text stringlengths 4 1.02M | meta dict |
|---|---|
import string, cgi, time, requests
from os import curdir, sep
from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
# import pri
class MyHandler(BaseHTTPRequestHandler):
def do_GET(self):
try:
if self.path.endswith(".api"):
self.send_response(200)
self.... | {
"content_hash": "2d9c2c12ca62d6368ca15731bcce7a76",
"timestamp": "",
"source": "github",
"line_count": 104,
"max_line_length": 117,
"avg_line_length": 36.96153846153846,
"alnum_prop": 0.4815296566077003,
"repo_name": "lsnow2017/ACDMedia",
"id": "656d231a5ca57c2e37d49abaae3d497dee9179a8",
"size": "... |
from __future__ import print_function, division, absolute_import
from logging import getLogger
from textwrap import dedent
log = getLogger(__name__)
def dals(string):
"""dedent and left-strip"""
return dedent(string).lstrip()
def _get_attr(obj, attr_name, aliases=()):
try:
return getattr(obj, a... | {
"content_hash": "16fd96488964979bf2e96be2818d5e1a",
"timestamp": "",
"source": "github",
"line_count": 66,
"max_line_length": 89,
"avg_line_length": 30.742424242424242,
"alnum_prop": 0.5736816165598817,
"repo_name": "zooba/PTVS",
"id": "69d31b8d58bdadbcacd2f3a7f7a90c78ce4119b8",
"size": "2053",
... |
from __future__ import absolute_import
from pipeline.compressors import CompressorBase
class SlimItCompressor(CompressorBase):
"""
JS compressor based on the Python library slimit
(http://pypi.python.org/pypi/slimit/).
"""
def compress_js(self, js):
from slimit import minify
retur... | {
"content_hash": "17b996e992b9ed01641fa737df7074e0",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 52,
"avg_line_length": 25.615384615384617,
"alnum_prop": 0.6936936936936937,
"repo_name": "hyperoslo/django-pipeline",
"id": "8a9a600637f54e5ba82910162479d3559f96d0ee",
"si... |
from py3oauth2 import message
from py3oauth2.authorizationcodegrant import (
AccessTokenRequest,
AuthorizationRequest,
)
from oidc.idtoken import IDToken as BaseIDToken
__all__ = ['IDToken', 'AuthenticationRequest', 'AccessTokenRequest']
class AuthenticationRequest(AuthorizationRequest):
# OAuth2.0 para... | {
"content_hash": "3c58bc4a11d5d1c3c7e5f4a5e04d0e45",
"timestamp": "",
"source": "github",
"line_count": 59,
"max_line_length": 77,
"avg_line_length": 34.52542372881356,
"alnum_prop": 0.6607756504663721,
"repo_name": "GehirnInc/python-oidc",
"id": "876d1ff36e2a96c79d84cd1dd23b5c8eb95ebc5b",
"size": ... |
import tests.model_control.test_ozone_custom_models_enabled as testmod
testmod.build_model( ['Logit'] , ['PolyTrend'] , ['Seasonal_WeekOfYear'] , ['MLP'] ); | {
"content_hash": "75a218f1b1dda3f4beeeb307b3a9cb1e",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 85,
"avg_line_length": 39.5,
"alnum_prop": 0.7088607594936709,
"repo_name": "antoinecarme/pyaf",
"id": "54b8634a9572e4f3cc83420502ae840963d614ca",
"size": "158",
"binary":... |
from check_link import is_absolute
from domain import get_domain
from check_link import check_link # Todo: not used
def get_button_str(link, text):
return ' <a href="%s" target="_blank" class="btn btn-outline-secondary btn-sm" role="button">' % link + ' %s' % text + '</a>\n'
def get_button_str_inplace(link, text... | {
"content_hash": "d2ed5d2270fb888fa01c9ea49147e3f3",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 132,
"avg_line_length": 40.5,
"alnum_prop": 0.6659404502541757,
"repo_name": "syncle/syncle.github.io",
"id": "9230a7eb37e0e1541b90aedd8ee3b1f68143a799",
"size": "1378",
... |
"""
Example of using Google Maps queries and PyMap3D
https://developers.google.com/places/web-service/search
This requires a Google Cloud key, and costs a couple US cents per query.
TODO: Would like to instead query a larger region, would OSM be an option?
"""
import functools
from argparse import ArgumentParser
fro... | {
"content_hash": "6c7c438c3318c3e1f4115a9d13f0e12b",
"timestamp": "",
"source": "github",
"line_count": 75,
"max_line_length": 98,
"avg_line_length": 30.546666666666667,
"alnum_prop": 0.6551724137931034,
"repo_name": "geospace-code/pymap3d",
"id": "f0755e4798c1ffba4ba50bd907474eab41211e92",
"size":... |
import pyaf.Bench.TS_datasets as tsds
import tests.artificial.process_artificial_dataset as art
art.process_dataset(N = 128 , FREQ = 'D', seed = 0, trendtype = "ConstantTrend", cycle_length = 7, transform = "Quantization", sigma = 0.0, exog_count = 100, ar_order = 0); | {
"content_hash": "c54866ef79433b69fdd80dc00d4ad2f8",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 172,
"avg_line_length": 38.857142857142854,
"alnum_prop": 0.7132352941176471,
"repo_name": "antoinecarme/pyaf",
"id": "7ee2f79978e4ac84b24b901d2e52e84ba6416499",
"size": "27... |
import sys
from mixbox.binding_utils import *
class malwareMetaData(GeneratedsSuper):
"""This is the top level element for the xml document. Required
attribute is version. Open issues: 2. Right way to express
commonality in field data so that it can be combined properly 3.
How to handle unicode in url... | {
"content_hash": "f58acacac01a0a8084963dbed2f8c1e5",
"timestamp": "",
"source": "github",
"line_count": 3342,
"max_line_length": 588,
"avg_line_length": 47.39108318372232,
"alnum_prop": 0.6269754579147752,
"repo_name": "MAECProject/python-maec",
"id": "b70d006d7191a53b5d626e74f2130a9ade0df109",
"si... |
from block import *
import os
import time
import base64
from logging import ERROR, WARN, INFO, DEBUG
class file_data_reader(Block):
def on_load(self, config):
self.config = config
self.add_port("input", Port.PUSH, Port.UNNAMED, ["url"])
self.add_port("output", Port.PUSH, Port.UNNAMED, ["url", "data"])
... | {
"content_hash": "0e0ab19df6d745a433357867cb25f8fd",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 92,
"avg_line_length": 32.12,
"alnum_prop": 0.6450809464508095,
"repo_name": "mpi-sws-rse/datablox",
"id": "25861e0aba3ded9f19e6d6ae0e662777e412c33b",
"size": "803",
"bin... |
"""
FILE: sample_begin_get_route_directions_batch.py
DESCRIPTION:
This sample demonstrates how to sends batches of route direction queries.
USAGE:
python begin_get_route_directions_batch.py
Set the environment variables with your own values before running the sample:
- AZURE_SUBSCRIPTION_KEY - your sub... | {
"content_hash": "9724438181787be15cd1c53e134411c5",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 104,
"avg_line_length": 32.774193548387096,
"alnum_prop": 0.7312992125984252,
"repo_name": "Azure/azure-sdk-for-python",
"id": "08e21b6f79c8cd38ce144ef72a4319aa76ea918e",
"... |
from django.contrib import admin
from django.contrib.auth import get_user_model
from django.utils.translation import ugettext_lazy as _, ungettext
from .models import Comment
from .views.moderation import perform_flag, perform_approve, perform_delete
from tango_admin.admin_actions import nuke_users
class UsernameSe... | {
"content_hash": "ad1b36178540eabf7c7f3cb5f5442bb4",
"timestamp": "",
"source": "github",
"line_count": 87,
"max_line_length": 99,
"avg_line_length": 39.310344827586206,
"alnum_prop": 0.6163742690058479,
"repo_name": "tBaxter/tango-comments",
"id": "f3af3243095ff6382073b26ad17dad6571487636",
"size"... |
import unittest
import pyqubes.validate
import pyqubes.constants
class TestvalidateLinuxUsername(unittest.TestCase):
def test_validate_linux_username_valid_simple(self):
input_string = "foobar"
valid_input_string = pyqubes.validate.linux_username(input_string)
self.assertEqual(valid_input... | {
"content_hash": "75868c3b059560172420312b3d3e7c60",
"timestamp": "",
"source": "github",
"line_count": 120,
"max_line_length": 79,
"avg_line_length": 42.85,
"alnum_prop": 0.6997277323998444,
"repo_name": "tommilligan/pyqubes",
"id": "d03407c791469abc90c286e86bdf016f767fb993",
"size": "5165",
"bi... |
import sys, re
from engine.database import Database
db = Database("numbers.sqlite")
with db as conn:
for row in conn.execute("SELECT * from log ORDER BY time"):
print(row)
| {
"content_hash": "4e588a33a1376001bf89fb712e9d95a4",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 63,
"avg_line_length": 26.428571428571427,
"alnum_prop": 0.6972972972972973,
"repo_name": "benjaveri/phonescreen",
"id": "ee2c06826e132780c7900038b48871fe73bf78f6",
"size": ... |
import operator
from collections import OrderedDict, defaultdict
class LRUDict(OrderedDict):
# https://gist.github.com/davesteele/44793cd0348f59f8fadd49d7799bd306
def __init__(self, *args, maximum_length: int, **kwargs):
assert maximum_length > 0
self.maximum_length = maximum_length
s... | {
"content_hash": "b9638f53b09d3cddcfb8cfca463e92d6",
"timestamp": "",
"source": "github",
"line_count": 51,
"max_line_length": 74,
"avg_line_length": 28.647058823529413,
"alnum_prop": 0.6071184120465435,
"repo_name": "crosscompute/crosscompute",
"id": "75455edf9e67353edbc3774bcec3795142fe26fe",
"si... |
"""
core-daemon: the CORE daemon is a server process that receives CORE API
messages and instantiates emulated nodes and networks within the kernel. Various
message handlers are defined and some support for sending messages.
"""
import argparse
import logging
import os
import time
from configparser import ConfigParser... | {
"content_hash": "fbe2eee2a7c6e59b938c60bcb4b70820",
"timestamp": "",
"source": "github",
"line_count": 130,
"max_line_length": 98,
"avg_line_length": 28.423076923076923,
"alnum_prop": 0.6568335588633288,
"repo_name": "coreemu/core",
"id": "6b9caa54e90e6ab3e87d4120560e56dbe8bf23ca",
"size": "3695",... |
"""
Testing for Support Vector Machine module (sklearn.svm)
TODO: remove hard coded numerical results when possible
"""
import warnings
import numpy as np
from numpy.testing import (assert_array_equal, assert_array_almost_equal,
assert_almost_equal)
from scipy import sparse
from nose.tools ... | {
"content_hash": "20c8f2ba64ab8b4f47b2bf2f5fc6a726",
"timestamp": "",
"source": "github",
"line_count": 676,
"max_line_length": 78,
"avg_line_length": 33.71597633136095,
"alnum_prop": 0.6202614952614952,
"repo_name": "B3AU/waveTree",
"id": "8b0ad94d0af93d9825caec313d2f44a30efbc1e4",
"size": "22792"... |
'''
nje_limbcorr_v2
Author: Nicholas J. Elmer
Department of Atmospheric Science, University of Alabama in Huntsville (UAH)
NASA Short-term Prediction Research and Transition (SPoRT) Center
Huntsville, Alabama, USA
[email protected]
Version: 2.0 (Last updated June 2016)
Note: The function call is differe... | {
"content_hash": "da48058157bc642519a14e94f13eb667",
"timestamp": "",
"source": "github",
"line_count": 495,
"max_line_length": 99,
"avg_line_length": 39.345454545454544,
"alnum_prop": 0.5979667282809612,
"repo_name": "njelmer/limbcorr",
"id": "c14921ac80daee7477334f195841772f81df1484",
"size": "19... |
import platform
import socket
import subprocess
PORT_TIMEOUT = 5
PING_TIMEOUT = 5
def is_port_open(host: str, port: int) -> bool:
"""
Test if a given port in a host is open.
"""
# pylint: disable=invalid-name
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.settimeout(PORT_TIMEOUT)
... | {
"content_hash": "0ed0a856bbc8f25507624dd9b680df71",
"timestamp": "",
"source": "github",
"line_count": 51,
"max_line_length": 68,
"avg_line_length": 23.137254901960784,
"alnum_prop": 0.6127118644067797,
"repo_name": "zhouyao1994/incubator-superset",
"id": "8079a96e203b1d94128f78d3b2c505ef194df0ae",
... |
from __future__ import absolute_import
from fabric import colors
from lib.base import (
BGPContainer,
CmdBuffer,
try_several_times,
wait_for_completion,
)
class ExaBGPContainer(BGPContainer):
SHARED_VOLUME = '/shared_volume'
PID_FILE = '/var/run/exabgp.pid'
def __init__(self, name, asn... | {
"content_hash": "0d944b88aa7b8a002b370eac15f7ae72",
"timestamp": "",
"source": "github",
"line_count": 296,
"max_line_length": 134,
"avg_line_length": 35.432432432432435,
"alnum_prop": 0.5069603356216629,
"repo_name": "tamihiro/gobgp",
"id": "1326dd86382988f1a8ce17fc802a5aefac9317c0",
"size": "111... |
"""
pyexcel_io.database
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
database data importer and exporter
:copyright: (c) 2014-2017 by Onni Software Ltd.
:license: New BSD License, see LICENSE for more details
"""
from pyexcel_io.plugins import IOPluginInfoChain
from pyexcel_io.constants import DB_DJANGO, DB... | {
"content_hash": "5f598b529977d6cbd4a19f7561657ec9",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 68,
"avg_line_length": 30.653846153846153,
"alnum_prop": 0.6925972396486826,
"repo_name": "caspartse/QQ-Groups-Spider",
"id": "01357e47de148709fbe3497070ff947f9398918f",
"s... |
from django.conf import settings
from storages.backends.s3boto import S3BotoStorage
from django.contrib.staticfiles.storage import ManifestFilesMixin
from toolware.utils.generic import get_domain
from .. import defaults as defs
class MediaFilesStorage(S3BotoStorage):
"""
Custom S3 storage for uploaded asse... | {
"content_hash": "1cd88d06c930f834239d9a38cd828137",
"timestamp": "",
"source": "github",
"line_count": 46,
"max_line_length": 82,
"avg_line_length": 34.32608695652174,
"alnum_prop": 0.6681443951868271,
"repo_name": "un33k/djangoware",
"id": "4826883ed07e27d2452a65b5025ebfe8a56fa7b6",
"size": "1789... |
__all__ = ['arc','arrow','axis','colorbar','compass','contour','default',
'getlimits','halftone','legend','plot','polygon','rgb','rect',
'regionfile','savefig','stick','subplot','subplot2','text','title',
'vector','vectorkey','xlabel','ylabel']
from arc import arc
from arrow import arr... | {
"content_hash": "0b3fb8a7f6197361e6084012ea06f5df",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 78,
"avg_line_length": 31.3,
"alnum_prop": 0.7646432374866879,
"repo_name": "nlchap0/nlcpython",
"id": "4ca832f76f1f2eeeaf71a1b1942aac859c9d13b3",
"size": "985",
"binary"... |
"""
Helper script for starting/stopping/reloading Glance server programs.
Thanks for some of the code, Swifties ;)
"""
from __future__ import print_function
from __future__ import with_statement
import argparse
import fcntl
import os
import resource
import signal
import subprocess
import sys
import tempfile
import ti... | {
"content_hash": "45f374e15097f3bb9e647226ff0d33af",
"timestamp": "",
"source": "github",
"line_count": 371,
"max_line_length": 78,
"avg_line_length": 33.725067385444746,
"alnum_prop": 0.5417998721227621,
"repo_name": "redhat-openstack/glance",
"id": "e388362c4a6e9332a1cf074141f3bffc74af8e1c",
"siz... |
import httplib
import time
import base64
import urllib
import StringIO
import sys
import socket
try:
from oss.oss_util import *
except:
from oss_util import *
try:
from oss.oss_xml_handler import *
except:
from oss_xml_handler import *
class OssAPI:
'''
A simple OSS API
'''
DefaultCont... | {
"content_hash": "7b9e733ff792952a0e5ec70d56f13ce9",
"timestamp": "",
"source": "github",
"line_count": 2028,
"max_line_length": 197,
"avg_line_length": 29.381163708086785,
"alnum_prop": 0.5390450616765965,
"repo_name": "luzhijun/Optimization",
"id": "2a937cccdd325cdcbe097d457e3b4fce883dbb83",
"siz... |
class Graph:
def __init__(self, graph_dict=None):
"""initializes a graph object"""
if graph_dict is None:
graph_dict = {}
self.__graph_dist = graph_dict
def __str__(self):
return "Undirected Graph \nNodes: %s \nEdges: %s" % (
self.list_vertices(), self.li... | {
"content_hash": "3f52e1d07946da85169af28299e6b3ec",
"timestamp": "",
"source": "github",
"line_count": 124,
"max_line_length": 72,
"avg_line_length": 27.629032258064516,
"alnum_prop": 0.5224751897256276,
"repo_name": "codervikash/algorithms",
"id": "8eb07347336360e0e897a02fabb64477591c429b",
"size... |
import os
import sys
#Adding directory to the path where Python searches for modules
cmd_folder = os.path.dirname('/home/arvind/Documents/Me/My_Projects/Git/Crypto/modules/')
sys.path.insert(0, cmd_folder)
import mtrand
if __name__ == "__main__":
mt= []
mtrand.init_by_array(19650218)
n= 1
for i in ran... | {
"content_hash": "326d169abf578624f96c5992c63a31cb",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 89,
"avg_line_length": 26.5625,
"alnum_prop": 0.6729411764705883,
"repo_name": "arvinddoraiswamy/blahblah",
"id": "ac57de74ff17ed295defc5553a33c1e7c99f1a3e",
"size": "425",... |
import os
import shutil
import tempfile
import sys
import pip
from cloudify.utils import LocalCommandRunner
from cloudify import utils
def extract_plugin_name(plugin_url):
previous_cwd = os.getcwd()
fetch_plugin_from_pip_by_url = not os.path.isdir(plugin_url)
plugin_dir = plugin_url
try:
if f... | {
"content_hash": "5ca4ddb1cd55dfe5b01e4e944567bb2e",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 79,
"avg_line_length": 36.741379310344826,
"alnum_prop": 0.5330830595964337,
"repo_name": "konradxyz/cloudify-manager",
"id": "fa9b7ec9a51492a110a969428effbd46ee3d84dc",
"s... |
from activitystreams.models.activity import Activity
from dino import environ
from dino.config import SessionKeys
__author__ = 'Oscar Eriksson <[email protected]>'
class BaseValidator(object):
def validate_request(self, activity: Activity) -> (bool, str):
if not hasattr(activity.actor, 'id') or acti... | {
"content_hash": "88641ea5dce4d0d869d527962158e32c",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 106,
"avg_line_length": 38.30909090909091,
"alnum_prop": 0.6193640246796392,
"repo_name": "thenetcircle/dino",
"id": "d56d0d1fd554f9fae4a35498b9c0d70a871013df",
"size": "26... |
"""
raven.utils.serializer.manager
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010-2012 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
import logging
__all__ = ('register', 'transform')
logger = logging.getLogger('sentry.errors.serializer')
class Serializatio... | {
"content_hash": "9449b7818d32cd632cbb085f8389862c",
"timestamp": "",
"source": "github",
"line_count": 91,
"max_line_length": 102,
"avg_line_length": 28.406593406593405,
"alnum_prop": 0.581431334622824,
"repo_name": "collective/mr.poe",
"id": "33ae3959dbc2278d59b0ad279ec8eb3138cffc9c",
"size": "25... |
import tempfile
import boto3
import pydash
# noinspection PyUnresolvedReferences
from infra_buddy.commandline import cli
from infra_buddy.commands.bootstrap import command as bcommand
from testcase_parent import ParentTestCase
import unittest
class BootStrapTestCase(ParentTestCase):
def tearDown(self):
p... | {
"content_hash": "fe9a1ac08305d70b3709d6dad717f2f6",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 111,
"avg_line_length": 33.026315789473685,
"alnum_prop": 0.6581673306772908,
"repo_name": "AlienVault-Engineering/infra-buddy",
"id": "c66fa1e23ba1cf3db04df59c56f7f4e02fa06d... |
"""
airPy is a flight controller based on pyboard and written in micropython.
The MIT License (MIT)
Copyright (c) 2016 Fabrizio Scimia, [email protected]
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... | {
"content_hash": "ddf1e6e7ef3520f3d7d0f781565ae6c7",
"timestamp": "",
"source": "github",
"line_count": 164,
"max_line_length": 115,
"avg_line_length": 36.896341463414636,
"alnum_prop": 0.584200958519253,
"repo_name": "Sokrates80/air-py",
"id": "690385ee83e5919fdcf59b4f7b58b2d8de81525b",
"size": "6... |
import inspect
import numpy as np
import pytest
from astropy import units as u
from astropy.nddata.decorators import support_nddata
from astropy.nddata.nddata import NDData
from astropy.utils.exceptions import AstropyUserWarning
from astropy.wcs import WCS
class CCDData(NDData):
pass
@support_nddata
def wrapp... | {
"content_hash": "38eedda105c34f88d5223cff3577a444",
"timestamp": "",
"source": "github",
"line_count": 381,
"max_line_length": 85,
"avg_line_length": 25.070866141732285,
"alnum_prop": 0.6234296482412061,
"repo_name": "astropy/astropy",
"id": "f392dbbb24a04ac8fdad37c6b446bea3853083bd",
"size": "961... |
import re, clue,sys
def message(*m):
print(*m,file=sys.stderr)
# loads the clues "line" by "line" from iterable (could be a file,
# list of strings etc),
# returns (dictionary of metadata (key => data), dictionary of clues (name => Clue))
def load_clues(iterable):
clues = {}
metadata = {}
count = 0
... | {
"content_hash": "bcd716d229dcfaf6e78d7db849c2bcff",
"timestamp": "",
"source": "github",
"line_count": 382,
"max_line_length": 120,
"avg_line_length": 36.146596858638745,
"alnum_prop": 0.5288238702201622,
"repo_name": "huonw/crossworder",
"id": "c947090794aee828cf128677b97b489336219851",
"size": "... |
"""
Tests for .importer module.
"""
import os
import sys
import recursely
from tests._compat import TestCase
TESTS_DIR = os.path.dirname(__file__)
IMPORTED_DIR = os.path.join(TESTS_DIR, 'imported')
def test_imported_dir_is_not_package():
"""Make sure `imported` directory was not made into a package.
The r... | {
"content_hash": "85bd27e6308f5809089fa7cd210717c5",
"timestamp": "",
"source": "github",
"line_count": 129,
"max_line_length": 80,
"avg_line_length": 33.86821705426357,
"alnum_prop": 0.6335545891508354,
"repo_name": "Xion/recursely",
"id": "681434a6750531291bd3a2e89d1153ad6ff2b429",
"size": "4369"... |
"""Add section order as a template property
Revision ID: 44b77ae3ee69
Revises: 228017954653
Create Date: 2015-03-18 00:42:45.782409
"""
# revision identifiers, used by Alembic.
revision = '44b77ae3ee69'
down_revision = '228017954653'
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import pos... | {
"content_hash": "3df67bd65d37335318a16d2ae129d221",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 109,
"avg_line_length": 27.692307692307693,
"alnum_prop": 0.7152777777777778,
"repo_name": "codeforamerica/template-maker",
"id": "7e59f73c8c7885133cb5ebd34b99efaff23ea8db",
... |
import os
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
('Ossama Edbali', '[email protected]'),
)
MANAGERS = ADMINS
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
... | {
"content_hash": "e0683b43861945a36007cad34ca6eb50",
"timestamp": "",
"source": "github",
"line_count": 189,
"max_line_length": 127,
"avg_line_length": 33.455026455026456,
"alnum_prop": 0.6884390321050134,
"repo_name": "oss6/sigil",
"id": "3fe6dae983e817310df3d68eef1663561b57d8e2",
"size": "6359",
... |
from django.conf.urls import patterns
from django.conf.urls import url
from searchlight_ui.dashboards.project.search import views
urlpatterns = patterns(
'searchlight_ui.dashboards.project.search.views',
url(r'^$', views.IndexView.as_view(), name='index'),
)
| {
"content_hash": "c01a99d80bb40a28550e4079deb83c93",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 58,
"avg_line_length": 27,
"alnum_prop": 0.7518518518518519,
"repo_name": "ttripp/searchlight-ui",
"id": "243521f428b2bd58501625525eb34fbe436f794a",
"size": "884",
"binar... |
"""Pytest initialization"""
from hypothesis import settings
# To really run a lot of Hypothesis:
# pytest --hypothesis-profile=crazy --hypothesis-show-statistics
settings.register_profile("crazy", settings(max_examples=100000, timeout=600))
| {
"content_hash": "f9bb536188767eabaec1789c16c05dcc",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 78,
"avg_line_length": 34.714285714285715,
"alnum_prop": 0.7818930041152263,
"repo_name": "nedbat/zellij",
"id": "dbc83c0bdaeac92d448f3de538e057fbfae8444d",
"size": "243",
... |
from ._security_insights import SecurityInsights
try:
from ._patch import __all__ as _patch_all
from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import
except ImportError:
_patch_all = []
from ._patch import patch_sdk as _patch_sdk
__all__ = ["SecurityInsights"]
__all__.extend([p fo... | {
"content_hash": "08290a61f61c9786c77baa65acae283a",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 82,
"avg_line_length": 28.76923076923077,
"alnum_prop": 0.6711229946524064,
"repo_name": "Azure/azure-sdk-for-python",
"id": "6c57b1fcf3b2e781a8d582d2bd55d8935ef1175e",
"si... |
class Accusation:
def __init__(self, player, suspect, weapon, location):
self.player = player
self.suspect = suspect
self.weapon = weapon
self.location = location
def to_dict(self):
return {
"player": str(self.player.id),
"suspect": self.suspect,
"weapon": self.weapon,
"location": self.locatio... | {
"content_hash": "bf5e2c3f030ee7a5c26858bc8cfc649d",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 55,
"avg_line_length": 21.666666666666668,
"alnum_prop": 0.6676923076923077,
"repo_name": "SArnab/JHU-605.401.82-SupaFly",
"id": "e866ddebc6ebc118a3542f5393601538140bde5d",
... |
from astar import astar
import curses, random
DUNGEON = """
#################
#
# ###########
# #
############# # #
# # #
# # ... | {
"content_hash": "089d9001826153d23dbd597e3362d0f5",
"timestamp": "",
"source": "github",
"line_count": 255,
"max_line_length": 77,
"avg_line_length": 32.36470588235294,
"alnum_prop": 0.47606930813037684,
"repo_name": "elemel/python-astar",
"id": "e693d73060bc7105240558cd830029f7ad75ac0a",
"size": ... |
readpost = open('../used/test/post_inside.txt','r');
readcmnt = open('../used/test/cmnt_inside.txt','r');
readtran = open('../used/test/encdec_trans_inside.txt','r');
def preprocess(line):
lline = list(line.decode("utf-8"));
lline = [x for x in lline if x != u' '];
return lline
def compareSen(line1,line2):... | {
"content_hash": "dfae4a0a2642c1d05e121ced5b1f1364",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 75,
"avg_line_length": 29.852941176470587,
"alnum_prop": 0.5714285714285714,
"repo_name": "JianboTang/modified_GroundHog",
"id": "d95672636bc131bb66d66aeb52dd351629d74a23",
... |
""" This file configures python logging for the pytest framework
integration tests
Note: pytest must be invoked with this file in the working directory
E.G. py.test frameworks/<your-frameworks>/tests
"""
import json
import logging
import os
import os.path
import re
import retrying
import shutil
import sys
import time
... | {
"content_hash": "02c729f332d4268585dcf8f9909265cd",
"timestamp": "",
"source": "github",
"line_count": 313,
"max_line_length": 133,
"avg_line_length": 45.808306709265175,
"alnum_prop": 0.6466731761751988,
"repo_name": "vishnu2kmohan/dcos-commons",
"id": "003db814f1a47b36a70dfeb170a6d1ed18dfe949",
... |
"""
@package mi.dataset.parser.test.test_adcpt_acfgm_dcl_pd0
@fid marine-integrations/mi/dataset/parser/test/test_adcpt_acfgm_dcl_pd0.py
@author Jeff Roy
@brief Test code for a adcpt_acfgm_dcl_pd0 data parser
"""
import copy
import os
from datetime import datetime
import yaml
from nose.plugins.attrib import attr
from... | {
"content_hash": "1011cdf0aa562922ff3e2576069c5a26",
"timestamp": "",
"source": "github",
"line_count": 393,
"max_line_length": 110,
"avg_line_length": 37.529262086513995,
"alnum_prop": 0.5600379686758424,
"repo_name": "renegelinas/mi-instrument",
"id": "7da12e34c69325af0ac832ae764cdad0120d2609",
"... |
from functools import partial
import os
from mock import patch
from core import db
from tools import rename_checklist_type
import testing as T
class RenameTagTest(T.TestCase, T.FakeDataMixin):
checklist_keys = [ 'id', 'request', 'type', 'complete', 'target']
checklist_data = [
[1, 0, 'search', 0, ... | {
"content_hash": "fed96eef59cdd6e8ad38fefcdf866f17",
"timestamp": "",
"source": "github",
"line_count": 99,
"max_line_length": 92,
"avg_line_length": 36.06060606060606,
"alnum_prop": 0.630532212885154,
"repo_name": "bis12/pushmanager",
"id": "5a4025adf1ca24156c0b99f47fc04370acb9d283",
"size": "3594... |
class ManagedObjectRepo(object):
"""Stores and manages KMIP managed objects.
The KMIP specification details the managed objects that are stored by a
KMIP server. This repository abstraction is an interface for KMIP servers
to store managed objects.
"""
def __init__(self):
pass
def... | {
"content_hash": "27bc9db290ed6b14b9f06753b204fb14",
"timestamp": "",
"source": "github",
"line_count": 57,
"max_line_length": 77,
"avg_line_length": 36.421052631578945,
"alnum_prop": 0.6666666666666666,
"repo_name": "viktorTarasov/PyKMIP",
"id": "7b075c163a5bc8c9c60a5cbe0e2c157eb30692e7",
"size": ... |
import unittest
import numpy as np
import sys
sys.path.append("..")
import paddle
from op_test_xpu import XPUOpTest
from xpu.get_test_cover_info import (
create_test_class,
get_xpu_op_support_types,
XPUOpTestWrapper,
)
paddle.enable_static()
class XPUTestSignOP(XPUOpTestWrapper):
def __init__(self... | {
"content_hash": "0b43d37fb23f9358b21875d0f176662f",
"timestamp": "",
"source": "github",
"line_count": 75,
"max_line_length": 73,
"avg_line_length": 25.453333333333333,
"alnum_prop": 0.5788370874803562,
"repo_name": "luotao1/Paddle",
"id": "b498c5fc3a17e59819715939bd7ae19a7918c9ec",
"size": "2522"... |
import io
import httplib
import time
import ConfigParser
import math
import json
agentStep = []
inside = []
firstStep = []
timeStart = []
timeStop = []
typeCharacterDict = {}
amountLeaders = None
behaviors = False
results = io.open('SmartSimResults', 'wb')
simulationStarted = False
config = ConfigParser.RawConfigP... | {
"content_hash": "faf684815678bf9d9c5d2e9d95973bac",
"timestamp": "",
"source": "github",
"line_count": 101,
"max_line_length": 69,
"avg_line_length": 26.386138613861387,
"alnum_prop": 0.750093808630394,
"repo_name": "gsi-upm/SmartSim",
"id": "a747be9b0a4f04409625462b5bfdac486160a5cd",
"size": "266... |
import math
from transform import Transform
class Rotation(Transform):
def __init__(self, degree):
Transform.__init__(self)
degree = math.radians(degree)
self.trans_matrix = [[math.cos(degree), math.sin(degree)*-1.0, 0], [math.sin(degree), math.cos(degree), 0], [0, 0, 1]]
print self.t... | {
"content_hash": "319801930567cf92c1fc08fa28614a41",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 126,
"avg_line_length": 25.46153846153846,
"alnum_prop": 0.6374622356495468,
"repo_name": "germanogesser/computacao_grafica",
"id": "06e75278c3eff49b17a4615d422ec64b3a4d4d7a"... |
"""
===========================================================================
Visualising statistical significance thresholds on EEG data
===========================================================================
MNE-Python provides a range of tools for statistical hypothesis testing
and the visualisation of the re... | {
"content_hash": "a34375eadee38d9a93ba8a8dcf59251e",
"timestamp": "",
"source": "github",
"line_count": 127,
"max_line_length": 79,
"avg_line_length": 43.55118110236221,
"alnum_prop": 0.6588320376062194,
"repo_name": "adykstra/mne-python",
"id": "e47fe2afc614192dc8ffc72507f19209ffd154c6",
"size": "... |
import datetime
import pprint
import inspect
from ...vendor.Qt import QtWidgets, QtCore
from ...vendor import qtawesome
from ... import io
from ... import api
from ... import pipeline
from .model import SubsetsModel, FamiliesFilterProxyModel
from .delegates import PrettyTimeDelegate, VersionDelegate
from . import lib... | {
"content_hash": "3f7afc7d15eefdee110edb80c1cfaf1d",
"timestamp": "",
"source": "github",
"line_count": 448,
"max_line_length": 78,
"avg_line_length": 32.542410714285715,
"alnum_prop": 0.5899581589958159,
"repo_name": "MoonShineVFX/core",
"id": "a8da674f588398c14d0e4775e1bc1cf483b989fa",
"size": "1... |
"""
Tests for L{twisted.web.vhost}.
"""
from __future__ import absolute_import, division
from twisted.internet.defer import gatherResults
from twisted.trial.unittest import TestCase
from twisted.web.http import NOT_FOUND
from twisted.web.resource import NoResource
from twisted.web.static import Data
from twisted.web.... | {
"content_hash": "9cba4f814bfd385bc75db0e3316b904b",
"timestamp": "",
"source": "github",
"line_count": 197,
"max_line_length": 81,
"avg_line_length": 37.18274111675127,
"alnum_prop": 0.6386348122866894,
"repo_name": "ArcherSys/ArcherSys",
"id": "d4d9852809bdca01a3437be59ae23287f8d0a0dc",
"size": "... |
import pyaf.Bench.TS_datasets as tsds
import tests.artificial.process_artificial_dataset as art
art.process_dataset(N = 128 , FREQ = 'D', seed = 0, trendtype = "PolyTrend", cycle_length = 0, transform = "Anscombe", sigma = 0.0, exog_count = 0, ar_order = 0); | {
"content_hash": "062297f829458e207c2e59171fef4ac8",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 162,
"avg_line_length": 37.42857142857143,
"alnum_prop": 0.7022900763358778,
"repo_name": "antoinecarme/pyaf",
"id": "b25099e075231f5aef7d17c544d1bb5e1a606e76",
"size": "262... |
class Solution(object):
def insert(self, intervals, newInterval):
"""
O(n)
:type intervals: List[Interval]
:type newInterval: Interval
:rtype: List[Interval]
"""
if not newInterval:
return intervals
if not intervals:
return [new... | {
"content_hash": "a2878da1a9b732a52bf285b129ec0ef6",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 78,
"avg_line_length": 33.61538461538461,
"alnum_prop": 0.528604118993135,
"repo_name": "youhusky/Facebook_Prepare",
"id": "da23d08b4790e8285a63c4f845be41b467f2cde9",
"size... |
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "csvt05.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| {
"content_hash": "15088394ef8cb19e99e7d549866530b2",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 70,
"avg_line_length": 25.22222222222222,
"alnum_prop": 0.7092511013215859,
"repo_name": "ysh329/django-test",
"id": "a298fcc43ccf1d0b4b98e5f7b108203d9579b2e6",
"size": "249... |
class DataPath(object):
def __init__(self, *path):
self._path = path
def __add__(self, other):
dp = DataPath()
dp._path = self._path + other._path
return dp
def __str__(self):
return '.'.join(map(str, (self._path)))
def __repr__(self):
return 'DataPath... | {
"content_hash": "4f7c304b285ddbe3eefc38051ca44bfd",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 54,
"avg_line_length": 23.4,
"alnum_prop": 0.50997150997151,
"repo_name": "23andMe/Yamale",
"id": "1f6b6d8987f9f7669b3a4981c359e6b8035f4741",
"size": "351",
"binary": fal... |
from tower_cli import models
from tests.compat import unittest, mock
class FieldTests(unittest.TestCase):
"""A set of tests to establish that the base Field class works in the
way we expect.
"""
def test_dunder_lt(self):
"""Establish that the `__lt__` comparison method on fields works
... | {
"content_hash": "b920f93cb2ce2a2295da54d19edcaee9",
"timestamp": "",
"source": "github",
"line_count": 75,
"max_line_length": 78,
"avg_line_length": 32.54666666666667,
"alnum_prop": 0.5964768537484637,
"repo_name": "tomfotherby/tower-cli",
"id": "e0d1f8d7ae247c98a5d287c5c36859f398906465",
"size": ... |
import glob
import logging
import os.path
import pytest
import numpy as np
from metpy.io.nexrad import Level2File, Level3File, is_precip_mode
from metpy.cbook import get_test_data
# Turn off the warnings for tests
logging.getLogger("metpy.io.nexrad").setLevel(logging.CRITICAL)
#
# NEXRAD Level 2 Tests
#
# 1999 fi... | {
"content_hash": "9f0429af9e89040193ea03654d5965e9",
"timestamp": "",
"source": "github",
"line_count": 122,
"max_line_length": 95,
"avg_line_length": 29.065573770491802,
"alnum_prop": 0.6731528482797519,
"repo_name": "deeplycloudy/MetPy",
"id": "1c90dede1d122477429204c03f58f95cac458022",
"size": "... |
"""The tests for the denonavr media player platform."""
from unittest.mock import patch
import pytest
from homeassistant.components import media_player
from homeassistant.components.denonavr.config_flow import (
CONF_MANUFACTURER,
CONF_SERIAL_NUMBER,
CONF_TYPE,
DOMAIN,
)
from homeassistant.components.... | {
"content_hash": "a90f6d06689b37ead05fd57dba1922d7",
"timestamp": "",
"source": "github",
"line_count": 136,
"max_line_length": 87,
"avg_line_length": 29.16176470588235,
"alnum_prop": 0.6797781139687342,
"repo_name": "nkgilley/home-assistant",
"id": "4497025c11cebce444dbd4aed326e905f25900e0",
"size... |
'''A full-screen minute:second timer. Leave it in charge of your conference
lighting talks.
After 5 minutes, the timer goes red. This limit is easily adjustable by
hacking the source code.
Press spacebar to start, stop and reset the timer.
'''
import pyglet
window = pyglet.window.Window(fullscreen=True)
class Ti... | {
"content_hash": "1a290a56776037e361b7adb66c4e9686",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 77,
"avg_line_length": 26.982142857142858,
"alnum_prop": 0.5592322964923891,
"repo_name": "nicememory/pie",
"id": "af9a7be5f9626d8db1af044da7badce5e947880c",
"size": "3252"... |
'''
Implements the cuda module as called from within an executing kernel
(@cuda.jit-decorated function).
'''
from contextlib import contextmanager
import sys
import threading
import traceback
import numpy as np
from numba.np import numpy_support
class Dim3(object):
'''
Used to implement thread/block indice... | {
"content_hash": "95559202389b3f894a8dc6a262f72e3c",
"timestamp": "",
"source": "github",
"line_count": 402,
"max_line_length": 80,
"avg_line_length": 24.997512437810947,
"alnum_prop": 0.559458652602249,
"repo_name": "IntelLabs/numba",
"id": "7455b7cd51811d36b1eea9aa59411749f8c5bef8",
"size": "1004... |
"""Provides various scoring methods for word strength."""
import re
import fuzzy
dmeta = fuzzy.DMetaphone()
soundex = fuzzy.Soundex(4)
def score_dmetaphone(words):
"""Score words using the double metaphone algorithm.
:param words (list): the list of words.
:rtype scores (list): the scored words
""... | {
"content_hash": "b39785cad2774d98881112bdfc508633",
"timestamp": "",
"source": "github",
"line_count": 196,
"max_line_length": 78,
"avg_line_length": 27.5,
"alnum_prop": 0.5970315398886827,
"repo_name": "christabor/namebot",
"id": "183712d351a97950557b190145f0ad6e1383f54b",
"size": "5390",
"bina... |
import csv
k = ['Alabama', 'Alaska', 'Arizona', 'Arkansas', 'California', 'Colorado', 'Connecticut', 'Delaware',
'District of Columbia', 'Florida', 'Georgia', 'Hawaii', 'Idaho', 'Illinois', 'Indiana', 'Iowa',
'Kansas', 'Kentucky', 'Louisiana', 'Maine', 'Maryland', 'Massachusetts', 'Michigan', 'Minnesota',
'Mississipp... | {
"content_hash": "86934860ca8abea549d5e8538aa29af8",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 104,
"avg_line_length": 30.512820512820515,
"alnum_prop": 0.6310924369747899,
"repo_name": "ub-cse442/election-and-data-sci",
"id": "dc5315ef38181733c39fc8c1b07641053a4bf987"... |
from measures.generic.Overhead import Overhead as Overhead
from measures.multicast.SentRemoteMulticastYYYMessages import SentRemoteMulticastYYYMessages as SentRemoteMulticastYYYMessages
class GraphsearchOverhead(Overhead):
def __init__(self, period, simulationTime):
Overhead.__init__(self, period, simulationTime... | {
"content_hash": "d43c4c762088aff543d2e5a048422e92",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 147,
"avg_line_length": 49.2,
"alnum_prop": 0.8360433604336044,
"repo_name": "unaguil/hyperion-ns2",
"id": "70010e98c83a97335a174b6178b1089a1797a141",
"size": "738",
"bin... |
from __future__ import absolute_import, unicode_literals
from .base import (
Base64, NotEquivalentError, UndeliverableWarning, BrokerState,
QoS, Message, AbstractChannel, Channel, Management, Transport,
Empty, binding_key_t, queue_binding_t,
)
__all__ = (
'Base64', 'NotEquivalentError', 'Undeliverable... | {
"content_hash": "102d4b54f4afc8df37fdc19a661dce03",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 78,
"avg_line_length": 36.53846153846154,
"alnum_prop": 0.6989473684210527,
"repo_name": "urbn/kombu",
"id": "e2ee0b5d9f5ae509b7ea2635d7c006911c1bccda",
"size": "475",
"b... |
"""
Tests for the text processor.
"""
from __future__ import unicode_literals
import json
from unittest import TestCase, main
from datetime import datetime
import warnings
from nose.tools import * # PEP8 asserts
from nose.plugins.attrib import attr
from textblob.compat import PY2, unicode, basestring, binary_type
im... | {
"content_hash": "ea6d9af30f25f3528715ad83d6960f0e",
"timestamp": "",
"source": "github",
"line_count": 1012,
"max_line_length": 291,
"avg_line_length": 38.55632411067194,
"alnum_prop": 0.6069863399882108,
"repo_name": "bbengfort/TextBlob",
"id": "e23473e27352d82e3bb01760e83b556fcd8f1814",
"size": ... |
import tweepy, requests, time
# from cowpy import cow
# cheese = cow.Milk()
class MyStreamListener(tweepy.StreamListener):
def __init__(self):
self.auth = tweepy.OAuthHandler('v8xVBZlXBp2AJoWI3VjDjzDkC', 'Wpoom4N6tpTgfywzCt6y83gvZubbYoT0vL0V8FXzhyXA74218D')
self.auth.set_access_token('734122414158... | {
"content_hash": "652c08a72d48316dc9aed02e201faca0",
"timestamp": "",
"source": "github",
"line_count": 74,
"max_line_length": 137,
"avg_line_length": 41.86486486486486,
"alnum_prop": 0.5355067785668173,
"repo_name": "Dabs4Dads/polly",
"id": "6aa95b356f80b4e2fcc8534e09acc9f4443aa0c0",
"size": "3098... |
from django.shortcuts import render_to_response
from django.template import RequestContext
from django.http import StreamingHttpResponse, HttpResponse
from django.views.decorators.csrf import csrf_exempt
from guacamole import client
import logging
import uuid
import threading
logger = logging.getLogger(__name__)
soc... | {
"content_hash": "e2efcf966b2a4d8e2bdd2b992fc8edb4",
"timestamp": "",
"source": "github",
"line_count": 111,
"max_line_length": 77,
"avg_line_length": 26.81081081081081,
"alnum_prop": 0.5655241935483871,
"repo_name": "rescale/django-guacamole",
"id": "2a44521366f15049b97dd76067ceb47a6718656e",
"siz... |
from fontTools.misc import sstruct
from fontTools.misc.textTools import safeEval
from . import DefaultTable
maxpFormat_0_5 = """
> # big endian
tableVersion: i
numGlyphs: H
"""
maxpFormat_1_0_add = """
> # big endian
maxPoints: H
maxContours: H
maxComposite... | {
"content_hash": "f0f222abd22679c7f16f9ccdd2343acf",
"timestamp": "",
"source": "github",
"line_count": 138,
"max_line_length": 77,
"avg_line_length": 30.369565217391305,
"alnum_prop": 0.684800763540921,
"repo_name": "fonttools/fonttools",
"id": "e810806dcff1aa15e1abe21f885efcc4ca78130e",
"size": "... |
'''
Created on Feb 5, 2015
@author: jeremie
'''
import abc
class CombiningEventMixinMetaclass(type):
"""
Metaclass to allow union of _eventMixin_events attributes of base classes
instead of overwriting them.
"""
def __new__(cls, name, bases, attrs):
_eventMixin_events = set(attrs.get('_eventMixin_event... | {
"content_hash": "0217dfaaadb36f68eff5429560f1e2ca",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 75,
"avg_line_length": 33.81481481481482,
"alnum_prop": 0.6867469879518072,
"repo_name": "jmiserez/sts",
"id": "a66cffd1df87cbbdf1c4fa61fbd09962a5ecec01",
"size": "913",
... |
import unittest
from cloudbaseinit.utils import crypt
class TestOpenSSLException(unittest.TestCase):
def setUp(self):
self._openssl = crypt.OpenSSLException()
def test_get_openssl_error_msg(self):
expected_error_msg = u'error:00000000:lib(0):func(0):reason(0)'
error_msg = self._open... | {
"content_hash": "73ee371532c2011add315b5da0b02d1b",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 75,
"avg_line_length": 28.576923076923077,
"alnum_prop": 0.65814266487214,
"repo_name": "ader1990/cloudbase-init",
"id": "565f4aeb87ad985cfea8456e224205d5e9f09953",
"size":... |
import tensorflow as tf
FLAGS = tf.app.flags.FLAGS
def define_flags():
############
# Run mode
############
tf.app.flags.DEFINE_string('run', None, "Which operation to run. [train|inference]")
##########################
# Training parameters
###########################
tf.app.flags.... | {
"content_hash": "5108e4b7e8efa484f6f1f61ca7682359",
"timestamp": "",
"source": "github",
"line_count": 46,
"max_line_length": 106,
"avg_line_length": 47.869565217391305,
"alnum_prop": 0.6030881017257039,
"repo_name": "tdeboissiere/DeepLearningImplementations",
"id": "f712efe144ad625bebe21fb5d3a4946f... |
"""Support for Homekit cameras."""
from __future__ import annotations
from aiohomekit.model.services import ServicesTypes
from homeassistant.components.camera import Camera
from homeassistant.core import callback
from . import KNOWN_DEVICES, AccessoryEntity
class HomeKitCamera(AccessoryEntity, Camera):
"""Repr... | {
"content_hash": "53826f8a5e83b2dab1a96ffe901d779d",
"timestamp": "",
"source": "github",
"line_count": 54,
"max_line_length": 72,
"avg_line_length": 29.296296296296298,
"alnum_prop": 0.6485461441213654,
"repo_name": "sander76/home-assistant",
"id": "a0b15087356cdbb4851f35a2d79cd516db22c90e",
"size... |
from django import template
from django.template.defaultfilters import escape
from django.utils.safestring import mark_safe
from workshops.models import TrainingProgress
register = template.Library()
@register.simple_tag
def progress_label(progress):
assert isinstance(progress, TrainingProgress)
if progres... | {
"content_hash": "c02a43cb6f85971b0d7e6439205d61fb",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 88,
"avg_line_length": 28.755102040816325,
"alnum_prop": 0.6188786373314408,
"repo_name": "pbanaszkiewicz/amy",
"id": "35f8f4662af0f2b0d23489d2884d0175076cdafb",
"size": "1... |
from ObjectCreationParameters import ObjectCreationParameters
class ResponsibilityParameters(ObjectCreationParameters):
def __init__(self,name):
ObjectCreationParameters.__init__(self)
self.theName = name
def name(self): return self.theName
| {
"content_hash": "2a4632e8d52d353b1e3ac817fa7e1a69",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 61,
"avg_line_length": 31.875,
"alnum_prop": 0.788235294117647,
"repo_name": "RobinQuetin/CAIRIS-web",
"id": "945574a3d2cea43b2221e26ac4b10bee41617ee9",
"size": "1054",
"b... |
from __future__ import print_function
from builtins import range
import sys, os
sys.path.insert(1, os.path.join("..","..",".."))
import h2o
from tests import pyunit_utils
from h2o.estimators.deeplearning import H2ODeepLearningEstimator
def weights_and_biases():
print("Test checks if Deep Learning weights and biase... | {
"content_hash": "31847d8996c9c9eeacdf9ddbd8170dee",
"timestamp": "",
"source": "github",
"line_count": 107,
"max_line_length": 133,
"avg_line_length": 37.12149532710281,
"alnum_prop": 0.6555891238670695,
"repo_name": "spennihana/h2o-3",
"id": "b093555200b3d49f6f14eb3437a45b90a742b53e",
"size": "39... |
from __future__ import division
import logging
import os
import subprocess
import shutil
import sys
import tempfile
try:
import numpy as np
except ImportError:
logging.critical('Cannot import the third-party Python package numpy')
sys.exit(1)
from . import signal_processing
class ExternalVad(object):
def _... | {
"content_hash": "90a3f5ac3f0d1a839c24970ae115f42c",
"timestamp": "",
"source": "github",
"line_count": 69,
"max_line_length": 76,
"avg_line_length": 30.057971014492754,
"alnum_prop": 0.6258437801350049,
"repo_name": "koobonil/Boss2D",
"id": "01418d84fe0d69dbb0a398d3901831da1bd5072f",
"size": "2468... |
import cpp11_initializer_list_extend
c = cpp11_initializer_list_extend.Container([10, 20, 30, 40])
| {
"content_hash": "8d3c08712b56b7263a514e7196339117",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 61,
"avg_line_length": 33.333333333333336,
"alnum_prop": 0.76,
"repo_name": "DEKHTIARJonathan/BilletterieUTC",
"id": "285273efaabac6200db64fe5f0e9ad734f8604d4",
"size": "100... |
import string
from urllib import urlencode
from django.http import HttpResponse, HttpResponseRedirect
from django.shortcuts import render
from django.views.decorators.csrf import csrf_exempt
import commonware.log
from oauthlib import oauth1
from oauthlib.common import safe_string_equals
from amo.decorators import lo... | {
"content_hash": "ff0cbebb282d16a67e31acb4aee640cd",
"timestamp": "",
"source": "github",
"line_count": 212,
"max_line_length": 79,
"avg_line_length": 37.08490566037736,
"alnum_prop": 0.6087509539557364,
"repo_name": "robhudson/zamboni",
"id": "834469d6b9f22ad29fe2a65059868b3fab5ab887",
"size": "78... |
"""TensorFlow Lite tooling helper functionality.
EXPERIMENTAL: APIs here are unstable and likely to change without notice.
@@toco_convert
@@toco_convert_protos
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import subprocess
import tempfile... | {
"content_hash": "04f67e7921010abaf88ef510ddc186bc",
"timestamp": "",
"source": "github",
"line_count": 185,
"max_line_length": 104,
"avg_line_length": 36.821621621621624,
"alnum_prop": 0.6861421021726365,
"repo_name": "horance-liu/tensorflow",
"id": "5e8edbb93767c67e3a6cc96f5a76a945d92cf2ab",
"siz... |
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('blog', '0002_auto_20160528_0900'),
]
operations = [
migrations.AddField(
... | {
"content_hash": "cde22a53c5df27ea52098abfbfbb8b5b",
"timestamp": "",
"source": "github",
"line_count": 65,
"max_line_length": 171,
"avg_line_length": 34.92307692307692,
"alnum_prop": 0.5629955947136563,
"repo_name": "rocity/dj-blog",
"id": "b7927a60b399cc3e1ba9679b7c204b8742c3c86b",
"size": "2342"... |
import json
from django_webtest import WebTest
from django.test import TestCase
from django.core.urlresolvers import reverse
from rest_framework.renderers import JSONRenderer
from cellcounter.main.models import CellType
from .defaults import MOCK_KEYBOARD, DEFAULT_KEYBOARD_STRING
from .factories import UserFactory, ... | {
"content_hash": "727d082f70793b235ef99cb4fa0601d0",
"timestamp": "",
"source": "github",
"line_count": 261,
"max_line_length": 101,
"avg_line_length": 46.582375478927204,
"alnum_prop": 0.5688435597960191,
"repo_name": "haematologic/cellcounter",
"id": "d0a5371e4c5057244e9189138760ec2283a0d14e",
"s... |
from futurist import periodics
import os
import threading
import time
from oslo_log import log
import ceilometer
from ceilometer import monasca_client as mon_client
from ceilometer import publisher
from ceilometer.publisher.monasca_data_filter import MonascaDataFilter
from monascaclient import exc
import traceback
... | {
"content_hash": "bd7e7ef6e7c9ffeec4b8df3f7a7f4589",
"timestamp": "",
"source": "github",
"line_count": 233,
"max_line_length": 79,
"avg_line_length": 40.25321888412017,
"alnum_prop": 0.5614671073675231,
"repo_name": "openstack/ceilometer",
"id": "9d9839f1037c6e8e5f6e553542f044d680a0799b",
"size": ... |
from cliff.command import Command
import call_server as server
class AppDelete(Command):
def get_parser(self, prog_name):
parser = super(AppDelete, self).get_parser(prog_name)
parser.add_argument('app_name')
return parser
def take_action(self, parsed_args):
app_name = ... | {
"content_hash": "7221849f9733f268b2cd2d5ee1c83ede",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 61,
"avg_line_length": 21.72222222222222,
"alnum_prop": 0.659846547314578,
"repo_name": "cloud-ark/cloudark",
"id": "389ae0774d98442c29047583aebbcf23681c336a",
"size": "391... |
'''
Usage:
python3 backlog.py issues.csv
Reference: http://www.backlog.jp/api/
'''
BACKLOG_USER = ''
BACKLOG_PASS = ''
BACKLOG_HOST = '' # Ex: abc.backlog.jp
DEBUG = False
import sys
import csv
from xmlrpc.client import ServerProxy
class BacklogAPI:
client = None
def __init__(self, user, passwd, host):... | {
"content_hash": "621eb5eb3558071adca319e0d0a8a950",
"timestamp": "",
"source": "github",
"line_count": 71,
"max_line_length": 86,
"avg_line_length": 28.225352112676056,
"alnum_prop": 0.5598802395209581,
"repo_name": "manhg/backlog-import-csv",
"id": "37dac0e3533c6f49395cdeb5d89b1206bc32eeb6",
"siz... |
from django.contrib import admin
# Register your models here.
from article.models import Article
admin.site.register(Article)
| {
"content_hash": "d6b2f2d5aceb98a5cc3e8cd4f5f61a72",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 34,
"avg_line_length": 16.25,
"alnum_prop": 0.8,
"repo_name": "meranamvarun/django_practice",
"id": "31e58aaae96cb0766dde9e1a4a2d161229bc5cc1",
"size": "130",
"binary": fa... |
from selenium.common.exceptions import NoSuchElementException
from selenium.common.exceptions import StaleElementReferenceException
from selenium.common.exceptions import WebDriverException
from selenium.webdriver.support.wait import WebDriverWait
import browser
import time
class PageObject:
XPATH_RADIO = '//div... | {
"content_hash": "52c2a9f713ca2424b650ef27af227505",
"timestamp": "",
"source": "github",
"line_count": 228,
"max_line_length": 78,
"avg_line_length": 36.56140350877193,
"alnum_prop": 0.5296305182341651,
"repo_name": "dancn/fuel-main-dev",
"id": "7c0a372711f7d76c5cfb90754acb66c2a8197f16",
"size": "... |
def make_parent(parent: str) -> str:
# Sample function parameter parent in list_annotations_sample
parent = parent
return parent
| {
"content_hash": "07b1645e7c4b91ff4da15f690ac5fde7",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 65,
"avg_line_length": 23.833333333333332,
"alnum_prop": 0.7062937062937062,
"repo_name": "sasha-gitg/python-aiplatform",
"id": "cd8f117a8544516c80599e5f34b134c698317d20",
"... |
from pyface.resource_manager import *
| {
"content_hash": "eddf27c77cda1c31fb28198b494bf620",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 37,
"avg_line_length": 38,
"alnum_prop": 0.8157894736842105,
"repo_name": "enthought/etsproxy",
"id": "ef5048f0b94a547aa4b352594137f287fa5f1f74",
"size": "53",
"binary": f... |
"""Landlab component for overland flow using a local implicit solution to the
kinematic-wave approximation.
Created on Fri May 27 14:26:13 2016
@author: gtucker
"""
import numpy as np
from scipy.optimize import newton
from landlab import Component
from landlab.components import FlowAccumulator
def water_fn(x, a,... | {
"content_hash": "fe753840eeba95e13174f880f39068d8",
"timestamp": "",
"source": "github",
"line_count": 390,
"max_line_length": 86,
"avg_line_length": 35.11794871794872,
"alnum_prop": 0.5686331775700935,
"repo_name": "landlab/landlab",
"id": "632bf0fa0f1b72eb38a55ede6472219e460ae703",
"size": "1372... |
import pyqtgraph as pg
import re
from pathlib import Path
from cued_datalogger.analysis import analysis_window
class Workspace(object):
"""
The ``Workspace`` class stores the workspace attributes and has methods for
saving, loading, configuring, and displaying the workspace settings.
Workspaces are ... | {
"content_hash": "e69dfd7e5d2f64ee171bca8fd69dde1e",
"timestamp": "",
"source": "github",
"line_count": 158,
"max_line_length": 80,
"avg_line_length": 38.13291139240506,
"alnum_prop": 0.5689626556016597,
"repo_name": "torebutlin/cued_datalogger",
"id": "32579be9d648c3cc001c31f4c8f915e1b6c0f4f6",
"s... |
from geoq.core.models import Setting
import json
def app_settings(request):
"""Global values to pass to templates"""
settings_dict = dict()
settings = dict()
for obj in Setting.objects.all():
settings[obj.name] = obj.value
settings_dict['settings'] = json.dumps(settings)
return setting... | {
"content_hash": "4bf76edcb8ca2b182faa5472364cdfa5",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 52,
"avg_line_length": 27.25,
"alnum_prop": 0.6788990825688074,
"repo_name": "Pkthunder/geoq",
"id": "0f10d0466582655b48ca55ea1843236e7d5f8c4f",
"size": "534",
"binary": ... |
import os
import warnings
import functools
import imath
import IECore
import Gaffer
import GafferUI
from Qt import QtCore
class PathWidget( GafferUI.TextWidget ) :
def __init__( self, path, **kw ) :
GafferUI.TextWidget.__init__( self, str( path ), **kw )
# we can be fairly sure that the average path require... | {
"content_hash": "7b3ad3954c22d48a339cce1de4c2124f",
"timestamp": "",
"source": "github",
"line_count": 205,
"max_line_length": 138,
"avg_line_length": 26.921951219512195,
"alnum_prop": 0.6472186990396811,
"repo_name": "lucienfostier/gaffer",
"id": "2b8dee03c0109b7e7f71d3a1de13c2214a3f97c2",
"size"... |
from leapp.tags import Tag
class SecondPhaseTag(Tag):
name = 'second_phase'
| {
"content_hash": "8310b456d4e1468809ed090ff641e7dc",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 26,
"avg_line_length": 16.4,
"alnum_prop": 0.7195121951219512,
"repo_name": "vinzenz/prototype",
"id": "ead6c9516e28f2aa0927b22e3cdf0e33a581455d",
"size": "82",
"binary": ... |
from django.db import models
from django.utils.timezone import now
from django.conf import settings
from django.contrib.contenttypes.models import ContentType
from filtered_contenttypes.fields import FilteredGenericForeignKey
from django_pgjson.fields import JsonBField
from .managers import ActionManager
from . impor... | {
"content_hash": "b8d6ad3c038f4cc8dcfaa6cb74c162d4",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 80,
"avg_line_length": 35.72727272727273,
"alnum_prop": 0.6727735368956743,
"repo_name": "owais/django-simple-activity",
"id": "69fa520dded44168c6ccb367b112f756aea4bd4a",
"... |
import pytest
pytestmark = pytest.mark.nondestructive
def test_auth_with_company_id_and_psk(public_api_v1):
result = public_api_v1.authentication()
assert result and result.get('success')
def test_auth_with_auth_file(public_api_v1_auth_file):
result = public_api_v1_auth_file.authentication()
assert... | {
"content_hash": "1a8fdfc56c40461594f060a71ef93916",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 70,
"avg_line_length": 23.45,
"alnum_prop": 0.7281449893390192,
"repo_name": "ninemoreminutes/lmiapi",
"id": "4c747049e97cc2eea0489dc413c0cecc273cf4cb",
"size": "948",
"b... |
import cPickle as pickle
import json
import os
import unittest
from gzip import GzipFile
from shutil import rmtree
from time import time
from distutils.dir_util import mkpath
from eventlet import spawn, Timeout, listen
from swift.obj import updater as object_updater, server as object_server
from swift.obj.server impo... | {
"content_hash": "44ba0cb175d2473776bbf46417eb3bf7",
"timestamp": "",
"source": "github",
"line_count": 207,
"max_line_length": 79,
"avg_line_length": 36.07729468599034,
"alnum_prop": 0.5002678093197643,
"repo_name": "Mirantis/swift-encrypt",
"id": "104325b6acb3517df26a13b3b4dc78eb913159e3",
"size"... |
from msrest.serialization import Model
class X12DelimiterOverrides(Model):
"""X12DelimiterOverrides.
:param protocol_version: The protocol version.
:type protocol_version: str
:param message_id: The message id.
:type message_id: str
:param data_element_separator: The data element separator.
... | {
"content_hash": "aae980947c5dd74b62b6a1c3f6f0cf31",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 258,
"avg_line_length": 52.01923076923077,
"alnum_prop": 0.6979667282809612,
"repo_name": "rjschwei/azure-sdk-for-python",
"id": "b3fcdfc6c1e5b37b1b4fecee07fa146232e5b13e",
... |
import sys
from PIL import Image, ImageFilter
from mpi4py import MPI
import colorsys
from math import ceil
import pickle
import time
comm = MPI.COMM_WORLD
rank = comm.Get_rank()
name = MPI.Get_processor_name()
if rank == 0:
start_time = time.time()
#Open original image and calculate the division of it
#origina... | {
"content_hash": "30dab8b214d5b59071d4493d7d33f1b2",
"timestamp": "",
"source": "github",
"line_count": 141,
"max_line_length": 93,
"avg_line_length": 36.638297872340424,
"alnum_prop": 0.7468060394889663,
"repo_name": "BrennaBlackwell/PythonForPi",
"id": "ef700e6f7677819a9858cdefb088a125d6a96b90",
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.