text stringlengths 4 1.02M | meta dict |
|---|---|
from __future__ import absolute_import
from __future__ import print_function
import mock
import reactive.manila_handlers as handlers
import charms_openstack.test_utils as test_utils
class TestRegisteredHooks(test_utils.TestRegisteredHooks):
def test_hooks(self):
defaults = [
'charm.install... | {
"content_hash": "84a9b11150f853ae502a6429678e4292",
"timestamp": "",
"source": "github",
"line_count": 76,
"max_line_length": 78,
"avg_line_length": 40.11842105263158,
"alnum_prop": 0.5847818957035094,
"repo_name": "ajkavanagh/charm-manila",
"id": "b3431ee4623daf183e9de7e9a0e605bae292b283",
"size"... |
import unittest
import os
from mock import patch
import mailpile
from mailpile.commands import Action as action
from mailpile.tests import MailPileUnittest
class TestCommands(MailPileUnittest):
def test_index(self):
res = self.mp.rescan()
self.assertEqual(res.as_dict()["status"], 'success')
... | {
"content_hash": "29bfd5803c8fd7a85f4a1fe577461671",
"timestamp": "",
"source": "github",
"line_count": 161,
"max_line_length": 87,
"avg_line_length": 32.62732919254658,
"alnum_prop": 0.5948981534361317,
"repo_name": "laborautonomo/Mailpile",
"id": "9f14d978258446501e81271b30503b4e4e06aa7a",
"size"... |
from string import Template
from datetime import date
metrocoinDir = "./";
inFile = metrocoinDir+"/share/qt/Info.plist"
outFile = "Metrocoin-Qt.app/Contents/Info.plist"
version = "unknown";
fileForGrabbingVersion = metrocoinDir+"metrocoin-qt.pro"
for line in open(fileForGrabbingVersion):
lineArr = line.re... | {
"content_hash": "22bb370ff1eb1bfb19691fd23f4dc197",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 69,
"avg_line_length": 27.583333333333332,
"alnum_prop": 0.7145015105740181,
"repo_name": "metrocoins/metrocoin",
"id": "6ec7c0c9cf3ddd711c47b0c5bc3af176b8bee574",
"size": ... |
from __future__ import annotations
from tempfile import NamedTemporaryFile
from typing import TYPE_CHECKING, Sequence
from airflow.models import BaseOperator
from airflow.providers.amazon.aws.hooks.s3 import S3Hook
from airflow.providers.ftp.hooks.ftp import FTPHook
if TYPE_CHECKING:
from airflow.utils.context i... | {
"content_hash": "4e40d6d0ff6d0e6827c2d31ea115a87e",
"timestamp": "",
"source": "github",
"line_count": 63,
"max_line_length": 83,
"avg_line_length": 34.58730158730159,
"alnum_prop": 0.645709040844424,
"repo_name": "cfei18/incubator-airflow",
"id": "b0f9b3b9aa6ae099338286c959cb395f8ea1cbd1",
"size"... |
import re
import sre_constants
from django import forms
from django.forms import widgets
from django.utils.safestring import mark_safe
from django.utils.translation import ugettext as _
from djblets.auth.forms import RegistrationForm as DjbletsRegistrationForm
from djblets.siteconfig.forms import SiteSettingsForm
from... | {
"content_hash": "c3a6d1630cfe0432c88ca241d348bd9c",
"timestamp": "",
"source": "github",
"line_count": 457,
"max_line_length": 84,
"avg_line_length": 39.47702407002188,
"alnum_prop": 0.6109971731057037,
"repo_name": "atagar/ReviewBoard",
"id": "b3e708a80360a7ff2ebad21fc7ad1f896d35b389",
"size": "1... |
import sys
import getopt
from mailutils import *
from mailutils.header import *
print_attachments = False
indent_level = 4
def print_file (fname, indent):
try:
fp = open (fname, 'r')
for line in fp:
print "%*.*s%s" % (indent, indent, '', line)
fp.close ()
remove (fname)... | {
"content_hash": "6dfd296bcbd61c1ae89bad9f5c608c98",
"timestamp": "",
"source": "github",
"line_count": 136,
"max_line_length": 78,
"avg_line_length": 29.71323529411765,
"alnum_prop": 0.5476367235832714,
"repo_name": "ssvlab/esbmc-gpu",
"id": "471a05211457aa6c803e631e8e48971b8a886543",
"size": "486... |
from functools import reduce
def format_comment_title(product):
"""Produce a Markdown-formatted string based on a given "product"--a string
containing a browser identifier optionally followed by a colon and a
release channel. (For example: "firefox" or "chrome:dev".) The generated
title string is used ... | {
"content_hash": "2b31736e121a9b6971cf95bd0e918f7e",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 89,
"avg_line_length": 38.61904761904762,
"alnum_prop": 0.5351418002466092,
"repo_name": "ric2b/Vivaldi-browser",
"id": "43020cdafe6e336102acf4986bf3ac1a6b25de0d",
"size": ... |
import itertools
import subprocess
import sys
import pytest
ONLY_COMPLETED_OPTIONS = (None, "--only-completed", "--not-only-completed")
SKIP_SUCCESS_OPTIONS = (None, "--skip-success", "--include-success")
OPTION_COMBINATIONS = (
list(filter(None, combo)) for combo in itertools.product(ONLY_COMPLETED_OPTIONS, SKIP... | {
"content_hash": "3796b071ebdc054b8adc65f502b112d6",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 108,
"avg_line_length": 34.793103448275865,
"alnum_prop": 0.7413280475718533,
"repo_name": "sixty-north/cosmic-ray",
"id": "089f292a00d726ca627edb9a687336d80a7db55f",
"size... |
from scrapy.dupefilters import RFPDupeFilter
import redis
from crawler import redis_const
class MyDupeFilter(RFPDupeFilter):
def __init__(self, path=None, debug=False):
RFPDupeFilter.__init__(self, path=None, debug=False)
self.rclient = redis.StrictRedis(host="localhost", port=6379, db=0)
def... | {
"content_hash": "025805da403ae0f6d30c75e4c082a5c6",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 75,
"avg_line_length": 30.833333333333332,
"alnum_prop": 0.7108108108108108,
"repo_name": "jiady/htdb",
"id": "786431e2157ae39d16b9144515372d4a369c12f8",
"size": "370",
"... |
import websocket
from threading import Thread
import time
import sys
def on_message(ws, message):
print(message)
def on_error(ws, error):
print(error)
def on_close(ws):
print("### closed ###")
def on_open(ws):
def run(*args):
for i in range(3):
# send the message, then wait
... | {
"content_hash": "ea1901b291132d656a9ef26fbc4f1c15",
"timestamp": "",
"source": "github",
"line_count": 46,
"max_line_length": 54,
"avg_line_length": 21.217391304347824,
"alnum_prop": 0.5122950819672131,
"repo_name": "youtube/cobalt",
"id": "8c01a9408bc679ab99e744074d2b12e9ae17eb2b",
"size": "976",... |
import numpy as np
import h5py
import matplotlib.pyplot as plt
def sigmoid(Z):
A = 1/(1+np.exp(-Z))
cache = Z
return A, cache
def sigmoid_backward(dA, cache):
Z = cache
s = 1/(1+np.exp(-Z))
dZ = dA * s * (1-s)
assert (dZ.shape == Z.shape)
return dZ
def relu(Z):
A = np.maxim... | {
"content_hash": "14693d16cd9bf7646e134c0b5cbf16ce",
"timestamp": "",
"source": "github",
"line_count": 623,
"max_line_length": 121,
"avg_line_length": 29.213483146067414,
"alnum_prop": 0.5808791208791209,
"repo_name": "darkamenosa/basic-neural-network",
"id": "e298a3210adb3f70f697ee1e34f915e8a781de3... |
""" Test redundancy features for VPC routers
"""
from marvin.codes import PASS, FAILED
from nose.plugins.attrib import attr
from marvin.cloudstackTestCase import cloudstackTestCase
from marvin.lib.base import (stopRouter,
startRouter,
destroyRouter,
... | {
"content_hash": "c11300008327ee1941bd70700f82117c",
"timestamp": "",
"source": "github",
"line_count": 742,
"max_line_length": 148,
"avg_line_length": 38.38409703504043,
"alnum_prop": 0.521821565254029,
"repo_name": "DaanHoogland/cloudstack",
"id": "fe6b4108fbf90ca9fc9e87751d9f3df2079c1ff7",
"size... |
import smtplib
from email.MIMEMultipart import MIMEMultipart
from email.MIMEText import MIMEText
from alerter import Alerter
class EMailAlerter(Alerter):
"""Send email alerts using MTP to a mail server."""
def __init__(self, config_options):
Alerter.__init__(self, config_options)
try:
... | {
"content_hash": "bf78677fb64e48de1c21fe96264aab2f",
"timestamp": "",
"source": "github",
"line_count": 102,
"max_line_length": 304,
"avg_line_length": 38.1078431372549,
"alnum_prop": 0.5526112683303319,
"repo_name": "nonbeing/simplemonitor",
"id": "3be68d93f834d059f9ac2ca1fd5b7ddd9f48e1c5",
"size"... |
"""
One way to serialize a binary tree is to use pre-order traversal. When we encounter a non-null node, we record the
node's value. If it is a null node, we record using a sentinel value such as #.
_9_
/ \
3 2
/ \ / \
4 1 # 6
/ \ / \ / \
# # # # # #
For example, the above binary tree ca... | {
"content_hash": "05772aec2d20c1ed0e3303d39fc157d2",
"timestamp": "",
"source": "github",
"line_count": 89,
"max_line_length": 119,
"avg_line_length": 24.685393258426966,
"alnum_prop": 0.519344560764679,
"repo_name": "algorhythms/LeetCode",
"id": "f2fae51fb452c731d8e23121bd515a74ac7a6d82",
"size": ... |
from django.db import models
from django.utils import timezone
from ckeditor.fields import RichTextField
| {
"content_hash": "0d92e4add4757dd549de91321ad7a771",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 41,
"avg_line_length": 22,
"alnum_prop": 0.8181818181818182,
"repo_name": "zacherytapp/wedding",
"id": "b93ef28fabd20b8af6f2bc2a3f29e46134bcdd8b",
"size": "110",
"binary":... |
import json
import logging
import mimetypes
import os
from typing import Dict, List, Optional
from urllib.parse import quote
from uuid import uuid4
import requests
# noinspection PyPackageRequirements
from slugify import slugify
from federation.entities.base import Post, Profile
from federation.entities.matrix.enums ... | {
"content_hash": "34ddbef0af03956beef07ae6d342c78e",
"timestamp": "",
"source": "github",
"line_count": 369,
"max_line_length": 116,
"avg_line_length": 38.09756097560975,
"alnum_prop": 0.5539906103286385,
"repo_name": "jaywink/federation",
"id": "b1375dd1487bf3cc601bdb8dc9c75a77b856408e",
"size": "... |
from azurectl.azurectl_exceptions import (
AzurePageBlobZeroPageError,
AzurePageBlobAlignmentViolation,
AzurePageBlobSetupError,
AzurePageBlobUpdateError
)
class PageBlob(object):
"""
Page blob iterator to control a stream of data to an Azure page blob
"""
def __init__(self, blob_s... | {
"content_hash": "d275e3da710f34895e3e397dd8763f1f",
"timestamp": "",
"source": "github",
"line_count": 103,
"max_line_length": 76,
"avg_line_length": 31.961165048543688,
"alnum_prop": 0.5309842041312273,
"repo_name": "SUSE/azurectl",
"id": "839f2afec7a67471d129f4444b54c1f519f437a0",
"size": "3896"... |
"""
Communicates with MySQL
"""
import logging
from copy import copy
from MySQLdb.cursors import DictCursor
from twisted.enterprise import adbapi
from .logger import Logger
from .base import Component, shared
LOGGER = logging.getLogger(__name__)
class MySQL(Component):
"""Implements MySQL's runquery method as... | {
"content_hash": "fa9725767fbe6e76db92bbeadf8dd4b8",
"timestamp": "",
"source": "github",
"line_count": 51,
"max_line_length": 65,
"avg_line_length": 27.647058823529413,
"alnum_prop": 0.6085106382978723,
"repo_name": "hiidef/hiispider",
"id": "1eec801bfc3a12ea7247108c18c16cbe4672860e",
"size": "145... |
from oslo_config import cfg
from neutron._i18n import _
AGENT_OPTS = [
cfg.IntOpt('agent_down_time', default=75,
help=_("Seconds to regard the agent is down; should be at "
"least twice report_interval, to be sure the "
"agent is down for good.")),
cf... | {
"content_hash": "b4579ddb305de804a5b3faa5d6c4b96d",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 79,
"avg_line_length": 52.416666666666664,
"alnum_prop": 0.5490196078431373,
"repo_name": "eayunstack/neutron",
"id": "10abf434bfd45898f75c6698779236517b462274",
"size": "2... |
import errno
import os
import re
import subprocess
import sys
def get_keywords():
# these strings will be replaced by git during git-archive.
# setup.py/versioneer.py will grep for the variable names, so they must
# each be defined on a line of their own. _version.py will just call
# get_keywords().
... | {
"content_hash": "d51e10ce5eed62abd51867790a2d6db2",
"timestamp": "",
"source": "github",
"line_count": 450,
"max_line_length": 79,
"avg_line_length": 33.98444444444444,
"alnum_prop": 0.5715686915582292,
"repo_name": "tacaswell/metadataStore",
"id": "fdc1f8191028e437e88205e34f870188076255a3",
"size... |
import os
import subprocess
def exists(file):
"""Is this an executable file?"""
return os.path.isfile(file) and os.access(file, os.X_OK)
def find(file, dirs=None):
"""Search for an executable in a given list of directories.
If no directories are given, search according to the PATH
environment variable... | {
"content_hash": "3b0cdb0749b995e1f538bc46c7dec232",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 74,
"avg_line_length": 29.53488372093023,
"alnum_prop": 0.6653543307086615,
"repo_name": "wbond/subversion",
"id": "f04f6d2487a730428f8ce4ceb99313707a570eae",
"size": "2135... |
from os import PathLike, path
from typing import Dict, Iterable, Union
from marshmallow.exceptions import ValidationError as SchemaValidationError
from azure.ai.ml._artifacts._artifact_utilities import (
_check_and_upload_path,
_get_default_datastore_info,
_update_metadata,
)
from azure.ai.ml._artifacts._... | {
"content_hash": "daa470da6c5cfb4564ecc172c4a1f454",
"timestamp": "",
"source": "github",
"line_count": 487,
"max_line_length": 124,
"avg_line_length": 42.776180698151954,
"alnum_prop": 0.580597158218126,
"repo_name": "Azure/azure-sdk-for-python",
"id": "589de4f7f29778ec9d473927546096cf8fff6812",
"... |
"""
Base typeclass for in-game Channels.
"""
from evennia.typeclasses.models import TypeclassBase
from evennia.comms.models import TempMsg, ChannelDB
from evennia.comms.managers import ChannelManager
from evennia.utils import logger
from evennia.utils.utils import make_iter
from future.utils import with_metaclass
c... | {
"content_hash": "015898799691206461fcb6041900a6f5",
"timestamp": "",
"source": "github",
"line_count": 522,
"max_line_length": 117,
"avg_line_length": 35.0919540229885,
"alnum_prop": 0.5866360956436292,
"repo_name": "titeuf87/evennia",
"id": "b8f53d47afb10c332656d10399d4ac4a8eb428eb",
"size": "183... |
from django.core.management.base import BaseCommand, CommandError
from Avaliacao.Questao.models import *
import random
def cargaTesteTipoQuestao(rg1=4,rg2=2,rrg=10):
#inclui tipo questoes rg1-rg2.
for i in range(rg1):
tq = TipoQuestao(tipo="Tipo %d" %i)
tq.save()
for... | {
"content_hash": "18cfe8eb4a080cefbe7ade11a646705c",
"timestamp": "",
"source": "github",
"line_count": 61,
"max_line_length": 83,
"avg_line_length": 35.83606557377049,
"alnum_prop": 0.5663311985361391,
"repo_name": "arruda/amao",
"id": "a26054001b89ff6775222ec5f8607c87c4027381",
"size": "2186",
... |
from openstack.key_manager.v1 import container as _container
from openstack.key_manager.v1 import order as _order
from openstack.key_manager.v1 import secret as _secret
from openstack import proxy2
class Proxy(proxy2.BaseProxy):
def create_container(self, **attrs):
"""Create a new container from attribut... | {
"content_hash": "36a53b26103f30b6199abc3247eecd45",
"timestamp": "",
"source": "github",
"line_count": 250,
"max_line_length": 78,
"avg_line_length": 40.992,
"alnum_prop": 0.584504293520687,
"repo_name": "briancurtin/python-openstacksdk",
"id": "0c65d2629236983b647860d0bf04855c729c92db",
"size": "... |
from __future__ import division
from __future__ import absolute_import
from firedrake import *
from fade import *
from fade.ml import *
import numpy as np
def test_coupling_mean_preserving():
mesh = UnitIntervalMesh(1)
mesh_hierarchy = MeshHierarchy(mesh, 3)
r_loc = 2
r_loc_cost = 0
coord =... | {
"content_hash": "6876d2101c95edc1a155f7a9ee82b10c",
"timestamp": "",
"source": "github",
"line_count": 113,
"max_line_length": 95,
"avg_line_length": 32.85840707964602,
"alnum_prop": 0.6213304605440345,
"repo_name": "alsgregory/firedrake_da",
"id": "f61f3001afd406acb4502093aa2ae7fa9ad1e2f5",
"size... |
'''
Problem:
Given a large array of int return the length of the longest
increasing(non-necessarily-adjacent) sub-sequence
'''
| {
"content_hash": "6cdce0dbd9993dc2090e04cf352c9ac5",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 59,
"avg_line_length": 25.4,
"alnum_prop": 0.7716535433070866,
"repo_name": "RishiRamraj/interviews",
"id": "4673107bfe8146ce73cfc0e966713a96d496596b",
"size": "127",
"bin... |
import sublime
import sublime_plugin
import os
import re
import sys
SETTINGS_FILE = "narrowing.sublime-settings"
extensions = None
regions = None
src_file = None
tmp_file = None
class NarrowCommand(sublime_plugin.TextCommand):
window = None
# param "action" = 'edit' / 'replace'
def run(self, edit, action=... | {
"content_hash": "31a448e7f12df691985c5179862b5af3",
"timestamp": "",
"source": "github",
"line_count": 82,
"max_line_length": 101,
"avg_line_length": 37.19512195121951,
"alnum_prop": 0.5259016393442623,
"repo_name": "icycandle/SublimeNarrowing",
"id": "f7e2283bcdf20b8c8a2a900f79e95a97bd96ff92",
"s... |
import os
from stash.tests.stashtest import StashTestCase
class Md5sumTests(StashTestCase):
"""tests for the md5sum command."""
def setUp(self):
"""setup the tests"""
self.cwd = self.get_data_path()
StashTestCase.setUp(self)
def get_data_path(self):
"""return the data/ s... | {
"content_hash": "5162111fb1daccb0d627bd520b48b58b",
"timestamp": "",
"source": "github",
"line_count": 61,
"max_line_length": 87,
"avg_line_length": 36.459016393442624,
"alnum_prop": 0.5975719424460432,
"repo_name": "ywangd/stash",
"id": "14f02259f56cddc2cd57951ecea3af63f78c79ef",
"size": "2248",
... |
import blinker
focus = blinker.Signal()
set_prompt = blinker.Signal()
set_prompt_yn = blinker.Signal()
set_message = blinker.Signal()
redraw_status = blinker.Signal()
call_delay = blinker.Signal()
| {
"content_hash": "5e8a144f9da35dbc2e231390fe50563c",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 32,
"avg_line_length": 24.75,
"alnum_prop": 0.7424242424242424,
"repo_name": "tunz/binch",
"id": "a98d949633f88d6b6a658f7a6b83a58ea360e0e3",
"size": "198",
"binary": false... |
"""Utility functions to aid in testing."""
import sys
from imp import load_source
from os.path import abspath, dirname, join
def get_bin_path():
"""Get the path to the HOME/bin directory."""
return abspath(join(dirname(__file__), '..'))
def add_bin_to_path():
"""Add the HOME/bin directory to the PATH."... | {
"content_hash": "6318a0ccd0f55caca3706c493a9e40f5",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 82,
"avg_line_length": 29.757575757575758,
"alnum_prop": 0.6771894093686355,
"repo_name": "kbd/setup",
"id": "5b42bc67967352bc1ae206e0f258012ef80b1f1a",
"size": "982",
"b... |
import time
import json
import logging
import calendar
import StringIO
import traceback
from collections import OrderedDict
import xml.etree.ElementTree as ET
from email.utils import parsedate, parsedate_tz
import requests
import requests.packages.urllib3 as urllib3
urllib3.disable_warnings()
from cachecontrol import ... | {
"content_hash": "4ca7ba91eb9b3f9b2efc57b9d984b12a",
"timestamp": "",
"source": "github",
"line_count": 274,
"max_line_length": 128,
"avg_line_length": 35.167883211678834,
"alnum_prop": 0.6159194686591947,
"repo_name": "porduna/appcomposer",
"id": "c2758e4f452d37c224b6574954054b46672ca2d1",
"size":... |
from test_framework import BitcoinTestFramework
from bitcoinrpc.authproxy import AuthServiceProxy, JSONRPCException
from util import *
def check_array_result(object_array, to_match, expected):
"""
Pass in array of JSON objects, a dictionary with key/value pairs
to match against, and another dictionary wit... | {
"content_hash": "49fc4e467b529c59b1f3b2fd51980e73",
"timestamp": "",
"source": "github",
"line_count": 92,
"max_line_length": 105,
"avg_line_length": 48.59782608695652,
"alnum_prop": 0.5135316484008052,
"repo_name": "mitchellcash/ion",
"id": "25b6827c7e83ad6c3aee4f6c40a44acac7f5e7fb",
"size": "480... |
import os
try:
from setuptools import setup, Command
except ImportError:
from distutils.core import setup, Command
os.environ['DJANGO_SETTINGS_MODULE'] = 'analytical.tests.settings'
cmdclass = {}
try:
from sphinx.setup_command import BuildDoc
cmdclass['build_sphinx'] = BuildDoc
except ImportError:
... | {
"content_hash": "e8e367e3554abb9bcef01eadbd957b9f",
"timestamp": "",
"source": "github",
"line_count": 89,
"max_line_length": 79,
"avg_line_length": 25.06741573033708,
"alnum_prop": 0.6378305692514568,
"repo_name": "ericdwang/django-analytical",
"id": "c974b43c37d4c35c22a6cac14c385f2df4571db1",
"s... |
import unittest
import time
from decimal import Decimal
from discosbackend import timediscos
from astropy.time import Time
class TestTimeDiscos(unittest.TestCase):
def setUp(self):
self.now = time.time()
def test_astropy_conversion(self):
dt = Time(self.now * timediscos.CENTINANOSECONDS,
... | {
"content_hash": "1276eea1bb8cb8f95c7806c6afef363f",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 59,
"avg_line_length": 30.925925925925927,
"alnum_prop": 0.6622754491017964,
"repo_name": "discos/discos-backend",
"id": "e0d6ad1dbe0852827ccb88a28d745932303430b0",
"size":... |
"""
ExternalList.py - large disk-based lists
========================================
A list class that serves as a stand-in for python lists but
stores data on the file system.
Implements not all functionality of lists yet. Lists are stored
as tab-separated values for unix sort functionality, so all
elements in the ... | {
"content_hash": "c8872e5602c646310960e51193000ee3",
"timestamp": "",
"source": "github",
"line_count": 110,
"max_line_length": 98,
"avg_line_length": 24.581818181818182,
"alnum_prop": 0.569896449704142,
"repo_name": "CGATOxford/Optic",
"id": "d07c677e1146005bb0029a4ff00c4c210f2c8ec1",
"size": "369... |
"""
Based on django-picklefield which is
Copyright (c) 2009-2010 Gintautas Miliauskas
but some improvements including not deepcopying values.
Provides an implementation of a pickled object field.
Such fields can contain any picklable objects.
The implementation is taken and adopted from Django... | {
"content_hash": "27bf6e7008d699fd2b9c89e023229fb6",
"timestamp": "",
"source": "github",
"line_count": 128,
"max_line_length": 77,
"avg_line_length": 29.71875,
"alnum_prop": 0.6703470031545742,
"repo_name": "celery/django-celery",
"id": "a7dc5bd2dbfe895a79e6d9ca68b43aba73f99364",
"size": "3804",
... |
"""
<Program Name>
hash.py
<Author>
Vladimir Diaz <vladimir.v.diaz@gmail.com>
<Started>
February 28, 2012. Based on a previous version of this module.
<Copyright>
See LICENSE for licensing information.
<Purpose>
Support multiple implementations of secure hash and message digest
algorithms. Any hash-rel... | {
"content_hash": "78de68114798a994aafe7fbfc8e46c5a",
"timestamp": "",
"source": "github",
"line_count": 281,
"max_line_length": 92,
"avg_line_length": 30.722419928825623,
"alnum_prop": 0.7069384918336615,
"repo_name": "team-ferret/pip-in-toto",
"id": "f940af2720d6a090797a61c77f9a2061d1fc33ca",
"siz... |
from optimize.constants import *
| {
"content_hash": "7053b01a9fd5ff37a420292110e62fab",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 32,
"avg_line_length": 33,
"alnum_prop": 0.8181818181818182,
"repo_name": "haoyio/stock-opt",
"id": "e774c1724bb72e70418ce2ed0d6059e637204428",
"size": "33",
"binary": fal... |
from django.http import HttpRequest
from django.template import (
Context, RequestContext, Template, Variable, VariableDoesNotExist,
)
from django.template.context import RenderContext
from django.test import RequestFactory, SimpleTestCase, override_settings
class ContextTests(SimpleTestCase):
def test_conte... | {
"content_hash": "912aa45906fa8620c7f3f5c6df924617",
"timestamp": "",
"source": "github",
"line_count": 160,
"max_line_length": 84,
"avg_line_length": 30.3,
"alnum_prop": 0.5488861386138614,
"repo_name": "wetneb/django",
"id": "9c23a38af23a15ba6cb64a561ec0dcbb126896dc",
"size": "4873",
"binary": ... |
from django import template
from django_countries.fields import Country
register = template.Library()
@register.assignment_tag
def get_country(code):
return Country(code=code)
| {
"content_hash": "8411e9808454920f2395df8dcb8a9036",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 43,
"avg_line_length": 18.4,
"alnum_prop": 0.782608695652174,
"repo_name": "jrfernandes/django-countries",
"id": "8c7eaf33f551ae3b82dd7d1d0522fd6fb8617eb2",
"size": "184",
... |
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
from sqlalchemy.ext.associationproxy import association_proxy
from sqlalchemy.orm import relationship, backref
import flask_admin as admin
from flask_admin.contrib import sqla
# Create application
app = Flask(__name__)
# Create dummy secrey key so we ca... | {
"content_hash": "42bcecffeb8ac9749e60131fce5f58bc",
"timestamp": "",
"source": "github",
"line_count": 108,
"max_line_length": 106,
"avg_line_length": 31.14814814814815,
"alnum_prop": 0.6765755053507729,
"repo_name": "haradashinya/flask-admin",
"id": "22f256ab0474b53673b00163a36413e98c883571",
"si... |
"""
Ctypesgencore is the module that contains the main body of ctypesgen - in fact,
it contains everything but the command-line interface.
ctypesgen's job is divided into three steps:
Step 1: Parse
Ctypesgen reads the input header files and parses them. It generates a list of
function, variable, struct, union, enum,... | {
"content_hash": "6760307e70aa23e1ddb82ea2cfcb4ed1",
"timestamp": "",
"source": "github",
"line_count": 78,
"max_line_length": 80,
"avg_line_length": 27.55128205128205,
"alnum_prop": 0.7701256398324802,
"repo_name": "davidjamesca/ctypesgen",
"id": "a9558ba86a9b78a483e70204a748d21931b3e22d",
"size":... |
from datetime import datetime
from flask import Flask
from flask import render_template, request
import logging
import telegram
import leancloud
from leancloud import Engine, Query, Object, LeanCloudError
import random
import re
import sys
import urllib2
import json
import threading
reload(sys)
sys.setdefaultencoding... | {
"content_hash": "ae25e3f258f6724b4b3f125331921d0e",
"timestamp": "",
"source": "github",
"line_count": 362,
"max_line_length": 121,
"avg_line_length": 28.944751381215468,
"alnum_prop": 0.5897117770566902,
"repo_name": "drakeet/DrakeetLoveBot",
"id": "90730fe5c4316388a91eaf275b85e8dff7200b08",
"siz... |
from collections import OrderedDict
from typing import Tuple, Union
import numpy as np
import torch
import torch.nn.functional as F
from torch import nn
class Bottleneck(nn.Module):
expansion = 4
def __init__(self, inplanes, planes, stride=1):
super().__init__()
# all conv layers have strid... | {
"content_hash": "308658cfeed507f5a2daba22349cdf5c",
"timestamp": "",
"source": "github",
"line_count": 436,
"max_line_length": 178,
"avg_line_length": 39.84862385321101,
"alnum_prop": 0.5936456774490618,
"repo_name": "openai/CLIP",
"id": "232b7792eb97440642547bd462cf128df9243933",
"size": "17374",... |
import warnings
import numpy as np
import pytest
from numpy.testing import (assert_almost_equal,
assert_array_equal,
)
from nistats.hemodynamic_models import (_hrf_kernel,
_orthogonalize,
... | {
"content_hash": "7ea867f95bd933611aac5a44c405f68f",
"timestamp": "",
"source": "github",
"line_count": 275,
"max_line_length": 76,
"avg_line_length": 33.31636363636363,
"alnum_prop": 0.5425671250818599,
"repo_name": "nistats/nistats",
"id": "a8eb7c0f715c58df1ed48eac9e9ea1a657fc7634",
"size": "9162... |
import collections
import os
import sexpdata
from ensime_shared.util import Util
BOOTSTRAPS_ROOT = os.path.join(os.environ['HOME'], '.config', 'ensime-vim')
"""Default directory where ENSIME server bootstrap projects will be created."""
LOG_FORMAT = '%(levelname)-8s <%(asctime)s> (%(filename)s:%(lineno)d) - %(messa... | {
"content_hash": "c1c63a221b4ba7d36bcdaa68583850e1",
"timestamp": "",
"source": "github",
"line_count": 140,
"max_line_length": 97,
"avg_line_length": 34.121428571428574,
"alnum_prop": 0.5880259577140464,
"repo_name": "ensime/ensime-vim",
"id": "4a095c94d22d363ad8beeb43b1775aee9f84ae3d",
"size": "4... |
import hmac
import hashlib
def hmac_digest(key=None, string=None, encoding=None):
"""
Crypt using HMAC.
:param key:
:param string:
:param encoding:
:return:
"""
h = hmac.new(key=key, digestmod=hashlib.sha256)
h.update(unicode(string, 'utf-8'))
if encoding:
return h.he... | {
"content_hash": "94cd254b3045b8b6d8ab02821db980c3",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 54,
"avg_line_length": 17.82857142857143,
"alnum_prop": 0.5977564102564102,
"repo_name": "fidemapps/fidem-signer.py",
"id": "297bab763577e4a30061b27b8466b4e44dce8744",
"siz... |
import vss_functions
import os
from re import search
import argparse
from shutil import copy
class OutputPathError(Exception):
pass
def argument_parsing():
parser = argparse.ArgumentParser(description=u'vss_explorer v0.010 - command-line tool to browse shadow copies '
... | {
"content_hash": "bc5d526278f66977ba633e03d8ff07c3",
"timestamp": "",
"source": "github",
"line_count": 132,
"max_line_length": 121,
"avg_line_length": 36.515151515151516,
"alnum_prop": 0.49688796680497926,
"repo_name": "RatixXt/PyVSS",
"id": "d4eed94bf3759ae8a0e00fcef0ebc75828b5e438",
"size": "485... |
from django.conf.urls import patterns, include, url
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()
handler500 = 'aaee_front.lib.remoteauth.views.server_error'
urlpatterns = patterns(
'',
url(r'^', include('aaee_front.apps.main.urls')),
url(r'^e... | {
"content_hash": "9945b88d473f861c6b0017b3a20dec3d",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 64,
"avg_line_length": 28.470588235294116,
"alnum_prop": 0.6962809917355371,
"repo_name": "aaee-enscachan/aaee-front",
"id": "815f4c5799f895f461297839b32541a75672bf5c",
"si... |
import lights.cli
import lights.colour
import lights.colour.correction as lcc
import time
def main():
# Get light options
parser = lights.cli.get_light_options()
# Process arguments
args = parser.parse_args()
l = lights.cli.get_lights_from_args(args)
glw = lcc.GammaLightWrapper(l, gamma=2.2)
... | {
"content_hash": "37c9af79e50c525b13b04aac9d9bc441",
"timestamp": "",
"source": "github",
"line_count": 46,
"max_line_length": 74,
"avg_line_length": 22.47826086956522,
"alnum_prop": 0.5851063829787234,
"repo_name": "snorecore/lights",
"id": "e6784220f9f36d821a9f18695a45d93821d85747",
"size": "1034... |
from __future__ import unicode_literals
from django.db import models, migrations
def fix_scrap(apps, schema_editor):
InstagramAccount = apps.get_model("social", "InstagramAccount")
for ia in InstagramAccount.objects.all():
ia.scrape_account = ia.scrap_account
ia.save()
class Migration(migrat... | {
"content_hash": "df938432542f300e74ca7772094ee9b9",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 67,
"avg_line_length": 25.05,
"alnum_prop": 0.6606786427145709,
"repo_name": "MadeInHaus/django-social",
"id": "38cc251b7060b437ea9ef720f4e56d124de934f5",
"size": "525",
... |
from collections import namedtuple
Participant = namedtuple("Participant", ["nick", "socket"])
| {
"content_hash": "26bc7317db3a583618a2bb79a97f655a",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 59,
"avg_line_length": 32,
"alnum_prop": 0.7604166666666666,
"repo_name": "WayneKoorts/TornChat",
"id": "041f9e964729d6dde3244b0b536b1abc9f7298af",
"size": "96",
"binary":... |
"""
The Plaid API
The Plaid REST API. Please see https://plaid.com/docs/api for more details. # noqa: E501
Generated by: https://openapi-generator.tech
"""
import re # noqa: F401
import sys # noqa: F401
from plaid.model_utils import ( # noqa: F401
ApiTypeError,
ModelComposed,
ModelNormal... | {
"content_hash": "57769302db55b7d1880bbbc3c74f8e76",
"timestamp": "",
"source": "github",
"line_count": 241,
"max_line_length": 490,
"avg_line_length": 54.6597510373444,
"alnum_prop": 0.6051013436574812,
"repo_name": "plaid/plaid-python",
"id": "e1cef0ea0feeb4e936fe52c322f9d501a38faa3d",
"size": "1... |
import numpy as np
# In[2]:
np.random.seed(1234)
np.random.normal()
# Then, the core part will be to install and import [James Powell (`dutc`)](https://github.com/dutc/) [`rwatch`](https://github.com/dutc/rwatch) module.
# If you don't have it installed :
#
# 1. Be sure to have CPython 3.5. `rwatch` patches the ... | {
"content_hash": "ca59bf2b452fa2f7ef3dcd89f49ab2be",
"timestamp": "",
"source": "github",
"line_count": 493,
"max_line_length": 248,
"avg_line_length": 22.634888438133874,
"alnum_prop": 0.6600053768258805,
"repo_name": "Naereen/notebooks",
"id": "97f46343fc2b88eb7aba9271ac56cfdd73bcc0d9",
"size": "... |
from __future__ import unicode_literals, division, absolute_import
from builtins import * # noqa pylint: disable=unused-import, redefined-builtin
from past.builtins import basestring
import re
import copy
import logging
log = logging.getLogger('utils.qualities')
class QualityComponent(object):
""""""
def ... | {
"content_hash": "9e4361cd019091f6888774324e1b04a2",
"timestamp": "",
"source": "github",
"line_count": 491,
"max_line_length": 117,
"avg_line_length": 36.84725050916497,
"alnum_prop": 0.5653880168030069,
"repo_name": "sean797/Flexget",
"id": "8881c318807e80621e0ba723abcbf0172a34cc09",
"size": "180... |
"""Tests for the Elmax config flow."""
from unittest.mock import patch
from elmax_api.exceptions import ElmaxBadLoginError, ElmaxBadPinError, ElmaxNetworkError
from homeassistant import config_entries, data_entry_flow
from homeassistant.components.elmax.const import (
CONF_ELMAX_PANEL_ID,
CONF_ELMAX_PANEL_NAM... | {
"content_hash": "badda01b8281ec0fd6c3f90020721e6e",
"timestamp": "",
"source": "github",
"line_count": 404,
"max_line_length": 95,
"avg_line_length": 35.03217821782178,
"alnum_prop": 0.5771214583480534,
"repo_name": "toddeye/home-assistant",
"id": "5b8d42799e90540d7591875b1583260363b57d4f",
"size"... |
"""
Python Interchangeable Virtual Instrument Library
Copyright (c) 2012-2016 Alex Forencich
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the... | {
"content_hash": "3abb45b87ef80d41d84c6c941d236e3d",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 77,
"avg_line_length": 33.69090909090909,
"alnum_prop": 0.6492174851592013,
"repo_name": "Diti24/python-ivi",
"id": "3a0957b5a30a812399b8088a6aa33889176dd1b8",
"size": "185... |
from django.conf.urls import include, url
from . import views
urlpatterns = (
url(r'^resources$', views.resources_page, name='resources'),
)
| {
"content_hash": "15f28f248b529478d29cbba90d3de69c",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 64,
"avg_line_length": 21,
"alnum_prop": 0.7074829931972789,
"repo_name": "Oinweb/py-fly",
"id": "c23ec78979b2276a9648d439b0eacd67477d799f",
"size": "147",
"binary": false... |
"""
*******************************************************************************
* Ledger Blue
* (c) 2016 Ledger
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.... | {
"content_hash": "01c13d88c2acdf62f5f3b20a2002ef8f",
"timestamp": "",
"source": "github",
"line_count": 90,
"max_line_length": 127,
"avg_line_length": 34.544444444444444,
"alnum_prop": 0.6815696365390801,
"repo_name": "LedgerHQ/blue-loader-python",
"id": "6346380d1d84bc2651f1ef63e31276ba4dc3f5bc",
... |
from __future__ import absolute_import
from sentry.utils.safe import get_path, trim
from sentry.utils.strings import truncatechars
from .base import BaseEvent
def get_crash_location(data):
from sentry.stacktraces.processing import get_crash_frame_from_event_data
frame = get_crash_frame_from_event_data(
... | {
"content_hash": "b93d8f6bad9355c981a789b49ead7e68",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 90,
"avg_line_length": 32.01724137931034,
"alnum_prop": 0.6112008616047389,
"repo_name": "mvaled/sentry",
"id": "6e54112dd44e75ba0ca2885210ac14b0040de17c",
"size": "1857",
... |
import demistomock as demisto # noqa: F401
from CommonServerPython import * # noqa: F401
import json
import random
import re
from datetime import datetime as dt
ERROR_TEMPLATE = 'ERROR: SendEmailReply - {function_name}: {reason}'
def get_utc_now():
""" A wrapper function for datetime.utcnow
Helps handle te... | {
"content_hash": "e193d4e054ba923a94a9b52645ea9e02",
"timestamp": "",
"source": "github",
"line_count": 974,
"max_line_length": 121,
"avg_line_length": 44.63757700205339,
"alnum_prop": 0.6193849621639027,
"repo_name": "VirusTotal/content",
"id": "549177491abf10f9e0dc8f2f39780c75de9d2247",
"size": "... |
"""
WIFISCAN.PY
WiFi Hotspot Plugin
Original Source: https://github.com/pimoroni/dot3k/blob/master/python/examples/advanced/plugins/wlan.py
Changes:
- Removed Bar
- Improved Display Style of WiFi Networks
(C) 2015, rGunti
"""
from dot3k.menu import MenuOption
import dot3k.backlight
import wifi, threa... | {
"content_hash": "7cf29245a5cb1e5beb7726c6f3e1b001",
"timestamp": "",
"source": "github",
"line_count": 109,
"max_line_length": 105,
"avg_line_length": 21.587155963302752,
"alnum_prop": 0.6243093922651933,
"repo_name": "rGunti/Yuki-Chan-Music-Player",
"id": "bb308e82d1df649bf61bfb5f237af113be625bf9",... |
import arviz as az
data = az.load_arviz_data('centered_eight')
az.plot_violin(data)
| {
"content_hash": "7205f92ccf0a8d1dbdfba4e32d2460e3",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 43,
"avg_line_length": 28,
"alnum_prop": 0.75,
"repo_name": "mcmcplotlib/mcmcplotlib",
"id": "4cd3992c81be861f353a368b6244ebd0ff6b0a7e",
"size": "84",
"binary": false,
"... |
import datetime
from collections import defaultdict
from flask_marshmallow import Marshmallow
from flask_sqlalchemy import SQLAlchemy
from sqlalchemy.ext.compiler import compiles
from sqlalchemy.ext.hybrid import hybrid_property
from sqlalchemy.orm import column_property, validates
from CTFd.cache import cache
db = ... | {
"content_hash": "8afdfb31f35d9651930848af11e55405",
"timestamp": "",
"source": "github",
"line_count": 1023,
"max_line_length": 117,
"avg_line_length": 31.93548387096774,
"alnum_prop": 0.6239057239057239,
"repo_name": "CTFd/CTFd",
"id": "2bfef2d7575f220286c927cdac497885a7aef957",
"size": "32670",
... |
import json
import logging
import re
import time
from api.api_samples.python_client.api_client import CloudBoltAPIClient
from api.api_samples.python_client.samples.api_helpers import wait_for_order_completion
from common.methods import set_progress
from servicecatalog.models import ServiceBlueprint
from utilities.exce... | {
"content_hash": "ba9fe620dcdea3a6d2bc51f20d28c114",
"timestamp": "",
"source": "github",
"line_count": 128,
"max_line_length": 106,
"avg_line_length": 34.5546875,
"alnum_prop": 0.644359032330997,
"repo_name": "CloudBoltSoftware/cloudbolt-forge",
"id": "5e51694f2c6399316cb6f862a80aab1a2bfdf5c9",
"s... |
from __future__ import absolute_import
import sys
sys.path.append("/usr/local/lib/python3.2/site-packages/")#access to numpy, matplotlib, networkx libraries
from pyN.data_analysis import *
from pyN.Populations import AdExPopulation, IzhikevichPopulation
from pyN.Network import *
from pyN.DopaNetwork import *
from pyN... | {
"content_hash": "76b218efd2f8e54a5f00cea572d649d4",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 106,
"avg_line_length": 33.8,
"alnum_prop": 0.7988165680473372,
"repo_name": "ericjang/pyN",
"id": "a0d65f4b22bb53affe4c969ea2d442b04116078d",
"size": "338",
"binary": fa... |
from .containers import ContainerConfig, HostConfig, LogConfig, Ulimit
from .healthcheck import Healthcheck
from .networks import EndpointConfig, IPAMConfig, IPAMPool, NetworkingConfig
from .services import (
ConfigReference, ContainerSpec, DNSConfig, DriverConfig, EndpointSpec,
Mount, Placement, Privileges, Re... | {
"content_hash": "a90d4b2722332563bd04e44915ecb106",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 76,
"avg_line_length": 50.333333333333336,
"alnum_prop": 0.8211920529801324,
"repo_name": "vpetersson/docker-py",
"id": "39c93e344dfe5d44d3091e3549e4ae718f5d3e4c",
"size": "... |
'''Welcome(Introduction)
Are you ready for this? (Plays Whoomp there it is by Tag Team).
No, but in all seriouness are you ready to play my game, I hope you enjoy it.
Take it seriously please.
'''
| {
"content_hash": "435341c034471d5304b4757643ce0d07",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 77,
"avg_line_length": 33,
"alnum_prop": 0.7323232323232324,
"repo_name": "troydasheroreo/text-adventure2",
"id": "46636fe3c96c199187c6513395359d249beb07cd",
"size": "198",
... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import argparse
import collections
import hashlib
import io
import itertools
import gzip
import codecs
import os
import re
import sys
PATH_VALUE_REGEX = re.compile(r'pat... | {
"content_hash": "c5ca469aa56a0674be62e50f4014db8a",
"timestamp": "",
"source": "github",
"line_count": 652,
"max_line_length": 98,
"avg_line_length": 36.92638036809816,
"alnum_prop": 0.5593121781026749,
"repo_name": "shs96c/buck",
"id": "9e7d869671ca297d8309b9b69cfda5e6b0c35be7",
"size": "24076",
... |
"""scn_a
This file is a test scene.
This one is specifically used for testing
scene swaps and model data manipulation."""
# Import built-in libraries.
pass
# Import supplementary libraries.
import pygame
from pygame.locals import *
# Import local modules.
from bases import Scene
import model
... | {
"content_hash": "da678d6aec8ee9a8838f9cc24e9a757b",
"timestamp": "",
"source": "github",
"line_count": 46,
"max_line_length": 46,
"avg_line_length": 21.5,
"alnum_prop": 0.5035389282103134,
"repo_name": "Tricorne-Games/pyGameFrame",
"id": "e4fe512247a7a795f8b03a598d8dff0cdbac2747",
"size": "1013",
... |
"""
Tests for single instance Solr Cores
"""
from tests.docker_fixtures import *
from zonne import connect
from zonne.core import Core
CORE_NAME = 'test_core'
@solr_docker_test
def test_create_core(solr_fixture):
"""
Can we create a new Solr core?
:param solr_fixture: SolrFixture instance for testing
... | {
"content_hash": "8ac5b07659b1cafeee35253684e307af",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 66,
"avg_line_length": 23,
"alnum_prop": 0.6884057971014492,
"repo_name": "voutilad/zonne",
"id": "5bd3c76cec3ffbbafbb8aedbb72956332754459d",
"size": "828",
"binary": fal... |
import os
import hashlib
from StringIO import StringIO
from zipfile import ZipFile, ZIP_STORED
from viper.common.out import *
from viper.common.network import download
from viper.common.objects import File
from viper.common.utils import path_split_all
url = 'https://github.com/viper-framework/viper/archive/master.zip... | {
"content_hash": "c4b32b1a8029e13847ed0f01aa421178",
"timestamp": "",
"source": "github",
"line_count": 88,
"max_line_length": 100,
"avg_line_length": 35.77272727272727,
"alnum_prop": 0.6127700127064803,
"repo_name": "jack51706/viper",
"id": "78aef869447d418e628604b019baaf616b0ac775",
"size": "3292... |
"""
The main purpose of these models is to do manual testing of
the mongonaut front end. Do not use this code as an actual blog
backend.
"""
from mongoengine import BooleanField
from mongoengine import DateTimeField
from mongoengine import Document
from mongoengine import EmbeddedDocument
from mongoengine import Embe... | {
"content_hash": "473325acf156fb4c463cd3012a732508",
"timestamp": "",
"source": "github",
"line_count": 83,
"max_line_length": 89,
"avg_line_length": 35.78313253012048,
"alnum_prop": 0.7111111111111111,
"repo_name": "lchsk/django-mongonaut",
"id": "7a0ac6e4cd012606623b41d7f337bf8d6c5f5371",
"size":... |
"""\
Paster create template for creating your own authentication methods.
"""
from paste.script.templates import BasicPackage
class AuthenticatePlugin(BasicPackage):
_template_dir = 'authenticate'
summary = "An AuthKit authenticate middleware plugin"
| {
"content_hash": "177732e0b123941093b72b323b58cdc7",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 68,
"avg_line_length": 29,
"alnum_prop": 0.7777777777777778,
"repo_name": "santisiri/popego",
"id": "6281348dfb5fad26071a276fbac7ed4342a9c5ae",
"size": "261",
"binary": fa... |
'''Unit tests for grit.format.policy_templates.writers.doc_writer'''
import os
import sys
if __name__ == '__main__':
sys.path.append(os.path.join(os.path.dirname(__file__), '../../../..'))
import unittest
from xml.dom import minidom
from grit.format.policy_templates.writers import writer_unittest_common
from grit... | {
"content_hash": "a815c8d89c6eeda0079f29bedc12a364",
"timestamp": "",
"source": "github",
"line_count": 551,
"max_line_length": 142,
"avg_line_length": 34.637023593466424,
"alnum_prop": 0.5436206444851978,
"repo_name": "windyuuy/opera",
"id": "c413211a80f2eb55b8135776d771ce23e67a55e6",
"size": "192... |
import random
import gevent
from flaky import flaky
@flaky(max_runs=3)
def test_miner_start(web3_empty, wait_for_miner_start):
web3 = web3_empty
# sanity
assert web3.eth.mining
assert web3.miner.hashrate
web3.miner.stop()
with gevent.Timeout(60):
while web3.eth.mining or web3.eth.... | {
"content_hash": "9428c358419452e44f8de68b8d1e8136",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 55,
"avg_line_length": 18.5,
"alnum_prop": 0.6792792792792792,
"repo_name": "shravan-shandilya/web3.py",
"id": "65f1ace32fbf9c22458d80da04d22d93fb53e5d7",
"size": "555",
... |
from copy import deepcopy
from typing import Any, TYPE_CHECKING
from msrest import Deserializer, Serializer
from azure.core.rest import HttpRequest, HttpResponse
from azure.mgmt.core import ARMPipelineClient
from . import models
from ._configuration import ApplicationInsightsManagementClientConfiguration
from .opera... | {
"content_hash": "6471becf0cd0143b2463e6d485a054ad",
"timestamp": "",
"source": "github",
"line_count": 91,
"max_line_length": 137,
"avg_line_length": 41.494505494505496,
"alnum_prop": 0.6927966101694916,
"repo_name": "Azure/azure-sdk-for-python",
"id": "edc619695dfea51d275bb2e6640a19138dff6c51",
"... |
import mock
import random
from twisted.trial import unittest
from twisted.internet import defer
from buildbot import config
from buildbot.test.fake import fakedb, fakemaster
from buildbot.process import builder, factory
from buildbot.util import epoch2datetime
class BuilderMixin(object):
def makeBuilder(self, name... | {
"content_hash": "472918ab676225d59d6356b2da9548e0",
"timestamp": "",
"source": "github",
"line_count": 412,
"max_line_length": 98,
"avg_line_length": 38.327669902912625,
"alnum_prop": 0.6233930720030397,
"repo_name": "denny820909/builder",
"id": "462b5694f311a74628be7443c0696427aef607e1",
"size": ... |
"""
Functions and script to peek into the callable/argument structure of a set of callables, as given by
a module (or module dot-path string), class, callable, or list thereof.
"""
import matplotlib.pylab as plt
import importlib
import pandas as pd
import numpy as np
from typing import Callable, Iterator
import inspect... | {
"content_hash": "6167fe4500b7c8faf243ba6f8de79be6",
"timestamp": "",
"source": "github",
"line_count": 374,
"max_line_length": 115,
"avg_line_length": 34.72192513368984,
"alnum_prop": 0.6218235022331742,
"repo_name": "thorwhalen/ut",
"id": "3334db18c1f86aae905feb4398ca741a1305807c",
"size": "12986... |
import ssl, socket, SocketServer, select
class SSlSocketServer(SocketServer.ThreadingMixIn, SocketServer.TCPServer):
def get_request(self):#overwritten
newsocket, fromaddr = self.socket.accept()
connstream = ssl.wrap_socket(newsocket,
server_side=True,
certfile="cacert.pem",... | {
"content_hash": "785959da536f3faa2adc634c31a4af9e",
"timestamp": "",
"source": "github",
"line_count": 66,
"max_line_length": 75,
"avg_line_length": 30.257575757575758,
"alnum_prop": 0.5332999499248874,
"repo_name": "wynemo/sockstunnel",
"id": "dc8cf94a2801e9d860d893741026505e61a9fac4",
"size": "2... |
import six
import decimal
import json
import multiprocessing as mp
from collections import OrderedDict
from datetime import date, datetime, time, timedelta
from distutils.version import LooseVersion
import hypothesis as h
import hypothesis.extra.pytz as tzst
import hypothesis.strategies as st
import numpy as np
impor... | {
"content_hash": "6327304879b090aecc6c11fdbb5e11d4",
"timestamp": "",
"source": "github",
"line_count": 2513,
"max_line_length": 79,
"avg_line_length": 35.41146040588937,
"alnum_prop": 0.544145905673735,
"repo_name": "tebeka/arrow",
"id": "fe5b3051a5bb41e729d85f17de6dcd08d8af1035",
"size": "89820",... |
from collections import namedtuple
Network = namedtuple(
'Network', (
'code', 'network_name', 'subnet_name',
'wif', 'address', 'pay_to_script', 'prv32', 'pub32',
'tx', 'block',
'magic_header', 'default_port', 'dns_bootstrap'
)
)
| {
"content_hash": "a635561f564456658d84425b34f1fc69",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 60,
"avg_line_length": 27,
"alnum_prop": 0.562962962962963,
"repo_name": "XertroV/pycoin",
"id": "f852e41c5a83c463b7a5ce81aed989f26b88b25c",
"size": "270",
"binary": fals... |
from generate import generate_poem
def main():
print(generate_poem())
if __name__ == "__main__":
main()
| {
"content_hash": "d5ea07928682c95d91260a5d19d5f54c",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 34,
"avg_line_length": 12.88888888888889,
"alnum_prop": 0.5862068965517241,
"repo_name": "thornewolf/PoemGenerator",
"id": "68c9eaba71d8c3672a747adabb81cb20a92181b0",
"size"... |
"""
Py3d
v0.1
## Introduction
A pure Python 3d ray-tracer renderer with a focus on being user-friendly :)
Allows the user to build a scene of 3d geometries and render it to an image file.
Obviously it is not as fast or powerful as heavier more hardcore 3d libraries,
but it is small, light, and can create some neat stu... | {
"content_hash": "af8d370d528278a8bae44331fcb2d371",
"timestamp": "",
"source": "github",
"line_count": 554,
"max_line_length": 285,
"avg_line_length": 41.824909747292416,
"alnum_prop": 0.6365284191446204,
"repo_name": "karimbahgat/Py3d",
"id": "53e2b9a1591f69536fb5d6fb0691d312139c5a5b",
"size": "2... |
import os
from printer import Printer
from utils import Utils, VSDKInspector
class VSDCommand(object):
""" VSD CLI commands
"""
@classmethod
def execute(cls, args):
""" Execute CLI command """
func = getattr(cls, args.command)
cls._check_arguments(args)
func(args)
... | {
"content_hash": "5f8997c9ca67d202cd3fed235b4c691a",
"timestamp": "",
"source": "github",
"line_count": 421,
"max_line_length": 178,
"avg_line_length": 36.29928741092637,
"alnum_prop": 0.6006412773197225,
"repo_name": "nuagenetworks/vsdcli",
"id": "f71c1122301b509209612dcc03a4ab31d4a81dab",
"size":... |
import pytest
from c7n.config import Config
from c7n_tencentcloud.client import Session
from c7n_tencentcloud.provider import TencentCloud
from tencentcloud.common.exception.tencent_cloud_sdk_exception import TencentCloudSDKException
@pytest.fixture
def tc_provider():
return TencentCloud()
def test_get_session_... | {
"content_hash": "64734652d963c9a5cb5ef9ce1df822a3",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 94,
"avg_line_length": 27.319148936170212,
"alnum_prop": 0.7048286604361371,
"repo_name": "alfredgamulo/cloud-custodian",
"id": "d9ebf7c69a70c6c0cb2fb42ff1d39f2c479d9c99",
... |
import numpy as np
def sigmoid(x):
"""Calculate sigmoid"""
return 1 / (1 + np.exp(-x))
# network size
N_input = 4
N_hidden = 3
N_output = 2
np.random.seed(42)
# make some fake data
X = np.random.randn(N_input)
weights_in_hidden = np.random.normal(0, scale=0.1, size=(N_input, N_hidden))
weights_hidden_out... | {
"content_hash": "155e8d7750206c8f7e434fbd01f56283",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 78,
"avg_line_length": 22.21212121212121,
"alnum_prop": 0.7025920873124147,
"repo_name": "Kulbear/deep-learning-nano-foundation",
"id": "b1ba591c68e4bbbb8b3a416b200e09be9ced5... |
from __future__ import print_function
import codecs
import os
import sys
try:
from setuptools import Extension, find_packages, setup
except ImportError:
print('setuptools is required for tt installation.\n'
'You can install it using pip.', file=sys.stderr)
sys.exit(1)
# directories/files
here =... | {
"content_hash": "1b7179002b57ca2d2e9ce6a1e26f6f93",
"timestamp": "",
"source": "github",
"line_count": 97,
"max_line_length": 77,
"avg_line_length": 27.721649484536083,
"alnum_prop": 0.6418743027147639,
"repo_name": "welchbj/tt",
"id": "05f636aa64cf7df28d2a22c3cab447b1cb6fd8a4",
"size": "2689",
... |
from __future__ import absolute_import
import logging
log = logging.getLogger(__name__)
import os
import sys
from bokeh.io import set_curdoc, curdoc
from .code_runner import _CodeRunner
from .handler import Handler
class CodeHandler(Handler):
""" Run source code which modifies a Document
Args:
sou... | {
"content_hash": "7e91fbaa2a45f4395535e067608dc28d",
"timestamp": "",
"source": "github",
"line_count": 117,
"max_line_length": 117,
"avg_line_length": 29.675213675213676,
"alnum_prop": 0.5941820276497696,
"repo_name": "percyfal/bokeh",
"id": "b3b0327d80fb44def8a2c51a48d0a03dd6d0fb64",
"size": "347... |
"""Schedule for batch_matmul operator"""
from tvm import autotvm
from tvm.contrib import rocblas
from .. import generic
from ..util import get_const_tuple
@autotvm.register_topi_compute("batch_matmul_rocblas.rocm")
def batch_matmul_rocblas(cfg, x, y, out_shape=None):
"""Computes matrix multiplication of `x` and `... | {
"content_hash": "1ed7e55c8707dddb42692cf8e3f5d172",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 79,
"avg_line_length": 32.743589743589745,
"alnum_prop": 0.6421299921691465,
"repo_name": "sxjscience/tvm",
"id": "fa4dd457f3ed95565490074470f6a625509ff3fa",
"size": "2127"... |
import testtools
import webob
from glance.api import cached_images
from glance.api import policy
from glance.common import exception
from glance import image_cache
class FakePolicyEnforcer(policy.Enforcer):
def __init__(self):
self.default_rule = ''
self.policy_path = ''
self.policy_file_... | {
"content_hash": "7f9cbdb896dbab582ec6b548087a1bfc",
"timestamp": "",
"source": "github",
"line_count": 97,
"max_line_length": 72,
"avg_line_length": 29.463917525773194,
"alnum_prop": 0.6301609517144856,
"repo_name": "tanglei528/glance",
"id": "c0360384b888121cbdd4c2b5fc94a397d2cb85a7",
"size": "34... |
from __future__ import absolute_import
from django.contrib import admin
from .models import Tag, TaggedItem
class TaggedItemInline(admin.StackedInline):
model = TaggedItem
class TagAdmin(admin.ModelAdmin):
list_display = ["name"]
inlines = [
TaggedItemInline
]
admin.site.register(Tag, Tag... | {
"content_hash": "c4a4a852d61d8924294b723f6ab9643a",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 44,
"avg_line_length": 18.166666666666668,
"alnum_prop": 0.7186544342507645,
"repo_name": "niwinz/Green-Mine",
"id": "45d0bfd2ee49279867264c4d59af128e222115f7",
"size": "35... |
from generator.actions import Actions
from random import choice, randint
from os.path import dirname, abspath, join
import string
import sys
sys.path.append(join(dirname(dirname(dirname(abspath(__file__)))), "support"))
from multipasssupport import MultiPassSupport
def random_alpha(a, b):
return ''.join(choice(s... | {
"content_hash": "cc71b0c428f18ecdab4c9aa38cdeb616",
"timestamp": "",
"source": "github",
"line_count": 745,
"max_line_length": 122,
"avg_line_length": 32.34093959731543,
"alnum_prop": 0.6477131235992363,
"repo_name": "f0rki/cb-multios",
"id": "ce7c6e4c9c211af5c9b809533264a95cd9547a7c",
"size": "25... |
from flask import Flask
from flask.ext.mongoengine import MongoEngine
# If you'd rather use Creole for markup, import Creole instead
from flaskext.markdown import Markdown
# from flaskext.creole import Creole
app = Flask(__name__)
app.config['MONGODB_SETTINGS'] = {'DB': "CareerLog"}
app.config["SECRET_KEY"] = ... | {
"content_hash": "1979d00fcbd21c99c4bb84855e2c645d",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 73,
"avg_line_length": 29,
"alnum_prop": 0.7036637931034483,
"repo_name": "celttechie/CareerLog",
"id": "319af33e0826157091aa0ce84471050ae1ed8e3c",
"size": "928",
"binary... |
from django.contrib import admin
from guildapp.models import Application
admin.site.register(Application)
| {
"content_hash": "b27a53d3e4dcdb86be5d747d093a36ec",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 39,
"avg_line_length": 26.75,
"alnum_prop": 0.8504672897196262,
"repo_name": "wjford5/guild-website",
"id": "ea59b4e7b71074122be58fc1cceeb18767a88c96",
"size": "107",
"bin... |
"""Test configs for control_dep."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow.compat.v1 as tf
from tensorflow.lite.testing.zip_test_utils import create_tensor_data
from tensorflow.lite.testing.zip_test_utils import make_zip_of_tests
f... | {
"content_hash": "39cf6932f88619d3e113256c14940080",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 78,
"avg_line_length": 35.97674418604651,
"alnum_prop": 0.6580478345184227,
"repo_name": "frreiss/tensorflow-fred",
"id": "c2f28fc1f4259add5f3e7e9db9e6bc035abbcee1",
"size"... |
import _plotly_utils.basevalidators
class ConnectgapsValidator(_plotly_utils.basevalidators.BooleanValidator):
def __init__(
self, plotly_name="connectgaps", parent_name="scatterternary", **kwargs
):
super(ConnectgapsValidator, self).__init__(
plotly_name=plotly_name,
p... | {
"content_hash": "58c4b97832efdd77cb16e71404580518",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 79,
"avg_line_length": 33.15384615384615,
"alnum_prop": 0.6194895591647331,
"repo_name": "plotly/plotly.py",
"id": "ba7f921065c93803c26b66ffc3c430338ec9cbe1",
"size": "431"... |
"""Config flow to configure the Uptime integration."""
from __future__ import annotations
from typing import Any
import voluptuous as vol
from homeassistant.config_entries import ConfigFlow
from homeassistant.const import CONF_NAME
from homeassistant.data_entry_flow import FlowResult
from .const import DEFAULT_NAME... | {
"content_hash": "80e93284f7f9d4fb4208ff98e58205aa",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 80,
"avg_line_length": 31.2972972972973,
"alnum_prop": 0.6623488773747841,
"repo_name": "mezz64/home-assistant",
"id": "6ff36ee34b1056a373a3574c34b28903eb67d764",
"size": "... |
import types
from matplotlib._pylab_helpers import Gcf
from matplotlib.figure import Figure
from matplotlib.backend_bases import (
FigureCanvasBase, FigureManagerBase, GraphicsContextBase, RendererBase)
from . import imgcat
assert isinstance(imgcat, types.FunctionType)
class FigureManagerImgcat(FigureManagerBa... | {
"content_hash": "da75227080d89cb8d724c2634b437708",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 77,
"avg_line_length": 27.238095238095237,
"alnum_prop": 0.7377622377622378,
"repo_name": "wookayin/python-imgcat",
"id": "c29bb4243f48a6b16cc9fcc69bd1b34f54c6e801",
"size"... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.