text stringlengths 0 1.05M | meta dict |
|---|---|
"""A chart parser and some grammars. (Chapter 22)"""
from utils import *
#______________________________________________________________________________
# Grammars and Lexicons
def Rules(**rules):
"""Create a dictionary mapping symbols to alternative sequences.
>>> Rules(A = "B C | D E")
{'A': [['B', 'C... | {
"repo_name": "ken0nek/Software2",
"path": "140714/nlp.py",
"copies": "9",
"size": "6011",
"license": "mit",
"hash": 7787981093581479000,
"line_mean": 34.3588235294,
"line_max": 95,
"alpha_frac": 0.5338545999,
"autogenerated": false,
"ratio": 3.4289788933257275,
"config_test": false,
"has_no_... |
"""A chart parser and some grammars. (Chapter 22)"""
# (Written for the second edition of AIMA; expect some discrepanciecs
# from the third edition until this gets reviewed.)
from collections import defaultdict
import urllib.request
import re
# ________________________________________________________________________... | {
"repo_name": "sofmonk/aima-python",
"path": "nlp.py",
"copies": "1",
"size": "15220",
"license": "mit",
"hash": 7263117038356376000,
"line_mean": 37.2211055276,
"line_max": 114,
"alpha_frac": 0.5620562714,
"autogenerated": false,
"ratio": 3.7551221920513456,
"config_test": false,
"has_no_key... |
"""A chart parser and some grammars. (Chapter 22)"""
# (Written for the second edition of AIMA; expect some discrepanciecs
# from the third edition until this gets reviewed.)
from . utils import *
from collections import defaultdict
#______________________________________________________________________________
# Gr... | {
"repo_name": "gokul-uf/aima-python",
"path": "aimaPy/nlp.py",
"copies": "1",
"size": "8703",
"license": "mit",
"hash": 7219337756951665000,
"line_mean": 39.2916666667,
"line_max": 378,
"alpha_frac": 0.4898310927,
"autogenerated": false,
"ratio": 3.242548435171386,
"config_test": false,
"has_... |
"""A chart parser and some grammars. (Chapter 22)"""
# (Written for the second edition of AIMA; expect some discrepanciecs
# from the third edition until this gets reviewed.)
from utils import *
from collections import defaultdict
#______________________________________________________________________________
# Gra... | {
"repo_name": "MircoT/aima-python",
"path": "nlp.py",
"copies": "1",
"size": "8702",
"license": "mit",
"hash": 7379244320641577000,
"line_mean": 39.1013824885,
"line_max": 378,
"alpha_frac": 0.4898873822,
"autogenerated": false,
"ratio": 3.2421758569299555,
"config_test": false,
"has_no_keywo... |
"""A chart parser and some grammars. (Chapter 22)"""
# (Written for the second edition of AIMA; expect some discrepanciecs
# from the third edition until this gets reviewed.)
from utils import *
#______________________________________________________________________________
# Grammars and Lexicons
def Rules(**rules... | {
"repo_name": "ttalviste/aima",
"path": "aima/nlp.py",
"copies": "2",
"size": "8297",
"license": "mit",
"hash": -6962023272076194000,
"line_mean": 38.6985645933,
"line_max": 378,
"alpha_frac": 0.5048812824,
"autogenerated": false,
"ratio": 3.0958955223880595,
"config_test": false,
"has_no_key... |
""" A cheap and cheerful elm327 wifi dongle simulator.
"""
import SocketServer
LISTEN_IP = 'localhost'
RESPONDERS = {
'ATI': lambda: 'LM327 v1.5 (fake)',
'010C': lambda: '01 07', # RPM
'010D': lambda: '64', # KPH
}
class ELM327Handler(SocketServer.BaseRequestHandler):
def handle(... | {
"repo_name": "thisismyrobot/obDash",
"path": "elm327wifisim.py",
"copies": "1",
"size": "1132",
"license": "mit",
"hash": 9205753825789336000,
"line_mean": 23.1555555556,
"line_max": 70,
"alpha_frac": 0.5300353357,
"autogenerated": false,
"ratio": 3.9719298245614034,
"config_test": false,
"h... |
'''A checker for Draft Designer Smart Grids. Checks several different aspects of the grid and
reports Errors and Warnings.
Created on May 15, 2013
@author: Cam Moore
'''
from apps.managers.challenge_mgr import challenge_mgr
from apps.widgets.smartgrid_design.models import DesignerAction, DesignerEvent, DesignerGrid, \... | {
"repo_name": "yongwen/makahiki",
"path": "makahiki/apps/managers/smartgrid_mgr/gcc.py",
"copies": "3",
"size": "19805",
"license": "mit",
"hash": -844153852135999200,
"line_mean": 39.5840163934,
"line_max": 100,
"alpha_frac": 0.5963645544,
"autogenerated": false,
"ratio": 3.8772513703993736,
"... |
"""A CherryPy tool for hosting a foreign WSGI application."""
import sys
import warnings
import cherrypy
# is this sufficient for start_response?
def start_response(status, response_headers, exc_info=None):
cherrypy.response.status = status
headers_dict = dict(response_headers)
cherrypy.resp... | {
"repo_name": "cread/ec2id",
"path": "cherrypy/lib/wsgiapp.py",
"copies": "1",
"size": "2610",
"license": "apache-2.0",
"hash": -3720640023283479000,
"line_mean": 31.8961038961,
"line_max": 73,
"alpha_frac": 0.6302681992,
"autogenerated": false,
"ratio": 4.110236220472441,
"config_test": false,... |
"""achievement_date_unique
Revision ID: 65c7a32b7322
Revises: d4a70083f72e
Create Date: 2017-01-31 23:01:11.744725
"""
# revision identifiers, used by Alembic.
revision = '65c7a32b7322'
down_revision = 'd4a70083f72e'
branch_labels = None
depends_on = None
from alembic import op
import sqlalchemy as sa
def upgrade... | {
"repo_name": "ActiDoo/gamification-engine",
"path": "gengine/app/alembic/versions/65c7a32b7322_achievement_date_unique.py",
"copies": "1",
"size": "2270",
"license": "mit",
"hash": 8783330824597448000,
"line_mean": 51.7906976744,
"line_max": 219,
"alpha_frac": 0.7281938326,
"autogenerated": false,... |
"""Achievement management."""
from flask import jsonify
from flask_restplus import Namespace, Resource
import api
from api import PicoException, require_admin
from .schemas import achievement_patch_req, achievement_req
ns = Namespace("achievements", description="Achievement management")
@ns.route("")
class Achieve... | {
"repo_name": "royragsdale/picoCTF",
"path": "picoCTF-web/api/apps/v1/achievements.py",
"copies": "2",
"size": "2868",
"license": "mit",
"hash": -5250793928133448000,
"line_mean": 33.5542168675,
"line_max": 88,
"alpha_frac": 0.6474895397,
"autogenerated": false,
"ratio": 3.4721549636803872,
"co... |
#Achieves around .019 when trained with the 3'rd convolutional module having 64 layers
#when trained on around 175,000 patches in total.
#The 32 layer in module 3) is not that different, achieving around .022
#In both cases after 10 training epochs.
#Sadly not the 205,000 due to Mathematica HDF5 bug (uses 32-bit progra... | {
"repo_name": "jfrancis71/TensorFlowApps",
"path": "FaceTraining.py",
"copies": "1",
"size": "4559",
"license": "mit",
"hash": 2239702025717803000,
"line_mean": 34.0692307692,
"line_max": 157,
"alpha_frac": 0.6499232288,
"autogenerated": false,
"ratio": 2.842269326683292,
"config_test": false,
... |
"""Acid Base descriptor.
References:
* http://cdk.github.io/cdk/1.5/docs/api/org/openscience/cdk/qsar/descriptors/molecular/AcidicGroupCountDescriptor.html
* http://cdk.github.io/cdk/1.5/docs/api/org/openscience/cdk/qsar/descriptors/molecular/BasicGroupCountDescriptor.html
""" # noqa: E501
from abc import a... | {
"repo_name": "mordred-descriptor/mordred",
"path": "mordred/AcidBase.py",
"copies": "1",
"size": "1810",
"license": "bsd-3-clause",
"hash": 1713949195114105600,
"line_mean": 20.0465116279,
"line_max": 122,
"alpha_frac": 0.5524861878,
"autogenerated": false,
"ratio": 2.9966887417218544,
"config... |
"""aclarknet 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: url(r'^$', views.home, name='home')
Class-b... | {
"repo_name": "ACLARKNET/aclarknet-website",
"path": "aclarknet/urls.py",
"copies": "1",
"size": "1649",
"license": "mit",
"hash": 5174645127124175000,
"line_mean": 42.3947368421,
"line_max": 79,
"alpha_frac": 0.6658580958,
"autogenerated": false,
"ratio": 3.4,
"config_test": false,
"has_no_k... |
"""A class and CLI client to interact with a Pyjojo instance"""
from __future__ import print_function
import base64
import json
import requests
class Mojo(object):
"""A class used to interact with a Pyjojo instance"""
def __init__(self, **kwargs):
"""Constructs a Mojo by connecting to a Jojo and cach... | {
"repo_name": "GradysGhost/pymojo",
"path": "pymojo/mojo.py",
"copies": "1",
"size": "4385",
"license": "apache-2.0",
"hash": -1865219172026683000,
"line_mean": 31.4814814815,
"line_max": 79,
"alpha_frac": 0.5388825542,
"autogenerated": false,
"ratio": 4.299019607843137,
"config_test": false,
... |
"""A class and helper functions for dealing with density
histograms.
"""
import glob
import os.path
import numpy as np
class DensityHistogram(object):
"""A collection of data about the z-direction local density.
Attributes:
index: A numpy array enumerating the subensembles of the
simula... | {
"repo_name": "adamrall/coex",
"path": "coex/density.py",
"copies": "1",
"size": "4142",
"license": "bsd-2-clause",
"hash": 8885114256098753000,
"line_mean": 29.9104477612,
"line_max": 78,
"alpha_frac": 0.6224046354,
"autogenerated": false,
"ratio": 3.796516956920257,
"config_test": false,
"h... |
# A class containing reading tools for sentence embeddings.
# 1) reading the word embeddings from a file
# 2) reading the Microsoft Research Paraphrase Corpus from a file (version training or testing)
import datetime
from bllipparser import Tree
import math
import nltk
import sys
from nltk.data import find
embeddin... | {
"repo_name": "Kelina/SentenceEmbeddings",
"path": "Tools_Reading.py",
"copies": "1",
"size": "3468",
"license": "apache-2.0",
"hash": 149221526007962980,
"line_mean": 26.1015625,
"line_max": 105,
"alpha_frac": 0.6450403691,
"autogenerated": false,
"ratio": 3.226046511627907,
"config_test": fal... |
"""A :class:`Dataset` is a simple abstraction around a `data` and a
`target` matrix.
A Dataset's :attr:`~Dataset.data` and :attr:`~Dataset.target`
attributes are available via attributes of the same name:
.. doctest::
>>> data = np.array([[3, 2, 1], [2, 1, 0]] * 4)
>>> target = np.array([3, 2] * 4)
>>> dataset... | {
"repo_name": "rajegannathan/grasp-lift-eeg-cat-dog-solution-updated",
"path": "python-packages/nolearn-0.5/nolearn/dataset.py",
"copies": "2",
"size": "2473",
"license": "bsd-3-clause",
"hash": 8896767815531190000,
"line_mean": 28.0941176471,
"line_max": 76,
"alpha_frac": 0.6457743631,
"autogenera... |
# A class encapsulating the basic functionality commonly used for an OpenGL view
# System imports
import numpy as np
from math import pi, sin, cos, tan
# OpenGL imports
from OpenGL.GL import *
from OpenGL.GLU import *
from OpenGL.GLUT import *
# Use euclid for rotations
import euclid as eu
# Local imports
from Util... | {
"repo_name": "nmwsharp/DDGSpring2016",
"path": "core/Camera.py",
"copies": "1",
"size": "6240",
"license": "mit",
"hash": 4532495744758387700,
"line_mean": 31.5,
"line_max": 94,
"alpha_frac": 0.5708333333,
"autogenerated": false,
"ratio": 3.6533957845433256,
"config_test": false,
"has_no_key... |
# a class for all the global variables for the CAD system, to replace HeeksCAD
import wx
from SelectMode import SelectMode
from Color import HeeksColor
from Material import Material
import geom
from OpenGL.GL import *
from OpenGL.GLU import *
from Grid import RenderGrid
import sys
from CadFrame import CadFram... | {
"repo_name": "danheeks/HeeksCAM",
"path": "PyCAD/HeeksCAD.py",
"copies": "1",
"size": "8521",
"license": "bsd-2-clause",
"hash": 7320780825895988000,
"line_mean": 31.28515625,
"line_max": 173,
"alpha_frac": 0.5670695928,
"autogenerated": false,
"ratio": 3.526903973509934,
"config_test": false,... |
"""A class for a normal form game"""
import numpy as np
from scipy.optimize import linprog
from scipy.spatial import HalfspaceIntersection
def build_halfspaces(M):
"""
Build a matrix representation for a halfspace corresponding to:
Mx <= 1 and x >= 0
This is of the form:
[M: -1]
[... | {
"repo_name": "drvinceknight/Nashpy",
"path": "src/nashpy/polytope/polytope.py",
"copies": "1",
"size": "2774",
"license": "mit",
"hash": -5039639765285649000,
"line_mean": 24.2181818182,
"line_max": 104,
"alpha_frac": 0.6164383562,
"autogenerated": false,
"ratio": 3.7184986595174263,
"config_t... |
"""A class for a normal form game"""
import numpy as np
from .algorithms.lemke_howson import lemke_howson
from .algorithms.support_enumeration import support_enumeration
from .algorithms.vertex_enumeration import vertex_enumeration
from .learning.fictitious_play import fictitious_play
from .learning.replicator_dynamic... | {
"repo_name": "drvinceknight/Nashpy",
"path": "src/nashpy/game.py",
"copies": "1",
"size": "9268",
"license": "mit",
"hash": 7979568060059578000,
"line_mean": 30.4169491525,
"line_max": 106,
"alpha_frac": 0.5869659042,
"autogenerated": false,
"ratio": 4.314711359404097,
"config_test": false,
... |
"""A class for a normal form game"""
import warnings
from itertools import chain, combinations
import numpy as np
def powerset(n):
"""
A power set of range(n)
Based on recipe from python itertools documentation:
https://docs.python.org/2/library/itertools.html#recipes
Parameters
----------... | {
"repo_name": "drvinceknight/Nashpy",
"path": "src/nashpy/algorithms/support_enumeration.py",
"copies": "1",
"size": "6855",
"license": "mit",
"hash": -738179337116536600,
"line_mean": 26.7530364372,
"line_max": 85,
"alpha_frac": 0.6106491612,
"autogenerated": false,
"ratio": 3.8926746166950594,
... |
"""A class for an overall activity"""
from twothirds import Data, TwoThirdsGame
import seaborn as sns
import matplotlib.pyplot as plt
class Activity:
def __init__(self, filename):
self.raw_data = Data(filename)
self.raw_data.read()
self.data = self.raw_data.out()
self.games = [TwoTh... | {
"repo_name": "drvinceknight/TwoThirds",
"path": "twothirds/activity.py",
"copies": "1",
"size": "1744",
"license": "mit",
"hash": 5477309497749872000,
"line_mean": 33.88,
"line_max": 102,
"alpha_frac": 0.5653669725,
"autogenerated": false,
"ratio": 3.3409961685823757,
"config_test": false,
"... |
""" A class for building a PyRTL AES circuit.
Currently this class only supports 128 bit AES encryption/decryption
Example::
import pyrtl
from pyrtl.rtllib.aes import AES
aes = AES()
plaintext = pyrtl.Input(bitwidth=128, name='aes_plaintext')
key = pyrtl.Input(bitwidth=128, name='aes_key')
a... | {
"repo_name": "UCSBarchlab/PyRTL",
"path": "pyrtl/rtllib/aes.py",
"copies": "1",
"size": "20040",
"license": "bsd-3-clause",
"hash": -3803449266277873700,
"line_mean": 45.0689655172,
"line_max": 93,
"alpha_frac": 0.5779441118,
"autogenerated": false,
"ratio": 2.8542942600769123,
"config_test": ... |
""" A class for building histograms incrementally. """
import numpy as np
from collections import defaultdict
class RHist():
"""
A class for calculating histograms where the bin size
and location is set by rounding the input (i.e. use <decimals>) but
where the number and range of bins is determined... | {
"repo_name": "parenthetical-e/bigstats",
"path": "hist.py",
"copies": "1",
"size": "6254",
"license": "bsd-2-clause",
"hash": -1240893760392850400,
"line_mean": 26.3100436681,
"line_max": 77,
"alpha_frac": 0.5295810681,
"autogenerated": false,
"ratio": 4.111768573307035,
"config_test": false,
... |
"""A class for controling graph."""
import numpy as np
import matplotlib.pyplot as plt
from math import log10, ceil, sqrt
from more_itertools import chunked
import cPickle
from .type import is_number, float_list
class MGraph:
"""Control graphs and visualizaton."""
def __init__(self):
self.dir_to_save ... | {
"repo_name": "belemizz/mimic2_tools",
"path": "clinical_db/mutil/graph.py",
"copies": "1",
"size": "18161",
"license": "mit",
"hash": -5158962004349609000,
"line_mean": 38.6528384279,
"line_max": 99,
"alpha_frac": 0.5323495402,
"autogenerated": false,
"ratio": 3.4546319193456343,
"config_test"... |
'A class for creating focus elements for use with gridgen'
# Copyright R. Hetland on 2007-11-26.
# All rights reserved.
# Version 1.0.0 on 2007-11-26
# Initial version of Focus and FocusPoint classes.
from numpy import *
from scipy.special import erf
class FocusPoint(object):
"""
Return a transformed, ... | {
"repo_name": "simion1232006/pyroms",
"path": "pyroms/focus.py",
"copies": "1",
"size": "4087",
"license": "bsd-3-clause",
"hash": -6630461991126780000,
"line_mean": 33.9401709402,
"line_max": 106,
"alpha_frac": 0.5869831172,
"autogenerated": false,
"ratio": 2.846100278551532,
"config_test": fa... |
"""A class for downloading event data from Open Catalogs."""
import codecs
import json
import os
import re
import shutil
import webbrowser
from collections import OrderedDict
from difflib import get_close_matches
from astrocats.catalog.utils import is_number
from six import string_types
from mosfit.printer import Pri... | {
"repo_name": "guillochon/FriendlyFit",
"path": "mosfit/fetcher.py",
"copies": "5",
"size": "10425",
"license": "mit",
"hash": 1692135649380628200,
"line_mean": 43.1737288136,
"line_max": 79,
"alpha_frac": 0.4174580336,
"autogenerated": false,
"ratio": 5.055771096023278,
"config_test": true,
... |
""" A class for handling large tractography datasets.
It is built using the h5py which in turn implement
key features of the HDF5 (hierachical data format) API [1]_.
References
----------
.. [1] http://www.hdfgroup.org/HDF5/doc/H5.intro.html
"""
import numpy as np
import h5py
from nibabel.stream... | {
"repo_name": "nilgoyyou/dipy",
"path": "dipy/io/dpy.py",
"copies": "2",
"size": "4474",
"license": "bsd-3-clause",
"hash": 3260410179514379000,
"line_mean": 29.2297297297,
"line_max": 77,
"alpha_frac": 0.5127402772,
"autogenerated": false,
"ratio": 3.694467382328654,
"config_test": false,
"h... |
''' A class for handling large tractography datasets.
It is built using the pytables tools which in turn implement
key features of the HDF5 (hierachical data format) API [1]_.
References
----------
.. [1] http://www.hdfgroup.org/HDF5/doc/H5.intro.html
'''
import numpy as np
# Conditional import ... | {
"repo_name": "matthieudumont/dipy",
"path": "dipy/io/dpy.py",
"copies": "2",
"size": "4952",
"license": "bsd-3-clause",
"hash": -5905453544975111000,
"line_mean": 32.6870748299,
"line_max": 79,
"alpha_frac": 0.4919224556,
"autogenerated": false,
"ratio": 3.9775100401606425,
"config_test": fals... |
''' A class for handling large tractography datasets.
It is built using the pytables tools which in turn implement
key features of the HDF5 (hierachical data format) API [1]_.
References
----------
.. [1] http://www.hdfgroup.org/HDF5/doc/H5.intro.html
'''
import numpy as np
# Conditional import... | {
"repo_name": "rfdougherty/dipy",
"path": "dipy/io/dpy.py",
"copies": "11",
"size": "4636",
"license": "bsd-3-clause",
"hash": 4313028932745195500,
"line_mean": 32.8394160584,
"line_max": 135,
"alpha_frac": 0.5230802416,
"autogenerated": false,
"ratio": 3.762987012987013,
"config_test": false,
... |
''' A class for handling large tractography datasets.
It is built using the pytables tools which in turn implement
key features of the HDF5 (hierachical data format) API [1]_.
References
----------
.. [1] http://www.hdfgroup.org/HDF5/doc/H5.intro.html
'''
import numpy as np
from distutils.versio... | {
"repo_name": "omarocegueda/dipy",
"path": "dipy/io/dpy.py",
"copies": "3",
"size": "5761",
"license": "bsd-3-clause",
"hash": 6197182644142380000,
"line_mean": 33.7048192771,
"line_max": 119,
"alpha_frac": 0.510328068,
"autogenerated": false,
"ratio": 3.9110658520027157,
"config_test": false,
... |
'''A class for interacting with a nsqd instance over http'''
from . import BaseClient, json_wrap, ok_check, ClientException
from ..util import pack
class Client(BaseClient):
@ok_check
def ping(self):
'''Ping the client'''
return self.get('ping')
@json_wrap
def info(self):
'''... | {
"repo_name": "dlecocq/nsq-py",
"path": "nsq/http/nsqd.py",
"copies": "1",
"size": "3917",
"license": "mit",
"hash": 3484775974341873700,
"line_mean": 33.9732142857,
"line_max": 80,
"alpha_frac": 0.5739086035,
"autogenerated": false,
"ratio": 4.252985884907709,
"config_test": false,
"has_no_k... |
'''A class for interacting with a nsqlookupd instance over http'''
from . import BaseClient, json_wrap, ok_check
class Client(BaseClient):
'''A client for talking to nsqlookupd over http'''
@ok_check
def ping(self):
'''Ping the client'''
return self.get('ping')
@json_wrap
def inf... | {
"repo_name": "dlecocq/nsq-py",
"path": "nsq/http/nsqlookupd.py",
"copies": "1",
"size": "2002",
"license": "mit",
"hash": -9212283524350920000,
"line_mean": 28.0144927536,
"line_max": 66,
"alpha_frac": 0.5914085914,
"autogenerated": false,
"ratio": 4.069105691056911,
"config_test": false,
"h... |
"""A class for managing collision tests between all objects in a WorldModel.
"""
from __future__ import generators
from robotsim import *
import se3
class WorldCollider:
"""
Attributes:
- geomList: a list of (object,geom) pairs for all objects in the world
- mask: a list of sets, indicating whic... | {
"repo_name": "stevekuznetsov/Klampt",
"path": "Python/klampt/robotcollide.py",
"copies": "1",
"size": "15364",
"license": "bsd-3-clause",
"hash": 2114435262365613800,
"line_mean": 42.0364145658,
"line_max": 132,
"alpha_frac": 0.5537620411,
"autogenerated": false,
"ratio": 4.03784494086728,
"co... |
"""A class for managing OpenBSD's Packet Filter.
This class communicates with the kernel through the ioctl(2) interface provided
by the pf(4) pseudo-device; this allows Python to natively send commands to the
kernel, thanks to the fcntl and ctypes modules.
"""
import os
import stat
from fcntl import ioctl
from errno ... | {
"repo_name": "dotpy/py-pf",
"path": "pf/filter.py",
"copies": "1",
"size": "30374",
"license": "bsd-3-clause",
"hash": 3747517932098310700,
"line_mean": 33.9528193326,
"line_max": 86,
"alpha_frac": 0.5631790347,
"autogenerated": false,
"ratio": 3.4363615793641813,
"config_test": false,
"has_... |
"""A class for managing OpRegularizers."""
from __future__ import absolute_import
from __future__ import division
# [internal] enable type annotations
from __future__ import print_function
import collections
from morph_net.framework import concat_and_slice_regularizers
from morph_net.framework import constant_op_reg... | {
"repo_name": "google-research/morph-net",
"path": "morph_net/framework/op_regularizer_manager.py",
"copies": "1",
"size": "27056",
"license": "apache-2.0",
"hash": 6339691322377077000,
"line_mean": 36.7350069735,
"line_max": 80,
"alpha_frac": 0.6579686576,
"autogenerated": false,
"ratio": 3.7515... |
"""A class for manipulating time series based on measurements at
unevenly-spaced times, see:
http://en.wikipedia.org/wiki/Unevenly_spaced_time_series
"""
import csv
import datetime
import itertools
import pprint
from queue import PriorityQueue
import sortedcontainers
from dateutil.parser import parse as date_parse
f... | {
"repo_name": "datascopeanalytics/traces",
"path": "traces/timeseries.py",
"copies": "1",
"size": "36019",
"license": "mit",
"hash": 3663469954914108400,
"line_mean": 31.1598214286,
"line_max": 79,
"alpha_frac": 0.5597323635,
"autogenerated": false,
"ratio": 4.360653753026634,
"config_test": fa... |
""" A class for observatories to use with the Virtual Radio Interferometer
Adapted from the vriObservatory.java class from the legacy code."""
class Observatory(object):
def __init__(self, menu_name, full_name,
latitude, longitude, num_antennas, num_stations,
ant_diameter, ant_el_limit,
antennas, stati... | {
"repo_name": "NuriaLorente/VRIpy",
"path": "Observatory.py",
"copies": "1",
"size": "1070",
"license": "mit",
"hash": 988909154599918000,
"line_mean": 47.6363636364,
"line_max": 81,
"alpha_frac": 0.7485981308,
"autogenerated": false,
"ratio": 3.440514469453376,
"config_test": false,
"has_no_... |
# A class for performing hidden markov models
import copy
import numpy as np
class HMM():
def __init__(self, transmission_prob, emission_prob, obs=None):
'''
Note that this implementation assumes that n, m, and T are small
enough not to require underflow mitigation.
Required Inpu... | {
"repo_name": "aldengolab/hidden-markov-model",
"path": "hmm.py",
"copies": "1",
"size": "10528",
"license": "mit",
"hash": 8558655080084198000,
"line_mean": 38.5789473684,
"line_max": 151,
"alpha_frac": 0.5539513678,
"autogenerated": false,
"ratio": 3.6927393896878287,
"config_test": false,
... |
"""A class for reading and writing ELF format binaries (esp. Amiga m68k ones)"""
import struct
import os
from ELF import *
from ELFFile import *
class ELFReader:
def _load_section_headers(self, f, ef):
shoff = ef.header.shoff
shentsize = ef.header.shentsize
f.seek(shoff, os.SEEK_SET)
shnum = ef.he... | {
"repo_name": "alpine9000/amiga_examples",
"path": "tools/external/amitools/amitools/binfmt/elf/ELFReader.py",
"copies": "1",
"size": "6319",
"license": "bsd-2-clause",
"hash": -7209164815298673000,
"line_mean": 27.9862385321,
"line_max": 80,
"alpha_frac": 0.6217755974,
"autogenerated": false,
"r... |
"""A class for SQLGitHub sessions.
Sample Usage:
g = Github(token)
s = SgSession(g, ["name", "description"], "abseil.repos")
print(s.Execute())
"""
import table as tb
import table_fetcher
from expression import SgExpression
from grouping import SgGrouping
from ordering import SgOrdering
from ordering impo... | {
"repo_name": "lnishan/SQLGitHub",
"path": "components/session.py",
"copies": "1",
"size": "5335",
"license": "mit",
"hash": -5547283115970506000,
"line_mean": 38.5185185185,
"line_max": 153,
"alpha_frac": 0.6131208997,
"autogenerated": false,
"ratio": 4.122874806800618,
"config_test": false,
... |
#a class for the Kaplan-Meier estimator
from statsmodels.compat.python import range
import numpy as np
from math import sqrt
import matplotlib.pyplot as plt
class KAPLAN_MEIER(object):
def __init__(self, data, timesIn, groupIn, censoringIn):
raise RuntimeError('Newer version of Kaplan-Meier class available... | {
"repo_name": "wzbozon/statsmodels",
"path": "statsmodels/sandbox/km_class.py",
"copies": "31",
"size": "11748",
"license": "bsd-3-clause",
"hash": -5926520682033970000,
"line_mean": 47.95,
"line_max": 91,
"alpha_frac": 0.4906367041,
"autogenerated": false,
"ratio": 4.438231960710238,
"config_t... |
#a class for the Kaplan-Meier estimator
import numpy as np
from math import sqrt
import matplotlib.pyplot as plt
class KAPLAN_MEIER(object):
def __init__(self, data, timesIn, groupIn, censoringIn):
raise RuntimeError('Newer version of Kaplan-Meier class available in survival2.py')
#store the inputs... | {
"repo_name": "wesm/statsmodels",
"path": "scikits/statsmodels/sandbox/km_class.py",
"copies": "5",
"size": "11704",
"license": "bsd-3-clause",
"hash": 5593517864010706000,
"line_mean": 47.9707112971,
"line_max": 91,
"alpha_frac": 0.4892344498,
"autogenerated": false,
"ratio": 4.438376943496397,
... |
"""A class for the Lemke Howson algorithm"""
import warnings
from itertools import cycle
import numpy as np
from nashpy.integer_pivoting import (
make_tableau,
non_basic_variables,
pivot_tableau,
)
def shift_tableau(tableau, shape):
"""
Shift a tableau to ensure labels of pairs of tableaux coinc... | {
"repo_name": "drvinceknight/Nashpy",
"path": "src/nashpy/algorithms/lemke_howson.py",
"copies": "1",
"size": "3796",
"license": "mit",
"hash": -3560653609190244000,
"line_mean": 26.9117647059,
"line_max": 83,
"alpha_frac": 0.6198630137,
"autogenerated": false,
"ratio": 3.7142857142857144,
"con... |
"""A class for the Lemke Howson algorithm with lexicographical ordering"""
from itertools import cycle
import numpy as np
from nashpy.integer_pivoting import make_tableau, pivot_tableau_lex
from .lemke_howson import shift_tableau, tableau_to_strategy
def lemke_howson_lex(A, B, initial_dropped_label=0):
"""
... | {
"repo_name": "drvinceknight/Nashpy",
"path": "src/nashpy/algorithms/lemke_howson_lex.py",
"copies": "1",
"size": "3808",
"license": "mit",
"hash": 902916041433906600,
"line_mean": 31.547008547,
"line_max": 85,
"alpha_frac": 0.6402310924,
"autogenerated": false,
"ratio": 3.6232159847764036,
"co... |
"""A class for the vertex enumeration algorithm"""
import numpy as np
from nashpy.polytope import build_halfspaces, non_trivial_vertices
def vertex_enumeration(A, B):
"""
Obtain the Nash equilibria using enumeration of the vertices of the best
response polytopes.
Algorithm implemented here is Algori... | {
"repo_name": "drvinceknight/Nashpy",
"path": "src/nashpy/algorithms/vertex_enumeration.py",
"copies": "1",
"size": "1448",
"license": "mit",
"hash": 2097955600661822500,
"line_mean": 26.8461538462,
"line_max": 79,
"alpha_frac": 0.6256906077,
"autogenerated": false,
"ratio": 3.497584541062802,
... |
## A class for working with trajectories (basically animation paths)
## J Eisenmann
## ACCAD
## 2012-13
from IterativeDynamicTimeWarping import *
from Vector import *
from Plane import *
from Cylinder import *
import maya.cmds as mc
class Trajectory:
""" A class to hold spatio-temporal path information """
d... | {
"repo_name": "jeisenma/traceSelectionInMaya",
"path": "scripts/Trajectory.py",
"copies": "1",
"size": "5614",
"license": "mit",
"hash": 5848402642529200000,
"line_mean": 40.5851851852,
"line_max": 169,
"alpha_frac": 0.5545065907,
"autogenerated": false,
"ratio": 3.879751209398756,
"config_test... |
"""A class for working with vector representations."""
import json
import logging
import os
from io import open
import numpy as np
from tqdm import tqdm
logger = logging.getLogger(__name__)
class Reach(object):
"""
Work with vector representations of items.
Supports functions for calculating fast batc... | {
"repo_name": "stephantul/reach",
"path": "reach/reach.py",
"copies": "1",
"size": "28867",
"license": "mit",
"hash": -3763876699457379300,
"line_mean": 33.7795180723,
"line_max": 98,
"alpha_frac": 0.5619565594,
"autogenerated": false,
"ratio": 4.51540747692789,
"config_test": false,
"has_no_... |
"""A class for wrapping a WebSocket."""
import asyncio
import json
import websockets
class WebSocketWrapper(object):
"""A class that wraps a client WebSocket.
Attributes:
ws (websockets.client.WebSocketClientProtocol): The websocket object
representing the WebSocket wrapped by this clas... | {
"repo_name": "welchbj/spotnet",
"path": "backend/utils/ws_wrapper.py",
"copies": "1",
"size": "1747",
"license": "mit",
"hash": 3144005357220292600,
"line_mean": 24.6911764706,
"line_max": 76,
"alpha_frac": 0.5935890097,
"autogenerated": false,
"ratio": 4.44529262086514,
"config_test": false,
... |
""" A class for writing out everything associated with a training run.
E.g. Command line arguments, hyperparameters, input and output sizes, model description, results
"""
import os
import sys
import argparse
import datetime
import pickle
import subprocess
class Experiment(object):
__version__ = "1.0.0"
def ... | {
"repo_name": "Bleyddyn/malpi",
"path": "malpi/train/experiment.py",
"copies": "1",
"size": "5843",
"license": "mit",
"hash": 1762477492135918000,
"line_mean": 42.9323308271,
"line_max": 138,
"alpha_frac": 0.5719664556,
"autogenerated": false,
"ratio": 3.908361204013378,
"config_test": false,
... |
""" A class holding game state """
import sumoku.game
import sys
def output_tile(tile, highlight):
""" Print a tile in color """
sys.stdout.write('\x1b[{};{}1m{}\x1b[0m'
.format(31 + tile[1], '47;' if highlight else '',
tile[0]))
class GameState(object):
... | {
"repo_name": "sheepweevil/modulus-master",
"path": "sumoku/gamestate.py",
"copies": "1",
"size": "4409",
"license": "mit",
"hash": -170293391087994560,
"line_mean": 37.3391304348,
"line_max": 77,
"alpha_frac": 0.4992061692,
"autogenerated": false,
"ratio": 3.972072072072072,
"config_test": fal... |
"""A class implementation of code found in
https://github.com/hackappcom/iloot"""
from xml.parsers.expat import ExpatError
from urllib.parse import urlparse
import plistlib
import http.client as http
class PlistRequester(object):
"""A class to make requesting plist data from a webserver easier"""
def __init_... | {
"repo_name": "mattandersen/icloud-recents-deleter",
"path": "libs/plistrequester.py",
"copies": "1",
"size": "1656",
"license": "mit",
"hash": 5336805120631063000,
"line_mean": 30.2452830189,
"line_max": 115,
"alpha_frac": 0.6123188406,
"autogenerated": false,
"ratio": 3.7722095671981775,
"con... |
"""A class implementing an exponentially moving average."""
import progress.decorators
from progress.eta.base import BaseETA
@progress.decorators.inherit_docstrings
class EMAETA(BaseETA):
"""Implements an exponentially moving average algorithm.
Previous progress has an exponentially decreasing influence
... | {
"repo_name": "MisanthropicBit/progress",
"path": "progress/eta/ema.py",
"copies": "1",
"size": "1607",
"license": "mit",
"hash": -6126272084552591000,
"line_mean": 25.3442622951,
"line_max": 78,
"alpha_frac": 0.5718730554,
"autogenerated": false,
"ratio": 3.835322195704057,
"config_test": fals... |
"""A class needed to reload modules."""
import sys
import imp
import logging
from .tools import PKG_NAME
log = logging.getLogger("ECC")
class ModuleReloader:
"""Reloader for all dependencies."""
MAX_RELOAD_TRIES = 10
@staticmethod
def reload_all(ignore_string='singleton'):
"""Reload all lo... | {
"repo_name": "niosus/EasyClangComplete",
"path": "plugin/utils/module_reloader.py",
"copies": "1",
"size": "1595",
"license": "mit",
"hash": 9104347241393245000,
"line_mean": 33.6739130435,
"line_max": 76,
"alpha_frac": 0.5968652038,
"autogenerated": false,
"ratio": 4.346049046321526,
"config_... |
""" A class representation of all possible input types """
import logging
from os import linesep
from xml.sax.saxutils import quoteattr
# Initialize logger for this module
logger = logging.getLogger(__name__)
class Base:
def __init__(self, name, parent, wsdl_type, update_parent=True):
self... | {
"repo_name": "qmuloadmin/soapy",
"path": "soapy/inputs.py",
"copies": "1",
"size": "17856",
"license": "bsd-3-clause",
"hash": 3534931422227848700,
"line_mean": 37.1578947368,
"line_max": 117,
"alpha_frac": 0.5624439964,
"autogenerated": false,
"ratio": 4.592592592592593,
"config_test": false,... |
"""A class representing a microbial or tissue community."""
import re
import six
import six.moves.cPickle as pickle
import cobra
import pandas as pd
from sympy.core.singleton import S
from tqdm import tqdm
from micom.util import load_model, join_models, add_var_from_expression
from micom.logger import logger
from mico... | {
"repo_name": "cdiener/micom",
"path": "micom/community.py",
"copies": "1",
"size": "19333",
"license": "apache-2.0",
"hash": -1029667247200642300,
"line_mean": 38.944214876,
"line_max": 79,
"alpha_frac": 0.5881135882,
"autogenerated": false,
"ratio": 4.43519155769672,
"config_test": false,
"... |
"""A class representing a processing job: for one sample and one sample-to-detector distance"""
import time
import traceback
from datetime import datetime
from multiprocessing.queues import Queue
from multiprocessing.synchronize import Lock, Event
from typing import List, Optional, Any
import h5py
import numpy as np
f... | {
"repo_name": "awacha/cct",
"path": "cct/core/processing/processingjob.py",
"copies": "1",
"size": "20066",
"license": "bsd-3-clause",
"hash": 6661031751666146000,
"line_mean": 49.9289340102,
"line_max": 120,
"alpha_frac": 0.5656832453,
"autogenerated": false,
"ratio": 3.9593528018942385,
"conf... |
"A class representing individuals"
from pydigree.recombination import recombine
from pydigree.paths import kinship
from pydigree.common import flatten
from pydigree.genotypes import LabelledAlleles
from pydigree.exceptions import IterationError
from pydigree.phenotypes import Phenotypes
# TODO: Move this somewhere mo... | {
"repo_name": "jameshicks/pydigree",
"path": "pydigree/individual.py",
"copies": "1",
"size": "15424",
"license": "apache-2.0",
"hash": 4499481781320710000,
"line_mean": 32.1698924731,
"line_max": 79,
"alpha_frac": 0.5844139004,
"autogenerated": false,
"ratio": 4.155172413793103,
"config_test":... |
# A class representing the contents of /etc/network/interfaces
from debinterface.interfacesWriter import InterfacesWriter
from debinterface.interfacesReader import InterfacesReader
from debinterface.adapter import NetworkAdapter
import debinterface.toolutils as toolutils
class Interfaces:
_interfaces_path = '/etc... | {
"repo_name": "michaelboulton/debinterface",
"path": "debinterface/interfaces.py",
"copies": "1",
"size": "3276",
"license": "bsd-3-clause",
"hash": -1405889030419315000,
"line_mean": 29.9056603774,
"line_max": 78,
"alpha_frac": 0.5992063492,
"autogenerated": false,
"ratio": 4.55,
"config_test"... |
# A class representing the contents of /etc/network/interfaces
from interfacesWriter import InterfacesWriter
from interfacesReader import InterfacesReader
from adapter import NetworkAdapter
import toolutils
#import defaults
class Interfaces:
_interfaces_path = '/etc/network/interfaces'
def __init__(self, upd... | {
"repo_name": "le9i0nx/debinterface",
"path": "interfaces.py",
"copies": "1",
"size": "3325",
"license": "bsd-3-clause",
"hash": -5387718861210518000,
"line_mean": 30.6666666667,
"line_max": 89,
"alpha_frac": 0.6216541353,
"autogenerated": false,
"ratio": 4.386543535620053,
"config_test": false... |
# A class representing the contents of /etc/network/interfaces
from adapter import NetworkAdapter
import StringIO
class InterfacesReader:
''' Short lived class to read interfaces file '''
def __init__(self, interfaces_path):
self._interfaces_path = interfaces_path
self._reset()
@propert... | {
"repo_name": "dggreenbaum/debinterface",
"path": "interfacesReader.py",
"copies": "4",
"size": "5241",
"license": "bsd-3-clause",
"hash": 3795905094307924000,
"line_mean": 35.6503496503,
"line_max": 107,
"alpha_frac": 0.532150353,
"autogenerated": false,
"ratio": 4.206260032102729,
"config_tes... |
"""A class that can be used to represent a car."""
"""A set of classes used to represent gas and electric cars."""
class Car():
"""A simple attempt to represent a car."""
def __init__(self, make, model, year):
"""Initialize attributes to describe a car."""
self.make = make
self.model =... | {
"repo_name": "mccarrion/python-practice",
"path": "crash_course/chapter09/car.py",
"copies": "1",
"size": "2929",
"license": "mit",
"hash": -7059992858041922000,
"line_mean": 30.4946236559,
"line_max": 77,
"alpha_frac": 0.6111300785,
"autogenerated": false,
"ratio": 3.478622327790974,
"config_... |
"""A class that can be used to represent a car."""
class Car():
"""A simple attempt to represent a car."""
def __init__(self, manufacturer, model, year):
"""Initialize attributes to describe a car."""
self.manufacturer = manufacturer
self.model = model
self.year = year... | {
"repo_name": "lluxury/pcc_exercise",
"path": "09/car.py",
"copies": "1",
"size": "1263",
"license": "mit",
"hash": 5306594851964954000,
"line_mean": 35.1470588235,
"line_max": 79,
"alpha_frac": 0.5756136184,
"autogenerated": false,
"ratio": 4.087378640776699,
"config_test": false,
"has_no_ke... |
""" A class that can provide a date/time in any timeformat.format() format and both
local and UTC timezones within a ContextVariable.
Copyright (c) 2004 Colin Stewart (http://www.owlfish.com/)
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted pr... | {
"repo_name": "owlfish/pubtal",
"path": "lib/pubtal/DateContext.py",
"copies": "1",
"size": "3035",
"license": "bsd-3-clause",
"hash": 4333515682096000500,
"line_mean": 37.9102564103,
"line_max": 93,
"alpha_frac": 0.7291598023,
"autogenerated": false,
"ratio": 3.78428927680798,
"config_test": f... |
'''A class that checks connections'''
import time
import threading
from . import logger
class StoppableThread(threading.Thread):
'''A thread that may be stopped'''
def __init__(self):
threading.Thread.__init__(self)
self._event = threading.Event()
def wait(self, timeout):
'''Wait... | {
"repo_name": "dlecocq/nsq-py",
"path": "nsq/checker.py",
"copies": "1",
"size": "1791",
"license": "mit",
"hash": -7491734606844129000,
"line_mean": 29.8793103448,
"line_max": 78,
"alpha_frac": 0.6058068118,
"autogenerated": false,
"ratio": 4.378973105134475,
"config_test": false,
"has_no_ke... |
'''A class that listens to pubsub channels and can unlisten'''
import logging
import threading
import contextlib
# Our logger
logger = logging.getLogger('qless')
class Listener(object):
'''A class that listens to pubsub channels and can unlisten'''
def __init__(self, redis, channels):
self._pubsub =... | {
"repo_name": "seomoz/qless-py",
"path": "qless/listener.py",
"copies": "1",
"size": "2225",
"license": "mit",
"hash": -6098407002178100000,
"line_mean": 28.6666666667,
"line_max": 75,
"alpha_frac": 0.566741573,
"autogenerated": false,
"ratio": 4.303675048355899,
"config_test": false,
"has_no... |
"""A class that performs HTTP-01 challenges for Apache"""
import logging
import os
from acme.magic_typing import List, Set # pylint: disable=unused-import, no-name-in-module
from certbot import errors
from certbot.plugins import common
from certbot_apache.obj import VirtualHost # pylint: disable=unused-import
from c... | {
"repo_name": "letsencrypt/letsencrypt",
"path": "certbot-apache/certbot_apache/http_01.py",
"copies": "1",
"size": "7968",
"license": "apache-2.0",
"hash": -7423766223547613000,
"line_mean": 37.4927536232,
"line_max": 91,
"alpha_frac": 0.6066767068,
"autogenerated": false,
"ratio": 3.93093241243... |
"""A class that performs TLS-SNI-01 challenges for Apache"""
import os
import logging
from certbot.plugins import common
from certbot.errors import PluginError, MissingCommandlineFlag
from certbot_apache import obj
from certbot_apache import parser
logger = logging.getLogger(__name__)
class ApacheTlsSni01(common.... | {
"repo_name": "dietsche/letsencrypt",
"path": "certbot-apache/certbot_apache/tls_sni_01.py",
"copies": "1",
"size": "6683",
"license": "apache-2.0",
"hash": 3285832167967193000,
"line_mean": 34.1736842105,
"line_max": 79,
"alpha_frac": 0.6319018405,
"autogenerated": false,
"ratio": 3.997009569377... |
"""A class that performs TLS-SNI-01 challenges for Apache"""
import os
import logging
from letsencrypt.plugins import common
from letsencrypt_apache import obj
from letsencrypt_apache import parser
logger = logging.getLogger(__name__)
class ApacheTlsSni01(common.TLSSNI01):
"""Class that performs TLS-SNI-01 ch... | {
"repo_name": "thanatos/lets-encrypt-preview",
"path": "letsencrypt-apache/letsencrypt_apache/tls_sni_01.py",
"copies": "1",
"size": "6210",
"license": "apache-2.0",
"hash": -4839916551796540000,
"line_mean": 33.5,
"line_max": 80,
"alpha_frac": 0.6325281804,
"autogenerated": false,
"ratio": 3.965... |
# A class that takes a single image, applies affine transformations, and renders it
# (and possibly a pixel-mask to tell which pixels are coming from the image)
# The class will only load the image when the render function is called (lazy evaluation)
import cv2
import numpy as np
import math
class SingleTileAffineRend... | {
"repo_name": "Rhoana/rh_aligner",
"path": "old/renderer/single_tile_affine_renderer.py",
"copies": "1",
"size": "12335",
"license": "mit",
"hash": -9041177022771855000,
"line_mean": 53.5796460177,
"line_max": 213,
"alpha_frac": 0.6112687475,
"autogenerated": false,
"ratio": 3.55988455988456,
"... |
# A class that takes a single image, applies transformations (both affine and non-affine), and renders it
# (and possibly a pixel-mask to tell which pixels are coming from the image).
# Assumption: there is only one non-affine transformation. TODO - get rid of this assumption
# The class will only load the image when t... | {
"repo_name": "Rhoana/rh_aligner",
"path": "old/renderer/single_tile_renderer.py",
"copies": "1",
"size": "20035",
"license": "mit",
"hash": 347611344933902900,
"line_mean": 55.1204481793,
"line_max": 208,
"alpha_frac": 0.6209134015,
"autogenerated": false,
"ratio": 3.535380271748721,
"config_t... |
"""A class to aid in generating random numbers and sequences
It doesn't seem necessary to create an options class since this class will probably not be extended
"""
import random, sys
nts = ['A','C','G','T']
hexchars = '0123456789abcdef'
uuid4special = '89ab'
class RandomSource:
"""You can asign it a seed if you... | {
"repo_name": "jason-weirather/py-seq-tools",
"path": "seqtools/simulation/randomsource.py",
"copies": "1",
"size": "3309",
"license": "apache-2.0",
"hash": 818378733695486200,
"line_mean": 29.6388888889,
"line_max": 181,
"alpha_frac": 0.6424901783,
"autogenerated": false,
"ratio": 3.531483457844... |
"""A class to build directory diff tools on."""
import os
import dircache
import cmpcache
import statcache
from stat import *
class dircmp:
"""Directory comparison class."""
def new(self, a, b):
"""Initialize."""
self.a = a
self.b = b
# Properties that caller may change befor... | {
"repo_name": "MalloyPower/parsing-python",
"path": "front-end/testsuite-python-lib/Python-2.0/Lib/lib-old/dircmp.py",
"copies": "4",
"size": "6029",
"license": "mit",
"hash": 1277190448387764000,
"line_mean": 28.9950248756,
"line_max": 72,
"alpha_frac": 0.5345828496,
"autogenerated": false,
"rat... |
""" A class to convert a corpus of PREPROCESSED documents into the Vector Space representation """
from collections import defaultdict
import TermParamsClass
import math
class VectorSpace:
N = 10 #Total number of documents in the corpus
@staticmethod
def computeInverseDocFreq(numDocsWithTerm, numDocsTotal):
... | {
"repo_name": "aiyyoi/ADB-Project-1",
"path": "VectorSpaceClass.py",
"copies": "1",
"size": "3212",
"license": "mit",
"hash": -3504086218558458000,
"line_mean": 32.8105263158,
"line_max": 105,
"alpha_frac": 0.6706102117,
"autogenerated": false,
"ratio": 3.121477162293489,
"config_test": false,
... |
"""A class to crawl webpages."""
from __future__ import absolute_import, print_function
import sys
import lxml.html as lh
from .orderedset import OrderedSet
from . import utils
class Crawler(object):
"""Follows and saves webpages to PART.html files."""
def __init__(self, args, seed_url=None):
"""S... | {
"repo_name": "huntrar/scrape",
"path": "scrape/crawler.py",
"copies": "1",
"size": "3963",
"license": "mit",
"hash": -6758113123482355000,
"line_mean": 35.6944444444,
"line_max": 84,
"alpha_frac": 0.5591723442,
"autogenerated": false,
"ratio": 3.9511465603190428,
"config_test": false,
"has_n... |
# A class to describe a Star shape.
class Star(object):
def __init__(self):
self.x = random(100, width - 100)
self.y = random(100, height - 100)
self.speed = random(0.5, 3)
# First create the shape.
self.s = createShape()
self.s.beginShape()
# You can set fil... | {
"repo_name": "kantel/processingpy",
"path": "sketches/modes/PythonMode/examples/Topics/Create Shapes/PolygonPShapeOOP/star.py",
"copies": "6",
"size": "1126",
"license": "mit",
"hash": 6250003606796715000,
"line_mean": 27.8717948718,
"line_max": 55,
"alpha_frac": 0.526642984,
"autogenerated": fals... |
"""A class to download NAIP imagery from the s3://aws-naip RequesterPays bucket."""
import boto3
import os
import subprocess
import sys
import time
from random import shuffle
from src.config import cache_paths, create_cache_directories, NAIP_DATA_DIR, LABELS_DATA_DIR
class NAIPDownloader:
"""Downloads NAIP image... | {
"repo_name": "trailbehind/DeepOSM",
"path": "src/naip_images.py",
"copies": "2",
"size": "5282",
"license": "mit",
"hash": 3308869800225673700,
"line_mean": 37.2753623188,
"line_max": 99,
"alpha_frac": 0.5556607346,
"autogenerated": false,
"ratio": 3.7647897362794014,
"config_test": false,
"... |
"""A class to generate plots for the results of applied loss functions and/or
accuracy of models trained with machine learning methods.
Example:
plotter = LossAccPlotter()
for epoch in range(100):
loss_train, acc_train = your_model.train()
loss_val, acc_val = your_model.validate()
plott... | {
"repo_name": "XinDongol/warehouse",
"path": "draw/LossAccPlotter/laplotter.py",
"copies": "3",
"size": "26025",
"license": "mit",
"hash": 4886162902124814000,
"line_mean": 41.3859934853,
"line_max": 92,
"alpha_frac": 0.5576176753,
"autogenerated": false,
"ratio": 3.950964020039472,
"config_tes... |
# a class to hold a formula and all the parameter settings which go with it
import copy
import math
import random
import re
import StringIO
import weakref
import fracttypes
import gradient
import image
# matches a complex number
cmplx_re = re.compile(r'\((.*?),(.*?)\)')
# matches a hypercomplex number
hyper_re = re.... | {
"repo_name": "ericchill/gnofract4d",
"path": "fract4d/formsettings.py",
"copies": "1",
"size": "12216",
"license": "bsd-3-clause",
"hash": 8672380856605546000,
"line_mean": 33.4112676056,
"line_max": 82,
"alpha_frac": 0.5180091683,
"autogenerated": false,
"ratio": 3.777365491651206,
"config_te... |
"""A class to hold entity values."""
from collections import OrderedDict
import fnmatch
import re
from typing import Any, Dict, Optional, Pattern
from homeassistant.core import split_entity_id
# mypy: disallow-any-generics
class EntityValues:
"""Class to store entity id based values."""
def __init__(
... | {
"repo_name": "partofthething/home-assistant",
"path": "homeassistant/helpers/entity_values.py",
"copies": "3",
"size": "1660",
"license": "mit",
"hash": 8207015178582773000,
"line_mean": 29.7407407407,
"line_max": 68,
"alpha_frac": 0.5831325301,
"autogenerated": false,
"ratio": 4.058679706601467... |
"""A class to hold entity values."""
from collections import OrderedDict
import fnmatch
import re
from typing import Any, Dict, Optional, Pattern
from homeassistant.core import split_entity_id
class EntityValues:
"""Class to store entity id based values."""
def __init__(
self,
exact: Optiona... | {
"repo_name": "qedi-r/home-assistant",
"path": "homeassistant/helpers/entity_values.py",
"copies": "19",
"size": "1546",
"license": "apache-2.0",
"hash": 664552293114965900,
"line_mean": 28.7307692308,
"line_max": 68,
"alpha_frac": 0.5782664942,
"autogenerated": false,
"ratio": 4.247252747252747,... |
"""A class to hold entity values."""
from collections import OrderedDict
import fnmatch
import re
from typing import Any, Dict, Optional, Pattern # noqa: F401
from homeassistant.core import split_entity_id
class EntityValues:
"""Class to store entity id based values."""
def __init__(
self,
... | {
"repo_name": "fbradyirl/home-assistant",
"path": "homeassistant/helpers/entity_values.py",
"copies": "1",
"size": "1576",
"license": "apache-2.0",
"hash": 5771701921764271000,
"line_mean": 29.3076923077,
"line_max": 70,
"alpha_frac": 0.5774111675,
"autogenerated": false,
"ratio": 4.1914893617021... |
"""A class to hold entity values."""
from collections import OrderedDict
import fnmatch
import re
from typing import Dict
from homeassistant.core import split_entity_id
class EntityValues:
"""Class to store entity id based values."""
def __init__(self, exact: Dict = None, domain: Dict = None,
... | {
"repo_name": "Danielhiversen/home-assistant",
"path": "homeassistant/helpers/entity_values.py",
"copies": "3",
"size": "1405",
"license": "mit",
"hash": 8192409149731231000,
"line_mean": 28.2708333333,
"line_max": 68,
"alpha_frac": 0.5758007117,
"autogenerated": false,
"ratio": 4.376947040498442... |
"""A class to hold entity values."""
from collections import OrderedDict
import fnmatch
import re
from homeassistant.core import split_entity_id
class EntityValues(object):
"""Class to store entity id based values."""
def __init__(self, exact=None, domain=None, glob=None):
"""Initialize an EntityCon... | {
"repo_name": "MungoRae/home-assistant",
"path": "homeassistant/helpers/entity_values.py",
"copies": "28",
"size": "1340",
"license": "apache-2.0",
"hash": 7295884759394458000,
"line_mean": 28.1304347826,
"line_max": 68,
"alpha_frac": 0.5813432836,
"autogenerated": false,
"ratio": 4.3506493506493... |
"""A class to hold entity values."""
from __future__ import annotations
from collections import OrderedDict
import fnmatch
import re
from typing import Any
from homeassistant.core import split_entity_id
# mypy: disallow-any-generics
class EntityValues:
"""Class to store entity id based values."""
def __in... | {
"repo_name": "kennedyshead/home-assistant",
"path": "homeassistant/helpers/entity_values.py",
"copies": "2",
"size": "1662",
"license": "apache-2.0",
"hash": 7268175306500996000,
"line_mean": 28.6785714286,
"line_max": 68,
"alpha_frac": 0.578820698,
"autogenerated": false,
"ratio": 4.02421307506... |
"""A class to hold entity values."""
from __future__ import annotations
from collections import OrderedDict
import fnmatch
import re
from typing import Any, Pattern
from homeassistant.core import split_entity_id
# mypy: disallow-any-generics
class EntityValues:
"""Class to store entity id based values."""
... | {
"repo_name": "sander76/home-assistant",
"path": "homeassistant/helpers/entity_values.py",
"copies": "3",
"size": "1668",
"license": "apache-2.0",
"hash": 1140993966264533000,
"line_mean": 28.7857142857,
"line_max": 68,
"alpha_frac": 0.579736211,
"autogenerated": false,
"ratio": 4.038740920096853... |
"""A class to hold the data about scoring taxids and NC ids."""
import sys
import taxon
class scoring:
"""
We use this class to score a pair of IDs. We can handle taxonomy IDs
and NC_\d+ IDs (i.e. from genbank).
"""
def __init__(self):
sys.stderr.write("Parsing the taxonomy files\n")
... | {
"repo_name": "linsalrob/PhageHosts",
"path": "code/scoring.py",
"copies": "1",
"size": "4070",
"license": "mit",
"hash": -2891458303786684000,
"line_mean": 35.017699115,
"line_max": 95,
"alpha_frac": 0.5461916462,
"autogenerated": false,
"ratio": 3.4726962457337884,
"config_test": false,
"ha... |
# a class to manage SRTM surfaces
import json
import numpy as np
import os
from pylab import *
import random
import scipy.interpolate
import struct
import urllib.request
import zipfile
import navpy
from .logger import log
# return the lower left corner of the 1x1 degree tile containing
# the specified lla coordinat... | {
"repo_name": "UASLab/ImageAnalysis",
"path": "scripts/lib/srtm.py",
"copies": "1",
"size": "11147",
"license": "mit",
"hash": 5376634110165213000,
"line_mean": 34.2753164557,
"line_max": 124,
"alpha_frac": 0.5624831793,
"autogenerated": false,
"ratio": 3.053972602739726,
"config_test": false,
... |
"""A class to provide the flot plotting utility in an ipython notebook
This class provides utilities to plot data in an ipython notebook using
the flot http://code.google.com/p/flot/ javascript plotting library. It
has the class plot which must be instantiated as an object. Once this is
instantiated the plot_figure m... | {
"repo_name": "mlhenderson/narrative",
"path": "src/MG-RAST_ipy-mkmq/ipyMKMQ/flotplot.py",
"copies": "7",
"size": "7906",
"license": "mit",
"hash": -4500349992348054000,
"line_mean": 47.5030674847,
"line_max": 190,
"alpha_frac": 0.4798886921,
"autogenerated": false,
"ratio": 4.035732516590097,
... |
# A class to represent a list of ipfw rules and tables
import os.path
from subprocess import Popen, PIPE
import builtins
import glob
from includes.output import *
from includes.util import *
from includes.defines import *
class IPFW:
# Constructor
def __init__(self, directory, uuid = None):
self.... | {
"repo_name": "vuid-com/tredly",
"path": "components/tredly-libs/python-common/objects/firewall/ipfw.py",
"copies": "2",
"size": "11251",
"license": "mit",
"hash": 8125513311521402000,
"line_mean": 38.7597173145,
"line_max": 178,
"alpha_frac": 0.5172873522,
"autogenerated": false,
"ratio": 4.5440... |
# A class to represent a network interface
import random
class NetInterface:
# Constructor
def __init__(self, name = None, mac = None):
self.name = name
self.mac = mac
self.ip4Addrs = []
self.ip6Addrs = []
# Action: Generate a mac address for this interface
#
... | {
"repo_name": "vuid-com/tredly",
"path": "components/tredly-libs/python-common/objects/ip4/netinterface.py",
"copies": "2",
"size": "1063",
"license": "mit",
"hash": -5257381930515646000,
"line_mean": 33.3225806452,
"line_max": 156,
"alpha_frac": 0.57855127,
"autogenerated": false,
"ratio": 3.508... |
# A class to represent an layer 4 proxy file
import os.path
import re
from subprocess import Popen, PIPE
class Layer4ProxyFile:
# Constructor
def __init__(self, filePath):
self.filePath = filePath
self.preamble = ''
self.lines = []
# Action: reads layer 4 proxy file, and stores pa... | {
"repo_name": "vuid-com/tredly",
"path": "components/tredly-libs/python-common/objects/layer4proxy/layer4proxyfile.py",
"copies": "2",
"size": "6613",
"license": "mit",
"hash": 7777041940517652000,
"line_mean": 32.404040404,
"line_max": 179,
"alpha_frac": 0.5121729926,
"autogenerated": false,
"ra... |
# A class to represent an Unbound File
import os.path
import re
from subprocess import Popen, PIPE
class UnboundFile:
# Constructor
def __init__(self, filePath):
self.filePath = filePath
self.lines = []
# Action: reads unbound file, and stores parsed lines to self
#
# Pre:
# Po... | {
"repo_name": "vuid-com/tredly",
"path": "components/tredly-libs/python-common/objects/tredly/unboundfile.py",
"copies": "2",
"size": "4957",
"license": "mit",
"hash": 352944071771337150,
"line_mean": 32.2751677852,
"line_max": 153,
"alpha_frac": 0.4960661691,
"autogenerated": false,
"ratio": 4.3... |
# A class to represent an Unbound File
import os.path
import re
class ResolvConfFile:
# Constructor
def __init__(self, filePath = '/etc/resolv.conf', search = [], servers = []):
self.filePath = filePath
self.search = search
self.nameservers = servers
# Action: reads resolv.conf... | {
"repo_name": "vuid-com/tredly",
"path": "components/tredly-libs/python-common/objects/tredly/resolvconffile.py",
"copies": "2",
"size": "3121",
"license": "mit",
"hash": -1755437721273979000,
"line_mean": 33.3076923077,
"line_max": 83,
"alpha_frac": 0.5081704582,
"autogenerated": false,
"ratio":... |
# A class to represent a sweep of frames collected under the same conditions.
# This pertains to the dataset object in the early phases of processing.
import os
from xia2.Experts.FindImages import find_matching_images
from xia2.Handlers.Phil import PhilIndex
def SweepFactory(template, directory, beam=None):
""... | {
"repo_name": "xia2/xia2",
"path": "src/xia2/Schema/Sweep.py",
"copies": "1",
"size": "4340",
"license": "bsd-3-clause",
"hash": -4535391322729451000,
"line_mean": 28.5238095238,
"line_max": 88,
"alpha_frac": 0.583640553,
"autogenerated": false,
"ratio": 4.165067178502879,
"config_test": false,... |
# A class to represent a tredly partition
import os
import shutil
from objects.tidycmd.tidycmd import *
from includes.util import *
from includes.defines import *
from includes.output import *
from objects.tredly.container import *
class Partition:
# Constructor
def __init__(self, name, maxHdd = None, maxCpu... | {
"repo_name": "tredly/tredly",
"path": "components/tredly-libs/python-common/objects/tredly/partition.py",
"copies": "2",
"size": "5577",
"license": "mit",
"hash": 13385306043224484,
"line_mean": 31.6140350877,
"line_max": 152,
"alpha_frac": 0.5892056661,
"autogenerated": false,
"ratio": 4.020908... |
# A class to retrieve data from a tredly host
from subprocess import Popen, PIPE
import re
import builtins
from includes.util import *
from includes.defines import *
from includes.output import *
from objects.nginx.nginxblock import *
class Layer7Proxy:
# Constructor
#def __init__(self):
# Action: r... | {
"repo_name": "tredly/tredly",
"path": "components/tredly-libs/python-common/objects/nginx/layer7proxy.py",
"copies": "2",
"size": "12548",
"license": "mit",
"hash": -8614164896421857000,
"line_mean": 42.5729166667,
"line_max": 161,
"alpha_frac": 0.5998565508,
"autogenerated": false,
"ratio": 4.3... |
# A class to retrieve data from a tredly host
from subprocess import Popen, PIPE
import re
from objects.tidycmd.tidycmd import *
from includes.util import *
from includes.defines import *
from includes.output import *
class TredlyHost:
# Action: return a list of partition names on this host
#
# Pre:
... | {
"repo_name": "tredly/tredly",
"path": "components/tredly-libs/python-common/objects/tredly/tredlyhost.py",
"copies": "2",
"size": "14413",
"license": "mit",
"hash": -4128565464779281000,
"line_mean": 34.239608802,
"line_max": 127,
"alpha_frac": 0.5979324221,
"autogenerated": false,
"ratio": 4.11... |
'''A class to store estimators once retrieved from the database.
'''
import numpy as np
import os
from itertools import izip
from dmrg_helpers.extract.estimator_site import EstimatorSite
from dmrg_helpers.view.xy_data import XYDataDict
class EstimatorData(object):
"""An auxiliary class to hold the numerical data f... | {
"repo_name": "iglpdc/dmrg_helpers",
"path": "dmrg_helpers/extract/estimator.py",
"copies": "1",
"size": "5864",
"license": "mit",
"hash": 1314680287810832000,
"line_mean": 36.5897435897,
"line_max": 80,
"alpha_frac": 0.6348908595,
"autogenerated": false,
"ratio": 4.197566213314245,
"config_tes... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.