text stringlengths 4 1.02M | meta dict |
|---|---|
'''
'''
#-----------------------------------------------------------------------------
# Boilerplate
#-----------------------------------------------------------------------------
import logging # isort:skip
log = logging.getLogger(__name__)
#--------------------------------------------------------------------------... | {
"content_hash": "f14c441721d38354167f50bcba322108",
"timestamp": "",
"source": "github",
"line_count": 132,
"max_line_length": 98,
"avg_line_length": 26.62878787878788,
"alnum_prop": 0.4321479374110953,
"repo_name": "ericmjl/bokeh",
"id": "484dd8d24e7e6d2ab6d132a835fc6cc99f638505",
"size": "3846",... |
from typing import TypeVar
from scitwi.search.search_query import SearchQuery
StrOrQuery = TypeVar('StrOrQuery', str, SearchQuery) | {
"content_hash": "4dcc2e9da4f01ab095b796e225dfd230",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 52,
"avg_line_length": 26.4,
"alnum_prop": 0.8181818181818182,
"repo_name": "vahndi/scitwi",
"id": "e8c77c178fa09b7aa21c4cd1a8a30e79f6d5e8e1",
"size": "132",
"binary": fal... |
from vtk import *
from tonic.vtk import *
from tonic.vtk.dataset_builder import *
# -----------------------------------------------------------------------------
# User configuration
# -----------------------------------------------------------------------------
dataset_destination_path = '/Users/seb/Desktop/vm_head... | {
"content_hash": "8cb1a68b2d7ed82fd75abd6fc1ae04d8",
"timestamp": "",
"source": "github",
"line_count": 106,
"max_line_length": 157,
"avg_line_length": 30.32075471698113,
"alnum_prop": 0.581207218419415,
"repo_name": "Kitware/tonic-data-generator",
"id": "4191e9c21e3b1889209f8045cbc58f4789cd98c7",
... |
from sympy.utilities.source import get_mod_func, get_class
def test_get_mod_func():
assert get_mod_func('sympy.core.basic.Basic') == ('sympy.core.basic', 'Basic')
def test_get_class():
_basic = get_class('sympy.core.basic.Basic')
assert _basic.__name__ == 'Basic' | {
"content_hash": "b2509120e6d1d6500630a6bb47b1c52c",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 82,
"avg_line_length": 34.625,
"alnum_prop": 0.6714801444043321,
"repo_name": "KevinGoodsell/sympy",
"id": "0716d469948e00394c1ae6855da541488f9578cc",
"size": "277",
"bina... |
from .deleted_revisions import DeletedRevisions
from .pages import Pages
from .recent_changes import RecentChanges
from .revisions import Revisions
from .site_info import SiteInfo
from .user_contribs import UserContribs
from .users import Users
| {
"content_hash": "f12c8aee800ea7f472674ab803ffff86",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 47,
"avg_line_length": 35,
"alnum_prop": 0.8408163265306122,
"repo_name": "makoshark/Mediawiki-Utilities",
"id": "dcfc3e295a08c95f73d2839cb2738096f6afc432",
"size": "245",
... |
from __future__ import unicode_literals
from httplib import responses
from flask import current_app as app
from flask import Blueprint, jsonify, request
from www.content import repository, exceptions
from www.main.serializers import serialize
from www.main.exceptions import ApiError
from www.decorators import add_head... | {
"content_hash": "d9c5652372b057e33a518177f2bdb548",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 75,
"avg_line_length": 32.78181818181818,
"alnum_prop": 0.6888519134775375,
"repo_name": "spryle/james.spry-leverton.com",
"id": "a0c4ccd7480077f4b53fd7ed2e549a5297244168",
... |
try:
from functools import wraps
except ImportError:
# for python < 2.5... this is a limited set of what we need to do
# with a wrapped function :
def wraps(f):
def wrap_with_f(new_f):
new_f.__name__ = f.__name__
if hasattr(f, '__module__'):
new_f.__module... | {
"content_hash": "b1e78b6a0893677f2ba92687262d3991",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 72,
"avg_line_length": 30.542857142857144,
"alnum_prop": 0.5266604303086997,
"repo_name": "mozilla/betafarm",
"id": "1f81e12b1d4cd11cb768db0e75d0f1819fe9c2f1",
"size": "107... |
from nssrc.com.citrix.netscaler.nitro.resource.base.base_resource import base_resource
from nssrc.com.citrix.netscaler.nitro.resource.base.base_resource import base_response
from nssrc.com.citrix.netscaler.nitro.service.options import options
from nssrc.com.citrix.netscaler.nitro.exception.nitro_exception import nitro_... | {
"content_hash": "96e67558411494e6cb79601309cfab1f",
"timestamp": "",
"source": "github",
"line_count": 241,
"max_line_length": 249,
"avg_line_length": 26.103734439834025,
"alnum_prop": 0.670004768717215,
"repo_name": "mahabs/nitro",
"id": "108a5e1ea931868e61a6c64e17d43b671ba53e03",
"size": "6905",... |
class BaseBackend(object):
def test_backend(self):
return NotImplemented
| {
"content_hash": "c58d7363106e12e8baf0f1f138ea1ba0",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 29,
"avg_line_length": 21.5,
"alnum_prop": 0.6976744186046512,
"repo_name": "adaptivdesign/odooku-compat",
"id": "ca425ecca1ecf8be8e98a2f31918de79e7014bcc",
"size": "86",
... |
'''
Created on Apr 14, 2015
@author: shurrey
'''
import logging
import sys
import suds
import random
from suds.client import Client
from suds.xsd.doctor import ImportDoctor, Import
from suds.wsse import *
from uuid import uuid1
from datetime import datetime
def getEntitlements():
return(["Announcement.WS:c... | {
"content_hash": "f0c9cf657b5b02f967f1b187349e6499",
"timestamp": "",
"source": "github",
"line_count": 358,
"max_line_length": 155,
"avg_line_length": 50.35474860335196,
"alnum_prop": 0.5959394241970378,
"repo_name": "blackboard/BBDN-WsSoapPythonWorkshop",
"id": "dc62062798b7d95792f428b8fd8b69d872e3... |
"""
Cubes
=====
Tools to deal with spectroscopic data cubes.
Some features in Cubes require additional packages:
* smoothing - requires agpy_\'s smooth and parallel_map routines
* `pyregion <git://github.com/astropy/pyregion.git>`_
The 'grunt work' is performed by the :py:mod:`cubes` module
"""
from __futu... | {
"content_hash": "e084bbbf296798577675e83a184d770a",
"timestamp": "",
"source": "github",
"line_count": 1532,
"max_line_length": 155,
"avg_line_length": 43.79177545691906,
"alnum_prop": 0.5411617403747261,
"repo_name": "vlas-sokolov/pyspeckit",
"id": "0fcd3e4229a0616c9b6f6d96acb1688d620c81d2",
"siz... |
import pytest
from .todo_list_api.app import db, create_todolist_app, User, Task
@pytest.fixture(scope="session")
def todolist_app():
return create_todolist_app(testing=True)
@pytest.fixture(scope="session")
def todolist_with_users_tasks(todolist_app):
with todolist_app.test_request_context():
users... | {
"content_hash": "218a14ea5ecd400a386cf2e2a6bc8e59",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 66,
"avg_line_length": 27,
"alnum_prop": 0.4988425925925926,
"repo_name": "inkmonk/flask-sqlalchemy-booster",
"id": "8aa5c0efafd04ec3d2678f83eee78c366d6eb728",
"size": "864... |
import socket
from os.path import basename
from math import floor
from i3pystatus import IntervalModule, formatp
from i3pystatus.core.util import TimeWrapper
class MPD(IntervalModule):
"""
Displays various information from MPD (the music player daemon)
.. rubric:: Available formatters (uses :ref:`format... | {
"content_hash": "74f9f6982464b119c20cfa05595be1a2",
"timestamp": "",
"source": "github",
"line_count": 156,
"max_line_length": 246,
"avg_line_length": 36.98717948717949,
"alnum_prop": 0.5474870017331023,
"repo_name": "juliushaertl/i3pystatus",
"id": "1aed61aefc7a018df74a4998020fe943c78aead2",
"siz... |
import datetime
import iso8601
import mock
from oslo_utils.fixture import uuidsentinel as uuids
from webob import exc
from nova.api.openstack.compute import migrations as migrations_v21
from nova import context
from nova import exception
from nova import objects
from nova.objects import base
from nova import test
fro... | {
"content_hash": "e5455f1f615e884ddcb79c53ebdc8b16",
"timestamp": "",
"source": "github",
"line_count": 487,
"max_line_length": 78,
"avg_line_length": 40.8870636550308,
"alnum_prop": 0.5688027320208919,
"repo_name": "klmitch/nova",
"id": "a06d395bea4dc611f718421d760c6a0c742fd678",
"size": "20510",
... |
import os
import logging
import time
import sys
l = logging.getLogger("angr.tests.test_ddg")
import nose
import angr
# Load the tests
test_location = str(os.path.dirname(os.path.realpath(__file__)))
def perform_one(binary_path):
proj = angr.Project(binary_path,
use_sim_procedures=True,
... | {
"content_hash": "4043d7b9aa0cf7b98c9a3c9a82e22f8c",
"timestamp": "",
"source": "github",
"line_count": 60,
"max_line_length": 91,
"avg_line_length": 31.916666666666668,
"alnum_prop": 0.6616187989556136,
"repo_name": "lowks/angr",
"id": "b72ce1aa446086ed31cea56516380809e9b8479a",
"size": "1938",
... |
from cupy.logic import ufunc
def allclose(a, b, rtol=1e-05, atol=1e-08):
# TODO(beam2d): Implement it
raise NotImplementedError
def isclose(a, b, rtol=1e-05, atol=1e-08, equal_nan=False):
# TODO(beam2d): Implement it
raise NotImplementedError
def array_equal(a1, a2):
# TODO(beam2d): Implement ... | {
"content_hash": "393c88dac50ca0b5df60ab1756091089",
"timestamp": "",
"source": "github",
"line_count": 75,
"max_line_length": 59,
"avg_line_length": 18.04,
"alnum_prop": 0.5868440502586844,
"repo_name": "yanweifu/chainer",
"id": "357b0d629ee5ef20d9c9af18a45f9a34cc225855",
"size": "1353",
"binary... |
import json
import unittest
from airflow.exceptions import AirflowException
from airflow.models import Connection
from airflow.providers.discord.hooks.discord_webhook import DiscordWebhookHook
from airflow.utils import db
class TestDiscordWebhookHook(unittest.TestCase):
_config = {
'http_conn_id': 'defa... | {
"content_hash": "fd05e5fcf2a0ffece8e185aaf3a7470e",
"timestamp": "",
"source": "github",
"line_count": 93,
"max_line_length": 86,
"avg_line_length": 33.32258064516129,
"alnum_prop": 0.6356889319135205,
"repo_name": "DinoCow/airflow",
"id": "f28a10a10473fc9ca1312385b91c7ff7acaf5214",
"size": "3888"... |
import os
class FileFinder(object):
def __init__(self, config):
# Parse config
self._config = config
try:
self._valid_file_extensions = self._config['valid_file_extensions']
self._filename_blacklist = self._config['filename_blacklist']
except:
r... | {
"content_hash": "01e975a8f80e26f40f6b8e56a492fb61",
"timestamp": "",
"source": "github",
"line_count": 73,
"max_line_length": 79,
"avg_line_length": 33.342465753424655,
"alnum_prop": 0.5493015612161052,
"repo_name": "sheabot/tvdbnamer",
"id": "d6aa3d2894d074213574b315a6a7623927caf2bd",
"size": "24... |
from __future__ import print_function
import textwrap
import os
import sys
import yaml
def print_help():
print(textwrap.dedent("""
This tool checks that all plugin registry doesn't contain revision
for plugins.
./tox-check-plugin_registry.py [--help] SOME_YAML...
Specify as cli ... | {
"content_hash": "2cab2c2c0fafd460e459e15b873ff103",
"timestamp": "",
"source": "github",
"line_count": 86,
"max_line_length": 74,
"avg_line_length": 27.511627906976745,
"alnum_prop": 0.5684699915469146,
"repo_name": "okolisny/InfraRed",
"id": "b0344876261e8341256e45dd4720c66b13f29ee5",
"size": "23... |
import base64
import tempfile
import traceback
import SimpleXMLRPCServer
import sys, os
sys.path.append(os.sep.join(('..','..','..','..','..')))
import voodoo.configuration as CM
import weblab.experiment.devices.xilinx_impact.devices as XilinxDevices
import weblab.experiment.devices.xilinx_impact.impact as XilinxImp... | {
"content_hash": "2c9de37392549986cf70c9fb3dbd088e",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 87,
"avg_line_length": 30.975609756097562,
"alnum_prop": 0.6519685039370079,
"repo_name": "porduna/weblabdeusto",
"id": "4024648f5f0ef1f6be30bcb1f49c9e968e2403ab",
"size": ... |
from __future__ import division, print_function
import os
def configuration(parent_package='',top_path=None):
from numpy.distutils.misc_util import Configuration
config = Configuration('climlab', parent_package, top_path)
config.add_subpackage('convection')
config.add_subpackage('domain')
config.a... | {
"content_hash": "cddc375dc65eac8f1ffbcc5807260110",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 63,
"avg_line_length": 34.13636363636363,
"alnum_prop": 0.6977363515312917,
"repo_name": "cjcardinale/climlab",
"id": "d4ba866227b8be4ab6823e4764b7031f539f679e",
"size": "7... |
from decimal import Decimal
from django import template
from clarityv2.invoices.constants import TWO_DIGITS
register = template.Library()
@register.filter
def duration(td):
total_seconds = int(td.total_seconds())
hours = total_seconds / 3600
return '{}'.format(round(float(hours), 2))
@register.simpl... | {
"content_hash": "270da588be2487349acacce691d8a0ba",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 72,
"avg_line_length": 21.76595744680851,
"alnum_prop": 0.6930596285434996,
"repo_name": "Clarity-89/clarityv2",
"id": "881e966217abbe21632e0d1cf30ef8f835f69d36",
"size": "... |
""" Module: league
TODO: fill this in with required methods to implement since required
members aren't strictly members [they are pulled from properties].
"""
from util.dev import print_timing
from constants import API_NODE_TYPE, API_EDGE_TYPE
from constants import API_NODE_PROPERTY, API_CONSTANT
import sqobject
imp... | {
"content_hash": "095261b49ac8762b52a379c8c8fe06cd",
"timestamp": "",
"source": "github",
"line_count": 166,
"max_line_length": 77,
"avg_line_length": 27.933734939759034,
"alnum_prop": 0.5930558550787147,
"repo_name": "scrbrd/scoreboard",
"id": "abc1eb8286bafb60f330e3ee512b54474ff5fb40",
"size": "4... |
"""
Test harness for the venv module.
Copyright (C) 2011-2012 Vinay Sajip.
Licensed to the PSF under a contributor agreement.
"""
import ensurepip
import os
import os.path
import re
import shutil
import struct
import subprocess
import sys
import tempfile
from test.support import (captured_stdout, captured_stderr, req... | {
"content_hash": "2847054aa2bbb2106eafdec819e8e4db",
"timestamp": "",
"source": "github",
"line_count": 494,
"max_line_length": 84,
"avg_line_length": 41.21862348178138,
"alnum_prop": 0.5818190747470778,
"repo_name": "kikocorreoso/brython",
"id": "ede65935b650bb6acc4c63ed944543c0d3c2a43f",
"size": ... |
def encode(input):
chars = list(input)
char_map = {}
tree_root_node = None
for char in chars:
if not char_map.has_key(char):
char_map[char] = 0
char_map[char] += 1
counts = CharCounts()
for letter, count in char_map.iteritems():
counts.add_new(CharCount(lett... | {
"content_hash": "2f54875783bf87e71d37080dab3f68b3",
"timestamp": "",
"source": "github",
"line_count": 80,
"max_line_length": 90,
"avg_line_length": 27.125,
"alnum_prop": 0.5622119815668203,
"repo_name": "codebox/algorithms",
"id": "132ca07f42a6cd6443e840326e2fe106694a88c5",
"size": "2170",
"bin... |
"""
Command-line wrapper to curl for Rackspace Cloud API
"""
import argparse
import sys
import logging
import rackspacecurl
from rackspacecurl import client
from rackspacecurl import utils
from rackspacecurl.v1_0 import shell as shell_v1_0
logger = logging.getLogger(__name__)
class RackspaceCurlArgumentParser(argpa... | {
"content_hash": "66965768077aa3ef7962e2a9ca71066f",
"timestamp": "",
"source": "github",
"line_count": 172,
"max_line_length": 78,
"avg_line_length": 31.959302325581394,
"alnum_prop": 0.5626705475714026,
"repo_name": "kwminnick/raxcurl",
"id": "fbbafa8a79d7e39fcd85527a7de2b92a66ed8c58",
"size": "5... |
"""
Collection of GUI elements created by Pavlo Shchelokovskyy.
This module cannot be used on it own.
Provides following functions:
rgba_wx2mplt - Convert wx.Colour to colour format used by matplotlib
Provides following objects:
OneParamFilePanel - simple panel for processing one file with one parameter;
Nu... | {
"content_hash": "ad84c7de74d19075619d88c51cc8326f",
"timestamp": "",
"source": "github",
"line_count": 355,
"max_line_length": 114,
"avg_line_length": 33.27605633802817,
"alnum_prop": 0.5827478201980869,
"repo_name": "pshchelo/vampy",
"id": "b20a16545663b124d101a407b92d9d0910b32412",
"size": "1183... |
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
import bpz
readme = open('README.rst').read()
history = open('HISTORY.rst').read().replace('.. :changelog:', '')
requirements = [
"Django >=1.6,<1.7",
"South >= 1.0",
]
test_requirements = [
"django-nose",
... | {
"content_hash": "b7bf626f8b5672c143000acca09a21ff",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 69,
"avg_line_length": 28.25,
"alnum_prop": 0.6133424098025868,
"repo_name": "codefortulsa/BPZAround.me",
"id": "9bf1e797663e37358d78154bb4bab0a99436c150",
"size": "1516",
... |
import nose
import convert
class ConversionTest():
def __init__(self):
self.path = "/Users/Sean/FYP/CodeForSean\
/convert/news_1942_706831.txt"
self.file_of_files = "/Users/Sean/FYP/CodeForSean/convert/fs.txt"
def test_get_paths(self):
assert (convert.get_paths(self.file_of_f... | {
"content_hash": "592e8bc126970bfeae7a63ce763a2729",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 73,
"avg_line_length": 27.5625,
"alnum_prop": 0.6462585034013606,
"repo_name": "scowan1995/COHA_to_googlengram",
"id": "4c11569aa8c9c2ba2cbcae4de0cc699a51830708",
"size": "... |
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 'Param'
db.create_table('SITE_PARAMETER', (
('dateCreate', self.gf('django.db.models.fields.DateTimeField... | {
"content_hash": "51d372f2857788b84b9b444d5df3726c",
"timestamp": "",
"source": "github",
"line_count": 725,
"max_line_length": 245,
"avg_line_length": 97.56827586206897,
"alnum_prop": 0.595190635735188,
"repo_name": "Ximpia/ximpia",
"id": "fddfb4376fee417763810ae32b3a4e06e66b1b2c",
"size": "70761"... |
from django.conf import settings
from django.conf.urls import (
include,
url,
)
from django.conf.urls.static import static
from django.contrib import admin
from django.views.static import serve
import firebot.views
urlpatterns = [
# Django Views
url(r'^accounts/', include('allauth.urls')),
url(r'... | {
"content_hash": "4e7824fa6f90f5e5abcf99591e0bf736",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 109,
"avg_line_length": 29.93103448275862,
"alnum_prop": 0.6566820276497696,
"repo_name": "FundersClub/fire",
"id": "e03cbe0bdeee3399e4787c94da8f9e7102cc89de",
"size": "868... |
import os
import sys
import locale
import codecs
import sublime
def getSTVersion():
ST_version_text = sublime.version()
ST_version = int(ST_version_text) / 1000
return ST_version
def getSysPlatform():
# platform may be "osx", "linux" or "windows"
sys_platform = sublime.platform()
return sys_p... | {
"content_hash": "5e969e7b391f9f5ee037d46176b4e947",
"timestamp": "",
"source": "github",
"line_count": 63,
"max_line_length": 72,
"avg_line_length": 25.555555555555557,
"alnum_prop": 0.6658385093167701,
"repo_name": "fightbear/SublimeCocos",
"id": "4d5875fa8ae8de5006c995ca4a0c709101730594",
"size"... |
from Queue import Queue
import random
import time
class MarsTestHarness(object):
'''
For use with GUI testing, will generate random data for each queue
'''
def __init__(self, telemetryQueue = None, beamGapQueue = None, refreshTime = 5):
self._telemetryQueue = telemetryQueue
self._beamGa... | {
"content_hash": "634ec8b026e5b2e852b17a4067383b55",
"timestamp": "",
"source": "github",
"line_count": 59,
"max_line_length": 110,
"avg_line_length": 44.3728813559322,
"alnum_prop": 0.5786860198624905,
"repo_name": "JoeBartelmo/goddard",
"id": "ae322f61e905eea983c6da9229c86bbd1bfbeea2",
"size": "3... |
from setuptools import setup, find_packages, Extension
from Cython.Build import cythonize
extensions = [
Extension("pylonghair",
["pylonghair.pyx",
"_longhair.c",
"native/cauchy_256.cpp",
"native/MemSwap.cpp",
"native/MemXOR.cpp",
... | {
"content_hash": "d1dc08d096042988a296123dea9fac2d",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 54,
"avg_line_length": 21.375,
"alnum_prop": 0.5526315789473685,
"repo_name": "sampot/pylonghair",
"id": "d3d38db9993e26442b53f1825c438d5fc46fd2ea",
"size": "709",
"binar... |
'''
evaluate result
'''
from keras.models import load_model
from keras.utils import np_utils
import numpy as np
import os
import sys
# add path
sys.path.append('../')
sys.path.append('../tools')
from tools import conf
from tools import load_data
from tools import prepare
# input sentence dimensions
step_length =... | {
"content_hash": "06c9a0c7357bd0cadecf049fcdecf289",
"timestamp": "",
"source": "github",
"line_count": 62,
"max_line_length": 153,
"avg_line_length": 25.56451612903226,
"alnum_prop": 0.6845425867507886,
"repo_name": "danche354/Sequence-Labeling",
"id": "b5b75e5c1271281dd909204bf469e35b0f7cd403",
"... |
import numpy as np
import factory
from django.utils.timezone import datetime
from ..charts import models
class ChartFactory(factory.DjangoModelFactory):
name = factory.Sequence(lambda n: 'name-{0}'.format(n))
xname = 'Length'
xunit = 'mm'
yname = 'Power'
yunit = 'W'
legend = 'data 1'
pub_... | {
"content_hash": "dd152d9e399fcf11925b8de9094cad67",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 59,
"avg_line_length": 22.894736842105264,
"alnum_prop": 0.6344827586206897,
"repo_name": "frRoy/Benchmarklib",
"id": "6733d2e96445a9f53dcd3865933c6254ce5c4c66",
"size": "4... |
import os
import sys
from io import StringIO
import zlib
import requests_mock
import mock
import libcloud
from libcloud.test import unittest
from libcloud.common.base import Connection
from libcloud.http import LibcloudConnection
from libcloud.utils.loggingconnection import LoggingConnection
EXPECTED_DATA_JSON = """... | {
"content_hash": "7d699f6fc3ea439a4098a5c540ffc346",
"timestamp": "",
"source": "github",
"line_count": 149,
"max_line_length": 90,
"avg_line_length": 32.214765100671144,
"alnum_prop": 0.6177083333333333,
"repo_name": "andrewsomething/libcloud",
"id": "bd030567d0f9a06177788d3ae468c14772fd5447",
"si... |
__author__ = 'SHADOWxCODEX'
#pip install requests
#or easy_install requests
#found under python_path\Scripts\pip
#if you get an python egg related error, try 'pip install --upgrade setuptools'
import requests
import itertools
print('Author: SHADOWxCODEX')
print('Date Created: 7-24-2015')
print('Source: https://github... | {
"content_hash": "106f07a5b049af1693f0cf85e887d951",
"timestamp": "",
"source": "github",
"line_count": 147,
"max_line_length": 156,
"avg_line_length": 35.25850340136054,
"alnum_prop": 0.5998456492378931,
"repo_name": "PhantomBALR/pydomainfinder",
"id": "f39588ae98f6a85bc15e088861ba8a9e58e74909",
"... |
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
('marketplace', '0033_mandatory_offering_type'),
]
operations = [
migrations.CreateModel(
name='GoogleCredentials',
... | {
"content_hash": "61364917c3bcca8ee08735734bf6d29a",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 81,
"avg_line_length": 32.08510638297872,
"alnum_prop": 0.44297082228116713,
"repo_name": "opennode/waldur-mastermind",
"id": "11d2cf4a09ef4bbd829dce3d5ed744294b0a1d59",
"s... |
"""
Limited tests of the visualization module. Right now it just makes
sure that passing custom Axes works.
"""
from sympy.mpmath import mp, fp
def test_axes():
try:
import matplotlib
version = matplotlib.__version__.split("-")[0]
version = version.split(".")[:2]
if map(int, versi... | {
"content_hash": "f21a3b22adac5b645ac8b063f8e4a6b4",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 74,
"avg_line_length": 29.40625,
"alnum_prop": 0.5759829968119022,
"repo_name": "pernici/sympy",
"id": "6b40550d3a9ff6c0d0f8ba00c02920fe940c264f",
"size": "941",
"binary"... |
from __future__ import unicode_literals
from moto.core import BaseBackend, BaseModel
from moto.ec2 import ec2_backends
import uuid
import datetime
from random import choice
from .exceptions import ResourceNotFoundException, ValidationException
class OpsworkInstance(BaseModel):
"""
opsworks maintains its own ... | {
"content_hash": "cfe49b276d45a648f3ee794e0fd4892e",
"timestamp": "",
"source": "github",
"line_count": 541,
"max_line_length": 108,
"avg_line_length": 40.402957486136785,
"alnum_prop": 0.577957727147955,
"repo_name": "kefo/moto",
"id": "3adfd33236f2104a1e6eca6f0a1097fe7f12af2c",
"size": "21858",
... |
import frappe
def execute():
from frappe.core.doctype.file.file import make_home_folder
if not frappe.db.exists("DocType", "File"):
frappe.rename_doc("DocType", "File Data", "File")
frappe.reload_doctype("File")
if not frappe.db.exists("File", {"is_home_folder": 1}):
make_home_folder()
# make missing fold... | {
"content_hash": "817b6e10671275a3f95d6eaa57aae79d",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 91,
"avg_line_length": 29.9375,
"alnum_prop": 0.6962421711899791,
"repo_name": "gangadharkadam/v6_frappe",
"id": "64af2e14117a0a453288315077f5430c3ffeb803",
"size": "958",
... |
import unittest
import sys
import os
import json
import time
import requests
from sklearn import svm
from argparse import ArgumentParser
cur_dir = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, os.path.abspath('%s/../' % cur_dir))
from clipper_admin.clipper_manager import Clipper
import random
import soc... | {
"content_hash": "079b82fa50147d10b712c2cff2d275a2",
"timestamp": "",
"source": "github",
"line_count": 354,
"max_line_length": 102,
"avg_line_length": 39.99152542372882,
"alnum_prop": 0.6309246309246309,
"repo_name": "dubeyabhi07/clipper",
"id": "c7498445554a1bbe031a9e46a32a6fb55f1125f9",
"size": ... |
"""
@file linking_behavior.py
@url https://bokeh.pydata.org/en/latest/docs/user_guide/interaction/linking.html
@details To run, try doing this in the command line, in the directory of this
file:
python3 linking_behavior.py
"""
from bokeh.io import output_file, show
from bokeh.layouts import gridplot
from bokeh.plotting... | {
"content_hash": "f85ba498cbb1520591f15f5e20a9aa98",
"timestamp": "",
"source": "github",
"line_count": 128,
"max_line_length": 82,
"avg_line_length": 36.0703125,
"alnum_prop": 0.7281784708685294,
"repo_name": "ernestyalumni/MLgrabbag",
"id": "84d410a64e2f8240f17bf94ec62a64a1006802f5",
"size": "461... |
from direct.directnotify import DirectNotifyGlobal
from direct.distributed import DistributedObject
from direct.interval.IntervalGlobal import *
from otp.speedchat import SpeedChatGlobals
from toontown.toonbase import TTLocalizer
class DistributedGreenToonEffectMgr(DistributedObject.DistributedObject):
notify = Di... | {
"content_hash": "7f675a0738328917bbe9f1748367f2e1",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 89,
"avg_line_length": 37.96774193548387,
"alnum_prop": 0.7434154630416313,
"repo_name": "silly-wacky-3-town-toon/SOURCE-COD",
"id": "6279673b9aa2a6863fc229f47631aee9ce57ee75... |
import json
from unittest.mock import patch
from django.test.utils import override_settings
from hc.api.models import Channel
from hc.test import BaseTestCase
@override_settings(SLACK_CLIENT_ID="fake-client-id")
class AddSlackCompleteTestCase(BaseTestCase):
@patch("hc.front.views.requests.post")
def test_it_... | {
"content_hash": "60537f5534d7fc5a09335bb84682456e",
"timestamp": "",
"source": "github",
"line_count": 93,
"max_line_length": 83,
"avg_line_length": 38.87096774193548,
"alnum_prop": 0.6533886583679115,
"repo_name": "iphoting/healthchecks",
"id": "4d0bd3ad703a087b2979d8bcaf15f2f0547dcb16",
"size": ... |
from dask.distributed import Client
from glob import glob
import dask.dataframe as dd
import pandas as pd
from dask import delayed
import dask.bag as db
import json
import numpy as np
import os
import six
import itertools
from dateutil import parser
columns = ('ca', 'unit', 'scp', 'station', 'linename', 'division',
... | {
"content_hash": "36051774e414beabde3ac215e27d4e61",
"timestamp": "",
"source": "github",
"line_count": 144,
"max_line_length": 80,
"avg_line_length": 31.34027777777778,
"alnum_prop": 0.5329049412807445,
"repo_name": "r-shekhar/NYC-transport",
"id": "095a2fc12621cd35a22ed5195c3915dcd3ecf72f",
"size... |
from rest_framework import serializers
from referral_module import models
from django.contrib.auth.models import User
class UserSerializer(serializers.ModelSerializer):
class Meta:
model = User
fields = ('id', 'username', )
class UserReferrerSerializer(serializers.ModelSerializer):
user = ... | {
"content_hash": "57312f07c199caa0e46b04e8e78e0ca9",
"timestamp": "",
"source": "github",
"line_count": 89,
"max_line_length": 82,
"avg_line_length": 26.247191011235955,
"alnum_prop": 0.603167808219178,
"repo_name": "moneypark/whydjango",
"id": "c8f591471e2cceed1c4faac4af3759b50bd1b047",
"size": "2... |
""" --- Description ---
Module:
Logger.py
Abstract:
A module for logging
Modified:
threemeninaboat3247 2018/04/30
--- End ---
"""
# Standard library imports
import logging
logger = logging.getLogger('Kuchinawa Log')
# ログレベルの設定
logger.setLevel(10)
# ログのファイル出力先を設定
fh =... | {
"content_hash": "cd3536ca8e3de9c2809235ad05da499b",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 81,
"avg_line_length": 20.655172413793103,
"alnum_prop": 0.6861435726210351,
"repo_name": "threemeninaboat3247/kuchinawa",
"id": "f315277c03047d954514d2d9908c6f026aae74fa",
... |
from temboo.core.choreography import Choreography
from temboo.core.choreography import InputSet
from temboo.core.choreography import ResultSet
from temboo.core.choreography import ChoreographyExecution
import json
class CreateWantsToWatch(Choreography):
def __init__(self, temboo_session):
"""
Cre... | {
"content_hash": "51e3ea9c2e19995cb7929394e57121b0",
"timestamp": "",
"source": "github",
"line_count": 161,
"max_line_length": 206,
"avg_line_length": 51.5527950310559,
"alnum_prop": 0.6795180722891566,
"repo_name": "jordanemedlock/psychtruths",
"id": "0b204aecfe1aebe6aa257510cc98ec9ac8ba7aad",
"s... |
"""This module can be used for finding similar code"""
import re
import rope.refactor.wildcards
from rope.base import libutils
from rope.base import codeanalyze, exceptions, ast, builtins
from rope.refactor import (patchedast, wildcards)
from rope.refactor.patchedast import MismatchedTokenError
class BadNameInCheck... | {
"content_hash": "65c42a7604b57c47cfca664b602b88c5",
"timestamp": "",
"source": "github",
"line_count": 370,
"max_line_length": 79,
"avg_line_length": 33.74594594594595,
"alnum_prop": 0.5764856639436169,
"repo_name": "zrzka/blackmamba",
"id": "425f9ed955c27eab2741cfb496f3257747f5bbaf",
"size": "124... |
"""
flask_weixin
~~~~~~~~~~~~
Weixin implementation in Flask.
:copyright: (c) 2013 - 2015 by Hsiaoming Yang and its contributors.
:license: BSD, see LICENSE for more detail.
"""
import time
import hashlib
from datetime import datetime
try:
from lxml import etree
except ImportError:
from ... | {
"content_hash": "3062169b707fe425224d602e0a69004d",
"timestamp": "",
"source": "github",
"line_count": 406,
"max_line_length": 75,
"avg_line_length": 29.935960591133004,
"alnum_prop": 0.532170478854698,
"repo_name": "tonyseek/flask-weixin",
"id": "6bc10fd921e413745a1bad8924e0035c4a56eda1",
"size":... |
from google.protobuf.json_format import MessageToJson, Parse
from pyqrllib.pyqrllib import bin2hstr
from qrl.core import config
from qrl.core.misc import logger
from qrl.core.State import State
from qrl.generated import qrl_pb2
class BlockMetadata(object):
def __init__(self, pbdata=None):
se... | {
"content_hash": "7652b5504bdf76f4d49a7a62137e1702",
"timestamp": "",
"source": "github",
"line_count": 121,
"max_line_length": 91,
"avg_line_length": 36.06611570247934,
"alnum_prop": 0.620531622364803,
"repo_name": "cyyber/QRL",
"id": "80b85e439ff2de34bcf5ee1038f0a44cc4bb663b",
"size": "4519",
"... |
from __future__ import print_function
import re
from streamlink.plugin import Plugin
from streamlink.plugin.api import http
from streamlink.compat import urlparse, parse_qsl
from streamlink.plugin.api import useragents
from streamlink.plugin.api import validate
from streamlink.stream import HLSStream
from streamlink.s... | {
"content_hash": "7a521b9bf76f69ef538792b29fd7ff8e",
"timestamp": "",
"source": "github",
"line_count": 80,
"max_line_length": 104,
"avg_line_length": 40.3,
"alnum_prop": 0.5769230769230769,
"repo_name": "mmetak/streamlink",
"id": "37e9cd0eb4e257467b7c10e6255b683aad813783",
"size": "3224",
"binar... |
"""VIC test archiving command line interface"""
import argparse
from collections import OrderedDict
from datetime import datetime
from .run_tests import epilog, description, CustomFormatter
# -------------------------------------------------------------------- #
def main():
"""
Archive VIC tests
"""
... | {
"content_hash": "c6685a678cfe06ea4bf3903df20cbc41",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 76,
"avg_line_length": 34.62222222222222,
"alnum_prop": 0.43709884467265725,
"repo_name": "UW-Hydro/VIC",
"id": "f4c1f45ac7005faf6b4c6ce5acbc0a85d1b5b1c5",
"size": "1580",
... |
import time
import threading
import threadactive
class BackWorker(threadactive.Agent):
def tick(self):
threadactive.Agent.tick(self)
print("[%s][%d] front" % (threading.current_thread().getName(), time.clock()) )
self.print_in_front2()
self.print_in_back()
time.sleep(1)
... | {
"content_hash": "32fe9869d8c8ee3c2a6bb9bd1ad3f7ff",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 95,
"avg_line_length": 27.708333333333332,
"alnum_prop": 0.5639097744360902,
"repo_name": "sunjinopensource/threadactive",
"id": "76bdc5250c07d4f55321530d626811ef2485b296",
... |
import git
import os
class Updater(object):
def __init__(self, is_develop):
self.repo = git.Repo(os.getcwd())
self.branch = 'origin/master' if not is_develop else 'origin/develop'
def check(self):
self.repo.remote().fetch()
diff = self.repo.index.diff(self.branch)
ret... | {
"content_hash": "03e2de8e06c5d704fa918867dbf968e6",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 77,
"avg_line_length": 23.555555555555557,
"alnum_prop": 0.6037735849056604,
"repo_name": "parkourben99/SpeedOfPi",
"id": "67b9e41b34d09b169088dc247d4656f03a530193",
"size"... |
"""
Support for Xiaomi Mi Flora BLE plant sensor.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/sensor.miflora/
"""
from datetime import timedelta
import logging
import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA
from... | {
"content_hash": "7a601721e8a53e6fe7dfabce3222c5e2",
"timestamp": "",
"source": "github",
"line_count": 163,
"max_line_length": 78,
"avg_line_length": 31.809815950920246,
"alnum_prop": 0.6324011571841851,
"repo_name": "philipbl/home-assistant",
"id": "28906dfaef46d54f7730e86c0e4a7bef34b1d7ba",
"siz... |
from __future__ import unicode_literals
from django.http import Http404
class GetUserMixin(object):
"""
Mixin para selecionar o usuário que será utilizado.
"""
def get_user(self):
"""
Retorna o objeto do usuário.
Por padrão seleciona o usuário em `self.request.user`.
... | {
"content_hash": "453bbe81a04752382a2a61e9b9fd8731",
"timestamp": "",
"source": "github",
"line_count": 174,
"max_line_length": 118,
"avg_line_length": 32.741379310344826,
"alnum_prop": 0.5973319290854836,
"repo_name": "eduardoklosowski/django-userviews",
"id": "1d4c565d5e58ca210cc30acae6bde40d89996b... |
import random, shlex
import driver, utils, vcoptparse, workload_runner
def prepare_option_parser_mode_flags(opt_parser):
opt_parser["valgrind"] = vcoptparse.BoolFlag("--valgrind")
opt_parser["valgrind-options"] = vcoptparse.StringFlag("--valgrind-options", "--leak-check=full --track-origins=yes --child-silent... | {
"content_hash": "ffa5b87b1ef9dde08a314f91001c85f4",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 151,
"avg_line_length": 40.255319148936174,
"alnum_prop": 0.6686046511627907,
"repo_name": "grandquista/rethinkdb",
"id": "0cf611d15d9923fbf63a20ee3ec7b9fea3d39f9e",
"size"... |
__author__ = 'tan'
from user_admin import UserAdminUIModule, UserAdminHandler | {
"content_hash": "e3f7499a3a7252d811ef10ffcbdc7c94",
"timestamp": "",
"source": "github",
"line_count": 2,
"max_line_length": 58,
"avg_line_length": 38.5,
"alnum_prop": 0.7922077922077922,
"repo_name": "tanmaykm/JuliaBox",
"id": "881f8f3ef957127992494717ad440c9a371df497",
"size": "77",
"binary": ... |
import ConfigParser
Config = ConfigParser.ConfigParser()
Config.read('ucas.ini')
import logging
ROOT = Config.get("server", "root")
STATIC_FILES = ('favicon.ico', 'robots.txt', 'css/ucas.css',
'img/glyphicons-halflings.png', )
BASE_URL = "http://modulecatalogue.nottingham.ac.uk/nottingham/asp/moduled... | {
"content_hash": "9b4c3c4016ee3040a206e980b26be5d6",
"timestamp": "",
"source": "github",
"line_count": 436,
"max_line_length": 85,
"avg_line_length": 33.357798165137616,
"alnum_prop": 0.5477860286028603,
"repo_name": "mor1/ucas-www",
"id": "299979578cd059c440a76b83724e9f4b71e1604c",
"size": "15931... |
"""
==============================================================
Compute seed-based time-frequency connectivity in sensor space
==============================================================
Computes the connectivity between a seed-gradiometer close to the visual cortex
and all other gradiometers. The connectivity i... | {
"content_hash": "7e50bb43698997ac25c909680ad0ed09",
"timestamp": "",
"source": "github",
"line_count": 81,
"max_line_length": 79,
"avg_line_length": 36.06172839506173,
"alnum_prop": 0.6607326258130777,
"repo_name": "mne-tools/mne-tools.github.io",
"id": "047a4b519a054eccfd1ad8f954dad0fb896ee042",
... |
import sys
import sqlite3
try:
conn = sqlite3.connect('./webvirtmgr.sqlite3')
cur = conn.cursor()
allservers = cur.execute("select id,name,hostname,login,password,type from servers_compute").fetchall()
for i in allservers:
print i
finally:
cur.close()
conn.close()
| {
"content_hash": "96a816fcf175fbd8eb903036453d3f18",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 107,
"avg_line_length": 24.916666666666668,
"alnum_prop": 0.6755852842809364,
"repo_name": "lichengshuang/createvhost",
"id": "d8e697e24b3ed72a60d007400e32d93ea4d6f543",
"s... |
"""This test unit checks node attributes that are persistent (AttributeSet)."""
from __future__ import print_function
from __future__ import absolute_import
import sys
from distutils.version import LooseVersion
import numpy
from numpy.testing import assert_array_equal, assert_almost_equal
import tables
from tables i... | {
"content_hash": "f66f73e74ca1378a378365d8134bcfe4",
"timestamp": "",
"source": "github",
"line_count": 1761,
"max_line_length": 80,
"avg_line_length": 37.65758091993186,
"alnum_prop": 0.5676996154716127,
"repo_name": "gdementen/PyTables",
"id": "a6f924f4786adfccae4b9d1793c45c56dc5a6f5e",
"size": "... |
import urllib.parse
import requests
from zope.interface import implementer
from warehouse import tasks
from warehouse.cache.origin.interfaces import IOriginCache
class UnsuccessfulPurge(Exception):
pass
@tasks.task(bind=True, ignore_result=True, acks_late=True)
def purge_key(task, request, key):
cacher =... | {
"content_hash": "f9caf00bf52a0b8b9e521b1db7b1aaae",
"timestamp": "",
"source": "github",
"line_count": 96,
"max_line_length": 87,
"avg_line_length": 27.65625,
"alnum_prop": 0.5969868173258004,
"repo_name": "dstufft/warehouse",
"id": "ac94b67d03b940e0a5d43f3ab03a65dd8df385c3",
"size": "3196",
"bi... |
"""This is a configuration file for the ajax lookups for the proteins app.
See http://code.google.com/p/django-ajax-selects/ for information about configuring the ajax lookups.
"""
from proteins.models import Protein
from django.db.models import Q
from django.utils.html import escape
from ajax_select import LookupC... | {
"content_hash": "83612d2509669cd79cc545cbda0fb390",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 103,
"avg_line_length": 32.17948717948718,
"alnum_prop": 0.6956175298804781,
"repo_name": "davebridges/ExperimentDB",
"id": "0fcbd91a9ae8ed9d298d1058a8098cebb860c98d",
"siz... |
from __future__ import print_function
import base64
import os
import sys
if __name__ == "__main__":
# create font data chunk for embedding
font = "Tests/images/courB08"
print(" f._load_pilfont_data(")
print(" # %s" % os.path.basename(font))
print(" BytesIO(base64.decodestring(b''... | {
"content_hash": "28658d9399e19796b886c5afa9772b14",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 63,
"avg_line_length": 34.86666666666667,
"alnum_prop": 0.5927342256214149,
"repo_name": "keremgocen/demo-gui-python",
"id": "9997e981bf7a8dfa4429827424ce53ac6ea990ec",
"si... |
from read_data import read_from_file,read_nell_relations,get_relation_fname,get_node
from nltk.stem.snowball import SnowballStemmer
from nltk import word_tokenize,pos_tag
from predicate_extraction_set_matching import set_matching
import operator,sys
from nltk.corpus import stopwords
from nltk.stem.snowball import Snowb... | {
"content_hash": "c2ef7de7ac58d6c95de192dea040d289",
"timestamp": "",
"source": "github",
"line_count": 106,
"max_line_length": 84,
"avg_line_length": 29.12264150943396,
"alnum_prop": 0.6890184645286687,
"repo_name": "vedsarkushwaha/KBH_NELL",
"id": "de0f7aa83efa71a7b08f93af4479a2951a0b15ca",
"size... |
from datetime import datetime
import sys
import yaml
from config_parser import OSConfigParser, print_comments, show_header, \
format_var_name, value_to_yaml
def print_ansible_conf(parser, prefix, namespace):
values = parser.values
for section in values:
print '\n## [{0}] #... | {
"content_hash": "fc00cf2c8370200c57454c6719fb88a1",
"timestamp": "",
"source": "github",
"line_count": 77,
"max_line_length": 72,
"avg_line_length": 28.25974025974026,
"alnum_prop": 0.53125,
"repo_name": "stackio/ansible-openstack-config-gen",
"id": "d490cdc3cfc452ea518e36377111edb7b2afafa0",
"siz... |
import hashlib
from ledger.util import count_bits_set
class TreeHasher(object):
"""Merkle hasher with domain separation for leaves and nodes."""
def __init__(self, hashfunc=hashlib.sha256):
self.hashfunc = hashfunc
def __repr__(self):
return "%s(%r)" % (self.__class__.__name__, self.has... | {
"content_hash": "11ca168b00da16125c8a97a5969f5173",
"timestamp": "",
"source": "github",
"line_count": 76,
"max_line_length": 80,
"avg_line_length": 37.35526315789474,
"alnum_prop": 0.5695667488552307,
"repo_name": "evernym/ledger",
"id": "3c1baaeb2fc5b56b9a8bf694eaa0a7cb5920bebe",
"size": "2839",... |
import os
import sys
import unittest
from contextlib import contextmanager
from functools import partial
from pathlib import Path
from typing import Any, Iterator, List, Optional, Tuple
import pyink
from pyink.debug import DebugVisitor
from pyink.mode import TargetVersion
from pyink.output import diff, err, out
PYTHO... | {
"content_hash": "3a9a05a2d35e40f5c31847cb9d1fec4f",
"timestamp": "",
"source": "github",
"line_count": 161,
"max_line_length": 87,
"avg_line_length": 32.79503105590062,
"alnum_prop": 0.6505681818181818,
"repo_name": "google/pyink",
"id": "8e1783f25734cc4dd143c128a4a9f0304c09c3f5",
"size": "5280",
... |
"""
The host matching URL Map seems to be matching hosts well but fails in
generating/building URLs when there are same endpoints.
This patch makes strict host matching to ensure nothing skips host
matching.
Also see: https://github.com/mitsuhiko/werkzeug/issues/488
:copyright: (c) 2014 by Op... | {
"content_hash": "18079db67d27abb0dcae8fe63f12d12c",
"timestamp": "",
"source": "github",
"line_count": 71,
"max_line_length": 76,
"avg_line_length": 36.42253521126761,
"alnum_prop": 0.6152358855375096,
"repo_name": "usudaysingh/nereid",
"id": "0e07ae462f02a3cb00b687ca66a18ac3a3302ff8",
"size": "26... |
from __future__ import unicode_literals
from ..utils import ApplyMask
def test_ApplyMask_inputs():
input_map = dict(args=dict(argstr='%s',
),
environ=dict(nohash=True,
usedefault=True,
),
ignore_exception=dict(nohash=True,
usedefault=True,
),
in_file=dict(argstr='%s',
mandatory... | {
"content_hash": "36104bd12f424df52b2b48a0eb1082b4",
"timestamp": "",
"source": "github",
"line_count": 64,
"max_line_length": 69,
"avg_line_length": 24.734375,
"alnum_prop": 0.5963360707517372,
"repo_name": "mick-d/nipype",
"id": "2d59dc9ad5ba3fa8658faed89e23b759b07409f0",
"size": "1637",
"binar... |
"""
Some utilities for work with units of physical quantities.
"""
try:
import sympy as sm
except ImportError:
sm = None
from sfepy.base.base import *
default_units_of_basic_quantities = {
'length' : 'm',
'time' : 's',
'mass' : 'kg',
'temperature' : 'C',
}
# Cannot use N for Newton as it is a... | {
"content_hash": "df2e3609e3fb253d99058d7508220b96",
"timestamp": "",
"source": "github",
"line_count": 237,
"max_line_length": 81,
"avg_line_length": 24.974683544303797,
"alnum_prop": 0.5484034465281298,
"repo_name": "olivierverdier/sfepy",
"id": "4a64dee76a93c5d33840cd77778a9c305832fa43",
"size":... |
import itertools
def invalid_preamble_number(numbers, preamble):
for p in range(preamble, len(numbers)):
if not any(a + b == numbers[p] for a, b in itertools.combinations(numbers[p - preamble:p], 2)):
yield numbers[p]
def contiguous_set_code(numbers, total):
num_set = []
num_set_sum ... | {
"content_hash": "c0d48b11849c0a3bb0c15187f53754a8",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 103,
"avg_line_length": 24.970588235294116,
"alnum_prop": 0.5889281507656066,
"repo_name": "bbglab/adventofcode",
"id": "dba447fc4efb42d90bb27e49782db65ddbc8497b",
"size": ... |
"""Support for Tesla binary sensor."""
import logging
from homeassistant.components.binary_sensor import DEVICE_CLASSES, BinarySensorEntity
from . import DOMAIN as TESLA_DOMAIN, TeslaDevice
_LOGGER = logging.getLogger(__name__)
async def async_setup_entry(hass, config_entry, async_add_entities):
"""Set up the ... | {
"content_hash": "bc7e2df7b6191932ac774d640e78e1f7",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 86,
"avg_line_length": 29.317073170731707,
"alnum_prop": 0.6239600665557404,
"repo_name": "titilambert/home-assistant",
"id": "01dc1aa44f0bdf002ef4de1173c7c59cb1e4a986",
"s... |
import re
from manuel import Document, Region, RegionContainer, Manuel
from mock import Mock
from testfixtures import compare, Comparison as C, TempDirectory
from testfixtures.manuel import Files,FileBlock,FileResult
from unittest import TestCase
class TestContainer(RegionContainer):
def __init__(self,attr,*block... | {
"content_hash": "dc5f6c76ed9084587ba15c77ceecca31",
"timestamp": "",
"source": "github",
"line_count": 228,
"max_line_length": 70,
"avg_line_length": 26.12280701754386,
"alnum_prop": 0.5008394895903291,
"repo_name": "beblount/Steer-Clear-Backend-Web",
"id": "10c92da086327fafb1d1e38a080dfec73d0c80cb"... |
""" Constants used by Home Assistant components. """
__version__ = "0.7.6.dev0"
# Can be used to specify a catch all when registering state or event listeners.
MATCH_ALL = '*'
# If no name is specified
DEVICE_DEFAULT_NAME = "Unnamed Device"
# #### CONFIG ####
CONF_LATITUDE = "latitude"
CONF_LONGITUDE = "longitude"
... | {
"content_hash": "3599f920d192018fb782291ca6b04b99",
"timestamp": "",
"source": "github",
"line_count": 171,
"max_line_length": 79,
"avg_line_length": 27.80701754385965,
"alnum_prop": 0.7282860147213459,
"repo_name": "pottzer/home-assistant",
"id": "4d5f68e24c5da530938d9629e1f31d8204f3a510",
"size"... |
import _plotly_utils.basevalidators
class ColorValidator(_plotly_utils.basevalidators.ColorValidator):
def __init__(
self, plotly_name="color", parent_name="scattergeo.selected.textfont", **kwargs
):
super(ColorValidator, self).__init__(
plotly_name=plotly_name,
parent_... | {
"content_hash": "bc2427374d34dd0ff9f25cd6f772f163",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 87,
"avg_line_length": 33.57142857142857,
"alnum_prop": 0.597872340425532,
"repo_name": "plotly/python-api",
"id": "16a39e52c660d57c325b68bc391c78912b48937d",
"size": "470"... |
"""
Exceptions for SATOSA
"""
class SATOSAError(Exception):
"""
Base SATOSA exception
"""
pass
class SATOSAConfigurationError(SATOSAError):
"""
SATOSA configuration error
"""
pass
class SATOSAStateError(SATOSAError):
"""
SATOSA state error.
"""
pass
class SATOSACr... | {
"content_hash": "21ad55e4e66fca8d0661bec075f33ff6",
"timestamp": "",
"source": "github",
"line_count": 69,
"max_line_length": 70,
"avg_line_length": 18.594202898550726,
"alnum_prop": 0.5775526110678099,
"repo_name": "irtnog/SATOSA",
"id": "02f3c0554f64074d51fb88cca667f558a34bde74",
"size": "1283",... |
import tensorflow as tf
import neuralnetwork
class SquaredLossOptimizer:
def __init__(self, network, tf_optimizer=tf.train.AdamOptimizer(0.0001), parameters=None, l2=None, summary_writer=None):
if not network.is_compiled():
raise Exception("Cannot run optimizer on uncompiled network!")
... | {
"content_hash": "c09f8b095d30fc186b9779bd94bcb790",
"timestamp": "",
"source": "github",
"line_count": 78,
"max_line_length": 124,
"avg_line_length": 44.833333333333336,
"alnum_prop": 0.6462682299113526,
"repo_name": "karolkuna/reinforcement-learning",
"id": "e7958dcea3cdded774be65abbb539e212caf4ec8... |
import sys
import argparse
import eve.ore
import eve.market
import eve.regions
progDescription = """
Fetches market data from eve-central and prints out a list of ore
values per m3.
"""
PRICE_TYPE_PERCENTILE = "percentile"
PRICE_TYPE_AVERAGE = "average"
PRICE_TYPE_MIN = "min"
PRICE_TYPE_MAX = "max"
PRICE_TYPE_DEFAU... | {
"content_hash": "e1bd37684a4fa3471ec22aff8da89271",
"timestamp": "",
"source": "github",
"line_count": 106,
"max_line_length": 89,
"avg_line_length": 30.57547169811321,
"alnum_prop": 0.7022523912372725,
"repo_name": "iwinulose/eve",
"id": "748cbe32aa9c4072012567eb49d08cce136d88d7",
"size": "4597",... |
from flask.ext.sqlalchemy import SQLAlchemy
db = SQLAlchemy() | {
"content_hash": "ea614a4a1937d424b43fb6221c11a1b0",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 43,
"avg_line_length": 20.666666666666668,
"alnum_prop": 0.8064516129032258,
"repo_name": "abacuspix/NFV_project",
"id": "508e673e1da5babd219fa2826acb9c227f29242a",
"size": ... |
import numpy as np
from pathlib import Path
from pySDC.helpers.stats_helper import get_sorted
from pySDC.implementations.problem_classes.AdvectionEquation_ND_FD import advectionNd
from pySDC.implementations.problem_classes.HeatEquation_ND_FD import heatNd_unforced
from pySDC.implementations.problem_classes.TestEquati... | {
"content_hash": "c8b1beef1190e10d31db2442843fe7f8",
"timestamp": "",
"source": "github",
"line_count": 271,
"max_line_length": 116,
"avg_line_length": 37.07380073800738,
"alnum_prop": 0.677913805115955,
"repo_name": "Parallel-in-Time/pySDC",
"id": "d8ae15df25d376930c76a99ab3e725cd2b7bc4e8",
"size"... |
import numpy as np
from astropy.units import si
from astropy.units import equivalencies as eq
from astropy.units import Unit
from astropy.units.quantity import SpecificTypeQuantity, Quantity
from astropy.units.decorators import quantity_input
__all__ = ['SpectralQuantity']
# We don't want to run doctests in the docst... | {
"content_hash": "533cda291420aca2c8dbb6d1e5d36038",
"timestamp": "",
"source": "github",
"line_count": 304,
"max_line_length": 128,
"avg_line_length": 39.875,
"alnum_prop": 0.6198647087939284,
"repo_name": "saimn/astropy",
"id": "cca0a94d69a06524e9c78c904a42dbf20dde00b0",
"size": "12122",
"binar... |
"""
Utility functions for pilgrim
"""
import mimetypes
from . import codecs
def __defaultopen(file):
import os, subprocess, sys
if os.name == "posix":
if sys.platform == "darwin":
cmd = "open"
cmd = "xdg-open"
elif os.name == "nt":
cmd = "start"
else:
ra... | {
"content_hash": "5c59d07e657cd608dad8f3056a0eb412",
"timestamp": "",
"source": "github",
"line_count": 63,
"max_line_length": 85,
"avg_line_length": 24.253968253968253,
"alnum_prop": 0.6086387434554974,
"repo_name": "shuge/pilgrim",
"id": "bd3acfd4f948742f56fbb9ee5382950ce97719f5",
"size": "1552",... |
__author__ = 'Yan QiDong'
__email__ = 'yanqd0@outlook.com'
__url__ = 'https://github.com/yanqd0/csft'
__copyright__ = 'Copyright (C) 2017 ' + __author__
__license__ = 'MIT License'
def _get_version(default='x.x.x.dev'):
try:
from pkg_resources import DistributionNotFound, get_distribution
except Impor... | {
"content_hash": "6e74fddd473dc5880ad12a2f083e73ae",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 72,
"avg_line_length": 28.833333333333332,
"alnum_prop": 0.6083815028901735,
"repo_name": "yanqd0/csft",
"id": "d829ad5c64134a14e37b8531476629aa33fef9dc",
"size": "692",
... |
"""Stream files from storage."""
from django.core.files.storage import DefaultStorage
from django_downloadview.files import StorageFile
from django_downloadview.views.path import PathDownloadView
class StorageDownloadView(PathDownloadView):
"""Serve a file using storage and filename."""
#: Storage the file t... | {
"content_hash": "e2fdecf34334440f69901dcb7b9b3e9c",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 79,
"avg_line_length": 33.42857142857143,
"alnum_prop": 0.7051282051282052,
"repo_name": "zerc/django-downloadview",
"id": "56a1662c5f4c047a7378eb00ad145bdb15fbbffc",
"size... |
import microbit
w = microbit.io.P0
short = 250
long = 500
w.set_digital_value(0)
while True:
if microbit.button_a.is_pressed():
w.set_digital_value(1)
microbit.sleep(short)
w.set_digital_value(0)
microbit.display.print('A')
if microbit.button_b.is_pressed():
w.set_digit... | {
"content_hash": "5efa66c1abf54159dcf3367c71013077",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 38,
"avg_line_length": 23.736842105263158,
"alnum_prop": 0.6208425720620843,
"repo_name": "jrmhaig/microbit_playground",
"id": "3bc500760792ec74c520a19c6b7ec184acdd5051",
"... |
from django.db import models
from django.utils.translation import ugettext as _
class SmsMessage(models.Model):
from_phone = models.CharField(max_length=255, blank=True, default='')
to_phones = models.TextField(blank=True, default='', help_text=_('"," seperated list of phone numbers'))
body = models.TextF... | {
"content_hash": "b00d57c6dd2d86f28068d53aed1c5399",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 108,
"avg_line_length": 43,
"alnum_prop": 0.7272727272727273,
"repo_name": "stefanfoulis/django-sendsms-admin",
"id": "25bcc0990c0d4d95b078011d127bc7783f3fed3b",
"size": "4... |
__license__ = 'MIT License <http://www.opensource.org/licenses/mit-license.php>'
__author__ = 'Lucas Theis <lucas@theis.io>'
__docformat__ = 'epytext'
from transform import Transform
from radialgaussianization import RadialGaussianization
from numpy.linalg import inv, slogdet
from numpy import vstack, dot, zeros
from ... | {
"content_hash": "d640da4487c447f62b218370900f3d50",
"timestamp": "",
"source": "github",
"line_count": 148,
"max_line_length": 101,
"avg_line_length": 25.466216216216218,
"alnum_prop": 0.6662244627222075,
"repo_name": "lucastheis/isa",
"id": "121e6249045137472b93b36408bb02b129606325",
"size": "376... |
from tempest.lib.common.utils import data_utils
from tempest.lib import exceptions as lib_exc
from tempest import test
from neutron.tests.api import base
from neutron.tests.tempest import config
CONF = config.CONF
class FloatingIPNegativeTestJSON(base.BaseNetworkTest):
@classmethod
@test.requires_ext(exten... | {
"content_hash": "28f4b306f597689da70990ad83043662",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 74,
"avg_line_length": 43.72,
"alnum_prop": 0.640896614821592,
"repo_name": "MaximNevrov/neutron",
"id": "e3ea90ae9ef14fa6aceea98b8fbc204ae76febbf",
"size": "2881",
"bina... |
MONGO_HOST = 'localhost'
MONGO_PORT = 27017
MONGO_DBNAME = 'uclass-api'
# Enable reads (GET), inserts (POST) and DELETE for resources/collections
# (if you omit this line, the API will default to ['GET'] and provide
# read-only access to the endpoint).
RESOURCE_METHODS = ['GET', 'POST', 'DELETE']
# Enable reads (GET)... | {
"content_hash": "2f37717b042a9bd417d239ac90fac037",
"timestamp": "",
"source": "github",
"line_count": 59,
"max_line_length": 78,
"avg_line_length": 28.864406779661017,
"alnum_prop": 0.6147974163241339,
"repo_name": "wbashir/uclass-api",
"id": "6d1ddac0b2d6fc1043ce0a5e31e383bde40d7beb",
"size": "1... |
import autoslug.fields
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('blog', '0007_blogpost_image_credit'),
]
operations = [
migrations.AlterField(
model_name='blogpost',
name='slug',
field=autoslug.fields.Au... | {
"content_hash": "d4e4abb978f844a5c8c260bcb321daf9",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 141,
"avg_line_length": 26.058823529411764,
"alnum_prop": 0.6275395033860045,
"repo_name": "Clarity-89/clarityv2",
"id": "ec75f2560199ab9cf268d0e553a00fc528c222ce",
"size":... |
import pytest
import json
import time
from itertools import islice
from cbpro.authenticated_client import AuthenticatedClient
@pytest.fixture(scope='module')
def dc():
"""Dummy client for testing."""
return AuthenticatedClient('test', 'test', 'test')
@pytest.mark.usefixtures('dc')
class TestAuthenticatedCli... | {
"content_hash": "d066716f4e88e35e2693cf7d8b39dc8c",
"timestamp": "",
"source": "github",
"line_count": 208,
"max_line_length": 80,
"avg_line_length": 36.125,
"alnum_prop": 0.5920947564546181,
"repo_name": "danpaquin/GDAX-Python",
"id": "36ae1bebda4ed5f5b8a47ee28abd53877535902d",
"size": "7514",
... |
import sys
import os
from basic.constant import ROOT_PATH
from basic.common import makedirsforfile,checkToSkip,printStatus
from basic.annotationtable import readConcepts,readAnnotationsFrom
from svm import KERNEL_TYPE
from svmutil import svm_train
from fiksvm import svm_to_fiksvm, fiksvm_save_model, fiksvm_load_model... | {
"content_hash": "4cda010e7ff305962c3966ebdcfadb47",
"timestamp": "",
"source": "github",
"line_count": 123,
"max_line_length": 139,
"avg_line_length": 38.333333333333336,
"alnum_prop": 0.6167550371155885,
"repo_name": "li-xirong/image2label",
"id": "7a4953e05e1fdffd6debb810100128ae580e500d",
"size... |
def getoption(config, section, option):
try:
val = config.get(section,option).split(':')
except:
val = None
return val
def configuration(parent_package='',top_path=None):
import numpy
import fnmatch
import os
import sys
import ConfigParser
from numpy.distutils.misc_... | {
"content_hash": "8d6836f26ba748b2c4747fbf95edd3b7",
"timestamp": "",
"source": "github",
"line_count": 145,
"max_line_length": 86,
"avg_line_length": 39.42068965517242,
"alnum_prop": 0.5900979706088173,
"repo_name": "optimizers/pysparse",
"id": "1697922176dfdb3a4f19ca16871a0fa4e57b4168",
"size": "... |
from .base import FunctionalTest
from demoslogic.premises.models import Premise
from demoslogic.arguments.models import Argument
class NetworkGraphTest(FunctionalTest):
fixtures = ['fixtures\\testset.yaml']
def test_right_number_of_elements(self):
argument_count = Argument.objects.count()
prem... | {
"content_hash": "fbf2c8001e98c4952dd22e88b49cb38d",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 117,
"avg_line_length": 50.64705882352941,
"alnum_prop": 0.7154471544715447,
"repo_name": "amstart/demo",
"id": "e5a32f0609f61dd402a576eca1c60ad242fe73d1",
"size": "861",
... |
import sys, os, glob
if len(sys.argv)<2:
print("usage: python3", sys.argv[0], "typename");
sys.exit();
gen_type = sys.argv[1];
files = glob.glob("cvector_template*.h");
for f in files:
file_string = open(f).read();
out_string = file_string.replace("TYPE", gen_type);
print("Generating cvector_" + gen_type + f[16... | {
"content_hash": "b11ef7a2c9ab2964a110cc4a617bb89f",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 52,
"avg_line_length": 24.2,
"alnum_prop": 0.6239669421487604,
"repo_name": "rswinkle/CVector",
"id": "ebb7825b753b4fc82d7b75d84e3555ad88719374",
"size": "484",
"binary":... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.