text stringlengths 4 1.02M | meta dict |
|---|---|
import sys
from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload
from azure.core.exceptions import (
ClientAuthenticationError,
HttpResponseError,
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
map_error,
)
from azure.core.pipeline import Pipeline... | {
"content_hash": "4464a493cbb01f5e88922877dfe2c51e",
"timestamp": "",
"source": "github",
"line_count": 207,
"max_line_length": 203,
"avg_line_length": 43.14492753623188,
"alnum_prop": 0.6675624230209383,
"repo_name": "Azure/azure-sdk-for-python",
"id": "57cd06f5e5f9db047128da35d70f45a14ab41b23",
"... |
from validator import decorator
MANIFEST_URI = 'https://developer.mozilla.org/en/XUL_Tutorial/Manifest_Files'
DANGEROUS_CATEGORIES = ('JavaScript-global-constructor',
'JavaScript-global-constructor-prototype-alias',
'JavaScript-global-property',
... | {
"content_hash": "6dd3b41eda0e2d8ae66b2ca5a0b585fd",
"timestamp": "",
"source": "github",
"line_count": 125,
"max_line_length": 79,
"avg_line_length": 44.104,
"alnum_prop": 0.5682931253401052,
"repo_name": "mstriemer/amo-validator",
"id": "a6b49efbb61987a0937d3f7647f6806ca652311b",
"size": "5513",
... |
"""
This file starts the Twister Server.
"""
# Patch for _DummyThread __stop error
import threading
threading._DummyThread._Thread__stop = lambda x: 1
import cherrypy
cherrypy.log.access_log.propagate = False
cherrypy.log.error_log.setLevel(10)
import os
import sys
import time
import thread
from rpyc.utils.server im... | {
"content_hash": "9f1368d03c50d821fc7ff2d8cfab9853",
"timestamp": "",
"source": "github",
"line_count": 166,
"max_line_length": 104,
"avg_line_length": 30.259036144578314,
"alnum_prop": 0.5827194903444157,
"repo_name": "Luxoft/Twister",
"id": "30c929653dabe9fd7ea08d70f45e4c274d1ce13a",
"size": "588... |
from functools import wraps
def fsm_log_by(func):
@wraps(func)
def wrapped(*args, **kwargs):
arg_list = list(args)
instance = arg_list.pop(0)
if kwargs.get('by', False):
instance.by = kwargs['by']
if kwargs.get('description', False):
instanc... | {
"content_hash": "fa534ae4b0039faec74cd0f86010d20a",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 56,
"avg_line_length": 24.52,
"alnum_prop": 0.5530179445350734,
"repo_name": "mord4z/django-fsm-log",
"id": "cc5eb030dcf949ed6ccc745f213074876fae6f45",
"size": "613",
"bi... |
from cStringIO import StringIO
import boto.connection
import boto.exception
import boto.s3.connection
import boto.s3.acl
import boto.utils
import bunch
import nose
import operator
import random
import string
import socket
import ssl
import os
import re
from urlparse import urlparse
from boto.s3.connection import S3Co... | {
"content_hash": "68ee80b4c5bb52b5237e9918f2ef3d6e",
"timestamp": "",
"source": "github",
"line_count": 1753,
"max_line_length": 202,
"avg_line_length": 31.527666856816886,
"alnum_prop": 0.6970217847579069,
"repo_name": "Qihoo360/zeppelin-gateway",
"id": "f45a1620c83cdce11e45b3f08f960a4bbf800d10",
... |
from __future__ import absolute_import, unicode_literals
import datetime
from decimal import Decimal
from django import test
from django import forms
from django.core.exceptions import ValidationError
from django.db import models
from django.db.models.fields.files import FieldFile
from django.utils import unittest
f... | {
"content_hash": "483860f4d127352cf2abe02838bafdcb",
"timestamp": "",
"source": "github",
"line_count": 365,
"max_line_length": 95,
"avg_line_length": 39.50684931506849,
"alnum_prop": 0.6381414701803051,
"repo_name": "rebost/django",
"id": "b94c4696f9afdb9bcef96b564fe87272f44bcc7d",
"size": "14420"... |
from pyvx.backend import *
from pyvx.nodes import *
Image = CoreImage
Graph = CoreGraph
| {
"content_hash": "1079d4380cb3132b6e9a09aa4981809b",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 26,
"avg_line_length": 17.8,
"alnum_prop": 0.7640449438202247,
"repo_name": "hakanardo/pyvx",
"id": "708005ccadfbf62173f93e09bf3a28c822ae36e1",
"size": "89",
"binary": fal... |
from libcloud.utils.misc import get_driver as get_provider_driver
from libcloud.utils.misc import set_driver as set_provider_driver
from libcloud.loadbalancer.types import Provider
__all__ = [
"Provider",
"DRIVERS",
"get_driver",
]
DRIVERS = {
Provider.RACKSPACE_US:
('libcloud.loadbala... | {
"content_hash": "400f31be8a4cb13973d94e0d03acd05f",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 79,
"avg_line_length": 34.25806451612903,
"alnum_prop": 0.6826741996233522,
"repo_name": "ConPaaS-team/conpaas",
"id": "cf2411d845a136a13b2c97ae7bc4b18078cce720",
"size": "... |
"""Utility functions and classes for supporting query conditions.
Classes:
`CompileCondition`
Container for a compiled condition.
Functions:
`compile_condition`
Compile a condition and extract usable index conditions.
`call_on_recarr`
Evaluate a function over a structured array.
"""
import re
from num... | {
"content_hash": "ef319b01ae88fac2b5916dac3022a008",
"timestamp": "",
"source": "github",
"line_count": 440,
"max_line_length": 79,
"avg_line_length": 35.53409090909091,
"alnum_prop": 0.6117684681803646,
"repo_name": "jack-pappas/PyTables",
"id": "1757b7d52fb09c0b80def4f357cab9a5ce08409f",
"size": ... |
from async_geocoder import AsyncGeocoder
import asyncio
from shapely.geometry import Point, LineString
import json
import sys
import logging
import re
logging.basicConfig(stream=sys.stdout, level=logging.DEBUG)
log = logging.getLogger()
class ElasticGeocoder(AsyncGeocoder):
"""
Implements AsyncGeocoder with ... | {
"content_hash": "4fe8f308f35a1b76813c47db75605350",
"timestamp": "",
"source": "github",
"line_count": 265,
"max_line_length": 120,
"avg_line_length": 42.18490566037736,
"alnum_prop": 0.35629304946775203,
"repo_name": "national-voter-file/async_py_geocoder",
"id": "42439994f1de111138b2cfdc392b136bae... |
from django.forms import ModelForm
from .models import BonusData
class SettingsForm(ModelForm):
def clean_twitter(self):
data = self.cleaned_data['twitter'].strip()
if len(data)>0:
if data[0] != "@":
return "@"+data
return data
class Meta:
model = Bon... | {
"content_hash": "8bfe7e623028be98dd83327f05e27078",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 51,
"avg_line_length": 27.5625,
"alnum_prop": 0.5374149659863946,
"repo_name": "michcioperz/nyuuu",
"id": "ce674e17c0f7aae9b530f87004e601a202fe23ee",
"size": "441",
"bina... |
from a10sdk.common.A10BaseClass import A10BaseClass
class Icmpv6RateLimit(A10BaseClass):
"""Class Description::
Limit the rate of ICMPv6 packet.
Class icmpv6-rate-limit supports CRUD Operations and inherits from `common/A10BaseClass`.
This class is the `"PARENT"` class for this module.`
:pa... | {
"content_hash": "d7c05c3b992ab046e891628b97bbe58b",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 276,
"avg_line_length": 44.75609756097561,
"alnum_prop": 0.6517711171662125,
"repo_name": "amwelch/a10sdk-python",
"id": "828ebfdc01affd3ed7e780ef45448a5886aef103",
"size":... |
from __future__ import unicode_literals
from django.db import migrations
import wagtail.core.blocks
import wagtail.core.fields
import wagtail.images.blocks
class Migration(migrations.Migration):
dependencies = [
('core', '0007_auto_20171128_1157'),
]
operations = [
migrations.AlterModel... | {
"content_hash": "f7da9d2ebb7bfbd825ac01e10991ab59",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 311,
"avg_line_length": 33.62068965517241,
"alnum_prop": 0.64,
"repo_name": "nfletton/bvspca",
"id": "47deee3768b39cab374be34a4d0114a49d911260",
"size": "1048",
"binary":... |
"""Constants for the Renault integration tests."""
from homeassistant.components.binary_sensor import BinarySensorDeviceClass
from homeassistant.components.renault.const import (
CONF_KAMEREON_ACCOUNT_ID,
CONF_LOCALE,
DEVICE_CLASS_CHARGE_MODE,
DEVICE_CLASS_CHARGE_STATE,
DEVICE_CLASS_PLUG_STATE,
... | {
"content_hash": "19d4bff9f688310361e33eac37af0ce0",
"timestamp": "",
"source": "github",
"line_count": 795,
"max_line_length": 77,
"avg_line_length": 41.99245283018868,
"alnum_prop": 0.5255511622334053,
"repo_name": "toddeye/home-assistant",
"id": "41a72c6b7ab375f3c47b3160c8b9b74ce55f3a63",
"size"... |
import unittest
from django.contrib.gis.gdal import OGRGeometry, OGRGeomType, \
OGRException, OGRIndexError, SpatialReference, CoordTransform, \
gdal_version
from django.contrib.gis.tests.geometries import *
class OGRGeomTest(unittest.TestCase):
"This tests the OGR Geometry."
def test00_geomtype(self)... | {
"content_hash": "d4ef74676dd4aa5a7ae0734fafa01ea8",
"timestamp": "",
"source": "github",
"line_count": 404,
"max_line_length": 88,
"avg_line_length": 41.32178217821782,
"alnum_prop": 0.5736192644063736,
"repo_name": "chewable/django",
"id": "8f5caa9615b190942499f2a13d2290ec260038c2",
"size": "1669... |
from .vtk_particles import VTKParticles
from .vtk_lattice import VTKLattice
from .vtk_mesh import VTKMesh
__all__ = ['VTKParticles', 'VTKLattice', 'VTKMesh']
| {
"content_hash": "684ad1e0dfde55b6b855b92b8c62ee60",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 51,
"avg_line_length": 31.8,
"alnum_prop": 0.7547169811320755,
"repo_name": "simphony/simphony-mayavi",
"id": "02e15a5383fa6c2569971e462ec65dc921bd1588",
"size": "159",
"b... |
"""Hook for winrm remote execution."""
import getpass
from typing import Optional
from winrm.protocol import Protocol
from airflow.exceptions import AirflowException
from airflow.hooks.base import BaseHook
# TODO: Fixme please - I have too complex implementation
# pylint: disable=too-many-instance-attributes,too-ma... | {
"content_hash": "71c00b0b86dc4a151715b7005ac9344f",
"timestamp": "",
"source": "github",
"line_count": 222,
"max_line_length": 106,
"avg_line_length": 46.91891891891892,
"alnum_prop": 0.6177995391705069,
"repo_name": "DinoCow/airflow",
"id": "2524a816f08804414e40948250f43a951762b9e6",
"size": "112... |
"""This module implements a loader and dumper for the svmlight format
This format is a text-based format, with one sample per line. It does
not store zero valued features hence is suitable for sparse dataset.
The first element of each line can be used to store a target variable to
predict.
This format is used as the... | {
"content_hash": "678d13837165b6d90a599223687f8c79",
"timestamp": "",
"source": "github",
"line_count": 379,
"max_line_length": 79,
"avg_line_length": 38.43007915567282,
"alnum_prop": 0.6378990731204943,
"repo_name": "Garrett-R/scikit-learn",
"id": "f2a188221e33302424b80991ebefe91e25a8e2c5",
"size"... |
from __future__ import absolute_import
from __future__ import print_function
import sys
import tornado.web
import logging
from django import http
from django.conf import settings
from django.core.handlers.wsgi import WSGIRequest, get_script_name
from django.core.handlers import base
from django.core.urlresolvers impor... | {
"content_hash": "1de3950585013fd22165d2d53be1ed5f",
"timestamp": "",
"source": "github",
"line_count": 317,
"max_line_length": 172,
"avg_line_length": 43.53312302839117,
"alnum_prop": 0.5652898550724638,
"repo_name": "j831/zulip",
"id": "3fa3437430407e6f630aa496b2e6d24b93f301ce",
"size": "13800",
... |
from setuptools import setup
setup(
name="Takeout Analyser",
version="0.1.0",
author="Britt Gresham",
author_email="britt@brittg.com",
description=("Make pretty graphs out of Google Takeout Data"),
license="MIT",
install_requires=[
'beautifulsoup4',
'python-dateutil',
... | {
"content_hash": "ea24b5df8c682f570cd413bf920a77b8",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 66,
"avg_line_length": 22.40909090909091,
"alnum_prop": 0.5841784989858012,
"repo_name": "demophoon/Google-Voice-Takeout-Analyser",
"id": "765f5dcbde1e92f93cb21e37e812d2ef597... |
import unittest
import numpy
import chainer
from chainer.backends import cuda
from chainer import functions
from chainer import gradient_check
from chainer import testing
from chainer.testing import attr
from chainer.utils import collections_abc
def _pair(x):
if isinstance(x, collections_abc.Iterable):
... | {
"content_hash": "31b3be5a3533eee9a28a13b3a425944f",
"timestamp": "",
"source": "github",
"line_count": 113,
"max_line_length": 73,
"avg_line_length": 34.69911504424779,
"alnum_prop": 0.5944912012241775,
"repo_name": "tkerola/chainer",
"id": "8f10cec8b1f873449143ff5f206b32b40cba3107",
"size": "3921... |
import sys
from langid import arguments, model, output
def main():
"""
Language identification main script.
This script identifies the language of a text.
The text is read from STDIN.
The language is displayed on STDOUT using a 2 letter code (e.g. 'en', 'de')
"""
args = arguments.parse_ar... | {
"content_hash": "d10a6732540d923ad332e62d1ed0c7f3",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 79,
"avg_line_length": 23.05,
"alnum_prop": 0.6377440347071583,
"repo_name": "tritzer/plug-nlp",
"id": "3fca3ae09b527c4dd710d79a303739919d3d327c",
"size": "461",
"binary"... |
import tensorflow as tf
# Default hyperparameters:
hparams = tf.contrib.training.HParams(
# Comma-separated list of cleaners to run on text prior to training and eval. For non-English
# text, you may want to use "basic_cleaners" or "transliteration_cleaners" See TRAINING_DATA.md.
cleaners='english_cleaners',
... | {
"content_hash": "1762f3a437931903a9d7a5ac48ccc379",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 98,
"avg_line_length": 25.21276595744681,
"alnum_prop": 0.6894514767932489,
"repo_name": "keithito/tacotron",
"id": "05ae82a351e3bc27375040d5d8fc95fda9ea8bf3",
"size": "118... |
"""Gpg module. Used for runbook signature validation."""
import os
import subprocess
import configuration
import subprocessfactory
import tracer
from workerexception import *
GPG = "gpg"
GPG_BATCH_OPTION = "--batch"
GPG_DECRYPT_OPTION = "--decrypt"
GPG_KEYRING_OPTION = "--keyring"
GPG_NO_DEFAULT_KEYRING_OPTION = "--... | {
"content_hash": "c1bc06ded100496230f63a681a9420b9",
"timestamp": "",
"source": "github",
"line_count": 66,
"max_line_length": 117,
"avg_line_length": 38.09090909090909,
"alnum_prop": 0.656722354813047,
"repo_name": "MSFTOSSMgmt/WPSDSCLinux",
"id": "59ce7b4946a55cb2a164d766c7bbb6a98046d613",
"size"... |
import flatbuffers
class PcaModelR(object):
__slots__ = ['_tab']
@classmethod
def GetRootAsPcaModelR(cls, buf, offset):
n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
x = PcaModelR()
x.Init(buf, n + offset)
return x
# PcaModelR
def Init(self, b... | {
"content_hash": "f51ce149a9fe33642468ceab129f30b1",
"timestamp": "",
"source": "github",
"line_count": 154,
"max_line_length": 171,
"avg_line_length": 41.48051948051948,
"alnum_prop": 0.6734502191609267,
"repo_name": "quanhua92/learning-notes",
"id": "5f2bbbce72d8de98ce281254e3821de2bb1be73b",
"si... |
from numpy import *
from string import upper
def iainterot(Iab, theta=45, DIRECTION="CLOCKWISE"):
from iase2hmt import iase2hmt
from iaserot import iaserot
DIRECTION = upper(DIRECTION)
A,Bc = Iab
if DIRECTION != 'CLOCKWISE':
theta = 360 - theta
Irot = iase2hmt( iaserot(A, theta),
... | {
"content_hash": "6560cc14faec52d045ae56a07c666014",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 52,
"avg_line_length": 20.77777777777778,
"alnum_prop": 0.6336898395721925,
"repo_name": "mariecpereira/IA369Z",
"id": "0f492d3399f9936184e09543c905424a9f4a97cb",
"size": "... |
def before_send(event, hint):
"""
Log 400 Bad Request errors with the same custom fingerprint so that we can
group them and ignore them all together. See:
https://github.com/getsentry/sentry-python/issues/149#issuecomment-434448781
"""
log_record = hint.get('log_record')
if log_record and ha... | {
"content_hash": "3760b4ca2454c357d0594719990edeb0",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 80,
"avg_line_length": 43.90909090909091,
"alnum_prop": 0.6770186335403726,
"repo_name": "datamade/la-metro-councilmatic",
"id": "b47dc2cd75c469f7350cadf3a9232922625dda7c",
... |
from nose.tools import *
from lamson.testing import *
import os
from lamson import server
relay = relay(port=8823)
client = RouterConversation("somedude@localhost", "requests_tests")
confirm_format = "testing-confirm-[0-9]+@"
noreply_format = "testing-noreply@"
def test_forwards_relay_host():
"""
!!!!!! YOU ... | {
"content_hash": "3cf5f202bdd1142ee70711aaddcaaa49",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 196,
"avg_line_length": 35.86206896551724,
"alnum_prop": 0.7096153846153846,
"repo_name": "jluttine/mail-forwarder",
"id": "cd3a385b00683d640ad904a83c7e9d0220271b15",
"size... |
from ._version import get_versions
from .namespace import NEW_NAMESPACE as DEFAULT_NAMESPACE
from .models import (
BackgroundJobItem,
ColumnItem,
ConnectionCredentials,
ConnectionItem,
DQWItem,
DailyInterval,
DataAlertItem,
DatabaseItem,
DatasourceItem,
FlowItem,
FlowRunItem,... | {
"content_hash": "12157fa86a42fd3c604bc784450f93c5",
"timestamp": "",
"source": "github",
"line_count": 54,
"max_line_length": 57,
"avg_line_length": 19.166666666666668,
"alnum_prop": 0.6908212560386473,
"repo_name": "tableau/server-client-python",
"id": "212540d84d37d33ce8fdabe5ed4f68302ce60c87",
... |
from a10sdk.common.A10BaseClass import A10BaseClass
class Ipv6(A10BaseClass):
"""Class Description::
Configure sFlow IPv6 collector.
Class ipv6 supports CRUD Operations and inherits from `common/A10BaseClass`.
This class is the `"PARENT"` class for this module.`
:param uuid: {"description":... | {
"content_hash": "8407014bef2ebea9d7e17f065c64f093",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 171,
"avg_line_length": 35.05,
"alnum_prop": 0.6219686162624821,
"repo_name": "a10networks/a10sdk-python",
"id": "801f1af1cf62ca789db4b42d8c2d3ad3dd7a14dd",
"size": "1402",... |
import os
import IECore
import Gaffer
import GafferTest
import GafferImage
import GafferImageTest
class DeleteImageMetadataTest( GafferImageTest.ImageTestCase ) :
checkerFile = os.path.expandvars( "$GAFFER_ROOT/python/GafferImageTest/images/checker.exr" )
def test( self ) :
i = GafferImage.ImageReader()
i["... | {
"content_hash": "d82b1573eda6811aee1b3993eae60c63",
"timestamp": "",
"source": "github",
"line_count": 64,
"max_line_length": 93,
"avg_line_length": 29.703125,
"alnum_prop": 0.6970015781167807,
"repo_name": "ivanimanishi/gaffer",
"id": "0265340dd726829b7471802fd9760134c876ea3d",
"size": "3704",
... |
from direct.fsm import FSM
from direct.gui.DirectGui import *
from direct.directnotify import DirectNotifyGlobal
from direct.interval.IntervalGlobal import *
from toontown.toonbase import ToontownGlobals
from toontown.toonbase import TTLocalizer
from toontown.fishing import FishPhoto
from toontown.fishing import... | {
"content_hash": "c89021bd6e40ca43c6217e45fd8be682",
"timestamp": "",
"source": "github",
"line_count": 101,
"max_line_length": 89,
"avg_line_length": 32.51485148514851,
"alnum_prop": 0.593483556638246,
"repo_name": "DedMemez/ODS-August-2017",
"id": "f336aa109155ab5b0abe4965ca6606a55da33e70",
"size... |
import os
from setuptools import setup
from setuptools import find_packages
here = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(here, 'README.rst')) as f:
README = f.read()
REQUIREMENTS = [
'google-apitools',
'httplib2 >= 0.9.1',
'oauth2client >= 1.4.6',
'protobuf == 3.0.... | {
"content_hash": "2419c2ad2e232494f9c4c2e700ceb1ca",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 63,
"avg_line_length": 26.68,
"alnum_prop": 0.618440779610195,
"repo_name": "thesandlord/gcloud-python",
"id": "0cccb9846624c3c764cbe6a7f1024dd2db16ee47",
"size": "1334",
... |
'''Autogenerated by xml_generate script, do not edit!'''
from OpenGL import platform as _p, arrays
# Code generation uses this
from OpenGL.raw.GL import _types as _cs
# End users want this...
from OpenGL.raw.GL._types import *
from OpenGL.raw.GL import _errors
from OpenGL.constant import Constant as _C
import ctypes
_... | {
"content_hash": "4e127c62c8f1d3dce81f2ab3f6495a22",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 119,
"avg_line_length": 45.84615384615385,
"alnum_prop": 0.7709731543624161,
"repo_name": "alexus37/AugmentedRealityChess",
"id": "8bec7a78ef815c669108337b9955421ae8412b87",
... |
import _plotly_utils.basevalidators
class SpikethicknessValidator(_plotly_utils.basevalidators.NumberValidator):
def __init__(
self, plotly_name="spikethickness", parent_name="layout.scene.xaxis", **kwargs
):
super(SpikethicknessValidator, self).__init__(
plotly_name=plotly_name,
... | {
"content_hash": "e668ffb13e537021c70257fab1622023",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 86,
"avg_line_length": 35.06666666666667,
"alnum_prop": 0.5988593155893536,
"repo_name": "plotly/python-api",
"id": "36aa0d82b3316ded5de490ea594ebaee9738ad39",
"size": "526... |
# ### Lock animated
# This is a simulation of a ship lock, similar to the ones we can see in the Panama Canal or in some North European ports.
# The lock has two doors (left and right) which can open when the level of water is the same at both sides of the door.
# The picture below shows a particular moment of t... | {
"content_hash": "6a6ed55cfc8d3ad04a8942da6c8511ef",
"timestamp": "",
"source": "github",
"line_count": 349,
"max_line_length": 478,
"avg_line_length": 39.64756446991404,
"alnum_prop": 0.6445038664450387,
"repo_name": "salabim/salabim",
"id": "d8fad2e8b74aeccf7ad64b7ca0721a79af8d12fa",
"size": "138... |
from django.urls import path
from . import views
app_name = "files"
urlpatterns = [
path("images/", views.ImageListView.as_view(), name="images"),
path("image-upload/", views.imageUpload, name="image-upload"),
path("image-delete/<int:pk>", views.ImageDeleteView.as_view(), name="image-delete"),
path("... | {
"content_hash": "4a790ebc82ef8f68541fed1df0c54e8b",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 88,
"avg_line_length": 32.75,
"alnum_prop": 0.6768447837150128,
"repo_name": "hackerspace-ntnu/website",
"id": "df8ed938d821e3f5a0d496034a5dfc3238028009",
"size": "393",
... |
"""inputs: functions that grab data from elsewhere"""
from asyncio import coroutine, Task
from aioes import Elasticsearch
from .utils import wait_for_fd
import asyncio
import sys
def type_boost(doctype, boost_factor):
"""Helper function to boost results from particular data stores"""
return { "boost_factor": boos... | {
"content_hash": "b05ee6c5e7c01d6d01f784451aaa3826",
"timestamp": "",
"source": "github",
"line_count": 84,
"max_line_length": 104,
"avg_line_length": 28.107142857142858,
"alnum_prop": 0.6501482422702245,
"repo_name": "exec-all/numad",
"id": "25e3af09f4c00ae2075cbb7e477335defd0b162e",
"size": "2383... |
"""Bandit source."""
from ..meta.entity import Color
from ..meta.source import Source
from ..parameters import access_parameters, MultipleChoiceParameter, Severities
ALL_BANDIT_METRICS = ["security_warnings", "source_up_to_dateness"]
BANDIT = Source(
name="Bandit",
description="Bandit is a tool designed to ... | {
"content_hash": "85a54dccd0d9a5a162e6d6ecd2c965ef",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 115,
"avg_line_length": 38.44444444444444,
"alnum_prop": 0.6192196531791907,
"repo_name": "ICTU/quality-time",
"id": "1d4dc25f2461785788eb6130b49b9709449d3dcd",
"size": "13... |
import sys
import socket
import re
from IPy import IP
from dns.resolver import Resolver, NXDOMAIN, NoNameservers, Timeout, NoAnswer
from threading import Thread
class Lookup(Thread):
def __init__(self, host, dnslist, listed, resolver):
Thread.__init__(self)
self.host = host
self.listed = l... | {
"content_hash": "e64c7c2ba37790fb3445b1275e711091",
"timestamp": "",
"source": "github",
"line_count": 116,
"max_line_length": 89,
"avg_line_length": 37.36206896551724,
"alnum_prop": 0.5032302722658053,
"repo_name": "WhatsCS/TS3-Bot",
"id": "f58f1d803ad502dd390654769148ff6f82b7e12d",
"size": "4357... |
import pathlib
import runpy
import subprocess
import sys
from unittest import mock
from mitmproxy import version
def test_version(capsys):
here = pathlib.Path(__file__).absolute().parent
version_file = here / ".." / ".." / "mitmproxy" / "version.py"
runpy.run_path(str(version_file), run_name='__main__')
... | {
"content_hash": "f8cd6cda74847399a4602c9f2083d5c1",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 88,
"avg_line_length": 30.333333333333332,
"alnum_prop": 0.6373626373626373,
"repo_name": "Kriechi/mitmproxy",
"id": "f6595c5277368d2f748ded2009938bd5f9ee0ed9",
"size": "10... |
from pytest import raises
from quarkc.environment import Environment
def test_query_environment():
env = Environment()
env['foo'] = 1
assert env['foo'] == 1
def test_environment_inclusion():
env = Environment()
env['foo'] = 1
assert 'foo' in env
def test_equal_names_collide():
env = E... | {
"content_hash": "53d173191691aa86c0df604161e23f10",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 50,
"avg_line_length": 19.862068965517242,
"alnum_prop": 0.625,
"repo_name": "datawire/quark",
"id": "74aad3bb2d801ef70a911203dad745bb70f7ad63",
"size": "576",
"binary": ... |
import json
import logging
import operator
from appengine_url_fetcher import AppEngineUrlFetcher
import url_constants
class ChannelInfo(object):
def __init__(self, channel, branch, version):
self.channel = channel
self.branch = branch
self.version = version
class BranchUtility(object):
def __init__(s... | {
"content_hash": "bacb33eba57ce85423709829e35ec5b2",
"timestamp": "",
"source": "github",
"line_count": 162,
"max_line_length": 80,
"avg_line_length": 35.58641975308642,
"alnum_prop": 0.614050303555941,
"repo_name": "Sidney84/pa-chromium",
"id": "1c683c682104d2cd6f9936e9da9647bde0ed3ffe",
"size": "... |
from django.db.models import Manager
from django.db.models.query import QuerySet
class PostQuerySet(QuerySet):
def public(self):
return self.filter(status__exact=self.model.STATUS_PUBLIC)
def private(self):
return self.filter(status__in=[
self.model.STATUS_PRIVATE,
])
c... | {
"content_hash": "e7c68f500e841f8e2b56161b6138b07f",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 66,
"avg_line_length": 22.72,
"alnum_prop": 0.6602112676056338,
"repo_name": "lsk112233/Clone-test-repo",
"id": "11f63310149e2042b72d62edabbcbd9c05a44b9e",
"size": "568",
... |
import random
import numpy as np
from sentences import Sentence
class SerialParser:
def __init__(self, transition_system, learner, num_epochs=100):
self.transition_system = transition_system
self.learner = learner
self.num_epochs = num_epochs
self.p_explore = 0.1
self.num... | {
"content_hash": "cfd153b319fd13223580f9bd4546a920",
"timestamp": "",
"source": "github",
"line_count": 102,
"max_line_length": 106,
"avg_line_length": 35.21568627450981,
"alnum_prop": 0.5595768374164811,
"repo_name": "andersjo/hals",
"id": "6594bc830905a2e2c381bd38e273e72338e77823",
"size": "3592"... |
"""Support for Canary camera."""
import asyncio
from datetime import timedelta
from typing import Callable, List
from haffmpeg.camera import CameraMjpeg
from haffmpeg.tools import IMAGE_JPEG, ImageFrame
import voluptuous as vol
from homeassistant.components.camera import PLATFORM_SCHEMA, Camera
from homeassistant.com... | {
"content_hash": "34acc5701eca5a9f458fb1fbcbd35c92",
"timestamp": "",
"source": "github",
"line_count": 167,
"max_line_length": 87,
"avg_line_length": 32.532934131736525,
"alnum_prop": 0.6245168415240199,
"repo_name": "sdague/home-assistant",
"id": "a90eb5a2825a84fc1f3bcd04b27a5ff4e9bb09f3",
"size"... |
from __future__ import absolute_import, division, print_function, unicode_literals
import os
import unittest
from pants.build_graph.address import Address
from pants.build_graph.build_file_aliases import BuildFileAliases, TargetMacro
from pants.build_graph.target import Target
from pants.engine.legacy.graph import Le... | {
"content_hash": "4cf2f980bccd71b2be149fc9e889084c",
"timestamp": "",
"source": "github",
"line_count": 125,
"max_line_length": 91,
"avg_line_length": 43,
"alnum_prop": 0.5789767441860465,
"repo_name": "twitter/pants",
"id": "b5b59a3a0d580b79c70cd2e9bb35b1fea1d67351",
"size": "5522",
"binary": fa... |
"""Access classess and identity for partitions.
Copyright (c) 2013 Clarinova. This file is licensed under the terms of
the Revised BSD License, included in this distribution as LICENSE.txt
"""
# import os
from sqlalchemy.orm import lazyload, noload
from sqlalchemy.orm.exc import NoResultFound
from six import iter... | {
"content_hash": "3b15ae0acdd6536c6709278bca1e72a5",
"timestamp": "",
"source": "github",
"line_count": 272,
"max_line_length": 115,
"avg_line_length": 32.26470588235294,
"alnum_prop": 0.5704193254329991,
"repo_name": "CivicKnowledge/ambry",
"id": "a0b64820874a10e13cabe9381a07de023d29033b",
"size":... |
import csv
from imdb import IMDb
import os.path
import sys
MODE = 'append' # append, write
if len(sys.argv) < 2:
print "Usage: %s <inputfile movies csv> <outputfile genre csv>" % sys.argv[0]
print " movies csv file must contain at least columns: movie_id, name, imdb_id"
sys.exit(1)
MOVIE_FILE = sys... | {
"content_hash": "b263f64da6134f6c1a66e4fb0bd1cc0e",
"timestamp": "",
"source": "github",
"line_count": 126,
"max_line_length": 104,
"avg_line_length": 30.634920634920636,
"alnum_prop": 0.5616580310880829,
"repo_name": "beefoo/hollywood-diversity",
"id": "f269d77a625fc25e2c2e6706f76b6e150a2f3b4e",
... |
"""
Tests for Posix backup driver.
"""
import os
import mock
from six.moves import builtins
from jacket.storage.backup.drivers import posix
from jacket import context
from jacket.storage import test
from jacket.tests.storage.unit import fake_constants as fake
FAKE_FILE_SIZE = 52428800
FAKE_SHA_BLOCK_SIZE_BYTES = ... | {
"content_hash": "88055ad7ecb8fcb581860868031f65ed",
"timestamp": "",
"source": "github",
"line_count": 168,
"max_line_length": 79,
"avg_line_length": 35.714285714285715,
"alnum_prop": 0.6388333333333334,
"repo_name": "HybridF5/jacket",
"id": "a9db2597aed280876da704f93592c910b21befb8",
"size": "663... |
from __future__ import absolute_import
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "pinecast.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| {
"content_hash": "d887a457310fbc1225e84383802c9877",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 72,
"avg_line_length": 24.454545454545453,
"alnum_prop": 0.7174721189591078,
"repo_name": "AlmostBetterNetwork/podmaster-host",
"id": "478bbce4136d66e8fc1d9e2f000d5b6897590cc... |
from __future__ import print_function
import collections
import datetime
from getopt import getopt, GetoptError
import os
import sys
from calendarserver.tools import tables
from calendarserver.tools.cmdline import utilityMain, WorkerService
from pycalendar.datetime import DateTime
from twext.enterprise.dal.record i... | {
"content_hash": "9a6c532dbedf9b02ba2c1d7fa4bb6a1e",
"timestamp": "",
"source": "github",
"line_count": 1421,
"max_line_length": 180,
"avg_line_length": 34.7100633356791,
"alnum_prop": 0.5365245423027797,
"repo_name": "macosforge/ccs-calendarserver",
"id": "84065bb165e781125535ffbb131884375fe834f6",
... |
"""
"""
import pytz
from datetime import datetime
from time import sleep
from vnpy.api.sopt import (
MdApi,
TdApi,
THOST_FTDC_OAS_Submitted,
THOST_FTDC_OAS_Accepted,
THOST_FTDC_OAS_Rejected,
THOST_FTDC_OST_NoTradeQueueing,
THOST_FTDC_OST_PartTradedQueueing,
THOST_FTDC_OST_AllTraded,
... | {
"content_hash": "50a2104c94cb16e03863c5b73316ff55",
"timestamp": "",
"source": "github",
"line_count": 872,
"max_line_length": 99,
"avg_line_length": 29.60894495412844,
"alnum_prop": 0.5625314690731632,
"repo_name": "bigdig/vnpy",
"id": "20311081df71ccdc2766795af5efb078765aff08",
"size": "26243",
... |
"""Top level ``eval`` module.
"""
import tokenize
from pandas.core import common as com
from pandas.computation.expr import Expr, _parsers, tokenize_string
from pandas.computation.scope import _ensure_scope
from pandas.compat import DeepChainMap, builtins
from pandas.computation.engines import _engines
from distutils.... | {
"content_hash": "add1d8a27de2e55af797e45339e0ec64",
"timestamp": "",
"source": "github",
"line_count": 240,
"max_line_length": 88,
"avg_line_length": 34.6875,
"alnum_prop": 0.6203003003003003,
"repo_name": "zrhans/pythonanywhere",
"id": "e3096a85ca7d7a22271a639963a1f50c4925e71f",
"size": "8348",
... |
import copy
import importlib
import sys
try:
from unittest import mock
except ImportError:
import mock
try:
import fastapi
FASTAPI_INSTALLED = True
except ImportError:
FASTAPI_INSTALLED = False
import unittest2
import rollbar
from rollbar.lib._async import AsyncMock
from rollbar.test import Bas... | {
"content_hash": "86127e319b9190ab82dff2e33e62b910",
"timestamp": "",
"source": "github",
"line_count": 391,
"max_line_length": 91,
"avg_line_length": 32.97442455242967,
"alnum_prop": 0.6195610020941597,
"repo_name": "rollbar/pyrollbar",
"id": "26c929eb370f1c8d3174885bc895a21586283aca",
"size": "12... |
import os
import sys
import platform
import subprocess
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from SCons import Environment
def is_active():
return True
def get_name():
return "Android"
def can_build():
return os.path.exists(get_env_android_sdk_root())
def get_opts():
return [
... | {
"content_hash": "16e9ac65ba6dcbba6a34bbe3d6618cdb",
"timestamp": "",
"source": "github",
"line_count": 192,
"max_line_length": 129,
"avg_line_length": 31.75,
"alnum_prop": 0.5958005249343832,
"repo_name": "godotengine/godot",
"id": "57a8d34d0e19235f05a7d9d61dc280f49da46646",
"size": "6096",
"bin... |
import unittest
from katas.beta.how_much_coffee_do_you_need import how_much_coffee
class HowMuchCoffeeTestCase(unittest.TestCase):
def test_equal_1(self):
self.assertEqual(how_much_coffee([]), 0)
def test_equal_2(self):
self.assertEqual(how_much_coffee(['cw']), 1)
def test_equal_3(self)... | {
"content_hash": "a0c1a34abf552c03a4d818400176e76d",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 72,
"avg_line_length": 29.5,
"alnum_prop": 0.6101694915254238,
"repo_name": "the-zebulan/CodeWars",
"id": "559403092a784838be5904554d6f1d569b7e1865",
"size": "708",
"bina... |
from builtins import str
from builtins import object
from re import compile as re_compile
import logging as logger
from bq_data_access.v2.errors import FeatureNotFoundException
# Import all supported data types
# ===============================
from bq_data_access.data_types.definitions import PlottableDataType, FEAT... | {
"content_hash": "826413f14091f0960b33c3e293f110b4",
"timestamp": "",
"source": "github",
"line_count": 207,
"max_line_length": 118,
"avg_line_length": 44.13526570048309,
"alnum_prop": 0.7359894921190894,
"repo_name": "isb-cgc/ISB-CGC-Webapp",
"id": "12e2904b76eaa0b174737af72e686e4ce2a71eff",
"size... |
"""
SoftLayer.messaging
~~~~~~~~~~~~~~~~~~~
Manager for the SoftLayer Message Queue service
:license: MIT, see LICENSE for more details.
"""
import json
import requests.auth
from SoftLayer import consts
from SoftLayer import exceptions
# pylint: disable=no-self-use
ENDPOINTS = {
"dal05": {
... | {
"content_hash": "d7091af84ca8e6f396db01e1cb2cb840",
"timestamp": "",
"source": "github",
"line_count": 396,
"max_line_length": 77,
"avg_line_length": 31.992424242424242,
"alnum_prop": 0.5575814981450785,
"repo_name": "underscorephil/softlayer-python",
"id": "8c273b6b595d7a9522a429a48d01eb485de55f27"... |
from sqlalchemy import Boolean, Column, DateTime, ForeignKey, Integer
from sqlalchemy import MetaData, String, Table
def upgrade(migrate_engine):
# Upgrade operations go here. Don't create your own engine;
# bind migrate_engine to your metadata
meta = MetaData()
meta.bind = migrate_engine
# load ... | {
"content_hash": "1540deabc8f24a171508244c46f73609",
"timestamp": "",
"source": "github",
"line_count": 75,
"max_line_length": 74,
"avg_line_length": 29.88,
"alnum_prop": 0.6157965194109772,
"repo_name": "eneabio/nova",
"id": "a626d2c7dbd1a4b69a5b08fe8884abf4a771db89",
"size": "2865",
"binary": f... |
"""Service Factory"""
# pylint: disable=too-many-arguments
from .. import LAUNCHKEY_PRODUCTION
from ..clients import ServiceClient
from .base import BaseFactory
class ServiceFactory(BaseFactory):
"""
Factory for creating clients when representing a LaunchKey Service Profile
"""
def __init__(self, s... | {
"content_hash": "d6e6aeb9f576a50b8b344f0531407efa",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 78,
"avg_line_length": 39.13157894736842,
"alnum_prop": 0.6671149966375253,
"repo_name": "LaunchKey/launchkey-python",
"id": "8d7b286bf82856342f886fb4a8da6422f7450b3d",
"si... |
PLUGINS = 'PLUGINS'
INVENTORY = 'INVENTORY'
PORT_STATE = 'port-state'
PORT_UP = "ACTIVE"
PORT_DOWN = "DOWN"
UUID = 'uuid'
TENANTID = 'tenant_id'
NETWORKID = 'network_id'
NETWORKNAME = 'name'
NETWORKPORTS = 'ports'
INTERFACEID = 'interface_id'
PORTSTATE = 'state'
PORTID = 'port_id'
PPNAME = 'name'
PPVLANID = 'vlan_id'... | {
"content_hash": "68cfb4ac23f51962f9b1417d2b0f209b",
"timestamp": "",
"source": "github",
"line_count": 144,
"max_line_length": 65,
"avg_line_length": 24.770833333333332,
"alnum_prop": 0.7266610597140454,
"repo_name": "savi-dev/quantum",
"id": "696dc17ebc0cff1be34a71a55e11a01ce804c8fe",
"size": "42... |
from __future__ import absolute_import
from __future__ import print_function
from __future__ import with_statement
import os
import shutil
import weakref
import tempfile
import functools
from txtorcon.util import available_tcp_port
# backwards-compatibility dance: we "should" be using the
# ...WithReactor class, but... | {
"content_hash": "1a87cdb63bb8f7d800a892c173925dd7",
"timestamp": "",
"source": "github",
"line_count": 802,
"max_line_length": 125,
"avg_line_length": 37.69950124688279,
"alnum_prop": 0.6271208863899455,
"repo_name": "david415/txtorcon",
"id": "ef3000767788f59db0ed8b91ff32c105e903d302",
"size": "3... |
from time import sleep
from mycroft import Message
from mycroft.messagebus.client.threaded_event_emitter import \
ThreadedEventEmitter
class TestThreadedEventEmitter:
def setup(self):
self.emitter = ThreadedEventEmitter()
self.count = 0
self.msg = Message('testing')
def example_e... | {
"content_hash": "dd69c89f7c42a4bf8e5a6b1603acd1da",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 75,
"avg_line_length": 33.25,
"alnum_prop": 0.6493506493506493,
"repo_name": "Dark5ide/mycroft-core",
"id": "5a711d32c46da91ab549c8095db864eaece03a56",
"size": "2043",
"b... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from units.compat.mock import patch
from ansible.modules.network.nxos import nxos_hsrp
from .nxos_module import TestNxosModule, set_module_args
class TestNxosHsrpModule(TestNxosModule):
module = nxos_hsrp
def setUp(self... | {
"content_hash": "cb92c2070882738eb8c3ec5d9df5ffca",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 101,
"avg_line_length": 44.083333333333336,
"alnum_prop": 0.5198487712665406,
"repo_name": "thaim/ansible",
"id": "2cb84a224dff31b6b031136f58453f700c725822",
"size": "2826"... |
import codecs
import os
import platform
import shutil
import subprocess
import sys
import tempfile
import abstractRenderer
#
# Renders to ConTeXt so we can make PDF. Main renderer for PDF of OEB
#
class Renderer(abstractRenderer.AbstractRenderer):
def runscript(self, c, prefix='', repeatFilter=''):
pp... | {
"content_hash": "6aade08cc6f31062c68c6318494b7028",
"timestamp": "",
"source": "github",
"line_count": 364,
"max_line_length": 212,
"avg_line_length": 40.77197802197802,
"alnum_prop": 0.5646519776295398,
"repo_name": "openenglishbible/USFM-Tools",
"id": "8bceb45ac5597f153864d103a62ff57752dbf6c0",
... |
from __future__ import print_function
import argparse
import os
import stat
import sys
# find the import for catkin's python package - either from source space or from an installed underlay
if os.path.exists(os.path.join('/opt/ros/kinetic/share/catkin/cmake', 'catkinConfig.cmake.in')):
sys.path.insert(0, os.path.j... | {
"content_hash": "4bb6f2bdaadb00bc5a44ee991e62ec7a",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 134,
"avg_line_length": 47.89655172413793,
"alnum_prop": 0.728581713462923,
"repo_name": "xiaozhuchacha/OpenBottle",
"id": "a3a0fb712a4741a2beb5966d9e0ac7a64f07d0bc",
"size... |
import logging as sys_logging
from oslo_reports import guru_meditation_report as gmr
from dragonflow import version
# During the call to gmr.TextGuruMeditation.setup_autorun(), Guru Meditation
# Report tries to start logging. Set a handler here to accommodate this.
logger = sys_logging.getLogger(None)
if not logger.... | {
"content_hash": "9c6340465a68604848a84888d9071105",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 76,
"avg_line_length": 35.714285714285715,
"alnum_prop": 0.802,
"repo_name": "openstack/dragonflow",
"id": "f4fc0ac83ad42176083aa65809916dcd6f0680bb",
"size": "1098",
"bi... |
from appcomposer.translator.tasks import cel
import sys
cel.worker_main(sys.argv + ['--concurrency=4', '--queues=critical-independent-tasks'])
| {
"content_hash": "98f6c7b941edde455a7c794fe42f5ae9",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 86,
"avg_line_length": 36,
"alnum_prop": 0.7638888888888888,
"repo_name": "morelab/appcomposer",
"id": "ca16587044920c61d41158a5370c95b48f3734f6",
"size": "162",
"binary":... |
import fnmatch
import threading
import itertools
import json
import operator
import os
import yaml
from ceilometer import dispatcher
from ceilometer.i18n import _
from ceilometer import keystone_client
from oslo_config import cfg
from oslo_log import log
import requests
import six
import stevedore.dispatch
LOG = log... | {
"content_hash": "aca9b6cf9afa1511009517e54ced3cde",
"timestamp": "",
"source": "github",
"line_count": 377,
"max_line_length": 79,
"avg_line_length": 40.389920424403186,
"alnum_prop": 0.5509949431930125,
"repo_name": "pkilambi/ceilometer",
"id": "ab34d0625c31f9379cb51971bc168acd3a319627",
"size": ... |
r"""
Newton's method is a rather popular iterative root finding algorithm. Starting
at an initial guess :math:`x_0` it tries to find better and better
approximations of the root of a function :math:`f(x)`. For this it uses the
first derivative :math:`f'(x)` of the function. The process
.. math::
x_{n+1} = x_n - ... | {
"content_hash": "dd238d91add6d66bf75b69c55c2997c9",
"timestamp": "",
"source": "github",
"line_count": 97,
"max_line_length": 79,
"avg_line_length": 27.278350515463917,
"alnum_prop": 0.5978835978835979,
"repo_name": "ZeeD26/python101",
"id": "23b74f05e4c5352dd701d76ef5557f37d55e4c19",
"size": "264... |
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = []
operations = [
migrations.CreateModel(
name="GroupPermission",
fields=[
(
... | {
"content_hash": "12f27ff41d6a4ee2c78ebf1d4669596c",
"timestamp": "",
"source": "github",
"line_count": 91,
"max_line_length": 84,
"avg_line_length": 31.945054945054945,
"alnum_prop": 0.38080495356037153,
"repo_name": "20c/django-namespace-perms",
"id": "15b5ffb4be026adc6e46dded2cf6bf8ed324b3dc",
"... |
import os.path as op
from copy import deepcopy
import warnings
import numpy as np
from scipy import fftpack
from numpy.testing import (assert_array_almost_equal, assert_equal,
assert_array_equal, assert_allclose)
from nose.tools import assert_true, assert_raises, assert_not_equal
from mne i... | {
"content_hash": "e7dce594478a9ab556f2e85b2dd4c152",
"timestamp": "",
"source": "github",
"line_count": 477,
"max_line_length": 78,
"avg_line_length": 37.15094339622642,
"alnum_prop": 0.6444331583996389,
"repo_name": "lorenzo-desantis/mne-python",
"id": "a2fab281a2eba3632124442e3352f86e5e3c7dfa",
"... |
from pythonforandroid.recipe import PythonRecipe
class IpaddressRecipe(PythonRecipe):
name = 'ipaddress'
version = '1.0.16'
url = 'https://pypi.python.org/packages/source/i/ipaddress/ipaddress-{version}.tar.gz'
depends = ['python2']
recipe = IpaddressRecipe()
| {
"content_hash": "f8c152998d754dd3daadddf5080f9642",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 87,
"avg_line_length": 22.416666666666668,
"alnum_prop": 0.7472118959107806,
"repo_name": "okajun35/python_for_android_doc_ja",
"id": "16a468cdce770a187a35dbfeeaba5c7a4489eda... |
import matplotlib.pyplot as plt
import numpy as np
from matplotlib.backends.backend_pdf import PdfPages
def save_subplots_in_pdf(values, row=6, col=6):
"""values could be either array or list of array"""
with PdfPages('multipage.pdf') as pp:
for num, plt_obj in enumerate(values):
res = num... | {
"content_hash": "db5d161a1292ab11f89d3f879b6e9c87",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 63,
"avg_line_length": 30.88,
"alnum_prop": 0.5686528497409327,
"repo_name": "braysia/covertrace",
"id": "649f104df75d72076fbb301ec6d7f94cb79de973",
"size": "772",
"binar... |
def birds():
i01.mouth.speak("I dont like birds")
| {
"content_hash": "b543bf77b9bf1e0335082ef812ee31bb",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 38,
"avg_line_length": 14.25,
"alnum_prop": 0.6140350877192983,
"repo_name": "MyRobotLab/pyrobotlab",
"id": "0fd7c49e07519b11c121895bd816eb67c6d149cc",
"size": "57",
"bina... |
import os
import sys
d = os.path.dirname
sys.path.insert(0, d(d(os.path.abspath(__file__))))
import george
extensions = [
"sphinx.ext.autodoc",
"sphinx.ext.mathjax",
]
templates_path = ["_templates"]
source_suffix = ".rst"
master_doc = "index"
# # FIXME
# mathjax_path = "MathJax/MathJax.js"
# General inform... | {
"content_hash": "afd03ac6a3d042c7f09ce47e1dcdeacd",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 62,
"avg_line_length": 22.963636363636365,
"alnum_prop": 0.6492478226444972,
"repo_name": "karenyyng/george",
"id": "3e7e4035618b9e9283847923943a21388d97a0c8",
"size": "128... |
"""Utilities for parsing SQL to tree using CFG.
The CFG defined in this file covers covers only the subset of SQL in the
Spider-SSP dataset, but gaurantees a single unique parse for every
query in that dataset.
"""
import collections
from language.compgen.nqg.common.cky import cfg_parser
from language.compgen.nqg.co... | {
"content_hash": "d85472bb35ef4ca03e828910861aa381",
"timestamp": "",
"source": "github",
"line_count": 357,
"max_line_length": 80,
"avg_line_length": 28.88235294117647,
"alnum_prop": 0.5932499272621472,
"repo_name": "google-research/language",
"id": "8adca9d9b0cf6fad6553377c35a3434d14af12c2",
"siz... |
import os
import os.path
import ffig.generators
import logging
log = logging.getLogger(__name__)
def go_generator(module_name, binding, api_classes, env, output_dir):
''' Create Go bindings in an appropriate Go package.
This generator produces a directory src/modulename inside the output
direct... | {
"content_hash": "a1a56aaa6189631734083cd09c58825a",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 77,
"avg_line_length": 37,
"alnum_prop": 0.6680265170831209,
"repo_name": "jbcoe/C_API_generation",
"id": "72bb293e407bf3414f4af8ab40bea8a535e8da26",
"size": "2165",
"bin... |
"""Top-level namespace for freesurfer."""
from .base import Info, FSCommand
from .preprocess import (ParseDICOMDir, UnpackSDICOMDir, MRIConvert, Resample,
ReconAll, BBRegister, ApplyVolTransform, Smooth,
DICOMConvert, RobustRegister, FitMSParams,
... | {
"content_hash": "697e6ae26d9397863613462e4a9edb75",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 79,
"avg_line_length": 57.75,
"alnum_prop": 0.6681096681096681,
"repo_name": "christianbrodbeck/nipype",
"id": "df3a67e827b3e2ae6bfe29d87c66f14642f2de2f",
"size": "807",
... |
"""
This module contains logic for testing the server-side database. These tests should evaluate whether the database
can be initialised correctly and can function correctly.
"""
import time
import math
import datetime
import transaction
from sqlalchemy import create_engine
from pyramid import testing
from projectcon... | {
"content_hash": "7860b834e395971b1df5ad509e2ec43a",
"timestamp": "",
"source": "github",
"line_count": 388,
"max_line_length": 119,
"avg_line_length": 44.55154639175258,
"alnum_prop": 0.6367002198310772,
"repo_name": "CO600GOL/Game_of_life",
"id": "79ac91477393d66f06515875b50a2312c016fee6",
"size"... |
import logging
from datetime import datetime
from util import parse_datetime
class Lineup(object):
def __init__(self):
self.lineup_id = None # type: unicode
self.name = None # type: unicode
self.transport = None # type: unicode
self.location = None # type: unicode
s... | {
"content_hash": "3db66c331219b19940978a26a7bac60a",
"timestamp": "",
"source": "github",
"line_count": 69,
"max_line_length": 86,
"avg_line_length": 23.840579710144926,
"alnum_prop": 0.5404255319148936,
"repo_name": "astrilchuk/sd2xmltv",
"id": "00bc5505f362b4cfbaf8ba119122107d01e19553",
"size": "... |
import unittest
from pygame.locals import *
from ..profile import Profile
class TestVector(unittest.TestCase):
def setUp(self):
self.config = {'control': {'jump': ['SPACE', None],
'right': ['d', 'RIGHT'], 'mouse_sensitivity': 0.3,
'forward': ['w', 'UP'], 'menu': ['ESCAPE', None],
... | {
"content_hash": "7af078bde026a3c02c2740c86bc9f81a",
"timestamp": "",
"source": "github",
"line_count": 97,
"max_line_length": 62,
"avg_line_length": 34.36082474226804,
"alnum_prop": 0.5616561656165616,
"repo_name": "axelri/return-of-the-spheres",
"id": "2178bba6a72d42987d7ad7f0b89f171aa4b7beaf",
"... |
import re, sys
import functools as fu
import sublime, sublime_plugin
from copy import copy
# Handling the different imports in Sublime
if sublime.version() < '3000':
# we are on ST2 and Python 2.X
_ST3 = False
import paragraph
import sbp_layout as ll
else:
_ST3 = True
import Default.paragraph ... | {
"content_hash": "af5427f03185f0875f32ed1504007941",
"timestamp": "",
"source": "github",
"line_count": 2355,
"max_line_length": 120,
"avg_line_length": 35.56645435244161,
"alnum_prop": 0.5703506488854929,
"repo_name": "seanvk/sublemacspro",
"id": "c493e7b8111bb574a539d2a74ff29354efbb86ea",
"size":... |
import asyncio
import logging
import unittest
import grpc
from grpc.experimental import aio
from src.proto.grpc.testing import messages_pb2
from src.proto.grpc.testing import test_pb2_grpc
from tests_aio.unit import _common
from tests_aio.unit import _constants
from tests_aio.unit._test_base import AioTestBase
from t... | {
"content_hash": "8204143eb18ef3ec867b3b08b506ed00",
"timestamp": "",
"source": "github",
"line_count": 689,
"max_line_length": 83,
"avg_line_length": 42.16690856313498,
"alnum_prop": 0.5808006057894194,
"repo_name": "donnadionne/grpc",
"id": "7367c454fad5c3ab0e1602d0efdacbae4a211d05",
"size": "296... |
import numpy
required_matrices = ['trace']
def run(world, matrices):
m = matrices['trace']
# We need to use a copy for temporary results
mean = numpy.ndarray(m.shape, dtype=m.dtype)
# Initialize it with the current values, attenuated
numpy.multiply(m, 0.95, mean)
# Then add after having sh... | {
"content_hash": "4442fb21066c36453e523d48bacdf642",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 98,
"avg_line_length": 40.03846153846154,
"alnum_prop": 0.6580211335254563,
"repo_name": "ofavre/cellulart",
"id": "34872915a9d0c2ce8d7034f0f9e47d4d7cd83fc8",
"size": "1095... |
"""Translate generators test."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import shutil
import tarfile
from tensor2tensor.data_generators import text_problems
from tensor2tensor.data_generators import translate
import tensorflow as tf
cl... | {
"content_hash": "d1f6e463e3a4b932e12f18dd1f28cc15",
"timestamp": "",
"source": "github",
"line_count": 72,
"max_line_length": 79,
"avg_line_length": 29.944444444444443,
"alnum_prop": 0.6020408163265306,
"repo_name": "mlperf/training_results_v0.6",
"id": "b34cff1b7f015c56f39fcfa4286fa665f9407dcb",
... |
from pymongo import MongoClient
from progressbar import ProgressBar, Bar, Percentage, FormatLabel, ETA
import numpy as np
np.set_printoptions(threshold=np.nan)
client = MongoClient()
db = client.dotabot
matches = db.matches
# We're going to create a training matrix, X, where each
# row is a different match and each ... | {
"content_hash": "7a796f9cb1c6031467dc62ea738adfb1",
"timestamp": "",
"source": "github",
"line_count": 66,
"max_line_length": 98,
"avg_line_length": 30.166666666666668,
"alnum_prop": 0.6956303365143144,
"repo_name": "suitnecniv/dota2",
"id": "0bd84b39ea7847534d1815b6045102aa2bce039b",
"size": "199... |
"""The Tesla Powerwall integration."""
import asyncio
from datetime import timedelta
import logging
import requests
from tesla_powerwall import APIChangedError, Powerwall, PowerwallUnreachableError
import voluptuous as vol
from homeassistant.config_entries import SOURCE_IMPORT, ConfigEntry
from homeassistant.const im... | {
"content_hash": "831a2b8e32024beeb48aefe90c0de392",
"timestamp": "",
"source": "github",
"line_count": 211,
"max_line_length": 92,
"avg_line_length": 34.96208530805687,
"alnum_prop": 0.6579910532736885,
"repo_name": "mKeRix/home-assistant",
"id": "0f25a14546db7df2ed9049d41d9b3d8a227a0553",
"size":... |
from dstack import type_manager
class ResponseHolder:
def __init__(self):
self._responses = []
self.priority = type_manager.PRIORITY_PRE
def clear(self):
self._responses = []
def publish(self, resp):
self._responses = resp
def list(self):
return self._respons... | {
"content_hash": "ee2cf2fddecce8b0e1a142bd2d142950",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 50,
"avg_line_length": 22.142857142857142,
"alnum_prop": 0.5870967741935483,
"repo_name": "ibuildthecloud/dstack",
"id": "ec1b4b512a41131b1538e6648c58bae48bbfa496",
"size":... |
"""Tests for export."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from google.protobuf import text_format
from tensorflow.core.example import example_pb2
from tensorflow.python.estimator import export
from tensorflow.python.framework import constant_o... | {
"content_hash": "1211ad20ace31e7f55acdb847382ff5f",
"timestamp": "",
"source": "github",
"line_count": 125,
"max_line_length": 79,
"avg_line_length": 42.208,
"alnum_prop": 0.5921152388172858,
"repo_name": "thjashin/tensorflow",
"id": "efefaf7f294006e0b8fd27a3dac779618e7f7ace",
"size": "5965",
"b... |
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import json
import unittest
import bs4
from internal_backend.sitegen.tasks import sitegen
CONFIG_JSON = """
{
"sources": {
"index": "fake0/README.html",
... | {
"content_hash": "832fa5c76211764092f890ad937556a5",
"timestamp": "",
"source": "github",
"line_count": 214,
"max_line_length": 217,
"avg_line_length": 35.967289719626166,
"alnum_prop": 0.48746264778485127,
"repo_name": "baroquebobcat/pants",
"id": "b024221deb0b116b331057561b23e37700abf1a1",
"size"... |
from RGT.XML.SVG.basicSvgNode import BasicSvgNode
from RGT.XML.SVG.Attribs.xlinkAttributes import XlinkAttributes
class MpathNode(BasicSvgNode, XlinkAttributes):
svgNodeType = BasicSvgNode.SVG_MPATH_NODE
ATTRIBUTE_EXTERNAL_RESOURCES_REQUIRED = 'externalResourcesRequired'
def __init__(self, owne... | {
"content_hash": "85f0c8774eb9509a8372ae53d5267118",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 88,
"avg_line_length": 38.121212121212125,
"alnum_prop": 0.6279809220985691,
"repo_name": "danrg/RGT-tool",
"id": "cb2479760273853e7d68320eeb026471965e592b",
"size": "1258"... |
"""Tests for Stochastic Weight Averaging optimizer."""
import numpy as np
import pytest
import tensorflow as tf
from tensorflow_addons.optimizers import stochastic_weight_averaging
from tensorflow_addons.optimizers.utils import fit_bn
SWA = stochastic_weight_averaging.SWA
@pytest.mark.usefixtures("maybe_run_functi... | {
"content_hash": "4fd6a8dc36cd8d80eef2b736cd541365",
"timestamp": "",
"source": "github",
"line_count": 120,
"max_line_length": 86,
"avg_line_length": 31.783333333333335,
"alnum_prop": 0.6620346093340325,
"repo_name": "tensorflow/addons",
"id": "ef2aaaacc1ccef4c146d338b788687f46ecdb8a9",
"size": "4... |
"""The Versioneer - like a rocketeer, but for versions.
The Versioneer
==============
* like a rocketeer, but for versions!
* https://github.com/warner/python-versioneer
* Brian Warner
* License: Public Domain
* Compatible With: python2.6, 2.7, 3.2, 3.3, 3.4, and pypy
* [![Latest Version]
(https://pypip.in/version/ve... | {
"content_hash": "9ea650811468d25f2b096644705b60ef",
"timestamp": "",
"source": "github",
"line_count": 1971,
"max_line_length": 81,
"avg_line_length": 36.76052765093861,
"alnum_prop": 0.6132772065419916,
"repo_name": "lbdreyer/nc-time-axis",
"id": "b1289247bb93b56750d11dcd4d689140973119af",
"size"... |
from __future__ import print_function
import os
from marrow.script import execute, script, describe
__version__ = '1.0'
@script(
title = 'ls clone',
version = __version__,
copyright = "Copyright 2010 Alice Bevan-McGregor\nThis is free software; see the source for copying conditions. There... | {
"content_hash": "220213fa24065cc1755598fd2f271378",
"timestamp": "",
"source": "github",
"line_count": 62,
"max_line_length": 208,
"avg_line_length": 34.903225806451616,
"alnum_prop": 0.6575785582255084,
"repo_name": "marrow/script",
"id": "0c6076858160b86a60f5abc3d3baa80aeb1fb96f",
"size": "2205"... |
try:
from urllib.parse import urljoin
except ImportError:
from urlparse import urljoin
try:
import cPickle as pickle
except ImportError:
import pickle
from pip._vendor.urllib3.response import HTTPResponse
from pip._vendor.urllib3.util import is_fp_closed
# Replicate some six behaviour
try:
text... | {
"content_hash": "8725652bf3cb12a04c57ba56f8e58c70",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 53,
"avg_line_length": 19,
"alnum_prop": 0.7394736842105263,
"repo_name": "Code-In-Action/python-in-action",
"id": "b59f1122a456e3394429e57c70e9e80d2c236607",
"size": "380"... |
import datetime
from django.contrib.admin.templatetags.admin_urls import add_preserved_filters
from django.contrib.admin.utils import (
display_for_field, display_for_value, get_fields_from_path,
label_for_field, lookup_field,
)
from django.contrib.admin.views.main import (
ALL_VAR, ORDER_VAR, PAGE_VAR, SE... | {
"content_hash": "6f8f2a5eef30ac9afd2d6772044de27d",
"timestamp": "",
"source": "github",
"line_count": 438,
"max_line_length": 110,
"avg_line_length": 39.205479452054796,
"alnum_prop": 0.5468786396459352,
"repo_name": "auready/django",
"id": "81b533436d0730c876ea5a9e64be8a4b538a9570",
"size": "171... |
"""Ops for preprocessing data."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import threading
from tensorflow.contrib.tensor_forest.python import constants
from tensorflow.python.framework import dtypes
from tensorflow.python.framework import load_lib... | {
"content_hash": "639685d39d70df0f94a4655c2f6c843d",
"timestamp": "",
"source": "github",
"line_count": 121,
"max_line_length": 76,
"avg_line_length": 33.11570247933884,
"alnum_prop": 0.6833042176191665,
"repo_name": "ppries/tensorflow",
"id": "4f754b598eede668249d5868dca7e5c7dd9b0275",
"size": "46... |
import unittest
from pypowervm.tests.test_utils import pvmhttp
import pypowervm.wrappers.base_partition as bp
import pypowervm.wrappers.managed_system as ms
import pypowervm.wrappers.mtms as mtmwrap
_MS_HTTPRESP_FILE = "managedsystem.txt"
_MC_HTTPRESP_FILE = "managementconsole.txt"
_MS_NAME = 'HV4'
class TestMSEntr... | {
"content_hash": "cb0c73047c9cd1e811fe2a9dac170cfe",
"timestamp": "",
"source": "github",
"line_count": 357,
"max_line_length": 79,
"avg_line_length": 43.8375350140056,
"alnum_prop": 0.5883067092651757,
"repo_name": "powervm/pypowervm",
"id": "b06ca5231a3f00f690dfd0c1c31a4c6628d46f6c",
"size": "162... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.