text stringlengths 4 1.02M | meta dict |
|---|---|
'''
@author: Gabriele Girelli
@email: gigi.ga90@gmail.com
@module: pygpseq.fish
@description: methods for FISH data manipulation.
'''
# DEPENDENCIES =================================================================
__all__ = ['matplotlib', 'numpy', 'pandas', 'skimage', 'tifffile']
from pygpseq.fish import dot, image... | {
"content_hash": "6900b9c2d97b82c74bf9ba8c8c713e12",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 80,
"avg_line_length": 30.875,
"alnum_prop": 0.38461538461538464,
"repo_name": "ggirelli/gpseq-img-py",
"id": "1c8294376ba903159c99838661368050493606b5",
"size": "519",
"... |
"""Common methods used across tests for Bond."""
from asyncio import TimeoutError as AsyncIOTimeoutError
from contextlib import nullcontext
from datetime import timedelta
from typing import Any, Dict, Optional
from homeassistant import core
from homeassistant.components.bond.const import DOMAIN as BOND_DOMAIN
from hom... | {
"content_hash": "88aa4922ef9c8bb8567254d0795b1e88",
"timestamp": "",
"source": "github",
"line_count": 159,
"max_line_length": 85,
"avg_line_length": 31.339622641509433,
"alnum_prop": 0.6767007826610476,
"repo_name": "pschmitt/home-assistant",
"id": "1a37455b3389587571a8501a8e58a11aa8d807da",
"siz... |
from django.contrib import admin
from . import models
admin.site.register(models.Feed)
admin.site.register(models.FeedEntry)
admin.site.register(models.ChosenFeed)
| {
"content_hash": "8405c1ae63ca3fa7713f53f246c97142",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 38,
"avg_line_length": 27.5,
"alnum_prop": 0.8242424242424242,
"repo_name": "arocks/jazz_reader",
"id": "2389a97e265b30055d6d57a93732f72fe1fca3b9",
"size": "165",
"binary"... |
"""
Unified driver for NetApp storage systems.
Supports multiple storage systems of different families and protocols.
"""
from oslo_log import log as logging
from oslo_utils import importutils
from cinder import exception
from cinder.i18n import _
from cinder.volume import driver
from cinder.volume.drivers.netapp im... | {
"content_hash": "ec646399a4542e10a2cedcdcdcf6a86b",
"timestamp": "",
"source": "github",
"line_count": 94,
"max_line_length": 75,
"avg_line_length": 36.12765957446808,
"alnum_prop": 0.6375147232037691,
"repo_name": "phenoxim/cinder",
"id": "3fec3fc8e95d84d59cc07495127b0cdb64188413",
"size": "4142"... |
"""
110. Balanced Binary Tree
https://leetcode.com/problems/balanced-binary-tree/
"""
from typing import Optional
# Definition for a binary tree node.
class TreeNode:
def __init__(self, val=0, left=None, right=None):
self.val = val
self.left = left
self.right = right
class Solution:
... | {
"content_hash": "e6347a53307397a54ccc9bc7a52482f7",
"timestamp": "",
"source": "github",
"line_count": 69,
"max_line_length": 74,
"avg_line_length": 21.028985507246375,
"alnum_prop": 0.5223983459682977,
"repo_name": "pisskidney/leetcode",
"id": "121e87b6f3b49f034e60e81d737c9948e2c932cb",
"size": "... |
"""Asynchronous datastore API.
This is designed to be the lowest-level API to be used by all Python
datastore client libraries.
A refactoring is in progress to rebuild datastore.py on top of this,
while remaining nearly 100% backwards compatible. A new (not intended
to be compatible) library to replace db.py is also... | {
"content_hash": "e561f0558222a59bd2aec0f629605e5c",
"timestamp": "",
"source": "github",
"line_count": 2601,
"max_line_length": 80,
"avg_line_length": 31.86159169550173,
"alnum_prop": 0.6557341442224153,
"repo_name": "pigeonflight/strider-plone",
"id": "b85d3ee35bf0c382f39a2bc3a8713679fe4a1b8e",
"... |
from functools import reduce
import os, re
import optparse
import textwrap
class Error(Exception):
def __init__(self, msg):
Exception.__init__(self, msg)
def ToCArray(byte_sequence):
result = []
for chr in byte_sequence:
result.append(str(ord(chr)))
joined = ", ".join(result)
return textwrap.fill... | {
"content_hash": "eeeb9990cfb41b80c846b5cab74bbfa2",
"timestamp": "",
"source": "github",
"line_count": 333,
"max_line_length": 91,
"avg_line_length": 27.147147147147148,
"alnum_prop": 0.6571902654867257,
"repo_name": "youtube/cobalt_sandbox",
"id": "cc050d51d4615356dd959f47dba33311b2d96c32",
"size... |
import torch
from .Module import Module
from .utils import clear
class PairwiseDistance(Module):
def __init__(self, p):
super(PairwiseDistance, self).__init__()
assert p % 1 == 0
self.gradInput = []
self.diff = torch.Tensor()
self.norm = p
self.outExpand = None
... | {
"content_hash": "8a609520b3e2f45981b9d9e095e9936c",
"timestamp": "",
"source": "github",
"line_count": 83,
"max_line_length": 84,
"avg_line_length": 32.54216867469879,
"alnum_prop": 0.5379489078119215,
"repo_name": "RPGOne/Skynet",
"id": "cf083daf1d6d91715303ac664af211ef15c577ed",
"size": "2701",
... |
from datetime import datetime, timedelta
import dateutil
from indy_common.constants import START
from indy_node.server.restart_log import RestartLog
from indy_node.test.pool_restart.helper import _createServer, sdk_send_restart, _stopServer
from indy_node.test.pool_restart.test_pool_restart import _comparison_reply, ... | {
"content_hash": "ce13b4b360817fa70b48b3d9cb2eb46c",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 95,
"avg_line_length": 41.76744186046512,
"alnum_prop": 0.6046770601336303,
"repo_name": "spivachuk/sovrin-node",
"id": "7999d62aec18efe2b47c462091f151365179cc7f",
"size": ... |
'''
Performs a beam search with given parameters.
Takes as input a
interface: a BeamSearchInterface object
params: a set of parameters
n: the number of things to return
k: the number of symbols to expand at each step.
'''
''' the following actions are needed for instance:
instance.next_child(self, must_be_better_than... | {
"content_hash": "2b984333335bb57836e87050680eb046",
"timestamp": "",
"source": "github",
"line_count": 71,
"max_line_length": 83,
"avg_line_length": 32.63380281690141,
"alnum_prop": 0.5584807941303409,
"repo_name": "dwhalen/holophrasm",
"id": "857a421ba905200c57a375eb9afb6e0c1773f415",
"size": "23... |
import logging
from typing import Any, List, Set
from synapse.config.sso import SsoAttributeRequirement
from synapse.types import JsonDict
from synapse.util.check_dependencies import check_requirements
from synapse.util.module_loader import load_module, load_python_module
from ._base import Config, ConfigError
from .... | {
"content_hash": "00da21d5b0751f034a80d6665d2d70c7",
"timestamp": "",
"source": "github",
"line_count": 221,
"max_line_length": 90,
"avg_line_length": 37.69683257918552,
"alnum_prop": 0.6132517104789341,
"repo_name": "matrix-org/synapse",
"id": "49ca663dde2d351b49efde9d8e8174ffbcf15deb",
"size": "8... |
import os
basedir = os.path.abspath(os.path.dirname(__file__))
class Config:
SECRET_KEY = os.environ.get('SECRET_KEY') or 'HOLMESCONANHENRYALVINREN'
SQLALCHEMY_COMMIT_ON_TEARDOWN = True
SQLALCHEMY_TRACK_MODIFICATIONS = True
MAIL_SERVER = 'smtp.126.com'
MAIL_PORT = 25
MAIL_USE_TLS = True
MA... | {
"content_hash": "197adbdeabdc42a75e2dd8386074afb0",
"timestamp": "",
"source": "github",
"line_count": 46,
"max_line_length": 75,
"avg_line_length": 27.934782608695652,
"alnum_prop": 0.666147859922179,
"repo_name": "AlvinRenNo1/clife",
"id": "83683f3dcda12f7433c529498e2fb5f00e2975ee",
"size": "128... |
__author__ = 'djgagne'
import unittest
from hagelslag.evaluation.ProbabilityMetrics import DistributedReliability, DistributedROC, DistributedCRPS
import numpy as np
class TestProbabilityMetrics(unittest.TestCase):
def setUp(self):
self.num_forecasts = 1000
self.forecasts = dict(perfect=np.concat... | {
"content_hash": "1ce55b2eeba861b27de43953bd8c45e6",
"timestamp": "",
"source": "github",
"line_count": 87,
"max_line_length": 122,
"avg_line_length": 64.28735632183908,
"alnum_prop": 0.6086179152512069,
"repo_name": "djgagne/hagelslag",
"id": "c5587f42162e3ab652705cf743b00688c5563e30",
"size": "55... |
'''
Created on Mar 17, 2014
@author: h7qin
'''
import os
def getTotalSourceLineNumbers(dir):
def walk(dirname):
for dirpath, dirs, files in os.walk(dir):
dirs[:] = [d for d in dirs]
files[:] = [f for f in files]
yield (dirpath, dirs, files)
def getLineNumber(filenam... | {
"content_hash": "5074a1d4b3329bb20dc434dfe52e2b90",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 76,
"avg_line_length": 27.77777777777778,
"alnum_prop": 0.5856,
"repo_name": "h2oloopan/easymerge",
"id": "a66ed4d2f323adbad130025d04ddeb0e803ca515",
"size": "1250",
"bin... |
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Deleting field 'Post.tweeter_id'
db.delete_column('posts_post', 'tweeter_id')
# Deleting field 'Post.tweeter_prof... | {
"content_hash": "e2bfbfe76b148982ee4ed47bd2747e6b",
"timestamp": "",
"source": "github",
"line_count": 101,
"max_line_length": 182,
"avg_line_length": 64.35643564356435,
"alnum_prop": 0.5547692307692308,
"repo_name": "fxdgear/beersocial",
"id": "be7a194bccf1d153f1544617d668383f33413518",
"size": "... |
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='AutomaticUpdateRule',
fields=[
('id', models.AutoField(verbose_name='ID', seria... | {
"content_hash": "fdef83f88859ccd584cf2dc1705c6338",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 162,
"avg_line_length": 45.490566037735846,
"alnum_prop": 0.5545416839485691,
"repo_name": "dimagi/commcare-hq",
"id": "4c908bc9f28201cb89b4e7096b7bff800f8ead52",
"size": "... |
from __future__ import unicode_literals, division, absolute_import, print_function
native_int = int
from builtins import * # pylint: disable=unused-import, redefined-builtin
import atexit
import codecs
import copy
import fnmatch
import logging
import os
import shutil
import signal
import sys
import threading
import t... | {
"content_hash": "993780dbf1bc569d7aa82bb46efc6c98",
"timestamp": "",
"source": "github",
"line_count": 923,
"max_line_length": 120,
"avg_line_length": 42.191765980498374,
"alnum_prop": 0.582312610738772,
"repo_name": "tarzasai/Flexget",
"id": "861227da9f407621eea848b4e02a788976bdfd4f",
"size": "38... |
"""Pooling layers.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import functools
from tensorflow.python.framework import tensor_shape
from tensorflow.python.keras import backend
from tensorflow.python.keras.engine.base_layer import InputSpec
from ten... | {
"content_hash": "d4ceaf98d930edefaa0cd9d411c9f540",
"timestamp": "",
"source": "github",
"line_count": 899,
"max_line_length": 80,
"avg_line_length": 37.81312569521691,
"alnum_prop": 0.6342295699241043,
"repo_name": "seanli9jan/tensorflow",
"id": "b8d6b03664f48a8aa699cab7cb5e372dfd71830f",
"size":... |
from hookutils import collect_submodules
hiddenimports = collect_submodules('keyring.backends')
| {
"content_hash": "b70d291bd1cd0cdaf5bda6b1463bf147",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 54,
"avg_line_length": 32.333333333333336,
"alnum_prop": 0.8350515463917526,
"repo_name": "rygwdn/rallyswitcher",
"id": "cf0f4c40d3ddf19707093610702893bea923fe71",
"size": "... |
import warnings
import logging
from urllib.parse import urlparse, parse_qs
import requests
from pyquery import PyQuery as pq
ENTRY = 'https://webcat.hkpl.gov.hk/search/query?theme=WEB'
logger = logging.getLogger('hkpl-searcher')
logging.basicConfig(format='[%(name)s / %(levelname)s] %(message)s', level=logging.INFO)
... | {
"content_hash": "e968e43ec42831c253edd9e26ae68a59",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 88,
"avg_line_length": 21.23404255319149,
"alnum_prop": 0.624248496993988,
"repo_name": "Holi0317/hkpl-searcher",
"id": "1965ac3a10427a1021468427a14bf9f3bc76a2f6",
"size": ... |
__author__ = "Brendan O'Connor (anyall.org, brenocon@gmail.com)"
'''
Copyright 2015 Serendio Inc.
Modified By - Satish Palaniappan
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.... | {
"content_hash": "e93d811e9186d03c05e930d808835fd0",
"timestamp": "",
"source": "github",
"line_count": 77,
"max_line_length": 168,
"avg_line_length": 32.246753246753244,
"alnum_prop": 0.675392670157068,
"repo_name": "serendio-labs/diskoveror-ta",
"id": "2a1ea9b85f674028c05ee01f01d892470cfb22eb",
"... |
from typing import Any, Optional
from unittest import mock
from unittest.mock import MagicMock
from cwltool.loghandler import _logger
from cwltool.main import main
from .util import get_data
class MockResponse1:
def __init__(
self, json_data: Any, status_code: int, raise_for_status: Optional[bool] = Non... | {
"content_hash": "ee926d4553eed189145523d7bec848d3",
"timestamp": "",
"source": "github",
"line_count": 119,
"max_line_length": 177,
"avg_line_length": 36.36134453781513,
"alnum_prop": 0.6295354749248903,
"repo_name": "common-workflow-language/cwltool",
"id": "52cd46a224cb0daefea3da409fd438d6889e970e... |
from direct.directnotify.DirectNotifyGlobal import directNotify
from otp.avatar import AvatarDetail
from toontown.toon import DistributedToon
class ToonDetail(AvatarDetail.AvatarDetail):
notify = directNotify.newCategory('ToonDetail')
def getDClass(self):
return 'DistributedToon'
def cr... | {
"content_hash": "8909830f6efb49a33b619b2784c832af",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 67,
"avg_line_length": 33.214285714285715,
"alnum_prop": 0.7397849462365591,
"repo_name": "DedMemez/ODS-August-2017",
"id": "c4779c422f865d5c40d34b78bc9aadc84731ead1",
"siz... |
import json
from aiohttp import web
class Response(web.Response):
def __init__(self, body=None, **kwargs):
super(Response, self).__init__(
body=body.encode('utf-8') if body is not None else body, **kwargs
)
class JavaScriptResponse(Response):
def __init__(self, data, **kwargs):... | {
"content_hash": "39a41340efc636a75f5210ce0d3bc872",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 77,
"avg_line_length": 25.166666666666668,
"alnum_prop": 0.5838852097130243,
"repo_name": "dmonroy/chilero",
"id": "066c9d153267b96ca1f17118de46e879a3397104",
"size": "906"... |
"""Abstractions to interact with service models."""
from collections import defaultdict
from botocore.utils import CachedProperty, instance_cache
from botocore.compat import OrderedDict
NOT_SET = object()
class NoShapeFoundError(Exception):
pass
class InvalidShapeError(Exception):
pass
class OperationN... | {
"content_hash": "c04f79e9a502a036b15676c23c20d8a2",
"timestamp": "",
"source": "github",
"line_count": 675,
"max_line_length": 79,
"avg_line_length": 34.33037037037037,
"alnum_prop": 0.5981530229145989,
"repo_name": "lordmuffin/aws-cfn-plex",
"id": "a33c2edbcb1e3cf5be82d859b1c3627e1edfa701",
"size... |
from unittest import main, TestCase
from json import loads, dumps
from os.path import join
from functools import partial
from tornado.web import HTTPError
from qiita_db.handlers.tests.oauthbase import OauthTestingBase
import qiita_db as qdb
from qiita_db.handlers.prep_template import _get_prep_template
class UtilTe... | {
"content_hash": "9b8f49c41e11c559d187118069c86d3d",
"timestamp": "",
"source": "github",
"line_count": 156,
"max_line_length": 79,
"avg_line_length": 41.493589743589745,
"alnum_prop": 0.5733044955970956,
"repo_name": "ElDeveloper/qiita",
"id": "108fe81b4e5959d561a54a4295ebebd96b00ca92",
"size": "6... |
'''Kaushik Tandon
This program scrapes Wikipedia articles related to Environmental Tech. The goal is to build a knowledge graph
of topics related to AI and categorize them using The Brane's Knowledge Classification System of tags. This program
successfully creates nodes and links in a CSV file with a false pos... | {
"content_hash": "c713f96e0eb483a748a24adc03f47ff8",
"timestamp": "",
"source": "github",
"line_count": 871,
"max_line_length": 197,
"avg_line_length": 35.630309988518945,
"alnum_prop": 0.6752593929238899,
"repo_name": "TheBrane/sodi-data-acquisition",
"id": "87c3c181dfe40b2d24830b7096abdc4f94cca879"... |
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('diary', '0012_auto_20150525_0151'),
]
operations = [
migrations.RemoveField(
model_name='imageitem',
name='data',
),... | {
"content_hash": "8c4fa80cf2b1ccb98341bd8b24a2be55",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 46,
"avg_line_length": 22.17391304347826,
"alnum_prop": 0.5509803921568628,
"repo_name": "DevLoL/devlol.at",
"id": "eabb8cf87ca59edd4b1c9366b30f39325516550e",
"size": "534"... |
import os
import warnings
import theano
import theano.sandbox.cuda
from theano import config
def set_gpu_from_theano():
"""
This set the GPU used by PyCUDA to the same as the one used by Theano.
"""
# Transfer the theano gpu binding to pycuda, for consistency
if config.device.startswith("gpu") an... | {
"content_hash": "0b863ecab880128547a8b57afb68563f",
"timestamp": "",
"source": "github",
"line_count": 65,
"max_line_length": 80,
"avg_line_length": 38.95384615384615,
"alnum_prop": 0.6141390205371248,
"repo_name": "surgebiswas/poker",
"id": "f01c478edd1f84f2f279bc72744d5548584b3605",
"size": "253... |
import logging
from .core import AuthenticationException
logger = logging.getLogger(__name__)
class AuthorizationHeaderToken(object):
def __init__(self, scheme, token, handler):
self.__scheme = scheme
self.__token = token
self.__handler = handler
@property
def scheme(self):
... | {
"content_hash": "76977de6e81410232749b33276591029",
"timestamp": "",
"source": "github",
"line_count": 70,
"max_line_length": 99,
"avg_line_length": 24.485714285714284,
"alnum_prop": 0.6651108518086347,
"repo_name": "barryloper/dorthy",
"id": "1838d37fd1b495c23d12378aaa092e957708c55d",
"size": "17... |
"""
Unit tests for CalendarDateRange parameter.
"""
import datetime as dt
import param
from . import API1TestCase
# Assuming tests of range parameter cover most of what's needed to
# test date range.
class TestDateTimeRange(API1TestCase):
bad_range = (dt.date(2017,2,27),dt.date(2017,2,26))
def test_wrong_t... | {
"content_hash": "a4184ce8496b636dea760f63458f35ce",
"timestamp": "",
"source": "github",
"line_count": 78,
"max_line_length": 67,
"avg_line_length": 26.371794871794872,
"alnum_prop": 0.5683033543996111,
"repo_name": "ceball/param",
"id": "01984eead3132e8ee4fb8d9a2752ef3a2ba1b78d",
"size": "2057",
... |
class Solution:
def replaceWords(self, dict, sentence) -> str:
trie = {}
for word in dict:
current_dict = trie
for c in word:
current_dict = current_dict.setdefault(c, {})
current_dict['_end_'] = '_end_'
print(trie)
def search(word)... | {
"content_hash": "05b6bcaf549cda11bfbede5f2cea299b",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 61,
"avg_line_length": 33.208333333333336,
"alnum_prop": 0.5081555834378921,
"repo_name": "eroicaleo/LearningPython",
"id": "d9630f4f753e119586a9e288ad284a1c49a15ca4",
"siz... |
import sys, os, os.path
sys.path.append(os.path.abspath("../../src"))
import whoosh
# 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 he... | {
"content_hash": "194d5d1f0fa11dea3a0420d573e8f474",
"timestamp": "",
"source": "github",
"line_count": 198,
"max_line_length": 80,
"avg_line_length": 32.27777777777778,
"alnum_prop": 0.7011422312627132,
"repo_name": "soad241/whoosh",
"id": "0136619dcef7a9a4a0ffca6480e71efb620f2b02",
"size": "6392"... |
__revision__ = "test/LINK/VersionedLib-subdir.py rel_2.5.1:3735:9dc6cee5c168 2016/11/03 14:02:02 bdbaddog"
"""
Ensure that SharedLibrary builder with SHLIBVERSION='0.1.2' can build its target
in a subdirectory containing .so.0.1.2 in name.
This is regression test for issue mentioned in:
http://thread.gmane.org/gmane... | {
"content_hash": "05d54067f74d0c5b77535473781fc1b9",
"timestamp": "",
"source": "github",
"line_count": 136,
"max_line_length": 106,
"avg_line_length": 23.529411764705884,
"alnum_prop": 0.6390625,
"repo_name": "EmanueleCannizzaro/scons",
"id": "c1634d2b3f52c2ccbec4e2d176bb88fe4386624b",
"size": "43... |
from hywiki.items import HyWord
from scrapy.contrib.linkextractors.sgml import SgmlLinkExtractor
from scrapy.contrib.spiders import CrawlSpider
from scrapy.contrib.spiders import Rule
from scrapy.selector import Selector
class HywikiWordSpider(CrawlSpider):
name = 'word_scraper'
allowed_domains = ['hy.wikipedia.o... | {
"content_hash": "91c710dcba66f59b32e03f9cc2a53089",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 83,
"avg_line_length": 31.548387096774192,
"alnum_prop": 0.6697341513292433,
"repo_name": "hygir/wikipedia-scraper",
"id": "04f3184b2d5e7a3efd1216206787a4f971aa6c66",
"size... |
import datetime
import re
from docutils import nodes, utils
from docutils.parsers.rst import Directive, directives, roles
from docutils.parsers.rst.directives.admonitions import BaseAdmonition
from docutils.transforms import Transform
from docutils import languages
from nikola.plugin_categories import RestExtension
f... | {
"content_hash": "5be76e55f412a79dc6fbb96c182ba305",
"timestamp": "",
"source": "github",
"line_count": 513,
"max_line_length": 136,
"avg_line_length": 36.09551656920078,
"alnum_prop": 0.603715504671383,
"repo_name": "pluser/nikola_plugins",
"id": "25ce218b60778f89f1a8ca8993737ceddebc15b8",
"size":... |
import numpy as np
import aigame
from aigame.spaces import prng
class Box(aigame.Space):
"""
A box in R^n.
I.e., each coordinate is bounded.
Example usage:
self.action_space = spaces.Box(low=-10, high=10, shape=(1,))
"""
def __init__(self, low, high, shape=None):
"""
Two k... | {
"content_hash": "ecba62371c8afbb3023a5bd01387600b",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 103,
"avg_line_length": 33.68181818181818,
"alnum_prop": 0.5775978407557355,
"repo_name": "Justontheway/aigame",
"id": "176d211fa63e53f063b0bc272faae56a63e64982",
"size": "... |
import json
import time
import urllib
from tempest.api_schema.response.compute import servers as common_schema
from tempest.api_schema.response.compute.v3 import servers as schema
from tempest.common import rest_client
from tempest.common import waiters
from tempest import config
from tempest import exceptions
CONF =... | {
"content_hash": "87e1613f3c02c36d8ba76afa3a4317d3",
"timestamp": "",
"source": "github",
"line_count": 514,
"max_line_length": 79,
"avg_line_length": 41.92023346303502,
"alnum_prop": 0.5817979301062793,
"repo_name": "nikolay-fedotov/tempest",
"id": "89e282dfc5aa06f667f82e8ed88ea6366a50d5e7",
"size... |
import argparse
import handson.myyaml
class CustomFormatter(argparse.ArgumentDefaultsHelpFormatter,
argparse.RawDescriptionHelpFormatter):
pass
class InitArgs(object):
def __init__(self, args):
handson.myyaml._yfn = args.yamlfile
| {
"content_hash": "26130bb6cc2066fb10f7a993381f21f1",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 61,
"avg_line_length": 21,
"alnum_prop": 0.6996336996336996,
"repo_name": "smithfarm/ceph-auto-aws",
"id": "5c8dd16c153d8d9ffd010e3aa7e9f296497763f4",
"size": "1795",
"bi... |
"""
WSGI config for helping_hands_site project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APP... | {
"content_hash": "b3af6d64f7c000c9db5b6d227a32c9fa",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 79,
"avg_line_length": 45.46875,
"alnum_prop": 0.7938144329896907,
"repo_name": "sophiataskova/helping_hands",
"id": "ac500bbd0839fd466b8255dbdfc10a14e44ce193",
"size": "14... |
import heapq
import rave.log
import rave.loader
_log = rave.log.get(__name__)
PRIORITY_MIN = -100
PRIORITY_MAX = 100
PRIORITY_NEUTRAL = 0
ENGINE_PACKAGE = 'rave'
MODULE_PACKAGE = 'rave.modules'
GAME_PACKAGE = 'rave.game'
class ModuleLoader(rave.loader.VFSImporter):
"""
A loader that loads rave e... | {
"content_hash": "85cef41c452d77e72e22eef39b450b87",
"timestamp": "",
"source": "github",
"line_count": 196,
"max_line_length": 132,
"avg_line_length": 34.75,
"alnum_prop": 0.5903685215093232,
"repo_name": "rave-engine/rave",
"id": "fcacbd7535312322247e9fdae2ea36d0ba62d6bf",
"size": "6811",
"bina... |
from collections import defaultdict
from itertools import groupby, starmap
from operator import attrgetter, itemgetter
from django.shortcuts import get_object_or_404
from django.utils.encoding import force_text
from django.utils.six.moves import filter, filterfalse
from django.utils.translation import ugettext as _
... | {
"content_hash": "19f9b81646fd35789c0a4f44c75e9e87",
"timestamp": "",
"source": "github",
"line_count": 251,
"max_line_length": 120,
"avg_line_length": 43.30677290836653,
"alnum_prop": 0.6435142594296228,
"repo_name": "netzkolchose/django-cms",
"id": "67ab6e9b396bc260ce170b0a83cc4088b6632590",
"siz... |
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
from sentry.utils.db import is_postgres
class Migration(SchemaMigration):
# Flag to indicate if this migration is too risky
# to run online and needs to be coordinated... | {
"content_hash": "da1007f95dfe547e1a8d9efdd7ae48a7",
"timestamp": "",
"source": "github",
"line_count": 956,
"max_line_length": 233,
"avg_line_length": 91.09414225941423,
"alnum_prop": 0.5790827457915164,
"repo_name": "ifduyue/sentry",
"id": "5bc0ed7d966128eea749877623224e11c4cf9d36",
"size": "8711... |
import logging
from unittest import TestCase
from unittest import skipIf
from parameterized import parameterized
from hvac import exceptions
from tests import utils
from tests.utils.hvac_integration_test_case import HvacIntegrationTestCase
@skipIf(
utils.vault_version_lt("0.11.0"),
"Azure secret engine not ... | {
"content_hash": "ab077aee2e84de867e4b32295b60a69d",
"timestamp": "",
"source": "github",
"line_count": 110,
"max_line_length": 86,
"avg_line_length": 35.9,
"alnum_prop": 0.5910357052418334,
"repo_name": "ianunruh/hvac",
"id": "22290e3913b56c19b2eb9c3a647b542241d2db4d",
"size": "3949",
"binary": ... |
from django.conf.urls import patterns, url
from apps.issues.views import IssueDetailView, IssueAdvanceView, IssueOnBoardView, IssueCreateView
urlpatterns = patterns('',
url(r'^create/$', IssueCreateView.as_view(), name='issue-create'),
url(r'^(?P<pk>\d+)/$', IssueDetailView.as_view(), name='issue-detail'),
... | {
"content_hash": "d6ecfc9f1c2f8fbd3156805b3c54e639",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 98,
"avg_line_length": 54.55555555555556,
"alnum_prop": 0.6863543788187373,
"repo_name": "petry/kanboard",
"id": "c7727be4725bdb6568220cd6f83a97d8418e05b0",
"size": "491",
... |
import sys
import unittest
import json
from libcloud.utils.py3 import httplib
from libcloud.dns.base import Record, Zone
from libcloud.dns.drivers.powerdns import PowerDNSDriver
from libcloud.dns.types import ZoneDoesNotExistError, ZoneAlreadyExistsError
from libcloud.dns.types import RecordType
from libcloud.test i... | {
"content_hash": "6cac746435053e1c7a6f3e1984c6e90d",
"timestamp": "",
"source": "github",
"line_count": 199,
"max_line_length": 83,
"avg_line_length": 35.1608040201005,
"alnum_prop": 0.60468772330999,
"repo_name": "mistio/libcloud",
"id": "31c033b770b30483749c0bd502b8c682c09fe7ea",
"size": "7746",
... |
from django.conf import settings
from django.core.mail import send_mail
from django.core.urlresolvers import reverse
def send_validation(strategy, backend, code):
url = '{0}?verification_code={1}'.format(reverse('social:complete',
args=(backend.name,)),
... | {
"content_hash": "ccc96012e1ffbf2db6ebd28adf8a52c2",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 79,
"avg_line_length": 44.92307692307692,
"alnum_prop": 0.5856164383561644,
"repo_name": "pythondigest/pythondigest",
"id": "a120c1ae78a2349b250d49f6d697b6f63a7d02b8",
"siz... |
"""
====================================
rsfMRI: ANTS, FS, FSL, SPM, aCompCor
====================================
A preprocessing workflow for Siemens resting state data.
This workflow makes use of:
- ANTS
- FreeSurfer
- FSL
- SPM
- CompCor
For example::
python rsfmri_preprocessing.py -d /data/12345-34-1.dcm -... | {
"content_hash": "0e5d74f237b22999c1af0516b2bd9b09",
"timestamp": "",
"source": "github",
"line_count": 1028,
"max_line_length": 139,
"avg_line_length": 41.490272373540854,
"alnum_prop": 0.5957516646347182,
"repo_name": "BrainIntensive/OnlineBrainIntensive",
"id": "77c7598f84c1b06936e79fad09efedbfe8f... |
import _plotly_utils.basevalidators
class ValueValidator(_plotly_utils.basevalidators.StringValidator):
def __init__(
self,
plotly_name="value",
parent_name="scatterpolargl.marker.colorbar.tickformatstop",
**kwargs
):
super(ValueValidator, self).__init__(
pl... | {
"content_hash": "333f987eb58a71f4146e3dfc04782d7d",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 68,
"avg_line_length": 30.11764705882353,
"alnum_prop": 0.58203125,
"repo_name": "plotly/python-api",
"id": "ede54658b1a161e8a7d79718eebe51d8e6e641ff",
"size": "512",
"bi... |
import argparse
import os, sys
import time
import subprocess
# Parse arguments, don't change input args
current_time = time.ctime()
parser = argparse.ArgumentParser(description='Python script benchmarking mxnet')
parser.add_argument('-log', type=str, default=('mxnet_' + current_time + '.log').replace(" ", "_"),
... | {
"content_hash": "fb532d785c1d0c418bbac76827b2bbb9",
"timestamp": "",
"source": "github",
"line_count": 65,
"max_line_length": 211,
"avg_line_length": 46.83076923076923,
"alnum_prop": 0.683311432325887,
"repo_name": "hclhkbu/dlbench",
"id": "1d9bf54e15c73c4b006d91dfadd27b5ac1c18b8a",
"size": "3044"... |
'''
New Integration Test for Simple VM start scheduler create 1000.
@author: quarkonics
'''
import os
import time
import sys
import threading
import zstackwoodpecker.operations.vm_operations as vm_ops
import zstackwoodpecker.operations.scheduler_operations as schd_ops
import zstackwoodpecker.test_util a... | {
"content_hash": "625ab3313a2948c52d928f5599c85a77",
"timestamp": "",
"source": "github",
"line_count": 126,
"max_line_length": 197,
"avg_line_length": 35.357142857142854,
"alnum_prop": 0.6377104377104377,
"repo_name": "zstackio/zstack-woodpecker",
"id": "6949538ed7ffcfa008050561316e9fd7ba5f8e73",
... |
import logging
logger = logging.getLogger(__name__)
class SearchClientStub(object):
def __init__(self, *a, **kw):
pass
def __getattr__(self, attr):
logger.info("%s.%s is called" % (self.__class__.__name__, attr))
return self.__init__
class MQPoolStub(object):
def __init__(self... | {
"content_hash": "87e59560252f85a918c0edf5b330bfda",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 72,
"avg_line_length": 21.90909090909091,
"alnum_prop": 0.5414937759336099,
"repo_name": "dongweiming/code",
"id": "d09ed8f390f1c56e77b694daedecee4ce3fee09d",
"size": "507"... |
import glob
for name in sorted(glob.glob('dir/*')):
print(name)
| {
"content_hash": "928d04c33fa58889921117982b2015ac",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 39,
"avg_line_length": 22.666666666666668,
"alnum_prop": 0.6617647058823529,
"repo_name": "jasonwee/asus-rt-n14uhp-mrtg",
"id": "5278b2547b6db66c4069d370626acebb08972851",
"... |
import numpy
from chainer import cuda
from chainer import serializer
class DictionarySerializer(serializer.Serializer):
"""Serializer for dictionary.
This is the standard serializer in Chainer. The hierarchy of objects are
simply mapped to a flat dictionary with keys representing the paths to
objec... | {
"content_hash": "4c77c4c3e485e3498745150dbcbde2a5",
"timestamp": "",
"source": "github",
"line_count": 137,
"max_line_length": 79,
"avg_line_length": 32.277372262773724,
"alnum_prop": 0.6234735413839891,
"repo_name": "kiyukuta/chainer",
"id": "7a29007bed243947b304b3de714b63fbcd75e821",
"size": "44... |
import string
from oslo.serialization import jsonutils
from nova.compute import api as compute_api
from nova import exception
from nova import test
from nova.tests.api.openstack import fakes
from nova.tests import fake_instance
def fake_get_console_output(self, _context, _instance, tail_length):
fixture = [str(... | {
"content_hash": "2839c9b3ac65da6466e0a6a0223ac136",
"timestamp": "",
"source": "github",
"line_count": 156,
"max_line_length": 78,
"avg_line_length": 37.12179487179487,
"alnum_prop": 0.6373683301675013,
"repo_name": "maelnor/nova",
"id": "faf39da0e11e02e50ebc4bf87bf67ab0f4b420c4",
"size": "6419",
... |
from flask.ext.sqlalchemy import SQLAlchemy
from flask.ext.security import Security
db = SQLAlchemy()
security = Security()
| {
"content_hash": "40ea6bdc9bf85d6a006cfb819f0c7db1",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 43,
"avg_line_length": 18.142857142857142,
"alnum_prop": 0.7874015748031497,
"repo_name": "buddha314/pathfinder-game-manager",
"id": "2f2a86be806b91ee8a91d8bf4126876730662e3d"... |
import requests
from openconversation.base import billet
class InvalidActionError(Exception):
pass
class Billet(billet.Billet):
def __init__(self, billet_id):
self._url = billet_id
if billet_id is not None:
data = self._get(billet_id)
if not data:
raise Va... | {
"content_hash": "45be482ffaa7f6ab79420587320daa0d",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 75,
"avg_line_length": 26.55,
"alnum_prop": 0.6064030131826742,
"repo_name": "AdrianGaudebert/openconversation",
"id": "3f76c623a8f9c6803c23e9bb8dec64d7dcb41645",
"size": "... |
'''
The MIT License (MIT)
Copyright (c) 2014 Mats Liljegren
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,... | {
"content_hash": "4fab809ab6178db835812f0373296886",
"timestamp": "",
"source": "github",
"line_count": 83,
"max_line_length": 150,
"avg_line_length": 38.1566265060241,
"alnum_prop": 0.6495105778339122,
"repo_name": "matslil/git-reviewer",
"id": "cc5ab93d8ef1f1a49e8385feef81e00cdda02d15",
"size": "... |
"""
This module contains essential stuff that should've come with Python itself ;)
It also contains functions (or functionality) which is in Python versions
higher than 2.5 which used to be the lowest version supported by Scrapy.
"""
import os
import re
import inspect
import weakref
from functools import wraps
from s... | {
"content_hash": "6e8f418fc0ba7bb16339c51b7bf387a6",
"timestamp": "",
"source": "github",
"line_count": 224,
"max_line_length": 108,
"avg_line_length": 34.02232142857143,
"alnum_prop": 0.6272142763416875,
"repo_name": "mouadino/scrapy",
"id": "82c953abcc232bd95e4ea498311d731c18845fa9",
"size": "762... |
"""
Example Airflow DAG for Google Cloud Dataflow service
"""
from __future__ import annotations
import os
from datetime import datetime
from airflow import models
from airflow.providers.google.cloud.operators.dataflow import DataflowStartSqlJobOperator
GCP_PROJECT_ID = os.environ.get("GCP_PROJECT_ID", "example-proj... | {
"content_hash": "48ce1739549bd5f43d1fa1b0761da928",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 91,
"avg_line_length": 35.98,
"alnum_prop": 0.6425792106725959,
"repo_name": "apache/airflow",
"id": "3ef0626f6db10573394eb83c18fce88414df43ca",
"size": "2586",
"binary":... |
"""
Copyright (c) 2016 Ad Schellevis <ad@opnsense.org>
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
... | {
"content_hash": "1d6e251ed3fa559d55252bd966afbb28",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 100,
"avg_line_length": 52.351351351351354,
"alnum_prop": 0.7134744450180692,
"repo_name": "opnsense/core",
"id": "54c0451e87c43275c8ec2a1a0a61870f8f87570f",
"size": "1963"... |
import math
from itertools import chain
from random import randint, shuffle
from itertools import cycle
def range_generator(min, max):
prev = 1467632017.0
m = 2147483647.0
k = 16807.0
b = 0.0
while True:
prev = (k * prev + b) % m
delta = int((math.floor(prev * max / m) + min) % (... | {
"content_hash": "9a7f41335bba0c9c68978ee4fb90e352",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 82,
"avg_line_length": 21.714285714285715,
"alnum_prop": 0.5684210526315789,
"repo_name": "sat2707/aicups",
"id": "69dcaa317d6746c183eed5df2568a61c77474e42",
"size": "760",... |
from os import path
import time
from jpype import *
startJVM(getDefaultJVMPath(), "-ea")
# XML test
Element = JPackage("org").w3c.dom.Element
def output(el, prefix="") :
if not isinstance(el, Element) :
return
#print prefix, "<", el.getTagName(),
atts = el.getAttribu... | {
"content_hash": "d3c4539dfaaefeb8634955a00c5d3020",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 87,
"avg_line_length": 24.536585365853657,
"alnum_prop": 0.5775347912524851,
"repo_name": "marscher/jpype",
"id": "aaf39100ccc8d0967206712e4f0178c5f50a2f22",
"size": "1786"... |
import SloppyCell.ReactionNetworks
import SloppyCell.ReactionNetworks.Reactions as Reactions
baseNetwork = SloppyCell.ReactionNetworks.Network('base')
baseNetwork.addCompartment('cell')
baseNetwork.addSpecies('EGF', 'cell', 0.0, typicalValue = 1)
baseNetwork.addSpecies('NGF', 'cell', 0.0, typicalValue = 1)
baseNetwo... | {
"content_hash": "b6a39f76e1fa06f00ef1df3ebe28e176",
"timestamp": "",
"source": "github",
"line_count": 219,
"max_line_length": 154,
"avg_line_length": 45.757990867579906,
"alnum_prop": 0.6105179123839937,
"repo_name": "GutenkunstLab/SloppyCell",
"id": "280826d0290ae81ca7e8b7c1267bd8f20b6906d0",
"s... |
with open('/home/matheus/Imagens/imagem.png', 'rb') as fonte:
with open('/home/matheus/Imagens/imagem3.png', 'wb') as destino:
byte = fonte.read(1)
while byte != b'':
destino.write(byte)
byte = fonte.read(1)
| {
"content_hash": "bbba10ec367ec4a675bbf36cb09d5334",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 68,
"avg_line_length": 37.714285714285715,
"alnum_prop": 0.5492424242424242,
"repo_name": "matheusfarias/Python",
"id": "27e2600eeafd4e9460ab0334e2adf9bbeb4a1ccc",
"size": "... |
from django.apps import apps
from django.db.models import Case, IntegerField, Q, When
MATCH_HOSTNAME_PORT = 0
MATCH_HOSTNAME_DEFAULT = 1
MATCH_DEFAULT = 2
MATCH_HOSTNAME = 3
def get_site_for_hostname(hostname, port):
"""Return the wagtailcore.Site object for the given hostname and port."""
Site = apps.get_m... | {
"content_hash": "0fbe384acff10d4c9fcb049176bce3a7",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 94,
"avg_line_length": 36.16,
"alnum_prop": 0.6664823008849557,
"repo_name": "torchbox/wagtail",
"id": "f17a63fdf040df52e9f6b658ee5366aa2d851e9d",
"size": "1808",
"binary... |
"""Workflow management."""
__all__ = [
'Task',
'Workflow',
]
import builtins
import sys
import os
class Task:
"""Individual steps of a workflow."""
def __init__(self, workflow):
self.workflow = workflow
self.print = self.workflow.print
self.prefix = self.workflow.... | {
"content_hash": "cb79a80cf8917f934a839e09a476050b",
"timestamp": "",
"source": "github",
"line_count": 80,
"max_line_length": 66,
"avg_line_length": 23.975,
"alnum_prop": 0.543274244004171,
"repo_name": "brandjon/frexp",
"id": "f8c1032fde1226a257a939e19cf839409dd17368",
"size": "1918",
"binary":... |
import unittest
import IECore
import Gaffer
import GafferUI
import GafferUITest
from Qt import QtWidgets
class TestWidget( GafferUI.Widget ) :
def __init__( self, s, **kw ) :
GafferUI.Widget.__init__( self, QtWidgets.QLabel( s ), **kw )
self.s = s
class ListContainerTest( GafferUITest.TestCase ) :
def te... | {
"content_hash": "38cf470a57d6251dd54dcb668032833f",
"timestamp": "",
"source": "github",
"line_count": 337,
"max_line_length": 84,
"avg_line_length": 25.658753709198812,
"alnum_prop": 0.6406846305076905,
"repo_name": "appleseedhq/gaffer",
"id": "cf41bc448c6571a15bbaae1fd759c8e3f7c849a8",
"size": "... |
"""Support for Renault device trackers."""
from __future__ import annotations
from renault_api.kamereon.models import KamereonVehicleLocationData
from homeassistant.components.device_tracker import SOURCE_TYPE_GPS
from homeassistant.components.device_tracker.config_entry import TrackerEntity
from homeassistant.config... | {
"content_hash": "d54543b3b7fd84eb493f38048bbe1bc6",
"timestamp": "",
"source": "github",
"line_count": 61,
"max_line_length": 84,
"avg_line_length": 33.32786885245902,
"alnum_prop": 0.7294638465322184,
"repo_name": "Danielhiversen/home-assistant",
"id": "466a1f9e4a60072126a602c00672951659fe86a3",
... |
"""
RegEx utilities
"""
REGEX_SPECIAL_CHARS = '()[]'
def SanitizeRegex(text):
for char in REGEX_SPECIAL_CHARS:
text = text.replace(char, '\\' + char)
return text
| {
"content_hash": "e8f8c1d5d55bf508090d8a875ae082ac",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 42,
"avg_line_length": 15.909090909090908,
"alnum_prop": 0.6285714285714286,
"repo_name": "ghowland/templateman",
"id": "690f33a68759bbc8d14f606cf5f69dc769f8f2d5",
"size": ... |
from collections import namedtuple, OrderedDict
import json
from pathlib import PosixPath
import re
import sys
import html_writer
import models
from symbols import pairs
from tagsetbench import read_args
from vertical import parse_token_with_two_tags, read_sentences
Row = namedtuple('Row', ['expected_tag', 'given_tag... | {
"content_hash": "d2ad06bfd8eaa7fccdf7402191fa5fd2",
"timestamp": "",
"source": "github",
"line_count": 1146,
"max_line_length": 93,
"avg_line_length": 39.24258289703316,
"alnum_prop": 0.5167215156097127,
"repo_name": "lenoch/tagsetbench",
"id": "49a1a7e1ad266e682e69360b8e9f5b4a49f99e3e",
"size": "... |
from queue import Queue
from queue import PriorityQueue as PQueue
from queue import LifoQueue as Stack
from collections import Counter, defaultdict, deque, OrderedDict
from sys import setrecursionlimit as setreclim
from sys import maxsize
from bisect import bisect_left, bisect, insort_left, insort
import math
from fra... | {
"content_hash": "e1b67689cd9e17c0cdfb01ef623e9192",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 64,
"avg_line_length": 29.27777777777778,
"alnum_prop": 0.7741935483870968,
"repo_name": "knuu/competitive-programming",
"id": "4cabf1af96c0a02223e524cd5d33615a380747c1",
"... |
import logging
import os
import datetime
import bson
from tg import expose, flash, redirect, validate, config
from tg.decorators import with_trailing_slash
from pylons import tmpl_context as c, app_globals as g
from pylons import request, response
from webob import exc as wexc
import allura.tasks.repo_tasks
from allu... | {
"content_hash": "61015042d8458fa5d7ac8197dca818f9",
"timestamp": "",
"source": "github",
"line_count": 828,
"max_line_length": 119,
"avg_line_length": 36.621980676328505,
"alnum_prop": 0.5912343765458563,
"repo_name": "apache/incubator-allura",
"id": "47857f43ee931f8c581a14f9793e5b5d66fee3c3",
"si... |
import supybot.conf as conf
import supybot.registry as registry
def configure(advanced):
# This will be called by supybot to configure this module. advanced is
# a bool that specifies whether the user identified himself as an advanced
# user or not. You should effect your configuration by manipulating th... | {
"content_hash": "e378ac42d1bd4867cb33865c27ea22fc",
"timestamp": "",
"source": "github",
"line_count": 60,
"max_line_length": 78,
"avg_line_length": 58.68333333333333,
"alnum_prop": 0.7656915648963363,
"repo_name": "haxwithaxe/supybot",
"id": "4d8d99c3aeb6fd8e79b5e02444d3422014007d79",
"size": "51... |
import datetime
import json
import operator
import os
from decimal import Decimal
import pytest
from pyrql import Query
from pyrql import RQLQueryError
@pytest.fixture(scope="session")
def data():
with open(os.path.join(os.path.dirname(__file__), "testdata.json")) as f:
data_ = json.load(f)
for row... | {
"content_hash": "d68fb3c2625157eda20b745a32924216",
"timestamp": "",
"source": "github",
"line_count": 394,
"max_line_length": 116,
"avg_line_length": 35.6243654822335,
"alnum_prop": 0.5483756055856369,
"repo_name": "pjwerneck/pyrql",
"id": "085d7be660e5e25e490a069faa104123a0916b76",
"size": "1406... |
if __name__ == "__main__":
import gizeh
import moviepy.editor as mpy
from scipy import misc
from scipy.ndimage import zoom
from numpy import pi
from vectortween.NumberAnimation import NumberAnimation
from vectortween.SequentialAnimation import SequentialAnimation
from vectortween.ColorA... | {
"content_hash": "c9ea0105491be7e4a13099582f810879",
"timestamp": "",
"source": "github",
"line_count": 82,
"max_line_length": 106,
"avg_line_length": 39.792682926829265,
"alnum_prop": 0.5586883236285627,
"repo_name": "shimpe/pyvectortween",
"id": "8a8d1b17465d7618dc177e816e638254d8e5dceb",
"size":... |
"""Tests for textio module."""
from __future__ import absolute_import
from __future__ import division
import bz2
import datetime
import glob
import gzip
import logging
import os
import shutil
import sys
import tempfile
import unittest
import zlib
from builtins import range
import apache_beam as beam
import apache_bea... | {
"content_hash": "409c8190293345fa941174acfd6f247f",
"timestamp": "",
"source": "github",
"line_count": 1152,
"max_line_length": 112,
"avg_line_length": 36.81684027777778,
"alnum_prop": 0.6439299271449791,
"repo_name": "markflyhigh/incubator-beam",
"id": "fc6da454e9ac06445aff024653b9ee465a65b422",
... |
from __future__ import absolute_import
from unittest import TestCase
import voeventparse as vp
from pysovo.tests.resources import datapaths
import pysovo.voevent as vo_subs
from pysovo.triggers.swift import BatGrb
import datetime
class TestFollowupVoevent(TestCase):
def test_initial_case(self):
with open(d... | {
"content_hash": "8750c810aa417d9f71c732a16c09ff44",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 79,
"avg_line_length": 37.869565217391305,
"alnum_prop": 0.5797933409873708,
"repo_name": "timstaley/pysovo",
"id": "ee22a7d1aac4ed1801b379977abfba090e23ab05",
"size": "871... |
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
class SuspiciousOperation(Exception):
"""
The user did something suspicious
"""
| {
"content_hash": "559d5d89fdb04c53e13fe49405c022e0",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 39,
"avg_line_length": 22.77777777777778,
"alnum_prop": 0.7170731707317073,
"repo_name": "dstufft/storages",
"id": "d14548ea2b2a55fb87e9081e91bcf0b846ca4222",
"size": "205",... |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('proposals', '0011_auto_20151222_1743'),
]
operations = [
migrations.AddField(
model_name='talkproposal',
name='cancelled',
... | {
"content_hash": "e6190833d2b253b03bc63e06b0f80680",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 94,
"avg_line_length": 27.782608695652176,
"alnum_prop": 0.6087636932707355,
"repo_name": "uranusjr/pycontw2016",
"id": "6656d913c9b728f1bc73636cdb469b93c6f57bf1",
"size": ... |
import random
from pandac.PandaModules import *
from direct.interval.IntervalGlobal import Sequence, Func, Parallel, Wait, LerpHprInterval, LerpScaleInterval, LerpFunctionInterval
from otp.otpbase import OTPGlobals
from toontown.toonbase import ToontownGlobals
from CogdoGameGatherable import CogdoGameGatherable, CogdoM... | {
"content_hash": "6fada797fcc8b7d7b84d07971d98c42c",
"timestamp": "",
"source": "github",
"line_count": 437,
"max_line_length": 348,
"avg_line_length": 36.49885583524028,
"alnum_prop": 0.6587460815047022,
"repo_name": "ToonTownInfiniteRepo/ToontownInfinite",
"id": "7f8a4a9adfaff4feb0b6a0cdc22b12f9978... |
"""Contains calculations related to cross-sections and respective vector components.
Compared to the rest of the calculations which are based around pint quantities, this module
is based around xarray DataArrays.
"""
import numpy as np
import xarray as xr
from .basic import coriolis_parameter
from .tools import firs... | {
"content_hash": "a6d190cc81d87328d1bb860784bc1095",
"timestamp": "",
"source": "github",
"line_count": 325,
"max_line_length": 93,
"avg_line_length": 32.73538461538462,
"alnum_prop": 0.6508130463389417,
"repo_name": "Unidata/MetPy",
"id": "acc8bba28a57044b3c369f6bff9fc766e429119a",
"size": "10777"... |
"""Bluetooth support for esphome."""
from __future__ import annotations
from collections.abc import Callable
import logging
from aioesphomeapi import APIClient
from homeassistant.components.bluetooth import (
HaBluetoothConnector,
async_get_advertisement_callback,
async_register_scanner,
)
from homeassis... | {
"content_hash": "782c9e19b9a4049399cafd2bde6fcd6d",
"timestamp": "",
"source": "github",
"line_count": 86,
"max_line_length": 88,
"avg_line_length": 30.906976744186046,
"alnum_prop": 0.6832204665161776,
"repo_name": "mezz64/home-assistant",
"id": "b5be536247485824008d52a07124633df7823c99",
"size":... |
import six
from geojson import GeoJSON
from pymongo import GEOSPHERE
from pymongo.errors import OperationFailure
from girder.api import access
from girder.api.describe import Description, autoDescribeRoute
from girder.api.rest import Resource, RestException
from girder.constants import AccessType
GEOSPATIAL_FIELD =... | {
"content_hash": "84e03ec45ac0611637a2843408553486",
"timestamp": "",
"source": "github",
"line_count": 359,
"max_line_length": 91,
"avg_line_length": 39.370473537604454,
"alnum_prop": 0.5756332248478845,
"repo_name": "sutartmelson/girder",
"id": "f9741457d6bdceadbed34d699d6ba0444aafe5b0",
"size": ... |
import unittest2
from consts.fcm.platform_type import PlatformType
class TestPlatformType(unittest2.TestCase):
def test_validate_invalid(self):
with self.assertRaises(ValueError):
PlatformType.validate(3)
def test_validate(self):
PlatformType.validate(PlatformType.ANDROID)
... | {
"content_hash": "b95dc1e88321d556523d020fbb61acbf",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 94,
"avg_line_length": 39.54545454545455,
"alnum_prop": 0.7226053639846743,
"repo_name": "bdaroz/the-blue-alliance",
"id": "91baf364f52ab8437677c2390543a1b15d00d385",
"size... |
from Crypto.Cipher import PKCS1_OAEP
from Crypto.PublicKey import RSA
from django import forms
from django.db.models import Count
from dcim.models import Device
from utilities.forms import BootstrapMixin, BulkEditForm, BulkImportForm, CSVDataField, FilterChoiceField, SlugField
from .models import Secret, SecretRole,... | {
"content_hash": "5e38e7ef6386a867fbc35d273c2843d2",
"timestamp": "",
"source": "github",
"line_count": 129,
"max_line_length": 117,
"avg_line_length": 34.06201550387597,
"alnum_prop": 0.6688666363222576,
"repo_name": "Alphalink/netbox",
"id": "65e36937612b943a2f1b7aa0e6e9df3b21a98437",
"size": "43... |
import sys
import os
import re
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
sys.path.insert(0, os.path.join(os.path.dirname(__file__), 'tinify'))
from version import __version__
install_require = ['requests >= 2.7.0, < 3.0.0']
tests_require = ['pytest', 'httpretty < ... | {
"content_hash": "a4967ad175c3a623b7b529a4a6f2d5ad",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 135,
"avg_line_length": 30.696428571428573,
"alnum_prop": 0.6218731820826061,
"repo_name": "tinify/tinify-python",
"id": "8a039e4da5d94bbf8c5015563ae59acbd86ff2f4",
"size":... |
from oslo_log import log
import testtools
from tempest.common import waiters
from tempest import config
from tempest.scenario import manager
from tempest import test
CONF = config.CONF
LOG = log.getLogger(__name__)
class TestShelveInstance(manager.ScenarioTest):
"""
This test shelves then unshelves a Nova ... | {
"content_hash": "24f96be7f92b5d903615066c43a0718c",
"timestamp": "",
"source": "github",
"line_count": 104,
"max_line_length": 79,
"avg_line_length": 42.91346153846154,
"alnum_prop": 0.5783105534393905,
"repo_name": "izadorozhna/tempest",
"id": "bc80412361bd50978b86a245157b247004ea1be2",
"size": "... |
__all__ = [
'list_opts'
]
import copy
import itertools
import manila.api.common
import manila.api.middleware.auth
import manila.common.config
import manila.compute
import manila.compute.nova
import manila.coordination
import manila.data.helper
import manila.db.api
import manila.db.base
import manila.exception
imp... | {
"content_hash": "a493f3fbf95cfd6b7c6fcdd20f814481",
"timestamp": "",
"source": "github",
"line_count": 203,
"max_line_length": 78,
"avg_line_length": 43.93103448275862,
"alnum_prop": 0.7924422516259251,
"repo_name": "openstack/manila",
"id": "4121bf9841f6e6233964e07024387c86e87bde3f",
"size": "951... |
import logging
import re
from webkitpy.common.system.deprecated_logging import error, log
from webkitpy.common.system.executive import Executive, ScriptError
from webkitpy.common.system.filesystem import FileSystem
class CheckoutNeedsUpdate(ScriptError):
def __init__(self, script_args, exit_code, output, cwd):
... | {
"content_hash": "250b421779d3acd0e7c224f03840b087",
"timestamp": "",
"source": "github",
"line_count": 216,
"max_line_length": 130,
"avg_line_length": 34.81944444444444,
"alnum_prop": 0.6554979391038426,
"repo_name": "leighpauls/k2cro4",
"id": "ee63b713012d88ddf32c3c36ef89f5e6ee9b38c6",
"size": "9... |
import os
import unittest
import textwrap
from mock import patch
from conans.client import tools
from conans.client.rest.conan_requester import ConanRequester
from conans.test.utils.tools import TestClient
from conans.util.files import save
@patch.dict('os.environ', {})
class ProxiesConfTest(unittest.TestCase):
... | {
"content_hash": "bd59b758ff6d7c7d8f6e7d982ce1b46d",
"timestamp": "",
"source": "github",
"line_count": 129,
"max_line_length": 96,
"avg_line_length": 35.3875968992248,
"alnum_prop": 0.5989047097480833,
"repo_name": "memsharded/conan",
"id": "efa4ee1f184689fecbc86fea9eecd30a8acb95cb",
"size": "4565... |
extensions = ['rst2pdf.pdfbuilder']
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
# The suffix of source filenames.
source_suffix = '.rst'
# The encoding of source files.
# source_encoding = 'utf-8-sig'
# The master toctree document.
master_doc = 'index'
#... | {
"content_hash": "7cdafbc253627c1e30b310ebac8f3f0c",
"timestamp": "",
"source": "github",
"line_count": 265,
"max_line_length": 80,
"avg_line_length": 32.52075471698113,
"alnum_prop": 0.7019029937340451,
"repo_name": "ccaballe/crossdata",
"id": "179eeb64e690bb81e6bd15abfee914fe1389d701",
"size": "9... |
from .panzoom import PanZoom
from .viewport import Viewport
from .trackball import Trackball
from .xyz import X,Y,Z
from .rotate import Rotate
from .position import Position
from .translate import Translate
from .transform import Transform
from .albers import Albers
from .polar import PolarProjection
from .hammer imp... | {
"content_hash": "d1a7a6fe0d8ed73fb0bd61cab6aac5e9",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 65,
"avg_line_length": 31.714285714285715,
"alnum_prop": 0.8524774774774775,
"repo_name": "duyuan11/glumpy",
"id": "df3b668a92c23d41369fcdaa470ef413ef6fef93",
"size": "1189... |
from .redis_queue import RedisQueue
from .collection_queues import CollectionQueues
from redis.connection import ConnectionPool
from redis.connection import Connection
from redis.connection import ConnectionError
from redis.connection import BlockingConnectionPool
from redis.connection import AuthenticationError
VERSIO... | {
"content_hash": "1dd0ac0eba5f082e03937c278f823f4e",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 51,
"avg_line_length": 41.125,
"alnum_prop": 0.8723404255319149,
"repo_name": "yordanglez/redis-sort-queue",
"id": "d2eb867eadcb6fbe8a5d5030a54fe4b047dbdada",
"size": "353",... |
"""Contains the Unit Tests for the REST Resources.
Contains the Unit Tests for exercising all provided
API Endpoints for the Python Eve REST Server
"""
import requests
__author__ = "Sanjay Joshi"
__copyright__ = "Copyright 2016 IBM"
__credits__ = ["Sanjay Joshi"]
__license__ = "Apache 2.0"
__version__ = "1.0"
__main... | {
"content_hash": "bd34ab8d4159b325e27b44c4b2791ca4",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 54,
"avg_line_length": 25.928571428571427,
"alnum_prop": 0.6597796143250688,
"repo_name": "joshisa/mistub",
"id": "ef6a97af8f9d32e902ce8684782427015fbffac4",
"size": "748",... |
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'ReplayEvent'
db.create_table('webscript_backend_replayevent', (
('id', self.gf('django.db.models.fields.... | {
"content_hash": "7206b66d94c82d1be991bde6e4937ad4",
"timestamp": "",
"source": "github",
"line_count": 137,
"max_line_length": 182,
"avg_line_length": 74.63503649635037,
"alnum_prop": 0.5737897310513448,
"repo_name": "sbarman/webscript_db",
"id": "2e34e618669c810bcf083df460170b03ad3b903f",
"size":... |
from ex25 import *
print "Let's practice everything."
print 'You\'d need to know \'bout escapes with \\ that do \n newlines and \t tabs.'
poem = """
\tThe lovely world
with logic so firmly planted
cannot discern \n the needs of love
nor comprehend passion from intuition
and requires an explantion
\n\t\twhere there is... | {
"content_hash": "4929a23130c19a796f98691dc5f062b7",
"timestamp": "",
"source": "github",
"line_count": 54,
"max_line_length": 83,
"avg_line_length": 24.314814814814813,
"alnum_prop": 0.6976389946686976,
"repo_name": "1uk/LPTHW",
"id": "a0d67a72e22d108cf14bd50cec091738f5e09380",
"size": "1313",
"... |
import os
import tornado.web
import tornado.escape
from traffic_cloud_utils.plotting.visualization import road_user_counts, road_user_icon_counts
from traffic_cloud_utils.app_config import get_project_path
from baseHandler import BaseHandler
from traffic_cloud_utils.statusHelper import StatusHelper, Status
class Road... | {
"content_hash": "e34d008fe3a7e6dc1571113b824a23cb",
"timestamp": "",
"source": "github",
"line_count": 78,
"max_line_length": 297,
"avg_line_length": 43.282051282051285,
"alnum_prop": 0.6368483412322274,
"repo_name": "santosfamilyfoundation/SantosCloud",
"id": "d22e743fda3df537c18792b43d01982cefc96c... |
from random import random
from random import choice
from math import floor
import names
'''
Names is required to run this script.
download from https://pypi.python.org/pypi/names/.
'''
elder_population = 0
married_population = 0
single_population = 0
runtime = 0
born_this_year = 0
living = []
the_dead = []
'''
A bun... | {
"content_hash": "24866aac869fd4fdf5f6479fe390cc31",
"timestamp": "",
"source": "github",
"line_count": 666,
"max_line_length": 235,
"avg_line_length": 32.61711711711712,
"alnum_prop": 0.45808589973760533,
"repo_name": "jackellice2/Population-Simulator",
"id": "bb51d902f6dc45488f72f4035eab1cc60afacd3... |
import math
import numbers
import time
# Special dependencies
import numpy
# Cassius interdependencies
import mathtools
def unicode_number(x):
"""Convert a number to unicode, with appropriate substitutions."""
output = u"%g" % x
if output[0] == u"-":
output = u"\u2012" + output[1:]
index = output.find... | {
"content_hash": "bf4dfadb13fc2131fa6af89f7cb3f200",
"timestamp": "",
"source": "github",
"line_count": 588,
"max_line_length": 136,
"avg_line_length": 34.025510204081634,
"alnum_prop": 0.5780476833108412,
"repo_name": "opendatagroup/cassius",
"id": "59a7c0f5f453d9ef84a25bf50dcc3a9c2c8b10f3",
"size... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.