text stringlengths 4 1.02M | meta dict |
|---|---|
from typing import Any
import pytest
from datadog_checks.base import AgentCheck
from datadog_checks.base.stubs.aggregator import AggregatorStub
from .common import CHECK_CONFIG
from .metrics import METRICS
@pytest.mark.e2e
def test_e2e(dd_agent_check):
# type: (Any) -> None
aggregator = dd_agent_check(CHEC... | {
"content_hash": "fd71c4f8bbac7c637ef258178e080ca6",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 93,
"avg_line_length": 28.925925925925927,
"alnum_prop": 0.6850192061459667,
"repo_name": "DataDog/integrations-extras",
"id": "30c756f74d131409a3130305262316e585327141",
"... |
"""Cloudhands DB server functions
This file contains functions which either make direct modifications to the
Cloudhands database, request information from the DB, or bundle a series of
functions which cause a number of DB changes to take effect.
"""
from collections import OrderedDict
#We need everything from the mo... | {
"content_hash": "03968975e7c8f886ef80dbf225d3853f",
"timestamp": "",
"source": "github",
"line_count": 917,
"max_line_length": 95,
"avg_line_length": 35.55070883315158,
"alnum_prop": 0.6269018404907976,
"repo_name": "cedadev/eos-db",
"id": "a03980e5f41ab8b2da2d8ccd7096e8703b91eaa3",
"size": "32600... |
"""
The ``mlflow.projects`` module provides an API for running MLflow projects locally or remotely.
"""
import json
import yaml
import os
import logging
import mlflow.projects.databricks
from mlflow import tracking
from mlflow.entities import RunStatus
from mlflow.exceptions import ExecutionException, MlflowException
... | {
"content_hash": "98b4510259f0003e81dc811d66e6afaa",
"timestamp": "",
"source": "github",
"line_count": 422,
"max_line_length": 100,
"avg_line_length": 40.09715639810427,
"alnum_prop": 0.6359553217894923,
"repo_name": "mlflow/mlflow",
"id": "c26fffd3a4f92e6726b85e5e654d3f48484e8974",
"size": "16921... |
import unittest
from sqltxt.sql_tokenizer import select_stmt, parse
class SqlTokenizerTest(unittest.TestCase):
def test_parse_select_list(self):
parsed = select_stmt.parseString('select col1 from table1')
self.assertEqual(list(parsed.column_definitions), ['col1'])
parsed = select_stmt.par... | {
"content_hash": "09c2ef56fc7338d8fa2eefb661bdeb99",
"timestamp": "",
"source": "github",
"line_count": 144,
"max_line_length": 83,
"avg_line_length": 37.416666666666664,
"alnum_prop": 0.557720861172977,
"repo_name": "shahin/sqltxt",
"id": "124e6ee9b13a57e7fff0b1786752b7106de2bbc2",
"size": "5388",... |
# -*- coding: utf-8 -*-
# ProjectEuler/src/python/problem394.py
#
# Eating pie
# ==========
# Published on Saturday, 15th September 2012, 08:00 pm
#
# Jeff eats a pie in an unusual way. The pie is circular. He starts with
# slicing an initial cut in the pie along a radius. While there is at least a
# given fraction ... | {
"content_hash": "5bc831914b8dfa7cc8b838353b145603",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 79,
"avg_line_length": 37.375,
"alnum_prop": 0.7134894091415831,
"repo_name": "olduvaihand/ProjectEuler",
"id": "8928326834d3edfaf8b3a7a5cd728d4e2ef5c7a3",
"size": "899",
... |
import pymongo
import ssl
MONGODB_URL = 'mongodb://admin:[email protected]:26175,bluemix-sandbox-dal-9-portal.6.dblayer.com:26175/admin?ssl=true'
client = pymongo.MongoClient(MONGODB_URL, ssl_cert_reqs=ssl.CERT_NONE)
db = client.get_default_database()
print(db.collection_name... | {
"content_hash": "f26c95cbe871bc5054b33c83c4b41e88",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 161,
"avg_line_length": 40.625,
"alnum_prop": 0.7876923076923077,
"repo_name": "weizy1981/WatsonRobot",
"id": "8cf2499a0c50a96358c2dcad7106ba532cd7ad27",
"size": "325",
"b... |
"""
Device tracker platform that adds support for OwnTracks over MQTT.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/device_tracker.owntracks/
"""
import json
import logging
from homeassistant.components import zone as zone_comp
from homeassistant.comp... | {
"content_hash": "f0fc808fbd3e6fca9e6628175cb51388",
"timestamp": "",
"source": "github",
"line_count": 358,
"max_line_length": 79,
"avg_line_length": 32.07821229050279,
"alnum_prop": 0.6359282479972135,
"repo_name": "jamespcole/home-assistant",
"id": "f1214b62b0edc0e040c9c7f957414b6ed3c9881a",
"si... |
import re
from typing import Tuple, Union, List
from refprocessor.common import RANGE_REGEXP, SIGN_GT, SIGN_GTE, SIGN_LT, SIGN_LTE, get_sign_by_string, ValueRange, POINT_STRICT, Value, RANGE_IN
class AgeRight:
MODE_DAY = "day"
MODE_MONTH = "month"
MODE_YEAR = "year"
MODE_UNKNOWN = "unknow"
DAY_O... | {
"content_hash": "a20d716165686e88568390b451893237",
"timestamp": "",
"source": "github",
"line_count": 202,
"max_line_length": 145,
"avg_line_length": 30.643564356435643,
"alnum_prop": 0.5274636510500808,
"repo_name": "moodpulse/l2",
"id": "4f005c42cc9df57ac53c8761ed25ea23356f6aaf",
"size": "6268"... |
"""
english.py
Tools for NLG.
"""
from utils import *
@instance
class number:
@instance
class singular: pass
@instance
class plural: pass
@instance
class gender:
@instance
class masculine: pass
@instance
class feminine: pass
@instance
class neuter: pass
| {
"content_hash": "0c1d266f9163e7e85912c4e9031e4e28",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 23,
"avg_line_length": 12.590909090909092,
"alnum_prop": 0.703971119133574,
"repo_name": "solsword/dunyazad",
"id": "64db7c67b1e801609c9049d3a118073c432b57bd",
"size": "277... |
import json
from django.contrib.auth.models import User
from django.db import models
from django.db.models.signals import post_save
from django.utils.functional import cached_property
from dateutil.rrule import rrule, MONTHLY
from slugify import slugify
from wye.base.constants import WorkshopStatus
from wye.regions.m... | {
"content_hash": "0f2bd0f7849e80a55121ff0262eba4f8",
"timestamp": "",
"source": "github",
"line_count": 176,
"max_line_length": 87,
"avg_line_length": 34.76136363636363,
"alnum_prop": 0.6153971886237333,
"repo_name": "DESHRAJ/wye",
"id": "719d95af373e2ec64ec99e055fbec49be39228d3",
"size": "6118",
... |
from pandasqt.compat import QtCore, QtGui, Qt, Signal, Slot
class OverlayProgressWidget(QtGui.QFrame):
def __init__(self, parent, workers=[], debug=True, margin=0):
super(OverlayProgressWidget, self).__init__(parent)
self._debug = debug
self._workers = workers
self._detailProgressBa... | {
"content_hash": "8d42c5feda123b523857a88d39b0de3a",
"timestamp": "",
"source": "github",
"line_count": 121,
"max_line_length": 108,
"avg_line_length": 33.37190082644628,
"alnum_prop": 0.612184249628529,
"repo_name": "datalyze-solutions/pandas-qt",
"id": "2ebce7da2ee77da6abce4abeb522023e6b935a1c",
... |
import logging
import core
import models
from mapreduce import operation as op
from mapreduce.api.map_job import mapper
from google.appengine.ext import db
class RecreateMapper(mapper.Mapper):
"""This sets all the default values on an entity's fields.
It's useful when we add fields.
"""
def __call__(self,... | {
"content_hash": "7a894b463b777bbf159c2d8c8263b6ed",
"timestamp": "",
"source": "github",
"line_count": 106,
"max_line_length": 95,
"avg_line_length": 33.95283018867924,
"alnum_prop": 0.6540705751597666,
"repo_name": "hjfreyer/marry-fuck-kill",
"id": "861aa36446917d85190cf1afe2973b9cf26525a6",
"siz... |
"""
WSGI config for myforum project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTI... | {
"content_hash": "dc2e3869c2bde5002b5a80c295234fcd",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 78,
"avg_line_length": 24.4375,
"alnum_prop": 0.7698209718670077,
"repo_name": "zalax303/test_django",
"id": "437b10ae9d0c555d23227a73c698f9d5fdce2bc7",
"size": "391",
"b... |
"""Copyright 2008 Orbitz WorldWide
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
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software... | {
"content_hash": "cf5362ce40eb4264a65088bf4cdd905e",
"timestamp": "",
"source": "github",
"line_count": 120,
"max_line_length": 110,
"avg_line_length": 32.9,
"alnum_prop": 0.704660587639311,
"repo_name": "eberle1080/tesserae-ng",
"id": "a45db78b30bc59afc32c5ed370031542b3249ec6",
"size": "3948",
"... |
'''
simple shortcut for running nosetests via python
replacement for *.bat or *.sh wrappers
'''
import sys
from os.path import abspath, dirname
import nose
def run_all(argv=None):
sys.exitfunc = lambda msg = 'Process shutting down...': sys.stderr.write(msg + '\n')
if argv is None:
argv = [
... | {
"content_hash": "bc00369c8449dbb58feff7c1085fe4f2",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 88,
"avg_line_length": 21.333333333333332,
"alnum_prop": 0.565625,
"repo_name": "ella/ella-taggit",
"id": "9d66d3c96c52a7e7515bd4873e5ca00b034dfbdd",
"size": "663",
"bina... |
"""
This is a tutorial on how to create a Bayesian network, and perform
exact MAX-SUM inference on it.
"""
"""Import the required numerical modules"""
import numpy as np
"""Import the GrMPy modules"""
import models
import inference
import cpds
if __name__ == '__main__':
"""
This example is based... | {
"content_hash": "5574c11082377743f73b9619bed10665",
"timestamp": "",
"source": "github",
"line_count": 103,
"max_line_length": 75,
"avg_line_length": 31.398058252427184,
"alnum_prop": 0.5333951762523191,
"repo_name": "bhrzslm/uncertainty-reasoning",
"id": "0d610c33eee0c60ff37e739ea7b237b7fd0b7505",
... |
import json
from chargebee.model import Model
from chargebee import request
from chargebee import APIError
class Export(Model):
class Download(Model):
fields = ["download_url", "valid_till", "mime_type"]
pass
fields = ["id", "operation_type", "mime_type", "status", "created_at", "download"]
de... | {
"content_hash": "6d9ea60cd31ef81fa32e6ad85a2ded81",
"timestamp": "",
"source": "github",
"line_count": 96,
"max_line_length": 108,
"avg_line_length": 40.770833333333336,
"alnum_prop": 0.6699029126213593,
"repo_name": "chargebee/chargebee-python",
"id": "32c3be660318a620aef2cb93c78223bd51d863ef",
"... |
# Lint as: python2, python3
# Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
... | {
"content_hash": "8d30e4d5fbfde01f1bbd3d7080915747",
"timestamp": "",
"source": "github",
"line_count": 343,
"max_line_length": 80,
"avg_line_length": 34.78425655976677,
"alnum_prop": 0.6737071494426284,
"repo_name": "Intel-Corporation/tensorflow",
"id": "1eeca809d476782e08ff8782ca80c161e3dfb895",
... |
from django import forms
from django.core.urlresolvers import reverse
from django.conf import settings
from django.views.generic import FormView
from django.utils.translation import ugettext as _
from mailsnake import MailSnake
class SubscriptionForm(forms.Form):
name = forms.CharField(label=_('Name'), max_length... | {
"content_hash": "5a8368b2bbc7d9e56a103d6b6be2c0cb",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 78,
"avg_line_length": 34.696969696969695,
"alnum_prop": 0.6698689956331878,
"repo_name": "simonluijk/django-chimps",
"id": "9a9cbde0e23b0778929ed09620d85f987f8586f8",
"siz... |
from ccxt.base.exchange import Exchange
from ccxt.base.errors import ExchangeError
from ccxt.base.errors import AuthenticationError
from ccxt.base.errors import PermissionDenied
from ccxt.base.errors import ArgumentsRequired
from ccxt.base.errors import BadRequest
from ccxt.base.errors import BadSymbol
from ccxt.base.e... | {
"content_hash": "3b8bd76cd3f2845f5878d59499bafc8e",
"timestamp": "",
"source": "github",
"line_count": 2565,
"max_line_length": 292,
"avg_line_length": 44.54307992202729,
"alnum_prop": 0.47934846349767624,
"repo_name": "ccxt/ccxt",
"id": "81342e19f3b2f5efba994b39ace16ea51814100e",
"size": "114438"... |
import os
from email.mime.image import MIMEImage
from django.conf import settings
from django.core.files.images import File
from django.core.mail import EmailMultiAlternatives, send_mail, EmailMessage
from django.core.mail.backends.base import BaseEmailBackend
from django.test import TestCase
from django.test.utils imp... | {
"content_hash": "38dab4725f549cd260db368590078799",
"timestamp": "",
"source": "github",
"line_count": 136,
"max_line_length": 119,
"avg_line_length": 42.81617647058823,
"alnum_prop": 0.6426240769362871,
"repo_name": "jrief/django-post_office",
"id": "083b64288a43f401d44a999bd3c8f05bbde8eca6",
"si... |
import pytest
from selenium.common.exceptions import (
ElementNotSelectableException,
NoSuchElementException,
UnexpectedTagNameException)
from selenium.webdriver.support.ui import Select
from selenium.webdriver.common.by import By
disabledSelect = {'name': 'no-select', 'values': ['Foo']}
singleSelectValue... | {
"content_hash": "ec19782bb2c6fc1ccbfa5096800921a7",
"timestamp": "",
"source": "github",
"line_count": 293,
"max_line_length": 138,
"avg_line_length": 39.50511945392491,
"alnum_prop": 0.6790496760259179,
"repo_name": "GorK-ChO/selenium",
"id": "4c287b4d3569d9b8bdf179fbd6ac3638da93bafe",
"size": "1... |
'''
Created on Mar 18, 2014
@author: nathan
'''
from functools import wraps
SHORT_SIZE = 99
CHUNK_SIZE = 999
def make_sender_line(name):
'''
Create a formatted, encoded sender line
'''
return 'FROM {name}\n'.format(name=name).encode('ascii')
def make_body(*body):
'''
Create an encoded bo... | {
"content_hash": "dc63ac41dcfdfb0587f9d4ca64eb519d",
"timestamp": "",
"source": "github",
"line_count": 75,
"max_line_length": 78,
"avg_line_length": 25.14666666666667,
"alnum_prop": 0.6261930010604454,
"repo_name": "Lucretiel/NPproject3",
"id": "75d0bcb8ae2dc6c5d7c16a2e65b1d0eec2a0928c",
"size": "... |
"""Utility functions for processes.
"""
import os
import sys
import subprocess
import errno
import select
import logging
import signal
import resource
from cStringIO import StringIO
from ganeti import errors
from ganeti import constants
from ganeti import compat
from ganeti.utils import retry as utils_retry
from ... | {
"content_hash": "cf5eafe3190bc6aec9d9d479888ca79b",
"timestamp": "",
"source": "github",
"line_count": 1043,
"max_line_length": 80,
"avg_line_length": 28.53307766059444,
"alnum_prop": 0.6380040322580646,
"repo_name": "apyrgio/snf-ganeti",
"id": "dccee318fb56c9e4c962b1e00d4b04c9888223ae",
"size": "... |
from djangae.test import TestCase
from ..fields import Field
class fieldTestCase(TestCase):
def test_clean_token_trailing_plus(self):
field = Field()
token = "a+"
cleaned_token = field.clean_token(token)
self.assertEqual(token, cleaned_token)
def test_clean_token_plus_in_word(... | {
"content_hash": "0ff408436ca3a2ef5becfb393c96fc04",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 49,
"avg_line_length": 30.764705882352942,
"alnum_prop": 0.607074569789675,
"repo_name": "potatolondon/djangae",
"id": "a6dabd6594bcebd4edc1375a240414b0dba1ac2d",
"size": "... |
import unittest
from airflow.utils.trigger_rule import TriggerRule
class TestTriggerRule(unittest.TestCase):
def test_valid_trigger_rules(self):
self.assertTrue(TriggerRule.is_valid(TriggerRule.ALL_SUCCESS))
self.assertTrue(TriggerRule.is_valid(TriggerRule.ALL_FAILED))
self.assertTrue(Tri... | {
"content_hash": "4bdf3cad4bcd91992e847e9fbde46e33",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 81,
"avg_line_length": 50.1764705882353,
"alnum_prop": 0.7502930832356389,
"repo_name": "owlabs/incubator-airflow",
"id": "844f98c6852a542d634bf2d2ba7f0f28c2c13c76",
"size"... |
"""A non-blocking, single-threaded HTTP server.
Typical applications have little direct interaction with the `HTTPServer`
class except to start a server at the beginning of the process
(and even that is often done indirectly via `tornado.web.Application.listen`).
This module also defines the `HTTPRequest` class which... | {
"content_hash": "8f8d8943d73b7295846e65780aa8e0a1",
"timestamp": "",
"source": "github",
"line_count": 481,
"max_line_length": 89,
"avg_line_length": 38.99584199584199,
"alnum_prop": 0.6047342325531802,
"repo_name": "Yelp/zygote",
"id": "ed6381d8888c14e8113d2b269aa6862bb64c7fb4",
"size": "19939",
... |
import itertools
import uuid
import numpy as np
from google.protobuf.json_format import MessageToDict
from sklearn import metrics
from sklearn.linear_model import LogisticRegression, LinearRegression
from federatedml.model_base import Metric, MetricMeta
from federatedml.evaluation.metrics.regression_metric import IC,... | {
"content_hash": "38630d9c366c7ba0f9d6f090c745adab",
"timestamp": "",
"source": "github",
"line_count": 482,
"max_line_length": 117,
"avg_line_length": 45.28630705394191,
"alnum_prop": 0.5764614256917721,
"repo_name": "FederatedAI/FATE",
"id": "acb280b343a22f201141a1ef778f4fe0e51acbc1",
"size": "22... |
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('application', '0012_application_duplicate'),
]
operations = [
migrations.AddField(
model_name='application',
name='approval_... | {
"content_hash": "2b0bc3477ed0e3d0e760ff9e06ce294c",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 61,
"avg_line_length": 22.61111111111111,
"alnum_prop": 0.6142506142506142,
"repo_name": "RightToResearch/OpenCon-Rating-App",
"id": "11a0e96df8f37eb09cc4ada5f07a0263a28c6da6... |
class ModelTestCase(object):
def runTest(self):
pass | {
"content_hash": "c0dc1e905ef70e73903adb474064723d",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 28,
"avg_line_length": 21.333333333333332,
"alnum_prop": 0.65625,
"repo_name": "TeamADEA/Hunger_Games",
"id": "d56ce5f1d8ced70cd199d0e42cf1a6b3a4e19f64",
"size": "105",
"b... |
"""peep ("prudently examine every package") verifies that packages conform to a
trusted, locally stored hash and only then installs them::
peep install -r requirements.txt
This makes your deployments verifiably repeatable without having to maintain a
local PyPI mirror or use a vendor lib. Just update the version ... | {
"content_hash": "2f700a649e99165087fafec223288046",
"timestamp": "",
"source": "github",
"line_count": 878,
"max_line_length": 157,
"avg_line_length": 36.90432801822323,
"alnum_prop": 0.6079254367014382,
"repo_name": "DESHRAJ/fjord",
"id": "c3f490d9965759b01fc9c3bc9a3ef71d0c9bcb20",
"size": "32424... |
import re
def getVtt(fname):
with open(fname) as f:
content = f.readlines()
content = [x.strip() for x in content]
p = re.compile('\d{2}:\d{2}:\d{2}.\d{3} --> \d{2}:\d{2}:\d{2}.\d{3}')
pureText = ""
pay_attention = False
for line in content:
if p.match(line) != None:
... | {
"content_hash": "2128090b724d4f7ac02e561d06fbd480",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 119,
"avg_line_length": 32.166666666666664,
"alnum_prop": 0.5689119170984456,
"repo_name": "aktivkohle/youtube-curation",
"id": "5841d766c43ec6f6373ccf561c3d4afa0bb2e153",
... |
from django.conf import settings
from django.contrib.auth.models import Group, User
from django.db import models
from django.template.defaultfilters import slugify
from django.utils.translation import gettext_lazy as _lazy
from kitsune.sumo.models import ModelBase
from kitsune.sumo.urlresolvers import reverse
from kit... | {
"content_hash": "8c7f8e27f3809cc0102bad516e7114f2",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 96,
"avg_line_length": 33.59090909090909,
"alnum_prop": 0.6928281461434371,
"repo_name": "mozilla/kitsune",
"id": "dc912e5b1f5f5fbba3e36d8c35c3def498377c87",
"size": "1478"... |
"""Tornado handlers for kernel specifications."""
# Copyright (c) IPython Development Team.
# Distributed under the terms of the Modified BSD License.
import glob
import json
import os
pjoin = os.path.join
from tornado import web
from ...base.handlers import IPythonHandler, json_errors
from ...utils import url_path... | {
"content_hash": "4e08feb29efa86a085893265fa29d88b",
"timestamp": "",
"source": "github",
"line_count": 86,
"max_line_length": 94,
"avg_line_length": 30.151162790697676,
"alnum_prop": 0.6047049749325106,
"repo_name": "initNirvana/Easyphotos",
"id": "72397788f4f1e27baa692e350f8664d67af8f32f",
"size"... |
import rules
| {
"content_hash": "880aa50730a5d7c617be48bcfcd4f985",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 12,
"avg_line_length": 13,
"alnum_prop": 0.8461538461538461,
"repo_name": "asyncee/django-application-template",
"id": "1239971dc264fd5b8ea363850c3db2d41b64266b",
"size": "1... |
import sys
import os
import random
import math
from PIL import Image, ImageEnhance, ImageFilter
import numpy as np
import h5py
import threading
import signal
if len(sys.argv) != 5:
print('Usage: %s datasetDir numSamples batchSize sphereProbability' % sys.argv[0])
sys.exit(1)
datasetDir, N, BATCH_SIZE, probabi... | {
"content_hash": "abd067aee3450f7da263d2ba6e2de376",
"timestamp": "",
"source": "github",
"line_count": 229,
"max_line_length": 147,
"avg_line_length": 35.375545851528386,
"alnum_prop": 0.5788174299469201,
"repo_name": "Hornobster/Ball-Tracking",
"id": "af626aa92255e6ad01b87bcd20357fb25945b8c2",
"s... |
"""
Copyright 2012 GroupDocs.
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
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in w... | {
"content_hash": "fc324a4d04ec619512e05a9ed780656f",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 77,
"avg_line_length": 30.37837837837838,
"alnum_prop": 0.6432384341637011,
"repo_name": "liosha2007/temporary-groupdocs-python3-sdk",
"id": "bfed8e15359d40d88049c65aa3b70a02... |
import os
from chainer import computational_graph
from chainer import configuration
from chainer.training import extension
from chainer import variable
_var_style = {'shape': 'octagon', 'fillcolor': '#E0E0E0', 'style': 'filled'}
_func_style = {'shape': 'record', 'fillcolor': '#6495ED', 'style': 'filled'}
def dump_... | {
"content_hash": "ffd023623dbde40894ffc94101b5b7de",
"timestamp": "",
"source": "github",
"line_count": 96,
"max_line_length": 78,
"avg_line_length": 39.229166666666664,
"alnum_prop": 0.6577270313329793,
"repo_name": "jnishi/chainer",
"id": "5d3d02a103a494d56fea460ed571754ed81cfb84",
"size": "3766"... |
from __future__ import unicode_literals
import webnotes
import inspect, os, json, datetime, shutil
from jinja2 import Environment, FileSystemLoader
from webnotes.modules import get_doc_path, get_module_path, scrub
from webnotes.utils import get_path, get_base_path
class DocType:
def __init__(self, d, dl):
self.d... | {
"content_hash": "0cb98d9dd54b39958c871e4037241bcb",
"timestamp": "",
"source": "github",
"line_count": 511,
"max_line_length": 151,
"avg_line_length": 29.59491193737769,
"alnum_prop": 0.6138993585928718,
"repo_name": "rohitw1991/latestadbwnf",
"id": "b052672cedefaec7f56ac8780d1326a00c936ffe",
"siz... |
"""Tests for augment.inline."""
# Copyright 2021 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 applicab... | {
"content_hash": "9a5a19683eb2ac443b5ee49d4bd62caf",
"timestamp": "",
"source": "github",
"line_count": 96,
"max_line_length": 78,
"avg_line_length": 30.375,
"alnum_prop": 0.6340877914951989,
"repo_name": "google/pasta",
"id": "8299a5e9d809643614a8be0d4f9d911103ca1da7",
"size": "2931",
"binary": ... |
import sys, getopt
from github import Github
def main(argv):
opts, args = getopt.getopt(argv,"r:p:t:")
for opt, arg in opts:
if opt == "-p":
pull = int(arg)
elif opt == "-r":
repo = arg.strip()
elif opt == "-t":
token = arg.strip()
print pull, r... | {
"content_hash": "550cc372befad95e6e533758e91e7a3e",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 123,
"avg_line_length": 25.115384615384617,
"alnum_prop": 0.555895865237366,
"repo_name": "AleksueiR/glitch",
"id": "aee3197fb3e3b2287c2198e7f391a1b767a99945",
"size": "672... |
import openpnm as op
ws = op.Workspace()
class LabelTest:
def setup_class(self):
pass
def teardown_class(self):
ws.clear()
def test_bravais_fcc(self):
net = op.network.FaceCenteredCubic(shape=[4, 4, 4])
assert 'pore.surface' in net.keys()
assert net.num_pores('lef... | {
"content_hash": "0e84b7f85ab6b81177d2d0b25ac6d30a",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 63,
"avg_line_length": 32,
"alnum_prop": 0.5589622641509434,
"repo_name": "PMEAL/OpenPNM",
"id": "5a157565ed32defb4a2feb179c197e444cfa0eae",
"size": "1696",
"binary": fal... |
import os, sys
from django.core.management import setup_environ
# Add root project directory to import path
sys.path.append(os.path.abspath('.'))
# Include settings, so it's not necessary to set DJANGO_SETTINGS_MODULE
import settings
setup_environ(settings)
| {
"content_hash": "f2eac99314cbe50988dd66282039aa97",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 71,
"avg_line_length": 26.1,
"alnum_prop": 0.7854406130268199,
"repo_name": "wapcaplet/vittles",
"id": "fb20717d939573ce3cd9801f2fb1094ad242bce0",
"size": "261",
"binary"... |
"""Openweathermap service"""
import time
import threading
import urllib.error
import urllib.request
import json
import datetime
from service.openweather_codes import CODES
import socket
class Openweather(threading.Thread):
"""Openweather class to get data from openweathermap"""
def __init__(self, cities, apik... | {
"content_hash": "3e8c4117912cca4ece7529b767c31af8",
"timestamp": "",
"source": "github",
"line_count": 175,
"max_line_length": 134,
"avg_line_length": 36.822857142857146,
"alnum_prop": 0.5049658597144631,
"repo_name": "bkosciow/doton",
"id": "10c75fa7204534f5f15d445d1fa4dbf3ebd4f60a",
"size": "644... |
__author__ = 'Gennady Kovalev <[email protected]>'
__copyright__ = '(c) 2016-2019 Development management business group'
__licence__ = 'For license information see LICENSE'
import datetime
def new(days=0,
seconds=0,
microseconds=0,
milliseconds=0,
minutes=0,
hours=0,
weeks=... | {
"content_hash": "678e377d4f431263c5b144be13719d3d",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 72,
"avg_line_length": 22.782608695652176,
"alnum_prop": 0.5801526717557252,
"repo_name": "belolap/esl",
"id": "de94708361e027a558eccedcaa0a52dce6fef70c",
"size": "524",
... |
from rest_framework import serializers
from rest_framework.relations import PrimaryKeyRelatedField, SlugRelatedField
from clothstream.styletags.models import ItemStyleTag, StyleTag
class StyleTagSerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = StyleTag
fields = ('id', 'name'... | {
"content_hash": "b0c3c2caf10fbb1300f66090ac621b6e",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 77,
"avg_line_length": 33.22222222222222,
"alnum_prop": 0.754180602006689,
"repo_name": "julienaubert/clothstream",
"id": "c7781f530a92407afd916b81ea8b6602bbf2336b",
"size"... |
import logging
from google.datacatalog_connectors.commons import utils
from google.api_core import exceptions
from google.cloud import datacatalog
class DataCatalogFacade:
"""Wraps Data Catalog's API calls."""
__BOOL_TYPE = datacatalog.FieldType.PrimitiveType.BOOL
__DOUBLE_TYPE = datacatalog.FieldType.... | {
"content_hash": "bd17848c536f4c92358c950b0e80d6bd",
"timestamp": "",
"source": "github",
"line_count": 484,
"max_line_length": 79,
"avg_line_length": 37.52272727272727,
"alnum_prop": 0.5833929849677881,
"repo_name": "GoogleCloudPlatform/datacatalog-connectors",
"id": "4b56924adb99d73bf5cc44c40ff69d1... |
from nose.tools import *
from dateutil.parser import parse as time_parse
import yawhois
class TestWhoisSafenamesNetStatusRegistered(object):
def setUp(self):
fixture_path = "spec/fixtures/responses/whois.safenames.net/status_registered.txt"
host = "whois.safenames.net"
part ... | {
"content_hash": "f85b68d205935773b9cb58fb234511b0",
"timestamp": "",
"source": "github",
"line_count": 113,
"max_line_length": 92,
"avg_line_length": 50.690265486725664,
"alnum_prop": 0.6443784916201117,
"repo_name": "huyphan/pyyawhois",
"id": "380517659330caf503cad6c92172fdd7d207480d",
"size": "5... |
from __future__ import absolute_import
from enable.tools.viewport_pan_tool import *
| {
"content_hash": "03136fc8c0929353faed5eef38ff640a",
"timestamp": "",
"source": "github",
"line_count": 2,
"max_line_length": 44,
"avg_line_length": 42,
"alnum_prop": 0.7857142857142857,
"repo_name": "enthought/etsproxy",
"id": "fa635e15ee478fc1a7823a2191b4b2ec52f1308a",
"size": "99",
"binary": f... |
"""
Copyright (c) 2012-2014, Austin Benson and David Gleich
All rights reserved.
This file is part of MRTSQR and is under the BSD 2-Clause License,
which can be found in the LICENSE file in the root directory, or at
http://opensource.org/licenses/BSD-2-Clause
"""
"""
This is a script to run the Direc... | {
"content_hash": "1c50c671373af1bcd7ba423c6fd0f303",
"timestamp": "",
"source": "github",
"line_count": 158,
"max_line_length": 85,
"avg_line_length": 32.120253164556964,
"alnum_prop": 0.6023645320197044,
"repo_name": "arbenson/mrtsqr",
"id": "b784bc710506ba51ceb85728f7977db639103e22",
"size": "507... |
import os
import socket
import struct
import select
import time
ICMP_ECHO_RESPONSE = 0
ICMP_ECHO_REQUEST = 8
class PingICMP():
'''
PingICMP reference Linux implemented and RFC 792
'''
def __init__(self):
pass
def __checksum(self, source_string):
_sum = 0
... | {
"content_hash": "131f6e68b46a304e607ceded85dc60b6",
"timestamp": "",
"source": "github",
"line_count": 136,
"max_line_length": 111,
"avg_line_length": 33.97794117647059,
"alnum_prop": 0.4773858472192166,
"repo_name": "interhui/py-sys",
"id": "1e8c53bb8359f2bb20255961c6e4baf8f9db4e37",
"size": "463... |
"""Tests for homekit_controller config flow."""
import json
from unittest import mock
import homekit
import pytest
from homeassistant.components.homekit_controller import config_flow
from homeassistant.components.homekit_controller.const import KNOWN_DEVICES
from tests.common import MockConfigEntry
from tests.compone... | {
"content_hash": "ffd35b00ccb1061de464bf5ef7df7389",
"timestamp": "",
"source": "github",
"line_count": 967,
"max_line_length": 78,
"avg_line_length": 28.985522233712512,
"alnum_prop": 0.5688394163188126,
"repo_name": "jabesq/home-assistant",
"id": "99562f600459308c34156ac3ab8b968d6da2139c",
"size"... |
"""
Django settings for mrestweb project.
Generated by 'django-admin startproject' using Django 1.9.5.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.9/ref/settings/
"""
import os
... | {
"content_hash": "fbdd54e3b0d200db7969ab8d71d9f92d",
"timestamp": "",
"source": "github",
"line_count": 147,
"max_line_length": 91,
"avg_line_length": 26.312925170068027,
"alnum_prop": 0.6770941054808687,
"repo_name": "brunogabriel/mobile-rest-web",
"id": "08c5944dee35c3d8ae224f31f968b761d320e5ef",
... |
from nodeGraph import NodeGraph
from node import Node
from plug import Plug
from wire import Wire | {
"content_hash": "c56034fb688e0105b2b45e8a379efbfa",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 31,
"avg_line_length": 24.25,
"alnum_prop": 0.845360824742268,
"repo_name": "Derfies/wxnodegraph",
"id": "3c2b9e6ae99a8ccec1b2d60d528f649e21a29ca8",
"size": "97",
"binary"... |
from test_framework.test_framework import ComparisonTestFramework
from test_framework.util import *
from test_framework.mininode import CTransaction, NetworkThread
from test_framework.blocktools import create_coinbase, create_block
from test_framework.comptool import TestInstance, TestManager
from test_framework.script... | {
"content_hash": "00481643d43927a88bf70aff2d1c4021",
"timestamp": "",
"source": "github",
"line_count": 184,
"max_line_length": 100,
"avg_line_length": 36.108695652173914,
"alnum_prop": 0.5982841661649608,
"repo_name": "Kangmo/bitcoin",
"id": "95be385d93fb0e9de91ab9295282e92939531753",
"size": "686... |
import os
import sys
sys.path.append(os.path.join(os.path.dirname(__file__), "../"))
import shutil
import unittest
import numpy as np
from model.data_processor import DataProcessor
from model.one_hot_model import OneHotModel
class TestOneHotModel(unittest.TestCase):
def test_one_hot_forward(self):
vocab_... | {
"content_hash": "73fe315edb5c6d7eecdb62d6654c8b2a",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 87,
"avg_line_length": 30.851063829787233,
"alnum_prop": 0.6206896551724138,
"repo_name": "icoxfog417/tying-wv-and-wc",
"id": "9091ad5b0d0a98ffe207342916a1f9308b724058",
"s... |
from __future__ import print_function
from concurrent.futures import ThreadPoolExecutor
from opentracing.mocktracer import MockTracer
from ..testcase import OpenTracingTestCase
class TestThreads(OpenTracingTestCase):
def setUp(self):
self.tracer = MockTracer()
self.executor = ThreadPoolExecutor(... | {
"content_hash": "ed6c960b7f4112c011890ccbb87dd37f",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 73,
"avg_line_length": 33.6875,
"alnum_prop": 0.6456400742115028,
"repo_name": "opentracing/opentracing-python",
"id": "f5a1a81ddf74836d105c8be659313ef7e1bc7ca2",
"size": "... |
import matplotlib.pyplot as plt
import numpy as np
from models.SimpleRecurrent import SimpleRecurrentModel
from keras.callbacks import ModelCheckpoint
def set_params(nturns = 3, input_wait = 3, quiet_gap = 4, stim_dur = 3,
var_delay_length = 0, stim_noise = 0, rec_noise = .1,
... | {
"content_hash": "8f091269c916d8b1e5b9650517aaba25",
"timestamp": "",
"source": "github",
"line_count": 111,
"max_line_length": 128,
"avg_line_length": 38.153153153153156,
"alnum_prop": 0.5976387249114522,
"repo_name": "ABAtanasov/KerasCog",
"id": "7adef3ef731b504b7439b7c725d07dbeb9fba5cc",
"size":... |
from __future__ import division
import sys
import datetime
import itertools
import ntpath
import multiprocessing as mp
try:
import simplejson as json
except ImportError:
import json
import numpy as np
from pymongo.errors import PyMongoError
from pymongo import MongoClient, GEOSPHERE
from netCDF4 import Dataset
... | {
"content_hash": "2e9401c2457b1c4a81356ae904ce1423",
"timestamp": "",
"source": "github",
"line_count": 278,
"max_line_length": 86,
"avg_line_length": 30.086330935251798,
"alnum_prop": 0.5304878048780488,
"repo_name": "RDCEP/atlas-viewer",
"id": "e6a518c2875e7541023c331234509a3e1c340c9d",
"size": "... |
import os
import sys
TEST_PATH = os.path.dirname(__file__)
sys.path.insert(0, os.path.join(TEST_PATH, '..'))
import pytest
from pyvirtualdisplay import Display
import webdriverwrapper
from webdriverwrapper.pytest import *
@pytest.yield_fixture(scope='session', autouse=True)
def display():
d = Display(visible=... | {
"content_hash": "87a021490f556c1d69d516f42a547265",
"timestamp": "",
"source": "github",
"line_count": 71,
"max_line_length": 73,
"avg_line_length": 21.788732394366196,
"alnum_prop": 0.6994182288299935,
"repo_name": "horejsek/python-webdriverwrapper",
"id": "baafa4ea80cfcc9fbb6e9b42ef68ad80ebef46ed"... |
"""
sentry.contrib
~~~~~~~~~~~~~~
:copyright: (c) 2010 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
| {
"content_hash": "af5df5787aa791ec6de61dd90797a7bd",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 70,
"avg_line_length": 22.142857142857142,
"alnum_prop": 0.6451612903225806,
"repo_name": "dcramer/sentry-old",
"id": "f02bb7cacea0e7f59a8909de5618c179be151962",
"size": "15... |
import pandas as pd
from db import DemoDB, DB, list_profiles, remove_profile
import unittest
db = DemoDB()
class PandaSQLTest(unittest.TestCase):
def setUp(self):
pass
def test_query_rowsum(self):
df = db.query("select * from Artist;")
self.assertEqual(len(df), 275)
def tes... | {
"content_hash": "bc6ebb433f98b0c6a2299046f9649b98",
"timestamp": "",
"source": "github",
"line_count": 74,
"max_line_length": 63,
"avg_line_length": 29.283783783783782,
"alnum_prop": 0.615597600369174,
"repo_name": "alienfluid/db.py",
"id": "5f01522e1ea5f9c966629e8770f4ebce28d369b9",
"size": "2167... |
from CIM15.IEC61970.Core.Curve import Curve
class HydroGeneratingEfficiencyCurve(Curve):
"""Relationship between unit efficiency in percent and unit output active power for a given net head in meters. The relationship between efficiency, discharge, head, and power output is expressed as follows: E =KP/HQ Where: ... | {
"content_hash": "31e399df6095fa4bdd6fb1da7a7a3196",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 925,
"avg_line_length": 58.875,
"alnum_prop": 0.7184713375796178,
"repo_name": "rwl/PyCIM",
"id": "a9d146bfcd27904d471ecdce5d3bc139c419d47c",
"size": "3455",
"binary": fa... |
"""
Allow users to set and activate scenes.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/scene/
"""
import asyncio
import importlib
import logging
import voluptuous as vol
from homeassistant.const import (
ATTR_ENTITY_ID, CONF_PLATFORM, SERVICE_... | {
"content_hash": "fe26a7bb406454f331486f6bc73a7403",
"timestamp": "",
"source": "github",
"line_count": 129,
"max_line_length": 75,
"avg_line_length": 26.976744186046513,
"alnum_prop": 0.6721264367816092,
"repo_name": "persandstrom/home-assistant",
"id": "8771a84c1d64d11a0181e704decd184b26107722",
... |
import sys
from os.path import dirname, realpath, join, normpath
from celery.schedules import crontab
import djcelery
djcelery.setup_loader()
SITE_ROOT = join(dirname(realpath(__file__)), '../../')
sys.path.insert(0, normpath(join(SITE_ROOT, "sorbet/")))
TIME_ZONE = 'America/New_York'
LANGUAGE_CODE = 'en-us'
USE_I18... | {
"content_hash": "ed9e1684dac31949de4b2484c45040f5",
"timestamp": "",
"source": "github",
"line_count": 114,
"max_line_length": 69,
"avg_line_length": 25.20175438596491,
"alnum_prop": 0.6435781413156979,
"repo_name": "jacobjbollinger/sorbet",
"id": "5d3ee07111346762a169e31fb18fe99aaf6a858a",
"size"... |
"""Interactive plot to illustrate the phenomenon of covariate shift.
That is, p(x,y) differs from training to testing phase. The interactive plot allows you
to specify p(x) via a probability tabels while p(y|x) remains fixed.
You can see that underspecified discriminative models are not immune to covariate shift.
Use ... | {
"content_hash": "e9e23062f878943086669e9384011884",
"timestamp": "",
"source": "github",
"line_count": 244,
"max_line_length": 100,
"avg_line_length": 42.97540983606557,
"alnum_prop": 0.5473965287049399,
"repo_name": "pprett/dataset-shift-osdc16",
"id": "5709550abc9ee39279a76e1899ca059f66cbc28c",
... |
import collections
import six
import sys
import time
from oslo_log import log
from networking_odl.common._i18n import _LW
LOG = log.getLogger(__name__)
class CacheEntry(collections.namedtuple('CacheEntry', ['timeout', 'values'])):
error = None
@classmethod
def create(cls, timeout, *values):
... | {
"content_hash": "3a4db067a094f73ba71d70b13ae7992a",
"timestamp": "",
"source": "github",
"line_count": 180,
"max_line_length": 79,
"avg_line_length": 37.827777777777776,
"alnum_prop": 0.5338522543692172,
"repo_name": "FedericoRessi/networking-odl",
"id": "0154737827900a467cd4476da73307982dc90d9e",
... |
"""
Functional test suite for the root controller.
This is an example of how functional tests can be written for controllers.
As opposed to a unit-test, which test a small unit of functionality,
functional tests exercise the whole application and its WSGI stack.
Please read http://pythonpaste.org/webtest/ for more i... | {
"content_hash": "5a5b1464cc29dcd4f51e055949aa8407",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 74,
"avg_line_length": 32.19512195121951,
"alnum_prop": 0.6621212121212121,
"repo_name": "lmacken/moksha",
"id": "3ceaafacd57f81025761f7a720fe131d796fa2ad",
"size": "1963",... |
from __future__ import absolute_import
import copy
import datetime
import memcache
from keystone.common import utils
from keystone import config
from keystone import exception
from keystone.openstack.common import jsonutils
from keystone.openstack.common import log as logging
from keystone.openstack.common import tim... | {
"content_hash": "f4b19dadc8ed5afc43eb3a8d23b2ff91",
"timestamp": "",
"source": "github",
"line_count": 263,
"max_line_length": 79,
"avg_line_length": 44.2851711026616,
"alnum_prop": 0.5620331415815232,
"repo_name": "rickerc/keystone_audit",
"id": "08c1c4098ca38174509dd74def78df7efdba4d86",
"size":... |
from .pygren import *
| {
"content_hash": "e2a4fd5ffb23aeaa68d0457039420742",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 21,
"avg_line_length": 22,
"alnum_prop": 0.7272727272727273,
"repo_name": "PyGrEn/python-pygren",
"id": "4e038cd869a636e24b9f729b24e6af136d3be227",
"size": "22",
"binary":... |
import flask
import auth
import model
import util
import wtforms
from flask.ext import wtf
from main import app
class TrackUpdateForm(wtf.Form):
album = wtforms.StringField('Album', filters=[util.strip_filter])
title = wtforms.StringField('Title', filters=[util.strip_filter])
artist = wtforms.StringField(... | {
"content_hash": "2a766ced107a8e71519b06a3ff0249d9",
"timestamp": "",
"source": "github",
"line_count": 113,
"max_line_length": 115,
"avg_line_length": 40.73451327433628,
"alnum_prop": 0.5711492504888116,
"repo_name": "ssxenon01/music-app",
"id": "8416ce67e584c82689a71509a88519530895f616",
"size": ... |
"""
Django settings for rss_reader project.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.7/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)... | {
"content_hash": "69fdd1419e660974df2d23d51220bfb2",
"timestamp": "",
"source": "github",
"line_count": 111,
"max_line_length": 71,
"avg_line_length": 23.36036036036036,
"alnum_prop": 0.6968762051677594,
"repo_name": "CombustibleLemons/rss-reader",
"id": "703ae19fa147ccc5178351a287fa483860e9d994",
... |
from setuptools import setup, find_packages
setup(
name='django-urli18n',
version='0.1',
description='A reusable Django app to display the current activated language in the URL',
author='Torsten Engelbrecht',
author_email='[email protected]',
url='https://github.com/Tort... | {
"content_hash": "c7845c056b067ccce5ddb58118d12a8a",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 95,
"avg_line_length": 37.333333333333336,
"alnum_prop": 0.6517857142857143,
"repo_name": "torte/django-urli18n",
"id": "51e3a73dbd4535d8bc704570af8809f103066e83",
"size": ... |
from __future__ import (
absolute_import, division, print_function, unicode_literals
)
NEVER = 'n'
CONNECTION_ERROR = 'c'
TIMEOUT = 't'
CONNECTION_ERROR_AND_TIMEOUT = 'ct'
DEFAULT = CONNECTION_ERROR
DEFAULT_RETRY_LIMIT = 4
| {
"content_hash": "4db3f41fc05b9e3a583e8d194b518c77",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 63,
"avg_line_length": 20.818181818181817,
"alnum_prop": 0.7117903930131004,
"repo_name": "Willyham/tchannel-python",
"id": "5ec115e240e9edf9404ba1c2459f27d4f1306483",
"siz... |
import pickle
import pickletools
from test import support
from test.pickletester import AbstractPickleTests
import doctest
import unittest
class OptimizedPickleTests(AbstractPickleTests, unittest.TestCase):
def dumps(self, arg, proto=None, **kwargs):
return pickletools.optimize(pickle.dumps(arg, proto, **... | {
"content_hash": "542e3d05cc2db5ffd125528f37d02089",
"timestamp": "",
"source": "github",
"line_count": 104,
"max_line_length": 74,
"avg_line_length": 40.63461538461539,
"alnum_prop": 0.5847136772361571,
"repo_name": "brython-dev/brython",
"id": "d37af79e878a2e52042e2752f0ca5c9649a45bfa",
"size": "... |
import _plotly_utils.basevalidators
class SizemodeValidator(_plotly_utils.basevalidators.EnumeratedValidator):
def __init__(
self, plotly_name="sizemode", parent_name="scatterpolargl.marker", **kwargs
):
super(SizemodeValidator, self).__init__(
plotly_name=plotly_name,
... | {
"content_hash": "ace8569649f7ea7b01c66b7e9a1ea9e9",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 83,
"avg_line_length": 35.357142857142854,
"alnum_prop": 0.6060606060606061,
"repo_name": "plotly/plotly.py",
"id": "5794ca9709a304b7961b7af75c0fbb723eea5d2a",
"size": "495... |
import configparser
import os
import shutil
from unittest import TestCase
from unittest.mock import MagicMock, patch
import click
from click.testing import CliRunner
from scripttest import TestFileEnvironment
from logger import auto, remote, cli, params, convert as conv, merge as mrg
from logger.cli import cmd, start... | {
"content_hash": "72d596f929b302453afd5565ad4db8a7",
"timestamp": "",
"source": "github",
"line_count": 259,
"max_line_length": 113,
"avg_line_length": 41.567567567567565,
"alnum_prop": 0.6129481701653353,
"repo_name": "ujiro99/auto_logger",
"id": "48514ffc20879f8f57589b206a2ac48739aa70bc",
"size":... |
"""JSON Tree Library
"""
import collections
import datetime
import json
import json.scanner
import re
import sys
__version__ = (0,5,1)
__version_string__ = '.'.join(str(x) for x in __version__)
__author__ = 'Doug Napoleone'
__email__ = '[email protected]'
if sys.version_info.major > 2 :
basestr... | {
"content_hash": "8291b24fdb660f421d56b8d561500e1d",
"timestamp": "",
"source": "github",
"line_count": 298,
"max_line_length": 85,
"avg_line_length": 37.85906040268456,
"alnum_prop": 0.6156709803226378,
"repo_name": "dougn/jsontree",
"id": "b1b10be64e70a1bf954a979970f3377cd33da6cc",
"size": "11282... |
import unittest
from .extractor import Extractor
class BaseExtractorTestCase(unittest.TestCase):
def test_base_extract(self):
ext = Extractor()
self.assertRaises(NotImplementedError, ext.extract, '')
if __name__ == '__main__': # pragma: no cover
unittest.main()
| {
"content_hash": "99b3bb21bd39662b489799a436133bae",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 63,
"avg_line_length": 22.384615384615383,
"alnum_prop": 0.6804123711340206,
"repo_name": "cnu/chronos",
"id": "0ae0afb741312027f5a7a5e68f1141beae223435",
"size": "338",
... |
import glance_store
from oslo_log import log as logging
import webob.exc
from daisy.api import policy
from daisy.common import exception
from daisy.common import utils
from daisy.common import wsgi
import daisy.db
import daisy.gateway
from daisy import i18n
import daisy.notifier
LOG = logging.getLogger(__name__)
_ =... | {
"content_hash": "2bc48582756e0eecd64e82464a241efd",
"timestamp": "",
"source": "github",
"line_count": 85,
"max_line_length": 77,
"avg_line_length": 36.4,
"alnum_prop": 0.6192630898513252,
"repo_name": "OpenDaisy/daisy-api",
"id": "745884eff1a8d9e36e2239d52f989cbe16f5c10c",
"size": "3729",
"bina... |
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 'Note.image'
db.add_column(u'catalog_note', 'image',
self.gf... | {
"content_hash": "7f0f92186ddbd44a2c3403ad8a4c47d4",
"timestamp": "",
"source": "github",
"line_count": 569,
"max_line_length": 224,
"avg_line_length": 79.31458699472759,
"alnum_prop": 0.5428982938178595,
"repo_name": "Makeystreet/makeystreet",
"id": "d6ce44aea408e58e52124f9df3578b2d27a36e56",
"siz... |
from flask import Flask, Response
from twilio.util import TwilioCapability
app = Flask(__name__)
@app.route('/token', methods=['GET'])
def get_capability_token():
"""Respond to incoming requests."""
# Find these values at twilio.com/console
account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
auth_tok... | {
"content_hash": "20bf10723c682267c202ebe99fb97b9a",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 58,
"avg_line_length": 24.708333333333332,
"alnum_prop": 0.6947723440134908,
"repo_name": "teoreteetik/api-snippets",
"id": "c9553462de46d7624bc8c2c86a9da3b53a945ec6",
"siz... |
import math
# Here it decided to have a simple Heap data structure and leave function max_heapify
# not as class methods, so that it's the same as the interface defined in CLRS
class Heap():
def __init__(self, A:list):
self.data = A
self.size = len(A)
self.root = A[0]
def left(self, i... | {
"content_hash": "9fea6f9cbf85d4b85faf36104d57de92",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 85,
"avg_line_length": 25.18421052631579,
"alnum_prop": 0.5151515151515151,
"repo_name": "JasonVann/CLRS",
"id": "ee67d798866c821a0d4fb9354a10728fe63334a9",
"size": "957",
... |
from __future__ import absolute_import, unicode_literals
from django.test import SimpleTestCase
from localflavor.us.forms import (USZipCodeField, USPhoneNumberField,
USStateField, USStateSelect,
USSocialSecurityNumberField)
from .forms import USPlac... | {
"content_hash": "5e0889e70c1c5c05261d91720c1700a9",
"timestamp": "",
"source": "github",
"line_count": 287,
"max_line_length": 110,
"avg_line_length": 37.68641114982579,
"alnum_prop": 0.6734467455621301,
"repo_name": "yakky/django-localflavor",
"id": "4c8146caa40bfd7a7495e6da6ef5bf8a16e714d9",
"si... |
"""Generates C++ source files from a mojom.Module."""
from generate import mojom
from generate import mojom_pack
from generate import mojom_generator
from generate.template_expander import UseJinja
_kind_to_cpp_type = {
mojom.BOOL: "bool",
mojom.INT8: "int8_t",
mojom.UINT8: "uint8_t",
mojom.INT16: ... | {
"content_hash": "a8100ce3a8dbf9c66a4ed51b5eacebd1",
"timestamp": "",
"source": "github",
"line_count": 172,
"max_line_length": 77,
"avg_line_length": 34.354651162790695,
"alnum_prop": 0.689118294127602,
"repo_name": "ChromiumWebApps/chromium",
"id": "4420aafd88f7f01f34e01cd1b14f2afb818fff4d",
"siz... |
import copy
import tempfile
import numpy as np
import torch
import torch.utils.data as data
from sklearn.metrics import (
accuracy_score,
precision_score,
roc_auc_score,
recall_score,
f1_score,
fbeta_score,
)
from torch.utils.data import DataLoader
from federatedml.framework.weights import Ord... | {
"content_hash": "fa3f1aef1844a5b47d8350f1791b0c6b",
"timestamp": "",
"source": "github",
"line_count": 329,
"max_line_length": 88,
"avg_line_length": 36.29483282674772,
"alnum_prop": 0.5269240432124612,
"repo_name": "FederatedAI/FATE",
"id": "a8024365da8e9ea22b68fd15803f1d4981c40fa9",
"size": "125... |
"""
CLI Tool for Paessler's PRTG (http://www.paessler.com/)
"""
import argparse
import os
import logging
from prtg.client import Client
def load_config():
endpoint = None
username = None
password = None
try:
endpoint = os.environ['PRTGENDPOINT']
username = os.environ['PRTGUSERNAME']... | {
"content_hash": "6c867e90f411901820983ff9a1f24e13",
"timestamp": "",
"source": "github",
"line_count": 91,
"max_line_length": 120,
"avg_line_length": 28.428571428571427,
"alnum_prop": 0.6265945110166216,
"repo_name": "kevinschoon/prtgtagger",
"id": "4d5b991743a4111f945ff0de3d6efa27a46f5f47",
"size... |
from django.conf.urls import patterns, include, url
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns(
'',
url(r'^$', 'hoa.views.home'),
url(r'^login/$', 'django.contrib.auth.views.login', {'template_name': 'login.html'}),
... | {
"content_hash": "eae205b1f0ac20983f7ed6da5e2fc2af",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 89,
"avg_line_length": 34.57142857142857,
"alnum_prop": 0.6556473829201102,
"repo_name": "desecho/hoa",
"id": "753d4564b0bef5d0ee95b5f65b923589a14e7f25",
"size": "726",
"... |
import tempfile
import os
from telemetry.core import exceptions
from telemetry import decorators
from telemetry.testing import tab_test_case
class TabStackTraceTest(tab_test_case.TabTestCase):
# Stack traces do not currently work on 10.6, but they are also being
# disabled shortly so just disable it for now.
... | {
"content_hash": "1fbd6b106ef54783738944bf2afaea20",
"timestamp": "",
"source": "github",
"line_count": 66,
"max_line_length": 80,
"avg_line_length": 45.696969696969695,
"alnum_prop": 0.7045755968169761,
"repo_name": "google-ar/WebARonARCore",
"id": "a9d2744c8d3dc88d5452d0cf62b108dd3b525d24",
"size... |
"""
Exception related utilities.
"""
import logging
import sys
import time
import traceback
import six
from taskflow.openstack.common.gettextutils import _ # noqa
class save_and_reraise_exception(object):
"""Save current exception, run some code and then re-raise.
In some cases the exception context can ... | {
"content_hash": "19791599b5c8d455f2eeccc62433e357",
"timestamp": "",
"source": "github",
"line_count": 84,
"max_line_length": 75,
"avg_line_length": 36.36904761904762,
"alnum_prop": 0.564975450081833,
"repo_name": "jessicalucci/TaskManagement",
"id": "8f4f6b15bb2f5e7a8e269e749b1b8c5fd1eeaef9",
"si... |
import re
from bson.objectid import ObjectId, InvalidId
import datetime
from girder.models.model_base import AccessControlledModel
from girder.constants import AccessType
from girder.models.model_base import ValidationException
from girder.models.group import Group
from girder.models.item import Item
from girder.model... | {
"content_hash": "0b03fe005aea1b7c38d0b1483aed4ab0",
"timestamp": "",
"source": "github",
"line_count": 339,
"max_line_length": 107,
"avg_line_length": 33.40117994100295,
"alnum_prop": 0.5274220612911773,
"repo_name": "OpenChemistry/materialsdatabank",
"id": "c144b986e267c4da6f0e0e6253a02a5d0c0834c0"... |
"""Test the helper method for writing tests."""
import asyncio
import functools as ft
import json
import logging
import os
import uuid
import sys
import threading
from collections import OrderedDict
from contextlib import contextmanager
from datetime import timedelta
from io import StringIO
from unittest.mock import M... | {
"content_hash": "adc9913fba881823e3b7081b7b56eadd",
"timestamp": "",
"source": "github",
"line_count": 971,
"max_line_length": 79,
"avg_line_length": 31.579814624098866,
"alnum_prop": 0.6235650926167493,
"repo_name": "jabesq/home-assistant",
"id": "cb0e6c69cefeacbd565dbd9af7dda0980e01b157",
"size"... |
"""
Salt Edge Account Information API
API Reference for services # noqa: E501
OpenAPI spec version: 5.0.0
Contact: [email protected]
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re # noqa: F401
import six
class ReconnectSessionRequestBody(object... | {
"content_hash": "1d7139b48a6194859c4d7573948e550a",
"timestamp": "",
"source": "github",
"line_count": 109,
"max_line_length": 90,
"avg_line_length": 29.926605504587155,
"alnum_prop": 0.5616186388718577,
"repo_name": "ltowarek/budget-supervisor",
"id": "15237fed3f81feb552370ee5267f1a65d02a0474",
"... |
import os
import sys
import time
import datetime
import csv
import json
SLEEP_TIME=0.1 # TODO: Optimization of SLEEP_TIME
BIN_DIR = os.path.dirname(os.path.abspath(__file__))
# TOKENS_DIR = os.path.normpath(os.path.join(BIN_DIR,'../tokens/'))
DEFAULT_CONFIG_DIR = os.path.normpath(os.path.join(BIN_DIR,'../config/'))
c... | {
"content_hash": "85d5870f6964e62436ff9148be6f567d",
"timestamp": "",
"source": "github",
"line_count": 77,
"max_line_length": 138,
"avg_line_length": 38.688311688311686,
"alnum_prop": 0.6196710305471634,
"repo_name": "AkihikoITOH/capybara",
"id": "6984fd82727bd5ee9c10a1ed3f89359efe2303e7",
"size":... |
import csv
import os
import re
from datetime import datetime, timedelta
from io import StringIO
from unittest import mock
import boto3
import pytest
from zoneinfo import ZoneInfo
from sqlalchemy import func
from ichnaea.data.public import (
read_stations_from_csv,
write_stations_to_csv,
InvalidCSV,
)
from... | {
"content_hash": "78bc9751911e969abee93fca3c20b9a1",
"timestamp": "",
"source": "github",
"line_count": 419,
"max_line_length": 91,
"avg_line_length": 39.214797136038186,
"alnum_prop": 0.6146308806524253,
"repo_name": "mozilla/ichnaea",
"id": "e13947f7a7d9301ec0e7163395f01152f5f683d0",
"size": "164... |
from seriesbutler import datasources
from seriesbutler.datasources import TheTvDb
from seriesbutler.models import DataSourceException
from unittest import mock
import datetime
from vcr import VCR
import responses
import requests
import pytest
vcr = VCR(cassette_library_dir='build/cassettes/datasources/')
@vcr.use_ca... | {
"content_hash": "5f92042f7057321e154006dc1b5e8ba5",
"timestamp": "",
"source": "github",
"line_count": 169,
"max_line_length": 79,
"avg_line_length": 32.053254437869825,
"alnum_prop": 0.66069780321211,
"repo_name": "raphiz/seriesbutler",
"id": "5fcdfe01991c6f4e2c7245535952ac144bbe7101",
"size": "5... |
"""
Node.js Blueprint
=================
**Fabric environment:**
.. code-block:: yaml
blueprints:
- blues.node
settings:
node:
# version: latest # Install latest node version
packages: # List of npm packages to install (Optional)
# - coffee-script
... | {
"content_hash": "01462062bbe36fd1c1ce3541c017f2a7",
"timestamp": "",
"source": "github",
"line_count": 235,
"max_line_length": 80,
"avg_line_length": 26.45531914893617,
"alnum_prop": 0.5731059996783014,
"repo_name": "5monkeys/blues",
"id": "cf8772b99fb190b5346962e1f2e573d29479efed",
"size": "6217"... |
from __future__ import annotations
from collections import defaultdict
from itertools import chain
from types import MappingProxyType
from typing import Any
from typing import Callable
from typing import Sequence
from dynaconf import validator_conditions
from dynaconf.utils import ensure_a_list
from dynaconf.utils.fu... | {
"content_hash": "81c1cd938717c65d69e8dd1fc083c5df",
"timestamp": "",
"source": "github",
"line_count": 475,
"max_line_length": 79,
"avg_line_length": 32.922105263157896,
"alnum_prop": 0.5300549942447883,
"repo_name": "rochacbruno/dynaconf",
"id": "f3c581d460e38a1f6375df9fd0f0a749d73983ae",
"size":... |
"""
Author: Mohamed K. Eid ([email protected])
Description: stylizes an image using a generative model trained on a particular style
Args:
--input: path to the input image you'd like to apply a style to
--style: name of style (found in 'lib/generators') to apply to the input
--o... | {
"content_hash": "7f914faed74782ec9849278739b73c32",
"timestamp": "",
"source": "github",
"line_count": 99,
"max_line_length": 107,
"avg_line_length": 31.8989898989899,
"alnum_prop": 0.6567447751741609,
"repo_name": "mohamedkeid/Feed-Forward-Style-Transfer",
"id": "afb7c16e074450715fd2eec78b7496f0a22... |
from django.contrib.staticfiles.testing import LiveServerTestCase, StaticLiveServerTestCase
from django.core.urlresolvers import reverse
from django.conf import settings
import os
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.common.by import By
from seleni... | {
"content_hash": "23eb83bb8a3afc52d772236cb36c35a7",
"timestamp": "",
"source": "github",
"line_count": 62,
"max_line_length": 108,
"avg_line_length": 32.516129032258064,
"alnum_prop": 0.6755952380952381,
"repo_name": "futurice/vimma2",
"id": "ec52f481d1ec353d6f39052f2424e70ae724ac38",
"size": "201... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.