text stringlengths 4 1.02M | meta dict |
|---|---|
from uuid import uuid4
from copy import copy
from bottle import request
from bottle import abort
def require_json(*fields):
def require_json_inner(f):
def inner_func(*args, **kwargs):
if not 'json' in kwargs:
if not request.json:
abort(400, 'Must use Content-type of application/json')
kwargs['jso... | {
"content_hash": "d7e7a09136e08be19a9625e81b0db5e8",
"timestamp": "",
"source": "github",
"line_count": 80,
"max_line_length": 60,
"avg_line_length": 22.575,
"alnum_prop": 0.6572535991140642,
"repo_name": "Wazoku/Shoreditch-Gamerunner",
"id": "f2f4a7b3f6bdcaf88a44395503dc1e17153a5054",
"size": "180... |
from antlr4 import *
from io import StringIO
import sys
if sys.version_info[1] > 5:
from typing import TextIO
else:
from typing.io import TextIO
def serializedATN():
with StringIO() as buf:
buf.write("\3\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964\3\34")
buf.write("\u0081\4\2\t\2\4\3\t\3\4\4... | {
"content_hash": "1eb270892f77c3ccf748d071faa64bed",
"timestamp": "",
"source": "github",
"line_count": 1098,
"max_line_length": 512,
"avg_line_length": 36.19489981785064,
"alnum_prop": 0.581777464646973,
"repo_name": "yugangw-msft/azure-cli",
"id": "fd2ddc9ed2f99b3bea1ae5e6e5b1a3abafdf25ad",
"size... |
from msrest.serialization import Model
class Usage(Model):
"""Describes network resource usage.
Variables are only populated by the server, and will be ignored when
sending a request.
All required parameters must be populated in order to send to Azure.
:ivar id: Resource identifier.
:vartyp... | {
"content_hash": "fac39a26645cf565fe637ebf97596007",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 77,
"avg_line_length": 32.4375,
"alnum_prop": 0.5870263326910726,
"repo_name": "lmazuel/azure-sdk-for-python",
"id": "d2465f38f5ce0818cf5d4baf899af892b4d51b24",
"size": "20... |
import logging
import unittest
from satella.instrumentation.metrics.data import MetricData, MetricDataCollection
logger = logging.getLogger(__name__)
class TestMetricData(unittest.TestCase):
def test_internal(self):
md = MetricData('name', 2, {'labels': 'key'}, None, True)
md2 = MetricData.from... | {
"content_hash": "d0f50c067c48b1a0ca0371c85f31cbe0",
"timestamp": "",
"source": "github",
"line_count": 77,
"max_line_length": 99,
"avg_line_length": 47.324675324675326,
"alnum_prop": 0.5543358946212953,
"repo_name": "piotrmaslanka/satella",
"id": "437445fdba44e3b6e96800a82ad60a00f909c062",
"size":... |
from magnumclient.common import base
from magnumclient.common import utils
from magnumclient import exceptions
CREATION_ATTRIBUTES = ['bay_uuid', 'manifest', 'manifest_url']
class ReplicationController(base.Resource):
def __repr__(self):
return "<ReplicationController %s>" % self._info
class Replicati... | {
"content_hash": "2f72dff4e64d684b68f9d6a0a74bdef3",
"timestamp": "",
"source": "github",
"line_count": 85,
"max_line_length": 79,
"avg_line_length": 32.423529411764704,
"alnum_prop": 0.5678519593613933,
"repo_name": "ramielrowe/python-magnumclient",
"id": "63e8b2d16fdc4addc0dd8b4cfbf7fafac0264930",
... |
import hashlib
import random
from django.conf import settings
from django.contrib.auth import models as auth_models
from django.core.urlresolvers import reverse
from django.db import models
from django.template import Template, Context, TemplateDoesNotExist
from django.template.loader import get_template
from django.u... | {
"content_hash": "c09206ac69233245cb6c18be1355e158",
"timestamp": "",
"source": "github",
"line_count": 364,
"max_line_length": 92,
"avg_line_length": 36.467032967032964,
"alnum_prop": 0.6123248455627542,
"repo_name": "michaelBenin/django-oscar",
"id": "025bb6569fe9271fc05926f804d32f9e7b7144e0",
"s... |
from __future__ import unicode_literals
import os
import sys
try:
import unittest2 as unittest
except ImportError:
import unittest
from rpaths import unicode, dict_union, Path, PosixPath, WindowsPath, \
Pattern, pattern2re
windows_only = unittest.skipUnless(issubclass(Path, WindowsPath),
... | {
"content_hash": "1c22452be0f4ad4c50c61ccd9cdd0887",
"timestamp": "",
"source": "github",
"line_count": 341,
"max_line_length": 79,
"avg_line_length": 37.3782991202346,
"alnum_prop": 0.49278204927035935,
"repo_name": "remram44/rpaths",
"id": "de725d780e1a1c94f0ad9489d5e7f59a165848c1",
"size": "1274... |
"""
Remake of the pyramid demo from the box2d testbed.
"""
import pygame
from pygame.locals import *
from pygame.color import *
import pymunk
from pymunk import Vec2d
class PyramidDemo:
def flipyv(self, v):
return v[0], -v[1]+self.h
def __init__(self):
self.running = ... | {
"content_hash": "5afb3f430926b205acc234014931a90d",
"timestamp": "",
"source": "github",
"line_count": 120,
"max_line_length": 99,
"avg_line_length": 33.11666666666667,
"alnum_prop": 0.4859084046300956,
"repo_name": "cfobel/python___pymunk",
"id": "b78032b4e518d5bba2880c172d71d6316cb0b108",
"size"... |
"""
Custom parameter types for MyMCAdmin
"""
import grp
import pwd
import click
class User(click.ParamType):
"""
A system user defined by its username or UID
"""
name = 'user'
def convert(self, value, param, ctx):
try:
if isinstance(value, int):
# This call s... | {
"content_hash": "fdd1e0a0062cd4c718820d5ecc3ca485",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 64,
"avg_line_length": 24.288888888888888,
"alnum_prop": 0.5489478499542544,
"repo_name": "durandj/mymcadmin",
"id": "4c1c1a8e0c6b7527c8a0e910d6d18e5c4e26136d",
"size": "10... |
from nose.tools import *
from dateutil.parser import parse as time_parse
import yawhois
class TestWhoisDnsBePropertyStatusNotallowed(object):
def setUp(self):
fixture_path = "spec/fixtures/responses/whois.dns.be/property_status_notallowed.txt"
host = "whois.dns.be"
part = y... | {
"content_hash": "7ba96f0f2937d71803552c2a4005609a",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 92,
"avg_line_length": 32.75,
"alnum_prop": 0.6625954198473283,
"repo_name": "huyphan/pyyawhois",
"id": "f12204235b507442080dd0af319018421c33a47b",
"size": "925",
"binary... |
import uuid
class TagSet(object):
def __init__(self, store, names=None):
"""
:param store: The cache store implementation
:type store: cachy.contracts.store.Store
:param names: The tags names
:type names: list or tuple
"""
self._store = store
self.... | {
"content_hash": "8afaee2e3b2eae684da7979f8bc38859",
"timestamp": "",
"source": "github",
"line_count": 74,
"max_line_length": 77,
"avg_line_length": 22.16216216216216,
"alnum_prop": 0.5176829268292683,
"repo_name": "sdispater/cachy",
"id": "ebfb3eb2162bec2fbd7f5859cea0f8acfba2b7b3",
"size": "1665"... |
from __future__ import absolute_import
import logging
import six
from elasticsearch import Elasticsearch
from elasticsearch.exceptions import NotFoundError
from elasticsearch.exceptions import ConnectionError
from scrapi import settings
from scrapi.processing.base import BaseProcessor
from scrapi.base.transformer i... | {
"content_hash": "f5c8be49d0430a53eebc40c8352d613b",
"timestamp": "",
"source": "github",
"line_count": 122,
"max_line_length": 129,
"avg_line_length": 34.09836065573771,
"alnum_prop": 0.6338942307692308,
"repo_name": "alexgarciac/scrapi",
"id": "64938317ff79f68c59968071f1a7b701247caa18",
"size": "... |
<<<<<<< HEAD
<<<<<<< HEAD
"""Unit tests for collections.defaultdict."""
import os
import copy
import pickle
import tempfile
import unittest
from test import support
from collections import defaultdict
def foobar():
return list
class TestDefaultDict(unittest.TestCase):
def test_basic(self):
d1 = def... | {
"content_hash": "71b7d78c204fa23ffd6b71f9bbc8e395",
"timestamp": "",
"source": "github",
"line_count": 576,
"max_line_length": 76,
"avg_line_length": 31.930555555555557,
"alnum_prop": 0.5520334928229665,
"repo_name": "ArcherSys/ArcherSys",
"id": "dd37976870b91dc7b22be63e526a7aca1c05bd25",
"size": ... |
import glob
import re
sources = glob.glob("css/theme_orig/source/*.scss")+\
glob.glob("css/theme_orig/template/*.scss")
for source in sources:
destName = source.replace("_orig","")[:-5]+".less"
dest = file(destName,"w")
print "Creating:",dest.name
varNames = []
for line in file(source):
... | {
"content_hash": "917725eaad5e67c249bb6220111d9314",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 65,
"avg_line_length": 31.391304347826086,
"alnum_prop": 0.5429362880886427,
"repo_name": "derivationBud/prez",
"id": "3592adcdeb5c797a399f30d0c03f9c1fdb741677",
"size": "8... |
"""
List expired users that have expired or will expire soon, according to the expiry date written in their notes field in PaperCut.
USAGE: listExpiredUsers.py [how_soon]
It will list and identify users that have expired or will expire within the next "n" days
In PaperCut admin, please use the user's notes field ... | {
"content_hash": "d54ef5502b495e1b1e37a137151a5f44",
"timestamp": "",
"source": "github",
"line_count": 120,
"max_line_length": 129,
"avg_line_length": 36.108333333333334,
"alnum_prop": 0.6180475421186246,
"repo_name": "PaperCutSoftware/PaperCutExamples",
"id": "99ab386c444f457dc46040a697759976db94d0... |
__revision__ = "$Id: models.py 28 2009-10-22 15:03:02Z jarek.zgoda $"
import datetime
import secrets
from base64 import b32encode
from typing import List, Mapping, Optional, Union
from urllib.parse import urljoin
from django.conf import settings
from django.contrib.contenttypes.fields import GenericForeignKey
from dja... | {
"content_hash": "0c3f83a74e36a66bba61526842704680",
"timestamp": "",
"source": "github",
"line_count": 241,
"max_line_length": 100,
"avg_line_length": 35.468879668049794,
"alnum_prop": 0.7101076275152083,
"repo_name": "eeshangarg/zulip",
"id": "f778bbf0c5f35177a1dad3d11b2c0d5ced66825d",
"size": "8... |
from collections import MutableMapping
class _MinEntry(object):
"""
Mutable entries for a Min-PQ dictionary.
"""
def __init__(self, dkey, pkey):
self.dkey = dkey #dictionary key
self.pkey = pkey #priority key
def __lt__(self, other):
return self.pkey < other.pkey
cl... | {
"content_hash": "be5eb827c8aca48c9c48de042d7babc2",
"timestamp": "",
"source": "github",
"line_count": 185,
"max_line_length": 83,
"avg_line_length": 30.52972972972973,
"alnum_prop": 0.5138101983002833,
"repo_name": "ActiveState/code",
"id": "9eab6e31a8d54c1c29bd5f721a9040c957a3d6a5",
"size": "564... |
"""
Distribution related models
"""
from sqlalchemy import func
from sqlalchemy.ext import hybrid
from sqlalchemy import orm
from sqlalchemy.sql.expression import select
from sqlalchemy import Column
from sqlalchemy import ForeignKey
from sqlalchemy import Text
from apiary.mappers import Base
from apiary.mappers imp... | {
"content_hash": "22efdc1d846363c91f01dfd3502e6b6e",
"timestamp": "",
"source": "github",
"line_count": 61,
"max_line_length": 77,
"avg_line_length": 30.24590163934426,
"alnum_prop": 0.6336043360433604,
"repo_name": "gmr/apiary",
"id": "e63feb9364feb6ec488f26fad59138e016a8e21e",
"size": "1845",
"... |
from cryptography.hazmat.primitives import hashes
from cryptography.hazmat.primitives.asymmetric import padding, utils
from ..algorithm import SignatureAlgorithm
from ..transform import SignatureTransform
from ..._enums import SignatureAlgorithm as KeyVaultSignatureAlgorithm
class RsaSignatureTransform(SignatureTran... | {
"content_hash": "75b05b5d10b76183901ddd988a10631a",
"timestamp": "",
"source": "github",
"line_count": 71,
"max_line_length": 114,
"avg_line_length": 30.816901408450704,
"alnum_prop": 0.7431444241316271,
"repo_name": "Azure/azure-sdk-for-python",
"id": "984befca583a81d63f00d9483b7d4930137052f7",
"... |
import random
import item
import monster
from weapon import new_dagger, new_sword, new_gun, new_sling, new_kris, new_katar, new_cestus, new_iron_hand, new_spear, new_claw, new_morning_star, new_rapier, new_scimitar, new_club, new_flail, new_hammer, new_chain_and_ball, new_trident, new_whip, new_axe
class DungeonTable... | {
"content_hash": "0b33d465aee48c299cc9f65ba30c77ff",
"timestamp": "",
"source": "github",
"line_count": 136,
"max_line_length": 258,
"avg_line_length": 33.35294117647059,
"alnum_prop": 0.6199294532627866,
"repo_name": "co/TheLastRogue",
"id": "84a1d7bc693fcac1266f07bbf67032cbc94b9c96",
"size": "453... |
from __future__ import division
__author__ = 'Vladimir Iglovikov'
from sklearn import cross_validation
from sklearn.ensemble import RandomForestClassifier
from sklearn.ensemble import GradientBoostingClassifier
from sklearn.metrics import log_loss
from sklearn.svm import SVC
from sklearn.multiclass import OneVsRestCla... | {
"content_hash": "0893415ba87340e6e6f1bf5118a157a9",
"timestamp": "",
"source": "github",
"line_count": 150,
"max_line_length": 283,
"avg_line_length": 39.96666666666667,
"alnum_prop": 0.5616346955796497,
"repo_name": "ternaus/kaggle_otto",
"id": "4f1579602803a192acfd97f6f6e5370b9a4d4c68",
"size": ... |
import os
import sys
from lettuce import core
from lettuce.terrain import after
from lettuce.terrain import before
failed_scenarios = []
scenarios_and_its_fails = {}
def wrt(string):
sys.stdout.write(string.encode('utf-8'))
@before.each_scenario
def print_scenario_running(scenario):
wrt('%s ... ' % scenari... | {
"content_hash": "77265411a0d4a5cac2794058e3a67104",
"timestamp": "",
"source": "github",
"line_count": 78,
"max_line_length": 71,
"avg_line_length": 26.96153846153846,
"alnum_prop": 0.621017593913457,
"repo_name": "softak/webfaction_demo",
"id": "f82d95bdd1017382a91185336d7d06f35e4dffe4",
"size": ... |
import json
import pulp
import unittest
from pyspatialopt.models import covering, utilities
class GLPKSolverTest(unittest.TestCase):
def setUp(self):
# Read the coverages
with open("valid_coverages/partial_coverage1.json", "r") as f:
self.partial_coverage = json.load(f)
with o... | {
"content_hash": "cdce4465a10b63b12685e88b86786082",
"timestamp": "",
"source": "github",
"line_count": 113,
"max_line_length": 120,
"avg_line_length": 50.309734513274336,
"alnum_prop": 0.6225153913808268,
"repo_name": "apulverizer/pyspatialopt",
"id": "c8df0ca291d310fe6da6875796b23bfcd1743110",
"s... |
import datetime
from django.conf.urls import url
from django.contrib import admin
from django.shortcuts import render
from .models import ANDROID_PLATFORM, APNS_PLATFORM, App, Device, GCM_PLATFORM, ResponseLog
from .utils import get_metrics
class DeviceAdmin(admin.ModelAdmin):
search_fields = ('name', 'sip_user... | {
"content_hash": "1c677380ce8ee6f5ad1be96a27b45d2e",
"timestamp": "",
"source": "github",
"line_count": 78,
"max_line_length": 91,
"avg_line_length": 29.05128205128205,
"alnum_prop": 0.6125330979699912,
"repo_name": "VoIPGRID/vialer-middleware",
"id": "362b7b02b25c9d4abffe137b4968a8a62ca41144",
"si... |
import sys
import os
import shlex
sys.path.append(os.path.abspath('..'))
import admin_cli
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like sh... | {
"content_hash": "da6f70343778723c6a153f36bbc72fd2",
"timestamp": "",
"source": "github",
"line_count": 275,
"max_line_length": 79,
"avg_line_length": 32.49818181818182,
"alnum_prop": 0.7059415911379657,
"repo_name": "ZuluPro/django-admin-cli",
"id": "a38201e279e18ca7515287c38212eef09622f1ab",
"siz... |
"""
Class based generic views.
These views are only available if you are using Django >= 1.3.
"""
from django.contrib.auth.models import User
from django.views.generic.detail import DetailView
from bookmarks.handlers import library
class BookmarksMixin(object):
"""
Mixin for bookmarks class based views.
... | {
"content_hash": "8e14f0b27b316df9f03fe75464d5da41",
"timestamp": "",
"source": "github",
"line_count": 168,
"max_line_length": 79,
"avg_line_length": 33.208333333333336,
"alnum_prop": 0.636314751747625,
"repo_name": "gradel/django-generic-bookmarks",
"id": "48cbfb1a6e730cdda2d971851de46d2255a455bd",... |
import hashlib
import base64
import json
from google.cloud import bigquery
from sql_translator.sql_parser import *
from sql_translator.sql_rewrite import *
from sql_translator.rfmt import *
import QueryEntry as qe
bq = bigquery.Client()
def event_handler(request):
request_json = request.get_json()
print('... | {
"content_hash": "48a36d8a95d14a33a5de642094089c51",
"timestamp": "",
"source": "github",
"line_count": 185,
"max_line_length": 133,
"avg_line_length": 31.756756756756758,
"alnum_prop": 0.5548936170212766,
"repo_name": "GoogleCloudPlatform/datacatalog-tag-engine",
"id": "53d7562db27d1a6ef850d34c4b0cf... |
import config, wiki
if config.ts:
TSUser = config.ts
else:
raise wiki.NoTSUsername('No Toolserver username given.')
"""
Script that has MySQL Functions for toolserver users
Wiki should be in the form of langproject (ex. enwiki) without the '_p' on the end
Host is either 1, 2, or 3. Can be left blank
"""
__version__ ... | {
"content_hash": "88c4d0921b8f19f471e958e5e436d9eb",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 103,
"avg_line_length": 29.04,
"alnum_prop": 0.6584022038567493,
"repo_name": "legoktm/pythonwikibot",
"id": "4168fc6e85b60fc0833cb1a793ea08ead71e82d8",
"size": "1469",
"... |
from parlai.core.teachers import Teacher
from .build import build
from parlai.utils.io import PathManager
import json
import os
import random
import copy
WELCOME_MESSAGE = "Negotiate with your opponent to decide who gets how many items of each kind. There are three kinds of packages: Food, Water, and Firewood. Each ha... | {
"content_hash": "b3d67f2985058d013b0a60c4fcc23c67",
"timestamp": "",
"source": "github",
"line_count": 334,
"max_line_length": 703,
"avg_line_length": 41.26047904191617,
"alnum_prop": 0.597053914810246,
"repo_name": "facebookresearch/ParlAI",
"id": "e25613ca82d0ef9ec38d5a8147d6d643cfb0c4a9",
"size... |
from rx.observable import Observable
from rx.internal import extensionmethod
@extensionmethod(Observable, alias="to_iterable")
def to_list(self):
"""Creates a list from an observable sequence.
Returns an observable sequence containing a single element with a list
containing all the elements of the source... | {
"content_hash": "df6c5d4be5834ea2231eb18af99a4a1b",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 74,
"avg_line_length": 29.625,
"alnum_prop": 0.7130801687763713,
"repo_name": "dbrattli/RxPY",
"id": "55a39a90158490e32247c630b8d6c9bd581ef78c",
"size": "474",
"binary": ... |
from __future__ import unicode_literals
from django.conf.urls import url, include
from . import views, Registry
urlpatterns = [
url(r'^$', views.LoginFormView.as_view(), name="login"),
url(r'^logout$', views.LogoutActionView.as_view(), name="logout"),
url(r'^settings', views.SettingsView.as_view(), name=... | {
"content_hash": "01e03ce8d620aeef1003b03b9b4ada0d",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 123,
"avg_line_length": 37.2,
"alnum_prop": 0.6792114695340502,
"repo_name": "watchdogpolska/watchdog-id",
"id": "e75ed5ed7b46b89235825b1fddaf5843c9717123",
"size": "582",
... |
from glob import glob
from xml.dom import minidom
from itertools import chain
import os
try:
MODULE = os.path.dirname(__file__)
except:
MODULE = ""
### LIST FUNCTIONS #################################################################################
def column(list, i):
return [row[i] for row in l... | {
"content_hash": "e4413ba8230be497edb0a02b3528ea59",
"timestamp": "",
"source": "github",
"line_count": 424,
"max_line_length": 124,
"avg_line_length": 40.75235849056604,
"alnum_prop": 0.5192430117483651,
"repo_name": "decebel/dataAtom_alpha",
"id": "3ba8d6c487ccd317ea7c7aefd8ff21d2b6c791b7",
"size... |
import canio2
from canio2 import CANopenNode
# CAN module (CAN iface type) initialization
module = canio2.make_module('ixxat')
# CAN iface creation. Pass iface id (or '*') and bitrate to make_iface method.
iface = module.make_iface('HW104122','1000K')
# io_service object is a link between low and high levels
io_servi... | {
"content_hash": "653499127c0af239144c9784094194a9",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 78,
"avg_line_length": 34.06666666666667,
"alnum_prop": 0.7534246575342466,
"repo_name": "gruzovator/canio2",
"id": "0d589d7f79b4b458048757be67d7ef4f54b001ff",
"size": "720... |
from __future__ import nested_scopes
import os
import traceback
import pydevd_file_utils
try:
from urllib import quote
except:
from urllib.parse import quote # @UnresolvedImport
try:
from collections import OrderedDict
except:
OrderedDict = dict
import inspect
from _pydevd_bundle.pydevd_constants ... | {
"content_hash": "966c8e2b10365db1bd7380e076686e9f",
"timestamp": "",
"source": "github",
"line_count": 642,
"max_line_length": 154,
"avg_line_length": 32.769470404984425,
"alnum_prop": 0.5991063789333587,
"repo_name": "siosio/intellij-community",
"id": "67c953b1bea872d83731c7d03697884af0abe4a2",
"... |
def is_greater(num1, num2):
"""Checks that both arguments are numbers and of the same type.
Returns Boolean.
"""
assert type(num1) == type(num2), "Two different types were given."
assert type(num1) != type(1.0) or type(num1) != type(1), "Non-number was g\
iven." # PEP-8 recommends 80 ch... | {
"content_hash": "57f11718a5ed05c55b131fab7db77ad3",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 80,
"avg_line_length": 35.38095238095238,
"alnum_prop": 0.6096904441453567,
"repo_name": "pranavsb/Python-SIG-2015",
"id": "4107a6b750b62f3b76b345380e9e54db20270cc4",
"size... |
import unittest
import sys
import numpy as np
import scipy.sparse as sp
from sklearn.externals.six.moves import cStringIO as StringIO
from sklearn.externals import joblib
from sklearn.base import BaseEstimator, ClassifierMixin
from sklearn.utils import deprecated
from sklearn.utils.testing import (assert_raises_rege... | {
"content_hash": "768e83646c89f68e7245daa7ddf58c17",
"timestamp": "",
"source": "github",
"line_count": 472,
"max_line_length": 79,
"avg_line_length": 35.728813559322035,
"alnum_prop": 0.6235175521821632,
"repo_name": "vortex-ape/scikit-learn",
"id": "bf8412b3e527de1e31c62a4af29e9f27522089d8",
"siz... |
try:
from colorama import init as colorama_init
from colorama import Fore, Style
imported_colorama = True
except(ImportError):
print "Could not import colorama: Skipping coloration"
class Dummy(object):
def __getattr__(self, key):
return ''
Fore = Dummy()
Style = Dummy... | {
"content_hash": "01024502ef6819f9287a333adc36685d",
"timestamp": "",
"source": "github",
"line_count": 83,
"max_line_length": 75,
"avg_line_length": 26.6144578313253,
"alnum_prop": 0.5984608420099593,
"repo_name": "jpanikulam/experiments",
"id": "82a9f3b24ba604eb37ecb96c34154535e26cfc3a",
"size": ... |
"""
AgentCount Model
================
Model describing the counts for agents in various states at a given point
in time.
"""
from pyfarm.master.application import db
from pyfarm.master.config import config
class AgentCount(db.Model):
__bind_key__ = 'statistics'
__tablename__ = config.get("table_statistics_a... | {
"content_hash": "94969d8f8b4f3fcfa7f7448c9fbd36df",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 80,
"avg_line_length": 27.069767441860463,
"alnum_prop": 0.627147766323024,
"repo_name": "pyfarm/pyfarm-master",
"id": "28e0f5bb00fc65099e73b5047ee09d7ff5332daa",
"size": "... |
from __future__ import unicode_literals
from ..minc import Beast
def test_Beast_inputs():
input_map = dict(abspath=dict(argstr='-abspath',
usedefault=True,
),
args=dict(argstr='%s',
),
clobber=dict(argstr='-clobber',
usedefault=True,
),
confidence_level_alpha=dict(argstr='-alpha %s... | {
"content_hash": "0a534ba471c25565ec1c647a39d06f16",
"timestamp": "",
"source": "github",
"line_count": 82,
"max_line_length": 67,
"avg_line_length": 25.451219512195124,
"alnum_prop": 0.6046957355055103,
"repo_name": "mick-d/nipype",
"id": "642bd6f6eab843d34f5a0126fac7a602b687d8da",
"size": "2141",... |
import requests
from datetime import date
now = date.today().year
| {
"content_hash": "192da13bb2266231665f781df0d8d932",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 25,
"avg_line_length": 10,
"alnum_prop": 0.7428571428571429,
"repo_name": "hust201010701/FestivalDateCountDown",
"id": "6b734b435137955bb73630ad1616bd51263f7fb4",
"size": "7... |
__all__ = ('EulerMovement',)
from grease.controller.integrator import EulerMovement
| {
"content_hash": "b91e191e785d647b49e5080acafab820",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 54,
"avg_line_length": 28.333333333333332,
"alnum_prop": 0.7647058823529411,
"repo_name": "caseman/grease",
"id": "cdb4589a1a9648ef20a46370562588a7ffeaeed4",
"size": "86",
... |
"""Admin model views for PersistentIdentifier."""
import uuid
from flask import current_app, url_for
from flask_admin.contrib.sqla import ModelView
from flask_admin.contrib.sqla.filters import FilterEqual
from markupsafe import Markup
from .models import PersistentIdentifier, PIDStatus
def _(x):
"""Identity fu... | {
"content_hash": "2fd28e8cc8772f558e52b997a9abfdbd",
"timestamp": "",
"source": "github",
"line_count": 73,
"max_line_length": 71,
"avg_line_length": 28.45205479452055,
"alnum_prop": 0.6297544535387578,
"repo_name": "tiborsimko/invenio-pidstore",
"id": "b503d0fa42765a10b83414c14ad2f94d5a4a4699",
"s... |
import os
import shutil
from unittest import TestCase, main
import pandas as pd
import numpy.testing as npt
import americangut.notebook_environment as agenv
import americangut.per_sample as agps
class PerSampleTests(TestCase):
def test_create_opts(self):
obs = agps.create_opts('fecal', 'somepath', gradi... | {
"content_hash": "d7e34ed1a24df3d3441d0a79df31e29e",
"timestamp": "",
"source": "github",
"line_count": 213,
"max_line_length": 79,
"avg_line_length": 41.539906103286384,
"alnum_prop": 0.49254068716094035,
"repo_name": "EmbrietteH/American-Gut",
"id": "d21c01cc3ad14c0e87040c0acc9a7e9e07523c13",
"si... |
import MySQLdb
db = MySQLdb.connect("localhost","david","david","picturetoken")
cursor=db.cursor()
cursor.execute("select * from picturetoken")
rs=cursor.fetchone()
# cursor.close
print rs
print rs[2]
access_token=rs[1]
refresh_token=rs[2]
from baidupcs import PCS
# access_token = '21.9403b998cd9b271fa44a54199aad2949.... | {
"content_hash": "13b73e47b6fb2f50c93e125dde75ecde",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 92,
"avg_line_length": 24.62962962962963,
"alnum_prop": 0.7308270676691729,
"repo_name": "matrixorz/justpic",
"id": "a711bdf296c9cea010b378e6fef391b8dc49c8f0",
"size": "665... |
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..utils import (
int_or_none,
parse_codecs,
)
class MinotoIE(InfoExtractor):
_VALID_URL = r'(?:minoto:|https?://(?:play|iframe|embed)\.minoto-video\.com/(?P<player_id>[0-9]+)/)(?P<id>[a-zA-Z0-9]+)'
def _real_ex... | {
"content_hash": "899c1b3abe008862a62fc36512aea0c4",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 124,
"avg_line_length": 38.22,
"alnum_prop": 0.5075876504447933,
"repo_name": "yasoob/youtube-dl-GUI",
"id": "6367311956ca973328b546b7d7fd8d34f72f251e",
"size": "1927",
"... |
__author__ = 'Ahmed Hani Ibrahim'
import pandas as pd
class CsvReader(object):
def __init__(self, file):
if not file.endswith('.csv'):
raise ValueError('This is not a .csv file. Check file extension please!')
self.__file = file
self.__data = pd.read_csv(file)
def get_da... | {
"content_hash": "503d5598b0ff07bbbf2225bac08db5ee",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 85,
"avg_line_length": 23.677419354838708,
"alnum_prop": 0.5926430517711172,
"repo_name": "AhmedHani/Kaggle-Machine-Learning-Competitions",
"id": "c13afa8e47fb9eefc6f7745483e... |
#! /usr/bin/env python
from __future__ import print_function
"""
A module for validating the the file structure of WOFF Files.
*validateFont* is the only public function.
This can also be used as a command line tool for validating WOFF files.
"""
# import
import os
import re
import time
import sys
import struct
impo... | {
"content_hash": "23f6f3cd2192052df18e6afb50f3e6cf",
"timestamp": "",
"source": "github",
"line_count": 2490,
"max_line_length": 210,
"avg_line_length": 31.802008032128516,
"alnum_prop": 0.5957543536186495,
"repo_name": "typesupply/woffTools",
"id": "4f289a9d812ee5b63c3e7cc7f6da3a1e8ea88935",
"size... |
"""
"""
import sys
import json
import traceback
from datetime import datetime, timedelta
from copy import copy, deepcopy
from functools import lru_cache
from typing import List
import pandas as pd
from .vnctpmd import MdApi
from .vnctptd import TdApi
from .ctp_constant import (
THOST_FTDC_OAS_Submitted,
THOST_... | {
"content_hash": "ba4fddb028443b0119595c507b8201eb",
"timestamp": "",
"source": "github",
"line_count": 2088,
"max_line_length": 119,
"avg_line_length": 35.02921455938697,
"alnum_prop": 0.5345018525861008,
"repo_name": "msincenselee/vnpy",
"id": "247e3671907fcab5ca713e3fc68d66b566596759",
"size": "... |
import copy
import datetime
import json
import os
import six
from bson.objectid import ObjectId
from .model_base import AccessControlledModel, ValidationException, \
GirderException
from girder import events
from girder.constants import AccessType
from girder.utility.progress import noProgress, setResponseTimeLimi... | {
"content_hash": "b0d65fbf4903537ec6f3aab762303390",
"timestamp": "",
"source": "github",
"line_count": 883,
"max_line_length": 97,
"avg_line_length": 39.39184597961495,
"alnum_prop": 0.5713998217520053,
"repo_name": "sutartmelson/girder",
"id": "7014465d0ca4cbae9f704beb2d96ca70d3abd695",
"size": "... |
from __future__ import unicode_literals
import django.core.validators
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='PageScrapeResult... | {
"content_hash": "5da226561f1242ff5f31c8c13e0cbdcc",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 147,
"avg_line_length": 37.98,
"alnum_prop": 0.5497630331753555,
"repo_name": "theju/atifier",
"id": "353f9680dc523c95db5acda31308847df1e5f48e",
"size": "1971",
"binary":... |
import time
from src.main.com.rowley.shavekeeper.productdatacompiler.models.ProductModels import Razor, Blade, Brush
from src.main.com.rowley.shavekeeper.productdatacompiler.web.FileHelper import load_consolidator, save_consolidator
from src.main.com.rowley.shavekeeper.productdatacompiler.web.WebFuncsCommon import loa... | {
"content_hash": "b56351b6331a4ec34bdaa77d76d3e4a5",
"timestamp": "",
"source": "github",
"line_count": 115,
"max_line_length": 120,
"avg_line_length": 41.208695652173915,
"alnum_prop": 0.7136526693395231,
"repo_name": "alphonzo79/ShaveKeeper",
"id": "d6b1d31d87210de661bf85f4db567bf94db4b989",
"siz... |
import os
from setuptools import setup, find_packages
with open(os.path.join(os.path.dirname(__file__), 'VERSION')) as v_file:
version = v_file.read().strip()
with open(os.path.join(os.path.dirname(__file__), 'README.md')) as readme:
README = readme.read()
setup(
name='canvas_python_sdk',
version=ver... | {
"content_hash": "925018d7ec979ef288f886813d6c7c2c",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 81,
"avg_line_length": 31.11627906976744,
"alnum_prop": 0.6053811659192825,
"repo_name": "penzance/canvas_python_sdk",
"id": "81e18d8f0938da8ea19463fa1723df6ff2b1d3ff",
"si... |
"""Methods for brownian bridges.
These can be used in Monte-Carlo simulation for payoff with continuous barrier.
Indeed, the Monte-Carlo simulation is inherently discrete in time, and to
improve convergence (w.r.t. the number of time steps) for payoff with continuous
barrier, adjustment with brownian bridge can be mad... | {
"content_hash": "eb1e0db5a9b5155cff60417d928f22d8",
"timestamp": "",
"source": "github",
"line_count": 183,
"max_line_length": 80,
"avg_line_length": 38.71584699453552,
"alnum_prop": 0.6472829922371207,
"repo_name": "google/tf-quant-finance",
"id": "2ecd190377c8d03eee8c370213bbbf7b44638127",
"size... |
import falcon
from oslo_log import log
from monasca_log_api.app.base import exceptions
from monasca_log_api.app.base import validation
from monasca_log_api.app.controller.api import logs_api
from monasca_log_api.app.controller.v3.aid import bulk_processor
from monasca_log_api.app.controller.v3.aid import helpers
from ... | {
"content_hash": "c21859bd7faab4da6d7d4121d9dc1dae",
"timestamp": "",
"source": "github",
"line_count": 98,
"max_line_length": 73,
"avg_line_length": 34.38775510204081,
"alnum_prop": 0.6091988130563798,
"repo_name": "stackforge/monasca-log-api",
"id": "349382b9eb078dabd8aa35c745c85ecf529fe40e",
"si... |
"""
This module contains functions/values used repeatedly in different modules of
the ``builtin_frames`` package.
"""
import warnings
import erfa
import numpy as np
from astropy import units as u
from astropy.time import Time
from astropy.coordinates.earth import EarthLocation
from astropy.utils import iers
from ast... | {
"content_hash": "edfb9b101e7bc46aaf9ad3783c9c8758",
"timestamp": "",
"source": "github",
"line_count": 418,
"max_line_length": 94,
"avg_line_length": 34.311004784689,
"alnum_prop": 0.6486543020499232,
"repo_name": "dhomeier/astropy",
"id": "3130a8d8263541b32a9fde81a7751389b6c894d4",
"size": "14430... |
import copy
import os
import os.path as op
import numpy as np
from ..constants import FIFF
from ..open import fiff_open, _fiff_get_fid, _get_next_fname
from ..meas_info import read_meas_info
from ..tree import dir_tree_find
from ..tag import read_tag, read_tag_info
from ..base import (BaseRaw, _RawShell, _check_raw_c... | {
"content_hash": "2afe33c118708dd15cace69073daa111",
"timestamp": "",
"source": "github",
"line_count": 471,
"max_line_length": 79,
"avg_line_length": 42.859872611464965,
"alnum_prop": 0.49804329518997376,
"repo_name": "jaeilepp/mne-python",
"id": "cc955169e0ee9ba585ea726ec2272b5332004315",
"size":... |
import unittest
from unittest import mock
from NarrativeService.data.fetcher import DataFetcher
import os
from configparser import ConfigParser
from installed_clients.authclient import KBaseAuth
from installed_clients.WorkspaceClient import Workspace
from NarrativeService.NarrativeServiceServer import MethodContext
fro... | {
"content_hash": "13694e1b25b0a0af3c08405e034c8ea0",
"timestamp": "",
"source": "github",
"line_count": 392,
"max_line_length": 115,
"avg_line_length": 45.91581632653061,
"alnum_prop": 0.6047558197677648,
"repo_name": "kbaseapps/NarrativeService",
"id": "1664a62538c5d0600233f4ce8130ec8ac40d3e3b",
"... |
"""Service methods for typed instances."""
import copy
import inspect
import json
from extensions.objects.models import objects
import feconf
import utils
class Registry(object):
"""Registry of all objects."""
# Dict mapping object class names to their classes.
objects_dict = {}
@classmethod
d... | {
"content_hash": "ed560463450abebcda0a1761b1a2c84e",
"timestamp": "",
"source": "github",
"line_count": 62,
"max_line_length": 77,
"avg_line_length": 30.016129032258064,
"alnum_prop": 0.6281569048898442,
"repo_name": "souravbadami/oppia",
"id": "42e9372cac30d8f083ff884eb3b9d03ab328e511",
"size": "2... |
from data_collection.management.commands import BaseHalaroseCsvImporter
class Command(BaseHalaroseCsvImporter):
council_id = 'E06000035'
addresses_name = 'parl.2017-06-08/Version 1/Medway polling_station_export-2017-05-25.csv'
stations_name = 'parl.2017-06-08/Version 1/Medway polling_station_export... | {
"content_hash": "b2548126fba1668b2f37d9f20586f00b",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 94,
"avg_line_length": 52,
"alnum_prop": 0.7211538461538461,
"repo_name": "chris48s/UK-Polling-Stations",
"id": "11eb529b241c0a14860afe46654f60e87fc8e82f",
"size": "416",
... |
"""
Created on Thu Dec 11 11:37:39 2014
@author: sm1fg
Generate a 1D non-magnetic atmosphere vector based on an empirical model
based on observational data, or specify an analytical hydrostatic
equilibrium atmosphere.
"""
import numpy as np
from scipy.interpolate import UnivariateSpline
import astropy.t... | {
"content_hash": "1c304df63fedcab4483e32f06a1be537",
"timestamp": "",
"source": "github",
"line_count": 257,
"max_line_length": 91,
"avg_line_length": 39.88326848249027,
"alnum_prop": 0.5372682926829269,
"repo_name": "Cadair/pysac",
"id": "17a5bf5daae88f741e6be11709438507ace89d0c",
"size": "10274",... |
""" Instance counter primitives
We don't use a meta class as it's unnecessary complex, and portable meta classes
have their difficulties, and want to count classes, who already have a meta
class.
This is going to expanded with time.
"""
from nuitka.Options import isShowMemory
from nuitka.Tracing import printIndented... | {
"content_hash": "736f35e7236630d0ae613601f2a7db60",
"timestamp": "",
"source": "github",
"line_count": 66,
"max_line_length": 80,
"avg_line_length": 21.87878787878788,
"alnum_prop": 0.6357340720221607,
"repo_name": "kayhayen/Nuitka",
"id": "3ae371327e1bb7f681d3dad769a5bbc69e5e1991",
"size": "2224"... |
"""
The MIT License (MIT)
Copyright (c) 2014-2017 University of Bristol
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, copy, m... | {
"content_hash": "76cb3abe6833f40e60125023d9e1b824",
"timestamp": "",
"source": "github",
"line_count": 90,
"max_line_length": 78,
"avg_line_length": 37.21111111111111,
"alnum_prop": 0.5685279187817259,
"repo_name": "IRC-SPHERE/HyperStream",
"id": "7076f0c43de1f8a5d2d7d3054bbba477ce371099",
"size":... |
"""
Created by Rodrigo Fuentealba
Please, read the file "/LICENSE.md" for licensing information.
"""
__author__="Rodrigo Fuentealba <[email protected]>"
__version__="1.0"
__copyright__="Copyright (c) Rodrigo Fuentealba <[email protected]>"
__license__="MIT"
from daemon import daemon
| {
"content_hash": "22658d859758a23c930b590e8d0d7a29",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 76,
"avg_line_length": 27.454545454545453,
"alnum_prop": 0.7251655629139073,
"repo_name": "itolosa/turkmenbashi",
"id": "2410e601ef004d2ffcd3dc07eb65ec9e125150cf",
"size": ... |
"""Tests for keeping uniqueness constraints for requests"""
# This file is essentially a 1:1 copy of test_uniqueness_constraints
# The record requests should be validated like records
from django.contrib.auth.models import User
from powerdns.models.powerdns import Domain, Record
from powerdns.tests.utils import Recor... | {
"content_hash": "3a612df62876f249489ef649605b850b",
"timestamp": "",
"source": "github",
"line_count": 102,
"max_line_length": 78,
"avg_line_length": 33.96078431372549,
"alnum_prop": 0.6004618937644342,
"repo_name": "zefciu/django-powerdns-dnssec",
"id": "1721bc0fb87ddf7d83fd75b6d784d28a6555c8aa",
... |
"""
"""
from math import cos, sin, sqrt
from operator import add
from Chapter1.themes.compound_procedures import square
from Chapter2.themes.lisp_list_structured_data import car, cdr, cons, lisp_list
from Chapter2.themes.mapping_over_lists import map
from Chapter2.themes.representations_of_complex_numbers import (
... | {
"content_hash": "6ac6106d3ad7a4ccd91e61892cd13b2a",
"timestamp": "",
"source": "github",
"line_count": 134,
"max_line_length": 79,
"avg_line_length": 26.604477611940297,
"alnum_prop": 0.6042075736325385,
"repo_name": "aoyono/sicpy",
"id": "67e4628eab040ab314679a6648407664eb03d4c9",
"size": "3589",... |
import busbus
from busbus.queryable import Queryable
from busbus import util
from abc import ABCMeta, abstractmethod, abstractproperty
import arrow
import collections
import datetime
import heapq
import six
@six.add_metaclass(ABCMeta)
class ArrivalGeneratorBase(util.Iterable):
def __init__(self, provider, stops... | {
"content_hash": "eb49f11c2fb17709dd9c42ba7a50c692",
"timestamp": "",
"source": "github",
"line_count": 104,
"max_line_length": 77,
"avg_line_length": 33.40384615384615,
"alnum_prop": 0.5906735751295337,
"repo_name": "spaceboats/busbus",
"id": "dfe2043ae69b773e9514ec7a096dcd5d629fc064",
"size": "34... |
from setuptools import setup
setup(
name = 'mog',
packages = ['mog'],
version = '0.6.0',
description = 'A different take on the UNIX tool cat',
install_requires = ['pygments'],
author = 'witchard',
author_email = '[email protected]',
url = 'https://github.com/witchard/mog',
download_url = 'https:... | {
"content_hash": "7d8502058659df27123966fc56cd9cb1",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 77,
"avg_line_length": 35.348837209302324,
"alnum_prop": 0.6197368421052631,
"repo_name": "witchard/mog",
"id": "88a69793219125a9240b9a992d5a1b5783b633a8",
"size": "1520",
... |
import numpy
from prpy.tsr.tsrlibrary import TSRFactory
from prpy.tsr.tsr import TSR, TSRChain
@TSRFactory('herb', 'conference_table', 'point_on')
def point_on(robot, table, manip=None):
'''
This creates a TSR that allows you to sample poses on the table.
The samples from this TSR should be used to find po... | {
"content_hash": "c903f1d6497ea298514f67573c0cb054",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 109,
"avg_line_length": 44.8974358974359,
"alnum_prop": 0.6179326099371788,
"repo_name": "DavidB-CMU/herbpy",
"id": "562eacf115f07012c014e1b7cf51350c2e2b7e86",
"size": "175... |
"""This script is used to synthesize generated parts of this library."""
import synthtool as s
from synthtool import gcp
from synthtool.languages import python
import os
common = gcp.CommonTemplates()
default_version = "v2"
for library in s.get_staging_dirs(default_version):
if library.name == "v2":
# Fi... | {
"content_hash": "bc724bf55e140253d3d5fe528c7318be",
"timestamp": "",
"source": "github",
"line_count": 114,
"max_line_length": 115,
"avg_line_length": 30.54385964912281,
"alnum_prop": 0.5226881102814475,
"repo_name": "googleapis/python-logging",
"id": "0ef7dcaa1ebe8de4a70043009bdb58a90fa2bbd3",
"s... |
"""
Tool to subroutinize a CFF OpenType font.
Usage (command line):
>> ./pyCompressor.py /path/to/font.otf
# font written to /path/to/font.compressed.otf
Usage (in Python):
>> font = TTFont(path_to_font)
>> compreffor = Compreffor(font)
>> compreffor.compress()
>> font.save(path_to_output)
"""
import itertools
impor... | {
"content_hash": "d68740eff20992abc31910e56a6b100f",
"timestamp": "",
"source": "github",
"line_count": 1004,
"max_line_length": 172,
"avg_line_length": 38.45617529880478,
"alnum_prop": 0.5342398342398342,
"repo_name": "anthrotype/compreffor",
"id": "5ce18a6f5f250741426cc407bf21a5e961b3f461",
"size... |
import random
secretNumber = random.randint(1, 20)
print("I am thinking of a number between 1 and 20.")
#Ask the player to guess 6 times.
for guessesTaken in range(1, 7):
print("Take a guess. ")
guess = int(input())
if guess < secretNumber:
print("Your guess is too low.")
elif guess > secretN... | {
"content_hash": "885d88b2f6e9af376b8fde1f6d8f6623",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 82,
"avg_line_length": 29.523809523809526,
"alnum_prop": 0.6548387096774193,
"repo_name": "gunit84/Automate_Boring_Stuff",
"id": "e85abd62801c47c71d8ddf28c66b579ff2a07894",
... |
import unittest
from nose.exc import SkipTest
import time
class TestMainCase(unittest.TestCase):
def test_Ma(self):
print "printing: Verify assert 1"
self.assertTrue(1)
def test_Mb(self):
self.assertTrue(0, "raising: Some details")
def test_Mc(self):
print "printing: Veri... | {
"content_hash": "097df815a93f66e617a7d9f026b63884",
"timestamp": "",
"source": "github",
"line_count": 69,
"max_line_length": 69,
"avg_line_length": 21.956521739130434,
"alnum_prop": 0.6396039603960396,
"repo_name": "lysenkoivan/nose-html-reporting",
"id": "de39260a8c314460496875010fbdba45d383ddb9",... |
"""Deep Neural Network estimators."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tempfile
from tensorflow.contrib import layers
from tensorflow.contrib import metrics as metrics_lib
from tensorflow.contrib.framework import deprecated
from tenso... | {
"content_hash": "437788b0a1cd26e1e335343bf00573b0",
"timestamp": "",
"source": "github",
"line_count": 736,
"max_line_length": 82,
"avg_line_length": 38.73233695652174,
"alnum_prop": 0.6575577928228155,
"repo_name": "nanditav/15712-TensorFlow",
"id": "e417aa739fb801a8a2fe00269e7165f1a997f7d8",
"si... |
"""
Convenience interface for defining service URL endpoints for ESGF nodes
"""
class ESGFNode(object):
def __init__(self, base_url):
# Strip '/' from url as necessary
self.base_url = base_url.rstrip('/')
@property
def search_url(self):
"""
Return the URL of the esg-searc... | {
"content_hash": "e57f8c20cb8f981674e40d8775f65305",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 78,
"avg_line_length": 27.057142857142857,
"alnum_prop": 0.5702217529039071,
"repo_name": "bird-house/esgf-pyclient",
"id": "4e7e9313c19ae4b9743bc97528ed331f7458c097",
"siz... |
__author__ = 'tonycastronova'
from math import floor, ceil
import data_mapping
class MSSQL():
def __init__(self, options, dbwrenchObj):
self.__schemas = dbwrenchObj
self.__use_schemas = options.use_schemas
self.map = data_mapping.MSSQL()
self.__global_schema = options.global_schema
... | {
"content_hash": "b9467cc8f1cbd48e1b0a50c8d583f3a5",
"timestamp": "",
"source": "github",
"line_count": 453,
"max_line_length": 355,
"avg_line_length": 36.618101545253865,
"alnum_prop": 0.5217627200385822,
"repo_name": "miguelcleon/ODM2",
"id": "0cf6c419617f5986965bbb0cb36e1a283b080ded",
"size": "1... |
class ReflectionException(Exception):
pass
class SignatureException(ReflectionException):
pass
class MissingArguments(SignatureException):
pass
class UnknownArguments(SignatureException):
pass
class InvalidKeywordArgument(ReflectionException):
pass
| {
"content_hash": "4110a2c666a7b9244f7077723069277a",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 50,
"avg_line_length": 17.1875,
"alnum_prop": 0.7963636363636364,
"repo_name": "Infinidat/infi.pyutils",
"id": "951be236b64c7d5d013f60ecefdb39cfffafbc12",
"size": "275",
... |
from shogun import CombinedFeatures, RealFeatures, BinaryLabels
from shogun import CombinedKernel, PolyKernel, CustomKernel
from shogun import MKLClassification
from tools.load import LoadMatrix
lm=LoadMatrix()
#only run example if SVMLight is included as LibSVM solver crashes in MKLClassification
try:
from shogun im... | {
"content_hash": "118a1ea18da9f5e90836713930a3b547",
"timestamp": "",
"source": "github",
"line_count": 87,
"max_line_length": 98,
"avg_line_length": 28.50574712643678,
"alnum_prop": 0.6830645161290323,
"repo_name": "sorig/shogun",
"id": "c5211faa5e432d34b5b2d67dda50ef2ca953430b",
"size": "2502",
... |
import io
import logging
import os
import re
from typing import List, Optional, Pattern
from pygls.lsp.types import (NumType, Position, Range, TextDocumentContentChangeEvent,
TextDocumentItem, TextDocumentSyncKind,
VersionedTextDocumentIdentifier, WorkspaceFold... | {
"content_hash": "76b683a1c2297ddc98fb25b7316398ba",
"timestamp": "",
"source": "github",
"line_count": 400,
"max_line_length": 88,
"avg_line_length": 33.5475,
"alnum_prop": 0.6146508681719949,
"repo_name": "openlawlibrary/pygls",
"id": "8e73625f38752ba4cba034ccdb4f9ac3781c3a87",
"size": "14811",
... |
import itertools
import six
from csvkit import CSVKitReader
from csvkit.cli import CSVKitUtility
from csvkit.headers import make_default_headers
class CSVLook(CSVKitUtility):
description = 'Render a CSV file in the console as a fixed-width table.'
def add_arguments(self):
self.argparser.add_argumen... | {
"content_hash": "ddc43b25605c9ed13665a62fe006c461",
"timestamp": "",
"source": "github",
"line_count": 87,
"max_line_length": 150,
"avg_line_length": 32.08045977011494,
"alnum_prop": 0.5284844141884629,
"repo_name": "Tabea-K/csvkit",
"id": "e6fb0259f9579954bd7a16d045778b6734247a22",
"size": "2814"... |
from metrics import loading
from metrics import timeline
from telemetry.core import util
from telemetry.page import page_measurement
class LoadingTrace(page_measurement.PageMeasurement):
def __init__(self, *args, **kwargs):
super(LoadingTrace, self).__init__(*args, **kwargs)
self._timeline_metric = timeline.... | {
"content_hash": "cc8ec3e58f03471d49b25796ff21c4a5",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 78,
"avg_line_length": 35.25806451612903,
"alnum_prop": 0.7328453796889296,
"repo_name": "mogoweb/chromium-crosswalk",
"id": "16d930027ecb25be1e2c31cc66c191b3e00b77bc",
"si... |
from fractions import Fraction
from ..library.number_theory.primes import is_prime
from ..library.base import is_permutation
from ..library.sqrt import csqrt
def solve(bound: int=10_000_000) -> int:
primes = []
middle = csqrt(bound)
around = 10 * csqrt(middle)
for i in range(1, middle + around):
... | {
"content_hash": "00f423b06c4723fb0657fe4ee3d229d4",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 75,
"avg_line_length": 25.6,
"alnum_prop": 0.51171875,
"repo_name": "cryvate/project-euler",
"id": "3b59eec272d2cd6d85e12413918cd7b67e26706b",
"size": "768",
"binary": fa... |
from __future__ import absolute_import, division, print_function, unicode_literals
from h2o.estimators.estimator_base import H2OEstimator
from h2o.exceptions import H2OValueError
from h2o.frame import H2OFrame
from h2o.utils.typechecks import assert_is_type, Enum, numeric
class H2OGradientBoostingEstimator(H2OEstima... | {
"content_hash": "863d8458b2f9adc706ed86a1280c4363",
"timestamp": "",
"source": "github",
"line_count": 2216,
"max_line_length": 229,
"avg_line_length": 46.568592057761734,
"alnum_prop": 0.5599344935850227,
"repo_name": "h2oai/h2o-3",
"id": "bf201ddd0c2a63b84677122a1054b70abf1b579a",
"size": "10340... |
import array
import datetime
import logging
import threading
import queue
from ant.easy.channel import Channel
from ant.easy.node import Node, Message
import ant.fs.command
from ant.fs.beacon import Beacon
from ant.fs.command import (
LinkCommand,
DownloadRequest,
DownloadResponse,
AuthenticateCommand... | {
"content_hash": "55371ca5ca1cf0325250167440d77897",
"timestamp": "",
"source": "github",
"line_count": 410,
"max_line_length": 118,
"avg_line_length": 33.69024390243902,
"alnum_prop": 0.5625135741692608,
"repo_name": "Tigge/openant",
"id": "5d2587093efb68b14aac012be94ec2727e897238",
"size": "14937... |
from django.db.models import Q
from ajax_select import LookupChannel
from census_paleo.models import taxonomy, reference, censusLocation, specimen, fossilLocation
class taxonLookup(LookupChannel):
model = taxonomy
def get_query(self,q,request):
query = Q(taxonRank__icontains=q) | Q(species__icontain... | {
"content_hash": "22c49d1355c59b03f9f8d9e819f20817",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 193,
"avg_line_length": 30.74137931034483,
"alnum_prop": 0.6892877173303421,
"repo_name": "wabarr/census-paleo",
"id": "ebfffa0255418cc404af56cb0c3111720708a6b7",
"size": "... |
from copy import deepcopy
class Test(object):
def __init__(self, results, seats, blocks=None, params=None):
self.results = results
self.seats = seats
self.params = params
self.blocks = blocks
self.seat_results = {}
self.parties = []
for (ward, votes) in self.... | {
"content_hash": "8d2aecf925015680c6e504e6b34fe278",
"timestamp": "",
"source": "github",
"line_count": 84,
"max_line_length": 119,
"avg_line_length": 34.726190476190474,
"alnum_prop": 0.5581076448405896,
"repo_name": "rotsee/contrafactual-elections",
"id": "310b357b733caf0c05d1e4fe30e864521f4d577b",... |
import base64
import inspect
import os
import shutil
import tempfile
from castellan import key_manager
import fixtures
import mock
from oslo_concurrency import lockutils
from oslo_config import fixture as config_fixture
from oslo_utils import imageutils
from oslo_utils import units
from oslo_utils import uuidutils
im... | {
"content_hash": "3cefe0e883aa7b1cd8b5cc2cf8b8ee99",
"timestamp": "",
"source": "github",
"line_count": 1806,
"max_line_length": 79,
"avg_line_length": 44.102436323366554,
"alnum_prop": 0.5844015618526284,
"repo_name": "vmturbo/nova",
"id": "f35da2c7032c4b1ccac03747c1b96f6974a1ce06",
"size": "80278... |
import django_tables2 as tables
from django_tables2.utils import Accessor
from dcim.models import Interface
from tenancy.tables import COL_TENANT
from utilities.tables import BaseTable, BooleanColumn, ToggleColumn
from .models import Aggregate, IPAddress, Prefix, RIR, Role, Service, VLAN, VLANGroup, VRF
RIR_UTILIZATI... | {
"content_hash": "a5a8a545fdfba48cafc88123b563d755",
"timestamp": "",
"source": "github",
"line_count": 489,
"max_line_length": 376,
"avg_line_length": 35.52965235173824,
"alnum_prop": 0.6278922527915276,
"repo_name": "lampwins/netbox",
"id": "3906f080f93d4686f1c1c37a6a0dc30d1cfe77a5",
"size": "173... |
"""
Showing how we can take advantage of in memory caching via Redis if we are
making repeated market data calls externally.
This memory cache is designed to be temporary (and relatively transparent to
the user), rather than long term storage.
For longer term storage, can use IOEngine combined with MongoDB
"""
__au... | {
"content_hash": "8132338b711b0250a1fd20a942d3a0e8",
"timestamp": "",
"source": "github",
"line_count": 72,
"max_line_length": 79,
"avg_line_length": 36.666666666666664,
"alnum_prop": 0.6791666666666667,
"repo_name": "cuemacro/findatapy",
"id": "ea583c114dfcb4d6cd70a8b9ea2a37a1d447d26b",
"size": "2... |
from django.shortcuts import render
from django.conf import settings
from django_telegrambot.apps import DjangoTelegramBot
# Create your views here.
def index(request):
bot_list = DjangoTelegramBot.bots
context = {'bot_list': bot_list, 'update_mode':settings.DJANGO_TELEGRAMBOT['MODE']}
return render(reques... | {
"content_hash": "817a60b60852aaa8f5f4b1e15a78fc5a",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 87,
"avg_line_length": 38.888888888888886,
"alnum_prop": 0.7628571428571429,
"repo_name": "JungDev/django-telegrambot",
"id": "c01e3ae66563707a72350f8ccae8a5d274561ff0",
"si... |
from setuptools import setup, find_packages
setup(
name='cl2nc',
version='3.3.1',
description='Convert Vaisala CL51 and CL31 dat files to NetCDF',
author='Peter Kuma',
author_email='[email protected]',
license='MIT',
py_modules=['cl2nc'],
entry_points={
'console_scripts': ['cl... | {
"content_hash": "01a05078383eb5e81480fafe05f4da59",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 74,
"avg_line_length": 34.964285714285715,
"alnum_prop": 0.6057201225740552,
"repo_name": "peterkuma/cl2nc",
"id": "f7a59e675c8965963e1160e0d6fabd125402b4e2",
"size": "1002... |
class RouterInfo(object):
"""Represents some system information about the router,
such as hardware and firmware version.
"""
def __init__(self):
self._hardware_version = None
self._firmware_version = None
def set_hardware_version(self, value):
self._hardware_version = value... | {
"content_hash": "4999f73c862a153f7950b67cce856513",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 59,
"avg_line_length": 26.09090909090909,
"alnum_prop": 0.6498257839721254,
"repo_name": "spantaleev/roscraco",
"id": "41d275e129432c049fe2f107433add7c2adb3c1f",
"size": "5... |
from direct.distributed import DistributedObjectAI
from otp.level import DistributedLevelAI
from direct.directnotify import DirectNotifyGlobal
from toontown.toonbase import ToontownGlobals
from toontown.coghq import MintLayout, DistributedMintRoomAI
from toontown.coghq import BattleExperienceAggregatorAI
class Distrib... | {
"content_hash": "239fe34150fb9e28be5d1ba7c1325c43",
"timestamp": "",
"source": "github",
"line_count": 71,
"max_line_length": 176,
"avg_line_length": 37.267605633802816,
"alnum_prop": 0.6757369614512472,
"repo_name": "ksmit799/Toontown-Source",
"id": "5aa6f3f2970ae38aa5fcb06d466b9c0a3e9d17d9",
"si... |
from __future__ import division
from datetime import datetime, timedelta
import logging
import os
from guessit import guessit
logger = logging.getLogger(__name__)
#: Video extensions
VIDEO_EXTENSIONS = ('.3g2', '.3gp', '.3gp2', '.3gpp', '.60d', '.ajp', '.asf', '.asx', '.avchd', '.avi', '.bik',
'.... | {
"content_hash": "721f30fc1bd81d00e02b726fca7223c0",
"timestamp": "",
"source": "github",
"line_count": 228,
"max_line_length": 117,
"avg_line_length": 36.09649122807018,
"alnum_prop": 0.5865127582017011,
"repo_name": "fernandog/subliminal",
"id": "49e78091a509a67c468075f038bbda1db5f9dedd",
"size":... |
"""
Kubeflow Training SDK
Python SDK for Kubeflow Training # noqa: E501
The version of the OpenAPI document: v1.5.0
Generated by: https://openapi-generator.tech
"""
from __future__ import absolute_import
import copy
import logging
import multiprocessing
import sys
import urllib3
import six
from s... | {
"content_hash": "b35c00abbe099397e01d7ed290384d75",
"timestamp": "",
"source": "github",
"line_count": 374,
"max_line_length": 85,
"avg_line_length": 33.07486631016043,
"alnum_prop": 0.5854486661277284,
"repo_name": "kubeflow/training-operator",
"id": "62846b36acee7674507c18de6510e5596b272539",
"s... |
"""Utility classes and values used for marshalling and unmarshalling objects to
and from primitive types.
.. warning::
This module is treated as private API.
Users should not need to use this module directly.
"""
from __future__ import unicode_literals
from marshmallow.utils import missing
from marshmallow.... | {
"content_hash": "92335d3553b19fb6cbb56dca7b04124c",
"timestamp": "",
"source": "github",
"line_count": 301,
"max_line_length": 96,
"avg_line_length": 39.66445182724252,
"alnum_prop": 0.5446854845464444,
"repo_name": "dwieeb/marshmallow",
"id": "5caca5833a02af3a73b47087720071813abf6d40",
"size": "1... |
InterfaceBusItem = 'com.victronenergy.BusItem'
import sys
import os
from csv import reader as csvreader
from dbus.mainloop.glib import DBusGMainLoop
import dbus
import dbus.service
import gobject
import pickle
import logging
from collections import defaultdict
from functools import total_ordering
from itertools import... | {
"content_hash": "339eed85bf01294f1afb453a1a1f78b4",
"timestamp": "",
"source": "github",
"line_count": 78,
"max_line_length": 81,
"avg_line_length": 26.858974358974358,
"alnum_prop": 0.7102625298329356,
"repo_name": "victronenergy/dbus_modbustcp",
"id": "dd59713047da8b697bbd5190ffdf3c2936ffac57",
... |
from .hugo_doc import HugoDoc
from slugify import UniqueSlugify
import os
slugger = UniqueSlugify()
class DocsMaker(object):
"""A documentation site maker."""
def __init__(self, section):
self.section = section
self.output_dir = '%s/livingdocs/content/%s' % (
os.getcwd(), self.s... | {
"content_hash": "48e62911687a2d1f8bb86fbeae9c683e",
"timestamp": "",
"source": "github",
"line_count": 91,
"max_line_length": 98,
"avg_line_length": 33.967032967032964,
"alnum_prop": 0.5606599805888062,
"repo_name": "discogs/python-livingdocs",
"id": "0df2ec88b28d3be17d9be6701cfb7aa5aed16378",
"si... |
import os
import json
from decimal import Decimal
from datapackage_pipelines.wrapper import ingest, spew
parameters_, datapackage_, resources_ = ingest()
column = parameters_['column']
currency = parameters_['currency']
currency_column = parameters_['currency-column']
date_columns = parameters_['date-columns']
miss... | {
"content_hash": "b737a575f3fc6116dc53815b39ec12d2",
"timestamp": "",
"source": "github",
"line_count": 63,
"max_line_length": 114,
"avg_line_length": 35.79365079365079,
"alnum_prop": 0.5215077605321508,
"repo_name": "Victordeleon/os-data-importers",
"id": "1d99a8e00a7a7bb1e7f4b8628efbb431f9d882df",
... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
DOCUMENTATION = """
become: pbrun
short_description: PowerBroker run
description:
- This become plugins allows your remote/login user to execute commands as another user via the pbrun utility.
author: ansibl... | {
"content_hash": "47138a2dd7e96924716d7614965ae6ab",
"timestamp": "",
"source": "github",
"line_count": 101,
"max_line_length": 118,
"avg_line_length": 32.039603960396036,
"alnum_prop": 0.5219406674907293,
"repo_name": "thaim/ansible",
"id": "a426c8c345ab131f811852d6aad1264f0f036a4b",
"size": "3392... |
import os
import logging
import time
from multiprocessing.dummy import Pool as ThreadPool
from utils import set_up_logging
log = set_up_logging('download', loglevel=logging.DEBUG)
# GENERAL DOWNLOAD FUNCTIONS
def response_download(response, output_loc):
if response.ok:
try:
with open(output... | {
"content_hash": "fd24480ed50904579adeaf948d8a178d",
"timestamp": "",
"source": "github",
"line_count": 103,
"max_line_length": 72,
"avg_line_length": 34.116504854368934,
"alnum_prop": 0.5483779169038133,
"repo_name": "influence-usa/campaign-finance_state_PA",
"id": "64e7381da88973ff13be8317433e4a10c... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.