text stringlengths 4 1.02M | meta dict |
|---|---|
class File(In.entity.Entity):
'''File Entity class.
'''
def __init__(self, data = None, items = None, **args):
self.nabar_id = 0
self.size = 0
self.mime1 = None
self.mime2 = None
self.path = None
self.tmp_path = None # temporary uploaded path
self.remote = 0
self.private = 0
self.data = {}
... | {
"content_hash": "98b557a72150a6638a56cf6d14ce3d55",
"timestamp": "",
"source": "github",
"line_count": 67,
"max_line_length": 58,
"avg_line_length": 21.73134328358209,
"alnum_prop": 0.5625,
"repo_name": "vinoth3v/In",
"id": "917e20b7d97b0a50c3e0dfd68f3a108ec38d89e7",
"size": "1457",
"binary": fa... |
import _plotly_utils.basevalidators
class HoverinfosrcValidator(_plotly_utils.basevalidators.SrcValidator):
def __init__(self, plotly_name="hoverinfosrc", parent_name="candlestick", **kwargs):
super(HoverinfosrcValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_... | {
"content_hash": "091ab6f64633c5f8d1666e4aade3b9ee",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 88,
"avg_line_length": 38.083333333333336,
"alnum_prop": 0.6214442013129103,
"repo_name": "plotly/python-api",
"id": "04b3e9315624c34aba4bc03010b59ad874812c2b",
"size": "45... |
import unittest
import unittest.mock
import re
import logging
import typing # noqa (use mypy typing)
import warnings
from typing import Any
from typing import Callable
from torment import decorators
from torment import fixtures
logger = logging.getLogger(__name__)
@property
def _module(self) -> str:
'''Actual... | {
"content_hash": "3497317ce5466a0b4074f77b9de52ea0",
"timestamp": "",
"source": "github",
"line_count": 149,
"max_line_length": 169,
"avg_line_length": 31.503355704697988,
"alnum_prop": 0.6105666808691947,
"repo_name": "devx/torment",
"id": "a05eb82cfd1f1198a9b4ff6876933b019a1f7780",
"size": "5274"... |
"""Provides device conditions for sensors."""
from __future__ import annotations
import voluptuous as vol
from homeassistant.components.device_automation.exceptions import (
InvalidDeviceAutomationConfig,
)
from homeassistant.const import CONF_ABOVE, CONF_BELOW, CONF_ENTITY_ID, CONF_TYPE
from homeassistant.core i... | {
"content_hash": "55a0363b696b3ab8f8e1721f6fff581e",
"timestamp": "",
"source": "github",
"line_count": 209,
"max_line_length": 88,
"avg_line_length": 37.42583732057416,
"alnum_prop": 0.6328304781385835,
"repo_name": "home-assistant/home-assistant",
"id": "229e5069069c3516f350fccf27f3030dae05ae81",
... |
from sklearn import svm
class Models(object):
def __init__(self, trained, evaluations, classify):
self.trained = trained
self.evaluations = evaluations
self.classify = classify
self.result = list()
def svm_linear(self):
"""
Classification tweets with... | {
"content_hash": "b3f440a65443ec6474df88bb4a192bdc",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 80,
"avg_line_length": 34,
"alnum_prop": 0.5745098039215686,
"repo_name": "fernandopso/twitter-svm-tfidf.py",
"id": "16ad9e6a7b3eee0e2c53641f093db8cd2af84360",
"size": "106... |
import copy
import inspect
import warnings
from itertools import chain
from django.apps import apps
from django.conf import settings
from django.core import checks
from django.core.exceptions import (
NON_FIELD_ERRORS, FieldDoesNotExist, FieldError, MultipleObjectsReturned,
ObjectDoesNotExist, ValidationError,... | {
"content_hash": "f672ebda4f5b03dc61c1950caa9431c5",
"timestamp": "",
"source": "github",
"line_count": 1716,
"max_line_length": 114,
"avg_line_length": 41.35489510489511,
"alnum_prop": 0.5386739942225041,
"repo_name": "camilonova/django",
"id": "efc8b1862f508becd37dac9ca671023ba6929ba8",
"size": "... |
from time import sleep
from functools import wraps
import logging
logging.basicConfig()
log = logging.getLogger("retry")
def retry(f):
@wraps(f)
def wrapped_f(*args, **kwargs):
MAX_ATTEMPTS = 5
for attempt in range(1, MAX_ATTEMPTS + 1):
try:
return f(*args, **kwargs)... | {
"content_hash": "e27709bfe28a215d93e3780534183d80",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 71,
"avg_line_length": 28.72972972972973,
"alnum_prop": 0.5888993414863594,
"repo_name": "pezy/python_test",
"id": "1e7080fc2fa841ec108a43fcfbb6e3cf51eab9cd",
"size": "1063... |
from django.test.utils import override_settings
from openstack_auth import policy as policy_backend
from openstack_dashboard import policy
from openstack_dashboard.test import helpers as test
class PolicyBackendTestCase(test.TestCase):
def test_policy_file_load(self):
policy_backend.reset()
enfor... | {
"content_hash": "48f4bcbec4e41a032591483bdf385c9d",
"timestamp": "",
"source": "github",
"line_count": 91,
"max_line_length": 66,
"avg_line_length": 40.81318681318681,
"alnum_prop": 0.6284329563812601,
"repo_name": "bigswitch/horizon",
"id": "48e7b822858efd9f17c3c66634f6c921214b4c82",
"size": "428... |
"""Create a Block Diagonal operator from one or more `LinearOperators`."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.python.framework import common_shapes
from tensorflow.python.framework import dtypes
from tensorflow.python.framework ... | {
"content_hash": "8d2e03b61660d04266fbe72aa6704fd6",
"timestamp": "",
"source": "github",
"line_count": 360,
"max_line_length": 99,
"avg_line_length": 37.41388888888889,
"alnum_prop": 0.6717647932288959,
"repo_name": "ghchinoy/tensorflow",
"id": "6a3c0debaff78ef4ff7a2b42f07a8a7ce965abb6",
"size": "... |
import logging
from celery.task.base import task
from django.db.models.loading import get_model
logger = logging.getLogger('getpaid.backends.przelewy24')
@task
def get_payment_status_task(payment_id, p24_session_id, p24_order_id, p24_kwota):
Payment = get_model('getpaid', 'Payment')
try:
payment = Pa... | {
"content_hash": "e691fd52d7c58aa02e778484ac863ebf",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 88,
"avg_line_length": 35.68421052631579,
"alnum_prop": 0.7315634218289085,
"repo_name": "pawciobiel/django-getpaid",
"id": "ec04a43d47eef6c88f63e5315cc57acb69246b37",
"siz... |
import os
import re
import sys
from BidirMap import BidirMap
from logging import debug
import S3
from Utils import unicodise, check_bucket_name_dns_conformity
class S3Uri(object):
type = None
_subclasses = None
def __new__(self, string):
if not self._subclasses:
## Generate a list of a... | {
"content_hash": "a802dc46a3c3681a550e353f9e3ad543",
"timestamp": "",
"source": "github",
"line_count": 217,
"max_line_length": 82,
"avg_line_length": 29.63594470046083,
"alnum_prop": 0.532887575804696,
"repo_name": "zhm/s3_cmd_bin",
"id": "e53d46a63936d873f3f49238b0f2d43105272591",
"size": "6560",... |
import uuid
import webob
from nova.api.openstack.compute.contrib import shelve as shelve_v2
from nova.api.openstack.compute.plugins.v3 import shelve as shelve_v21
from nova.compute import api as compute_api
from nova import db
from nova import exception
from nova.openstack.common import policy as common_policy
from n... | {
"content_hash": "b0ca4f83577c43d7a3f97fef1d859f01",
"timestamp": "",
"source": "github",
"line_count": 122,
"max_line_length": 77,
"avg_line_length": 40.368852459016395,
"alnum_prop": 0.6235532994923858,
"repo_name": "affo/nova",
"id": "ce5760fef1c3be4889c7a34ad3e1c1c80573de29",
"size": "5523",
... |
import config
from flask import Flask, render_template, send_from_directory, jsonify, request
from datetime import datetime, timedelta
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from models import TemperatureMeasurement
app = Flask(__name__)
# Set up the DB
engine = create_engine(con... | {
"content_hash": "42ab5f87f01f875e8bcb0a8b280b347e",
"timestamp": "",
"source": "github",
"line_count": 51,
"max_line_length": 79,
"avg_line_length": 28.80392156862745,
"alnum_prop": 0.6589516678012253,
"repo_name": "ganiserb/raspy",
"id": "91437b98b3dddd91db3d71a9100fe302d1b9c803",
"size": "1484",... |
"""Migration for a given Submitty course database."""
def up(config, database, semester, course):
"""
Run up migration.
:param config: Object holding configuration details about Submitty
:type config: migrator.config.Config
:param database: Object for interacting with given database for environme... | {
"content_hash": "af032c2b8c5e195501c5e195af516a6f",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 95,
"avg_line_length": 33.878787878787875,
"alnum_prop": 0.7191413237924866,
"repo_name": "Submitty/Submitty",
"id": "c1586c9f36341587844be99c2e2e3a9856ce4f78",
"size": "11... |
"""
Tests for uu module.
Nick Mathewson
"""
import unittest
from test import support
import os
import stat
import sys
import uu
import io
plaintext = b"The symbols on top of your keyboard are !@#$%^&*()_+|~\n"
encodedtext = b"""\
M5&AE('-Y;6)O;',@;VX@=&]P(&]F('EO=7(@:V5Y8F]A<F0@87)E("% (R0E
*7B8J*"E?*WQ^"@ """
# ... | {
"content_hash": "7df45e18d93bebbc8a4af907b739b33c",
"timestamp": "",
"source": "github",
"line_count": 242,
"max_line_length": 80,
"avg_line_length": 32.52066115702479,
"alnum_prop": 0.559720457433291,
"repo_name": "kikocorreoso/brython",
"id": "c9f05e5b760d922cfaddf4a509d2fbc317b8b97f",
"size": "... |
import random
import traceback
import datetime
import re
import sys
sys.path[0:0] = [""]
from bson.binary import Binary
from bson.dbref import DBRef
from bson.objectid import ObjectId
from bson.son import SON
gen_target = 100
reduction_attempts = 10
examples = 5
def lift(value):
return lambda: value
def choos... | {
"content_hash": "4e95c97c1be2b24ca237e00e7067251a",
"timestamp": "",
"source": "github",
"line_count": 226,
"max_line_length": 79,
"avg_line_length": 29.013274336283185,
"alnum_prop": 0.5758731127039804,
"repo_name": "marcosleonefilho/hoop-pymongo",
"id": "b653f10df98bdbdd77cd0f938898f8cc46d752f4",
... |
from lib.common import helpers
class Module:
def __init__(self, mainMenu, params=[]):
self.info = {
'Name': 'Invoke-Mimikatz SAM dump',
'Author': ['@JosephBialek', '@gentilkiwi'],
'Description': ("Runs PowerSploit's Invoke-Mimikatz function "
... | {
"content_hash": "a0046b792ae01adb8e5d5be009c7d34c",
"timestamp": "",
"source": "github",
"line_count": 75,
"max_line_length": 104,
"avg_line_length": 29.493333333333332,
"alnum_prop": 0.5022603978300181,
"repo_name": "rvazarkar/Empire",
"id": "45773d89f79f1fbe36e5070315cb50e69a18d6c4",
"size": "22... |
import datetime
from dateutil.relativedelta import relativedelta
import random
from six.moves.urllib.parse import urlencode
from django.contrib.auth.models import Permission
from django.core.urlresolvers import reverse
from django.test import TestCase
from timepiece import utils
from timepiece.forms import DATE_FORM... | {
"content_hash": "33ed707a9727369989ae47e3e56707e8",
"timestamp": "",
"source": "github",
"line_count": 700,
"max_line_length": 91,
"avg_line_length": 44.32714285714286,
"alnum_prop": 0.630958135937349,
"repo_name": "arbitrahj/django-timepiece",
"id": "94fa41daff63c81d62d27ce08a3a045423396f06",
"si... |
import hashlib
import random
from django.contrib.auth.models import User
def generate_username(email):
def random_username():
h = hashlib.sha1(email).hexdigest()[:25]
# don't ask
n = random.randint(1, (10 ** (5 - 1)) - 1)
return "%s%d" % (h, n)
while True:
try:
... | {
"content_hash": "bb7c3b50fcc4749ee14c77e38c2301da",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 50,
"avg_line_length": 24.94736842105263,
"alnum_prop": 0.5759493670886076,
"repo_name": "PyCon/pycon",
"id": "4a214616bd4366c468657f58380de515e761ad49",
"size": "474",
"... |
from django.test import TestCase
from django.contrib.auth.models import User
from django.conf import settings
from django.contrib.auth.models import SiteProfileNotAvailable
from userena.utils import (get_gravatar, signin_redirect, get_profile_model,
get_protocol)
from userena import settings... | {
"content_hash": "ebc8094051185cb52c690af9214d891a",
"timestamp": "",
"source": "github",
"line_count": 97,
"max_line_length": 86,
"avg_line_length": 38.577319587628864,
"alnum_prop": 0.5734901122394441,
"repo_name": "pjdelport/django-userena",
"id": "47452f89a20ab00eb6ae49f5ed3fb95f823d3f8e",
"siz... |
from rest_framework import serializers
from django.contrib.auth.models import User
from .models import Card
class UserSimpleSerializer(serializers.ModelSerializer):
class Meta(object):
model = User
fields = ('username', 'first_name', 'last_name', 'is_staff', 'is_active', 'email')
class CardSeria... | {
"content_hash": "c059af9e7d1d85166aeed3fe99b1adc9",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 90,
"avg_line_length": 26.4,
"alnum_prop": 0.6799242424242424,
"repo_name": "neosergio/WisdomBox",
"id": "0d293177f49e12ad1523c0fde3cd7394c85dc0c9",
"size": "528",
"binar... |
'''
BfPy wsdsl variables holding the Betfair WSDL definitions
'''
#
# Variables containing the Betfair WSDL files
#
BFVendorService = '''
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright 2003-2004 The Sporting Exchange Limited. All rights reserved.
The presentation, distribution or other dissemination of the i... | {
"content_hash": "056af675ef0f6b255c80b0f8cdca6e00",
"timestamp": "",
"source": "github",
"line_count": 828,
"max_line_length": 459,
"avg_line_length": 44.828502415458935,
"alnum_prop": 0.6550999515060079,
"repo_name": "kells1986/Betfair-Finktank-Tool",
"id": "8a4d329fc1ff0790d154958b83432e27b2280ce4... |
"""
.. _tut_stats_cluster_source_1samp:
=================================================================
Permutation t-test on source data with spatio-temporal clustering
=================================================================
Tests if the evoked response is significantly different between
conditions acros... | {
"content_hash": "787e15d678d2ea682df12c98afd23ab2",
"timestamp": "",
"source": "github",
"line_count": 186,
"max_line_length": 79,
"avg_line_length": 42.166666666666664,
"alnum_prop": 0.613795741425475,
"repo_name": "nicproulx/mne-python",
"id": "059b34d99f390700def7d47b323e231bc29e2799",
"size": ... |
"""
.. dialect:: postgresql+psycopg2
:name: psycopg2
:dbapi: psycopg2
:connectstring: postgresql+psycopg2://user:password@host:port/dbname[?key=value&key=value...]
:url: http://pypi.python.org/pypi/psycopg2/
psycopg2 Connect Arguments
-----------------------------------
psycopg2-specific keyword argum... | {
"content_hash": "d0db0d0bbbb9328033f58c182c995546",
"timestamp": "",
"source": "github",
"line_count": 523,
"max_line_length": 107,
"avg_line_length": 39.29445506692161,
"alnum_prop": 0.6351029147000146,
"repo_name": "michaelBenin/sqlalchemy",
"id": "25fafa59c63d9d5474d124f81208121430b18a81",
"siz... |
"""This example deletes custom targeting values for a given custom targeting
key. To determine which custom targeting keys and values exist, run
get_all_custom_targeting_keys_and_values.py."""
__author__ = '[email protected] (Jeff Sham)'
# Locate the client library. If module was installed via "setup.py" script,... | {
"content_hash": "a9049da2ada0b7b3a96ef90e687fcf3b",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 80,
"avg_line_length": 33.94827586206897,
"alnum_prop": 0.6785170137125445,
"repo_name": "donspaulding/adspygoogle",
"id": "66da2e90fd4f7207dff557761aed13ad089497a4",
"size... |
import sys
import re
import math
global default_var
default_var = {}
class ParameterGroup(object):
"""
Single parameter group
"""
def __init__(self, name):
self.name = name
self.no_code_generation = False #for injected parameters
self.params = []
def AddParameter(self, par... | {
"content_hash": "13cada8703c6eafdad738308c7e86f40",
"timestamp": "",
"source": "github",
"line_count": 439,
"max_line_length": 156,
"avg_line_length": 41.65375854214123,
"alnum_prop": 0.46478180028437055,
"repo_name": "acfloria/Firmware",
"id": "7fadf9f7c3e233cc176567bca3d314f13be8a582",
"size": "... |
from direct.gui.DirectGui import *
from panda3d.core import *
from toontown.toonbase.ToontownBattleGlobals import *
import InventoryBase
from toontown.toonbase import TTLocalizer
from toontown.quest import BlinkingArrows
from direct.interval.IntervalGlobal import *
from direct.directnotify import DirectNotifyGlobal
fro... | {
"content_hash": "53af7a09c8fd059b7549ccd597ea0d2d",
"timestamp": "",
"source": "github",
"line_count": 1347,
"max_line_length": 471,
"avg_line_length": 46.01187824795843,
"alnum_prop": 0.6103778760205234,
"repo_name": "silly-wacky-3-town-toon/SOURCE-COD",
"id": "7e4a6abc7d54aaa0a587b425fcf98d18b4978... |
from __future__ import print_function
from __future__ import absolute_import
import contextlib
import itertools
import logging
import optparse # pylint: disable=deprecated-module
import os
import re
import sys
import time
try:
import psutil
except ImportError:
psutil = None
import py_utils
from py_utils import cl... | {
"content_hash": "0084b3238a3f14d0b67f0a11ba38572c",
"timestamp": "",
"source": "github",
"line_count": 568,
"max_line_length": 80,
"avg_line_length": 41.434859154929576,
"alnum_prop": 0.6775015933715742,
"repo_name": "catapult-project/catapult",
"id": "ae0b4c08fd409ef303cb9db552eafb5ea532fd36",
"s... |
try:
import unittest2 as unittest
except ImportError:
import unittest # noqa
import sys
from cassandra.cqlengine.connection import get_session
class BaseCassEngTestCase(unittest.TestCase):
session = None
def setUp(self):
self.session = get_session()
def assertHasAttr(self, obj, attr)... | {
"content_hash": "23827ceffd002962938328903eb260eb",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 74,
"avg_line_length": 27,
"alnum_prop": 0.6481481481481481,
"repo_name": "tempbottle/python-driver",
"id": "856f2bac4fa170bbfc4ba5e2dcf01c6016c792b5",
"size": "1330",
"b... |
"""Convenience wrapper for starting an appengine tool."""
import os
import sys
if not hasattr(sys, 'version_info'):
sys.stderr.write('Very old versions of Python are not supported. Please '
'use version 2.5 or greater.\n')
sys.exit(1)
version_tuple = tuple(sys.version_info[:2])
if version_tupl... | {
"content_hash": "c484916de225325edba744333472dea3",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 76,
"avg_line_length": 34.04545454545455,
"alnum_prop": 0.6528704939919893,
"repo_name": "jamslevy/gsoc",
"id": "9bda605d480b8b88c26f70d1a19126ad349565fc",
"size": "2099",
... |
from datetime import datetime
import bleach
import markdown
from django.db import models
""" Presentation """
class Speaker(models.Model):
""" Who """
email = models.EmailField(unique=True)
full_name = models.CharField(max_length=255)
bio = models.TextField(default='')
twitter_username = models... | {
"content_hash": "519745c38ca15eab4adc2c4a2e0c555e",
"timestamp": "",
"source": "github",
"line_count": 166,
"max_line_length": 120,
"avg_line_length": 29.06024096385542,
"alnum_prop": 0.6314262023217247,
"repo_name": "pyconca/2017-web",
"id": "2135402ce3ea9aaa1a977601c1a67f65727cb992",
"size": "48... |
""" Tests import_csv functionality with varying parameters"""
import unittest
from sparktkregtests.lib import sparktk_test
class FrameCreateTest(sparktk_test.SparkTKTestCase):
def setUp(self):
"""Build frames to be exercised and establish known baselines"""
super(FrameCreateTest, self).setUp()
... | {
"content_hash": "d7fae7f8b1630a51a62d66e33dade3e9",
"timestamp": "",
"source": "github",
"line_count": 119,
"max_line_length": 115,
"avg_line_length": 48.285714285714285,
"alnum_prop": 0.6005917159763313,
"repo_name": "trustedanalytics/spark-tk",
"id": "42bbb10423b22c7c990d514bf3790e2f0ee9d918",
"... |
"""
ListScreen
==========
XML Definition
.. code-block:: xml
<screen name="foo" type="list">
<label>displayed label</label>
</screen>
"""
import logging
from math import floor
from screenflow.screens import Screen
from screenflow.constants import XML_NAME
# Configure log... | {
"content_hash": "392f7104f5ccaacb97469bab1d43c026",
"timestamp": "",
"source": "github",
"line_count": 97,
"max_line_length": 79,
"avg_line_length": 25.79381443298969,
"alnum_prop": 0.5831334932054356,
"repo_name": "Faylixe/screenflow",
"id": "2ea9e2eb1bff714a259fa89ee5a2d38f6f760bd8",
"size": "25... |
"""The app module, containing the app factory function."""
import os
from flask import Flask, render_template
from colorsearchtest.settings import ProdConfig
from colorsearchtest.assets import assets
from colorsearchtest.extensions import (
cache,
db,
migrate,
debug_toolbar,
)
from colorsearchtest imp... | {
"content_hash": "ff637974604f71b27e92582349699f0f",
"timestamp": "",
"source": "github",
"line_count": 72,
"max_line_length": 123,
"avg_line_length": 30.76388888888889,
"alnum_prop": 0.691196388261851,
"repo_name": "Jaza/colorsearchtest",
"id": "43585caa4d096dd43bea411754e70b7b3097047c",
"size": "... |
try:
import configparser
except:
import ConfigParser as configparser
def test_config(config):
assert config.templates_dir == '~/.latest/templates/'
assert config.pyexpr_entry == r'\{\$'
assert config.pyexpr_exit == r'\$\}'
assert config.env_entry == r'<<<'
assert config.env_exit == r'>>>'
... | {
"content_hash": "71316b0abd2d8fc93fbac7b68f8b15ce",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 64,
"avg_line_length": 27.375,
"alnum_prop": 0.6598173515981736,
"repo_name": "bluephlavio/latest",
"id": "917ad5a4421587d45c686ca06a094f7adb6eb3d6",
"size": "438",
"bina... |
import os
import os.path
import socket
from pilot.common.exception import FileHandlingFailure
from pilot.util.config import config
from pilot.util.filehandling import write_json, touch, remove, read_json, get_checksum_value
from pilot.util.timing import time_stamp
import logging
logger = logging.getLogger(__name__)
... | {
"content_hash": "12363b6ebcd1f2927c8ebf371688763b",
"timestamp": "",
"source": "github",
"line_count": 345,
"max_line_length": 127,
"avg_line_length": 33.504347826086956,
"alnum_prop": 0.6242754563543559,
"repo_name": "PalNilsson/pilot2",
"id": "643253efba04ca1c6a03bc966b4476a4b7bc9cfa",
"size": "... |
"""Implemented Protocols."""
# relative
from . import beaver
from . import spdz
from .aby3 import ABY3
__all__ = ["beaver", "spdz", "ABY3"]
| {
"content_hash": "7c2db3da571fe43bcb7088a481679129",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 36,
"avg_line_length": 20.142857142857142,
"alnum_prop": 0.6595744680851063,
"repo_name": "OpenMined/PySyft",
"id": "22b2c3ce6ade1e3a92a6d7fc890d81389d7b4386",
"size": "141"... |
"""BleBox binary sensor entities."""
from blebox_uniapi.binary_sensor import BinarySensor as BinarySensorFeature
from blebox_uniapi.box import Box
from homeassistant.components.binary_sensor import (
BinarySensorDeviceClass,
BinarySensorEntity,
BinarySensorEntityDescription,
)
from homeassistant.config_en... | {
"content_hash": "f80d69346933217ae34bc02a157716a4",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 86,
"avg_line_length": 30.87272727272727,
"alnum_prop": 0.7179034157832744,
"repo_name": "mezz64/home-assistant",
"id": "7eb6fd1e5a28fcce44e9457eb4a91a515527c498",
"size": ... |
"""Views for GSoCStudent.
"""
__authors__ = [
'"Daniel Hans" <[email protected]>',
'"Sverre Rabbelier" <[email protected]>',
]
from django import forms
from django.utils.translation import ugettext
from soc.logic import cleaning
from soc.logic import dicts
from soc.views import out_of_band
from so... | {
"content_hash": "3ff13219b7fc1b032917d9cc0dae461e",
"timestamp": "",
"source": "github",
"line_count": 140,
"max_line_length": 77,
"avg_line_length": 33.82857142857143,
"alnum_prop": 0.676731418918919,
"repo_name": "SRabbelier/Melange",
"id": "a89feabf4435be9cccb81cb5d5876239a161531a",
"size": "53... |
import antlr3
import testbase
import unittest
class t016actions(testbase.ANTLRTest):
def setUp(self):
self.compileGrammar()
def testValid(self):
cStream = antlr3.StringStream("int foo;")
lexer = self.getLexer(cStream)
tStream = antlr3.CommonTokenStream(lexer)
... | {
"content_hash": "c94a38c238a33761e719294401b792be",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 49,
"avg_line_length": 24.75,
"alnum_prop": 0.6060606060606061,
"repo_name": "pballand/congress",
"id": "60ea53ac409c5fa4c96dc8718df032cb52412e1d",
"size": "495",
"binary... |
from __future__ import unicode_literals, division, absolute_import
from builtins import * # noqa pylint: disable=unused-import, redefined-builtin
import pytest
from jinja2 import Template
from flexget.plugins.parsers.parser_guessit import ParserGuessit
from flexget.plugins.parsers.parser_internal import ParserIntern... | {
"content_hash": "b3e0469ae5f4201441673e1285bbc28b",
"timestamp": "",
"source": "github",
"line_count": 185,
"max_line_length": 110,
"avg_line_length": 39.432432432432435,
"alnum_prop": 0.5803975325565456,
"repo_name": "sean797/Flexget",
"id": "ff119e201deabb8842d58b89be981584888fc7f1",
"size": "72... |
from jumeaux.models import JudgementAddOnPayload, JudgementAddOnReference
class JudgementExecutor:
def exec(self, payload: JudgementAddOnPayload, reference: JudgementAddOnReference) -> JudgementAddOnPayload:
raise NotImplementedError()
| {
"content_hash": "6c473a9c57be17fb6e97306725a5301f",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 112,
"avg_line_length": 41.666666666666664,
"alnum_prop": 0.82,
"repo_name": "tadashi-aikawa/gemini",
"id": "ad4d45bc68c840905d07b620d9132d743cd8e339",
"size": "273",
"bin... |
import os
from django.utils.encoding import filepath_to_uri
from django.utils.six.moves.urllib.parse import urljoin
from django.core.files.storage import Storage
from django.core.files.base import ContentFile
from django.conf import settings
from qiniu import Auth, BucketManager, put_data
class QiniuStorage(Storage)... | {
"content_hash": "87f33e472a5e105e92e995383f009f1b",
"timestamp": "",
"source": "github",
"line_count": 59,
"max_line_length": 109,
"avg_line_length": 31.559322033898304,
"alnum_prop": 0.6364124597207304,
"repo_name": "isayme/django-blog",
"id": "23a546356119deff4850d50b3dcccc562b6dbd62",
"size": "... |
import psutil
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
from matplotlib.dates import strpdate2num
import pandas as pd
import sys
from pySPM.tools.fpanel import Fpanel
def plotLog(filename, watch=False, **kargs):
fig, ax = plt.subplots(1,1)
fig.subplots_adjust(hspace=0)
plt... | {
"content_hash": "620dd9af729a717445d8a1ac2f8717c2",
"timestamp": "",
"source": "github",
"line_count": 61,
"max_line_length": 117,
"avg_line_length": 32.39344262295082,
"alnum_prop": 0.5774291497975709,
"repo_name": "scholi/pySPM",
"id": "279abfe465e4e7fe586fdd589088be83a17c4ca4",
"size": "1976",
... |
from setuptools import setup, find_packages
setup(name="python-weixin",
version="0.0.1",
description="Weixin API client",
license="BSD",
install_requires=["simplejson","requests","six", "chardet"],
author="Zongxiao Cheng",
author_email="[email protected]",
url="https://git... | {
"content_hash": "400e44913d1671a9e5d9620a9dbfd274",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 66,
"avg_line_length": 33.46153846153846,
"alnum_prop": 0.639080459770115,
"repo_name": "kingctan/python-weixin",
"id": "a8641b9df911820f265900cd53f30edb8f527d6a",
"size": ... |
"""A library of top-level style functions.
"""
__version__ = "$Revision: #1 $"
#===========================================================================
import os
import os.path as path
from .SubStyle import SubStyle
#===========================================================================
__all__ = [
'cle... | {
"content_hash": "3eaf26235e7ef0c5312baa6ea58a0a57",
"timestamp": "",
"source": "github",
"line_count": 182,
"max_line_length": 79,
"avg_line_length": 29.796703296703296,
"alnum_prop": 0.5484049419140697,
"repo_name": "nasa/mplStyle",
"id": "682938278246a7af352a4330807844b209118da3",
"size": "7225"... |
import copy
import datetime
from django.core.exceptions import EmptyResultSet, FieldError
from django.db.backends import utils as backend_utils
from django.db.models import fields
from django.db.models.query_utils import Q
from django.utils.functional import cached_property
class Combinable:
"""
Provides the... | {
"content_hash": "81379e47c364689bc02ffe461ab01f55",
"timestamp": "",
"source": "github",
"line_count": 1087,
"max_line_length": 114,
"avg_line_length": 35.723091076356944,
"alnum_prop": 0.6110581751693235,
"repo_name": "twz915/django",
"id": "a1cec2393afe17626830474434e709499c8a4641",
"size": "388... |
'''Custom error classes.'''
class CollectionError(Exception):
'''Raise when a collection error occurs.'''
| {
"content_hash": "8e7d69ac31701e3119d2774c40438107",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 47,
"avg_line_length": 18.833333333333332,
"alnum_prop": 0.6902654867256637,
"repo_name": "getavalon/core",
"id": "964e55348e93ccd1cffa598b0ab49923fe08c697",
"size": "218",
... |
from collections import OrderedDict
from rest_framework import serializers
class NetworkCollectionSerializer(serializers.ListSerializer):
"""
NetJSON NetworkCollection
"""
@property
def data(self):
return super(serializers.ListSerializer, self).data
def to_representation(self, data)... | {
"content_hash": "2d90e00ee2250b7119f545cc75c7887f",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 64,
"avg_line_length": 22.818181818181817,
"alnum_prop": 0.6427622841965471,
"repo_name": "interop-dev/django-netjsongraph",
"id": "3323a802c6d1937727d152aa42865704d13a9eca",... |
"""Tests for datasets."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from absl import flags
from absl.testing import flagsaver
from absl.testing import parameterized
from compare_gan import datasets
import tensorflow as tf
FLAGS = flags.FLAGS
_TPU_S... | {
"content_hash": "95355088941de76d5484dde537df743f",
"timestamp": "",
"source": "github",
"line_count": 99,
"max_line_length": 75,
"avg_line_length": 33.888888888888886,
"alnum_prop": 0.684053651266766,
"repo_name": "google/compare_gan",
"id": "24eac61b8b9660ed69ed48761219434485ef406f",
"size": "39... |
import pytest
import numpy as np
import tensorflow as tf
import librosa
from kapre import Frame, Energy, MuLawEncoding, MuLawDecoding, LogmelToMFCC
from kapre.backend import _CH_FIRST_STR, _CH_LAST_STR, _CH_DEFAULT_STR
from utils import get_audio, save_load_compare
@pytest.mark.parametrize('data_format', ['default',... | {
"content_hash": "432e9f911d59c247466f80baf573eb39",
"timestamp": "",
"source": "github",
"line_count": 157,
"max_line_length": 100,
"avg_line_length": 33.52229299363057,
"alnum_prop": 0.6349990499714991,
"repo_name": "keunwoochoi/kapre",
"id": "cb2322b7c9f2422b3335d9d24f3e295b33caa1d2",
"size": "5... |
from functools import wraps
import inspect
RED = '\033[91m'
BLUE = '\033[94m'
BOLD = '\033[1m'
END = '\033[0m'
def _default_handler(e, *args, **kwargs):
pass
def silence(target_exceptions:list, exception_handler=_default_handler):
def decor(func):
@wraps(func)
def wrapper(*args, **kwargs):
... | {
"content_hash": "763f9ad78e884731cc7d3df24dd5dd40",
"timestamp": "",
"source": "github",
"line_count": 210,
"max_line_length": 118,
"avg_line_length": 35.65714285714286,
"alnum_prop": 0.4776976495726496,
"repo_name": "kashifrazzaqui/again",
"id": "d435845bc92aea8f3076861327cad1739c418734",
"size":... |
# A game with VTK and tkinter. :)
import sys
if sys.hexversion < 0x03000000:
# for Python2
import Tkinter as tkinter
else:
# for Python3
import tkinter
import vtk
from vtk.tk.vtkTkRenderWindowInteractor import vtkTkRenderWindowInteractor
# Create the pipeline
puzzle = vtk.vtkSpherePuzzl... | {
"content_hash": "f7f7718f5de65549a817cfbaa36a266b",
"timestamp": "",
"source": "github",
"line_count": 168,
"max_line_length": 74,
"avg_line_length": 24.339285714285715,
"alnum_prop": 0.669601369528002,
"repo_name": "hlzz/dotfiles",
"id": "f2bdcc34c1bd374830cd3cf0ff1b2282779e5eef",
"size": "4112",... |
import numpy as np
class HyperbolicTangentLayer(object):
"""A layer that applies tanh element-wise.
This layer has fixed scaling parameters for the tanh and
does not adjust weights during training.
"""
def __init__(self, m=2/3, alpha=1.7159, beta=0):
"""Create new HyperbolicTangentLayer.
... | {
"content_hash": "037d2be7728e8be4eee6e2a61ea97277",
"timestamp": "",
"source": "github",
"line_count": 74,
"max_line_length": 62,
"avg_line_length": 29.743243243243242,
"alnum_prop": 0.5533848250795094,
"repo_name": "Knuppknou/academia_ai",
"id": "6d6e55687d2d6226e44183690c5a8a8e1cc806c0",
"size":... |
import asyncio
import discord
import random
import scrims
from discord.ext import commands
class VoiceEntry:
def __init__(self, message, player):
self.requester = message.author
self.channel = message.channel
self.player = player
def __str__(self):
fmt = '*{0.title}* uploaded b... | {
"content_hash": "5f8d33fc7dd9d688fb08d289ebb3e41f",
"timestamp": "",
"source": "github",
"line_count": 322,
"max_line_length": 181,
"avg_line_length": 37.015527950310556,
"alnum_prop": 0.5966943535531505,
"repo_name": "PWills2013/r2Bot",
"id": "efb122a3c9915e4746dd7eeaa53ab3cb2c2bccdb",
"size": "1... |
"""
NumPy
=====
Provides
1. An array object of arbitrary homogeneous items
2. Fast mathematical operations over arrays
3. Linear Algebra, Fourier Transforms, Random Number Generation
How to use the documentation
----------------------------
Documentation is available in two forms: docstrings provided
with the c... | {
"content_hash": "8843aa6a8430dd74e41f929aef5a1191",
"timestamp": "",
"source": "github",
"line_count": 260,
"max_line_length": 85,
"avg_line_length": 34.06923076923077,
"alnum_prop": 0.6551140212237525,
"repo_name": "jorisvandenbossche/numpy",
"id": "349914b2f3a776b41b99eeada73fbf24e933eadd",
"siz... |
import warnings
from unittest import TestCase
from paste.fixture import TestApp
from paste.httpexceptions import HTTPMovedPermanently
from paste.registry import RegistryManager
import pylons
from pylons.controllers import WSGIController
from pylons.controllers.util import etag_cache
from pylons.decorators import json... | {
"content_hash": "31601af894bce1e3ee3c0062d231aaa6",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 76,
"avg_line_length": 31.49056603773585,
"alnum_prop": 0.7082085080886759,
"repo_name": "obeattie/pylons",
"id": "9efb5e065f07a8668431e5359029d8edc7f5b7fb",
"size": "1669"... |
import os
import re
import json
import time
import pdb
from pyquery import PyQuery as pq
import lxml.html
from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
from selenium.webd... | {
"content_hash": "f0980cf7af2fbfe0aed482bcf8ac80a7",
"timestamp": "",
"source": "github",
"line_count": 255,
"max_line_length": 147,
"avg_line_length": 35.384313725490195,
"alnum_prop": 0.5865011636927852,
"repo_name": "pradyumnac/valueresearch",
"id": "1e7370adf560d8dff433bab489873d80e577a256",
"s... |
"""This file is for distribute properimage
"""
# =============================================================================
# IMPORTS
# =============================================================================
import sys
import os
import setuptools
from ez_setup import use_setuptools
use_setuptools()
# ==... | {
"content_hash": "2387e6105049b19684d14ba4eb701bf6",
"timestamp": "",
"source": "github",
"line_count": 105,
"max_line_length": 79,
"avg_line_length": 31.39047619047619,
"alnum_prop": 0.4098907766990291,
"repo_name": "toros-astro/ProperImage",
"id": "660fdbaf2d9c33a0fc7d067dba47b0064cf645c6",
"size... |
import requests
import json
import time
import os
import urllib2
import random
from sqlalchemy import create_engine
from sqlalchemy import MetaData, Column, Table, ForeignKey
from sqlalchemy import Integer, String, DateTime
from sqlalchemy import func
from sqlalchemy.orm import sessionmaker
from config import *
eng... | {
"content_hash": "9c0fb924856c90cd00daf47009b7dc34",
"timestamp": "",
"source": "github",
"line_count": 153,
"max_line_length": 125,
"avg_line_length": 33.248366013071895,
"alnum_prop": 0.6264989188126597,
"repo_name": "kevinpeterson/github-process-research",
"id": "02f86bfdf4778e5c202f34c278f8ee90b4... |
import Tkinter, tkFileDialog
import json
import csv
from canari.maltego.utils import debug, progress
from canari.framework import configure #, superuser
from common.entities import RFCSV, RFEvent
from common.APIUtil import APIUtil
__author__ = 'Filip Reesalu'
__copyright__ = 'Copyright 2014, Recorded Future'
__credits... | {
"content_hash": "a9dd933c892f97c02cf760f0aadd9e1d",
"timestamp": "",
"source": "github",
"line_count": 82,
"max_line_length": 297,
"avg_line_length": 29.951219512195124,
"alnum_prop": 0.6445439739413681,
"repo_name": "cmlh/Maltego-Recorded_Future",
"id": "cc4fd2c5486b135ebc54a5ac5a9e453a6a3be4a1",
... |
from __future__ import print_function
import chainer
import chainer.functions as F
from chainer import Variable
class DCGANUpdater(chainer.training.StandardUpdater):
def __init__(self, *args, **kwargs):
self.gen, self.dis = kwargs.pop('models')
super(DCGANUpdater, self).__init__(*args, **kwargs)... | {
"content_hash": "fd123c184ad5ed0356b8f7f4180d8f68",
"timestamp": "",
"source": "github",
"line_count": 46,
"max_line_length": 68,
"avg_line_length": 30.82608695652174,
"alnum_prop": 0.5994358251057827,
"repo_name": "ysekky/chainer",
"id": "b9fda48ab2fb36fb02875dafb92a96de14e3e92d",
"size": "1441",... |
"""Weather information for air and road temperature (by Trafikverket)."""
import asyncio
from datetime import timedelta
import logging
import aiohttp
import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.const import (
ATTR_ATTRIBUTION, CONF_API_KEY, CONF_MONITOR... | {
"content_hash": "a873c81c75b5e0077b0714d3b102f34d",
"timestamp": "",
"source": "github",
"line_count": 153,
"max_line_length": 77,
"avg_line_length": 32.71895424836601,
"alnum_prop": 0.6450259688373952,
"repo_name": "jabesq/home-assistant",
"id": "c846d020c848775fd6c20dc9c5bb89bfca32c71a",
"size":... |
import ast
import pytest
import jsonschema
import time as ttime
from datetime import datetime
from bluesky.plans import scan, grid_scan
import bluesky.preprocessors as bpp
import bluesky.plan_stubs as bps
from bluesky.preprocessors import SupplementalData
from bluesky.callbacks.best_effort import BestEffortCallback
fro... | {
"content_hash": "eab5ccfda90f3990026c6d1428c472b6",
"timestamp": "",
"source": "github",
"line_count": 242,
"max_line_length": 97,
"avg_line_length": 30.71900826446281,
"alnum_prop": 0.6524078557976863,
"repo_name": "ericdill/bluesky",
"id": "09870872ddc6b0d65e14d2787149b58224822a87",
"size": "743... |
""" This module contains classes for handling DIDL-Lite metadata.
This is the XML schema used by Sonos for carrying metadata representing many
items such as tracks, playlists, composers, albums etc.
"""
# It tries to follow the class hierarchy provided by the DIDL-Lite schema
# described in the UPnP Spec, especiall... | {
"content_hash": "202d24161b6b59a48069eeaee79e4f07",
"timestamp": "",
"source": "github",
"line_count": 989,
"max_line_length": 81,
"avg_line_length": 36.68655207280081,
"alnum_prop": 0.5726648843811151,
"repo_name": "bwhaley/SoCo",
"id": "2d5b7b7e0320d4a82368071b60b4488b8990a38b",
"size": "36364",... |
"""Implementation of the flags interface."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import argparse
_global_parser = argparse.ArgumentParser()
class _FlagValues(object):
def __init__(self):
"""Global container and accessor for flags and the... | {
"content_hash": "f7319323c74c85bd205ed26024bef810",
"timestamp": "",
"source": "github",
"line_count": 110,
"max_line_length": 71,
"avg_line_length": 33.60909090909091,
"alnum_prop": 0.6205031106302408,
"repo_name": "Lab603/PicEncyclopedias",
"id": "85f9e2cb860d02166e2171e1cebd9e5ebccfc25b",
"size... |
import matplotlib.pyplot as plt
import seaborn as sb
import pandas as pd
P_letter_lang = pd.read_csv('table_langs.dat', sep=' ', header=0, index_col = 0)
plt.plot(range(26), pd.np.array(P_letter_lang["eng"]), '-')
plt.plot(range(26), pd.np.array(P_letter_lang["fre"]), '-')
plt.plot(range(26), pd.np.array(P_letter_lan... | {
"content_hash": "2d9a224769c11b1e98ba0b83e77302b7",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 80,
"avg_line_length": 40.375,
"alnum_prop": 0.6640866873065016,
"repo_name": "bmtgoncalves/IFISC2017",
"id": "aa605ca741b88d9abda74286d6dc647bc10495a0",
"size": "670",
"... |
from datadog import initialize, api
from datadog.api.constants import CheckStatus
options = {
'api_key': '9775a026f1ca7d1c6c5af9d94d9595a4',
'app_key': '87ce4a24b5553d2e482ea8a8500e71b8ad4554ff'
}
initialize(**options)
check = 'app.ok'
host = 'app1'
status = CheckStatus.OK
api.ServiceCheck.check(check=check... | {
"content_hash": "e31349d6af45d3bcb82891fe4244e6c3",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 94,
"avg_line_length": 25.4,
"alnum_prop": 0.7585301837270341,
"repo_name": "inokappa/documentation",
"id": "cac35d7a6fbef3251cf32ade791029b097854cb4",
"size": "381",
"bi... |
from model.contact import Contact
import random
def test_delete_first_contact(app, db, check_ui): # add a fixture app as a parameter
if len(db.get_contact_list()) == 0:
app.contact.create(Contact(firstname="Ivan"))
old_contacts = db.get_contact_list()
contact = random.choice(old_contacts)
app... | {
"content_hash": "e650c7cdfac327c83a677031c5944f70",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 123,
"avg_line_length": 47.9375,
"alnum_prop": 0.6988265971316818,
"repo_name": "Lana-Pa/Python-training",
"id": "25d235938921ef306c760008407fae28eadd4554",
"size": "767",
... |
from . import bagofrequests as bag
from BeautifulSoup import BeautifulSoup
from . import handlers
import re
from . import result as res
HEX_MASSAGE = [(re.compile('&#x([^;]+);'), lambda m: '&#%d;' % int(m.group(1), 16))]
class ContentRepo(object):
def __init__(self, url, **kwargs):
self.url = url
... | {
"content_hash": "4a44e3728f6835db4a038f2062d1cd20",
"timestamp": "",
"source": "github",
"line_count": 540,
"max_line_length": 120,
"avg_line_length": 32.592592592592595,
"alnum_prop": 0.5505681818181818,
"repo_name": "Sensis/pyaem",
"id": "704befe14749e8da46ea9d3b0c9ef0269c6c5b41",
"size": "17600... |
""" Python test discovery, setup and run of test functions. """
import re
import fnmatch
import functools
import py
import inspect
import sys
import pytest
from _pytest.mark import MarkDecorator, MarkerError
from py._code.code import TerminalRepr
try:
import enum
except ImportError: # pragma: no cover
# Only ... | {
"content_hash": "8f3c1678aaeec2f60fb2741e47ae42b3",
"timestamp": "",
"source": "github",
"line_count": 2169,
"max_line_length": 108,
"avg_line_length": 38.67542646380821,
"alnum_prop": 0.6022029635104367,
"repo_name": "pelme/pytest",
"id": "88c7d1a39d8a529f81df34d46925dc8fe8288646",
"size": "83887... |
from django.test import TestCase
from django.utils.timezone import get_current_timezone
from app.utils import *
from app.myblog.models import Article, Classification
class TestEncodeJson(TestCase):
def test_ecnode(self):
res = encodejson(1, {})
self.assertIsInstance(res ,str)
class TestCreateRa... | {
"content_hash": "cca036fde1a653baec31b280e0478f0d",
"timestamp": "",
"source": "github",
"line_count": 126,
"max_line_length": 110,
"avg_line_length": 36.26984126984127,
"alnum_prop": 0.613129102844639,
"repo_name": "madarou/angular-django",
"id": "b7bc6922332a89a585b6ffbc09e0aa106a795778",
"size"... |
import pytest
from .. import config
class TestYamlConfig(object):
def setup(self):
self.test_class = config.YamlConfig
def test_set_multiple(self):
conf_obj = self.test_class()
conf_obj.foo = 'foo'
conf_obj.bar = 'bar'
assert conf_obj.foo == 'foo'
assert conf_... | {
"content_hash": "92488752ae30ee56cdf7dc27f67cf356",
"timestamp": "",
"source": "github",
"line_count": 156,
"max_line_length": 71,
"avg_line_length": 30.346153846153847,
"alnum_prop": 0.5648500211237854,
"repo_name": "yghannam/teuthology",
"id": "1bea8b0d7524fba38028c36e7d295271b6391339",
"size": ... |
"""
A collection of basic statistical functions for Python. The function
names appear below.
Some scalar functions defined here are also available in the scipy.special
package where they work on arbitrary sized arrays.
Disclaimers: The function list is obviously incomplete and, worse, the
functions are not optimi... | {
"content_hash": "f2b2df75c803adcc8858811c94449070",
"timestamp": "",
"source": "github",
"line_count": 7389,
"max_line_length": 119,
"avg_line_length": 34.7559886317499,
"alnum_prop": 0.6026860115570923,
"repo_name": "jamestwebber/scipy",
"id": "2a8d7540d6fe05beb6dbab32d85dc3ef0e15e689",
"size": "... |
import project
import company
import report
import wizard
import res_partner
import res_config
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
| {
"content_hash": "8cf6e338e1e292896bfc918ca470abc5",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 65,
"avg_line_length": 20.25,
"alnum_prop": 0.8333333333333334,
"repo_name": "diogocs1/comps",
"id": "becd17f0b78d73aa89c3c61d76317867c9e9a1c7",
"size": "1141",
"binary": ... |
"""Decorators for Click commands"""
import asyncio
from functools import wraps
import click
from planet import exceptions
# https://github.com/pallets/click/issues/85#issuecomment-503464628
def coro(func):
"""Wrap async functions so they can be run sync with Click.
Parameters:
func: a Click command... | {
"content_hash": "26133e6a9502b58a14ad8570ffada70b",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 78,
"avg_line_length": 22.78846153846154,
"alnum_prop": 0.640506329113924,
"repo_name": "planetlabs/planet-client-python",
"id": "f25cadc89818116108b434977bbcadce524bc231",
... |
"""Interface definitions for working with raw packets"""
from twisted.internet import protocol
from zope.interface import Interface
class IRawDatagramProtocol(Interface):
"""An interface for protocols such as UDP, ICMP and TCP."""
def addProto():
"""
Add a protocol on top of this one.
... | {
"content_hash": "1d936fae519e085b24a2f35d59636408",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 66,
"avg_line_length": 25.066666666666666,
"alnum_prop": 0.6143617021276596,
"repo_name": "nlloyd/SubliminalCollaborator",
"id": "0d3875bae3ca84cdf2c89f4eece8ed181d462e93",
... |
""" Various utilities for dealing with percept data """
from rigor.s3 import DefaultS3Client
from rigor.types import Percept
try:
import cv2
import numpy as np
_kImageReadFlags = cv2.CV_LOAD_IMAGE_UNCHANGED
except ImportError:
pass
from urlparse import urlsplit
import urllib2
import contextlib
import os
class P... | {
"content_hash": "7ff464999dfd0b708f825d73449a58b4",
"timestamp": "",
"source": "github",
"line_count": 127,
"max_line_length": 196,
"avg_line_length": 29.95275590551181,
"alnum_prop": 0.7268664563617245,
"repo_name": "blindsightcorp/rigor",
"id": "0d62d858fa1255623a09b5289c0e5e8d53e5185b",
"size":... |
"""
requests.safe_mode
~~~~~~~~~~~~
This module contains a decorator that implements safe_mode.
:copyright: (c) 2012 by Kenneth Reitz.
:license: ISC, see LICENSE for more details.
"""
from .models import Response
from .packages.urllib3.response import HTTPResponse
from .exceptions import RequestException, Connectio... | {
"content_hash": "540d20e724090a06c613279a7a3d91d6",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 101,
"avg_line_length": 37,
"alnum_prop": 0.6251778093883357,
"repo_name": "splunk/splunk-webframework",
"id": "0fb8d7052adcb894d940db7874e633ed934dfcdb",
"size": "1431",
... |
from oslo_log import log as logging
import pecan
from pecan import rest
from six.moves import http_client
import wsme
from ironic.api.controllers import base
from ironic.api.controllers import link
from ironic.api.controllers.v1 import utils as api_utils
from ironic.api.controllers.v1 import volume_connector
from iron... | {
"content_hash": "43c75cdbf0918a2675ba4682af10bbc4",
"timestamp": "",
"source": "github",
"line_count": 121,
"max_line_length": 79,
"avg_line_length": 35.049586776859506,
"alnum_prop": 0.5963216222589012,
"repo_name": "ruyang/ironic",
"id": "9b2eb8447fa30e10bdeafe2980f2d0aa65b7fae8",
"size": "4851"... |
"""Support for INSTEON Modems (PLM and Hub)."""
import asyncio
import logging
from pyinsteon import async_close, async_connect, devices
from homeassistant.config_entries import SOURCE_IMPORT
from homeassistant.const import CONF_PLATFORM, EVENT_HOMEASSISTANT_STOP
from homeassistant.data_entry_flow import RESULT_TYPE_C... | {
"content_hash": "648bef4c22881c15ce5cd27f5d2763f6",
"timestamp": "",
"source": "github",
"line_count": 166,
"max_line_length": 107,
"avg_line_length": 34.102409638554214,
"alnum_prop": 0.6587175410704822,
"repo_name": "titilambert/home-assistant",
"id": "62032b681b83099d1e27b42133cabcd774995d2f",
... |
from __future__ import print_function, division
from neuralnilm import Net, RealApplianceSource, BLSTMLayer, SubsampleLayer, DimshuffleLayer
from lasagne.nonlinearities import sigmoid, rectify
from lasagne.objectives import crossentropy
from lasagne.init import Uniform, Normal
from lasagne.layers import LSTMLayer, Dens... | {
"content_hash": "75b62fa9cbc34f911a9b9b8bd38d433c",
"timestamp": "",
"source": "github",
"line_count": 203,
"max_line_length": 92,
"avg_line_length": 26.211822660098523,
"alnum_prop": 0.6829543318925014,
"repo_name": "JackKelly/neuralnilm_prototype",
"id": "e1228d814516634df28f1c16361f91e89a66a438",... |
"""Unittest for googlesafebrowsing.sblist."""
import sblist
import server
import util
import unittest
class ListTest(unittest.TestCase):
def assertSameElements(self, a, b):
a = sorted(list(a))
b = sorted(list(b))
self.assertEqual(a, b, 'Expected: [%s], Found: [%s]' %
(', '.join(m... | {
"content_hash": "c84c1979ca26d636a47992034a56bb43",
"timestamp": "",
"source": "github",
"line_count": 234,
"max_line_length": 78,
"avg_line_length": 40.14957264957265,
"alnum_prop": 0.6623736029803087,
"repo_name": "robertobarreda/django-safe-browsing",
"id": "3c520f7e004dd2d3a51e7086aeb4f2fe70b84b... |
"""
Script which is automatically run on the MiniBot's Pi upon startup.
Must be configured in /etc/init.d/minibotinit.sh on the RPi.
"""
from minibot.bot import Bot
from minibot.hardware.communication.TCP import TCP
import minibot.hardware.communication.UDP
import json
from threading import Thread
import time
import ... | {
"content_hash": "1304c01435d1eb5b23848075cf8f865f",
"timestamp": "",
"source": "github",
"line_count": 115,
"max_line_length": 88,
"avg_line_length": 28.48695652173913,
"alnum_prop": 0.6217948717948718,
"repo_name": "cornell-cup/cs-minibot",
"id": "d900d835d533062a0f3d2c59883c9630d8bb38c3",
"size"... |
import pygame
from pygame.locals import *
from Model import GameBoard
from Agent import SmartAgent as Agent
import threading
from copy import deepcopy
class GameSpace:
moveStatement = "Move #{0}: enter choice for Player {1}: {2}"
resourcesBase = "resources/"
xChar = resourcesBase+"xChar.png"
oChar = resourcesBase+... | {
"content_hash": "8f3e7d29b9e5f8d228cd5d541a710288",
"timestamp": "",
"source": "github",
"line_count": 119,
"max_line_length": 105,
"avg_line_length": 27.30252100840336,
"alnum_prop": 0.6491228070175439,
"repo_name": "Digmaster/TicTacToe",
"id": "f4f946604b5260a94366806b1ce437f61c30230f",
"size": ... |
from werkzeug.contrib.fixers import ProxyFix
from app import create_app
app = create_app()
app.wsgi_app = ProxyFix(app.wsgi_app)
if __name__ == '__main__':
app.run(host='0.0.0.0')
| {
"content_hash": "554f514cb2bef14ed72aac954a176bb6",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 44,
"avg_line_length": 20.77777777777778,
"alnum_prop": 0.6684491978609626,
"repo_name": "DoubleHYH/my_Blog",
"id": "070d51934a56efe27fdf2eeab2c5a7d491522a01",
"size": "234"... |
''' main.py '''
import logging
import tornado.ioloop
import tornado.web
from tornado.httpclient import AsyncHTTPClient
from tornado.options import define, options, parse_command_line
from heron.shell.src.python import handlers
default_handlers = [
(r"^/jmap/([0-9]+$)", handlers.JmapHandler),
(r"^/histo/([0-9... | {
"content_hash": "8699fcd0f7bfea00420bc7b4ee34552b",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 80,
"avg_line_length": 35.523809523809526,
"alnum_prop": 0.6816353887399463,
"repo_name": "huijunwu/heron",
"id": "c476eca56e7eca970688684eacc67998a5ee1db8",
"size": "2343"... |
from . import proputils
class PropertyTestMixin(object):
def setUp(self):
self.C = self.new_class()
def do_test_set_and_delete(self, c):
c.p = 'x'
self.assertEquals('x', c.p)
c.p = 'y'
self.assertEquals('y', c.p)
del c.p
self.assertRaises(AttributeError, getattr, c, 'p')
self.as... | {
"content_hash": "1dc9b987415765dcc9aaf93758fa3fc5",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 65,
"avg_line_length": 26.238095238095237,
"alnum_prop": 0.6687840290381125,
"repo_name": "slobberchops/sordid-tools",
"id": "f3e1a1a6c51a727604d4d66870193724da71dcd1",
"si... |
import datetime
from django.db import models
from django.utils import timezone
# Create your models here.
class Poll(models.Model):
question = models.CharField(max_length=200)
pub_date = models.DateTimeField('date published')
def __unicode__(self):
return self.question
def was_published_... | {
"content_hash": "dcef8054616ec617a960d2dc1f93a6a7",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 70,
"avg_line_length": 28.896551724137932,
"alnum_prop": 0.6837708830548926,
"repo_name": "linzeyang/Django_Tutorial",
"id": "535cdb988b74f50dc68a25681374dcec420cd4c6",
"si... |
"""Synchronize replicas for training."""
from tensorflow.python.distribute import distribution_strategy_context
from tensorflow.python.framework import indexed_slices
from tensorflow.python.framework import ops
from tensorflow.python.ops import array_ops
from tensorflow.python.ops import control_flow_ops
from tensorflo... | {
"content_hash": "9426ab60ec4db7c218237d10d17ab83e",
"timestamp": "",
"source": "github",
"line_count": 485,
"max_line_length": 98,
"avg_line_length": 42.228865979381446,
"alnum_prop": 0.6862946145207753,
"repo_name": "paolodedios/tensorflow",
"id": "23b5f32b0b147ea74c949a5440c837b96bfb4e6a",
"size... |
"""System for assigning and displaying ratings of explorations."""
import datetime
from core.domain import event_services
from core.domain import exp_services
from core.platform import models
import feconf
(exp_models, user_models,) = models.Registry.import_models([
models.NAMES.exploration, models.NAMES.user])
t... | {
"content_hash": "dbbbba217272298b613d5ae7ba3e8d0b",
"timestamp": "",
"source": "github",
"line_count": 95,
"max_line_length": 78,
"avg_line_length": 36.578947368421055,
"alnum_prop": 0.6975539568345324,
"repo_name": "MaximLich/oppia",
"id": "0bb75814120eac39cac34bf489c86d7a37ce54fc",
"size": "4098... |
from .utilities import normalize, cross_val_score, add_intercept
__all__ = ['normalize', 'cross_val_score', 'add_intercept']
| {
"content_hash": "ba5b2461e43340b613b05edb4cc7dfe4",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 64,
"avg_line_length": 42,
"alnum_prop": 0.7142857142857143,
"repo_name": "bhillmann/koko",
"id": "c4f238ae426d2f6e709a3e5a43c69186ef34f442",
"size": "126",
"binary": fals... |
from ..excel_comparsion_test import ExcelComparisonTest
from ...workbook import Workbook
class TestCompareXLSXFiles(ExcelComparisonTest):
"""
Test file created by XlsxWriter against a file created by Excel.
"""
def setUp(self):
self.maxDiff = None
filename = 'chart_crossing02.xlsx'
... | {
"content_hash": "01845ed209ae8d305031809862e91237",
"timestamp": "",
"source": "github",
"line_count": 54,
"max_line_length": 68,
"avg_line_length": 27.22222222222222,
"alnum_prop": 0.5693877551020409,
"repo_name": "jkyeung/XlsxWriter",
"id": "23dd0b815240895d7598921a5c3103f056a7d786",
"size": "16... |
from ovirtcli.command.action import ActionCommand
from ovirtcli.command.add import AddCommand
from ovirtcli.command.connect import ConnectCommand
from ovirtcli.command.console import ConsoleCommand
from ovirtcli.command.remove import RemoveCommand
from ovirtcli.command.disconnect import DisconnectCommand
from ovirtcli.... | {
"content_hash": "e35ae008ade34cd3154b15d5ed6bb908",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 57,
"avg_line_length": 49.38461538461539,
"alnum_prop": 0.8785046728971962,
"repo_name": "oVirt/ovirt-engine-cli",
"id": "fb2b847dedb61387c72fb4a9990c7ece97c1e881",
"size":... |
"""
Simple Python Wrapper for LibOFP.
No external dependencies; uses builtin json module.
"""
import json
import os
import struct
import subprocess
import sys
def getDefaultPort():
try:
return int(os.environ.get('LIBOFP_DEFAULT_PORT'))
except:
return 6653
DEFAULT_OPENFLOW_PORT = getDefault... | {
"content_hash": "659eaa45064ffe03ab8cdd1958b17cb9",
"timestamp": "",
"source": "github",
"line_count": 141,
"max_line_length": 105,
"avg_line_length": 27.02836879432624,
"alnum_prop": 0.5657307793230123,
"repo_name": "byllyfish/oftr",
"id": "965c5594d351538fa51dd396144b20187dea97ed",
"size": "3811... |
from __future__ import with_statement
import re
from datetime import datetime
from trac.attachment import Attachment
from trac.core import TracError
from trac.resource import Resource, ResourceNotFound
from trac.ticket.api import TicketSystem
from trac.util import embedded_numbers, partition
from trac.uti... | {
"content_hash": "355ee3eb9184a3d52fa493fee1c2ff56",
"timestamp": "",
"source": "github",
"line_count": 1149,
"max_line_length": 88,
"avg_line_length": 41.40644038294169,
"alnum_prop": 0.5018076341012275,
"repo_name": "i-rabot/tractogithub",
"id": "f53a8bd7b69725dc74c9936d21960110cb6a2a1e",
"size":... |
from PyObjCTools.TestSupport import *
from Quartz.QuartzCore import *
from Quartz import *
class TestCIPluginInterfaceHelper (NSObject):
def load_(self, h): return 1
class TestCIPlugInInterface (TestCase):
def testMethods(self):
self.assertResultIsBOOL(TestCIPluginInterfaceHelper.load_)
def no_te... | {
"content_hash": "3cb58686be34ae33953cbd776aeabd91",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 66,
"avg_line_length": 28.647058823529413,
"alnum_prop": 0.7186858316221766,
"repo_name": "albertz/music-player",
"id": "57b7f028aeb99a5488956233434c2db61ebc11b6",
"size": ... |
import os
if 'SYNCHRONY_DATABASE' in os.environ:
SQLALCHEMY_DATABASE_URI = os.environ['SYNCHRONY_DATABASE']
else:
SQLALCHEMY_DATABASE_URI = "sqlite:///cache.db"
# Let users without accounts reap the benefits of decentralised web pages:
OPEN_PROXY = True
# If you haven't got an internet connection change this to 0.... | {
"content_hash": "e0d551432c1ebc498704d844a5bfef13",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 74,
"avg_line_length": 28.608695652173914,
"alnum_prop": 0.7659574468085106,
"repo_name": "Psybernetics/Synchrony",
"id": "cced50dd1edc34cccb3635109b91ba7bfdb479b4",
"size"... |
from flask_admin.contrib.sqla import ModelView
class AdminUserView(ModelView):
"""Vista que permite realizar operaciones CRUD sobre el modelo User"""
column_list = ("name", "email", "skills", "roles")
class AdminRoleView(ModelView):
"""Vista que permite realizar operaciones CRUD sobre el modelo Role"... | {
"content_hash": "f61e3259ab400ed4ee5f5d85a4d0cab3",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 74,
"avg_line_length": 22.2,
"alnum_prop": 0.7027027027027027,
"repo_name": "AthelasPeru/laborapp",
"id": "d7e6e523bcac4691ed8f0d4a38b4c7b10ad3342d",
"size": "444",
"bina... |
from __future__ import absolute_import
import atexit
import os
import re
import json
import collections
import tempfile
from StringIO import StringIO
from PIL import Image
from atx import logutils
logger = logutils.getLogger(__name__)
_DISPLAY_RE = re.compile(
r'.*DisplayViewport{valid=true, .*orientation=(?P<... | {
"content_hash": "e22ac85b4ebe0b788105a0776ab76609",
"timestamp": "",
"source": "github",
"line_count": 294,
"max_line_length": 134,
"avg_line_length": 31.700680272108844,
"alnum_prop": 0.5335836909871244,
"repo_name": "Andy-hpliu/AirtestX",
"id": "dc36ce7b2b447dbb443e79e479456a914c75a96d",
"size":... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.