text stringlengths 4 1.02M | meta dict |
|---|---|
__author__ = 'jawaad'
from distutils.core import setup
setup(name='pytbar',
version='0.300',
description='Library that converts the Japanese Post Office\'s CSV files into a python class. These are '
'thereafter added to a database.',
author='Jawaad Mahmood',
author_email='id... | {
"content_hash": "1e164c7ac92b0a07a25321f4c99a26ad",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 112,
"avg_line_length": 35.38461538461539,
"alnum_prop": 0.6413043478260869,
"repo_name": "jmahmood/pytbar",
"id": "7b79fa050b37bf1067fd1ca82c23662ae43037f6",
"size": "482"... |
import unittest
import numpy
from numpy.testing.utils import assert_almost_equal
from cmepy.statistics import Distribution
from cmepy.measurement import Measurement
class MeasurementTests(unittest.TestCase):
def test_attribute_trickery(self):
m = Measurement()
m.write(0.0, Distribution({(0, ) : 1... | {
"content_hash": "988086a4c77737c7e55c7072aeb80418",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 73,
"avg_line_length": 27.03030303030303,
"alnum_prop": 0.570627802690583,
"repo_name": "hegland/cmepy",
"id": "d822348ece9542534885a5290bb3d715f1031802",
"size": "892",
... |
from __future__ import absolute_import
import logging
import os.path
import re
from pip._vendor.packaging.version import parse as parse_version
from pip._vendor.six.moves.urllib import parse as urllib_parse
from pip._vendor.six.moves.urllib import request as urllib_request
from pip._internal.compat import samefile
f... | {
"content_hash": "5fd78b096bb10afaa0d6e4b09eef8313",
"timestamp": "",
"source": "github",
"line_count": 307,
"max_line_length": 79,
"avg_line_length": 36.45928338762215,
"alnum_prop": 0.5539176270883588,
"repo_name": "zvezdan/pip",
"id": "3528d8fd9b3b237231e0c2873a5ccb0b431a0e29",
"size": "11193",
... |
import re, os, signal, time, filecmp, stat, fileinput
import yaml
from gppylib.commands.gp import GpStart, chk_local_db_running
from gppylib.commands.base import Command, ExecutionError, REMOTE
from gppylib.db import dbconn
from gppylib.gparray import GpArray, MODE_SYNCHRONIZED
from gppylib.operations.backup_utils impo... | {
"content_hash": "4e050683937c919adf0568832196172f",
"timestamp": "",
"source": "github",
"line_count": 1438,
"max_line_length": 246,
"avg_line_length": 44.50556328233658,
"alnum_prop": 0.6194315536180253,
"repo_name": "foyzur/gpdb",
"id": "86aefb7d2c44e4ff8f0fd72eb2ead89e0639e754",
"size": "64021"... |
from setuptools import setup
from setuptools.command.upload import upload
import os
class ReleaseToPyPICommand(upload):
def finalize_options(self):
self.repository = 'https://upload.pypi.org/legacy/'
self.username = os.environ['PYPI_USERNAME']
self.password = os.environ['PYPI_PASSWORD']
... | {
"content_hash": "6116b15a62174acb2b3324666c25817d",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 83,
"avg_line_length": 25.736842105263158,
"alnum_prop": 0.6380368098159509,
"repo_name": "ApplauseOSS/djangoevents",
"id": "462bf0fc8cf0520dc87ccd38ac5112889e74c1a4",
"siz... |
"""
pgoapi - Pokemon Go API
Copyright (c) 2016 tjado <https://github.com/tejado>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use... | {
"content_hash": "b0a7e3f721acc548177d5837392ae98a",
"timestamp": "",
"source": "github",
"line_count": 151,
"max_line_length": 79,
"avg_line_length": 29.05298013245033,
"alnum_prop": 0.6826988830635969,
"repo_name": "rubenvereecken/pokemongo-api",
"id": "fc8ce0412c40ae4a2c3d31cc21a2cea99c1887e6",
... |
"""Review Board feature checkers."""
from __future__ import unicode_literals
from djblets.features.checkers import SiteConfigFeatureChecker
class RBFeatureChecker(SiteConfigFeatureChecker):
"""Feature checker that checks against a LocalSite's configuration.
Features can be enabled/disabled on a per-LocalSi... | {
"content_hash": "7e8a539fe2544983a671cab7f321600b",
"timestamp": "",
"source": "github",
"line_count": 68,
"max_line_length": 78,
"avg_line_length": 36.544117647058826,
"alnum_prop": 0.6120724346076458,
"repo_name": "brennie/reviewboard",
"id": "df595097e4f68c115b6d42ba4ee05147e93b6134",
"size": "... |
import json
from django.template.loader import render_to_string
__version__ = (0, 1, 2)
class SirTrevorContent(str):
@property
def html(self):
html = []
content = json.loads(self)
for block in content['data']:
template_name = 'sirtrevor/blocks/%s.html' % block['type']
... | {
"content_hash": "e8a6830774896124d6fbfc0842da6b4c",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 71,
"avg_line_length": 26.125,
"alnum_prop": 0.6028708133971292,
"repo_name": "Tarun12345/rat-notes",
"id": "11c9091764581b7006e84bc2d346a653086b3fd3",
"size": "418",
"bi... |
"""This module exports the Htmlhint plugin class."""
import logging
import sublime
from SublimeLinter.lint import LintMatch, NodeLinter
logger = logging.getLogger("SublimeLinter.plugin.htmlhint")
class Htmlhint(NodeLinter):
"""Provides an interface to htmlhint."""
cmd = ("htmlhint", "--format", "json", ... | {
"content_hash": "b3f0315f35129f7f61f2c037580e023e",
"timestamp": "",
"source": "github",
"line_count": 60,
"max_line_length": 86,
"avg_line_length": 28.066666666666666,
"alnum_prop": 0.5605700712589073,
"repo_name": "mmaday/SublimeLinter-contrib-htmlhint",
"id": "b63018bbc33b13a7bf41d5ed6dd58bbd3501... |
"""
The MIT License (MIT)
Copyright (c) 2014 - 2016 Mohab Usama
"""
import logging
VERSION = '0.11'
logger = logging.getLogger(__name__)
logger.setLevel(logging.INFO)
logger.handlers = [logging.StreamHandler()]
| {
"content_hash": "c26c0e4cd9279636d120202da9d83e5d",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 43,
"avg_line_length": 14.466666666666667,
"alnum_prop": 0.7004608294930875,
"repo_name": "mohabusama/pyguacamole",
"id": "10e28abb06963440c172e3f2f2fef0987f1c59a0",
"size"... |
listen_ip = '' # empty stays for 0.0.0.0
listen_port = 9090
connections = 30
target_server = 'kirito.la.net.ua'
from gevent.pywsgi import WSGIServer
from gevent.pool import Pool
from m3u8_streamer import M3u8Streamer
from urlparse import urljoin
class ResultWrapper(object):
def __init__(self, data, close):
... | {
"content_hash": "50aca115ac2df85825b6fc162ab04107",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 94,
"avg_line_length": 26.954545454545453,
"alnum_prop": 0.6104553119730185,
"repo_name": "rain87/hls-glue",
"id": "87dff38df61ad9cdb539452ef6ca9f5f3d35405e",
"size": "1249... |
from django.db import models
from django.core.validators import validate_unicode_slug
import sys
from functools import partial
from collections import defaultdict
from abc import ABC, abstractmethod
from django.core.exceptions import ValidationError
from django.utils import timezone
from datetime import timedelta
cla... | {
"content_hash": "8c407f344ca4f95408d51990a7537c92",
"timestamp": "",
"source": "github",
"line_count": 163,
"max_line_length": 75,
"avg_line_length": 28.337423312883434,
"alnum_prop": 0.6332539510716605,
"repo_name": "TenStrings/organizador-de-asados",
"id": "2e31228d7eaa450217138ffe8f28b525e9b10d95... |
import os
import re
import json
import requests
import signal
import httpretty
from freezegun import freeze_time
from contextlib import contextmanager
from sure import within, miliseconds, expect
from tornado import version as tornado_version
from httpretty import HTTPretty, httprettified
from httpretty.core import de... | {
"content_hash": "d5a73dc766b7492b00c818864c0de9be",
"timestamp": "",
"source": "github",
"line_count": 925,
"max_line_length": 551,
"avg_line_length": 36.101621621621625,
"alnum_prop": 0.6510750434209738,
"repo_name": "gabrielfalcao/HTTPretty",
"id": "55aa109d46a64c410d77448716c185e36e4fce39",
"si... |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Card',
fields=[
('id', models.AutoField(auto_create... | {
"content_hash": "ccd8c02d8455615e673fdee9ee84e428",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 114,
"avg_line_length": 26.291666666666668,
"alnum_prop": 0.5451664025356577,
"repo_name": "ualikhansars/Gwent",
"id": "6a98507a9ef501bed84201d1bc28f4227aa21ebe",
"size": "... |
import gdal
import getopt
import json
import math
import numpy
import os
import sys
import tempfile
from gdalconst import *
from osgeo import osr
from dateutil.parser import parse
from pymrgeo import MrGeo
from pymrgeo.rastermapop import RasterMapOp
# The purpose of this script is to provide an example of how pymrg... | {
"content_hash": "dbb14c6b45aba26f9a94ce89252146d6",
"timestamp": "",
"source": "github",
"line_count": 239,
"max_line_length": 119,
"avg_line_length": 42.0836820083682,
"alnum_prop": 0.6102604891628555,
"repo_name": "ngageoint/mrgeo",
"id": "99c5a02c75ac7678c7283a0da98523ab47e0cecb",
"size": "1008... |
'''
pydiatra helper functions
'''
import contextlib
class ExceptionContext(object):
def __init__(self):
self.exception = None
def __str__(self):
return str(self.exception)
def __nonzero__(self):
return self.exception is not None
__bool__ = __nonzero__
def __enter__(sel... | {
"content_hash": "951b75a7336379d248d85bf0605e2ed5",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 48,
"avg_line_length": 20.1,
"alnum_prop": 0.5970149253731343,
"repo_name": "jwilk/pydiatra",
"id": "481d735171307faf9de69e5317b1a223112faaca",
"size": "2143",
"binary": ... |
import os
from pymongo import read_preferences
class Config(object):
# Secret key for the cookies. Change in production.
SECRET_KEY = 'secret'
# Mongo DB settings.
MONGODB_SETTINGS = {
'db': 'next_frontend',
'host': os.environ.get('MONGODB_PORT_27017_TCP_ADDR','localhost'),
'po... | {
"content_hash": "e3464253a79bb834ea250afc5f60b94b",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 101,
"avg_line_length": 37.724137931034484,
"alnum_prop": 0.6860146252285192,
"repo_name": "lalitkumarj/NEXT-psych",
"id": "d162288e92929ef07c476c6ced2efb5bd8f3d8f6",
"size... |
import itertools
import uuid
try:
import asyncio
except ImportError:
import trollius as asyncio
import daiquiri
from oslo_config import cfg
import six
from gnocchi import incoming
from gnocchi import indexer
from gnocchi import service
from gnocchi import storage
from gnocchi import utils
LOG = daiquiri.get... | {
"content_hash": "58a3de18c7ec78322127ac211dac297a",
"timestamp": "",
"source": "github",
"line_count": 181,
"max_line_length": 79,
"avg_line_length": 35.6353591160221,
"alnum_prop": 0.5485271317829458,
"repo_name": "leandroreox/gnocchi",
"id": "3db68a14f383bc1ccb2a34c2e9a9473454c70bd6",
"size": "7... |
from designate import objects
from designate.objects.adapters.api_v2 import base
class TsigKeyAPIv2Adapter(base.APIv2Adapter):
ADAPTER_OBJECT = objects.TsigKey
MODIFICATIONS = {
'fields': {
"id": {},
"name": {
'read_only': False
},
"algor... | {
"content_hash": "a24f93f104e1417243ec6098632c42d6",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 50,
"avg_line_length": 24.65909090909091,
"alnum_prop": 0.43870967741935485,
"repo_name": "openstack/designate",
"id": "ff9535ebcc6fe53d4105c60507d74d3488d99a6b",
"size": "... |
import attr
from . import gentoo
from .utils import remove_spaces
class InvalidVersion(ValueError):
pass
def is_valid_alpine_version(s):
"""
Return True is the string `s` is a valid Alpine version.
We do not support yet version strings that start with
non-significant zeros.
For example:
>>> is_valid_... | {
"content_hash": "98eaa9283ee401fbf3d57f48e6f31de1",
"timestamp": "",
"source": "github",
"line_count": 153,
"max_line_length": 80,
"avg_line_length": 29.640522875816995,
"alnum_prop": 0.6760749724366042,
"repo_name": "google/osv.dev",
"id": "fb69334ffbef077797762aa6e08d640b29ef7b20",
"size": "4709... |
"""fontTools.pens.pointInsidePen -- Pen implementing "point inside" testing
for shapes.
"""
from __future__ import print_function, division, absolute_import
from fontTools.misc.py23 import *
from fontTools.pens.basePen import BasePen
from fontTools.misc.bezierTools import solveQuadratic, solveCubic
__all__ = ["Point... | {
"content_hash": "2ef1f14d1d13abaf825a062f6231ba5c",
"timestamp": "",
"source": "github",
"line_count": 192,
"max_line_length": 83,
"avg_line_length": 27.828125,
"alnum_prop": 0.6704098820887142,
"repo_name": "Pal3love/otRebuilder",
"id": "3311841bd1130e5706caaa801b13951a5a4ff353",
"size": "5343",
... |
import os
from hashlib import md5
import requests
class RClient(object):
def __init__(self, username, password, soft_id, soft_key):
self.base_params = {
'username': username,
'password': md5(password.encode('utf-8')).hexdigest(),
'softid': soft_id,
'softkey... | {
"content_hash": "3d9f5674c386210a9f5670e9827ac0d4",
"timestamp": "",
"source": "github",
"line_count": 59,
"max_line_length": 111,
"avg_line_length": 29.491525423728813,
"alnum_prop": 0.5678160919540229,
"repo_name": "Chyroc/WechatSogou",
"id": "740e410acccb6b92979894ced28eba8424e5d02a",
"size": "... |
import asyncio
import discord
from discord.ext import commands
from cogs.utils import checks
from cogs.utils.storage import RedisDict
class TemporaryVoice:
"""A cog to create TeamSpeak-like voice channels."""
def __init__(self, liara):
self.liara = liara
self.config = RedisDict('pandentia.te... | {
"content_hash": "8d4d3462877f2c89a68ca116cef27ea3",
"timestamp": "",
"source": "github",
"line_count": 97,
"max_line_length": 102,
"avg_line_length": 38.36082474226804,
"alnum_prop": 0.5958075786079011,
"repo_name": "Pandentia/Liara-Cogs",
"id": "fc0f80b7693af0ccec93f32801a503c35c4da057",
"size": ... |
import grpc
from google.cloud.container_v1beta1.proto import (
cluster_service_pb2 as google_dot_cloud_dot_container__v1beta1_dot_proto_dot_cluster__service__pb2,
)
from google.protobuf import empty_pb2 as google_dot_protobuf_dot_empty__pb2
class ClusterManagerStub(object):
"""Google Kubernetes Engine Cluste... | {
"content_hash": "1418b845076dc91e670517010aefdd8f",
"timestamp": "",
"source": "github",
"line_count": 601,
"max_line_length": 156,
"avg_line_length": 61.673876871880196,
"alnum_prop": 0.717369017428371,
"repo_name": "tseaver/google-cloud-python",
"id": "f722b4a8133853ddcde5fa36ed0487ffd06f2773",
... |
import os
import redis
import urlparse
from werkzeug.wrappers import Request, Response
from werkzeug.routing import Map, Rule
from werkzeug.exceptions import HTTPException, NotFound
from werkzeug.wsgi import SharedDataMiddleware
from werkzeug.utils import redirect
from jinja2 import Environment, FileSystemLoader
clas... | {
"content_hash": "5da8a1a24993f306e1c9ac935097a61f",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 76,
"avg_line_length": 29.91111111111111,
"alnum_prop": 0.6760772659732541,
"repo_name": "hugoxia/Python",
"id": "06737ca6c622cac8c79bb9b27200467012b1e1cf",
"size": "1346",... |
import logging
import gen
from gen.build_deploy.bash import onprem_source
# TODO(cmaloney): Should be able to pass an exact tree to gen so that we can test
# one little piece at a time rather than having to rework this every time that
# DC/OS parameters change.
def test_error_during_calc(monkeypatch):
monkeypatc... | {
"content_hash": "d9a37b8a0ef138d0dca5bc8920445d1c",
"timestamp": "",
"source": "github",
"line_count": 78,
"max_line_length": 116,
"avg_line_length": 34.93589743589744,
"alnum_prop": 0.5761467889908257,
"repo_name": "dcos/dcos",
"id": "e15b9fb72f3dfe11b8db17e7b139e94018277c37",
"size": "2725",
"... |
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import django_fsm
import uuid
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
... | {
"content_hash": "1429673b9f0697eeb3800011e08c2856",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 86,
"avg_line_length": 32.857142857142854,
"alnum_prop": 0.4483695652173913,
"repo_name": "fin/froide",
"id": "ff62019a28a1385d15f19abca9900d02fff8d467",
"size": "1889",
... |
from twisted.web.resource import Resource
class WSGIRootResource(Resource):
def __init__(self, wsgiResource, children):
"""
Creates a Twisted Web root resource.
"""
Resource.__init__(self)
self._wsgiResource = wsgiResource
self.children = children
def getChild(s... | {
"content_hash": "e5308131a8c528c4fd24511fc288ec4d",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 47,
"avg_line_length": 29.733333333333334,
"alnum_prop": 0.6300448430493274,
"repo_name": "cravler/flask-twisted",
"id": "e7b46a74e85ddc9c3e7f0b8aff9477a878b20243",
"size":... |
from typing import List
import databases
import sqlalchemy
from fastapi import FastAPI
from pydantic import BaseModel
# SQLAlchemy specific code, as with any other app
DATABASE_URL = "sqlite:///./test.db"
# DATABASE_URL = "postgresql://user:password@postgresserver/db"
database = databases.Database(DATABASE_URL)
met... | {
"content_hash": "e7679bb496a5aedd57b11cea877483f1",
"timestamp": "",
"source": "github",
"line_count": 65,
"max_line_length": 75,
"avg_line_length": 21.76923076923077,
"alnum_prop": 0.7102473498233216,
"repo_name": "tiangolo/fastapi",
"id": "cbf43d790f69b416a0530af00eeea00edfa7d227",
"size": "1415... |
import os
import subprocess
#
# Checks all files in 'files' to be self-sufficient by creating a simple source file with contents:
# #include <file>
# int main() {}
# and hands it over to the compiler. In the case of an error, the compiler output is printed and an exception thrown.
#
def run_include_check(files, co... | {
"content_hash": "a42707adc0c1e952dc38dcd7376516c1",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 130,
"avg_line_length": 29.07547169811321,
"alnum_prop": 0.6768332251784556,
"repo_name": "viennagrid/viennagrid-dev",
"id": "dea6eb4eeba73321820f5dfba234923b0f244438",
"si... |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('psoriassist', '0004_auto_20160313_1405'),
]
operations = [
migrations.AlterField(
model_name='lesion',
name='i... | {
"content_hash": "23a03c565dbd82e206d6162efd20a0a8",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 64,
"avg_line_length": 22.944444444444443,
"alnum_prop": 0.5738498789346247,
"repo_name": "maxprais/psoriassist",
"id": "5a5473ef2df0de9a9ce5b06190b3d4664f626ee2",
"size": ... |
import json
import urllib2
from ..models import Airport
from .. import BasicAPI
ENDPOINT_URL = 'https://api.flightstats.com/flex/airports/rest/v1/json/'
class Flightstats(BasicAPI):
is_multilingual = True
def __init__(self,*args,**kwargs):
self.app_id = kwargs['app_id']
self.app_key... | {
"content_hash": "3c488a8d7a2594ad0469e004a79a7f1c",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 107,
"avg_line_length": 40.57692307692308,
"alnum_prop": 0.5303317535545023,
"repo_name": "illing2005/django-airports-apis",
"id": "f8dcb7e47b8605b02b75f09546e279ca250d8472",... |
from itertools import product
from fractions import gcd
def compute():
side_length = 50
# Triangles with the right-angle at (0, 0)
num_triangles = side_length ** 2
# Triangles with the right-angle elsewhere
for x, y in product(range(0, side_length + 1), repeat=2):
if x == 0 and y == 0:
continue
# Find s... | {
"content_hash": "19e69940015bf584dc95eaea15265a27",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 68,
"avg_line_length": 19,
"alnum_prop": 0.5897129186602871,
"repo_name": "Bathlamos/Project-Euler-Solutions",
"id": "4948a5fde6257afe9b4c5baaa28fa6e823e7d5c2",
"size": "95... |
"""Wrapper around the exif library to extract and convert some information.
"""
import datetime
import fractions
import warnings
import exif
# Some helper classes for exif attributes, having customized string
# representations.
class ExposureTime(fractions.Fraction):
def __str__(self):
if self.denominato... | {
"content_hash": "b50f3ba2f431d0daa8507e978ee0e303",
"timestamp": "",
"source": "github",
"line_count": 132,
"max_line_length": 75,
"avg_line_length": 27.704545454545453,
"alnum_prop": 0.5490839485917418,
"repo_name": "RKrahl/photo-tools",
"id": "f1ab6a3b0cca797341b0ad1db813a2a80029b891",
"size": "... |
import logging
import sys
import fiona
logging.basicConfig(stream=sys.stderr, level=logging.DEBUG)
def test_collection_get():
with fiona.open('docs/data/test_uk.shp') as src:
result = src[5]
assert result['id'] == '5'
def test_collection_slice():
with fiona.open('docs/data/test_uk.shp') as s... | {
"content_hash": "c60cbba968df0ef0b61833d778a2dcfa",
"timestamp": "",
"source": "github",
"line_count": 75,
"max_line_length": 59,
"avg_line_length": 26.573333333333334,
"alnum_prop": 0.5499247365780231,
"repo_name": "johanvdw/Fiona",
"id": "6e4d62a01f38c95549b884b794bace24e7c33790",
"size": "1993"... |
from __future__ import unicode_literals
from moto.core.responses import BaseResponse
from moto.ec2.utils import filters_from_querystring
from moto.core import ACCOUNT_ID
def try_parse_int(value, default=None):
try:
return int(value)
except (TypeError, ValueError):
return default
def parse_s... | {
"content_hash": "aa8c9480782d0d670bdb695b39e6d8d3",
"timestamp": "",
"source": "github",
"line_count": 298,
"max_line_length": 135,
"avg_line_length": 40.2248322147651,
"alnum_prop": 0.5276549595395011,
"repo_name": "william-richard/moto",
"id": "60645e1659cd342c10fa0b41124fd019dee74e63",
"size": ... |
try:
import cPickle as pickle
except:
import pickle
from hashlib import md5
import time
import functools
import base64
from sqlalchemy.sql import text as _sql
from twisted.internet import reactor
from twisted.logger import Logger
CACHE_SET_EVENT = 'cache_set'
CACHE_DELETE_EVENT = 'cache_delete'
CACHE_UPDATE_EVEN... | {
"content_hash": "e5e8187fec6737320d7db9b91c702e2b",
"timestamp": "",
"source": "github",
"line_count": 185,
"max_line_length": 127,
"avg_line_length": 35.178378378378376,
"alnum_prop": 0.5175169022741242,
"repo_name": "talkincode/toughlib",
"id": "ebf89daf4be78c02f2e6ffe2b99668d5ce67410b",
"size":... |
"""Test the preciousblock RPC."""
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import (
assert_equal,
connect_nodes_bi,
sync_chain,
sync_blocks,
)
def unidirectional_node_sync_via_rpc(node_src, node_dest):
blocks_to_copy = []
blockhash = node_src.getb... | {
"content_hash": "a08bfaa8792187f1c14a48df1662fe02",
"timestamp": "",
"source": "github",
"line_count": 110,
"max_line_length": 127,
"avg_line_length": 44.42727272727273,
"alnum_prop": 0.6451810926949049,
"repo_name": "nmarley/dash",
"id": "99db817d2b98cef811ed42dbc2eae59092bed81e",
"size": "5096",... |
import unittest
import mechanize
from links import links
class LinksTest(unittest.TestCase):
"""Test para 'links.py'"""
def test_obtener_parametros_de_la_url(self):
url_unlam = 'http://www.unlam.edu.ar/index.php'
url_unlam_con_parametros = 'http://www.unlam.edu.ar/index.php?seccion=-... | {
"content_hash": "5ed75f225487428e5091f262fa1b9f52",
"timestamp": "",
"source": "github",
"line_count": 114,
"max_line_length": 138,
"avg_line_length": 46.64035087719298,
"alnum_prop": 0.567801391762272,
"repo_name": "leapalazzolo/XSS",
"id": "62ff02a6bac3206fc4fd091a30ff001276808ac7",
"size": "536... |
import re
import operator
from collections import Counter
from zipfile import ZipFile
from numpy import array
from scipy import zeros
from scipy.stats import chisquare
kWORDS = re.compile("[a-z]{1,}")
kSTOPWORDS = set(['i', 'me', 'my', 'myself', 'we', 'our', 'ours', 'ourselves', 'yo',
'your', 'yours... | {
"content_hash": "0f49ac234eda8dff87100798fb6ef2e8",
"timestamp": "",
"source": "github",
"line_count": 208,
"max_line_length": 88,
"avg_line_length": 32.11538461538461,
"alnum_prop": 0.5392215568862275,
"repo_name": "Pinafore/ds-hw",
"id": "dfb918fb45914c6b071e729c24ba5f7e1751b0d1",
"size": "6680"... |
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Changing field 'PendingTimelineShare.user'
db.alter_column(u'timeline_pendingtimelineshare', 'user_id', self.gf('django.db.models... | {
"content_hash": "11125ffd52acd98a21d4db0ccfedd84b",
"timestamp": "",
"source": "github",
"line_count": 122,
"max_line_length": 196,
"avg_line_length": 81.82786885245902,
"alnum_prop": 0.5616548131824101,
"repo_name": "drawquest/drawquest-web",
"id": "5f81b364bcce575417239fcbb806c01299810bad",
"siz... |
import os.path as op
import warnings
import copy
import numpy as np
from .fixes import _get_img_fdata
from .parallel import parallel_func
from .source_estimate import (
_BaseSurfaceSourceEstimate, _BaseVolSourceEstimate, _BaseSourceEstimate,
_get_ico_tris)
from .source_space import SourceSpaces, _ensure_src, _... | {
"content_hash": "c03bc324d58b9ee386f4995d034817f2",
"timestamp": "",
"source": "github",
"line_count": 1426,
"max_line_length": 102,
"avg_line_length": 41.90953716690042,
"alnum_prop": 0.5855964392684437,
"repo_name": "kambysese/mne-python",
"id": "9dc40425d307d2a1e4a6209316534bc02b9dd1c6",
"size"... |
import os
from flask import Flask, render_template, request, flash
from cookbook import Brewery, Beer
import boto3
from botocore.exceptions import ClientError
app = Flask(__name__)
app.secret_key = os.urandom(24)
table_name= 'dev-brewblog'
dynamo_control = boto3.client('dynamodb')
dynamo_data = boto3.resource('dynamo... | {
"content_hash": "9f3a012f0d9c86e69703eb932e1c8ee7",
"timestamp": "",
"source": "github",
"line_count": 76,
"max_line_length": 78,
"avg_line_length": 33.89473684210526,
"alnum_prop": 0.5690993788819876,
"repo_name": "stewmi/brew-blog",
"id": "f1ae654a00fd21eef725f150e796ff052e887343",
"size": "2576... |
import pyos
import urllib2
from urllib import urlretrieve
from apps.pman.fuzzywuzzy import fuzz
from datetime import timedelta
import time
"""
PMan Specific app.json parameters.
Specified under the key "pman".
{
"pman": {
"depends": [] - A list of packages on which the app depends.
"min_os": 1.0 -... | {
"content_hash": "595239a4fd8d37e060a15ec76427b8bd",
"timestamp": "",
"source": "github",
"line_count": 596,
"max_line_length": 174,
"avg_line_length": 45.17953020134228,
"alnum_prop": 0.5649348237828202,
"repo_name": "furmada/PythonOS",
"id": "8c15cc6a06aa58d6c6f32b08a99088704bd06c07",
"size": "26... |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('cdadmap', '0037_auto_20151106_1149'),
]
operations = [
migrations.AddField(
model_name='surveypanel',
name='instagram',
... | {
"content_hash": "07ab2039798d4ec018e3eef8c30969e9",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 74,
"avg_line_length": 27.535714285714285,
"alnum_prop": 0.5758754863813229,
"repo_name": "NiJeLorg/CDADMap",
"id": "d35f8b6cefcfe92dada730041735f84798dcffcf",
"size": "795... |
from __future__ import print_function, division
import sys
import os
sys.path.append(os.path.abspath("."))
sys.dont_write_bytecode = True
from sklearn.model_selection import KFold
import numpy as np
def loo(dataset):
"""
Leave one out experiment
:param dataset: Dataset object
:return:
"""
for index, item... | {
"content_hash": "84f2e6837ee29dd598cbb8cf8c91ca0a",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 75,
"avg_line_length": 25.5,
"alnum_prop": 0.6887254901960784,
"repo_name": "dr-bigfatnoob/effort",
"id": "c7ab8d05c4771c1c1cf1938ded03c489361c8eb1",
"size": "1224",
"bin... |
from collections import deque
from pylimitbook.tick import Bid, Ask, Trade
from pylimitbook.tree import Tree
from builtins import input
from six.moves import cStringIO as StringIO
def parse_csv(columns, line):
"""
Parse a CSV line that has ',' as a separator.
Columns is a list of the column names, must ma... | {
"content_hash": "baff388d4e95f488df364bf2069f82d9",
"timestamp": "",
"source": "github",
"line_count": 141,
"max_line_length": 88,
"avg_line_length": 32.843971631205676,
"alnum_prop": 0.5173828546750162,
"repo_name": "danielktaylor/PyLimitBook",
"id": "cbabad47180d13ff927635dfa92ac48c27e8cf2b",
"s... |
import re
import fnmatch
import IECore
import Gaffer
import GafferUI
## \todo Potential optimisation.
# Currently every PlugValueWidget instance connects to the various plug signals
# on the node, and tests to see if the plug is of interest when signalled. When many
# PlugValueWidgets are instantiated for a node thi... | {
"content_hash": "6019fc983cf18b8abbfbd8d70916b29c",
"timestamp": "",
"source": "github",
"line_count": 453,
"max_line_length": 131,
"avg_line_length": 33.015452538631344,
"alnum_prop": 0.7067397699919765,
"repo_name": "davidsminor/gaffer",
"id": "843f1176f098802f74510bf43a6eda135d8452a7",
"size": ... |
"""
A example script to automatically send messages based on certain triggers.
The script makes uses of environment variables to determine the API ID,
hash, phone and such to be used. You may want to add these to your .bashrc
file, including TG_API_ID, TG_API_HASH, TG_PHONE and optionally TG_SESSION.
This script assu... | {
"content_hash": "0045e246a9b6fd07ae6ca6f3479fe802",
"timestamp": "",
"source": "github",
"line_count": 136,
"max_line_length": 89,
"avg_line_length": 39.330882352941174,
"alnum_prop": 0.6176855487006917,
"repo_name": "andr-04/Telethon",
"id": "660263639e11a34d92cfce9a3e30194d64a4d077",
"size": "53... |
from twext.python.filepath import CachingFilePath as FilePath
from twisted.internet.defer import inlineCallbacks
from twistedcaldav.ical import Component
from twistedcaldav.memcachelock import MemcacheLock
from twistedcaldav.memcacher import Memcacher
from twistedcaldav.test.util import StoreTestCase, SimpleStoreReques... | {
"content_hash": "7974fa4ae9702c978d69929157cb8cce",
"timestamp": "",
"source": "github",
"line_count": 207,
"max_line_length": 117,
"avg_line_length": 37.46376811594203,
"alnum_prop": 0.6353320438426822,
"repo_name": "red-hood/calendarserver",
"id": "ab6b3b9c1b695ec413b915147db12dff1bd0883c",
"siz... |
from setuptools import setup
setup(
name='key-exchange-plugin',
description='A Cloudify plugin to exchange public keys between dynamically instanciated nodes',
version='0.85',
author='Joshua Cornutt',
author_email='josh@gigaspaces.com',
packages=['plugin'],
install_requires=[
'cloud... | {
"content_hash": "a9ce9e31cdce88543539a0b91fcfb167",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 99,
"avg_line_length": 27.307692307692307,
"alnum_prop": 0.6816901408450704,
"repo_name": "01000101/cloudify-test-app",
"id": "119a39ed9e64de014d07bf7ea9881a784a62b83d",
"s... |
from typing import TYPE_CHECKING
import warnings
from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.paging import ItemPaged
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import HttpR... | {
"content_hash": "c6d915197537503b44f64093a1921945",
"timestamp": "",
"source": "github",
"line_count": 432,
"max_line_length": 211,
"avg_line_length": 47.101851851851855,
"alnum_prop": 0.6292510320424611,
"repo_name": "Azure/azure-sdk-for-python",
"id": "6eea2a22d3d6b2fb32061dc4236a533a294b07d6",
... |
"""Get a single product from a specified Google Merchant Center account and a product ID"""
import argparse
import sys
from apiclient import sample_tools
from oauth2client import client
# Declare command-line flags.
argparser = argparse.ArgumentParser(add_help=False)
argparser.add_argument(
'merchant_id',
... | {
"content_hash": "c012aa275fe208220acd4b3d9bc65b01",
"timestamp": "",
"source": "github",
"line_count": 57,
"max_line_length": 100,
"avg_line_length": 26.70175438596491,
"alnum_prop": 0.69053876478318,
"repo_name": "davidtzau/google-shopping-examples",
"id": "5e47f34bb6b3ce6e7a22ea784c6b1a7291ecd187"... |
import flatbuffers
import multiprocessing
import queue
from threading import Thread
from rlbot.messages.flat import QuickChat
from rlbot.messages.flat import QuickChatSelection
from rlbot.utils.logging_utils import get_logger
from rlbot.utils.structures.utils import create_enum_object
"""
Look for quick chats from ... | {
"content_hash": "f7675be7a9b36b229bf5aeb0a8f9a47e",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 97,
"avg_line_length": 37.76923076923077,
"alnum_prop": 0.664969450101833,
"repo_name": "drssoccer55/RLBot",
"id": "7ad1efbb52010f48b6a6d4ed76816740635443c7",
"size": "1964... |
from django.conf import settings
from django.core.exceptions import SuspiciousOperation
from django.contrib.sessions.backends.base import SessionBase, CreateError
from django_couchdb_utils.sessions.models import Session
from couchdbkit.exceptions import ResourceNotFound
class SessionStore(SessionBase):
def create... | {
"content_hash": "c49a9efb9d9137332e38243997ffa9b8",
"timestamp": "",
"source": "github",
"line_count": 65,
"max_line_length": 86,
"avg_line_length": 31.923076923076923,
"alnum_prop": 0.5898795180722891,
"repo_name": "stefankoegl/django-couchdb-utils",
"id": "53aa6583e5de903c489c97b6e1b64a35b3536047"... |
"""
The Human Hive
"""
import sys
import time
import argparse
import multiprocessing
import numpy as np
import pyaudio
from humanhive import samplestream, utils, sources
from humanhive import HumanHive
def build_parser():
parser = argparse.ArgumentParser(__doc__)
parser.add_argument(
"--n-channels",... | {
"content_hash": "a85f51a86bef0817972f4a7f267847d2",
"timestamp": "",
"source": "github",
"line_count": 81,
"max_line_length": 79,
"avg_line_length": 22.753086419753085,
"alnum_prop": 0.6071622354856213,
"repo_name": "mfergie/human-hive",
"id": "9eae55f4843324462d1fad411d93965415126887",
"size": "1... |
import scanner
import numpy as np
import cv2
import pickle
import time
import progressbar
class Detector(object):
def __init__(self, descriptor, classifier):
self.descriptor = descriptor
self.classifier = classifier
def dump(self, filename):
obj = {"descr... | {
"content_hash": "fdb52f43cec585ffb0cb40d3cd813674",
"timestamp": "",
"source": "github",
"line_count": 223,
"max_line_length": 136,
"avg_line_length": 36.46636771300449,
"alnum_prop": 0.5012297097884899,
"repo_name": "penny4860/object-detector",
"id": "09ce8c82dc93cfd5aa3066c87ce0a3789c15f469",
"s... |
from .helper import DataHelper, EmailDelivery
"""
Module for work with data
"""
__all__ = [
'DataHelper',
'EmailDelivery'
]
| {
"content_hash": "975c447d4bed3f9b9860334b5bf1655f",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 45,
"avg_line_length": 13.4,
"alnum_prop": 0.6417910447761194,
"repo_name": "hose314/cs.betlabs.ru",
"id": "e4ea5ea35c40db728dc2e636c607f2c00b04ee54",
"size": "159",
"bin... |
from body import Body
class Simulation(object):
MOUNTAIN_HEIGHT = 1E06 # 1000 km
def __init__(self, num_random_objs):
self.bodies = []
self.selected_body = None
if num_random_objs > 0:
self.selected_body = 0
self.bodies.append(Body.generate_circular_equatoria... | {
"content_hash": "89e1dba4920dd57a8a812157bb89b356",
"timestamp": "",
"source": "github",
"line_count": 65,
"max_line_length": 100,
"avg_line_length": 29.876923076923077,
"alnum_prop": 0.5484037075180227,
"repo_name": "bojanbog/orbital-academy",
"id": "9d04f6ea7aa8fb287aef757c352c4aead5815816",
"si... |
from .upload import manual_upload
from .upload import get_hashes
from .geotag import Geotag
def upload(path, **kwargs):
manual_upload(path, **kwargs)
def geotag(path, path_gpx, **kwargs):
"""GeoTag
:param ``path``: Image File Path
:param ``gpx``: GPX File Path
:param ``bearing``: Bearing/Direct... | {
"content_hash": "740820881fdd0d0dbef43fcaa473a903",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 60,
"avg_line_length": 23.681818181818183,
"alnum_prop": 0.6641074856046065,
"repo_name": "DenisCarriere/mapillary",
"id": "391a63ade0b253b51d086f9ecc915a34e67026a5",
"size... |
import pymel.core as pm
import logging
import Renderer as Renderer
import traceback
import sys
import os
import optimizeTextures
import path
reload(Renderer)
log = logging.getLogger("mtkrLogger")
RENDERER_NAME = "Kray"
class KrayRenderer(Renderer.MayaToRenderer):
theRendererInstance = None
@staticmethod
... | {
"content_hash": "de290f4fd998316af80044ef2bf8035c",
"timestamp": "",
"source": "github",
"line_count": 669,
"max_line_length": 169,
"avg_line_length": 63.3168908819133,
"alnum_prop": 0.5953162255955051,
"repo_name": "haggi/OpenMaya",
"id": "54fbdc162d09706f807d0d14ada0a50c75ee878b",
"size": "42359... |
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('feed', '0005_auto_20160418_0325'),
]
operations = [
migrations.AlterField(
model_name='feed',
name='feedurl',
fi... | {
"content_hash": "794294e88a49790daec148278fbfae9f",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 47,
"avg_line_length": 20.61111111111111,
"alnum_prop": 0.5849056603773585,
"repo_name": "kiwiheretic/logos-v2",
"id": "99d29fc689dd7326ff2c031de5892c0ff50539b9",
"size": "... |
'test unilint cli'
import unittest
from mock import patch
from unilint.unilint_main import register_formatter, register_plugin, \
FORMATTERS, PLUGINS, resolve_plugins
from unilint.unilint_main import extend_maybe, order_issues, remove_duplicates
from mock import Mock
# pylint: disable=R0904,C0111
class HelperFu... | {
"content_hash": "0312b79e709c12bdb5c90c6e81d0a53a",
"timestamp": "",
"source": "github",
"line_count": 143,
"max_line_length": 79,
"avg_line_length": 41.53846153846154,
"alnum_prop": 0.5786195286195286,
"repo_name": "tkruse/unilint",
"id": "f97e18ba94fd8dbb967ff9dc8284c692be41d20d",
"size": "5940"... |
from pprint import pprint
import os
import sys
root = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
sys.path.append(root + '/python')
import ccxt # noqa: E402
symbol = 'ETH/BTC'
exchange = ccxt.poloniex({
'enableRateLimit': True, # or .enableRateLimit = True later
})
# print ... | {
"content_hash": "e6da91af4f376935d7a7180cfed6302b",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 83,
"avg_line_length": 24.434782608695652,
"alnum_prop": 0.603202846975089,
"repo_name": "tritoanst/ccxt",
"id": "e15a5a254ac420b6733bca842c6b91db06b1e5ab",
"size": "587",
... |
from asposebarcode import Settings
from com.aspose.barcode import BarCodeBuilder
from com.aspose.barcode import Symbology
class SetAspectRatio:
def __init__(self):
dataDir = Settings.dataDir + 'WorkingWith2DBarcodes/Utility2DBarcodeFeatures/SetAspectRatio/'
# Instantiate barcode object
... | {
"content_hash": "0089813d9c717b8433b208cde9b8f1ea",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 101,
"avg_line_length": 26.379310344827587,
"alnum_prop": 0.661437908496732,
"repo_name": "aspose-barcode/Aspose.BarCode-for-Java",
"id": "52d4999c171f5fdcab11633c28ca0220c38... |
import numpy as np
from abbrator import Abbrator
import pdb
class Letterman(object):
def __init__(self, ideogram, karyotype):
"""
self.karyotype
Abbrator
"""
self.ideogram= ideogram
self.karyotype= karyotype
self.init_params()
def define... | {
"content_hash": "8d360c116c8a555faea8c461f46637df",
"timestamp": "",
"source": "github",
"line_count": 241,
"max_line_length": 109,
"avg_line_length": 30.406639004149376,
"alnum_prop": 0.5402565502183406,
"repo_name": "ecotox/pacfm",
"id": "6f9230ea864ad106d9fa1791c767469fbc54697b",
"size": "7328"... |
import datetime
import logging
import os
import re
import html5lib
import tornado.web
import tornado.wsgi
from tornado.web import url
from google.appengine.api import memcache
from google.appengine.api import taskqueue
from google.appengine.api import users
from google.appengine.ext import blobstore
from google.appen... | {
"content_hash": "f283ac8f2b6eb6bb1c7209cfd909e8c3",
"timestamp": "",
"source": "github",
"line_count": 319,
"max_line_length": 81,
"avg_line_length": 32.078369905956116,
"alnum_prop": 0.6500537476790775,
"repo_name": "haldun/bookmarks-gae",
"id": "8fc55ea858335fbd9775ddc76e98f07aa934d72e",
"size":... |
from django.conf.urls import patterns, include, url
from django.contrib import admin
from django.conf import settings
from django.conf.urls.static import static
admin.autodiscover()
urlpatterns = patterns('',
url(r'^', include('books.urls', namespace='index')),
url(r'^admin/', include(admin.site.urls)),
... | {
"content_hash": "130d8a2b34faa0347775fdcce6737b9d",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 80,
"avg_line_length": 30.75,
"alnum_prop": 0.6839430894308943,
"repo_name": "agiliq/fundraiser",
"id": "3e856915e19c2e50a4fa82b38da9331d137c566e",
"size": "984",
"binary... |
from django_jinja.library import filter
__author__ = 'AlexStarov'
@filter(name='custom_QuerySet_filter', )
def custom_QuerySet_filter(value, variable, operation, value_variable, ):
value = value.filter(is_availability=1, ) # map(variable, operation, value_variable, ), ) # is_availability=1)
return value
| {
"content_hash": "3b271cc6d063364c9f5809f0893bcfb8",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 116,
"avg_line_length": 35.333333333333336,
"alnum_prop": 0.7169811320754716,
"repo_name": "AlexStarov/Shop",
"id": "c3e72ad1305dcd22b561b975732630d20425ce7b",
"size": "342"... |
import sys, time
import atexit
import OpenGL.GL as gl
import OpenGL.GLUT as glut
import key, mouse, event, proxy
import _ctypes
import threading
import traceback
import IPython
if sys.platform in ['linux2', 'darwin']:
import termios
# The one and only window
_window = None
def active_window():
return _window... | {
"content_hash": "3b8510df14d2b3b24843771b098a3d1f",
"timestamp": "",
"source": "github",
"line_count": 530,
"max_line_length": 94,
"avg_line_length": 33.445283018867926,
"alnum_prop": 0.5700665688818685,
"repo_name": "davidcox/glumpy",
"id": "cd6b1f3d4197848c084a98024bdff64e900b4935",
"size": "181... |
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('lists', '0002_item_text'),
]
operations = [
migrations.CreateModel(
name='List',
fields=[
('id', models.Auto... | {
"content_hash": "112015d82d078ed5df154a1fb2fac57f",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 114,
"avg_line_length": 22.789473684210527,
"alnum_prop": 0.5658198614318707,
"repo_name": "talaniz/django-tdd",
"id": "9afd30d093b76001ec456a08cc038046f95e93c7",
"size": "... |
from django.conf import settings
from django.core.urlresolvers import reverse
from django.shortcuts import render
from core.common import *
from reports.forms import ReportForm
def report_form(request):
return render(request, 'reports/form.html', {
'settings': settings,
'user': get_user(request.user),
'f... | {
"content_hash": "84d4f9621032f2fc8cae0fa315af3f3b",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 53,
"avg_line_length": 28.76923076923077,
"alnum_prop": 0.7540106951871658,
"repo_name": "PrincessTeruko/TsunArt",
"id": "3cba600ab6a801c1cdb4c9e0e7c56061d28599a3",
"size":... |
"""MeltingPotEnv as a MultiAgentEnv wrapper to interface with RLLib."""
from typing import Tuple
import dm_env
import dmlab2d
from gym import spaces
from ml_collections import config_dict
import numpy as np
from ray.rllib.agents import trainer
from ray.rllib.env import multi_agent_env
from ray.rllib.policy.sample_bat... | {
"content_hash": "8566a5114aaa2eef654ddd21cef166c0",
"timestamp": "",
"source": "github",
"line_count": 171,
"max_line_length": 80,
"avg_line_length": 31.27485380116959,
"alnum_prop": 0.6630516080777861,
"repo_name": "deepmind/meltingpot",
"id": "9310aaca377d3fa1fa0fecc424425db445977d21",
"size": "... |
import os
import sys
sys.path.insert(0, os.path.abspath('..'))
# -- General configuration ------------------------------------------------
# If your documentation needs a minimal Sphinx version, state it here.
#
# needs_sphinx = '1.0'
# Add any Sphinx extension module names here, as strings. They can be
# extensions... | {
"content_hash": "1459ae4feb8674e97876dbf5f87540fb",
"timestamp": "",
"source": "github",
"line_count": 327,
"max_line_length": 80,
"avg_line_length": 28.425076452599388,
"alnum_prop": 0.685529854760624,
"repo_name": "brianr747/SFC_models",
"id": "171ef6ba24ce91873d69b6f891294d380c8d769d",
"size": ... |
from django.db import models
from django.contrib.auth.models import User
from django.db.models import Count
from ct.models import Response
class CorrectnessMeter(models.Model):
"""User answers correctness meter."""
PARTIALLY_CORRECT_ANSWER_POINT_REDUCTION = 0.9
CORRECT_ANSWER_POINTS = 1
NOT_CORRECT_A... | {
"content_hash": "db5667e9febf08b0a85d82ae9be55c62",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 113,
"avg_line_length": 34.65714285714286,
"alnum_prop": 0.6826051112943117,
"repo_name": "raccoongang/socraticqs2",
"id": "bb446621fde09672c5587388748d12b95ccb0827",
"size... |
"""Implements a resource and task management multiprocessing.Process
based on BigJob.
"""
__author__ = "Ole Weidner"
__email__ = "ole.weidner@rutgers.edu"
__copyright__ = "Copyright 2013-2014, The RADICAL Project at Rutgers"
__license__ = "MIT"
import saga
import time
import pilot
import Queue
import consta... | {
"content_hash": "66e9dcc5313e8e5627bf9844856d6e9a",
"timestamp": "",
"source": "github",
"line_count": 315,
"max_line_length": 110,
"avg_line_length": 38.46666666666667,
"alnum_prop": 0.5125030948254519,
"repo_name": "radical-cybertools/BigJobAsync",
"id": "afa91b3303afc5376fdc1ffe52c2afc50921efbd",... |
from datetime import date
from django.conf import settings
from django.utils import six
from django.utils.crypto import constant_time_compare, salted_hmac
from django.utils.http import base36_to_int, int_to_base36
class PasswordResetTokenGenerator(object):
"""
Strategy object used to generate and c... | {
"content_hash": "300faf7941e4618fb086cd9723390048",
"timestamp": "",
"source": "github",
"line_count": 74,
"max_line_length": 112,
"avg_line_length": 37.04054054054054,
"alnum_prop": 0.6165632980663991,
"repo_name": "diego-d5000/MisValesMd",
"id": "ed7f3a7b219a277e9676b31387a0fec3a8fcee0f",
"size"... |
import functools
import numpy as np
from scipy.stats import norm as ndist
import regreg.api as rr
from selection.tests.instance import gaussian_instance
from selection.learning.utils import full_model_inference, pivot_plot
from selection.learning.core import normal_sampler, random_forest_fit_sk
from selection.learn... | {
"content_hash": "b39085cab454dac3676bfff433295413",
"timestamp": "",
"source": "github",
"line_count": 98,
"max_line_length": 87,
"avg_line_length": 33.265306122448976,
"alnum_prop": 0.5128834355828221,
"repo_name": "selective-inference/selective-inference",
"id": "c7832c5eac251af53e632a16e3f763216a... |
import pdb
import datetime
import operator
import json
import logging
import orange
import Orange
import orngTree
import orngStat
import orngTest
import orngDisc
import Orange.feature as orf
import numpy as np
from datetime import datetime, date, timedelta
from datetime import time as dttime
from collections import d... | {
"content_hash": "075e711cdf01749e797e529085389190",
"timestamp": "",
"source": "github",
"line_count": 210,
"max_line_length": 87,
"avg_line_length": 24.67142857142857,
"alnum_prop": 0.6404169079328315,
"repo_name": "sirrice/scorpion",
"id": "a2ed1a03435b835fcc9eb787a9aefa0eb1a6ad91",
"size": "518... |
""" Python test discovery, setup and run of test functions. """
import fnmatch
import py
import inspect
import sys
import pytest
from _pytest.mark import MarkDecorator, MarkerError
from py._code.code import TerminalRepr
import _pytest
cutdir = py.path.local(_pytest.__file__).dirpath()
NoneType = type(None)
NOTSET = o... | {
"content_hash": "e9877f12623b6b78119f99c23b474922",
"timestamp": "",
"source": "github",
"line_count": 2071,
"max_line_length": 108,
"avg_line_length": 39.022694350555284,
"alnum_prop": 0.6011309641655118,
"repo_name": "gauribhoite/personfinder",
"id": "2fa4af3732f2bf3cc3e9a49070ea2b4bd9926c01",
"... |
from distutils.spawn import find_executable
import os
from setuptools import setup, find_packages
from dockerfabric import __version__
def include_readme():
try:
import pandoc
except ImportError:
return ''
pandoc.core.PANDOC_PATH = find_executable('pandoc')
readme_file = os.path.join(... | {
"content_hash": "90bd0b2fa3e3f18eac1a4fd083d43a8f",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 89,
"avg_line_length": 31.8,
"alnum_prop": 0.6226415094339622,
"repo_name": "merll/docker-fabric",
"id": "c783d245ec175a0c3d89da54bb93a70a9308f737",
"size": "1590",
"bina... |
import functools
import timeit
from typing import Optional
import jax
from jax import lax
import jax.numpy as jnp
from jax._src.lax.control_flow.for_loop import for_loop
import numpy as np
import jax_triton as jt
from jax_triton import pallas as pl
def layer_norm_forward_kernel(
x_ref, weight_ref, bias_ref, # I... | {
"content_hash": "68a084fc324be1c095bc90137cf66a2a",
"timestamp": "",
"source": "github",
"line_count": 112,
"max_line_length": 93,
"avg_line_length": 37.5625,
"alnum_prop": 0.6173044925124792,
"repo_name": "jax-ml/jax-triton",
"id": "c4da2cfd5a98549f8b51f4f3dbe6eb57706727f1",
"size": "4795",
"bi... |
import re
import numpy as np
import pandas as pd
from scipy import sparse
from scipy.stats import pearsonr
from scattertext.representations import Word2VecFromParsedCorpus
class EmbeddingsResolver:
def __init__(self, corpus):
self.corpus_ = corpus
self.embeddings_ = None
self.word2vec_mo... | {
"content_hash": "8d56cfd66eb506a06b2f852c4e0d2900",
"timestamp": "",
"source": "github",
"line_count": 96,
"max_line_length": 118,
"avg_line_length": 42.916666666666664,
"alnum_prop": 0.6135922330097088,
"repo_name": "JasonKessler/scattertext",
"id": "fc1cd8b6560fad955bdddff3272bbdeb21d7883c",
"si... |
from m5.objects.ArmCPU import ArmMinorCPU
MinorCPU = ArmMinorCPU
| {
"content_hash": "24ad282cd8f597bf6be0344c2e174771",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 41,
"avg_line_length": 22,
"alnum_prop": 0.8333333333333334,
"repo_name": "gem5/gem5",
"id": "bac019774e758b20b8810aa6212f15555bd9edd7",
"size": "1558",
"binary": false,
... |
import os
import sys
import time
import six
import numpy as np
import math
import argparse
import paddle
import paddle.fluid as fluid
import time
import utils
import net
SEED = 102
def parse_args():
parser = argparse.ArgumentParser("TagSpace benchmark.")
parser.add_argument(
'--neg_size', type=int, de... | {
"content_hash": "0ec13670acabd5feb367e0d93e359ab0",
"timestamp": "",
"source": "github",
"line_count": 137,
"max_line_length": 126,
"avg_line_length": 41.90510948905109,
"alnum_prop": 0.5840445915345759,
"repo_name": "kuke/models",
"id": "96cdf615ed9e6673159db5163f33f431d5c6e9bc",
"size": "5741",
... |
import torch
from torch.autograd import Variable
# N is batch size; D_in is input dimension;
# H is hidden dimension; D_out is output dimension.
N, D_in, H, D_out = 64, 1000, 100, 10
# Create random Tensors to hold inputs and outputs, and wrap them in Variables.
x = Variable(torch.randn(N, D_in))
y = Variable(torch.r... | {
"content_hash": "e97d9e32e69f6c3293dca01084339f61",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 83,
"avg_line_length": 41.73076923076923,
"alnum_prop": 0.7211981566820277,
"repo_name": "floydhub/dockerfiles",
"id": "2ebd4aaab063069e659f1ed8cbe11d96bf13cc80",
"size": "... |
from deep_qa.data.tokenizers.word_tokenizer import WordTokenizer
class TestTokenizer:
tokenizer = WordTokenizer({})
passage = "On January 7, 2012, Beyoncé gave birth to her first child, a daughter, Blue Ivy " +\
"Carter, at Lenox Hill Hospital in New York. Five months later, she performed for four " +... | {
"content_hash": "93ea933a70c32850acf899048932850a",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 99,
"avg_line_length": 50.75,
"alnum_prop": 0.6571428571428571,
"repo_name": "RTHMaK/RPGOne",
"id": "4d2dbefde187c7e79936018a628a6ba6100d7ecc",
"size": "1060",
"binary": ... |
from setuptools import setup, find_packages
setup(
name='gimble',
author='Mike Douglas',
author_email='foo@bar.com',
version='1.0.1',
description='XMPP Chat Bot',
long_description='',
entry_points = {
'console_scripts': [
'gimble = gimble.robot:main',
],
}... | {
"content_hash": "fbbea8dfa4c01b94ae3328255c936ef0",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 43,
"avg_line_length": 18,
"alnum_prop": 0.5511111111111111,
"repo_name": "mike-douglas/gimble",
"id": "bce31136856f9cdc5d5953bb7cac16ac686001da",
"size": "450",
"binary"... |
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "dj_minus.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| {
"content_hash": "c15813895953a91afa9515bff47d7c04",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 72,
"avg_line_length": 25.444444444444443,
"alnum_prop": 0.7074235807860262,
"repo_name": "jacobb/dj_minus_dj",
"id": "50977e8721725e4569f128f5ca546be03cd2333e",
"size": "25... |
import json
import os
import time
def getSettings(mainfile_dir):
try:
with open(mainfile_dir + '/settings.cbs','r') as f:
return json.load(f)
except FileNotFoundError:
restoreDefaultSettings(mainfile_dir)
with open(mainfile_dir + '/settings.cbs', 'r') as f:
ret... | {
"content_hash": "f84602631df219427010a01e0bcb0b1b",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 87,
"avg_line_length": 28.227272727272727,
"alnum_prop": 0.5909822866344605,
"repo_name": "gracefulcamel/Codebooks",
"id": "e5f3f7234194f5a3dd2be5f3132488e8a2d0850e",
"size... |
"""
Convert Kaggle format data into 1 file by pair of variables
"""
import os
import numpy as np
import pandas as pd
import csv
def format_col(df):
df.columns=['A','B']
A=""
B=""
for idx,row in df.iterrows():
A+=' '+str(float(row['A']))
B+=' ' + str(float(row['B']))
return A,B
def... | {
"content_hash": "408fe6d7d23be92f312bc5508226059f",
"timestamp": "",
"source": "github",
"line_count": 51,
"max_line_length": 71,
"avg_line_length": 29.392156862745097,
"alnum_prop": 0.5783855903935957,
"repo_name": "Diviyan-Kalainathan/causal-humans",
"id": "309434de63d93e7bae3322560fc136297f9698f5... |
"""pytest for :mod:`pykern.pkcompat`
:copyright: Copyright (c) 2015 Bivio Software, Inc. All Rights Reserved.
:license: http://www.apache.org/licenses/LICENSE-2.0.html
"""
from __future__ import absolute_import, division, print_function
import locale
import os
import pytest
import six
def setup_module():
"""S... | {
"content_hash": "7b7fed73d3197f58a7e5318bca518916",
"timestamp": "",
"source": "github",
"line_count": 89,
"max_line_length": 78,
"avg_line_length": 28.775280898876403,
"alnum_prop": 0.62827020695041,
"repo_name": "radiasoft/pykern",
"id": "211a84053f07dd778fa4c929495d3b9c6b1ad9d9",
"size": "2594"... |
from datetime import date, timedelta
import re
from corehq.apps.reports.standard.cases.data_sources import CaseDisplay
from casexml.apps.case.models import CommCareCase
from django.utils.translation import ugettext as _
import logging
from corehq.util.dates import iso_string_to_datetime
from custom.bihar.calculations.u... | {
"content_hash": "2efa147e4e953bb356f8191b17bcc98e",
"timestamp": "",
"source": "github",
"line_count": 635,
"max_line_length": 178,
"avg_line_length": 34.809448818897636,
"alnum_prop": 0.57338038364097,
"repo_name": "puttarajubr/commcare-hq",
"id": "eadfe1aa8bf19f295d83849e9ef62db9f03f6a4f",
"size... |
import os
import json
import grequests
import urlparse
import abstract_backend as sdm_absbackends
import util as sdm_util
DEFAULT_REST_HOSTS = ["http://localhost:8888"]
DEFAULT_MOUNT_PATH = "hsyn:///"
class RestBackendException(sdm_absbackends.AbstractBackendException):
pass
class RestBackendConfig(sdm_absback... | {
"content_hash": "49bbdc0cca9aef39ce672ab13330a3a9",
"timestamp": "",
"source": "github",
"line_count": 497,
"max_line_length": 163,
"avg_line_length": 41.227364185110666,
"alnum_prop": 0.5291849682772084,
"repo_name": "syndicate-storage/syndicate-dataset-manager",
"id": "ab414a03e59f7eb220dcf0886e30... |
import sys
import logging
try:
import ldap
import ldap.filter
ldap.set_option(ldap.OPT_REFERRALS, 0)
except Exception, e:
logging.error('missing ldap, try "easy_install python-ldap"')
raise e
def ldap_auth(server='ldap', port=None,
base_dn='ou=users,dc=domain,dc=com',
m... | {
"content_hash": "55eebe7eae3eb7f0e4ce6fa12bfe9ebc",
"timestamp": "",
"source": "github",
"line_count": 663,
"max_line_length": 79,
"avg_line_length": 45.02413273001508,
"alnum_prop": 0.46584704030015744,
"repo_name": "ericgriffin/fflock",
"id": "c374209e153fd184cc6e71325fc973d93a9b900b",
"size": "... |
from rest_framework import serializers
from calories.models import Food
class FoodSerializer(serializers.ModelSerializer):
class Meta:
fields = ('pk', 'name', 'calories')
model = Food
class FoodListSerializer(serializers.Serializer):
foods = serializers.ListField(child=FoodSerializer(many=Tr... | {
"content_hash": "4a3b5df6328859f27e9d2270635e0dd1",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 66,
"avg_line_length": 22.818181818181817,
"alnum_prop": 0.6992031872509961,
"repo_name": "banjocat/calorie-find",
"id": "2e2bfa67b2ab4ebf4f85d7108805fb44872b7c41",
"size":... |
from runner.koan import *
class AboutStrings(Koan):
def test_double_quoted_strings_are_strings(self):
string = "Hello, world."
self.assertEqual(True, isinstance(string, str))
def test_single_quoted_strings_are_also_strings(self):
string = 'Goodbye, world.'
self.assertEqual(Tru... | {
"content_hash": "c0828aa78e54d00cb9aeac50fcf4378f",
"timestamp": "",
"source": "github",
"line_count": 91,
"max_line_length": 85,
"avg_line_length": 33.59340659340659,
"alnum_prop": 0.6107294733398757,
"repo_name": "kimegitee/python-koans",
"id": "36439435cc0cd95b59b5e8d4676c23e49246d1ab",
"size":... |
import pygame, sys, random
from pygame.locals import *
def doRectsOverlap(rect1, rect2):
for a, b in [(rect1, rect2), (rect2, rect1)]:
# Check if a's corners are inside b
if ((isPointInsideRect(a.left, a.top, b)) or
(isPointInsideRect(a.left, a.bottom, b)) or
(isPoin... | {
"content_hash": "c155d345f7771ad6a12d69a63e78eb19",
"timestamp": "",
"source": "github",
"line_count": 125,
"max_line_length": 140,
"avg_line_length": 31.792,
"alnum_prop": 0.5931051836940111,
"repo_name": "renebentes/Python4Zumbis",
"id": "a770c99ad8416cc7d9b622ac8762092a964ff0f8",
"size": "3974"... |
import unittest
# noinspection PyUnresolvedReferences
from requests.utils import DEFAULT_ACCEPT_ENCODING
from streamlink import Streamlink
from streamlink.stream import AkamaiHDStream
from streamlink.stream import HDSStream
from streamlink.stream import HLSStream
from streamlink.stream import HTTPStream
from streamli... | {
"content_hash": "0a25a4fb120609a5169fac68ccb7d378",
"timestamp": "",
"source": "github",
"line_count": 116,
"max_line_length": 95,
"avg_line_length": 34.10344827586207,
"alnum_prop": 0.4598078867542973,
"repo_name": "melmorabity/streamlink",
"id": "629be4cd299174888b10223732da29ce6b4b2587",
"size"... |
from __future__ import unicode_literals
from django.apps import AppConfig
from django.utils.translation import ugettext_lazy as _
class SlugsConfig(AppConfig):
name = 'yepes.contrib.slugs'
verbose_name = _('Slugs')
| {
"content_hash": "f74423a5398eed5116fac98ba840ef0c",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 55,
"avg_line_length": 22.7,
"alnum_prop": 0.7400881057268722,
"repo_name": "samuelmaudo/yepes",
"id": "73440fc394d749d80eb3273765e7632b11c528d4",
"size": "251",
"binary"... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.