text stringlengths 4 1.02M | meta dict |
|---|---|
import rest_framework.serializers
from rest_framework_nested.relations import NestedHyperlinkedIdentityField, NestedHyperlinkedRelatedField
try:
from rest_framework.utils.field_mapping import get_nested_relation_kwargs
except ImportError:
pass
# passing because NestedHyperlinkedModelSerializer can't be used... | {
"content_hash": "3cf918f31fcdc2d3000c6bf48de4b96c",
"timestamp": "",
"source": "github",
"line_count": 54,
"max_line_length": 105,
"avg_line_length": 38.48148148148148,
"alnum_prop": 0.6929740134744947,
"repo_name": "alanjds/drf-nested-routers",
"id": "38c50a800d40a3babb47dca3dfc7f45a916cfd19",
"s... |
"""Tests for dopamine.logger."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import pickle
import shutil
from absl import flags
from absl.testing import absltest
from absl.testing import parameterized
from dopamine.discrete_domains import log... | {
"content_hash": "b5f5a47c1a4231784447f40ddce3dcf9",
"timestamp": "",
"source": "github",
"line_count": 104,
"max_line_length": 78,
"avg_line_length": 34.56730769230769,
"alnum_prop": 0.6820584144645341,
"repo_name": "google/dopamine",
"id": "955a4a639d8920a23e974a2c6f3df411bc99d5e5",
"size": "4196... |
import logging
log = logging.getLogger(__name__)
log.addHandler(logging.NullHandler())
from pymeasure.instruments import Instrument
from pymeasure.adapters import VISAAdapter
from pymeasure.instruments.validators import (
truncated_discrete_set, strict_discrete_set,
truncated_range
)
from time import sleep, ti... | {
"content_hash": "d9ea97e30ca2c9ec193a5618b618a295",
"timestamp": "",
"source": "github",
"line_count": 204,
"max_line_length": 93,
"avg_line_length": 31.102941176470587,
"alnum_prop": 0.571946414499606,
"repo_name": "dvspirito/pymeasure",
"id": "e98fa659796c6f0c5e43fac027f194ccffc1900b",
"size": "... |
from xml.etree.ElementTree import XML
import os
import logging
from metashare.settings import LOG_HANDLER
import pycountry
# Setup logging support.
LOGGER = logging.getLogger(__name__)
LOGGER.addHandler(LOG_HANDLER)
def read_langs(filename):
if not os.path.isfile(filename):
LOGGER.error('read_langs: {0} n... | {
"content_hash": "d11543b97d93ad8f32beaac6008de1a2",
"timestamp": "",
"source": "github",
"line_count": 51,
"max_line_length": 66,
"avg_line_length": 28.274509803921568,
"alnum_prop": 0.6178918169209431,
"repo_name": "zeehio/META-SHARE",
"id": "37f29cd54c53a2b03b3fbfcac05d149ded14d54c",
"size": "14... |
import responses
from requests.exceptions import HTTPError
from gitlab_tests.base_test import BaseTest
from response_data.deploy_keys import *
class TestGetAllDeployKeys(BaseTest):
@responses.activate
def test_get_all_deploy_keys(self):
responses.add(
responses.GET,
self.gitla... | {
"content_hash": "f9a269a0a4306f11909a293b0d0f6b25",
"timestamp": "",
"source": "github",
"line_count": 68,
"max_line_length": 81,
"avg_line_length": 32.6764705882353,
"alnum_prop": 0.6134113411341134,
"repo_name": "pyapi-gitlab/pyapi-gitlab",
"id": "20d40b6fd8ed149d60a8ddfa295f11f0953ac6e7",
"size... |
import math
import string
import sys
import struct
import matplotlib
import matplotlib.pyplot as pyplot
#import utils
import numpy as np
#import array
#import astLib.astStats as astStats
import cPickle
import asciitable
import scipy.ndimage
import scipy.stats as ss
import scipy as sp
import pyfits
import make_color_ima... | {
"content_hash": "070cc311a27dec4d92d914a29b62383a",
"timestamp": "",
"source": "github",
"line_count": 269,
"max_line_length": 179,
"avg_line_length": 55.520446096654275,
"alnum_prop": 0.690592567793773,
"repo_name": "gsnyder206/mock-surveys",
"id": "41cf2716126b05e5239362d33b3e4fb6db3d78dd",
"siz... |
import abc
import copy
import os
import oslo_messaging
import six
from neutron.agent.linux import ip_lib
from neutron.common import rpc as n_rpc
from neutron import context
from neutron_lib import constants
from neutron_lib.plugins import directory
from neutron_vpnaas.services.vpn import device_drivers
from neutron_vp... | {
"content_hash": "8e71532212c1e45171a6dce38bacab6d",
"timestamp": "",
"source": "github",
"line_count": 320,
"max_line_length": 79,
"avg_line_length": 38.490625,
"alnum_prop": 0.6162214825038564,
"repo_name": "naveensan1/nuage-openstack-neutron",
"id": "c67a5b32cc16e82519deee31ae8cd2d354d05579",
"s... |
import numpy as np
from scipy.integrate import odeint
# Set constant 2 * pi.
PI2 = 2 * np.pi
class Cantilever(object):
"""Damped Driven Harmonic Oscillator Simulator for AFM Cantilevers.
Simulates a DDHO under excitation with given parameters.
Parameters
----------
can_params : dict
Par... | {
"content_hash": "30a499698ba29fb851989f6afab1ecad",
"timestamp": "",
"source": "github",
"line_count": 271,
"max_line_length": 78,
"avg_line_length": 28.136531365313655,
"alnum_prop": 0.5489836065573771,
"repo_name": "jarrison/trEFM-learn",
"id": "530acd982f4dafd757f279ae922f8cee21a9444a",
"size":... |
from . import core, utils
import cgt
import ctypes, os.path as osp, hashlib, numpy as np, sys, subprocess, string, os, time, traceback, cPickle
from collections import defaultdict, namedtuple
from StringIO import StringIO
import logging
def function(inputs, outputs, dbg=None, updates=None, givens=None):
assert isi... | {
"content_hash": "35b03755c3d288a8c9f45a652881f87a",
"timestamp": "",
"source": "github",
"line_count": 900,
"max_line_length": 162,
"avg_line_length": 40.66888888888889,
"alnum_prop": 0.5859789082563794,
"repo_name": "RichardWarfield/cgt",
"id": "b9466f0d00c8d9b7a314a512f331357ea2003dd5",
"size": ... |
"""
EasyBuild support for Python packages that are configured with CMake, implemented as an easyblock
@author: Stijn De Weirdt (Ghent University)
@author: Dries Verdegem (Ghent University)
@author: Kenneth Hoste (Ghent University)
@author: Pieter De Baets (Ghent University)
@author: Jens Timmerman (Ghent University)
"... | {
"content_hash": "e0fbd1ed9dc671497f4aa485bd07624b",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 97,
"avg_line_length": 35.16981132075472,
"alnum_prop": 0.6958154506437768,
"repo_name": "ULHPC/modules",
"id": "6a83197b3c980cd1e8f3283412e1d0b9feadb1fd",
"size": "2922",
... |
from __future__ import absolute_import
from ircb.models import create_tables
from .network import NetworkStore
from .client import ClientStore
from .network_message_store import NetworkMessageStore
from .channel import ChannelStore
def initialize():
create_tables()
NetworkStore.initialize()
ClientStore.... | {
"content_hash": "35252bfea8036d5e20b7b4dab8a82291",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 54,
"avg_line_length": 21.045454545454547,
"alnum_prop": 0.7386609071274298,
"repo_name": "Ghost-script/ircb",
"id": "d16ffcb1e13b94b45f932b131c0c349246f79cdf",
"size": "46... |
"""
This script runs the application using a development server.
It contains the definition of routes and views for the application.
"""
from flask import Flask
import ast
app = Flask(__name__)
# routes.py after app is created, circular references
# noinspection PyPep8
from routes import *
# noinspection PyPep8
im... | {
"content_hash": "a5f8181bc8433cef4969e8490e32cb8b",
"timestamp": "",
"source": "github",
"line_count": 51,
"max_line_length": 82,
"avg_line_length": 26.176470588235293,
"alnum_prop": 0.6891385767790262,
"repo_name": "cliftbar/FlaPyDisaster",
"id": "863310b9582fc8b99ec48a7c634c90df3a3b075b",
"size"... |
"""
Diagonal single qubit gate.
"""
from qiskit import CompositeGate
from qiskit import Gate
from qiskit import InstructionSet
from qiskit import QuantumCircuit
from qiskit import QuantumRegister
from qiskit.extensions.standard import header # pylint: disable=unused-import
class U1Gate(Gate):
"""Diagonal single-... | {
"content_hash": "47ffeea0d91b9e13ff9e5f5011ad26b5",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 78,
"avg_line_length": 27.857142857142858,
"alnum_prop": 0.6249084249084249,
"repo_name": "atilag/qiskit-sdk-py",
"id": "62cd54b38d0af50a3c76b60f20b1336f7404d59d",
"size": ... |
"""Tests for the experimental input pipeline ops."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from collections import namedtuple
import threading
import time
import warnings
from absl.testing import parameterized
import numpy as np
from tensorflow.c... | {
"content_hash": "a8faa31c1b3e1019d9422a5b4a58edf7",
"timestamp": "",
"source": "github",
"line_count": 824,
"max_line_length": 80,
"avg_line_length": 37.61407766990291,
"alnum_prop": 0.6263147706007615,
"repo_name": "xodus7/tensorflow",
"id": "ae04995436995c66a053784c40dc8c56bb59cff1",
"size": "31... |
"""
Tests for the repo manager tool
"""
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import os
import glob
import shutil
import tempfile
import unittest
import ga4gh.exceptions as exceptions
import ga4gh.datarepo as datarepo
import ga4gh.cli as cli
impo... | {
"content_hash": "bccc7227c3c65f96f822c2f3ca95c556",
"timestamp": "",
"source": "github",
"line_count": 930,
"max_line_length": 79,
"avg_line_length": 37.575268817204304,
"alnum_prop": 0.6359708112748605,
"repo_name": "ohsu-computational-biology/server",
"id": "ec397ce9b28829f9fe8e51b6f4f8fbd8964d1bb... |
"""
This file emits the list of reasons why a particular build needs to be clobbered
(or a list of 'landmines').
"""
import optparse
import sys
import landmine_utils
builder = landmine_utils.platform
distributor = landmine_utils.distributor
gyp_defines = landmine_utils.gyp_defines
gyp_msvs_version = landmine_utils.... | {
"content_hash": "3b11bc45cf5bc77f10400568db4f7157",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 80,
"avg_line_length": 31.5,
"alnum_prop": 0.6694033935413246,
"repo_name": "cvsuser-chromium/chromium",
"id": "05c9de6962846a3f2280b5a3f5f6b68d2b91b5d2",
"size": "2012",
... |
from __future__ import absolute_import
from jinja2 import Markup
from changes.buildfailures.base import BuildFailure
class MissingArtifact(BuildFailure):
def get_html_label(self, build):
# TODO(dcramer): we need arbitrary data with build failures so this can
# say *what* artifact
return ... | {
"content_hash": "3568a87df71d4b141fa20402bef1817f",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 81,
"avg_line_length": 32.25,
"alnum_prop": 0.7312661498708011,
"repo_name": "bowlofstew/changes",
"id": "cacd2daf2e2a05e9350b4322dd397be2ca4179cc",
"size": "387",
"binar... |
import setuptools
# All these imported to be added to our distribution
import conjureup
find_420_friendly_packages = setuptools.PEP420PackageFinder.find
setuptools.setup(
name="conjure-up",
version=conjureup.__version__,
author="Adam Stokes",
author_email="adam.stokes@ubuntu.com",
description="co... | {
"content_hash": "3753b35af533ab689321f8d9ec778b95",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 70,
"avg_line_length": 28.727272727272727,
"alnum_prop": 0.6756329113924051,
"repo_name": "ubuntu/conjure-up",
"id": "1c6bb9471b8113d8f12ecf536327572d650276a5",
"size": "63... |
from datetime import datetime, timedelta
from sita.appointments.models import Appointment
from calendar import monthrange
def construct_query_view_month(month, year):
calendar = monthrange(year, month)
first_day_month = datetime(year=year, month=month, day=1)
last_day_month = datetime(year=year, month=mont... | {
"content_hash": "a7c840602c9d455aab326b3d3d128c01",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 173,
"avg_line_length": 57.7,
"alnum_prop": 0.7400346620450606,
"repo_name": "Fabfm4/Sita-BackEnd",
"id": "dd1972b14369d5704592537caa87b8860ee5581a",
"size": "577",
"bina... |
from django import forms
from django.contrib import admin
from jmbo.admin import ModelBaseAdmin
from poll.models import Poll, PollOption
readonly_attrs = {
'readonly': 'readonly',
'style': 'border-width: 0px;',
}
class PollOptionForm(forms.ModelForm):
votes = forms.IntegerField(
required=False,
... | {
"content_hash": "b106b9d497421bc9152b66dccfd27da6",
"timestamp": "",
"source": "github",
"line_count": 46,
"max_line_length": 73,
"avg_line_length": 28.130434782608695,
"alnum_prop": 0.6530139103554868,
"repo_name": "praekelt/jmbo-poll",
"id": "530568059084e3d229117a990775476725aa7f68",
"size": "1... |
"""create laptime view
Revision ID: 4f8fc8f7c68d
Revises: 4d73c542db51
Create Date: 2014-05-01 21:45:38.669382
"""
# revision identifiers, used by Alembic.
revision = '4f8fc8f7c68d'
down_revision = '4d73c542db51'
from alembic import op
import sqlalchemy as sa
from sqlalchemy.ext.compiler import compiles
from sqla... | {
"content_hash": "3c3fff327260743f08a51a14d5f26759",
"timestamp": "",
"source": "github",
"line_count": 102,
"max_line_length": 101,
"avg_line_length": 28.294117647058822,
"alnum_prop": 0.613998613998614,
"repo_name": "kartyboyz/n64-storage-flask",
"id": "1ad19c4fec54ab35766cf7ca63bd8ccda11fc1f0",
... |
import socket
import datetime
import time
from aeon.exceptions import ProbeError
class BaseDevice(object):
DEFAULT_PROBE_TIMEOUT = 10
def __init__(self, target, connector, **kwargs):
"""
:param target: hostname or ipaddr of target device
:param kwargs:
'user' : login user... | {
"content_hash": "fb1e5fd321d1e6d080e8a37e8ab11528",
"timestamp": "",
"source": "github",
"line_count": 67,
"max_line_length": 83,
"avg_line_length": 31.970149253731343,
"alnum_prop": 0.5410830999066293,
"repo_name": "Apstra/aeon-venos",
"id": "1a7a083f4f05afc170ccdd97077322306265aedc",
"size": "23... |
import logging
import typing
import discord
from asyncpg.exceptions import PostgresError
from discord.ext import commands
from discord.ext.commands import BucketType, has_permissions
from bot.bot import command, group, cooldown
from bot.converters import CommandConverter
from bot.formatter import Paginator
from bot.g... | {
"content_hash": "0dc6e8ef04735df5f57cf50521370ef2",
"timestamp": "",
"source": "github",
"line_count": 577,
"max_line_length": 156,
"avg_line_length": 43.114384748700175,
"alnum_prop": 0.5559352011898541,
"repo_name": "s0hvaperuna/Not-a-bot",
"id": "a70e28c64302610cace00ce56e7650854abe9aef",
"size... |
"""
This module implements unit tests for the item-based checks of the core layer. For now, only
checks done by L{SanityCheckTreeWalker<datafinder.core.item.visitor.checks.SanityCheckTreeWalker>}
are tested.
"""
import unittest
from datafinder.core.item.collection import ItemRoot, ItemCollection
from ... | {
"content_hash": "31c7ae27b2111a5c1486c3437b485ba3",
"timestamp": "",
"source": "github",
"line_count": 311,
"max_line_length": 125,
"avg_line_length": 46.19292604501608,
"alnum_prop": 0.6850897953501323,
"repo_name": "DLR-SC/DataFinder",
"id": "2e69743ac0846dba4056cf59b11e61bdd037fb7d",
"size": "1... |
"""
BunnyFunctions contains a set of high level functions to manipulate experiment objects.
"""
__license__ = "MIT"
from Experiment import *
from Participant import *
from mpl_toolkits.mplot3d import Axes3D
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.pylab as pylab
import sys
import time
de... | {
"content_hash": "ca724a6702aa737ffef4dff5f2c29c79",
"timestamp": "",
"source": "github",
"line_count": 405,
"max_line_length": 340,
"avg_line_length": 36.08888888888889,
"alnum_prop": 0.5938697318007663,
"repo_name": "julianje/Bunny",
"id": "2226d9ea7d82fe04c17250379e20dd049ac3fd0c",
"size": "1464... |
import time
from django.test import TestCase
from selenium import webdriver
from selenium.common.exceptions import TimeoutException
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from webdriver_manager.chrome imp... | {
"content_hash": "62fa54d22f0c047c1bda765b8b466df7",
"timestamp": "",
"source": "github",
"line_count": 92,
"max_line_length": 116,
"avg_line_length": 37.46739130434783,
"alnum_prop": 0.6483899042645779,
"repo_name": "otto-torino/django-baton",
"id": "d8ac6913871a1fadba57d5cb857b406941afe311",
"siz... |
"""\
=================
Pure Transformer component
=================
This component applies a function specified at its creation to messages
received (a filter). If the function returns None, no message is sent,
otherwise the result of the function is sent to "outbox".
Example Usage
-------------
To read in lines of ... | {
"content_hash": "82b890af57a0d3f99903dd56351a40ed",
"timestamp": "",
"source": "github",
"line_count": 57,
"max_line_length": 82,
"avg_line_length": 30.24561403508772,
"alnum_prop": 0.5968677494199536,
"repo_name": "sparkslabs/kamaelia_",
"id": "1f9e3512fade873fce34826a9ed3a75ddf62784f",
"size": "... |
"""Trigger entity."""
from __future__ import annotations
import logging
from typing import Any
from homeassistant.const import (
CONF_DEVICE_CLASS,
CONF_ICON,
CONF_NAME,
CONF_UNIQUE_ID,
CONF_UNIT_OF_MEASUREMENT,
)
from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers im... | {
"content_hash": "763e57615dbb1c7c0ef0497d13effe51",
"timestamp": "",
"source": "github",
"line_count": 163,
"max_line_length": 85,
"avg_line_length": 31.21472392638037,
"alnum_prop": 0.5837264150943396,
"repo_name": "aronsky/home-assistant",
"id": "c80620b045343e8608f99b5a0962cdea7897f692",
"size"... |
from typing import Union
from fastapi import Body, FastAPI
from pydantic import BaseModel
app = FastAPI()
class Item(BaseModel):
name: str
description: Union[str, None] = None
price: float
tax: Union[float, None] = None
@app.put("/items/{item_id}")
async def update_item(item_id: int, item: Item = ... | {
"content_hash": "1640d408b61491d7fb59c27c1d17ec4f",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 67,
"avg_line_length": 21.42105263157895,
"alnum_prop": 0.6732186732186732,
"repo_name": "tiangolo/fastapi",
"id": "29e6e14b7e306571b35c99237165e1e06df9df2d",
"size": "407"... |
import tensorflow as tf
import numpy as np
from tensorflow.examples.tutorials.mnist import mnist
from tensorflow.examples.tutorials.mnist import input_data
import cdbn_backup as cdbn
""" --------------------------------------------
------------------- DATA -------------------
---------------------------------... | {
"content_hash": "acf38f24d84c562ef507db676358a167",
"timestamp": "",
"source": "github",
"line_count": 124,
"max_line_length": 144,
"avg_line_length": 44.83064516129032,
"alnum_prop": 0.5634106853750674,
"repo_name": "arthurmeyer/Convolutional_Deep_Belief_Network",
"id": "de25ac275bf89e462e008733548... |
"""
Tests for L{twisted.python.log}.
"""
from __future__ import division, absolute_import, print_function
from twisted.python.compat import _PY3, NativeStringIO as StringIO
import os
import sys
import time
import logging
import warnings
import calendar
from io import IOBase
from imp import reload
from twisted.trial... | {
"content_hash": "a577858ec1cc7187dfe504d9b8a7e870",
"timestamp": "",
"source": "github",
"line_count": 1083,
"max_line_length": 79,
"avg_line_length": 33.47737765466297,
"alnum_prop": 0.6045895851721095,
"repo_name": "whitehorse-io/encarnia",
"id": "a66cc342de92c8f51333426e5d6cfabf6665e28e",
"size... |
from django.shortcuts import render
from django.views.generic import CreateView
from django.contrib import messages
from datetimewidget.widgets import DateTimeWidget
from .models import Appointment
class AppointmentCreateMixin(object):
fields = ('patient_name',
'patient_middlename',
... | {
"content_hash": "ff4f6c5ea4b8eb8db0cc9ccee33ab373",
"timestamp": "",
"source": "github",
"line_count": 68,
"max_line_length": 76,
"avg_line_length": 34.970588235294116,
"alnum_prop": 0.6021867115222876,
"repo_name": "thefivekey/django-doctor-appointment",
"id": "8013a49048f96dc22ab675d307f02a2fc054a... |
import time
from pokemongo_bot import logger
from pokemongo_bot.human_behaviour import (normalized_reticle_size, sleep,
spin_modifier)
class PokemonCatchWorker(object):
BAG_FULL = 'bag_full'
NO_POKEBALLS = 'no_pokeballs'
def __init__(self, pokemon, bot):
... | {
"content_hash": "5bd8b93dd51e06ee7d5a535d6d12d662",
"timestamp": "",
"source": "github",
"line_count": 333,
"max_line_length": 120,
"avg_line_length": 51.52252252252252,
"alnum_prop": 0.43270968117969344,
"repo_name": "codybaldwin/PokemonGo-Bot",
"id": "b2f57b503217f310b85e86710a470d38927b5d01",
"... |
import itertools
from typing import Union, Sequence, Optional
import numpy as np
_RealArraylike = Union[np.ndarray, float]
def _single_qubit_unitary(
theta: _RealArraylike, phi_d: _RealArraylike, phi_o: _RealArraylike
) -> np.ndarray:
"""Single qubit unitary matrix.
Args:
theta: cos(theta) is m... | {
"content_hash": "15bb489f888f3cb874fc8798142eccfa",
"timestamp": "",
"source": "github",
"line_count": 297,
"max_line_length": 96,
"avg_line_length": 35.48148148148148,
"alnum_prop": 0.6113114442968305,
"repo_name": "balopat/Cirq",
"id": "d4cd6904187816aadcf50036e362c017134280b4",
"size": "10540",... |
from mock import patch
from _common import unittest
from helper import TestHelper
from beets.library import Item
class KeyFinderTest(unittest.TestCase, TestHelper):
def setUp(self):
self.setup_beets()
self.load_plugins('keyfinder')
self.patcher = patch('beets.util.command_output')
... | {
"content_hash": "a8e25174fed162db0d6c873bfbe85a28",
"timestamp": "",
"source": "github",
"line_count": 68,
"max_line_length": 60,
"avg_line_length": 26.720588235294116,
"alnum_prop": 0.6037424325811778,
"repo_name": "bj-yinyan/beets",
"id": "5795002dcde42ddf04c705aec80d43ee7a4abc43",
"size": "2465... |
import collections
import sys
def main():
lines = [[int(x) for x in line.split()] for line in sys.stdin]
[n, m], a, b, c = lines
def one():
return 1
# http://codereview.stackexchange.com/questions/62956/performance-in-hackerrank-challenge-sherlock-and-queries
factors = collections.default... | {
"content_hash": "7a937c46ba8954d701558a3464479dd6",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 114,
"avg_line_length": 26.782608695652176,
"alnum_prop": 0.5941558441558441,
"repo_name": "Dobiasd/HackerRank-solutions",
"id": "21c90500200507d79457e62e5b041ea1ef143457",
... |
from mock import patch, Mock, sentinel
from nose.tools import raises
from tests import FlexGetBase
from flexget.task import Task
from flexget.plugins.output import notify_sns
class TestNotifySNS(object):
@patch('boto3.Session')
def test_emitter_build_session_from_empty_config(self, Session):
e = noti... | {
"content_hash": "7089ac10f5a0c184bdf372882a9df94c",
"timestamp": "",
"source": "github",
"line_count": 66,
"max_line_length": 93,
"avg_line_length": 36.515151515151516,
"alnum_prop": 0.6203319502074689,
"repo_name": "tsnoam/Flexget",
"id": "1bc26c3bc326b46c794040098f81302426bcac5f",
"size": "2410"... |
__author__ = 'pc'
#a small server
import socket
s = socket.socket()
host = s.getpeername
port = 1234
s.bind(host, sort)
s.listen(5)
while True:
c, addr = s.accept()
print 'Got connection from ', addr
c.send('Thank you for connecting')
c.close()
import socket
s = socket.socket()
host = socket.get... | {
"content_hash": "172cc90e4fadeaabfd250e51186b5517",
"timestamp": "",
"source": "github",
"line_count": 116,
"max_line_length": 72,
"avg_line_length": 20.74137931034483,
"alnum_prop": 0.587281795511222,
"repo_name": "hisuley/sxj",
"id": "508a34ae8d666a179e5fae8d3e8e2f3060fb9e28",
"size": "2406",
... |
"""
Created on Sat Aug 15 12:55:25 2015
@author: Ben
"""
# def write_IO(self):
# """write IO_table for all supply subsectors and solves for final demand"""
# #creates empty IO table with all subsectors
# IO_table = pd.DataFrame(0,index = self.subsectors.keys(),
# columns = self.subsectors.keys(),dtype=float)
# #write... | {
"content_hash": "9f622b9f4011fdfffe2777de32ec4de7",
"timestamp": "",
"source": "github",
"line_count": 175,
"max_line_length": 208,
"avg_line_length": 65.31428571428572,
"alnum_prop": 0.5349956255468067,
"repo_name": "energyPATHWAYS/energyPATHWAYS",
"id": "5f5ee8fef7c09dd86b5ac52178fb528835cdb572",
... |
class ValidationError(Exception):
def __init__(self, message=None):
self.message = message
| {
"content_hash": "94c190371316c9f742d3ad4a14fd36c7",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 35,
"avg_line_length": 32.333333333333336,
"alnum_prop": 0.711340206185567,
"repo_name": "sanjuro/RCJK",
"id": "02507c5a2c990c3132cb57beda0008e9b39a105c",
"size": "109",
"... |
import os
import shutil
import tempfile
import fiona
from . import fiona_dataset
from utils import get_compressed_file_wrapper
def read(
fp, prop_map, filterer=None, source_filename=None, layer_name=None, merge_on=None
):
"""Read geojson file.
:param fp: file-like object
:param prop_map: dictionary... | {
"content_hash": "9809d3860ab1db6216ac0a2c4c35508e",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 85,
"avg_line_length": 29.945454545454545,
"alnum_prop": 0.6211293260473588,
"repo_name": "OpenBounds/Processing",
"id": "2a0c7c8abc8462b1b4e8c1ca12e0187eab5fa082",
"size":... |
from gevent import monkey; monkey.patch_all()
import web
import os
from cerebro_model import CerebroModel
from experiment_runner import SimulationDataElement
import json
import pprint
import pymongo
from experiment_db import ExperimentDB
USE_MONGO = True
urls = (
r'^/$', 'index',
r'^/anomaly$','anomaly',
r'^/a... | {
"content_hash": "b90346bf5ed511c4441ccbec57d56cff",
"timestamp": "",
"source": "github",
"line_count": 216,
"max_line_length": 80,
"avg_line_length": 27.50462962962963,
"alnum_prop": 0.6887729338495203,
"repo_name": "numenta/nupic.cerebro",
"id": "ba5eb72f0140ad57f506b0b24567fb3bf51e8855",
"size":... |
"""
Pyfranca lexer tests.
"""
import unittest
from pyfranca import Lexer
class BaseTestCase(unittest.TestCase):
@staticmethod
def _tokenize(data):
lexer = Lexer()
tokenized_data = lexer.tokenize_data(data)
return tokenized_data
class TestCheckRegularExpressions(BaseTestCase):
... | {
"content_hash": "2aaf424c1d443a6e5f15eba9bf572a20",
"timestamp": "",
"source": "github",
"line_count": 303,
"max_line_length": 103,
"avg_line_length": 44.71617161716171,
"alnum_prop": 0.5977562919772677,
"repo_name": "zayfod/pyfranca",
"id": "633895f6be3b4ecc8f55c5aea28b6e6dfaa22dec",
"size": "135... |
from S3 import S3 # NOQA
def config(parser):
parser.add_argument("--upload.s3.region", dest="upload.s3.region", default="us-east-1", type=str,
help="S3 Uploader AWS region to connect to (default: us-east-1)")
parser.add_argument("--upload.s3.access_key", dest="upload.s3.access_key", t... | {
"content_hash": "11f8c4a514b11bd02c9b635b5995415e",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 118,
"avg_line_length": 78.96551724137932,
"alnum_prop": 0.6283842794759825,
"repo_name": "Percona-Lab/mongodb_consistent_backup",
"id": "3c7b1d5fdb6908d1ec334d2358b22fe62520... |
import os
import string
import textwrap
import six
from six.moves.configparser import ConfigParser
from swift.common.utils import (
config_true_value, SWIFT_CONF_FILE, whataremyips, list_from_csv)
from swift.common.ring import Ring, RingData
from swift.common.utils import quorum_size
from swift.common.exceptions im... | {
"content_hash": "49db54a8ac8a8fa1647a646ef1c15554",
"timestamp": "",
"source": "github",
"line_count": 873,
"max_line_length": 79,
"avg_line_length": 37.29896907216495,
"alnum_prop": 0.5927154351698298,
"repo_name": "prashanthpai/swift",
"id": "0714e51dab7d3947621c36d57445df9342914573",
"size": "3... |
"""unit testing code for the SD file handling stuff
"""
import unittest,sys,os
from rdkit import RDConfig
from rdkit import Chem
import tempfile
from cStringIO import StringIO
class TestCase(unittest.TestCase):
def setUp(self):
#print '\n%s: '%self.shortDescription(),
self.fName = os.path.join(RDConfig.RDDa... | {
"content_hash": "3c783d922fc008b58f161644548c44bb",
"timestamp": "",
"source": "github",
"line_count": 157,
"max_line_length": 77,
"avg_line_length": 25.29299363057325,
"alnum_prop": 0.5948123898262403,
"repo_name": "rdkit/rdkit-orig",
"id": "47c835364d2801d7b31109af323bd04df58cc4db",
"size": "427... |
from typing import Any, List, Optional
import tensorflow as tf
import numpy as np
from yarll.memory.experiences_memory import ExperiencesMemory, Experience
from yarll.misc.utils import RunningMeanStd, normalize
class EnvRunner(object):
"""Environment runner using a policy"""
def __init__(self, env, policy, co... | {
"content_hash": "2512833a4d65e0a63177a1565d7f9d5b",
"timestamp": "",
"source": "github",
"line_count": 119,
"max_line_length": 139,
"avg_line_length": 48.470588235294116,
"alnum_prop": 0.5884188626907073,
"repo_name": "arnomoonens/DeepRL",
"id": "26fb6f94dd9b37fb726b114fa26915c4c1a3b29f",
"size": ... |
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('api', '0049_account_accept_friend_requests'),
]
operations = [
migrations.RemoveField(
model_name='userpreferences',
name='a... | {
"content_hash": "982671db2fe0b20d2c906a269b67f549",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 55,
"avg_line_length": 21.235294117647058,
"alnum_prop": 0.6177285318559557,
"repo_name": "dburr/SchoolIdolAPI",
"id": "d878df559b888c8d87891787e98411688aedadf0",
"size": "... |
"""
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this ... | {
"content_hash": "b9385c3af97fb5a60b0cbabd3b60b6f3",
"timestamp": "",
"source": "github",
"line_count": 518,
"max_line_length": 780,
"avg_line_length": 47.87644787644788,
"alnum_prop": 0.5668951612903226,
"repo_name": "pluradj/incubator-tinkerpop",
"id": "66c5ad1a98fd7e776d7e2c280438e2887286568a",
... |
"""
django_localflavot_pt.forms
~~~~~~~~~~~~~~~~~~~~~~~~~~~
Contains PT-specific Django form helpers.
"""
from __future__ import unicode_literals
from .pt_regions import REGION_CHOICES
from django.core.validators import EMPTY_VALUES
from django.forms import ValidationError
from django.forms.fields import Field, Regex... | {
"content_hash": "f78b2ccdffa93aaf4daf79778c363c4b",
"timestamp": "",
"source": "github",
"line_count": 156,
"max_line_length": 148,
"avg_line_length": 35.8525641025641,
"alnum_prop": 0.6551045950295011,
"repo_name": "M157q/django-localflavor",
"id": "75c900540a3b594e05ac4bf7669a7924ca21b52d",
"siz... |
import logging
import json
import ast
from webob import Response
from ryu.base import app_manager
from ryu.controller import ofp_event
from ryu.controller import dpset
from ryu.controller.handler import MAIN_DISPATCHER
from ryu.controller.handler import set_ev_cls
from ryu.ofproto import ofproto_v1_0
from ryu.ofproto... | {
"content_hash": "e4ff6e9360da4273d33f2ba8fc0a282c",
"timestamp": "",
"source": "github",
"line_count": 718,
"max_line_length": 79,
"avg_line_length": 36.128133704735376,
"alnum_prop": 0.5888974556669236,
"repo_name": "StephenKing/summerschool-2015-ryu",
"id": "38301ca585f169f41f909d5eff42a45b6f79f8a... |
from requests.auth import HTTPDigestAuth
from requests.utils import dict_from_cookiejar
from log import LOG
from sys import stdout
from hashlib import sha1
from re import findall
import hmac
import utility
import state
default_credentials = [("admin", "admin")]
def _salt(url):
""" ColdFusion requires a salt that ... | {
"content_hash": "d7d2bf872faac9a3cf86a72871a06b92",
"timestamp": "",
"source": "github",
"line_count": 115,
"max_line_length": 92,
"avg_line_length": 32.504347826086956,
"alnum_prop": 0.5417335473515249,
"repo_name": "jorik041/clusterd",
"id": "5f72a844c762fbbef3a0d2e69e8e09f86eb4cbbe",
"size": "3... |
"""Configuration.from_yaml() with environment variables interpolation tests."""
import os
import yaml
from pytest import mark, raises
def test_env_variable_interpolation(config, yaml_config_file_3):
config.from_yaml(yaml_config_file_3)
assert config() == {
"section1": {
"value1": "test-... | {
"content_hash": "84704f38bde5835b33497b7bdc1e1bbb",
"timestamp": "",
"source": "github",
"line_count": 185,
"max_line_length": 95,
"avg_line_length": 31.57837837837838,
"alnum_prop": 0.6129750085587128,
"repo_name": "ets-labs/python-dependency-injector",
"id": "8e6e1c0dc54517cad8c1d0167f8aa3714941dd... |
from __future__ import absolute_import, division, print_function
import datetime
import logging
import os
import pprint
import numpy as np
import tensorflow as tf
from sklearn import metrics
from tensorflow.python.saved_model import (
signature_constants, signature_def_utils, tag_constants, utils)
import sparse_m... | {
"content_hash": "e742770bb83c21a851e58c7f66ca667f",
"timestamp": "",
"source": "github",
"line_count": 508,
"max_line_length": 129,
"avg_line_length": 39.303149606299215,
"alnum_prop": 0.6328258038665732,
"repo_name": "tobegit3hub/deep_recommend_system",
"id": "430e2e298aef472a5b561758bd3fb48aba47b1... |
from random import randint
''' Returns a prime greater than n '''
def nextPrime(n):
assert n > 0
n += 1
while isPrime(n) != True:
n += 1
return n
''' Returns True if n is prime False otherwise'''
def isPrime(n):
if n == 2 :
return True
if n % 2 == 0 :
return False
i... | {
"content_hash": "b78658a92a869eb8caab9faa2c30640d",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 49,
"avg_line_length": 20.74074074074074,
"alnum_prop": 0.5410714285714285,
"repo_name": "2020saurav/DGA",
"id": "5e099d9e34b7b7c08bb5b6914b5fabcb0df855db",
"size": "560",
... |
"""Command line interface for testing commands."""
| {
"content_hash": "447f783c9d402bd424d909c05f650957",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 50,
"avg_line_length": 51,
"alnum_prop": 0.7450980392156863,
"repo_name": "nstoik/farm_monitor",
"id": "7639c88d3afafc3a83f80f23aab4e3988234c77e",
"size": "75",
"binary": ... |
from sqlalchemy import create_engine, and_
from datetime import datetime
import numpy as np
from models import (ActionMixin, UserMixin, ItemMixin, ComputationMixin,
COMPUTATION_SK_NAME,
ACTION_UPVOTE, ACTION_DOWNVOTE,
ACTION_FLAG_SPAM, ACTION_FLAG_HAM)
impor... | {
"content_hash": "13514822c307c0a7a68ea05eca6d564c",
"timestamp": "",
"source": "github",
"line_count": 236,
"max_line_length": 85,
"avg_line_length": 34.855932203389834,
"alnum_prop": 0.6511062484804279,
"repo_name": "mshavlovsky/mannord",
"id": "c35dff992a67fc858758c81ba0aedfbd94e8636a",
"size": ... |
"""Part of the Keras training engine related to distributed training.
"""
# pylint: disable=protected-access
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
from tensorflow.python.distribute import distribute_coordinator as dc
from tensor... | {
"content_hash": "300165c2bbf21be9ce7299483707babd",
"timestamp": "",
"source": "github",
"line_count": 784,
"max_line_length": 88,
"avg_line_length": 37.25765306122449,
"alnum_prop": 0.6483738445737761,
"repo_name": "aldian/tensorflow",
"id": "b33a90bd5330d336bdf2d500d43f3c8a6e4faaee",
"size": "29... |
import pprint, socket
from pysandesh.sandesh_base import *
from pysandesh.connection_info import ConnectionState
from gen_py.broadview.ttypes import \
PRouterBroadViewInfo, \
Device, \
IngressPortPriorityGroup, \
IngressPortServicePool, \
IngressServicePool, \
Egres... | {
"content_hash": "56cf0789c1db55fcc2422f09b3b20880",
"timestamp": "",
"source": "github",
"line_count": 92,
"max_line_length": 70,
"avg_line_length": 37.65217391304348,
"alnum_prop": 0.5363741339491916,
"repo_name": "codilime/contrail-controller",
"id": "29ab99ed7ea7fc890c4886a5ef1275ffbe251db8",
"... |
"""Testing decorators module."""
from numpy.testing import assert_raises, assert_equal
from dipy.testing import assert_true
from dipy.testing.decorators import doctest_skip_parser
def test_skipper():
def f():
pass
docstring = \
""" Header
>>> something # skip if not HAVE_AMODULE
... | {
"content_hash": "2525d3500e4cc2e51a34ddab87946744",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 55,
"avg_line_length": 25.270833333333332,
"alnum_prop": 0.5539983511953833,
"repo_name": "FrancoisRheaultUS/dipy",
"id": "3b5747b9c35a0a49b238139b490344ba6d5ac3b7",
"size"... |
from RGT.XML.SVG.Filters.baseFilterNode import BaseFilterNode
from types import StringType
from RGT.XML.SVG.basicSvgNode import BasicSvgNode
class FeColorMatrixNode(BaseFilterNode):
svgNodeType = BasicSvgNode.SVG_FE_COLOR_MATRIX_NODE
ATTRIBUTE_IN = 'in'
ATTRIBUTE_TYPE = 'type'
ATTRIBUTE_VAL... | {
"content_hash": "bd9dba515e1cf8934bbff9d50133284a",
"timestamp": "",
"source": "github",
"line_count": 61,
"max_line_length": 85,
"avg_line_length": 33.83606557377049,
"alnum_prop": 0.5794573643410853,
"repo_name": "danrg/RGT-tool",
"id": "85f5501d63798e49ec948d79fa9d95591fd9f4dd",
"size": "2064",... |
from os import path
from codecs import open
from setuptools import setup, find_packages
HERE = path.abspath(path.dirname(__file__))
with open(path.join(HERE, 'README.rst'), encoding = 'utf-8') as readme_file:
readme = readme_file.read()
with open(path.join(HERE, 'LICENSE'), encoding = 'utf-8') as license_file:
... | {
"content_hash": "03fd5632e487c8be1f5ce891af1100d4",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 76,
"avg_line_length": 31.375,
"alnum_prop": 0.646746347941567,
"repo_name": "uetoyo/specific.py",
"id": "87252c8076137f81494f0547b2727cbb755de6fe",
"size": "800",
"binar... |
from .auto_rest_swagger_bat_array_service import AutoRestSwaggerBATArrayService, AutoRestSwaggerBATArrayServiceConfiguration
from .version import VERSION
__all__ = [
'AutoRestSwaggerBATArrayService',
'AutoRestSwaggerBATArrayServiceConfiguration'
]
__version__ = VERSION
| {
"content_hash": "dbee5f28e33c386cb27fd04d3edd1b2a",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 124,
"avg_line_length": 28.1,
"alnum_prop": 0.8078291814946619,
"repo_name": "csmengwan/autorest",
"id": "aaf980709effe10b78ae5ecf6f835620d55a1a12",
"size": "755",
"binar... |
"""
Copyright 2003-2010 Cort Stratton. All rights reserved.
Copyright 2015, 2016 Hanson Robotics
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
1. Redistributions of source code must retain the above copyright
notice, ... | {
"content_hash": "d9b097b2eda777ff165ebbe43bf66f10",
"timestamp": "",
"source": "github",
"line_count": 68,
"max_line_length": 71,
"avg_line_length": 34.88235294117647,
"alnum_prop": 0.6732715008431703,
"repo_name": "hansonrobotics/chatbot",
"id": "7942d715dc06e7e47e52d8966b8c73f0a458082f",
"size":... |
"""Tests for the Home Assistant Websocket API."""
import asyncio
from unittest.mock import patch
from aiohttp import WSMsgType
from async_timeout import timeout
import pytest
from homeassistant.core import callback
from homeassistant.components import websocket_api as wapi, frontend
from tests.common import mock_htt... | {
"content_hash": "68a0d3b54b9b6e3c6ceaa559fdc571a2",
"timestamp": "",
"source": "github",
"line_count": 303,
"max_line_length": 77,
"avg_line_length": 27.85148514851485,
"alnum_prop": 0.6429671762057115,
"repo_name": "kyvinh/home-assistant",
"id": "3cdc77414eeda5d04acb7a7edd70fdeb560c80db",
"size":... |
from unittest import TestCase, skip
from IPython import embed
from qlknn.plots.load_data import *
| {
"content_hash": "89c155450c5a40e83fab7679c358106e",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 35,
"avg_line_length": 24.75,
"alnum_prop": 0.8080808080808081,
"repo_name": "Karel-van-de-Plassche/QLKNN-develop",
"id": "c5f7383c263ce014a8e5d4770b99763005950aeb",
"size":... |
def get_available_ip_by_domain(domain):
"""
:param domain: The domain to choose from
:type domain: class:`Domain`
:param system: The system the interface belongs to
:returns: ip_address
This function looks at `domain.name` and strips off 'mozilla.com' (yes it
needs to be `<something>.mozill... | {
"content_hash": "37bb5053575c56832105dbd30b069d07",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 78,
"avg_line_length": 45.5,
"alnum_prop": 0.7048665620094191,
"repo_name": "rtucker-mozilla/mozilla_inventory",
"id": "148ad1435cfa9d5bc05327f63764b234e27daa96",
"size": "... |
from __future__ import print_function
import argparse
import hashlib
import os
import subprocess
import sys
from binstar_client.utils import get_binstar
import binstar_client.errors
import conda.config
from conda_build.metadata import MetaData
from conda_build.build import bldpkg_path
def built_distribution_already... | {
"content_hash": "3165c15ddfaec346f42a1ce7460bd290",
"timestamp": "",
"source": "github",
"line_count": 123,
"max_line_length": 96,
"avg_line_length": 40.26829268292683,
"alnum_prop": 0.6188168786593984,
"repo_name": "willyd/conda-recipes",
"id": "681f144d4434a30e22986b083d2485f8b37f820b",
"size": ... |
"""Lexer has one of the main Curly's functions, :py:func:`tokenize`.
The main idea of lexing is to split raw text into structured list of
well known and defined parts, called *tokens*. Each token has a class
and some contents (let's say, from ``{% if something %}`` we can get
following contents for :py:class:`StartBlo... | {
"content_hash": "9eaa5fdc7a45df5c218e016b4e892ecd",
"timestamp": "",
"source": "github",
"line_count": 302,
"max_line_length": 75,
"avg_line_length": 33.288079470198674,
"alnum_prop": 0.6272754401671143,
"repo_name": "9seconds/curly",
"id": "a66d6f843833526b4f329a7b845e5cf79145fce1",
"size": "1007... |
"""
the default serializer for the plugin.
it uses json to do the actual work.
"""
import json
def json_serialize(value):
return json.dumps(value)
def json_deserialize(s):
return json.loads(s)
| {
"content_hash": "7c40074a08e81972010b3751c19ad045",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 38,
"avg_line_length": 13.8,
"alnum_prop": 0.7004830917874396,
"repo_name": "amdorra/django-kvmodel",
"id": "4979a1105eb5a665819f9570c2ba84f0221ceb69",
"size": "207",
"bi... |
'''
'''
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License");... | {
"content_hash": "c8792982ded100f5b13bfc2054e4d309",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 113,
"avg_line_length": 36.24444444444445,
"alnum_prop": 0.7400367872470877,
"repo_name": "pbchou/trafficserver",
"id": "16d746a97a584cf21f8b448e76ec28f33e576d22",
"size": ... |
"""
Component management module for lpm
A component definition consists of (at least):
- an ID (part number)
- a descriptive name
- a description
- a category
- a list of suppliers
- a list of manufacturers
- a list of revisions consisting of:
- a description
- a list of files
- a 'released' flag
- an 'obsolet... | {
"content_hash": "43ee6882f4655ee0beae61d4ec200b11",
"timestamp": "",
"source": "github",
"line_count": 639,
"max_line_length": 120,
"avg_line_length": 35.38810641627543,
"alnum_prop": 0.6109759872639632,
"repo_name": "h-friederich/lpm",
"id": "3679b46fea57dfe53ba9afd81109c0271f1c4737",
"size": "22... |
import httplib # basic HTTP library for HTTPS connections
import logging
from quantum.plugins.nicira.nicira_nvp_plugin.api_client.client_eventlet \
import NvpApiClientEventlet
from quantum.plugins.nicira.nicira_nvp_plugin.api_client.request_eventlet \
import NvpGenericRequestEventlet
LOG = logging.getLogge... | {
"content_hash": "d9f7bb4390d523e298d53f3d1598163a",
"timestamp": "",
"source": "github",
"line_count": 194,
"max_line_length": 78,
"avg_line_length": 33.71134020618557,
"alnum_prop": 0.6443425076452599,
"repo_name": "savi-dev/quantum",
"id": "dd1387e6cd0fbe0004fc85ce4b9ecfc16e6e568f",
"size": "720... |
try:
from builtins import object
except ImportError:
pass
import sys
from .utils import InheritedStuff
from .utils import Stuff, DummyModel
from functools import partial
from transitions import Machine, MachineError, State, EventData
from transitions.core import listify, _prep_ordered_arg
from unittest impor... | {
"content_hash": "2d542b1ee7d8e650eaed591cf6f1ecd6",
"timestamp": "",
"source": "github",
"line_count": 1285,
"max_line_length": 113,
"avg_line_length": 36.4443579766537,
"alnum_prop": 0.5554013367214025,
"repo_name": "tyarkoni/transitions",
"id": "0048fdb7f14476ce0851851db6aaa2337ab498bb",
"size":... |
import os
import logging
import structlog
import json
LOG_DEFAULT_LEVEL = 'info'
def log_factory(handler, level, namespace):
""" Opinionated logger factory. """
logger = logging.getLogger(namespace)
logger.setLevel(level)
if not logger.handlers:
logger.addHandler(handler)
return structl... | {
"content_hash": "4a58dd4d77a83a01bb1b9a1714c03cf6",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 84,
"avg_line_length": 28.15625,
"alnum_prop": 0.658157602663707,
"repo_name": "axelbellec/BoTigo",
"id": "32cb195e312ca178a022e4f628a601b295312d74",
"size": "901",
"bina... |
import argparse
from mock import patch
from ..orchestra import cluster
from .. import misc
from ..config import config
import pytest
class FakeRemote(object):
pass
def test_get_clients_simple():
ctx = argparse.Namespace()
remote = FakeRemote()
ctx.cluster = cluster.Cluster(
remotes=[
... | {
"content_hash": "1be90c943a3a70e36deb64de398b2d0f",
"timestamp": "",
"source": "github",
"line_count": 169,
"max_line_length": 131,
"avg_line_length": 31.976331360946745,
"alnum_prop": 0.6034418948926721,
"repo_name": "michaelsevilla/teuthology",
"id": "c3da5dbc10163334b7f06f784c89427eed8908e1",
"... |
from itertools import count
from math import sqrt
from collections import Counter
puz_input = 33100000
factor_count = Counter()
def get_factors(n):
global factor_count
def check_count(factor, flist):
if factor_count[factor] > 50:
pass
else:
factor_count[factor] += 1
... | {
"content_hash": "abfa598c44a99ef14a3619077a8cd084",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 50,
"avg_line_length": 22.34375,
"alnum_prop": 0.5412587412587413,
"repo_name": "pwicks86/adventofcode2015",
"id": "96b4eaeab2bf3cdfc3ba994c9611f77b51f45475",
"size": "715"... |
class ModuleDocFragment(object):
# Standard files documentation fragment
DOCUMENTATION = r'''
options:
url:
description:
- HTTP, HTTPS, or FTP URL in the form (http|https|ftp)://[user[:pass]]@host.domain[:port]/path
type: str
force:
description:
- If C(yes) do not get a cached copy.... | {
"content_hash": "e2aed6df859f819aebc86f0b43876697",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 113,
"avg_line_length": 35.63793103448276,
"alnum_prop": 0.6840832123850992,
"repo_name": "thaim/ansible",
"id": "d6fdcc384d005c9fe7a7d451d37d544a389c4e4f",
"size": "2244",... |
class Solution(object):
def lengthOfLongestSubstring(self, s):
"""
:type s: str
:rtype: int
"""
ret_len = 0
counter = dict()
left, right = 0, 0
while True:
while right < len(s):
counter[s[right]] = counter.get(s[right], 0) +... | {
"content_hash": "e31978c0d15ff1ae8b892815d4b90d48",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 64,
"avg_line_length": 31.642857142857142,
"alnum_prop": 0.47404063205417607,
"repo_name": "knuu/competitive-programming",
"id": "47eed66f6a516304156d62344473507ee03c971b",
... |
"""
Run Regression Test Suite
This module calls down into individual test cases via subprocess. It will
forward all unrecognized arguments onto the individual test scripts, other
than:
- `-extended`: run the "extended" test suite in addition to the basic one.
- `-win`: signal that this is running in a Windows... | {
"content_hash": "ccf1138a93e26877262e62bfb873a712",
"timestamp": "",
"source": "github",
"line_count": 250,
"max_line_length": 91,
"avg_line_length": 29.908,
"alnum_prop": 0.5994382773839775,
"repo_name": "thetimpotter/bitcoin_1.0",
"id": "df71e44b6037d9d2df2d4b621c1ed82894a5cd21",
"size": "7687",... |
from django.core.urlresolvers import reverse
from django.forms.models import modelformset_factory, modelform_factory
from django.http import HttpResponse
from django.shortcuts import redirect
from django.template import loader
from django_ajax.decorators import ajax
from corporate.auxiliary_scripts import update_resume... | {
"content_hash": "06f13ec45256c255a90f281bd0254333",
"timestamp": "",
"source": "github",
"line_count": 387,
"max_line_length": 128,
"avg_line_length": 44.622739018087856,
"alnum_prop": 0.6424228386125427,
"repo_name": "tbpmig/mig-website",
"id": "a869d158baeed4559d320fae1876fffb354d3225",
"size": ... |
"""
Benchmark for SGD regression
Compares SGD regression against coordinate descent and Ridge
on synthetik data.
"""
print __doc__
# Author: Peter Prettenhofer <peter.prettenhofer@gmail.com>
# License: BSD Style.
import numpy as np
import pylab as pl
import gc
from time import time
from sklearn.linear_model impo... | {
"content_hash": "fb09dcc5698a385837c090700f331784",
"timestamp": "",
"source": "github",
"line_count": 130,
"max_line_length": 76,
"avg_line_length": 34.646153846153844,
"alnum_prop": 0.511101243339254,
"repo_name": "sgenoud/scikit-learn",
"id": "e07bd0add590b7fac6b6e594640542eb505629d5",
"size": ... |
from survey.error import ValidationError
from survey.models import SurveyResponse
from validate_email import validate_email
BOOLEAN = (True, False)
GENDERS = ("male", "female")
COLORS = (
"red",
"blue",
"green",
"brown",
"black",
"white",
"orange",
"pink",
"yellow",
"purple")
... | {
"content_hash": "15b68cb3dc39ec928b3aa726839e131f",
"timestamp": "",
"source": "github",
"line_count": 135,
"max_line_length": 78,
"avg_line_length": 27.51851851851852,
"alnum_prop": 0.6506056527590848,
"repo_name": "jllivermont/hotjar-task",
"id": "1f93f7ae5f0cd3e41962af217b8e8b20815c24c2",
"size... |
import fixtures
import mock
import os
from testtools.matchers import HasLength
from ironic.common import disk_partitioner
from ironic.common import exception
from ironic.common import utils
from ironic.tests import base
class DiskPartitionerTestCase(base.TestCase):
def setUp(self):
super(DiskPartitioner... | {
"content_hash": "77821b993b80f361ce92d2ff76cc3122",
"timestamp": "",
"source": "github",
"line_count": 186,
"max_line_length": 79,
"avg_line_length": 43.47849462365591,
"alnum_prop": 0.5119327315444541,
"repo_name": "faizan-barmawer/openstack_ironic",
"id": "494510f0310cfc3bb8469bd8473b9a9af2894c41"... |
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Changing field 'Photo.height'
db.alter_column('vkontakte_photos_photo', 'height', self.gf('django.db.models.fields.PositiveIntege... | {
"content_hash": "1f2c51fc42b20013a792f819e31dbbc5",
"timestamp": "",
"source": "github",
"line_count": 136,
"max_line_length": 165,
"avg_line_length": 78.79411764705883,
"alnum_prop": 0.5617767823814857,
"repo_name": "ramusus/django-vkontakte-photos",
"id": "19c1baa66532ac94ccd15a145025afe34da235a7"... |
import wx
from cairis.core.armid import *
import WidgetFactory
from EnvironmentPropertiesPanel import EnvironmentPropertiesPanel
from ValueTensionsGrid import ValueTensionsGrid
__author__ = 'Shamal Faily'
class SummaryPage(wx.Panel):
def __init__(self,parent):
wx.Panel.__init__(self,parent,GOAL_PANELSUMMARY_ID)... | {
"content_hash": "d45f02ad7bee1cd2bac055d10e8f4b9f",
"timestamp": "",
"source": "github",
"line_count": 70,
"max_line_length": 188,
"avg_line_length": 39.857142857142854,
"alnum_prop": 0.7351254480286739,
"repo_name": "nathanbjenx/cairis",
"id": "6b14704517b36f0560e56e73770d9478f8598aeb",
"size": "... |
"""
Check formatting for Swift.Array<T> that are bridged from ObjC
"""
import lldb
from lldbsuite.test.lldbtest import *
from lldbsuite.test.decorators import *
import lldbsuite.test.lldbutil as lldbutil
import os
import unittest2
class TestSwiftBridgedArray(TestBase):
mydir = TestBase.compute_mydir(__file__)
... | {
"content_hash": "462d1cd842d1abdf94d845c5882dfdd7",
"timestamp": "",
"source": "github",
"line_count": 66,
"max_line_length": 109,
"avg_line_length": 32.515151515151516,
"alnum_prop": 0.6397949673811743,
"repo_name": "apple/swift-lldb",
"id": "15d35c2a863b683ef962f4894574d2c584f9ab36",
"size": "26... |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('users', '0038_auto_20180815_0108'),
]
operations = [
migrations.AddField(
model_name='userprofile',
name='auth0_user_id',
... | {
"content_hash": "53cdb9552ab23ed4e221d072c1ea5a58",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 77,
"avg_line_length": 22.944444444444443,
"alnum_prop": 0.6004842615012107,
"repo_name": "akatsoulas/mozillians",
"id": "f446b302a04e2ed79e7cfb5882a57272e28815bf",
"size":... |
from django.db.models import Count
from committees.models import Committee, CommitteeMeeting
from plenum import create_protocol_parts
import logging
def Parse(reparse, logger, meeting_pks=None):
logger.debug('Parse (reparse=%s, meeting_pks=%s)'%(reparse, meeting_pks))
if meeting_pks is not None:
meetin... | {
"content_hash": "3f13aa4cb1cb9380057c835982d3fef8",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 92,
"avg_line_length": 46.43478260869565,
"alnum_prop": 0.7172284644194756,
"repo_name": "navotsil/Open-Knesset",
"id": "5b950ea46a1edbc35c410fd69cd2290b546602d3",
"size": ... |
from __future__ import print_function
import argparse
import json
import os
import sys
def merge_shard_results(summary_json, jsons_to_merge):
"""Reads JSON test output from all shards and combines them into one.
Returns dict with merged test output on success or None on failure. Emits
annotations.
"""
try... | {
"content_hash": "4805a43ddd132b425acff15443d22d75",
"timestamp": "",
"source": "github",
"line_count": 167,
"max_line_length": 80,
"avg_line_length": 35.053892215568865,
"alnum_prop": 0.641270925862658,
"repo_name": "youtube/cobalt",
"id": "58a29366c4f2814791a5867716d4e424061610f4",
"size": "6042"... |
import apihelper
import time
from mock import patch
import unittest
import os
import sys
sys.path.append("..")
if __name__ == "__main__":
sys.path.append("/opt/xos")
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "xos.settings")
def side_effect_bad_password(*args, **kwargs):
raise Exception()
class ... | {
"content_hash": "9e3a619bc8c2b4d836caa111ad6aee8d",
"timestamp": "",
"source": "github",
"line_count": 120,
"max_line_length": 86,
"avg_line_length": 30.375,
"alnum_prop": 0.5887517146776406,
"repo_name": "open-cloud/xos",
"id": "89b343c0aa4c2ad6f20dac748c5324fc616e7dc0",
"size": "4434",
"binary... |
import pytest
import tpfd
import logging
logging.basicConfig(level=logging.DEBUG)
logging.debug('test')
p = tpfd.Parser()
p.debug = False
PARSE_LIST_RESULTS = []
FIND_LIST_RESULTS = []
FILE_RESULTS = []
@p.on_parse('{Animal} are cool')
def main(animal):
return animal
@p.on_parse('List... | {
"content_hash": "f3b7bed04c44190ca7597ad80c72b2e6",
"timestamp": "",
"source": "github",
"line_count": 103,
"max_line_length": 111,
"avg_line_length": 19.95145631067961,
"alnum_prop": 0.5970802919708029,
"repo_name": "erinxocon/tpfd",
"id": "3a92c38ea1bf8dfed8cd2b4e333c5a83cf008d01",
"size": "2090... |
from zope.interface import implements
from twisted.python import usage
from twisted.plugin import IPlugin
from twisted.application.service import IServiceMaker
from vumidash.graphite_client import GraphiteClient
from vumidash.dummy_client import DummyClient
from vumidash.gecko_server import GeckoServer
class Option... | {
"content_hash": "1b929e7b6f688d26673d218da7429bdb",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 79,
"avg_line_length": 30.511627906976745,
"alnum_prop": 0.680640243902439,
"repo_name": "praekelt/vumi-dashboard",
"id": "d6b6ca1325b3da1fe3c66a5494d38b567b79d0a7",
"size"... |
"""
Utilities for pretty-printing data[types].
"""
__all__ = ('pretty_date', 'plural', 'trim', 'fix_link')
import re
import sys
from datetime import datetime
def pretty_date(time=False):
"""
Get a datetime object or a int() Epoch timestamp and return a
pretty string like 'an hour ago', 'Yesterday', '3 mon... | {
"content_hash": "297a60e0cd8944ed130d13bd239094f5",
"timestamp": "",
"source": "github",
"line_count": 85,
"max_line_length": 67,
"avg_line_length": 29.094117647058823,
"alnum_prop": 0.5818843509906996,
"repo_name": "notifico/notifico",
"id": "47fd7bb9ff8b1e98f9b3059708682aca3790a5ed",
"size": "24... |
from django.contrib.auth.backends import ModelBackend
class AuthenticationBackend(ModelBackend):
"""
Permissions that do not receive an object:
* formly.view_survey_list
* formly.create_survey
Permissions that receive a survey object:
* formly.view_survey_detail
* formly.change_... | {
"content_hash": "1089c91ec021890a31eee297e63ce659",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 70,
"avg_line_length": 31.357142857142858,
"alnum_prop": 0.5808656036446469,
"repo_name": "eldarion/formly",
"id": "934c7dcd6b0ff066bfabc5eaf62b3b586de3ef3b",
"size": "1756... |
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('wooey', '0044_change_script_parameter_choices_to_text'),
]
opera... | {
"content_hash": "29b0510c582add23f54e167dc5789133",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 178,
"avg_line_length": 38.166666666666664,
"alnum_prop": 0.665938864628821,
"repo_name": "wooey/Wooey",
"id": "7c0d6ecdb885136158e0b29b12bfd44af816bae0",
"size": "966",
... |
from __future__ import print_function
import os
import abc
import shelve
from pprint import pprint
from cloudmesh_base.tables import dict_printer
from cloudmesh_base.Shell import Shell
from cloudmesh_base.util import banner
from cloudmesh_base.util import path_expand
from cloudmesh_pbs.OpenPBS import OpenPBS
class... | {
"content_hash": "6ce7eebfb5b2d6abbd603d24c8c8df85",
"timestamp": "",
"source": "github",
"line_count": 188,
"max_line_length": 96,
"avg_line_length": 25.154255319148938,
"alnum_prop": 0.5601607105096215,
"repo_name": "rajpushkar83/pbs",
"id": "eb0f2f6d25732d291bf475135b2e4ef9a847e4a7",
"size": "47... |
'''
Create per SPW test images of a pipeline-calibrated MS.
This version is intended for line SPWs.
Run EVLA_pipe_restore.py before this script.
'''
logprint("Starting EVLA_pipe_testimage_lines.py",
logfileout='logs/testimage_lines.log')
import os
import sys
from warnings import warn
from tasks import cle... | {
"content_hash": "5e7df3dfc0b673ed86526059b5b38da6",
"timestamp": "",
"source": "github",
"line_count": 118,
"max_line_length": 79,
"avg_line_length": 33.720338983050844,
"alnum_prop": 0.614727318421714,
"repo_name": "e-koch/VLA_Lband",
"id": "f186e8f2269cdc8064c8be9f27a3e8b0c8672c3e",
"size": "398... |
"""Test that longer and mixed texts are tokenized correctly."""
from __future__ import unicode_literals
import pytest
def test_tokenizer_handles_long_text(en_tokenizer):
text = """Tributes pour in for late British Labour Party leader
Tributes poured in from around the world Thursday
to the late Labour Party l... | {
"content_hash": "5d0d1f4e8adda71f250bd9c9bbe661ea",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 77,
"avg_line_length": 34.73529411764706,
"alnum_prop": 0.6900931414055885,
"repo_name": "banglakit/spaCy",
"id": "a99cfa29ee0851e025f639a9ca5da29fcb1fe2e2",
"size": "1201"... |
from __future__ import (nested_scopes, generators, division, absolute_import, with_statement,
print_function, unicode_literals)
from collections import defaultdict
import os
import re
from pants.base.build_environment import get_buildroot
from pants.backend.jvm.tasks.jvm_compile.analysis_parse... | {
"content_hash": "e78ff53f3a58aebfc3af033240d4530c",
"timestamp": "",
"source": "github",
"line_count": 94,
"max_line_length": 93,
"avg_line_length": 39.08510638297872,
"alnum_prop": 0.655688622754491,
"repo_name": "square/pants",
"id": "a50db298e014be491d52332c1ed998b9b68679cd",
"size": "3821",
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.