code stringlengths 1 1.49M | file_id stringlengths 42 46 | node_count int64 0 7.38k | total_lines int64 1 20.9k | vector_dim int64 15 15 | vector_labels stringclasses 1
value | nodes stringlengths 2 3.75M | connections stringlengths 2 964k |
|---|---|---|---|---|---|---|---|
from __future__ import unicode_literals
import codecs
import datetime
from decimal import Decimal
import locale
try:
from urllib.parse import quote
except ImportError: # Python 2
from urllib import quote
import warnings
from django.utils.functional import Promise
from django.utils import six
class Django... | ajibawa-2023/Python-Code-Large/train/row_82772 | 108 | 244 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82772:ImportFrom_L1_C0", "label": "from __future__ import unicode_literals", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0041, 0.0041, 0, 0.66, 0.0, 777, 0, 1, 0, 0, 777, 0, 0], "semantic": {"name": "__future__", "arg_names": [], "imp... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_82772:Try_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82772:ImportFrom_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82772:Try_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82772:ImportFrom_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/tr... |
"""JsLex: a lexer for Javascript"""
# Originally from https://bitbucket.org/ned/jslex
import re
class Tok(object):
"""
A specification for a token class.
"""
num = 0
def __init__(self, name, regex, next=None):
self.id = Tok.num
Tok.num += 1
self.name = name
self.reg... | ajibawa-2023/Python-Code-Large/train/row_82773 | 70 | 219 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82773:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 1], "level": 0, "parent": null, "vector": [8, 0, 0.0046, 0.0046, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_82773:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82773:Expr_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82773:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82773:Assign_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/tra... |
"""
PHP date() style date formatting
See http://www.php.net/date for format strings
Usage:
>>> import datetime
>>> d = datetime.datetime.now()
>>> df = DateFormat(d)
>>> print(df.format('jS F Y H:i'))
7th October 2003 11:39
>>>
"""
from __future__ import unicode_literals
import re
import time
import calendar
import d... | ajibawa-2023/Python-Code-Large/train/row_82774 | 219 | 317 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82774:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 12], "level": 0, "parent": null, "vector": [8, 0, 0.0205, 0.0379, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annota... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_82774:ClassDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82774:FunctionDef_L31_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82774:FunctionDef_L31_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_82774:Assign_L32_C8"}, {"f": "ajibawa-2023/Python-... |
from __future__ import unicode_literals
import datetime
from django.utils.timezone import is_aware, utc
from django.utils.translation import ungettext, ugettext
def timesince(d, now=None, reversed=False):
"""
Takes two datetime objects and returns the time between d and now
as a nicely formatted string, ... | ajibawa-2023/Python-Code-Large/train/row_82775 | 29 | 63 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82775:ImportFrom_L1_C0", "label": "from __future__ import unicode_literals", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0159, 0.0159, 0, 0.66, 0.0, 777, 0, 1, 0, 0, 777, 0, 0], "semantic": {"name": "__future__", "arg_names": [], "imp... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_82775:FunctionDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82775:Expr_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82775:FunctionDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82775:Assign_L22_C4"}, {"f": "ajibawa-2023/Python-Code-La... |
# Copyright (c) 2010 Guilherme Gondim. All rights reserved.
# Copyright (c) 2009 Simon Willison. All rights reserved.
# Copyright (c) 2002 Drew Perttula. All rights reserved.
#
# License:
# Python Software Foundation License version 2
#
# See the file "LICENSE" for terms & conditions for usage, and a DISCLAIMER OF
# ... | ajibawa-2023/Python-Code-Large/train/row_82776 | 47 | 99 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82776:Expr_L18_C0", "label": "expression", "type": "expression", "loc": [18, 38], "level": 0, "parent": null, "vector": [8, 0, 0.2828, 0.2121, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "anno... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_82776:ClassDef_L47_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82776:Assign_L48_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82776:ClassDef_L47_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82776:FunctionDef_L50_C4"}, {"f": "ajibawa-2023/Python-Cod... |
# Autoreloading launcher.
# Borrowed from Peter Hunt and the CherryPy project (http://www.cherrypy.org).
# Some taken from Ian Bicking's Paste (http://pythonpaste.org/).
#
# Portions copyright (c) 2004, CherryPy Team (team@cherrypy.org)
# All rights reserved.
#
# Redistribution and use in source and binary forms, with ... | ajibawa-2023/Python-Code-Large/train/row_82777 | 82 | 146 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82777:Import_L31_C0", "label": "os import os, sys, time\u2026", "type": "import", "loc": [31, 31], "level": 0, "parent": null, "vector": [1, 0, 0.2123, 0.0068, 0, 0.66, 0.0, 688, 0, 4, 0, 0, 688, 0, 0], "semantic": {"name": "os", "arg_names": [], "import_names": ["os", ... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_82777:Try_L33_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82777:ImportFrom_L34_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82777:Try_L33_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82777:ImportFrom_L36_C4"}, {"f": "ajibawa-2023/Python-Code-Large... |
from __future__ import unicode_literals
import base64
import calendar
import datetime
import re
import sys
try:
from urllib import parse as urllib_parse
except ImportError: # Python 2
import urllib as urllib_parse
import urlparse
urllib_parse.urlparse = urlparse.urlparse
from binascii import Error... | ajibawa-2023/Python-Code-Large/train/row_82778 | 131 | 265 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82778:ImportFrom_L1_C0", "label": "from __future__ import unicode_literals", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0038, 0.0038, 0, 0.66, 0.0, 777, 0, 1, 0, 0, 777, 0, 0], "semantic": {"name": "__future__", "arg_names": [], "imp... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_82778:Try_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82778:ImportFrom_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82778:Try_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82778:Import_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/... |
import copy
import operator
from functools import wraps, update_wrapper
import sys
from django.utils import six
from django.utils.six.moves import copyreg
# You can't trivially replace this `functools.partial` because this binds to
# classes and returns bound instances, whereas functools.partial (on CPython)
# is a ... | ajibawa-2023/Python-Code-Large/train/row_82779 | 207 | 391 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82779:Import_L1_C0", "label": "copy import copy", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0026, 0.0026, 0, 0.66, 0.0, 739, 0, 1, 0, 0, 739, 0, 0], "semantic": {"name": "copy", "arg_names": [], "import_names": ["copy"], "rhs_call_n... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_82779:FunctionDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82779:FunctionDef_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82779:FunctionDef_L14_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_82779:Return_L15_C8"}, {"f": "ajibawa-2023/Pyth... |
"""
Utilities for XML generation/parsing.
"""
from xml.sax.saxutils import XMLGenerator
class SimplerXMLGenerator(XMLGenerator):
def addQuickElement(self, name, contents=None, attrs=None):
"Convenience method for adding an element with no children"
if attrs is None: attrs = {}
self.startEl... | ajibawa-2023/Python-Code-Large/train/row_82780 | 11 | 14 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82780:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.1429, 0.2143, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_82780:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82780:FunctionDef_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82780:FunctionDef_L8_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_82780:Expr_L9_C8"}, {"f": "ajibawa-2023/Python-Code-L... |
import os
import sys
if os.name == 'posix':
def become_daemon(our_home_dir='.', out_log='/dev/null',
err_log='/dev/null', umask=0o022):
"Robustly turn into a UNIX daemon, running in our_home_dir."
# First fork
try:
if os.fork() > 0:
sys.exit... | ajibawa-2023/Python-Code-Large/train/row_82781 | 41 | 58 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82781:Import_L1_C0", "label": "os import os", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0172, 0.0172, 0, 0.66, 0.0, 688, 0, 1, 0, 0, 688, 0, 0], "semantic": {"name": "os", "arg_names": [], "import_names": ["os"], "rhs_call_name": ""... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_82781:If_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82781:FunctionDef_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82781:FunctionDef_L5_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_82781:Expr_L7_C8"}, {"f": "ajibawa-2023/Python-Code-Large/t... |
"""
Functions for working with "safe strings": strings that can be displayed safely
without further escaping in HTML. Marking something as a "safe string" means
that the producer of the string has already turned characters that should not
be interpreted by the HTML engine (e.g. '<') into the appropriate entities.
"""
f... | ajibawa-2023/Python-Code-Large/train/row_82782 | 69 | 134 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82782:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 6], "level": 0, "parent": null, "vector": [8, 0, 0.0261, 0.0448, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_82782:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82782:Expr_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82782:ClassDef_L19_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82782:Expr_L20_C4"}, {"f": "ajibawa-2023/Python-Code-Large/t... |
import os
import sys
try:
from functools import wraps
except ImportError:
# only needed for Python 2.4
def wraps(_):
def _wraps(func):
return func
return _wraps
__unittest = True
def _relpath_nt(path, start=os.path.curdir):
"""Return a relative version of a path"""
if... | ajibawa-2023/Python-Code-Large/train/row_82783 | 37 | 64 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82783:Import_L1_C0", "label": "os import os", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0156, 0.0156, 0, 0.66, 0.0, 688, 0, 1, 0, 0, 688, 0, 0], "semantic": {"name": "os", "arg_names": [], "import_names": ["os"], "rhs_call_name": ""... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_82783:Try_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82783:ImportFrom_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82783:Try_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82783:FunctionDef_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/tr... |
"""Unittest main program"""
import sys
import os
import types
from django.utils.unittest import loader, runner
try:
from django.utils.unittest.signals import installHandler
except ImportError:
installHandler = None
__unittest = True
FAILFAST = " -f, --failfast Stop on first failure\n"
CATCHBREAK = ... | ajibawa-2023/Python-Code-Large/train/row_82784 | 136 | 241 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82784:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 1], "level": 0, "parent": null, "vector": [8, 0, 0.0041, 0.0041, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_82784:Try_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82784:ImportFrom_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82784:Try_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82784:Assign_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/... |
import signal
import weakref
from django.utils.unittest.compatibility import wraps
__unittest = True
class _InterruptHandler(object):
def __init__(self, default_handler):
self.called = False
self.default_handler = default_handler
def __call__(self, signum, frame):
installed_handler ... | ajibawa-2023/Python-Code-Large/train/row_82785 | 39 | 57 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82785:Import_L1_C0", "label": "signal import signal", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0175, 0.0175, 0, 0.66, 0.0, 621, 0, 1, 0, 0, 621, 0, 0], "semantic": {"name": "signal", "arg_names": [], "import_names": ["signal"], "rh... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_82785:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82785:FunctionDef_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82785:FunctionDef_L10_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_82785:Assign_L11_C8"}, {"f": "ajibawa-2023/Python-C... |
"""Test result object"""
import sys
import traceback
import unittest
from StringIO import StringIO
from django.utils.unittest import util
from django.utils.unittest.compatibility import wraps
__unittest = True
def failfast(method):
@wraps(method)
def inner(self, *args, **kw):
if getattr(self, 'fail... | ajibawa-2023/Python-Code-Large/train/row_82786 | 120 | 183 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82786:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 1], "level": 0, "parent": null, "vector": [8, 0, 0.0055, 0.0055, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_82786:FunctionDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82786:FunctionDef_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82786:FunctionDef_L16_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_82786:If_L17_C8"}, {"f": "ajibawa-2023/Python-C... |
import os
import sys
from django.utils.unittest.loader import defaultTestLoader
def collector():
# import __main__ triggers code re-execution
__main__ = sys.modules['__main__']
setupDir = os.path.abspath(os.path.dirname(__main__.__file__))
return defaultTestLoader.discover(setupDir)
| ajibawa-2023/Python-Code-Large/train/row_82787 | 7 | 9 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82787:Import_L1_C0", "label": "os import os", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.1111, 0.1111, 0, 0.66, 0.0, 688, 0, 1, 0, 0, 688, 0, 0], "semantic": {"name": "os", "arg_names": [], "import_names": ["os"], "rhs_call_name": ""... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_82787:FunctionDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82787:Assign_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82787:FunctionDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82787:Assign_L8_C4"}, {"f": "ajibawa-2023/Python-Code-L... |
"""TestSuite"""
import sys
import unittest
from django.utils.unittest import case, util
__unittest = True
class BaseTestSuite(unittest.TestSuite):
"""A simple test suite that doesn't provide class or module shared fixtures.
"""
def __init__(self, tests=()):
self._tests = []
self.addTests... | ajibawa-2023/Python-Code-Large/train/row_82788 | 185 | 287 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82788:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 1], "level": 0, "parent": null, "vector": [8, 0, 0.0035, 0.0035, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_82788:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82788:Expr_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82788:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82788:FunctionDef_L13_C4"}, {"f": "ajibawa-2023/Python-Code-... |
"""Test case implementation"""
import sys
import difflib
import pprint
import re
import unittest
import warnings
from django.utils.unittest import result
from django.utils.unittest.util import\
safe_repr, safe_str, strclass,\
unorderable_list_difference
from django.utils.unittest.compatibility import wraps
... | ajibawa-2023/Python-Code-Large/train/row_82789 | 563 | 1,076 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82789:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 1], "level": 0, "parent": null, "vector": [8, 0, 0.0009, 0.0009, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_82789:ClassDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82789:Expr_L24_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82789:ClassDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82789:Expr_L32_C4"}, {"f": "ajibawa-2023/Python-Code-Large/t... |
"""Various utility functions."""
__unittest = True
_MAX_LENGTH = 80
def safe_repr(obj, short=False):
try:
result = repr(obj)
except Exception:
result = object.__repr__(obj)
if not short or len(result) < _MAX_LENGTH:
return result
return result[:_MAX_LENGTH] + ' [truncated]...'... | ajibawa-2023/Python-Code-Large/train/row_82790 | 60 | 99 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82790:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 1], "level": 0, "parent": null, "vector": [8, 0, 0.0101, 0.0101, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_82790:FunctionDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82790:Try_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82790:Try_L8_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_82790:Assign_L9_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/... |
"""
unittest2
unittest2 is a backport of the new features added to the unittest testing
framework in Python 2.7. It is tested to run on Python 2.4 - 2.6.
To use unittest2 instead of unittest simply replace ``import unittest`` with
``import unittest2``.
Copyright (c) 1999-2003 Steve Purcell
Copyright (c) 2003-2010 P... | ajibawa-2023/Python-Code-Large/train/row_82791 | 21 | 80 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82791:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 27], "level": 0, "parent": null, "vector": [8, 0, 0.175, 0.3375, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_82791:Try_L33_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82791:ImportFrom_L35_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82791:Try_L33_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82791:If_L37_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/r... |
"""Main entry point"""
import sys
if sys.argv[0].endswith("__main__.py"):
sys.argv[0] = "unittest2"
__unittest = True
from django.utils.unittest.main import main_
main_()
| ajibawa-2023/Python-Code-Large/train/row_82792 | 7 | 10 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82792:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 1], "level": 0, "parent": null, "vector": [8, 0, 0.1, 0.1, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_82792:If_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82792:Assign_L5_C4"}] |
"""Loading unittests."""
import os
import re
import sys
import traceback
import types
import unittest
from fnmatch import fnmatch
from django.utils.unittest import case, suite
try:
from os.path import relpath
except ImportError:
from django.utils.unittest.compatibility import relpath
__unittest = True
de... | ajibawa-2023/Python-Code-Large/train/row_82793 | 191 | 322 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82793:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 1], "level": 0, "parent": null, "vector": [8, 0, 0.0031, 0.0031, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_82793:Try_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82793:ImportFrom_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82793:Try_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82793:ImportFrom_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large... |
"""Running tests"""
import sys
import time
import unittest
from django.utils.unittest import result
try:
from django.utils.unittest.signals import registerResult
except ImportError:
def registerResult(_):
pass
__unittest = True
class _WritelnDecorator(object):
"""Used to decorate file-like obj... | ajibawa-2023/Python-Code-Large/train/row_82794 | 156 | 206 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82794:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 1], "level": 0, "parent": null, "vector": [8, 0, 0.0049, 0.0049, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_82794:Try_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82794:ImportFrom_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82794:Try_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82794:FunctionDef_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/... |
"""
Synchronization primitives:
- reader-writer lock (preference to writers)
(Contributed to Django by eugene@lazutkin.com)
"""
import contextlib
try:
import threading
except ImportError:
import dummy_threading as threading
class RWLock(object):
"""
Classic implementation of reader-writer lock ... | ajibawa-2023/Python-Code-Large/train/row_82795 | 44 | 93 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82795:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 7], "level": 0, "parent": null, "vector": [8, 0, 0.043, 0.0753, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotati... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_82795:Try_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82795:Import_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82795:Try_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82795:Import_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/r... |
"Implementation of tzinfo classes for use with datetime.datetime."
from __future__ import unicode_literals
import time
from datetime import timedelta, tzinfo
from django.utils.encoding import force_str, force_text, DEFAULT_LOCALE_ENCODING
# Python's doc say: "A tzinfo subclass must have an __init__() method that ca... | ajibawa-2023/Python-Code-Large/train/row_82796 | 54 | 100 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82796:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 1], "level": 0, "parent": null, "vector": [8, 0, 0.01, 0.01, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation"... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_82796:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82796:Expr_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82796:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82796:FunctionDef_L17_C4"}, {"f": "ajibawa-2023/Python-Code-... |
import decimal
import datetime
from django.conf import settings
from django.utils import dateformat, numberformat, datetime_safe
from django.utils.importlib import import_module
from django.utils.encoding import force_str
from django.utils.functional import lazy
from django.utils.safestring import mark_safe
from djang... | ajibawa-2023/Python-Code-Large/train/row_82797 | 120 | 207 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82797:Import_L1_C0", "label": "decimal import decimal", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0048, 0.0048, 0, 0.66, 0.0, 349, 0, 1, 0, 0, 349, 0, 0], "semantic": {"name": "decimal", "arg_names": [], "import_names": ["decimal"],... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_82797:FunctionDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82797:Expr_L31_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82797:FunctionDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82797:Assign_L37_C4"}, {"f": "ajibawa-2023/Python-Code... |
"""
Functions for reversing a regular expression (used in reverse URL resolving).
Used internally by Django and not intended for external use.
This is not, and is not intended to be, a complete reg-exp decompiler. It
should be good enough for a large class of URLS, however.
"""
from __future__ import unicode_literals
... | ajibawa-2023/Python-Code-Large/train/row_82798 | 177 | 342 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82798:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 7], "level": 0, "parent": null, "vector": [8, 0, 0.0117, 0.0205, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_82798:ClassDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82798:Expr_L30_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82798:ClassDef_L36_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82798:Expr_L37_C4"}, {"f": "ajibawa-2023/Python-Code-Large/t... |
from django.utils.six.moves import html_parser as _html_parser
import re
import sys
current_version = sys.version_info
use_workaround = (
(current_version < (2, 7, 3)) or
(current_version >= (3, 0) and current_version < (3, 2, 3))
)
HTMLParseError = _html_parser.HTMLParseError
if not use_workaround:
HTM... | ajibawa-2023/Python-Code-Large/train/row_82799 | 79 | 113 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82799:ImportFrom_L1_C0", "label": "from django.utils.six.moves import _html_parser", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0088, 0.0088, 0, 0.66, 0.0, 886, 0, 1, 0, 0, 886, 0, 0], "semantic": {"name": "django.utils.six.moves", "... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_82799:If_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82799:Assign_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82799:If_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82799:Assign_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row... |
from __future__ import unicode_literals
import re
import unicodedata
import warnings
from gzip import GzipFile
from io import BytesIO
from django.utils.encoding import force_text
from django.utils.functional import allow_lazy, SimpleLazyObject
from django.utils import six
from django.utils.six.moves import html_entit... | ajibawa-2023/Python-Code-Large/train/row_82800 | 236 | 428 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82800:ImportFrom_L1_C0", "label": "from __future__ import unicode_literals", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0023, 0.0023, 0, 0.66, 0.0, 777, 0, 1, 0, 0, 777, 0, 0], "semantic": {"name": "__future__", "arg_names": [], "imp... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_82800:If_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82800:ImportFrom_L19_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82800:FunctionDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82800:Expr_L31_C4"}, {"f": "ajibawa-2023/Python-Code-Larg... |
import os
import stat
import sys
from os.path import join, normcase, normpath, abspath, isabs, sep, dirname
from django.utils.encoding import force_text
from django.utils import six
try:
WindowsError = WindowsError
except NameError:
class WindowsError(Exception):
pass
if not six.PY3:
fs_encoding ... | ajibawa-2023/Python-Code-Large/train/row_82801 | 43 | 98 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82801:Import_L1_C0", "label": "os import os", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0102, 0.0102, 0, 0.66, 0.0, 688, 0, 1, 0, 0, 688, 0, 0], "semantic": {"name": "os", "arg_names": [], "import_names": ["os"], "rhs_call_name": ""... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_82801:Try_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82801:Assign_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82801:Try_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82801:ClassDef_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/r... |
import logging
import traceback
from django.conf import settings
from django.core import mail
from django.views.debug import ExceptionReporter, get_exception_reporter_filter
# Make sure a NullHandler is available
# This was added in Python 2.7/3.2
try:
from logging import NullHandler
except ImportError:
clas... | ajibawa-2023/Python-Code-Large/train/row_82802 | 56 | 148 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82802:Import_L1_C0", "label": "logging import logging", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0068, 0.0068, 0, 0.66, 0.0, 715, 0, 1, 0, 0, 715, 0, 0], "semantic": {"name": "logging", "arg_names": [], "import_names": ["logging"],... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_82802:Try_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82802:ImportFrom_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82802:Try_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82802:ClassDef_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/t... |
"""
A class for storing a tree graph. Primarily used for filter constructs in the
ORM.
"""
import copy
class Node(object):
"""
A single internal node in the tree graph. A Node should be viewed as a
connection (the root) with the children being either leaf nodes or other
Node instances.
"""
# S... | ajibawa-2023/Python-Code-Large/train/row_82803 | 76 | 156 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82803:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 4], "level": 0, "parent": null, "vector": [8, 0, 0.016, 0.0256, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotati... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_82803:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82803:Expr_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82803:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82803:Assign_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/tr... |
"""
Providing iterator functions that are not in all version of Python we support.
Where possible, we try to use the system-native version and only fall back to
these implementations if necessary.
"""
import collections
import itertools
import sys
import warnings
def is_iterable(x):
"A implementation independent... | ajibawa-2023/Python-Code-Large/train/row_82804 | 25 | 46 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82804:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 5], "level": 0, "parent": null, "vector": [8, 0, 0.0652, 0.1087, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_82804:FunctionDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82804:Expr_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82804:FunctionDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82804:Try_L15_C4"}, {"f": "ajibawa-2023/Python-Code-La... |
from __future__ import unicode_literals
import datetime
import os
import subprocess
def get_version(version=None):
"Returns a PEP 386-compliant version number from VERSION."
if version is None:
from django import VERSION as version
else:
assert len(version) == 5
assert version[3] i... | ajibawa-2023/Python-Code-Large/train/row_82805 | 28 | 51 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82805:ImportFrom_L1_C0", "label": "from __future__ import unicode_literals", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0196, 0.0196, 0, 0.66, 0.0, 777, 0, 1, 0, 0, 777, 0, 0], "semantic": {"name": "__future__", "arg_names": [], "imp... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_82805:FunctionDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82805:Expr_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82805:FunctionDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82805:If_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/t... |
"Functions that help with dynamically creating decorators for views."
from functools import wraps, update_wrapper, WRAPPER_ASSIGNMENTS
class classonlymethod(classmethod):
def __get__(self, instance, owner):
if instance is not None:
raise AttributeError("This method is available only on the vie... | ajibawa-2023/Python-Code-Large/train/row_82806 | 60 | 112 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82806:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 1], "level": 0, "parent": null, "vector": [8, 0, 0.0089, 0.0089, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_82806:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82806:FunctionDef_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82806:FunctionDef_L6_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_82806:If_L7_C8"}, {"f": "ajibawa-2023/Python-Code-Lar... |
from django.conf import settings
from django.utils.safestring import mark_safe
from django.utils import six
def format(number, decimal_sep, decimal_pos=None, grouping=0, thousand_sep='',
force_grouping=False):
"""
Gets a number (as a number or string), and returns it as a string,
using formats ... | ajibawa-2023/Python-Code-Large/train/row_82807 | 30 | 48 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82807:ImportFrom_L1_C0", "label": "from django.conf import settings", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0208, 0.0208, 0, 0.66, 0.0, 128, 0, 1, 0, 0, 128, 0, 0], "semantic": {"name": "django.conf", "arg_names": [], "import_na... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_82807:FunctionDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82807:Expr_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82807:FunctionDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82807:Assign_L17_C4"}, {"f": "ajibawa-2023/Python-Code-La... |
"""Fixer for __unicode__ methods.
Uses the django.utils.encoding.python_2_unicode_compatible decorator.
"""
from __future__ import unicode_literals
from lib2to3 import fixer_base
from lib2to3.fixer_util import find_indentation, Name, syms, touch_import
from lib2to3.pgen2 import token
from lib2to3.pytree import Leaf,... | ajibawa-2023/Python-Code-Large/train/row_82808 | 19 | 36 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82808:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 4], "level": 0, "parent": null, "vector": [8, 0, 0.0694, 0.1111, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_82808:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82808:Assign_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82808:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82808:Assign_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Lar... |
# This is a copy of the Python logging.config.dictconfig module,
# reproduced with permission. It is provided here for backwards
# compatibility for Python versions prior to 2.7.
#
# Copyright 2009-2010 by Vinay Sajip. All Rights Reserved.
#
# Permission to use, copy, modify, and distribute this software and its
# docu... | ajibawa-2023/Python-Code-Large/train/row_82809 | 339 | 555 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82809:Import_L21_C0", "label": "logging.handlers import logging.handlers", "type": "import", "loc": [21, 21], "level": 0, "parent": null, "vector": [1, 0, 0.0378, 0.0018, 0, 0.66, 0.0, 365, 0, 1, 0, 0, 365, 0, 0], "semantic": {"name": "logging.handlers", "arg_names": []... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_82809:FunctionDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82809:Assign_L31_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82809:FunctionDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82809:If_L32_C4"}, {"f": "ajibawa-2023/Python-Code-L... |
"""Utilities for writing code that runs on Python 2 and 3"""
# Copyright (c) 2010-2014 Benjamin Peterson
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including with... | ajibawa-2023/Python-Code-Large/train/row_82810 | 339 | 676 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82810:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 1], "level": 0, "parent": null, "vector": [8, 0, 0.0015, 0.0015, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_82810:If_L35_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82810:Assign_L36_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82810:If_L35_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82810:Assign_L37_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row... |
"""
Based on "python-archive" -- http://pypi.python.org/pypi/python-archive/
Copyright (c) 2010 Gary Wilson Jr. <gary.wilson@gmail.com> and contributors.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the So... | ajibawa-2023/Python-Code-Large/train/row_82811 | 114 | 215 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82811:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 23], "level": 0, "parent": null, "vector": [8, 0, 0.0558, 0.107, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_82811:ClassDef_L32_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82811:Expr_L33_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82811:ClassDef_L38_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82811:Expr_L39_C4"}, {"f": "ajibawa-2023/Python-Code-Large/t... |
"""Timezone helper functions.
This module uses pytz when it's available and fallbacks when it isn't.
"""
from datetime import datetime, timedelta, tzinfo
from threading import local
import time as _time
try:
import pytz
except ImportError:
pytz = None
from django.conf import settings
from django.utils impor... | ajibawa-2023/Python-Code-Large/train/row_82812 | 129 | 293 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82812:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 4], "level": 0, "parent": null, "vector": [8, 0, 0.0085, 0.0137, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_82812:Try_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82812:Import_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82812:Try_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82812:Assign_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/r... |
"""HTML utilities suitable for global use."""
from __future__ import unicode_literals
import re
import string
try:
from urllib.parse import quote, unquote, urlsplit, urlunsplit
except ImportError: # Python 2
from urllib import quote, unquote
from urlparse import urlsplit, urlunsplit
from django.utils... | ajibawa-2023/Python-Code-Large/train/row_82813 | 160 | 273 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82813:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 1], "level": 0, "parent": null, "vector": [8, 0, 0.0037, 0.0037, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_82813:Try_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82813:ImportFrom_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82813:Try_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82813:ImportFrom_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/tr... |
"""
Django's standard crypto functions and utilities.
"""
from __future__ import unicode_literals
import hmac
import struct
import hashlib
import binascii
import operator
import time
from functools import reduce
# Use the system PRNG if possible
import random
try:
random = random.SystemRandom()
using_sysrando... | ajibawa-2023/Python-Code-Large/train/row_82814 | 78 | 164 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82814:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0122, 0.0183, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_82814:Try_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82814:Assign_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82814:Try_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82814:Assign_L18_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/r... |
# This code was mostly based on ipaddr-py
# Copyright 2007 Google Inc. http://code.google.com/p/ipaddr-py/
# Licensed under the Apache License, Version 2.0 (the "License").
from django.core.exceptions import ValidationError
from django.utils.six.moves import xrange
def clean_ipv6_address(ip_str, unpack_ipv4=False,
... | ajibawa-2023/Python-Code-Large/train/row_82815 | 107 | 268 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82815:ImportFrom_L4_C0", "label": "from django.core.exceptions import ValidationError", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.0149, 0.0037, 0, 0.66, 0.0, 160, 0, 1, 0, 0, 160, 0, 0], "semantic": {"name": "django.core.exceptions"... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_82815:FunctionDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82815:Expr_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82815:FunctionDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82815:Assign_L28_C4"}, {"f": "ajibawa-2023/Python-Code-La... |
# Taken from Python 2.7 with permission from/by the original author.
import sys
def _resolve_name(name, package, level):
"""Return the absolute name of the module to be imported."""
if not hasattr(package, 'rindex'):
raise ValueError("'package' not set to a string")
dot = len(package)
for x in ... | ajibawa-2023/Python-Code-Large/train/row_82816 | 19 | 36 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82816:Import_L2_C0", "label": "sys import sys", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0556, 0.0278, 0, 0.66, 0.0, 509, 0, 1, 0, 0, 509, 0, 0], "semantic": {"name": "sys", "arg_names": [], "import_names": ["sys"], "rhs_call_name"... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_82816:FunctionDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82816:Expr_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82816:FunctionDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82816:If_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/t... |
# Django 1.5 only supports Python >= 2.6, where the standard library includes
# the json module. Previous version of Django shipped a copy for Python < 2.6.
# For backwards compatibility, we're keeping an importable json module
# at this location, with the same lookup sequence.
# Avoid shadowing the simplejson module... | ajibawa-2023/Python-Code-Large/train/row_82817 | 13 | 31 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82817:ImportFrom_L8_C0", "label": "from __future__ import absolute_import", "type": "import", "loc": [8, 8], "level": 0, "parent": null, "vector": [1, 0, 0.2581, 0.0323, 0, 0.66, 0.0, 777, 0, 1, 0, 0, 777, 0, 0], "semantic": {"name": "__future__", "arg_names": [], "impo... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_82817:Try_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82817:Import_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82817:Try_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82817:Assign_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/r... |
"""Functions to parse datetime objects."""
# We're using regular expressions rather than time.strptime because:
# - They provide both validation and parsing.
# - They're more flexible for datetimes.
# - The date/datetime/time constructors produce friendlier error messages.
import datetime
import re
from django.utils ... | ajibawa-2023/Python-Code-Large/train/row_82818 | 42 | 82 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82818:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 1], "level": 0, "parent": null, "vector": [8, 0, 0.0122, 0.0122, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_82818:FunctionDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82818:Expr_L31_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82818:FunctionDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82818:Assign_L36_C4"}, {"f": "ajibawa-2023/Python-Code... |
"""
Fixes Python 2.4's failure to deepcopy unbound functions.
"""
import copy
import types
import warnings
warnings.warn("django.utils.copycompat is deprecated; use the native copy module instead",
DeprecationWarning)
# Monkeypatch copy's deepcopy registry to handle functions correctly.
if (hasattr(cop... | ajibawa-2023/Python-Code-Large/train/row_82819 | 8 | 18 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82819:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.1111, 0.1667, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_82819:If_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82819:Assign_L14_C4"}] |
"""
The md5 and sha modules are deprecated since Python 2.5, replaced by the
hashlib module containing both hash algorithms. Here, we provide a common
interface to the md5 and sha constructors, depending on system version.
"""
import warnings
warnings.warn("django.utils.hashcompat is deprecated; use hashlib instead",
... | ajibawa-2023/Python-Code-Large/train/row_82820 | 8 | 15 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82820:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 5], "level": 0, "parent": null, "vector": [8, 0, 0.2, 0.3333, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation... | [] |
import copy
import warnings
from django.utils import six
class MergeDict(object):
"""
A simple class for creating new "virtual" dictionaries that actually look
up values in more than one dictionary, passed in the constructor.
If a key appears in more than one of the given dictionaries, only the
f... | ajibawa-2023/Python-Code-Large/train/row_82821 | 305 | 518 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82821:Import_L1_C0", "label": "copy import copy", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0019, 0.0019, 0, 0.66, 0.0, 739, 0, 1, 0, 0, 739, 0, 0], "semantic": {"name": "copy", "arg_names": [], "import_names": ["copy"], "rhs_call_n... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_82821:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82821:Expr_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82821:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82821:FunctionDef_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Lar... |
"""
Syndication feed generation library -- used for generating RSS, etc.
Sample usage:
>>> from django.utils import feedgenerator
>>> feed = feedgenerator.Rss201rev2Feed(
... title="Poynter E-Media Tidbits",
... link="http://www.poynter.org/column.asp?id=31",
... description="A group Weblog by the sharpes... | ajibawa-2023/Python-Code-Large/train/row_82822 | 231 | 389 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82822:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 23], "level": 0, "parent": null, "vector": [8, 0, 0.0308, 0.0591, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annota... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_82822:Try_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82822:ImportFrom_L28_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82822:Try_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82822:ImportFrom_L30_C4"}, {"f": "ajibawa-2023/Python-Code-Large... |
# Python's datetime strftime doesn't handle dates before 1900.
# These classes override date and datetime to support the formatting of a date
# through its full "proleptic Gregorian" date range.
#
# Based on code submitted to comp.lang.python by Andrew Dalke
#
# >>> datetime_safe.date(1850, 8, 2).strftime("%Y/%m/%d was... | ajibawa-2023/Python-Code-Large/train/row_82823 | 56 | 92 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82823:ImportFrom_L10_C0", "label": "from datetime import real_date, real_datetime", "type": "import", "loc": [10, 10], "level": 0, "parent": null, "vector": [1, 0, 0.1087, 0.0109, 0, 0.66, 0.0, 426, 0, 2, 0, 0, 426, 0, 0], "semantic": {"name": "datetime", "arg_names": [... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_82823:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82823:FunctionDef_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82823:FunctionDef_L15_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_82823:Return_L16_C8"}, {"f": "ajibawa-2023/Python-... |
"""Translation helper functions."""
from __future__ import unicode_literals
import locale
import os
import re
import sys
import gettext as gettext_module
from threading import local
from django.utils.importlib import import_module
from django.utils.encoding import force_str, force_text
from django.utils._os import up... | ajibawa-2023/Python-Code-Large/train/row_82824 | 381 | 612 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82824:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 1], "level": 0, "parent": null, "vector": [8, 0, 0.0016, 0.0016, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_82824:FunctionDef_L44_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82824:Expr_L45_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82824:FunctionDef_L44_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82824:Assign_L49_C4"}, {"f": "ajibawa-2023/Python-Code... |
# These are versions of the functions in django.utils.translation.trans_real
# that don't actually do anything. This is purely for performance, so that
# settings.USE_I18N = False can use this module rather than trans_real.py.
from django.conf import settings
from django.utils.encoding import force_text
from django.ut... | ajibawa-2023/Python-Code-Large/train/row_82825 | 37 | 63 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82825:ImportFrom_L5_C0", "label": "from django.conf import settings", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.0794, 0.0159, 0, 0.66, 0.0, 128, 0, 1, 0, 0, 128, 0, 0], "semantic": {"name": "django.conf", "arg_names": [], "import_na... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_82825:FunctionDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82825:If_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82825:If_L10_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_82825:Return_L10_C20"}, {"f": "ajibawa-2023/Python-Code-Large/trai... |
"""
Internationalization support.
"""
from __future__ import unicode_literals
from django.utils.encoding import force_text
from django.utils.functional import lazy
from django.utils import six
__all__ = [
'activate', 'deactivate', 'override', 'deactivate_all',
'get_language', 'get_language_from_request',
... | ajibawa-2023/Python-Code-Large/train/row_82826 | 78 | 150 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82826:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0133, 0.02, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotatio... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_82826:ClassDef_L32_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82826:Expr_L33_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82826:ClassDef_L32_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82826:FunctionDef_L45_C4"}, {"f": "ajibawa-2023/Python-Code-... |
"""
This module contains helper functions for controlling caching. It does so by
managing the "Vary" header of responses. It includes functions to patch the
header of response objects directly and decorators that change functions to do
that header-patching themselves.
For information on the Vary header, see:
http... | ajibawa-2023/Python-Code-Large/train/row_82827 | 132 | 254 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82827:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 18], "level": 0, "parent": null, "vector": [8, 0, 0.0374, 0.0709, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annota... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_82827:FunctionDef_L34_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82827:Expr_L35_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82827:FunctionDef_L34_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82827:FunctionDef_L46_C4"}, {"f": "ajibawa-2023/Python... |
from __future__ import unicode_literals
from calendar import timegm
from django.conf import settings
from django.contrib.sites.models import get_current_site
from django.core.exceptions import ImproperlyConfigured, ObjectDoesNotExist
from django.http import HttpResponse, Http404
from django.template import loader, Te... | ajibawa-2023/Python-Code-Large/train/row_82828 | 98 | 196 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82828:ImportFrom_L1_C0", "label": "from __future__ import unicode_literals", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0051, 0.0051, 0, 0.66, 0.0, 777, 0, 1, 0, 0, 777, 0, 0], "semantic": {"name": "__future__", "arg_names": [], "imp... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_82828:FunctionDef_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82828:Assign_L19_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82828:FunctionDef_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82828:If_L20_C4"}, {"f": "ajibawa-2023/Python-Code-L... |
"""
Czech-specific form helpers
"""
from __future__ import absolute_import, unicode_literals
import re
from django.contrib.localflavor.cz.cz_regions import REGION_CHOICES
from django.core.validators import EMPTY_VALUES
from django.forms import ValidationError
from django.forms.fields import Select, RegexField, Field... | ajibawa-2023/Python-Code-Large/train/row_82829 | 58 | 136 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82829:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0147, 0.0221, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_82829:ClassDef_L19_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82829:Expr_L20_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82829:ClassDef_L19_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82829:FunctionDef_L23_C4"}, {"f": "ajibawa-2023/Python-Code-... |
"""
Czech regions, translations get from http://www.crwflags.com/fotw/Flags/cz-re.html
"""
from django.utils.translation import ugettext_lazy as _
REGION_CHOICES = (
('PR', _('Prague')),
('CE', _('Central Bohemian Region')),
('SO', _('South Bohemian Region')),
('PI', _('Pilsen Region')),
('CA', _(... | ajibawa-2023/Python-Code-Large/train/row_82830 | 3 | 22 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82830:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0909, 0.1364, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [] |
"""
India-specific Form helpers.
"""
from __future__ import absolute_import, unicode_literals
import re
from django.contrib.localflavor.in_.in_states import STATES_NORMALIZED, STATE_CHOICES
from django.core.validators import EMPTY_VALUES
from django.forms import ValidationError
from django.forms.fields import Field,... | ajibawa-2023/Python-Code-Large/train/row_82831 | 46 | 115 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82831:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0174, 0.0261, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_82831:ClassDef_L39_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82831:Assign_L40_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82831:ClassDef_L39_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82831:FunctionDef_L44_C4"}, {"f": "ajibawa-2023/Python-Cod... |
"""
A mapping of state misspellings/abbreviations to normalized abbreviations, and
an alphabetical list of states for use as `choices` in a formfield.
This exists in this standalone file so that it's only imported into memory
when explicitly needed.
"""
STATE_CHOICES = (
('KA', 'Karnataka'),
('AP', 'Andhra Pr... | ajibawa-2023/Python-Code-Large/train/row_82832 | 3 | 133 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82832:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 7], "level": 0, "parent": null, "vector": [8, 0, 0.0301, 0.0526, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [] |
"""
NL-specific Form helpers
"""
from __future__ import absolute_import, unicode_literals
import re
from django.contrib.localflavor.nl.nl_provinces import PROVINCE_CHOICES
from django.core.validators import EMPTY_VALUES
from django.forms import ValidationError
from django.forms.fields import Field, Select
from djang... | ajibawa-2023/Python-Code-Large/train/row_82833 | 52 | 104 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82833:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0192, 0.0288, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_82833:ClassDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82833:Expr_L22_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82833:ClassDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82833:Assign_L25_C4"}, {"f": "ajibawa-2023/Python-Code-Large... |
from django.utils.translation import ugettext_lazy as _
PROVINCE_CHOICES = (
('DR', _('Drenthe')),
('FL', _('Flevoland')),
('FR', _('Friesland')),
('GL', _('Gelderland')),
('GR', _('Groningen')),
('LB', _('Limburg')),
('NB', _('Noord-Brabant')),
('NH', _('Noord-Holland')),
('OV', _(... | ajibawa-2023/Python-Code-Large/train/row_82834 | 2 | 16 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82834:ImportFrom_L1_C0", "label": "from django.utils.translation import _", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0625, 0.0625, 0, 0.66, 0.0, 389, 0, 1, 0, 0, 389, 0, 0], "semantic": {"name": "django.utils.translation", "arg_nam... | [] |
from __future__ import absolute_import, unicode_literals
import datetime
from django.core.validators import EMPTY_VALUES
from django.forms import ValidationError
from django.forms.fields import RegexField, Select
from django.utils.translation import ugettext_lazy as _
from django.contrib.localflavor.mk.mk_choices im... | ajibawa-2023/Python-Code-Large/train/row_82835 | 50 | 102 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82835:ImportFrom_L1_C0", "label": "from __future__ import absolute_import, unicode_literals", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0098, 0.0098, 0, 0.66, 0.0, 777, 0, 2, 0, 0, 777, 0, 0], "semantic": {"name": "__future__", "arg... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_82835:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82835:Expr_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82835:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82835:Assign_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large... |
# -*- coding: utf-8 -*-
"""
Macedonian municipalities per the reorganization from 2004.
"""
from __future__ import unicode_literals
from django.utils.translation import ugettext_lazy as _
MK_MUNICIPALITIES = (
('AD', _('Aerodrom')),
('AR', _('Aračinovo')),
('BR', _('Berovo')),
('TL', _('Bitola')),
... | ajibawa-2023/Python-Code-Large/train/row_82836 | 4 | 94 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82836:Expr_L2_C0", "label": "expression", "type": "expression", "loc": [2, 4], "level": 0, "parent": null, "vector": [8, 0, 0.0319, 0.0319, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [] |
from django.db.models.fields import CharField
from django.utils.translation import ugettext_lazy as _
from django.contrib.localflavor.mk.mk_choices import MK_MUNICIPALITIES
from django.contrib.localflavor.mk.forms import (UMCNField as UMCNFormField,
MKIdentityCardNumberField as MKIdentityCardNumberFormField)
cla... | ajibawa-2023/Python-Code-Large/train/row_82837 | 28 | 44 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82837:ImportFrom_L1_C0", "label": "from django.db.models.fields import CharField", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0227, 0.0227, 0, 0.66, 0.0, 5, 0, 1, 0, 0, 5, 0, 0], "semantic": {"name": "django.db.models.fields", "arg_n... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_82837:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82837:Assign_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82837:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82837:FunctionDef_L13_C4"}, {"f": "ajibawa-2023/Python-Code-... |
"""
Iceland specific form helpers.
"""
from __future__ import absolute_import, unicode_literals
from django.contrib.localflavor.is_.is_postalcodes import IS_POSTALCODES
from django.core.validators import EMPTY_VALUES
from django.forms import ValidationError
from django.forms.fields import RegexField
from django.forms... | ajibawa-2023/Python-Code-Large/train/row_82838 | 44 | 86 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82838:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0233, 0.0349, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_82838:ClassDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82838:Expr_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82838:ClassDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82838:Assign_L21_C4"}, {"f": "ajibawa-2023/Python-Code-Large... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
IS_POSTALCODES = (
('101', '101 Reykjavík'),
('103', '103 Reykjavík'),
('104', '104 Reykjavík'),
('105', '105 Reykjavík'),
('107', '107 Reykjavík'),
('108', '108 Reykjavík'),
('109', '109 Reykjavík'),
('110', '110 Reykjavík... | ajibawa-2023/Python-Code-Large/train/row_82839 | 2 | 152 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82839:ImportFrom_L2_C0", "label": "from __future__ import unicode_literals", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0132, 0.0066, 0, 0.66, 0.0, 777, 0, 1, 0, 0, 777, 0, 0], "semantic": {"name": "__future__", "arg_names": [], "imp... | [] |
# -*- coding: utf-8 -*-
"""
Swedish specific Form helpers
"""
from __future__ import absolute_import, unicode_literals
import re
from django import forms
from django.utils.translation import ugettext_lazy as _
from django.core.validators import EMPTY_VALUES
from django.contrib.localflavor.se.se_counties import COUNTY... | ajibawa-2023/Python-Code-Large/train/row_82840 | 56 | 161 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82840:Expr_L2_C0", "label": "expression", "type": "expression", "loc": [2, 4], "level": 0, "parent": null, "vector": [8, 0, 0.0186, 0.0186, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_82840:ClassDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82840:Expr_L25_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82840:ClassDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82840:FunctionDef_L33_C4"}, {"f": "ajibawa-2023/Python-Code-... |
# -*- coding: utf-8 -*-
"""
An alphabetical list of Swedish counties, sorted by codes.
http://en.wikipedia.org/wiki/Counties_of_Sweden
This exists in this standalone file so that it's only imported into memory
when explicitly needed.
"""
from __future__ import unicode_literals
from django.utils.translation import u... | ajibawa-2023/Python-Code-Large/train/row_82841 | 4 | 37 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82841:Expr_L2_C0", "label": "expression", "type": "expression", "loc": [2, 10], "level": 0, "parent": null, "vector": [8, 0, 0.1622, 0.2432, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annota... | [] |
import datetime
from django.utils import six
def id_number_checksum(gd):
"""
Calculates a Swedish ID number checksum, using the
"Luhn"-algoritm
"""
n = s = 0
for c in (gd['year'] + gd['month'] + gd['day'] + gd['serial']):
tmp = ((n % 2) and 1 or 2) * int(c)
if tmp > 9:
... | ajibawa-2023/Python-Code-Large/train/row_82842 | 36 | 84 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82842:Import_L1_C0", "label": "datetime import datetime", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0119, 0.0119, 0, 0.66, 0.0, 426, 0, 1, 0, 0, 426, 0, 0], "semantic": {"name": "datetime", "arg_names": [], "import_names": ["datetim... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_82842:FunctionDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82842:Expr_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82842:FunctionDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82842:Assign_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Lar... |
"""
IT-specific Form helpers
"""
from __future__ import absolute_import, unicode_literals
import re
from django.contrib.localflavor.it.it_province import PROVINCE_CHOICES
from django.contrib.localflavor.it.it_region import REGION_CHOICES
from django.contrib.localflavor.it.util import ssn_check_digit, vat_number_chec... | ajibawa-2023/Python-Code-Large/train/row_82843 | 50 | 88 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82843:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0227, 0.0341, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_82843:ClassDef_L19_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82843:Assign_L20_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82843:ClassDef_L19_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82843:FunctionDef_L23_C4"}, {"f": "ajibawa-2023/Python-Cod... |
# -*- coding: utf-8 -*
from __future__ import unicode_literals
REGION_CHOICES = (
('ABR', 'Abruzzo'),
('BAS', 'Basilicata'),
('CAL', 'Calabria'),
('CAM', 'Campania'),
('EMR', 'Emilia-Romagna'),
('FVG', 'Friuli-Venezia Giulia'),
('LAZ', 'Lazio'),
('LIG', 'Liguria'),
('LOM', 'Lombardi... | ajibawa-2023/Python-Code-Large/train/row_82844 | 2 | 25 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82844:ImportFrom_L2_C0", "label": "from __future__ import unicode_literals", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.08, 0.04, 0, 0.66, 0.0, 777, 0, 1, 0, 0, 777, 0, 0], "semantic": {"name": "__future__", "arg_names": [], "import_... | [] |
from django.utils.encoding import smart_text
def ssn_check_digit(value):
"Calculate Italian social security number check digit."
ssn_even_chars = {
'0': 0, '1': 1, '2': 2, '3': 3, '4': 4, '5': 5, '6': 6, '7': 7, '8': 8,
'9': 9, 'A': 0, 'B': 1, 'C': 2, 'D': 3, 'E': 4, 'F': 5, 'G': 6, 'H': 7,
... | ajibawa-2023/Python-Code-Large/train/row_82845 | 21 | 44 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82845:ImportFrom_L1_C0", "label": "from django.utils.encoding import smart_text", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0227, 0.0227, 0, 0.66, 0.0, 96, 0, 1, 0, 0, 96, 0, 0], "semantic": {"name": "django.utils.encoding", "arg_na... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_82845:FunctionDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82845:Expr_L4_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82845:FunctionDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82845:Assign_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Lar... |
# -*- coding: utf-8 -*
from __future__ import unicode_literals
PROVINCE_CHOICES = (
('AG', 'Agrigento'),
('AL', 'Alessandria'),
('AN', 'Ancona'),
('AO', 'Aosta'),
('AR', 'Arezzo'),
('AP', 'Ascoli Piceno'),
('AT', 'Asti'),
('AV', 'Avellino'),
('BA', 'Bari'),
('BT', 'Barletta-Andr... | ajibawa-2023/Python-Code-Large/train/row_82846 | 2 | 115 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82846:ImportFrom_L2_C0", "label": "from __future__ import unicode_literals", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0174, 0.0087, 0, 0.66, 0.0, 777, 0, 1, 0, 0, 777, 0, 0], "semantic": {"name": "__future__", "arg_names": [], "imp... | [] |
"""
GB-specific Form helpers
"""
from __future__ import absolute_import, unicode_literals
import re
from django.contrib.localflavor.gb.gb_regions import GB_NATIONS_CHOICES, GB_REGION_CHOICES
from django.forms.fields import CharField, Select
from django.forms import ValidationError
from django.utils.translation impor... | ajibawa-2023/Python-Code-Large/train/row_82847 | 30 | 55 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82847:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0364, 0.0545, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_82847:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82847:Expr_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82847:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82847:Assign_L24_C4"}, {"f": "ajibawa-2023/Python-Code-Large... |
"""
Sources:
English regions: http://www.statistics.gov.uk/geography/downloads/31_10_01_REGION_names_and_codes_12_00.xls
Northern Ireland regions: http://en.wikipedia.org/wiki/List_of_Irish_counties_by_area
Welsh regions: http://en.wikipedia.org/wiki/Preserved_counties_of_Wales
Scottish regions: http://... | ajibawa-2023/Python-Code-Large/train/row_82848 | 8 | 97 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82848:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 7], "level": 0, "parent": null, "vector": [8, 0, 0.0412, 0.0722, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [] |
"""
JP-specific Form helpers
"""
from __future__ import absolute_import
from django.contrib.localflavor.jp.jp_prefectures import JP_PREFECTURES
from django.forms.fields import RegexField, Select
from django.utils.translation import ugettext_lazy as _
class JPPostalCodeField(RegexField):
"""
A form field tha... | ajibawa-2023/Python-Code-Large/train/row_82849 | 18 | 39 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82849:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0513, 0.0769, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_82849:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82849:Expr_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82849:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82849:Assign_L18_C4"}, {"f": "ajibawa-2023/Python-Code-Large... |
from django.utils.translation import ugettext_lazy
JP_PREFECTURES = (
('hokkaido', ugettext_lazy('Hokkaido'),),
('aomori', ugettext_lazy('Aomori'),),
('iwate', ugettext_lazy('Iwate'),),
('miyagi', ugettext_lazy('Miyagi'),),
('akita', ugettext_lazy('Akita'),),
('yamagata', ugettext_lazy('Yamagat... | ajibawa-2023/Python-Code-Large/train/row_82850 | 2 | 51 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82850:ImportFrom_L1_C0", "label": "from django.utils.translation import ugettext_lazy", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0196, 0.0196, 0, 0.66, 0.0, 389, 0, 1, 0, 0, 389, 0, 0], "semantic": {"name": "django.utils.translatio... | [] |
"""
Chile specific form helpers.
"""
from __future__ import absolute_import, unicode_literals
from django.core.validators import EMPTY_VALUES
from django.forms import ValidationError
from django.forms.fields import RegexField, Select
from django.utils.translation import ugettext_lazy as _
from django.utils.encoding i... | ajibawa-2023/Python-Code-Large/train/row_82851 | 51 | 97 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82851:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0206, 0.0309, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_82851:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82851:Expr_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82851:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82851:FunctionDef_L20_C4"}, {"f": "ajibawa-2023/Python-Code-... |
# -*- coding: utf-8 -*-
"""
A list of Chilean regions as `choices` in a formfield.
This exists in this standalone file so that it's only imported into memory
when explicitly needed.
"""
from __future__ import unicode_literals
REGION_CHOICES = (
('RM', 'Región Metropolitana de Santiago'),
('I', 'Región de T... | ajibawa-2023/Python-Code-Large/train/row_82852 | 3 | 26 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82852:Expr_L2_C0", "label": "expression", "type": "expression", "loc": [2, 7], "level": 0, "parent": null, "vector": [8, 0, 0.1731, 0.2308, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [] |
"""
AT-specific Form helpers
"""
from __future__ import unicode_literals
import re
from django.core.validators import EMPTY_VALUES
from django.forms import ValidationError
from django.forms.fields import Field, RegexField, Select
from django.utils.translation import ugettext_lazy as _
re_ssn = re.compile(r'^\d{4} \d{... | ajibawa-2023/Python-Code-Large/train/row_82853 | 33 | 69 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82853:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.029, 0.0435, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotati... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_82853:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82853:Expr_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82853:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82853:Assign_L21_C4"}, {"f": "ajibawa-2023/Python-Code-Large... |
# -*- coding: utf-8 -*
from django.utils.translation import ugettext_lazy as _
STATE_CHOICES = (
('BL', _('Burgenland')),
('KA', _('Carinthia')),
('NO', _('Lower Austria')),
('OO', _('Upper Austria')),
('SA', _('Salzburg')),
('ST', _('Styria')),
('TI', _('Tyrol')),
('VO', _('Vorarlberg'... | ajibawa-2023/Python-Code-Large/train/row_82854 | 2 | 14 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82854:ImportFrom_L2_C0", "label": "from django.utils.translation import _", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.1429, 0.0714, 0, 0.66, 0.0, 389, 0, 1, 0, 0, 389, 0, 0], "semantic": {"name": "django.utils.translation", "arg_nam... | [] |
"""
DE-specific Form helpers
"""
from __future__ import absolute_import, unicode_literals
import re
from django.contrib.localflavor.de.de_states import STATE_CHOICES
from django.core.validators import EMPTY_VALUES
from django.forms import ValidationError
from django.forms.fields import Field, RegexField, Select
from... | ajibawa-2023/Python-Code-Large/train/row_82855 | 48 | 88 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82855:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0227, 0.0341, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_82855:ClassDef_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82855:Assign_L19_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82855:ClassDef_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82855:FunctionDef_L22_C4"}, {"f": "ajibawa-2023/Python-Cod... |
# -*- coding: utf-8 -*
from django.utils.translation import ugettext_lazy as _
STATE_CHOICES = (
('BW', _('Baden-Wuerttemberg')),
('BY', _('Bavaria')),
('BE', _('Berlin')),
('BB', _('Brandenburg')),
('HB', _('Bremen')),
('HH', _('Hamburg')),
('HE', _('Hessen')),
('MV', _('Mecklenburg-We... | ajibawa-2023/Python-Code-Large/train/row_82856 | 2 | 21 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82856:ImportFrom_L2_C0", "label": "from django.utils.translation import _", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0952, 0.0476, 0, 0.66, 0.0, 389, 0, 1, 0, 0, 389, 0, 0], "semantic": {"name": "django.utils.translation", "arg_nam... | [] |
"""
Australian-specific Form helpers
"""
from __future__ import absolute_import, unicode_literals
import re
from django.contrib.localflavor.au.au_states import STATE_CHOICES
from django.core.validators import EMPTY_VALUES
from django.forms import ValidationError
from django.forms.fields import Field, RegexField, Sel... | ajibawa-2023/Python-Code-Large/train/row_82857 | 31 | 60 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82857:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0333, 0.05, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotatio... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_82857:ClassDef_L19_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82857:Expr_L20_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82857:ClassDef_L19_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82857:Assign_L25_C4"}, {"f": "ajibawa-2023/Python-Code-Large... |
from django.utils.translation import ugettext_lazy as _
from django.db.models.fields import CharField
from django.contrib.localflavor.au.au_states import STATE_CHOICES
from django.contrib.localflavor.au import forms
class AUStateField(CharField):
description = _("Australian State")
def __init__(self, *args,... | ajibawa-2023/Python-Code-Large/train/row_82858 | 28 | 43 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82858:ImportFrom_L1_C0", "label": "from django.utils.translation import _", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0233, 0.0233, 0, 0.66, 0.0, 389, 0, 1, 0, 0, 389, 0, 0], "semantic": {"name": "django.utils.translation", "arg_nam... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_82858:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82858:Assign_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82858:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82858:FunctionDef_L11_C4"}, {"f": "ajibawa-2023/Python-Code-L... |
"""
An alphabetical list of states for use as `choices` in a formfield.
This exists in this standalone file so that it's only imported into memory
when explicitly needed.
"""
STATE_CHOICES = (
('ACT', 'Australian Capital Territory'),
('NSW', 'New South Wales'),
('NT', 'Northern Territory'),
('QLD', 'Q... | ajibawa-2023/Python-Code-Large/train/row_82859 | 2 | 17 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82859:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 6], "level": 0, "parent": null, "vector": [8, 0, 0.2059, 0.3529, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [] |
"""
PT-specific Form helpers
"""
from __future__ import unicode_literals
import re
from django.core.validators import EMPTY_VALUES
from django.forms import ValidationError
from django.forms.fields import Field, RegexField
from django.utils.encoding import smart_text
from django.utils.translation import ugettext_lazy ... | ajibawa-2023/Python-Code-Large/train/row_82860 | 29 | 50 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82860:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.04, 0.06, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation"... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_82860:ClassDef_L17_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82860:Assign_L18_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82860:ClassDef_L17_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82860:FunctionDef_L22_C4"}, {"f": "ajibawa-2023/Python-Cod... |
# -*- coding: utf-8 -*-
"""
HR-specific Form helpers
"""
from __future__ import absolute_import, unicode_literals
import datetime
import re
from django.contrib.localflavor.hr.hr_choices import (
HR_LICENSE_PLATE_PREFIX_CHOICES, HR_COUNTY_CHOICES,
HR_PHONE_NUMBER_PREFIX_CHOICES)
from django.core.validators imp... | ajibawa-2023/Python-Code-Large/train/row_82861 | 119 | 282 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82861:Expr_L2_C0", "label": "expression", "type": "expression", "loc": [2, 4], "level": 0, "parent": null, "vector": [8, 0, 0.0106, 0.0106, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_82861:ClassDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82861:Expr_L31_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82861:ClassDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82861:FunctionDef_L35_C4"}, {"f": "ajibawa-2023/Python-Code-... |
# -*- coding: utf-8 -*-
"""
Sources:
Croatian Counties: http://en.wikipedia.org/wiki/ISO_3166-2:HR
Croatia doesn't have official abbreviations for counties.
The ones provided are in common use.
"""
from __future__ import unicode_literals
from django.utils.translation import ugettext_lazy as _
HR_COUNTY_C... | ajibawa-2023/Python-Code-Large/train/row_82862 | 8 | 112 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82862:Expr_L2_C0", "label": "expression", "type": "expression", "loc": [2, 8], "level": 0, "parent": null, "vector": [8, 0, 0.0446, 0.0625, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [] |
# -*- coding: utf-8 -*-
"""
AR-specific Form helpers.
"""
from __future__ import absolute_import, unicode_literals
from django.contrib.localflavor.ar.ar_provinces import PROVINCE_CHOICES
from django.core.validators import EMPTY_VALUES
from django.forms import ValidationError
from django.forms.fields import RegexField... | ajibawa-2023/Python-Code-Large/train/row_82863 | 70 | 128 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82863:Expr_L2_C0", "label": "expression", "type": "expression", "loc": [2, 4], "level": 0, "parent": null, "vector": [8, 0, 0.0234, 0.0234, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_82863:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82863:Expr_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82863:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82863:FunctionDef_L20_C4"}, {"f": "ajibawa-2023/Python-Code-... |
# -*- coding: utf-8 -*-
"""
A list of Argentinean provinces and autonomous cities as `choices` in a
formfield. From
http://www.argentina.gov.ar/argentina/portal/paginas.dhtml?pagina=425
This exists in this standalone file so that it's only imported into memory
when explicitly needed.
"""
from __future__ import unicode... | ajibawa-2023/Python-Code-Large/train/row_82864 | 3 | 37 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82864:Expr_L2_C0", "label": "expression", "type": "expression", "loc": [2, 9], "level": 0, "parent": null, "vector": [8, 0, 0.1486, 0.2162, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [] |
# -*- coding: utf-8 -*-
"""
BR-specific Form helpers
"""
from __future__ import absolute_import, unicode_literals
import re
from django.contrib.localflavor.br.br_states import STATE_CHOICES
from django.core.validators import EMPTY_VALUES
from django.forms import ValidationError
from django.forms.fields import Field,... | ajibawa-2023/Python-Code-Large/train/row_82865 | 96 | 166 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82865:Expr_L2_C0", "label": "expression", "type": "expression", "loc": [2, 4], "level": 0, "parent": null, "vector": [8, 0, 0.0181, 0.0181, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_82865:ClassDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82865:Assign_L21_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82865:ClassDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82865:FunctionDef_L25_C4"}, {"f": "ajibawa-2023/Python-Cod... |
# -*- coding: utf-8 -*-
"""
An alphabetical list of Brazilian states for use as `choices` in a formfield.
This exists in this standalone file so that it's only imported into memory
when explicitly needed.
"""
from __future__ import unicode_literals
STATE_CHOICES = (
('AC', 'Acre'),
('AL', 'Alagoas'),
('AP... | ajibawa-2023/Python-Code-Large/train/row_82866 | 3 | 38 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82866:Expr_L2_C0", "label": "expression", "type": "expression", "loc": [2, 7], "level": 0, "parent": null, "vector": [8, 0, 0.1184, 0.1579, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [] |
"""
Slovak-specific form helpers
"""
from __future__ import absolute_import, unicode_literals
from django.contrib.localflavor.sk.sk_districts import DISTRICT_CHOICES
from django.contrib.localflavor.sk.sk_regions import REGION_CHOICES
from django.forms.fields import Select, RegexField
from django.utils.translation imp... | ajibawa-2023/Python-Code-Large/train/row_82867 | 23 | 46 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82867:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0435, 0.0652, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_82867:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82867:Expr_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82867:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82867:FunctionDef_L17_C4"}, {"f": "ajibawa-2023/Python-Code-... |
"""
Slovak districts according to http://sk.wikipedia.org/wiki/Administrat%C3%ADvne_%C4%8Dlenenie_Slovenska
"""
from django.utils.translation import ugettext_lazy as _
DISTRICT_CHOICES = (
('BB', _('Banska Bystrica')),
('BS', _('Banska Stiavnica')),
('BJ', _('Bardejov')),
('BN', _('Banovce nad Bebravo... | ajibawa-2023/Python-Code-Large/train/row_82868 | 3 | 87 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82868:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.023, 0.0345, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotati... | [] |
"""
Slovak regions according to http://sk.wikipedia.org/wiki/Administrat%C3%ADvne_%C4%8Dlenenie_Slovenska
"""
from django.utils.translation import ugettext_lazy as _
REGION_CHOICES = (
('BB', _('Banska Bystrica region')),
('BA', _('Bratislava region')),
('KE', _('Kosice region')),
('NR', _('Nitra regi... | ajibawa-2023/Python-Code-Large/train/row_82869 | 3 | 16 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82869:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.125, 0.1875, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotati... | [] |
# -*- coding: utf-8 -*-
"""
Mexican-specific form helpers.
"""
from __future__ import unicode_literals
import re
from django.forms import ValidationError
from django.forms.fields import Select, RegexField
from django.utils import six
from django.utils.translation import ugettext_lazy as _
from django.core.validators i... | ajibawa-2023/Python-Code-Large/train/row_82870 | 85 | 227 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82870:Expr_L2_C0", "label": "expression", "type": "expression", "loc": [2, 4], "level": 0, "parent": null, "vector": [8, 0, 0.0132, 0.0132, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_82870:ClassDef_L51_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82870:Expr_L52_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82870:ClassDef_L51_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82870:FunctionDef_L55_C4"}, {"f": "ajibawa-2023/Python-Code-... |
# -*- coding: utf-8 -*-
"""
A list of Mexican states for use as `choices` in a formfield.
This exists in this standalone file so that it's only imported into memory
when explicitly needed.
"""
from __future__ import unicode_literals
from django.utils.translation import ugettext_lazy as _
# All 31 states, plus the `D... | ajibawa-2023/Python-Code-Large/train/row_82871 | 4 | 46 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82871:Expr_L2_C0", "label": "expression", "type": "expression", "loc": [2, 7], "level": 0, "parent": null, "vector": [8, 0, 0.0978, 0.1304, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.