text stringlengths 4 1.02M | meta dict |
|---|---|
import os
from unittest import TestCase
from ..database import delete_database, create_session, cleanup_database
from ..database.exceptions import ObjectAlreadyExists, ObjectNotFound
from ..database.exceptions import NonMatchingTaxonomyIds
from ..database.models import Protein, Interaction, Psimi, Pubmed
from ..databa... | {
"content_hash": "84098df57b5272f741c47ace7529090d",
"timestamp": "",
"source": "github",
"line_count": 724,
"max_line_length": 76,
"avg_line_length": 34.180939226519335,
"alnum_prop": 0.6486442801147614,
"repo_name": "daniaki/pyPPI",
"id": "d4b66224cf07cb44909b833f2a5f0778b510597a",
"size": "24747... |
"""
raven.contrib.celery
~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010-2012 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import
import logging
from celery.exceptions import SoftTimeLimitExceeded
from celery.signals import (
after_s... | {
"content_hash": "95f49f8dd8ec751506b0c6def26648f2",
"timestamp": "",
"source": "github",
"line_count": 96,
"max_line_length": 109,
"avg_line_length": 34.947916666666664,
"alnum_prop": 0.651564828614009,
"repo_name": "getsentry/raven-python",
"id": "02f3ab00e479f70a41d1657f33bf6ec199212a91",
"size"... |
import os, sys, re
import numpy as np
from PIL import Image
from scipy.signal import convolve2d
from scipy.io import loadmat
def load_cube(dataFile, dtype='float32'):
if dataFile.endswith('.tif') or dataFile.endswith('.tiff'):
return load_tiff_data(dataFile, dtype)
elif dataFile.endswith('.mat'):
... | {
"content_hash": "59bda94f708d120470415a69ad7e0136",
"timestamp": "",
"source": "github",
"line_count": 292,
"max_line_length": 93,
"avg_line_length": 34.18835616438356,
"alnum_prop": 0.5988179905839928,
"repo_name": "neurodata/macho",
"id": "6c55c883e52bceaeb27d3a12aecc8f8fd0c06b7f",
"size": "1099... |
"""Mail IPC messages"""
from Kamaelia.Community.RJL.Kamaelia.IPC.BaseIPC import IPC
# =================== Messages for sending an e-mail as a stream ====================
class MIPCNewMessageFrom(IPC):
"Start of a new e-mail message from %{from}s"
Parameters = ["fromemail"]
#Parameters:
# fromemai... | {
"content_hash": "1b76112b17c5cb28af07b3cdbd3cf0f5",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 85,
"avg_line_length": 27.392857142857142,
"alnum_prop": 0.6492829204693612,
"repo_name": "sparkslabs/kamaelia_",
"id": "3c7c335a9aba15532002c67a754d5025f9ebaa2e",
"size": ... |
from django.apps import AppConfig
class PublicInterfaceConfig(AppConfig):
name = 'public_interface'
verbose_name = 'Biological data'
| {
"content_hash": "0b99a1f3be33fd321316df34f93c5fdf",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 39,
"avg_line_length": 23.833333333333332,
"alnum_prop": 0.7552447552447552,
"repo_name": "carlosp420/VoSeq",
"id": "c9bd96791b4a2c0ff306d045cebde7273a65f97a",
"size": "143"... |
"""Reproduce an Fan state."""
import asyncio
import logging
from types import MappingProxyType
from typing import Iterable, Optional
from homeassistant.const import (
ATTR_ENTITY_ID,
SERVICE_TURN_OFF,
SERVICE_TURN_ON,
STATE_OFF,
STATE_ON,
)
from homeassistant.core import Context, State
from homeass... | {
"content_hash": "4fa7d5c6cc81744fbdcfe604bbd3ea0d",
"timestamp": "",
"source": "github",
"line_count": 100,
"max_line_length": 87,
"avg_line_length": 29.11,
"alnum_prop": 0.6465132256956372,
"repo_name": "postlund/home-assistant",
"id": "2692ac7ee5cb30e0fa83d64212368b4b967e8ee9",
"size": "2911",
... |
from __future__ import absolute_import
from numba.cuda.testing import unittest
from numba.cuda.testing import skip_on_cudasim, skip_unless_conda_cudatoolkit
from numba.findlib import find_lib
@skip_on_cudasim('Library detection unsupported in the simulator')
@skip_unless_conda_cudatoolkit
class TestLibraryDetection(... | {
"content_hash": "b1a1c58f276e8e58ac806bb42e0fc8e3",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 77,
"avg_line_length": 41.4,
"alnum_prop": 0.7101449275362319,
"repo_name": "jriehl/numba",
"id": "38e30981885d7b21d9743f1dc0b4039b074e68a3",
"size": "828",
"binary": fal... |
"""Gitlab Freak database models."""
import datetime
from flask.ext.sqlalchemy import SQLAlchemy
from sqlalchemy.sql.expression import false
db = SQLAlchemy()
class ProjectHasBoard(db.Model):
"""Describe the link between a Gitlab project and a Trello board."""
__tablename__ = 'project_board'
id = db.Co... | {
"content_hash": "1c37a5222a0f1cd18464d35684cee0f5",
"timestamp": "",
"source": "github",
"line_count": 107,
"max_line_length": 73,
"avg_line_length": 31.261682242990656,
"alnum_prop": 0.6245142002989537,
"repo_name": "Pegase745/gitlab-to-trello",
"id": "0525b6452f1d9ac3247379f51d05cacca3521b84",
"... |
"""Directives that list configuration fields asssociated with tasks or
config objects.
"""
__all__ = (
"ConfigFieldListingDirective",
"SubtaskListingDirective",
"StandaloneConfigFieldsDirective",
)
import functools
from typing import Any, Callable, Dict
from docutils import nodes
from docutils.parsers.rs... | {
"content_hash": "ad1da5c392f4ea2af01d5bc2e5214627",
"timestamp": "",
"source": "github",
"line_count": 1179,
"max_line_length": 86,
"avg_line_length": 33.76420695504665,
"alnum_prop": 0.6324859324758842,
"repo_name": "lsst-sqre/sphinxkit",
"id": "49fd31b7bc3fb9b48c6c3fce4b4565790966609a",
"size": ... |
"""Dual Imaging Spectrograph"""
| {
"content_hash": "eebdc1887a3f74de3e498be20b2e50eb",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 31,
"avg_line_length": 32,
"alnum_prop": 0.71875,
"repo_name": "r-owen/TUI",
"id": "97a106c1873a224853fa37da91b48625685a9dde",
"size": "32",
"binary": false,
"copies": "... |
import json
__author__ = 'Adam R. Smith, Michael Meisinger'
import collections
import datetime
import string
import time
import base64
import uuid
import os
import re
from types import NoneType
from copy import deepcopy
from mi.core.time_tools import timegm_to_float
DICT_LOCKING_ATTR = "__locked__"
class DotNotati... | {
"content_hash": "fc6870f87b5bc62cc6fd2b4cd0105eb7",
"timestamp": "",
"source": "github",
"line_count": 428,
"max_line_length": 108,
"avg_line_length": 32.80373831775701,
"alnum_prop": 0.622079772079772,
"repo_name": "tapanagupta/mi-instrument",
"id": "075f1b8c1ead87042fea6daec712cd4d3a3783ff",
"si... |
r"""
This module contains classes useful for analyzing ferroelectric candidates.
The Polarization class can recover the spontaneous polarization using
multiple calculations along a nonpolar to polar ferroelectric distortion.
The EnergyTrend class is useful for assessing the trend in energy across
the distortion.
See N... | {
"content_hash": "087868cf09d0c5b2c16d2090e0af76e6",
"timestamp": "",
"source": "github",
"line_count": 506,
"max_line_length": 119,
"avg_line_length": 38.966403162055336,
"alnum_prop": 0.6225592128619972,
"repo_name": "gVallverdu/pymatgen",
"id": "6b3e47bf59623cc12722cb4dfc645b89bb07fe63",
"size":... |
"""Generate git diffs between branches suitable for Differential reviews."""
# =============================================================================
# CONTENTS
# -----------------------------------------------------------------------------
# abdt_differ
#
# Public Classes:
# NoDiffError
# ReductionTechnique... | {
"content_hash": "5beb5b35556106bddd88f3c358507e4a",
"timestamp": "",
"source": "github",
"line_count": 214,
"max_line_length": 79,
"avg_line_length": 33.14485981308411,
"alnum_prop": 0.6199069505145919,
"repo_name": "bloomberg/phabricator-tools",
"id": "688d46ef625b44e45f5e1991442c01fb9b9581fd",
"... |
'''
Local settings
- Run in Debug mode
- Use console backend for emails
- Add Django Debug Toolbar
- Add django-extensions as app
'''
from .common import * # noqa
# DEBUG
# ------------------------------------------------------------------------------
DEBUG = env.bool('DJANGO_DEBUG', default=True)
TEMPLATES[0]['OPT... | {
"content_hash": "ab0f0e91041140714b0a12054b923bd6",
"timestamp": "",
"source": "github",
"line_count": 61,
"max_line_length": 110,
"avg_line_length": 31.75409836065574,
"alnum_prop": 0.48890036138358284,
"repo_name": "ricleal/reduction_server",
"id": "d1048549aedf19aa863376f4d3067058b43c02ac",
"si... |
import logging
from flask import jsonify, request
import flask_login
from server import app
from server.util.request import form_fields_required, api_error_handler
from server.auth import user_admin_mediacloud_client, user_mediacloud_client
from server.views.topics import concatenate_query_for_solr, _parse_collection_... | {
"content_hash": "469037ebc2d2c647acbd37bad0053b2b",
"timestamp": "",
"source": "github",
"line_count": 59,
"max_line_length": 120,
"avg_line_length": 47.74576271186441,
"alnum_prop": 0.6837060702875399,
"repo_name": "mitmedialab/MediaCloud-Web-Tools",
"id": "b04daea17b5da0b110289292b70b5d0b519efd63"... |
import sys
if sys.version_info.major == 2:
from future.standard_library import install_aliases
install_aliases()
import functools
from backports.functools_lru_cache import lru_cache
functools.lru_cache = lru_cache
from .auditor import ( # noqa
AuditFailure,
audit_checker,
)
from .calculate... | {
"content_hash": "61a350bfed52ac8ff42448e53418adb2",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 55,
"avg_line_length": 27.442307692307693,
"alnum_prop": 0.6818500350385424,
"repo_name": "kidaa/encoded",
"id": "6bb149aca7b19e0471ff4a9aa25d88bfac133e8e",
"size": "1427",... |
"""Computer vision example on Transfer Learning.
This computer vision example illustrates how one could fine-tune a pre-trained
network (by default, a ResNet50 is used) using pytorch-lightning. For the sake
of this example, the 'cats and dogs dataset' (~60MB, see `DATA_URL` below) and
the proposed network (denoted by `... | {
"content_hash": "95a21104998ac3771f486542eaa6c779",
"timestamp": "",
"source": "github",
"line_count": 295,
"max_line_length": 94,
"avg_line_length": 35.84406779661017,
"alnum_prop": 0.6311707962927936,
"repo_name": "yangw1234/BigDL",
"id": "ba150ecda4f3f5e13a055662e0e0a1be3713f70c",
"size": "1192... |
import random
from oslo_config import cfg
from oslo_utils import uuidutils
from saharaclient.api import base as sahara_base
from rally.common.i18n import _
from rally.common import logging
from rally.common import utils as rutils
from rally import consts
from rally import exceptions
from rally.plugins.openstack impor... | {
"content_hash": "98bdc49baeb308534fa83d97b6124718",
"timestamp": "",
"source": "github",
"line_count": 595,
"max_line_length": 79,
"avg_line_length": 42.332773109243696,
"alnum_prop": 0.5717008099094807,
"repo_name": "gluke77/rally",
"id": "2e86a9204fd357d8a041ed405868aa4625344688",
"size": "25818... |
"""Invokes Bazel builds for the given target using Tulsi specific flags."""
import argparse
import pipes
import subprocess
import sys
from bazel_build_settings import BUILD_SETTINGS
def _FatalError(msg, exit_code=1):
"""Prints a fatal error message to stderr and exits."""
sys.stderr.write(msg)
sys.exit(exit_c... | {
"content_hash": "2a20b7f769d37d73a3e03f3b6643817a",
"timestamp": "",
"source": "github",
"line_count": 96,
"max_line_length": 80,
"avg_line_length": 34.916666666666664,
"alnum_prop": 0.6545346062052506,
"repo_name": "bazelbuild/tulsi",
"id": "6e4fba0d651ca74bfa531f370fabb42b48c60ad1",
"size": "397... |
from tabler import Tabler
| {
"content_hash": "147f001054d72304e008afa29258d32d",
"timestamp": "",
"source": "github",
"line_count": 2,
"max_line_length": 25,
"avg_line_length": 13.5,
"alnum_prop": 0.8148148148148148,
"repo_name": "bschmeck/tabler",
"id": "a4afe167fe599e873de1486cb33cdece7745d8f3",
"size": "27",
"binary": fa... |
"""This script is used to synthesize generated parts of this library."""
import synthtool as s
import synthtool.gcp as gcp
templates = gcp.CommonTemplates().java_library()
s.copy(templates, excludes=[
'README.md',
]) | {
"content_hash": "ca27be89d888679fd1369a534bb447ff",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 72,
"avg_line_length": 22.3,
"alnum_prop": 0.7354260089686099,
"repo_name": "cdapio/java-logging-logback",
"id": "c484fc4d29b76b33e0fb58a21f03ba018b3316c2",
"size": "798",
... |
from unittest import TestCase
from remote_helper.job import Job, NullJob
class JobTest(TestCase):
def setUp(self):
self.sample_events_url = 'http://url.to.some/events/endpoint'
self.a_job = Job(self.sample_events_url)
def test_is_running_right_after_creation(self):
self.assertTrue(sel... | {
"content_hash": "75fe55a5dd13c2c9f2865e25cc8d61cf",
"timestamp": "",
"source": "github",
"line_count": 109,
"max_line_length": 87,
"avg_line_length": 31.431192660550458,
"alnum_prop": 0.6558669001751314,
"repo_name": "RemoteHelper/server",
"id": "96a5fc8b6474fc247c5056cacf98e95969dcc31d",
"size": ... |
import os
import logging
from ..tools_supported import ToolsSupported
from ..generate import Generator
from . import argparse_filestring_type, argparse_string_type
help = 'Clean generated projects'
def run(args):
generator = Generator(args.file)
for project in generator.generate(args.project):
proje... | {
"content_hash": "8f175489e496a949a675db4cec86d7ae",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 142,
"avg_line_length": 38.45454545454545,
"alnum_prop": 0.7186761229314421,
"repo_name": "ohagendorf/project_generator",
"id": "826265d7256c4f4145700429555f7df315fe2c59",
... |
from __future__ import unicode_literals
from pytest import raises, fixture, fail
from bitforge.privkey import PrivateKey
from bitforge.pubkey import PublicKey
import bitforge.networks
data = {
'privkey_hex': 'd862dc70f3a40b52e9ed3567b073e32dc543f3b51c9eae8f3ac3e95a05af6b65',
'pubkey_pair': (
8323455... | {
"content_hash": "b00dc16085f0c219b9554b79288f3251",
"timestamp": "",
"source": "github",
"line_count": 118,
"max_line_length": 157,
"avg_line_length": 36.07627118644068,
"alnum_prop": 0.6866337796570354,
"repo_name": "muun/bitforge",
"id": "75b568f3ee9f7d8dc0a79d3229468085e9bf1696",
"size": "4257"... |
import json
import os
def client(*args, **kwargs):
return Client(*args, **kwargs)
class Client(object):
def __init__(self, *args, **kwargs):
super(Client, self).__init__()
def list_nodes(self, *args, **kwargs):
fixture = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'list_nod... | {
"content_hash": "d764e7af7561b4a34ea765f61f132038",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 93,
"avg_line_length": 26.5625,
"alnum_prop": 0.5929411764705882,
"repo_name": "DataDog/integrations-core",
"id": "85b72e91a0fa85d8d48ae35c181f46e977b9ab18",
"size": "540",... |
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import os
import sys
import TestSCons
if sys.platform == 'win32':
_lib = '.lib'
import SCons.Tool.MSCommon as msc
if not msc.msvc_exists():
_lib = '.a'
else:
_lib = '.a'
test = TestSCons.TestSCons()
test.write('SConstruct', """
en... | {
"content_hash": "f589d0e2c9e23029bf0db227566de4e1",
"timestamp": "",
"source": "github",
"line_count": 62,
"max_line_length": 69,
"avg_line_length": 18.93548387096774,
"alnum_prop": 0.5817717206132879,
"repo_name": "timj/scons",
"id": "aed451e3f86efff5344dd2fcbad00f74b1ed8285",
"size": "2276",
"... |
from django.core import serializers
from django.core.mail import EmailMultiAlternatives
from django.conf import settings
from django.contrib.auth import get_user_model
import json
import inspect
import string
import random
import hashlib
import os.path
import os
import shutil
import datetime
from transliterate import s... | {
"content_hash": "f59aebff6903842e41d25225dcdfb498",
"timestamp": "",
"source": "github",
"line_count": 275,
"max_line_length": 118,
"avg_line_length": 29.818181818181817,
"alnum_prop": 0.5715853658536585,
"repo_name": "EndyKaufman/django-postgres-angularjs-blog",
"id": "cf4bc70cf91276b8b662821ef32f3... |
"""Operations for generating random numbers."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.python.framework import dtypes
from tensorflow.python.framework import ops
from tensorflow.python.framework import tensor_shape
from tensorflow.p... | {
"content_hash": "31da169aeaf71397f0a2723bdafb2673",
"timestamp": "",
"source": "github",
"line_count": 213,
"max_line_length": 80,
"avg_line_length": 38.478873239436616,
"alnum_prop": 0.6664226451927769,
"repo_name": "lukas-krecan/tensorflow",
"id": "1416e4a8c14889b4ef98fede4709b8f97bd43808",
"siz... |
import argparse
from pandas import read_csv
from eval_lib import get_best_id, many2nine, doublespace2comma
def evaluate(lexsample_clasified_fpath):
names=["context_id","target","target_pos","target_position","gold_sense_ids","predict_sense_ids","golden_related","predict_related","context"]
df = read_csv(lexs... | {
"content_hash": "136215d40fc3364e79faf2c7bc4b4987",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 146,
"avg_line_length": 43.906976744186046,
"alnum_prop": 0.6721398305084746,
"repo_name": "tudarmstadt-lt/contextualization-eval",
"id": "64f85da30cb538d23772fc5995b6a424909... |
from __future__ import print_function
import argparse
import calendar
import datetime
import hashlib
import logging
import os
import shutil
import time
import psutil
import yaml
from conda_execute.conda_interface import CONDA_VERSION_MAJOR_MINOR
import conda_execute.config
from conda_execute.lock import Locked
log... | {
"content_hash": "d90d77054675c3fd7535ad5b1e61f64e",
"timestamp": "",
"source": "github",
"line_count": 295,
"max_line_length": 154,
"avg_line_length": 40.78983050847457,
"alnum_prop": 0.6134795977727915,
"repo_name": "pelson/conda-execute",
"id": "2b93217cd3b151982802be71630f21b1b0b342d1",
"size":... |
import pytest
import sys
from errata_tool.cli import main
class FakeProduct(object):
def __init__(self, name):
self.name = name
self.description = 'Foo description'
self.url = 'https://errata.devel.redhat.com/myrelease'
def test_short_help(monkeypatch):
argv = ['errata-tool', 'produ... | {
"content_hash": "ae3b308d46aa5897c22f2a75e2a5a5f7",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 71,
"avg_line_length": 25.846153846153847,
"alnum_prop": 0.6468253968253969,
"repo_name": "ktdreyer/errata-tool",
"id": "e6515d8bdf095854a4964833e873dd0800fdc906",
"size": ... |
import logging
import os
import tempfile
from subprocess import Popen, PIPE, STDOUT
from couchapp.localdoc import document
from couchapp import util
from nose import tools
# need this decorator to tell nose that this thing isn't a test
@tools.nottest
def test(conf, path, *args, **opts):
export = opts.get('export'... | {
"content_hash": "b42a025123973e9794b370aebe2f0d90",
"timestamp": "",
"source": "github",
"line_count": 75,
"max_line_length": 76,
"avg_line_length": 28.386666666666667,
"alnum_prop": 0.5425082198215124,
"repo_name": "LearningRegistry/LearningRegistry",
"id": "ae767c4fe055229fcb4a8738418200c778ce7e37... |
"""Python wrappers around Brain.
This file is MACHINE GENERATED! Do not edit.
"""
from google.protobuf import text_format
from tensorflow.core.framework import op_def_pb2
from tensorflow.python.framework import op_def_registry
from tensorflow.python.framework import ops
from tensorflow.python.ops import op_def_libra... | {
"content_hash": "89ed3ec55d3c5a8f5f897ba884d16da9",
"timestamp": "",
"source": "github",
"line_count": 1171,
"max_line_length": 204,
"avg_line_length": 26.314261315115285,
"alnum_prop": 0.566463295904459,
"repo_name": "shishaochen/TensorFlow-0.8-Win",
"id": "136a45990a989bb74985d1c0d281e58f3e32648b"... |
import pygst
import gst
import gst.interfaces
from numpy import fromstring
import subprocess
import traceback
from string import find
from threading import Timer
from TurtleArt.taconstants import XO1, XO4
from TurtleArt.tautils import debug_output
# Initial device settings
RATE = 48000
MIC_BOOST = True
DC_MODE_ENABLE... | {
"content_hash": "93c4212dda30f1e7e0de3e263d88aa29",
"timestamp": "",
"source": "github",
"line_count": 655,
"max_line_length": 80,
"avg_line_length": 39.804580152671754,
"alnum_prop": 0.5434565817735502,
"repo_name": "walterbender/turtle3D",
"id": "228e4c26322f92f853e1fce5f3c35159c6690f6c",
"size"... |
import heapq
from chainer import function_node
from chainer import variable
# Note: docstrings must be updated when changing these default values.
_var_style = {'shape': 'octagon', 'fillcolor': '#E0E0E0', 'style': 'filled'}
_func_style = {'shape': 'record', 'fillcolor': '#6495ED', 'style': 'filled'}
class DotNode(... | {
"content_hash": "f0f07d455255e034ef3daae3090fdb07",
"timestamp": "",
"source": "github",
"line_count": 340,
"max_line_length": 81,
"avg_line_length": 39.02058823529412,
"alnum_prop": 0.5754126780734152,
"repo_name": "niboshi/chainer",
"id": "663000e3e225659884e19ff2cf0d289503976d76",
"size": "1326... |
import urllib, time, random
from FireModules.fire_module_base_class import *
class google_search_hiding_data( FireModule ):
def __init__(self):
self.commentsStr = "Websurfing/google_search_hiding_data"
def __init__(self, moofStr):
self.moofStr = moofStr
self.commentsStr = "Websurfing/google_search_hiding_da... | {
"content_hash": "d0afddace724119e9fe2e200a21f7a91",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 120,
"avg_line_length": 24.48780487804878,
"alnum_prop": 0.7320717131474104,
"repo_name": "TryCatchHCF/DumpsterFire",
"id": "eff569eca86cd79e39eb7451346ef8bcac3b78ad",
"siz... |
import urllib2
import json
import sys
from optparse import OptionParser
usage = "usage: %prog [options] host"
parser = OptionParser(usage = usage)
parser.add_option("-t", "--token", dest="token", default="", type='string',
help="token")
(options, args) = parser.parse_args()
if len(args) != 1:
parser.print_usage()... | {
"content_hash": "ebae652e9786a39b35510a1e512ffaa4",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 78,
"avg_line_length": 25.789473684210527,
"alnum_prop": 0.6918367346938775,
"repo_name": "foursquare/fsqio",
"id": "5a6c067c4c899f822dcfbcf61b4d8154e18f0052",
"size": "509... |
import traceback
from submissions.VanderKallen import slavery
from sklearn.neural_network import MLPRegressor
from sklearn.neural_network import MLPClassifier
class DataFrame:
data = []
feature_names = []
target = []
target_names = []
slaveTot = DataFrame()
slaveAS = DataFrame()
slaveBoth = DataFrame(... | {
"content_hash": "958461ecbf61a3484b8a140681aef9c1",
"timestamp": "",
"source": "github",
"line_count": 162,
"max_line_length": 66,
"avg_line_length": 20.97530864197531,
"alnum_prop": 0.5670982931135963,
"repo_name": "WhittKinley/aima-python",
"id": "855045c507dd0a335131e3f45a99be55858da209",
"size... |
import json
import demistomock as demisto # noqa: F401
import yaml
from CommonServerPython import * # noqa: F401
def main():
try:
incident = demisto.incident()
assets = incident.get('CustomFields', {}).get('assettable', {})
if not assets:
return ''
if not isinstanc... | {
"content_hash": "1e4638866eda2fab9ed6fd2ddba6a670",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 104,
"avg_line_length": 30.43243243243243,
"alnum_prop": 0.5870337477797514,
"repo_name": "VirusTotal/content",
"id": "316ff48112ebf614ed3c7ae2ad608aad63276400",
"size": "1... |
from typing import Optional, Dict, Any, List, Tuple, Union
import math
import random
import logging
import json
import functools
import asyncio
import aiohttp
import secrets
from hailtop.config import get_deploy_config, DeployConfig
from hailtop.auth import service_auth_headers
from hailtop.utils import bounded_gather... | {
"content_hash": "96ed905e4ebf29edd884998ee8cb24ef",
"timestamp": "",
"source": "github",
"line_count": 983,
"max_line_length": 143,
"avg_line_length": 37.03153611393693,
"alnum_prop": 0.5530190648865447,
"repo_name": "hail-is/hail",
"id": "f8f5c28e07728853df3f09cceb354dc337e0500e",
"size": "36402"... |
: def render_asset_panel context, asset, wrap=False
<li class="list-group-item">
<h4>
General
<a href="#" style="display: inline-block; margin: -10px;"><sup style="display: inline-block; padding: 10px 10px 0;"><i class="fa fa-question-circle small"></i></sup></a>
</h4>
<dl>
<dt>Name</dt>
<dd>${contex... | {
"content_hash": "1908cae3795e888ede38c33c6144c3e4",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 172,
"avg_line_length": 26.2,
"alnum_prop": 0.6008724100327154,
"repo_name": "marrow/contentment",
"id": "c734e434106b7ab9c391404b6a9a715d0b0c95a7",
"size": "936",
"binar... |
"""
The OGRGeometry is a wrapper for using the OGR Geometry class
(see http://www.gdal.org/classOGRGeometry.html). OGRGeometry
may be instantiated when reading geometries from OGR Data Sources
(e.g. SHP files), or when given OGC WKT (a string).
While the 'full' API is not present yet, the API is "pythonic" unlik... | {
"content_hash": "bfb0a20bdde0e57f8d19bf04bc258c16",
"timestamp": "",
"source": "github",
"line_count": 717,
"max_line_length": 108,
"avg_line_length": 34.11994421199442,
"alnum_prop": 0.6116742969260955,
"repo_name": "shacker/django",
"id": "d111f8bc44158677d48bcdd856a41c3f448515d0",
"size": "2446... |
from .base import *
ADMINS = (
# ('Your Name', 'your_email@example.com'),
)
MANAGERS = ADMINS
# Hosts/domain names that are valid for this site; required if DEBUG is False
# See https://docs.djangoproject.com/en/1.5/ref/settings/#allowed-hosts
ALLOWED_HOSTS = []
FIXTURE_DIRS += (project_directory('fixtures/prod... | {
"content_hash": "1d917e591acc5100b6730517f7c423e0",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 77,
"avg_line_length": 22.88888888888889,
"alnum_prop": 0.5407766990291262,
"repo_name": "yourlabs/django-permissions-widget",
"id": "18e49933a1cf20cbaa7a99cc8847633b4959eb14... |
import sys, os, json, subprocess, re, hashlib, time
import urllib.request
import urllib.parse
from pyxc.util import TempDir, parentOf, simplePost
import pj.api_internal
def runViaNode(path, codepath, exceptionServerHost, exceptionServerPort, runExceptionServer):
path = os.path.abspath(path)
if not os.p... | {
"content_hash": "30b64ca36d0e987cb880fc3b60a2be3f",
"timestamp": "",
"source": "github",
"line_count": 94,
"max_line_length": 96,
"avg_line_length": 34.42553191489362,
"alnum_prop": 0.530902348578492,
"repo_name": "andrewschaaf/pyxc-pj",
"id": "4009447e8bb64dc687d62751f1bd65921ec440cd",
"size": "3... |
import tweepy
import json
from haiku import Haiku
with open('access.json') as f:
secrets = json.load(f)
auth = tweepy.OAuthHandler(secrets['consumer_key'], secrets['consumer_secret_key'])
auth.set_access_token(secrets['access_token'], secrets['secret_access_token'])
class CustomStreamListener(tweepy.StreamListener... | {
"content_hash": "408e8fddd8bdb55adc7f047fd8b6eca7",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 122,
"avg_line_length": 32.189189189189186,
"alnum_prop": 0.7187237615449202,
"repo_name": "Jaemu/haiku.py",
"id": "23fe0eb5a9396d72efc90689941bc35491756577",
"size": "1191... |
import os
import re
import string
import sys
import logging
import oelite.util
class NotAGitRepository(Exception):
def __init__(self, path):
self.path = path
def __str__(self):
print self.path
class GitRepository(object):
SHA1_RE = re.compile("([0-9a-f]{1,40})$")
def __init__(self... | {
"content_hash": "cdcafc701e1630abebc12e883f513e0d",
"timestamp": "",
"source": "github",
"line_count": 170,
"max_line_length": 79,
"avg_line_length": 30.876470588235293,
"alnum_prop": 0.5357210897313774,
"repo_name": "hundeboll/core",
"id": "f4a9e382ee019cb97be4e68a31b3267db4592e58",
"size": "5249... |
from chainer.functions.activation import sigmoid
from chainer.functions.activation import tanh
from chainer.functions.math import linear_interpolate
from chainer import link
from chainer.links.connection import linear
from chainer import variable
class GRUBase(link.Chain):
def __init__(self, in_size, out_size, i... | {
"content_hash": "b134a017369f1df18ab29a970c8e6d8b",
"timestamp": "",
"source": "github",
"line_count": 257,
"max_line_length": 79,
"avg_line_length": 35.509727626459146,
"alnum_prop": 0.5584045584045584,
"repo_name": "keisuke-umezawa/chainer",
"id": "2bbd3c505206dac4831c141aeadf66d672cf11af",
"siz... |
import platform, re, sys,os, subprocess
distro = platform.linux_distribution()[0]
args = {'act': sys.argv[1],'service': sys.argv[2]}
if re.search(distro,'Ubuntu'):
if os.path.isfile("/etc/init/%s.conf" % args['service']):
cmd = args['act'] + " " + args['service']
elif os.path.isfile("/etc/init.d/%s" % args['... | {
"content_hash": "a3b8c61ddfa8193e3cf883a3be60a3e8",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 62,
"avg_line_length": 31.789473684210527,
"alnum_prop": 0.6208609271523179,
"repo_name": "Aamir-raza-1/st2contrib",
"id": "b77cd4aba10b9683863bfb36f31bee2e956a4bb4",
"size... |
from msrest.serialization import Model
class AdditionalUnattendContent(Model):
"""Additional XML formatted information that can be included in the
Unattend.xml file, which is used by Windows Setup. Contents are defined by
setting name, component name, and the pass in which the content is a
applied.
... | {
"content_hash": "3b4eedba9bdf0ccd0759a92a89be60b3",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 93,
"avg_line_length": 48.21951219512195,
"alnum_prop": 0.6970156803237229,
"repo_name": "v-iam/azure-sdk-for-python",
"id": "6e8749c489e5147e797ded908cd5c90724fb1fe7",
"si... |
import pandas as pd
from numba import typeof
from numba import types
from numba import objmode
from ..categorical.pdimpl import _reconstruct_CategoricalDtype
def _reconstruct_Series(data, dtype):
values_list = [v.literal_value for v in data]
dtype = _reconstruct_CategoricalDtype(dtype)
return pd.Series(... | {
"content_hash": "f3203069c225db03a355b1e087b0ed2a",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 95,
"avg_line_length": 31.176470588235293,
"alnum_prop": 0.6820754716981132,
"repo_name": "IntelLabs/hpat",
"id": "5788e0b67d9bbce372ae119dc0cd96def3f5e6bb",
"size": "2573"... |
import contextlib
import logging
import signal
import sys
import blessed
terminal = blessed.Terminal()
# Key codes used in application.
KEY_DOWN = 258
KEY_UP = 259
KEY_LEFT = 260
KEY_RIGHT = 261
KEY_BACKSPACE = 330
KEY_PGDN = 338
KEY_PGUP = 339
KEY_ENTER = 343
KEY_ESCAPE = 361
class IO:
"""Handles rendering of... | {
"content_hash": "a884ed9494b5790269c4ceca1b776119",
"timestamp": "",
"source": "github",
"line_count": 206,
"max_line_length": 172,
"avg_line_length": 39.39320388349515,
"alnum_prop": 0.6280961182994454,
"repo_name": "owlowlgo/redterm",
"id": "c701ee22bb2a6e6db0a32128cfb37c331cec6eab",
"size": "81... |
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
("publicbody", "0005_auto_20171106_1503"),
]
operations = [
migrations.CreateModel(
name="Classification"... | {
"content_hash": "de747a7272901fe3f4f1b388fd320f6e",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 80,
"avg_line_length": 32.18867924528302,
"alnum_prop": 0.4806565064478312,
"repo_name": "fin/froide",
"id": "b9ad8b30b089eb393aa01b8edfbad0d32cc58063",
"size": "1779",
"... |
from sklearn2sql_heroku.tests.classification import generic as class_gen
class_gen.test_model("LGBMClassifier" , "BinaryClass_100" , "oracle")
| {
"content_hash": "563435fe6c943b2ae7cf5c807d648943",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 72,
"avg_line_length": 36.25,
"alnum_prop": 0.7862068965517242,
"repo_name": "antoinecarme/sklearn2sql_heroku",
"id": "ac76fe270aab20ddd79ce7eec8dbac79ce310807",
"size": "14... |
from . import models
from ._builtin import Page, WaitPage
from otree.api import Currency as c, currency_range
from .models import Constants
class PaymentInfo(Page):
def vars_for_template(self):
participant = self.participant
return {
'redemption_code': participant.label or participant... | {
"content_hash": "4e2f0022709cc9bbc202331b11630b93",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 69,
"avg_line_length": 23.0625,
"alnum_prop": 0.6937669376693767,
"repo_name": "PinkyOne/otree_game",
"id": "ce70dfded0e0f26104a0ef841c521cd853ac2e94",
"size": "369",
"bi... |
from __future__ import unicode_literals
from django.db import models, migrations
import django.db.models.deletion
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('api', '0141_auto_20160707_1624')... | {
"content_hash": "6325f42c639d8b0b4f2977c900d51c1a",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 167,
"avg_line_length": 38.724137931034484,
"alnum_prop": 0.6206589492430988,
"repo_name": "SchoolIdolTomodachi/SchoolIdolAPI",
"id": "6dd766fbecc24220c99a0fa3c95a511a011ed8f... |
import sys
import os
import argparse
import labkey as lk
import pandas as pd
import numpy as np
import re
from datetime import datetime, time as dtime
from subprocess import check_output
import time
import math
EXTENSIONS = {'mzml':'.mzML',
'hdf5':'.h5',
'spectralhits':'_spectral-hits.tab.gz',
... | {
"content_hash": "5e6719502a4a797c8a5ad708f9fc6dde",
"timestamp": "",
"source": "github",
"line_count": 408,
"max_line_length": 194,
"avg_line_length": 44.931372549019606,
"alnum_prop": 0.6391010255291294,
"repo_name": "metabolite-atlas/metatlas",
"id": "a420e3034e991f8260f15a1a5a8a45edc92fa69d",
"... |
"""
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": "340b29c6553b843e55a66c6eb87e2419",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 72,
"avg_line_length": 40.75,
"alnum_prop": 0.7975460122699386,
"repo_name": "alexryndin/ambari",
"id": "bffbc26377cb989c15151ef628c2697e1a1eb702",
"size": "849",
"binary... |
from ifaint import *
#start
bindc('h',invert) # Binds the invert function to the H-key
bindc('h',desaturate,mod.ctrl) # Binds desaturate to Ctrl+H
bindc('h',context_flip_horizontal,mod.ctrl|mod.shift) # Binds context_flip_horizontal to Ctrl+Shift+H
| {
"content_hash": "7334c61d88e8acc04640d81fcb136a72",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 101,
"avg_line_length": 42.666666666666664,
"alnum_prop": 0.73828125,
"repo_name": "tectronics/faint-graphics-editor",
"id": "5890628a5582b73f246e4e115a83a9c62b6c76df",
"siz... |
"""Support for Buienradar.nl weather service."""
import logging
from buienradar.constants import (
CONDCODE,
CONDITION,
DATETIME,
MAX_TEMP,
MIN_TEMP,
RAIN,
WINDAZIMUTH,
WINDSPEED,
)
import voluptuous as vol
from homeassistant.components.weather import (
ATTR_FORECAST_CONDITION,
... | {
"content_hash": "d09392c5789351785f4f5c12448b9711",
"timestamp": "",
"source": "github",
"line_count": 206,
"max_line_length": 86,
"avg_line_length": 29.45631067961165,
"alnum_prop": 0.6097560975609756,
"repo_name": "tchellomello/home-assistant",
"id": "d0a0c0e18b4eb034677cbca510a0f83bb5de74e6",
"... |
from ..excel_comparison_test import ExcelComparisonTest
from ...workbook import Workbook
class TestCompareXLSXFiles(ExcelComparisonTest):
"""
Test file created by XlsxWriter against a file created by Excel.
"""
def setUp(self):
self.set_filename('chart_axis40.xlsx')
def test_create_fil... | {
"content_hash": "f3238f55b3439bd2643aa4e5d08853e5",
"timestamp": "",
"source": "github",
"line_count": 46,
"max_line_length": 68,
"avg_line_length": 25.934782608695652,
"alnum_prop": 0.5741827326068735,
"repo_name": "jmcnamara/XlsxWriter",
"id": "a035b3272b0e1829f08ffe3b8b94f847f5f3d3de",
"size": ... |
"""
Send metrics to a [influxdb](https://github.com/influxdb/influxdb/) using the
http interface.
v1.0 : creation
v1.1 : force influxdb driver with SSL
v1.2 : added a timer to delay influxdb writing in case of failure
this whill avoid the 100% cpu loop when influx in not responding
Sebastien Prune THOMAS... | {
"content_hash": "35258e429b5c88dd1189565de31f700f",
"timestamp": "",
"source": "github",
"line_count": 462,
"max_line_length": 419,
"avg_line_length": 41.426406926406926,
"alnum_prop": 0.49809289931553374,
"repo_name": "szibis/diamond-influxdb",
"id": "5eae3f6c24cd6baf34c4a2fbac6e35511908c012",
"s... |
import ops
import tensorflow as tf
import tensorflow.contrib.slim as slim
import model4 as model
from flowfairy.conf import settings
from util import lrelu, conv2d, maxpool2d, GLU, causal_GLU
batch_size = settings.BATCH_SIZE
samplerate = sr = settings.SAMPLERATE
dropout = settings.DROPOUT
learning_rate = settings.LEAR... | {
"content_hash": "08de28957481b69756dac9b837c75766",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 125,
"avg_line_length": 28.527272727272727,
"alnum_prop": 0.6265137029955385,
"repo_name": "WhatDo/FlowFairy",
"id": "87d207f3105ff3d4503ca31a59468bd703bb09fc",
"size": "15... |
"""
Test example snippets from the lldb 'help expression' output.
"""
from __future__ import print_function
import os
import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
class Radar9673644TestCase(TestBase):
mydir = TestBase... | {
"content_hash": "7e712134a2fb1393a9ed21cc3fc99328",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 85,
"avg_line_length": 28.145833333333332,
"alnum_prop": 0.615099925980755,
"repo_name": "youtube/cobalt_sandbox",
"id": "dfef8735071b998a7622344b8f2e6289e71d266c",
"size":... |
import json
from django.http import HttpResponse
from django.shortcuts import render, get_object_or_404
# Create your views here.
from channelworm.ion_channel.models import Graph
def index(request):
return render(request, 'digitizer/index.html')
def digitize(request, graph_id):
graph = get_object_or_404(G... | {
"content_hash": "c173ed39c220acecf557827c7631efee",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 84,
"avg_line_length": 27.384615384615383,
"alnum_prop": 0.7148876404494382,
"repo_name": "openworm/ChannelWorm",
"id": "f6f5bc49c298f5020176a36b50c85ff82ab91361",
"size": ... |
import abc
class MeteringAbstractDriver(object):
"""Abstract Metering driver."""
__metaclass__ = abc.ABCMeta
def __init__(self, plugin, conf):
pass
@abc.abstractmethod
def update_routers(self, context, routers):
pass
@abc.abstractmethod
def remove_router(self, context, r... | {
"content_hash": "2b7a2a55c8e2df75fb870f80b0030580",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 60,
"avg_line_length": 21.757575757575758,
"alnum_prop": 0.6448467966573816,
"repo_name": "kaiweifan/neutron",
"id": "a5e5ca193c240f8d38b7aff0583ce01b2d89bd71",
"size": "13... |
""" Landlab component that simulates relative wetness, mean factor-of-safety,
and probability of failure.
Relative wetness and factor-of-safety are based on the infinite slope
stability model driven by topographic and soils inputs and recharge provided
by user in a "landslide_driver" file. In addition, the component s... | {
"content_hash": "dc00856707b8fad6dab9d546d19e916c",
"timestamp": "",
"source": "github",
"line_count": 119,
"max_line_length": 91,
"avg_line_length": 35.04201680672269,
"alnum_prop": 0.7290167865707434,
"repo_name": "laijingtao/landlab",
"id": "dade5f38b021a41a3f36fb5aed72d11ef51b567e",
"size": "4... |
"""Wrapper to check for internal tool sync_keyboxes."""
import sys
try:
from internal import sync_keyboxes
except ImportError:
print('sync_keyboxes.py not found, skipping.')
sys.exit(0)
if __name__ == '__main__':
sys.exit(sync_keyboxes.SyncKeyboxesForCurrentBranch())
| {
"content_hash": "928d798026fd3aa707ea51cc85ca42f8",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 56,
"avg_line_length": 23.25,
"alnum_prop": 0.7168458781362007,
"repo_name": "youtube/cobalt",
"id": "dc4890fec46b4fd193d5d9605582848883aaec42",
"size": "908",
"binary": ... |
"""Convert SVG Path's elliptical arcs to Bezier curves.
The code is adapted from FontTools fontTools/svgLib/path/arc.py, which in turn
is adapted from Blink's SVGPathNormalizer::DecomposeArcToCubic:
https://github.com/chromium/chromium/blob/93831f2/third_party/blink/renderer/core/svg/svg_path_parser.cc#L169-L278
"""
f... | {
"content_hash": "0698f096bda64d6db9b9b02327fbf1d5",
"timestamp": "",
"source": "github",
"line_count": 196,
"max_line_length": 114,
"avg_line_length": 35.714285714285715,
"alnum_prop": 0.6345714285714286,
"repo_name": "googlefonts/picosvg",
"id": "e713e320681e1815205bd5ad4f53a45cfcbcbc8e",
"size":... |
"""Setuptools file."""
# pylint: disable=E0611,F0401
from setuptools import setup
from os import path
import versioneer
try:
import setuptools
[setuptools]
except ImportError:
pass
with open(path.join(path.dirname(__file__), 'README.rst'), encoding="utf-8") as long_d_f:
LONG_DESCRIPTION = long_d_f.re... | {
"content_hash": "32a6778ef1a4db2cca43395fe5991675",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 89,
"avg_line_length": 35.63157894736842,
"alnum_prop": 0.6056129985228951,
"repo_name": "qarnot/qarnot-sdk-python",
"id": "b29bfec1117f7c7671351022216f1562bf7f8674",
"size... |
import os
import sys
import djstripe
version = djstripe.__version__
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
if sys.argv[-1] == 'publish':
os.system('python setup.py sdist upload')
os.system('python setup.py bdist_wheel upload')
print("Tagging the ve... | {
"content_hash": "53b2c4bcafc2ea5fe998ede8ea7e55ab",
"timestamp": "",
"source": "github",
"line_count": 66,
"max_line_length": 67,
"avg_line_length": 27.803030303030305,
"alnum_prop": 0.6103542234332425,
"repo_name": "mwarkentin/dj-stripe",
"id": "e64bd0cc12d24ee444a019408060932b3555358b",
"size": ... |
import click
import codecs
import collections
import datetime
import difflib
import magic
import os
import peewee
from pygments.lexers.php import PhpLexer
from pygments.token import Token, is_token_subtype
class WontFix(Exception):
pass
db = peewee.Proxy()
class Plugin(peewee.Model):
active = peewee.Integ... | {
"content_hash": "83d6643cdbf92e271430c21812f9d2e6",
"timestamp": "",
"source": "github",
"line_count": 410,
"max_line_length": 119,
"avg_line_length": 42.917073170731705,
"alnum_prop": 0.5747897249374858,
"repo_name": "dumpedc/vbfixer",
"id": "3221d3b0ea26124a733e96d005792e48d8deba19",
"size": "18... |
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import division
from __future__ import absolute_import
from future import standard_library
standard_library.install_aliases()
__title__ = 'server-hardware-types'
__version__ = '0.0.1'
__copyright__ = '(C) Copyright (2012-201... | {
"content_hash": "74f433fe57cc41c59f5b339de03469fc",
"timestamp": "",
"source": "github",
"line_count": 110,
"max_line_length": 110,
"avg_line_length": 35.80909090909091,
"alnum_prop": 0.6158923584666159,
"repo_name": "danielreed/python-hpOneView",
"id": "f2a88b87e0f58ae7a24c5e31d82500f1ba7d4a3d",
... |
class Account:
me = None
def __init__(self, device):
# @todo:
self.id = "account"
self.device = device
self.hardware_id = self.device.hardware_id
@classmethod
def set_me(cls, device):
if cls.me is None:
cls.me = Account(device)
| {
"content_hash": "fedcf7a6c2b8a8d00a6e4b50685822d2",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 50,
"avg_line_length": 21.357142857142858,
"alnum_prop": 0.5384615384615384,
"repo_name": "filemakergarage/zeroclient",
"id": "4e3096fb1c83f1855f9c5e2e5ec9eb04957dac96",
"s... |
import unittest
from sqlalchemy.schema import Table
from carepoint.tests.db.db import DatabaseTest
from carepoint.models.cph.patient_phone import PatientPhone
class TestModelsCphPatientPhone(DatabaseTest):
def test_table_initialization(self):
self.assertIsInstance(PatientPhone.__table__, Table)
def ... | {
"content_hash": "b03bf8f4682d3226f9fb7bb14bc78f6e",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 60,
"avg_line_length": 26.5,
"alnum_prop": 0.7064989517819706,
"repo_name": "laslabs/Python-Carepoint",
"id": "369480fc6298fe0494eabcd65802d5ed7ebc73c4",
"size": "591",
"... |
import re
from copy import deepcopy
from lxml import etree
from fake_switches.netconf import XML_NS, XML_ATTRIBUTES, CANDIDATE, RUNNING, AlreadyLocked, NetconfError, \
CannotLockUncleanCandidate, first,UnknownVlan, InvalidInterfaceType, InvalidTrailingInput, \
AggregatePortOutOfRange, PhysicalPortOutOfRange, ... | {
"content_hash": "53637f7ed1a19f847df06baab4cd685d",
"timestamp": "",
"source": "github",
"line_count": 693,
"max_line_length": 225,
"avg_line_length": 42.37085137085137,
"alnum_prop": 0.599087286721384,
"repo_name": "stephanerobert/fake-switches",
"id": "c456d006ad5fbb842e59f0e31aa441553d498627",
... |
if __name__ == "__main__":
import lib.BioSIM_API as BioSIM_API
import time
#create and initialize WeatherGenerator
WG = BioSIM_API.WeatherGenerator('Context Name')
print("Initialize Weather Generator")
msg = WG.Initialize("Shore=./Layers/Shore.ann&Normals=./Weather/Normals/Canada-USA 19... | {
"content_hash": "1735abb481f9e1912e550a1bfb4e4bb3",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 199,
"avg_line_length": 37.5,
"alnum_prop": 0.6946031746031746,
"repo_name": "RNCan/WeatherBasedSimulationFramework",
"id": "af5b704c151b8a7c19a2210468d10b7e05adcb21",
"siz... |
from .catalog import Catalog
from .funcs import hosts
from .remotedata import RemoteData, du, dp, do, dr
from .servers import Servers
| {
"content_hash": "463f628f6cccccf674fa9ab591d6f005",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 50,
"avg_line_length": 33.5,
"alnum_prop": 0.7910447761194029,
"repo_name": "hhuuggoo/kitchensink",
"id": "59bb90719f42214c7367201f579e14d35d8c721d",
"size": "134",
"binar... |
import responses
import watson_developer_cloud
import os
import json
profile_url = 'https://gateway.watsonplatform.net/personality-insights/api/v3/profile'
"""
Input: Plain text (English)
Output: JSON, no raw scores or preferences (English)
"""
@responses.activate
def test_plain_to_json():
personality_insights =... | {
"content_hash": "555b2ca6d65d68995e61f1065ad73930",
"timestamp": "",
"source": "github",
"line_count": 115,
"max_line_length": 113,
"avg_line_length": 40.495652173913044,
"alnum_prop": 0.686922911745759,
"repo_name": "ehdsouza/python-sdk",
"id": "7eb4299bb89c60b33e6b95cc5384bf9be714683e",
"size": ... |
from spyre import server
import pandas as pd
import urllib2
import json
class StockExample(server.App):
title = "Historical Stock Prices"
inputs = [{ "input_type":'dropdown',
"label": 'Company',
"options" : [ {"label": "Google", "value":"GOOG"},
{"label": "Yahoo", "value":"YHOO"},
{... | {
"content_hash": "b6a1914afa7594857043ffee76d3c4ed",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 120,
"avg_line_length": 31.363636363636363,
"alnum_prop": 0.6156521739130435,
"repo_name": "dolel13/spyre",
"id": "12e482c1585d38aee34b5da66a9991c2343f2042",
"size": "1725"... |
from __future__ import print_function
import operator
import pytest
from pandas.compat import (zip, range, lrange, StringIO)
from pandas import DataFrame, Series, Index, MultiIndex, date_range
import pandas as pd
import numpy as np
from numpy.random import randn
from pandas.util.testing import (assert_series_equal,... | {
"content_hash": "0100d915374388995a7cfcddddeb48fe",
"timestamp": "",
"source": "github",
"line_count": 1097,
"max_line_length": 89,
"avg_line_length": 38.62351868732908,
"alnum_prop": 0.5503894264810008,
"repo_name": "NixaSoftware/CVis",
"id": "a6c36792ef074eeeeb0e0102e5afba61757e5493",
"size": "4... |
from __future__ import unicode_literals
from collections import defaultdict
from ete3 import Tree
from ete3.coretype.tree import TreeError
def prune(tree, nodes, const_depth=True, keep_root=False):
"""
We provide a customized alternative to ete3.Tree.prune to increase the speed of tree
pruning for the sp... | {
"content_hash": "1a8e4f5fa228b09346a795364e681bac",
"timestamp": "",
"source": "github",
"line_count": 63,
"max_line_length": 88,
"avg_line_length": 35.25396825396825,
"alnum_prop": 0.6069338135974787,
"repo_name": "shh-dlce/dplace",
"id": "68b618dcbdc0717c7ec09d713d0bd8c6d8f520b9",
"size": "2236"... |
import json
import re
from calvin.requests import calvinresponse
from calvin.utilities.calvin_callback import CalvinCB
from calvin.utilities.calvinlogger import get_logger
from routes import register, handler
from authentication import authentication_decorator
from calvin.utilities.attribute_resolver import format_inde... | {
"content_hash": "b3b89643ba22b39771b767df91b90f06",
"timestamp": "",
"source": "github",
"line_count": 282,
"max_line_length": 213,
"avg_line_length": 37.87943262411348,
"alnum_prop": 0.6596143044373712,
"repo_name": "EricssonResearch/calvin-base",
"id": "83e47af8e3664fb7f7f0c200d9a7de0532796ed4",
... |
"""Classification example using sci-kit learn k-nearest
"""
import pandas as pd
import numpy as np
from sklearn import cross_validation, neighbors
# read data, replace missing values, drop useless id column
df = pd.read_csv('breast-cancer-wisconsin.data')
df.replace('?', -99999, inplace=True)
df.drop(['id'], 1, inpla... | {
"content_hash": "87421c62f155d9890c9f8464c4e4c459",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 89,
"avg_line_length": 30.363636363636363,
"alnum_prop": 0.7105788423153693,
"repo_name": "FelixPM/Learning-Machine-Learning",
"id": "279cfa82ef9c785a4b6a1aef5db34f7f444b8269... |
"""
Created on 22 Mar 2014
@author: Max Demian
"""
# 100% coverage
import unittest
from contactman import Contact, ContactList, Friend, Supplier, EmailableContact
class TestContactman(unittest.TestCase):
def setUp(self):
self.c = Contact("max", "demian@gmx.de")
self.d = Contact("1", "2")... | {
"content_hash": "e413e147ed3a8ed6e57d2ba6d0b5f202",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 103,
"avg_line_length": 32.04545454545455,
"alnum_prop": 0.6056737588652482,
"repo_name": "mikar/60-days-of-python",
"id": "c25003e1569096d66f9c0c8482aa30aadd26ffa8",
"size... |
from io import BytesIO
from typing import List # noqa: F401
from reportlab.graphics.barcode import createBarcodeDrawing
from reportlab.lib import colors, pagesizes
from reportlab.lib.enums import TA_CENTER
from reportlab.lib.styles import ParagraphStyle
from reportlab.lib.units import mm
from reportlab.lib.utils impo... | {
"content_hash": "a88bbfc6230d0883d0bef704386680dc",
"timestamp": "",
"source": "github",
"line_count": 417,
"max_line_length": 116,
"avg_line_length": 44.28776978417266,
"alnum_prop": 0.5727203811999133,
"repo_name": "osantana/correios",
"id": "eb2efdd1079ee092820c0d236e12ec360818907d",
"size": "1... |
import tensorflow as tf
import numpy as np
import pysc2.my_agent.layer as layer
from pysc2.my_agent.utils import get_power_index
from pysc2.lib import actions as sc2_actions
import os
os.environ['CUDA_VISIBLE_DEVICES'] = '3'
_NO_OP = sc2_actions.FUNCTIONS.no_op.id
_MOVE_MINIMAP = sc2_actions.FUNCTIONS.Move_minimap.id... | {
"content_hash": "799aec3bfb6a563ad60214711f0267cd",
"timestamp": "",
"source": "github",
"line_count": 724,
"max_line_length": 129,
"avg_line_length": 42.26381215469613,
"alnum_prop": 0.5607372789960456,
"repo_name": "pangzhenjia/pysc2-source",
"id": "d1c7716fcd9bf50090ae5c8ab4db3db3f9a7c973",
"si... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
################################################################################
# Documentation
################################################################################
ANSIBLE_METADATA = {'metadata_version': '1.1', 'statu... | {
"content_hash": "a26a6908aa50dae1c69a64a808cc631f",
"timestamp": "",
"source": "github",
"line_count": 218,
"max_line_length": 148,
"avg_line_length": 27.76605504587156,
"alnum_prop": 0.5957376507516934,
"repo_name": "SergeyCherepanov/ansible",
"id": "5982ed0a79c07083a63e62f866d100ede1bd29ec",
"si... |
import PyPDF2
src_pdf = PyPDF2.PdfFileReader('data/src/pdf/sample1.pdf')
dst_pdf = PyPDF2.PdfFileWriter()
dst_pdf.cloneReaderDocumentRoot(src_pdf)
with open('data/temp/sample1_no_meta.pdf', 'wb') as f:
dst_pdf.write(f)
print(PyPDF2.PdfFileReader('data/temp/sample1_no_meta.pdf').documentInfo)
# {'/Producer': 'Py... | {
"content_hash": "5b9027ffd21a88b64f6c8a38d0cf0c1a",
"timestamp": "",
"source": "github",
"line_count": 107,
"max_line_length": 192,
"avg_line_length": 38.48598130841121,
"alnum_prop": 0.6750849927149102,
"repo_name": "nkmk/python-snippets",
"id": "3fe6af511d79110a9f1a2e3b45900ea230364890",
"size":... |
from gui_lib.container import Container
from gui_lib.label import Label
from gui_lib.listbox import Listbox
from gui_lib.core import end
from verenigingNaamCoupler import getVerenigingNaam
from factuurRetex import factuurRetex
import curses
class factuurListItem(Label):
def __init__(self, width, factuur, manager,... | {
"content_hash": "4872740882ad63b19f58c028723ea697",
"timestamp": "",
"source": "github",
"line_count": 59,
"max_line_length": 98,
"avg_line_length": 33.728813559322035,
"alnum_prop": 0.6316582914572865,
"repo_name": "thijsmie/madmin",
"id": "edfdb78d2768022b80788664c8103afa57739749",
"size": "1990... |
import _sqlite3
import os, tempfile, unittest
class TestSupport:
def getfilename(self):
if _sqlite3.sqlite_version_info() >= (2, 8, 2):
return ":memory:"
else:
return tempfile.mktemp()
def removefile(self):
if self.filename != ":memory:":
os.remove(s... | {
"content_hash": "a1b575d4b249a7fc2136f11f786d948a",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 55,
"avg_line_length": 25.692307692307693,
"alnum_prop": 0.5778443113772455,
"repo_name": "sassoftware/conary",
"id": "006e9efa55392ec7a8b10410aa7701844b4c4231",
"size": "3... |
"""
This module provides a simplified API for invoking the Turku Event Extraction
System (TEES) on text and extracting INDRA statement from TEES output.
See publication:
Jari Björne, Sofie Van Landeghem, Sampo Pyysalo, Tomoko Ohta, Filip Ginter,
Yves Van de Peer, Sofia Ananiadou and Tapio Salakoski, PubMed-Scale Event... | {
"content_hash": "91d152870e2429266b9988f4c137758b",
"timestamp": "",
"source": "github",
"line_count": 311,
"max_line_length": 79,
"avg_line_length": 39.91318327974277,
"alnum_prop": 0.6224119874325305,
"repo_name": "pvtodorov/indra",
"id": "122aa68fc0e2dcaf156207c713111fedc273cc1d",
"size": "1243... |
import os
import json
import glob
import sqlite3
with sqlite3.connect("data.db") as conn:
c = conn.cursor()
c.execute("drop table if exists github")
c.execute("""
create table github (
owner text,
name text,
description text,
language text,
... | {
"content_hash": "ae7ca962a93efee7b7990266bb1d9278",
"timestamp": "",
"source": "github",
"line_count": 75,
"max_line_length": 75,
"avg_line_length": 28.56,
"alnum_prop": 0.46872082166199813,
"repo_name": "dfm/github-repo-crawler",
"id": "634b0f368775cabecc627723d6b16f017f74d501",
"size": "2142",
... |
from oslo_policy import policy
from nova.policies import base
POLICY_ROOT = 'os_compute_api:os-server-tags:%s'
server_tags_policies = [
policy.DocumentedRuleDefault(
name=POLICY_ROOT % 'delete_all',
check_str=base.PROJECT_MEMBER_OR_ADMIN,
description="Delete all the server tags",
... | {
"content_hash": "1cb5447de0157505bc533eb6299c2021",
"timestamp": "",
"source": "github",
"line_count": 86,
"max_line_length": 76,
"avg_line_length": 28.511627906976745,
"alnum_prop": 0.515905383360522,
"repo_name": "mahak/nova",
"id": "baa11239877de35284ee7b0de7409bada909986d",
"size": "3091",
"... |
import argparse
import sys
import json
from zsearch_definitions import protocols
from ztag.stream import Stream, Incoming, Outgoing, InputFile, OutputFile
from ztag.transform import Transform, Decoder, Encoder
from ztag.decoders import JSONDecoder
from ztag.encoders import JSONEncoder
from ztag.annotation import Anno... | {
"content_hash": "8d0d7db21cf26e3e05aa0365ab4655b1",
"timestamp": "",
"source": "github",
"line_count": 183,
"max_line_length": 99,
"avg_line_length": 36.622950819672134,
"alnum_prop": 0.6281706953148314,
"repo_name": "zmap/ztag",
"id": "6357d95689a17bce06fe8e5a02bcf42fbb46806a",
"size": "6702",
... |
"""
A simple webserver that returns canned data
"""
from __future__ import print_function
from random import randint
from bottle import run, get, static_file
def make_random_coordinate():
""" Make a random coordinate dictionary"""
return make_coordinate(randint(0, 100), randint(0, 100))
def make_coordinate... | {
"content_hash": "43cd760f31982c82b683e10317a4eaf9",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 60,
"avg_line_length": 25.67241379310345,
"alnum_prop": 0.5963734049697784,
"repo_name": "pviafore/nvd3-bottle-example",
"id": "bffe2a7e4557853b5f6ccbfb78bd3e95559eb75d",
"... |
from msrest.paging import Paged
class ResourceSkuPaged(Paged):
"""
A paging container for iterating over a list of :class:`ResourceSku <azure.mgmt.compute.v2017_03_30.models.ResourceSku>` object
"""
_attribute_map = {
'next_link': {'key': 'nextLink', 'type': 'str'},
'current_page': {'... | {
"content_hash": "70bfc47777e835239186655a57389ac6",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 131,
"avg_line_length": 29.5625,
"alnum_prop": 0.6088794926004228,
"repo_name": "AutorestCI/azure-sdk-for-python",
"id": "7ec1fe3ac3f2b215fdefc6c2eb18130cdd34d602",
"size":... |
import site
reload(site)
import project
import label
import registry
import replication
import repository
import swagger_client
class Harbor(project.Project, label.Label,
registry.Registry, replication.Replication,
repository.Repository):
pass | {
"content_hash": "64d83208cc849f7a1cc69acf8fec865e",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 47,
"avg_line_length": 19.76923076923077,
"alnum_prop": 0.8054474708171206,
"repo_name": "steven-zou/harbor",
"id": "29f12db99f48429c9440e0f451b5408c26b1b4a2",
"size": "281... |
import os.path as op
from copy import deepcopy
from functools import partial
import pytest
import numpy as np
from scipy.io import savemat
from numpy.testing import assert_array_equal, assert_equal
from mne.channels import (rename_channels, read_ch_connectivity,
find_ch_connectivity, make_1... | {
"content_hash": "dc4ae420aee1c558d1a9e9ed8d8d0c37",
"timestamp": "",
"source": "github",
"line_count": 301,
"max_line_length": 77,
"avg_line_length": 42.76079734219269,
"alnum_prop": 0.5987102789216067,
"repo_name": "adykstra/mne-python",
"id": "8275cd55f72c69f25aee7d33c37c6638d7e282b2",
"size": "... |
"""Support for Verizon FiOS Quantum Gateways."""
import logging
from quantum_gateway import QuantumGatewayScanner
from requests.exceptions import RequestException
import voluptuous as vol
from homeassistant.components.device_tracker import (
DOMAIN,
PLATFORM_SCHEMA,
DeviceScanner,
)
from homeassistant.con... | {
"content_hash": "172a3af08fb7ee142415beabe51135b5",
"timestamp": "",
"source": "github",
"line_count": 70,
"max_line_length": 80,
"avg_line_length": 32.042857142857144,
"alnum_prop": 0.6705305394560857,
"repo_name": "balloob/home-assistant",
"id": "08f8a5191c9fcf88d1b9a4e3e21471bcaf5c09e7",
"size"... |
"""
The flask application package.
"""
from flask import Flask
from flask_jsonrpc import JSONRPC
app = Flask(__name__)
jsonrpc = JSONRPC(app, '/api',enable_web_browsable_api=True)
import ModStorage.views
import ModStorage.api
import ModStorage.ModVizX2Api | {
"content_hash": "0f3957ae41de0c228cebcbef1d7c11b8",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 60,
"avg_line_length": 19.846153846153847,
"alnum_prop": 0.7713178294573644,
"repo_name": "benno16/extraFiles",
"id": "f7d4c04bf8519ce6feaeb33c0986374633bbb6c8",
"size": "2... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.