text stringlengths 4 1.02M | meta dict |
|---|---|
"""
sphinx.util
~~~~~~~~~~~
Utility functions for Sphinx.
:copyright: Copyright 2007-2013 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import os
import re
import sys
import shutil
import fnmatch
import tempfile
import posixpath
import traceback
import unicodedata
f... | {
"content_hash": "c157fe61c7af96e486e50d916e266701",
"timestamp": "",
"source": "github",
"line_count": 438,
"max_line_length": 79,
"avg_line_length": 31.799086757990867,
"alnum_prop": 0.5955628948879954,
"repo_name": "SurfasJones/icecream-info",
"id": "a20fc19be8c0684dc5fe5bd54e0e64b2d1f4521b",
"s... |
# -*- coding: utf-8 -*-
# ProjectEuler/src/python/problem298.py
#
# Selective Amnesia
# =================
# Published on Friday, 25th June 2010, 09:00 pm
#
# table.p298, table.p298 th, table.p298 td { border-width: 1px 1px 1px 1px;
# border-style: solid solid solid solid; border-color: black black black
# black;... | {
"content_hash": "8fb84088e4b0d3e97509f652924e61a7",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 79,
"avg_line_length": 52.53846153846154,
"alnum_prop": 0.6837481698389458,
"repo_name": "olduvaihand/ProjectEuler",
"id": "a6f7d70a34b42d708cc2d749e0df978189abbd97",
"size... |
"""
Defines tasks for uwsgi to run at regular intervals
"""
import datetime
import os
import uwsgidecorators
from flask import Flask
import model
from database import db_session
EXECUTOR_TIMEOUT_MINS = 3
@uwsgidecorators.timer(15, target="spooler")
def reset_overdue_runs(signum):
app = Flask(__name__)
app... | {
"content_hash": "4c67ffabb435b6ec5ac0ba86c2cbc13e",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 88,
"avg_line_length": 24.263157894736842,
"alnum_prop": 0.6767895878524945,
"repo_name": "BenDoan/code_court",
"id": "69e20d3d5679dbb31d9e01cec8b38eb10f6ff3dd",
"size": "9... |
import logging
logging.basicConfig(level=logging.ERROR)
try:
import cmt.ee_authenticate
except:
import sys
import os.path
sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), '..'))
import cmt.ee_authenticate
import matplotlib
#matplotlib.use('tkagg')
import sys
import os
impor... | {
"content_hash": "85c10f07b31b5a2c414eca9630757eae",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 107,
"avg_line_length": 26.363636363636363,
"alnum_prop": 0.7183908045977011,
"repo_name": "nasa/CrisisMappingToolkit",
"id": "4d65c3bf094c9208e5e384172c37a8da837407de",
"s... |
import sys
from QueryPublic import QueryPublicBitfinex
from Trade import Trade, TradeListBitfinex
from DBConnections import BitfinexDBConnection
from time import sleep
from datetime import datetime, timedelta
query = QueryPublicBitfinex()
with BitfinexDBConnection() as dbconn:
try:
cursor = dbconn.cursor... | {
"content_hash": "2a70aaf7f1b127fae6c60f2b09b4a332",
"timestamp": "",
"source": "github",
"line_count": 46,
"max_line_length": 109,
"avg_line_length": 33.73913043478261,
"alnum_prop": 0.6746134020618557,
"repo_name": "sebschre/cryptoAssetManager",
"id": "388969ec7e2c7a15d88e0f350d420e47052a5f5a",
"... |
"""Parses .swood files."""
# See https://github.com/milkey-mouse/swood/issues/1
from os.path import normpath, abspath, dirname, join
from collections import defaultdict
from enum import Enum
from PIL.Image import BILINEAR
from .sample import Sample
from .instruments import *
from . import complain
import zipfile
imp... | {
"content_hash": "5cb94d9046b315fa56da9967650b2b7d",
"timestamp": "",
"source": "github",
"line_count": 322,
"max_line_length": 126,
"avg_line_length": 43.64596273291925,
"alnum_prop": 0.5062615625444713,
"repo_name": "milkey-mouse/swood",
"id": "830c27064a98b307b9c9f341da7c1b6ad637040e",
"size": "... |
"""
This is an implementation of decimal floating point arithmetic based on
the General Decimal Arithmetic Specification:
http://speleotrove.com/decimal/decarith.html
and IEEE standard 854-1987:
http://en.wikipedia.org/wiki/IEEE_854-1987
Decimal floating point has finite precision with arbitrarily large bou... | {
"content_hash": "36c6c6caf0879f6808f0c7362ced0cda",
"timestamp": "",
"source": "github",
"line_count": 6391,
"max_line_length": 100,
"avg_line_length": 35.65780003129401,
"alnum_prop": 0.5511367376222635,
"repo_name": "xyuanmu/XX-Net",
"id": "c14d8ca86a1181d951048b2fb939560793b1bb64",
"size": "228... |
"""settings.py
Udacity conference server-side Python App Engine app user settings
$Id$
created/forked from conference.py by wesc on 2014 may 24
"""
# Replace the following lines with client IDs obtained from the APIs
# Console or Cloud Console.
WEB_CLIENT_ID = '897025632095-df4358n84k27aaf0rj0dff52db4dtgh8.apps.go... | {
"content_hash": "d2d403575dcb61824f171a66a195814e",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 90,
"avg_line_length": 29.5,
"alnum_prop": 0.7860169491525424,
"repo_name": "zacharytamas/udacity-courses",
"id": "31663ec939a5bea412ceabbdb8ee48e4be6be71a",
"size": "495",... |
from blogMiddleware import BlogMiddleware
urls = [(r"^/blog/(\d{4})/(\d{2})/(\d{2})$", BlogMiddleware)]
| {
"content_hash": "4d74ad8c5e14b6bfa44471fe72c20123",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 61,
"avg_line_length": 35,
"alnum_prop": 0.638095238095238,
"repo_name": "tobi-weber/levitas",
"id": "d8f46b2adec3dd16225560865c9a4749f584425f",
"size": "129",
"binary": f... |
"""
Created on Thu Apr 16 07:59:47 2015
@author: Richard Decal
bootstrapping on upwind-left vs -right quadrants.
To compare upwind positional distributions, we examined the percentage of trajectory
positions found in the left half of the wind tunnel. For each experimental condition,
we can calculate this left side ... | {
"content_hash": "a1c4e29a5a6c08a6a96dfd148dff6a78",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 93,
"avg_line_length": 57.22222222222222,
"alnum_prop": 0.8003883495145631,
"repo_name": "isomerase/mozziesniff",
"id": "5bec6e728c6c20f104ff3a399ea2bcbfa9263e38",
"size": ... |
from random import choice
from flask import Flask, json, Response, request
from flask.views import MethodView
from flask_sqlalchemy import SQLAlchemy
class ApiFlask(Flask):
def make_response(self, rv):
if isinstance(rv, ApiResult):
return rv.to_response()
return Flask.make_response(... | {
"content_hash": "8581899b323359ca3497ef3862e28e78",
"timestamp": "",
"source": "github",
"line_count": 174,
"max_line_length": 83,
"avg_line_length": 27.396551724137932,
"alnum_prop": 0.5980700650304175,
"repo_name": "kryptn/Fortunate",
"id": "d3491eaf730c34d896488ba2016d584e74572c2e",
"size": "47... |
from setuptools import setup, find_packages
from imp import load_source
setup(
name='webassets-traceur',
version=load_source('', 'webassets_traceur/_version.py').__version__,
description='An additional webassets filter to compile ES6 to ES5 '
'using traceur.',
classifiers=[
'De... | {
"content_hash": "04d1a1de4e629af6a3750b4119baf941",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 73,
"avg_line_length": 34.37931034482759,
"alnum_prop": 0.6168505516549649,
"repo_name": "concordusapps/webassets-traceur",
"id": "f99893137f1eeaf6d85824a17d945a6560a9d80a",
... |
import sys
firstline = sys.stdin.readline()
current_ID = firstline.split()[0]
distance_buffer=firstline.split()[2]
gene_buffer=[firstline.split()[1]]
strand_buffer={firstline.split()[3]}
for line in sys.stdin:
ID=line.split()[0]
distance=line.split()[2]
gene=line.split()[1]
strand=line.split()[3]
i... | {
"content_hash": "fd2ff48d81b68afcbbd70f983999e89c",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 93,
"avg_line_length": 29.84,
"alnum_prop": 0.6420911528150134,
"repo_name": "corcra/feabhsa-here",
"id": "df4eaf032816bad1d6952fd435abf830277a72dc",
"size": "855",
"bina... |
User_Specified_Output_Folder = "BingWallpapers/"
# Iterate through days
for whatday in range(-7,2):
whatday = 0-whatday
# Import modules
import os,datetime,re,calendar,urllib.request,shutil
# Print starting message
print("------Process Started------")
# Function to find out "Month" and "Day" value
def findmonthd... | {
"content_hash": "de56c3ad5ce3326a07bada2108e3d1bd",
"timestamp": "",
"source": "github",
"line_count": 72,
"max_line_length": 145,
"avg_line_length": 35.416666666666664,
"alnum_prop": 0.6945098039215686,
"repo_name": "dlfbdnd/Bing-Wallpaper-Downloader",
"id": "11ea9817d6b7ef9f38f704a419677c7077276c3... |
import unittest
import paddle.fluid as fluid
import paddle.fluid.profiler as profiler
import numpy
class BaseParallelForTest(unittest.TestCase):
def run_test(self, callback, feed, fetch):
"""
Run the unittest for parallel.for
Args:
callback(callable): A callable function retur... | {
"content_hash": "66a98e2d126b210c325e40ff962ce546",
"timestamp": "",
"source": "github",
"line_count": 214,
"max_line_length": 80,
"avg_line_length": 33.700934579439256,
"alnum_prop": 0.5073488630061009,
"repo_name": "lcy-seso/Paddle",
"id": "79bea148f9398152a02d70946cdc5fff1f47ba6b",
"size": "782... |
import unittest
from telemetry.timeline import tracing_category_filter
from telemetry.timeline import tracing_config
class TracingConfigTests(unittest.TestCase):
def testDefault(self):
config = tracing_config.TracingConfig()
config_string = config.GetChromeTraceConfigJsonString()
self.assertEquals(
... | {
"content_hash": "d2fbcaa78bb56f71a40922b31e32d24b",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 68,
"avg_line_length": 34.303030303030305,
"alnum_prop": 0.6563604240282686,
"repo_name": "XiaosongWei/chromium-crosswalk",
"id": "dc79c56b8d6795dbc5eb2a3e380f73db03f12bfe",
... |
from django.shortcuts import render
from django.http import HttpResponse
from qiniuyun.backend import QiniuPush
from qiniuyun.models import ImageAtQiniu
from .indexView import ImgList
from DJangoHotel.models import Order,RoomInfo,Customer
import time
import datetime
from random import randint
def orderResult(request):... | {
"content_hash": "d906bb9bea1310cb8ef8fa55a9dd5b3d",
"timestamp": "",
"source": "github",
"line_count": 60,
"max_line_length": 81,
"avg_line_length": 31.383333333333333,
"alnum_prop": 0.648964418481147,
"repo_name": "williezh/hotelbooksystem",
"id": "6047ab3e66d799e42d114ff716cc37996679c605",
"size... |
import abc
from typing import Awaitable, Callable, Optional, Sequence, Union
import pkg_resources
import google.auth # type: ignore
import google.api_core # type: ignore
from google.api_core import exceptions as core_exceptions # type: ignore
from google.api_core import gapic_v1 # type: ignore
from google.api_core... | {
"content_hash": "12c226a37a940985bcab9c9dd563c292",
"timestamp": "",
"source": "github",
"line_count": 143,
"max_line_length": 101,
"avg_line_length": 38.43356643356643,
"alnum_prop": 0.6235443959243085,
"repo_name": "googleads/google-ads-python",
"id": "9980c26bd7b050d8d81e2d3719dcd311a671f40d",
... |
import base64
import datetime
import StringIO
import time
import urllib
from apiclient.http import MediaIoBaseUpload
from google.appengine.api import app_identity
from googleapiclient.discovery import build
from oauth2client.client import GoogleCredentials
import config
import utils
class CloudStorage(object):
... | {
"content_hash": "420e4eee681ca333bf7238aeb15b5260",
"timestamp": "",
"source": "github",
"line_count": 152,
"max_line_length": 93,
"avg_line_length": 38.32236842105263,
"alnum_prop": 0.590557939914163,
"repo_name": "gimite/personfinder",
"id": "e10880959ec8188fa2afead97ac69385523278b7",
"size": "6... |
import theano
import theano.tensor as T
import numpy
import unittest
from yann.core.operators import copy_params
class TestOperators(unittest.TestCase):
def test_copy_params(self):
numpy.random.seed(0)
self.verbose = 3
self.input_ndarray = numpy.random.rand(1, 1, 10, 10)
self.input... | {
"content_hash": "0158f60360443222146542f3c6c36a5f",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 100,
"avg_line_length": 39.526315789473685,
"alnum_prop": 0.6830892143808256,
"repo_name": "ragavvenkatesan/Convolutional-Neural-Networks",
"id": "b4f64f9d1eef0d3c19a1d305bae... |
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import signal
import sys
from contextlib import contextmanager
from pants.java.nailgun_client import NailgunClient
from pants.java.nailgun_protocol import NailgunProt... | {
"content_hash": "ca37bd64905bb8f83a2235a43b3b8bc4",
"timestamp": "",
"source": "github",
"line_count": 78,
"max_line_length": 98,
"avg_line_length": 38.87179487179487,
"alnum_prop": 0.7074538258575198,
"repo_name": "manasapte/pants",
"id": "fa8325bb2b18bba2ef89ea26c8e61fe0567a2bdb",
"size": "3179"... |
"""
Configurator for Home Assistant.
https://github.com/danielperna84/hass-configurator
"""
import os
import sys
import json
import ssl
import socketserver
import base64
import ipaddress
import signal
import cgi
import shlex
import subprocess
import logging
import fnmatch
from string import Template
from http.server im... | {
"content_hash": "5ff76de227d01db24bda2e28315b38fd",
"timestamp": "",
"source": "github",
"line_count": 3623,
"max_line_length": 363,
"avg_line_length": 45.12669058791057,
"alnum_prop": 0.4956451001259985,
"repo_name": "vinjex/home-assistant",
"id": "42e8eafc28edcc045ed221de9953abe582202866",
"size... |
"""
This module contains useful utilities for GeoDjango.
"""
from django.contrib.gis.gdal import HAS_GDAL
from django.contrib.gis.utils.wkt import precision_wkt # NOQA
from django.core.exceptions import ImproperlyConfigured
if HAS_GDAL:
from django.contrib.gis.utils.ogrinfo import ogrinfo # NOQA
from django... | {
"content_hash": "ebbb1a704529a4c15ef0ce1396c52448",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 93,
"avg_line_length": 41.88235294117647,
"alnum_prop": 0.7429775280898876,
"repo_name": "tlksio/tlksio",
"id": "78b221663fc139ca0af41fdd8ae837080647adcf",
"size": "712",
... |
from robot.utils import is_string, py2to3, PY3
from .comments import Comment
if PY3:
unicode = str
@py2to3
class Setting(object):
def __init__(self, setting_name, parent=None, comment=None):
self.setting_name = setting_name
self.parent = parent
self._set_initial_value()
sel... | {
"content_hash": "4d0976dccd3b0856b1607e7b110309e0",
"timestamp": "",
"source": "github",
"line_count": 372,
"max_line_length": 80,
"avg_line_length": 26.258064516129032,
"alnum_prop": 0.5854832104832105,
"repo_name": "snyderr/robotframework",
"id": "86916e7338171b482d5ab5e325b63336772f10c4",
"size... |
import pytest
from libqtile import layout
import libqtile.manager
import libqtile.config
from ..conftest import no_xinerama
from .layout_utils import assertFocused, assertFocusPath
class MatrixConfig(object):
auto_fullscreen = True
main = None
groups = [
libqtile.config.Group("a"),
libqti... | {
"content_hash": "92f341327a391a57bd97fa14d405ff4a",
"timestamp": "",
"source": "github",
"line_count": 107,
"max_line_length": 90,
"avg_line_length": 29.317757009345794,
"alnum_prop": 0.641695887790883,
"repo_name": "cortesi/qtile",
"id": "5c09eb8d37a128325515e0054b3c8f029a430040",
"size": "4475",... |
""" Copyright (c) <2014> Author Vance King Saxbe. A, and contributors Power Dominion Enterprise, Precieux Consulting and other contributors. Modelled, Architected and designed by Vance King Saxbe. A. with the geeks from GoldSax Consulting and GoldSax Technologies email @vsaxbe@yahoo.com. Development teams from Power Do... | {
"content_hash": "ef9432f6614e60f785bca7ecbe30a606",
"timestamp": "",
"source": "github",
"line_count": 72,
"max_line_length": 472,
"avg_line_length": 53.625,
"alnum_prop": 0.5625485625485626,
"repo_name": "VanceKingSaxbeA/EconometricIntelligence",
"id": "492689bbf8566f500cbd6eee77e25c29c11376ad",
... |
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'Logo.visibility_level'
db.add_column(u'communication_logo', 'visibility_level',
... | {
"content_hash": "d043eb7046219207545da93028b16022",
"timestamp": "",
"source": "github",
"line_count": 136,
"max_line_length": 195,
"avg_line_length": 74.29411764705883,
"alnum_prop": 0.5503760886777513,
"repo_name": "ArcaniteSolutions/truffe2",
"id": "a0d59a059a4949baf5d52e9e3df25a25718eab16",
"s... |
"""Consume and serialize all of the data from a running TensorBoard instance.
This program connects to a live TensorBoard backend at given port, and saves
all of the data to local disk JSON in a predictable format.
This makes it easy to mock out the TensorBoard backend so that the frontend
may be tested in isolation.... | {
"content_hash": "2eb14be1ad9c435af4a5c5f7893b13e0",
"timestamp": "",
"source": "github",
"line_count": 206,
"max_line_length": 79,
"avg_line_length": 32.63592233009709,
"alnum_prop": 0.6486687490703555,
"repo_name": "Lab603/PicEncyclopedias",
"id": "3feca406cc59adf71d4bbfa25da2fdadd6184d65",
"size... |
import json
from typing import Optional
import pytest
from mock import Mock
from pygls.lsp.types import (DidCloseTextDocumentParams,
DidOpenTextDocumentParams, TextDocumentIdentifier,
TextDocumentItem)
from pygls.workspace import Document, Workspace
from ...se... | {
"content_hash": "16ad97f2f9e8df51ffef4d9f62e21d48",
"timestamp": "",
"source": "github",
"line_count": 94,
"max_line_length": 79,
"avg_line_length": 26.79787234042553,
"alnum_prop": 0.6621675267963477,
"repo_name": "openlawlibrary/pygls",
"id": "6453c51304501245f85758f535c561903ff86ed5",
"size": "... |
import bibleIn
import tldrnewsIn
import weatherIn
import calebIn
import bibleProc
import tldrnewsProc
import weatherProc
import calebAmountsProc
import calebSupportersProc
import textOut
kindle = "/media/toben/Kindle/documents/"
#kindle = '/home/toben/Code/Little-News-Processor/'
def run():
caleb_data = calebIn.fe... | {
"content_hash": "1ca1f0e18ec099b85fdcef7526a03f2a",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 54,
"avg_line_length": 22.102564102564102,
"alnum_prop": 0.7587006960556845,
"repo_name": "Narcolapser/Little-News-Processor",
"id": "1decfc89b40100b4af98e2e6e461a1dac51e53db... |
"""
Sample Google App Engine application that demonstrates using the Users API
For more information about App Engine, see README.md under /appengine.
"""
# [START all]
from google.appengine.api import users
import webapp2
class MainPage(webapp2.RequestHandler):
def get(self):
user = users.get_current_u... | {
"content_hash": "3c4772bf2fb231c5e5c565fa4e849109",
"timestamp": "",
"source": "github",
"line_count": 46,
"max_line_length": 74,
"avg_line_length": 27.630434782608695,
"alnum_prop": 0.5837922895357985,
"repo_name": "clarko1/Cramd",
"id": "7904a20c44284db3241f6b6fcfb29b1197cb2d9b",
"size": "1847",... |
from __future__ import absolute_import
from typing import Any, Iterable, List, Mapping, Set, Text, Tuple
from django.http import HttpRequest, HttpResponse
from django.utils.translation import ugettext as _
from zerver.lib.actions import check_stream_name, create_streams_if_needed
from zerver.lib.request import Jsona... | {
"content_hash": "667b9d302200e30e881989d4c2e4f185",
"timestamp": "",
"source": "github",
"line_count": 161,
"max_line_length": 98,
"avg_line_length": 42.98757763975155,
"alnum_prop": 0.6657997399219766,
"repo_name": "christi3k/zulip",
"id": "96c22be0106fead4dce433b636b7bd87638f891e",
"size": "6921... |
from fake_useragent import UserAgent
def get_random_agent_headers():
headers = {
"User-Agent": UserAgent().chrome,
"Referer": "https://www.baidu.com/"
}
return headers | {
"content_hash": "0ca3631383cedbc0e4f6b5d5382d2e3d",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 43,
"avg_line_length": 24.5,
"alnum_prop": 0.6275510204081632,
"repo_name": "hbbhbbh/TmallSingleCrawler",
"id": "2f5e9ca07ffa902f198533702a1e3bf02cd31299",
"size": "196",
... |
import collections
import os
import re
import tracing_project
from tracing_build import check_common
class _Token(object):
def __init__(self, data, token_id=None):
self.data = data
if token_id:
self.token_id = token_id
else:
self.token_id = 'plain'
class BuildFile(object):
def __init_... | {
"content_hash": "32f6e19944a010ca37e51f9e735e0da4",
"timestamp": "",
"source": "github",
"line_count": 119,
"max_line_length": 75,
"avg_line_length": 28.10924369747899,
"alnum_prop": 0.6385650224215247,
"repo_name": "catapult-project/catapult",
"id": "4151ea7a6ac38a681d74a42cc77fd03aea81fcff",
"si... |
import copy
import datetime
import os
import uuid
import eventlet.event
from oslo_config import cfg
from oslo_log import log as logging
from six.moves import urllib
from yaql import specs
import murano.common.exceptions as exceptions
import murano.common.messaging as messaging
from murano.dsl import dsl
import murano... | {
"content_hash": "45ce59d22afa486c153aa30f23baf104",
"timestamp": "",
"source": "github",
"line_count": 320,
"max_line_length": 78,
"avg_line_length": 33.80625,
"alnum_prop": 0.5501016823812165,
"repo_name": "olivierlemasle/murano",
"id": "32ef701de3adf3a5f60c9b2815f0875432a35952",
"size": "11401",... |
import random
import re
import unittest
import warnings
import requests
from ruamel.yaml import YAML
from pymatgen.analysis.phase_diagram import PhaseDiagram
from pymatgen.analysis.pourbaix_diagram import PourbaixDiagram, PourbaixEntry
from pymatgen.analysis.reaction_calculator import Reaction
from pymatgen.analysis.... | {
"content_hash": "e42b68c0501893faf161d4fd95c7ffe4",
"timestamp": "",
"source": "github",
"line_count": 519,
"max_line_length": 120,
"avg_line_length": 44.14643545279383,
"alnum_prop": 0.6158781424581006,
"repo_name": "gVallverdu/pymatgen",
"id": "4668511dca2f18610de127d7bf88a0ac8490fb05",
"size": ... |
"""
使用协程实现生产者-消费者的例子
"""
import asyncio
import random
async def consumer(queue, id):
while True:
val = await queue.get()
print('{} get a val: {}'.format(id, val))
await asyncio.sleep(1)
async def producer(queue, id):
for i in range(5):
val = random.randint(1, 10)
awa... | {
"content_hash": "7b996daefead394bc3b25de2bc2a638a",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 96,
"avg_line_length": 22.952380952380953,
"alnum_prop": 0.6224066390041494,
"repo_name": "yidao620c/core-python",
"id": "221c6d69b86d5c82c8e760d54d81138f526aa85e",
"size":... |
import unittest
import tkinter
from tkinter import font
from test.support import requires, run_unittest
from tkinter.test.support import AbstractTkTest
requires('gui')
fontname = "TkDefaultFont"
class FontTest(AbstractTkTest, unittest.TestCase):
@classmethod
def setUpClass(cls):
AbstractTkTest.setUp... | {
"content_hash": "a7216e67782f723318dd87b8420f1f6c",
"timestamp": "",
"source": "github",
"line_count": 87,
"max_line_length": 77,
"avg_line_length": 37.97701149425287,
"alnum_prop": 0.6343825665859564,
"repo_name": "juanyaw/python",
"id": "ba3b9da498b770c28fef60f2032fd52f9c624783",
"size": "3304",... |
from collections import OrderedDict
from functools import partial
from django.template import RequestContext
from django.template.loader import render_to_string
from django.core.urlresolvers import reverse
from django import template
from django.utils.html import escape
from couchdbkit.exceptions import ResourceNotFou... | {
"content_hash": "1474bee07ded36cd98866ac588d3e748",
"timestamp": "",
"source": "github",
"line_count": 235,
"max_line_length": 112,
"avg_line_length": 34.50212765957447,
"alnum_prop": 0.6185249136655155,
"repo_name": "qedsoftware/commcare-hq",
"id": "7575fd3756a6ea46781f550847a093de5365ef4b",
"siz... |
"""
:mod:`packet_base` --- Packet base class
========================================
"""
# Stdlib
import struct
from abc import ABCMeta, abstractmethod
# External
import capnp
# SCION
import proto.scion_capnp as P
from lib.errors import SCIONParseError
from lib.util import hex_str
class Serializable(object, metacl... | {
"content_hash": "f5a735a1ca978d117f733e41ad526930",
"timestamp": "",
"source": "github",
"line_count": 231,
"max_line_length": 76,
"avg_line_length": 25.393939393939394,
"alnum_prop": 0.5801227412205933,
"repo_name": "dmpiergiacomo/scion",
"id": "9d34e04667e9463e13cef90384d7417059ea01ff",
"size": ... |
import ibis
from ibis.compat import unittest
from ibis.expr.tests.mocks import BasicTestCase
import ibis.expr.analysis as L
import ibis.expr.operations as ops
import ibis.common as com
from ibis.tests.util import assert_equal
# Place to collect esoteric expression analysis bugs and tests
class TestTableExprBasics... | {
"content_hash": "068a5fdbedfaa28d81256f9c7b3176b8",
"timestamp": "",
"source": "github",
"line_count": 270,
"max_line_length": 79,
"avg_line_length": 33.13703703703704,
"alnum_prop": 0.5471107633843747,
"repo_name": "mariusvniekerk/ibis",
"id": "5a3ebc02c8e88912922f7af3132b060f626226b3",
"size": "... |
from setuptools import setup, find_packages
from setuptools.command import sdist
del sdist.finders[:]
CPSVERSION = '1.2.0'
long_description = """
ConPaaS: an integrated runtime environment for elastic Cloud applications
=========================================================================
"""
setup(name='cpslib'... | {
"content_hash": "8e06832ba6e08a5f592c80d1b6a5d794",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 94,
"avg_line_length": 36.85,
"alnum_prop": 0.6268656716417911,
"repo_name": "mihaisoloi/conpaas",
"id": "4b31adc3ff039926690e2d729b33dedae3a1ecc5",
"size": "760",
"binar... |
from keystoneclient import exceptions
from keystoneclient.tests.v3 import utils
from keystoneclient.v3 import role_assignments
class RoleAssignmentsTests(utils.TestCase, utils.CrudTests):
def setUp(self):
super(RoleAssignmentsTests, self).setUp()
self.key = 'role_assignment'
self.collecti... | {
"content_hash": "712bc63ca39a98af00bdf0c4b779a90b",
"timestamp": "",
"source": "github",
"line_count": 198,
"max_line_length": 79,
"avg_line_length": 37.378787878787875,
"alnum_prop": 0.5501959194703419,
"repo_name": "alexpilotti/python-keystoneclient",
"id": "f47d9ec6096106123c8bcd21c4144686b3643b2... |
from django.conf.urls import patterns, url
urlpatterns = patterns(
'home.views',
url(r'^$', 'home', name='home'),
)
| {
"content_hash": "754afecd28c8e74e37130432e35970e4",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 42,
"avg_line_length": 18,
"alnum_prop": 0.626984126984127,
"repo_name": "Codectivo/Incubu",
"id": "73b24b7969a56cd25041d9caec84eb401c5de1a0",
"size": "126",
"binary": fal... |
import os
import asyncio
import discord
import logging
from discord.ext import commands
from cogs.utils.dataIO import dataIO
from cogs.utils import checks
from __main__ import settings
from cogs.utils.chat_formatting import box, pagify
log = logging.getLogger('red.ServerWhitelist')
class ServerWhitelist:
"""
... | {
"content_hash": "b13f19a89b68138cf72cbcee58ddf97a",
"timestamp": "",
"source": "github",
"line_count": 213,
"max_line_length": 79,
"avg_line_length": 36.71830985915493,
"alnum_prop": 0.5350978135788262,
"repo_name": "Garcia1008/tournament",
"id": "3d141f11982f35902453aec985ac1e0f1a677ecc",
"size":... |
from proton import Message, symbol
from system_test import TestCase, Qdrouterd, main_module, TIMEOUT, unittest, TestTimeout
from proton.handlers import MessagingHandler
from proton.reactor import Container
class AddrTimer(object):
def __init__(self, parent):
self.parent = parent
def on_timer_task(sel... | {
"content_hash": "d2279f100a39c5c6ce566947836a1306",
"timestamp": "",
"source": "github",
"line_count": 364,
"max_line_length": 127,
"avg_line_length": 40.832417582417584,
"alnum_prop": 0.5091838794321469,
"repo_name": "mgoulish/qpid-dispatch",
"id": "29171f0c07c5d40918ffe7710a945138d516f63e",
"siz... |
from ..excel_comparsion_test import ExcelComparisonTest
from ...workbook import Workbook
class TestCompareXLSXFiles(ExcelComparisonTest):
"""
Test file created by XlsxWriter against a file created by Excel.
"""
def setUp(self):
self.maxDiff = None
filename = 'chart_display_units06.x... | {
"content_hash": "a5e423dce91b41b48db92ef347aabcee",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 83,
"avg_line_length": 26.404255319148938,
"alnum_prop": 0.6107977437550363,
"repo_name": "applicationdevm/XlsxWriter",
"id": "8a78b17425deea24f5bf6cf1d1576328175ee133",
"s... |
import unittest
from hwt.hdl.statements.assignmentContainer import HdlAssignmentContainer
from hwt.hdl.statements.statement import HdlStatement
from hwtLib.examples.axi.oooOp.counterHashTable import OooOpExampleCounterHashTable
from hwtLib.examples.mem.ram import SimpleAsyncRam
from hwtLib.examples.statements.ifStm im... | {
"content_hash": "1d65607067f9bf6468a871cb593f29af",
"timestamp": "",
"source": "github",
"line_count": 74,
"max_line_length": 83,
"avg_line_length": 35.851351351351354,
"alnum_prop": 0.6637768563889936,
"repo_name": "Nic30/hwtLib",
"id": "80f67d51cf6491bf031e35825032f12819ed98c1",
"size": "2701",
... |
class CachingBase(object):
class __metaclass__(type):
def __new__(cls, name, bases, dct):
dct = dict(dct)
dct['_cache'] = dict()
return type.__new__(cls, name, bases, dct)
def __new__(cls, *args):
key = cls.get_key(*args)
try:
return cls.... | {
"content_hash": "a8da3da5491fed8d279a003c858ac0c7",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 56,
"avg_line_length": 27.941176470588236,
"alnum_prop": 0.48,
"repo_name": "matthagy/Jamenson",
"id": "0f10210b6209ad6eb4bc9aa0a786f28149df0744",
"size": "477",
"binary"... |
import cv2
import os
def save_frame_play(video_path, dir_path, basename, ext='jpg', delay=1, window_name='frame'):
cap = cv2.VideoCapture(video_path)
if not cap.isOpened():
return
os.makedirs(dir_path, exist_ok=True)
base_path = os.path.join(dir_path, basename)
digit = len(str(i... | {
"content_hash": "39015ab1f85f6b1b642559ed6a39e32e",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 93,
"avg_line_length": 27.352941176470587,
"alnum_prop": 0.543010752688172,
"repo_name": "nkmk/python-snippets",
"id": "1aa35b42fd1ffb914598d84538ea54d001f74c45",
"size": "... |
import time
import unittest
from unittest.mock import MagicMock
from unittest.mock import patch
import apache_beam as beam
from apache_beam import coders
from apache_beam.options.pipeline_options import PipelineOptions
from apache_beam.portability.api import beam_interactive_api_pb2
from apache_beam.runners.interactiv... | {
"content_hash": "87a26d99bd2a39a601d0f8d8a06080fa",
"timestamp": "",
"source": "github",
"line_count": 553,
"max_line_length": 89,
"avg_line_length": 38.67088607594937,
"alnum_prop": 0.6884732288987608,
"repo_name": "apache/beam",
"id": "6d1b3f3ebb1712732fd5b851defa45c5853f539a",
"size": "22168",
... |
import unittest
from hagelslag.data.MRMSGrid import MRMSGrid
from datetime import datetime
class TestMRMSGrid(unittest.TestCase):
def setUp(self):
self.path = "../../testdata/mrms_3km/"
self.variable = "MESH_Max_60min_00.50"
self.start_date = datetime(2015, 5, 1, 18, 0)
self.end_dat... | {
"content_hash": "d2b3d5c39c4bab4aaa77f868c2bf3511",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 121,
"avg_line_length": 44.26086956521739,
"alnum_prop": 0.6679764243614931,
"repo_name": "djgagne/hagelslag-unidata",
"id": "5c3828dcae1df358d827e6b92f97666f143f65d7",
"si... |
import unittest2
from ice import tasks
import fabric.api as fabric_api
def a_func(*args, **kwargs):
"""A help message"""
ret_val = kwargs
ret_val['args'] = args
return ret_val
class TestCallable(unittest2.TestCase):
def test_help_message(self):
c = tasks.Callable(a_func)
self.ass... | {
"content_hash": "996529cfd3a7f40d9d69c2038d09f60c",
"timestamp": "",
"source": "github",
"line_count": 95,
"max_line_length": 61,
"avg_line_length": 26.16842105263158,
"alnum_prop": 0.5172968624296058,
"repo_name": "ice-stuff/ice",
"id": "bab5802798b958ef3320c0f5a3cfc24977096758",
"size": "2486",
... |
from twisted.plugin import IPlugin
from zope.interface import implementer
from desertbot.message import IRCMessage
from desertbot.moduleinterface import IModule
from desertbot.modules.commandinterface import BotCommand
from desertbot.response import IRCResponse
import requests
import http.client
from urllib3.exceptio... | {
"content_hash": "c38258a635def71db15f7557c141c92a",
"timestamp": "",
"source": "github",
"line_count": 51,
"max_line_length": 149,
"avg_line_length": 41.05882352941177,
"alnum_prop": 0.6848137535816619,
"repo_name": "DesertBot/DesertBot",
"id": "74917e49aeaffe573c6e1649a8a5867008d502cb",
"size": "... |
'''Prompt user for confirmations based on file names, and keeps track of
previous choices.
'''
import tilutil.systemutils as su
class ConfirmManager:
'''Class to prompt user for file operation confirmations, and remember the
patterns for future prompts.
'''
def __init__(self):
self.ap... | {
"content_hash": "20f13a35e7ce9576bd8444dc4515284f",
"timestamp": "",
"source": "github",
"line_count": 67,
"max_line_length": 81,
"avg_line_length": 35.43283582089552,
"alnum_prop": 0.5754001684919966,
"repo_name": "nagyistoce/phoshare",
"id": "79c30b16efef27438973edb316f966fd12375635",
"size": "2... |
"""
Compliance Checker suite runner
"""
from __future__ import print_function
import sys
import inspect
import itertools
import json
from netCDF4 import Dataset
from lxml import etree as ET
from compliance_checker.base import fix_return_value, Result
from owslib.sos import SensorObservationService
from owslib.swe.sens... | {
"content_hash": "e64163ce7522a3cf2408d623ac4fd500",
"timestamp": "",
"source": "github",
"line_count": 589,
"max_line_length": 179,
"avg_line_length": 38.39388794567063,
"alnum_prop": 0.5264437958786592,
"repo_name": "duncombe/compliance-checker",
"id": "8a103aecaf650aeba0e2eee3c37cbcad2631457a",
... |
"""Tests for tensorflow.ops.tensor_array_ops."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
from tensorflow.core.protobuf import config_pb2
from tensorflow.python.client import session as session_lib
from tensorflow.python.eager imp... | {
"content_hash": "fc0ca2a90ea41994e63691d570d50a30",
"timestamp": "",
"source": "github",
"line_count": 1669,
"max_line_length": 80,
"avg_line_length": 38.254643499101256,
"alnum_prop": 0.6159412345137595,
"repo_name": "ageron/tensorflow",
"id": "4d7ae4f24ea04fe840d7f8e6f13e8d9ec95fffea",
"size": "... |
from __future__ import absolute_import, unicode_literals
from demoapp.models import Somemodel
from django.contrib import admin
class SomemodelAdmin(admin.ModelAdmin):
list_display = ('title',)
def save_model(self, request, obj, form, change):
obj.current_user = request.user
super(SomemodelAdm... | {
"content_hash": "7caeb21e6acdd3a0aaf8ff22c732d53e",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 74,
"avg_line_length": 32.07692307692308,
"alnum_prop": 0.7386091127098321,
"repo_name": "sthzg/django-chatterbox",
"id": "0c41dd329df4db22db444d3d2bce452dbe49e9e3",
"size"... |
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'CategoryTranslation.slug'
db.add_column(u'aldryn_faq_category_translation', 'slug',
self.gf('d... | {
"content_hash": "7d9d532f05c8c9851b76211c1130fbd0",
"timestamp": "",
"source": "github",
"line_count": 71,
"max_line_length": 162,
"avg_line_length": 65.21126760563381,
"alnum_prop": 0.5691144708423326,
"repo_name": "mkoistinen/aldryn-faq",
"id": "383351dcc4eae62c202a32a46026cd72859e63e7",
"size":... |
import re, inspect
from revkitui import RevLibEditor
from PyQt4 import QtCore, QtGui
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from core.BaseItemButton import *
from core.BaseItemButtonMaximize import *
from core.BaseItemButtonClose import *
from core.PathSelector import *
from core.PortItem import *
from... | {
"content_hash": "3e6d10995eb1974b7c4d3c1db709678d",
"timestamp": "",
"source": "github",
"line_count": 463,
"max_line_length": 132,
"avg_line_length": 33.734341252699785,
"alnum_prop": 0.564632819002497,
"repo_name": "ajavadia/ScaffCC",
"id": "3dfe510b8aaf157156b5b74530525ce734da90fc",
"size": "16... |
import numpy.testing as npt
import AFQ.data.fetch as afd
from AFQ.utils.conversion import matlab_tractography, matlab_mori_groups
import os.path as op
DATA_PATH = op.join(op.abspath(op.dirname(__file__)), "../../tests/data")
def test_matlab_tractography():
sft = matlab_tractography(
op.join(DATA_PATH, ... | {
"content_hash": "20abdfe3363590ef978954f78a0f2717",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 73,
"avg_line_length": 30.26086956521739,
"alnum_prop": 0.6824712643678161,
"repo_name": "yeatmanlab/pyAFQ",
"id": "3c9b8c58f4f45ee73c761e4fd83c99326ee139b3",
"size": "696"... |
from sqlalchemy.ext import declarative
from sqlalchemy import orm
class QuantumBase(object):
"""Base class for Quantum Models."""
def __setitem__(self, key, value):
setattr(self, key, value)
def __getitem__(self, key):
return getattr(self, key)
def get(self, key, default=None):
... | {
"content_hash": "1feeb397f0d3ec18e5b558f37c3e04af",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 74,
"avg_line_length": 27.104166666666668,
"alnum_prop": 0.595695618754804,
"repo_name": "ruijie/quantum",
"id": "e3ffa682c7f42b1d14096c1961bdf2fd85a8d16f",
"size": "1886",... |
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'FlatValue.published'
db.add_column(u'profiles_flatvalue', 'published', self.gf('django.db.models.fields.Bool... | {
"content_hash": "716ae6d2cb1ecc9d5dbc32fb1812c857",
"timestamp": "",
"source": "github",
"line_count": 297,
"max_line_length": 217,
"avg_line_length": 87.21212121212122,
"alnum_prop": 0.552660026252799,
"repo_name": "ProvidencePlan/Profiles",
"id": "4e078c2a091230b1c30bfcc6306e2e6429b4345f",
"size... |
from pipeline.param.base_param import BaseParam
from pipeline.param import consts
class SampleWeightParam(BaseParam):
"""
Define sample weight parameters.
Parameters
----------
class_weight : str or dict, default None
class weight dictionary or class weight computation mode, string value... | {
"content_hash": "463118165b66cb5a0ace0f369f973a50",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 119,
"avg_line_length": 39.86538461538461,
"alnum_prop": 0.627592860588519,
"repo_name": "FederatedAI/FATE",
"id": "394f4050dd13d431c0a96b5ed221e8b0ebb6216d",
"size": "2737... |
from __future__ import unicode_literals
from bson import ObjectId
import datetime
from tgext.ecommerce.model import models, Product
from tgext.ecommerce.lib.utils import apply_vat, with_currency
class OrderManager(object):
@classmethod
def create(cls, cart, payment_date=None, payer_info=None, status='created'... | {
"content_hash": "4ddc1b41cf377a586164419617ac5241",
"timestamp": "",
"source": "github",
"line_count": 73,
"max_line_length": 124,
"avg_line_length": 45.41095890410959,
"alnum_prop": 0.5185520361990951,
"repo_name": "axant/tgext.ecommerce",
"id": "7bcac6e51e6f2f73c1af5a256c0cd0588ff0c7c6",
"size":... |
from django.conf import settings
from django.db import models
from django.utils.translation import ugettext_lazy as _
from panda.models.base_upload import BaseUpload
class RelatedUpload(BaseUpload):
"""
A file related to a dataset file uploaded to PANDA.
"""
from panda.models.dataset import Dataset
... | {
"content_hash": "e2137cd72574bf6000622e1c33f8bce0",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 72,
"avg_line_length": 30.695652173913043,
"alnum_prop": 0.6827195467422096,
"repo_name": "PalmBeachPost/panda",
"id": "23122243a5a9d203504bf02b6037f7e6116117f5",
"size": "... |
import os, sys
from PyQt5.QtWidgets import (QWizard, QMessageBox)
from PyQt5.QtGui import QPixmap
from PyQt5.QtCore import pyqtSlot, Qt
try:
import odmltables
have_odmltables = True
except:
have_odmltables = False
from .settings import Settings
class OdmltablesWizard(QWizard):
def __init__(self, wi... | {
"content_hash": "2b667b8db5b2d2dd8fee320781af0661",
"timestamp": "",
"source": "github",
"line_count": 83,
"max_line_length": 86,
"avg_line_length": 33.27710843373494,
"alnum_prop": 0.5745836350470673,
"repo_name": "INM-6/python-odmltables",
"id": "54b51b30bb070d1462b530e3aafb5daba4e65245",
"size"... |
from __future__ import absolute_import
from collections import defaultdict
import functools
import itertools
import logging
import os
from pip._vendor import pkg_resources
from pip._vendor import requests
from pip.download import (url_to_path, unpack_url)
from pip.exceptions import (InstallationError, BestVersionAlr... | {
"content_hash": "ecdad30d1b386e2caeb089c33acf0013",
"timestamp": "",
"source": "github",
"line_count": 670,
"max_line_length": 79,
"avg_line_length": 41.832835820895525,
"alnum_prop": 0.5483445126302269,
"repo_name": "ChristopherHogan/pip",
"id": "58951adba967ebf668a39d8c13fcc09434332c98",
"size":... |
import subprocess
import os
import sys
import time
import datetime
import re
import random
import multiprocessing
#from enum import Enum
import numpy as np
import matplotlib.pyplot as plt
import copy_reg
import types
from my_regex import *
import arch_handler as ah
###### Enums ######
e_Test_Type = ('normal',
'bina... | {
"content_hash": "f089d79741feb7354a41a96583cfe350",
"timestamp": "",
"source": "github",
"line_count": 1228,
"max_line_length": 194,
"avg_line_length": 40.97801302931596,
"alnum_prop": 0.6915403112020826,
"repo_name": "wotan-fpga/wotan",
"id": "c10c3a2be3b4cbabcd99fa6fb6122a6ed3ee2237",
"size": "5... |
"""Google Cloud Platform library - ml cell magic."""
from __future__ import absolute_import
from __future__ import unicode_literals
try:
import IPython
import IPython.core.display
import IPython.core.magic
except ImportError:
raise Exception('This module can only be loaded in ipython.')
import argparse
import... | {
"content_hash": "f9954358d825afd6e8efb39b4fd0902e",
"timestamp": "",
"source": "github",
"line_count": 1231,
"max_line_length": 113,
"avg_line_length": 43.38017871649066,
"alnum_prop": 0.6086402876350631,
"repo_name": "yebrahim/pydatalab",
"id": "1df97d9e17b1e491a26484f379564e716472ed2c",
"size": ... |
from django import forms
from django.core.exceptions import ValidationError
from dist.models import Category
from netboot.forms import boolean_choices
class AddCategoryForm(forms.Form):
parent = forms.ChoiceField(label='Parent', required=False)
title = forms.CharField(max_length=100)
description = forms... | {
"content_hash": "42996a48b9ce176b5e027350ccbc5549",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 104,
"avg_line_length": 35.8,
"alnum_prop": 0.656025538707103,
"repo_name": "tfmt/netboot",
"id": "fafe2e780d4d3d486809f74231f898310ae761eb",
"size": "1253",
"binary": fa... |
__author__ = 'shafferm'
from run_sparcc import sparcc_correlation, sparcc_correlation_w_bootstraps
| {
"content_hash": "f8bbbddf428a9855cd409c514d50f0b3",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 74,
"avg_line_length": 33.333333333333336,
"alnum_prop": 0.78,
"repo_name": "shafferm/fast_sparCC",
"id": "b350b0f3d038718146bf8480f50e822a50002c19",
"size": "100",
"binar... |
"""A swing up experiment in Cartpole."""
from typing import Optional
from bsuite.environments import base
from bsuite.environments import cartpole
from bsuite.experiments.cartpole_swingup import sweep
import dm_env
from dm_env import specs
import numpy as np
class CartpoleSwingup(base.Environment):
"""A difficul... | {
"content_hash": "5295702777598302afbab03fc1f06aea",
"timestamp": "",
"source": "github",
"line_count": 140,
"max_line_length": 80,
"avg_line_length": 34.24285714285714,
"alnum_prop": 0.6320400500625782,
"repo_name": "deepmind/bsuite",
"id": "13c3b9e902fddc1921b69cc499d6a7625fcfcc25",
"size": "5524... |
import itertools
import sys
from mox3 import mox
from neutronclient.neutron.v2_0 import port
from neutronclient import shell
from neutronclient.tests.unit import test_cli20
class CLITestV20PortJSON(test_cli20.CLITestV20Base):
def setUp(self):
super(CLITestV20PortJSON, self).setUp(plurals={'tags': 'tag'}... | {
"content_hash": "937a895cd11b40a99184b4249445dc02",
"timestamp": "",
"source": "github",
"line_count": 403,
"max_line_length": 79,
"avg_line_length": 41.61538461538461,
"alnum_prop": 0.5146979905789756,
"repo_name": "rackerlabs/python-neutronclient",
"id": "d7306d709ea56d4960d443534d0f05896c54381c",... |
from google.cloud import storage
import google.cloud.storage.acl
import pytest
import acl
# Typically we'd use a @example.com address, but GCS requires a real Google
# account.
TEST_EMAIL = 'jonwayne@google.com'
@pytest.fixture
def test_bucket(cloud_config):
"""Yields a bucket that resets its acl after the test... | {
"content_hash": "cb6c78c5ed7622552dd67d27df52f47a",
"timestamp": "",
"source": "github",
"line_count": 121,
"max_line_length": 79,
"avg_line_length": 30.429752066115704,
"alnum_prop": 0.7085822922324824,
"repo_name": "pongem/python-bot-project",
"id": "3197b4ea0f526558c67fcd8ff0a4496db8cdfab7",
"s... |
import httplib
import socket
import urlparse
import eventlet
import httplib2
from oslo.config import cfg
import webob
from quantum.agent.linux import daemon
from quantum.common import config
from quantum.common import utils
from quantum.openstack.common import log as logging
from quantum import wsgi
proxy_socket = c... | {
"content_hash": "900c25743db59cd93099ff0b70dac09b",
"timestamp": "",
"source": "github",
"line_count": 156,
"max_line_length": 79,
"avg_line_length": 32.76923076923077,
"alnum_prop": 0.57179186228482,
"repo_name": "yamt/neutron",
"id": "f6282e8b4284a207effa2c471a15eff75ab077df",
"size": "5822",
... |
from django.template import Library
from django.conf import settings
from django.contrib.sites.models import Site
register = Library()
CSS_URL = getattr(settings, 'BOOTSTRAP_CSS_URL', '')
JS_URL = getattr(settings, 'BOOTSTRAP_JS_URL', '')
@register.inclusion_tag('bootstrap/styles.inc.html')
def bootstrap_styles():
... | {
"content_hash": "0bbcc060162bf645fc9b09d43b39f282",
"timestamp": "",
"source": "github",
"line_count": 109,
"max_line_length": 109,
"avg_line_length": 27.94495412844037,
"alnum_prop": 0.6214707813525936,
"repo_name": "iamsteadman/bambu-bootstrap",
"id": "43f407e887bfdbf82c933f7b3395764c90731a93",
... |
from envisage.ui.tasks.task_extension import TaskExtension
from pyface.tasks.action.schema_addition import SchemaAddition
# ============= standard library imports ========================
from traits.api import List
from pychron.envisage.tasks.base_task_plugin import BaseTaskPlugin
from pychron.geochron.geochron_servi... | {
"content_hash": "01a3bbef1ef1ac3d87d57e643b78fb02",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 103,
"avg_line_length": 35.87931034482759,
"alnum_prop": 0.6727534839019702,
"repo_name": "UManPychron/pychron",
"id": "15fee3f9f4e0833fd6d6b3b52ebc7d1aa0d28372",
"size": "... |
import sys
sys.path.append('../python-mbus')
import pytest
import os
from mbus import MBus
# test if servial evice is connected
def nohardware():
try:
fd = os.open(config.getini(serialdevice), os.O_RDONLY)
except OSError:
return True
os.close(fd)
return False
def test_empty_init():
... | {
"content_hash": "017ac493961afc74ec42cb64649046e3",
"timestamp": "",
"source": "github",
"line_count": 90,
"max_line_length": 74,
"avg_line_length": 22.866666666666667,
"alnum_prop": 0.6579203109815355,
"repo_name": "Cougar/python-mbus",
"id": "95ab46f70e22f817155614cc6a54ea27f8523d54",
"size": "2... |
import os.path, sys
sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), os.pardir))
import unittest
import itertools
from pipeline_base import PipelineBlock, Zip
from pipeline_hof import Filter, Map, Fold
from pipeline_parallel import FilterParallel, FoldParallel, MapParallel, BeginParallel, EndPa... | {
"content_hash": "5105c3a6495de18ab5f8792f84425dd3",
"timestamp": "",
"source": "github",
"line_count": 147,
"max_line_length": 143,
"avg_line_length": 29.8843537414966,
"alnum_prop": 0.6057363988162987,
"repo_name": "lmc2179/chevrons",
"id": "bd6ce876bccf0b32249060061ae0b4cff962b056",
"size": "439... |
from os.path import dirname
from ipkg.build import Formula, File
class c(Formula):
name = 'c'
version = '1.0'
sources = File(dirname(__file__) + '/../../sources/c-1.0.tar.gz')
platform = 'any'
dependencies = ('d', 'e')
def install(self):
pass
| {
"content_hash": "34624461163706bb8d22e880ba73fa93",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 69,
"avg_line_length": 17.5625,
"alnum_prop": 0.5693950177935944,
"repo_name": "pmuller/ipkg",
"id": "3c7b50d6af0599a0558804b05aae31402f54e987",
"size": "281",
"binary": ... |
from django.contrib import admin
from .models import Eventos
from multimedia.models import *
class FotosAdmin(generic.GenericTabularInline):
model = Fotos
extra = 1
class AdjuntosAdmin(generic.GenericTabularInline):
model = Adjuntos
extra = 1
class EventosAdmin(admin.ModelAdmin):
def queryset(sel... | {
"content_hash": "5445c661e902a7bd83362796e47478e5",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 66,
"avg_line_length": 29.53125,
"alnum_prop": 0.6835978835978836,
"repo_name": "CARocha/cesesma",
"id": "35810942c491e247288db6f2aea1ab643ef1ca63",
"size": "945",
"binar... |
import requests.packages.urllib3
import serial
import json
from firebase import firebase
requests.packages.urllib3.disable_warnings()
arduinoData = serial.Serial('com31', 9600)
firebase = firebase.FirebaseApplication(
'https://___YOUR_PROJECT_NAME____.firebaseio.com/')
while 1:
myData = (arduin... | {
"content_hash": "1f44e6af31ddf538668e1f6ea0f93ac6",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 58,
"avg_line_length": 27.944444444444443,
"alnum_prop": 0.68389662027833,
"repo_name": "Logan1x/Python-Scripts",
"id": "3a8b55963b22f1905e6d76c3d30c7ed7eea5396f",
"size": ... |
from PyQt5.QtCore import *
from Business import *
from Data.Components import Components
__author__ = 'mamj'
col_header = ["Components", "Type"]
types = ['Lines', 'Areas']
class ComponentsModel(QAbstractTableModel):
def __init__(self, doc):
QAbstractItemModel.__init__(self)
self._components = doc.get_component... | {
"content_hash": "845fd0e74f26100148eb061717e88a7b",
"timestamp": "",
"source": "github",
"line_count": 110,
"max_line_length": 77,
"avg_line_length": 30.527272727272727,
"alnum_prop": 0.7004169148302561,
"repo_name": "pracedru/PracedruDesign",
"id": "c1ad567affa430bd14fa6e55a5ec3607692a0d71",
"siz... |
import os
import unittest
import time
import jwt
import datetime
from collections import namedtuple
from hashlib import md5
from elasticsearch import Elasticsearch, NotFoundError
from tests.module.blueprints.config import LOCAL_ELASTICSEARCH
try:
from unittest.mock import Mock, patch
except ImportError:
from... | {
"content_hash": "1fc3909cfa5eede594a0fe40a0ed5a02",
"timestamp": "",
"source": "github",
"line_count": 285,
"max_line_length": 77,
"avg_line_length": 37.575438596491225,
"alnum_prop": 0.5726024838920534,
"repo_name": "openspending/os-authz-service",
"id": "eee158687da25043d2df5ea2391a0dd19ecad930",
... |
from __future__ import unicode_literals
from django.conf.urls import url
from django.contrib.auth import views as auth_views
from stackdio.core.utils import cached_url
from stackdio.ui import views
from stackdio.ui.views import accounts
from stackdio.ui.views import blueprints
from stackdio.ui.views import environment... | {
"content_hash": "57df3d3f0d7b8f948a4954135d8b0a5a",
"timestamp": "",
"source": "github",
"line_count": 352,
"max_line_length": 95,
"avg_line_length": 35.72159090909091,
"alnum_prop": 0.5627485287100366,
"repo_name": "stackdio/stackdio",
"id": "de94dab7f41e1860decfcc82c7cce49585937785",
"size": "13... |
from __future__ import print_function
from flask import render_template
from flask import Flask
from flask import request, redirect, url_for
from flask import Response
from flask import send_from_directory
import CIV_template
targetlet = ['a','c','d','e','s','A','C','D','E','S']
tempdata =''
def markup_file(filen... | {
"content_hash": "417c087cb6e6132e14e8c660480b5622",
"timestamp": "",
"source": "github",
"line_count": 229,
"max_line_length": 153,
"avg_line_length": 34.004366812227076,
"alnum_prop": 0.6166688069860023,
"repo_name": "philip-schrodt/CIVET-Flask",
"id": "702c4515d761bbf2b586278e8dc3b4830a254ba8",
... |
"""A tiny Python program to check that Python is working.
Try running this program from the command line like this:
python hello.py
python hello.py Alice
That should print:
Hello World -or- Hello Alice
Try changing the 'Hello' to 'Howdy' and run again.
Once you have that working, you're ready for class -- you can... | {
"content_hash": "bcf7c6e56bcdaa29de7595284685d52c",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 68,
"avg_line_length": 29.68,
"alnum_prop": 0.7021563342318059,
"repo_name": "chipoglesby/google-python-exercises",
"id": "a54b9f0f7b066e8e1bf79ad3368070e13e9c5963",
"size"... |
"""The aws_lambda component."""
| {
"content_hash": "63ea1670b88aafbba7a41f1a30f1a089",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 31,
"avg_line_length": 32,
"alnum_prop": 0.65625,
"repo_name": "jamespcole/home-assistant",
"id": "f6d86d02e93f31a24517f6ccfb9f94899662bd68",
"size": "32",
"binary": false... |
import pkg_resources
# -- General configuration ------------------------------------------------
# If your documentation needs a minimal Sphinx version, state it here.
#
# needs_sphinx = '1.0'
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*')... | {
"content_hash": "4896490955d6046ba8c91def0bf61c92",
"timestamp": "",
"source": "github",
"line_count": 333,
"max_line_length": 86,
"avg_line_length": 28.72072072072072,
"alnum_prop": 0.6884148891677122,
"repo_name": "LabD/django-postcode-lookup",
"id": "5c4d6c3f0de7b835fb68e5dd4104f1f6295063b9",
"... |
print "Hello World"
print "Something else"
print "This is the change"
print "This is the last thing"
| {
"content_hash": "ba61cc71d24f4f196d3ab2f7f9525846",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 30,
"avg_line_length": 25.25,
"alnum_prop": 0.7524752475247525,
"repo_name": "SameGordon/pynet_test",
"id": "2a9421ab6fd9ae273f9fc01fedcf5b82a813a2c7",
"size": "101",
"bin... |
"""
This file demonstrates writing tests using the unittest module. These will pass
when you run "manage.py test".
Replace this with more appropriate tests for your application.
"""
from django.test import TestCase
class SimpleTest(TestCase):
def test_basic_addition(self):
"""
Tests that 1 + 1 a... | {
"content_hash": "68395f7de65f1d10266aaebc56d9f41a",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 79,
"avg_line_length": 23.9375,
"alnum_prop": 0.6762402088772846,
"repo_name": "ngageoint/gamification-server",
"id": "9f828095bceca240c2415b842194960200f5383a",
"size": "4... |
from oslo.config import cfg
import sqlalchemy as sa
from sqlalchemy.orm import exc as sa_exc
from neutron.common import exceptions as exc
from neutron.db import api as db_api
from neutron.db import model_base
from neutron.openstack.common import log
from neutron.plugins.ml2 import driver_api as api
from neutron.plugin... | {
"content_hash": "58b47d574ab91d91271f5fb6b80b4aef",
"timestamp": "",
"source": "github",
"line_count": 187,
"max_line_length": 79,
"avg_line_length": 39.839572192513366,
"alnum_prop": 0.5471140939597315,
"repo_name": "rickerc/neutron_audit",
"id": "5366215f5323ecf65687e5792ac8f3798a292ebd",
"size"... |
from __future__ import absolute_import
from __future__ import print_function
import os
import ujson
from optparse import make_option
from django.test import Client
from django.conf import settings
from django.core.management.base import BaseCommand
class Command(BaseCommand):
help = """
Create webhook message b... | {
"content_hash": "2e1b788c99f36b57e381f69aed687ab0",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 94,
"avg_line_length": 33.886792452830186,
"alnum_prop": 0.623608017817372,
"repo_name": "peiwei/zulip",
"id": "b0d41798951c103b3137822c1a82ed511686560c",
"size": "1796",
... |
import httplib
import re
import sys
import getopt
# Pages to include in distribution
wiki_pages = [
"CamelCase",
"InterMapTxt",
"InterTrac",
"InterWiki",
"PageTemplates",
"RecentChanges",
"TitleIndex",
"TracAccessibility",
"TracAdmin",
"TracBackup",
"TracBrowser",
"TracCgi",
"TracChangeset",
"TracEnviron... | {
"content_hash": "ed462ea0104e5aa5dd5175e0123978a0",
"timestamp": "",
"source": "github",
"line_count": 138,
"max_line_length": 79,
"avg_line_length": 23.347826086956523,
"alnum_prop": 0.5561762880198634,
"repo_name": "dokipen/trac",
"id": "8047729e8991f3ac752758bd843c415938d01127",
"size": "3477",... |
from __future__ import unicode_literals, division, absolute_import, print_function
import os
from asn1crypto import core, ocsp, x509, algos
from . import errors
from ._types import str_cls, type_name
from .version import __version__
from ._urllib import Request, urlopen, URLError
def fetch(cert, issuer, hash_algo=... | {
"content_hash": "8f3f2ee1699c939a1b34fae2a9b2b319",
"timestamp": "",
"source": "github",
"line_count": 112,
"max_line_length": 112,
"avg_line_length": 36.357142857142854,
"alnum_prop": 0.6362966601178782,
"repo_name": "kak-bo-che/certvalidator",
"id": "f3e839b8704215e6b03de37354d5602c24fa65c3",
"s... |
"""
Modulo de configuraciones globales.
"""
log = None
| {
"content_hash": "16cc59ebe6ac52ead95cfe3be3e83b1d",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 35,
"avg_line_length": 9.5,
"alnum_prop": 0.6666666666666666,
"repo_name": "klashxx/PyConES",
"id": "b1a429f96625ef995ac2cb7ac29cd85fe90b4ddc",
"size": "81",
"binary": fal... |
'''custom_grouping_helper.py'''
from collections import namedtuple
class CustomGroupingHelper:
"""Helper class for managing custom grouping"""
def __init__(self):
# map <stream_id -> list(targets)>
self.targets = {}
def add(self, stream_id, task_ids, grouping, source_comp_name):
"""Adds the target c... | {
"content_hash": "9bdf52c31ad84c460858ca6c3b6d6051",
"timestamp": "",
"source": "github",
"line_count": 62,
"max_line_length": 93,
"avg_line_length": 38.903225806451616,
"alnum_prop": 0.6600331674958541,
"repo_name": "twitter/heron",
"id": "59f832fb2e936835dba628ca443706f7e0d87321",
"size": "3262",... |
def test_sv_tokenizer_handles_long_text(sv_tokenizer):
text = """Det var så härligt ute på landet. Det var sommar, majsen var gul, havren grön,
höet var uppställt i stackar nere vid den gröna ängen, och där gick storken på sina långa,
röda ben och snackade engelska, för det språket hade han lärt sig av sin mor.
Ru... | {
"content_hash": "0088f687223e14f6856c8ac672606fda",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 129,
"avg_line_length": 50.214285714285715,
"alnum_prop": 0.7311522048364154,
"repo_name": "honnibal/spaCy",
"id": "1e26c45bc61ad588edfdbfe49d222eaca5091b9f",
"size": "723"... |
from subprocess import call
from os import path
import hitchpostgres
import hitchselenium
import hitchpython
import hitchserve
import hitchredis
import hitchtest
import hitchsmtp
# Get directory above this file
PROJECT_DIRECTORY = path.abspath(path.join(path.dirname(__file__), '..'))
class ExecutionEngine(hitchtest... | {
"content_hash": "35423132b1bb0bfa7caad673c5a05caf",
"timestamp": "",
"source": "github",
"line_count": 148,
"max_line_length": 114,
"avg_line_length": 34.391891891891895,
"alnum_prop": 0.611984282907662,
"repo_name": "jondelmil/brainiac",
"id": "6e30dc4eb66c690c23059e136d631763af2e3a71",
"size": "... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.