text stringlengths 0 1.05M | meta dict |
|---|---|
"""A full convolutional neural network for road segmentation.
nohup python -u -m self_driving.road_seg.convnet > self_driving/road_seg/output.txt 2>&1 &
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import copy
import tensorflow as tf
from utils impo... | {
"repo_name": "mengli/PcmAudioRecorder",
"path": "self_driving/road_seg/convnet.py",
"copies": "2",
"size": "5948",
"license": "apache-2.0",
"hash": -4977446518754172000,
"line_mean": 35.950310559,
"line_max": 92,
"alpha_frac": 0.6442501681,
"autogenerated": false,
"ratio": 3.1978494623655913,
... |
"""A fully featured python package for quaternion representation, manipulation, 3D rotation and animation.
See:
https://github.com/KieranWynn/pyquaternion
"""
# Always prefer setuptools over distutils
from setuptools import setup, find_packages
# To use a consistent encoding
from codecs import open
from os im... | {
"repo_name": "timdelbruegger/pyquaternion",
"path": "setup.py",
"copies": "1",
"size": "4037",
"license": "mit",
"hash": -5288398573613396000,
"line_mean": 36.1037735849,
"line_max": 127,
"alpha_frac": 0.6603913797,
"autogenerated": false,
"ratio": 4.313034188034188,
"config_test": false,
"h... |
"""A functional set of stubs to be used for unit testing.
Projects that use pycassa and need to run an automated unit test suite on a
system like Jenkins can use these stubs to emulate interactions with Cassandra
without spinning up a cluster locally.
"""
import operator
from uuid import UUID
from collections impor... | {
"repo_name": "pycassa/pycassa",
"path": "pycassa/contrib/stubs.py",
"copies": "1",
"size": "8186",
"license": "mit",
"hash": 8383586363816461000,
"line_mean": 30.9765625,
"line_max": 113,
"alpha_frac": 0.5944295138,
"autogenerated": false,
"ratio": 4.070611636001989,
"config_test": false,
"h... |
# A function for generating a parametric fuselage external surface (outer mould
# line) model. For a description of the parameterisation, see the article:
# A. Sobester, "'Self-designing' Parametric Geometries", AIAA SciTech 2015,
# Orlando, FL.
# ====================================================================... | {
"repo_name": "teknologika/foil-generator",
"path": "airconicsv021/fuselage_oml.py",
"copies": "1",
"size": "15541",
"license": "apache-2.0",
"hash": -8127807802933826000,
"line_mean": 36.6641791045,
"line_max": 188,
"alpha_frac": 0.6221607361,
"autogenerated": false,
"ratio": 2.862589795542457,
... |
# A function for generating a parametric high bypass turbofan engine nacelle model.
# Run this file directly to get an example (scroll to the end to see it).
# ==============================================================================
# AirCONICS
# Aircraft CONfiguration through Integrated Cross-disciplinary Sc... | {
"repo_name": "teknologika/foil-generator",
"path": "airconicsv021/engine.py",
"copies": "1",
"size": "7588",
"license": "apache-2.0",
"hash": 643333494008982100,
"line_mean": 40.4022346369,
"line_max": 124,
"alpha_frac": 0.6939905113,
"autogenerated": false,
"ratio": 3.1136643414033647,
"confi... |
""" A function that helps develop code for both Python 2 and 3.
Source: https://github.com/mitsuhiko/flask/blob/0.10.1/flask/_compat.py
"""
def with_metaclass(meta, *bases):
# This requires a bit of explanation: the basic idea is to make a
# dummy metaclass for one level of class instantiation that replaces
... | {
"repo_name": "seanlin0800/python_snippets",
"path": "compact_metaclass.py",
"copies": "1",
"size": "1473",
"license": "unlicense",
"hash": 3720676814937814000,
"line_mean": 27.8823529412,
"line_max": 72,
"alpha_frac": 0.5926680244,
"autogenerated": false,
"ratio": 3.8661417322834644,
"config_t... |
# A function that returns names of the jobs on the queue
def jobs_on_queue():
onq = []
import os
import subprocess
pwd = os.getcwd().split('/')
if len(pwd)>1 and pwd[1]=='home':
username = pwd[2]
elif len(pwd)>3 and pwd[1]=='stash':
username = pwd[3]
else:
username = ''
if os.path.exists('... | {
"repo_name": "gkumar7/AlGDock",
"path": "Pipeline/_jobs_on_queue.py",
"copies": "2",
"size": "1118",
"license": "mit",
"hash": -1114157465785252200,
"line_mean": 42,
"line_max": 127,
"alpha_frac": 0.6082289803,
"autogenerated": false,
"ratio": 3.063013698630137,
"config_test": false,
"has_no... |
"""A function that sorts a list of numbers using the radix method."""
def radix(lst):
"""Sort a list of numbers using the radix sort method."""
for num in lst:
if not isinstance(num, int):
raise TypeError('Must use integers')
digit_place = 1
number_of_places, working_num = 0, 0
... | {
"repo_name": "rwisecar/data-structures",
"path": "src/radixsort.py",
"copies": "1",
"size": "1574",
"license": "mit",
"hash": -2097331424745691100,
"line_mean": 28.6981132075,
"line_max": 214,
"alpha_frac": 0.5673443456,
"autogenerated": false,
"ratio": 3.5610859728506785,
"config_test": false... |
"""A function that sorts a list using the quicksort method."""
def quicksort(lst):
"""Sort a list using the quicksort method."""
if len(lst) < 2:
return lst
elif isinstance(lst, list):
first_half = []
second_half = []
pivot = lst[len(lst) // 2]
for item in lst:
... | {
"repo_name": "rwisecar/data-structures",
"path": "src/quicksort.py",
"copies": "1",
"size": "1509",
"license": "mit",
"hash": 312433318968042240,
"line_mean": 28.5882352941,
"line_max": 226,
"alpha_frac": 0.5705765408,
"autogenerated": false,
"ratio": 3.7725,
"config_test": false,
"has_no_ke... |
"""A function to begin dataset downloads in a separate thread."""
import sys
from time import time
from threading import Thread, Lock
import wx
from retriever.lib.tools import final_cleanup
class DownloadThread(Thread):
def __init__(self, engine, script):
Thread.__init__(self)
self.engine = engin... | {
"repo_name": "davharris/retriever",
"path": "lib/download.py",
"copies": "1",
"size": "2375",
"license": "mit",
"hash": 4922075260314003000,
"line_mean": 25.6853932584,
"line_max": 133,
"alpha_frac": 0.4804210526,
"autogenerated": false,
"ratio": 4.3498168498168495,
"config_test": false,
"ha... |
from itertools import islice, repeat
from array import array
def getPrimes(n):
r = n // 2
#plist = list(islice(repeat(True), r + 1))
plist = array("B", repeat(1, r + 1))
plist[0] = 0
lim = int((n**0.5) / 2 + 1)
for i in range(1, lim + 1):
p = 2 * i + 1
if plist[i]:
... | {
"repo_name": "subhrm/google-code-jam-solutions",
"path": "solutions/helpers/utils/prime.py",
"copies": "1",
"size": "1024",
"license": "mit",
"hash": 1538517593782649000,
"line_mean": 23.380952381,
"line_max": 92,
"alpha_frac": 0.5283203125,
"autogenerated": false,
"ratio": 2.752688172043011,
... |
import locale
locale.setlocale(locale.LC_NUMERIC, 'C')
import numpy as np
from numba import jit
@jit
def getPrimes(n):
plist = np.arange(n+1)
plist[0] = 0
plist[1] = 0
lim = int(n**0.5) + 1
for i in range(2, lim+1):
if plist[i] > 0:
p,sp = i , i*i
if sp <= n:
... | {
"repo_name": "subhrm/google-code-jam-solutions",
"path": "solutions/helpers/utils/prime0.py",
"copies": "1",
"size": "1048",
"license": "mit",
"hash": -8981370574648114000,
"line_mean": 23.9523809524,
"line_max": 98,
"alpha_frac": 0.5219465649,
"autogenerated": false,
"ratio": 2.9273743016759775... |
''' A function to get all hotels located in a given city '''
import sys
from googleplaces import GooglePlaces, types
# GOOGLE_API_KEY = 'Put key here'
PLACEHOLDER_PRIORITY = 100
def write_hotels(region, query_result, hotel_csv):
''' Writes the query results in the csv file '''
global PLACEHOLDER_PRIORITY
... | {
"repo_name": "fahadakhan96/hotel-recommend",
"path": "src/gethotels.py",
"copies": "1",
"size": "1199",
"license": "mit",
"hash": 1367317882835370800,
"line_mean": 33.2571428571,
"line_max": 106,
"alpha_frac": 0.6738949124,
"autogenerated": false,
"ratio": 3.0431472081218276,
"config_test": fa... |
""" A function to import symbols. """
def import_symbol(symbol_path):
""" Import the symbol defined by the specified symbol path.
Examples
--------
import_symbol('tarfile:TarFile') -> TarFile
import_symbol('tarfile:TarFile.open') -> TarFile.open
To allow compatibility with old-school traits... | {
"repo_name": "burnpanck/traits",
"path": "traits/util/import_symbol.py",
"copies": "1",
"size": "1063",
"license": "bsd-3-clause",
"hash": 848248853987877400,
"line_mean": 27.7297297297,
"line_max": 79,
"alpha_frac": 0.5682031985,
"autogenerated": false,
"ratio": 4.374485596707819,
"config_tes... |
"""A function to start the GUI application."""
import sys
import os
from golem import gui
from werkzeug import _reloader
ORIGINAL_GET_ARGS = None
def run_gui(host=None, port=5000, debug=False):
# Patch Werkzeug._reloader._get_args_for_reloading()
# The Flask development server reloader does not work when
... | {
"repo_name": "lucianopuccio/golem",
"path": "golem/gui/gui_start.py",
"copies": "1",
"size": "1255",
"license": "mit",
"hash": -2126464203613431800,
"line_mean": 30.375,
"line_max": 91,
"alpha_frac": 0.6629482072,
"autogenerated": false,
"ratio": 3.3466666666666667,
"config_test": false,
"ha... |
"""A function to track a grid and display its origin on the screen
"""
# The MIT License (MIT)
#
# Copyright (c) 2016 GTRC.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restrict... | {
"repo_name": "mjsobrep/robot2camera-calibration",
"path": "robot2cam_calibration/track_grid.py",
"copies": "1",
"size": "10414",
"license": "mit",
"hash": 4953815504034475000,
"line_mean": 38.2981132075,
"line_max": 79,
"alpha_frac": 0.5858459766,
"autogenerated": false,
"ratio": 4.2008874546187... |
"""A function to unpack integer ranges of the form x-y,z."""
import re
__copyright__ = "Copyright (c) 2013- F-Secure"
def unpack_integer_range(integerrange):
"""Input an integer range spec like "200,205-207" and return a list of
integers like [200, 205, 206, 207]
:param integerrange: The range specifica... | {
"repo_name": "F-Secure/mittn",
"path": "mittn/httpfuzzer/number_ranges.py",
"copies": "1",
"size": "2232",
"license": "apache-2.0",
"hash": 442262853037580300,
"line_mean": 44.5510204082,
"line_max": 80,
"alpha_frac": 0.5689964158,
"autogenerated": false,
"ratio": 4.41106719367589,
"config_tes... |
"""A function to unpack integer ranges of the form x-y,z"""
"""
Copyright (c) 2014 F-Secure
See LICENSE for details
"""
import re
def unpack_integer_range(integerrange):
"""Input an integer range spec like "200,205-207" and return a list of
integers like [200, 205, 206, 207]
:param integerrange: The ra... | {
"repo_name": "mittn/mittn",
"path": "mittn/httpfuzzer/number_ranges.py",
"copies": "2",
"size": "2302",
"license": "apache-2.0",
"hash": 7268090408188413000,
"line_mean": 42.4528301887,
"line_max": 80,
"alpha_frac": 0.5621198957,
"autogenerated": false,
"ratio": 4.504892367906066,
"config_test... |
## a function which gets a path as argument and returns the data
import numpy as np
import matplotlib.pyplot as plt
class datLoad:
def __init__(self,dirpath):
self.dirpath=dirpath
self.data={}
## lese jetzt Daten ein
with open (self.dirpath, 'r') as dirfile:
dir... | {
"repo_name": "Kylskap/PloPo",
"path": "handler/datLoad.py",
"copies": "1",
"size": "2815",
"license": "apache-2.0",
"hash": -3743816880884708400,
"line_mean": 34.6329113924,
"line_max": 105,
"alpha_frac": 0.5978685613,
"autogenerated": false,
"ratio": 3.856164383561644,
"config_test": false,
... |
## a function which gets a path as argument and returns the data
import numpy as np
import matplotlib.pyplot as plt
class reader:
def __init__(self,dirpath):
self.dirpath=dirpath
self.data={}
## lese jetzt Daten ein
with open (self.dirpath, 'r') as dirfile:
dirs... | {
"repo_name": "Kylskap/PloPo",
"path": "handler/reader/auto_Reader.py",
"copies": "1",
"size": "2814",
"license": "apache-2.0",
"hash": -8393292494957623000,
"line_mean": 34.6202531646,
"line_max": 105,
"alpha_frac": 0.5977256574,
"autogenerated": false,
"ratio": 3.860082304526749,
"config_test... |
# A funny story by HVNSweeting
#Must run with 2.7
import threading
import logging
import time
import sys
logging.basicConfig(level=logging.DEBUG,
format='%(threadName)-10s %(message)s'
)
print 'you are running %s' % str(sys.version_info)
def wait_for_her(e):
logging.debug("WaitBoy is waiting...")
... | {
"repo_name": "familug/FAMILUG",
"path": "Python/threading_com.py",
"copies": "1",
"size": "1800",
"license": "bsd-2-clause",
"hash": 8278879320172419000,
"line_mean": 27.125,
"line_max": 68,
"alpha_frac": 0.6377777778,
"autogenerated": false,
"ratio": 3.0150753768844223,
"config_test": false,
... |
"""A Future class"""
from hawkweed.functional.primitives import reduce
from hawkweed.classes.repr import Repr
class Future(Repr):
"""A Future class"""
def __init__(self, value):
"""
Takes a binary function (taking success and error, respectively)
and builds a Future from it.
Co... | {
"repo_name": "hellerve/hawkweed",
"path": "hawkweed/classes/future.py",
"copies": "1",
"size": "3790",
"license": "mit",
"hash": 1168330177188898300,
"line_mean": 27.9312977099,
"line_max": 81,
"alpha_frac": 0.5493403694,
"autogenerated": false,
"ratio": 4.684796044499382,
"config_test": false... |
"""A Future class similar to the one in PEP 3148."""
__all__ = ['CancelledError', 'TimeoutError', 'InvalidStateError',
'Future', 'wrap_future', 'isfuture']
import concurrent.futures
import logging
import sys
import traceback
from . import base_futures
from . import compat
from . import events
CancelledE... | {
"repo_name": "mindbender-studio/setup",
"path": "bin/windows/python36/Lib/asyncio/futures.py",
"copies": "4",
"size": "16028",
"license": "mit",
"hash": 1204929341273374500,
"line_mean": 35.1805869074,
"line_max": 81,
"alpha_frac": 0.628213127,
"autogenerated": false,
"ratio": 4.423958045818383,... |
"""A Future class similar to the one in PEP 3148."""
__all__ = ['CancelledError', 'TimeoutError',
'InvalidStateError',
'Future', 'wrap_future', 'isfuture',
]
import concurrent.futures._base
import logging
import reprlib
import sys
import traceback
from ActualVim.lib.asyncio_inc impor... | {
"repo_name": "lunixbochs/actualvim",
"path": "lib/asyncio/futures.py",
"copies": "1",
"size": "17563",
"license": "mit",
"hash": -8555216802579907000,
"line_mean": 35.6659707724,
"line_max": 79,
"alpha_frac": 0.6151568639,
"autogenerated": false,
"ratio": 4.417253521126761,
"config_test": fals... |
"""A Future class similar to the one in PEP 3148."""
__all__ = ['CancelledError', 'TimeoutError',
'InvalidStateError',
'Future', 'wrap_future',
]
import concurrent.futures._base
import logging
import reprlib
import sys
import traceback
from . import compat
from . import events
# Sta... | {
"repo_name": "gvanrossum/asyncio",
"path": "asyncio/futures.py",
"copies": "1",
"size": "16438",
"license": "apache-2.0",
"hash": 877274133838611000,
"line_mean": 35.2869757174,
"line_max": 78,
"alpha_frac": 0.6121182626,
"autogenerated": false,
"ratio": 4.440302539168017,
"config_test": false... |
"""A Future class similar to the one in PEP 3148."""
__all__ = ['CancelledError', 'TimeoutError',
'InvalidStateError',
'Future', 'wrap_future',
]
import concurrent.futures.cooperative
import concurrent.futures.multithreaded
import concurrent.futures.exceptions
import logging
from . import event... | {
"repo_name": "mikhtonyuk/rxpython",
"path": "asyncio/futures.py",
"copies": "1",
"size": "3013",
"license": "mit",
"hash": 2839998452173772000,
"line_mean": 30.7157894737,
"line_max": 80,
"alpha_frac": 0.6518420179,
"autogenerated": false,
"ratio": 4.049731182795699,
"config_test": false,
"h... |
"""A Future class similar to the one in PEP 3148."""
__all__ = ['CancelledError', 'TimeoutError',
'InvalidStateError',
'Future', 'wrap_future',
]
import logging
import six
import sys
import traceback
try:
import reprlib # Python 3
except ImportError:
import repr as reprlib ... | {
"repo_name": "haypo/trollius",
"path": "trollius/futures.py",
"copies": "1",
"size": "16289",
"license": "apache-2.0",
"hash": -2187980279730275300,
"line_mean": 35.1977777778,
"line_max": 85,
"alpha_frac": 0.5938363313,
"autogenerated": false,
"ratio": 4.431175190424375,
"config_test": false,... |
"""A Future class similar to the one in PEP 3148."""
__all__ = (
'Future', 'wrap_future', 'isfuture',
)
import concurrent.futures
import contextvars
import logging
import sys
from . import base_futures
from . import events
from . import exceptions
from . import format_helpers
isfuture = base_futures.isfuture
... | {
"repo_name": "batermj/algorithm-challenger",
"path": "code-analysis/programming_anguage/python/source_codes/Python3.8.0/Python-3.8.0/Lib/asyncio/futures.py",
"copies": "1",
"size": "13041",
"license": "apache-2.0",
"hash": 9213721555885797000,
"line_mean": 31.9318181818,
"line_max": 79,
"alpha_frac"... |
"""A Future class similar to the one in PEP 3148."""
from .events import *
from .helpers import *
# States for Future.
_PENDING = 'PENDING'
_CANCELLED = 'CANCELLED'
_FINISHED = 'FINISHED'
class Error(Exception):
pass
class CancelledError(Error):
pass
class TimeoutError(Error):
pass
class InvalidStateE... | {
"repo_name": "jonathanverner/brython",
"path": "www/src/Lib/site-packages/simpleaio/futures.py",
"copies": "5",
"size": "13617",
"license": "bsd-3-clause",
"hash": -5362133132676593000,
"line_mean": 34.0953608247,
"line_max": 78,
"alpha_frac": 0.6013806272,
"autogenerated": false,
"ratio": 4.428... |
# AGAGD Models Imports
import agagd_core.models as agagd_models
# DJango Imports
import django_tables2 as tables
from django.core.exceptions import ObjectDoesNotExist
from django.urls import reverse
from django.utils.safestring import mark_safe
# Base Bootstrap Column Attributes
default_bootstrap_column_attrs = {
... | {
"repo_name": "usgo/agagd",
"path": "agagd/agagd_core/tables/beta.py",
"copies": "1",
"size": "7345",
"license": "mit",
"hash": 6620626038129519000,
"line_mean": 29.6041666667,
"line_max": 87,
"alpha_frac": 0.6016337645,
"autogenerated": false,
"ratio": 3.7570332480818416,
"config_test": false,... |
#again rerun
from lxml import html,etree
import os
from matlablike import *
from unidecode import unidecode
import re
import sys
fp = open(sys.argv[1],'r')
needsspace_re = re.compile(r'(\w[):;"\-\.,!?}]*) +(["(]*\w)')
paragraphcommands_re = re.compile(r'^ *\\(sub)*paragraph{.*}')
commentline_re = re.compile(r'^ *%')
no... | {
"repo_name": "jmfranck/pyDiffTools",
"path": "pydifftools/onewordify_undo.py",
"copies": "1",
"size": "1676",
"license": "bsd-3-clause",
"hash": 654094680259464300,
"line_mean": 37.976744186,
"line_max": 97,
"alpha_frac": 0.6217183771,
"autogenerated": false,
"ratio": 2.816806722689076,
"confi... |
#again rerun
from lxml import html,etree
import os
from matlablike import *
from unidecode import unidecode
import re
import sys
fp = open(sys.argv[1],'r')
paragraphcommands_re = re.compile(r'^ *\\(sub)*paragraph{.*}')
commentline_re = re.compile(r'^ *%')
beginlatex_re = re.compile(r'^[^#]*\\begin{document}(.*)')
endla... | {
"repo_name": "jmfranck/pyDiffTools",
"path": "pydifftools/onewordify.py",
"copies": "1",
"size": "5230",
"license": "bsd-3-clause",
"hash": 380223453828810700,
"line_mean": 42.2231404959,
"line_max": 223,
"alpha_frac": 0.590248566,
"autogenerated": false,
"ratio": 3.113095238095238,
"config_te... |
#again rerun
from lxml import html,etree
import os
from pyspecdata.fornotebook import *
from pyspecdata import *
import re
fp = open(sys.argv[1],'r')
content = fp.read()
fp.close()
doc = html.fromstring(content)
commentlabel_re = re.compile(r'\[([A-Z]+)([0-9])\]')
comment_dict = {}
#for j in doc.xpath('descendant::*[@s... | {
"repo_name": "jmfranck/pyDiffTools",
"path": "pydifftools/html_comments.py",
"copies": "1",
"size": "1117",
"license": "bsd-3-clause",
"hash": -1091251118477178800,
"line_mean": 33.90625,
"line_max": 74,
"alpha_frac": 0.6768128917,
"autogenerated": false,
"ratio": 2.806532663316583,
"config_te... |
#again rerun
from lxml import html,etree
import os
from pyspecdata import *
from unidecode import unidecode
import re
import sys
from .comment_functions import generate_alphabetnumber,matchingbrackets,comment_definition
manual_math_conversion = False # this hacks some stuff that pandoc does much better
fp = open(sys.ar... | {
"repo_name": "jmfranck/pyDiffTools",
"path": "pydifftools/html_uncomments.py",
"copies": "1",
"size": "18153",
"license": "bsd-3-clause",
"hash": -6997942207925776000,
"line_mean": 49.8487394958,
"line_max": 287,
"alpha_frac": 0.597477001,
"autogenerated": false,
"ratio": 3.278490157124797,
"c... |
#again rerun
from lxml import html,etree
import os
import re
def run(arguments):
needsspace_re = re.compile(r'(\w[):;"-\.,!}]*) +([^%}~])')
allmarkers_re = re.compile(r'(.*?)%(\[ORIG|ORIG\]\[NEW|NEW\])%(.*\n*)')# in all these, the newline at the end is just so it doesn't gobble up the newline
def parse_line... | {
"repo_name": "jmfranck/pyDiffTools",
"path": "pydifftools/split_conflict.py",
"copies": "1",
"size": "6952",
"license": "bsd-3-clause",
"hash": 1550601529502375200,
"line_mean": 50.8805970149,
"line_max": 213,
"alpha_frac": 0.5309263521,
"autogenerated": false,
"ratio": 3.6705385427666313,
"co... |
# again, this is copied liberally from scipy nnls -- see scipy licensing
from .general_functions import redim_F_to_C, redim_C_to_F, strm, inside_sphinx
if not inside_sphinx():
from . import _nnls
from numpy import asarray_chkfinite, zeros, double, isscalar, isfortran
from numpy import array as np_array
import mult... | {
"repo_name": "jmfranck/pyspecdata",
"path": "pyspecdata/nnls.py",
"copies": "1",
"size": "4107",
"license": "bsd-3-clause",
"hash": 5601576959021495000,
"line_mean": 35.6696428571,
"line_max": 111,
"alpha_frac": 0.5648892135,
"autogenerated": false,
"ratio": 3.5042662116040955,
"config_test": ... |
"""A game state for a level loaded from a file."""
# Copyright © 2014 Mikko Ronkainen <firstname@mikkoronkainen.com>
# License: MIT, see the LICENSE file.
import sfml as sf
from pymazing import world, level_loader, color, light, camera, coordinate_grid, renderer, matrix
class GameStateLoadedLevel:
def... | {
"repo_name": "mikoro/pymazing",
"path": "pymazing/game_state_loaded_level.py",
"copies": "1",
"size": "4314",
"license": "mit",
"hash": -294939087564130800,
"line_mean": 39.8737864078,
"line_max": 175,
"alpha_frac": 0.6401576629,
"autogenerated": false,
"ratio": 3.512214983713355,
"config_test... |
"""A game state for a simple rotating cube."""
# Copyright © 2014 Mikko Ronkainen <firstname@mikkoronkainen.com>
# License: MIT, see the LICENSE file.
from pymazing import world, mesh, color, light, euler_angle, camera, renderer
class GameStateSimpleCube:
def __init__(self, config):
self.world =... | {
"repo_name": "mikoro/pymazing",
"path": "pymazing/game_state_simple_cube.py",
"copies": "1",
"size": "1832",
"license": "mit",
"hash": -6826012891778122000,
"line_mean": 36.9574468085,
"line_max": 91,
"alpha_frac": 0.6389950847,
"autogenerated": false,
"ratio": 3.3596330275229356,
"config_test... |
"""agata URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.11/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-base... | {
"repo_name": "superarius/sabrina",
"path": "agata/urls.py",
"copies": "1",
"size": "1584",
"license": "mit",
"hash": 6096424229965760000,
"line_mean": 47,
"line_max": 95,
"alpha_frac": 0.6736111111,
"autogenerated": false,
"ratio": 3.0171428571428573,
"config_test": false,
"has_no_keywords":... |
# Agbase - Algorithm Path
#
# Copyright (c) 2015. Elec Research.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/
import agbase_config as config
from models im... | {
"repo_name": "elec-otago/python-agbase",
"path": "agbase/algorithm.py",
"copies": "1",
"size": "2497",
"license": "mpl-2.0",
"hash": -6008745648964556000,
"line_mean": 25.0208333333,
"line_max": 118,
"alpha_frac": 0.649979976,
"autogenerated": false,
"ratio": 3.613603473227207,
"config_test": ... |
# Agbase - Animal Path
#
# Copyright (c) 2015. Elec Research.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/
import agbase_config as config
from models impor... | {
"repo_name": "elec-otago/python-agbase",
"path": "agbase/animal.py",
"copies": "1",
"size": "5325",
"license": "mpl-2.0",
"hash": 571933544712748900,
"line_mean": 25.625,
"line_max": 109,
"alpha_frac": 0.5391549296,
"autogenerated": false,
"ratio": 3.554739652870494,
"config_test": false,
"h... |
# Agbase API Library
#
# Copyright (c) 2015. Elec Research.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/
import agbase_config as config
from models import ... | {
"repo_name": "elec-otago/python-agbase",
"path": "agbase/farm.py",
"copies": "1",
"size": "2050",
"license": "mpl-2.0",
"hash": 6644793093335567000,
"line_mean": 20.3541666667,
"line_max": 70,
"alpha_frac": 0.6346341463,
"autogenerated": false,
"ratio": 3.1490015360983103,
"config_test": false... |
# Agbase - Auth and User Path
#
# Copyright (c) 2015. Elec Research.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/
import agbase_config as config
from model... | {
"repo_name": "elec-otago/python-agbase",
"path": "agbase/agbase.py",
"copies": "1",
"size": "5105",
"license": "mpl-2.0",
"hash": 3199347959478636500,
"line_mean": 25.5885416667,
"line_max": 124,
"alpha_frac": 0.6673849167,
"autogenerated": false,
"ratio": 3.5110041265474554,
"config_test": fa... |
# Agbase - Herd Path
#
# Copyright (c) 2015. Elec Research.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/
import agbase_config as config
from models import ... | {
"repo_name": "elec-otago/python-agbase",
"path": "agbase/herd.py",
"copies": "1",
"size": "1664",
"license": "mpl-2.0",
"hash": 1249555577942793700,
"line_mean": 21.1866666667,
"line_max": 87,
"alpha_frac": 0.6472355769,
"autogenerated": false,
"ratio": 3.1695238095238096,
"config_test": false... |
# Agbase - Measurement Category Path
#
# Copyright (c) 2015. Elec Research.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/
from models import *
from agbase i... | {
"repo_name": "elec-otago/python-agbase",
"path": "agbase/measurement_category.py",
"copies": "1",
"size": "2081",
"license": "mpl-2.0",
"hash": 868487349893014500,
"line_mean": 23.7738095238,
"line_max": 90,
"alpha_frac": 0.6881307064,
"autogenerated": false,
"ratio": 3.7094474153297683,
"conf... |
# Agbase - Measurement List
#
# Copyright (c) 2015. Elec Research.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/
__author__ = 'Tim Molteno, Mark Butler'
cl... | {
"repo_name": "elec-otago/python-agbase",
"path": "agbase/measurement_list.py",
"copies": "1",
"size": "1938",
"license": "mpl-2.0",
"hash": 2597913597769766400,
"line_mean": 28.8307692308,
"line_max": 77,
"alpha_frac": 0.5536635707,
"autogenerated": false,
"ratio": 3.8,
"config_test": false,
... |
# Agbase - Measurement Path
#
# Copyright (c) 2015. Elec Research.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/
import agbase_config as config
from models ... | {
"repo_name": "elec-otago/python-agbase",
"path": "agbase/measurement.py",
"copies": "1",
"size": "4039",
"license": "mpl-2.0",
"hash": -2818208930763733500,
"line_mean": 28.4817518248,
"line_max": 113,
"alpha_frac": 0.6905174548,
"autogenerated": false,
"ratio": 3.577502214348981,
"config_test... |
# Agbase - Unittest - Tests
#
# Copyright (c) 2015. Elec Research.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/
import unittest
from agbase.agbase import A... | {
"repo_name": "elec-otago/python-agbase",
"path": "tests/test_agbase.py",
"copies": "1",
"size": "9799",
"license": "mpl-2.0",
"hash": -5272045273377145000,
"line_mean": 30.6096774194,
"line_max": 179,
"alpha_frac": 0.6308807021,
"autogenerated": false,
"ratio": 3.7258555133079847,
"config_test... |
"""agdss URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.9/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path(r'^$', views.home, name='home')
Cl... | {
"repo_name": "darknight-007/agdss-1",
"path": "agdss/urls.py",
"copies": "1",
"size": "1552",
"license": "apache-2.0",
"hash": 6919134785743478000,
"line_mean": 32.4888888889,
"line_max": 79,
"alpha_frac": 0.7074742268,
"autogenerated": false,
"ratio": 3.433628318584071,
"config_test": false,
... |
age=9
name=["Minglong","minghu","jack",22,age,23,3,4,5,7,87,89,9,9,4]
print(name)
print(name[0:2]) #列表的切片,直接取多个元素,知道下标号码就行
print(name[2:5]) #取jack和age变量
print(name[-5:]) #取最后5个值
name[0]="xxxxx" #修改其中的一个元素
print(name)
name.insert(1,"mingmao") #插入一个元素
print(name)
name.append("haha") #往列表的最后追加一个值
print(name)
... | {
"repo_name": "xiaoyongaa/ALL",
"path": "python基础2周/24课课上实例.py",
"copies": "1",
"size": "2054",
"license": "apache-2.0",
"hash": -987320530964387100,
"line_mean": 13.6111111111,
"line_max": 107,
"alpha_frac": 0.6191381496,
"autogenerated": false,
"ratio": 1.5216972034715526,
"config_test": fals... |
# age counter
# by prasith 11/09/2014
import time
def main():
print ("\n\nThis programme will calculate your age.\n(Accuracy: +/- 1 Day)")
main2()
def main2():
print ("\nEnter your birth year, month and date seperated by commas. eg:1999,5,21: ")
Y1 , M1 , D1 = input(">")
if Y1 < 1914:
... | {
"repo_name": "PrasithL/python_scripts",
"path": "age_calculator.py",
"copies": "1",
"size": "1601",
"license": "apache-2.0",
"hash": -8381620427573316000,
"line_mean": 22.8955223881,
"line_max": 92,
"alpha_frac": 0.4859462836,
"autogenerated": false,
"ratio": 3.1453831041257367,
"config_test":... |
"""agency_description to agency_request_summary
Revision ID: cf62ec87d973
Revises: 971f341c0204
Create Date: 2017-05-31 16:29:17.341283
"""
# revision identifiers, used by Alembic.
revision = "cf62ec87d973"
down_revision = "58a5abdd94ac"
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import... | {
"repo_name": "CityOfNewYork/NYCOpenRecords",
"path": "migrations/versions/cf62ec87d973_agency_description_to_agency_request_.py",
"copies": "1",
"size": "1494",
"license": "apache-2.0",
"hash": -8977271538269467000,
"line_mean": 26.1636363636,
"line_max": 87,
"alpha_frac": 0.6258366801,
"autogener... |
agenda = []
gravou = True
def pedenome():
return input("Nome: ").replace("#", "$")
def pedetelefone():
return input("Telefone: ").replace("#", "$")
def pedearquivo():
return input("Nome do arquivo: ")
def mostra(nome, telefone):
print(f"Nome: {nome} Telefone: {telefone}")
def pesquisa(nome):
... | {
"repo_name": "laenderoliveira/exerclivropy",
"path": "cap09/exercicio-09-22.py",
"copies": "1",
"size": "3565",
"license": "mit",
"hash": 3301225766881733600,
"line_mean": 20.2874251497,
"line_max": 78,
"alpha_frac": 0.5232067511,
"autogenerated": false,
"ratio": 3,
"config_test": false,
"ha... |
agenda = []
gravou = True
def pedenome(op=""):
i = input("Nome: ").replace("#", "$")
if i == "":
i = op
return i
def pedetelefone(op=""):
i = input("Telefone: ").replace("#", "$")
if i == "":
i = op
return i
def pedeaniversario():
return input("Aniversário Ex 27/03/1998:... | {
"repo_name": "laenderoliveira/exerclivropy",
"path": "cap09/exercicio-09-25.py",
"copies": "3",
"size": "4865",
"license": "mit",
"hash": -5901792432274009000,
"line_mean": 20.9592760181,
"line_max": 83,
"alpha_frac": 0.5487327426,
"autogenerated": false,
"ratio": 2.980958230958231,
"config_te... |
agenda = []
def pedenome():
return input("Nome: ")
def pedetelefone():
return input("Telefone: ")
def pedearquivo():
return input("Nome do arquivo: ")
def mostra(nome, telefone):
print("Nome: {} Telefone: {}".format(nome, telefone))
def pesquisa(nome):
mnome = nome.lower()
for p, e in ... | {
"repo_name": "laenderoliveira/exerclivropy",
"path": "cap09/exercicio-09-17.py",
"copies": "1",
"size": "2380",
"license": "mit",
"hash": 4973983456072742000,
"line_mean": 18.9495798319,
"line_max": 83,
"alpha_frac": 0.5366470093,
"autogenerated": false,
"ratio": 2.9490683229813666,
"config_te... |
agenda = []
def pedenome():
return input("Nome: ").replace("#", "$")
def pedetelefone():
return input("Telefone: ").replace("#", "$")
def pedearquivo():
return input("Nome do arquivo: ")
def mostra(nome, telefone):
print(f"Nome: {nome} Telefone: {telefone}")
def pesquisa(nome):
mnome = nom... | {
"repo_name": "laenderoliveira/exerclivropy",
"path": "cap09/exercicio-09-21.py",
"copies": "1",
"size": "2962",
"license": "mit",
"hash": -5778730560117697000,
"line_mean": 19.2328767123,
"line_max": 78,
"alpha_frac": 0.5226811104,
"autogenerated": false,
"ratio": 2.9247524752475247,
"config_t... |
# A general cross-validation
import numpy as np
class CrossValidation:
def __init__(self, X, Y):
"""General cross-validation for both classification and regression.
1) check the shape of X and Y are compatible with the input model;
2) the model doesn't have memory on previous trainings, i.... | {
"repo_name": "huangyh09/hilearn",
"path": "hilearn/models/cross_validation.py",
"copies": "1",
"size": "3018",
"license": "apache-2.0",
"hash": 8727750021901192000,
"line_mean": 35.8170731707,
"line_max": 75,
"alpha_frac": 0.5049701789,
"autogenerated": false,
"ratio": 3.597139451728248,
"conf... |
"""A generally useful event scheduler class.
Each instance of this class manages its own queue.
No multi-threading is implied; you are supposed to hack that
yourself, or use a single instance per application.
Each instance is parametrized with two functions, one that is
supposed to return the current time, one that is ... | {
"repo_name": "corona10/grumpy",
"path": "grumpy-runtime-src/third_party/stdlib/sched.py",
"copies": "5",
"size": "5964",
"license": "apache-2.0",
"hash": 2948077052532133000,
"line_mean": 41,
"line_max": 78,
"alpha_frac": 0.651240778,
"autogenerated": false,
"ratio": 4.31236442516269,
"config_... |
"""A generally useful event scheduler class.
Each instance of this class manages its own queue.
No multi-threading is implied; you are supposed to hack that
yourself, or use a single instance per application.
Each instance is parametrized with two functions, one that is
supposed to return the current time, one that i... | {
"repo_name": "r-lyeh/scriptorium",
"path": "python/micropython/tests/bytecode/pylib-tests/sched.py",
"copies": "22",
"size": "6393",
"license": "unlicense",
"hash": -8084954636860253000,
"line_mean": 37.0535714286,
"line_max": 78,
"alpha_frac": 0.6389801345,
"autogenerated": false,
"ratio": 4.40... |
"""A generally useful event scheduler class.
Each instance of this class manages its own queue.
No multi-threading is implied; you are supposed to hack that
yourself, or use a single instance per application.
Each instance is parametrized with two functions, one that is
supposed to return the current time, one... | {
"repo_name": "ericlink/adms-server",
"path": "playframework-dist/1.1-src/python/Lib/sched.py",
"copies": "2",
"size": "4652",
"license": "mit",
"hash": -4927871475221731000,
"line_mean": 37.7606837607,
"line_max": 70,
"alpha_frac": 0.6493981083,
"autogenerated": false,
"ratio": 4.633466135458168... |
"""A general module with tools for use with the saltfp package"""
import math
import numpy as np
import scipy.ndimage as nd
from saltfit import interfit
from salterror import SaltError, SaltIOError
from FPRing import FPRing, ringfit
def fpfunc(z, r, t, coef=None):
"""A functional form fitting the Fabry Perot para... | {
"repo_name": "saltastro/pysalt",
"path": "saltfp/fptools.py",
"copies": "2",
"size": "8336",
"license": "bsd-3-clause",
"hash": 6850688405180854000,
"line_mean": 27.7448275862,
"line_max": 109,
"alpha_frac": 0.5832533589,
"autogenerated": false,
"ratio": 2.8248051507963403,
"config_test": fals... |
""" A general notion of data grouped by key.
This module generally mimics the pandas API.
"""
from .functions_std.base import placeholder_like, struct
from .functions_std.error import *
from .column import build_dataframe, AbstractColumn
from .types import StructField, StructType
__all__ = ['KeyedGroup', 'groupby']
... | {
"repo_name": "tjhunter/karps",
"path": "python/karps/groups.py",
"copies": "1",
"size": "5383",
"license": "apache-2.0",
"hash": -6758677642348388000,
"line_mean": 38.8740740741,
"line_max": 108,
"alpha_frac": 0.6695151403,
"autogenerated": false,
"ratio": 3.477390180878553,
"config_test": fal... |
"""A general-purpose javascript compiler."""
from __future__ import unicode_literals
import os.path, subprocess
from django.conf import settings
from django.utils import six
import optimizations
class JavascriptError(Exception):
"""Something went wrong with javascript compilation."""
def __init__(self, m... | {
"repo_name": "etianen/django-optimizations",
"path": "src/optimizations/javascriptcompiler.py",
"copies": "1",
"size": "1814",
"license": "bsd-3-clause",
"hash": 6789613758103089000,
"line_mean": 31.9818181818,
"line_max": 136,
"alpha_frac": 0.6422271224,
"autogenerated": false,
"ratio": 4.56926... |
# A general purpose MFC CCtrlView view that uses Scintilla.
from . import control
from . import IDLEenvironment # IDLE emulation.
from pywin.mfc import docview
from pywin.mfc import dialog
from . import scintillacon
import win32con
import win32ui
import afxres
import string
import array
import sys
import types
import ... | {
"repo_name": "huguesv/PTVS",
"path": "Python/Product/Miniconda/Miniconda3-x64/Lib/site-packages/pythonwin/pywin/scintilla/view.py",
"copies": "7",
"size": "25662",
"license": "apache-2.0",
"hash": -6712388173229187000,
"line_mean": 34.5429362881,
"line_max": 163,
"alpha_frac": 0.7186111761,
"autog... |
# A general purpose MFC CCtrlView view that uses Scintilla.
import control
import IDLEenvironment # IDLE emulation.
from pywin.mfc import docview
from pywin.mfc import dialog
import scintillacon
import win32con
import win32ui
import afxres
import string
import array
import sys
import types
import __main__ # for attrib... | {
"repo_name": "IronLanguages/ironpython2",
"path": "Src/StdLib/Lib/site-packages/pythonwin/pywin/scintilla/view.py",
"copies": "2",
"size": "24844",
"license": "apache-2.0",
"hash": -8092190392549420000,
"line_mean": 34.4407988588,
"line_max": 163,
"alpha_frac": 0.7183625825,
"autogenerated": false... |
# A general purpose MFC CCtrlView view that uses Scintilla.
import control
import IDLEenvironment # IDLE emulation.
from pywin.mfc import docview
from pywin.mfc import dialog
from scintillacon import *
import win32con
import win32ui
import afxres
import string
import array
import sys
import types
import ... | {
"repo_name": "Southpaw-TACTIC/Team",
"path": "src/python/Lib/site-packages/pythonwin/pywin/scintilla/view.py",
"copies": "1",
"size": "25363",
"license": "epl-1.0",
"hash": 8705341516641559000,
"line_mean": 34.1296296296,
"line_max": 163,
"alpha_frac": 0.6966052912,
"autogenerated": false,
"rati... |
"""A general purpose stripifier, based on NvTriStrip (http://developer.nvidia.com/)
Credit for porting NvTriStrip to Python goes to the RuneBlade Foundation
library:
http://techgame.net/projects/Runeblade/browser/trunk/RBRapier/RBRapier/Tools/Geometry/Analysis/TriangleStripifier.py?rev=760
The algorithm of this strip... | {
"repo_name": "griest024/PokyrimTools",
"path": "pyffi-develop/pyffi/utils/trianglestripifier.py",
"copies": "1",
"size": "20714",
"license": "mit",
"hash": -4843858487775067000,
"line_mean": 36.799270073,
"line_max": 163,
"alpha_frac": 0.524138264,
"autogenerated": false,
"ratio": 3.554221002059... |
# a generator for a PE with maximum number of section, for XP (limit to 96 sections, empty debug directory is necessary
SEC_NUMB = 96 # XP
SECTIONS_VSTART = 0x01400 # XP, 96 sections
f = open("max_secXP.asm", "wt")
f.write("""; PE file with a maximum of sections
%include '..\..\consts.asm'
FILEALIGN eq... | {
"repo_name": "angea/corkami",
"path": "wip/MakePE/examples/PE/max_secXP.py",
"copies": "1",
"size": "4035",
"license": "bsd-2-clause",
"hash": 5088760992289762000,
"line_mean": 30.8048780488,
"line_max": 119,
"alpha_frac": 0.6837670384,
"autogenerated": false,
"ratio": 3.246178600160901,
"conf... |
# a generator for a PE with maximum number of section
# 199 sections confirmed working
SEC_NUMB = 199
SECTIONS_VSTART = 0x02000
f = open("max_sec.asm", "wt")
f.write("""; PE file with a maximum of sections
%include '..\..\consts.asm'
FILEALIGN equ 200h
SECTIONALIGN equ 1000h
org IMAGEBASE
istruc I... | {
"repo_name": "angea/corkami",
"path": "wip/MakePE/examples/PE/max_sec.py",
"copies": "1",
"size": "3885",
"license": "bsd-2-clause",
"hash": -1712395775167908400,
"line_mean": 29.3306451613,
"line_max": 108,
"alpha_frac": 0.6810810811,
"autogenerated": false,
"ratio": 3.245614035087719,
"confi... |
'''A generator to create all possible indexes from a pattern.
'''
import re
from functools import partial
import types
from dmrg_helpers.core.dmrg_exceptions import DMRGException
class SiteFilter(object):
"""A class to filter out integers according to a pattern.
You construct this class using a string with so... | {
"repo_name": "iglpdc/dmrg_helpers",
"path": "dmrg_helpers/extract/generate_indexes.py",
"copies": "1",
"size": "5301",
"license": "mit",
"hash": -1930521831463769600,
"line_mean": 32.7643312102,
"line_max": 79,
"alpha_frac": 0.5817770232,
"autogenerated": false,
"ratio": 3.9354120267260577,
"c... |
# A generator version of words lookup
# Still early for use in a concurrent setup
from collections import defaultdict
import re
class Words:
def __init__(self, wordfile='words'):
self.wordfile = wordfile
self.word_dict = defaultdict(set)
self.load_words()
def load_words(self):
... | {
"repo_name": "souravdatta/words",
"path": "gwords.py",
"copies": "1",
"size": "1970",
"license": "mit",
"hash": -8068219511769591000,
"line_mean": 27.9705882353,
"line_max": 53,
"alpha_frac": 0.4406091371,
"autogenerated": false,
"ratio": 3.8030888030888033,
"config_test": false,
"has_no_key... |
"""A generic API for contactology"""
from __future__ import print_function
import six
from six.moves.urllib.parse import urlencode
from pprint import pformat
import json
from twisted.web.client import getPage
from twisted.internet import defer
from twisted.python import log
__version__ = "3.0"
class APIError(Except... | {
"repo_name": "jinty/van.contactology",
"path": "van/contactology/__init__.py",
"copies": "1",
"size": "2964",
"license": "bsd-3-clause",
"hash": -2132753996216031200,
"line_mean": 31.9333333333,
"line_max": 91,
"alpha_frac": 0.5782726046,
"autogenerated": false,
"ratio": 3.775796178343949,
"co... |
"""A generic class to build line-oriented command interpreters.
Interpreters constructed with this class obey the following conventions:
1. End of file on input is processed as the command 'EOF'.
2. A command is parsed out of each line by collecting the prefix composed
of characters in the identchars member.
3. A ... | {
"repo_name": "glwu/python-for-android",
"path": "python3-alpha/python3-src/Lib/cmd.py",
"copies": "46",
"size": "14803",
"license": "apache-2.0",
"hash": 3673645380942845000,
"line_mean": 36.1002506266,
"line_max": 79,
"alpha_frac": 0.5525231372,
"autogenerated": false,
"ratio": 4.49939209726443... |
"""A generic class to build line-oriented command interpreters.
Interpreters constructed with this class obey the following conventions:
1. End of file on input is processed as the command 'EOF'.
2. A command is parsed out of each line by collecting the prefix composed
of characters in the identchars member.... | {
"repo_name": "nattee/cafe-grader-web",
"path": "lib/assets/Lib/cmd.py",
"copies": "11",
"size": "15261",
"license": "mit",
"hash": 630701896771360600,
"line_mean": 36.0573566085,
"line_max": 79,
"alpha_frac": 0.5372518184,
"autogenerated": false,
"ratio": 4.5953026196928635,
"config_test": fal... |
"""A generic custom property.
There are three parts to this file:
- the Flexidate class, which acts as a non-trivial example
- the CustomProperty class, which implements the generic functionality
- classes FlexidateProperty and Actor, and main(), showing sample usage
(Arguably the CustomProperty class should come bef... | {
"repo_name": "bslatkin/8-bits",
"path": "appengine-ndb/custom.py",
"copies": "1",
"size": "8011",
"license": "apache-2.0",
"hash": 791197267654449400,
"line_mean": 31.5650406504,
"line_max": 78,
"alpha_frac": 0.6188990139,
"autogenerated": false,
"ratio": 3.7734338200659443,
"config_test": fal... |
"""A generic daemon class. Subclass and override the run() method.
Based on http://www.jejik.com/articles/2007/02/a_simple_unix_linux_daemon_in_python/
"""
import atexit
import os
from signal import SIGTERM
import sys
import time
class Daemon(object):
def __init__(self, pidfile, stdin='/dev/null', stdout='/dev/... | {
"repo_name": "RepositPower/pystatsd",
"path": "pystatsd/daemon.py",
"copies": "2",
"size": "3233",
"license": "bsd-2-clause",
"hash": -8496516436152733000,
"line_mean": 27.3596491228,
"line_max": 84,
"alpha_frac": 0.4856170739,
"autogenerated": false,
"ratio": 3.8170011806375443,
"config_test"... |
""" A generic Emacs-style kill ring, as well as a Qt-specific version.
"""
#-----------------------------------------------------------------------------
# Imports
#-----------------------------------------------------------------------------
# System library imports
from IPython.external.qt import QtCore, QtGui
#---... | {
"repo_name": "sodafree/backend",
"path": "build/ipython/build/lib.linux-i686-2.7/IPython/frontend/qt/console/kill_ring.py",
"copies": "5",
"size": "3809",
"license": "bsd-3-clause",
"hash": 9159628415168418000,
"line_mean": 28.7578125,
"line_max": 80,
"alpha_frac": 0.4305592019,
"autogenerated": f... |
""" A generic game scene. """
import pygame.locals
from .update_events import UpdateEvents
from .resources.scenes import SceneChange
class Scene(object):
""" A generic game scene.
A scene should be immutable once created.
"""
def setup(self):
pass
def teardown(self):
pass
... | {
"repo_name": "hodgestar/banjo",
"path": "ngn/scene.py",
"copies": "1",
"size": "1606",
"license": "mit",
"hash": 8157457618776009000,
"line_mean": 23.7076923077,
"line_max": 66,
"alpha_frac": 0.5722291407,
"autogenerated": false,
"ratio": 4.34054054054054,
"config_test": false,
"has_no_keywo... |
# A Generic job class, that is extended by a specific job class that needs to be executed on the cluster
import sys
import os.path
import os
import subprocess
import datetime
import time
from itertools import product
from collections import defaultdict
LOGS_DIR = './logs_' + datetime.datetime.now().isoformat()
MEASUR... | {
"repo_name": "Rhoana/rh_aligner",
"path": "scripts/job.py",
"copies": "1",
"size": "29164",
"license": "mit",
"hash": -5752663834891736000,
"line_mean": 42.0147492625,
"line_max": 165,
"alpha_frac": 0.5188245782,
"autogenerated": false,
"ratio": 4.109921082299887,
"config_test": false,
"has_... |
"""A generic, multi-protocol asynchronous server
Usage :
- create a server on a specific host and port : server = Server(host,port)
- call the loop() function, passing it the server and the class used to
manage the protocol (a subclass of ClientHandler) : loop(server,ProtocolClass)
An example of protocol class is pr... | {
"repo_name": "ActiveState/code",
"path": "recipes/Python/511453_generic_multi_protocol_asynchronous/recipe-511453.py",
"copies": "1",
"size": "6643",
"license": "mit",
"hash": -5898893554671109000,
"line_mean": 38.0764705882,
"line_max": 78,
"alpha_frac": 0.5645039892,
"autogenerated": false,
"r... |
"""A generic resource for publishing objects via BRPC.
Requires BRPC
API Stability: semi-stable
"""
from __future__ import nested_scopes
__version__ = "$Revision: 1.32 $"[11:-2]
# System Imports
import brpc
import urlparse
from cStringIO import StringIO
from gzip import GzipFile
pipeline_debug = False
version = "... | {
"repo_name": "rabimba/p2pScrapper",
"path": "BitTorrent-5.2.2/BTL/twisted_brpc.py",
"copies": "3",
"size": "23697",
"license": "mit",
"hash": 8288518969786411000,
"line_mean": 35.1234756098,
"line_max": 106,
"alpha_frac": 0.608136051,
"autogenerated": false,
"ratio": 4.209058614564832,
"config... |
"""A generic rest serving layer for NDB models."""
import logging
import sys
from google.appengine.api import namespace_manager
from google.appengine.ext import db
import flask
import flask.views
from appengine import user
def command(func):
"""Command decorator - automatically dispatches methods."""
setattr(f... | {
"repo_name": "tomwilkie/awesomation",
"path": "src/appengine/rest.py",
"copies": "1",
"size": "5973",
"license": "mit",
"hash": 825404743761626400,
"line_mean": 27.8550724638,
"line_max": 78,
"alpha_frac": 0.6358613762,
"autogenerated": false,
"ratio": 3.775600505689001,
"config_test": false,
... |
# A generic test template for the Python solutions to the linked list problems.
#
# The testee function is recommended to be defined inside the "solution" module.
#
import sys
import LinkedList
import solution
FP_RATIO_PREC = 2
# The number of digits of precision in the values representing
# the passed/failed ratio ... | {
"repo_name": "lilsweetcaligula/Algorithms",
"path": "data_structures/linked_list/problems/add_two/py/tests.py",
"copies": "1",
"size": "3686",
"license": "mit",
"hash": 5478549063349894000,
"line_mean": 38.6344086022,
"line_max": 112,
"alpha_frac": 0.5567010309,
"autogenerated": false,
"ratio": ... |
'''A generic tree class.'''
from util.dot import escape
from util.mixin import Keyed
def Tree(node_type):
'''A parameterized tree class which asserts that its nodes carry values
that are instances of a particular type.'''
class TreeClass(Keyed):
def __init__(self, value, subtrees=None):
... | {
"repo_name": "bdusell/pycfg",
"path": "src/util/tree.py",
"copies": "1",
"size": "2353",
"license": "mit",
"hash": -5039356408781752000,
"line_mean": 30.7972972973,
"line_max": 91,
"alpha_frac": 0.4946876328,
"autogenerated": false,
"ratio": 4.186832740213523,
"config_test": false,
"has_no_k... |
""" Agent acquiring data from web or file data sources and streaming packets. """
__author__ = 'Michael Meisinger'
from gevent.event import Event
from pyon.public import BadRequest, EventPublisher, log, NotFound, OT, RT, get_safe
from pyon.util.async import spawn
from ion.agent.streaming_agent import StreamingAgent... | {
"repo_name": "scionrep/scioncc",
"path": "src/ion/agent/data_agent.py",
"copies": "1",
"size": "2856",
"license": "bsd-2-clause",
"hash": 5203583757772816000,
"line_mean": 38.6666666667,
"line_max": 95,
"alpha_frac": 0.6523109244,
"autogenerated": false,
"ratio": 3.8594594594594596,
"config_te... |
"""Agent Base.
Basic definitions, such as the Agent and RoboticAgent base classes.
Author: Lucas David -- <ld492@drexel.edu>
License: MIT (c) 2016
"""
import logging
import time
import numpy as np
from enum import Enum
from naoqi import ALProxy
from mazerunner.components.base import NAOAdapter
from .. import compo... | {
"repo_name": "lucasdavid/mazerunner",
"path": "mazerunner/agents/base.py",
"copies": "1",
"size": "5016",
"license": "mit",
"hash": 3949280038649996000,
"line_mean": 28.5058823529,
"line_max": 80,
"alpha_frac": 0.5703748006,
"autogenerated": false,
"ratio": 4.176519567027477,
"config_test": fa... |
''' AgentClass.py: Class for a basic RL Agent '''
# Python imports.
from collections import defaultdict
class Agent(object):
''' Abstract Agent class. '''
def __init__(self, name, actions, gamma=0.99):
self.name = name
self.actions = list(actions) # Just in case we're given a numpy array (lik... | {
"repo_name": "david-abel/simple_rl",
"path": "simple_rl/agents/AgentClass.py",
"copies": "1",
"size": "1526",
"license": "apache-2.0",
"hash": -1949566223329106200,
"line_mean": 23.2222222222,
"line_max": 96,
"alpha_frac": 0.5347313237,
"autogenerated": false,
"ratio": 4.080213903743315,
"conf... |
#Agente escenario
from os import system
class cEscenario:
def __init__(self):
self.__aFila = 0
self.__aColumna = 0
self.__aEscenario = []
def sFilCol(self):
return self.__aFila, self.__aColumna
def sElemento(self, pFila, pColumna):
return self.__aEscenario[pFila]... | {
"repo_name": "ivansoriasolis/AppTanque",
"path": "src/aEscenario.py",
"copies": "1",
"size": "3748",
"license": "epl-1.0",
"hash": -3605092334596145000,
"line_mean": 33.0818181818,
"line_max": 123,
"alpha_frac": 0.4653148346,
"autogenerated": false,
"ratio": 3.206159110350727,
"config_test": f... |
# agent_email.py written by Duncan Murray 12/10/2014
import os
import imaplib
import smtplib
root_folder = os.path.abspath(os.path.dirname(os.path.abspath(__file__)) + os.sep + ".." + os.sep + ".." + os.sep + "..")
#import aikif.cls_log as mod_log
import aikif.config as mod_cfg # comment out if you dont need c... | {
"repo_name": "acutesoftware/rawdata",
"path": "scripts/gather/email_gmail.py",
"copies": "1",
"size": "4561",
"license": "mit",
"hash": -668787732551795200,
"line_mean": 36.7024793388,
"line_max": 122,
"alpha_frac": 0.5801359351,
"autogenerated": false,
"ratio": 3.571652310101801,
"config_test... |
""" agent errors """
import cgi
from paste.urlparser import PkgResourcesParser
from pylons.middleware import error_document_template
from webhelpers.html.builder import literal
from agent.lib.base import BaseController
class ErrorController(BaseController):
"""Generates error documents as and when they are requir... | {
"repo_name": "cronuspaas/cronusagent",
"path": "agent/agent/controllers/error.py",
"copies": "1",
"size": "1701",
"license": "apache-2.0",
"hash": -4778675462399555000,
"line_mean": 37.6590909091,
"line_max": 91,
"alpha_frac": 0.6631393298,
"autogenerated": false,
"ratio": 4.231343283582089,
"... |
"""Agent manager to handle plugin to agent RPC and periodic tasks."""
# coding=utf-8
# Copyright 2016 F5 Networks Inc.
#
# 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... | {
"repo_name": "richbrowne/f5-openstack-agent",
"path": "f5_openstack_agent/lbaasv2/drivers/bigip/agent_manager.py",
"copies": "1",
"size": "54618",
"license": "apache-2.0",
"hash": 2397604299253300000,
"line_mean": 40.4086429113,
"line_max": 79,
"alpha_frac": 0.5847888974,
"autogenerated": false,
... |
"""Agent module."""
import time
import uuid
import logging
import argparse
import importlib
from slamon_agent import timeutil
from slamon_agent.executor import Executor
from slamon_agent.handlers import TaskHandler
from slamon_agent.communication import Communicator, TemporaryError
class Agent(object):
"""Agent... | {
"repo_name": "SLAMon/slamon-python-agent",
"path": "slamon_agent/agent.py",
"copies": "1",
"size": "4443",
"license": "apache-2.0",
"hash": 4722172975109789000,
"line_mean": 37.6347826087,
"line_max": 111,
"alpha_frac": 0.5827143822,
"autogenerated": false,
"ratio": 4.280346820809249,
"config_... |
"""Agent"""
import torch
from torch.nn.utils.rnn import pack_padded_sequence
from net import Decoder, Encoder
from action import Action, AverageMeter
from dataset import Dataset
class Agent:
def __init__(self):
super(Agent, self).__init__()
#self.config = config
self.action = Action()
... | {
"repo_name": "MegaShow/college-programming",
"path": "Homework/Principles of Artificial Neural Networks/Week 15 Image Caption/src/agent.py",
"copies": "1",
"size": "6788",
"license": "mit",
"hash": -699218031971559300,
"line_mean": 33.9896907216,
"line_max": 89,
"alpha_frac": 0.5517088981,
"autoge... |
"""Agent plays with keyboard input
"""
__author__ = "Liyan Chen, Chang Gao"
__copyright__ = "Copyright (c) 2017 Malmactor"
__license__ = "MIT"
key_act_map = {
"a": "left_nojump",
"d": "right_nojump",
"w": "nolr_jump",
"q": "left_jump",
"e": "right_jump"
}
def keyboard_agent(simulation, keypoller... | {
"repo_name": "Malmactor/malrio",
"path": "src/Agent/keyboard_agent.py",
"copies": "1",
"size": "1163",
"license": "mit",
"hash": 2720742267763220000,
"line_mean": 24.2826086957,
"line_max": 66,
"alpha_frac": 0.5993121238,
"autogenerated": false,
"ratio": 3.567484662576687,
"config_test": false... |
# Agent.py
from Tools import *
from agTools import *
from random import *
import graphicDisplayGlobalVarAndFunctions as gvf
import commonVar as common
import numpy.random as npr
import numpy
import pandas as pd
import os
def mySort(ag):
if ag == []:
return []
numAg = []
for a in ag:
numAg... | {
"repo_name": "terna/SLAPP3",
"path": "6 objectSwarmObserverAgents_AESOP_turtleLib_NetworkX/oligopoly/Agent.py",
"copies": "1",
"size": "64523",
"license": "cc0-1.0",
"hash": 3846383145802185000,
"line_mean": 40.0190718373,
"line_max": 97,
"alpha_frac": 0.5622026254,
"autogenerated": false,
"rati... |
# Agent.py
from Tools import *
from agTools import *
from turtle import *
register_shape("school/pupilBlackF.gif")
register_shape("school/pupilGreenF.gif")
register_shape("school/pupilRedF.gif")
register_shape("school/pupilYellowF.gif")
register_shape("school/pupilSpecialF.gif")
register_shape("school/pupilBlackM.gif"... | {
"repo_name": "terna/SLAPP3",
"path": "6 objectSwarmObserverAgents_AESOP_turtleLib_NetworkX/school/Agent.py",
"copies": "1",
"size": "27391",
"license": "cc0-1.0",
"hash": 7063755813656908000,
"line_mean": 35.6680053548,
"line_max": 79,
"alpha_frac": 0.5407250557,
"autogenerated": false,
"ratio":... |
# Agent.py
from Tools import *
from agTools import *
import commonVar as common
class Agent(SuperAgent):
def __init__(self, number, myWorldState,
xPos, yPos, lX=0, rX=0, bY=0, tY=0, agType=""):
# 0 definitions to be replaced (useful only if the
# dimensions are o... | {
"repo_name": "terna/SLAPP3",
"path": "6 objectSwarmObserverAgents_AESOP_turtleLib_NetworkX/debug/Agent.py",
"copies": "1",
"size": "2358",
"license": "cc0-1.0",
"hash": -4903057965197125000,
"line_mean": 33.1739130435,
"line_max": 74,
"alpha_frac": 0.5453774385,
"autogenerated": false,
"ratio": ... |
# Agent.py
from Tools import *
from agTools import *
import graphicDisplayGlobalVarAndFunctions as gvf
import commonVar as common
class Agent(SuperAgent):
def __init__(self, number, myWorldState,
xPos=0, yPos=0, lX=0, rX=0, bY=0, tY=0, agType="",
sector=0):
# 0 d... | {
"repo_name": "terna/SLAPP3",
"path": "6 objectSwarmObserverAgents_AESOP_turtleLib_NetworkX/production/Agent.py",
"copies": "1",
"size": "11126",
"license": "cc0-1.0",
"hash": 8709830619486130000,
"line_mean": 34.3206349206,
"line_max": 87,
"alpha_frac": 0.5596800288,
"autogenerated": false,
"rat... |
# Agent.py
from Tools import *
from agTools import *
class Agent(SuperAgent):
def __init__(self, number, myWorldState,
xPos, yPos, lX=0, rX=0, bY=0, tY=0, agType=""):
# 0 definitions to be replaced (useful only if the
# dimensions are omitted and we do not use sp... | {
"repo_name": "terna/SLAPP3",
"path": "6 objectSwarmObserverAgents_AESOP_turtleLib_NetworkX/basic2D/Agent.py",
"copies": "1",
"size": "3576",
"license": "cc0-1.0",
"hash": -1957749164653530400,
"line_mean": 31.5090909091,
"line_max": 74,
"alpha_frac": 0.5352348993,
"autogenerated": false,
"ratio"... |
# Agent.py
from Tools import *
from agTools import *
class Agent(SuperAgent):
def __init__(self, number, myWorldState,
xPos, yPos, lX=-20, rX=19, bY=-20, tY=19, agType=""):
# the environment
self.agOperatingSets = []
self.number = number
self.lX = lX
self.r... | {
"repo_name": "terna/SLAPP3",
"path": "6 objectSwarmObserverAgents_AESOP_turtleLib_NetworkX/basic2classesPathsToTypes/Agent.py",
"copies": "1",
"size": "3376",
"license": "cc0-1.0",
"hash": -1119020441145169000,
"line_mean": 31.7766990291,
"line_max": 74,
"alpha_frac": 0.5337677725,
"autogenerated"... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.