text stringlengths 4 1.02M | meta dict |
|---|---|
import sys
import time
import asyncio
import hashlib
import copy as cp
import celery
import pytest
from waterbutler import tasks # noqa
import tests.utils as test_utils
# Hack to get the module, not the function
copy = sys.modules['waterbutler.tasks.copy']
@pytest.fixture(autouse=True)
def patch_backend(monkeyp... | {
"content_hash": "ce9d5cf2440f87c83392bea7ba4638b6",
"timestamp": "",
"source": "github",
"line_count": 153,
"max_line_length": 96,
"avg_line_length": 29.366013071895424,
"alnum_prop": 0.6383262853327398,
"repo_name": "CenterForOpenScience/waterbutler",
"id": "b563d0e6761dffe6511c94327fb2dc4c5a9ac956... |
from django.core.management.base import BaseCommand, CommandError
from notemanagement.models import Category
class Command(BaseCommand):
help = 'Testing command for note management'
def handle(self, *args, **options):
cats = Category.objects.all()
for cat in cats:
self.stdout.write... | {
"content_hash": "85b8c1fdd393cd073760e5058cde600b",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 65,
"avg_line_length": 34.54545454545455,
"alnum_prop": 0.6815789473684211,
"repo_name": "nvl1109/magictool",
"id": "05bff3d770a89d085375cd259a8a00ce3c15cea8",
"size": "380... |
from nose.tools import assert_false, assert_is, assert_is_none
from .. import filters
from clare.common import messaging
class TestDoublesBattleFilter(object):
def __init__(self):
self.filter = None
def setup(self):
self.filter = filters.DoublesBattleFilter()
def test_doubles_battles_a... | {
"content_hash": "bf4a7c5b9385bf71b6a3737d4961b5b3",
"timestamp": "",
"source": "github",
"line_count": 111,
"max_line_length": 68,
"avg_line_length": 34.36036036036036,
"alnum_prop": 0.5521761929732564,
"repo_name": "dnguyen0304/clare",
"id": "e12728f030007aa7dd27367f687e1d2ef511a4dd",
"size": "38... |
from __future__ import absolute_import
import functools
import inspect
import sys
import wsme
import wsme.rest.args
import wsme.rest.json
import wsme.rest.xml
import pecan
from wsme.utils import is_valid_code
class JSonRenderer(object):
@staticmethod
def __init__(path, extra_vars):
pass
@stat... | {
"content_hash": "2f6d280917e371aedfe8f058b29582e9",
"timestamp": "",
"source": "github",
"line_count": 142,
"max_line_length": 72,
"avg_line_length": 30.823943661971832,
"alnum_prop": 0.55608864519077,
"repo_name": "stackforge/wsme",
"id": "9d63dde1df71cc3bbe5e40660fd9e012c143b6d2",
"size": "4377"... |
from sklearn2sql_heroku.tests.classification import generic as class_gen
class_gen.test_model("SVC_rbf" , "BinaryClass_500" , "mysql")
| {
"content_hash": "7bf24ca4ecb97fb0d9c1bb8a646fff81",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 72,
"avg_line_length": 34.25,
"alnum_prop": 0.7664233576642335,
"repo_name": "antoinecarme/sklearn2sql_heroku",
"id": "050b46a0ad95d5443854ee39ac875d3538c85a13",
"size": "13... |
"""
Copyright (c) 2013, Cogniteam
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following... | {
"content_hash": "14938366a0731444f588c06edcea9d81",
"timestamp": "",
"source": "github",
"line_count": 71,
"max_line_length": 85,
"avg_line_length": 37.929577464788736,
"alnum_prop": 0.7415521722985517,
"repo_name": "cogniteam/decision_making",
"id": "92a7bedd22790c788b80f27d35cb39a0341f6858",
"si... |
"""
Django settings for todo project.
Generated by 'django-admin startproject' using Django 3.0.8.
For more information on this file, see
https://docs.djangoproject.com/en/3.1/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.1/ref/settings/
"""
import os
from ... | {
"content_hash": "04006efc311b0ea38e3e4e954a99115b",
"timestamp": "",
"source": "github",
"line_count": 125,
"max_line_length": 91,
"avg_line_length": 25.776,
"alnum_prop": 0.6846679081315953,
"repo_name": "bugsnag/bugsnag-python",
"id": "80ddedb5a5c30c9abfd6877cbcfa65fe7c7f8bf5",
"size": "3237",
... |
"""DataUpdateCoordinator for System Bridge."""
from __future__ import annotations
import asyncio
from datetime import timedelta
import logging
from typing import Callable
from systembridge import Bridge
from systembridge.exceptions import (
BridgeAuthenticationException,
BridgeConnectionClosedException,
B... | {
"content_hash": "63c591d61df5e74252d446b0d49b5c12",
"timestamp": "",
"source": "github",
"line_count": 139,
"max_line_length": 88,
"avg_line_length": 34.330935251798564,
"alnum_prop": 0.5848700754400671,
"repo_name": "sander76/home-assistant",
"id": "d34e1019a0b803ee8fb7bb50b7c87a16407dcdb0",
"siz... |
class cm_power:
"""class to conveniently switch power on and of"""
"""the hostanme is the label of the host as defined in the inventory."""
def on(self, hostname):
"""switches the power on"""
def off(self, hostname):
"""switches power off"""
def status(self, hostname):
"... | {
"content_hash": "ce4e3f783021649460d77ed79c1d42b6",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 76,
"avg_line_length": 28.55,
"alnum_prop": 0.626970227670753,
"repo_name": "rajpushkar83/cloudmesh",
"id": "62bd1a929b9c4b2b16d8d7418c990af344230b58",
"size": "594",
"bi... |
import unittest
import time
import rethinkdb as r
from flask import g, request
from base import BaseTestCase
from users import User
from web import app, verifyLogin
from user.token import generate_confirmation_token, confirm_token
class TestUserRegistration(BaseTestCase):
def test_user_registration(self):
... | {
"content_hash": "a13e3d9c045d40b5325871ab65c07e4c",
"timestamp": "",
"source": "github",
"line_count": 315,
"max_line_length": 77,
"avg_line_length": 40.87301587301587,
"alnum_prop": 0.5844660194174758,
"repo_name": "Runbook/runbook",
"id": "b745e2002d49cf211a497b70f2259b98e4b40148",
"size": "1313... |
def getminimum(array):
sqrt=isqrt(1000)
mini=[]
for i in range(0,len(array),sqrt):
mini.append(minimum(array[i:i+sqrt]))
return minimum(mini)
def minimum(array):
minValue = array[0]
for i in range(1, len(array)):
if array[i] < minValue:
minValue = a... | {
"content_hash": "2a0d359905aabe5c6be208a98b90d712",
"timestamp": "",
"source": "github",
"line_count": 98,
"max_line_length": 88,
"avg_line_length": 26.306122448979593,
"alnum_prop": 0.4972847168347556,
"repo_name": "PythonRam/Hit-Sort",
"id": "cdd605204db208f755a7fdbbfcb01314d2af3862",
"size": "2... |
import numpy as np
import scipy
import scipy.optimize
import distortion
class Objective(object):
# TODO: fixme: implement alternative distortion models. Currently
# only CaltechNonlinearDistortionModel is used.
def __init__(self,
list_of_lines,
distortion_center_guess=N... | {
"content_hash": "562ca78e03c10b037e428da671e55784",
"timestamp": "",
"source": "github",
"line_count": 199,
"max_line_length": 138,
"avg_line_length": 37.71356783919598,
"alnum_prop": 0.5573617588274483,
"repo_name": "astraw/pinpoint",
"id": "bc0570a94e300d1a18ba5f15c6e66ba7cb977983",
"size": "750... |
from django.contrib.auth.models import AnonymousUser
from django.db.models import Q
from django.http import HttpResponseForbidden
from django.utils import timezone
from django_sonic_screwdriver.settings import api_settings
from .models import UserBan, IPBan
class BanMiddleware:
def __init__(self, get_response):... | {
"content_hash": "da3186a2f043c78a451027d6221f98e5",
"timestamp": "",
"source": "github",
"line_count": 75,
"max_line_length": 82,
"avg_line_length": 29.106666666666666,
"alnum_prop": 0.5968850206138342,
"repo_name": "rhazdon/django-sonic-screwdriver",
"id": "6552dbf48e0359e611ccdc0d5752b126aeb67eb7"... |
import subprocess
def WriteFile(filename, data):
fh = open(filename, "w")
try:
fh.write(data)
finally:
fh.close()
test_cases = []
def TestCase(asm, accept):
def Func():
print '* test %r' % asm
full_asm = asm + '\n.p2align 5, 0x90\n'
WriteFile('tmp.S', full_asm)
subprocess.check_call... | {
"content_hash": "94db35e29abffc66af7362e6c2ce4c22",
"timestamp": "",
"source": "github",
"line_count": 120,
"max_line_length": 72,
"avg_line_length": 20.95,
"alnum_prop": 0.6571201272871917,
"repo_name": "mseaborn/x86-decoder",
"id": "86aa2c7a53c7db6006ac3ed6a06e23c8e09137f1",
"size": "2686",
"b... |
"""Generated class for properties.json"""
class Properties:
"""Generated schema class"""
def __init__(self):
self.key_type = None
self.version = None
self.connect = None
@staticmethod
def from_dict(source):
if not source:
return None
result = Properties()
result.key_type = sour... | {
"content_hash": "1a5a3ea965032c711ed0ac3c093a9d92",
"timestamp": "",
"source": "github",
"line_count": 46,
"max_line_length": 77,
"avg_line_length": 23.152173913043477,
"alnum_prop": 0.6262910798122066,
"repo_name": "faucetsdn/udmi",
"id": "55129a4ca7816e0b8288b61e7656daad8ad56e69",
"size": "1065"... |
from uuid import uuid4
import json
# RPC superclass
from rpcdaemon.lib.rpc import RPC
# Logger wrapper
from rpcdaemon.lib.logger import Logger
# Config parser
from rpcdaemon.lib.config import Config
# Dump agent handler
class Dump(RPC):
def __init__(self, connection, config, handler=None):
# Grab a cop... | {
"content_hash": "3137e49dd3173e7b18b3c4c6fe85e94b",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 73,
"avg_line_length": 24.660714285714285,
"alnum_prop": 0.5271542360608255,
"repo_name": "rcbops/rpcdaemon-buildpackage",
"id": "4ff6494105c30bdaf2b3820c50a9cee739ecb337",
... |
import logging
logging.basicConfig(level=logging.DEBUG)
logging.disable(logging.CRITICAL)
# make the grid
grid = {}
x = 0
y = 0
topEdge = 0
bottomEdge = 0
leftEdge = 0
rightEdge = 0
direction = 'right'
n = 1
while n <= 1001 * 1001:
grid[(x, y)] = n
logging.debug('grid %s, %s set to %s' % (x, y, n))
#impo... | {
"content_hash": "5ae24dcd0d0d49097311f002f3815aaf",
"timestamp": "",
"source": "github",
"line_count": 65,
"max_line_length": 111,
"avg_line_length": 27.523076923076925,
"alnum_prop": 0.5695919508105086,
"repo_name": "asweigart/AlDoesProjectEuler",
"id": "bf15dfcbd20352fee4fc40b27638cf22266e7118",
... |
from __future__ import unicode_literals
from datetime import timedelta
import pytest
from indico.modules.events.contributions.models.contributions import Contribution
@pytest.fixture
def create_contribution(db):
"""Returns a a callable that lets you create a contribution"""
def _create_contribution(event,... | {
"content_hash": "e2a854b104dd0784b13e8198e80f11d7",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 88,
"avg_line_length": 27.56,
"alnum_prop": 0.7460087082728593,
"repo_name": "mvidalgarcia/indico",
"id": "091e02ceef3840178da7fbc1ae2c6e9d1f48f32b",
"size": "903",
"bina... |
"""JSON helper functions"""
try:
import simplejson as json
except ImportError:
import json
from django.http import HttpResponse
def JsonResponse(data, dump=True):
try:
data['errors']
except KeyError:
data['success'] = True
except TypeError:
pass
return HttpResponse(
... | {
"content_hash": "6ffdda76f0b0fdfabffbbfb0aadc3e01",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 43,
"avg_line_length": 20.387096774193548,
"alnum_prop": 0.6518987341772152,
"repo_name": "Slruh/Empous-Control-The-World",
"id": "80057c0bcef746906ecf938c5b269e9d5a60ddac",
... |
"""Create menus and crumbs from a site hierarchy.
You define the site hierarchy as lists/tuples. Each location in the hierarchy
is a (url, description) tuple. Each list has the base URL/text in the 0
position, and all the children coming after it. Any child can be a list,
representing further depth to the hierarchy... | {
"content_hash": "3e537326e549ec9d8f81d590de342000",
"timestamp": "",
"source": "github",
"line_count": 165,
"max_line_length": 81,
"avg_line_length": 35.17575757575757,
"alnum_prop": 0.5225706409372847,
"repo_name": "nzavagli/UnrealPy",
"id": "dece01ebb2b53c2b6e09336477602d4ff47d395a",
"size": "58... |
"""
URL patterns for the OpenStack Dashboard.
"""
from django.conf import settings
from django.conf.urls import include # noqa
from django.conf.urls import patterns
from django.conf.urls.static import static # noqa
from django.conf.urls import url
from django.contrib.staticfiles.urls import staticfiles_urlpatterns ... | {
"content_hash": "d976cf33acde9a41e6191a0f9d93488f",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 78,
"avg_line_length": 33.34285714285714,
"alnum_prop": 0.7455012853470437,
"repo_name": "zouyapeng/horizon-newtouch",
"id": "12aa89847a14abc6013d9ffbab8d1e7f80159256",
"si... |
from collections import deque
def tarjan(g):
"""
Tarjan's algo for finding strongly connected components in a directed graph
Uses two main attributes of each node to track reachability, the index of that node
within a component(index), and the lowest index reachable from that node(lowlink).
We t... | {
"content_hash": "64fdc83659e0c0b73ace5d1fe4026a22",
"timestamp": "",
"source": "github",
"line_count": 83,
"max_line_length": 87,
"avg_line_length": 31.951807228915662,
"alnum_prop": 0.558446455505279,
"repo_name": "TheAlgorithms/Python",
"id": "30f8ca8a204f50796dbd8e7dc278a3d95d82187d",
"size": "... |
"""Module for interface of os installer.
.. moduleauthor::: Xiaodong Wang <xiaodongwang@huawei.com>
"""
import logging
from compass.config_management.installers import installer
from compass.utils import setting_wrapper as setting
class Installer(installer.Installer):
"""Interface for os installer."""
NA... | {
"content_hash": "942a4745e90431e03cb5b690a0430577",
"timestamp": "",
"source": "github",
"line_count": 65,
"max_line_length": 73,
"avg_line_length": 28.615384615384617,
"alnum_prop": 0.6698924731182796,
"repo_name": "huawei-cloud/compass-core",
"id": "2acf51c62959a00dd7d47bc873f401b95c779511",
"si... |
"""
Copyright (c) 2012-2016 Ben Croston
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribut... | {
"content_hash": "f2a67c278d10b9730967ee8b00bcbf20",
"timestamp": "",
"source": "github",
"line_count": 46,
"max_line_length": 214,
"avg_line_length": 50.97826086956522,
"alnum_prop": 0.6601279317697228,
"repo_name": "DrXoo/testing-arduino",
"id": "0dad5808aec9a4c6e8d44b2c57a83bc179fe12e1",
"size":... |
from .fetchers import NUMetadatasFetcher
from .fetchers import NUEgressAdvFwdEntryTemplatesFetcher
from .fetchers import NUGlobalMetadatasFetcher
from bambou import NURESTObject
class NUEgressAdvFwdTemplate(NURESTObject):
""" Represents a EgressAdvFwdTemplate in the VSD
Notes:
Create a t... | {
"content_hash": "85ea8afe3f201e633e50b2e46dd38d29",
"timestamp": "",
"source": "github",
"line_count": 439,
"max_line_length": 492,
"avg_line_length": 31.544419134396357,
"alnum_prop": 0.5844887348353552,
"repo_name": "nuagenetworks/vspk-python",
"id": "af94158100813c7cd91d0acc2d8bc3a967cec457",
"... |
"""
============================================
Channel Coding (:mod:`commpy.channelcoding`)
============================================
.. module:: commpy.channelcoding
Galois Fields
=============
.. autosummary::
:toctree: generated/
GF -- Class representing a Galois Field object.
Algebraic Codes
===... | {
"content_hash": "abe25cdb08aa21474049c781604ee922",
"timestamp": "",
"source": "github",
"line_count": 76,
"max_line_length": 77,
"avg_line_length": 21.68421052631579,
"alnum_prop": 0.6171116504854369,
"repo_name": "tarunlnmiit/CommPy",
"id": "669c544713092dcfe92a541b3188dcef0e94313d",
"size": "16... |
import os.path
import sys
from threading import Thread
from django.conf import settings
from django.db.models import signals as model_signals
try:
from filebrowser.views import filebrowser_post_upload
from filebrowser.views import filebrowser_post_rename
from filebrowser.views import filebrowser_post_dele... | {
"content_hash": "d1280b5b79fbaf2262ebba1f8b629ad5",
"timestamp": "",
"source": "github",
"line_count": 219,
"max_line_length": 160,
"avg_line_length": 43.60730593607306,
"alnum_prop": 0.6134031413612565,
"repo_name": "vishalsodani/django-linkcheck",
"id": "6a998e21add1cff9747d70676bd01288989c6dc4",
... |
import random
from collections import defaultdict
from mesa.time import RandomActivation
class RandomActivationByBreed(RandomActivation):
'''
A scheduler which activates each type of agent once per step, in random
order, with the order reshuffled every step.
This is equivalent to the NetLogo 'ask br... | {
"content_hash": "3fe00fc272daf4fa81160a86cd9487b6",
"timestamp": "",
"source": "github",
"line_count": 79,
"max_line_length": 78,
"avg_line_length": 28.240506329113924,
"alnum_prop": 0.5858359480053787,
"repo_name": "projectmesa/mesa-examples",
"id": "9b59a5e2483c40f4137a8c941f56dc4b4c4832b6",
"si... |
"""
Mock unit tests for the NetApp block storage 7-mode library
"""
import ddt
from lxml import etree
import mock
from cinder import exception
from cinder import test
import cinder.tests.unit.volume.drivers.netapp.dataontap.client.fakes \
as client_fakes
import cinder.tests.unit.volume.drivers.netapp.dataontap.f... | {
"content_hash": "efaaf7135faa678db074eb9713f4c59b",
"timestamp": "",
"source": "github",
"line_count": 578,
"max_line_length": 79,
"avg_line_length": 42.050173010380625,
"alnum_prop": 0.6284303641226086,
"repo_name": "apporc/cinder",
"id": "c178a70d53ca1f0c377bc7d5ba05f8c6663704dd",
"size": "25110... |
MODULES_LIST = {'dashboard': {'txt':'Dashboard','icon':'icon_house_alt'},
'inventario': {'txt':'Inventario','icon':'fa fa-cubes'},
'tickets': {'txt':'Tickets','icon':'fa fa-bug'},
'new': {'txt':'Nuevo','icon':'fa fa-plus'},
'calendario': {'txt':'Calendario... | {
"content_hash": "5e46d993c759cabb244a26308b313ac9",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 133,
"avg_line_length": 42.8,
"alnum_prop": 0.5542056074766355,
"repo_name": "jejimenez/invetronic",
"id": "b8c98cefaf34c3801f311843be1c4bf451c52c38",
"size": "2145",
"bi... |
from know_me.profile import serializers
def test_serialize(
api_rf,
km_user_factory,
media_resource_cover_style_factory,
serialized_time,
):
"""
Test serializing a media resource cover style.
"""
# Note that it is not intended for a resource to have both a file
# and link defined a... | {
"content_hash": "2c4af179adbeda87e258eeabe41fd60d",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 73,
"avg_line_length": 30.53061224489796,
"alnum_prop": 0.6570855614973262,
"repo_name": "knowmetools/km-api",
"id": "ebeedcffc4a5418c92ac9090fd03093662a8dccb",
"size": "14... |
import abc
import collections
import itertools
from oslo_serialization import jsonutils
from oslo_utils import encodeutils
from oslo_utils import strutils
import six
from heat.common import exception
from heat.common.i18n import _
from heat.common import param_utils
from heat.engine import constraints as constr
PAR... | {
"content_hash": "8b5a943e981168a0063f8f55164d4e81",
"timestamp": "",
"source": "github",
"line_count": 586,
"max_line_length": 79,
"avg_line_length": 35.00511945392491,
"alnum_prop": 0.5849461317213475,
"repo_name": "noironetworks/heat",
"id": "168ac3e59cfcdd67af9377b60fd031b306ca4c49",
"size": "2... |
from __future__ import unicode_literals
from builtins import str
from FTModuleClass import *
import site
site.addsitedir(r"Lib")
from ChineseUtilities import SortStringDB, ChineseWritingSystems
#----------------------------------------------------------------
# Documentation for the user:
docs = {FTM_Name : ... | {
"content_hash": "c7fbc38eb86ad378b15a2afda5da7f90",
"timestamp": "",
"source": "github",
"line_count": 119,
"max_line_length": 113,
"avg_line_length": 39.54621848739496,
"alnum_prop": 0.6179345516362091,
"repo_name": "rmlockwood/FLExTrans",
"id": "ac2a75a5539c6c02c6d640eabf80bd3738a18d49",
"size":... |
"""Tools for representing a device as an edge-labelled graph."""
from cirq.contrib.graph_device.hypergraph import UndirectedHypergraph
from cirq.contrib.graph_device.graph_device import (
is_undirected_device_graph,
is_crosstalk_graph,
FixedDurationUndirectedGraphDeviceEdge,
UndirectedGraphDevice,
... | {
"content_hash": "180e9d0e6017532e8472c80de098a800",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 69,
"avg_line_length": 31.375,
"alnum_prop": 0.7888446215139442,
"repo_name": "quantumlib/Cirq",
"id": "91f80c867e8901aee055e99f2b954ff06306923a",
"size": "1087",
"binary... |
import logging
from io import StringIO
import pytest
from ..logger import find_parent_module, create_logger, setup_logging
logger = create_logger()
@pytest.fixture()
def io_logger():
io = StringIO()
handler = setup_logging(stream=io, env_var=None)
handler.setFormatter(logging.Formatter('%(name)s: %(mess... | {
"content_hash": "35a450f8d8b3c342b653b61907ebf486",
"timestamp": "",
"source": "github",
"line_count": 54,
"max_line_length": 113,
"avg_line_length": 29.166666666666668,
"alnum_prop": 0.686984126984127,
"repo_name": "mhubig/borg",
"id": "b6dc296532f22bfd478e5028f512525ef6adc43b",
"size": "1575",
... |
from imu import IMU
from pressure import Pressure
| {
"content_hash": "72974b4066c755eb5b59d39fd95a5f20",
"timestamp": "",
"source": "github",
"line_count": 2,
"max_line_length": 29,
"avg_line_length": 25,
"alnum_prop": 0.84,
"repo_name": "purduerov/X9-Core",
"id": "931a1a2fa3ed279b523bb77af5ecadc74bdf43dd",
"size": "50",
"binary": false,
"copies... |
from test.test_support import run_unittest, check_warnings
import cgi
import os
import sys
import tempfile
import unittest
class HackedSysModule:
# The regression test will have real values in sys.argv, which
# will completely confuse the test of the cgi module
argv = []
stdin = sys.stdin
cgi.sys = Ha... | {
"content_hash": "4b953be9ae3a1882a070ad5bc0a4c364",
"timestamp": "",
"source": "github",
"line_count": 417,
"max_line_length": 183,
"avg_line_length": 36.32374100719424,
"alnum_prop": 0.5325146893774345,
"repo_name": "ianyh/heroku-buildpack-python-opencv",
"id": "7fdd482b9424e48e2628c80f238d8cdec849... |
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('contentcuration', '0059_merge'),
('contentcuration', '0061_auto_20170327_1344'),
]
operations = [
]
| {
"content_hash": "9ba9f275db1d6121eaea040d62b75ea8",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 55,
"avg_line_length": 19.142857142857142,
"alnum_prop": 0.6455223880597015,
"repo_name": "DXCanas/content-curation",
"id": "350e9f50404fa4ef5c15ecbc666bb685edda8285",
"siz... |
"""@author mda"""
from setuptools import setup, find_packages
import os
PROJECT_ROOT = os.path.dirname(os.path.abspath(__file__))
setup(name='dataidentity',
version='0.1',
author='Moxious',
author_email='moxious@oldhat.org',
url='https://github.com/moxious/dataidentity',
packages=find_pa... | {
"content_hash": "b4dea7ecb9736b5a65afb43a204615f2",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 69,
"avg_line_length": 36.142857142857146,
"alnum_prop": 0.5665349143610013,
"repo_name": "plus-provenance/dataidentity",
"id": "c6f1e39fbc9151d34c58309d2196eeaefcacc5d1",
... |
'''
You have a total of n coins that you want to form in a staircase shape, where every k-th row must have exactly k coins.
Given n, find the total number of full staircase rows that can be formed.
n is a non-negative integer and fits within the range of a 32-bit signed integer.
Example 1:
n = 5
The coins can form... | {
"content_hash": "532ef46660f004d4f1990e0e15ad3159",
"timestamp": "",
"source": "github",
"line_count": 57,
"max_line_length": 119,
"avg_line_length": 21.614035087719298,
"alnum_prop": 0.5681818181818182,
"repo_name": "shub0/algorithm-data-structure",
"id": "5be446dcfbab9fed8c37a00d4d7b3e107656bee8",... |
from oslo_versionedobjects import fields
from cinder import objects
def fake_db_volume(**updates):
db_volume = {
'id': '1',
'size': 1,
'name': 'volume-1',
'availability_zone': 'fake_availability_zone',
'status': 'available',
'attach_status': 'detached',
'pr... | {
"content_hash": "dc68be3ec1c59b3ef57fc75cc3670d28",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 71,
"avg_line_length": 27.314285714285713,
"alnum_prop": 0.5711297071129707,
"repo_name": "potsmaster/cinder",
"id": "57b8b736fbfc44499489c6807ceb7b17f7190c58",
"size": "15... |
from django.core.management.base import NoArgsCommand
from logging import getLogger
from mks.models import Member
from django.core.cache import cache
logger = getLogger(__name__)
class Command(NoArgsCommand):
help = "Recalculates bill statistics for mks of current knesset"
info_types = ['bills_proposed', 'bi... | {
"content_hash": "3d559f49803250a4beec4669cca42533",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 83,
"avg_line_length": 35.52173913043478,
"alnum_prop": 0.6707466340269278,
"repo_name": "alonisser/Open-Knesset",
"id": "5063eab27a0c5878facbec2f7f7979bbe1ceadb1",
"size":... |
import os.path as op
import itertools as itt
from numpy.testing import (assert_array_almost_equal, assert_array_equal,
assert_equal, assert_allclose)
import pytest
import numpy as np
from scipy import linalg
from mne.cov import (regularize, whiten_evoked,
_auto_low_rank... | {
"content_hash": "aaef4b7461d4c3410b273ef8a743245c",
"timestamp": "",
"source": "github",
"line_count": 801,
"max_line_length": 79,
"avg_line_length": 43.03245942571785,
"alnum_prop": 0.6169311555310569,
"repo_name": "rkmaddox/mne-python",
"id": "73d4c0854d36609027c4b2095a3ce3f516d72358",
"size": "... |
import proto # type: ignore
__protobuf__ = proto.module(
package="google.ads.googleads.v10.errors",
marshal="google.ads.googleads.v10",
manifest={
"IdErrorEnum",
},
)
class IdErrorEnum(proto.Message):
r"""Container for enum describing possible id errors."""
class IdError(proto.Enum... | {
"content_hash": "703b81e7a6c883bb5b766795df604888",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 60,
"avg_line_length": 21.26086956521739,
"alnum_prop": 0.6196319018404908,
"repo_name": "googleads/google-ads-python",
"id": "1551e792d9712b2fd3c9a03f9852467ab2e3572c",
"s... |
"""
Self-test file, registration case
for OBS RINEX reader
"""
import pytest
import xarray
from datetime import datetime
from pytest import approx
from pathlib import Path
import georinex as gr
R = Path(__file__).parent / "data"
@pytest.mark.parametrize(
"time, exp_time",
[
(None, None),
(da... | {
"content_hash": "2c9d5151b93abe33e953e590f1c37e7b",
"timestamp": "",
"source": "github",
"line_count": 94,
"max_line_length": 88,
"avg_line_length": 23.095744680851062,
"alnum_prop": 0.6379548595117457,
"repo_name": "geospace-code/georinex",
"id": "863403f9ffbe2623a25872aac67866d850da7a75",
"size"... |
try:
import cv2.cv as cv
OPENCV_AVAILABLE = True
except ImportError:
OPENCV_AVAILABLE = False
try:
import cv2
OPENCV2_AVAILABLE = True
except ImportError:
OPENCV2_AVAILABLE = False
from subprocess import Popen, PIPE
import os
PROG_NAME = 'tesseract'
TEMP_IMAGE = 'tmp.bmp'
TEMP_FILE = 'tmp'
#... | {
"content_hash": "400ab3bf11dbd678456e85ae82b5dd0f",
"timestamp": "",
"source": "github",
"line_count": 96,
"max_line_length": 86,
"avg_line_length": 28.5,
"alnum_prop": 0.6465643274853801,
"repo_name": "annafeit/web_labeling",
"id": "84fbea371d456f0cc5a2bc0ca201a37d64feab96",
"size": "2736",
"bi... |
from . import Dataset
import numpy as np
class MiniBatches(Dataset):
def __init__(self, dataset, batch_size=20):
self.origin = dataset
self.size = batch_size
def _yield_data(self, subset):
for i in xrange(0, len(subset), self.size):
yield map(np.array, list(zip(*subset[i:i... | {
"content_hash": "e4b0b81213d3daa0adbc4aaae8c65282",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 68,
"avg_line_length": 29.166666666666668,
"alnum_prop": 0.5977142857142858,
"repo_name": "dlacombejr/deepy",
"id": "b47176c1ec0020140317cd7f9a3f77808d66bc83",
"size": "923... |
import numpy
def _CenterTForm(dataSet):
""" INTERNAL USE ONLY
"""
pass
def _NormalizeTForm(dataSet):
""" INTERNAL USE ONLY
"""
pass
def _StandardTForm(dataSet):
""" INTERNAL USE ONLY
"""
pass
_availTransforms = [
('Center', _CenterTForm, 'translates so that mean(x)=0'),
('Normalize', _N... | {
"content_hash": "82adeb4f0b3c0c4a933e1c1bce7e0572",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 62,
"avg_line_length": 16.666666666666668,
"alnum_prop": 0.64625,
"repo_name": "jandom/rdkit",
"id": "9c71d1b2ab6633deecbd14805c7091d8199b7b03",
"size": "891",
"binary": ... |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('members', '0006_auto_20170502_1722'),
]
operations = [
migrations.RemoveField(
model_name='useraccountdata',
name='member',
... | {
"content_hash": "697ee0b9dce41792e1bc6ab3cfcbb0d4",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 77,
"avg_line_length": 25.866666666666667,
"alnum_prop": 0.5605670103092784,
"repo_name": "Teknologforeningen/teknologr.io",
"id": "dc02b705c23e9dbde2e950a763c4bb5c473a158f",... |
"""Rules for NonnegativeInts."""
__author__ = 'Sean Lip'
from extensions.rules import base
class Equals(base.NonnegativeIntRule):
description = 'is equal to {{x|NonnegativeInt}}'
def _evaluate(self, subject):
return subject == self.x
| {
"content_hash": "b9419afff36949b857f3b3a01a370b5b",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 52,
"avg_line_length": 21.25,
"alnum_prop": 0.6784313725490196,
"repo_name": "BenHenning/oppia",
"id": "2e7765903b3722d622690ce6a66f258d9b542a26",
"size": "877",
"binary"... |
from setuptools import setup
setup(
name='easyaspect',
version='0.1.0',
description='Easy Approach to AOP in Python',
url='http://github.com/LuizArmesto/easyaspect',
author='Luiz Armesto',
author_email='luiz.armesto@gmail.com',
license='MIT',
packages=['easyaspect'],
package_dir={'e... | {
"content_hash": "272c78282b83334f6f80b64ec2d3dfe7",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 51,
"avg_line_length": 25.333333333333332,
"alnum_prop": 0.6513157894736842,
"repo_name": "LuizArmesto/easyaspect",
"id": "4e0f873950a67b253034c30049f358bf5d6b6ff0",
"size"... |
from getpass import getuser
# Settings of the annotation process
############
# How many frames does a batch scan.
# This excludes the very last frame, since we start at 0.
batchsize = 100
# Show every tickskip-th frame for annotation.
tickskip = 5
# Skip so many batches after each. Example: 3 means batch, skip, skip... | {
"content_hash": "3aa956bf4634ae1d83643e68283e8b7a",
"timestamp": "",
"source": "github",
"line_count": 450,
"max_line_length": 146,
"avg_line_length": 36.54222222222222,
"alnum_prop": 0.5865361225979081,
"repo_name": "lucasb-eyer/laser-detection-annotator",
"id": "6fd3b527819b27532ad64c8615396cb4b8c... |
import logging
from typing import Any, Dict, Optional
logger = logging.getLogger(__name__)
class MagicInjectError(ValueError):
pass
def get_injection_requests(
type_hints: Dict[str, type], cname: str, component: Optional[Any] = None
) -> Dict[str, type]:
"""
Given a dict of type hints, filter it to... | {
"content_hash": "55caccc9eb461ea7b6a0b64c15b984ee",
"timestamp": "",
"source": "github",
"line_count": 85,
"max_line_length": 115,
"avg_line_length": 32.94117647058823,
"alnum_prop": 0.6117857142857143,
"repo_name": "robotpy/robotpy-wpilib-utilities",
"id": "6f3c8e535a91688216dd7eefc7aa3a7d9d80ec5e"... |
'''
Tests for GMF
'''
#general python modules
import os
import pickle
import numpy as np
from multiprocessing import cpu_count
from numpy.linalg import solve
#haltools functions
from halotools.sim_manager import CachedHaloCatalog
from halotools.empirical_models import PrebuiltHodModelFactory
from halotools.mock_obse... | {
"content_hash": "db8521c3181f41e0c5e49005e32daddb",
"timestamp": "",
"source": "github",
"line_count": 130,
"max_line_length": 125,
"avg_line_length": 29.276923076923076,
"alnum_prop": 0.6053599579611141,
"repo_name": "mjvakili/ccppabc",
"id": "e9f88c6031aa41eefcae68eaf5391132b2f89119",
"size": "3... |
from django.db import models
class SensorRecord(models.Model):
device_id = models.IntegerField()
fw = models.IntegerField()
evt = models.IntegerField()
coil_revesed = models.CharField(max_length=3)
power_active = models.FloatField()
power_reactive = models.FloatField()
power_appearent = mo... | {
"content_hash": "f0bff2ff1577fb8cd3bb933960f3f7a7",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 50,
"avg_line_length": 34.12765957446808,
"alnum_prop": 0.6620947630922693,
"repo_name": "joaojunior/exercise_sensor",
"id": "f22c8180b7dacb37fc94af186c871ddb517f6e96",
"si... |
"""
.. todo::
WRITEME
"""
import os
import logging
import numpy
from theano.compat.six.moves import xrange
from pylearn2.datasets import cache, dense_design_matrix
from pylearn2.expr.preprocessing import global_contrast_normalize
from pylearn2.utils import contains_nan
from pylearn2.utils import serial
from pyle... | {
"content_hash": "93d22c9994de510d554e39d4b7f037b3",
"timestamp": "",
"source": "github",
"line_count": 253,
"max_line_length": 78,
"avg_line_length": 29.936758893280633,
"alnum_prop": 0.5071296540797465,
"repo_name": "Refefer/pylearn2",
"id": "4440c714fd4623762908ff44c814640d8e64f726",
"size": "75... |
from __future__ import with_statement
"""
A class which handles loading the pricing files.
"""
import os.path
from os.path import join as pjoin
try:
import simplejson as json
except ImportError:
import json
from libcloud.utils.connection import get_response_object
__all__ = [
'get_pricing',
'get_si... | {
"content_hash": "bb00f77ea4add16a7941b1e61d1f2790",
"timestamp": "",
"source": "github",
"line_count": 202,
"max_line_length": 117,
"avg_line_length": 28.198019801980198,
"alnum_prop": 0.6471207865168539,
"repo_name": "Jc2k/libcloud",
"id": "a4e974772d10fa54e6b26252424d0283633c0ca8",
"size": "6477... |
import base64
import functools
import hashlib
import json
import math
from os import urandom
from random import randint
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives.asymmetric import padding
from cryptography.hazmat.primitives.asymmetric import rsa
from cryptography.hazm... | {
"content_hash": "3698879399b4846bdd2b5ba886fc947d",
"timestamp": "",
"source": "github",
"line_count": 1285,
"max_line_length": 79,
"avg_line_length": 37.87470817120622,
"alnum_prop": 0.4977501078715404,
"repo_name": "eharney/cinder",
"id": "57cb8b419b1edd56bfe08e1ff6931fcd4674f2a5",
"size": "4930... |
"""custom
Custom builders and methods.
"""
#
# Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
# All Rights Reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the
# "Software"), to deal in the Software without r... | {
"content_hash": "7fc1b3480566ab8c43098bb5edee069a",
"timestamp": "",
"source": "github",
"line_count": 283,
"max_line_length": 82,
"avg_line_length": 31.992932862190813,
"alnum_prop": 0.6371769383697813,
"repo_name": "gzorin/RSXGL",
"id": "08073162e74147b3383636a7fb39ebb605872e89",
"size": "9054",... |
from a10sdk.common.A10BaseClass import A10BaseClass
class Force(A10BaseClass):
"""Class Description::
Unconditional write to Non-volatile Memory.
Class force supports CRUD Operations and inherits from `common/A10BaseClass`.
This class is the `"PARENT"` class for this module.`
:param all_par... | {
"content_hash": "3e51206944a9503e5136ac992b088236",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 162,
"avg_line_length": 32.717948717948715,
"alnum_prop": 0.6300940438871473,
"repo_name": "a10networks/a10sdk-python",
"id": "f04903c5ab69b45b9a190854bae13ad36776d8c6",
"s... |
from django.utils.safestring import mark_safe
from django.contrib.auth.models import User, Group
from django.contrib.auth.admin import UserAdmin, GroupAdmin
from django.contrib import admin
def roles(self):
#short_name = unicode # function to get group name
p = sorted([u"<a title='%s'>%s</a>" % (x, x) f... | {
"content_hash": "299a835c68f4c51567e60d5af127d1ae",
"timestamp": "",
"source": "github",
"line_count": 74,
"max_line_length": 159,
"avg_line_length": 36.108108108108105,
"alnum_prop": 0.655688622754491,
"repo_name": "underbluewaters/marinemap",
"id": "607fd4f37c4aea705acfd94366cdfb7d2f9a4b30",
"si... |
"""Python implementation of elastic-net regularized GLMs."""
from copy import deepcopy
import numpy as np
from scipy.special import expit
from scipy.stats import norm
from .utils import logger, set_log_level
from .base import BaseEstimator, is_classifier, check_version
def _lmb(distr, beta0, beta, X, eta):
"""C... | {
"content_hash": "4add8da055c578971c975bd8c5d0d363",
"timestamp": "",
"source": "github",
"line_count": 1120,
"max_line_length": 78,
"avg_line_length": 32.738392857142856,
"alnum_prop": 0.5169225734311507,
"repo_name": "the872/pyglmnet",
"id": "e4715d9c3f69e42b8291de6cb25ef463e64f4767",
"size": "36... |
from __future__ import with_statement
import os
import pytest
import redis
import time
import re
from threading import Thread
from redis.connection import ssl_available, to_bool
from .conftest import skip_if_server_version_lt
class DummyConnection(object):
description_format = "DummyConnection<>"
def __init... | {
"content_hash": "32185a3fa0a53747e3ae3b2c8ccff66c",
"timestamp": "",
"source": "github",
"line_count": 492,
"max_line_length": 79,
"avg_line_length": 36.21951219512195,
"alnum_prop": 0.5734006734006734,
"repo_name": "lamby/pkg-python-redis",
"id": "11c20080a91fb49167068632d189d4a73511c2af",
"size"... |
'''
A model to define values to mask and the masking string.
'''
import re
class Mask_Model:
def __init__(self, mask_find_regex=None, mask_replace=None):
if mask_find_regex is None:
self._mask_find_regex = re.compile("(\d\d\d-\d\d-\d\d\d\d|\d\d\d\d-\d\d\d\d-\d\d\d\d-\d\d\d\d)")
else:
... | {
"content_hash": "8c23a3b3b74a711eb6e5827dd564cebc",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 108,
"avg_line_length": 23.625,
"alnum_prop": 0.5989417989417989,
"repo_name": "kalaboster/stringer",
"id": "786bf0312e1553551a7a7692adf94e752a75edab",
"size": "1516",
"b... |
def longest_shared_prefix(s1, s2):
size = min(len(s1), len(s2))
for i in range(size):
if s1[i] != s2[i]:
return i
return size
initial = input()
desired = input()
operations = int(input())
shared_prefix_size = longest_shared_prefix(initial, desired)
operations_needed = len(initial) + len(desired) - 2 ... | {
"content_hash": "225c0cdd3ec681d6f235776760414927",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 118,
"avg_line_length": 28.22222222222222,
"alnum_prop": 0.6692913385826772,
"repo_name": "clemus90/competitive-programming",
"id": "ceeeb7478b3603565bc1b6eb01b3b4e84bf7d192"... |
from panda3d.core import *
from panda3d.direct import *
from direct.interval.IntervalGlobal import *
from direct.showbase import DirectObject
from DroppedGag import *
types = ['',
'Pie',
'Banana',
'Anvil']
class RaceGag(DirectObject.DirectObject):
def __init__(self, parent, slot, testPos):
DirectObject... | {
"content_hash": "bec5de9bf563e9745f638a42963fa723",
"timestamp": "",
"source": "github",
"line_count": 77,
"max_line_length": 85,
"avg_line_length": 30.48051948051948,
"alnum_prop": 0.5994887089902002,
"repo_name": "silly-wacky-3-town-toon/SOURCE-COD",
"id": "c40473bd9241050e9aedae22986bf03181d9c779... |
"""Tests for `tf.data.experimental.parse_example_dataset()."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import copy
import numpy as np
from tensorflow.core.example import example_pb2
from tensorflow.core.example import feature_pb2
from tensorflow.p... | {
"content_hash": "b487f4dd814fc808296f2c01177cccb5",
"timestamp": "",
"source": "github",
"line_count": 836,
"max_line_length": 86,
"avg_line_length": 35.354066985645936,
"alnum_prop": 0.5310596833130329,
"repo_name": "snnn/tensorflow",
"id": "723e709ae8dbb9ad2d27e77780c3da4a5e95c7d0",
"size": "302... |
import datetime
import tempfile
import os
from django import forms
from django.contrib.auth.models import User
from django.contrib.contenttypes import generic
from django.contrib.contenttypes.models import ContentType
from django.core.files.storage import FileSystemStorage
from django.db import models
class Section(... | {
"content_hash": "448b0619433dcadc3552d972ced48e54",
"timestamp": "",
"source": "github",
"line_count": 567,
"max_line_length": 110,
"avg_line_length": 25.74426807760141,
"alnum_prop": 0.6744536548605878,
"repo_name": "mixman/djangodev",
"id": "eb56f9b6e3b689385af5a5dee30eb949c6172edb",
"size": "14... |
from sklearn.neighbors import KNeighborsClassifier
class NearestNeighbors:
def __init__(self, k):
self.k = k
self.nn = KNeighborsClassifier(n_neighbors=k)
def fit(self, X):
self.X = X
def predict(self, l, Yl):
scores = self.nn.fit(self.X[l,:], Yl).predict(self.X)
r... | {
"content_hash": "89d882b964cb8ec4bcddef7b963ac2ed",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 61,
"avg_line_length": 25.615384615384617,
"alnum_prop": 0.6096096096096096,
"repo_name": "quark0/AnchorClouds",
"id": "4896e10c39dde8920a27bbeddb40daf6996226b7",
"size": "... |
"""Sources and sinks.
A Source manages record-oriented data input from a particular kind of source
(e.g. a set of files, a database table, etc.). The reader() method of a source
returns a reader object supporting the iterator protocol; iteration yields
raw records of unprocessed, serialized data.
A Sink manages reco... | {
"content_hash": "72e639cc9a70bf505fea0c5a39947598",
"timestamp": "",
"source": "github",
"line_count": 1148,
"max_line_length": 80,
"avg_line_length": 41.741289198606275,
"alnum_prop": 0.7060664871971452,
"repo_name": "rangadi/incubator-beam",
"id": "425137c86341ac97a6272baa3e40464317f5b316",
"siz... |
import os
import sys
from invoke import task
WHEELHOUSE_PATH = os.environ.get('WHEELHOUSE')
@task
def wheelhouse(ctx, develop=False, pty=True):
req_file = 'dev-requirements.txt' if develop else 'requirements.txt'
cmd = 'pip wheel --find-links={} -r {} --wheel-dir={}'.format(WHEELHOUSE_PATH, req_file,
... | {
"content_hash": "69eb22594c06e496a22944a83ca413d5",
"timestamp": "",
"source": "github",
"line_count": 140,
"max_line_length": 93,
"avg_line_length": 27.357142857142858,
"alnum_prop": 0.6234986945169713,
"repo_name": "CenterForOpenScience/waterbutler",
"id": "b610676bd8eb779ac84d29ae2a838cea11a4013d... |
import json
import pika
import uuid
class RPCClient(object):
def __init__(self, rabbit_url, exchange):
self._rabbit_url = rabbit_url
self._exchange = exchange
self._connection = pika.BlockingConnection(pika.URLParameters(self._rabbit_url))
self._setup_channel()
def _setup_cha... | {
"content_hash": "0a9015afb24a3c6e327d67f1967cd905",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 88,
"avg_line_length": 31.86046511627907,
"alnum_prop": 0.6124087591240875,
"repo_name": "HydAu/Projectweekends_Pi-Control-Client",
"id": "5655574aea0afafe4affffd50c55361f25d... |
from msrest.pipeline import ClientRawResponse
from msrestazure.azure_exceptions import CloudError
from msrestazure.azure_operation import AzureOperationPoller
import uuid
from .. import models
class GlobalSchedulesOperations(object):
"""GlobalSchedulesOperations operations.
:param client: Client for service... | {
"content_hash": "4cbae184b26c8f93596f408bd10064da",
"timestamp": "",
"source": "github",
"line_count": 618,
"max_line_length": 152,
"avg_line_length": 45.66181229773463,
"alnum_prop": 0.6310287395017541,
"repo_name": "SUSE/azure-sdk-for-python",
"id": "e287aa122afd42dae64b667ec855e061a43e1c84",
"s... |
"""Pilot Manager tests
"""
import os
import sys
import radical.pilot
import unittest
import uuid
from copy import deepcopy
from radical.pilot.db import Session
from pymongo import MongoClient
# DBURL defines the MongoDB server URL and has the format mongodb://host:port.
# For the installation of a MongoDB server, re... | {
"content_hash": "405a700f5d51aa469fa5776666d559bd",
"timestamp": "",
"source": "github",
"line_count": 226,
"max_line_length": 109,
"avg_line_length": 36.057522123893804,
"alnum_prop": 0.5870658976561541,
"repo_name": "JensTimmerman/radical.pilot",
"id": "599b88f815d55b7ca07c8155ae7641057c9211b1",
... |
"""
This extension adds a language field to every page. When calling the request
processors the page's language is activated.
Pages in secondary languages can be said to be a translation of a page in the
primary language (the first language in settings.LANGUAGES), thereby enabling
deeplinks between translated pages.
I... | {
"content_hash": "7bc8e88e894af72b587f73465cdb6544",
"timestamp": "",
"source": "github",
"line_count": 319,
"max_line_length": 88,
"avg_line_length": 38.789968652037615,
"alnum_prop": 0.5732988524325198,
"repo_name": "mjl/feincms",
"id": "a96bf8ad2ab5439009dfbe0d36c9c41692971295",
"size": "12525",... |
from sqlalchemy import Column
from sqlalchemy.sql.sqltypes import BigInteger, CHAR, Integer, SmallInteger
from destiny.main.bdd import Base
from destiny.utils import rep_model
class Events(Base):
__tablename__ = 'events'
eventId = Column(BigInteger, autoincrement=True, primary_key=True)
gameId = Column(B... | {
"content_hash": "3a9d30d67111c7a14fe0462ebf118da9",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 75,
"avg_line_length": 29.176470588235293,
"alnum_prop": 0.7258064516129032,
"repo_name": "Schluucht/Destiny",
"id": "576da4e1915002129179bcd92aff7940ec52ffb4",
"size": "49... |
import unittest
from nose.exc import SkipTest
class TestMainCase(unittest.TestCase):
def test_Ma(self):
print "printing: Verify assert 1"
self.assertTrue(1)
def test_Mb(self):
self.assertTrue(0, "raising: Some details")
def test_Mc(self):
print "printing: Verify assert 0"... | {
"content_hash": "af8cedfc37b0278a84faee0f375d10ef",
"timestamp": "",
"source": "github",
"line_count": 59,
"max_line_length": 69,
"avg_line_length": 21.35593220338983,
"alnum_prop": 0.626984126984127,
"repo_name": "telefonicaid/nose-html-reporting",
"id": "7ea6ec627f9184691f2d243e260d988db8baf905",
... |
#!/usr/bin/python2
#
# Copyright (c) 2009 Google Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of... | {
"content_hash": "a3f477196f56a4109962d6dcefae3eea",
"timestamp": "",
"source": "github",
"line_count": 3868,
"max_line_length": 93,
"avg_line_length": 40.10910031023785,
"alnum_prop": 0.6387567518789238,
"repo_name": "libornovax/master_thesis_code",
"id": "6ec4fb76e2c49e69f4f465ac73e07806b37b1319",
... |
import pkg_resources
from .web_server import *
from .web_interface import *
try:
__version__ = pkg_resources.get_distribution(__name__).version
except:
__version__ = 'unknown'
| {
"content_hash": "483e61e535607c02ba53362830ea91ff",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 66,
"avg_line_length": 20.666666666666668,
"alnum_prop": 0.6827956989247311,
"repo_name": "Mynti207/cs207project",
"id": "40090c379f0785b2d294b05271b5fc8ef6142340",
"size": ... |
from __future__ import unicode_literals, division, absolute_import
from builtins import * # noqa pylint: disable=unused-import, redefined-builtin
import logging
from sqlalchemy import Column, Integer, Unicode
from flexget import db_schema, plugin
from flexget.config_schema import process_config
from flexget.event i... | {
"content_hash": "fe855dfd551d111324ef8f456999bd78",
"timestamp": "",
"source": "github",
"line_count": 120,
"max_line_length": 120,
"avg_line_length": 35.84166666666667,
"alnum_prop": 0.5868402697047198,
"repo_name": "sean797/Flexget",
"id": "92d9e928ae84f42643849174567dbdb0105f2c0a",
"size": "430... |
"""Ce fichier définit le contexte-éditeur 'quitter'."""
from . import Editeur
class Supprimer(Editeur):
"""Contexte-éditeur supprimer.
Ce contexte est appelé quand on souhaite supprimer l'objet manipulé.
"""
nom = "editeur:base:supprimer"
def __init__(self, pere, objet=None, at... | {
"content_hash": "4ab19d6574e0a3e7c0e9bd656a444a86",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 72,
"avg_line_length": 30.146341463414632,
"alnum_prop": 0.5533980582524272,
"repo_name": "vlegoff/tsunami",
"id": "fd05b4dab753cbe720185ca5793b16893718eaf7",
"size": "2813... |
"""This module helper query builder for my dashboard page."""
from sqlalchemy import and_
from sqlalchemy import case
from sqlalchemy import literal
from sqlalchemy import or_
from sqlalchemy import true
from sqlalchemy import union
from sqlalchemy import alias
from sqlalchemy.orm import aliased
from ggrc import db
fro... | {
"content_hash": "92be7cf566aa9a1a6e179ab02a5e9d60",
"timestamp": "",
"source": "github",
"line_count": 283,
"max_line_length": 79,
"avg_line_length": 35.32862190812721,
"alnum_prop": 0.6380276055211043,
"repo_name": "plamut/ggrc-core",
"id": "55e8ccdff6e22381a9186671c211cb56a3519c59",
"size": "101... |
from tempest.api.compute import base
from tempest.common.utils import data_utils
from tempest.common import waiters
from tempest import config
from tempest import test
CONF = config.CONF
class VolumesSnapshotsTestJSON(base.BaseV2ComputeTest):
@classmethod
def skip_checks(cls):
super(VolumesSnapshot... | {
"content_hash": "d38c585066be522e555e00efdbc449d7",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 79,
"avg_line_length": 41.36206896551724,
"alnum_prop": 0.6302626094205919,
"repo_name": "tonyli71/tempest",
"id": "a00c0bad1319365d82341ed0077c10491347fb26",
"size": "3040... |
import os
import tempfile
import unittest
from unittest import mock
from unittest.mock import MagicMock, call
import kubernetes
from airflow.cli import cli_parser
from airflow.cli.commands import kubernetes_command
class TestGenerateDagYamlCommand(unittest.TestCase):
@classmethod
def setUpClass(cls):
... | {
"content_hash": "d4676727ddf274f40f3a8d378d137169",
"timestamp": "",
"source": "github",
"line_count": 215,
"max_line_length": 108,
"avg_line_length": 43.730232558139534,
"alnum_prop": 0.6379493724739417,
"repo_name": "apache/incubator-airflow",
"id": "490c7fafc5b66ed25722ef5fe56c6380f3f0f3f9",
"s... |
from __future__ import absolute_import
import json
import datetime
import pytz
import logging
from django.core.mail import send_mail
from django.contrib.auth import authenticate, login as auth_login
from django.contrib.auth.decorators import login_required
from django.contrib.auth.models import Group, User
from django... | {
"content_hash": "b459a8203d904cf605c0d0f2113ae47e",
"timestamp": "",
"source": "github",
"line_count": 1724,
"max_line_length": 133,
"avg_line_length": 44.77030162412993,
"alnum_prop": 0.626969320066335,
"repo_name": "ResearchSoftwareInstitute/MyHPOM",
"id": "549b4a8ea83f8366085351a38d33cb762d49d636... |
"""
Generators for some directed graphs, including growing network (GN) graphs and
scale-free graphs.
"""
# Copyright (C) 2006-2009 by
# Aric Hagberg <hagberg@lanl.gov>
# Dan Schult <dschult@colgate.edu>
# Pieter Swart <swart@lanl.gov>
# All rights reserved.
# BSD license.
__author__ ="""Aric Hagber... | {
"content_hash": "3e21ecadae127a446a74b9620e056e46",
"timestamp": "",
"source": "github",
"line_count": 306,
"max_line_length": 133,
"avg_line_length": 31.81699346405229,
"alnum_prop": 0.607025472473295,
"repo_name": "michaelpacer/networkx",
"id": "ecd3a4d9a5bc4092ab93c6aab2877fa18fe00bfd",
"size":... |
from helpers.basehelper import BaseHelper
from telnetlib import Telnet
class JamesHelper(BaseHelper):
def __init__(self, app):
self.app = app
def ensure_user_exists(self, username, password):
james_config = self.app.config["james"]
session = JamesHelper.Session(james_config["host"], j... | {
"content_hash": "3d0e747b2a5c9c3175466432a04c3077",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 89,
"avg_line_length": 37.520833333333336,
"alnum_prop": 0.5791227096057746,
"repo_name": "dkorogodin/python_mantis",
"id": "8a14e376ed66af55ad9718c948a6b308b6b18ec3",
"siz... |
""" Test foglamp.services.core server """
import asyncio
import json
from unittest import mock
from unittest.mock import MagicMock, patch
from aiohttp import web
from aiohttp.test_utils import make_mocked_request
from aiohttp.streams import StreamReader
from multidict import CIMultiDict
import pytest
from foglamp.ser... | {
"content_hash": "0aa39b15f2fcfd7279020022684c37d5",
"timestamp": "",
"source": "github",
"line_count": 663,
"max_line_length": 210,
"avg_line_length": 48.56108597285068,
"alnum_prop": 0.6414772021369114,
"repo_name": "foglamp/FogLAMP",
"id": "0fcb00a9cf7e9ac2244cb4ee156402a55563d54c",
"size": "322... |
from neutron_lib.api.definitions import agent
from neutron_lib.api.definitions import availability_zone
from neutron_lib.tests.unit.api.definitions import base
class AvailabilityZoneDefinitionTestCase(base.DefinitionBaseTestCase):
extension_module = availability_zone
extension_resources = (availability_zone.C... | {
"content_hash": "32dec794ab91805e8e3cd600d2979a74",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 70,
"avg_line_length": 47.81818181818182,
"alnum_prop": 0.7262357414448669,
"repo_name": "openstack/neutron-lib",
"id": "d854d8ab947f3ee715a84bddfac9f8f5c712c40f",
"size": ... |
"""
ERP+
"""
__author__ = 'António Anacleto'
__credits__ = []
__version__ = "1.0"
__maintainer__ = "António Anacleto"
__status__ = "Development"
__model_name__= 'sub_familia_produto.SubFamiliaProduto'
import auth, base_models
from orm import *
from form import *
class SubFamiliaProduto(Model, View):
def __init__(s... | {
"content_hash": "222134430687b8e60fdfe9ef030e126f",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 92,
"avg_line_length": 31.073170731707318,
"alnum_prop": 0.5313971742543171,
"repo_name": "IdeaSolutionsOnline/ERP4R",
"id": "7bd13ab5bfcdc0c8219deb124ef8a21444b4fc71",
"si... |
from __future__ import absolute_import, division, print_function
import tensorflow as tf
def full_connect(inputs,
weights_shape,
biases_shape,
is_train=True,
FLAGS=None):
with tf.device("/cpu:0"):
weights = tf.get_variable(
"weights", ... | {
"content_hash": "34c8633560e16aaeb5c726d073be82e3",
"timestamp": "",
"source": "github",
"line_count": 113,
"max_line_length": 79,
"avg_line_length": 39.31858407079646,
"alnum_prop": 0.5876659914472203,
"repo_name": "tobegit3hub/deep_recommend_system",
"id": "38faecf1fb3a1678fb2a631496d4a94d60689773... |
import numpy as np
import pandas as pd
from sklearn.metrics.cluster import silhouette_samples, silhouette_score
def silhouette(adata, group_key, embed, metric="euclidean", scale=True):
"""Average silhouette width (ASW)
Wrapper for sklearn silhouette function values range from [-1, 1] with
* 1 indica... | {
"content_hash": "41ae725e281c1f0cf0fad01d3eb0772c",
"timestamp": "",
"source": "github",
"line_count": 124,
"max_line_length": 121,
"avg_line_length": 32.87096774193548,
"alnum_prop": 0.6351815505397449,
"repo_name": "theislab/scib",
"id": "4341e4fb1e46d010006b609ae984b6fa4964af8d",
"size": "4076"... |
"""
Notes views
"""
from flask import (
Blueprint,
escape,
jsonify,
redirect,
render_template,
request,
url_for)
from flask_login import current_user
from flask_security import login_required
from sqlalchemy import desc, or_
from app.blueprints.notes.email_tip import EmailTip
from app.blue... | {
"content_hash": "00e442d4ec6edaa819c351c745c1c5fb",
"timestamp": "",
"source": "github",
"line_count": 140,
"max_line_length": 76,
"avg_line_length": 23.742857142857144,
"alnum_prop": 0.635078219013237,
"repo_name": "crossgovernmentservices/csd-notes",
"id": "cc5cce733acd2c764baa9ec5fa5aa516325495cf... |
import abc
import collections
import threading
from oslo_log import log as logging
import six
from oslo_messaging._drivers import common
LOG = logging.getLogger(__name__)
@six.add_metaclass(abc.ABCMeta)
class Pool(object):
"""A thread-safe object pool.
Modelled after the eventlet.pools.Pool interface, bu... | {
"content_hash": "b2ab3f36d05ee4fdda2d6ef2410922b4",
"timestamp": "",
"source": "github",
"line_count": 99,
"max_line_length": 77,
"avg_line_length": 27.484848484848484,
"alnum_prop": 0.5608232267548695,
"repo_name": "dims/oslo.messaging",
"id": "699ce5c10048a26ef4aa140891d706e2c16c3cfa",
"size": "... |
import sys, os
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#sys.path.insert(0, os.path.abspath('.'))
sys.path.insert(0, '_ext... | {
"content_hash": "2c01d6b224360b4eef26f0f02d839b17",
"timestamp": "",
"source": "github",
"line_count": 204,
"max_line_length": 80,
"avg_line_length": 32.59803921568628,
"alnum_prop": 0.7061654135338346,
"repo_name": "PointCloudLibrary/blog",
"id": "e9974402f107de012bafdd69beae2f42f479daaa",
"size"... |
from . import taskdbs, defaults, utils, workers
from .workers import *
from .taskdbs import *
from .defaults import (TASK_STATES,
LIST_OF_TASK_STATES,
TASK_LOG_ACTIONS,
VALID_LOG_CHECKIN_ACTIONS,
TASKDB_STATES)
| {
"content_hash": "aeffe9618b619103d5ebcce390edab6e",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 49,
"avg_line_length": 37.875,
"alnum_prop": 0.5379537953795379,
"repo_name": "beckermr/cake",
"id": "19b4831edcea5b896a0dd7cc20df130a785e889a",
"size": "318",
"binary": f... |
from __future__ import with_statement
import itertools
import collections
import numpy
import datetime
import timeit
import logging
import nltk
import csv
import re
import pandas
import pickle
import codecs
import random
import json
#from gensim import corpora, models, similarities
#from nltk.util import ngrams
from d... | {
"content_hash": "e39081d863d1b1ec891a3f628eaadd29",
"timestamp": "",
"source": "github",
"line_count": 147,
"max_line_length": 104,
"avg_line_length": 26.959183673469386,
"alnum_prop": 0.6845823870804946,
"repo_name": "SingaporeNews/singaporenews.github.io",
"id": "0054f588d71364e58ec1a0b14632c74108... |
from pymoku import Moku
from pymoku.instruments import LockInAmp
import matplotlib.pyplot as plt
from matplotlib.ticker import FuncFormatter
# Connect to your Moku by its device name
# Alternatively, use Moku.get_by_serial('#####') or Moku('192.168.###.###')
m = Moku.get_by_name('Moku')
try:
i = m.deploy_or_conn... | {
"content_hash": "bcd214f5fee4f20d25ad723f043115be",
"timestamp": "",
"source": "github",
"line_count": 71,
"max_line_length": 79,
"avg_line_length": 32.33802816901409,
"alnum_prop": 0.6520034843205574,
"repo_name": "liquidinstruments/pymoku",
"id": "d0a5fb4613f599a4b1d4ad39fd37d9a655537afc",
"size... |
import logging
class NullHandler(logging.Handler):
def emit(self, record):
pass
log = logging.getLogger('VizTestResults')
log.setLevel(logging.ERROR)
log.addHandler(NullHandler())
import VizjQuery
class VizTestResults(VizjQuery.VizjQuery):
#======================== header ============... | {
"content_hash": "5fae675797745596b4cfdd97d4260316",
"timestamp": "",
"source": "github",
"line_count": 314,
"max_line_length": 117,
"avg_line_length": 37.452229299363054,
"alnum_prop": 0.42772108843537415,
"repo_name": "twatteyne/dustlink_academy",
"id": "576a2ea61cf0cef13fd22f347ae20bf4c4d54d62",
... |
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('herana', '0002_populate_questionnaire_options'),
]
operations = [
migrations.AddField(
model_name='strategicobjective',
name... | {
"content_hash": "faa09c427cfc97e48a0a5d640777a79d",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 112,
"avg_line_length": 34.093023255813954,
"alnum_prop": 0.5927694406548432,
"repo_name": "Code4SA/herana",
"id": "7d8d34ac6286b533e972a8200b9a6d1b177fa3b0",
"size": "1490... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.