text stringlengths 4 1.02M | meta dict |
|---|---|
'''
This is a very simple example referenced in the beginner's tutorial:
https://enigmampc.github.io/catalyst/beginner-tutorial.html
Run this example, by executing the following from your terminal:
catalyst ingest-exchange -x bitfinex -f daily -i btc_usdt
catalyst run -f buy_btc_simple.py -x bi... | {
"content_hash": "8410e6623fb11986a54ae6512dcdc92f",
"timestamp": "",
"source": "github",
"line_count": 96,
"max_line_length": 77,
"avg_line_length": 36.302083333333336,
"alnum_prop": 0.612051649928264,
"repo_name": "enigmampc/catalyst",
"id": "5cd6a1a5d20695f4717d0d5528f971c46e5b7456",
"size": "34... |
"""Config flow for Spotify."""
from __future__ import annotations
from collections.abc import Mapping
import logging
from typing import Any
from spotipy import Spotify
from homeassistant.config_entries import ConfigEntry
from homeassistant.data_entry_flow import FlowResult
from homeassistant.helpers import config_en... | {
"content_hash": "94ab435b326897e44d51b35d627bfac4",
"timestamp": "",
"source": "github",
"line_count": 83,
"max_line_length": 88,
"avg_line_length": 33.795180722891565,
"alnum_prop": 0.6442067736185383,
"repo_name": "nkgilley/home-assistant",
"id": "bbfb92db091306645719397d4b24dafd907775bd",
"size... |
#!/usr/bin/env python
"""
The screen to be used when a screen transition happens
"""
from Microsoft.Xna.Framework import Color, Rectangle
from base import BaseScreen
class Transition:
speed = 1.5 # seconds
color = Color.Black
is_finished = False
def __init__(self, to_opaque=True):
self.... | {
"content_hash": "7a5b82266effa7e7ef518674ec07a936",
"timestamp": "",
"source": "github",
"line_count": 91,
"max_line_length": 92,
"avg_line_length": 27.263736263736263,
"alnum_prop": 0.6082224909310762,
"repo_name": "Eshumkv/WeaponWizard",
"id": "ea957ac27c5a829946fad530b17ae0bf0b17fcbe",
"size": ... |
"""The tab switching measurement.
This measurement opens pages in different tabs. After all the tabs have opened,
it cycles through each tab in sequence, and records a histogram of the time
between when a tab was first requested to be shown, and when it was painted.
Power usage is also measured.
"""
import time
from... | {
"content_hash": "69e7738fec64838260779b81cc4ad486",
"timestamp": "",
"source": "github",
"line_count": 86,
"max_line_length": 79,
"avg_line_length": 35.127906976744185,
"alnum_prop": 0.7096987752399868,
"repo_name": "anirudhSK/chromium",
"id": "6a78493b725c7369256645c2a2a99de9b6fbdf58",
"size": "3... |
import time
import config
import busses
def advance_station():
index = busses.status_bus["station"]
if busses.status_bus["line"] == "S41":
index += 1
if busses.status_bus["line"] == "S42":
index -= 1
index = index % len(config.stations)
busses.status_bus["station"] = index
buss... | {
"content_hash": "882fc4751548e0b80493d1fec02937a4",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 70,
"avg_line_length": 28.72222222222222,
"alnum_prop": 0.6421663442940039,
"repo_name": "Pixdigit/Saufbot",
"id": "3b46c19ad1a4f3dcbb7944f0596f0c015264ef95",
"size": "541"... |
from lxml import etree
from openerp import tools
from openerp.tools.translate import _
from openerp.osv import fields, osv
class project_task_delegate(osv.osv_memory):
_name = 'project.task.delegate'
_description = 'Task Delegate'
_columns = {
'name': fields.char('Delegated Title', required=True,... | {
"content_hash": "0d623a7a78e55476382b33d51855d9c8",
"timestamp": "",
"source": "github",
"line_count": 115,
"max_line_length": 206,
"avg_line_length": 47.68695652173913,
"alnum_prop": 0.6057622173595916,
"repo_name": "diogocs1/comps",
"id": "e3c935d4f5dd7ac53b6691fb71c6129f76ca96a1",
"size": "6463... |
import oslo_config.cfg
# there are 3 ways to access the configuration.
#
# a. ryu.cfg.CONF (used to register cli options)
# b. RyuApp.CONF (preferred way for ryu applications)
# c. oslo.config.cfg.CONF
#
# Currently all of above shares a single ConfigOpts instance.
# We will unshare c. (and stop using it) a... | {
"content_hash": "71613bd1b2d5740cf7804595d309943f",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 76,
"avg_line_length": 35.484848484848484,
"alnum_prop": 0.7677198975234842,
"repo_name": "lzppp/mylearning",
"id": "3c580aee6a40afca3fe7de2d42262433c3cf4d76",
"size": "185... |
def predict_next_board(game):
"""Returns a list of pos2sible board positions each for left, down, right, up"""
orig = game.board
left = game.move_left()
down = game.move_down()
right = game.move_right()
up = game.move_up()
return [orig, left, down, right, up]
def flatten(board):
re... | {
"content_hash": "493d21cc84e6009b347a314d01146607",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 98,
"avg_line_length": 27.29268292682927,
"alnum_prop": 0.5924932975871313,
"repo_name": "jdowns/play2048",
"id": "69cb6a8c8a082cb770fab5ae835bc1667381d04a",
"size": "1119"... |
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('event', '0008_auto_20180208_1256'),
]
operations = [
migrations.AlterModelOptions(
name='room',
options={'ordering': ['order', 'name']},
),
migration... | {
"content_hash": "65bd8937a85a4f4b15ff6a74fdb4ac20",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 53,
"avg_line_length": 24.15,
"alnum_prop": 0.5590062111801242,
"repo_name": "bruecksen/notifhain",
"id": "7bb2f61dbbb3cfd50a57a56f53714d4e7cdb4cc2",
"size": "532",
"bina... |
import logging
import os, sys, time, socket
import docker
def setupLogging():
log = logging.getLogger('maestro')
if not len(log.handlers):
log.setLevel(logging.DEBUG)
formatter = logging.Formatter("%(asctime)s %(levelname)-10s %(message)s")
filehandler = logging.FileHandler('maestro.log')
filehand... | {
"content_hash": "06428de94b1562f08ea49b043e25a086",
"timestamp": "",
"source": "github",
"line_count": 91,
"max_line_length": 77,
"avg_line_length": 23.692307692307693,
"alnum_prop": 0.6321892393320965,
"repo_name": "Wiredcraft/maestro",
"id": "0d5c3765521de6017bbf8c85a6f05f0b8eab6f8f",
"size": "2... |
from __future__ import unicode_literals
import django.core.validators
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('proposals', '0013_auto_20160919_0021'),
]
operations = [
migrations.AlterField(
model_name='score',
... | {
"content_hash": "5dc460eac709550c7cb800854935c5da",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 234,
"avg_line_length": 33.416666666666664,
"alnum_prop": 0.6309226932668329,
"repo_name": "pyvec/cz.pycon.org-2016",
"id": "d56d62f4a67ee95a0068a88a767c232e44bade57",
"siz... |
import os
import time
import base64
import urllib
from urlparse import urlparse
import cPickle as pickle
import json
import etcd
from configdb import exceptions
from configdb.db.interface import base
from configdb.db.interface import inmemory_interface
import logging
log = logging.getLogger(__name__)
class EtcdSess... | {
"content_hash": "d14b756a053293fa2909214e1a54c692",
"timestamp": "",
"source": "github",
"line_count": 238,
"max_line_length": 91,
"avg_line_length": 30.95798319327731,
"alnum_prop": 0.5636536373507057,
"repo_name": "lavagetto/configdb",
"id": "e1d2a46015836461ea03024c24a0780a5e0dfddc",
"size": "7... |
"""
sentry.models.organizationmember
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010-2014 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import, print_function
import logging
from bitfield import BitField
from django.conf impor... | {
"content_hash": "061534153ff5b904dedcee956b4af835",
"timestamp": "",
"source": "github",
"line_count": 171,
"max_line_length": 87,
"avg_line_length": 32.64912280701754,
"alnum_prop": 0.6089915815869604,
"repo_name": "jokey2k/sentry",
"id": "2073613a9070d666ff8f46e34375f8c98e1ff615",
"size": "5583"... |
from django.db import models
from django.urls import reverse
from django.utils.encoding import python_2_unicode_compatible
from model_utils import Choices
from minipub.models import MinipubModel
@python_2_unicode_compatible
class Article(MinipubModel):
STATUS = Choices('draft', 'published', 'archived')
tit... | {
"content_hash": "aca2b9c5d9b1b8e7d699888895adee3d",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 99,
"avg_line_length": 30.64,
"alnum_prop": 0.6971279373368147,
"repo_name": "richardbarran/django-mininews",
"id": "694faf1808a5aca591e20a6e41286cd1b81f1ec2",
"size": "766... |
'''
A script to check that the (Linux) executables produced by gitian only contain
allowed gcc, glibc and libstdc++ version symbols. This makes sure they are
still compatible with the minimum supported Linux distribution versions.
Example usage:
find ../gitian-builder/build -type f -executable | xargs python con... | {
"content_hash": "d6191ce6c96fd7d41c4fc4426356154a",
"timestamp": "",
"source": "github",
"line_count": 104,
"max_line_length": 142,
"avg_line_length": 35.72115384615385,
"alnum_prop": 0.6409152086137281,
"repo_name": "mzng/minacoin",
"id": "4f6a18da2d39e3b586702e41261b877104e35944",
"size": "3920"... |
import re
import math
import multiprocessing
from time import time
from .helpers import parse_date, scrape, headers, dubizzle_request
from .regions import uae
from bs4 import BeautifulSoup
class SearchException(BaseException):
pass
class Search(object):
"""
Simple class that organizes search parameters in... | {
"content_hash": "09717f65f27eb049fe26817e66d4bd96",
"timestamp": "",
"source": "github",
"line_count": 295,
"max_line_length": 125,
"avg_line_length": 36.70169491525424,
"alnum_prop": 0.5272928789138266,
"repo_name": "b4oshany/dubizzle",
"id": "ea156d7ce7570cc8f188ba511d25425e29a25f76",
"size": "1... |
from __future__ import print_function
from twisted.web.template import flattenString
from quoting_element import ExampleElement
def renderDone(output):
print(output)
flattenString(None, ExampleElement()).addCallback(renderDone)
| {
"content_hash": "152ab2b38428df02d31c6e60818bbc1c",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 61,
"avg_line_length": 33.285714285714285,
"alnum_prop": 0.8154506437768241,
"repo_name": "EricMuller/mywebmarks-backend",
"id": "51e82aa9062f50b8e9d384c41eebec41101886db",
... |
from decimal import *
import getpass
import math
import os
import os.path
import platform
import sys
import time
from jsonrpc import ServiceProxy, json
BASE_FEE=Decimal("0.001")
def check_json_precision():
"""Make sure json library being used does not lose precision converting BTC values"""
n = Decimal("20000... | {
"content_hash": "4fc36109bce7ce58a82b10da71900575",
"timestamp": "",
"source": "github",
"line_count": 252,
"max_line_length": 111,
"avg_line_length": 38.25,
"alnum_prop": 0.6148978109762423,
"repo_name": "kzcashteam/kzcash",
"id": "0e403406a9f5fa55d2f52f0a5107cd0904a3ad9a",
"size": "10014",
"bi... |
"""
lxml custom element classes for slide-related XML elements, including all
masters.
"""
from __future__ import (
absolute_import, division, print_function, unicode_literals
)
from . import parse_from_template, parse_xml
from .ns import nsdecls
from .simpletypes import XsdString
from .xmlchemy import (
Base... | {
"content_hash": "79e8c9c5a1fc3c5ee49393a83fc1536d",
"timestamp": "",
"source": "github",
"line_count": 156,
"max_line_length": 77,
"avg_line_length": 26.935897435897434,
"alnum_prop": 0.5680628272251309,
"repo_name": "biggihs/python-pptx",
"id": "dc5ff02b9f1dbf829569f2112fe33aed33f69c76",
"size": ... |
from datetime import datetime
import pytest
from pydantic import ValidationError
from datahub.configuration.time_window_config import BucketDuration, get_time_bucket
from datahub.emitter.mcp import MetadataChangeProposalWrapper
from datahub.ingestion.api.workunit import MetadataWorkUnit
from datahub.ingestion.source.... | {
"content_hash": "81580853b626418e184497505627e696",
"timestamp": "",
"source": "github",
"line_count": 145,
"max_line_length": 85,
"avg_line_length": 30.282758620689656,
"alnum_prop": 0.6770667273969483,
"repo_name": "linkedin/WhereHows",
"id": "021a988422688a214f9e09a70a6689946dfb6d27",
"size": "... |
from keras.layers import Highway as KerasHighway
class Highway(KerasHighway):
"""
Keras' `Highway` layer does not support masking, but it easily could, just by returning the
mask. This `Layer` makes this possible.
"""
def __init__(self, **kwargs):
super(Highway, self).__init__(**kwargs)
... | {
"content_hash": "c6121946b2fd7939c7d8b7a7cd679c61",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 95,
"avg_line_length": 35.5,
"alnum_prop": 0.6591549295774648,
"repo_name": "matt-gardner/deep_qa",
"id": "117843ce5833515b50d8b3cf6d05d6712df232b9",
"size": "355",
"bina... |
from keystone.common.ldap.core import *
| {
"content_hash": "b9668f7faa2bc2bc322177b5be775a81",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 39,
"avg_line_length": 40,
"alnum_prop": 0.8,
"repo_name": "sanket4373/keystone",
"id": "5cfd58385a1b4bb7d70fd1eb02b7f17c97591ec7",
"size": "642",
"binary": false,
"copi... |
"""
Meteogram
=========
Plots time series data as a meteogram.
"""
import datetime as dt
import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as np
from metpy.calc import dewpoint_from_relative_humidity
from metpy.cbook import get_test_data
from metpy.plots import add_metpy_logo
from metpy.units im... | {
"content_hash": "823d78bdd0048b0ae5a14bd0d758e586",
"timestamp": "",
"source": "github",
"line_count": 216,
"max_line_length": 94,
"avg_line_length": 40.34722222222222,
"alnum_prop": 0.5932300631095812,
"repo_name": "metpy/MetPy",
"id": "fbb78df2b3e679ff597a4ae53f06b0cba8439283",
"size": "8853",
... |
"""This module has configurations for flask app."""
import logging
import os
CONFIG = {
"development": "flask_app.config.DevelopmentConfig",
"testing": "flask_app.config.TestingConfig",
"production": "flask_app.config.ProductionConfig",
"default": "flask_app.config.ProductionConfig"
}
class BaseConf... | {
"content_hash": "87382eaabae20a39d809b4f1b7d2ee04",
"timestamp": "",
"source": "github",
"line_count": 68,
"max_line_length": 76,
"avg_line_length": 30.029411764705884,
"alnum_prop": 0.6523016650342801,
"repo_name": "stevenaubertin/angular2-flask",
"id": "177021a2324758d5244f999b33f4e28311e96b14",
... |
import sys
import os.path as op
def main():
sys.path.insert(0, op.abspath('.'))
from niworkflows.__about__ import __version__
print(__version__)
if __name__ == '__main__':
main()
| {
"content_hash": "fbf7e4370c07ec7d427ab3ebab242d0a",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 49,
"avg_line_length": 16.583333333333332,
"alnum_prop": 0.5728643216080402,
"repo_name": "oesteban/niworkflows",
"id": "7f287990193416f3c5abc840886e20e7bfc830e4",
"size": ... |
"""This module tests the brillo sdk command."""
from __future__ import print_function
import mock
import os
from chromite.cbuildbot import constants
from chromite.cbuildbot import repository
from chromite.cli import command_unittest
from chromite.cli.brillo import brillo_sdk
from chromite.lib import bootstrap_lib
fr... | {
"content_hash": "aac5ae69c988f3c39f55e4e23892198c",
"timestamp": "",
"source": "github",
"line_count": 342,
"max_line_length": 78,
"avg_line_length": 37.228070175438596,
"alnum_prop": 0.6714577442664154,
"repo_name": "guorendong/iridium-browser-ubuntu",
"id": "3439347fe2cd8937d2dc3550ad7e4fe36fc2414... |
from classytags.arguments import Argument
from classytags.core import Options
from classytags.helpers import AsTag
from django import template
from django.contrib.contenttypes.models import ContentType
from django.core.exceptions import FieldError
from django.db.models import Count
from taggit_templatetags2 import set... | {
"content_hash": "168431c92b5b39eec30bd0568713f469",
"timestamp": "",
"source": "github",
"line_count": 224,
"max_line_length": 110,
"avg_line_length": 32.486607142857146,
"alnum_prop": 0.5858183317301086,
"repo_name": "fizista/django-taggit-templatetags2",
"id": "a9dd2d83685958d198f72d924d78ad459057... |
import os
import hashlib
import tempfile
import unittest
import vivisect
from vivisect.const import *
def add_events(vw):
# Call some APIs to populate the event list.
# Coherency is not the objective. Just get some events in there.
filehash = hashlib.md5(b'testfile').hexdigest()
vw.addFile('testfile'... | {
"content_hash": "48cee4c7d0d636b7f4db8ca578334b4d",
"timestamp": "",
"source": "github",
"line_count": 126,
"max_line_length": 109,
"avg_line_length": 40.023809523809526,
"alnum_prop": 0.6210588935157644,
"repo_name": "atlas0fd00m/vivisect",
"id": "b191525e29ae4ba79c09725ee09bd1dc5d0837b5",
"size"... |
import argparse
import numpy as np
import sys
def generate():
parser = argparse.ArgumentParser()
parser.add_argument('--vocab_file', default='vocab.txt', type=str)
parser.add_argument('--vectors_file', default='vectors.txt', type=str)
args = parser.parse_args()
with open(args.vocab_file, 'r') as f... | {
"content_hash": "9de3bf1bc93a60a3a53b8ff63ea74970",
"timestamp": "",
"source": "github",
"line_count": 80,
"max_line_length": 139,
"avg_line_length": 32.8375,
"alnum_prop": 0.5135135135135135,
"repo_name": "Ignotus/word2vec_theano",
"id": "bed075e782eb6290aef2c9dc80b393dbe949ffc2",
"size": "2627",... |
import os
import sys
# Add the third_party/ dir to our search path so that we can find the
# modules in there automatically. This isn't normal, so don't replicate
# this pattern elsewhere.
_chromite_dir = os.path.normpath(os.path.dirname(os.path.realpath(__file__)))
_containing_dir = os.path.dirname(_chromite_dir)
_t... | {
"content_hash": "d949e95488ae57318b9bb317662eaf28",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 78,
"avg_line_length": 41.275862068965516,
"alnum_prop": 0.7343358395989975,
"repo_name": "zhang0137/chromite",
"id": "43226417d34b3a1bae6adaa1e64e596cd0797567",
"size": "1... |
from typing import Union
import copy
import numpy as np
from collections import OrderedDict
from rl_coach.agents.agent import Agent
from rl_coach.agents.policy_optimization_agent import PolicyOptimizationAgent
from rl_coach.architectures.head_parameters import SACQHeadParameters,SACPolicyHeadParameters,VHeadParameter... | {
"content_hash": "a37395207175a3853db71f7bc567eb00",
"timestamp": "",
"source": "github",
"line_count": 309,
"max_line_length": 129,
"avg_line_length": 48.799352750809064,
"alnum_prop": 0.6609854764904834,
"repo_name": "NervanaSystems/coach",
"id": "39d38803d29ea77099b41855746f71b2a922f478",
"size"... |
import unittest
from avro import schema
from avro import io
from avro import datafile
class TestAvro(unittest.TestCase):
def test_container(self):
writer = open('data.avro', 'wb')
datum_writer = io.DatumWriter()
schema_object = schema.parse("""\
{ "type": "record",
"n... | {
"content_hash": "c23cbd727c1482234ba388d3430c92f1",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 74,
"avg_line_length": 32.51063829787234,
"alnum_prop": 0.5235602094240838,
"repo_name": "qrsforever/workspace",
"id": "6e6cff2e2f2feeeee54811b26fb8fdc744782558",
"size": "... |
import sys
try:
from setuptools import setup
except ImportError:
from distutils import setup
config = {
'description': 'test', 'author': 'danbordeanu', 'version': '0.1'
}
setup(**config)
| {
"content_hash": "ed10f28dea2740064bd6ce1b780d3128",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 68,
"avg_line_length": 16.833333333333332,
"alnum_prop": 0.6732673267326733,
"repo_name": "danbordeanu/my_hello_world",
"id": "a8b87aced87ec2aff27db1bb7be92515c086e072",
"s... |
"""Manifest unit tests."""
import firebase_functions.private.manifest as _manifest
import firebase_functions.params as _params
full_endpoint = _manifest.ManifestEndpoint(
platform="gcfv2",
region=["us-west1"],
availableMemoryMb=512,
timeoutSeconds=60,
minInstances=1,
maxInstances=3,
concur... | {
"content_hash": "c90fc1c9172ad210f0740a5c85fc8849",
"timestamp": "",
"source": "github",
"line_count": 165,
"max_line_length": 80,
"avg_line_length": 31.854545454545455,
"alnum_prop": 0.5627853881278538,
"repo_name": "firebase/firebase-functions-python",
"id": "e029e454b3891387e1e30272f8b3929940744d... |
"""Training helper that checkpoints models and computes summaries."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import contextlib
import os
import time
from tensorflow.core.framework.summary_pb2 import Summary
from tensorflow.core.util.event_pb2 impor... | {
"content_hash": "ab5d904d0799c0ab5203cc6acb5bc088",
"timestamp": "",
"source": "github",
"line_count": 1031,
"max_line_length": 80,
"avg_line_length": 38.11833171677983,
"alnum_prop": 0.6714758269720101,
"repo_name": "Lab603/PicEncyclopedias",
"id": "a3ee383758be7553b49bf003dcf7593b7cc7fe7b",
"siz... |
"""
Created on Jan 28, 2013
@author: agross
"""
import os as os
import pickle as pickle
from collections import defaultdict
import pandas as pd
import numpy as np
from Helpers.Misc import make_path_dump
from Processing.ProcessClinical import get_clinical
from Data.Annotations import read_in_pathways
def tree():
... | {
"content_hash": "992c3f9a182fe4d33122fa20974de23a",
"timestamp": "",
"source": "github",
"line_count": 219,
"max_line_length": 78,
"avg_line_length": 34.333333333333336,
"alnum_prop": 0.5701556057986434,
"repo_name": "theandygross/CancerData",
"id": "43bf7c1e0a235112e8cd942668f813ea4e3f68ca",
"siz... |
from webskewer.serve.main import main
if __name__ == '__main__':
#import cProfile
#import pstats
#try:
# cProfile.run('main()', 'mainprof')
#except KeyboardInterrupt:
# pass
#p = pstats.Stats('mainprof')
#p.strip_dirs()
#p.sort_stats('calls', 'time')
#p.print_stats()
... | {
"content_hash": "1b4a0836e0fe1463ddb2870b917c7d4f",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 43,
"avg_line_length": 20.647058823529413,
"alnum_prop": 0.5641025641025641,
"repo_name": "dhain/webskewer",
"id": "2e73f6846d2c1e426f26f835bc673310fd8075af",
"size": "351"... |
"""Linters that warn about common problems with kake rules."""
from __future__ import absolute_import
import inspect
import re
import sys
from shared import ka_root
from kake.lib import compile_rule
from kake.lib import computed_inputs
# captures "'foo' in context", "context['foo']", and
# context.get('foo'). We... | {
"content_hash": "62c8f598dc9afd9dcf6dae4bbc06e479",
"timestamp": "",
"source": "github",
"line_count": 118,
"max_line_length": 79,
"avg_line_length": 39.889830508474574,
"alnum_prop": 0.5810495007435734,
"repo_name": "Khan/khan-linter",
"id": "215785b49124f4ccfcbe7d7b7c424aba18216810",
"size": "47... |
from __future__ import absolute_import, division, print_function
import pytest
sa = pytest.importorskip('sqlalchemy')
import itertools
from distutils.version import LooseVersion
import datashape
from odo import into, resource, discover
from pandas import DataFrame
from toolz import unique
from blaze.compute.sql i... | {
"content_hash": "1f33622122003ec791b71755ab552a10",
"timestamp": "",
"source": "github",
"line_count": 1908,
"max_line_length": 89,
"avg_line_length": 30.362683438155138,
"alnum_prop": 0.5619174204239453,
"repo_name": "ChinaQuants/blaze",
"id": "bb3933c5a09fefb6df865e74796f38ff3415f38e",
"size": "... |
"""distutils.command.install
Implements the Distutils 'install' command."""
import sys
import os
from distutils import log
from distutils.core import Command
from distutils.debug import DEBUG
from distutils.sysconfig import get_config_vars
from distutils.errors import DistutilsPlatformError
from distutils.file_util ... | {
"content_hash": "a5fd9fd89d7c761a1c3e95693572e604",
"timestamp": "",
"source": "github",
"line_count": 677,
"max_line_length": 81,
"avg_line_length": 40.602658788774,
"alnum_prop": 0.5702124563445867,
"repo_name": "ryfeus/lambda-packs",
"id": "400fb45dd0869f3c173a2e16a99894a15c484c18",
"size": "27... |
import os
import glideinwms_tarfile
import cStringIO
class FileDoesNotExist(Exception):
"""File does not exist exception
@note: Include the file name in the full_path
@ivar full_path: The full path to the missing file. Includes the file name
"""
def __init__(self, full_path):
message = "T... | {
"content_hash": "490fcf097045eb64965e9dc285abf93d",
"timestamp": "",
"source": "github",
"line_count": 132,
"max_line_length": 86,
"avg_line_length": 38.14393939393939,
"alnum_prop": 0.6190665342601788,
"repo_name": "bbockelm/glideinWMS",
"id": "410709edeacd2c0320ec20f1f9d442deaa2b30a3",
"size": "... |
"""The tests for mqtt select component."""
import json
from unittest.mock import patch
import pytest
from homeassistant.components import select
from homeassistant.components.mqtt.select import (
CONF_OPTIONS,
MQTT_SELECT_ATTRIBUTES_BLOCKED,
)
from homeassistant.components.select import (
ATTR_OPTION,
... | {
"content_hash": "22c67b7f43c688f828f977e66f4afcb3",
"timestamp": "",
"source": "github",
"line_count": 459,
"max_line_length": 120,
"avg_line_length": 31.70806100217865,
"alnum_prop": 0.6157757317575924,
"repo_name": "lukas-hetzenecker/home-assistant",
"id": "f2e48e10dc554ad2ecd744753b84abb280f679c7... |
def test_q_application(q_application):
from PyQt4 import QtGui
assert QtGui.QX11Info.display()
| {
"content_hash": "d0a64ebff38b7b1b9ff39cd236a23a3f",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 38,
"avg_line_length": 34.333333333333336,
"alnum_prop": 0.7475728155339806,
"repo_name": "manahl/pytest-plugins",
"id": "0e1c5125692fa37dedd9f302eb5ffc060fb294ad",
"size": ... |
import ctypes
import pathlib
import atexit
from pkg_resources import resource_filename
from typing import List
lib = ctypes.cdll.LoadLibrary(resource_filename('dex', 'libDex.so'))
def tagged_union(name: str, members: List[type]):
named_members = [(f"t{i}", member) for i, member in enumerate(members)]
payload = ty... | {
"content_hash": "de561b9ebd1db1c67c9faf8239e3275a",
"timestamp": "",
"source": "github",
"line_count": 108,
"max_line_length": 117,
"avg_line_length": 33.398148148148145,
"alnum_prop": 0.702800110895481,
"repo_name": "google-research/dex-lang",
"id": "a4ec8e18c22df848110685eed13fdbcc19cbc961",
"si... |
from buffer import Buffer
from connection import Connection
from friend import Friend
from ids import GID
from servers import servers
from steamid import SteamID
import web
| {
"content_hash": "e55f58499304b8712985b6149b94e126",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 33,
"avg_line_length": 24.714285714285715,
"alnum_prop": 0.8497109826589595,
"repo_name": "lunixbochs/vaporbat",
"id": "be0426d7cc217087fe1f590d6c990387002433ea",
"size": "1... |
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('products', '0018_delete_section'),
]
operations = [
migrations.AlterField(
model_name='chapter',
name='color',
field=models.CharField(blank=True, choices... | {
"content_hash": "cd36476c8b47446587952309e1b2764f",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 237,
"avg_line_length": 35.72222222222222,
"alnum_prop": 0.5637636080870918,
"repo_name": "flavoi/diventi",
"id": "84e8b764a360c5549b2f4f05711656300b488a3e",
"size": "1335"... |
import time
from urllib.parse import urljoin
import pytest
import requests
from generic_test_code.common import (
generic_correct_upstream_dest_test,
generic_correct_upstream_request_test,
header_is_absent,
verify_header,
)
from mocker.endpoints.marathon import (
SCHEDULER_APP_ALWAYSTHERE_DIFFEREN... | {
"content_hash": "df5c31165082c8f63ae311f46cb2538a",
"timestamp": "",
"source": "github",
"line_count": 977,
"max_line_length": 93,
"avg_line_length": 43.62538382804504,
"alnum_prop": 0.5541973628642485,
"repo_name": "kensipe/dcos",
"id": "41027cee6a6c92c7bd6eda2be8f4fecef56a3758",
"size": "42687",... |
import sys
sys.path.insert(1,"../")
import h2o
from tests import pyunit_utils
from h2o.estimators.glm import H2OGeneralizedLinearEstimator
import os
def test_hdfs_io():
'''
Test H2O read and write to hdfs
'''
hdfs_name_node = os.getenv("NAME_NODE")
print("Importing hdfs data")
h2o_data = h2o.i... | {
"content_hash": "67eb4f61e6b46e18fcb13b1e6806d571",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 104,
"avg_line_length": 34.5531914893617,
"alnum_prop": 0.6527093596059114,
"repo_name": "h2oai/h2o-dev",
"id": "d818cb7507701d6ec1fa56a401ba5d0377c1be6b",
"size": "1624",
... |
import json
import sys
from typing import cast, Dict, List, Union
import looker_sdk
from looker_sdk import models, error
import sdk_exceptions
sdk = looker_sdk.init31("../looker.ini")
def main() -> None:
"""Given a look id, obtain the query behind it and run it with the desired
filter values.
https:/... | {
"content_hash": "0fb4ac86b7d5f5eb644f6711efc0b86d",
"timestamp": "",
"source": "github",
"line_count": 88,
"max_line_length": 119,
"avg_line_length": 30.443181818181817,
"alnum_prop": 0.6424038820455393,
"repo_name": "looker-open-source/sdk-examples",
"id": "74c67271d4f2d60d3ee5ddecfa422ef51ad1e2d9"... |
import requests
import urllib
import csv
import os
import sys
from time import time
import argparse
from py_data_getter import data_getter
from py_db import db
db = db('nba_shots')
def initiate(start_year, end_year):
start_time = time()
print "-------------------------"
print "shots_Breakdown.py"
f... | {
"content_hash": "fde0d4850257d4052939ba3405ad79f3",
"timestamp": "",
"source": "github",
"line_count": 139,
"max_line_length": 243,
"avg_line_length": 33.388489208633096,
"alnum_prop": 0.6136608489549666,
"repo_name": "Connor-R/nba_shot_charts",
"id": "0b327eaf79e341b3f3ff8f439f066bb469435a0d",
"s... |
'''
Copyright (c) 2015 Joaquin Duo - File under MIT License
Code Licensed under MIT License. See LICENSE file.
To enable explicit relative importing in __main__, you simply import
this package before any relative import
Usage:
------
To enable explicit relative importing in __main__, you simply import
this package ... | {
"content_hash": "54949c26745c459bdd9fd85edf27967a",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 76,
"avg_line_length": 24.03846153846154,
"alnum_prop": 0.7504,
"repo_name": "joaduo/rel_imp",
"id": "58a36c886f1ffff7dd1bc8a17c17f6b217785678",
"size": "649",
"binary": ... |
import subprocess
import time
import praw
from hashlib import sha1
from flask import Flask
from flask import Response
from flask import request
from cStringIO import StringIO
from base64 import b64encode
from base64 import b64decode
from ConfigParser import ConfigParser
import OAuth2Util
import os
import markdown
impor... | {
"content_hash": "0ada34e5b91b21d1476b29cba475bc4c",
"timestamp": "",
"source": "github",
"line_count": 110,
"max_line_length": 131,
"avg_line_length": 38.25454545454546,
"alnum_prop": 0.6739543726235742,
"repo_name": "foobarbazblarg/stayclean",
"id": "34e0488f3d3ca2998001a6aba57c0e308e211523",
"si... |
from django.contrib.auth import login, logout, authenticate
from django.contrib.auth.forms import AuthenticationForm
from django.http import HttpResponse
from django.http import JsonResponse
from django.views.decorators.cache import never_cache
from django.views.decorators.csrf import csrf_protect, ensure_csrf_cookie
f... | {
"content_hash": "73450ad38beeb4980a470229894d2cd9",
"timestamp": "",
"source": "github",
"line_count": 60,
"max_line_length": 80,
"avg_line_length": 28.116666666666667,
"alnum_prop": 0.7326615293420272,
"repo_name": "BenjaminSchubert/HttpInfrastructure",
"id": "75e5aacc6537de0be3a8a4b0e056bc80176a89... |
"""
This module contains AWS SNS hook
"""
import json
from airflow.contrib.hooks.aws_hook import AwsHook
def _get_message_attribute(o):
if isinstance(o, bytes):
return {'DataType': 'Binary', 'BinaryValue': o}
if isinstance(o, str):
return {'DataType': 'String', 'StringValue': o}
if isinst... | {
"content_hash": "b407e0cb2a2896a5c7acbe07f78c6cd4",
"timestamp": "",
"source": "github",
"line_count": 76,
"max_line_length": 105,
"avg_line_length": 32.31578947368421,
"alnum_prop": 0.5850977198697068,
"repo_name": "owlabs/incubator-airflow",
"id": "ae6429356921df221d5ac7f2740768a1763f3bd6",
"siz... |
"""Tests for functions."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import re
import sys
import time
import numpy as np
from tensorflow.core.framework import function_pb2
from tensorflow.core.protobuf import config_pb2
from tensorflow.core.protobuf... | {
"content_hash": "82cddc4379b03f96da7f1c31427aaf87",
"timestamp": "",
"source": "github",
"line_count": 1850,
"max_line_length": 80,
"avg_line_length": 31.96108108108108,
"alnum_prop": 0.6326275199567041,
"repo_name": "jendap/tensorflow",
"id": "7543376bcf274dc6edf821e19838c4aa574826ff",
"size": "5... |
Experiment(description='More thorough version with more data',
data_dir='../data/tsdlr-400/',
max_depth=10,
random_order=True,
k=1,
debug=False,
local_computation=False,
n_rand=9,
sd=4,
max_jobs=400,
verbo... | {
"content_hash": "7a9dcd24b523e489a19634729df4ae6c",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 72,
"avg_line_length": 33.473684210526315,
"alnum_prop": 0.5141509433962265,
"repo_name": "codeaudit/gpss-research",
"id": "b9be50377915bd2dab46c07ae6c885f71433c2f4",
"size... |
from typing import Any, List, Union, Iterable, Optional
import bonsai
class LDAPValueList(list):
"""
Modified list that tracks added and deleted values. It also contains
only unique elements. The elements are compared to their lower-cased
string representations.
A new LDAPValueList can be create... | {
"content_hash": "48d939d9ca957b0132fb9dcb8b642079",
"timestamp": "",
"source": "github",
"line_count": 234,
"max_line_length": 76,
"avg_line_length": 33.25213675213675,
"alnum_prop": 0.5612389153065158,
"repo_name": "Noirello/bonsai",
"id": "24ec4e0223d065118e3c9d65187ad1afcfdee994",
"size": "7781... |
from django.shortcuts import render, get_object_or_404
from django.http import HttpResponse, HttpResponseRedirect
from django.core.urlresolvers import reverse
from django.contrib.auth.decorators import login_required
import datetime
from django.utils import timezone
from django.contrib.auth import authenticate, login, ... | {
"content_hash": "ac06af750f30d26789e53d4973191c4e",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 59,
"avg_line_length": 41.38461538461539,
"alnum_prop": 0.8420074349442379,
"repo_name": "bharathramh92/easy-ecom",
"id": "3d0a71ed45abead43d927dc2e339d4b2e6f2ac7f",
"size"... |
import json
import os.path
import requests
from html.parser import HTMLParser
from argparse import ArgumentParser
emojiListURL = 'http://unicode.org/emoji/charts/full-emoji-list.html'
class EmojiParser(HTMLParser):
def __init__(self, imgPath):
HTMLParser.__init__(self)
self.imgpath = imgPath
... | {
"content_hash": "9496d8d48d956841fa6061385ec25cee",
"timestamp": "",
"source": "github",
"line_count": 85,
"max_line_length": 103,
"avg_line_length": 35.705882352941174,
"alnum_prop": 0.5940691927512356,
"repo_name": "andresth/emojiselector",
"id": "ceb9d825a34c6ce738425c3a093f6df3c0365fdf",
"size... |
import os
from setuptools import setup, find_packages
here = os.path.abspath(os.path.dirname(__file__))
README = open(os.path.join(here, 'README.md')).read()
requires = [
'colormath',
'pyserial',
'requests',
'simplejson']
setup(
name='Lightbox',
version='1.0.1',
description=('Python library and ... | {
"content_hash": "77c2175e52ecfec0caff92f0982ed54f",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 80,
"avg_line_length": 28.02857142857143,
"alnum_prop": 0.6472986748216106,
"repo_name": "edelooff/Lightbox",
"id": "f6af55c191dbfff2273361f728ac9eae281535be",
"size": "981... |
from .Radius_client import Radius_client
from time import time
from functools import reduce
class RadiusAuthorisation(Radius_client):
def do_auth(self, username, caller, callee, h323_cid, sip_cid, remote_ip, res_cb, \
realm = None, nonce = None, uri = None, response = None, extra_attributes = None):
... | {
"content_hash": "7ff9db3d3313fcb73cf7f6e4e3c2fdd5",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 119,
"avg_line_length": 54.21951219512195,
"alnum_prop": 0.5677013045434098,
"repo_name": "hgascon/pulsar",
"id": "7b1e8cdef85d8c0558cc6ef2c6180a5b8aba1e22",
"size": "3348"... |
"""
Tests for the integration test suite itself.
"""
import logging
import os
import subprocess
from collections import defaultdict
from pathlib import Path
from typing import Set
import yaml
from get_test_group import patterns_from_group
__maintainer__ = 'adam'
__contact__ = '[email protected]'
log =... | {
"content_hash": "4cfb2f38183ec48aa346229ee6adf245",
"timestamp": "",
"source": "github",
"line_count": 112,
"max_line_length": 118,
"avg_line_length": 32.348214285714285,
"alnum_prop": 0.5956389732266077,
"repo_name": "mesosphere-mergebot/dcos",
"id": "cc57a137728a5fedfebf271e4d933206bec04fb7",
"s... |
import pytest
pytestmark = pytest.mark.django_db
def test_admin_interface(client):
public_urls = [
'/admin/login/',
'/',
'/about/',
'/privacy/',
]
for url in public_urls:
response = client.get('/admin/login/')
assert response.status_code == 200
| {
"content_hash": "611dceb1f3ab3755b5a5900e65ee85a3",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 46,
"avg_line_length": 20.533333333333335,
"alnum_prop": 0.5551948051948052,
"repo_name": "vipul-sharma20/fossevents.in",
"id": "6d8ea06d731f88a010626fb826d7fb1ed2750cbf",
... |
try:
# Python 2.7
from collections import OrderedDict
except:
# Python 2.6
from gluon.contrib.simplejson.ordered_dict import OrderedDict
from gluon import current
from gluon.storage import Storage
def config(settings):
"""
Template settings for a hosted environment to allow NGOs to share d... | {
"content_hash": "8c5808c2f05a6f53e73381323c6151a9",
"timestamp": "",
"source": "github",
"line_count": 361,
"max_line_length": 152,
"avg_line_length": 39.78116343490305,
"alnum_prop": 0.5604066569180419,
"repo_name": "flavour/Turkey",
"id": "cbb5a45539c2e70edf3d11dabf4c956270f5567d",
"size": "1448... |
from IECore import *
import sys
import unittest
class LensDistortOpTest(unittest.TestCase):
def testDistortOpWithStandardLensModel(self):
# The lens model and parameters to use.
o = CompoundObject()
o["lensModel"] = StringData( "StandardRadialLensModel" )
o["distortion"] = DoubleData( 0.2 )
o["anamorph... | {
"content_hash": "c002b211f6393beb450a8227803ca12d",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 90,
"avg_line_length": 27.6,
"alnum_prop": 0.6935817805383023,
"repo_name": "DoubleNegativeVisualEffects/cortex",
"id": "1b883118ebcd2c5bb011d066a48d3c61ef300e29",
"size": ... |
from . import test_access_rights
checks = [
test_access_rights,
]
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
| {
"content_hash": "b6add75ce50d9f3db9229a2a5c372bd2",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 65,
"avg_line_length": 19.714285714285715,
"alnum_prop": 0.7391304347826086,
"repo_name": "diogocs1/comps",
"id": "c79181f77104c59e58e6d7f6708df65cc4f943a9",
"size": "1124",... |
from __future__ import unicode_literals
from django.db import migrations, models
import django_extensions.db.fields
class Migration(migrations.Migration):
dependencies = [("data_finder", "0004_loggedpostcode_view_used")]
operations = [
migrations.CreateModel(
name="ElectionNotificationS... | {
"content_hash": "5fe72078da42d5e985337075ce08aebf",
"timestamp": "",
"source": "github",
"line_count": 46,
"max_line_length": 74,
"avg_line_length": 32.52173913043478,
"alnum_prop": 0.43783422459893045,
"repo_name": "DemocracyClub/UK-Polling-Stations",
"id": "f1b6ed3f82d4b141b085c1e05d30bec00da2529e... |
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('checkout', '0013_auto_20180112_1421'),
]
operations = [
migrations.AlterField(
model_name='item',
... | {
"content_hash": "7647e74019cfcaa5e77f9f88f2418c06",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 102,
"avg_line_length": 24.263157894736842,
"alnum_prop": 0.631236442516269,
"repo_name": "CoutinhoElias/danibraz",
"id": "7ffe6ebd24d1e19a2a182563d01e704f7046ebe7",
"size"... |
import unittest
from subprocess import check_output
def run(json):
return check_output(["./trost", "-j", "jsons/%s" % json]).strip()
class Quantum_Test(unittest.TestCase):
def test_print(self):
self.assertEqual("नमस्ते, Hello, Привет, 您好, ہیلو", run("print.json"))
def test_iadd(self):
... | {
"content_hash": "dca02c218ae2ac185e2937d26dcdb3a7",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 78,
"avg_line_length": 25.166666666666668,
"alnum_prop": 0.6070640176600441,
"repo_name": "trost-lang/quantum",
"id": "4e6769a588c0f338d275b938e3085749db890725",
"size": "9... |
from __future__ import unicode_literals
import unicodecsv as csv
from django.conf.urls import url
from django.contrib import messages
from django.forms.forms import pretty_name
from django.forms.models import inlineformset_factory, modelform_factory
from django.http import HttpResponseRedirect
from django.shortcuts i... | {
"content_hash": "9eca05811a07c8f7c54b98e856e73f43",
"timestamp": "",
"source": "github",
"line_count": 161,
"max_line_length": 92,
"avg_line_length": 33.45962732919255,
"alnum_prop": 0.5418600334137739,
"repo_name": "zatan/django-inline-csv-importer",
"id": "04e944e81ffe6e37550e9779afdfc951547eaeaa"... |
import exceptions as exc
import functools
import pecan
from oslo_log import log as logging
from pecan import rest
from nca47.common.i18n import _
LOG = logging.getLogger(__name__)
def expose(function):
"""
Packaging pecan RestController expose method. Resolving WSGi request body.
"""
... | {
"content_hash": "808aa09f2333e832da7dfb0bceb4ac94",
"timestamp": "",
"source": "github",
"line_count": 112,
"max_line_length": 78,
"avg_line_length": 32.705357142857146,
"alnum_prop": 0.5350805350805351,
"repo_name": "WosunOO/nca_xianshu",
"id": "aad2d8eca3c1e49c0133185974d76f27634c50af",
"size": ... |
from django.conf.urls import patterns, include, url
urlpatterns = patterns('',
) | {
"content_hash": "6c2e079224ad78d5425f9847aa76605f",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 51,
"avg_line_length": 20.25,
"alnum_prop": 0.7530864197530864,
"repo_name": "hfercc/mese2014",
"id": "6736aeccd43cd9925ba052c655b1f9cb824876e7",
"size": "81",
"binary": f... |
import importlib
import types
from js9 import j
class SourceLoader:
"""
holds the logic of building the code of a service actions
"""
def __init__(self, service):
self._module = None
self._source = None
self.service = service
def _load(self):
"""
load all ... | {
"content_hash": "b7bcf0b5b419808a57459413d14a474d",
"timestamp": "",
"source": "github",
"line_count": 78,
"max_line_length": 90,
"avg_line_length": 27.76923076923077,
"alnum_prop": 0.5069252077562327,
"repo_name": "Jumpscale/ays9",
"id": "8abb25f3ee4e83eb906665af5d1041b9aaa5cc43",
"size": "2166",... |
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "intown.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| {
"content_hash": "ef89594b8e27047073229e2edda5ce59",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 70,
"avg_line_length": 25.22222222222222,
"alnum_prop": 0.7092511013215859,
"repo_name": "brainless/intown",
"id": "084c8c0a23528d25e3312e1adc3b4f2d6e0d8566",
"size": "249",... |
from sentry.testutils import TestCase
from sentry.utils.data_scrubber import SensitiveDataFilter
VARS = {
'foo': 'bar',
'password': 'hello',
'the_secret': 'hello',
'a_password_here': 'hello',
'api_key': 'secret_key',
'apiKey': 'secret_key',
}
class SensitiveDataFilterTest(TestCase):
def... | {
"content_hash": "a3b7f91c7efa85da42e26addac97c865",
"timestamp": "",
"source": "github",
"line_count": 183,
"max_line_length": 95,
"avg_line_length": 32.66120218579235,
"alnum_prop": 0.5710222519658692,
"repo_name": "korealerts1/sentry",
"id": "2f0cae307753c898343d68f18946bea5f3cd96b2",
"size": "6... |
"""
Tests for projectq.backends._circuits._plot.py.
To generate the baseline images,
run the tests with '--mpl-generate-path=baseline'
Then run the tests simply with '--mpl'
"""
from copy import deepcopy
import pytest
import projectq.backends._circuits._plot as _plot
# =============================... | {
"content_hash": "ad80606a72ed76c3225eda945a0eac45",
"timestamp": "",
"source": "github",
"line_count": 248,
"max_line_length": 103,
"avg_line_length": 32.17741935483871,
"alnum_prop": 0.5715538847117795,
"repo_name": "ProjectQ-Framework/ProjectQ",
"id": "3e81d23d1b346f147885ebc3211f5489ef27f0ef",
... |
import webkitpy.thirdparty.unittest2 as unittest
from webkitpy.common.system.filesystem_mock import MockFileSystem
from webkitpy.common.system.outputcapture import OutputCapture
from webkitpy.common.system.workspace import Workspace
from webkitpy.common.system.executive_mock import MockExecutive
class WorkspaceTest(... | {
"content_hash": "91806286672ab45f38482fe5703e02a0",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 149,
"avg_line_length": 47.97727272727273,
"alnum_prop": 0.6575082899099952,
"repo_name": "lordmos/blink",
"id": "cc0de52fac6f24440fae578b6ed57cdc5ee00524",
"size": "3638",... |
import io
import os
import setuptools
# Package metadata.
name = 'google-cloud-pubsub'
description = 'Google Cloud Pub/Sub API client library'
version = '0.39.0'
# Should be one of:
# 'Development Status :: 3 - Alpha'
# 'Development Status :: 4 - Beta'
# 'Development Status :: 5 - Production/Stable'
release_status ... | {
"content_hash": "24d58a70a9563d450a21aa6f32a9931d",
"timestamp": "",
"source": "github",
"line_count": 76,
"max_line_length": 75,
"avg_line_length": 28.57894736842105,
"alnum_prop": 0.6597605893186004,
"repo_name": "dhermes/google-cloud-python",
"id": "14d78aa1a1ed9b729de2dd61a7d3cf1ef7629d5c",
"s... |
"""
Sales templatetags docstring
""" | {
"content_hash": "552fb37e61a80ba3199cd27ebb068b97",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 29,
"avg_line_length": 12.333333333333334,
"alnum_prop": 0.7027027027027027,
"repo_name": "alejo8591/maker",
"id": "62a3be44542927db920152611b2a8137de46bedd",
"size": "89",
... |
from django.test import TestCase
from django.urls import reverse
from django.contrib.auth.models import User
from netdevice.models import router, network_os, interface, logical_interface, vrf
from bgp.models import aut_num
def create_router(network_os_name):
nos = network_os.objects.get(name=network... | {
"content_hash": "6cc8db8f5d18e3bfa54b4105db232bc5",
"timestamp": "",
"source": "github",
"line_count": 142,
"max_line_length": 158,
"avg_line_length": 45.65492957746479,
"alnum_prop": 0.5384852691655098,
"repo_name": "lkmhaqer/gtools-python",
"id": "32effd21a962fc3e1aeb183b8b5b413ec3803bdd",
"size... |
import sys, os
import datetime
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#sys.path.append(os.path.abspath('.'))
# -- Gener... | {
"content_hash": "938b39ba5963ba7ce6338625d7185b72",
"timestamp": "",
"source": "github",
"line_count": 182,
"max_line_length": 80,
"avg_line_length": 32.61538461538461,
"alnum_prop": 0.710411051212938,
"repo_name": "sittizen/django-fullcalendar",
"id": "73921f13471bc750cf4b375dec2c21482604b0d3",
"... |
"""A class to store named variables and a scope operator to manage sharing."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import contextlib
import six
from tensorflow.python.framework import dtypes
from tensorflow.python.framework import ops
from ten... | {
"content_hash": "3f6c2f889fda559f9b82cab9f8e7687c",
"timestamp": "",
"source": "github",
"line_count": 549,
"max_line_length": 80,
"avg_line_length": 39.998178506375226,
"alnum_prop": 0.6796302199553714,
"repo_name": "4Quant/tensorflow",
"id": "7ffdd37212d67a64bdf8de21ab703c038522a0e4",
"size": "2... |
import fileinput
import pdb
import sys
import traceback
from itertools import permutations
def solve(paths):
cities = set()
distances = dict()
for start, end, distance in paths:
cities.add(start)
cities.add(end)
distances.setdefault(start, dict())[end] = distance
distances.... | {
"content_hash": "ce511c9edada1089e66cf334a02cde04",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 76,
"avg_line_length": 26.27777777777778,
"alnum_prop": 0.5972515856236786,
"repo_name": "BrendanLeber/adventofcode",
"id": "549b5cdaae6b43cccc4242c6e45c9c7e2c44b041",
"siz... |
"""
URLConf for Django user profile management.
Recommended usage is to use a call to ``include()`` in your project's
root URLConf to include this URLConf for any URL beginning with
'/profiles/'.
If the default behavior of the profile views is acceptable to you,
simply use a line like this in your root URLConf to set... | {
"content_hash": "6ce4495c17e251e6a1b2f79784d41e4a",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 70,
"avg_line_length": 38.53488372093023,
"alnum_prop": 0.5896197948098975,
"repo_name": "saebyn/django-profiles",
"id": "9f560f39847e0f54fe981566552fe2d3210baeaa",
"size":... |
from uuid import UUID
from org.apache.qpid.proton.engine import EndpointState, TransportException, Sasl, SslDomain
from org.apache.qpid.proton.engine.impl import ConnectionImpl, SessionImpl, \
SenderImpl, ReceiverImpl, TransportImpl
from org.apache.qpid.proton.engine.impl.ssl import SslDomainImpl, SslPeerDetailsIm... | {
"content_hash": "3da96f45c0e70072b7f7fa1646eeda1d",
"timestamp": "",
"source": "github",
"line_count": 894,
"max_line_length": 92,
"avg_line_length": 25.184563758389263,
"alnum_prop": 0.6643126804352654,
"repo_name": "chirino/proton",
"id": "6dabb9175d719eca096e62349afaaa38d6df6144",
"size": "2330... |
from mediapp.settings.base import *
from aws.conf import *
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
USE_TZ = True
ALLOWED_HOSTS = ['localhost','127.0.0.1','167.99.0.50','app.mediteccali.com']
#STATIC_ROOT = 'staticfiles'
INSTALLED_APPS += (
'storages',
)
| {
"content_hash": "13f09b73d7b767c35b35f6d5d62ebb55",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 77,
"avg_line_length": 18.9375,
"alnum_prop": 0.6897689768976898,
"repo_name": "andresmauro17/mediapp",
"id": "9dd1d0b1033ca0c789246f472943231a50cd6417",
"size": "303",
"... |
import unittest
from tf import tf
VALID_CONFIG = {
'project_root': '/tmp'
}
class CommandsTest(unittest.TestCase):
def test_terraform_command_with_arguments(self):
wrapper = tf.TF('test', 'qa', tfargs=['-target', 'test', '-Xdestroy', '-target=./mymodule'], config=VALID_CONFIG)
wrapper.build_path()
cm... | {
"content_hash": "e5d4770c5c53348a7914a7ce02cf7140",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 117,
"avg_line_length": 26.11111111111111,
"alnum_prop": 0.6180851063829788,
"repo_name": "micahlmartin/terraflow",
"id": "76861a0efdf67954528e21d694e4447144bb8b5e",
"size"... |
import argparse
import collections
from doctest import SKIP
import multiprocessing
import os
import re
import subprocess
import sys
import tempfile
# find our home
ROOT = os.path.abspath(os.path.join(os.path.dirname(sys.argv[0]), '../..'))
os.chdir(ROOT)
vendors = collections.defaultdict(list)
scores = collections.de... | {
"content_hash": "1315815b2b37d928b7ad78e31c2607f3",
"timestamp": "",
"source": "github",
"line_count": 624,
"max_line_length": 90,
"avg_line_length": 31.173076923076923,
"alnum_prop": 0.5653403249023237,
"repo_name": "ejona86/grpc",
"id": "cff53e5dc1537e4d72d5443ebe007580005fa1d7",
"size": "20054"... |
class Solution:
def minFlips(self, target: str) -> int:
answer=0
last='0'
for x in target:
if x!=last:
answer+=1
last=x
return answer
| {
"content_hash": "d36e8d64f87e4ce45e569bbe6159bf6c",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 43,
"avg_line_length": 23.5,
"alnum_prop": 0.40425531914893614,
"repo_name": "Magic07/online-judge-solutions",
"id": "9f54758bd8ef792701ec65b82982a1b123312c29",
"size": "23... |
import re
from os import path
from setuptools import setup
ROOT_DIR = path.abspath(path.dirname(__file__))
DESCRIPTION = 'Flask-Diced - CRUD views generator for Flask'
LONG_DESCRIPTION = open(path.join(ROOT_DIR, 'README.rst')).read()
VERSION = re.search(
"__version__ = '([^']+)'",
open(path.join(ROOT_DIR, 'fl... | {
"content_hash": "33734cb109f87bc4c4121a23c89fb4c1",
"timestamp": "",
"source": "github",
"line_count": 54,
"max_line_length": 71,
"avg_line_length": 30.703703703703702,
"alnum_prop": 0.5850422195416164,
"repo_name": "pyx/flask-diced",
"id": "a4f3e4242ae2cbf49bedf64a44ba813fd30b363a",
"size": "1682... |
import os
import sys
import resource
__all__ = ['release_syslim', 'tune_opencv', 'tune_tensorflow', 'initialize_main']
def release_syslim():
sys.setrecursionlimit(1000000)
try:
slim = 65536 * 1024
resource.setrlimit(resource.RLIMIT_STACK, (slim, slim))
except ValueError:
pass
de... | {
"content_hash": "68642e3404d608b3e1c7fc93a03bf000",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 81,
"avg_line_length": 21.714285714285715,
"alnum_prop": 0.649671052631579,
"repo_name": "vacancy/TensorArtist",
"id": "4b024b0f50a8187c6938ba60ab710cf06cbe3ad1",
"size": "... |
"""NginxParser is a member object of the NginxConfigurator class."""
import copy
import glob
import logging
import os
import pyparsing
import re
from certbot import errors
from certbot_nginx import obj
from certbot_nginx import nginxparser
logger = logging.getLogger(__name__)
class NginxParser(object):
"""Cla... | {
"content_hash": "7b416278ef5844bcdd83c24c7d65200c",
"timestamp": "",
"source": "github",
"line_count": 572,
"max_line_length": 93,
"avg_line_length": 35.21503496503497,
"alnum_prop": 0.5741945092587996,
"repo_name": "jtl999/certbot",
"id": "a9ef21f2ec2de99159729b8ee34f027f90db8276",
"size": "20143... |
from ..testutil import eq_
from ..notify import Broadcaster, Listener, Repeater
class HelloListener(Listener):
def __init__(self, broadcaster):
Listener.__init__(self, broadcaster)
self.hello_count = 0
def hello(self):
self.hello_count += 1
class HelloRepeater(Repeater):
def __ini... | {
"content_hash": "64c3467c283bfac072bb0660134849f0",
"timestamp": "",
"source": "github",
"line_count": 134,
"max_line_length": 96,
"avg_line_length": 29.380597014925375,
"alnum_prop": 0.6309372618745237,
"repo_name": "hsoft/currency_server",
"id": "336be66b328948e24cacebdb801768eebfa857e9",
"size"... |
"""
This script computes the absolute trajectory error from the ground truth
trajectory and the estimated trajectory.
"""
import sys
import numpy
import argparse
import associate
def align(model,data):
"""Align two trajectories using the method of Horn (closed-form).
Input:
model -- first trajectory ... | {
"content_hash": "893452c7f4df40ee13af98ad6be65269",
"timestamp": "",
"source": "github",
"line_count": 159,
"max_line_length": 189,
"avg_line_length": 42.716981132075475,
"alnum_prop": 0.6409010600706714,
"repo_name": "introlab/rtabmap_ros",
"id": "6b23f42f2650d9fdaf6a04201159a032602f3d50",
"size"... |
"""
Unit Tests for the --Problem Name-- problem
for Google Code Jam --Year--
--Round--
Link to problem description:
--Link--
Author:
Chris Nitsas
(nitsas)
Language:
Python 3(.4)
Date:
--Date--
Usage:
python3 test_runme.py
"""
import io
import os
import sys
import unittest
# modules I've written:
import... | {
"content_hash": "adcd6eef668efa2165cf98d64068f2df",
"timestamp": "",
"source": "github",
"line_count": 86,
"max_line_length": 83,
"avg_line_length": 24.58139534883721,
"alnum_prop": 0.6263008514664143,
"repo_name": "nitsas/codejamsolutions",
"id": "7b9f3451bab2ef7d26d39e22b38ab08ebfd3f1f9",
"size"... |
def extractRosetranslatorWordpressCom(item):
'''
Parser for 'rosetranslator.wordpress.com'
'''
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or "preview" in item['title'].lower():
return None
tagmap = [
('PRC', 'PRC', 'translated'),
... | {
"content_hash": "381711d1d075529fc2cd2ff3906f2dd2",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 104,
"avg_line_length": 27,
"alnum_prop": 0.6402116402116402,
"repo_name": "fake-name/ReadableWebProxy",
"id": "0130dbe2d576ab2963989cc6ed44d6cfa1f8f88a",
"size": "568",
... |
import os
from django.db import models
from django import forms
from .files import ProcessorFieldFile
from .widgets import ClearableProcessedFileInput
class FileFieldProcessor(forms.FileField):
widget = ClearableProcessedFileInput
class FileProcessorField(models.FileField):
attr_class = ProcessorFieldFile
... | {
"content_hash": "30a10cabc5a7a868a24f7bd96677b662",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 97,
"avg_line_length": 33.40909090909091,
"alnum_prop": 0.6863945578231293,
"repo_name": "syrusakbary/django-processorfield",
"id": "737db8d8dee320c2f5f084e5fcf723a0767cbc1c"... |
from logging import getLogger
from cornice.resource import resource, view
from openprocurement.api.models import Bid, get_now
from openprocurement.api.utils import (
save_tender,
set_ownership,
apply_patch,
error_handler,
update_journal_handler_params,
)
from openprocurement.api.validation import (
... | {
"content_hash": "1d4db7f67218f4730421b6a1d56b89f3",
"timestamp": "",
"source": "github",
"line_count": 302,
"max_line_length": 150,
"avg_line_length": 35.682119205298015,
"alnum_prop": 0.4843170007423905,
"repo_name": "selurvedu/openprocurement.api",
"id": "cbe35d8ada1e7b32e62da62105327add835d8451",... |
"""
Copyright 2020 Google LLC
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distrib... | {
"content_hash": "64d17b42e9889ef09090a318a87cd8d4",
"timestamp": "",
"source": "github",
"line_count": 264,
"max_line_length": 304,
"avg_line_length": 32.333333333333336,
"alnum_prop": 0.6403467666354264,
"repo_name": "google/debaised-analysis",
"id": "f6186ab4a7f52bcc2af19ba7f4fa90ccfcd21462",
"s... |
import spidev
class mcp3208:
#initialize mcp3208 on chip select device
def __init__(self,device):
self.values = [-1] * 8
self.spi = spidev.SpiDev()
self.spi.open(0,device)
#Read MCP3208 and return array of value of each channel
def readADC(self):
for channel in range(0,8):
self.values[channel] = ... | {
"content_hash": "395466ae0adeb2140b3ea3ecb75deb21",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 73,
"avg_line_length": 25.387096774193548,
"alnum_prop": 0.6734434561626429,
"repo_name": "spencerdb/rpi-arena",
"id": "391ad41c194e01251ccee1f485f9be98efa7f8ef",
"size": "... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.