text stringlengths 4 1.02M | meta dict |
|---|---|
from __future__ import absolute_import, division, print_function
import copy
import numpy as np
from matplotlib.patches import Ellipse, Polygon, Rectangle, Path as MplPath, PathPatch
from matplotlib.transforms import IdentityTransform, blended_transform_factory
from glue.core.exceptions import UndefinedROI
from glue... | {
"content_hash": "f10d3404c272f4746cd1d64afa148c7c",
"timestamp": "",
"source": "github",
"line_count": 1265,
"max_line_length": 97,
"avg_line_length": 27.87114624505929,
"alnum_prop": 0.5380208185608532,
"repo_name": "saimn/glue",
"id": "e1e90366ca69919b820ecd79b8e15c1a1557ea84",
"size": "35257",
... |
import k3d
import os
def generate():
filepath = os.path.join(os.path.abspath(os.path.dirname(__file__)),
'../../assets/factory/arcade_carpet_512.png')
with open(filepath, 'rb') as stl:
data = stl.read()
plt_texture = k3d.texture(data,
fil... | {
"content_hash": "cd13e1f5c0ca65db97d9007c8d0500a0",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 73,
"avg_line_length": 23.63157894736842,
"alnum_prop": 0.5478841870824054,
"repo_name": "K3D-tools/K3D-jupyter",
"id": "553849fcf69f202b7643826deb3bd9993b26c514",
"size": ... |
import time
from simplejson import dumps
from django.shortcuts import render_to_response
from django.http import HttpResponse
from django.template import RequestContext
# ZeroMQ Connection
from gevent import spawn
from gevent_zeromq import zmq
context = zmq.Context()
publisher = context.socket(zmq.PUB)
publisher.bind... | {
"content_hash": "b001e002d6c416bb284b4bbb11309441",
"timestamp": "",
"source": "github",
"line_count": 110,
"max_line_length": 74,
"avg_line_length": 27.436363636363637,
"alnum_prop": 0.621272365805169,
"repo_name": "MechanisM/zeromq-chat",
"id": "705544ed8db2e6aa9da08e0c526f0a29459d5db1",
"size":... |
import unittest
import numpy as np
import chainer
from chainer import testing
from chainer.dataset import tabular
class TestFromData(unittest.TestCase):
def test_unary_args(self):
dataset = tabular.from_data(np.arange(10))
self.assertIsInstance(dataset, chainer.dataset.TabularDataset)
... | {
"content_hash": "811b1639ee9eb9dfedb36371bd507912",
"timestamp": "",
"source": "github",
"line_count": 89,
"max_line_length": 70,
"avg_line_length": 33.831460674157306,
"alnum_prop": 0.6067751577548987,
"repo_name": "okuta/chainer",
"id": "11a1d017bcfde06434c2b27c021702bf2320588d",
"size": "3011",... |
from __future__ import absolute_import
import abc
import six
from st2common.util import concurrency
__all__ = ["Sensor", "PollingSensor"]
@six.add_metaclass(abc.ABCMeta)
class BaseSensor(object):
"""
Base Sensor class - not to be instantiated directly.
"""
def __init__(self, sensor_service, confi... | {
"content_hash": "53d4a0b35e7227bd05035c20ca2960cd",
"timestamp": "",
"source": "github",
"line_count": 125,
"max_line_length": 90,
"avg_line_length": 22.808,
"alnum_prop": 0.5762890213960014,
"repo_name": "Plexxi/st2",
"id": "a8309ba292b412b15659395f7f5acce6d7cafbf2",
"size": "3479",
"binary": f... |
""" Heap sort. A O(n * log(n)) operation to sort
a list in increasing order. It's based on a MinHeap
implementation (Priority Queue).
"""
from heaps.min_heap import MinHeap
from utils.arrays import create_random_array
def heap_sort(source_list=None):
if isinstance(source_list, list):
sorted_data = []
... | {
"content_hash": "4f474d8ac8fb1eda28c8414211920d9d",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 98,
"avg_line_length": 35.390243902439025,
"alnum_prop": 0.5933838731909028,
"repo_name": "rcanepa/cs-fundamentals",
"id": "75a3fc5f2f6c5f6a77c1eae70d0a322c9e6851b1",
"size... |
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WH... | {
"content_hash": "90f09b5af2bfb2700d58de7e7312ef95",
"timestamp": "",
"source": "github",
"line_count": 415,
"max_line_length": 174,
"avg_line_length": 38.41927710843373,
"alnum_prop": 0.48306573005519315,
"repo_name": "jeremiedecock/tictactoe-py",
"id": "76f2dd51421a2e35332a767cedb66d45746abd01",
... |
import unittest
from test import test_support
from weakref import proxy, ref, WeakSet
import operator
import copy
import string
import os
from random import randrange, shuffle
import sys
import warnings
import collections
import gc
import contextlib
from UserString import UserString as ustr
class Foo:
pass
class... | {
"content_hash": "5b744cad2292a47955f3126b2cd29266",
"timestamp": "",
"source": "github",
"line_count": 514,
"max_line_length": 81,
"avg_line_length": 34.81517509727627,
"alnum_prop": 0.5668063704945515,
"repo_name": "shiblon/pytour",
"id": "c939dad27f23d2245e4607fdfc6ea051ebecdd90",
"size": "17895... |
<<<<<<< HEAD
<<<<<<< HEAD
#!/usr/bin/env python
# Copyright (c) 2012 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Unit tests for the common.py file."""
import gyp.common
import unittest
import sys
class TestTopologicallySo... | {
"content_hash": "3475512182878930d6a9b3ece892036c",
"timestamp": "",
"source": "github",
"line_count": 222,
"max_line_length": 75,
"avg_line_length": 27.25225225225225,
"alnum_prop": 0.608099173553719,
"repo_name": "ArcherSys/ArcherSys",
"id": "c94412fcf666582ec4ca48f51275a48387f25977",
"size": "6... |
'''
Covenant Add-on
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the... | {
"content_hash": "ec5d6d8477f4c8ba3e9fa81d48a1926a",
"timestamp": "",
"source": "github",
"line_count": 345,
"max_line_length": 222,
"avg_line_length": 53.26086956521739,
"alnum_prop": 0.6765714285714286,
"repo_name": "TheWardoctor/Wardoctors-repo",
"id": "0d8e11260719ecc7d34ed58038b9c4841ba531d3",
... |
from __future__ import absolute_import
from __future__ import print_function
import PyOpenWorm as P
P.connect('default.conf')
class NC_neighbor(P.Property):
def __init__(self, *args, **kwargs):
P.Property.__init__(self, '_nb', *args, **kwargs)
self.real_neighbor = self.owner.neighbor
# Re... | {
"content_hash": "2f0bde1f267d4607f668937b3cc742fa",
"timestamp": "",
"source": "github",
"line_count": 148,
"max_line_length": 110,
"avg_line_length": 30.236486486486488,
"alnum_prop": 0.580782122905028,
"repo_name": "gsarma/PyOpenWorm",
"id": "6de0874900b227734953b30e8a6bf9bed87cf212",
"size": "4... |
import six
from couchdbkit import ResourceNotFound
from dimagi.utils.couch.database import iter_docs
from .interface import DocumentStore
from pillowtop.dao.exceptions import DocumentMissingError, DocumentDeletedError, DocumentNotFoundError
ID_CHUNK_SIZE = 10000
class CouchDocumentStore(DocumentStore):
def __i... | {
"content_hash": "9cc2b215ef5a9193b11d795a60c75714",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 102,
"avg_line_length": 29.29787234042553,
"alnum_prop": 0.6405228758169934,
"repo_name": "dimagi/commcare-hq",
"id": "ba21e1746575fe12270c09a7df34a73376552eb2",
"size": "1... |
from core.checks import * # NOQA
default_app_config = 'panel.apps.PanelConfig'
| {
"content_hash": "0f052da56d97547fb93b8d78b2fd5676",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 45,
"avg_line_length": 20.5,
"alnum_prop": 0.7317073170731707,
"repo_name": "ikcam/django-skeleton",
"id": "cda7d92fa600ccd8e9b81bec9dd8c3289f6085b3",
"size": "82",
"binar... |
import pytest
from django.core.exceptions import ImproperlyConfigured
from modernrpc.views import RPCEntryPoint
def test_invalid_entry_point_no_handler(settings, rf):
settings.MODERNRPC_HANDLERS = []
entry_point = RPCEntryPoint.as_view()
exc_match = r"At least 1 handler must be instantiated"
with py... | {
"content_hash": "b2fb444c0702d63ca824fcc2bf1d8f86",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 62,
"avg_line_length": 31.384615384615383,
"alnum_prop": 0.75,
"repo_name": "alorence/django-modern-rpc",
"id": "e89678b847fb58f7ab8e8491842aeadede768751",
"size": "424",
... |
from django.core import validators
from django.db import models
from rest_framework.serializers import WritableField
class MoneyFieldDRF(WritableField):
def __init__(self, max_value=9999999999, min_value=0, *args, **kwargs):
kwargs.setdefault("validators", [])
if max_value is not None:
... | {
"content_hash": "ca2c979e1dd8e001c97af2b64c954d6b",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 80,
"avg_line_length": 39.32258064516129,
"alnum_prop": 0.6628383921246924,
"repo_name": "ministryofjustice/cla_backend",
"id": "66f025de58eabe8116ed532a9784fcb9d5f1602e",
... |
from sklearn_explain.tests.skl_datasets import skl_datasets_test as skltest
skltest.test_class_dataset_and_model("FourClass_100" , "LogisticRegression_4")
| {
"content_hash": "6da165c9c69eec69396376b56212a299",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 78,
"avg_line_length": 39.25,
"alnum_prop": 0.802547770700637,
"repo_name": "antoinecarme/sklearn_explain",
"id": "cb7a1341043b9c948d4231254ce63989dc8ce509",
"size": "157",
... |
import django.forms as forms
from string import Template
from django.utils.safestring import mark_safe
from django.conf import settings
import os
class ImageUploaderWidget(forms.TextInput):
def render(self, name, value, attrs=None):
tpl = Template(u'<img src="$url" />')
print(attrs)
url = "... | {
"content_hash": "5fea43053b798c50b69db49f58150ed7",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 51,
"avg_line_length": 33.833333333333336,
"alnum_prop": 0.6945812807881774,
"repo_name": "Mercy-Nekesa/sokoapp",
"id": "afd92a7a579439f03ea9bd6ebc0a70820d8d818b",
"size": ... |
"""Run inference on a single image with a MUSIQ checkpoint."""
import collections
import io
from typing import Dict, Sequence, Text, TypeVar
from absl import app
from absl import flags
import jax
import jax.numpy as jnp
import ml_collections
import numpy as np
import tensorflow.compat.v1 as tf
import musiq.model.mul... | {
"content_hash": "f51cbf1adf338a4a1498aed1cb7af76d",
"timestamp": "",
"source": "github",
"line_count": 163,
"max_line_length": 80,
"avg_line_length": 28.803680981595093,
"alnum_prop": 0.6602768903088392,
"repo_name": "google-research/google-research",
"id": "a6fdcbc5b4b1baa9f635e7f7c0ea90e53e2598be"... |
import sys
from pywrap.import_hook import CppFinder
from pywrap.testing import PREFIX
from pywrap.utils import remove_files
from nose.tools import assert_equal, assert_raises
def test_import_hook_missing_header():
del sys.meta_path[:]
sys.meta_path.append(CppFinder(import_path=PREFIX))
try:
assert... | {
"content_hash": "b0bc19a46d6957cd4722ed7ae4d20c5e",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 57,
"avg_line_length": 27.615384615384617,
"alnum_prop": 0.6727019498607242,
"repo_name": "AlexanderFabisch/cythonwrapper",
"id": "c86c1c8fa3c0438d8ffafc9c6e38eaefbbc023e2",
... |
"""Test the datalab interface functions.
Note that the calls to do analysis, training, and prediction are all mocked.
"""
from __future__ import absolute_import
from __future__ import print_function
import os
import sys
# Set up the path so that we can import local packages.
sys.path.append(
os.path.abspath(os.p... | {
"content_hash": "38bfd0c15bf0cbbdd125cd6479189c8a",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 76,
"avg_line_length": 30.3125,
"alnum_prop": 0.7010309278350515,
"repo_name": "jdanbrown/pydatalab",
"id": "734a183ec9845f27bee7376f0ae6860d2310a2a3",
"size": "1073",
"b... |
"""
====================================
Displaying key timeseries statistics
====================================
Visualizing characteristics of a time series is a key component to effective
forecasting. In this example, we'll look at a very simple method to examine
critical statistics of a time series object.
.. r... | {
"content_hash": "f018b56a4eeebbb8b04873f9fcc30482",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 79,
"avg_line_length": 30.024390243902438,
"alnum_prop": 0.7059301380991064,
"repo_name": "alkaline-ml/pmdarima",
"id": "a78b5fde2459e1c906c70b843501687b91af5c5e",
"size": ... |
from django.contrib import admin
from django.contrib.auth.admin import UserAdmin
from custom_auth.models import CustomUser
admin.site.register(CustomUser, UserAdmin)
| {
"content_hash": "ab93661403ef6128c2bfec99695dcc70",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 47,
"avg_line_length": 24.142857142857142,
"alnum_prop": 0.834319526627219,
"repo_name": "Larhard/Elgassia",
"id": "4e42b2991fbb7a8345ff9228a783ece5a42b4935",
"size": "169",... |
from __future__ import absolute_import, division, print_function, unicode_literals
import pytest ; pytest
#-----------------------------------------------------------------------------
# Imports
#-----------------------------------------------------------------------------
# Standard library imports
# External impo... | {
"content_hash": "1a4babc2bcbb32d7c42e24de3472b6ca",
"timestamp": "",
"source": "github",
"line_count": 112,
"max_line_length": 94,
"avg_line_length": 31.758928571428573,
"alnum_prop": 0.4877705931965139,
"repo_name": "timsnyder/bokeh",
"id": "d1319e69595cce010c2b13471e18964a89794a4c",
"size": "406... |
from .version import __version__
from .sendgrid import SendGridClient
from .exceptions import SendGridError, SendGridClientError, SendGridServerError
#v2 API
from .message import Mail
#v3 API
from .client import SendGridAPIClient | {
"content_hash": "2b15c5c9c0ef924bc734421af967810c",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 79,
"avg_line_length": 32.714285714285715,
"alnum_prop": 0.834061135371179,
"repo_name": "thinkingserious/sendgrid-python",
"id": "270c2895eb2cd459f71a459c5ec91125b1ad8a2f",
... |
"""
So, you have some structure from wild. Say this will be some JSON over API.
But you cant change this JSON structure.
"""
sample_data = {
'userNameFirst': 'Adam',
'userNameSecond': 'Smith',
'userPassword': 'supersecretpassword',
'userEmail': 'adam@smith.math.edu',
'userRoles':... | {
"content_hash": "5e79daa892eaf341edab2e134abb92df",
"timestamp": "",
"source": "github",
"line_count": 127,
"max_line_length": 84,
"avg_line_length": 31.1496062992126,
"alnum_prop": 0.6352376137512639,
"repo_name": "rrader/trafaret",
"id": "49f915e8528b24f1a483c24758efa170778c366f",
"size": "3956"... |
import unittest
import pythran
import os.path
#pythran export a((float,(int,uintp),str list) list list)
#pythran export a(str)
#pythran export a( (str,str), int, intp list list)
#pythran export a( float set )
#pythran export a( bool:str dict )
#pythran export a( float )
#pythran export a( int8[] )
#pythran export a( i... | {
"content_hash": "22bb86121c5f4b66c9956dbed6a00853",
"timestamp": "",
"source": "github",
"line_count": 135,
"max_line_length": 80,
"avg_line_length": 29.585185185185185,
"alnum_prop": 0.6236855282924386,
"repo_name": "pombredanne/pythran",
"id": "a8f5d1150f13a2e3a2a0c3527df0e8f3697eb620",
"size": ... |
import datetime
import re
import uuid
from functools import lru_cache
from django.conf import settings
from django.db.backends.base.operations import BaseDatabaseOperations
from django.db.backends.utils import strip_quotes, truncate_name
from django.db.utils import DatabaseError
from django.utils import timezone
from ... | {
"content_hash": "2e212befdada77bc4ec89bb37e84dd12",
"timestamp": "",
"source": "github",
"line_count": 596,
"max_line_length": 114,
"avg_line_length": 43.17617449664429,
"alnum_prop": 0.582015311079159,
"repo_name": "fenginx/django",
"id": "77d330c4111f6e60dbdf764052c582f5d28ba652",
"size": "25733... |
from make_apex_cubes import all_lines
from spectral_cube import SpectralCube,BooleanArrayMask
import pyspeckit
from astropy.io import fits
from numpy.lib.stride_tricks import as_strided
from paths import mpath
import numpy as np
import time
from astropy import log
from astropy import constants
from astropy import units... | {
"content_hash": "8eeea2fc88c24a86fe84043b07047c33",
"timestamp": "",
"source": "github",
"line_count": 57,
"max_line_length": 93,
"avg_line_length": 50.07017543859649,
"alnum_prop": 0.6121233356692362,
"repo_name": "adamginsburg/APEX_CMZ_H2CO",
"id": "480d50c259cb889f9e4a1616347fcc28ee651e6a",
"si... |
from builtins import object
import json
import os
from PyAnalysisTools.base import _logger
from PyAnalysisTools.base.Singleton import Singleton
from PyAnalysisTools.base.ShellUtils import copy
from future.utils import with_metaclass
class JSONHandle(with_metaclass(Singleton, object)):
def __init__(self, *args, **... | {
"content_hash": "6d758e4da67432ccf3b60c5a45148e74",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 84,
"avg_line_length": 32.35897435897436,
"alnum_prop": 0.6164817749603804,
"repo_name": "morgenst/PyAnalysisTools",
"id": "1c7fe854fe2e4b2bf071972c7ed2789bc58423e6",
"size... |
from __future__ import print_function, unicode_literals, absolute_import
import os
import os.path
import shutil
import errno
import logging
logger = logging.getLogger(__name__)
COLOR_CODES = {
"reset": "\033[0m",
"black": "\033[1;30m",
"red": "\033[1;31m",
"green": "\033[1;32m",
"yellow": "\033[1... | {
"content_hash": "35b0ec0697f5521d74d8501d09e4fef0",
"timestamp": "",
"source": "github",
"line_count": 114,
"max_line_length": 76,
"avg_line_length": 28.780701754385966,
"alnum_prop": 0.5650716245047241,
"repo_name": "zhaochunqi/simiki",
"id": "fd34cdb6607dcac76834e3e8666cf0185293fc50",
"size": "3... |
from oslo_policy import policy as common_policy
from keystone.common import policies
import keystone.conf
from keystone import exception
CONF = keystone.conf.CONF
_ENFORCER = None
def reset():
global _ENFORCER
_ENFORCER = None
def init():
global _ENFORCER
if not _ENFORCER:
_ENFORCER = c... | {
"content_hash": "43f162ab9e5211448a4fd430f2b644b5",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 78,
"avg_line_length": 26.581818181818182,
"alnum_prop": 0.6757865937072504,
"repo_name": "rajalokan/keystone",
"id": "4ec0a0f996bae2f7c95d07c52d779b68424ea20c",
"size": "2... |
"""Downloads and processes the Brown Corpus (http://www.nltk.org/nltk_data)."""
import os
import random
import string
from xml.etree import ElementTree
import lingvo.compat as tf
tf.flags.DEFINE_string("outdir", "/tmp/punctuator_data",
"The output directory.")
FLAGS = tf.flags.FLAGS
def main... | {
"content_hash": "717bcfccbeff38638299c1a9c51ad17c",
"timestamp": "",
"source": "github",
"line_count": 125,
"max_line_length": 80,
"avg_line_length": 34.936,
"alnum_prop": 0.552553240210671,
"repo_name": "tensorflow/lingvo",
"id": "1a7f47c053c76af949c659b5b07d4de261f7f13c",
"size": "5056",
"bina... |
"""
<description>
"""
import pytest as pt
import teetool as tt
# @pt.mark.xfail(reason="out of the blue stopped working on Travis. Mayavi/VTK *sigh*")
def test_visual_3d():
"""
can produce figures
"""
# build world
world_1 = tt.World(name="Example 3D", ndim=3, resolution=[10, 10, 10])
# ex... | {
"content_hash": "cebbece9a2f5ac00a3f928e9e20caf6d",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 88,
"avg_line_length": 27.155172413793103,
"alnum_prop": 0.6374603174603175,
"repo_name": "WillemEerland/teetool",
"id": "2f2401b8ea2c86835752ca86d47818e880d9ccc5",
"size":... |
from __future__ import unicode_literals
from django.db import migrations, models
import wagtail.wagtailcore.fields
class Migration(migrations.Migration):
dependencies = [
('cms_pages', '0007_auto_20151025_0021'),
]
operations = [
migrations.AddField(
model_name='staticpage',... | {
"content_hash": "0b7ac9c6d57c0a521f642baa184e1cb6",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 172,
"avg_line_length": 29.541666666666668,
"alnum_prop": 0.6191819464033851,
"repo_name": "dchaplinsky/pep.org.ua",
"id": "297102a89edd19e8911f8e5b1a7b9392b7b4c005",
"size... |
"""Graphviz visualizations of Program Graphs."""
from absl import logging # pylint: disable=unused-import
import pygraphviz
from python_graphs import program_graph_dataclasses as pb
import six
def to_graphviz(graph):
"""Creates a graphviz representation of a ProgramGraph.
Args:
graph: A ProgramGraph object... | {
"content_hash": "b8847023e711000f07159625ff79a1d4",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 66,
"avg_line_length": 28.659574468085108,
"alnum_prop": 0.6547884187082406,
"repo_name": "google-research/python-graphs",
"id": "046bf176ac227ba73753a40308d8214afbf9e3e1",
... |
import sys
import os
import argparse
from ete2 import Tree
try:
print "importing image"
import Image
import ImageFont
import ImageDraw
import ImageMath
except ImportError:
print "importing image from pil"
from PIL import Image
from PIL import ImageFont
from PIL import ImageDraw
... | {
"content_hash": "d26fe9e89fec6fce12bfd863eddcd150",
"timestamp": "",
"source": "github",
"line_count": 286,
"max_line_length": 192,
"avg_line_length": 34.80419580419581,
"alnum_prop": 0.5577657223226844,
"repo_name": "sauloal/introgressionbrowser",
"id": "afe34af472aa41cabcb06044cfac44000b9dcf42",
... |
"""Testing utilities."""
# Copyright (c) 2011, 2012
# Authors: Pietro Berkes,
# Andreas Muller
# Mathieu Blondel
# Olivier Grisel
# Arnaud Joly
# Denis Engemann
# License: BSD 3 clause
import os
import inspect
import pkgutil
import warnings
import sys
import re
import platf... | {
"content_hash": "cd41d05ed9c535032ddcc46df32a5dc1",
"timestamp": "",
"source": "github",
"line_count": 665,
"max_line_length": 81,
"avg_line_length": 33.4390977443609,
"alnum_prop": 0.6112784997976346,
"repo_name": "ycaihua/scikit-learn",
"id": "f0ba189bd8c0fb52422ccbf86057666670df8060",
"size": "... |
from django.shortcuts import render, redirect
from django.http import HttpRequest
from schools.models import School
from django.views.generic import *
# Create your views here.
class SchoolList(ListView):
model = School
def stthomas_home(request):
return render(request, 'stthomas/home.html')
def stthomas_abo... | {
"content_hash": "1529fee8215b0525f976d1a5d5ba2946",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 57,
"avg_line_length": 33.25925925925926,
"alnum_prop": 0.7661469933184856,
"repo_name": "AnimeshSinha1309/Website-Edunet",
"id": "5dd99ffc0a2625da80640f8cbbbbd92ae802fb0f",
... |
'''
Config file generator
~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2016 by Jihoon Kang <kang@ghoon.net>
:license: Apache 2, see LICENSE for more details
'''
from jinja2 import Environment, FileSystemLoader
import yaml
def generate_config(project_name, project_rootdir, build_target,
tmpl_name='default', ... | {
"content_hash": "32088b1b3c27afbdbdd6adbae3222bb7",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 66,
"avg_line_length": 26.73076923076923,
"alnum_prop": 0.6431654676258993,
"repo_name": "kghoon/epgen",
"id": "edc66905cc3be0936f0e48d38f8d285a01d3b606",
"size": "720",
... |
import collections
import logging
from pip._vendor import six
from pip._vendor.packaging.utils import canonicalize_name
from pip._internal.exceptions import (
DistributionNotFound,
InstallationError,
UnsupportedPythonVersion,
UnsupportedWheel,
)
from pip._internal.models.wheel import Wheel
from pip._i... | {
"content_hash": "e0e04479d10f9fd116912463845379f4",
"timestamp": "",
"source": "github",
"line_count": 459,
"max_line_length": 78,
"avg_line_length": 37.40522875816993,
"alnum_prop": 0.5961908090162502,
"repo_name": "sserrot/champion_relationships",
"id": "dab23aa09d19b1e1988c30a882c4dd12d3f999bb",
... |
import json
import seaborn as sns
import matplotlib.pyplot as plt
import numpy as np
import os
import pandas as pd
from PIL import Image, ImageDraw
def reformat_face_corners(df):
df['face_left_x'] = df.apply(lambda x: x.face_corners[0], axis=1)
df['face_upper_y'] = df.apply(lambda x: x.face_corners[1], axis=1)... | {
"content_hash": "8c9b01348ac48f130f1ef63996c41ca0",
"timestamp": "",
"source": "github",
"line_count": 65,
"max_line_length": 98,
"avg_line_length": 43.55384615384615,
"alnum_prop": 0.5856587778170258,
"repo_name": "dansbecker/what-celebrity",
"id": "f30b3833b597d36adc0047fb79dbe9b6e88cb91c",
"siz... |
"""Support for CO2 sensor connected to a serial port."""
from datetime import timedelta
import logging
from pmsensor import co2sensor
import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
from homeassistant.const import (
ATTR_TEMPERATURE,
CONCENTRATION_PARTS_PER_M... | {
"content_hash": "de63277631fb55855d885da27a56aad3",
"timestamp": "",
"source": "github",
"line_count": 147,
"max_line_length": 82,
"avg_line_length": 31.714285714285715,
"alnum_prop": 0.6342771342771343,
"repo_name": "kennedyshead/home-assistant",
"id": "0f0735dd5dadb6afbf0db42b84e62de7e0cb80ee",
... |
from sqlalchemy import Column, Integer, String, Boolean, Sequence
from sqlalchemy import BigInteger, Date, DateTime, Float, Numeric
from pow_comments.powlib import relation
from pow_comments.sqldblib import Base
#@relation.has_many("<plural_other_models>")
@relation.is_tree()
@relation.setup_schema()
class Comment(Ba... | {
"content_hash": "0cf103f25954a563b4dd43d1b2b07682",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 81,
"avg_line_length": 28.84090909090909,
"alnum_prop": 0.5728920409771474,
"repo_name": "pythononwheels/pow_devel",
"id": "ce2b562580db068aa1234038f50087c81326fde4",
"size... |
import os
import time
import hashlib
import functools
import mimetypes
import itertools
import time
import logging
import asyncio
from datetime import datetime, timedelta
from ..toolbox.config import get_description
from . import server as web
from . import api
from .async import asyncweb, webcoroutine
from .setting... | {
"content_hash": "899eb0cb701f2a98e5de1176be6c8f36",
"timestamp": "",
"source": "github",
"line_count": 198,
"max_line_length": 116,
"avg_line_length": 32.73232323232323,
"alnum_prop": 0.6292238852029007,
"repo_name": "jtackaberry/stagehand",
"id": "6e294e700dd6492d68416ebeaa7dadfe10542650",
"size"... |
import logging
import os
import time
from concurrent.futures import ThreadPoolExecutor, as_completed
from random import randrange
from collections import namedtuple, deque
from copy import deepcopy
from urllib.parse import urljoin, urlparse
import requests
from .decorators import with_history
from .exceptions import... | {
"content_hash": "093a6daea555d840f7aba1600872dcac",
"timestamp": "",
"source": "github",
"line_count": 530,
"max_line_length": 97,
"avg_line_length": 31.477358490566036,
"alnum_prop": 0.5407300845171732,
"repo_name": "nuncjo/Delver",
"id": "f77ba590f83bcbf14cd2fab161a328625750686c",
"size": "16708... |
import logging
import requests
import json
from datetime import datetime
from django.core.management.base import BaseCommand
from seaserv import ccnet_api
from seahub.work_weixin.utils import handler_work_weixin_api_response, \
get_work_weixin_access_token, admin_work_weixin_departments_check
from seahub.work_wei... | {
"content_hash": "bad0595551b5802c75e3556c7e1b68cf",
"timestamp": "",
"source": "github",
"line_count": 121,
"max_line_length": 87,
"avg_line_length": 33.429752066115704,
"alnum_prop": 0.6032138442521632,
"repo_name": "miurahr/seahub",
"id": "0d7c08763fa05251f470bbd18dcab5ddc05a338e",
"size": "4069... |
import kivy
kivy.require('1.7.1')
from kivy.app import App
from kivy.properties import ObjectProperty
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.label import Label
from kivy.uix.popup import Popup
from plyer import tts
__version__ = '1.1.12'
class SayThis(BoxLayout):
saywhat_text = ObjectProperty(... | {
"content_hash": "2583c86feff85ffc23b1a36ceea5ebb4",
"timestamp": "",
"source": "github",
"line_count": 46,
"max_line_length": 77,
"avg_line_length": 21.82608695652174,
"alnum_prop": 0.5796812749003984,
"repo_name": "brousch/saythis",
"id": "ade345f09e4d2c809fa6035f0679efcb156f9dc6",
"size": "1004"... |
from __future__ import unicode_literals
import django.core.files.storage
from django.db import models, migrations
import simple_classroom.apps.downloads
import simple_classroom.apps.downloads.models
class Migration(migrations.Migration):
dependencies = [
('downloads', '0008_auto_20150314_1327'),
]
... | {
"content_hash": "9f0df2b79fc29995551ddef134c45e34",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 179,
"avg_line_length": 35.34375,
"alnum_prop": 0.6427939876215738,
"repo_name": "maxicecilia/simple_classroom",
"id": "f0c8b490bd3bbcb1cdcc4358aa4c04cd3bea70d9",
"size": "... |
import configparser
import multiprocessing
import os
import pickle
import random
import sys
import time
from Modes import Base_Mode
from multiprocessing import Manager
from InterfaceAPI import InterfaceAPI, ApiError, ApiError404, ApiError403
ATTEMPTS = 3
class DataDownloader:
def __init__(self, database, patch... | {
"content_hash": "f5f8365e36b714b800ffb604b8b24cfd",
"timestamp": "",
"source": "github",
"line_count": 218,
"max_line_length": 150,
"avg_line_length": 41.440366972477065,
"alnum_prop": 0.5551250830197033,
"repo_name": "vingtfranc/LoLAnalyzer",
"id": "8d2b96034eae66294b9a67ae355f94845a3b45ab",
"siz... |
import pytest
import sh
from molecule import config
from molecule.verifier.lint import flake8
@pytest.fixture
def molecule_verifier_lint_section_data():
return {
'verifier': {
'name': 'testinfra',
'lint': {
'name': 'flake8',
'options': {
... | {
"content_hash": "86b7ff9905a75e1de5f9fa9462a9c403",
"timestamp": "",
"source": "github",
"line_count": 137,
"max_line_length": 79,
"avg_line_length": 29.204379562043794,
"alnum_prop": 0.6548362909272681,
"repo_name": "kireledan/molecule",
"id": "be4741f0ec6406d551b7030412188827475d0b63",
"size": "... |
import functools
from oslo.config import cfg
from neutron.common import constants as n_const
from neutron.common import exceptions as n_exc
from neutron.common import rpc as n_rpc
from neutron.common import topics
from neutron.db import agents_db
from neutron.db import db_base_plugin_v2
from neutron.db import externa... | {
"content_hash": "8ba058349f1a0a48213a2abf4c2e335a",
"timestamp": "",
"source": "github",
"line_count": 657,
"max_line_length": 79,
"avg_line_length": 41.23896499238965,
"alnum_prop": 0.5711596663467926,
"repo_name": "SnabbCo/neutron",
"id": "3d2ecd381c3f0294c6c06f8199fbff097d4076e6",
"size": "2776... |
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
"""
Test case for the bug report:
"[ 1088979 ] Unnecessary rebuild with generated header file"
(<http://sourceforge.net/tracker/index.php?func=detail&aid=1088979&group_id=30337&atid=398971>).
Unnecessary rebuild with generated header file
Scons rebuilds so... | {
"content_hash": "902a38f7d950601136b6bd8cedb5cb39",
"timestamp": "",
"source": "github",
"line_count": 105,
"max_line_length": 96,
"avg_line_length": 22.571428571428573,
"alnum_prop": 0.6654008438818565,
"repo_name": "andrewyoung1991/scons",
"id": "6beba7419e34c0209e23f60b29dd7b9cbe9372ae",
"size"... |
"""
Unit tests for the nova-policy-check CLI interfaces.
"""
import fixtures
import mock
from six.moves import StringIO
from nova.cmd import policy_check
import nova.conf
from nova import context as nova_context
from nova import db
from nova import exception
from nova.policies import base as base_policies
from no... | {
"content_hash": "1bb74181d2ace4100bafdc4ea2bff467",
"timestamp": "",
"source": "github",
"line_count": 186,
"max_line_length": 78,
"avg_line_length": 44.05913978494624,
"alnum_prop": 0.6183038438071995,
"repo_name": "Juniper/nova",
"id": "bfb719885a4f0ac7246a54479b469aca4fb384a7",
"size": "8834",
... |
"""
Domino Public API
Public API endpoints for Custom Metrics # noqa: E501
The version of the OpenAPI document: 5.3.0
Generated by: https://openapi-generator.tech
"""
__version__ = "1.0.0"
# import ApiClient
from domino._impl.custommetrics.api_client import ApiClient
# import Configuration
from do... | {
"content_hash": "4b75514614ede4b5080dcbde740558ba",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 67,
"avg_line_length": 32.833333333333336,
"alnum_prop": 0.8058375634517766,
"repo_name": "dominodatalab/python-domino",
"id": "d9593b53f24cb2c80a8b0698433be709302fe9eb",
"... |
"""
Thinkful Python Unit 1 Lesson 6 Assignment 4
Implement Bicycle in Python using Classes
Qasim Ijaz
"""
import random
class Wheels(object):
def __init__(self, weight, cost, model):
self.weight = weight
self.cost = cost
self.model = model
class Frames(object):
def __init__(self, mat... | {
"content_hash": "32272c734edf49421674b50714fa8d99",
"timestamp": "",
"source": "github",
"line_count": 73,
"max_line_length": 117,
"avg_line_length": 24.91780821917808,
"alnum_prop": 0.6118746564046179,
"repo_name": "qasimchadhar/thinkful",
"id": "554b8a05c601b4d0984f35c7360124206826f2f7",
"size":... |
from selenium import webdriver
from page_objects import *
from datetime import datetime
import unittest
import argparse
tender_id = None
class SeleniumMixin(unittest.TestCase):
def assertlementIsPresentById(self, elem_id):
try:
self.driver.find_element_by_id(elem_id)
except NoSuchElem... | {
"content_hash": "26beb1d8bfc9e3be69ec4ef393d6f28b",
"timestamp": "",
"source": "github",
"line_count": 69,
"max_line_length": 117,
"avg_line_length": 34.710144927536234,
"alnum_prop": 0.5436325678496868,
"repo_name": "lesiavl/selenium_perfomance_tests",
"id": "530ffb81accf2b531b3935a1c514a2ede6db80a... |
from django.core.exceptions import ValidationError
from .factories import PhotoSizeFactory
from .helpers import PhotologueBaseTest
class PhotoSizeNameTest(PhotologueBaseTest):
def test_valid_name(self):
"""We are restricted in what names we can enter."""
photosize = PhotoSizeFactory()
... | {
"content_hash": "3c4402636b447e686c8890b6d9f503e9",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 129,
"avg_line_length": 34.8,
"alnum_prop": 0.6657088122605364,
"repo_name": "MathieuDuponchelle/my_patched_photologue",
"id": "47da0ff277a2fc99b2269be6d7482eb945fd3dfe",
"... |
from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import (
ClientAuthenticationError,
HttpResponseError,
ResourceExistsError,
ResourceNotFoundEr... | {
"content_hash": "eed318111bbe19d13f71c695756be248",
"timestamp": "",
"source": "github",
"line_count": 2262,
"max_line_length": 217,
"avg_line_length": 47.98187444739169,
"alnum_prop": 0.6376192011793431,
"repo_name": "Azure/azure-sdk-for-python",
"id": "ee3f45f46a9ad78fa63313b6b20f195fa55422a7",
... |
from django.conf.urls.defaults import *
urlpatterns = patterns('',
url(r'^add-for/(?P<app_label>[\w\-]+)/(?P<module_name>[\w\-]+)/(?P<pk>\d+)/$', 'attachments.views.add_attachment', name="add_attachment"),
url(r'^delete/(?P<attachment_pk>\d+)/$', 'attachments.views.delete_attachment', name="delete_attachment")... | {
"content_hash": "9432c5ab00be888885a81da551c66af3",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 142,
"avg_line_length": 53.833333333333336,
"alnum_prop": 0.6470588235294118,
"repo_name": "vitan/django-attachments",
"id": "d7c94d42f80b223f014baf97e3acdeb4802e8309",
"siz... |
from django.core.cache import cache
from devserver.modules import DevServerModule
class CacheSummaryModule(DevServerModule):
"""
Outputs a summary of cache events once a response is ready.
"""
real_time = False
logger_name = 'cache'
attrs_to_track = ['set', 'get', 'delete', 'add', 'get_many... | {
"content_hash": "cfa4ea3a6307f391fbeb9d443eb4f085",
"timestamp": "",
"source": "github",
"line_count": 51,
"max_line_length": 135,
"avg_line_length": 32.09803921568628,
"alnum_prop": 0.6078191814294441,
"repo_name": "coagulant/django-devserver",
"id": "e8e9b1333c27cfbde196732f4974131880ce4b82",
"s... |
import Functions
from operator import itemgetter
f = open("PrideAndPrejudice.txt")
Text = f.read()
LetterFrequency = {}
WordFrequency = {}
#The following code uses CreateList and DictionaryUpdate to create a list then
#updating the associated dictionary. The list of letters is then displayed in
#descending ... | {
"content_hash": "84cfdb67a04548782588b095e31f4330",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 114,
"avg_line_length": 44.73529411764706,
"alnum_prop": 0.7232084155161078,
"repo_name": "samarthmenon/word-count-prideandprejudice",
"id": "c8de1cbd4c41e9cfe6b861e5655a3b5e... |
import re
import urllib
import urlparse
import collections
class HeatIdentifier(collections.Mapping):
FIELDS = (
TENANT, STACK_NAME, STACK_ID, PATH
) = (
'tenant', 'stack_name', 'stack_id', 'path'
)
path_re = re.compile(r'stacks/([^/]+)/([^/]+)(.*)')
def __init__(self, tenant, st... | {
"content_hash": "f0934e3e4d1fbee6fc559fd93002ae51",
"timestamp": "",
"source": "github",
"line_count": 224,
"max_line_length": 78,
"avg_line_length": 33.17857142857143,
"alnum_prop": 0.5291980624327234,
"repo_name": "rickerc/heat_audit",
"id": "9a44aaf305dba8071efc1958c9468eb34caae3bc",
"size": "8... |
import os
import unittest
from external.wip import work_in_progress
from nose.plugins.attrib import attr
from rmgpy import settings
from rmgpy.data.rmg import RMGDatabase, database
from rmgpy.rmg.main import RMG
from rmgpy.rmg.model import Species
from rmgpy.data.thermo import *
from rmgpy.molecule.molecule import Mol... | {
"content_hash": "fc51844adaea1f7847691161fb6c4c0c",
"timestamp": "",
"source": "github",
"line_count": 1543,
"max_line_length": 227,
"avg_line_length": 44.081011017498376,
"alnum_prop": 0.6497640295808401,
"repo_name": "Molecular-Image-Recognition/Molecular-Image-Recognition",
"id": "33115fe90e07e8f... |
from __future__ import print_function
import json
import struct
import re
import base64
import httplib
import sys
settings = {}
class BitcoinRPC:
def __init__(self, host, port, username, password):
authpair = "%s:%s" % (username, password)
self.authhdr = "Basic %s" % (base64.b64encode(authpair))
self.conn = ht... | {
"content_hash": "0905077ee4c690947cf2e17be1d208ee",
"timestamp": "",
"source": "github",
"line_count": 104,
"max_line_length": 90,
"avg_line_length": 26.365384615384617,
"alnum_prop": 0.6542669584245077,
"repo_name": "inkvisit/sarmacoins",
"id": "0dff8733f0530402a64431fe699502eff66aabcb",
"size": ... |
import os.path as op
from copy import deepcopy
import numpy as np
import pandas as pd
import nibabel as nib
import nipype
import pytest
from .. import model
class TestModelWorkflows(object):
def test_model_fit_workflow_creation(self, lyman_info):
info = lyman_info["info"]
subjects = lyman_info[... | {
"content_hash": "4d640a2e4bd52584affb35b31241b1e9",
"timestamp": "",
"source": "github",
"line_count": 340,
"max_line_length": 78,
"avg_line_length": 35.358823529411765,
"alnum_prop": 0.5686241889868574,
"repo_name": "mwaskom/lyman",
"id": "ff49c7cbd9adefb99e91775524706b07b09265b7",
"size": "12022... |
"""
This module converts requested URLs to callback view functions.
RegexURLResolver is the main class here. Its resolve() method takes a URL (as
a string) and returns a ResolverMatch object which provides access to all
attributes of the resolved URL match.
"""
import functools
import re
import threading
from importli... | {
"content_hash": "a6327145aec1b76f4a70dc0c17c79051",
"timestamp": "",
"source": "github",
"line_count": 514,
"max_line_length": 113,
"avg_line_length": 40.929961089494164,
"alnum_prop": 0.5641220648350603,
"repo_name": "whs/django",
"id": "03bac717f810d0555bc9ad3506d872e945bd0f00",
"size": "21038",... |
import re, operator
from flask import Blueprint, request, render_template, flash, g, session, \
redirect, url_for, jsonify, abort, make_response, Response
from dataviva import db
from dataviva.utils.make_query import make_query
from dataviva.secex.models import Yb_secex, Yw, Yp, Ybw, Ybp, Ypw, Ybpw
mod = B... | {
"content_hash": "6e9d34ad2f39cd482602f1ecb0d7bbfd",
"timestamp": "",
"source": "github",
"line_count": 77,
"max_line_length": 80,
"avg_line_length": 36.41558441558441,
"alnum_prop": 0.503922967189729,
"repo_name": "dogobox/datavivamaster",
"id": "1e86bb76591f1593961e913e88770e47264b09b6",
"size": ... |
from django.http import Http404
from django.conf import settings
from .views import page
class PageFallbackMiddleware(object):
def process_response(self, request, response):
if response.status_code != 404:
return response # No need to check for a flatpage for non-404 responses.
try:
... | {
"content_hash": "238daac323f286002267b70433b6da08",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 84,
"avg_line_length": 35.78947368421053,
"alnum_prop": 0.6470588235294118,
"repo_name": "kimus/django-blocks",
"id": "bc88051add7ec35b2600bb2ea750f231cb8b2bf5",
"size": "6... |
from elasticsearch import Elasticsearch
from id_getter import get_ids_with_response_status
import time
import sys
if __name__ == '__main__':
es = Elasticsearch(['http://localhost:9200'])
print "Starting to extract responses from Elasticsearch"
filename = sys.argv[1]
with open(str(filename), 'w') ... | {
"content_hash": "6a6dc30bd874d2b96b598dcabf97e421",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 138,
"avg_line_length": 47.16326530612245,
"alnum_prop": 0.617914322803981,
"repo_name": "cemkoc/GorReplay_and_Log",
"id": "ad885e78cbfafa814a2ced48bce077b3ae39b21f",
"size... |
import json
import threading
__author__ = 'Daniel Puschmann'
import abc
import os
from virtualisation.misc.jsonobject import JSONObject
from messagebus.rabbitmq import RabbitMQ
from virtualisation.misc.threads import QueueThread
from virtualisation.annotation.genericannotation import GenericAnnotation
from virtualisa... | {
"content_hash": "1414809ad4a575e623faf41b659d3596",
"timestamp": "",
"source": "github",
"line_count": 105,
"max_line_length": 116,
"avg_line_length": 38.34285714285714,
"alnum_prop": 0.6686537506209638,
"repo_name": "CityPulse/CP_Resourcemanagement",
"id": "a9d5cd68c5a90d6e4d4562ac4c16d1f8cd0fb15c"... |
"""Tests for tensorflow.ops.test_util."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import collections
import copy
import random
import threading
import unittest
import weakref
from absl.testing import parameterized
import numpy as np
from google.pr... | {
"content_hash": "23ff61c22a5e90599130b516805bbf5b",
"timestamp": "",
"source": "github",
"line_count": 1021,
"max_line_length": 98,
"avg_line_length": 35.081292850146916,
"alnum_prop": 0.6547545926629069,
"repo_name": "sarvex/tensorflow",
"id": "85cc7b88581c524c735ddd6b01996e1b0cd39e6c",
"size": "... |
import io
import os
import pytest
from cookiecutter import repository
@pytest.fixture
def template():
return 'cookiecutter-pytest-plugin'
@pytest.fixture
def cloned_cookiecutter_path(user_config_data, template):
cookiecutters_dir = user_config_data['cookiecutters_dir']
cloned_template_path = os.path.j... | {
"content_hash": "089d6209ec34ac3312d4c0a5795755bb",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 73,
"avg_line_length": 24.62857142857143,
"alnum_prop": 0.7088167053364269,
"repo_name": "stevepiercy/cookiecutter",
"id": "7b274a35e711d5b237c2c3430e2453597fba3988",
"size... |
import json
import click
from tabulate import tabulate
@click.command('users', short_help='List users')
@click.option('--role', 'roles', multiple=True, help='Filter users by role')
@click.pass_obj
def cli(obj, roles):
"""List users."""
client = obj['client']
query = [('roles', r) for r in roles]
if ... | {
"content_hash": "cbb7d5c1ebdf8b7daad5ebd8f6e2dce9",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 130,
"avg_line_length": 38.416666666666664,
"alnum_prop": 0.5997830802603037,
"repo_name": "alerta/python-alerta",
"id": "ee2ed62014423dea9cb0296db4c960b4b389c3b5",
"size":... |
"""
Created on Wed Oct 22 10:53:57 2014
@author: Natural Solutions (Thomas)
"""
| {
"content_hash": "25926b0e9f4cb624e05bae6b93fe381f",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 35,
"avg_line_length": 13.666666666666666,
"alnum_prop": 0.6707317073170732,
"repo_name": "NaturalSolutions/ecoReleve-Server",
"id": "d82ece3a603de50a25c837c3e7de34bd9316f0a8"... |
import json
import os
import pytest
@pytest.mark.integration
def test_bigquery_uri():
from datahub.ingestion.source.sql.bigquery import BigQueryConfig
config = BigQueryConfig.parse_obj(
{
"project_id": "test-project",
}
)
assert config.get_sql_alchemy_url() == "bigquery:/... | {
"content_hash": "878476bd0d86571fc6d385b9124d1c45",
"timestamp": "",
"source": "github",
"line_count": 65,
"max_line_length": 98,
"avg_line_length": 31.676923076923078,
"alnum_prop": 0.6032054395337543,
"repo_name": "linkedin/WhereHows",
"id": "7bc769d29f54990c52064a0fd0cc8b39fe1238eb",
"size": "2... |
import mock
from novaclient import exceptions as exc
from novaclient.tests.unit import utils
from novaclient.tests.unit.v2 import fakes
from novaclient.v2 import versions
class VersionsTest(utils.TestCase):
def setUp(self):
super(VersionsTest, self).setUp()
self.cs = fakes.FakeClient()
se... | {
"content_hash": "687f3e56a1f96b9f0bd8216bf2916dfb",
"timestamp": "",
"source": "github",
"line_count": 69,
"max_line_length": 79,
"avg_line_length": 43.73913043478261,
"alnum_prop": 0.6033797216699801,
"repo_name": "takeshineshiro/python-novaclient",
"id": "aa8e84a6ef3ede9cbaf721ddb73637be24f1d43b",... |
from .test_commons import conn_info, VerticaTestCase
from .. import connect
class ColumnTestCase(VerticaTestCase):
def test_column_names_query(self):
column_0 = 'isocode'
column_1 = 'name'
query = """
select 'US' as {column_0}, 'United States' as {column_1}
union all
... | {
"content_hash": "7a6e43c2ff662c97bc081906ef86b04d",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 64,
"avg_line_length": 33.285714285714285,
"alnum_prop": 0.5779685264663805,
"repo_name": "dennisobrien/vertica-python",
"id": "f1d889d74b65609306b931ec586eb487df17b235",
"... |
import importlib
import asyncio
import pytest
import os
from aiohttp.web import Application, AppRunner, TCPSite
from aiohttp_json_rpc import JsonRpc, JsonRpcClient
try:
django_settings = importlib.import_module(
os.environ.get('DJANGO_SETTINGS_MODULE'))
django_wsgi_application = importlib.import_mod... | {
"content_hash": "20e687f7a8d15de3550fe90e06c7154a",
"timestamp": "",
"source": "github",
"line_count": 134,
"max_line_length": 76,
"avg_line_length": 25.51492537313433,
"alnum_prop": 0.6089499853758409,
"repo_name": "pengutronix/aiohttp-json-rpc",
"id": "e57c26ff4ebb52bd794ed37760e97fc06c3851ee",
... |
import logging
import os
from dart.client.python.dart_client import Dart
from dart.config.config import configuration
from dart.engine.es.metadata import ElasticsearchActionTypes
from dart.model.engine import Engine, EngineData
_logger = logging.getLogger(__name__)
def add_elasticsearch_engine(config):
engine_co... | {
"content_hash": "d2925fada0ee677eb7ae9b797eb449df",
"timestamp": "",
"source": "github",
"line_count": 104,
"max_line_length": 124,
"avg_line_length": 39.01923076923077,
"alnum_prop": 0.5066535239034007,
"repo_name": "RetailMeNotSandbox/dart",
"id": "481af0264413c8a40b7e925340b3048a38ec9107",
"siz... |
import falcon
import falcon.testing as testing
from belzoni.operation.api.api import OperationAPI
#class falcon.testing.TestBase(methodName='runTest'):
class OperationAPITest(testing.TestBase):
def before(self):
# TestBase provides an instance of falcon.API to use along
# with simulate_request (s... | {
"content_hash": "5a804465a4ac8a491029f9b33fd10bea",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 74,
"avg_line_length": 41.689655172413794,
"alnum_prop": 0.6898263027295285,
"repo_name": "SmartInfrastructures/belzoni-workload-manager",
"id": "5e42670d6889f6bf00d79d2679be... |
"""Define various utilities for WWLLN tests."""
import pytest
from homeassistant.components.wwlln import CONF_WINDOW, DOMAIN
from homeassistant.const import (
CONF_LATITUDE,
CONF_LONGITUDE,
CONF_RADIUS,
CONF_UNIT_SYSTEM,
)
from tests.common import MockConfigEntry
@pytest.fixture
def config_entry():
... | {
"content_hash": "92c0dd757fdc385c5e2e12ea898da631",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 62,
"avg_line_length": 23.857142857142858,
"alnum_prop": 0.624251497005988,
"repo_name": "postlund/home-assistant",
"id": "787b68aebcca51bd08f1da564f2985009fd391e9",
"size"... |
import sys, os, time
import doctest
sys.path.append("..")
from mas.multiagent import *
def test_context_basic() :
'''
>>> test_context_basic()
Initialization.
Context: <<multiagent.Context has_oracle=1>>
Time: 0.0000
Object: <<multiagent.Object name=0>>
Obstacle: <<multiagent.Obstacle name... | {
"content_hash": "6995bfa54c6b3056e0b6665141214218",
"timestamp": "",
"source": "github",
"line_count": 101,
"max_line_length": 161,
"avg_line_length": 36.01980198019802,
"alnum_prop": 0.597306212204508,
"repo_name": "csningli/MultiAgent",
"id": "bcae97221a5461e1dd5e183e7d79e50bf60df016",
"size": "... |
import sklearn_crfsuite
from sklearn_crfsuite import scorers
from sklearn_crfsuite import metrics
import json
import codecs
import random
from crf_ner import get_features, get_X_y, train_model
# config
ENCODING = 'utf-8'
FILE_PATH = '../data/ner/train.json'
SEED = 7
SPLIT = 0.20
def load():
json_data = json.load... | {
"content_hash": "bfdbfc73b3d0331560ef8a4a9975393a",
"timestamp": "",
"source": "github",
"line_count": 91,
"max_line_length": 71,
"avg_line_length": 24.274725274725274,
"alnum_prop": 0.6034404708012675,
"repo_name": "lastmansleeping/hindi-toolkit",
"id": "d1cddd791e38b71e65763d576ae6f97cde68f78e",
... |
import _plotly_utils.basevalidators
class B0Validator(_plotly_utils.basevalidators.NumberValidator):
def __init__(self, plotly_name="b0", parent_name="carpet", **kwargs):
super(B0Validator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
edit_type=kwar... | {
"content_hash": "7c7658d3041fd093a9c563b341d49b1f",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 73,
"avg_line_length": 34.63636363636363,
"alnum_prop": 0.6062992125984252,
"repo_name": "plotly/plotly.py",
"id": "7f6b8166b206eda3dd7153b2a4ca9d3fff64fee3",
"size": "381"... |
from __future__ import absolute_import, unicode_literals
from gaebusiness.business import CommandExecutionException
from gaecookie.decorator import no_csrf
from gaepermission.decorator import login_required
from tekton.gae.middleware.json_middleware import JsonResponse, JsonUnsecureResponse
from book_app import facade
... | {
"content_hash": "5ea0defbe730f1bde3465b0db2972e0c",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 84,
"avg_line_length": 29.27906976744186,
"alnum_prop": 0.7148530579825259,
"repo_name": "renzon/fatec-script-2",
"id": "afa193246b933b04289947fb45cb667d774fa17c",
"size": ... |
__revision__ = "src/engine/SCons/Tool/MSCommon/__init__.py 2014/09/27 12:51:43 garyo"
__doc__ = """
Common functions for Microsoft Visual Studio and Visual C/C++.
"""
import copy
import os
import re
import subprocess
import SCons.Errors
import SCons.Platform.win32
import SCons.Util
from SCons.Tool.MSCommon.sdk imp... | {
"content_hash": "d6a9ed8a12da0830fdbb7ebd8c3dbf3d",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 86,
"avg_line_length": 28.333333333333332,
"alnum_prop": 0.5454545454545454,
"repo_name": "smandy/locke",
"id": "7c05452bf84fc61aaed005fc820609745299cb68",
"size": "2048",
... |
from GenSched import Schedule, Theater_Room
class SpecGenreSchedule(Schedule):
def __init__(self):
#Doesn't need to do anything in here. Type in anything to make sure indentation doesn't messes up.
1
def schedule(self, name, genre):
for i in range(0, len(self.theaters)):
if(self.theaters[i].get_genre() == ... | {
"content_hash": "ce1c350d559e430312eacb0cd7116285",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 167,
"avg_line_length": 42.68,
"alnum_prop": 0.6457357075913777,
"repo_name": "askii93/Strategy-Movies",
"id": "3b4cdd65d0894ccfb974853b61bdc8540821d3bd",
"size": "1067",
... |
from __future__ import absolute_import, division, print_function, unicode_literals
import unittest
from nose.plugins.attrib import attr
import hgvs.variant
@attr(tags=["quick","models"])
class Test_SequenceVariant(unittest.TestCase):
def test_SequenceVariant(self):
var = hgvs.variant.SequenceVariant(ac=... | {
"content_hash": "9ce0ba90be3280b5ab4a3d5c98870874",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 82,
"avg_line_length": 33.90909090909091,
"alnum_prop": 0.7184986595174263,
"repo_name": "jmuhlich/hgvs",
"id": "3852a2d2b906268cb8698d70e089d5d5f92cbe61",
"size": "1143",
... |
from __future__ import unicode_literals
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('servisformu', '0004_auto_20160114_1526'),
]
operations = [
migrations.AddField(
model_name='urunler',
... | {
"content_hash": "3cf8b5c42fcef6890cedc5ebc2bdb717",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 114,
"avg_line_length": 30.79310344827586,
"alnum_prop": 0.606942889137738,
"repo_name": "muslu/django-teknikservis-py3",
"id": "bb7f1c5bb18c433d23506ab42f64ee8c2da3904f",
... |
from netmiko.huawei.huawei_ssh import HuaweiSSH
__all__ = ['HuaweiSSH']
| {
"content_hash": "683c0b54d8cc67c2e8fa5693352f033f",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 47,
"avg_line_length": 24.333333333333332,
"alnum_prop": 0.726027397260274,
"repo_name": "sbyount/my_python",
"id": "af11986699f49f9b316659baf37e3b77ce29c07b",
"size": "73",... |
from __future__ import absolute_import
from __future__ import print_function
from contextlib import contextmanager
from typing import (cast, Any, Callable, Dict, Generator, Iterable, Iterator, List, Mapping,
Optional, Sized, Tuple, Union)
from django.core.urlresolvers import LocaleRegexURLResolver
... | {
"content_hash": "4970c5e636bd50727e2ba8f035f9a92b",
"timestamp": "",
"source": "github",
"line_count": 379,
"max_line_length": 154,
"avg_line_length": 35.39841688654354,
"alnum_prop": 0.6066636851520573,
"repo_name": "Jianchun1/zulip",
"id": "d811bd3714db277911a36b425395766156e5fb9b",
"size": "134... |
import random
from enum import Enum
X, O = TOKENS = 'XO'
WIN_MASKS = [
0b100100100,
0b10010010,
0b1001001,
0b111000000,
0b111000,
0b111,
0b100010001,
0b1010100,
]
SIZE = 9
EMPTY = 2 ** SIZE - 1
FULL = 0
Events = Enum('Events', 'Start Move Win Draw')
class Tree:
pass
class Stat... | {
"content_hash": "a72167ab9d79556721324626658453fb",
"timestamp": "",
"source": "github",
"line_count": 179,
"max_line_length": 69,
"avg_line_length": 19.810055865921786,
"alnum_prop": 0.5910885504794134,
"repo_name": "jorgebg/tictactoe",
"id": "b6eb8257e16dfa67cbe9d9a9a9d9a3d924007d68",
"size": "3... |
import datetime
from operator import attrgetter
from .models import (
Country, Person, Group, Membership, Friendship, Article,
ArticleTranslation, ArticleTag, ArticleIdea, NewsArticle)
from django.test import TestCase
from django.utils.translation import activate
from django.core.exceptions import FieldError
f... | {
"content_hash": "13a6b91b0fa9e2d3a1bee399ee117ff0",
"timestamp": "",
"source": "github",
"line_count": 385,
"max_line_length": 100,
"avg_line_length": 43.25454545454546,
"alnum_prop": 0.6324385996517145,
"repo_name": "alu0100207385/dsi_3Django",
"id": "cd81cc68a24a940125dd662b55c648425c2dff08",
"s... |
import inspect
from util.log import *
class Callback(object):
def __init__(self):
if not callable(getattr(self, "callback", None)):
ERROR("callback method not found.")
return
self.callback_param_names = inspect.getargspec(self.callback)[0]
DEBUG(self.callback_param_... | {
"content_hash": "77b266a2bc6a9b785015cb659716408e",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 73,
"avg_line_length": 35.04,
"alnum_prop": 0.5176940639269406,
"repo_name": "fangjing828/LEHome",
"id": "64b600a29244ce9264974243ce175b71617f1c85",
"size": "2394",
"bina... |
"""Django middleware for NDB."""
__author__ = 'James A. Morrison'
from . import eventloop, tasklets
class NdbDjangoMiddleware(object):
"""Django middleware for NDB.
To use NDB with django, add
'ndb.NdbDjangoMiddleware',
to the MIDDLEWARE_CLASSES entry in your Django settings.py file.
Or, if you are u... | {
"content_hash": "c55fb4a8ea7d9e062c376b1c5a83ccc6",
"timestamp": "",
"source": "github",
"line_count": 51,
"max_line_length": 73,
"avg_line_length": 31.137254901960784,
"alnum_prop": 0.7103274559193955,
"repo_name": "GoogleCloudPlatform/python-compat-runtime",
"id": "fce0682f3626843d25ce04b73363d4ab... |
from flask.ext.wtf import Form
from wtforms import StringField, BooleanField, TextAreaField
from wtforms.validators import DataRequired, Length
class LoginForm(Form):
openid = StringField('openid', validators=[DataRequired()])
remember_me = BooleanField('remember_me', default=False)
class EditForm(Form):
nic... | {
"content_hash": "be97f20bfa899cb935d078b911272fa6",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 74,
"avg_line_length": 41.36363636363637,
"alnum_prop": 0.7670329670329671,
"repo_name": "kweztah/com.sociavist",
"id": "7130153fb6b36722ef722308c7e948402a995ca9",
"size": ... |
from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^$', views.tax_list, name='taxes'),
url(r'^(?P<country_code>[A-Z]{2})/details/$', views.tax_details,
name='tax-details'),
url(r'^configure-taxes/$', views.configure_taxes,
name='configure-taxes'),
url(r'^fetch-t... | {
"content_hash": "9e17a334fa6e1ec4a8cec06002b92cfa",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 68,
"avg_line_length": 32.416666666666664,
"alnum_prop": 0.6169665809768637,
"repo_name": "UITools/saleor",
"id": "1d22e4e2fc6f3475b918fbdd48b5e30836b0c31b",
"size": "389",... |
__author__ = 'sshnaidm'
import sys
import xml.etree.ElementTree as Et
with open(sys.argv[1]) as f:
xml = f.read()
exml = Et.fromstring(xml)
tmp_fails = [i.attrib["classname"] + "." + i.attrib["name"]
for i in exml.getchildren()
for z in i.getchildren()
if i.getchildren()
if "... | {
"content_hash": "5c98e2e40ba7f48d8af9418504956742",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 63,
"avg_line_length": 23.05,
"alnum_prop": 0.6052060737527115,
"repo_name": "sshnaidm/openstack-sqe",
"id": "bd9d01fa9bd064ef151bb174ad76b734afcf4e41",
"size": "461",
"b... |
import urlparse
import urllib
import cgi
import hashlib
from six import moves
from w3lib.util import unicode_to_str
import tldextract
# Python 2.x urllib.always_safe become private in Python 3.x;
# its content is copied here
_ALWAYS_SAFE_BYTES = (b'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
b'abcdefghijklmnopq... | {
"content_hash": "ece4320b108ae3f8ae8f87bc6801020b",
"timestamp": "",
"source": "github",
"line_count": 111,
"max_line_length": 107,
"avg_line_length": 37.153153153153156,
"alnum_prop": 0.6006304558680893,
"repo_name": "rahulsharma1991/frontera",
"id": "8a990d75a6d07147559e97aa1b45a44e3b60b4fa",
"s... |
import itertools
from oslo_log import log as logging
from oslo_serialization import jsonutils
from oslo_utils import netutils
from heat.common import exception
from heat.common.i18n import _
from heat.engine import resource
from heat.engine.resources.openstack.neutron import port as neutron_port
LOG = logging.getLo... | {
"content_hash": "7e6df147e31fa8da11eff6c80e8000b8",
"timestamp": "",
"source": "github",
"line_count": 458,
"max_line_length": 79,
"avg_line_length": 43.146288209606986,
"alnum_prop": 0.5502251910328425,
"repo_name": "dims/heat",
"id": "16f0c898848560db2c0cde339147ae0dcb9f970b",
"size": "20336",
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.