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 |
|---|---|---|---|---|---|---|---|
# -*- coding: utf-8 -*-
#########################################################################
## This scaffolding model makes your app work on Google App Engine too
## File is released under public domain and you can use without limitations
#########################################################################
... | ajibawa-2023/Python-Code-Large/train/row_742 | 18 | 83 | 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_742:If_L12_C0", "label": "if", "type": "if", "loc": [12, 19], "level": 0, "parent": null, "vector": [4, 0, 0.1867, 0.0964, 0, 0.66, 0.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snipp... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_742:If_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_742:Assign_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_742:If_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_742:Assign_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_742:If_... |
# -*- coding: utf-8 -*-
# this file is released under public domain and you can use without limitations
#########################################################################
## This is a sample controller
## - index is the default action of any application
## - user is required for authentication and authorization... | ajibawa-2023/Python-Code-Large/train/row_744 | 16 | 76 | 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_744:FunctionDef_L13_C0", "label": "index", "type": "function", "loc": [13, 22], "level": 0, "parent": null, "vector": [2, 0, 0.2303, 0.1316, 0, 0.66, 0.0, 780, 0, 0, 1, 0, 0, 0, 3], "semantic": {"name": "index", "arg_names": [], "import_names": [], "rhs_call_name": "", ... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_744:FunctionDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_744:Expr_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_744:FunctionDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_744:Assign_L21_C4"}, {"f": "ajibawa-2023/Python-Code-Large/t... |
# -*- coding: utf-8 -*-
# This is an app-specific example router
#
# This simple router is used for setting languages from app/languages directory
# as a part of the application path: app/<lang>/controller/function
# Language from default.py or 'en' (if the file is not found) is used as
# a default_language
#
# ... | ajibawa-2023/Python-Code-Large/train/row_745 | 4 | 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_745:ImportFrom_L21_C0", "label": "from fileutils import abspath", "type": "import", "loc": [21, 21], "level": 0, "parent": null, "vector": [1, 0, 0.5526, 0.0263, 0, 0.66, 0.0, 687, 0, 1, 0, 0, 687, 0, 0], "semantic": {"name": "fileutils", "arg_names": [], "import_names"... | [] |
#!/usr/bin/env python
from setuptools import setup
from gluon.fileutils import tar, untar, read_file, write_file
import tarfile
import sys
def tar(file, filelist, expression='^.+$'):
"""
tars dir/files into file, only tars file that match expression
"""
tar = tarfile.TarFile(file, 'w')
try:
... | ajibawa-2023/Python-Code-Large/train/row_746 | 20 | 81 | 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_746:ImportFrom_L3_C0", "label": "from setuptools import setup", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.037, 0.0123, 0, 0.66, 0.0, 182, 0, 1, 0, 0, 182, 0, 0], "semantic": {"name": "setuptools", "arg_names": [], "import_names": ["... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_746:FunctionDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_746:Expr_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_746:FunctionDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_746:Assign_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/tra... |
"""
web2py handler for isapi-wsgi for IIS. Requires:
http://code.google.com/p/isapi-wsgi/
"""
# The entry point for the ISAPI extension.
def __ExtensionFactory__():
import os
import sys
path = os.path.dirname(os.path.abspath(__file__))
os.chdir(path)
sys.path = [path] + [p for p in sys.path if not... | ajibawa-2023/Python-Code-Large/train/row_747 | 25 | 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_747:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 4], "level": 0, "parent": null, "vector": [8, 0, 0.0676, 0.1081, 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_747:FunctionDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_747:Import_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_747:FunctionDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_747:Import_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/tr... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
This file is part of the web2py Web Framework
Copyrighted by Massimo Di Pierro <mdipierro@cs.depaul.edu>
License: LGPLv3 (http://www.gnu.org/licenses/lgpl.html)
This is a CGI handler for Apache
Requires apache+[mod_cgi or mod_cgid].
In httpd.conf put something like:
... | ajibawa-2023/Python-Code-Large/train/row_748 | 9 | 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_748:Expr_L4_C0", "label": "expression", "type": "expression", "loc": [4, 51], "level": 0, "parent": null, "vector": [8, 0, 0.4365, 0.7619, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotati... | [] |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Sropulpof
# Copyright (C) 2008 Société des arts technologiques (SAT)
# http://www.sat.qc.ca
# All rights reserved.
#
# This file is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Soft... | ajibawa-2023/Python-Code-Large/train/row_749 | 143 | 258 | 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_749:Expr_L22_C0", "label": "expression", "type": "expression", "loc": [22, 26], "level": 0, "parent": null, "vector": [8, 0, 0.093, 0.0194, 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_749:FunctionDef_L38_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_749:Expr_L39_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_749:FunctionDef_L38_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_749:Return_L40_C4"}, {"f": "ajibawa-2023/Python-Code-Large/t... |
"""Convert a FAQ (AlterEgo) markdown dump into ReSt documents using pandoc
**Todo**
#. add titles
#. add logging
#. add CLI with optparse
"""
import os
import sys
import glob
import subprocess
import logging
indir = 'faq_markdown'
outdir = 'faq_rst'
inpath = os.path.join('.', indir)
outpath = os.path.join('.', out... | ajibawa-2023/Python-Code-Large/train/row_750 | 21 | 42 | 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_750:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 7], "level": 0, "parent": null, "vector": [8, 0, 0.0952, 0.1667, 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_750:For_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_750:Assign_L27_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_750:For_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_750:Assign_L28_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_750:F... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Sropulpof
# Copyright (C) 2008 Société des arts technologiques (SAT)
# http://www.sat.qc.ca
# All rights reserved.
#
# This file is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Soft... | ajibawa-2023/Python-Code-Large/train/row_751 | 149 | 271 | 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_751:Expr_L22_C0", "label": "expression", "type": "expression", "loc": [22, 26], "level": 0, "parent": null, "vector": [8, 0, 0.0886, 0.0185, 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_751:FunctionDef_L38_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_751:Expr_L39_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_751:FunctionDef_L38_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_751:Return_L40_C4"}, {"f": "ajibawa-2023/Python-Code-Large/t... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Sropulpof
# Copyright (C) 2008 Société des arts technologiques (SAT)
# http://www.sat.qc.ca
# All rights reserved.
#
# This file is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Soft... | ajibawa-2023/Python-Code-Large/train/row_752 | 143 | 258 | 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_752:Expr_L22_C0", "label": "expression", "type": "expression", "loc": [22, 26], "level": 0, "parent": null, "vector": [8, 0, 0.093, 0.0194, 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_752:FunctionDef_L38_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_752:Expr_L39_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_752:FunctionDef_L38_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_752:Return_L40_C4"}, {"f": "ajibawa-2023/Python-Code-Large/t... |
import os
import subprocess
import codecs
#--- BZR: changelog information
def write_changelog_bzr(repo_path, output_dir,
output_file='bzr_revision_log.txt',
target_encoding='utf-8'):
"""Write the bzr changelog to a file whi... | ajibawa-2023/Python-Code-Large/train/row_753 | 33 | 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_753:Import_L1_C0", "label": "os import os", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0115, 0.0115, 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_753:FunctionDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_753:Expr_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_753:FunctionDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_753:Assign_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/tra... |
#
# A pair of directives for inserting content that will only appear in
# either html or latex.
#
from docutils.nodes import Body, Element
from docutils.writers.html4css1 import HTMLTranslator
try:
from sphinx.latexwriter import LaTeXTranslator
except ImportError:
from sphinx.writers.latex import LaTeXTranslat... | ajibawa-2023/Python-Code-Large/train/row_756 | 60 | 96 | 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_756:ImportFrom_L6_C0", "label": "from docutils.nodes import Body, Element", "type": "import", "loc": [6, 6], "level": 0, "parent": null, "vector": [1, 0, 0.0625, 0.0104, 0, 0.66, 0.0, 127, 0, 2, 0, 0, 127, 0, 0], "semantic": {"name": "docutils.nodes", "arg_names": [], "... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_756:Try_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_756:ImportFrom_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_756:Try_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_756:ImportFrom_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_... |
from cStringIO import StringIO
import compiler
import inspect
import textwrap
import tokenize
from compiler_unparse import unparse
class Comment(object):
""" A comment block.
"""
is_comment = True
def __init__(self, start_lineno, end_lineno, text):
# int : The first line number in the block. ... | ajibawa-2023/Python-Code-Large/train/row_757 | 97 | 158 | 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_757:ImportFrom_L1_C0", "label": "from cStringIO import StringIO", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0063, 0.0063, 0, 0.66, 0.0, 764, 0, 1, 0, 0, 764, 0, 0], "semantic": {"name": "cStringIO", "arg_names": [], "import_names": ... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_757:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_757:Expr_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_757:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_757:Assign_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/r... |
from distutils.core import setup
import setuptools
import sys, os
version = "0.2.dev"
setup(
name="numpydoc",
packages=["numpydoc"],
package_dir={"numpydoc": ""},
version=version,
description="Sphinx extension to support docstrings in Numpy format",
# classifiers from http://pypi.python.org/py... | ajibawa-2023/Python-Code-Large/train/row_760 | 5 | 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_760:ImportFrom_L1_C0", "label": "from distutils.core import setup", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0323, 0.0323, 0, 0.66, 0.0, 152, 0, 1, 0, 0, 152, 0, 0], "semantic": {"name": "distutils.core", "arg_names": [], "import_n... | [] |
""" Turn compiler.ast structures back into executable python code.
The unparse method takes a compiler.ast tree and transforms it back into
valid python code. It is incomplete and currently only works for
import statements, function calls, function definitions, assignments, and
basic expressions.
... | ajibawa-2023/Python-Code-Large/train/row_761 | 386 | 860 | 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_761:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 12], "level": 0, "parent": null, "vector": [8, 0, 0.0076, 0.014, 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_761:FunctionDef_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Assign_L19_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L20_C4"}, {"f": "ajibawa-2023/Python-Code-Large/t... |
"""
==============
phantom_import
==============
Sphinx extension to make directives from ``sphinx.ext.autodoc`` and similar
extensions to use docstrings loaded from an XML file.
This extension loads an XML file in the Pydocweb format [1] and
creates a dummy module that contains the specified docstrings. This
can be ... | ajibawa-2023/Python-Code-Large/train/row_762 | 101 | 162 | 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_762:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 16], "level": 0, "parent": null, "vector": [8, 0, 0.0525, 0.0988, 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_762:FunctionDef_L19_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_762:Expr_L20_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_762:FunctionDef_L19_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_762:Expr_L21_C4"}, {"f": "ajibawa-2023/Python-Code-Large/tra... |
from numpydoc import setup
| ajibawa-2023/Python-Code-Large/train/row_763 | 1 | 1 | 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_763:ImportFrom_L1_C0", "label": "from numpydoc import setup", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 1.0, 1.0, 0, 0.66, 0.0, 32, 0, 1, 0, 0, 32, 0, 0], "semantic": {"name": "numpydoc", "arg_names": [], "import_names": ["setup"], "r... | [] |
import re, inspect, textwrap, pydoc
import sphinx
from docscrape import NumpyDocString, FunctionDoc, ClassDoc
class SphinxDocString(NumpyDocString):
# string conversion routines
def _str_header(self, name, symbol='`'):
return ['.. rubric:: ' + name, '']
def _str_field_list(self, name):
ret... | ajibawa-2023/Python-Code-Large/train/row_764 | 87 | 149 | 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_764:Import_L1_C0", "label": "re import re, inspect, textwrap\u2026", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0067, 0.0067, 0, 0.66, 0.0, 540, 0, 4, 0, 0, 540, 0, 0], "semantic": {"name": "re", "arg_names": [], "import_names": ["re... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_764:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_764:FunctionDef_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_764:FunctionDef_L7_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_764:Return_L8_C8"}, {"f": "ajibawa-2023/Python-Code-Large/t... |
"""
========
numpydoc
========
Sphinx extension that handles docstrings in the Numpy standard format. [1]
It will:
- Convert Parameters etc. sections to field lists.
- Convert See Also section to a See also entry.
- Renumber references.
- Extract the signature from the docstring, if it can't be determined otherwise.... | ajibawa-2023/Python-Code-Large/train/row_765 | 61 | 117 | 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_765:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 17], "level": 0, "parent": null, "vector": [8, 0, 0.0769, 0.1453, 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_765:FunctionDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_765:If_L26_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_765:If_L26_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_765:Assign_L28_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_76... |
# -*- coding: utf-8 -*-
# default_application, default_controller, default_function
# are used when the respective element is missing from the
# (possibly rewritten) incoming URL
#
default_application = 'init' # ordinarily set in base routes.py
default_controller = 'default' # ordinarily set in app-specific routes... | ajibawa-2023/Python-Code-Large/train/row_766 | 13 | 199 | 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_766:Assign_L7_C0", "label": "default_application =", "type": "assigned_variable", "loc": [7, 7], "level": 0, "parent": null, "vector": [14, 0, 0.0352, 0.005, 0, 0.66, 0.0, 558, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "default_application", "arg_names": [], "import_na... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_766:FunctionDef_L115_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_766:Expr_L116_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_766:If_L197_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_766:Import_L198_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
if '__file__' in globals():
path = os.path.dirname(os.path.abspath(__file__))
elif hasattr(sys, 'frozen'):
path = os.path.dirname(os.path.abspath(sys.executable)) # for py2exe
else: # should never happen
path = os.getcwd()
os.chdir(path)... | ajibawa-2023/Python-Code-Large/train/row_767 | 20 | 33 | 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_767:Import_L4_C0", "label": "os import os", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.1212, 0.0303, 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_767:If_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_767:Assign_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_767:If_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_767:If_L9_C0"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_767:If_L9_C0", ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
This file is part of the web2py Web Framework
Copyrighted by Massimo Di Pierro <mdipierro@cs.depaul.edu>
License: LGPLv3 (http://www.gnu.org/licenses/lgpl.html)
"""
##############################################################################
# Configuration paramete... | ajibawa-2023/Python-Code-Large/train/row_768 | 55 | 106 | 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_768:Expr_L4_C0", "label": "expression", "type": "expression", "loc": [4, 8], "level": 0, "parent": null, "vector": [8, 0, 0.0566, 0.0472, 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_768:If_L48_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_768:Assign_L49_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_768:If_L48_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_768:Assign_L52_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_768:Fun... |
import logging
logger = logging.getLogger('x90-analyze')
logger.setLevel(logging.DEBUG)
# File Handler
hdlr = logging.FileHandler('logs/run.log')
formatter = logging.Formatter('%(asctime)s [%(levelname)s] %(message)s')
hdlr.setFormatter(formatter)
logger.addHandler(hdlr)
hdlr.setLevel(logging.DEBUG)
# Stream handle... | ajibawa-2023/Python-Code-Large/train/row_769 | 19 | 27 | 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_769:Import_L1_C0", "label": "logging import logging", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.037, 0.037, 0, 0.66, 0.0, 715, 0, 1, 0, 0, 715, 0, 0], "semantic": {"name": "logging", "arg_names": [], "import_names": ["logging"], "rh... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_769:FunctionDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_769:Expr_L21_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_769:FunctionDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_769:Expr_L24_C1"}, {"f": "ajibawa-2023/Python-Code-Large/tra... |
import os
import re
import shutil
import commands
import _mysql
import hashlib
import logger
# Analyze project.
def analyze_metrics(project, revision, url, db, folder):
analyze_code_metrics(project, revision, url, db, folder)
analyze_filemetrics(project, revision, url, db, folder)
# Get code metrics:
def analyze_co... | ajibawa-2023/Python-Code-Large/train/row_770 | 42 | 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_770:Import_L1_C0", "label": "os import os", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0175, 0.0175, 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_770:FunctionDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_770:Expr_L11_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_770:FunctionDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_770:Expr_L12_C1"}, {"f": "ajibawa-2023/Python-Code-Large/tra... |
##
## Mercurial-analyzer
##
## Todo: skriv om...
from xml.dom import minidom
import logger
## Parses a dom file
def parsedom(file):
try:
dom = minidom.parse(file)
except Exception:
logger.printerror("Failed to parse the xml file " + file);
exit()
return dom
class Project:
name="-noname-"
type="svn"
u... | ajibawa-2023/Python-Code-Large/train/row_772 | 89 | 121 | 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_772:ImportFrom_L6_C0", "label": "from xml.dom import minidom", "type": "import", "loc": [6, 6], "level": 0, "parent": null, "vector": [1, 0, 0.0496, 0.0083, 0, 0.66, 0.0, 290, 0, 1, 0, 0, 290, 0, 0], "semantic": {"name": "xml.dom", "arg_names": [], "import_names": ["min... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_772:FunctionDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_772:Try_L11_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_772:Try_L11_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_772:Assign_L12_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_... |
##
## mercurial-analyzer
##
## Requires: Cloc (sudo apt-get install cloc)
import analyzelib
import settingsreader
from database import DbHandler
import logger
def getType(types, name):
try:
ret = types[name];
return ret
except Exception:
logger.printerror("Missing type "+name)
exit();
logger.printinfo("... | ajibawa-2023/Python-Code-Large/train/row_774 | 21 | 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_774:Import_L6_C0", "label": "analyzelib import analyzelib", "type": "import", "loc": [6, 6], "level": 0, "parent": null, "vector": [1, 0, 0.1667, 0.0278, 0, 0.66, 0.0, 443, 0, 1, 0, 0, 443, 0, 0], "semantic": {"name": "analyzelib", "arg_names": [], "import_names": ["ana... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_774:FunctionDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_774:Try_L12_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_774:Try_L12_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_774:Assign_L13_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_... |
#====================================================================
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you ... | ajibawa-2023/Python-Code-Large/train/row_775 | 38 | 74 | 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_775:Import_L26_C0", "label": "os import os", "type": "import", "loc": [26, 26], "level": 0, "parent": null, "vector": [1, 0, 0.3514, 0.0135, 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_775:FunctionDef_L35_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_775:Assign_L36_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_775:FunctionDef_L35_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_775:For_L37_C4"}, {"f": "ajibawa-2023/Python-Code-Large/tr... |
#!/usr/bin/env python
#
# Copyright 2006, 2007 Google Inc. All Rights Reserved.
# Author: danderson@google.com (David Anderson)
#
# Script for uploading files to a Google Code project.
#
# This is intended to be both a useful script for people who want to
# streamline project uploads and a reference implementation for
... | ajibawa-2023/Python-Code-Large/train/row_777 | 90 | 248 | 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_777:Expr_L46_C0", "label": "expression", "type": "expression", "loc": [46, 47], "level": 0, "parent": null, "vector": [8, 0, 0.1875, 0.0081, 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_777:FunctionDef_L59_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_777:Expr_L60_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_777:FunctionDef_L59_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_777:If_L80_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train... |
#!/usr/bin/env python
#
# Copyright 2006, 2007 Google Inc. All Rights Reserved.
# Author: danderson@google.com (David Anderson)
#
# Script for uploading files to a Google Code project.
#
# This is intended to be both a useful script for people who want to
# streamline project uploads and a reference implementation for
... | ajibawa-2023/Python-Code-Large/train/row_778 | 90 | 248 | 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_778:Expr_L46_C0", "label": "expression", "type": "expression", "loc": [46, 47], "level": 0, "parent": null, "vector": [8, 0, 0.1875, 0.0081, 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_778:FunctionDef_L59_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_778:Expr_L60_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_778:FunctionDef_L59_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_778:If_L80_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train... |
#!/usr/bin/env python3
import random
class MastermindGame():
def __init__(self):
self._generated_string = ""
used_digits = set()
for i in range(4):
digit = random.randrange(0, 10, 1)
while digit in used_digits:
digit = random.randrange(0, 10, 1)
... | ajibawa-2023/Python-Code-Large/train/row_779 | 29 | 40 | 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_779:Import_L2_C0", "label": "random import random", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.05, 0.025, 0, 0.66, 0.0, 715, 0, 1, 0, 0, 715, 0, 0], "semantic": {"name": "random", "arg_names": [], "import_names": ["random"], "rhs_cal... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_779:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_779:FunctionDef_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_779:FunctionDef_L6_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_779:Assign_L7_C8"}, {"f": "ajibawa-2023/Python-Code-Large/t... |
#!/usr/bin/env python3
import random
class MastermindGame():
def __init__(self):
self._generated_string = ""
used_digits = set()
for i in range(4):
digit = random.randrange(0, 10, 1)
while digit in used_digits:
digit = random.randrange(0, 10, 1)
... | ajibawa-2023/Python-Code-Large/train/row_780 | 29 | 40 | 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_780:Import_L2_C0", "label": "random import random", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.05, 0.025, 0, 0.66, 0.0, 715, 0, 1, 0, 0, 715, 0, 0], "semantic": {"name": "random", "arg_names": [], "import_names": ["random"], "rhs_cal... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_780:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_780:FunctionDef_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_780:FunctionDef_L6_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_780:Assign_L7_C8"}, {"f": "ajibawa-2023/Python-Code-Large/t... |
import time
def yesno(question):
val = raw_input(question + " ")
return val.startswith("y") or val.startswith("Y")
use_pysqlite2 = yesno("Use pysqlite 2.0?")
use_autocommit = yesno("Use autocommit?")
use_executemany= yesno("Use executemany?")
if use_pysqlite2:
from pysqlite2 import dbapi2 as s... | ajibawa-2023/Python-Code-Large/train/row_781 | 42 | 61 | 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_781:Import_L1_C0", "label": "time import time", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0164, 0.0164, 0, 0.66, 0.0, 654, 0, 1, 0, 0, 654, 0, 0], "semantic": {"name": "time", "arg_names": [], "import_names": ["time"], "rhs_call_nam... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_781:FunctionDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_781:Assign_L4_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_781:FunctionDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_781:Return_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/tra... |
import time
def yesno(question):
val = raw_input(question + " ")
return val.startswith("y") or val.startswith("Y")
use_pysqlite2 = yesno("Use pysqlite 2.0?")
if use_pysqlite2:
use_custom_types = yesno("Use custom types?")
use_dictcursor = yesno("Use dict cursor?")
use_rowcursor = yesno("... | ajibawa-2023/Python-Code-Large/train/row_782 | 71 | 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_782:Import_L1_C0", "label": "time import time", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0103, 0.0103, 0, 0.66, 0.0, 654, 0, 1, 0, 0, 654, 0, 0], "semantic": {"name": "time", "arg_names": [], "import_names": ["time"], "rhs_call_nam... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_782:FunctionDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_782:Assign_L4_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_782:FunctionDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_782:Return_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/tra... |
#!/usr/bin/env python
from pysqlite2.test import test
test()
| ajibawa-2023/Python-Code-Large/train/row_783 | 2 | 3 | 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_783:ImportFrom_L2_C0", "label": "from pysqlite2.test import test", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.6667, 0.3333, 0, 0.66, 0.0, 472, 0, 1, 0, 0, 472, 0, 0], "semantic": {"name": "pysqlite2.test", "arg_names": [], "import_na... | [] |
from pysqlite2 import dbapi2 as sqlite
import os, threading
def getcon():
#con = sqlite.connect("db", isolation_level=None, timeout=5.0)
con = sqlite.connect(":memory:")
cur = con.cursor()
cur.execute("create table test(i, s)")
for i in range(10):
cur.execute("insert into test(i, s) values ... | ajibawa-2023/Python-Code-Large/train/row_784 | 56 | 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_784:ImportFrom_L1_C0", "label": "from pysqlite2 import sqlite", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0125, 0.0125, 0, 0.66, 0.0, 987, 0, 1, 0, 0, 987, 0, 0], "semantic": {"name": "pysqlite2", "arg_names": [], "import_names": ["... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_784:FunctionDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_784:Assign_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_784:FunctionDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_784:Assign_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/tra... |
from __future__ import with_statement
from pysqlite2 import dbapi2 as sqlite3
from datetime import datetime, timedelta
import time
def read_modify_write():
# Open connection and create example schema and data.
# In reality, open a database file instead of an in-memory database.
con = sqlite3.connect(":memo... | ajibawa-2023/Python-Code-Large/train/row_786 | 32 | 110 | 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_786:ImportFrom_L1_C0", "label": "from __future__ import with_statement", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0091, 0.0091, 0, 0.66, 0.0, 777, 0, 1, 0, 0, 777, 0, 0], "semantic": {"name": "__future__", "arg_names": [], "import_... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_786:FunctionDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_786:Assign_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_786:FunctionDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_786:Assign_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/tr... |
from pysqlite2 import dbapi2 as sqlite3
Cursor = sqlite3.Cursor
class EagerCursor(Cursor):
def __init__(self, con):
Cursor.__init__(self, con)
self.rows = []
self.pos = 0
def execute(self, *args):
sqlite3.Cursor.execute(self, *args)
self.rows = Cursor.fetchall(self)
... | ajibawa-2023/Python-Code-Large/train/row_787 | 38 | 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_787:ImportFrom_L1_C0", "label": "from pysqlite2 import sqlite3", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0196, 0.0196, 0, 0.66, 0.0, 987, 0, 1, 0, 0, 987, 0, 0], "semantic": {"name": "pysqlite2", "arg_names": [], "import_names": [... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_787:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_787:FunctionDef_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_787:FunctionDef_L6_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_787:Expr_L7_C8"}, {"f": "ajibawa-2023/Python-Code-Large/tra... |
#!/usr/bin/env python
#
# Cross-compile and build pysqlite installers for win32 on Linux or Mac OS X.
#
# The way this works is very ugly, but hey, it *works*! And I didn't have to
# reinvent the wheel using NSIS.
import os
import sys
import urllib
import zipfile
from setup import get_amalgamation
# Cross-compiler
... | ajibawa-2023/Python-Code-Large/train/row_788 | 41 | 68 | 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_788:Import_L8_C0", "label": "os import os", "type": "import", "loc": [8, 8], "level": 0, "parent": null, "vector": [1, 0, 0.1176, 0.0147, 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_788:If_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_788:Assign_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_788:If_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_788:Assign_L18_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_788:If_... |
# -*- coding: utf-8 -*-
#
# pysqlite documentation build configuration file, created by
# sphinx-quickstart.py on Sat Mar 22 02:47:54 2008.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# The contents of this file are pickled, so don't put values in the namespace
# that aren't pic... | ajibawa-2023/Python-Code-Large/train/row_789 | 14 | 132 | 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_789:Import_L14_C0", "label": "sys import sys", "type": "import", "loc": [14, 14], "level": 0, "parent": null, "vector": [1, 0, 0.1061, 0.0076, 0, 0.66, 0.0, 509, 0, 1, 0, 0, 509, 0, 0], "semantic": {"name": "sys", "arg_names": [], "import_names": ["sys"], "rhs_call_name... | [] |
from pysqlite2 import dbapi2 as sqlite3
FIELD_MAX_WIDTH = 20
TABLE_NAME = 'people'
SELECT = 'select * from %s order by age, name_last' % TABLE_NAME
con = sqlite3.connect("mydb")
cur = con.cursor()
cur.execute(SELECT)
# Print a header.
for fieldDesc in cur.description:
print fieldDesc[0].ljust(FIELD_MAX_WIDTH) ,... | ajibawa-2023/Python-Code-Large/train/row_790 | 1 | 2 | 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_790:ImportFrom_L1_C0", "label": "from pysqlite2 import sqlite3", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.5, 0.5, 0, 0.66, 0.0, 987, 0, 1, 0, 0, 987, 0, 0], "semantic": {"name": "pysqlite2", "arg_names": [], "import_names": ["sqlit... | [] |
from pysqlite2 import dbapi2 as sqlite3
def progress():
print "Query still executing. Please wait ..."
con = sqlite3.connect(":memory:")
con.execute("create table test(x)")
# Let's create some data
con.executemany("insert into test(x) values (?)", [(x,) for x in xrange(300)])
# A progress handler, executed ever... | ajibawa-2023/Python-Code-Large/train/row_791 | 12 | 29 | 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_791:ImportFrom_L1_C0", "label": "from pysqlite2 import sqlite3", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0345, 0.0345, 0, 0.66, 0.0, 987, 0, 1, 0, 0, 987, 0, 0], "semantic": {"name": "pysqlite2", "arg_names": [], "import_names": [... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_791:FunctionDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_791:Expr_L4_C4"}] |
from pysqlite2 import dbapi2 as sqlite3
con = sqlite3.connect("mydb")
cur = con.cursor()
SELECT = "select name_last, age from people order by age, name_last"
# 1. Iterate over the rows available from the cursor, unpacking the
# resulting sequences to yield their elements (name_last, age):
cur.execute(SELECT)
for (na... | ajibawa-2023/Python-Code-Large/train/row_792 | 10 | 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_792:ImportFrom_L1_C0", "label": "from pysqlite2 import sqlite3", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0588, 0.0588, 0, 0.66, 0.0, 987, 0, 1, 0, 0, 987, 0, 0], "semantic": {"name": "pysqlite2", "arg_names": [], "import_names": [... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_792:For_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_792:Expr_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_792:For_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_792:Expr_L17_C4"}] |
from pysqlite2 import dbapi2 as sqlite3
# Create a connection to the database file "mydb":
con = sqlite3.connect("mydb")
# Get a Cursor object that operates in the context of Connection con:
cur = con.cursor()
# Execute the SELECT statement:
cur.execute("select * from people order by age")
# Retrieve all rows as a ... | ajibawa-2023/Python-Code-Large/train/row_793 | 5 | 13 | 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_793:ImportFrom_L1_C0", "label": "from pysqlite2 import sqlite3", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0769, 0.0769, 0, 0.66, 0.0, 987, 0, 1, 0, 0, 987, 0, 0], "semantic": {"name": "pysqlite2", "arg_names": [], "import_names": [... | [] |
from pysqlite2 import dbapi2 as sqlite3
con = sqlite3.connect("mydb")
| ajibawa-2023/Python-Code-Large/train/row_794 | 2 | 3 | 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_794:ImportFrom_L1_C0", "label": "from pysqlite2 import sqlite3", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.3333, 0.3333, 0, 0.66, 0.0, 987, 0, 1, 0, 0, 987, 0, 0], "semantic": {"name": "pysqlite2", "arg_names": [], "import_names": [... | [] |
from pysqlite2 import dbapi2 as sqlite3
class MySum:
def __init__(self):
self.count = 0
def step(self, value):
self.count += value
def finalize(self):
return self.count
con = sqlite3.connect(":memory:")
con.create_aggregate("mysum", 1, MySum)
cur = con.cursor()
cur.execute("creat... | ajibawa-2023/Python-Code-Large/train/row_795 | 15 | 20 | 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_795:ImportFrom_L1_C0", "label": "from pysqlite2 import sqlite3", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.05, 0.05, 0, 0.66, 0.0, 987, 0, 1, 0, 0, 987, 0, 0], "semantic": {"name": "pysqlite2", "arg_names": [], "import_names": ["sql... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_795:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_795:FunctionDef_L4_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_795:FunctionDef_L4_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_795:Assign_L5_C8"}, {"f": "ajibawa-2023/Python-Code-Large/t... |
# A minimal SQLite shell for experiments
from pysqlite2 import dbapi2 as sqlite3
con = sqlite3.connect(":memory:")
con.isolation_level = None
cur = con.cursor()
buffer = ""
print "Enter your SQL commands to execute in SQLite."
print "Enter a blank line to exit."
while True:
line = raw_input()
if line == ""... | ajibawa-2023/Python-Code-Large/train/row_796 | 1 | 2 | 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_796:ImportFrom_L1_C0", "label": "from pysqlite2 import sqlite3", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.5, 0.5, 0, 0.66, 0.0, 987, 0, 1, 0, 0, 987, 0, 0], "semantic": {"name": "pysqlite2", "arg_names": [], "import_names": ["sqlit... | [] |
from pysqlite2 import dbapi2 as sqlite3
def dict_factory(cursor, row):
d = {}
for idx, col in enumerate(cursor.description):
d[col[0]] = row[idx]
return d
con = sqlite3.connect(":memory:")
con.row_factory = dict_factory
cur = con.cursor()
cur.execute("select 1 as a")
print cur.fetchone()["a"]
| ajibawa-2023/Python-Code-Large/train/row_797 | 11 | 13 | 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_797:ImportFrom_L1_C0", "label": "from pysqlite2 import sqlite3", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0769, 0.0769, 0, 0.66, 0.0, 987, 0, 1, 0, 0, 987, 0, 0], "semantic": {"name": "pysqlite2", "arg_names": [], "import_names": [... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_797:FunctionDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_797:Assign_L4_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_797:FunctionDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_797:For_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/... |
from pysqlite2 import dbapi2 as sqlite3
import datetime
con = sqlite3.connect(":memory:", detect_types=sqlite3.PARSE_DECLTYPES|sqlite3.PARSE_COLNAMES)
cur = con.cursor()
cur.execute("create table test(d date, ts timestamp)")
today = datetime.date.today()
now = datetime.datetime.now()
cur.execute("insert into test(d,... | ajibawa-2023/Python-Code-Large/train/row_798 | 16 | 20 | 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_798:ImportFrom_L1_C0", "label": "from pysqlite2 import sqlite3", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.05, 0.05, 0, 0.66, 0.0, 987, 0, 1, 0, 0, 987, 0, 0], "semantic": {"name": "pysqlite2", "arg_names": [], "import_names": ["sql... | [] |
from pysqlite2 import dbapi2 as sqlite3
def authorizer_callback(action, arg1, arg2, dbname, source):
if action != sqlite3.SQLITE_SELECT:
return sqlite3.SQLITE_DENY
if arg1 == "private_table":
return sqlite3.SQLITE_DENY
return sqlite3.SQLITE_OK
con = sqlite3.connect(":memory:")
con.executes... | ajibawa-2023/Python-Code-Large/train/row_799 | 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_799:ImportFrom_L1_C0", "label": "from pysqlite2 import sqlite3", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.1111, 0.1111, 0, 0.66, 0.0, 987, 0, 1, 0, 0, 987, 0, 0], "semantic": {"name": "pysqlite2", "arg_names": [], "import_names": [... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_799:FunctionDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_799:If_L4_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_799:If_L4_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_799:Return_L5_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_799:Fu... |
from pysqlite2 import dbapi2 as sqlite3
# The shared cache is only available in SQLite versions 3.3.3 or later
# See the SQLite documentaton for details.
sqlite3.enable_shared_cache(True)
| ajibawa-2023/Python-Code-Large/train/row_800 | 2 | 6 | 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_800:ImportFrom_L1_C0", "label": "from pysqlite2 import sqlite3", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.1667, 0.1667, 0, 0.66, 0.0, 987, 0, 1, 0, 0, 987, 0, 0], "semantic": {"name": "pysqlite2", "arg_names": [], "import_names": [... | [] |
from pysqlite2 import dbapi2 as sqlite3
con = sqlite3.connect(":memory:")
| ajibawa-2023/Python-Code-Large/train/row_801 | 2 | 3 | 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_801:ImportFrom_L1_C0", "label": "from pysqlite2 import sqlite3", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.3333, 0.3333, 0, 0.66, 0.0, 987, 0, 1, 0, 0, 987, 0, 0], "semantic": {"name": "pysqlite2", "arg_names": [], "import_names": [... | [] |
from pysqlite2 import dbapi2 as sqlite3
con = sqlite3.connect("mydb")
cur = con.cursor()
who = "Yeltsin"
age = 72
cur.execute("select name_last, age from people where name_last=? and age=?", (who, age))
print cur.fetchone()
| ajibawa-2023/Python-Code-Large/train/row_802 | 7 | 11 | 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_802:ImportFrom_L1_C0", "label": "from pysqlite2 import sqlite3", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0909, 0.0909, 0, 0.66, 0.0, 987, 0, 1, 0, 0, 987, 0, 0], "semantic": {"name": "pysqlite2", "arg_names": [], "import_names": [... | [] |
from __future__ import with_statement
from pysqlite2 import dbapi2 as sqlite3
con = sqlite3.connect(":memory:")
con.execute("create table person (id integer primary key, firstname varchar unique)")
# Successful, con.commit() is called automatically afterwards
with con:
con.execute("insert into person(firstname) v... | ajibawa-2023/Python-Code-Large/train/row_803 | 8 | 19 | 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_803:ImportFrom_L1_C0", "label": "from __future__ import with_statement", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0526, 0.0526, 0, 0.66, 0.0, 777, 0, 1, 0, 0, 777, 0, 0], "semantic": {"name": "__future__", "arg_names": [], "import_... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_803:Try_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_803:Expr_L15_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_803:Try_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_803:Expr_L17_C4"}] |
from pysqlite2 import dbapi2 as sqlite3
import md5
def md5sum(t):
return md5.md5(t).hexdigest()
con = sqlite3.connect(":memory:")
con.create_function("md5", 1, md5sum)
cur = con.cursor()
cur.execute("select md5(?)", ("foo",))
print cur.fetchone()[0]
| ajibawa-2023/Python-Code-Large/train/row_804 | 9 | 11 | 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_804:ImportFrom_L1_C0", "label": "from pysqlite2 import sqlite3", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0909, 0.0909, 0, 0.66, 0.0, 987, 0, 1, 0, 0, 987, 0, 0], "semantic": {"name": "pysqlite2", "arg_names": [], "import_names": [... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_804:FunctionDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_804:Return_L5_C4"}] |
from pysqlite2 import dbapi2 as sqlite3
con = sqlite3.connect("mydb")
con.row_factory = sqlite3.Row
cur = con.cursor()
cur.execute("select name_last, age from people")
for row in cur:
assert row[0] == row["name_last"]
assert row["name_last"] == row["nAmE_lAsT"]
assert row[1] == row["age"]
assert row[1... | ajibawa-2023/Python-Code-Large/train/row_805 | 6 | 12 | 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_805:ImportFrom_L1_C0", "label": "from pysqlite2 import sqlite3", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0833, 0.0833, 0, 0.66, 0.0, 987, 0, 1, 0, 0, 987, 0, 0], "semantic": {"name": "pysqlite2", "arg_names": [], "import_names": [... | [] |
from pysqlite2 import dbapi2 as sqlite3
class Point(object):
def __init__(self, x, y):
self.x, self.y = x, y
def adapt_point(point):
return "%f;%f" % (point.x, point.y)
sqlite3.register_adapter(Point, adapt_point)
con = sqlite3.connect(":memory:")
cur = con.cursor()
p = Point(4.0, -3.2)
cur.execute... | ajibawa-2023/Python-Code-Large/train/row_806 | 12 | 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_806:ImportFrom_L1_C0", "label": "from pysqlite2 import sqlite3", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0588, 0.0588, 0, 0.66, 0.0, 987, 0, 1, 0, 0, 987, 0, 0], "semantic": {"name": "pysqlite2", "arg_names": [], "import_names": [... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_806:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_806:FunctionDef_L4_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_806:FunctionDef_L4_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_806:Assign_L5_C8"}, {"f": "ajibawa-2023/Python-Code-Large/t... |
from pysqlite2 import dbapi2 as sqlite3
con = sqlite3.connect(":memory:")
cur = con.cursor()
# Create the table
con.execute("create table person(lastname, firstname)")
AUSTRIA = u"\xd6sterreich"
# by default, rows are returned as Unicode
cur.execute("select ?", (AUSTRIA,))
row = cur.fetchone()
assert row[0] == AUST... | ajibawa-2023/Python-Code-Large/train/row_807 | 18 | 42 | 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_807:ImportFrom_L1_C0", "label": "from pysqlite2 import sqlite3", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0238, 0.0238, 0, 0.66, 0.0, 987, 0, 1, 0, 0, 987, 0, 0], "semantic": {"name": "pysqlite2", "arg_names": [], "import_names": [... | [] |
from pysqlite2 import dbapi2 as sqlite3
class CountCursorsConnection(sqlite3.Connection):
def __init__(self, *args, **kwargs):
sqlite3.Connection.__init__(self, *args, **kwargs)
self.numcursors = 0
def cursor(self, *args, **kwargs):
self.numcursors += 1
return sqlite3.Connectio... | ajibawa-2023/Python-Code-Large/train/row_808 | 11 | 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_808:ImportFrom_L1_C0", "label": "from pysqlite2 import sqlite3", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0667, 0.0667, 0, 0.66, 0.0, 987, 0, 1, 0, 0, 987, 0, 0], "semantic": {"name": "pysqlite2", "arg_names": [], "import_names": [... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_808:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_808:FunctionDef_L4_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_808:FunctionDef_L4_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_808:Expr_L5_C8"}, {"f": "ajibawa-2023/Python-Code-Large/tra... |
from pysqlite2 import dbapi2 as sqlite3
def collate_reverse(string1, string2):
return -cmp(string1, string2)
con = sqlite3.connect(":memory:")
con.create_collation("reverse", collate_reverse)
cur = con.cursor()
cur.execute("create table test(x)")
cur.executemany("insert into test(x) values (?)", [("a",), ("b",)]... | ajibawa-2023/Python-Code-Large/train/row_809 | 12 | 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_809:ImportFrom_L1_C0", "label": "from pysqlite2 import sqlite3", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0667, 0.0667, 0, 0.66, 0.0, 987, 0, 1, 0, 0, 987, 0, 0], "semantic": {"name": "pysqlite2", "arg_names": [], "import_names": [... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_809:FunctionDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_809:Return_L4_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_809:For_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_809:Expr_L14_C4"}] |
from pysqlite2 import dbapi2 as sqlite3
con = sqlite3.connect(":memory:")
cur = con.cursor()
cur.executescript("""
create table person(
firstname,
lastname,
age
);
create table book(
title,
author,
published
);
insert into book(title, author, publis... | ajibawa-2023/Python-Code-Large/train/row_810 | 4 | 24 | 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_810:ImportFrom_L1_C0", "label": "from pysqlite2 import sqlite3", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0417, 0.0417, 0, 0.66, 0.0, 987, 0, 1, 0, 0, 987, 0, 0], "semantic": {"name": "pysqlite2", "arg_names": [], "import_names": [... | [] |
from pysqlite2 import dbapi2 as sqlite3
con = sqlite3.connect(":memory:")
# enable extension loading
con.enable_load_extension(True)
# Load the fulltext search extension
con.execute("select load_extension('./fts3.so')")
# alternatively you can load the extension using an API call:
# con.load_extension("./fts3.so")
... | ajibawa-2023/Python-Code-Large/train/row_811 | 9 | 28 | 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_811:ImportFrom_L1_C0", "label": "from pysqlite2 import sqlite3", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0357, 0.0357, 0, 0.66, 0.0, 987, 0, 1, 0, 0, 987, 0, 0], "semantic": {"name": "pysqlite2", "arg_names": [], "import_names": [... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_811:For_L25_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_811:Expr_L26_C4"}] |
from pysqlite2 import dbapi2 as sqlite3
persons = [
("Hugo", "Boss"),
("Calvin", "Klein")
]
con = sqlite3.connect(":memory:")
# Create the table
con.execute("create table person(firstname, lastname)")
# Fill the table
con.executemany("insert into person(firstname, lastname) values (?, ?)", persons)
# P... | ajibawa-2023/Python-Code-Large/train/row_812 | 8 | 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_812:ImportFrom_L1_C0", "label": "from pysqlite2 import sqlite3", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0476, 0.0476, 0, 0.66, 0.0, 987, 0, 1, 0, 0, 987, 0, 0], "semantic": {"name": "pysqlite2", "arg_names": [], "import_names": [... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_812:For_L17_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_812:Expr_L18_C4"}] |
from pysqlite2 import dbapi2 as sqlite3
con = sqlite3.connect("mydb")
cur = con.cursor()
who = "Yeltsin"
age = 72
cur.execute("select name_last, age from people where name_last=:who and age=:age",
locals())
print cur.fetchone()
| ajibawa-2023/Python-Code-Large/train/row_813 | 7 | 12 | 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_813:ImportFrom_L1_C0", "label": "from pysqlite2 import sqlite3", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0833, 0.0833, 0, 0.66, 0.0, 987, 0, 1, 0, 0, 987, 0, 0], "semantic": {"name": "pysqlite2", "arg_names": [], "import_names": [... | [] |
# Not referenced from the documentation, but builds the database file the other
# code snippets expect.
from pysqlite2 import dbapi2 as sqlite3
import os
DB_FILE = "mydb"
if os.path.exists(DB_FILE):
os.remove(DB_FILE)
con = sqlite3.connect(DB_FILE)
cur = con.cursor()
cur.execute("""
create table people
... | ajibawa-2023/Python-Code-Large/train/row_814 | 13 | 28 | 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_814:ImportFrom_L4_C0", "label": "from pysqlite2 import sqlite3", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.1429, 0.0357, 0, 0.66, 0.0, 987, 0, 1, 0, 0, 987, 0, 0], "semantic": {"name": "pysqlite2", "arg_names": [], "import_names": [... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_814:If_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_814:Expr_L10_C4"}] |
from pysqlite2 import dbapi2 as sqlite3
con = sqlite3.connect("mydb")
cur = con.cursor()
who = "Yeltsin"
age = 72
cur.execute("select name_last, age from people where name_last=:who and age=:age",
{"who": who, "age": age})
print cur.fetchone()
| ajibawa-2023/Python-Code-Large/train/row_815 | 7 | 12 | 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_815:ImportFrom_L1_C0", "label": "from pysqlite2 import sqlite3", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0833, 0.0833, 0, 0.66, 0.0, 987, 0, 1, 0, 0, 987, 0, 0], "semantic": {"name": "pysqlite2", "arg_names": [], "import_names": [... | [] |
from pysqlite2 import dbapi2 as sqlite3
import datetime
con = sqlite3.connect(":memory:", detect_types=sqlite3.PARSE_COLNAMES)
cur = con.cursor()
cur.execute('select ? as "x [timestamp]"', (datetime.datetime.now(),))
dt = cur.fetchone()[0]
print dt, type(dt)
| ajibawa-2023/Python-Code-Large/train/row_816 | 7 | 8 | 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_816:ImportFrom_L1_C0", "label": "from pysqlite2 import sqlite3", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.125, 0.125, 0, 0.66, 0.0, 987, 0, 1, 0, 0, 987, 0, 0], "semantic": {"name": "pysqlite2", "arg_names": [], "import_names": ["s... | [] |
from pysqlite2 import dbapi2 as sqlite3
def char_generator():
import string
for c in string.letters[:26]:
yield (c,)
con = sqlite3.connect(":memory:")
cur = con.cursor()
cur.execute("create table characters(c)")
cur.executemany("insert into characters(c) values (?)", char_generator())
cur.execute("s... | ajibawa-2023/Python-Code-Large/train/row_817 | 11 | 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_817:ImportFrom_L1_C0", "label": "from pysqlite2 import sqlite3", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0667, 0.0667, 0, 0.66, 0.0, 987, 0, 1, 0, 0, 987, 0, 0], "semantic": {"name": "pysqlite2", "arg_names": [], "import_names": [... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_817:FunctionDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_817:Import_L4_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_817:FunctionDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_817:For_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/... |
from pysqlite2 import dbapi2 as sqlite3
con = sqlite3.connect("mydb")
cur = con.cursor()
newPeople = (
('Lebed' , 53),
('Zhirinovsky' , 57),
)
for person in newPeople:
cur.execute("insert into people (name_last, age) values (?, ?)", person)
# The changes will not be saved unless the transaction... | ajibawa-2023/Python-Code-Large/train/row_818 | 7 | 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_818:ImportFrom_L1_C0", "label": "from pysqlite2 import sqlite3", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0625, 0.0625, 0, 0.66, 0.0, 987, 0, 1, 0, 0, 987, 0, 0], "semantic": {"name": "pysqlite2", "arg_names": [], "import_names": [... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_818:For_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_818:Expr_L13_C4"}] |
from pysqlite2 import dbapi2 as sqlite3
class Point(object):
def __init__(self, x, y):
self.x, self.y = x, y
def __conform__(self, protocol):
if protocol is sqlite3.PrepareProtocol:
return "%f;%f" % (self.x, self.y)
con = sqlite3.connect(":memory:")
cur = con.cursor()
p = Point(4... | ajibawa-2023/Python-Code-Large/train/row_819 | 12 | 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_819:ImportFrom_L1_C0", "label": "from pysqlite2 import sqlite3", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0625, 0.0625, 0, 0.66, 0.0, 987, 0, 1, 0, 0, 987, 0, 0], "semantic": {"name": "pysqlite2", "arg_names": [], "import_names": [... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_819:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_819:FunctionDef_L4_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_819:FunctionDef_L4_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_819:Assign_L5_C8"}, {"f": "ajibawa-2023/Python-Code-Large/t... |
from pysqlite2 import dbapi2 as sqlite3
class Point(object):
def __init__(self, x, y):
self.x, self.y = x, y
def __repr__(self):
return "(%f;%f)" % (self.x, self.y)
def adapt_point(point):
return "%f;%f" % (point.x, point.y)
def convert_point(s):
x, y = map(float, s.split(";"))
r... | ajibawa-2023/Python-Code-Large/train/row_820 | 30 | 47 | 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_820:ImportFrom_L1_C0", "label": "from pysqlite2 import sqlite3", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0213, 0.0213, 0, 0.66, 0.0, 987, 0, 1, 0, 0, 987, 0, 0], "semantic": {"name": "pysqlite2", "arg_names": [], "import_names": [... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_820:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_820:FunctionDef_L4_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_820:FunctionDef_L4_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_820:Assign_L5_C8"}, {"f": "ajibawa-2023/Python-Code-Large/t... |
from pysqlite2 import dbapi2 as sqlite3
class IterChars:
def __init__(self):
self.count = ord('a')
def __iter__(self):
return self
def next(self):
if self.count > ord('z'):
raise StopIteration
self.count += 1
return (chr(self.count - 1),) # this is a 1-... | ajibawa-2023/Python-Code-Large/train/row_821 | 16 | 24 | 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_821:ImportFrom_L1_C0", "label": "from pysqlite2 import sqlite3", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0417, 0.0417, 0, 0.66, 0.0, 987, 0, 1, 0, 0, 987, 0, 0], "semantic": {"name": "pysqlite2", "arg_names": [], "import_names": [... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_821:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_821:FunctionDef_L4_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_821:FunctionDef_L4_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_821:Assign_L5_C8"}, {"f": "ajibawa-2023/Python-Code-Large/t... |
from pysqlite2 import dbapi2 as sqlite3
import apsw
apsw_con = apsw.Connection(":memory:")
apsw_con.createscalarfunction("times_two", lambda x: 2*x, 1)
# Create pysqlite connection from APSW connection
con = sqlite3.connect(apsw_con)
result = con.execute("select times_two(15)").fetchone()[0]
assert result == 30
con.c... | ajibawa-2023/Python-Code-Large/train/row_822 | 7 | 12 | 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_822:ImportFrom_L1_C0", "label": "from pysqlite2 import sqlite3", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0833, 0.0833, 0, 0.66, 0.0, 987, 0, 1, 0, 0, 987, 0, 0], "semantic": {"name": "pysqlite2", "arg_names": [], "import_names": [... | [] |
from pysqlite2 import dbapi2 as sqlite3
import datetime, time
def adapt_datetime(ts):
return time.mktime(ts.timetuple())
sqlite3.register_adapter(datetime.datetime, adapt_datetime)
con = sqlite3.connect(":memory:")
cur = con.cursor()
now = datetime.datetime.now()
cur.execute("select ?", (now,))
print cur.fetcho... | ajibawa-2023/Python-Code-Large/train/row_823 | 10 | 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_823:ImportFrom_L1_C0", "label": "from pysqlite2 import sqlite3", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0714, 0.0714, 0, 0.66, 0.0, 987, 0, 1, 0, 0, 987, 0, 0], "semantic": {"name": "pysqlite2", "arg_names": [], "import_names": [... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_823:FunctionDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_823:Return_L5_C4"}] |
# Author: Paul Kippes <kippesp@gmail.com>
import unittest
from pysqlite2 import dbapi2 as sqlite
class DumpTests(unittest.TestCase):
def setUp(self):
self.cx = sqlite.connect(":memory:")
self.cu = self.cx.cursor()
def tearDown(self):
self.cx.close()
def CheckTableDump(self):
... | ajibawa-2023/Python-Code-Large/train/row_824 | 22 | 52 | 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_824:Import_L3_C0", "label": "unittest import unittest", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0577, 0.0192, 0, 0.66, 0.0, 88, 0, 1, 0, 0, 88, 0, 0], "semantic": {"name": "unittest", "arg_names": [], "import_names": ["unittest"],... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_824:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_824:FunctionDef_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_824:FunctionDef_L7_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_824:Assign_L8_C8"}, {"f": "ajibawa-2023/Python-Code-Large/t... |
# Mimic the sqlite3 console shell's .dump command
# Author: Paul Kippes <kippesp@gmail.com>
def _iterdump(connection):
"""
Returns an iterator to the dump of the database in an SQL text format.
Used to produce an SQL dump of the database. Useful to save an in-memory
database for later restoration. T... | ajibawa-2023/Python-Code-Large/train/row_825 | 24 | 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_825:FunctionDef_L4_C0", "label": "_iterdump", "type": "function", "loc": [4, 63], "level": 0, "parent": null, "vector": [2, 0, 0.5317, 0.9524, 0, 0.66, 0.0, 339, 0, 1, 0, 0, 0, 0, 11], "semantic": {"name": "_iterdump", "arg_names": ["connection"], "import_names": [], "r... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_825:FunctionDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_825:Expr_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_825:FunctionDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_825:Assign_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/trai... |
#!/usr/bin/python2.6
#
# Simple http server to emulate api.playfoursquare.com
import logging
import shutil
import sys
import urlparse
import SimpleHTTPServer
import BaseHTTPServer
class RequestHandler(BaseHTTPServer.BaseHTTPRequestHandler):
"""Handle playfoursquare.com requests, for testing."""
def do_GET(self... | ajibawa-2023/Python-Code-Large/train/row_826 | 63 | 85 | 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_826:Import_L5_C0", "label": "logging import logging", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.0588, 0.0118, 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_826:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_826:Expr_L15_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_826:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_826:FunctionDef_L17_C2"}, {"f": "ajibawa-2023/Python-Code-Large/tr... |
#!/usr/bin/python
import datetime
import sys
import textwrap
import common
from xml.dom import pulldom
PARSER = """\
/**
* Copyright 2009 Joe LaPenna
*/
package com.joelapenna.foursquare.parsers;
import com.joelapenna.foursquare.Foursquare;
import com.joelapenna.foursquare.error.FoursquareError;
import com.joel... | ajibawa-2023/Python-Code-Large/train/row_827 | 42 | 149 | 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_827:Import_L3_C0", "label": "datetime import datetime", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0201, 0.0067, 0, 0.66, 0.0, 426, 0, 1, 0, 0, 426, 0, 0], "semantic": {"name": "datetime", "arg_names": [], "import_names": ["datetime"... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_827:FunctionDef_L82_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_827:Assign_L83_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_827:FunctionDef_L82_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_827:Expr_L85_C2"}, {"f": "ajibawa-2023/Python-Code-Large/t... |
#!/usr/bin/python
"""
Pull a oAuth protected page from foursquare.
Expects ~/.oget to contain (one on each line):
CONSUMER_KEY
CONSUMER_KEY_SECRET
USERNAME
PASSWORD
Don't forget to chmod 600 the file!
"""
import httplib
import os
import re
import sys
import urllib
import urllib2
import urlparse
import user
from xml.... | ajibawa-2023/Python-Code-Large/train/row_828 | 50 | 111 | 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_828:Expr_L2_C0", "label": "expression", "type": "expression", "loc": [2, 12], "level": 0, "parent": null, "vector": [8, 0, 0.0631, 0.0991, 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_828:FunctionDef_L48_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_828:Return_L49_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_828:FunctionDef_L56_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_828:Assign_L57_C2"}, {"f": "ajibawa-2023/Python-Code-Large... |
#!/usr/bin/python
import os
import subprocess
import sys
BASEDIR = '../main/src/com/joelapenna/foursquare'
TYPESDIR = '../captures/types/v1'
captures = sys.argv[1:]
if not captures:
captures = os.listdir(TYPESDIR)
for f in captures:
basename = f.split('.')[0]
javaname = ''.join([c.capitalize() for c in basena... | ajibawa-2023/Python-Code-Large/train/row_829 | 20 | 27 | 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_829:Import_L3_C0", "label": "os import os", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.1111, 0.037, 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_829:If_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_829:Assign_L12_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_829:For_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_829:Assign_L15_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_829:Fo... |
#!/usr/bin/python
import logging
from xml.dom import minidom
from xml.dom import pulldom
BOOLEAN = "boolean"
STRING = "String"
GROUP = "Group"
# Interfaces that all FoursquareTypes implement.
DEFAULT_INTERFACES = ['FoursquareType']
# Interfaces that specific FoursqureTypes implement.
INTERFACES = {
}
DEFAULT_CLA... | ajibawa-2023/Python-Code-Large/train/row_830 | 44 | 114 | 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_830:Import_L3_C0", "label": "logging import logging", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0263, 0.0088, 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_830:FunctionDef_L59_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_830:Expr_L60_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_830:FunctionDef_L59_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_830:Assign_L71_C2"}, {"f": "ajibawa-2023/Python-Code-Large/t... |
# Run from the commandline:
#
# python server.py
# POST audio to http://localhost:9000
# GET audio from http://localhost:9000
#
# A simple server to collect audio using python. To be more secure,
# you might want to check the file names and place size restrictions
# on the incoming data.
import cgi
from BaseHTTPSe... | ajibawa-2023/Python-Code-Large/train/row_831 | 34 | 53 | 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_831:Import_L11_C0", "label": "cgi import cgi", "type": "import", "loc": [11, 11], "level": 0, "parent": null, "vector": [1, 0, 0.2075, 0.0189, 0, 0.66, 0.0, 934, 0, 1, 0, 0, 934, 0, 0], "semantic": {"name": "cgi", "arg_names": [], "import_names": ["cgi"], "rhs_call_name... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_831:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_831:Assign_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_831:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_831:FunctionDef_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/... |
'''
Created on 21-03-2011
@author: maciek
'''
def formatString(format, **kwargs):
'''
'''
if not format: return ''
for arg in kwargs.keys():
format = format.replace("{" + arg + "}", "##" + arg + "##")
format = format.replace ("{", "{{")
format = format.replace("}", "}}")
for... | ajibawa-2023/Python-Code-Large/train/row_832 | 15 | 23 | 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_832:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 5], "level": 0, "parent": null, "vector": [8, 0, 0.1304, 0.2174, 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_832:FunctionDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_832:Expr_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_832:FunctionDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_832:If_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/ro... |
'''
Created on 21-03-2011
@author: maciek
'''
from IndexGenerator import IndexGenerator
from optparse import OptionParser
import os
import tempfile
import shutil
import logging
logging.basicConfig(level = logging.DEBUG)
parser = OptionParser()
parser.add_option('-n', '--app-name', action='store', dest='appName', hel... | ajibawa-2023/Python-Code-Large/train/row_833 | 69 | 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_833:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 5], "level": 0, "parent": null, "vector": [8, 0, 0.0341, 0.0568, 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_833:If_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_833:Expr_L27_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_833:If_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_833:If_L28_C0"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_833:If_L28_C0... |
'''
Created on 21-03-2011
@author: maciek
'''
from formater import formatString
import os
class IndexGenerator(object):
'''
Generates Index.html for iOS app OTA distribution
'''
basePath = os.path.dirname(__file__)
templateFile = os.path.join(basePath,"templates/index.tmpl")
releaseUrls = ""
... | ajibawa-2023/Python-Code-Large/train/row_834 | 31 | 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_834:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 5], "level": 0, "parent": null, "vector": [8, 0, 0.0526, 0.0877, 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_834:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_834:Expr_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_834:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_834:Assign_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/r... |
# Django settings for iphone12580 project.
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ('Your Name', 'your_email@domain.com'),
)
MANAGERS = ADMINS
DATABASE_ENGINE = '' # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
DATABASE_NAME = '' # Or path to database file ... | ajibawa-2023/Python-Code-Large/train/row_835 | 23 | 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_835:Assign_L3_C0", "label": "DEBUG =", "type": "assigned_variable", "loc": [3, 3], "level": 0, "parent": null, "vector": [14, 0, 0.0375, 0.0125, 0, 0.66, 0.0, 309, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "DEBUG", "arg_names": [], "import_names": [], "rhs_call_name": ... | [] |
from django.db import models
# Create your models here.
| ajibawa-2023/Python-Code-Large/train/row_836 | 1 | 3 | 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_836:ImportFrom_L1_C0", "label": "from django.db import models", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.3333, 0.3333, 0, 0.66, 0.0, 40, 0, 1, 0, 0, 40, 0, 0], "semantic": {"name": "django.db", "arg_names": [], "import_names": ["mo... | [] |
"""
This file demonstrates two different styles of tests (one doctest and one
unittest). These will both pass when you run "manage.py test".
Replace these with more appropriate tests for your application.
"""
from django.test import TestCase
class SimpleTest(TestCase):
def test_basic_addition(self):
"""
... | ajibawa-2023/Python-Code-Large/train/row_837 | 7 | 23 | 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_837:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 6], "level": 0, "parent": null, "vector": [8, 0, 0.1522, 0.2609, 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_837:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_837:FunctionDef_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_837:FunctionDef_L11_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_837:Expr_L12_C8"}, {"f": "ajibawa-2023/Python-Code-Large... |
# -*- coding: utf-8 -*-
from django.http import HttpResponseRedirect, HttpResponse, Http404
from django.shortcuts import render_to_response
from django.core.paginator import Paginator,InvalidPage,EmptyPage
def test(request):
return HttpResponse("hello iphone")
def index(request):
return render_to_response("in... | ajibawa-2023/Python-Code-Large/train/row_838 | 13 | 19 | 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_838:ImportFrom_L2_C0", "label": "from django.http import HttpResponseRedirect, HttpResponse, Http404", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.1053, 0.0526, 0, 0.66, 0.0, 779, 0, 3, 0, 0, 779, 0, 0], "semantic": {"name": "django.h... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_838:FunctionDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_838:Return_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_838:FunctionDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_838:Return_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/tr... |
#!/usr/bin/env python
from django.core.management import execute_manager
try:
import settings # Assumed to be in the same directory.
except ImportError:
import sys
sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll have to ... | ajibawa-2023/Python-Code-Large/train/row_839 | 8 | 11 | 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_839:ImportFrom_L2_C0", "label": "from django.core.management import execute_manager", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.1818, 0.0909, 0, 0.66, 0.0, 879, 0, 1, 0, 0, 879, 0, 0], "semantic": {"name": "django.core.management", ... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_839:Try_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_839:Import_L4_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_839:Try_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_839:Import_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_839:Try_L... |
from django.conf.urls.defaults import *
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
# Example:
# (r'^iphone12580/', include('iphone12580.foo.urls')),
# Uncomment the admin/doc line below and add 'django.contrib.admin... | ajibawa-2023/Python-Code-Large/train/row_840 | 4 | 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_840:ImportFrom_L1_C0", "label": "from django.conf.urls.defaults import *", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0455, 0.0455, 0, 0.66, 0.0, 341, 0, 1, 0, 0, 341, 0, 0], "semantic": {"name": "django.conf.urls.defaults", "arg_nam... | [] |
#!/usr/bin/env python
from django.core.management import execute_manager
try:
import settings # Assumed to be in the same directory.
except ImportError:
import sys
sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll have to ... | ajibawa-2023/Python-Code-Large/train/row_841 | 8 | 11 | 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_841:ImportFrom_L2_C0", "label": "from django.core.management import execute_manager", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.1818, 0.0909, 0, 0.66, 0.0, 879, 0, 1, 0, 0, 879, 0, 0], "semantic": {"name": "django.core.management", ... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_841:Try_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_841:Import_L4_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_841:Try_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_841:Import_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_841:Try_L... |
import sys
import os
from PIL import Image
def detectEdge(img, w, h):
left, upper, right, lower = w,h,0,0
pixels = img.load()
threshold = 10
for x in range(0,w):
for y in xrange(0,h):
pix = pixels[x,y]
if (pix[0]<(254-threshold) or pix[1]<(254-threshold) or pix[2... | ajibawa-2023/Python-Code-Large/train/row_842 | 24 | 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_842:Import_L2_C0", "label": "sys import sys", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0645, 0.0323, 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_842:FunctionDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_842:Assign_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_842:FunctionDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_842:Assign_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/tr... |
# Run from the commandline:
#
# python server.py
# POST audio to http://localhost:9000
# GET audio from http://localhost:9000
#
# A simple server to collect audio using python. To be more secure,
# you might want to check the file names and place size restrictions
# on the incoming data.
import cgi
from BaseHTTPSe... | ajibawa-2023/Python-Code-Large/train/row_843 | 34 | 53 | 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_843:Import_L11_C0", "label": "cgi import cgi", "type": "import", "loc": [11, 11], "level": 0, "parent": null, "vector": [1, 0, 0.2075, 0.0189, 0, 0.66, 0.0, 934, 0, 1, 0, 0, 934, 0, 0], "semantic": {"name": "cgi", "arg_names": [], "import_names": ["cgi"], "rhs_call_name... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_843:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_843:Assign_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_843:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_843:FunctionDef_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/... |
#!/usr/bin/env python
import time
import os
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BCM)
DEBUG = 0
# read SPI data from MCP3008 chip, 8 possible adc's (0 thru 7)
def readadc(adcnum, clockpin, mosipin, misopin, cspin):
if ((adcnum > 7) or (adcnum < 0)):
return -1
GPIO.output(cspin, Tr... | ajibawa-2023/Python-Code-Large/train/row_844 | 66 | 110 | 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_844:Import_L2_C0", "label": "time import time", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0182, 0.0091, 0, 0.66, 0.0, 654, 0, 1, 0, 0, 654, 0, 0], "semantic": {"name": "time", "arg_names": [], "import_names": ["time"], "rhs_call_nam... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_844:FunctionDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_844:If_L11_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_844:If_L11_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_844:Return_L12_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8... |
#coding=utf8
from django.db import models
class Address(models.Model):
name = models.CharField(max_length=20)
address = models.CharField(max_length=100)
pub_date = models.DateField()
| ajibawa-2023/Python-Code-Large/train/row_845 | 5 | 7 | 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_845:ImportFrom_L2_C0", "label": "from django.db import models", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.2857, 0.1429, 0, 0.66, 0.0, 40, 0, 1, 0, 0, 40, 0, 0], "semantic": {"name": "django.db", "arg_names": [], "import_names": ["mo... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_845:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_845:Assign_L5_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_845:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_845:Assign_L6_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row... |
"""
This file demonstrates writing tests using the unittest module. These will pass
when you run "manage.py test".
Replace this with more appropriate tests for your application.
"""
from django.test import TestCase
class SimpleTest(TestCase):
def test_basic_addition(self):
"""
Tests... | ajibawa-2023/Python-Code-Large/train/row_846 | 6 | 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_846:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 6], "level": 0, "parent": null, "vector": [8, 0, 0.2188, 0.375, 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_846:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_846:FunctionDef_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_846:FunctionDef_L12_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_846:Expr_L13_C8"}, {"f": "ajibawa-2023/Python-Code-Large... |
from django.conf.urls.defaults import patterns, url
__author__ = 'Administrator'
urlpatterns = patterns('address.views',
url(r'^test/$','test')
) | ajibawa-2023/Python-Code-Large/train/row_847 | 3 | 6 | 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_847:ImportFrom_L1_C0", "label": "from django.conf.urls.defaults import patterns, url", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.1667, 0.1667, 0, 0.66, 0.0, 341, 0, 2, 0, 0, 341, 0, 0], "semantic": {"name": "django.conf.urls.default... | [] |
from django.contrib import admin
from address.models import Address
__author__ = 'Administrator'
admin.site.register(Address) | ajibawa-2023/Python-Code-Large/train/row_848 | 4 | 5 | 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_848:ImportFrom_L1_C0", "label": "from django.contrib import admin", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.2, 0.2, 0, 0.66, 0.0, 302, 0, 1, 0, 0, 302, 0, 0], "semantic": {"name": "django.contrib", "arg_names": [], "import_names":... | [] |
# Create your views here.
import urllib2
from django.http import HttpResponse
from django.shortcuts import render_to_response
from models import Address
def latest_address(request):
addresslist = Address.objects.order_by('-pub_date')[:10]
return render_to_response('latest_address.html', {'addresslist':... | ajibawa-2023/Python-Code-Large/train/row_849 | 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_849:Import_L2_C0", "label": "urllib2 import urllib2", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.1429, 0.0714, 0, 0.66, 0.0, 345, 0, 1, 0, 0, 345, 0, 0], "semantic": {"name": "urllib2", "arg_names": [], "import_names": ["urllib2"], "... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_849:FunctionDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_849:Assign_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_849:FunctionDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_849:Return_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/tra... |
from BeautifulSoup import BeautifulSoup
__author__ = 'Administrator'
import urllib,urllib2,cookielib
from BeautifulSoup import BeautifulSoup
myCookie = urllib2.HTTPCookieProcessor(cookielib.CookieJar())
openner = urllib2.build_opener(myCookie)
post_data = {'email':'yinjj472@nenu.edu.cn',
'pass... | ajibawa-2023/Python-Code-Large/train/row_850 | 12 | 32 | 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_850:ImportFrom_L1_C0", "label": "from BeautifulSoup import BeautifulSoup", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0312, 0.0312, 0, 0.66, 0.0, 878, 0, 1, 0, 0, 878, 0, 0], "semantic": {"name": "BeautifulSoup", "arg_names": [], "im... | [] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.