text stringlengths 4 1.02M | meta dict |
|---|---|
from __future__ import unicode_literals
import gettext
import os
from datetime import datetime, timedelta
from importlib import import_module
from unittest import skipIf
from django import forms
from django.conf import settings
from django.contrib import admin
from django.contrib.admin import widgets
from django.cont... | {
"content_hash": "6fb7f273095bf2c0568bf4f5caf641a4",
"timestamp": "",
"source": "github",
"line_count": 1302,
"max_line_length": 119,
"avg_line_length": 44.90399385560676,
"alnum_prop": 0.6206961429915334,
"repo_name": "dydek/django",
"id": "46f2d2a76e51c0dc54b1b991eb138e04d2b605d8",
"size": "58514... |
import logging
import getopt
import sys
import couchapp.commands as commands
from couchapp.errors import AppError, CommandLineError
from couchapp.config import Config
logger = logging.getLogger(__name__)
class NullHandler(logging.Handler):
""" null log handler """
def emit(self, record):
pass
def ... | {
"content_hash": "39d9ca7533d5289d5729f4f2f2ef1495",
"timestamp": "",
"source": "github",
"line_count": 172,
"max_line_length": 72,
"avg_line_length": 25.47093023255814,
"alnum_prop": 0.5843414745491897,
"repo_name": "flimzy/couchapp",
"id": "4258814db31d21406ee08cff7c5ace71d0e20532",
"size": "4516... |
"""
check_schedule.py: check correct scheduled show title information
"""
__author__ = "Kentaro Sasaki"
__copyright__ = "Copyright 2014 Kentaro Sasaki"
import datetime
import json
import logging
def _load_json(file_name):
logging.debug("Open json file: %s" % file_name)
with open(file_name) as fp:
return j... | {
"content_hash": "76d0dce8bc26d8d557e97268f44c52bb",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 73,
"avg_line_length": 23.229166666666668,
"alnum_prop": 0.662780269058296,
"repo_name": "kentarosasaki/agqr-rec",
"id": "98148ebf8594caf910be21bcc9795f9c41c3f79a",
"size":... |
import os,sys
BASEDIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.append(BASEDIR)
from core import client
if __name__ == "__main__":
client.run()
| {
"content_hash": "a1188017a8156d2265625e36b837c08e",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 69,
"avg_line_length": 29.5,
"alnum_prop": 0.6779661016949152,
"repo_name": "jianbosky/ftp_server_client",
"id": "8a27da6aaa89bce51034192ff8fbf49736aca071",
"size": "222",
... |
from __future__ import unicode_literals
from django.db import models
from django.utils.timezone import now
from django.utils.encoding import python_2_unicode_compatible
from django.utils.translation import ugettext_lazy as _
from djangobmf.conf import settings
from djangobmf.models import BMFModel
from .serializers ... | {
"content_hash": "2aa30d262a53ce849541042cbcca2ab3",
"timestamp": "",
"source": "github",
"line_count": 222,
"max_line_length": 112,
"avg_line_length": 29.472972972972972,
"alnum_prop": 0.5986550511997555,
"repo_name": "django-bmf/django-bmf",
"id": "5700599e6ee3effc718d167611726a61ac1bd2e5",
"size... |
import logging
import sys
from django.shortcuts import render
from django.http import JsonResponse, HttpResponse
from django.views.decorators.http import require_http_methods
from search.db.query import Query
@require_http_methods(["GET"])
def index(request):
if request.GET.get("q", ""):
session_id = r... | {
"content_hash": "3c54138c93234cc3ae394b248d7ffc48",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 80,
"avg_line_length": 28.58139534883721,
"alnum_prop": 0.531326281529699,
"repo_name": "duosproject/duos-web",
"id": "3f1a322c42bb69c5211956c6022a06648684ae2b",
"size": "1... |
from __future__ import (absolute_import, division,
print_function, unicode_literals)
from future.utils import iteritems
from mock import Mock
from unittest import TestCase
from sqlalchemy import Boolean, Column, ForeignKey, Integer, String
from sqlalchemy.ext.declarative import as_declarative, ... | {
"content_hash": "b5724252d202c2d12dd7964a6d0a2aba",
"timestamp": "",
"source": "github",
"line_count": 117,
"max_line_length": 68,
"avg_line_length": 25.136752136752136,
"alnum_prop": 0.5759945596735804,
"repo_name": "Rhathe/fixtureupper",
"id": "cc4af316d1c6782e7d46088ab58ab2a4c39be521",
"size": ... |
from .generated.FoxySheepLexer import FoxySheepLexer
from .generated.FoxySheepParser import FoxySheepParser
from .generated.FoxySheepListener import FoxySheepListener
from .generated.FoxySheepVisitor import FoxySheepVisitor
from .generated.FullFormLexer import FullFormLexer
from .generated.FullFormParser import FullFo... | {
"content_hash": "ded1579659c27d902eec1197efa549b4",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 58,
"avg_line_length": 43.416666666666664,
"alnum_prop": 0.8867562380038387,
"repo_name": "rljacobson/FoxySheep",
"id": "0ddaa772c3827e0f4513935408c1c7d45fd564dc",
"size": ... |
def calc_bin(value, bound_min, bound_max, bins):
"""Find bin in parameter range.
Args:
value (float): some value, the result of a simulation.
bound_min (float): lower limit, defining the parameter-space.
bound_max (float): upper limit, defining the parameter-space.
bins (int): nu... | {
"content_hash": "9d3cf61aa407ad7b5b2a8fd1d26f9775",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 106,
"avg_line_length": 46.05555555555556,
"alnum_prop": 0.6441495778045838,
"repo_name": "WilmerLab/HTSOHM-dev",
"id": "3b3bf1a07c6da2973a827ac2ab4c0924daa9b464",
"size": ... |
default_app_config = 'tethys_datasets.apps.TethysDatasetsConfig' | {
"content_hash": "4ab4b49963f323a17a8a9242bd27b838",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 64,
"avg_line_length": 64,
"alnum_prop": 0.84375,
"repo_name": "CI-WATER/django-tethys_datasets",
"id": "4ed6e21a5f4e6cdccb87101cede8f09a870f59a3",
"size": "93",
"binary":... |
from pathlib import Path
import pytest
from libqtile import config, confreader, utils
configs_dir = Path(__file__).resolve().parent / "configs"
def load_config(name):
f = confreader.Config(configs_dir / name)
f.load()
return f
def test_validate():
# bad key
f = load_config("basic.py")
f.k... | {
"content_hash": "0ba0dcbc4abd0c6e9ee0d6b5625a2427",
"timestamp": "",
"source": "github",
"line_count": 84,
"max_line_length": 73,
"avg_line_length": 24.583333333333332,
"alnum_prop": 0.6353510895883777,
"repo_name": "ramnes/qtile",
"id": "7eb1dec1514f06ffd643c04fcb0625aefcf004c1",
"size": "3226",
... |
import sys
from pyasn1.codec.der import decoder as der_decoder
from pyasn1.codec.der import encoder as der_encoder
from pyasn1_modules import pem
from pyasn1_modules import rfc2511
try:
import unittest2 as unittest
except ImportError:
import unittest
class CertificateReqTestCase(unittest.TestCase):
pe... | {
"content_hash": "10b95fc3cc11510fef450314afa256bc",
"timestamp": "",
"source": "github",
"line_count": 46,
"max_line_length": 80,
"avg_line_length": 31.130434782608695,
"alnum_prop": 0.8107541899441341,
"repo_name": "catapult-project/catapult",
"id": "cd5e266ce3c8ef5e733d39e245a8a92a59100fa7",
"si... |
"""
Copyright 2015 Brocade Communications Systems, Inc.
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.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed t... | {
"content_hash": "8fe4af7732afd34f239d009b76650e52",
"timestamp": "",
"source": "github",
"line_count": 315,
"max_line_length": 77,
"avg_line_length": 34.60634920634921,
"alnum_prop": 0.5461884230804513,
"repo_name": "SivagnanamCiena/pynos",
"id": "1e19767c0f8f70f0f898f4b672f3ae812bf26d4a",
"size":... |
"""Compute the weighted sum of qubit states."""
from typing import List, Optional
import numpy as np
from qiskit.circuit import QuantumRegister, AncillaRegister, QuantumCircuit
from ..blueprintcircuit import BlueprintCircuit
class WeightedAdder(BlueprintCircuit):
r"""A circuit to compute the weighted sum of qu... | {
"content_hash": "d4d588ffdf8acb61305092b4c2a2c22d",
"timestamp": "",
"source": "github",
"line_count": 325,
"max_line_length": 97,
"avg_line_length": 37.62461538461538,
"alnum_prop": 0.47325809617271836,
"repo_name": "QISKit/qiskit-sdk-py",
"id": "f7d1dd6ef33947e5f32c1cf5f381dfc76793af0e",
"size":... |
from bottle import hook, install, response, route, run
from bottle.ext.mongo import MongoPlugin
import server
# Borrowed from https://gist.github.com/richard-flosi/3789163
@hook('after_request')
def enable_cors():
"""
You need to add some headers to each request.
Don't use the wildcard '*' for Access-Cont... | {
"content_hash": "a4bfc564a35da91d6ad56aeb0da034c6",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 117,
"avg_line_length": 38.68181818181818,
"alnum_prop": 0.7074030552291422,
"repo_name": "stilvoid/microservices-workshop",
"id": "ee7a0ec19b2f6fed77a3d0e6fec124ac369d5cb4",... |
import tabulate
from tabulate import (
DataRow,
Line as TabulateLine,
TableFormat,
_binary_type,
_strip_invisible,
_text_type,
)
crate_fmt = TableFormat(lineabove=TabulateLine("+", "-", "+", "+"),
linebelowheader=TabulateLine("+", "-", "+", "+"),
... | {
"content_hash": "e707b423d0876df74b80240ca7b4430a",
"timestamp": "",
"source": "github",
"line_count": 74,
"max_line_length": 197,
"avg_line_length": 35.310810810810814,
"alnum_prop": 0.5621890547263682,
"repo_name": "crate/crash",
"id": "7ee76fbd1a794bacf32577739d07a988fc839287",
"size": "2613",
... |
from __future__ import print_function
import importlib, inspect, os, sys
import numpy as np
from sklearn.datasets import make_regression
from sklearn.decomposition import PCA
from sklearn.metrics import r2_score
from sklearn.model_selection import train_test_split
from sklearn.pipeline import Pipeline
from sklearn.pre... | {
"content_hash": "4e51f1afe8de1d65ce20ae0f04a0bf0b",
"timestamp": "",
"source": "github",
"line_count": 155,
"max_line_length": 130,
"avg_line_length": 41.18064516129032,
"alnum_prop": 0.6968510104966317,
"repo_name": "michalkurka/h2o-3",
"id": "8274ad6e55bea6b5c7f0db6de99bc1920d164ad2",
"size": "6... |
import os
import sys
def _gw_logging_cfg(log_file):
return {
'version': 1,
'disable_existing_loggers': False,
'formatters': {
'standard': {
'format': "%(asctime)s - %(levelname)-5s - %(message)s"
},
'debug': {
'format': "%... | {
"content_hash": "40f81d783633ebe4d3109c6bf1c8e2a0",
"timestamp": "",
"source": "github",
"line_count": 100,
"max_line_length": 104,
"avg_line_length": 34.2,
"alnum_prop": 0.5628654970760234,
"repo_name": "useblocks/groundwork",
"id": "e7b165071bff7fd474ec3db65e1ccb7a2451fa2e",
"size": "3420",
"b... |
import pytest
from jinja2 import nodes
from jinja2schema import parse, UnexpectedExpression, InvalidExpression
from jinja2schema.visitors.expr import visit_filter, Context
from jinja2schema.model import Dictionary, Scalar, List, Unknown, String, Number
def get_scalar_context(ast):
return Context(return_struct_cl... | {
"content_hash": "0bcbac1074dcecd121dd451336b22795",
"timestamp": "",
"source": "github",
"line_count": 148,
"max_line_length": 96,
"avg_line_length": 35.11486486486486,
"alnum_prop": 0.6140080815855301,
"repo_name": "aromanovich/jinja2schema",
"id": "1758ef4d39c4a2a183362723bb3e422f3974838f",
"siz... |
"""Implements the OSEO GetOptions operation"""
import logging
import pyxb
import pyxb.bundles.opengis.oseo_1_0 as oseo
import pyxb.bundles.opengis.swe_2_0 as swe
from ..models import Order
from .. import settings
from .. import utilities
logger = logging.getLogger(__name__)
def create_oseo_order_options(collectio... | {
"content_hash": "ac66c27ce8c698b1be8db795e5670ecf",
"timestamp": "",
"source": "github",
"line_count": 114,
"max_line_length": 74,
"avg_line_length": 38.51754385964912,
"alnum_prop": 0.6720564791619221,
"repo_name": "pyoseo/django-oseoserver",
"id": "6bcb73758ea1427ebce39643608c713e29d7ec3a",
"siz... |
""" For docs, see https://github.com/pkimber/cloud_docs """
import os
from pkg_resources import safe_name
from fabric.api import (
abort,
cd,
env,
run,
)
from fabric.colors import (
green,
yellow,
)
from fabric.contrib.files import exists
from fabric.contrib.project import rsync_project
from ... | {
"content_hash": "831e12fd0380442e4c36e71b05e37b57",
"timestamp": "",
"source": "github",
"line_count": 153,
"max_line_length": 85,
"avg_line_length": 30.18300653594771,
"alnum_prop": 0.6167171935902989,
"repo_name": "pkimber/fabric",
"id": "03eb08460f92f36d83dbd99e7f54966222f7a61a",
"size": "4618"... |
from runner.koan import *
import jims
import joes
counter = 0 # Global
class AboutScope(Koan):
#
# NOTE:
# Look in jims.py and joes.py to see definitions of Dog used
# for this set of tests
#
def test_dog_is_not_available_in_the_current_scope(self):
try:
fido = ... | {
"content_hash": "771c082036aebcafe8fcb85de4bb7677",
"timestamp": "",
"source": "github",
"line_count": 89,
"max_line_length": 77,
"avg_line_length": 33,
"alnum_prop": 0.5641811372148451,
"repo_name": "aomelchenko/python_koans",
"id": "0aa5cf7e842175bcb09085283dbfea085dc3312a",
"size": "2984",
"b... |
import unittest
import pep8
import os.path
tests_dir = os.path.dirname(__file__)
modules_dir = os.path.abspath(os.path.join(tests_dir, "..", "coal"))
class TestCodeStyle(unittest.TestCase):
def test_pep8_conformance(self):
pep8style = pep8.StyleGuide()
result = pep8style.check_files([tests_dir,... | {
"content_hash": "a36f2fa885df9e92db0384d231dc0e06",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 68,
"avg_line_length": 24.42105263157895,
"alnum_prop": 0.6271551724137931,
"repo_name": "saymedia/python-coal",
"id": "068bbc74436fd0e267247968d9cddb5a4c84cc8f",
"size": "... |
from flask_script import Manager
from sched.app import app, db
# By default, Flask-Script adds the 'runserver' and 'shell' commands to
# interact with the Flask application. Add additional commands using the
# `@manager.command` decorator, where Flask-Script will create help
# documentation using the function's docst... | {
"content_hash": "5e82cc50a8c3c8edb3a3c325022ed8b5",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 72,
"avg_line_length": 26.307692307692307,
"alnum_prop": 0.7236842105263158,
"repo_name": "abacuspix/NFV_project",
"id": "90a7da9e403f61d6afb09ddbd471ea5b35dd5dea",
"size":... |
def largestValuesInTreeRows(t):
current_floor = [t]
res = []
while len(current_floor):
next_floor = []
m = []
for node in current_floor:
# print("node:", node)
if node and node.value:
# print("root:", node.value)
m.append(node.... | {
"content_hash": "4eb47c6eef563186edb2c294460638c4",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 51,
"avg_line_length": 31,
"alnum_prop": 0.4726507713884993,
"repo_name": "emirot/codefights",
"id": "79bcaf9a223ccae4b4cf16ccae0229681b5dbab5",
"size": "869",
"binary": ... |
"""
A scrpit to load comment into Database
Author: Ming
Usage:
usage: load_comments.py [-h] [--source SOURCE] [--start START] [--end END]
[--user USER] [--passwd PASSWD] [--db DBNAME]
optional arguments:
-h, --help show this help message and exit
--source SOURCE The source info, which wo... | {
"content_hash": "de099c7904e86bc03affe0361c710f47",
"timestamp": "",
"source": "github",
"line_count": 128,
"max_line_length": 212,
"avg_line_length": 35.8125,
"alnum_prop": 0.6348167539267016,
"repo_name": "WangWenjun559/Weiss",
"id": "fd2e05ab6cbe1c7b4257c05ae7b5349833913a15",
"size": "4584",
... |
from __future__ import division, print_function, absolute_import
import os
import sys
import re
from distutils.dep_util import newer_group, newer
from glob import glob
from os.path import join
def configuration(parent_package='',top_path=None):
from numpy.distutils.system_info import get_info, NotFoundError
f... | {
"content_hash": "588225aaff90bd71c08fd64aa5c1bdcf",
"timestamp": "",
"source": "github",
"line_count": 51,
"max_line_length": 67,
"avg_line_length": 29.176470588235293,
"alnum_prop": 0.6122311827956989,
"repo_name": "juliantaylor/scipy",
"id": "ce1eaeedaf75e7eb0ca6b9e1b8a5d4be9b00a875",
"size": "1... |
import sys, re, time, string
import numpy;
import scipy;
import scipy.special;
import nltk;
def compute_dirichlet_expectation(dirichlet_parameter):
if (len(dirichlet_parameter.shape) == 1):
return scipy.special.psi(dirichlet_parameter) - scipy.special.psi(numpy.sum(dirichlet_parameter))
return scipy.sp... | {
"content_hash": "6d2d2376bbad1fa4fc3fb07b20da6d0c",
"timestamp": "",
"source": "github",
"line_count": 97,
"max_line_length": 151,
"avg_line_length": 39.72164948453608,
"alnum_prop": 0.559563976122502,
"repo_name": "kzhai/InfVocLDA",
"id": "d32f1d5a74b76f9fdbe969a00fd6bc24eadb7996",
"size": "3853"... |
from functools import partial, wraps
from slm_lab.lib import logger, optimizer, util
import os
import pydash as ps
import torch
import torch.nn as nn
logger = logger.get_logger(__name__)
# register custom torch.optim
setattr(torch.optim, 'GlobalAdam', optimizer.GlobalAdam)
setattr(torch.optim, 'GlobalRMSprop', optimi... | {
"content_hash": "9ac5b10a1af36abc6a8cbc0177c9d451",
"timestamp": "",
"source": "github",
"line_count": 365,
"max_line_length": 231,
"avg_line_length": 40.24657534246575,
"alnum_prop": 0.6365554799183117,
"repo_name": "kengz/Unity-Lab",
"id": "79244ad4ee49621e5aec239858951f0fc6311fb3",
"size": "146... |
"""
Default settings for the ``mezzanine.blog`` app. Each of these can be
overridden in your project's settings module, just like regular
Django settings. The ``editable`` argument for each controls whether
the setting is editable via Django's admin.
Thought should be given to how a setting is actually used before
mak... | {
"content_hash": "b00eff835683db572c8b16d5324e7478",
"timestamp": "",
"source": "github",
"line_count": 71,
"max_line_length": 80,
"avg_line_length": 27.014084507042252,
"alnum_prop": 0.6882168925964547,
"repo_name": "guibernardino/mezzanine",
"id": "c8e1eb7ca826f53fbaad489520b2995958472e55",
"size... |
"""Statistical functions."""
# pylint: disable=unused-import,line-too-long,g-importing-member
from tensorflow_probability.python.internal import all_util
from tensorflow_probability.python.stats.calibration import brier_decomposition
from tensorflow_probability.python.stats.calibration import brier_score
from tensorfl... | {
"content_hash": "c1b333555cbe821b206677cb0670f5d5",
"timestamp": "",
"source": "github",
"line_count": 68,
"max_line_length": 96,
"avg_line_length": 46.13235294117647,
"alnum_prop": 0.8020401657634683,
"repo_name": "tensorflow/probability",
"id": "dd75111e11719433441662168c745b71ee98c8ce",
"size":... |
from settings import CONSUMER_KEY, CONSUMER_SECRET, ACCESS_TOKEN, ACCESS_TOKEN_SECRET
import oauth2 as oauth
class SingletonTwAuthentication(object):
"""
Singleton Pattern for OAUTH Twitter Authentication Process
"""
_instance = None
_client = None
def __new__(cls, *args, **kwargs):
i... | {
"content_hash": "9a23d951eab188a0f5b359283afb97fc",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 85,
"avg_line_length": 30.333333333333332,
"alnum_prop": 0.6648351648351648,
"repo_name": "Raul-diffindo/TwRestApiPlaces",
"id": "1b8c4d8a5bae9a1a1e066b93281c4dd4975f86c8",
... |
import requests
import warnings
import sys
class Monitor:
def __init__(self, accountID, token):
self.token = token
self.pricingApi = "https://api-fxpractice.oanda.com/v3/accounts/"
self.pricingApi += accountID
self.pricingApi += "/pricing"
#currencies is a list of strings
def getBidsAndAsks(self, currenci... | {
"content_hash": "94921cbf648b43ea3b7c7db92157301c",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 74,
"avg_line_length": 29.68421052631579,
"alnum_prop": 0.723404255319149,
"repo_name": "atanasAV/forex-trading-api",
"id": "15c597c94667a96ae9ab7a9f03b32cb2b1c65f1c",
"siz... |
import random
import json
random.seed()
def d6():
"""Simulate the roll of a 6 sided die"""
return random.randint(1, 6)
def two_d6():
"""Simulate the roll of two 6 sided die"""
return random.randint(1, 6) + random.randint(1, 6)
def d3():
"""Simulate the roll of a 3 sided die"""
return random... | {
"content_hash": "6c370775e5279abb78a9901b3e294aee",
"timestamp": "",
"source": "github",
"line_count": 387,
"max_line_length": 120,
"avg_line_length": 36.47803617571059,
"alnum_prop": 0.5341078132747751,
"repo_name": "Galidron/SectorBuild",
"id": "58b6740a36d4b07bec3543ac6006cfa2d4a9f864",
"size":... |
"""This module contains Google BigQuery to MSSQL operator."""
from typing import TYPE_CHECKING, List, Optional, Sequence, Union
from airflow.models import BaseOperator
from airflow.providers.google.cloud.hooks.bigquery import BigQueryHook
from airflow.providers.google.cloud.utils.bigquery_get_data import bigquery_get_... | {
"content_hash": "504e3a150cec0e7eb4763549b163dc2e",
"timestamp": "",
"source": "github",
"line_count": 118,
"max_line_length": 107,
"avg_line_length": 42.95762711864407,
"alnum_prop": 0.648254093509568,
"repo_name": "lyft/incubator-airflow",
"id": "ca63ff0d99b500dc024f463336e053ca602f1ea3",
"size"... |
"""
This will generate a movie data set of 1100 records.
These are the first 1100 movies which appear when querying the Freebase of type '/film/film'.
Here is the link to the freebase page - https://www.freebase.com/film/film?schema=
Usage - python3 film_data_generator.py
"""
import csv
import copy
import... | {
"content_hash": "9f69d1bff4409a8c0b3c186f71e47b48",
"timestamp": "",
"source": "github",
"line_count": 103,
"max_line_length": 99,
"avg_line_length": 30.601941747572816,
"alnum_prop": 0.629758883248731,
"repo_name": "koneksys/KLD",
"id": "c36ba24b000a90dcf8d82e578c42d3c91b57c3d6",
"size": "3947",
... |
"""Interact with a REST API."""
import json
import logging
from urllib.parse import urljoin
from aiohttp import ClientHttpProcessingError, ClientSession
class API(ClientSession):
"""Interact with a REST API."""
URL = None
def __init__(self, **kwargs):
super().__init__(**kwargs)
self.l... | {
"content_hash": "eb0bd8d8de6bf5dea1feaf45d6203fad",
"timestamp": "",
"source": "github",
"line_count": 61,
"max_line_length": 73,
"avg_line_length": 33,
"alnum_prop": 0.604073522106309,
"repo_name": "CactusDev/CactusBot",
"id": "d40b932702b67d5f9c5c2f1115fa84de145b1377",
"size": "2013",
"binary"... |
"""
This module contains Google BigQuery to BigQuery operator.
"""
import warnings
from typing import Dict, List, Optional, Union
from airflow.models import BaseOperator
from airflow.providers.google.cloud.hooks.bigquery import BigQueryHook
from airflow.utils.decorators import apply_defaults
class BigQueryToBigQuery... | {
"content_hash": "8ab042dcb8f58fd6424f887d4b2fe284",
"timestamp": "",
"source": "github",
"line_count": 108,
"max_line_length": 103,
"avg_line_length": 45.96296296296296,
"alnum_prop": 0.6518936341659952,
"repo_name": "mtagle/airflow",
"id": "f164cf2ce20a009a8cabca8e331e43f28442f455",
"size": "5751... |
from robot.errors import DataError
from robot.utils import XmlWriter, NullMarkupWriter, get_timestamp, unic
from robot.version import get_full_version
from .loggerhelper import IsLogged
class XmlLogger(object):
def __init__(self, path, log_level='TRACE', generator='Robot'):
self._log_message_is_logged =... | {
"content_hash": "3c35c5d47e710e3b4a9ea3b864165231",
"timestamp": "",
"source": "github",
"line_count": 163,
"max_line_length": 78,
"avg_line_length": 34.122699386503065,
"alnum_prop": 0.565623876303488,
"repo_name": "shellderp/sublime-robot-plugin",
"id": "d6a6c26469b8ab76cb30007130e49523adfacea8",
... |
'''Neural style transfer with Keras.
Before running this script, download the weights for the VGG16 model at:
https://drive.google.com/file/d/0Bz7KyqmuGsilT0J5dmRCM0ROVHc/view?usp=sharing
(source: https://gist.github.com/baraldilorenzo/07d7802847aaad0a35d3)
and make sure the variable `weights_path` in this script matc... | {
"content_hash": "b5334ea765f050ffdac01c45436818e8",
"timestamp": "",
"source": "github",
"line_count": 302,
"max_line_length": 105,
"avg_line_length": 37.996688741721854,
"alnum_prop": 0.6918518518518518,
"repo_name": "relh/keras",
"id": "e457b72ecbd79b042e52c53908a72a9805aba3c7",
"size": "11475",... |
from unittest.mock import patch
from django.contrib.auth.models import AnonymousUser, User
from django.test import RequestFactory, TestCase
from logger.middleware import LogAuthenticatedRequestMiddleware
class TestLogRequestMiddleware(TestCase):
def setUp(self):
self.factory = RequestFactory()
s... | {
"content_hash": "aa2fd4279c6eba340bbb356689c6a946",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 76,
"avg_line_length": 33.46875,
"alnum_prop": 0.7105508870214753,
"repo_name": "incuna/incuna-request-logging",
"id": "58bd9fa426835a2e5d2eb40baa8806c8e9134e39",
"size": "... |
"""Token bucket implementation for rate limiting."""
from __future__ import absolute_import, unicode_literals
from collections import deque
from kombu.five import monotonic
__all__ = ('TokenBucket',)
class TokenBucket(object):
"""Token Bucket Algorithm.
See Also:
https://en.wikipedia.org/wiki/Toke... | {
"content_hash": "f7b4a16df07f0958242d8b48a247cac8",
"timestamp": "",
"source": "github",
"line_count": 83,
"max_line_length": 79,
"avg_line_length": 30.518072289156628,
"alnum_prop": 0.608764311093565,
"repo_name": "urbn/kombu",
"id": "4c84834040ac1db83ec959014b6152ef67667322",
"size": "2533",
"... |
from __future__ import unicode_literals
import os
from datetime import date
from unittest import skipUnless
from django.apps import apps
from django.conf import settings
from django.contrib.sitemaps import Sitemap, GenericSitemap
from django.contrib.sites.models import Site
from django.core.exceptions import Improper... | {
"content_hash": "863b48c7156443d595d6ff7e4521d98c",
"timestamp": "",
"source": "github",
"line_count": 223,
"max_line_length": 204,
"avg_line_length": 48.01793721973094,
"alnum_prop": 0.6804258498319014,
"repo_name": "iambibhas/django",
"id": "dde9e97c01077e5758e71371bd7bf2cac6c763ee",
"size": "10... |
"""
"""
from __future__ import unicode_literals
import re
from .selection import SelectionType
__all__ = ('Document',)
# Regex for finding the "words" in documents. (We consider a group of alnum
# characters a word, but also a group of special characters a word, as long as
# it doesn't contain a space.)
_FIND_WORD... | {
"content_hash": "6dd778b9e40f5b2e87ba5119c8f05116",
"timestamp": "",
"source": "github",
"line_count": 491,
"max_line_length": 123,
"avg_line_length": 33.27902240325866,
"alnum_prop": 0.5644430844553243,
"repo_name": "Carreau/python-prompt-toolkit",
"id": "20e7ef946c3047db7f073a3ef8972bf3135116b6",
... |
import rospy
from std_msgs.msg import (
Empty,
String,
)
from geometry_msgs.msg import PoseStamped, Pose
from jsk_rviz_plugins.msg import OverlayText
from jsk_2015_05_baxter_apc.msg import *
from jsk_2015_05_baxter_apc.srv import *
class DemoReal(object):
"""Demo for video sending to Amazon Official ... | {
"content_hash": "68ba25d96965757d30de2cfb6bdde227",
"timestamp": "",
"source": "github",
"line_count": 89,
"max_line_length": 108,
"avg_line_length": 42.79775280898876,
"alnum_prop": 0.5707534786033079,
"repo_name": "pazeshun/jsk_apc",
"id": "6ed3096b057c0b35cb3c5842211a18f84d5e2c21",
"size": "392... |
from base64 import b64encode
from flask_pluginengine import current_plugin
from indico_piwik.queries.base import PiwikQueryReportEventBase
class PiwikQueryReportEventGraphBase(PiwikQueryReportEventBase):
"""Base Piwik query for retrieving PNG graphs"""
def call(self, apiModule, apiAction, height=None, widt... | {
"content_hash": "cb6d896c1855b594f8ca0988a5ccc1e9",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 115,
"avg_line_length": 42.23255813953488,
"alnum_prop": 0.6607929515418502,
"repo_name": "ThiefMaster/indico-plugins",
"id": "823399b4ede2b188aa6384c07b6a6ef6a3b13257",
"s... |
from scout.constants import USER_DEFAULT_TRACKS
from scout.models import User
def build_user(user_info):
"""Build a user object
Args:
user_info(dict): A dictionary with user information
Returns:
user_obj(scout.models.User)
"""
try:
email = user_info["email"]
except Ke... | {
"content_hash": "fab83bd42e1c14acc5ddf53465754c39",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 99,
"avg_line_length": 26.166666666666668,
"alnum_prop": 0.6284501061571125,
"repo_name": "Clinical-Genomics/scout",
"id": "69b28b11629f5f793a7057d02b8503c129d16f25",
"size... |
import diventi.accounts.models
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('accounts', '0231_auto_20190820_2207'),
]
operations = [
migrations.AlterModelManagers(
name='diventiuser',
managers=[
('object... | {
"content_hash": "e3ab958e94400060a59163d73796a656",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 74,
"avg_line_length": 22.38888888888889,
"alnum_prop": 0.5831265508684863,
"repo_name": "flavoi/diventi",
"id": "c1db4b44fcd65d27c85655efc451cc1b64e59ca7",
"size": "452",
... |
from __future__ import unicode_literals, print_function, division, absolute_import
from shutil import rmtree
from tempfile import mkdtemp
class WithTempDir(object):
tempdir = None
@classmethod
def setUpClass(cls):
super(WithTempDir, cls).setUpClass()
cls.tempdir = mkdtemp()
@classmet... | {
"content_hash": "4ab23fda6918550c084521593700b3af",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 82,
"avg_line_length": 25.333333333333332,
"alnum_prop": 0.6776315789473685,
"repo_name": "climapulse/dj-bgfiles",
"id": "c15bafd635bbe1d09e267858ba2edb0c218f26a7",
"size":... |
__author__ = 'Chuck Dilts'
import comware
comware.CLI('system-view ; undo int tun 1 ; undo evi site-id ; undo evi designated-vlan ; return ')
comware.CLI('system-view ; interface GigabitEthernet2/0 ; undo evi enable ; return ')
print 'EVI has been removed'
| {
"content_hash": "aab686ce64a63a3083ff06165321a1e7",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 99,
"avg_line_length": 22.083333333333332,
"alnum_prop": 0.7056603773584905,
"repo_name": "networkingdvi/HPN-Scripting",
"id": "989dfab3e788026103080de915b054efe28ab6db",
"... |
"""
Test of basic math operations on the Tensors and compare with numpy results
The Tensor types includes GPU and CPU Tensors
"""
from neon.backends import gen_backend
import numpy as np
def init_helper(lib, inA, inB, dtype):
A = lib.array(inA, dtype=dtype)
B = lib.array(inB, dtype=dtype)
C = lib.empty(i... | {
"content_hash": "c632debdd99a3c6bbaa8602c29f80d2b",
"timestamp": "",
"source": "github",
"line_count": 79,
"max_line_length": 98,
"avg_line_length": 31.31645569620253,
"alnum_prop": 0.5844785772029103,
"repo_name": "misko/neon",
"id": "466b814ddde7eaae7927f744dc04f5929d292bd5",
"size": "3236",
"... |
from canvas_sdk import client, utils
def get_kaltura_config(request_ctx, **request_kwargs):
"""
Return the config information for the Kaltura plugin in json format.
:param request_ctx: The request context
:type request_ctx: :class:RequestContext
:return: Get Kaltura config
:rty... | {
"content_hash": "5217581deafaef0157eeafa364461329",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 79,
"avg_line_length": 28.46153846153846,
"alnum_prop": 0.6702702702702703,
"repo_name": "penzance/canvas_python_sdk",
"id": "6530fb4d54ec6f25a4644f27e2f1475cc4c67e15",
"si... |
"""Embedding result protobuf."""
import dataclasses
from typing import Any, List
import numpy as np
from tensorflow_lite_support.cc.task.processor.proto import embedding_pb2
from tensorflow_lite_support.python.task.core.optional_dependencies import doc_controls
_FeatureVectorProto = embedding_pb2.FeatureVector
_Embe... | {
"content_hash": "59856e79db8441b0b16a4d055314b94b",
"timestamp": "",
"source": "github",
"line_count": 155,
"max_line_length": 87,
"avg_line_length": 30.258064516129032,
"alnum_prop": 0.6978678038379531,
"repo_name": "nwjs/chromium.src",
"id": "3ca5b14c18018a5ab7b28ad0285c47ff21a7e8af",
"size": "5... |
__author__ = 'luqitao'
import os
import shlex
import signal
from eventlet.green import subprocess
from eventlet import greenthread
import log as LOG
CURRENT_PATH = os.path.dirname(os.path.abspath(__file__))
def _subprocess_setup():
# Python installs a SIGPIPE handler by default. This is usually not what
# ... | {
"content_hash": "860b46bdd6d6361ddebb8c41c8ffd07f",
"timestamp": "",
"source": "github",
"line_count": 81,
"max_line_length": 111,
"avg_line_length": 33.48148148148148,
"alnum_prop": 0.5859144542772862,
"repo_name": "Hybrid-Cloud/badam",
"id": "ba6ebddd63e855c0d9199c4d3078861ec5502c05",
"size": "2... |
"""
Tests for the JSON encoder / decoder.
"""
import datetime
import decimal
import sys
import unicodedata
import unittest
from datafinder.persistence.error import PersistenceError
from datafinder.persistence.metadata.value_mapping import json_format
__version__ = "$Revision-Id:$"
_AE = u... | {
"content_hash": "4d22cfc5c7a5f088947c7022c49e2243",
"timestamp": "",
"source": "github",
"line_count": 163,
"max_line_length": 97,
"avg_line_length": 41.43558282208589,
"alnum_prop": 0.6103050044418122,
"repo_name": "DLR-SC/DataFinder",
"id": "79256cd657d83a00f3476d7549633f32617afbde",
"size": "84... |
"""Tests for model.py.
"""
# TODO(crbug.com/1148168): Set up these tests to run on the tryjobs.
import unittest
from model import Model
class ModelTest(unittest.TestCase):
"""Tests for model.py"""
def assert_project(self, project, name, id_, summary, owners):
self.assertEqual(project.name, name)
self.a... | {
"content_hash": "f359a02257ce3541b6741e66085aa236",
"timestamp": "",
"source": "github",
"line_count": 294,
"max_line_length": 78,
"avg_line_length": 32.95238095238095,
"alnum_prop": 0.5456234516928159,
"repo_name": "scheib/chromium",
"id": "aac8a10b4567b30f07670f1c92ac0b423af8bc3a",
"size": "9897... |
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Deleting field 'UserSignal.shot'
db.delete_column(u'h1ds_usersignal', 'shot')
# Deleting field 'UserSignal.is_fixed_to_sh... | {
"content_hash": "f115c696844c524c36807398bfe9e7f0",
"timestamp": "",
"source": "github",
"line_count": 161,
"max_line_length": 187,
"avg_line_length": 66.51552795031056,
"alnum_prop": 0.54132038472313,
"repo_name": "h1ds/h1ds",
"id": "5e6f18852e20cf7b5a562e47abcfa93292d075d8",
"size": "10733",
"... |
import sys
import os
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
sys.path.insert(0, os.path.abspath('../..'))
# -- General c... | {
"content_hash": "9482224bd1e03f0d52288aca3c0f326a",
"timestamp": "",
"source": "github",
"line_count": 255,
"max_line_length": 79,
"avg_line_length": 32.14901960784314,
"alnum_prop": 0.6993169065625763,
"repo_name": "weiyuanke/mykeystone",
"id": "319faf0685749f88691eae3f0c8b5a8cfac426e6",
"size": ... |
__author__ = 'Dima Potekhin'
import shutil
from epicycle.derkonfigurator.WorkspaceEntity import WorkspaceEntity
from epicycle.derkonfigurator.repository import Repository
class Workspace(WorkspaceEntity):
DEFAULT_LOCAL_CONFIG_RESOURCE_NAME = "workspace_config.yaml.local.default"
LOCAL_CONFIG_FILE_NAME = "wor... | {
"content_hash": "b9260173cc73ee1cdbbc058bdc90e01e",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 113,
"avg_line_length": 37.5,
"alnum_prop": 0.6693333333333333,
"repo_name": "open-epicycle/epicycle.derkonfigurator-py",
"id": "a49db97757002bbd74e487cf5aede451e352384d",
... |
"""
SALTS XBMC Addon
Copyright (C) 2014 tknorris
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
T... | {
"content_hash": "2a837509ffb9be6158c425b20861b7e2",
"timestamp": "",
"source": "github",
"line_count": 87,
"max_line_length": 157,
"avg_line_length": 40.97701149425287,
"alnum_prop": 0.6286115007012623,
"repo_name": "TheWardoctor/Wardoctors-repo",
"id": "068a0b3341bbfa20489ab8f218cad02a5b62989e",
... |
from app.NLP_LDA import *
def test_read_letters():
letters = read_letter_from_file("test\example_shareholders_letter.csv")
assert len(letters) == 38
def test_read_company():
company = read_letter_from_file("test\example_shareholders_letter.csv")
assert len(company) == 38
def test_number_of_company():... | {
"content_hash": "d1ce85809b544a3bdf58dc423b5da4fe",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 82,
"avg_line_length": 36.73684210526316,
"alnum_prop": 0.6905444126074498,
"repo_name": "lkc9015/freestyle_project",
"id": "ffdf31b8656b130415f96133646ca7dfdafeabd1",
"siz... |
"""
Django settings for amoki_music project.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.6/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...... | {
"content_hash": "fd029b8c76c626d04c7a3a56c52da0b1",
"timestamp": "",
"source": "github",
"line_count": 246,
"max_line_length": 112,
"avg_line_length": 25.959349593495936,
"alnum_prop": 0.6570623238333855,
"repo_name": "Amoki/Amoki-Music",
"id": "21eb6adcc7f2223d999901c1c63fdb74c7405dd5",
"size": "... |
"""Utils for creating PerfZero benchmarks."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import REDACTED
from absl import flags
from absl import logging
from absl.testing import flagsaver
import tensorflow as tf # pylint: disable=g-bad-impor... | {
"content_hash": "eef3ce6b6d90e625b682d54580e39638",
"timestamp": "",
"source": "github",
"line_count": 78,
"max_line_length": 77,
"avg_line_length": 33.26923076923077,
"alnum_prop": 0.6685934489402697,
"repo_name": "mlperf/training_results_v0.7",
"id": "164683c76eb2877ab7457f51cf43b91563de7e54",
"... |
"""
Django settings for sassafras project.
Generated by 'django-admin startproject' using Django 1.8.13.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.8/ref/settings/
"""
# Build p... | {
"content_hash": "7d780e221bc5f8e5a656f71fa461a41e",
"timestamp": "",
"source": "github",
"line_count": 130,
"max_line_length": 71,
"avg_line_length": 25.876923076923077,
"alnum_prop": 0.700653983353151,
"repo_name": "mliudev/sassafras",
"id": "8f8cbc67238882e5aef5639431d5085d5c2d2769",
"size": "33... |
class PBH5ToolsException(Exception):
def __init__(self, command, msg):
self.command = command
self.msg = msg
def __str__(self):
return "command: " + self.command + " produced the following error: " + self.msg
| {
"content_hash": "1ea40f1fb2685a7e13f82127db46fe65",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 88,
"avg_line_length": 35.142857142857146,
"alnum_prop": 0.5975609756097561,
"repo_name": "PacificBiosciences/pbh5tools",
"id": "4424276c8628efaec80e2c928c3d5f5d1411422e",
"... |
"""Module for wrapper cyber record."""
import collections
import importlib
import os
import sys
from google.protobuf.descriptor_pb2 import FileDescriptorProto
# init vars
CYBER_PATH = os.environ['CYBER_PATH']
CYBER_DIR = os.path.split(CYBER_PATH)[0]
sys.path.append(CYBER_PATH + "/third_party/")
sys.path.append(CYBER... | {
"content_hash": "4d825c759437d730565c16f6cd7e63e0",
"timestamp": "",
"source": "github",
"line_count": 220,
"max_line_length": 100,
"avg_line_length": 31.90909090909091,
"alnum_prop": 0.6284900284900284,
"repo_name": "wanglei828/apollo",
"id": "95c084596ac42f523503f927641ff0f3f2d040ed",
"size": "7... |
import json
import numpy as np
import os
import pytest
import sys
import time
import ray
from ray.cluster_utils import Cluster
from ray.test_utils import flat_errors
import ray.ray_constants as ray_constants
@pytest.fixture(params=[1, 4])
def ray_start_reconstruction(request):
num_nodes = request.param
plas... | {
"content_hash": "6a1870a62289680b63c6505e88c89525",
"timestamp": "",
"source": "github",
"line_count": 371,
"max_line_length": 79,
"avg_line_length": 33.506738544474395,
"alnum_prop": 0.636553776848202,
"repo_name": "stephanie-wang/ray",
"id": "b307341bc91e48a0b74caf4c42e322e5851da49b",
"size": "1... |
# Copyright 2002, 2003 Vladimir Prus
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
# This tests correct handling of "-d1" and "-d2" options.
import BoostBuild
t = BoostBuild.Tester(["-ffile.jam"], pa... | {
"content_hash": "25cdfb5f53946d546dff354cf4c8cbeb",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 68,
"avg_line_length": 22.838709677419356,
"alnum_prop": 0.6468926553672316,
"repo_name": "ycsoft/FatCat-Server",
"id": "61ff545ebbf85f54ca8b4edea144c4fd0c53f529",
"size": ... |
import urllib2
from bs4 import BeautifulSoup
from xml.dom import minidom
import random
from scrapy.utils.project import get_project_settings
import logging
import getpass
import stem
import stem.connection
from stem import Signal
from stem.control import Controller
class TorProxyMiddleware(object):
def __init__(... | {
"content_hash": "b56109f462ef7faa70b81af137278e94",
"timestamp": "",
"source": "github",
"line_count": 132,
"max_line_length": 115,
"avg_line_length": 36.21212121212121,
"alnum_prop": 0.5548117154811716,
"repo_name": "claneave28/PythonScraper",
"id": "3fc614ded7274528c9416d384a9b14126aca46f7",
"si... |
import flatbuffers
from flatbuffers.compat import import_numpy
np = import_numpy()
class TypeAliases(object):
__slots__ = ['_tab']
@classmethod
def GetRootAs(cls, buf, offset=0):
n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
x = TypeAliases()
x.Init(buf, n + o... | {
"content_hash": "89f78e2993a7dcd3e4805783285f3253",
"timestamp": "",
"source": "github",
"line_count": 301,
"max_line_length": 135,
"avg_line_length": 37.056478405315616,
"alnum_prop": 0.6383360229514076,
"repo_name": "alexames/flatbuffers",
"id": "b3020490a0b63c151d6040d5726c954d99c27efa",
"size"... |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('widgetbox', '0016_list_style'),
]
operations = [
migrations.RemoveField(
model_name='list',
name='tag',
),
m... | {
"content_hash": "162c77f0ad877f0a9f77c740a343a723",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 228,
"avg_line_length": 29.318181818181817,
"alnum_prop": 0.5906976744186047,
"repo_name": "logithr/djangocms-widgetbox",
"id": "a9e7748b26eadccbdd08e1c186badc5aab10e210",
... |
from msrest.paging import Paged
class OperationMetadataPaged(Paged):
"""
A paging container for iterating over a list of :class:`OperationMetadata <azure.mgmt.devtestlabs.models.OperationMetadata>` object
"""
_attribute_map = {
'next_link': {'key': 'nextLink', 'type': 'str'},
'current... | {
"content_hash": "b2c94f767ea4f78ea55e5d510e50c1e2",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 135,
"avg_line_length": 30.9375,
"alnum_prop": 0.6323232323232323,
"repo_name": "lmazuel/azure-sdk-for-python",
"id": "f0fa25a37beda8d4388ed94af9f8b4ac4d39f006",
"size": "9... |
__author__ = 'cadu'
from models import Feed, Magazine, Category, User, UserFavorite, Administrator, CoverArticle, PROFILE_OPTIONS
from serializers import AdministratorSerializer, MagazineSerializer, CategorySerializer, CoverArticleSerializer
from django.http import HttpResponse
from rest_framework.views import APIView... | {
"content_hash": "b09f8dba10662bfbd27a78a58e295bff",
"timestamp": "",
"source": "github",
"line_count": 976,
"max_line_length": 158,
"avg_line_length": 35.71823770491803,
"alnum_prop": 0.6048592983563295,
"repo_name": "Infobase/pulsemob_webservices",
"id": "82b5593214ad6d79099b6378d611a8febe37d0d3",
... |
"""
Greedy implementation of the vision problem.
Written by Ooj Amit Srivastava.
"""
from typing import List
def solve(satisfactions : List[int], walkers : List[int]) -> int:
# Find best pair go back-n-forth
# Pair goodness = sum(pair) * U-index(pair) + sum(0->pair)
# This is optimal because... | {
"content_hash": "d33559fb8392f9e8ebbd2193204e9060",
"timestamp": "",
"source": "github",
"line_count": 51,
"max_line_length": 83,
"avg_line_length": 31.58823529411765,
"alnum_prop": 0.5704531346989448,
"repo_name": "matthewelse/british-informatics-olympiad",
"id": "c398faef07486748d67f9056f4ce86ade7... |
"""
Qc API
Qc API # noqa: E501
The version of the OpenAPI document: 3.0.0
Contact: cloudsupport@telestream.net
Generated by: https://openapi-generator.tech
"""
from __future__ import absolute_import
import unittest
import datetime
import telestream_cloud_qc
from telestream_cloud_qc.models.hdr... | {
"content_hash": "53e8e64d79dcd509c952e818c911649b",
"timestamp": "",
"source": "github",
"line_count": 63,
"max_line_length": 77,
"avg_line_length": 28.158730158730158,
"alnum_prop": 0.5676437429537767,
"repo_name": "Telestream/telestream-cloud-python-sdk",
"id": "026e27946dd58396e66f2b490b451a29c69... |
import argparse
import json
import os
import re
import urllib.request
_REPO_URL = 'https://dl.google.com/dl/android/maven2'
_GROUP_NAME = 'com/google/android/gms'
_MODULE_NAME = 'play-services-instantapps'
_FILE_EXT = 'aar'
_OVERRIDE_LATEST = None
_PATCH_VERSION = 'cr1'
def do_latest():
if _OVERRIDE_LATEST is no... | {
"content_hash": "c2817d273fbd9e78420acfb4b038d90e",
"timestamp": "",
"source": "github",
"line_count": 70,
"max_line_length": 79,
"avg_line_length": 31.771428571428572,
"alnum_prop": 0.5962230215827338,
"repo_name": "chromium/chromium",
"id": "3acce0731de437786a4b690dfda2414bf50fb606",
"size": "24... |
from operator import attrgetter
from pyangbind.lib.yangtypes import RestrictedPrecisionDecimalType
from pyangbind.lib.yangtypes import RestrictedClassType
from pyangbind.lib.yangtypes import TypedListType
from pyangbind.lib.yangtypes import YANGBool
from pyangbind.lib.yangtypes import YANGListType
from pyangbind.lib.ya... | {
"content_hash": "e436d7c2f6adffce3c76938cd9630d58",
"timestamp": "",
"source": "github",
"line_count": 650,
"max_line_length": 395,
"avg_line_length": 39.71076923076923,
"alnum_prop": 0.5841469084146909,
"repo_name": "napalm-automation/napalm-yang",
"id": "e21a4ae4169a6c1cb7a759053fe3d6e6d46b419c",
... |
import argparse
import copy
import sys
from ros_buildfarm.argument import add_argument_arch
from ros_buildfarm.argument import add_argument_build_name
from ros_buildfarm.argument import add_argument_cache_dir
from ros_buildfarm.argument import add_argument_config_url
from ros_buildfarm.argument import \
add_argume... | {
"content_hash": "1e4638da6fc0ab806e91e88d8ccd364c",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 76,
"avg_line_length": 37.46938775510204,
"alnum_prop": 0.7478213507625272,
"repo_name": "130s/ros_buildfarm",
"id": "72b8e2335d80666396e394293a1b66daa0cf1cbb",
"size": "18... |
import json
import re
import flavorsync.test.config as config
from lxml import etree, objectify
from flavorsync.model import Infrastructure, Flavor, FlavorCollection
XML_MIMETYPE = 'application/xml'
JSON_MIMETYPE = 'application/json'
WRONG_MIMETYPE = 'application/whatever'
JSON_EXAMPLE_PAYLOADS_DIR = 'flavorsync/te... | {
"content_hash": "3815760149afa685fb4bec836b71e5a6",
"timestamp": "",
"source": "github",
"line_count": 119,
"max_line_length": 102,
"avg_line_length": 34.88235294117647,
"alnum_prop": 0.6535774512165743,
"repo_name": "Fiware/ops.Flavor-sync",
"id": "b539bf2a8b54675a800b7361763db5d943e467ea",
"size... |
import os
from setuptools import setup
VERSION = (1, 0, 0)
__version__ = '.'.join((str(x) for x in VERSION))
setup(
name='appetizer',
version=__version__,
description='Appetizer tools for test recording, replaying and functional testing',
author='Mingyuan Xia',
author_email='mxia@mxia.me',
url... | {
"content_hash": "7945a1b5587e3f61ea69cb01f5366c48",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 87,
"avg_line_length": 32.73076923076923,
"alnum_prop": 0.6263219741480611,
"repo_name": "appetizerio/replaykit.py",
"id": "41a47666874b36f176b99f08493997d41958ce35",
"size... |
"""Usage information for the main IPython applications.
"""
#-----------------------------------------------------------------------------
# Copyright (C) 2008-2011 The IPython Development Team
# Copyright (C) 2001-2007 Fernando Perez. <fperez@colorado.edu>
#
# Distributed under the terms of the BSD License. The f... | {
"content_hash": "78ebb8ba5b1da748b2d95cd4ccad1845",
"timestamp": "",
"source": "github",
"line_count": 340,
"max_line_length": 112,
"avg_line_length": 39.758823529411764,
"alnum_prop": 0.6731765054002071,
"repo_name": "ipython/ipython",
"id": "53219bceb2562805537fe37632e19be6fb56760e",
"size": "13... |
import re
import os
import sys
import time
import unittest
import ConfigParser
from setuptools import setup, Command
class SQLiteTest(Command):
"""
Run the tests on SQLite
"""
description = "Run tests on SQLite"
user_options = []
def initialize_options(self):
pass
def finalize_o... | {
"content_hash": "6f7f4da3f90c13aef450c0f9ccbacb13",
"timestamp": "",
"source": "github",
"line_count": 210,
"max_line_length": 79,
"avg_line_length": 28.3,
"alnum_prop": 0.5779909136799596,
"repo_name": "fulfilio/nereid",
"id": "9456797dc442b8be621063c316daea590185f9f2",
"size": "6095",
"binary"... |
"""Tests of fiona.env"""
import os
import sys
try:
from unittest import mock
except ImportError:
import mock
import fiona
from fiona import _env
from fiona.env import getenv, hasenv, ensure_env, ensure_env_with_credentials
from fiona.session import AWSSession, GSSession
def test_nested_credentials(monkeypat... | {
"content_hash": "0bea0885beb6a619f68a9befdafbe900",
"timestamp": "",
"source": "github",
"line_count": 117,
"max_line_length": 97,
"avg_line_length": 32.82905982905983,
"alnum_prop": 0.670919031502213,
"repo_name": "rbuffat/Fiona",
"id": "ff85c3733a88b39bd2fdb8425569f947ab18c605",
"size": "3841",
... |
"""Treadmill host-ring service.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import glob
import logging
import os
import sys
import tempfile
import click
from treadmill import cli
from treadmill import contex... | {
"content_hash": "2b5906ccefef5ba6a495b17d8a5918bf",
"timestamp": "",
"source": "github",
"line_count": 113,
"max_line_length": 78,
"avg_line_length": 32.230088495575224,
"alnum_prop": 0.5351455244371225,
"repo_name": "captiosus/treadmill",
"id": "97c965c742527c6a176625c9a4f4cf1cff823940",
"size": ... |
"""Common tradfri test fixtures."""
from unittest.mock import Mock, patch
import pytest
from . import MOCK_GATEWAY_ID
from tests.components.light.conftest import mock_light_profiles # noqa: F401
# pylint: disable=protected-access
@pytest.fixture
def mock_gateway_info():
"""Mock get_gateway_info."""
with ... | {
"content_hash": "91bff7d8842e2cfd70d970211942e93a",
"timestamp": "",
"source": "github",
"line_count": 88,
"max_line_length": 88,
"avg_line_length": 27.238636363636363,
"alnum_prop": 0.6587400917813934,
"repo_name": "adrienbrault/home-assistant",
"id": "54a8625f23c1398a79bd22e9ff3be878a771674a",
"... |
from __future__ import print_function
from binaryninja import *
# TODO: rule out impossible nestings to speed up traversing
def traverse_llil_basic_block(f_type, f, block):
for instr in block:
traverse_typed(f_type, f, instr)
def traverse_mlil_basic_block(f_type, f, block):
for instr in block:
... | {
"content_hash": "1349e5a231db53cb750b0ab29f8d4319",
"timestamp": "",
"source": "github",
"line_count": 136,
"max_line_length": 111,
"avg_line_length": 26.08823529411765,
"alnum_prop": 0.6226042841037204,
"repo_name": "kenoph/binja-fyb",
"id": "c400a5e81a1f4ca7228841d20189c1b66974f58b",
"size": "35... |
"""
Copyright 2017 The Trustees of Princeton University
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.apache.org/licenses/LICENSE-2.0
Unless required by applicab... | {
"content_hash": "af0d0c5af3c5036f10085e1e0de5224d",
"timestamp": "",
"source": "github",
"line_count": 288,
"max_line_length": 175,
"avg_line_length": 28.600694444444443,
"alnum_prop": 0.6020395775160859,
"repo_name": "syndicate-storage/syndicate-core",
"id": "65e62be8c234435b504efeba6911473dfef7bcd... |
from sys import stdin
from itertools import combinations
remainingTime = int(stdin.readline())
remainingExercises = int(stdin.readline())
# Grab exercises
data = []
for i in range(remainingExercises):
data.append([int(x) for x in stdin.readline().split()])
hasSolution = True
combinationLength = 2
maxPoints = 0
whi... | {
"content_hash": "1f63e416005b557143bc02cfa517ddb2",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 60,
"avg_line_length": 24.622222222222224,
"alnum_prop": 0.7364620938628159,
"repo_name": "AntoineAugusti/katas",
"id": "85a6370839588e871589f5d89e2d30e7f9588def",
"size": ... |
from __future__ import unicode_literals
import os
from django.core.exceptions import ImproperlyConfigured
from django.core.urlresolvers import reverse, clear_url_caches
from django.http import HttpResponsePermanentRedirect
from django.middleware.locale import LocaleMiddleware
from django.test import TestCase
from dja... | {
"content_hash": "fe568e213eced58fd50fd978ca61fa93",
"timestamp": "",
"source": "github",
"line_count": 325,
"max_line_length": 112,
"avg_line_length": 39.74153846153846,
"alnum_prop": 0.6491173737999381,
"repo_name": "yceruto/django",
"id": "78f5a46aae72b6094674732cd6ed3700802ccbf1",
"size": "1291... |
import os
import re
import unittest
from django.conf import settings
from django.contrib.auth.models import User
from django.test import TestCase
# from linkcheck.utils import find as find_links
from pidman.pid.ark_utils import normalize_ark, valid_qualifier, \
invalid_qualifier_characters
from pidman.pid.models ... | {
"content_hash": "7f31a84f4bcbe26605fa87824b1909b0",
"timestamp": "",
"source": "github",
"line_count": 345,
"max_line_length": 116,
"avg_line_length": 46.594202898550726,
"alnum_prop": 0.6235769828926905,
"repo_name": "emory-libraries/pidman",
"id": "5b291f56b007b4349b153e029129337ae1ecbfd6",
"siz... |
import unittest
import os
class TestCluster(unittest.TestCase):
"""
Test cluster functionality.
"""
def setUp(self):
# Find out the current directory
self.miso_path = os.path.dirname(os.path.abspath(os.path.expanduser(__file__)))
self.tests_data_dir = os.path.join(self.miso_path... | {
"content_hash": "ea957bd2db384c418961aec5599be121",
"timestamp": "",
"source": "github",
"line_count": 91,
"max_line_length": 101,
"avg_line_length": 40.824175824175825,
"alnum_prop": 0.4635262449528937,
"repo_name": "wuxue/altanalyze",
"id": "1df31ae30aca102424f45502bdf1eb4ae376704e",
"size": "37... |
import time
import BaseHTTPServer
import re
HOST_NAME = ''
PORT_NUMBER = 80
class MyHandler(BaseHTTPServer.BaseHTTPRequestHandler):
def do_HEAD(s):
s.send_response(200)
s.send_header("Content-type", "text/html")
s.end_headers()
def do_GET(s):
s.send_response(200)
path = re.split('/', s.path)
actionta... | {
"content_hash": "e12084cb480ced4443346be72759f091",
"timestamp": "",
"source": "github",
"line_count": 74,
"max_line_length": 90,
"avg_line_length": 26.027027027027028,
"alnum_prop": 0.6427829698857737,
"repo_name": "Purdue-ACM-SIGAPP/Purdue-App-Old",
"id": "7b53b4622a408e95b983711b3b96d0d0c633e7cd"... |
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "briefbe.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| {
"content_hash": "5071b236432c077e5e7aae02e19abfe3",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 71,
"avg_line_length": 25.333333333333332,
"alnum_prop": 0.7105263157894737,
"repo_name": "bjarnoldus/briefbe",
"id": "896f945c196ddae0edaacf8f6fccda563a93b03e",
"size": "25... |
import random
from typing import Type, TypeVar, Mapping, Any, Iterable, Generator
import pytest
from datapipelines import DataSource, CompositeDataSource, PipelineContext, NotFoundError
#########################################
# Create simple DataSources for testing #
#########################################
T = ... | {
"content_hash": "3f77dcc77ac7474e94c03bf641fffb0b",
"timestamp": "",
"source": "github",
"line_count": 382,
"max_line_length": 125,
"avg_line_length": 29.157068062827225,
"alnum_prop": 0.6219249416412282,
"repo_name": "sserrot/champion_relationships",
"id": "f6c45260ecf6debde8798c62ccc42c732cda8178"... |
def extractAtenTranslations(item):
"""
"""
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or 'preview' in item['title'].lower():
return None
if 'Skill Taker' in item['tags'] or 'Skill Taker Ch' in item['title']:
return buildReleaseMessageWithType(item, 'Skill Tak... | {
"content_hash": "316b0e14be506d103304af55001191ce",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 152,
"avg_line_length": 43.4,
"alnum_prop": 0.7258064516129032,
"repo_name": "fake-name/ReadableWebProxy",
"id": "c7f6ef2b51beb217b973570c3ad3df5ad28bd89b",
"size": "436",
... |
""" Main app entry / wsgi entry point """
import logging
import sys
import config
from lazyblacksmith.app import create_app
APP = create_app(config)
def set_loggers():
""" Define logger format and level for the whole app """
formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s... | {
"content_hash": "a8dfde18ccc80d2511e5ad10eb071215",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 91,
"avg_line_length": 27.863636363636363,
"alnum_prop": 0.6492659053833605,
"repo_name": "Kyria/LazyBlacksmith",
"id": "9e0cd8bfe40253823da6fefea4761c082db94627",
"size": ... |
"""Add event log.
Revision ID: d17d4d4fd1ee
Revises: 95779b509fe4
Create Date: 2016-07-22 12:21:14.296489
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
# revision identifiers, used by Alembic.
revision = 'd17d4d4fd1ee'
down_revision = '95779b509fe4'
def upgrade():
... | {
"content_hash": "bef5732c5e0d551aa64ff7e93f420930",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 87,
"avg_line_length": 34.02777777777778,
"alnum_prop": 0.6579591836734694,
"repo_name": "gazeti/aleph",
"id": "92c64834ac0b04e95c7e2d2bc2bb879d1dd3f193",
"size": "1225",
... |
from glumpy import library
from glumpy.transforms.transform import Transform
import numpy as np
class Translate(Transform):
"""
Translation transform
:param 3-tuple translate:
Translation vector. Default is (0,0,0).
The transform is connected to the following events:
* ``on_attach``: T... | {
"content_hash": "6c688977d0877092b31baf4b6b2ca49f",
"timestamp": "",
"source": "github",
"line_count": 63,
"max_line_length": 77,
"avg_line_length": 24.047619047619047,
"alnum_prop": 0.5808580858085809,
"repo_name": "glumpy/glumpy",
"id": "64a180be677a006e80d7b20aa9fa69cdd94edb98",
"size": "1785",... |
from __future__ import absolute_import
from django.contrib.contenttypes.models import ContentType
from django.core import management
from django.core.exceptions import FieldError
from django.db import models, DEFAULT_DB_ALIAS
from django.db.models import signals
from django.test import TestCase
from .models import (... | {
"content_hash": "b14a4c8b0824b07442fd093f1e72f2b9",
"timestamp": "",
"source": "github",
"line_count": 315,
"max_line_length": 87,
"avg_line_length": 37.00317460317461,
"alnum_prop": 0.6177934111187371,
"repo_name": "mixman/djangodev",
"id": "3ec84656893f9631a9acb9417b76305022906607",
"size": "116... |
import math
import sys
import os
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from ehata import ehata
from itm import pytm
from geo import tropoClim
from geo import refractivity
from geo import ned_indexer
from geo import nlcd_indexer
from geo import land_use
from geo import vincenty
#... | {
"content_hash": "9dcf42b73c0584fa0ccd352b716f5659",
"timestamp": "",
"source": "github",
"line_count": 149,
"max_line_length": 105,
"avg_line_length": 41.54362416107382,
"alnum_prop": 0.6337641357027464,
"repo_name": "gregbillock/Spectrum-Access-System",
"id": "7f1ed02fbcc208a5099d64e386b1ba2a78d3a6... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.