text stringlengths 4 1.02M | meta dict |
|---|---|
from __future__ import division
import urllib2
import sys
import os
import json
import datetime
import traceback
import logging
import logging.handlers
import inspect
import math
import onebusaway
if __name__ == "__main__":
logger = onebusaway.getLogger()
if len(sys.argv) < 2:
print float("NaN")
sys.exit(2)
st... | {
"content_hash": "26f212938b3fe7bda606d86242699d4d",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 90,
"avg_line_length": 20.08108108108108,
"alnum_prop": 0.7146702557200538,
"repo_name": "wlindley/onebusaway",
"id": "4c5439dfe3021775a729056654eb5c2766721840",
"size": "7... |
import os
import logging
import decimal
import base64
import json
from datetime import datetime
from lib import config, util, util_tetcoin
ASSET_MAX_RETRY = 3
D = decimal.Decimal
def parse_issuance(db, message, cur_block_index, cur_block):
if message['status'] != 'valid':
return
def modify_extended_... | {
"content_hash": "e64246a881c45f52d34eb70bb5bdc9ea",
"timestamp": "",
"source": "github",
"line_count": 279,
"max_line_length": 159,
"avg_line_length": 52.132616487455195,
"alnum_prop": 0.5889996562392574,
"repo_name": "Tetchain/tetblockd",
"id": "185584856303477c6956874f76f629cbe43e2c1b",
"size": ... |
from qtpy import QtWidgets, QtGui
from echo.qt.autoconnect import autoconnect_callbacks_to_qt
from echo import CallbackProperty
from echo.qt.connect import UserDataWrapper
def test_autoconnect_callbacks_to_qt():
class Data(object):
pass
data1 = Data()
data2 = Data()
class CustomWidget(QtWi... | {
"content_hash": "8921d7a828df77fef2a0219c262be43a",
"timestamp": "",
"source": "github",
"line_count": 122,
"max_line_length": 91,
"avg_line_length": 30.87704918032787,
"alnum_prop": 0.6625962304220866,
"repo_name": "glue-viz/echo",
"id": "ed2beaf01fc0103f45a184bd7e64cf337c2819a7",
"size": "3767",... |
from gdc_ng_models.models.misc import *
| {
"content_hash": "3a24721e2c1ede693d2d7edc7f457210",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 39,
"avg_line_length": 40,
"alnum_prop": 0.775,
"repo_name": "NCI-GDC/gdcdatamodel",
"id": "7123efb48cfa1451d2c83ded892b6750c3ad638e",
"size": "40",
"binary": false,
"co... |
from tornado.gen import coroutine
from qiita_core.util import execute_as_transaction
from qiita_db.software import Software
from .base_handlers import BaseHandler
class SoftwareHandler(BaseHandler):
@coroutine
@execute_as_transaction
def get(self):
# active True will only show active software
... | {
"content_hash": "8ad58de66fa5ed9c6eb18005adb019cc",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 63,
"avg_line_length": 29.894736842105264,
"alnum_prop": 0.6883802816901409,
"repo_name": "ElDeveloper/qiita",
"id": "9b1d5e238727694132f83c3030a23705e9ec5e21",
"size": "91... |
from distutils.core import setup
import py2exe
setup(
name='Facturacion',
version='1.0',
packages=['', 'Objects', 'Collections', 'Controllers'],
url='https://atalgaba.com',
license='GNU GENERAL PUBLIC LICENSE',
author='IhToN',
author_email='atalgaba@gmail.com',
description='Programa sim... | {
"content_hash": "04da42ea4170722d78a9fe892dbd8f86",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 59,
"avg_line_length": 26.714285714285715,
"alnum_prop": 0.6711229946524064,
"repo_name": "IhToN/DAW1-PRG",
"id": "450e1d667a2e85c66c60e425ca2ae301853438c5",
"size": "375",... |
import sys
import asyncio
import os
from queue import Empty
from molotov.util import cancellable_sleep, printable_error, multiprocessing
class SharedConsole(object):
"""Multi-process compatible stdout console.
"""
def __init__(self, interval=0.1, max_lines_displayed=20, stream=sys.stdout):
self.... | {
"content_hash": "56e2a76bbd1cc23bee93a691a3e8b096",
"timestamp": "",
"source": "github",
"line_count": 74,
"max_line_length": 80,
"avg_line_length": 29.445945945945947,
"alnum_prop": 0.5222579164754475,
"repo_name": "loads/molotov",
"id": "ad15c1b390f53f2ca07febe696376b3ab134ebb7",
"size": "2179",... |
"""Simple collision check.
This module provides simple collision checking appropriate for
shmups. It provides routines to check whether two moving circles
collided during the past frame.
An equivalent C-based version will be used automatically if it was
compiled and installed with the module. If available, it will be... | {
"content_hash": "5bae265604d37f0d807c45fb184a2eed",
"timestamp": "",
"source": "github",
"line_count": 112,
"max_line_length": 75,
"avg_line_length": 27.848214285714285,
"alnum_prop": 0.6219942289195255,
"repo_name": "andarms/pyweek22",
"id": "2e88b3c0a492008a8c62cb0a23c0c92fbd9f3f4f",
"size": "31... |
import os
import time
from cm_api.api_client import ApiResource
# If the exit code is not zero Cloudera Director will fail
# Post creation scripts also have access to the following environment variables:
# DEPLOYMENT_HOST_PORT
# ENVIRONMENT_NAME
# DEPLOYMENT_NAME
# CLUSTER_NAME
# CM_USERNAME
# CM_PA... | {
"content_hash": "08a0020ab35248881806402be746a765",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 80,
"avg_line_length": 26,
"alnum_prop": 0.6634615384615384,
"repo_name": "TobyHFerguson/director-scripts",
"id": "b80b4ea975497f5b5b344f7d28734c58b4b38c42",
"size": "746",... |
import os
from flask_script import Manager, Shell
from app import create_app
from flask import url_for
app = create_app(os.getenv('FLASK_CONFIG') or 'default')
manager = Manager(app)
def make_shell():
return dict(app=app)
manager.add_command("shell", Shell(make_context=make_shell))
def run_test(discover_name... | {
"content_hash": "6e8c0fb8d8a84230358f6df4881d3f39",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 67,
"avg_line_length": 21.224489795918366,
"alnum_prop": 0.6298076923076923,
"repo_name": "utofu/oauth-server",
"id": "df450c53164104a5ea3d3f94524bf09b734a4d35",
"size": "1... |
"""Support for Actions on Google Assistant Smart Home Control."""
from __future__ import annotations
import logging
from typing import Any
import voluptuous as vol
# Typing imports
from homeassistant.const import CONF_API_KEY, CONF_NAME
from homeassistant.core import HomeAssistant, ServiceCall
from homeassistant.hel... | {
"content_hash": "7286b81b1b712a3c63d807d6a0e08080",
"timestamp": "",
"source": "github",
"line_count": 127,
"max_line_length": 112,
"avg_line_length": 30.566929133858267,
"alnum_prop": 0.6622874806800618,
"repo_name": "kennedyshead/home-assistant",
"id": "13516783233ade65c43133b68bc19259ec3ea823",
... |
"""
Display return data as a progress bar
"""
try:
import progressbar
HAS_PROGRESSBAR = True
except ImportError:
HAS_PROGRESSBAR = False
def __virtual__():
return True if HAS_PROGRESSBAR else False
def output(ret, bar, **kwargs): # pylint: disable=unused-argument
"""
Update the progress ... | {
"content_hash": "54198c9c7d2ecffc2f4744817b375533",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 98,
"avg_line_length": 24.32,
"alnum_prop": 0.6011513157894737,
"repo_name": "saltstack/salt",
"id": "1d00a379cc468bc4cf9b0b57bae5494611bf1bf4",
"size": "1216",
"binary":... |
import p4_hlir.hlir.p4 as p4
from tenjin.util import *
import os
import globals as gl
import re
import socket
from collections import defaultdict, OrderedDict
from util.topo_sorting import Graph, Node
from time import sleep
import sys
import json
from pkg_resources import resource_string
_SMART_DIR = os.path.dirname(o... | {
"content_hash": "f094f8e128839f95a569a877e02c3dcc",
"timestamp": "",
"source": "github",
"line_count": 1221,
"max_line_length": 107,
"avg_line_length": 40.171990171990174,
"alnum_prop": 0.5532313965341489,
"repo_name": "PrincetonUniversity/p4c-behavioral",
"id": "ef488fca181abebd87081c427c8d64368a85... |
from calvin.runtime.south.plugins.async import async
from calvin.utilities.calvinlogger import get_logger
_log = get_logger(__name__)
class TimerEvent(async.DelayedCall):
def __init__(self, actor_id, delay, trigger_loop, repeats=False):
super(TimerEvent, self).__init__(delay, callback=self.trigger)
... | {
"content_hash": "f39248f05684dac756a25ce0155bb5ba",
"timestamp": "",
"source": "github",
"line_count": 57,
"max_line_length": 113,
"avg_line_length": 30.80701754385965,
"alnum_prop": 0.6349658314350797,
"repo_name": "MalmoUniversity-DA366A/calvin-base",
"id": "efc245d24981ed7bd020be3e92c2ea4ded87ccd... |
"""Mock utilities that are async aware."""
import sys
if sys.version_info[:2] < (3, 8):
from asynctest.mock import * # noqa
from asynctest.mock import CoroutineMock as AsyncMock # noqa
else:
from unittest.mock import * # noqa
| {
"content_hash": "04cfb3380bf431f9dd6ecec8df60cbfe",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 65,
"avg_line_length": 30.25,
"alnum_prop": 0.6859504132231405,
"repo_name": "mKeRix/home-assistant",
"id": "1942b2ca284b8a38ef31501e8ed4c0a6b9d6759f",
"size": "242",
"bin... |
from django.shortcuts import render
from schnippjs import schnippforms
from testproduct.models import News, Category
import json
from django.forms.models import modelform_factory
from django.http import HttpResponse
def testing(request):
'''
Required for selenium tests;
'''
cat = Category(nam... | {
"content_hash": "8bc179d3570d6e8167d117906ebb9992",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 115,
"avg_line_length": 32.256410256410255,
"alnum_prop": 0.6263910969793323,
"repo_name": "tonimichel/djpl-schnippjs",
"id": "864becf4885a631d3c24ef507f8e992d72a3f5d9",
"s... |
import contextlib
import logging
import os
from pylib.constants import host_paths
_COLORAMA_PATH = os.path.join(
host_paths.DIR_SOURCE_ROOT, 'third_party', 'colorama', 'src')
with host_paths.SysPath(_COLORAMA_PATH, position=0):
import colorama
class _ColorFormatter(logging.Formatter):
# pylint does not see... | {
"content_hash": "3c4837c97eabb6be9da9d7a29fa9acdb",
"timestamp": "",
"source": "github",
"line_count": 107,
"max_line_length": 79,
"avg_line_length": 29.682242990654206,
"alnum_prop": 0.7169395465994962,
"repo_name": "chrisdickinson/nojs",
"id": "082f9e851b7f33c36f616fec0b11fe2ae06b5750",
"size": ... |
"""Load dataset for the Attention model (CSJ corpus).
In addition, frame stacking and skipping are used.
You can use the multi-GPU version.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from os.path import join, isfile
import pickle
import numpy... | {
"content_hash": "3e28e051e5490dc7014d315633060e27",
"timestamp": "",
"source": "github",
"line_count": 106,
"max_line_length": 86,
"avg_line_length": 43.339622641509436,
"alnum_prop": 0.5794514584240313,
"repo_name": "hirofumi0810/tensorflow_end2end_speech_recognition",
"id": "f3a953ffceaac88bd7e53b... |
import os
import warnings
from bento.core.pkg_objects \
import \
Extension
from bento.core.node \
import \
split_path
def translate_name(name, ref_node, from_node):
if from_node != ref_node:
parent_pkg = ref_node.path_from(from_node).replace(os.sep, ".")
return ".".join([p... | {
"content_hash": "fc6222a5fcb044575884483c82e239f2",
"timestamp": "",
"source": "github",
"line_count": 267,
"max_line_length": 109,
"avg_line_length": 41.846441947565545,
"alnum_prop": 0.5630537903875414,
"repo_name": "cournape/Bento",
"id": "8641c329c35c92bba14ad22c7354fd3d9ea62dbb",
"size": "111... |
import logging
from mock import patch
from nailgun.db.sqlalchemy.models import IPAddr
from nailgun.db.sqlalchemy.models import NetworkGroup
from nailgun.db.sqlalchemy.models import Node
from nailgun.test.base import BaseIntegrationTest
from nailgun.test.base import fake_tasks
from nailgun.test.base import reverse
lo... | {
"content_hash": "838975bc0bb73295d13a549b5c1b0aaf",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 69,
"avg_line_length": 29.057692307692307,
"alnum_prop": 0.6227663798808736,
"repo_name": "Axam/nsx-web",
"id": "ffd5da13ae3bd734ba84eeb6045217f15d5b33c3",
"size": "2146",
... |
from supriya.tools.requesttools.Request import Request
class GroupDeepFreeRequest(Request):
### CLASS VARIABLES ###
__slots__ = (
)
### INITIALIZER ###
def __init__(
self,
):
Request.__init__(self)
raise NotImplementedError
### PUBLIC METHODS ###
d... | {
"content_hash": "faa3fcdda1fa94c6ea32d8927531a929",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 54,
"avg_line_length": 18.90909090909091,
"alnum_prop": 0.6025641025641025,
"repo_name": "andrewyoung1991/supriya",
"id": "0615a9c21d1893753ba61fc1b10b38b4f178116d",
"size"... |
from numpy import array, outer, ones, size, dot, linalg, zeros, cross, transpose
from ms_optAlgs import ms_optNewton
class SegmentMathError(Exception):
pass
class SegmentGeometry(object):
def __init__(self, p1, p2, p3, p4):
self.setPoints(p1, p2, p3, p4)
def setPoints(self, p1, p2, p3, p4):
self.__a = -... | {
"content_hash": "a2131681bc0bec6d0bd51e93761aecda",
"timestamp": "",
"source": "github",
"line_count": 140,
"max_line_length": 166,
"avg_line_length": 32.371428571428574,
"alnum_prop": 0.6151809355692851,
"repo_name": "DLR-SC/tigl",
"id": "17b6460445d8730cc3a2266109dcb9e1fcb24ec4",
"size": "5283",... |
"""Application API.
Use VAPIX® Application API to upload, control and manage applications and their license keys.
"""
from ...models.applications.application import Application
from ..api import APIItems
URL = "/axis-cgi/applications"
URL_CONTROL = f"{URL}/control.cgi"
URL_LICENSE = f"{URL}/license.cgi"
URL_LIST = f... | {
"content_hash": "742ef3ae41cff8ebc2e435f5fb8ed33e",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 93,
"avg_line_length": 28.344827586206897,
"alnum_prop": 0.6332116788321168,
"repo_name": "Kane610/axis",
"id": "977e665aeeffe2658470171f99c0f00a324d44a9",
"size": "1645",
... |
"""TensorBoard HTTP utilities."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import gzip
import json
import re
import time
import wsgiref.handlers
import six
import tensorflow as tf
from werkzeug import wrappers... | {
"content_hash": "36d31b61039e0dc8c4b8161857829444",
"timestamp": "",
"source": "github",
"line_count": 134,
"max_line_length": 80,
"avg_line_length": 37.5,
"alnum_prop": 0.6929353233830846,
"repo_name": "ville-k/tensorflow",
"id": "81a06a5f14cfb41734154427ad33183db00dcada",
"size": "5714",
"bina... |
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import six
import numpy as np
from matplotlib.testing.decorators import (image_comparison, cleanup,
knownfailureif)
import matplotlib.pyplot as plt
import matplotlib... | {
"content_hash": "30a563fda139741b5f6892f33824cd41",
"timestamp": "",
"source": "github",
"line_count": 162,
"max_line_length": 78,
"avg_line_length": 36.864197530864196,
"alnum_prop": 0.5517414601473544,
"repo_name": "ammarkhann/FinalSeniorCode",
"id": "3fb37031db070069be47268a29eea403a960dd00",
"... |
from creative import Creative
REQUIRED_INLINE = ['AdSystem', 'AdTitle']
REQUIRED_WRAPPER = ['AdSystem', 'VASTAdTagURI']
def validateSettings(settings, requireds):
keys = settings.keys()
for required in requireds:
if required not in keys:
raise Exception("Missing required settings: {requir... | {
"content_hash": "a1f1a686e84d48057b94aae32ec84f7a",
"timestamp": "",
"source": "github",
"line_count": 62,
"max_line_length": 94,
"avg_line_length": 30.64516129032258,
"alnum_prop": 0.6405263157894737,
"repo_name": "selam/python-vast-xml-generator",
"id": "c61ee7c3e1afd59544a51284dfda6c129785aba2",
... |
from collections import defaultdict
import random
class Sarsa:
def __init__(self, actions, epsilon=0.05, gamma=0.99):
self.q = {}
self.dalpha = defaultdict(lambda: defaultdict(int))
self.epsilon = epsilon
self.gamma = gamma
self.actions = actions
def getQ(s... | {
"content_hash": "74575597e4e0ab09cf68ca086c6d9053",
"timestamp": "",
"source": "github",
"line_count": 60,
"max_line_length": 76,
"avg_line_length": 35.75,
"alnum_prop": 0.5062937062937063,
"repo_name": "SahilC/reinforcement-learning",
"id": "d01e8d6d3fd6179bdd79b4aae79b409091084a9c",
"size": "214... |
import os
import shutil
import re
import subprocess
from PIL import Image
from PIL import ImageOps
from cliff.lister import Lister
from clint.textui import colored, puts
from ..libraries.mod_pbxproj import XcodeProject
IGNORE_DIR_SUFFIX = ('.framework', '.embeddedframework', '.bundle', '.xcodeproj')
IGNORE_DIR = ('P... | {
"content_hash": "14c192b98698b3713af0db613c3b506c",
"timestamp": "",
"source": "github",
"line_count": 403,
"max_line_length": 170,
"avg_line_length": 39.593052109181144,
"alnum_prop": 0.5174229130107797,
"repo_name": "sodabiscuit/occult",
"id": "32e82c8ac5c791cd0afd4a979d5936010b717d3f",
"size": ... |
"""
Define Numpy Ufuncs as Models.
"""
import numpy as np
from astropy.modeling.core import Model
trig_ufuncs = ["sin", "cos", "tan", "arcsin", "arccos", "arctan", "arctan2",
"hypot", "sinh", "cosh", "tanh", "arcsinh", "arccosh",
"arctanh", "deg2rad", "rad2deg"]
math_ops = ["add", "sub... | {
"content_hash": "18aa37a4c7d0d10907049a65c514766c",
"timestamp": "",
"source": "github",
"line_count": 83,
"max_line_length": 76,
"avg_line_length": 28.048192771084338,
"alnum_prop": 0.5730240549828178,
"repo_name": "lpsinger/astropy",
"id": "c65eca32bc58b5dca17ce6f9ab3afc0c70c7c61d",
"size": "239... |
def dedupe_and_sort(sequence, first=None, last=None):
"""
De-dupe and partially sort a sequence.
The `first` argument should contain all the items that might appear in
`sequence` and for which the order (relative to each other) is important.
The `last` argument is the same, but matching items will... | {
"content_hash": "1eed99b45da583b59e7f61f64284af57",
"timestamp": "",
"source": "github",
"line_count": 85,
"max_line_length": 92,
"avg_line_length": 33.98823529411764,
"alnum_prop": 0.6531671858774662,
"repo_name": "ic-labs/django-icekit",
"id": "7988d173425e3f26cd84c872663c321c716b47b4",
"size": ... |
"""
Test suite for the brute force module
"""
import unittest
import numpy
class TestSuite(unittest.TestCase):
"""
Test suite for this module
"""
def test_pivot_to_generator(self):
"""
Verifies the conversion of a pivot vector to a generator
"""
from numpy.random im... | {
"content_hash": "44c588b0d588b9b5ecbd472efd3d6c6d",
"timestamp": "",
"source": "github",
"line_count": 412,
"max_line_length": 99,
"avg_line_length": 35.182038834951456,
"alnum_prop": 0.5524663677130045,
"repo_name": "bolverk/kobra",
"id": "5ee7437d43d998218eda4ab3e5b9369e2137b0c1",
"size": "14495... |
import functools
from typing import Any, Mapping
from absl.testing import parameterized
import numpy as np
import scipy.stats
import tensorflow as tf
from private_linear_compression import count_sketching_utils
def perform_encode_decode(gradient: tf.Tensor, gradient_length: tf.Tensor,
kwar... | {
"content_hash": "087287012d545adcfa905bee94aad0e9",
"timestamp": "",
"source": "github",
"line_count": 453,
"max_line_length": 80,
"avg_line_length": 40.21412803532009,
"alnum_prop": 0.6556513147060438,
"repo_name": "google-research/federated",
"id": "73264bb41f3fe8eaa13646e4668b5304824834b2",
"si... |
"""ShutIt module. See http://shutit.tk
"""
from shutit_module import ShutItModule
class coreos_vagrant(ShutItModule):
def build(self, shutit):
# Some useful API calls for reference. See shutit's docs for more info and options:
#
# ISSUING BASH COMMANDS
# shutit.send(send,expect=<default>) - Send a command... | {
"content_hash": "e0da22cd565494becefd375cb5a1bce1",
"timestamp": "",
"source": "github",
"line_count": 136,
"max_line_length": 183,
"avg_line_length": 52.580882352941174,
"alnum_prop": 0.6306810236330583,
"repo_name": "ianmiell/shutit-coreos-vagrant",
"id": "314907853bd5f96a24b95439a12d2f30afa54c93"... |
"""Shared helper functions for BigQuery API classes."""
import base64
from collections import OrderedDict
import datetime
from google.cloud._helpers import UTC
from google.cloud._helpers import _date_from_iso8601_date
from google.cloud._helpers import _datetime_from_microseconds
from google.cloud._helpers import _dat... | {
"content_hash": "a9c61e6cf8426a9f0b0d047e0a75e913",
"timestamp": "",
"source": "github",
"line_count": 625,
"max_line_length": 79,
"avg_line_length": 31.3552,
"alnum_prop": 0.6007552176353523,
"repo_name": "axbaretto/beam",
"id": "bbcbae1674c331e189bc0a55886791232f1c0e97",
"size": "20173",
"bina... |
from argparse import ArgumentParser
from pprint import PrettyPrinter
from . import acf, appinfo, manifest
parser = ArgumentParser(
prog="steamfiles",
description=" Python library for parsing the most common Steam file formats. ",
)
parser.add_argument(
"type", choices=["acf", "appinfo", "manifest"], help=... | {
"content_hash": "285f627ffdc50a6fc03a12aad386783b",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 83,
"avg_line_length": 24.655172413793103,
"alnum_prop": 0.6671328671328671,
"repo_name": "leovp/steamfiles",
"id": "2b1c7aebf888dc3e56f291bc72883b2b1cca68eb",
"size": "715... |
"""
Component to interface with binary sensors.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/binary_sensor/
"""
import asyncio
import logging
import voluptuous as vol
from homeassistant.helpers.entity_component import EntityComponent
from homeassist... | {
"content_hash": "6810c25cf7a8ba7b815965feccaefbfa",
"timestamp": "",
"source": "github",
"line_count": 80,
"max_line_length": 75,
"avg_line_length": 30.9,
"alnum_prop": 0.6452265372168284,
"repo_name": "oandrew/home-assistant",
"id": "38b08fd32b4eeb3c55b3d4b83398a2c802af16a1",
"size": "2472",
"b... |
"""Test op functions against ORACLE."""
from __future__ import with_statement
from tests import op_fixture, capture_context_buffer, \
_no_sql_testing_config, assert_raises_message, staging_env, \
three_rev_fixture, clear_staging_env
from alembic import op, command, util
from sqlalchemy import Integer, Column, F... | {
"content_hash": "354522636df7bef98196c258ae905751",
"timestamp": "",
"source": "github",
"line_count": 156,
"max_line_length": 94,
"avg_line_length": 34.583333333333336,
"alnum_prop": 0.5959221501390176,
"repo_name": "briandailey/alembic",
"id": "a14197d9458e2aca6835e5fb739025fd1917251b",
"size": ... |
from tgbot.entities import RequestingEntity
class FileEntity(RequestingEntity):
def __init__(self, props, api):
props.update({
"id": ("file_id", None),
"size": ("file_size", None),
"mime_type": ("mime_type", None)
})
RequestingEntity.... | {
"content_hash": "8bf05b6bfdef066335ccc46afa3099f2",
"timestamp": "",
"source": "github",
"line_count": 65,
"max_line_length": 94,
"avg_line_length": 31.153846153846153,
"alnum_prop": 0.5219753086419753,
"repo_name": "JacoRuit/tgbot",
"id": "ef9cb9e758a14e98b7e23255d0e83a9fb476c79b",
"size": "2025"... |
from pandac.PandaModules import OdeJointGroup, OdeWorld, OdeHashSpace
class World:
def __init__(self, game):
self.game = game
self.world = OdeWorld()
self.world.setGravity(0, 0, -9.81 * 3)
self.group = OdeJointGroup()
self.space = OdeHashSpace()
self.space.setAutoCollideWorld(self.world)
self.space.setA... | {
"content_hash": "b24223c14ac92c540a69d7cd497b453b",
"timestamp": "",
"source": "github",
"line_count": 101,
"max_line_length": 113,
"avg_line_length": 32.64356435643565,
"alnum_prop": 0.6800121322414316,
"repo_name": "joaofrancese/heavy-destruction",
"id": "3513ec0cc2e014c36e8a9bf4764934bb6f82a604",... |
"""SQLite parser plugin for Google Chrome history database files."""
from dfdatetime import posix_time as dfdatetime_posix_time
from dfdatetime import webkit_time as dfdatetime_webkit_time
from plaso.containers import events
from plaso.containers import time_events
from plaso.lib import definitions
from plaso.parsers... | {
"content_hash": "48eccd53a8c30d0589a292f5bafe498d",
"timestamp": "",
"source": "github",
"line_count": 1037,
"max_line_length": 79,
"avg_line_length": 49.4619093539055,
"alnum_prop": 0.6453053107697106,
"repo_name": "kiddinn/plaso",
"id": "0fd756f4de42c6e8adcd7511a26dddf01f1424ec",
"size": "51316"... |
import simplejson as json
import sys
import re
import re
import string
import unicodedata
import os
class TweetParser(object):
"""docstring for TweetParser
Recibe un tweet en bruto y retorna un tweet con una representación más ligera
Se especifican fields: atributos del tweet los cuales pueden ser ['id','created_at... | {
"content_hash": "3f2e84b3f1352255a8084617923ef9e0",
"timestamp": "",
"source": "github",
"line_count": 101,
"max_line_length": 118,
"avg_line_length": 27.26732673267327,
"alnum_prop": 0.7051561365286856,
"repo_name": "edmunoz/aed",
"id": "34d6f8c2553e9ffc71aaeec84140d5fca71601a4",
"size": "2780",
... |
"""Test multi-worker Keras."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import collections
import copy
import functools
import json
import os
import sys
import threading
from absl.testing import parameterized
# pylint: disable=g-direct-tensorflow-i... | {
"content_hash": "63738db256d3fb8d477793f3b8af894f",
"timestamp": "",
"source": "github",
"line_count": 308,
"max_line_length": 94,
"avg_line_length": 37.782467532467535,
"alnum_prop": 0.6529174185786715,
"repo_name": "petewarden/tensorflow",
"id": "a5597d00a3017529139a8b47d95399fbf3f003f1",
"size"... |
import json
import logging
import random
import signal
from datetime import datetime, timedelta
from enum import IntEnum
from itertools import chain
from threading import Thread
from time import sleep
import six
from django.conf import settings
from django.db import DatabaseError
from django.db import models
from djan... | {
"content_hash": "e3107bedf3d90219e88aabb0ef9f6db2",
"timestamp": "",
"source": "github",
"line_count": 390,
"max_line_length": 183,
"avg_line_length": 38.55897435897436,
"alnum_prop": 0.615241388482511,
"repo_name": "wooyek/django-tasker",
"id": "7d2b16d8c8c581e8ee7b435c8c7330a56345e5bc",
"size": ... |
import json
from thrift.Thrift import TType
class ThriftJSONDecoder(json.JSONDecoder):
"""A decoder that makes python thrift structs JSON deserializable via the standard python json module.
Pass this decoder when reading json, like this:
json.loads(str, cls=text.ThriftJSONDecoder, <other kwargs>)
... | {
"content_hash": "5800afaa4650895739b3ef09aae311f8",
"timestamp": "",
"source": "github",
"line_count": 87,
"max_line_length": 107,
"avg_line_length": 36.64367816091954,
"alnum_prop": 0.678168130489335,
"repo_name": "duydb2/ZTC",
"id": "424adf70a915d175ca1db4df1955d2b891ab65e1",
"size": "3188",
"... |
from .entity_health_state import EntityHealthState
class ServiceHealthState(EntityHealthState):
"""Represents the health state of a service, which contains the service
identifier and its aggregated health state.
:param aggregated_health_state: Possible values include: 'Invalid', 'Ok',
'Warning', 'Er... | {
"content_hash": "78e9307e89902b610be576380731dc29",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 97,
"avg_line_length": 38.77272727272727,
"alnum_prop": 0.6811254396248535,
"repo_name": "v-iam/azure-sdk-for-python",
"id": "2a60453cb87f0e793f591dce99cdf3b31cc5e5f4",
"si... |
import subprocess, os, sys
from reverseZone_naming import reverseZone_name
from netaddr import *
zone_files_path="/etc/bind/zones"
def remove_forward_record():
host_name_to_be_removed= sys.argv[1]
domain_name= sys.argv[2]
os.chdir(zone_files_path)
forward_zone_file_name="{0}{1}".format("db.",domain_name)
readFi... | {
"content_hash": "710a9ad277c4d50ae2269ad22f248512",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 80,
"avg_line_length": 27.2,
"alnum_prop": 0.7237394957983193,
"repo_name": "anilveeramalli/cloudify-azure-plugin",
"id": "d9fa065ffdae864cb7d21bd5e168488e9863ef7a",
"size"... |
class Solution(object):
def kthSmallest(self, root, k):
"""
:type root: TreeNode
:type k: int
:rtype: int
"""
stack = [root]
while root.left:
stack.append(root.left)
root = root.left
while True:
curr = stack.pop()
... | {
"content_hash": "041f4bed63c0f0fcb88b5b06d24251d6",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 43,
"avg_line_length": 24.44,
"alnum_prop": 0.41734860883797054,
"repo_name": "daicang/Leetcode-solutions",
"id": "e3f9c650aea6636a3cecbe24e3fbf8f9a51c839e",
"size": "813",... |
import theano
import theano.tensor as T
import numpy as np
from util import *
class BaseGRULayer( object ):
"""
Implements a GRU layer
"""
def __init__(self, input_width, output_width, activation_shift=0.0, name=None, dropout_keep=1, dropout_input=False, dropout_output=True):
"""
Para... | {
"content_hash": "907725babe2eb4deee7188d9b818da1d",
"timestamp": "",
"source": "github",
"line_count": 117,
"max_line_length": 141,
"avg_line_length": 38.51282051282051,
"alnum_prop": 0.5876608965823347,
"repo_name": "hexahedria/gated-graph-transformer-network",
"id": "84711d9173c904bb8a1079dfb61c3b... |
import pytest
import numpy as np
import nnabla.functions as F
from nbla_test_utils import (
function_tester,
list_ctx_and_func_name)
def ref_broadcast(x, shape):
return x * np.ones(shape, dtype=x.dtype)
def get_combination(n):
if n == 0:
return [(n, np.array([], dtype=np.bool))]
all_com... | {
"content_hash": "1ddc45f8ef05870a8332ce47455e0599",
"timestamp": "",
"source": "github",
"line_count": 101,
"max_line_length": 93,
"avg_line_length": 36.78217821782178,
"alnum_prop": 0.5911170928667564,
"repo_name": "sony/nnabla",
"id": "efa21b57d52c86a9d323a875a55e162562c3e35e",
"size": "4358",
... |
import sys
class Terminal(object):
"""An interface for text entry and display."""
def __init__(self, environ):
self.environ = environ
@property
def primary_prompt_string(self):
"""The prompt first seen at the command line. Defaults to "$ "."""
return self.environ.get("PS1", "$... | {
"content_hash": "35ff71aa394f5500bdb617f203008282",
"timestamp": "",
"source": "github",
"line_count": 78,
"max_line_length": 77,
"avg_line_length": 28.012820512820515,
"alnum_prop": 0.5725400457665903,
"repo_name": "Ceasar/twosheds",
"id": "fc86b6fee4d3884ff780ea160ef839ffef74dbb5",
"size": "2185... |
import multiprocessing
from Provider import Provider
from ProviderAgentException import ProviderException
from foundation.FoundationException import FoundationException
import foundation.agent_properties
import MySQLdb
import logging
import datetime
import os
import sys
import re
import inspect
logger = logging.getL... | {
"content_hash": "cf75ad3f3321412178123a5a49e14970",
"timestamp": "",
"source": "github",
"line_count": 191,
"max_line_length": 128,
"avg_line_length": 38.60732984293194,
"alnum_prop": 0.6311364252780038,
"repo_name": "lmarent/network_agents_ver2_python",
"id": "e7c199c2c698b54dbcf44aeac84aa4fa0cd98d... |
from __future__ import unicode_literals
import datetime
import sys
from django.test import TestCase, override_settings
from django.utils import six
from django_postgres_pgpfields import proxy
from django_postgres_pgpfields import fields
from .factories import EncryptedModelFactory
from .models import EncryptedModel... | {
"content_hash": "da09c11238e2331556157314621ad351",
"timestamp": "",
"source": "github",
"line_count": 204,
"max_line_length": 97,
"avg_line_length": 39.661764705882355,
"alnum_prop": 0.6620936843406254,
"repo_name": "coldmind/django-postgres-pgpfields",
"id": "cd80278fa28dd89906808b12a722eda5fdf43d... |
"""
Uses the unittest module to test this app with `manage.py test`.
"""
# from django.test import TestCase
from unittest import TestCase, main
import doctest
import pug.nlp.util
class NLPDocTest(TestCase):
def test_module(self, module=None):
if module is not None:
failure_count, test_count ... | {
"content_hash": "3564f61185f07190c063c66cb8a54e78",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 145,
"avg_line_length": 30.666666666666668,
"alnum_prop": 0.6152173913043478,
"repo_name": "hobson/pug",
"id": "64ef787b3f3d2ccc9640bf32eebeeae4866029fc",
"size": "942",
... |
try:
import usocket as socket, ussl as ssl, uerrno as errno, sys
except:
import socket, ssl, errno, sys, time, select
def test_one(site, opts):
ai = socket.getaddrinfo(site, 443)
addr = ai[0][-1]
print(addr)
# Connect the raw socket
s = socket.socket()
s.setblocking(False)
try:
... | {
"content_hash": "19175d47421b0273eb7ca25485a45e21",
"timestamp": "",
"source": "github",
"line_count": 116,
"max_line_length": 74,
"avg_line_length": 26.887931034482758,
"alnum_prop": 0.4597627444693812,
"repo_name": "bvernoux/micropython",
"id": "54abc6966fc05e5cb1cea27a7237291bceca79ce",
"size":... |
import gzip
import json
import os
from django.conf import settings
from django.contrib import messages
from django.contrib.auth.decorators import login_required
from django.core.paginator import EmptyPage
from django.core.paginator import PageNotAnInteger
from django.core.paginator import Paginator
from django.db.mode... | {
"content_hash": "03be12aadbb975058c60db648515c6e1",
"timestamp": "",
"source": "github",
"line_count": 605,
"max_line_length": 189,
"avg_line_length": 38.65289256198347,
"alnum_prop": 0.5854180029933718,
"repo_name": "raonyguimaraes/mendelmd",
"id": "187b0de83501a8ff520c60464dc8a280aaaa514f",
"siz... |
"""
:codeauthor: Jayesh Kariya <jayeshk@saltstack.com>
"""
import pytest
import salt.modules.sdb as sdb
from salt.exceptions import SaltInvocationError
@pytest.fixture
def configure_loader_modules():
return {sdb: {}}
def test_get():
"""
Test if it gets a value from a db, using a uri in the form of
... | {
"content_hash": "ea134d63e6c39a884e7fada0b391eebc",
"timestamp": "",
"source": "github",
"line_count": 61,
"max_line_length": 84,
"avg_line_length": 26.262295081967213,
"alnum_prop": 0.6491885143570537,
"repo_name": "saltstack/salt",
"id": "01d1e1a627333dc6c1ac795ce6a54d32994b6667",
"size": "1602"... |
import os
import cherrypy
import json
PATH = os.path.abspath(os.path.dirname(__file__))
class Root(object):
class api(object):
pass
class RestObject(object):
exposed = True
def __init__(self,data):
self.data = data
def GET(self,*args,**kwargs):
cherrypy.... | {
"content_hash": "566a78d05f4bf542af829206430972a7",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 73,
"avg_line_length": 23.80952380952381,
"alnum_prop": 0.528,
"repo_name": "senormeow/durandal-example",
"id": "edb77c18180a1e177e447d3b16c1fbea92ca4823",
"size": "1000",
... |
from app.models import Tag
def get_all_tags():
query = Tag.query.order_by(Tag.created_on.desc())
return query
def get_tag_by_id(id):
query = Tag.query.filter_by(id=id).first_or_404()
return query
def search_tags(string):
query = Tag.query.filter(Tag.name.contains(string))
return query
| {
"content_hash": "68f5877413c73f6cb04d503da4bcd191",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 55,
"avg_line_length": 19.75,
"alnum_prop": 0.6740506329113924,
"repo_name": "maxnovais/Flapy_Blog",
"id": "daca8e4d6b32084907e644de68c7a07b2a006d24",
"size": "338",
"bin... |
from cms.models import CMSPlugin, Placeholder
from cms.models.aliaspluginmodel import AliasPluginModel
from cms.models.placeholderpluginmodel import PlaceholderReference
from cms.plugin_base import CMSPluginBase, PluginMenuItem
from cms.plugin_pool import plugin_pool
from cms.plugin_rendering import render_placeholder
... | {
"content_hash": "8f419a20dee15607d567209a172e63f2",
"timestamp": "",
"source": "github",
"line_count": 108,
"max_line_length": 109,
"avg_line_length": 39.72222222222222,
"alnum_prop": 0.6494172494172494,
"repo_name": "wuzhihui1123/django-cms",
"id": "32fc603d84a375cd7b6fbd59a9e66cd498a0a0c2",
"siz... |
import sys
import time
import stackless
from cogen.core.schedulers import Scheduler
from cogen.core.coroutines import coroutine
from cogen.core import events
@coroutine
def mycoro():
while 1:
yield events.Sleep(1)
print '#'
sched = Scheduler()
sched.add(mycoro)
sched_iter = sched.it... | {
"content_hash": "5220cd0e0138346157f62ed59630283d",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 49,
"avg_line_length": 19.71875,
"alnum_prop": 0.6465927099841522,
"repo_name": "pombredanne/cogen",
"id": "91166973424c6144a3ab806ece2075dbf2b05b02",
"size": "631",
"bin... |
import os
import re
import subprocess
import sys
import yaml
index = {}
# Improved 'libcache' data importer. Turns .a.cache files into YAML by
# invoking the proprietary parser directly.
# demangles SunPro mangled names - partially. Arguments aren't parsed yet.
def demangle(mangled):
if mangled.startswith("__1c"... | {
"content_hash": "95f06835cdb9c8f224d2af87de78fd72",
"timestamp": "",
"source": "github",
"line_count": 175,
"max_line_length": 116,
"avg_line_length": 38.49142857142857,
"alnum_prop": 0.580166270783848,
"repo_name": "CodethinkLabs/software-dependency-visualizer",
"id": "68d541fc074a7fe243b5e74780688... |
import sys
import re
import json
# internal function, do not call directly
def _jsonquery(J, exprs):
try: # pop the first expression
expr = exprs[0]
exprs = exprs[1:]
except IndexError: # or note terminal case
expr = None
def recur(Js): # recurrence helper
for s in _jsonquer... | {
"content_hash": "c52b419cd5cfefae67342506fd6509fb",
"timestamp": "",
"source": "github",
"line_count": 73,
"max_line_length": 76,
"avg_line_length": 38.80821917808219,
"alnum_prop": 0.5757147899752912,
"repo_name": "joefutrelle/ladder",
"id": "0bd57171701fb3a67c77e4d1b7f2cf4ba27e2c7d",
"size": "28... |
assert [foo, bar], "No AssertionError"
assert "There is an AssertionError" # [assert-on-string-literal]
assert "" # [assert-on-string-literal]
| {
"content_hash": "ee3b9556dd524cb4b97c2d9ff8eff5d4",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 64,
"avg_line_length": 47.666666666666664,
"alnum_prop": 0.7342657342657343,
"repo_name": "ruchee/vimrc",
"id": "14e7d4c556bc22b20bacb54e3b7d552696ec0718",
"size": "206",
... |
from __future__ import print_function
from PIL import Image
im = Image.open("cone.png")
print(im.format, im.size, im.mode)
| {
"content_hash": "01c31876ee06894d8dd46ffa54be53f6",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 37,
"avg_line_length": 20.833333333333332,
"alnum_prop": 0.72,
"repo_name": "wolftype/pony",
"id": "a5b925b4e455d7aae2f4b42089892382351ae260",
"size": "125",
"binary": fal... |
import logging
from datetime import timedelta
from django import forms
from django.forms import widgets
import happyforms
from tower import ugettext as _
from tower import ugettext_lazy as _lazy
import mkt
from mkt.api.forms import CustomNullBooleanSelect
from mkt.reviewers.models import CannedResponse
from mkt.revi... | {
"content_hash": "93f066666f3e544e56eff623e05ded13",
"timestamp": "",
"source": "github",
"line_count": 270,
"max_line_length": 79,
"avg_line_length": 37.337037037037035,
"alnum_prop": 0.6138279932546374,
"repo_name": "kumar303/zamboni",
"id": "db1fba6ca987d11ddc0ce908f654df9b6d51cac5",
"size": "10... |
from oslo_config import cfg
retry_engine_group = cfg.OptGroup('retry_engine',
title='Retry Engine Options',
help='Options under this group allow to '
'configure valid connection '
... | {
"content_hash": "01e6f4cdacf31bc6efdd3fb220a2c0f7",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 75,
"avg_line_length": 31.59259259259259,
"alnum_prop": 0.5392731535756154,
"repo_name": "stackforge/monasca-notification",
"id": "83b3ff9f088bd731172b8c36f98fd25a517a3177",
... |
"""BeautifulSoup document parser/page scraper.
Requires:
pip install beautifulsoup4
pip install requests
"""
import requests
from bs4 import BeautifulSoup
html = requests.get('http://gog.com/').text
soup = BeautifulSoup(html)
print "\nCleaned up content:\n%s" % soup.prettify()
print "\nContent of the <t... | {
"content_hash": "968fc29fed671c23e1fb5d1f7eb0329d",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 86,
"avg_line_length": 27.341463414634145,
"alnum_prop": 0.6717216770740411,
"repo_name": "jeremyosborne/python",
"id": "a05e9a59d34fc10de165e823ceee40315290e60d",
"size": ... |
from generator.textutil import indent, dedent
from generator.Enum import Enum
from generator.Message import Message
import re
class File:
def __init__(self, f, base_file):
# Store relevant information from our class in our object
self.package = f.package
self.name = f.name
self.b... | {
"content_hash": "fedb6a110f528b0e7b5e603d92130489",
"timestamp": "",
"source": "github",
"line_count": 142,
"max_line_length": 107,
"avg_line_length": 32.58450704225352,
"alnum_prop": 0.5117786902960881,
"repo_name": "Fastcode/NUClearExample",
"id": "b5b0f07543b7e6743206d94ec85ada047677ae3f",
"siz... |
"""
Copyright 2011 Dmitry Nikulin
This file is part of Captchure.
Captchure is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later ... | {
"content_hash": "91fc19b7504cdc6663467582077ae36a",
"timestamp": "",
"source": "github",
"line_count": 322,
"max_line_length": 120,
"avg_line_length": 34.19565217391305,
"alnum_prop": 0.5836890382344928,
"repo_name": "Apkawa/simple-captcha-ocr-opencv",
"id": "4b7abf49da28aca5f998a60b65940d1996d18876... |
MIN_ADDRESS = 0
MAX_ADDRESS = 4294967295
def parse_filter(line):
start, end = map(int, line.split('-'))
return (start, end)
def is_allowed(filters, address):
for min_range, max_range in filters:
if address >= min_range and address <= max_range:
return False
if min_range > addre... | {
"content_hash": "84194539811483dc5adf73da544114f9",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 57,
"avg_line_length": 24.96969696969697,
"alnum_prop": 0.6080097087378641,
"repo_name": "stdgy/adventofcode",
"id": "d71e87e03aaf48df3762403540a1de91ea829577",
"size": "82... |
import pip
import xmlrpclib
from django.conf import settings
from django.core.management.base import BaseCommand, CommandError
'''
originally based off of:
https://gist.github.com/3555765
which was originally based off of:
http://code.activestate.com/recipes/577708/
'''
class Command(BaseCommand):... | {
"content_hash": "1912e073839ff2e18a32ec7971648a94",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 125,
"avg_line_length": 36.285714285714285,
"alnum_prop": 0.6133858267716535,
"repo_name": "adamfast/django-librarywatch",
"id": "3e8ce9be41bea5a66ad241914cf2f59f153e76fd",
... |
"""
OpenFlow 1.5 definitions.
"""
from ryu.lib import type_desc
from ryu.ofproto import oxm_fields
from ryu.ofproto import oxs_fields
from struct import calcsize
# enum ofp_port_no
# Port numbering. Ports are numbered starting from 1.
OFPP_MAX = 0xffffff00 # Maximum number of physical and logical
... | {
"content_hash": "ccf1bb755350ed4b02d6b024ead22db4",
"timestamp": "",
"source": "github",
"line_count": 1809,
"max_line_length": 81,
"avg_line_length": 41.89110005527916,
"alnum_prop": 0.6746150090392051,
"repo_name": "elahejalalpour/ELRyu",
"id": "31e5cc05603a312133856dffa5b38cf0ae3b9d6e",
"size":... |
"""
.. module:: __main__
:platform: linux
:synopsis: Special main entry point.
.. moduleauthor:: Paul Fanelli <paul.fanelli@gmail.com>
.. modulecreated:: 6/28/15
"""
import sys
from planet_alignment.app.app_factory import AppFactory
from planet_alignment.cmd.cmd_parser import CommandParser
def main(argv=None... | {
"content_hash": "028f63cf0b22949488c3680eadb301dc",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 57,
"avg_line_length": 21,
"alnum_prop": 0.645320197044335,
"repo_name": "paulfanelli/planet_alignment",
"id": "e53802d1978408768cd39ae7703555bfb6de8f55",
"size": "609",
... |
from __future__ import absolute_import
from django.core import mail
from django.contrib.auth.models import User
from sentry.models import Project, ProjectKey, Group, Event, Team, \
MessageFilterValue, MessageCountByMinute, FilterValue, PendingTeamMember
from tests.base import TestCase
class ProjectTest(TestCase)... | {
"content_hash": "9423902752983d17eb494aa572d10a87",
"timestamp": "",
"source": "github",
"line_count": 89,
"max_line_length": 126,
"avg_line_length": 44.42696629213483,
"alnum_prop": 0.6820940819423369,
"repo_name": "chayapan/django-sentry",
"id": "b767495a14dfe87bc0c5738a20cf69a35e642747",
"size"... |
from __future__ import unicode_literals
import datetime
import itertools
import unittest
from operator import attrgetter
from freezegun import freeze_time
from freezegun.api import FakeDatetime
from tests.mock import MagicMock, Mock
from streamlink.stream.dash_manifest import MPD, MPDParsers, MPDParsingError, utc, R... | {
"content_hash": "92694ed4268bb2105ddaaf63834194c1",
"timestamp": "",
"source": "github",
"line_count": 240,
"max_line_length": 113,
"avg_line_length": 51.675,
"alnum_prop": 0.5474923399451701,
"repo_name": "back-to/streamlink",
"id": "9270552abebd86ddb21fb7cca45906f2f9d07a92",
"size": "12402",
"... |
import scrapy
from opensecrets.items import ComitteeFunds
import logging
import re
class ComitteesSpider(scrapy.Spider):
name = "comittees"
allowed_domains = ["www.opensecrets.org"]
start_urls = (
'http://www.opensecrets.org/cmteprofiles/',
)
def parse(self, response):
out=["http://... | {
"content_hash": "6cef14542e6b53543d514041c17f9375",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 131,
"avg_line_length": 39.142857142857146,
"alnum_prop": 0.5855057351407716,
"repo_name": "trcook/open_secrets_scrape",
"id": "c50154be9337a7f1aada41245c0407957536eb93",
"... |
import sys
import onnx
from onnx import helper, shape_inference
from onnx import TensorProto
import numpy as np
from onnx import numpy_helper
if len(sys.argv) < 2:
print("Please give model path...")
exit(1)
input_model_name = sys.argv[1]
output_model_name = input_model_name[:-5] + "_optimized.onnx"
model = o... | {
"content_hash": "e38b470f9bea75268a5a5d4119afb5bd",
"timestamp": "",
"source": "github",
"line_count": 332,
"max_line_length": 110,
"avg_line_length": 34.95180722891566,
"alnum_prop": 0.6131506377111341,
"repo_name": "microsoft/onnxruntime",
"id": "8c0be5b08c04a0f409cd43e7b7a08b11675775bf",
"size"... |
from novaclient.v1_1.flavors import *
from novaclient.base import Manager
"""novaclient/v1_1/flavors/FlavorManager"""
class CustomeFlavorManager(FlavorManager):
def _data(self, url, response_key, obj_class=None, body=None):
if body:
_resp, body = self.api.client.post(url, body=body)
else:
_resp, body ... | {
"content_hash": "345a13ac7178592d4575fa721fac7c19",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 81,
"avg_line_length": 34.08,
"alnum_prop": 0.7007042253521126,
"repo_name": "khandavally/devstack",
"id": "a2aedd623c5e3e140409f9c3cc5b4c3f89bfb5d0",
"size": "1704",
"bi... |
from rest_framework import generics, permissions as drf_permissions
from rest_framework.exceptions import ValidationError, NotFound
from framework.auth.oauth_scopes import CoreScopes
from website.project.model import Q, Node
from api.base import permissions as base_permissions
from api.base.views import JSONAPIBaseVie... | {
"content_hash": "4c9c5f13465aa880901111a9bdfc0cf9",
"timestamp": "",
"source": "github",
"line_count": 312,
"max_line_length": 130,
"avg_line_length": 43.23076923076923,
"alnum_prop": 0.6708926453143536,
"repo_name": "brandonPurvis/osf.io",
"id": "04cfb389293f685b46d4feac309c2409b4da8c97",
"size":... |
from core import kde
class Restart4(kde.KDE4Action):
"""Restart Yakuake, open terminal instances will get killed."""
def binary_dependencies(self):
return ['yakuake']
def execute(self):
return kde.restart('org.kde.yakuake', 'yakuake')
class Restart5(kde.KDE5Action):
"""Restart Yakuak... | {
"content_hash": "5377d876ecc8d071ee2792d464bf8047",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 67,
"avg_line_length": 26.894736842105264,
"alnum_prop": 0.6673189823874756,
"repo_name": "nielsvm/kde4-profiles",
"id": "c6f2e779c8e28d1ff16485fd3b19a75abeb64e5c",
"size":... |
import unittest
from airflow.contrib.operators.gcs_download_operator \
import GoogleCloudStorageDownloadOperator
from tests.compat import mock
TASK_ID = 'test-gcs-download-operator'
TEST_BUCKET = 'test-bucket'
TEST_OBJECT = 'dir1/test-object'
LOCAL_FILE_PATH = '/home/airflow/gcp/test-object'
class GoogleCloudSt... | {
"content_hash": "1bcd8ffc4d2cabc9faf9b25744259a30",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 89,
"avg_line_length": 39.16,
"alnum_prop": 0.6322778345250255,
"repo_name": "owlabs/incubator-airflow",
"id": "c366afed162eaf49507141fa9154bcaa1f529b4c",
"size": "1791",
... |
from mozi.layers.activation import RELU, Softmax
from mozi.layers.normalization import LRN
from mozi.layers.convolution import Convolution2D, Pooling2D
from mozi.layers.linear import Linear
from mozi.layers.noise import Dropout
from mozi.layers.misc import Flatten
from mozi.layers.template import Template
class Alexn... | {
"content_hash": "4746eaf35748abadb0b3ffdef93b357a",
"timestamp": "",
"source": "github",
"line_count": 81,
"max_line_length": 107,
"avg_line_length": 43.95061728395062,
"alnum_prop": 0.573876404494382,
"repo_name": "hycis/Mozi",
"id": "21ce1b4f651d53a87c8089f589d30031686cfb2e",
"size": "3561",
"... |
import sys
file=sys.argv[1]
genbank_record=open(file, 'r')
n = 0
l = []
for line in genbank_record:
# print line
if line.startswith("SOURCE"):
newline=line.strip()
source_divided=(newline.split(None, 1))
print source_divided[1]
if "ORGANISM" in line:
newline=line.str... | {
"content_hash": "b1552bf1887d65809e65638b61bfbbbf",
"timestamp": "",
"source": "github",
"line_count": 77,
"max_line_length": 155,
"avg_line_length": 29.61038961038961,
"alnum_prop": 0.6355263157894737,
"repo_name": "jooolia/phylo_temporal_jericho",
"id": "19560b32348933469aba3eea31d2cdaba2bd0fcc",
... |
import os.path
from datetime import date
from sqlite3 import dbapi2 as sqlite
import simplejson as json
import xbmcgui
import common
import connection
import database_common as db_common
def create():
c = _database.cursor()
c.execute('''CREATE TABLE series
(content_id INTEGER PRIMARY KEY,
... | {
"content_hash": "57d9b4298317dce2ebf8440b67600efc",
"timestamp": "",
"source": "github",
"line_count": 576,
"max_line_length": 154,
"avg_line_length": 33.3125,
"alnum_prop": 0.542995622263915,
"repo_name": "bradyemerson/plugin.video.starzplay",
"id": "787351278de65dda85178c0131a556b51789ad36",
"si... |
import tests.model_control.test_ozone_custom_models_enabled as testmod
testmod.build_model( ['Logit'] , ['Lag1Trend'] , ['Seasonal_MonthOfYear'] , ['MLP'] ); | {
"content_hash": "5844c585d52563a586535f4ea62eb59a",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 86,
"avg_line_length": 39.75,
"alnum_prop": 0.710691823899371,
"repo_name": "antoinecarme/pyaf",
"id": "eb3366505a489519f6abeab6ca20e499073751fb",
"size": "159",
"binary":... |
from django.db import models
from django.db.models.deletion import ProtectedError
from .testament import Testament
from django_rv_apps.apps.believe_his_prophets.models.language import Language
class Book(models.Model):
id = models.AutoField(
primary_key=True,
editable=False)
testament = models... | {
"content_hash": "df0bef4e0336e6cf7fe4eb3fdd46f8fe",
"timestamp": "",
"source": "github",
"line_count": 57,
"max_line_length": 77,
"avg_line_length": 28.87719298245614,
"alnum_prop": 0.6336573511543135,
"repo_name": "davrv93/creed-en-sus-profetas-backend",
"id": "d7ef1df145f189254ce508f5cf4292eff111f... |
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import symbol_database as _symbol_database
# @@protoc_ins... | {
"content_hash": "52295f534f7ae5c202b7b60ddc1b4101",
"timestamp": "",
"source": "github",
"line_count": 95,
"max_line_length": 372,
"avg_line_length": 39.88421052631579,
"alnum_prop": 0.7120612298759568,
"repo_name": "rshriram/api",
"id": "28e678d3e58bb5f3474b1f63e0c402fe3e566dba",
"size": "3898",
... |
from unittest import mock
import os
import platform
import requests
import tempfile
import shutil
import unittest
import yaml
from knack import CLI
from azure.cli.core._config import GLOBAL_CONFIG_DIR, ENV_VAR_PREFIX
from azure.cli.core.cloud import get_active_cloud
from azure.cli.core.profiles import get_sdk, Resour... | {
"content_hash": "ec9af0eae556a0ba56d28b4487448bc1",
"timestamp": "",
"source": "github",
"line_count": 841,
"max_line_length": 168,
"avg_line_length": 46.30083234244947,
"alnum_prop": 0.5673746115719459,
"repo_name": "yugangw-msft/azure-cli",
"id": "ae84b8174fef5e7efff8d9941ec5a13f8c708d69",
"size... |
"""Tests for object_detection.meta_architectures.faster_rcnn_meta_arch."""
from absl.testing import parameterized
import numpy as np
import tensorflow as tf
from object_detection.meta_architectures import faster_rcnn_meta_arch_test_lib
class FasterRCNNMetaArchTest(
faster_rcnn_meta_arch_test_lib.FasterRCNNMetaA... | {
"content_hash": "4b3b2aa40df48a668415026bf9d6f089",
"timestamp": "",
"source": "github",
"line_count": 426,
"max_line_length": 80,
"avg_line_length": 46.413145539906104,
"alnum_prop": 0.550070807202104,
"repo_name": "derekjchow/models",
"id": "810d65a232484c2259c95a51bc6d553193c184c9",
"size": "20... |
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
import django_extensions.db.fields
class Migration(migrations.Migration):
initial = True
dependencies = [
('cfp', '0014_auto_20170605_1545'),
('events', '0004_auto_20170516_1156... | {
"content_hash": "237739b2f64d597c83b05f10488f14fa",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 140,
"avg_line_length": 41.63636363636363,
"alnum_prop": 0.6069868995633187,
"repo_name": "WebCampZg/conference-web",
"id": "2c2ede86f030b40d5b44af544beac5dfd79e69e8",
"siz... |
from google.cloud import speech_v1p1beta1 as speech
def sample_recognize(storage_uri):
"""
Performs synchronous speech recognition on an audio file
Args:
storage_uri URI for audio file in Cloud Storage, e.g. gs://[BUCKET]/[FILE]
"""
client = speech.SpeechClient()
# storage_uri = 'gs:/... | {
"content_hash": "17e1efae933d787939ae36a11fb77977",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 80,
"avg_line_length": 26.344827586206897,
"alnum_prop": 0.6557591623036649,
"repo_name": "googleapis/python-speech",
"id": "d40e6d32f1c89bdc3d97a23504e6ea3e393529fd",
"siz... |
# Copyright (c) 2016 Croatian Meteor Network
# 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": "7c5c1e1875ac6c35a24181f68fbd0408",
"timestamp": "",
"source": "github",
"line_count": 318,
"max_line_length": 141,
"avg_line_length": 29.830188679245282,
"alnum_prop": 0.5829643685431162,
"repo_name": "CroatianMeteorNetwork/MeteorRadiometer",
"id": "0b420bad545146f0af129d61a8a56532f... |
from django import template
from webquills.core.models import Image
# https://docs.djangoproject.com/en/3.2/howto/custom-template-tags/
register = template.Library()
@register.simple_tag
def image_url(instance: Image, op: str = "", **kwargs):
if op:
return instance.get_thumb(op, **kwargs).url
elif ... | {
"content_hash": "3418feec0d4ec9033c6f06bc149beea1",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 87,
"avg_line_length": 29.15625,
"alnum_prop": 0.654876741693462,
"repo_name": "veselosky/webquills",
"id": "4ea727dd991ef8637a75ceb170e63a40334fa8f0",
"size": "933",
"bi... |
import numpy
from numpy.testing import assert_raises
from fuel import config
from fuel.datasets import CIFAR100
from fuel.streams import DataStream
from fuel.schemes import SequentialScheme
def test_cifar100():
train = CIFAR100('train', load_in_memory=False)
assert train.num_examples == 50000
handle = tr... | {
"content_hash": "1a07d1e13583529351ced7d8ed7d3dbb",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 78,
"avg_line_length": 32.06818181818182,
"alnum_prop": 0.6265060240963856,
"repo_name": "EderSantana/fuel",
"id": "689a7b7e2ce44b7b77f8c413a3a8c8f9e54b89ce",
"size": "1411... |
import main
import robocup
import constants
import math
#
# Returns an array of their robots that we can chip over based on the current ball position
# this only operates on the distances from the ball to each robot and the Chip distances in constants.py
#
def chippable_robots():
bp = main.ball().pos
return ... | {
"content_hash": "6441159ce22b4d26a2070f1fd129c6e2",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 104,
"avg_line_length": 30.705882352941178,
"alnum_prop": 0.6934865900383141,
"repo_name": "JNeiger/robocup-software",
"id": "448b55009dd37360da0174705c275bcd2c185fac",
"si... |
import json
import sys
from nltk import RegexpTokenizer, OrderedDict
from nltk.stem.snowball import RussianStemmer
genres = {
1: "Rock",
2: "Pop",
3: "Rap & Hip - Hop",
4: "Easy Listening",
5: "Dance & House",
6: "Instrumental",
7: "Metal",
21: "Alternative",
8... | {
"content_hash": "4fadc238a4b28cb45276cb3732328030",
"timestamp": "",
"source": "github",
"line_count": 67,
"max_line_length": 119,
"avg_line_length": 31.567164179104477,
"alnum_prop": 0.5314420803782506,
"repo_name": "AlekseyLobanov/gotohack",
"id": "97f5189cce7f06aa2a35e12ea78380e454f342d5",
"siz... |
"""
Auto-generated class for AYSStep
"""
from .Job import Job
from . import client_support
class AYSStep(object):
"""
auto-generated. don't touch.
"""
@staticmethod
def create(jobs, number):
"""
:type jobs: list[Job]
:type number: int
:rtype: AYSStep
"""
... | {
"content_hash": "dab86e705613d9bd574ac0750a356c9d",
"timestamp": "",
"source": "github",
"line_count": 66,
"max_line_length": 107,
"avg_line_length": 28.954545454545453,
"alnum_prop": 0.5724751439037153,
"repo_name": "Jumpscale/ays9",
"id": "971a157506bba1668bb31bfc4fe4cbe2b06bba6e",
"size": "1911... |
'''
--------------------------------------------------------------
Before running this Airflow module...
Install StarThinker in cloud composer from open source:
pip install git+https://github.com/google/starthinker
Or push local code to the cloud composer plugins directory:
source install/deploy.sh
... | {
"content_hash": "2b71a4efde3c6ff08387550c43ca8b76",
"timestamp": "",
"source": "github",
"line_count": 116,
"max_line_length": 87,
"avg_line_length": 27.96551724137931,
"alnum_prop": 0.5283600493218249,
"repo_name": "google/starthinker",
"id": "94e36910830b90c8c903b959014af75ee54331af",
"size": "3... |
import logging
import re
import uuid
import random
from urllib.parse import urlparse
from multiprocessing import Process
import requests
from lxml import etree
from twisted.internet import reactor
from scrapy.crawler import CrawlerRunner
from scrapy.utils.log import configure_logging
from scrapy.utils.project import... | {
"content_hash": "6b37f849bcef45df9cc2e12947df46ce",
"timestamp": "",
"source": "github",
"line_count": 241,
"max_line_length": 68,
"avg_line_length": 30.406639004149376,
"alnum_prop": 0.5989355895196506,
"repo_name": "hack4code/BlogSpider",
"id": "66aae574d48f5626cfaff8848dfec6b0bd819ce5",
"size":... |
""" Python 'uu_codec' Codec - UU content transfer encoding
Unlike most of the other codecs which target Unicode, this codec
will return Python string objects for both encode and decode.
Written by Marc-Andre Lemburg (mal@lemburg.com). Some details were
adapted from uu.py which was written by Lance Ell... | {
"content_hash": "188c9a2f4eab9cc59f849886f0897245",
"timestamp": "",
"source": "github",
"line_count": 112,
"max_line_length": 70,
"avg_line_length": 28.285714285714285,
"alnum_prop": 0.6300505050505051,
"repo_name": "neopoly/rubyfox-server",
"id": "6ef8369d53c615b5e4b4ea7dd41990fa707806fe",
"size... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.