text stringlengths 4 1.02M | meta dict |
|---|---|
"""State and behavior for operation context."""
import time
# _interfaces is referenced from specification in this module.
from grpc.framework.core import _interfaces # pylint: disable=unused-import
from grpc.framework.interfaces.base import base
class OperationContext(base.OperationContext):
"""An implementatio... | {
"content_hash": "fe58b9233b32175e59d1851613f7844d",
"timestamp": "",
"source": "github",
"line_count": 63,
"max_line_length": 80,
"avg_line_length": 34.333333333333336,
"alnum_prop": 0.7124364308830329,
"repo_name": "fichter/grpc",
"id": "24a12b612e50310c346d4d32413be22c87f29267",
"size": "3692",
... |
"""
Copyright (c) 2016 Ryan Fan
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, subli... | {
"content_hash": "b47fbfc9a3dc82f18d0d34864cc8975b",
"timestamp": "",
"source": "github",
"line_count": 96,
"max_line_length": 85,
"avg_line_length": 37.135416666666664,
"alnum_prop": 0.6603085553997194,
"repo_name": "rfancn/wxgigo",
"id": "9c1d0bcf707a62ae5b518fe0a00aad7f020ef50f",
"size": "3611",... |
from collections import Iterable
import numpy as np
from mordred import Result, Descriptor, error, is_missing
from nose.tools import eq_, ok_, raises
class Dummy1(Descriptor):
def __str__(self):
return "Dummy1"
def parameters(self):
return ()
def calculate(self):
return 1
cla... | {
"content_hash": "48c4d87d3203e817fdeebc0402a3a157",
"timestamp": "",
"source": "github",
"line_count": 120,
"max_line_length": 86,
"avg_line_length": 19.166666666666668,
"alnum_prop": 0.5982608695652174,
"repo_name": "mordred-descriptor/mordred",
"id": "4861e34a1599530b1aa289b31d3accb36249bed5",
"... |
from django.contrib.auth import get_permission_codename
from wagtail.wagtailcore.models import Page
class PermissionHelper(object):
"""
Provides permission-related helper functions to effectively control what
what a user can and can't do to instances of a 'typical' model, where
permissions are granted... | {
"content_hash": "f23242f469ce76541e763f78eed8874d",
"timestamp": "",
"source": "github",
"line_count": 151,
"max_line_length": 78,
"avg_line_length": 35.95364238410596,
"alnum_prop": 0.6323448148830355,
"repo_name": "tomdyson/wagtailmodeladmin",
"id": "d45ef04e7657bae3b27bf07594bcef8ef24bebec",
"s... |
from django.db import models
# Create your models here.
class Site(models.Model):
# uint serial number
sn = models.CharField(
verbose_name='电站序列号',
max_length=20)
# short name
name = models.CharField(
verbose_name='电站名称',
max_length=40)
# total meters number
met... | {
"content_hash": "2d5736f12868d86d803657c4f07c573e",
"timestamp": "",
"source": "github",
"line_count": 270,
"max_line_length": 110,
"avg_line_length": 42.785185185185185,
"alnum_prop": 0.6528739612188366,
"repo_name": "mageelen/snow",
"id": "dabcf7303dce7382690eaff149dbf5d99845d65e",
"size": "1273... |
"""Support for the for Danfoss Air HRV sswitches."""
import logging
from homeassistant.components.switch import (
SwitchDevice)
from homeassistant.components.danfoss_air import DOMAIN \
as DANFOSS_AIR_DOMAIN
_LOGGER = logging.getLogger(__name__)
def setup_platform(hass, config, add_entities, discovery_info... | {
"content_hash": "e222ce11d09728a6cc07529462ec98b1",
"timestamp": "",
"source": "github",
"line_count": 72,
"max_line_length": 77,
"avg_line_length": 29.555555555555557,
"alnum_prop": 0.6221804511278195,
"repo_name": "HydrelioxGitHub/home-assistant",
"id": "ec85757be59dd18836b41c47c4f1c735c9a42974",
... |
"""
Testing that functions from compat work as expected
"""
from pandas.compat import (
range, zip, map, filter,
lrange, lzip, lmap, lfilter,
builtins
)
import unittest
import nose
import pandas.util.testing as tm
class TestBuiltinIterators(tm.TestCase):
def check_result(self, actual, expected, length... | {
"content_hash": "ef0fba203166bc91ebc8f373247019dc",
"timestamp": "",
"source": "github",
"line_count": 70,
"max_line_length": 80,
"avg_line_length": 33.34285714285714,
"alnum_prop": 0.5779777206512425,
"repo_name": "bdh1011/wau",
"id": "242b54c84d0ee94c87f7bd5eccbc4552637ef6dd",
"size": "2358",
... |
"""Demo platform for the Device tracker component."""
import random
from homeassistant.components.device_tracker import DOMAIN
def setup_scanner(hass, config, see, discovery_info=None):
"""Set up the demo tracker."""
def offset():
"""Return random offset."""
return (random.randrange(500, 200... | {
"content_hash": "e183d30bd20ac5648b614b536c618f04",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 84,
"avg_line_length": 27.829268292682926,
"alnum_prop": 0.5898334794040315,
"repo_name": "qedi-r/home-assistant",
"id": "fba8095efd64203f5ff02cfb44c8ebc2e50f3648",
"size":... |
import numpy as np
import scipy.sparse as sp
from menpo.shape import TriMesh, PointCloud
from menpo.transform import Translation, UniformScale, AlignmentSimilarity
from menpo3d.vtkutils import trimesh_to_vtk, VTKClosestPointLocator
from menpo3d.morphablemodel.shapemodel import ShapeModel
import os
import sys
from con... | {
"content_hash": "d4c00560601f9f2f791fa0e59941e330",
"timestamp": "",
"source": "github",
"line_count": 499,
"max_line_length": 91,
"avg_line_length": 41.72945891783567,
"alnum_prop": 0.5590452864620852,
"repo_name": "grigorisg9gr/menpo3d",
"id": "3cc66283ce36b5449840d6887f546188d38cd331",
"size": ... |
""" Sahana Eden Automated Tests - INV006 Create Catalog
@copyright: 2011-2012 (c) Sahana Software Foundation
@license: MIT
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 with... | {
"content_hash": "414b32fff62242bb1556d1a3c0f4dc8e",
"timestamp": "",
"source": "github",
"line_count": 54,
"max_line_length": 110,
"avg_line_length": 41.574074074074076,
"alnum_prop": 0.6418708240534521,
"repo_name": "madhurauti/Map-Polygon",
"id": "e05083cdce291bcb406c50ce57b3d7632ad453b5",
"size... |
import unittest
import numpy as np
import sys
sys.path.append("..")
from op_test import OpTest
import paddle
import paddle.fluid as fluid
from paddle.framework import core
paddle.enable_static()
SEED = 2021
def gather_numpy(x, index, axis):
x_transpose = np.swapaxes(x, 0, axis)
tmp_gather = x_transpose[inde... | {
"content_hash": "83b5124d552b551b2f7e84e8ca33e022",
"timestamp": "",
"source": "github",
"line_count": 161,
"max_line_length": 80,
"avg_line_length": 31.32919254658385,
"alnum_prop": 0.5329103885804917,
"repo_name": "luotao1/Paddle",
"id": "1d27eadbc12f3870e975a80b2a05b0a6adedbcf6",
"size": "5657"... |
import sys
import os
from distutils.core import setup
try:
from distutils.command.build_py import build_py_2to3 as build_py
except ImportError:
from distutils.command.build_py import build_py
# This ugly hack executes the first few lines of the module file to look up some
# common variables. We cannot just im... | {
"content_hash": "ac5b6ea23b571929f63d4a3dd9fdd5af",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 80,
"avg_line_length": 34.390243902439025,
"alnum_prop": 0.6524822695035462,
"repo_name": "tg123/bottle-mysql",
"id": "57d77adffe7c98aca4e16aded6b6e5d12a38068d",
"size": "1... |
class Market(object):
def __init__(self):
self.name = __name__
def get_order_book(self):
pass
def get_account_info(self):
pass
def execute_order(self, orderType):
pass
| {
"content_hash": "71b8e4c0a74483af0df0322a68d11855",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 39,
"avg_line_length": 18.25,
"alnum_prop": 0.547945205479452,
"repo_name": "lorganthesorn/CryptoArb",
"id": "ef3d22320a3964bbfc725f4ca1086dcc5db92722",
"size": "221",
"b... |
"""change_setatbirth_for_workspace__model
Revision ID: e968d868a097
Revises: ec6018a5919f
Create Date: 2020-02-04 11:33:00.348870
"""
from alembic import op
# revision identifiers, used by Alembic.
revision = 'e968d868a097'
down_revision = 'ec6018a5919f'
branch_labels = None
depends_on = None
def upgrade(engine_na... | {
"content_hash": "825222b0c1c1b5182f7f4b89dc954776",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 95,
"avg_line_length": 26.38,
"alnum_prop": 0.6747536012130402,
"repo_name": "all-of-us/raw-data-repository",
"id": "52431a406c57ce34498f616632227821b2270bae",
"size": "131... |
"""
This file parses messages using functions defined in in the template's
parser.py
@copyright: 2012-14 (c) Sahana Software Foundation
@license: MIT
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), ... | {
"content_hash": "cce01ef8ae6e7c9ca7b2d84dca9681ce",
"timestamp": "",
"source": "github",
"line_count": 215,
"max_line_length": 82,
"avg_line_length": 34.716279069767445,
"alnum_prop": 0.5061629153269025,
"repo_name": "collective/eden",
"id": "e216e88cced3ef7a6122a13f4afde9f8b36cb460",
"size": "753... |
import random
import mock
import txamqp.client
from twisted.internet.defer import inlineCallbacks, Deferred
from twisted.internet.task import LoopingCall
from twisted.trial import unittest
from gtxamqp.factory import AmqpReconnectingFactory
from tests import utils
class ChannelClosedTests(unittest.TestCase):
di... | {
"content_hash": "52f245301e599ba676a5f3be1c9e9f36",
"timestamp": "",
"source": "github",
"line_count": 62,
"max_line_length": 100,
"avg_line_length": 33.74193548387097,
"alnum_prop": 0.6630019120458891,
"repo_name": "devsenexx/gtxamqp",
"id": "dd3cbf7ea5abdde4a48326d560074f9b8773870a",
"size": "20... |
from __future__ import absolute_import
import os
import shutil
import tempfile
import sys
import re
from io import StringIO
import pytest
from cwltool.main import main
import cwltool.process
from .util import get_data, needs_docker, temp_dir, windows_needs_docker
@needs_docker
def test_missing_enable_ext():
... | {
"content_hash": "4e113d39dd1d4b433e90117177de6626",
"timestamp": "",
"source": "github",
"line_count": 196,
"max_line_length": 134,
"avg_line_length": 32.964285714285715,
"alnum_prop": 0.5988237114997679,
"repo_name": "dleehr/cwltool",
"id": "58ab99f9ad343a9e43f29553e90c3e538ec7b82e",
"size": "646... |
"""Functions to compute local metrics.
To compute the metrics for a set of sequences, the statistics are first computed
for each sequence, these are then summed and normalized.
Sequences are specified by (gt_id_subset, pr_id_subset, similarity):
gt_id_subset: List of integer arrays of groundtruth tracks in each fra... | {
"content_hash": "e5138f0026547fbeb3c6a7d621bee707",
"timestamp": "",
"source": "github",
"line_count": 697,
"max_line_length": 80,
"avg_line_length": 42.12338593974175,
"alnum_prop": 0.6396117166212534,
"repo_name": "google-research/localmot",
"id": "da1dcac55b359dc68c23415bf2fd5e3cde4fe6df",
"siz... |
from pandac.PandaModules import Point3, VBase4
from direct.fsm.FSM import FSM
from direct.interval.IntervalGlobal import Sequence, Parallel, ActorInterval, Func, Wait, ParticleInterval, Track, LerpColorScaleInterval, LerpScaleInterval, LerpHprInterval
from direct.task.Task import Task
from toontown.battle import Battle... | {
"content_hash": "1430eb1ca9dea03ba0acab1c2160916f",
"timestamp": "",
"source": "github",
"line_count": 264,
"max_line_length": 380,
"avg_line_length": 44.49242424242424,
"alnum_prop": 0.6877234803337307,
"repo_name": "ToonTownInfiniteRepo/ToontownInfinite",
"id": "9b5edbfc737bfe0f915819d6113814a3d6a... |
"""Utilities for unit-testing Keras."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import functools
import threading
import numpy as np
from tensorflow.python import keras
from tensorflow.python import tf2
from tensorflow.python.eager import context
... | {
"content_hash": "bc623aacd7b7566cbf35ae3a5e6dd608",
"timestamp": "",
"source": "github",
"line_count": 871,
"max_line_length": 88,
"avg_line_length": 34.88978185993111,
"alnum_prop": 0.6671163907993024,
"repo_name": "ppwwyyxx/tensorflow",
"id": "e4c2406399f40e13cd887d3cd64fc2cc075c962f",
"size": "... |
from threading import Lock
import numpy as np
import cv2
import time
class FaceDetector():
def __init__(self, mainObj, detector, queue = None, extrap = 0):
self.faceLock = Lock()
self.mainObj = mainObj
self.quit = False
self.detector = detector
self.faces = []
self.e... | {
"content_hash": "f96a4fd8b652e0c2a217bf69fc3e7d4c",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 73,
"avg_line_length": 32.851063829787236,
"alnum_prop": 0.5272020725388601,
"repo_name": "lehtolav/distributed-face-recognition",
"id": "aee7b2a676930054f18b0e1e115efdf46bd2... |
"""Brings up a set of Global Registry nodes along with databases.
They can create separate clusters.
"""
import copy
import json
import common
import docker
def _tweak_config(config, name, uid):
cfg = copy.deepcopy(config)
cfg['nodes'] = {'node': cfg['nodes'][name]}
sys_config = cfg['nodes']['node']['s... | {
"content_hash": "552c029d8a0e2fa75e049ebf738dde7a",
"timestamp": "",
"source": "github",
"line_count": 96,
"max_line_length": 80,
"avg_line_length": 32.791666666666664,
"alnum_prop": 0.6188055908513341,
"repo_name": "xorver/oneprovider_ccm",
"id": "7d5db407e9baebe5ae35463f137c5d157d47e6bc",
"size"... |
"""Unittests for mysql.connector.cursor
"""
import new
import itertools
from decimal import Decimal
import time
import datetime
import inspect
import re
import tests
from mysql.connector import (connection, cursor, conversion, protocol,
utils, errors, constants)
class TestsCursor(tests.MySQLConnectorTests):
... | {
"content_hash": "d53956b927b97926e4a5befd42c32f5b",
"timestamp": "",
"source": "github",
"line_count": 942,
"max_line_length": 80,
"avg_line_length": 36.07643312101911,
"alnum_prop": 0.5470809792843692,
"repo_name": "rcosnita/fantastico",
"id": "99ac25b34443cb2e23dd2d22c02e8dc94868f359",
"size": "... |
import pandas as pd
import numpy as np
from sklearn.metrics import mean_squared_error
from pyspark.ml.evaluation import RegressionEvaluator,Evaluator
from math import sqrt
from sklearn.metrics.pairwise import pairwise_distances
from sklearn.metrics.pairwise import cosine_similarity
class EvaluadorRMSE(Evaluator):
... | {
"content_hash": "31224e037aac3b4ba48367520c0d1a3b",
"timestamp": "",
"source": "github",
"line_count": 99,
"max_line_length": 127,
"avg_line_length": 33.484848484848484,
"alnum_prop": 0.633182503770739,
"repo_name": "pvalienteverde/MeetUpIntroMLySistemasRecomendacion",
"id": "1f502a260e37ea2896b670e... |
from __future__ import print_function
import types
import warnings
import sys
import traceback
import inspect
import pickle
from copy import deepcopy
import numpy as np
from scipy import sparse
import struct
from sklearn.externals.six.moves import zip
from sklearn.externals.joblib import hash, Memory
from sklearn.ut... | {
"content_hash": "96d69a28f5c03c622ed4b1d34d1e24c4",
"timestamp": "",
"source": "github",
"line_count": 1444,
"max_line_length": 81,
"avg_line_length": 35.887119113573405,
"alnum_prop": 0.6183786495822157,
"repo_name": "anurag313/scikit-learn",
"id": "2ff07f13dae40edf984341596dd268a0af39c88f",
"siz... |
"""
nimsdata.medimg.nimsnifti
=========================
NIMSNifti provide NIfti writing capabilities for MR datasets read by any subclass of NIMSMRReader.
Provides nifti specifics, inherits from NIMSMRReader, NIMSMRWriter.
"""
import os
import bson
import logging
import nibabel
import json
import numpy as np
impo... | {
"content_hash": "8a25a8cf40ff0bf97f2edb8dd1865e36",
"timestamp": "",
"source": "github",
"line_count": 287,
"max_line_length": 161,
"avg_line_length": 37.52613240418118,
"alnum_prop": 0.5717734447539461,
"repo_name": "cni/nimsdata",
"id": "c4fa9306f96f17781800a17f38346e939e38b938",
"size": "10850"... |
import socket
import time
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(('localhost', 5228))
s.send("<stream>")
#s.flush()
s.send("<test/>")
s.send("<test/>")
s.send("<test/>")
s.send("</stream>")
#s.flush()
s.close()
| {
"content_hash": "af9f2dbcaaacb9192c2b9fb41a7d46b7",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 53,
"avg_line_length": 18.307692307692307,
"alnum_prop": 0.634453781512605,
"repo_name": "sezuan/SleekXMPP",
"id": "50eb6c500eb127043820ed23b72a9d6d296d3501",
"size": "238"... |
"""Support for HomeKit Controller air quality sensors."""
import logging
from aiohomekit.model.characteristics import CharacteristicsTypes
from aiohomekit.model.services import ServicesTypes
from homeassistant.components.air_quality import AirQualityEntity
from homeassistant.core import callback
from . import KNOWN_... | {
"content_hash": "7bdc96a41841e84eacbd89546746c19b",
"timestamp": "",
"source": "github",
"line_count": 113,
"max_line_length": 74,
"avg_line_length": 32.89380530973451,
"alnum_prop": 0.6655905299973096,
"repo_name": "aronsky/home-assistant",
"id": "df5a89f179ec4840a648e24cc74af589362d66fb",
"size"... |
import os
from setuptools import setup
def read(*path):
"""Use this to read files from source directory"""
with open(
os.path.join(os.path.dirname(__file__), *path),
encoding="utf8"
) as fp:
return fp.read()
setup(
name="rucola-permalinks",
version='0.0.1',
li... | {
"content_hash": "862420311ecf162ea55c9038266ce62d",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 82,
"avg_line_length": 22.11111111111111,
"alnum_prop": 0.6256281407035176,
"repo_name": "lecnim/rucola-permalinks",
"id": "b77fc5f8e5dd851c7dc80e6c675e8a94db42880c",
"size... |
import amulet
import unittest
class TestDeploy(unittest.TestCase):
"""
Trivial deployment test for Apache Flume HDFS.
This charm cannot do anything useful by itself, so integration testing
is done in the bundle.
"""
def test_deploy(self):
self.d = amulet.Deployment(series='xenial')
... | {
"content_hash": "2caa17fb6dc92ac0adf1fde7f900648f",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 76,
"avg_line_length": 27.142857142857142,
"alnum_prop": 0.6473684210526316,
"repo_name": "juju-solutions/layer-apache-flume-hdfs",
"id": "c8041dbb150b398d8935d2448839dc9cdc9... |
"""
I/O for boolean regulatory networks.
"""
import numpy as N, matplotlib as M, pylab as P, logging, subprocess, os
from cookbook.pylab_utils import layout_sub_plot, pylab_ioff
from . import network, chow_liu_trees
from .analysis import aggregate_possible_regulations, aggregate_possible_thetas, aggregate_possible_in... | {
"content_hash": "5c2be5c53842b48431250a5d86bba696",
"timestamp": "",
"source": "github",
"line_count": 426,
"max_line_length": 134,
"avg_line_length": 37.110328638497656,
"alnum_prop": 0.593965462711114,
"repo_name": "JohnReid/pybool",
"id": "0385feffc676f73c83de6e90b1b40d03d771f3b1",
"size": "158... |
"""
kinto
Kinto is a minimalist JSON storage service with synchronisation and sharing abilities. It is meant to be easy to use and easy to self-host. **Limitations of this OpenAPI specification:** 1. Validation on OR clauses is not supported (e.g. provide `data` or `permissions` in patch operations). 2.... | {
"content_hash": "f0c8a0bd0e1257df1997cf5cce112162",
"timestamp": "",
"source": "github",
"line_count": 51,
"max_line_length": 938,
"avg_line_length": 44.35294117647059,
"alnum_prop": 0.7316534040671971,
"repo_name": "gabisurita/kinto-codegen-tutorial",
"id": "984300d05ab6a4ccad63cdea74fda74777fea938... |
"""
sphinx.builders.devhelp
~~~~~~~~~~~~~~~~~~~~~~~
Build HTML documentation and Devhelp_ support files.
.. _Devhelp: http://live.gnome.org/devhelp
:copyright: Copyright 2007-2016 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
from __future__ import absolute_impo... | {
"content_hash": "ea74e1d4e3b6e2e24cbbd4a9535f4685",
"timestamp": "",
"source": "github",
"line_count": 132,
"max_line_length": 92,
"avg_line_length": 31.12878787878788,
"alnum_prop": 0.5536626916524702,
"repo_name": "axbaretto/beam",
"id": "0849a72ea5121acaf470c2ba3cd37696b300368e",
"size": "4133"... |
import os
import sys
import logging
import datetime
from dateutil import parser
from volttron.platform.vip.agent import Agent, Core, PubSub, RPC, compat
from volttron.platform.agent import utils
from volttron.platform.agent.utils import (get_aware_utc_now, format_timestamp)
from .helpers import *
from .measurement_ty... | {
"content_hash": "4fece059a738d72dbb46cfd954b266dc",
"timestamp": "",
"source": "github",
"line_count": 348,
"max_line_length": 118,
"avg_line_length": 47.91379310344828,
"alnum_prop": 0.5906801007556675,
"repo_name": "VOLTTRON/volttron-applications",
"id": "29e75de5f2748d3c86957859709c587c28ef0894",... |
import operator
from collections import namedtuple
import numpy as np
from allel.chunked import util as _util
from allel.abc import ArrayWrapper, DisplayAsTable
from allel.model.ndarray import subset as _numpy_subset, NumpyRecArrayWrapper
def store(data, arr, start=0, stop=None, offset=0, blen=None):
"""Copy ... | {
"content_hash": "1ecc0b48e2b0700c3ee5269c93c67808",
"timestamp": "",
"source": "github",
"line_count": 959,
"max_line_length": 95,
"avg_line_length": 32.74452554744526,
"alnum_prop": 0.569900006369021,
"repo_name": "cggh/scikit-allel",
"id": "2d72effa0717b2c2acbeba1576089c69cc38787c",
"size": "314... |
def partition(arr, l, r):
x = arr[r]
cur = l
for i in range(l, r):
if arr[i] <= x:
arr[cur], arr[i] = arr[i], arr[cur]
cur += 1
arr[cur], arr[r] = arr[r], arr[cur]
return cur
# finds the kth position (of the sorted array)
# in a given unsorted array i.e this function
# can be used to find b... | {
"content_hash": "4e56bacc83c052575faca4d8a729d879",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 49,
"avg_line_length": 24.458333333333332,
"alnum_prop": 0.5979557069846678,
"repo_name": "teckoo/teckoo.github.io",
"id": "21e4763bfac090cd090dcbf605d373dcd29c295b",
"size... |
print("__name__ is ", __name__)
print("__package__ is ", __package__)
import sys
print("From sys.modules", sys.modules["kitty"])
from kitty.speak.hello import speak
| {
"content_hash": "31d6d79fc3e3865e9d3707467e132185",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 47,
"avg_line_length": 23.857142857142858,
"alnum_prop": 0.6526946107784432,
"repo_name": "tempbottle/Nuitka",
"id": "542e87ea9c7566297b80d9ce9005da2ec5dd5459",
"size": "106... |
import csv
from csv import excel_tab
from sklearn.feature_extraction.text import TfidfVectorizer as TFIDF
from sklearn.naive_bayes import MultinomialNB as MNB
from sklearn.linear_model import LogisticRegression as LR
from sklearn.cross_validation import cross_val_score
from bs4 import BeautifulSoup
import cPickle
impor... | {
"content_hash": "f7d30390fb832a7922c7ee29be96b519",
"timestamp": "",
"source": "github",
"line_count": 127,
"max_line_length": 79,
"avg_line_length": 37.24409448818898,
"alnum_prop": 0.5714587737843552,
"repo_name": "corinnelhh/text_detective",
"id": "0dbe71de6d43210ead6e47cb1c5ad3cfbad08ff7",
"si... |
import ipaddress
import logging
import re
from collections import Counter
from typing import Callable, List, Collection, Union, Tuple, Optional, Dict, Pattern, Any
from . import connectors
from .command_handlers import OTCommandHandler, OtCliCommandRunner, OtbrSshCommandRunner, OtbrAdbCommandRunner
from .connectors im... | {
"content_hash": "328376b31988f7fc2d3396e4bfbb8424",
"timestamp": "",
"source": "github",
"line_count": 2468,
"max_line_length": 208,
"avg_line_length": 36.593598055105346,
"alnum_prop": 0.573881943906193,
"repo_name": "srickardti/openthread",
"id": "ed000dd8414fc7ca62da05d2896a7491f37f4b2f",
"size... |
from statsmodels.compat.pandas import Appender, is_int_index, to_numpy
from abc import ABC, abstractmethod
import datetime as dt
from typing import Hashable, List, Optional, Sequence, Set, Tuple, Type, Union
import numpy as np
import pandas as pd
from scipy.linalg import qr
from statsmodels.iolib.summary import d_or... | {
"content_hash": "50c99c8609e579ada516068ecd841d63",
"timestamp": "",
"source": "github",
"line_count": 1480,
"max_line_length": 79,
"avg_line_length": 34.8445945945946,
"alnum_prop": 0.5739189451231336,
"repo_name": "bashtage/statsmodels",
"id": "b75c3dd8766eec32ee42ba3c75a9565ca6bec858",
"size": ... |
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "ReaderSS.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| {
"content_hash": "41b8ed5fb29bbf215702cad7ba62e8bf",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 72,
"avg_line_length": 25.444444444444443,
"alnum_prop": 0.7117903930131004,
"repo_name": "polarkac/ReaderSS",
"id": "691e57ec89689f1280e8e0b80328a7e8af4003ee",
"size": "251... |
from django.shortcuts import render_to_response
from django.template import RequestContext
from django.http import Http404, HttpResponseRedirect
from django.views.generic import list_detail
from django.contrib.auth.models import User
from django.contrib.auth.decorators import login_required
from django.core.urlresolver... | {
"content_hash": "4415217fb3094ccc3789d48c4f8ae54e",
"timestamp": "",
"source": "github",
"line_count": 65,
"max_line_length": 119,
"avg_line_length": 39.292307692307695,
"alnum_prop": 0.6714956930305404,
"repo_name": "rg3915/django-basic-apps",
"id": "612f0661d77f399ecc04e2602ab292b68168933b",
"si... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import datetime
import unittest
from airflow import configuration, DAG
from airflow.contrib.operators import mlengine_operator_utils
from airflow.contrib.operators.mlengine_operator_utils import create_evaluat... | {
"content_hash": "f01ae7ce5cbbe9dda92d00fea72666b1",
"timestamp": "",
"source": "github",
"line_count": 169,
"max_line_length": 87,
"avg_line_length": 40.88165680473373,
"alnum_prop": 0.5656390215660733,
"repo_name": "yati-sagade/incubator-airflow",
"id": "c8f6fb5544f64a572b81e0dcf70fd81d79ce6768",
... |
from google.cloud import contentwarehouse_v1
async def sample_create_document_link():
# Create a client
client = contentwarehouse_v1.DocumentLinkServiceAsyncClient()
# Initialize request argument(s)
request = contentwarehouse_v1.CreateDocumentLinkRequest(
parent="parent_value",
)
# M... | {
"content_hash": "4db0ad7cc29762528308d073624eeca3",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 82,
"avg_line_length": 28.05263157894737,
"alnum_prop": 0.7467166979362101,
"repo_name": "googleapis/google-cloud-python",
"id": "af966edbb46db53d1b4dcf3646c10b10106ac7ab",
... |
from get_manifest import *
from check_hash import *
get_MANIFEST(sys.argv[1])
if check_hashes("MANIFEST", "MANIFEST_temp"):
manifest = open("MANIFEST", 'wb')
temp = open("MANIFEST_temp", 'rb')
new_man = temp.read()
manifest.write(new_man)
| {
"content_hash": "e94a09a615f151b1dde076af292f00c1",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 45,
"avg_line_length": 23.09090909090909,
"alnum_prop": 0.6653543307086615,
"repo_name": "monzum/tuf-legacy",
"id": "9250e7b92f3e7173e3e555d6899eae5813d84b5d",
"size": "254... |
from django.conf import settings
from django.conf.urls import include, url
from django.contrib import admin
from django.contrib.sitemaps.views import sitemap
from core import views as core_views
from api.resources import OrderableResource, PostResource, SearchResource
from core.sitemap import IndexSitemap, BlogSitemap... | {
"content_hash": "e42b24289dc6335d056491ffd5b85657",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 87,
"avg_line_length": 35.84,
"alnum_prop": 0.6702008928571429,
"repo_name": "manti-by/m2",
"id": "a8570421d0a1589026d3f875a94e6220bc248ed5",
"size": "1792",
"binary": fa... |
"""
Submitted on behalf of a third-party: sqlalchemy
"""
from sqlalchemy.ext.mutable import Mutable
class MutableDict(Mutable, dict):
"""A dictionary type that implements :class:`.Mutable`.
.. versionadded:: 0.8
"""
def __setitem__(self, key, value):
"""Detect dictionary set events and emit... | {
"content_hash": "a8edd34c30da4ee0908773fe2ed6125b",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 66,
"avg_line_length": 25.523809523809526,
"alnum_prop": 0.5886194029850746,
"repo_name": "redhat-openstack/heat",
"id": "8646a624071f57c2eabad948f8c3658e50a49f7d",
"size":... |
from nose.tools import eq_
from kitsune.kbadge.tests import AwardFactory, BadgeFactory
from kitsune.sumo.tests import LocalizingClient, TestCase
from kitsune.sumo.urlresolvers import reverse
class AwardsListTests(TestCase):
client = LocalizingClient()
def test_list_empty(self):
resp = self.client.ge... | {
"content_hash": "c37def7d64035d7c1e0242ebeaebb218",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 74,
"avg_line_length": 37.21621621621622,
"alnum_prop": 0.6833696441539578,
"repo_name": "mythmon/kitsune",
"id": "30124edd064dca042b11a9e802b370924a67df67",
"size": "1377"... |
from GestureAgents.Recognizer import Recognizer, newHypothesis
from GestureAgents.Agent import Agent
import math
from GestureAgentsTUIO.Gestures2D.RecognizerTap import RecognizerTap
def build_and_register_DT(RTKlass=RecognizerTap):
class RecognizerDT_Test(Recognizer):
rtotal = 0
def __init__(sel... | {
"content_hash": "dc16fe90cb37a5887db5fdef44f80afb",
"timestamp": "",
"source": "github",
"line_count": 88,
"max_line_length": 80,
"avg_line_length": 34.72727272727273,
"alnum_prop": 0.5605366492146597,
"repo_name": "chaosct/GestureAgents",
"id": "35887c9bfbf7f063528483182f70d72a270d3a39",
"size": ... |
"""
Created on Thu Mar 9 21:15:08 2017
@author: franklin
"""
import xlrd
datafile = "data/2013_ERCOT_Hourly_Load_Data.xls"
def parse_file(datafile):
workbook = xlrd.open_workbook(datafile)
sheet = workbook.sheet_by_index(0)
data = [[sheet.cell_value(r, col)
for col in range(sheet.nco... | {
"content_hash": "a39708f08e98e7d4a83c36f0115c7bbf",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 75,
"avg_line_length": 26.943396226415093,
"alnum_prop": 0.6134453781512605,
"repo_name": "franklinsales/udacity-data-analyst-nanodegree",
"id": "2f8804c56f9baa77ac097d5e9fb9... |
"""
USAGE: %(program)s WIKI_XML_DUMP OUTPUT
Converts articles from a Wikipedia dump to a file containing the texts from the
articles. A single line is an article, articles are separted by a newline.
Note: doesn't support lemmatization.
Adapted from:
- http://textminingonline.com/training-word2vec-model-on-english-wi... | {
"content_hash": "3305b24f66a4695973f13185f3e14585",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 84,
"avg_line_length": 32.583333333333336,
"alnum_prop": 0.6406649616368286,
"repo_name": "hgrif/wiki-word2vec",
"id": "a2d3608392b0ba677889a13a083a2e3484dba07e",
"size": "... |
"""This command deals with the fact that the NHS mutates its
prescribing identifiers periodically, making tracking changes through
time very difficult.
As of 2017 (but this is expected to change within the next year), NHS
England uses a derivative of the BNF (British National Formulary)
codes to identify each presenta... | {
"content_hash": "37450ce0749a9ee6b0265044bd1038bb",
"timestamp": "",
"source": "github",
"line_count": 321,
"max_line_length": 88,
"avg_line_length": 38.67601246105919,
"alnum_prop": 0.6364881192106323,
"repo_name": "ebmdatalab/openprescribing",
"id": "bc449e0cce43af436411c2d99bce7ec72acc6b01",
"s... |
import chainer
import chainer.testing
import chainer.testing.attr
import chainermn
import mock
import numpy as np
import unittest
class ExampleModel(chainer.Chain):
def __init__(self):
super(ExampleModel, self).__init__()
with self.init_scope():
self.a = chainer.links.Linear(2, 3)
... | {
"content_hash": "aafcc9628a717091157e11c9cf8c0dce",
"timestamp": "",
"source": "github",
"line_count": 223,
"max_line_length": 77,
"avg_line_length": 43.488789237668165,
"alnum_prop": 0.597030315528975,
"repo_name": "rezoo/chainer",
"id": "0c4b7483dc5de39be3dcc68463afcc252b969bcd",
"size": "9698",... |
"""SOAP protocol implementation, dispatchers and client stub."""
import logging
import string
import httpx
from . import core, namespaces as ns, soap11, soap12, wsa
from .utils import uncapitalize
SOAP_HTTP_Transport = ns.wsdl_soap_http
logger = logging.getLogger('soapfish')
class SOAPVersion:
SOAP11 = soap1... | {
"content_hash": "c0a88d1002a377f6c27a44ddf9cf9637",
"timestamp": "",
"source": "github",
"line_count": 140,
"max_line_length": 111,
"avg_line_length": 36.457142857142856,
"alnum_prop": 0.6490987460815048,
"repo_name": "soapteam/soapfish",
"id": "9dd053f2ff73215943f6f25490c3658b401c3c57",
"size": "... |
try:
from tkinter import Tk, Toplevel, Frame, Label, Scale, HORIZONTAL
except ImportError:
from Tkinter import Tk, Toplevel, Frame, Label, Scale, HORIZONTAL
from PIL import Image, ImageTk, ImageEnhance
import sys
#
# enhancer widget
class Enhance(Frame):
def __init__(self, master, image, name, enhancer,... | {
"content_hash": "f4a61c5397612cf43b2ded9f8aecd419",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 80,
"avg_line_length": 26.64,
"alnum_prop": 0.6291291291291291,
"repo_name": "insta-code1/Instafit-ecommerce-Django",
"id": "4ef479a28cd3795d405dcd88dfa52f478210e939",
"siz... |
from collections import OrderedDict
from typing import Dict, Type
from .base import CustomerCustomizerServiceTransport
from .grpc import CustomerCustomizerServiceGrpcTransport
# Compile a registry of transports.
_transport_registry = (
OrderedDict()
) # type: Dict[str, Type[CustomerCustomizerServiceTransport]]
_... | {
"content_hash": "90ae7912238047d9146b2c8b88717af5",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 68,
"avg_line_length": 30.6875,
"alnum_prop": 0.8044806517311609,
"repo_name": "googleads/google-ads-python",
"id": "323aab7586df512c4fefbfca1e42d8ebe5c7b966",
"size": "109... |
import signal
class TimeoutFunctionException(Exception):
"""Exception to raise on a timeout"""
pass
class TimeoutFunction:
def __init__(self, function, timeout):
self.timeout = timeout
self.function = function
def handle_timeout(self, signum, frame):
raise TimeoutFunctionExcep... | {
"content_hash": "10169ab8df02778c77ef6790750b15c4",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 80,
"avg_line_length": 40.43478260869565,
"alnum_prop": 0.432258064516129,
"repo_name": "mredar/oac-ead-to-pdf",
"id": "b2e88ed3e29a7fdb2962a4c3eed61e2ae67c8e11",
"size": "... |
"""
Copyright (c) 2006-2013 sqlmap developers (http://sqlmap.org/)
See the file 'doc/COPYING' for copying permission
"""
from lib.core.settings import WAF_ATTACK_VECTORS
__product__ = "dotDefender (Applicure Technologies)"
def detect(get_page):
retval = False
for vector in WAF_ATTACK_VECTORS:
page, ... | {
"content_hash": "a2a0d907f38504fdd80cb4688948cb52",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 63,
"avg_line_length": 25.105263157894736,
"alnum_prop": 0.6540880503144654,
"repo_name": "JeyZeta/Dangerous",
"id": "9cc66e18b758352168371c4e26fb950be6d5483d",
"size": "50... |
"""Main test class for app_cli"""
from src import app
class TestApp(object):
def setup_method(self, _):
self.app = app
def test_function(self):
self.app.set_name("test")
assert self.app.get_name() == "test" | {
"content_hash": "4f61ddd3fb3dd71b4949afb2e45f5b49",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 44,
"avg_line_length": 21.90909090909091,
"alnum_prop": 0.6016597510373444,
"repo_name": "kefniark/turnkey-tools",
"id": "1656216cd9c102f6cd8c4d0f456ef1aada443ce5",
"size":... |
from pygbe.util import an_solution
from convergence import (run_convergence, picklesave, pickleload,
report_results, mesh)
def main():
print('{:-^60}'.format('Running molecule_neumann test'))
try:
test_outputs = pickleload()
except FileNotFoundError:
test_outputs ... | {
"content_hash": "2d17024badb6d390678df45bc01b8ba4",
"timestamp": "",
"source": "github",
"line_count": 79,
"max_line_length": 87,
"avg_line_length": 37.59493670886076,
"alnum_prop": 0.6148148148148148,
"repo_name": "barbagroup/pygbe",
"id": "852a5f81d670c55c6cda3662e55426abff7425a6",
"size": "2970... |
from apgl.graph.DictGraph import DictGraph
from apgl.util.Util import Util
import unittest
import numpy
import logging
import numbers
import numpy.testing as nptst
class DictGraphTest(unittest.TestCase):
def setUp(self):
self.graph = DictGraph()
self.graph.addEdge(0, 1, 1)
self.graph.addE... | {
"content_hash": "e02b5b5b21d24cd01f16b0de547430d1",
"timestamp": "",
"source": "github",
"line_count": 831,
"max_line_length": 123,
"avg_line_length": 33.61492178098676,
"alnum_prop": 0.5748908140617169,
"repo_name": "charanpald/APGL",
"id": "de17a81602564b3e1029e9e52fb18ab8651bcb01",
"size": "279... |
import functools
import datetime
import mock
from factory import SubFactory
from factory.fuzzy import FuzzyDateTime, FuzzyAttribute, FuzzyChoice
from mock import patch, Mock
import factory
import pytz
from factory.django import DjangoModelFactory
from django.utils import timezone
from django.db.utils import Integrity... | {
"content_hash": "34f8c290f030ba4cc799f1a53bbbe1ae",
"timestamp": "",
"source": "github",
"line_count": 818,
"max_line_length": 150,
"avg_line_length": 32.52444987775061,
"alnum_prop": 0.6349934222890434,
"repo_name": "cwisecarver/osf.io",
"id": "a02c05726754b96a7b3520161dcd1c766ea9b3fd",
"size": "... |
"""Strategy combinations for combinations.combine()."""
import sys
import unittest
from tensorflow.core.protobuf import config_pb2
from tensorflow.python import tf2
from tensorflow.python.distribute import central_storage_strategy
from tensorflow.python.distribute import cluster_resolver
from tensorflow.python.distrib... | {
"content_hash": "89d868fd6775a2f02a5b98b68bca31aa",
"timestamp": "",
"source": "github",
"line_count": 665,
"max_line_length": 111,
"avg_line_length": 39.57142857142857,
"alnum_prop": 0.6967129013870416,
"repo_name": "yongtang/tensorflow",
"id": "595155988d03953397554614094bc959884e0503",
"size": ... |
"""This module contains a Google Dataprep operator."""
from typing import TYPE_CHECKING, Sequence
from airflow.models import BaseOperator
from airflow.providers.google.cloud.hooks.dataprep import GoogleDataprepHook
if TYPE_CHECKING:
from airflow.utils.context import Context
class DataprepGetJobsForJobGroupOpera... | {
"content_hash": "1c2096cc8fdce65be03343da0b1d1a4b",
"timestamp": "",
"source": "github",
"line_count": 109,
"max_line_length": 108,
"avg_line_length": 37.944954128440365,
"alnum_prop": 0.664651837524178,
"repo_name": "Acehaidrey/incubator-airflow",
"id": "54f76dc381b479095d014d6ebc45b254ae5012e4",
... |
class StripeError(Exception):
def __init__(self, message=None, http_body=None, http_status=None,
json_body=None, headers=None):
super(StripeError, self).__init__(message)
if http_body and hasattr(http_body, 'decode'):
try:
http_body = http_body.decode('... | {
"content_hash": "f87ad707a7d64587e60b39063425861f",
"timestamp": "",
"source": "github",
"line_count": 62,
"max_line_length": 70,
"avg_line_length": 28.14516129032258,
"alnum_prop": 0.5805157593123209,
"repo_name": "alexmic/stripe-python",
"id": "c3415d7a280d020a231bbafe2ed5c71d1cb7e214",
"size": ... |
__author__ = 'Steven LI'
from test_steps import *
def my_add(*args):
ret = 0
for i in args:
ret += i
return ret
#############################################################################
## Please notice sleep in my_mul function
## for options explanation
def my_mul(*args):
import time... | {
"content_hash": "2abee7dcc77854f3ed62f8f5efd2c34a",
"timestamp": "",
"source": "github",
"line_count": 88,
"max_line_length": 133,
"avg_line_length": 52.84090909090909,
"alnum_prop": 0.6236559139784946,
"repo_name": "steven004/TestSteps",
"id": "73051a26fba714fb192c73007d4b9fcf17b38c33",
"size": "... |
import cocos
from package.helper import ProjectHelper
class FrameworkSet(cocos.CCPlugin):
@staticmethod
def plugin_name():
return "set-framework"
@staticmethod
def brief_description():
return cocos.MultiLanguage.get_string('FRAMEWORK_SET_BRIEF')
# parse arguments
def parse_a... | {
"content_hash": "748909dc6e97eaf56c95273320bfbaf1",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 114,
"avg_line_length": 30.93103448275862,
"alnum_prop": 0.6477146042363434,
"repo_name": "stars2014/quick-ng",
"id": "7d20fad6e5116a333ad9eaeb0544eeb8380850e5",
"size": "8... |
import simplejson
import time
import psycopg2
import config
from geojson.examples import SimpleWebFeature
from shapely.geometry import asShape
from geoalchemy2.types import Geography
#trim off excess spaces from strings
def trim_property(property):
if isinstance(property, unicode):
return property.strip()
... | {
"content_hash": "5848f21f22c4752746cfeb54afb7b4c1",
"timestamp": "",
"source": "github",
"line_count": 93,
"max_line_length": 109,
"avg_line_length": 31.333333333333332,
"alnum_prop": 0.5851063829787234,
"repo_name": "atlefren/ssr_loader",
"id": "b2f4789402da6a5d8fd13391e3ed91221cbd3a72",
"size": ... |
from rllab.baselines.linear_feature_baseline import LinearFeatureBaseline
from rllab.envs.normalized_env import normalize
from sandbox.rocky.tf.envs.base import TfEnv
from sandbox.rocky.tf.policies.gaussian_mlp_policy import GaussianMLPPolicy
from sandbox.rocky.tf.algos.trpo import TRPO
from rllab.misc.instrument impor... | {
"content_hash": "b5bd31da18173b35e61396466c848074",
"timestamp": "",
"source": "github",
"line_count": 72,
"max_line_length": 93,
"avg_line_length": 26.65277777777778,
"alnum_prop": 0.6435643564356436,
"repo_name": "brain-research/mirage-rl-qprop",
"id": "2e163b868a7a2b1e65d9a5eac82fa2d9616ae0b7",
... |
from django.db import models
import django_filters
from django_filters.rest_framework import FilterSet
from django.core.exceptions import ValidationError
from .fields import CPUField, MemoryField
# front-end API types
TYPE_CHOICES = [("string", "String values"), ("float", "Float values"),
("boolean"... | {
"content_hash": "8d2d5cead7a20aee5db1bf352ff4cc2a",
"timestamp": "",
"source": "github",
"line_count": 323,
"max_line_length": 90,
"avg_line_length": 43.024767801857585,
"alnum_prop": 0.6309275383176225,
"repo_name": "FNNDSC/ChRIS_ultron_backEnd",
"id": "65a2fb1d95b8b8d7e632998a1de93ccdece0ad7f",
... |
try:
from nengo.exceptions import ConfigError
except ImportError:
ConfigError = KeyError
def getconfig(config, object, name, default=None):
"""Get a configuration parameter that may or may not have been added to the
config.
"""
try:
return getattr(config[object], name, default)
exc... | {
"content_hash": "6f1c88f843a2181f27182d0d684441c7",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 79,
"avg_line_length": 28.466666666666665,
"alnum_prop": 0.6908665105386417,
"repo_name": "project-rig/nengo_spinnaker",
"id": "05411a4573f4dedca6344ac7718c1fdcb43c4f88",
"... |
"""A task where the goal is to move the hand close to a target prop or site."""
import collections
from dm_control import composer
from dm_control.composer import initializers
from dm_control.composer.observation import observable
from dm_control.composer.variation import distributions
from dm_control.entities import... | {
"content_hash": "7b9a5fc8683ae7bc903c082a3f0b7caf",
"timestamp": "",
"source": "github",
"line_count": 195,
"max_line_length": 80,
"avg_line_length": 35.03589743589744,
"alnum_prop": 0.6995023419203747,
"repo_name": "deepmind/dm_control",
"id": "b2c8d4d2ff07be3044aadf11d220a4ad5279ef41",
"size": "... |
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('formidable', '0005_conditions_default'),
]
operations = [
migrations.RemoveField(
model_name='preset',
name='form',
),
migrations.RemoveField(
mo... | {
"content_hash": "9ab62633700724a2d35dd74079e7dbb1",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 50,
"avg_line_length": 20.31578947368421,
"alnum_prop": 0.5362694300518135,
"repo_name": "novafloss/django-formidable",
"id": "e56960ba17fe7870d7092326218d0055b205a3b0",
"s... |
import pytest
import aiohttp
from aiohttp import content_disposition_filename, parse_content_disposition
class TestParseContentDisposition:
# http://greenbytes.de/tech/tc2231/
def test_parse_empty(self) -> None:
disptype, params = parse_content_disposition(None)
assert disptype is None
... | {
"content_hash": "80d159a67361290294307e5eb69c69b7",
"timestamp": "",
"source": "github",
"line_count": 699,
"max_line_length": 88,
"avg_line_length": 39.35765379113018,
"alnum_prop": 0.6072480098869543,
"repo_name": "KeepSafe/aiohttp",
"id": "9516751cba92782f804d5fa5ec4e08d4e504909c",
"size": "275... |
"""
Forum attachments abstract models
=================================
This module defines abstract models provided by the ``forum_attachments`` application.
"""
import os
from django.db import models
from django.utils.translation import gettext_lazy as _
from machina.conf import settings as machina_s... | {
"content_hash": "daf366facca7378534278fd511771800",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 96,
"avg_line_length": 32.583333333333336,
"alnum_prop": 0.6649616368286445,
"repo_name": "ellmetha/django-machina",
"id": "65bbe994dbf4f416348042030eee50010ef9aeb9",
"size... |
import types
import typing
PackageName = typing.NamedTuple("PackageName", [
("Name", str),
("CompareString", str)
])
PackageName.__repr__ = types.MethodType(lambda s: s.Name)
PackageName.__eq__ = types.MethodType(lambda this, that: isinstance(that, PackageName) and this.CompareString == that.CompareString)... | {
"content_hash": "e2e368e35e3bca3c59bc96d59b94a438",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 132,
"avg_line_length": 33.578947368421055,
"alnum_prop": 0.6724137931034483,
"repo_name": "GuRenYiBeiAiHuangLiang/ScriptTool",
"id": "3876c85aed62e1dc804a0cfe4ac3d7c2b614f70... |
try:
from cStringIO import StringIO
except ImportError:
from StringIO import StringIO
from ...sipmessaging import SIPHeaderField
from ...sipmessaging import classproperty
class PrivacySIPHeaderField(SIPHeaderField):
# noinspection PyNestedDecorators
@classproperty
@classmethod
def canonical_fi... | {
"content_hash": "f9fcde1bf8c36d1e9c01c7a23b88ec50",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 116,
"avg_line_length": 27.608695652173914,
"alnum_prop": 0.7275590551181103,
"repo_name": "bobjects/BobStack",
"id": "f99754b601240744a30b504826761006be6bf396",
"size": "6... |
import copy
import mock
from tempest.lib.services.compute import base_compute_client
from tempest.lib.services.compute import services_client
from tempest.tests.lib import fake_auth_provider
from tempest.tests.lib.services import base
class TestServicesClient(base.BaseServiceTest):
FAKE_SERVICES = {
"s... | {
"content_hash": "3f039d67966888a41a9b1c0cb5bbc5b5",
"timestamp": "",
"source": "github",
"line_count": 201,
"max_line_length": 75,
"avg_line_length": 37.07960199004975,
"alnum_prop": 0.5972091775124111,
"repo_name": "masayukig/tempest",
"id": "ba432e39e188d85251e481874e601dd7b58029c3",
"size": "80... |
import time
import oauth_req
import simplejson
import ratelimit
def getSearch(query, search_type, filename_to_write, friends_dir, count = 100):
# import packages
import csv
import urllib
import save_csv
# get Twitter API keys
key = ratelimit.getKeys(1)
consumer_key, consumer_secret, k... | {
"content_hash": "4accac8a72d31845445d08fcfcb1a7ed",
"timestamp": "",
"source": "github",
"line_count": 169,
"max_line_length": 140,
"avg_line_length": 36.14792899408284,
"alnum_prop": 0.5338025863480111,
"repo_name": "coolster1/dark-rt-toolkit",
"id": "5139cab6e336537d97ce893cf562b786f7afd30d",
"s... |
from __future__ import print_function
import argparse
import cgi
import codecs
import errno
import functools
from multiprocessing import cpu_count
import os.path
import re
import shutil
import sys
from pygments import highlight
from pygments.lexers.c_cpp import CppLexer
from pygments.formatters import HtmlFormatter
... | {
"content_hash": "b7f643f595fcb044070377f2c06d0bf9",
"timestamp": "",
"source": "github",
"line_count": 341,
"max_line_length": 179,
"avg_line_length": 33.97360703812317,
"alnum_prop": 0.6100129477772982,
"repo_name": "endlessm/chromium-browser",
"id": "4887043e0f9650c7a83f0bc6e7edd13615e5c682",
"s... |
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": "421b6755678d35fd6c2304fd7c060152",
"timestamp": "",
"source": "github",
"line_count": 1117,
"max_line_length": 881,
"avg_line_length": 43.127126230975826,
"alnum_prop": 0.52054055176136,
"repo_name": "napalm-automation/napalm-yang",
"id": "01bdc7b49155afe165e04be2208e379d10df75be",
... |
import unittest
class TestModules(unittest.TestCase):
def test_variance_decomposition_import(self):
try:
import limix.modules.varianceDecomposition as vd
except ImportError:
self.fail()
if __name__ == '__main__':
unittest.main()
| {
"content_hash": "3f4c09e7d13d3db22b89e344c953060c",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 60,
"avg_line_length": 25.363636363636363,
"alnum_prop": 0.6344086021505376,
"repo_name": "PMBio/limix",
"id": "7fd1577f9d5180378f14f3a80d3d7dc3fed9bc0e",
"size": "279",
... |
import docker
from docker import errors
import mock
import six
from magnum.common import docker_utils
from magnum.common import exception
from magnum.conductor.handlers import docker_conductor
from magnum import objects
from magnum.objects import fields
from magnum.tests import base
class TestDockerHandler(base.Base... | {
"content_hash": "549f20b767b1b480a4d6b1619ca1958e",
"timestamp": "",
"source": "github",
"line_count": 545,
"max_line_length": 79,
"avg_line_length": 47.93211009174312,
"alnum_prop": 0.594265589710217,
"repo_name": "jay-lau/magnum",
"id": "1d4e40dbd3bfe74699f61c0ccf6a15c091499091",
"size": "26719"... |
class HttpResponseError(Exception):
"""
Represents an HTTP response error.
"""
def __init__(self, code, reason):
#: Number representing the error (example: 404)
self.status_code = code
#: Reason of the fail (example: "Not found")
self.reason = reason.title()
#:... | {
"content_hash": "7ae8aa79c9ab170dfd70ff8cfd3d6270",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 112,
"avg_line_length": 30.056603773584907,
"alnum_prop": 0.5693659761456371,
"repo_name": "softak/webfaction_demo",
"id": "29603c2461a16a8900337e5794b5e2556b03fcec",
"size... |
from core.database.generator import *
from core.Outputs.C import *
from core.Outputs.Cplusplus import *
from core.Outputs.Dll import *
from core.Outputs.exe import *
from core.Outputs.python import *
from core.Outputs.txt import *
shellcode = generator( "windows", "messagebox", "asdasdyrkrykrk")
ExeFile(shellcode... | {
"content_hash": "b310fc0143a7fd09be5ff1cfce6a1144",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 65,
"avg_line_length": 18.736842105263158,
"alnum_prop": 0.7584269662921348,
"repo_name": "roissy/l0l",
"id": "93abf673ba30cf1501bb60252bb6740b265ee926",
"size": "364",
"... |
import unittest
import discretize
import discretize
from SimPEG import maps
from SimPEG import simulation
import numpy as np
class TestTimeSimulation(unittest.TestCase):
def setUp(self):
mesh = discretize.TensorMesh([10, 10])
self.sim = simulation.BaseTimeSimulation(mesh)
def test_timeProblem... | {
"content_hash": "e2713125ec6ed00fb0b13be82dad381e",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 76,
"avg_line_length": 28.321428571428573,
"alnum_prop": 0.6431273644388399,
"repo_name": "simpeg/simpeg",
"id": "65fa1aa39f7a76a82edb85a2a451fc70631af1db",
"size": "793",
... |
from __future__ import absolute_import
from __future__ import division
import click
from guild import click_util
@click.command()
@click_util.use_args
def shell(args):
"""Start a Python shell for API use.
**NOTE:** This is a developer feature.
"""
from . import shell_impl
shell_impl.main(args... | {
"content_hash": "a3e69670d871fe8430ac28cdc49605cb",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 42,
"avg_line_length": 16.94736842105263,
"alnum_prop": 0.6770186335403726,
"repo_name": "guildai/guild",
"id": "cd9d7404576d2217a984bc9ed9aa8ceb502187d0",
"size": "903",
... |
from __future__ import unicode_literals
from django.test import TestCase
from django.core.urlresolvers import reverse
from django.core.cache import cache
from django.contrib.auth import get_user_model
from django.core import mail
from django.utils.translation import ugettext as _
from django.test.utils import override... | {
"content_hash": "a25e03224a9f513321441c07cc9a67f7",
"timestamp": "",
"source": "github",
"line_count": 568,
"max_line_length": 94,
"avg_line_length": 38.25,
"alnum_prop": 0.6084875264659855,
"repo_name": "david30907d/feedback_django",
"id": "61258ef5365f9b1ccb29792b32854ca6ed34aa27",
"size": "2175... |
"""Synthetic BERT data loader."""
from typing import Mapping, Any
import numpy as np
from load_test.data import data_loader
class SyntheticBertLoader(data_loader.DataLoader):
"""A simple dataloader that creates synthetic BERT samples."""
def __init__(
self,
seq_length: int = 384,
use_v2_feature... | {
"content_hash": "9a6593d495b9de1cfc2d32989760b336",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 64,
"avg_line_length": 31.78787878787879,
"alnum_prop": 0.6501429933269781,
"repo_name": "tensorflow/tpu",
"id": "1a97c656766157fe59dbfac6ab2c67fe79bb3e63",
"size": "1738",... |
"""MaskedAutoregressiveFlow bijector."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
from tensorflow.python.framework import constant_op
from tensorflow.python.framework import dtypes
from tensorflow.python.framework import ops
from ... | {
"content_hash": "b4ea6f149ce73bb76e45fbda254a9896",
"timestamp": "",
"source": "github",
"line_count": 564,
"max_line_length": 80,
"avg_line_length": 41.07446808510638,
"alnum_prop": 0.6781490114823449,
"repo_name": "chemelnucfin/tensorflow",
"id": "88855b27fd3dbdb73b9acd3415e8e393313aad41",
"size... |
from oscar.apps.shipping import apps
class ShippingConfig(apps.ShippingConfig):
name = 'shipping'
| {
"content_hash": "61229cf30fb646a757dcb440188a3897",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 42,
"avg_line_length": 20.8,
"alnum_prop": 0.7692307692307693,
"repo_name": "django-oscar/django-oscar",
"id": "f146c3fc93aa79e6fd9f7442c06d1b8bee4f8fc1",
"size": "104",
"... |
'''
用法例子:
class ExampleDocument( Document ):
name = StringField( required=True, max_length=10 )
email = EmailField( required=True )
password = IntField( max=10000000 )
meta = {
'collection':'example'
}
@gen.engine
def your_method( arg, callback ):
result = yield motor.Op( .... )
callback( result, None )
... | {
"content_hash": "e046008943c11ca33f0f0a64e974e115",
"timestamp": "",
"source": "github",
"line_count": 108,
"max_line_length": 138,
"avg_line_length": 31.833333333333332,
"alnum_prop": 0.6983711460151251,
"repo_name": "shiyanhui/Asytormongo",
"id": "689ca6c5aa93f7dde1386ed7edc17abdd240f960",
"size... |
from __future__ import absolute_import, division, print_function, unicode_literals
from django.conf import settings
from django.core.paginator import Paginator
from django.views.generic import FormView
from django.views.generic.edit import FormMixin
from django.views.generic.list import MultipleObjectMixin
from .form... | {
"content_hash": "c192ea6131956f33b36ec8da52e788cf",
"timestamp": "",
"source": "github",
"line_count": 134,
"max_line_length": 82,
"avg_line_length": 29.574626865671643,
"alnum_prop": 0.6376482462780722,
"repo_name": "sgaist/django-haystack",
"id": "016ca0c65bb804eea1fc32c264059405001dcd23",
"size... |
from flask import request
def pass_token(fn):
"""Передает токен в функцию
:param fn: func
:return: func
"""
def wrapper(*args, **kwargs):
auth_type, token = request.headers['Authorization'].split(None, 1)
kwargs.update({
"sess_token": token,
})
ret... | {
"content_hash": "0a697fd803a849e58ae14c23f888ddef",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 74,
"avg_line_length": 21.352941176470587,
"alnum_prop": 0.5647382920110193,
"repo_name": "pablodiguerero/asterisk.api",
"id": "e14f6e5929ea87771acf8a5af9690d77305c495e",
"... |
def configuration(parent_package='io',top_path=None):
from numpy.distutils.misc_util import Configuration
config = Configuration('arff', parent_package, top_path)
#config.add_data_dir('tests')
return config
if __name__ == '__main__':
from numpy.distutils.core import setup
setup(**configuration(... | {
"content_hash": "e8e68054987a48269b80c0f7fe7899af",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 60,
"avg_line_length": 38.111111111111114,
"alnum_prop": 0.6909620991253644,
"repo_name": "huard/scipy-work",
"id": "3ae197f026df39ebb2e4d1cf2469016466ef81b3",
"size": "366"... |
from google.analytics import admin_v1alpha
async def sample_update_data_stream():
# Create a client
client = admin_v1alpha.AnalyticsAdminServiceAsyncClient()
# Initialize request argument(s)
request = admin_v1alpha.UpdateDataStreamRequest(
)
# Make the request
response = await client.upd... | {
"content_hash": "3e581b52eb6bbf21eeb1927c6c6ba22f",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 85,
"avg_line_length": 27.055555555555557,
"alnum_prop": 0.7515400410677618,
"repo_name": "googleapis/python-analytics-admin",
"id": "686fdd1a8f40b607b01791efae2aee09a4c7846c... |
import pytest
import sys
import time
from test_base_class import TestBaseClass
aerospike = pytest.importorskip("aerospike")
try:
from aerospike.exception import *
except:
print "Please install aerospike python client."
sys.exit(1)
class TestLList(TestBaseClass):
pytestmark = pytest.mark.skipif(
... | {
"content_hash": "a6cf4ab62c463a94a3b381a421489a5a",
"timestamp": "",
"source": "github",
"line_count": 322,
"max_line_length": 104,
"avg_line_length": 35.04347826086956,
"alnum_prop": 0.5875576036866359,
"repo_name": "arthurprs/aerospike-client-python",
"id": "d1e546222cdd97446eeca16ea82061ec6a61fd0... |
"""Unit tests for UnboundedThreadPoolExecutor."""
# pytype: skip-file
from __future__ import absolute_import
import itertools
import threading
import time
import traceback
import unittest
# patches unittest.TestCase to be python3 compatible
import future.tests.base # pylint: disable=unused-import
from apache_beam... | {
"content_hash": "048f8683d3017c7cbd25e35952c6d900",
"timestamp": "",
"source": "github",
"line_count": 114,
"max_line_length": 78,
"avg_line_length": 27.93859649122807,
"alnum_prop": 0.6888540031397175,
"repo_name": "iemejia/incubator-beam",
"id": "b9251cad00a15ed4f8034adc8b4539031efb0191",
"size"... |
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": "de366496d995f76a75b16e94a6508b24",
"timestamp": "",
"source": "github",
"line_count": 250,
"max_line_length": 79,
"avg_line_length": 33.32,
"alnum_prop": 0.6879951980792317,
"repo_name": "IFCA/keystone-voms",
"id": "1ce0f8523d62d1f6ccb8ef5911fd463e4b784114",
"size": "8752",
"bin... |
"""
Colour Analysis
===============
Defines the *Colour - Analysis* main class:
- :class:`ColourAnalysis`
"""
from __future__ import division, unicode_literals
import json
import os
from collections import OrderedDict, deque, namedtuple
from itertools import cycle
import numpy as np
from vispy.scene import Scene... | {
"content_hash": "ddf51e3fc899504215095675a3e73bc4",
"timestamp": "",
"source": "github",
"line_count": 873,
"max_line_length": 79,
"avg_line_length": 28.668957617411227,
"alnum_prop": 0.536039635608119,
"repo_name": "colour-science/colour-analysis",
"id": "59ffae8f3e8b8ed816547e6a3d505a4c4a2d2233",
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.