text stringlengths 4 1.02M | meta dict |
|---|---|
"""An implementation of Matching Layer."""
import typing
import tensorflow as tf
from keras.engine import Layer
class MatchingLayer(Layer):
"""
Layer that computes a matching matrix between samples in two tensors.
:param normalize: Whether to L2-normalize samples along the
dot product axis befor... | {
"content_hash": "fce33d4ac6969d6d820c99af4253ddd1",
"timestamp": "",
"source": "github",
"line_count": 140,
"max_line_length": 78,
"avg_line_length": 41.09285714285714,
"alnum_prop": 0.5235529289066574,
"repo_name": "faneshion/MatchZoo",
"id": "54dead2a7b4440161ac8352d249bc199d7c1d677",
"size": "5... |
import json
from flask import Flask, request, abort
from st2reactor.sensor.base import Sensor
TRIGGER_REF = 'circle_ci.build_event'
class CircleCIWebhookSensor(Sensor):
def setup(self):
self.host = self._config['host']
self.port = self._config['port']
self._endpoints = self._config['end... | {
"content_hash": "6742148cb98437611e670d81efae12c1",
"timestamp": "",
"source": "github",
"line_count": 60,
"max_line_length": 95,
"avg_line_length": 30.366666666666667,
"alnum_prop": 0.5998902305159166,
"repo_name": "StackStorm/st2contrib",
"id": "761cd57538bbf89495487aa25d00e67b99921004",
"size":... |
from __future__ import unicode_literals
from setuptools import setup, find_packages
setup(
name='reQuiver',
version='0.0.1',
packages=find_packages(exclude=['*test*']),
install_requires=['requests', 'beautifulsoup4', 'CacheControl'],
setup_requires=["nose>=1.3"],
tests_require=["httmock"],
... | {
"content_hash": "615819dc500c889c5e2b346a425e6536",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 75,
"avg_line_length": 31.63157894736842,
"alnum_prop": 0.6688851913477537,
"repo_name": "mbiokyle29/reQuiver",
"id": "0ec2c1d883a0ad6875da39a38d668749ef1c8f22",
"size": "6... |
from google.cloud import aiplatform
def get_model_evaluation_video_object_tracking_sample(
project: str,
model_id: str,
evaluation_id: str,
location: str = "us-central1",
api_endpoint: str = "us-central1-aiplatform.googleapis.com",
):
"""
To obtain evaluation_id run the following commands ... | {
"content_hash": "ad8f5147c4eb4627269c27283a3079ec",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 115,
"avg_line_length": 39.666666666666664,
"alnum_prop": 0.7100840336134454,
"repo_name": "googleapis/python-aiplatform",
"id": "2726681178ea13ab856065103e8f196d02a2a53c",
... |
__version__ = "trunk"
import copy
import csv
import random
import re
import sys
import textwrap
import itertools
import unicodedata
from evennia.utils.ansi import parse_ansi
py3k = sys.version_info[0] >= 3
if py3k:
unicode = str
basestring = str
itermap = map
iterzip = zip
uni_chr = chr
from ... | {
"content_hash": "ad72d9db1584fe142d16d02c4a95ff1a",
"timestamp": "",
"source": "github",
"line_count": 1474,
"max_line_length": 207,
"avg_line_length": 36.29579375848033,
"alnum_prop": 0.563196261682243,
"repo_name": "TheTypoMaster/evennia",
"id": "800afb3d7c7a993a6ba0bd99536a4720d06e3bff",
"size"... |
import unittest
from gluon import *
# =============================================================================
class DefaultApproverOverrideTests(unittest.TestCase):
""" Test ability to override default approver in imports """
def setUp(self):
xmlstr = """
<s3xml>
<resource name="org_organi... | {
"content_hash": "49442a1fb8399d784098a6d5786878c0",
"timestamp": "",
"source": "github",
"line_count": 170,
"max_line_length": 82,
"avg_line_length": 32.07058823529412,
"alnum_prop": 0.5876742479823918,
"repo_name": "snpabilonia/rgims",
"id": "47678bf6adb754d7108e419a9ac1ab28f88bc681",
"size": "56... |
"""Test the Network UPS Tools (NUT) config flow."""
from unittest.mock import patch
from pynut2.nut2 import PyNUTError
from homeassistant import config_entries, data_entry_flow, setup
from homeassistant.components import zeroconf
from homeassistant.components.nut.const import DOMAIN
from homeassistant.const import (... | {
"content_hash": "ff0e6fdba1d306e09b3239d2e690d876",
"timestamp": "",
"source": "github",
"line_count": 425,
"max_line_length": 88,
"avg_line_length": 31.404705882352943,
"alnum_prop": 0.5839514497639919,
"repo_name": "rohitranjan1991/home-assistant",
"id": "2261fec3a86147a1a2bc9bbd681f3cf093ea9e59",... |
import logging
import os
import subprocess
LOG = logging.getLogger('archvyrt')
class Base:
"""
Base provisioner for domain
"""
def __init__(self, domain):
"""
Initialize provisioner
"""
self._domain = domain
@property
def domain(self):
"""
Lib... | {
"content_hash": "d55d447d32d092c11b3f250df99a8742",
"timestamp": "",
"source": "github",
"line_count": 67,
"max_line_length": 76,
"avg_line_length": 25.119402985074625,
"alnum_prop": 0.48128342245989303,
"repo_name": "Bigluu/arch-provision",
"id": "08a94073d2883d3b11488261f4f1373a0817eddb",
"size"... |
from . import apc
from . import coco
from . import voc
from .utils import view_dataset
from .utils import visualize_heatmap
from .utils import visualize_segmentation
from .utils import visualize_label
from .utils import view_class_seg_dataset
from .utils import visualize_instance_segmentation
from .utils import v... | {
"content_hash": "af8e7e58a117146b4987f04b894e3584",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 50,
"avg_line_length": 21.5625,
"alnum_prop": 0.8028985507246377,
"repo_name": "pazeshun/jsk_apc",
"id": "e97828c85ee5e9a554279bd7229e9d4a51cdb3b3",
"size": "361",
"binar... |
from __future__ import absolute_import
import itertools
from time import time
from . import Errors
from . import DebugFlags
from . import Options
from .Visitor import CythonTransform
from .Errors import CompileError, InternalError, AbortError
from . import Naming
#
# Really small pipeline stages
#
def dumptree(t):
... | {
"content_hash": "6fffecb87f2f0c403457083437f6d7b8",
"timestamp": "",
"source": "github",
"line_count": 341,
"max_line_length": 97,
"avg_line_length": 38.37243401759531,
"alnum_prop": 0.6543370271303018,
"repo_name": "madjar/cython",
"id": "dd90fac2892900ac126b9debbac3a19630ebf520",
"size": "13085"... |
from datetime import datetime, date, timedelta
from pyxmli import (Invoice, Group, Line, Tax, Discount, Address,
DeliveryMethod, Payment, INVOICE_PAID, RATE_TYPE_FIXED,
RATE_TYPE_PERCENTAGE, DELIVERY_METHOD_EMAIL)
invoice = Invoice(name="Online shopping on Guitar Heroes Store",... | {
"content_hash": "83dd560622b5e6970ccc25ab93a13cba",
"timestamp": "",
"source": "github",
"line_count": 80,
"max_line_length": 82,
"avg_line_length": 40.675,
"alnum_prop": 0.610940381069453,
"repo_name": "mohamedattahri/Greendizer-Python-Library",
"id": "dab285b9c6376e057bc38c179405d4d94f52462d",
"... |
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import os
import shutil
from pants.util.contextutil import temporary_file
def atomic_copy(src, dst):
"""Copy the file src to dst, overwriting dst atomically."""
... | {
"content_hash": "da89845ae5ad250c231e369818d1c6a5",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 93,
"avg_line_length": 32.57142857142857,
"alnum_prop": 0.706140350877193,
"repo_name": "TansyArron/pants",
"id": "b12716374ec4f04c906166f663172d4ad12034cd",
"size": "603",... |
"""
~~~~~
:copyright: (c) 2015 by Halfmoon Labs, Inc.
:license: MIT, see LICENSE for more details.
"""
import json
import traceback
from jwt import DecodeError
from pybitcoin import BitcoinPublicKey
from .tokenizer import Tokenizer
from .resolver import Resolver
class AuthMessage():
tokenizer = Token... | {
"content_hash": "6deee98d09167158f705d220ddf50283",
"timestamp": "",
"source": "github",
"line_count": 71,
"max_line_length": 74,
"avg_line_length": 29.056338028169016,
"alnum_prop": 0.624818225884634,
"repo_name": "mine-code/blockchain-auth-python",
"id": "6a0fad55fe0958e267037951a5ce87ac0437ee3a",... |
from suds import *
from suds.client import Client
from sys import exit
from optparse import OptionParser
from aviary.util import *
# change these for other default locations and ports
wsdl = 'file:/var/lib/condor/aviary/services/job/aviary-job.wsdl'
cmds = ['holdJob', 'releaseJob', 'removeJob', 'suspendJob', 'continue... | {
"content_hash": "642d369fdb517f074ddeeefc065878ac",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 105,
"avg_line_length": 29.319148936170212,
"alnum_prop": 0.7177068214804064,
"repo_name": "djw8605/condor",
"id": "7178d64adcb769ea825b022a40beaacb9472cdcf",
"size": "2056... |
from paddle.trainer_config_helpers import *
"""
paper: https://arxiv.org/abs/1512.03385
"""
is_test = get_config_arg("is_test", bool, False)
is_predict = get_config_arg("is_predict", bool, False)
data_provider = get_config_arg("data_provider", bool, True)
layer_num = get_config_arg("layer_num", int, 50)
if not is_pred... | {
"content_hash": "24f275c5c041681ab919640f942a91c0",
"timestamp": "",
"source": "github",
"line_count": 257,
"max_line_length": 80,
"avg_line_length": 27.68093385214008,
"alnum_prop": 0.5822322181613719,
"repo_name": "qingqing01/Paddle",
"id": "015b74cd484596039b9fcf010576ca340d044db7",
"size": "77... |
import os
import sys
from setuptools import setup
INSTALL_REQUIRES = ['requests >=1.0.3', 'boto >=2.1.1', 'six >=1.2.0', 'urllib3 >= 1.0.2', 'inflection >= 0.3.1']
if sys.version_info < (2, 7, 0):
INSTALL_REQUIRES.append('argparse>=1.1')
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fn... | {
"content_hash": "32566604edb6dcc280614048ed70963c",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 113,
"avg_line_length": 33.108108108108105,
"alnum_prop": 0.6065306122448979,
"repo_name": "msumit/qds-sdk-py",
"id": "c4a29efeb73e3d7eda9bdd222dff20bff4f30d8d",
"size": "1... |
"""
Simple script to generate stub files for the clingo python module.
"""
import re
import types
import inspect
import os.path
from textwrap import indent
from mako.template import Template
import clingo
TYPING_TYPES = [
'AbstractSet', 'Any', 'AnyStr', 'AsyncContextManager', 'AsyncGenerator', 'AsyncIterable', ... | {
"content_hash": "12e6efb54c280d43b5f30fbf0a740c50",
"timestamp": "",
"source": "github",
"line_count": 328,
"max_line_length": 110,
"avg_line_length": 28.11890243902439,
"alnum_prop": 0.562181502764827,
"repo_name": "potassco/clingo",
"id": "63cdd48211e8aec3ba5ec8aa58e451c18a1453a7",
"size": "9245... |
import pytest
from rlp.sedes import big_endian_int
from rlp.sedes.lists import CountableList
from rlp import SerializationError
def test_countable_list():
l1 = CountableList(big_endian_int)
serializable = ([], [1, 2], list(range(500)))
for s in serializable:
r = l1.serialize(s)
assert l1.d... | {
"content_hash": "000dcb6b8274de5c80e2ea2095df39da",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 74,
"avg_line_length": 34.55555555555556,
"alnum_prop": 0.572347266881029,
"repo_name": "holiman/pyrlp",
"id": "f4f00fd578205759f8adb7b28eb8ef985c1e90aa",
"size": "933",
... |
import requests
import json
import redis
import random
# max user numbers for sampling
MAX_SYSTEM_USERS = 4000000
MAX_USER=50000
# coefficient for all clean users,not in loan collection system
ALL_CLEAN_USER_COE= 0.315222
ALL_CLEAN_USER_SAMPLE_METRIC = int(MAX_USER*ALL_CLEAN_USER_COE)
# coefficient ... | {
"content_hash": "691ad80d925b87d8cb3ef813158e66cc",
"timestamp": "",
"source": "github",
"line_count": 143,
"max_line_length": 118,
"avg_line_length": 29.657342657342657,
"alnum_prop": 0.5703843433152558,
"repo_name": "snakedragon/scrapy-hive",
"id": "decc7b036f4d8cbfb2b003a4d3f2d7cfba506b88",
"si... |
import sqlite3
con = sqlite3.connect('todo.db') # Warning: This file is created in the current directory
con.execute("CREATE TABLE todo (id INTEGER PRIMARY KEY, task char(100) NOT NULL, status bool NOT NULL)")
con.execute("INSERT INTO todo (task,status) VALUES ('test',0)")
con.execute("INSERT INTO todo (task,status) V... | {
"content_hash": "94dbcd32a4f664e38a49bb511b1d7925",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 119,
"avg_line_length": 64.18181818181819,
"alnum_prop": 0.7492917847025495,
"repo_name": "rarewin/my-studies",
"id": "000619768e9bae332c4fe3779362f3185b3e52ae",
"size": "7... |
"""
test_formatting
~~~~~~~~~~~~~~~
Tests for the :mod:`~ydf.formatting` module.
"""
import pytest
from ydf import formatting
@pytest.fixture(scope='module', params=[
['foo'],
['bar'],
['baz']
])
def one_item_list(request):
"""
Fixture that yields one item lists.
"""
return ... | {
"content_hash": "c497d019bf0bcebfd2afb56eab07ac45",
"timestamp": "",
"source": "github",
"line_count": 100,
"max_line_length": 105,
"avg_line_length": 28.07,
"alnum_prop": 0.6255789098681867,
"repo_name": "ahawker/ydf",
"id": "35288a1f264f062e327173d950189053ebafa344",
"size": "2807",
"binary": ... |
from __future__ import absolute_import
from proj.celery import celery
@celery.task
def add(x, y):
return x + y
@celery.task
def mul(x, y):
return x * y
@celery.task
def xsum(numbers):
return sum(numbers)
| {
"content_hash": "50993da7e81c65a6baf2ca1fc7f996d9",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 38,
"avg_line_length": 11.789473684210526,
"alnum_prop": 0.6607142857142857,
"repo_name": "telamonian/saga-python",
"id": "129db73b1429c2d457b7f82a92267c960cfd3ce2",
"size"... |
'''
$Id: tzfile.py,v 1.8 2004/06/03 00:15:24 zenzen Exp $
'''
from datetime import datetime
from struct import unpack, calcsize
from pytz.tzinfo import StaticTzInfo, DstTzInfo, memorized_ttinfo
from pytz.tzinfo import memorized_datetime, memorized_timedelta
def _byte_string(s):
"""Cast a string or byte string t... | {
"content_hash": "49756e22d3fa2cbc72b8bccc30d3940f",
"timestamp": "",
"source": "github",
"line_count": 133,
"max_line_length": 79,
"avg_line_length": 35.51127819548872,
"alnum_prop": 0.5456277789540547,
"repo_name": "kimjinyong/i2nsf-framework",
"id": "99e74489b859e21fcaa68e93089035c3d81a73c8",
"s... |
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('customer_subsystem', '0001_initial'),
]
operations = [
migrations.RenameField(
model_name='reservation',
old_name='checkout_... | {
"content_hash": "7c6d529c70320207879b4c84bd8d01c8",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 62,
"avg_line_length": 24.125,
"alnum_prop": 0.5630397236614854,
"repo_name": "erfannoury/Simorgh",
"id": "b102d622812a3e1dc9e29de25654fd35aa26e06f",
"size": "603",
"bina... |
from graphics import *
SCALE = 70.0
MATERIALS_COLOR = {"stone": "darkgrey",
"sheep": color_rgb(149,200,89),
"brick": color_rgb(183,117,73),
"wood": "darkgreen",
"wheat": "gold",
"desert": "beige"}
class Display:
def _... | {
"content_hash": "d545946f118b9c0a08a13f63de43f43b",
"timestamp": "",
"source": "github",
"line_count": 123,
"max_line_length": 128,
"avg_line_length": 30.479674796747968,
"alnum_prop": 0.5710856228327554,
"repo_name": "alexadkins/Catan-Pathfinder",
"id": "172c9006fd63873a086bb39c7618d69248e5c7d8",
... |
from setuptools import setup, find_packages
def parse_requirements(filename):
""" load requirements from a pip requirements file """
lineiter = (line.strip() for line in open(filename))
return [line for line in lineiter if line and not line.startswith("#")]
setup(
name="nagios-mesos",
description=... | {
"content_hash": "cf34ecfd4206e710a6031774dfa56515",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 75,
"avg_line_length": 36.44827586206897,
"alnum_prop": 0.6688741721854304,
"repo_name": "kamaradclimber/nagios-mesos",
"id": "ce9e3ec3543e615037b0cd419ff28a948dc67811",
"s... |
from nssrc.com.citrix.netscaler.nitro.resource.base.base_resource import base_resource
from nssrc.com.citrix.netscaler.nitro.resource.base.base_resource import base_response
from nssrc.com.citrix.netscaler.nitro.service.options import options
from nssrc.com.citrix.netscaler.nitro.exception.nitro_exception import nitro_... | {
"content_hash": "7709c99dd760a8ec0e93365196081215",
"timestamp": "",
"source": "github",
"line_count": 337,
"max_line_length": 430,
"avg_line_length": 40.36498516320475,
"alnum_prop": 0.7384400499889731,
"repo_name": "mahabs/nitro",
"id": "84e62f052283380f81976f5e4f3dc0c10b4e475c",
"size": "14217"... |
from pony.orm import *
from datetime import datetime
from model.group import Group
from model.contact import Contact
from pymysql.converters import encoders, decoders, convert_mysql_timestamp
class ORMFixture:
db = Database()
class ORMGroup(db.Entity):
_table_ = 'group_list'
id = PrimaryKey(... | {
"content_hash": "05367214896a1083fb2c9dcde12da507",
"timestamp": "",
"source": "github",
"line_count": 65,
"max_line_length": 126,
"avg_line_length": 40.23076923076923,
"alnum_prop": 0.6684512428298279,
"repo_name": "ble669/python_training",
"id": "53663bcd5e9c47472b4ae7385a6b1bab5fc83c5f",
"size"... |
import os
import argparse
import sys
import platform
from collections import namedtuple
from pysmt.cmd.installers import MSatInstaller, Z3Installer, PicoSATInstaller
from pysmt.cmd.installers import CVC4Installer, YicesInstaller, BtorInstaller
from pysmt.cmd.installers import CuddInstaller
from pysmt.cmd.installers.b... | {
"content_hash": "39716b76c3150432796596fc05433db6",
"timestamp": "",
"source": "github",
"line_count": 243,
"max_line_length": 113,
"avg_line_length": 39.534979423868315,
"alnum_prop": 0.5879046528572915,
"repo_name": "pysmt/pysmt",
"id": "66bd5bc7acf7f253559a4c1fa1c61a4f5a9238cb",
"size": "10202"... |
import copy
from unittest import mock
from neutron_lib import constants
from neutron_lib import context
from neutron_lib.services.qos import constants as qos_consts
from oslo_utils import uuidutils
from neutron.objects.qos import policy
from neutron.objects.qos import rule
from neutron.plugins.ml2.drivers.openvswitch... | {
"content_hash": "1d2db1a3e6d89f278c26083c12825d75",
"timestamp": "",
"source": "github",
"line_count": 356,
"max_line_length": 79,
"avg_line_length": 43.63483146067416,
"alnum_prop": 0.5878717651602936,
"repo_name": "openstack/neutron",
"id": "e2bef51f1fc5e386462b45644e7ba7c27438205e",
"size": "16... |
"""Generate Blink V8 bindings (.h and .cpp files).
If run itself, caches Jinja templates (and creates dummy file for build,
since cache filenames are unpredictable and opaque).
This module is *not* concurrency-safe without care: bytecode caching creates
a race condition on cache *write* (crashes if one process tries ... | {
"content_hash": "6885c52e528cd4aae97a43b197375d5c",
"timestamp": "",
"source": "github",
"line_count": 437,
"max_line_length": 115,
"avg_line_length": 44.67505720823799,
"alnum_prop": 0.6702351073093274,
"repo_name": "zero-rp/miniblink49",
"id": "4169c23a2edca55f96e650d5aa4846aeb8229ea6",
"size": ... |
'''
Copyright (C) 2016 Turi
All rights reserved.
This software may be modified and distributed under the terms
of the BSD license. See the LICENSE file for details.
'''
from .show import show, show_dispatch
| {
"content_hash": "b2e8d1824317fc68c475b0384833073f",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 61,
"avg_line_length": 23.22222222222222,
"alnum_prop": 0.7607655502392344,
"repo_name": "dato-code/SFrame",
"id": "b41785ce16c110faffe4f4e18f034c6283baa219",
"size": "209",... |
from __future__ import absolute_import
from __future__ import print_function
from __future__ import division
import tensorflow as tf
from tensorforce import util, TensorForceError
from tensorforce.core.memories import Memory
from tensorforce.core.optimizers import Optimizer
from tensorforce.models import Model
clas... | {
"content_hash": "d2638f97426678d62220336159c26874",
"timestamp": "",
"source": "github",
"line_count": 611,
"max_line_length": 134,
"avg_line_length": 41.33387888707038,
"alnum_prop": 0.5912096614531775,
"repo_name": "lefnire/tensorforce",
"id": "92a44d7f537bfa47eebff6c0fba1aaf3e01ec952",
"size": ... |
'''
Multitarget planar tracking
==================
Example of using features2d framework for interactive video homography matching.
ORB features and FLANN matcher are used. This sample provides PlaneTracker class
and an example of its usage.
video: http://www.youtube.com/watch?v=pzVbhxx6aog
Usage
-----
plane_tracker... | {
"content_hash": "eb1b53553fc7b2050d39e591a06a00df",
"timestamp": "",
"source": "github",
"line_count": 177,
"max_line_length": 103,
"avg_line_length": 32.632768361581924,
"alnum_prop": 0.5647506925207756,
"repo_name": "apavlenko/opencv",
"id": "c32f65a442379109d7c79af9044f5e770bc837e3",
"size": "5... |
import os
import sys
import json
import subprocess
import lighthouse_result_pb2 as lhr_pb2
from google.protobuf.json_format import Parse, MessageToJson
path = os.path.realpath(__file__)
path_dir = os.path.dirname(path)
path_sample_preprocessed = path_dir + '/sample_v2_processed.json'
path_sample = path_dir + '/../../... | {
"content_hash": "0bf3b6d1d5281b1e4372eb7f1da9cf0f",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 163,
"avg_line_length": 29.511627906976745,
"alnum_prop": 0.7060677698975572,
"repo_name": "deepanjanroy/lighthouse",
"id": "a70b8f485c4be80bb01210ccaaed0416b6c2d21f",
"siz... |
from ea import adult_selection
from ea import parent_selection
from ea import reproduction
from ea import main
from ea import binary_gtype
from ea.ea_globals import *
def fitness_test(population):
'''Naive fitness test for onemax, just the number of ones'''
tested = []
for ind in population:
tested... | {
"content_hash": "67610fd67c22ae862bf08cf9cf3086e1",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 157,
"avg_line_length": 38.76744186046512,
"alnum_prop": 0.7096580683863227,
"repo_name": "imre-kerr/better-ea",
"id": "f4c94845c8154c68ab50617bfdc932bbf85450ad",
"size": "... |
"""
:copyright: (c) 2013-2020 by Mike Taylor and Kartik Prabhu
:license: MIT, see LICENSE for more details.
"""
import json
import requests
path_testdata = './data/webmention_rocks_test'
test_data = {}
def storePageData(pageURL, pageFilename):
"""Store the returned HTML as a file
"""
r = requests.ge... | {
"content_hash": "86285b9651ac689be3f811c7689741a1",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 58,
"avg_line_length": 25.346153846153847,
"alnum_prop": 0.6282245827010622,
"repo_name": "bear/ronkyuu",
"id": "91695e6007b632614825b7c305f18d7d72126bd1",
"size": "683",
... |
from random import randint
num = randint(1, 100)
print('Guess what I think?')
bingo = False
while bingo == False:
answer = input()
if answer > num:
print('too big!')
if answer < num:
print('too small!')
if answer == num:
print('BINGO!')
bingo = True
| {
"content_hash": "bd7bef7c791fa031ee936a92b5224bab",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 28,
"avg_line_length": 16.833333333333332,
"alnum_prop": 0.5577557755775577,
"repo_name": "QuinceySun/Python",
"id": "fb4bc7af4d94e4971e5afcb7c7d8627048570a8d",
"size": "30... |
from collections import OrderedDict
from lxml import etree
import pyusps.urlutil
api_url = 'https://production.shippingapis.com/ShippingAPI.dll'
address_max = 5
def _find_error(root):
if root.tag == 'Error':
num = root.find('Number')
desc = root.find('Description')
return (num, desc)
d... | {
"content_hash": "a4b772c405431d4f9553469c1aa6a934",
"timestamp": "",
"source": "github",
"line_count": 192,
"max_line_length": 70,
"avg_line_length": 27.572916666666668,
"alnum_prop": 0.561956932376275,
"repo_name": "thelinuxkid/pyusps",
"id": "31964c01177663f85e07a39ba1264cbd9d5cac34",
"size": "5... |
import sys, os
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#sys.path.insert(0, os.path.abspath('.'))
# -- General configurat... | {
"content_hash": "698cd02db4cd366c2d1bb87bc5c426ec",
"timestamp": "",
"source": "github",
"line_count": 205,
"max_line_length": 80,
"avg_line_length": 32.43414634146342,
"alnum_prop": 0.7043164385621898,
"repo_name": "carlosp420/edittag",
"id": "e8d46e612bc3cda336e929f1860b8ef00b15e124",
"size": "7... |
"""
sentry.models.team
~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010-2014 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import, print_function
import warnings
from django.conf import settings
from django.db import connections, IntegrityEr... | {
"content_hash": "152a82b9ef9ad716827447a40404c09b",
"timestamp": "",
"source": "github",
"line_count": 273,
"max_line_length": 100,
"avg_line_length": 32.010989010989015,
"alnum_prop": 0.5642522027691955,
"repo_name": "gencer/sentry",
"id": "ed0c99d04d360d134c4c7fdf0c4a94e0f0f1459e",
"size": "8739... |
import numpy as np
# Scipy
from scipy.stats import linregress
# Matplotlib
import matplotlib.pyplot as plt
def plot_spectrum(spectrum, freqs=None, drop_zero_frequency=True, ax=None,
xlog=False, ylog=False, loglog=False,
variance_preserving=False, xlim=None,
ylim=N... | {
"content_hash": "aa62d53ab32237af2d9b1c7c66f1f575",
"timestamp": "",
"source": "github",
"line_count": 265,
"max_line_length": 80,
"avg_line_length": 29.71698113207547,
"alnum_prop": 0.6627301587301587,
"repo_name": "serazing/xscale",
"id": "27b08d0a1b8c0ea7e7fcd1de9325a88fb6b4e326",
"size": "7883... |
from datadog_checks.base.utils.models.fields import get_default_field_value
def shared_proxy(field, value):
return get_default_field_value(field, value)
def shared_service(field, value):
return get_default_field_value(field, value)
def shared_skip_proxy(field, value):
return False
def shared_timeout... | {
"content_hash": "2ef29dfbadd26c814bea5b083a662906",
"timestamp": "",
"source": "github",
"line_count": 273,
"max_line_length": 75,
"avg_line_length": 20.41025641025641,
"alnum_prop": 0.7374371859296482,
"repo_name": "DataDog/integrations-core",
"id": "ac37081d21df7126a7260484b1586e98d5ec1255",
"si... |
import dominoes
import unittest
class TestResult(unittest.TestCase):
def test_result(self):
p = 0
w = True
pts = 100
r = dominoes.Result(p, w, pts)
self.assertEqual(r.player, p)
self.assertEqual(r.won, True)
self.assertEqual(r.points, pts)
if __name__ == '_... | {
"content_hash": "bf1bbb662c74de7d25c4b11169548273",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 39,
"avg_line_length": 21.875,
"alnum_prop": 0.5771428571428572,
"repo_name": "abw333/dominoes",
"id": "4b6b9fa53795c0defe8848bd15f2d10257eeab90",
"size": "350",
"binary"... |
from PIL import Image
import logging
from pixelsort.argparams import parse_args
from pixelsort.main import pixelsort
from pixelsort.util import id_generator
args = parse_args()
image_input_path = args.pop("image_input_path")
image_output_path = args.pop("image_output_path")
interval_file_path = args.pop("interval_file... | {
"content_hash": "c560e3a0d8b11530ee9b5512deb9f9a3",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 74,
"avg_line_length": 33.2962962962963,
"alnum_prop": 0.7252502780867631,
"repo_name": "satyarth/pixelsort",
"id": "532712db3405eea4c6a3473c7a579bc1362ca797",
"size": "899... |
from distutils.core import setup
setup(name='django-country-utils', version='0.1',
description='Add a CountryField to Django',
author='Gustaf Sjöberg', author_email='[email protected]',
packages=['country_utils'],
zip_safe=False)
| {
"content_hash": "03fb4f67374a92ca690860a325114a70",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 61,
"avg_line_length": 36,
"alnum_prop": 0.6865079365079365,
"repo_name": "strange/django-country-utils",
"id": "bac17b74655cc6dadab051ededdac6df88088cab",
"size": "294",
... |
from paddle.trainer.config_parser import parse_config
from paddle.proto import TrainerConfig_pb2
import sys
__all__ = []
if __name__ == '__main__':
whole_conf = False
if len(sys.argv) == 2:
conf = parse_config(sys.argv[1], '')
elif len(sys.argv) == 3:
conf = parse_config(sys.argv[1], sys.a... | {
"content_hash": "135e58d82dff58aaf4d7898e62a52f17",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 60,
"avg_line_length": 26.4,
"alnum_prop": 0.5893939393939394,
"repo_name": "alvations/Paddle",
"id": "c5ce5c8d9a084d68b250d091808f528459f46921",
"size": "1260",
"binary"... |
"""Support for OwnTracks."""
from collections import defaultdict
import json
import logging
import re
from aiohttp.web import json_response
import voluptuous as vol
from homeassistant import config_entries
from homeassistant.components import mqtt
from homeassistant.const import (
ATTR_GPS_ACCURACY,
ATTR_LATI... | {
"content_hash": "8e628fef6748e105b23c0850450aff0a",
"timestamp": "",
"source": "github",
"line_count": 315,
"max_line_length": 88,
"avg_line_length": 31.923809523809524,
"alnum_prop": 0.6071002386634845,
"repo_name": "home-assistant/home-assistant",
"id": "3cae9505ee8b41f7f9ac365a4562b1aff42e9b72",
... |
"""Config flow for flume integration."""
from functools import partial
import logging
from pyflume import FlumeAuth, FlumeDeviceList
from requests.exceptions import RequestException
import voluptuous as vol
from homeassistant import config_entries, core, exceptions
from homeassistant.const import (
CONF_CLIENT_ID... | {
"content_hash": "5e0e1f696655a9506872dafa8956ac9c",
"timestamp": "",
"source": "github",
"line_count": 109,
"max_line_length": 86,
"avg_line_length": 31.568807339449542,
"alnum_prop": 0.6469049694856146,
"repo_name": "pschmitt/home-assistant",
"id": "f26be5f1e1de802f910a66cb8b4dd255f39d6cce",
"siz... |
"""
The :mod:`sklearn.cross_validation` module includes utilities for cross-
validation and performance evaluation.
"""
# Author: Alexandre Gramfort <[email protected]>,
# Gael Varoquaux <[email protected]>,
# Olivier Grisel <[email protected]>
# License: BSD 3 clause
i... | {
"content_hash": "a8ce5686c15537ea41704e758f9398f6",
"timestamp": "",
"source": "github",
"line_count": 1571,
"max_line_length": 91,
"avg_line_length": 35.91725015913431,
"alnum_prop": 0.58001630454046,
"repo_name": "albahnsen/CostSensitiveClassification",
"id": "45a554301e5fb6a4504ba7b2e4820a38c9018... |
"""show the configuration as discovered from the current directory."""
# =============================================================================
# CONTENTS
# -----------------------------------------------------------------------------
# aoncmd_showconfig
#
# Public Functions:
# getFromfilePrefixChars
# setup... | {
"content_hash": "8ef4df33936cfc56efd2f559ec9257c9",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 79,
"avg_line_length": 34.05357142857143,
"alnum_prop": 0.5527005768222338,
"repo_name": "bloomberg/phabricator-tools",
"id": "a2c916e174887a9c50d227225eb98bc767405bd8",
"s... |
"""Chart where free things are.
The StuffCharter class is a wrapper around the folium
openstreetmap python object, which in turn generates a
leaflet map.
Example usage:
>>> from stuff_scraper import StuffScraper
>>> from stuff_charter import StuffCharter
>>> stuffs = StuffScraper('montreal', 5, precise... | {
"content_hash": "82400afab708484aefb59d930ec487c5",
"timestamp": "",
"source": "github",
"line_count": 215,
"max_line_length": 131,
"avg_line_length": 40.562790697674416,
"alnum_prop": 0.5681687879830295,
"repo_name": "polypmer/freestuffs",
"id": "d50389315fcfe93f70a13d89196fe8aeefcfa629",
"size":... |
from south.db import db
from south.v2 import SchemaMigration
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'TrainingTempShare.user'
db.add_column('website_trainingtempshare', 'user',
self.gf('django.db.models.fields.related.ForeignKey')(to=orm['au... | {
"content_hash": "6ca25835812a2c0bc9c1bf07ff691212",
"timestamp": "",
"source": "github",
"line_count": 143,
"max_line_length": 182,
"avg_line_length": 74.02097902097903,
"alnum_prop": 0.5516296646197449,
"repo_name": "UniShared/unishared",
"id": "641944c48e53b9d386f888637a526e31c9808cc7",
"size": ... |
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('badgificator', '0004_auto_20150101_1106'),
]
operations = [
migrations.RemoveField(
model_name='badge',
name='condition_func... | {
"content_hash": "45f990f328e90640faaffafbf922466d",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 352,
"avg_line_length": 38.6551724137931,
"alnum_prop": 0.6119536128456735,
"repo_name": "mrjmad/django_badgificator",
"id": "dbfe7c3a05cf51be9380dd39a71944fbc871e67c",
"si... |
"""SCons.Tool.gcc
Tool-specific initialization for MinGW (http://www.mingw.org/)
There normally shouldn't be any need to import this module directly.
It will usually be imported through the generic SCons.Tool.Tool()
selection method.
"""
#
# __COPYRIGHT__
#
# Permission is hereby granted, free of charge, to any per... | {
"content_hash": "9063ee26148d4864b4b81762d1b32088",
"timestamp": "",
"source": "github",
"line_count": 180,
"max_line_length": 135,
"avg_line_length": 35.74444444444445,
"alnum_prop": 0.6465651227852036,
"repo_name": "Distrotech/scons",
"id": "601ec3b81552ebfffa0241296812af33bcd10e71",
"size": "64... |
from .compat import StringIO, str
import seria
import click
CONTEXT_SETTINGS = dict(help_option_names=['-h', '--help'])
input = None
output = None
out_fmt = None
@click.command(context_settings=CONTEXT_SETTINGS)
@click.option('--xml', '-x', 'out_fmt', flag_value='xml')
@click.option('--yaml', '--yml', '-y', 'out_... | {
"content_hash": "3381914a8b8a4f60a89f8caac36fedbe",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 68,
"avg_line_length": 27.02857142857143,
"alnum_prop": 0.6014799154334038,
"repo_name": "rtluckie/seria",
"id": "9ad691b01ee82525a0a4360b877ea4512ed05064",
"size": "971",
... |
"""Utility functions to retrieve OAuth2 credentials using a service account.
A service account is used to allow multiple 'Admin' users access to resources
owned by multiple users in an apps domain.
"""
import os
import http_utils
import log_utils
from oauth2client import client
import recall_errors
import service_ac... | {
"content_hash": "0d3da77a07ef011223486a7c867c603e",
"timestamp": "",
"source": "github",
"line_count": 103,
"max_line_length": 78,
"avg_line_length": 36.33009708737864,
"alnum_prop": 0.7600213789417424,
"repo_name": "google/googleapps-message-recall",
"id": "b62d714b11856f3cd9cb81a90277416ed5d32a9e"... |
from collections import OrderedDict
import os
import re
from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union
import pkg_resources
from google.api_core import client_options as client_options_lib
from google.api_core import exceptions as core_exceptions
from google.api_core import gapic_v1
from goog... | {
"content_hash": "eeaecc83da83922a0385489a643270b3",
"timestamp": "",
"source": "github",
"line_count": 2211,
"max_line_length": 167,
"avg_line_length": 40.207146087743105,
"alnum_prop": 0.598674885824203,
"repo_name": "googleapis/python-dialogflow-cx",
"id": "f463b19556199e51ffcbb69e93390ed5d6c3a650... |
"""
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": "9bd53a41191c04774479c9556b1ce0ee",
"timestamp": "",
"source": "github",
"line_count": 88,
"max_line_length": 93,
"avg_line_length": 33.03409090909091,
"alnum_prop": 0.7667698658410733,
"repo_name": "arenadata/ambari",
"id": "c4e99fa34179bdc3d483cdc239a82cc8654c43e5",
"size": "2907... |
import functools
from collections import OrderedDict
from utils import displayupdate, hw
from guicore.switcher import SwitchScreen
import config
import debug
import logsupport
from screens import screen
import issuecommands
from logsupport import ConsoleWarning
from screens.maintscreenbase import MaintScreenDesc, fixe... | {
"content_hash": "e43c3ce1d2facac1f01cdd6360cc3a07",
"timestamp": "",
"source": "github",
"line_count": 170,
"max_line_length": 113,
"avg_line_length": 41.411764705882355,
"alnum_prop": 0.7329545454545454,
"repo_name": "kevinkahn/softconsole",
"id": "7e99c6b0f56f50d195de411472f628815355557c",
"size... |
import logging
import json
import sys
from dlab.fab import *
from dlab.meta_lib import *
from dlab.actions_lib import *
import os
import traceback
if __name__ == "__main__":
instance_class = 'notebook'
local_log_filename = "{}_{}_{}.log".format(os.environ['conf_resource'], os.environ['edge_user_name'],
... | {
"content_hash": "e228f6f856cec00c18ae8c2620258a4c",
"timestamp": "",
"source": "github",
"line_count": 196,
"max_line_length": 131,
"avg_line_length": 51.566326530612244,
"alnum_prop": 0.5693084001187296,
"repo_name": "epam/DLab",
"id": "803998340d6704edc1bee913d5ade49cbdc65a6a",
"size": "10876",
... |
from __future__ import unicode_literals
from indico.modules.events.logs.controllers import RHEventLogs, RHEventLogsJSON
from indico.web.flask.wrappers import IndicoBlueprint
_bp = IndicoBlueprint('event_logs', __name__, template_folder='templates', virtual_template_folder='events/logs',
url_pre... | {
"content_hash": "66fd667b68e94f2cdec275a540646704",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 113,
"avg_line_length": 41.36363636363637,
"alnum_prop": 0.7208791208791209,
"repo_name": "OmeGak/indico",
"id": "21528905dfda014451e3514e8f1a906454f7d383",
"size": "669",
... |
config = {
'login_url': 'https://entgaming.net/forum/ucp.php',
'games_url': 'https://entgaming.net/bans/games.php',
'game_url': 'https://entgaming.net/bans/game.php',
'rangeban_url': 'https://entgaming.net/bans/rangeban.php',
'verbose': 0,
'ent-user' : <Username>,
'ent-pass' : <Password>
}
def getKey(... | {
"content_hash": "7ffc7b55d0be8cd43f0f84c6652ccbfb",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 59,
"avg_line_length": 27.266666666666666,
"alnum_prop": 0.6381418092909535,
"repo_name": "Carterj3/Ent_Hephaestus",
"id": "0dd3ac6766441851791289a51674ec1e3eafdeb0",
"size... |
import _plotly_utils.basevalidators
class TickfontValidator(_plotly_utils.basevalidators.CompoundValidator):
def __init__(self, plotly_name="tickfont", parent_name="carpet.aaxis", **kwargs):
super(TickfontValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
... | {
"content_hash": "e0e5e2cf37c076586dbfbbac708b8323",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 85,
"avg_line_length": 41.2972972972973,
"alnum_prop": 0.5445026178010471,
"repo_name": "plotly/plotly.py",
"id": "39f6745e710c75c72120fc90666661b3bb996faf",
"size": "1528"... |
from swgpy.object import *
def create(kernel):
result = Static()
result.template = "object/static/terrain/tatooine/shared_rock_spire_fin_tatooine.iff"
result.attribute_template_id = -1
result.stfName("obj_n","unknown_object")
#### BEGIN MODIFICATIONS ####
#### END MODIFICATIONS ####
return result | {
"content_hash": "3f3853b91099d8ad1ae360a86d32bfc7",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 86,
"avg_line_length": 24.23076923076923,
"alnum_prop": 0.6984126984126984,
"repo_name": "obi-two/Rebelion",
"id": "65c2d98510e3c1b52f2ba9bcf9e8926abd5b2b20",
"size": "460"... |
import tensorflow as tf
from tensorforce.core import parameter_modules, SignatureDict, TensorSpec, tf_function, tf_util
from tensorforce.core.layers import Layer
class PreprocessingLayer(Layer):
"""
Base class for preprocessing layers which require to be reset.
Args:
name (string): Layer name
... | {
"content_hash": "d60b04ec81df04f04715699fc35b4b1e",
"timestamp": "",
"source": "github",
"line_count": 402,
"max_line_length": 99,
"avg_line_length": 39.25373134328358,
"alnum_prop": 0.5678073510773131,
"repo_name": "reinforceio/tensorforce",
"id": "55d74d849c1295281a374cfda0be60e6d6c62b58",
"size... |
import six
from heat.common import exception
from heat.common.i18n import _
from heat.engine import attributes
from heat.engine.clients import progress
from heat.engine import constraints
from heat.engine import properties
from heat.engine import resource
from heat.engine.resources.openstack.neutron import neutron
fro... | {
"content_hash": "ec6e0619f80fe500e64d643342240dac",
"timestamp": "",
"source": "github",
"line_count": 756,
"max_line_length": 79,
"avg_line_length": 36.92857142857143,
"alnum_prop": 0.5412278816534136,
"repo_name": "pratikmallya/heat",
"id": "27945d3bec706f2054a5f0459a75b6e7864778e0",
"size": "28... |
# Copyright 2017 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | {
"content_hash": "134fb919df471daed1a6d623ad9bca6b",
"timestamp": "",
"source": "github",
"line_count": 90,
"max_line_length": 78,
"avg_line_length": 38.46666666666667,
"alnum_prop": 0.6091854419410745,
"repo_name": "jonparrott/gcloud-python",
"id": "267a048af4cf8811a6724188af8040b633958f06",
"size... |
import sqlalchemy.types as types
import json
from ggrc.utils import as_json
from .exceptions import ValidationError
class JsonType(types.TypeDecorator):
'''
Marshals Python structures to and from JSON stored
as Text in the db
'''
# FIXME: Change this to a larger column type and fix validation below
impl = ... | {
"content_hash": "7b787531b3554afc5a6add1843223b96",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 75,
"avg_line_length": 31.44,
"alnum_prop": 0.7061068702290076,
"repo_name": "hyperNURb/ggrc-core",
"id": "3d055b0209ba1f0a54248382f2c780acb05e4402",
"size": "1812",
"bin... |
from django.core import mail
from nose.tools import eq_
from kitsune.kbadge.tests import AwardFactory, BadgeFactory
from kitsune.sumo.tests import TestCase
class AwardNotificationTests(TestCase):
def test_notification(self):
# Note: Need to do this import here so the
# notify_award_recipient fun... | {
"content_hash": "c93a784c71a2c11b5c03c417d93d2c60",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 70,
"avg_line_length": 31.321428571428573,
"alnum_prop": 0.677309007981756,
"repo_name": "safwanrahman/kitsune",
"id": "b4cbb744de25f65fb281d4edb5d69382483dd255",
"size": "... |
"""Tests the Metadata Server utility."""
import httplib
import json
import mock
import socket
from tests.unittest_utils import ForsetiTestCase
from google.cloud.security.common.util import metadata_server
from google.cloud.security.common.util import errors
from StringIO import StringIO
class _MockHttpError(socket... | {
"content_hash": "32594776dab3d17a257359f51092c507",
"timestamp": "",
"source": "github",
"line_count": 122,
"max_line_length": 83,
"avg_line_length": 35.442622950819676,
"alnum_prop": 0.6667437557816837,
"repo_name": "cschnei3/forseti-security",
"id": "5b29d03f6203a43399716f19dc05cd9a5c8bc393",
"s... |
from app import db
class VAT(db.Model):
"""Define VAT Model"""
id = db.Column(db.Integer, primary_key=True)
date_created = db.Column(db.DateTime, default=db.func.current_timestamp())
date_modified = db.Column(db.DateTime, default=db.func.current_timestamp(),
onupdate=db.func.current_timestamp())
name = db... | {
"content_hash": "30635d0af72934d9ef54619b328230c5",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 76,
"avg_line_length": 37.57142857142857,
"alnum_prop": 0.7186311787072244,
"repo_name": "oeilgauche/vicuna",
"id": "e0242ed4eade305f451b9b0bed94b925cee2bed3",
"size": "789... |
from lather import exceptions
class Response(object):
"""
Simple class which represents the suds response
"""
def __init__(self, keylist, dict):
self.__keylist__ = keylist
for key in self.__keylist__:
setattr(self, key, dict[key])
class MaxLengthValidaiton(object):
"... | {
"content_hash": "dec896932a59f46fd69f7eac7e872e2f",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 66,
"avg_line_length": 23.08,
"alnum_prop": 0.6031195840554593,
"repo_name": "ctxis/lather",
"id": "285a262ea8efb647f13d723906af91b98bc0ad0f",
"size": "601",
"binary": fa... |
from __future__ import unicode_literals
from frappe import _
import zxcvbn
def test_password_strength(password, user_inputs=None):
'''Wrapper around zxcvbn.password_strength'''
result = zxcvbn.password_strength(password, user_inputs)
result['feedback'] = get_feedback(result['score'], result['match_sequence'])
retu... | {
"content_hash": "2582c6caadcf0c2010da5bc34aa3adf5",
"timestamp": "",
"source": "github",
"line_count": 168,
"max_line_length": 109,
"avg_line_length": 31.851190476190474,
"alnum_prop": 0.6714632778919828,
"repo_name": "anandpdoshi/frappe",
"id": "bc0b6ad8c370bfe5f892835d7446633e045bcf1e",
"size": ... |
import logging
from django.conf import settings
from django.http import (HttpResponseRedirect, HttpResponse,
HttpResponseForbidden, HttpResponseNotFound, Http404)
from django.shortcuts import get_object_or_404, render_to_response, redirect
from django.contrib.auth.decorators import login_required
from django.... | {
"content_hash": "3cc755c92a4a15634a7c2c525513d9a7",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 76,
"avg_line_length": 32.18518518518518,
"alnum_prop": 0.7238204833141542,
"repo_name": "mozilla/badges.mozilla.org",
"id": "4773d5644924615b31a630ad6ddb59c4b8a8c520",
"si... |
from .test_simple_types import *
from .test_string_types import *
| {
"content_hash": "eeac7e93f72e23a57869b529984007d8",
"timestamp": "",
"source": "github",
"line_count": 2,
"max_line_length": 32,
"avg_line_length": 33,
"alnum_prop": 0.7575757575757576,
"repo_name": "ajmarks/gymnast",
"id": "8b2815daa910d8ba1a36f515584e24de9167f845",
"size": "66",
"binary": fals... |
import serial, time, struct, sys
ser = serial.Serial()
#ser.port = "/dev/cu.wchusbserial1410" # Set this to your serial port
ser.port = "/dev/ttyUSB0" # Set this to your serial port
ser.baudrate = 9600
ser.open()
ser.flushInput()
byte, lastbyte = "\x00", "\x00"
while True:
lastbyte = byte
byte = ser.read(si... | {
"content_hash": "137d8c30e6f854fbe9fbd866cfa2d86b",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 156,
"avg_line_length": 31.21875,
"alnum_prop": 0.6206206206206206,
"repo_name": "kiu/feinstaubnode",
"id": "6f17d93d16bd00150d5f6bdeaa8b75684a615c57",
"size": "1044",
"b... |
import log as logger
import threading
import time
EXP_TIME = 50
logger.init("jacket-cache", output=False)
_cache_lock = threading.Lock()
class JacketStatusCache(object):
def __init__(self, synchronizer):
logger.info("init jacket status cache.")
self.synchronizer = synchronizer
self.... | {
"content_hash": "520ab1c7b33b538ae81f358d2aa81fc4",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 120,
"avg_line_length": 30.023255813953487,
"alnum_prop": 0.6034082106893881,
"repo_name": "back1860/jacket-status-cache",
"id": "ff6f0dd5e2a52f6681cfbce20276d82bdfba4ee9",
... |
import serial
import math
import time
import thread
import threading
# some module-level definitions for the robot commands
START = chr(128) # already converted to bytes...
BAUD = chr(129) # + 1 byte
CONTROL = chr(130) # deprecated for Create
SAFE = chr(131)
FULL = chr(132)
POWER = chr(133)
SPOT = chr(134) ... | {
"content_hash": "dbaa377027af65fab8870aaf44136802",
"timestamp": "",
"source": "github",
"line_count": 1700,
"max_line_length": 508,
"avg_line_length": 37.51294117647059,
"alnum_prop": 0.5477952706516966,
"repo_name": "huangy6/vroombot",
"id": "dabe308ef8849a52e0d208336ece79745362e1d9",
"size": "6... |
from __future__ import absolute_import
from __future__ import print_function
from __future__ import unicode_literals
import logging
from django.core.management.base import BaseCommand
import kolibri
from ...utils import dbbackup
from kolibri.utils import server
logger = logging.getLogger(__name__)
class Command(B... | {
"content_hash": "106892dbe0fcbd7022a422046b983d6e",
"timestamp": "",
"source": "github",
"line_count": 59,
"max_line_length": 83,
"avg_line_length": 27.983050847457626,
"alnum_prop": 0.5723803755299818,
"repo_name": "lyw07/kolibri",
"id": "a9120bfaea3c96001e802f221d558143efc72e37",
"size": "1651",... |
from django.conf.urls import patterns, include, url
import app.views as av
import django.contrib.auth.views
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns(
'',
url(r'^$', av.index),
url(r'^login/$', django.contrib.auth.vie... | {
"content_hash": "97b9eddda10a8cc7f7a618d591af01a0",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 87,
"avg_line_length": 32.93333333333333,
"alnum_prop": 0.6275303643724697,
"repo_name": "mashabow/manatsum",
"id": "5c776b30da86672e76cd07ea1c069d9c1d905eb0",
"size": "100... |
import numpy as np
import pytest
import pandas as pd
from pandas.util.testing import assert_frame_equal, assert_series_equal
@pytest.fixture(params=[['inner'], ['inner', 'outer']])
def frame(request):
levels = request.param
df = pd.DataFrame({'outer': ['a', 'a', 'a', 'b', 'b', 'b'],
'i... | {
"content_hash": "ac85c826f5c41c519c3fa6ffb04092d0",
"timestamp": "",
"source": "github",
"line_count": 68,
"max_line_length": 72,
"avg_line_length": 29.75,
"alnum_prop": 0.5348492338111716,
"repo_name": "MJuddBooth/pandas",
"id": "141381f84300b540423478099d9a878859f19c55",
"size": "2023",
"binar... |
"""
Interface for tagging each token in a sentence with supplementary
information, such as its part of speech.
"""
from nltk.internals import overridden
class TaggerI(object):
"""
A processing interface for assigning a tag to each token in a list.
Tags are case sensitive strings that identify some propert... | {
"content_hash": "7e54b4c6d4c743650c50fab9b54afd2e",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 71,
"avg_line_length": 32.30555555555556,
"alnum_prop": 0.6276870163370594,
"repo_name": "hectormartinez/rougexstem",
"id": "1ba2bffd96e24e3b18a56a87a1a8d3034d68a1dc",
"siz... |
"""
Unit tests for PySpark; additional tests are implemented as doctests in
individual modules.
"""
from array import array
from glob import glob
import os
import re
import shutil
import subprocess
import sys
import tempfile
import time
import zipfile
import random
import threading
import hashlib
from py4j.protocol i... | {
"content_hash": "80f5fe2e15b21eb4eb2b436f969829d4",
"timestamp": "",
"source": "github",
"line_count": 2463,
"max_line_length": 100,
"avg_line_length": 40.92367032074706,
"alnum_prop": 0.5883625179820428,
"repo_name": "rekhajoshm/spark",
"id": "8ac1df52fc59777a06fdbeb36910c61102e3b043",
"size": "1... |
import pytest
from multidl.downloaders.local_file_downloader import LocalFileDownloader
@pytest.mark.parametrize('url, expected', [
('file:///dir/file1.txt', 'file1.txt'),
('file:///file2.txt', 'file2.txt'),
])
def test_get_file_name(tmpdir, url, expected):
downloader = LocalFileDownloader(url, str(tmpdi... | {
"content_hash": "367b61bd82d889609601ac95c64f6ea0",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 73,
"avg_line_length": 31.166666666666668,
"alnum_prop": 0.7058823529411765,
"repo_name": "julienc91/multidl",
"id": "1c456f4aeae0fd4829f9f0818a661eb6433b1c8e",
"size": "39... |
import os.path
import sys, imp, getopt
from migrate.versioning import api
from config import SQLALCHEMY_DATABASE_URI
from config import SQLALCHEMY_MIGRATE_REPO
from model import *
def build():
db.create_all()
if not os.path.exists(SQLALCHEMY_MIGRATE_REPO):
api.create(SQLALCHEMY_MIGRATE_REPO, 'database ... | {
"content_hash": "b299605d9c23bb12eec74beacbd9e0a3",
"timestamp": "",
"source": "github",
"line_count": 72,
"max_line_length": 125,
"avg_line_length": 37.041666666666664,
"alnum_prop": 0.6527934008248969,
"repo_name": "rettigs/cs-senior-capstone",
"id": "391d76988a12f30c0d7e91c52c2e74b25e7f7e52",
"... |
from __future__ import unicode_literals
from django import forms
from django.core.exceptions import ValidationError
from django.db import transaction
from django.utils.text import slugify
from django.utils.translation import (
ugettext,
ugettext_lazy as _,
)
from cms.admin.forms import AddPageForm
from cms.pl... | {
"content_hash": "c1da4a1f274486bc9cf8febc96d3f4d4",
"timestamp": "",
"source": "github",
"line_count": 198,
"max_line_length": 102,
"avg_line_length": 33.515151515151516,
"alnum_prop": 0.6050331525015069,
"repo_name": "benzkji/django-cms",
"id": "77c76ed74673dca9ae8fcc72b8eb69e07568ba32",
"size": ... |
import pytest
asdf = pytest.importorskip('asdf')
import datetime
import numpy as np
from astropy import time
from asdf import AsdfFile, yamlutil, tagged
from asdf.tests import helpers
import asdf.schema as asdf_schema
def _flatten_combiners(schema):
newschema = dict()
def add_entry(path, schema, combine... | {
"content_hash": "d19703f5e8bae5050d6926409d71f0c0",
"timestamp": "",
"source": "github",
"line_count": 128,
"max_line_length": 82,
"avg_line_length": 27.328125,
"alnum_prop": 0.6106346483704974,
"repo_name": "StuartLittlefair/astropy",
"id": "1709994b4acb0946c515907d48d97299300f10dc",
"size": "356... |
from RawInstreamFile import RawInstreamFile
from MidiFileParser import MidiFileParser
class MidiInFile:
"""
Parses a midi file, and triggers the midi events on the outStream
object.
Get example data from a minimal midi file, generated with cubase.
>>> test_file = 'C:/Documents and Sett... | {
"content_hash": "17e7681a1caab1905690e62faf9d4aab",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 120,
"avg_line_length": 27.547169811320753,
"alnum_prop": 0.6198630136986302,
"repo_name": "fretsonfire/fof-python",
"id": "88f5a7be94584e5df2246e45203c8d5208d5a250",
"size... |
from sys import version_info
if version_info >= (2,6,0):
def swig_import_helper():
from os.path import dirname
import imp
fp = None
try:
fp, pathname, description = imp.find_module('_csc', [dirname(__file__)])
except ImportError:
import _csc
... | {
"content_hash": "17cf20587ac338e1e9ca302aca1af1a8",
"timestamp": "",
"source": "github",
"line_count": 418,
"max_line_length": 94,
"avg_line_length": 47.49760765550239,
"alnum_prop": 0.6119673617407072,
"repo_name": "teoliphant/scipy",
"id": "a1ed0645828af5e22c7e785706d60f27d1b4fa62",
"size": "200... |
"""Support for LCN switches."""
import pypck
from homeassistant.components.switch import SwitchDevice
from homeassistant.const import CONF_ADDRESS
from . import LcnDevice
from .const import CONF_CONNECTIONS, CONF_OUTPUT, DATA_LCN, OUTPUT_PORTS
from .helpers import get_connection
async def async_setup_platform(
... | {
"content_hash": "9f56f6977905808c9cede55fee686f91",
"timestamp": "",
"source": "github",
"line_count": 127,
"max_line_length": 82,
"avg_line_length": 33.78740157480315,
"alnum_prop": 0.6439058494523421,
"repo_name": "Teagan42/home-assistant",
"id": "f19548c4aee235ab61bcfd9a615bb0beec9e9a31",
"size... |
"""distutils.msvc9compiler
Contains MSVCCompiler, an implementation of the abstract CCompiler class
for the Microsoft Visual Studio 2008.
The module is compatible with VS 2005 and VS 2008. You can find legacy support
for older versions of VS in distutils.msvccompiler.
"""
# Written by Perry Stoll
# hacked by Robin B... | {
"content_hash": "572ed70c0c71d1cd05246ec460f51a64",
"timestamp": "",
"source": "github",
"line_count": 832,
"max_line_length": 88,
"avg_line_length": 36.30288461538461,
"alnum_prop": 0.5547278506158124,
"repo_name": "pypa/setuptools",
"id": "a4714a559dcb695c996cadbac8be71ec9ccb40da",
"size": "3020... |
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.test import TestCase
from nose.tools import eq_
from lib.utils import static_url, update_csp, validate_settings
class TestValidate(TestCase):
def test_secret_key(self):
with self.settings(DEBUG=True,
... | {
"content_hash": "8355519792771278bce29b74456ed6de",
"timestamp": "",
"source": "github",
"line_count": 83,
"max_line_length": 78,
"avg_line_length": 38.66265060240964,
"alnum_prop": 0.5091928949828607,
"repo_name": "shahbaz17/zamboni",
"id": "aab0ad04d12d42d567680aab63e8aad9063b4702",
"size": "320... |
"""
Simplex method for solving linear programming problems
"""
import numpy as np
from warnings import warn
from .optimize import OptimizeResult, OptimizeWarning, _check_unknown_options
from ._linprog_util import _postsolve
def _pivot_col(T, tol=1.0E-12, bland=False):
"""
Given a linear programming simplex ta... | {
"content_hash": "3bf1751aa1472386b26f8ee94c0582ae",
"timestamp": "",
"source": "github",
"line_count": 516,
"max_line_length": 83,
"avg_line_length": 37.781007751937985,
"alnum_prop": 0.5847140292382662,
"repo_name": "gfyoung/scipy",
"id": "1915f0f84a8223d359b41bd5dbd7a77acfa586dd",
"size": "19495... |
"""AsusWrt component constants."""
DOMAIN = "asuswrt"
CONF_DNSMASQ = "dnsmasq"
CONF_INTERFACE = "interface"
CONF_REQUIRE_IP = "require_ip"
CONF_SSH_KEY = "ssh_key"
CONF_TRACK_UNKNOWN = "track_unknown"
DATA_ASUSWRT = DOMAIN
DEFAULT_DNSMASQ = "/var/lib/misc"
DEFAULT_INTERFACE = "eth0"
DEFAULT_SSH_PORT = 22
DEFAULT_TRA... | {
"content_hash": "5f7a83dfe5d1b6e9523b7ecdae3e1f5f",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 80,
"avg_line_length": 26.25,
"alnum_prop": 0.7047619047619048,
"repo_name": "rohitranjan1991/home-assistant",
"id": "95e93e0ff2537edca94a876cf26e51e3bce73275",
"size": "73... |
from __future__ import absolute_import, division, print_function
from nacl import exceptions as exc
from nacl._sodium import ffi, lib
from nacl.exceptions import ensure
crypto_secretbox_KEYBYTES = lib.crypto_secretbox_keybytes()
crypto_secretbox_NONCEBYTES = lib.crypto_secretbox_noncebytes()
crypto_secretbox_ZEROBYT... | {
"content_hash": "56b6106ac305fc67f68d5ca3185517fd",
"timestamp": "",
"source": "github",
"line_count": 67,
"max_line_length": 76,
"avg_line_length": 33.76119402985075,
"alnum_prop": 0.7015915119363395,
"repo_name": "lmctv/pynacl",
"id": "5323b26c8e4abff174fa1f4db5eafefb0a6e9c8d",
"size": "2864",
... |
__doc__="""
Select glyphs with the same color as the currently selected one.
"""
import GlyphsApp
thisFont = Glyphs.font # frontmost font
selectedLayers = thisFont.selectedLayers
def indexSetWithIndex( index ):
indexSet = NSIndexSet.alloc().initWithIndex_( index )
return indexSet
def hasColor( thisGlyph, colorInd... | {
"content_hash": "dbbc135f407eab87ffa3d3e5dc8738d6",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 105,
"avg_line_length": 32.1875,
"alnum_prop": 0.7796116504854369,
"repo_name": "weiweihuanghuang/Glyphs-Scripts",
"id": "b33db7d5bc7167018d7d1062181c713d86def054",
"size":... |
import io
import os
import tempfile
import unittest.mock
from contextlib import redirect_stdout
import pytest
from airflow import models
from airflow.cli import cli_parser
from airflow.cli.commands import variable_command
from airflow.models import Variable
from tests.test_utils.db import clear_db_variables
class T... | {
"content_hash": "d04aa1853f81fc3b0bba86b0f0dbf4e9",
"timestamp": "",
"source": "github",
"line_count": 144,
"max_line_length": 110,
"avg_line_length": 43.56944444444444,
"alnum_prop": 0.6165125916480714,
"repo_name": "mistercrunch/airflow",
"id": "cd497f2f9c491addcbd38bf45b41144a0ff69f2c",
"size":... |
"""
CellState Manager
"""
import copy
import datetime
import functools
import time
from oslo_config import cfg
from oslo_db import exception as db_exc
from oslo_log import log as logging
from oslo_serialization import jsonutils
from oslo_utils import timeutils
from oslo_utils import units
from nova.cells import rpc_d... | {
"content_hash": "5365427c6fa9aa44a089b946da9bb61b",
"timestamp": "",
"source": "github",
"line_count": 484,
"max_line_length": 78,
"avg_line_length": 36.917355371900825,
"alnum_prop": 0.5826617416610701,
"repo_name": "petrutlucian94/nova",
"id": "a53ae50cafea1e35e46daee64b696ced49f13fdc",
"size": ... |
import picocm
import unittest
from picocm_unittest import *
class Jinja2Tests(unittest.TestCase):
def test_jinja2(self):
template='Hello {{a}}{{b}}!'
expected='Hello PicoCM!'
with TempFile() as templatefile:
with TempFile() as dst:
picocm.file_write(templatefile.name, template)
self.assertTrue(picoc... | {
"content_hash": "e516f02b991ccbf322104d00f606464c",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 93,
"avg_line_length": 32.72222222222222,
"alnum_prop": 0.6859083191850595,
"repo_name": "mediafly/picocm",
"id": "87a0521ea0c0103c0f039545b600577346aaf255",
"size": "613",... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.