text stringlengths 0 1.05M | meta dict |
|---|---|
## An implementation of the credential scheme based on an algebraic
## MAC proposed by Chase, Meiklejohn and Zaverucha in Algebraic MACs and Keyed-Verification
## Anonymous Credentials", at ACM CCS 2014. The credentials scheme
## is based on the GGM based aMAC. (see section 4.2, pages 8-9)
from amacs import *
from ge... | {
"repo_name": "moullos/UnlimitID",
"path": "UnlimitID/IdP/amacscreds/amacscreds.py",
"copies": "3",
"size": "20237",
"license": "bsd-2-clause",
"hash": -3776869563205313500,
"line_mean": 27.3828892006,
"line_max": 112,
"alpha_frac": 0.5888718684,
"autogenerated": false,
"ratio": 2.852692416126304... |
"""An implementation of the CYK algorithm.
The CYK algorithm was chosen because the Google
docstring format allows for ambiguous representations,
which CYK can handle without devolving into a terrible
complexity. (It has a worst case of O(n^3).
There are faster, on average, algorithms, which might
be better suited to... | {
"repo_name": "terrencepreilly/darglint",
"path": "darglint/parse/cyk.py",
"copies": "1",
"size": "2961",
"license": "mit",
"hash": 7560341049837262000,
"line_mean": 33.4302325581,
"line_max": 79,
"alpha_frac": 0.4981425194,
"autogenerated": false,
"ratio": 4.2727272727272725,
"config_test": fa... |
"""An implementation of the Finite State Machine.
This module can be used to build and describe finite-state automata.
Author: Slawek Ligus <root@ooz.ie>
Overview of classes:
State -- a class representing a state which can be used in a finite state
machine of any type.
FiniteStateMachine -- a s... | {
"repo_name": "lnerit/ktailFSM",
"path": "build/lib.linux-x86_64-2.7/fsm.py",
"copies": "1",
"size": "8758",
"license": "bsd-3-clause",
"hash": 875990444219504800,
"line_mean": 30.6173285199,
"line_max": 80,
"alpha_frac": 0.5926010505,
"autogenerated": false,
"ratio": 4.100187265917603,
"config... |
# An implementation of the greedy algorithm for decomposing a fraction into an
# Egyptian fraction (a sum of distinct unit fractions). Egyptian fractions
# are a representation of fractions that dates back at least 3500 years (the
# Rhind Mathematical Papyrus contains a table of fractions written out this
# way). A n... | {
"repo_name": "saisankargochhayat/algo_quest",
"path": "greedy/egyptian_fraction.py",
"copies": "1",
"size": "2562",
"license": "apache-2.0",
"hash": 2052203973146058500,
"line_mean": 34.5833333333,
"line_max": 79,
"alpha_frac": 0.643637783,
"autogenerated": false,
"ratio": 3.5632823365785815,
... |
# An implementation of the Indexer interface using XDS. This depends on the
# XDS wrappers to actually implement the functionality.
import logging
import os
import math
import shutil
from cctbx.array_family import flex
from scitbx import matrix
# wrappers for programs that this needs
from xia2.Wrappers.XDS.XDSXyco... | {
"repo_name": "xia2/xia2",
"path": "src/xia2/Modules/Indexer/XDSIndexer.py",
"copies": "1",
"size": "26100",
"license": "bsd-3-clause",
"hash": -6747512125613562000,
"line_mean": 35.4016736402,
"line_max": 88,
"alpha_frac": 0.554559387,
"autogenerated": false,
"ratio": 3.836542701749228,
"confi... |
# An implementation of the Integrater interface using Dials. This depends on the
# Dials wrappers to actually implement the functionality.
import logging
import math
import os
import xia2.Wrappers.Dials.Integrate
from dxtbx.serialize import load
from xia2.Handlers.Citations import Citations
from xia2.Handlers.Files ... | {
"repo_name": "xia2/xia2",
"path": "src/xia2/Modules/Integrater/DialsIntegrater.py",
"copies": "1",
"size": "24379",
"license": "bsd-3-clause",
"hash": -1982380141785672400,
"line_mean": 37.0921875,
"line_max": 88,
"alpha_frac": 0.5848065958,
"autogenerated": false,
"ratio": 3.931462667311724,
... |
# An implementation of the Integrater interface using XDS. This depends on the
# XDS wrappers to actually implement the functionality.
#
# This will "wrap" the XDS programs DEFPIX and INTEGRATE - CORRECT is
# considered to be a part of the scaling - see XDSScaler.py.
import copy
import inspect
import logging
import m... | {
"repo_name": "xia2/xia2",
"path": "src/xia2/Modules/Integrater/XDSIntegrater.py",
"copies": "1",
"size": "33839",
"license": "bsd-3-clause",
"hash": 1583534125715426800,
"line_mean": 35.8215451578,
"line_max": 88,
"alpha_frac": 0.5706137888,
"autogenerated": false,
"ratio": 3.7804714557032733,
... |
from distutils.core import setup
setup(
name='pyld-signatures',
version='0.1dev',
packages=['pyld_sig',],
license='License :: OSI Approved :: BSD License',
author='Spec-Ops',
install_requires=[
"cryptography",
"isodate",
"pyld",
"pytz",
"pytest",
],... | {
"repo_name": "Spec-Ops/pyld-signatures",
"path": "setup.py",
"copies": "1",
"size": "2021",
"license": "bsd-3-clause",
"hash": 7780679977858535000,
"line_mean": 39.42,
"line_max": 78,
"alpha_frac": 0.7377535873,
"autogenerated": false,
"ratio": 4.4126637554585155,
"config_test": false,
"has_... |
import base64
import copy
import json
import isodate
from datetime import datetime
from pyld import jsonld
import pytz
from cryptography.hazmat.primitives import serialization
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives import hashes
from cryptography.hazmat.primitives... | {
"repo_name": "Spec-Ops/pyld-signatures",
"path": "pyld_sig/__init__.py",
"copies": "1",
"size": "28940",
"license": "bsd-3-clause",
"hash": -3593398744881655300,
"line_mean": 37.535286285,
"line_max": 80,
"alpha_frac": 0.6350034554,
"autogenerated": false,
"ratio": 3.816934845687154,
"config_t... |
# An implementation of the Longest Common Subsequence Problem
# Takes two command line arguments, the two subsequences and prints out the
# longest common subsequence and its size
from copy import deepcopy
import sys
def lcs (prev, current, a, b):
rows, columns = len(a), len(b)
print(columns, rows)
print(... | {
"repo_name": "pybae/etc",
"path": "Algorithms/lcs.py",
"copies": "1",
"size": "1204",
"license": "mit",
"hash": 2470287357003485700,
"line_mean": 35.4848484848,
"line_max": 75,
"alpha_frac": 0.6411960133,
"autogenerated": false,
"ratio": 3.4597701149425286,
"config_test": false,
"has_no_keyw... |
"""An implementation of the model from:
Model-based dissection of CD95 signaling dynamics reveals both a pro- and
antiapoptotic role of c-FLIPL. Fricker N, Beaudouin J, Richter P, Eils R,
Krammer PH, Lavrik IN. J Cell Biol. 2010 Aug 9;190(3):377-89.
doi:10.1083/jcb.201002060
http://jcb.rupress.org/content/190/3/377.... | {
"repo_name": "pysb/pysb",
"path": "pysb/examples/fricker_2010_apoptosis.py",
"copies": "5",
"size": "10795",
"license": "bsd-2-clause",
"hash": -4203956628892056000,
"line_mean": 44.1673640167,
"line_max": 176,
"alpha_frac": 0.6638258453,
"autogenerated": false,
"ratio": 2.2057621577441764,
"c... |
"""An implementation of the OpenID Provider Authentication Policy
Extension 1.0, Draft 5
@see: http://openid.net/developers/specs/
@since: 2.1.0
"""
from __future__ import unicode_literals
import re
import warnings
import six
from openid.extension import Extension
__all__ = [
'Request',
'Response',
'n... | {
"repo_name": "openid/python-openid",
"path": "openid/extensions/pape.py",
"copies": "1",
"size": "16350",
"license": "apache-2.0",
"hash": 5797540045245743000,
"line_mean": 33.2767295597,
"line_max": 117,
"alpha_frac": 0.5927828746,
"autogenerated": false,
"ratio": 4.2074112197632525,
"config_... |
"""An implementation of the OpenID Provider Authentication Policy
Extension 1.0, Draft 5
@see: http://openid.net/developers/specs/
@since: 2.1.0
"""
__all__ = [
'Request',
'Response',
'ns_uri',
'AUTH_PHISHING_RESISTANT',
'AUTH_MULTI_FACTOR',
'AUTH_MULTI_FACTOR_PHYSICAL',
'LEVELS_NIST',
... | {
"repo_name": "ddayguerrero/blogme",
"path": "flask/lib/python3.4/site-packages/openid/extensions/draft/pape5.py",
"copies": "12",
"size": "16494",
"license": "mit",
"hash": -5452355694426009000,
"line_mean": 33.5786163522,
"line_max": 111,
"alpha_frac": 0.5906390202,
"autogenerated": false,
"rat... |
"""An implementation of the OpenID Provider Authentication Policy
Extension 1.0
@see: http://openid.net/developers/specs/
@since: 2.1.0
"""
from __future__ import unicode_literals
import re
import warnings
import six
from openid.extension import Extension
__all__ = [
'Request',
'Response',
'ns_uri',
... | {
"repo_name": "openid/python-openid",
"path": "openid/extensions/draft/pape2.py",
"copies": "1",
"size": "9517",
"license": "apache-2.0",
"hash": 8009195472549468000,
"line_mean": 32.1602787456,
"line_max": 111,
"alpha_frac": 0.6130083009,
"autogenerated": false,
"ratio": 4.143230300391815,
"co... |
"""An implementation of the OpenID Provider Authentication Policy
Extension 1.0
@see: http://openid.net/developers/specs/
@since: 2.1.0
"""
__all__ = [
'Request',
'Response',
'ns_uri',
'AUTH_PHISHING_RESISTANT',
'AUTH_MULTI_FACTOR',
'AUTH_MULTI_FACTOR_PHYSICAL',
]
from openid.extension i... | {
"repo_name": "bbozhev/flask-test",
"path": "flask/lib/python2.7/site-packages/openid/extensions/draft/pape2.py",
"copies": "12",
"size": "9469",
"license": "mit",
"hash": -9045294505862824000,
"line_mean": 32.6975088968,
"line_max": 111,
"alpha_frac": 0.6076671243,
"autogenerated": false,
"ratio... |
""" An implementation of the paper "A Neural Algorithm of Artistic Style"
by Gatys et al. in TensorFlow.
Author: Chip Huyen (huyenn@stanford.edu)
Prepared for the class CS 20SI: "TensorFlow for Deep Learning Research"
For more details, please read the assignment handout:
http://web.stanford.edu/class/cs20si/assignment... | {
"repo_name": "najeeb97khan/Tensorflow-CS20SI",
"path": "Assignment_2/style_transfer/style_transfer.py",
"copies": "1",
"size": "8564",
"license": "mit",
"hash": -4277097788352153000,
"line_mean": 38.465437788,
"line_max": 116,
"alpha_frac": 0.6020551144,
"autogenerated": false,
"ratio": 3.625740... |
""" An implementation of the paper "A Neural Algorithm of Artistic Style"
For more details, please read the assignment handout:
http://web.stanford.edu/class/cs20si/assignments/a2.pdf
"""
from __future__ import print_function
import os
import time
import numpy as np
import tensorflow as tf
import vgg_model
import ut... | {
"repo_name": "infilect/ml-course1",
"path": "week3/assignments/style_transfer/style_transfer_sols.py",
"copies": "2",
"size": "8613",
"license": "mit",
"hash": 2502604371116722000,
"line_mean": 39.6273584906,
"line_max": 106,
"alpha_frac": 0.5934053175,
"autogenerated": false,
"ratio": 3.7125,
... |
"""An implementation of the Porter2 stemming algorithm.
See http://snowball.tartarus.org/algorithms/english/stemmer.html
Adapted from pyporter2 by Michael Dirolf.
This algorithm is more correct but (at least in this implementation)
several times slower than the original porter algorithm as implemented
in stemming.por... | {
"repo_name": "HeadCow/ARPS",
"path": "tmsvm/dependence/porter2.py",
"copies": "21",
"size": "8289",
"license": "mit",
"hash": 6390124163143646000,
"line_mean": 28.1866197183,
"line_max": 87,
"alpha_frac": 0.4793099288,
"autogenerated": false,
"ratio": 3.3763747454175155,
"config_test": false,
... |
"""An implementation of the Python Database API Specification v2.0
using Teradata ODBC."""
# The MIT License (MIT)
#
# Copyright (c) 2015 by Teradata
#
# 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 th... | {
"repo_name": "fxstein/PyTd",
"path": "teradata/tdodbc.py",
"copies": "1",
"size": "37550",
"license": "mit",
"hash": -3962073777640271400,
"line_mean": 40.9084821429,
"line_max": 79,
"alpha_frac": 0.5679360852,
"autogenerated": false,
"ratio": 3.999360954308233,
"config_test": false,
"has_no... |
"""An implementation of the Python Database API Specification v2.0 using
Teradata REST."""
# The MIT License (MIT)
#
# Copyright (c) 2015 by Teradata
#
# 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... | {
"repo_name": "fxstein/PyTd",
"path": "teradata/tdrest.py",
"copies": "1",
"size": "15604",
"license": "mit",
"hash": -5716982777036947000,
"line_mean": 36.0641330166,
"line_max": 79,
"alpha_frac": 0.5640861318,
"autogenerated": false,
"ratio": 4.551925320886815,
"config_test": false,
"has_no... |
'''An implementation of the Raft consensus algorithm.
References:
[1] Ongaro, Diego and Ousterhout, John. "In Search of an
Understandable Consensus Algorithm (Extended Version)". May 2014
<https://ramcloud.stanford.edu/raft.pdf>
[2] Howard, Heidi. "ARC: Analysis of Raft Consensus." July 2014.
<http://www... | {
"repo_name": "matthewnorman/kon_tiki",
"path": "kontiki/raft.py",
"copies": "2",
"size": "22848",
"license": "bsd-3-clause",
"hash": -5710742842367078000,
"line_mean": 37.0166389351,
"line_max": 79,
"alpha_frac": 0.584602591,
"autogenerated": false,
"ratio": 4.751091703056769,
"config_test": f... |
# An implementation of the scaler interface for dials.scale
import logging
import math
import os
import bz2
from orderedset import OrderedSet
import libtbx
import numpy as np
from xia2.Handlers.Citations import Citations
from xia2.Handlers.Files import FileHandler
from xia2.lib.bits import auto_logfiler
from xia2.H... | {
"repo_name": "xia2/xia2",
"path": "src/xia2/Modules/Scaler/DialsScaler.py",
"copies": "1",
"size": "61842",
"license": "bsd-3-clause",
"hash": -5741158566559380000,
"line_mean": 41.6496551724,
"line_max": 92,
"alpha_frac": 0.5888231299,
"autogenerated": false,
"ratio": 3.8571695877253167,
"con... |
# An implementation of the Scaler interface using CCP4 programs and Aimless.
import copy
import logging
import math
import os
import re
from xia2.Handlers.CIF import CIF, mmCIF
from xia2.Handlers.Citations import Citations
from xia2.Handlers.Files import FileHandler
from xia2.Handlers.Phil import PhilIndex
from xia2... | {
"repo_name": "xia2/xia2",
"path": "src/xia2/Modules/Scaler/CCP4ScalerA.py",
"copies": "1",
"size": "45837",
"license": "bsd-3-clause",
"hash": 1758730570044993500,
"line_mean": 35.995157385,
"line_max": 91,
"alpha_frac": 0.544232825,
"autogenerated": false,
"ratio": 4.041350731793335,
"config_... |
# An implementation of the segsieve algorithm
# Finds the number of primes in range [a, b] in O(n log log b)
# time and O(sqrt(b)) space
from math import *
p = []
# Generate list of important primes
def sieve(delta):
flags = [None] * (delta+1)
for i in range(3, delta+1, 2):
if not flags[i]:
... | {
"repo_name": "ruar18/competitive-programming",
"path": "algorithms-data-structures/number-theory/primes/segmented-sieve.py",
"copies": "1",
"size": "1871",
"license": "mit",
"hash": 358089324921771500,
"line_mean": 29.6721311475,
"line_max": 98,
"alpha_frac": 0.5328701229,
"autogenerated": false,
... |
"""An implementation of the Web Site Process Bus.
This module is completely standalone, depending only on the stdlib.
Web Site Process Bus
--------------------
A Bus object is used to contain and manage site-wide behavior:
daemonization, HTTP server start/stop, process reload, signal handling,
drop privileges, PID f... | {
"repo_name": "bmbove/omxremote",
"path": "cherrypy/process/wspbus.py",
"copies": "1",
"size": "16029",
"license": "bsd-3-clause",
"hash": 4870785982507429000,
"line_mean": 36.1041666667,
"line_max": 80,
"alpha_frac": 0.6047788384,
"autogenerated": false,
"ratio": 4.427900552486188,
"config_tes... |
"""An implementation of the Zephyr Abstract Syntax Definition Language.
See http://asdl.sourceforge.net/ and
http://www.cs.princeton.edu/~danwang/Papers/dsl97/dsl97-abstract.html.
Only supports top level module decl, not view. I'm guessing that view
is intended to support the browser and I'm not interested in the
br... | {
"repo_name": "CamelBackNotation/CarnotKE",
"path": "jyhton/ast/asdl.py",
"copies": "7",
"size": "11335",
"license": "apache-2.0",
"hash": 6655011558011426000,
"line_mean": 26.4455205811,
"line_max": 77,
"alpha_frac": 0.5389501544,
"autogenerated": false,
"ratio": 3.723718791064389,
"config_tes... |
"""An implementation of the Zephyr Abstract Syntax Definition Language.
See http://asdl.sourceforge.net/ and
http://www.cs.princeton.edu/research/techreps/TR-554-97
Only supports top level module decl, not view. I'm guessing that view
is intended to support the browser and I'm not interested in the
browser.
Changes... | {
"repo_name": "imsparsh/python-for-android",
"path": "python3-alpha/python3-src/Parser/asdl.py",
"copies": "47",
"size": "11726",
"license": "apache-2.0",
"hash": -3072529063225658400,
"line_mean": 26.0184331797,
"line_max": 78,
"alpha_frac": 0.5368412076,
"autogenerated": false,
"ratio": 3.74035... |
"""An implementation of the Zephyr Abstract Syntax Definition Language.
See http://asdl.sourceforge.net/ and
http://www.cs.princeton.edu/research/techreps/TR-554-97
Only supports top level module decl, not view. I'm guessing that view
is intended to support the browser and I'm not interested in the
browser.
... | {
"repo_name": "google/google-ctf",
"path": "third_party/edk2/AppPkg/Applications/Python/Python-2.7.2/Parser/asdl.py",
"copies": "6",
"size": "11733",
"license": "apache-2.0",
"hash": -5132164861358181000,
"line_mean": 26.4092009685,
"line_max": 77,
"alpha_frac": 0.5196454445,
"autogenerated": false... |
"""An implementation of Unix's 'tee' command in Python
Implementing 'tee' in Python allows the ease of writing output once, which will
be written to many file/file-like objects.
Benefits:
* Cross-platform (e.g. a pipe to the actual tee command won't work on Windows)
* The ability to write to more than just fi... | {
"repo_name": "bsandrow/pytee",
"path": "pytee.py",
"copies": "1",
"size": "3625",
"license": "bsd-3-clause",
"hash": -296607030111853200,
"line_mean": 31.9545454545,
"line_max": 94,
"alpha_frac": 0.5376551724,
"autogenerated": false,
"ratio": 4.014396456256922,
"config_test": false,
"has_no_... |
"""An implementation of Unix's 'tee' command in Python
Implementing 'tee' in Python allows the ease of writing output once, which will
be written to many file/file-like objects.
Benefits:
* Cross-platform (e.g. a pipe to the actual tee command won't work on Windows)
* The ability to write to more than just files. Any... | {
"repo_name": "Novartis/yap",
"path": "bin/pytee.py",
"copies": "1",
"size": "2764",
"license": "apache-2.0",
"hash": 5628525631498017000,
"line_mean": 27.7916666667,
"line_max": 79,
"alpha_frac": 0.6255426918,
"autogenerated": false,
"ratio": 3.6657824933687,
"config_test": false,
"has_no_ke... |
#an implimentation of Cross-Input Neighborhood Differences from http://www.cv-foundation.org/openaccess/content_cvpr_2015/papers/Ahmed_An_Improved_Deep_2015_CVPR_paper.pdf in sonnet
import tensorflow as tf
import sonnet as snt
class CrossInputNeighborhoodDifferences(snt.AbstractModule):
""" docstring """
def __in... | {
"repo_name": "thesilencelies/SonnetConvs",
"path": "CrossInputNeighborhoodDifferences.py",
"copies": "1",
"size": "1536",
"license": "apache-2.0",
"hash": -2169105244998783700,
"line_mean": 39.4210526316,
"line_max": 181,
"alpha_frac": 0.630859375,
"autogenerated": false,
"ratio": 2.762589928057... |
"""An importer for 3D Studio files.
"""
# Author: Prabhu Ramachandran <prabhu at aero dot iitb dot ac dot in>
# Copyright (c) 2007, Enthought, Inc.
# License: BSD Style.
# Standard library imports.
from os.path import basename
# Enthought imports.
from tvtk.api import tvtk
from traits.api import Instance
# Local im... | {
"repo_name": "liulion/mayavi",
"path": "mayavi/sources/three_ds_importer.py",
"copies": "3",
"size": "1973",
"license": "bsd-3-clause",
"hash": -1874059362194500000,
"line_mean": 32.4406779661,
"line_max": 74,
"alpha_frac": 0.4956918398,
"autogenerated": false,
"ratio": 4.653301886792453,
"con... |
"""An importer for VRML files.
"""
# Author: Prabhu Ramachandran <prabhu at aero dot iitb dot ac dot in>
# Copyright (c) 2007, Enthought, Inc.
# License: BSD Style.
# Standard library imports.
from os.path import basename
# Enthought imports.
from tvtk.api import tvtk
from traits.api import Instance, Str
from traits... | {
"repo_name": "liulion/mayavi",
"path": "mayavi/sources/vrml_importer.py",
"copies": "3",
"size": "5191",
"license": "bsd-3-clause",
"hash": 1398754739321764000,
"line_mean": 32.7077922078,
"line_max": 74,
"alpha_frac": 0.5270660759,
"autogenerated": false,
"ratio": 4.322231473771857,
"config_t... |
"""An improved base task implementing easy (and explicit) saving of outputs."""
import os
import logging
from inspect import getfullargspec
import numpy as np
from caput import pipeline, config, memh5
class MPILogFilter(logging.Filter):
"""Filter log entries by MPI rank.
Also this will optionally add MPI ... | {
"repo_name": "radiocosmology/draco",
"path": "draco/core/task.py",
"copies": "1",
"size": "17398",
"license": "mit",
"hash": 3233856631904754700,
"line_mean": 29.0483592401,
"line_max": 118,
"alpha_frac": 0.5795493735,
"autogenerated": false,
"ratio": 4.262126408623224,
"config_test": true,
... |
"""An improved scikit-learn-like interface of XGBoost
About
-----
scikit-learn is machine learning library for Python.
XGBoost is a new and useful gradient boosting library,
which provides a customized Python interface as well as
a simplified scikit-learn-like interface.
This repo contains a slightly improved and ... | {
"repo_name": "fyears/sklearn_xgb",
"path": "sklearn_xgb/__init__.py",
"copies": "1",
"size": "18515",
"license": "apache-2.0",
"hash": 3177853271446869500,
"line_mean": 27.7947122862,
"line_max": 175,
"alpha_frac": 0.570510397,
"autogenerated": false,
"ratio": 3.784750613246116,
"config_test":... |
""" An improvement over env.py (hopefully) """
import glob
from .. import gcc_utils
import env_uno
import env_due
class ArduinoEnv():
""" Base arduino environment class """
# -----------------------------
# public
def __init__(self, proj_name, build_dir, arduino_path, hardware):
hardware_... | {
"repo_name": "uozuAho/doit_helpers",
"path": "doit_helpers/arduino/env2.py",
"copies": "1",
"size": "6182",
"license": "mit",
"hash": 2677083226785102300,
"line_mean": 34.5287356322,
"line_max": 108,
"alpha_frac": 0.5580718214,
"autogenerated": false,
"ratio": 3.5734104046242776,
"config_test"... |
"""An incredibly simple HTTP basic auth implementation."""
from base64 import b64decode, b64encode
from six.moves.urllib.parse import quote, unquote
class DecodeError(Exception):
pass
class EncodeError(Exception):
pass
def encode(username, password):
"""Returns an HTTP basic authentication encrypted... | {
"repo_name": "rdegges/python-basicauth",
"path": "basicauth.py",
"copies": "1",
"size": "1689",
"license": "unlicense",
"hash": 7181980355720775000,
"line_mean": 27.6271186441,
"line_max": 79,
"alpha_frac": 0.6370633511,
"autogenerated": false,
"ratio": 4.308673469387755,
"config_test": false,... |
"""An incredibly simple HTTP basic auth implementation.
"""
# stdlib imports
from base64 import b64decode
from base64 import b64encode
from urllib import quote
from urllib import unquote
class DecodeError(Exception):
pass
def encode(username, password):
"""Returns an HTTP basic authentication encrypted stri... | {
"repo_name": "paddycarey/beardo-control",
"path": "app/vendor/nacelle/contrib/lockdown/utils.py",
"copies": "2",
"size": "1812",
"license": "mit",
"hash": -4561468497249334000,
"line_mean": 28.7049180328,
"line_max": 79,
"alpha_frac": 0.6490066225,
"autogenerated": false,
"ratio": 4.398058252427... |
# An indexer using the DIALS methods.
import copy
import logging
import math
import os
import string
import libtbx
from cctbx import crystal, sgtbx
# wrappers for programs that this needs: DIALS
from dials.array_family import flex
from xia2.Wrappers.Dials.GenerateMask import GenerateMask as _GenerateMask
from xia... | {
"repo_name": "xia2/xia2",
"path": "src/xia2/Modules/Indexer/DialsIndexer.py",
"copies": "1",
"size": "33770",
"license": "bsd-3-clause",
"hash": -5231063319208537000,
"line_mean": 40.8982630273,
"line_max": 101,
"alpha_frac": 0.536600533,
"autogenerated": false,
"ratio": 4.105275954291272,
"co... |
# An individual Particle
class Particle(object):
def __init__(self, sprite):
# A single force
self.gravity = PVector(0, 0.1)
self.partSize = random(10, 60)
# The particle is a textured quad.
self.part = createShape()
self.part.beginShape(QUAD)
self.part.noS... | {
"repo_name": "jdf/processing.py",
"path": "mode/examples/Topics/Create Shapes/ParticleSystemPShape/particle.py",
"copies": "4",
"size": "2115",
"license": "apache-2.0",
"hash": -84366065868247300,
"line_mean": 33.6721311475,
"line_max": 72,
"alpha_frac": 0.5735224586,
"autogenerated": false,
"ra... |
"""An individual treadmill spawn instance."""
import logging
import os
import yaml
from treadmill.spawn import utils as spawn_utils
_LOGGER = logging.getLogger(__name__)
class Instance(object):
"""Treadmill spawn instance"""
__slots__ = (
'id',
'proid',
'name',
'settings',
... | {
"repo_name": "keithhendry/treadmill",
"path": "treadmill/spawn/instance.py",
"copies": "3",
"size": "1514",
"license": "apache-2.0",
"hash": -3171822152896527400,
"line_mean": 24.2333333333,
"line_max": 75,
"alpha_frac": 0.5462351387,
"autogenerated": false,
"ratio": 3.9324675324675327,
"confi... |
"""An individual treadmill spawn instance.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import io
import logging
import os
from treadmill.spawn import utils as spawn_utils
from treadmill import yamlwrapper as ... | {
"repo_name": "Morgan-Stanley/treadmill",
"path": "lib/python/treadmill/spawn/instance.py",
"copies": "2",
"size": "1778",
"license": "apache-2.0",
"hash": -2939651276752070700,
"line_mean": 24.4,
"line_max": 75,
"alpha_frac": 0.5697412823,
"autogenerated": false,
"ratio": 3.9599109131403116,
"... |
"""An inflow wind model
@moduleauthor:: Juan P. Murcia <jumu@dtu.dk>
"""
import numpy as np
def get_ABL_U(z,Ur,zr,type='Log',**kwargs):
"""Function of undisturbed inflow wind speed
Inputs
----------
z: np.array, float
Heights to evaluate the streamwise wind speed
Ur: float
Refer... | {
"repo_name": "DTUWindEnergy/FUSED-Wake",
"path": "fusedwake/Inflow.py",
"copies": "1",
"size": "9422",
"license": "mit",
"hash": -1789563178772687400,
"line_mean": 36.684,
"line_max": 119,
"alpha_frac": 0.5781764144,
"autogenerated": false,
"ratio": 2.700200630553167,
"config_test": false,
"... |
## an initial version
## Transform the tfrecord to slim data provider format
import numpy
import tensorflow as tf
import os
slim = tf.contrib.slim
ITEMS_TO_DESCRIPTIONS = {
'image': 'slim.tfexample_decoder.Image',
'shape': 'shape',
'height': 'height',
'width': 'width',
'object/bbox': 'box',
... | {
"repo_name": "liuzz1983/open_vision",
"path": "openvision/datasets/sythtextprovider.py",
"copies": "1",
"size": "2593",
"license": "mit",
"hash": -5948938730038087000,
"line_mean": 35.0277777778,
"line_max": 85,
"alpha_frac": 0.6436559969,
"autogenerated": false,
"ratio": 3.4163372859025034,
"... |
'''An in-memory backend'''
import collections
from ..exceptions import DownloadException, DeleteException
class Memory(object):
'''An in-memory backend'''
def __init__(self):
self.buckets = collections.defaultdict(dict)
def download(self, bucket, key, fobj, retries, headers=None):
'''D... | {
"repo_name": "seomoz/s3po",
"path": "s3po/backends/memory.py",
"copies": "1",
"size": "1433",
"license": "mit",
"hash": 949973569496496000,
"line_mean": 33.9512195122,
"line_max": 89,
"alpha_frac": 0.6099092812,
"autogenerated": false,
"ratio": 4.106017191977077,
"config_test": false,
"has_n... |
# An in-place quicksort.
# http://en.wikipedia.org/wiki/Quicksort
import random
def quicksort(array):
_quicksort(array, 0, len(array) - 1)
def _quicksort(array, left, right):
if left >= right:
return
s_i = _partition(array, left, right)
_quicksort(array, left, s_i - 1)
_quicksort(array... | {
"repo_name": "calebperkins/algorithms",
"path": "algorithms/quicksort.py",
"copies": "1",
"size": "1094",
"license": "mit",
"hash": -7380096473533658000,
"line_mean": 23.3111111111,
"line_max": 73,
"alpha_frac": 0.5868372943,
"autogenerated": false,
"ratio": 2.9972602739726026,
"config_test": ... |
"""An in-process kernel"""
# Copyright (c) IPython Development Team.
# Distributed under the terms of the Modified BSD License.
from contextlib import contextmanager
import logging
import sys
from IPython.core.interactiveshell import InteractiveShellABC
from ipykernel.jsonutil import json_clean
from traitlets import... | {
"repo_name": "sserrot/champion_relationships",
"path": "venv/Lib/site-packages/ipykernel/inprocess/ipkernel.py",
"copies": "1",
"size": "6861",
"license": "mit",
"hash": 4417990565750485000,
"line_mean": 34.734375,
"line_max": 88,
"alpha_frac": 0.5512315989,
"autogenerated": false,
"ratio": 4.63... |
"""An instance of an FMOD Studio Event."""
from ctypes import byref, c_bool, c_float, c_int, c_void_p
from ..channel_group import ChannelGroup
from ..utils import prepare_str
from .enums import PLAYBACK_STATE
from .studio_object import StudioObject
class EventInstance(StudioObject):
"""An instance of an FMOD St... | {
"repo_name": "tyrylu/pyfmodex",
"path": "pyfmodex/studio/event_instance.py",
"copies": "1",
"size": "2848",
"license": "mit",
"hash": 329387678341367040,
"line_mean": 28.3608247423,
"line_max": 86,
"alpha_frac": 0.6169241573,
"autogenerated": false,
"ratio": 4.097841726618705,
"config_test": f... |
""" An instance of data collection corresponding to a single step within a
Procedure.
:Authors: Sana dev team
:Version: 2.0
"""
import mimetypes, os
from django.db import models
from django.utils.translation import ugettext as _
from mds.api.utils import make_uuid, guess_fext
_app = "core"
class Observation(model... | {
"repo_name": "SanaMobile/sana.mds",
"path": "src/mds/core/models/observation.py",
"copies": "1",
"size": "5330",
"license": "bsd-3-clause",
"hash": -150896457585635070,
"line_mean": 30.9161676647,
"line_max": 91,
"alpha_frac": 0.5960600375,
"autogenerated": false,
"ratio": 4.213438735177865,
"... |
""" An instance of data collection corresponding to a single step within a
Procedure.
:Authors: Sana dev team
:Version: 2.0
"""
import mimetypes, os
from django.db import models
from mds.api.utils import make_uuid, guess_fext
_app = "core"
class Observation(models.Model):
""" A piece of data collected about a ... | {
"repo_name": "rryan/sana.mds",
"path": "src/mds/core/models/observation.py",
"copies": "1",
"size": "5256",
"license": "bsd-3-clause",
"hash": -5769661608895717000,
"line_mean": 31.85,
"line_max": 91,
"alpha_frac": 0.5840943683,
"autogenerated": false,
"ratio": 4.287112561174552,
"config_test"... |
""" An instance of data collection resulting from executing a Procedure
on a Subject.
:Authors: Sana dev team
:Version: 2.0
"""
from django.db import models
from mds.api.utils import make_uuid
class Encounter(models.Model):
""" A completed procedure, where data has been collected
"""
class Meta:
... | {
"repo_name": "dekatzenel/team-k",
"path": "mds/core/models/encounter.py",
"copies": "1",
"size": "2116",
"license": "bsd-3-clause",
"hash": 2922018781041516000,
"line_mean": 30.1176470588,
"line_max": 90,
"alpha_frac": 0.6214555766,
"autogenerated": false,
"ratio": 4.300813008130081,
"config_t... |
"""An instance of echomesh, representing one node."""
from __future__ import absolute_import, division, print_function, unicode_literals
import time
from echomesh.Cechomesh import cechomesh
from echomesh.base import Settings
from echomesh.base import Quit
from echomesh.base import Yaml
from echomesh.element import S... | {
"repo_name": "rec/echomesh",
"path": "code/python/echomesh/Instance.py",
"copies": "1",
"size": "4326",
"license": "mit",
"hash": 7433514359706902000,
"line_mean": 32.796875,
"line_max": 82,
"alpha_frac": 0.6100323625,
"autogenerated": false,
"ratio": 3.8972972972972975,
"config_test": false,
... |
# Dependencies: Immunity Debugger
# Author: Brian Yip
import immlib
def main(args):
imm = immlib.Debugger()
encrypted_file = open('''Path to encrypted file''', "rb")
in_file = encrypted_file.read()
in_buffer_size = len(in_file)
# Allocate memory in the debugged process and write the data
... | {
"repo_name": "itsbriany/Security-Tools",
"path": "reverse-engineering/self_decrypt_template.py",
"copies": "2",
"size": "1384",
"license": "mit",
"hash": -3703236248349654500,
"line_mean": 28.4468085106,
"line_max": 77,
"alpha_frac": 0.7023121387,
"autogenerated": false,
"ratio": 3.5948051948051... |
"""An interactive graph to plot the trajectory of points on and off the mandelbrot
set. Illustrates the use of sliders in matplotlib"""
import pylab
from matplotlib.widgets import Slider
def compute_trajectory(x0, y0, set_boundary = 2, n_iters = 100):
"""Take the fragment and compute a further n_iters iterations for... | {
"repo_name": "ActiveState/code",
"path": "recipes/Python/577642_Mandelbrot_trajectories/recipe-577642.py",
"copies": "1",
"size": "1571",
"license": "mit",
"hash": -7598073259739794000,
"line_mean": 27.0535714286,
"line_max": 82,
"alpha_frac": 0.6155315086,
"autogenerated": false,
"ratio": 2.416... |
"""An interactive interpreter inside of a diesel event loop.
It's useful for importing and interacting with code that expects to run
inside of a diesel event loop. It works especially well for interactive
sessions with diesel's various network protocol clients.
Supports both the standard Python interactive interprete... | {
"repo_name": "dieseldev/diesel",
"path": "diesel/interactive.py",
"copies": "1",
"size": "1836",
"license": "bsd-3-clause",
"hash": 3595309032179243500,
"line_mean": 26,
"line_max": 87,
"alpha_frac": 0.6623093682,
"autogenerated": false,
"ratio": 4.008733624454148,
"config_test": false,
"has... |
"""An interactive mouse-based example
This script tracks whether mouse clicks hit a circle.
On the screen there's a circle with a fixed center and radius. Mouse clicks
inside and outside the circle to change its color.
On click (and drag), mouse coordinates are fed into the ``mousex`` and
``mousey`` input nodes. T... | {
"repo_name": "akaihola/lusmu",
"path": "lusmu/examples/mouse.py",
"copies": "1",
"size": "3119",
"license": "bsd-3-clause",
"hash": -8787905215254300000,
"line_mean": 28.9903846154,
"line_max": 79,
"alpha_frac": 0.677140109,
"autogenerated": false,
"ratio": 3.4050218340611353,
"config_test": f... |
"""An interactuve GUI to explore the patches we generate.
I use this to confirm that the patches we generate are reasonable
"""
from pylab import plt
import os
import pandas as pd
import pickle
from matplotlib.widgets import Slider, RadioButtons
from easydict import EasyDict
from srp.config import C
import numpy as n... | {
"repo_name": "jfemiani/srp-boxes",
"path": "srp/visualize/show_patches.py",
"copies": "1",
"size": "3423",
"license": "mit",
"hash": -7932441709435813000,
"line_mean": 28.2564102564,
"line_max": 84,
"alpha_frac": 0.6038562664,
"autogenerated": false,
"ratio": 3.2445497630331754,
"config_test":... |
"""An intercomponent communication protocol."""
# pylint: disable=invalid-name,bad-whitespace
from enum import Enum, IntEnum, auto, unique
import traceback
import multiprocessing
import os
import json
__version__ = (1, 5, 0)
class AutoIntEnum(IntEnum):
"""
An enum with automatically incrementing integer val... | {
"repo_name": "pioneers/PieCentral",
"path": "runtime/runtime/util.py",
"copies": "1",
"size": "6961",
"license": "apache-2.0",
"hash": 5893885445357965000,
"line_mean": 33.805,
"line_max": 98,
"alpha_frac": 0.610831777,
"autogenerated": false,
"ratio": 3.7525606469002697,
"config_test": false,... |
#An interesting turtle sample from CSDN, 啥是佩奇, python turtleDrawPeppa.py
from turtle import*
def nose(x,y):
penup()
goto(x,y)
pendown()
setheading(-30)
begin_fill()
a=0.4
for i in range(120):
if 0<=i<30 or 60<=i<90:
a=a+0.08
left(3)
forward(a)
... | {
"repo_name": "mphz/bkdev",
"path": "pycod/turtleDrawPeppa.py",
"copies": "1",
"size": "3137",
"license": "mit",
"hash": 534133986255046800,
"line_mean": 15.6378378378,
"line_max": 72,
"alpha_frac": 0.5183620409,
"autogenerated": false,
"ratio": 2.657167530224525,
"config_test": false,
"has_n... |
"""An interface between JPL ephemerides and Skyfield."""
import jplephem
from jplephem.spk import SPK
from jplephem.names import target_names as _names
from numpy import max, min
from .constants import AU_KM, C_AUDAY, DAY_S
from .ephemerislib import Body, Segment
from .functions import length_of
from .positionlib imp... | {
"repo_name": "GuidoBR/python-skyfield",
"path": "skyfield/jpllib.py",
"copies": "1",
"size": "6858",
"license": "mit",
"hash": 7323382856470085000,
"line_mean": 35.2857142857,
"line_max": 80,
"alpha_frac": 0.5810731992,
"autogenerated": false,
"ratio": 3.3323615160349855,
"config_test": false,... |
"""An interface between JPL ephemerides and Skyfield."""
import jplephem
from jplephem.spk import SPK
from jplephem.names import target_names
from numpy import max, min
from .chaining import Body, Segment
from .constants import AU_KM, C_AUDAY, DAY_S
from .functions import length_of
from .positionlib import Astrometri... | {
"repo_name": "exoanalytic/python-skyfield",
"path": "skyfield/jpllib.py",
"copies": "1",
"size": "6276",
"license": "mit",
"hash": -1170863877936210200,
"line_mean": 35.0689655172,
"line_max": 80,
"alpha_frac": 0.5874760994,
"autogenerated": false,
"ratio": 3.2875851231011,
"config_test": fals... |
"""An interface between JPL ephemerides and Skyfield."""
import os
from collections import defaultdict, namedtuple
from numpy import max, min
from jplephem.spk import SPK
from jplephem.names import target_name_pairs, target_names as _names
from .constants import AU_KM, C_AUDAY, DAY_S
from .errors import DeprecationE... | {
"repo_name": "ozialien/python-skyfield",
"path": "skyfield/jpllib.py",
"copies": "1",
"size": "15948",
"license": "mit",
"hash": 6297223191010244000,
"line_mean": 36.1748251748,
"line_max": 80,
"alpha_frac": 0.6192626035,
"autogenerated": false,
"ratio": 3.694232105628909,
"config_test": false... |
"""An interface between JPL ephemerides and Skyfield."""
import os
from collections import defaultdict
from jplephem.exceptions import OutOfRangeError
from jplephem.spk import SPK
from jplephem.names import target_name_pairs
from .constants import AU_KM, DAY_S
from .errors import EphemerisRangeError
from .timelib im... | {
"repo_name": "skyfielders/python-skyfield",
"path": "skyfield/jpllib.py",
"copies": "1",
"size": "9581",
"license": "mit",
"hash": 4450481301664066000,
"line_mean": 36.8695652174,
"line_max": 78,
"alpha_frac": 0.5980586578,
"autogenerated": false,
"ratio": 3.569672131147541,
"config_test": fal... |
"""An interface between Skyfield and the Python ``sgp4`` library."""
from numpy import array, cross, einsum, zeros_like
from sgp4.earth_gravity import wgs72
from sgp4.io import twoline2rv
from sgp4.propagation import sgp4
from .constants import AU_KM, DAY_S, T0, tau
from .errors import raise_error_for_deprecated_time... | {
"repo_name": "ozialien/python-skyfield",
"path": "skyfield/sgp4lib.py",
"copies": "1",
"size": "5410",
"license": "mit",
"hash": 7817404253149138000,
"line_mean": 33.4585987261,
"line_max": 77,
"alpha_frac": 0.6112754159,
"autogenerated": false,
"ratio": 3.0055555555555555,
"config_test": fals... |
"""An interface for a directory watcher."""
import abc
import collections
import logging
import os
import sys
import enum
_LOGGER = logging.getLogger(__name__)
class DirWatcherEvent(enum.Enum):
"""DirWatcher's emitted event types.
"""
# W0232: Class has no __init__ method
# pylint: disable=W0232
... | {
"repo_name": "ThoughtWorksInc/treadmill",
"path": "treadmill/dirwatch/dirwatch_base.py",
"copies": "3",
"size": "5583",
"license": "apache-2.0",
"hash": -3772069707316996600,
"line_mean": 27.9274611399,
"line_max": 79,
"alpha_frac": 0.5479133083,
"autogenerated": false,
"ratio": 4.29792147806004... |
"""An interface for a directory watcher.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import abc
import collections
import logging
import os
import sys
import enum
import six
_LOGGER = logging.getLogger(__na... | {
"repo_name": "captiosus/treadmill",
"path": "treadmill/dirwatch/dirwatch_base.py",
"copies": "2",
"size": "5749",
"license": "apache-2.0",
"hash": 7836205973088194000,
"line_mean": 27.6019900498,
"line_max": 79,
"alpha_frac": 0.5550530527,
"autogenerated": false,
"ratio": 4.277529761904762,
"c... |
# An interface for controlling LEDs via the Multimorphic PD-LED board,
# for use with P-ROC pinball hardware. This code is a module for pyprocgame,
# written by Adam Preble and Gerry Stellenberg
# More information is avaible at http://pyprocgame.pindev.org/
# and http://pinballcontrollers.com/
# This module was writte... | {
"repo_name": "mjocean/PyProcGameHD-SkeletonGame",
"path": "procgame/LEDs.py",
"copies": "1",
"size": "74833",
"license": "mit",
"hash": 6255868642551011000,
"line_mean": 45.1932098765,
"line_max": 98,
"alpha_frac": 0.569708551,
"autogenerated": false,
"ratio": 4.393154866737114,
"config_test":... |
"""An interface for creating and retrieving alerts in Matchlight."""
from __future__ import absolute_import
import calendar
import datetime
import json
import matchlight.error
__all__ = (
'Alert',
'AlertMethods',
)
class Alert(object):
"""Represents an alert.
Attributes:
id (:obj:`str`): ... | {
"repo_name": "TerbiumLabs/python-matchlightsdk",
"path": "src/matchlight/alert.py",
"copies": "1",
"size": "11268",
"license": "bsd-3-clause",
"hash": 7224883908109211000,
"line_mean": 32.7365269461,
"line_max": 79,
"alpha_frac": 0.5502307419,
"autogenerated": false,
"ratio": 4.434474616292798,
... |
"""An interface for creating and retrieving Matchlight projects."""
from __future__ import absolute_import
import datetime
try:
import collections.abc as collections_abc
except ImportError:
import collections as collections_abc
import json
import six
import matchlight.error
import matchlight.utils
class P... | {
"repo_name": "TerbiumLabs/python-matchlightsdk",
"path": "src/matchlight/project.py",
"copies": "1",
"size": "8788",
"license": "bsd-3-clause",
"hash": -8966841957121999000,
"line_mean": 33.328125,
"line_max": 76,
"alpha_frac": 0.5696404188,
"autogenerated": false,
"ratio": 4.407221664994985,
... |
"""An interface for creating and retrieving PII records in Matchlight."""
from __future__ import absolute_import
import io
import json
import six
import matchlight.error
import matchlight.utils
from pylibfp import (
fingerprint,
fingerprints_pii_address_variants,
fingerprints_pii_city_state_zip_variants... | {
"repo_name": "TerbiumLabs/python-matchlightsdk",
"path": "src/matchlight/record.py",
"copies": "1",
"size": "18317",
"license": "bsd-3-clause",
"hash": 8489491299121575000,
"line_mean": 35.3432539683,
"line_max": 79,
"alpha_frac": 0.5559862423,
"autogenerated": false,
"ratio": 4.3799617407938785... |
"""An interface for downloading and filtering Matchlight feeds."""
from __future__ import absolute_import, print_function
import datetime
import io
import json
import time
import six
import matchlight.error
import matchlight.utils
if not six.PY3:
from backports import csv
else:
import csv
class Feed(objec... | {
"repo_name": "TerbiumLabs/python-matchlightsdk",
"path": "src/matchlight/feed.py",
"copies": "1",
"size": "7421",
"license": "bsd-3-clause",
"hash": 786974627101397600,
"line_mean": 32.8858447489,
"line_max": 77,
"alpha_frac": 0.5721600862,
"autogenerated": false,
"ratio": 4.245423340961098,
"... |
"""An interface for extending pandas with custom arrays.
.. warning::
This is an experimental API and subject to breaking changes
without warning.
"""
import numpy as np
from pandas.errors import AbstractMethodError
from pandas.compat.numpy import function as nv
_not_implemented_message = "{} does not impleme... | {
"repo_name": "ryfeus/lambda-packs",
"path": "Tensorflow_Pandas_Numpy/source3.6/pandas/core/arrays/base.py",
"copies": "1",
"size": "21492",
"license": "mit",
"hash": 5165872286571083000,
"line_mean": 34.1176470588,
"line_max": 79,
"alpha_frac": 0.5648613438,
"autogenerated": false,
"ratio": 4.86... |
"""An interface for extending pandas with custom arrays.
.. warning::
This is an experimental API and subject to breaking changes
without warning.
"""
import numpy as np
import operator
from pandas.core.dtypes.generic import ABCSeries, ABCIndexClass
from pandas.errors import AbstractMethodError
from pandas.co... | {
"repo_name": "amolkahat/pandas",
"path": "pandas/core/arrays/base.py",
"copies": "3",
"size": "31271",
"license": "bsd-3-clause",
"hash": 1093223014130310400,
"line_mean": 34.3344632768,
"line_max": 79,
"alpha_frac": 0.574366026,
"autogenerated": false,
"ratio": 4.74666059502125,
"config_test"... |
"""An interface for extending pandas with custom arrays.
.. warning::
This is an experimental API and subject to breaking changes
without warning.
"""
import operator
from typing import Any, Callable, Dict, Optional, Sequence, Tuple, Union
import numpy as np
from pandas.compat import set_function_name
from pa... | {
"repo_name": "toobaz/pandas",
"path": "pandas/core/arrays/base.py",
"copies": "2",
"size": "40003",
"license": "bsd-3-clause",
"hash": 6232905153799439000,
"line_mean": 32.9296013571,
"line_max": 87,
"alpha_frac": 0.5712071595,
"autogenerated": false,
"ratio": 4.699600563909774,
"config_test":... |
"""An interface for extending pandas with custom arrays.
.. warning::
This is an experimental API and subject to breaking changes
without warning.
"""
import operator
import numpy as np
from pandas.compat import PY3, set_function_name
from pandas.compat.numpy import function as nv
from pandas.errors import Ab... | {
"repo_name": "GuessWhoSamFoo/pandas",
"path": "pandas/core/arrays/base.py",
"copies": "1",
"size": "38965",
"license": "bsd-3-clause",
"hash": -3184456759167220700,
"line_mean": 33.7901785714,
"line_max": 79,
"alpha_frac": 0.5662004363,
"autogenerated": false,
"ratio": 4.712178014270165,
"conf... |
# An interface for programs which do integration - this will handle
# all of the input and output, delegating the actual processing to an
# implementation of this interfacing.
#
# The following are considered critical:
#
# Input:
# An implementation of the indexer class.
#
# Output:
# [processed reflections?]
#
# This ... | {
"repo_name": "xia2/xia2",
"path": "src/xia2/Schema/Interfaces/Integrater.py",
"copies": "1",
"size": "28028",
"license": "bsd-3-clause",
"hash": -6803015810135161000,
"line_mean": 33.8606965174,
"line_max": 88,
"alpha_frac": 0.585093478,
"autogenerated": false,
"ratio": 4.04678024833959,
"conf... |
# An interface for programs which perform indexing - this will handle
# all of the aspects of the interface which are common between indexing
# progtrams, and which must be presented in order to satisfy the contract
# for the indexer interface.
#
# The following are considered to be critical for this class:
#
# Images ... | {
"repo_name": "xia2/xia2",
"path": "src/xia2/Schema/Interfaces/Indexer.py",
"copies": "1",
"size": "26930",
"license": "bsd-3-clause",
"hash": -5571892499541710000,
"line_mean": 33.3933588761,
"line_max": 95,
"alpha_frac": 0.5666171556,
"autogenerated": false,
"ratio": 4.0278193239605145,
"conf... |
# An interface for programs which process X-Ray diffraction images.
# This adds the code for handling the templates, directories etc.
# but not the use of them e.g. the keyworded input.
#
# This is a virtual class - and should be inherited from only for the
# purposes of using the methods.
#
# The following are conside... | {
"repo_name": "xia2/xia2",
"path": "src/xia2/Schema/Interfaces/FrameProcessor.py",
"copies": "1",
"size": "9676",
"license": "bsd-3-clause",
"hash": 7502535004706504000,
"line_mean": 28.3212121212,
"line_max": 87,
"alpha_frac": 0.5937370814,
"autogenerated": false,
"ratio": 3.759129759129759,
"... |
"""An interface for publishing rich data to frontends.
There are two components of the display system:
* Display formatters, which take a Python object and compute the
representation of the object in various formats (text, HTML, SVG, etc.).
* The display publisher that is used to send the representation data to the... | {
"repo_name": "marcoantoniooliveira/labweb",
"path": "oscar/lib/python2.7/site-packages/IPython/core/displaypub.py",
"copies": "2",
"size": "5918",
"license": "bsd-3-clause",
"hash": -2574726621297347600,
"line_mean": 35.0853658537,
"line_max": 78,
"alpha_frac": 0.5904021629,
"autogenerated": false... |
"""An interface for searching the Matchlight fingerprints database."""
from __future__ import absolute_import
import datetime
import json
import six
import matchlight.error
import pylibfp
class SearchMethods(object):
"""Provides methods for interfacing with the search API."""
def __init__(self, ml_connect... | {
"repo_name": "TerbiumLabs/python-matchlightsdk",
"path": "src/matchlight/search.py",
"copies": "1",
"size": "5952",
"license": "bsd-3-clause",
"hash": -3089249613834879500,
"line_mean": 32.251396648,
"line_max": 78,
"alpha_frac": 0.5398185484,
"autogenerated": false,
"ratio": 4.613953488372093,
... |
"""An interface for the Slack web API
https://github.com/Shir0kamii/slack-client
"""
# Always prefer setuptools over distutils
from setuptools import setup, find_packages
# To use a consistent encoding
from codecs import open
from os import path
here = path.abspath(path.dirname(__file__))
# Get the long description... | {
"repo_name": "Shir0kamii/slack-client",
"path": "setup.py",
"copies": "1",
"size": "2472",
"license": "mit",
"hash": 585912390156804600,
"line_mean": 31.96,
"line_max": 79,
"alpha_frac": 0.6662621359,
"autogenerated": false,
"ratio": 4.085950413223141,
"config_test": false,
"has_no_keywords"... |
"""An interface that manages Digital Signal Processor (DSP) Connections."""
from ctypes import *
from .enums import DSPCONNECTION_TYPE
from .fmodobject import *
from .globalvars import get_class
class DSPConnection(FmodObject):
"""An interface that manages Digital Signal Processor (DSP) Connections."""
@pro... | {
"repo_name": "tyrylu/pyfmodex",
"path": "pyfmodex/dsp_connection.py",
"copies": "1",
"size": "4690",
"license": "mit",
"hash": -6347538798286331000,
"line_mean": 35.3565891473,
"line_max": 100,
"alpha_frac": 0.6147121535,
"autogenerated": false,
"ratio": 4.078260869565217,
"config_test": false... |
"""An interface that manages Sound Groups."""
from ctypes import byref, c_float, c_int, c_void_p, create_string_buffer
from .enums import SOUNDGROUP_BEHAVIOR
from .fmodobject import FmodObject
from .globalvars import get_class
class SoundGroup(FmodObject):
"""An interface that manages Sound Groups."""
@prop... | {
"repo_name": "tyrylu/pyfmodex",
"path": "pyfmodex/sound_group.py",
"copies": "1",
"size": "4543",
"license": "mit",
"hash": 5453038591049585000,
"line_mean": 29.4899328859,
"line_max": 81,
"alpha_frac": 0.6178736518,
"autogenerated": false,
"ratio": 3.6141607000795544,
"config_test": false,
... |
"""An interface that manages virtual 3D reverb spheres."""
from ctypes import *
from .fmodobject import FmodObject
from .structures import REVERB_PROPERTIES, VECTOR
from .utils import check_type
class Reverb3D(FmodObject):
"""An interface that manages virtual 3D reverb spheres."""
@property
def _threed... | {
"repo_name": "tyrylu/pyfmodex",
"path": "pyfmodex/reverb.py",
"copies": "1",
"size": "3530",
"license": "mit",
"hash": -7798097461079376000,
"line_mean": 27.6991869919,
"line_max": 87,
"alpha_frac": 0.6042492918,
"autogenerated": false,
"ratio": 3.8453159041394334,
"config_test": false,
"has... |
"""An interface that represents the shared APIs between
:py:class:`pyfmodex.channel.Channel` and
:py:class:`pyfmodex.channel_group.ChannelGroup`.
"""
# pylint: disable=too-many-public-methods
# That's not our fault... :-)
from ctypes import *
from .callback_prototypes import CHANNELCONTROL_CALLBACK
from .cone_settin... | {
"repo_name": "tyrylu/pyfmodex",
"path": "pyfmodex/channel_control.py",
"copies": "1",
"size": "36232",
"license": "mit",
"hash": -7120706403960294000,
"line_mean": 35.5241935484,
"line_max": 110,
"alpha_frac": 0.6252759991,
"autogenerated": false,
"ratio": 3.985918591859186,
"config_test": fal... |
"""An interface to GraphViz."""
from __future__ import division
from __future__ import print_function
import copy
import io
import errno
import os
import re
import subprocess
import sys
import tempfile
import warnings
try:
import dot_parser
except Exception as e:
warnings.warn(
"Couldn't import dot_par... | {
"repo_name": "erocarrera/pydot",
"path": "pydot.py",
"copies": "1",
"size": "54068",
"license": "mit",
"hash": -3781711013687590000,
"line_mean": 26.769902414,
"line_max": 78,
"alpha_frac": 0.5488828882,
"autogenerated": false,
"ratio": 4.013956941351151,
"config_test": false,
"has_no_keywor... |
"""An interface to GraphViz."""
import copy
import io
import errno
import os
import re
import subprocess
import sys
import tempfile
import warnings
try:
import dot_parser
except Exception as e:
warnings.warn(
"`pydot` could not import `dot_parser`, "
"so `pydot` will be unable to parse DOT file... | {
"repo_name": "pydot/pydot",
"path": "pydot.py",
"copies": "1",
"size": "54493",
"license": "mit",
"hash": -6503652617289410000,
"line_mean": 28.7126499455,
"line_max": 79,
"alpha_frac": 0.546547263,
"autogenerated": false,
"ratio": 4.0299511906522705,
"config_test": false,
"has_no_keywords":... |
"""An interface to interactact with the common data-store shared
between various bots and the fetcher bot
Currently, the data-store is simply in memory and acts more or less
as a stub, but we plan to have the information in a database that
can be accessed through this module.
May change into class if necessary for ma... | {
"repo_name": "AnalysisBots/runtime",
"path": "scripts/datastore.py",
"copies": "1",
"size": "2364",
"license": "mit",
"hash": -5040557377388072000,
"line_mean": 28.5625,
"line_max": 75,
"alpha_frac": 0.6861252115,
"autogenerated": false,
"ratio": 4.01358234295416,
"config_test": false,
"has_... |
"""An interface to manage files contained within a pod.
The File class should not be accessed directly. Instead, file objects should be
retrieved using the methods "create_file" or "get_file" from the Pod class.
pod = pods.Pod('/home/growler/my-site/')
You can create a new file.
pod.create_file('/README.md')
Y... | {
"repo_name": "vitorio/pygrow",
"path": "grow/pods/files.py",
"copies": "2",
"size": "2811",
"license": "mit",
"hash": 3199761876507939000,
"line_mean": 23.4434782609,
"line_max": 84,
"alpha_frac": 0.679473497,
"autogenerated": false,
"ratio": 3.4072727272727272,
"config_test": false,
"has_no... |
"""An interface to the NORB and Small NORB datasets.
Unlike ./norb_small.py, this reads the original NORB file format, not the
LISA lab's .npy version.
Download the datasets from:
Small NORB: http://www.cs.nyu.edu/~ylclab/data/norb-v1.0-small/
(big) NORB: http://www.cs.nyu.edu/~ylclab/data/norb-v1.0/
NORB and Small ... | {
"repo_name": "nouiz/pylearn2",
"path": "pylearn2/datasets/new_norb.py",
"copies": "44",
"size": "34651",
"license": "bsd-3-clause",
"hash": 8412076440644270000,
"line_mean": 34.3221202854,
"line_max": 79,
"alpha_frac": 0.5097111194,
"autogenerated": false,
"ratio": 4.302868496212591,
"config_t... |
"""An internal(!) helpers module"""
class StreamlikeException(Exception):
""" Base error. """
code = None
def __init__(self, message, result=None):
super(StreamlikeException, self).__init__(message)
self.result = result
if message:
self.message = message
class BadReques... | {
"repo_name": "brightforme/python-streamlike",
"path": "streamlike/helpers.py",
"copies": "1",
"size": "2745",
"license": "mit",
"hash": 4722507884618274000,
"line_mean": 25.9215686275,
"line_max": 108,
"alpha_frac": 0.6480874317,
"autogenerated": false,
"ratio": 3.9439655172413794,
"config_tes... |
"""An internal module for wrapping the use of mappers."""
def make_mapper(mapper_class):
"""Wrap a mapper.
This makes a mapper wrapped with a few convenient tools for managing
mappers with scalar bars in a consistent way since not all mapper classes
have scalar ranges and lookup tables.
"""
c... | {
"repo_name": "akaszynski/vtkInterface",
"path": "pyvista/plotting/mapper.py",
"copies": "1",
"size": "1417",
"license": "mit",
"hash": 2846052007923669000,
"line_mean": 28.5208333333,
"line_max": 77,
"alpha_frac": 0.5800988003,
"autogenerated": false,
"ratio": 4.428125,
"config_test": false,
... |
# An Internet checksum algorithm using Python.
# This program is licensed under the GPL; see LICENSE for details.
# This procedure can be used to calculate the Internet checksum of
# some data. It is adapted from RFC 1071:
#
# ftp://ftp.isi.edu/in-notes/rfc1071.txt
#
# See also:
#
# http://www.netfor2.com/ipsum.htm
... | {
"repo_name": "mdelatorre/checksum",
"path": "ichecksum.py",
"copies": "1",
"size": "1348",
"license": "cc0-1.0",
"hash": 727103883265623400,
"line_mean": 31.0952380952,
"line_max": 77,
"alpha_frac": 0.6424332344,
"autogenerated": false,
"ratio": 3.4564102564102566,
"config_test": false,
"has... |
# An internet operator plans to connect a business park to the optical fiber
# network. The area to be covered is large and the operator is asking you to
# write a program that will calculate the minimum length of optical fiber cable
# required to connect all buildings.
# For the implementation of the works, the ... | {
"repo_name": "Pouf/CodingCompetition",
"path": "CG/medium_network-cabling.py",
"copies": "1",
"size": "1034",
"license": "mit",
"hash": -5213598350318899000,
"line_mean": 39.44,
"line_max": 79,
"alpha_frac": 0.7292069632,
"autogenerated": false,
"ratio": 3.577854671280277,
"config_test": false... |
# An Introduction to Interactive Programming in Python (Part 1)
# Challenges regarding triangle perimiter and area
# including chellenge 11. from functions excercises
import math
from string import split
class My_Point(object):
__x = 0.0
__y = 0.0
def __init__(self, x, y):
self.__x = x
... | {
"repo_name": "polde-live/interprog1",
"path": "exercises/triangles.py",
"copies": "1",
"size": "3021",
"license": "unlicense",
"hash": -3505459968177569000,
"line_mean": 24.8290598291,
"line_max": 89,
"alpha_frac": 0.5475008275,
"autogenerated": false,
"ratio": 2.776654411764706,
"config_test"... |
# # An Introduction to Interactive Programming in Python (Part 1)
# Practice exercise for interactive applications
def hl():
print "*" * 20
# 1. pring_goodbye
def print_goodbye():
message = "Goodbye"
print message
# Tests
message = "Hello"
print message
print_goodbye()
print message
message = "Cia... | {
"repo_name": "polde-live/interprog1",
"path": "exercises/intprog.py",
"copies": "1",
"size": "1235",
"license": "unlicense",
"hash": -7722888274040530000,
"line_mean": 14.8333333333,
"line_max": 65,
"alpha_frac": 0.6898785425,
"autogenerated": false,
"ratio": 3.2845744680851063,
"config_test":... |
# An Introduction to Interactive Programming in Python (Part 1)
# Practice exercises for expressions
# 1. Number of feet in 13 miles:
feet_in_13_miles = 13 * 5280 #There are 5280 feet in a mile.
print "There are %d in 13 miles" %feet_in_13_miles
# 2. Number of seconds in 7 hours, 21 minutes and 37 seconds:
total_s... | {
"repo_name": "polde-live/interprog1",
"path": "exercises/expressions.py",
"copies": "1",
"size": "2001",
"license": "unlicense",
"hash": 7736628790815662000,
"line_mean": 22.8214285714,
"line_max": 81,
"alpha_frac": 0.6381809095,
"autogenerated": false,
"ratio": 2.6294349540078845,
"config_tes... |
# An Introduction to Interactive Programming in Python (Part 1)
# Practice exercises for variables and assignments
# 1. Compute the number of feet corresponding to __a number of miles:
def miles_to_feet(miles):
return float(miles * 5280)
def print_miles_to_feet(miles):
print "%.1f miles equals %.1f feet" ... | {
"repo_name": "polde-live/interprog1",
"path": "exercises/variables.py",
"copies": "1",
"size": "3682",
"license": "unlicense",
"hash": 4487087774683992000,
"line_mean": 24.0476190476,
"line_max": 89,
"alpha_frac": 0.5507876154,
"autogenerated": false,
"ratio": 2.7314540059347183,
"config_test"... |
"""An intuitive record/replay mock object.
First, use the mock as you would the real object:
>>> mopen = Mock()
>>> fd = mopen('/etc/passwd')
One exception to this is return values, which are specified by defining the
"returns" attributes:
>>> fd.read().returns = 'This is a test'
>>> fd.close()
Once all the functi... | {
"repo_name": "alecthomas/flam",
"path": "random/mock.py",
"copies": "3",
"size": "1658",
"license": "bsd-3-clause",
"hash": 1344326297475170000,
"line_mean": 21.1066666667,
"line_max": 78,
"alpha_frac": 0.6182147165,
"autogenerated": false,
"ratio": 3.776765375854214,
"config_test": false,
"... |
# An investigation into simple python access to the critterbot/disco
# devices through the an interface similar to Thomas' java interface
import socket
import struct
import array
import time
#---------------- Drop Interface
class Dconst:
int_size=4
char_size=1
byte_size=1
time_size=8
num_leds=16
... | {
"repo_name": "jmodayil/rlai-critterbot",
"path": "support/scripts/python_client/critter.py",
"copies": "1",
"size": "10678",
"license": "apache-2.0",
"hash": -8717749214610564000,
"line_mean": 32.8984126984,
"line_max": 129,
"alpha_frac": 0.5780108635,
"autogenerated": false,
"ratio": 3.66186556... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.