text stringlengths 4 1.02M | meta dict |
|---|---|
"""Support for Modbus Register sensors."""
import logging
import struct
from typing import Any, Union
import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.const import (
CONF_NAME,
CONF_OFFSET,
CONF_SLAVE,
CONF_STRUCTURE,
CONF_UNIT_OF_MEASUREMENT,... | {
"content_hash": "6df54218151196690b5722fe5ac939f8",
"timestamp": "",
"source": "github",
"line_count": 237,
"max_line_length": 88,
"avg_line_length": 31.219409282700422,
"alnum_prop": 0.5508852547641573,
"repo_name": "qedi-r/home-assistant",
"id": "1a5c71812d610b63dcbd12a5941741a9104b7024",
"size"... |
from __future__ import division
import sys
import os
import shutil
import warnings
import inspect
import configparser
import threading as thread
import traceback
import copy
import logging
import numpy as np
import pandas as pd
import matplotlib as mpl
mpl.use('agg') # Prevents crash when GUI runs matplotlib in thre... | {
"content_hash": "405ed554eac4fb51f59c8ddd457bc73b",
"timestamp": "",
"source": "github",
"line_count": 644,
"max_line_length": 79,
"avg_line_length": 32.92391304347826,
"alnum_prop": 0.6090647549875018,
"repo_name": "jkitzes/macroeco",
"id": "102a50005436d61042a63d896d8a6ee3f1739209",
"size": "212... |
import json
import django_filters
from django.contrib.gis.geos import GEOSGeometry
from dateutil.parser import parse
from django.core.exceptions import ImproperlyConfigured
from django.contrib.gis.db import models as gis_models
from django.contrib.gis.gdal.error import GDALException
from django.db.models import Q
fr... | {
"content_hash": "70dcfa5f7b00963e2b20a1a5522a6e77",
"timestamp": "",
"source": "github",
"line_count": 232,
"max_line_length": 108,
"avg_line_length": 37.866379310344826,
"alnum_prop": 0.6761525327262379,
"repo_name": "azavea/ashlar",
"id": "3a181ccb568b3251769730b7daed665140151546",
"size": "8785... |
import islpy as isl
simple_send_receive = False
def print_set(name, s):
print name, " := ",
if (s.is_empty()):
print "Empty"
else:
print s, ";"
# The set S is assumed to be blocked. The size of each multidimensional
# block is indicated using the "block" list.
# Each block is partitioned into partitions.
# ... | {
"content_hash": "c0fd613cd5c270d887fdba68aac507d2",
"timestamp": "",
"source": "github",
"line_count": 273,
"max_line_length": 201,
"avg_line_length": 41.12820512820513,
"alnum_prop": 0.6526540790879943,
"repo_name": "rbaghdadi/ISIR",
"id": "45e3c32cf8d323bb365854f4728ea22db2b4aadb",
"size": "1122... |
"""Tests for mongodb backend
Authors:
* Min RK
"""
#-------------------------------------------------------------------------
# Copyright (C) 2011 The IPython Development Team
#
# Distributed under the terms of the BSD License. The full license is in
# the file COPYING, distributed as part of this software.
#--... | {
"content_hash": "95d49b78f1338b882f527837ea2b0817",
"timestamp": "",
"source": "github",
"line_count": 59,
"max_line_length": 75,
"avg_line_length": 26.16949152542373,
"alnum_prop": 0.5485751295336787,
"repo_name": "mattvonrocketstein/smash",
"id": "873076ebbde859c5470464f1d4b1951e47bdd921",
"size... |
from RPi.GPIO import *
class Relay:
def __init__(self, pin):
self.pin = pin
setup(self.pin, OUT)
self.Enabled = False
def Enable(self):
output(self.pin, True)
self.Enabled = True
def Disable(self):
output(self.pin, False)
self.Enabled = False
| {
"content_hash": "a0a3faeaa7fefb64b025fb816b9e4737",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 31,
"avg_line_length": 20.933333333333334,
"alnum_prop": 0.5573248407643312,
"repo_name": "curtisblack/R2D2",
"id": "4ae79f2e4e073d0e521240788660f965ce978186",
"size": "314... |
import numpy as np
import numpy.testing as npt
import pytest
from pytest import raises as assert_raises
from scipy.integrate import IntegrationWarning
from scipy import stats
from scipy.special import betainc
from .common_tests import (check_normalization, check_moment, check_mean_expect,
ch... | {
"content_hash": "0c5f9c3f07393c37939e4a6306abe8ab",
"timestamp": "",
"source": "github",
"line_count": 834,
"max_line_length": 100,
"avg_line_length": 41.66546762589928,
"alnum_prop": 0.601283490172379,
"repo_name": "matthew-brett/scipy",
"id": "797769f677300788a519692725c498025fb86ca2",
"size": "... |
"""Support for (EMEA/EU-based) Honeywell evohome systems."""
# Glossary:
# TCS - temperature control system (a.k.a. Controller, Parent), which can
# have up to 13 Children:
# 0-12 Heating zones (a.k.a. Zone), and
# 0-1 DHW controller, (a.k.a. Boiler)
# The TCS & Zones are implemented as Climate devices, Boi... | {
"content_hash": "ea0631dc3810254247e8724ec1c891c4",
"timestamp": "",
"source": "github",
"line_count": 147,
"max_line_length": 79,
"avg_line_length": 34.29931972789116,
"alnum_prop": 0.6443871479571599,
"repo_name": "auduny/home-assistant",
"id": "459a3636a06d3f5f728f34360007c7829d0a3c19",
"size":... |
"""Handles configuration options for the tests.
The tests are capable of running in other contexts, such as in a VM or against
a real deployment. Using this configuration ensures we can run them in other
environments if we choose to.
"""
import json
import os
from collections import Mapping
#TODO(tim.simpson): I f... | {
"content_hash": "c577b4a80a21a82b2f3ffae6a71a408b",
"timestamp": "",
"source": "github",
"line_count": 184,
"max_line_length": 79,
"avg_line_length": 34.10326086956522,
"alnum_prop": 0.5266932270916335,
"repo_name": "CMSS-BCRDB/RDS",
"id": "b5722fd77fa4074094ac0c74f425ac6951753d5e",
"size": "6915"... |
__all__ = [
"job_template",
"vars_template",
"parent_template"
]
job_template = 'JOB {job_id} {condor}\n'.format
vars_template = 'VARS {job_id} input="{input}" arguments="{arguments}"\n'.format
_parent_template = 'PARENT {parents} CHILD {children}\n'.format
def parent_template(*, parents, children):
... | {
"content_hash": "56ce396b2e1d0cb37129b063615563f6",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 80,
"avg_line_length": 29.772727272727273,
"alnum_prop": 0.6290076335877862,
"repo_name": "dwysocki/CondorScheduler",
"id": "85634c609a7265daa95546f758e37dad2203c95f",
"siz... |
"""
Example of using the InputImageButton class.
"""
from ggame.inputpoint import InputImageButton
from ggame.mathapp import MathApp
from ggame.asset import Frame
def pressbutton(_button):
"""
Callback function executed when button is pressed.
"""
print("Button Pressed!")
BUTTON = InputImageButton(
... | {
"content_hash": "121c621e66ab335bb4083a72cb74d6f9",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 86,
"avg_line_length": 21.19047619047619,
"alnum_prop": 0.7056179775280899,
"repo_name": "tiggerntatie/ggame",
"id": "38e3aeb32beef7b0dc32a781d43d98486949a311",
"size": "44... |
import os
import pytest
import fuzzinator
from common_formatter import mock_issue, mock_templates_dir
@pytest.mark.parametrize('issue, formatter_init_kwargs, exp_short, exp_long', [
(mock_issue,
{'short': '{{id}}', 'long': 'id: {{id}}, bar: {{bar}}, baz: {{baz}}, qux.xyz: {{qux.xyz}}'},
'foo',
'i... | {
"content_hash": "5fc25fea2e19992eb47b6aab44c85909",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 149,
"avg_line_length": 35.73076923076923,
"alnum_prop": 0.635091496232508,
"repo_name": "akosthekiss/fuzzinator",
"id": "cac95c1f3519d18642fda4705711313f678d5ccc",
"size":... |
"""
The LinearMap class keeps track of things that occur over
a 1-dimensial space, thus the "linear" in "LinearMap". The LinearMap
helps you visualize the layout of "chunks" of linear space. The
chunks may overlap, or they may not. Sample applications include
the visualization of headers, segments, and sections within... | {
"content_hash": "d43b38979fc0903372c7fcb692d3f804",
"timestamp": "",
"source": "github",
"line_count": 270,
"max_line_length": 79,
"avg_line_length": 31.92962962962963,
"alnum_prop": 0.5543440436144299,
"repo_name": "gilramir/instmake",
"id": "51575be46c0185d7fc42dea234f47b0c0637cc1d",
"size": "86... |
import os
from rackattack.virtual import sh
def create(image, sizeGB):
dirname = os.path.dirname(image)
if not os.path.isdir(dirname):
os.makedirs(dirname, 0777)
sh.run(['qemu-img', 'create', '-f', 'qcow2', image, '%dG' % sizeGB])
os.chmod(image, 0666)
def deriveCopyOnWrite(original, newImag... | {
"content_hash": "90c2b2feabdc65c82e7ae5519d388ca8",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 97,
"avg_line_length": 31.666666666666668,
"alnum_prop": 0.6505263157894737,
"repo_name": "eliran-stratoscale/rackattack-virtual",
"id": "d608ac81fe1d71da33df96625864ffd23d03... |
import icalendar
from django.conf import settings
from django.http import HttpResponse, Http404
from django.shortcuts import get_object_or_404, render
from django.template import TemplateDoesNotExist
from django.utils import timezone
from django.utils.translation import gettext_lazy as _
from django_date_extensions.fie... | {
"content_hash": "613890ce4700a88136d6532f32d73b1c",
"timestamp": "",
"source": "github",
"line_count": 176,
"max_line_length": 100,
"avg_line_length": 30.386363636363637,
"alnum_prop": 0.6602468212415856,
"repo_name": "DjangoGirls/djangogirls",
"id": "b6947cd9a2868d6313ae9c4e208b436fc94dc5f0",
"si... |
number = 9
print(type(number)) # print type of variable "number"
# FLOAT variables are numbers with decimal points:
float_number = 9.0
print (type(float_number))
# Here's a STRING variable:
foo = "hi there"
# Here we're changing it to an INT:
foo = 1000000
print (type(foo))
# What kind of variable is shopping?
s... | {
"content_hash": "4bd7242dab1f4306c1fdf99515ac0bd2",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 66,
"avg_line_length": 20.555555555555557,
"alnum_prop": 0.6410810810810811,
"repo_name": "jimoconnell/electrobrain",
"id": "ae102f734191ecc80136559a494002b4a7dca00f",
"siz... |
from __future__ import absolute_import
import re
import posixpath
from sentry.grouping.component import GroupingComponent
from sentry.grouping.strategies.base import strategy
from sentry.grouping.strategies.utils import remove_non_stacktrace_variants, has_url_origin
from sentry.grouping.strategies.similarity_encoders... | {
"content_hash": "7a746da0dea064b3eebef162a3d9010a",
"timestamp": "",
"source": "github",
"line_count": 453,
"max_line_length": 100,
"avg_line_length": 41.1766004415011,
"alnum_prop": 0.6515841955717578,
"repo_name": "beeftornado/sentry",
"id": "d372e99a1f81b49f2911261a5f64d5fa42454033",
"size": "1... |
__author__ = 'farooq.sheikh'
from setuptools import setup, find_packages
setup(
name = 'asposecellscloudexamples',
packages = find_packages(),
version = '1.2,
description = 'Aspose.Cells Cloud SDK for Python allows you to use Aspose.Cells APIs in your Python applications',
author='Farooq Sheikh',
... | {
"content_hash": "c4153d0a348e9da18a598a9263bc657d",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 118,
"avg_line_length": 34.77272727272727,
"alnum_prop": 0.6692810457516339,
"repo_name": "asposecells/Aspose_Cells_Cloud",
"id": "05d3b4e783280cebc160ad97ea01c22990204744",
... |
import Inline
info = {
"friendly_name": "Emphasised text",
"summary": "Applies the 'emphasis' typestyle to the contained markup.",
}
def SpanHandler(rest, acc):
(inner, rest) = Inline.parse(rest)
acc.append(Inline.TagFragment('pyle_em', inner))
return rest
| {
"content_hash": "0ba9e30913cb4aa480364b0861016e24",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 75,
"avg_line_length": 25.363636363636363,
"alnum_prop": 0.6738351254480287,
"repo_name": "CymaticLabs/Unity3D.Amqp",
"id": "8bf66cba84658ad8bb49f75edde0ed14ac3af2b6",
"siz... |
from icalendar import iCalendar # NOQA
from mail import Mailer # NOQA
| {
"content_hash": "61b0dd55d906998758df65127b8a73f6",
"timestamp": "",
"source": "github",
"line_count": 2,
"max_line_length": 39,
"avg_line_length": 40,
"alnum_prop": 0.7,
"repo_name": "angstwad/fortnight",
"id": "7095522682344313aad70bc2f789cde963500c02",
"size": "127",
"binary": false,
"copie... |
from pypy.rlib.parsing.ebnfparse import parse_ebnf, make_parse_function
from pypy.rlib.parsing.tree import RPythonVisitor
import py
from ripe import compiler, ripedir
from ripe.objects import W_Integer
grammar = py.path.local(ripedir).join("grammar.txt").read("rt")
regexs, rules, ToAST = parse_ebnf(grammar)
_parse = ... | {
"content_hash": "aa703da6c1fa276883f72eb249e45dea",
"timestamp": "",
"source": "github",
"line_count": 296,
"max_line_length": 79,
"avg_line_length": 27.658783783783782,
"alnum_prop": 0.6092585806766826,
"repo_name": "Julian/Ripe",
"id": "85729559c3adabcbe14e7c5562e57019d46e41fe",
"size": "8187",
... |
import os
import os.path
import logging
import string
import unicodedata
# Django
from django.utils.functional import LazyObject
from django.core.files.base import ContentFile
from django.utils.encoding import force_unicode
class ImproperlyConfigured(Exception):
pass
def ensure_path(filename):
... | {
"content_hash": "37775ea6f6ac332c2dfecb1ca1606dc6",
"timestamp": "",
"source": "github",
"line_count": 178,
"max_line_length": 185,
"avg_line_length": 38.42696629213483,
"alnum_prop": 0.6051169590643275,
"repo_name": "YAmikep/django-feedstorage",
"id": "0909de0bc5d6e58d79af9f6a8d9f8800134a33a9",
"... |
"""kolibri URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.8/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-bas... | {
"content_hash": "cd06403175bccc09641aa3b9f8dd86e1",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 77,
"avg_line_length": 32.58139534883721,
"alnum_prop": 0.7102069950035689,
"repo_name": "mrpau/kolibri",
"id": "d9537df4c2953be5d385ef6243163438658cd646",
"size": "1425",
... |
import RPi.GPIO as GPIO
import os
gpio_pin_number=40
GPIO.setmode(GPIO.BOARD)
GPIO.setup(gpio_pin_number, GPIO.IN, pull_up_down=GPIO.PUD_UP)
#It's very important the pin is an input to avoid short-circuits
#The pull-up resistor means the pin is high by default
try:
GPIO.wait_for_edge(gpio_pin_number, GPIO.FALLI... | {
"content_hash": "1e5cd781447e021065a353c6d66312a7",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 64,
"avg_line_length": 26.90909090909091,
"alnum_prop": 0.7297297297297297,
"repo_name": "merose/MakeyPiano",
"id": "d2bf95459a394d6a516c48d4a78ff3a22cb172d4",
"size": "895... |
from decimal import Decimal, DecimalException
from logging import getLogger
from django.conf import settings
from django.contrib.auth.decorators import login_required
from django.contrib.auth.models import User
from django.core.exceptions import PermissionDenied, SuspiciousOperation
from django.http import HttpRespons... | {
"content_hash": "6398ec0b920a433bed62480ee27a69a4",
"timestamp": "",
"source": "github",
"line_count": 288,
"max_line_length": 116,
"avg_line_length": 38.12847222222222,
"alnum_prop": 0.6500318732355888,
"repo_name": "ekevoo/esupa",
"id": "3bfc4925d7d34c97a28a286003fc19db77ee2b67",
"size": "11582"... |
from autopyfactory.interfaces import SchedInterface
import logging
class Fillactivated(SchedInterface):
id = 'fillactivated'
def __init__(self, apfqueue, config, section):
try:
self.apfqueue = apfqueue
self.log = logging.getLogger('autopyfactory.sched.%s' ... | {
"content_hash": "adc43e470032c8259bfbafd6ae2ff4ef",
"timestamp": "",
"source": "github",
"line_count": 94,
"max_line_length": 142,
"avg_line_length": 39.787234042553195,
"alnum_prop": 0.5483957219251336,
"repo_name": "btovar/autopyfactory",
"id": "f2d43f02eff1fb1ff0592b32120746ed7dd2fdc5",
"size":... |
import pytest
import random
import os
MAX = int(1e7)
def generate_input_file(input_file):
""" 生成输入文件 """
# 只生成 1M 个
print('Generating')
with open(input_file, 'w') as fd:
for i in range(1024):
cache = []
for j in range(1024):
cache.append(random.randint... | {
"content_hash": "c0b24537cfc034fedb5fbe438b88e84c",
"timestamp": "",
"source": "github",
"line_count": 118,
"max_line_length": 58,
"avg_line_length": 23.847457627118644,
"alnum_prop": 0.562544420753376,
"repo_name": "fengyc/programming-pearls-2nd-python",
"id": "477e1ffbebb87335d2898770af32e2234c937... |
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | {
"content_hash": "49f6e1421f528642ff4a3a6ab753f1af",
"timestamp": "",
"source": "github",
"line_count": 95,
"max_line_length": 90,
"avg_line_length": 25.042105263157893,
"alnum_prop": 0.6376628835645229,
"repo_name": "googleapis/google-cloud-php",
"id": "cbd8b306a83ebf449fb70ce652b8521087cd2c81",
"... |
import d1_test.d1_test_case
import d1_test.instance_generator.access_policy
# ===============================================================================
@d1_test.d1_test_case.reproducible_random_decorator("TestAccessPolicy")
class TestAccessPolicy(d1_test.d1_test_case.D1TestCase):
def test_1000(self):
... | {
"content_hash": "a11485c27b42a6c55c7275713ef021ec",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 103,
"avg_line_length": 38.94827586206897,
"alnum_prop": 0.6193005754758742,
"repo_name": "DataONEorg/d1_python",
"id": "d9d0be85088ed9dccd074402aea8bd116a9ba8f0",
"size": ... |
import abc
from pathlib import Path
from virtualenv.create.describe import PosixSupports, Python3Supports, WindowsSupports
from virtualenv.create.via_global_ref.builtin.ref import PathRefToDest
from .common import PyPy
class PyPy3(PyPy, Python3Supports, metaclass=abc.ABCMeta):
@classmethod
def exe_stem(cls)... | {
"content_hash": "ea37051a08eb2d2fac7b947257a901bb",
"timestamp": "",
"source": "github",
"line_count": 91,
"max_line_length": 116,
"avg_line_length": 34.13186813186813,
"alnum_prop": 0.6313586606567934,
"repo_name": "joshcai/utdcs",
"id": "ca5778c2c34810574411949b4de2ba2c8500bba5",
"size": "3106",... |
import pickle
import tensorflow as tf
import numpy as np
from keras.models import Sequential, Model
from keras.layers import Dense, Activation, Input, Flatten
from keras.optimizers import SGD, Adam, RMSprop
from keras.utils import np_utils
from keras.layers.normalization import BatchNormalization
from tensorflow.pyth... | {
"content_hash": "020b6d74b99c28a425ed58d9212c439e",
"timestamp": "",
"source": "github",
"line_count": 80,
"max_line_length": 101,
"avg_line_length": 31.15,
"alnum_prop": 0.6813804173354735,
"repo_name": "thomasantony/CarND-Projects",
"id": "267b2ae1a3a11cb40253fceb6cc8f5fcd3f6c5f8",
"size": "4540... |
import calendar
import urlparse
import re
import time_util
import struct
import base64
# Also defined in saml2.saml but can't import from there
XSI_NAMESPACE = 'http://www.w3.org/2001/XMLSchema-instance'
XSI_NIL = '{%s}nil' % XSI_NAMESPACE
# ---------------------------------------------------------
class NotValid(Ex... | {
"content_hash": "076ea03572ebbf0ff587afdb02c7e600",
"timestamp": "",
"source": "github",
"line_count": 452,
"max_line_length": 79,
"avg_line_length": 27.712389380530972,
"alnum_prop": 0.489701421044228,
"repo_name": "Runscope/pysaml2",
"id": "376df9ed6115183fddf25f1ba4940f6e788025c3",
"size": "125... |
"""
Helios Signals
Effectively callbacks that other apps can wait and be notified about
"""
import django.dispatch
# when an election is created
election_created = django.dispatch.Signal(providing_args=["election"])
# when a vote is cast
vote_cast = django.dispatch.Signal(providing_args=["user", "voter", "election"... | {
"content_hash": "7c6ffdffef8bdf3bfbe249a933d28650",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 93,
"avg_line_length": 27.3125,
"alnum_prop": 0.7551487414187643,
"repo_name": "shirlei/helios-server",
"id": "4c82d2ed854c0dbc79587d126c09895adb93e2dd",
"size": "437",
"... |
from functional.tests.identity.v3 import test_identity
from tempest.lib.common.utils import data_utils
class IdentityProviderTests(test_identity.IdentityTests):
# Introduce functional test case for command 'Identity Provider'
def test_idp_create(self):
self._create_dummy_idp()
def test_idp_delet... | {
"content_hash": "afe48cf60ac5ffe47ab0d751e3f3f32f",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 79,
"avg_line_length": 46.57142857142857,
"alnum_prop": 0.6007157464212679,
"repo_name": "redhat-openstack/python-openstackclient",
"id": "08f660f66da20c311069f412aee62208d1b... |
import re
import uuid
from django import forms
from django.db import models
from .utils import prepare_uuid_string
try:
from psycopg2 import extras
extras.register_uuid()
except (ImportError, AttributeError):
pass
def uuid_validator(value):
if re.search("[^a-f0-9]+", value):
raise forms.Va... | {
"content_hash": "d1a4fafe42c654c5cb50f9be878b6c83",
"timestamp": "",
"source": "github",
"line_count": 72,
"max_line_length": 77,
"avg_line_length": 26.98611111111111,
"alnum_prop": 0.6212043232115285,
"repo_name": "5monkeys/django-formapi",
"id": "c5594c5c66b2cefe649c05f4922740f2b45c1124",
"size"... |
from __future__ import print_function, division, absolute_import
from marvin.api.api import Interaction
from marvin import config
import pytest
pytestmark = pytest.mark.uses_web
auths = [None, 'token', 'netrc']
@pytest.fixture(params=auths)
def mint(request):
base = 'https://lore.sdss.utah.edu/'
url = '/ma... | {
"content_hash": "42acf9541349d032be26be721b73fd2a",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 115,
"avg_line_length": 30.18918918918919,
"alnum_prop": 0.6732318710832588,
"repo_name": "sdss/marvin",
"id": "10ad1f88870883e5d22bf339afb515d764f7953d",
"size": "1348",
... |
import datetime
from twisted.internet import reactor
from twisted.internet.defer import inlineCallbacks
from autobahn.twisted.wamp import ApplicationSession
class Component(ApplicationSession):
"""
A simple time service application component.
"""
def onConnect(self):
self.join("realm1")
def... | {
"content_hash": "00b749730a2a29e82c4b6f31f34b3aa0",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 52,
"avg_line_length": 20.4,
"alnum_prop": 0.6901960784313725,
"repo_name": "eugenejen/AutobahnPython",
"id": "e060c28427843a7505b319f113beceef62785f0b",
"size": "1280",
... |
"""AzureDocument classes and enums.
"""
class DatabaseAccount(object):
"""Database account. A DatabaseAccount is the container for databases.
:Attributes:
- `DatabaseLink`: str, the self-link for Databases in the
databaseAccount.
- `MediaLink`: str, the self-link for Media in the da... | {
"content_hash": "71177ee0c5e5bde1144d1ec29592a30c",
"timestamp": "",
"source": "github",
"line_count": 274,
"max_line_length": 99,
"avg_line_length": 35.28832116788321,
"alnum_prop": 0.6644947771227635,
"repo_name": "shipunyc/azure-documentdb-python",
"id": "fe8b968c7868f280711a8a895ffa39bbeb4e71c6"... |
import pytest
from SendEmailToCampaignRecipients import *
CAMPAIGN_EMAIL_TO = 'campaignemailto'
CAMPAIGN_EMAIL_SUBJECT = 'campaignemailsubject'
CAMPAIGN_EMAIL_BODY = 'campaignemailbody'
NUM_OF_INCIDENTS = 5
INCIDENT_IDS = [str(i) for i in range(NUM_OF_INCIDENTS)]
CUSTOM_FIELDS = {
CAMPAIGN_EMAIL_TO: 'a@a.com',
... | {
"content_hash": "44954223eee41a539a638e971338da45",
"timestamp": "",
"source": "github",
"line_count": 71,
"max_line_length": 94,
"avg_line_length": 26.929577464788732,
"alnum_prop": 0.6427824267782427,
"repo_name": "VirusTotal/content",
"id": "949123cde51eeb1d39b1808564d584c21126e470",
"size": "1... |
from swgpy.object import *
def create(kernel):
result = Static()
result.template = "object/static/particle/shared_particle_test_83.iff"
result.attribute_template_id = -1
result.stfName("obj_n","unknown_object")
#### BEGIN MODIFICATIONS ####
#### END MODIFICATIONS ####
return result | {
"content_hash": "924a98934eb2335387d5401ab3eeb908",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 71,
"avg_line_length": 23.076923076923077,
"alnum_prop": 0.69,
"repo_name": "anhstudios/swganh",
"id": "9e735ee975eab74deb982480c87a75fa05a8bf55",
"size": "445",
"binary"... |
from urllib import urlencode
from django import forms
from django.conf import settings
from django.contrib import admin
from django.core import validators
from django.core.urlresolvers import resolve
from django.utils.html import format_html
from django.utils.translation import ugettext, ugettext_lazy as _
from olymp... | {
"content_hash": "afd9ceb838fbdbce172f75f5f2e1deee",
"timestamp": "",
"source": "github",
"line_count": 168,
"max_line_length": 79,
"avg_line_length": 36.44642857142857,
"alnum_prop": 0.6037889923240242,
"repo_name": "lavish205/olympia",
"id": "26cf0f359c64e4c92c08819f85943d3d955d4027",
"size": "61... |
import itertools
import ggrc
from ggrc import models
from integration.ggrc import TestCase
from integration.ggrc import generator
counter = 0
def make_name(msg):
global counter
counter += 1
return msg + str(counter)
def relate(src, dst):
if src < dst:
return (src, dst)
else:
return (dst, src)
... | {
"content_hash": "a2a216177dcb0a5a1fd268e52b6d3da4",
"timestamp": "",
"source": "github",
"line_count": 334,
"max_line_length": 78,
"avg_line_length": 31.09880239520958,
"alnum_prop": 0.5887166650620969,
"repo_name": "VinnieJohns/ggrc-core",
"id": "44d3268a80bd52c235d438f1f3d9e2ccd6ed3de4",
"size":... |
from __future__ import absolute_import
import six
from sentry.app import locks
from sentry.models import OrganizationOption
from sentry.plugins import providers
from sentry.models import Integration
from sentry.utils.http import absolute_uri
from sentry.integrations.exceptions import ApiError, IntegrationError
from s... | {
"content_hash": "01f827521d8da55db2428ec070e7a84c",
"timestamp": "",
"source": "github",
"line_count": 126,
"max_line_length": 98,
"avg_line_length": 39.08730158730159,
"alnum_prop": 0.580507614213198,
"repo_name": "mvaled/sentry",
"id": "d051c8f58e56c2360e6d1da1accb1040f3232ee4",
"size": "4925",
... |
import rospy
from geometry_msgs.msg import PoseStamped
from mavros_msgs.msg import State
from mavros_msgs.srv import CommandBool, CommandBoolRequest
from mavros_msgs.srv import SetMode, SetModeRequest
current_state = State()
def state_cb(msg):
global current_state
current_state = msg
def offboard_node():
... | {
"content_hash": "74190983861586f4dfc8689c8e61cd58",
"timestamp": "",
"source": "github",
"line_count": 81,
"max_line_length": 74,
"avg_line_length": 28.530864197530864,
"alnum_prop": 0.584162700129814,
"repo_name": "uenota/px4_simulation_stack",
"id": "ca96571ab15c2f149f6464532e2774344d7cc4cf",
"s... |
"""
The module contains an implementation of uBoost algorithm.
The main goal of **uBoost** is to fight correlation between predictions and some variables (i.e. mass of particle).
* `uBoostBDT` is a modified version of AdaBoost, that targets to obtain efficiency uniformity at the specified level (global efficiency)
* `... | {
"content_hash": "c9bb14ad8a4f8a44e283215ef5b9d609",
"timestamp": "",
"source": "github",
"line_count": 563,
"max_line_length": 136,
"avg_line_length": 43.202486678507995,
"alnum_prop": 0.6258685195082844,
"repo_name": "anaderi/hep_ml",
"id": "420748500412190b39b4584397a462297b5296b7",
"size": "243... |
import collections.abc
import functools
BUFFER_MAX = 1 * 1024 * 1024 # We'll buffer up to 1MB
def add_vary_callback(*varies):
def inner(request, response):
vary = set(response.vary if response.vary is not None else [])
vary |= set(varies)
response.vary = vary
return inner
def add... | {
"content_hash": "4f389b7f1314bdec1672e5cf96c48811",
"timestamp": "",
"source": "github",
"line_count": 105,
"max_line_length": 86,
"avg_line_length": 33.74285714285714,
"alnum_prop": 0.5955405023990968,
"repo_name": "dstufft/warehouse",
"id": "2482f4b05a3f289b4449d0bfd40278d71bfd63b8",
"size": "40... |
"""Mixin holding dropout fields for RNN cells."""
import tensorflow.compat.v2 as tf
from tensorflow.tools.docs import doc_controls
from keras import backend
@doc_controls.do_not_generate_docs
class DropoutRNNCellMixin:
"""Object that hold dropout related fields for RNN Cell.
This class is not a standalone... | {
"content_hash": "109410a13b06ff0de80e325c224f96da",
"timestamp": "",
"source": "github",
"line_count": 165,
"max_line_length": 80,
"avg_line_length": 41.89090909090909,
"alnum_prop": 0.6532118055555556,
"repo_name": "keras-team/keras",
"id": "df02f668ea3cebcb61cb0bb80e20e82b4300d340",
"size": "760... |
from django.db import models
from constants import APPLICATION_LABEL
MAX_PROJECT_TAG_LENGTH = 20
class ProjectTag(models.Model):
name = models.CharField(max_length=MAX_PROJECT_TAG_LENGTH, blank=True, null=False, unique=True)
def __unicode__(self):
return self.name
class Meta:
... | {
"content_hash": "c18189d77fc4eabf6ef2abe536074d0e",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 99,
"avg_line_length": 23.666666666666668,
"alnum_prop": 0.6816901408450704,
"repo_name": "EarthSystemCoG/COG",
"id": "6d7382269bbf1b0093a0bb0e06bc1651ac0eb38a",
"size": "3... |
import arrow
import logging
import pickle
import redis
import random
from collections import MutableMapping
from datetime import timedelta
CONST_GC_MAX = 100
CONST_GC_PROB = 50
class ExpiringDictStore(MutableMapping):
""" Store for ExpiringDict.
Implement MutableMapping interface to act as a collection.
... | {
"content_hash": "28a730dd52e06e409285d3436b24386d",
"timestamp": "",
"source": "github",
"line_count": 212,
"max_line_length": 80,
"avg_line_length": 30.35377358490566,
"alnum_prop": 0.574980574980575,
"repo_name": "Pi3rral/expiringpdict",
"id": "d8e744b0c719713146ea86bc1fc40f798778e3bd",
"size": ... |
from setuptools import setup, find_packages
setup(
name='infosystem',
version='0.1.87',
summary='Infosystem Framework',
url='https://github.com/samueldmq/infosystem',
author='Samuel de Medeiros Queiroz, Francois Oliveira',
author_email='samueldmq@gmail.com, oliveira.francois@gmail.com',
li... | {
"content_hash": "54cf711895b1f099c13c2a888a339618",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 68,
"avg_line_length": 29.692307692307693,
"alnum_prop": 0.7046632124352331,
"repo_name": "samueldmq/infosystem",
"id": "a38b9a08fb502771de2c8c591833f05dbfe1589d",
"size": ... |
import sys
sys.path.insert(0, "../../python")
import numpy as np
import mxnet as mx
# The interface of a data iter that works for bucketing
#
# DataIter
# - default_bucket_key: the bucket key for the default symbol.
#
# DataBatch
# - provide_data: same as DataIter, but specific to this batch
# - provide_label: s... | {
"content_hash": "e843657f091ceebbee7e2e86a46584ec",
"timestamp": "",
"source": "github",
"line_count": 399,
"max_line_length": 119,
"avg_line_length": 36.909774436090224,
"alnum_prop": 0.5673253208392748,
"repo_name": "linmajia/dlbench",
"id": "b25515bb251ad62ede8b16538c8d49d640928c94",
"size": "1... |
from ordered_model.admin import OrderedModelAdmin
from filebrowser.settings import ADMIN_THUMBNAIL
from django.utils.translation import ugettext_lazy as _
from django.contrib.admin import StackedInline
from .model import Photo
class PhotoAdmin(OrderedModelAdmin):
list_display = ('as_rendered', 'is_enabled', 'nam... | {
"content_hash": "7d8a9dd71029421df8dfe2ce4c8ff21a",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 80,
"avg_line_length": 42.875,
"alnum_prop": 0.6239067055393586,
"repo_name": "gbezyuk/django-react-redux-universal-hot-example",
"id": "4dea40665bb0826289ce1a20ca248f7f840b9... |
ANSIBLE_METADATA = {
'status': ['preview'],
'supported_by': 'community',
'metadata_version': '1.0'
}
DOCUMENTATION = '''
---
module: bigip_selfip
short_description: Manage Self-IPs on a BIG-IP system
description:
- Manage Self-IPs on a BIG-IP system
version_added: "2.2"
options:
address:
descriptio... | {
"content_hash": "624ad8b549d6c9cb39add66df4febe02",
"timestamp": "",
"source": "github",
"line_count": 690,
"max_line_length": 105,
"avg_line_length": 30.118840579710145,
"alnum_prop": 0.5565393128669041,
"repo_name": "mcgonagle/ansible_f5",
"id": "7c2f730d1cd68a412c23eb1af8a516062d397d9a",
"size"... |
import json
import sys
import pyperf
EMPTY = ({}, 2000)
SIMPLE_DATA = {'key1': 0, 'key2': True, 'key3': 'value', 'key4': 'foo',
'key5': 'string'}
SIMPLE = (SIMPLE_DATA, 1000)
NESTED_DATA = {'key1': 0, 'key2': SIMPLE[0], 'key3': 'value', 'key4': SIMPLE[0],
'key5': SIMPLE[0], 'key': '\u01... | {
"content_hash": "a492dc7ea4de1aed2c538ff42e038ea7",
"timestamp": "",
"source": "github",
"line_count": 59,
"max_line_length": 119,
"avg_line_length": 26.508474576271187,
"alnum_prop": 0.5332480818414322,
"repo_name": "python/performance",
"id": "ccdaaadac65ee74d1ecc1b171b314c2fde019923",
"size": "... |
""" test_colr_tool.py
Unit tests for colr.py command line tool.
These tests should be ran with `green -q` to quiet stdout.
If you are using nose then stdout should be quiet already.
If you are using unittest to run these, then -b should work to quiet them.
-Christopher Welborn 12-09-2015
"""
impor... | {
"content_hash": "e2f5ac172e1344b5c16489856dbcf192",
"timestamp": "",
"source": "github",
"line_count": 462,
"max_line_length": 80,
"avg_line_length": 34.112554112554115,
"alnum_prop": 0.4736040609137056,
"repo_name": "welbornprod/colr",
"id": "31e012c76fc3e587ac67b96470e912e41dc09c33",
"size": "15... |
from omegaconf import DictConfig, OmegaConf
import hydra
@hydra.main(config_path='conf')
def my_app(cfg):
print(OmegaConf.to_yaml(cfg))
def _apply_argparse_cli():
import argparse, sys
p = argparse.ArgumentParser()
p.add_argument("--db", default="mysql")
p.add_argument("--db-config", nargs="*", def... | {
"content_hash": "f2927f1a935dde28ba866cd8de75f936",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 56,
"avg_line_length": 26.61111111111111,
"alnum_prop": 0.6200417536534447,
"repo_name": "guildai/guild",
"id": "53ac7f59a4fb05456a48e3bc3f267f60098fdc45",
"size": "479",
... |
from decimal import Decimal
from distutils.version import LooseVersion
from django.core.management.base import NoArgsCommand
from django.core import urlresolvers
from django.utils.importlib import import_module
import django
import imp
import logging
import re
import sys
import types
errors = []
logged_more = False
ap... | {
"content_hash": "5cc81b9b615e9268f715a4624965e860",
"timestamp": "",
"source": "github",
"line_count": 322,
"max_line_length": 160,
"avg_line_length": 46.43478260869565,
"alnum_prop": 0.6194489031567684,
"repo_name": "grengojbo/satchmo",
"id": "39b78d4067cc6d354a56e4f66169c39bd75849dd",
"size": "1... |
class DbConnector:
def __init__(self):
pass
def add_comment_count(self, comments_url, count):
raise NotImplementedError
def add_story(self, nb_hash, added, comments_url, story_url):
raise NotImplementedError
def close_connection(self):
raise NotImplementedError
de... | {
"content_hash": "9712a3766cfa6a8159dfe0cbe5360b04",
"timestamp": "",
"source": "github",
"line_count": 54,
"max_line_length": 83,
"avg_line_length": 26.537037037037038,
"alnum_prop": 0.6838799720865317,
"repo_name": "bmordue/nb",
"id": "50322764c77b5ea61979ce1d9d043ee3cad7de19",
"size": "1433",
... |
from msrest.serialization import Model
class Frames(Model):
"""The response for a Get Frames request.
:param review_id: Id of the review.
:type review_id: str
:param video_frames:
:type video_frames:
list[~azure.cognitiveservices.vision.contentmoderator.models.Frame]
"""
_attribute_... | {
"content_hash": "b5c0d34607f4686960b37b01eb30ddc0",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 72,
"avg_line_length": 28.772727272727273,
"alnum_prop": 0.6113744075829384,
"repo_name": "AutorestCI/azure-sdk-for-python",
"id": "724a54ce61cfa902debb47467a3368d0d6b237e5",... |
from distutils.core import setup
setup(name='kao_json',
version='0.3.1',
description='Python JSON Conversion Library',
author='Chris Loew',
author_email='cloew123@gmail.com',
#url='http://www.python.org/sigs/distutils-sig/',
packages=['kao_json',
'kao_json.builders',... | {
"content_hash": "81dc97f6e987bb9656beca1661c60844",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 55,
"avg_line_length": 32.2,
"alnum_prop": 0.5445134575569358,
"repo_name": "cloew/KaoJson",
"id": "cfb5de6510b611d6449c23e4e53c01b9dd51b5f7",
"size": "483",
"binary": fa... |
from __future__ import division
from __future__ import with_statement
# standard python libraries
try:
import json
except:
import simplejson as json
import re
import os
import time
# matplotlib.sf.net
import matplotlib
import numpy
# www.gtk.org
import gtk
# our own libraries
from elrond.static imp... | {
"content_hash": "15bf6d9a12f93b1b455fcedf861891e7",
"timestamp": "",
"source": "github",
"line_count": 804,
"max_line_length": 107,
"avg_line_length": 31.940298507462686,
"alnum_prop": 0.46736760124610593,
"repo_name": "cdsi/grima",
"id": "5321145ab6dd5a87aabdfbd2a8109f1375b9d8ab",
"size": "25680"... |
import tests.model_control.test_ozone_custom_models_enabled as testmod
testmod.build_model( ['BoxCox'] , ['LinearTrend'] , ['Seasonal_DayOfWeek'] , ['AR'] ); | {
"content_hash": "17ec29caa8459f6a25f315d13f2835dc",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 86,
"avg_line_length": 39.75,
"alnum_prop": 0.710691823899371,
"repo_name": "antoinecarme/pyaf",
"id": "96128bf168ad97c2131ef5f2e968ae386c4665be",
"size": "159",
"binary":... |
from ncclient.operations.rpc import *
import unittest
from mock import patch
from ncclient import manager
import ncclient.manager
import ncclient.transport
from ncclient.xml_ import *
from ncclient.operations import RaiseMode
from ncclient.capabilities import Capabilities
import sys
if sys.version >= '3':
patch_st... | {
"content_hash": "23692fe56ce58a5a11c88d735399e800",
"timestamp": "",
"source": "github",
"line_count": 178,
"max_line_length": 235,
"avg_line_length": 36.353932584269664,
"alnum_prop": 0.6247875135218668,
"repo_name": "einarnn/ncclient",
"id": "131d2970fb306cf14857fa53a46ede2d122c4f83",
"size": "6... |
import numpy as np
from .parametric import f_oneway, ttest_1samp_no_p
from ..parallel import parallel_func, check_n_jobs
from ..fixes import jit, has_numba
from ..utils import (split_list, logger, verbose, ProgressBar, warn, _pl,
check_random_state, _check_option, _validate_type)
from ..source_est... | {
"content_hash": "fbce863b9f91926d7e11993aea16511c",
"timestamp": "",
"source": "github",
"line_count": 1497,
"max_line_length": 79,
"avg_line_length": 39.5437541750167,
"alnum_prop": 0.5861614608848421,
"repo_name": "Eric89GXL/mne-python",
"id": "f2830bf486883fad603aeaa9d0261ea385a4b55d",
"size": ... |
from gevent import monkey; monkey.patch_all()
import os
from collections import namedtuple
#from plumb_util import find_service, find_text
from syncstomp.managed import ManagedConnection
from apollo.queues import OneQueueApolloMonitor, ApolloMonitor
import logging; logger = logging.getLogger(__name__)
from uuid import... | {
"content_hash": "0052e8189d52d1d61bcdee73a8cc453c",
"timestamp": "",
"source": "github",
"line_count": 121,
"max_line_length": 78,
"avg_line_length": 31.132231404958677,
"alnum_prop": 0.6586142819219538,
"repo_name": "pombredanne/apollo-1",
"id": "d689754ee702fa5a89fcf793d1133bf6d481e859",
"size":... |
from sqlalchemy import Column, Integer, String, Text, DateTime, Index
from datetime import datetime
from .db import Base
class Question(Base):
__tablename__ = 'questions'
__table_args__ = (
Index('questions_query_id_index', "query_id"),
Index('questions_question_id_index', "question_id"),
... | {
"content_hash": "732dcebea7d0e5664b3a02a2fb4d684c",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 75,
"avg_line_length": 35.29545454545455,
"alnum_prop": 0.601416613007083,
"repo_name": "mpkato/openliveq",
"id": "56279ac039d052e7f6b2a5d24924389483d23efa",
"size": "1553"... |
import argparse
import sys
import json
import time
import requests
import tornado.ioloop
from tornado.httpclient import AsyncHTTPClient
from tornado.httputil import url_concat
testurls = ['https://t.co/gFVKpELNO0',
'https://docs.python.org/2/library/configparser.html',
'http://www.huffingtonpo... | {
"content_hash": "4964f28945fb57558337e7ddee896d9c",
"timestamp": "",
"source": "github",
"line_count": 57,
"max_line_length": 145,
"avg_line_length": 28.842105263157894,
"alnum_prop": 0.6551094890510949,
"repo_name": "lrei/canonical_urls",
"id": "679de24c7f6c04345b3d6fb03b9f15be42c93174",
"size": ... |
import unittest
import math
from function.generic_univariate_pitch_function import GenericUnivariatePitchFunction
from harmonicmodel.tertian_chord_template import TertianChordTemplate
from melody.constraints.contextual_note import ContextualNote
from melody.constraints.fit_pitch_to_function_constraint import FitPitch... | {
"content_hash": "49c3552c2610f4c88d2272eb54585ee6",
"timestamp": "",
"source": "github",
"line_count": 151,
"max_line_length": 119,
"avg_line_length": 44.728476821192054,
"alnum_prop": 0.6209653538643767,
"repo_name": "dpazel/music_rep",
"id": "de3be5a7011404c1751c392f8ba057690cf425f4",
"size": "6... |
from temboo.core.choreography import Choreography
from temboo.core.choreography import InputSet
from temboo.core.choreography import ResultSet
from temboo.core.choreography import ChoreographyExecution
import json
class GetArtistTracks(Choreography):
def __init__(self, temboo_session):
"""
Create... | {
"content_hash": "16fb8e442f17379c4237dab6818b4062",
"timestamp": "",
"source": "github",
"line_count": 81,
"max_line_length": 129,
"avg_line_length": 40.97530864197531,
"alnum_prop": 0.6824344682133172,
"repo_name": "jordanemedlock/psychtruths",
"id": "f9fd666b956885bc663460dd2ee7d5a3977461eb",
"s... |
from common_fixtures import * # NOQA
def _clean_hostlabelmaps_for_host(client, host):
for label in host.hostLabels():
host.removelabel(label=label.id)
wait_for_condition(
client, host,
lambda x: len(x.hostLabels()) == 0,
lambda x: 'Number of labels for host is: ' + len(x.hostL... | {
"content_hash": "b8d46b40c5d64aead60454582d5701fc",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 77,
"avg_line_length": 30.732142857142858,
"alnum_prop": 0.599651365485183,
"repo_name": "rancherio/cattle",
"id": "af660e993421d2ac4ece22f98f440fda3fba6e2d",
"size": "1721... |
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import os
import string
import sys
import TestSCons
_python_ = TestSCons._python_
_exe = TestSCons._exe
test = TestSCons.TestSCons()
test.write("wrapper.py",
"""import os
import string
import sys
open('%s', 'wb').write("wrapper.py\\n")
args = filter(lamb... | {
"content_hash": "24867c5dd5988dc21eae432d7fd8e4f7",
"timestamp": "",
"source": "github",
"line_count": 63,
"max_line_length": 69,
"avg_line_length": 21.03174603174603,
"alnum_prop": 0.5954716981132075,
"repo_name": "datalogics/scons",
"id": "d80960d197b2a7941ac3792c64107afa314037ec",
"size": "2427... |
from unittest import TestCase
import mock
from src.main.Parser import Parser
@mock.patch('random.randint', return_value=3)
class TestParser(TestCase):
def test_double_dice_roll(self, mocked_roll):
parser = Parser()
self.assertEqual(parser.parse("2d4+3d5"), 15)
self.assertEqual(parser.par... | {
"content_hash": "de396fa5cc30d0910d4f9a744089e200",
"timestamp": "",
"source": "github",
"line_count": 66,
"max_line_length": 72,
"avg_line_length": 37.34848484848485,
"alnum_prop": 0.6478701825557809,
"repo_name": "charleshamel73/diceroller",
"id": "9d10aa21e6fe82757645793294ce6384ab55a511",
"siz... |
import Axon
from Kamaelia.Util.PipelineComponent import pipeline
from Kamaelia.Util.Graphline import Graphline
from Kamaelia.Util.Console import ConsoleReader, ConsoleEchoer
from Kamaelia.Visualisation.PhysicsGraph.chunks_to_lines import chunks_to_lines
from Kamaelia.Visualisation.PhysicsGraph.lines_to_tokenlists impo... | {
"content_hash": "f6efc007d907896eb72b97f63effbcd3",
"timestamp": "",
"source": "github",
"line_count": 111,
"max_line_length": 107,
"avg_line_length": 43.36036036036036,
"alnum_prop": 0.5630583835445668,
"repo_name": "bbc/kamaelia",
"id": "80573ef713f4eade98a1e9295b1ba8c98fbfb894",
"size": "4832",... |
"""Tests for Qt Linguist storage class"""
from lxml import etree
from translate.misc.multistring import multistring
from translate.storage import ts2 as ts
from translate.storage import test_base
from translate.storage.placeables import parse
from translate.storage.placeables import xliff
from translate.storage.place... | {
"content_hash": "656dff124ec117f7cfa776a9b1770a0f",
"timestamp": "",
"source": "github",
"line_count": 167,
"max_line_length": 98,
"avg_line_length": 33.622754491017965,
"alnum_prop": 0.6329474621549421,
"repo_name": "rlr/fjord",
"id": "ae2f0f4da760d9fc2a7a993d61c358bfc095219a",
"size": "6422",
... |
import sys
import os
import re
import tempfile
import shutil
import argparse
import glob
import stat
from LoggerManager import logger, initConsoleLogging, initFileLogging
""" constants """
EXTERNAL_DATA_SIZE_THRESHOLD = 1*1024*1024 # 1 MiB
EXTERNAL_DATA_PREFIX = ".ExternalData_SHA1_"
IGNORE_FILE_LIST = ("CMakeLists... | {
"content_hash": "05194cce77ddf460195f436242cbdd4f",
"timestamp": "",
"source": "github",
"line_count": 294,
"max_line_length": 91,
"avg_line_length": 35.863945578231295,
"alnum_prop": 0.6976479514415781,
"repo_name": "luisibanez/vista-debian-med-package",
"id": "14d19bd21145ef285a03eeefbab699f49c3d0... |
"""
Periscope API for the masses
"""
import os
import time
from periapi.downloadmgr import DownloadManager
from periapi.listener import Listener
from periapi.broadcast import Broadcast
DEFAULT_NOTIFICATION_INTERVAL = 15
class AutoCap:
"""Class to check notifications stream and start capping new broadcasts"""
... | {
"content_hash": "b4065b5d060c3d4ff59fee8a524e48f3",
"timestamp": "",
"source": "github",
"line_count": 121,
"max_line_length": 98,
"avg_line_length": 34.66942148760331,
"alnum_prop": 0.6095351609058403,
"repo_name": "baliscope/periapi",
"id": "66e39dd6d9e5e7508903b12ec9efe54758a4b13e",
"size": "42... |
"""
This is a pure Python implementation of the greedy-merge-sort algorithm
reference: https://www.geeksforgeeks.org/optimal-file-merge-patterns/
For doctests run following command:
python3 -m doctest -v greedy_merge_sort.py
Objective
Merge a set of sorted files of different length into a single sorted file.
We need ... | {
"content_hash": "548c63a80b32bca17b449666c6e3bc7b",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 79,
"avg_line_length": 29.232142857142858,
"alnum_prop": 0.6725717776420281,
"repo_name": "TheAlgorithms/Python",
"id": "a1c934f84498b0beaa9113ed59767bc64726ecda",
"size": ... |
import os
import shutil
import numpy as np
import skimage as ski
import skimage.io
import skimage.util
import skimage.measure
from scipy import ndimage as ndi
indir = '/groups/flyem/data/temp/ordishc/exports/raveler_export_for davi'
outdir = '/groups/saalfeld/home/nuneziglesiasj/data/raveler_export_davi_v7'
os.makedir... | {
"content_hash": "3cb4069881aef1388c54a14a365778c4",
"timestamp": "",
"source": "github",
"line_count": 96,
"max_line_length": 89,
"avg_line_length": 36.677083333333336,
"alnum_prop": 0.6628798636750923,
"repo_name": "jni/special-scripts",
"id": "71806598dc6adef02bb92f734ff9d9b87c0aec55",
"size": "... |
'''
The MIT License (MIT)
Copyright (c) 2016 Wei-Hung Weng
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, including without limitation the rights
to use, copy, modify, merge... | {
"content_hash": "7031ee25b6c11cbd3f140663c959dd2c",
"timestamp": "",
"source": "github",
"line_count": 341,
"max_line_length": 250,
"avg_line_length": 40.240469208211145,
"alnum_prop": 0.6211922460282757,
"repo_name": "ckbjimmy/cdc",
"id": "bd1681170dc42ac8ab72554c024a0f1e436b4324",
"size": "13722... |
#!/usr/bin/env python
#
# Appcelerator Titanium Module Packager
#
#
import os, subprocess, sys, glob, string
import zipfile
from datetime import date
cwd = os.path.abspath(os.path.dirname(sys._getframe(0).f_code.co_filename))
os.chdir(cwd)
required_module_keys = ['name','version','moduleid','description','copyright','... | {
"content_hash": "889ae0871382acbac4a4748ca45e425b",
"timestamp": "",
"source": "github",
"line_count": 247,
"max_line_length": 125,
"avg_line_length": 30.821862348178136,
"alnum_prop": 0.6856692499671614,
"repo_name": "gimdongwoo/firebase-titanium",
"id": "e99af93dec5deb45e9f351ee1d12e5606f4fadd4",
... |
import json
filename = 'username.json'
with open(filename) as f_obj:
username = json.load(f_obj)
print("Welcome back, " + username + "!")
| {
"content_hash": "bc8f12a29f8bbff413d838572e344f4e",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 44,
"avg_line_length": 21.142857142857142,
"alnum_prop": 0.6486486486486487,
"repo_name": "mccarrion/python-practice",
"id": "9b60e796aade908bca20f0cca43c3a9ab6689b8b",
"siz... |
from flask import Flask, url_for, jsonify, request, abort, has_request_context
import logging
from logging.handlers import RotatingFileHandler
import os
from utils import generate_id
import redis
from rest_data_structures import Car, Appliance, Pantry
app = Flask(__name__)
class CustomFormatter(logging.Formatter):
... | {
"content_hash": "d1df9eca9fafd28735e7be129e9b9361",
"timestamp": "",
"source": "github",
"line_count": 253,
"max_line_length": 161,
"avg_line_length": 37.83399209486166,
"alnum_prop": 0.6225449226911827,
"repo_name": "jeremyprice/RU_Python_IV_API",
"id": "5e2f444590ac181df84d59270cce27d564a05e84",
... |
import unittest
# DO NOT IMPORT redi here!
# Each test needs it's own redi module so we can manipulate the
# module-scoped variables and functions
class TestResume(unittest.TestCase):
def test_no_resume_deletes_old_run_data(self):
class MockPersonFormEvents(object):
def delete(self):
... | {
"content_hash": "e1c7aed9f9222e273a04957e0fa1008a",
"timestamp": "",
"source": "github",
"line_count": 94,
"max_line_length": 85,
"avg_line_length": 35.45744680851064,
"alnum_prop": 0.5901590159015901,
"repo_name": "nrejack/redi",
"id": "e80b579328a84ffc6bf39970a440a45a538fe89f",
"size": "3892",
... |
from hashlib import sha1
import mimetypes
import traceback
import warnings
from django.contrib.sites.models import Site
from django.core.exceptions import ValidationError
from django.core.files.storage import default_storage
from django.core.urlresolvers import reverse
from django.core.validators import ipv4_re
from d... | {
"content_hash": "a4fbbaeba5bc8e64359b4b3309cdd9cc",
"timestamp": "",
"source": "github",
"line_count": 561,
"max_line_length": 79,
"avg_line_length": 37.83600713012478,
"alnum_prop": 0.5730707622726845,
"repo_name": "pculture/django-vidscraper",
"id": "76181ebbc16a7dfb0e02e8f89f73eb6535ec1ac0",
"s... |
"""SCons.Tool.mwld
Tool-specific initialization for the Metrowerks CodeWarrior linker.
There normally shouldn't be any need to import this module directly.
It will usually be imported through the generic SCons.Tool.Tool()
selection method.
"""
#
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2... | {
"content_hash": "d3919d2abc7d3531ea627de66cb4f17f",
"timestamp": "",
"source": "github",
"line_count": 107,
"max_line_length": 135,
"avg_line_length": 34,
"alnum_prop": 0.6880153930731171,
"repo_name": "bubichain/blockchain",
"id": "a8cf2a62ecbac993d05eaab9f2b424e7bb1d4ff6",
"size": "3638",
"bin... |
"""Generates straight-line programs performing arithmetic on multiple variables.
"""
import dataclasses
import random
from typing import Optional, Text, Tuple
DEFAULT_OPS = ("+=", "-=", "*=")
@dataclasses.dataclass
class MultivarArithmeticConfig(object):
"""The config class for the multivar arithmetic generator.... | {
"content_hash": "e2dc12a23ada9fe51b5e3df1f72e5afa",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 80,
"avg_line_length": 27.857142857142858,
"alnum_prop": 0.6628205128205128,
"repo_name": "google-research/google-research",
"id": "b5ded93412ddcb18e64fe82b7687315c9183d692",... |
import sys
import os
import unittest
import pexpect
from Naked.toolshed.shell import execute
from Naked.toolshed.system import file_exists, make_path
class CryptoUnicodePassphraseTest(unittest.TestCase):
def setUp(self):
pass
def tearDown(self):
pass
def submit_same_uni_passphrase(self, ... | {
"content_hash": "8b26583dd86871eeb83670ae3a3e38a4",
"timestamp": "",
"source": "github",
"line_count": 59,
"max_line_length": 119,
"avg_line_length": 36.83050847457627,
"alnum_prop": 0.6695812241141279,
"repo_name": "chrissimpkins/crypto",
"id": "2358cd336343eb5f1761b477ba5b1f7580a6f52e",
"size": ... |
from ..core import Mapping
class Compound(Mapping):
"""
Mapping based on passing one mapping through another
.. math::
f(\mathbf{x}) = f_2(f_1(\mathbf{x}))
:param mapping1: first mapping
:type mapping1: GPy.mappings.Mapping
:param mapping2: second mapping
:type mapping2: GPy.mappi... | {
"content_hash": "aab556cd15031fd2d2ad224787814bd8",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 85,
"avg_line_length": 32.52777777777778,
"alnum_prop": 0.6507258753202391,
"repo_name": "SheffieldML/GPy",
"id": "9078910f29b1f9920c371c0a84c286243d4bcbec",
"size": "1282"... |
from flask import g, redirect, url_for
from app import app, db
from .models import auth
@app.route('/delete-me/')
@auth.protected(csrf=True, role='user')
def delete_me():
db.session.delete(g.user)
db.commit()
auth.logout()
return redirect(url_for('index'))
| {
"content_hash": "3bf1eb36ba73883b7c3f7cfd776b97f7",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 39,
"avg_line_length": 19.785714285714285,
"alnum_prop": 0.6750902527075813,
"repo_name": "jpscaletti/authcode",
"id": "965013cc944bf242d7d961dd7640aad582210ac2",
"size": "... |
"""
Demonstration of borders and background colors.
"""
from vispy.scene import SceneCanvas
canvas = SceneCanvas(keys='interactive', bgcolor='w', show=True)
grid = canvas.central_widget.add_grid(spacing=0, bgcolor='gray',
border_color='k')
view1 = grid.add_view(row=0, col=0, marg... | {
"content_hash": "348749087c5a47fd75f5e683df6c6978",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 70,
"avg_line_length": 35.1875,
"alnum_prop": 0.566607460035524,
"repo_name": "Eric89GXL/vispy",
"id": "c08ad119cebd4307048c5bfd876a1052dba283fe",
"size": "902",
"binary"... |
from abc import ABCMeta, abstractmethod
class Actor():
@abstractmethod
def __init__(self, batteryManagerObj):
pass
@abstractmethod
def run(self):
pass
| {
"content_hash": "adca0ddccdf9aa543f38d654608bd23c",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 39,
"avg_line_length": 19.875,
"alnum_prop": 0.7421383647798742,
"repo_name": "zjcers/ecohawks-battery",
"id": "5c55eeae23fd60d2b1c8bb5b6936e9831d1cacf2",
"size": "308",
"... |
"""Stores application configuration taken from e.g. app.yaml, queues.yaml."""
# TODO: Support more than just app.yaml.
import errno
import logging
import os
import os.path
import random
import string
import threading
import types
from google.appengine.api import appinfo
from google.appengine.api import appinfo_incl... | {
"content_hash": "e0130eac187debf4591e795bd8ad6d05",
"timestamp": "",
"source": "github",
"line_count": 570,
"max_line_length": 80,
"avg_line_length": 33.12105263157895,
"alnum_prop": 0.6661369775941522,
"repo_name": "elsigh/browserscope",
"id": "84d9f1bc0651fe347667f375edc48b3a76ff8f2c",
"size": "... |
import mock
import sys
guestfs = mock.Mock()
sys.modules['guestfs'] = guestfs
from sahara.cli.image_pack import api
from sahara.tests.unit import base
class TestSaharaImagePackAPI(base.SaharaTestCase):
def setUp(self):
super(TestSaharaImagePackAPI, self).setUp()
def tearDown(self):
super(T... | {
"content_hash": "c8f69c61fe2a432bd24d361b566ab47a",
"timestamp": "",
"source": "github",
"line_count": 57,
"max_line_length": 78,
"avg_line_length": 40.19298245614035,
"alnum_prop": 0.6569183762549106,
"repo_name": "tellesnobrega/sahara",
"id": "68f6073b8139226e9446acad231f9d8d73d03665",
"size": "... |
import tornado.ioloop
import tornado.web
from libthumbor.url import Url
from thumbor.handlers.imaging import ImagingHandler
class ThumborServiceApp(tornado.web.Application):
def __init__(self, context):
self.context = context
self.debug = getattr(self.context.server, "debug", False)
super... | {
"content_hash": "e93c3a646e3734d3def40403ce835ed3",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 86,
"avg_line_length": 33.88,
"alnum_prop": 0.6611570247933884,
"repo_name": "kkopachev/thumbor",
"id": "6679e50a3fc4a6edbb71ef05cd8c24b7f3b3ce34",
"size": "1099",
"binar... |
"""This module is deprecated. Please use `airflow.providers.apache.hive.hooks.hive`."""
import warnings
# pylint: disable=unused-import
from airflow.providers.apache.hive.hooks.hive import ( # noqa
HIVE_QUEUE_PRIORITIES,
HiveCliHook,
HiveMetastoreHook,
HiveServer2Hook,
)
warnings.warn(
"This mod... | {
"content_hash": "7400a624aee15e01f81fc76f717a6069",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 88,
"avg_line_length": 25.88235294117647,
"alnum_prop": 0.7340909090909091,
"repo_name": "DinoCow/airflow",
"id": "5009647593e49c8fb1f03ac1c062357da9b19ba0",
"size": "1227"... |
from test_framework.test_framework import MincoinTestFramework
from test_framework.util import *
from test_framework.mininode import CTransaction, NetworkThread
from test_framework.blocktools import create_coinbase, create_block, add_witness_commitment
from test_framework.script import CScript
from io import BytesIO
im... | {
"content_hash": "153b7f50cf4a71b97603e748a51f5031",
"timestamp": "",
"source": "github",
"line_count": 143,
"max_line_length": 137,
"avg_line_length": 44.22377622377623,
"alnum_prop": 0.6570208728652751,
"repo_name": "mincoin-project/mincoin",
"id": "d907844ed4b319cee8fa5e69eb3b599e0b5a16a8",
"siz... |
class Generator(object):
def __init__(self, manager):
self.__init_attributes(manager)
self.__sigid1 = manager.connect("generate-dictionary", self.__generate_cb)
def __init_attributes(self, manager):
self.__manager = manager
from re import UNICODE, compile
self.__pattern = compile(r"[^-\w]", UNICODE)
fro... | {
"content_hash": "2f9501a684efddea42b3d871af5a8cc4",
"timestamp": "",
"source": "github",
"line_count": 54,
"max_line_length": 76,
"avg_line_length": 28.61111111111111,
"alnum_prop": 0.6802588996763754,
"repo_name": "baverman/scribes-goodies",
"id": "9900ee31be8b7de1348da20efcb2cfec34ed9612",
"size... |
import datetime
import factory
from django.utils.timezone import utc
from openbudget.apps.accounts.factories import AccountFactory
from openbudget.apps.sheets.factories import TemplateFactory, TemplateNodeFactory
from openbudget.apps.taxonomies.models import Taxonomy, Tag, TaggedNode
class TaxonomyFactory(factory.Dja... | {
"content_hash": "85b6effe782b49f332faab141e906b28",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 89,
"avg_line_length": 32.76,
"alnum_prop": 0.7307692307692307,
"repo_name": "nborwankar/open-budgets",
"id": "08a0aace0caec70ae9534910ee9e0cdb8cd8ad23",
"size": "1638",
... |
from datetime import datetime, timedelta
from airflow import DAG
from airflow.decorators import task
from airflow.providers.amazon.aws.hooks.sqs import SqsHook
from airflow.providers.amazon.aws.operators.sqs import SqsPublishOperator
from airflow.providers.amazon.aws.sensors.sqs import SqsSensor
QUEUE_NAME = 'Airflow... | {
"content_hash": "7f08c90aa246808eb8ee64aefa96559e",
"timestamp": "",
"source": "github",
"line_count": 64,
"max_line_length": 80,
"avg_line_length": 30.0625,
"alnum_prop": 0.682952182952183,
"repo_name": "mistercrunch/airflow",
"id": "acf8c12e3292dceb7a09dd004dbbea0ee58ab683",
"size": "2710",
"b... |
"""
A utils for Markdown
convert : render markdown to html
get_toc : Get the Table of Content
get_images: Return a list of images, can be used to extract the top image
"""
import os
import markdown
from jinja2.nodes import CallBlock
from jinja2.ext import Extension
# ------------------------------------------------... | {
"content_hash": "560c344eb04f89e08893bf8ca3c05fde",
"timestamp": "",
"source": "github",
"line_count": 100,
"max_line_length": 80,
"avg_line_length": 24.82,
"alnum_prop": 0.5535858178887993,
"repo_name": "mardix/mambo",
"id": "1eda0ebf49d0778c793721097fab1ece602be8d6",
"size": "2482",
"binary": ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.