text stringlengths 4 1.02M | meta dict |
|---|---|
"""
test.py
Copyright 2015 Jeroen Arnoldus <jeroen@repleo.nl>
THIS SOFTWARE IS SUPPLIED WITHOUT WARRANTY OF ANY KIND, AND MAY BE
COPIED, MODIFIED OR DISTRIBUTED IN ANY WAY, AS LONG AS THIS NOTICE
AND ACKNOWLEDGEMENT OF AUTHORSHIP REMAIN.
"""
from django.test import TestCase
class BaseTest(TestCase):
... | {
"content_hash": "b8df7bc828bc85d90eccc04a7db15369",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 66,
"avg_line_length": 29.842105263157894,
"alnum_prop": 0.7001763668430335,
"repo_name": "bjarnoldus/randomcab",
"id": "80bbea60bfca8521f49e00f1f520fe663f4fd3ca",
"size": ... |
from django.contrib import admin
from . import models
admin.site.register(models.AdminDeleteModel)
admin.site.register(models.ResizeCropModel)
admin.site.register(models.ResizeModel)
admin.site.register(models.SimpleModel)
admin.site.register(models.ThumbnailModel)
admin.site.register(models.MaxSizeModel)
admin.site.... | {
"content_hash": "753916500c541f90e4527ed639551458",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 45,
"avg_line_length": 33,
"alnum_prop": 0.8484848484848485,
"repo_name": "kowito/django-stdimage",
"id": "0abab8ba623fe820d226697ff5a954ba21cdc5ce",
"size": "396",
"bina... |
from ebs_deploy import out, get, parse_env_config, parse_option_settings
def add_arguments(parser):
"""
Args for the init command
"""
parser.add_argument('-e', '--environment', help='Environment name', required=False, nargs='+')
parser.add_argument('-w', '--dont-wait', help='Skip waiting for the a... | {
"content_hash": "24358f33d8bdba5318563c753ac03043",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 112,
"avg_line_length": 37.19444444444444,
"alnum_prop": 0.6310679611650486,
"repo_name": "cfeduke/ebs-deploy",
"id": "a303208036bb482484b68890acbff67cb64766ce",
"size": "1... |
from io import StringIO
import sys
import os
import bottleneck as bn
def update_readme():
# run benchmark suite while capturing output; indent
with Capturing() as bench_list:
bn.bench()
bench_list = [" " + b for b in bench_list]
# read readme
cwd = os.path.dirname(__file__)
readm... | {
"content_hash": "6b4017e30f93c72f5a16811e88e29098",
"timestamp": "",
"source": "github",
"line_count": 57,
"max_line_length": 77,
"avg_line_length": 28.68421052631579,
"alnum_prop": 0.6048929663608563,
"repo_name": "kwgoodman/bottleneck",
"id": "4d4d800a2daf686cd31a69966327320295164227",
"size": "... |
from xd.tool.main import main
from case import *
from redirect import *
import sys
class tests(TestCase):
def test_main_no_args(self):
main(['xd'])
def test_main_early_args(self):
with stdchannels_redirected():
main(['xd', '-d'])
| {
"content_hash": "1a4eaae77f3a669fbc64a781d75a3969",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 38,
"avg_line_length": 18.066666666666666,
"alnum_prop": 0.6125461254612546,
"repo_name": "esben/xd-tool",
"id": "5b106678a4926525aee201d21bbaad7f3729a4bf",
"size": "271",
... |
__author__ = 'jond'
import os
import re
from rdflib import Graph, Namespace
from pyproj import Proj, transform
v84 = Proj(proj="latlong",towgs84="0,0,0",ellps="WGS84")
v36 = Proj(proj="latlong", k=0.9996012717, ellps="airy",
towgs84="446.448,-125.157,542.060,0.1502,0.2470,0.8421,-20.4894")
vgrid = Proj(init=... | {
"content_hash": "9f08ed064b41ff660fee9405be93be3e",
"timestamp": "",
"source": "github",
"line_count": 86,
"max_line_length": 94,
"avg_line_length": 35.104651162790695,
"alnum_prop": 0.671745611129513,
"repo_name": "GMDSP-Linked-Data/RDF-work-in-progress",
"id": "14cb5a0bf1e2fc7a9f3aad5fb26af8d11e20... |
import math
import numpy as np
from skfeature.utility.sparse_learning import tree_lasso_projection, tree_norm
def group_fs(X, y, z1, z2, idx, **kwargs):
"""
This function implements supervised sparse group feature selection with least square loss, i.e.,
min_{w} ||Xw-y||_2^2 + z_1||w||_1 + z_2*sum_... | {
"content_hash": "1800e8da63edbe48396ae8a268559e94",
"timestamp": "",
"source": "github",
"line_count": 148,
"max_line_length": 130,
"avg_line_length": 35.7027027027027,
"alnum_prop": 0.5575321725965178,
"repo_name": "UltronAI/Deep-Learning",
"id": "04ebf6f82462cb2abe3634abf3f25e03e6d1ab47",
"size"... |
"""Permissions for Home Assistant."""
import logging
from typing import Any, Callable, Optional
import voluptuous as vol
from .const import CAT_ENTITIES
from .models import PermissionLookup
from .types import PolicyType
from .entities import ENTITY_POLICY_SCHEMA, compile_entities
from .merge import merge_policies # ... | {
"content_hash": "979eaf40c694db1cfd1d2350c27f8262",
"timestamp": "",
"source": "github",
"line_count": 79,
"max_line_length": 85,
"avg_line_length": 32.59493670886076,
"alnum_prop": 0.665242718446602,
"repo_name": "qedi-r/home-assistant",
"id": "f0e093953e1b183cb1047881d7412749335cacbe",
"size": "... |
import optparse
import os
import sys
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__),
'..', '..', '..', '..',
'build', 'android')))
from pylib import constants
from pylib.utils import findbugs
def main(a... | {
"content_hash": "16047726a1ab63d157e25730829a1638",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 79,
"avg_line_length": 29.285714285714285,
"alnum_prop": 0.5426829268292683,
"repo_name": "codenote/chromium-test",
"id": "f660f1f6221ce70ced1f3ee73c47ad482a63cf9a",
"size"... |
from google.protobuf import text_format, wrappers_pb2
from runtime.dbapi.connection import ResultSet
# NOTE(sneaxiy): importing sqlflow_pb2 consumes about
# 0.24s. Do not know how to shorten the import time.
from runtime.dbapi.table_writer import sqlflow_pb2
class ProtobufWriter(object):
def __init__(self, result... | {
"content_hash": "d58e6761c61b28962a6feb0a9e0d8346",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 78,
"avg_line_length": 37.62,
"alnum_prop": 0.6018075491759702,
"repo_name": "sql-machine-learning/sqlflow",
"id": "db565927090a970c31791eb31332edfe7cb1e193",
"size": "2481... |
"""Test p2p permission message.
Test that permissions are correctly calculated and applied
"""
from test_framework.test_node import ErrorMatch
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import (
assert_equal,
connect_nodes,
p2p_port,
)
class P2PPermissionsTest... | {
"content_hash": "29496e108578b47bc1e5378536b12c91",
"timestamp": "",
"source": "github",
"line_count": 99,
"max_line_length": 156,
"avg_line_length": 40.676767676767675,
"alnum_prop": 0.6123665259498385,
"repo_name": "FeatherCoin/Feathercoin",
"id": "40b28d7533b1f6ec19ace84da7c8a78a82eaf715",
"siz... |
"""Support for interfacing with the XBMC/Kodi JSON-RPC API."""
from datetime import timedelta
from functools import wraps
import logging
import re
import jsonrpc_base
from pykodi import CannotConnectError
import voluptuous as vol
from homeassistant.components.media_player import PLATFORM_SCHEMA, MediaPlayerEntity
fro... | {
"content_hash": "c471a66eaa7cb12fa426d83c3d350801",
"timestamp": "",
"source": "github",
"line_count": 886,
"max_line_length": 88,
"avg_line_length": 32.39729119638826,
"alnum_prop": 0.593471293199554,
"repo_name": "turbokongen/home-assistant",
"id": "6b849cb711b1bfb2a165af55e7721a7d408c3ca7",
"si... |
import os
os.environ['APP_CONFIG_FILE'] = '/home/ec2-user/training/config/default.py'
import logging
from logging.handlers import RotatingFileHandler
from flask import current_app
from flask_script import Manager
from app import app
import json
import requests
from prettytable import PrettyTable
# mise en place jou... | {
"content_hash": "e8c0683184c04fe570111a56794f76d4",
"timestamp": "",
"source": "github",
"line_count": 113,
"max_line_length": 128,
"avg_line_length": 35.32743362831859,
"alnum_prop": 0.6049599198396793,
"repo_name": "lanig35/flask-app",
"id": "b9b31f1168c17c20a8e555a6fcfa601114fd4236",
"size": "4... |
from PIL import Image, ImageFilter
#IMAGE PROPERTIES
name = "testimage.jpeg"
folder = "assets"+"/"
#Open Image
#returns the Image object
def open_img(img_name):
img = Image.open(img_name)
return img
#Sharpen Image Function
def sharpen_img(path,img_name):
img = open_img(img_name)
sharp_img = img.filter(ImageFilte... | {
"content_hash": "72af5a08e62de159e15e03e37ee8d8ee",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 82,
"avg_line_length": 25.23076923076923,
"alnum_prop": 0.7296747967479674,
"repo_name": "okoyenzube/python-goodness",
"id": "dfc5f795aed21b98adc7c87c7722ee322bb2971b",
"si... |
from peewee import Proxy
# create a placeholder database
db = Proxy()
def init_db(database_url):
"""
This function initializes the global database with the given url.
"""
# utility function to parse database urls
from playhouse.db_url import connect
# initialize the peewee database with th... | {
"content_hash": "09a7b312fdf6f0a0f0044c5f2bc4710f",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 73,
"avg_line_length": 29.384615384615383,
"alnum_prop": 0.7198952879581152,
"repo_name": "AlecAivazis/nautilus",
"id": "ea0e6069c6a186c26dfb1eb7d01741cd1c439d86",
"size": ... |
from __future__ import unicode_literals
from django.apps import AppConfig
class QuotesConfig(AppConfig):
name = 'quotes'
| {
"content_hash": "1d88ef2959b77d7228e4adfab7a37498",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 39,
"avg_line_length": 25.2,
"alnum_prop": 0.7619047619047619,
"repo_name": "nivbend/memoir",
"id": "259048cae92a92dda5cdb43e559323b320918a5a",
"size": "126",
"binary": fa... |
from .base import BaseController
from api_health.models.task import TaskForm
class NewTaskController(BaseController):
def get(self):
template = self.templateEnv.get_template('detail.html')
self.write(template.render(form=TaskForm()))
| {
"content_hash": "8d66df37fb27847e68ec2db688337a3c",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 63,
"avg_line_length": 28.555555555555557,
"alnum_prop": 0.7392996108949417,
"repo_name": "bigodines/api-health",
"id": "7118a99e758c68fc23dec6919a2c5aaf0b83da0d",
"size": "... |
"""
time_raycast
"""
from __future__ import absolute_import, division, print_function
import logging
import timeit
from mcedit2.util.raycast import rayCast
from mceditlib.geometry import Ray
from mceditlib.worldeditor import WorldEditor
log = logging.getLogger(__name__)
def main():
filename = "C:\Users\Rio\A... | {
"content_hash": "fc0210e9e6d40a01f568d1950100cbd3",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 82,
"avg_line_length": 30.708333333333332,
"alnum_prop": 0.6635006784260515,
"repo_name": "vorburger/mcedit2",
"id": "62c57c53132b1390c3ea52cc74f957dd3ac3e8ff",
"size": "73... |
import re
import pickle
from swtk.processors import *
from collections import defaultdict
class RareWordProcessor(Plugin):
help = 'Highlights rare words based on a provided dictionary (by default 5,000 words from Brown corpus).'
run_priority = 100
def __init__(self, dictionary_filename='./data/frequent_wo... | {
"content_hash": "6861c5fe88c17d8d20721da7d777ffd8",
"timestamp": "",
"source": "github",
"line_count": 46,
"max_line_length": 122,
"avg_line_length": 48.54347826086956,
"alnum_prop": 0.6166592028660994,
"repo_name": "pkorus/swtk",
"id": "8b1cea5259f05f593ac0a70fc3a3c7e785d97609",
"size": "2233",
... |
from __future__ import print_function
from itertools import islice
from future.builtins import bytes, next, object, range
from future.utils import iteritems, python_2_unicode_compatible, bchr
from past.builtins import unicode
from past.builtins import str as old_str
from future.utils import native_str
import os, re,... | {
"content_hash": "f93902ba569bd2e0772e9b8e32a9ee50",
"timestamp": "",
"source": "github",
"line_count": 363,
"max_line_length": 123,
"avg_line_length": 33.40495867768595,
"alnum_prop": 0.5918687118588157,
"repo_name": "franzinc/agraph-python",
"id": "805205f58307d32fcef422d4f80b2df249c11171",
"size... |
"""
Innovations algorithm for MA(q) and SARIMA(p,d,q)x(P,D,Q,s) model parameters.
Author: Chad Fulton
License: BSD-3
"""
import warnings
import numpy as np
from scipy.optimize import minimize
from statsmodels.tools.tools import Bunch
from statsmodels.tsa.innovations import arma_innovations
from statsmodels.tsa.statto... | {
"content_hash": "62a3861b154e7e05df629be511ed1617",
"timestamp": "",
"source": "github",
"line_count": 251,
"max_line_length": 79,
"avg_line_length": 38.50996015936255,
"alnum_prop": 0.6452513966480447,
"repo_name": "josef-pkt/statsmodels",
"id": "9526feb164de732f0688c4dd4e2967959edfae1f",
"size":... |
"""Gradient Boosted Regression Trees
This module contains methods for fitting gradient boosted regression trees for
both classification and regression.
The module structure is the following:
- The ``BaseGradientBoosting`` base class implements a common ``fit`` method
for all the estimators in the module. Regressio... | {
"content_hash": "c2e7d4484ade153bbb062da593fcb4f8",
"timestamp": "",
"source": "github",
"line_count": 1609,
"max_line_length": 91,
"avg_line_length": 38.36979490366687,
"alnum_prop": 0.5816123232421401,
"repo_name": "mehdidc/scikit-learn",
"id": "1e107190beff9dabe86d491da1df2eeb1554c46b",
"size":... |
"""Tests for optimizer_builder."""
import tensorflow as tf
from google.protobuf import text_format
from object_detection.builders import optimizer_builder
from object_detection.protos import optimizer_pb2
class LearningRateBuilderTest(tf.test.TestCase):
def testBuildConstantLearningRate(self):
learning_rate... | {
"content_hash": "efe0510287787c1fd37d3bbc2f768020",
"timestamp": "",
"source": "github",
"line_count": 188,
"max_line_length": 70,
"avg_line_length": 31.845744680851062,
"alnum_prop": 0.6594287623183565,
"repo_name": "jiaphuan/models",
"id": "ee380305bb258aa5afb57e5bfb75823a3510d48a",
"size": "667... |
u"""Test simulationSerial
:copyright: Copyright (c) 2016 RadiaSoft LLC. All Rights Reserved.
:license: http://www.apache.org/licenses/LICENSE-2.0.html
"""
from __future__ import absolute_import, division, print_function
import pytest
#: Used for a sanity check on serial numbers
_MIN_SERIAL = 10000000
def test_srw... | {
"content_hash": "33570f05548147969800f14a41f34ac4",
"timestamp": "",
"source": "github",
"line_count": 64,
"max_line_length": 71,
"avg_line_length": 33.015625,
"alnum_prop": 0.6426881211547563,
"repo_name": "mkeilman/sirepo",
"id": "e767446e7fbdcb4697571c493d6d0edcee7316bb",
"size": "2137",
"bin... |
import renderdoc as rd
import rdtest
class D3D11_Leak_Check(rdtest.TestCase):
demos_test_name = 'D3D11_Leak_Check'
demos_frame_cap = 50000
demos_frame_count = 10
demos_timeout = 120
def check_capture(self):
memory: int = rd.GetCurrentProcessMemoryUsage()
if memory > 500*1000*1000... | {
"content_hash": "910d9e4254454390ca512e8784cc3679",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 112,
"avg_line_length": 31.235294117647058,
"alnum_prop": 0.67984934086629,
"repo_name": "moradin/renderdoc",
"id": "2c1fb93b2da2206abc02c59939534a5638f541ad",
"size": "531... |
__author__ = "Stacy Smith"
__credits__ = "Jeremy Schulman, Nitin Kumar"
import unittest2 as unittest
from nose.plugins.attrib import attr
from mock import patch, MagicMock
import os
from jnpr.junos.exception import FactLoopError
from jnpr.junos import Device
from ncclient.manager import Manager, make_device_handler
... | {
"content_hash": "5a7f2fa88a91e3390c1ef13b3bac6147",
"timestamp": "",
"source": "github",
"line_count": 230,
"max_line_length": 78,
"avg_line_length": 42.48695652173913,
"alnum_prop": 0.5771592304543594,
"repo_name": "spidercensus/py-junos-eznc",
"id": "9a3396f195d9626abf12abda8ea43b42e69ac304",
"s... |
"""Offer time listening automation rules."""
from datetime import datetime
from functools import partial
import voluptuous as vol
from homeassistant.components import sensor
from homeassistant.const import (
ATTR_DEVICE_CLASS,
CONF_AT,
CONF_PLATFORM,
STATE_UNAVAILABLE,
STATE_UNKNOWN,
)
from homeas... | {
"content_hash": "c170ac410d9616f141f2ba72d2b80463",
"timestamp": "",
"source": "github",
"line_count": 188,
"max_line_length": 89,
"avg_line_length": 33.611702127659576,
"alnum_prop": 0.5204937490109195,
"repo_name": "mezz64/home-assistant",
"id": "a51eff004e5214834af750b6d4bd02bde4b83dce",
"size"... |
from __future__ import with_statement
import logging
import urllib
import string
import sys
import re
import traceback
import time
import util
import models
import BeautifulSoup
def find_checkout_form(soup):
return soup.find('form', {'name' : lambda(x):x=='process_form_2' or x=='checkout_form'}... | {
"content_hash": "0aa380b8e20dbe15c24037b53eb0359b",
"timestamp": "",
"source": "github",
"line_count": 303,
"max_line_length": 179,
"avg_line_length": 38.617161716171616,
"alnum_prop": 0.5490983676608837,
"repo_name": "bluestemscott/librarygadget",
"id": "77be820592c0c14f3f905eff4d46df463b133cee",
... |
from plotly.basedatatypes import BaseTraceHierarchyType as _BaseTraceHierarchyType
import copy as _copy
class Decreasing(_BaseTraceHierarchyType):
# class properties
# --------------------
_parent_path_str = "indicator.delta"
_path_str = "indicator.delta.decreasing"
_valid_props = {"color", "symb... | {
"content_hash": "e0e762de06170bf5ce16cff67c567be2",
"timestamp": "",
"source": "github",
"line_count": 167,
"max_line_length": 82,
"avg_line_length": 34.65269461077844,
"alnum_prop": 0.5436322792465872,
"repo_name": "plotly/python-api",
"id": "d4df99687fb5884fe4910e0676978a6a2aa8d0c4",
"size": "57... |
import sqlite3
import os
CACHE = None
def _init(cache_file):
"""Creates a new Cache object."""
global CACHE
CACHE = Cache(cache_file)
def get_cache(config_file=None):
"""Used to retrieve the global cache object."""
if CACHE is None:
_init(config_file)
return CACHE
class Cache():
... | {
"content_hash": "9f780120a1121b37df90135735ec4fb8",
"timestamp": "",
"source": "github",
"line_count": 110,
"max_line_length": 101,
"avg_line_length": 32.31818181818182,
"alnum_prop": 0.5673699015471168,
"repo_name": "yutiansut/QUANTAXIS",
"id": "6ae913020a2b039f0f6a6255eefac3326af0d804",
"size": ... |
'''
script.module.metadatautils
imdb.py
Get metadata from imdb
'''
from utils import requests, try_parse_int
import BeautifulSoup
from simplecache import use_cache
class Imdb(object):
'''Info from IMDB (currently only top250)'''
def __init__(self, simplecache=None, kodidb=None):
'''Initi... | {
"content_hash": "983b100cfe710bcd5f4a5322db42edbd",
"timestamp": "",
"source": "github",
"line_count": 68,
"max_line_length": 90,
"avg_line_length": 37.26470588235294,
"alnum_prop": 0.521310181531176,
"repo_name": "marcelveldt/script.module.metadatautils",
"id": "a66bc7539b47c018d5fbfdbb0d0bcb2f317d... |
from __future__ import print_function
class MaxHeap:
def __init__(self, arr, N):
self._arr = arr
self.N = N
for i in range(N/2, 0, -1):
self.down(i)
def up(self, k):
# While we aren't at the root and the parent is less than the current node, swap them
whil... | {
"content_hash": "48c21b17a0baa3d78ce8a97382fd57f7",
"timestamp": "",
"source": "github",
"line_count": 69,
"max_line_length": 98,
"avg_line_length": 31.014492753623188,
"alnum_prop": 0.5079439252336448,
"repo_name": "engineersamuel/algorithms-and-datastructures",
"id": "77b31c08cbfe2e0c33e33dcbb710c... |
from openprocurement.tender.belowthreshold.views.lot import TenderLotResource
from openprocurement.api.utils import (
get_now,
json_view,
context_unpack,
)
from openprocurement.tender.core.validation import (
validate_lot_data,
validate_patch_lot_data,
validate_tender_period_extension,
valid... | {
"content_hash": "8f621f0c3737a6ff686a181314619aa3",
"timestamp": "",
"source": "github",
"line_count": 70,
"max_line_length": 191,
"avg_line_length": 47.5,
"alnum_prop": 0.6535338345864662,
"repo_name": "openprocurement/openprocurement.tender.openua",
"id": "08f761add1b7437e58e864d588cc372702c5c286"... |
from __future__ import print_function
import numpy as np
import scipy.sparse as sp
from .lightfm_fast import (CSRMatrix, FastLightFM,
fit_logistic, predict_lightfm,
fit_warp, fit_bpr, fit_warp_kos)
CYTHON_DTYPE = np.float32
class LightFM(object):
def __i... | {
"content_hash": "8a0e6e8c40f0de55777369c5730017b5",
"timestamp": "",
"source": "github",
"line_count": 413,
"max_line_length": 108,
"avg_line_length": 43.026634382566584,
"alnum_prop": 0.5237478897017445,
"repo_name": "qqwjq/lightFM",
"id": "44ae7d1e73de7141e5cae9634eea3faab29a8000",
"size": "1777... |
"""Config flow for Cast."""
import voluptuous as vol
from homeassistant import config_entries
from homeassistant.helpers import config_validation as cv
from .const import CONF_IGNORE_CEC, CONF_KNOWN_HOSTS, CONF_UUID, DOMAIN
IGNORE_CEC_SCHEMA = vol.Schema(vol.All(cv.ensure_list, [cv.string]))
KNOWN_HOSTS_SCHEMA = vol... | {
"content_hash": "bc7964326fa3ab3d2891311675628164",
"timestamp": "",
"source": "github",
"line_count": 203,
"max_line_length": 85,
"avg_line_length": 35.05911330049261,
"alnum_prop": 0.5951946044681748,
"repo_name": "aronsky/home-assistant",
"id": "bb316f2b5119f5e8dfd16e812f8dc875cf2d0793",
"size"... |
from __future__ import absolute_import
import time
from threading import Event, Thread
from traits.api import Int, List
from pychron.globals import globalv
from pychron.loggable import Loggable
class StatusMonitor(Loggable):
# valve_manager = None
_stop_evt = None
_finished_evt = None
_clients = Lis... | {
"content_hash": "72a83b817f180d09fb139c772b17d2ab",
"timestamp": "",
"source": "github",
"line_count": 137,
"max_line_length": 79,
"avg_line_length": 28.496350364963504,
"alnum_prop": 0.48975409836065575,
"repo_name": "USGSDenverPychron/pychron",
"id": "d85b9fc02279f97fccc724ed4b2b8c35a464b7bf",
"... |
class vigenere:
__alpha = ""
def __init__(self):
self.__alpha = """ABCDEFGHIJKLMNOPQRSTUVWXYZ"""
@staticmethod
def adjust_key(key, l):
okey = key
while len(key) <= l:
key += okey
return key
def encode(self, plain, key):
plain = plain.upper()
... | {
"content_hash": "92c45f40cc0bf249ade3ae62aa12199d",
"timestamp": "",
"source": "github",
"line_count": 69,
"max_line_length": 102,
"avg_line_length": 26.52173913043478,
"alnum_prop": 0.5060109289617486,
"repo_name": "HCDevelopers/MultiEncoder",
"id": "69c388836d80fda37d761a98d44d708d2208d31c",
"si... |
"""Weather data coordinator for the AEMET OpenData service."""
from dataclasses import dataclass, field
from datetime import timedelta
import logging
from aemet_opendata.const import (
AEMET_ATTR_DATE,
AEMET_ATTR_DAY,
AEMET_ATTR_DIRECTION,
AEMET_ATTR_ELABORATED,
AEMET_ATTR_FORECAST,
AEMET_ATTR_... | {
"content_hash": "f05289dbbc0b250f89c65ddd47922dfd",
"timestamp": "",
"source": "github",
"line_count": 637,
"max_line_length": 88,
"avg_line_length": 33.17425431711146,
"alnum_prop": 0.5746261593791406,
"repo_name": "partofthething/home-assistant",
"id": "619429c9a5b2751925005cc47cf690a7f7d4b217",
... |
import os.path as op
import numpy as np
from numpy.testing import assert_array_almost_equal, assert_array_equal
from nose.tools import assert_true
from mne.datasets import testing
from mne import read_label, read_forward_solution, pick_types_forward
from mne.label import Label
from mne.simulation.source import genera... | {
"content_hash": "061d6af11daa79e0fa72d74dfe65d90b",
"timestamp": "",
"source": "github",
"line_count": 223,
"max_line_length": 77,
"avg_line_length": 33.55156950672646,
"alnum_prop": 0.5721732157177225,
"repo_name": "effigies/mne-python",
"id": "56a9b035040f4e84877f7d12654a272e068e4e7a",
"size": "... |
from pprint import pformat
from django.http import HttpResponse
from django.views.generic import View
from django_ssl_auth.fineid import user_dict_from_dn
class Fineid(View):
def get(self, request, **kwargs):
ctx = dict(
user_data=user_dict_from_dn(request.META[
'HTTP_X_SSL_U... | {
"content_hash": "06ae1667da12e51f5c71db5581e11b58",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 75,
"avg_line_length": 32.46153846153846,
"alnum_prop": 0.6303317535545023,
"repo_name": "tarkatronic/django-ssl-auth",
"id": "e96092c2708c185922ee2abf751c14024f90c18e",
"s... |
from oslo_db import exception as db_exc
from oslo_log import log as logging
from sqlalchemy import func
import sqlalchemy.orm as sa_orm
from glance.common import exception as exc
from glance.db.sqlalchemy.metadef_api import namespace as namespace_api
import glance.db.sqlalchemy.metadef_api.utils as metadef_utils
from ... | {
"content_hash": "f708eb3e17bac50a5cf3f3a5f0e25306",
"timestamp": "",
"source": "github",
"line_count": 137,
"max_line_length": 77,
"avg_line_length": 37.167883211678834,
"alnum_prop": 0.6696779261586803,
"repo_name": "rajalokan/glance",
"id": "48862522fe13510072c12f5207ed7a62436c0151",
"size": "57... |
import pickle
import stun
from kademlia.network import Server
from twisted.internet import reactor
from twisted.application import service, internet
from threading import Thread
##
# OBNode2
# This class implements the information held by a node on the OB network
class OBNode(Server):
##
# Constructor
... | {
"content_hash": "ebdc627a2944e4166dc4dd62abd01785",
"timestamp": "",
"source": "github",
"line_count": 91,
"max_line_length": 85,
"avg_line_length": 30.87912087912088,
"alnum_prop": 0.6117437722419928,
"repo_name": "cgsheeh/SFWR3XA3_Redevelopment",
"id": "d6419e10190936919578525f1e9b31c4aecea616",
... |
"""
This script is used for updating generated SDK files.
"""
import os
import fileinput
import re
__replacements = [
("import kubeflow.training", "from kubeflow.training.models import *"),
("kubeflow.training.models.v1\/.*.v1.", "V1"),
("kubeflow.training.models.kubeflow/org/v1/", "kubeflow_org_v1_"),
... | {
"content_hash": "0522bb76df2bb9c27fc0f80e78dab7dc",
"timestamp": "",
"source": "github",
"line_count": 57,
"max_line_length": 101,
"avg_line_length": 36.333333333333336,
"alnum_prop": 0.6446161274746499,
"repo_name": "kubeflow/training-operator",
"id": "a62ab3bd5ef2f55731173fb08e7536982d0e578a",
"... |
import unittest
import tempfile
import uuid
import os
import mittn.headlessscanner.dbtools as dbtools
import datetime
import socket
import json
import sqlalchemy
from sqlalchemy import create_engine, Table, Column, MetaData, exc, types
class dbtools_test_case(unittest.TestCase):
def setUp(self):
# Create ... | {
"content_hash": "43a5c1b1d766a282120e8b10f1911b2e",
"timestamp": "",
"source": "github",
"line_count": 174,
"max_line_length": 133,
"avg_line_length": 46.54597701149425,
"alnum_prop": 0.5233979503642425,
"repo_name": "mittn/mittn",
"id": "f8e9a18ff29d20fa79ba95829bc4294feb34e28f",
"size": "8099",
... |
"""
This module provides a @concurrent decorator primitive to
offload computations from mitmproxy's main master thread.
"""
from __future__ import absolute_import, print_function, division
import threading
class ReplyProxy(object):
def __init__(self, original_reply, script_thread):
self.original_reply = ... | {
"content_hash": "db7ff0e459d177c1ed0a2ac5511eb406",
"timestamp": "",
"source": "github",
"line_count": 63,
"max_line_length": 110,
"avg_line_length": 30.095238095238095,
"alnum_prop": 0.619198312236287,
"repo_name": "ikoz/mitmproxy",
"id": "f0f5e3cd50693278ee632d61f642500c0c533806",
"size": "1896"... |
import contextlib
import mock
from oslo.serialization import jsonutils
from nova import block_device
from nova import context
from nova import test
from nova.tests.unit import fake_instance
from nova.tests.unit import matchers
from nova.virt import block_device as driver_block_device
from nova.virt import driver
from... | {
"content_hash": "c1a14b168896a85867dc3c81a12460dd",
"timestamp": "",
"source": "github",
"line_count": 672,
"max_line_length": 78,
"avg_line_length": 40.40029761904762,
"alnum_prop": 0.5634830012155144,
"repo_name": "projectcalico/calico-nova",
"id": "b2aabf966fcdf557468ee321aa0bace9470b0d4a",
"si... |
from flask import Flask, render_template, redirect, session, request
import random
app = Flask(__name__)
app.secret_key='ThisIsSecure'
@app.route('/')
def index():
if not 'random' in session:
session['random']=random.randint(1,100)
session['format']='hide'
print(session['random'])
return... | {
"content_hash": "390180197228acad812ac42fbba36484",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 68,
"avg_line_length": 27.25531914893617,
"alnum_prop": 0.5846994535519126,
"repo_name": "jiobert/python",
"id": "e3aa13f5bd2a6ff8f1bbb8f9e4fa74114e43ac23",
"size": "1281",... |
import unittest
from os.path import join
from nilmtk.tests.testingtools import data_dir
from nilmtk import (Appliance, MeterGroup, ElecMeter, HDFDataStore,
global_meter_group, TimeFrame, DataSet)
from nilmtk.utils import tree_root, nodes_adjacent_to_root
from nilmtk.elecmeter import ElecMeterID
fro... | {
"content_hash": "d7074e05c911f1adf34940aaf93552a9",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 74,
"avg_line_length": 36.205128205128204,
"alnum_prop": 0.669971671388102,
"repo_name": "nilmtk/nilmtk",
"id": "d0973b4ae53666fc30abee66e9c1d58c54b6d082",
"size": "1412",
... |
__author__ = 'DSOWASP'
from twisted.internet import reactor, protocol
from time import sleep
# a client protocol
class EchoClient(protocol.Protocol):
"""Once connected, send a message, then print the result."""
def connectionMade(self): # 如果连接建立,则调用一次
message = by... | {
"content_hash": "42cee5562942bd2995bde09ac48948e2",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 96,
"avg_line_length": 35.01923076923077,
"alnum_prop": 0.5705656232839099,
"repo_name": "dianshen/python_day",
"id": "f5228e70771ff938e1ed9aaeaa2d9a0c89ccf70a",
"size": "2... |
"""
Support for the Locative platform.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/device_tracker.locative/
"""
import logging
from homeassistant.components.device_tracker import \
DOMAIN as DEVICE_TRACKER_DOMAIN
from homeassistant.components.loc... | {
"content_hash": "d26759a16f4f2ab80917930b634b9006",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 74,
"avg_line_length": 31.38095238095238,
"alnum_prop": 0.7192716236722306,
"repo_name": "nugget/home-assistant",
"id": "78090914b2c98cbf7ed589113af5d4e613d15461",
"size": ... |
import loggable
class Session(loggable.Loggable):
"""A session with a serial device is composed of a file like processing
object (eg a link), and a handler representing the context controlling the
link.
"""
link = None
handle = None
def __init__(self, link, handle):
self.link = link
self.ha... | {
"content_hash": "ecfee02ee8e3c2c048ca768c373e8c3b",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 76,
"avg_line_length": 21.58823529411765,
"alnum_prop": 0.662125340599455,
"repo_name": "bewest/insulaudit",
"id": "0960a17ee7f29446ed05785c811e2cc6780f8a05",
"size": "367"... |
from unittest import mock
from django.contrib.auth.models import Permission
from django.test import TestCase
from django.urls import reverse
from wagtail.core.models import Page
from wagtail.core.signals import page_unpublished
from wagtail.tests.testapp.models import SimplePage
from wagtail.tests.utils import Wagtai... | {
"content_hash": "ec1450d343d0865428fd75a5ff3d2498",
"timestamp": "",
"source": "github",
"line_count": 181,
"max_line_length": 141,
"avg_line_length": 41.92817679558011,
"alnum_prop": 0.6641191197786269,
"repo_name": "nimasmi/wagtail",
"id": "cf5b285dc65ec67c15b658982a7bec8fe5b76ddf",
"size": "758... |
import sys
import unicodedata
#reload(sys)
#sys.setdefaultencoding("utf-8")
class ParsingException(Exception):
reason = ''
def __init__(self, reason):
self.reason = reason
def __str__(self):
return 'Error: ' + self.reason
| {
"content_hash": "107005659c323c2cf223cf6f972867cc",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 38,
"avg_line_length": 18.428571428571427,
"alnum_prop": 0.6201550387596899,
"repo_name": "dhmodi/virtual_patient_assistant",
"id": "56c1a4d204e66f6e73616bc190f74f3f93acb061"... |
import random
print("***Guessing game***\n")
print('Instructions: Try to guess the number between 1 and 100.\n')
number_to_guess=random.randint(1,100)
number_user=int(input('Enter a number(1 to 100): '))
tries=1
difference=0
worst=number_user
while(number_to_guess!=number_user):
if (abs(number_to_guess-number_use... | {
"content_hash": "7be011d0ecb9b9fbb27dbf742edf713a",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 106,
"avg_line_length": 38.083333333333336,
"alnum_prop": 0.6663019693654267,
"repo_name": "onanism/CMPT101",
"id": "be60ca99fb72ba5a67a8ff28e33634a7ea853577",
"size": "104... |
from distutils.core import setup
setup(name='gmetric',
version='1.0',
author='Nick Galbreath',
author_email='nickg [at] modp [dot] com',
description='library and cmd-line to inject statistics into gmond. See http://ganglia.info',
url='http://code.google.com/p/embeddedgmetric/',
py_m... | {
"content_hash": "974884cf69a2d0cade9ded53e53a114f",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 99,
"avg_line_length": 38.666666666666664,
"alnum_prop": 0.646551724137931,
"repo_name": "edisona/embeddedgmetric",
"id": "4aef0e5b732bb230ede5fb4c76541a74c7ce9b90",
"size":... |
from zope.interface import Interface
class IDataTable(Interface):
"""
Basic methods to deal with jQuery datatables with souper.soup
"""
def column_info(self):
"""
info about the avaiable columns. It is a list with a dictionary that contains
information about each column
... | {
"content_hash": "4c8af127a752a05e9ad54610490f3ee0",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 93,
"avg_line_length": 35.73170731707317,
"alnum_prop": 0.5808873720136519,
"repo_name": "bluedynamics/souper.datatables",
"id": "eea76395386d76f805f44df6d75f2830032cf357",
... |
from __future__ import absolute_import
from __future__ import unicode_literals
import os
import sys
DEFAULT_TIMEOUT = 10
HTTP_TIMEOUT = int(os.environ.get('COMPOSE_HTTP_TIMEOUT', os.environ.get('DOCKER_CLIENT_TIMEOUT', 60)))
IMAGE_EVENTS = ['delete', 'import', 'pull', 'push', 'tag', 'untag']
IS_WINDOWS_PLATFORM = (sy... | {
"content_hash": "7eeea6cd6e5824678ee5d7155a50ccc6",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 103,
"avg_line_length": 30.620689655172413,
"alnum_prop": 0.7072072072072072,
"repo_name": "KalleDK/compose",
"id": "db5e2fb4f07983099568b542fd815d566579dc9e",
"size": "888... |
"""
Django settings for croquis project.
Generated by 'django-admin startproject' using Django 1.8.5.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.8/ref/settings/
"""
# Build path... | {
"content_hash": "7974a3510a1231222330d313cb8a17de",
"timestamp": "",
"source": "github",
"line_count": 103,
"max_line_length": 71,
"avg_line_length": 25.796116504854368,
"alnum_prop": 0.6902521640948438,
"repo_name": "kk6/Croquis",
"id": "dc21a41039b8f3b977ec53a165b85cbfee042d13",
"size": "2657",
... |
from lib.actions import OpsGenieBaseAction
class DisableIntegrationAction(OpsGenieBaseAction):
def run(self, name):
"""
Disable an integration in OpsGenie.
Args:
- name: Name of integration
Returns:
- dict: Data from OpsGenie
"""
payload = {"apiKe... | {
"content_hash": "0660d215080960e843323a96d0a4aa77",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 55,
"avg_line_length": 23.772727272727273,
"alnum_prop": 0.5258126195028681,
"repo_name": "armab/st2contrib",
"id": "a2378a89d74c55aad665bb7afaa6a1fbcd262fb2",
"size": "127... |
from .fullcontact import FullContact # noqa
| {
"content_hash": "85f2c5fec0963853350a86bdbd57da39",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 44,
"avg_line_length": 45,
"alnum_prop": 0.8,
"repo_name": "fullcontact/fullcontact.py",
"id": "7614896d31ea7d25094d92165e41aa43111d1cb3",
"size": "45",
"binary": false,
... |
"""
Player
The Player represents the game "account" and each login has only one
Player object. A Player is what chats on default channels but has no
other in-game-world existence. Rather the Player puppets Objects (such
as Characters) in order to actually participate in the game world.
Guest
Guest players are simpl... | {
"content_hash": "573b3f94740297dc3647ccd5c64876af",
"timestamp": "",
"source": "github",
"line_count": 102,
"max_line_length": 129,
"avg_line_length": 37.23529411764706,
"alnum_prop": 0.7235387045813586,
"repo_name": "MarsZone/DreamLand",
"id": "2cdfc06fdbe40b80bf32024934e1cfe7947143e0",
"size": "... |
from oslo_utils import strutils
from webob import exc
from nova.api.openstack import common
from nova.api.openstack.compute.schemas import migrate_server
from nova.api.openstack import extensions
from nova.api.openstack import wsgi
from nova.api import validation
from nova import compute
from nova import exception
AL... | {
"content_hash": "dc5b67d040c7d635348b8675c7b09235",
"timestamp": "",
"source": "github",
"line_count": 100,
"max_line_length": 79,
"avg_line_length": 41.35,
"alnum_prop": 0.6483675937122129,
"repo_name": "takeshineshiro/nova",
"id": "af3cf2167851858bb0d9da4c8f251aee1c467e89",
"size": "4765",
"bi... |
import re
import psutil
import requests
# This function will be called from Metrics or Resources class
def send(self, payload):
success = False
pause = 1
while not success and self.working:
try:
requests.post(self.host + '/event', data=payload)
success = True
except requests.ConnectionError:
... | {
"content_hash": "daaa2500878a695da5506180b176dc89",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 73,
"avg_line_length": 24.5,
"alnum_prop": 0.6492346938775511,
"repo_name": "andrei-alpha/seep-analytics",
"id": "a34caf6f1e134bf44e2ccf0dbbb0439233521973",
"size": "784",
... |
"""
Implements the functionality of the default authentication option page.
"""
from qt import SIGNAL
from datafinder.gui.admin.datastore_configuration_wizard.abstract_option_controller import AbstractOptionController
__version__ = "$Revision-Id:$"
class AuthenticationOptionController(Abstrac... | {
"content_hash": "58490403640a168ad5c9aa320291fbb1",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 133,
"avg_line_length": 39.125,
"alnum_prop": 0.6943556975505857,
"repo_name": "DLR-SC/DataFinder",
"id": "5e76f0749d611c09317d2ef9b610fae1eb074c44",
"size": "3572",
"bin... |
class HtmlStorer(object):
def store_db(self, html):
pass
def store_file(self, html):
pass
| {
"content_hash": "9871dcbecbc929d0b7e696a443203517",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 31,
"avg_line_length": 11.909090909090908,
"alnum_prop": 0.5114503816793893,
"repo_name": "junkainiu/dinner-helper",
"id": "e831dc031eec5289f4e91a6ca56017ea5247ebca",
"size... |
"""Generates grid anchors on the fly corresponding to multiple CNN layers.
Generates grid anchors on the fly corresponding to multiple CNN layers as
described in:
"SSD: Single Shot MultiBox Detector"
Wei Liu, Dragomir Anguelov, Dumitru Erhan, Christian Szegedy, Scott Reed,
Cheng-Yang Fu, Alexander C. Berg
(see Section... | {
"content_hash": "328fdea7927a6ce99e14ed5eb8ce6965",
"timestamp": "",
"source": "github",
"line_count": 327,
"max_line_length": 80,
"avg_line_length": 48.86544342507645,
"alnum_prop": 0.6390888040553226,
"repo_name": "tombstone/models",
"id": "5da24d4192c93a0e05a7dd48cce1ae823ae6b60d",
"size": "166... |
import warnings
from typing import Callable, Dict, Optional, Sequence, Tuple, Union
from google.api_core import grpc_helpers
from google.api_core import gapic_v1
import google.auth # type: ignore
from google.auth import credentials as ga_credentials # type: ignore
from google.auth.transport.grpc import SslCredential... | {
"content_hash": "b8da104f497af8854dd0352ad0bea240",
"timestamp": "",
"source": "github",
"line_count": 439,
"max_line_length": 91,
"avg_line_length": 44.2619589977221,
"alnum_prop": 0.6138644434151613,
"repo_name": "googleapis/python-dialogflow-cx",
"id": "5ea89caf70070ae981703445740fb0e317f3a21d",
... |
"""
==================
Find ECG artifacts
==================
Locate QRS component of ECG.
"""
# Authors: Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr>
#
# License: BSD (3-clause)
print(__doc__)
import numpy as np
import matplotlib.pyplot as plt
import mne
from mne import io
from mne.datasets import s... | {
"content_hash": "dbda51aa101b8a048cf2d5d0d125117d",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 79,
"avg_line_length": 27.104166666666668,
"alnum_prop": 0.5495772482705611,
"repo_name": "effigies/mne-python",
"id": "bc3f653c4f595a51d21b3e5b6fca55da274a36af",
"size": "... |
"""Tests for dataset_utils."""
from jax3d.projects.nesf.nerfstatic.datasets import dataset_utils
import pytest
def test_prefetch():
loaded_elems = []
def _iterator(num_iter):
for x in range(num_iter):
loaded_elems.append(x)
yield x
ds = dataset_utils.prefetch(_iterator(20), buffer_size=3)
... | {
"content_hash": "ef4458630135e30b7b43d34c721316ae",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 65,
"avg_line_length": 23.923076923076923,
"alnum_prop": 0.6237942122186495,
"repo_name": "google-research/jax3d",
"id": "5d244c4cffbd1e62c3246a7cff866d15d2fd218e",
"size":... |
import os
import ycm_core
# These are the compilation flags that will be used in case there's no
# compilation database set (by default, one is not set).
# CHANGE THIS LIST OF FLAGS. YES, THIS IS THE DROID YOU HAVE BEEN LOOKING FOR.
flags = [
'-DMUDUO_STD_STRING'
'-Wall',
'-Wextra',
#'-Werror',
#'-Wc++98-compat',
'... | {
"content_hash": "85c78e4320bb0f81ace865a23e4e5084",
"timestamp": "",
"source": "github",
"line_count": 137,
"max_line_length": 80,
"avg_line_length": 33.33576642335766,
"alnum_prop": 0.6805342675717101,
"repo_name": "liuluheng/levmu",
"id": "f65b8ae14f93d704a666207a3da7117b2ef455c2",
"size": "5966... |
"""A parser of RFC 2822 and MIME email messages."""
__all__ = ['Parser', 'HeaderParser', 'BytesParser', 'BytesHeaderParser',
'FeedParser', 'BytesFeedParser']
from io import StringIO, TextIOWrapper
from email.feedparser import FeedParser, BytesFeedParser
from email._policybase import compat32
class Parse... | {
"content_hash": "ff1a4f5cea9c7894af8664004eb8bbb7",
"timestamp": "",
"source": "github",
"line_count": 129,
"max_line_length": 78,
"avg_line_length": 37.98449612403101,
"alnum_prop": 0.6685714285714286,
"repo_name": "batermj/algorithm-challenger",
"id": "7db4da1ff081c1c66c1f0224d7543e68aa3b89a5",
... |
from reportlab.graphics.charts.legends import Legend
from reportlab.graphics.charts.lineplots import LinePlot
from reportlab.graphics.shapes import Drawing, _DrawingEditorMixin, String
from reportlab.graphics.charts.textlabels import Label
from excelcolors import *
class LineChart(_DrawingEditorMixin,Drawing):
def... | {
"content_hash": "e9a59f77e0efb49e6ee701ed38cb0842",
"timestamp": "",
"source": "github",
"line_count": 82,
"max_line_length": 172,
"avg_line_length": 51.21951219512195,
"alnum_prop": 0.5716666666666667,
"repo_name": "mattjmorrison/ReportLab",
"id": "b8b15790a934c1b0ec13a33a6c1dd334407e07af",
"size... |
from django.contrib.auth.models import User
from tastypie.cache import SimpleCache
from tastypie import fields
from tastypie.resources import ModelResource
from tastypie.authentication import SessionAuthentication
from tastypie.authorization import Authorization
from basic.models import Note, AnnotatedNote, SlugBasedNo... | {
"content_hash": "583677c4cd00f7ab094f92193c94a58a",
"timestamp": "",
"source": "github",
"line_count": 71,
"max_line_length": 59,
"avg_line_length": 28.422535211267604,
"alnum_prop": 0.6848364717542121,
"repo_name": "waveaccounting/django-tastypie",
"id": "6bd9ec6379a868a81165255195bc1a6356027a6b",
... |
from torch import nn
class ModuleProxyWrapper(nn.Module):
"""
Wrap a DistributedDataParallel module and forward requests for missing
attributes to the module wrapped by DDP (the twice-wrapped module).
Also forward calls to :func:`state_dict` and :func:`load_state_dict`.
Usage::
module.xy... | {
"content_hash": "f406f1b1b569631d3b835ca0ce8b9cbf",
"timestamp": "",
"source": "github",
"line_count": 51,
"max_line_length": 79,
"avg_line_length": 35.03921568627451,
"alnum_prop": 0.6105204252937885,
"repo_name": "pytorch/fairseq",
"id": "904dc0c202e09db244518836c0f061e0850cad61",
"size": "1965"... |
"""Config file processing (.vexrc).
"""
import os
import sys
import re
import shlex
import platform
from collections import OrderedDict
_IDENTIFIER_PATTERN = '[a-zA-Z][_a-zA-Z0-9]*'
_SQUOTE_RE = re.compile(r"'([^']*)'\Z") # NO squotes inside
_DQUOTE_RE = re.compile(r'"([^"]*)"\Z') # NO dquotes inside
_HEADING_RE = r... | {
"content_hash": "1613eab048aeb67983ba47108c5cca5d",
"timestamp": "",
"source": "github",
"line_count": 175,
"max_line_length": 78,
"avg_line_length": 32.074285714285715,
"alnum_prop": 0.5599501158026011,
"repo_name": "living180/vex",
"id": "31b3d9ec459c8348f5f945c0a37f4a2379cd3c34",
"size": "5613"... |
"""Constructs a variable encoder based on an encoder spec."""
from typing import Dict, List, Optional
import numpy as np
import tensorflow as tf
from covid_epidemiology.src.models.encoders import gam_encoder
from covid_epidemiology.src.models.encoders import variable_encoders
from covid_epidemiology.src.models.shared ... | {
"content_hash": "61e6a08ceacbf51232b0cfc89b49c478",
"timestamp": "",
"source": "github",
"line_count": 106,
"max_line_length": 80,
"avg_line_length": 38.91509433962264,
"alnum_prop": 0.6783030303030303,
"repo_name": "google-research/google-research",
"id": "24dd1809d974b526e6065016c84217a821667fba",... |
import copy
from tempest.lib.api_schema.response.compute.v2_16 import servers \
as serversv216
# Compute microversion 2.19:
# 1. New attributes in 'server' dict.
# 'description'
get_server = copy.deepcopy(serversv216.get_server)
get_server['response_body']['properties']['server'][
'properties'].update({'... | {
"content_hash": "3e581ba466a5747348fa52d1ae053a9a",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 76,
"avg_line_length": 48.816326530612244,
"alnum_prop": 0.7261705685618729,
"repo_name": "cisco-openstack/tempest",
"id": "b6c3c1496518afd603fc0d73254d7528c54029ef",
"size... |
from src.base.solution import Solution
from src.tests.part2.q145_test_bitree_postorder import BiTreePostOrderTestCases
class BiTreePostOrder(Solution):
def gen_test_cases(self):
return BiTreePostOrderTestCases()
def run_test(self, input):
return self.postorderTraversal(input)
def postord... | {
"content_hash": "12b5e3981321bc48834d54af64b16548",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 79,
"avg_line_length": 25.81578947368421,
"alnum_prop": 0.5188583078491336,
"repo_name": "hychrisli/PyAlgorithms",
"id": "fd6271a9127fd8e508ee5fda93a824e194bbfb17",
"size":... |
from tastypie_nonrel.resources import MongoResource, MongoListResource
from django.conf.urls.defaults import url
from tastypie.utils import trailing_slash
from tastypie.fields import (CharField,
ForeignKey,
)
from tastypie.authorization import Authorization
fr... | {
"content_hash": "1d6d382c889e0f23e656e139e7b24b1f",
"timestamp": "",
"source": "github",
"line_count": 124,
"max_line_length": 100,
"avg_line_length": 40.08870967741935,
"alnum_prop": 0.5375176020921344,
"repo_name": "andresdouglas/django-tastypie-nonrel",
"id": "6aa81d30fe4165734744ca3aaaf38d58f094... |
import web, os
from configobj import ConfigObj
conf = ConfigObj(os.path.join(os.path.dirname(os.path.realpath(__file__)), '../config.ini'))
db_info = conf['DB']
db_xpmanager = web.database(dbn='mysql', db = 'xpmanager', user = db_info['USER'], pw= db_info['PASS'], host = db_info['HOST'])
db_xpmanager.printing = False
| {
"content_hash": "fdecd91b9c4da8f89eff0bba7cee8f89",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 127,
"avg_line_length": 45.714285714285715,
"alnum_prop": 0.684375,
"repo_name": "bizet/xpmanager",
"id": "aada360f96af7a03646d5b9a4d608a01df849ffd",
"size": "320",
"binar... |
import datetime
import os
from django.conf import settings
from olympia.amo.tests import TestCase
from olympia.addons.models import Addon
from olympia.devhub.cron import update_blog_posts
from olympia.devhub.tasks import convert_purified
from olympia.devhub.models import BlogPost
class TestRSS(TestCase):
def t... | {
"content_hash": "0c0e1ab11acfe931ea074f1fea893bd2",
"timestamp": "",
"source": "github",
"line_count": 54,
"max_line_length": 63,
"avg_line_length": 29,
"alnum_prop": 0.6334610472541508,
"repo_name": "Prashant-Surya/addons-server",
"id": "a3109c190cc5d9c3429d1c84739c4c04f4acffa2",
"size": "1566",
... |
import datetime
import json
import re
import sys
import sqlalchemy
from flask import request
from ggrc.settings import CUSTOM_URL_ROOT
from ggrc.utils import benchmarks
class GrcEncoder(json.JSONEncoder):
"""Custom JSON Encoder to handle datetime objects and sets
from:
`http://stackoverflow.com/questions/... | {
"content_hash": "508bc78145439f24ee55045de35a07d7",
"timestamp": "",
"source": "github",
"line_count": 266,
"max_line_length": 117,
"avg_line_length": 26.703007518796994,
"alnum_prop": 0.657609460791215,
"repo_name": "plamut/ggrc-core",
"id": "7f79c899d59b6cd795a5e1ae0d205c44899b1131",
"size": "72... |
import json
prev = json.load(open('data/enriched.json'))
curr = json.load(open('data/pages_parsed.json'))
exts_id = set(ext['ext_id'] for ext in curr)
for ext in prev:
if ext['ext_id'] not in exts_id:
ext['deleted'] = True
curr.append(ext)
json.dump(curr, open('data/_merged.json','w'), indent=2) | {
"content_hash": "6d090062d8392bd0376297b9fcfe43ac",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 56,
"avg_line_length": 23.46153846153846,
"alnum_prop": 0.6688524590163935,
"repo_name": "mdamien/chrome-extensions-archive",
"id": "08f063faf14f2a1b3379832ade9fa2700bc2a054"... |
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('content', '0002_auto_20160217_0802'),
]
operations = [
migrations.AlterField(
model_name='ourstory',
name='order',
... | {
"content_hash": "9d52b39e7746d14eb4d8c29a537e79ca",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 118,
"avg_line_length": 24.833333333333332,
"alnum_prop": 0.5592841163310962,
"repo_name": "djangogirlscodecamp/lightandleadership",
"id": "71c92291d1f0286be20dfc872e16136a54... |
from __future__ import unicode_literals
import os
DEBUG = False
ALLOWED_HOSTS = ['*']
LANGUAGE_CODE = 'en-us'
ROOT_URLCONF = 'urls'
SECRET_KEY = '12345abcd'
SITE_ID = 1
TIME_ZONE = 'UTC'
USE_I18N = True
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django_core',
'django_... | {
"content_hash": "2149bfe3d112c1b0675cb6f91b18c4f4",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 78,
"avg_line_length": 22.05263157894737,
"alnum_prop": 0.6670644391408115,
"repo_name": "InfoAgeTech/django-core",
"id": "b591288888fb532a7efcf72183a79e1cbaed0e56",
"size"... |
import glob
import os
import sys
import ah_bootstrap
from setuptools import setup
#A dirty hack to get around some early import/configurations ambiguities
if sys.version_info[0] >= 3:
import builtins
else:
import __builtin__ as builtins
builtins._ASTROPY_SETUP_ = True
from astropy_helpers.setup_helpers impor... | {
"content_hash": "7524595c1fb3d3300011269ed008960c",
"timestamp": "",
"source": "github",
"line_count": 134,
"max_line_length": 79,
"avg_line_length": 34.5,
"alnum_prop": 0.7209604153147307,
"repo_name": "profxj/xastropy",
"id": "390f6ab343b4244de11e56d988837d90b72c121e",
"size": "4710",
"binary"... |
import os
import re
import random
import unittest
import ConfigParser
import itertools
import json
import uuid
from oauth2client.client import SignedJwtAssertionCredentials
import gspread
CONFIG_FILENAME = os.path.join(os.path.dirname(__file__), 'tests.config')
CREDS_FILENAME = os.path.join(os.path.dirname(__file__... | {
"content_hash": "501cd0a388a9ed926eefccc3030be273",
"timestamp": "",
"source": "github",
"line_count": 480,
"max_line_length": 79,
"avg_line_length": 33.797916666666666,
"alnum_prop": 0.5888553288540961,
"repo_name": "rohit91/gspread",
"id": "ebbd074b0e890e2bbc2f2d8fea4083897291ed0c",
"size": "162... |
try:
from unittest2 import TestCase
except ImportError:
from unittest import TestCase
assert TestCase
| {
"content_hash": "0402a80e3ab6e628b6599547b357df23",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 34,
"avg_line_length": 18.5,
"alnum_prop": 0.7837837837837838,
"repo_name": "hubertokf/lupsContextServer",
"id": "9e449e63a6f2c1bb64a354034b7964751d9a41d9",
"size": "111",
... |
from zeit.cms.i18n import MessageFactory as _
from zeit.content.article.edit.interfaces import IBox
import grokcore.component as grok
import zeit.cms.content.property
import zeit.cms.content.reference
import zeit.cms.related.related
import zeit.content.article.edit.block
import zeit.content.article.edit.interfaces
impo... | {
"content_hash": "b40f7c64df1dd7910d9104a5f94d499b",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 72,
"avg_line_length": 30.1875,
"alnum_prop": 0.7363699102829537,
"repo_name": "ZeitOnline/zeit.content.article",
"id": "65732e8c1f6355e01d836d207a3d32da746c436a",
"size": ... |
from ._sql import *
| {
"content_hash": "c78e16be6d4d0032fab24dd3c30fb0f2",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 19,
"avg_line_length": 20,
"alnum_prop": 0.65,
"repo_name": "hsoft/musicguru",
"id": "ac69b325469c9e25d65bad34dc47f73399eba406",
"size": "20",
"binary": false,
"copies":... |
'''
Created on Feb 17, 2015
@author: Jorge Onieva
Common functions that can be useful in any Slicer module development
'''
import os
import os.path as path
import logging
from __main__ import slicer, vtk, qt
from . import Util
class SlicerUtil:
#######################################
#### Constants / Propert... | {
"content_hash": "3bf0f669a4062d3cd9f2f243dd3bc982",
"timestamp": "",
"source": "github",
"line_count": 965,
"max_line_length": 172,
"avg_line_length": 43.26839378238342,
"alnum_prop": 0.6436030080950328,
"repo_name": "acil-bwh/SlicerCIP",
"id": "0045932afaf1ee1530208b9466a7bddbb9f59629",
"size": "... |
from unittest import TestCase
from py4j.java_gateway import java_import
from pymrgeo.mrgeo import MrGeo
from rastermapoptestsupport import RasterMapOpTestSupport
class CropTests(TestCase):
_mrgeo = None
@classmethod
def setUpClass(cls):
print("*** CropTests.setUpClass()")
cls._mrgeo = M... | {
"content_hash": "1d967f8a65486c412cbc076ee17da110",
"timestamp": "",
"source": "github",
"line_count": 102,
"max_line_length": 120,
"avg_line_length": 41.40196078431372,
"alnum_prop": 0.5910490172862893,
"repo_name": "ngageoint/mrgeo",
"id": "290a6143f7c554b6088de01797aae9bf28c819d3",
"size": "422... |
import getopt
import sys
import httplib
import urllib2
import re
import HTMLParser
import urlparse
PROG='crawler'
VERSION='1.0'
USERAGENT='Crawler/' + VERSION
HTTPRE = re.compile('^http')
class DefaultErrorHandler(urllib2.HTTPDefaultErrorHandler):
def http_error_default(self, req, fp, code, msg, headers):
resul... | {
"content_hash": "1c558a8642cd73ff533a400194c9d79e",
"timestamp": "",
"source": "github",
"line_count": 173,
"max_line_length": 91,
"avg_line_length": 23.485549132947977,
"alnum_prop": 0.6354910164902782,
"repo_name": "pticon/Crawler",
"id": "1eaf403319234afac84078bf56798ccc429d10b3",
"size": "4087... |
from main import create_app
from db import db
app = create_app()
app.app_context().push()
db.create_all(app=app)
| {
"content_hash": "6d35156dd29b256420809c827a2bbce4",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 27,
"avg_line_length": 16.428571428571427,
"alnum_prop": 0.7217391304347827,
"repo_name": "fmlvn/anphode",
"id": "69d54ac87f287dc145ca3593bba3d01acae64644",
"size": "162",
... |
"""The tests for the demo number component."""
import pytest
import voluptuous as vol
from homeassistant.components.number.const import (
ATTR_MAX,
ATTR_MIN,
ATTR_STEP,
ATTR_VALUE,
DOMAIN,
MODE_AUTO,
MODE_BOX,
MODE_SLIDER,
SERVICE_SET_VALUE,
)
from homeassistant.const import ATTR_E... | {
"content_hash": "bf2e8cde9458fd55edfe2f383ad53f22",
"timestamp": "",
"source": "github",
"line_count": 116,
"max_line_length": 86,
"avg_line_length": 30.120689655172413,
"alnum_prop": 0.659988551803091,
"repo_name": "aronsky/home-assistant",
"id": "88e46f5c66d82d0b829dbb50d0130998d70bcbc8",
"size"... |
from django.conf.urls import patterns, url
from lp_registration.views import LPRegistrationView, LogoutView, LoginView
urlpatterns = patterns('',
url(r'^logout/$', LogoutView.as_view(), name="logout"),
url(r'^login/$', LoginView.as_view(), name="login"),
(r'^register/', LPRegistrationView.as_view()),
... | {
"content_hash": "cb40a093b025a00cd76a1bd9b5688b75",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 75,
"avg_line_length": 35.77777777777778,
"alnum_prop": 0.6894409937888198,
"repo_name": "festlv/latvijas-pasta-toolis",
"id": "7bcc627ea3f23979d875f73db6cebc269f26887a",
"s... |
import re
import os
import sys
import json
import errno
import platform
import fileinput
import subprocess
from datetime import datetime, timezone
try:
import requests
except ImportError:
raise ImportError(
'Failed to import \'requests\', run \'pip install requests\'')
try:
import pystache
except... | {
"content_hash": "2523414b84c4c4cc9da214640f1b05e6",
"timestamp": "",
"source": "github",
"line_count": 714,
"max_line_length": 114,
"avg_line_length": 35.1078431372549,
"alnum_prop": 0.5104320421270994,
"repo_name": "vcatechnology/cmake-boilerplate",
"id": "3e90f0f36cd361643f6c5c29599fe9e97f81396d",... |
import time
from contextlib import contextmanager
from tenacity import retry, stop_after_attempt, wait_fixed
from ._env import (
deserialize_data,
get_env_vars,
get_state,
save_state,
serialize_data,
set_env_vars,
set_up_env,
tear_down_env,
)
from .ci import running_on_ci
from .conditi... | {
"content_hash": "81d86abb20406aa7257665cbf449f15c",
"timestamp": "",
"source": "github",
"line_count": 136,
"max_line_length": 109,
"avg_line_length": 30.58823529411765,
"alnum_prop": 0.6149038461538462,
"repo_name": "DataDog/integrations-core",
"id": "6ed9c89b9bc462034bcd4706dff6c3b36bea5081",
"s... |
import os.path, sys
import distutils.util
# Append the directory in which the binaries were placed to Python's sys.path,
# then import the D DLL.
libDir = os.path.join('build', 'lib.%s-%s' % (
distutils.util.get_platform(),
'.'.join(str(v) for v in sys.version_info[:2])
))
sys.path.append(os.path.abspath(libDi... | {
"content_hash": "a7e59e02060b0ae980a71bcd91951088",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 78,
"avg_line_length": 23.944444444444443,
"alnum_prop": 0.7006960556844548,
"repo_name": "ariovistus/pyd",
"id": "9d246472748c5e1b7c11ac2c985ce001040a913f",
"size": "431",... |
"""\
This is a python port of "Goose" orignialy licensed to Gravity.com
under one or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership.
Python port was written by Xavier Grangier for Recrutae
Gravity.com licenses this file
to ... | {
"content_hash": "293e208dd686687bdc4e0f66c321a0e5",
"timestamp": "",
"source": "github",
"line_count": 110,
"max_line_length": 106,
"avg_line_length": 41.74545454545454,
"alnum_prop": 0.6212979094076655,
"repo_name": "cronycle/python-goose",
"id": "c6ac6dd7d7a64ae0bece6eaae9be4348303e542e",
"size"... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.