text stringlengths 4 1.02M | meta dict |
|---|---|
"""
Support for Ambient Weather Station Service.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/ambient_station/
"""
import logging
import voluptuous as vol
from homeassistant.config_entries import SOURCE_IMPORT
from homeassistant.const import (
A... | {
"content_hash": "e1184a8544fa8a5714d9c230715330c4",
"timestamp": "",
"source": "github",
"line_count": 301,
"max_line_length": 78,
"avg_line_length": 36.73421926910299,
"alnum_prop": 0.6324500316541557,
"repo_name": "PetePriority/home-assistant",
"id": "4aa19dbc69ea65db21372848929c08d3c098b210",
"... |
import Rule
from CommonDataClass.FdfClass import RuleComplexFileClassObject
## complex rule
#
#
class RuleComplexFile(RuleComplexFileClassObject) :
## The constructor
#
# @param self The object pointer
#
def __init__(self):
RuleComplexFileClassObject.__init__(self)
| {
"content_hash": "955fce8ea63ba142698a36466b95e1ea",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 64,
"avg_line_length": 23.53846153846154,
"alnum_prop": 0.6862745098039216,
"repo_name": "egraba/vbox_openbsd",
"id": "7ecc32560868778a0ef337d0fa67b76e7b1b7bc6",
"size": "8... |
import os
import base64
import boto.ec2
# EU-WEST-1: RHEL7 HVM
AMI_ID = 'ami-25158352'
region = 'eu-west-1'
def generate_userdata():
'''Read environment vars and various other things to
get SSH keys, usernames and deploy scripts and inject them into an
instance as a userdata script
'''
ssh_key = os.environ["... | {
"content_hash": "0ee2f6eac85ae46b681749ff9a055a4c",
"timestamp": "",
"source": "github",
"line_count": 102,
"max_line_length": 145,
"avg_line_length": 31.901960784313726,
"alnum_prop": 0.7234173325138291,
"repo_name": "Financial-Times/paasport",
"id": "1ef476da5f5460b46ac1b625211430aad364cc1c",
"s... |
import mxnet as mx
import numpy as np
import unittest
from mxnet.test_utils import rand_ndarray, assert_almost_equal
from common import setup_module, with_seed, assertRaises, teardown
from mxnet.base import py_str, MXNetError
shape = (4, 4)
keys = [5, 7, 11]
str_keys = ['b', 'c', 'd']
def init_kv(stype='default'):
... | {
"content_hash": "1b583b20dcb8d0db5ff7881937133df1",
"timestamp": "",
"source": "github",
"line_count": 305,
"max_line_length": 94,
"avg_line_length": 32.445901639344264,
"alnum_prop": 0.5789207760711399,
"repo_name": "jamesliu/mxnet",
"id": "0ab61bb27483492525f8fbd75ba9a4cd6e419010",
"size": "1070... |
""" extension to test the extension_manager """
from ped_core.editor_common import Editor
from ped_dialog.message_dialog import message
# register shift-F1 to comment the highlighted block
def ped_ext_info():
""" return registration information for extension_manager """
return ( "CMD_COMMENT", "EDITOR", "KEYT... | {
"content_hash": "1614619da71bb2bc59bae92b28a80518",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 89,
"avg_line_length": 35.642857142857146,
"alnum_prop": 0.6172344689378757,
"repo_name": "jpfxgood/ped",
"id": "66a9ce7062f2ff8fd360657d7062afdf79bd34ca",
"size": "1054",
... |
"""Constants and utilities related to Omaha versions."""
_ONECLICK_PLUGIN_NAME = 'npHouseOfLifeOneClick'
_UPDATE_PLUGIN_NAME = 'npHouseOfLifeUpdate'
_BHO_NAME = 'HolupdateBho'
_CRASH_HANDLER_NAME = 'HouseOfLifeCrashHandler'
# List of languages that are fully supported in the current build.
_OMAHA_LANGUAGES = [
'a... | {
"content_hash": "5ca73d4b76f1ac6a6448558e893c9f93",
"timestamp": "",
"source": "github",
"line_count": 332,
"max_line_length": 80,
"avg_line_length": 31.599397590361445,
"alnum_prop": 0.6463635497092746,
"repo_name": "Crystalnix/bitpop-omaha",
"id": "c4f5d85f468c6300ec9186368dc6c674baf48bce",
"siz... |
""" FileTailer: File 'tail/cat' interface with optional:
simple filters, a.k.a. 'grep -P'
complex filters, a.k.a. break each line into "columns", with each column being a separate 'filter'
"""
import logging
import os.path
import re
from termcolor import colored
from .color_chooser import colorize
... | {
"content_hash": "15aa2384e647944dcba569ae83c83577",
"timestamp": "",
"source": "github",
"line_count": 266,
"max_line_length": 111,
"avg_line_length": 34.08646616541353,
"alnum_prop": 0.5070034189919488,
"repo_name": "gluent/gluent-eng",
"id": "9299bd8fac1651bccb2311598a73f200f798da58",
"size": "9... |
import re
from typing import Dict, Sequence, Tuple
from unittest import TestCase, mock
import pytest
from google.api_core.retry import Retry
from airflow import AirflowException
from airflow.providers.google.cloud.hooks.os_login import OSLoginHook
from tests.providers.google.cloud.utils.base_gcp_mock import (
moc... | {
"content_hash": "656f5d9f684daec4c79d7a41c1fd970b",
"timestamp": "",
"source": "github",
"line_count": 163,
"max_line_length": 107,
"avg_line_length": 36.20245398773006,
"alnum_prop": 0.6246398915438062,
"repo_name": "apache/incubator-airflow",
"id": "d2b88e4c6c895d41c48be44ae0839ff8167dc4b7",
"si... |
from django import forms
from gollahalli_cms.editor.models import ContentModel, MetaContentModel, EducationModel, ProjectsModel, TutorialsModel, ExperienceModel
class ContentModelForm(forms.ModelForm):
ref_id = forms.CharField(required=False)
bio = forms.CharField(widget=forms.Textarea)
created = forms.D... | {
"content_hash": "0b86bb5212631afb85e4768b165a5c0e",
"timestamp": "",
"source": "github",
"line_count": 72,
"max_line_length": 135,
"avg_line_length": 24.305555555555557,
"alnum_prop": 0.668,
"repo_name": "akshaybabloo/gollahalli-com",
"id": "b2c3381236137ff928ceb608394b643964163b0a",
"size": "1750... |
import argparse
import os
import queue
import subprocess
import sys
import threading
PASS_COLOR = '\033[92m'
FAIL_COLOR = '\033[31m'
ENDC_COLOR = '\033[0m'
class Task:
def __init__(self, name, cmd):
self.name = name
self.cmd = cmd
self.success = False
self.output = ""
def run_test... | {
"content_hash": "e082bc828a4f629f8ab7535abc1ea579",
"timestamp": "",
"source": "github",
"line_count": 136,
"max_line_length": 96,
"avg_line_length": 29.610294117647058,
"alnum_prop": 0.4954060094363049,
"repo_name": "bdilly/soletta",
"id": "37d1b1bd946687ce71e14d8842b91a51bb5bda94",
"size": "5657... |
import setuptools
with open('README.rst') as f:
long_description = f.read()
setuptools.setup(
name='happymongo',
version='0.1.1',
description=('Python module for making it easy and consistent to '
'connect to MongoDB via PyMongo either in Flask or in'
' a non-flask ap... | {
"content_hash": "dfaac1802d47824fb65304e9af2dc91f",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 71,
"avg_line_length": 32.94736842105263,
"alnum_prop": 0.6533546325878594,
"repo_name": "sivel/happymongo",
"id": "62ba87ad561ec68dd05e0357e848915806bc4a70",
"size": "649"... |
"""
unknown.py
Created by Thomas Mangin on 2014-06-30.
Copyright (c) 2009-2015 Exa Networks. All rights reserved.
"""
from exabgp.bgp.message.open.capability.capability import Capability
# ============================================================ UnknownCapability
#
@Capability.unknown
class UnknownCapability (... | {
"content_hash": "35b8546999681f9141c92fc53a36cac1",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 107,
"avg_line_length": 27.261904761904763,
"alnum_prop": 0.6716157205240174,
"repo_name": "blablacar/exabgp",
"id": "4b3ddede2f96c8e0c2be0d2ab6495fd9a0442612",
"size": "11... |
"""Extract parse_example op configuration to a proto."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.core.example import example_parser_configuration_pb2
from tensorflow.python.framework import tensor_shape
from tensorflow.python.framewo... | {
"content_hash": "949a41591c1b6bd6d773108082fdad51",
"timestamp": "",
"source": "github",
"line_count": 108,
"max_line_length": 74,
"avg_line_length": 37.5,
"alnum_prop": 0.677037037037037,
"repo_name": "jbedorf/tensorflow",
"id": "dc8937a31995c1752ea49638ff23ff805a39753f",
"size": "4739",
"binar... |
"""Parse prices of a device from geizhals."""
import logging
from datetime import timedelta
import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA
import homeassistant.helpers.config_validation as cv
from homeassistant.util import Throttle
from homeassistant.helpers.entity import Entity
... | {
"content_hash": "248320915bfe07121517dae34f00c0bd",
"timestamp": "",
"source": "github",
"line_count": 99,
"max_line_length": 71,
"avg_line_length": 29.444444444444443,
"alnum_prop": 0.6222984562607204,
"repo_name": "molobrakos/home-assistant",
"id": "03c263f54ab1d5be5ba4a6434965f049468fe33d",
"si... |
from jsonpath_rw import jsonpath, parse
import json
__author__ = 'Masataka'
class JobInfoList:
def __init__(self):
self.current_job_id = -1
self.jobList = []
def get_current_job(self):
if len(self.jobList) > 0:
return self.jobList[self.current_job_id]
def get_job_lis... | {
"content_hash": "446ff3c5f4bc8ca9da4376f2ad73beaa",
"timestamp": "",
"source": "github",
"line_count": 64,
"max_line_length": 111,
"avg_line_length": 31.40625,
"alnum_prop": 0.5805970149253732,
"repo_name": "plinecom/JobManager",
"id": "81c7ec64d330f5e087da05362fa214697844a37e",
"size": "2010",
... |
"""Read the contents of a QE output file containing QE dynmical matrix"""
import re
import math
import numpy as np
from PDielec.Constants import amu, angs2bohr, hartree2ev
from PDielec.UnitCell import UnitCell
from PDielec.GenericOutputReader import GenericOutputReader
class QEOutputReader(GenericOutputReader):
"... | {
"content_hash": "6f00f9ee7c20666432bd2dab9a034d7f",
"timestamp": "",
"source": "github",
"line_count": 343,
"max_line_length": 117,
"avg_line_length": 39.673469387755105,
"alnum_prop": 0.5627572016460906,
"repo_name": "JohnKendrick/PDielec",
"id": "92992a8e71781db18be157e2769abdf6f34ee63e",
"size"... |
from ..errors import *
from .state import State
from .links import BoundLink
from .variable import Variable
from .assignment import InferVariable
class Identifier(BoundLink):
name = None
def __init__(self, name:str, tokens = None):
BoundLink.__init__(self, None, tokens)
self.name = name
... | {
"content_hash": "3feac22952eaf77e5c96cd8be2d8473c",
"timestamp": "",
"source": "github",
"line_count": 62,
"max_line_length": 130,
"avg_line_length": 31.467741935483872,
"alnum_prop": 0.6217324449000513,
"repo_name": "pektin/jam",
"id": "9eaae8c5aee4b4635c314c276e2d424369e906a6",
"size": "1951",
... |
from io import BytesIO
import sys
import pytest
from pandas.io.msgpack import ExtType, OutOfData, Unpacker, packb
class TestUnpack(object):
def test_unpack_array_header_from_file(self):
f = BytesIO(packb([1, 2, 3, 4]))
unpacker = Unpacker(f)
assert unpacker.read_array_header() == 4
... | {
"content_hash": "25af92090e60652d3258d9bb4b878531",
"timestamp": "",
"source": "github",
"line_count": 67,
"max_line_length": 73,
"avg_line_length": 30.134328358208954,
"alnum_prop": 0.524517087667162,
"repo_name": "GuessWhoSamFoo/pandas",
"id": "356156296c067f6097ea24f07a01db10409fa74e",
"size": ... |
"""Basic Model Interface (BMI) for the Diffusion model."""
import numpy as np
from basic_modeling_interface import Bmi
from .diffusion import Diffusion
class BmiDiffusion(Bmi):
"""BMI for the Diffusion model."""
_name = 'Diffusion model'
_input_var_names = ('plate_surface__temperature',)
_output_va... | {
"content_hash": "0673adef79d675a37b22abf25c09be9a",
"timestamp": "",
"source": "github",
"line_count": 297,
"max_line_length": 73,
"avg_line_length": 24.737373737373737,
"alnum_prop": 0.5019735946644889,
"repo_name": "csdms/bmi-live-2017",
"id": "0b64c9791331f1d8f385cfc72c5d78667ca6cd33",
"size": ... |
import wpf # Loads required .NET Assemblies behind the scenes
from System.Windows import (GridLength, SizeToContent, TextWrapping, Thickness,
Window, WindowStartupLocation)
from System.Windows.Controls import (Button, ColumnDefinition, Grid, Label, ListBox,
... | {
"content_hash": "304b18b06815ea2cb5f2cb33c7c22710",
"timestamp": "",
"source": "github",
"line_count": 206,
"max_line_length": 99,
"avg_line_length": 33.470873786407765,
"alnum_prop": 0.6110224800580131,
"repo_name": "robotframework/RIDE",
"id": "39d1b9e2d3f40e5a191a8cdfdae068962b43a6ca",
"size": ... |
"""
PySpark supports custom serializers for transferring data; this can improve
performance.
By default, PySpark uses L{PickleSerializer} to serialize objects using Python's
C{cPickle} serializer, which can serialize nearly any Python object.
Other serializers, like L{MarshalSerializer}, support fewer datatypes but ca... | {
"content_hash": "592df562babccc7a34301c9f825c2f40",
"timestamp": "",
"source": "github",
"line_count": 826,
"max_line_length": 100,
"avg_line_length": 33.50726392251816,
"alnum_prop": 0.617516349315316,
"repo_name": "WindCanDie/spark",
"id": "a2c59fedfc8cdec8383c89217dda9e5f1bbb77c5",
"size": "284... |
"""Test HD Wallet keypool restore function.
Two nodes. Node1 is under test. Node0 is providing transactions and generating blocks.
- Start node1, shutdown and backup wallet.
- Generate 110 keys (enough to drain the keypool). Store key 90 (in the initial keypool) and key 110 (beyond the initial keypool). Send funds to... | {
"content_hash": "f1509316492cc5f2834495e719fbc084",
"timestamp": "",
"source": "github",
"line_count": 70,
"max_line_length": 164,
"avg_line_length": 35.642857142857146,
"alnum_prop": 0.6541082164328658,
"repo_name": "martexcoin/martexcoin",
"id": "e36a46930537c943f14d25e2181d10bde77d17fe",
"size"... |
# -*- coding: utf-8 -*-
"""
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License a... | {
"content_hash": "f5c57562577c9543e4cf094f824a1e2e",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 77,
"avg_line_length": 44.73684210526316,
"alnum_prop": 0.4164705882352941,
"repo_name": "jkibele/acc-assess",
"id": "754673d7dc6470af50c136558937288c34038cb3",
"size": "13... |
from common import BaseTest
class DynamodbTest(BaseTest):
def test_resources(self):
session_factory = self.replay_flight_data('test_dynamodb_table')
p = self.load_policy(
{'name': 'tables',
'resource': 'dynamodb-table'},
session_factory=session_factory)
... | {
"content_hash": "17706518938b9d5f65c71d3de1ba0a57",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 72,
"avg_line_length": 34.48275862068966,
"alnum_prop": 0.561,
"repo_name": "stevenmjo/cloud-custodian",
"id": "3200455001792b97008642271ba9b00d74a1535c",
"size": "1585",
... |
"""
This script transfers pages from a source wiki to a target wiki.
It also copies edit history to a subpage.
-tolang: The target site code.
-tosite: The target site family.
-prefix: Page prefix on the new site.
-overwrite: Existing pages are skipped by default. Use his option to
... | {
"content_hash": "2d1c86baf376571539eecd541ae19d0c",
"timestamp": "",
"source": "github",
"line_count": 176,
"max_line_length": 130,
"avg_line_length": 28.71590909090909,
"alnum_prop": 0.6379105658884052,
"repo_name": "emijrp/pywikibot-core",
"id": "239a991db4a52b15b91c70162f541c0c8d2beb21",
"size"... |
"""
This package contains algorithms for extracting document representations from their raw
bag-of-word counts.
"""
# bring model classes directly into package namespace, to save some typing
from .hdpmodel import HdpModel
from .ldamodel import LdaModel
from .lsimodel import LsiModel
from .tfidfmodel import TfidfModel
... | {
"content_hash": "e4ada9bc533ba0e38b7942b318399472",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 102,
"avg_line_length": 34.285714285714285,
"alnum_prop": 0.7072916666666667,
"repo_name": "TitasNandi/Summer_Project",
"id": "dc028e24fef4e4bcff11b3b370feb6e2f9232fd2",
"s... |
import NeuralNetwork as nn
import numpy as np
import PIL.Image
import os
import os.path
import json
import io
import datetime
import math
try:
import matplotlib.pyplot as plt
USE_MATPLOTLIB = True
except ImportError:
plt = None
USE_MATPLOTLIB = False
DEBUG_ENABLED = False
def main():
usr_valid_res... | {
"content_hash": "b03b70939ab27465354854af86185e81",
"timestamp": "",
"source": "github",
"line_count": 160,
"max_line_length": 99,
"avg_line_length": 33.89375,
"alnum_prop": 0.6186612576064908,
"repo_name": "supakorn-ras/Face-Filter",
"id": "56f65e027e232f0e40d7b73c435e1e28f474141b",
"size": "5447... |
from abc import ABC
from typing import List, Union
from py4j.java_gateway import JavaClass, JavaObject
from pyflink.java_gateway import get_gateway
class TypeInformation(ABC):
"""
TypeInformation is the core class of Flink's type system. FLink requires a type information
for all types that are used as i... | {
"content_hash": "29d0ee0acf41a2976c9059ae7c43fe60",
"timestamp": "",
"source": "github",
"line_count": 455,
"max_line_length": 100,
"avg_line_length": 39.69450549450549,
"alnum_prop": 0.6650794529649521,
"repo_name": "tzulitai/flink",
"id": "8b1da5d2564a641fb935a97deb6e1cb4898b12b7",
"size": "1902... |
from openid.extensions.draft import pape5 as pape
from openid.message import *
from openid.server import server
import warnings
warnings.filterwarnings(
'ignore', module=__name__, message='"none" used as a policy URI')
import unittest
class PapeRequestTestCase(unittest.TestCase):
def setUp(self):
se... | {
"content_hash": "c595a8383d85eadb1f3be7c6ca1a18aa",
"timestamp": "",
"source": "github",
"line_count": 497,
"max_line_length": 79,
"avg_line_length": 37.36418511066398,
"alnum_prop": 0.5965535810446957,
"repo_name": "necaris/python3-openid",
"id": "0d3905c23eb526cd4fee0226a1138ba09fddd082",
"size"... |
"""
tests for hep_ml.speedup module
"""
from __future__ import division, print_function, absolute_import
import numpy
import pandas
import time
from hep_ml.speedup import LookupClassifier
from hep_ml.commonutils import generate_sample
from sklearn.ensemble import GradientBoostingClassifier
from sklearn.metrics import ... | {
"content_hash": "68e3a920dccf8ed84e0d80c22cfa4d82",
"timestamp": "",
"source": "github",
"line_count": 84,
"max_line_length": 111,
"avg_line_length": 39.023809523809526,
"alnum_prop": 0.7028676021964613,
"repo_name": "iamfullofspam/hep_ml",
"id": "82270d253a4ffce9ba7454d2c14504a7bcf5c707",
"size":... |
from __future__ import unicode_literals
import matplotlib
from matplotlib.axes import Axes
from matplotlib.patches import Circle
from matplotlib.path import Path
from matplotlib.ticker import NullLocator, Formatter, FixedLocator
from matplotlib.transforms import Affine2D, BboxTransformTo, Transform
from matplotlib.pro... | {
"content_hash": "ad02d985ea9906a04b23920d2c1eb831",
"timestamp": "",
"source": "github",
"line_count": 479,
"max_line_length": 81,
"avg_line_length": 38.09185803757829,
"alnum_prop": 0.5964594979721582,
"repo_name": "RobertABT/heightmap",
"id": "31f55f6b523df162c89c97167ab5401460944d0e",
"size": "... |
import numpy as np
from mnist import MNIST
from classification_base import MNIST_PATH
def prep_binary_classes(y, digit=2):
return np.array([int(x==digit) for x in y])
def mnist_training(shuffled=True):
mndata = MNIST(MNIST_PATH)
train_ims, train_labels = mndata.load_training()
train_X = np.array(tra... | {
"content_hash": "fde18abd5679cecc6d54dc5edcc373e1",
"timestamp": "",
"source": "github",
"line_count": 64,
"max_line_length": 74,
"avg_line_length": 28.546875,
"alnum_prop": 0.6305418719211823,
"repo_name": "JanetMatsen/Machine_Learning_CSE_546",
"id": "37099fc9e3acb7f640fedb4e56957a8334b9dc6f",
"... |
"""A alternate implementation of the persistent dict found in
http://erezsh.wordpress.com/2009/05/24/filedict-a-persistent-dictionary-in-python/
"""
import sqlite3, UserDict, pickle
def key(k):
return hash(k), pickle.dumps(k)
class persistentDict(UserDict.DictMixin):
def __init__(self, filetable, d=None, **... | {
"content_hash": "919a48855d264e172055aa9c8b7f4bd3",
"timestamp": "",
"source": "github",
"line_count": 69,
"max_line_length": 110,
"avg_line_length": 36.47826086956522,
"alnum_prop": 0.5613825983313468,
"repo_name": "zepheira/zenpub",
"id": "763228244a1612141076875e15439f31c631b2f1",
"size": "2517... |
import unittest
from latex2mathml import aggregator
__author__ = "Ronie Martinez"
__copyright__ = "Copyright 2016-2017, Ronie Martinez"
__credits__ = ["Ronie Martinez"]
__license__ = "MIT"
__maintainer__ = "Ronie Martinez"
__email__ = "ronmarti18@gmail.com"
__status__ = "Development"
class AggregatorTest(unittest.Te... | {
"content_hash": "a124535f2f501bca4eb99ad55a83458c",
"timestamp": "",
"source": "github",
"line_count": 57,
"max_line_length": 118,
"avg_line_length": 40.75438596491228,
"alnum_prop": 0.5393887214808437,
"repo_name": "TU-Berlin/mathosphere",
"id": "f827c62b35be45bbc683f3a630e5f3862c44bce0",
"size":... |
from random import randint
board = []
for x in range(0, 5):
board.append(["O"] * 5)
def print_board(board):
for row in board:
print " ".join(row)
print_board(board)
def random_row(board):
return randint(0, len(board) - 1)
def random_col(board):
return randint(0, len(board[0]) - 1)
ship_ro... | {
"content_hash": "420345b009f213a906069a84714ab513",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 68,
"avg_line_length": 21.104166666666668,
"alnum_prop": 0.5784797630799605,
"repo_name": "abhisekkumar/python",
"id": "517e2176fcd7a9bcc1fb9e203196a758ea0fbb26",
"size": "... |
import typing as t
from marshmallow import EXCLUDE, ValidationError, fields
from marshmallow_enum import EnumField
from marshmallow_oneofschema import OneOfSchema
from indico.core.db.sqlalchemy.links import LinkType
from indico.core.marshmallow import mm
from indico.modules.attachments.models.attachments import Attac... | {
"content_hash": "1e58c759febe55c1ba55cfaf174799e8",
"timestamp": "",
"source": "github",
"line_count": 314,
"max_line_length": 111,
"avg_line_length": 39.56369426751592,
"alnum_prop": 0.6928278193673025,
"repo_name": "ThiefMaster/indico",
"id": "b964b78342d87ea9d13e320f3488f63fad7d8d89",
"size": "... |
from __future__ import print_function
import warnings
import sys
import traceback
import inspect
import pickle
import numpy as np
from scipy import sparse
import struct
from sklearn.externals.six.moves import zip
from sklearn.utils.testing import assert_raises
from sklearn.utils.testing import assert_equal
from skle... | {
"content_hash": "fcb06db75f09ff37e0ba34e2518a777b",
"timestamp": "",
"source": "github",
"line_count": 998,
"max_line_length": 81,
"avg_line_length": 35.763527054108216,
"alnum_prop": 0.6023478650678024,
"repo_name": "abhishekgahlot/scikit-learn",
"id": "1552fe4e8492c18d8382b3f8055f325b0c95f126",
... |
"""Support for Somfy hubs."""
from abc import abstractmethod
import asyncio
from datetime import timedelta
import logging
from pymfy.api.devices.category import Category
import voluptuous as vol
from homeassistant.components.somfy import config_flow
from homeassistant.config_entries import ConfigEntry
from homeassist... | {
"content_hash": "85bc726f37c39497e3df25f5d61363a0",
"timestamp": "",
"source": "github",
"line_count": 209,
"max_line_length": 86,
"avg_line_length": 29.91866028708134,
"alnum_prop": 0.6321765552534784,
"repo_name": "soldag/home-assistant",
"id": "99b0a2ee56420d56075d6fcafb41a71376575c17",
"size":... |
from xml.etree import ElementTree
import requests
"""
In order to use the patched get :
1 - import this module and set XML_DICT to your own XML dict.
The expected format is { "$entity_uri_1" : "$entity_xml_1",
"$entity_uri_2" : "$entity_xml_2",
...}
2 -... | {
"content_hash": "1d0714aaa11c222251e921aaa3feb273",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 132,
"avg_line_length": 33.472727272727276,
"alnum_prop": 0.6056491037479631,
"repo_name": "Galithil/genologics",
"id": "93f79aec052ec747e28a402cf1bbe6295aae04b8",
"size": ... |
from PyObjCTools.TestSupport import *
from AppKit import *
class TestNSGlyphGeneratorHelper (NSObject):
def insertGlyphs_length_forStartingGlyphAtIndex_characterIndex_(self, glyphs, length, glyphIndex, charIndex):
self.glyphs = (glyphs, length, glyphIndex, charIndex)
def setIntAttribute_value_forGlyph... | {
"content_hash": "adadabae98364fc454cdc1cb9c856016",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 119,
"avg_line_length": 47.52,
"alnum_prop": 0.7108585858585859,
"repo_name": "albertz/music-player",
"id": "d4e1ff41a05bdfac4a583d58eab17632e8173e29",
"size": "2377",
"b... |
command += info_command ("--stats ../common/textures/grid.tx", info_program="iinfo")
| {
"content_hash": "738e0aaff51afc3be0a39658c062f2a1",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 84,
"avg_line_length": 85,
"alnum_prop": 0.6941176470588235,
"repo_name": "OpenImageIO/oiio",
"id": "32436fea16c78af18a0357af3abee58984428805",
"size": "108",
"binary": fa... |
"""
The flask application package.
"""
from flask import Flask
app = Flask(__name__)
app.debug = False
import lvsys.views
| {
"content_hash": "0caa608f25ccd679d042e65b28561c30",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 30,
"avg_line_length": 13.777777777777779,
"alnum_prop": 0.7016129032258065,
"repo_name": "sun1991/lvsys",
"id": "400a3c857a804a7885a7636c79631480c950177c",
"size": "124",
... |
from django.conf import settings
def ssl_media(request):
if request.is_secure():
ssl_media_url = settings.MEDIA_URL.replace('http://','https://')
else:
ssl_media_url = settings.MEDIA_URL
return {'MEDIA_URL': ssl_media_url}
| {
"content_hash": "93e3003378eabf364bfd1a12f969edfe",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 72,
"avg_line_length": 28.11111111111111,
"alnum_prop": 0.6403162055335968,
"repo_name": "bueda/django-comrade",
"id": "39227f6020b1c2f3a6e293b72e0c6f172f8391a2",
"size": "2... |
"""
This module uses and extends scholar.py to scrape results
from google scholar to determine the authors, citations,
and title of a paper given a list of possible titles.
"""
#from difflib import get_close_matches
#get_close_matches(word, possibilities[, n][, cutoff])
from scholar import ScholarQuerier
from user_ag... | {
"content_hash": "e734b593b3b3ebb91a8865d3de8e6ddc",
"timestamp": "",
"source": "github",
"line_count": 57,
"max_line_length": 77,
"avg_line_length": 33.228070175438596,
"alnum_prop": 0.6246040126715945,
"repo_name": "ftalex/citation_graph",
"id": "a2a6bc5b8393cb08317da880ae0e78a0448c99c1",
"size":... |
from django.conf.urls import patterns, url
from .views import (
HomeView,
TournamentListView,
TournamentDetailView,
TournamentCreateView,
TournamentResultsView,
)
urlpatterns = patterns(
'',
# urls for Tournament
url(
r'^$',
HomeView.as_view(),
name='core_home_vi... | {
"content_hash": "ce7c03bf6559b7d2163284a70eecf9f6",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 45,
"avg_line_length": 22.83783783783784,
"alnum_prop": 0.570414201183432,
"repo_name": "Axelrod-Python/DjAxelrod",
"id": "05a80816966fcb553b7e618eee82e324e80e080d",
"size"... |
"""Tests of tests/tools.py"""
import glob
import os
import unittest
from .tools import renumber_svg_ids, canonicalize_svg, SvgTest
class RenumberTest(unittest.TestCase):
"""Test the renumber_svg_ids function."""
def test_it(self):
self.assertEqual(
renumber_svg_ids("<svg id='id10' id='i... | {
"content_hash": "3fd756b838faa9e14b812c6075869b69",
"timestamp": "",
"source": "github",
"line_count": 95,
"max_line_length": 78,
"avg_line_length": 34.357894736842105,
"alnum_prop": 0.5514705882352942,
"repo_name": "nedbat/cupid",
"id": "941c14d8ebb383ca8e48974f97a4f9d38ef703cb",
"size": "3264",
... |
"""Module for testing constraints involving the bind server command."""
import unittest
if __name__ == "__main__":
import utils
utils.import_depends()
from brokertest import TestBrokerCommand
class TestBindServerConstraints(TestBrokerCommand):
def testrejectdelunittest02(self):
command = "del ... | {
"content_hash": "993ed614957a100b29cded88a2512f4d",
"timestamp": "",
"source": "github",
"line_count": 81,
"max_line_length": 84,
"avg_line_length": 42.28395061728395,
"alnum_prop": 0.5783941605839416,
"repo_name": "stdweird/aquilon",
"id": "ac09f86ad042a4d0fdc257b19af038d2bdfb09a1",
"size": "4158... |
import os, time
import shutil
import json
from tinydb import TinyDB, Query
proj_dir = str(cfg.__project_dir__)
img_dir = "01. Plates\\"
class Transfer():
def __init__(self, proj_dir, local_dir):
self.shot_file_db = TinyDB('C:\\Users\\IanHartman\\Basket-App\\basket\\assets\\shot_file_db.json')
s... | {
"content_hash": "93d5b2f87734d90b0f4b60ec1279c180",
"timestamp": "",
"source": "github",
"line_count": 121,
"max_line_length": 179,
"avg_line_length": 38.099173553719005,
"alnum_prop": 0.586767895878525,
"repo_name": "Hartman-/Basket",
"id": "0eec4144b3388d26ae06dcc5b51fae1986f25c0d",
"size": "463... |
from linkedlist import SinglyLinkedListNode
def reverseList(head):
tail=None
last=None
tempNode = head
while tempNode is not None:
currentNode, tempNode = tempNode, tempNode.next
currentNode.next = tail
tail = currentNode
return tail
def reverseListKNode(head,k):
... | {
"content_hash": "0df8079759330364690acd847ea2a986",
"timestamp": "",
"source": "github",
"line_count": 91,
"max_line_length": 57,
"avg_line_length": 15.989010989010989,
"alnum_prop": 0.5773195876288659,
"repo_name": "pankajanand18/python-tests",
"id": "0ffd900e1ae4970fd82520a76c55f4af9a9dd99d",
"s... |
import re
from setuptools import setup
import os.path
version = re.search("__version__ = '([^']+)'", open(
os.path.join(os.path.dirname(__file__), 'multifeedexporter.py')
).read().strip()).group(1)
here = os.path.abspath(os.path.dirname(__file__))
README = open(os.path.join(here, 'README.rst')).read... | {
"content_hash": "4fef157f4b053cf44ad949b8f8487ad1",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 77,
"avg_line_length": 32.2,
"alnum_prop": 0.6335403726708074,
"repo_name": "gbirke/scrapy-multifeedexporter",
"id": "65ef070ef41c3d331fa96f88d1627771d20c9ac1",
"size": "11... |
from pandac.PandaModules import *
from toontown.toonbase import ToontownGlobals
import Playground
from toontown.launcher import DownloadForceAcknowledge
from toontown.building import Elevator
from toontown.toontowngui import TTDialog
from toontown.toonbase import TTLocalizer
from toontown.racing import RaceGlobals
from... | {
"content_hash": "0e67cec132e8c4fadfc6786921868619",
"timestamp": "",
"source": "github",
"line_count": 182,
"max_line_length": 148,
"avg_line_length": 39.357142857142854,
"alnum_prop": 0.6664805249197264,
"repo_name": "linktlh/Toontown-journey",
"id": "10e4be14873d6be79354d3b9f4f4f2ea1cad2e9b",
"s... |
"""
Matrix square root for general matrices and for upper triangular matrices.
This module exists to avoid cyclic imports.
"""
__all__ = ['sqrtm']
import numpy as np
from scipy._lib._util import _asarray_validated
# Local imports
from .misc import norm
from .lapack import ztrsyl, dtrsyl
from .decomp_schur import ... | {
"content_hash": "766d9f628ceaee116881e58feeab2771",
"timestamp": "",
"source": "github",
"line_count": 191,
"max_line_length": 76,
"avg_line_length": 29.643979057591622,
"alnum_prop": 0.578064288237372,
"repo_name": "nmayorov/scipy",
"id": "d14f9bfbd8b0b40eff617ccdb256bae4423e3376",
"size": "5662"... |
from __future__ import unicode_literals
import ckeditor.fields
import ckeditor_uploader.fields
from django.db import migrations, models
import django.db.models.deletion
import django.db.models.manager
import mptt.fields
class Migration(migrations.Migration):
initial = True
dependencies = [
]
opera... | {
"content_hash": "0013571b3ce744432d3fcf0e675dd6af",
"timestamp": "",
"source": "github",
"line_count": 96,
"max_line_length": 204,
"avg_line_length": 51.041666666666664,
"alnum_prop": 0.5783673469387756,
"repo_name": "skylifewww/pangolin-fog",
"id": "4f4d5e97c4db9ebf12a1ce9528fa53777ee5d838",
"siz... |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('reviews_manager', '0004_auto_20161209_1323'),
]
operations = [
migrations.AddField(
model_name='clinicalannotationstep',
nam... | {
"content_hash": "c8415aea0cb37c1f22dd7787afb2cb1e",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 72,
"avg_line_length": 23.38888888888889,
"alnum_prop": 0.6175771971496437,
"repo_name": "crs4/ProMort",
"id": "39729af65c4744ccbbd91f0e58db3ba9e4849c5e",
"size": "1544",
... |
from collections import Counter
from redis import StrictRedis
from streamparse import Bolt
class WordCountBolt(Bolt):
outputs = ['word', 'count']
def initialize(self, conf, ctx):
self.counter = Counter()
self.total = 0
def _increment(self, word, inc_by):
self.counter[word] += i... | {
"content_hash": "5a126cfd4157a3527cf8e6d1c02f8d43",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 65,
"avg_line_length": 27.365853658536587,
"alnum_prop": 0.5926916221033868,
"repo_name": "codywilbourn/streamparse",
"id": "90f968d2536ed000cf073b5656673a30d7bd414b",
"siz... |
"""Tests for kernel connection utilities"""
# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
import json
import os
import nose.tools as nt
from traitlets.config import Config
from jupyter_core.application import JupyterApp
from ipython_genutils.tempdir import Temp... | {
"content_hash": "5e82394f1ca9dcfb7a2a56886d7f620d",
"timestamp": "",
"source": "github",
"line_count": 137,
"max_line_length": 95,
"avg_line_length": 32.08029197080292,
"alnum_prop": 0.6348122866894198,
"repo_name": "ammarkhann/FinalSeniorCode",
"id": "c84ee660ba0c850d3646a86c8748cde86930f4e2",
"s... |
from unittest import TestCase
from testfixtures import compare
from service.ws_re.register.author import Author
class TestAuthor(TestCase):
def test_author(self):
register_author = Author("Test Name", {"death": 1999})
compare("Test Name", register_author.name)
compare(1999, register_auth... | {
"content_hash": "5b48023a4fa01485939987d9bdee5ed4",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 73,
"avg_line_length": 36.229166666666664,
"alnum_prop": 0.6365727429557216,
"repo_name": "the-it/WS_THEbotIT",
"id": "5d6f2d05b1550698fea05235017fba0dddce331b",
"size": "1... |
"""`Factory` provider - passing injections to the underlying providers example."""
from dependency_injector import containers, providers
class Regularizer:
def __init__(self, alpha: float) -> None:
self.alpha = alpha
class Loss:
def __init__(self, regularizer: Regularizer) -> None:
self.reg... | {
"content_hash": "cbebd2ba0b0c277113c6f02bc84e3f5b",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 82,
"avg_line_length": 24.132075471698112,
"alnum_prop": 0.6075058639562158,
"repo_name": "rmk135/dependency_injector",
"id": "de1130f3f8091bed43dc923456df729ca192c4d0",
"s... |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('groups', '0012_auto_20160318_0818'),
]
operations = [
migrations.AlterField(
model_name='invite',
name='accepted',
... | {
"content_hash": "ec4ccd9c25eb4c70278b1345889729fa",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 53,
"avg_line_length": 21.22222222222222,
"alnum_prop": 0.5968586387434555,
"repo_name": "fxa90id/mozillians",
"id": "fe866292f5d9cc32e7676165d8a2970e319e9a8c",
"size": "40... |
"""
Given a list, rotate the list to the right by k places, where k is non-negative.
For example:
Given 1->2->3->4->5->NULL and k = 2,
return 4->5->1->2->3->NULL.
"""
# Definition for singly-linked list.
# class ListNode:
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution:
... | {
"content_hash": "a41835e2379f1fd90ded3a8d9cad88c0",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 80,
"avg_line_length": 26.289473684210527,
"alnum_prop": 0.48148148148148145,
"repo_name": "yuzhangcmu/Python-Study",
"id": "727e6c5bc5bc4d5560c819eaac4a67bff5b08498",
"siz... |
from UserDict import DictMixin
class OrderedDict(dict, DictMixin):
def __init__(self, *args, **kwds):
if len(args) > 1:
raise TypeError('expected at most 1 arguments, got %d' % len(args))
try:
self.__end
except AttributeError:
self.clear()
... | {
"content_hash": "f8cdbe947b52b952467176f1432898b7",
"timestamp": "",
"source": "github",
"line_count": 107,
"max_line_length": 79,
"avg_line_length": 28.60747663551402,
"alnum_prop": 0.48056190787324404,
"repo_name": "citrix-openstack-build/glance",
"id": "524a5c96f34d8b9d9f235c673e6ae81a1e2dd37d",
... |
"""The text random column class of the dataframe creator, create random text snippets"""
import random
import warnings
__author__ = "Peter J Usherwood"
__python_version__ = "3.6"
class TextRandom:
"""
Produce a column of random sentences, 1 per row, generated by markov chains on a given corpus.
"""
... | {
"content_hash": "88f51b17498be49cf6b040cf24ca0d74",
"timestamp": "",
"source": "github",
"line_count": 124,
"max_line_length": 114,
"avg_line_length": 33.693548387096776,
"alnum_prop": 0.5598372426998564,
"repo_name": "Usherwood/usherwood_ds",
"id": "2adfbc0824111eaccaca440773fa11c1fdaefe36",
"siz... |
import unittest
import pynuodb
from .nuodb_base import NuoBase
class NuoDBGlobalsTest(NuoBase):
def test_module_globals(self):
self.assertEquals(pynuodb.apilevel, '2.0')
self.assertEquals(pynuodb.threadsafety, 1)
self.assertEquals(pynuodb.paramstyle, 'qmark')
if __name__ == '__main__':
... | {
"content_hash": "0ffacee93e8cc1755266ee3bb59aa87c",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 54,
"avg_line_length": 22.666666666666668,
"alnum_prop": 0.6882352941176471,
"repo_name": "tvincentNuoDB/nuodb-python",
"id": "d8e1848c3376f50adf0527f1d746b3f52c56c757",
"s... |
import os
from dashboard import app as application, run
if __name__ == '__main__':
ip = os.environ.get('OPENSHIFT_PYTHON_IP', '0.0.0.0')
port = int(os.environ.get('OPENSHIFT_PYTHON_PORT', 8051))
application.config['PROPAGATE_EXCEPTIONS'] = True
run(ip, port) | {
"content_hash": "10d2e9fc4026dc5fd5b4bc1e31b80667",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 61,
"avg_line_length": 30.666666666666668,
"alnum_prop": 0.6594202898550725,
"repo_name": "ButecoOpenSource/dashboard-old",
"id": "caf8ff258da40e4e54b0918a4255cfebe288ba03",
... |
from autobahn.twisted.websocket import WebSocketServerProtocol, \
WebSocketServerFactory
import json
from twisted.internet.defer import Deferred, \
inlineCallbacks, \
returnValue
def sleep(delay):
d = Defe... | {
"content_hash": "2ba34803a2ed352b41233974770fa846",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 73,
"avg_line_length": 25.28846153846154,
"alnum_prop": 0.6106463878326996,
"repo_name": "mrrrgn/AutobahnPython",
"id": "89346d7e872f8154b2e574d1b12f1a2fb7f18bcf",
"size": ... |
from rockstar import RockStar
r_code = "cat ('Hello world!')"
rock_it_bro = RockStar(days=400, file_name='hello.r', code=r_code)
rock_it_bro.make_me_a_rockstar()
| {
"content_hash": "86d3e0c4d95c84b2c259365dcd13549c",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 66,
"avg_line_length": 27.333333333333332,
"alnum_prop": 0.7012195121951219,
"repo_name": "Hitman666/rockstar",
"id": "d316eda0dcae9278c355d2ec9775d1e21b406ae8",
"size": "16... |
"""
Definition of TreeNode:
class TreeNode:
def __init__(self, val):
self.val = val
self.left, self.right = None, None
"""
class Solution:
"""
@param root: The root of binary tree.
@return: Preorder in ArrayList which contains node values.
"""
def preorderTraversal(self, root):... | {
"content_hash": "d108055c5de255c6eaefb948eaa9945b",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 62,
"avg_line_length": 25.153846153846153,
"alnum_prop": 0.6223241590214067,
"repo_name": "joshua-jin/algorithm-campus",
"id": "124db7060e69d2c6b4849e3dcb9472734b7a9de3",
"... |
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('logistica', '0037_nfentrada_empresa'),
]
operations = [
migrations.CreateModel(
name='NfEntradaAgator',
fields=[
],
... | {
"content_hash": "72ef89beab49f06ccb6e1b26b3d0a08e",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 73,
"avg_line_length": 27.35135135135135,
"alnum_prop": 0.48122529644268774,
"repo_name": "anselmobd/fo2",
"id": "c79c6a4619fbf4cf9ba2dc9a5e0b88f79731a1c1",
"size": "1086",... |
from subprocess \
import \
call
# Code taken from python 2.6.5
class CalledProcessError(Exception):
"""This exception is raised when a process run by check_call() returns
a non-zero exit status. The exit status will be stored in the
returncode attribute."""
def __init__(self, returncode, c... | {
"content_hash": "384a7820e2123ffe98bf72ea29aea743",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 92,
"avg_line_length": 32.088235294117645,
"alnum_prop": 0.6617781851512374,
"repo_name": "abadger/Bento",
"id": "39ea610e70cce34191a0fac62f47a8a30cb7e436",
"size": "1091",... |
import copy
import unittest
import warnings
import mock
import numpy as np
import chainer
from chainer import backend
from chainer.backends import cuda
from chainer import optimizer
from chainer import optimizers
from chainer import serializer
from chainer import testing
from chainer.testing import attr
import chaine... | {
"content_hash": "0ef89419578874af96c91698e63da26f",
"timestamp": "",
"source": "github",
"line_count": 689,
"max_line_length": 79,
"avg_line_length": 32.63570391872279,
"alnum_prop": 0.6182068842835542,
"repo_name": "ktnyt/chainer",
"id": "1185707d8c33c8eb8e5a2be9d545c564fc87a2ea",
"size": "22486"... |
from __future__ import unicode_literals
import json
import logging
from django import template
from django.utils import six
from django.utils.html import mark_safe
from reviewboard.avatars import avatar_services
register = template.Library()
@register.simple_tag(takes_context=True)
def avatar(context, user, size... | {
"content_hash": "99c223ee46265e699cfb21da3fe750bf",
"timestamp": "",
"source": "github",
"line_count": 138,
"max_line_length": 79,
"avg_line_length": 32.768115942028984,
"alnum_prop": 0.6134453781512605,
"repo_name": "davidt/reviewboard",
"id": "a6543ef668bb698f99684fda7c0d47cc375ec003",
"size": "... |
import _plotly_utils.basevalidators
class ColorsrcValidator(_plotly_utils.basevalidators.SrcValidator):
def __init__(
self, plotly_name="colorsrc", parent_name="funnel.insidetextfont", **kwargs
):
super(ColorsrcValidator, self).__init__(
plotly_name=plotly_name,
parent_... | {
"content_hash": "3298ae20960bb9996ce684f26ce46a3e",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 83,
"avg_line_length": 32.69230769230769,
"alnum_prop": 0.611764705882353,
"repo_name": "plotly/plotly.py",
"id": "55ebdda24f6f4c7879fafc365b792abc459be894",
"size": "425",... |
"""
Tools for working in non-realtime.
"""
from .AudioInputBusGroup import AudioInputBusGroup # noqa
from .AudioOutputBusGroup import AudioOutputBusGroup # noqa
from .Buffer import Buffer # noqa
from .BufferGroup import BufferGroup # noqa
from .Bus import Bus # noqa
from .BusGroup import BusGroup # noqa
from .DoN... | {
"content_hash": "3135b0c705867ff1ece946bc4f16e6c2",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 60,
"avg_line_length": 38.42857142857143,
"alnum_prop": 0.7806691449814126,
"repo_name": "Pulgama/supriya",
"id": "ce59dd2488c13da9dcfa4e10dfbdfc2b06a94a2b",
"size": "807",... |
import sys
import threading
class ProgressBar(object):
"""
Print progress bar in the separated thread
"""
def __init__(self, interval=1, fp=sys.stdout):
"""
Start thread for progress bar
:param interval: interval seconds to write dots
:param fp: file pointer to write
... | {
"content_hash": "a73fa9cbd896597b110f22175607438a",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 61,
"avg_line_length": 23.74,
"alnum_prop": 0.5450716090985678,
"repo_name": "mogproject/artifact-cli",
"id": "11822ddb4f0e2af268c9a0111ef7383ce925b10a",
"size": "1187",
... |
import datetime
from dateutil.relativedelta import relativedelta
from django.contrib.auth.models import User
from django.contrib.sites.models import Site
from django.core.exceptions import ValidationError
from django.core.mail import send_mail
from django.core.urlresolvers import reverse
from django.db import models
f... | {
"content_hash": "cef381cbaf84640b8a45c7174267277e",
"timestamp": "",
"source": "github",
"line_count": 401,
"max_line_length": 82,
"avg_line_length": 39.209476309226936,
"alnum_prop": 0.5953062392673154,
"repo_name": "gaga3966/django-timepiece",
"id": "a9d2bc078b18ce376180b966bef7b4aaf05f316f",
"s... |
import sys
import imp
import json
import sublime
import sublime_plugin
# Make sure all dependencies are reloaded on upgrade
reloader_path = 'json2apex.helpers.reloader'
if reloader_path in sys.modules:
imp.reload(sys.modules[reloader_path])
from .helpers import reloader
reloader.reload()
from .helpers import JSON2... | {
"content_hash": "6cbc1edf2c8495e981f218e67334d489",
"timestamp": "",
"source": "github",
"line_count": 179,
"max_line_length": 92,
"avg_line_length": 26.804469273743017,
"alnum_prop": 0.7219674864526886,
"repo_name": "nchursin/json2apex",
"id": "b79588340b983668d800ce5f516f5c2bea185ece",
"size": "... |
import sqlite3 as sql
from error import error
class database: #the database class handles anything with a database connection
def __init__(self):
try:
self.rdb = None
self.rdb = sql.connect('average_check.db')
self.ecx = self.rdb.cursor()
except:
error(1,'sql connect error', True)
... | {
"content_hash": "2b2a1a85879fda0bb170300c58214218",
"timestamp": "",
"source": "github",
"line_count": 137,
"max_line_length": 193,
"avg_line_length": 48.416058394160586,
"alnum_prop": 0.615257048092869,
"repo_name": "msemple1111/average_alpr",
"id": "a128b877d913509e6424b29026776d59808b4ceb",
"si... |
from .map_layer_error import MapLayerError
class UnmappedDataSourceError(MapLayerError):
"""description of class""" | {
"content_hash": "466d66c91daa388c65545aaf58c37e15",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 45,
"avg_line_length": 30,
"alnum_prop": 0.7916666666666666,
"repo_name": "adamkerz/arcpyext",
"id": "e6373375175092a0aedb22faf7244427edd2bd31",
"size": "120",
"binary": f... |
"""Tests for Convolution node name match via the XLA JIT.
The canned results in these tests are created by running each test using the
Tensorflow CPU device and saving the output.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
from... | {
"content_hash": "2bbbf98fb8bb93f7fc4fcd7b931460fb",
"timestamp": "",
"source": "github",
"line_count": 108,
"max_line_length": 80,
"avg_line_length": 32.879629629629626,
"alnum_prop": 0.6088425795550549,
"repo_name": "frreiss/tensorflow-fred",
"id": "e346d9f17cdd9710505ae57c865b2be463130577",
"siz... |
# Copyright 2016-2017 University of Pittsburgh
# 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 agr... | {
"content_hash": "3d89fea7ce64925f2c30f1ca7d9f9bad",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 91,
"avg_line_length": 33.28947368421053,
"alnum_prop": 0.7201581027667984,
"repo_name": "dbmi-pitt/dbmi-annotator",
"id": "3529607fc61b7fa1cdd8a87d9ee89a539b5278d2",
"size... |
import shutil
from subprocess import Popen
from tempfile import TemporaryFile
from urllib.parse import urlparse
from pathlib import PurePath
from urllib.parse import unquote
GIT_BIN=shutil.which("git")
# Determine the default directory name used by git for the uri
def get_default_repo_dirname(uri, bare=False):
p... | {
"content_hash": "dbc0b76069cc8401217d3685d41dd31c",
"timestamp": "",
"source": "github",
"line_count": 75,
"max_line_length": 90,
"avg_line_length": 27.653333333333332,
"alnum_prop": 0.6142719382835101,
"repo_name": "datamachine/telex",
"id": "c2dd2c6c060ba439d111273f694d0addc2184292",
"size": "20... |
""" ymir.mixins.packages
"""
import os
from fabric import api
from ymir import data as ydata
class PackageMixin(object):
""" To be linux-base agnostic, services should NOT call apt or yum directly.
Actually.. services should not be installing packages directly because
one of the CAP languages i... | {
"content_hash": "7ae284e9cee25aef519d5a783c8af307",
"timestamp": "",
"source": "github",
"line_count": 105,
"max_line_length": 82,
"avg_line_length": 40.333333333333336,
"alnum_prop": 0.5903187721369539,
"repo_name": "mattvonrocketstein/ymir",
"id": "98756ad5bcc8721c53a926850bded2d470e3409b",
"siz... |
"""
Types to use in messaging stuff.
"""
from typing import TypeVar, Dict, List
Transferrable = TypeVar("Transferrable", Dict, List, str)
Serialized = TypeVar("Serialized", str, bytes)
| {
"content_hash": "fbd79c34d69af0b3dc4d4abd585e8c47",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 57,
"avg_line_length": 18.9,
"alnum_prop": 0.7195767195767195,
"repo_name": "anti1869/sunhead",
"id": "4a3117dcef23ac7db11954c36d900c94ed4634dc",
"size": "189",
"binary":... |
from tempest.api.network import base
from tempest.common import utils
from tempest import config
from tempest.lib.common.utils import data_utils
from tempest.lib.common.utils import test_utils
from tempest.lib import decorators
from tempest.lib import exceptions as lib_exc
CONF = config.CONF
class SubnetPoolsTestJSO... | {
"content_hash": "1cc8541aeac3363668876ba427d45e26",
"timestamp": "",
"source": "github",
"line_count": 60,
"max_line_length": 78,
"avg_line_length": 42.983333333333334,
"alnum_prop": 0.6521907716169058,
"repo_name": "Juniper/tempest",
"id": "bfc26098ea1dd4969cef3d9a5adfbe58b05f2ee7",
"size": "3174... |
'''config.py: util functions for config, mainly for heron-cli'''
import argparse
import contextlib
import getpass
import os
import sys
import subprocess
import tarfile
import tempfile
import yaml
from heron.common.src.python.utils.log import Log
# pylint: disable=logging-not-lazy
# default environ tag, if not provi... | {
"content_hash": "cb02ba671c109ee0cc5e700b6f9527e2",
"timestamp": "",
"source": "github",
"line_count": 401,
"max_line_length": 100,
"avg_line_length": 29.60847880299252,
"alnum_prop": 0.6540048850332688,
"repo_name": "objmagic/heron",
"id": "900b2422a8af8bd6a4c7f6ad0a5f7737294f9b2c",
"size": "1246... |
from django.db import models
from dockit.schema.loading import get_base_document
import datetime
from decimal import Decimal
from dockit.backends.djangodocument.managers import BaseIndexManager, DocumentManager, RegisteredIndexManager
class DocumentStore(models.Model):
collection = models.CharField(max_length=1... | {
"content_hash": "cd0c90f6154668b1ffc66da1bed8f331",
"timestamp": "",
"source": "github",
"line_count": 87,
"max_line_length": 109,
"avg_line_length": 35.39080459770115,
"alnum_prop": 0.7544657356284508,
"repo_name": "zbyte64/django-dockit",
"id": "cf3482f69f0f542bdb746f420bf23674a6bc03ba",
"size":... |
"""Various classes representing distributed values."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import collections
import contextlib
import weakref
import six
from tensorflow.python.distribute import device_util
from tensorflow.python.distribute imp... | {
"content_hash": "e330d3f9f8703e968f229332749a72e5",
"timestamp": "",
"source": "github",
"line_count": 1582,
"max_line_length": 108,
"avg_line_length": 36.53350189633375,
"alnum_prop": 0.6729877500173023,
"repo_name": "ageron/tensorflow",
"id": "374810e1284837407fba9b4a0bd8c8c0c746f3e4",
"size": "... |
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import functools
import logging
import multiprocessing
import traceback
from abc import abstractmethod
from collections import OrderedDict
from Queue import Queue
fro... | {
"content_hash": "98834dac144ae4593c7b71ec024a4e3c",
"timestamp": "",
"source": "github",
"line_count": 496,
"max_line_length": 108,
"avg_line_length": 38.520161290322584,
"alnum_prop": 0.692504972260023,
"repo_name": "kwlzn/pants",
"id": "1fe82b42bea93fba324b126e0838dd24747bdb56",
"size": "19253",... |
from django.contrib import admin
from .models import FileModel
@admin.register(FileModel)
class HelperAdmin(admin.ModelAdmin):
def save_model(self, request, instance, form, change):
user = request.user
instance = form.save(commit=False)
if not change or not instance.created_by:
... | {
"content_hash": "9ef054b36558dd77c9b4ed3582bc84b3",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 63,
"avg_line_length": 30.235294117647058,
"alnum_prop": 0.6459143968871596,
"repo_name": "k0t3n/fspo_helper",
"id": "ae85dce96b95642674430b626ee0f34ff040f102",
"size": "51... |
from ez_setup import use_setuptools
use_setuptools()
from setuptools import setup, find_packages
def readfile(filename):
fp = open(filename)
try:
data = fp.read()
except:
raise
finally:
fp.close()
return data
setup(
name='BaseConv',
version='0.1a',
description='... | {
"content_hash": "72692ec82776d268b2a19cd43abd7a62",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 74,
"avg_line_length": 26.51851851851852,
"alnum_prop": 0.6578212290502793,
"repo_name": "zvoase/baseconv",
"id": "260af7640609a4ae536650b127c84f7481b78545",
"size": "716",... |
from common_fixtures import * # NOQA
LB_IMAGE_UUID = "docker:sangeetha/lbtest:latest"
CONTAINER_HOST_NAMES = ["container1", "container2", "container3"]
containers_in_host = []
logger = logging.getLogger(__name__)
if_lb_containers = pytest.mark.skipif(
not os.environ.get('EXECUTE_STANDALONE_LB') or
os.envir... | {
"content_hash": "e8247cd2559fadb9215cd713942c3fc3",
"timestamp": "",
"source": "github",
"line_count": 1230,
"max_line_length": 79,
"avg_line_length": 33.34634146341463,
"alnum_prop": 0.5646333138287497,
"repo_name": "hibooboo2/validation-tests",
"id": "06802eeca63c45f197dcc83901cf6eb7ca43e3bf",
"... |
"""
If dbus is available, this module implements a
org.freedesktop.Notifications service.
"""
from .log_utils import logger
try:
import dbus
from dbus import service
from dbus.mainloop.glib import DBusGMainLoop
DBusGMainLoop(set_as_default=True)
has_dbus = True
except ImportError:
has_d... | {
"content_hash": "cdfd8347e33ddc1048e80838079e099b",
"timestamp": "",
"source": "github",
"line_count": 95,
"max_line_length": 82,
"avg_line_length": 31.526315789473685,
"alnum_prop": 0.5996661101836394,
"repo_name": "flacjacket/qtile",
"id": "4005d58ef9b223536e734a0be8fb520b98f828d6",
"size": "422... |
"""
Flask-Mandrill
==============
A Flask Extension to remove some of the boiler plate encountered when
sending emails with `Mandrill <http://www.mandrill.com/>`_
Installation
````````````
.. code:: bash
$ pip install flask-mandrill
Usage
`````
.. code:: python
from flask import Flask
from f... | {
"content_hash": "eb138fe07740efd681983c8d338d8c05",
"timestamp": "",
"source": "github",
"line_count": 64,
"max_line_length": 70,
"avg_line_length": 25.234375,
"alnum_prop": 0.5857585139318885,
"repo_name": "volker48/flask-mandrill",
"id": "3f01210e72b31cf3eafe26eca0723a21876bb1e2",
"size": "1615"... |
from ...fluid.initializer import Initializer
from ...fluid.data_feeder import check_variable_and_dtype
from ...fluid.core import VarDesc
from ...fluid import framework
from ...fluid.framework import _current_expected_place
from paddle import in_dynamic_mode
from paddle.utils import unique_name
from paddle import _C_ops... | {
"content_hash": "7c09984dc44d54a0c30f182126c162d8",
"timestamp": "",
"source": "github",
"line_count": 293,
"max_line_length": 111,
"avg_line_length": 35.918088737201366,
"alnum_prop": 0.4713987077156975,
"repo_name": "PaddlePaddle/Paddle",
"id": "489033291a7fc3ffe66db291a7933c6ac644ef4a",
"size":... |
import os
from setuptools import setup
def read_file(name):
filepath = os.path.join(
os.path.dirname(os.path.realpath(__file__)),
name
)
data = open(filepath)
try:
return data.read()
except IOError:
print "could not read %r" % name
data.close()
PROJECT = ... | {
"content_hash": "273bbd9c3a4a4615b2d536e1290a2584",
"timestamp": "",
"source": "github",
"line_count": 68,
"max_line_length": 73,
"avg_line_length": 28.955882352941178,
"alnum_prop": 0.6084306754697816,
"repo_name": "apache/cloudstack-ec2stack",
"id": "21bea7229a13729d74e6136692ac6899493dfbae",
"s... |
""" Record a few seconds of audio and save to a WAVE file. """
import logging
import socket
import os
import sys
import wave
import random
from itertools import izip
from math import sqrt
import pyaudio
import numpy as np
from globalvars import (SOCKET_ADDR, SAMPLES_PER_SECOND)
#PyAudio setup
FORMAT = pyaudio.paInt... | {
"content_hash": "71ef015d1912e2886d0985080eec69b3",
"timestamp": "",
"source": "github",
"line_count": 138,
"max_line_length": 103,
"avg_line_length": 26.18840579710145,
"alnum_prop": 0.6405644714997233,
"repo_name": "zwass/lpControl",
"id": "c5117ad19a76cd55f21f5707aa5052ab4a7277c4",
"size": "361... |
"""Tests for tensorflow.ops.data_flow_ops.FIFOQueue."""
import random
import re
import time
import tensorflow.python.platform
import numpy as np
import tensorflow as tf
class FIFOQueueTest(tf.test.TestCase):
def testConstructor(self):
with tf.Graph().as_default():
q = tf.FIFOQueue(10, tf.float32, name=... | {
"content_hash": "23cab438e61c3bb54e6ea6ce66ace7f7",
"timestamp": "",
"source": "github",
"line_count": 1071,
"max_line_length": 80,
"avg_line_length": 34.83940242763772,
"alnum_prop": 0.6023101867981668,
"repo_name": "brendandburns/tensorflow",
"id": "11b7d46318981208dc36a632f5a11a5e71ac3912",
"si... |
from django.conf.urls import patterns, url
from loginurl.views import cleanup, login
from haystack.query import SearchQuerySet
from haystack.views import FacetedSearchView
from .views import IndexView, PersonDetailView, PersonCreateView, PersonUpdateView, \
DirectoryFacetedSearchForm, LoginView
sqs = SearchQuerySe... | {
"content_hash": "7d1c7a051e06623341cd859d77487ced",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 121,
"avg_line_length": 43.77777777777778,
"alnum_prop": 0.7115059221658206,
"repo_name": "ocwc/directory",
"id": "56b76818bb0c8998a49a2fc615ca4791843998a8",
"size": "1182"... |
__all__ = [ 'Client', 'Listener', 'Pipe', 'wait' ]
import io
import os
import sys
import socket
import struct
import time
import tempfile
import itertools
import _multiprocess as _multiprocessing
from . import reduction
from . import util
from . import AuthenticationError, BufferTooShort
from .reduction import Fork... | {
"content_hash": "1f4ff51d256fb48e2074922cf2db4fb1",
"timestamp": "",
"source": "github",
"line_count": 945,
"max_line_length": 84,
"avg_line_length": 32.15873015873016,
"alnum_prop": 0.5473181967752551,
"repo_name": "seishei/multiprocess",
"id": "a07c89d7c2c6433faa2a90588a20bbf04eb18f03",
"size": ... |
from __future__ import print_function
import unittest
import paddle.fluid.layers as layers
from paddle.fluid.executor import Executor
import paddle.fluid.core as core
from paddle.fluid.backward import append_backward
import numpy
class TestWhileOp(unittest.TestCase):
def test_simple_forward(self):
d0 = l... | {
"content_hash": "464451a671543917405c08d6573f30a0",
"timestamp": "",
"source": "github",
"line_count": 87,
"max_line_length": 76,
"avg_line_length": 34.52873563218391,
"alnum_prop": 0.5709054593874834,
"repo_name": "baidu/Paddle",
"id": "43fd9d425bffb1e0198f4e845da959570a964990",
"size": "3615",
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.