text stringlengths 4 1.02M | meta dict |
|---|---|
import copy
import math
import time
from oslo_log import log as logging
import six
from cinder import exception
from cinder.i18n import _
from cinder import utils
from cinder.volume.drivers.netapp.dataontap.client import api as netapp_api
from cinder.volume.drivers.netapp.dataontap.client import client_base
from osl... | {
"content_hash": "b1fe0c713dd832e53d466a5f73a1d482",
"timestamp": "",
"source": "github",
"line_count": 588,
"max_line_length": 79,
"avg_line_length": 41.40816326530612,
"alnum_prop": 0.53942828979793,
"repo_name": "eharney/cinder",
"id": "9671fa9d007ff8e9437c5d77490c43b295a88262",
"size": "25092",... |
from __future__ import absolute_import
import functools
def toDict(replay):
def __getattr(object, name, default):
return getattr(object, name, default)
_getattr = functools.partial(__getattr, default=None)
data = {
'gateway': _getattr(replay, 'gateway'),
'map': _getattr(replay, 'ma... | {
"content_hash": "4d54d5ece1d83d69064b495458dabf3c",
"timestamp": "",
"source": "github",
"line_count": 59,
"max_line_length": 68,
"avg_line_length": 38.644067796610166,
"alnum_prop": 0.5342105263157895,
"repo_name": "dsjoerg/sc2reader",
"id": "63cd137403583faaaf5e8ac11813c8bbc7a22d67",
"size": "22... |
"""Utility functions, constants, and classes pertaining to WAVE audio files."""
import struct
from vesper.util.bunch import Bunch
class WaveFileFormatError(Exception):
pass
RIFF_CHUNK_ID = 'RIFF'
FMT_CHUNK_ID = 'fmt '
FACT_CHUNK_ID = 'fact'
DATA_CHUNK_ID = 'data'
_WAVE_FORM_TYPE = 'WAVE'
_FMT_CHUNK_SIZES = ... | {
"content_hash": "b715eed970a9a1d5841e53d8355aa462",
"timestamp": "",
"source": "github",
"line_count": 164,
"max_line_length": 79,
"avg_line_length": 24.536585365853657,
"alnum_prop": 0.5897117296222664,
"repo_name": "HaroldMills/Vesper",
"id": "34dc4316660cf5cd529e1595c6e3c12f61a98e0a",
"size": "... |
from ntulifeguardapp.settings import *
| {
"content_hash": "096f9d9c87d647eb4ac6ff757f6c2ce5",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 38,
"avg_line_length": 39,
"alnum_prop": 0.8461538461538461,
"repo_name": "timchen86/ntulifeguardapp",
"id": "282c1b65287e22c256e881c87a6a2fce2913bf71",
"size": "39",
"bin... |
import unittest
import munch
import basecrm
from basecrm.test.testutils import BaseTestCase
class UsersServiceTests(BaseTestCase):
def test_service_property_exists(self):
self.assertTrue(hasattr(self.client, 'users'))
def test_method_list_exists(self):
self.assertTrue(hasattr(self.client.use... | {
"content_hash": "7430dce8f462151a7d0ab59826725635",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 116,
"avg_line_length": 33.916666666666664,
"alnum_prop": 0.6904176904176904,
"repo_name": "basecrm/basecrm-python",
"id": "d32d07e3732239c1c3eca029bfa4054751e0a5f6",
"size... |
import numpy
from chainer.backends import cuda
from chainer import function
from chainer.utils import type_check
class Contrastive(function.Function):
"""Contrastive loss function."""
def __init__(self, margin, reduce='mean'):
if margin <= 0:
raise ValueError("margin should be positive ... | {
"content_hash": "6a50b1349727aff03a04ec6035950096",
"timestamp": "",
"source": "github",
"line_count": 149,
"max_line_length": 79,
"avg_line_length": 36.81879194630873,
"alnum_prop": 0.5534086766314255,
"repo_name": "aonotas/chainer",
"id": "511ba946860aaecfd851f0a8ada09a4f0e00bdb7",
"size": "5486... |
from jousting.round.phase import Phase
from jousting.util.dice import D6, roll
class Charge(Phase):
def do_charge(self):
p1 = self._controller.get_p1()
p2 = self._controller.get_p2()
while not self.check_point_of_contact():
p1_move = self.limit_movement(self.roll_movement())
... | {
"content_hash": "3904758cfdffc481a1b2d76d55a96ffd",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 113,
"avg_line_length": 38.292682926829265,
"alnum_prop": 0.6165605095541401,
"repo_name": "Serneum/jousting-core",
"id": "06dcdece2242632dd60f56f3ee9c0a5fcd6e9cff",
"size"... |
import time
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BCM)
class StepperMotor:
def __init__(self, pin1, pin2, pin3, pin4, mode=2, delay=0.005, stepsbyspin=512):
self.p1 = pin1
self.p2 = pin2
self.p3 = pin3
self.p4 = pin4
self.modo = mode
self.delay = delay
self.lap = 512
GPIO.setup(pin1, GPIO.OUT)
... | {
"content_hash": "a32133ebeccf6f3901093e4de262da30",
"timestamp": "",
"source": "github",
"line_count": 209,
"max_line_length": 82,
"avg_line_length": 28.425837320574164,
"alnum_prop": 0.6780003366436627,
"repo_name": "intelidomo/rpi_snippets",
"id": "68e8ad3f93ddebde4588151b7c0d7590c90d9857",
"siz... |
from ._tail_recursive import tail_recursive
| {
"content_hash": "1633e1e58002f188337ef04955c5334e",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 43,
"avg_line_length": 44,
"alnum_prop": 0.8181818181818182,
"repo_name": "xj9/funk",
"id": "1a7ef825b6795217ded4746f7adb10d8604f0372",
"size": "69",
"binary": false,
"c... |
"""OpenType Layout-related functionality."""
| {
"content_hash": "477940433b8bb95f268306b837c9df42",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 44,
"avg_line_length": 45,
"alnum_prop": 0.7555555555555555,
"repo_name": "Pal3love/otRebuilder",
"id": "12e414fc3bf00e6152f953b989914f034edfe9e1",
"size": "45",
"binary":... |
import json
import time
import subprocess
import discord
import discord.ext.commands as commands
import psutil
def setup(bot):
bot.add_cog(Core(bot))
def duration_to_str(duration):
"""Converts a timestamp to a string representation."""
minutes, seconds = divmod(duration, 60)
hours, minutes = divmo... | {
"content_hash": "9ae1c90e5947905f688edd413c6e19d4",
"timestamp": "",
"source": "github",
"line_count": 117,
"max_line_length": 234,
"avg_line_length": 39.94871794871795,
"alnum_prop": 0.6328626444159179,
"repo_name": "PapyrusThePlant/MusicPanda",
"id": "2b01151bc0817d5c4ffee3d4faef78896aecd9ca",
"... |
from sklearn2sql_heroku.tests.regression import generic as reg_gen
reg_gen.test_model("GradientBoostingRegressor" , "freidman2" , "duckdb")
| {
"content_hash": "449da442728ec3c83fc177d7820286f7",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 72,
"avg_line_length": 35.5,
"alnum_prop": 0.7887323943661971,
"repo_name": "antoinecarme/sklearn2sql_heroku",
"id": "848ca36d4042235ee1857ce5e304e0dc84329906",
"size": "142... |
"""Example scenarios to display in the workbench.
This code is in the Workbench layer.
"""
import logging
from collections import namedtuple
from xblock.core import XBlock
from django.conf import settings
from django.template.defaultfilters import slugify
from .runtime import WORKBENCH_KVS, WorkbenchRuntime
log... | {
"content_hash": "073dff6134c6ab8fc676bee1d2b1650a",
"timestamp": "",
"source": "github",
"line_count": 93,
"max_line_length": 81,
"avg_line_length": 29.559139784946236,
"alnum_prop": 0.6711531465987632,
"repo_name": "stvstnfrd/xblock-sdk",
"id": "1c03355ea71c324420147fcedcc9cd197b82d9e1",
"size": ... |
"""Adds support for generic thermostat units."""
import asyncio
import logging
import voluptuous as vol
from homeassistant.components.climate import PLATFORM_SCHEMA, ClimateEntity
from homeassistant.components.climate.const import (
ATTR_PRESET_MODE,
CURRENT_HVAC_COOL,
CURRENT_HVAC_HEAT,
CURRENT_HVAC_... | {
"content_hash": "c6e069a6509276e6039ec717a185d5b1",
"timestamp": "",
"source": "github",
"line_count": 489,
"max_line_length": 96,
"avg_line_length": 34.877300613496935,
"alnum_prop": 0.5750806215186163,
"repo_name": "soldag/home-assistant",
"id": "4072c43bc27257bf1ce7a0c0dbb3ead6b9094879",
"size"... |
from . import assert_msg
from anipy import (
Browser,
Query
)
from anipy.ani.enum_ import (
Season,
MediaType,
SeriesType,
AnimeStatus,
MangaStatus,
SortBy
)
class TestBrowser(object):
def testQuery(self):
expected = {
'year': 2014,
'season': 'fa... | {
"content_hash": "bdd49e9daa62218cf4d3e0bc1be177fa",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 80,
"avg_line_length": 23.62,
"alnum_prop": 0.5529212531752752,
"repo_name": "twissell-/anipy",
"id": "01c10bf636e186f6558cd5de6609f13567f0e634",
"size": "1181",
"binary"... |
"""A module used for downloading files."""
import hashlib
import os
import shutil
import subprocess as sp
import tempfile
from ftplib import FTP
import requests
from tqdm import tqdm
from .logger import geoparse_logger as logger
try:
from urlparse import urlparse
except ImportError:
from urllib.parse import ... | {
"content_hash": "6c26b4ace12c52eba8d533284f31a42b",
"timestamp": "",
"source": "github",
"line_count": 248,
"max_line_length": 88,
"avg_line_length": 36.11693548387097,
"alnum_prop": 0.49246399464106283,
"repo_name": "guma44/GEOparse",
"id": "c1c74d47992c10317fc4cdc47b2195ec1196620d",
"size": "895... |
import pandas as pd
from bokeh.layouts import row, widgetbox
from bokeh.models import Select
from bokeh.palettes import Spectral5
from bokeh.plotting import curdoc, figure
from bokeh.sampledata.autompg import autompg
df = autompg.copy()
SIZES = list(range(6, 22, 3))
COLORS = Spectral5
ORIGINS = ['North America', 'Eu... | {
"content_hash": "eb7c70e251846ec2733c636a802a0477",
"timestamp": "",
"source": "github",
"line_count": 92,
"max_line_length": 111,
"avg_line_length": 29.347826086956523,
"alnum_prop": 0.6388888888888888,
"repo_name": "schoolie/bokeh",
"id": "39ded619a1f766ad09bc09e26244c3e413709275",
"size": "2700... |
import sys
from FileHelper import FileHelper
# This chunck factory creates chunks from textfile
class ChuncksFactory:
# Files if a list of files
def __init__(self, files):
self.chunck_completed = 0 ;
self.files = files ;
self.nChunks = -1 ;
def divideIntoChunks(self,filenameGenera... | {
"content_hash": "1e58b8e31f1470bdcd35a3ac17e539c0",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 88,
"avg_line_length": 37.54838709677419,
"alnum_prop": 0.584192439862543,
"repo_name": "neosky2142/PyMR",
"id": "bc0cfda356d319a97c1ac8c4a17efdc781caf950",
"size": "1164",... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from caffe2.python import core, schema
from caffe2.python.layers.layers import InstantiationContext
from caffe2.python.layers.tags import Tags
def _filter_layers(layers... | {
"content_hash": "b45ab9d75cff7d30e855f58cf4fa8fb4",
"timestamp": "",
"source": "github",
"line_count": 102,
"max_line_length": 80,
"avg_line_length": 34.294117647058826,
"alnum_prop": 0.6732418524871355,
"repo_name": "pietern/caffe2",
"id": "f14597effd0f20690f70ac659900aef1ca072ca7",
"size": "4254... |
import json
from django.http import HttpRequest
from testcases import TestCaseWithFixture
class ViewsTestCase(TestCaseWithFixture):
def test_gets(self):
resp = self.client.get('/api/v1/', data={'format': 'json'})
self.assertEqual(resp.status_code, 200)
deserialized = json.loads(resp.cont... | {
"content_hash": "0dd1f8e43b5d4e2e49cbc3b75c1cbfe7",
"timestamp": "",
"source": "github",
"line_count": 171,
"max_line_length": 128,
"avg_line_length": 49.567251461988306,
"alnum_prop": 0.6327277017461067,
"repo_name": "ipsosante/django-tastypie",
"id": "e45365dc41cded87e7ac5525a1291bd2e09647a8",
"... |
import logging
import os
import socket
from oslo_concurrency import processutils
from oslo_config import cfg
import oslo_i18n
from oslo_service import service
from oslo_service import systemd
import pbr.version
# NOTE(dstanek): i18n.enable_lazy() must be called before
# keystone.i18n._() is called to ensure it has t... | {
"content_hash": "c2531209ff1ad8a2303df6a69046ef8e",
"timestamp": "",
"source": "github",
"line_count": 141,
"max_line_length": 79,
"avg_line_length": 34.95035460992908,
"alnum_prop": 0.6152597402597403,
"repo_name": "maestro-hybrid-cloud/keystone",
"id": "f016b7f9f45bbcb3f72a29197674a1c841be594f",
... |
import os
from setuptools import setup, find_packages
root = os.path.abspath(os.path.dirname(__file__))
path = lambda *p: os.path.join(root, *p)
setup(
name='bztools',
version=__import__('bugzilla').__version__,
description='Models and scripts to access the Bugzilla REST API.',
long_description=ope... | {
"content_hash": "43da91efced10b8cb18fa8c3aabbb6e8",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 71,
"avg_line_length": 28.88888888888889,
"alnum_prop": 0.6153846153846154,
"repo_name": "jbalogh/bztools",
"id": "bc817b7aea2b1b3113eacd3156e4503d5f0f7eb8",
"size": "1040"... |
"""
@package mi.dataset.parser.test
@file mi-dataset/mi/dataset/parser/test/test_cspp_eng_dcl.py
@author Jeff Roy
@brief Test code for a cspp_eng_dcl data parser
"""
import os
from nose.plugins.attrib import attr
from mi.core.exceptions import RecoverableSampleException
from mi.core.log import get_logger
from mi.da... | {
"content_hash": "d307a3bbde319fbf29de767bd8ed900c",
"timestamp": "",
"source": "github",
"line_count": 168,
"max_line_length": 96,
"avg_line_length": 42.05357142857143,
"alnum_prop": 0.6048124557678698,
"repo_name": "vipullakhani/mi-instrument",
"id": "fb48abfd9a0769a2bcb94d3b8818f716ac98949a",
"s... |
"""Migrate an undercloud's stack data to use ephemeral Heat. Queries for
existing stacks and exports necessary data from the stack to the default
consistent working directory before backing up and dropping the heat database.
"""
import argparse
import logging
import os
import subprocess
import tarfile
import tempfile
... | {
"content_hash": "810da1fe4c8171c985bfc24791d04b31",
"timestamp": "",
"source": "github",
"line_count": 430,
"max_line_length": 85,
"avg_line_length": 33.4,
"alnum_prop": 0.6049993037181451,
"repo_name": "openstack/tripleo-heat-templates",
"id": "c6ed9bfcd0e6e1aabee6e05f3128d14fb700f619",
"size": "... |
from swgpy.object import *
def create(kernel):
result = Tangible()
result.template = "object/tangible/survey_tool/shared_survey_tool_liquid.iff"
result.attribute_template_id = 1
result.stfName("item_n","survey_tool_liquid")
#### BEGIN MODIFICATIONS ####
#### END MODIFICATIONS ####
return result | {
"content_hash": "5f4034fb26e0e4f2decee34f916c6e12",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 78,
"avg_line_length": 24.076923076923077,
"alnum_prop": 0.6996805111821086,
"repo_name": "obi-two/Rebelion",
"id": "3b6ea54effcfa57a3d56e13b468d5c642ea4ca8a",
"size": "458... |
"""
Our hero Teemo is attacking an enemy Ashe with poison attacks! When Teemo attacks Ashe, Ashe gets poisoned for a exactly duration seconds. More formally, an attack at second t will mean Ashe is poisoned during the inclusive time interval [t, t + duration - 1]. If Teemo attacks again before the poison effect ends, ... | {
"content_hash": "d9138636df7b40b1d2d30e9658a0633a",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 411,
"avg_line_length": 40.81818181818182,
"alnum_prop": 0.705456570155902,
"repo_name": "franklingu/leetcode-solutions",
"id": "d02e103e1562e9efdb3e19270e568b2c3d5cab64",
... |
import pytest
from landlab import RasterModelGrid
from landlab.components import LandslideProbability
@pytest.fixture
def ls_prob():
grid = RasterModelGrid((20, 20), xy_spacing=10e0)
grid.add_zeros("topographic__slope", at="node", dtype=float)
grid.add_zeros("topographic__specific_contributing_area", at=... | {
"content_hash": "9d9a8b34b89fefa07bf29e60367ee9c9",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 72,
"avg_line_length": 39.76190476190476,
"alnum_prop": 0.7065868263473054,
"repo_name": "landlab/landlab",
"id": "e46af0d129910c40087c1a069715ed89cc38680d",
"size": "835",... |
import abc
import six
@six.add_metaclass(abc.ABCMeta)
class FwaasDriverBase(object):
"""Firewall as a Service Driver base class.
Using FwaasDriver Class, an instance of L3 perimeter Firewall
can be created. The firewall co-exists with the L3 agent.
One instance is created for each tenant. One firew... | {
"content_hash": "693c7d54b34452d22e8f0a449fa5bb9c",
"timestamp": "",
"source": "github",
"line_count": 101,
"max_line_length": 79,
"avg_line_length": 32.56435643564357,
"alnum_prop": 0.6983885679537853,
"repo_name": "CiscoSystems/vespa",
"id": "7128e251a2af17b1263013d9ae3cb7608124db50",
"size": "4... |
"""
Script that trains DTNN models on qm7 dataset.
"""
from __future__ import print_function
from __future__ import division
from __future__ import unicode_literals
import numpy as np
np.random.seed(123)
import tensorflow as tf
tf.random.set_seed(123)
import deepchem as dc
# Load QM7 dataset
tasks, datasets, transfor... | {
"content_hash": "6627901a93d6d4735ead216bc4c347e9",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 76,
"avg_line_length": 24.8,
"alnum_prop": 0.7258064516129032,
"repo_name": "miaecle/deepchem",
"id": "7d3cf3ff0668303029c749c790fc927661183caa",
"size": "1240",
"binary"... |
from collections import namedtuple
import contextlib
import pytest
from pyleus.storm import StormTuple, Bolt, SimpleBolt
from pyleus.testing import ComponentTestCase, mock
class TestBolt(ComponentTestCase):
INSTANCE_CLS = Bolt
def test_ack(self):
tup = mock.Mock(id=1234)
with mock.patch.o... | {
"content_hash": "1c424b1dac96ec0d3e4e4330e1a87089",
"timestamp": "",
"source": "github",
"line_count": 207,
"max_line_length": 102,
"avg_line_length": 33.43478260869565,
"alnum_prop": 0.600346770697876,
"repo_name": "jirafe/pyleus",
"id": "cfed823164f24a4cebd9106b579ecc7492235fe5",
"size": "6921",... |
from __future__ import unicode_literals
from collections import namedtuple
from django.conf.urls import include, url
from django.test import TestCase
from rest_framework.compat import Resolver404, make_url_resolver
from rest_framework.test import APIRequestFactory
from rest_framework.urlpatterns import format_suffix... | {
"content_hash": "fbbe87342f342310d2212e8952661ec4",
"timestamp": "",
"source": "github",
"line_count": 101,
"max_line_length": 94,
"avg_line_length": 37.64356435643565,
"alnum_prop": 0.5725933719095213,
"repo_name": "dmwyatt/django-rest-framework",
"id": "7320de4793efd414c45f78574064fa9f4a6a23a4",
... |
from .main import Lightning
from .session import Session
from .visualization import Visualization, VisualizationLocal
from .types.plots import *
from .types.images import *
from .types.streaming import *
from .types.three import *
__version__ = "1.1.1"
| {
"content_hash": "f7045ad9dc34458dde90e8fe63c3a7d0",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 60,
"avg_line_length": 28.22222222222222,
"alnum_prop": 0.7716535433070866,
"repo_name": "garretstuber/lightning-python",
"id": "e9616ef22c86f95575c9eee903f5271e2ae9c3ba",
"... |
import tensorflow as tf
def highway(input_, size, layer_size=1, bias=-2, f=tf.nn.relu):
"""Highway Network (cf. http://arxiv.org/abs/1505.00387).
t = sigmoid(Wy + b)
z = t * g(Wy + b) + (1 - t) * y
where g is nonlinearity, t is transform gate, and (1 - t) is carry gate.
"""
output = input_
... | {
"content_hash": "e4b7124290887d5795385e5c81b5f47c",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 115,
"avg_line_length": 33.93333333333333,
"alnum_prop": 0.6110019646365422,
"repo_name": "windowsyuli/cross_domain",
"id": "815f8b5a0c36fbaf540d65a7368977f9c9972add",
"siz... |
"""Unit tests for qrscp.py QR get service."""
import logging
import os
import subprocess
import sys
import tempfile
import time
import pytest
from pydicom import dcmread, Dataset
from pydicom.uid import (
ExplicitVRLittleEndian, ImplicitVRLittleEndian,
DeflatedExplicitVRLittleEndian, ExplicitVRBigEndian
)
f... | {
"content_hash": "d67b67df3361c5ab2f6cdb545fd2b5d4",
"timestamp": "",
"source": "github",
"line_count": 161,
"max_line_length": 78,
"avg_line_length": 26.385093167701864,
"alnum_prop": 0.5972222222222222,
"repo_name": "scaramallion/pynetdicom3",
"id": "a5d61758c6c29f9f57b99c5f8bcb689beb7d577e",
"si... |
'''
Convert back and forth between the molecule (open boundary) and the 0D PBC
system.
'''
import numpy
from pyscf import gto, scf
from pyscf.pbc import gto as pbcgto
from pyscf.pbc import scf as pbcscf
from pyscf.pbc import df
cell = pbcgto.Cell()
cell.atom = 'N 0 0 0; N 0 0 1.2'
cell.basis = 'gth-dzvp'
cell.pseudo ... | {
"content_hash": "7340b69d19e9b1748408be10e39ea110",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 78,
"avg_line_length": 31.46551724137931,
"alnum_prop": 0.7276712328767123,
"repo_name": "sunqm/pyscf",
"id": "d5fd3b1d3ec8c2913073cdc77b5a6d28c61d4845",
"size": "1848",
... |
class create_gist:
def create(self, fields):
r = requests.post("https://api.github.com/gists",
data=json.dumps(fields),
headers={'user-agent':client.name})
return r.json()
def create(self, key, fields):
r = requests.post("https://api.g... | {
"content_hash": "d2dabcb8101a322e5c7d24cb03412dcb",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 62,
"avg_line_length": 40.92307692307692,
"alnum_prop": 0.48120300751879697,
"repo_name": "eightnoteight/x-gist",
"id": "ff303b02e7d93bf7d01287fc91065d8a36dab788",
"size": ... |
"""Tests for the IPython tab-completion machinery."""
# Copyright (c) IPython Development Team.
# Distributed under the terms of the Modified BSD License.
import os
import sys
import textwrap
import unittest
from contextlib import contextmanager
import nose.tools as nt
from traitlets.config.loader import Config
fr... | {
"content_hash": "0b3a29fbb6bd0c3ac69c8c08f25291d1",
"timestamp": "",
"source": "github",
"line_count": 1110,
"max_line_length": 112,
"avg_line_length": 36.1027027027027,
"alnum_prop": 0.5479113639766432,
"repo_name": "sserrot/champion_relationships",
"id": "2c19e2e01876ef8d976774681c8b73ab89266367",... |
from django import template
from django.contrib.auth.models import User, AnonymousUser, Group
from django.core.urlresolvers import reverse
from django.test import TestCase
from follow import signals, utils
from .models import Follow
from .utils import register
register(User)
register(Group)
class FollowTest(TestCase)... | {
"content_hash": "2a777b33561743b36272891946b581e4",
"timestamp": "",
"source": "github",
"line_count": 205,
"max_line_length": 129,
"avg_line_length": 38.11219512195122,
"alnum_prop": 0.6070651478305389,
"repo_name": "affan2/django-follow",
"id": "514f66a67a41e8720f7b47fc125353c6875591dd",
"size":... |
"""Stupid tests that ensure logging works as expected"""
from __future__ import division, absolute_import, print_function
import sys
import threading
import logging as log
from six import StringIO
import unittest
import beets.logging as blog
from beets import plugins, ui
import beetsplug
from test import _common
from... | {
"content_hash": "0b341747822325e09e041646b10e1e92",
"timestamp": "",
"source": "github",
"line_count": 300,
"max_line_length": 77,
"avg_line_length": 35.126666666666665,
"alnum_prop": 0.5776238375403302,
"repo_name": "shamangeorge/beets",
"id": "826b2447b51f31b752beb2142ed1838510c377c2",
"size": "... |
"""Document formatting specifics for parsing and working with documents."""
import logging
from grow.common import utils
from grow.documents import document_front_matter as doc_front_matter
# Set markdown logging level to info.
logging.getLogger('MARKDOWN').setLevel(logging.INFO)
BOUNDARY_SEPARATOR = '---'
class... | {
"content_hash": "4751fe8c9c046f56cc3084d59868efbb",
"timestamp": "",
"source": "github",
"line_count": 166,
"max_line_length": 77,
"avg_line_length": 30.63855421686747,
"alnum_prop": 0.6305544632324027,
"repo_name": "grow/pygrow",
"id": "5b5ddc153ee4c637b0ae11f11be185639119b0e8",
"size": "5086",
... |
from flask import render_template
# from flask import render_template, redirect, url_for, abort
# from flask_login import current_user
from . import main
@main.route('/')
def index():
# return '<h1>Hello World!</h1>'
return render_template('main/index.html')
@main.route('/download')
def download():
retur... | {
"content_hash": "4adfd10a6a0296dfe28078a7592598aa",
"timestamp": "",
"source": "github",
"line_count": 87,
"max_line_length": 75,
"avg_line_length": 34.02298850574713,
"alnum_prop": 0.6483108108108108,
"repo_name": "cmacro/mogufsite",
"id": "05744f49e3de8e92545c5887b797755c37b73f18",
"size": "2960... |
"""Test Home Assistant remote methods and classes."""
# pylint: disable=protected-access
import asyncio
import threading
import unittest
from unittest.mock import patch
import homeassistant.core as ha
import homeassistant.bootstrap as bootstrap
import homeassistant.remote as remote
import homeassistant.components.http... | {
"content_hash": "9a56195e89f577594469ac4d4f1951df",
"timestamp": "",
"source": "github",
"line_count": 317,
"max_line_length": 79,
"avg_line_length": 33.321766561514195,
"alnum_prop": 0.6253905140585061,
"repo_name": "philipbl/home-assistant",
"id": "55d8ca18b5fc800bbea0a052d5574cd2ac9886e9",
"siz... |
import django
from django.conf import settings
from django.core.management import call_command, get_commands, load_command_class
from django.core.management.base import BaseCommand, CommandError
from django.db import connection
try:
from django.utils.six.moves import input
except ImportError:
input = raw_input... | {
"content_hash": "72b29739e9d1ecaf4017473a01196acf",
"timestamp": "",
"source": "github",
"line_count": 183,
"max_line_length": 119,
"avg_line_length": 41.5792349726776,
"alnum_prop": 0.6132211854382967,
"repo_name": "ArtProcessors/django-tenant-schemas",
"id": "c3c28edd8b50144e55d630e0ac207915a1ae77... |
import os
import sys
import time
import pyqtgraph as pg
from PyQt4 import QtCore, QtGui, uic
import numpy as np
app = QtGui.QApplication(sys.argv)
ui_path = os.path.join(os.path.curdir, 'ui', 'QBGraph.ui')
if sys.platform == 'win32':
ui_path = os.path.join(os.path.curdir, 'ui', 'Windows', 'QBGraph.ui')
form_class,... | {
"content_hash": "803a2b29170a1f2b2f8bcf8e27cba69d",
"timestamp": "",
"source": "github",
"line_count": 288,
"max_line_length": 90,
"avg_line_length": 35.423611111111114,
"alnum_prop": 0.5081356596745736,
"repo_name": "emptyewer/DEEPN",
"id": "8f087b5edeb34102bec011ad48f5246e8ccd7441",
"size": "102... |
__author__ = 'ntrepid8'
import agilebot.cmd_util
import logging
from logging import NullHandler
import json
import sys
import argparse
from agilebot import util
from functools import partial
import os
logger = logging.getLogger('agilebot.slack')
logger.addHandler(NullHandler())
def create_bot(args, conf):
# updat... | {
"content_hash": "3c7b558887880738656fd2f745fc8f45",
"timestamp": "",
"source": "github",
"line_count": 93,
"max_line_length": 111,
"avg_line_length": 32.01075268817204,
"alnum_prop": 0.6540141081625798,
"repo_name": "ntrepid8/agilebot",
"id": "75646676d5bc0342ef47f8a75478843d28a4e232",
"size": "29... |
'''Unit tests for grit.gather.policy_json'''
import os
import re
import sys
if __name__ == '__main__':
sys.path.append(os.path.join(os.path.dirname(sys.argv[0]), '../..'))
import unittest
from grit.gather import muppet_strings
from grit.gather import policy_json
class PolicyJsonUnittest(unittest.TestCase):
def... | {
"content_hash": "931837f1b606449b03ff4a5209b74929",
"timestamp": "",
"source": "github",
"line_count": 185,
"max_line_length": 79,
"avg_line_length": 32.05945945945946,
"alnum_prop": 0.5191367391670881,
"repo_name": "Crystalnix/house-of-life-chromium",
"id": "9ebddb8d5aef5ec2d4b8e3c5f3efbd22012f9ab4... |
'''
Sample config JSON stanza:
{
"plugins": [
{"id": "http://bibfra.me/tool/pybibframe#labelizer",
"lookup": {
"http://bibfra.me/vocab/lite/Foobar": {
"separator": " ",
"marcOrder": True,
"properties": ["http://bibfra.me/vocab/lite/title",... | {
"content_hash": "f3516b3a823c81393183baaf7ddd715a",
"timestamp": "",
"source": "github",
"line_count": 210,
"max_line_length": 139,
"avg_line_length": 44.60952380952381,
"alnum_prop": 0.6203031596925704,
"repo_name": "zepheira/pybibframe",
"id": "05199b88a3e7e0b4c41d6e6d9c943101d36cdaf2",
"size": ... |
from test_support import verbose, findfile
import tokenize, os, sys
if verbose:
print 'starting...'
file = open(findfile('tokenize_tests'+os.extsep+'py'))
tokenize.tokenize(file.readline)
if verbose:
print 'finished'
| {
"content_hash": "19747c60537cdbae7e4413ebd738e6b5",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 54,
"avg_line_length": 25.11111111111111,
"alnum_prop": 0.7345132743362832,
"repo_name": "mariaantoanelam/Licenta",
"id": "7ac5624e9452101661ca38551ebdecdd3d6cb4e7",
"size":... |
"""functions to get decorative/informative text out of strings..."""
import re
import unicodedata
from translate.lang import data
def spacestart(str1):
"""returns all the whitespace from the start of the string"""
newstring = u""
for c in str1:
if c.isspace():
newstring += c
el... | {
"content_hash": "40b0dcbb8e801d8ed272707f890a3d52",
"timestamp": "",
"source": "github",
"line_count": 234,
"max_line_length": 127,
"avg_line_length": 38.743589743589745,
"alnum_prop": 0.6061107434370174,
"repo_name": "dbbhattacharya/kitsune",
"id": "ecee9ec3fc073640859f5ae1a8b76a9c426a29f9",
"siz... |
"""Measure the memory growth during a function call.
"""
from __future__ import print_function
from guppy import hpy #1
if sys.version_info.major < 3:
range = xrange
def check_memory_growth(function, *args, **kwargs): #2
"""Measure the memory usage of `f... | {
"content_hash": "db6dde34fca075e9ac92548b2249101b",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 67,
"avg_line_length": 33.888888888888886,
"alnum_prop": 0.42360655737704916,
"repo_name": "rawrgulmuffins/presentation_notes",
"id": "98381db827349089ae314a9589ede761d398fbe... |
import requests
from requests import Request, Session
from requests.packages.urllib3.util import Retry
from requests.adapters import HTTPAdapter
from datetime import datetime, timezone
from time import sleep
import lxml
import lxml.html as lh
from urllib.parse import quote, urlsplit
import re
from operator import itemg... | {
"content_hash": "9e755275761ce0015f6975f0907ccaa4",
"timestamp": "",
"source": "github",
"line_count": 431,
"max_line_length": 184,
"avg_line_length": 40.17169373549884,
"alnum_prop": 0.5276654730276077,
"repo_name": "dtuit/TwitterWebsiteSearch",
"id": "76c76b3318aabc52c57cd61148edf9a8a15fc12b",
"... |
import os
import shutil
import mock
from catkin_tools import config
from ..utils import assert_raises_regex
from ..utils import in_temporary_directory
from ..utils import redirected_stdio
@mock.patch('catkin_tools.config.initialize_verb_aliases')
@in_temporary_directory
def test_config_initialization(patched_func):... | {
"content_hash": "8867b59b599eb0ca6be25451cd2d394e",
"timestamp": "",
"source": "github",
"line_count": 120,
"max_line_length": 111,
"avg_line_length": 38.891666666666666,
"alnum_prop": 0.6905935290336405,
"repo_name": "xqms/catkin_tools",
"id": "edd98038cf6bb19f41bc5fb246b6cee3e980fbe4",
"size": "... |
from .. import Provider as BaseProvider
class Provider(BaseProvider):
"""
A Faker provider for the Portuguese VAT IDs
"""
vat_id_formats = (
'PT#########',
)
def vat_id(self):
"""
http://ec.europa.eu/taxation_customs/vies/faq.html#item_11
:return: A random Por... | {
"content_hash": "a973b33bbdf7fb66ba03f9b6c9abdd4b",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 69,
"avg_line_length": 22,
"alnum_prop": 0.5813397129186603,
"repo_name": "danhuss/faker",
"id": "a5f85eb61f8e2115da65eb39c0d4cbb2f73ea22c",
"size": "418",
"binary": fals... |
from __future__ import unicode_literals
from django.core.management.base import NoArgsCommand
from channel.actions import post_process_channel
from optparse import make_option
from docutil.commands_util import recocommand
from docutil.str_util import smart_decode
class Command(NoArgsCommand):
option_list = NoArgs... | {
"content_hash": "f4b751de3ff43ab482bae0f1727a1443",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 73,
"avg_line_length": 38.4,
"alnum_prop": 0.671875,
"repo_name": "bartdag/recodoc2",
"id": "a32f7110ed36fdaeb81660abea54e32525584436",
"size": "960",
"binary": false,
... |
from __future__ import unicode_literals
import django.core.validators
from django.db import migrations, models
import re
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Contact',
fields=[
... | {
"content_hash": "c004762fb45ca8e82b60b48fae61f3b3",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 295,
"avg_line_length": 69.68571428571428,
"alnum_prop": 0.6412464124641246,
"repo_name": "alphageek-xyz/site",
"id": "9a82ad03157301944df906076e354841ba2d4a15",
"size": "2... |
from base import Task
from common import phases
import volume
class Create(Task):
description = 'Creating a loopback volume'
phase = phases.volume_creation
successors = [volume.Attach]
@classmethod
def run(cls, info):
import os.path
image_path = os.path.join(info.workspace, 'volume.{ext}'.format(ext=info.vo... | {
"content_hash": "597f38e5a8eef7b73379f45a74b26c3a",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 93,
"avg_line_length": 29.606060606060606,
"alnum_prop": 0.7430910951893551,
"repo_name": "brianspeir/Vanilla",
"id": "94204294c21335481be9f200d95d5a9b7a8dcbaf",
"size": "9... |
__author__ = 'Sean WANG'
import os
import sys
import time
import copy
MAX_TIME = 1000000000
MAX_PRO = 10000
# convert the input
def strtolist(str):
start_time = int(str.split()[0])
end_time = int(str.split()[1])
return [start_time, end_time]
# check input valid
def inputisvalid(in_num, ... | {
"content_hash": "88919dc59ef5fb6a601ae11a0645500e",
"timestamp": "",
"source": "github",
"line_count": 144,
"max_line_length": 95,
"avg_line_length": 28.28472222222222,
"alnum_prop": 0.5924380063835011,
"repo_name": "IT-SeanWANG/CodeJam",
"id": "c493067f8516a2e0d9821f1a3ba0f2b5a11bf3f1",
"size": "... |
import logging
from pyvisdk.exceptions import InvalidArgumentError
########################################
# Automatically generated, do not edit.
########################################
log = logging.getLogger(__name__)
def ComplianceResult(vim, *args, **kwargs):
'''DataObject representing the result from a C... | {
"content_hash": "04b37d334167297eb5a60d8304c0626e",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 124,
"avg_line_length": 32.9375,
"alnum_prop": 0.6015180265654649,
"repo_name": "xuru/pyvisdk",
"id": "e99cc118efcef3b0451f6b9428f7d8efa8f28d7b",
"size": "1055",
"binary"... |
from torch.utils.data.sampler import Sampler
import math
def trainable_param(model):
training = []
for p in model.parameters():
if p.requires_grad:
training.append(p)
return training
class DistributedSequentialSampler(Sampler):
"""
A sequential sampler used in FeatureSet when... | {
"content_hash": "911ff1352151ddd195e2032c2f180696",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 82,
"avg_line_length": 28.4,
"alnum_prop": 0.6100352112676056,
"repo_name": "intel-analytics/analytics-zoo",
"id": "37ce7595d999dc7545806922ce0bf4a1d2cb943a",
"size": "1726... |
"""Tests for resource tracker claims."""
import re
import uuid
import mock
import six
from nova.compute import claims
from nova import context
from nova import db
from nova import exception
from nova import objects
from nova.openstack.common import jsonutils
from nova.pci import pci_manager
from nova import test
fro... | {
"content_hash": "10af99a8edd83b9cb9b22d7e486c6a0e",
"timestamp": "",
"source": "github",
"line_count": 317,
"max_line_length": 78,
"avg_line_length": 36.41955835962145,
"alnum_prop": 0.5692507579038545,
"repo_name": "tianweizhang/nova",
"id": "8a4e30b1bc6aff1b214445077c4a3106cb52c3ab",
"size": "12... |
from django.conf import settings
from django.core.urlresolvers import reverse
from django.test import TestCase
from django.contrib.auth.models import User
class ChangePasswordTest(TestCase):
urls = "pinax.apps.account.tests.account_urls"
def setUp(self):
self.old_installed_apps = settings.INSTAL... | {
"content_hash": "6a608a25dbf0a88b52212b8ebf8ee1dd",
"timestamp": "",
"source": "github",
"line_count": 79,
"max_line_length": 92,
"avg_line_length": 33.46835443037975,
"alnum_prop": 0.5922844175491679,
"repo_name": "espenak/pinax-oldversion-backup",
"id": "ceeb0b5ee023e9e09acb99a42c7755920f41d0ba",
... |
"""Trash a trashable card."""
from csrv.model.actions import action
from csrv.model import cost
from csrv.model import errors
class Trash(action.Action):
DESCRIPTION = 'Trash a card'
def resolve(self, response=None, ignore_clicks=False, ignore_all_costs=False):
action.Action.resolve(
self,
... | {
"content_hash": "20456f18c313f60dd855afc1095fa82a",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 80,
"avg_line_length": 24.52173913043478,
"alnum_prop": 0.6879432624113475,
"repo_name": "mrroach/CentralServer",
"id": "597e9752499a9e94fa5f985d897327e2bd6c9ffe",
"size": ... |
from django.conf import settings
from django.shortcuts import get_object_or_404
from rest_framework import generics
from rest_framework.response import Response
from rest_framework.status import HTTP_201_CREATED
from rest_framework.viewsets import ModelViewSet
from ..conf import settings as zeus_settings
from ..models ... | {
"content_hash": "5c0993bd01e3e7daf303313a8efb45d1",
"timestamp": "",
"source": "github",
"line_count": 138,
"max_line_length": 81,
"avg_line_length": 31.666666666666668,
"alnum_prop": 0.6086956521739131,
"repo_name": "lukaszb/zeusci",
"id": "936fc1f8aa0a1ace941c7a355556acff06650926",
"size": "4370... |
from django import template
from django.contrib.staticfiles import finders
#from django.utils.html import escape
from django.utils.safestring import mark_safe
register = template.Library()
@register.simple_tag
def includestatic(path, encoding='UTF-8'):
file_path = finders.find(path)
with open(file_path, "r", encodi... | {
"content_hash": "0ba76e899e35715cbcb1c62b56cf2a6f",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 51,
"avg_line_length": 29.285714285714285,
"alnum_prop": 0.7682926829268293,
"repo_name": "amitdhiman000/MyOffers",
"id": "4fd78e3b51eec645c78b798c3784c7e3f041f0fb",
"size"... |
from __future__ import unicode_literals
import inspect
def arginfo(callable):
"""Get information about the arguments of a callable.
Returns a :class:`inspect.ArgSpec` object as for
:func:`inspect.getargspec`.
:func:`inspect.getargspec` returns information about the arguments
of a function. argin... | {
"content_hash": "5493c27c395e24a25709bfdc59f6ab0d",
"timestamp": "",
"source": "github",
"line_count": 117,
"max_line_length": 75,
"avg_line_length": 29.752136752136753,
"alnum_prop": 0.6627405917839702,
"repo_name": "taschini/reg",
"id": "16ec82afd6e448a5939fb687515f8b891a00858a",
"size": "3481",... |
"""
Validation of SDFkt using a collection of unittests
author: Rinse Wester
"""
import unittest
from tests.testhsdfgraph import HSDFGraphTestCase
from tests.testsdfgraph import SDFGraphTestCase
from tests.testcsdfgraph import CSDFGraphTestCase
def suite():
suite = unittest.TestSuite()
suite.addTest(unitte... | {
"content_hash": "18cdb88012b84ddf3a178cf58c79fe0d",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 56,
"avg_line_length": 25.391304347826086,
"alnum_prop": 0.7671232876712328,
"repo_name": "rinsewester/SDFkit",
"id": "b69a173c526602cd6c8349a5e4183478d9866c35",
"size": "6... |
""" The base class for all test case controllers.
Copyright (c) 2014-2022 Kenn Takara
See LICENSE for details
"""
import logging
import time
from twisted.internet import reactor
from twisted.internet.endpoints import connectProtocol, clientFromString
from fixtest.base import FixtestTestInterruptedError, Fi... | {
"content_hash": "bd8dd9fefd35a13bca53f7d1b7fda36e",
"timestamp": "",
"source": "github",
"line_count": 211,
"max_line_length": 73,
"avg_line_length": 31.42654028436019,
"alnum_prop": 0.5496908460262404,
"repo_name": "kennt/fixtest",
"id": "4a2262620533a6e3576d7bee0559ce6ecba80a15",
"size": "6631",... |
import datetime
import unittest2
import json
from google.appengine.ext import ndb
from google.appengine.ext import testbed
from datafeeds.datafeed_fms_api import DatafeedFMSAPI
from helpers.match_helper import MatchHelper
from helpers.match_manipulator import MatchManipulator
from models.event import Event
from model... | {
"content_hash": "a14654f0b43b4d584493f617cf6850a3",
"timestamp": "",
"source": "github",
"line_count": 377,
"max_line_length": 162,
"avg_line_length": 61.56233421750663,
"alnum_prop": 0.6637511310267569,
"repo_name": "fangeugene/the-blue-alliance",
"id": "a07ae32017d55362ad8f3226d3d14e40d7a94d6f",
... |
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'Comment'
db.create_table(u'core_comment', (
(u'id', self.gf('django.db.models.fields.AutoField')(primary... | {
"content_hash": "38eca4b498e6d10a1a2a80857ebdf7dc",
"timestamp": "",
"source": "github",
"line_count": 141,
"max_line_length": 208,
"avg_line_length": 78.46808510638297,
"alnum_prop": 0.5490780911062907,
"repo_name": "Pkthunder/geoq",
"id": "4ccf009e5ca15598def5a40a17d28afe6368265e",
"size": "1108... |
"""Startup utilities"""
#pylint:skip-file
import os
import sys
from functools import partial
import paste.script.command
import werkzeug.script
from lxml import etree
import logging
log = logging.getLogger(__name__) # pylint: disable-msg=C0103
etc = partial(os.path.join, 'parts', 'etc')
DEPLOY_INI = etc('deploy.... | {
"content_hash": "d19241725e5dd11958c8d77f57b6b122",
"timestamp": "",
"source": "github",
"line_count": 140,
"max_line_length": 77,
"avg_line_length": 27.728571428571428,
"alnum_prop": 0.6218444100978877,
"repo_name": "jchrusciel/presence-analyzer-jchrusciel",
"id": "54a93d068a0e32e8ef81439d9cf3ae0c7... |
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('invoice', '0003_auto_20160921_1730'),
]
operations = [
migrations.AlterField(
model_name='usercheckout',
name='email',
... | {
"content_hash": "b03fb465ae6fd62e589b57b79365e52c",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 65,
"avg_line_length": 22.11111111111111,
"alnum_prop": 0.6030150753768844,
"repo_name": "brittdawn/django-webstore",
"id": "1ec797461d9abcb98dc7cbf8184fb571d2d28b4b",
"siz... |
"""Main Weather Server application module.
.. moduleauthor:: grzes71
"""
import argparse
import logging
from configparser import ConfigParser
import weatherserver.config as cfg
from weatherserver.config.configuration import create_configuration
from weatherserver.model.weathermodel import create_wea... | {
"content_hash": "a86ac95270279064411b1da3fbc1e89c",
"timestamp": "",
"source": "github",
"line_count": 65,
"max_line_length": 91,
"avg_line_length": 31.26153846153846,
"alnum_prop": 0.6377952755905512,
"repo_name": "grzes71/PyWeatherServer",
"id": "ae376f2f9a4a0c729deb634838fd0bf648ac2c1f",
"size"... |
{
'name' : 'Email Templates',
'version' : '1.1',
'author' : 'OpenERP SA',
'website' : 'https://www.odoo.com/page/mailing',
'category' : 'Marketing',
'depends' : ['mail'],
'description': """
Email Templating (simplified version of the original Power Email by Openlabs).
=======================... | {
"content_hash": "43358884bcd0143a8908f71f4199208d",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 100,
"avg_line_length": 42.10204081632653,
"alnum_prop": 0.6965584100824043,
"repo_name": "cristianquaglio/odoo",
"id": "d93c08be11c440dcc4ee3d959234f1456a8b6da2",
"size": ... |
from __future__ import absolute_import
import os
import sys
import json
from distutils import log
import sentry
JS_SDK_REGISTRY_URL = (
"https://release-registry.services.sentry.io/sdks/sentry.javascript.browser/versions"
)
LOADER_FOLDER = os.path.abspath(os.path.join(os.path.dirname(sentry.__file__), "loader"))... | {
"content_hash": "d2d0b82568b6d8acbb2c424056dd2282",
"timestamp": "",
"source": "github",
"line_count": 61,
"max_line_length": 97,
"avg_line_length": 24.114754098360656,
"alnum_prop": 0.6607749830047587,
"repo_name": "mvaled/sentry",
"id": "99a18c4325bbff47d6a2b3c0f6a2c6834744e2c5",
"size": "1605",... |
"""
Created on Thu Dec 4 18:11:29 2014
@author: jarenas
"""
import numpy as np
from itertools import product
from scipy import spatial
import sys
def dd_hellinger(theta1,theta2):
""" Calcula la distancia de Hellinger entre distribuciones discretas.
Parametros de entrada:
... | {
"content_hash": "c29299dce62dee2b767639e3e08d419e",
"timestamp": "",
"source": "github",
"line_count": 94,
"max_line_length": 90,
"avg_line_length": 35.40425531914894,
"alnum_prop": 0.6048677884615384,
"repo_name": "ML4DS/ML4all",
"id": "bc0b975d64a358f3ac86b5a1d72974dc0708da03",
"size": "3353",
... |
import re
from bs4 import BeautifulSoup as bs
from sys import argv
from codecs import open
from itertools import combinations, islice
class FormeurTXT:
def __init__(self,xmlFile):
self.entree = bs(open(xmlFile),"xml")
self._phrases = []
self.recupererTexte()
self.genererCorpus()
... | {
"content_hash": "79b7a1ad705a0a0314be3820d1d523ca",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 190,
"avg_line_length": 36.2,
"alnum_prop": 0.6341313689379988,
"repo_name": "Krolov18/Languages",
"id": "4e42aaf0b8aba95656d734fd9dca48ff60e693d4",
"size": "1639",
"bina... |
from wdom.tag import NewTagClass as NewTag
from wdom.themes import *
name = 'Concise'
project_url = 'http://http://concisecss.com/'
project_repository = 'https://github.com/ConciseCSS/concise.css'
license = 'MIT License'
license_url = 'https://github.com/ConciseCSS/concise.css/blob/master/LICENSE'
css_files = [
'... | {
"content_hash": "eb2f6aedd8f0797f26aec95bd02092ac",
"timestamp": "",
"source": "github",
"line_count": 78,
"max_line_length": 92,
"avg_line_length": 33.14102564102564,
"alnum_prop": 0.6479690522243714,
"repo_name": "miyakogi/wdom",
"id": "f2193b00818ff581c103159b5eeace4869cadec4",
"size": "2648",
... |
from django.contrib.auth import authenticate
from django.contrib.auth.views import redirect_to_login
from django.shortcuts import render, redirect
from django.http.response import HttpResponse, HttpResponseForbidden, HttpResponseRedirect
from django.utils import timezone
from datetime import timedelta
from common.shor... | {
"content_hash": "88c2e7133018772fa9b1bd837dcf7586",
"timestamp": "",
"source": "github",
"line_count": 246,
"max_line_length": 101,
"avg_line_length": 33.04471544715447,
"alnum_prop": 0.6160659367695903,
"repo_name": "DrChat/thermoctrl",
"id": "4793cb54d98eca3fb4228520803c56f169100b21",
"size": "8... |
from __future__ import unicode_literals
from django.db.models.signals import pre_save
from django.dispatch import receiver
from django.db import models
import os
def get_upload_path(instance, filename):
if instance.user:
return os.path.join(
"data/faces/raw", "%s" % instance.user.username, fi... | {
"content_hash": "e7b9063d59bbb64eb45c15bea9d1422e",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 85,
"avg_line_length": 29.153846153846153,
"alnum_prop": 0.6772207563764292,
"repo_name": "helloworldajou/webserver",
"id": "d895b8f8243f929d1e0eb107017d6bfaae5291b9",
"siz... |
if __name__ == '__main__':
from airtest import console
console.main()
| {
"content_hash": "1cc3fa79b1a4cf641625c38cb6bc5020",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 31,
"avg_line_length": 26,
"alnum_prop": 0.5769230769230769,
"repo_name": "NetEase/airtest",
"id": "219c610599f9ddaff39fce72b81ad667eb906d8f",
"size": "101",
"binary": fal... |
def arg(*args, **kwargs):
"""Decorator for CLI args."""
def _decorator(func):
add_arg(func, *args, **kwargs)
return func
return _decorator
def add_arg(f, *args, **kwargs):
"""Bind CLI arguments to a shell.py `do_foo` function."""
if not hasattr(f, 'arguments'):
f.arguments ... | {
"content_hash": "1d80fb91eddfdcbdf787594ae7ea7186",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 77,
"avg_line_length": 34.73684210526316,
"alnum_prop": 0.6287878787878788,
"repo_name": "trebuchet-deploy/trigger",
"id": "b039cf04c09851b98e8dd94af9a4568a9f268898",
"size... |
DOCUMENTATION = '''
---
module: win_s3
version_added: ""
short_description: Upload and download from AWS S3
description:
- Uses AWS_SDK for Powershell. If the module is not found it will be downloaded. More Info: http://aws.amazon.com/powershell/. Uses the SDK, with either provided credentials or IAM role crede... | {
"content_hash": "f52ec9710c0019a70c3c203d3489e9b9",
"timestamp": "",
"source": "github",
"line_count": 90,
"max_line_length": 372,
"avg_line_length": 30.1,
"alnum_prop": 0.6710963455149501,
"repo_name": "schwartzmx/ansible-module-devel",
"id": "7ccfc901cc0dd9d94838addb3cb83db86b433ac4",
"size": "3... |
import pytest
from hijri_converter import locales
@pytest.fixture(scope="class")
def all_locales(request):
request.cls.locales = locales._locale_map
@pytest.mark.usefixtures("all_locales")
class TestLocalesValidity:
def test_locale_data_structure(self):
for locale_cls in self.locales.values():
... | {
"content_hash": "ac7099e8652555ff6577e4bec85bd63b",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 77,
"avg_line_length": 30.810344827586206,
"alnum_prop": 0.599888080581981,
"repo_name": "dralshehri/hijri-converter",
"id": "7a665c8da3798426573a246589fcc82633df7b05",
"si... |
from ..excel_comparsion_test import ExcelComparisonTest
from ...workbook import Workbook
class TestCompareXLSXFiles(ExcelComparisonTest):
"""
Test file created by XlsxWriter against a file created by Excel.
"""
def setUp(self):
self.maxDiff = None
filename = 'image_anchor06.xlsx'
... | {
"content_hash": "d479071ae4373d80593186311876472b",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 74,
"avg_line_length": 27.243243243243242,
"alnum_prop": 0.6130952380952381,
"repo_name": "jkyeung/XlsxWriter",
"id": "32d5e34d520e1baf212ae0adb3ff7c1496e3345f",
"size": "1... |
"""
Test pdtContext
"""
import time
import unittest
import parsedatetime as pdt
from parsedatetime.context import pdtContext
class test(unittest.TestCase):
def setUp(self):
self.cal = pdt.Calendar(version=pdt.VERSION_CONTEXT_STYLE)
(self.yr, self.mth, self.dy, self.hr, self.mn,
self.sec... | {
"content_hash": "a69162522f62591fac2e04583913eb60",
"timestamp": "",
"source": "github",
"line_count": 51,
"max_line_length": 79,
"avg_line_length": 35.88235294117647,
"alnum_prop": 0.5606557377049181,
"repo_name": "cpatulea/parsedatetime",
"id": "6317f7771e3a3df48f3e4c91068d86582750b375",
"size":... |
class Player():
""" a leetcoin player """
def __init__(self, key, kills, deaths, name, weapon, rank):
self.key = key
self.kills = kills
self.deaths = deaths
self.name = name
self.rank = rank
self.weapon = weapon
def to_dict(self):
return ({
... | {
"content_hash": "90179d92fb9dff189407bcf1e00ea924",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 63,
"avg_line_length": 30,
"alnum_prop": 0.44666666666666666,
"repo_name": "LeetCoinTeam/lc_tactoe",
"id": "bef063f8b0c1c1389190e50b23253f9be05f8f92",
"size": "601",
"bin... |
import sys
if '' not in sys.path:
sys.path.append('')
import time
import unittest
from pyactors.logs import file_logger
from pyactors.generator import GeneratorActor
from pyactors.thread import ThreadedGeneratorActor
from pyactors.exceptions import EmptyInboxException
from tests import TestGeneratorActor as Test... | {
"content_hash": "f56be74fa7b8b4afcc96ae920f7297d5",
"timestamp": "",
"source": "github",
"line_count": 259,
"max_line_length": 90,
"avg_line_length": 34.05791505791506,
"alnum_prop": 0.5906359823149303,
"repo_name": "snakeego/pyactors",
"id": "999119d47eedb85ceabeeb903237cc5021eb502b",
"size": "88... |
import hec.heclib
import hec.io
import os
from datetime import datetime
from hec.heclib.util import HecTime
from os import path
def relativeFolder(folder, dssFilePath, createFolder='ifrelative'):
"""
Return an absolute path to ``folder`` relative to ``dssFilePath``.
If the path ``folder`` is already ... | {
"content_hash": "2b95c6073fae35aed82f412a5fe68322",
"timestamp": "",
"source": "github",
"line_count": 115,
"max_line_length": 89,
"avg_line_length": 28.895652173913042,
"alnum_prop": 0.6370749322900993,
"repo_name": "jprine/monitoring-module",
"id": "56041444d80b946d04cfb7ccff2e901291ce4bc6",
"si... |
"""Fichier contenant le paramètre 'supprimer' de la commande 'groupe inclus'.
"""
from primaires.interpreteur.masque.parametre import Parametre
from primaires.interpreteur.masque.exceptions.erreur_interpretation import \
ErreurInterpretation
class PrmInclusSupprimer(Parametre):
"""Commande 'groupe inclu... | {
"content_hash": "b52ee55f89d4399642d8b49de5857995",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 78,
"avg_line_length": 42.46341463414634,
"alnum_prop": 0.630097645031591,
"repo_name": "vlegoff/tsunami",
"id": "10e89604e759466cec9353f2114792ba9bc9202b",
"size": "3321",... |
from setuptools import setup
setup(name='quokka_module_template')
| {
"content_hash": "523aa75bcf46104ad9c9d0ddbc1d87c1",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 36,
"avg_line_length": 22.333333333333332,
"alnum_prop": 0.8059701492537313,
"repo_name": "abnerpc/quokka",
"id": "eb94a75612c42c7943289883b60e1bd94bbeb06d",
"size": "67",
... |
from django.contrib import admin
from open_news.models import NewsWebsite, Article
class NewsWebsiteAdmin(admin.ModelAdmin):
list_display = ('id', 'name', 'url_', 'scraper')
list_display_links = ('name',)
def url_(self, instance):
return '<a href="%s" target="_blank">%s</a>' % (instance.url, i... | {
"content_hash": "a5507638e2de87c29fc2c5e911612c1f",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 83,
"avg_line_length": 35.45454545454545,
"alnum_prop": 0.6474358974358975,
"repo_name": "kholidfu/django-dynamic-scraper",
"id": "c5f5a0140ccc6ba739d01db4eff8ffc70ba8f76d",
... |
from sqlalchemy import create_engine
def _get_version(conn):
# this is the suggested way of finding the mode, from
# https://python-oracledb.readthedocs.io/en/latest/user_guide/tracing.html#vsessconinfo
sql = (
"SELECT UNIQUE CLIENT_DRIVER "
"FROM V$SESSION_CONNECT_INFO "
"WHERE SI... | {
"content_hash": "a3b9dc7d8b53f7b39288667e69765bf6",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 91,
"avg_line_length": 30.214285714285715,
"alnum_prop": 0.6335697399527187,
"repo_name": "sqlalchemy/sqlalchemy",
"id": "21743d6ec73408ae39d2574ef3afb1bb03214465",
"size":... |
class ClassRegistry(type):
"""Maintain a registry of classes, indexed by name.
Note that this implementation requires that the names be unique, as it uses
a dictionary to hold the classes by name.
The name in the registry can be overridden via the 'name' attribute of the
class, and the 'priority' attribute contro... | {
"content_hash": "a5b79873507a3ff9bf1f5e3ea3bf2b11",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 75,
"avg_line_length": 34.74418604651163,
"alnum_prop": 0.6311914323962516,
"repo_name": "PhiInnovations/mdp28-linux-bsp",
"id": "58188fdd6e09fa6e7ad78ca1f7f497e2d15839c4",
... |
import roslib; roslib.load_manifest('beginner_tutorials')
import rospy
from std_msgs.msg import String
def talker():
pub = rospy.Publisher('chatter', String)
rospy.init_node('talker')
while not rospy.is_shutdown():
str = "hello world %s" % rospy.get_time()
rospy.loginfo(str)
pub.pu... | {
"content_hash": "b9360471fc2a427ca1a5f5ac37d47f4f",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 57,
"avg_line_length": 23.6,
"alnum_prop": 0.6186440677966102,
"repo_name": "rhogroup/simple",
"id": "33220871b96bccf30f97235796692379e16df334",
"size": "494",
"binary": ... |
""" Tests of the chemistry utilities
:Author: Jonathan Karr <[email protected]>
:Date: 2018-02-07
:Copyright: 2018, Karr Lab
:License: MIT
"""
from wc_utils.util import chem
import attrdict
import openbabel
import unittest
class EmpiricalFormulaTestCase(unittest.TestCase):
def test_EmpiricalFormula_constructo... | {
"content_hash": "98b2d5274656a71a7cb360eb463b71ac",
"timestamp": "",
"source": "github",
"line_count": 205,
"max_line_length": 98,
"avg_line_length": 32.88292682926829,
"alnum_prop": 0.5895267764426643,
"repo_name": "KarrLab/wc_utils",
"id": "360ace8875cd29af2d5d4fc3b540dc758c14d22f",
"size": "674... |
from collections import deque
from time import time
from twisted.application.service import Service
from twisted.internet import reactor
from twisted.internet.defer import Deferred, DeferredList
from twisted.internet.protocol import ReconnectingClientFactory
from twisted.protocols.basic import LineOnlyReceiver, Int32S... | {
"content_hash": "daf0e6cade745378f07b657879d5fe3f",
"timestamp": "",
"source": "github",
"line_count": 459,
"max_line_length": 123,
"avg_line_length": 35.407407407407405,
"alnum_prop": 0.727602756583805,
"repo_name": "iain-buclaw-sociomantic/carbon",
"id": "2d9dd8fbe79d18caa62cdfef11f8a6fd52867297",... |
import json
from datetime import date
from elasticsearch import helpers as es_helpers
from oxyio import settings
from oxyio.log import logger
from oxyio.app import redis_client, es_client
from oxyio.mappings.stats import object_stat_mapping
from .base import Task
class IndexStats(Task):
NAME = 'core/index_stat... | {
"content_hash": "52266951826085d2fbe3f6cdfd208e9e",
"timestamp": "",
"source": "github",
"line_count": 98,
"max_line_length": 80,
"avg_line_length": 27.377551020408163,
"alnum_prop": 0.555721207603429,
"repo_name": "oxyio/oxyio",
"id": "1cf877a1d80bb6c42076b63452dc979212573131",
"size": "2788",
... |
DASHBOARD = 'project'
# If set to True, this dashboard will be set as the default dashboard.
DEFAULT = True
# A dictionary of exception classes to be added to HORIZON['exceptions'].
ADD_EXCEPTIONS = {}
# A list of applications to be added to INSTALLED_APPS.
ADD_INSTALLED_APPS = ['openstack_dashboard.dashboards.project'... | {
"content_hash": "32d963427e3cff47c8767b19699f2a6d",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 73,
"avg_line_length": 37.47727272727273,
"alnum_prop": 0.7016373559733171,
"repo_name": "RudoCris/horizon",
"id": "be3200c0b08aba8c05c98326c64d27735fe6389d",
"size": "2331... |
import struct
import time
from packet_utils import *
from tcp import *
from udp import *
from icmp import *
from igmp import *
from packet_base import packet_base
from pox.lib.addresses import IPAddr, IP_ANY, IP_BROADCAST
class ipv4(packet_base):
"IP packet struct"
MIN_LEN = 20
IPv4 = 4
ICMP_... | {
"content_hash": "7fff67f7b272b40a630fbe6068e9c422",
"timestamp": "",
"source": "github",
"line_count": 142,
"max_line_length": 108,
"avg_line_length": 32.95070422535211,
"alnum_prop": 0.5216926693737978,
"repo_name": "hsnlab/escape",
"id": "6c47a2e5ee6143410d162c80617f69459cc6c80e",
"size": "6630"... |
"""Handle invoking netconan from the command line."""
# Copyright 2018 Intentionet
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0... | {
"content_hash": "1a3ac553c770227c1b008f591e09f32f",
"timestamp": "",
"source": "github",
"line_count": 249,
"max_line_length": 276,
"avg_line_length": 32.626506024096386,
"alnum_prop": 0.6152141802067946,
"repo_name": "intentionet/netconan",
"id": "cc586a40b3e29b09990f25e8c211d296ca72b9e3",
"size"... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.