text stringlengths 4 1.02M | meta dict |
|---|---|
"""Tests for head.py."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import math
import sys
# pylint: disable=g-bad-todo,g-import-not-at-top
# TODO: #6568 Remove this hack that makes dlopen() not crash.
if hasattr(sys, "getdlopenflags") and hasattr(sys... | {
"content_hash": "565b9b81fca0e154975f60c872127b4b",
"timestamp": "",
"source": "github",
"line_count": 1156,
"max_line_length": 80,
"avg_line_length": 39.7621107266436,
"alnum_prop": 0.6080931143261177,
"repo_name": "handroissuazo/tensorflow",
"id": "ec8f25c657b4691af32ab82d4b25a882a5c3c700",
"siz... |
"""Constants for the generic (IP Camera) integration."""
DOMAIN = "generic"
DEFAULT_NAME = "Generic Camera"
CONF_CONFIRMED_OK = "confirmed_ok"
CONF_CONTENT_TYPE = "content_type"
CONF_LIMIT_REFETCH_TO_URL_CHANGE = "limit_refetch_to_url_change"
CONF_STILL_IMAGE_URL = "still_image_url"
CONF_STREAM_SOURCE = "stream_source... | {
"content_hash": "4a37b93b12f2ed956f05c41e29598aa8",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 64,
"avg_line_length": 29.8125,
"alnum_prop": 0.7484276729559748,
"repo_name": "nkgilley/home-assistant",
"id": "eb3769094222c2c8e3003d704b18716e096e0fd6",
"size": "477",
... |
from flask import Blueprint
from ..extensions import ldap
foo = Blueprint('foo', __name__, url_prefix='/foo')
@foo.route('/group')
@ldap.group_required(groups=['Web Developers', 'QA'])
def group():
return 'Group restricted page in foo module'
| {
"content_hash": "0ca6c5994a3f1d218f3f707877556dfe",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 53,
"avg_line_length": 25,
"alnum_prop": 0.696,
"repo_name": "admiralobvious/flask-simpleldap",
"id": "41505187939852ae96c7cecb6fda2386e0d4a61b",
"size": "250",
"binary":... |
import socket
import threading
from django.core.handlers.wsgi import WSGIHandler
from django.core.servers import basehttp
from django.test.testcases import TransactionTestCase
from django.core.management import call_command
class StoppableWSGIServer(basehttp.WSGIServer):
"""WSGIServer with short timeout, so that ... | {
"content_hash": "0f0a58d899142373ef68f58529fe37be",
"timestamp": "",
"source": "github",
"line_count": 81,
"max_line_length": 95,
"avg_line_length": 37.45679012345679,
"alnum_prop": 0.6334871456822676,
"repo_name": "rbraley/django-tastypie",
"id": "8418507e58d8259d71831abb45e4e9b2d0423061",
"size"... |
import datetime
import logging
from sqlalchemy.orm import joinedload
from sqlalchemy.orm.session import Session
import smartdb
import tools
from model import MachineInterface, Machine, MachineDisk, Chassis, ChassisPort
from smartdb import cockroach_transaction
logger = logging.getLogger(__file__)
class DiscoveryRe... | {
"content_hash": "ff0e2c337bb7ab4b71e0d5cc11b7899b",
"timestamp": "",
"source": "github",
"line_count": 173,
"max_line_length": 115,
"avg_line_length": 38.17341040462428,
"alnum_prop": 0.5036341611144761,
"repo_name": "JulienBalestra/enjoliver",
"id": "54fee4e1690bdf2bbf94310b5ee7eda304ee574b",
"si... |
AUTHOR = 'Chris Dent'
AUTHOR_EMAIL = 'cdent@peermore.com'
NAME = 'tiddlywebplugins.jsonp'
DESCRIPTION = 'JSONP serialization for TiddlyWeb'
VERSION = '0.7'
import os
from setuptools import setup, find_packages
setup(
namespace_packages = ['tiddlywebplugins'],
name = NAME,
version = VERSION,
descrip... | {
"content_hash": "10139008ed1b80567466c5a9d9ea3f5c",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 86,
"avg_line_length": 26.814814814814813,
"alnum_prop": 0.6588397790055248,
"repo_name": "tiddlyweb/tiddlywebplugins.jsonp",
"id": "b9330aa90e2c96a940c63ccacf161c15ec1243d2"... |
import json
import logging
import ujson
import unicodedata
from os import mkdir
from os.path import join, exists
from typing import List, Optional
import numpy as np
import requests
from bs4 import BeautifulSoup
from docqa.data_processing.text_utils import NltkAndPunctTokenizer, ParagraphWithInverse
from docqa.config... | {
"content_hash": "0bf50fc973245a340309e1820c823c3c",
"timestamp": "",
"source": "github",
"line_count": 244,
"max_line_length": 98,
"avg_line_length": 39.635245901639344,
"alnum_prop": 0.5395512356529831,
"repo_name": "allenai/document-qa",
"id": "0e97ed5207bab39078633b6c548e70a0767fab2d",
"size": ... |
import sys
import time
import Quartz
class Mouse():
down = [Quartz.kCGEventLeftMouseDown, Quartz.kCGEventRightMouseDown, Quartz.kCGEventOtherMouseDown]
up = [Quartz.kCGEventLeftMouseUp, Quartz.kCGEventRightMouseUp, Quartz.kCGEventOtherMouseUp]
[LEFT, RIGHT, OTHER] = [0, 1, 2]
def position(self):
... | {
"content_hash": "ed148f2026e287eec2a7a389d1a264ff",
"timestamp": "",
"source": "github",
"line_count": 99,
"max_line_length": 112,
"avg_line_length": 37.82828282828283,
"alnum_prop": 0.6504672897196262,
"repo_name": "mayank408/Mousely",
"id": "1debae11e02fb4c9bbbdcadc1cea2892a409395f",
"size": "37... |
from __future__ import print_function
import os, sys
from .pytem import Pytem
def print_err(*args):
print(*args, file=sys.stderr)
subject = Pytem("template",'globalfile')
def tag_test():
result = subject.render_string("title : Title---%title%")
print_err(result)
assert result == "<p>Title</p>"
de... | {
"content_hash": "21ad4c8a5630a60fd1bef0bf2bba903c",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 76,
"avg_line_length": 22.5625,
"alnum_prop": 0.6385041551246537,
"repo_name": "wastevensv/pytem",
"id": "128f0ab5f1688125ffaf8dfff91ac746f2142119",
"size": "722",
"binar... |
from django.apps import AppConfig
class AllinkContactConfig(AppConfig):
name = 'allink_apps.contact'
verbose_name = "Allink Contact"
| {
"content_hash": "8c3abf141bfea2373468409c684275a1",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 37,
"avg_line_length": 23.833333333333332,
"alnum_prop": 0.7482517482517482,
"repo_name": "allink/allink-apps",
"id": "e81fdee99c9571a1b55cc96f07c11a421910c6a2",
"size": "16... |
import matplotlib
import numpy as np
import matplotlib.pyplot as plt
import datetime
import seaborn as sns
import matplotlib.patches as mpatches
import csv
from matplotlib import rcParams
sns.set_style("ticks")
rcParams['axes.labelsize'] = 22
rcParams['axes.titlesize'] = 22
rcParams['xtick.labelsize'] = 18
rcParams['y... | {
"content_hash": "f749b6ad556b0bd27d096b42646d70cd",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 154,
"avg_line_length": 30.509090909090908,
"alnum_prop": 0.6960667461263409,
"repo_name": "GiorgosMethe/Load-Profile-Decomposition",
"id": "779582d47e72760d1b3b65a523f3c061c... |
"""
Python Lexical Analyser
Actions for use in token specifications
"""
class Action(object):
def perform(self, token_stream, text):
pass # abstract
def __copy__(self):
return self # immutable, no need to copy
def __deepcopy__(self, memo):
return self # immutable, no need to c... | {
"content_hash": "902f8504b8d63104327f3ed3c8dd3bbd",
"timestamp": "",
"source": "github",
"line_count": 119,
"max_line_length": 87,
"avg_line_length": 24.04201680672269,
"alnum_prop": 0.611674239776302,
"repo_name": "cython/cython",
"id": "725278ddf8bb51786a4cf368e3b80ad4250030ab",
"size": "2919",
... |
"""
A minimal EWMH-aware OO layer over xpyb. This is NOT intended to be
complete - it only implements the subset of functionalty needed by qtile.
"""
from __future__ import print_function, division
import six
import logging
from xcffib.xproto import CW, WindowClass, EventMask
from xcffib.xfixes import Selecti... | {
"content_hash": "240a195faaf1c19901f2c365b64527b9",
"timestamp": "",
"source": "github",
"line_count": 900,
"max_line_length": 91,
"avg_line_length": 31.525555555555556,
"alnum_prop": 0.5463645014626581,
"repo_name": "StephenBarnes/qtile",
"id": "fb39da0c4a5ed36087ae34bbee1e60fdd4709ce4",
"size": ... |
from __future__ import absolute_import, division, print_function, unicode_literals
import os
from builtins import object
from mock import Mock
from pants.cache.cache_setup import (CacheFactory, CacheSetup, CacheSpec, CacheSpecFormatError,
EmptyCacheSpecError, InvalidCacheSpecErro... | {
"content_hash": "52a6706d87d08f8a56003a16b8a7b911",
"timestamp": "",
"source": "github",
"line_count": 218,
"max_line_length": 98,
"avg_line_length": 42.74770642201835,
"alnum_prop": 0.667024358836785,
"repo_name": "twitter/pants",
"id": "434ad49b60f5de36a2de32beac77f6342475164f",
"size": "9466",
... |
"""
Created on Sun May 28 17:37:50 2017
@author: azkei
"""
# Creating a DataFrame and writing it to JSON
# Generate DataFrame
frame = pd.DataFrame(np.arange(16).reshape(4,4),
index=['white','black','red','blue'],
columns=['up','down','right','left'])
# Convert it to a json fil... | {
"content_hash": "121a90a4709116471ec84ecda7a9a09e",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 79,
"avg_line_length": 35.205882352941174,
"alnum_prop": 0.7101086048454469,
"repo_name": "jjsalomon/python-analytics",
"id": "fb061e4e8260a09be4f750502ac20de3d14f83b7",
"s... |
import threading
import socket
import logging
import os
import collections
import time
import json
import gconlib.commands as commands
import serial
SOCKET_FILE = "/var/run/gcon.socket"
LOCAL_SOCKET_FILE = "gcon.socket"
class SockerRunner(threading.Thread):
def __init__(self, path, gcon):
threading.Threa... | {
"content_hash": "eb15c84ddcf97f69eabe85a727e6645d",
"timestamp": "",
"source": "github",
"line_count": 188,
"max_line_length": 109,
"avg_line_length": 29.77659574468085,
"alnum_prop": 0.5521614862450875,
"repo_name": "laubed/gcon",
"id": "efd7e8f7f9caa5d0cad05a583d7c41b8f96e9376",
"size": "5622",
... |
from infra_libs.ts_mon.config import add_argparse_options
from infra_libs.ts_mon.config import process_argparse_options
from infra_libs.ts_mon.common.distribution import Distribution
from infra_libs.ts_mon.common.distribution import FixedWidthBucketer
from infra_libs.ts_mon.common.distribution import GeometricBucketer... | {
"content_hash": "0914a9654c05c12ed16fc85d2febffc0",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 80,
"avg_line_length": 55.16279069767442,
"alnum_prop": 0.856239460370995,
"repo_name": "luci/luci-py",
"id": "4e7c883376501300540b89e38cf31867485a781e",
"size": "2535",
... |
import abc
from WebMirror.rules import load_rules
import WebMirror.TimedTriggers.TriggerBase
import WebRequest
import settings
class UrlTrigger(WebMirror.TimedTriggers.TriggerBase.TriggerBaseClass):
@abc.abstractmethod
def get_urls(self):
pass
class RssTriggerBase(UrlTrigger):
pluginName = "Rss Trigger"
... | {
"content_hash": "456794aa5c8bb99868ac968257110b4c",
"timestamp": "",
"source": "github",
"line_count": 178,
"max_line_length": 95,
"avg_line_length": 22.96067415730337,
"alnum_prop": 0.6904820161487644,
"repo_name": "fake-name/ReadableWebProxy",
"id": "54435de378ce148aa825a7e386a75ffcfe4163e7",
"s... |
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('userAverange', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='MAP'... | {
"content_hash": "0b8ea75c3a5b03ee115c3218d0cef7a1",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 125,
"avg_line_length": 30.153846153846153,
"alnum_prop": 0.5841836734693877,
"repo_name": "DiegoCorrea/ouvidoMusical",
"id": "da6530e1da9cdb22771081a2de5ecf106a00c7d9",
"s... |
"""Defines models for reading that save out to checkpoints."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from samyro import integerize
import prettytensor as pt
import tensorflow as tf
class Model(object):
"""A model shape.
TODO(jkahn): con... | {
"content_hash": "529b6aefbbd8a1a511afe8b9c3cc53c6",
"timestamp": "",
"source": "github",
"line_count": 85,
"max_line_length": 76,
"avg_line_length": 41.15294117647059,
"alnum_prop": 0.5957690108633504,
"repo_name": "jkahn/samyro",
"id": "6be1e77fadd2cf88b4d0af2a018e526d3326bc18",
"size": "3498",
... |
import time
from oslo.config import cfg
import requests
from neutron.common import constants as n_const
from neutron.common import exceptions as n_exc
from neutron.common import utils
from neutron.extensions import portbindings
from neutron.openstack.common import excutils
from neutron.openstack.common import jsonuti... | {
"content_hash": "aa818860c7ebd706ecaffd028f931761",
"timestamp": "",
"source": "github",
"line_count": 339,
"max_line_length": 79,
"avg_line_length": 41.584070796460175,
"alnum_prop": 0.5994183159537491,
"repo_name": "sajuptpm/neutron-ipam",
"id": "a2a94874a681c1a90cb286430f8be5889d80795b",
"size"... |
import os
import six
import struct
import sys
import unittest
sys.path.insert(0, os.path.join(os.path.dirname(__file__), ".."))
import pfp
import pfp.errors
from pfp.fields import *
import pfp.utils
from pfp.bitwrap import BitwrappedStream
import utils
class TestBitwrap(unittest.TestCase):
def setUp(self):
pass
... | {
"content_hash": "4d1b64ee51eceef5a6e7b734dfa3210d",
"timestamp": "",
"source": "github",
"line_count": 160,
"max_line_length": 90,
"avg_line_length": 27.28125,
"alnum_prop": 0.6991981672394043,
"repo_name": "AmesianX/pfp",
"id": "fc0c66b65860707c5ec359c9ff176cc5efb6c1da",
"size": "4406",
"binary... |
"""Test the cross_validation module"""
from __future__ import division
import warnings
import numpy as np
from scipy.sparse import coo_matrix
from scipy.sparse import csr_matrix
from scipy import stats
from sklearn.utils.testing import assert_true
from sklearn.utils.testing import assert_false
from sklearn.utils.test... | {
"content_hash": "39a29b62e7295b7b84f86b45a4c4e52f",
"timestamp": "",
"source": "github",
"line_count": 1243,
"max_line_length": 79,
"avg_line_length": 38.18181818181818,
"alnum_prop": 0.6119258322798146,
"repo_name": "sonnyhu/scikit-learn",
"id": "60962aa0dffd390f13904ee6ed4b857e22be26c5",
"size":... |
"""
Generate samples of synthetic data sets.
"""
# Authors: B. Thirion, G. Varoquaux, A. Gramfort, V. Michel, O. Grisel,
# G. Louppe, J. Nothman
# License: BSD 3 clause
import numbers
import array
from collections.abc import Iterable
import numpy as np
from scipy import linalg
import scipy.sparse as sp
fro... | {
"content_hash": "ced82d8bf9d7d541205e75042836f677",
"timestamp": "",
"source": "github",
"line_count": 1762,
"max_line_length": 79,
"avg_line_length": 34.4228149829739,
"alnum_prop": 0.6096153529091718,
"repo_name": "kevin-intel/scikit-learn",
"id": "3a9e1812cb1e771c31b13be690b205ffb00b2f99",
"siz... |
from swgpy.object import *
def create(kernel):
result = Static()
result.template = "object/static/structure/tatooine/shared_planter_window_style_01.iff"
result.attribute_template_id = -1
result.stfName("obj_n","unknown_object")
#### BEGIN MODIFICATIONS ####
#### END MODIFICATIONS ####
return result | {
"content_hash": "8263858185737c3ebe5c9af2ed75b3a4",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 88,
"avg_line_length": 24.384615384615383,
"alnum_prop": 0.7003154574132492,
"repo_name": "obi-two/Rebelion",
"id": "1efc7affedd46d21964a2eb3aedff3deaa728f96",
"size": "462... |
from setuptools import setup, find_packages
setup(name="mcp", version="5.2",
packages=find_packages(exclude=('mcp_test', 'mcp_test.*')))
| {
"content_hash": "ff98b0c1077e4fcbc4350ae19b367595",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 67,
"avg_line_length": 48.333333333333336,
"alnum_prop": 0.6827586206896552,
"repo_name": "sassoftware/mcp",
"id": "5f0bb0f6a55ea92daac614d354b8c199d952e0bb",
"size": "732",... |
import Queue
import StringIO
import codecs
import json
import logging
import os
import platform
import re
import sys
import thread
import time
import threading
import unittest
from webkitpy.common.system import outputcapture, path
from webkitpy.common.system.crashlogs_unittest import make_mock_crash_report_darwin
from... | {
"content_hash": "041b83fee64998197457f48344ba61a9",
"timestamp": "",
"source": "github",
"line_count": 1030,
"max_line_length": 216,
"avg_line_length": 53.34077669902913,
"alnum_prop": 0.6586884112047469,
"repo_name": "jtg-gg/blink",
"id": "7ac88d3e8789ed23aeb9df2ea38b3ad2ea372855",
"size": "56608... |
"""
The Arsenal Image Caching Service
"""
import sys
from oslo_config import cfg
from oslo_service import service
from arsenal.common import service as arsenal_service
CONF = cfg.CONF
def main():
# Parse config file and command line options, then start logging
arsenal_service.prepare_service(sys.argv)
... | {
"content_hash": "ec7bac78cc35776db824e506b84c6dec",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 68,
"avg_line_length": 21.523809523809526,
"alnum_prop": 0.75,
"repo_name": "lekhajee/arsenal",
"id": "f4978bf4361f3759dcd92736a18689c6f97b1df3",
"size": "1105",
"binary"... |
"""This example adds a campaign ad extension to a given campaign.
To get campaigns, run get_campaigns.py.
The LoadFromStorage method is pulling credentials and properties from a
"googleads.yaml" file. By default, it looks for this file in your home
directory. For more information, see the "Caching authentication info... | {
"content_hash": "211bab9b7604c896c959a563de06bac7",
"timestamp": "",
"source": "github",
"line_count": 97,
"max_line_length": 78,
"avg_line_length": 32.74226804123711,
"alnum_prop": 0.5680100755667506,
"repo_name": "dietrichc/streamline-ppc-reports",
"id": "96b2a4df4bfb09f99b80abbde6229e6562b97f28",... |
from __future__ import unicode_literals
from django.conf.urls import patterns, include, url
from django.conf.urls.i18n import i18n_patterns
from django.contrib import admin
from mezzanine.conf import settings
from apps.las_shop.views import index_shop
admin.autodiscover()
# Add the urlpatterns for any custom Djang... | {
"content_hash": "f6cfeb24e92e2278817178b0c0d01370",
"timestamp": "",
"source": "github",
"line_count": 116,
"max_line_length": 78,
"avg_line_length": 40.66379310344828,
"alnum_prop": 0.6525333898664405,
"repo_name": "dfirst/romasshop",
"id": "8065c0c43b7fd43950361d8079a571bc2f4c5662",
"size": "471... |
class LetterStrings:
def sum(self, s):
total = 0
for string in s:
for letter in string:
if(letter != '-'):
total += 1
return total
| {
"content_hash": "e8d3ddee5fd565ecab771d97d7483615",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 34,
"avg_line_length": 23.11111111111111,
"alnum_prop": 0.42788461538461536,
"repo_name": "mikefeneley/topcoder",
"id": "875a450f99a11ecf84753b4f9ec7a5c0e5f61f7b",
"size": "... |
from collections import OrderedDict
class AnalysisResults(OrderedDict):
def __init__(self, result):
super(AnalysisResults, self).__init__()
if result:
try:
self["request_id"] = result.get("requestId", None)
self["metadata"] = Metadata(result.get("metadat... | {
"content_hash": "7306405218ef8b6fb9b25743e08c7fd9",
"timestamp": "",
"source": "github",
"line_count": 462,
"max_line_length": 86,
"avg_line_length": 23.66017316017316,
"alnum_prop": 0.577989205013265,
"repo_name": "chidochipotle/oxford",
"id": "90a0017ff902fd94e0b0f4e84f652074e397a2fb",
"size": "... |
import sys
import glob
import serial
def serial_ports():
""" Lists serial port names
:raises EnvironmentError:
On unsupported or unknown platforms
:returns:
A list of the serial ports available on the system
"""
if sys.platform.startswith('win'):
ports = ['... | {
"content_hash": "4333552fefe99a5f307324fb881b7aa6",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 79,
"avg_line_length": 26.783783783783782,
"alnum_prop": 0.5832492431886983,
"repo_name": "mox17/teensy-car-sensors",
"id": "32c8cb3f135a6281a145b2e718231ca1cc90b84f",
"siz... |
import os
from django import VERSION as DJANGO_VERSION
from django.utils.translation import ugettext_lazy as _
import dj_database_url
from prettyconf import config
# If True, the django-modeltranslation will be added to the
# INSTALLED_APPS setting.
USE_MODELTRANSLATION = False
########################
# MAIN DJA... | {
"content_hash": "3bd003210350cee40a8f238f87bb6be1",
"timestamp": "",
"source": "github",
"line_count": 256,
"max_line_length": 81,
"avg_line_length": 32.26953125,
"alnum_prop": 0.6910785619174434,
"repo_name": "lamenezes/fanficast",
"id": "fd08425dc2e5076ac6cc4f695566a82bb96da1cb",
"size": "8279",... |
import random
import requests
import string
import time
from nose.tools import eq_ as eq
def assert_raises(excClass, callableObj, *args, **kwargs):
"""
Like unittest.TestCase.assertRaises, but returns the exception.
"""
try:
callableObj(*args, **kwargs)
except excClass as e:
return... | {
"content_hash": "1a8032841210a99f20d774ef35d41dcd",
"timestamp": "",
"source": "github",
"line_count": 63,
"max_line_length": 141,
"avg_line_length": 29.73015873015873,
"alnum_prop": 0.594233849439402,
"repo_name": "kalantal/s3-tests",
"id": "24f7d87d5c9c12b1137c16d2a2bc3195b778a9a9",
"size": "187... |
import logging
from collections import defaultdict
from errno import ENOENT
from stat import S_IFDIR, S_IFLNK, S_IFREG, S_ISDIR, S_ISREG
from sys import argv, exit
from time import time, sleep
from fuse import FUSE, FuseOSError, Operations, LoggingMixIn
import socket
import sys
import select
import threading
import q... | {
"content_hash": "89be3e0f712872e9631505a7d4063397",
"timestamp": "",
"source": "github",
"line_count": 2484,
"max_line_length": 163,
"avg_line_length": 39.231078904991946,
"alnum_prop": 0.5149615187275526,
"repo_name": "zhaozhang/amfora",
"id": "fa928ee69c7b040984d93722962959fae7d4132d",
"size": "... |
"""
Talon.One API
Use the Talon.One API to integrate with your application and to manage applications and campaigns: - Use the operations in the [Integration API section](#integration-api) are used to integrate with our platform - Use the operation in the [Management API section](#management-api) to manage ap... | {
"content_hash": "8f3ec1fcce90e85fca7356d31d067ecc",
"timestamp": "",
"source": "github",
"line_count": 146,
"max_line_length": 732,
"avg_line_length": 34.945205479452056,
"alnum_prop": 0.6072128577028616,
"repo_name": "talon-one/talon_one.py",
"id": "a498656a94b2acc545ede2acc624a3b9b0a6e573",
"siz... |
from django.conf.urls import patterns, url
from tests import views
urlpatterns = patterns(
'',
url('^$', views.PostViewSet.as_view({'get': 'list'}), name='post-list')
)
| {
"content_hash": "e2a67dab660fda1b1376a9ea69b4aece",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 75,
"avg_line_length": 22.375,
"alnum_prop": 0.659217877094972,
"repo_name": "kevin-brown/drf-json-api",
"id": "c11a0852e935acaea9c6a960d8d870f7861133f5",
"size": "179",
"... |
import os
import sys
if __name__ == "__main__":
try:
from django.core.management import execute_from_command_line
except ImportError:
# The above import may fail for some other reason. Ensure that the
# issue is really that Django is missing to avoid masking other
# exceptions o... | {
"content_hash": "43d0b32cdf299518348d9e722b6bfb9d",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 77,
"avg_line_length": 35.55,
"alnum_prop": 0.6075949367088608,
"repo_name": "GrantHeaslip/ghweb",
"id": "1cf432333bf59c6ccc2447753d4da8318c7c39c9",
"size": "733",
"binar... |
from functools import partial
from inspect import getmembers
import numpy as np
from .utils import check_indices
from ..fixes import _get_args
from ..parallel import parallel_func
from ..source_estimate import _BaseSourceEstimate
from ..epochs import BaseEpochs
from ..time_frequency.multitaper import (_mt_spectra, _c... | {
"content_hash": "32324cea08c47cc0f31144512d6229a1",
"timestamp": "",
"source": "github",
"line_count": 1083,
"max_line_length": 79,
"avg_line_length": 39.091412742382275,
"alnum_prop": 0.5655706727135299,
"repo_name": "teonlamont/mne-python",
"id": "d6b2f3a892040e83a0c5647e9c706f3ac15fc877",
"size... |
from __future__ import unicode_literals
from flask import Flask, render_template
app = Flask('slow_splinter_demo')
@app.route('/')
def index():
return render_template('index.html')
| {
"content_hash": "f8027871edd9532a8d281e7f5b363841",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 40,
"avg_line_length": 18.9,
"alnum_prop": 0.708994708994709,
"repo_name": "ErinCall/slow_splinter_demo",
"id": "7a6ebc3e6df598bed49b1f85fb3b1c41a85caa3d",
"size": "189",
... |
import fixtures
from oslo_serialization import jsonutils as json
from tempest.tests import base
from tempest.tests.lib import fake_http
class BaseServiceTest(base.TestCase):
def create_response(self, body, to_utf=False, status=200, headers=None):
json_body = {}
if body:
json_body = js... | {
"content_hash": "54c35e424b2ec320bb4c9858608592ef",
"timestamp": "",
"source": "github",
"line_count": 63,
"max_line_length": 79,
"avg_line_length": 44.492063492063494,
"alnum_prop": 0.5829468426685694,
"repo_name": "Juniper/tempest",
"id": "924f9f20624b7a9ba4c754b75dc45a3a8b54c890",
"size": "3438... |
from tvm.relay.frontend.common import StrAttrsDict
def test_key_is_present():
attrs = StrAttrsDict({"a": 1})
assert attrs.has_attr("a")
def test_key_is_not_present():
attrs = StrAttrsDict({"a": 1})
assert not attrs.has_attr("b")
if __name__ == "__main__":
test_key_is_present()
test_key_is_... | {
"content_hash": "96266b221a3e9c4dd69d528eebb6fdb5",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 50,
"avg_line_length": 20.625,
"alnum_prop": 0.6242424242424243,
"repo_name": "sxjscience/tvm",
"id": "e706f2af304acae2e98144ad92ae89a9ed1366ec",
"size": "1115",
"binary"... |
import datetime
import pytest
import google.cloud._helpers
KMS_KEY_NAME = "projects/1/locations/us/keyRings/1/cryptoKeys/1"
@pytest.fixture
def target_class():
from google.cloud.bigquery import Model
return Model
@pytest.fixture
def object_under_test(target_class):
return target_class("project-id.da... | {
"content_hash": "6754dea8c593db8c5624c17374e26d74",
"timestamp": "",
"source": "github",
"line_count": 404,
"max_line_length": 88,
"avg_line_length": 33.49009900990099,
"alnum_prop": 0.59490022172949,
"repo_name": "googleapis/python-bigquery",
"id": "1ae98841490865c92ffd48baece7801612fd59bb",
"siz... |
import pathlib
from qiime2 import sdk
from qiime2.plugin import model
from qiime2.core import util
def identity_transformer(view):
return view
class ModelType:
@staticmethod
def from_view_type(view_type):
if issubclass(view_type, model.base.FormatBase):
if issubclass(view_type,
... | {
"content_hash": "6ad0f979377a3480edbda1d44652275a",
"timestamp": "",
"source": "github",
"line_count": 227,
"max_line_length": 79,
"avg_line_length": 35.4625550660793,
"alnum_prop": 0.58472049689441,
"repo_name": "jakereps/qiime2",
"id": "a5be41a13ed4ac90d52f27c36c7d2e993eef7b85",
"size": "8399",
... |
"""
WSGI config for contmon project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLICATION`` ... | {
"content_hash": "561337835823744f2916fdb127b8c726",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 79,
"avg_line_length": 41.9,
"alnum_prop": 0.7941527446300716,
"repo_name": "adandan01/contmon",
"id": "ace7d92e1d81afbbc261aa93046d2582daebc407",
"size": "1676",
"binary... |
from binascii import hexlify
from binascii import unhexlify
import os, sys, logging
try:
from Crypto.Hash import SHA256, HMAC
HAS_HASH = True
except ImportError:
HAS_HASH = False
# Counter import fails for 2.0.1, requires >= 2.6.1 from pip
try:
from Crypto.Util import Counter
HAS_COUNTER =... | {
"content_hash": "d2934def8fb1610b6103e9ab343e8816",
"timestamp": "",
"source": "github",
"line_count": 213,
"max_line_length": 136,
"avg_line_length": 29.187793427230048,
"alnum_prop": 0.5739102460994049,
"repo_name": "lykops/lykops",
"id": "d22ea8ea955407c110faad533fc60c349eaf4bb7",
"size": "6445... |
from optparse import OptionParser
from task import Task
import logging
from model_param_space import param_space_dict
def train(model_name, data_name, params_dict, logger, eval_by_rel, if_save):
task = Task(model_name, data_name, 1, params_dict, logger, eval_by_rel)
task.refit(if_save)
def parse_args(parser):... | {
"content_hash": "548eb3dbafc74c3af033ea5d62461722",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 98,
"avg_line_length": 41.310344827586206,
"alnum_prop": 0.6786310517529215,
"repo_name": "billy-inn/tensorflow-efe",
"id": "262a62d36a15d8fd30a0b6f856b8c3537d064616",
"siz... |
"""Launch an iPython shell with access to the current context."""
from IPython import embed
import unsync
import click
@unsync.command()
@click.pass_context
def ipython_shell(ctx):
"""Launch an IPython shell with access to the current context."""
data = ctx.obj # noqa
embed()
ipython_shell.display_name ... | {
"content_hash": "47901f0ac6bb16cb63741474b57ddc9c",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 69,
"avg_line_length": 22,
"alnum_prop": 0.7181818181818181,
"repo_name": "PGower/Unsync",
"id": "bf150cc02b9c759a4cbd5f9894c5a6485f987012",
"size": "330",
"binary": fals... |
from sys import byteorder
from array import array
from struct import pack
import pyaudio
import wave
THRESHOLD = 500
CHUNK_SIZE = 1024
FORMAT = pyaudio.paInt16
RATE = 44100
def is_silent(snd_data):
"Returns 'True' if below the 'silent' threshold"
return max(snd_data) < THRESHOLD
def normalize(snd_data):
... | {
"content_hash": "f9d85d74bd607e10460904b63105d839",
"timestamp": "",
"source": "github",
"line_count": 120,
"max_line_length": 80,
"avg_line_length": 24.941666666666666,
"alnum_prop": 0.6030738389575676,
"repo_name": "bbcdli/xuexi",
"id": "dfee77ee5531d84afa5f17aa69d9b48584d5c94d",
"size": "2993",... |
import argparse
import logging
from typing import Text, Union, Optional
from rasa.shared.constants import (
DEFAULT_CONFIG_PATH,
DEFAULT_DOMAIN_PATH,
DEFAULT_MODELS_PATH,
DEFAULT_DATA_PATH,
DEFAULT_ENDPOINTS_PATH,
)
def add_model_param(
parser: argparse.ArgumentParser,
model_name: Text = ... | {
"content_hash": "83c7e80f26a82303cff14161c2b0e386",
"timestamp": "",
"source": "github",
"line_count": 154,
"max_line_length": 84,
"avg_line_length": 31.136363636363637,
"alnum_prop": 0.6412930135557873,
"repo_name": "RasaHQ/rasa_nlu",
"id": "04e94da0daf4b1eba324ec4f29ed2ffed30d6449",
"size": "479... |
from pythonforandroid.recipe import PythonRecipe
class SixRecipe(PythonRecipe):
version = '1.10.0'
url = 'https://pypi.python.org/packages/source/s/six/six-{version}.tar.gz'
depends = ['setuptools']
recipe = SixRecipe()
| {
"content_hash": "85dec7507a9809fc9cf03fd4351d4bae",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 78,
"avg_line_length": 23.6,
"alnum_prop": 0.7076271186440678,
"repo_name": "rnixx/python-for-android",
"id": "43f15246a0657d4a41949d7ababe74fe8f192128",
"size": "236",
"... |
import importlib, logging, os
from contextlib import contextmanager
from tempfile import mkdtemp
import yaml
from datapackage_pipelines_knesset.common import object_storage
import json
import requests
import psutil
from datapackage_pipelines_metrics.influxdb import send_metric
import time
@contextmanager
def temp_log... | {
"content_hash": "9da30fd3a837b31d2f6e87af14600dab",
"timestamp": "",
"source": "github",
"line_count": 112,
"max_line_length": 109,
"avg_line_length": 34.4375,
"alnum_prop": 0.6245786880995593,
"repo_name": "OriHoch/knesset-data-pipelines",
"id": "016b6be395fcb43597dd19b4d2760708483ead95",
"size":... |
from ..trezor.qt_generic import QtPlugin
from keepkey import KeepKeyPlugin
class Plugin(KeepKeyPlugin, QtPlugin):
icon_paired = ":icons/keepkey.png"
icon_unpaired = ":icons/keepkey_unpaired.png"
@classmethod
def pin_matrix_widget_class(self):
from keepkeylib.qt.pinmatrix import PinMatrixWidge... | {
"content_hash": "503a56d800ef8a20103d11916f0ec0a8",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 59,
"avg_line_length": 29.416666666666668,
"alnum_prop": 0.7365439093484419,
"repo_name": "fireduck64/electrum",
"id": "189cc48269a00c83e3ade263bb9b820ce2ab05c2",
"size": "... |
"""Unit tests for the DB API."""
import copy
import datetime
import iso8601
import mock
import netaddr
from oslo_db import api as oslo_db_api
from oslo_db import exception as db_exc
from oslo_db.sqlalchemy import enginefacade
from oslo_db.sqlalchemy import test_base
from oslo_db.sqlalchemy import update_match
from os... | {
"content_hash": "dfb195b0599ed4b931abea50ebde9d8d",
"timestamp": "",
"source": "github",
"line_count": 9737,
"max_line_length": 92,
"avg_line_length": 45.122008832289204,
"alnum_prop": 0.5666764537854527,
"repo_name": "gooddata/openstack-nova",
"id": "a792a5ea67651497ba46058c5d414eeabe861764",
"si... |
"""
Django settings for tutorial project.
Generated by 'django-admin startproject' using Django 1.9.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.9/ref/settings/
"""
import os
# ... | {
"content_hash": "ac7144eb36fd60cafa6d519b5241fb42",
"timestamp": "",
"source": "github",
"line_count": 127,
"max_line_length": 91,
"avg_line_length": 25.826771653543307,
"alnum_prop": 0.688109756097561,
"repo_name": "BubuYo/rest_api",
"id": "2945c9898638df3a6bd351f700ec17e312b96afd",
"size": "3280... |
mi_diccionario_vacio = {}
mi_diccionario_vacio['llave-1'] = 2
mi_diccionario_vacio['llave-2'] = 4
mi_diccionario_vacio['llave-3'] = 8
# Borra un elemento del diccionario
del mi_diccionario_vacio['llave-1']
# Verificamos que una llave existe en el diccionario
if 'llave-2' in mi_diccionario_vacio:
print('llave-2 ex... | {
"content_hash": "54d7c76ad76c887541623e68c7e5003f",
"timestamp": "",
"source": "github",
"line_count": 226,
"max_line_length": 112,
"avg_line_length": 30.398230088495577,
"alnum_prop": 0.6452692867540029,
"repo_name": "AnhellO/DAS_Sistemas",
"id": "b9c9d8b7b608134dbe8d8d5fe8b6d0ea9773a33c",
"size"... |
"""Reading, editing, and writing XML files."""
import xml.etree.ElementTree as ET # noqa: N814
import logging
import re
logger = logging.getLogger(__name__)
class XML(object):
"""Class capable of reading, editing, and writing XML files."""
@staticmethod
def get_ns(text):
"""Get the namespace... | {
"content_hash": "d595e9d82af193a2de3a899b8b9d0941",
"timestamp": "",
"source": "github",
"line_count": 294,
"max_line_length": 79,
"avg_line_length": 40,
"alnum_prop": 0.5386904761904762,
"repo_name": "glennmatthews/cot",
"id": "5f4b3e3461c045bb5520a192d8d5c82a72b16099",
"size": "12501",
"binary... |
'''
Datadog
www.datadoghq.com
----
Make sense of your IT Data
Licensed under Simplified BSD License (see LICENSE)
(C) Boxed Ice 2010 all rights reserved
(C) Datadog, Inc. 2010-2013 all rights reserved
'''
# set up logging before importing any other components
from config import initialize_... | {
"content_hash": "c0926966467bcb5ebd0b3ada15e07541",
"timestamp": "",
"source": "github",
"line_count": 528,
"max_line_length": 148,
"avg_line_length": 36.52840909090909,
"alnum_prop": 0.6026857468761342,
"repo_name": "JohnLZeller/dd-agent",
"id": "7b2d1d10cb07f8238084793562afddea673d9312",
"size":... |
import os
import wx
from contextlib import contextmanager
from robotide.namespace import Namespace
from robotide.controller import Project
from robotide.spec import librarydatabase
from robotide.ui import LoadProgressObserver
from robotide.ui.mainframe import RideFrame
from robotide.pluginapi import RideLogMessage
fro... | {
"content_hash": "57d1b1070e725de9bcc37700f953702d",
"timestamp": "",
"source": "github",
"line_count": 125,
"max_line_length": 89,
"avg_line_length": 38.04,
"alnum_prop": 0.670031545741325,
"repo_name": "caio2k/RIDE",
"id": "0c22d5148d30d78c24f1dd575e747591f0194dd5",
"size": "5363",
"binary": fa... |
from pynos import device
from st2actions.runners.pythonrunner import Action
class interface_ip_address(Action):
def run(self, **kwargs):
conn = (str(kwargs.pop('ip')), str(kwargs.pop('port')))
auth = (str(kwargs.pop('username')), str(kwargs.pop('password')))
test = kwargs.pop('test', False... | {
"content_hash": "b1d67dc13e1634e4d2944240e2461407",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 73,
"avg_line_length": 33.35294117647059,
"alnum_prop": 0.5908289241622575,
"repo_name": "StackStorm/st2contrib",
"id": "b09fac2e95cee0fc4ce707c4a8eb1ab1b2a3bbad",
"size": ... |
from __future__ import absolute_import, division, print_function, unicode_literals
import pytest ; pytest
#-----------------------------------------------------------------------------
# Imports
#-----------------------------------------------------------------------------
# Standard library imports
# External impo... | {
"content_hash": "ac6f25569c70d2e25b77b4acb218c7f6",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 91,
"avg_line_length": 30.8125,
"alnum_prop": 0.34212305611899935,
"repo_name": "Karel-van-de-Plassche/bokeh",
"id": "2a0ece8de92a7ca4c0269f42458bdf1e42a972dc",
"size": "19... |
from nova.compute import resource_tracker
class FakeResourceTracker(resource_tracker.ResourceTracker):
"""Version without a DB requirement."""
def _update(self, context, compute_node):
pass
| {
"content_hash": "99e07d0f3265c410c0a5bf00c1b6f016",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 60,
"avg_line_length": 26.125,
"alnum_prop": 0.7320574162679426,
"repo_name": "vmturbo/nova",
"id": "3a173a4b84db4d471a847718fcf4f60f98ab9fc8",
"size": "849",
"binary": fa... |
from __future__ import print_function
import subprocess
import sys
from rospkg.os_detect import OS_ARCH, OS_MANJARO
from ..installers import PackageManagerInstaller
from .source import SOURCE_INSTALLER
from .pip import PIP_INSTALLER
PACMAN_INSTALLER = 'pacman'
def register_installers(context):
context.set_inst... | {
"content_hash": "d80eef170dd209bb5f95563343241405",
"timestamp": "",
"source": "github",
"line_count": 63,
"max_line_length": 99,
"avg_line_length": 31.285714285714285,
"alnum_prop": 0.6884830035514967,
"repo_name": "ros-infrastructure/rosdep",
"id": "d9301f43d95022d9109b43b4ec2224d182a0520e",
"si... |
class TestModule(object):
def tests(self):
return {'equalto': lambda a, b: a == b}
| {
"content_hash": "bff1963f065b3acf228c790c4726cd63",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 47,
"avg_line_length": 31.666666666666668,
"alnum_prop": 0.5894736842105263,
"repo_name": "alem0lars/os-install",
"id": "968b63bb779fcc7fee1555b84dc44b8d280f6ca8",
"size": "... |
from lar import *
from scipy import *
import json
import scipy
import numpy as np
import time as tm
import gc
from pngstack2array3d import *
import struct
import getopt, sys
import traceback
#
import matplotlib.pyplot as plt
# ------------------------------------------------------------
# Logging & Timer
# ----------... | {
"content_hash": "03ed7f5587be28818fec4c24dcfbac23",
"timestamp": "",
"source": "github",
"line_count": 263,
"max_line_length": 167,
"avg_line_length": 31.32319391634981,
"alnum_prop": 0.5871570769604273,
"repo_name": "cvdlab/lar-running-demo",
"id": "ae67453c25b117e393a14ab6b00552924e4cf8be",
"siz... |
"""
================================================
:mod:`replacers` -- Survivor replacement methods
================================================
This module provides pre-defined replacers for evolutionary computations.
All replacer functions have the following arguments:
- *... | {
"content_hash": "85e22ea1ce0f9208000a85e1093fd689",
"timestamp": "",
"source": "github",
"line_count": 438,
"max_line_length": 115,
"avg_line_length": 40.32876712328767,
"alnum_prop": 0.6456068840579711,
"repo_name": "aarongarrett/inspyred",
"id": "10aa4e11150bc6066cb7b49ca96fac394cd51c52",
"size"... |
"""empty message
Revision ID: 426c876ed746
Revises: b92dc277c384
Create Date: 2017-05-12 11:57:29.387852
"""
# revision identifiers, used by Alembic.
revision = '426c876ed746'
down_revision = 'b92dc277c384'
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by Alembic - ... | {
"content_hash": "8a0f99e9d2806be67b2a9fcb85712254",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 65,
"avg_line_length": 27.8,
"alnum_prop": 0.6642685851318945,
"repo_name": "uwcirg/true_nth_usa_portal",
"id": "2ad232f8d2f3cc8047e86ecba1193af3fbe3b0e6",
"size": "834",
... |
import pytest
from openshift_checks.package_availability import PackageAvailability
@pytest.mark.parametrize('pkg_mgr,is_active', [
('yum', True),
('dnf', False),
])
def test_is_active(pkg_mgr, is_active):
task_vars = dict(
ansible_pkg_mgr=pkg_mgr,
)
assert PackageAvailability(None, task_... | {
"content_hash": "54fdcd7e037b87b6a50f18abf0e4729a",
"timestamp": "",
"source": "github",
"line_count": 59,
"max_line_length": 85,
"avg_line_length": 30.694915254237287,
"alnum_prop": 0.6024295969077857,
"repo_name": "maxamillion/openshift-ansible",
"id": "206e21318fefd5660ba26fdef891b2c4f2f520a2",
... |
"""Tests for registry."""
from absl.testing import absltest
from language.mentionmemory.encoders import base_encoder
from language.mentionmemory.encoders import encoder_registry
@encoder_registry.register_encoder('decorated_encoder')
class DecoratedEncoder(base_encoder.BaseEncoder):
pass
class UnDecoratedEncode... | {
"content_hash": "d9ae1c41899f30515b17c7bb938a2cb1",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 109,
"avg_line_length": 34.46551724137931,
"alnum_prop": 0.7518759379689844,
"repo_name": "google-research/language",
"id": "30dbd763ad8e7efe3b48778647584f3e6b325a4d",
"siz... |
from L500analysis.derived_fields.derived_fields import *
from L500analysis.plotting.profiles.tools.radial_normalizations import *
from L500analysis.derived_fields.collections.peak_height.derived_field_functions \
import *
from L500analysis.utils.constants import hubble,Msun2g,kpc2cm
from L500analysis.plotting.profi... | {
"content_hash": "2f6c97f864f3ddffc0f9b73e12bb01e8",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 84,
"avg_line_length": 38.74418604651163,
"alnum_prop": 0.6308523409363745,
"repo_name": "cavestruz/L500analysis",
"id": "713ea22c3bf218153e5f8f2194f1c7364ab17a45",
"size":... |
from datetime import datetime
import requests
from scraper.database import get_session
from scraper.models import Champion, Player, Match, PlayerMatchMap
from scraper.settings import Config
def fetch_base(base, resource, **kwargs):
url = base + resource
kwargs['api_key'] = Config.TOKEN
response = reques... | {
"content_hash": "38eef219e11a8fb7f6952dabfc58d497",
"timestamp": "",
"source": "github",
"line_count": 112,
"max_line_length": 76,
"avg_line_length": 34.160714285714285,
"alnum_prop": 0.5763199163617355,
"repo_name": "Doomsk/dblolscrapper",
"id": "e23a7a2ab420ee22ca6fdd335411de7f41966c2f",
"size":... |
from vic import lib as vic_lib
def test_str_to_bool():
for s, expected in [('TRUE', True), ('FALSE', False),
('true', True), ('false', False),
('TrUe', True), ('FaLsE', False)]:
assert vic_lib.str_to_bool(s.encode()) == expected
def test_str_to_agg_type():... | {
"content_hash": "7020a5a7bbe423314de1aa1de21eedda",
"timestamp": "",
"source": "github",
"line_count": 82,
"max_line_length": 83,
"avg_line_length": 38.59756097560975,
"alnum_prop": 0.6066350710900474,
"repo_name": "UW-Hydro/VIC",
"id": "2db57b442fa6ae06b6826617283d2b79731a2d85",
"size": "3165",
... |
from rally import consts
class Endpoint(object):
def __init__(self, auth_url, username, password, tenant_name=None,
permission=consts.EndpointPermission.USER,
region_name=None, endpoint_type=consts.EndpointType.PUBLIC,
admin_port=None, domain_name=None, endpoint... | {
"content_hash": "34b72999f4bc1e54dc428bc2351fb66f",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 76,
"avg_line_length": 42.55813953488372,
"alnum_prop": 0.5896174863387978,
"repo_name": "varunarya10/rally",
"id": "24ac9077f77a5c016c65c925654c9e2a76717083",
"size": "246... |
"""
calico.etcddriver.test_protocol
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Tests for Felix/etcddriver protocol read/write function.
"""
import logging
import socket
from unittest import TestCase
import errno
from mock import Mock, call, patch
import msgpack
from calico.etcddriver.protocol import (
MessageWriter, STATUS_... | {
"content_hash": "9abd425e752b8fce2025c3e639bf9698",
"timestamp": "",
"source": "github",
"line_count": 220,
"max_line_length": 75,
"avg_line_length": 34.122727272727275,
"alnum_prop": 0.5260423604635673,
"repo_name": "alexhersh/calico",
"id": "14d36bf5ad1dd2511a641c6417afb5e10f06cd72",
"size": "81... |
import ctypes
import itertools
import windows
import windows.hooks
from windows.generated_def.winstructs import *
class Ressource(object):
def __init__(self, filename, lpName, lpType):
self.filename = filename
self.lpName = lpName
self.lpType = lpType
self.driver_data = None
... | {
"content_hash": "95df8fe369b92448d6bd8d7a93b19a9a",
"timestamp": "",
"source": "github",
"line_count": 68,
"max_line_length": 75,
"avg_line_length": 28.16176470588235,
"alnum_prop": 0.6725848563968668,
"repo_name": "sogeti-esec-lab/LKD",
"id": "0e6f977cf27cacfcaf3bae96a85dedd2ecd19132",
"size": "1... |
from __future__ import absolute_import
from mock import patch, Mock
from fabutils.git import get_changed_files
@patch('fabutils.git.quiet')
@patch('fabutils.git.local', Mock())
def test_called_within_quiet(quiet):
get_changed_files()
quiet.assert_called_once()
@patch('fabutils.git.quiet')
@patch('fabutils.... | {
"content_hash": "62c9670107fee91bbb97a0d9218b1e93",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 71,
"avg_line_length": 27.451612903225808,
"alnum_prop": 0.700352526439483,
"repo_name": "novopl/fabutils",
"id": "0abf3ca6719d5b2822c80e764823ec39c82c1231",
"size": "875",... |
from twitter.common import app
from twitter.common.log.options import LogOptions
from apache.aurora.admin import help as help_commands
from apache.aurora.admin import admin, maintenance
from apache.aurora.common.auth.auth_module_manager import register_auth_module
from .help import add_verbosity_options, generate_ter... | {
"content_hash": "b74b42895f8839889b89812c4f3ae287",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 78,
"avg_line_length": 26.774193548387096,
"alnum_prop": 0.791566265060241,
"repo_name": "wfarner/aurora",
"id": "470b2d2339284de9246b35daa0af1c2b832c232d",
"size": "1379",... |
"""
Driver for Linux servers running LVM.
"""
import math
import os
import socket
from oslo.config import cfg
from cinder.brick import exception as brick_exception
from cinder.brick.local_dev import lvm as lvm
from cinder import exception
from cinder.image import image_utils
from cinder.openstack.common import file... | {
"content_hash": "a4f9557375ee36bf622bb612ef070195",
"timestamp": "",
"source": "github",
"line_count": 610,
"max_line_length": 79,
"avg_line_length": 40.87377049180328,
"alnum_prop": 0.5625877351301488,
"repo_name": "spring-week-topos/cinder-week",
"id": "2dc2fdaf2f62d82d3258f3ba8494f0d590dcba87",
... |
"""
AUTHOR: KEITH WILLIAMS
DATE: 14/2/2017
DESCRIPTION: Manage all database interactions
"""
# PyMongo was the recommended python driver for MongoDB at
# https://docs.mongodb.com/ecosystem/drivers/python/
import pymongo
import redis
# http://api.mongodb.com/python/current/api/bson/json_util.html
from bson.json_ut... | {
"content_hash": "24a47b3153180e84a8a96d5d19483e2d",
"timestamp": "",
"source": "github",
"line_count": 218,
"max_line_length": 197,
"avg_line_length": 33.24770642201835,
"alnum_prop": 0.7128863134657837,
"repo_name": "KeithWilliamsGMIT/3rd-Year-Project",
"id": "bd930dacc1f6d89321eb04de1ee79d5e28ea33... |
from rsqueakvm.plugins.foreign_language.process import W_ForeignLanguageProcess
from rsqueakvm.plugins.ruby import utils
from rsqueakvm.plugins.ruby.frame import WR_FrameObject
from rsqueakvm.plugins.ruby.model import W_RubyObject
from rsqueakvm.plugins.ruby.objspace import ruby_space
from topaz.error import RubyError... | {
"content_hash": "973df493f3161a3a43b5162dfcc52fc0",
"timestamp": "",
"source": "github",
"line_count": 70,
"max_line_length": 79,
"avg_line_length": 36.91428571428571,
"alnum_prop": 0.6133900928792569,
"repo_name": "HPI-SWA-Lab/RSqueak",
"id": "5a2877100d2c2bc0bae59b1d4c270dfc5a205af7",
"size": "2... |
import inspect
from mocha import (register_package,
config,
decorators as h_deco,
render,
abort
)
from mocha.core import (set_view_attr,
get_view_attr)
# `contrib` prefix is set so all templates in th... | {
"content_hash": "3c99f68597c9f953967deb076a9f29d0",
"timestamp": "",
"source": "github",
"line_count": 61,
"max_line_length": 80,
"avg_line_length": 25.049180327868854,
"alnum_prop": 0.5399214659685864,
"repo_name": "mardix/Mocha",
"id": "4b4477c97e814560c1505fd9092356ea23b540b2",
"size": "1528",
... |
from __future__ import print_function
import argparse
import ConfigParser
import datetime
import logging
import os
from Queue import Queue
import re
import subprocess
import sys
import yaml
import concurrent.futures
from rackspace_monitoring.drivers import rackspace
from rackspace_monitoring.providers import get_dri... | {
"content_hash": "1469de43b70df9759ae84bc723a878d7",
"timestamp": "",
"source": "github",
"line_count": 841,
"max_line_length": 79,
"avg_line_length": 38.18668252080856,
"alnum_prop": 0.507613264829519,
"repo_name": "npawelek/rpc-maas",
"id": "0c05bfccc0aec5fafe33ab5d7fa420a25648cc9c",
"size": "327... |
from __future__ import absolute_import
import six
from sentry.models import AuthIdentity, AuthProvider
from sentry.testutils import AuthProviderTestCase
from sentry.utils.auth import SSO_SESSION_KEY
class OrganizationAuthLoginTest(AuthProviderTestCase):
def test_sso_auth_required(self):
user = self.crea... | {
"content_hash": "4da041c729bb7fe0f729d450643a954a",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 79,
"avg_line_length": 37.422222222222224,
"alnum_prop": 0.6828978622327792,
"repo_name": "beeftornado/sentry",
"id": "9d25276f8a56a68804e3bf744eeb42d9f3a4bff4",
"size": "1... |
from __future__ import print_function, absolute_import, division
import sys
import inspect
import socket
import numpy as np
from sklearn.utils import check_random_state
from sklearn.grid_search import ParameterGrid
try:
from hyperopt import (Trials, tpe, fmin, STATUS_OK, STATUS_RUNNING,
S... | {
"content_hash": "c219f5d67caae3c77c1ab3b90b1b3d04",
"timestamp": "",
"source": "github",
"line_count": 390,
"max_line_length": 108,
"avg_line_length": 37.62307692307692,
"alnum_prop": 0.5782730184692974,
"repo_name": "msultan/osprey",
"id": "7d666409d735882fe07b30f41227929433d96b2e",
"size": "1467... |
import base64
from typing import List
from xdrlib import Packer, Unpacker
from .base import Integer
from .operation_meta import OperationMeta
from .transaction_meta_v1 import TransactionMetaV1
from .transaction_meta_v2 import TransactionMetaV2
__all__ = ["TransactionMeta"]
class TransactionMeta:
"""
XDR Sou... | {
"content_hash": "92ad5d8af16f48d8c2df76e94b50073d",
"timestamp": "",
"source": "github",
"line_count": 119,
"max_line_length": 112,
"avg_line_length": 30.840336134453782,
"alnum_prop": 0.5574931880108992,
"repo_name": "StellarCN/py-stellar-base",
"id": "0a9ef07b2b86292ffe59e3ab3d3be4dd659e7ed1",
"... |
from packages import peewee
metadata_db_proxy = peewee.Proxy()
class Scheme(peewee.Model):
item_id = peewee.CharField(index=True)
key = peewee.CharField(index=True)
value = peewee.CharField(index=True)
class Meta:
database = metadata_db_proxy
db_table = '... | {
"content_hash": "8b6ccc39838fde004950c73793410e69",
"timestamp": "",
"source": "github",
"line_count": 91,
"max_line_length": 112,
"avg_line_length": 32.37362637362637,
"alnum_prop": 0.5227427019687713,
"repo_name": "ownport/storages",
"id": "a2bb4051fe902d799542825335cd9b441f3a257c",
"size": "294... |
from __future__ import unicode_literals
from datetime import timedelta
from core.analytics import ScheduledAnalytics
from mongoengine import Q
class ExpireTags(ScheduledAnalytics):
default_values = {
"frequency": timedelta(hours=12),
"name": "ExpireTags",
"description": "Expires tags in ... | {
"content_hash": "0c7cb506b58bc6520947ce20a440dc72",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 71,
"avg_line_length": 23.551724137931036,
"alnum_prop": 0.6544655929721815,
"repo_name": "yeti-platform/yeti",
"id": "5fa3d331a1459d66c91cc7bf2c6ef15ce8c7ffda",
"size": "6... |
"""ctexplain: how does configuration affect build graphs?
This is a swiss army knife tool that tries to explain why build graphs are the
size they are and how build flags, configuration transitions, and dependency
structures affect that.
This can help developers use flags and transitions with minimal memory and
maxim... | {
"content_hash": "062378a776eaae9d38dfc90b6f536b82",
"timestamp": "",
"source": "github",
"line_count": 145,
"max_line_length": 134,
"avg_line_length": 33.5448275862069,
"alnum_prop": 0.7002467105263158,
"repo_name": "werkt/bazel",
"id": "cb300a45cd95164a1d7a355ffdc297f34850d417",
"size": "5485",
... |
from __future__ import print_function
import sys
from datetime import datetime
import time
import array
import struct
import os
sys.path.append("build/lib/python/")
import vsimj1b
sys.path.append("../../shell")
import swapforth
class TetheredJ1b(swapforth.TetheredTarget):
cellsize = 4
def open_ser(self, por... | {
"content_hash": "b0ccd267b9314baf15f2c3ca2b516058",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 74,
"avg_line_length": 23.22641509433962,
"alnum_prop": 0.5385865150284321,
"repo_name": "jamesbowman/swapforth",
"id": "a1065802b69bea6c34cdc08331f19dbc9b3d3985",
"size": ... |
from Container import Container
from JumpScale import j
import os
import docker
import time
from urllib import parse
class Docker:
def __init__(self):
self.__jslocation__ = "j.sal.docker"
self.logger = j.logger.get('j.sal.docker')
self._basepath = "/mnt/vmstor/docker"
self._weave... | {
"content_hash": "a04b56173e51be091602d8d8e0c9630d",
"timestamp": "",
"source": "github",
"line_count": 681,
"max_line_length": 190,
"avg_line_length": 35.34214390602056,
"alnum_prop": 0.5397623400365631,
"repo_name": "Jumpscale/jumpscale_core8",
"id": "955f76fc66bdf4ce50e3a4721988dde6fe2040dc",
"s... |
import os
from setuptools import setup, find_packages
here = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(here, 'README.md')) as f:
README = f.read()
with open(os.path.join(here, 'CHANGES.md')) as f:
CHANGES = f.read()
long_description = README + "\n\n" + CHANGES
try:
import pypandoc
... | {
"content_hash": "996d0150fdb139655332ede828febbd0",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 77,
"avg_line_length": 27.875,
"alnum_prop": 0.6258808456117874,
"repo_name": "jenner/LstGen",
"id": "838c3b6f28b846e9fbc7da5c7cb43a407a776a55",
"size": "1561",
"binary":... |
"""
homeassistant.bootstrap
~~~~~~~~~~~~~~~~~~~~~~~
Provides methods to bootstrap a home assistant instance.
Each method will return a tuple (bus, statemachine).
After bootstrapping you can add your own components or
start by calling homeassistant.start_home_assistant(bus)
"""
import os
import sys
import logging
imp... | {
"content_hash": "9469a46a91df614ea49337502b88759e",
"timestamp": "",
"source": "github",
"line_count": 357,
"max_line_length": 79,
"avg_line_length": 32.851540616246496,
"alnum_prop": 0.6339529331514324,
"repo_name": "alexkolar/home-assistant",
"id": "a7e4dbfdc14e4b78a99150bf1fde698096dee384",
"si... |
"""
A file full of bit twidling helpers
"""
import struct
MAX_WORD = 32 # usually no more than 8, 16 is for SIMD register support
# Masks to use for unsigned anding to size
u_maxes = [(2 ** (8*i)) - 1 for i in range(MAX_WORD+1)]
u_maxes[0] = 0 # powers of 0 are 1, but we need 0
bu_maxes = [(2 ** (i)) - 1 for i in ... | {
"content_hash": "19c03d7f64a7188feddcae54a56ebecf",
"timestamp": "",
"source": "github",
"line_count": 353,
"max_line_length": 79,
"avg_line_length": 24.725212464589234,
"alnum_prop": 0.5783684692942255,
"repo_name": "atlas0fd00m/CanCat",
"id": "4ccb5ab883712c0eb76a640bb61b8b332281dfa6",
"size": "... |
"""Changes the description, promo text and title of an app in en-US and en-GB.
"""
import argparse
import sys
from apiclient import sample_tools
from oauth2client import client
TRACK = 'alpha' # Can be 'alpha', beta', 'production' or 'rollout'
# Declare command-line flags.
argparser = argparse.ArgumentParser(add_he... | {
"content_hash": "667eff7ffa455f09b04c0d0218fc468e",
"timestamp": "",
"source": "github",
"line_count": 63,
"max_line_length": 78,
"avg_line_length": 33.01587301587302,
"alnum_prop": 0.6485576923076923,
"repo_name": "hyogij/android-play-publisher-api",
"id": "7005a8bfe0a8dd9dd35b5c27dd18b868662c2953"... |
import MySQLdb
import logging
from mysql_basic_c import mysql_basic_c as database
logger = logging.getLogger(__name__)
class tab_history_tickets():
'''
Manage tab_history_tickets table
'''
def __init__(self, host, user, passwd, db):
'''
init class.
Args:
host:mysql... | {
"content_hash": "88fc0701f6a18eb8b056976574aafab1",
"timestamp": "",
"source": "github",
"line_count": 628,
"max_line_length": 715,
"avg_line_length": 46.738853503184714,
"alnum_prop": 0.5797901335513764,
"repo_name": "Svolcano/python_exercise",
"id": "3e24378f1f3b09285002c85d10ff3fa2f8b2de30",
"s... |
import paddle.fluid.core as core
import unittest
import numpy as np
class TestSelectedRows(unittest.TestCase):
def test_selected_rows(self):
place = core.CPUPlace()
height = 10
rows = [0, 4, 7]
row_numel = 12
selected_rows = core.SelectedRows(rows, height)
np_array ... | {
"content_hash": "00f59ca3f38ae8a647848093f1e08f2d",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 79,
"avg_line_length": 31.710526315789473,
"alnum_prop": 0.5717842323651452,
"repo_name": "pkuyym/Paddle",
"id": "3d7b86787fbf0a855bcd86b8a873c9134cb1d5cc",
"size": "1818",... |
"""
Functions to aid writing python scripts that process the pandoc
AST serialized as JSON.
"""
import codecs
import hashlib
import io
import json
import os
import sys
# some utility-functions: make it easier to create your own filters
def get_filename4code(module, content, ext=None):
"""Generate filename base... | {
"content_hash": "38248a659d9065c975d35d65d1cf8d20",
"timestamp": "",
"source": "github",
"line_count": 284,
"max_line_length": 81,
"avg_line_length": 28.735915492957748,
"alnum_prop": 0.6040926357064085,
"repo_name": "lancezlin/ml_template_py",
"id": "0d9152d908168954b7fc3d3c212cbb319b4001db",
"si... |
from copy import deepcopy
from threading import Lock, Event
from miniworld.Config import config
from miniworld.concurrency.ExceptionStopThread import ExceptionStopThread
from miniworld.errors import Unsupported
from miniworld.log import log
from miniworld.model.emulation.nodes.virtual.CentralNode import is_central_nod... | {
"content_hash": "41872a0121d6ed4b3c5d956b3d2863bc",
"timestamp": "",
"source": "github",
"line_count": 230,
"max_line_length": 176,
"avg_line_length": 34.856521739130436,
"alnum_prop": 0.5724086316577274,
"repo_name": "miniworld-project/miniworld_core",
"id": "3f0bc55b17767cc9a7685b6812d19525b05ca5e... |
import random
def typoglycemia(sentence):
transformed = []
for word in sentence.split():
if len(word) > 4:
head, middle, last = word[0], list(word[1:-1]), word[-1]
random.shuffle(middle)
word = head + ''.join(middle) + last
transformed.append(word)
return ... | {
"content_hash": "f4262d6c1b3837a8bf6ec3a3b91a78db",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 130,
"avg_line_length": 38.214285714285715,
"alnum_prop": 0.6130841121495327,
"repo_name": "knuu/nlp100",
"id": "04d3ebd915f48e48b4d38bf956dd81710d6556c5",
"size": "535",
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.