text stringlengths 4 1.02M | meta dict |
|---|---|
"""Experimenter base class for problem statement and evaluation.
Experimenters represent black-box optimization problems and/or users.
Each experimenter defines a ProblemStatement, representing the search space and
the metrics it returns in Evaluate (via CompletedTrials).
Pseudo-code for using Experimenters with Vizi... | {
"content_hash": "fc6383bbc3c0d67d5c26586dc63a2583",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 79,
"avg_line_length": 32.666666666666664,
"alnum_prop": 0.7667638483965015,
"repo_name": "google/vizier",
"id": "d75ffcec73751da877e353bb2c7d42d5c6a42406",
"size": "1948",... |
"""Mocking utilities for testing"""
import json
import os
import re
import uuid
from io import BytesIO
from unittest.mock import Mock
from urllib.parse import parse_qs, urlparse
import pytest
from tornado import web
from tornado.httpclient import HTTPResponse
from tornado.httputil import HTTPServerRequest
from tornado... | {
"content_hash": "1c1c6ec91190c9593c421a7a26c05446",
"timestamp": "",
"source": "github",
"line_count": 276,
"max_line_length": 91,
"avg_line_length": 32.13405797101449,
"alnum_prop": 0.5569962791746533,
"repo_name": "jupyterhub/oauthenticator",
"id": "c272329905193f6c05a46de7739ef74342779c01",
"si... |
class ScrapeShawBrosPipeline(object):
def process_item(self, item, spider):
return item
| {
"content_hash": "27e6d30480b7f9b3dc81f9b5e5db7b67",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 41,
"avg_line_length": 33.333333333333336,
"alnum_prop": 0.71,
"repo_name": "vlandham/shaw_bros",
"id": "b559415567e302c18b276fa33227b2e0569ad476",
"size": "294",
"binary"... |
import urllib.request
import urllib.parse
import io
from lxml import etree
MANIADB_ROOT_URL = 'http://www.maniadb.com/api/'
MANIADB_SEARCH_URL = 'search/' #검색 asp 파일 정보. example: http://www.maniadb.com/api/search/metallica/?sr=artist&display=10&key=example&v=0.5
MANIADB_ALBUM_URL = 'album/' # example: http://www.mania... | {
"content_hash": "a0fcda0a85038373938dca3a7e2f8be3",
"timestamp": "",
"source": "github",
"line_count": 80,
"max_line_length": 139,
"avg_line_length": 33.75,
"alnum_prop": 0.7066666666666667,
"repo_name": "Pusungwi/pymaniadb",
"id": "7832d3a0d8db6010f12c9abf096ff8ce41a8b7d4",
"size": "2840",
"bin... |
import os
import sys
import subprocess
import argparse
from arnold import main
from flask.ext.script import Manager, Shell, Server
from contracts_api.app import create_app
from contracts_api.settings import DevConfig, ProdConfig
from contracts_api.database import db
if os.environ.get("CONTRACTS_API_ENV") == 'prod':
... | {
"content_hash": "efc904159e64bba3a49ffe76f7c6385c",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 72,
"avg_line_length": 24.381818181818183,
"alnum_prop": 0.6644295302013423,
"repo_name": "codeforamerica/contracts-api",
"id": "d597df0e72c8b1b99bd640be127fc6fd6d8db8dd",
... |
import line_profiler
from timeit import default_timer as timer
import sys
import glob
import os
import re
import fnmatch
import math
import numpy as np
from vocabulary import Vocabulary
import collections
from scipy import sparse
from scipy.sparse import * # dok_matrix
from swig.array_of_trees import ArrayOfTrees
de... | {
"content_hash": "b4307288ed1188aa48955dd84718e17b",
"timestamp": "",
"source": "github",
"line_count": 183,
"max_line_length": 95,
"avg_line_length": 27.273224043715846,
"alnum_prop": 0.6183129633340012,
"repo_name": "undertherain/nlp_cooc",
"id": "bc1683cc694d62cdb9ed9b67eefcb257d3c29e6d",
"size"... |
import bz2
import io
import os
data = 'Contents of the example file go here.\n'
with bz2.BZ2File('example.bz2', 'wb') as output:
with io.TextIOWrapper(output, encoding='utf-8') as enc:
enc.write(data)
os.system('file example.bz2')
| {
"content_hash": "e44a0d44d365086a8a4967d39c35ef78",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 59,
"avg_line_length": 22.363636363636363,
"alnum_prop": 0.6910569105691057,
"repo_name": "jasonwee/asus-rt-n14uhp-mrtg",
"id": "9e9c3e2544eb211ac0cf75e89a1fbe9051db60c8",
... |
version = "0.1"
authors = ("Peter Stroia-Williams", '')
copyright = "© 2010"
comments = "A somewhat messily coded but functional match viewer."
import matchviewcanvas
import pygtk
pygtk.require("2.0")
import gtk
import os
import sys
class MatchViewerApp(object):
matchListFN = None
def on_window_destroy(se... | {
"content_hash": "b91c90c8f478de8b8444e578992b2bf8",
"timestamp": "",
"source": "github",
"line_count": 221,
"max_line_length": 120,
"avg_line_length": 39.828054298642535,
"alnum_prop": 0.6146330379459214,
"repo_name": "peterSW/MatchViewer",
"id": "4b0fc458b47242f9d052ab6a3ee844dbe45cf1c0",
"size":... |
frontConvertParent = '/var/local/meTypesetTests/testingDocuments/jolOutput'
frontSampleParent = '/var/local/meTypesetTests/testingDocuments/jolXML'
bodyConvertParent = '/var/local/meTypesetTests/testingDocuments/coactionDocxOutput/'
bodySampleParent = '/var/local/meTypesetTests/testingDocuments/coactionXML'
necessaryMa... | {
"content_hash": "dc86a6c448931049fcf0ee139baf097b",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 268,
"avg_line_length": 83.25,
"alnum_prop": 0.7732732732732732,
"repo_name": "jnicolls/meTypeset-Test",
"id": "fea8b97469b70332813ec115053183a180082974",
"size": "956",
"... |
import mechanicalsoup
browser = mechanicalsoup.StatefulBrowser()
browser.open("http://httpbin.org/")
print(browser.url)
browser.follow_link("forms")
print(browser.url)
print(browser.page)
browser.select_form('form[action="/post"]')
browser["custname"] = "Me"
browser["custtel"] = "00 00 0001"
browser["custemail"] = "... | {
"content_hash": "f6c9dfe5c0fde0d9b0d7027e7ab620a7",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 61,
"avg_line_length": 27.037037037037038,
"alnum_prop": 0.7273972602739726,
"repo_name": "hemberger/MechanicalSoup",
"id": "f02beeb5a5f638fb62fb9e5e29555c420a539d45",
"siz... |
'''
PEXPECT LICENSE
This license is approved by the OSI and FSF as GPL-compatible.
http://opensource.org/licenses/isc-license.txt
Copyright (c) 2012, Noah Spurrier <[email protected]>
PERMISSION TO USE, COPY, MODIFY, AND/OR DISTRIBUTE THIS SOFTWARE FOR ANY
PURPOSE WITH OR WITHOUT FEE IS HEREBY GRA... | {
"content_hash": "2f6b6cddef780cf17b1b32f056e0b58b",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 76,
"avg_line_length": 42.921052631578945,
"alnum_prop": 0.7516860821581851,
"repo_name": "HPPTECH/hpp_IOSTressTest",
"id": "8ccf13f49ffc8e70b8d2d72faed95d8dd7c4207d",
"siz... |
import os
import sys
from unittest import defaultTestLoader, TextTestRunner, TestSuite
TESTS = ('asyncflux_test', 'client_test', 'clusteradmin_test', 'database_test',
'shardspace_test', 'user_test', 'util_test', )
def make_suite(prefix='', extra=(), force_all=False):
tests = TESTS + extra
test_names... | {
"content_hash": "92cc1c7e83b07caca980cf12cad5ae54",
"timestamp": "",
"source": "github",
"line_count": 88,
"max_line_length": 80,
"avg_line_length": 32.01136363636363,
"alnum_prop": 0.5708200212992546,
"repo_name": "puentesarrin/asyncflux",
"id": "77a3da1c0dc15d0cc1228599708d9e6270edda55",
"size":... |
import pytest
from aiogear import PacketType, Worker
@pytest.fixture
def worker():
w = Worker()
return w
@pytest.mark.parametrize('param', [10, '10'])
def test_can_do_timeout(worker, param):
# Expect no exception
worker.send(PacketType.CAN_DO_TIMEOUT, 'func', param)
assert 1 == 1
| {
"content_hash": "5e5ee4c4fae3fc29b5616b7802b957a8",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 57,
"avg_line_length": 20.333333333333332,
"alnum_prop": 0.6786885245901639,
"repo_name": "sardok/aiogear",
"id": "aedc4bc157f95dccfc7e93b75c17b40084f21656",
"size": "305",... |
"""Django settings for workbench project."""
import json
import os
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
DJFS = {'type': 'osfs',
'directory_root': 'workbench/static/djpyfs',
'url_root': '/static/djpyfs'}
DEBUG = True
if os.environ.get('EXCLUDE_SAMPLE_XBLOCKS') == 'yes':
EXCLUDED... | {
"content_hash": "906600489387629747bbcd490750c5c0",
"timestamp": "",
"source": "github",
"line_count": 233,
"max_line_length": 94,
"avg_line_length": 30.047210300429185,
"alnum_prop": 0.6459077274675047,
"repo_name": "stvstnfrd/xblock-sdk",
"id": "1842a56276650e6943be81339656c47d25c6ab12",
"size":... |
"""Test ref results for data with no coincidences."""
import numpy
import pytest
from pytest import approx
from ndd.estimators import AsymptoticNsb, Nsb, Plugin
from ndd.exceptions import NddError
N = (10, 10)
K = (10, 1000)
@pytest.fixture(params=zip(N, K))
def data(request):
n, k = request.param
return {'... | {
"content_hash": "b3003917d04e959c83604a3a97d2d91b",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 72,
"avg_line_length": 25.953488372093023,
"alnum_prop": 0.6523297491039427,
"repo_name": "simomarsili/ndd",
"id": "b2221cde5f50f1eec59dd5eeb1a04ba5484d240a",
"size": "1215... |
import pandas as pd
import logging as log
from ..utils.database import dbutils
def get_daily_call_counts(db_connection, timeseries_table):
"""
Gets the time series data per customer from the database. This data
contains every unique customer ID from the time series set along with
the every unique call... | {
"content_hash": "fcb5c056e9e3382a456ee0f9c6edb526",
"timestamp": "",
"source": "github",
"line_count": 286,
"max_line_length": 90,
"avg_line_length": 32.32867132867133,
"alnum_prop": 0.6015574302401038,
"repo_name": "DSSG2017/florence",
"id": "05b964241529d4aebb66252dbfdd7330056cf5bf",
"size": "92... |
#pylint: disable-msg=C0301
#pylint: disable-msg=F0401
#pylint: disable-msg=W0142
"""Tests for application.py"""
import sys
import os
import unittest
import time
#import pprint
#import pdb
import warnings
from threading import Thread
import ctypes
import mock
import six
sys.path.append(".")
from ... | {
"content_hash": "1693b474d64a8f02dd3e4e48a5b033fc",
"timestamp": "",
"source": "github",
"line_count": 1416,
"max_line_length": 124,
"avg_line_length": 41.0225988700565,
"alnum_prop": 0.6116753890648671,
"repo_name": "airelil/pywinauto",
"id": "1cf48c88e94a26c51b98948221dfd43f08de72b9",
"size": "5... |
import random
from argparse import Namespace
from contextlib import contextmanager
from pathlib import Path
import pytest
from vedro import Scenario
from vedro.core import ArgumentParser, ConfigType, Dispatcher, VirtualScenario
from vedro.events import ArgParsedEvent, ArgParseEvent, ConfigLoadedEvent
from vedro.plugi... | {
"content_hash": "565fd5972dbff363ebb8ba817bc7635b",
"timestamp": "",
"source": "github",
"line_count": 57,
"max_line_length": 87,
"avg_line_length": 28.719298245614034,
"alnum_prop": 0.7116676847892486,
"repo_name": "nikitanovosibirsk/vedro",
"id": "fe5b281fcda76242905349db2352e333f91f6fb9",
"size... |
import parmed
import tempfile
import os
import shutil
# Get the paths to the gaff.dat and leaprc files:
leaprc_path = os.path.join(os.getenv("CONDA_PREFIX"), 'dat', 'leap', 'cmd', 'leaprc.gaff')
gaffdat_path = os.path.join(os.getenv("CONDA_PREFIX"), 'dat', 'leap', 'parm', 'gaff.dat')
# Make a temporary directory (oth... | {
"content_hash": "328a7aad55886766f7e258e60046d236",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 106,
"avg_line_length": 34.77777777777778,
"alnum_prop": 0.7539936102236422,
"repo_name": "choderalab/perses",
"id": "ecf98c5fb91c2474a41ff97437e64496e9e3039c",
"size": "93... |
from datetime import datetime
from django.db import models
from django.contrib.auth.models import User
from django.db.models.signals import post_save
class SiteKind:
github = "github"
values = [("github", "github")]
class RepositoryKind:
git = "git"
hg = "hg"
values = [("git", "git"), ("hg", "hg"... | {
"content_hash": "a6140aecf05815d4e459427a646229c5",
"timestamp": "",
"source": "github",
"line_count": 177,
"max_line_length": 109,
"avg_line_length": 29.74576271186441,
"alnum_prop": 0.6653371320037986,
"repo_name": "sema/django-2012",
"id": "bdff8acf020108e85065d38ffd1403ff26d12e8a",
"size": "52... |
__all__ = ['cntv_download', 'cntv_download_by_id']
from common import *
import json
import re
def cntv_download_by_id(id, title=None, output_dir='.', merge=True):
assert id
info = json.loads(get_html('http://vdn.apps.cntv.cn/api/getHttpVideoInfo.do?pid='+id).decode('utf-8'))
title = title or info['title']
video =... | {
"content_hash": "6f86938cf2e65dc4030027bd7d252598",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 103,
"avg_line_length": 35.37837837837838,
"alnum_prop": 0.6516424751718869,
"repo_name": "rahimnathwani/youku-lixian",
"id": "0ca3f961a01b53d56321e06f0cfd930aafc393c4",
"s... |
"""Tests for Intel MPI benchmark."""
import unittest
from unittest import mock
from absl.testing import flagsaver
from absl.testing import parameterized
from perfkitbenchmarker import os_types
from perfkitbenchmarker.linux_packages import imb
from perfkitbenchmarker.linux_packages import intelmpi
# Required for --mpi... | {
"content_hash": "a2d592a2fb93e3aca237ab08c716139b",
"timestamp": "",
"source": "github",
"line_count": 182,
"max_line_length": 82,
"avg_line_length": 35.357142857142854,
"alnum_prop": 0.6397824397824398,
"repo_name": "GoogleCloudPlatform/PerfKitBenchmarker",
"id": "bba2e38021dbc03054efd22624525e56cf... |
"""A setuptools based setup module.
See:
https://packaging.python.org/en/latest/distributing.html
https://github.com/pypa/sampleproject
"""
# Always prefer setuptools over distutils
from setuptools import setup, find_packages
# To use a consistent encoding
from codecs import open
from os import path
here = pa... | {
"content_hash": "4af6e618f63568e4a0ecf2262710dd6f",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 91,
"avg_line_length": 34.06896551724138,
"alnum_prop": 0.7135627530364372,
"repo_name": "emdodds/DictLearner",
"id": "9f6e9eb69f555356470fdac81a9d487ed013a2ec",
"size": "9... |
from sqlalchemy.ext.declarative import declarative_base
from flask_sqlalchemy import SQLAlchemy
db = SQLAlchemy()
db_session = db.session
Base = declarative_base()
def init_db(app):
db.init_app(app)
with app.app_context():
Base.metadata.create_all(bind=db.engine)
Base.query = db_session.query_pro... | {
"content_hash": "ddf0ece243166bac87c384937f595699",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 55,
"avg_line_length": 23.5,
"alnum_prop": 0.723404255319149,
"repo_name": "roxel/planner",
"id": "57e2fdbe97f22d642b54596febc14d7d66646521",
"size": "329",
"binary": fal... |
import __future__
import sys
import numpy
sys.stdin = open("./challenge_sample_input", 'r')
print("===" * 30)
print("SAMPLE OUTPUT:")
print("===" * 30)
print(open("./challenge_sample_output", 'r').read())
print("===" * 30)
print("START")
print("===" * 30)
A = numpy.array(map(int,raw_input().split()))
B = numpy.array(m... | {
"content_hash": "06cba48f2fac2b8cae7e9782202e9d4f",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 52,
"avg_line_length": 24.8125,
"alnum_prop": 0.6272040302267002,
"repo_name": "shollingsworth/HackerRank",
"id": "10743ba4d83bb2658c7c57a8884354b6c2c33491",
"size": "443",... |
r"""Simple Reinforcement Learning test environment.
Kinematic point mass environment similar to the one from the MAML paper.
"""
import gym
from gym.utils import seeding
import matplotlib.pyplot as plt
import numpy as np
class MovePointEnv(gym.Env):
"""Simple point mass gym environment.
The goal is to move an ... | {
"content_hash": "0e870c79f5db24df86be7b564989c762",
"timestamp": "",
"source": "github",
"line_count": 121,
"max_line_length": 80,
"avg_line_length": 35.47107438016529,
"alnum_prop": 0.6258154706430569,
"repo_name": "google-research/google-research",
"id": "721acd0d88ebefe3e6074abaf61b6f1e4d294479",... |
import numpy as np
from .vad import vad
def _get_edges(vact):
edges = np.flatnonzero(np.diff(vact.astype(int)))
edges = edges + 1
if vact[0]:
edges = np.hstack((0, edges))
if vact[-1]:
edges = np.hstack((edges, vact.size))
edges = np.minimum(edges, vact.size).reshape(-1, 2)
... | {
"content_hash": "1a0c535bda10ff1206a7fa918f1484f7",
"timestamp": "",
"source": "github",
"line_count": 157,
"max_line_length": 86,
"avg_line_length": 27.89171974522293,
"alnum_prop": 0.5788992920758164,
"repo_name": "F-Tag/python-vad",
"id": "c68aecdec5ad028b3a62a56d2c726b5a5c43c74c",
"size": "437... |
"""Test the TcEx API Snippets."""
# first-party
from tcex.api.tc.v3.tql.tql_operator import TqlOperator
from tests.api.tc.v3.v3_helpers import TestV3, V3Helper
class TestCaseSnippets(TestV3):
"""Test TcEx API Interface."""
v3 = None
def setup_method(self, method: callable):
"""Configure setup be... | {
"content_hash": "2a7aa9d050f140ea968128a51485db36",
"timestamp": "",
"source": "github",
"line_count": 291,
"max_line_length": 92,
"avg_line_length": 29.25085910652921,
"alnum_prop": 0.5337171052631579,
"repo_name": "ThreatConnect-Inc/tcex",
"id": "3373baf948208aece5fdaa4d50762b199c8c41ac",
"size"... |
'''
Log handler.
'''
from concurrent.futures import ThreadPoolExecutor
from config import CMS_CFG
from torcms.core import tools
from torcms.core.base_handler import BaseHandler
from torcms.model.log_model import MLog
class LogHandler(BaseHandler):
'''
Log handler.
'''
executor = ThreadPoolExecutor(2... | {
"content_hash": "f3b15938332467a932a6103d6cc33d69",
"timestamp": "",
"source": "github",
"line_count": 220,
"max_line_length": 83,
"avg_line_length": 29.263636363636362,
"alnum_prop": 0.47452625038831936,
"repo_name": "bukun/TorCMS",
"id": "c811333e634dde219a759c9bc340c6ca19ee35eb",
"size": "6467"... |
import json
from watson_developer_cloud import PersonalityInsightsV3
class Personality:
def __init__(self, url, username, password, version):
self.personality_insights = PersonalityInsightsV3(
url=url,
version=version,
username=username,
password=password,
... | {
"content_hash": "6895df07d8180d7a6a8d4bb90c53fb07",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 85,
"avg_line_length": 28.607142857142858,
"alnum_prop": 0.5131086142322098,
"repo_name": "martialblog/watson-diary",
"id": "9c317680acb217d713891749b7d576988a3a1865",
"siz... |
"""
Interfaces for ABFS
"""
from future import standard_library
standard_library.install_aliases()
from builtins import object
import logging
import os
import sys
import threading
import re
from math import ceil
from posixpath import join
from hadoop.hdfs_site import get_umask_mode
from hadoop.fs.exceptions import We... | {
"content_hash": "f049459262359cf38b16ad0d65f8127d",
"timestamp": "",
"source": "github",
"line_count": 721,
"max_line_length": 127,
"avg_line_length": 29.328710124826628,
"alnum_prop": 0.6243261136858035,
"repo_name": "cloudera/hue",
"id": "c8d2ad9604de9292c2f6ea4452825d4d5e0c3d08",
"size": "21938... |
from __future__ import absolute_import, division, print_function, with_statement
import datetime
import json
from bson.objectid import ObjectId
import gridfs
from pymongo import MongoClient
from turbo.model import BaseModel
from turbo.util import PY3, basestring_type as basestring, utf8
from util import unittest, fak... | {
"content_hash": "ef627c2fe9d20637086ae8924b73e625",
"timestamp": "",
"source": "github",
"line_count": 368,
"max_line_length": 85,
"avg_line_length": 32.96467391304348,
"alnum_prop": 0.5410930673481164,
"repo_name": "wecatch/app-turbo",
"id": "b56427b3d7ffb67dacdb03ea89f9ce32fb777ceb",
"size": "12... |
_exportpath = '/sys/class/gpio/gpiochip0/subsystem/export'
_unexportpath = '/sys/class/gpio/gpiochip0/subsystem/unexport'
_gpiopath = '/sys/class/gpio/gpio'
# Write to the GPIO fs. Seems to need to close to take effect
def writetofs(fname,data):
f=open(fname,'w')
f.write(data)
f.close()
#Read from GPIO fs.
def ... | {
"content_hash": "0d47997e79527ad0434dd5c265cfc0b0",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 77,
"avg_line_length": 23.047619047619047,
"alnum_prop": 0.6838842975206612,
"repo_name": "msoftware/onion_omega2_hex_keypad",
"id": "8b3fa8d157c0c38afdc79eaf98fd4cade154805b... |
import json
import telegram
from rq.decorators import job
from redis_wrap import SYSTEMS
import config
import botcommands
from utils import *
bot = None
@job('reply', connection=SYSTEMS['default'], result_ttl=5)
def handle_update(update, telegram_bot=None):
global bot
if telegram_bot is None:
print... | {
"content_hash": "6561a425d8ccada40fedffaa3195f778",
"timestamp": "",
"source": "github",
"line_count": 175,
"max_line_length": 69,
"avg_line_length": 33.25142857142857,
"alnum_prop": 0.5794810104829008,
"repo_name": "JokerQyou/bot",
"id": "12b16dc8d4b3c2f5e04497758e12ddb41f9316da",
"size": "5913",... |
from django.db import models
import binascii
class HashField(models.BinaryField):
description = ('HashField is related to some other field in a model and'
'stores its hashed value for better indexing performance.')
def __init__(self, *args, **kwargs):
kwargs['max_length'] = 16
kwargs.s... | {
"content_hash": "2c9645488648012967efce8ed2cb26ca",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 76,
"avg_line_length": 35.3,
"alnum_prop": 0.6402266288951841,
"repo_name": "amcat/django-hash-field",
"id": "4563cc48a04909a9d4ca95de626b75baeb788cec",
"size": "706",
"b... |
"""
MIT License
Copyright (c) 2016 William Tumeo
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, modify, merge, publish,... | {
"content_hash": "4e9e06e2f8334a6df64e43eb309bcb1e",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 78,
"avg_line_length": 44.48,
"alnum_prop": 0.8012589928057554,
"repo_name": "williamd1k0/shiori",
"id": "63b1838d6f816cfb1dc89c9e74159dc1a1b47785",
"size": "1113",
"bina... |
import sys,tty,termios,time
import RPi.GPIO as GPIO
LEFT_PIN = 26
RIGHT_PIN = 16
STATUS_PIN = 13
class _Getch:
def __call__(self):
fd = sys.stdin.fileno()
old_settings = termios.tcgetattr(fd)
try:
tty.setraw(sys.stdin.fileno())
ch = sys.stdin.read(1)
finally... | {
"content_hash": "121c2c501488fde7bdd471b631bc222d",
"timestamp": "",
"source": "github",
"line_count": 71,
"max_line_length": 66,
"avg_line_length": 19.408450704225352,
"alnum_prop": 0.5587808417997098,
"repo_name": "MaxxDelusional/SpiderPi",
"id": "757f2e895f44c1f4325f446bc5e35788a34f1fc0",
"size... |
from __future__ import unicode_literals
from django.contrib.gis.db import models
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='RasterLayer',
fields=[
('id', models.A... | {
"content_hash": "a904837c6ad84288f05e40a47ac2afab",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 179,
"avg_line_length": 40.829268292682926,
"alnum_prop": 0.548984468339307,
"repo_name": "PADAS/django-raster",
"id": "5dfc049a867f1ee9046f0ab3bb1b10c4b6fff4dd",
"size": "... |
"""Calculate similarity scores based on the Jaccard distance between events."""
from __future__ import unicode_literals
from timesketch.lib import similarity
from timesketch.lib.analyzers import interface
from timesketch.lib.analyzers import manager
class SimilarityScorerConfig(object):
"""Configuration for a s... | {
"content_hash": "b4893a9511360d720173c8e682a3fa61",
"timestamp": "",
"source": "github",
"line_count": 132,
"max_line_length": 80,
"avg_line_length": 33.84848484848485,
"alnum_prop": 0.605863921217547,
"repo_name": "google/timesketch",
"id": "99204b788843fe0565fb2353a72c3403733dd666",
"size": "506... |
import os
from importlib import import_module
from databuild.loader import load_classpath
from databuild.buildfile import BuildFile
from databuild.utils import multiglob
class Builder(object):
def __init__(self, settings='databuild.settings'):
self.settings = import_module(settings)
AdapterClass ... | {
"content_hash": "341b6b72ca41d11e8891cfa74cc4c317",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 67,
"avg_line_length": 35.55172413793103,
"alnum_prop": 0.6188166828322017,
"repo_name": "databuild/databuild",
"id": "0ee7c6d4641f49a96850aadf5d7cbbcf07da6d69",
"size": "1... |
"""
"""
from __future__ import unicode_literals, absolute_import
from autobit import config
from autobit import ConfigError
from autobit.tracker import Tracker
from autobit.classification import MediaType
class BroadcastTheNet(Tracker):
def __init__(self):
self.name = "btn"
self._authkey = ""
... | {
"content_hash": "e75a708a19b8584b209c4a039ce2605f",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 109,
"avg_line_length": 31.214285714285715,
"alnum_prop": 0.5949656750572082,
"repo_name": "leighmacdonald/autobit",
"id": "d7e510c6c7caf0695c05d43863a178e3c288f98d",
"size... |
import os
import sc2reader
import Player
import traceback
class GameProcessor:
CONST_FPS = 16.0
CONST_EXT = '.SC2Replay'
def __init__(self):
self.path = ""
self.files = list()
self.exclude = ""
self.processed = dict()
print("GameProcessor created")
def ... | {
"content_hash": "71aa6762356e491e981603bdc1402353",
"timestamp": "",
"source": "github",
"line_count": 132,
"max_line_length": 154,
"avg_line_length": 44.96212121212121,
"alnum_prop": 0.5745577085088458,
"repo_name": "eqy/vroMAD",
"id": "dffadac6639d23ed58a5fdd18de0379fc2e577de",
"size": "5935",
... |
"""Imports for Python API.
This file is MACHINE GENERATED! Do not edit.
Generated by: tensorflow/tools/api/generator/create_python_api.py script.
"""
from tensorflow.python.saved_model.loader import load
from tensorflow.python.saved_model.loader import maybe_saved_model_directory | {
"content_hash": "3cdf90fcc05d57889b66fe3b5b9fa3ac",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 76,
"avg_line_length": 40.142857142857146,
"alnum_prop": 0.8078291814946619,
"repo_name": "ryfeus/lambda-packs",
"id": "80f566aded94c6ecfecf065db3467e27cdd62314",
"size": "2... |
from get_data import get_data
import os
import xml.etree.ElementTree as ET
import collections
FMI_API_KEY = os.environ['FMI_API_KEY']
weather_now_url = "http://data.fmi.fi/fmi-apikey/" + FMI_API_KEY + "/wfs?request=getFeature&storedquery_id=fmi::observations::weather::simple&place="
def parse_weather_data(location):... | {
"content_hash": "21a225fdf9505881501b7565166de64a",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 149,
"avg_line_length": 36.172413793103445,
"alnum_prop": 0.6930409914204004,
"repo_name": "Mikrobitti/6-17-saabotti",
"id": "b241dba8bc13726e3a0841623744ab378efe16b9",
"si... |
from setuptools import setup, find_packages
setup(
name='django-email-from-template',
description="Send emails generated entirely from Django templates.",
version='2.4.1',
url='https://chris-lamb.co.uk/projects/django-email-from-template',
author="Chris Lamb",
author_email='[email protected]... | {
"content_hash": "8cbe8593f72f2db9a850b36c0b51d4a3",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 72,
"avg_line_length": 23.285714285714285,
"alnum_prop": 0.623721881390593,
"repo_name": "lamby/django-email-from-template",
"id": "d0630924aba5ea793a1fb30bfd3d32e1d28833b9",... |
import os
import sys
import tempfile
from zipfile import ZipFile, ZIP_DEFLATED
from datetime import datetime
import time
from jinja2 import Environment, FileSystemLoader
from . import Color
if getattr(sys, "frozen", False):
_basedir = os.path.join(sys._MEIPASS, "pyexcelerate")
else:
_basedir = os.path.dirname(... | {
"content_hash": "218f21dde51fa56f9301fc4d8ee60b80",
"timestamp": "",
"source": "github",
"line_count": 92,
"max_line_length": 101,
"avg_line_length": 39.68478260869565,
"alnum_prop": 0.5897014516570802,
"repo_name": "kz26/PyExcelerate",
"id": "8302037892ce397e1167601ad092200cccd250d5",
"size": "36... |
try:
from StringIO import StringIO
except ImportError:
from io import StringIO
import unittest
import geojson
class FeaturesTest(unittest.TestCase):
def test_protocol(self):
"""
A dictionary can satisfy the protocol
"""
f = {
'type': 'Feature',
'id'... | {
"content_hash": "77495aede992c184f61aa003edb2b1f6",
"timestamp": "",
"source": "github",
"line_count": 119,
"max_line_length": 76,
"avg_line_length": 40.57142857142857,
"alnum_prop": 0.4587821043910522,
"repo_name": "frewsxcv/python-geojson",
"id": "e2b56e9bd8f86b2066207b24e662f6b023e64c89",
"size... |
from __future__ import unicode_literals
import unittest
from django.core.exceptions import ValidationError
from django_social import Source
from django_social.facebook.api import get_location_info
from django_social.facebook.api import search_places
class SocialTestCase(unittest.TestCase):
def test_facebook_ge... | {
"content_hash": "82a6573f8b64e5b8bf9f6865f2754dbf",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 118,
"avg_line_length": 39.916666666666664,
"alnum_prop": 0.6383089770354906,
"repo_name": "InfoAgeTech/django-social",
"id": "8d0c95a31362c0f90bf82379a73a75fdc2c2abdc",
"s... |
import os
import sys
import xbmc
import urllib,urllib2
import xbmcvfs
import xbmcaddon
import xbmcgui,xbmcplugin,shutil
from zipfile import ZipFile
from cStringIO import StringIO
import uuid
__addon__ = xbmcaddon.Addon()
__author__ = __addon__.getAddonInfo('author')
__scriptid__ = __addon__.getAddonInfo('id')
__... | {
"content_hash": "df014e9a5ad5b06125f94239647dc1b3",
"timestamp": "",
"source": "github",
"line_count": 201,
"max_line_length": 129,
"avg_line_length": 39.28358208955224,
"alnum_prop": 0.5073454913880446,
"repo_name": "aplicatii-romanesti/allinclusive-kodi-pi",
"id": "ac8a7b0f6855a5621473797cbf7b3ebe... |
"""
The resume module
=================
This module defines - among other things - the views responsible for exposing personal
information.
"""
def init_app(app, **kwargs):
""" Performs app-initialization operations related to the current module. """
# Registers blueprints.
from . import... | {
"content_hash": "4d25ddf67433c4ed5f353637ca2ef7fb",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 90,
"avg_line_length": 27,
"alnum_prop": 0.6881091617933723,
"repo_name": "ellmetha/morganaubert-resume",
"id": "aa4ee8fd76aa61d159b0865d282204e2e2304b55",
"size": "513",
... |
from collections import defaultdict
from .state import State
from ..messages.append_entries import AppendEntriesMessage
class Leader(State):
def __init__(self):
self._nextIndexes = defaultdict(int)
self._matchIndex = defaultdict(int)
def set_sever(self, server):
self._sever = server
... | {
"content_hash": "a476118e14c9016c3a37f9d0164f05b0",
"timestamp": "",
"source": "github",
"line_count": 67,
"max_line_length": 79,
"avg_line_length": 36.38805970149254,
"alnum_prop": 0.5557834290401968,
"repo_name": "streed/simpleRaft",
"id": "76395d4a2afdfc9ad5284307c942b41aa8a9e1fd",
"size": "243... |
'''
This is a sample code to demonstrate how to use the TensorFlow custom op with
FasterTransformer library in encoder.
This sample code builds a BERT transformer model by TensorFlow and TensorFlow
custom op. Then compare the maximum difference of them to verify the correctness
of FasterTransformer.
Users are also... | {
"content_hash": "1adf25aac76b91e7a5d44036711fb50e",
"timestamp": "",
"source": "github",
"line_count": 255,
"max_line_length": 171,
"avg_line_length": 49.937254901960785,
"alnum_prop": 0.5528506360923512,
"repo_name": "NVIDIA/FasterTransformer",
"id": "b894ac9155595b85ceb05f219cdea1acd99050ce",
"s... |
__all__ = [ "SharedLock" ]
################################################################################
from threading import Lock, currentThread, Event
from random import randint
from exc_string import trace_string
if not hasattr(__builtins__, "sorted"):
def sorted(seq):
result = [ x for x in seq ]
... | {
"content_hash": "3f15467f100c6388a514da57a0aa9916",
"timestamp": "",
"source": "github",
"line_count": 523,
"max_line_length": 113,
"avg_line_length": 38.03059273422562,
"alnum_prop": 0.5040723981900452,
"repo_name": "ActiveState/code",
"id": "4fcb865b501f957013c54c50fae7c1da36ab42a9",
"size": "23... |
import datetime
import os
import re
import tempfile
import urllib2
from lxml import etree
from optparse import make_option
from tempfile import gettempdir
from django.core.files import File
from django.core.management.base import BaseCommand, CommandError
from django.utils.timezone import utc
from airmozilla.main.m... | {
"content_hash": "6eee4b1df86f795e424d5e91f0423b09",
"timestamp": "",
"source": "github",
"line_count": 235,
"max_line_length": 152,
"avg_line_length": 41.276595744680854,
"alnum_prop": 0.5261855670103093,
"repo_name": "peterbe/airmozilla",
"id": "e425491abf0a0084e37b60ca7ab86a09de60e97b",
"size": ... |
"""Common brick related utilities."""
from __future__ import print_function
import os
from chromite.lib import osutils
from chromite.lib import workspace_lib
_DEFAULT_LAYOUT_CONF = {'profile_eapi_when_unspecified': '5-progress',
'profile-formats': 'portage-2 profile-default-eapi',
... | {
"content_hash": "77def8ba98afcb64b156822a81edc403",
"timestamp": "",
"source": "github",
"line_count": 269,
"max_line_length": 80,
"avg_line_length": 33.486988847583646,
"alnum_prop": 0.6465364120781527,
"repo_name": "guorendong/iridium-browser-ubuntu",
"id": "0925688166a8862590ae6e8372dbc195b41e90c... |
import argparse
import asyncio
import logging
import itertools
import aiosip
sip_config = {
'local_ip': '127.0.0.1',
'local_port': 6000
}
async def notify(dialog):
for idx in itertools.count(1):
await dialog.notify(payload=str(idx))
await asyncio.sleep(1)
async def on_subscribe(request... | {
"content_hash": "3cfee866ffa32754ce545a5ce68f21b3",
"timestamp": "",
"source": "github",
"line_count": 90,
"max_line_length": 76,
"avg_line_length": 23.788888888888888,
"alnum_prop": 0.6090611863615133,
"repo_name": "Eyepea/aiosip",
"id": "2b5e484215a683487d6f531e3c94b40ebf589d87",
"size": "2141",... |
def how_user_handles_food(user):
try:
if user.handles_food_with_vigilance:
return "vigilance"
except AttributeError:
return "probably a sucker." | {
"content_hash": "270d13a900ef99739387b03e76569b60",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 44,
"avg_line_length": 30,
"alnum_prop": 0.6333333333333333,
"repo_name": "SlashRoot/WHAT",
"id": "f7f8777c4120d6e87e5b2115ca5195a0e9c8fe05",
"size": "180",
"binary": fals... |
"""
`Unit tests for cargo.logic.NetworkingLogic`
--·--·--·--·--·--·--·--·--·--·--·--·--·--·--·--·--·--·--·--·--·--·--·--·--·--·--
2016 Jared Lunde © The MIT License (MIT)
http://github.com/jaredlunde
"""
from cargo.logic import NetworkingLogic
from unit_tests import configure
from unit_tests.configure import n... | {
"content_hash": "c43677b7e2f55659c0ef06d211729692",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 80,
"avg_line_length": 27.304347826086957,
"alnum_prop": 0.6003184713375797,
"repo_name": "jaredlunde/cargo-orm",
"id": "dbe59721111462eaf96bf4849702ecb741623c3c",
"size": ... |
"""
epitopepredict analysis methods
Created September 2013
Copyright (C) Damien Farrell
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 3
of the License, or ... | {
"content_hash": "0b914699cd22d6b1aecc1b3e00da449e",
"timestamp": "",
"source": "github",
"line_count": 705,
"max_line_length": 100,
"avg_line_length": 33.55744680851064,
"alnum_prop": 0.5958238228083523,
"repo_name": "dmnfarrell/mhcpredict",
"id": "2a785c2c07491dec7b767b85373258fc9c2ed1c0",
"size"... |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('article', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='article',
name='abstract',
field=mo... | {
"content_hash": "7724e086f3fc000a84592e79c7974c47",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 58,
"avg_line_length": 20.88888888888889,
"alnum_prop": 0.5877659574468085,
"repo_name": "YoungsonZhao/Blog-Django",
"id": "67f85d8ef3efe7df3d311d5f52ee24bad30e61c2",
"size... |
import sys
# Take input
if len(sys.argv) > 1:
N = int(sys.argv[1])
else:
N = int(input("N? "))
current = N # Repeat until we get to 1
while current != 1:
# Decide what move we take
if current % 3 == 0:
move = 0 # 0 if it's already divisible
elif current % 3 == 1:
move =... | {
"content_hash": "cae51b0ef4b4bc46e3260440ea29c410",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 55,
"avg_line_length": 20.379310344827587,
"alnum_prop": 0.5482233502538071,
"repo_name": "fsufitch/dailyprogrammer",
"id": "e95a02e247e7770db9751747be8cdff80ffa44e0",
"siz... |
import zstackwoodpecker.test_state as ts_header
import os
TestAction = ts_header.TestAction
def path():
return dict(initial_formation="template5", checking_point=8, path_list=[
[TestAction.create_vm, 'vm1', ],
[TestAction.create_volume, 'volume1', 'flag=scsi'],
[TestAction.attach_volume, 'vm1', 'volume1'],
... | {
"content_hash": "01e0ea2d7edeaefe28b931fd514bf3b4",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 317,
"avg_line_length": 49.42857142857143,
"alnum_prop": 0.7155243600330305,
"repo_name": "zstackio/zstack-woodpecker",
"id": "ced206296988a55d8ac5d3fd86e089c96efbeabc",
"s... |
"""
Class to extract information from OpenWRT devices
"""
__all__ = ['OpenWRT']
from netengine.backends.ssh import SSH
import json
class OpenWRT(SSH):
"""
OpenWRT SSH backend
"""
_ubus_dict = {}
_iwinfo_dict = {}
def __str__(self):
""" print a human readable object description """... | {
"content_hash": "e5034ce1574ac8751c063a2a57e0d4f7",
"timestamp": "",
"source": "github",
"line_count": 232,
"max_line_length": 106,
"avg_line_length": 33.17672413793103,
"alnum_prop": 0.5169546576588281,
"repo_name": "ninuxorg/netengine",
"id": "0799ed35645c9b76630a1a62e4a0861adba31ed4",
"size": "... |
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('server', '0011_auto_20171101_1255'),
]
operations = [
migrations.AddField(
model_name='event',
... | {
"content_hash": "de2f3281898062e6dc8b3408a32b2b70",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 120,
"avg_line_length": 24.894736842105264,
"alnum_prop": 0.638477801268499,
"repo_name": "wodo/WebTool3",
"id": "d27692921027036c972f4f9e2616449870af6a4d",
"size": "547",
... |
FAILEDOPERATION_APIMETAPARSEFAILED = 'FailedOperation.ApiMetaParseFailed'
# 创建应用,获取ES鉴权信息失败。
FAILEDOPERATION_APPLICATIONCREATEESATUHERROR = 'FailedOperation.ApplicationCreateEsAtuhError'
# 应用查询失败。
FAILEDOPERATION_APPLICATIONQUERYFAILED = 'FailedOperation.ApplicationQueryFailed'
# 创建集群,开通VPC网络权限失败。
FAILEDOPERATION_CL... | {
"content_hash": "5759d6aa62fceb1fb32cf07aa5cf9743",
"timestamp": "",
"source": "github",
"line_count": 952,
"max_line_length": 127,
"avg_line_length": 34.938025210084035,
"alnum_prop": 0.8694867863263281,
"repo_name": "tzpBingo/github-trending",
"id": "f719460adcc1f84386a49deff17300abbff5cdcf",
"s... |
"""Cloud Functions do not exceed memory limits.
Log entries indicating Cloud Functions exceeding memory limits have been found.
"""
from boltons.iterutils import get_path
from gcpdiag import lint, models
from gcpdiag.queries import gcf, logs
MATCH_STR = 'Error: memory limit exceeded.'
logs_by_project = {}
LOG_FILT... | {
"content_hash": "9d099f933ae5d05a90577c1d2416967c",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 80,
"avg_line_length": 33.32,
"alnum_prop": 0.6872749099639855,
"repo_name": "GoogleCloudPlatform/gcpdiag",
"id": "681fc16b60684cdebba495ce6a2b9ac79945a1ec",
"size": "2261"... |
import json
import os
import rethinkdb
from flask import Flask, Response, request
import hn
LIMIT = 700
app = Flask(__name__, static_url_path='', static_folder='public')
app.add_url_rule('/', 'root', lambda: app.send_static_file('./index.html'))
@app.route('/hnjobs', methods=['GET'])
def comments_handler():
c... | {
"content_hash": "b8cdd9d99222459a46fd19e058756112",
"timestamp": "",
"source": "github",
"line_count": 75,
"max_line_length": 105,
"avg_line_length": 39.306666666666665,
"alnum_prop": 0.5739484396200815,
"repo_name": "babo/hnjobs",
"id": "1a98b2f0028ccac4b2294a97a6911ca3c82294d4",
"size": "3570",
... |
'''
Copyright (C) 2017 Scaleway. All rights reserved.
Use of this source code is governed by a MIT-style
license that can be found in the LICENSE file.
'''
from .tooling import yaml_params
@yaml_params
def test_system_state(host, params):
"""
Tests the system state exported by systemd.
Example:
>> -... | {
"content_hash": "893419689e6d97b6a20c70f7229708bb",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 70,
"avg_line_length": 23.605263157894736,
"alnum_prop": 0.6042363433667781,
"repo_name": "scaleway/tim",
"id": "076270d92aeddf948f674b6985a4a1d13518336b",
"size": "897",
... |
from django.shortcuts import render
from django.core.urlresolvers import reverse
from game.forms import GameForm
from game.models import Game, User, Coordinate
from django.http import HttpResponseRedirect, HttpResponse
from django.utils import simplejson as json
from game.functions import reveal, create_revealed_matrix... | {
"content_hash": "6f905458ce0e5df8595a5f00fa861492",
"timestamp": "",
"source": "github",
"line_count": 153,
"max_line_length": 160,
"avg_line_length": 35.62091503267974,
"alnum_prop": 0.6706422018348623,
"repo_name": "ZzCalvinzZ/minesweeper",
"id": "b8b6ccd03de8a6545bab6362cd4a4c89e9272689",
"size... |
__author__ = 'Robert Meyer'
import numpy as np
import sys
if (sys.version_info < (2, 7, 0)):
import unittest2 as unittest
else:
import unittest
from pypet.parameter import Parameter, PickleParameter, ArrayParameter,\
SparseParameter, ObjectTable, Result, SparseResult, PickleResult, BaseParameter
from pype... | {
"content_hash": "ef34a44243a65c15837486d3c8d4d2c6",
"timestamp": "",
"source": "github",
"line_count": 1069,
"max_line_length": 114,
"avg_line_length": 33.31057062675398,
"alnum_prop": 0.5536802493751579,
"repo_name": "nigroup/pypet",
"id": "d300a8afeb31a497ee256acfc137c0f341efecb7",
"size": "3560... |
import uuid
from setuptools import setup, find_packages
from pip.req import parse_requirements
install_reqs = parse_requirements('requirements.txt', session=uuid.uuid1())
reqs = [str(req.req) for req in install_reqs]
setup(
name='twitter_mysql',
version='0.1',
description='Scripts for normal... | {
"content_hash": "eb2fd39ce530b0c589058e18528c0a92",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 75,
"avg_line_length": 28.63157894736842,
"alnum_prop": 0.6893382352941176,
"repo_name": "emCOMP/twitter-mysql",
"id": "f3ef3c2d2858b5beba86f850d414b68fd4e7092a",
"size": "... |
from django import template
from django.core.cache import cache
from django.template.defaultfilters import stringfilter
from django.template.loader import render_to_string
from django.utils.html import conditional_escape
from django.utils.safestring import mark_safe
register = template.Library()
def __get_cached_aut... | {
"content_hash": "b63c75d23d29c4d0e1f163dd23512c7c",
"timestamp": "",
"source": "github",
"line_count": 70,
"max_line_length": 79,
"avg_line_length": 28.257142857142856,
"alnum_prop": 0.6122345803842265,
"repo_name": "dominicrodger/django-magazine",
"id": "91a7f6a92e286eda0730f6ee5ff8b7aabe6b626c",
... |
import io
import unittest
from unittest.mock import patch
from kattis import k_parsinghex
###############################################################################
class SampleInput(unittest.TestCase):
'''Problem statement sample inputs and outputs'''
def test_sample_input(self):
'''Run and ass... | {
"content_hash": "cb022d78a5dd04bb627e01a0d1801f6c",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 79,
"avg_line_length": 34.55882352941177,
"alnum_prop": 0.5387234042553192,
"repo_name": "ivanlyon/exercises",
"id": "00a815992f5c6bd303e567b8f101983e45827d56",
"size": "11... |
"""
Services for communicating with Hacker News REST API
and Hacker News Interval REST API
"""
import json
import requests
from models import JSONSerializable
class HTTPService(object):
"""
Abstract class service that implements common methods for
all HTTP services
"""
# Base url for the service
... | {
"content_hash": "0da554c8f29a24037fe9792f8ce1dd09",
"timestamp": "",
"source": "github",
"line_count": 164,
"max_line_length": 88,
"avg_line_length": 31.817073170731707,
"alnum_prop": 0.5962054426983519,
"repo_name": "kperusko/hacker-news-interval-worker",
"id": "188648eb547ab1a7c94a62acfc0847a3047e... |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='BlogPost',
fields=[
('id', models.AutoFi... | {
"content_hash": "1cf4d8239bd85ddbd1a2af051486d9d3",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 118,
"avg_line_length": 28.454545454545453,
"alnum_prop": 0.5383386581469649,
"repo_name": "Rut0/RutoApp",
"id": "7f10500ad454192d77f78dc22f0c2e74612c2276",
"size": "696",
... |
import tests.model_control.test_ozone_custom_models_enabled as testmod
testmod.build_model( ['Difference'] , ['ConstantTrend'] , ['Seasonal_WeekOfYear'] , ['ARX'] ); | {
"content_hash": "b1dee84bbc145dffd03f2082088f41b9",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 94,
"avg_line_length": 41.75,
"alnum_prop": 0.7245508982035929,
"repo_name": "antoinecarme/pyaf",
"id": "26d9f0be81e4fa02a28868ee5b18d728170c4c0d",
"size": "167",
"binary"... |
"""The tests the cover command line platform."""
import logging
import pytest
from homeassistant import setup
from homeassistant.components.cover import ATTR_POSITION, ATTR_TILT_POSITION, DOMAIN
from homeassistant.const import (
ATTR_ENTITY_ID,
SERVICE_CLOSE_COVER,
SERVICE_CLOSE_COVER_TILT,
SERVICE_OP... | {
"content_hash": "012fb5e4a5776cfc99d0adbdcd41952e",
"timestamp": "",
"source": "github",
"line_count": 1017,
"max_line_length": 103,
"avg_line_length": 34.64896755162242,
"alnum_prop": 0.45782961575571823,
"repo_name": "postlund/home-assistant",
"id": "9980691085bd8aab98e72b127e30aecc1d01fa09",
"s... |
import os, sys
sys.path.insert(0, os.getcwd())
import json
import platform
import subprocess
import sys
from glob import glob
VERSION = "v0.7"
import logging
logging.basicConfig(level=logging.INFO, format="[%(asctime)s %(filename)s:%(lineno)d %(levelname)s] %(message)s")
from code.common.system_list import system_... | {
"content_hash": "77e4de17b26781ff537c95c9573fc500",
"timestamp": "",
"source": "github",
"line_count": 271,
"max_line_length": 148,
"avg_line_length": 34.11439114391144,
"alnum_prop": 0.5846403461330449,
"repo_name": "mlperf/inference_results_v0.7",
"id": "166e0ce955818c1295355cf3c06469ed3cbd3e20",
... |
import cherrypy
import sys
import mysql.connector
from collections import OrderedDict
#Define database variables
DATABASE_USER = 'root'
DATABASE_HOST = '127.0.0.1'
DATABASE_NAME = 'feedND'
#Create connection to MySQL
cnx = mysql.connector.connect(user=DATABASE_USER, host=DATABASE_HOST, database=DATABASE_NAME)
cursor ... | {
"content_hash": "a5d23c478f846dd1a44a738dedf0cec3",
"timestamp": "",
"source": "github",
"line_count": 89,
"max_line_length": 93,
"avg_line_length": 24.696629213483146,
"alnum_prop": 0.586442220200182,
"repo_name": "zyz29/yzhou9-webapps",
"id": "760213ce9bf57514cc7f63e97e35d4ca368bfe7c",
"size": "... |
from ._visual import (Text, Line, Triangle, Rectangle, Circle, RawImage,
Diamond, ConcentricCircles, FixationDot, _convert_color,
_Triangular)
| {
"content_hash": "8f3b35fb23876440c3d9bb942005232e",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 78,
"avg_line_length": 62.333333333333336,
"alnum_prop": 0.5989304812834224,
"repo_name": "lkishline/expyfun",
"id": "72f528a4af02ebce178d8eaff3c4d528f5254f7a",
"size": "187... |
def method():
if True:
return 1
#begin nocover
else:
return 2
#end nocover
| {
"content_hash": "6fa8d903de27faba5758c59271e96090",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 18,
"avg_line_length": 15.285714285714286,
"alnum_prop": 0.514018691588785,
"repo_name": "cortesi/pry",
"id": "10ac026720c64e2fbd9c9fc4f422e73e337ab12f",
"size": "107",
"b... |
from ipaddress import IPv4Interface as IPv4Int
from nose.tools import assert_equals, assert_raises
from nettool.nettest import NetTest as nu
class TestConversion(object):
def setup(self):
self.netmasks = list()
self.wildcards = list()
for x in range(0, 33):
netmask = IPv4Int... | {
"content_hash": "978de9840ceae609beacee5a68007993",
"timestamp": "",
"source": "github",
"line_count": 115,
"max_line_length": 100,
"avg_line_length": 54.28695652173913,
"alnum_prop": 0.6650648726573762,
"repo_name": "heyglen/netobj",
"id": "0681f3f1b8bb06bd1058dad65ce2c71aded10079",
"size": "6272... |
import imp
from migrate.versioning import api
from app import db
from config import SQLALCHEMY_DATABASE_URI
from config import SQLALCHEMY_MIGRATE_REPO
migration=SQLALCHEMY_MIGRATE_REPO+'/versions/%03d_migration.py' % (api.db_version(SQLALCHEMY_DATABASE_URI,SQLALCHEMY_MIGRATE_REPO)+1)
tmp_module=imp.new_module('... | {
"content_hash": "2c21d35fd2556fdb924b5860773fd828",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 133,
"avg_line_length": 54,
"alnum_prop": 0.8,
"repo_name": "ljhandlwt/flask-study",
"id": "e237fb6f5a960decdf0759e5bc60375daa44c29b",
"size": "810",
"binary": false,
"... |
"""
Django settings for app project.
"""
DEBUG = True
ROOT_URLCONF = 'app'
MIDDLEWARE_CLASSES = []
SECRET_KEY = 'secret_key'
TIME_ZONE = 'UTC'
USE_TZ = True
| {
"content_hash": "14f6a805f4dca6e16b9ab53cd6b989ef",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 32,
"avg_line_length": 11.571428571428571,
"alnum_prop": 0.6481481481481481,
"repo_name": "vvv-v13/backend-tools",
"id": "c5f26513198b06918f13971f67d161b2989bb3bd",
"size":... |
import sys
from setuptools import setup, find_packages
from setuptools.command.test import test as testcommand
with open('test_requirements.txt') as test_reqs:
tests_require = test_reqs.readlines(),
class PyTest(testcommand):
user_options = testcommand.user_options[:]
user_options += [
('coverag... | {
"content_hash": "a571b39fa2635b143b476834322f8b44",
"timestamp": "",
"source": "github",
"line_count": 76,
"max_line_length": 76,
"avg_line_length": 29.473684210526315,
"alnum_prop": 0.6245535714285714,
"repo_name": "amir-qayyum-khan/PyLmod",
"id": "49ad80219e56888361adee4c77a7e02058583c01",
"size... |
from decimal import *
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import *
denoms = [
('denom_0.05', 0.05),
('denom_0.1', 0.1),
('denom_0.5', 0.5),
('denom_1', 1),
('denom_10', 10),
('denom_25', 25),
('denom_100', 100),
]
class ListSigmaMintVal... | {
"content_hash": "eb3fd79bacc9da30627c9614b1ecefbe",
"timestamp": "",
"source": "github",
"line_count": 61,
"max_line_length": 95,
"avg_line_length": 31.885245901639344,
"alnum_prop": 0.6231362467866324,
"repo_name": "zcoinofficial/zcoin",
"id": "bcf8321dae50c6337bedb230e021330f827b2cd6",
"size": "... |
"""Low-level http related exceptions."""
__all__ = ('HttpProcessingError',)
class HttpProcessingError(Exception):
"""HTTP error.
Shortcut for raising HTTP errors with custom code, message and headers.
:param int code: HTTP Error code.
:param str message: (optional) Error message.
:param list of... | {
"content_hash": "75e0e4a51bf680af4ad070aaa2c4f750",
"timestamp": "",
"source": "github",
"line_count": 78,
"max_line_length": 78,
"avg_line_length": 22.987179487179485,
"alnum_prop": 0.6162855549358617,
"repo_name": "singulared/aiohttp",
"id": "7cb422a04115613a4d7405b7609987dcfde7fdf4",
"size": "1... |
"""Classes to read RINEX files."""
import math
import warnings
from collections import namedtuple, defaultdict
from datetime import timedelta
from .dtutils import validate_epoch, get_microsec
from .glo import fetch_slot_freq_num, FetchSlotFreqNumError
from .gnss import *
from .tec import Tec
class ObsFile(object):
... | {
"content_hash": "437da68a0e90b28b32b36639b19980fa",
"timestamp": "",
"source": "github",
"line_count": 831,
"max_line_length": 79,
"avg_line_length": 31.492178098676295,
"alnum_prop": 0.4622850592281238,
"repo_name": "gnss-lab/gnss-tec",
"id": "5ec1da1f436da3bdb7ef7ae6c3553de903adfa02",
"size": "2... |
from pytest import warns
from dash import dcc, dash_table
def filter_dir(package):
ignore = [
"warnings",
"json",
"async_resources",
"package",
"package_name",
"f",
"express",
]
return sorted(
[
item
for item in dir(p... | {
"content_hash": "cb355bcc8af62cf54f47b252c0919988",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 84,
"avg_line_length": 21.904761904761905,
"alnum_prop": 0.55,
"repo_name": "plotly/dash",
"id": "08d7b14a23f3e92d47dc7fb2679a5002d715b029",
"size": "920",
"binary": fals... |
from __future__ import unicode_literals
from django.contrib import admin
from models import Project, TestSet, TestCase, TestStep, TestSetRun, TestCaseRun
admin.site.register(Project)
admin.site.register(TestSet)
admin.site.register(TestCase)
admin.site.register(TestStep)
admin.site.register(TestSetRun)
admin.site.reg... | {
"content_hash": "5c632ef888d2814b6d025d28cfcd1f8f",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 80,
"avg_line_length": 30.818181818181817,
"alnum_prop": 0.8230088495575221,
"repo_name": "Shibashisdas/testmanager-backend",
"id": "f67f4747d256d532f520aedec13d2eeaea313fab"... |
import os
import pathlib
import re
from collections.abc import Container, Iterable, Mapping, MutableMapping, Sized
from urllib.parse import unquote
import pytest
from yarl import URL
import aiohttp
from aiohttp import hdrs, web
from aiohttp.test_utils import make_mocked_request
from aiohttp.web import HTTPMethodNotAl... | {
"content_hash": "434c5990816012c60a7e2dc9fe8cd337",
"timestamp": "",
"source": "github",
"line_count": 1248,
"max_line_length": 79,
"avg_line_length": 31.692307692307693,
"alnum_prop": 0.6211569579288025,
"repo_name": "arthurdarcet/aiohttp",
"id": "632fd275d3c4d6fc820bd6865251703d216da70f",
"size"... |
"""Example use of NrvrCommander.
Idea and first implementation - Leo Baschy <srguiwiz12 AT nrvr DOT com>
Contributor - Nora Baschy
Public repository - https://github.com/srguiwiz/nrvr-commander
Copyright (c) Nirvana Research 2006-2015.
Simplified BSD License"""
import os.path
import shutil
import sys
import tempfi... | {
"content_hash": "1cd030a49576124ab93dee93ae611f63",
"timestamp": "",
"source": "github",
"line_count": 213,
"max_line_length": 143,
"avg_line_length": 49.38028169014085,
"alnum_prop": 0.756322494770869,
"repo_name": "srguiwiz/nrvr-commander",
"id": "6a15515ccd30a4409d9f4d4846daa536dc030f6c",
"size... |
"""
WSGI config for stereo8 project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/howto/deployment/wsgi/
"""
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "stereo8.settings")
from django.core.w... | {
"content_hash": "fcaadf4c2ae552bb8e21eeb5b5582735",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 78,
"avg_line_length": 27.785714285714285,
"alnum_prop": 0.7737789203084833,
"repo_name": "gjeck/stereo8",
"id": "84e02a60650d7872acd5cd458bca449e84dc956e",
"size": "389",
... |
import logging
from ppci.api import cc
logging.basicConfig(level=logging.DEBUG)
with open('main.c', 'r') as f:
obj = cc(f, 'x86_64', debug=True)
print('Object file created:', obj)
with open('hello.oj', 'w') as f:
obj.save(f)
| {
"content_hash": "95ee5ce3abecde93f7336f1d6199112e",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 40,
"avg_line_length": 21.454545454545453,
"alnum_prop": 0.6610169491525424,
"repo_name": "windelbouwman/ppci-mirror",
"id": "7828bf76360066b42e37032284d1eef08d6eefb9",
"si... |
from django.apps import AppConfig
from onthefly.monkey_patch import patch
class OntheflyConfig(AppConfig):
name = 'onthefly'
patched = False
def ready(self):
if not self.patched:
patch()
self.patched = True
| {
"content_hash": "393540e23cf4469cc22919d036567e78",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 39,
"avg_line_length": 19.615384615384617,
"alnum_prop": 0.6392156862745098,
"repo_name": "baranbartu/onthefly",
"id": "2b057bfece101f5be7263cbcaa11e12d77d7ef9d",
"size": "... |
import unittest
from katas.kyu_6.exercise_in_summing import maximum_sum, minimum_sum
class ExerciseInSummingTestCase(unittest.TestCase):
def test_equals(self):
self.assertEqual(minimum_sum([5, 4, 3, 2, 1], 2), 3)
def test_equals_2(self):
self.assertEqual(maximum_sum([5, 4, 3, 2, 1], 3), 12)
... | {
"content_hash": "e1f7371a786b23361c8b48062039e00e",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 68,
"avg_line_length": 28.823529411764707,
"alnum_prop": 0.636734693877551,
"repo_name": "the-zebulan/CodeWars",
"id": "f2f7298865f53f1486356d05b8ee27593dc2bb17",
"size": "... |
from __future__ import print_function
from collections import defaultdict
import json
import socket
import sys
import geoip2.database
eppn_domains = defaultdict(int)
email_domains = defaultdict(int)
def process_email(x):
parts = x.split('@')
if len(parts) != 2:
print('error: %r' % (x), file=sys.stde... | {
"content_hash": "4e6f9d12dae78b8a892d963b9a54509f",
"timestamp": "",
"source": "github",
"line_count": 85,
"max_line_length": 77,
"avg_line_length": 28.647058823529413,
"alnum_prop": 0.5835728952772073,
"repo_name": "GENI-NSF/geni-demoviz",
"id": "df398332e40ec33b5b0111f1569dfd59c32dd50d",
"size":... |
import re
import sys
import pysam
from subprocess import Popen, PIPE
from collections import defaultdict
import pickle
pi_IN="/lscr2/andersenlab/kml436/git_repos2/Transposons2/files/WB_piRNA_positions.gff"
reference="/lscr2/andersenlab/kml436/sv_sim2/c_elegans.PRJNA13758.WS245.genomic.fa"
pi_fasta="/lscr2/andersenlab... | {
"content_hash": "1db5371cc444d2567fa1cbe440def717",
"timestamp": "",
"source": "github",
"line_count": 212,
"max_line_length": 178,
"avg_line_length": 36.54716981132076,
"alnum_prop": 0.697212183789365,
"repo_name": "klaricch/Transposons2",
"id": "a485a01d3ea8b71e2f90059e3db8d33361f3886f",
"size":... |
"""
sentry_kafka.models
~~~~~~~~~~~~~~~~~~~~~
"""
from django import forms
from django.conf import settings
from django.core import (validators, exceptions)
from kafka import KafkaClient, SimpleProducer
from sentry.plugins.bases.notify import NotifyPlugin
import sentry_kafka
import json
import re
import types
def... | {
"content_hash": "a9fe683ae852ac5c3bfed4d10ae7a510",
"timestamp": "",
"source": "github",
"line_count": 136,
"max_line_length": 113,
"avg_line_length": 39.5,
"alnum_prop": 0.6191362620997766,
"repo_name": "Banno/getsentry-kafka",
"id": "4e5218f58c6b2b47d8710a5072e112a6a0e3f463",
"size": "5372",
"... |
import xml.etree.ElementTree as et
class Include:
"""Meta plugin that allows you to include other config files, will be declared as <obj type="Include" config="other"/> A name is not needed."""
def __init__(self, xml):
# Get the name of the config to load...
self.config = xml.get('config')
... | {
"content_hash": "da976c2497431986e46c0242617ab521",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 147,
"avg_line_length": 27.233333333333334,
"alnum_prop": 0.591187270501836,
"repo_name": "gamingrobot/second-sunrise",
"id": "09a52d13ae0a1fb6dfe62df71c2fccefac638d40",
"s... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.