text stringlengths 0 1.05M | meta dict |
|---|---|
# Agent.py
from Tools import *
from agTools import *
class Agent(SuperAgent):
def __init__(self, number, myWorldState,
xPos, yPos, zPos, lX=0, rX=0, bY=0, tY=0, bZ=0, tZ=0,
agType=""):
# 0 definitions to be replaced (useful only if the
# dimensio... | {
"repo_name": "terna/SLAPP3",
"path": "6 objectSwarmObserverAgents_AESOP_turtleLib_NetworkX/basic3D/Agent.py",
"copies": "1",
"size": "3936",
"license": "cc0-1.0",
"hash": -5326909922621836000,
"line_mean": 31.8,
"line_max": 79,
"alpha_frac": 0.525152439,
"autogenerated": false,
"ratio": 3.416666... |
# agent.py
# --------
import util
def scoreEvaluationFn(gameState, player):
'''
This default evaluation function just returns the score of the state.
'''
enemyScore, playerScore = gameState.getScore(player)
return playerScore - enemyScore
def betterEvaluationFn(gameState, player):
'''
Insane piece killing ev... | {
"repo_name": "AhanM/ChessAI",
"path": "agent.py",
"copies": "1",
"size": "5883",
"license": "mit",
"hash": -6511213693691430000,
"line_mean": 27.2884615385,
"line_max": 144,
"alpha_frac": 0.7079721231,
"autogenerated": false,
"ratio": 3.051348547717842,
"config_test": false,
"has_no_keywords... |
"""agent.py -- personal assistant and modular chat bot
Copyright 2016 Rylan Santinon
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
... | {
"repo_name": "rylans/figaro",
"path": "figaro/agent.py",
"copies": "1",
"size": "3536",
"license": "apache-2.0",
"hash": -7985159492829491000,
"line_mean": 32.6761904762,
"line_max": 82,
"alpha_frac": 0.6425339367,
"autogenerated": false,
"ratio": 4.045766590389016,
"config_test": false,
"ha... |
# Agent.py - Use a message queue interface to launch a program and monitor it
#
import os
import signal
import time
import subprocess
from subprocess import Popen as Popen
import yaml
import redis
import magic
import psutil
import json
import plotly
print plotly.__version__ # version >1.9.4 required
from plotly.grap... | {
"repo_name": "appfit/AppFit",
"path": "rightsize/agent/agent.py",
"copies": "1",
"size": "6747",
"license": "apache-2.0",
"hash": -3557722781710637000,
"line_mean": 43.9866666667,
"line_max": 138,
"alpha_frac": 0.6106417667,
"autogenerated": false,
"ratio": 3.6352370689655173,
"config_test": t... |
# agents
# agent_id, agent_famname,agent_name
t1=[[100,'Brown','Jack'],
[101,'Red','James'],
[102,'Black','John'],
[103,'White','Jeff'],
[104,'White','Jasper']]
# clients
# client_id,agent_id,client_name
t2=[[100,100,'McDonalds'],
[101,100,'KFC'],
[102,102,'Burger King'],
[103,103,'Chinese'... | {
"repo_name": "ActiveState/code",
"path": "recipes/Python/159974_SQLlike_set_operations_list/recipe-159974.py",
"copies": "1",
"size": "6281",
"license": "mit",
"hash": -4897228186061637000,
"line_mean": 34.6875,
"line_max": 79,
"alpha_frac": 0.4922782996,
"autogenerated": false,
"ratio": 2.94744... |
"""Agent to process the COIL-100 dataset using nap."""
import os
import logging
import argparse
from datetime import datetime
import numpy as np
from lumos.context import Context
from lumos.input import run
from ..vision.visual_system import VisualSystem, FeatureManager
class COILManager(FeatureManager):
"""A vi... | {
"repo_name": "napratin/nap",
"path": "nap/agent/coil.py",
"copies": "1",
"size": "6940",
"license": "mit",
"hash": 8889049779163754000,
"line_mean": 56.8333333333,
"line_max": 241,
"alpha_frac": 0.6804034582,
"autogenerated": false,
"ratio": 3.670015864621893,
"config_test": false,
"has_no_k... |
"""AgentUpgrade Class"""
from .http_helper import HttpHelper
from .halo_endpoint import HaloEndpoint
class AgentUpgrade(HaloEndpoint):
"""Initializing the AgentUpgrade class:
Args:
session (:class:`cloudpassage.HaloSession`): This will define how you
interact with the Halo API, including... | {
"repo_name": "cloudpassage/cloudpassage-halo-python-sdk",
"path": "cloudpassage/agent_upgrade.py",
"copies": "1",
"size": "3326",
"license": "bsd-3-clause",
"hash": 8020971304069133000,
"line_mean": 32.595959596,
"line_max": 77,
"alpha_frac": 0.617558629,
"autogenerated": false,
"ratio": 4.77187... |
"""agent URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.10/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-base... | {
"repo_name": "kinnevo/kic_alone",
"path": "agent/urls.py",
"copies": "1",
"size": "1763",
"license": "mit",
"hash": -2655886076923446300,
"line_mean": 35.7291666667,
"line_max": 79,
"alpha_frac": 0.6505955757,
"autogenerated": false,
"ratio": 3.3903846153846153,
"config_test": false,
"has_no... |
"""Agent with uses A3C trained network"""
import random
import torch
import torch.nn.functional as F
from torch.autograd import Variable
from loveletter.env import LoveLetterEnv
from loveletter.agents.random import AgentRandom
from loveletter.agents.agent import Agent
from loveletter.trainers.a3c_model import Actor... | {
"repo_name": "user01/love-letter",
"path": "loveletter/agents/a3c.py",
"copies": "1",
"size": "1900",
"license": "mit",
"hash": -6599662120337115000,
"line_mean": 30.6666666667,
"line_max": 75,
"alpha_frac": 0.6052631579,
"autogenerated": false,
"ratio": 3.6538461538461537,
"config_test": fals... |
"""ageo - active geolocation library: core.
"""
__all__ = ('Location', 'Map', 'Observation')
import bisect
import functools
import itertools
import numpy as np
import pyproj
from scipy import sparse
from shapely.geometry import Point, MultiPoint, Polygon, box as Box
from shapely.ops import transform as sh_transform
i... | {
"repo_name": "zackw/active-geolocator",
"path": "lib/ageo/ageo.py",
"copies": "1",
"size": "32510",
"license": "mit",
"hash": -2970625627687039500,
"line_mean": 39.1333333333,
"line_max": 79,
"alpha_frac": 0.5461117263,
"autogenerated": false,
"ratio": 4.096270161290323,
"config_test": false,
... |
# A geology museum in California has six different rocks
# sitting in a row on a shelf, with labels on the shelf
# telling what type of rock each is. An earthquake hits
# and the rocks all fall off the shelf. A janitor comes in
# and, wanting to clean the floor, puts the rocks back on
# the shelf in random order. The... | {
"repo_name": "andrewzwicky/puzzles",
"path": "FiveThirtyEightRiddler/2016-12-16/express.py",
"copies": "1",
"size": "1188",
"license": "mit",
"hash": -152849651564609660,
"line_mean": 37.3225806452,
"line_max": 79,
"alpha_frac": 0.718013468,
"autogenerated": false,
"ratio": 3.394285714285714,
... |
"""ageo.ranging - active geolocation library: ranging functions.
A ranging function computes (non-normalized) probability as a function
of geographic location, given a reference location, calibration data
(see ageo.calibration), and a set of timing observations. This module
provides several different algorithms for t... | {
"repo_name": "zackw/active-geolocator",
"path": "lib/ageo/ranging.py",
"copies": "1",
"size": "5898",
"license": "mit",
"hash": 4996189226042431000,
"line_mean": 37.0516129032,
"line_max": 78,
"alpha_frac": 0.6583587657,
"autogenerated": false,
"ratio": 3.768690095846645,
"config_test": false,... |
ages = [16, 91, 29, 38, 14, 22]
print(ages)
print(ages[1])
ages.append(100)
print(ages)
ages.append(20)
ages.append(20)
ages.append(20)
print(ages)
print(ages.count(20))
print(ages.index(20))
ages.insert(1, 50)
print(ages)
ages.insert(1, 60)
print(ages)
ages.remove(20)
print(ages)
ages.reve... | {
"repo_name": "smartdong/PythonPractise",
"path": "Chapter 09/example.py",
"copies": "1",
"size": "2603",
"license": "mit",
"hash": -974050457698880400,
"line_mean": 16.4609929078,
"line_max": 56,
"alpha_frac": 0.5059546677,
"autogenerated": false,
"ratio": 1.7707482993197279,
"config_test": fa... |
"""A gevent based handler."""
from __future__ import absolute_import
import atexit
import logging
import gevent
import gevent.event
import gevent.queue
import gevent.select
import gevent.thread
from gevent.queue import Empty
from gevent.queue import Queue
from gevent import socket
try:
from gevent.lock import Se... | {
"repo_name": "azureplus/hue",
"path": "desktop/core/ext-py/kazoo-2.0/kazoo/handlers/gevent.py",
"copies": "36",
"size": "4918",
"license": "apache-2.0",
"hash": 9137988590901690000,
"line_mean": 29.5465838509,
"line_max": 73,
"alpha_frac": 0.6185441236,
"autogenerated": false,
"ratio": 4.5537037... |
"""A gevent based handler."""
from __future__ import absolute_import
import logging
import gevent
from gevent import socket
import gevent.event
import gevent.queue
import gevent.select
import gevent.thread
try:
from gevent.lock import Semaphore, RLock
except ImportError:
from gevent.coros import Semaphore, RL... | {
"repo_name": "python-zk/kazoo",
"path": "kazoo/handlers/gevent.py",
"copies": "3",
"size": "5194",
"license": "apache-2.0",
"hash": 8759011419898342000,
"line_mean": 29.5529411765,
"line_max": 71,
"alpha_frac": 0.6110897189,
"autogenerated": false,
"ratio": 4.560140474100088,
"config_test": fa... |
"""A gevent based handler."""
from __future__ import absolute_import
import logging
import gevent
import gevent.event
import gevent.queue
import gevent.select
import gevent.thread
from gevent.queue import Empty
from gevent.queue import Queue
from gevent import socket
try:
from gevent.lock import Semaphore, RLock... | {
"repo_name": "johankaito/fufuka",
"path": "microblog/venv/lib/python2.7/site-packages/kazoo/handlers/gevent.py",
"copies": "13",
"size": "4954",
"license": "apache-2.0",
"hash": 6892760098569892000,
"line_mean": 29.3926380368,
"line_max": 71,
"alpha_frac": 0.6215179653,
"autogenerated": false,
"... |
"""A gevent based handler."""
from __future__ import absolute_import
import logging
import gevent
import gevent.event
import gevent.queue
import gevent.select
import gevent.thread
import kazoo.python2atexit as python2atexit
from gevent.queue import Empty
from gevent.queue import Queue
from gevent import socket
try:... | {
"repo_name": "max0d41/kazoo",
"path": "kazoo/handlers/gevent.py",
"copies": "1",
"size": "5019",
"license": "apache-2.0",
"hash": 3758709374374409000,
"line_mean": 29.6036585366,
"line_max": 93,
"alpha_frac": 0.6234309623,
"autogenerated": false,
"ratio": 4.489266547406082,
"config_test": fals... |
'''A Gevent-based worker'''
import os
import gevent
import gevent.pool
from six import next
from . import Worker
from qless import logger
class GeventWorker(Worker):
'''A Gevent-based worker'''
def __init__(self, *args, **kwargs):
Worker.__init__(self, *args, **kwargs)
# Should we shut down ... | {
"repo_name": "seomoz/qless-py",
"path": "qless/workers/greenlet.py",
"copies": "1",
"size": "2720",
"license": "mit",
"hash": -4550340432083189000,
"line_mean": 34.7894736842,
"line_max": 80,
"alpha_frac": 0.5261029412,
"autogenerated": false,
"ratio": 4.556113902847571,
"config_test": false,
... |
"""Agglomerates storm-centered radar images by SPC date.
In other words, this script converts the file structure from one file per
field/height pair per time step to one file per field/height pair per SPC date.
"""
import argparse
import numpy
from gewittergefahr.gg_utils import radar_utils
from gewittergefahr.gg_uti... | {
"repo_name": "thunderhoser/GewitterGefahr",
"path": "gewittergefahr/scripts/agglom_storm_images_by_date.py",
"copies": "1",
"size": "8415",
"license": "mit",
"hash": 1168786316500274000,
"line_mean": 38.8815165877,
"line_max": 80,
"alpha_frac": 0.6331550802,
"autogenerated": false,
"ratio": 3.10... |
"""Aggregate all of the GO reference information into a single blob for downstream use."""
####
#### Aggregate all of the GO reference information into a single blob
#### for downstream use.
####
#### This script assumes access (via CLI option) of the directory
#### containing the GO reference data file.
####
#### Exam... | {
"repo_name": "geneontology/go-site",
"path": "scripts/aggregate-references.py",
"copies": "1",
"size": "9360",
"license": "bsd-3-clause",
"hash": 7161390482938908000,
"line_mean": 36.44,
"line_max": 133,
"alpha_frac": 0.5612179487,
"autogenerated": false,
"ratio": 3.9543726235741445,
"config_t... |
"""Aggregate all of the report JSON and other metadata into a single blob for downstream use, such as creating webpages."""
####
#### Aggregate all of the report JSON and other metadata into a single blob
#### for downstream use, such as creating webpages.
####
#### This script assumes access to skyhook or a flat direc... | {
"repo_name": "geneontology/go-site",
"path": "scripts/aggregate-json-reports.py",
"copies": "1",
"size": "11320",
"license": "bsd-3-clause",
"hash": 8073658394831471000,
"line_mean": 39.1418439716,
"line_max": 208,
"alpha_frac": 0.5599823322,
"autogenerated": false,
"ratio": 3.8024857238831036,
... |
# This script fuses volume-level metadata with volume-level
# summaries of BookNLP output in order to produce yearly summaries
# by character and author gender.
import json, csv, os, sys
from collections import Counter
volgender = dict()
voldate = dict()
volbirth = dict()
mindate = 3000
maxdate = 0
with open('pos... | {
"repo_name": "tedunderwood/character",
"path": "post22hathi/aggregate_authgender.py",
"copies": "1",
"size": "3801",
"license": "mit",
"hash": 7485458146849789000,
"line_mean": 29.408,
"line_max": 115,
"alpha_frac": 0.5953696396,
"autogenerated": false,
"ratio": 3.6974708171206228,
"config_tes... |
# aggregate_by_authgender.py
import json, csv, os, sys
from collections import Counter
# import utils
currentdir = os.path.dirname(__file__)
libpath = os.path.join(currentdir, '../../lib')
sys.path.append(libpath)
import SonicScrewdriver as utils
volgender = dict()
voldate = dict()
volbirth = dict()
volgenre = dic... | {
"repo_name": "tedunderwood/character",
"path": "genre_experiment/aggregate_post22__by_genre.py",
"copies": "1",
"size": "3152",
"license": "mit",
"hash": 6858588537765905000,
"line_mean": 26.649122807,
"line_max": 83,
"alpha_frac": 0.5989847716,
"autogenerated": false,
"ratio": 3.557562076749435... |
# aggregate_by_authgender.py
import json, csv, os, sys
from collections import Counter
volgender = dict()
voldate = dict()
volbirth = dict()
mindate = 3000
maxdate = 0
with open('pre23_corrected_metadata.csv', encoding = 'utf-8') as f:
reader = csv.DictReader(f)
for row in reader:
volgender[row['doc... | {
"repo_name": "tedunderwood/character",
"path": "pre23hathi/aggregate_old_authgender.py",
"copies": "1",
"size": "3328",
"license": "mit",
"hash": -3082304942318164000,
"line_mean": 29.5321100917,
"line_max": 115,
"alpha_frac": 0.5997596154,
"autogenerated": false,
"ratio": 3.6611661166116614,
... |
""" Aggregate crime data for use in a web application """
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from sdipylib.url import download_ambry_db # install: pip install 'git+https://github.com/sdrdl/sdipylib.git'
from lib import plot_rhythm
import csv
import re
import os
import json
here = o... | {
"repo_name": "sdrdl/crimeviz",
"path": "analysis/makedatafiles.py",
"copies": "1",
"size": "3328",
"license": "mit",
"hash": -8832671421442600000,
"line_mean": 30.1121495327,
"line_max": 131,
"alpha_frac": 0.6352163462,
"autogenerated": false,
"ratio": 3.1665080875356804,
"config_test": false,... |
"""Aggregate grid values to census tracts and classify as above/below a given threshold. Used for safety routing."""
import csv
import json
import argparse
import numpy
def main():
parser = argparse.ArgumentParser()
parser.add_argument("empath_grid_csv")
parser.add_argument("ct_grid_csv")
parser.add_a... | {
"repo_name": "joh12041/route-externalities",
"path": "utils/aggregate_grid_values_to_ct.py",
"copies": "1",
"size": "4089",
"license": "mit",
"hash": -421872462839453600,
"line_mean": 40.303030303,
"line_max": 120,
"alpha_frac": 0.5551479579,
"autogenerated": false,
"ratio": 3.3709810387469084,
... |
"""Aggregate local features using Fisher Vectors with a GMM as the
probabilistic model"""
from joblib import Parallel, delayed
import numpy as np
from sklearn.mixture import GaussianMixture
from sklearn.decomposition import PCA
from .base import BaseAggregator
def _transform_batch(x, means, inv_covariances, inv_sqr... | {
"repo_name": "paschalidoud/feature-aggregation",
"path": "feature_aggregation/fv.py",
"copies": "1",
"size": "10519",
"license": "mit",
"hash": -7754333678776730000,
"line_mean": 36.4341637011,
"line_max": 85,
"alpha_frac": 0.5928320183,
"autogenerated": false,
"ratio": 4.172550575168584,
"con... |
"""Aggregate local features using Locality-constrained Linear Coding"""
import numpy as np
from sklearn import cluster
from sklearn.metrics import pairwise_distances
from .base import BaseAggregator
class LLC(BaseAggregator):
"""Compute a Locality-constrained Linear Coding and aggregate local
features with ... | {
"repo_name": "paschalidoud/feature-aggregation",
"path": "feature_aggregation/llc.py",
"copies": "1",
"size": "3648",
"license": "mit",
"hash": -343563646005030900,
"line_mean": 33.4150943396,
"line_max": 85,
"alpha_frac": 0.5718201754,
"autogenerated": false,
"ratio": 4.256709451575262,
"conf... |
"""Aggregate profiling data and generate an rst file"""
import itertools
import tabulate
def update(means, new, count, num=1):
"""Recursively update mean dictionary"""
for key, val in new.items():
if isinstance(val, dict):
update(means.setdefault(key, {}), val, count)
else:
... | {
"repo_name": "egtaonline/GameAnalysis",
"path": "profile/display.py",
"copies": "1",
"size": "4344",
"license": "apache-2.0",
"hash": 3641596534176080400,
"line_mean": 37.7857142857,
"line_max": 79,
"alpha_frac": 0.5534069982,
"autogenerated": false,
"ratio": 4.0036866359447005,
"config_test":... |
# _aggregate.py
import numpy as np
import pandas as pd
import os
from pandas.tools.pivot import pivot_table
import itertools
from database import DB
from _column_lengths import add_column_length
def setup_transfomers():
db = DB()
transformers = {
"planning_region": {
"table": "attrs_bra_pr... | {
"repo_name": "DataViva/dataviva-scripts",
"path": "scripts/ei/table_aggregator.py",
"copies": "1",
"size": "2996",
"license": "mit",
"hash": 2854631000665187300,
"line_mean": 28.0873786408,
"line_max": 86,
"alpha_frac": 0.5857810414,
"autogenerated": false,
"ratio": 3.245937161430119,
"config_... |
{
"repo_name": "multicastTor/multicastTor",
"path": "torps/util/aggregate_relays.py",
"copies": "1",
"size": "2834",
"license": "bsd-3-clause",
"hash": 6291973294725476000,
"line_mean": 36.7866666667,
"line_max": 229,
"alpha_frac": 0.642554693,
"autogenerated": false,
"ratio": 3.170022371364653,
... | |
"""Aggregates the performance results from a edw benchmark.
An edw benchmark, runs multiple iterations of a suite of queries.
Independent raw query performance is aggregated during the benchmark, and used
for generating:
a. Raw query performance samples
b. Aggregated query performance samples
c. Raw wall time for each... | {
"repo_name": "GoogleCloudPlatform/PerfKitBenchmarker",
"path": "perfkitbenchmarker/edw_benchmark_results_aggregator.py",
"copies": "1",
"size": "42267",
"license": "apache-2.0",
"hash": 1550876223856840000,
"line_mean": 37.4595086442,
"line_max": 99,
"alpha_frac": 0.6775735207,
"autogenerated": fa... |
"""Aggregation function for CLI specified options and config file options.
This holds the logic that uses the collected and merged config files and
applies the user-specified command-line configuration on top of it.
"""
import logging
from flake8 import utils
from flake8.options import config
LOG = logging.getLogger... | {
"repo_name": "vicky2135/lucious",
"path": "oscar/lib/python2.7/site-packages/flake8/options/aggregator.py",
"copies": "3",
"size": "3288",
"license": "bsd-3-clause",
"hash": -2407417777393643500,
"line_mean": 40.6202531646,
"line_max": 78,
"alpha_frac": 0.6879562044,
"autogenerated": false,
"rat... |
"""Aggregation methods"""
__docformat__ = "restructuredtext en"
import numpy as np
from scipy.sparse import csr_matrix, coo_matrix, isspmatrix_csr, isspmatrix_csc
from pyamg import amg_core
from pyamg.graph import lloyd_cluster
__all__ = ['standard_aggregation', 'naive_aggregation', 'lloyd_aggregation']
def standa... | {
"repo_name": "pombreda/pyamg",
"path": "pyamg/aggregation/aggregate.py",
"copies": "1",
"size": "8278",
"license": "bsd-3-clause",
"hash": 4773301270415715000,
"line_mean": 29.2116788321,
"line_max": 79,
"alpha_frac": 0.5428847548,
"autogenerated": false,
"ratio": 3.470859538784067,
"config_te... |
"""Aggregation methods."""
import numpy as np
import scipy.sparse as sparse
from pyamg import amg_core
from pyamg.graph import lloyd_cluster, asgraph
import warnings
__all__ = ['standard_aggregation', 'naive_aggregation', 'lloyd_aggregation', 'balanced_lloyd_aggregation']
def standard_aggregation(C):
"""Comput... | {
"repo_name": "pyamg/pyamg",
"path": "pyamg/aggregation/aggregate.py",
"copies": "1",
"size": "10661",
"license": "mit",
"hash": -1166843716707742500,
"line_mean": 29.0309859155,
"line_max": 106,
"alpha_frac": 0.5509802082,
"autogenerated": false,
"ratio": 3.4771689497716896,
"config_test": fal... |
"""aggregation operations
:notes::
aggregation currently doesn't support shift bit operators those can be substituted by:
x >> y = x / (2 ** y)
x << y = x * (2 ** y)
"""
from mongoUtils.helpers import pp_doc
from pymongo.command_cursor import CommandCursor
from bson.son import SON
from datetime ... | {
"repo_name": "nickmilon/mongoUtils",
"path": "mongoUtils/aggregation.py",
"copies": "1",
"size": "11059",
"license": "apache-2.0",
"hash": 6354431143092468000,
"line_mean": 41.3716475096,
"line_max": 158,
"alpha_frac": 0.5715706664,
"autogenerated": false,
"ratio": 4.193780811528252,
"config_t... |
"""Agile app for managing releases
"""
import os
from datetime import date
import glob
import asyncio
from dateutil import parser
from pulsar.utils.html import capfirst
from .. import core
class RemoveRelease(core.AgileSetting):
name = "remove_release"
flags = ['--remove-release']
nargs = "?"
const... | {
"repo_name": "quantmind/git-agile",
"path": "agile/plugins/github.py",
"copies": "2",
"size": "10796",
"license": "bsd-3-clause",
"hash": 6840276892495755000,
"line_mean": 35.472972973,
"line_max": 78,
"alpha_frac": 0.5104668396,
"autogenerated": false,
"ratio": 4.316673330667733,
"config_test... |
"""Agilent N6705B Power Supply SCIPI Class.
Copyright (c) 2014 The Project Loon Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file
"""
__author__ = "Alfred Cohen"
__email__ = "alfredcohen@google.com"
import time
class Driver(object):
"""A... | {
"repo_name": "taiwenko/python",
"path": "instruments/AgilentN6705B.py",
"copies": "1",
"size": "4267",
"license": "mit",
"hash": 6568216786939185000,
"line_mean": 29.2624113475,
"line_max": 78,
"alpha_frac": 0.5683149754,
"autogenerated": false,
"ratio": 3.3651419558359623,
"config_test": fals... |
""" Agilent's 'Masshunter Quant'
"""
from DateTime import DateTime
from Products.Archetypes.event import ObjectInitializedEvent
from Products.CMFCore.utils import getToolByName
from Products.Five.browser.pagetemplatefile import ViewPageTemplateFile
from bika.lims import bikaMessageFactory as _
from bika.lims.utils impo... | {
"repo_name": "hocinebendou/bika.gsoc",
"path": "bika/lims/exportimport/instruments/agilent/masshunter/quantitative.py",
"copies": "5",
"size": "23863",
"license": "mit",
"hash": -6618794874881368000,
"line_mean": 46.9176706827,
"line_max": 138,
"alpha_frac": 0.5486736789,
"autogenerated": false,
... |
# a gimbal plus the chopper itself
import math
from math import degrees, radians, sin, cos, atan2, asin
import random
#from modules.pyrexopengl import *
#from modules.pyrexopenglconstans import *
import vector
import axial_frame
import coordinate_system
from OpenGL.GL import *
import cube
import ... | {
"repo_name": "fdkz/flybyrift",
"path": "system/gimbal1.py",
"copies": "1",
"size": "17209",
"license": "mit",
"hash": 2857070440420656600,
"line_mean": 36.0730088496,
"line_max": 118,
"alpha_frac": 0.5295484921,
"autogenerated": false,
"ratio": 2.7053922339254832,
"config_test": false,
"has_... |
"""AGIPD & LPD geometry handling."""
from cfelpyutils.crystfel_utils import load_crystfel_geometry
from copy import copy
import h5py
from itertools import product
import numpy as np
from scipy.ndimage import affine_transform
import warnings
from .crystfel_fmt import write_crystfel_geom
__all__ = ['AGIPD_1MGeometry', ... | {
"repo_name": "European-XFEL/h5tools-py",
"path": "karabo_data/geometry2/__init__.py",
"copies": "1",
"size": "60485",
"license": "bsd-3-clause",
"hash": -8078231280233923000,
"line_mean": 38.7888157895,
"line_max": 94,
"alpha_frac": 0.5580945452,
"autogenerated": false,
"ratio": 3.91601916601916... |
a_global = 3
class Rectangle(object):
attribute_in_class = 3
class Foo:
def foo_meth(self):
class bla:
bla_attribute = "blattr"
print "foo"
foolocal = bla()
self.fooattribute = "fooattribute"
print "foo nested class"
... | {
"repo_name": "aptana/Pydev",
"path": "tests/org.python.pydev.refactoring.tests/src/python/visitor/attributevisitor/testGlobalLocal1.py",
"copies": "8",
"size": "1763",
"license": "epl-1.0",
"hash": 7661214025997893000,
"line_mean": 24.5652173913,
"line_max": 98,
"alpha_frac": 0.644356211,
"autogen... |
""" A global cache for milter LDAP queries
"""
import datetime
class QueryCache(object):
""" A global cache for milter LDAP queries
"""
cache = {}
""" The cache """
@staticmethod
def get(directory_server, query):
""" Return a cached query
:param directory_server: The dire... | {
"repo_name": "dploeger/disclaimr",
"path": "disclaimr/query_cache.py",
"copies": "1",
"size": "2728",
"license": "mit",
"hash": 3392218367358194700,
"line_mean": 24.9904761905,
"line_max": 80,
"alpha_frac": 0.5835777126,
"autogenerated": false,
"ratio": 4.600337268128162,
"config_test": false,... |
""""A global list of error identifiers that may be used.
The identifiers are gathered here for easy reference, for example when
writing an external error logger then it may be useful to know what
kinds of error identifiers to expect.
"""
# =============================================================================
... | {
"repo_name": "bloomberg/phabricator-tools",
"path": "py/abd/abdt_errident.py",
"copies": "4",
"size": "2610",
"license": "apache-2.0",
"hash": -5612355224501910000,
"line_mean": 31.625,
"line_max": 79,
"alpha_frac": 0.60651341,
"autogenerated": false,
"ratio": 3.4342105263157894,
"config_test"... |
"""A global module containing functions for managing the project."""
__author__ = 'wittawat'
import fsic
import os
try:
import cPickle as pickle
except:
import pickle
def get_root():
"""Return the full path to the root of the package"""
return os.path.abspath(os.path.dirname(fsic.__file__))
def re... | {
"repo_name": "Diviyan-Kalainathan/causal-humans",
"path": "Cause-effect/lib/fsic/glo.py",
"copies": "3",
"size": "2891",
"license": "mit",
"hash": 7400615233114957000,
"line_mean": 29.4315789474,
"line_max": 91,
"alpha_frac": 0.6599792459,
"autogenerated": false,
"ratio": 3.5824039653035937,
"... |
# A global var. to remember autodiscover state.
LOADING = False
class StepAlreadyRegistered(Exception):
pass
class StepNotFound(Exception):
pass
class Registry(object):
_registry = {}
def add_step(self, name, func):
# Check if the plugin is already registered.
if func.__name__ in sel... | {
"repo_name": "stephrdev/loetwerk",
"path": "journeyman/buildrunner/registry.py",
"copies": "1",
"size": "2064",
"license": "mit",
"hash": 5154279870106959000,
"line_mean": 28.0704225352,
"line_max": 74,
"alpha_frac": 0.6104651163,
"autogenerated": false,
"ratio": 4.372881355932203,
"config_tes... |
"""A globe is used to represent a given state of the world."""
from existenz.location import Location
from existenz.util_decorator import memoize
class Globe(object):
"""A Globe is used to represent a given state of the world."""
def __init__(self, size=5):
self._size = size
self._total_locat... | {
"repo_name": "neoinsanity/existenz",
"path": "existenz/globe.py",
"copies": "1",
"size": "2850",
"license": "apache-2.0",
"hash": 3554721693191029000,
"line_mean": 35.0759493671,
"line_max": 77,
"alpha_frac": 0.5722807018,
"autogenerated": false,
"ratio": 3.8358008075370122,
"config_test": fal... |
# A glob module for genomespace paths
# Used to handle wildcard searches in a manner compatible with
# standard file globbing
import fnmatch
import os
import re
try:
from urllib.parse import urlparse
except ImportError:
from urlparse import urlparse
GENOMESPACE_URL_REGEX = re.compile(
r'(http[s]?://.*/dat... | {
"repo_name": "gvlproject/python-genomespaceclient",
"path": "genomespaceclient/gs_glob.py",
"copies": "1",
"size": "3337",
"license": "mit",
"hash": -8555704988381880000,
"line_mean": 28.5309734513,
"line_max": 77,
"alpha_frac": 0.6559784237,
"autogenerated": false,
"ratio": 3.687292817679558,
... |
""" Agnostic API for sailplay.ru """
__version__ = "0.2.0"
__project__ = "sailplay"
__author__ = "Kirill Klenov <horneds@gmail.com>"
__license__ = "BSD"
import logging
import requests as rs
from contextlib import contextmanager
from copy import deepcopy
logger = logging.getLogger('sailplay')
rs_logger = logging.get... | {
"repo_name": "klen/sailplay",
"path": "sailplay.py",
"copies": "1",
"size": "3632",
"license": "bsd-3-clause",
"hash": -4927140060038735000,
"line_mean": 25.5109489051,
"line_max": 76,
"alpha_frac": 0.5699339207,
"autogenerated": false,
"ratio": 3.7137014314928427,
"config_test": false,
"has... |
""" a goaway lock """
import random
import threading
import thread
import uuid
import logging
import goaway.globalvars as globalvars
import goaway.rpc as rpc
logger = logging.getLogger(__name__)
class Lock(object):
"""A GoAway Lock.
All locks are centralized for full ordering of acquire and releases.
Su... | {
"repo_name": "anpere/goaway",
"path": "goaway/datatypes/lock.py",
"copies": "1",
"size": "1870",
"license": "mit",
"hash": 7371649368180832000,
"line_mean": 30.1666666667,
"line_max": 92,
"alpha_frac": 0.5935828877,
"autogenerated": false,
"ratio": 3.9368421052631577,
"config_test": false,
"... |
"A Google Calendar Parser"
from datetime import datetime, date, timedelta
from time import strptime, mktime
from xml.sax.saxutils import unescape
from urllib2 import urlopen
# From Requirements.txt
from pytz import timezone
from icalendar.cal import Calendar, Event
from BeautifulSoup import BeautifulStoneSoup, Tag
... | {
"repo_name": "dominicmeroux/Reading-In-and-Analyzing-Calendar-Data-by-Interfacing-Between-MySQL-and-Python",
"path": "calendar_parser.py",
"copies": "1",
"size": "15492",
"license": "mit",
"hash": -2630800464869314000,
"line_mean": 37.8270676692,
"line_max": 115,
"alpha_frac": 0.5562225665,
"autog... |
"""A google Music skill."""
from random import shuffle
from gmusicapi import Mobileclient
name = 'Google Music'
examples = 'search for jimmy hendrix, play library, shuffle library.'
api = Mobileclient()
logged_in = False
def results_to_tracks(results, app):
"""Convert a list of results to a li... | {
"repo_name": "chrisnorman7/helper",
"path": "skills/google_music.py",
"copies": "1",
"size": "3471",
"license": "mpl-2.0",
"hash": 861068548204634400,
"line_mean": 27.1680672269,
"line_max": 79,
"alpha_frac": 0.5211754538,
"autogenerated": false,
"ratio": 4.151913875598086,
"config_test": true... |
"""A GO term, A, can be represented as DAG_a = (A, T_a, E_a), aka a GoSubDag"""
__copyright__ = "Copyright (C) 2020-present, DV Klopfenstein. All rights reserved."
__author__ = "DV Klopfenstein"
## import timeit
## from goatools.godag.prttime import prt_hms
class DagA:
"""A GO term, A, can be represented as DAG... | {
"repo_name": "tanghaibao/goatools",
"path": "goatools/semsim/termwise/dag_a.py",
"copies": "1",
"size": "2624",
"license": "bsd-2-clause",
"hash": -1373124626002087400,
"line_mean": 36.4857142857,
"line_max": 98,
"alpha_frac": 0.5697408537,
"autogenerated": false,
"ratio": 2.9450056116722783,
... |
"""A GQL-based viewer for the Google App Engine Datastore."""
import cgi
import logging
import os
import re
import sys
import time
import urllib
from google.appengine.ext import webapp
from google.appengine.ext.webapp import util
import ndb
FORM = """\
<html>
<head>
<title>Data Viewer - %(APPLICATION_ID)s - ... | {
"repo_name": "bslatkin/8-bits",
"path": "appengine-ndb/demo/dataviewer.py",
"copies": "1",
"size": "3739",
"license": "apache-2.0",
"hash": -8574546823150788000,
"line_mean": 28.2109375,
"line_max": 77,
"alpha_frac": 0.4872960685,
"autogenerated": false,
"ratio": 4.05531453362256,
"config_test... |
# a grab-bag of simple optimization techniques
# while we rely on the C compiler to do the heavy lifting,
# it's reluctant to do anything to floating point arithmetic
# in case it changes the behavior of the program. We have
# a freer hand because
# a) this is for drawing pretty pictures, not calculating missile
# ... | {
"repo_name": "ericchill/gnofract4d",
"path": "fract4d/optimize.py",
"copies": "1",
"size": "3195",
"license": "bsd-3-clause",
"hash": -9207362253584944000,
"line_mean": 27.7837837838,
"line_max": 72,
"alpha_frac": 0.5436619718,
"autogenerated": false,
"ratio": 4.271390374331551,
"config_test":... |
"""a graphical config manager for StaSh"""
import os
import ast
import threading
import console
import ui
from stash.system.shcommon import _STASH_CONFIG_FILES
import pythonista_add_action as paa
_stash = globals()["_stash"]
ORIENTATIONS = ("landscape", "landscape_left", "landscape_right")
# define option types
TY... | {
"repo_name": "cclauss/stash",
"path": "bin/easy_config.py",
"copies": "1",
"size": "14853",
"license": "mit",
"hash": -2005808375103440000,
"line_mean": 25.1975308642,
"line_max": 124,
"alpha_frac": 0.6371776745,
"autogenerated": false,
"ratio": 2.679595886703951,
"config_test": true,
"has_n... |
"""A Graph of Nodes."""
from __future__ import absolute_import, print_function
import logging
import pickle
import warnings
from ascii_canvas import canvas, item
from .errors import CycleError
from .evaluator import LinearEvaluator, ThreadedEvaluator, \
LegacyMultiprocessingEvaluator
from .plug import InputPlug,... | {
"repo_name": "PaulSchweizer/flowpipe",
"path": "flowpipe/graph.py",
"copies": "1",
"size": "17481",
"license": "mit",
"hash": 6751571978559594000,
"line_mean": 36.5128755365,
"line_max": 86,
"alpha_frac": 0.5556318288,
"autogenerated": false,
"ratio": 4.394419306184012,
"config_test": false,
... |
query = "bird"
try:
graph = ximport("graph")
except ImportError:
graph = ximport("__init__")
reload(graph)
import en
from random import shuffle
#### WORDNET GRAPH ###################################################################################
class wordnetgraph(graph.graph):
""" Browse Wor... | {
"repo_name": "gt-ros-pkg/rcommander-core",
"path": "nodebox_qt/src/graph/graph_example4.py",
"copies": "3",
"size": "9645",
"license": "bsd-3-clause",
"hash": 2524314237547145700,
"line_mean": 29.8178913738,
"line_max": 102,
"alpha_frac": 0.4961119751,
"autogenerated": false,
"ratio": 4.02377972... |
query = "bird"
try:
graph = ximport("graph")
except ImportError:
graph = ximport("__init__")
reload(graph)
import en
from random import shuffle
#### WORDNET GRAPH ###################################################################################
class wordnetgraph(graph.graph):
... | {
"repo_name": "zaqwes8811/micro-apps",
"path": "extern/GPL_libs/graph/graph_example4.py",
"copies": "2",
"size": "9957",
"license": "mit",
"hash": -5565381609396478000,
"line_mean": 29.8178913738,
"line_max": 102,
"alpha_frac": 0.4805664357,
"autogenerated": false,
"ratio": 4.122981366459627,
"... |
# a graph type used for dataflow analysis.
# Not a very general implementation
# based on the description in Appel's book
from bisect import bisect, insort
class T:
def __init__(self):
self._nodes = []
self._succ = {}
self._pred = {}
self.nextNode = 0
def _getNextNode(self):
... | {
"repo_name": "ericchill/gnofract4d",
"path": "fract4d/graph.py",
"copies": "1",
"size": "1393",
"license": "bsd-3-clause",
"hash": -2366310744052419600,
"line_mean": 23.0172413793,
"line_max": 58,
"alpha_frac": 0.5204594401,
"autogenerated": false,
"ratio": 3.599483204134367,
"config_test": fa... |
"""A grid plane component.
"""
# Author: Prabhu Ramachandran <prabhu_r@users.sf.net>
# Copyright (c) 2005-2006, Enthought, Inc.
# License: BSD Style.
# Enthought library imports.
from traits.api import Instance, Enum, Int, Range
from traitsui.api import View, Group, Item
from tvtk.api import tvtk
from apptools.persis... | {
"repo_name": "dmsurti/mayavi",
"path": "mayavi/components/grid_plane.py",
"copies": "1",
"size": "6555",
"license": "bsd-3-clause",
"hash": 2782541675271855600,
"line_mean": 32.9637305699,
"line_max": 77,
"alpha_frac": 0.5363844394,
"autogenerated": false,
"ratio": 4.295543905635649,
"config_t... |
""" A Group for toggling the visibility of a task's dock panes. """
# Enthought library imports.
from pyface.action.api import Action, ActionItem, Group
from traits.api import cached_property, Instance, List, on_trait_change, \
Property, Unicode
# Local imports.
from pyface.tasks.i_dock_pane import IDockPane
c... | {
"repo_name": "pankajp/pyface",
"path": "pyface/tasks/action/dock_pane_toggle_group.py",
"copies": "5",
"size": "3899",
"license": "bsd-3-clause",
"hash": -6759156949744195000,
"line_mean": 30.192,
"line_max": 79,
"alpha_frac": 0.5442421134,
"autogenerated": false,
"ratio": 4.346711259754738,
"... |
"""A group of functions to help Python 2 act like Python 3"""
import sys
def run_script(path, globals=None, locals=None):
# In Python 2, we can use execfile(...), but in Python 3 that function
# doesn't exist, and we instead use exec(open(...)). Since the latter
# approach always works, just use t... | {
"repo_name": "belson17/modred",
"path": "modred/py2to3.py",
"copies": "1",
"size": "1947",
"license": "bsd-2-clause",
"hash": -1327347564945691400,
"line_mean": 31,
"line_max": 79,
"alpha_frac": 0.636877247,
"autogenerated": false,
"ratio": 3.9412955465587043,
"config_test": false,
"has_no_k... |
""" A group of procedures. Note there is a many-to-many relationship between procedure and procedure groups
:Authors: Sana dev team
:Version: 2.0
"""
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
from mds.api.utils import make_uuid
@python_2_unicode_compatible
class Proce... | {
"repo_name": "SanaMobile/sana.mds",
"path": "src/mds/core/models/procedure_group.py",
"copies": "1",
"size": "1259",
"license": "bsd-3-clause",
"hash": -6674566372207257000,
"line_mean": 29.7073170732,
"line_max": 107,
"alpha_frac": 0.6838760921,
"autogenerated": false,
"ratio": 3.95911949685534... |
"""A group of useful functions"""
import inspect
import os
import numpy as np
from numpy import polymul, polyadd
import scipy
import scipy.linalg
import scipy.signal
from .py2to3 import range
class UndefinedError(Exception): pass
def atleast_2d_row(array):
"""Converts 1d arrays to 2d arrays, but always as row v... | {
"repo_name": "belson17/modred",
"path": "modred/util.py",
"copies": "1",
"size": "20177",
"license": "bsd-2-clause",
"hash": -5176008193480600000,
"line_mean": 31.1802232855,
"line_max": 83,
"alpha_frac": 0.6252663924,
"autogenerated": false,
"ratio": 3.571782616392282,
"config_test": false,
... |
"""A group of utility functions for validating data and graphing them, as well as automating pulling
from created dictionaries."""
# This library contains utility functions for visualizing the results of clustering algorithms
# from scikit learn. It relies on matplotlib, seaborn, and pylab. This exists because the nat... | {
"repo_name": "codezakh/plotutil",
"path": "plotutil.py",
"copies": "1",
"size": "6575",
"license": "mit",
"hash": -6084061160722497000,
"line_mean": 37.0115606936,
"line_max": 194,
"alpha_frac": 0.7003802281,
"autogenerated": false,
"ratio": 3.3614519427402865,
"config_test": false,
"has_no_... |
# a gtk notebook window class
# this module is not officially supported. It may not be part of the PyPlotter
# package in the future!!!
import gtk
from gtk import gdk
try:
import Gfx, gtkGfx, Graph
except ImportError:
from . import Gfx, gtkGfx, Graph
class Canvas(object):
def __init__(self, canvas, pixmap... | {
"repo_name": "jecki/MetaInductionSim",
"path": "PyPlotter/gtkSupport.py",
"copies": "3",
"size": "5079",
"license": "mit",
"hash": -5204706876796183000,
"line_mean": 35.0212765957,
"line_max": 83,
"alpha_frac": 0.5755069896,
"autogenerated": false,
"ratio": 3.5003445899379737,
"config_test": f... |
"""A guestbook sample with sqlite3."""
import logging
import os
import jinja2
import sqlite3
import webapp2
from google.appengine.api import app_identity
from google.appengine.api import modules
from google.appengine.api import runtime
from google.appengine.api import users
from google.appengine.ext import ndb
JINJ... | {
"repo_name": "googlearchive/appengine-sqlite-guestbook-python",
"path": "main.py",
"copies": "1",
"size": "5760",
"license": "apache-2.0",
"hash": 1246022818866695000,
"line_mean": 29.6382978723,
"line_max": 77,
"alpha_frac": 0.6277777778,
"autogenerated": false,
"ratio": 3.980649619903248,
"c... |
''' A guide renderer for displaying grid lines on Bokeh plots.
'''
from __future__ import absolute_import
from ..core.properties import Auto, Either, Float, Include, Instance, Int, Override, String, Tuple
from ..core.property_mixins import FillProps, LineProps
from .renderers import GuideRenderer
from .tickers impor... | {
"repo_name": "dennisobrien/bokeh",
"path": "bokeh/models/grids.py",
"copies": "5",
"size": "2149",
"license": "bsd-3-clause",
"hash": 5343223882948424000,
"line_mean": 30.1449275362,
"line_max": 98,
"alpha_frac": 0.6761284318,
"autogenerated": false,
"ratio": 4.062381852551985,
"config_test": ... |
""" A guide renderer for displaying grid lines on Bokeh plots.
"""
from __future__ import absolute_import
from ..core.properties import Int, String, Float, Auto, Instance, Tuple, Either, Include, Override
from ..core.property_mixins import FillProps, LineProps
from .renderers import GuideRenderer
from .tickers impor... | {
"repo_name": "phobson/bokeh",
"path": "bokeh/models/grids.py",
"copies": "3",
"size": "2078",
"license": "bsd-3-clause",
"hash": 9076661190979161000,
"line_mean": 29.5588235294,
"line_max": 98,
"alpha_frac": 0.6742059673,
"autogenerated": false,
"ratio": 4.050682261208577,
"config_test": false... |
""" A guide renderer for displaying grid lines on Bokeh plots.
"""
from __future__ import absolute_import
from ..properties import Int, String, Float, Auto, Instance, Tuple, Either, Include
from ..mixins import FillProps, LineProps
from .renderers import GuideRenderer
from .tickers import Ticker
class Grid(GuideRen... | {
"repo_name": "lukebarnard1/bokeh",
"path": "bokeh/models/grids.py",
"copies": "4",
"size": "1719",
"license": "bsd-3-clause",
"hash": 8437811642343330000,
"line_mean": 30.2545454545,
"line_max": 83,
"alpha_frac": 0.6748109366,
"autogenerated": false,
"ratio": 4.192682926829268,
"config_test": ... |
""" A guide renderer for displaying grid lines on Bokeh plots.
"""
from __future__ import absolute_import
from ..properties import Int, String, Float, Auto, Instance, Tuple, Either, Include, Override
from ..mixins import FillProps, LineProps
from .renderers import GuideRenderer
from .tickers import Ticker
class Gri... | {
"repo_name": "htygithub/bokeh",
"path": "bokeh/models/grids.py",
"copies": "2",
"size": "2059",
"license": "bsd-3-clause",
"hash": 3633125932498140000,
"line_mean": 29.2794117647,
"line_max": 93,
"alpha_frac": 0.6726566294,
"autogenerated": false,
"ratio": 4.093439363817097,
"config_test": fal... |
"""A GUI, implemented with PyQt4
BeamAnalyzer v0.4.0
Copyright 2014 Evan Murawski
License: MIT
"""
__about = 'BeamAnalyzer v0.4.0\n\nCopyright 2014 Evan Murawski\nLicense: MIT'
__version = 'v0.4.0'
from PyQt4 import QtCore, QtGui
from frontend.guistructure import Ui_Beam
from frontend.forcemomentprompt import Ui_For... | {
"repo_name": "EvanMurawski/BeamAnalyzer",
"path": "beamanalyzer/guiinterface.py",
"copies": "1",
"size": "12446",
"license": "mit",
"hash": 5177508034015693000,
"line_mean": 30.1175,
"line_max": 120,
"alpha_frac": 0.6832717339,
"autogenerated": false,
"ratio": 3.7319340329835082,
"config_test"... |
# A Gui interface allowing the binary illiterate to figure out the ip address the Arduino has been assigned.
import os
import re
from PySide.QtCore import QFile, QMetaObject, QSignalMapper, Slot, QRegExp
from PySide.QtGui import QDialog, QPushButton, QRegExpValidator
from PySide.QtUiTools import QUiLoader
class IPHel... | {
"repo_name": "MHendricks/Motionbuilder-Remote",
"path": "iphelper.py",
"copies": "1",
"size": "3612",
"license": "mit",
"hash": -5365688135667160000,
"line_mean": 31.5405405405,
"line_max": 149,
"alpha_frac": 0.7203765227,
"autogenerated": false,
"ratio": 2.9082125603864735,
"config_test": fal... |
'''A GUI program to analyze data from the geiger counter experiment'''
# The GUI package for python
import Tkinter as tk
import tkFileDialog as tkfd
import tkMessageBox as tkmb
import tkSimpleDialog as tksd
# Our analysis tools
import analyzeData as ad
import PlotData as pd
class App:
'''The driver class for the... | {
"repo_name": "musicalrunner/Geiger-Counter",
"path": "GUI.py",
"copies": "2",
"size": "11856",
"license": "mit",
"hash": 4015887718166713300,
"line_mean": 33.9734513274,
"line_max": 120,
"alpha_frac": 0.6129385965,
"autogenerated": false,
"ratio": 4.370070033173609,
"config_test": false,
"ha... |
"""A hack to allow safe clearing of the cache in django.contrib.sites.
Since django.contrib.sites may not be thread-safe when there are
multiple instances of the application server, we're patching it with
a thread-safe structure and methods that use it underneath.
"""
import threading
from django.contrib.sites.models... | {
"repo_name": "UITools/saleor",
"path": "saleor/site/patch_sites.py",
"copies": "3",
"size": "2508",
"license": "bsd-3-clause",
"hash": 983979381103566300,
"line_mean": 36.4328358209,
"line_max": 78,
"alpha_frac": 0.6427432217,
"autogenerated": false,
"ratio": 3.980952380952381,
"config_test": ... |
# A hack to find "haikus" in English text. For the purposes of this program
# a "haiku" is one or more complete sentences that, together, can be broken
# into groups of 5, 7, and 5 syllables. Each canididate haiku line, and then
# the entire haiku, has to make it through a few heuristics to filter out
# constructions ... | {
"repo_name": "jdf/haikufinder",
"path": "haikufinder/__init__.py",
"copies": "1",
"size": "10271",
"license": "bsd-3-clause",
"hash": 2442744563536365600,
"line_mean": 36.2137681159,
"line_max": 123,
"alpha_frac": 0.5526238925,
"autogenerated": false,
"ratio": 3.4431780087160577,
"config_test"... |
# A handler for all of the information which may be passed in on the command
# line. This singleton object should be able to handle the input, structure
# it and make it available in a useful fashion.
#
# This is a hook into a global data repository, should mostly be replaced with
# a Phil interface.
import collectio... | {
"repo_name": "xia2/xia2",
"path": "src/xia2/Handlers/CommandLine.py",
"copies": "1",
"size": "23317",
"license": "bsd-3-clause",
"hash": 3540070667827939300,
"line_mean": 39.3373702422,
"line_max": 88,
"alpha_frac": 0.5854171134,
"autogenerated": false,
"ratio": 3.88648108018003,
"config_test"... |
# A handler for management of program citations. This should initialise
# from a citations.xml file which can be found in a number of places...
# in particular $HOME or $USERDIR (I think, on Windows) .xia2,
# data etc...
#
# That would be %USERPROFILE%
import os
import xml.dom.minidom
class _Citations:
"""A cla... | {
"repo_name": "xia2/xia2",
"path": "src/xia2/Handlers/Citations.py",
"copies": "1",
"size": "4364",
"license": "bsd-3-clause",
"hash": -438990462421595800,
"line_mean": 30.1714285714,
"line_max": 87,
"alpha_frac": 0.5398716774,
"autogenerated": false,
"ratio": 4.029547553093259,
"config_test": ... |
# A handler for matters of the operating environment, which will impact
# on data harvesting, working directories, a couple of other odds & sods.
import atexit
import ctypes
import logging
import os
import platform
import tempfile
from libtbx.introspection import number_of_processors
logger = logging.getLogger("xia... | {
"repo_name": "xia2/xia2",
"path": "src/xia2/Handlers/Environment.py",
"copies": "1",
"size": "3131",
"license": "bsd-3-clause",
"hash": -7968598544354753000,
"line_mean": 25.7606837607,
"line_max": 87,
"alpha_frac": 0.6285531779,
"autogenerated": false,
"ratio": 3.537853107344633,
"config_test... |
# A handler to manage the data ending up in CIF output file
import bz2
import datetime
import iotbx.cif.model
import xia2.Handlers.Citations
from xia2.Handlers.Versions import versions
mmcif_software_header = (
"_software.pdbx_ordinal",
"_software.citation_id",
"_software.name", # as defined at [1]
... | {
"repo_name": "xia2/xia2",
"path": "src/xia2/Handlers/CIF.py",
"copies": "1",
"size": "9096",
"license": "bsd-3-clause",
"hash": -4668732332784693000,
"line_mean": 39.4266666667,
"line_max": 86,
"alpha_frac": 0.5163808267,
"autogenerated": false,
"ratio": 3.935958459541324,
"config_test": false... |
# A handler to manage the data which needs to end up in the ISPyB database
# mapping xia2 verbose names to ISPyB API field names
# https://github.com/DiamondLightSource/ispyb-api/blob/
# 41bf10db91ab0f0bea91f77a5f37f087c28218ca/ispyb/sp/mxprocessing.py#L28-L32
_name_map = {
"High resolution limit": "res_lim_h... | {
"repo_name": "xia2/xia2",
"path": "src/xia2/Interfaces/ISPyB/__init__.py",
"copies": "1",
"size": "3626",
"license": "bsd-3-clause",
"hash": -4944060234445878000,
"line_mean": 37.1684210526,
"line_max": 88,
"alpha_frac": 0.5728075014,
"autogenerated": false,
"ratio": 3.3419354838709676,
"confi... |
# A handler to manage the data which needs to end up in the ISPyB xml out
# file.
import os
import time
from xia2.Handlers.Files import FileHandler
from xia2.Handlers.Phil import PhilIndex
def sanitize(path):
"""Replace double path separators with single ones."""
double = os.sep * 2
return path.replac... | {
"repo_name": "xia2/xia2",
"path": "src/xia2/Interfaces/ISPyB/ISPyBXmlHandler.py",
"copies": "1",
"size": "17242",
"license": "bsd-3-clause",
"hash": 7327731286512828000,
"line_mean": 36.6462882096,
"line_max": 88,
"alpha_frac": 0.4937942234,
"autogenerated": false,
"ratio": 4.373921867072552,
... |
# A handler to render the index.html template for the MOL AngularJS SPA
from google.appengine.ext.webapp import template
from google.appengine.ext.webapp.util import run_wsgi_app
import logging
import os
import random
import ee_assets
import webapp2
import json
import cache
if 'SERVER_SOFTWARE' in os.environ:
PR... | {
"repo_name": "earthenv/mapotron",
"path": "earthenv.py",
"copies": "1",
"size": "1308",
"license": "bsd-3-clause",
"hash": -1846455668739548200,
"line_mean": 24.6470588235,
"line_max": 77,
"alpha_frac": 0.6391437309,
"autogenerated": false,
"ratio": 3.4603174603174605,
"config_test": false,
... |
# A handy translator that converts control flow into the appropriate
# llvm_cbuilder constructs
from numba.functions import _get_ast, fix_ast_lineno
import inspect, functools, ast
import logging
logger = logging.getLogger(__name__)
def translate(func):
# TODO use meta package
wrapper = functools.wraps(func)
... | {
"repo_name": "llvmpy/llvmpy",
"path": "llvm_cbuilder/translator.py",
"copies": "1",
"size": "5607",
"license": "bsd-3-clause",
"hash": 474415111170880400,
"line_mean": 27.9020618557,
"line_max": 82,
"alpha_frac": 0.5662564651,
"autogenerated": false,
"ratio": 3.8116927260367097,
"config_test":... |
"""A hardware card."""
from csrv.model import actions
from csrv.model import events
from csrv.model import modifiers
from csrv.model.cards import installable_card
from csrv.model import game_object
from csrv.model import timing_phases
from csrv.model.cards import card_info
class Hardware(installable_card.Installable... | {
"repo_name": "mrroach/CentralServer",
"path": "csrv/model/cards/hardware.py",
"copies": "1",
"size": "1364",
"license": "apache-2.0",
"hash": 3393654110893479400,
"line_mean": 26.8367346939,
"line_max": 79,
"alpha_frac": 0.7162756598,
"autogenerated": false,
"ratio": 3.6373333333333333,
"confi... |
"""A health check for OpenShift clusters."""
from openshift_checks import OpenShiftCheck
class EtcdVolume(OpenShiftCheck):
"""Ensures etcd storage usage does not exceed a given threshold."""
name = "etcd_volume"
tags = ["etcd", "health"]
# Default device usage threshold. Value should be in the rang... | {
"repo_name": "ivanhorvath/openshift-tools",
"path": "openshift/installer/vendored/openshift-ansible-3.7.52-1/roles/openshift_health_checker/openshift_checks/etcd_volume.py",
"copies": "48",
"size": "1586",
"license": "apache-2.0",
"hash": -6944093126916974000,
"line_mean": 32.7446808511,
"line_max": 1... |
"""A health check for OpenShift clusters."""
from openshift_checks import OpenShiftCheck, OpenShiftCheckException, get_var
class EtcdVolume(OpenShiftCheck):
"""Ensures etcd storage usage does not exceed a given threshold."""
name = "etcd_volume"
tags = ["etcd", "health"]
# Default device usage thre... | {
"repo_name": "git001/openshift-ansible",
"path": "roles/openshift_health_checker/openshift_checks/etcd_volume.py",
"copies": "3",
"size": "2253",
"license": "apache-2.0",
"hash": 8968467564501589000,
"line_mean": 37.8448275862,
"line_max": 112,
"alpha_frac": 0.5823346649,
"autogenerated": false,
... |
"""A health check for OpenShift clusters."""
from openshift_checks import OpenShiftCheck, OpenShiftCheckException
class EtcdVolume(OpenShiftCheck):
"""Ensures etcd storage usage does not exceed a given threshold."""
name = "etcd_volume"
tags = ["etcd", "health"]
# Default device usage threshold. Va... | {
"repo_name": "rhdedgar/openshift-tools",
"path": "openshift/installer/vendored/openshift-ansible-3.6.173.0.27/roles/openshift_health_checker/openshift_checks/etcd_volume.py",
"copies": "1",
"size": "2050",
"license": "apache-2.0",
"hash": -6929326387651361000,
"line_mean": 36.2727272727,
"line_max": 1... |
"""A heap that is used in the persistentdb implementation
"""
# from .persistentdb import TYPES, TYPE_DEFAULT
import os
import struct
import timeseries
import json
import pickle
from tsdb.tsdb_constants import *
class HeapFile:
def __init__(self, heap_file_name):
self.filename = heap_file_name
if ... | {
"repo_name": "cs207-project/TimeSeries",
"path": "tsdb/utils_heapfile.py",
"copies": "1",
"size": "4660",
"license": "mit",
"hash": 4774316766354948000,
"line_mean": 39.5304347826,
"line_max": 118,
"alpha_frac": 0.6027896996,
"autogenerated": false,
"ratio": 3.767178658043654,
"config_test": f... |
"""A hello world.
Uses the main libraries to verify the environment installation.
"""
import sys
import matplotlib.pyplot as plt
import numpy as np
# import pydensecrf.densecrf as crf
import pymia.evaluation.evaluator as pymia_eval
import SimpleITK as sitk
import sklearn.ensemble as sk_ensemble
def main():
pr... | {
"repo_name": "istb-mia/MIALab",
"path": "bin/hello_world.py",
"copies": "1",
"size": "1189",
"license": "apache-2.0",
"hash": 884831718512091100,
"line_mean": 22.3137254902,
"line_max": 73,
"alpha_frac": 0.6518082422,
"autogenerated": false,
"ratio": 3.330532212885154,
"config_test": false,
... |
"""A hello world.
Uses the main libraries to verify the environment installation.
"""
import sys
import numpy as np
import matplotlib.pyplot as plt
import pydensecrf.densecrf as crf
import SimpleITK as sitk
import tensorflow as tf
from tensorflow.python.platform import app
def main(_):
print('Welcome to MIALa... | {
"repo_name": "mrunibe/MIALab",
"path": "bin/hello_world.py",
"copies": "2",
"size": "1397",
"license": "apache-2.0",
"hash": -5885000275245065000,
"line_mean": 22.2833333333,
"line_max": 65,
"alpha_frac": 0.6471009306,
"autogenerated": false,
"ratio": 3.5100502512562812,
"config_test": false,
... |
# A hello world program. From the Curio tutorial at
# https://curio.readthedocs.org/en/latest/tutorial.html
#
import curio
import signal
import os
async def countdown(n):
while n > 0:
print('T-minus', n)
await curio.sleep(1)
n -= 1
start_evt = curio.Event()
def fib(n):
if n <= 2:
... | {
"repo_name": "ABaldwinHunter/curio-clone",
"path": "examples/hello.py",
"copies": "2",
"size": "1436",
"license": "bsd-3-clause",
"hash": -9002006542629399000,
"line_mean": 22.9333333333,
"line_max": 59,
"alpha_frac": 0.5793871866,
"autogenerated": false,
"ratio": 3.3163972286374133,
"config_t... |
"""A helper class for managing batch normalization state.
This class is designed to simplify adding batch normalization
(http://arxiv.org/pdf/1502.03167v3.pdf) to your model by
managing the state variables associated with it.
Important ... | {
"repo_name": "mikowals/mnist",
"path": "batchnormalizer.py",
"copies": "1",
"size": "3442",
"license": "mit",
"hash": 862960271378793300,
"line_mean": 45.527027027,
"line_max": 103,
"alpha_frac": 0.5694363742,
"autogenerated": false,
"ratio": 4.016336056009335,
"config_test": false,
"has_no_... |
"""A helper class for managing batch normalization state.
This class is designed to simplify adding batch normalization
(http://arxiv.org/pdf/1502.03167v3.pdf) to your model by
managing the state variables associated with it.
Important use note: The function get_assigner() returns
an op that must be executed to save... | {
"repo_name": "bperez77/ensemble_colorization",
"path": "batchnorm.py",
"copies": "1",
"size": "2591",
"license": "mit",
"hash": 2712846777727487500,
"line_mean": 38.8615384615,
"line_max": 75,
"alpha_frac": 0.6730991895,
"autogenerated": false,
"ratio": 3.6288515406162465,
"config_test": false... |
"""A helper class to encrypt and decrypt passwords.
Example and documentation provided at the link below is pre-req for
understanding this helper.
https://www.dlitz.net/software/pycrypto/api/current/Crypto.Cipher.AES-module.html
Some key points from the documentation:
The block size determines the AES key size:
16 ... | {
"repo_name": "google/googleapps-password-generator",
"path": "password_crypto_helper.py",
"copies": "1",
"size": "3421",
"license": "apache-2.0",
"hash": -6688642634925044000,
"line_mean": 36.1847826087,
"line_max": 96,
"alpha_frac": 0.7521192634,
"autogenerated": false,
"ratio": 4.0437352245862... |
"""A helper, CLI tool for working with py_func's defining E2E tests.
This CLI provides methods for printing and submitting Argo workflows defined
by py_funcs.
"""
import fire
import logging
from kubernetes import client as k8s_client
import retrying
import yaml
from kubeflow.testing import argo_build_util
from kubefl... | {
"repo_name": "kubeflow/testing",
"path": "py/kubeflow/testing/e2e_tool.py",
"copies": "1",
"size": "5135",
"license": "apache-2.0",
"hash": 2317426944090240500,
"line_mean": 32.3441558442,
"line_max": 90,
"alpha_frac": 0.6311587147,
"autogenerated": false,
"ratio": 3.872549019607843,
"config_t... |
"""a helper for easy creation of gdb pretty-printers"""
import gdb.printing
# in python2 gdb.Value can only be converted to long(), python3 only has int()
try: a=long(1)
except: long=int
pp_registry=dict();
class PPWrapper:
def __init__(self, prefix, val, cb):
self.prefix = prefix
self.val = val... | {
"repo_name": "vuvova/gdb-tools",
"path": "pretty_printer/__init__.py",
"copies": "1",
"size": "2298",
"license": "bsd-3-clause",
"hash": -3361648743952572000,
"line_mean": 29.64,
"line_max": 78,
"alpha_frac": 0.6074847694,
"autogenerated": false,
"ratio": 3.9215017064846416,
"config_test": fal... |
"""A helper function for parsing and executing parse_format skills."""
import logging
from parse import parse, search
from opsdroid.parsers.regex import calculate_score
_LOGGER = logging.getLogger(__name__)
async def match_format(text, opts):
"""Match a message considering the options."""
case_sensitive ... | {
"repo_name": "opsdroid/opsdroid",
"path": "opsdroid/parsers/parseformat.py",
"copies": "3",
"size": "1586",
"license": "apache-2.0",
"hash": -619019288963816600,
"line_mean": 32.7446808511,
"line_max": 76,
"alpha_frac": 0.525851198,
"autogenerated": false,
"ratio": 4.806060606060606,
"config_t... |
"""A helper function for parsing and executing regex skills."""
import logging
import regex
_LOGGER = logging.getLogger(__name__)
async def calculate_score(expression, score_factor):
"""Calculate the score of a regex."""
# The score asymptotically approaches the max score
# based on the length of the ex... | {
"repo_name": "opsdroid/opsdroid",
"path": "opsdroid/parsers/regex.py",
"copies": "3",
"size": "2049",
"license": "apache-2.0",
"hash": 8124897137846753000,
"line_mean": 36.2545454545,
"line_max": 86,
"alpha_frac": 0.5524646169,
"autogenerated": false,
"ratio": 4.625282167042889,
"config_test":... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.