code stringlengths 1 1.72M | language stringclasses 1
value |
|---|---|
if False: # set to True to insert test data
store(store.product.id > 0).delete()
store(store.category.id > 0).delete()
if len(store(store.product.id > 0).select()) == 0:
fantasy_id = store.category.insert(name='Fantasy', description='Fantasy books', small_image='testdata/hp1.jpg')
hp1 = ... | Python |
UNDEFINED = -1
if request.env.web2py_runtime_gae: # if running on Google App Engine
store = DAL('gae') # connect to Google BigTable
session.connect(request, response, db=store) # and store sessions and tickets there
else:
store = DAL("sqlite://store.db")
store.define... | Python |
#
import re
# delimiter to use between words in URL
URL_DELIMITER = '-'
def pretty_url(id, name):
"""Create pretty URL from record name and ID
"""
return '%s%s%d' % (' '.join(re.sub('[^\w ]+', '', name).split()).replace(' ', URL_DELIMITER), URL_DELIMITER, id)
def pretty_id(url):
"""Extract id fr... | Python |
###########################################################
### make sure administrator is on localhost
############################################################
import os, socket, datetime,copy
import gluon.contenttype
import gluon.fileutils
### crytical --- make a copy of the environment
global_env=copy.copy(glo... | Python |
if not session.cart:
# instantiate new cart
session.cart, session.balance = [], 0
session.google_merchant_id = mystore.google_merchant_id
response.menu = [
['Store Front', request.function == 'index', URL(r=request, f='index')],
['About Us', request.function == 'aboutus', URL(r=request, f='aboutus')]... | Python |
###########################################################
### make sure administrator is on localhost
############################################################
import os
from gluon.contenttype import contenttype
from gluon.fileutils import check_credentials, listdir
if not session.authorized and not request.func... | Python |
#!/usr/bin/python2.4
#
# Copyright 2007 The Python-Twitter Developers
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by... | Python |
#!/usr/bin/python2.4
#
# Copyright 2007 The Python-Twitter Developers
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by... | Python |
"""Implementation of JSONEncoder
"""
import re
try:
from simplejson._speedups import encode_basestring_ascii as c_encode_basestring_ascii
except ImportError:
c_encode_basestring_ascii = None
try:
from simplejson._speedups import make_encoder as c_make_encoder
except ImportError:
c_make_encoder = None
... | Python |
"""Implementation of JSONDecoder
"""
import re
import sys
import struct
from simplejson.scanner import make_scanner
try:
from simplejson._speedups import scanstring as c_scanstring
except ImportError:
c_scanstring = None
__all__ = ['JSONDecoder']
FLAGS = re.VERBOSE | re.MULTILINE | re.DOTALL
def _floatconst... | Python |
r"""JSON (JavaScript Object Notation) <http://json.org> is a subset of
JavaScript syntax (ECMA-262 3rd edition) used as a lightweight data
interchange format.
:mod:`simplejson` exposes an API familiar to users of the standard library
:mod:`marshal` and :mod:`pickle` modules. It is the externally maintained
version of ... | Python |
r"""Using simplejson from the shell to validate and
pretty-print::
$ echo '{"json":"obj"}' | python -msimplejson.tool
{
"json": "obj"
}
$ echo '{ 1.2:3.4}' | python -msimplejson.tool
Expecting property name: line 1 column 2 (char 2)
"""
import simplejson
def main():
import sys
if l... | Python |
"""JSON token scanner
"""
import re
try:
from simplejson._speedups import make_scanner as c_make_scanner
except ImportError:
c_make_scanner = None
__all__ = ['make_scanner']
NUMBER_RE = re.compile(
r'(-?(?:0|[1-9]\d*))(\.\d+)?([eE][-+]?\d+)?',
(re.VERBOSE | re.MULTILINE | re.DOTALL))
def py_make_scan... | Python |
#!/usr/bin/python2.4
'''Load the latest update for a Twitter user and leave it in an XHTML fragment'''
__author__ = 'dewitt@google.com'
import codecs
import getopt
import sys
import twitter
TEMPLATE = """
<div class="twitter">
<span class="twitter-user"><a href="http://twitter.com/%s">Twitter</a>: </span>
<span... | Python |
#!/usr/bin/python2.4
'''Post a message to twitter'''
__author__ = 'dewitt@google.com'
import ConfigParser
import getopt
import os
import sys
import twitter
USAGE = '''Usage: tweet [options] message
This script posts a message to Twitter.
Options:
-h --help : print this help
--consumer-key : the twit... | Python |
#!/usr/bin/python2.4
#
# Copyright 2007 The Python-Twitter Developers
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by... | Python |
Python-Code-Large
Python-Code-Large is a large-scale corpus of Python source code comprising more than 2 million rows of Python code. The dataset is designed to support research in large language model (LLM) pretraining, code intelligence, software engineering automation, and program analysis for the Python ecosystem.
By providing a high-volume, language-specific corpus, Python-Code-Large enables systematic experimentation in Python-focused model training, domain adaptation, and downstream code understanding tasks.
Python-Code-Large addresses the need for a dedicated Python-only dataset at substantial scale, enabling focused research across data science, backend systems, automation, scientific computing, and AI-driven Python environments.
1. Dataset Composition
Programming Language: Python
Size: 2M+ rows of Python code
File Format: .jsonl
Each record is stored as structured JSON Lines format for efficient streaming, large-scale training, and distributed processing.
Content Types
The dataset includes a wide variety of Python constructs and paradigms, such as:
Function definitions and decorators
Class-based and object-oriented programming
Inheritance and multiple inheritance patterns
Async programming (async / await)
Generators and iterators
Context managers
Exception handling patterns
Type hints and annotations
Functional programming constructs (map, filter, lambda)
List, dictionary, and set comprehensions
Metaprogramming patterns
Data processing pipelines
Web framework logic
REST API implementations
Machine learning scripts
Data science notebooks (converted to .py where applicable)
CLI utilities
Testing frameworks (unit tests, integration tests)
Configuration and environment management code
Docstrings and inline documentation
Modern Python 3.x features
2. Intended Research Applications
2.1 Pretraining
Training Python code foundation models from scratch
Continued pretraining of existing LLMs
Python-specialized language modeling
Tokenizer training optimized for Python syntax
AST-aware pretraining experiments
2.2 Fine-Tuning and Adaptation
Code completion systems
Intelligent IDE assistants
Automated refactoring tools
Conversational programming agents
Python-specific copilots
Docstring generation systems
Type inference assistants
2.3 Code Intelligence Tasks
Code summarization
Code-to-text generation
Documentation generation
Bug detection
Vulnerability detection
Clone detection
Code similarity modeling
Readability enhancement
_ Static code analysis
- Structural and dependency modeling
2.4 Software Engineering Research
Empirical studies of Python coding patterns
Analysis of async architectures in Python
Framework usage studies
Dependency and import graph modeling
AST-based experiments
Cross-version Python evolution analysis
Type adoption analysis (PEP-based transitions)
Large-scale study of testing patterns
3. Research Opportunities Enabled
Python-Code-Large enables exploration of:
Python-specific tokenizer efficiency
Function-level representation learning
Retrieval-augmented generation for code
Secure code modeling
Long-context modeling of large Python files
Docstring-conditioned generation
Python-specific benchmark creation
Thanks to open source community for all the guidance & support!!
- Downloads last month
- 4,863