text stringlengths 4 1.02M | meta dict |
|---|---|
import os
import pytest
def assert_true(condition):
__tracebackhide__ = True
assert condition
def assert_false(condition):
__tracebackhide__ = True
assert not condition
def assert_raises(expected_exception, *args, **kwargs):
__tracebackhide__ = True
return pytest.raises(expected_exception... | {
"content_hash": "661c78e243830543fce1696ab487323d",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 61,
"avg_line_length": 18.11111111111111,
"alnum_prop": 0.6687116564417178,
"repo_name": "matthew-brett/delocate",
"id": "ec2d3175faa25037a1375c035ff9f841a228b703",
"size":... |
class FormData(dict):
''' A dict that can be built from a form or formset instance, and will fill
itself with request.POST-like data, allowing easier testing of form submissions.
See forms_inline.TestTranslationsInline for example uses.
'''
def __init__(self, form_or_set):
if hasattr(form_o... | {
"content_hash": "ed969fdffdf115c9f0cd2d6b3b494d72",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 84,
"avg_line_length": 37.02857142857143,
"alnum_prop": 0.5547839506172839,
"repo_name": "philippeowagner/django-hvad",
"id": "de822b6d7d12410fc0f1b7f312df7960476ef69b",
"s... |
import random
import math
import numpy
def gen_toy_data(data_dim=500, set_size=100, freq_range=[20,40], phase_range=[20,40], amplitude_range=[10,50], delay=5, input_noise=0.0, target_noise=0.0):
# generates toy wavy data
# data_dim is the number of points per wave
# set_size is the number of waves
#... | {
"content_hash": "0316910f2981e558a097a52fed0d7f67",
"timestamp": "",
"source": "github",
"line_count": 81,
"max_line_length": 155,
"avg_line_length": 33.50617283950617,
"alnum_prop": 0.5644804716285925,
"repo_name": "grezesf/Research",
"id": "1cbf1af4deabbeb7c886c395132643e4f0264a86",
"size": "273... |
from fontTools.misc.textTools import bytechr, byteord, bytesjoin, tobytes, tostr
from fontTools.misc import eexec
from .psOperators import (
PSOperators,
ps_StandardEncoding,
ps_array,
ps_boolean,
ps_dict,
ps_integer,
ps_literal,
ps_mark,
ps_name,
ps_operator,
ps_procedure,
ps_procmark,
ps_real,
ps_string... | {
"content_hash": "fee8b1fd7ebf0b80e6e61bb29076f522",
"timestamp": "",
"source": "github",
"line_count": 385,
"max_line_length": 94,
"avg_line_length": 24.945454545454545,
"alnum_prop": 0.6487921699291962,
"repo_name": "fonttools/fonttools",
"id": "a6c8b8b5ac062c0754f75b9c32e8a661bbfffea0",
"size": ... |
import jsonschema
import mock
from rally.plugins.common.runners import rps
from rally.task import runner
from tests.unit import fakes
from tests.unit import test
RUNNERS_BASE = "rally.task.runner."
RUNNERS = "rally.plugins.common.runners."
class RPSScenarioRunnerTestCase(test.TestCase):
def setUp(self):
... | {
"content_hash": "fabdbfaa1dcb7a63e8c54a99325b57b5",
"timestamp": "",
"source": "github",
"line_count": 275,
"max_line_length": 78,
"avg_line_length": 38.589090909090906,
"alnum_prop": 0.531379570297776,
"repo_name": "amit0701/rally",
"id": "ffdb9f5a3b165b20df0ffa0736f187bbc107a235",
"size": "11242... |
from datetime import datetime
from botplugin import BotPluginInterface
COMMANDS = {'/uptime': 'Time this bot is up and running'}
class BotPlugin(BotPluginInterface):
startTime = 0
def __init__(self, logger):
BotPluginInterface.__init__(self)
self.commands = COMMANDS
self.startTime = ... | {
"content_hash": "1ffb7f4fca3d35ba6be162229c27d946",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 71,
"avg_line_length": 26.928571428571427,
"alnum_prop": 0.656498673740053,
"repo_name": "artemy/telegrambot",
"id": "7f6cf01949d130f04cabd92e17827ee927f1be9a",
"size": "75... |
from datetime import datetime
from sqlalchemy import create_engine
from sqlalchemy.schema import Column
from sqlalchemy.orm import sessionmaker
from sqlalchemy.types import String, DateTime, Integer, Boolean
from sqlalchemy.ext.declarative import declarative_base
Base = declarative_base()
class Mail(Base):
__tablena... | {
"content_hash": "4b6f54fb44ff802807b21619669a63ee",
"timestamp": "",
"source": "github",
"line_count": 67,
"max_line_length": 152,
"avg_line_length": 33.298507462686565,
"alnum_prop": 0.6629314208874943,
"repo_name": "Wangjianyong/mailer-beebee",
"id": "45084c69de49e416bab60e9270092f0365bd91b8",
"... |
from logging import getLogger
from multiprocessing import Queue
from .log_configures import configure_logger
def log_listener_process(queue: Queue, log_level: int, echo: bool, file_log: bool, file_path: str, prefix: str):
"""
Configure logger at LogListenerProcess. Get log data from Queue, and handle it.
... | {
"content_hash": "bf9522c20587755b523aca6c0ddd4270",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 112,
"avg_line_length": 34.03030303030303,
"alnum_prop": 0.6268922528940338,
"repo_name": "pddg/qkouserver",
"id": "c48a740cd98babf19044efe1499880cc780af724",
"size": "1243... |
"""
Copyright 2012 Ali Ok (aliokATapacheDOTorg)
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 to in wr... | {
"content_hash": "c63160809885c5eda1fd803c276da1da",
"timestamp": "",
"source": "github",
"line_count": 902,
"max_line_length": 191,
"avg_line_length": 73.31818181818181,
"alnum_prop": 0.6536827302556969,
"repo_name": "aliok/trnltk",
"id": "55545b5853e9983dd1c85c8c304edbc57d532c38",
"size": "66269"... |
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
sys.path.insert(0, os.path.abspath('..'))
import cdrouter
# -- General configuration ------------------------------------------------
# I... | {
"content_hash": "9ce5b1105cc29812a0c982cac3762dd7",
"timestamp": "",
"source": "github",
"line_count": 142,
"max_line_length": 79,
"avg_line_length": 30.161971830985916,
"alnum_prop": 0.6672892832127014,
"repo_name": "qacafe/cdrouter.py",
"id": "9d7f8f77186f475d2dd797171d110024c876e03f",
"size": "... |
from django.db import connections
from django.db.models.manager import Manager as DJManager
import re
import copy
from .utils import dict_keys_to_str
try:
from django.core.exceptions import MultipleObjectsReturned, ObjectDoesNotExist
except ImportError:
class ObjectDoesNotExist(Exception):
pass
cla... | {
"content_hash": "8cf50610d535017bbf30db3a23d58478",
"timestamp": "",
"source": "github",
"line_count": 905,
"max_line_length": 180,
"avg_line_length": 38.37237569060773,
"alnum_prop": 0.5530566993981628,
"repo_name": "aparo/django-elasticsearch",
"id": "78d2e13e2a371a9e7f6e5bf367303c45006f8e78",
"... |
from msrest.serialization import Model
class OperationDisplay(Model):
"""The object that represents the operation.
Variables are only populated by the server, and will be ignored when
sending a request.
:ivar provider: Service provider: Microsoft.Billing.
:vartype provider: str
:ivar resourc... | {
"content_hash": "559e35714f8aae2d4a26cc90b2a9e631",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 74,
"avg_line_length": 29.257142857142856,
"alnum_prop": 0.60546875,
"repo_name": "lmazuel/azure-sdk-for-python",
"id": "0dcad2d20d02e381f150e5c62b3ac354602314cd",
"size": ... |
import json
import pkgutil
import unittest2
import openerp.modules.registry
import openerp
from openerp.tests import common
from openerp.tools.misc import mute_logger
def message(msg, type='error', from_=0, to_=0, record=0, field='value', **kwargs):
return dict(kwargs,
type=type, rows={'from': fr... | {
"content_hash": "9d268a84c602dbb1e2dc80ec9bdf69bc",
"timestamp": "",
"source": "github",
"line_count": 1176,
"max_line_length": 94,
"avg_line_length": 38.00765306122449,
"alnum_prop": 0.5299460813924872,
"repo_name": "chjw8016/GreenOdoo7-haibao",
"id": "0afbf6f49c3fe319aaab2971d49dfdc10dacbf40",
"... |
import pytest
from unittest import TestCase
import bigdl.nano.automl as nano_automl
class TestGlobalConfig(TestCase):
def test_disable_automl(self):
nano_automl.hpo_config.disable_hpo_pytorch()
pass
def test_enable_automl(self):
nano_automl.hpo_config.enable_hpo_pytorch()
pas... | {
"content_hash": "d8e960ebd49a965dcee19e1dba5fcd91",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 52,
"avg_line_length": 19.94736842105263,
"alnum_prop": 0.6596306068601583,
"repo_name": "intel-analytics/BigDL",
"id": "47f74025ead7ee5701714132c8b9d2ce05a04ce8",
"size": ... |
from helper import TestHelper
class TestJumpPrevOffsetIndent(TestHelper):
def command(self):
return 'jump_prev_indent'
def test_positive_indent_offset(self):
lines = [
' Lorem ipsum dolor sit amet',
'',
'Lorem ipsum dolor sit amet',
'Lorem ipsum dolor sit amet'
]
starting_... | {
"content_hash": "24e43d612ef6fefd743b0045d1432b1e",
"timestamp": "",
"source": "github",
"line_count": 51,
"max_line_length": 87,
"avg_line_length": 28.11764705882353,
"alnum_prop": 0.6366806136680614,
"repo_name": "mwean/sublime_jump_along_indent",
"id": "f453363aad094c4529cc3fca4c7eac98dad2b57c",
... |
import datetime
from oslo.config import cfg
from oslo.serialization import jsonutils
import webob
from nova.api.openstack.compute import plugins
from nova.api.openstack.compute.plugins.v3 import servers as servers_v21
from nova.api.openstack.compute import servers as servers_v2
from nova.api.openstack import extensio... | {
"content_hash": "d64d1f8ebdc1aad18bd397e687994581",
"timestamp": "",
"source": "github",
"line_count": 239,
"max_line_length": 79,
"avg_line_length": 38.66945606694561,
"alnum_prop": 0.6118805453365073,
"repo_name": "shakamunyi/nova",
"id": "5c2a42526fb84a38f94447200ac46752e3beb9ec",
"size": "9878... |
from dataclasses import dataclass
from typing import Tuple
from pants.backend.python.lint.flake8.subsystem import Flake8, Flake8FieldSet
from pants.backend.python.util_rules import pex
from pants.backend.python.util_rules.interpreter_constraints import InterpreterConstraints
from pants.backend.python.util_rules.pex im... | {
"content_hash": "cb3f77408ba674cd1b7070e4f311e586",
"timestamp": "",
"source": "github",
"line_count": 109,
"max_line_length": 97,
"avg_line_length": 39.48623853211009,
"alnum_prop": 0.7184014869888475,
"repo_name": "patricklaw/pants",
"id": "ad757e2e3056f4697082c02b2a1f25e2b67429f6",
"size": "443... |
from settings.base import rel
CONTEXT_PROCESSORS = (
'django.contrib.auth.context_processors.auth',
'django.core.context_processors.request',
'django.core.context_processors.debug',
'django.core.context_processors.i18n',
'django.core.context_processors.media',
'django.core.context_processors.st... | {
"content_hash": "5e85adbeb1e40ccd290a2921564d097e",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 69,
"avg_line_length": 28.88,
"alnum_prop": 0.6412742382271468,
"repo_name": "skylifewww/pangolinland",
"id": "499a5d7d6433f7447ef43d6d0a7e49769f1968cd",
"size": "722",
"... |
"""race dataset."""
import tensorflow_datasets.public_api as tfds
from tensorflow_datasets.text.race import race
class RaceTest(tfds.testing.DatasetBuilderTestCase):
"""Tests for race dataset."""
DATASET_CLASS = race.Race
BUILDER_CONFIG_NAMES_TO_TEST = ["high"]
SPLITS = {
"train": 1, # Number of fake ... | {
"content_hash": "58ab92242bee4a550ea072291baf4980",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 52,
"avg_line_length": 25.68421052631579,
"alnum_prop": 0.6598360655737705,
"repo_name": "tensorflow/datasets",
"id": "2b538cdf0bdfdc830b7703b2f26f333fcbfc11da",
"size": "1... |
from cel import cli
def test_main_has_all_commands_registered():
for command in ['build', 'build_runner', 'start', 'run', 'templates']:
assert command in cli.main.commands
| {
"content_hash": "3ade4ce6c560811c0d22a694cea9334d",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 74,
"avg_line_length": 31,
"alnum_prop": 0.6774193548387096,
"repo_name": "a-musing-moose/cel",
"id": "70ea728fd72e12d2381b5c5db6ada6eb565ad2d5",
"size": "186",
"binary": ... |
import os, sys, mobilesdk
import shutil, time, json
import xml.dom.minidom
class PluginsTest(mobilesdk.MobileSDKTest):
# Tests TIMOB-4903, and "compile" for external build plugins
def testPluginFunctions(self):
self.createProject("pluginTest", "android")
testPlugin = os.path.join(os.path.dirname(os.path.abspath... | {
"content_hash": "b7b6269703a698b3a6f48ea56929b703",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 105,
"avg_line_length": 37.95348837209303,
"alnum_prop": 0.7340686274509803,
"repo_name": "hieupham007/Titanium_Mobile",
"id": "2a1312686e6e1305aca9a988646db3dbabed3e8d",
"... |
import pytest
def test_sub_container():
import pyctrl
import pyctrl.block as block
from pyctrl.block.container import Container, Input, Output, ContainerException
from pyctrl.block.system import Gain, DTTF
container = Container()
container.add_signals('s1', 's2', 's3')
# add subcon... | {
"content_hash": "7fa4c08f8c88665ca3a18cba32e629fc",
"timestamp": "",
"source": "github",
"line_count": 211,
"max_line_length": 83,
"avg_line_length": 31.43127962085308,
"alnum_prop": 0.5149276236429433,
"repo_name": "mcdeoliveira/pyctrl",
"id": "4520788d59989fb5223f7f124620afa79d5e647e",
"size": "... |
from urllib import unquote
from amgut.lib.mail import send_email
from amgut.handlers.base_handlers import BaseHandler
from amgut.connections import ag_data
from amgut import text_locale
class ChangePassVerifyHandler(BaseHandler):
def get(self):
email = self.get_argument('email', None)
if email i... | {
"content_hash": "976b948239bf75f5773e633cc78cf4b9",
"timestamp": "",
"source": "github",
"line_count": 61,
"max_line_length": 73,
"avg_line_length": 43.09836065573771,
"alnum_prop": 0.5701787751996957,
"repo_name": "mortonjt/american-gut-web",
"id": "a3a20ac7db9fae58107c68a7a799f7f4db4c178d",
"siz... |
from django.apps import AppConfig
from django.utils.translation import ugettext_lazy as _
from . import checks # NOQA
class WagtailAdminAppConfig(AppConfig):
name = 'wagtail.admin'
label = 'wagtailadmin'
verbose_name = _("Wagtail admin")
| {
"content_hash": "56fb7dcac1483569d86b40cf2c005f66",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 55,
"avg_line_length": 25.4,
"alnum_prop": 0.7322834645669292,
"repo_name": "nealtodd/wagtail",
"id": "a5536a9b5d4e046560b24686152504e826e6f8cf",
"size": "254",
"binary":... |
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
# Importing the dataset
dataset = pd.read_csv('Churn_Modelling.csv')
X = dataset.iloc[:, 3:13].values
y = dataset.iloc[:, 13].values
# Encoding categorical data
from sklearn.preprocessing import LabelEncoder, OneHotEncoder
labelencoder_X_1 = Label... | {
"content_hash": "ca68b288feb21581ac728569ed255e5a",
"timestamp": "",
"source": "github",
"line_count": 63,
"max_line_length": 101,
"avg_line_length": 32.22222222222222,
"alnum_prop": 0.741871921182266,
"repo_name": "balazssimon/ml-playground",
"id": "57a3d13ae9b990c361bf66228d27405f012041ea",
"siz... |
import math, random, re
from collections import defaultdict, Counter, deque
from linear_algebra import dot, get_row, get_column, make_matrix, magnitude, scalar_multiply, shape, distance
from functools import partial
users = [
{ "id": 0, "name": "Hero" },
{ "id": 1, "name": "Dunn" },
{ "id": 2, "name": "Sue... | {
"content_hash": "ff32d03d5333d481b0f0a3e7b5142c85",
"timestamp": "",
"source": "github",
"line_count": 228,
"max_line_length": 109,
"avg_line_length": 30.69298245614035,
"alnum_prop": 0.5885967419262647,
"repo_name": "joelgrus/data-science-from-scratch",
"id": "f9c7142e4f4f8cd4906c25697722cc504d4246... |
"""
CP FireEye Dynamic analysis endpoint
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"""
from flask_jsonschema import validate
from app.api.analysis.fireeye import process_add_fireeye_url_analysis, process_get_fireeye_analysis, \
process_get_fireeye_report, process_add_fireeye_analysis, process_get_fireeye_envir... | {
"content_hash": "349fd899f0b5baf985209ab667e254eb",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 102,
"avg_line_length": 33.166666666666664,
"alnum_prop": 0.7110552763819096,
"repo_name": "certeu/do-portal",
"id": "58a63830369dbf29d7cff77348a7f9b5dc4f74ba",
"size": "11... |
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 conf... | {
"content_hash": "0cb60c52cb0ab08578df8188b39572ad",
"timestamp": "",
"source": "github",
"line_count": 338,
"max_line_length": 83,
"avg_line_length": 32.218934911242606,
"alnum_prop": 0.7081726354453627,
"repo_name": "torreco/django-oidc-provider",
"id": "1d0828f02f3a2bf35bb457c3c320cb1c6c81e9af",
... |
"""This module defines handlers for InvalidUsage exceptions defined in common package
Note that to use the error handlers, you must import them
"""
from flask import jsonify
from servmon.api import api_blueprint
from servmon.common import invalid_usage
@api_blueprint.errorhandler(invalid_usage.InvalidUsage)
def h... | {
"content_hash": "7fa3b9fdb414120089ae454b80d0c3c7",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 85,
"avg_line_length": 28.40909090909091,
"alnum_prop": 0.7376,
"repo_name": "hpsuenaa/servmon",
"id": "f6607c1bb066bc47f3c2fc85e5b67082e370e27c",
"size": "625",
"binary"... |
from wallace.db.base.sql.model import SqlModel
class PostgresModel(SqlModel):
pass
| {
"content_hash": "b482442cf1742143e688e38236b12dd2",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 46,
"avg_line_length": 17.8,
"alnum_prop": 0.7752808988764045,
"repo_name": "csira/wallace",
"id": "77f2cd176fb4e4c6cdb19c01f2a8054da7a2c365",
"size": "89",
"binary": fals... |
from .homogeneous import Translation, UniformScale, Rotation, Similarity
def scale_about_centre(obj, scale):
r"""
Return a Homogeneous Transform that implements scaling an object about
its centre. The given object must be transformable and must implement
a method to provide the object centre.
Par... | {
"content_hash": "65d334ce6022dbdc2552ea6dfbb15416",
"timestamp": "",
"source": "github",
"line_count": 62,
"max_line_length": 78,
"avg_line_length": 35.564516129032256,
"alnum_prop": 0.6839002267573696,
"repo_name": "mozata/menpo",
"id": "3843226cb6651205a208a71932dd0167d3124b4c",
"size": "2205",
... |
import smtplib
from email.mime.text import MIMEText
class PrintAction:
def execute(self, content):
print(content)
class EmailAction:
"""Send an email when a rule is matched"""
from_email = "alerts@stocks.com"
def __init__(self, to):
self.to_email = to
def execute(self, content)... | {
"content_hash": "e000809d5a864eef448262e598f15986",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 47,
"avg_line_length": 24.23076923076923,
"alnum_prop": 0.5920634920634921,
"repo_name": "DanielFrank/test_driven_python",
"id": "bb436ceccdb1979a22a8d5c7052f8e6ead08b461",
... |
import sys
from random import choice as randchoice
from itertools import cycle
from board import Loc, Board
size = 3
blank = '.'
players = 'XO'
class TictactoeBoard(Board):
def filled(self):
return not any(tile==blank for tile in self)
def random_blank(self):
blank_locs = [loc for loc ... | {
"content_hash": "14645ce0742e7e6fd8b5fa947ca53e4c",
"timestamp": "",
"source": "github",
"line_count": 66,
"max_line_length": 93,
"avg_line_length": 26.818181818181817,
"alnum_prop": 0.5745762711864407,
"repo_name": "akulakov/simple-games",
"id": "1e2f86931c5cb678bafc96bb5d4adb9be9201ced",
"size":... |
import numpy
import math
def sky_median_sig_clip(input_arr, sig_fract, percent_fract, max_iter=100):
"""Estimating sky value for a given number of iterations
@type input_arr: numpy array
@param input_arr: image data array
@type sig_fract: float
@param sig_fract: fraction of sigma clipping
@type percent_fract: ... | {
"content_hash": "964d3e8591d6263ac3bc71187ef5bd80",
"timestamp": "",
"source": "github",
"line_count": 206,
"max_line_length": 92,
"avg_line_length": 29.179611650485437,
"alnum_prop": 0.7038762269173182,
"repo_name": "bamford/astrobamf",
"id": "738e7ea9c528e9b0e08a03aa3a0abc946f4c1db4",
"size": "6... |
from core import Tile
import json
from random import randrange
from ds import WUF, isValidSequence
# import pdb
def loadTiles():
f = open('data/tiles.json')
tiles = json.load(f)
tileArr = []
# print tiles['freq']
for (l, f) in tiles['freq'].iteritems():
score = tiles['scores'][l]
fo... | {
"content_hash": "74cb06d6759e57b994639247192174e3",
"timestamp": "",
"source": "github",
"line_count": 420,
"max_line_length": 118,
"avg_line_length": 32.16428571428571,
"alnum_prop": 0.4641350210970464,
"repo_name": "deostroll/sengine",
"id": "702c74c94478bb82021d361ca44cd30a205421b8",
"size": "1... |
"""Parse an EXPRESS file and extract basic information on all
entities and data types contained"""
import sys
import re
from collections import OrderedDict
re_match_entity = re.compile(r"""
ENTITY\s+(\w+)\s* # 'ENTITY foo'
.*? # skip... | {
"content_hash": "6af701d2c40ca61d11e846ce0926b569",
"timestamp": "",
"source": "github",
"line_count": 81,
"max_line_length": 118,
"avg_line_length": 35.97530864197531,
"alnum_prop": 0.5425531914893617,
"repo_name": "google/filament",
"id": "c2a39e70b812a4510fcba07b33f63129c1efcc5d",
"size": "4865... |
from collections import OrderedDict
import inspect
from typing import List
from torchmetrics.metric import Metric
import pytorch_lightning as pl
from torch import nn, Tensor, fx
from torch.nn.modules.loss import _Loss
from torch.optim import Optimizer
from torch.optim.lr_scheduler import _LRScheduler
from bigdl.nano.u... | {
"content_hash": "acc88120dcd37fff386fda0f8eb3ca71",
"timestamp": "",
"source": "github",
"line_count": 136,
"max_line_length": 90,
"avg_line_length": 38.49264705882353,
"alnum_prop": 0.606494746895893,
"repo_name": "yangw1234/BigDL",
"id": "362c0d29318a7df490ab783f943a15e105006a67",
"size": "5821"... |
from twilio.rest import TwilioRestClient
# Credentials owner: yklal95@gmail.com
# Find these values at https://twilio.com/user/account
account_sid = "ACe464c41a9b742a67a494ae0b08fd6a7c"
auth_token = "8473ba13daed9e9f7a3d8fe2cb20941d"
client = TwilioRestClient(account_sid, auth_token)
message = client.messages.create(... | {
"content_hash": "e8bf7b0da3e55ed185333504abafcf91",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 73,
"avg_line_length": 39.72727272727273,
"alnum_prop": 0.7345537757437071,
"repo_name": "jiteshjha/hello_friend",
"id": "5188c05d5d24e28b1883db988d2acc6f963fd6b7",
"size":... |
"""Interact with Stackdriver Error Reporting via Logging API.
It's possible to report Stackdriver Error Reporting errors by formatting
structured log messages in Stackdriver Logging in a given format. This
client provides a mechanism to report errors using that technique.
"""
import google.cloud.logging.client
clas... | {
"content_hash": "0cd115508ce835d4babe2ebc76513730",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 83,
"avg_line_length": 44.145833333333336,
"alnum_prop": 0.6460594620103822,
"repo_name": "ammarkhann/FinalSeniorCode",
"id": "d8bd7a12a4771ecae42a01a83b9e0ad6cfc5e4c3",
"s... |
import os
import unittest2 as unittest
from mock import patch, ANY
import liquipy
from liquipy.executor import Executor as LiquibaseExecutor
class LiquipySampleTest(unittest.TestCase):
def setUp(self):
self.pathToChangelog = os.path.realpath(os.path.join(
os.path.dirname(__file__),
"../../sample/c... | {
"content_hash": "555242f1965dd3ddc55651a505266071",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 80,
"avg_line_length": 30.027027027027028,
"alnum_prop": 0.7047704770477048,
"repo_name": "oxtopus/liquipy",
"id": "e14114684e9f4b64625202a97a6988b5e8f58224",
"size": "1111... |
"""
This module provides code to work with the enzyme.dat file from
Enzyme.
http://www.expasy.ch/enzyme/
Tested with the release of 03-Mar-2009.
Functions:
read Reads a file containing one ENZYME entry
parse Reads a file containing multiple ENZYME entries
Classes:
Record Holds ENZYME data.
"""
def p... | {
"content_hash": "f6f044928370980a961e9034b324586f",
"timestamp": "",
"source": "github",
"line_count": 142,
"max_line_length": 70,
"avg_line_length": 29.260563380281692,
"alnum_prop": 0.49458483754512633,
"repo_name": "LyonsLab/coge",
"id": "cdd0f7616544b10bee233697c0f602a9f166661c",
"size": "4440... |
import rdtest
import renderdoc as rd
class VK_Buffer_Truncation(rdtest.Buffer_Truncation):
demos_test_name = 'VK_Buffer_Truncation'
internal = False | {
"content_hash": "d96d307e55a9a103f092e0e623eea6b6",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 53,
"avg_line_length": 22.571428571428573,
"alnum_prop": 0.759493670886076,
"repo_name": "Zorro666/renderdoc",
"id": "a1613e61e69f58e4f7a42ad075ebdcce0df1a151",
"size": "158... |
import generateData, configureDS, schema, config, build, deploy, starter, interactive, sys
# Configuration dictionary
d = config.getConfigDir()
# MAIN PROGRAM
d = interactive.collectConfigs(d)
if not d[config.IS_CONFIG_OK]:
print 'Configuration is invalid, exit OX Platform setup!'
sys.exit()
# generate ldap... | {
"content_hash": "3517c6ca620d312db6cabcd35d8afc18",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 90,
"avg_line_length": 27.53191489361702,
"alnum_prop": 0.6939721792890263,
"repo_name": "GluuFederation/install",
"id": "34e02f6881868bf8ed26815b522d5e38ccd18c25",
"size":... |
from .xkcd_rgb import xkcd_rgb # noqa: F401
from .crayons import crayons # noqa: F401
| {
"content_hash": "20442aae8ecd8d947a6eb55eb7127909",
"timestamp": "",
"source": "github",
"line_count": 2,
"max_line_length": 44,
"avg_line_length": 44,
"alnum_prop": 0.7272727272727273,
"repo_name": "arokem/seaborn",
"id": "3d0bf1d56bdc5c0e724c8eeb95200297884337cc",
"size": "88",
"binary": false... |
from cyder.api.v1.endpoints.dns import api
from cyder.cydns.txt.models import TXT
class TXTSerializer(api.CommonDNSSerializer, api.LabelDomainMixin):
class Meta(api.CommonDNSMeta):
model = TXT
class TXTViewSet(api.CommonDNSViewSet):
model = TXT
serializer_class = TXTSerializer
| {
"content_hash": "dccf66cd92a244e5ff50679f22988083",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 67,
"avg_line_length": 25.166666666666668,
"alnum_prop": 0.7582781456953642,
"repo_name": "akeym/cyder",
"id": "114ca22d7d87d279d941dfa157ad50680c296b4d",
"size": "302",
... |
import unittest
import os
from unittest import TextTestResult
from django.test.runner import DiscoverRunner
from django.db import NotSupportedError
from djangae.utils import find_project_root
from google.appengine.ext import testbed
# Many Django tests require saving instances with a PK
# of zero. App Engine doesn... | {
"content_hash": "d9519950340617fe626d301816b4ba9d",
"timestamp": "",
"source": "github",
"line_count": 182,
"max_line_length": 123,
"avg_line_length": 39.42857142857143,
"alnum_prop": 0.6782329988851727,
"repo_name": "asendecka/djangae",
"id": "cdd4897537feca1f095b2f3585ce1b04dba270ba",
"size": "7... |
"""
Tests whether a file (in .csv format) with each line, consisting of data about a single student,
is anonymous with to a particular level of k.
This program will take a set of fields in each line (hard coded, at the moment) and will check to
insure that there are at least k other lines with the same values for thos... | {
"content_hash": "378f209fe6386ce199ebc01904c3ea0b",
"timestamp": "",
"source": "github",
"line_count": 103,
"max_line_length": 100,
"avg_line_length": 38.77669902912621,
"alnum_prop": 0.670756134201302,
"repo_name": "jimwaldo/HarvardX-Tools",
"id": "66482d616c2c3705115b41e4e9d6d556b5e3bb62",
"size... |
import random
class ZobristHashing(object):
def __init__(self, n_positions, n_pieces):
size = n_positions * n_pieces
self.table = [random.getrandbits(32) for i in range(size)]
self.n_positions = n_positions
self.n_pieces = n_pieces
def __call__(self, board):
result = ... | {
"content_hash": "6d18e418a014defd6d855ebe8263260a",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 66,
"avg_line_length": 28.529411764705884,
"alnum_prop": 0.5608247422680412,
"repo_name": "davidrobles/mlnd-capstone-code",
"id": "89becad5fb308fb97228e3d53e2a1697fc407d63",
... |
def makeBar(progress):
# Get the progress in half for a shorter progress bar
shortProgress = progress/2
# Convert progress to a string while we are at it
progressString = str(progress)
# Get the amount of "done" progress, or the % of 100%
doneProgress = int(shortProgress)
# Get the reverse ... | {
"content_hash": "c43a105833290f345a05d95c4de6880c",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 81,
"avg_line_length": 37.888888888888886,
"alnum_prop": 0.6891495601173021,
"repo_name": "StarbotDiscord/Starbot",
"id": "6d8f3bcc639a56a123fd3b64b98a67c8b798434c",
"size"... |
"""
__Trigger01ExprPart1_Complete_MDL.py_____________________________________________________
Automatically generated AToM3 Model File (Do not modify directly)
Author: gehan
Modified: Sun Mar 1 20:50:52 2015
_________________________________________________________________________________________
"""
from stickylink ... | {
"content_hash": "3d7bc66ddbfd1307b2703dc21f4aa499",
"timestamp": "",
"source": "github",
"line_count": 146,
"max_line_length": 626,
"avg_line_length": 47.657534246575345,
"alnum_prop": 0.6325093417648749,
"repo_name": "levilucio/SyVOLT",
"id": "41f389a3f6e6873e3435a015344848104de4813f",
"size": "6... |
from html import escape
from wptserve.utils import isomorphic_decode
def main(request, response):
label = request.GET.first(b'label')
return u"""<!doctype html><meta charset="%s">""" % escape(isomorphic_decode(label))
| {
"content_hash": "53fcc43d3da17394250cea9e195d18de",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 87,
"avg_line_length": 32.57142857142857,
"alnum_prop": 0.7192982456140351,
"repo_name": "chromium/chromium",
"id": "15edff7061f96b6f40fe42f6c4c09d3cdc07b643",
"size": "228"... |
import argparse
import fileinput
import io
import shutil
import subprocess
GIT = shutil.which("git")
def update_file(file, lineno, old, new):
"""
Replace all occurrences of the old substring by the new substring.
:param file: The file to update.
:param lineno: The line number to update.
:param o... | {
"content_hash": "eefcaf2cfca3478dbfa6999aa2dfeea8",
"timestamp": "",
"source": "github",
"line_count": 146,
"max_line_length": 118,
"avg_line_length": 32.08904109589041,
"alnum_prop": 0.568196371398079,
"repo_name": "MarkEWaite/jenkins",
"id": "044d441a935e1ac7204ea4616fac2cafe2d6e6d3",
"size": "4... |
from werkzeug import FileStorage
from wtforms import FileField as _FileField
from wtforms import ValidationError
class FileField(_FileField):
"""
Werkzeug-aware subclass of **wtforms.FileField**
Provides a `has_file()` method to check if its data is a FileStorage
instance with an actual file.
"""... | {
"content_hash": "10fc128c3f8e1ea46618a148f0f4a438",
"timestamp": "",
"source": "github",
"line_count": 79,
"max_line_length": 78,
"avg_line_length": 29.050632911392405,
"alnum_prop": 0.6200435729847494,
"repo_name": "midma101/AndIWasJustGoingToBed",
"id": "a61cacb658eb909d41a1147a8bb24b102c957f74",
... |
"""Tests for learn.estimators.tensor_signature."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow as tf
from tensorflow.contrib.learn.python.learn.estimators import tensor_signature
class TensorSignatureTest(tf.test.TestCase):
def ... | {
"content_hash": "aebe01d45c302777d331d3e485db2537",
"timestamp": "",
"source": "github",
"line_count": 91,
"max_line_length": 78,
"avg_line_length": 47.175824175824175,
"alnum_prop": 0.5949219659911483,
"repo_name": "ninotoshi/tensorflow",
"id": "bd1e18bd8d96d996e47afe845222cf11008e702d",
"size": ... |
"""log_this_plus
Revision ID: 525c854f0005
Revises: e46f2d27a08e
Create Date: 2016-12-13 16:19:02.239322
"""
# revision identifiers, used by Alembic.
revision = '525c854f0005'
down_revision = 'e46f2d27a08e'
from alembic import op
import sqlalchemy as sa
def upgrade():
op.add_column('logs', sa.Column('duration... | {
"content_hash": "8b090e47ab02ce0eaf3b212ec9036abe",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 87,
"avg_line_length": 22.666666666666668,
"alnum_prop": 0.7058823529411765,
"repo_name": "dmigo/incubator-superset",
"id": "1db3f5c76006a7f8ca22d5bd39f36faa9dec116d",
"siz... |
import copy, json, os, sys
from bs4 import BeautifulSoup as bs4
content_file = sys.argv[1]
menu_content = file(sys.argv[2])
content = bs4(file(content_file), 'lxml')
for menu_container in content.select('.static-menu'):
menu_container.clear()
menu_container.append(bs4(menu_content, 'html.parser'))
file(con... | {
"content_hash": "0deef5aeec16bb19448fdb7fe24b90e6",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 65,
"avg_line_length": 27,
"alnum_prop": 0.7116402116402116,
"repo_name": "emkael/pzbs-ranking",
"id": "e30c702d19f33b3cc48d51ecebee5281da36751e",
"size": "378",
"binary"... |
__all__ = ['register', 'sharedPackages',
'reloadSharedPackage', 'reloadSharedPackages']
from panda3d._core import Filename, VirtualFileSystem, VirtualFileMountSystem, OFileStream, copyStream
import sys
import marshal
import imp
import types
import __builtin__
# The sharedPackages dictionary lists all of th... | {
"content_hash": "cba398bd7fedeeb3b248bc2443049a69",
"timestamp": "",
"source": "github",
"line_count": 524,
"max_line_length": 121,
"avg_line_length": 36.38358778625954,
"alnum_prop": 0.5791765014424338,
"repo_name": "matthiascy/panda3d",
"id": "16b1ac4becc2e4417ef33dd79898ee0af369a06b",
"size": "... |
import optproblems.cec2005
import numpy as np
import time
from POA import *
import os
if __name__ == "__main__":
dim = 10
repeats = 10
evaluations = 10000*dim
parties = 6
members = 5
candidates = 2
if not os.path.exists('results'):
os.makedirs('results')
if not os.path.exists(... | {
"content_hash": "21d4bc4b59796bac4e9163837216bae8",
"timestamp": "",
"source": "github",
"line_count": 159,
"max_line_length": 97,
"avg_line_length": 35.76100628930818,
"alnum_prop": 0.5861765740415055,
"repo_name": "JJSrra/Research-SocioinspiredAlgorithms",
"id": "f7a7a1526d4a6a08c76e3cd615dc58c4d2... |
from datapackage_pipelines_knesset.common.processors.base_processor import BaseProcessor
import logging
class DumpFields(BaseProcessor):
def __init__(self, *args, **kwargs):
super(DumpFields, self).__init__(*args, **kwargs)
self._schema = self._parameters.get("schema")
def _process(self, dat... | {
"content_hash": "244b4515fd3b0959502d71aced49884c",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 88,
"avg_line_length": 27.848484848484848,
"alnum_prop": 0.5854189336235038,
"repo_name": "hasadna/knesset-data-pipelines",
"id": "caff143f1f967b5929f1be2f836edab2e11f21b4",
... |
"""
Sales: Hardtree module definition
"""
PROPERTIES = {
'title': 'Sales & Stock',
'details': 'Sales and Client Relationship Management',
'url': '/sales/',
'system': False,
'type': 'major'
}
URL_PATTERNS = [
'^/sales/',
]
# Temporarily disabled cron due to failing .currency setting
# from tre... | {
"content_hash": "ed47f0cf4ce1bd55f217b6014fc26287",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 60,
"avg_line_length": 20.57894736842105,
"alnum_prop": 0.649616368286445,
"repo_name": "thiagof/treeio",
"id": "eb88abb6ac63bac07550f64a9ff40246fbcbd3ac",
"size": "504",
... |
__author__ = 'jh'
__copyright__ = 'www.codeh.de'
from django.views.generic.list import ListView
from django.shortcuts import redirect
from .models import AlertMessage
class AlertsView(ListView):
template_name = 'alert-list.html'
def get_queryset(self):
self.alerts = AlertMessage.objects.all().order... | {
"content_hash": "39ecda30b33c7f6db54a435611c8be31",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 68,
"avg_line_length": 24.392857142857142,
"alnum_prop": 0.6749633967789166,
"repo_name": "jhcodeh/my-doku",
"id": "57da5af98acbab6eb08526ba50d143174e2e299b",
"size": "707"... |
"""
Views for managing Quantum networks.
"""
import logging
import warnings
from django import shortcuts
from django import template
from django.contrib import messages
from django.contrib.auth.decorators import login_required
from django.utils.translation import ugettext as _
from horizon import api
from horizon.da... | {
"content_hash": "c33ce6a0ee45a6e68efb065b1cae6ed5",
"timestamp": "",
"source": "github",
"line_count": 194,
"max_line_length": 78,
"avg_line_length": 37.18556701030928,
"alnum_prop": 0.5381203215968949,
"repo_name": "usc-isi/horizon-old",
"id": "747511a85dd8ccec75ce8083af3773acd3db151e",
"size": "... |
"""Tests for tensorflow.ops.gradients."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import warnings
import numpy as np
from tensorflow.contrib.compiler import jit
from tensorflow.python.framework import constant_op
from tensorflow.python.framework i... | {
"content_hash": "45567b6cd8ee5ea1abe6fa8e8c0c0ee4",
"timestamp": "",
"source": "github",
"line_count": 598,
"max_line_length": 84,
"avg_line_length": 38.10200668896321,
"alnum_prop": 0.6381391266183893,
"repo_name": "handroissuazo/tensorflow",
"id": "453313b4ac3223666d4277d99a909c05a7547cfc",
"siz... |
import dbus.service
from gi.repository import GObject as gobject
from oacids.helpers.dbus_props import GPropSync, Manager, WithProperties
from ifaces import BUS, IFACE, PATH, INTROSPECTABLE_IFACE, TRIGGER_IFACE, OPENAPS_IFACE
from oacids.schedules import utils
import datetime
from dateutil import parser, rrule, tz
im... | {
"content_hash": "f32f081e1f4bafd4d6a6bc2573dbece3",
"timestamp": "",
"source": "github",
"line_count": 325,
"max_line_length": 168,
"avg_line_length": 35.91692307692308,
"alnum_prop": 0.6497901139381479,
"repo_name": "openaps/oacids",
"id": "80a0a845f4c1891eba4454a2d81d1fff2f6a1066",
"size": "1167... |
"""
Plugins to add behavior to mpld3 charts
=======================================
Plugins are means of adding additional javascript features to D3-rendered
matplotlib plots. A number of plugins are defined here; it is also possible
to create nearly any imaginable behavior by defining your own custom plugin.
"""
__... | {
"content_hash": "ec2f3d5063a57238572551887434074c",
"timestamp": "",
"source": "github",
"line_count": 841,
"max_line_length": 207,
"avg_line_length": 37.28537455410226,
"alnum_prop": 0.5414739930478043,
"repo_name": "etgalloway/mpld3",
"id": "6bffeef53ee47e5c1f7314e8c378d27ec1b54fec",
"size": "31... |
import os
import logging
from typing import Callable, Dict, Type
from filelock import FileLock
import ray
from ray import tune
from ray.tune.resources import Resources
from ray.tune.trainable import TrainableUtil
from ray.tune.result import RESULT_DUPLICATE
from ray.tune.logger import NoopLogger
from ray.tune.functi... | {
"content_hash": "9948ef630655b16fa6fe9a95b3867f22",
"timestamp": "",
"source": "github",
"line_count": 229,
"max_line_length": 77,
"avg_line_length": 34.519650655021834,
"alnum_prop": 0.6376976597090449,
"repo_name": "robertnishihara/ray",
"id": "e3603de2b6e7bb941c32f6f714f659e203610759",
"size": ... |
from oslo.config import cfg
from designate.central import rpcapi
cfg.CONF.register_group(cfg.OptGroup(
name='service:api', title="Configuration for API Service"
))
cfg.CONF.register_opts([
cfg.IntOpt('workers', default=None,
help='Number of worker processes to spawn'),
cfg.StrOpt('api-base-... | {
"content_hash": "92d9df1aff640585af5a627cf32796d9",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 79,
"avg_line_length": 33.7,
"alnum_prop": 0.6439169139465876,
"repo_name": "richm/designate",
"id": "93f20b6a05dababe3fa41a16ebbda0cf4cbd9fc7",
"size": "1974",
"binary":... |
from __future__ import absolute_import
import os
import subprocess
from pip.vcs import subversion, git, bazaar, mercurial
from pip.backwardcompat import urlretrieve
from tests.lib import path_to_url
if hasattr(subprocess, "check_call"):
subprocess_call = subprocess.check_call
else:
subprocess_call = subproce... | {
"content_hash": "64bbfa42761421f910f2892546595b57",
"timestamp": "",
"source": "github",
"line_count": 84,
"max_line_length": 73,
"avg_line_length": 30.75,
"alnum_prop": 0.6531165311653117,
"repo_name": "Ivoz/pip",
"id": "a64d456b3d773955c50330f91898ca9862161b9f",
"size": "2583",
"binary": false... |
import os
import ssl
from oslo.config import cfg
from messager.common.gettextutils import _
ssl_opts = [
cfg.StrOpt('ca_file',
default=None,
help="CA certificate file to use to verify "
"connecting clients"),
cfg.StrOpt('cert_file',
default=No... | {
"content_hash": "f3169a49e7c78bfc4c092f0fac66485b",
"timestamp": "",
"source": "github",
"line_count": 84,
"max_line_length": 74,
"avg_line_length": 26.55952380952381,
"alnum_prop": 0.5889735544598834,
"repo_name": "snowflying/messager",
"id": "ee931912783c054fa12571474a6c69daa7146446",
"size": "2... |
from __future__ import absolute_import
import json
import re
import numpy as np
from common import ENV_ACTIONS, ENV_BOARD, ENV_ENTITIES, \
ENV_BOARD_SHAPE, ENV_AGENT_NAMES
from MalmoPython import MissionSpec
from malmopy.environment.malmo import MalmoEnvironment, MalmoStateBuilder
import os
class PigChaseSymb... | {
"content_hash": "5969b80d3aaf8f6387f2b9bf50d006d9",
"timestamp": "",
"source": "github",
"line_count": 272,
"max_line_length": 173,
"avg_line_length": 37.74264705882353,
"alnum_prop": 0.5349698032339762,
"repo_name": "village-people/flying-pig",
"id": "33484a02820ee9b1a6bcac1aa6dd08dc7a2daf4c",
"s... |
from __future__ import print_function
import os
import sys
import unittest
import coverage
testfolder = os.path.abspath(os.path.dirname(__file__))
package_root = os.path.abspath(os.path.join(testfolder, r"..\.."))
sys.path.append(package_root)
# needs to be called before importing the modules
cov = cov... | {
"content_hash": "69ba4cc803da08c504898981d985c8c8",
"timestamp": "",
"source": "github",
"line_count": 66,
"max_line_length": 104,
"avg_line_length": 29.196969696969695,
"alnum_prop": 0.6097560975609756,
"repo_name": "MagazinnikIvan/pywinauto",
"id": "5736c8d382b149f4566d273a86cdbede6cccf4c0",
"si... |
class CacheMixin(object):
'''
Tools to analyse direction of change for a given conditional.
'''
def store(self, field=None, nodes=None):
'''
store the cache for change analysis upon next iteration.
'''
field = field or getattr(self, 'field')
nodes = nodes or geta... | {
"content_hash": "858bc33f3db8a0923408fb9fd57956b5",
"timestamp": "",
"source": "github",
"line_count": 96,
"max_line_length": 65,
"avg_line_length": 25.21875,
"alnum_prop": 0.5138372573316812,
"repo_name": "Strangemother/python-state-machine",
"id": "2a72520c32579d1594f6ffe0c2bd68e5c82a3d1e",
"siz... |
"""SCons.Tool.tlib
XXX
"""
#
# Copyright (c) 2001 - 2014 The SCons Foundation
#
# 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 righ... | {
"content_hash": "492cacd6e284ae9de87d494f8405e9df",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 75,
"avg_line_length": 34.54716981132076,
"alnum_prop": 0.72200983069361,
"repo_name": "unix1986/scons",
"id": "7eedee8649572677e39b5d49221c5a361d2b98f5",
"size": "1831",
... |
import os,sys
from ftplib import FTP
from tempfile import mkdtemp
from shutil import rmtree
from http.client import HTTPConnection
from urllib.parse import urlsplit
def get_temp_dir(work_dir,prefix='temp'):
'''
This function returns a temporary directory
'''
try:
temp_dir=mkdtemp(prefix=prefix,dir=work_di... | {
"content_hash": "f0157b33205d50e2fdafbbd4b17af881",
"timestamp": "",
"source": "github",
"line_count": 83,
"max_line_length": 183,
"avg_line_length": 26.253012048192772,
"alnum_prop": 0.656264341441028,
"repo_name": "avikdatta/python_scripts",
"id": "8867f9cf124d784b9f64c9f2f903f4f0e4f074e5",
"siz... |
tests = r"""
>>> from django.forms import *
>>> from django.forms.widgets import RadioFieldRenderer
>>> from django.utils.safestring import mark_safe
>>> from django.utils import formats
>>> import datetime
>>> import time
>>> import re
>>> try:
... from decimal import Decimal
... except ImportError:
... from d... | {
"content_hash": "222defdd0a6d982a43f1667bc3d5dd93",
"timestamp": "",
"source": "github",
"line_count": 1310,
"max_line_length": 553,
"avg_line_length": 43.264885496183204,
"alnum_prop": 0.6282619051819962,
"repo_name": "t11e/django",
"id": "cc83a888cf12ba2d2276730a66a80cc90d4dac67",
"size": "56877... |
from __future__ import print_function
import requests
import time
from airflow.exceptions import AirflowException
from airflow.hooks.base_hook import BaseHook
class DruidHook(BaseHook):
"""
Connection to Druid
:param druid_ingest_conn_id: The connection id to the Druid overlord machine which accepts in... | {
"content_hash": "c58a27569119ab0053fa141fd08bff71",
"timestamp": "",
"source": "github",
"line_count": 78,
"max_line_length": 108,
"avg_line_length": 36.3974358974359,
"alnum_prop": 0.6114829165199014,
"repo_name": "cjqian/incubator-airflow",
"id": "655f66688d16bc4cce799ecd1bd2b9ce720c9c13",
"size... |
from datetime import date, datetime
from typing import Dict, List, Set, Tuple, Union
try:
from typing import TypedDict
except ImportError:
from typing_extensions import TypedDict
from robot.api.deco import not_keyword
not_keyword(TypedDict)
class Number:
pass
def string_to_int(value: str) -> int:
... | {
"content_hash": "503ed42ce6d3d48181684356ee5a56af",
"timestamp": "",
"source": "github",
"line_count": 179,
"max_line_length": 102,
"avg_line_length": 25.424581005586592,
"alnum_prop": 0.6060206548011426,
"repo_name": "robotframework/robotframework",
"id": "3102d98cf2909fc7da71afca9856a6e34c7a2f40",... |
import hues
from django.core.management.base import BaseCommand
from elasticsearch_dsl.connections import connections
from elasticsearch_flex.indexes import registered_indices
class Command(BaseCommand):
help = 'Sync search indices, templates, and scripts.'
def add_arguments(self, parser):
parser.a... | {
"content_hash": "b4478f48c55861a31661c5e1e2dee3b0",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 68,
"avg_line_length": 32.026315789473685,
"alnum_prop": 0.580115036976171,
"repo_name": "prashnts/dj-elasticsearch-flex",
"id": "44321cff440771f28fe8c2f692ea7f141cb78cc9",
... |
import logging
import time
import numpy as np
from basil.dut import Dut
chip = Dut("bdaq53_eth.yaml")
chip.init()
chip['CONTROL']['EN'] = 0
chip['CONTROL'].write()
logging.info("Starting data test ...")
chip['CONTROL']['EN'] = 1
chip['CONTROL'].write()
start = 0
for i in range(10):
time.sleep(1)
fifo_... | {
"content_hash": "90e530169d6122fa014d738dc3f3ed36",
"timestamp": "",
"source": "github",
"line_count": 59,
"max_line_length": 122,
"avg_line_length": 23.11864406779661,
"alnum_prop": 0.6151026392961877,
"repo_name": "SiLab-Bonn/basil",
"id": "340ec901b2cb71ddbd1ef43bbfae064469822615",
"size": "166... |
import os
import sys
import json
import traceback
import random
import math
import matplotlib
import matplotlib.pyplot as plt
import pprint
colors = {'red': '#cd7058', 'blue': '#599ad3', 'orange': '#f9a65a', 'green': '#66cc66', 'black': '#000000', 'purple': '#990066'}
numbering_subplots = ['a', 'b', 'c', 'd', 'e', 'f... | {
"content_hash": "272236a6da89b40018b54b77f1786f0e",
"timestamp": "",
"source": "github",
"line_count": 399,
"max_line_length": 169,
"avg_line_length": 41.56641604010025,
"alnum_prop": 0.47223394633705157,
"repo_name": "amyvmiwei/hashmap",
"id": "2b9d11e9359d266f38578cc0c998a5c97f219430",
"size": "... |
from waflib.TaskGen import extension
from waflib import Task,Utils
def add_lua(self,node):
tsk=self.create_task('luac',node,node.change_ext('.luac'))
inst_to=getattr(self,'install_path',self.env.LUADIR and'${LUADIR}'or None)
if inst_to:
self.bld.install_files(inst_to,tsk.outputs)
return tsk
class luac(Task.Task):... | {
"content_hash": "04eb00a5722cd2abaf95800aa7a7ff1d",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 75,
"avg_line_length": 30.666666666666668,
"alnum_prop": 0.7130434782608696,
"repo_name": "yagince/text_ux",
"id": "0d48d4f8977badd58e3cc901bd9421b86d27587b",
"size": "605"... |
"""
mlab: a simple scripting interface to Mayavi2 for 3D plotting.
Can be used inside Mayavi2 itself, in "ipython -wthread", or in any
application with the WxWidget mainloop running.
"""
# Author: Prabhu Ramachandran <prabhu_r@users.sf.net>
# Gael Varoquaux <gael dot varoquaux at normalesup dot org>
# Copyrig... | {
"content_hash": "13ecde971d1afa8eb2d3d523c63c7ee6",
"timestamp": "",
"source": "github",
"line_count": 97,
"max_line_length": 78,
"avg_line_length": 31.082474226804123,
"alnum_prop": 0.6560530679933665,
"repo_name": "dmsurti/mayavi",
"id": "8a01d5fb89716f89aaaf36a2a27997806592096b",
"size": "3015"... |
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import logging
import re
from pants.subsystem.subsystem import Subsystem
from pants.util.memo import memoized_property
from pants.contrib.go.subsystems.archive_retri... | {
"content_hash": "f39577509052d65a089f85a959a2710c",
"timestamp": "",
"source": "github",
"line_count": 91,
"max_line_length": 99,
"avg_line_length": 49.05494505494506,
"alnum_prop": 0.6366487455197133,
"repo_name": "peiyuwang/pants",
"id": "800ad2d0a75201536a1cfb3e02f51f2fc3184c4d",
"size": "4611"... |
'''The app module, containing the app factory function.'''
from flask import Flask, render_template
from statusmap.settings import ProdConfig
from statusmap.assets import assets
from statusmap.extensions import (
bcrypt,
cache,
db,
login_manager,
migrate,
debug_toolbar,
)
from statusmap import ... | {
"content_hash": "d324a26b79b59ee8d0922f5a4b4c38af",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 73,
"avg_line_length": 26.745454545454546,
"alnum_prop": 0.6947654656696125,
"repo_name": "evolvedlight/statusmap",
"id": "f434ef75388b1307766ca7556aff4ffc8ee3cd83",
"size"... |
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('formidable', '0002_remove_access_display'),
]
operations = [
migrations.AlterField(
model_name='item',
name='label',
field=models.TextField(),
),... | {
"content_hash": "254a5ee26be45d3b1fbaa787465c6a09",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 53,
"avg_line_length": 20.4375,
"alnum_prop": 0.5626911314984709,
"repo_name": "novafloss/django-formidable",
"id": "3448e8d49b3df8f1a3a2e6d2f97632681d2077d0",
"size": "327... |
from __future__ import absolute_import, division, print_function, unicode_literals
from .common import BaseTest
class TestBatchComputeEnvironment(BaseTest):
def test_batch_compute_update(self):
session_factory = self.replay_flight_data("test_batch_compute_update")
p = self.load_policy(
... | {
"content_hash": "82e4577f512e48ae9cc27853e362ac72",
"timestamp": "",
"source": "github",
"line_count": 68,
"max_line_length": 88,
"avg_line_length": 39.25,
"alnum_prop": 0.5818658673660547,
"repo_name": "ewbankkit/cloud-custodian",
"id": "29d0312f56991ea19bf054ca21e88ed61e19ad84",
"size": "3254",
... |
from baseparser import BaseParser
from bs4 import BeautifulSoup
import re
import datetime
DATE_FORMAT = '%A, %B %e %Y, %l:%M %p'
class WashPoParser(BaseParser):
SUFFIX = '?print=true'
domains = ['www.washingtonpost.com']
feeder_pat = '^http://www.washingtonpost.com/.*_story.html'
feeder_pages = ['h... | {
"content_hash": "f3cc6b6c4d8148cf7a95a370dee5c1f7",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 85,
"avg_line_length": 30.931818181818183,
"alnum_prop": 0.5657604702424688,
"repo_name": "bjowi/newsdiffs",
"id": "06c7bfa868ca536000c5e303fc4630b0dd40ea83",
"size": "1361... |
import sys
try:
import unittest2 as unittest
except ImportError:
import unittest
import logging
from config_manager import ConfigManager
try:
from mock import patch
except ImportError:
if sys.version_info < (3, 0, 0):
print("[-] The mock module is needed to create mock objects,"
... | {
"content_hash": "b431c108e12e9c7816f185b60bd79dcd",
"timestamp": "",
"source": "github",
"line_count": 281,
"max_line_length": 117,
"avg_line_length": 34.09964412811388,
"alnum_prop": 0.5245251513254018,
"repo_name": "afxentios/config-logger",
"id": "814510db5f9fc3169be7ab772a996db7db530b11",
"siz... |
"""This file sets up the django environment."""
import os
import django
from django.conf import settings
import logging
from grr.lib import config_lib
from grr.lib import registry
class DjangoInit(registry.InitHook):
"""Initialize the Django environment."""
def RunOnce(self):
"""Configure the Django envi... | {
"content_hash": "62982936b3acbd1976a6a344c6347586",
"timestamp": "",
"source": "github",
"line_count": 72,
"max_line_length": 80,
"avg_line_length": 32.888888888888886,
"alnum_prop": 0.6672297297297297,
"repo_name": "pchaigno/grr",
"id": "c5921f2724772e1e5a65c2f953fe22573060b8c5",
"size": "2390",
... |
from __future__ import print_function
from pyqtgraph import Vector, SRTTransform3D
class Frame(object):
"""One or more frames of imaging data, including meta information.
Expects *info* to be a dictionary with some minimal information:
* 'frameTransform' maps from the image coordinates (0,0 at top-left)... | {
"content_hash": "43c1a8b22b5cc0cb58980535a5d4f57f",
"timestamp": "",
"source": "github",
"line_count": 79,
"max_line_length": 106,
"avg_line_length": 36.49367088607595,
"alnum_prop": 0.63579604578564,
"repo_name": "campagnola/acq4",
"id": "598f0960411e70bad1e3ced121a2ff5b823e8627",
"size": "2883",... |
def readImg(imgf, dim=32, augment=True):
'''
This function loads in an image and computes dim reduction.
---
I: imgf=image file path, dim=downsampled image size, use 64
O: vector (dim-reduced) representation of the image
---
For testing this function, we can use:
imgf = 'Data/images_trai... | {
"content_hash": "584bb100966eab8c092e1d77afeb5e8b",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 68,
"avg_line_length": 27.441860465116278,
"alnum_prop": 0.6203389830508474,
"repo_name": "mattdelhey/kaggle-galaxy",
"id": "3a07cf1c99d23476c05aad719094cdcf4001a864",
"siz... |
"""Utilities for collecting objects based on "is" comparison."""
# Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# 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://w... | {
"content_hash": "c3a95850882201161c9849de5d9f573e",
"timestamp": "",
"source": "github",
"line_count": 231,
"max_line_length": 85,
"avg_line_length": 27.186147186147185,
"alnum_prop": 0.6643312101910828,
"repo_name": "arborh/tensorflow",
"id": "a5ad1e772450f00c1a1eea372caa64008cfe1bf5",
"size": "6... |
"""
Worker that receives input from Piped RDD.
"""
from __future__ import print_function
import os
import sys
import time
import socket
import traceback
from pyspark.accumulators import _accumulatorRegistry
from pyspark.broadcast import Broadcast, _broadcastRegistry
from pyspark.files import SparkFiles
from pyspark.se... | {
"content_hash": "513ef0dfbcca76a2533f4551c8765b13",
"timestamp": "",
"source": "github",
"line_count": 194,
"max_line_length": 95,
"avg_line_length": 34.855670103092784,
"alnum_prop": 0.6223010943507838,
"repo_name": "DataReplyUK/datareplyuk",
"id": "cf47ab8f96c6d1c70c8a4990138e926394fb6c2c",
"siz... |
"""Amazon boto3 interface."""
from __future__ import absolute_import, unicode_literals
try:
import boto3
from botocore import exceptions
from botocore.awsrequest import AWSRequest
from botocore.response import get_response
except ImportError:
boto3 = None
class _void(object):
pass
... | {
"content_hash": "7a01c2b601a437e29c43277eeb87b650",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 56,
"avg_line_length": 22.04,
"alnum_prop": 0.6733212341197822,
"repo_name": "cloudera/hue",
"id": "8c962df91087de4c48dc09c9881f8a11e4ddae0e",
"size": "575",
"binary": fa... |
import pytz
import numbers
from hashlib import md5
from datetime import datetime
from zipline.protocol import DATASOURCE_TYPE
from six import iteritems, b
def hash_args(*args, **kwargs):
"""Define a unique string for any set of representable args."""
arg_string = '_'.join([str(arg) for arg in args])
kwa... | {
"content_hash": "86a3fb826f981c90c3e3668c60f261a4",
"timestamp": "",
"source": "github",
"line_count": 57,
"max_line_length": 79,
"avg_line_length": 29.68421052631579,
"alnum_prop": 0.693853427895981,
"repo_name": "lsbardel/zipline",
"id": "9bd8f2c583b432be3705381f546c900334db42d8",
"size": "2276"... |
"""
Django settings for {{cookiecutter.project_name}} project.
For more information on this file, see
https://docs.djangoproject.com/en/dev/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/dev/ref/settings/
"""
from __future__ import absolute_import, unicode_liter... | {
"content_hash": "87854bec1073204ab8ad0765dd1ae2db",
"timestamp": "",
"source": "github",
"line_count": 238,
"max_line_length": 147,
"avg_line_length": 38.09243697478992,
"alnum_prop": 0.6169203617913082,
"repo_name": "ingenioustechie/cookiecutter-django-openshift",
"id": "3e11ee4333ab92cbf813a7b2c8f... |
import json,numpy,sys,os,shutil
import theano
import theano.tensor as T
from pythonDnn.utils.utils import dimshuffle
from pythonDnn.io_modules.file_writer import write_dataset
from pythonDnn.io_modules.file_reader import read_dataset
from pythonDnn.io_modules import create_folder_structure_if_not_exists
import loggin... | {
"content_hash": "a21dda05b1ee61006d0b1861ebd29395",
"timestamp": "",
"source": "github",
"line_count": 190,
"max_line_length": 119,
"avg_line_length": 40.805263157894736,
"alnum_prop": 0.6640010318586353,
"repo_name": "IITM-DONLAB/python-dnn",
"id": "517b449917b08ff9dba6c54efd4fce1dc459b00c",
"siz... |
from __future__ import unicode_literals
from functools import partial
from django.contrib.contenttypes.models import ContentType
from django.db import models, migrations
def remove_old_contentype(content_type, apps, schema_editor):
"""If we change model name, we need to remove its ContentType entry."""
Conte... | {
"content_hash": "2f1f2e173bb399b7f1d2f0187dc63608",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 75,
"avg_line_length": 27.8125,
"alnum_prop": 0.6235955056179775,
"repo_name": "swcarpentry/amy",
"id": "0bbaa837c5bd0624a804b704e45d3192bd61019d",
"size": "914",
"binary... |
from bpy.types import Panel
class MMDMaterialPanel(Panel):
bl_idname = 'MATERIAL_PT_mmd_tools_material'
bl_label = 'MMD Material'
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
bl_context = 'material'
@classmethod
def poll(cls, context):
material = context.active_object.act... | {
"content_hash": "91e7813b00f6a5d1ef76b19d46525d78",
"timestamp": "",
"source": "github",
"line_count": 126,
"max_line_length": 105,
"avg_line_length": 33.25396825396825,
"alnum_prop": 0.5613365155131265,
"repo_name": "sugiany/blender_mmd_tools",
"id": "64712e746acaff8bc2abcf579a83d7c95ec38f93",
"s... |
import xml.etree.ElementTree as ET
import pprint
import re
import codecs
import json
"""
Clean, format the osm data into a JSON format for import into mongodb
"""
# REGEX to check for all lower case characters in a string
lower = re.compile(r'^([a-z]|_)*$')
# REGEX to check for colon values
lower_colon = re.compi... | {
"content_hash": "78ff0485033922a38a362d1f52a399a4",
"timestamp": "",
"source": "github",
"line_count": 316,
"max_line_length": 141,
"avg_line_length": 37.0126582278481,
"alnum_prop": 0.544203146374829,
"repo_name": "craignicholson/P2",
"id": "4112ddb3f10e10531e8623a04c0b34749c9a3128",
"size": "117... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.