text stringlengths 4 1.02M | meta dict |
|---|---|
"""Tests for the view with a list of projects."""
from tests import profile_utils
from tests import test_utils
from tests.utils import project_utils
class ProjectListTest(test_utils.GSoCDjangoTestCase):
"""Tests project list page."""
def setUp(self):
self.init()
def assertProjectTemplatesUsed(self, respo... | {
"content_hash": "bff571d27903073ed5a4f239cbb291d2",
"timestamp": "",
"source": "github",
"line_count": 46,
"max_line_length": 80,
"avg_line_length": 33.91304347826087,
"alnum_prop": 0.7121794871794872,
"repo_name": "rhyolight/nupic.son",
"id": "0d6803753b399d60cb7a0f3aaaefe83adbb1e2ca",
"size": "2... |
"""
_models_admin.py
"""
_models_admin_code = '''# coding: utf-8
"""
sql models
use: Flask-SQLAlchemy
-- http://flask-sqlalchemy.pocoo.org/2.1/
"""
from . import db, login_manager
from werkzeug.security import generate_password_hash, check_password_hash
from flask_login import UserMixin, AnonymousUserM... | {
"content_hash": "6e3ca1be7014c4d7742c8546b9e1ddee",
"timestamp": "",
"source": "github",
"line_count": 114,
"max_line_length": 73,
"avg_line_length": 25.86842105263158,
"alnum_prop": 0.6035944387928112,
"repo_name": "neo1218/mana",
"id": "8ca875e9558a6a4bc7020f9d1614e58644f75013",
"size": "2965",
... |
from django.core.handlers.wsgi import WSGIRequest
from django.test import TestCase
import mock
from nose.tools import eq_, ok_
from rest_framework.serializers import Serializer, ValidationError
from test_utils import RequestFactory
from mkt.users.models import UserProfile
from mkt.api.serializers import PotatoCaptcha... | {
"content_hash": "0510ab655ae8a2201b53b4ec563fab85",
"timestamp": "",
"source": "github",
"line_count": 81,
"max_line_length": 77,
"avg_line_length": 38.925925925925924,
"alnum_prop": 0.6422454804947669,
"repo_name": "ngokevin/zamboni",
"id": "4ba0a5ee475ec8cd2fad86c9e159effc237ed5ff",
"size": "317... |
WIDTH = 640
HEIGHT = 480
class Ball(ZRect): pass
#
# The ball is a red square halfway across the game screen
#
ball = Ball(0, 0, 30, 30)
ball.center = WIDTH / 2, HEIGHT / 2
ball.colour = "red"
#
# The ball moves one step right and one step down each tick
#
ball.direction = 1, 1
#
# The ball moves at a s... | {
"content_hash": "d01c4d597f23ef69ba31c27b270f6fb6",
"timestamp": "",
"source": "github",
"line_count": 64,
"max_line_length": 68,
"avg_line_length": 23.578125,
"alnum_prop": 0.6096752816434725,
"repo_name": "westpark/wallball",
"id": "ffccbc7675126074baa9b3d3923d64b447d01836",
"size": "1509",
"b... |
import sqlite3
import argparse
import boto.mturk.connection
TRIM_DIFFERENCE_MAX = 1.0
def main(video_db, mturk_db, sandbox, aws_access_key_id, aws_secret_access_key):
"""
Command line tool to decide whether assignments are rejected
"""
# TODO verify correct verification labels here
# TODO make Mtu... | {
"content_hash": "a415a11e2a74c5746cdf7139ea730c40",
"timestamp": "",
"source": "github",
"line_count": 145,
"max_line_length": 130,
"avg_line_length": 49.42758620689655,
"alnum_prop": 0.5265801590623692,
"repo_name": "happyharrycn/vatic_fpv",
"id": "357a5fe408e535bdf841d44929efaa983ce37fdd",
"size... |
# http://www.pythonchallenge.com/pc/return/5808.html
# If needed, use username and password from challenge 8
from os import path
import numpy as np
import matplotlib.pyplot as plt
from PIL import Image, ImageOps
from utils import download_file
def solve11():
filepath = download_file(
... | {
"content_hash": "4e657a94b03f3074fd66af6fd3301c57",
"timestamp": "",
"source": "github",
"line_count": 94,
"max_line_length": 75,
"avg_line_length": 25.372340425531913,
"alnum_prop": 0.5220125786163522,
"repo_name": "f171a9a3497c8b/python_playground",
"id": "fc5a2e2c6217ef10398d127d8b3396fe71eb18e4"... |
from airflow.models import BaseOperator
from airflow.utils import apply_defaults
from airflow.exceptions import AirflowException
from airflow.contrib.hooks.emr_hook import EmrHook
class EmrTerminateJobFlowOperator(BaseOperator):
"""
Operator to terminate EMR JobFlows.
:param job_flow_id: id of the JobFlo... | {
"content_hash": "3d0b95b08dfb12cbeb360a71c841fb61",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 79,
"avg_line_length": 33.666666666666664,
"alnum_prop": 0.6428027418126429,
"repo_name": "RealImpactAnalytics/airflow",
"id": "9d210922009e27fcb250fb8fc04e8b15fed4893b",
"... |
"""
Support for monitoring energy usage using the DTE energy bridge.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/sensor.dte_energy_bridge/
"""
import logging
import voluptuous as vol
from homeassistant.helpers.entity import Entity
from homeassistant... | {
"content_hash": "0d170ed37186e5295cb7bcbf58bbe5a8",
"timestamp": "",
"source": "github",
"line_count": 95,
"max_line_length": 74,
"avg_line_length": 29.05263157894737,
"alnum_prop": 0.6333333333333333,
"repo_name": "varunr047/homefile",
"id": "90b484f46dc52efa6fdaeabcd13c5435dbe1a8f2",
"size": "27... |
"""Module for testing the add/del/show hub command."""
import unittest
if __name__ == "__main__":
import utils
utils.import_depends()
from brokertest import TestBrokerCommand
class TestHub(TestBrokerCommand):
def test_100_add_hub1_default_org(self):
command = ["add", "hub", "--hub", "hub1", "-... | {
"content_hash": "99ba1128ca44dc12cce5e5ac57bc5259",
"timestamp": "",
"source": "github",
"line_count": 120,
"max_line_length": 88,
"avg_line_length": 37.833333333333336,
"alnum_prop": 0.5797356828193833,
"repo_name": "guillaume-philippon/aquilon",
"id": "3af3307cf4ea97a291170974b4c5f440b215b9c2",
... |
from wallace.db.redisdb.hash import RedisHash
from wallace.errors import ConfigError
class ExpiringRedisHash(RedisHash):
ttl = None # must explicitly set ttl
def __init__(self):
RedisHash.__init__(self)
if not isinstance(self.ttl, int) or self.ttl < 1:
raise ConfigError(801, 'i... | {
"content_hash": "c4aa52cd3ced0b90f902fed572e248da",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 75,
"avg_line_length": 31,
"alnum_prop": 0.6415770609318996,
"repo_name": "csira/wallace",
"id": "abbcf7f99db8aa426a0c4df41116d788da7d7e3f",
"size": "558",
"binary": fals... |
from __future__ import print_function
import matplotlib
import numpy as np
import copy
import re
import itertools
from astropy import log
from astropy import units as u
from astropy.extern.six.moves import xrange
from ..config import mycfg
from ..config import ConfigDescriptor as cfgdec
from . import units
from . impo... | {
"content_hash": "fdd4ea92111cff1147f1204cc0c06853",
"timestamp": "",
"source": "github",
"line_count": 1999,
"max_line_length": 171,
"avg_line_length": 44.05702851425713,
"alnum_prop": 0.5583967298739639,
"repo_name": "mikelum/pyspeckit",
"id": "3450a94651b3566fbbdef85c08e3e8aa94d4dcc9",
"size": "... |
from django.contrib.auth.models import User
from rhinocloud.utils import random_generator
def generate_username_from_email(sender, instance, **kwargs):
if isinstance(instance, User):
email = instance.email
username = random_generator(email[:25])
while sender.objects.filter(username=usernam... | {
"content_hash": "a2abb4a50a6e3c86af082fd42dd4d7f1",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 64,
"avg_line_length": 37.19230769230769,
"alnum_prop": 0.6463288521199586,
"repo_name": "allanlei/rhinocloud-utils",
"id": "6be41bcd6dd8fa15d119543ee2ff31162b5f3964",
"siz... |
"""
Non-cython methods for getting counts and distributions from data.
"""
import numpy as np
__all__ = (
'counts_from_data',
'distribution_from_data',
'get_counts',
)
try: # cython
from .pycounts import counts_from_data, distribution_from_data
except ImportError: # no cython
from boltons.... | {
"content_hash": "d01f335ee4bd40f0b1e3790d7784ba77",
"timestamp": "",
"source": "github",
"line_count": 185,
"max_line_length": 98,
"avg_line_length": 34.556756756756755,
"alnum_prop": 0.6137963397465979,
"repo_name": "dit/dit",
"id": "904094329ff8325a20831b3a1e7275e3f63505a3",
"size": "6393",
"b... |
from tsgettoolbox import tsgettoolbox
# %% [markdown]
# Let's say that I want flow (parameterCd=00060) for site '02325000'. All of the tsgettoolbox functions create a _pandas_ DataFrame.
# %%
df = tsgettoolbox.nwis_dv(sites="02325000", startDT="2000-01-01", parameterCd="00060")
# %%
df.head() # The .head() functio... | {
"content_hash": "7f63f05ed7fc322900a65e173e8dff9d",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 133,
"avg_line_length": 24.959183673469386,
"alnum_prop": 0.6729354047424366,
"repo_name": "timcera/tsgettoolbox",
"id": "95e7d88e637c5635bc8385dcda4031ff21b7350b",
"size":... |
""" DB Reporting Wrapper
"""
from .database import Database
# Depreciated
from .database import retrieve_data
from .database import insert_data
from .database import insert_data_many
from .database import run_command
| {
"content_hash": "6f58a840206bceaa25be523253f5b6f3",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 38,
"avg_line_length": 21.9,
"alnum_prop": 0.7899543378995434,
"repo_name": "aguinane/dbReportingWrapper",
"id": "08eda36ce1eed583fec852ca28979a091c21ef2d",
"size": "219",
... |
from __future__ import unicode_literals
import webnotes, json
from webnotes.utils import cint, now, cstr
from webnotes import _
class DocType:
def __init__(self, doc, doclist):
self.doc = doc
self.doclist = doclist
def autoname(self):
"""set name as email id"""
if self.doc.name not in ('Guest','Administra... | {
"content_hash": "5161b8d0c692648e16bf9249d6909592",
"timestamp": "",
"source": "github",
"line_count": 310,
"max_line_length": 100,
"avg_line_length": 32.806451612903224,
"alnum_prop": 0.6764995083579154,
"repo_name": "gangadhar-kadam/mic-wnframework",
"id": "f0ee9ffe9ee60f2d623799971452b0c90fa843c1... |
"""
Module: mediahandler.types.tv
Module contains:
- |MHTv|
Child class of MHMediaType for the TV media type.
"""
import os
import logging
from re import escape, search, sub, IGNORECASE
import mediahandler.types
class MHTv(mediahandler.types.MHMediaType):
"""Child class of MHMediaType for the TV ... | {
"content_hash": "ba964c1c01a6af056aae34b4a8b6e857",
"timestamp": "",
"source": "github",
"line_count": 104,
"max_line_length": 78,
"avg_line_length": 26.403846153846153,
"alnum_prop": 0.5509832483612528,
"repo_name": "ErinMorelli/em-media-handler",
"id": "5eb22d5276baf5c465ad5b6ea615f96c9e21ffb1",
... |
import mxnet as mx
def mlp_layer(input_layer, n_hidden, activation=None, BN=False):
"""
A MLP layer with activation layer and BN
:param input_layer: input sym
:param n_hidden: # of hidden neurons
:param activation: the activation function
:return: the symbol as output
"""
# get a FC ... | {
"content_hash": "d2b7e346e8d97d1f46683d975228dc48",
"timestamp": "",
"source": "github",
"line_count": 107,
"max_line_length": 85,
"avg_line_length": 30.50467289719626,
"alnum_prop": 0.5612745098039216,
"repo_name": "amigao0502/AI",
"id": "4d479c9ded848acf5ce8ad8e471fb88fa141f26b",
"size": "3264",... |
from strands_executive_msgs.msg import Task
import rospy
import json
import requests
from calendar import timegm
from dateutil import parser
from dateutil import tz
from datetime import datetime
from datetime import timedelta
from strands_executive_msgs.srv import CreateTask
from pprint import pprint
from threading i... | {
"content_hash": "ebde624b4e6f918e6537bb9411ee56de",
"timestamp": "",
"source": "github",
"line_count": 218,
"max_line_length": 78,
"avg_line_length": 38.862385321100916,
"alnum_prop": 0.5308073654390935,
"repo_name": "bfalacerda/strands_executive",
"id": "9365f49b8e3ed576e25df0cad86541e12c13b27e",
... |
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: v1.8.2
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import os
import sys
import unittest
im... | {
"content_hash": "b76d4fd26ed6a92cb019cdb95d1d54e2",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 105,
"avg_line_length": 22.095238095238095,
"alnum_prop": 0.6875,
"repo_name": "mbohlool/client-python",
"id": "ff46a61db1c874e1cf050167b0bebeed24bea5f9",
"size": "945",
... |
import os
import re
PACKAGE_NAME_MESSAGE_TYPE_SEPARATOR = '/'
COMMENT_DELIMITER = '#'
CONSTANT_SEPARATOR = '='
ARRAY_UPPER_BOUND_TOKEN = '<='
STRING_UPPER_BOUND_TOKEN = '<='
SERVICE_REQUEST_RESPONSE_SEPARATOR = '---'
SERVICE_REQUEST_MESSAGE_SUFFIX = '_Request'
SERVICE_RESPONSE_MESSAGE_SUFFIX = '_Response'
PRIMITIVE_... | {
"content_hash": "e99ac17f0bd44b52b127515cc9bc1d65",
"timestamp": "",
"source": "github",
"line_count": 628,
"max_line_length": 91,
"avg_line_length": 35.68789808917197,
"alnum_prop": 0.5655006246653579,
"repo_name": "esteve/rosidl",
"id": "47a27656358bb49333dc0a0824b8c07d70e8f43b",
"size": "23019"... |
"""Windows UserAssist information collector."""
import codecs
import logging
from winregrc import data_format
from winregrc import errors
from winregrc import interface
class UserAssistEntry(object):
"""UserAssist entry.
Attributes:
guid (str): GUID.
name (str): name.
value_name (str): name of the ... | {
"content_hash": "d03704435f80ecdaa38d2d73df279d91",
"timestamp": "",
"source": "github",
"line_count": 216,
"max_line_length": 80,
"avg_line_length": 34.041666666666664,
"alnum_prop": 0.6716986264109888,
"repo_name": "libyal/winreg-kb",
"id": "bba66b74bdf36fdad84459584593765882f3bd5f",
"size": "73... |
"""Contains the logic for `aq update city`."""
from sqlalchemy.orm import with_polymorphic
from aquilon.exceptions_ import ArgumentError
from aquilon.aqdb.model import (City, Campus, HardwareEntity, Machine,
NetworkDevice, Cluster, Network)
from aquilon.worker.broker import BrokerComma... | {
"content_hash": "b24890504f9906cef85fc5433e3c3441",
"timestamp": "",
"source": "github",
"line_count": 90,
"max_line_length": 106,
"avg_line_length": 38.522222222222226,
"alnum_prop": 0.5985001442169022,
"repo_name": "quattor/aquilon",
"id": "37311bbc402840fb2ce14b7657fcc04a808dee44",
"size": "419... |
import MySQLdb
import MySQLdb.cursors
import json
import datetime
import requests
import time
''' PUSH '''
DOMAIN='YOURDOMAIN.opendatasoft.com'
PUSH_OR_API_LEY='YOUR API KEY HERE'
push_base_url = 'http://%s/api/push/1.0/am/realtime/push/?pushkey=%s'%(DOMAIN,PUSH_OR_API_LEY)
# A specific datetime encoder for json.dump... | {
"content_hash": "eb24c803b5a4a42a8b902278832290ae",
"timestamp": "",
"source": "github",
"line_count": 68,
"max_line_length": 105,
"avg_line_length": 30.176470588235293,
"alnum_prop": 0.6276803118908382,
"repo_name": "opendatasoft/ods-cookbook",
"id": "2044cb0d8679e0f4ef9f8b3d5ba5f82b2fc66d58",
"s... |
"""
Jumping rules for MCMC
======================
This module contains classes that implement jumping rules for MCMC.
"""
import numpy as np
class RandomWalk:
"""
Random walk jumping function for MCMC.
"""
def __init__(self, covmat):
"""
Create a random walker with given covariance.
... | {
"content_hash": "2513655e1ea614049d3062383e3cb001",
"timestamp": "",
"source": "github",
"line_count": 64,
"max_line_length": 85,
"avg_line_length": 31.921875,
"alnum_prop": 0.574645129711209,
"repo_name": "atmtools/typhon",
"id": "d8dcba93f950bc0a2b2d52d5b32a4507d670cecd",
"size": "2043",
"bina... |
"""
Django settings for todolist project.
Generated by 'django-admin startproject' using Django 1.9.2.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.9/ref/settings/
"""
import os
#... | {
"content_hash": "c57ff5da38b922b575530c5cdd8c5aea",
"timestamp": "",
"source": "github",
"line_count": 203,
"max_line_length": 91,
"avg_line_length": 28.65024630541872,
"alnum_prop": 0.672971114167813,
"repo_name": "mannyrivera2010/todolist-py3-drf",
"id": "c56bc4a8ffea219030e6d6080846f38556a4f151",... |
"""
.. module:: models
"""
import logging
import os
import uuid
from django.contrib.auth.models import User
from django.db import models
from django.db.models import F
from django.db.models import Q
from django.utils import timezone
logger = logging.getLogger('volontulo.models')
def upload_to_offers(_, filename):
... | {
"content_hash": "0d83c86150b1c8b4e7ad11ecb5966b9f",
"timestamp": "",
"source": "github",
"line_count": 181,
"max_line_length": 77,
"avg_line_length": 30.895027624309392,
"alnum_prop": 0.6421673819742489,
"repo_name": "w1stler/volontulo",
"id": "f4a85cf064d11d23114936e9acc7bf29c06b577d",
"size": "5... |
"""Models and helper functions for access to app's datastore metadata.
These entities cannot be created by users, but are created as results of
__namespace__, __kind__ and __property__ metadata queries such as
# Find all namespaces
q = db.GqlQuery("SELECT * FROM __namespace__")
for p in q.run():
print "name... | {
"content_hash": "75efbcf987e7c21c22eb2b6e2ab36754",
"timestamp": "",
"source": "github",
"line_count": 291,
"max_line_length": 79,
"avg_line_length": 25.848797250859107,
"alnum_prop": 0.6430470619516087,
"repo_name": "adviti/melange",
"id": "a6b612a7d8006cf8cae7804ff4eb44888aaedd5e",
"size": "8127... |
import inspect
import re
from lollipop.compat import DictMixin, iterkeys
import collections
def identity(value):
"""Function that returns its argument."""
return value
def constant(value):
"""Returns function that takes any arguments and always returns given value."""
def func(*args, **kwargs):
... | {
"content_hash": "29fa41562699850fc7334ece702c948c",
"timestamp": "",
"source": "github",
"line_count": 183,
"max_line_length": 89,
"avg_line_length": 25.81967213114754,
"alnum_prop": 0.5887830687830687,
"repo_name": "maximkulkin/lollipop",
"id": "d41fa2735d97672b2c6ca2eeb37fd3e8dc9d7de3",
"size": ... |
"""Utils needed for Google Hangouts."""
from hangups import CredentialsPrompt, GoogleAuthError, RefreshTokenCache
class Google2FAError(GoogleAuthError):
"""A Google authentication request failed."""
class HangoutsCredentials(CredentialsPrompt):
"""Google account credentials.
This implementation gets t... | {
"content_hash": "08aa3bb60c58067f6502ce0b90b1b262",
"timestamp": "",
"source": "github",
"line_count": 81,
"max_line_length": 73,
"avg_line_length": 24.493827160493826,
"alnum_prop": 0.6008064516129032,
"repo_name": "HydrelioxGitHub/home-assistant",
"id": "9aff7730201ac9c615e890942100c133dc7397ca",
... |
import setuptools
install_requires = [
'PrettyTable==0.7.2',
'kazoo==1.00',
'simplejson',
'argparse',
'requests',
'kafka-python'
]
setuptools.setup(
name = 'stormkafkamon',
version = '0.1.1',
license = 'Apache',
description = '''Monitor offsets of a storm kafka spout.''',
a... | {
"content_hash": "1acbb4e2de48d3c0bfaff04295f2d1f9",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 103,
"avg_line_length": 26.419354838709676,
"alnum_prop": 0.6105006105006106,
"repo_name": "vivekrao1985/stormkafkamon",
"id": "49f029b3fe2e4b602468f3c4818f8555288acfae",
"... |
from django.http import HttpResponse
from django.contrib.auth import authenticate
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
from piston.handler import BaseHandler as Handler
from piston.emitters import JSONEmitter, Emitter
from opps.api.models import ApiKey
class UncachedEmitter(JSONE... | {
"content_hash": "2c9d698ae73cb15b08783e20ee2f6bab",
"timestamp": "",
"source": "github",
"line_count": 127,
"max_line_length": 78,
"avg_line_length": 32.52755905511811,
"alnum_prop": 0.6051803437424352,
"repo_name": "YACOWS/opps",
"id": "d5f504a6b71be3bc732a5f88fe282dafbf910b32",
"size": "4177",
... |
import re
from itertools import chain
from .nodes import (
Argument,
Comment,
ExternalLink,
Heading,
HTMLEntity,
Node,
Tag,
Template,
Text,
Wikilink,
)
from .smart_list.list_proxy import ListProxy
from .string_mixin import StringMixIn
from .utils import parse_anything
__all__ =... | {
"content_hash": "29a429ac153be4681d83f0e8fccb1eb1",
"timestamp": "",
"source": "github",
"line_count": 694,
"max_line_length": 84,
"avg_line_length": 42.46685878962536,
"alnum_prop": 0.5816707383279045,
"repo_name": "earwig/mwparserfromhell",
"id": "4d4f9b30486dbfb32a3f9a5af76522e2c16d10cb",
"size... |
from . import AWSObject, AWSProperty, Tags
from .validators import boolean
def attribute_type_validator(x):
valid_types = ["S", "N", "B"]
if x not in valid_types:
raise ValueError("AttributeType must be one of: %s" %
", ".join(valid_types))
return x
def key_type_validato... | {
"content_hash": "a8bf3d8fbb22b9d6125448210801a0e7",
"timestamp": "",
"source": "github",
"line_count": 104,
"max_line_length": 79,
"avg_line_length": 26.307692307692307,
"alnum_prop": 0.6085526315789473,
"repo_name": "7digital/troposphere",
"id": "978a4691a915e9b7d02a2e719a5e88107a5e736d",
"size":... |
import numpy as np
from numpy.testing import *
class TestArrayRepr(object):
def test_nan_inf(self):
x = np.array([np.nan, np.inf])
assert_equal(repr(x), 'array([ nan, inf])')
if __name__ == "__main__":
run_module_suite()
| {
"content_hash": "7c21f3044bea418c1d3f4c7e42ece640",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 52,
"avg_line_length": 24.8,
"alnum_prop": 0.592741935483871,
"repo_name": "dagss/numpy_svn",
"id": "954869727eda905a12cd32c7521b375fd407e2bf",
"size": "248",
"binary": f... |
import sys
import unittest
import libsbml
class TestSpeciesReference_newSetters(unittest.TestCase):
global sr
sr = None
def setUp(self):
self.sr = libsbml.SpeciesReference(2,4)
if (self.sr == None):
pass
pass
def tearDown(self):
_dummyList = [ self.sr ]; _dummyList[:] = []; del ... | {
"content_hash": "71791766f3b5846dd94ef87fd0cb1c3c",
"timestamp": "",
"source": "github",
"line_count": 245,
"max_line_length": 72,
"avg_line_length": 35.06122448979592,
"alnum_prop": 0.6626309662398138,
"repo_name": "TheCoSMoCompany/biopredyn",
"id": "ba5cdd25dcddcb0068a734eb8d694548221ced21",
"si... |
import asyncio
import gc
import inspect
import io
import re
import unittest
import unittest.mock
import urllib.parse
import zlib
from http.cookies import SimpleCookie
from multidict import CIMultiDict, CIMultiDictProxy, upstr
import pytest
import aiohttp
from aiohttp import BaseConnector
from aiohttp.client_reqrep im... | {
"content_hash": "250058a015809f68d1db620be4517df5",
"timestamp": "",
"source": "github",
"line_count": 943,
"max_line_length": 79,
"avg_line_length": 35.3711558854719,
"alnum_prop": 0.5900164892819667,
"repo_name": "elastic-coders/aiohttp",
"id": "a4f41a66f55b554eee3f382b0c0ec768062efed3",
"size":... |
import os.path
from migrate.versioning import api
from config import SQLALCHEMY_DATABASE_URI
from config import SQLALCHEMY_MIGRATE_REPO
from app import db
db.create_all()
if not os.path.exists(SQLALCHEMY_MIGRATE_REPO):
api.create(SQLALCHEMY_MIGRATE_REPO, 'database repository')
api.version_control(SQLALCHEMY... | {
"content_hash": "1b8c3d7ef75e0514cef2a5fbb49549ae",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 73,
"avg_line_length": 26.68421052631579,
"alnum_prop": 0.7514792899408284,
"repo_name": "Napchat/microblog",
"id": "0745429b76d5ae73eed3d0f971e450e17c1d3d7b",
"size": "526... |
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
try:
from django.contrib.auth import get_user_model
except ImportError: # django < 1.5
from django.contrib.auth.models import User
else:
User = get_user_model()
user_orm_label = '%s.%s' % (User._meta.... | {
"content_hash": "8777012f7fb0818fc1c2b95f5238dcdb",
"timestamp": "",
"source": "github",
"line_count": 156,
"max_line_length": 192,
"avg_line_length": 74.82051282051282,
"alnum_prop": 0.5670836189170665,
"repo_name": "fusionbox/django-widgy-blog",
"id": "0c9b86a6c18e8d592ed2b9835605c6796ce2dac2",
... |
""" unit testing code for MOE-type descriptors with EStates
"""
import os
import unittest
from rdkit import Chem
from rdkit.Chem.EState import EState_VSA
class TestCase(unittest.TestCase):
@staticmethod
def referenceData():
filename = os.sep.join(
[os.path.dirname(os.path.abspath(__file__)), 'test_... | {
"content_hash": "46e6e829c8b73f06e5984b5e8fcb1bef",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 85,
"avg_line_length": 27.711111111111112,
"alnum_prop": 0.6086607858861267,
"repo_name": "bp-kelley/rdkit",
"id": "650dad5638f0cda3f75138fe824f413c8201d4d6",
"size": "1529... |
"""Model constructor for Tensorflow state-level models."""
from typing import Dict, List
import numpy as np
import tensorflow as tf
from covid_epidemiology.src import constants
from covid_epidemiology.src.models import generic_seir_model_constructor
from covid_epidemiology.src.models import losses
from covid_epidemiolo... | {
"content_hash": "f0924f0e84de6261deee23ea70f8e325",
"timestamp": "",
"source": "github",
"line_count": 1031,
"max_line_length": 96,
"avg_line_length": 42.915615906886515,
"alnum_prop": 0.625841884012114,
"repo_name": "google-research/google-research",
"id": "697d726c1363ad055ff7a18bdfea3268a55c707e"... |
"""A MCTS actor."""
from typing import Optional, Tuple
import acme
from acme import adders
from acme import specs
from acme.agents.tf.mcts import models
from acme.agents.tf.mcts import search
from acme.agents.tf.mcts import types
from acme.tf import variable_utils as tf2_variable_utils
import dm_env
import numpy as ... | {
"content_hash": "371fc2af6edbc95d65a6c8aa8131811b",
"timestamp": "",
"source": "github",
"line_count": 106,
"max_line_length": 79,
"avg_line_length": 31.754716981132077,
"alnum_prop": 0.684194890077243,
"repo_name": "deepmind/acme",
"id": "887d7c25e535db703ba4cc83ac07cbb2caa423d7",
"size": "3982",... |
'''
.. module:: skrf.io.csv
========================================
csv (:mod:`skrf.io.csv`)
========================================
Functions for reading and writing standard csv files
.. autosummary::
:toctree: generated/
read_pna_csv
pna_csv_2_ntwks
'''
import numpy as npy
import os
from ..network i... | {
"content_hash": "50b5f2da54d076cb54f6f0096471b2d1",
"timestamp": "",
"source": "github",
"line_count": 875,
"max_line_length": 155,
"avg_line_length": 28.95657142857143,
"alnum_prop": 0.5280419939219324,
"repo_name": "Ttl/scikit-rf",
"id": "fdaaccbc004c9f329897d47ac4556bd9d312c22c",
"size": "25338... |
import numpy as np
import matplotlib.pyplot as plt
from codim1.core import *
from codim1.assembly import *
from codim1.fast_lib import *
from codim1.post import *
import codim1.core.tools as tools
import matplotlib as mpl
mpl.rcParams['lines.linewidth'] = 2
def test_long_ray_fsf():
shear_modulus = 1.0
poisson_... | {
"content_hash": "8178fdf90ca34fb904e761c9b15432ff",
"timestamp": "",
"source": "github",
"line_count": 197,
"max_line_length": 87,
"avg_line_length": 35.69543147208122,
"alnum_prop": 0.5578782707622298,
"repo_name": "tbenthompson/codim1",
"id": "16cbd3370f5005d0b73e8be78a516745b365bc55",
"size": "... |
"""
@name: Modules/House/Lighting/Lights/_test/test_lights.py
@author: D. Brian Kimmel
@contact: D.BrianKimmel@gmail.com
@copyright: (c) 2014-2020 by D. Brian Kimmel
@note: Created on May 23, 2014
@license: MIT License
@summary: This module is for testing lighting data.
Passed all 14 tests - DBK - 2... | {
"content_hash": "55a17436eb8b12805e4bd88332111496",
"timestamp": "",
"source": "github",
"line_count": 304,
"max_line_length": 97,
"avg_line_length": 34.161184210526315,
"alnum_prop": 0.6129032258064516,
"repo_name": "DBrianKimmel/PyHouse",
"id": "194fb8daf219a8d2de2582cfc33ebd9c42698cb2",
"size":... |
import logging
import os
from tests.beeswax.impala_beeswax import ImpalaBeeswaxClient, ImpalaBeeswaxResult
from tests.performance.query import Query, QueryResult
# Setup logging for this module.
logging.basicConfig(level=logging.INFO, format='[%(name)s] %(threadName)s: %(message)s')
LOG = logging.getLogger('query_exe... | {
"content_hash": "9263b0780ddab34c609e99a42abbaac7",
"timestamp": "",
"source": "github",
"line_count": 161,
"max_line_length": 89,
"avg_line_length": 30.993788819875775,
"alnum_prop": 0.680561122244489,
"repo_name": "XiaominZhang/Impala",
"id": "4a3503eff09c7a761f74ace191f71911f985acd3",
"size": "... |
"""
Custom router to allow bulk deletion
Modified from https://github.com/miki725/django-rest-framework-bulk
"""
from __future__ import print_function, unicode_literals
import copy
from rest_framework.routers import DefaultRouter, SimpleRouter
class BulkDeleteRouter(DefaultRouter):
"""
Map http methods to a... | {
"content_hash": "74b22866bb6c97110c149370beab0ec3",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 67,
"avg_line_length": 25.42105263157895,
"alnum_prop": 0.7204968944099379,
"repo_name": "jonboiser/kolibri",
"id": "b79e8959f766d02bb7e771216bf0ccc58ef636dc",
"size": "483... |
import _plotly_utils.basevalidators
class BordercolorsrcValidator(_plotly_utils.basevalidators.SrcValidator):
def __init__(
self,
plotly_name="bordercolorsrc",
parent_name="scatterpolar.hoverlabel",
**kwargs,
):
super(BordercolorsrcValidator, self).__init__(
... | {
"content_hash": "6761bb68df1d18c108e5469701945031",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 73,
"avg_line_length": 29.375,
"alnum_prop": 0.5957446808510638,
"repo_name": "plotly/plotly.py",
"id": "6ea006daf35d08408155739db2827cbdd548e6ef",
"size": "470",
"binary... |
from django import forms
from django.contrib import admin
from django.core.exceptions import ObjectDoesNotExist
from stratum0.models import Stratum0, Stratum1, ReplicationSite
import cvmfs.repository
class Stratum0AdminForm(forms.ModelForm):
class Meta:
fields = '__all__'
model = Stratum0
de... | {
"content_hash": "2319a76e9987bd0942ff97cf206b88bb",
"timestamp": "",
"source": "github",
"line_count": 94,
"max_line_length": 125,
"avg_line_length": 32.712765957446805,
"alnum_prop": 0.6214634146341463,
"repo_name": "cvmfs/monitor",
"id": "bb82c6ad3304754e25092205171669386de87114",
"size": "3075"... |
"""
DB-API Shortcuts
``get_object_or_404()`` is a shortcut function to be used in view functions for
performing a ``get()`` lookup and raising a ``Http404`` exception if a
``DoesNotExist`` exception was raised during the ``get()`` call.
``get_list_or_404()`` is a shortcut function to be used in view functions for
per... | {
"content_hash": "22445f4e022bc1eac21fcede63b18605",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 96,
"avg_line_length": 28.942857142857143,
"alnum_prop": 0.6910167818361304,
"repo_name": "twz915/django",
"id": "ce74bc04adb9ae3126b79a6a4f4f26b1397d4c8d",
"size": "1013",... |
"""Data store proxy for a data server."""
import base64
import functools
import os
import threading
import time
import uuid
import logging
from grr.lib import access_control
from grr.lib import config_lib
from grr.lib import data_store
from grr.lib import rdfvalue
from grr.lib import utils
from grr.lib.data_stores... | {
"content_hash": "baf968c9a71314439f673dab5bbf363a",
"timestamp": "",
"source": "github",
"line_count": 339,
"max_line_length": 79,
"avg_line_length": 32.823008849557525,
"alnum_prop": 0.6804170036847308,
"repo_name": "defaultnamehere/grr",
"id": "346960a3db3817d39e2f5c3aefa643ab7dce453b",
"size": ... |
""" Include Bokeh plots in Sphinx HTML documentation.
For other output types, the placeholder text ``[graph]`` will
be generated.
The ``bokeh-plot`` directive can be used by either supplying:
**A path to a source file** as the argument to the directive::
.. bokeh-plot:: path/to/plot.py
.. note::
.py script... | {
"content_hash": "3fd11183eaa199c4262acc2965edcd39",
"timestamp": "",
"source": "github",
"line_count": 328,
"max_line_length": 122,
"avg_line_length": 35.082317073170735,
"alnum_prop": 0.6305726948813766,
"repo_name": "rs2/bokeh",
"id": "b297f7d9a889d0ad6a55f862e4bac0acd00aa1e2",
"size": "11507",
... |
from flask import Blueprint
utils = Blueprint(
'utils',
__name__,
url_prefix='/v1/utils'
)
@utils.route('/ping', methods=['GET'])
def ping():
return 'pong'
| {
"content_hash": "b9693abefcf2220adee7f05e8f233098",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 38,
"avg_line_length": 15.818181818181818,
"alnum_prop": 0.5977011494252874,
"repo_name": "Dinoshauer/img-resize",
"id": "6a000b5d300b208a542db5f9f90e0a342e751866",
"size":... |
import setuptools
import unittest
def discover_tests():
test_loader = unittest.TestLoader()
return test_loader.discover('.', pattern='*_test.py')
if __name__ == '__main__':
setuptools.setup(
name='mesonwrap',
version='0.2.0',
author='The Meson development team',
license='... | {
"content_hash": "1f8335d43a08383bb8a0027b7fb29459",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 57,
"avg_line_length": 24.622222222222224,
"alnum_prop": 0.4584837545126354,
"repo_name": "mesonbuild/wrapweb",
"id": "0b246840d91dbd31305c8c4937c80c560f26a625",
"size": "1... |
from sys import argv, exit
import tamil
import sys
def usage():
return u"tscii2utf8.py <source-file> <destination-file> "
if __name__ == u"__main__":
if not argv[1:]:
print( usage() )
exit(-1)
try:
source_file = argv[1]
destination_file = argv[2]
with open(source... | {
"content_hash": "fd825ce6eda6a345f1cbe73225b10f27",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 118,
"avg_line_length": 35.12,
"alnum_prop": 0.5831435079726651,
"repo_name": "atvKumar/open-tamil",
"id": "7623f7fc2d6f9ec5dc20f8c7be3e337d02691397",
"size": "950",
"bin... |
"""
ASGI config for restpython project.
It exposes the ASGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/4.0/howto/deployment/asgi/
"""
import os
from django.core.asgi import get_asgi_application
os.environ.setdefault('DJANGO_SE... | {
"content_hash": "463a3c1e6139988116aa3ba6b2a9a90c",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 78,
"avg_line_length": 24.8125,
"alnum_prop": 0.7732997481108312,
"repo_name": "zerazobz/coding",
"id": "53dfaef4c49e539114c2e5d6fbd537a86549bd38",
"size": "397",
"binary... |
"""
Created on Wed Oct 4 10:22:49 2017
Converting excel files to csv
@author: Yuriy Sverchkov
"""
import logging
from sys import argv
from pandas import read_excel, concat
# Constants
logging.basicConfig( level = logging.DEBUG )
log = logging.getLogger(__name__)
log.setLevel( logging.DEBUG )
standardized_columns ... | {
"content_hash": "4f6724d45f9aba230dfb859fa69555df",
"timestamp": "",
"source": "github",
"line_count": 68,
"max_line_length": 111,
"avg_line_length": 26.941176470588236,
"alnum_prop": 0.5982532751091703,
"repo_name": "sverchkov/ivancic-panel-selection",
"id": "dfd26fb7f21de651b564572abdb5b734e76efd5... |
"""Distogram container used throughout ConKit"""
import numpy as np
from operator import attrgetter
from conkit.core.distance import Distance
from conkit.io._cache import PARSER_CACHE
from conkit.core.contactmap import ContactMap
class Distogram(ContactMap):
"""A distogram object to store all associated informat... | {
"content_hash": "aabb2399e423adc0884afbe36bfdc304",
"timestamp": "",
"source": "github",
"line_count": 323,
"max_line_length": 120,
"avg_line_length": 38.916408668730654,
"alnum_prop": 0.6234685759745425,
"repo_name": "rigdenlab/conkit",
"id": "c0c0fbca53470d2632a3e0479d749b5a78980abf",
"size": "1... |
from sourcelyzer.cli import outnl
from sourcelyzer.properties import load_from_file
from sourcelyzer.app import App
import cherrypy
def init_server(properties):
cherrypy.config.update({
'server.socket_host': properties['sourcelyzer.server.listen_addr'],
'server.socket_port': int(properties['sourcel... | {
"content_hash": "28293b9d52856a838b466665267b6577",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 99,
"avg_line_length": 26.022222222222222,
"alnum_prop": 0.6797608881298036,
"repo_name": "sourcelyzer/sourcelyzer",
"id": "bb8c7d57d5c42515e68c39055a6830615b3eb612",
"size... |
"""
\x1b[31mYmir Automation:\x1b[0m
This is the \x1b[35mDemo\x1b[0m Service
"""
import os
from fabric import api
from ymir import load_service_from_json
YMIR_SERVICE_JSON = os.path.abspath(
os.environ.get(
'YMIR_SERVICE_JSON',
os.path.join(os.path.dirname(__file__),
'service.... | {
"content_hash": "5f4b6ffd3f534aa9c498a84d71d9ac92",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 77,
"avg_line_length": 28,
"alnum_prop": 0.6666666666666666,
"repo_name": "mattvonrocketstein/ymir",
"id": "6345f2168e42933d6920f1e3a046fc708d6c08b2",
"size": "970",
"bin... |
import boto.sqs
import boto.sqs.queue
from boto.sqs.message import Message
from boto.sqs.connection import SQSConnection
from boto.exception import SQSError
import sys
import urllib2
response = urllib2.urlopen("http://ec2-52-30-7-5.eu-west-1.compute.amazonaws.com:81/key")
key = response.read()
# Get the keys from a sp... | {
"content_hash": "d7a5855df3a6925274093e257ba93a8a",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 120,
"avg_line_length": 30.333333333333332,
"alnum_prop": 0.7545787545787546,
"repo_name": "JoonasKansala/lab11",
"id": "c6a3519e64df49a189cbe6681cb8faa88d9cb4e5",
"size": ... |
import math
import os
import random
import re
import sys
'''
Arrays: Left Rotation
https://www.hackerrank.com/challenges/ctci-array-left-rotation/problem
'''
# Complete the rotLeft function below.
def rotLeft(a, d):
return a[d:]+a[:d]
if __name__ == '__main__':
n = 5
d = 4
a = [1, 2, 3, 4, 5]
... | {
"content_hash": "e12ea7c32cc8ce221a1f25911166f3a3",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 70,
"avg_line_length": 14.37037037037037,
"alnum_prop": 0.6005154639175257,
"repo_name": "MarsBighead/mustang",
"id": "9891d6e74fcfc77f73996a4a4339f5612f9992e0",
"size": "4... |
"""
Set of programs to read and interact with output from Multifluid/multispecies
"""
import numpy as np
import os
from .bifrost import BifrostData, Rhoeetab, read_idl_ascii, subs2grph
class EbysusData(BifrostData):
"""
Class to hold data from Multifluid/multispecies simulations
in native format.
""... | {
"content_hash": "99f738a4e5fecb68ec7c749d91e71712",
"timestamp": "",
"source": "github",
"line_count": 257,
"max_line_length": 119,
"avg_line_length": 39.89494163424124,
"alnum_prop": 0.5306739490880718,
"repo_name": "M1kol4j/helita",
"id": "154dfd34d64dc108f00e3bf8bd7d534306944922",
"size": "1025... |
import argparse
parser = argparse.ArgumentParser(prog="single.py", description="Run Starfish fitting model in parallel.")
# Even though these arguments aren't being used, we need to add them.
parser.add_argument("--generate", action="store_true", help="Write out the data, mean model, and residuals for current parameter... | {
"content_hash": "4e22ecd5a2178f4b892addc21f8dd235",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 140,
"avg_line_length": 45.529411764705884,
"alnum_prop": 0.7493540051679587,
"repo_name": "BrownDwarf/Starfish",
"id": "9848fcc51846892dbce6b6119092540a3ac89261",
"size": ... |
'''
CodeWars 2013
Distinct Letters
'''
import sys
def is_distinct(line):
used_letters = []
for c in line:
if c in used_letters:
return False
else:
used_letters.append(c)
return True
def get_output(is_distinct):
if is_distinct:
return 'USES DISTINCT L... | {
"content_hash": "a64936b34aa3274f481c61e3420cb7b5",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 47,
"avg_line_length": 17.533333333333335,
"alnum_prop": 0.5855513307984791,
"repo_name": "martrik/HPCodeWarsSamples",
"id": "15eb2bdae01411614d0cefdfc9315892c71fe53a",
"si... |
"""Tests for ceilometer/storage/
"""
import mock
from oslo_config import fixture as fixture_config
from oslotest import base
import retrying
from ceilometer.alarm.storage import impl_log as impl_log_alarm
from ceilometer.alarm.storage import impl_sqlalchemy as impl_sqlalchemy_alarm
from ceilometer.event.storage import... | {
"content_hash": "908d1ebb6c6ccc916892fa26a6b53b2c",
"timestamp": "",
"source": "github",
"line_count": 112,
"max_line_length": 77,
"avg_line_length": 47.375,
"alnum_prop": 0.6468149264983039,
"repo_name": "yanheven/ceilometer",
"id": "55439ebb0f91bf235b084da9a2b434d72334f829",
"size": "5907",
"b... |
"""
Unit test for Date parameters.
"""
import unittest
import datetime as dt
import param
class TestDateParameters(unittest.TestCase):
def test_initialization_out_of_bounds(self):
try:
class Q(param.Parameterized):
q = param.Date(dt.datetime(2017,2,27),
... | {
"content_hash": "031ed5985c3f4c2b8371c0b6602e8447",
"timestamp": "",
"source": "github",
"line_count": 54,
"max_line_length": 77,
"avg_line_length": 34.333333333333336,
"alnum_prop": 0.5043149946062567,
"repo_name": "ioam/param",
"id": "860e8fe30898a1de8f6a9c17691b5bcac497bea5",
"size": "1854",
... |
from __future__ import unicode_literals
from django.contrib import admin
from django.db.models.signals import pre_delete
from django.dispatch import receiver
from django.http import HttpResponse, HttpResponseNotFound
from django.shortcuts import get_object_or_404, render_to_response
from django.template import Request... | {
"content_hash": "e628f7803d742bd22402c0cf14b6f845",
"timestamp": "",
"source": "github",
"line_count": 181,
"max_line_length": 77,
"avg_line_length": 34.50828729281768,
"alnum_prop": 0.5669228306115914,
"repo_name": "bkochendorfer/reviewboard",
"id": "5f38e109d11a511c78a7e53d80048f2801c484b0",
"si... |
from django.apps import AppConfig
class FeedConfig(AppConfig):
name = 'feed'
| {
"content_hash": "8fca4ccb5f5282cdfbff25a4ef8bcce5",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 33,
"avg_line_length": 16.6,
"alnum_prop": 0.7349397590361446,
"repo_name": "SJIT-Hackerspace/hackerspace",
"id": "e4e5c4116d2959954af7863f8c054b8668283b04",
"size": "83",
... |
from test import *
import os
path=os.path.dirname(os.path.abspath(__file__))
os.chdir(path)
import unittest
unittest.main() | {
"content_hash": "3020a8bae81649dfe4378b72f26c3823",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 47,
"avg_line_length": 17.714285714285715,
"alnum_prop": 0.75,
"repo_name": "wowgeeker/fabscheduler",
"id": "c610a07c48eb3f931ef41f63ad5d7654d8b65be6",
"size": "147",
"bin... |
from openstack.tests.unit import base
from openstack.key_manager.v1 import container
ID_VAL = "123"
IDENTIFIER = 'http://localhost/containers/%s' % ID_VAL
EXAMPLE = {
'container_ref': IDENTIFIER,
'created': '2015-03-09T12:14:57.233772',
'name': '3',
'secret_refs': ['4'],
'status': '5',
'type':... | {
"content_hash": "a745f376e5838701aa67e987fed91d8d",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 69,
"avg_line_length": 35.46511627906977,
"alnum_prop": 0.6504918032786885,
"repo_name": "openstack/python-openstacksdk",
"id": "2095e6c41cf50bf4d8a9b26221a93edaec66a16c",
... |
from decorator import decorator
from .chara import Spy
from . import storage
from .replayers import SEQUENCE, PATTERN_MATCH
def record(target):
@decorator
def wrapper(fn, *args, **kwargs):
spy = Spy(target)
with spy.record():
result = fn(*args, **kwargs)
storage.write(fn... | {
"content_hash": "ddb025f03e04557150327b2445465d16",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 66,
"avg_line_length": 20.390243902439025,
"alnum_prop": 0.6064593301435407,
"repo_name": "bywires/chara",
"id": "87fd848142522b1959fe1bc4754202a7a9735e5c",
"size": "836",
... |
import argparse
import gzip
import json
def make_unique(infile, outfile, tweet_ids):
fout = gzip.open(outfile, 'w')
with gzip.open(infile, 'r') as source:
for line in source:
try:
tweet = json.loads(line)
except:
continue
if tweet['i... | {
"content_hash": "630ec226569feb620abedede4982c646",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 74,
"avg_line_length": 23.11904761904762,
"alnum_prop": 0.5417095777548918,
"repo_name": "lrei/twitter_sentiment_gen",
"id": "133bcc03ea2e9a0369f6a01560fa216d758d8369",
"si... |
from MathFunc import *
from copy import copy, deepcopy
from model.Game import Game
from model.World import World
from model.Move import Move
from CommonFunctions import *
def get_puck_owner(world: World):
h = None
for h in world.hockeyists:
if world.puck.owner_hockeyist_id == h.id:
return h... | {
"content_hash": "c19cc987ac51e08b8fbf35968903314f",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 95,
"avg_line_length": 44.68,
"alnum_prop": 0.631154879140555,
"repo_name": "pkosukhin/codehockey",
"id": "1d6764262a6124e2b9c7f25918e0f646c5ccff56",
"size": "2234",
"bin... |
import json
from os.path import join
from glob import glob
class VocabularyEncoder(json.JSONEncoder):
"""
Encodes a Vocuabulary class to JSON
"""
def default(self, obj):
if isinstance(obj, Vocabulary) or isinstance(obj, VocabularyManifest):
return obj.to_json()
return jso... | {
"content_hash": "8a4226fdfea49416b5049d8f64354b7c",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 78,
"avg_line_length": 24.571428571428573,
"alnum_prop": 0.6337209302325582,
"repo_name": "JiscRDSS/taxonomyschema",
"id": "a46fd2f16451dec630e56416587fc6f079cefb62",
"size... |
import logging
from pkg_resources import iter_entry_points
log = logging.getLogger(__name__)
SCANNERS = {}
def scan_path(store, parent, path):
if not len(SCANNERS):
for ep in iter_entry_points('datasurvey.scanners'):
SCANNERS[ep.name] = ep.load()
best_scanner = None
best_bid = 0
... | {
"content_hash": "282b5e6764a6c31910b14f6caa5269d9",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 59,
"avg_line_length": 26.424242424242426,
"alnum_prop": 0.5642201834862385,
"repo_name": "occrp/datasurvey",
"id": "872249e82afff2f0a11bfea877d577af91e0f082",
"size": "872... |
from __future__ import absolute_import, unicode_literals
import os
import platform
from unittest.case import TestCase
import placa_grafica
from templates import FRAMES
class TestesDoMotor(TestCase):
def teste_inverter_coordenadas(self):
self.assertTupleEqual((0, placa_grafica.ALTURA - 1), placa_grafica.no... | {
"content_hash": "76dd81bce2b96046ac65bb5fcb8918c8",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 106,
"avg_line_length": 39.73809523809524,
"alnum_prop": 0.6285200718993409,
"repo_name": "Cleitoon1/pythonbirds",
"id": "025c040043e0a436ad174af64d4373457fdb4661",
"size":... |
import copy
import functools
import random
import netaddr
from neutron_lib import constants
from oslo_config import cfg
from oslo_log import log as logging
import testscenarios
from neutron.agent import firewall
from neutron.agent.linux import iptables_firewall
from neutron.agent.linux import openvswitch_firewall
fro... | {
"content_hash": "99c767ce2edc415a876769d94fabdfb9",
"timestamp": "",
"source": "github",
"line_count": 666,
"max_line_length": 79,
"avg_line_length": 49.786786786786784,
"alnum_prop": 0.5755473792146691,
"repo_name": "bigswitch/neutron",
"id": "c9d57f1f2e179e0bd403aa03b71ea37cb7b2cf6c",
"size": "3... |
"""
Support for Honeywell Round Connected and Honeywell Evohome thermostats.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/thermostat.honeywell/
"""
import logging
import socket
from homeassistant.components.thermostat import ThermostatDevice
from home... | {
"content_hash": "29062cf89bb49410b49b323fe71ef892",
"timestamp": "",
"source": "github",
"line_count": 247,
"max_line_length": 77,
"avg_line_length": 32.121457489878544,
"alnum_prop": 0.6022183009831107,
"repo_name": "Zyell/home-assistant",
"id": "633212e02b5b437761bac4d11ff297cb9f403c3b",
"size":... |
import pygame, string
pygame.init()
class MyDisplay:
def surface_from_image_file(self, fullfilename):
"""
Takes the filename, loads it and finally returns the surface
"""
try:
# print "surface_from_image_file: loading file", fullfilename
return pygame.image.l... | {
"content_hash": "c5c8f8085e4c5a2cff684518da2c3db7",
"timestamp": "",
"source": "github",
"line_count": 246,
"max_line_length": 125,
"avg_line_length": 39.77235772357724,
"alnum_prop": 0.5729762878168438,
"repo_name": "sparkslabs/kamaelia_",
"id": "1ecbdb6574b7a47b8e30ea5e8a73cf902787ea5b",
"size":... |
from __future__ import print_function
"""Dump binary log generated by PX4's sdlog2 or APM as CSV
Usage: python sdlog2_dump.py <log.bin> [-v] [-e] [-d delimiter] [-n null] [-m MSG[.field1,field2,...]]
-v Use plain debug output instead of CSV.
-e Recover from errors.
-d Use "delimiter" in ... | {
"content_hash": "39cef6a229b85e193e0aede9148823f1",
"timestamp": "",
"source": "github",
"line_count": 348,
"max_line_length": 147,
"avg_line_length": 37.14655172413793,
"alnum_prop": 0.4847218998994353,
"repo_name": "Xyrotechnology/Project-Anthrax",
"id": "7da0e6e5e2f05bd24ae34fbc2746c6f0a2fcf4bd",... |
import datetime
import time
import random
import csv as csv
from collections import defaultdict
import numpy as np
def create_data(file_name,number_of_days):
lat,lon = read_coordinates('coordinates.csv')
number_of_stops = len(lat)
time_end = datetime.datetime.now()
time_end = time_end.replace(hour=5,minute=0, se... | {
"content_hash": "f5b634a1dd8fac9935ac486535581665",
"timestamp": "",
"source": "github",
"line_count": 189,
"max_line_length": 134,
"avg_line_length": 35.12169312169312,
"alnum_prop": 0.7051822838204278,
"repo_name": "zliobaite/Heatmaps",
"id": "7c731b21d5d20255a7c909f746042ddb52b1f74d",
"size": "... |
from __future__ import absolute_import, unicode_literals
from chatpro.profiles.models import Contact
from chatpro.test import ChatProTest
from dash.utils.sync import sync_pull_contacts
from django.utils import timezone
from mock import patch
from temba.types import Contact as TembaContact
class TembaTest(ChatProTest... | {
"content_hash": "42927c48890cd0e3a415b98589ad46f7",
"timestamp": "",
"source": "github",
"line_count": 71,
"max_line_length": 108,
"avg_line_length": 59.91549295774648,
"alnum_prop": 0.5916784203102962,
"repo_name": "rapidpro/chatpro",
"id": "75c851bc7fd0284a0c406fde41067776c18cc4df",
"size": "425... |
import os, pytest, rdflib, tempfile
from channelworm.ion_channel.exporter import Exporter
pytestmark = [pytest.mark.django_db]
SAMPLE_LOCATION = os.path.join('tests', 'test_data', 'rdf_data.n3')
EXPORT_LOCATION = os.path.join('tests', 'test_data', 'exported_data.n3')
def test_exporter_init_and_load(data_pool):
... | {
"content_hash": "6846c11022e3e91fc13c9849fa0e3362",
"timestamp": "",
"source": "github",
"line_count": 69,
"max_line_length": 72,
"avg_line_length": 27.855072463768117,
"alnum_prop": 0.6675338189386056,
"repo_name": "openworm/ChannelWorm",
"id": "b97af166ed1b6bb90a30193c00c2179b0e3b9c66",
"size": ... |
from pybuilder.core import use_plugin, init
use_plugin('python.core')
# build
use_plugin('python.install_dependencies')
use_plugin('python.pydev')
use_plugin('python.distutils')
# quality
use_plugin('python.unittest')
use_plugin('python.coverage')
use_plugin('python.frosted')
use_plugin('python.flake8')
use_plugin('py... | {
"content_hash": "609beed7dc2ab1d44d97effbdb49f582",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 68,
"avg_line_length": 26.84,
"alnum_prop": 0.7347242921013413,
"repo_name": "careerfamily/simpleioc",
"id": "91465b0812044a5c4c0e297c685d68cc8814a858",
"size": "671",
"b... |
from package_control import sys_path
sys_path.add_dependency(u'bz2')
| {
"content_hash": "0d053fe89d17b05d1fc22f55f22fffdc",
"timestamp": "",
"source": "github",
"line_count": 2,
"max_line_length": 36,
"avg_line_length": 34.5,
"alnum_prop": 0.7971014492753623,
"repo_name": "herove/dotfiles",
"id": "4d4b42fadbd64b72bbe8ecdb82d83b07f8577659",
"size": "70",
"binary": fa... |
from kotti import DBSession
from kotti.resources import Content, Document
from pyramid.view import view_config
@view_config(name='sitemap.xml',
context=Document,
permission='view',
renderer='templates/sitemap.pt',)
def sitemap(request):
nodes = DBSession.query(Content).with_... | {
"content_hash": "388673b8b617c666d7c2189251c732d8",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 62,
"avg_line_length": 32,
"alnum_prop": 0.6899038461538461,
"repo_name": "koansys/kotti_sitemap",
"id": "781dfb33d4cac6d08a72b86aed9ddebb92e8fdc7",
"size": "416",
"binar... |
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('goals', '0166_auto_20160902_1934'),
]
operations = [
migrations.AddField(
model_name='customactionfeedb... | {
"content_hash": "0ee85eaed88c3ae08fbe7ed4f975a962",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 127,
"avg_line_length": 30.75,
"alnum_prop": 0.6355013550135501,
"repo_name": "tndatacommons/tndata_backend",
"id": "c5b463cee653fcee3b50cb8b39f0c4f1b27780b6",
"size": "810... |
import argparse
import errno
import itertools
import os
import sys
import time
from .confparser import ConfParser
from .confparser import ConfParserException
from .palette import Palette
from .transformer import Transformer
from .transformer import RegexStyle
from .txtsconf import *
from .version import VERSION
VERSI... | {
"content_hash": "f0785bc880d4707d384192f887dbb9c5",
"timestamp": "",
"source": "github",
"line_count": 151,
"max_line_length": 127,
"avg_line_length": 32.48344370860927,
"alnum_prop": 0.6004077471967381,
"repo_name": "armandino/TxtStyle",
"id": "1712b728a2b5d1f294180f1e0355eafad73a4b06",
"size": "... |
import copy
import fractions
import functools
import math
import numbers
import re
import sys
import weakref
class UnitArithmetic:
@classmethod
def multiply(cls, first, second):
result = first.copy()
for unit, power in second.items():
result[unit] = result.get(unit, 0) + power
return cls.clean(re... | {
"content_hash": "c0b21e1eb877ad834ebc845630cf8bae",
"timestamp": "",
"source": "github",
"line_count": 402,
"max_line_length": 78,
"avg_line_length": 34.90049751243781,
"alnum_prop": 0.6291518175338561,
"repo_name": "EdwinChan/python-physical",
"id": "bc7bac02b2e6bb78d2f1fce80bb2445a9e5deda8",
"si... |
from __future__ import absolute_import, division, print_function
import atexit
import errno
import os
import shutil
import sys
import tempfile
import time
import path_utils as path
import pywatchman
global_temp_dir = None
class TempDir(object):
"""
This is a helper for locating a reasonable place for temp... | {
"content_hash": "8206eb0b22578a7bc796766eb50d879a",
"timestamp": "",
"source": "github",
"line_count": 110,
"max_line_length": 88,
"avg_line_length": 33.10909090909091,
"alnum_prop": 0.6328940142778693,
"repo_name": "wez/watchman",
"id": "cbbb5392663edfb887dcabd828e6b59a2ed3fd62",
"size": "3664",
... |
from sqlalchemy import Column, DateTime, String, text, create_engine
from sqlalchemy.dialects.mysql import INTEGER, TINYINT
from sqlalchemy.ext.declarative import declarative_base
Base = declarative_base()
metadata = Base.metadata
class PmUser(Base):
__tablename__ = 'pm_user'
id = Column(INTEGER(11), primar... | {
"content_hash": "694a86cd50980665980d4dca24b42ff7",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 102,
"avg_line_length": 37.8,
"alnum_prop": 0.707936507936508,
"repo_name": "qqxx6661/price-monitor",
"id": "2f99ad6a54ddcbb8d7347bcc27db7ebdf9a6a270",
"size": "983",
"bi... |
from enum import Enum
from six import with_metaclass
from azure.core import CaseInsensitiveEnumMeta
class AccessRights(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)):
MANAGE = "Manage"
SEND = "Send"
LISTEN = "Listen"
class ClusterSkuName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)):
"""N... | {
"content_hash": "bcecf8ced2c485aeb60cce9cc4336037",
"timestamp": "",
"source": "github",
"line_count": 148,
"max_line_length": 100,
"avg_line_length": 28.87162162162162,
"alnum_prop": 0.7002106248537328,
"repo_name": "Azure/azure-sdk-for-python",
"id": "d145b436a261162ad0978750d55e5562f6a82276",
"... |
default_app_config = 'daiquiri.stats.apps.StatsConfig' | {
"content_hash": "9bb62b6283b0b96f821255ebf8babe2f",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 54,
"avg_line_length": 54,
"alnum_prop": 0.8148148148148148,
"repo_name": "aipescience/django-daiquiri",
"id": "944830e7e434d1492142b9df89c18107c0a7b1bd",
"size": "54",
"b... |
from libcloud.storage.types import Provider
from libcloud.storage.types import OLD_CONSTANT_TO_NEW_MAPPING
from libcloud.common.providers import get_driver as _get_provider_driver
from libcloud.common.providers import set_driver as _set_provider_driver
DRIVERS = {
Provider.DUMMY:
('libcloud.storage.drivers.dum... | {
"content_hash": "09ac4bd9a77a6dcbc4fed2f743c629ad",
"timestamp": "",
"source": "github",
"line_count": 83,
"max_line_length": 77,
"avg_line_length": 43.66265060240964,
"alnum_prop": 0.7224061810154525,
"repo_name": "vongazman/libcloud",
"id": "183189ebb88aa1fd4ab6c64b4a52c6633da64f1d",
"size": "44... |
from traitsui.null.rgb_color_trait import *
| {
"content_hash": "ff4106674377fadd9e0d3659dee1c589",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 43,
"avg_line_length": 44,
"alnum_prop": 0.7954545454545454,
"repo_name": "enthought/etsproxy",
"id": "f28225edf308d1801a3b67c3a3b9a6c623e9ac8b",
"size": "59",
"binary": f... |
from framework import *
login()
term = input("Grading Term ('current' or 'q1'): ")
if term == "current":
currentQ()
elif term == "q1":
quarter1()
else:
print("Invalid Choice Please Restart")
browser.quit()
exit()
| {
"content_hash": "1f50ba8c8f4b7f4e74d4b9c846906d3e",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 50,
"avg_line_length": 17.857142857142858,
"alnum_prop": 0.576,
"repo_name": "sapblatt11/veraScrape",
"id": "b27d65d580de3167947b063052d80ca87dd651f3",
"size": "272",
"bi... |
"""
NMA (Notify My Android) notification service.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/notify.nma/
"""
import logging
import xml.etree.ElementTree as ET
import requests
from blumate.components.notify import (
ATTR_TITLE, DOMAIN, BaseNotif... | {
"content_hash": "13cc93f088b8d0fa81cb500245beabc1",
"timestamp": "",
"source": "github",
"line_count": 62,
"max_line_length": 74,
"avg_line_length": 30.661290322580644,
"alnum_prop": 0.6186217780115728,
"repo_name": "bdfoster/blumate",
"id": "1a170fbd376e709dc94f07979fa967b2e856157d",
"size": "190... |
import os
import numpy as np
import tensorflow as tf
import dataplumbing as dp
##########################################################################################
# Settings
##########################################################################################
# Model settings
#
num_features = dp.train.nu... | {
"content_hash": "a584ec15e59c95e0ef79ae03cdf93193",
"timestamp": "",
"source": "github",
"line_count": 167,
"max_line_length": 126,
"avg_line_length": 28.790419161676645,
"alnum_prop": 0.586730449251248,
"repo_name": "jostmey/rwa",
"id": "93120002bc5a8da0dca0998fb3529568d7da2ec1",
"size": "5409",
... |
import mock
import pytest
import unittest
from mercury.common.exceptions import MercuryClientException
from mercury.log_service import service as log_server
mock_make_agent_log_service = mock.MagicMock()
def mock_init(self, bind_address):
self.bind_address = bind_address
self.context = mock.MagicMock()
... | {
"content_hash": "59b1e8423684976305386b6b289d1537",
"timestamp": "",
"source": "github",
"line_count": 59,
"max_line_length": 91,
"avg_line_length": 36.23728813559322,
"alnum_prop": 0.5701590271281571,
"repo_name": "jr0d/mercury",
"id": "59c2a3445fc4d4a9731235caa5ba631f5d30160a",
"size": "2138",
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.