text stringlengths 4 1.02M | meta dict |
|---|---|
"""Tests for lineprofiler.py."""
# Standard library imports
import os
# Third party imports
from pytestqt import qtbot
from qtpy.QtCore import Qt
from spyder.utils.qthelpers import qapplication
MAIN_APP = qapplication()
# Local imports
from spyder_line_profiler.widgets.lineprofiler import LineProfilerWidget
try:
... | {
"content_hash": "20d70752ee52dff3f7d3fae82b54d0a7",
"timestamp": "",
"source": "github",
"line_count": 70,
"max_line_length": 80,
"avg_line_length": 29.7,
"alnum_prop": 0.6772486772486772,
"repo_name": "Nodd/spyder.line_profiler",
"id": "372ab171ed4d6d13eb86a4c0b7f785e3f679f3fb",
"size": "2232",
... |
'''
TODO - essentially all the tests currently here are barebones sanity checks
to ensure a minimal level of functionality exists. In other words, there are
many special cases that are not being covered *yet*.
'''
import array
import codecs
import os
import re
import shutil
import string
import subprocess
import sys
i... | {
"content_hash": "f783ff1021bfdd64646ba032d8fb64f5",
"timestamp": "",
"source": "github",
"line_count": 2052,
"max_line_length": 936,
"avg_line_length": 54.874756335282655,
"alnum_prop": 0.6250277523689423,
"repo_name": "IronLanguages/ironpython3",
"id": "aaa7d58d26e89586d5e3a0cff0d35a8619b8c48f",
... |
import re
import struct
import logging
import six # Python 2+3 compatibility
try:
import hashlib as md5
except ImportError:
import md5
try:
from Crypto.Cipher import ARC4
from Crypto.Cipher import AES
from Crypto.Hash import SHA256
except ImportError:
AES = SHA256 = None
from . import arcfo... | {
"content_hash": "aba38d504b54895b8ed8d78f5869511c",
"timestamp": "",
"source": "github",
"line_count": 813,
"max_line_length": 97,
"avg_line_length": 33.708487084870846,
"alnum_prop": 0.5377850757161102,
"repo_name": "rotula/pdfminer",
"id": "b92d7c6e2080d343194ae7310e811bb11ea235ff",
"size": "274... |
import numpy
import rospy
import tf
import tf2_ros
import geometry_msgs.msg
import math
def normalize(v):
norm=numpy.linalg.norm(v)
if norm==0:
return v
return v/norm
def lookupMatrixLH(cameraPosition, cameraTarget, cameraUpVector):
zaxis = normalize(cameraTarget - cameraPosition)
xaxis = ... | {
"content_hash": "bb9ee38300bd665700ce07d46294d846",
"timestamp": "",
"source": "github",
"line_count": 124,
"max_line_length": 70,
"avg_line_length": 39.693548387096776,
"alnum_prop": 0.6859000406338887,
"repo_name": "xunilrj/sandbox",
"id": "7b7e5f8ad724e6b31605562d6784e992367ce648",
"size": "494... |
import json
import os
import argparse
import subprocess
from scripts.mirnas.update_mirnas_helpers import get_rfam_accs, get_mirna_ids
from scripts.mirnas.mirna_config import UPDATE_DIR, SEARCH_DIRS, MEMORY, CPU, LSF_GROUP, NEW_DIR, QUEUE
def add_ref_sequentially(reference, mirna_ids=None, rfam_accessions=None):
"... | {
"content_hash": "be7c902eff98194f0702d0a23d1d4772",
"timestamp": "",
"source": "github",
"line_count": 113,
"max_line_length": 112,
"avg_line_length": 39.13274336283186,
"alnum_prop": 0.61917684305744,
"repo_name": "Rfam/rfam-production",
"id": "450b300c31d6a616f13ed33b8fc54764ec46fb8e",
"size": "... |
import django.forms as forms
import magic
from captcha.fields import CaptchaField
from django.conf import settings
from django.core.exceptions import ValidationError
from django.core.validators import FileExtensionValidator
from django.db import models
from django.shortcuts import render
from django.template.defaultfil... | {
"content_hash": "a1e89f3ed99980d178ae56c9843d0d65",
"timestamp": "",
"source": "github",
"line_count": 153,
"max_line_length": 79,
"avg_line_length": 38.091503267973856,
"alnum_prop": 0.6403568977350721,
"repo_name": "kingsdigitallab/kdl-django",
"id": "bdf9cac9d615804fd476aa1587d2f8e5493bef5c",
"... |
from urllib import urlencode, quote_plus
from datetime import datetime, date
import urllib2
try:
import functools
partial = functools.partial
except ImportError:
def partial(func, *args, **keywords):
def newfunc(*fargs, **fkeywords):
newkeywords = keywords.copy()
newkeywords... | {
"content_hash": "1301bd22c07e698e58d6b02e07f779d7",
"timestamp": "",
"source": "github",
"line_count": 99,
"max_line_length": 77,
"avg_line_length": 31.050505050505052,
"alnum_prop": 0.5393623942745608,
"repo_name": "bmac/evilsheep",
"id": "6020d11cc4701db24bbb7e445b626bb816ce2850",
"size": "3074"... |
from __future__ import print_function, division
from sympy.core import S, Add, Expr, Basic
from sympy.assumptions import Q, ask
from sympy.core.logic import fuzzy_not
def refine(expr, assumptions=True):
"""
Simplify an expression using assumptions.
Gives the form of expr that would be obtained if symbol... | {
"content_hash": "5d47c3866a39cf58b837b04f3b1e5414",
"timestamp": "",
"source": "github",
"line_count": 268,
"max_line_length": 78,
"avg_line_length": 31.69776119402985,
"alnum_prop": 0.5300765155974102,
"repo_name": "kumarkrishna/sympy",
"id": "e96ddea614eae867dd16d4beaf7f48e921006a33",
"size": "8... |
from regioninfo import SDBRegionInfo
def regions():
"""
Get all available regions for the SDB service.
:rtype: list
:return: A list of :class:`boto.sdb.regioninfo.RegionInfo`
"""
return [SDBRegionInfo(name='us-east-1',
endpoint='sdb.amazonaws.com'),
... | {
"content_hash": "3e0a5de194e9fe6b66475a7bd820a6d0",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 70,
"avg_line_length": 32.96,
"alnum_prop": 0.5546116504854369,
"repo_name": "woggle/mesos-old",
"id": "58c9794535c59383a1e035f956ff6942f47d3c02",
"size": "1931",
"binary... |
import random
from django.test import TestCase
from game.forms import NewGameForm
class NewGameFormTest(TestCase):
def test_player_valid(self):
form = NewGameForm({
'player1': 'game.players.AIPlayer',
'player2': 'human'
})
self.assertTrue(form.is_valid())
def ... | {
"content_hash": "fb6e76a8fc54a9d93df0898723a72928",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 70,
"avg_line_length": 29.526315789473685,
"alnum_prop": 0.5650623885918004,
"repo_name": "claudiordgz/tictactoe-django",
"id": "bdd27952437fcf6bae9e5cfd6f67e9f28b6bc0b6",
... |
class Indian(object):
def printIndian(self):
print 'I am an Indian'
class Gujarati(Indian):
def printGujarati(self):
print 'I am Gujarati'
def printMarathi(self):
print 'I am Marathi'
def printKathiyawadi(self):
print 'I am Kathiyawadi'
def main():
superObj = ... | {
"content_hash": "03afcc5e0ae263c9e9905240e43a96d6",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 32,
"avg_line_length": 17,
"alnum_prop": 0.6078431372549019,
"repo_name": "dek-odoo/python-samples",
"id": "5ad5b57aa3f940ffc2ce131a4a5cc30d4f58ec6d",
"size": "658",
"bin... |
import os
import uuid
import t
from restkit import request
from restkit.forms import multipart_form_encode
from _server_test import HOST, PORT
LONG_BODY_PART = """This is a relatively long body, that we send to the client...
This is a relatively long body, that we send to the client...
This is a relatively long body,... | {
"content_hash": "aa09967701093e5591fe645e21911244",
"timestamp": "",
"source": "github",
"line_count": 135,
"max_line_length": 81,
"avg_line_length": 44.474074074074075,
"alnum_prop": 0.6640572951365756,
"repo_name": "emidln/django_roa",
"id": "6e083e7b5b0d8ce6c05537f33724cc8548755aab",
"size": "6... |
"""
zine
~~~~
Zine is a simple python weblog software.
Get a WSGI Application
======================
To get the WSGI application for Zine you can use the `make_app`
function. This function can either create a dispatcher for one instance
or for multiple application instances where th... | {
"content_hash": "9bb4d22fc27e49dbdb238cf93227d4dd",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 76,
"avg_line_length": 34.77777777777778,
"alnum_prop": 0.6829073482428115,
"repo_name": "mitsuhiko/zine",
"id": "c54317ff52c36b8817dcb79249133848ed1af863",
"size": "1276",... |
import sys
from subprocess import Popen, call, PIPE
from random import randint
from time import strftime
import shlex
try:
from Rappture.tools import getCommandOutput as RapptureExec
except ImportError:
pass
def psd(s, **kwargs):
"""pysimm.apps.poreblazer.psd
Perform pore size distribution calculati... | {
"content_hash": "ac2aa3d94b0c1c185600e8007b7d62c8",
"timestamp": "",
"source": "github",
"line_count": 273,
"max_line_length": 109,
"avg_line_length": 34.5970695970696,
"alnum_prop": 0.5818951826363155,
"repo_name": "plin1112/pysimm",
"id": "fe8d1131660c58033a86219e7d8dc22443e8eb44",
"size": "1099... |
import time
from datetime import datetime
import sys
import os
from multiprocessing import Pool
# Project dependency modules
import pandas as pd
pd.set_option('mode.chained_assignment', None) # block warnings due to DataFrame value assignment
import lasagne
# Project modules
sys.path.append('../')
from sleep_control.t... | {
"content_hash": "f95da46dba21970b1ca04d88e169100f",
"timestamp": "",
"source": "github",
"line_count": 130,
"max_line_length": 103,
"avg_line_length": 33.41538461538462,
"alnum_prop": 0.6673572744014733,
"repo_name": "zaxliu/deepnap",
"id": "42a9eb16a5b795432712c0181bc2d6d1117662ae",
"size": "4370... |
import datetime
import decimal
import hashlib
import logging
import operator
import re
import sys
import threading
import uuid
from collections import deque
from collections import namedtuple
try:
from collections import OrderedDict
except ImportError:
OrderedDict = dict
from copy import deepcopy
from functools... | {
"content_hash": "4a09b35b39f6f0e06646db4dcfcbc1d1",
"timestamp": "",
"source": "github",
"line_count": 4629,
"max_line_length": 79,
"avg_line_length": 33.77403326852452,
"alnum_prop": 0.5637073045925547,
"repo_name": "py4a/peewee",
"id": "d1a1c42c966173003e04a9442a28f2309b9da2a1",
"size": "156866"... |
import sys
import os
import __builtin__
from ctypes import *
from cStringIO import StringIO
from termcolor import cprint
import colorama
global here
global test_functions
here = os.getcwd()
test_functions = set([])
# Constant format output strings
success_string = '[OK] {}'
fail_string = '[KO] {}'
problem_stri... | {
"content_hash": "86a2e57ffb851a6ffda9796bfd4e879a",
"timestamp": "",
"source": "github",
"line_count": 100,
"max_line_length": 75,
"avg_line_length": 31.62,
"alnum_prop": 0.5815939278937381,
"repo_name": "Yayg/rift",
"id": "e53d3bcfc65605cd97562da6b0b77304d6328e3c",
"size": "3162",
"binary": fal... |
import sys, os, math
import matplotlib.pyplot as plt
#-Configuration ----------------------------------------------------------------
sizes = [ 2**n for n in range(6, 13) ]
modes = ['Naive', 'SMB', 'CRB', 'CRB-T', 'CRB-TR']
#-Script Body ------------------------------------------------------------------
if __name__ =... | {
"content_hash": "e7d892343520e604dab9bc463b497111",
"timestamp": "",
"source": "github",
"line_count": 91,
"max_line_length": 80,
"avg_line_length": 34.86813186813187,
"alnum_prop": 0.4853450992751339,
"repo_name": "Cryst4L/Blaze",
"id": "762726e125dd253658b56731550ccb3475bc9d2d",
"size": "3195",
... |
"""ABCs."""
# Authors: Guillaume Favelier <guillaume.favelier@gmail.com
# Eric Larson <larson.eric.d@gmail.com>
#
# License: Simplified BSD
from abc import ABC, abstractmethod, abstractclassmethod
from contextlib import nullcontext
import warnings
from ..utils import tight_layout
class _AbstractRenderer(A... | {
"content_hash": "d0fe24f0db78f777450602a71b1d1f2d",
"timestamp": "",
"source": "github",
"line_count": 809,
"max_line_length": 79,
"avg_line_length": 30.826946847960446,
"alnum_prop": 0.5697902883034605,
"repo_name": "rkmaddox/mne-python",
"id": "11f4c79ecf1e03eabae180587b978c7b84c7c3fd",
"size": ... |
from inspect import signature
def actual_kwargs(function):
"""
Decorator that provides the wrapped function with an attribute
'actual_kwargs'
containing just those keyword arguments actually passed in to the function.
References
----------
http://stackoverflow.com/questions/1408818/gettin... | {
"content_hash": "966a91c62a9c3ffebe2bfdb38fd0860e",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 79,
"avg_line_length": 25.82758620689655,
"alnum_prop": 0.6875834445927904,
"repo_name": "Dekken/tick",
"id": "46a02fe416ff50232ed6baf53db2c33e1df55299",
"size": "774",
"... |
from iris_sdk.models.maps.base_map import BaseMap
class SipPeerTelephoneNumbersMap(BaseMap):
sip_peer_telephone_number = None | {
"content_hash": "ab6ba7ac1c9e227a91bc1c3e2e52862d",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 49,
"avg_line_length": 26.2,
"alnum_prop": 0.8015267175572519,
"repo_name": "bandwidthcom/python-bandwidth-iris",
"id": "a9b1e917803d73c738d17d5c7d1d146999743b3d",
"size": "... |
import imp
import sys
import os
from conans.model.ref import ConanFileReference
from conans.client.recorder.action_recorder import ActionRecorder
from conans.model.requires import Requirement
class ConanPythonRequire(object):
def __init__(self, proxy, range_resolver):
self._modules = {}
self._pro... | {
"content_hash": "8d11b8b26bae535836f6c3d31efff214",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 85,
"avg_line_length": 34.31818181818182,
"alnum_prop": 0.5735099337748344,
"repo_name": "luckielordie/conan",
"id": "9929a5430a23c0433592bcdecf56a6a6e9379dbc",
"size": "15... |
"""
pyClanSphere.utils.account
~~~~~~~~~~~~~~~~~~~~~~~~~~
This module implements various functions used by the account interface.
:copyright: (c) 2009 - 2010 by the pyClanSphere Team,
see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from pyClanSphere.... | {
"content_hash": "36ed888e0174e9290912e89fee5ac311",
"timestamp": "",
"source": "github",
"line_count": 73,
"max_line_length": 119,
"avg_line_length": 36.78082191780822,
"alnum_prop": 0.6171322160148975,
"repo_name": "jokey2k/pyClanSphere",
"id": "85421492fc4aac22784cefa6272e68fe6a772a7f",
"size": ... |
'''
Fibonacci numbers
The Fibonacci numbers form a sequence of integers defined recursively
in the following way. The first two numbers in the Fibonacci sequence are 0 and 1,
and each subsequent number is the sum of the previous two.
'''
def fibonacci(N):
# Initialize the fibonacci series
# fib(0) = 0, fib(1) = 1
... | {
"content_hash": "981e7a5ee96fa241248206aa7009aec8",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 82,
"avg_line_length": 20.761904761904763,
"alnum_prop": 0.6697247706422018,
"repo_name": "barissimsek/gopython",
"id": "d6b5ed26bd07e2b16c0cf26367dbaf083dce7595",
"size": ... |
#!/usr/bin/env python3
# Copyright (c) 2017-2018 The Machinecoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test deprecation of RPC calls."""
from test_framework.test_framework import MachinecoinTestFramewo... | {
"content_hash": "8ef22623091c228b4439d845e2b6868b",
"timestamp": "",
"source": "github",
"line_count": 111,
"max_line_length": 137,
"avg_line_length": 43.531531531531535,
"alnum_prop": 0.6632864238410596,
"repo_name": "machinecoin-project/machinecoin",
"id": "d2d835163c315f79fdd23fee58fbd1e293c7f339... |
class ZellenKultur:
def __init__(self, listeDerZellen1=[]):
self.listeDerZellen = listeDerZellen1
def anzahlLebenderZellen(self):
anzahlZellenDieLeben = 2
return anzahlZellenDieLeben
def main(self):
return
if __name__ == '__main__':
pass | {
"content_hash": "bb381b818877a39ab8470625f8dd9852",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 45,
"avg_line_length": 19.0625,
"alnum_prop": 0.5934426229508196,
"repo_name": "hemmerling/codingdojo",
"id": "f5d9115cf6c3d09b4e8623a5b5d82c1a714cee42",
"size": "661",
"... |
from __future__ import unicode_literals
from furl import furl
from django.views.generic import FormView, DeleteView
from django.core.mail import send_mail
from django.shortcuts import redirect
from django.http import Http404, HttpResponse
from website.settings import SUPPORT_EMAIL, DOMAIN
from website.security import... | {
"content_hash": "ab89060d8bff8c239850a13adf2f7d1c",
"timestamp": "",
"source": "github",
"line_count": 177,
"max_line_length": 82,
"avg_line_length": 32.84180790960452,
"alnum_prop": 0.5890246000344056,
"repo_name": "amyshi188/osf.io",
"id": "33b4aabf9b8d0f0bbd99b4dc27f82037c2da96f1",
"size": "581... |
import os
from distutils.core import setup
def find_packages(root):
# so we don't depend on setuptools; from the Storm ORM setup.py
packages = []
for directory, subdirectories, files in os.walk(root):
if '__init__.py' in files:
packages.append(directory.replace(os.sep, '.'))
... | {
"content_hash": "5db13e5033a9c7ceba3ec80ff328fba5",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 67,
"avg_line_length": 34.53125,
"alnum_prop": 0.5945701357466063,
"repo_name": "dantium/django-tables",
"id": "72ce82a9c252d17841ce388d6845702c04f428fa",
"size": "1105",
... |
"""Redis pool using one module in different files"""
import json
import redis
import time
import os
from functools import wraps
from kits.log import get_logger
ROOT_PATH = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
REDIS_LOGGER = get_logger('redis')
def redis_excepts(orig_func):
"""try excepts ... | {
"content_hash": "dbac4c23bc0262c032c058eac62c831c",
"timestamp": "",
"source": "github",
"line_count": 465,
"max_line_length": 93,
"avg_line_length": 32.806451612903224,
"alnum_prop": 0.541265158964274,
"repo_name": "Elaoed/iplives",
"id": "57f34f2d72ff80ae1554976660bf488a8bd5a3a0",
"size": "15271... |
'''Autogenerated by xml_generate script, do not edit!'''
from OpenGL import platform as _p, arrays
# Code generation uses this
from OpenGL.raw.GL import _types as _cs
# End users want this...
from OpenGL.raw.GL._types import *
from OpenGL.raw.GL import _errors
from OpenGL.constant import Constant as _C
import ctypes
_... | {
"content_hash": "23cb0158c453b8411fa885bbd0b16e0d",
"timestamp": "",
"source": "github",
"line_count": 46,
"max_line_length": 120,
"avg_line_length": 56.93478260869565,
"alnum_prop": 0.7804505536464299,
"repo_name": "alexus37/AugmentedRealityChess",
"id": "fd23d6aaab258d2ce9a12b3e0ff75742caa95b8d",
... |
import sys
from getpass import getpass
from BioSQL import BioSeqDatabase
from common import standard_options, generate_placeholders, chunks, extract_feature_sql
def get_seqfeature_for_db(server, biodb):
''' find all seqfeatures that have the given value for the qualifier
returns a list of seqfeature_id
... | {
"content_hash": "b845f124b0c79cde371c002c1e8b9caf",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 162,
"avg_line_length": 45.125,
"alnum_prop": 0.6770083102493075,
"repo_name": "ctSkennerton/BioSQL-Extensions",
"id": "608aa2a17c029e81a982bbb54b0e89ab7265bee5",
"size": "... |
""" This module provides the project version info and comparison utility.
"""
__version_info__ = (0, 1, 3)
__version__ = '.'.join(str(x) for x in __version_info__)
def compare_version(value):
""" Determines if the provided version value compares with program version.
`value`
Version comp... | {
"content_hash": "b3a4e180730892f98561f3940667da99",
"timestamp": "",
"source": "github",
"line_count": 46,
"max_line_length": 79,
"avg_line_length": 24.891304347826086,
"alnum_prop": 0.4908296943231441,
"repo_name": "xtrementl/focus",
"id": "e11afe8bca7f179e286e38bac574757d9d6943f9",
"size": "1145... |
HOST = "/dev/rfcomm0"
PORT = 1
DB_PORT = 5984
CONFSTRING = '{"enableRawOutput": false, "format": "Json"}\n'
DB_USERNAME = "encima"
DB_PWD = "Cocaine5Unicorn_Hiatus"
DB_NAME = 'mindwave_logs'
DB_DELETE = True
FG_CMD = {
'Darwin': "osascript /Users/encima/development/neurosky/neurosocket/osx/foreground_app.scpt",... | {
"content_hash": "65a83549ecf463ee5f5333501b8037b4",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 101,
"avg_line_length": 31.4375,
"alnum_prop": 0.658051689860835,
"repo_name": "encima/NeuroSocket",
"id": "542d5b448897e555db4ead12a9da0ec9bf0306f7",
"size": "503",
"bin... |
from semcplogic.model import ModelBuilder
from semcplogic.cpmodel import NonLinearCPLogicGenerator
from semcplogic.cpcompiler import CPCompiler
from semcplogic.problogresult import GnuplotDrawer
b = ModelBuilder()
b.addNode("f")
b.addNode("v1",0,1)
b.addNode("v2",0,1)
b.setInfluence("f","v1",5)
b.setInfluence("f","v2"... | {
"content_hash": "65ac08d811ac6dd84ef673b671e348ef",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 62,
"avg_line_length": 25.22222222222222,
"alnum_prop": 0.737151248164464,
"repo_name": "verhoevenv/semcplogic",
"id": "d94ed3052b090d8c855352e8f74e83e6ae64d171",
"size": "... |
"""Conversion tool from Brain Vision EEG to FIF"""
# Authors: Teon Brooks <teon.brooks@gmail.com>
# Christian Brodbeck <christianbrodbeck@nyu.edu>
#
# License: BSD (3-clause)
import os
import time
import re
import warnings
import numpy as np
from ...utils import verbose, logger
from ..constants import FIFF... | {
"content_hash": "53bce5527bd000000fb34b5cb4d0e75b",
"timestamp": "",
"source": "github",
"line_count": 619,
"max_line_length": 79,
"avg_line_length": 36.79806138933764,
"alnum_prop": 0.5525946088330845,
"repo_name": "Odingod/mne-python",
"id": "f2a17325e85f72acdead02ddf21f1fcc2e0f8a0d",
"size": "2... |
from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload
from urllib.parse import parse_qs, urljoin, urlparse
from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import (
ClientAuthenticationError,
HttpResponseError,
ResourceExistsEr... | {
"content_hash": "8b62dc0d055342244005f6eeecdef2bd",
"timestamp": "",
"source": "github",
"line_count": 645,
"max_line_length": 197,
"avg_line_length": 45.88837209302326,
"alnum_prop": 0.651429150618285,
"repo_name": "Azure/azure-sdk-for-python",
"id": "0e9e8468ff4bb466ccc3ea363b8f2cd44b64d23e",
"s... |
"""Lighting channels module for Zigbee Home Automation."""
from typing import Optional
import zigpy.zcl.clusters.lighting as lighting
from .. import registries, typing as zha_typing
from ..const import REPORT_CONFIG_DEFAULT
from .base import ClientChannel, ZigbeeChannel
@registries.ZIGBEE_CHANNEL_REGISTRY.register(... | {
"content_hash": "877df746bcc4946a609cb2b49b90dfb7",
"timestamp": "",
"source": "github",
"line_count": 113,
"max_line_length": 87,
"avg_line_length": 36.9646017699115,
"alnum_prop": 0.6581278429494852,
"repo_name": "soldag/home-assistant",
"id": "9d52ff12d379954147b8aa05f39e13a071be0106",
"size": ... |
import unittest
from mock import patch
import simplejson as json
from .context import app
app.config['TWILIO_ACCOUNT_SID'] = 'ACxxxxxx'
app.config['TWILIO_AUTH_TOKEN'] = 'yyyyyyyyy'
app.config['TWILIO_CALLER_ID'] = '+15558675309'
app.config['NYTIMES_API_KEY'] = '###'
class TwiMLTest(unittest.TestCase):
def set... | {
"content_hash": "bd6cdc00abf563afdb9900597e0c7190",
"timestamp": "",
"source": "github",
"line_count": 124,
"max_line_length": 79,
"avg_line_length": 35.153225806451616,
"alnum_prop": 0.5797201192934159,
"repo_name": "RobSpectre/New-York-Times-Conference-Room",
"id": "fddff13c97322ef9ea51e09d5d62905... |
__author__ = 'termie@google.com (Andy Smith)'
import re
import time, datetime
try:
import cPickle as pickle
except ImportError:
import pickle
from google.appengine.ext import db
from google.appengine.api.datastore_types import Blob
DJANGO_DATE = "%Y-%m-%d"
DJANGO_TIME = "%H:%M:%S"
class DateTimeProperty(db.Date... | {
"content_hash": "816b1cbda18d7f8fef4d34ddc40a7e2e",
"timestamp": "",
"source": "github",
"line_count": 67,
"max_line_length": 79,
"avg_line_length": 28.611940298507463,
"alnum_prop": 0.6541471048513302,
"repo_name": "AloneRoad/Inforlearn",
"id": "df0ff00316d55a67397eedbb7f97fe579a58ea47",
"size": ... |
"""Helper utilities and decorators."""
from flask import flash
from sqlalchemy.orm import exc
from werkzeug.exceptions import abort
from werkzeug.routing import BaseConverter
def flash_errors(form, category='warning'):
"""Flash all errors for a form."""
for field, errors in form.errors.items():
for er... | {
"content_hash": "2e40d18cc6fb9287d1b8219ee3f52c02",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 69,
"avg_line_length": 27.86046511627907,
"alnum_prop": 0.6143572621035058,
"repo_name": "dyzajash/scanlation_cms",
"id": "11713afe3a10269d2fcf43f3a5bb61c999e39030",
"size"... |
from scriptine import path, log
import tarfile
import warnings
warnings.warn('scriptine.file module is still in development and will be changed')
class file_collection(object):
def __init__(self):
self.files = []
self.base = path('.')
def include(self, patterns, recursive=False):
if i... | {
"content_hash": "5e91394298811d7ed9a2d6bb4719feed",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 82,
"avg_line_length": 33.15384615384615,
"alnum_prop": 0.5870069605568445,
"repo_name": "olt/scriptine",
"id": "c78cafa26ac34893d76526b2c79ecd1b4e10718d",
"size": "1293",
... |
try:
import blurdev
aboutToClearPaths = blurdev.core.aboutToClearPaths
except ImportError:
aboutToClearPaths = None
# This is used by Studiomax's rescaletime module. It basicly provides a QMainWindow
# that is parented to 3ds Max to tell the user to not do anything while its processing.
# rescaletime is basicly a h... | {
"content_hash": "149eb2b84cb01924dc06740b123934b4",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 89,
"avg_line_length": 30.040816326530614,
"alnum_prop": 0.7438858695652174,
"repo_name": "blurstudio/cross3d",
"id": "527549db8866ead43f3cc5157cfab078c57fe0f3",
"size": "2... |
from django.contrib.auth import get_user_model
from django.urls import reverse
from lbworkflow.views.helper import user_wf_info_as_dict
from .leave.models import Leave
from .test_base import BaseTests
User = get_user_model()
class HelperTests(BaseTests):
def test_user_wf_info_as_dict(self):
leave = sel... | {
"content_hash": "a8a42718121c4eb2aa8184a098347267",
"timestamp": "",
"source": "github",
"line_count": 124,
"max_line_length": 67,
"avg_line_length": 34.88709677419355,
"alnum_prop": 0.5945446139620897,
"repo_name": "vicalloy/django-lb-workflow",
"id": "b240ce6698e4e924b2db977e6e864de02f843cb1",
"... |
import switchlight_api
import time
import sys
import threading
from bottle import run, get, post, request, template, static_file, redirect, response
class Main(threading.Thread):
def __init__(self):
threading.Thread.__init__(self)
self.addr = sys.argv[1].split(':')
if len(self.addr) < 2: se... | {
"content_hash": "4d41cf18fcbf43b08b4f00041218b560",
"timestamp": "",
"source": "github",
"line_count": 106,
"max_line_length": 109,
"avg_line_length": 29.858490566037737,
"alnum_prop": 0.5876777251184834,
"repo_name": "hunternet93/switchlight",
"id": "babbac29a9bf3ffe4981d890963edbbf8d3d1d45",
"si... |
"""
slurpECL.py
Honestly there's not much practical use for this one but it was fun to
experiment with.
It's like slurp.py, but sends a midi START message followed by
midi CLOCK messages for the designated tempo, and stops when a midi STOP
message is recieved (or KeyboardInterrupt).
Note that for this to work proper... | {
"content_hash": "0435b3774a9a0f29e001d3c55b909e03",
"timestamp": "",
"source": "github",
"line_count": 118,
"max_line_length": 78,
"avg_line_length": 30.25423728813559,
"alnum_prop": 0.6756302521008404,
"repo_name": "hschh86/usersong-extractor",
"id": "99371f3ed07e7fd0fcfee6959df582479910ab69",
"s... |
from __future__ import absolute_import, division, print_function, with_statement
import tornado.escape
from tornado.escape import utf8, xhtml_escape, xhtml_unescape, url_escape, url_unescape, to_unicode, json_decode, json_encode, squeeze, recursive_unicode
from tornado.util import u, unicode_type
from tornado.test.uti... | {
"content_hash": "c9891082d4eac3086bd29fe9da4a32a7",
"timestamp": "",
"source": "github",
"line_count": 229,
"max_line_length": 212,
"avg_line_length": 46.633187772925766,
"alnum_prop": 0.5920966382620095,
"repo_name": "xinyu7/tornado",
"id": "98a23463890c0b8633bc966075253196df8ecadd",
"size": "107... |
"""Light for Shelly."""
from __future__ import annotations
from aioshelly import Block
from homeassistant.components.light import (
ATTR_BRIGHTNESS,
ATTR_COLOR_TEMP,
ATTR_HS_COLOR,
ATTR_WHITE_VALUE,
SUPPORT_BRIGHTNESS,
SUPPORT_COLOR,
SUPPORT_COLOR_TEMP,
SUPPORT_WHITE_VALUE,
LightEn... | {
"content_hash": "39f7fe3613ffee8b85d4d00a423093df",
"timestamp": "",
"source": "github",
"line_count": 231,
"max_line_length": 96,
"avg_line_length": 33.99134199134199,
"alnum_prop": 0.586602139582272,
"repo_name": "adrienbrault/home-assistant",
"id": "a9e137968758a91fa46fb19b8a5dc272cf01bec4",
"s... |
from .bitstream import BitStream
__all__ = ['BitStream', 'bitmasks']
| {
"content_hash": "d3fa6781e83fb170a2f8cab48ab5eff9",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 35,
"avg_line_length": 23.333333333333332,
"alnum_prop": 0.6857142857142857,
"repo_name": "mudaltsov/bitstream_iter",
"id": "e844734cf7d0462de45d31a79fdfa4ceed922200",
"size... |
from tkinter import Tk
import pytest
from pyDEA.main_gui import MainFrame
import tests.utils_for_tests as utils_for_tests
@pytest.fixture
def main_frame(request):
parent = Tk()
main_frame = MainFrame(parent)
request.addfinalizer(parent.destroy)
return main_frame
def test_run_gui(main_frame):
f... | {
"content_hash": "b523547522791ae05efac39a43398b2c",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 80,
"avg_line_length": 35.425,
"alnum_prop": 0.5589273112208892,
"repo_name": "olga-perederieieva/pyDEA",
"id": "b0644629565064abbb126b62763b84339bda9306",
"size": "1417",
... |
import numpy as np
import quantmod as qm
import pandas as pd
import pandas_datareader as web
# In[]:
ch = qm.get_symbol('TSLA')
ch.adjust(inplace=True)
ch.add_RSI()
ch.add_MACD()
ch.add_EMA()
ch.add_BBANDS()
ch.plot(kind='candlestick', theme='light', log=True, volume=True)
ch.plot(kind='candlestick', theme='dark', ... | {
"content_hash": "166ec1dcc9fc0ec61679d4482c0c5bbe",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 65,
"avg_line_length": 20,
"alnum_prop": 0.7138888888888889,
"repo_name": "jackwluo/py-quantmod",
"id": "fe77284c2a6b63a212f923bbac7cf7e5ef95edb1",
"size": "369",
"binary... |
import datetime
from django.conf import settings
from freezegun import freeze_time
from testil import assert_raises, eq
from corehq.apps.celery import task
from corehq.celery_monitoring.heartbeat import (
HEARTBEAT_FREQUENCY,
Heartbeat,
HeartbeatNeverRecorded,
)
from corehq.celery_monitoring.signals impo... | {
"content_hash": "dd1261ed754ac1330e0c1bafa0101790",
"timestamp": "",
"source": "github",
"line_count": 134,
"max_line_length": 104,
"avg_line_length": 29.574626865671643,
"alnum_prop": 0.6540499621498864,
"repo_name": "dimagi/commcare-hq",
"id": "0a85aec3ba8b10af0a817c99bfc48eba46298283",
"size": ... |
"""Define tests for the Dune HD config flow."""
from unittest.mock import patch
from homeassistant import data_entry_flow
from homeassistant.components.dunehd.const import DOMAIN
from homeassistant.config_entries import SOURCE_IMPORT, SOURCE_USER
from homeassistant.const import CONF_HOST
from tests.common import Mock... | {
"content_hash": "979126c04641a6f1cc6942194eeb1aac",
"timestamp": "",
"source": "github",
"line_count": 132,
"max_line_length": 85,
"avg_line_length": 38.25,
"alnum_prop": 0.6601307189542484,
"repo_name": "FreekingDean/home-assistant",
"id": "c8e7b0f7f3e5eaf1976e0e7193c42ee2685accd2",
"size": "5049... |
"""
Glance Image Cache Invalid Cache Entry and Stalled Image cleaner
This is meant to be run as a periodic task from cron.
If something goes wrong while we're caching an image (for example the fetch
times out, or an exception is raised), we create an 'invalid' entry. These
entires are left around for debugging purpos... | {
"content_hash": "2c1bac7fd403c784b19b862f36de0a3d",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 77,
"avg_line_length": 32.76923076923077,
"alnum_prop": 0.6744913928012519,
"repo_name": "tanglei528/glance",
"id": "42a5c84494531d8047564298d9bea1bd8f36e788",
"size": "204... |
from bokeh.document import Document
from bokeh.embed import file_html
from bokeh.models import (BoxSelectTool, Circle, Column, ColumnDataSource,
DataTable, Grid, HoverTool, IntEditor, LinearAxis,
NumberEditor, NumberFormatter, Plot, SelectEditor,
... | {
"content_hash": "7425a4541320e1cbe465c1837aef3943",
"timestamp": "",
"source": "github",
"line_count": 75,
"max_line_length": 150,
"avg_line_length": 44.48,
"alnum_prop": 0.6573741007194245,
"repo_name": "ericmjl/bokeh",
"id": "8c209f64f9e9853be0cde3fad9ccbc806c8fe93f",
"size": "3336",
"binary":... |
subreddit = 'buildapcsales'
t_channel = '@buildapcsalesusa'
def send_post(submission, r2t):
return r2t.send_simple(submission)
| {
"content_hash": "422badc4c373412f140968228799d1e6",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 38,
"avg_line_length": 22.166666666666668,
"alnum_prop": 0.7443609022556391,
"repo_name": "Fillll/reddit2telegram",
"id": "02cc6b80eeb0234f981c78126d762e7333bdeaf6",
"size":... |
"""Scheduling Utilities."""
from __future__ import absolute_import, unicode_literals
from itertools import count
from kombu.five import python_2_unicode_compatible
from .imports import symbol_by_name
__all__ = (
'FairCycle', 'priority_cycle', 'round_robin_cycle', 'sorted_cycle',
)
CYCLE_ALIASES = {
'priori... | {
"content_hash": "766010fdd2ea2528f91ec2db17248df0",
"timestamp": "",
"source": "github",
"line_count": 114,
"max_line_length": 72,
"avg_line_length": 26.82456140350877,
"alnum_prop": 0.5784826684107259,
"repo_name": "mdworks2016/work_development",
"id": "9bc4d93625df5c1d7f661377a2fe1d0a32c78374",
... |
"""Unit tests for organization application view."""
from django import http
from google.appengine.ext import ndb
from melange.models import connection as connection_model
from melange.models import contact as contact_model
from melange.models import organization as org_model
from melange.models import survey as surv... | {
"content_hash": "77789b1e36564fdb3320b2d2f10d75b8",
"timestamp": "",
"source": "github",
"line_count": 699,
"max_line_length": 80,
"avg_line_length": 36.15736766809728,
"alnum_prop": 0.7018279654981404,
"repo_name": "rhyolight/nupic.son",
"id": "dbfd3ec2bbd22a53574e808fd76f542a699fca87",
"size": "... |
import pickle
from gzip import open as gzip_open
from collections import defaultdict
# ------------------------------------------------------------------------------
# Openers
#
file_openers = {
"vert": open,
"txt": open,
"gz": gzip_open,
}
def get_opener(file_path):
""" Gets a proper opening functi... | {
"content_hash": "5030a6bcab458bbfec186751d1761dd2",
"timestamp": "",
"source": "github",
"line_count": 72,
"max_line_length": 81,
"avg_line_length": 23.23611111111111,
"alnum_prop": 0.5086670651524208,
"repo_name": "nimcho/dimo",
"id": "0c29a452d3bf2ed38c641b6a602ea108accbbc3e",
"size": "1673",
... |
from __future__ import absolute_import
# Copyright (c) 2010-2019 openpyxl
"""
Enclosing chart object. The various chart types are actually child objects.
Will probably need to call this indirectly
"""
from openpyxl.descriptors.serialisable import Serialisable
from openpyxl.descriptors import (
Typed,
String,
... | {
"content_hash": "33ca4018d918e99f95355656672cda24",
"timestamp": "",
"source": "github",
"line_count": 195,
"max_line_length": 89,
"avg_line_length": 31.394871794871793,
"alnum_prop": 0.6179353152564522,
"repo_name": "cloudera/hue",
"id": "c2bd9b685c1b911befdc38542140c002140882e8",
"size": "6122",... |
from __future__ import unicode_literals
from django.contrib.contenttypes.fields import (
GenericForeignKey, GenericRelation
)
from django.contrib.contenttypes.models import ContentType
from django.db import models
from django.test import TestCase
from django.utils.encoding import python_2_unicode_compatible
from ... | {
"content_hash": "585e56786471dce6081e5180c21ced54",
"timestamp": "",
"source": "github",
"line_count": 108,
"max_line_length": 85,
"avg_line_length": 29.88888888888889,
"alnum_prop": 0.6093556381660471,
"repo_name": "linovia/django-rest-framework",
"id": "a3798b0a39741578dcd39ef39f8dc3626934a0f8",
... |
import unittest
def char_counter(string):
counter = dict()
for char in string:
if char in counter:
counter[char] += 1
else:
counter[char] = 1
result= ""
for key in counter:
result += key + ": " + str(counter[key]) + ", "
return result[0: len(result) ... | {
"content_hash": "0a8ef3b8821acf27e400a1608c971406",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 68,
"avg_line_length": 20.02857142857143,
"alnum_prop": 0.5378031383737518,
"repo_name": "adrianbeloqui/Python",
"id": "d55df40503726ed9b55334e0e855896d3c72c359",
"size": "... |
import lcm
def stripLog(inFile, outFile):
channels = {'CAMERA':True, 'SCAN':True, 'PRE_SPINDLE_TO_POST_SPINDLE':True}
inLog = lcm.EventLog(inFile, 'r')
outLog = lcm.EventLog(outFile, 'w', overwrite=True)
for event in inLog:
if event.channel in channels:
outLog.write_event(... | {
"content_hash": "8170179c927b43213cd75af3374e059c",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 94,
"avg_line_length": 34.333333333333336,
"alnum_prop": 0.6601941747572816,
"repo_name": "openhumanoids/oh-distro",
"id": "1ed1c100c71c1200e2bcd344e1128f60bb2918e4",
"size... |
import re
from pathlib import Path
regex = r"(?:.*/)?(?P<firstname>[^/]*) (?P<lastname>[^/]*)_(?P<moodleid>\d*)_\w*/?.*"
#compileing the regex is optional. It is a performance optimization.
cmp_regex = re.compile(regex)
def parseSub(file_path):
file_path = Path(file_path).as_posix()
m = re.match(cmp_... | {
"content_hash": "d2302ea3e862345a231e74a69c6ea216",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 99,
"avg_line_length": 34.333333333333336,
"alnum_prop": 0.588702559576346,
"repo_name": "ludvi025/graid",
"id": "2028120f82b9ae28a38375b892ce283f765829e7",
"size": "1133",... |
import unittest
def suite():
from babel.messages.tests import catalog, extract, frontend, mofile, \
plurals, pofile, checkers
suite = unittest.TestSuite()
suite.addTest(catalog.suite())
suite.addTest(extract.suite())
suite.addTest(frontend.suite())
suite.add... | {
"content_hash": "0e0aace98a349716552bdac6af10195b",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 74,
"avg_line_length": 31.176470588235293,
"alnum_prop": 0.6377358490566037,
"repo_name": "miracle2k/babel",
"id": "2fb1b2ed245e0d38544fe5e978b5e494e697bf7e",
"size": "1025... |
import uuid
from keystone.common.validation import parameter_types
from keystone.common.validation import validators
from keystone import exception
from keystone import tests
# Test schema to validate create requests against
_CREATE = {
'type': 'object',
'properties': {
'name': parameter_types.name,
... | {
"content_hash": "5b1d4f5c013e40ae25ddbf20aec3ee35",
"timestamp": "",
"source": "github",
"line_count": 147,
"max_line_length": 78,
"avg_line_length": 40.054421768707485,
"alnum_prop": 0.5944293478260869,
"repo_name": "reeshupatel/demo",
"id": "76793c4993a58fbef5c5f43121d0f1e19143c63e",
"size": "64... |
"""
Unit testing module for pytest-pylti plugin
"""
pytest_plugins = 'pytester', # pylint: disable=invalid-name
def test_basic(testdir):
"""Verify basic pylint checks"""
testdir.makepyfile("""import sys""")
result = testdir.runpytest('--pylint')
assert 'Missing module docstring' in result.stdout.str... | {
"content_hash": "ee317f6746b25e8279a0ea1487b5ac10",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 69,
"avg_line_length": 29.56,
"alnum_prop": 0.6623815967523681,
"repo_name": "rutsky/pytest-pylint",
"id": "2a00618cb06b84c5e19cf169252af701fe4dc218",
"size": "1502",
"bi... |
class StemmerI(object):
"""
A processing interface for removing morphological affixes from
words. This process is known as stemming.
"""
def stem(self, token):
"""
Strip affixes from the token and return the stem.
:param token: The token that should be stemmed.
:ty... | {
"content_hash": "fbc1b95b6ae1472124f3b335e26e8f0e",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 66,
"avg_line_length": 24,
"alnum_prop": 0.6145833333333334,
"repo_name": "MiniPlayer/log-island",
"id": "5866a0cc7c180eff040d73d821932676f79c3134",
"size": "673",
"binar... |
def genSubsets(L):
'''
L: list
Returns: all subsets of L
'''
# base case
if len(L) == 0:
return [[]]
# recursive block
# all the subsets of smaller + all the subsets of smaller combined with extra = all subsets of L
extra = L[0:1]
smaller = genSubsets(L[1:])
combine ... | {
"content_hash": "b672e5cddc5e02f26a09e2050fb21bc3",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 101,
"avg_line_length": 25.5625,
"alnum_prop": 0.5721271393643031,
"repo_name": "medifle/python_6.00.1x",
"id": "a98b7b44feddf0456ba25200a194c7a38cc6abff",
"size": "409",
... |
import six
RECON_RELINKER_FILE = 'relinker.recon'
RECON_OBJECT_FILE = 'object.recon'
RECON_CONTAINER_FILE = 'container.recon'
RECON_ACCOUNT_FILE = 'account.recon'
RECON_DRIVE_FILE = 'drive.recon'
DEFAULT_RECON_CACHE_PATH = '/var/cache/swift'
def server_type_to_recon_file(server_type):
if not isinstance(server_ty... | {
"content_hash": "790242285fd706f47024479e99c931c9",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 74,
"avg_line_length": 34.266666666666666,
"alnum_prop": 0.6984435797665369,
"repo_name": "openstack/swift",
"id": "44c8fb8ef159921ae842fd2aefa9d9c9e99bcca2",
"size": "1109... |
from paddle import _C_ops
from paddle.fluid.framework import dygraph_only
__all__ = []
@dygraph_only
def addmm(input, x, y, beta=1.0, alpha=1.0, name=None):
"""
Note:
This API is only supported from ``CUDA 11.0`` .
Applies matrix multiplication for `x` and `y` , `input` is added to
the final... | {
"content_hash": "829d28873a7e9b6b10826245bd9c6463",
"timestamp": "",
"source": "github",
"line_count": 68,
"max_line_length": 142,
"avg_line_length": 38.23529411764706,
"alnum_prop": 0.5903846153846154,
"repo_name": "luotao1/Paddle",
"id": "a09611d2d0f5178685c5b5488de30e96d8b489e9",
"size": "3213"... |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('smartshark', '0016_auto_20160610_1438'),
]
operations = [
migrations.AlterField(
model_name='plugin',
name='active',
... | {
"content_hash": "a20f156fcfd060fc44ded1251cbc29c2",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 53,
"avg_line_length": 21.333333333333332,
"alnum_prop": 0.5989583333333334,
"repo_name": "smartshark/serverSHARK",
"id": "d982f3f8714e235a019ef4a6b0c8772b691096ab",
"size"... |
import os
import sys
import shutil
import sqlite3
class Logger(object):
def __init__(self, log_file):
self.terminal = sys.stdout
self.log = open(log_file, "w")
def write(self, message):
self.terminal.write(message)
self.log.write(message)
def flush(self):
#this f... | {
"content_hash": "2086a99be4d7df7569963f06fa67349f",
"timestamp": "",
"source": "github",
"line_count": 51,
"max_line_length": 77,
"avg_line_length": 25.647058823529413,
"alnum_prop": 0.6666666666666666,
"repo_name": "aylward/ITKTubeTK",
"id": "47f65129041140fa598701e37c06d3aca0862e48",
"size": "13... |
from bigml.api import BigML
api = BigML()
source1_file = "iris.csv"
args = \
{'fields': {'000000': {'name': 'sepal length', 'optype': 'numeric'},
'000001': {'name': 'sepal width', 'optype': 'numeric'},
'000002': {'name': 'petal length', 'optype': 'numeric'},
'000003': {'name': 'petal width', 'optype': 'numeric'},
'0000... | {
"content_hash": "ab56d661af03226425f6301a6d7c422e",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 68,
"avg_line_length": 30.736842105263158,
"alnum_prop": 0.6386986301369864,
"repo_name": "jaor/bigmler",
"id": "16827017e4b1dd0f70bdc098ad28d0a6a29eed5c",
"size": "584",
... |
"""
flask.ext.security.decorators
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Flask-Security decorators module
:copyright: (c) 2012 by Matt Wright.
:license: MIT, see LICENSE for more details.
"""
from collections import namedtuple
from functools import wraps
from flask import current_app, Response, request, ... | {
"content_hash": "9bce3ce20b742c08c4f272e54a27c154",
"timestamp": "",
"source": "github",
"line_count": 205,
"max_line_length": 82,
"avg_line_length": 31.004878048780487,
"alnum_prop": 0.6428571428571429,
"repo_name": "maxziv/SEApp",
"id": "40b5ba58b9d00219621b2c5f923629b24d767ae0",
"size": "6380",... |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('imager_images', '0004_auto_20170206_1601'),
]
operations = [
migrations.AlterField(
model_name='photo',
name='photo',
... | {
"content_hash": "3eb462f50a114f236e4913d6b440282d",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 61,
"avg_line_length": 22.57894736842105,
"alnum_prop": 0.5874125874125874,
"repo_name": "midfies/django-imager",
"id": "da0d23ec593d2c369d8e74bb701c6cee9bf037f5",
"size": ... |
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('leaderboard', '0002_auto_20161030_2333'),
('activities', '0001_initial'),
]
operations = [
migrations.AddFi... | {
"content_hash": "c12688949781093017be7edbaba1efe9",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 248,
"avg_line_length": 35.56666666666667,
"alnum_prop": 0.5876288659793815,
"repo_name": "JeromeRisselin/PRJ-medtec_sigproc",
"id": "9cbf41d33ec56c841a239cd6fcc1dc2eb39edf3b... |
from girder.exceptions import ValidationException
from girder.plugin import GirderPlugin
from girder.utility import setting_utilities
from . import constants, rest
@setting_utilities.validator(constants.PluginSettings.GOOGLE_ANALYTICS_TRACKING_ID)
def validateTrackingId(doc):
if not doc['value']:
raise V... | {
"content_hash": "4e73da28e4512183862eb38c6093673f",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 93,
"avg_line_length": 32.26315789473684,
"alnum_prop": 0.763458401305057,
"repo_name": "kotfic/girder",
"id": "91036786f606ec7020a0193600b3b8506c8a2570",
"size": "1402",
... |
from annotations import Annotations, ExpansionError
from jstruct_generator import CGenerator
from preprocess import preprocess
from pycparser import c_parser, c_ast, plyparser
import re
GENERATED1NL = '// Generated automatically by libjstruct. Do Not Modify.\n'
GENERATED = GENERATED1NL + '\n'
INIT_INSTRUCTIONS = '// ... | {
"content_hash": "39365ce63799abe61cab167f1858189f",
"timestamp": "",
"source": "github",
"line_count": 198,
"max_line_length": 102,
"avg_line_length": 35.25757575757576,
"alnum_prop": 0.6110872367855608,
"repo_name": "jamie-pate/jstruct",
"id": "f3670adf0193dc86fc38cecbf22bd1fe6410f278",
"size": "... |
"""
Examples of using the API from datastax to query Cassandra
https://datastax.github.io/python-driver/api/index.html
"""
import pprint
import uuid
from cassandra.cluster import Cluster
from cassandra.cqlengine.connection import setup
from cassandra.cqlengine.management import sync_table
from cassandra.cqlengine.fun... | {
"content_hash": "eaf6ab1477cba4b77c74f7357d442b82",
"timestamp": "",
"source": "github",
"line_count": 130,
"max_line_length": 142,
"avg_line_length": 35.50769230769231,
"alnum_prop": 0.6009532062391681,
"repo_name": "WilliamQLiu/django-cassandra-prototype",
"id": "c92469d6506246b8741ec1177be7f4486d... |
import inspect
import six
from .core import Locust, TaskSet
from .log import console_logger
def print_task_ratio(locusts, total=False, level=0, parent_ratio=1.0):
d = get_task_ratio_dict(locusts, total=total, parent_ratio=parent_ratio)
_print_task_ratio(d)
def _print_task_ratio(x, level=0):
for k, v in s... | {
"content_hash": "b446aacad349fab2ad1110a3c40e0d6e",
"timestamp": "",
"source": "github",
"line_count": 51,
"max_line_length": 93,
"avg_line_length": 31.96078431372549,
"alnum_prop": 0.5779141104294478,
"repo_name": "locustrelease/locust",
"id": "15555341e817771aa3793fcce1fef1e1a669b99d",
"size": "... |
import os
import sys
import time
import inspect
import traceback
saved_path = sys.path[:]
sys.path.append(os.path.dirname(os.path.abspath(inspect.getsourcefile(lambda:0))))
from internal.memcached_connection import MemcachedBinaryConnection
from internal.memcached_connection import STATUS, COMMANDS
mc = MemcachedBin... | {
"content_hash": "7bce0ad05d602cfad2e2935b6455f039",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 92,
"avg_line_length": 28.727272727272727,
"alnum_prop": 0.6050632911392405,
"repo_name": "tarantool/memcached",
"id": "50c2698762f13ce3b212a253ce787cdcc5146830",
"size": "... |
from __future__ import unicode_literals
from django.core.exceptions import ValidationError
from django import forms
from django.forms import widgets
from django.template import engines
from django.template.loader import select_template
from django.utils.translation import ugettext_lazy as _, ugettext
from cms.plugin_... | {
"content_hash": "1d9168229f8d82eeaeb276406ef4ad2a",
"timestamp": "",
"source": "github",
"line_count": 65,
"max_line_length": 122,
"avg_line_length": 38.43076923076923,
"alnum_prop": 0.6837469975980784,
"repo_name": "khchine5/django-shop",
"id": "00f9abba029ebc3dbf833345734a4ca9d0ffda5d",
"size": ... |
extensions = []
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
# The suffix of source filenames.
source_suffix = '.rst'
# The encoding of source files.
#source_encoding = 'utf-8-sig'
# The master toctree document.
master_doc = 'index'
# General information ... | {
"content_hash": "1f94acfb4230a9d43ed02b34433f8638",
"timestamp": "",
"source": "github",
"line_count": 215,
"max_line_length": 80,
"avg_line_length": 31.506976744186048,
"alnum_prop": 0.7044582226158843,
"repo_name": "grue/django-allauth",
"id": "1feae52de60edbe2f0f8aa3beb341dac2223675a",
"size": ... |
import vim
from os import path
import urllib2
import urllib
import json
import subprocess
import time
import re
server_addr = vim.eval('g:padawan#server_addr')
server_command = vim.eval('g:padawan#server_command')
cli = vim.eval('g:padawan#cli')
composer = vim.eval('g:padawan#composer_command')
timeout = float(vim.eva... | {
"content_hash": "303890a26d70b3f3a0a7db9e49c9bb0e",
"timestamp": "",
"source": "github",
"line_count": 253,
"max_line_length": 81,
"avg_line_length": 28.766798418972332,
"alnum_prop": 0.5103050288540808,
"repo_name": "xintron/padawan.vim",
"id": "287a246e151550c9374b881dea1deaa5bf415f44",
"size": ... |
"""All the test files for API renderers plugins are imported here."""
# These need to register plugins so, pylint: disable=unused-import
from grr.gui.api_plugins import aff4_test
from grr.gui.api_plugins import artifact_test
from grr.gui.api_plugins import client_test
from grr.gui.api_plugins import config_test
from... | {
"content_hash": "b969ec56647fd3e9298957bd642778f0",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 69,
"avg_line_length": 39.125,
"alnum_prop": 0.8019169329073482,
"repo_name": "pombredanne/grr",
"id": "8518601e9ecdd2fdf1d5a93ea4cbf0ba2bae0ac0",
"size": "648",
"binary"... |
import time
import json
import re
import os
from datetime import datetime, timedelta
from six.moves.urllib.parse import urlparse # pylint: disable=import-error
from msrest.paging import Paged
from azure.mgmt.recoveryservices.models import Vault, VaultProperties, Sku, SkuName, BackupStorageConfig
from azure.mgmt.recov... | {
"content_hash": "147f91b8466e7ad45fad3a4883a00cc6",
"timestamp": "",
"source": "github",
"line_count": 766,
"max_line_length": 134,
"avg_line_length": 44.608355091383814,
"alnum_prop": 0.6719344454199591,
"repo_name": "QingChenmsft/azure-cli",
"id": "f38bd46514b3806f0725ef8b495bb9d37a8b3e7f",
"siz... |
from robot.libraries.BuiltIn import BuiltIn
class LogLevels(object):
ROBOT_LISTENER_API_VERSION = 2
def __init__(self):
self.ROBOT_LIBRARY_LISTENER = self
self.messages = []
def _log_message(self, msg):
self.messages.append('%s: %s' % (msg['level'], msg['message']))
def logg... | {
"content_hash": "d3c8534abfbb30cc65b6324efa5d3fe6",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 80,
"avg_line_length": 29.4,
"alnum_prop": 0.6303854875283447,
"repo_name": "snyderr/robotframework",
"id": "3d367158dcc9a1e07fce4e52e4cc35b46e6f5ca8",
"size": "441",
"bi... |
"""Writes WMT training data from tfds to a TSV file, and generates spm model."""
import csv
import os
import tempfile
from absl import app
from absl import flags
from sentencepiece import SentencePieceTrainer
import tensorflow.compat.v2 as tf
import tensorflow_datasets as tfds
FLAGS = flags.FLAGS
flags.DEFINE_string... | {
"content_hash": "4c3f372471bb470dae07169745770438",
"timestamp": "",
"source": "github",
"line_count": 234,
"max_line_length": 88,
"avg_line_length": 36.84615384615385,
"alnum_prop": 0.6565762004175365,
"repo_name": "google-research/google-research",
"id": "51c64ac9c5136b886e1d4c189629eea01bd19511",... |
from rest_framework import serializers
from social.app.models.author import Author
class UnknownAuthorSerializer(serializers.Serializer):
"""
Used in input cases where we don't necessarily know about a remote Author yet, so it doesn't make sense
to use a ModelSerializer
"""
id = serializers.URLFi... | {
"content_hash": "59795f7ab5df655a18e0b902ad230d40",
"timestamp": "",
"source": "github",
"line_count": 59,
"max_line_length": 116,
"avg_line_length": 35.08474576271186,
"alnum_prop": 0.6903381642512078,
"repo_name": "TeamAADGT/CMPUT404-project-socialdistribution",
"id": "249f70b6b4c873404ec7c4f0a3f5... |
from contextlib import contextmanager
import os
from unittest import mock
from mako.cmd import cmdline
from mako.testing.assertions import eq_
from mako.testing.assertions import expect_raises
from mako.testing.assertions import expect_raises_message
from mako.testing.config import config
from mako.testing.fixtures im... | {
"content_hash": "940035677ec6e151c1393d0de11a5847",
"timestamp": "",
"source": "github",
"line_count": 97,
"max_line_length": 79,
"avg_line_length": 34.96907216494845,
"alnum_prop": 0.527122641509434,
"repo_name": "chromium/chromium",
"id": "785c652304a5f2adc4decfe4e00d10482b97f270",
"size": "3392... |
"""This module contains classes used for decks."""
import random
from .cards import Card
class Deck(object):
"""
A class which specifies the details of the deck of playing cards.
"""
def __init__(self, packs):
"""
The method used to construct a deck using a given number of packs of pl... | {
"content_hash": "ecbe23ff4bb4ad0e74e23e3508555423",
"timestamp": "",
"source": "github",
"line_count": 84,
"max_line_length": 98,
"avg_line_length": 26.904761904761905,
"alnum_prop": 0.5323008849557522,
"repo_name": "ExcaliburZero/blackjack",
"id": "9c1a09d893756a918260f3fdbcfe816000d65a36",
"size... |
"""
For a set of SWC neurons (subset of dendrites), load them in the model [1] and
calculate stats which can later be used for parameter estimation.
"""
import statistics
import glob
import textwrap
from pprint import pformat
from plucky import merge, plucks
from swc import LineSegment, read_neuron
from model import ... | {
"content_hash": "5aa337248eeb6c6c37f1df06d327d983",
"timestamp": "",
"source": "github",
"line_count": 174,
"max_line_length": 84,
"avg_line_length": 35.252873563218394,
"alnum_prop": 0.628953374633192,
"repo_name": "randomir/dendritic-growth-model",
"id": "d3055926ab8d78b826a586fe05952821e0118e7a",... |
"""
:Author: Juti Noppornpitak <jnopporn@shiroyuki.com>
:Stability: Stable
"""
from bson import ObjectId
from tori.data.serializer import ArraySerializer
from tori.db.exception import ReadOnlyProxyException
from tori.db.metadata.helper import EntityMetadataHelper
class Serializer(ArraySerializer):
""" Object Ser... | {
"content_hash": "ba4870b7a836a349577d62d7bc136bcb",
"timestamp": "",
"source": "github",
"line_count": 330,
"max_line_length": 123,
"avg_line_length": 33.73030303030303,
"alnum_prop": 0.5964423681609918,
"repo_name": "shiroyuki/Tori",
"id": "4e628a874cf69702cd3a9f27d78465a6d3ea4387",
"size": "1115... |
from sqlalchemy.testing import assert_raises, assert_raises_message
import sqlalchemy as sa
from sqlalchemy import Integer, PickleType, String, ForeignKey
import operator
from sqlalchemy import testing
from sqlalchemy.util import OrderedSet
from sqlalchemy.orm import mapper, relationship, create_session, \
PropComp... | {
"content_hash": "7601b8485a05a1eabb3a34f6e01cc7fe",
"timestamp": "",
"source": "github",
"line_count": 1413,
"max_line_length": 76,
"avg_line_length": 32.35527246992215,
"alnum_prop": 0.5323067500765563,
"repo_name": "rclmenezes/sqlalchemy",
"id": "e1474f39b1284d789dd1678161c15cf482a2097e",
"size"... |
__author__ = 'Lynch Lee' | {
"content_hash": "21975379da77228490cc62c9c3453f50",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 24,
"avg_line_length": 24,
"alnum_prop": 0.5833333333333334,
"repo_name": "easemob/emchat-server-examples",
"id": "986bbd123a94b15338a5c564776f9e98ed467c60",
"size": "66",
... |
from __future__ import absolute_import
import os
import click
from zhihudaily.crawler import Crawler
from zhihudaily.app import create_app
from zhihudaily.configs import DevelopConfig, ProductionConfig
CONFIG = (ProductionConfig if os.environ.get('FLASK_APP_ENV') == 'production'
else DevelopConfig)
app =... | {
"content_hash": "3cc6c5989a1f4ac8be61771f82ab55ae",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 77,
"avg_line_length": 23.245283018867923,
"alnum_prop": 0.6599025974025974,
"repo_name": "lord63/zhihudaily",
"id": "793a02fde9f570725dcfe389acbe9ea1030926b0",
"size": "12... |
import cv2
import sys
# Get user supplied values
imagePath = sys.argv[1]
cascPath = sys.argv[2]
# Create the haar cascade
faceCascade = cv2.CascadeClassifier(cascPath)
# Read the image
image = cv2.imread(imagePath)
gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
# Detect faces in the image
faces = faceCascade.detect... | {
"content_hash": "1e7e839fcc023f47a6efb2271f064ece",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 60,
"avg_line_length": 21.40625,
"alnum_prop": 0.6846715328467153,
"repo_name": "eugenekolo/EC500",
"id": "08189a183b33f9a8a06230b5a031a23a888409f4",
"size": "685",
"bina... |
from SDSURLS import app
import config
if __name__ == "__main__":
from wsgiref import simple_server
httpd = simple_server.make_server(config.host, config.port, app)
httpd.serve_forever() | {
"content_hash": "64cd1612bb97981f7fbb13db263c147f",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 68,
"avg_line_length": 28.285714285714285,
"alnum_prop": 0.696969696969697,
"repo_name": "EpicDavi/SDSURLS",
"id": "4e8a30aa82b63239131822ce88244557c2c602dc",
"size": "198",... |
import sys
import os
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
projectPath = os.getcwd() + '/../raxas'
sys.path.insert(0, os... | {
"content_hash": "b21bd3f1687c255eff0e00e2b9768d1c",
"timestamp": "",
"source": "github",
"line_count": 321,
"max_line_length": 132,
"avg_line_length": 32.62305295950156,
"alnum_prop": 0.7091291061879297,
"repo_name": "rackerlabs/rax-autoscaler",
"id": "d3c33fbb607e3fc240d1cedaa437c71d9944d516",
"s... |
from time import time
from urlparse import urlparse
from django.db import models
from django.db.models.signals import post_save
from django.dispatch import receiver
from mezzanine.core.models import Displayable, Ownable
from mezzanine.generic.models import Rating
from mezzanine.generic.fields import RatingField, Comm... | {
"content_hash": "61c8b20331e731ff2ca118df3a65f786",
"timestamp": "",
"source": "github",
"line_count": 54,
"max_line_length": 69,
"avg_line_length": 28.814814814814813,
"alnum_prop": 0.7011568123393316,
"repo_name": "baturay/ne-istiyoruz",
"id": "871fcaf39465fc3e231ba4a71ddcc90307ac1f12",
"size": ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.