text stringlengths 4 1.02M | meta dict |
|---|---|
"""
NOTE: concatenation seems very slow
"""
import treeano
import treeano.nodes as tn
@treeano.register_node("partition_axis")
class PartitionAxisNode(treeano.NodeImpl):
"""
node that returns a fraction of the input tensor
rough explanation:
x.shape == (4, 8, 12, 16, 20)
y = partition_axis(x, s... | {
"content_hash": "66850e06417a87a6a054543099a031a1",
"timestamp": "",
"source": "github",
"line_count": 71,
"max_line_length": 71,
"avg_line_length": 33.394366197183096,
"alnum_prop": 0.48629270350063264,
"repo_name": "nsauder/treeano",
"id": "9f712635743c3695f75c0e47abb0155db4205593",
"size": "237... |
from traits.api import List
import math
from pychron.hardware.polyinomial_mapper import BaseMapper
from pychron.hardware.core.core_device import CoreDevice
from pychron.hardware.gauges.base_controller import BaseGaugeController
from pychron.hardware.labjack.base_u3_lv import BaseU3LV
PARAMS = {
"mbar": (6.8, 11.3... | {
"content_hash": "7d1b4ba1e9d586083978650d1bdd8d54",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 76,
"avg_line_length": 28.6,
"alnum_prop": 0.6179275270184361,
"repo_name": "NMGRL/pychron",
"id": "299e3314769416a13512b372e5f7b1d503dcdb98",
"size": "2301",
"binary": f... |
import nltk
from nltk import PerceptronTagger
class PosTagger:
def __init__(self, sentence):
"""
Args:
sentence:
"""
self.sentence = sentence
self.tagger = PosTagger.get_tagger()
def pos_tag(self):
"""
Returns:
"""
tokens ... | {
"content_hash": "419fb170f9343bfb44c3148f1d4b5096",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 51,
"avg_line_length": 17.46875,
"alnum_prop": 0.5277280858676208,
"repo_name": "yardstick17/extract_phrase",
"id": "fc6e5f512229e0a4a8b4fd59b6100c136a9b0c1e",
"size": "606... |
from imp import load_source
from getpass import getpass
from base64 import b64encode, b64decode
import logging
import os, sys
import ConfigParser
CONFIG = 'config/config.ini'
for v in sys.argv:
if 'config' in v:
CONFIG = v.split('=')[1:]
config_parser = ConfigParser.RawConfigParser()
config_parser.read(CON... | {
"content_hash": "37e627ee4b513ebd630186692db1c6ea",
"timestamp": "",
"source": "github",
"line_count": 79,
"max_line_length": 71,
"avg_line_length": 27.658227848101266,
"alnum_prop": 0.6411899313501144,
"repo_name": "jlongever/RackHD",
"id": "e4d31907b0eae50f11dc7906ad7037f510b7eb12",
"size": "218... |
from distutils.core import setup
import py2exe
setup(console=['vs_tool_agent.py']) | {
"content_hash": "a8a20ba791c5c707d6ae8c7c76a8ef6f",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 37,
"avg_line_length": 22.75,
"alnum_prop": 0.7142857142857143,
"repo_name": "freedot/uts",
"id": "c10b3ae1d3fee1a88743b4a7ff1b6cc7b5b4cf65",
"size": "91",
"binary": false... |
# Copyright (C) Vladimir Prus 2002. Permission to copy, use, modify, sell and
# distribute this software is granted provided this copyright notice appears in
# all copies. This software is provided "as is" without express or implied
# warranty, and with no claim as to its suitability for any purpose.
import... | {
"content_hash": "08c78df213165fb6e21c660c5ef63fd9",
"timestamp": "",
"source": "github",
"line_count": 462,
"max_line_length": 106,
"avg_line_length": 32.984848484848484,
"alnum_prop": 0.5673600629962596,
"repo_name": "ycsoft/FatCat-Server",
"id": "8c498de4d04774b1cc1e57f3a8782748cb1b9fe8",
"size"... |
import ddt
from poppy.model.helpers import origin
from tests.unit import base
@ddt.ddt
class TestOrigin(base.TestCase):
def test_origin(self):
origin_url = 'www.mywebsite.com'
port = 443
ssl = True
myorigin = origin.Origin(origin_url, port, ssl)
# test all properties
... | {
"content_hash": "f70d1fe776e81bd20f0f544c48d3274b",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 73,
"avg_line_length": 25.314285714285713,
"alnum_prop": 0.618510158013544,
"repo_name": "amitgandhinz/cdn",
"id": "09bc647988c66f2b8cfa8d2904a053dd3fc5ff1f",
"size": "1472... |
from os import path
from setuptools import setup
from distutils.command.clean import clean
from distutils.dir_util import remove_tree
import apitestcase
class CustomCleanCommand(clean):
"""
Customized clean method that removes 'dist' and 'build' directories.
"""
def run(self):
clean.run(self... | {
"content_hash": "6bcb4df0cade3538651c472f1e32e074",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 72,
"avg_line_length": 26.823529411764707,
"alnum_prop": 0.6600877192982456,
"repo_name": "bramwelt/apitestcase",
"id": "d5d6459a4559f95dcc83039bf51c9ab068be46a3",
"size": ... |
import functools
import logging
import json
import requests
from requests.adapters import HTTPAdapter
from requests.packages.urllib3.util.retry import Retry
logging.basicConfig(level=logging.DEBUG)
url = 'https://review.opendev.org/projects/'
# This is what a project looks like
'''
"openstack-attic/akanda": {
... | {
"content_hash": "d308163a47daf206b488cc331809885a",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 89,
"avg_line_length": 29.056603773584907,
"alnum_prop": 0.7006493506493506,
"repo_name": "dtroyer/devstack",
"id": "d39b8018ae61f46c53654c0ead6845b4bdc12b93",
"size": "250... |
import asyncio
import pytest
import ray
from ray.experimental.serve.policy import (
RandomPolicyQueue, RandomPolicyQueueActor, RoundRobinPolicyQueueActor,
PowerOfTwoPolicyQueueActor, FixedPackingPolicyQueueActor)
pytestmark = pytest.mark.asyncio
def make_task_runner_mock():
@ray.remote(num_cpus=0)
... | {
"content_hash": "615c328f42b4e27d21a2ca988959fc77",
"timestamp": "",
"source": "github",
"line_count": 190,
"max_line_length": 78,
"avg_line_length": 34.97894736842105,
"alnum_prop": 0.6477580499548601,
"repo_name": "stephanie-wang/ray",
"id": "ce9ab25311bf3ba4a50230b5de3478706889db9b",
"size": "6... |
from datetime import datetime
from datetime import timedelta
from database import db
from pytz import timezone
from pytz import utc
from yelp_beans.models import MeetingSpec
from yelp_beans.models import MeetingSubscription
def filter_subscriptions_by_user_data(subscriptions, user):
approved_subscriptions = []
... | {
"content_hash": "412421478411dd6804ea4124ef5dd2df",
"timestamp": "",
"source": "github",
"line_count": 139,
"max_line_length": 108,
"avg_line_length": 34.093525179856115,
"alnum_prop": 0.6524583245410425,
"repo_name": "Yelp/beans",
"id": "b30f0c1e44b953f6c1ea2f4be5449ef187864629",
"size": "4739",
... |
import os
import jinja2
template_dir = os.path.join(os.path.dirname(__file__), '../views')
jinja_env = jinja2.Environment(loader=jinja2.FileSystemLoader(template_dir),
autoescape=True)
def render_str(template, **params):
t = jinja_env.get_template(template)
return t.render(par... | {
"content_hash": "99aba4dd7f427c806ddd9259b70b5459",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 76,
"avg_line_length": 27.083333333333332,
"alnum_prop": 0.6584615384615384,
"repo_name": "gnodar01/basic-blog",
"id": "fb5485087cac020d6392dc710d6891baf10fab01",
"size": "... |
import inspect
import sys
from aatest import OperationError
from aatest.events import EV_PROTOCOL_RESPONSE
from aatest.events import NoSuchEvent
from saml2.samlp import NameIDPolicy
__author__ = 'roland'
def set_name_id(oper, args):
assertion = oper.conv.protocol_response[-1].assertion
oper.req_args["name_id"... | {
"content_hash": "d99a844c51bd4ff250517082639d6eb1",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 86,
"avg_line_length": 26.641509433962263,
"alnum_prop": 0.6855524079320113,
"repo_name": "identinetics/saml2test2",
"id": "8e6fbeced4bde5daec1e58672fb72ba6b016f216",
"size... |
'''OpenGL extension SGIX.flush_raster
Automatically generated by the get_gl_extensions script, do not edit!
'''
from OpenGL import platform, constants, constant, arrays
from OpenGL import extensions
from OpenGL.GL import glget
import ctypes
EXTENSION_NAME = 'GL_SGIX_flush_raster'
_DEPRECATED = False
glFlushRasterSGIX... | {
"content_hash": "1268a2aac365807d34ed0c39e8982ad5",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 71,
"avg_line_length": 27.36,
"alnum_prop": 0.7821637426900585,
"repo_name": "Universal-Model-Converter/UMC3.0a",
"id": "2b09528c715c0191eebb743b4be71caa1d2ca531",
"size": ... |
import sys
try:
import cx_Oracle
print "Oracle python drivier is ok!"
except Exception, e:
print e
sys.exit(1)
finally:
sys.exit(1)
| {
"content_hash": "6ce3ce520bb5b778a56e2516c93b99c6",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 40,
"avg_line_length": 10.533333333333333,
"alnum_prop": 0.6265822784810127,
"repo_name": "stanxii/indexRiver",
"id": "d5f5444e509ad267575ed6de1d42fdfe663ef658",
"size": "1... |
import types
class Wrapper(object):
def __init__(self,obj):
self._obj = obj
def __getattr__(self, attr):
if hasattr(self._obj, attr):
attr_value = getattr(self._obj,attr)
if isinstance(attr_value,types.MethodType):
def callable(... | {
"content_hash": "d3d16c3daa10acfff4eace89583e0789",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 55,
"avg_line_length": 26.85,
"alnum_prop": 0.4767225325884544,
"repo_name": "ActiveState/code",
"id": "8bd002dbd8802d0d7002fe65b80aeacf95194066",
"size": "537",
"binary"... |
import weakref
from .anyQt import QtGui, QtCore
class PSpyderhive(object):
def __init__(self, parent, parentwidget):
self._parent = weakref.ref(parent)
pw = parentwidget.wrapwidget()
self.widget = QtGui.QWidget(pw)
pw.setMinimumSize(800, 50)
pw.setTitleBarWidget(QtGui.QWid... | {
"content_hash": "5712fe2adee52b0fc8bbf4695d363881",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 70,
"avg_line_length": 35.41860465116279,
"alnum_prop": 0.6506894287590282,
"repo_name": "agoose77/hivesystem",
"id": "27cacfe1209bc662d142a11a2dafab9774e58d79",
"size": "1... |
'''
The thin runner is used to manage the salt thin systems.
Salt Thin is a transport-less version of Salt that can be used to run rouitines
in a standalone way. This runner has tools which generate the standalone salt
system for easy consumption.
'''
# Import Salt libs
import salt.utils.thin
def generate(extra_mod... | {
"content_hash": "e4c1f0b238ec49c43f3d3bf3baa50c73",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 80,
"avg_line_length": 31.142857142857142,
"alnum_prop": 0.7087155963302753,
"repo_name": "MadeiraCloud/salt",
"id": "02bdc82212abaef32c8d580682cc59003db15d6c",
"size": "89... |
from server.devices.producers import CogenerationUnit, PeakLoadBoiler
class SimulatedCogenerationUnit(CogenerationUnit):
"""The simulation of a cogeneration unit"""
def __init__(self, device_id, env):
super(SimulatedCogenerationUnit, self).__init__(device_id, env)
#: Saves the last powered o... | {
"content_hash": "6effb7c8ba2b9406b7b7d4f5f10b8952",
"timestamp": "",
"source": "github",
"line_count": 168,
"max_line_length": 103,
"avg_line_length": 48.208333333333336,
"alnum_prop": 0.6402024941350785,
"repo_name": "SEC-i/ecoControl",
"id": "64fb61a029ecaecccae6903e2c0a0967303391ca",
"size": "8... |
import numpy as np
import random
# I implemented Schmidhuber's "Compressed Network Search" but didn't use it.
# ndded for the compress/decompress functions.
#from scipy.fftpack import dct
import json
import sys
import config
from env import make_env
import time
import os
from gym.wrappers import Monitor
from nn impor... | {
"content_hash": "baba7174b0d8a5bb92d74f60dd23aaeb",
"timestamp": "",
"source": "github",
"line_count": 815,
"max_line_length": 192,
"avg_line_length": 32.7239263803681,
"alnum_prop": 0.6376452943382077,
"repo_name": "google/brain-tokyo-workshop",
"id": "ca479e429cbe5ff2d53629dba541578e9644ef7b",
"... |
from rqalpha.events import EVENT, Event
from rqalpha.utils import run_when_strategy_not_hold
from rqalpha.utils.logger import user_system_log
from rqalpha.utils.i18n import gettext as _
from rqalpha.utils.exception import ModifyExceptionFromType
from rqalpha.execution_context import ExecutionContext
from rqalpha.const ... | {
"content_hash": "59bb6f276fe41eac9b49d3f81135e933",
"timestamp": "",
"source": "github",
"line_count": 89,
"max_line_length": 120,
"avg_line_length": 45.39325842696629,
"alnum_prop": 0.6574257425742575,
"repo_name": "xclxxl414/rqalpha",
"id": "76b61ae9764fb1f10ba59de30a5082017127db4f",
"size": "46... |
"""This example gets Sites under MCM requiring review."""
# Import appropriate modules from the client library.
from googleads import ad_manager
def main(client):
# Initialize appropriate service.
site_service = client.GetService('SiteService', version='v202211')
# Create a statement to select Sites needing a... | {
"content_hash": "d789ebfe70151e82b389ae42b33ae990",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 78,
"avg_line_length": 34.5,
"alnum_prop": 0.6947996589940324,
"repo_name": "googleads/googleads-python-lib",
"id": "17eddde1bd88e9f428a2b16cdb04f1302a2332a6",
"size": "177... |
"""
Tests for seqmagick.transform
"""
from cStringIO import StringIO
import functools
import logging
import unittest
from Bio import Alphabet, SeqIO
from Bio.SeqRecord import SeqRecord
from Bio.Seq import Seq
from seqmagick import transform
logging.basicConfig(level=logging.FATAL)
def _alignment_record(sequence):
... | {
"content_hash": "48d0eb101b596564dad4797762ad70fe",
"timestamp": "",
"source": "github",
"line_count": 671,
"max_line_length": 146,
"avg_line_length": 38.14157973174367,
"alnum_prop": 0.5971163990153557,
"repo_name": "theboocock/ancient_dna_pipeline",
"id": "f3b6dd79f0dad988ff490578b2152c2a309e1c59"... |
import sys
from ete3 import Tree
from collections import defaultdict
def bissect_tree(treeObj):
subtree1 = ''
subtree2 = ''
for node in treeObj.traverse("postorder"):
if node.dist > length_cutoff: #split the tree here
if node.is_leaf():
continue
elif len(node... | {
"content_hash": "48d0ee152a0eb4a808bbf5d711ea06db",
"timestamp": "",
"source": "github",
"line_count": 76,
"max_line_length": 148,
"avg_line_length": 32.473684210526315,
"alnum_prop": 0.5753646677471637,
"repo_name": "Tancata/phylo",
"id": "ff2354287529e3309106528546d4b9e09f8d7eba",
"size": "2927"... |
import unittest
from dart.model.event import Event
from dart.model.event import EventData
from dart.model.exception import DartValidationException
from dart.schema.base import default_and_validate
from dart.schema.event import event_schema
class TestEventSchema(unittest.TestCase):
def test_event_schema(self):
... | {
"content_hash": "08fcf764c869ce14dd3a4b3023cec909",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 79,
"avg_line_length": 32.29032258064516,
"alnum_prop": 0.6823176823176823,
"repo_name": "RetailMeNotSandbox/dart",
"id": "3326f0a11d9e08f4a96c5858445e403b8c1f6f28",
"size"... |
import argparse
import json
import os
import sys
from . import TimeoutError, run_script
def main():
parser = argparse.ArgumentParser(description='Run tests.')
parser.add_argument('action', nargs='+', choices=['build', 'test'])
parser.add_argument('--workspace', required=True, help='Workspace to build and ... | {
"content_hash": "ee0dfd83c85c48121a94e31c2fea0395",
"timestamp": "",
"source": "github",
"line_count": 201,
"max_line_length": 328,
"avg_line_length": 42.72636815920398,
"alnum_prop": 0.6137633907778295,
"repo_name": "CrossWaterBridge/python-xctool-runner",
"id": "dda0ea94d6c49cdaf263c558769fa4e4ee7... |
import copy
import mock
from openstackclient.common import exceptions
from openstackclient.network.v2 import network
from openstackclient.tests import fakes
from openstackclient.tests.identity.v2_0 import fakes as identity_fakes_v2
from openstackclient.tests.identity.v3 import fakes as identity_fakes_v3
from openstack... | {
"content_hash": "2f31fabc4074d851e85bf9d6ac592181",
"timestamp": "",
"source": "github",
"line_count": 470,
"max_line_length": 77,
"avg_line_length": 31.327659574468086,
"alnum_prop": 0.5602417821244227,
"repo_name": "sjsucohort6/openstack",
"id": "55062594f0693a583969afbc04e217aacff42bf5",
"size"... |
"""
Generate header file with macros defining MicroPython version info.
This script works with Python 2.6, 2.7, 3.3 and 3.4.
"""
from __future__ import print_function
import sys
import os
import datetime
import subprocess
def get_version_info_from_git():
# Python 2.6 doesn't have check_output, so check for tha... | {
"content_hash": "e22937aae147db3e05d276f73cb358b7",
"timestamp": "",
"source": "github",
"line_count": 117,
"max_line_length": 96,
"avg_line_length": 29.11111111111111,
"alnum_prop": 0.5807398708162067,
"repo_name": "bvernoux/micropython",
"id": "54b7fa9ab7d2a5096855ec4feb05f9f2896dca19",
"size": ... |
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import logging
import os
import subprocess
from abc import abstractmethod, abstractproperty
from contextlib import contextmanager
from six import string_types
from tw... | {
"content_hash": "35683349710978aac60d51f6795dcdc8",
"timestamp": "",
"source": "github",
"line_count": 230,
"max_line_length": 99,
"avg_line_length": 36.334782608695654,
"alnum_prop": 0.6817039607514659,
"repo_name": "qma/pants",
"id": "4590686fd9a6cc776d15a0b9369e12113c88ad50",
"size": "8504",
... |
from __future__ import annotations
from unittest import mock
import numpy as np
from dials.algorithms.symmetry.cosym import observers
def test_SymmetryAnalysisObserver():
# setup script
script = mock.Mock()
# test when no symmetry analysis has been performed
script._symmetry_analysis = None
ob... | {
"content_hash": "41e2b7ce78499312aa3baf734ddb7ead",
"timestamp": "",
"source": "github",
"line_count": 90,
"max_line_length": 63,
"avg_line_length": 28.633333333333333,
"alnum_prop": 0.5440434613892122,
"repo_name": "dials/dials",
"id": "34cbaa2b44010083a2a3c45205d91b1209e9b5f3",
"size": "2577",
... |
import json
# save info from common.print_info()
last_info = None
def output(video_extractor, pretty_print=True):
ve = video_extractor
out = {}
out['url'] = ve.url
out['title'] = ve.title
out['site'] = ve.name
out['streams'] = ve.streams
if pretty_print:
print(json.dumps(out, inden... | {
"content_hash": "8c9ad35e31823193d531631860d68200",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 80,
"avg_line_length": 26.181818181818183,
"alnum_prop": 0.6284722222222222,
"repo_name": "betaY/crawler",
"id": "86a42abccbe3fa17008b337ffbe3a6e0cec2dc48",
"size": "1153",... |
from markdown import markdown
import bleach
import re
from werkzeug.exceptions import NotFound
from . import consts as c
def md2html(md: str):
allowed_tags = ('a', 'abbr', 'acronym', 'b', 'blockquote', 'code', 'em', 'i', 'li', 'ol', 'pre', 'strong', 'ul',
'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'p... | {
"content_hash": "c4348289ed90158965605fe0ef06334a",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 119,
"avg_line_length": 32.391304347826086,
"alnum_prop": 0.5865771812080537,
"repo_name": "Einbert-Xeride/tsscp",
"id": "3fcf57a78c3cdb081a87fe39f1490b8e39729d04",
"size":... |
def extractTranslatingZeTianJi(item):
"""
"""
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or 'preview' in item['title'].lower():
return None
return buildReleaseMessageWithType(item, 'Ze Tian Ji ', vol, chp, frag=frag, postfix=postfix)
| {
"content_hash": "a6d285e026c18a07a8dd8e7d80276ef6",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 94,
"avg_line_length": 36.625,
"alnum_prop": 0.7235494880546075,
"repo_name": "fake-name/ReadableWebProxy",
"id": "fea5fa92291ed547056a215ae9da2ec73afc4444",
"size": "293",
... |
from functools import wraps
class exception_guard(object):
"""Guard against the given exception and raise a different exception."""
def __init__(self, catchable, throwable=RuntimeError):
if is_exception_class(catchable):
self._catchable = catchable
else:
raise TypeError... | {
"content_hash": "8b86013444ac76796b02ee8cef66b9bb",
"timestamp": "",
"source": "github",
"line_count": 109,
"max_line_length": 76,
"avg_line_length": 32.018348623853214,
"alnum_prop": 0.5865329512893983,
"repo_name": "ActiveState/code",
"id": "cefd71130b44100692420538276babfc190654c3",
"size": "34... |
"""
Deal with the part of a Tx that specifies where the Bitcoin goes to.
The MIT License (MIT)
Copyright (c) 2013 by Richard Kiss
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 witho... | {
"content_hash": "ce14495d4d41f511c03cf8ab67413cdc",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 106,
"avg_line_length": 36.53846153846154,
"alnum_prop": 0.72,
"repo_name": "ohmannomma/proofofexistence",
"id": "ec70d039ae00bbd2ebf2d9802eb2eafdb7c5f16b",
"size": "1925",... |
"""Test case runner."""
import os
import sys
import unittest
TESTS_DIR = os.path.dirname(os.path.abspath(__file__))
def main():
sys.argv.insert(1, 'discover')
sys.argv.insert(2, TESTS_DIR)
return unittest.main()
if __name__ == '__main__':
sys.exit(main())
| {
"content_hash": "5efe9ce41ff1ea666f5f751ea5bed42f",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 54,
"avg_line_length": 15.882352941176471,
"alnum_prop": 0.6407407407407407,
"repo_name": "nicko96/Chrome-Infra",
"id": "c6fee4d607ecb122dd22045b2c8dbf1717f3710e",
"size": ... |
import logging
from skybase import config as sky_cfg
from skybase.skytask import SkyTask
from skybase import skytask
from skybase.utils.logger import Logger
from skybase.planet import Planet
from skybase.utils import simple_error_format
import skybase.actions.route
def route_ping_add_arguments(parser):
parser.... | {
"content_hash": "90e4741239d5abc25a3b5d753d83ec9b",
"timestamp": "",
"source": "github",
"line_count": 93,
"max_line_length": 129,
"avg_line_length": 27.892473118279568,
"alnum_prop": 0.6033153430994603,
"repo_name": "lithiumtech/skybase.io",
"id": "5c2665addb260b88c0d4841af78584f75de69f3a",
"size... |
"""
numpy.ma : a package to handle missing or invalid values.
This package was initially written for numarray by Paul F. Dubois
at Lawrence Livermore National Laboratory.
In 2006, the package was completely rewritten by Pierre Gerard-Marchant
(University of Georgia) to make the MaskedArray class a subclass of ndarray,... | {
"content_hash": "4aad2792c0e4d85feccdab5dd4b8c7d8",
"timestamp": "",
"source": "github",
"line_count": 7863,
"max_line_length": 83,
"avg_line_length": 31.440798677349612,
"alnum_prop": 0.5378025151788495,
"repo_name": "ryfeus/lambda-packs",
"id": "574077185251ddcca62f9a7c59892e413d9bb80c",
"size":... |
import logging
from django import forms
from django.utils.safestring import mark_safe
from xlivesettings import settings as x_setts
log = logging.getLogger(__name__)
class LocalizedStringValueFieldWidget(forms.MultiWidget):
def __init__(self, langs=[], attrs=None):
widgets = []
for lang in langs... | {
"content_hash": "f86f3c427080cc0bba401fc79e848d80",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 119,
"avg_line_length": 38.50909090909091,
"alnum_prop": 0.5930122757318225,
"repo_name": "oblalex/django-xlivesettings",
"id": "11dccd024b787e0adbc4c832fa3e86d756b9e680",
... |
print 'hello'
| {
"content_hash": "71fc66bfc9fbe7a7ef53fd984dd55379",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 13,
"avg_line_length": 14,
"alnum_prop": 0.7142857142857143,
"repo_name": "liggettla/python",
"id": "d079c1cf462cf29833d8273805cec55234ecac43",
"size": "46",
"binary": fal... |
"""
Description
Example:
Input: [format]
[]
Output: [format]
[]
"""
def solve(input):
return str("solution")
input_file = open("io/tests.txt", "r");
output_file = open("io/solution.txt", "w");
debug = True
test = input_file.readline()
while test != '':
test = test.rstrip("\r\n")
solution = solve(test)... | {
"content_hash": "c5e492ef1dfeb6aa8b8dd166c0177f3b",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 43,
"avg_line_length": 16.482758620689655,
"alnum_prop": 0.604602510460251,
"repo_name": "felixs8696/code-hub",
"id": "c1e3594bee6e75c96ce1b83c2184a19c4bde3fbe",
"size": "4... |
import logging; logger = logging.getLogger("morse." + __name__)
import pymoos.MOOSCommClient
import morse.core.middleware
def init_extra_module(self, component_instance, function, mw_data):
""" Setup the middleware connection with this data
Prepare the middleware to handle the serialised data as necessary.
... | {
"content_hash": "b7c64665adca7b785df84d64ed4102c5",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 100,
"avg_line_length": 43.925925925925924,
"alnum_prop": 0.7276559865092749,
"repo_name": "Arkapravo/morse-0.6",
"id": "0b600f0501b2219837e13d3fda0740b18e95f1be",
"size": ... |
"""create openvas last update table
Revision ID: 4e051e1c257
Revises: 46942860847
Create Date: 2016-01-04 09:04:30.597267
"""
# revision identifiers, used by Alembic.
revision = '4e051e1c257'
down_revision = '46942860847'
branch_labels = None
depends_on = None
from sqlalchemy.dialects import postgresql
from alembic... | {
"content_hash": "aba4b2755148f38718aed735d38a1492",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 92,
"avg_line_length": 24.666666666666668,
"alnum_prop": 0.6928746928746928,
"repo_name": "asrozar/perception",
"id": "2e2a3c51889585ea775dde5c06b3210f001cb8da",
"size": "8... |
"""
sentry.interfaces.exception
~~~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010-2014 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import
__all__ = ('Exception',)
import six
from django.conf import settings
from sentry.interface... | {
"content_hash": "a25993826b5cceb0e986b7c7b0e36128",
"timestamp": "",
"source": "github",
"line_count": 350,
"max_line_length": 89,
"avg_line_length": 31.357142857142858,
"alnum_prop": 0.5545330296127563,
"repo_name": "BuildingLink/sentry",
"id": "595e330cd9065d5305dab2635bd78e59e622edd1",
"size": ... |
"""Unittests for builder_status_lib."""
from __future__ import print_function
import sys
from chromite.lib import builder_status_lib
from chromite.lib import cidb
from chromite.lib import constants
from chromite.lib import cros_test_lib
from chromite.lib import fake_cidb
from chromite.lib import failure_message_lib
... | {
"content_hash": "2630f3ac26b737e3463e3052d6e280ec",
"timestamp": "",
"source": "github",
"line_count": 145,
"max_line_length": 79,
"avg_line_length": 38.5448275862069,
"alnum_prop": 0.7160493827160493,
"repo_name": "endlessm/chromium-browser",
"id": "a58840140aaeb7650a85b6891c392115f1a8adb9",
"siz... |
import MotionParticlesFLE as mp
gen_dot = mp.generate_dot
import numpy as np
import os
from default_param import *
image = {}
experiment = 'FLE'
do_sim = False
do_sim = True
for stimulus_tag, im_arg in zip(stim_labels, stim_args):
# generating the movie
image[stimulus_tag] = {}
image[stimulus_tag]['args'] ... | {
"content_hash": "deac491119b8ce646164fc549f95e512",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 123,
"avg_line_length": 47.82857142857143,
"alnum_prop": 0.5669056152927121,
"repo_name": "laurentperrinet/Khoei_2017_PLoSCB",
"id": "9ce9d321064b9af4f8dc36183b809cefb753907b... |
"""
A class for expressing and modifying the cost field
associated with your alqr planner.
It prescribes how much you care about getting to the
goal state, avoiding obstacles, keeping within actuator
constraints, avoiding excessive effort etc...
The state space must be ordered as:
[position_1, position_2, ..., positi... | {
"content_hash": "e8ab80b44da685ac91cc6fd701094d50",
"timestamp": "",
"source": "github",
"line_count": 254,
"max_line_length": 106,
"avg_line_length": 33.75196850393701,
"alnum_prop": 0.6978887204012598,
"repo_name": "jnez71/aLQR",
"id": "264ff39642ee2e82decdf37bb6c05b8fce01c266",
"size": "8573",
... |
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import six
from pants.build_graph.address import Addresses
class FromTarget(object):
"""Used in a BUILD file to redirect the value of the sources= attribute to an... | {
"content_hash": "870c6b85f996e2336d497a343b4757e2",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 93,
"avg_line_length": 36.666666666666664,
"alnum_prop": 0.6747474747474748,
"repo_name": "megaserg/pants",
"id": "fa27880e2a726f27104931c496c4d5a5443334d3",
"size": "1137"... |
import pytest
import numpy as np
from pathlib import Path
from qutip.qip.qasm import read_qasm, circuit_to_qasm_str
from qutip.qip.circuit import Measurement, QubitCircuit
from qutip import tensor, rand_ket, basis, rand_dm, identity
from qutip.qip.operations.gates import cnot, ry
@pytest.mark.parametrize(["filename"... | {
"content_hash": "9bf0c1df25960355adeed4f1b282e592",
"timestamp": "",
"source": "github",
"line_count": 132,
"max_line_length": 80,
"avg_line_length": 39.74242424242424,
"alnum_prop": 0.6387723980175372,
"repo_name": "qutip/qutip",
"id": "caef7a3e8d9adcda4258cb26bc5260a6fab5dab0",
"size": "5246",
... |
import sys
prevUser = None
nTotal = 0
for line in sys.stdin:
currentUser = line
if (prevUser != currentUser):
nTotal += 1
prevUser = currentUser
print '%d' % (nTotal) | {
"content_hash": "5d4cca8c17d7a4453af0dd4e3d632a82",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 33,
"avg_line_length": 16.666666666666668,
"alnum_prop": 0.595,
"repo_name": "jatinmistry13/PrimitiveRecommenderSystem",
"id": "aeccb7bfc908d276a528136a60d2c7917997bb77",
"... |
import unittest
import os
from test.aiml_tests.client import TestClient
from programy.config.brain import BrainFileConfiguration
class UtiltyTestClient(TestClient):
def __init__(self):
TestClient.__init__(self)
def load_configuration(self, arguments):
super(UtiltyTestClient, self).load_confi... | {
"content_hash": "fbd5833331b0152773a0137d5ac3a808",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 116,
"avg_line_length": 34.666666666666664,
"alnum_prop": 0.7307692307692307,
"repo_name": "dkamotsky/program-y",
"id": "83359e744c69b7644027f5a12a8f5a03e128632a",
"size": ... |
server = {
'port': 7090,
'host': '0.0.0.0'
}
# Pecan Application Configurations
# See https://pecan.readthedocs.org/en/latest/configuration.html#application-configuration # noqa
app = {
'root': 'bm_instance_agent.api.controllers.root.RootController',
'modules': ['bm_instance_agent.api'],
'debug': F... | {
"content_hash": "a089f3ecc6953d5acc919b63d10a2b23",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 97,
"avg_line_length": 27.25,
"alnum_prop": 0.6758409785932722,
"repo_name": "zstackorg/zstack-utility",
"id": "9bc853e948d1fe9b1f1ded3da3379f80fc77ffa1",
"size": "453",
... |
"""
Contains basic interface (abstract base class) for word embeddings.
"""
import os
from abc import ABCMeta, abstractmethod
class IWordEmbedding(object):
"""
Abstract base class for word embeddings
"""
__metaclass__ = ABCMeta
def __init__(self, path, vector_length):
self.model = None
... | {
"content_hash": "e71d3786f6a41b6f300c3cc324185c64",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 100,
"avg_line_length": 31.71698113207547,
"alnum_prop": 0.6067816775728733,
"repo_name": "mikolajsacha/tweetsclassification",
"id": "7f8f6a7f28d8b06830ecdb7ea64f4bc472c4bc8e... |
from hgwebcommit.actions import FunctionAction, manager
def action(name, label, params=None):
def _wrap(func):
obj = FunctionAction(name, label, func, params)
manager.add(obj)
return func
return _wrap
| {
"content_hash": "75397d8454215af937a38de788c012e4",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 55,
"avg_line_length": 29.25,
"alnum_prop": 0.6709401709401709,
"repo_name": "tokibito/flask-hgwebcommit",
"id": "357751de098977d7973476f0d404b65ca3adeb16",
"size": "234",
... |
import sys
from nltk.corpus.reader import util
from nltk.corpus.reader.api import *
from nltk.corpus.reader.util import *
class ChasenCorpusReader(CorpusReader):
def __init__(self, root, fileids, encoding="utf8", sent_splitter=None):
self._sent_splitter = sent_splitter
CorpusReader.__init__(self,... | {
"content_hash": "9e88aeefbcad9b2b137b023d6afcebf5",
"timestamp": "",
"source": "github",
"line_count": 152,
"max_line_length": 88,
"avg_line_length": 28.80921052631579,
"alnum_prop": 0.517698104590089,
"repo_name": "nltk/nltk",
"id": "c5b2c8cc7f9e5ed4c3b7a23e31e5f897849afa97",
"size": "4541",
"b... |
from yambopy.tools.duck import isstring
import yamboparser
class YamboFile(yamboparser.YamboFile):
"""
Wrapper around the Yambofile class of yamboparser
"""
def from_dict(filename):
"""
intialize from a dicitonary
"""
pass
def from_file(filename):
... | {
"content_hash": "5653e5d8cabe5d888936b095f952c56a",
"timestamp": "",
"source": "github",
"line_count": 63,
"max_line_length": 69,
"avg_line_length": 24.047619047619047,
"alnum_prop": 0.5801980198019802,
"repo_name": "alexmoratalla/yambopy",
"id": "88da78e1c55a3a5ade5eb4c415d5f6fdb8e710ec",
"size":... |
"""Generators
It's head-exploding time!
We recently wrote a function that, given lines
with dates and measurements, splits them up,
makes sure they only move forward, and prints them
out.
Printing is nice, but not impressively useful or
exciting. We want to _transform_ this data
(eventually into a chart), not just o... | {
"content_hash": "9e5187f2b2e8d0aab7faceb8131ef83b",
"timestamp": "",
"source": "github",
"line_count": 82,
"max_line_length": 70,
"avg_line_length": 29.71951219512195,
"alnum_prop": 0.6918342224045958,
"repo_name": "shiblon/pytour",
"id": "d3dac9fdc0a9728b0b4946443fc4c1495d2f36a1",
"size": "2450",... |
from rest_framework import serializers
from biz.idc.models import DataCenter, UserDataCenter
class DataCenterSerializer(serializers.ModelSerializer):
class Meta:
model = DataCenter
class UserDataCenterSerializer(serializers.ModelSerializer):
class Meta:
model = UserDataCenter
class Deta... | {
"content_hash": "054becb1376bbc1624fd1ea94dab1b55",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 79,
"avg_line_length": 23.458333333333332,
"alnum_prop": 0.7442273534635879,
"repo_name": "zhanghui9700/eonboard",
"id": "eb8ea10a7768eb5af09597e78dec9c5942a29e31",
"size":... |
#!/usr/bin/env python
# coding=utf-8
# by BinSys <binsys@163.com>
# 支持 mtouch mtouch-64 mtouch.exe mandroid.exe 解包
# Readme
# 1. 将插件文件 MKBundleManager.py 放入 IDA Pro 的 plugins 目录
# 2. 用IDA打开待分析文件,等待分析完毕(左下角状态栏的 AU: idel)
# 3. IDA 菜单栏 点击 View -> Open subviews -> Bundled Assembly Manager
# 4. 在 Bundled Asse... | {
"content_hash": "0bc3e2701260f7e8c73e99172defa906",
"timestamp": "",
"source": "github",
"line_count": 1003,
"max_line_length": 182,
"avg_line_length": 27.60319042871386,
"alnum_prop": 0.6403236292711117,
"repo_name": "azraelrabbit/MKBundleManager",
"id": "7e6182e6158141294696eff66cf5bf287faa6a09",
... |
from shared_schema_tenants.settings import get_setting
from shared_schema_tenants.helpers.tenant_json_field import TenantJSONFieldHelper
class TenantExtraDataHelper(TenantJSONFieldHelper):
def __init__(self, instance=None):
super(TenantExtraDataHelper, self).__init__(
instance_field_name='ex... | {
"content_hash": "4ef7a03bb3790f3c65107ecd0dc45546",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 82,
"avg_line_length": 42.333333333333336,
"alnum_prop": 0.7322834645669292,
"repo_name": "hugobessa/django-shared-schema-tenants",
"id": "3da3330e311ac31177bb1a6104f2141a7e3... |
from PyQt4 import QtCore, QtGui
class SqChatWidget(QtGui.QWidget):
def __init__(self, parent=None):
super(SqChatWidget, self).__init__(parent)
self.sendBtn = QtGui.QPushButton('Send', self)
self.sendBtn.resize(self.sendBtn.sizeHint())
self.settingsBtn = QtGui.QPushButton('Settings... | {
"content_hash": "5fe18caf8f7e68903b34cac66db7d2b7",
"timestamp": "",
"source": "github",
"line_count": 70,
"max_line_length": 72,
"avg_line_length": 28.214285714285715,
"alnum_prop": 0.6131645569620253,
"repo_name": "destinmoulton/squabble",
"id": "f5cada3dbb26aa00433e5b96bcfd8f9c76a011f1",
"size"... |
import struct
from yabgp.message.attribute import Attribute
from yabgp.message.attribute import AttributeID
from yabgp.message.attribute import AttributeFlag
from yabgp.common import exception as excep
from yabgp.common import constants as bgp_cons
class Community(Attribute):
"""
COMMUNITIES path attribu... | {
"content_hash": "f98099cc5e6ad12b295577d1804c8e05",
"timestamp": "",
"source": "github",
"line_count": 65,
"max_line_length": 97,
"avg_line_length": 38.50769230769231,
"alnum_prop": 0.5813024370755094,
"repo_name": "abn/yabgp",
"id": "14ca60ac0ce6af5d8eac00866f122a00c8993aed",
"size": "3135",
"b... |
from django.contrib import admin
from django.contrib.auth.admin import UserAdmin
from django.utils.translation import gettext_lazy as _
from .models import User, CocRecord
from .forms import AdminUserChangeForm, UserCreationForm
@admin.register(User)
class UserAdmin(UserAdmin):
fieldsets = (
(
... | {
"content_hash": "1ac445169ed999eaf799a79a40da83c6",
"timestamp": "",
"source": "github",
"line_count": 69,
"max_line_length": 72,
"avg_line_length": 26.26086956521739,
"alnum_prop": 0.46467991169977924,
"repo_name": "pycontw/pycontw2016",
"id": "e663a2b0cd271900b74288f59813be52fb0fb908",
"size": "... |
import os
import json
import numpy as np
from pprint import pprint
from sys import argv
#args : SUBJECT_DIR, ${overlapFlag}, JSONTABLE filename, number_ROIS
subject_dir = argv[1]
overlapName = argv[2]
jsonFile = argv[3]
nb_ROIS = argv[4]
DIR_Surfaces = os.path.join(subject_dir, 'OutputSurfaces' + overlapName, 'lab... | {
"content_hash": "e9800a5ae5aaf42f1959cc15209d6886",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 89,
"avg_line_length": 25.53061224489796,
"alnum_prop": 0.6514788169464428,
"repo_name": "NIRALUser/CIVILITY",
"id": "c6a4bd147f31748a3e3b565f174b1b95b44391d7",
"size": "12... |
import importlib
import os
from pathlib import Path
import pytest
def test_testing_dbs(tmp_path_factory: pytest.TempPathFactory):
tmp_path = tmp_path_factory.mktemp("data")
cwd = os.getcwd()
os.chdir(tmp_path)
test_db = Path("./test.db")
if test_db.is_file(): # pragma: nocover
test_db.un... | {
"content_hash": "781c8fb132e4e5a40cce650199848da1",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 87,
"avg_line_length": 30,
"alnum_prop": 0.6826086956521739,
"repo_name": "tiangolo/fastapi",
"id": "6f667dea03ce191393602b07ed5049d53619f66e",
"size": "690",
"binary": f... |
"""Switch between depending on pyglib.app or an OSS replacement."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
# pylint: disable=g-import-not-at-top
# pylint: disable=wildcard-import
from . import control_imports
if control_imports.USE_OSS and control_i... | {
"content_hash": "3d2bc40bd7763e9d7448732592ec7130",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 77,
"avg_line_length": 37.733333333333334,
"alnum_prop": 0.773851590106007,
"repo_name": "RyanYoung25/tensorflow",
"id": "4bc45464b5d4176a0c219c89531e3bc2e59d3bba",
"size":... |
'''
This modules provides a method to parse an ISO 8601:2004 date string to a
python datetime.date instance.
It supports all basic, extended and expanded formats as described in the ISO
standard. The only limitations it has, are given by the Python datetime.date
implementation, which does not support dates before 0001... | {
"content_hash": "2246d71062a2d5b22891f1526f1e1eb0",
"timestamp": "",
"source": "github",
"line_count": 175,
"max_line_length": 79,
"avg_line_length": 49.24,
"alnum_prop": 0.5326679818962516,
"repo_name": "unor/schemaorg",
"id": "8bafa207fcab1076cf40c02fef08e694eea57be3",
"size": "10165",
"binary... |
import sys
import logging
import copy
from urllib2 import URLError
from httplib import HTTPException
from Bio import Entrez
RESULTS_FILE = 'dois-1000-per-line.txt'
LOG_FORMAT = '%(asctime)-15s %(message)s'
logging.basicConfig(level=logging.DEBUG, format=LOG_FORMAT)
log = logging.getLogger(__name__)
def fail(msg, o... | {
"content_hash": "6b8e984b99a30d4d56bb1ef95c2baeb4",
"timestamp": "",
"source": "github",
"line_count": 162,
"max_line_length": 142,
"avg_line_length": 32.93827160493827,
"alnum_prop": 0.5970764617691154,
"repo_name": "emanuil-tolev/wellcome-outputs-from-ncbi",
"id": "8b00781102d83a379694f06e717261ef... |
ACCESS_TOKEN_URL = 'https://auth.aweber.com/1.0/oauth/access_token'
API_BASE = 'https://api.aweber.com/1.0'
AUTHORIZE_URL = 'https://auth.aweber.com/1.0/oauth/authorize'
REQUEST_TOKEN_URL = 'https://auth.aweber.com/1.0/oauth/request_token'
class APIException(Exception):
"""APIExceptions."""
class AWeberBase(obj... | {
"content_hash": "59c292ee12987203c8f3d71de915ea6f",
"timestamp": "",
"source": "github",
"line_count": 88,
"max_line_length": 71,
"avg_line_length": 31.295454545454547,
"alnum_prop": 0.5566448801742919,
"repo_name": "aweber/AWeber-API-Python-Library",
"id": "799f1ba46e826e2c791fc9b2710a19923c7c12fb"... |
"""Schemas for BigQuery tables / queries."""
class SchemaField(object):
"""Describe a single field within a table schema.
Args:
name (str): the name of the field.
field_type (str): the type of the field. See
https://cloud.google.com/bigquery/docs/reference/rest/v2/tables#schema.f... | {
"content_hash": "c1fce4d3aea533e556b5cdaf74e23b77",
"timestamp": "",
"source": "github",
"line_count": 185,
"max_line_length": 94,
"avg_line_length": 30.405405405405407,
"alnum_prop": 0.5767111111111111,
"repo_name": "jonparrott/google-cloud-python",
"id": "759d7c3cbe6530f1ebf383fd595108c05ba117d3",... |
from django.contrib.auth import get_user_model
from django.test import override_settings
from django.urls import reverse
from django.utils import encoding
from example.tests import TestBase
class ModelViewSetTests(TestBase):
"""
Test usage with ModelViewSets, also tests pluralization, camelization,
and u... | {
"content_hash": "b9def88b3cdeaa6436391715381ffc9c",
"timestamp": "",
"source": "github",
"line_count": 217,
"max_line_length": 92,
"avg_line_length": 34.345622119815665,
"alnum_prop": 0.48450288474439823,
"repo_name": "leo-naeka/django-rest-framework-json-api",
"id": "21a641f8b8474df25aa53c757f87694... |
"""
babushka
~~~~~~~~
Russian Doll Caching for Jinja2 & NDB on GAE.
:license: MIT License, see LICENSE for more details.
:documentation: See README.md for documentation.
"""
from google.appengine.api import memcache
from jinja2 import nodes
from jinja2.ext import Extension
import hashlib
# --... | {
"content_hash": "fed8340469a57cb79f647fbe901ddac7",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 95,
"avg_line_length": 27.603448275862068,
"alnum_prop": 0.5665209244222361,
"repo_name": "ozburo/babushka",
"id": "c3e48ef360d9297f9c8a13aa7352ba2fd6addf4c",
"size": "1625... |
from typing import Dict
import datetime
import json
import uuid
from flask import Flask, jsonify, request
from ambassador.utils import parse_yaml
class FakeScoutApp (Flask):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.counts: Dict[str, int] = {}
app = FakeScout... | {
"content_hash": "ff10dec6b85480977772693cda5b5bde",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 82,
"avg_line_length": 21.79310344827586,
"alnum_prop": 0.6052215189873418,
"repo_name": "datawire/ambassador",
"id": "e3ca2ec1f4c3c7a4c331001ccc3238b8e084fb3a",
"size": "1... |
"""
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this ... | {
"content_hash": "51c41aab0f1d12ed47585b95fae5ff0a",
"timestamp": "",
"source": "github",
"line_count": 136,
"max_line_length": 131,
"avg_line_length": 31.75,
"alnum_prop": 0.6956924502084298,
"repo_name": "alexryndin/ambari",
"id": "2379dd3015baa17499b9d705f5512b4787672f05",
"size": "4340",
"bin... |
"""Correctness tests for tf.keras using DistributionStrategy."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import functools
from absl.testing import parameterized
import numpy as np
import six
from tensorflow.python import keras
from tensorflow.python.... | {
"content_hash": "c99d80fd03f6d54939bd3943ba4094cf",
"timestamp": "",
"source": "github",
"line_count": 622,
"max_line_length": 105,
"avg_line_length": 35.28456591639871,
"alnum_prop": 0.647104387843441,
"repo_name": "adit-chandra/tensorflow",
"id": "097a550dd20ec79fa06665084a49abd974cd0082",
"size... |
import mock
import pytest
import time
from collections import OrderedDict
from django.utils import timezone
from addons.osfstorage import settings as osfstorage_settings
from api_tests.utils import create_test_file
from framework.auth import Auth
from osf.management.commands.update_institution_project_counts import ... | {
"content_hash": "3b8211b6dbee9f847a702db15fc2463b",
"timestamp": "",
"source": "github",
"line_count": 454,
"max_line_length": 167,
"avg_line_length": 39.36784140969163,
"alnum_prop": 0.6543389470150507,
"repo_name": "brianjgeiger/osf.io",
"id": "5589d03ad26f268bc3f8d398dbbf82b7031bf304",
"size": ... |
from test.base_test_case import BaseTestCase
import os
class TestParseConfigs(BaseTestCase):
def test_folders_exists(self):
self.assertTrue(os.path.exists(self.packager_config.root))
self.assertTrue(os.path.isdir(self.packager_config.root))
self.assertTrue(os.path.exists(self.packager_co... | {
"content_hash": "d467acbeeb9c6d29bd0e4c157024858e",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 79,
"avg_line_length": 41.642857142857146,
"alnum_prop": 0.7272727272727273,
"repo_name": "nma/coding-pytest-extension",
"id": "e880e73bf0aff61788a9d79903b7ed0ce07ab628",
"... |
from requests import Session, Request
from ..models import Person
class PeopleSvc(object):
"""
Class that wraps the SWAPI /person endpoint
"""
def __init__(self):
self.history = []
self.base_url = 'https://swapi.co/api/people'
self.session = Session()
def get_person(self... | {
"content_hash": "bb10567d6c09a76e7dfb3679cae75aad",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 94,
"avg_line_length": 29.862068965517242,
"alnum_prop": 0.6120092378752887,
"repo_name": "j4ramos/swapi_example",
"id": "26c75ca393f7d924b3fdbcf1a311d62307c0f5ce",
"size":... |
from __future__ import absolute_import
import functools
import mock
from django.template.loader import render_to_string
from exam import fixture
from sentry.interfaces.base import InterfaceValidationError
from sentry.interfaces.stacktrace import (
Frame, Stacktrace, get_context, slim_frame_data
)
from sentry.mod... | {
"content_hash": "d0a281048cbc39dd000a6fa6be340096",
"timestamp": "",
"source": "github",
"line_count": 665,
"max_line_length": 168,
"avg_line_length": 35.2796992481203,
"alnum_prop": 0.5407271642299987,
"repo_name": "BuildingLink/sentry",
"id": "30f09923937c45b1a16f3f1b4a1d74bde53c2c3f",
"size": "... |
SPECIALIZATIONS = [(2, 2, 2),
(2, 2, 3),
(2, 2, 4),
(2, 2, "Eigen::Dynamic"),
(2, 3, 3),
(2, 3, 4),
(2, 3, 9),
(2, 3, "Eigen::Dynamic"),
(2, 4, 3),
(... | {
"content_hash": "a8fb805f979bbfdc9ba7aab43d81f0fc",
"timestamp": "",
"source": "github",
"line_count": 179,
"max_line_length": 84,
"avg_line_length": 34.1731843575419,
"alnum_prop": 0.5993133889161354,
"repo_name": "ikoruk/ceres-solver",
"id": "a352d29203b535ad8010d6d73e8ec53f7285d7b3",
"size": "8... |
from unittest import TestCase
import plotly.graph_objs as go
import pytest
class TestGraphObjConstructor(TestCase):
def test_kwarg(self):
m = go.scatter.Marker(color="green")
self.assertEqual(m.to_plotly_json(), {"color": "green"})
def test_valid_arg_dict(self):
m = go.scatter.Marker(... | {
"content_hash": "018df39d767a5e27eaa43114df8f7dbd",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 86,
"avg_line_length": 33.422222222222224,
"alnum_prop": 0.613031914893617,
"repo_name": "plotly/python-api",
"id": "09fa78857b8bc3cfed5872cbdf2b42c059c3cd1b",
"size": "150... |
"""
CNI implementation
Demultiplexes on the CNI_COMMAND and runs the necessary operation
"""
import argparse
import inspect
import json
import logging
import os
import sys
# set parent directory in sys.path
cfile = os.path.abspath(inspect.getfile(inspect.currentframe())) # nopep8
sys.path.append(os.path.dirname(os.p... | {
"content_hash": "1e681f6224a0fb6a810354986a57610f",
"timestamp": "",
"source": "github",
"line_count": 269,
"max_line_length": 79,
"avg_line_length": 37.174721189591075,
"alnum_prop": 0.5998,
"repo_name": "rombie/contrail-controller",
"id": "ebb44668caa592222695c9b6242d7d6546aa2959",
"size": "1011... |
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('userprofile', '0009_merge_20180623_1742'),
]
operations = [
migrations.RemoveField(
model_name='profile',
name='auto_duty',
),
migrations.RemoveField(
... | {
"content_hash": "0be2de87865292b8fafa6b4e74efc6e7",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 52,
"avg_line_length": 21,
"alnum_prop": 0.5238095238095238,
"repo_name": "hackerspace-ntnu/website",
"id": "b3267ed400cf7ddb58c35e8fef6689afd2f6b1a5",
"size": "512",
"bi... |
""" smashlib.patches
"""
from smashlib.patches.base import Patch
from smashlib.patches.cd import PatchCDMagic
from smashlib.patches.pushd import PatchPushdMagic
__all__ = [
Patch.__name__,
PatchCDMagic.__name__,
PatchPushdMagic.__name__,
]
| {
"content_hash": "fc0688f69f890763f2edc3825719d790",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 50,
"avg_line_length": 25.2,
"alnum_prop": 0.7142857142857143,
"repo_name": "mattvonrocketstein/smash",
"id": "765becf28baeaf614af252a3ffd483d0b0b83ddb",
"size": "252",
"... |
import errno
import os
import resource
import time
import signal
def daemonize():
try:
pid = os.fork()
except OSError as e:
raise e
if pid == 0:
os.setsid()
try:
pid = os.fork()
except OSError as e:
raise e
if pid == 0:
... | {
"content_hash": "583e5f7b32fcbb0396ebdba919e39ae7",
"timestamp": "",
"source": "github",
"line_count": 139,
"max_line_length": 69,
"avg_line_length": 25.575539568345324,
"alnum_prop": 0.5085794655414908,
"repo_name": "letconex/MMT",
"id": "8bdd68e31dac9185e597c7df55e59e19f744d1cb",
"size": "3555",... |
import os
import sys
import pbr.version
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
sys.path.insert(0, os.path.abspath(os.pa... | {
"content_hash": "20673bda3abbd6fc370a4cf4e7b5f0d9",
"timestamp": "",
"source": "github",
"line_count": 251,
"max_line_length": 88,
"avg_line_length": 31.83266932270916,
"alnum_prop": 0.700250312891114,
"repo_name": "citrix-openstack-build/python-openstackclient",
"id": "47025b6daa59f500ded9a536e3f52... |
"""
Assessments
This module currently contains 2 types of Assessments
* Flexible Impact Assessments (including Mobile access)
* Rapid Assessment Tool (from ECB: http://www.ecbproject.org/page/48)
@ToDo: Migrate this to a Template in the Survey module
@ToDo Validation similar to si... | {
"content_hash": "f74193ca442c8c7d67c34c6a2bc669b6",
"timestamp": "",
"source": "github",
"line_count": 2561,
"max_line_length": 246,
"avg_line_length": 52.06286606794221,
"alnum_prop": 0.4424861062152655,
"repo_name": "sammyshj/gci",
"id": "c91b18c3f6b69b149a432134756b971c620a02ce",
"size": "13335... |
"""
tipfy.auth.facebook
~~~~~~~~~~~~~~~~~~~
Implementation of Facebook authentication scheme.
Ported from `tornado.auth`_.
:copyright: 2009 Facebook.
:copyright: 2011 tipfy.org.
:license: Apache License Version 2.0, see LICENSE.txt for more details.
"""
from __future__ import absolute_imp... | {
"content_hash": "c2e18cab65eb8d45a231d1b0c2f45eed",
"timestamp": "",
"source": "github",
"line_count": 249,
"max_line_length": 83,
"avg_line_length": 36.04016064257028,
"alnum_prop": 0.5853577000222866,
"repo_name": "moraes/tipfy",
"id": "5363cf9bff5736f166fbf33bb640790859e42553",
"size": "8998",
... |
from __future__ import absolute_import
from celery import Celery
import os
os.environ.setdefault('CELERY_CONFIG_MODULE', 'thehonestgenepipeline.celeryconfig')
celery = Celery('thehonestgenepipeline',
include=['thehonestgenepipeline.imputation','thehonestgenepipeline.ancestry','thehonestgenepipeline.riskprediction'... | {
"content_hash": "8b09e862774f4e0c3e1d9987bc08f03f",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 121,
"avg_line_length": 26.5625,
"alnum_prop": 0.7670588235294118,
"repo_name": "TheHonestGene/thehonestgene-pipeline",
"id": "a04fc2cf7baab39344a479e4e06c2b2ac1720862",
"s... |
try:
import unittest2 as unittest
except ImportError:
import unittest # noqa
from cassandra.protocol import ProtocolHandler, ResultMessage, UUIDType, read_int, EventMessage
from cassandra.query import tuple_factory
from cassandra.cluster import Cluster
from tests.integration import use_singledc, PROTOCOL_VERS... | {
"content_hash": "a7d768bbd71e0f5f050a86f0b07fc8e0",
"timestamp": "",
"source": "github",
"line_count": 167,
"max_line_length": 133,
"avg_line_length": 40.11377245508982,
"alnum_prop": 0.6948798328108673,
"repo_name": "thobbs/python-driver",
"id": "c6818f7f4bbfa41cb3054cd8dd470bc13f9eb370",
"size":... |
from fabric.api import local
def css():
local('cp -r vendor/markdown-core/dist/css dist/')
local('cp -r vendor/markdown-core/dist/fonts dist/')
local('curl https://cdn.jsdelivr.net/jquery.ui/1.11.4/jquery-ui.min.css > dist/css/markdown-plus.css')
local('curl https://cdn.jsdelivr.net/jquery.layout/1.4.... | {
"content_hash": "bc08cbb721f68a1e6cfc79c2dd10dceb",
"timestamp": "",
"source": "github",
"line_count": 57,
"max_line_length": 119,
"avg_line_length": 56.64912280701754,
"alnum_prop": 0.6763703933106224,
"repo_name": "bnuzet/markpurcha",
"id": "a474fbee5ffcb61ac65bc1388588a71b0adb7d62",
"size": "32... |
"""Zgres config file"""
import os
import sys
import logging
import configparser
class StdOutFilter(logging.Filter):
def filter(self, record):
return record.levelno < logging.WARNING
def add_config_file(parser, config_file):
parser.add_argument('-c', '--config',
dest='config',
... | {
"content_hash": "524cf5152f98d8bc361c9850614f76f2",
"timestamp": "",
"source": "github",
"line_count": 72,
"max_line_length": 172,
"avg_line_length": 34.333333333333336,
"alnum_prop": 0.6383495145631068,
"repo_name": "jinty/zgres",
"id": "789a75529c1e59ebb80017122a97681240ce1fbc",
"size": "2472",
... |
"""
===============================
Compute and visualize ERDS maps
===============================
This example calculates and displays ERDS maps of event-related EEG data. ERDS
(sometimes also written as ERD/ERS) is short for event-related
desynchronization (ERD) and event-related synchronization (ERS) [1]_.
Concept... | {
"content_hash": "842be34dfe2570c668180137d14adeec",
"timestamp": "",
"source": "github",
"line_count": 139,
"max_line_length": 90,
"avg_line_length": 44.94964028776978,
"alnum_prop": 0.6381241997439181,
"repo_name": "teonlamont/mne-python",
"id": "aff930fd9a9b444d188974d28c5d7840dfedb09c",
"size":... |
"""
Accuracy on MNIST dataset: 94,39 %
"""
import os, sys
from scythe.core import *
from scythe.MNIST import *
import matplotlib.pyplot as plt
def main():
if len(sys.argv) < 2:
print("Please provide the path to the MNIST dataset as first argument")
return
mnist_folder = sys.argv[1]
n_f... | {
"content_hash": "fcbe3fa996de91d6a764bbb71edf94e4",
"timestamp": "",
"source": "github",
"line_count": 66,
"max_line_length": 86,
"avg_line_length": 28.606060606060606,
"alnum_prop": 0.6573093220338984,
"repo_name": "AntoinePassemiers/Scythe",
"id": "088ae8e88e16cb3dbd5e17998a6cbce9a816cbc4",
"siz... |
"""
The MIT License (MIT)
Copyright (c) 2014 Moritz Wundke
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": "6b836f6ef6369b9d6bf9a07eed0f205e",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 78,
"avg_line_length": 37.108108108108105,
"alnum_prop": 0.7749453750910416,
"repo_name": "moritz-wundke/SimpleTelemetryProvider",
"id": "9379dbd3611bf9f0e6cc08c71bfa97eb59cb... |
import glob
from redbaron import RedBaron
help_dict = {
'--model-dir': 'Location to write checkpoints and summaries to. Must be a GCS URI when using Cloud TPU.',
'--max-steps': 'The total number of steps to train the model.',
'--use-tpu': 'Whether to use TPU.',
'--tpu': 'The name or GRPC URL of the T... | {
"content_hash": "a07e1775cd20f18e6a79597c3e3099de",
"timestamp": "",
"source": "github",
"line_count": 65,
"max_line_length": 122,
"avg_line_length": 37.03076923076923,
"alnum_prop": 0.6028250934773577,
"repo_name": "GoogleCloudPlatform/cloudml-samples",
"id": "d98aee786dad4188a0125750eed34313579ca9... |
DOCUMENTATION = '''
---
module: compatibility
short_description: Verifies whether a given kraken config file contains any
known incompatibilities. This module assumes the config has already passed
jsonschema validation.
'''
EXAMPLES = '''
- name: Load configuration file
include_vars:
file: "{{ config_filename ... | {
"content_hash": "27cb127f64b79d7a3309055def9ecd76",
"timestamp": "",
"source": "github",
"line_count": 166,
"max_line_length": 82,
"avg_line_length": 33.63855421686747,
"alnum_prop": 0.6223137535816619,
"repo_name": "samsung-cnct/kraken-lib",
"id": "b2d941ced65e8bfbcaedcd63cdf7aa166a35287f",
"size... |
import datetime
from django.core.urlresolvers import reverse
from django.db import models
from django.conf import settings
from django.contrib.auth.models import User
from django.utils import timezone
from uuslug import slugify
import thread
class PostQuerySet(models.QuerySet):
def published(self):
... | {
"content_hash": "c59176556289f83ce4f18c95a9fdaa9d",
"timestamp": "",
"source": "github",
"line_count": 135,
"max_line_length": 121,
"avg_line_length": 33.34074074074074,
"alnum_prop": 0.5794267940457676,
"repo_name": "zouyapeng/Homepage",
"id": "831e5c4c76003a979079a655e88ee27e1e99e018",
"size": "... |
import time
import sqlite3 as lite
from tmp102 import tmp102_read_temperature
#location of the data base
location = '../db.sqlite3'
CURRENT_DAY_TABLE = 'current_day'
#LAST_WEEK_TABLE = 'last_week'
#HISTORY_TABLE_NAME = 'history'
#so we assume we have created these two tables manualy
'''
To create tables enter the S... | {
"content_hash": "c9cda87c7fef7ac0ce8f08fdcb18a445",
"timestamp": "",
"source": "github",
"line_count": 51,
"max_line_length": 87,
"avg_line_length": 28.764705882352942,
"alnum_prop": 0.6802999318336742,
"repo_name": "AngelTsanev/pacemPI",
"id": "cd53ef1dd53105a9815d253508a0f9577ecbb00e",
"size": "... |
import re
class CommandError(Exception):
pass
class BaseCommand():
"""
Base command, this will accept and handle some generic features of all commands.
Like error handling, argument retrieving / checking
"""
def __init__(self, args):
"""
Initialize the class
"""
... | {
"content_hash": "b51b81fa667abefdfaec95c0dd45522c",
"timestamp": "",
"source": "github",
"line_count": 70,
"max_line_length": 84,
"avg_line_length": 22.87142857142857,
"alnum_prop": 0.4928169893816365,
"repo_name": "snelis/snelis",
"id": "ab5273d654a3923ccb0b1bcda1dd62d46392a4ae",
"size": "1601",
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.