text stringlengths 4 1.02M | meta dict |
|---|---|
"""OAuth 2.0 Authorization Flow
This module provides integration with `requests-oauthlib`_ for running the
`OAuth 2.0 Authorization Flow`_ and acquiring user credentials. See
`Using OAuth 2.0 to Access Google APIs`_ for an overview of OAuth 2.0
authorization scenarios Google APIs support.
Here's an example of using ... | {
"content_hash": "8cb4271e1fd1ee378f551b8a8cdf07d2",
"timestamp": "",
"source": "github",
"line_count": 555,
"max_line_length": 120,
"avg_line_length": 39.00720720720721,
"alnum_prop": 0.6355489860963555,
"repo_name": "googleapis/google-auth-library-python-oauthlib",
"id": "17b24e72735554d332000efec6... |
from django.conf import settings
try:
from django.urls import reverse
except ImportError:
from django.core.urlresolvers import reverse
from django.http import HttpResponseRedirect, HttpResponseForbidden, Http404
from django.shortcuts import render
from django.template import RequestContext
from django import fo... | {
"content_hash": "95b1b3c382900d001b60057e41536e32",
"timestamp": "",
"source": "github",
"line_count": 70,
"max_line_length": 77,
"avg_line_length": 35.94285714285714,
"alnum_prop": 0.6728934817170111,
"repo_name": "erikcw/django-masquerade",
"id": "c067caa6ccf3cd812ee16b49f92368c772be2785",
"size... |
from __future__ import unicode_literals
import logging
from cms.plugin_pool import plugin_pool
from django.conf import settings
from django.utils.translation import ugettext_lazy as _
from cms.plugin_base import CMSPluginBase
from layouter.forms import ContainerPluginForm
from layouter.models import ContainerPlugin
... | {
"content_hash": "f64892417e2ca7b5cd26b8ebbd252ec7",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 116,
"avg_line_length": 31.346938775510203,
"alnum_prop": 0.6510416666666666,
"repo_name": "Blueshoe/djangocms-layouter",
"id": "d47798bc65254c2b1d20f9fe50396505e5dc7054",
... |
"""
Bi-LSTM network for span-based constituency parsing.
"""
from __future__ import print_function
from __future__ import division
import time
import random
import sys
import dynet
import numpy as np
from phrase_tree import PhraseTree, FScore
from features import FeatureMapper
from parser import Parser
class LSTM(... | {
"content_hash": "7cd03b3bd08c731c3606491ff6a50293",
"timestamp": "",
"source": "github",
"line_count": 551,
"max_line_length": 90,
"avg_line_length": 31.707803992740473,
"alnum_prop": 0.5155972754850896,
"repo_name": "jhcross/span-parser",
"id": "cbb649c18bfe8722cc347b144aeb61b59e998c0d",
"size": ... |
"""Config for MNIST classifier.
"""
# pylint:disable=invalid-name
from magenta.models.latent_transfer import nn
from magenta.models.latent_transfer.configs import mnist_0_nlatent64
config = mnist_0_nlatent64.config
Classifier = nn.DFull
config['batch_size'] = 256
config['Classifier'] = Classifier
| {
"content_hash": "da364b5521cc887ccc5f03df770ea832",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 68,
"avg_line_length": 21.642857142857142,
"alnum_prop": 0.7722772277227723,
"repo_name": "magenta/magenta",
"id": "14cbca787a1b382c2499603f52b31436a735caa1",
"size": "888"... |
import os
test = {
"deployment_code": os.path.join(os.path.dirname(os.path.abspath(__file__)), "deploy_zookeepers.py"),
"test_code": [
os.path.join(os.path.dirname(os.path.abspath(__file__)), "test_suites/zookeeper_cluster_tests.py"),
os.path.join(os.path.dirname(os.path.abspath(__file__)), "test_suite... | {
"content_hash": "3d46a7349e5f624054ac43fbdfec6289",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 113,
"avg_line_length": 56.6,
"alnum_prop": 0.6837455830388692,
"repo_name": "pubnub/Zopkio",
"id": "188eba579554e9e9636fda2f199aafa6b3427515",
"size": "1386",
"binary": ... |
import sys
import os
import errno
import unittest
from array import array
from weakref import proxy
from functools import wraps
from test.support import (TESTFN, findfile, check_warnings, run_unittest,
make_bad_fd)
from collections import UserList
from _io import FileIO as _FileIO
class Aut... | {
"content_hash": "48ac6a685f9ea34b8d6235557c83b3e5",
"timestamp": "",
"source": "github",
"line_count": 388,
"max_line_length": 79,
"avg_line_length": 30.79123711340206,
"alnum_prop": 0.5223068552774756,
"repo_name": "MalloyPower/parsing-python",
"id": "657401e8edd08617f65a54d664dd165606db6631",
"s... |
"""Shannan entropy calculation. For more info see https://rdrr.io/cran/lidR/man/entropy.html"""
import numpy as np
from laserchicken import keys
from laserchicken.feature_extractor.base_feature_extractor import FeatureExtractor
class EntropyFeatureExtractor(FeatureExtractor):
layer_thickness = 0.5
min_val = ... | {
"content_hash": "4ad3880c92a4806a8e543cd14cda1fb6",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 98,
"avg_line_length": 35.53333333333333,
"alnum_prop": 0.649155722326454,
"repo_name": "eEcoLiDAR/eEcoLiDAR",
"id": "a986f0a701d6693f8306643c2ceff0270219c4a7",
"size": "15... |
import datetime
from typing import Any, AsyncIterator, Callable, Dict, Optional, TypeVar, Union
from azure.core.exceptions import (
ClientAuthenticationError,
HttpResponseError,
ResourceExistsError,
ResourceNotFoundError,
map_error,
)
from azure.core.pipeline import PipelineResponse
from azure.core... | {
"content_hash": "69c4c2f3d50dfe14cc8bac4e162c0d31",
"timestamp": "",
"source": "github",
"line_count": 3141,
"max_line_length": 139,
"avg_line_length": 54.87042343202802,
"alnum_prop": 0.6471325457794694,
"repo_name": "Azure/azure-sdk-for-python",
"id": "a88eea7d76e36de31e4dd0f4b826fcde05b3121b",
... |
import operator
from pyspark import since, keyword_only
from pyspark.ml import Estimator, Model
from pyspark.ml.param.shared import *
from pyspark.ml.regression import DecisionTreeModel, DecisionTreeRegressionModel, \
RandomForestParams, TreeEnsembleModel, TreeEnsembleParams
from pyspark.ml.util import *
from pysp... | {
"content_hash": "6235f2a437863482690c23fd775a14d6",
"timestamp": "",
"source": "github",
"line_count": 1653,
"max_line_length": 100,
"avg_line_length": 38.544464609800364,
"alnum_prop": 0.61680321436419,
"repo_name": "spark0001/spark2.1.1",
"id": "2b47c402674ad718624145e6807a20e8de77b684",
"size":... |
"""This file contains tests for the groups application.
These tests will verify generation of a new group and license object.
"""
from django.test import TestCase
from django.test.client import Client
from mousedb.groups.models import Group, License
MODELS = [Group, License]
class GroupsModelTests(TestCase):
... | {
"content_hash": "3acedef7d2d7655473116ade6a94be3e",
"timestamp": "",
"source": "github",
"line_count": 71,
"max_line_length": 108,
"avg_line_length": 41.61971830985915,
"alnum_prop": 0.6331641285956007,
"repo_name": "davebridges/mousedb",
"id": "862ed8982abbc2521d67839d379f6d2dbac4f702",
"size": "... |
"""
Purpose:
This script will generate a list of discovered nodes and identifiers
using the RackHD API calls.
"""
#pylint: disable=relative-import
import os
import sys
import subprocess
import json
import pprint
from nosedep import depends
# set path to common libraries
sys.path.append(subprocess.check_output(... | {
"content_hash": "a96c416e3edd2923aefbb1c007840a0a",
"timestamp": "",
"source": "github",
"line_count": 133,
"max_line_length": 115,
"avg_line_length": 44.8421052631579,
"alnum_prop": 0.46965124077800136,
"repo_name": "tldavies/RackHD",
"id": "9acc496ea7b08387505ae8639a4d3a39e38eb36f",
"size": "599... |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('events', '0005_auto_20160517_0003'),
]
operations = [
migrations.AlterField(
model_name='event',
name='description',
... | {
"content_hash": "8cc268684d27259881709c953cd10a35",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 52,
"avg_line_length": 21.27777777777778,
"alnum_prop": 0.5953002610966057,
"repo_name": "StephenOrJames/UBinE",
"id": "90653e01a360df62e8e8be4803936a92be5de54f",
"size": "... |
'''
File name: cnn_simple.py
Author: chimney37
Date created: 12/09/2017
Python Version: 3.62
'''
import tflearn
from tflearn.layers.conv import conv_2d, max_pool_2d
from tflearn.layers.core import input_data, dropout, fully_connected
from tflearn.layers.estimator import regression
import tflearn.dataset... | {
"content_hash": "2e51589c8a0362c976421267ec1509bd",
"timestamp": "",
"source": "github",
"line_count": 145,
"max_line_length": 160,
"avg_line_length": 45.84827586206897,
"alnum_prop": 0.7296931407942239,
"repo_name": "chimney37/ml-snippets",
"id": "2aab13d6f7f0e63145afcf9a6b89d8694fac6e4c",
"size"... |
class DummyThunderSocketHandler(object):
dummyid = 1
def __init__(self, *args, **kwargs):
self.userid = 'dummy_%d' % DummyThunderSocketHandler.dummyid
self.connected = True
DummyThunderSocketHandler.dummyid += 1
def send(self, message):
pass
def broadcast(self, users,... | {
"content_hash": "e3557062b474bcc8de02e50535c36159",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 68,
"avg_line_length": 24,
"alnum_prop": 0.6299019607843137,
"repo_name": "thunderpush/thunderpush",
"id": "d4dbb7bce3525b936f1e7f4c9ee29d43f4b2e393",
"size": "408",
"bin... |
'''Select alignments with >= a given coverage.'''
import sys
MIN_COV = 0.6
fails = 0
try:
MIN_COV = float(sys.argv[2])
except IndexError:
pass
for n, line in enumerate(open(sys.argv[1]), start=1):
cols = line.strip().split()
qSize = int(cols[10])
qStart = int(cols[11])
qEnd = int(cols[12])
... | {
"content_hash": "494785ff66b78392b7f5205e82f270a1",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 77,
"avg_line_length": 23.25,
"alnum_prop": 0.5770609318996416,
"repo_name": "likit/BioUtils",
"id": "9cafc4065e6b7e51545fbf4c5a24cfbcc415cb8d",
"size": "558",
"binary": ... |
from pycerberus import InvalidDataError
from pycerberus.errors import InvalidArgumentsError
from pycerberus.test_util import ValidationTest
from pycerberus.validators import IntegerValidator
class IntegerValidatorTest(ValidationTest):
validator_class = IntegerValidator
def test_can_convert_string_to... | {
"content_hash": "12095410397880fed85f9ce52f2d3e6d",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 98,
"avg_line_length": 43.3448275862069,
"alnum_prop": 0.6793953858392999,
"repo_name": "r-kitaev/lucid-python-cerberus",
"id": "da57769c0f134e7a55ba5c8ccb391bdc04c0ad57",
... |
from core import perf_benchmark
from core import platforms
import page_sets
from telemetry import story
from telemetry import benchmark
from telemetry.timeline import chrome_trace_category_filter
from telemetry.web_perf import timeline_based_measurement
@benchmark.Info(emails=['mythria@chromium.org','ulan@chromium.... | {
"content_hash": "20972bc4dc1584d9d36290f0afa03ae0",
"timestamp": "",
"source": "github",
"line_count": 54,
"max_line_length": 75,
"avg_line_length": 35.25925925925926,
"alnum_prop": 0.7657563025210085,
"repo_name": "endlessm/chromium-browser",
"id": "637e4f362ec3d94bb3380b0f04260437791262c3",
"siz... |
import fos.core.scene as scene
import fos.core.plots as plots
#world=scene.SceneStuff(plot=plots.PlotStuff())
world = scene.Scene(plot=plots.Plot())
world.run()
| {
"content_hash": "ce7109a465010d1a5b39d87da75a83af",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 47,
"avg_line_length": 20.5,
"alnum_prop": 0.7560975609756098,
"repo_name": "fos/fos-legacy",
"id": "5dc9c2b9e20b235c1d305412539f49d6d043a14d",
"size": "164",
"binary": fa... |
"""Module that groups code required to handle state restore for component."""
from __future__ import annotations
from typing import Any, Iterable
from homeassistant.core import Context, HomeAssistant, State
from homeassistant.helpers.state import async_reproduce_state
from . import get_entity_ids
async def async_r... | {
"content_hash": "3e653f9e71168dcc3e7d665ea432e348",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 79,
"avg_line_length": 31.194444444444443,
"alnum_prop": 0.6046304541406946,
"repo_name": "adrienbrault/home-assistant",
"id": "ea21c147b9b7ff04e58c1942049d4f4a871753b0",
"... |
import unittest
from alphatwirl.loop import NullCollector
##__________________________________________________________________||
class TestCollector(unittest.TestCase):
def test_collect(self):
obj = NullCollector()
repr(obj)
self.assertIsNone(obj.collect([]))
##__________________________... | {
"content_hash": "a5a98fff4dc4e9498f64f2a0035ed4ad",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 70,
"avg_line_length": 27.923076923076923,
"alnum_prop": 0.418732782369146,
"repo_name": "TaiSakuma/AlphaTwirl",
"id": "330f0f366646df1a3adf02ebd59b81f2b5425f31",
"size": "... |
import numpy as np
import bayesopt as bo
## @addtogroup BayesOptPython
# Python Module for BayesOpt.
#
# Check test.py and test2.py with examples about how to run this code.
# Those files also provides examples about how to run the optimization
# using a callback pattern. (see bayesopt.pyx)
## Python Module for Bayes... | {
"content_hash": "3b652746b9edab99ef4dee6f12940d11",
"timestamp": "",
"source": "github",
"line_count": 157,
"max_line_length": 76,
"avg_line_length": 29.898089171974522,
"alnum_prop": 0.6001278227524499,
"repo_name": "pchrapka/brain-modelling",
"id": "7734be4114ab922362be1d01060fcf0c40df82b1",
"si... |
from itertools import islice
from math import exp
from math import log
import random
import unittest
from rasmus import stats
from rasmus import util
from rasmus.gnuplot import Gnuplot
from rasmus.testing import make_clean_dir
from rasmus import hmm
#=================================================================... | {
"content_hash": "3836ae4fbe6024556bc55ebe70f76476",
"timestamp": "",
"source": "github",
"line_count": 143,
"max_line_length": 79,
"avg_line_length": 30.447552447552447,
"alnum_prop": 0.539503904455673,
"repo_name": "abhishekgahlot/compbio",
"id": "fa343d7dfa3c2a29316df2feba05743da2f1f1a7",
"size"... |
import numpy as np
import scipy.io
def get_value_array(res,key):
"""
Creates and array of result keys with the same name but differtent indices
Parameters
----------
res : dict
results dictionary
key : string
variable name
Returns
-------
val : num... | {
"content_hash": "fc712a03ed2eb82a3d7ab015995b72df",
"timestamp": "",
"source": "github",
"line_count": 154,
"max_line_length": 101,
"avg_line_length": 24.564935064935064,
"alnum_prop": 0.5096484271742003,
"repo_name": "BrechtBa/dympy",
"id": "e6138b70725ed75a00774c22c575aec10df60047",
"size": "466... |
from __future__ import unicode_literals
from collections import OrderedDict
from itertools import count, groupby
from mptt.models import MPTTModel, TreeForeignKey
from django.conf import settings
from django.contrib.auth.models import User
from django.contrib.contenttypes.models import ContentType
from django.contrib... | {
"content_hash": "0bba3a486b2862b53ab747a7299b6d92",
"timestamp": "",
"source": "github",
"line_count": 1343,
"max_line_length": 124,
"avg_line_length": 38.65822784810127,
"alnum_prop": 0.6218459879040025,
"repo_name": "snazy2000/netbox",
"id": "3719c7c2509cadc9ddb531a8a775c9355a8344dc",
"size": "5... |
from __future__ import absolute_import
import logging
import sys
from .hub import Hub
from .client import Client
from .core.backend import \
activate_greenhouse, activate_gevent, activate_eventlet
from .futures import Future, after, wait_any, wait_all
VERSION = (2, 0, 0, "")
__version__ = ".".join(filter(No... | {
"content_hash": "dca3809105e80a62fa83465b346d6c74",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 68,
"avg_line_length": 28.903225806451612,
"alnum_prop": 0.6707589285714286,
"repo_name": "teepark/junction",
"id": "5d20f0ebd282d2e891f584095f44dccbeff3b3c7",
"size": "896... |
"""This module contains Azure Data Explorer operators"""
from typing import Optional, Union
from azure.kusto.data._models import KustoResultTable
from airflow.configuration import conf
from airflow.models import BaseOperator
from airflow.providers.microsoft.azure.hooks.adx import AzureDataExplorerHook
class AzureDa... | {
"content_hash": "1319e31665f16a1f9cb6118a3583c256",
"timestamp": "",
"source": "github",
"line_count": 61,
"max_line_length": 111,
"avg_line_length": 36.40983606557377,
"alnum_prop": 0.6645655110310671,
"repo_name": "apache/incubator-airflow",
"id": "23af6effd0a5f1e38485e9c57c458b5a9ee0d709",
"siz... |
import os
from setuptools import setup
setup(
name="webdriver_components",
version="1.0.0",
author="Andrew Magee",
author_email="amagee@gmail.com",
description="Webdriver_components",
license='Apache License, Version 2.0',
keywords="selenium webdriver testing page objects components",
u... | {
"content_hash": "094a116adc9d04d4106a68569b2bbf26",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 69,
"avg_line_length": 30.13888888888889,
"alnum_prop": 0.6064516129032258,
"repo_name": "amagee/webdriver-components",
"id": "362c8c469bd079d174cb50af394cbb84b1ece414",
"s... |
import os, sys, subprocess
from tinydb import TinyDB, where
from recipyCommon.tinydb_utils import serializer
def get_record_from_db(id, dbfile):
db = TinyDB(dbfile, storage=serializer)
res = db.search(where('unique_id') == id)
return res
def run_script_and_get_id(script):
output = subprocess.check_o... | {
"content_hash": "219e8ea1de98a09d109b141fa412ee37",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 122,
"avg_line_length": 31.4375,
"alnum_prop": 0.6918489065606361,
"repo_name": "recipy/recipy",
"id": "3d7bd1927053c6d03cf52f6f370c1967b5062c6f",
"size": "503",
"binary"... |
import sys
sys.path.append("pyswarming/client")
import isolate
import isolate_format
import json
from code import interact
def parse_archive_command_line(args):
opts = isolate.parse_archive_command_line(args[1:], args[0])
d = eval(str(opts))
# interact(local=locals())
return d
def isolate_format_eva... | {
"content_hash": "e81eb4a0f049f5ff95134e0d28cbb816",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 64,
"avg_line_length": 22.342105263157894,
"alnum_prop": 0.6113074204946997,
"repo_name": "pombreda/isolatego",
"id": "e022d276e7bc529083bc5b3b19fe9a15dc048c14",
"size": "8... |
"""
email_reply_parser is a python library port of GitHub's Email Reply Parser.
For more information, visit https://github.com/zapier/email-reply-parser
"""
import re
class EmailReplyParser(object):
""" Represents a email message that is parsed.
"""
@staticmethod
def read(text):
"""... | {
"content_hash": "5b0f968d8e1d02328402c7d864b20167",
"timestamp": "",
"source": "github",
"line_count": 172,
"max_line_length": 118,
"avg_line_length": 32.08720930232558,
"alnum_prop": 0.5714803406414205,
"repo_name": "zapier/email-reply-parser",
"id": "063f65b53716d7cb3fa20540a05a0402904331e9",
"s... |
import random
import sys
import glob
import numpy as np
from keras import backend as K
from keras.models import load_model
from keras.applications.vgg16 import VGG16
from keras import optimizers
import tensorflow as tf
import data_handling as dh
import deep_models as dm
random.seed(111)
def data_generator(file_... | {
"content_hash": "e07921b425b539bb49cbea46a0c431ff",
"timestamp": "",
"source": "github",
"line_count": 234,
"max_line_length": 80,
"avg_line_length": 28.11965811965812,
"alnum_prop": 0.5376899696048633,
"repo_name": "diwadd/PathImageSegmentation",
"id": "54ba787e17929fc6556bfb7c5fb5507a2faeb89d",
... |
import re
import ast
match_ws = re.compile('^[ \t]+')
def get_ws_len(line):
match = match_ws.search(line)
if match:
return len(match.group(0))
else:
return 0
def renumerate(seq):
i = len(seq) - 1
for r in reversed(seq):
yield i, r
i -= 1
def sanitize_encoding(sourc... | {
"content_hash": "81f2f1e250ccc2d948d3b3119eef5932",
"timestamp": "",
"source": "github",
"line_count": 154,
"max_line_length": 107,
"avg_line_length": 31.98701298701299,
"alnum_prop": 0.562322371092164,
"repo_name": "baverman/supplement",
"id": "fa3e22a3e2ecd64176bbc76874d2ed91bded564e",
"size": "... |
import csv
with open("/tmp/QueryPipelineStatistics.csv") as f:
reader = csv.reader(f)
header = next(reader)
assert header == ['query',
'rows',
'matches',
'quadwords',
'cachelines',
'parse',
... | {
"content_hash": "ddbdef0f34b8f95c9d5881782ad489be",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 51,
"avg_line_length": 26.958333333333332,
"alnum_prop": 0.43431221020092736,
"repo_name": "BitFunnel/BitFunnel",
"id": "fbe2e9ecea75ea671f1b1e770cf25f98f55db36e",
"size": ... |
import re
from bookdb import BookDB
DB = BookDB()
def resolve_path(path):
urls = [(r'^$', books),
(r'^book/(id[\d]+)$', book)]
matchpath = path.lstrip('/')
for regexp, func in urls:
match = re.match(regexp, matchpath)
if match is None:
continue
args = match... | {
"content_hash": "f4a35df4a85b7161ab38114a0c1e1a70",
"timestamp": "",
"source": "github",
"line_count": 72,
"max_line_length": 63,
"avg_line_length": 25.569444444444443,
"alnum_prop": 0.5643671917436176,
"repo_name": "bm5w/fabrictests",
"id": "3c17c8f327d420b262f47d1af64e0bb6a984beac",
"size": "184... |
"""
Utilities for using the CUBAM model (python package ``cubam``), as described
in the paper
.. pull-quote::
Welinder P., Branson S., Belongie S., Perona, P. "The Multidimensional
Wisdom of Crowds." Conference on Neural Information Processing Systems
(NIPS) 2010.
"""
# This allows us to ``import cubam``... | {
"content_hash": "9ed660882737b2f0caae19dadaa8be62",
"timestamp": "",
"source": "github",
"line_count": 414,
"max_line_length": 112,
"avg_line_length": 37.28743961352657,
"alnum_prop": 0.6012178532098206,
"repo_name": "seanbell/opensurfaces",
"id": "55dabd0b3cfca52d5a273f63f38d18fafad1d797",
"size"... |
"""
A decoder that uses stacks to implement phrase-based translation.
In phrase-based translation, the source sentence is segmented into
phrases of one or more words, and translations for those phrases are
used to build the target sentence.
Hypothesis data structures are used to keep track of the source words
transla... | {
"content_hash": "124d86609ef41c4250762334ef598424",
"timestamp": "",
"source": "github",
"line_count": 508,
"max_line_length": 180,
"avg_line_length": 38.976377952755904,
"alnum_prop": 0.6107070707070708,
"repo_name": "nltk/nltk",
"id": "b0b022301bfff967a5fdab433aa82173e5011e39",
"size": "20001",
... |
"""WidgetInstnace serializer"""
from rest_framework import serializers
from open_discussions.serializers import WriteableSerializerMethodField
from widgets.models import WidgetInstance
from widgets.serializers.utils import get_widget_type_names
def _raise_not_implemented(*args, **kwargs): # pylint: disable=unused-a... | {
"content_hash": "0a28aad28a138136858a662809f8547f",
"timestamp": "",
"source": "github",
"line_count": 80,
"max_line_length": 82,
"avg_line_length": 35.075,
"alnum_prop": 0.6646471846044191,
"repo_name": "mitodl/open-discussions",
"id": "cff94fb6916d8ffe01ff14e69d32cf3e80eb553b",
"size": "2806",
... |
"""
test_magnum_services
--------------------
Functional tests for `shade` services method.
"""
from openstack.tests.functional import base
class TestMagnumServices(base.BaseFunctionalTest):
def setUp(self):
super(TestMagnumServices, self).setUp()
if not self.operator_cloud.has_service('contain... | {
"content_hash": "461676860a4d6650c8f2112d03feb552",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 69,
"avg_line_length": 30.821428571428573,
"alnum_prop": 0.657010428736964,
"repo_name": "dtroyer/python-openstacksdk",
"id": "f3ffd9e82909a03088813dee960b7b4ac32f0ba7",
"s... |
import ast
from .context import ContextScope
from .parser import Parser
from .utils import Helpers
def kompile(src, raw=False, filename='<compiler>', loader=None, **kwargs):
'''
Creates a new class based on the supplied template, and returnsit.
class Template(object):
def __call__(self, context)... | {
"content_hash": "3bcb69ec04b03180943e495ab5293fb2",
"timestamp": "",
"source": "github",
"line_count": 66,
"max_line_length": 78,
"avg_line_length": 24.666666666666668,
"alnum_prop": 0.6074938574938575,
"repo_name": "funkybob/knights-templater",
"id": "af573a61fbec9bdd088044288f8a6781b53349ac",
"s... |
"""Handles all requests to the conductor service."""
from oslo.config import cfg
from nova.conductor import manager
from nova.conductor import rpcapi
from nova import exception as exc
from nova.openstack.common import log as logging
from nova.openstack.common.rpc import common as rpc_common
from nova import utils
co... | {
"content_hash": "06d7df9f09793d7bd2b353eb06c258f0",
"timestamp": "",
"source": "github",
"line_count": 677,
"max_line_length": 79,
"avg_line_length": 48.44756277695716,
"alnum_prop": 0.564529406384341,
"repo_name": "zestrada/nova-cs498cc",
"id": "c7e824df48488d7d3d8a660de597d962b1f30886",
"size": ... |
"""A client to the Gene Ontology."""
import re
import logging
from typing import Union
from indra.databases.obo_client import OboClient
logger = logging.getLogger(__name__)
_client = OboClient(prefix='go')
def get_go_label(go_id):
"""Get label corresponding to a given GO identifier.
Parameters
--------... | {
"content_hash": "428c3b1587998ab72169f9a65ad87193",
"timestamp": "",
"source": "github",
"line_count": 136,
"max_line_length": 78,
"avg_line_length": 25.75735294117647,
"alnum_prop": 0.6091921210391094,
"repo_name": "sorgerlab/indra",
"id": "4e1782b36a250dac7167d0296a4b26f8c0a7abf8",
"size": "3503... |
c = get_config()
c.Execute.execute_retries = 4
| {
"content_hash": "df67ba911bd59f05759273ae90b53b80",
"timestamp": "",
"source": "github",
"line_count": 2,
"max_line_length": 29,
"avg_line_length": 23.5,
"alnum_prop": 0.7021276595744681,
"repo_name": "jhamrick/nbgrader",
"id": "5eb35c35120ee395c4c8cd3ff74d2b9c717e7b40",
"size": "47",
"binary": ... |
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
from django.conf.urls import patterns, include, url, static
from django.conf import settings
from django.contrib import admin
admin.autodiscover()
urlpatterns = []
if settings.DEBUG:
urlpatterns += staticfiles_urlpatterns()
urlpatterns += patter... | {
"content_hash": "ee965a293535c294d0fe062f40c79653",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 67,
"avg_line_length": 26.285714285714285,
"alnum_prop": 0.6938405797101449,
"repo_name": "jonge-democraten/project-req",
"id": "dd75edeb9d4da695ca2356f13aefcbb5ba2d4158",
... |
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
('momentum', '0007_auto_20150315_1331'),
]
operations = [
migrations.AlterField(
model_name='goal',
... | {
"content_hash": "f686aac58a61fb427653e84bb8751f7f",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 155,
"avg_line_length": 32,
"alnum_prop": 0.5674715909090909,
"repo_name": "mod2/momentum",
"id": "beffcba48d38acecc384ba58b649cd843f72e67d",
"size": "1432",
"binary": fa... |
from kivy.app import App
from kivy.uix.relativelayout import RelativeLayout
class DrawingSpace(RelativeLayout):
pass
class DrawingApp(App):
def build(self):
return DrawingSpace()
if __name__ == '__main__':
DrawingApp().run()
| {
"content_hash": "6063bde9fff67056c9bd0e7727e27d19",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 50,
"avg_line_length": 10.23076923076923,
"alnum_prop": 0.6428571428571429,
"repo_name": "pimier15/PyGUI",
"id": "84fddf7fc62837fd8752d3058533b8cd73b7369b",
"size": "266",
... |
from app import App
from config import create_config
config = create_config()
app = App(config)
| {
"content_hash": "d423057818f3ccc9aaa2873484b5d609",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 32,
"avg_line_length": 12.5,
"alnum_prop": 0.74,
"repo_name": "shuhari/yuhao.space",
"id": "be25df11629041bfd8b95768c46b6616a34128d1",
"size": "122",
"binary": false,
"c... |
from DistributedMinigameAI import *
from toontown.ai.ToonBarrier import *
from direct.fsm import ClassicFSM, State
from direct.fsm import State
import CatchGameGlobals
import MinigameGlobals
class DistributedCatchGameAI(DistributedMinigameAI):
def __init__(self, air, minigameId):
try:
self.Dis... | {
"content_hash": "67e7e831c235eac12b5daff1b7b38ef7",
"timestamp": "",
"source": "github",
"line_count": 121,
"max_line_length": 314,
"avg_line_length": 41.28099173553719,
"alnum_prop": 0.6506506506506506,
"repo_name": "silly-wacky-3-town-toon/SOURCE-COD",
"id": "51bcf28bc31b322d6ce03160f530d723ea97fd... |
"""
Provide a common way to import Qt classes used by pytest-qt in a unique manner,
abstracting API differences between PyQt5/6 and PySide2/6.
.. note:: This module is not part of pytest-qt public API, hence its interface
may change between releases and users should not rely on it.
Based on from https://github.com/ep... | {
"content_hash": "747232c78da413820bb739b273e330d2",
"timestamp": "",
"source": "github",
"line_count": 200,
"max_line_length": 98,
"avg_line_length": 32.29,
"alnum_prop": 0.5675131619696501,
"repo_name": "pytest-dev/pytest-qt",
"id": "e0c3a3504903b14cebbc605a9a3f7b7f18e1f6f0",
"size": "6458",
"b... |
import logging
from string import Template
from neutron_lib.api.definitions import portbindings
from neutron_lib.callbacks import events
from neutron_lib.callbacks import registry
from neutron_lib.callbacks import resources
from neutron_lib import constants as nl_const
from neutron_lib import context
from neutron_lib.... | {
"content_hash": "d01361c925e5111d2d5c28b838d97eb8",
"timestamp": "",
"source": "github",
"line_count": 446,
"max_line_length": 79,
"avg_line_length": 41.04932735426009,
"alnum_prop": 0.6051452916757701,
"repo_name": "openstack/networking-odl",
"id": "95f60734727cad411a0ae6432138af8f1645f7ec",
"siz... |
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "text_analysis.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| {
"content_hash": "33780a078ce8d63cf0e2f13395a59612",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 77,
"avg_line_length": 26,
"alnum_prop": 0.7136752136752137,
"repo_name": "bungoume/mecab-web-api",
"id": "9931f959cd2657bfe27bcc3b01f345c24a991f36",
"size": "256",
"binar... |
from datetime import timedelta
import pytest
from couchbase.exceptions import (CollectionAlreadyExistsException,
CollectionNotFoundException,
DocumentNotFoundException,
ScopeAlreadyExistsException,
... | {
"content_hash": "d3ef80397061b3b9419dc187c89b4b1e",
"timestamp": "",
"source": "github",
"line_count": 175,
"max_line_length": 99,
"avg_line_length": 51.16571428571429,
"alnum_prop": 0.6308912218003128,
"repo_name": "couchbase/couchbase-python-client",
"id": "8bac1100ae74c5f857ec792f9e747d9347438ecf... |
"""Code for backpropagation using the tape utilities."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import functools
import operator
import threading
import six
from tensorflow.python import pywrap_tensorflow
from tensorflow.python.eager import conte... | {
"content_hash": "dc65ea3881315c40dcc46553cab8c40f",
"timestamp": "",
"source": "github",
"line_count": 654,
"max_line_length": 110,
"avg_line_length": 31.13914373088685,
"alnum_prop": 0.6661919960716917,
"repo_name": "ryfeus/lambda-packs",
"id": "3c84cbbd6fae4834e187bce170ec8c501c7fab55",
"size": ... |
import os
import sys
import time
from oslo_log import log as logging
from oslo_service import service
from oslo_utils import strutils
from muranoagent.common import config
from muranoagent.common import messaging
from muranoagent import execution_plan_queue
from muranoagent import execution_plan_runner
from muranoage... | {
"content_hash": "bef0013a3d7cac4a462b21e0f09c1565",
"timestamp": "",
"source": "github",
"line_count": 155,
"max_line_length": 75,
"avg_line_length": 35.516129032258064,
"alnum_prop": 0.516802906448683,
"repo_name": "openstack/murano-agent",
"id": "e20c6a04b5fa30b31e14375783cd175ac1473c20",
"size"... |
import json
from django.test import TestCase
from . import models
def dump_dict(d):
"""
Returns a JSON string sorted by keys
"""
return json.dumps(d, sort_keys=True)
class FieldsTestCase(TestCase):
def test_auto_one_to_one(self):
super_villain = models.SuperVillain.objects.create()
... | {
"content_hash": "7b7d7b63e5122c754c36f4ccbcb77508",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 76,
"avg_line_length": 30.25531914893617,
"alnum_prop": 0.6329113924050633,
"repo_name": "rocity/dj-instagram",
"id": "bb94a30d78b6c23436a0fce111f75c8338fa7f86",
"size": "1... |
"""
aminator.plugins.cloud.base
===========================
Base class(es) for cloud plugins
"""
import abc
import logging
from aminator.plugins.base import BasePlugin
__all__ = ('BaseCloudPlugin',)
log = logging.getLogger(__name__)
class BaseCloudPlugin(BasePlugin):
"""
Cloud plugins are context managers ... | {
"content_hash": "6afc8c1a662451a6cf30dbc66ea47218",
"timestamp": "",
"source": "github",
"line_count": 81,
"max_line_length": 113,
"avg_line_length": 29.074074074074073,
"alnum_prop": 0.6445859872611465,
"repo_name": "VaishnoReddy/Aminator-",
"id": "2a81c2e98987fb5115f76f69ab63fd1c4ebab62f",
"size... |
import math
# Sibling Imports
from . import data
# NumPy
import numpy as np
class _Counter (object):
def __init__ (self):
self.counts = {}
def inc (self, key):
if key not in self.counts:
self.counts[key] = 1
else:
self.counts[key] += 1
return self.counts[key]
def alias (self, name):
return nam... | {
"content_hash": "fb5f7e0e78c01c56329cf9817c3d4d52",
"timestamp": "",
"source": "github",
"line_count": 231,
"max_line_length": 78,
"avg_line_length": 25.25974025974026,
"alnum_prop": 0.6536418166238218,
"repo_name": "richardingham/octopus",
"id": "13b0d4f8d82fdbd4e32baca6b771076b5240f668",
"size":... |
from django.conf.urls import patterns
from django.conf.urls import url
from openstack_horizon.dashboards.admin.volumes.volume_types.extras \
import views
urlpatterns = patterns(
'',
url(r'^$', views.IndexView.as_view(), name='index'),
url(r'^create/$', views.CreateView.as_view(), name='create'),
u... | {
"content_hash": "eb17271c33ad28fce069824063b8a6d8",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 73,
"avg_line_length": 32.583333333333336,
"alnum_prop": 0.6675191815856778,
"repo_name": "mrunge/openstack_horizon",
"id": "c877bfc75fef5a00ced9343dbd01c909ea899c16",
"siz... |
from django.shortcuts import render
from django.shortcuts import render_to_response
from django.http import HttpResponse
from django.template.context import RequestContext
from django.contrib.auth.models import User
from .models import Task
def viewHome(request):
context = RequestContext(request)
context.upda... | {
"content_hash": "f66d70a46a10218ffb005abbdc49fd21",
"timestamp": "",
"source": "github",
"line_count": 51,
"max_line_length": 116,
"avg_line_length": 38.294117647058826,
"alnum_prop": 0.6185355862775218,
"repo_name": "aazhbd/task_planner",
"id": "2dcb6d806d22f0d52455dbdca3d331ae950a5980",
"size": ... |
from __future__ import unicode_literals
from django.conf import settings
if __name__ == '__main__':
# When running this file in isolation, we need to set up the configuration
# before importing 'template'.
settings.configure()
from datetime import date, datetime
import os
import sys
import traceback
impo... | {
"content_hash": "a6d1605091effff7f0e923fc314c9e61",
"timestamp": "",
"source": "github",
"line_count": 1974,
"max_line_length": 388,
"avg_line_length": 63.11904761904762,
"alnum_prop": 0.5143944075700057,
"repo_name": "zedr/django",
"id": "0cfaf9ec0956d977080d74fca36b15c8baab92bb",
"size": "124737... |
from __future__ import unicode_literals
from django.conf import settings
from django.db import models, migrations
# Can't use the callable because the app registry is not ready yet.
# Really trusting users here... bad idea? probably.
DJSTRIPE_UNSAFE_SUBSCRIBER_MODEL = getattr(settings, "DJSTRIPE_SUBSCRIBER_MODEL", se... | {
"content_hash": "382b067fb60e4efc49aaf545b77816b9",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 107,
"avg_line_length": 31.76,
"alnum_prop": 0.6863979848866498,
"repo_name": "jpadilla/dj-stripe",
"id": "73ef87af4c16186f9e90455bed35b9c2323eb61d",
"size": "818",
"bina... |
from zorg.adaptor import Adaptor
from zorg.driver import Driver
from multiprocessing import Queue
import speech_recognition
import subprocess
class SpeechRecognition(Adaptor):
def __init__(self, options):
super(SpeechRecognition, self).__init__(options)
self.recognizer = speech_recognition.Recog... | {
"content_hash": "b7851b26133e7d6c37fed4fd03228e11",
"timestamp": "",
"source": "github",
"line_count": 121,
"max_line_length": 78,
"avg_line_length": 28.99173553719008,
"alnum_prop": 0.6299885974914481,
"repo_name": "gunthercox/salvius",
"id": "40a1ea02f9241586d781661772dda268198ad0e1",
"size": "3... |
"""
This script converts a subset of SVG into an HTML imagemap
Note *subset*. It only handles <path> elements, for which it only pays
attention to the M and L commands. Futher, it only notices the "translate"
transform.
It was written to generate the examples in the documentation for maphilight,
and thus is very sq... | {
"content_hash": "02734b342fd6553ee4c3f1e8bec2010d",
"timestamp": "",
"source": "github",
"line_count": 89,
"max_line_length": 118,
"avg_line_length": 37.258426966292134,
"alnum_prop": 0.6432448733413751,
"repo_name": "DailyActie/Surrogate-Model",
"id": "50e2f83d02fa910479d9070455f264b915ee7f00",
"... |
"""
Spherical Voronoi Code
.. versionadded:: 0.18.0
"""
#
# Copyright (C) Tyler Reddy, Ross Hemsley, Edd Edmondson,
# Nikolai Nowaczyk, Joe Pitt-Francis, 2015.
#
# Distributed under the same BSD license as Scipy.
#
import numpy as np
import numpy.matlib
import scipy
import itertools
__all__ = ['Sphe... | {
"content_hash": "872f291147327e60ac1ea07b371f76cd",
"timestamp": "",
"source": "github",
"line_count": 316,
"max_line_length": 78,
"avg_line_length": 38.33860759493671,
"alnum_prop": 0.6231118448204704,
"repo_name": "matthewalbani/scipy",
"id": "2f797d01cfcf36b9c1bbfbd2a5221cf831ad9610",
"size": "... |
from quark.drivers import base
from quark.drivers import ironic_driver as ironic
from quark.drivers import optimized_nvp_driver as optnvp
from quark.drivers.registry_base import DriverRegistryBase
from quark.drivers import unmanaged
from oslo_log import log as logging
LOG = logging.getLogger(__name__)
class DriverR... | {
"content_hash": "81afe3a3e758d8748233a5afc25a5b9d",
"timestamp": "",
"source": "github",
"line_count": 69,
"max_line_length": 78,
"avg_line_length": 41.26086956521739,
"alnum_prop": 0.6188970846505093,
"repo_name": "rackerlabs/quark",
"id": "7ca5894ca6908e8a83d44368c98f1193447328a9",
"size": "3485... |
from os import walk
__author__ = 'sim'
class ConllFilesIndex:
def __init__(self, files_path):
"""
Obtain a mapping between successfully parsed files (*.tab files with indices) and its position in the
concatenated conll file (output.conll).
:param files_path: path containing *.ta... | {
"content_hash": "062103bdbf8cd3acb4273ac63616c033",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 109,
"avg_line_length": 35,
"alnum_prop": 0.6026785714285714,
"repo_name": "rug-compling/hmm-reps",
"id": "d321957615264e55a292da7e008319edf7474706",
"size": "1120",
"bin... |
from sys import argv
from inspect import isfunction
class Parser:
def __init__(self):
self.args_dict= {}
def add_arg(self, function, arguments, **kwargs):
try:
assert isinstance(arguments, tuple), 'Arguments should be in a tuple'
assert isfunction(function) or function i... | {
"content_hash": "725d033649c6d82e43ae12027aaf3fc4",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 121,
"avg_line_length": 34.44,
"alnum_prop": 0.5598141695702671,
"repo_name": "elssar/clappy",
"id": "faabf82782d5b3d1a29761cb77db51e1302f8d3c",
"size": "888",
"binary": ... |
import nuke
nodeMenu = nuke.menu("Nodes")
drawMenu = nodeMenu.findItem("Draw")
drawMenu.addCommand("Ramp2", "nuke.createNode('Ramp2')")
filterMenu = nodeMenu.findItem("Filter")
filterMenu.addCommand("Driven Dilate", "nuke.createNode('DrivenDilate')")
| {
"content_hash": "ebeff82d73e24da6cc2ab265af635d5d",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 73,
"avg_line_length": 23.272727272727273,
"alnum_prop": 0.74609375,
"repo_name": "broganross/nkTools",
"id": "be5d437a7a5290ae3e89531c8a63ceee28e72051",
"size": "257",
"... |
from oslo.utils import timeutils
from keystone.common import controller
from keystone.common import dependency
from keystone import exception
from keystone.i18n import _
@dependency.requires('revoke_api')
class RevokeController(controller.V3Controller):
@controller.protected()
def list_revoke_events(self, co... | {
"content_hash": "c6272d9e81d12b211ff1bc6167e727e8",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 78,
"avg_line_length": 37.90625,
"alnum_prop": 0.562242374278648,
"repo_name": "blueboxgroup/keystone",
"id": "8667935ce1fc8a93ce4431ac4b19f4976219738d",
"size": "1759",
... |
"""DSM Security data."""
class SynoCoreSecurity:
"""Class containing Security data."""
API_KEY = "SYNO.Core.SecurityScan.Status"
def __init__(self, dsm):
"""Constructor method."""
self._dsm = dsm
self._data = {}
def update(self):
"""Updates security dat... | {
"content_hash": "d5f37e63fd400a73fb09f41073efbc6b",
"timestamp": "",
"source": "github",
"line_count": 62,
"max_line_length": 70,
"avg_line_length": 26.274193548387096,
"alnum_prop": 0.5420503376304481,
"repo_name": "StaticCube/python-synology",
"id": "eed4ff545b13cf50119bd2d4b8b5bc6f2ad1b1b3",
"s... |
from django.apps import AppConfig
class TaxonomiaConfig(AppConfig):
name = 'taxonomy'
| {
"content_hash": "5eb4c69716bebbdc5754309058d3d897",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 33,
"avg_line_length": 18.4,
"alnum_prop": 0.7608695652173914,
"repo_name": "jonaqp/heroku",
"id": "d05986e2b316dd1f0a3f9626fc7624923a30e7b5",
"size": "92",
"binary": fals... |
from google.analytics import admin_v1alpha
def sample_update_data_retention_settings():
# Create a client
client = admin_v1alpha.AnalyticsAdminServiceClient()
# Initialize request argument(s)
request = admin_v1alpha.UpdateDataRetentionSettingsRequest(
)
# Make the request
response = clie... | {
"content_hash": "cc44f0ad05cd99cd8076188389f6fdf3",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 95,
"avg_line_length": 28.61111111111111,
"alnum_prop": 0.7650485436893204,
"repo_name": "googleapis/python-analytics-admin",
"id": "51c1ebbbe6e1b6cb839dd86a18703965f962b821"... |
"""
This module is designed to be used as follows::
from future.builtins.iterators import *
And then, for example::
for i in range(10**15):
pass
for (a, b) in zip(range(10**15), range(-10**15, 0)):
pass
Note that this is standard Python 3 code, plus some imports that do
nothing on Pytho... | {
"content_hash": "da03e6cbaf0a5dd152c54fe9069d5d0d",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 73,
"avg_line_length": 26.846153846153847,
"alnum_prop": 0.6790830945558739,
"repo_name": "PythonCharmers/python-future",
"id": "dff651e0f46e8f45cb6591d7f69a75b7dcb192da",
... |
"""
Created on Fri Mar 13 21:31:23 2015
Timeseries defined by
* Name
* Frequency
* Timezone
will be saved as bitmaps in redis. One Bitmap for every year containing data
saved as a simple redis-Strings with the key 'ts:{pk}:bmap:{year}' with pk being
the id of the timeseries and year is self-explaining.
The values of... | {
"content_hash": "0ed097e81a3fcd475b219fe2644597dc",
"timestamp": "",
"source": "github",
"line_count": 191,
"max_line_length": 80,
"avg_line_length": 33.5130890052356,
"alnum_prop": 0.6005311670051554,
"repo_name": "espang/projects",
"id": "35a79d45d2e116d7c6f385a181c5f6fe9ed49a3c",
"size": "6425"... |
"""
A very simple progress bar which keep track of the progress as we consume an
iterator.
"""
import time
from prompt_toolkit.shortcuts import ProgressBar
def data():
"""
A generator that produces items. len() doesn't work here, so the progress
bar can't estimate the time it will take.
"""
for i... | {
"content_hash": "11ccc203bdfa27b9495117d6ee8493c2",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 77,
"avg_line_length": 19,
"alnum_prop": 0.6133603238866396,
"repo_name": "jonathanslenders/python-prompt-toolkit",
"id": "596ac6b8a0897cb6687677d4b7a1c6ac4f943620",
"size"... |
"""XML-RPC methods of Zinnia Pingback"""
from urllib2 import urlopen
from urllib2 import URLError
from urllib2 import HTTPError
from urlparse import urlsplit
from django.contrib import comments
from django.utils.html import strip_tags
from django.contrib.sites.models import Site
from django.core.urlresolvers import re... | {
"content_hash": "f6d58d7abbc1174650179b91ac4c4e09",
"timestamp": "",
"source": "github",
"line_count": 141,
"max_line_length": 74,
"avg_line_length": 32.91489361702128,
"alnum_prop": 0.6371471665589312,
"repo_name": "westinedu/similarinterest",
"id": "bbd4ad0fe6310c2f2f1f2739b50f80d0f8d29d70",
"si... |
from django.shortcuts import redirect
from django.template.response import TemplateResponse
from ..forms import ShippingMethodForm
from .discount import add_voucher_form
from .validators import (
validate_cart, validate_shipping_address,
validate_shipping_method, validate_is_shipping_required)
from .shipping i... | {
"content_hash": "5b79cd3e44ba30b2fddb87460ec541b3",
"timestamp": "",
"source": "github",
"line_count": 54,
"max_line_length": 89,
"avg_line_length": 37.333333333333336,
"alnum_prop": 0.7589285714285714,
"repo_name": "laosunhust/saleor",
"id": "5d791e6da60886d97b9cd90f5dfca28e0b81ad7f",
"size": "20... |
from __future__ import unicode_literals
from django.apps import AppConfig
class OfficevibeConfig(AppConfig):
name = 'officevibe'
| {
"content_hash": "209d9aac6bcc18391ac77135eb83f31f",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 39,
"avg_line_length": 19.428571428571427,
"alnum_prop": 0.7647058823529411,
"repo_name": "zkan/pronto-feedback",
"id": "05779ce1accdbc2cb85531184c8711007fb2b109",
"size": "... |
""" Index links from a sitemap to a SOLR instance"""
import sys
import getopt
import solr
import uuid
from os import listdir
from os.path import isfile, join, isdir
from BeautifulSoup import BeautifulSoup
from xml.etree.ElementTree import parse
default_encoding = 'utf-8'
if sys.getdefaultencoding() != default_encoding... | {
"content_hash": "1030b1f00c36156e8ff64a11adea104b",
"timestamp": "",
"source": "github",
"line_count": 172,
"max_line_length": 176,
"avg_line_length": 38.843023255813954,
"alnum_prop": 0.6594821134560694,
"repo_name": "WinRoad-NET/wrdoclet",
"id": "cc74186199cf40ba89b0d08b1c5d43da281c3951",
"size"... |
import translator
class XorTranslator(translator.Translator):
"""One time pad translator"""
def translate(self, cipher):
if len(cipher) > len(self.key):
return "".join([chr(ord(x) ^ ord(y)) for (x, y) in zip(cipher[:len(self.key)], self.key)])
else:
return "".join([chr(ord(x) ^ ord(y)) for (x, y) in zip(ci... | {
"content_hash": "7f281260b2cc8bc31dc51cb667b1f55f",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 93,
"avg_line_length": 34.333333333333336,
"alnum_prop": 0.6601941747572816,
"repo_name": "PrehistoricTeam/pycrypt",
"id": "16a224ca59d5b7b6c521a066ff25667d3a291730",
"size... |
import base64, re, traceback, os, string, sys
from prompt_toolkit import PromptSession
from prompt_toolkit.history import FileHistory
from prompt_toolkit.auto_suggest import AutoSuggestFromHistory
from prompt_toolkit.styles import Style
from poshc2.client.Alias import cs_alias, cs_replace
from poshc2.Colours import Co... | {
"content_hash": "1ffd2b338d4d82b140d79814f7d2f84f",
"timestamp": "",
"source": "github",
"line_count": 297,
"max_line_length": 331,
"avg_line_length": 48,
"alnum_prop": 0.6412037037037037,
"repo_name": "nettitude/PoshC2",
"id": "3ae6b8b10848033c5fda7bb482fb529653771078",
"size": "14256",
"binary... |
import os.path
import glob
def recursively_find_parent_containing_file(current_path, search_files):
# Convert to absolute path, in case we received relative path
current_path = os.path.abspath(current_path)
while current_path != os.sep:
for current_file in search_files:
# Check if this... | {
"content_hash": "a988db3ee143987b558ceb2992ba03d7",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 73,
"avg_line_length": 36.625,
"alnum_prop": 0.6621160409556314,
"repo_name": "yeti/signals",
"id": "96217c854351e9a0653411d7ec56d4d6c9664fe2",
"size": "586",
"binary": f... |
def memoize(f):
"""
Memoization decorator
"""
cache= {}
def func(*args):
if args not in cache:
cache[args] = f(*args)
return cache[args]
return func
class Sendgrid(object):
"""
Sendgrid API
"""
def __init__(self, username, password,... | {
"content_hash": "34f60e3eedd70d4402dce7aedae0ed9c",
"timestamp": "",
"source": "github",
"line_count": 54,
"max_line_length": 86,
"avg_line_length": 22.38888888888889,
"alnum_prop": 0.5202646815550042,
"repo_name": "EventBuck/EventBuck",
"id": "33b5d73b8bc6abb8de9817ae6524e2d0078ad4ab",
"size": "1... |
from rpihelper.app import create_app
| {
"content_hash": "09c935c0f12428aa96ee23bf56c7e3e5",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 36,
"avg_line_length": 37,
"alnum_prop": 0.8378378378378378,
"repo_name": "Gr1N/rpihelper",
"id": "600a616b8c425e81a4c6056d03123a7a782de73a",
"size": "62",
"binary": false... |
"""The Netatmo integration."""
import logging
from homeassistant.core import callback
from .const import (
ATTR_EVENT_TYPE,
ATTR_FACE_URL,
ATTR_ID,
ATTR_IS_KNOWN,
ATTR_NAME,
ATTR_PERSONS,
DATA_PERSONS,
DEFAULT_PERSON,
DOMAIN,
NETATMO_EVENT,
)
_LOGGER = logging.getLogger(__name... | {
"content_hash": "34cdae48a58ca148e0ebb3ad241108b4",
"timestamp": "",
"source": "github",
"line_count": 65,
"max_line_length": 83,
"avg_line_length": 28.584615384615386,
"alnum_prop": 0.5947255113024758,
"repo_name": "robbiet480/home-assistant",
"id": "8b6a4d3f1e1dbc2734b9f13c1aa6f209b1685fb4",
"si... |
from autobahn.twisted.util import sleep as _sleep
def sleep(seconds):
return _sleep(seconds)
| {
"content_hash": "2e4265dcfa8022296e8a2de391a6bac3",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 49,
"avg_line_length": 19.8,
"alnum_prop": 0.7474747474747475,
"repo_name": "MD-Studio/MDStudio",
"id": "4c671347951ef19011a78e976b976c045c84c8eb",
"size": "99",
"binary":... |
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('categories', '0013_auto_20150130_1440'),
('geokey_sapelli', '0002_sapellichoiceroot_sapelli_id'),
]
operations = [
migrations.CreateModel(
... | {
"content_hash": "252adb25c19fe6cb0063ca946818a0fc",
"timestamp": "",
"source": "github",
"line_count": 60,
"max_line_length": 148,
"avg_line_length": 34.766666666666666,
"alnum_prop": 0.5474592521572388,
"repo_name": "ExCiteS/geokey-sapelli",
"id": "fe2336854bfcd0ca7911c58e95e646b51ce29013",
"size... |
from google.appengine.ext.webapp import template
from google.appengine.api import memcache
from google.appengine.api import taskqueue
from google.appengine.api import users
#from webapp2_extras import jinja2
import logging
from os import path
import webapp2 as wa2
from functools import wraps
from jinja2 import Templat... | {
"content_hash": "c4bdc8a7315b87f0310afaba2e52544a",
"timestamp": "",
"source": "github",
"line_count": 592,
"max_line_length": 158,
"avg_line_length": 44.98817567567568,
"alnum_prop": 0.5283670634175647,
"repo_name": "chdb/DhammaMap",
"id": "4dc770591c5f6af01c34c1db0f6f9b7df82912a0",
"size": "2671... |
"""
Copyright (c) 2016 Keith Sterling
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute,... | {
"content_hash": "a46671bf5f503d6f6368b0c78535e43f",
"timestamp": "",
"source": "github",
"line_count": 156,
"max_line_length": 126,
"avg_line_length": 34.05769230769231,
"alnum_prop": 0.6357989836250706,
"repo_name": "dkamotsky/program-y",
"id": "b00c91c2487d02951d38011bd1aee43f3324b4bb",
"size": ... |
import os
import time
import unittest
from conans.client.cmd.uploader import compress_files
from conans.paths import PACKAGE_TGZ_NAME
from conans.test.utils.test_files import temp_folder
from conans.util.files import md5sum, mkdir, path_exists, save
class FilesTest(unittest.TestCase):
def test_md5_compress(self... | {
"content_hash": "50c37a7b3bb4eb316e5ca6e924b54c7f",
"timestamp": "",
"source": "github",
"line_count": 51,
"max_line_length": 80,
"avg_line_length": 32.35294117647059,
"alnum_prop": 0.6224242424242424,
"repo_name": "memsharded/conan",
"id": "cc617fc101462dd45a161d364e865213faa18a61",
"size": "1650... |
import copy
from collections.abc import MutableMapping, MutableSequence
def flatten_data(data, simple=0):
out = []
def flatten(x, name='',subgroup=None):
if subgroup is None:
subgroup = [{}]
if isinstance(x, MutableMapping):
for a in x:
subgroup = flatte... | {
"content_hash": "e2c6a6275f353a94a952dd76bae7db84",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 80,
"avg_line_length": 32.24390243902439,
"alnum_prop": 0.5022692889561271,
"repo_name": "thomascmann/flatten-data",
"id": "5b07f81df06b6c097ded335e97528b3224577bbe",
"size... |
from .request import Request | {
"content_hash": "2233ca91942d8ea37fc562204a856692",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 28,
"avg_line_length": 28,
"alnum_prop": 0.8571428571428571,
"repo_name": "andreask/fortnox-python",
"id": "092b84cfc5f022de1958429155c86f7e0457860b",
"size": "28",
"binar... |
"""Implements BigQuery query job results table functionality."""
from __future__ import absolute_import
from __future__ import unicode_literals
from . import _table
class QueryResultsTable(_table.Table):
""" A subclass of Table specifically for Query results.
The primary differences are the additional propertie... | {
"content_hash": "8e043bc03540f25b0985cf29a54dce28",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 100,
"avg_line_length": 32.96551724137931,
"alnum_prop": 0.6861924686192469,
"repo_name": "supriyagarg/pydatalab",
"id": "017e5bf5bd73cb1d3d4e880da7150520c9b26cac",
"size":... |
from seafileapi.utils import raise_does_not_exist, tsstr_sec
class Account(object):
__slots__ = (
'client', 'id', 'email', 'password', 'is_staff',
'is_active', 'usage', 'total', 'create_time',
'department', 'name', 'note', 'ACCOUNT_URL')
def __init__(self, client, email, **account_inf... | {
"content_hash": "432a87b5ca3f1fd7c91c872b6693dc63",
"timestamp": "",
"source": "github",
"line_count": 121,
"max_line_length": 117,
"avg_line_length": 33.40495867768595,
"alnum_prop": 0.5903018307768432,
"repo_name": "AshotS/python-seafile-api",
"id": "b8b171843f99d01ac5af7a20583fe9b3cf423289",
"s... |
import sys
import libxml2
# Memory debug specific
libxml2.debugMemory(1)
#
# Parse a document testing the Close() API
#
docstr="""<foo>
<label>some text</label>
<item>100</item>
</foo>"""
reader = libxml2.readerForDoc(docstr, "test1", None, 0)
ret = reader.Read()
ret = reader.Read()
ret = reader.Close()
if ret != 0... | {
"content_hash": "bea9048d071bc1b1a3807aac7d22c452",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 60,
"avg_line_length": 18.28125,
"alnum_prop": 0.6820512820512821,
"repo_name": "staryes/a18",
"id": "de2dcd6f8a1962b7018fcfcb1572bcb58d0d0ac2",
"size": "683",
"binary": ... |
"""Data loader for pre-processed Criteo data."""
import tensorflow.compat.v1 as tf
from REDACTED.tensorflow_models.mlperf.models.rough.dlrm import feature_config as fc
def rand_features(batch_size):
"""Emits random input features, used for testing."""
features = {}
pos_size = batch_size // 2
neg_size = batch... | {
"content_hash": "7e65455780fc6a4d43c4798e1289c36c",
"timestamp": "",
"source": "github",
"line_count": 248,
"max_line_length": 84,
"avg_line_length": 36.78225806451613,
"alnum_prop": 0.6066652049989038,
"repo_name": "mlperf/training_results_v0.7",
"id": "d3cf717c7b0d019add63a0f0cdda0b585727b32a",
... |
import sys
import logging
import importlib
from pegasus.metrics import app
from pegasus.metrics import db
logging.basicConfig(level=app.config["LOGLEVEL"], format=app.config["LOGFORMAT"])
if len(sys.argv) != 2:
print "Usage: %s MIGRATION_MODULE" % sys.argv[0]
print "ex: %s pegasus/metrics/migrations/001_conv... | {
"content_hash": "c92edbff8fa33aea52185a733ee064c8",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 84,
"avg_line_length": 21.576923076923077,
"alnum_prop": 0.7005347593582888,
"repo_name": "pegasus-isi/pegasus-metrics",
"id": "5cd3f74541fefd115dd3d8b8130305b3906da39f",
"... |
from collections import defaultdict
from traceback import format_exception
import sys
import time
from pyrsistent import v
from twisted.python.reflect import fullyQualifiedName as fully_qualified_name
import attr
@attr.s
class _DelayedMessage:
"""
A test status message that will be shown at the end of a run.... | {
"content_hash": "2bd825e1424ea98c29992a665fffea0e",
"timestamp": "",
"source": "github",
"line_count": 354,
"max_line_length": 79,
"avg_line_length": 28.24858757062147,
"alnum_prop": 0.5837,
"repo_name": "Julian/Virtue",
"id": "5f85dee0b8a437e946908e58a5037511ecc7ea5f",
"size": "10000",
"binary"... |
from typing import ClassVar, List, Type
exit_unclean = object()
exit_clean = object()
class Step(object):
provides = [] # type: ClassVar[List[str]]
def __init__(self, logger):
self.logger = logger
def run(self, step_index, state):
"""Base class for state-creating steps.
When a... | {
"content_hash": "d31f29cc24b12a24a131f1527a505047",
"timestamp": "",
"source": "github",
"line_count": 67,
"max_line_length": 87,
"avg_line_length": 30.65671641791045,
"alnum_prop": 0.578383641674781,
"repo_name": "ric2b/Vivaldi-browser",
"id": "47ea7ffb41f0d203caa0a921ddce4cfd5bfc0461",
"size": "... |
import pwd
import os
import glob
PROC_TCP = "/proc/net/tcp"
STATE = {
'01':'ESTABLISHED',
'02':'SYN_SENT',
'03':'SYN_RECV',
'04':'FIN_WAIT1',
'05':'FIN_WAIT2',
'06':'TIME_WAIT',
'07':'CLOSE',
'08':'CLOSE_WAIT',
'09':'LAST_ACK',
'0A':'LISTE... | {
"content_hash": "f0f3581bca37476e3ffa11f765b2cb4b",
"timestamp": "",
"source": "github",
"line_count": 97,
"max_line_length": 105,
"avg_line_length": 30.144329896907216,
"alnum_prop": 0.5249658002735978,
"repo_name": "dimagol/trex-core",
"id": "b3e857f7ef7f9e57a28f3c2afb3d6fbbfa1e7319",
"size": "3... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.