Team Ai
Datasetpublic

semeru/text-code-galeras-code-generation-from-docstring-3k-deduped

sourceHugging Faceupdated 3y agoView on Hugging Face
0likes607downloads
code_generation_from_docstring_dataset_3k_deduped.json91049 linesDownload Raw Back to root
1[2    {3        "id": 232037,4        "commit_id": "43e3a4011080911901176aab919c0ecf5046ddd3",5        "repo": "plotly.py",6        "path": "packages/python/plotly/plotly/graph_objs/layout/mapbox/_layer.py",7        "file_name": "_layer.py",8        "fun_name": "minzoom",9        "commit_message": "switch to black .22",10        "code": "def minzoom(self):\n        \n        return self[\"minzoom\"]\n",11        "url": "https://github.com/plotly/plotly.py.git",12        "language": "Python",13        "ast_errors": "",14        "n_ast_errors": 0,15        "ast_levels": 7,16        "n_whitespaces": 18,17        "n_words": 4,18        "vocab_size": 4,19        "complexity": 1,20        "nloc": 2,21        "token_counts": 11,22        "n_ast_nodes": 22,23        "n_identifiers": 2,24        "d_id": 63481,25        "documentation": {26            "docstring": "\n        Sets the minimum zoom level (mapbox.layer.minzoom). At zoom\n        levels less than the minzoom, the layer will be hidden.\n\n        The 'minzoom' property is a number and may be specified as:\n          - An int or float in the interval [0, 24]\n\n        Returns\n        -------\n        int|float\n        ",27            "n_words": 42,28            "vocab_size": 37,29            "n_whitespaces": 101,30            "language": "en"31        }32    },33    {34        "id": 196771,35        "commit_id": "f757f3daae6e11ea0cfb7dadc133274d8d74315f",36        "repo": "sympy",37        "path": "sympy/concrete/summations.py",38        "file_name": "summations.py",39        "fun_name": "telescopic",40        "commit_message": "Reordered imports 2",41        "code": "def telescopic(L, R, limits):\n    \n    (i, a, b) = limits\n    if L.is_Add or R.is_Add:\n        return None\n\n    # We want to solve(L.subs(i, i + m) + R, m)\n    # First we try a simple match since this does things that\n    # solve doesn't do, e.g. solve(f(k+m)-f(k), m) fails\n\n    k = Wild(\"k\")\n    sol = (-R).match(L.subs(i, i + k))\n    s = None\n    if sol and k in sol:\n        s = sol[k]\n        if not (s.is_Integer and L.subs(i, i + s) == -R):\n            # sometimes match fail(f(x+2).match(-f(x+k))->{k: -2 - 2x}))\n            s = None\n\n    # But there are things that match doesn't do that solve\n    # can do, e.g. determine that 1/(x + m) = 1/(1 - x) when m = 1\n\n    if s is None:\n        m = Dummy('m')\n        try:\n            from sympy.solvers.solvers import solve\n            sol = solve(L.subs(i, i + m) + R, m) or []\n        except NotImplementedError:\n            return None\n        sol = [si for si in sol if si.is_Integer and\n               (L.subs(i, i + si) + R).expand().is_zero]\n        if len(sol) != 1:\n            return None\n        s = sol[0]\n\n    if s < 0:\n        return telescopic_direct(R, L, abs(s), (i, a, b))\n    elif s > 0:\n        return telescopic_direct(L, R, s, (i, a, b))\n\n",42        "url": "https://github.com/sympy/sympy.git",43        "language": "Python",44        "ast_errors": "",45        "n_ast_errors": 0,46        "ast_levels": 19,47        "n_whitespaces": 391,48        "n_words": 189,49        "vocab_size": 104,50        "complexity": 16,51        "nloc": 27,52        "token_counts": 242,53        "n_ast_nodes": 374,54        "n_identifiers": 27,55        "d_id": 48161,56        "documentation": {57            "docstring": "\n    Tries to perform the summation using the telescopic property.\n\n    Return None if not possible.\n    ",58            "n_words": 14,59            "vocab_size": 13,60            "n_whitespaces": 24,61            "language": "en"62        }63    },64    {65        "id": 230902,66        "commit_id": "43e3a4011080911901176aab919c0ecf5046ddd3",67        "repo": "plotly.py",68        "path": "packages/python/plotly/plotly/graph_objs/layout/_annotation.py",69        "file_name": "_annotation.py",70        "fun_name": "startarrowsize",71        "commit_message": "switch to black .22",72        "code": "def startarrowsize(self):\n        \n        return self[\"startarrowsize\"]\n",73        "url": "https://github.com/plotly/plotly.py.git",74        "language": "Python",75        "ast_errors": "",76        "n_ast_errors": 0,77        "ast_levels": 7,78        "n_whitespaces": 18,79        "n_words": 4,80        "vocab_size": 4,81        "complexity": 1,82        "nloc": 2,83        "token_counts": 11,84        "n_ast_nodes": 22,85        "n_identifiers": 2,86        "d_id": 62575,87        "documentation": {88            "docstring": "\n        Sets the size of the start annotation arrow head, relative to\n        `arrowwidth`. A value of 1 (default) gives a head about 3x as\n        wide as the line.\n\n        The 'startarrowsize' property is a number and may be specified as:\n          - An int or float in the interval [0.3, inf]\n\n        Returns\n        -------\n        int|float\n        ",89            "n_words": 51,90            "vocab_size": 45,91            "n_whitespaces": 117,92            "language": "en"93        }94    },95    {96        "id": 266879,97        "commit_id": "8b2e6285650ec42ec4a19075a8567047e8304ba2",98        "repo": "ansible",99        "path": "lib/ansible/galaxy/dependency_resolution/providers.py",100        "file_name": "providers.py",101        "fun_name": "get_dependencies",102        "commit_message": "galaxy - Clean up type hints and imports.",103        "code": "def get_dependencies(self, candidate):\n        # type: (Candidate) -> list[Candidate]\n        r\n        # FIXME: If there's several galaxy servers set, there may be a\n        # FIXME: situation when the metadata of the same collection\n        # FIXME: differs. So how do we resolve this case? Priority?\n        # FIXME: Taking into account a pinned hash? Exploding on\n        # FIXME: any differences?\n        # NOTE: The underlying implmentation currently uses first found\n        req_map = self._api_proxy.get_collection_dependencies(candidate)\n\n        # NOTE: This guard expression MUST perform an early exit only\n        # NOTE: after the `get_collection_dependencies()` call because\n        # NOTE: internally it polulates the artifact URL of the candidate,\n        # NOTE: its SHA hash and the Galaxy API token. These are still\n        # NOTE: necessary with `--no-deps` because even with the disabled\n        # NOTE: dependency resolution the outer layer will still need to\n        # NOTE: know how to download and validate the artifact.\n        #\n        # NOTE: Virtual candidates should always return dependencies\n        # NOTE: because they are ephemeral and non-installable.\n        if not self._with_deps and not candidate.is_virtual:\n            return []\n\n        return [\n            self._make_req_from_dict({'name': dep_name, 'version': dep_req})\n            for dep_name, dep_req in req_map.items()\n        ]\n",104        "url": "https://github.com/ansible/ansible.git",105        "language": "Python",106        "ast_errors": "",107        "n_ast_errors": 0,108        "ast_levels": 11,109        "n_whitespaces": 364,110        "n_words": 178,111        "vocab_size": 125,112        "complexity": 4,113        "nloc": 13,114        "token_counts": 60,115        "n_ast_nodes": 115,116        "n_identifiers": 12,117        "d_id": 78638,118        "documentation": {119            "docstring": "Get direct dependencies of a candidate.\n\n        :returns: A collection of requirements that `candidate` \\\n                  specifies as its dependencies.\n        ",120            "n_words": 18,121            "vocab_size": 17,122            "n_whitespaces": 49,123            "language": "en"124        }125    },126    {127        "id": 159564,128        "commit_id": "e798bf049f036a5865c14d4343ed8a833864aabe",129        "repo": "rasa",130        "path": "rasa/shared/core/trackers.py",131        "file_name": "trackers.py",132        "fun_name": "active_loop_name",133        "commit_message": "convert TrackerActiveLoop to a dataclass",134        "code": "def active_loop_name(self) -> Optional[Text]:\n        \n        if not self.active_loop or self.active_loop.name == SHOULD_NOT_BE_SET:\n            return None\n\n        return self.active_loop.name\n",135        "url": "https://github.com/RasaHQ/rasa.git",136        "language": "Python",137        "ast_errors": "",138        "n_ast_errors": 0,139        "ast_levels": 9,140        "n_whitespaces": 47,141        "n_words": 15,142        "vocab_size": 13,143        "complexity": 3,144        "nloc": 8,145        "token_counts": 33,146        "n_ast_nodes": 54,147        "n_identifiers": 7,148        "d_id": 38336,149        "documentation": {150            "docstring": "Get the name of the currently active loop.\n\n        Returns: `None` if no active loop or the name of the currently active loop.\n        ",151            "n_words": 22,152            "vocab_size": 13,153            "n_whitespaces": 36,154            "language": "en"155        }156    },157    {158        "id": 262246,159        "commit_id": "00c7600103ee34ac50506af88f1b34b713f849e7",160        "repo": "TTS",161        "path": "TTS/tts/models/vits.py",162        "file_name": "vits.py",163        "fun_name": "get_lr",164        "commit_message": "Update Vits model API",165        "code": "def get_lr(self) -> List:\n        \n        return [self.config.lr_disc, self.config.lr_gen]\n",166        "url": "https://github.com/coqui-ai/TTS.git",167        "language": "Python",168        "ast_errors": "",169        "n_ast_errors": 0,170        "ast_levels": 8,171        "n_whitespaces": 21,172        "n_words": 7,173        "vocab_size": 7,174        "complexity": 1,175        "nloc": 7,176        "token_counts": 22,177        "n_ast_nodes": 36,178        "n_identifiers": 6,179        "d_id": 77157,180        "documentation": {181            "docstring": "Set the initial learning rates for each optimizer.\n\n        Returns:\n            List: learning rates for each optimizer.\n        ",182            "n_words": 15,183            "vocab_size": 10,184            "n_whitespaces": 40,185            "language": "en"186        }187    },188    {189        "id": 80333,190        "commit_id": "a4a3ba65d736045733cb49430d7076b73aec23bb",191        "repo": "awx",192        "path": "awx/main/tasks/receptor.py",193        "file_name": "receptor.py",194        "fun_name": "_convert_args_to_cli",195        "commit_message": "Refactored tasks.py to a package\n--- Added 3 new sub-package : awx.main.tasks.system , awx.main.tasks.jobs , awx.main.tasks.receptor\n--- Modified the functional tests and unit tests accordingly",196        "code": "def _convert_args_to_cli(vargs):\n    \n    args = ['cleanup']\n    for option in ('exclude_strings', 'remove_images'):\n        if vargs.get(option):\n            args.append('--{}={}'.format(option.replace('_', '-'), ' '.join(vargs.get(option))))\n    for option in ('file_pattern', 'image_prune', 'process_isolation_executable', 'grace_period'):\n        if vargs.get(option) is True:\n            args.append('--{}'.format(option.replace('_', '-')))\n        elif vargs.get(option) not in (None, ''):\n            args.append('--{}={}'.format(option.replace('_', '-'), vargs.get(option)))\n    return args\n\n",197        "url": "https://github.com/ansible/awx.git",198        "language": "Python",199        "ast_errors": "",200        "n_ast_errors": 0,201        "ast_levels": 17,202        "n_whitespaces": 109,203        "n_words": 40,204        "vocab_size": 31,205        "complexity": 6,206        "nloc": 11,207        "token_counts": 141,208        "n_ast_nodes": 251,209        "n_identifiers": 9,210        "d_id": 17051,211        "documentation": {212            "docstring": "\n    For the ansible-runner worker cleanup command\n    converts the dictionary (parsed argparse variables) used for python interface\n    into a string of CLI options, which has to be used on execution nodes.\n    ",213            "n_words": 30,214            "vocab_size": 28,215            "n_whitespaces": 43,216            "language": "en"217        }218    },219    {220        "id": 189683,221        "commit_id": "e040bcacd38378386749db18aeba575b93f4ebca",222        "repo": "manim",223        "path": "manim/mobject/geometry/line.py",224        "file_name": "line.py",225        "fun_name": "get_normal_vector",226        "commit_message": "Improved structure of the :mod:`.mobject` module (#2476)\n\n* group graphing and update its references\r\n\r\n* group text and update its references\r\n\r\n* group opengl and update its references\r\n\r\n* group three_d and update its references\r\n\r\n* group geometry and update (most) references\r\n\r\n* move some chaning.py + updater files  into animation\r\n\r\n* refactor arc.py\r\n\r\n* refactor line.py\r\n\r\n* refactor polygram.py\r\n\r\n* refactor tips.py\r\n\r\n* black + isort\r\n\r\n* import new files in __init__.py\r\n\r\n* refactor places where geometry was used\r\n\r\n* black + isort again\r\n\r\n* remove unused imports\r\n\r\n* update reference.rst\r\n\r\n* add descriptions to files\r\n\r\n* fix circular imports\r\n\r\n* forgot ArrowTip\r\n\r\n* fix tests\r\n\r\n* fix doctests\r\n\r\n* satisfy mypy?\r\n\r\n* [pre-commit.ci] auto fixes from pre-commit.com hooks\r\n\r\nfor more information, see https://pre-commit.ci\r\n\r\n* fix ALL merge conflicts\r\n\r\n* [pre-commit.ci] auto fixes from pre-commit.com hooks\r\n\r\nfor more information, see https://pre-commit.ci\r\n\r\n* [pre-commit.ci] auto fixes from pre-commit.com hooks\r\n\r\nfor more information, see https://pre-commit.ci\r\n\r\n* [pre-commit.ci] auto fixes from pre-commit.com hooks\r\n\r\nfor more information, see https://pre-commit.ci\r\n\r\n* one VMobject import slipped through\r\n\r\n* [pre-commit.ci] auto fixes from pre-commit.com hooks\r\n\r\nfor more information, see https://pre-commit.ci\r\n\r\n* re-add imports to `manim/opengl/__init__.py`\r\n\r\n* [pre-commit.ci] auto fixes from pre-commit.com hooks\r\n\r\nfor more information, see https://pre-commit.ci\r\n\r\n* fix reference manual\r\n\r\n* [pre-commit.ci] auto fixes from pre-commit.com hooks\r\n\r\nfor more information, see https://pre-commit.ci\r\n\r\n* ignore unknown directive type\r\n\r\n* fix arrow tip imports in docstrings\r\n\r\nCo-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>\r\nCo-authored-by: Benjamin Hackl <devel@benjamin-hackl.at>",227        "code": "def get_normal_vector(self) -> np.ndarray:\n        \n\n        p0, p1, p2 = self.tip.get_start_anchors()[:3]\n        return normalize(np.cross(p2 - p1, p1 - p0))\n",228        "url": "https://github.com/ManimCommunity/manim.git",229        "language": "Python",230        "ast_errors": "",231        "n_ast_errors": 0,232        "ast_levels": 10,233        "n_whitespaces": 37,234        "n_words": 16,235        "vocab_size": 14,236        "complexity": 1,237        "nloc": 12,238        "token_counts": 43,239        "n_ast_nodes": 69,240        "n_identifiers": 11,241        "d_id": 46164,242        "documentation": {243            "docstring": "Returns the normal of a vector.\n\n        Examples\n        --------\n        ::\n\n            >>> np.round(Arrow().get_normal_vector()) + 0. # add 0. to avoid negative 0 in output\n            array([ 0.,  0., -1.])\n        ",244            "n_words": 26,245            "vocab_size": 24,246            "n_whitespaces": 77,247            "language": "en"248        }249    },250    {251        "id": 66352,252        "commit_id": "494bd9ef78313436f0424b918f200dab8fc7c20b",253        "repo": "erpnext",254        "path": "erpnext/loan_management/report/loan_interest_report/loan_interest_report.py",255        "file_name": "loan_interest_report.py",256        "fun_name": "get_loan_wise_pledges",257        "commit_message": "style: format code with black",258        "code": "def get_loan_wise_pledges(filters):\n\tloan_wise_unpledges = {}\n\tcurrent_pledges = {}\n\n\tconditions = \"\"\n\n\tif filters.get(\"company\"):\n\t\tconditions = \"AND company = %(company)s\"\n\n\tunpledges = frappe.db.sql(\n\t\t.format(\n\t\t\tconditions=conditions\n\t\t),\n\t\tfilters,\n\t\tas_dict=1,\n\t)\n\n\tfor unpledge in unpledges:\n\t\tloan_wise_unpledges.setdefault((unpledge.loan, unpledge.loan_security), unpledge.qty)\n\n\tpledges = frappe.db.sql(\n\t\t.format(\n\t\t\tconditions=conditions\n\t\t),\n\t\tfilters,\n\t\tas_dict=1,\n\t)\n\n\tfor security in pledges:\n\t\tcurrent_pledges.setdefault((security.loan, security.loan_security), security.qty)\n\t\tcurrent_pledges[(security.loan, security.loan_security)] -= loan_wise_unpledges.get(\n\t\t\t(security.loan, security.loan_security), 0.0\n\t\t)\n\n\treturn current_pledges\n\n",259        "url": "https://github.com/frappe/erpnext.git",260        "language": "Python",261        "ast_errors": "",262        "n_ast_errors": 0,263        "ast_levels": 12,264        "n_whitespaces": 33,265        "n_words": 61,266        "vocab_size": 41,267        "complexity": 4,268        "nloc": 42,269        "token_counts": 154,270        "n_ast_nodes": 236,271        "n_identifiers": 19,272        "d_id": 14173,273        "documentation": {274            "docstring": "\n\t\tSELECT up.loan, u.loan_security, sum(u.qty) as qty\n\t\tFROM `tabLoan Security Unpledge` up, `tabUnpledge` u\n\t\tWHERE u.parent = up.name\n\t\tAND up.status = 'Approved'\n\t\t{conditions}\n\t\tGROUP BY up.loan, u.loan_security\n\t\n\t\tSELECT lp.loan, p.loan_security, sum(p.qty) as qty\n\t\tFROM `tabLoan Security Pledge` lp, `tabPledge`p\n\t\tWHERE p.parent = lp.name\n\t\tAND lp.status = 'Pledged'\n\t\t{conditions}\n\t\tGROUP BY lp.loan, p.loan_security\n\t",275            "n_words": 51,276            "vocab_size": 35,277            "n_whitespaces": 39,278            "language": "en"279        }280    },281    {282        "id": 261494,283        "commit_id": "bb080aa690364d84d11232c73dc8db2f0dde3578",284        "repo": "scikit-learn",285        "path": "sklearn/linear_model/_logistic.py",286        "file_name": "_logistic.py",287        "fun_name": "_check_multi_class",288        "commit_message": "ENH add newton-cholesky solver to LogisticRegression (#24767)",289        "code": "def _check_multi_class(multi_class, solver, n_classes):\n    \n    if multi_class == \"auto\":\n        if solver in (\"liblinear\", \"newton-cholesky\"):\n            multi_class = \"ovr\"\n        elif n_classes > 2:\n            multi_class = \"multinomial\"\n        else:\n            multi_class = \"ovr\"\n    if multi_class == \"multinomial\" and solver in (\"liblinear\", \"newton-cholesky\"):\n        raise ValueError(\"Solver %s does not support a multinomial backend.\" % solver)\n    return multi_class\n\n",290        "url": "https://github.com/scikit-learn/scikit-learn.git",291        "language": "Python",292        "ast_errors": "",293        "n_ast_errors": 0,294        "ast_levels": 12,295        "n_whitespaces": 122,296        "n_words": 49,297        "vocab_size": 33,298        "complexity": 6,299        "nloc": 11,300        "token_counts": 62,301        "n_ast_nodes": 118,302        "n_identifiers": 5,303        "d_id": 76838,304        "documentation": {305            "docstring": "Computes the multi class type, either \"multinomial\" or \"ovr\".\n\n    For `n_classes` > 2 and a solver that supports it, returns \"multinomial\".\n    For all other cases, in particular binary classification, return \"ovr\".\n    ",306            "n_words": 31,307            "vocab_size": 29,308            "n_whitespaces": 40,309            "language": "en"310        }311    },312    {313        "id": 66953,314        "commit_id": "494bd9ef78313436f0424b918f200dab8fc7c20b",315        "repo": "erpnext",316        "path": "erpnext/payroll/report/salary_payments_based_on_payment_mode/salary_payments_based_on_payment_mode.py",317        "file_name": "salary_payments_based_on_payment_mode.py",318        "fun_name": "get_data",319        "commit_message": "style: format code with black",320        "code": "def get_data(filters, mode_of_payments):\n\tdata = []\n\n\tconditions = get_conditions(filters)\n\n\tentry = frappe.db.sql(\n\t\t\n\t\t% (conditions),\n\t\tas_dict=1,\n\t)\n\n\tbranch_wise_entries, gross_pay = prepare_data(entry)\n\n\tbranches = frappe.db.sql_list(\n\t\t\n\t\t% (conditions)\n\t)\n\n\ttotal_row = {\"total\": 0, \"branch\": \"Total\"}\n\n\tfor branch in branches:\n\t\ttotal = 0\n\t\trow = {\"branch\": branch}\n\t\tfor mode in mode_of_payments:\n\t\t\tif branch_wise_entries.get(branch).get(mode):\n\t\t\t\trow[mode] = branch_wise_entries.get(branch).get(mode)\n\t\t\t\ttotal += branch_wise_entries.get(branch).get(mode)\n\n\t\trow[\"total\"] = total\n\t\tdata.append(row)\n\n\ttotal_row = get_total_based_on_mode_of_payment(data, mode_of_payments)\n\ttotal_deductions = gross_pay - total_row.get(\"total\")\n\n\treport_summary = []\n\n\tif data:\n\t\tdata.append(total_row)\n\t\tdata.append({})\n\t\tdata.append({\"branch\": \"<b>Total Gross Pay</b>\", mode_of_payments[0]: gross_pay})\n\t\tdata.append({\"branch\": \"<b>Total Deductions</b>\", mode_of_payments[0]: total_deductions})\n\t\tdata.append({\"branch\": \"<b>Total Net Pay</b>\", mode_of_payments[0]: total_row.get(\"total\")})\n\n\t\tcurrency = erpnext.get_company_currency(filters.company)\n\t\treport_summary = get_report_summary(\n\t\t\tgross_pay, total_deductions, total_row.get(\"total\"), currency\n\t\t)\n\n\treturn data, total_row, report_summary\n\n",321        "url": "https://github.com/frappe/erpnext.git",322        "language": "Python",323        "ast_errors": "",324        "n_ast_errors": 0,325        "ast_levels": 16,326        "n_whitespaces": 72,327        "n_words": 107,328        "vocab_size": 71,329        "complexity": 5,330        "nloc": 45,331        "token_counts": 270,332        "n_ast_nodes": 448,333        "n_identifiers": 31,334        "d_id": 14387,335        "documentation": {336            "docstring": "\n\t\tselect branch, mode_of_payment, sum(net_pay) as net_pay, sum(gross_pay) as gross_pay\n\t\tfrom `tabSalary Slip` sal\n\t\twhere docstatus = 1 %s\n\t\tgroup by branch, mode_of_payment\n\t\t\n\t\tselect distinct branch from `tabSalary Slip` sal\n\t\twhere docstatus = 1 %s\n\t",337            "n_words": 34,338            "vocab_size": 22,339            "n_whitespaces": 28,340            "language": "en"341        }342    },343    {344        "id": 74706,345        "commit_id": "d10f15e55806c6944827d801cd9c2d53f5da4186",346        "repo": "wagtail",347        "path": "wagtail/core/whitelist.py",348        "file_name": "whitelist.py",349        "fun_name": "attribute_rule",350        "commit_message": "Reformat with black",351        "code": "def attribute_rule(allowed_attrs):\n    \n",352        "url": "https://github.com/wagtail/wagtail.git",353        "language": "Python",354        "ast_errors": "",355        "n_ast_errors": 0,356        "ast_levels": 6,357        "n_whitespaces": 5,358        "n_words": 2,359        "vocab_size": 2,360        "complexity": 1,361        "nloc": 3,362        "token_counts": 10,363        "n_ast_nodes": 13,364        "n_identifiers": 2,365        "d_id": 16302,366        "documentation": {367            "docstring": "\n    Generator for functions that can be used as entries in Whitelister.element_rules.\n    These functions accept a tag, and modify its attributes by looking each attribute\n    up in the 'allowed_attrs' dict defined here:\n    * if the lookup fails, drop the attribute\n    * if the lookup returns a callable, replace the attribute with the result of calling\n      it - e.g. {'title': uppercase} will replace 'title' with the result of uppercasing\n      the title. If the callable returns None, the attribute is dropped\n    * if the lookup returns a truthy value, keep the attribute; if falsy, drop it\n    ",368            "n_words": 93,369            "vocab_size": 60,370            "n_whitespaces": 125,371            "language": "en"372        }373    },374    {375        "id": 87145,376        "commit_id": "fe07466a1449a5ae60526528ce7bf9399b59b47d",377        "repo": "sentry",378        "path": "src/sentry/region_to_control/producer.py",379        "file_name": "producer.py",380        "fun_name": "get_region_to_control_producer",381        "commit_message": "chore(hybrid-cloud): Extract region to control silo into service abstraction (#40353)\n\n1. Use the `silo_mode_delegator` to make the silo conditional sensitive\r\nlogic of region to control processing like other services that need to\r\nbe conditional based on deployment.\r\n2. Leverage the lifecycle management offered by the\r\n`DelegatedBySiloMode` to stop arroyo kafka producer between tests or\r\nafter test failures (rather than requiring explicit test fixture clean\r\nup, it's now 'implicit' to the lifecycle of the mocks introduced at the\r\ntop level).\r\n3. Add default mocks for the region to control kafka producer so that\r\nmost tests do not require kafka running (also improves performance\r\nsignificantly). There is still the integration test that uses the real\r\nproducer.\r\n4. *Attempt* to fix ModuleDeadlock error with more granular importing. I\r\ncould not reproduce this issue locally, unfortunately, so this is a best\r\neffort attempt to reduce any circular import possibilities.\r\n\r\nCo-authored-by: getsantry[bot] <66042841+getsantry[bot]@users.noreply.github.com>",382        "code": "def get_region_to_control_producer(self) -> KafkaProducer:\n        \n        if self._publisher is None:\n            config = settings.KAFKA_TOPICS.get(settings.KAFKA_REGION_TO_CONTROL)\n            self._publisher = KafkaProducer(\n                kafka_config.get_kafka_producer_cluster_options(config[\"cluster\"])\n            )\n",383        "url": "https://github.com/getsentry/sentry.git",384        "language": "Python",385        "ast_errors": "",386        "n_ast_errors": 0,387        "ast_levels": 14,388        "n_whitespaces": 78,389        "n_words": 16,390        "vocab_size": 14,391        "complexity": 2,392        "nloc": 13,393        "token_counts": 53,394        "n_ast_nodes": 73,395        "n_identifiers": 11,396        "d_id": 18234,397        "documentation": {398            "docstring": "\n        Creates, if necessary, an arroyo.KafkaProducer client configured for region to control communication and returns\n        it, caching it for future calls.  Installs an exit handler to close the worker thread processes.\n        ",399            "n_words": 30,400            "vocab_size": 27,401            "n_whitespaces": 53,402            "language": "en"403        }404    },405    {406        "id": 63636,407        "commit_id": "f638f5d0e6c8ebed0e69a6584bc7f003ec646580",408        "repo": "transferlearning",409        "path": ".venv/lib/python3.8/site-packages/pip/_vendor/requests/utils.py",410        "file_name": "utils.py",411        "fun_name": "dict_from_cookiejar",412        "commit_message": "upd; format",413        "code": "def dict_from_cookiejar(cj):\n    \n\n    cookie_dict = {}\n\n    for cookie in cj:\n        cookie_dict[cookie.name] = cookie.value\n\n    return cookie_dict\n\n",414        "url": "https://github.com/jindongwang/transferlearning.git",415        "language": "Python",416        "ast_errors": "",417        "n_ast_errors": 0,418        "ast_levels": 10,419        "n_whitespaces": 33,420        "n_words": 14,421        "vocab_size": 12,422        "complexity": 2,423        "nloc": 5,424        "token_counts": 27,425        "n_ast_nodes": 45,426        "n_identifiers": 6,427        "d_id": 13432,428        "documentation": {429            "docstring": "Returns a key/value dictionary from a CookieJar.\n\n    :param cj: CookieJar object to extract cookies from.\n    :rtype: dict\n    ",430            "n_words": 17,431            "vocab_size": 16,432            "n_whitespaces": 26,433            "language": "en"434        }435    },436    {437        "id": 195681,438        "commit_id": "d3c0fc825c4a80904a1fb9a2092137c3d9e0c3fe",439        "repo": "sympy",440        "path": "sympy/polys/numberfields/galoisgroups.py",441        "file_name": "galoisgroups.py",442        "fun_name": "galois_group",443        "commit_message": "Add a `galois_group()` function",444        "code": "def galois_group(T, max_tries=30, randomize=False):\n    r\n    from sympy.combinatorics.named_groups import CyclicGroup\n    gg = {\n        3: _galois_group_degree_3,\n        4: _galois_group_degree_4,\n        5: _galois_group_degree_5,\n    }\n    max_supported = max(gg.keys())\n    n = T.degree()\n    if n > max_supported:\n        raise ValueError(f\"Only polynomials up to degree {max_supported} are supported.\")\n    if n < 1:\n        raise ValueError(\"Constant polynomial has no Galois group.\")\n    if n < 3:\n        return (CyclicGroup(n), n == 1)\n    return gg[n](T, max_tries=max_tries, randomize=randomize)\n",445        "url": "https://github.com/sympy/sympy.git",446        "language": "Python",447        "ast_errors": "",448        "n_ast_errors": 0,449        "ast_levels": 11,450        "n_whitespaces": 133,451        "n_words": 62,452        "vocab_size": 50,453        "complexity": 4,454        "nloc": 52,455        "token_counts": 109,456        "n_ast_nodes": 171,457        "n_identifiers": 18,458        "d_id": 47364,459        "documentation": {460            "docstring": "\n    Compute the Galois group for polynomials *T* up to degree 5.\n\n    Parameters\n    ==========\n\n    T : Poly\n        Irreducible, monic polynomial over :ref:`ZZ`, whose Galois group\n        is to be determined.\n    max_tries : int, default 30\n        Make at most this many attempts in those steps that involve\n        generating Tschirnhausen transformations.\n    randomize : bool, default False\n        If ``True``, then use random coefficients when generating Tschirnhausen\n        transformations. Otherwise try transformations in a fixed order,\n        starting with small coefficients and degrees and working upward.\n\n    Returns\n    =======\n\n    Pair ``(PermutationGroup, bool)``\n        The first element is the Galois group, and the second says whether the\n        group is contained in the alternating group $A_n$ ($n$ the degree of\n        *T*).\n\n    Raises\n    ======\n\n    ValueError\n        if *T* is of an unsupported degree.\n\n    MaxTriesException\n        if could not complete before exceeding *max_tries* in those steps\n        that involve generating Tschirnhausen transformations.\n\n    ",461            "n_words": 135,462            "vocab_size": 98,463            "n_whitespaces": 269,464            "language": "en"465        }466    },467    {468        "id": 219892,469        "commit_id": "8198943edd73a363c266633e1aa5b2a9e9c9f526",470        "repo": "XX-Net",471        "path": "python3.10.4/Lib/_pyio.py",472        "file_name": "_pyio.py",473        "fun_name": "seek",474        "commit_message": "add python 3.10.4 for windows",475        "code": "def seek(self, pos, whence=SEEK_SET):\n        \n        if isinstance(pos, float):\n            raise TypeError('an integer is required')\n        self._checkClosed()\n        return os.lseek(self._fd, pos, whence)\n",476        "url": "https://github.com/XX-net/XX-Net.git",477        "language": "Python",478        "ast_errors": "",479        "n_ast_errors": 0,480        "ast_levels": 10,481        "n_whitespaces": 56,482        "n_words": 17,483        "vocab_size": 16,484        "complexity": 2,485        "nloc": 5,486        "token_counts": 43,487        "n_ast_nodes": 69,488        "n_identifiers": 12,489        "d_id": 55884,490        "documentation": {491            "docstring": "Move to new file position.\n\n        Argument offset is a byte count.  Optional argument whence defaults to\n        SEEK_SET or 0 (offset from start of file, offset should be >= 0); other values\n        are SEEK_CUR or 1 (move relative to current position, positive or negative),\n        and SEEK_END or 2 (move relative to end of file, usually negative, although\n        many platforms allow seeking beyond the end of a file).\n\n        Note that not all file objects are seekable.\n        ",492            "n_words": 74,493            "vocab_size": 58,494            "n_whitespaces": 124,495            "language": "en"496        }497    },498    {499        "id": 154492,500        "commit_id": "d6d503ac7c3028d871c34d9e99e925ddb0746df6",501        "repo": "modin",502        "path": "modin/core/execution/dask/implementations/pandas_on_dask/partitioning/virtual_partition.py",503        "file_name": "virtual_partition.py",504        "fun_name": "deploy_dask_func",505        "commit_message": "FIX-#4597: Refactor Partition handling of func, args, kwargs (#4715)\n\nCo-authored-by: Iaroslav Igoshev <Poolliver868@mail.ru>\r\nSigned-off-by: Jonathan Shi <jhshi@ponder.io>",506        "code": "def deploy_dask_func(deployer, axis, f_to_deploy, f_args, f_kwargs, *args, **kwargs):\n    \n    result = deployer(axis, f_to_deploy, f_args, f_kwargs, *args, **kwargs)\n    ip = get_ip()\n    if isinstance(result, pandas.DataFrame):\n        return result, len(result), len(result.columns), ip\n    elif all(isinstance(r, pandas.DataFrame) for r in result):\n        return [i for r in result for i in [r, len(r), len(r.columns), ip]]\n    else:\n        return [i for r in result for i in [r, None, None, ip]]\n",507        "url": "https://github.com/modin-project/modin.git",508        "language": "Python",509        "ast_errors": "",510        "n_ast_errors": 0,511        "ast_levels": 14,512        "n_whitespaces": 100,513        "n_words": 61,514        "vocab_size": 36,515        "complexity": 8,516        "nloc": 9,517        "token_counts": 136,518        "n_ast_nodes": 192,519        "n_identifiers": 19,520        "d_id": 36015,521        "documentation": {522            "docstring": "\n    Execute a function on an axis partition in a worker process.\n\n    This is ALWAYS called on either ``PandasDataframeAxisPartition.deploy_axis_func``\n    or ``PandasDataframeAxisPartition.deploy_func_between_two_axis_partitions``, which both\n    serve to deploy another dataframe function on a Dask worker process.\n\n    Parameters\n    ----------\n    deployer : callable\n        A `PandasDataFrameAxisPartition.deploy_*` method that will call `deploy_f`.\n    axis : {0, 1}\n        The axis to perform the function along.\n    f_to_deploy : callable or RayObjectID\n        The function to deploy.\n    f_args : list or tuple\n        Positional arguments to pass to ``f_to_deploy``.\n    f_kwargs : dict\n        Keyword arguments to pass to ``f_to_deploy``.\n    *args : list\n        Positional arguments to pass to ``func``.\n    **kwargs : dict\n        Keyword arguments to pass to ``func``.\n\n    Returns\n    -------\n    list\n        The result of the function ``func`` and metadata for it.\n    ",523            "n_words": 116,524            "vocab_size": 69,525            "n_whitespaces": 224,526            "language": "en"527        }528    },529    {530        "id": 46862,531        "commit_id": "bca849b4586c7446438f959b62903da4b997b9ea",532        "repo": "airflow",533        "path": "dev/breeze/src/airflow_breeze/utils/path_utils.py",534        "file_name": "path_utils.py",535        "fun_name": "get_used_airflow_sources",536        "commit_message": "Switch to `pipx` as the only installation Breeze2 method (#22740)\n\nSwitching Breeze2 to only use `pipx` for installation of Breeze2\r\ndue to problems it might cause for autocompletion if entrypoint\r\nis not avaiable on PATH.",537        "code": "def get_used_airflow_sources() -> Path:\n    \n    current_sources = search_upwards_for_airflow_sources_root(Path.cwd())\n    if current_sources is None:\n        current_sources = get_installation_airflow_sources()\n        if current_sources is None:\n            warn_non_editable()\n            sys.exit(1)\n    return current_sources\n\n\n@lru_cache(maxsize=None)",538        "url": "https://github.com/apache/airflow.git",539        "language": "Python",540        "ast_errors": "@lru_cache(maxsize=None)",541        "n_ast_errors": 1,542        "ast_levels": 11,543        "n_whitespaces": 70,544        "n_words": 23,545        "vocab_size": 15,546        "complexity": 3,547        "nloc": 13,548        "token_counts": 43,549        "n_ast_nodes": 88,550        "n_identifiers": 11,551        "d_id": 9023,552        "documentation": {553            "docstring": "\n    Retrieves the Root of used Airflow Sources which we operate on. Those are either Airflow sources found\n    upwards in directory tree or sources where Breeze was installed from.\n    :return: the Path for Airflow sources we use.\n    ",554            "n_words": 36,555            "vocab_size": 30,556            "n_whitespaces": 49,557            "language": "en"558        }559    },560    {561        "id": 105894,562        "commit_id": "0d9c12ad5155c6d505e70813a07c0aecd7120405",563        "repo": "datasets",564        "path": "tests/utils.py",565        "file_name": "utils.py",566        "fun_name": "require_spacy_model",567        "commit_message": "Make torch.Tensor and spacy models cacheable (#5191)\n\n* Make torch.Tensor and spacy models cacheable\r\n\r\n* Use newest models\r\n\r\n* Address comments\r\n\r\n* Small optim",568        "code": "def require_spacy_model(model):\n    \n",569        "url": "https://github.com/huggingface/datasets.git",570        "language": "Python",571        "ast_errors": "",572        "n_ast_errors": 0,573        "ast_levels": 6,574        "n_whitespaces": 5,575        "n_words": 2,576        "vocab_size": 2,577        "complexity": 1,578        "nloc": 3,579        "token_counts": 10,580        "n_ast_nodes": 13,581        "n_identifiers": 2,582        "d_id": 22215,583        "documentation": {584            "docstring": "\n    Decorator marking a test that requires a spacy model.\n\n    These tests are skipped when they aren't installed.\n    ",585            "n_words": 17,586            "vocab_size": 16,587            "n_whitespaces": 27,588            "language": "en"589        }590    },591    {592        "id": 176426,593        "commit_id": "f11068c0115ede0c7b631f771c10be7efd0b950b",594        "repo": "networkx",595        "path": "networkx/algorithms/polynomials.py",596        "file_name": "polynomials.py",597        "fun_name": "tutte_polynomial",598        "commit_message": "Add Tutte polynomial (#5265)\n\nAdd a new polynomial module to algorithms for characteristic polynomials.\r\nAdds the Tutte polynomial, which is computed and ultimate represented as a\r\nsympy expression.\r\n\r\nCo-authored-by: Dan Schult <dschult@colgate.edu>\r\nCo-authored-by: Ross Barnowski <rossbar@berkeley.edu>",599        "code": "def tutte_polynomial(G):\n    r\n    import sympy\n\n    x = sympy.Symbol(\"x\")\n    y = sympy.Symbol(\"y\")\n    stack = deque()\n    stack.append(nx.MultiGraph(G))\n\n    polynomial = 0\n    while stack:\n        G = stack.pop()\n        bridges = set(nx.bridges(G))\n\n        e = None\n        for i in G.edges:\n            if (i[0], i[1]) not in bridges and i[0] != i[1]:\n                e = i\n                break\n        if not e:\n            loops = list(nx.selfloop_edges(G, keys=True))\n            polynomial += x ** len(bridges) * y ** len(loops)\n        else:\n            # deletion-contraction\n            C = nx.contracted_edge(G, e, self_loops=True)\n            C.remove_edge(e[0], e[0])\n            G.remove_edge(*e)\n            stack.append(G)\n            stack.append(C)\n    return sympy.simplify(polynomial)\n",600        "url": "https://github.com/networkx/networkx.git",601        "language": "Python",602        "ast_errors": "",603        "n_ast_errors": 0,604        "ast_levels": 15,605        "n_whitespaces": 275,606        "n_words": 78,607        "vocab_size": 59,608        "complexity": 6,609        "nloc": 142,610        "token_counts": 195,611        "n_ast_nodes": 314,612        "n_identifiers": 28,613        "d_id": 41889,614        "documentation": {615            "docstring": "Returns the Tutte polynomial of `G`\n    \n    This function computes the Tutte polynomial via an iterative version of\n    the deletion-contraction algorithm.\n\n    The Tutte polynomial `T_G(x, y)` is a fundamental graph polynomial invariant in\n    two variables. It encodes a wide array of information related to the\n    edge-connectivity of a graph; \"Many problems about graphs can be reduced to\n    problems of finding and evaluating the Tutte polynomial at certain values\" [1]_.\n    In fact, every deletion-contraction-expressible feature of a graph is a\n    specialization of the Tutte polynomial [2]_ (see Notes for examples).\n\n    There are several equivalent definitions; here are three:\n\n    Def 1 (rank-nullity expansion): For `G` an undirected graph, `n(G)` the\n    number of vertices of `G`, `E` the edge set of `G`, `V` the vertex set of\n    `G`, and `c(A)` the number of connected components of the graph with vertex\n    set `V` and edge set `A` [3]_:\n\n    .. math::\n\n        T_G(x, y) = \\sum_{A \\in E} (x-1)^{c(A) - c(E)} (y-1)^{c(A) + |A| - n(G)}\n\n    Def 2 (spanning tree expansion): Let `G` be an undirected graph, `T` a spanning\n    tree of `G`, and `E` the edge set of `G`. Let `E` have an arbitrary strict\n    linear order `L`. Let `B_e` be the unique minimal nonempty edge cut of\n    $E \\setminus T \\cup {e}$. An edge `e` is internally active with respect to\n    `T` and `L` if `e` is the least edge in `B_e` according to the linear order\n    `L`. The internal activity of `T` (denoted `i(T)`) is the number of edges\n    in $E \\setminus T$ that are internally active with respect to `T` and `L`.\n    Let `P_e` be the unique path in $T \\cup {e}$ whose source and target vertex\n    are the same. An edge `e` is externally active with respect to `T` and `L`\n    if `e` is the least edge in `P_e` according to the linear order `L`. The\n    external activity of `T` (denoted `e(T)`) is the number of edges in\n    $E \\setminus T$ that are externally active with respect to `T` and `L`.\n    Then [4]_ [5]_:\n\n    .. math::\n\n        T_G(x, y) = \\sum_{T \\text{ a spanning tree of } G} x^{i(T)} y^{e(T)}\n\n    Def 3 (deletion-contraction recurrence): For `G` an undirected graph, `G-e`\n    the graph obtained from `G` by deleting edge `e`, `G/e` the graph obtained\n    from `G` by contracting edge `e`, `k(G)` the number of cut-edges of `G`,\n    and `l(G)` the number of self-loops of `G`:\n\n    .. math::\n        T_G(x, y) = \\begin{cases}\n    \t   x^{k(G)} y^{l(G)}, & \\text{if all edges are cut-edges or self-loops} \\\\\n           T_{G-e}(x, y) + T_{G/e}(x, y), & \\text{otherwise, for an arbitrary edge $e$ not a cut-edge or loop}\n        \\end{cases}\n\n    Parameters\n    ----------\n    G : NetworkX graph\n\n    Returns\n    -------\n    instance of `sympy.core.add.Add`\n        A Sympy expression representing the Tutte polynomial for `G`.\n\n    Examples\n    --------\n    >>> C = nx.cycle_graph(5)\n    >>> nx.tutte_polynomial(C)\n    x**4 + x**3 + x**2 + x + y\n\n    >>> D = nx.diamond_graph()\n    >>> nx.tutte_polynomial(D)\n    x**3 + 2*x**2 + 2*x*y + x + y**2 + y\n\n    Notes\n    -----\n    Some specializations of the Tutte polynomial:\n\n    - `T_G(1, 1)` counts the number of spanning trees of `G`\n    - `T_G(1, 2)` counts the number of connected spanning subgraphs of `G`\n    - `T_G(2, 1)` counts the number of spanning forests in `G`\n    - `T_G(0, 2)` counts the number of strong orientations of `G`\n    - `T_G(2, 0)` counts the number of acyclic orientations of `G`\n\n    Edge contraction is defined and deletion-contraction is introduced in [6]_.\n    Combinatorial meaning of the coefficients is introduced in [7]_.\n    Universality, properties, and applications are discussed in [8]_.\n\n    Practically, up-front computation of the Tutte polynomial may be useful when\n    users wish to repeatedly calculate edge-connectivity-related information\n    about one or more graphs.\n\n    References\n    ----------\n    .. [1] M. Brandt,\n       \"The Tutte Polynomial.\"\n       Talking About Combinatorial Objects Seminar, 2015\n       https://math.berkeley.edu/~brandtm/talks/tutte.pdf\n    .. [2] A. Bjรถrklund, T. Husfeldt, P. Kaski, M. Koivisto,\n       \"Computing the Tutte polynomial in vertex-exponential time\"\n       49th Annual IEEE Symposium on Foundations of Computer Science, 2008\n       https://ieeexplore.ieee.org/abstract/document/4691000\n    .. [3] Y. Shi, M. Dehmer, X. Li, I. Gutman,\n       \"Graph Polynomials,\" p. 14\n    .. [4] Y. Shi, M. Dehmer, X. Li, I. Gutman,\n       \"Graph Polynomials,\" p. 46\n    .. [5] A. Neลกetril, J. Goodall,\n       \"Graph invariants, homomorphisms, and the Tutte polynomial\"\n       https://iuuk.mff.cuni.cz/~andrew/Tutte.pdf\n    .. [6] D. B. West,\n       \"Introduction to Graph Theory,\" p. 84\n    .. [7] G. Coutinho,\n       \"A brief introduction to the Tutte polynomial\"\n       Structural Analysis of Complex Networks, 2011\n       https://homepages.dcc.ufmg.br/~gabriel/seminars/coutinho_tuttepolynomial_seminar.pdf\n    .. [8] J. A. Ellis-Monaghan, C. Merino,\n       \"Graph polynomials and their applications I: The Tutte polynomial\"\n       Structural Analysis of Complex Networks, 2011\n       https://arxiv.org/pdf/0803.3079.pdf\n    ",616            "n_words": 732,617            "vocab_size": 354,618            "n_whitespaces": 1105,619            "language": "en"620        }621    },622    {623        "id": 153822,624        "commit_id": "57e29bc5d82348006c5170ef9ac0a9eedcd9acf9",625        "repo": "modin",626        "path": "modin/core/storage_formats/base/query_compiler.py",627        "file_name": "query_compiler.py",628        "fun_name": "idxmax",629        "commit_message": "REFACTOR-#4513: Fix spelling mistakes in docs and docstrings (#4514)\n\nCo-authored-by: Rehan Sohail Durrani <rdurrani@berkeley.edu>\r\nSigned-off-by: jeffreykennethli <jkli@ponder.io>",630        "code": "def idxmax(self, **kwargs):  # noqa: PR02\n        \n        return DataFrameDefault.register(pandas.DataFrame.idxmax)(self, **kwargs)\n",631        "url": "https://github.com/modin-project/modin.git",632        "language": "Python",633        "ast_errors": "",634        "n_ast_errors": 0,635        "ast_levels": 10,636        "n_whitespaces": 24,637        "n_words": 9,638        "vocab_size": 9,639        "complexity": 1,640        "nloc": 2,641        "token_counts": 26,642        "n_ast_nodes": 44,643        "n_identifiers": 7,644        "d_id": 35637,645        "documentation": {646            "docstring": "\n        Get position of the first occurrence of the maximum for each row or column.\n\n        Parameters\n        ----------\n        axis : {0, 1}\n        skipna : bool\n        **kwargs : dict\n            Serves the compatibility purpose. Does not affect the result.\n\n        Returns\n        -------\n        BaseQueryCompiler\n            One-column QueryCompiler with index labels of the specified axis,\n            where each row contains position of the maximum element for the\n            corresponding row or column.\n        ",647            "n_words": 62,648            "vocab_size": 43,649            "n_whitespaces": 177,650            "language": "en"651        }652    },653    {654        "id": 65569,655        "commit_id": "494bd9ef78313436f0424b918f200dab8fc7c20b",656        "repo": "erpnext",657        "path": "erpnext/buying/report/procurement_tracker/procurement_tracker.py",658        "file_name": "procurement_tracker.py",659        "fun_name": "get_mapped_pr_records",660        "commit_message": "style: format code with black",661        "code": "def get_mapped_pr_records():\n\treturn frappe._dict(\n\t\tfrappe.db.sql(\n\t\t\t\n\t\t)\n\t)\n\n",662        "url": "https://github.com/frappe/erpnext.git",663        "language": "Python",664        "ast_errors": "",665        "n_ast_errors": 0,666        "ast_levels": 10,667        "n_whitespaces": 2,668        "n_words": 7,669        "vocab_size": 6,670        "complexity": 1,671        "nloc": 16,672        "token_counts": 18,673        "n_ast_nodes": 32,674        "n_identifiers": 5,675        "d_id": 13945,676        "documentation": {677            "docstring": "\n\t\tSELECT\n\t\t\tpr_item.purchase_order_item,\n\t\t\tpr.posting_date\n\t\tFROM `tabPurchase Receipt` pr, `tabPurchase Receipt Item` pr_item\n\t\tWHERE\n\t\t\tpr.docstatus=1\n\t\t\tAND pr.name=pr_item.parent\n\t\t\tAND pr_item.purchase_order_item IS NOT NULL\n\t\t\tAND pr.status not in  (\"Closed\",\"Completed\",\"Cancelled\")\n\t\t",678            "n_words": 25,679            "vocab_size": 22,680            "n_whitespaces": 17,681            "language": "en"682        }683    },684    {685        "id": 152171,686        "commit_id": "6a9b33c848281cb02f38764e4f91ef767f5e3edd",687        "repo": "stable-diffusion-webui",688        "path": "modules/codeformer/codeformer_arch.py",689        "file_name": "codeformer_arch.py",690        "fun_name": "calc_mean_std",691        "commit_message": "codeformer support",692        "code": "def calc_mean_std(feat, eps=1e-5):\n    \n    size = feat.size()\n    assert len(size) == 4, 'The input feature should be 4D tensor.'\n    b, c = size[:2]\n    feat_var = feat.view(b, c, -1).var(dim=2) + eps\n    feat_std = feat_var.sqrt().view(b, c, 1, 1)\n    feat_mean = feat.view(b, c, -1).mean(dim=2).view(b, c, 1, 1)\n    return feat_mean, feat_std\n\n",693        "url": "https://github.com/AUTOMATIC1111/stable-diffusion-webui.git",694        "language": "Python",695        "ast_errors": "",696        "n_ast_errors": 0,697        "ast_levels": 13,698        "n_whitespaces": 69,699        "n_words": 45,700        "vocab_size": 34,701        "complexity": 1,702        "nloc": 8,703        "token_counts": 112,704        "n_ast_nodes": 168,705        "n_identifiers": 15,706        "d_id": 35175,707        "documentation": {708            "docstring": "Calculate mean and std for adaptive_instance_normalization.\n\n    Args:\n        feat (Tensor): 4D tensor.\n        eps (float): A small value added to the variance to avoid\n            divide-by-zero. Default: 1e-5.\n    ",709            "n_words": 25,710            "vocab_size": 24,711            "n_whitespaces": 56,712            "language": "en"713        }714    },715    {716        "id": 176348,717        "commit_id": "e308b80f17264b89acf8defe185c71c6656d5105",718        "repo": "networkx",719        "path": "networkx/generators/line.py",720        "file_name": "line.py",721        "fun_name": "_lg_directed",722        "commit_message": "MAINT: Remove unnecessary helper functions, use inbuilt methods for line graph generator (#5327)\n\n* MAINT: Remove unnecessary helper functions, use inbuilt methods\r\n\r\n* Use multigraph key to create node, add tests for multi(di)graphs",723        "code": "def _lg_directed(G, create_using=None):\n    \n    L = nx.empty_graph(0, create_using, default=G.__class__)\n\n    # Create a graph specific edge function.\n    get_edges = partial(G.edges, keys=True) if G.is_multigraph() else G.edges\n\n    for from_node in get_edges():\n        # from_node is: (u,v) or (u,v,key)\n        L.add_node(from_node)\n        for to_node in get_edges(from_node[1]):\n            L.add_edge(from_node, to_node)\n\n    return L\n\n",724        "url": "https://github.com/networkx/networkx.git",725        "language": "Python",726        "ast_errors": "",727        "n_ast_errors": 0,728        "ast_levels": 11,729        "n_whitespaces": 92,730        "n_words": 42,731        "vocab_size": 36,732        "complexity": 4,733        "nloc": 8,734        "token_counts": 82,735        "n_ast_nodes": 128,736        "n_identifiers": 17,737        "d_id": 41851,738        "documentation": {739            "docstring": "Returns the line graph L of the (multi)digraph G.\n\n    Edges in G appear as nodes in L, represented as tuples of the form (u,v)\n    or (u,v,key) if G is a multidigraph. A node in L corresponding to the edge\n    (u,v) is connected to every node corresponding to an edge (v,w).\n\n    Parameters\n    ----------\n    G : digraph\n        A directed graph or directed multigraph.\n    create_using : NetworkX graph constructor, optional\n       Graph type to create. If graph instance, then cleared before populated.\n       Default is to use the same graph class as `G`.\n\n    ",740            "n_words": 88,741            "vocab_size": 58,742            "n_whitespaces": 131,743            "language": "en"744        }745    },746    {747        "id": 206039,748        "commit_id": "9c19aff7c7561e3a82978a272ecdaad40dda5c00",749        "repo": "django",750        "path": "django/forms/widgets.py",751        "file_name": "widgets.py",752        "fun_name": "id_for_label",753        "commit_message": "Refs #33476 -- Reformatted code with Black.",754        "code": "def id_for_label(self, id_, index=\"0\"):\n        \n        if id_ and self.add_id_index:\n            id_ = \"%s_%s\" % (id_, index)\n        return id_\n",755        "url": "https://github.com/django/django.git",756        "language": "Python",757        "ast_errors": "",758        "n_ast_errors": 0,759        "ast_levels": 10,760        "n_whitespaces": 48,761        "n_words": 16,762        "vocab_size": 14,763        "complexity": 3,764        "nloc": 4,765        "token_counts": 30,766        "n_ast_nodes": 51,767        "n_identifiers": 5,768        "d_id": 51334,769        "documentation": {770            "docstring": "\n        Use an incremented id for each option where the main widget\n        references the zero index.\n        ",771            "n_words": 15,772            "vocab_size": 14,773            "n_whitespaces": 37,774            "language": "en"775        }776    },777    {778        "id": 85629,779        "commit_id": "2f6716c264bbd916c2773edb8b75cf2e9b26c51b",780        "repo": "sentry",781        "path": "src/sentry/runner/initializer.py",782        "file_name": "initializer.py",783        "fun_name": "validate_snuba",784        "commit_message": "ref: type devserver startup (#38598)\n\nI noticed `sentry devserver 127.0.0.1` produced this error and decided\r\nto prevent it using typing:\r\n\r\n```console\r\n$ sentry devserver 127.0.0.1\r\nINFO:The Sentry runner will report development issues to Sentry.io. Use SENTRY_DEVENV_NO_REPORT to avoid reporting issues.\r\n16:33:40 [WARNING] sentry.utils.geo: settings.GEOIP_PATH_MMDB not configured.\r\n/Users/armenzg/code/sentry/src/sentry/runner/initializer.py:571: DeprecatedSettingWarning: The SENTRY_URL_PREFIX setting is deprecated. Please use SENTRY_OPTIONS['system.url-prefix'] instead.\r\n  warnings.warn(DeprecatedSettingWarning(old, \"SENTRY_OPTIONS['%s']\" % new))\r\n16:33:41 [INFO] sentry.plugins.github: apps-not-configured\r\n16:33:41 [INFO] sentry.runner: We have reported the error below to Sentry\r\n/Users/armenzg/code/sentry/.venv/lib/python3.8/site-packages/sentry_sdk/worker.py:123: ResourceWarning: unclosed <ssl.SSLSocket fd=6, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0, laddr=('192.168.0.14', 58764), raddr=('34.120.195.249', 443)>\r\n  callback = self._queue.get()\r\nResourceWarning: Enable tracemalloc to get the object allocation traceback\r\nTraceback (most recent call last):\r\n  File \"/Users/armenzg/code/sentry/.venv/bin/sentry\", line 33, in <module>\r\n    sys.exit(load_entry_point('sentry', 'console_scripts', 'sentry')())\r\n  File \"/Users/armenzg/code/sentry/src/sentry/runner/__init__.py\", line 186, in main\r\n    raise e\r\n  File \"/Users/armenzg/code/sentry/src/sentry/runner/__init__.py\", line 178, in main\r\n    func(**kwargs)\r\n  File \"/Users/armenzg/code/sentry/.venv/lib/python3.8/site-packages/click/core.py\", line 1128, in __call__\r\n    return self.main(*args, **kwargs)\r\n  File \"/Users/armenzg/code/sentry/.venv/lib/python3.8/site-packages/click/core.py\", line 1053, in main\r\n    rv = self.invoke(ctx)\r\n  File \"/Users/armenzg/code/sentry/.venv/lib/python3.8/site-packages/click/core.py\", line 1659, in invoke\r\n    return _process_result(sub_ctx.command.invoke(sub_ctx))\r\n  File \"/Users/armenzg/code/sentry/.venv/lib/python3.8/site-packages/click/core.py\", line 1395, in invoke\r\n    return ctx.invoke(self.callback, **ctx.params)\r\n  File \"/Users/armenzg/code/sentry/.venv/lib/python3.8/site-packages/click/core.py\", line 754, in invoke\r\n    return __callback(*args, **kwargs)\r\n  File \"/Users/armenzg/code/sentry/.venv/lib/python3.8/site-packages/click/decorators.py\", line 26, in new_func\r\n    return f(get_current_context(), *args, **kwargs)\r\n  File \"/Users/armenzg/code/sentry/src/sentry/runner/decorators.py\", line 69, in inner\r\n    return ctx.invoke(f, *args, **kwargs)\r\n  File \"/Users/armenzg/code/sentry/.venv/lib/python3.8/site-packages/click/core.py\", line 754, in invoke\r\n    return __callback(*args, **kwargs)\r\n  File \"/Users/armenzg/code/sentry/.venv/lib/python3.8/site-packages/click/decorators.py\", line 26, in new_func\r\n    return f(get_current_context(), *args, **kwargs)\r\n  File \"/Users/armenzg/code/sentry/src/sentry/runner/decorators.py\", line 29, in inner\r\n    return ctx.invoke(f, *args, **kwargs)\r\n  File \"/Users/armenzg/code/sentry/.venv/lib/python3.8/site-packages/click/core.py\", line 754, in invoke\r\n    return __callback(*args, **kwargs)\r\n  File \"/Users/armenzg/code/sentry/src/sentry/runner/commands/devserver.py\", line 215, in devserver\r\n    port = port + 1\r\nTypeError: unsupported operand type(s) for +: 'NoneType' and 'int\r\n```",785        "code": "def validate_snuba() -> None:\n    \n    if not settings.DEBUG:\n        return\n\n    has_all_snuba_required_backends = (\n        settings.SENTRY_SEARCH\n        in (\n            \"sentry.search.snuba.EventsDatasetSnubaSearchBackend\",\n            \"sentry.utils.services.ServiceDelegator\",\n        )\n        and settings.SENTRY_TAGSTORE == \"sentry.tagstore.snuba.SnubaTagStorage\"\n        and\n        # TODO(mattrobenolt): Remove ServiceDelegator check\n        settings.SENTRY_TSDB\n        in (\"sentry.tsdb.redissnuba.RedisSnubaTSDB\", \"sentry.utils.services.ServiceDelegator\")\n    )\n\n    eventstream_is_snuba = (\n        settings.SENTRY_EVENTSTREAM == \"sentry.eventstream.snuba.SnubaEventStream\"\n        or settings.SENTRY_EVENTSTREAM == \"sentry.eventstream.kafka.KafkaEventStream\"\n    )\n\n    # All good here, it doesn't matter what else is going on\n    if has_all_snuba_required_backends and eventstream_is_snuba:\n        return\n\n    from sentry.features import requires_snuba as snuba_features\n\n    snuba_enabled_features = set()\n\n    for feature in snuba_features:\n        if settings.SENTRY_FEATURES.get(feature, False):\n            snuba_enabled_features.add(feature)\n\n    if snuba_enabled_features and not eventstream_is_snuba:\n        from .importer import ConfigurationError\n\n        show_big_error(\n            \n            % \"\\n\".join(snuba_enabled_features)\n        )\n        raise ConfigurationError(\"Cannot continue without Snuba configured.\")\n\n    if not eventstream_is_snuba:\n        from .importer import ConfigurationError\n\n        show_big_error(\n            \n            % (\n                settings.SENTRY_SEARCH,\n                settings.SENTRY_TAGSTORE,\n                settings.SENTRY_TSDB,\n                settings.SENTRY_EVENTSTREAM,\n            )\n        )\n        raise ConfigurationError(\"Cannot continue without Snuba configured correctly.\")\n\n    if eventstream_is_snuba and not has_all_snuba_required_backends:\n        show_big_error(\n            \n            % (\n                settings.SENTRY_SEARCH,\n                settings.SENTRY_TAGSTORE,\n                settings.SENTRY_TSDB,\n                settings.SENTRY_EVENTSTREAM,\n            )\n        )\n",786        "url": "https://github.com/getsentry/sentry.git",787        "language": "Python",788        "ast_errors": "",789        "n_ast_errors": 0,790        "ast_levels": 13,791        "n_whitespaces": 580,792        "n_words": 133,793        "vocab_size": 77,794        "complexity": 14,795        "nloc": 98,796        "token_counts": 194,797        "n_ast_nodes": 333,798        "n_identifiers": 23,799        "d_id": 18018,800        "documentation": {801            "docstring": "\n    Make sure everything related to Snuba is in sync.\n\n    This covers a few cases:\n\n    * When you have features related to Snuba, you must also\n      have Snuba fully configured correctly to continue.\n    * If you have Snuba specific search/tagstore/tsdb backends,\n      you must also have a Snuba compatible eventstream backend\n      otherwise no data will be written into Snuba.\n    * If you only have Snuba related eventstream, yell that you\n      probably want the other backends otherwise things are weird.\n    \nYou have features enabled which require Snuba,\nbut you don't have any Snuba compatible configuration.\n\nFeatures you have enabled:\n%s\n\nSee: https://github.com/getsentry/snuba#sentry--snuba\n\nIt appears that you are requiring Snuba,\nbut your SENTRY_EVENTSTREAM is not compatible.\n\nCurrent settings:\n\nSENTRY_SEARCH = %r\nSENTRY_TAGSTORE = %r\nSENTRY_TSDB = %r\nSENTRY_EVENTSTREAM = %r\n\nSee: https://github.com/getsentry/snuba#sentry--snuba\nYou are using a Snuba compatible eventstream\nwithout configuring search/tagstore/tsdb also to use Snuba.\nThis is probably not what you want.\n\nCurrent settings:\n\nSENTRY_SEARCH = %r\nSENTRY_TAGSTORE = %r\nSENTRY_TSDB = %r\nSENTRY_EVENTSTREAM = %r\n\nSee: https://github.com/getsentry/snuba#sentry--snuba",802            "n_words": 165,803            "vocab_size": 86,804            "n_whitespaces": 182,805            "language": "en"806        }807    },808    {809        "id": 104578,810        "commit_id": "3804442bb7cfcb9d52044d92688115cfdc69c2da",811        "repo": "datasets",812        "path": "src/datasets/features/image.py",813        "file_name": "image.py",814        "fun_name": "flatten",815        "commit_message": "Fix flatten of complex feature types (#3723)\n\n* Flatten Translation and TranslationVariableLanguages\r\n\r\n* Add tests\r\n\r\n* Style\r\n\r\n* Flatten for decodable features\r\n\r\n* Fix flatten for non-dict types\r\n\r\n* Add test\r\n\r\n* Descriptive message in flatten for Audio feature\r\n\r\n* Small refactor\r\n\r\n* Add flatten to features\r\n\r\n* Update table_flatten\r\n\r\n* Revert changes in Dataset.flatten_/flatten\r\n\r\n* Apply Quentin's suggestions from code review\r\n\r\nCo-authored-by: Quentin Lhoest <42851186+lhoestq@users.noreply.github.com>\r\n\r\n* Improve table_flatten docstring\r\n\r\n* Fix tests\r\n\r\n* Add nested test\r\n\r\n* Minor fix\r\n\r\n* Remove comment\r\n\r\nCo-authored-by: Quentin Lhoest <42851186+lhoestq@users.noreply.github.com>",816        "code": "def flatten(self) -> Union[\"FeatureType\", Dict[str, \"FeatureType\"]]:\n        \n        from .features import Value\n\n        return (\n            self\n            if self.decode\n            else {\n                \"bytes\": Value(\"binary\"),\n                \"path\": Value(\"string\"),\n            }\n        )\n",817        "url": "https://github.com/huggingface/datasets.git",818        "language": "Python",819        "ast_errors": "",820        "n_ast_errors": 0,821        "ast_levels": 12,822        "n_whitespaces": 125,823        "n_words": 23,824        "vocab_size": 23,825        "complexity": 2,826        "nloc": 11,827        "token_counts": 48,828        "n_ast_nodes": 86,829        "n_identifiers": 8,830        "d_id": 21903,831        "documentation": {832            "docstring": "If in the decodable state, return the feature itself, otherwise flatten the feature into a dictionary.",833            "n_words": 16,834            "vocab_size": 13,835            "n_whitespaces": 15,836            "language": "en"837        }838    },839    {840        "id": 156733,841        "commit_id": "2820bae493a49cb1d0a6e376985c5473b8f04fa8",842        "repo": "dask",843        "path": "dask/array/core.py",844        "file_name": "core.py",845        "fun_name": "dot",846        "commit_message": "Don't include docs in ``Array`` methods, just refer to module docs (#9244)\n\nCo-authored-by: James Bourbeau <jrbourbeau@users.noreply.github.com>",847        "code": "def dot(self, other):\n        \n        from dask.array.routines import tensordot\n\n        return tensordot(self, other, axes=((self.ndim - 1,), (other.ndim - 2,)))\n",848        "url": "https://github.com/dask/dask.git",849        "language": "Python",850        "ast_errors": "",851        "n_ast_errors": 0,852        "ast_levels": 12,853        "n_whitespaces": 37,854        "n_words": 16,855        "vocab_size": 15,856        "complexity": 1,857        "nloc": 3,858        "token_counts": 45,859        "n_ast_nodes": 66,860        "n_identifiers": 9,861        "d_id": 36743,862        "documentation": {863            "docstring": "Dot product of self and other.\n\n        Refer to :func:`dask.array.tensordot` for full documentation.\n\n        See Also\n        --------\n        dask.array.dot : equivalent function\n        ",864            "n_words": 19,865            "vocab_size": 19,866            "n_whitespaces": 54,867            "language": "en"868        }869    },870    {871        "id": 101615,872        "commit_id": "98d01760e469fd2108eed8d0b0a1ba6297c3177c",873        "repo": "faceswap",874        "path": "tools/sort/sort_methods.py",875        "file_name": "sort_methods.py",876        "fun_name": "sort",877        "commit_message": "Overhaul sort:\n  - Standardize image data reading and writing\n  - Optimize loading (just one pass required)\n  - Make all sort groups binnable (to greater or lesser results)\n  - Add sort by pitch\n  - Deprecate multiple options\n  - linting, docs + locales",878        "code": "def sort(self) -> None:\n        \n        raise NotImplementedError()\n",879        "url": "https://github.com/deepfakes/faceswap.git",880        "language": "Python",881        "ast_errors": "",882        "n_ast_errors": 0,883        "ast_levels": 7,884        "n_whitespaces": 20,885        "n_words": 6,886        "vocab_size": 6,887        "complexity": 1,888        "nloc": 6,889        "token_counts": 12,890        "n_ast_nodes": 23,891        "n_identifiers": 3,892        "d_id": 21023,893        "documentation": {894            "docstring": " Override for method specific logic for sorting the loaded statistics\n\n        The scored list :attr:`_result` should be sorted in place\n        ",895            "n_words": 19,896            "vocab_size": 18,897            "n_whitespaces": 34,898            "language": "en"899        }900    },901    {902        "id": 277252,903        "commit_id": "fa6d9107a498f7c2403ff28c7b389a1a0c5cc083",904        "repo": "keras",905        "path": "keras/engine/base_layer.py",906        "file_name": "base_layer.py",907        "fun_name": "losses",908        "commit_message": "reduct too long lines",909        "code": "def losses(self):\n        \n        collected_losses = []\n        for layer in self._flatten_layers():\n            # If any eager losses are present, we assume the model to be part of\n            # an eager training loop (either a custom one or the one used when\n            # `run_eagerly=True`) and so we always return just the eager losses.\n            if layer._eager_losses:\n                # Filter placeholder losses that may have been added by revived\n                # layers.  (see base_layer_utils for details).\n                if (\n                    layer._eager_losses[0]\n                    is not base_layer_utils.REVIVED_LOSS_PLACEHOLDER\n                ):\n                    collected_losses.extend(layer._eager_losses)\n            else:\n                collected_losses.extend(layer._losses)\n            for regularizer in layer._callable_losses:\n                loss_tensor = regularizer()\n                if loss_tensor is not None:\n                    collected_losses.append(loss_tensor)\n        return collected_losses\n",910        "url": "https://github.com/keras-team/keras.git",911        "language": "Python",912        "ast_errors": "",913        "n_ast_errors": 0,914        "ast_levels": 14,915        "n_whitespaces": 369,916        "n_words": 93,917        "vocab_size": 71,918        "complexity": 6,919        "nloc": 16,920        "token_counts": 83,921        "n_ast_nodes": 140,922        "n_identifiers": 14,923        "d_id": 81916,924        "documentation": {925            "docstring": "List of losses added using the `add_loss()` API.\n\n        Variable regularization tensors are created when this property is\n        accessed, so it is eager safe: accessing `losses` under a\n        `tf.GradientTape` will propagate gradients back to the corresponding\n        variables.\n\n        Examples:\n\n        >>> class MyLayer(tf.keras.layers.Layer):\n        ...   def call(self, inputs):\n        ...     self.add_loss(tf.abs(tf.reduce_mean(inputs)))\n        ...     return inputs\n        >>> l = MyLayer()\n        >>> l(np.ones((10, 1)))\n        >>> l.losses\n        [1.0]\n\n        >>> inputs = tf.keras.Input(shape=(10,))\n        >>> x = tf.keras.layers.Dense(10)(inputs)\n        >>> outputs = tf.keras.layers.Dense(1)(x)\n        >>> model = tf.keras.Model(inputs, outputs)\n        >>> # Activity regularization.\n        >>> len(model.losses)\n        0\n        >>> model.add_loss(tf.abs(tf.reduce_mean(x)))\n        >>> len(model.losses)\n        1\n\n        >>> inputs = tf.keras.Input(shape=(10,))\n        >>> d = tf.keras.layers.Dense(10, kernel_initializer='ones')\n        >>> x = d(inputs)\n        >>> outputs = tf.keras.layers.Dense(1)(x)\n        >>> model = tf.keras.Model(inputs, outputs)\n        >>> # Weight regularization.\n        >>> model.add_loss(lambda: tf.reduce_mean(d.kernel))\n        >>> model.losses\n        [<tf.Tensor: shape=(), dtype=float32, numpy=1.0>]\n\n        Returns:\n          A list of tensors.\n        ",926            "n_words": 128,927            "vocab_size": 83,928            "n_whitespaces": 385,929            "language": "en"930        }931    },932    {933        "id": 206346,934        "commit_id": "9c19aff7c7561e3a82978a272ecdaad40dda5c00",935        "repo": "django",936        "path": "django/test/client.py",937        "file_name": "client.py",938        "fun_name": "store_rendered_templates",939        "commit_message": "Refs #33476 -- Reformatted code with Black.",940        "code": "def store_rendered_templates(store, signal, sender, template, context, **kwargs):\n    \n    store.setdefault(\"templates\", []).append(template)\n    if \"context\" not in store:\n        store[\"context\"] = ContextList()\n    store[\"context\"].append(copy(context))\n\n",941        "url": "https://github.com/django/django.git",942        "language": "Python",943        "ast_errors": "",944        "n_ast_errors": 0,945        "ast_levels": 10,946        "n_whitespaces": 37,947        "n_words": 18,948        "vocab_size": 18,949        "complexity": 2,950        "nloc": 5,951        "token_counts": 57,952        "n_ast_nodes": 96,953        "n_identifiers": 11,954        "d_id": 51498,955        "documentation": {956            "docstring": "\n    Store templates and contexts that are rendered.\n\n    The context is copied so that it is an accurate representation at the time\n    of rendering.\n    ",957            "n_words": 23,958            "vocab_size": 21,959            "n_whitespaces": 36,960            "language": "en"961        }962    },963    {964        "id": 190666,965        "commit_id": "b21b008118fc8cf65b4bcd9b059f1cd704e05c68",966        "repo": "pytest",967        "path": "testing/python/metafunc.py",968        "file_name": "metafunc.py",969        "fun_name": "test_unicode_idval",970        "commit_message": "Refactor idmaker functions into class IdMaker\n\nThis commit only refactors, it does not change or add functionality yet. Public\nAPI is retained. Reason or refactoring:\n\nUser provided parameter IDs (e.g. Metafunc.parametrize(ids=...)) had so far\nonly been used to calculate a unique test ID for each test invocation. That\ntest ID was a joined string where each parameter contributed some partial ID.\n\nWe're soon going to reuse functionality to generate parameter keys for\nreorder_items and FixtureDef cache. We will be interested in the partial\nIDs, and only if they originate from explicit user information. Refactoring\nmakes logic and data accessible for reuse, and increases cohesion in general.",971        "code": "def test_unicode_idval(self) -> None:\n        \n        values = [\n            (\"\", r\"\"),\n            (\"ascii\", r\"ascii\"),\n            (\"aรงรฃo\", r\"a\\xe7\\xe3o\"),\n            (\"josรฉ@blah.com\", r\"jos\\xe9@blah.com\"),\n            (\n                r\"ฮดฮฟฮบ.ฮนฮผฮฎ@ฯ€ฮฑฯฮฌฮดฮตฮนฮณฮผฮฑ.ฮดฮฟฮบฮนฮผฮฎ\",\n                r\"\\u03b4\\u03bf\\u03ba.\\u03b9\\u03bc\\u03ae@\\u03c0\\u03b1\\u03c1\\u03ac\\u03b4\\u03b5\\u03b9\\u03b3\"\n                r\"\\u03bc\\u03b1.\\u03b4\\u03bf\\u03ba\\u03b9\\u03bc\\u03ae\",\n            ),\n        ]\n        for val, expected in values:\n            assert (\n                IdMaker([], [], None, None, None, None)._idval(val, \"a\", 6) == expected\n            )\n",972        "url": "https://github.com/pytest-dev/pytest.git",973        "language": "Python",974        "ast_errors": "",975        "n_ast_errors": 0,976        "ast_levels": 14,977        "n_whitespaces": 215,978        "n_words": 39,979        "vocab_size": 35,980        "complexity": 2,981        "nloc": 21,982        "token_counts": 88,983        "n_ast_nodes": 135,984        "n_identifiers": 7,985        "d_id": 46373,986        "documentation": {987            "docstring": "Test that Unicode strings outside the ASCII character set get\n        escaped, using byte escapes if they're in that range or unicode\n        escapes if they're not.\n\n        ",988            "n_words": 25,989            "vocab_size": 21,990            "n_whitespaces": 46,991            "language": "en"992        }993    },994    {995        "id": 321750,996        "commit_id": "218f490484066660dd4e899da600b252f7edd468",997        "repo": "qutebrowser",998        "path": "qutebrowser/config/configfiles.py",999        "file_name": "configfiles.py",1000        "fun_name": "_has_webengine",1001        "commit_message": "Warn on QtWebEngine downgrade and Qt 5 -> 6 upgrade",1002        "code": "def _has_webengine(self) -> bool:\n        \n        try:\n            import qutebrowser.qt.webenginewidgets  # pylint: disable=unused-import\n        except ImportError:\n            return False\n        return True\n",1003        "url": "https://github.com/qutebrowser/qutebrowser.git",1004        "language": "Python",1005        "ast_errors": "",1006        "n_ast_errors": 0,1007        "ast_levels": 8,1008        "n_whitespaces": 67,1009        "n_words": 16,1010        "vocab_size": 15,1011        "complexity": 2,1012        "nloc": 10,1013        "token_counts": 23,1014        "n_ast_nodes": 40,1015        "n_identifiers": 7,1016        "d_id": 117884,1017        "documentation": {1018            "docstring": "Check if QtWebEngine is available.\n\n        Note that it's too early to use objects.backend here...\n        ",1019            "n_words": 14,1020            "vocab_size": 14,1021            "n_whitespaces": 28,1022            "language": "en"1023        }1024    },1025    {1026        "id": 130357,1027        "commit_id": "7f1bacc7dc9caf6d0ec042e39499bbf1d9a7d065",1028        "repo": "ray",1029        "path": "python/ray/autoscaler/_private/aliyun/utils.py",1030        "file_name": "utils.py",1031        "fun_name": "tag_resource",1032        "commit_message": "[CI] Format Python code with Black (#21975)\n\nSee #21316 and #21311 for the motivation behind these changes.",1033        "code": "def tag_resource(self, resource_ids, tags, resource_type=\"instance\"):\n        \n        request = TagResourcesRequest()\n        request.set_Tags(tags)\n        request.set_ResourceType(resource_type)\n        request.set_ResourceIds(resource_ids)\n        response = self._send_request(request)\n        if response is not None:\n            logging.info(\"instance %s create tag successfully.\", resource_ids)\n        else:\n            logging.error(\"instance %s create tag failed.\", resource_ids)\n",1034        "url": "https://github.com/ray-project/ray.git",1035        "language": "Python",1036        "ast_errors": "",1037        "n_ast_errors": 0,1038        "ast_levels": 11,1039        "n_whitespaces": 110,1040        "n_words": 32,1041        "vocab_size": 26,1042        "complexity": 2,1043        "nloc": 10,1044        "token_counts": 69,1045        "n_ast_nodes": 117,1046        "n_identifiers": 15,1047        "d_id": 29243,1048        "documentation": {1049            "docstring": "Create and bind tags to specified ECS resources.\n\n        :param resource_ids: The IDs of N resources.\n        :param tags: The tags of the resource.\n        :param resource_type: The type of the resource.\n        ",1050            "n_words": 29,1051            "vocab_size": 19,1052            "n_whitespaces": 57,1053            "language": "en"1054        }1055    },1056    {1057        "id": 308401,1058        "commit_id": "d0c4f0fec4216e4193da716001b5e13e1e3f2106",1059        "repo": "core",1060        "path": "homeassistant/components/mqtt/cover.py",1061        "file_name": "cover.py",1062        "fun_name": "async_close_cover",1063        "commit_message": "Add mqtt  encoding support for publishing  (#62739)\n\n* encoding support for mqtt publishing - todo tests\r\n\r\n* signature allows None values for qos and retain\r\n\r\n* common test for mqtt publishing encoding\r\n\r\n* better test with command templates\r\n\r\n* more tests\r\n\r\n* fix tests alarm control panel+tests light basic\r\n\r\n* tests light json and template\r\n\r\n* add tests vacuum and fix tests light_template",1064        "code": "async def async_close_cover(self, **kwargs):\n        \n        await mqtt.async_publish(\n            self.hass,\n            self._config.get(CONF_COMMAND_TOPIC),\n            self._config[CONF_PAYLOAD_CLOSE],\n            self._config[CONF_QOS],\n            self._config[CONF_RETAIN],\n            self._config[CONF_ENCODING],\n        )\n        if self._optimistic:\n            # Optimistically assume that cover has changed state.\n            self._state = STATE_CLOSED\n            if self._config.get(CONF_GET_POSITION_TOPIC):\n                self._position = self.find_percentage_in_range(\n                    self._config[CONF_POSITION_CLOSED], COVER_PAYLOAD\n                )\n            self.async_write_ha_state()\n",1065        "url": "https://github.com/home-assistant/core.git",1066        "language": "Python",1067        "ast_errors": "",1068        "n_ast_errors": 0,1069        "ast_levels": 14,1070        "n_whitespaces": 222,1071        "n_words": 35,1072        "vocab_size": 32,1073        "complexity": 3,1074        "nloc": 16,1075        "token_counts": 98,1076        "n_ast_nodes": 150,1077        "n_identifiers": 22,1078        "d_id": 107158,1079        "documentation": {1080            "docstring": "Move the cover down.\n\n        This method is a coroutine.\n        ",1081            "n_words": 9,1082            "vocab_size": 9,1083            "n_whitespaces": 23,1084            "language": "en"1085        }1086    },1087    {1088        "id": 22098,1089        "commit_id": "cd5a9683be69c86c8f3adcd13385a9bc5db198ec",1090        "repo": "pipenv",1091        "path": "pipenv/patched/pip/_vendor/requests/models.py",1092        "file_name": "models.py",1093        "fun_name": "links",1094        "commit_message": "Rename notpip to pip. Vendor in pip-22.2.1 and latest requirementslib and vistir.",1095        "code": "def links(self):\n        \n\n        header = self.headers.get(\"link\")\n\n        resolved_links = {}\n\n        if header:\n            links = parse_header_links(header)\n\n            for link in links:\n                key = link.get(\"rel\") or link.get(\"url\")\n                resolved_links[key] = link\n\n        return resolved_links\n",1096        "url": "https://github.com/pypa/pipenv.git",1097        "language": "Python",1098        "ast_errors": "",1099        "n_ast_errors": 0,1100        "ast_levels": 14,1101        "n_whitespaces": 114,1102        "n_words": 27,1103        "vocab_size": 21,1104        "complexity": 4,1105        "nloc": 9,1106        "token_counts": 57,1107        "n_ast_nodes": 100,1108        "n_identifiers": 9,1109        "d_id": 4177,1110        "documentation": {1111            "docstring": "Returns the parsed header links of the response, if any.",1112            "n_words": 10,1113            "vocab_size": 9,1114            "n_whitespaces": 9,1115            "language": "en"1116        }1117    },1118    {1119        "id": 118743,1120        "commit_id": "72703b38029f9358a0ec7ca5ed875a6b438ece19",1121        "repo": "streamlit",1122        "path": "lib/streamlit/elements/text.py",1123        "file_name": "text.py",1124        "fun_name": "text",1125        "commit_message": "Replace static apps with live Cloud apps (#4317)\n\nCo-authored-by: kajarenc <kajarenc@gmail.com>",1126        "code": "def text(self, body):\n        \n        text_proto = TextProto()\n        text_proto.body = clean_text(body)\n        return self.dg._enqueue(\"text\", text_proto)\n",1127        "url": "https://github.com/streamlit/streamlit.git",1128        "language": "Python",1129        "ast_errors": "",1130        "n_ast_errors": 0,1131        "ast_levels": 8,1132        "n_whitespaces": 40,1133        "n_words": 12,1134        "vocab_size": 11,1135        "complexity": 1,1136        "nloc": 4,1137        "token_counts": 32,1138        "n_ast_nodes": 55,1139        "n_identifiers": 8,1140        "d_id": 26400,1141        "documentation": {1142            "docstring": "Write fixed-width and preformatted text.\n\n        Parameters\n        ----------\n        body : str\n            The string to display.\n\n        Example\n        -------\n        >>> st.text('This is some text.')\n\n        ",1143            "n_words": 21,1144            "vocab_size": 21,1145            "n_whitespaces": 81,1146            "language": "en"1147        }1148    },1149    {1150        "id": 226825,1151        "commit_id": "43e3a4011080911901176aab919c0ecf5046ddd3",1152        "repo": "plotly.py",1153        "path": "packages/python/plotly/plotly/graph_objs/_funnelarea.py",1154        "file_name": "_funnelarea.py",1155        "fun_name": "baseratio",1156        "commit_message": "switch to black .22",1157        "code": "def baseratio(self):\n        \n        return self[\"baseratio\"]\n",1158        "url": "https://github.com/plotly/plotly.py.git",1159        "language": "Python",1160        "ast_errors": "",1161        "n_ast_errors": 0,1162        "ast_levels": 7,1163        "n_whitespaces": 18,1164        "n_words": 4,1165        "vocab_size": 4,1166        "complexity": 1,1167        "nloc": 2,1168        "token_counts": 11,1169        "n_ast_nodes": 22,1170        "n_identifiers": 2,1171        "d_id": 58498,1172        "documentation": {1173            "docstring": "\n        Sets the ratio between bottom length and maximum top length.\n\n        The 'baseratio' property is a number and may be specified as:\n          - An int or float in the interval [0, 1]\n\n        Returns\n        -------\n        int|float\n        ",1174            "n_words": 34,1175            "vocab_size": 32,1176            "n_whitespaces": 86,1177            "language": "en"1178        }1179    },1180    {1181        "id": 200894,1182        "commit_id": "9c19aff7c7561e3a82978a272ecdaad40dda5c00",1183        "repo": "django",1184        "path": "tests/aggregation/tests.py",1185        "file_name": "tests.py",1186        "fun_name": "test_sum_distinct_aggregate",1187        "commit_message": "Refs #33476 -- Reformatted code with Black.",1188        "code": "def test_sum_distinct_aggregate(self):\n        \n        authors = Author.objects.filter(book__in=[self.b5, self.b6])\n        self.assertEqual(authors.count(), 3)\n\n        distinct_authors = authors.distinct()\n        self.assertEqual(distinct_authors.count(), 2)\n\n        # Selected author ages are 57 and 46\n        age_sum = distinct_authors.aggregate(Sum(\"age\"))\n        self.assertEqual(age_sum[\"age__sum\"], 103)\n",1189        "url": "https://github.com/django/django.git",1190        "language": "Python",1191        "ast_errors": "",1192        "n_ast_errors": 0,1193        "ast_levels": 11,1194        "n_whitespaces": 82,1195        "n_words": 26,1196        "vocab_size": 24,1197        "complexity": 1,1198        "nloc": 7,1199        "token_counts": 79,1200        "n_ast_nodes": 132,

Showing the first 1,200 of 91049 lines. Download the file for the rest.