text stringlengths 0 1.05M | meta dict |
|---|---|
''' Ammo producers '''
from .util import get_opener, FactoryBase
from .module_exceptions import ConfigurationError
from .guns.http2 import Http2Ammo
import logging
logger = logging.getLogger(__name__)
class LineReader(object):
''' One line -- one missile '''
def __init__(self, filename, **kwargs):
... | {
"repo_name": "direvius/bfg",
"path": "bfg/ammo.py",
"copies": "1",
"size": "2290",
"license": "mit",
"hash": -3124352313261592000,
"line_mean": 28.358974359,
"line_max": 78,
"alpha_frac": 0.5441048035,
"autogenerated": false,
"ratio": 3.982608695652174,
"config_test": true,
"has_no_keywords"... |
# Amnesia is a structure that automatically suppresses incoming weights gradually.
# In a way, a block will tend to forget what it's learnt and throw away unnecessary inputs
# The tendency to forget will counteract with the tendency to learn, until convergence.
# Incoming weights cannot be suppressed individually, sin... | {
"repo_name": "Fuchai/Philosophy-Machine",
"path": "amne/amnesia.py",
"copies": "1",
"size": "133047",
"license": "apache-2.0",
"hash": 4445425205281548300,
"line_mean": 97.994047619,
"line_max": 133,
"alpha_frac": 0.6418934662,
"autogenerated": false,
"ratio": 1.9261516634334193,
"config_test"... |
"""A model based controller framework."""
from __future__ import absolute_import
from __future__ import division
#from __future__ import google_type_annotations
from __future__ import print_function
import os
import inspect
currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
parentd... | {
"repo_name": "google-research/motion_imitation",
"path": "mpc_controller/locomotion_controller.py",
"copies": "1",
"size": "3201",
"license": "apache-2.0",
"hash": 8780771907206457000,
"line_mean": 31.3333333333,
"line_max": 86,
"alpha_frac": 0.6957200875,
"autogenerated": false,
"ratio": 3.5885... |
"""A model for one project."""
from google.appengine.ext import ndb
from ctc.models import user as user_model
SETTABLE_FIELDS = [
'name', 'overview', 'organization_name', 'organization_contact',
'organization_mission', 'details', 'collaboration_link', 'code_link']
class Project(ndb.Model):
"""A model fo... | {
"repo_name": "samking/code-the-change-projects",
"path": "ctc/models/project.py",
"copies": "1",
"size": "2188",
"license": "apache-2.0",
"hash": -8373537596364097000,
"line_mean": 36.724137931,
"line_max": 77,
"alpha_frac": 0.6878427788,
"autogenerated": false,
"ratio": 3.90017825311943,
"con... |
"""A model for one user."""
from google.appengine.ext import ndb
from google.appengine.api import users
class User(ndb.Model):
"""A model for one user."""
created_date = ndb.DateTimeProperty(required=True, auto_now_add=True)
email = ndb.StringProperty(required=True)
name = ndb.StringProperty(default="... | {
"repo_name": "samking/code-the-change-projects",
"path": "ctc/models/user.py",
"copies": "1",
"size": "1642",
"license": "apache-2.0",
"hash": 8719726212280259000,
"line_mean": 32.5102040816,
"line_max": 74,
"alpha_frac": 0.637637028,
"autogenerated": false,
"ratio": 3.937649880095923,
"config... |
"""A model for storing information about how specific images should
be cached on slaves. This helps with always having the correct image
ahead of time as well as garbage collecting unneeded images on slaves.
"""
from __future__ import absolute_import
from sqlalchemy import Column, DateTime, ForeignKey
from sqlalchemy... | {
"repo_name": "dropbox/changes",
"path": "changes/models/cached_snapshot_image.py",
"copies": "3",
"size": "1941",
"license": "apache-2.0",
"hash": 8131894671979353000,
"line_mean": 38.612244898,
"line_max": 88,
"alpha_frac": 0.7320968573,
"autogenerated": false,
"ratio": 4.441647597254004,
"co... |
"""A model for the relationship between a user and a project."""
from google.appengine.ext import ndb
from ctc.models import user as user_model
class Collaborator(ndb.Model):
"""A model for relationship between a user and a project."""
user_key = ndb.KeyProperty(required=True, kind=user_model.User)
creat... | {
"repo_name": "samking/code-the-change-projects",
"path": "ctc/models/collaborator.py",
"copies": "1",
"size": "1962",
"license": "apache-2.0",
"hash": 2753148261991698400,
"line_mean": 38.24,
"line_max": 79,
"alpha_frac": 0.7099898063,
"autogenerated": false,
"ratio": 3.6266173752310538,
"conf... |
"""A model of temperature diffusion over a rectangular plate."""
import numpy as np
import yaml
class Diffusion(object):
"""Model of temperature diffusion on a plate."""
def __init__(self, config_file=None):
"""Initialize the model."""
if config_file is not None:
with open(config... | {
"repo_name": "csdms/bmi-live-2017",
"path": "bmi_live/diffusion.py",
"copies": "1",
"size": "1677",
"license": "mit",
"hash": 7805895429506945000,
"line_mean": 30.0555555556,
"line_max": 77,
"alpha_frac": 0.5122242099,
"autogenerated": false,
"ratio": 3.479253112033195,
"config_test": false,
... |
"""A model organizes the training of a neural network.
The general structure, and especial the fit method, are similar to the keras
Model class.
"""
#%%
import copy
import numpy as np
import time
import warnings
import natural_bm.backend as B
import natural_bm.callbacks as cbks
from natural_bm.utils import merge_Ord... | {
"repo_name": "alexhunterlang/natural_bm",
"path": "natural_bm/models.py",
"copies": "1",
"size": "13928",
"license": "mit",
"hash": -5584103061338695000,
"line_mean": 37.1589041096,
"line_max": 89,
"alpha_frac": 0.5309448593,
"autogenerated": false,
"ratio": 4.569553805774278,
"config_test": t... |
"""A Model whose structure is defined by an ontology."""
from deepchem.models import TensorGraph
from deepchem.models.tensorgraph import layers
from deepchem.metrics import to_one_hot
from deepchem.utils import get_data_dir, download_url
import tensorflow as tf
import math
import os
class OntologyModel(TensorGraph):... | {
"repo_name": "ktaneishi/deepchem",
"path": "deepchem/models/tensorgraph/models/ontology.py",
"copies": "1",
"size": "14653",
"license": "mit",
"hash": 2828340441275304000,
"line_mean": 37.6622691293,
"line_max": 82,
"alpha_frac": 0.6424622944,
"autogenerated": false,
"ratio": 4.024443834111508,
... |
# A modification of rnn.py by Razvan Pascanu
import numpy as np
import theano
import theano.tensor as TT
from theano.compat.python2x import OrderedDict
# number of hidden units
n = 50
# number of input units
nin = 5
# number of output units
nout = 5
# input (where first dimension is time)
u = TT.matrix()
# target (wh... | {
"repo_name": "youralien/minet",
"path": "rnn.py",
"copies": "1",
"size": "2995",
"license": "bsd-3-clause",
"hash": -642208896489973400,
"line_mean": 30.8617021277,
"line_max": 109,
"alpha_frac": 0.6370617696,
"autogenerated": false,
"ratio": 2.974180734856008,
"config_test": false,
"has_no_... |
# A modification version from chainercv repository.
# (See https://github.com/chainer/chainercv/blob/master/chainercv/evaluations/eval_detection_voc.py)
from __future__ import division
import os
from collections import defaultdict
import numpy as np
from maskrcnn_benchmark.structures.bounding_box import BoxList
from m... | {
"repo_name": "mlperf/training_results_v0.6",
"path": "NVIDIA/benchmarks/maskrcnn/implementations/pytorch/maskrcnn_benchmark/data/datasets/evaluation/voc/voc_eval.py",
"copies": "4",
"size": "8153",
"license": "apache-2.0",
"hash": 286635414634895650,
"line_mean": 36.7453703704,
"line_max": 100,
"alp... |
"""A modified copy of ProxyTypes 0.9 (https://pypi.io/project/ProxyTypes/)."""
"""
========== NOTICE OF MODIFICATION ==========
This version HAS BEEN MODIFIED from the original 'proxies.py' file by Luke Deen
Taylor. The original file was published on July 20, 2006.
Modifications made on July 18, 2016:
- Rewriting ... | {
"repo_name": "controversial/ui2",
"path": "ui2/subclassing/proxytypes.py",
"copies": "1",
"size": "8322",
"license": "mit",
"hash": -4635998452837173000,
"line_mean": 31.6352941176,
"line_max": 79,
"alpha_frac": 0.6017784186,
"autogenerated": false,
"ratio": 4.051606621226874,
"config_test": f... |
"""A modified image folder class
We modify the official PyTorch image folder (https://github.com/pytorch/vision/blob/master/torchvision/datasets/folder.py)
so that this class can load images from both current directory and its subdirectories.
"""
import torch.utils.data as data
from PIL import Image
import os
IMG_E... | {
"repo_name": "google/retiming",
"path": "third_party/data/image_folder.py",
"copies": "1",
"size": "1913",
"license": "apache-2.0",
"hash": 316054085994140740,
"line_mean": 27.9848484848,
"line_max": 122,
"alpha_frac": 0.5969681129,
"autogenerated": false,
"ratio": 3.7145631067961165,
"config_... |
# A modified main pdb debugger loop (see pdb.py in the Python library!)
from pdb import *
import sys,os,traceback
def main():
mainpyfile = sys.argv[1] # Get script filename
if not os.path.exists(mainpyfile):
print 'Error:', mainpyfile, 'does not exist'
sys.exit(1)
del sys.argv[0] ... | {
"repo_name": "ArcherSys/ArcherSys",
"path": "Lua/SciTE/scite-debug/xpdb.py",
"copies": "1",
"size": "1418",
"license": "mit",
"hash": 3361615781902957600,
"line_mean": 32.7619047619,
"line_max": 81,
"alpha_frac": 0.6269393512,
"autogenerated": false,
"ratio": 3.6927083333333335,
"config_test":... |
# A modified version of https://github.com/petermuehlbacher/diffusion-maps-algorithm/blob/master/diffusion%20maps.py
# A python implementation of the diffusion maps algorithm introduced by [Lafon](https://sites.google.com/site/stefansresearchpapers/home/dissertation.pdf).
import numpy as np
from numpy import linalg as... | {
"repo_name": "govinda-kamath/clustering_on_transcript_compatibility_counts",
"path": "Trapnell_pipeline/diffusion_maps.py",
"copies": "1",
"size": "3935",
"license": "mit",
"hash": 272965916727974600,
"line_mean": 29.503875969,
"line_max": 155,
"alpha_frac": 0.5730622618,
"autogenerated": false,
... |
# A modified version of the implementation from the following paper:
# TENER: Adapting Transformer Encoder for Named Entity Recognition
# Hang Yan, Bocao Deng, Xiaonan Li, Xipeng Qiu
import math
import torch
import torch.nn.functional as F
from torch import Tensor, nn
from hanlp.common.structure import ConfigTracker
... | {
"repo_name": "hankcs/HanLP",
"path": "hanlp/layers/transformers/relative_transformer.py",
"copies": "1",
"size": "11300",
"license": "apache-2.0",
"hash": 8012631892058092000,
"line_mean": 33.1707317073,
"line_max": 120,
"alpha_frac": 0.5210563883,
"autogenerated": false,
"ratio": 3.352677236015... |
"""A module containg the JavaLikeScanner class."""
class JavaLikeScanner(object):
"""
A class which allows a given string to be scanned through and broken up into various tokens.
"""
def __init__(self, contents):
"""
Create the scanner and initalize its contents.
:param str contents: The contents of the sc... | {
"repo_name": "ExcaliburZero/javalikescanner",
"path": "javalikescanner/javalikescanner.py",
"copies": "1",
"size": "4414",
"license": "mit",
"hash": 8343071674538951000,
"line_mean": 28.0394736842,
"line_max": 98,
"alpha_frac": 0.6746714998,
"autogenerated": false,
"ratio": 3.5482315112540195,
... |
"""A module containing a canonicalized game"""
import functools
import numpy as np
from gameanalysis import gamereader
from gameanalysis import rsgame
from gameanalysis import utils
# TODO There's an issue here where incomplete payoffs for single strategy roles
# contribute to incomplete profiles. There's not an ob... | {
"repo_name": "egtaonline/GameAnalysis",
"path": "gameanalysis/canongame.py",
"copies": "1",
"size": "4228",
"license": "apache-2.0",
"hash": -5540206288041642000,
"line_mean": 32.824,
"line_max": 79,
"alpha_frac": 0.6199148534,
"autogenerated": false,
"ratio": 3.657439446366782,
"config_test":... |
'''A module containing a class for representing and manipulating
creature information from the Pathfinder RPG'''
import re
import string
__all__ = ['Creature']
ABILITIES = ['Str', 'Dex', 'Con', 'Int', 'Wis', 'Cha']
ATTRIBUTES = [
'DEFENSE', 'hp', 'AC', 'touch', 'flat-footed',
'Fort', 'Ref', 'Will', 'Def... | {
"repo_name": "lot9s/pathfinder-rpg-utils",
"path": "data-mining/bestiary/core/creature.py",
"copies": "1",
"size": "2074",
"license": "mit",
"hash": -5442362062639989000,
"line_mean": 28.6285714286,
"line_max": 66,
"alpha_frac": 0.4527483124,
"autogenerated": false,
"ratio": 3.1956856702619416,
... |
'''A module containing a class for representing a Pathfinder RPG character.'''
import json
from pf_class import PFClass
from pf_class_instance import PFClassInstance
__all__ = ['PFCharacter']
CLASS_DIR = "res/json/class/"
JSON_EXTENSION = ".json"
class PFCharacter(object):
'''Class representing a character... | {
"repo_name": "lot9s/pathfinder-rpg-utils",
"path": "character-sheets/core/pf_character.py",
"copies": "1",
"size": "3958",
"license": "mit",
"hash": 5267108699212380000,
"line_mean": 36.3396226415,
"line_max": 80,
"alpha_frac": 0.5851440121,
"autogenerated": false,
"ratio": 4.392896781354051,
... |
'''A module containing a class for representing a Pathfinder RPG
character\'s investment in a particular character class'''
from pf_class import PFClass
__all__ = ['PFClassInstance']
class PFClassInstance(object):
'''Class representing a Pathfinder RPG character\'s investment in a
particular character c... | {
"repo_name": "lot9s/pathfinder-rpg-utils",
"path": "character-sheets/core/pf_class_instance.py",
"copies": "1",
"size": "1723",
"license": "mit",
"hash": -2548139484598539300,
"line_mean": 29.2280701754,
"line_max": 78,
"alpha_frac": 0.5705165409,
"autogenerated": false,
"ratio": 3.9700460829493... |
'''A module containing a class for storing Creature objects in a
SQLite database.'''
import csv
import sqlite3
__all__ = ['CreatureDB']
class CreatureDB(object):
'''Class for storing Creature objects in a SQLite database.'''
def __init__(self, name='creature.db', use_nominal_cr=False):
self.... | {
"repo_name": "lot9s/pathfinder-rpg-utils",
"path": "data-mining/bestiary/db/creatureDB.py",
"copies": "1",
"size": "6403",
"license": "mit",
"hash": -6970374430452077000,
"line_mean": 33.7989130435,
"line_max": 70,
"alpha_frac": 0.5092925191,
"autogenerated": false,
"ratio": 4.352821210061183,
... |
"""A module containing a core representation of an IATI Dataset."""
from lxml import etree
import iati.exceptions
import iati.utilities
import iati.validator
class Dataset:
"""Representation of an IATI XML file that may be validated against a Schema.
Attributes:
xml_str (str): An XML string represent... | {
"repo_name": "IATI/iati.core",
"path": "iati/data.py",
"copies": "1",
"size": "10271",
"license": "mit",
"hash": -513188287255252540,
"line_mean": 39.12109375,
"line_max": 186,
"alpha_frac": 0.6252555739,
"autogenerated": false,
"ratio": 4.522677234698371,
"config_test": false,
"has_no_keywo... |
"""A module containing a core representation of IATI Codelists."""
import collections
from lxml import etree
import iati.resources
import iati.utilities
class Codelist:
"""Representation of a Codelist as defined within the IATI SSOT.
Attributes:
complete (bool): Whether the Codelist is complete or no... | {
"repo_name": "IATI/iati.core",
"path": "iati/codelists.py",
"copies": "1",
"size": "8670",
"license": "mit",
"hash": -4449260308753380400,
"line_mean": 32.7354085603,
"line_max": 217,
"alpha_frac": 0.6176470588,
"autogenerated": false,
"ratio": 4.668820678513732,
"config_test": false,
"has_n... |
"""A module containing a core representation of IATI Rulesets.
Todo:
Consider how we should handle lxml errors.
Remove references to `case`.
"""
# no-member errors are due to using `setattr()` # pylint: disable=no-member
import collections
import decimal
import json
import re
import sre_constants
from dateti... | {
"repo_name": "IATI/iati.core",
"path": "iati/rulesets.py",
"copies": "1",
"size": "35984",
"license": "mit",
"hash": -1227688374581741000,
"line_mean": 35.3474747475,
"line_max": 191,
"alpha_frac": 0.613355936,
"autogenerated": false,
"ratio": 4.424443624738719,
"config_test": false,
"has_no... |
"""A module containing a core representation of IATI Schemas."""
import collections
from lxml import etree
import iati.codelists
import iati.constants
import iati.exceptions
import iati.resources
import iati.utilities
class Schema:
"""Representation of a Schema as defined within the IATI SSOT. This is used as a b... | {
"repo_name": "IATI/iati.core",
"path": "iati/schemas.py",
"copies": "1",
"size": "9284",
"license": "mit",
"hash": 2082357394841270000,
"line_mean": 37.3636363636,
"line_max": 224,
"alpha_frac": 0.6460577337,
"autogenerated": false,
"ratio": 4.406264831514001,
"config_test": false,
"has_no_k... |
"""A module containing a core representation of IATI Version Numbers, plus how they are handled and compared.
Todo:
Check whether there is any other version-related functionality to bring into this module.
Ensure that everything in this module should be here.
"""
from decimal import Decimal
import re
import ... | {
"repo_name": "IATI/iati.core",
"path": "iati/version.py",
"copies": "1",
"size": "19616",
"license": "mit",
"hash": 6932783670576749000,
"line_mean": 35.6654205607,
"line_max": 193,
"alpha_frac": 0.6740925775,
"autogenerated": false,
"ratio": 4.428990742831339,
"config_test": false,
"has_no_... |
'''A module containing a function for building Creature objects from
root HtmlElement objects related to d20pfsrd.com Bestiary pages'''
import re
import string
from core.creature import Creature
__all__ = ['build']
ABILITIES = ['Str', 'Dex', 'Con', 'Int', 'Wis', 'Cha']
ATTRIBUTES = [
'DEFENSE', 'hp', 'AC', ... | {
"repo_name": "lot9s/pathfinder-rpg-utils",
"path": "data-mining/bestiary/core/builders/creature/d20pfsrd.py",
"copies": "1",
"size": "12506",
"license": "mit",
"hash": -249179587914230460,
"line_mean": 35.7823529412,
"line_max": 76,
"alpha_frac": 0.6418519111,
"autogenerated": false,
"ratio": 3.... |
"""A module containing analytical objects specific to a particular experiment.
"""
import os
import numpy as np
import pandas as pd
from whaler.analysis import Analysis
class Reactions():
"""
"""
def __init__(self):
self.A = Analysis()
# Analysis output filenames.
self.cr... | {
"repo_name": "tristanbrown/whaler",
"path": "whaler/custom.py",
"copies": "1",
"size": "7129",
"license": "mit",
"hash": -395039050241628600,
"line_mean": 32.3177570093,
"line_max": 116,
"alpha_frac": 0.4821153037,
"autogenerated": false,
"ratio": 3.2419281491587086,
"config_test": false,
"h... |
'''a module containing analytic tools necessary for understanding the
behavior of learning automata.'''
# Written by Steven Porretta.
class Tsetlin(object):
'''Analysis tools for the Tsetlin automaton.'''
def stationary_probability_analytic(c, N):
'''This computes the exact stationary probability... | {
"repo_name": "0xSteve/learning_automata_simulator",
"path": "analyse_LA.py",
"copies": "1",
"size": "1615",
"license": "mit",
"hash": -7076460461305947000,
"line_mean": 34.8888888889,
"line_max": 74,
"alpha_frac": 0.5523219814,
"autogenerated": false,
"ratio": 3.5809312638580932,
"config_test"... |
"""A module containing classes for move refactoring
`create_move()` is a factory for creating move refactoring objects
based on inputs.
"""
from rope.base import (pyobjects, codeanalyze, exceptions, pynames,
taskhandle, evaluate, worder, libutils)
from rope.base.change import ChangeSet, ChangeC... | {
"repo_name": "ruchee/vimrc",
"path": "vimfiles/bundle/vim-python/submodules/rope/rope/refactor/move.py",
"copies": "3",
"size": "33302",
"license": "mit",
"hash": 446212810677330100,
"line_mean": 41.4770408163,
"line_max": 80,
"alpha_frac": 0.5986427242,
"autogenerated": false,
"ratio": 4.141524... |
"""A module containing classes for move refactoring
`create_move()` is a factory for creating move refactoring objects
based on inputs.
"""
from rope.base import pyobjects, codeanalyze, exceptions, pynames, taskhandle, evaluate, worder
from rope.base.change import ChangeSet, ChangeContents, MoveResource
from rope.ref... | {
"repo_name": "seawaywen/vim-config",
"path": "bundle/python-mode/pymode/libs3/rope/refactor/move.py",
"copies": "32",
"size": "26600",
"license": "apache-2.0",
"hash": 6179609204233381000,
"line_mean": 41.3566878981,
"line_max": 95,
"alpha_frac": 0.6083458647,
"autogenerated": false,
"ratio": 4.... |
"""A module containing convenient methods for general machine learning"""
from __future__ import print_function
from __future__ import division
from __future__ import unicode_literals
from __future__ import absolute_import
from builtins import zip
from builtins import int
from builtins import range
from future import ... | {
"repo_name": "wittawatj/kernel-gof",
"path": "kgof/util.py",
"copies": "1",
"size": "9350",
"license": "mit",
"hash": -1391773571418708000,
"line_mean": 27.1626506024,
"line_max": 104,
"alpha_frac": 0.5960427807,
"autogenerated": false,
"ratio": 3.2476554359152483,
"config_test": false,
"has... |
"""A module containing convenient methods for general machine learning"""
from __future__ import print_function
from builtins import object
__author__ = 'wittawat'
import autograd.numpy as np
import time
class ContextTimer(object):
"""
A class used to time an executation of a code snippet.
Use it with w... | {
"repo_name": "wittawatj/interpretable-test",
"path": "freqopttest/util.py",
"copies": "1",
"size": "5510",
"license": "mit",
"hash": -2589667794061698000,
"line_mean": 27.8481675393,
"line_max": 85,
"alpha_frac": 0.598185118,
"autogenerated": false,
"ratio": 3.390769230769231,
"config_test": f... |
"""A module containing convenient methods for general machine learning"""
__author__ = 'wittawat'
import numpy as np
import time
class ContextTimer(object):
"""
A class used to time an executation of a code snippet.
Use it with with .... as ...
For example,
with ContextTimer() as t:
... | {
"repo_name": "Diviyan-Kalainathan/causal-humans",
"path": "Cause-effect/lib/fsic/util.py",
"copies": "3",
"size": "9209",
"license": "mit",
"hash": 4800485878089776000,
"line_mean": 25.9269005848,
"line_max": 117,
"alpha_frac": 0.5748724074,
"autogenerated": false,
"ratio": 3.003587736464449,
... |
""" A module containing example functions for reading and plotting user output
It is important to make sure the functions work as the error messages can be
varied and messy to handle. The software raises ImportError if there is
something wrong with importing or running the code.
"""
import matplotlib.pyplot as plt
... | {
"repo_name": "smarisa/sdpt11",
"path": "neronet/scripts/example.py",
"copies": "2",
"size": "2671",
"license": "mit",
"hash": 8054393256256765000,
"line_mean": 32.8101265823,
"line_max": 78,
"alpha_frac": 0.6166229876,
"autogenerated": false,
"ratio": 4.016541353383459,
"config_test": false,
... |
'''A module containing functions that allow one to scrape data from
the Bestiary pages of d20pfsrd.com and place it in a database'''
import argparse
import traceback
from lxml.html import parse
from core.builders.creature.d20pfsrd import build as d20_build
from core.builders.creature.dict import build as dict_build
... | {
"repo_name": "lot9s/pathfinder-rpg-utils",
"path": "data-mining/bestiary/crawler.py",
"copies": "1",
"size": "10350",
"license": "mit",
"hash": 6754591112642021000,
"line_mean": 34.2040816327,
"line_max": 80,
"alpha_frac": 0.6418357488,
"autogenerated": false,
"ratio": 3.7870472008781557,
"con... |
"""A module containing `numpy`-specific plugins for mypy."""
from __future__ import annotations
import typing as t
import numpy as np
try:
import mypy.types
from mypy.types import Type
from mypy.plugin import Plugin, AnalyzeTypeContext
from mypy.nodes import MypyFile, ImportFrom, Statement
from ... | {
"repo_name": "anntzer/numpy",
"path": "numpy/typing/mypy_plugin.py",
"copies": "6",
"size": "4408",
"license": "bsd-3-clause",
"hash": -3188405779034545000,
"line_mean": 32.6488549618,
"line_max": 88,
"alpha_frac": 0.5798548094,
"autogenerated": false,
"ratio": 3.704201680672269,
"config_test"... |
"""A module containing tests for the library representation of Codelists."""
import copy
import pytest
from lxml import etree
import iati.codelists
class TestCodelistsNonClass:
"""Test codelists functionality that is not contained within a class.
Note:
There was once functionality regarding mapping f... | {
"repo_name": "IATI/iati.core",
"path": "iati/tests/test_codelists.py",
"copies": "1",
"size": "10333",
"license": "mit",
"hash": -5273858268014389000,
"line_mean": 39.36328125,
"line_max": 157,
"alpha_frac": 0.6602148456,
"autogenerated": false,
"ratio": 3.7089016511127064,
"config_test": true... |
"""A module containing tests for the library representation of default values."""
import pytest
import iati.codelists
import iati.constants
import iati.default
import iati.schemas
import iati.tests.utilities
class TestDefault:
"""A container for tests relating to Default data."""
@pytest.fixture(params=[
... | {
"repo_name": "IATI/iati.core",
"path": "iati/tests/test_default.py",
"copies": "1",
"size": "20111",
"license": "mit",
"hash": -5403593243775354000,
"line_mean": 47.34375,
"line_max": 312,
"alpha_frac": 0.6844512953,
"autogenerated": false,
"ratio": 3.851944072016855,
"config_test": true,
"h... |
"""A module containing tests for the library representation of IATI data.
Todo:
Implement tests for strict checking once validation work is underway.
"""
import collections
import math
from lxml import etree
import pytest
import iati.data
import iati.default
import iati.tests.utilities
class TestDatasets:
""... | {
"repo_name": "IATI/iati.core",
"path": "iati/tests/test_data.py",
"copies": "1",
"size": "28049",
"license": "mit",
"hash": 5162484489800089000,
"line_mean": 44.906710311,
"line_max": 250,
"alpha_frac": 0.6515383793,
"autogenerated": false,
"ratio": 3.8624345910217572,
"config_test": true,
"... |
"""A module containing tests for the pyIATI representation of Standard metadata."""
import copy
import math
import operator
import pytest
import iati.tests.utilities
from iati.tests.fixtures.versions import iativer, semver, split_decimal, split_iativer, split_semver
class TestVersionInit:
"""A container for tests... | {
"repo_name": "IATI/iati.core",
"path": "iati/tests/test_version.py",
"copies": "1",
"size": "30006",
"license": "mit",
"hash": -6450290303974735000,
"line_mean": 48.3519736842,
"line_max": 213,
"alpha_frac": 0.6863960541,
"autogenerated": false,
"ratio": 3.8802534592008278,
"config_test": true... |
""" A module containing the default routes. """
from flask import Blueprint, render_template, abort, session, redirect, url_for, request
from jinja2 import TemplateNotFound
from forms import RatingForm
from datetime import datetime
import Pyro4
import requests
ES_URL = 'https://search-net302test-hsws64h5osjjsdgl7krzl3... | {
"repo_name": "Sciprios/RateMyNewsUI",
"path": "rate_my_news_ui/default.py",
"copies": "1",
"size": "2082",
"license": "mit",
"hash": -1677727952098270700,
"line_mean": 39.0384615385,
"line_max": 151,
"alpha_frac": 0.6325648415,
"autogenerated": false,
"ratio": 3.528813559322034,
"config_test":... |
"""A module containing validation functionality."""
import sys
from lxml import etree
import yaml
import iati.default
import iati.resources
class ValidationError:
"""A base class to encapsulate information about Validation Errors."""
# pylint: disable=too-many-instance-attributes
def __init__(self, err_... | {
"repo_name": "IATI/iati.core",
"path": "iati/validator.py",
"copies": "1",
"size": "29558",
"license": "mit",
"hash": -4691988290062403000,
"line_mean": 34.5264423077,
"line_max": 205,
"alpha_frac": 0.656167535,
"autogenerated": false,
"ratio": 4.133407914976926,
"config_test": true,
"has_no... |
""" A module designed to hold onto encode.* decorated functions. Each
function decorated by encode is returned untouched. However, they
are registered within this module for retrieval by factories when
encoding from a pymm element.
This module (and it's decorations) should be used in-place of
writin... | {
"repo_name": "lancekindle/pymm",
"path": "pymm/encode.py",
"copies": "1",
"size": "2293",
"license": "mit",
"hash": 1937283328937140200,
"line_mean": 37.2166666667,
"line_max": 71,
"alpha_frac": 0.7296118622,
"autogenerated": false,
"ratio": 4.326415094339622,
"config_test": false,
"has_no_k... |
"""A module designed to interact with SCSGate.
See:
https://github.com/flavio/scsgate
"""
# 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 descri... | {
"repo_name": "flavio/scsgate",
"path": "setup.py",
"copies": "1",
"size": "3044",
"license": "mit",
"hash": 6304226218097423000,
"line_mean": 31.7311827957,
"line_max": 79,
"alpha_frac": 0.6596583443,
"autogenerated": false,
"ratio": 4.037135278514588,
"config_test": false,
"has_no_keywords"... |
''' A moduled used by maxent.py and phlearn.py to find the ideal weights for a tableau.
'''
import megatableau
import scipy, scipy.optimize
import math
import numpy as np
### HELPER FUNCTIONS FOR CALCULATING PROBABILITY ###
def maxent_value(weights, tableau, ur, sr):
""" Compute maxent value P* = exp(harmony) fo... | {
"repo_name": "rdaland/PhoMEnt",
"path": "optimizer.py",
"copies": "1",
"size": "4662",
"license": "bsd-3-clause",
"hash": 2370169338653923300,
"line_mean": 37.85,
"line_max": 112,
"alpha_frac": 0.6314886315,
"autogenerated": false,
"ratio": 3.190965092402464,
"config_test": false,
"has_no_ke... |
# Copyright 2015 Steven G. Decker
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writin... | {
"repo_name": "sgdecker/pygempak",
"path": "gempak.py",
"copies": "1",
"size": "3626",
"license": "apache-2.0",
"hash": -2628176378530501000,
"line_mean": 37.1684210526,
"line_max": 77,
"alpha_frac": 0.5579150579,
"autogenerated": false,
"ratio": 3.1668122270742356,
"config_test": false,
"has... |
""" A module for command parsing
The command module deals with parsing a cli command properly. It supports
abbreviated commands ("a" is parsed as the command "add" if there is no
other command beginning with "a" on that level) and has methods useful for
tab completion of both commands and external valu... | {
"repo_name": "fredsod/NIPAP",
"path": "nipap-cli/nipap_cli/command.py",
"copies": "4",
"size": "9996",
"license": "mit",
"hash": 5797237855453652000,
"line_mean": 34.0736842105,
"line_max": 105,
"alpha_frac": 0.5423169268,
"autogenerated": false,
"ratio": 4.730714623757691,
"config_test": fals... |
"""A module for computing regret and social welfare of profiles"""
import itertools
import multiprocessing
import numpy as np
from scipy import optimize
def pure_strategy_deviation_gains(game, prof):
"""Returns the pure strategy deviations gains
The result is a compact array of deviation gains. Each element... | {
"repo_name": "yackj/GameAnalysis",
"path": "gameanalysis/regret.py",
"copies": "1",
"size": "8072",
"license": "apache-2.0",
"hash": 6019105604549840000,
"line_mean": 37.2559241706,
"line_max": 79,
"alpha_frac": 0.6278493558,
"autogenerated": false,
"ratio": 3.664094416704494,
"config_test": f... |
"""A module for computing regret and social welfare of profiles"""
import numpy as np
def pure_strategy_deviation_pays(game, profile):
"""Returns the pure strategy deviation payoffs
The result is a compact array of deviation payoffs. Each element
corresponds to the payoff of deviating to strategy i from ... | {
"repo_name": "egtaonline/GameAnalysis",
"path": "gameanalysis/regret.py",
"copies": "1",
"size": "3845",
"license": "apache-2.0",
"hash": -7474672418785447000,
"line_mean": 36.6960784314,
"line_max": 79,
"alpha_frac": 0.6520156047,
"autogenerated": false,
"ratio": 3.4986351228389445,
"config_t... |
"""A module for consuming the Penn Dining API"""
import datetime
from .base import WrapperBase
BASE_URL = "https://esb.isc-seo.upenn.edu/8091/open_data/dining/"
V2_BASE_URL = "https://esb.isc-seo.upenn.edu/8091/open_data/dining/v2/?service="
ENDPOINTS = {
'MENUS': BASE_URL + 'menus',
'VENUES': BASE_URL + 've... | {
"repo_name": "pennlabs/penn-sdk-python",
"path": "penn/dining.py",
"copies": "1",
"size": "8193",
"license": "mit",
"hash": 6292493504977225000,
"line_mean": 36.5825688073,
"line_max": 133,
"alpha_frac": 0.5612107897,
"autogenerated": false,
"ratio": 3.6364846870838883,
"config_test": false,
... |
"""A module for consuming the Penn Registrar API"""
from os import path
import requests
from base import WrapperBase
BASE_URL = "https://esb.isc-seo.upenn.edu/8091/open_data/transit/"
ENDPOINTS = {
'APC': BASE_URL + 'apc',
'MDT': BASE_URL + 'mdt',
'TRANSAPC': BASE_URL + 'transapc',
'STOPINVENTORY': BAS... | {
"repo_name": "parkerh/freeclassrooms",
"path": "penn/transit.py",
"copies": "1",
"size": "2640",
"license": "mit",
"hash": 3841105784985343000,
"line_mean": 27.085106383,
"line_max": 77,
"alpha_frac": 0.5598484848,
"autogenerated": false,
"ratio": 3.5246995994659547,
"config_test": false,
"h... |
"""A module for consuming the Penn Registrar API"""
from os import path
import requests
from base import WrapperBase
BASE_URL = "https://esb.isc-seo.upenn.edu/8091/open_data/dining/"
ENDPOINTS = {
'MENUS': BASE_URL + 'menus',
'VENUES': BASE_URL + 'venues',
}
class Dining(WrapperBase):
"""The client for t... | {
"repo_name": "parkerh/freeclassrooms",
"path": "penn/dining.py",
"copies": "1",
"size": "1652",
"license": "mit",
"hash": 8990904504336362000,
"line_mean": 27,
"line_max": 91,
"alpha_frac": 0.6047215496,
"autogenerated": false,
"ratio": 3.6792873051224944,
"config_test": false,
"has_no_keywo... |
"""A module for consuming the Penn Transit API"""
from .base import WrapperBase
BASE_URL = "https://esb.isc-seo.upenn.edu/8091/open_data/transit/"
ENDPOINTS = {
'APC': BASE_URL + 'apc',
'MDT': BASE_URL + 'mdt',
'TRANSAPC': BASE_URL + 'transapc',
'STOPINVENTORY': BASE_URL + 'stopinventory',
'STOPTIM... | {
"repo_name": "pennlabs/penn-sdk-python",
"path": "penn/transit.py",
"copies": "1",
"size": "4065",
"license": "mit",
"hash": 5326973518133533000,
"line_mean": 30.0305343511,
"line_max": 74,
"alpha_frac": 0.5761377614,
"autogenerated": false,
"ratio": 4.012833168805528,
"config_test": true,
"... |
"""A module for creating docstrings for sphinx ``data`` domains."""
import re
import textwrap
_docstrings_list = []
def add_newdoc(name, value, doc):
_docstrings_list.append((name, value, doc))
def _parse_docstrings():
type_list_ret = []
for name, value, doc in _docstrings_list:
s = textwrap.d... | {
"repo_name": "anntzer/numpy",
"path": "numpy/typing/_add_docstring.py",
"copies": "4",
"size": "2605",
"license": "bsd-3-clause",
"hash": -864408812808923100,
"line_mean": 26.1354166667,
"line_max": 88,
"alpha_frac": 0.5393474088,
"autogenerated": false,
"ratio": 3.847858197932053,
"config_tes... |
"""A module for creating docstrings for sphinx ``data`` domains."""
import re
import textwrap
from ._generic_alias import NDArray
_docstrings_list = []
def add_newdoc(name: str, value: str, doc: str) -> None:
"""Append ``_docstrings_list`` with a docstring for `name`.
Parameters
----------
name : ... | {
"repo_name": "numpy/numpy",
"path": "numpy/typing/_add_docstring.py",
"copies": "2",
"size": "3815",
"license": "bsd-3-clause",
"hash": -3897951223405970000,
"line_mean": 25.6783216783,
"line_max": 88,
"alpha_frac": 0.5533420708,
"autogenerated": false,
"ratio": 3.8380281690140845,
"config_tes... |
"""A module for dealing with BMP bitmap image files."""
def write_grayscale(filename, pixels):
"""Create and write a grayscale BMP file."""
"""
Args:
filename: The name of the BMP file to be created.
pixels: A rectangular image stored as a sequence of rows.
Each row must be an... | {
"repo_name": "carlb15/Python",
"path": "bmp.py",
"copies": "1",
"size": "4090",
"license": "mit",
"hash": 261625247587111260,
"line_mean": 30.4615384615,
"line_max": 76,
"alpha_frac": 0.5655256724,
"autogenerated": false,
"ratio": 3.513745704467354,
"config_test": false,
"has_no_keywords": f... |
"""A module for dealing with BMP bitmap image files."""
def write_grayscale(filename, pixels):
"""Creates and writes a grayscale BMP file
Args:
filename: The name of the BMP file to be crated.
pixels: A rectangular image stored as a sequence of rows.
Each row must be an iterable ... | {
"repo_name": "kentoj/python-fundamentals",
"path": "bmp.py",
"copies": "1",
"size": "3588",
"license": "mit",
"hash": 929341682898686500,
"line_mean": 33.1714285714,
"line_max": 95,
"alpha_frac": 0.5847268673,
"autogenerated": false,
"ratio": 3.3160813308687613,
"config_test": false,
"has_no... |
"""A module for defining structured request species.
:author: Matthew Gidden <matthew.gidden _at_ gmail.com>
"""
import itertools
import numpy as np
import random
import math
from collections import OrderedDict, defaultdict, Iterable
from cyclopts import tools as cyctools
from cyclopts import cyclopts_io as cycio
fr... | {
"repo_name": "gidden/cyclopts",
"path": "cyclopts/structured_species/request.py",
"copies": "1",
"size": "18085",
"license": "bsd-3-clause",
"hash": -5246458175752097000,
"line_mean": 35.9836400818,
"line_max": 92,
"alpha_frac": 0.540945535,
"autogenerated": false,
"ratio": 3.786641541038526,
... |
"""A module for defining structured supply species.
:author: Matthew Gidden <matthew.gidden _at_ gmail.com>
"""
import itertools
import numpy as np
import random
import math
from collections import OrderedDict, defaultdict, Iterable, namedtuple
from cyclopts import tools as cyctools
from cyclopts import cyclopts_io ... | {
"repo_name": "gidden/cyclopts",
"path": "cyclopts/structured_species/supply.py",
"copies": "1",
"size": "18552",
"license": "bsd-3-clause",
"hash": -1422654497562031600,
"line_mean": 37.4099378882,
"line_max": 92,
"alpha_frac": 0.5495903407,
"autogenerated": false,
"ratio": 3.860978147762747,
... |
"""A module for displaying tabular data to humans.
This is currently a work in progress.
Example:
--------
from ... import table
...
t = t.Table(padding=1)
t.SetColumns(['Country', 'Total Population', 'Populous Cities'])
t.AppendRow(['China', '1,354,040,000',
['Shanghai', 'Beijing', 'Tianji... | {
"repo_name": "ychen820/microblog",
"path": "y/google-cloud-sdk/.install/.backup/platform/gcutil/lib/google_compute_engine/gcutil_lib/table/table.py",
"copies": "4",
"size": "32076",
"license": "bsd-3-clause",
"hash": 6348894764527780000,
"line_mean": 30.8846918489,
"line_max": 80,
"alpha_frac": 0.61... |
"""A module for dynamic, incremental ctypes code generation.
See the 'include' function for usage information.
"""
import sys
import os
import time
import bz2
import cPickle
import tempfile
try:
# md5 is deprecated in Python 2.5, so use hashlib if available
from hashlib import md5
except ImportError:
from ... | {
"repo_name": "luzfcb/ctypeslib",
"path": "ctypeslib/dynamic_module.py",
"copies": "1",
"size": "9763",
"license": "mit",
"hash": -4425632373919867000,
"line_mean": 33.1363636364,
"line_max": 90,
"alpha_frac": 0.5813786746,
"autogenerated": false,
"ratio": 4.110736842105263,
"config_test": fals... |
"""A module for dynamic, incremental ctypes code generation.
See the 'include' function for usage information.
"""
import sys, os, time, bz2, cPickle, tempfile
try:
# md5 is deprecated in Python 2.5, so use hashlib if available
from hashlib import md5
except ImportError:
from md5 import new as md5
import ... | {
"repo_name": "sugarmanz/ctypeslib",
"path": "ctypeslib/dynamic_module.py",
"copies": "1",
"size": "9680",
"license": "mit",
"hash": 3817550622574953000,
"line_mean": 35.1194029851,
"line_max": 99,
"alpha_frac": 0.5832644628,
"autogenerated": false,
"ratio": 4.091293322062553,
"config_test": fa... |
"""A module for extracting information from lists of dicts for creating
geodatabase fields.
"""
from __future__ import (
absolute_import, print_function, unicode_literals, division)
import re
from datetime import date, time, datetime
FIELD_TYPE_TEXT = "TEXT"
FIELD_TYPE_FLOAT = "FLOAT"
FIELD_TYPE_DOUBLE = "DOUBL... | {
"repo_name": "WSDOT-GIS/wsdot-traffic-gp",
"path": "wsdottraffic/fielddetection.py",
"copies": "1",
"size": "5368",
"license": "unlicense",
"hash": -2328973715128310000,
"line_mean": 29.5,
"line_max": 77,
"alpha_frac": 0.5702309985,
"autogenerated": false,
"ratio": 4.005970149253732,
"config_t... |
"""A module for forms used"""
from wtforms import StringField, PasswordField, validators, SubmitField, TextAreaField
from flask_wtf import FlaskForm
class SignupForm(FlaskForm):
"""The signup form"""
email = StringField(
'Email Address',
[
validators.data_required(),
val... | {
"repo_name": "indungu/yummy-recipes",
"path": "app/forms.py",
"copies": "1",
"size": "3058",
"license": "mit",
"hash": 5007774018050441000,
"line_mean": 36.2926829268,
"line_max": 98,
"alpha_frac": 0.5977763244,
"autogenerated": false,
"ratio": 4.149253731343284,
"config_test": false,
"has_n... |
"""A module for function minimization."""
# pylint: disable=too-many-arguments, too-many-instance-attributes
from average import EWMA
import numpy as np
from num_utils import saxpy, BILINEAR, sdot, EPS, resize, roll2
class AdamOptimizer:
"""Implements the Adam gradient descent optimizer [4] with iterate averag... | {
"repo_name": "crowsonkb/style_transfer",
"path": "optimizers.py",
"copies": "1",
"size": "4835",
"license": "mit",
"hash": 1740575003854315300,
"line_mean": 34.0362318841,
"line_max": 93,
"alpha_frac": 0.5677352637,
"autogenerated": false,
"ratio": 3.2602832097100474,
"config_test": false,
"... |
""" A module for handling HiSeq-specific files and folders
"""
import os
import glob
import csv
import scilifelab.illumina as illumina
class HiSeqRun(illumina.IlluminaRun):
def __init__(self, run_dir, samplesheet=None):
illumina.IlluminaRun.__init__(self, run_dir, samplesheet)
if self.samplesheet_... | {
"repo_name": "kate-v-stepanova/scilifelab",
"path": "scilifelab/illumina/hiseq.py",
"copies": "4",
"size": "4389",
"license": "mit",
"hash": 3364563665902037500,
"line_mean": 35.8823529412,
"line_max": 122,
"alpha_frac": 0.5532011848,
"autogenerated": false,
"ratio": 4.31988188976378,
"config_... |
# a module for handling interaction with the Flickr photo-sharing service
import os
import urllib, urllib2, urlparse, mimetools, mimetypes
import xml.dom.minidom
import hashlib
import random
from fetch import GET_CMD, Request
API_KEY="f29c6d8fa5d950131c4ae13adc55700d"
SECRET="037ec6eec0e91cab"
BASE_URL="http://www.... | {
"repo_name": "ericchill/gnofract4d",
"path": "fractutils/flickr.py",
"copies": "1",
"size": "8915",
"license": "bsd-3-clause",
"hash": 2372287830133748700,
"line_mean": 29.1182432432,
"line_max": 104,
"alpha_frac": 0.6259113853,
"autogenerated": false,
"ratio": 3.629885993485342,
"config_test"... |
""" A module for handling MiSeq-specific files and folders
"""
import os
import re
import glob
from collections import OrderedDict, defaultdict
import scilifelab.illumina as illumina
from scilifelab.illumina.hiseq import HiSeqSampleSheet
def group_fastq_files(fastq_files):
"""Divide the input fastq files into ... | {
"repo_name": "senthil10/scilifelab",
"path": "scilifelab/illumina/miseq.py",
"copies": "4",
"size": "8622",
"license": "mit",
"hash": -7939207240046575000,
"line_mean": 35.8504273504,
"line_max": 101,
"alpha_frac": 0.5213407562,
"autogenerated": false,
"ratio": 4.03085553997195,
"config_test":... |
"""A module for housing the Cursor class.
Exported Classes:
Cursor -- Class for representing a database cursor.
"""
from collections import deque
from .statement import Statement, PreparedStatement
from .exception import Error, NotSupportedError, ProgrammingError
class Cursor(object):
"""Class for represent... | {
"repo_name": "tvincentNuoDB/nuodb-python",
"path": "pynuodb/cursor.py",
"copies": "1",
"size": "8518",
"license": "bsd-3-clause",
"hash": -8210587714487926000,
"line_mean": 31.3878326996,
"line_max": 100,
"alpha_frac": 0.6021366518,
"autogenerated": false,
"ratio": 4.586968228325256,
"config_t... |
"""A module for housing the datatype classes.
Exported Classes:
Binary -- Class for a Binary object
Exported Functions:
DateFromTicks -- Converts ticks to a Date object.
TimeFromTicks -- Converts ticks to a Time object.
TimestampFromTicks -- Converts ticks to a Timestamp object.
DateToTicks -- Converts a Date object ... | {
"repo_name": "tvincentNuoDB/nuodb-python",
"path": "pynuodb/datatype.py",
"copies": "2",
"size": "4870",
"license": "bsd-3-clause",
"hash": -5951563940907047000,
"line_mean": 32.3561643836,
"line_max": 152,
"alpha_frac": 0.6406570842,
"autogenerated": false,
"ratio": 3.9116465863453813,
"confi... |
"""A module for implementing interaction between MIDI and SequenceGenerators."""
import abc
import threading
import time
# internal imports
import tensorflow as tf
from magenta.protobuf import generator_pb2
from magenta.protobuf import music_pb2
class MidiInteractionException(Exception):
"""Base class for except... | {
"repo_name": "hanzorama/magenta",
"path": "magenta/interfaces/midi/midi_interaction.py",
"copies": "1",
"size": "9737",
"license": "apache-2.0",
"hash": -3038283948923979300,
"line_mean": 36.30651341,
"line_max": 80,
"alpha_frac": 0.686042929,
"autogenerated": false,
"ratio": 3.954914703493095,
... |
"""A module for implementing interaction between MIDI and SequenceGenerators."""
import abc
import threading
import time
# internal imports
import tensorflow as tf
import magenta
from magenta.protobuf import generator_pb2
from magenta.protobuf import music_pb2
class MidiInteractionException(Exception):
"""Base c... | {
"repo_name": "YoshikawaMasashi/magenta",
"path": "magenta/interfaces/midi/midi_interaction.py",
"copies": "2",
"size": "20665",
"license": "apache-2.0",
"hash": -1082898153736650000,
"line_mean": 39.5992141454,
"line_max": 80,
"alpha_frac": 0.66682797,
"autogenerated": false,
"ratio": 4.13630904... |
"""A module for inferring objects
For more information see the documentation in `rope.base.oi`
package.
"""
import rope.base.builtins
import rope.base.pynames
import rope.base.pyobjects
from rope.base import evaluate, utils, arguments
from rope.base.oi.type_hinting.factory import get_type_hinting_factory
_ignore_in... | {
"repo_name": "zrzka/blackmamba",
"path": "blackmamba/lib/rope/base/oi/soi.py",
"copies": "1",
"size": "7894",
"license": "mit",
"hash": -4675897874265190000,
"line_mean": 34.5585585586,
"line_max": 111,
"alpha_frac": 0.6513807955,
"autogenerated": false,
"ratio": 3.8848425196850394,
"config_te... |
# a module for interacting with Amazon SimpleDB using Python pandas (and boto of course)
import pandas as pd
import boto.sdb
import datetime as dt
import dataframe_utils
from datetime_utils import *
class Creds:
def __init__(self, ID, secret):
self.ID = ID
self.secret = secret
# a domain is equiva... | {
"repo_name": "petergaultney/dataframe-browser",
"path": "sdb_utils.py",
"copies": "1",
"size": "3031",
"license": "bsd-3-clause",
"hash": -7388053325372506000,
"line_mean": 35.0833333333,
"line_max": 98,
"alpha_frac": 0.5856153085,
"autogenerated": false,
"ratio": 3.8367088607594937,
"config_t... |
"""A module for interactive testing.
Use:
$ python
>>> from csrv.model import setup_game
>>> setup_game.play()
this will prompt you for responses to choices if you break out at any point you
can access the game object as 'setup_game.g' and can resume the interactive
play with setup_game.play(setup_game.g)
"""
... | {
"repo_name": "mrroach/CentralServer",
"path": "csrv/model/setup_game.py",
"copies": "1",
"size": "3216",
"license": "apache-2.0",
"hash": 1096238321573087900,
"line_mean": 32.8526315789,
"line_max": 95,
"alpha_frac": 0.6203358209,
"autogenerated": false,
"ratio": 3.403174603174603,
"config_tes... |
"""A module for interfacing with the MIDI environment."""
import abc
from collections import defaultdict
from collections import deque
import Queue
import re
import threading
import time
# internal imports
import mido
import tensorflow as tf
# TODO(adarob): Use flattened imports.
from magenta.common import concurren... | {
"repo_name": "YoshikawaMasashi/magenta",
"path": "magenta/interfaces/midi/midi_hub.py",
"copies": "2",
"size": "42110",
"license": "apache-2.0",
"hash": -8017975807528309000,
"line_mean": 34.8688245315,
"line_max": 80,
"alpha_frac": 0.6564948943,
"autogenerated": false,
"ratio": 3.91356877323420... |
"""A module for interfacing with the MIDI environment."""
import abc
from collections import deque
import logging
import Queue
import re
import threading
import time
# internal imports
import mido
# TODO(adarob): Use flattened imports.
from magenta.common import concurrency
from magenta.protobuf import music_pb2
_D... | {
"repo_name": "hanzorama/magenta",
"path": "magenta/interfaces/midi/midi_hub.py",
"copies": "1",
"size": "36483",
"license": "apache-2.0",
"hash": 8382323773509153000,
"line_mean": 34.3860329777,
"line_max": 80,
"alpha_frac": 0.6537017241,
"autogenerated": false,
"ratio": 3.8944278394534586,
"c... |
"""A module for I/O helper functions, classes, etc."""
from collections import defaultdict
import cyclopts.tools as tools
class PathMap(object):
"""A simple container class for mapping columns to Hdf5 paths"""
def __init__(self, col=None):
"""Parameters
----------
col : str
... | {
"repo_name": "gidden/cyclopts",
"path": "cyclopts/io_tools.py",
"copies": "1",
"size": "3536",
"license": "bsd-3-clause",
"hash": 3760035189876235300,
"line_mean": 28.4666666667,
"line_max": 84,
"alpha_frac": 0.6043552036,
"autogenerated": false,
"ratio": 3.8351409978308024,
"config_test": fal... |
"""A module for Jython emulating (a small part of) CPython's multiprocessing.
With this, pygrametl can be made to use multiprocessing, but actually use
threads when used from Jython (where there is no GIL).
"""
# Copyright (c) 2011-2014, Aalborg University (chr@cs.aau.dk)
# All rights reserved.
# Redistribution... | {
"repo_name": "JimHagan/pygrametl",
"path": "pygrametl/jythonmultiprocessing.py",
"copies": "2",
"size": "2189",
"license": "bsd-2-clause",
"hash": -8805146009805427000,
"line_mean": 36.7413793103,
"line_max": 80,
"alpha_frac": 0.7565098218,
"autogenerated": false,
"ratio": 4.18546845124283,
"c... |
""" A module for Jython emulating (a small part of) CPython's multiprocessing.
With this, pygrametl can be made to use multiprocessing, but actually use threads when used from Jython (where there is no GIL).
"""
# Copyright (c) 2011, Christian Thomsen (chr@cs.aau.dk)
# All rights reserved.
# Redistribution ... | {
"repo_name": "lecs/pygrametl",
"path": "jythonmultiprocessing.py",
"copies": "2",
"size": "2161",
"license": "bsd-2-clause",
"hash": 2305804740471828000,
"line_mean": 42.22,
"line_max": 138,
"alpha_frac": 0.7575196668,
"autogenerated": false,
"ratio": 4.220703125,
"config_test": false,
"has_... |
""" A module for managing the AXDebug I*Contexts
"""
from . import gateways, axdebug
import pythoncom, win32com.server.util
# Utility function for wrapping object created by this module.
from .util import _wrap, _wrap_remove, trace
from . import adb
class DebugCodeContext(gateways.DebugCodeContext, gateways.DebugDoc... | {
"repo_name": "sserrot/champion_relationships",
"path": "venv/Lib/site-packages/win32comext/axdebug/contexts.py",
"copies": "1",
"size": "2171",
"license": "mit",
"hash": -4585348097714519600,
"line_mean": 37.7678571429,
"line_max": 87,
"alpha_frac": 0.673422386,
"autogenerated": false,
"ratio": ... |
""" A module for managing the AXDebug I*Contexts
"""
import gateways, axdebug
import pythoncom, win32com.server.util
# Utility function for wrapping object created by this module.
from .util import _wrap, _wrap_remove, trace
from . import adb
class DebugCodeContext(gateways.DebugCodeContext, gateways.DebugDocumentCo... | {
"repo_name": "ArcherSys/ArcherSys",
"path": "Lib/site-packages/win32comext/axdebug/contexts.py",
"copies": "10",
"size": "2164",
"license": "mit",
"hash": 375585777800011500,
"line_mean": 37.6428571429,
"line_max": 87,
"alpha_frac": 0.6737523105,
"autogenerated": false,
"ratio": 4.01484230055658... |
"""A module for manipulating Images, which are specially wrapped Pygame
surfaces.
"""
import pygame
import spyral
import copy
def _new_spyral_surface(size):
"""
Internal method for creating a new Spyral-compliant Pygame surface.
"""
return pygame.Surface((int(size[0]),
int(s... | {
"repo_name": "danShumway/python_math",
"path": "source/PythonMath.activity/libraries/spyral/spyral/image.py",
"copies": "1",
"size": "20561",
"license": "mit",
"hash": -6710973614415197000,
"line_mean": 38.8468992248,
"line_max": 147,
"alpha_frac": 0.5684062059,
"autogenerated": false,
"ratio": ... |
""" A module for mapping operators to their corresponding eigenstates
and vice versa
It contains a global dictionary with eigenstate-operator pairings.
If a new state-operator pair is created, this dictionary should be
updated as well.
It also contains functions operators_to_state and state_to_operators
for mapping b... | {
"repo_name": "sympsi/sympsi",
"path": "sympsi/operatorset.py",
"copies": "1",
"size": "9384",
"license": "bsd-3-clause",
"hash": 2453246635343243300,
"line_mean": 32.5142857143,
"line_max": 80,
"alpha_frac": 0.6343776641,
"autogenerated": false,
"ratio": 4.108581436077058,
"config_test": false... |
"""A module for networking related utilities."""
import random
import socket
def get_local_ip():
"""
Get the local IP address.
Equivalent to https://github.com/stencila/executa/blob/753207cb31298578497d978265c718e20b583a05/src/tcp/util.ts#L15
Thanks to https://stackoverflow.com/questions/166506/find... | {
"repo_name": "stencila/hub",
"path": "worker/util/network.py",
"copies": "1",
"size": "1130",
"license": "apache-2.0",
"hash": 957746954897078000,
"line_mean": 26.5609756098,
"line_max": 119,
"alpha_frac": 0.6451327434,
"autogenerated": false,
"ratio": 3.313782991202346,
"config_test": false,
... |
"""A module for parsing a query and searching for TF2 items
It supports class based search, eg: 'engineer hats'
It also supports alias based search, eg: 'engi hats'
Regular search, eg: 'Meet the Medic'
Slot search, eg: 'primary weps'
Set search, eg: 'the saharan spy set'
Price search, eg: 'unique > 1 ref hat'
Price vis... | {
"repo_name": "mohd-akram/item.tf",
"path": "tf2search.py",
"copies": "1",
"size": "27106",
"license": "mit",
"hash": -257663867956901600,
"line_mean": 32.9573934837,
"line_max": 79,
"alpha_frac": 0.5826629272,
"autogenerated": false,
"ratio": 3.8989928057553955,
"config_test": false,
"has_no... |
'''A module for parsing context free grammar specifications using an extended
syntax. This extended syntax allows for symbols with labels longer than one
character. Nonterminal names are written between angle brackets (<...>), and
terminal names are written between double quotes ("...").
Example:
<Sentence> -> <Noun-p... | {
"repo_name": "bdusell/pycfg",
"path": "src/cfg/cfg_reader.py",
"copies": "1",
"size": "3542",
"license": "mit",
"hash": -3582254568801285600,
"line_mean": 30.9099099099,
"line_max": 131,
"alpha_frac": 0.6055900621,
"autogenerated": false,
"ratio": 3.918141592920354,
"config_test": false,
"ha... |
"""A module for parsing vim-otl into a tree."""
import sys
class LineError(Exception):
"""An error that happens during line parsing."""
pass
class Object:
"""Represents an OTL object.
This object may be header, body, or perhaps some other kind of a
body; preformatted or user-defined (or user-de... | {
"repo_name": "fennekki/unikko",
"path": "unikko/votl.py",
"copies": "1",
"size": "10146",
"license": "bsd-2-clause",
"hash": 1572526072772238300,
"line_mean": 31.4153354633,
"line_max": 76,
"alpha_frac": 0.5063079046,
"autogenerated": false,
"ratio": 4.593028519692169,
"config_test": false,
... |
"""A module for periodically displaying progress on a hierarchy of tasks
and estimating time to completion.
>>> import progress, datetime
>>> progress.set_resolution(datetime.datetime.resolution) # show all messages, don't sample
>>> progress.start_task('Repetition', 2)
>>> for rep in range(2): # doctest: +ELLIPSIS
... | {
"repo_name": "arunchaganty/aeschines",
"path": "third-party/stanza/stanza/monitoring/progress.py",
"copies": "3",
"size": "6016",
"license": "mit",
"hash": -2125625674097820000,
"line_mean": 32.0549450549,
"line_max": 92,
"alpha_frac": 0.5871010638,
"autogenerated": false,
"ratio": 3.83184713375... |
"""A module for querying datasources (e.g., the World Bank Indicators). They
can optionally be stored locally to reduce internet queries.
"""
import contextlib
import json
import logging
import os
import requests
import warnings
import pandas as pd
from salamanca.utils import backend
WB_INDICATORS = {
'SP.POP.... | {
"repo_name": "gidden/salamanca",
"path": "salamanca/data.py",
"copies": "1",
"size": "6823",
"license": "apache-2.0",
"hash": -863604975722032800,
"line_mean": 28.9254385965,
"line_max": 83,
"alpha_frac": 0.529972153,
"autogenerated": false,
"ratio": 3.682137075013492,
"config_test": false,
... |
"""A module for querying for articles from the NYTimes."""
import sys
import os
wd = os.path.abspath('.')
sys.path.append(wd + '/../')
import pandas as pd
import numpy as np
from datetime import timedelta
from requests import get
from time import sleep
from os.path import exists
from pymongo import MongoClient
from ge... | {
"repo_name": "sahararaju/dataasservices",
"path": "scraping-job-portals/nytimes/article_scraper.py",
"copies": "2",
"size": "11530",
"license": "apache-2.0",
"hash": 3329139022745923600,
"line_mean": 34.2599388379,
"line_max": 93,
"alpha_frac": 0.5679098005,
"autogenerated": false,
"ratio": 4.11... |
"""A module for representing universal morphosyntactic feature bundles."""
from typing import Dict, List, Optional, Tuple, Type, Union
from cltk.core.exceptions import CLTKException
from cltk.morphology.universal_dependencies_features import *
__author__ = ["John Stewart <free-variation>"]
class Morphosy... | {
"repo_name": "cltk/cltk",
"path": "src/cltk/morphology/morphosyntax.py",
"copies": "4",
"size": "14467",
"license": "mit",
"hash": -7119769147641706000,
"line_mean": 30.8795454545,
"line_max": 92,
"alpha_frac": 0.540747909,
"autogenerated": false,
"ratio": 3.445344129554656,
"config_test": fal... |
"""A module for running Ansible by wrapping command line."""
from os.path import join
import subprocess
import logging
log = logging.getLogger(__name__)
class AnsibleRunner(object):
"""Responsible for running Ansible playbook."""
def __init__(self, playbook_root, inventory_filename, playbook_path,
... | {
"repo_name": "afgane/slurmscale",
"path": "slurmscale/util/ansible/cmd.py",
"copies": "1",
"size": "1377",
"license": "mit",
"hash": -139732912861624590,
"line_mean": 35.2368421053,
"line_max": 79,
"alpha_frac": 0.5940450254,
"autogenerated": false,
"ratio": 4.014577259475218,
"config_test": f... |
"""A module for running Ansible-related steps."""
from string import Template
INVENTORY_TEMPLATE = Template("""
jetstream-iu0.galaxyproject.org ansible_connection=local
[baseenv]
jetstream-iu0.galaxyproject.org
[baseenv:children]
galaxynodes
# "contoller" node(s) for this cloud (not necessarily a slurm controller)
... | {
"repo_name": "afgane/slurmscale",
"path": "slurmscale/util/ansible/__init__.py",
"copies": "1",
"size": "2016",
"license": "mit",
"hash": 4619496268268762000,
"line_mean": 24.5189873418,
"line_max": 79,
"alpha_frac": 0.6537698413,
"autogenerated": false,
"ratio": 3.587188612099644,
"config_tes... |
"""A module for scraping CareerBuilder for jobs.
This module is the driver for a CareerBuilder scraper. It controls the process
of instantiating a Selenium browser to scrape, and controlling that browser
throughout the entire process. It also handles the Threading, parsing, and
storage that takes place.
Usage:
... | {
"repo_name": "sahararaju/dataasservices",
"path": "scraping-job-portals/careerbuilder/job_scraper.py",
"copies": "2",
"size": "5613",
"license": "apache-2.0",
"hash": 2246335516284163600,
"line_mean": 31.6337209302,
"line_max": 85,
"alpha_frac": 0.6406556209,
"autogenerated": false,
"ratio": 3.8... |
"""A module for scraping Glassdoor for jobs.
This module is the driver for a Glassdoor scraper. It controls the process of
instantiating a Selenium browser to scrape, and controls that browser throughout
the entire process. It also handles parsing and storing our results.
Usage:
python job_scraper.py <job ti... | {
"repo_name": "mounicmadiraju/dataasservices",
"path": "scraping-job-portals/glassdoor/job_scraper.py",
"copies": "2",
"size": "8215",
"license": "apache-2.0",
"hash": -4860861829052787000,
"line_mean": 33.5168067227,
"line_max": 83,
"alpha_frac": 0.6366402921,
"autogenerated": false,
"ratio": 3.... |
"""A module for scraping Indeed for jobs.
This module is the driver for an Indeed scraper. It controls the process of issuing
requests, parsing the contents of those requests, and storing them. It also handles
the threading and multiprocessing that is used to speed up the scraping process.
Usage:
python job_... | {
"repo_name": "mounicmadiraju/dataasservices",
"path": "scraping-job-portals/indeed/job_scraper.py",
"copies": "2",
"size": "3534",
"license": "apache-2.0",
"hash": -1882585385203389200,
"line_mean": 36.5957446809,
"line_max": 88,
"alpha_frac": 0.66270515,
"autogenerated": false,
"ratio": 3.70440... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.