text stringlengths 4 1.02M | meta dict |
|---|---|
import json
import logging
from django.utils.encoding import force_unicode
from django.utils.html import escape
from django.utils.translation import ugettext as _
from desktop.lib.django_util import JsonResponse, render
from desktop.lib.exceptions_renderable import PopupException
from desktop.lib.rest.http_client imp... | {
"content_hash": "f5100a6eb3231bf044842afb2e34543c",
"timestamp": "",
"source": "github",
"line_count": 551,
"max_line_length": 134,
"avg_line_length": 31.765880217785845,
"alnum_prop": 0.6380049134434097,
"repo_name": "nvoron23/hue",
"id": "54498844a1be8b35e670fc57754c9e1e72f3a9e1",
"size": "18295... |
from ducktape.services.service import Service
from ducktape.utils.util import wait_until
from config import KafkaConfig
from kafkatest.services.kafka import config_property
from kafkatest.services.kafka.version import TRUNK
from kafkatest.services.kafka.directory import kafka_dir, KAFKA_TRUNK
from kafkatest.services.... | {
"content_hash": "2d2c9e6e6e82cd334f8cb0c0781d1d9a",
"timestamp": "",
"source": "github",
"line_count": 291,
"max_line_length": 159,
"avg_line_length": 40.175257731958766,
"alnum_prop": 0.6042254725857498,
"repo_name": "racker/kafka",
"id": "27530f0c4fffe32ab0d45594a64923f39bd41abc",
"size": "12472... |
import sys
from collections import namedtuple
Segment = namedtuple('Segment', 'start end')
def optimal_points(segments):
points = []
#write your code here
for s in segments:
points.append(s.start)
points.append(s.end)
return points
if __name__ == '__main__':
input = sys.stdin.read... | {
"content_hash": "ffb4b61cc64528a6f7d0786707cfb808",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 83,
"avg_line_length": 26.38095238095238,
"alnum_prop": 0.6064981949458483,
"repo_name": "oy-vey/algorithms-and-data-structures",
"id": "fabdedd54a265341b578e464deb816c8f4fd6... |
from . import database
from . import config
from . import simpcoins
| {
"content_hash": "895b1d9e2898275eb314b25bc8c81dca",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 23,
"avg_line_length": 22.666666666666668,
"alnum_prop": 0.7794117647058824,
"repo_name": "IsmaelRLG/simpbot",
"id": "a9f1bab5a677b7ffb6bb959556a31453ef690677",
"size": "232... |
from github import Github
import datetime
from employee import EmployCommit
import sys
# input_username = input("Github username: ")
# input_password = input("password: ")
# 接受命令行参数
input_username = sys.argv[1]
input_password = sys.argv[2]
github_obj = Github(input_username, input_password)
contributions = {}
repo_... | {
"content_hash": "82bb8aae1c3358080dde4d64ec0547d6",
"timestamp": "",
"source": "github",
"line_count": 59,
"max_line_length": 91,
"avg_line_length": 30.440677966101696,
"alnum_prop": 0.5629175946547884,
"repo_name": "rabitdash/practice",
"id": "05f315b9c31e3c6be24ac45d3580fd196fe6795b",
"size": "1... |
from os.path import abspath, join, dirname
from preggy import expect
import mock
# from tornado.concurrent import Future
import tornado.web
from tests.base import PythonTestCase
import thumbor.loaders.strict_https_loader as loader
from thumbor.context import Context
from thumbor.config import Config
from thumbor.load... | {
"content_hash": "bb98f0eab67b40768fe8422f52415f9a",
"timestamp": "",
"source": "github",
"line_count": 150,
"max_line_length": 102,
"avg_line_length": 34.62,
"alnum_prop": 0.6325823223570191,
"repo_name": "2947721120/thumbor",
"id": "27ad951b765fc184783a4d7bc9101c3bde27eda0",
"size": "5444",
"bi... |
r"""
Configuration options which may be set on the command line or in config files.
The schema for each option is defined using the Opt sub-classes, e.g.:
::
common_opts = [
cfg.StrOpt('bind_host',
default='0.0.0.0',
help='IP address to listen on'),
cfg.IntOp... | {
"content_hash": "346ebed6a7efc2450af2ca9321308175",
"timestamp": "",
"source": "github",
"line_count": 1771,
"max_line_length": 79,
"avg_line_length": 34.04573687182383,
"alnum_prop": 0.5921552367526329,
"repo_name": "fajoy/nova",
"id": "ad1f2a8a69e1ade29f21a12e899372ddce97ac9b",
"size": "60946",
... |
from bs4 import BeautifulSoup
try:
# For Python 3.0 and later
from urllib.request import urlopen
from urllib.error import URLError
from urllib.error import HTTPError
except ImportError:
# Fall back to Python 2's urllib2
from urllib2 import urlopen
from urllib2 import URLError
from urlli... | {
"content_hash": "4283734c1555c07130f2c4da0cbb3d6a",
"timestamp": "",
"source": "github",
"line_count": 232,
"max_line_length": 130,
"avg_line_length": 44.65948275862069,
"alnum_prop": 0.5016890261557765,
"repo_name": "ROZ32/pythonScraper",
"id": "1754a55a6a75bd7d4354215f384ecdb620509284",
"size": ... |
import argparse
import shlex
class ArgHandler(object):
def __init__(self, line):
self.parser = argparse.ArgumentParser(description='SQLCell arguments')
self.parser.add_argument(
"-e", "--engine",
help='Engine param, specify your connection string: --engine=postgresql://user... | {
"content_hash": "9924559a024cc5da99c9915e29375777",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 128,
"avg_line_length": 41.486486486486484,
"alnum_prop": 0.5771986970684039,
"repo_name": "tmthyjames/SQLCell",
"id": "97a4102a79e23575b7a5b079032881f68e13106a",
"size": "... |
import Plugin
from common import Task
import Trace
import StringUtils
class TextExporterPlugin(Plugin.ExporterPlugin):
"""
Text trace file writer.
"""
formatName = "text"
def saveTrace(self, trace, traceFile, truncateValues = True, includeSensorData = False):
try:
library = self.ana... | {
"content_hash": "a94aec7b98ff00db06be68d8047c4d28",
"timestamp": "",
"source": "github",
"line_count": 73,
"max_line_length": 102,
"avg_line_length": 35.945205479452056,
"alnum_prop": 0.5926067073170732,
"repo_name": "skyostil/tracy",
"id": "9e6ac2396f91ea2ad2390a465f24a723872a8546",
"size": "3727... |
"""
This is our basic test running framework based on Twisted's Trial.
Usage Examples:
# to run all the tests
python run_tests.py
# to run a specific test suite imported here
python run_tests.py NodeConnectionTestCase
# to run a specific test imported here
python run_tests.py NodeConnectionT... | {
"content_hash": "07c224903ad8b937071ee3a447fe58ee",
"timestamp": "",
"source": "github",
"line_count": 83,
"max_line_length": 76,
"avg_line_length": 32.144578313253014,
"alnum_prop": 0.6829085457271364,
"repo_name": "movmov/cc",
"id": "886ab4bd0bc5495e3529100404c6d277ffbaecc1",
"size": "3322",
"... |
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'Country'
db.create_table('geo_country', (
('id', self.gf('django.db.models.fields.AutoField')(primary_ke... | {
"content_hash": "b0c030157127e16c169b2abcf2de7751",
"timestamp": "",
"source": "github",
"line_count": 112,
"max_line_length": 171,
"avg_line_length": 60.767857142857146,
"alnum_prop": 0.5650896267998825,
"repo_name": "hoosteeno/mozillians",
"id": "085a96fff3ce48ce2dee70d6958ea2079e169507",
"size"... |
""" Sahana Eden Messaging Model
@copyright: 2009-2013 (c) Sahana Software Foundation
@license: MIT
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, inc... | {
"content_hash": "7c8b9bbeba6531bf28ac67a7e5ad1b83",
"timestamp": "",
"source": "github",
"line_count": 2273,
"max_line_length": 141,
"avg_line_length": 38.54025516937968,
"alnum_prop": 0.3987808497522888,
"repo_name": "code-for-india/sahana_shelter_worldbank",
"id": "b33d713d517b41717e924886151f40d6... |
from rest_framework import serializers
import pdb
from .models import *
from authentication.serializers import AccountSerializer
class ImageSerializer(serializers.ModelSerializer):
image = serializers.ImageField(max_length=128, use_url=True,)
class Meta:
model = Image
fields = ('title', 'imag... | {
"content_hash": "d8a10cdcc2c2431daf5432dbade55dbc",
"timestamp": "",
"source": "github",
"line_count": 121,
"max_line_length": 107,
"avg_line_length": 37.47107438016529,
"alnum_prop": 0.6444640494044993,
"repo_name": "dmham86/CrowdBrew",
"id": "8773cabffe9d9ff434e2a3ae134e285846790166",
"size": "4... |
import logging
import json
from nose.tools import assert_true, assert_equal, assert_false
from django.utils.encoding import smart_str
from django.contrib.auth.models import User, Group
from django.core.urlresolvers import reverse
import hadoop
from desktop.lib.django_test_util import make_logged_in_client, assert_eq... | {
"content_hash": "e002820d2775a90e19a76c9bd54a4ca9",
"timestamp": "",
"source": "github",
"line_count": 253,
"max_line_length": 202,
"avg_line_length": 45.76679841897233,
"alnum_prop": 0.6911650401589083,
"repo_name": "javachengwc/hue",
"id": "0fb586efe559940fec7cf46c157ff62407e6552d",
"size": "123... |
import logging
from telemetry.util import perf_tests_helper
from telemetry.util import statistics
from telemetry.value import improvement_direction
from telemetry.value import list_of_scalar_values
from telemetry.value import scalar
from telemetry.web_perf.metrics import rendering_stats
from telemetry.web_perf.metrics... | {
"content_hash": "e3aebfc3dee7212c70180998ea759186",
"timestamp": "",
"source": "github",
"line_count": 344,
"max_line_length": 80,
"avg_line_length": 46.45639534883721,
"alnum_prop": 0.6759902384081097,
"repo_name": "Chilledheart/chromium",
"id": "62201809c70989862110298158335aaa3fdf4125",
"size":... |
"""
Weibo OAuth2 backend, docs at:
http://psa.matiasaguirre.net/docs/backends/weibo.html
"""
from social.backends.oauth import BaseOAuth2
class WeiboOAuth2(BaseOAuth2):
"""Weibo (of sina) OAuth authentication backend"""
name = 'weibo'
ID_KEY = 'uid'
AUTHORIZATION_URL = 'https://api.weibo.com/oauth... | {
"content_hash": "a14a5f10557c5aec3fddcda5f56f4794",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 79,
"avg_line_length": 36.97674418604651,
"alnum_prop": 0.569811320754717,
"repo_name": "frankier/python-social-auth",
"id": "6082ae9d349eb98687153ce7fb976e70f71bea01",
"si... |
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import os
import TestSCons
_python_ = TestSCons._python_
_exe = TestSCons._exe
test = TestSCons.TestSCons()
test.write("wrapper.py",
"""import os
import sys
open('%s', 'wb').write("wrapper.py\\n")
os.system(" ".join(sys.argv[1:]))
""" % test.workpath(... | {
"content_hash": "3f724d7c97ad624f41fb0faa08c0ef2d",
"timestamp": "",
"source": "github",
"line_count": 66,
"max_line_length": 61,
"avg_line_length": 19.5,
"alnum_prop": 0.5944055944055944,
"repo_name": "Distrotech/scons",
"id": "25d9efb89675bd0503575661bc7d73b6bb90a7a6",
"size": "2389",
"binary"... |
import pytest
from haralyzer import HarPage, HarParser, HarEntry
from haralyzer.compat import iteritems
from haralyzer.errors import PageNotFoundError
import re
import six
BAD_PAGE_ID = 'sup_dawg'
PAGE_ID = 'page_3'
def test_init(har_data):
"""
Test the object loading
"""
with pytest.raises(ValueErro... | {
"content_hash": "f596488f717d3853211f8050c52e38e6",
"timestamp": "",
"source": "github",
"line_count": 286,
"max_line_length": 94,
"avg_line_length": 34.60489510489511,
"alnum_prop": 0.6405981610589068,
"repo_name": "mrname/haralyzer",
"id": "c1ee06c2e4469c810cd8d6a217951314ca3b51c9",
"size": "989... |
from rest_framework.generics import RetrieveUpdateDestroyAPIView, ListCreateAPIView
from rest_framework.response import Response
from django.utils.encoding import iri_to_uri
class JSONRootSingleModelView(RetrieveUpdateDestroyAPIView):
'''
allows GET, PUT, and DELETE
GET returns a single instance of the view's mo... | {
"content_hash": "3e4b6260f60d799321e2dd062859e44c",
"timestamp": "",
"source": "github",
"line_count": 46,
"max_line_length": 83,
"avg_line_length": 43.58695652173913,
"alnum_prop": 0.7301745635910224,
"repo_name": "4South/django-on-fire",
"id": "69f872929d8e935ce4048fd3667cf75df2eb1686",
"size": ... |
from rest_framework.routers import DefaultRouter
from . import views
router = DefaultRouter()
router.register(r'protonflux', views.ProtonfluxViewSet)
router.register(r'electronflux', views.ElectronfluxViewSet)
router.register(r'xrayflux', views.XrayfluxViewSet)
router.register(r'sunspot', views.SunspotViewSet)
route... | {
"content_hash": "38a0331a4601cb1ff909ef7083c5299a",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 72,
"avg_line_length": 48.30769230769231,
"alnum_prop": 0.8407643312101911,
"repo_name": "diacritica/spaceweather",
"id": "91590446ec8873656b91f5515ca53fb1efa51fae",
"size"... |
import py
from rpython.jit.metainterp.history import ConstInt, INT, FLOAT
from rpython.jit.backend.llsupport.regalloc import FrameManager, LinkedList
from rpython.jit.backend.llsupport.regalloc import RegisterManager as BaseRegMan
from rpython.jit.metainterp.resoperation import InputArgInt, InputArgRef,\
InputArgF... | {
"content_hash": "104b09c0841b448a2d3d8ad983d60447",
"timestamp": "",
"source": "github",
"line_count": 570,
"max_line_length": 92,
"avg_line_length": 33.52982456140351,
"alnum_prop": 0.5444746755964839,
"repo_name": "jptomo/rpython-lang-scheme",
"id": "297dc2a32713b8b60eaaa62b7c3e70adb5832671",
"s... |
import datetime
import time
import redis
import logging
import functools
from django_sockjs_server.lib.config import SockJSServerSettings
def reconnect_wrapper(func):
@functools.wraps(func)
def myfunc(self, *args, **kwargs):
while True:
try:
return func(self, *args, **kwargs... | {
"content_hash": "c070b3410eb40fe74f41a35ff486d7db",
"timestamp": "",
"source": "github",
"line_count": 80,
"max_line_length": 100,
"avg_line_length": 33.5875,
"alnum_prop": 0.5723855601042054,
"repo_name": "alfss/django-sockjs-server",
"id": "26bb83292806da9f91fcbf9104353d44f7d566f4",
"size": "268... |
import unittest
from wikisync.plugin import WikiSyncEnvironment
from wikisync.model import WikiSyncDao
from trac.test import EnvironmentStub
from pkg_resources import resource_filename
class WikiSyncModelTestCase(unittest.TestCase):
def setUp(self):
self.env = EnvironmentStub()
self.plugin = WikiS... | {
"content_hash": "c338933a617957980bae0ed946dfb889",
"timestamp": "",
"source": "github",
"line_count": 84,
"max_line_length": 89,
"avg_line_length": 33.083333333333336,
"alnum_prop": 0.5851025548758546,
"repo_name": "ivanchoo/TracWikiSync",
"id": "e4dfc0f3d19610f5103375517d67181e79c50dad",
"size":... |
import unittest
import jmespath
from parameterized import parameterized
from tests.charts.helm_template_generator import render_chart
class IngressWebTest(unittest.TestCase):
def test_should_pass_validation_with_just_ingress_enabled_v1(self):
render_chart(
values={"ingress": {"web": {"enable... | {
"content_hash": "31d04cc5b5b5d46b146522da26de8122",
"timestamp": "",
"source": "github",
"line_count": 137,
"max_line_length": 107,
"avg_line_length": 40.78832116788321,
"alnum_prop": 0.4808518253400143,
"repo_name": "danielvdende/incubator-airflow",
"id": "93b51e44dc8f19e7db93f68dbd881d874a924830",... |
from rest_framework import serializers
from .models import Post
class PostSerializers(serializers.HyperlinkedModelSerializer):
class Meta:
model = Post
fields = ('url', 'title', 'content', 'timestamp', 'updated', 'media_url', 'user')
| {
"content_hash": "da0c0bc3e2d61ef1973bc39df141a8a3",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 89,
"avg_line_length": 36.42857142857143,
"alnum_prop": 0.6980392156862745,
"repo_name": "divyamodi128/django_comments",
"id": "2322d04b7d9cd5b7a22c2c5733274bc784a0ffd6",
"s... |
"""This is the Volume Slicer Actor, to visualize a 3D volumetric image
of the head as slices.
Copyright (c) 2012-2014, Emanuele Olivetti and Eleftherios Garyfallidis
Distributed under the BSD 3-clause license. See COPYING.txt.
"""
import numpy as np
from fos import Window, Scene
from fos.actor.slicer import Slicer
fr... | {
"content_hash": "3b4b2988e3bc5e3245d19a580e76bb71",
"timestamp": "",
"source": "github",
"line_count": 214,
"max_line_length": 82,
"avg_line_length": 28.50467289719626,
"alnum_prop": 0.5042622950819672,
"repo_name": "Paolopost/tractome",
"id": "01a7d7abbde5fd3e60d6c1d871d980f09ba787ff",
"size": "6... |
from robofab.world import CurrentFont,AllFonts,CurrentGlyph
fonts=AllFonts()
forigen=CurrentFont()
sel=forigen.selection
def copiaWidth(myWidth,gtarget):
anchoFinal=gtarget.width
anchoActual=myWidth
anchoDif=anchoActual-anchoFinal
anchoSide=anchoDif/2
gtarget.leftMargin=gtarget.leftMargin+anchoSide
gtarget.right... | {
"content_hash": "637d58c02da64e975bc1f11f1d13f769",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 59,
"avg_line_length": 20.155172413793103,
"alnum_prop": 0.7279726261762189,
"repo_name": "huertatipografica/huertatipografica-fl-scripts",
"id": "18340268ff0e36b14ffbae9fa7f... |
import unittest
import json
from data_migrator.emitters.base import BaseEmitter
from data_migrator.emitters import CSVEmitter, JSONEmitter
from data_migrator.emitters import MySQLEmitter, UpdateEmitter
from data_migrator.models import Model, StringField
from data_migrator.exceptions import DefinitionException
class E... | {
"content_hash": "55154db68417adbb746e7f0b37dd7048",
"timestamp": "",
"source": "github",
"line_count": 92,
"max_line_length": 112,
"avg_line_length": 37.31521739130435,
"alnum_prop": 0.6562773084765511,
"repo_name": "schubergphilis/data-migrator",
"id": "c9dd65b07a8325c6c0d3c087b33a238b06162ffa",
... |
import hmac
import os
import re
import jinja2
template_dir = os.path.join(os.path.dirname(__file__), 'templates')
jinja_env = jinja2.Environment(loader=jinja2.FileSystemLoader(template_dir),
autoescape=True)
secret = "OhCanada"
def jinja_render_str(template, **params):
t = jinja_... | {
"content_hash": "dbf4f575e4822f6f844fefe5035547ec",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 76,
"avg_line_length": 20.48936170212766,
"alnum_prop": 0.6469366562824507,
"repo_name": "vincentwang901130/Multi-User-Blog",
"id": "4ffca03f136961d2f8a4a02ff3054e1e96a739e7"... |
import pytest
import time
import os
from contextlib import contextmanager
from .test_base_class import TestBaseClass
test_memleak = int(os.environ.get("TEST_MEMLEAK", 0))
if test_memleak != 1:
if pytest.__version__ < "3.0.0":
pytest.skip("Skip memleak tests")
else:
pytestmark = pytest.mark.ski... | {
"content_hash": "1ba8183ec0aec04ef5889f8aaa93e769",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 92,
"avg_line_length": 29.22641509433962,
"alnum_prop": 0.6371852808263396,
"repo_name": "aerospike/aerospike-client-python",
"id": "59d6781618fbfd73d9dc6705fd9cd6e29ce7cc2c"... |
"""
This is the main ``urlconf`` for Mezzanine - it sets up patterns for
all the various Mezzanine apps, third-party apps like Grappelli and
filebrowser.
"""
from __future__ import unicode_literals
from future.builtins import str
from django.conf.urls import include, url
from django.contrib.sitemaps.views import site... | {
"content_hash": "37002b7fbf069d81c432833fb5a21306",
"timestamp": "",
"source": "github",
"line_count": 90,
"max_line_length": 80,
"avg_line_length": 32.72222222222222,
"alnum_prop": 0.6553480475382003,
"repo_name": "viaregio/mezzanine",
"id": "b6685160f6e7cd9e164d9e9b45bfbdad8e9d57be",
"size": "29... |
import django
from django.core.urlresolvers import reverse
from django.forms import widgets
from django import http
from django.test.utils import override_settings
from mox3.mox import IsA # noqa
import six
from openstack_dashboard import api
from openstack_dashboard.api import cinder
from openstack_dashboard.dashbo... | {
"content_hash": "5f3526f9522873a0ad0abd9bebcdf225",
"timestamp": "",
"source": "github",
"line_count": 1585,
"max_line_length": 79,
"avg_line_length": 44.333753943217665,
"alnum_prop": 0.528355320269251,
"repo_name": "damien-dg/horizon",
"id": "6972ed4f41954489d2f1fee199a9720ceb6631ec",
"size": "7... |
from discord.ext import commands
import discord
from ext_module import ExtModule
from ext_module import PmForbidden
class AdminCog:
"""This cog contains commands that can be used by the bots admin(s).
This will not contain commands, which ban and kick a user or let the bot behave as a server admin.
"""
... | {
"content_hash": "4522c5bf921f12a895c42aea583b88f6",
"timestamp": "",
"source": "github",
"line_count": 169,
"max_line_length": 126,
"avg_line_length": 48.1301775147929,
"alnum_prop": 0.5906073272682567,
"repo_name": "JonSnowWhite/discord-soundboard-bot",
"id": "c9f4d06b0cdb0ac4b5eb620146fe1e91f72751... |
from enum import Enum
class TierType(Enum):
consumption = "Consumption"
commitment_100_au_hours = "Commitment_100AUHours"
commitment_500_au_hours = "Commitment_500AUHours"
commitment_1000_au_hours = "Commitment_1000AUHours"
commitment_5000_au_hours = "Commitment_5000AUHours"
commitment_10000_... | {
"content_hash": "e4dc6ba1f0fc365ba1cf150cdb738cd0",
"timestamp": "",
"source": "github",
"line_count": 70,
"max_line_length": 59,
"avg_line_length": 21.785714285714285,
"alnum_prop": 0.6904918032786885,
"repo_name": "AutorestCI/azure-sdk-for-python",
"id": "a69cfaa147fc05df7a3f1f59be95dbab7cd3b583",... |
from datetime import datetime
from django.utils import timezone
TIME_FORMAT_STRING = '%Y-%m%d-%H%M'
def get_datetime_string_for_file():
"""Get datetime string for file naming"""
return timezone.now().strftime(TIME_FORMAT_STRING)
def get_last_microsecond():
"""Used as a url param to clear any caching"""
... | {
"content_hash": "9cad593982ecbf6cb889743a313e2eb0",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 54,
"avg_line_length": 30.9375,
"alnum_prop": 0.701010101010101,
"repo_name": "IQSS/geoconnect",
"id": "414ebae8bf4c395dfebec480ecda3fbfcdcb1302",
"size": "495",
"binary"... |
ModuleName = "fibaro_motion_sensor"
BATTERY_CHECK_INTERVAL = 10800 # How often to check battery (secs) = 3 hours
SENSOR_POLL_INTERVAL = 600 # How often to request sensor values = 10 mins
TIME_CUTOFF = 1800 # Data older than this is considered "stale"
import sys
import... | {
"content_hash": "d5547133fb3858b4b9ee9bbe4974b4c8",
"timestamp": "",
"source": "github",
"line_count": 312,
"max_line_length": 136,
"avg_line_length": 43.54807692307692,
"alnum_prop": 0.4678001030396703,
"repo_name": "ContinuumBridge/fibaro_motion_sensor",
"id": "5d92a16869535f953041467445381ba97e9b... |
"""
Shared utility functions which are not specific to any particular module.
"""
from __future__ import absolute_import
import contextlib
import copy
import inspect
import sys
from functools import wraps
import packaging.version
import six
from .environment import MYPY_RUNNING
# format: off
six.add_move(
six.M... | {
"content_hash": "19d25798f47c791a117ef6daca1e02d0",
"timestamp": "",
"source": "github",
"line_count": 464,
"max_line_length": 92,
"avg_line_length": 32.16594827586207,
"alnum_prop": 0.6308877721943048,
"repo_name": "kennethreitz/pipenv",
"id": "162b4a20e0a85d597eaf555dd9fbec9e2eb7c8a5",
"size": "... |
"""Setup script for the Google Ads Python Client Library."""
import os
import re
import sys
from setuptools import setup
PACKAGES = ['googleads']
DEPENDENCIES = ['google-auth>=2.0.0,<3.0.0',
'google-auth-oauthlib>=0.0.1,<1.0.0', 'pytz>=2015.7',
'PyYAML>=6.0, <7.0', 'requests>=2.0.0,<... | {
"content_hash": "42c54efa2b880f1fb2d8071c6d1b4a85",
"timestamp": "",
"source": "github",
"line_count": 100,
"max_line_length": 79,
"avg_line_length": 28.32,
"alnum_prop": 0.6627824858757062,
"repo_name": "googleads/googleads-python-lib",
"id": "b37fe53d3ba886b9d81d6aea89225f3b299a5527",
"size": "3... |
from ip_proxy.connection.redis_connection import redisDb1
from ip_proxy.connection.mysql_connection import mysqlAsyn
from ip_proxy.config import QUEUE_NUM, QUEUE_KEY
import traceback
from ip_proxy.utils.log import Log
import time
class IpQueue(object):
def __init__(self):
self.redis = redisDb1.conn
... | {
"content_hash": "7507697bf04010d76777429cdb39c5c8",
"timestamp": "",
"source": "github",
"line_count": 73,
"max_line_length": 193,
"avg_line_length": 36.273972602739725,
"alnum_prop": 0.5083081570996979,
"repo_name": "owlsn/h_crawl",
"id": "dff31b0031a1a50b2ff736ce8546832ca114ff32",
"size": "2834"... |
import gym
from TabularQLearner import *
#
#
if __name__ == "__main__":
# ----------------------------------------
# Define parameters for e-Greedy policy
epsilon = 1.0 # exploration
epsilon_floor = 0.1
exploration_decay = 0.995
# Define parameters for Q-learning
alpha = 0.2
gamma = 0.... | {
"content_hash": "0193b3f65c984c4dceb066e9379fd7e6",
"timestamp": "",
"source": "github",
"line_count": 82,
"max_line_length": 97,
"avg_line_length": 28.5609756097561,
"alnum_prop": 0.4743808710503843,
"repo_name": "dganbold/reinforcement_learning",
"id": "8a93a098dddc193fcf6eb5e239d2dee87fcedbae",
... |
import functools
from oslo_log import log as logging
from oslo_utils import excutils
from neutron.agent.linux import ip_lib
LOG = logging.getLogger(__name__)
NS_PREFIX = 'qrouter-'
INTERNAL_DEV_PREFIX = 'qr-'
EXTERNAL_DEV_PREFIX = 'qg-'
# TODO(Carl) It is odd that this file needs this. It is a dvr detail.
ROUTER_2... | {
"content_hash": "cefa463c42db220d78b7c13745891467",
"timestamp": "",
"source": "github",
"line_count": 135,
"max_line_length": 76,
"avg_line_length": 33.84444444444444,
"alnum_prop": 0.5898446049463778,
"repo_name": "noironetworks/neutron",
"id": "58b0deb60750e3bbd2c2cc5c78c83b0a464d6efb",
"size":... |
from __future__ import unicode_literals, absolute_import
from django.conf.urls import patterns, include, url
from django.conf.urls.i18n import i18n_patterns
from django.contrib import admin
from django.views.generic import RedirectView
from mezzanine.core.views import direct_to_template
from mezzanine.conf import set... | {
"content_hash": "a8a24b5e5016df8a961c825dc9f644fd",
"timestamp": "",
"source": "github",
"line_count": 121,
"max_line_length": 76,
"avg_line_length": 40.760330578512395,
"alnum_prop": 0.6559205190592052,
"repo_name": "JeffHeard/terrapyn_project",
"id": "57d53176e3e6177de008af9e0687a6f5de65c742",
"... |
from __future__ import unicode_literals
from django.conf.urls import patterns, url, include
from djspikeval import views
__author__ = "pmeier82"
patterns_algorithm = patterns(
"",
url(r"^$", views.AlgorithmList.as_view(), name="list"),
url(r"^create/$", views.AlgorithmCreate.as_view(), name="create"),
... | {
"content_hash": "156e81385a4745446ea896495ea26f06",
"timestamp": "",
"source": "github",
"line_count": 59,
"max_line_length": 88,
"avg_line_length": 47.28813559322034,
"alnum_prop": 0.6157706093189964,
"repo_name": "pmeier82/django-spikeval",
"id": "a79a0e270f2acc20dfadaa54c1f9b72e1efc6ed6",
"size... |
import boto.sqs
import boto.sqs.queue
from boto.sqs.message import Message
from boto.sqs.connection import SQSConnection
from boto.exception import SQSError
import sys
import urllib2
p1='username'
p2='userpass'
url='http://ec2-52-30-7-5.eu-west-1.compute.amazonaws.com:81/key'
# Get the keys from a specific url and t... | {
"content_hash": "079c676c62e0b7b44a5474a27ec0ae9f",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 120,
"avg_line_length": 29.444444444444443,
"alnum_prop": 0.7415094339622641,
"repo_name": "krnan9525/Lab11",
"id": "3e301e1e4549608019b3520a8747eaf12bd0764e",
"size": "112... |
"""Tests for Ranking."""
import itertools
import math
from typing import List, Dict
from absl.testing import parameterized
import tensorflow as tf
import tensorflow_recommenders as tfrs
def _get_tpu_embedding_feature_config(
vocab_sizes: List[int],
embedding_dim: int,
table_name_prefix: str = "embedd... | {
"content_hash": "f34a220afaf8cfaff01cf224167a68d8",
"timestamp": "",
"source": "github",
"line_count": 159,
"max_line_length": 80,
"avg_line_length": 31.9874213836478,
"alnum_prop": 0.6189539913488006,
"repo_name": "tensorflow/recommenders",
"id": "64be9c74ab742cb46f5d678e4d6bea2e0da9f533",
"size"... |
import pandas as pd
import numpy as np
# If you'd like to try this lab with PCA instead of Isomap,
# as the dimensionality reduction technique:
Test_PCA = True
def plotDecisionBoundary(model, X, y):
print("Plotting...")
import matplotlib.pyplot as plt
import matplotlib
matplotlib.style.use('ggplot') # Look P... | {
"content_hash": "25982a10491513c49ea0b2334649c8a4",
"timestamp": "",
"source": "github",
"line_count": 187,
"max_line_length": 189,
"avg_line_length": 31.053475935828878,
"alnum_prop": 0.7094885483037713,
"repo_name": "sly-ninja/python_for_ml",
"id": "b1e70432353ee2496b9f46650daedd5a32a8da64",
"si... |
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('MASTER', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='Dusun',
fields=[
('id', models.Auto... | {
"content_hash": "5b969937d9cc821710f0d2be8ee6a66b",
"timestamp": "",
"source": "github",
"line_count": 54,
"max_line_length": 114,
"avg_line_length": 35.111111111111114,
"alnum_prop": 0.5416666666666666,
"repo_name": "ThinkBuntu/rembugdesa",
"id": "8f5223532b6e6c09835c59b95361ae43bb412ab0",
"size"... |
import pytest
import uuid
from flask import json, url_for
from app.models import Article, DRAFT, READY
from tests.conftest import create_authorization_header
from tests.db import create_article
sample_articles = [
{
"id": "1",
"title": "Forty Years Fighting Racism and Intolerance",
"aut... | {
"content_hash": "a68c322a7ebf0d238e24e7dcab3040b9",
"timestamp": "",
"source": "github",
"line_count": 221,
"max_line_length": 119,
"avg_line_length": 38.14027149321267,
"alnum_prop": 0.6024439435282952,
"repo_name": "NewAcropolis/api",
"id": "1531ace8a0377772537206fbe7291d2d289844f0",
"size": "84... |
import _plotly_utils.basevalidators
class TokenValidator(_plotly_utils.basevalidators.StringValidator):
def __init__(self, plotly_name="token", parent_name="funnelarea.stream", **kwargs):
super(TokenValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
... | {
"content_hash": "470e0da081e58dbbc1fc58981222a1b0",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 87,
"avg_line_length": 38.785714285714285,
"alnum_prop": 0.5948434622467772,
"repo_name": "plotly/python-api",
"id": "8fafb636323f2cff6c86694012e5806fd894ff57",
"size": "54... |
__author__ = 'jt'
import random
def randomID():
return ''.join(random.choice('0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz') for i in range(15))
| {
"content_hash": "41da58a154f367dbdee491fc67472bac",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 118,
"avg_line_length": 33.6,
"alnum_prop": 0.7619047619047619,
"repo_name": "jtmuyl/mass-cropper-for-cv",
"id": "06994ff82b255e0c0729b4c2bcca083bf2f332c8",
"size": "233",
... |
from __future__ import unicode_literals
from django.core import exceptions
from django.conf import settings
import logging
import warnings
from .models import ReloadRulesRequest
from .restrictor import IPRestrictor
try:
from django.utils.deprecation import MiddlewareMixin
except ImportError:
class MiddlewareMi... | {
"content_hash": "0689e4ef9bb9da4e310640ba9f36583c",
"timestamp": "",
"source": "github",
"line_count": 94,
"max_line_length": 116,
"avg_line_length": 38.62765957446808,
"alnum_prop": 0.6438997521343982,
"repo_name": "muccg/django-iprestrict",
"id": "4882c918efb1f155fca528e2c2cb37b75369399f",
"size... |
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
from olympia import amo
from olympia.amo.fields import PositiveAutoField
from olympia.amo.models import ModelBase
@python_2_unicode_compatible
class DiscoveryModule(ModelBase):
"""
Keeps the application, ordering, and ... | {
"content_hash": "54176a2d4fcfa4e457a5c928f5edb72a",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 77,
"avg_line_length": 34.62068965517241,
"alnum_prop": 0.6872509960159362,
"repo_name": "aviarypl/mozilla-l10n-addons-server",
"id": "3c7698a33cadfdc4f4ce689e344e2055febc9ce... |
from browserplus import BrowserPlus, __version__
| {
"content_hash": "560731409339b7911d232040639ccb75",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 48,
"avg_line_length": 49,
"alnum_prop": 0.7959183673469388,
"repo_name": "xujun10110/browserplus",
"id": "d092f9cddc4e9740519ad6905179aeb38c111ab8",
"size": "49",
"binary... |
"""Base class for MOMA initializers that return a boolean indicating success."""
import abc
from typing import Any
from dm_control import composer
class Initializer(composer.Initializer):
"""Composer initializer that returns whether it was successful."""
@abc.abstractmethod
def __call__(self, physics: Any, ra... | {
"content_hash": "02e7c1e00ad76de9e02afd23f25f813e",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 80,
"avg_line_length": 29.235294117647058,
"alnum_prop": 0.7344064386317908,
"repo_name": "deepmind/dm_robotics",
"id": "7545a37bf38f5d125b4c626d580b387147611285",
"size": ... |
"""Presubmit script for //build/skia_gold_common/.
See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts
for more details on the presubmit API built into depot_tools.
"""
def CommonChecks(input_api, output_api):
output = []
build_path = input_api.os_path.join(input_api.PresubmitLocalPath(),... | {
"content_hash": "dfdc892636acab40f7ef162c9735752c",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 75,
"avg_line_length": 30.967741935483872,
"alnum_prop": 0.7,
"repo_name": "youtube/cobalt_sandbox",
"id": "41e1bb2f7dee69fa912b16468ca6e2b73b5151d2",
"size": "1122",
"bi... |
"""
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this ... | {
"content_hash": "2b72f6cc0471938e9cf6c53450f917df",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 79,
"avg_line_length": 32.85,
"alnum_prop": 0.7245053272450532,
"repo_name": "zouzhberk/ambaridemo",
"id": "cc7b4cc14eb0a01ca7c33bb904b588199e268907",
"size": "1336",
"bi... |
import json
import os
import requests
from requests_toolbelt import MultipartEncoder
from .errors import *
from .converter import convert_html_to_telegraph_format, convert_json_to_html, OutputFormat
base_url = 'http://telegra.ph'
save_url = 'https://edit.telegra.ph/save'
api_url = 'https://api.telegra.ph'
default_user... | {
"content_hash": "b8e07b11281b5161deca9d55a6215ddf",
"timestamp": "",
"source": "github",
"line_count": 318,
"max_line_length": 130,
"avg_line_length": 41.55345911949686,
"alnum_prop": 0.6157862872710761,
"repo_name": "mercuree/html-telegraph-poster",
"id": "04e9369a1738c684c428209958127b91d3a50e73",... |
import ctypes
import numpy
from ..utils.c import load_library
double1d = ctypes.POINTER(ctypes.c_double)
class RecurrentNeuralNetwork(ctypes.Structure):
_fields_ = [
("dim", ctypes.c_int),
("steps", ctypes.c_int),
("m", double1d),
("x", double1d),
]
class Simulator:
... | {
"content_hash": "3366b739f23317e7da602013a03424d2",
"timestamp": "",
"source": "github",
"line_count": 51,
"max_line_length": 64,
"avg_line_length": 24.607843137254903,
"alnum_prop": 0.5936254980079682,
"repo_name": "tkf/comparatist",
"id": "68b6edf46eb5eafe00afc78e8bb4b420766af51f",
"size": "1255... |
import PythonQt
from PythonQt import QtCore, QtGui
import director.objectmodel as om
import director.visualization as vis
from director import affordanceitems
from director import lcmUtils
from director import callbacks
from director import cameracontrol
from director import splinewidget
from director import transformU... | {
"content_hash": "2352c850732f7f8b8693f6303668b0dc",
"timestamp": "",
"source": "github",
"line_count": 671,
"max_line_length": 152,
"avg_line_length": 33.58718330849479,
"alnum_prop": 0.6664152282912544,
"repo_name": "RobotLocomotion/director",
"id": "565635e1a04a92399568374c9d3cd156b6a07028",
"si... |
import argparse
import re
import struct
import subprocess
def get_output_name(hotfix, output):
if output:
return output
elif hotfix.endswith('.so'):
return hotfix[:-3] + '.hfx'
else:
return hotfix + '.hfx'
def get_raw_symbols(file_name):
process = subprocess.Popen(['nm', file... | {
"content_hash": "7ec82714b2d9a6379feec83aa3f9e10a",
"timestamp": "",
"source": "github",
"line_count": 87,
"max_line_length": 84,
"avg_line_length": 26.79310344827586,
"alnum_prop": 0.6327756327756328,
"repo_name": "pdziepak/lbp",
"id": "182abe8552fb9df7985822cf90e4540e64b5d2d0",
"size": "3452",
... |
"""
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this ... | {
"content_hash": "8c58ccb4f6dc53eb23715a1acd86c365",
"timestamp": "",
"source": "github",
"line_count": 87,
"max_line_length": 94,
"avg_line_length": 26.655172413793103,
"alnum_prop": 0.709357481673135,
"repo_name": "keedio/keedio-stacks",
"id": "e6ee5bf0fc37f48396ca16124b1868e9452e5b57",
"size": "... |
import datetime
import http.client
import mock
from typing import Collection
from rdr_service.dao.participant_summary_dao import ParticipantSummaryDao
from rdr_service.model.utils import from_client_participant_id
from rdr_service.clock import FakeClock
from rdr_service.code_constants import CONSENT_PERMISSION_YES_COD... | {
"content_hash": "91176fadd130c5b914b97360d0f584d8",
"timestamp": "",
"source": "github",
"line_count": 813,
"max_line_length": 119,
"avg_line_length": 45.31488314883149,
"alnum_prop": 0.6261773567492739,
"repo_name": "all-of-us/raw-data-repository",
"id": "b71eea372365e8c3df9f9dec0572dc84b9a22587",
... |
import logging
from bookie import app_generator
LOGGER = logging.getLogger(__name__)
LOGGER.setLevel(logging.INFO)
app = app_generator.create_app() # pylint: disable=invalid-name
if __name__ == '__main__':
# This is used when running locally. Gunicorn is used to run the
# application on Google App Engine... | {
"content_hash": "b22937205033c5ccec0753ebb1ce02f6",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 68,
"avg_line_length": 25.6875,
"alnum_prop": 0.6934306569343066,
"repo_name": "JasonMWhite/bookie",
"id": "1a8ae3fa951fc18a4b87210d1f38a29064e4fd79",
"size": "411",
"bin... |
ANSIBLE_METADATA = {'status': 'preview',
'supported_by': 'community',
'version': '1.0'}
DOCUMENTATION = '''
---
module: ipinfoio_facts
short_description: "Retrieve IP geolocation facts of a host's IP address"
description:
- "Gather IP geolocation facts of a host's IP address u... | {
"content_hash": "982a450b26d2a3e418588ba2b80a67ae",
"timestamp": "",
"source": "github",
"line_count": 122,
"max_line_length": 77,
"avg_line_length": 27.39344262295082,
"alnum_prop": 0.5951526032315978,
"repo_name": "nwiizo/workspace_2017",
"id": "748c49dcc9ae45317b6d8e464b462d19eaaa2a7e",
"size":... |
#!/usr/bin/python
# @lint-avoid-python-3-compatibility-imports
#
# tcplife Trace the lifespan of TCP sessions and summarize.
# For Linux, uses BCC, BPF. Embedded C.
#
# USAGE: tcplife [-h] [-C] [-S] [-p PID] [interval [count]]
#
# This uses dynamic tracing of kernel functions, and will need to be updated
# ... | {
"content_hash": "ebdd0aedeb13c04bcc824c278bf38a00",
"timestamp": "",
"source": "github",
"line_count": 360,
"max_line_length": 79,
"avg_line_length": 33.31666666666667,
"alnum_prop": 0.583791895947974,
"repo_name": "shodoco/bcc",
"id": "490e56860e29466edb2640b294a8cdd8e111a625",
"size": "11994",
... |
from raspledstrip.ledstrip import *
from raspledstrip.animation import *
from raspledstrip.color import Color
import os
import requests
import json
import time
import traceback
class Lumiere:
"""
Class to handle getting light information.
"""
def __init__(self):
"""
Constructor. Read settings if the... | {
"content_hash": "2a1b4961f173a611ca4b504e868189b0",
"timestamp": "",
"source": "github",
"line_count": 107,
"max_line_length": 98,
"avg_line_length": 23.934579439252335,
"alnum_prop": 0.6114798906677079,
"repo_name": "lumiere-lighting/lumiere-node-raspberry-pi",
"id": "04233262aab8e4fb07ce7da1b51952... |
"""
The :mod:`sklearn.model_selection._search` includes utilities to fine-tune the
parameters of an estimator.
"""
# Author: Alexandre Gramfort <alexandre.gramfort@inria.fr>,
# Gael Varoquaux <gael.varoquaux@normalesup.org>
# Andreas Mueller <amueller@ais.uni-bonn.de>
# Olivier Grisel <olivier.... | {
"content_hash": "ee28aae436821026e2d85c7d3e412607",
"timestamp": "",
"source": "github",
"line_count": 1558,
"max_line_length": 82,
"avg_line_length": 41.353658536585364,
"alnum_prop": 0.577364230393146,
"repo_name": "bnaul/scikit-learn",
"id": "efc230ac080f28163cb0a699180d136e851e4e3b",
"size": "... |
import numpy as np
from echometrics import *
from fixtures import data, make_simple_data
from nose import with_setup
def test_calc_metrics():
file = 'data/Sept17_DVM_int_cope38.csv'
echo = read_flat(file, ['Lat_M', 'Lon_M'], 'Layer', 'Sv_mean')
metrics_list = [depth_integral, sv_avg, center_of_mass, propor... | {
"content_hash": "194c8ae97f35dd2ae386196ffed35ef9",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 80,
"avg_line_length": 41.733333333333334,
"alnum_prop": 0.6853035143769968,
"repo_name": "ElOceanografo/EchoMetrics",
"id": "8681a9a75756ceb77e7caf66edcd01c7843cb8c5",
"si... |
from django.contrib.auth.models import User
from django.contrib.auth.forms import UserCreationForm
class RegisterForm(UserCreationForm):
class Meta:
model = User
fields = ('username', 'email', 'password1', 'password2')
| {
"content_hash": "9f4a50d6b02a93f006ccdfaa6bc04d4c",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 64,
"avg_line_length": 30.125,
"alnum_prop": 0.7178423236514523,
"repo_name": "Crypt1k/Blog",
"id": "2594350a6f06eb0b7b087004b2f89d8bee9b5440",
"size": "241",
"binary": fa... |
""" basecontroller.py - Classes to handle CRUD form for a model.
$Id: basecontroller.py 186 2011-05-28 06:19:05Z ats $
"""
__author__ = 'Atsushi Shibata <shibata@webcore.co.jp>'
__docformat__ = 'plaintext'
__licence__ = 'BSD'
import os
import new
import re
import logging
from urlparse import urlsplit
from Cookie im... | {
"content_hash": "6729ba978011e7933fea0aad07995e27",
"timestamp": "",
"source": "github",
"line_count": 278,
"max_line_length": 80,
"avg_line_length": 34.49640287769784,
"alnum_prop": 0.5481751824817518,
"repo_name": "Letractively/aha-gae",
"id": "c140fc522f89bb6c76925cc0fe56bdde12c9e284",
"size": ... |
import os
import sys
from setuptools import setup, find_packages, Extension
import numpy as np
import direfl
packages = ['direfl']
if len(sys.argv) == 1:
sys.argv.append('install')
# reflmodule extension
if sys.platform == "darwin":
# Python is not finding C++ headers on Mac unless the
# minimum OSX v... | {
"content_hash": "80ce6f9e5a5869a8beb22354f4ee280a",
"timestamp": "",
"source": "github",
"line_count": 73,
"max_line_length": 71,
"avg_line_length": 36.273972602739725,
"alnum_prop": 0.6333081570996979,
"repo_name": "reflectometry/direfl",
"id": "f8c54256665224bc8bdbf65ec25ce23e7b9dce30",
"size": ... |
"""Site services for use with a Web Site Process Bus."""
import os
import re
import signal as _signal
import sys
import time
import threading
import _thread
from cherrypy._cpcompat import text_or_bytes
from cherrypy._cpcompat import ntob
# _module__file__base is used by Autoreload to make
# absolute any filenames re... | {
"content_hash": "268bd28adadb6637ab2a6a8ec237a1de",
"timestamp": "",
"source": "github",
"line_count": 755,
"max_line_length": 79,
"avg_line_length": 35.557615894039735,
"alnum_prop": 0.5768084630857483,
"repo_name": "cherrypy/cherrypy",
"id": "e96fb1ce2a7f732b1f0c3d1431c521c33fc2d675",
"size": "2... |
"""Test Hierarchical Deterministic wallet function."""
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import (
assert_equal,
connect_nodes_bi,
)
import shutil
import os
class WalletHDTest(BitcoinTestFramework):
def set_test_params(self):
self.setup_clean_ch... | {
"content_hash": "e4f6827d75c8af4b8f863a1b55f85480",
"timestamp": "",
"source": "github",
"line_count": 118,
"max_line_length": 113,
"avg_line_length": 42.26271186440678,
"alnum_prop": 0.6174052536595147,
"repo_name": "ppcoin/ppcoin",
"id": "9f0e9acb47768ac58601a17d677f30a7d376edaa",
"size": "5201"... |
import os
import shutil
import zipfile
import tarfile
import natsort
import tempfile
from codecs import open
from . import util
DEFAULT_PROJECT_DESCRIPTION = 'No project description'
def sort_by_version(x):
# See http://natsort.readthedocs.io/en/stable/examples.html
return x['version'].replace('.', '~') + ... | {
"content_hash": "028e08e9f850d68cecf0627a3dc6b312",
"timestamp": "",
"source": "github",
"line_count": 193,
"max_line_length": 106,
"avg_line_length": 32.55958549222798,
"alnum_prop": 0.6441756842775302,
"repo_name": "rgalanakis/hostthedocs",
"id": "8105baf46f7b68c4276c358ec7b3657936273d43",
"size... |
import sys
import os
import registry_xml
template_gl_enums_header = """// GENERATED FILE - DO NOT EDIT.
// Generated by {script_name} using data from {data_source_name}.
//
// Copyright 2019 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// fo... | {
"content_hash": "332cfb6f04242d18966445f70f0039b3",
"timestamp": "",
"source": "github",
"line_count": 225,
"max_line_length": 99,
"avg_line_length": 33.66222222222222,
"alnum_prop": 0.6279376815421178,
"repo_name": "ppy/angle",
"id": "f849a7252b4d7242c80a76b8b412b794ae4226f2",
"size": "7922",
"... |
import base64
import collections
import json
from contextlib import nested
import mock
import os
import random
import string
import zipfile
import re
import unittest
from click.exceptions import ClickException
from lambda_packages import lambda_packages
from .utils import placebo_session, patch_open
from zappa.cli ... | {
"content_hash": "4ddb2355bf93c9d8c171a5cc44f128ee",
"timestamp": "",
"source": "github",
"line_count": 383,
"max_line_length": 245,
"avg_line_length": 38.6266318537859,
"alnum_prop": 0.5431255914559957,
"repo_name": "parroyo/Zappa",
"id": "d83e3ed1ccbf99dc009c70cac0e5c99bbe87957e",
"size": "14817"... |
""" Tutorial for chi.model
----------------------
This is how we can use python functions to define models
"""
import os
import chi
import tensorflow as tf
from tensorflow.contrib import layers # Keras-style layers
from tensorflow.contrib import learn
chi.set_loglevel('debug') # log whenever variables are cr... | {
"content_hash": "36f81a66d266229e184dcc470a5ea62c",
"timestamp": "",
"source": "github",
"line_count": 51,
"max_line_length": 84,
"avg_line_length": 32.450980392156865,
"alnum_prop": 0.7045317220543806,
"repo_name": "rmst/chi",
"id": "05a90a6a158017a36ad9dbff022aec1592672641",
"size": "1655",
"b... |
import django
from django.conf import settings
settings.configure(
DEBUG=True,
DATABASES={"default": {
"ENGINE": "django.db.backends.sqlite3",
"NAME": ":memory:"
}}
)
settings.INSTALLED_APPS += ("label_tag_attr", )
django.setup()
| {
"content_hash": "affa4667c5c7929a8cfb34135b204602",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 47,
"avg_line_length": 20,
"alnum_prop": 0.6346153846153846,
"repo_name": "c-bata/django-label-tag-attr",
"id": "f63d83da11bced8f8171a148857c3071971f973f",
"size": "260",
... |
from swgpy.object import *
def create(kernel):
result = Weapon()
result.template = "object/weapon/melee/2h_sword/crafted_saber/shared_sword_lightsaber_two_handed_s10.iff"
result.attribute_template_id = 10
result.stfName("weapon_name","sword_lightsaber_2h")
#### BEGIN MODIFICATIONS ####
#### END MODIFICATI... | {
"content_hash": "b94222fbae1eba496ecad8a43b2b32bb",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 106,
"avg_line_length": 26.615384615384617,
"alnum_prop": 0.7138728323699421,
"repo_name": "anhstudios/swganh",
"id": "b950edc92a4247cc04eab313092c2ae098cae41a",
"size": "4... |
import json
import requests
from uritemplate import URITemplate
from mapbox.services.base import Service
# Constants
BASE_URI = 'https://api.mapbox.com/datasets/v1'
class Datasets(Service):
"""Access to the Datasets API."""
baseuri = 'https://api.mapbox.com/datasets/v1'
def _attribs(self, name=None,... | {
"content_hash": "270f84f0a1ab2ce447b08e2251f0eb7a",
"timestamp": "",
"source": "github",
"line_count": 167,
"max_line_length": 77,
"avg_line_length": 35.041916167664674,
"alnum_prop": 0.6119275461380724,
"repo_name": "perrygeo/mapbox-sdk-py",
"id": "0c0e6e5d85dbc37f8b11c20c76cd8baa2a2c2ffd",
"size... |
from __future__ import absolute_import, division, print_function
from nacl._lib import lib
def randombytes(size):
"""
Returns ``size`` number of random bytes from a cryptographically secure
random source.
:param size: int
:rtype: bytes
"""
buf = lib.ffi.new("unsigned char[]", size)
l... | {
"content_hash": "26b58adb05cd4c19a3fd8166dd412a50",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 75,
"avg_line_length": 24.125,
"alnum_prop": 0.6606217616580311,
"repo_name": "scholarly/pynacl",
"id": "a28cd88130d69e10bee1dff0d914da17046b31da",
"size": "988",
"binary... |
import datetime
from django.contrib.admin import ModelAdmin
from django.contrib.admin.templatetags.admin_list import date_hierarchy
from django.contrib.admin.templatetags.admin_modify import submit_row
from django.contrib.auth.admin import UserAdmin
from django.contrib.auth.models import User
from django.test import R... | {
"content_hash": "e9d566b7f2be16a1c89e12fc9a3f204b",
"timestamp": "",
"source": "github",
"line_count": 130,
"max_line_length": 118,
"avg_line_length": 44.784615384615385,
"alnum_prop": 0.6228100309172105,
"repo_name": "georgemarshall/django",
"id": "f717b8e1b7a02ea373928b5f35b6948527803150",
"size... |
"""Tests for vcfio_header_io module."""
import collections
import os
import unittest
from pysam import libcbcf
import apache_beam as beam
from apache_beam.testing.util import assert_that
from apache_beam.testing.util import equal_to
import apache_beam.io.source_test_utils as source_test_utils
from apache_beam.testin... | {
"content_hash": "22fdb2a33314535af3fe8da4ad18fc19",
"timestamp": "",
"source": "github",
"line_count": 357,
"max_line_length": 80,
"avg_line_length": 41.15406162464986,
"alnum_prop": 0.6355839912877757,
"repo_name": "googlegenomics/gcp-variant-transforms",
"id": "05e8f91cf6f15c865752d253b6310e0b200b... |
import agate
from csvkit.cli import CSVKitUtility
class CSVPy(CSVKitUtility):
description = 'Load a CSV file into a CSV reader and then drop into a Python shell.'
def add_arguments(self):
self.argparser.add_argument('--dict', dest='as_dict', action='store_true',
h... | {
"content_hash": "b14579651a05d5c2defe8f00c9c9b292",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 125,
"avg_line_length": 34.82692307692308,
"alnum_prop": 0.5919381557150746,
"repo_name": "doganmeh/csvkit",
"id": "2d7802929be3aa776195f4f817f5eb0a6820777e",
"size": "1834... |
"""Matplotlib energyplot."""
import matplotlib.pyplot as plt
import numpy as np
from scipy.stats import rankdata
from ...plot_utils import _scale_fig_size
from . import backend_kwarg_defaults, backend_show, create_axes_grid, matplotlib_kwarg_dealiaser
def plot_ess(
ax,
plotters,
xdata,
ess_tail_datas... | {
"content_hash": "a0c84a41e6e780fb6954f22566bf66ea",
"timestamp": "",
"source": "github",
"line_count": 179,
"max_line_length": 100,
"avg_line_length": 35.927374301675975,
"alnum_prop": 0.5703623075726948,
"repo_name": "arviz-devs/arviz",
"id": "3decb0eae974e91d3031fcaae13635bfbe973510",
"size": "6... |
from sklearn.cross_validation import KFold
from sklearn.linear_model import LinearRegression, ElasticNet
import numpy as np
from sklearn.datasets import load_boston
boston = load_boston()
x = np.array([np.concatenate((v, [1])) for v in boston.data])
y = boston.target
FIT_EN = False
if FIT_EN:
model = ElasticNet(fi... | {
"content_hash": "bedeeff63850ebdefc319e9e9f98d602",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 61,
"avg_line_length": 29.233333333333334,
"alnum_prop": 0.6750285062713797,
"repo_name": "Nelca/buildMLSystem",
"id": "2ae52e02b94570d7acab79a5ec04e0d8d1424a97",
"size": "... |
from django.conf.urls import patterns, url
from rango import views
urlpatterns = patterns('',
url(r'^$', views.index, name='index'),
url(r'^about/$', views.about, name='about'),
url(r'^category/(?P<category_name_url>\w+)/$', views.category, name='category'),
url(r'^add_category/$', views.add_category, name='add_ca... | {
"content_hash": "c2364db6672e738e5db8291a861a6f75",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 90,
"avg_line_length": 49.61904761904762,
"alnum_prop": 0.654510556621881,
"repo_name": "sleonr0792/twd",
"id": "6b2589329a621f81a7faddf20ff5af48a971c466",
"size": "1042",
... |
import requests
from .. import __version__
class _Service(object):
def __init__(self):
self._BASE_URI = "http://gtr.rcuk.ac.uk/gtr/api/"
def get_session(self, token=None, env=None):
session = requests.Session()
session.headers.update(
{'User-Agent': ' '.join(
... | {
"content_hash": "a531d41e8dc69bcddae64eaea2dffcd0",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 83,
"avg_line_length": 32,
"alnum_prop": 0.5823863636363636,
"repo_name": "nestauk/gtr",
"id": "933d99e900db925e3162b73b33ad9ea906a08ea4",
"size": "1056",
"binary": false... |
"""
CertificatesEnddate - command ``/usr/bin/openssl x509 -noout -enddate -in path/to/cert/file``
=============================================================================================
This command gets the enddates of certificate files.
Typical output of this command is::
/usr/bin/find: '/etc/origin/node... | {
"content_hash": "fcf49353b6a51c736ebc33a249dcd037",
"timestamp": "",
"source": "github",
"line_count": 87,
"max_line_length": 119,
"avg_line_length": 38.60919540229885,
"alnum_prop": 0.6341172968145281,
"repo_name": "wcmitchell/insights-core",
"id": "1e29a58c6d8854562e2d956bd58e93de1fcb0c9c",
"siz... |
import uuid
from six.moves import http_client
from keystone.tests.unit import test_v3
class BaseTestCase(test_v3.RestfulTestCase):
EXTENSION_TO_ADD = 'simple_cert_extension'
CA_PATH = '/v3/OS-SIMPLE-CERT/ca'
CERT_PATH = '/v3/OS-SIMPLE-CERT/certificates'
class TestSimpleCert(BaseTestCase):
def r... | {
"content_hash": "30da59d0f994362052a2f5c7b67d8bca",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 75,
"avg_line_length": 30.851063829787233,
"alnum_prop": 0.5524137931034483,
"repo_name": "ajayaa/keystone",
"id": "b241b41baa46a6c3ff69332a1ba1fcf85bc0e717",
"size": "1996... |
"""
Tools for Lucene.
All Lucene features should be accessed in nordlys through this class.
- Lucene class for ensuring that the same version, analyzer, etc.
are used across nordlys modules. Handles IndexReader, IndexWriter, etc.
- Command line tools for checking indexed document content
@author: Faegheh Hasibi... | {
"content_hash": "2f77d47301fc1051757c9cbcbc0480f5",
"timestamp": "",
"source": "github",
"line_count": 574,
"max_line_length": 104,
"avg_line_length": 38.217770034843205,
"alnum_prop": 0.627068423211925,
"repo_name": "hasibi/EntityLinkingRetrieval-ELR",
"id": "f10d7d9b299d3f88d6cc19daf4004482f7a1081... |
import pafy
import datetime
import os
class Stream_Generator():
def __init__(self, url, start_time, end_time, format_type,
chosen_format, top_dir):
self.url = url
self.start_time = start_time
self.end_time = end_time
self.start_time_set = False
self.end_time... | {
"content_hash": "484d4e2210ca344cecfb363a905363a4",
"timestamp": "",
"source": "github",
"line_count": 226,
"max_line_length": 115,
"avg_line_length": 39.85840707964602,
"alnum_prop": 0.5595026642984015,
"repo_name": "sammypg/youtube_downloader",
"id": "2447d504112da659410a6f868067af34d5032153",
"... |
"""Test the System Bridge config flow."""
from unittest.mock import patch
from aiohttp.client_exceptions import ClientConnectionError
from systembridge.exceptions import BridgeAuthenticationException
from homeassistant import config_entries, data_entry_flow
from homeassistant.components.system_bridge.const import DOM... | {
"content_hash": "cd17b811020d16f9f59764030a01bea8",
"timestamp": "",
"source": "github",
"line_count": 353,
"max_line_length": 90,
"avg_line_length": 31.410764872521245,
"alnum_prop": 0.6516053391053391,
"repo_name": "lukas-hetzenecker/home-assistant",
"id": "1b46bb45a6d6d681acb5b52bd445b3d4b6879e69... |
import os
import os.path
import sys
import itertools
import collections
sys.path.append(
os.path.join(
os.environ.get( "SPLUNK_HOME", "/opt/splunk/6.1.3" ),
"etc/apps/framework/contrib/splunk-sdk-python/1.3.0",
)
)
import execnet
from splunklib.searchcommands import StreamingCommand, ReportingCommand, Confi... | {
"content_hash": "a947746b722db9624828063b4c0420b7",
"timestamp": "",
"source": "github",
"line_count": 217,
"max_line_length": 112,
"avg_line_length": 24.096774193548388,
"alnum_prop": 0.6783323771275579,
"repo_name": "nlproc/splunkml",
"id": "b0c6908bba50da6737d324b80c386a05a29763a1",
"size": "52... |
VERSION_TABLE = 'cisco_alembic_version'
| {
"content_hash": "881357d3cececfd1e4a55d80989e0acd",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 39,
"avg_line_length": 40,
"alnum_prop": 0.775,
"repo_name": "CiscoSystems/networking-cisco",
"id": "820ba1339e56632f6daa2748da793103c20ded15",
"size": "726",
"binary": fa... |
class LinkedInException(Exception):
def __init__(self, cause=None, status_code=None, response=None):
self.cause = cause
self.status_code = status_code
self.response = response
| {
"content_hash": "5c77c41ec39de99693640b580395b6b2",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 68,
"avg_line_length": 40.8,
"alnum_prop": 0.6617647058823529,
"repo_name": "kylemcc/pylinkedin",
"id": "a1349e8162826af9f69cc2e087f94945b61ba667",
"size": "204",
"binary"... |
__author__ = 'Simone Campagna'
import numpy
| {
"content_hash": "2c668c2fadf487c64ac41eff11f0de4f",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 30,
"avg_line_length": 15,
"alnum_prop": 0.6888888888888889,
"repo_name": "simone-campagna/buffered-numpy-arrays",
"id": "2860de511405c4a0faf3684e2f35ff6739d39c2f",
"size": ... |
import json
import os
import subprocess
import tempfile
import time
import unittest
from unittest import mock
import psutil
import pytest
from airflow import settings
from airflow.cli import cli_parser
from airflow.cli.commands import webserver_command
from airflow.cli.commands.webserver_command import GunicornMonito... | {
"content_hash": "8d5de73ee6cc8e3c1c02518622c25dff",
"timestamp": "",
"source": "github",
"line_count": 417,
"max_line_length": 105,
"avg_line_length": 42.16786570743405,
"alnum_prop": 0.5939490445859873,
"repo_name": "DinoCow/airflow",
"id": "1d7a6703df121b1cca62e3932b58d9ceaffb70af",
"size": "183... |
import unittest
import gc
import logging
import mock
from multiprocessing import Process, Queue
import os
import sys
from shellbot import Context, Engine, Shell
from shellbot.events import Message
from shellbot.updaters import FileUpdater
my_engine = Engine()
my_path = os.path.join(
os.path.dirname(os.path.dirnam... | {
"content_hash": "37645a1f2455c8a23bf6fdfad83d1d0f",
"timestamp": "",
"source": "github",
"line_count": 135,
"max_line_length": 184,
"avg_line_length": 24.822222222222223,
"alnum_prop": 0.5413309459862727,
"repo_name": "bernard357/shellbot",
"id": "9d99af0e18f7c11c171887e76ee610823024db67",
"size":... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.