text stringlengths 4 1.02M | meta dict |
|---|---|
from PyDAQmx import *
import numpy
def take_data_2chan(num_points, sampling_rate):
"""
Take `num_points` from the NIDAQ
"""
analog_input = Task()
read = int32()
data_size = 2*num_points
data = numpy.zeros((data_size), dtype=numpy.float64)
# DAQmx Configure Code
analog_input.CreateAIVoltageChan("Dev1/ai0:1",... | {
"content_hash": "0e78617e3d82ee163cc680bfb04017f9",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 104,
"avg_line_length": 26.56,
"alnum_prop": 0.7259036144578314,
"repo_name": "BBN-Q/Qlab",
"id": "ce57411c51123263ef0f55f256cc9096c6fff39f",
"size": "664",
"binary": fal... |
__test__ = {"doctest": """
>>> from testsuite.tsearch2_gis.models import Location
>>> from django.contrib.gis.geos import Point
>>> Location.objects.create(name=u"Mario's Pizza", latlon=Point(12.4604, 43.9420))
<Location: Mario's Pizza>
>>> Location.objects.update_index()
>>> Location.objects.search("mario")
[<Locat... | {
"content_hash": "260d5a25f0e480df3df0eb5434e42576",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 82,
"avg_line_length": 24.25,
"alnum_prop": 0.6855670103092784,
"repo_name": "hcarvalhoalves/django-tsearch2",
"id": "eb612a09f41b12dfd3397161796c36087fc175ee",
"size": "40... |
import os
import sys
try:
import syslog
except ImportError:
syslog = None
import platform
import types
from .log import DefaultFilter
ENV_PREFIX = 'KAIRA_'
_address_dict = {
'Windows': ('localhost', 514),
'Darwin': '/var/run/syslog',
'Linux': '/dev/log',
'FreeBSD': '/dev/log'
}
LOGGING = {
... | {
"content_hash": "8769d19e15fbd2fda2543e37d592f8f7",
"timestamp": "",
"source": "github",
"line_count": 178,
"max_line_length": 78,
"avg_line_length": 33.2752808988764,
"alnum_prop": 0.5353705892284315,
"repo_name": "mulonemartin/kaira",
"id": "88757fad31017f85299d481559b8b3365584a5e9",
"size": "59... |
from django.contrib import admin
from .models import Link
class LinkAdmin(admin.ModelAdmin):
search_fields = ['title__icontains', 'description']
list_display = ['title', 'user', 'domain', 'active']
list_filter = ['user', 'active']
date_hierarchy = 'created_on'
admin.site.register(Link, LinkAdmin)
| {
"content_hash": "ba9f24a0442584af4fa70e6113c40e2b",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 56,
"avg_line_length": 24.53846153846154,
"alnum_prop": 0.6833855799373041,
"repo_name": "moshthepitt/product.co.ke",
"id": "094d7f606e62915e065e725b89fc3afc6e0caa57",
"siz... |
from __future__ import unicode_literals
from django.contrib.auth.models import User
from django.db import models
from django.template.defaultfilters import slugify
class Publicacion(models.Model):
titulo = models.CharField(max_length=50)
contenido = models.TextField()
autor = models.ForeignKey(User, on_d... | {
"content_hash": "e0fee448a556fd9f0879b1dd1d47f002",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 77,
"avg_line_length": 33.24,
"alnum_prop": 0.677496991576414,
"repo_name": "edwar/repositio.com",
"id": "bc81897d11ad5c1defae5f723a544ab0ed87a44b",
"size": "831",
"binar... |
"""Google Cloud Platform library - Cloud Storage Functionality."""
from __future__ import absolute_import
from ._bucket import Bucket, Buckets
from ._object import Object, Objects
__all__ = ['Bucket', 'Buckets', 'Object', 'Objects']
| {
"content_hash": "f1424519cda80e0c38cf8669467c1467",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 66,
"avg_line_length": 33.57142857142857,
"alnum_prop": 0.7148936170212766,
"repo_name": "supriyagarg/pydatalab",
"id": "f68f853b415b5f99fae1de77581b07a69cabc29d",
"size": "... |
import os
import django
# Calculated paths for django and the site
# Used as starting points for various other paths
# Thanks to Gareth Rushgrove:
# http://www.morethanseven.net/2009/02/11/django-settings-tip-setting-relative-paths/
DJANGO_ROOT = os.path.dirname(os.path.realpath(django.__file__))
SITE_ROOT = os.path.d... | {
"content_hash": "fd450fd2b93547a9cf33711471aa8379",
"timestamp": "",
"source": "github",
"line_count": 205,
"max_line_length": 101,
"avg_line_length": 33.53658536585366,
"alnum_prop": 0.645090909090909,
"repo_name": "jimivdw/OMFraF",
"id": "90631633a66c286b0a9292f741f3c816bb7f1484",
"size": "6875"... |
from __future__ import unicode_literals
from django.db import models
# Create your models here.
class Registrado(models.Model):
nombre = models.CharField(max_length=120, blank=True, null=True)
email = models.EmailField()
codigo_postal = models.IntegerField(blank=True, null=True)
timestamp = models.DateTimeField(... | {
"content_hash": "6cd9560ba36ffee118779a0cb8d5af0e",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 95,
"avg_line_length": 34.411764705882355,
"alnum_prop": 0.7521367521367521,
"repo_name": "probardjango/Probar-Django-1.9",
"id": "adf9ea91782a8b2ecc810927eef58a04a149cd81",
... |
from flask_webtest import SessionScope
from pytest import fixture
from portal.database import db
from portal.models.questionnaire_bank import (
QuestionnaireBank,
QuestionnaireBankQuestionnaire
)
from portal.models.recur import Recur
@fixture
def initialized_with_ss_qb(
initialized_with_ss_protocol, ... | {
"content_hash": "9975e6d5097e431fdf5bfc55b00328bd",
"timestamp": "",
"source": "github",
"line_count": 51,
"max_line_length": 61,
"avg_line_length": 31.019607843137255,
"alnum_prop": 0.6599241466498104,
"repo_name": "uwcirg/true_nth_usa_portal",
"id": "a54cff346a634f29eab4ba4fe8683c7f7fe77c5a",
"s... |
import ConfigParser
import os
import tarfile
import urllib2
# Default client libs
import glanceclient as glance_client
import keystoneclient.v2_0.client as keystone_client
# Import Openstack exceptions
import glanceclient.exc as glance_exception
import keystoneclient.exceptions as keystone_exception
TEMPEST_TEMP_DI... | {
"content_hash": "0df2e3d2e381db3ea5b0a85942582e3d",
"timestamp": "",
"source": "github",
"line_count": 370,
"max_line_length": 79,
"avg_line_length": 37.95135135135135,
"alnum_prop": 0.6306793904002279,
"repo_name": "eltonkevani/tempest_el_env",
"id": "fe9f5afef19ae90f5d96369d452a27d49a1756b9",
"s... |
from __future__ import print_function
import core
import numpy
import six.moves as six
from framework import Variable, default_main_program
__all__ = ['DataFeeder']
class DataToLoDTensorConverter(object):
def __init__(self, place, lod_level, shape, dtype):
self.place = place
self.lod_level = lod... | {
"content_hash": "2871619d46da6f1e9f9d35e90146574d",
"timestamp": "",
"source": "github",
"line_count": 104,
"max_line_length": 80,
"avg_line_length": 35.25,
"alnum_prop": 0.5365521003818876,
"repo_name": "lcy-seso/Paddle",
"id": "ac02401c79b787716b2e5f43e0d1c5686cf2bd13",
"size": "4279",
"binary... |
"""
A simple gauge with a label that is suitable for use in places like a
status bar. It can be used in either an automatic indeterminant
(pulse) mode or in determinante mode where the programmer will need to
update the position of the progress bar. The indicator can be set to
hide itself when it is not active... | {
"content_hash": "fc97d47278b3e12da3b310c57aba158c",
"timestamp": "",
"source": "github",
"line_count": 141,
"max_line_length": 78,
"avg_line_length": 30.382978723404257,
"alnum_prop": 0.4992997198879552,
"repo_name": "ktan2020/legacy-automation",
"id": "30ab13edf8c885d1e41419bc99095d636bf9aa92",
"... |
from django.core.management.base import BaseCommand
from optparse import make_option
from sam.models import Quote
import os
class Command(BaseCommand):
help = 'This creates Quote objects from text file input or writes Quotes to text file'
option_list = BaseCommand.option_list + (
make_option('-r',
... | {
"content_hash": "a87bc1bbcb639c13273f6732655f4398",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 90,
"avg_line_length": 37.35,
"alnum_prop": 0.500669344042838,
"repo_name": "samolds/samster",
"id": "5e37ab7b25882c7bc3a265e6b0218dbb3b55644b",
"size": "1494",
"binary":... |
"""Grow.dev setup."""
import re
from setuptools import find_packages
from setuptools import setup
DEP_RE = re.compile(r'([\S]*)\s?=\s? [\"\']?([^\'\"]*)[\"\']?', re.IGNORECASE)
INSTALL_REQ = []
with open('Pipfile') as pipfile:
in_dep_section = False
for line in pipfile.readlines():
line = line.strip... | {
"content_hash": "c32c63a0aef3df61c495c7e43b7de964",
"timestamp": "",
"source": "github",
"line_count": 68,
"max_line_length": 87,
"avg_line_length": 29.191176470588236,
"alnum_prop": 0.5546599496221662,
"repo_name": "grow/grow",
"id": "199e2ed5543d4da0c60d840c75a44290666b7aba",
"size": "1985",
"... |
import json
import os
import pstats
import shutil
import sys
import tempfile
import unittest
from io import StringIO
from subprocess import Popen, PIPE
from scrapy.utils.test import get_testenv
class CmdlineTest(unittest.TestCase):
def setUp(self):
self.env = get_testenv()
self.env['SCRAPY_SETTI... | {
"content_hash": "0ad22808ff5ce08a57ce405cb91362b4",
"timestamp": "",
"source": "github",
"line_count": 66,
"max_line_length": 81,
"avg_line_length": 37.68181818181818,
"alnum_prop": 0.5930840369923602,
"repo_name": "eLRuLL/scrapy",
"id": "da99a6be8289471b0ae8337d0795263ae633fa05",
"size": "2487",
... |
from plantcv.plantcv._debug import _debug
from plantcv.plantcv import dilate
from plantcv.plantcv import params
from plantcv.plantcv import fatal_error
from skimage import feature
import numpy as np
import cv2
import os
def canny_edge_detect(img, mask=None, sigma=1.0, low_thresh=None, high_thresh=None, thickness=1,
... | {
"content_hash": "120b978c95e45612f5c2423de97473e3",
"timestamp": "",
"source": "github",
"line_count": 85,
"max_line_length": 120,
"avg_line_length": 40.71764705882353,
"alnum_prop": 0.6579023403640566,
"repo_name": "danforthcenter/plantcv",
"id": "753dab985d5ba58e2b82411c42ec95d611a6388e",
"size"... |
import sys
import os
import bpy
from bpy_extras.io_utils import ExportHelper
bl_info = {
"name": "treeface exporter",
"author": "Xi Yang",
"location": "File > Export",
"description": "export scene to treeface JSON format",
"category": "Import-Export",
}
def format_matrix(mat):
... | {
"content_hash": "0f4024c1dd29e7ba7dfec3a4eacd08e0",
"timestamp": "",
"source": "github",
"line_count": 383,
"max_line_length": 160,
"avg_line_length": 34.67624020887728,
"alnum_prop": 0.516301483322039,
"repo_name": "jiandingzhe/treeface",
"id": "5554b0f4f1e3a5312823aff9ca24aff30959ddd6",
"size": ... |
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('reddit', '0005_auto_20180726_2126'),
]
operations = [
migrations.AlterField(
model_name='post',
name='status',
field=models.CharField(choices=[('accepted... | {
"content_hash": "003a439ca6428c2cbd4673405679442c",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 179,
"avg_line_length": 28.9375,
"alnum_prop": 0.5831533477321814,
"repo_name": "vaniakosmos/memes-reposter",
"id": "105a198e3e7922ca84631193c5207200ed840353",
"size": "512... |
"""
Gateway for Binance Crypto Exchange.
"""
import urllib
import hashlib
import hmac
import time
from copy import copy
from datetime import datetime
from enum import Enum
from threading import Lock
from vnpy.api.rest import RestClient, Request
from vnpy.api.websocket import WebsocketClient
from vnpy.trader.constant ... | {
"content_hash": "49a61d37fb5c47ffa15adf5c22686103",
"timestamp": "",
"source": "github",
"line_count": 679,
"max_line_length": 84,
"avg_line_length": 27.197349042709867,
"alnum_prop": 0.5262359885200628,
"repo_name": "andrewchenshx/vnpy",
"id": "b3454d711384882394cb2a7214c2804e588924e5",
"size": "... |
import typing
from ... import exc
from ... import util
from ...sql import coercions
from ...sql import elements
from ...sql import operators
from ...sql import roles
from ...sql.base import _generative
from ...sql.base import Generative
Selfmatch = typing.TypeVar("Selfmatch", bound="match")
class match(Generative,... | {
"content_hash": "454cdafb4f0031b90dcd00d02e8bd09b",
"timestamp": "",
"source": "github",
"line_count": 136,
"max_line_length": 79,
"avg_line_length": 28.764705882352942,
"alnum_prop": 0.6083844580777096,
"repo_name": "zzzeek/sqlalchemy",
"id": "561803a78d8bdf98ddd37a17e3f8b925287c5303",
"size": "4... |
import pickle
from datetime import timedelta
from redis import Redis
from werkzeug.datastructures import CallbackDict
from flask.sessions import SessionInterface, SessionMixin
from util import random_base64
"""
From http://flask.pocoo.org/snippets/75/
modified session ID generation to ensure better randomness
"""
c... | {
"content_hash": "2df9b9077c1b4a524b359ed51dadaa5f",
"timestamp": "",
"source": "github",
"line_count": 71,
"max_line_length": 65,
"avg_line_length": 33.901408450704224,
"alnum_prop": 0.6186123805567096,
"repo_name": "icedevml/webcrypto-rsa-login",
"id": "2081584ec05d6d808148ad0e5f5c52c2427e7876",
... |
"""
Takes care of reading from BAM files and scattering (parallelizing) pipelines
See docs/bamtoolz.md for algorithm details"""
from collections import OrderedDict
import time
from multiprocessing import Process, Queue
import queue
import pysam
import cytoolz.curried as cyt
import logging
logger = logging.getLogger(... | {
"content_hash": "90498d9e94927427f1f945fe611b023a",
"timestamp": "",
"source": "github",
"line_count": 339,
"max_line_length": 111,
"avg_line_length": 36.36873156342183,
"alnum_prop": 0.6381701678968286,
"repo_name": "sbg/Mitty",
"id": "3e6139fe1a7c9a3042638b070028f7c3e52b865e",
"size": "12331",
... |
from __future__ import unicode_literals
from moto.core.responses import BaseResponse
from moto.ec2.utils import sequence_from_querystring
class ElasticIPAddresses(BaseResponse):
def allocate_address(self):
if "Domain" in self.querystring:
domain = self.querystring.get('Domain')[0]
els... | {
"content_hash": "6929b1211559f16c235f75cb335ce3e7",
"timestamp": "",
"source": "github",
"line_count": 161,
"max_line_length": 120,
"avg_line_length": 44.82608695652174,
"alnum_prop": 0.6128585284744353,
"repo_name": "gjtempleton/moto",
"id": "a64a33bb5dcbd2dcb3ee2abf8b0110ca90495458",
"size": "72... |
AUTHFAILURE = 'AuthFailure'
# DryRun 操作,代表请求将会是成功的,只是多传了 DryRun 参数。
DRYRUNOPERATION = 'DryRunOperation'
# 操作失败。
FAILEDOPERATION = 'FailedOperation'
# 内部错误。
INTERNALERROR = 'InternalError'
# 参数错误。
INVALIDPARAMETER = 'InvalidParameter'
# 参数取值错误。
INVALIDPARAMETERVALUE = 'InvalidParameterValue'
# 超过配额限制。
LIMITEXCEEDE... | {
"content_hash": "7d986fe5f2f818673a8ce0f8bea30d5e",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 73,
"avg_line_length": 18.254545454545454,
"alnum_prop": 0.7878486055776892,
"repo_name": "tzpBingo/github-trending",
"id": "94a1c8ef71f603c85dd9fbed3f02d0c8a5f5eba6",
"siz... |
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_Dialog(object):
def setupUi(self, Dialog):
Dialog.setObjectName("Dialog")
Dialog.resize(1375, 827)
self.verticalLayout = QtWidgets.QVBoxLayout(Dialog)
self.verticalLayout.setObjectName("verticalLayout")
self.tabWidget = QtW... | {
"content_hash": "e86cdd3dd0fb0886d0744855e4de6dba",
"timestamp": "",
"source": "github",
"line_count": 222,
"max_line_length": 117,
"avg_line_length": 63.9054054054054,
"alnum_prop": 0.7168534573905688,
"repo_name": "mdoucet/reflectivity_ui",
"id": "b77f9d2c37ba1bb310c6c3884b806c38da89ce78",
"size... |
from heat.openstack.common.notifier import api as notifier_api
from heat.engine import api as engine_api
from heat.engine import notification
def send(stack):
"""Send usage notifications to the configured notification driver."""
# The current notifications have a start/end:
# see: https://wiki.openstack... | {
"content_hash": "610de7b789cbe99953f3cb443921aed1",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 78,
"avg_line_length": 33.75,
"alnum_prop": 0.6275132275132275,
"repo_name": "ntt-sic/heat",
"id": "516090ca7c4a95415c053d11d88cee76390daf62",
"size": "1520",
"binary": f... |
print('Enter your age:')
age = int(input())
# if age >= 21:
# print('You are legal here.')
# else:
# print('Your are illegal here.')
print('You are legal here.') if age >= 21 else print('Your are illegal here.')
| {
"content_hash": "3387ddc999c96625168857935231e49f",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 78,
"avg_line_length": 27.625,
"alnum_prop": 0.6153846153846154,
"repo_name": "KristianMariyanov/PythonPlayground",
"id": "5bc188092f2c5159c1da98a0bde2db71fcd0b517",
"size":... |
import CsHelper
from CsDatabag import CsCmdLine
import logging
class CsChain(object):
def __init__(self):
self.chain = {}
self.last_added = ''
self.count = {}
def add(self, table, chain):
if table not in self.chain.keys():
self.chain.setdefault(table, []).append(c... | {
"content_hash": "7456b53eba9f115f9ad344bc1c01611d",
"timestamp": "",
"source": "github",
"line_count": 297,
"max_line_length": 156,
"avg_line_length": 34.66329966329966,
"alnum_prop": 0.5159786304031083,
"repo_name": "DaanHoogland/cloudstack",
"id": "01dfa7cac39917f8dceb6630105b56ab93c8672a",
"siz... |
class ChatterboxException(Exception):
pass
class RateLimitException(ChatterboxException):
pass
class KeyInvalidationException(ChatterboxException):
pass
| {
"content_hash": "b5adb67fad365e27b6f3d834f344638d",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 52,
"avg_line_length": 16.9,
"alnum_prop": 0.7988165680473372,
"repo_name": "blitzagency/django-chatterbox",
"id": "5b0cfd74366e54241c85a10f1c75b9126a4ba72f",
"size": "169"... |
import os
import pytest
from datadog_checks.dev import docker_run
from datadog_checks.dev.conditions import CheckDockerLogs
from datadog_checks.dev.utils import load_jmx_config
from . import common
@pytest.fixture(scope='session')
def dd_environment():
compose_file = os.path.join(common.HERE, 'docker', 'docker... | {
"content_hash": "0059197e8643431973d051227bcfc9f9",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 119,
"avg_line_length": 30.35,
"alnum_prop": 0.7051070840197694,
"repo_name": "DataDog/integrations-core",
"id": "4aff5f384f932a889e33dae6eed8707c7f17b5c4",
"size": "722",
... |
"""Tests for the Atag climate platform."""
from unittest.mock import PropertyMock, patch
from homeassistant.components.atag.climate import DOMAIN, PRESET_MAP
from homeassistant.components.climate import (
ATTR_HVAC_ACTION,
ATTR_HVAC_MODE,
ATTR_PRESET_MODE,
HVAC_MODE_HEAT,
SERVICE_SET_HVAC_MODE,
... | {
"content_hash": "8ae143096a2e07a6792e40a00f07fef3",
"timestamp": "",
"source": "github",
"line_count": 108,
"max_line_length": 88,
"avg_line_length": 36.398148148148145,
"alnum_prop": 0.6932078351564488,
"repo_name": "home-assistant/home-assistant",
"id": "ba6bc892e40c2805083532dc3155b04acfc4bf72",
... |
from attendly import *
VERSION='0.2.3' | {
"content_hash": "742920d114a50645413dd286c13ef828",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 22,
"avg_line_length": 13,
"alnum_prop": 0.717948717948718,
"repo_name": "Attendly/attendly-python",
"id": "c7a60043ce1277de2d104acb6085938eeaf3e922",
"size": "39",
"binar... |
'''
Author: sapatel91
Date: March 30, 2014
File: TestSendSOAP.py
Purpose: Send SOAP Commands to C4
Disclaimer: USE AT YOUR RISK, I TAKE NO RESPONSIBILITY
Most likely there won't be any though
'''
from Modules.PyControl4 import *
# Establish Connection
# NOTE: IP Address will be different f... | {
"content_hash": "2d3b3e94ec94912f611add8e264d658c",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 244,
"avg_line_length": 33.9,
"alnum_prop": 0.7168141592920354,
"repo_name": "sapatel91/pyControl4",
"id": "5929eaecb01bfdec6572ac623db110cf7a3ddc1d",
"size": "678",
"bin... |
from parsimonious import Grammar
from parsimonious.exceptions import ParseError
from parsimonious.nodes import NodeVisitor, VisitationError
from turing.utils.normalize import get_state_name_norm
norm_state = get_state_name_norm()
class TuringSyntaxError(VisitationError):
def __init__(self, text, pos):
... | {
"content_hash": "d111164d946ab053e6be040a37bd5139",
"timestamp": "",
"source": "github",
"line_count": 265,
"max_line_length": 97,
"avg_line_length": 25.381132075471697,
"alnum_prop": 0.5422242045792447,
"repo_name": "myaskevich/turing",
"id": "aced871c841e30d50ace24ef933246510fce571a",
"size": "6... |
from django.contrib.contenttypes.models import ContentType
from django.test.client import RequestFactory
from kitsune.access.helpers import has_perm, has_perm_or_owns
from kitsune.access.tests import permission
from kitsune.forums.tests import ForumTestCase, forum, thread
from kitsune.sumo.urlresolvers import reverse
... | {
"content_hash": "be31bf0a8daa221d63b51a173dfad635",
"timestamp": "",
"source": "github",
"line_count": 125,
"max_line_length": 78,
"avg_line_length": 43.136,
"alnum_prop": 0.6008902077151336,
"repo_name": "silentbob73/kitsune",
"id": "bef841ca25962804b119bed1be5079a2d3bef000",
"size": "5392",
"b... |
"""
Cisco Zone Driver is responsible to manage access control using FC zoning
for Cisco FC fabrics.
This is a concrete implementation of FCZoneDriver interface implementing
add_connection and delete_connection interfaces.
**Related Flags**
:zone_activate: Used by: class: 'FCZoneDriver'. Defaults to True
:zone_name_pr... | {
"content_hash": "29914cb36a720776baeb988f30c2dc3b",
"timestamp": "",
"source": "github",
"line_count": 476,
"max_line_length": 79,
"avg_line_length": 47.42226890756302,
"alnum_prop": 0.5017498781730386,
"repo_name": "tmenjo/cinder-2015.1.0",
"id": "2878ce3a51579e70afaf52ab2d8fd79bedc99d52",
"size"... |
import subprocess
import os
import sys
import time
import re
import socket
import socketserver
import threading
import copy
from pynhost import constants, objutils
from pynhost.platforms import platformhandler
class BaseEngine:
def __init__(self):
pass
def get_lines(self):
'''This should alway... | {
"content_hash": "de4ffa2a31bf9c0c82568d77142cc240",
"timestamp": "",
"source": "github",
"line_count": 159,
"max_line_length": 114,
"avg_line_length": 33.57861635220126,
"alnum_prop": 0.572017231691328,
"repo_name": "evfredericksen/pynacea",
"id": "90e6d7cc9685109b9a44986bc55335bb74ca0439",
"size"... |
from setuptools import setup
setup(
name='vmfusion',
version='0.2.0',
author='Mario Steinhoff',
author_email='steinhoff.mario@gmail.com',
packages=['vmfusion'],
url='https://github.com/msteinhoff/vmfusion-python',
license='LICENSE.txt',
description='A python API for the VMware Fusion CL... | {
"content_hash": "c843da40d4481daa58e219b4084daa61",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 64,
"avg_line_length": 27.375,
"alnum_prop": 0.6484018264840182,
"repo_name": "msteinhoff/vmfusion-python",
"id": "de3f1d246a61a4f5da0e11f2f0994ae5a077cf87",
"size": "438",... |
import re
import sys
class Configuration:
''' This class provides storage for the application configuration
and an interface to a configuration file
'''
def __init__(self, filepath):
''' On instantiation time the regexes for matching the
properties in the configuration file ar... | {
"content_hash": "00187ac4916336b58563fba110bbdc46",
"timestamp": "",
"source": "github",
"line_count": 67,
"max_line_length": 110,
"avg_line_length": 43.55223880597015,
"alnum_prop": 0.526045236463331,
"repo_name": "mrtazz/twsh",
"id": "089184be3408edfec9e4916620614721550e1692",
"size": "2918",
... |
import pandas as pd
import numpy as np
import nltk as nlp
import matplotlib.pyplot as plt
import importlib
import re
# Custom modules
import database
# Reload custom modules
def reloadall():
global database
database = importlib.reload(database)
print("Begin Main")
# Initialize variables
db = database.In... | {
"content_hash": "12a45330731e1a8e38712acf23ad6f10",
"timestamp": "",
"source": "github",
"line_count": 68,
"max_line_length": 116,
"avg_line_length": 26.897058823529413,
"alnum_prop": 0.7282668124658284,
"repo_name": "Christoph/PythonTest",
"id": "38dbe2db601409796c2bd7876155c1f20283b88b",
"size":... |
from unittest import TestCase
from unittest import main
from pylegos.core import Inspector
#USE CASE 1: Called from the different types of methods that can be contained inside a class
class sut1(object):
#USE CASE 2: Called from a nested class
class sut1nested(object):
@staticmethod
def getC... | {
"content_hash": "9c849c2cb63df92e191181fa0fa4db52",
"timestamp": "",
"source": "github",
"line_count": 120,
"max_line_length": 204,
"avg_line_length": 47.61666666666667,
"alnum_prop": 0.6825341267063353,
"repo_name": "velexio/pyLegos",
"id": "50470837b38c1d876838c23e8664e85075605158",
"size": "571... |
import sys
import pybindgen
from pybindgen import ReturnValue, Parameter, Module, Function, FileCodeSink
from pybindgen import CppMethod, CppConstructor, CppClass, Enum
def my_module_gen(out_file):
mod = Module('b')
mod.add_include('"b.h"')
B = mod.add_class('B')
B.add_constructor([])
B.add_cop... | {
"content_hash": "c6f6eab59c859033096a7d5d5262912b",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 76,
"avg_line_length": 27.4,
"alnum_prop": 0.6613138686131387,
"repo_name": "softDi/clusim",
"id": "7c65ef0eff5e5355c8af9896061de17571a57565",
"size": "709",
"binary": fa... |
class MarkdAsDriverException(Exception):
"""
Wrap any error as DriverException
"""
def __init__(self, wrapped_exc):
super().__init__()
self.wrapped_exc = wrapped_exc
| {
"content_hash": "7b445c343791c15b92a591cd7d1de676",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 40,
"avg_line_length": 28.285714285714285,
"alnum_prop": 0.601010101010101,
"repo_name": "neo4j/neo4j-python-driver",
"id": "042eab8c02dda052664bed07917dfe260864c4cf",
"size... |
import string
def sanitiseLine(line):
if line[-1:] == '\n': line = line[:-1]
if string.find(line, "##") != -1:
line = line[:string.find(line, "##")]
line = string.strip(line)
return line
def decodeFunction(featureVal):
retType, rest = string.split(featureVal, " ", 1)
nameIdent, params = string.spl... | {
"content_hash": "be3ada268d7393478c2b7352b545b044",
"timestamp": "",
"source": "github",
"line_count": 106,
"max_line_length": 71,
"avg_line_length": 31.17924528301887,
"alnum_prop": 0.5851739788199698,
"repo_name": "segafan/wme1_jankavan_tlc_edition-repo",
"id": "59ada3dce3dcc18462df9529f3866d68f90... |
"""Bijector base."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import abc
import collections
import contextlib
import re
import numpy as np
import six
from tensorflow.python.framework import dtypes
from tensorflow.python.framework import ops
from te... | {
"content_hash": "1ddbb5f3441919d229db3ce89720d274",
"timestamp": "",
"source": "github",
"line_count": 813,
"max_line_length": 80,
"avg_line_length": 35.779827798277985,
"alnum_prop": 0.6465674309876586,
"repo_name": "rabipanda/tensorflow",
"id": "44d64070ce48c0c115ea7edb1237124bc6698e90",
"size":... |
import pytest
from parameterized import parameterized
from airflow.plugins_manager import AirflowPlugin
from airflow.security import permissions
from tests.test_utils.api_connexion_utils import assert_401, create_user, delete_user
from tests.test_utils.config import conf_vars
from tests.test_utils.mock_plugins import ... | {
"content_hash": "ca549f689f212677644bb790042cc92a",
"timestamp": "",
"source": "github",
"line_count": 167,
"max_line_length": 110,
"avg_line_length": 38.5748502994012,
"alnum_prop": 0.5605402049053089,
"repo_name": "Acehaidrey/incubator-airflow",
"id": "669a2f31e294e2c19c0324c5bb89ca54080299ff",
... |
from __future__ import print_function
try:
# Python 2
import ConfigParser
except ImportError:
# Python 3
import configparser as ConfigParser
import os
import sys
sys.path.append(os.path.join(os.path.dirname(__file__), 'swift_build_support'))
# E402 means module level import not at top of file
from s... | {
"content_hash": "274e7f4a5b78ceb61b21cab25a44d3e9",
"timestamp": "",
"source": "github",
"line_count": 170,
"max_line_length": 79,
"avg_line_length": 36.22352941176471,
"alnum_prop": 0.6070152646963299,
"repo_name": "russbishop/swift",
"id": "bf5a117108389cd0fef2932fc2cc53d47a27e20c",
"size": "658... |
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('teams', '0001_initial'),
('substitutes', '0001_initial'),
('invites', '0004_auto_20180105_0213'),
]
operations = [
migrations.AlterUniqueTog... | {
"content_hash": "fe6c234ae29e11092d2f73a96c768971",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 51,
"avg_line_length": 22.894736842105264,
"alnum_prop": 0.5839080459770115,
"repo_name": "eSmelser/SnookR",
"id": "9eefdb3de321effc9d9e668b40c9019f33d82a58",
"size": "508"... |
PILE_OF_POO = u"\U0001F4A9"
def pytest_addoption(parser):
group = parser.getgroup('Poo', 'Poo')
group._addoption('--poo',
action="store_true", dest="poo", default=False,
help="Show crappy tests.")
def pytest_report_teststatus(report, config):
if (not config.option... | {
"content_hash": "b4246ecd619e1c167574492c5da0ed4a",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 95,
"avg_line_length": 37.38095238095238,
"alnum_prop": 0.6127388535031847,
"repo_name": "pelme/pytest-poo",
"id": "9fa6f1edaad3118be712c8f157f9fbf2557848cb",
"size": "786"... |
import os
PROJECT_DIR = os.path.dirname(os.path.realpath(__file__))
ENVIRONMENT_DIR = os.path.abspath(os.path.join(PROJECT_DIR, "..", "..", ".."))
HTDOCS_DIR = os.path.join(ENVIRONMENT_DIR, 'htdocs',)
LOG_DIR = os.path.join(ENVIRONMENT_DIR, 'var', 'log')
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ("Example"... | {
"content_hash": "732621c29b46f791c428a8f95c4065b0",
"timestamp": "",
"source": "github",
"line_count": 212,
"max_line_length": 108,
"avg_line_length": 32.02358490566038,
"alnum_prop": 0.6640153188982177,
"repo_name": "JoeJasinski/password-safe",
"id": "db3e3d3bfe2ecb44bffbd14beaceb18bd1ac7aef",
"s... |
import utils
import sys
import sortClass
class InsertionSort(sortClass.SortClass):
@staticmethod
def findSlot(myList, value, max):
for i in range(max):
if (value < myList[i]):
return i
return max-1
@staticmethod
def basicSort(myList):
# If the length is one or zero
# Nothing more to do.
# List is... | {
"content_hash": "0c1156c01db81c660502cab36b2f86d0",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 51,
"avg_line_length": 21.026315789473685,
"alnum_prop": 0.6795994993742178,
"repo_name": "bhagatyj/algorithms",
"id": "1c4bb4446a5d7975051bf48b0d599b0bc6f51ac0",
"size": "... |
from datetime import timedelta
from mock import patch
import re
from django.test import TestCase
from django.test.utils import override_settings
from django.utils.timezone import now
import requests
from .factories import ProxyGrantingTicketFactory
from .factories import ProxyTicketFactory
from .factories import Ser... | {
"content_hash": "b7225acafbfbf108379c3ece73f5880d",
"timestamp": "",
"source": "github",
"line_count": 552,
"max_line_length": 116,
"avg_line_length": 38.68840579710145,
"alnum_prop": 0.6234313541861772,
"repo_name": "orbitvu/django-mama-cas",
"id": "3d7cb6d447adc83f5b3a853c244d869f14d85c79",
"siz... |
'''
This checks if all command line args are documented.
Return value is 0 to indicate no error.
Author: @MarcoFalke
'''
from subprocess import check_output
import re
import sys
FOLDER_GREP = 'src'
FOLDER_TEST = 'src/test/'
REGEX_ARG = '(?:ForceSet|SoftSet|Get|Is)(?:Bool)?Args?(?:Set)?\("(-[^"]+)"'
REGEX_DOC = 'AddA... | {
"content_hash": "7cb0347823dc688cf6ab08cd09aa8d58",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 112,
"avg_line_length": 38.06382978723404,
"alnum_prop": 0.6467300167691448,
"repo_name": "droark/bitcoin",
"id": "3b05d5055cf1da072017458e0a698a487da1dafe",
"size": "2004"... |
from utils.codegen import format_type, get_detailed_extern_callinfos
from utils.extern import extern_has_tuple_params
from compiler_common import generate_var_name
from more_itertools import unique_everseen
#[ #include "dpdk_lib.h"
#[ #include "util_debug.h"
detailed_callinfos = get_detailed_extern_callinfos(hlir)
... | {
"content_hash": "2318f1b7de6278a913a1b7829b0aefcc",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 238,
"avg_line_length": 47.325581395348834,
"alnum_prop": 0.6845208845208846,
"repo_name": "P4ELTE/t4p4s",
"id": "6e0c6aeb50bf5d1bedef1213804d82d4cde5ddae",
"size": "2135",... |
from __future__ import (absolute_import, print_function, division)
import copy
import os
from netlib import tcp, certutils
from .. import stateobject, utils
class ClientConnection(tcp.BaseHandler, stateobject.StateObject):
def __init__(self, client_connection, address, server):
# Eventually, this object... | {
"content_hash": "dee8d02230b6eb97f6750d4f9cb0db30",
"timestamp": "",
"source": "github",
"line_count": 194,
"max_line_length": 105,
"avg_line_length": 30.95360824742268,
"alnum_prop": 0.5866777685262281,
"repo_name": "scriptmediala/mitmproxy",
"id": "f1e10de9f68ea3c020acd89d986293f5f6a15ba6",
"siz... |
from urllib3 import HTTPConnectionPool, HTTPSConnectionPool
from urllib3.poolmanager import proxy_from_url
from urllib3.exceptions import (
MaxRetryError,
ProxyError,
ReadTimeoutError,
SSLError,
ProtocolError,
)
from urllib3.response import httplib
from urllib3.util.ssl_ import H... | {
"content_hash": "f0446a81f5cd2d794e793ee19865ecec",
"timestamp": "",
"source": "github",
"line_count": 792,
"max_line_length": 108,
"avg_line_length": 35.39646464646464,
"alnum_prop": 0.5239708924876935,
"repo_name": "luca3m/urllib3",
"id": "5af00e0bf5d3e3c89c7eab3d4f2531c1853b9922",
"size": "2815... |
from rllab.baselines.linear_feature_baseline import LinearFeatureBaseline
from rllab.envs.normalized_env import normalize
from rllab.misc.instrument import stub, run_experiment_lite
from sandbox.snn4hrl.algos.trpo_snn import TRPO_snn
from sandbox.snn4hrl.bonus_evaluators.grid_bonus_evaluator import GridBonusEvaluator
f... | {
"content_hash": "a3253ebcbae04e8fe21244ea604e3959",
"timestamp": "",
"source": "github",
"line_count": 110,
"max_line_length": 90,
"avg_line_length": 36.18181818181818,
"alnum_prop": 0.6540201005025126,
"repo_name": "florensacc/snn4hrl",
"id": "02393c428a90678d5a11a5606e7c8b314fee3fb3",
"size": "3... |
import spinalcordtoolbox as sct
def main():
print(sct.__version__)
if __name__ == "__main__":
main()
| {
"content_hash": "a21860e4a0b776511230c21ded52ff27",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 31,
"avg_line_length": 12.555555555555555,
"alnum_prop": 0.5663716814159292,
"repo_name": "neuropoly/spinalcordtoolbox",
"id": "6eafa777b39dff7d5a6d6418a43268c86f10521f",
"s... |
"""Support for MySensors covers."""
from __future__ import annotations
from enum import Enum, unique
from typing import Any
from homeassistant.components import mysensors
from homeassistant.components.cover import ATTR_POSITION, DOMAIN, CoverEntity
from homeassistant.components.mysensors.const import MYSENSORS_DISCOV... | {
"content_hash": "b1aba3b944937141ab365156552fb72f",
"timestamp": "",
"source": "github",
"line_count": 153,
"max_line_length": 87,
"avg_line_length": 35.11764705882353,
"alnum_prop": 0.6195793783733482,
"repo_name": "lukas-hetzenecker/home-assistant",
"id": "9219097bea455b40ee4fe8fbe9f60c511082d058"... |
import math
import torch
import torch.nn as nn
from fairseq import utils
class SinusoidalPositionalEmbedding(nn.Module):
"""This module produces sinusoidal positional embeddings of any length.
Padding symbols are ignored, but it is necessary to specify whether padding
is added on the left side (left_pa... | {
"content_hash": "535f630cf458b264b12597429b10ba20",
"timestamp": "",
"source": "github",
"line_count": 69,
"max_line_length": 95,
"avg_line_length": 40.01449275362319,
"alnum_prop": 0.6247736327417602,
"repo_name": "mlperf/training_results_v0.6",
"id": "4b000e892eef4a94a3faa4477a9a878b3eca8f41",
"... |
"""
http://developer.openstack.org/api-ref-identity-v3.html#credentials-v3
"""
from oslo_serialization import jsonutils as json
from tempest.lib.common import rest_client
class CredentialsClient(rest_client.RestClient):
api_version = "v3"
def create_credential(self, **kwargs):
"""Creates a credenti... | {
"content_hash": "9315fc52fcf5f8ca3c7eadd12557c7cc",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 76,
"avg_line_length": 38.827586206896555,
"alnum_prop": 0.6309946714031972,
"repo_name": "LIS/lis-tempest",
"id": "6ab94d049596ff384fd39aa1348787f99001d028",
"size": "2888... |
"""
Shell utility functions which use non-blocking and eventlet / gevent friendly code.
"""
from __future__ import absolute_import
import os
import subprocess
import six
from st2common import log as logging
from st2common.util import concurrency
__all__ = ["run_command"]
TIMEOUT_EXIT_CODE = -9
LOG = logging.getL... | {
"content_hash": "5510adcd7826ca53019f861ee3c28d53",
"timestamp": "",
"source": "github",
"line_count": 225,
"max_line_length": 96,
"avg_line_length": 31.662222222222223,
"alnum_prop": 0.623385738349242,
"repo_name": "nzlosh/st2",
"id": "64830c9423c25c5e10f3ab13852b736caee2b6ef",
"size": "7752",
... |
import six
from django.db import models, transaction
from django.db.models import F, Max, Min
from django.contrib.comments.models import Comment
from django.contrib.contenttypes.models import ContentType
from django.utils.safestring import mark_safe
from django.utils.translation import ugettext, ugettext_lazy as _
fro... | {
"content_hash": "c7fabb4b897bce62584d22ece97bc949",
"timestamp": "",
"source": "github",
"line_count": 137,
"max_line_length": 132,
"avg_line_length": 36.737226277372265,
"alnum_prop": 0.6171269620504669,
"repo_name": "CantemoInternal/django-comments-xtd",
"id": "02ab19bf26c879ecfc5ea41cb55765cf6598... |
import datetime
from keystoneclient import access
from keystoneclient.openstack.common import timeutils
from keystoneclient.tests import client_fixtures as token_data
from keystoneclient.tests.v2_0 import client_fixtures
from keystoneclient.tests.v2_0 import utils
UNSCOPED_TOKEN = client_fixtures.UNSCOPED_TOKEN
PROJE... | {
"content_hash": "16612d4d23fa842051d428b6b62ed8b6",
"timestamp": "",
"source": "github",
"line_count": 109,
"max_line_length": 79,
"avg_line_length": 44.26605504587156,
"alnum_prop": 0.6905699481865285,
"repo_name": "ntt-sic/python-keystoneclient",
"id": "e097120e8220b1ccb5ecf52fb80c9505d90ef1de",
... |
"""Contains functionality to use flic buttons as a binary sensor."""
import asyncio
import logging
import voluptuous as vol
import homeassistant.helpers.config_validation as cv
from homeassistant.const import (
CONF_HOST, CONF_PORT, CONF_DISCOVERY, CONF_TIMEOUT,
EVENT_HOMEASSISTANT_STOP)
from homeassistant.co... | {
"content_hash": "f5f9bae456dbf42e5d49c0cdd8f06593",
"timestamp": "",
"source": "github",
"line_count": 257,
"max_line_length": 79,
"avg_line_length": 35.53307392996109,
"alnum_prop": 0.6371003066141042,
"repo_name": "ma314smith/home-assistant",
"id": "980af069f38dbb944d0478f1454d1eaa3c321181",
"si... |
import _plotly_utils.basevalidators
class NameValidator(_plotly_utils.basevalidators.StringValidator):
def __init__(self, plotly_name="name", parent_name="layout.mapbox.layer", **kwargs):
super(NameValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
... | {
"content_hash": "809cf80127b89c32e551080065c29231",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 88,
"avg_line_length": 37.083333333333336,
"alnum_prop": 0.6067415730337079,
"repo_name": "plotly/python-api",
"id": "d3b3e2d971a17c8b92fb2e68bcc9e5a0c8e471ea",
"size": "44... |
from morse.builder import *
# Land robot
ATRV = Robot('atrv')
Pose = Sensor('pose')
Pose.translate(x=-0.2000, z=0.9000)
ATRV.append(Pose)
Camera = Sensor('video_camera')
Camera.translate(x=0.2000, z=0.9000)
ATRV.append(Camera)
Motion_Controller = Actuator('waypoint')
ATRV.append(Motion_Controller)
# Scene configu... | {
"content_hash": "d8a727f7b9b4ed2ca294a505f9515585",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 40,
"avg_line_length": 20.708333333333332,
"alnum_prop": 0.7283702213279678,
"repo_name": "Arkapravo/morse-0.6",
"id": "ffa7a1c06ffe841d4d3813eab788492f91412c6c",
"size": "... |
"""
hyper/http20/bufsocket.py
~~~~~~~~~~~~~~~~~~~~~~~~~
This file implements a buffered socket wrapper.
The purpose of this is to avoid the overhead of unnecessary syscalls while
allowing small reads from the network. This represents a potentially massive
performance optimisation at the cost of burning some memory in... | {
"content_hash": "8f35784e2fd581bca39ddf89602dfc26",
"timestamp": "",
"source": "github",
"line_count": 316,
"max_line_length": 82,
"avg_line_length": 33.50316455696203,
"alnum_prop": 0.5800510059506943,
"repo_name": "qqzwc/XX-Net",
"id": "62c79cf58c94b9ac5237b181365867ed50f9033f",
"size": "10611",... |
import unittest
from sql import For, Table
class TestFor(unittest.TestCase):
def test_for(self):
for_ = For('UPDATE', Table('t1'), Table('t2'), nowait=True)
self.assertEqual(str(for_), 'FOR UPDATE OF "t1", "t2" NOWAIT')
| {
"content_hash": "81ba9f6e2d50d336edfe6840fda871c3",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 70,
"avg_line_length": 27,
"alnum_prop": 0.6378600823045267,
"repo_name": "shnergle/ShnergleServer",
"id": "cf0b940206e6dea8a27195030978dfcf4d44b154",
"size": "1853",
"bin... |
import os
import csv
from person import Person
import urllib2
class Members:
members = {}
def add(self, person):
self.members[person.name] = person
def parse_tsv(self, string):
lines = iter(string.splitlines())
r = csv.DictReader(lines, delimiter='\t')
for row in r:
... | {
"content_hash": "3a8bf8f7bf6717c4142737a1834b8868",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 108,
"avg_line_length": 29.517241379310345,
"alnum_prop": 0.5794392523364486,
"repo_name": "LandRegistry/team-dashboard",
"id": "c67c6cb06ad6d9bec3924a40493a869f38c65cc3",
... |
from huxley.api.tests import (DestroyAPITestCase, ListAPITestCase,
PartialUpdateAPITestCase, RetrieveAPITestCase)
from huxley.core.models import School
from huxley.utils.test import TestSchools, TestUsers
class SchoolDetailGetTestCase(RetrieveAPITestCase):
url_name = 'api:school_deta... | {
"content_hash": "70c50a2bb9ff4a638907a2b7f7905817",
"timestamp": "",
"source": "github",
"line_count": 226,
"max_line_length": 76,
"avg_line_length": 41.80530973451327,
"alnum_prop": 0.6436282811176969,
"repo_name": "ctmunwebmaster/huxley",
"id": "a4d3d780b0f9688df842cda599cc6feb58a73ab7",
"size":... |
"""Tasks related to format"""
import os
import subprocess
from artman.tasks import task_base
from artman.tasks.requirements import go_requirements
from artman.tasks.requirements import php_requirements
from artman.utils import task_utils
from artman.utils.logger import logger
# TODO: Store both intermediate and fin... | {
"content_hash": "236ce617b436ac1b0059fb70415948d1",
"timestamp": "",
"source": "github",
"line_count": 93,
"max_line_length": 79,
"avg_line_length": 37.53763440860215,
"alnum_prop": 0.6299054712116872,
"repo_name": "shinfan/artman",
"id": "a4c6e5f765c7851cfba24137e51bf824ee928a2d",
"size": "4084",... |
from language import pluralize
import termcolor
def colored(msg, color):
if color == 'term':
return msg
return termcolor.colored(msg, color)
class OutputWriter(object):
def __init__(self, stream, language, should_be_colored=True):
self._stream = stream
self._language = language
... | {
"content_hash": "5e29ed33650358c2149a39486266752b",
"timestamp": "",
"source": "github",
"line_count": 93,
"max_line_length": 77,
"avg_line_length": 45.795698924731184,
"alnum_prop": 0.45550598732096736,
"repo_name": "hltbra/pyhistorian",
"id": "30d38202b693e1b5d7d55618e83583c450389368",
"size": "... |
"""PT: PyTorch frontend."""
import itertools
import logging
import sys
import numpy as np
import tvm
from tvm.topi.util import get_const_tuple
from .. import analysis as _analysis
from .. import expr as _expr
from .. import op as _op
from ..ty import TupleType, TensorType, Any
from ..loops import while_loop
from .. ... | {
"content_hash": "9950fb45c27ab5c3ceefe271cac16072",
"timestamp": "",
"source": "github",
"line_count": 3360,
"max_line_length": 100,
"avg_line_length": 31.205952380952382,
"alnum_prop": 0.5607522984778545,
"repo_name": "sxjscience/tvm",
"id": "8e626f52d528202550b08d5209f9461bc65c3421",
"size": "10... |
import datetime
import dateutil.tz
from dateutil.parser import parse as parse_date
class AssetState:
"""AssetState is used instead of primitive state values (like ``2``, ``"a"``
or ``True``) when publishing data with a custom timestamp, i.e. not the
current timestamp at the time of publishing."""
def... | {
"content_hash": "e22e2d5f886298557e5f11af379b90cc",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 104,
"avg_line_length": 32.6,
"alnum_prop": 0.6108676599474145,
"repo_name": "allthingstalk/python-sdk",
"id": "5f686e143a32bae57f369806ca8d5856ee7c8707",
"size": "2040",
... |
"""Utilities for Backward differentiation formula (BDF) solver."""
import collections
import numpy as np
import tensorflow.compat.v1 as tf1
import tensorflow.compat.v2 as tf
from tensorflow_probability.python.internal import dtype_util
from tensorflow_probability.python.internal import prefer_static as ps
from tensorf... | {
"content_hash": "c6c4a13e4615f204d971e3c89bd0179e",
"timestamp": "",
"source": "github",
"line_count": 239,
"max_line_length": 80,
"avg_line_length": 40.55648535564853,
"alnum_prop": 0.6673888373052719,
"repo_name": "tensorflow/probability",
"id": "349456b2bba4e2d931682e759fc2dc90ae7800cd",
"size"... |
import time
from collections import defaultdict
import operator
# Below are two codes to read the file, we will be going with the non list comprehension version
def readtext(filename):
with open(filename) as f:
txtlines = [[str(s) for s in line.rstrip("\n").split(" ")] for line in f]
return txtlines
de... | {
"content_hash": "6cd26ac6850215abb1d9d0bc756b45ec",
"timestamp": "",
"source": "github",
"line_count": 122,
"max_line_length": 96,
"avg_line_length": 32.467213114754095,
"alnum_prop": 0.6574097450138854,
"repo_name": "p10rahulm/Dmage",
"id": "28bb2d41d9b97784363d8074fcbf87069b823271",
"size": "396... |
'''Trains a stacked what-where autoencoder built on residual blocks on the
MNIST dataset. It exemplifies two influential methods that have been developed
in the past few years.
The first is the idea of properly "unpooling." During any max pool, the
exact location (the "where") of the maximal value in a pooled re... | {
"content_hash": "6b1e1f16b1f7a7ccb32a01f29b62d3ad",
"timestamp": "",
"source": "github",
"line_count": 167,
"max_line_length": 79,
"avg_line_length": 38.4251497005988,
"alnum_prop": 0.6909770920991117,
"repo_name": "dolaameng/keras",
"id": "56919072c9801ef8a82f19fa778833dcad5e821e",
"size": "6417"... |
from __future__ import absolute_import, division, print_function
from collections import namedtuple
from itertools import starmap
from timeit import default_timer
from time import sleep
from multiprocessing import Process, Pipe, current_process
from ..callbacks import Callback
from ..utils import import_required
# ... | {
"content_hash": "d5f2da82b0f2adf5da4e6bddd1ccf958",
"timestamp": "",
"source": "github",
"line_count": 345,
"max_line_length": 88,
"avg_line_length": 30.469565217391306,
"alnum_prop": 0.5716324200913242,
"repo_name": "chrisbarber/dask",
"id": "8690defb7b0b76dee618feb831d55ffe0d8e5ff1",
"size": "10... |
from django.test.testcases import TestCase
from django_core.forms.widgets import CommaSeparatedListWidget
from django_core.forms.widgets import MultipleDecimalInputWidget
class CommaSeparatedListWidgetTestCase(TestCase):
def test_widget_value_from_datadict(self):
field_name = 'some_field'
data = ... | {
"content_hash": "b7cbe8a82afdd2b5c570d310cb7124c2",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 68,
"avg_line_length": 38.75,
"alnum_prop": 0.5816377171215881,
"repo_name": "InfoAgeTech/django-core",
"id": "0f2b5e85d495834a061cd7a68a9aa366e207830c",
"size": "2015",
... |
"""
The POX packet library for packet parsing and creation.
This is based heavily on NOX's packet library, though it has undergone
some signficant change, particularly with regard to making packet
assembly easier.
Could still use more work.
"""
# None of this is probably that big, and almost all of it gets loaded
# ... | {
"content_hash": "804db61026c17b57eb15c070909f42a4",
"timestamp": "",
"source": "github",
"line_count": 78,
"max_line_length": 70,
"avg_line_length": 16.743589743589745,
"alnum_prop": 0.6761102603369066,
"repo_name": "kavitshah8/SDNDeveloper",
"id": "4dffc7042402b670997e71fba7dfb0806040a25a",
"size... |
from __future__ import absolute_import, print_function
import sys
import setuptools
import pip.req
from setuptools.command.test import test as TestCommand
import stackquery
install_reqs = pip.req.parse_requirements('requirements.txt')
class Tox(TestCommand):
def finalize_options(self):
TestCommand.finali... | {
"content_hash": "df6a0a38189c147b72aa269796732e02",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 73,
"avg_line_length": 32.67272727272727,
"alnum_prop": 0.6377295492487479,
"repo_name": "arxcruz/stackquery-cmd",
"id": "d526ba7d1b7f05d53846c30843d5e8c7e032080d",
"size":... |
css = u"""
body
{
font-family:"YaHei Consolas Hybrid";
}
#test1
{
font-family:"hello";
}
#test2
{
font-family:"Times New Roman";
}
#test3
{
font-family:"";
}
#test4
{
font-family:"YaHei Consolas Hybrid";
}
"""
html = u"""
<html>
<head>
<body>
<p id='test1'>hello</p> <!-- does not fallback to default font specifie... | {
"content_hash": "9ea766ed69d7bfb13297103fe5edc4a3",
"timestamp": "",
"source": "github",
"line_count": 84,
"max_line_length": 109,
"avg_line_length": 24.892857142857142,
"alnum_prop": 0.6183644189383071,
"repo_name": "ptphp/PyLib",
"id": "231167bfdf710d5df4ef620238c6a8fdaa74d357",
"size": "2157",
... |
import datetime
import unittest
from freezegun import freeze_time
from airflow import settings
from airflow.models import DagRun, TaskInstance
from airflow.models.dag import DAG
from airflow.operators.dummy import DummyOperator
from airflow.operators.latest_only import LatestOnlyOperator
from airflow.utils import tim... | {
"content_hash": "7711710f967efbef657e017fa55cf8a5",
"timestamp": "",
"source": "github",
"line_count": 181,
"max_line_length": 100,
"avg_line_length": 39.24309392265194,
"alnum_prop": 0.6283260594115163,
"repo_name": "apache/incubator-airflow",
"id": "90714afb71fb30a3a525cd0771b372f0d35ef9b4",
"si... |
from webob import exc
from nova.api.openstack import common
from nova.api.openstack.compute.schemas import server_migrations
from nova.api.openstack import extensions
from nova.api.openstack import wsgi
from nova.api import validation
from nova import compute
from nova import exception
from nova.i18n import _
from nov... | {
"content_hash": "9634ffa4d64cad47b13ae0b00b2cba8f",
"timestamp": "",
"source": "github",
"line_count": 137,
"max_line_length": 79,
"avg_line_length": 44.08029197080292,
"alnum_prop": 0.6560688855770823,
"repo_name": "Juniper/nova",
"id": "c0fd4c38b5ae11f47b90424a1c2ccf5aa3d31a7d",
"size": "6675",
... |
from cx_Freeze import setup, Executable
# Dependencies are automatically detected, but it might need
# fine tuning.
buildOptions = dict(packages = [], excludes = [])
executables = [
Executable('push.py', 'Console', targetName = 'ldpush')
]
setup(name='ldpush',
version = '1.0',
description = 'A cross-... | {
"content_hash": "ac7764aeb39e35dce6d10e4f6e473163",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 246,
"avg_line_length": 41.266666666666666,
"alnum_prop": 0.7205169628432956,
"repo_name": "google/ldpush",
"id": "fe3c3ff1fc03400d6ef39bc60a330972d964cf27",
"size": "619",... |
import json
from os import path
import warnings
import numpy
import six
from chainer import reporter
from chainer import serializer as serializer_module
from chainer.training import extension
from chainer.training import trigger as trigger_module
try:
import matplotlib # NOQA
_available = True
except (Im... | {
"content_hash": "ec609db5795d22b39e3881ae9f506f4d",
"timestamp": "",
"source": "github",
"line_count": 184,
"max_line_length": 79,
"avg_line_length": 34.89673913043478,
"alnum_prop": 0.5854228313346831,
"repo_name": "anaruse/chainer",
"id": "4877dc4f8ec7bac858ad21afa01d82faefe83cc1",
"size": "6421... |
"""Testing utilities."""
# Copyright (c) 2011, 2012
# Authors: Pietro Berkes,
# Andreas Muller
# Mathieu Blondel
# Olivier Grisel
# Arnaud Joly
# Denis Engemann
# License: BSD 3 clause
import os
import inspect
import pkgutil
import warnings
import sys
import re
import platf... | {
"content_hash": "c917c2c8cd809ff78ff32d0d7755cff3",
"timestamp": "",
"source": "github",
"line_count": 643,
"max_line_length": 78,
"avg_line_length": 33.50077760497667,
"alnum_prop": 0.6133884220788264,
"repo_name": "evgchz/scikit-learn",
"id": "ee0cc4b65666b502d8dd390867d28074ff576854",
"size": "... |
"""Provides functionality to interact with fans."""
from datetime import timedelta
import functools as ft
import logging
from typing import List, Optional
import voluptuous as vol
from homeassistant.const import (
SERVICE_TOGGLE,
SERVICE_TURN_OFF,
SERVICE_TURN_ON,
STATE_ON,
)
import homeassistant.help... | {
"content_hash": "2aa324f96bf155718ba3f743e22deab6",
"timestamp": "",
"source": "github",
"line_count": 615,
"max_line_length": 115,
"avg_line_length": 31.53008130081301,
"alnum_prop": 0.6069826208034655,
"repo_name": "turbokongen/home-assistant",
"id": "8d6fcbea2c965805bf540df36b10c7553aa5625a",
"... |
class CudaDriverError(Exception):
pass
class CudaRuntimeError(Exception):
pass
class CudaSupportError(ImportError):
pass
class NvvmError(Exception):
def __str__(self):
return '\n'.join(map(str, self.args))
class NvvmSupportError(ImportError):
pass
| {
"content_hash": "ff4ba802b87ec93fa04897712e6c185d",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 45,
"avg_line_length": 14.947368421052632,
"alnum_prop": 0.6936619718309859,
"repo_name": "gmarkall/numba",
"id": "c82cebd545364a8bc95900d0ffb2dbee6c625f82",
"size": "284",... |
"""Simple textbox editing widget with Emacs-like keybindings."""
import curses, ascii
def rectangle(win, uly, ulx, lry, lrx):
"""Draw a rectangle with corners at the provided upper-left
and lower-right coordinates.
"""
win.vline(uly+1, ulx, curses.ACS_VLINE, lry - uly - 1)
win.hline(uly, ulx+1, cu... | {
"content_hash": "4e1db8ad18018077697c103dd26c50ec",
"timestamp": "",
"source": "github",
"line_count": 173,
"max_line_length": 83,
"avg_line_length": 38.225433526011564,
"alnum_prop": 0.5024950854377741,
"repo_name": "MalloyPower/parsing-python",
"id": "28d78dd5cd382cae86f8b0b94b6820555a800681",
"... |
from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload
from azure.core.exceptions import (
ClientAuthenticationError,
HttpResponseError,
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
map_error,
)
from azure.core.paging import ItemPaged
f... | {
"content_hash": "58bb4584d66182ba104c0499a36182c9",
"timestamp": "",
"source": "github",
"line_count": 7088,
"max_line_length": 267,
"avg_line_length": 47.67127539503386,
"alnum_prop": 0.6552794663415153,
"repo_name": "Azure/azure-sdk-for-python",
"id": "2b54a968098a0a4bdaeb108c7beb05054827f725",
... |
import bisect
from collections import defaultdict
import io
import json
import logging
import zipfile
from babelfish import Language
from guessit import guessit
from requests import Session
from . import ParserBeautifulSoup, Provider
from .. import __short_version__
from ..cache import SHOW_EXPIRATION_TIME, region
fr... | {
"content_hash": "5603096772a0d567d61e4feb4c5bbcaa",
"timestamp": "",
"source": "github",
"line_count": 227,
"max_line_length": 120,
"avg_line_length": 39.440528634361236,
"alnum_prop": 0.5872891768122417,
"repo_name": "neo1691/subliminal",
"id": "ac620a3d1f6f601c5031d20b156e545e8feb37a6",
"size": ... |
from copy import copy
from optparse import Option, OptionValueError
def _check_mesos_cluster(option, opt, value):
cluster_name = value
if option.clusters and cluster_name in option.clusters:
return option.clusters[cluster_name]
elif option.cluster_provider:
return option.cluster_provider(cluster_name)
... | {
"content_hash": "791afa89f5481f2a70b59fa4a8c73ca2",
"timestamp": "",
"source": "github",
"line_count": 79,
"max_line_length": 91,
"avg_line_length": 36.30379746835443,
"alnum_prop": 0.6886331938633193,
"repo_name": "mkhutornenko/incubator-aurora",
"id": "77202c286529e59576cb8aeb1c3e24f86ee5cb27",
... |
import myfunctions
import random
#Ask user for inputs and check validity
while True:
qns = int(input("How many problems would you like to attempt? "))
if qns <= 0:
print("Invalid number, try again\n")
continue
else:
break
while True:
width = int(input("How wide d... | {
"content_hash": "1c8cfcecee1e05b506bd545ad0865ec6",
"timestamp": "",
"source": "github",
"line_count": 176,
"max_line_length": 223,
"avg_line_length": 30.03409090909091,
"alnum_prop": 0.5107832009080591,
"repo_name": "sojournexx/python",
"id": "b4f467de862ac5d1ca87acf2d7d8a6057e9f8502",
"size": "5... |
from module_base import ModuleBase
from module_mixins import FilenameViewModuleMixin
import module_utils
import vtk
class vtiRDR(FilenameViewModuleMixin, ModuleBase):
def __init__(self, module_manager):
# call parent constructor
ModuleBase.__init__(self, module_manager)
self._reader = v... | {
"content_hash": "b508aa2e2167c2d33641ec154d421e34",
"timestamp": "",
"source": "github",
"line_count": 78,
"max_line_length": 67,
"avg_line_length": 27.743589743589745,
"alnum_prop": 0.6030499075785583,
"repo_name": "chrisidefix/devide",
"id": "4fdd5bc150789a8c98d7fe31f8011c5630fbb523",
"size": "2... |
import os
basedir = os.path.abspath(os.path.dirname(__file__))
class Config:
SECRET_KEY = os.environ.get(
'SECRET_KEY') or 'WILL.I.AM tour with Wale featuring Leon_Omosh'
MAIL_SERVER = 'smtp.googlemail.com'
MAIL_PORT = 587
MAIL_USE_TLS = True
MAIL_USERNAME = os.environ.get('MAIL_USERNAME')... | {
"content_hash": "68de6b4f7cea71dede044a691a8082fe",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 72,
"avg_line_length": 29.551020408163264,
"alnum_prop": 0.669889502762431,
"repo_name": "Kimanicodes/wananchi",
"id": "c847e6d17e7e48b21665b02b83a4ecedb4af39b2",
"size": "... |
"""RequestContext: context for requests that persist through all of nova."""
import copy
import uuid
from nova.openstack.common import local
from nova.openstack.common import log as logging
from nova.openstack.common import timeutils
from nova import policy
LOG = logging.getLogger(__name__)
def generate_request_i... | {
"content_hash": "e146c1486978d27205be6d9505a986de",
"timestamp": "",
"source": "github",
"line_count": 133,
"max_line_length": 78,
"avg_line_length": 35.54887218045113,
"alnum_prop": 0.5930626057529611,
"repo_name": "houshengbo/nova_vmware_compute_driver",
"id": "094e2bffbc33804d992949d79295234811de... |
import os
import sys
import math
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
LOG_PATH = "logs-2.txt"
SEARCHSTRING = "NARF: "
SAVENAME = "plot2"
x = []
y = []
z = []
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
f = open(LOG_PATH, "r")
lines = f.readlines()
for line in l... | {
"content_hash": "1e2ad518b7a9cee8b5af0dc04a74fa22",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 70,
"avg_line_length": 21.87878787878788,
"alnum_prop": 0.6260387811634349,
"repo_name": "mcguenther/MIScreen",
"id": "60d3340a6b6436fc1738ac4dab7f5a3bcff7839a",
"size": "7... |
"""
Tools for managing data for use with `~windspharm.standard.VectorWind`
(or indeed `spharm.Spharmt`).
"""
# Copyright (c) 2012-2013 Andrew Dawson
#
# 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 ... | {
"content_hash": "79dd80e39c90b5044330af3b152bf16b",
"timestamp": "",
"source": "github",
"line_count": 313,
"max_line_length": 79,
"avg_line_length": 28.782747603833865,
"alnum_prop": 0.6517926517926518,
"repo_name": "nicolasfauchereau/windspharm",
"id": "f4384940c0bb836a6b9a7fb7f31fe1a7ca0e357d",
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.