text stringlengths 4 1.02M | meta dict |
|---|---|
from matrixbot import utils
class BroadcastPlugin:
def __init__(self, bot, settings):
self.name = "BroadcastPlugin"
self.logger = utils.get_logger()
self.bot = bot
self.settings = settings
self.logger.info("BroadcastPlugin loaded (%(name)s)" % settings)
def dispatch(sel... | {
"content_hash": "f5c2557d5ff2b16a85dd052807e5b6cd",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 92,
"avg_line_length": 40.48837209302326,
"alnum_prop": 0.5577254451464676,
"repo_name": "psaavedra/matrix-bot",
"id": "06e83a7b2e95c7b0b844b90fae8f9800b84574cd",
"size": "... |
"""Prepares the data used for DeepLab training/evaluation."""
import tensorflow as tf
from deeplab.core import feature_extractor
from deeplab.core import preprocess_utils
# The probability of flipping the images and labels
# left-right during training
_PROB_OF_FLIP = 0.5
def preprocess_image_and_label(image,
... | {
"content_hash": "3a81d0a9dc5050fc62c833c06641d146",
"timestamp": "",
"source": "github",
"line_count": 123,
"max_line_length": 80,
"avg_line_length": 39.53658536585366,
"alnum_prop": 0.6512440880115156,
"repo_name": "tombstone/models",
"id": "9ca8bce4eb9104b22469419c4e6af4beaba9406a",
"size": "558... |
from __future__ import print_function
# For flag of bool type, we consider the strings 'False', 'false' and '0'
# as False, and the string s'True', 'true', '1' as True.
# We also accept the bool type as its corresponding value!
import logging
import os
import shlex
import sys
import warnings
from six import StringIO
... | {
"content_hash": "4cd8b3000be37156c9bdb232c6ac72bc",
"timestamp": "",
"source": "github",
"line_count": 420,
"max_line_length": 80,
"avg_line_length": 34.864285714285714,
"alnum_prop": 0.5983063579867514,
"repo_name": "cmdunkers/DeeperMind",
"id": "196214722ec6faa50065cc6200877e409984284b",
"size":... |
import copy
from oslo_log import log
from manila.common import constants
from manila.i18n import _, _LI
from manila import utils
LOG = log.getLogger(__name__)
def locked_access_rules_operation(operation):
"""Lock decorator for access rules operations.
Takes a named lock prior to executing the operation. T... | {
"content_hash": "212e85e24a8b9d2616fc94e23005247c",
"timestamp": "",
"source": "github",
"line_count": 540,
"max_line_length": 79,
"avg_line_length": 43.03333333333333,
"alnum_prop": 0.5602031155865392,
"repo_name": "vponomaryov/manila",
"id": "6bca410524ba43a2dd317713c50444df580ab967",
"size": "2... |
def oracle_connect(ip, port, username, passwd, sid=None, service_name=None):
import cx_Oracle
if sid:
# sid connect
dsn = cx_Oracle.makedsn(ip, port, sid)
instance_status = 1
db = cx_Oracle.connect(username, passwd, dsn)
return db
if service_name:
# service_na... | {
"content_hash": "f55401f29c1754de244adb63b4fc13e8",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 76,
"avg_line_length": 35.38461538461539,
"alnum_prop": 0.5869565217391305,
"repo_name": "CreditEaseDBA/Themis",
"id": "cde159e8af49cb15d5560e3686d0a9889ad483dc",
"size": "... |
import os
import sys
import importlib
import argparse
__dir__ = os.path.dirname(__file__)
sys.path.insert(0, os.path.join(__dir__, ''))
import cv2
import logging
import numpy as np
from pathlib import Path
ppcv = importlib.import_module('.', 'ppcv')
tools = importlib.import_module('.', 'tools')
tests = importlib.im... | {
"content_hash": "68386c3b2ca990e4b57cfef8b4501e9c",
"timestamp": "",
"source": "github",
"line_count": 66,
"max_line_length": 115,
"avg_line_length": 27.106060606060606,
"alnum_prop": 0.606484069312465,
"repo_name": "PaddlePaddle/models",
"id": "49ba871bcb785e723181da11ca6d85faa542a1ca",
"size": "... |
import urllib
from utils import simplejson, geocoder_factory
# http://www.multimap.com/openapidocs/1.2/web_service/ws_geocoding.htm
def geocode(q, api_key):
base_url = 'http://developer.multimap.com/API/geocode/1.2/%s' % urllib.quote(api_key)
json = simplejson.load(urllib.urlopen(base_url + '?' + urllib.urlen... | {
"content_hash": "c13adb6747f071208da2c1d68db99bd1",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 89,
"avg_line_length": 33.476190476190474,
"alnum_prop": 0.6088193456614509,
"repo_name": "simonw/geocoders",
"id": "d0400afa4ca24198de3a48e04f9b7242ad7f7fde",
"size": "703... |
import operator
import abc
class Expression(object):
__metaclass__ = abc.ABCMeta
def __init__(self):
pass
@abc.abstractmethod
def get_value(self):
pass
@abc.abstractmethod
def __str__(self):
pass
@abc.abstractmethod
def copy(self):
pass
@classmeth... | {
"content_hash": "606790ea1d12563c2a8a73aa68bafffb",
"timestamp": "",
"source": "github",
"line_count": 357,
"max_line_length": 97,
"avg_line_length": 23.394957983193276,
"alnum_prop": 0.5692049808429118,
"repo_name": "simone-campagna/py-structparser",
"id": "42ad312726fa5222de9735a5dc90f9604a3844f2"... |
"""A play local music files example
To use the script:
* Make sure soco is installed
* Drop this script into a folder that, besides python files, contains
nothing but music files
* Choose which player to use and run the script at the command line as such:
play_local_files.py "Living Room"
NOTE: The script has be... | {
"content_hash": "30e4b101ed1677867fca69fad95ea41a",
"timestamp": "",
"source": "github",
"line_count": 159,
"max_line_length": 78,
"avg_line_length": 33.61006289308176,
"alnum_prop": 0.6538173652694611,
"repo_name": "dajobe/SoCo",
"id": "4f43dfccbe656e1631ca06d0bd46c538caf85cf8",
"size": "5344",
... |
"""Tests for flag_util.py."""
import unittest
from perfkitbenchmarker import flag_util
class TestIntegerList(unittest.TestCase):
def testSimpleLength(self):
il = flag_util.IntegerList([1, 2, 3])
self.assertEqual(len(il), 3)
def testRangeLength(self):
il = flag_util.IntegerList([1, (2, 5), 9])
s... | {
"content_hash": "7f575a27687e55e7be32757e8ca0dd99",
"timestamp": "",
"source": "github",
"line_count": 88,
"max_line_length": 63,
"avg_line_length": 27.318181818181817,
"alnum_prop": 0.6580698835274542,
"repo_name": "kivio/PerfKitBenchmarker",
"id": "eebcae05830683773653959a3cf01ce756963c7a",
"siz... |
from openstack.tests.unit import base
from openstack.orchestration.v1 import stack_environment as se
FAKE = {
'encrypted_param_names': ['n1', 'n2'],
'event_sinks': {
's1': 'v1'
},
'parameters': {
'key_name': {
'type': 'string'
}
},
'parameter_defaults': {
... | {
"content_hash": "23f3eb632a2569ceca9a64ae87554243",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 76,
"avg_line_length": 27.636363636363637,
"alnum_prop": 0.5921052631578947,
"repo_name": "dtroyer/python-openstacksdk",
"id": "08737dc7e428cd42efd2ed48eb794205f268644d",
"... |
from django.shortcuts import render, render_to_response, redirect
from django.views.generic.base import View
from decision_engine.settings import DEBUG
from venue.models import Event
from decision.models import Decision, DecisionAnswers
from guest.models import Guest, GuestAnswers
from django.http import HttpResponse
i... | {
"content_hash": "0c02c198492e92e9cf6e7b19076c9cfa",
"timestamp": "",
"source": "github",
"line_count": 113,
"max_line_length": 98,
"avg_line_length": 37.13274336283186,
"alnum_prop": 0.6341754051477597,
"repo_name": "civiclee/Hack4Cause2017",
"id": "a363272fabcc7864136bd6f91056ce1963bcf388",
"size... |
import copy
import re
from collections import OrderedDict
from collections import defaultdict
from app.data_model.answer_store import natural_order
from app.questionnaire_state.state_answer import StateAnswer
from app.questionnaire_state.state_question import StateQuestion
class RepeatingAnswerStateQuestion(StateQue... | {
"content_hash": "5b683d48dcd7d5ed62e89c39c877af96",
"timestamp": "",
"source": "github",
"line_count": 91,
"max_line_length": 119,
"avg_line_length": 41.252747252747255,
"alnum_prop": 0.6728822589238146,
"repo_name": "qateam123/eq",
"id": "b73fc12cc6a5b6647b97812936487ba9f64b4c59",
"size": "3754",... |
from rally.common.i18n import _
from rally.common import logging
from rally.common import utils as rutils
from rally import consts
from rally import osclients
from rally.plugins.openstack.cleanup import manager as resource_manager
from rally.plugins.openstack.scenarios.nova import utils as nova_utils
from rally.plugins... | {
"content_hash": "0be9473be67df19c21fb68755bf29b1c",
"timestamp": "",
"source": "github",
"line_count": 104,
"max_line_length": 78,
"avg_line_length": 35.92307692307692,
"alnum_prop": 0.5,
"repo_name": "eayunstack/rally",
"id": "aeb293a2c9a68afe9b63056b7375bb21e1b0e319",
"size": "4302",
"binary":... |
"""
This module defines base classes for worker, aggregator and stats
processor.
Look at pyaloha.main module for a pipeline sequence understanding.
"""
from __future__ import print_function
import multiprocessing
import shutil
import traceback
from pyaloha.event_factory import EventFactory
from pyaloha.proto... | {
"content_hash": "ef954135100879910238e11ba90a1c15",
"timestamp": "",
"source": "github",
"line_count": 160,
"max_line_length": 79,
"avg_line_length": 31.7375,
"alnum_prop": 0.6478928712091374,
"repo_name": "ruilin/RLMap",
"id": "7abf77621d9d2e34259122d0c9b91089f7bf0c54",
"size": "5078",
"binary"... |
"""
build.py
~~~~~~~~
This module builds a bloomfilter from the NSRL Whitelist Database.
:copyright: (c) 2014 by Josh "blacktop" Maine.
:license: GPLv3
"""
import os
import binascii
from pybloom import BloomFilter
nsrl_path = '/nsrl/NSRLFile.txt'
error_rate = 0.01
# reference - http://stackoverflow.com/a/9631635... | {
"content_hash": "52ad35753e88c18b70b3ecffc1bc8005",
"timestamp": "",
"source": "github",
"line_count": 63,
"max_line_length": 82,
"avg_line_length": 28.714285714285715,
"alnum_prop": 0.5439469320066335,
"repo_name": "kost/docker-kf",
"id": "a25c29aeb5f78bc93833d844fa8907c0b6575792",
"size": "1857"... |
"""
Tests for the public interface of Automat.
"""
from functools import reduce
from unittest import TestCase
from .. import MethodicalMachine, NoTransition
class MethodicalTests(TestCase):
"""
Tests for L{MethodicalMachine}.
"""
def test_oneTransition(self):
"""
L{MethodicalMachine}... | {
"content_hash": "7ea95099f5a0fdc1d2a4004afae2ccb7",
"timestamp": "",
"source": "github",
"line_count": 399,
"max_line_length": 79,
"avg_line_length": 32.849624060150376,
"alnum_prop": 0.5269703212024109,
"repo_name": "ntuecon/server",
"id": "c94ee7e3130df72cb0338937802b30376ace4aee",
"size": "1310... |
import sys, os, logging
from hyperopt import hp, fmin, tpe
from hyperopt import STATUS_OK, STATUS_FAIL
from ghosh import GhoshModel, MODEL_FILE
LEARN = 'a'
KERNEL = 'kernel'
BATCH = 'batch'
log = logging.getLogger('OPTIMIZER')
class Optimizer:
def __init__(self, model, output_dir, train_path, validation_path)... | {
"content_hash": "fbf50680b89e449cd6ef7d85c8e03e94",
"timestamp": "",
"source": "github",
"line_count": 104,
"max_line_length": 89,
"avg_line_length": 28.596153846153847,
"alnum_prop": 0.5457296570275723,
"repo_name": "cosanlab/emote",
"id": "1f11d89f93bc15a2b8711557ee5f2b9f92e2dc9f",
"size": "2974... |
"""Dropout operations and handling."""
# Copyright 2015-present Scikit Flow Authors. All Rights Reserved.
#
# 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/licen... | {
"content_hash": "733251783d9592d931342ffcc351d74b",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 77,
"avg_line_length": 33.644444444444446,
"alnum_prop": 0.6651254953764861,
"repo_name": "dansbecker/skflow",
"id": "b0c5836632ff0bea713e560e75bdee0e5223a059",
"size": "15... |
import sys
import unicodedata
#reload(sys)
#sys.setdefaultencoding("utf-8")
class StopwordFilter:
def __init__(self):
self.list = []
def add_stopword(self, word):
self.list.append(word)
def get_stopword_list(self):
return self.list
def filter(self, sentence):
... | {
"content_hash": "7a4e27b745862f09fcc30eb00ec5b8d9",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 83,
"avg_line_length": 28.542857142857144,
"alnum_prop": 0.5785785785785785,
"repo_name": "dhmodi/virtual_patient_assistant",
"id": "be79a0e461d140e450b00bff34e7cd67c42e3ac3"... |
"""
Integer factorization
"""
from __future__ import print_function, division
import random
import math
from .primetest import isprime
from .generate import sieve, primerange, nextprime
from sympy.core import sympify
from sympy.core.evalf import bitcount
from sympy.core.logic import fuzzy_and
from sympy.core.numbers ... | {
"content_hash": "44eec6ea0b7dee2cd888efc72a8cc3b9",
"timestamp": "",
"source": "github",
"line_count": 1581,
"max_line_length": 86,
"avg_line_length": 29.838077166350413,
"alnum_prop": 0.523169542544622,
"repo_name": "liangjiaxing/sympy",
"id": "2d850a6c4990551e6eff220ded4ed2325542dd5a",
"size": "... |
import pycurl
import io
import json
jsonStr = '{"port":8099, "fileName":"plugin.xml", "line":5, "col":5, "offsetline":4}'
jsonStr1 = '{"port":8091, "fileName":"plugin.xml", "line":2, "col":0, "offsetline":4}'
jsonStr2 = '{"port":8091, "fileName":"plugin.xml", "line":2, "col":5, "offsetline":0}'
jsonStr3 = '{"port":809... | {
"content_hash": "c4861c2b5949693ace11f6f2b9ce4399",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 136,
"avg_line_length": 34.68181818181818,
"alnum_prop": 0.6435124508519003,
"repo_name": "luoluyao/AppetizerRemoteCall",
"id": "fea9667d27e63aaea9de313a64bc732508187b26",
... |
"""Paddings."""
from sonnet.src.pad import causal
from sonnet.src.pad import create
from sonnet.src.pad import full
from sonnet.src.pad import reverse_causal
from sonnet.src.pad import same
from sonnet.src.pad import valid
__all__ = (
"causal",
"create",
"full",
"reverse_causal",
"same",
"vali... | {
"content_hash": "69742d8cb27d1757334e93a50ab5f0fb",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 41,
"avg_line_length": 19.176470588235293,
"alnum_prop": 0.6717791411042945,
"repo_name": "deepmind/sonnet",
"id": "b8fb9c9666ac524cb8e153e77b476a0f1aa937e4",
"size": "1009... |
from __future__ import division
'''
This file provides an active learning environment for the demo interface.
Needs the file 'Topic.xlsx' as input.
Description of functionality
---
data model:
COMMENT KASPAR: I interpreted 'score' as the class of the noun phrase, i.e. 0 or 1.
datapoint = { str(noun phrase) ... | {
"content_hash": "276d15f0c8c342d44cbb10f664ff2c00",
"timestamp": "",
"source": "github",
"line_count": 318,
"max_line_length": 148,
"avg_line_length": 28.70440251572327,
"alnum_prop": 0.6214943032427696,
"repo_name": "ControCurator/controcurator",
"id": "b3e136d100edc1edfd02948f1398efd3ec83adb1",
... |
import mock
import unittest
from airflow import DAG, configuration
from airflow.contrib.operators.druid_operator import DruidOperator
from airflow.utils import timezone
from airflow.models import TaskInstance
DEFAULT_DATE = timezone.datetime(2017, 1, 1)
class TestDruidOperator(unittest.TestCase):
def setUp(self... | {
"content_hash": "98aac7ae225ed556b9d40e8287bf1786",
"timestamp": "",
"source": "github",
"line_count": 79,
"max_line_length": 94,
"avg_line_length": 32,
"alnum_prop": 0.4964398734177215,
"repo_name": "zack3241/incubator-airflow",
"id": "c8f92f5958c0cd7ff941a2aea890cd5a4dd43df6",
"size": "3097",
... |
"""This example fetches data from PQL tables and creates match table files."""
__author__ = ('Nicholas Chen',
'Joseph DiLallo')
import tempfile
# Import appropriate modules from the client library.
from googleads import dfp
def main(client):
# Initialize a report downloader.
report_downloader = c... | {
"content_hash": "e5d392e5dd84baf7ac9bc6ba3c468d3d",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 79,
"avg_line_length": 32.21951219512195,
"alnum_prop": 0.6866010598031794,
"repo_name": "coxmediagroup/googleads-python-lib",
"id": "18f2080632b18c06a787db536fb72ad23abbe308... |
import os
from som.wordfish.structures import (
structure_compressed,
structure_folder
)
# If you want to control the debug level, change MESSAGELEVEL in your
# environment
# Eg, only print critical information.
os.environ['MESSAGELEVEL'] = "CRITICAL"
# File
compressed_file = "data.zip"
structure = struct... | {
"content_hash": "8002a43d4548561ccef4861adf6a011e",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 70,
"avg_line_length": 22.1,
"alnum_prop": 0.751131221719457,
"repo_name": "radinformatics/som-tools",
"id": "de4f937b35078f4b7dce9bd810d5d956f918e193",
"size": "695",
"b... |
"""CompactBlocksTest -- test compact blocks (BIP 152, without segwit support, version 1)
"""
import random
from test_framework.blocktools import create_block, create_coinbase
from test_framework.messages import BlockTransactions, BlockTransactionsRequest, calculate_shortid, CBlock, CBlockHeader, CInv, COutPoint, CTr... | {
"content_hash": "6a9dbb12e4b831f16fb50ec3057963fc",
"timestamp": "",
"source": "github",
"line_count": 794,
"max_line_length": 433,
"avg_line_length": 46.44458438287154,
"alnum_prop": 0.643788811454294,
"repo_name": "dashpay/dash",
"id": "a3c750872f8cb57d5c64e5f00e20ac037c8db9ae",
"size": "37086",... |
"""
WSGI config for beauty_and_pics project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/howto/deployment/wsgi/
"""
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "beauty_and_pics.settings")
fr... | {
"content_hash": "30ee92b995badae618275daa998fd6bf",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 78,
"avg_line_length": 28.928571428571427,
"alnum_prop": 0.7728395061728395,
"repo_name": "entpy/beauty-and-pics",
"id": "10d7b48ef3393e4fb71a7a53dc263a1beab9b5df",
"size":... |
import creole
from .utils import binders_map, object_slug
class PinaxWikiHtmlEmitter(creole.HtmlEmitter):
def __init__(self, wiki, root, link_rules=None):
self.wiki = wiki
super().__init__(root, link_rules)
def link_emit(self, node):
target = node.content
if node.children:
... | {
"content_hash": "0ac2a82da0fdb08cafcdb918df85bd9b",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 85,
"avg_line_length": 33.54838709677419,
"alnum_prop": 0.6019230769230769,
"repo_name": "pinax/pinax-wiki",
"id": "4d4923ba51d75b1be6a38767501cb15f4e060e3e",
"size": "1040... |
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
("djasana", "0011_modifies_choices"),
]
operations = [
migrations.AlterField(
model_name="project",
... | {
"content_hash": "7cf071f7021dea231a8634d65bc796ac",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 60,
"avg_line_length": 23.75,
"alnum_prop": 0.5473684210526316,
"repo_name": "sbywater/django-asana",
"id": "6f049cf80cae005e34d0961c62e6321a07f8d03d",
"size": "643",
"bi... |
"""Defun decorator for defining graph-mode functions."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import collections
import functools
import re
import sys
import threading
import types as types_lib
import weakref
import numpy as np
import six
from ... | {
"content_hash": "396e56cc215fbdf58ba94d059209837c",
"timestamp": "",
"source": "github",
"line_count": 1657,
"max_line_length": 105,
"avg_line_length": 40.92939046469523,
"alnum_prop": 0.6817752875258036,
"repo_name": "asimshankar/tensorflow",
"id": "6770f1d3b3745906ebf4c13f24591c1d79e2d909",
"siz... |
from distutils.core import setup
from catkin_pkg.python_setup import generate_distutils_setup
# fetch values from package.xml
setup_args = generate_distutils_setup(
packages=['arni_gui'],
package_dir={'': 'src'},
)
setup(**setup_args)
| {
"content_hash": "aa1bdca166ded693e174c20cd320b683",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 60,
"avg_line_length": 24.5,
"alnum_prop": 0.726530612244898,
"repo_name": "andreasBihlmaier/arni",
"id": "2f38067d77a869bba88289cfc1b41fe7c5a2df99",
"size": "308",
"bina... |
"""Query build slave hardware info, and print it to stdout as csv."""
import csv
import json
import logging
import sys
import urllib2
_MASTERS = [
'chromium.perf',
'client.catapult',
'tryserver.chromium.perf',
'tryserver.client.catapult',
]
_KEYS = [
'master', 'builder', 'hostname',
'os fa... | {
"content_hash": "01e474e0ca2d6d9e489340aab2187d98",
"timestamp": "",
"source": "github",
"line_count": 87,
"max_line_length": 78,
"avg_line_length": 25.57471264367816,
"alnum_prop": 0.5635955056179776,
"repo_name": "SummerLW/Perf-Insight-Report",
"id": "85d4ffca7e97b6b01131a90e7df94996c60e9ea2",
"... |
from yapsy.IPlugin import IPlugin
import logging
import requests
import requests_cache
import socket
import json
from xml.etree import ElementTree
import plugin_ilmatieteenlaitos_secret as secret
from datetime import datetime
from jinja2 import Environment, PackageLoader
logging.basicConfig(format='%(asctime)s - %(nam... | {
"content_hash": "5d020bee96ab074e1d4d7d452502b293",
"timestamp": "",
"source": "github",
"line_count": 105,
"max_line_length": 218,
"avg_line_length": 38.6,
"alnum_prop": 0.5978287688132248,
"repo_name": "Vilsepi/radiate",
"id": "973d7100feac4952c524a7035206904ef0fe0e9b",
"size": "4289",
"binary... |
"""Support for monitoring a Smappee energy sensor."""
from __future__ import annotations
from dataclasses import dataclass, field
from homeassistant.components.sensor import (
SensorDeviceClass,
SensorEntity,
SensorEntityDescription,
SensorStateClass,
)
from homeassistant.const import (
ELECTRIC_P... | {
"content_hash": "cf5cd24a5a7241e58b42618fe2e130b5",
"timestamp": "",
"source": "github",
"line_count": 446,
"max_line_length": 88,
"avg_line_length": 38.0762331838565,
"alnum_prop": 0.582970203745142,
"repo_name": "home-assistant/home-assistant",
"id": "e2eef5d06cf79d2347d633601683f0a3f268a3c2",
"... |
import time
from test_framework.test_particl import (
ParticlTestFramework,
isclose
)
KEEP_FUNDING_TX_DATA = 86400 * 31
class SmsgRollingCacheTest(ParticlTestFramework):
def set_test_params(self):
self.setup_clean_chain = True # Don't copy from cache
self.num_nodes = 3
self.ext... | {
"content_hash": "28390c432918b7f5802e25ed686df43e",
"timestamp": "",
"source": "github",
"line_count": 77,
"max_line_length": 99,
"avg_line_length": 31.051948051948052,
"alnum_prop": 0.5872020075282308,
"repo_name": "particl/particl-core",
"id": "b2f809c2451769ed841cf3c20366889190e9ccc0",
"size": ... |
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('robocrm', '0022_auto_20141027_0155'),
]
operations = [
migrations.AlterField(
model_name='robouser',
name='major',
... | {
"content_hash": "6453be403e0d558ff1a751731af26489",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 50,
"avg_line_length": 21.055555555555557,
"alnum_prop": 0.5910290237467019,
"repo_name": "sreidy/roboticsclub.org",
"id": "0d68a3ff065e758effaff4afcb3d110b7f688b78",
"size... |
"""Python dataset sparse tensor utility functions."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.python.data.util import nest
from tensorflow.python.framework import dtypes
from tensorflow.python.framework import ops
from tensorflow.pyth... | {
"content_hash": "80f56ce2fa64aadd390103347b25f73d",
"timestamp": "",
"source": "github",
"line_count": 138,
"max_line_length": 80,
"avg_line_length": 31.384057971014492,
"alnum_prop": 0.7252366658970215,
"repo_name": "renyi533/tensorflow",
"id": "d7e516e24f91e4a0c12ed778742c6e4db1b9e4a4",
"size": ... |
from swgpy.object import *
def create(kernel):
result = Tangible()
result.template = "object/tangible/hair/human/shared_hair_human_female_s20.iff"
result.attribute_template_id = -1
result.stfName("hair_name","hair")
#### BEGIN MODIFICATIONS ####
#### END MODIFICATIONS ####
return result | {
"content_hash": "360f3d20bbee0a1e0839768b45dcee91",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 80,
"avg_line_length": 23.46153846153846,
"alnum_prop": 0.6918032786885245,
"repo_name": "anhstudios/swganh",
"id": "eef61d8dd8530fd16217f4a330342d65a423bd00",
"size": "450... |
import sys, os, time, tempfile, shutil, socket, fcntl, signal
from subprocess import Popen, PIPE
try:
socket.getaddrinfo('non-existing-host', 80)
NON_EXISTING_RESOLVABLE = True
except socket.gaierror:
NON_EXISTING_RESOLVABLE = False
def get_testenv():
env = os.environ.copy()
env['PYTHONPATH'] = ... | {
"content_hash": "802dec88ee44f586da0e6b12665023ae",
"timestamp": "",
"source": "github",
"line_count": 199,
"max_line_length": 97,
"avg_line_length": 34.42713567839196,
"alnum_prop": 0.5813749817544884,
"repo_name": "dwdm/splash",
"id": "aa5e4347fed785f2794acf5666175e77cc0ccb6b",
"size": "6851",
... |
"""
This file contains tests that focus on general set-up
of the python environment. They also check things that
probably don't need any checking.
"""
import sys
import pathlib
# Ensure that 'matmodlab' is imported from parent directory.
sys.path.insert(0, str(pathlib.Path(__file__).absolute().parent.parent))
try:
... | {
"content_hash": "3b4842694235ef9e44baa070eb51ac52",
"timestamp": "",
"source": "github",
"line_count": 60,
"max_line_length": 78,
"avg_line_length": 18.283333333333335,
"alnum_prop": 0.649954421148587,
"repo_name": "matmodlab/matmodlab2",
"id": "b81098e5da9e05154a495d146a36003cd8952cc5",
"size": "... |
from __future__ import unicode_literals
from django.db import models, migrations
import datetime
from django.utils.timezone import utc
class Migration(migrations.Migration):
dependencies = [
('imgpage', '0002_auto_20150823_2320'),
]
operations = [
migrations.AddField(
model_... | {
"content_hash": "043a96ea3bb6061b70e05fcf7badb176",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 122,
"avg_line_length": 25.904761904761905,
"alnum_prop": 0.6305147058823529,
"repo_name": "sudhaMR/Django-Perception",
"id": "df646581aa01bf2710ad53e55bf86b1cb7b6d58b",
"s... |
"""A module for defining structured request species.
:author: Matthew Gidden <matthew.gidden _at_ gmail.com>
"""
import itertools
import numpy as np
import random
import math
from collections import OrderedDict, defaultdict, Iterable
from cyclopts import tools as cyctools
from cyclopts import cyclopts_io as cycio
fr... | {
"content_hash": "f7afb8a7780c970099129b057cc251ce",
"timestamp": "",
"source": "github",
"line_count": 489,
"max_line_length": 92,
"avg_line_length": 36.98364008179959,
"alnum_prop": 0.5409455349737351,
"repo_name": "gidden/cyclopts",
"id": "68e620e551dc002d5e4a3b483c14aed966f21a68",
"size": "1808... |
from . import PluginBase
__all__ = ['Hash']
class Hash(PluginBase):
def help(self):
return """[string1] [string2]
Convert from ASCII string to hash string.
ex)
> hash a b
c3
"""
def execute(self, args):
if len(args) != 2:
raise ValueError('wrong number of arguments are given... | {
"content_hash": "175c42e588e7b6e6d0c271ba3a7679f8",
"timestamp": "",
"source": "github",
"line_count": 77,
"max_line_length": 94,
"avg_line_length": 21.818181818181817,
"alnum_prop": 0.6083333333333333,
"repo_name": "mikoim/funstuff",
"id": "08d36169858cefd8c564741d6686e0bcf5a37e8d",
"size": "1684... |
import sys
import codecs
import pprint
import argparse
from const import *
from utils import *
def show_resource(resource):
print "name: %s" % resource['name']
print "description: %s" % resource['description']
print "orgUnitPath: %s" % resource['orgUnitPath']
print "parentO... | {
"content_hash": "59ef94c136fb5cdb51ff0eac2fd81394",
"timestamp": "",
"source": "github",
"line_count": 173,
"max_line_length": 116,
"avg_line_length": 44.104046242774565,
"alnum_prop": 0.5874180865006553,
"repo_name": "yteraoka/googleapps-directory-tools",
"id": "a2d41751ca3997627fd3c0f2239f11b6a4e1... |
from flask import render_template, Response, request, flash, redirect, url_for, abort, send_from_directory
from flask.ext.login import login_required
from werkzeug import secure_filename
from app import app, db, models
from app.forms.upload_forms import RecordForm
from app.views.util.login import requires_roles
from a... | {
"content_hash": "52066c85b98cac267900da0d64c2d416",
"timestamp": "",
"source": "github",
"line_count": 149,
"max_line_length": 154,
"avg_line_length": 34.79194630872483,
"alnum_prop": 0.6458333333333334,
"repo_name": "MarkGalloway/RIS",
"id": "d70704607a9db2b023add291a1f4e3d870069415",
"size": "51... |
from typing import Optional
from path import Path
import cli_ui as ui
import tsrc
import tsrc.executor
class RemoteSetter(tsrc.executor.Task[tsrc.Repo]):
"""
For each repository:
* look for the remote configured in the manifest,
* add any missing remote,
* if a remote is found but with an ... | {
"content_hash": "b9ea3ebd72d5266e93da81679c136beb",
"timestamp": "",
"source": "github",
"line_count": 66,
"max_line_length": 78,
"avg_line_length": 34.21212121212121,
"alnum_prop": 0.5739592559787422,
"repo_name": "TankerApp/tsrc",
"id": "99db37e4babc6ef0eb63763622c0f2e88e1c42ee",
"size": "2258",... |
def sqrt(n):
approx = n/2.0
better = (approx + n/approx)/2.0
while better != approx:
approx = better
better = (approx + n/approx)/2.0
return approx
x = input("Enter x: ")
print "Square Root: ", sqrt(x)
| {
"content_hash": "5f0c4da3b9460abc4a4d23e33026ea91",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 40,
"avg_line_length": 23.5,
"alnum_prop": 0.5617021276595745,
"repo_name": "yusufshakeel/Python-Project",
"id": "8fe7d2af41b0405bb50be4204507a7753d6abc28",
"size": "277",
... |
import requests
import re
from hashlib import sha512
from webpageparser import WebPageParser, WebPageNode
class WebPage:
titles_seen = dict()
descriptions_seen = dict() # hash for description: id of the first webpage
regex_url = re.compile(r'(?:http[s]?:/|)/(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*\(\),]|(?:%[0-9a-... | {
"content_hash": "efadfabc50361529bfce76f9db6770d3",
"timestamp": "",
"source": "github",
"line_count": 318,
"max_line_length": 139,
"avg_line_length": 35.57232704402516,
"alnum_prop": 0.5236916548797736,
"repo_name": "dubzzz/py-seo-helper",
"id": "7c40b149f4758dd30a3258306f0140713904f02c",
"size":... |
from app_util import default_logger
from app_util import iso8601_to_fixed_ts
class db_connector_template():
def __init__(self, **kwargs):
"""
kwargs should contain: logger, debug_level
"""
self.logger = kwargs.get("logger", default_logger)
self.debug_level = kwargs.get("deb... | {
"content_hash": "ba190121bcf4f1663a55242c24ff658a",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 72,
"avg_line_length": 33.61538461538461,
"alnum_prop": 0.5560640732265446,
"repo_name": "tanupoo/lorawan-ss-as",
"id": "44879b884df5c188b8de70b28e228c3838d8ddb0",
"size": ... |
from sympy.combinatorics.named_groups import SymmetricGroup, AlternatingGroup,\
CyclicGroup
from sympy.combinatorics.testutil import _verify_bsgs, _cmp_perm_lists,\
_naive_list_centralizer, _verify_centralizer,\
_verify_normal_closure
from sympy.combinatorics.permutations import Permutation
from sympy.combinatorics.per... | {
"content_hash": "6e2d2991cb27bd41e33089c71e6832e2",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 79,
"avg_line_length": 33,
"alnum_prop": 0.6905594405594405,
"repo_name": "flacjacket/sympy",
"id": "63a1a1bdb1acd11dc7b3403eb062bf7ade90422c",
"size": "1716",
"binary": ... |
"""Test the collector flows."""
import os
from grr.client import vfs
from grr.lib import action_mocks
from grr.lib import aff4
from grr.lib import artifact
from grr.lib import artifact_registry
from grr.lib import artifact_test
from grr.lib import flags
from grr.lib import rdfvalue
from grr.lib import test_lib
from ... | {
"content_hash": "90c3f8c43be3220d7ce2539cc2756b86",
"timestamp": "",
"source": "github",
"line_count": 524,
"max_line_length": 80,
"avg_line_length": 41.54389312977099,
"alnum_prop": 0.644218843309293,
"repo_name": "ksmaheshkumar/grr",
"id": "d382e36dba8eb528d60d2f55cd5a088e88a7520c",
"size": "217... |
from Axon.Ipc import WaitComplete
from Kamaelia.Apps.Europython09.BB.Exceptions import GotShutdownMessage
from Kamaelia.Apps.Europython09.BB.RequestResponseComponent import RequestResponseComponent
class Authenticator(RequestResponseComponent):
users = {}
State = {}
def main(self):
loggedin = False... | {
"content_hash": "28a3cd910190ea3326a04002e81efaa1",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 91,
"avg_line_length": 34.8125,
"alnum_prop": 0.5529622980251346,
"repo_name": "bbc/kamaelia",
"id": "ee4c686d2ad1bcae1ab106ffe897e7096c22b268",
"size": "1939",
"binary":... |
from __future__ import unicode_literals, absolute_import
from unittest import TestCase
import time
from datetime import datetime
from py3utils import TimeUtils, DatetimeUtils
class TestTimeUtils(TestCase):
def test_get_current_timestamp(self):
expected = time.time()
actual = TimeUtils.get_curren... | {
"content_hash": "1bf0ab91f2a60ecacf89db3a9b0ae668",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 84,
"avg_line_length": 27.73913043478261,
"alnum_prop": 0.713166144200627,
"repo_name": "hezhiming/py3utils",
"id": "4484389266e92a67b858687466ba2397dcf54215",
"size": "741... |
"""Support for Wink hubs."""
from datetime import timedelta
import json
import logging
import os
import time
import voluptuous as vol
from homeassistant.components.http import HomeAssistantView
from homeassistant.const import (
ATTR_BATTERY_LEVEL, ATTR_ENTITY_ID, ATTR_NAME, CONF_EMAIL, CONF_PASSWORD,
EVENT_HO... | {
"content_hash": "403621608c0761851187a0d380a15adf",
"timestamp": "",
"source": "github",
"line_count": 886,
"max_line_length": 78,
"avg_line_length": 36.87020316027088,
"alnum_prop": 0.6033918021244681,
"repo_name": "HydrelioxGitHub/home-assistant",
"id": "2b03d7711acbd6b60720e2712ac87da408322a39",
... |
"""
sphinx.util.i18n
~~~~~~~~~~~~~~~~
Builder superclass for all builders.
:copyright: Copyright 2007-2015 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import gettext
from os import path
from collections import namedtuple
from babel.messages.pofile import read_po
f... | {
"content_hash": "f828cc96fbbb387503f2bea7882af763",
"timestamp": "",
"source": "github",
"line_count": 118,
"max_line_length": 87,
"avg_line_length": 30.97457627118644,
"alnum_prop": 0.612859097127223,
"repo_name": "ArcherSys/ArcherSys",
"id": "efdc31828be89475fb256d98e9dabf0db0114006",
"size": "3... |
from __future__ import print_function
import logging
import sys
import time
# THIRD PARTY
from django.db import DataError
from django.db.migrations.operations.base import Operation
from google.appengine.api.datastore import Delete, Query, Get, Key, Put, RunInTransaction
from google.appengine.api import datastore_erro... | {
"content_hash": "4a3543d3f6f0d304698eb6c9890c1636",
"timestamp": "",
"source": "github",
"line_count": 419,
"max_line_length": 125,
"avg_line_length": 39.38424821002387,
"alnum_prop": 0.6136225912010665,
"repo_name": "grzes/djangae",
"id": "7ee4e12198e361ca9efa8884b7260f2f67ce9954",
"size": "16517... |
from girc import message
from girc.common import iterable
class Handler(object):
"""A handler object manages a handler callback.
It wraps the callback with additional metadata governing matches.
It is normally registered to a client automatically at init time, or you can manually register it later
with handler.re... | {
"content_hash": "2ed1da598cfac42c51ca8439d0f153b6",
"timestamp": "",
"source": "github",
"line_count": 169,
"max_line_length": 109,
"avg_line_length": 38.86390532544379,
"alnum_prop": 0.7193970767356882,
"repo_name": "ekimekim/girc",
"id": "f64ba9913d9f90f4debe2a3ae4e6510c1343234a",
"size": "6569"... |
import pytest
from web3.utils.abi import (
function_abi_to_4byte_selector,
)
@pytest.fixture(autouse=True)
def wait_for_first_block(web3, wait_for_block):
wait_for_block(web3)
@pytest.fixture()
def math_contract(web3, MATH_ABI, MATH_CODE, MATH_RUNTIME, MATH_SOURCE,
wait_for_transaction):
... | {
"content_hash": "42f29a9995cf02422e9c7475430d1058",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 72,
"avg_line_length": 29.285714285714285,
"alnum_prop": 0.6804878048780488,
"repo_name": "shravan-shandilya/web3.py",
"id": "365c26f139ddc0e5ac2968a64bacb813fe5b7ead",
"si... |
from django.http import HttpResponse
from django.views.decorators.cache import never_cache
from prometheus_client import generate_latest, CONTENT_TYPE_LATEST
@never_cache
def metrics(request):
"""Exposes prometheus metrics"""
return HttpResponse(generate_latest(), content_type=CONTENT_TYPE_LATEST)
| {
"content_hash": "1642e954c81d9a70db0125c007d3b6b6",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 76,
"avg_line_length": 31,
"alnum_prop": 0.7935483870967742,
"repo_name": "micktwomey/gamecraft-mk-iii",
"id": "6d845bead79007d9272ad8979290c4b8b801b0c1",
"size": "310",
... |
from collections import defaultdict
import iso8601
import arrow
import logging
from impactstoryanalytics.widgets.widget import Widget, get_raw_dataclip_data
logger = logging.getLogger("impactstoryanalytics.widgets.hourly_new_users")
class Hourly_new_users(Widget):
new_accounts_query_url = "https://dataclips.he... | {
"content_hash": "8568567a2b6243c2848c2e80b9d3196e",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 105,
"avg_line_length": 37.625,
"alnum_prop": 0.70874861572536,
"repo_name": "Impactstory/impactstory-analytics",
"id": "af530a8459e4cac1eacb55614d2a58e268a2a4eb",
"size": ... |
from __future__ import absolute_import, division, print_function, unicode_literals
__metaclass__ = type
import pickle
import tornado.httpserver
import tornado.ioloop
import tornado.web
import tornado.websocket
import base64
import threading
from time import sleep
from RealSense import Streamer
SERVER_CLOSING = 'S... | {
"content_hash": "450e8439cd071d1ac52151a8f223c316",
"timestamp": "",
"source": "github",
"line_count": 60,
"max_line_length": 82,
"avg_line_length": 26.083333333333332,
"alnum_prop": 0.6466453674121406,
"repo_name": "MST-MRR/DroneKit",
"id": "6594b5868bc22d35459865a47e5d5a8722108e0d",
"size": "156... |
"""
Copyright 2012 Basho Technologies, Inc.
This file is provided to you 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 a... | {
"content_hash": "6f4f329f6fc1a4f065fe5a49dd7d282f",
"timestamp": "",
"source": "github",
"line_count": 165,
"max_line_length": 70,
"avg_line_length": 28.715151515151515,
"alnum_prop": 0.6274799493457155,
"repo_name": "Mitali-Sodhi/CodeLingo",
"id": "e992bbecbe9ac7b835f783511f88e704438c71bf",
"size... |
from feedly.feeds.aggregated_feed.redis import RedisAggregatedFeed
from feedly.tests.feeds.aggregated_feed.base import TestAggregatedFeed,\
implementation
from feedly.activity import AggregatedActivity
from feedly.tests.feeds.redis import CustomActivity
class CustomAggregated(AggregatedActivity):
pass
class... | {
"content_hash": "8230b70c0e5ac2de6ac39c6c1ecf177d",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 72,
"avg_line_length": 32.388888888888886,
"alnum_prop": 0.7487135506003431,
"repo_name": "izhan/Stream-Framework",
"id": "c0a2eac24114de1bd635a65745612a76ec3ba7ba",
"size"... |
from django.core.management.base import BaseCommand
from inventory.models import Jar
from pyment import settings
from django.utils import timezone
from datetime import timedelta
class Command(BaseCommand):
help = "Delete inactive jars more than %d days old" % settings.INACTIVE_JAR_AGE_DAYS
def add_arguments(... | {
"content_hash": "b9aa0e57191222a50399049505454560",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 120,
"avg_line_length": 43.285714285714285,
"alnum_prop": 0.7007700770077008,
"repo_name": "mathuin/pyment",
"id": "f33b11e4a30b108e1e39968b48db08951c485868",
"size": "909"... |
from pygw.base import GeoWaveObject
from pygw.base.type_conversions import StringArrayType
from .query_constraints_factory import QueryConstraintsFactory
from .query_hint_key import QueryHintKey
from .query_constraints import QueryConstraints
from ..base.java_transformer import NoOpTransformer
class BaseQueryBuilder... | {
"content_hash": "61d56f46319fa3277ba6edc4bdc74f04",
"timestamp": "",
"source": "github",
"line_count": 159,
"max_line_length": 120,
"avg_line_length": 30.641509433962263,
"alnum_prop": 0.6151477832512315,
"repo_name": "ngageoint/geowave",
"id": "cd634f733305987dfa7892d243fb4c8e02115844",
"size": "... |
from unittest import mock
import pytest
from saleor.payment import PaymentError
from saleor.payment.gateways.adyen.utils.apple_pay import (
initialize_apple_pay_session,
validate_payment_data_for_apple_pay,
)
@pytest.mark.parametrize(
"validation_url,merchant_identifier,domain,display_name,certificate",... | {
"content_hash": "acd894595341b922b32f057a911827f4",
"timestamp": "",
"source": "github",
"line_count": 139,
"max_line_length": 87,
"avg_line_length": 31.884892086330936,
"alnum_prop": 0.6389891696750902,
"repo_name": "mociepka/saleor",
"id": "1f0c2ff0cc889d6897096a922ac1c2e8ee8a5a66",
"size": "443... |
"""Tests for the CoinMarketCap sensor platform."""
import json
import unittest
from unittest.mock import patch
import homeassistant.components.sensor as sensor
from homeassistant.setup import setup_component
from tests.common import (
get_test_home_assistant, load_fixture, assert_setup_component)
VALID_CONFIG = ... | {
"content_hash": "354e19ff66b6e7bb9cde6255702e20c9",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 71,
"avg_line_length": 31.59090909090909,
"alnum_prop": 0.660431654676259,
"repo_name": "stefan-jonasson/home-assistant",
"id": "15c254bfb274aba88ff628f08ccf05e8cac9f9e6",
... |
'''
Using Turtle Graphics to draw a blue polygon with customizable number and
length of sides according to user's input.
'''
import turtle
sides = int(input("Number of sides: "))
distance = int(input("Side's length: "))
turtle.color('blue') # Set the pen's color to blue
turtle.pendown() # Start drawing
d... | {
"content_hash": "23d16410eb7ab3a97c6b0157aa283363",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 73,
"avg_line_length": 30.9,
"alnum_prop": 0.6699029126213593,
"repo_name": "laymonage/TarungLab",
"id": "5bc187c28dface4b47f67c7239f157a58ae0f76a",
"size": "618",
"binar... |
'''Forced Choice App
=====================
The main module that starts the experiment.
'''
from functools import partial
from os.path import join, dirname, isdir
from cplcom.moa.app import ExperimentApp, run_app as run_cpl_app
from kivy.properties import ObjectProperty
from kivy.resources import resource_add_path
f... | {
"content_hash": "0738221a38ae9294684e5b8b0b1ac489",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 70,
"avg_line_length": 26.666666666666668,
"alnum_prop": 0.7026785714285714,
"repo_name": "matham/forced_choice",
"id": "0eba926f1a86c4b3be90088cfc926ddaf5f33f77",
"size": ... |
"""
Spatial kernels for dwarf galaxies.
"""
import sys
import inspect
from abc import abstractmethod
from collections import OrderedDict as odict
import copy
import numpy as np
import healpy as hp
import scipy.integrate
import scipy.interpolate
import ugali.utils.projector
from ugali.utils.projector import Projector... | {
"content_hash": "4be528678ca85ee550d1f73e1c7456f2",
"timestamp": "",
"source": "github",
"line_count": 524,
"max_line_length": 99,
"avg_line_length": 30.599236641221374,
"alnum_prop": 0.5743420232006985,
"repo_name": "DarkEnergySurvey/ugali",
"id": "02f8f094a9c644bec386146a54708833ba338d76",
"size... |
"""Celko's "Nested Sets" Tree Structure.
http://www.intelligententerprise.com/001020/celko.jhtml
"""
from sqlalchemy import case
from sqlalchemy import Column
from sqlalchemy import create_engine
from sqlalchemy import event
from sqlalchemy import func
from sqlalchemy import Integer
from sqlalchemy import select
fro... | {
"content_hash": "ddc07ce345f9e91330af998d9c07efd6",
"timestamp": "",
"source": "github",
"line_count": 135,
"max_line_length": 77,
"avg_line_length": 28.2,
"alnum_prop": 0.6109797741003414,
"repo_name": "wujuguang/sqlalchemy",
"id": "ba45231ceeb8ba255ec3eda0bbde77801dd31ced",
"size": "3807",
"bi... |
"""Set up script for mod_pywebsocket.
"""
from distutils.core import setup, Extension
import sys
_PACKAGE_NAME = 'mod_pywebsocket'
# Build and use a C++ extension for faster masking. SWIG is required.
_USE_FAST_MASKING = False
if sys.version < '2.3':
print >> sys.stderr, '%s requires Python 2.3 or later.' % _... | {
"content_hash": "455b8c5e0ab226083ced1e0a1e9d0182",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 75,
"avg_line_length": 31.166666666666668,
"alnum_prop": 0.6058059587471352,
"repo_name": "Teamxrtc/webrtc-streaming-node",
"id": "935d6b105899ca1348d7d6d68bbe2bd49e85d118",
... |
from multiverse.mars import *
from multiverse.mars.objects import *
from multiverse.mars.core import *
from multiverse.mars.util import *
from multiverse.server.math import *
from multiverse.server.events import *
from multiverse.server.objects import *
from multiverse.server.engine import *
World.setTheme("mvfantasy.... | {
"content_hash": "53e0ddeeded0d480ebd4ccdec87e6eed",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 39,
"avg_line_length": 32.6,
"alnum_prop": 0.8067484662576687,
"repo_name": "longde123/MultiversePlatform",
"id": "ff546aa6ea5c34d27d4660973875cfce54c8acf9",
"size": "1544"... |
from u2flib_server.attestation.resolvers import create_resolver
from u2flib_server.attestation.metadata import MetadataProvider, Attestation
__all__ = ['create_resolver', 'MetadataProvider', 'Attestation']
| {
"content_hash": "f5fb3833923a56b3be826e65eb2c8254",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 76,
"avg_line_length": 51.75,
"alnum_prop": 0.8115942028985508,
"repo_name": "reqa/pkg-python-u2flib-server",
"id": "99cbbd8c6031a90c61486451336eceedbb351207",
"size": "1579... |
from day_19 import (parse, count_molecules, steps_to_generate, reverse_dict,
generate_prev)
def test_parse():
stream = "H => HO\nH => OH\nO => HH\n\nHOH\n"
assert parse(stream) == ({"H": ["HO", "OH"], "O": ["HH"]}, "HOH")
assert parse(stream.strip()) == ({"H": ["HO", "OH"], "O": ["HH"]... | {
"content_hash": "586f45a6ef5dbaecb0cb5745d0731899",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 77,
"avg_line_length": 40.513513513513516,
"alnum_prop": 0.5203468979319547,
"repo_name": "masasin/advent_of_code_2015",
"id": "df7a0d5679b6df742a41099aeff88a49ec76cbac",
"... |
from __future__ import absolute_import
from __future__ import division
from past.utils import old_div
from proteus import *
from proteus.default_n import *
try:
from .poisson_3d_tetgen_p import *
except:
from poisson_3d_tetgen_p import *
#steady-state so no time integration
timeIntegration = NoIntegration
#num... | {
"content_hash": "b4c0f2c98a3f5ddc6309b1694596846a",
"timestamp": "",
"source": "github",
"line_count": 90,
"max_line_length": 114,
"avg_line_length": 32.977777777777774,
"alnum_prop": 0.7611185983827493,
"repo_name": "erdc/proteus",
"id": "3539d0076f13c2e1079ed34b56afec2b37e13ca5",
"size": "2968",... |
import os
import shutil
import tempfile
import unittest
from telemetry import story
from telemetry import page as page_module
from telemetry.testing import system_stub
from telemetry.timeline import trace_data
from telemetry.value import trace
class TestBase(unittest.TestCase):
def setUp(self):
story_set = st... | {
"content_hash": "23b0da8fa7dd5936196d67147cce4213",
"timestamp": "",
"source": "github",
"line_count": 125,
"max_line_length": 79,
"avg_line_length": 30.368,
"alnum_prop": 0.6862486828240253,
"repo_name": "SummerLW/Perf-Insight-Report",
"id": "d3481461adafc4770557b2d008d0bf488e41f449",
"size": "39... |
from django.test import TestCase
import server.interface.nodes as views
from django.http import HttpResponse, HttpResponseNotFound, HttpResponseBadRequest
import server.interface.closest as cviews
import server.interface.util as util
from django.test.client import RequestFactory
class NodeTestCase(TestCase):
"""
... | {
"content_hash": "44d23d5da82dbcf60b30155105f93f2b",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 115,
"avg_line_length": 39.59615384615385,
"alnum_prop": 0.6435162700339971,
"repo_name": "simonneuville/runamic_server",
"id": "dbc52706dee4f21e4e9622b15579243c289240dd",
... |
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import copy
import sys
from pants.option.arg_splitter import GLOBAL_SCOPE, ArgSplitter
from pants.option.global_options import GlobalOptionsRegistrar
from pants.optio... | {
"content_hash": "7b47d9619980b51b83718e4e36a15fbe",
"timestamp": "",
"source": "github",
"line_count": 312,
"max_line_length": 100,
"avg_line_length": 43.51602564102564,
"alnum_prop": 0.688149075642631,
"repo_name": "slyphon/pants",
"id": "ccc662ac935da7171cf16e21a159dc6e0c1caf77",
"size": "13724"... |
"""
WSGI config for mybook project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTIN... | {
"content_hash": "3510eda86f807e7efcea989af6e908ec",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 78,
"avg_line_length": 24.3125,
"alnum_prop": 0.7686375321336761,
"repo_name": "kyon-bll/django_mybook",
"id": "8b18d4f263ac3027c0cde0932be144df86aa42ec",
"size": "389",
... |
"""
@version: ??
@author: 闫刚
@license:
@contact: 7470718@qq.com
@site: http://www.cashmerepipeline.com
@software:
@file: anim_utils.py
@time: 2017/12/11 16:13
"""
import maya.cmds as cmds
def getTimeLineStartEnd():
"""
:return:
"""
start_frame = cmds.playbackOptions(query=True, min = True)
end_... | {
"content_hash": "468f8451abcd49eb67ae21359d1dece6",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 66,
"avg_line_length": 17.451612903225808,
"alnum_prop": 0.6321626617375231,
"repo_name": "yes7rose/maya_utils",
"id": "5b6eed4e8a839c35563e7c0d26c4c01c7ff20db0",
"size": "... |
import fiona
import numpy as np
import numpy.ma as ma
import rasterio
import rasterio.features
import rasterio.mask
import pandas as pd
import sys
import pdb
shp_file = '/Users/ricardog/src/eec/data/from-adriana/tropicalforests.shp'
shp_file = '/Users/ricardog/src/eec/predicts/playground/tmp/topical-band34-24.shp'
sr... | {
"content_hash": "d5a2e04a1652fcf9e706d380c00689dc",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 82,
"avg_line_length": 44.42857142857143,
"alnum_prop": 0.5562700964630225,
"repo_name": "ricardog/raster-project",
"id": "e1a8be25740146ef03e9d104ef30e9052a2e7f04",
"size"... |
from __future__ import with_statement
import datetime
import time
import warnings
from itertools import imap, izip, starmap
from redis.connection import ConnectionPool, UnixDomainSocketConnection
from redis.exceptions import (
ConnectionError,
DataError,
RedisError,
ResponseError,
WatchError,
No... | {
"content_hash": "2ddb74ef223fd9470ffe852284ebda88",
"timestamp": "",
"source": "github",
"line_count": 1658,
"max_line_length": 106,
"avg_line_length": 37.51568154402895,
"alnum_prop": 0.5907782833073423,
"repo_name": "Instagram/redis-py",
"id": "43222d6dcb6fe010c490930047a72fd9901cf582",
"size": ... |
def n_(num, strng):
return strng if num == 1 else strng + 's'
| {
"content_hash": "1bb8b0bccc9b061dd40c855f4296ae8a",
"timestamp": "",
"source": "github",
"line_count": 2,
"max_line_length": 45,
"avg_line_length": 33,
"alnum_prop": 0.5909090909090909,
"repo_name": "resmio/nslocapysation",
"id": "4b6a788b418d643aff6c592d027251d510d3953c",
"size": "68",
"binary"... |
import pygame, random
from pygame.locals import *
pygame.init()
pygame.mixer.init()
size = width, height = 500, 500
screen = pygame.display.set_mode((size))
pygame.display.set_caption("Run away Spidy")
bg = pygame.image.load("img/bg.png")
bg = bg.convert()
bgrect = bg.get_rect()
screen.blit(bg, (0,0))
song = pygam... | {
"content_hash": "372376fc148f6be2125bf518fccd2c7a",
"timestamp": "",
"source": "github",
"line_count": 87,
"max_line_length": 55,
"avg_line_length": 24.114942528735632,
"alnum_prop": 0.6506196377502383,
"repo_name": "bszcz/python",
"id": "e45dbcd582d274c73894399714ad5c6f4767b55c",
"size": "2170",
... |
'''
test for vm migrate with assigned host uuid in newly add vcenter
@author: SyZhao
'''
import apibinding.inventory as inventory
import zstackwoodpecker.test_util as test_util
import zstackwoodpecker.test_lib as test_lib
import zstackwoodpecker.test_state as test_state
import zstackwoodpecker.operations.vm_o... | {
"content_hash": "94b92a0463a25f4bf08cad9c0c611a4e",
"timestamp": "",
"source": "github",
"line_count": 75,
"max_line_length": 128,
"avg_line_length": 33.333333333333336,
"alnum_prop": 0.6788,
"repo_name": "zstackorg/zstack-woodpecker",
"id": "ed9617746a27c3faea48af67e130fcd01b2ee340",
"size": "250... |
from __future__ import unicode_literals
from datetime import date
from django import forms
from django.contrib.admin import BooleanFieldListFilter, SimpleListFilter
from django.contrib.admin.options import (
HORIZONTAL, VERTICAL, ModelAdmin, TabularInline,
)
from django.contrib.admin.sites import AdminSite
from d... | {
"content_hash": "55d9757b26a4d390eb239cbe7e32d480",
"timestamp": "",
"source": "github",
"line_count": 1703,
"max_line_length": 116,
"avg_line_length": 34.50029359953024,
"alnum_prop": 0.607243762126834,
"repo_name": "gitaarik/django",
"id": "790d24f66d9342c25b00bbbfdaf5613e710a751d",
"size": "587... |
"""
Demonstrates how to limit the extent of grid lines
"""
# Major library imports
from numpy import array, linspace, zeros
from scipy.special import jn
# Enthought library imports
from enable.api import Component, ComponentEditor
from traits.api import HasTraits, Instance
from traitsui.api import UItem, View
# Chac... | {
"content_hash": "cbfacc14b14f671c1d599d385630a65d",
"timestamp": "",
"source": "github",
"line_count": 94,
"max_line_length": 82,
"avg_line_length": 33.96808510638298,
"alnum_prop": 0.5530848731600376,
"repo_name": "tommy-u/chaco",
"id": "b3dddacb53fd901bfea6387f4fdbc257aefb6665",
"size": "3215",
... |
import numpy as np
from .spectrum import Spectrum, unify_mz
from .spectrum_io import hdf5_load
from .spectrum_utils import ThresholdedPeakFiltering
from copy import deepcopy
from sklearn.metrics import zero_one_loss, f1_score, precision_score, recall_score
def load_spectra(datafile):
"""
Loads the spectra from... | {
"content_hash": "f92fb5dc02dda9d9e19ac0b440a2d375",
"timestamp": "",
"source": "github",
"line_count": 51,
"max_line_length": 82,
"avg_line_length": 28.88235294117647,
"alnum_prop": 0.6727766463000678,
"repo_name": "francisbrochu/microbiome-summer-school-2017_mass-spec",
"id": "09a089aab41012711e18f... |
import math
from i2c_core import i2c_core
class HMC5883(object):
# Define registers values from datasheet
ConfigurationRegisterA = 0x00
ConfigurationRegisterB = 0x01
ModeRegister = 0x02
AxisXDataRegisterMSB = 0x03
AxisXDataRegisterLSB = 0x04
AxisZDataRegisterMSB = 0x05
AxisZDataRegister... | {
"content_hash": "f3e2d51203b7e1c70c7e754d06369230",
"timestamp": "",
"source": "github",
"line_count": 162,
"max_line_length": 93,
"avg_line_length": 30.333333333333332,
"alnum_prop": 0.5738705738705738,
"repo_name": "CaptainStouf/python_libs",
"id": "19b6c4902bfd1fd2b52041b8b0196125ae72a8c5",
"si... |
import luigi.worker
from luigi.worker import Worker
from luigi import Task, RemoteScheduler, Parameter
import unittest
import logging
import luigi.notifications
from mock import Mock
luigi.notifications.DEBUG = True
class DummyTask(Task):
param = Parameter()
def __init__(self, *args, **kwargs):
supe... | {
"content_hash": "4f188c0adf4f6e376113ffb336b97ba0",
"timestamp": "",
"source": "github",
"line_count": 78,
"max_line_length": 113,
"avg_line_length": 26.44871794871795,
"alnum_prop": 0.5971885603490062,
"repo_name": "Mappy/luigi",
"id": "b4f68f3861a988d4f39bc22408a4515b44aacb1b",
"size": "2638",
... |
from oslo_log import log as logging
from sqlalchemy import Boolean, Column, DateTime
from sqlalchemy import Integer, MetaData, String, Table, ForeignKey
from cinder.i18n import _
LOG = logging.getLogger(__name__)
def upgrade(migrate_engine):
meta = MetaData()
meta.bind = migrate_engine
Table('snapshots... | {
"content_hash": "7c4ee05543e5f0738bb3f04ff3eb2bc5",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 76,
"avg_line_length": 28.979166666666668,
"alnum_prop": 0.6096333572969087,
"repo_name": "tmenjo/cinder-2015.1.1",
"id": "b5377115e9de74110d6e5303fb9dfd0fa021401a",
"size"... |
"""
Implementation of optimized einsum.
"""
from __future__ import division, absolute_import, print_function
import itertools
from numpy.compat import basestring
from numpy.core.multiarray import c_einsum
from numpy.core.numeric import asanyarray, tensordot
from numpy.core.overrides import array_function_dispatch
_... | {
"content_hash": "7d3ccbd56d4c2d74f6c252e5f47c6e10",
"timestamp": "",
"source": "github",
"line_count": 1432,
"max_line_length": 118,
"avg_line_length": 35.80377094972067,
"alnum_prop": 0.5862963468627489,
"repo_name": "MSeifert04/numpy",
"id": "3412c3fd5a7e16cebd666e8cef4aee59fd58c986",
"size": "5... |
import os
import unittest
from quickbooks.client import QuickBooks
from quickbooks.objects.taxrate import TaxRate
class TaxRateTest(unittest.TestCase):
def setUp(self):
self.qb_client = QuickBooks(
sandbox=True,
consumer_key=os.environ.get('CONSUMER_KEY'),
consumer_sec... | {
"content_hash": "165d3b74e46e9c31c4ae4333ebc111b7",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 70,
"avg_line_length": 29.91304347826087,
"alnum_prop": 0.6482558139534884,
"repo_name": "porn/python-quickbooks",
"id": "30da1ff4413104562e0a921b425eac5932aa6dc3",
"size":... |
from pybind11_tests import chrono as m
import datetime
def test_chrono_system_clock():
# Get the time from both c++ and datetime
date1 = m.test_chrono1()
date2 = datetime.datetime.today()
# The returned value should be a datetime
assert isinstance(date1, datetime.datetime)
# The numbers sho... | {
"content_hash": "de874944e9bfef6a29ae37111b4a22d1",
"timestamp": "",
"source": "github",
"line_count": 176,
"max_line_length": 80,
"avg_line_length": 29.21590909090909,
"alnum_prop": 0.6960326721120187,
"repo_name": "BYVoid/OpenCC",
"id": "55c95440655145f9b3c0c77d9e2d878a29f7fb45",
"size": "5142",... |
from lib.ConfigLoader import ConfigLoader
from resources.MySql import MySql
class Resources(object):
@staticmethod
def configs():
return [MySql.config()]
def __init__(self, logger, configs):
self.logger = logger
mysql_config = ConfigLoader.get_config_by_type(configs, type(MySql.con... | {
"content_hash": "3fe03a2648a788dc8a22ebbe26f66aed",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 85,
"avg_line_length": 32.5,
"alnum_prop": 0.6794871794871795,
"repo_name": "JimboMonkey1234/pushserver",
"id": "99db3828e0f5e571cb8f47b1244079c01f7541b9",
"size": "413",
... |
import ctypes
import faulthandler
import io
import itertools
import logging
import multiprocessing
import os
import pickle
import sys
import textwrap
import unittest
from importlib import import_module
from io import StringIO
from django.core.management import call_command
from django.db import connections
from django... | {
"content_hash": "17839f5d99e2cd18909f9aae2d8cb8e9",
"timestamp": "",
"source": "github",
"line_count": 833,
"max_line_length": 115,
"avg_line_length": 35.88475390156062,
"alnum_prop": 0.6136089923725412,
"repo_name": "googleinterns/django",
"id": "83f06c72f307d284a26676870c4a2743c09d4eac",
"size":... |
import os
import os.path as op
import warnings
import numpy as np
from scipy import sparse
from ..externals.six import string_types
from ..utils import verbose, logger
from ..io.pick import (channel_type, pick_info, pick_types,
_check_excludes_includes)
from ..io.constants import FIFF
def _g... | {
"content_hash": "21ff9671c78570cb208c40f541feab20",
"timestamp": "",
"source": "github",
"line_count": 738,
"max_line_length": 79,
"avg_line_length": 35.356368563685635,
"alnum_prop": 0.544897098838769,
"repo_name": "lorenzo-desantis/mne-python",
"id": "aae1a48597e0542298d359e9db324afb77a19994",
"... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.