text stringlengths 4 1.02M | meta dict |
|---|---|
"""Common utilities for the tests
"""
import time
import unittest
import random
random.seed()
import sys
import traceback
import pdb
from thingflow.base import IterableAsOutputThing, InputThing, FatalError,\
SensorEvent, Filter
class RandomSensor:
def __init__(self, sensor_id, mean=100.0, stddev=20.0, stop_a... | {
"content_hash": "1eac938fda96a292e76d1f0af80e7ab3",
"timestamp": "",
"source": "github",
"line_count": 240,
"max_line_length": 102,
"avg_line_length": 36.50833333333333,
"alnum_prop": 0.5889066423191053,
"repo_name": "mpi-sws-rse/thingflow-python",
"id": "08c2d3e3ea9ba873be2d07935bff6de45dbf1806",
... |
"""Autogenerated file - DO NOT EDIT
If you spot a bug, please report it on the mailing list and/or change the generator."""
from nipype.interfaces.base import CommandLine, CommandLineInputSpec, SEMLikeCommandLine, TraitedSpec, File, Directory, traits, isdefined, InputMultiPath, OutputMultiPath
import os
class OtsuTh... | {
"content_hash": "fbd76d3588cccf28a0c5e6f26f33f944",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 512,
"avg_line_length": 71.90243902439025,
"alnum_prop": 0.7917232021709634,
"repo_name": "iglpdc/nipype",
"id": "af724c9f96cdf6e2af6032b01301300a2995ffc6",
"size": "2971",... |
import sys
from decimal import Decimal, getcontext
def load_num():
num_str = ''
while num_str == '\n' or num_str=='':
num_str = sys.stdin.readline()
return int(num_str.rstrip())
if __name__ == '__main__':
# This problem is trivial using python's arbitrary precission integers.
# A C i... | {
"content_hash": "ca35032accabbd7a813d37071376a5aa",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 75,
"avg_line_length": 28.06451612903226,
"alnum_prop": 0.628735632183908,
"repo_name": "secnot/uva-onlinejudge-solutions",
"id": "20cadf8e47f6f7aa128434acc386414349ab967d",
... |
"""
Sensors of a KNX Device.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/knx/
"""
from homeassistant.const import (TEMP_CELSIUS, TEMPERATURE, CONF_TYPE,
ILLUMINANCE, SPEED_MS, CONF_MINIMUM,
... | {
"content_hash": "225a2e5992b1736549dba34d290e8cbe",
"timestamp": "",
"source": "github",
"line_count": 134,
"max_line_length": 79,
"avg_line_length": 31.313432835820894,
"alnum_prop": 0.6151096282173498,
"repo_name": "robjohnson189/home-assistant",
"id": "3dce95f768886705bbceef57fa06ab81affc5913",
... |
from decimal import Decimal
from trailer.model.fix import Fix
from trailer.model.fieldtools import nullable, make_list, make_time
class Waypoint:
def __init__(self, latitude, longitude, elevation=None, time=None,
magvar=None, geoid_height=None, name=None, comment=None,
descriptio... | {
"content_hash": "5292df23d3d8f6e8bce92e8ea1ad5703",
"timestamp": "",
"source": "github",
"line_count": 157,
"max_line_length": 101,
"avg_line_length": 27.88535031847134,
"alnum_prop": 0.6000456829602558,
"repo_name": "rob-smallshire/trailer",
"id": "e212429aee5838daa812a2c9bd905515e7742e3f",
"size... |
"""
Quick n dirty eigen3 detection
"""
import os, glob, types
import Options, Configure
def detect_eigen3(conf):
env = conf.env
opt = Options.options
conf.env['LIB_EIGEN3'] = ''
conf.env['EIGEN3_FOUND'] = False
if Options.options.no_eigen3:
return 0
if Options.options.eigen3:
conf.env['CPPPATH_EIGEN3'] = [... | {
"content_hash": "000140eee06293508b580b59082b9bd0",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 121,
"avg_line_length": 29.514285714285716,
"alnum_prop": 0.6747337850919651,
"repo_name": "Evolving-AI-Lab/innovation-engine",
"id": "19787cea237f95ad1b9781dd8add143f51413ba... |
from django.contrib.auth.models import Permission
from django.test import TestCase
from django.urls import reverse
from wagtail.admin.tests.pages.timestamps import local_datetime
from wagtail.core.models import Page
from wagtail.search.index import SearchField
from wagtail.tests.testapp.models import SimplePage, Singl... | {
"content_hash": "abe961fa43cab7f49f0003df1f167646",
"timestamp": "",
"source": "github",
"line_count": 186,
"max_line_length": 99,
"avg_line_length": 41.38709677419355,
"alnum_prop": 0.6208106001558846,
"repo_name": "torchbox/wagtail",
"id": "61d47109864ff0da274e475e419b99231f31cf62",
"size": "769... |
"""
"""
from abc import ABCMeta, abstractmethod
from typing import AsyncGenerator, Callable, Iterable, Optional, Sequence
from prompt_toolkit.document import Document
from prompt_toolkit.eventloop import generator_to_async_generator
from prompt_toolkit.formatted_text import AnyFormattedText, StyleAndTextTuples
__all_... | {
"content_hash": "13732c39f024b8e5167fd85797122221",
"timestamp": "",
"source": "github",
"line_count": 349,
"max_line_length": 88,
"avg_line_length": 32.99140401146132,
"alnum_prop": 0.6405245787736669,
"repo_name": "jonathanslenders/python-prompt-toolkit",
"id": "821cc5b7254641f93a4349974fa8fae20e3... |
import dwolla
import urlparse
import json
import webapp2
from webapp2_extras import sessions
from webapp2_extras import jinja2
from google.appengine.ext import db
from webapp2 import RequestHandler, WSGIApplication
class BaseHandler(RequestHandler):
def dispatch(self):
self.session_store = sessions.get_st... | {
"content_hash": "faf09fa1b267db7b4ecd4ee06dfd9878",
"timestamp": "",
"source": "github",
"line_count": 172,
"max_line_length": 90,
"avg_line_length": 31.63372093023256,
"alnum_prop": 0.6118360595478772,
"repo_name": "hansent/dwollaup",
"id": "45626b8ed042f581afd15de28a8ae3e22304ac8b",
"size": "544... |
from urllib.request import Request, urlopen
from urllib.parse import quote, urlencode
from urllib.error import HTTPError
import json
_baseurl = "https://api.twitch.tv/kraken"
_apiversionheader = "application/vnd.twitchtv.v2+json"
class TwitchAPI(object):
def __init__(self, client_id):
self.client_id = c... | {
"content_hash": "ba9350adfe2880ee8431ef23a6a82a93",
"timestamp": "",
"source": "github",
"line_count": 137,
"max_line_length": 133,
"avg_line_length": 44.175182481751825,
"alnum_prop": 0.6112029081295439,
"repo_name": "nicka101/CloudBroWeb",
"id": "9b964bdd650b15c392394e8a51e2a6095bc8cf97",
"size"... |
"""Implementation of compile_html based on CreoleWiki."""
import codecs
import os
try:
from creole import Parser
from creole.html_emitter import HtmlEmitter
creole = True
except ImportError:
creole = None
from nikola.plugin_categories import PageCompiler
from nikola.utils import makedirs, req_missing... | {
"content_hash": "8600e541b0419807f7d09a7cea17ec7e",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 85,
"avg_line_length": 33.43636363636364,
"alnum_prop": 0.6084828711256117,
"repo_name": "getnikola/plugins",
"id": "2284f6d1f14e2542f8547f2aab079d28bfd07a7f",
"size": "298... |
import subprocess
import sys
import setup_util
from os.path import expanduser
import os
import getpass
def start(args, logfile, errfile):
setup_util.replace_text("web-simple/app.pl", "localhost", args.database_host)
setup_util.replace_text("web-simple/nginx.conf", "USR", getpass.getuser())
setup_util.replace_tex... | {
"content_hash": "f0647b6167b73f2ee7d1080f7dd70fee",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 211,
"avg_line_length": 42.4,
"alnum_prop": 0.7075471698113207,
"repo_name": "ratpack/FrameworkBenchmarks",
"id": "7381de8a198c86c3f49970abefc997ff357491b6",
"size": "1272"... |
# store the string written to screens so can check it from test
current_drawn_strings = []
timer_running = False
KEY_MAP = { "down" : 40, "up": 38, "S" : 83, "W" : 87, "H" : 72}
class Label:
def set_text(l, text):
return Label()
class Frame:
def add_button(f, label, handler, width=100):
... | {
"content_hash": "0c30c8df2635dee811eb107d93b7efc9",
"timestamp": "",
"source": "github",
"line_count": 51,
"max_line_length": 72,
"avg_line_length": 23.274509803921568,
"alnum_prop": 0.6267902274641954,
"repo_name": "hemmerling/python-coursera2012",
"id": "4f8ddf199bf8097da9c2eb137b2b6b965a6eef29",
... |
import contextlib
import glob
import hashlib
import logging
import os
import re
import shutil
import signal
import socket
import subprocess
import tempfile
import threading
import time
import zipfile
from urllib.error import URLError
from urllib.request import urlopen
import grpc
from apache_beam.version import __ver... | {
"content_hash": "b44080b977b0485962e3b02302222a20",
"timestamp": "",
"source": "github",
"line_count": 348,
"max_line_length": 80,
"avg_line_length": 33.3132183908046,
"alnum_prop": 0.6195117743465884,
"repo_name": "lukecwik/incubator-beam",
"id": "f11132ca1643d6550dd028422a3176c5348ec3c4",
"size"... |
import os
from flask_script import Manager
from flask_migrate import Migrate, MigrateCommand
from app import app, db
app.config.from_object(os.environ['APP_SETTINGS'])
migrate = Migrate(app, db)
manager = Manager(app)
manager.add_command('db', MigrateCommand)
if __name__ == '__main__':
manager.run()
| {
"content_hash": "1453970048a8dbf26fd7cd52bd3e493a",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 50,
"avg_line_length": 19.4375,
"alnum_prop": 0.7234726688102894,
"repo_name": "JonathanFrederick/job-hunt",
"id": "1d11db3c754313470aaf7f4ede3f3a73f54096d5",
"size": "311"... |
import sdl2
import sdl2.ext
__all__ = []
DRAW_CONTEXT = None
class DrawContext:
def __init__(self, surface):
self.old_surface = None
self.surface = surface
def __enter__(self):
global DRAW_CONTEXT
self.old_surface = DRAW_CONTEXT
DRAW_CONTEXT = self.surface
... | {
"content_hash": "6c62079827832950212e8c2385258d37",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 96,
"avg_line_length": 27.340425531914892,
"alnum_prop": 0.6186770428015564,
"repo_name": "JaniM/PyBasic",
"id": "1542b6f84e7501fefdd7340c8ea1dfeb570355e3",
"size": "1286",... |
"""Tests for common methods in strategy classes."""
from absl.testing import parameterized
from tensorflow.python.data.ops import dataset_ops
from tensorflow.python.distribute import combinations
from tensorflow.python.distribute import distribution_strategy_context as ds_context
from tensorflow.python.distribute imp... | {
"content_hash": "7bed9f547c90e9a6f0a93a59f61eb817",
"timestamp": "",
"source": "github",
"line_count": 683,
"max_line_length": 99,
"avg_line_length": 37.194729136163986,
"alnum_prop": 0.6463155408597071,
"repo_name": "Intel-Corporation/tensorflow",
"id": "6c6f88cc11ca1b15ba801963fe85edb66e18b9e3",
... |
import sys
import numpy as np
import pylab
import pandas as pd
from easydev import precision
and_symbol = "^"
__all = ["Models", "BooleanModels", "ContinousModels",
"DTModels", "FuzzyModels", "CompareModels"]
class Models(object):
"""Data structure to store models.
Models are stored in dataframes. Co... | {
"content_hash": "aa917a2e21bff02a27ab5e95eb996c00",
"timestamp": "",
"source": "github",
"line_count": 487,
"max_line_length": 112,
"avg_line_length": 34.285420944558524,
"alnum_prop": 0.5578247589387315,
"repo_name": "cellnopt/cellnopt",
"id": "1ae32b248ebc6901c09b5bebe1b7265f2f7cd2ac",
"size": "... |
from django.conf.urls import url, patterns
from . import views
app_name = 'consultas'
urlpatterns = patterns(
'',
url(r'^$', views.index, name='index'),
url(r'^info/(?P<empresa_cif>.+)$', views.info, name='info'),
)
| {
"content_hash": "87d3e81fd780dbe8a9832e10eeabd189",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 64,
"avg_line_length": 23,
"alnum_prop": 0.6260869565217392,
"repo_name": "dmsgago/ree",
"id": "70bcf78963dccf804bc2bb4504c80904c5e20cc4",
"size": "230",
"binary": false,... |
from __future__ import unicode_literals
import json
import logging
import os
import threading
import pykka
import tornado.httpserver
import tornado.ioloop
import tornado.netutil
import tornado.web
import tornado.websocket
from mopidy import exceptions, models, zeroconf
from mopidy.core import CoreListener
from mopi... | {
"content_hash": "6d5526e718b3e99cfd6a230a718e4947",
"timestamp": "",
"source": "github",
"line_count": 182,
"max_line_length": 79,
"avg_line_length": 31.62087912087912,
"alnum_prop": 0.5716768027801912,
"repo_name": "woutervanwijk/mopidy",
"id": "57e2f46a274a609ee6866dc1304f8911bf97dc03",
"size": ... |
import sys
import guestfs
import tempfile
import hivex
def create_merge_file(path):
"""Create mergeide.reg with the link to the proper controlset.
The original file points to a CurrentControlSet key in the registry
However, that key is not present when the guest is not running.
This function creates ... | {
"content_hash": "bdcc643070de8dd4e33a01c0a9749b35",
"timestamp": "",
"source": "github",
"line_count": 74,
"max_line_length": 83,
"avg_line_length": 31.04054054054054,
"alnum_prop": 0.6569438397910318,
"repo_name": "jakobadam/kvm-mergeide",
"id": "3f4c25638f258f5c3846a71520b5b6d3ce05708b",
"size":... |
from org.python.util import PythonInterpreter
print recurse
pi = PythonInterpreter()
pi.set("terminal", terminal)
pi.set("recurse", recurse + 1)
pi.execfile('/media/truecrypt1/code/java/Hakd/python/programs/recursive.py')
| {
"content_hash": "49947a6a6c97b3c9c008d8afb1de58e1",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 76,
"avg_line_length": 25,
"alnum_prop": 0.7733333333333333,
"repo_name": "Rsgm/Hakd",
"id": "fccd601d138b70bfee634e0e708254b277c36022",
"size": "225",
"binary": false,
... |
import os
import sys
# In ORT Package the symbolic_shape_infer.py is in ../tools
file_path = os.path.dirname(__file__)
if os.path.exists(os.path.join(file_path, "../tools/symbolic_shape_infer.py")):
sys.path.append(os.path.join(file_path, '../tools'))
else:
sys.path.append(os.path.join(file_path, '..'))
from s... | {
"content_hash": "a99d34d38de3b121366b379c13866913",
"timestamp": "",
"source": "github",
"line_count": 79,
"max_line_length": 129,
"avg_line_length": 42,
"alnum_prop": 0.6024713682941532,
"repo_name": "ryfeus/lambda-packs",
"id": "1aaa7b120678ba9785603d78fdf5c5269e4b1db0",
"size": "3565",
"binar... |
import base64
import copy
import json
import isodate
from datetime import datetime
from pyld import jsonld
import pytz
from cryptography.hazmat.primitives import serialization
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives import hashes
from cryptography.hazmat.primitives.... | {
"content_hash": "b6dd568495cd1d44ecd9f1451fc0d544",
"timestamp": "",
"source": "github",
"line_count": 718,
"max_line_length": 80,
"avg_line_length": 37.956824512534816,
"alnum_prop": 0.6263163688401276,
"repo_name": "Spec-Ops/pyld-signatures",
"id": "3afa87a38ca717d25cce3b644e240051b31af18b",
"si... |
from __future__ import division
from subprocess import check_output
from math import log, sqrt, pow, e
from scipy import special
import numpy as np
import StringIO
import argparse
import time
import os
#Set the author information
__author__ = "Justin R. Klesmith"
__copyright__ = "Copyright 2016, Justin R. Klesmith"
__... | {
"content_hash": "5e16630c5c82ab16e873a1db6511830c",
"timestamp": "",
"source": "github",
"line_count": 488,
"max_line_length": 221,
"avg_line_length": 42.54713114754098,
"alnum_prop": 0.563309733660839,
"repo_name": "JKlesmith/Deep_Sequencing_Analysis",
"id": "2d977c67c014656e0867f971fff8a6c26182951... |
"""Example implementation of two double ended sliders as extension widgets"""
from bokeh.core.properties import Float, Instance, Tuple, Bool, Enum
from bokeh.models import InputWidget
from bokeh.models.callbacks import Callback
from bokeh.core.enums import SliderCallbackPolicy
from bokeh.layouts import column
from bok... | {
"content_hash": "3b6f7f187474138de7d9d74da5a2a3bd",
"timestamp": "",
"source": "github",
"line_count": 117,
"max_line_length": 115,
"avg_line_length": 38.9059829059829,
"alnum_prop": 0.6586115992970123,
"repo_name": "Karel-van-de-Plassche/bokeh",
"id": "4103508b63c835a71db086202d8dd62cabf93d91",
"... |
from django.contrib import admin
from .models import User
class UserAdmin(admin.ModelAdmin):
fields = ('first_name', 'last_name', 'birthday', 'gender', 'language', 'timezone', 'is_superuser', 'is_staff', 'is_active', 'username', 'email', 'password', 'created_on', 'updated_on', 'last_login',)
readonly_fields ... | {
"content_hash": "917331826a528d43af43503422d42bc5",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 203,
"avg_line_length": 29.842105263157894,
"alnum_prop": 0.7160493827160493,
"repo_name": "dogukantufekci/easyfind",
"id": "78baaeeeeedac2e137020e9a8cffc2142f6a029a",
"siz... |
import aarhus
import custom_stopwords
| {
"content_hash": "96a2242cfdccf5c238f2e38da565529f",
"timestamp": "",
"source": "github",
"line_count": 2,
"max_line_length": 23,
"avg_line_length": 19,
"alnum_prop": 0.868421052631579,
"repo_name": "mikedelong/aarhus",
"id": "0464ae03ba08c507f2b948109b559f1a57a8ce92",
"size": "38",
"binary": fal... |
import numpy as np
import scipy.io
from datasets.read_libsvm import *
import logging
import logging.config
import os
def libsvm2mat(fname, ndata, nfeatures, binary=True):
FORMAT = '%(asctime)-15s %(message)s'
logging.basicConfig(format=FORMAT, level=logging.DEBUG)
logger = logging.getLogger("opt")
lo... | {
"content_hash": "45455a5e82f1504b9b6c361088fb0ba4",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 85,
"avg_line_length": 25.157894736842106,
"alnum_prop": 0.6307531380753139,
"repo_name": "adefazio/point-saga",
"id": "801c2b79be5b111f8e94c6f361747f517dcf98f0",
"size": "... |
from datetime import datetime
from google.appengine.api import taskqueue
import config
import logic.alias
import logic.email
import logic.event
from errors import TaintedLove
from logic.toggle import get_toggle_state
from models import Employee
from models import Love
from models import LoveCount
from models.toggle i... | {
"content_hash": "36eb947853ee06f8544ea28a3aa938c0",
"timestamp": "",
"source": "github",
"line_count": 238,
"max_line_length": 115,
"avg_line_length": 36.634453781512605,
"alnum_prop": 0.6765684138089231,
"repo_name": "Yelp/love",
"id": "e57d2ad01319f87b49a4a91134cc3fc9c7744fe0",
"size": "8743",
... |
"""
Experimental optimization
This module provides a single mixin class which allows protocols to
collapse numerous small writes into a single larger one.
@author: Jp Calderone
"""
from twisted.internet import reactor
class BufferingMixin:
"""Mixin which adds write buffering.
"""
_delayedWriteCall = Non... | {
"content_hash": "d0bcd6ea5fffca67943eedcf73e1cef5",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 74,
"avg_line_length": 25.122448979591837,
"alnum_prop": 0.6425670186839968,
"repo_name": "Tokyo-Buffalo/tokyosouth",
"id": "99439cf1475e906fe465155021e48f87fd3099d2",
"siz... |
import csv
import json
from datetime import datetime
"""Useful for converting DynamoDB exports to CSV"""
data = []
with open('data') as f:
for line in f:
data.append(json.loads(line))
with open('data.csv', 'w', encoding='utf8') as csvf:
w = csv.writer(csvf, quoting=csv.QUOTE_MINIMAL)
w.writerow(... | {
"content_hash": "8a8fce368191214d91727938ab2e3612",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 56,
"avg_line_length": 29.80952380952381,
"alnum_prop": 0.6118210862619808,
"repo_name": "akrawchyk/amweekly",
"id": "f7562fbb0fd40e6f732b13273da04f190ed5f4bf",
"size": "62... |
import hashlib
from anchore_engine.db import AnalysisArtifact
from anchore_engine.services.policy_engine.engine.policy.gate import BaseTrigger, Gate
from anchore_engine.utils import ensure_bytes, ensure_str
MALWARE_CONTEXT_KEY = "malware_scans"
class ScanFindingsTrigger(BaseTrigger):
__trigger_name__ = "scans"
... | {
"content_hash": "5a49899810be9e09944930cf2939d929",
"timestamp": "",
"source": "github",
"line_count": 100,
"max_line_length": 139,
"avg_line_length": 32.22,
"alnum_prop": 0.574487895716946,
"repo_name": "anchore/anchore-engine",
"id": "19179851ad6f82779b0a59c47d3ba2f0fdf20ae7",
"size": "3222",
... |
import functools
import logging
from os.path import dirname, join
from . import cloudmask # noqa
from . import config # noqa
from . import constants # noqa
from . import files # noqa
from . import geodesy # noqa
from . import geographical # noqa
from . import latex # noqa
from . import math # noqa
from . impor... | {
"content_hash": "ab9301bba1c84c999e266d2b5d42a592",
"timestamp": "",
"source": "github",
"line_count": 88,
"max_line_length": 71,
"avg_line_length": 28.125,
"alnum_prop": 0.6496969696969697,
"repo_name": "atmtools/typhon",
"id": "74560a6b5d5b2781926eda4e95bce37954da2aa6",
"size": "2475",
"binary... |
"""
Made with <3 by Mustafa Gezen (mustafagezen)
The MIT License (MIT)
Copyright (c) 2014 Mustafa Gezen
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 limi... | {
"content_hash": "205a62becdeb0373ff323a769078b218",
"timestamp": "",
"source": "github",
"line_count": 148,
"max_line_length": 169,
"avg_line_length": 34.74324324324324,
"alnum_prop": 0.6705562038117464,
"repo_name": "mustafagezen/python-bring",
"id": "c855247dbf44711cddb95332a4cfc1b61b6ba7e9",
"s... |
import os
import numpy as np
import pandas as pd
from astropy import units as u
import pytest
import tardis
from tardis.atomic import AtomData
from tardis.plasma.standard_plasmas import LegacyPlasmaArray
from tardis.plasma.properties import *
# INPUTS
@pytest.fixture
def atomic_data(selected_atoms):
atomic_db_f... | {
"content_hash": "039060a120c721e7988461538ca3dad0",
"timestamp": "",
"source": "github",
"line_count": 261,
"max_line_length": 80,
"avg_line_length": 34.01149425287356,
"alnum_prop": 0.7122901881266194,
"repo_name": "orbitfold/tardis",
"id": "8e11b06a99965f82cb7223f4a70c3a7fd24963cc",
"size": "887... |
def _extract_match(toc, index, seperator=','):
"""
Extracts a path between seperators (,)
:toc (str) Table of contents
:index (int) Index of match
returns full path from match
"""
length = len(toc)
start_index = index
while toc[start_index] != seperator and start_index >= 0:
... | {
"content_hash": "6aa3f7aed0e48c942a24316a146bde1c",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 65,
"avg_line_length": 29.3,
"alnum_prop": 0.5989761092150171,
"repo_name": "codecov/pathmap",
"id": "98d9f97702c612f7a36a54afc5dcac00b5aa78b4",
"size": "586",
"binary": ... |
import functools
from operator import mul
import numpy
import six
import chainer
from chainer.backends import cuda
from chainer import function_node
from chainer.functions.pooling import max_pooling_nd_kernel
from chainer.functions.pooling import pooling_nd
from chainer.utils import conv_nd
import chainerx
class Ma... | {
"content_hash": "3eec6a8da1bdfd19658c86fab80b6428",
"timestamp": "",
"source": "github",
"line_count": 340,
"max_line_length": 79,
"avg_line_length": 37.02647058823529,
"alnum_prop": 0.5792358408134085,
"repo_name": "jnishi/chainer",
"id": "f4b757a169fd61120e2fe39bfa9b28d185b59b10",
"size": "12589... |
import random
#
# A simple name generator
#
female_names = ["Sarah", "Abby", "Kate", "Caitlin", "Kim", "Allison", "Sky"]
male_names = ["Mark", "Bob", "John", "Sean", "Jake", "Jerry", "Matthew"]
def human(gender):
if gender is "M":
return random.choice(male_names)
return random.choice(female_names) | {
"content_hash": "0cfb5a3f9b775f399d6fb2ab244eccbf",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 76,
"avg_line_length": 25.333333333333332,
"alnum_prop": 0.6480263157894737,
"repo_name": "SkylarKelty/AI",
"id": "4742efdd0b958b004fe6f284ca94c4a23c8744c9",
"size": "304",... |
import sys, os
__here__ = os.path.abspath(os.path.dirname(__file__))
# 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 shown here.
#sys.path.i... | {
"content_hash": "57fbd4eb290a8ae9293c66c6450caa65",
"timestamp": "",
"source": "github",
"line_count": 236,
"max_line_length": 148,
"avg_line_length": 32.49576271186441,
"alnum_prop": 0.6987873255965575,
"repo_name": "ftobia/ham",
"id": "c81d0d9bf471cf7818ef26bf11fcd4b1348aa028",
"size": "8083",
... |
from __future__ import absolute_import
import os.path
from six.moves.urllib.parse import urlencode
from os.path import join, dirname
from sentry.testutils import AcceptanceTestCase
EMAILS = (
('/debug/mail/assigned/', 'assigned'),
('/debug/mail/assigned/self/', 'assigned self'),
('/debug/mail/note/', 'n... | {
"content_hash": "3aae0d747d02440e0dd91734a55771b4",
"timestamp": "",
"source": "github",
"line_count": 79,
"max_line_length": 82,
"avg_line_length": 37.12658227848101,
"alnum_prop": 0.6096147289464712,
"repo_name": "looker/sentry",
"id": "5be4b63bfe7bfc55d8b080cf718b144d7c5f7280",
"size": "2933",
... |
from quark_runtime import *
import slack
import pkg
def call_main(): import sys; main(_List(sys.argv[1:]))
def main(args):
cli = slack.Client(None, u"fake-token", pkg.Handler());
(cli).onWSMessage(None, u"{\"type\": \"hello\"}");
(cli).onWSMessage(None, u"{\"type\": \"message\", \"user\": \"uid-1\", \"ch... | {
"content_hash": "f89781d44ad3880f0abdcab2ff240de0",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 104,
"avg_line_length": 31.454545454545453,
"alnum_prop": 0.5982658959537572,
"repo_name": "bozzzzo/quark",
"id": "be71f08459317c874a955356ce0f4c573eb85398",
"size": "346",... |
"""DSA public-key signature algorithm."""
__revision__ = "$Id$"
__all__ = ['generate', 'construct', 'error']
from Crypto.Util.python_compat import *
from Crypto.PublicKey import _DSA, _slowmath, pubkey
from Crypto import Random
try:
from Crypto.PublicKey import _fastmath
except ImportError:
_fastmath = Non... | {
"content_hash": "c8af80a788be9bbeca6b8365872b41d3",
"timestamp": "",
"source": "github",
"line_count": 165,
"max_line_length": 116,
"avg_line_length": 32.157575757575756,
"alnum_prop": 0.5740670938560121,
"repo_name": "cipicip/appengine",
"id": "6349cef8cccbc2ab45a51a8ac981317dd86318e4",
"size": "... |
from django.conf.urls import patterns, include, url
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
# Examples:
# url(r'^$', 'project.views.home', name='home'),
# url(r'^blog/', include('blog.urls')),
url(r'^admin/', include(admin.site.urls)),
url(r'^', include('l... | {
"content_hash": "5ec0471058ac0623230dae101ea01c65",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 52,
"avg_line_length": 26.076923076923077,
"alnum_prop": 0.640117994100295,
"repo_name": "aliva/lamenews",
"id": "5bfea91be4443cb314515482985c547fbeec127d",
"size": "339",
... |
__author__ = 'Tom Schaul, tom@idsia.ch'
from pybrain.utilities import abstractMethod
from evolvable import Evolvable
from pybrain.structure.parametercontainer import ParameterContainer
class TopologyEvolvable(ParameterContainer):
""" An evolvable object, with higher-level mutations,
that change the topology... | {
"content_hash": "f4b75f0dde2ac6b312dda3c9209c7104",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 67,
"avg_line_length": 29.13953488372093,
"alnum_prop": 0.6384676775738228,
"repo_name": "rbalda/neural_ocr",
"id": "9b93ecb800a461bd83df4a5e2860f01821bc0d4c",
"size": "125... |
"""party_affiliation table
Revision ID: 443b3b630b0f
Revises: df3415c2347
Create Date: 2014-05-31 02:22:34.753596
"""
# revision identifiers, used by Alembic.
revision = '443b3b630b0f'
down_revision = 'df3415c2347'
from alembic import op
import sqlalchemy as sa
def upgrade():
op.create_table('party_affiliatio... | {
"content_hash": "9d87f7704602f05fc7a408a0c5bd344c",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 109,
"avg_line_length": 36.24324324324324,
"alnum_prop": 0.6935123042505593,
"repo_name": "teampopong/pokr.kr",
"id": "bb7c4e149ab47cc42140037433e89acac5abc03e",
"size": "1... |
"""SCons.Tool
SCons tool selection.
This looks for modules that define a callable object that can modify
a construction environment as appropriate for a given tool (or tool
chain).
Note that because this subsystem just *selects* a callable that can
modify a construction environment, it's possible for people to defin... | {
"content_hash": "ce48db3e62774e650d6075fcbcce5661",
"timestamp": "",
"source": "github",
"line_count": 681,
"max_line_length": 107,
"avg_line_length": 39.42290748898679,
"alnum_prop": 0.5331321935411778,
"repo_name": "angad/libjingle-mac",
"id": "5bee64dd9a5346c0a534aefa21e7c78630aff130",
"size": ... |
from . import ir_report
| {
"content_hash": "308338efd503580dd5377fa4e212f2d4",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 23,
"avg_line_length": 24,
"alnum_prop": 0.75,
"repo_name": "vileopratama/vitech",
"id": "521aa82b53c9240d1d25080498ac87e2a297dabf",
"size": "170",
"binary": false,
"cop... |
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
@python_2_unicode_compatible
class TestCss(models.Model):
title = models.CharField(max_length=255)
css = models.TextField()
def __str__(self):
return self.title
@python_2_unicode_compatible
class TestHTML... | {
"content_hash": "19a23b36abe701eada8b42badc3598a9",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 61,
"avg_line_length": 23.05,
"alnum_prop": 0.7006507592190889,
"repo_name": "sk1p/django-codemirror2",
"id": "e693b6668102bdbbb5a49c640fdf5fab9bd34dea",
"size": "461",
"... |
"""The Python 2 and 3 compatible type definitions."""
import sys
# pylint: disable=invalid-name,undefined-variable
if sys.version_info[0] < 3:
BYTES_TYPE = str
INTEGER_TYPES = (int, long)
STRING_TYPES = (basestring, )
UNICODE_TYPE = unicode
else:
BYTES_TYPE = bytes
INTEGER_TYPES = (int, )
STRING_TYPES... | {
"content_hash": "b5286bacd8e70e7e0ac51d061b134853",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 53,
"avg_line_length": 20.705882352941178,
"alnum_prop": 0.6761363636363636,
"repo_name": "rgayon/l2tdevtools",
"id": "87fbeefe0edad6af13c07c736bcb1117a47c0757",
"size": "3... |
__author__ = 'buec'
from abc import ABCMeta
from abc import abstractmethod
class BaseParser(metaclass=ABCMeta):
@abstractmethod
def parse_string(self, data):
pass
def parse_from_file(self, file_path):
f = open(file_path, 'r')
content = f.read()
f.close()
return ... | {
"content_hash": "00b8d4421d2c683cb08842fd79c96a72",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 46,
"avg_line_length": 20.59259259259259,
"alnum_prop": 0.6007194244604317,
"repo_name": "ynop/pyspeechgrammar",
"id": "45a05e2923db7fd8eb2f790312668efd2102a5ee",
"size": "... |
import json
from flask import session, Blueprint, jsonify
from lexos.helpers import constants as constants
from lexos.managers import session_manager as session_manager
from lexos.models.statistics_model import StatsModel
from lexos.views.base import render
statistics_blueprint = Blueprint("statistics", __name__)
@s... | {
"content_hash": "24815b7fe368099cbdc0cefee23af852",
"timestamp": "",
"source": "github",
"line_count": 69,
"max_line_length": 73,
"avg_line_length": 31.434782608695652,
"alnum_prop": 0.6892577224527432,
"repo_name": "WheatonCS/Lexos",
"id": "dcd33b3028b427d0e57455e868e74d814b146bef",
"size": "2169... |
import scrapy
class TemplateprojectItem(scrapy.Item):
# define the fields for your item here like:
# name = scrapy.Field()
pass
| {
"content_hash": "b6b5e32fc8394e559889de3e8c217ac6",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 48,
"avg_line_length": 20.285714285714285,
"alnum_prop": 0.6971830985915493,
"repo_name": "Ertinfagor/ScrapySplash",
"id": "d6168d8d84acf0def3286a8187637e3ac9b3e4ce",
"size"... |
from __future__ import unicode_literals
import unittest
from django.conf.urls import url
from django.db import connection, connections, transaction
from django.http import Http404
from django.test import TestCase, TransactionTestCase, override_settings
from django.utils.decorators import method_decorator
from rest_f... | {
"content_hash": "9f24c25861765134223fb87756cabe9a",
"timestamp": "",
"source": "github",
"line_count": 153,
"max_line_length": 81,
"avg_line_length": 32.73856209150327,
"alnum_prop": 0.6813735276502296,
"repo_name": "kgeorgy/django-rest-framework",
"id": "697c549dea0aadab3d7416ff59b07d4a2b84d661",
... |
import json
import os
# Experiment settings
class XPParams:
debug = False
realExper = False
useCrossValidation = False
currentIteration = 0
baseline = False
useAutoGeneratedPOS = True
useAutoGeneratedDEP = True
useUniversalPOSTag = True
# Corpus and configuration paths
class Paths:
... | {
"content_hash": "a413dd8d4570e782e5d8dbd9e0973749",
"timestamp": "",
"source": "github",
"line_count": 99,
"max_line_length": 98,
"avg_line_length": 32.898989898989896,
"alnum_prop": 0.6622658888547743,
"repo_name": "hazemalsaied/IdenSys",
"id": "d87434510a6f620002dcc860b27da58d0107ddb8",
"size": ... |
from __future__ import with_statement
# Python 2.5 doesn't have the json module.
try:
import json
except ImportError:
import simplejson as json
import msparser
import os
import os.path
import sys
# Use unittest2 on versions older than Python 2.7.
if sys.version_info[0] < 3 and sys.version_info[1] < 7:
fr... | {
"content_hash": "bae6a0db2fa159389570c66d5f8f2cdd",
"timestamp": "",
"source": "github",
"line_count": 281,
"max_line_length": 76,
"avg_line_length": 32.67259786476868,
"alnum_prop": 0.5520095850125258,
"repo_name": "wdv4758h/msparser",
"id": "0496b27313e59c212bbcb29f7d5d0e820bf6761e",
"size": "93... |
import logging
import subprocess
import sys
import workflow
import pepper
import pepper.cli
logger = logging.getLogger(__name__)
def run_alfred(query):
"""Call Alfred with ``query``"""
subprocess.call([
'osascript', '-e',
'tell application "Alfred 2" to search "{}"'.format(query)])
def red... | {
"content_hash": "c33ca535b14f334c40cb3f28ab1e58b2",
"timestamp": "",
"source": "github",
"line_count": 64,
"max_line_length": 88,
"avg_line_length": 24.4375,
"alnum_prop": 0.559462915601023,
"repo_name": "kfdm/alfred-salt",
"id": "6e564a8d84d3bceec66f3407ba586a8cb915eac1",
"size": "1564",
"binar... |
"""Module with main classes related to Connections."""
import logging
from enum import Enum
from errno import EBADF, ENOTCONN
from socket import error as SocketError
from socket import SHUT_RDWR
__all__ = ('Connection', 'ConnectionProtocol', 'ConnectionState')
LOG = logging.getLogger(__name__)
class ConnectionState... | {
"content_hash": "d67438eef580e7c9201ab3dab8cee585",
"timestamp": "",
"source": "github",
"line_count": 149,
"max_line_length": 79,
"avg_line_length": 31.71812080536913,
"alnum_prop": 0.6100296233601354,
"repo_name": "macartur/kytos",
"id": "b05629290d24eaf65a61c42587f1f9b0be1b480b",
"size": "4726"... |
import numpy as np
from scipy import sparse
from ..base import BaseEstimator, TransformerMixin
from ..utils import check_array
from ..utils.validation import check_is_fitted
from ..utils.validation import _deprecate_positional_args
from ..utils._encode import _encode, _check_unknown, _unique
__all__ = [
'OneHot... | {
"content_hash": "c11f4de96ce2711d47e13dae2b4b4f63",
"timestamp": "",
"source": "github",
"line_count": 732,
"max_line_length": 79,
"avg_line_length": 37.8551912568306,
"alnum_prop": 0.5576326236015878,
"repo_name": "bnaul/scikit-learn",
"id": "d8df3b33117837584878360530b20885f1883e69",
"size": "27... |
"""Config flow to configure the PVOutput integration."""
from __future__ import annotations
from collections.abc import Mapping
from typing import Any
from pvo import PVOutput, PVOutputAuthenticationError, PVOutputError
import voluptuous as vol
from homeassistant.config_entries import ConfigEntry, ConfigFlow
from ho... | {
"content_hash": "2a985a860c81205e60d3e24a4b035a69",
"timestamp": "",
"source": "github",
"line_count": 131,
"max_line_length": 87,
"avg_line_length": 35.954198473282446,
"alnum_prop": 0.5441613588110403,
"repo_name": "toddeye/home-assistant",
"id": "25cc68acc240f712d331004cbd53f606de4cc34d",
"size... |
"""Rename admin role.
Revision ID: 3adc42b4f6b9
Revises: 10adeac7b693
Create Date: 2013-10-10 22:13:16.470076
"""
# revision identifiers, used by Alembic.
revision = '3adc42b4f6b9'
down_revision = '10adeac7b693'
import json
import sqlalchemy as sa
from alembic import op
from datetime import datetime
from sqlalchemy... | {
"content_hash": "ae2f50910ceb81cd0fa615ebce05ad9e",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 59,
"avg_line_length": 23.575757575757574,
"alnum_prop": 0.6928020565552699,
"repo_name": "hasanalom/ggrc-core",
"id": "109f8d45c9c02369c2fc3d3a4f6756e27fe676f7",
"size": "... |
from django.core.exceptions import AppRegistryNotReady
# IMPORTANT: the following code needs to be here so we can import
# our models without having to call django.setup() in every single
# file that tries to imports them
try:
from django.apps import apps
apps.check_apps_ready()
except AppRegistryNotReady:
... | {
"content_hash": "5ac5c44ddf72c241a51b9bf3e23b59c8",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 66,
"avg_line_length": 32.18181818181818,
"alnum_prop": 0.7655367231638418,
"repo_name": "OnRampOrg/onramp",
"id": "9d68a4a3ea54cda6e8b566896f5188a81dba9096",
"size": "354"... |
import unittest
import mock
from flashcards import storage
from flashcards.utils import storage as storageUtils
from flashcards.storage import StudySetStorage
from flashcards.sets import StudySet
from flashcards.cards import StudyCard
class TestStorageModule(unittest.TestCase):
@mock.patch('flashcards.storage.o... | {
"content_hash": "ba8df0e2a046b14ad19a25c8fd77c5de",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 80,
"avg_line_length": 35.44827586206897,
"alnum_prop": 0.7023346303501945,
"repo_name": "zergov/flashcards",
"id": "00c5f3db5cf3479c2e98761eeff6f53f70d94913",
"size": "205... |
""" Execution engine """
from builtins import int
import gzip
import os
import time
import botocore
import csv
import json
import pickle
import logging
from base64 import b64encode
from botocore.exceptions import ClientError
from decimal import Decimal
from dynamo3 import (TYPES, DynamoDBConnection, DynamoKey, LocalI... | {
"content_hash": "852996f73e4c3362c59c38740934f950",
"timestamp": "",
"source": "github",
"line_count": 989,
"max_line_length": 85,
"avg_line_length": 38.48432760364004,
"alnum_prop": 0.5267596752581383,
"repo_name": "mathcamp/dql",
"id": "df9074cb2eb47a1c50dc5ea49981c9817d727e43",
"size": "38061",... |
"""
This code demonstrates how to use dedupe with a comma separated values
(CSV) file. All operations are performed in memory, so will run very
quickly on datasets up to ~10,000 rows.
We start with a CSV file containing our messy data. In this example,
it is listings of early childhood education centers in Chicago
com... | {
"content_hash": "4810cd709b6ed58212b618ae41900935",
"timestamp": "",
"source": "github",
"line_count": 217,
"max_line_length": 87,
"avg_line_length": 30.857142857142858,
"alnum_prop": 0.6474014336917563,
"repo_name": "davebshow/ten_million_books",
"id": "f6e30d946673cd64bc97c11875029f30df05197b",
... |
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [("site", "0019_sitesettings_default_weight_unit")]
operations = [
migrations.AlterModelOptions(
name="sitesettings",
options={
"permissions": (
("manage... | {
"content_hash": "0336ccad4ffcf56b471ae4775d7fa58f",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 70,
"avg_line_length": 26.166666666666668,
"alnum_prop": 0.5201698513800425,
"repo_name": "mociepka/saleor",
"id": "7f7abb200e0c70c7564e0c9302a14133fbfe3f69",
"size": "520"... |
import pytest
from plenum.test.helper import sdk_send_random_requests
from stp_core.loop.eventually import eventually
from plenum.common.messages.node_messages import Commit
from plenum.test.delayers import delay
from plenum.test.propagate.helper import recvdRequest, recvdPropagate, \
sentPropagate, recvdPrepareFo... | {
"content_hash": "e54762a5317ba687502292e0803aaadc",
"timestamp": "",
"source": "github",
"line_count": 107,
"max_line_length": 90,
"avg_line_length": 40.532710280373834,
"alnum_prop": 0.7242333410191376,
"repo_name": "evernym/zeno",
"id": "36046866d2ec007bbf3ab09b7aabc09cf8580ad7",
"size": "4337",... |
"""Script for testing ganeti.tools.ssl_update"""
import unittest
import shutil
import tempfile
import os.path
import OpenSSL
import time
from ganeti import constants
from ganeti import errors
from ganeti import serializer
from ganeti import utils
from ganeti.tools import common
import testutils
class TestGenerateC... | {
"content_hash": "7ffbf55d7bcf56fb6158c4781a79e42c",
"timestamp": "",
"source": "github",
"line_count": 186,
"max_line_length": 80,
"avg_line_length": 33.08064516129032,
"alnum_prop": 0.6567528035104827,
"repo_name": "onponomarev/ganeti",
"id": "0eb7e451bf311f7e11bf332b90cac21d88a06188",
"size": "7... |
r"""Saves out a GraphDef containing the architecture of the model.
To use it, run something like this, with a model name defined by slim:
bazel build tensorflow_models/slim:export_inference_graph
bazel-bin/tensorflow_models/slim/export_inference_graph \
--model_name=inception_v3 --output_file=/tmp/inception_v3_inf_gr... | {
"content_hash": "8e782de0ea901546b3d6e21285218c5e",
"timestamp": "",
"source": "github",
"line_count": 103,
"max_line_length": 79,
"avg_line_length": 36.18446601941748,
"alnum_prop": 0.7182720686879528,
"repo_name": "erko/nips17-attack",
"id": "da42fb9609bf1cd9cb73ebd0e16fde63c9aa36c6",
"size": "4... |
import pygame
from pygame.sprite import Sprite
class Alien(Sprite):
def __init__(self, ai_settings, screen):
super(Alien, self).__init__()
self.screen = screen
self.ai_settings = ai_settings
self.image = pygame.image.load('images/alien.bmp')
self.rect = self.image.get_... | {
"content_hash": "cb1be60c94ced5f20061c5c0f457279a",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 93,
"avg_line_length": 25.823529411764707,
"alnum_prop": 0.6002277904328018,
"repo_name": "waiilaiiz/python_practice",
"id": "b31a234cf49b43e6f8df3621e6995f02c407e61a",
"si... |
from thrift.Thrift import TType, TMessageType, TException
from thrift.transport import TTransport
from thrift.protocol import TBinaryProtocol, TProtocol
try:
from thrift.protocol import fastbinary
except:
fastbinary = None
| {
"content_hash": "5fa051afa6dc33a22f1d1f4d4b7f5d36",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 57,
"avg_line_length": 23,
"alnum_prop": 0.8217391304347826,
"repo_name": "jacksonicson/paper.IS2015",
"id": "596ed8f04dcc11b04887daaec5b29dce00b70cd3",
"size": "379",
"b... |
"""Generic presubmit checks that can be reused by other presubmit checks."""
import os as _os
_HERE = _os.path.dirname(_os.path.abspath(__file__))
### Description checks
def CheckChangeHasTestField(input_api, output_api):
"""Requires that the changelist have a TEST= field."""
if input_api.change.TEST:
retur... | {
"content_hash": "b317a1a5d057b6b038a845f879a4000c",
"timestamp": "",
"source": "github",
"line_count": 1111,
"max_line_length": 80,
"avg_line_length": 37.0963096309631,
"alnum_prop": 0.6654534866792837,
"repo_name": "michalliu/chromium-depot_tools",
"id": "05b045de61fc5b22668322d61265db3d0c04020a",
... |
"""Tests for Vanderbilt SPC binary sensor platform."""
import asyncio
import pytest
from homeassistant.components.spc import SpcRegistry
from homeassistant.components.binary_sensor import spc
from tests.common import async_test_home_assistant
@pytest.fixture
def hass(loop):
"""Home Assistant fixture with device... | {
"content_hash": "afb654d585e8da8eb85ede7333c25f7a",
"timestamp": "",
"source": "github",
"line_count": 67,
"max_line_length": 71,
"avg_line_length": 29.16417910447761,
"alnum_prop": 0.5522006141248721,
"repo_name": "stefan-jonasson/home-assistant",
"id": "5004ccd321049a88dd66f9b173aee3f5c462727b",
... |
DEPS = [
'checkout',
'docker',
'env',
'infra',
'recipe_engine/file',
'recipe_engine/path',
'recipe_engine/properties',
'recipe_engine/python',
'recipe_engine/step',
'run',
'vars',
]
DOCKER_IMAGE = 'gcr.io/skia-public/gold-karma-chrome-tests:77.0.3865.120_v2'
INNER_KARMA_SCRIPT = 'skia/infra/canv... | {
"content_hash": "2a346f42dd383bc7c4d26d9bac14790e",
"timestamp": "",
"source": "github",
"line_count": 93,
"max_line_length": 79,
"avg_line_length": 33.924731182795696,
"alnum_prop": 0.5534072900158479,
"repo_name": "HalCanary/skia-hc",
"id": "956e8967e05c82fff53d1c6a727beafed216554c",
"size": "33... |
from __future__ import unicode_literals
import types
from django import forms
from patt3rns.forms import widgets as patt3rns_widgets
class CharField(forms.CharField):
def clean(self, value):
if isinstance(value, types.StringTypes):
value = value.strip()
value = super(CharField, self... | {
"content_hash": "9d8f9774166c24cf567fed84f0ec1962",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 57,
"avg_line_length": 23.806451612903224,
"alnum_prop": 0.7018970189701897,
"repo_name": "fredpalmer/patt3rns",
"id": "d0581bd5a7c65d19eae976ee09446f157f739403",
"size": "... |
"""A more or less complete user-defined wrapper around dictionary objects."""
class UserDict:
def __init__(self, dict=None, **kwargs):
self.data = {}
if dict is not None:
if not hasattr(dict,'keys'):
dict = type({})(dict) # make mapping from a sequence
self... | {
"content_hash": "0b52c8d7cdbfb5c9ef03a3c7464a4375",
"timestamp": "",
"source": "github",
"line_count": 164,
"max_line_length": 77,
"avg_line_length": 33.207317073170735,
"alnum_prop": 0.5552699228791774,
"repo_name": "OS2World/APP-INTERNET-torpak_2",
"id": "35f86fc4dc1076ad0eeeb862e44d290552657297",... |
"""
pytime
~~~~~~~~~~~~~
A easy-use module to solve the datetime needs by string.
:copyright: (c) 2015 by Sinux <nsinux@gmail.com>
:license: MIT, see LICENSE for more details.
"""
import calendar
import datetime
from .filter import BaseParser
bp = BaseParser.main
dp = BaseParser.parse_diff
de... | {
"content_hash": "ae77dac8cc0be09219dfa37c13b30dc3",
"timestamp": "",
"source": "github",
"line_count": 328,
"max_line_length": 108,
"avg_line_length": 28.841463414634145,
"alnum_prop": 0.6039112050739958,
"repo_name": "shinux/PyTime",
"id": "b892833dd0ff5f1509bbe2cc769c0379c228893f",
"size": "9501... |
"""
eve.auth
~~~~~~~~
Allow API endpoints to be secured via BasicAuth and derivates.
:copyright: (c) 2015 by Nicola Iarocci.
:license: BSD, see LICENSE for more details.
"""
from flask import request, Response, current_app as app, g, abort
from functools import wraps
def requires_auth(endpoint_c... | {
"content_hash": "4687284461745594269aff24a539b9bf",
"timestamp": "",
"source": "github",
"line_count": 264,
"max_line_length": 79,
"avg_line_length": 38.428030303030305,
"alnum_prop": 0.601675702316412,
"repo_name": "superdesk/eve",
"id": "0172b0a839098c7e720de067890681c3b739ecfd",
"size": "10170"... |
from keras.models import Sequential
from keras.layers import Dense, Dropout, Convolution1D, MaxPooling1D, Flatten, Embedding
from keras.optimizers import SGD
WEIGHTS_FOLDER_FORMAT = 'data/weights/{}_weights.h5'
class BaseNet:
NAME = 'NoneNet'
def __init__(self, train=False, **kwargs):
self.model =... | {
"content_hash": "928488bf869d1449623984367cca6136",
"timestamp": "",
"source": "github",
"line_count": 184,
"max_line_length": 91,
"avg_line_length": 30.195652173913043,
"alnum_prop": 0.580093592512599,
"repo_name": "NTHU-CVLab/ActivityProps",
"id": "096f24234bb6b7e6e014c5e45543055122256146",
"siz... |
from .sync import SyncWorker
from .commit_queue import CommitQueue
from .fetch import FetchWorker
| {
"content_hash": "6dfb36bb01139f609bc7205239096ad1",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 37,
"avg_line_length": 32.666666666666664,
"alnum_prop": 0.8367346938775511,
"repo_name": "ksmaheshkumar/gitfs",
"id": "3601eec6e7a83693932e493dd4293979ba57d84c",
"size": "6... |
from setuptools import setup, find_packages
packages = [
'cullerton.agora',
]
requires = [
'sqlalchemy',
]
setup(
name='cullerton.agora',
version="0.0.2",
packages=find_packages(),
namespace_packages=['cullerton'],
install_requires=requires,
author='mike cullerton',
author_email='... | {
"content_hash": "810f58345653a4fe77a86f950d28da2f",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 78,
"avg_line_length": 24.838709677419356,
"alnum_prop": 0.6311688311688312,
"repo_name": "cullerton/cullerton.agora",
"id": "9b3465f636d8273511035d8030e5acb1344a5178",
"si... |
import datetime
from typing import Dict, List, Optional, TYPE_CHECKING, Union
from ... import _serialization
if TYPE_CHECKING:
# pylint: disable=unused-import,ungrouped-imports
from .. import models as _models
class CloudToDeviceProperties(_serialization.Model):
"""The IoT hub cloud-to-device messaging ... | {
"content_hash": "00d22b7d26e815435c2e2f80335c77cb",
"timestamp": "",
"source": "github",
"line_count": 1752,
"max_line_length": 283,
"avg_line_length": 43.43550228310502,
"alnum_prop": 0.6537799445459205,
"repo_name": "Azure/azure-sdk-for-python",
"id": "1992b2788ec3ce9182032fdc7de3d668e2863c66",
... |
from django import forms
class ImageUploadForm(forms.Form):
"""Image upload form."""
image = forms.ImageField()
nombre = forms.CharField()
| {
"content_hash": "1978708fed84c20cd1637db8a484fa90",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 34,
"avg_line_length": 21.857142857142858,
"alnum_prop": 0.6862745098039216,
"repo_name": "roviol/recog",
"id": "b05952e4971a9a382937cbaac4e3a322d18add00",
"size": "153",
... |
from plotly.basedatatypes import BaseTraceHierarchyType as _BaseTraceHierarchyType
import copy as _copy
class ColorBar(_BaseTraceHierarchyType):
# class properties
# --------------------
_parent_path_str = "isosurface"
_path_str = "isosurface.colorbar"
_valid_props = {
"bgcolor",
... | {
"content_hash": "0a32bec82a6f7b277ae44c841bb03b02",
"timestamp": "",
"source": "github",
"line_count": 1940,
"max_line_length": 96,
"avg_line_length": 35.81958762886598,
"alnum_prop": 0.5536623974672614,
"repo_name": "plotly/python-api",
"id": "c7dd67ba652d30c42f7c74ae915651b281bed84e",
"size": "6... |
<<<<<<< HEAD
<<<<<<< HEAD
"""Shared OS X support functions."""
import os
import re
import sys
__all__ = [
'compiler_fixup',
'customize_config_vars',
'customize_compiler',
'get_platform_osx',
]
# configuration variables that may contain universal build flags,
# like "-arch" or "-isdkroot", that may ne... | {
"content_hash": "070d6f23517515628f9f814e33642146",
"timestamp": "",
"source": "github",
"line_count": 1512,
"max_line_length": 80,
"avg_line_length": 37.991402116402114,
"alnum_prop": 0.6125724631373709,
"repo_name": "ArcherSys/ArcherSys",
"id": "5ede43327f0661c4d381941737dd1b42f372e2b3",
"size":... |
__all__ = ('SrdpToolRunner',)
import sys, os, uuid, json, pkg_resources, argparse
from twisted.python import log
from twisted.internet.serialport import SerialPort
from _version import __version__
from srdp import SrdpStreamProtocol, SrdpDatagramProtocol
from eds import SrdpEdsDatabase
from srdptoolprovider imp... | {
"content_hash": "8ebc05f1519935d87657374fcea9e404",
"timestamp": "",
"source": "github",
"line_count": 295,
"max_line_length": 130,
"avg_line_length": 31.728813559322035,
"alnum_prop": 0.496474358974359,
"repo_name": "oberstet/SRDP",
"id": "92111365abd331ce83e8c91ccc8790e2c243a55f",
"size": "10126... |
from django.db import models
import datetime
class User(models.Model):
username = models.CharField(max_length=50)
password = models.CharField(max_length=200)
nickname = models.CharField(max_length=10)
email = models.EmailField()
phone = models.CharField(max_length=20)
create_time = models.Date... | {
"content_hash": "90e782f6dc752960786cffd7af3a7930",
"timestamp": "",
"source": "github",
"line_count": 75,
"max_line_length": 71,
"avg_line_length": 27.2,
"alnum_prop": 0.6901960784313725,
"repo_name": "GavinZhuLei/GavinsDjango",
"id": "e9e0b9d58357cae021407896d35af6643e7a008d",
"size": "2086",
... |
from __future__ import unicode_literals
import django.contrib.postgres.fields.jsonb
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('action', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='PageConversation',
... | {
"content_hash": "92811e3fcdc210e03147cac06bf3903d",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 114,
"avg_line_length": 36.064516129032256,
"alnum_prop": 0.5858676207513417,
"repo_name": "bhanduroshan/fbstats-docker",
"id": "f31dc0019b4ab86fa0ad18f4338f52b43a65d7d5",
... |
"""Tests for data_provider."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
from absl import flags
import numpy as np
import tensorflow.compat.v1 as tf
from tensorflow_gan.examples.cyclegan import data_provider
mock = tf.test.mock
class D... | {
"content_hash": "c9f866e23b2d945bf9d0e4458e450b55",
"timestamp": "",
"source": "github",
"line_count": 120,
"max_line_length": 80,
"avg_line_length": 37.55833333333333,
"alnum_prop": 0.664299977812292,
"repo_name": "tensorflow/gan",
"id": "0174cda8e31a8b38c06f0f5d6a6184c71bd34404",
"size": "5114",... |
import os
import sys
from pprint import pprint
root = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
sys.path.append(root + '/python')
import ccxt # noqa: E402
print('CCXT Version:', ccxt.__version__)
# Must read before your start:
#
# - https://github.com/ccxt/ccxt/wiki/Manual
# ... | {
"content_hash": "ca66e08e2f435a655ec8d45ab23aa066",
"timestamp": "",
"source": "github",
"line_count": 193,
"max_line_length": 93,
"avg_line_length": 36.031088082901555,
"alnum_prop": 0.6151855047454702,
"repo_name": "ccxt/ccxt",
"id": "4957822be46ae194367ed38e9fbeb3a4e0ece542",
"size": "6990",
... |
"""
This module imitates a real module, providing standard syntax
like from `plumbum.colors` and from `plumbum.colors.bg` to work alongside
all the standard syntax for colors.
"""
import atexit
import sys
from plumbum.colorlib import ansicolors, main
_reset = ansicolors.reset.now
if __name__ == "__main__":
main... | {
"content_hash": "371fc7499a98bf42c734a4fd26509abf",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 73,
"avg_line_length": 27,
"alnum_prop": 0.7001763668430335,
"repo_name": "tomerfiliba/plumbum",
"id": "07ec3f033add35d88ed2f2d77121e8c96af2f613",
"size": "567",
"binary"... |
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('sites', '0001_initial'),
('display', '0002_auto_20150505_0038'),
]
operations = [
migrations.AddField(
model_name='template',
... | {
"content_hash": "6e86662c4d1a17432d68c4582ba350b7",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 58,
"avg_line_length": 22.105263157894736,
"alnum_prop": 0.580952380952381,
"repo_name": "liddiard/skry",
"id": "6ebb875fb7f6b3b0c2846dca86d70563b06c23c1",
"size": "444",
... |
"""Generates a sysroot tarball for building a specific package.
Meant for use after setup_board and build_packages have been run.
"""
import os
from chromite.buildbot import constants
from chromite.lib import cros_build_lib
from chromite.lib import commandline
from chromite.lib import osutils
from chromite.lib impor... | {
"content_hash": "76d3b66ea62dbec6ed9c17ceca79c224",
"timestamp": "",
"source": "github",
"line_count": 107,
"max_line_length": 79,
"avg_line_length": 32.953271028037385,
"alnum_prop": 0.6695972773681225,
"repo_name": "windyuuy/opera",
"id": "9a38c48f82ec7954f82e6bfb9c0466babdbffd32",
"size": "3714... |
import unittest
import numpy as np
import math
from op_test import OpTest
def quantize_max_abs(x, num_bits):
range = math.pow(2, num_bits) - 1
scale = np.max(np.abs(x).flatten())
y = np.round(x / scale * range)
return y, scale
def dequantize_max_abs(x, num_bits, scale):
range = math.pow(2, num_b... | {
"content_hash": "e1fbad22f3c11bf9459155553e770198",
"timestamp": "",
"source": "github",
"line_count": 46,
"max_line_length": 71,
"avg_line_length": 24.08695652173913,
"alnum_prop": 0.5992779783393501,
"repo_name": "Canpio/Paddle",
"id": "281068e945e76a42635868d19573498f79fde1f3",
"size": "1721",
... |
"""
Kubernetes
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501
The version of the OpenAPI document: release-1.25
Generated by: https://openapi-generator.tech
"""
import pprint
import re # noqa: F401
import six
from kubernete... | {
"content_hash": "07d516c64cc878addd161f97c87d9787",
"timestamp": "",
"source": "github",
"line_count": 392,
"max_line_length": 435,
"avg_line_length": 41.67602040816327,
"alnum_prop": 0.6594233947481177,
"repo_name": "kubernetes-client/python",
"id": "161787ca4eb99fd814dce1527c45ede3dcb43b33",
"si... |
import unittest
class TestLogSettingUser(unittest.TestCase):
pass
| {
"content_hash": "6a82c9e30dcbadf26ebb65110d7944ff",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 44,
"avg_line_length": 17,
"alnum_prop": 0.8382352941176471,
"repo_name": "mhbu50/frappe",
"id": "45f7b61158757ad36359064fed086c8a19f48457",
"size": "195",
"binary": false... |
import os
import mimetypes
from hashlib import md5
from django.db import models
from instance import Instance
def upload_to(instance, filename):
return os.path.join(
instance.instance.xform.user.username,
'attachments',
os.path.split(filename)[1])
def hash_attachment_contents(contents):... | {
"content_hash": "e6212ae59695ef1228ab0a491f94ba94",
"timestamp": "",
"source": "github",
"line_count": 54,
"max_line_length": 75,
"avg_line_length": 28.24074074074074,
"alnum_prop": 0.640655737704918,
"repo_name": "awemulya/fieldsight-kobocat",
"id": "021170f7081a861cdfdba52f1f7372a221262eba",
"si... |
"""Implements authentication based on signed GCE VM metadata tokens.
See https://cloud.google.com/compute/docs/instances/verifying-instance-identity.
JWTs with signed metadata are read from X-Luci-Gce-Vm-Token header. The 'aud'
field in the tokens is expected to be https://(.*-dot-)?<app-id>.appspot.com.
On successf... | {
"content_hash": "91db0a10141fec95d8c7064a4e7207a3",
"timestamp": "",
"source": "github",
"line_count": 162,
"max_line_length": 80,
"avg_line_length": 32.22222222222222,
"alnum_prop": 0.6842911877394636,
"repo_name": "luci/luci-py",
"id": "41559ea75c4951226927f04295e8cc68d6073888",
"size": "5394",
... |
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('public_interface', '0005_auto_20210313_1919'),
]
operations = [
migrations.AddField(
model_name='vouchers',
name='flickr_photo_url',
field=models.TextFie... | {
"content_hash": "49f29518cda000978efed683af57ad22",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 58,
"avg_line_length": 22.75,
"alnum_prop": 0.5879120879120879,
"repo_name": "carlosp420/VoSeq",
"id": "f7546fbbf299d0441584fb1dfc1bb398dea73733",
"size": "414",
"binary"... |
import uuid
from django.db import models
from django.contrib.auth.models import User
from django.utils.translation import ugettext_lazy as _
from codenode.frontend.notebook.models import Notebook
class Folder(models.Model):
guid = models.CharField(max_length=32, unique=True, editable=False) #needs to be globally ... | {
"content_hash": "a5150fe72c19d9a6f398213051ed4fe9",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 107,
"avg_line_length": 35.733333333333334,
"alnum_prop": 0.6567164179104478,
"repo_name": "regmi/codenode-unr",
"id": "08d720e46d47a56833a0a0a06e1002340b482927",
"size": "... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.