text stringlengths 4 1.02M | meta dict |
|---|---|
from djblets.db.query import LocalDataQuerySet
from djblets.util.decorators import augment_method_from
from djblets.webapi.decorators import webapi_request_fields
from djblets.webapi.fields import IntFieldType, StringFieldType
from djblets.webapi.responses import WebAPIResponsePaginated
from reviewboard.hostingsvcs.re... | {
"content_hash": "554d000a0eefe02e69e2ea0fa52289f9",
"timestamp": "",
"source": "github",
"line_count": 225,
"max_line_length": 79,
"avg_line_length": 39.48444444444444,
"alnum_prop": 0.6020936515083296,
"repo_name": "reviewboard/reviewboard",
"id": "8b992b439985c7a80502d968db13d67f639f93c2",
"size... |
def remove_adjacent(nums):
adjacent=[]
for num in nums:
if len(adjacent)==0 or num not in adjacent:
adjacent.append(num)
return adjacent
# E. Given two lists sorted in increasing order, create and return a merged
# list of all the elements in sorted order. You may modify the passed in lists.
# Ideally, ... | {
"content_hash": "5d4469318eec56b9e442c67e8ac35fee",
"timestamp": "",
"source": "github",
"line_count": 54,
"max_line_length": 79,
"avg_line_length": 32.425925925925924,
"alnum_prop": 0.6407766990291263,
"repo_name": "rudy750/Google_Class",
"id": "0627c545af968dfabf13cf05c34dfd74ba354a49",
"size": ... |
""" Functions for visualizing lists of iGraph objects as SVG images
Filenames for SVGs:
When saving a single graphs (one graph per SVG):
[fout]_c[count].svg
Where fout is a function parameter (str) and count is retrieved from the list
when saving a grid (square) of graphs:
combined_[fout].svg
Where fout is... | {
"content_hash": "29089455d7d77fdad70bb67c79c6c6a7",
"timestamp": "",
"source": "github",
"line_count": 128,
"max_line_length": 81,
"avg_line_length": 34.921875,
"alnum_prop": 0.6006711409395973,
"repo_name": "cpacker/GraphZip",
"id": "803e95ac7d0fef0cf5e7c98949505f6161f58618",
"size": "4470",
"b... |
from django.db import models
from bitfield_manager.models import ParentBitfieldModelMixin, ChildBitfieldModelMixin
from bitfield import BitField
class BaseTestModel(models.Model):
"""
Base for test models that sets app_label, so they play nicely.
"""
class Meta:
app_label = 'tests'
abs... | {
"content_hash": "38864fb5cad4e30924f405558cda4d5a",
"timestamp": "",
"source": "github",
"line_count": 85,
"max_line_length": 110,
"avg_line_length": 37.694117647058825,
"alnum_prop": 0.7000624219725343,
"repo_name": "goodmase/django-bitfield-manager",
"id": "656fc678ec141a88a8aee8ce69c7e324008645f4... |
import sys
import rsync4python.rsync
def rdiff_signature(basefilename, signature_filename):
with open(basefilename, 'rb') as base:
with open(signature_filename, 'wb') as signature:
rsync4python.rsync.rsync.signature(base, signature)
def rdiff_patch(basefilename, deltafilename, finalfilenam... | {
"content_hash": "970d4af1108df5c03452e4141ee01f0c",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 66,
"avg_line_length": 29.833333333333332,
"alnum_prop": 0.6852886405959032,
"repo_name": "BenjamenMeyer/rsync4python",
"id": "45cee2a261b75506c212850de1111c03120d706b",
"s... |
from __future__ import print_function
import time
import sys
print("Running slow program")
sys.stdout.flush() # Make sure the print gets flushed so it appears in lit output.
time.sleep(6)
| {
"content_hash": "06d812ab30fd9276dc7369b863882e24",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 82,
"avg_line_length": 23.75,
"alnum_prop": 0.7578947368421053,
"repo_name": "silverneko/HWs",
"id": "2dccd6331360b46d4e29350be871e83b6eb9bd91",
"size": "210",
"binary": f... |
import sys, os
delete = os.path.join('src','tools')
root_path = os.getcwd().replace(delete,'')
sys.path.append(root_path)
| {
"content_hash": "46a1de2fcfd1f949718b8cfb1e769a4f",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 42,
"avg_line_length": 24.6,
"alnum_prop": 0.6910569105691057,
"repo_name": "golsun/GPS",
"id": "0a656adfd219c15c28e96647c4cf6b191321ead4",
"size": "123",
"binary": false,... |
'''
Installer for tratihubis.
Developer cheat sheet
---------------------
Create the installer archive::
$ python setup.py sdist --formats=zip
Upload release to PyPI::
$ pep8 -r --ignore=E501 *.py test/*.py
$ python test/test_tratihubis.py
$ python setup.py sdist --formats=zip upload
Tag a release::
$ ... | {
"content_hash": "858e8fefe670d25a97822c2c2b97d568",
"timestamp": "",
"source": "github",
"line_count": 80,
"max_line_length": 79,
"avg_line_length": 37.8125,
"alnum_prop": 0.7094214876033058,
"repo_name": "i-rabot/tractogithub",
"id": "a5c721dd4cdd117f11fa9759aab3ac286df6c4ad",
"size": "3025",
"... |
import numpy
class LearningRate(object):
def __init__(self):
'''constructor'''
def get_rate(self):
pass
def get_next_rate(self, current_error):
pass
class LearningRateConstant(LearningRate):
def __init__(self, learning_rate = 0.08, epoch_num = 20):
self... | {
"content_hash": "67ed91dafea8bcbe057519241fa5cbac",
"timestamp": "",
"source": "github",
"line_count": 152,
"max_line_length": 106,
"avg_line_length": 28.75657894736842,
"alnum_prop": 0.5470144131777626,
"repo_name": "ronanki/merlin",
"id": "287ce2972f91ed6942675d7eedc8b53f4d36e1aa",
"size": "6749... |
"""
nozama-cloudsearch
"""
import pkg_resources
from pyramid.view import view_config
@view_config(route_name='home', request_method='GET', renderer='json')
@view_config(route_name='ping', request_method='GET', renderer='json')
def status(request):
"""This is used to 'ping' the web service to check if its runnin... | {
"content_hash": "11bf8d367e7d615364931ff5eab19e47",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 74,
"avg_line_length": 23.75,
"alnum_prop": 0.6289473684210526,
"repo_name": "oisinmulvihill/nozama-cloudsearch",
"id": "1870266a02e759049b70e9f8aceae62f29f37c37",
"size": ... |
from __future__ import absolute_import, division, print_function
import functools
import inspect
import os
import shutil
import sys
import tempfile
import re
from errno import ENOENT
from contextlib import contextmanager
from importlib import import_module
from numbers import Integral
from threading import Lock
import... | {
"content_hash": "4adefe5db0c493d45757a4fcf62e0938",
"timestamp": "",
"source": "github",
"line_count": 1102,
"max_line_length": 101,
"avg_line_length": 26.058983666061707,
"alnum_prop": 0.5593550858376571,
"repo_name": "jcrist/dask",
"id": "87bec9d95ab89dd0548df5026b7621ebafd92bf1",
"size": "28717... |
import tempfile
import pytest
# this is require near the top to do setup of the test suite
# from counterpartylib.test import conftest
from counterpartylib.test.util_test import CURR_DIR as CPLIB_TESTDIR
from picopayments_hub import lib
from picopayments_hub import api
from pycoin.key.validate import is_address_valid... | {
"content_hash": "72de62c777fc7e69dd59779f5bc5546a",
"timestamp": "",
"source": "github",
"line_count": 103,
"max_line_length": 78,
"avg_line_length": 33.679611650485434,
"alnum_prop": 0.6344767944652637,
"repo_name": "StorjRND/picopayments",
"id": "38adce4debace3794abd5e6e51047dae5665e693",
"size"... |
import os
import unittest
import json
import tempfile
from nose.tools import assert_equals, assert_true
from numpy import arange, array, array_equal, mod
from numpy import dtype as dtypeFunc
from test_utils import PySparkTestCaseWithOutputDir
from thunder import ThunderContext
_have_image = False
try:
from PIL im... | {
"content_hash": "8e0f02ea8ad73becdff04066847baff7",
"timestamp": "",
"source": "github",
"line_count": 407,
"max_line_length": 118,
"avg_line_length": 44.223587223587224,
"alnum_prop": 0.6368131562864604,
"repo_name": "zhwa/thunder",
"id": "bc2043ca7c7ba53d55380f17f257c1cca4098d9b",
"size": "17999... |
import os
import unittest
import pytest
from pyspark.sql.functions import split
from sparknlp.annotator import *
from sparknlp.base import *
from test.util import SparkSessionForTest
@pytest.mark.slow
class MultiClassifierDLTestSpec(unittest.TestCase):
def setUp(self):
self.data = SparkSessionForTest.sp... | {
"content_hash": "53fa37635ba5ca1a9cd41bae89ed6a19",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 98,
"avg_line_length": 32.37735849056604,
"alnum_prop": 0.6083916083916084,
"repo_name": "JohnSnowLabs/spark-nlp",
"id": "c09712cfbf121fd8dcb0056029d6506522c8377f",
"size":... |
from six import iteritems
class Annotations(object):
"""Handles and stores (key,value) annotations for formulae"""
def __init__(self, initial_annotations=None):
if initial_annotations is not None:
self._annotations = initial_annotations
else:
self._annotations = {}
... | {
"content_hash": "ad4c0afb1ebd7cc3acbf1970a68435f1",
"timestamp": "",
"source": "github",
"line_count": 101,
"max_line_length": 76,
"avg_line_length": 34.53465346534654,
"alnum_prop": 0.5739678899082569,
"repo_name": "chubbymaggie/pysmt",
"id": "aa9b8f675e9c28db21d5e9eb891747f848cb798d",
"size": "4... |
from pytest import mark, param
from .conftest import read_json_sample
@mark.parametrize(
"query_string,expected_show_inactive",
[param("", False), param("show_inactive=yes", True)],
)
def test_ratings_ad(service, query_string: str, expected_show_inactive: bool):
uri = "/ratings/ad/"
uri += "?" + quer... | {
"content_hash": "3d3df408259cf5be26b0fcaa84a48968",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 78,
"avg_line_length": 30.1,
"alnum_prop": 0.6722037652270211,
"repo_name": "em92/pickup-rating",
"id": "ef7322f6f1ab786e7f6fe3cd21c7cb106db09d6a",
"size": "903",
"binary... |
"""Checks for optional dependencies using lazy import from
`PEP 562 <https://www.python.org/dev/peps/pep-0562/>`_.
"""
import importlib
from collections.abc import Sequence
# First, the top-level packages:
# TODO: This list is a duplicate of the dependencies in setup.cfg "all", but
# some of the package names are diff... | {
"content_hash": "5e0aff4bd59b006cb8c008e0234d0640",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 76,
"avg_line_length": 33.611111111111114,
"alnum_prop": 0.6396694214876033,
"repo_name": "adrn/gala",
"id": "2be4015767e311b4fe4b535619a97ac79d1625cc",
"size": "1210",
"... |
"""Generates various info tables from SPIR-V JSON grammar."""
import errno
import json
import os.path
import re
# Prefix for all C variables generated by this script.
PYGEN_VARIABLE_PREFIX = 'pygen_variable'
# Extensions to recognize, but which don't necessarily come from the SPIR-V
# core or KHR grammar files. Get... | {
"content_hash": "b36b64485580282622aa9868237e6627",
"timestamp": "",
"source": "github",
"line_count": 889,
"max_line_length": 101,
"avg_line_length": 39.72778402699662,
"alnum_prop": 0.6090945127130641,
"repo_name": "KhronosGroup/SPIRV-Tools",
"id": "6b7167b86ab2d922af523f78f78f7e0937f7be82",
"si... |
from __future__ import unicode_literals
from collections import namedtuple
import enum
import re
import sqlalchemy as sa
import slugify
from hyputils.memex.db import Base
from hyputils.memex.db import mixins
from hyputils.memex import pubid
from hyputils.memex.util.group import split_groupid
from hyputils.memex.secur... | {
"content_hash": "49609a0f190267e74d31c0287dd1024c",
"timestamp": "",
"source": "github",
"line_count": 305,
"max_line_length": 86,
"avg_line_length": 33.40327868852459,
"alnum_prop": 0.6399685904986259,
"repo_name": "tgbugs/hypush",
"id": "97092db4ed9e1173fee9b02737a3d3be04e0329b",
"size": "10217"... |
"""Image manipulation API.
Classes defined in this module:
Image: class used to encapsulate image information and transformations for
that image.
The current manipulations that are available are resize, rotate,
horizontal_flip, vertical_flip, crop and im_feeling_lucky.
It should be noted that each ... | {
"content_hash": "38d6b32b29c37b58cb404bf2fe9b6b9e",
"timestamp": "",
"source": "github",
"line_count": 1971,
"max_line_length": 80,
"avg_line_length": 37.26078132927448,
"alnum_prop": 0.6782587383069403,
"repo_name": "Suwmlee/XX-Net",
"id": "a3f1a93a0453048efda31f60524143a7c94cc465",
"size": "7404... |
import simplejson
import sys
import urllib
import urllib2
class StreamingChannelsCore():
def __init__(self, instanceId = 10, platformId = 4, version = 10):
self.settings = sys.modules["__main__"].settings
self.plugin = sys.modules["__main__"].plugin
self.enabledebug = sys.modules["__main__"].enabledebug
sel... | {
"content_hash": "60bcf480cbde77825b9dbfc64687efc3",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 67,
"avg_line_length": 28.11111111111111,
"alnum_prop": 0.7048748353096179,
"repo_name": "lperilla/kodi.plugin.streaming-channels",
"id": "6dbc86d9bfdc3a3d0da26860e5d4a4b3e2a... |
from .aws import Action as BaseAction
from .aws import BaseARN
service_name = "Amazon HealthLake"
prefix = "healthlake"
class Action(BaseAction):
def __init__(self, action: str = None) -> None:
super().__init__(prefix, action)
class ARN(BaseARN):
def __init__(self, resource: str = "", region: str =... | {
"content_hash": "3a870c3a247c066bb2e016ed1854fb7c",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 88,
"avg_line_length": 36.12820512820513,
"alnum_prop": 0.7579843860894251,
"repo_name": "cloudtools/awacs",
"id": "84b9cfa2664eddd3862d8d8bd333fed2764a96e1",
"size": "1525... |
from django.contrib import admin
# Register your models here.
from .models import signup
from .models import ipl_scores
admin.site.register(signup)
admin.site.register(ipl_scores)
| {
"content_hash": "921b5e252f836ca621464573418c7464",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 32,
"avg_line_length": 22.75,
"alnum_prop": 0.8021978021978022,
"repo_name": "Rahul91/Django_IPL",
"id": "78eab6c37cfa53957ad5f6d540419cfd0d0c165a",
"size": "182",
"binary... |
import asyncio
from cogbot.cogs.robo_mod.robo_mod_condition import RoboModCondition
from cogbot.cogs.robo_mod.robo_mod_trigger import RoboModTrigger
class MessageHasEmbedCondition(RoboModCondition):
def __init__(self):
self.min_count: int = None
self.delay: int = None
async def update(self, ... | {
"content_hash": "0b8f2da58f62b6a2b8d78c3499e2a662",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 68,
"avg_line_length": 35.9,
"alnum_prop": 0.6768802228412256,
"repo_name": "Arcensoth/cogbot",
"id": "eddc773cab0fc23f007e7e16fef603ebdb40a7c8",
"size": "718",
"binary":... |
from toast.math.vector import Vector2D
from toast.math.matrix import MatrixHelper
from toast.scene_graph import Component
class Transform(Component):
def __init__(self):
super(Transform, self).__init__()
self.__local_matrix = None
self.global_matrix = None
self.__p... | {
"content_hash": "3fd1a5fad2d4cbb8022a595178f823e4",
"timestamp": "",
"source": "github",
"line_count": 94,
"max_line_length": 97,
"avg_line_length": 28.69148936170213,
"alnum_prop": 0.5439377085650723,
"repo_name": "JSkelly/Toast",
"id": "fec37355db51cc2f9278cff2b194fcde35aeb840",
"size": "2697",
... |
"""freeze module
The freeze and unfreeze functions special-case some of the built-in
types. If these types grow the appropriate methods then that will
become unnecessary.
"""
__all__ = ("Freezable", "UnFreezable", "freeze", "unfreeze")
import builtins
from abc import ABCMeta, abstractmethod
class Freezable(meta... | {
"content_hash": "de6141180e1caba7a98386443bd2955f",
"timestamp": "",
"source": "github",
"line_count": 108,
"max_line_length": 67,
"avg_line_length": 20.833333333333332,
"alnum_prop": 0.6182222222222222,
"repo_name": "ActiveState/code",
"id": "3b1c99445d6e49d4311af88a6faa88fb8006526b",
"size": "22... |
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('event_exim', '0001_initial'),
('auth', '0007_alter_validators_add_error_messages'),
]
operation... | {
"content_hash": "ceb1753a150e18746efce988d8c27163",
"timestamp": "",
"source": "github",
"line_count": 114,
"max_line_length": 274,
"avg_line_length": 62.93859649122807,
"alnum_prop": 0.5763066202090592,
"repo_name": "MoveOnOrg/eventroller",
"id": "d1658ca50388b3b99408a2e1cb2670f88d128fc7",
"size"... |
"""
wiggle - Plot z=f(x,y) anomalies along tracks.
"""
from pygmt.clib import Session
from pygmt.helpers import build_arg_string, fmt_docstring, kwargs_to_strings, use_alias
@fmt_docstring
@use_alias(
B="frame",
D="position",
G="color",
J="projection",
R="region",
T="track",
U="timestamp",... | {
"content_hash": "fdb98504891eb14219746c413e26978f",
"timestamp": "",
"source": "github",
"line_count": 96,
"max_line_length": 87,
"avg_line_length": 34.489583333333336,
"alnum_prop": 0.5871337964361221,
"repo_name": "GenericMappingTools/gmt-python",
"id": "ddabb48c35ef770e243a55567aae1d203e606d21",
... |
import os
import re
def get_version():
"""
Extracts the version number from the version.py file.
"""
VERSION_FILE = '../{{ project_name }}/version.py'
mo = re.search(r'^__version__ = [\'"]([^\'"]*)[\'"]', open(VERSION_FILE, 'rt').read(), re.M)
if mo:
return mo.group(1)
else:
... | {
"content_hash": "8f43cb3993aa053938fed8534a45a7b4",
"timestamp": "",
"source": "github",
"line_count": 130,
"max_line_length": 96,
"avg_line_length": 31.29230769230769,
"alnum_prop": 0.6403638151425762,
"repo_name": "micahhausler/python-template",
"id": "119b96198ecd6b6e7becbf024ae8ae8abfa41198",
... |
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('game', '0011_deployedtaskimage'),
]
operations = [
migrations.RemoveField(
model_name='deployedtaskimage',
name='task',
... | {
"content_hash": "6bfddd286d1a86e4617a8c26d766b659",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 43,
"avg_line_length": 22.333333333333332,
"alnum_prop": 0.5708955223880597,
"repo_name": "stefantsov/blackbox3",
"id": "486951b9f4dc257e59f849d0f58b2b99ab522e0d",
"size": ... |
import abc
import mock
import six
from ceilometer.ipmi import manager
import ceilometer.tests.base as base
from oslotest import mockpatch
@six.add_metaclass(abc.ABCMeta)
class TestPollsterBase(base.BaseTestCase):
@abc.abstractmethod
def fake_data(self):
"""Fake data used for test."""
@abc.abst... | {
"content_hash": "d418ce625f0e0d23ff28a9dcd27750b9",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 77,
"avg_line_length": 31.214285714285715,
"alnum_prop": 0.63558352402746,
"repo_name": "luogangyi/Ceilometer-oVirt",
"id": "90d11c7532871ab6e5aa7cc536921b1ba63e557d",
"siz... |
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('blog', '0003_auto_20150616_2002'),
]
operations = [
migrations.AddField(
model_name='post',
name='slug',
field=m... | {
"content_hash": "99fda0ba6b8ae514e37bce780508c0bd",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 72,
"avg_line_length": 22.473684210526315,
"alnum_prop": 0.5831381733021077,
"repo_name": "patrickporto/soldajustica",
"id": "b17cfbe9cc828a0479a763408f94afd6bb439939",
"si... |
from .search_results_answer import SearchResultsAnswer
class Videos(SearchResultsAnswer):
"""Defines a video answer.
Variables are only populated by the server, and will be ignored when
sending a request.
:param _type: Constant filled by server.
:type _type: str
:ivar id: A String identifier... | {
"content_hash": "a1c7789fe65bcf6c740d9fee2806eb01",
"timestamp": "",
"source": "github",
"line_count": 75,
"max_line_length": 84,
"avg_line_length": 40.013333333333335,
"alnum_prop": 0.6221259580139953,
"repo_name": "AutorestCI/azure-sdk-for-python",
"id": "e3d3731268d58be241c8dc3c5be51f752d765ad8",... |
from __future__ import unicode_literals
import sprinter.lib as lib
from mock import Mock, patch
from sprinter.testtools import FormulaTest
from sprinter.formula.base import FormulaBase
source_config = """
[prompt_value_source]
formula = sprinter.formula.base
source_value = old
[resolve]
formula = sprinter.formula.bas... | {
"content_hash": "afd3e8f9a95a101b031fe194caa888ed",
"timestamp": "",
"source": "github",
"line_count": 141,
"max_line_length": 85,
"avg_line_length": 32.38297872340426,
"alnum_prop": 0.6263688129653964,
"repo_name": "toumorokoshi/sprinter",
"id": "e03c70ef4795967120db0a7b2e286df991e1fdb4",
"size":... |
import os
class MongoConfig(object):
MONGODB_DB = 'dev'
MONGODB_HOST = os.environ.get('MONGO_PORT_27017_TCP_ADDR')
MONGODB_PORT = os.environ.get('MONGO_PORT_27017_TCP_PORT')
| {
"content_hash": "528c29564f20347b7f0778151a8f7b94",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 62,
"avg_line_length": 26.857142857142858,
"alnum_prop": 0.6914893617021277,
"repo_name": "piotrdubiel/scribeserver",
"id": "17e7245872153fc465da020d964eecbaf9325a66",
"size... |
LAT_TT = (
"Latitude of the location where the sample was collected. Needs to be entered in decimal degrees. "
"Negative values for South latitudes. (Coordinate system: WGS84)"
)
LONG_TT = (
"Longitude of the location where the sample was collected. Needs to be entered in decimal degrees. "
"Negative va... | {
"content_hash": "88285e0f4c71bc8ab279a0160b0ad4d6",
"timestamp": "",
"source": "github",
"line_count": 132,
"max_line_length": 117,
"avg_line_length": 23.575757575757574,
"alnum_prop": 0.5308483290488432,
"repo_name": "NMGRL/pychron",
"id": "ca695751f764aabc6a76b90cc245fc6bcdc61e24",
"size": "3973... |
from msrest.serialization import Model
class ImageOSDisk(Model):
"""Describes an Operating System disk.
:param os_type: This property allows you to specify the type of the OS
that is included in the disk if creating a VM from a custom image.
<br><br> Possible values are: <br><br> **Windows** <br><b... | {
"content_hash": "0fa6cb85eed725f3d47a75ca3c535a3b",
"timestamp": "",
"source": "github",
"line_count": 64,
"max_line_length": 151,
"avg_line_length": 48.3125,
"alnum_prop": 0.6545924967658473,
"repo_name": "AutorestCI/azure-sdk-for-python",
"id": "9e656959bbcd2eb26ae3cda727c689454de35104",
"size":... |
"""Create Message Table
Revision ID: 3978aa063aba
Revises:
Create Date: 2017-09-01 14:01:18.246416
"""
# revision identifiers, used by Alembic.
revision = '3978aa063aba'
down_revision = None
branch_labels = None
depends_on = None
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto... | {
"content_hash": "1cd92aaf6a08798fbfb8aaa2f5e047be",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 63,
"avg_line_length": 24.558823529411764,
"alnum_prop": 0.6730538922155689,
"repo_name": "vigov5/framgiatw_flask_demo",
"id": "f0fcb79129cb3277ba4d3b73947c18f5a45b0b73",
"... |
from c7n_azure.provider import resources
from c7n_azure.resources.arm import ArmResourceManager
@resources.register('cdnprofile')
class CdnProfile(ArmResourceManager):
"""CDN Resource
:example:
Returns all CDNs with Standard_Verizon sku
.. code-block:: yaml
policies:
- name: stan... | {
"content_hash": "64c00780f2b110dba352ead1b2c27f87",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 58,
"avg_line_length": 24.564102564102566,
"alnum_prop": 0.5594989561586639,
"repo_name": "kapilt/cloud-custodian",
"id": "9dee6bbe1e54401ff9331ae7916eb8ea56e31c25",
"size"... |
from django import template
register = template.Library()
class VerbatimNode(template.Node):
def __init__(self, text):
self.text = text
def render(self, context):
return self.text
@register.tag
def verbatim(parser, token):
text = []
while 1:
token = parser.tokens.pop(0)
... | {
"content_hash": "3fb33b694ea1519138b6b71517965ab1",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 54,
"avg_line_length": 26.393939393939394,
"alnum_prop": 0.5545350172215844,
"repo_name": "socradev/django-fancypages",
"id": "f8f379f4ce17dfabde211b94c811757a4c553fc7",
"s... |
import pyvex
import claripy
import cle
from archinfo import ArchARM
from cachetools import LRUCache
import logging
from ..engine import SimEngineBase
from ...state_plugins.inspect import BP_AFTER, BP_BEFORE
from ...misc.ux import once
from ...errors import SimEngineError, SimTranslationError, SimError
from ... import ... | {
"content_hash": "f42b6f4189178f4519c547b4eb3d6089",
"timestamp": "",
"source": "github",
"line_count": 372,
"max_line_length": 120,
"avg_line_length": 40.44086021505376,
"alnum_prop": 0.5291810688646637,
"repo_name": "schieb/angr",
"id": "a3ef409c97fee5d0ceabaeaad429a5122129eb8a",
"size": "15044",... |
"""Unit tests for the stub provider.
"""
import unittest
from dsub.providers import stub
def raw_ops(tasklist):
"""Convert returned operations to raw operations."""
return [t.raw_task_data() for t in tasklist]
class TestGetJob(unittest.TestCase):
def test_get_success(self):
prov = stub.StubJobProvider()... | {
"content_hash": "0c5d3d4e8ee782594dcdcf62a65fe610",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 67,
"avg_line_length": 36.189655172413794,
"alnum_prop": 0.6107670319199618,
"repo_name": "mbookman/task-submission-tools",
"id": "ea68135899c5af59a751c3426550ca7f7cbd648d",
... |
from os.path import isfile, join
from platformio.commands.ci import cli as cmd_ci
from platformio.commands.lib.command import cli as cmd_lib
def test_ci_empty(clirunner):
result = clirunner.invoke(cmd_ci)
assert result.exit_code != 0
assert "Invalid value: Missing argument 'src'" in result.output
def t... | {
"content_hash": "b75afe0b88d5e34d35ef1c9f5efb0864",
"timestamp": "",
"source": "github",
"line_count": 179,
"max_line_length": 74,
"avg_line_length": 25.134078212290504,
"alnum_prop": 0.5183374083129584,
"repo_name": "platformio/platformio",
"id": "01ac9c3764cba82f37cbe0838d03ac613511613e",
"size"... |
"""Utilities for VariableMgr."""
from __future__ import print_function
import collections as pycoll
import operator
import tensorflow as tf
from tensorflow.python.framework import ops
from tensorflow.python.ops import gradients_impl
PS_SHADOW_VAR_PREFIX = 'ps_var'
AutoLossScaleParams = pycoll.namedtuple(
'Au... | {
"content_hash": "11fbdf854259beaa6ee444aa03082e90",
"timestamp": "",
"source": "github",
"line_count": 520,
"max_line_length": 107,
"avg_line_length": 38.86538461538461,
"alnum_prop": 0.6877288471053934,
"repo_name": "mlperf/training_results_v0.5",
"id": "62ebc5d8ce9a8874157444728480695ef132feb6",
... |
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('structure', '0008_auto_20181212_1536'),
]
operations = [
migrations.AddField(
model_name='structure',
name='stats_text',
... | {
"content_hash": "0398e6377249b08c2c7fdb4b25b5effc",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 118,
"avg_line_length": 26.176470588235293,
"alnum_prop": 0.6314606741573033,
"repo_name": "cmunk/protwis",
"id": "4f906aeadcaff4f3d423e0b78315568ba0567d10",
"size": "494",... |
import sparkpost
from .exceptions import SparkPostAPIException
class RequestsTransport(object):
def __init__(self):
import requests
self.sess = requests.Session()
def request(self, method, uri, headers, **kwargs):
response = self.sess.request(method, uri, headers=headers, **kwargs)
... | {
"content_hash": "87ef7f6f22eb73ed5cc55f2a2ab10c19",
"timestamp": "",
"source": "github",
"line_count": 57,
"max_line_length": 77,
"avg_line_length": 27.280701754385966,
"alnum_prop": 0.5954983922829582,
"repo_name": "thonkify/thonkify",
"id": "4c3c4672ab01608df1499e7ed1eef71d12a76915",
"size": "15... |
from __future__ import (absolute_import, division, print_function)
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
DOCUMENTATION = """
---
module: slxos_command
version_added: "2.6"
author: "Lindsay Hill (@LindsayHill)"
short_d... | {
"content_hash": "477166ca2e0343b177107fbaa8fcd554",
"timestamp": "",
"source": "github",
"line_count": 220,
"max_line_length": 109,
"avg_line_length": 32.56363636363636,
"alnum_prop": 0.6365159128978225,
"repo_name": "thaim/ansible",
"id": "ea6cb5c968e981e5a631b862f415b247ef8c3c1c",
"size": "7322"... |
from __future__ import division
import tensorflow as tf
class CaptionGenerator(object):
def __init__(self, word_to_idx, dim_feature=[196, 512], dim_embed=512, dim_hidden=1024, n_time_step=16,
prev2out=True, ctx2out=True, alpha_c=0.0, selector=True, dropout=True):
"""
Args:
... | {
"content_hash": "55db9a2fb04df8b454840ca71d0009f9",
"timestamp": "",
"source": "github",
"line_count": 206,
"max_line_length": 122,
"avg_line_length": 47.189320388349515,
"alnum_prop": 0.559510338442547,
"repo_name": "infilect/ml-course1",
"id": "99e299036771f60146e5593f28f1030a0c4ed638",
"size": ... |
import re
import fnmatch
import supybot.conf as conf
import supybot.utils as utils
import supybot.ircdb as ircdb
from supybot.commands import *
import supybot.ircutils as ircutils
import supybot.callbacks as callbacks
class User(callbacks.Plugin):
def _checkNotChannel(self, irc, msg, password=' '):
if pas... | {
"content_hash": "3b8b1f62d701c27af9a4449c2aed6e88",
"timestamp": "",
"source": "github",
"line_count": 430,
"max_line_length": 79,
"avg_line_length": 41.4953488372093,
"alnum_prop": 0.5346634534551364,
"repo_name": "jrabbit/ubotu-fr",
"id": "ad04768aa5cf0e325b63d027f41db99e57ecdb2d",
"size": "1943... |
"""
WSGI config for bigpandamon project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/howto/deployment/wsgi/
further doc: http://thecodeship.com/deployment/deploy-django-apache-virtualenv-and-mod_wsgi/
"""... | {
"content_hash": "beb342752b8ec8d93e2f487d1b56e7d6",
"timestamp": "",
"source": "github",
"line_count": 75,
"max_line_length": 92,
"avg_line_length": 31.12,
"alnum_prop": 0.7536418166238218,
"repo_name": "Foorth/panda-bigmon-core",
"id": "840bcf748d713f02a736ceedd9542ce1759cc62e",
"size": "2334",
... |
from collections import namedtuple
import itertools
import logging
from multiprocessing.dummy import Pool as ThreadPool
from elasticsearch import helpers
from django.core.management.base import BaseCommand, CommandError
from django.db import connection, transaction
from imageledger import models, search
console = l... | {
"content_hash": "25f4e3be76397ad59bee0dc2835371b1",
"timestamp": "",
"source": "github",
"line_count": 70,
"max_line_length": 127,
"avg_line_length": 41.885714285714286,
"alnum_prop": 0.5931105047748977,
"repo_name": "creativecommons/open-ledger",
"id": "d4c46b9c5cd5226011aa93973dc8b475664cde0f",
... |
import cStringIO
import base64
# try to import the PIL Image
try:
from PIL import Image
except ImportError:
import Image
# Flask imports:
from flask import Flask, request, request_finished, json, abort, make_response, Response, jsonify
# facerec imports
# facerec imports:
import sys
sys.path.append("../../..")... | {
"content_hash": "a2b6e2dfe28a6f018d7e60ab79db3189",
"timestamp": "",
"source": "github",
"line_count": 227,
"max_line_length": 123,
"avg_line_length": 35.70044052863436,
"alnum_prop": 0.6859575518262586,
"repo_name": "idf/FaceReader",
"id": "fee9528068754f9ce1675bdf374f2fe602f8e479",
"size": "9743... |
import base64
import pytest
from werkzeug.test import Client
from util import dev_login
def test_get_roles(client: Client) -> None:
with dev_login(client, 'admin'):
resp = client.get('/api/v1/role')
assert resp.status_code == 200
assert 'roles' in resp.json
assert isinstance(resp... | {
"content_hash": "bb8d5bff6ad092bc4ca8c72280355598",
"timestamp": "",
"source": "github",
"line_count": 128,
"max_line_length": 99,
"avg_line_length": 35.71875,
"alnum_prop": 0.6122047244094488,
"repo_name": "oss/shrunk",
"id": "95c58646d6e20401330f193ecfd35fc94541b02a",
"size": "4572",
"binary":... |
import logging
import os
import subprocess
import threading
import time
import uuid
from devil.utils import reraiser_thread
from pylib import constants
_MINIUMUM_TIMEOUT = 3.0
_PER_LINE_TIMEOUT = .002 # Should be able to process 500 lines per second.
_PROCESS_START_TIMEOUT = 10.0
_MAX_RESTARTS = 10 # Should be ple... | {
"content_hash": "81db4ec2b7d4dfaba1548e4ec20c9e8c",
"timestamp": "",
"source": "github",
"line_count": 174,
"max_line_length": 80,
"avg_line_length": 33.94252873563219,
"alnum_prop": 0.6244497121571283,
"repo_name": "scheib/chromium",
"id": "6fe86f408d5d89d04009c1523048f717a70d5545",
"size": "6069... |
"""Adapter classes and utilities for use with Reactive interfaces"""
from __future__ import absolute_import
import itertools
import re
import weakref
import six
import charms.reactive as reactive
import charms.reactive.bus
import charmhelpers.contrib.hahelpers.cluster as ch_cluster
import charmhelpers.contrib.networ... | {
"content_hash": "459eb8b2ae5464a7a8b613e5ee4be9f6",
"timestamp": "",
"source": "github",
"line_count": 1029,
"max_line_length": 79,
"avg_line_length": 37.207968901846456,
"alnum_prop": 0.57740225141693,
"repo_name": "ajkavanagh/charms.openstack",
"id": "12e1629f2af78577b03c2ea13de257fba42440b0",
"... |
import sys
try:
sys.getsizeof
except AttributeError:
print('SKIP')
raise SystemExit
print(sys.getsizeof(1) >= 2)
print(sys.getsizeof("") >= 2)
print(sys.getsizeof((1, 2)) >= 2)
print(sys.getsizeof([1, 2]) >= 2)
print(sys.getsizeof({1: 2}) >= 2)
class A:
pass
print(sys.getsizeof(A()) > 0)
try:
as... | {
"content_hash": "5cf5456d3c453efa5fba3578e64f0b61",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 42,
"avg_line_length": 18.03448275862069,
"alnum_prop": 0.6443594646271511,
"repo_name": "pfalcon/micropython",
"id": "32d891418365ae240d7f5299538cc3dbba05b5ec",
"size": "5... |
import sys, os, re, subprocess, codecs, optparse
CMD_PYTHON = sys.executable
QOOXDOO_PATH = '../../../thirdparty/qooxdoo/qooxdoo-2.1.1-sdk'
QX_PYLIB = "tool/pylib"
##
# A derived OptionParser class that ignores unknown options (The parent
# class raises in those cases, and stops further processing).
# We need this, a... | {
"content_hash": "60c3b0803185fde3bda95ad7b6c568d8",
"timestamp": "",
"source": "github",
"line_count": 124,
"max_line_length": 94,
"avg_line_length": 35.04838709677419,
"alnum_prop": 0.5883571099861942,
"repo_name": "ms123s/simpl4-src",
"id": "683adedd35dcfb0ac1d4b149fb05deeec663967c",
"size": "50... |
"""
Helpers for Zigbee Home Automation.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/zha/
"""
import asyncio
import collections
import logging
from homeassistant.core import callback
from .const import (
CLUSTER_TYPE_IN,
CLUSTER_TYPE_OUT,
... | {
"content_hash": "6226adfa6827434131523ead8ebb83c9",
"timestamp": "",
"source": "github",
"line_count": 173,
"max_line_length": 87,
"avg_line_length": 33.23699421965318,
"alnum_prop": 0.6417391304347826,
"repo_name": "Cinntax/home-assistant",
"id": "b07658e72d01ebacea3f02268b83633a3227ab97",
"size"... |
import os
import ConfigParser
import argparse
from apscheduler.scheduler import Scheduler
from datetime import datetime
from modules.light import read_light
from modules.soil_moisture import get_moisture
from modules.soil_temperature import get_celsius
from modules.temperature_and_humidity import get_temperature_and_h... | {
"content_hash": "2109f02ea3720f51a3fa28641fca24d9",
"timestamp": "",
"source": "github",
"line_count": 130,
"max_line_length": 103,
"avg_line_length": 35.38461538461539,
"alnum_prop": 0.6308695652173913,
"repo_name": "farmy-maker/farmy-py",
"id": "b1ea2b94032e054cb75dd5e2657dd1c8f510e393",
"size":... |
try:
import sys
import os
from Players.Audio import * # @UnusedWildImport
except ImportError, error:
print >> sys.stderr, "Erro ao importar o modulo", error
os._exit(1)
class ChannelSom:
"""Classe ChannelSom é uma classe para simular/tratar/lidar com canais de Som
:version: 224
:... | {
"content_hash": "fcbff390cc2dbab973eb68c5856caa51",
"timestamp": "",
"source": "github",
"line_count": 63,
"max_line_length": 113,
"avg_line_length": 42.317460317460316,
"alnum_prop": 0.6125281320330083,
"repo_name": "felipelindemberg/ControleMultimidiaUniversal",
"id": "98e99835bf72490319b1a2d502fc... |
from __future__ import absolute_import, print_function
from django.conf.urls import patterns, url
from .webhook import GitHubIntegrationsWebhookEndpoint
urlpatterns = patterns(
'',
url(r'^webhook/$', GitHubIntegrationsWebhookEndpoint.as_view()),
)
| {
"content_hash": "fba1c5bcde7982aec023500dfa8d27dc",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 68,
"avg_line_length": 25.9,
"alnum_prop": 0.7606177606177607,
"repo_name": "looker/sentry",
"id": "b51cbae85e9332451889f3d4e7ccd66aa1823095",
"size": "259",
"binary": fa... |
import os, sys, urllib, urllib2, socket
import xbmc, xbmcvfs, xbmcgui, xbmcaddon
import CommonFunctions
import re
import ftplib
import shutil
import time
import datetime
from datetime import date
# Minimal code to import bossanova808 common code
ADDON = xbmcaddon.Addon()
CWD = ADDON.getAddonInfo(... | {
"content_hash": "4b17a434cd89b90a9351d154a812b5a5",
"timestamp": "",
"source": "github",
"line_count": 930,
"max_line_length": 228,
"avg_line_length": 47.66559139784946,
"alnum_prop": 0.5918698820185432,
"repo_name": "aplicatii-romanesti/allinclusive-kodi-pi",
"id": "fe7bbf34f990c8783d3df55cb510a968... |
import datetime
import StringIO
import pytest
from django.test import TestCase
from django.db import IntegrityError
from django.core.files.uploadedfile import InMemoryUploadedFile
from django.contrib.auth.models import User
from py.path import local
from geoposition import Geoposition
from web.processors.event import ... | {
"content_hash": "e097cae47d3eb4ab238b2f9d70625fbb",
"timestamp": "",
"source": "github",
"line_count": 555,
"max_line_length": 483,
"avg_line_length": 39.655855855855854,
"alnum_prop": 0.714571311736108,
"repo_name": "joseihf/coding-events",
"id": "07a95362a4438ec0e12e9664f5b17aac4d12149d",
"size"... |
"""
Master configuration file for Evennia.
NOTE: NO MODIFICATIONS SHOULD BE MADE TO THIS FILE!
All settings changes should be done by copy-pasting the variable and
its value to <gamedir>/server/conf/settings.py.
Hint: Don't copy&paste over more from this file than you actually want
to change. Anything you don't cop... | {
"content_hash": "b212fdbd6d47da5964a820122569b46b",
"timestamp": "",
"source": "github",
"line_count": 1010,
"max_line_length": 100,
"avg_line_length": 50.52871287128713,
"alnum_prop": 0.7048830191636948,
"repo_name": "jamesbeebop/evennia",
"id": "15c7807977a7fd9ea6c7468fba492fc24ef52a3d",
"size":... |
from django import template
from ..models import *
from django.db.models.aggregates import Count
from django.core.cache import cache
register = template.Library()
@register.simple_tag
def get_category():
category_list = Category.objects.annotate(post_num=Count('post')).order_by('-post_num')
Category.objects.... | {
"content_hash": "ed480a088a84d0d46a7a87ecf8b4d570",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 110,
"avg_line_length": 25.942307692307693,
"alnum_prop": 0.6641957005189029,
"repo_name": "r26zhao/django_blog",
"id": "256b5bce98a0ccefadb6f31058c7419fe7808cd3",
"size": ... |
import time
import post
from api.api_helpers.common_helper import *
from api.api_helpers.user_helper import *
from util.StringBuilder import *
def create(ds, **args):
required(['username', 'name', 'email', 'about'], args)
optional('isAnonymous', args, False)
#ds.close_all()
conn = ds.get_db()
db ... | {
"content_hash": "38f569d16a0b5a19006b53726ee396b4",
"timestamp": "",
"source": "github",
"line_count": 205,
"max_line_length": 85,
"avg_line_length": 25.55121951219512,
"alnum_prop": 0.5399007254677358,
"repo_name": "igorcoding/forum-api",
"id": "b3520aa4330ed1d317b50e18516abb0c31e5f592",
"size": ... |
import unittest
import paddle
import paddle.distributed.fleet as fleet
import paddle.distributed.fleet.base.role_maker as role_maker
import os
import paddle.fluid as fluid
import numpy as np
class TestFleetBase(unittest.TestCase):
def setUp(self):
os.environ["POD_IP"] = "127.0.0.1"
os.environ["PAD... | {
"content_hash": "b26f22e89742db1981043d2d8130c6e4",
"timestamp": "",
"source": "github",
"line_count": 205,
"max_line_length": 89,
"avg_line_length": 33.88292682926829,
"alnum_prop": 0.5957385545637777,
"repo_name": "luotao1/Paddle",
"id": "686c7fa1ef75a260f78bde89cee8aa637825d911",
"size": "7557"... |
from __future__ import print_function
# This program is public domain
"""
Parameter expression evaluator.
For systems in which constraints are expressed as string expressions rather
than python code, :func:`compile_constraints` can construct an expression
evaluator that substitutes the computed values of the expressi... | {
"content_hash": "245cad576989b8571afdda3279bd7dbf",
"timestamp": "",
"source": "github",
"line_count": 402,
"max_line_length": 88,
"avg_line_length": 34.84577114427861,
"alnum_prop": 0.6424186179326099,
"repo_name": "lewisodriscoll/sasview",
"id": "c99740efbb2026da7ba3048ee725eedf8cec42e7",
"size"... |
from ctypes import c_int, c_char
from warnings import warn
import openmc.exceptions as exc
from . import _dll
def _error_handler(err, func, args):
"""Raise exception according to error code."""
# Get error code corresponding to global constant.
def errcode(s):
return c_int.in_dll(_dll, s).value
... | {
"content_hash": "8fb63fb12167897f8c582917cc6499a7",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 81,
"avg_line_length": 34.87179487179487,
"alnum_prop": 0.6544117647058824,
"repo_name": "wbinventor/openmc",
"id": "b35de4e60c9aadc9da2b845b2e9b98089357aebd",
"size": "136... |
import logging
import os
import subprocess
import sys
import virtualenv
from .activate_this import write_activate_this
LOGGER = logging.getLogger(__name__)
PREFIX = getattr(sys, "prefix", None)
REAL_PREFIX = getattr(sys, "real_prefix", None)
def install_virtualenv(install_dir):
if is_virtualenv(install_dir):
... | {
"content_hash": "2737e0dfee341311a9657efba6244547",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 69,
"avg_line_length": 23.71794871794872,
"alnum_prop": 0.6237837837837837,
"repo_name": "toumorokoshi/uranium",
"id": "db9c83b5ca8ee96841ac064411c6b452e15cdb82",
"size": "... |
"""Mock:
CNRead.describe(session, pid) → DescribeResponse
https://releases.dataone.org/online/api-documentation-v2.0.1/apis/CN_APIs.html#CNRead.describe
MNRead.describe(session, pid) → DescribeResponse
https://releases.dataone.org/online/api-documentation-v2.0.1/apis/MN_APIs.html#MNRead.describe
A DataONEException ca... | {
"content_hash": "261d82be90d79adc817e78c9cfdcdfd8",
"timestamp": "",
"source": "github",
"line_count": 80,
"max_line_length": 119,
"avg_line_length": 31.5625,
"alnum_prop": 0.6887128712871287,
"repo_name": "DataONEorg/d1_python",
"id": "f2f8e0a9700ffce7c4f3e7ca425624d2a7bc6eab",
"size": "3340",
... |
import os
import pytest
from wrimg.devices import Device
@pytest.fixture
def blkpath():
return '/dev/sdg'
@pytest.fixture
def regpath():
return 'setup.py'
@pytest.fixture
def regdev(regpath):
return Device(regpath)
@pytest.fixture
def blkdev(blkpath):
return Device(blkpath)
def test_fixtures... | {
"content_hash": "41b1a8517623db03f4f483ae0f156484",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 42,
"avg_line_length": 14.904761904761905,
"alnum_prop": 0.7204472843450479,
"repo_name": "mbr/wrimg",
"id": "2a98d70bdb48fdc49f4a3484be036c2a3c82a9de",
"size": "626",
"b... |
from log import init_logger
class PathMapper(object):
def __init__(self, mapping):
super(PathMapper, self).__init__()
self.mapping = mapping
self.logger = init_logger('PathMapper')
def map(self, path):
potential_keys = [key for key in self.mapping.keys() if path.startswith(key... | {
"content_hash": "590b57619f75dd8d00f5a87ffa1e6b31",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 85,
"avg_line_length": 35.72727272727273,
"alnum_prop": 0.6183206106870229,
"repo_name": "miguelaferreira/transmission-postprocess",
"id": "19c8d910ca0d318963db31562b5990f80c... |
from factory import Sequence, PostGenerationMethodCall
from factory.alchemy import SQLAlchemyModelFactory
from vBurgundy.user.models import User
from vBurgundy.database import db
class BaseFactory(SQLAlchemyModelFactory):
class Meta:
abstract = True
sqlalchemy_session = db.session
class UserFac... | {
"content_hash": "a0437a724eaa9d7f9e67d09b13f818ec",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 66,
"avg_line_length": 27.666666666666668,
"alnum_prop": 0.729776247848537,
"repo_name": "michaelrice/vBurgundy",
"id": "b0c20b1d47e4fe933b039dcc0229b342e4764f90",
"size": ... |
"""Tests for discussions API"""
# pylint: disable=redefined-outer-name
from django.core.exceptions import ImproperlyConfigured
from django.db.models.signals import post_save
from opensearch_dsl import Search
from factory.django import mute_signals
from open_discussions_api.constants import ROLE_STAFF
import pytest
from... | {
"content_hash": "0d77ea1a50618835719ddd7b1b85e928",
"timestamp": "",
"source": "github",
"line_count": 739,
"max_line_length": 118,
"avg_line_length": 41.37347767253045,
"alnum_prop": 0.7136222403924776,
"repo_name": "mitodl/micromasters",
"id": "44c008e055a815ac0d3960513ffe522e2f21cc44",
"size": ... |
"""The tests for the emulated Hue component."""
from http import HTTPStatus
import json
import unittest
from aiohttp import web
import defusedxml.ElementTree as ET
import pytest
from homeassistant import setup
from homeassistant.components import emulated_hue
from homeassistant.components.emulated_hue import upnp
fro... | {
"content_hash": "5f32391692499b8edf8479248d76f24d",
"timestamp": "",
"source": "github",
"line_count": 216,
"max_line_length": 88,
"avg_line_length": 29.925925925925927,
"alnum_prop": 0.6836324257425742,
"repo_name": "rohitranjan1991/home-assistant",
"id": "ec04ee7e19ca178a53e080a0619f3392a113e329",... |
from typing import Any, TYPE_CHECKING
from azure.core.configuration import Configuration
from azure.core.pipeline import policies
from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy
from .._version import VERSION
if TYPE_CHECKING:
# pylint: disable=unused-import,ungro... | {
"content_hash": "c1f5cd64dc0b441d3f645e30cd978a77",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 107,
"avg_line_length": 52.808510638297875,
"alnum_prop": 0.7264302981466559,
"repo_name": "Azure/azure-sdk-for-python",
"id": "c3e5601d1d620ecca829505194e46337c50f871d",
"... |
import math
import time
import krpc
turn_start_altitude = 250
turn_end_altitude = 45000
target_altitude = 150000
conn = krpc.connect(name='Launch into orbit')
vessel = conn.space_center.active_vessel
# Set up streams for telemetry
ut = conn.add_stream(getattr, conn.space_center, 'ut')
altitude = conn.add_stream(geta... | {
"content_hash": "6726125cede10945bdbdd4f473672710",
"timestamp": "",
"source": "github",
"line_count": 124,
"max_line_length": 82,
"avg_line_length": 28.870967741935484,
"alnum_prop": 0.702513966480447,
"repo_name": "mkluge/ksp-console",
"id": "043ea57fb2c658a148053454ae17574a6056a0a8",
"size": "3... |
import glob
import os
import re
import sys
# It's fragile to rely on the location of this script to find the top-level
# source directory.
TOP_LEVEL_DIRECTORY = os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))
WEBKIT_LIBRARIES = os.environ['WEBKIT_LIBRARIES'];
def main():... | {
"content_hash": "a7ba9641138d49f90530494980676a2f",
"timestamp": "",
"source": "github",
"line_count": 64,
"max_line_length": 115,
"avg_line_length": 40.03125,
"alnum_prop": 0.6928181108508977,
"repo_name": "gubaojian/trylearn",
"id": "51d650f7fbc5ac4914ebe3d299e74e798878731c",
"size": "2585",
"... |
"""Module containing the Chrome stages."""
from __future__ import print_function
import glob
import multiprocessing
import os
import shutil
from chromite.cbuildbot import commands
from chromite.cbuildbot import goma_util
from chromite.cbuildbot import manifest_version
from chromite.cbuildbot.stages import artifact_s... | {
"content_hash": "c3732bf4927eabfe57689e9ae4827b33",
"timestamp": "",
"source": "github",
"line_count": 370,
"max_line_length": 80,
"avg_line_length": 42.77297297297297,
"alnum_prop": 0.6501326930367749,
"repo_name": "endlessm/chromium-browser",
"id": "9c5a372e7d33f701aac91ecd8ccc2c43fcc3ddd0",
"si... |
from otp.ai.AIBaseGlobal import *
from pandac.PandaModules import *
from DistributedNPCToonBaseAI import *
import ToonDNA
from direct.task.Task import Task
from toontown.ai import DatabaseObject
from toontown.estate import ClosetGlobals
class DistributedNPCTailorAI(DistributedNPCToonBaseAI):
freeClothes = simbase.... | {
"content_hash": "a4eb8c506b7727d0abb1d8f77535aa8f",
"timestamp": "",
"source": "github",
"line_count": 178,
"max_line_length": 172,
"avg_line_length": 45.57865168539326,
"alnum_prop": 0.6180204609885369,
"repo_name": "ksmit799/Toontown-Source",
"id": "3a16b6dfc8363e5ca44b458d615671610e12673e",
"si... |
from . import CATALOGS_USE_SOCIAL_GRAPH
if CATALOGS_USE_SOCIAL_GRAPH:
from django.conf import settings
def inverse(edge_type):
from social_graph.models import EdgeTypeAssociation
return EdgeTypeAssociation.objects.get(direct=edge_type).inverse
# TODO: re-implement!!!
class GraphGrou... | {
"content_hash": "586c8da793b5a12f47e4aa94bac702e3",
"timestamp": "",
"source": "github",
"line_count": 71,
"max_line_length": 108,
"avg_line_length": 37.12676056338028,
"alnum_prop": 0.5618361153262519,
"repo_name": "suselrd/django-catalog-wizard",
"id": "5fdbd002c7211bbed83fc24ebd13f5f324a615cc",
... |
from django.conf.urls.defaults import patterns, include, url
from django.conf import settings
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
# Examples:
# url(r'^$', '{{ project_name }}.views.home', name='home'),
# url(r... | {
"content_hash": "0a4fdb02fd2528707218ddb49834d663",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 90,
"avg_line_length": 34.30434782608695,
"alnum_prop": 0.6628643852978454,
"repo_name": "zbyte64/django-dockit",
"id": "01714a9f6c9184d8fd40f923d96c4b552cc3c809",
"size": ... |
from graphics.widgets.verified_input_f import VerifiedInputF
import file_experts.file_expert as file_expert
import constants.input_constants as const
import tkinter as tk
class FileAndDirectoryNameInputF(tk.Frame):
""" Use to get user input for the new directory / file name."""
def __init__(self,
... | {
"content_hash": "448e339eda4787b27b7affc1c6369118",
"timestamp": "",
"source": "github",
"line_count": 255,
"max_line_length": 77,
"avg_line_length": 30.31764705882353,
"alnum_prop": 0.49967662656836115,
"repo_name": "dani-i/bachelor-project",
"id": "d7b23feb70e43f54af5f89add400066dff392d97",
"siz... |
import json
from typing import Any, Dict, Mapping, Optional
from urllib.parse import quote_plus
from mock import patch
from eduid_common.api.testing import EduidAPITestCase
from eduid_webapp.phone.app import PhoneApp, phone_init_app
from eduid_webapp.phone.helpers import PhoneMsg
class PhoneTests(EduidAPITestCase)... | {
"content_hash": "6b25b55f765208977cdfe8f63e64320a",
"timestamp": "",
"source": "github",
"line_count": 697,
"max_line_length": 119,
"avg_line_length": 41.80057388809182,
"alnum_prop": 0.6197357130598936,
"repo_name": "SUNET/eduid-webapp",
"id": "14feeb412612f302ccd876cc5f15b9cb471f3d18",
"size": "... |
import os
import sqlite3
import asyncio
import contextlib
import ipaddress
from collections import namedtuple
from itertools import chain
from pprint import pprint
from datetime import datetime
import aiodns
import requests
DB_NAME = 'dnsdb.sqlite3'
DnsQuery = namedtuple('DnsRequest',
'host cr... | {
"content_hash": "0cb681438eef784daa41698ac776054d",
"timestamp": "",
"source": "github",
"line_count": 238,
"max_line_length": 202,
"avg_line_length": 30.714285714285715,
"alnum_prop": 0.5459644322845417,
"repo_name": "kotyara1005/hello-rebbit",
"id": "1220ebac45aa0dee0f21987bf083e0364f3717f4",
"s... |
"""Unit-test of module 'backend' in 'msbackup' package."""
import os
import filecmp
import shutil
import subprocess
import tempfile
import unittest
from msbackup.backend import File
from test.mock import TextFile
try:
import configparser
except ImportError:
from six.moves import configparser
try:
xrang... | {
"content_hash": "71a91a2cce1d8ff35aa9800415c5ccd1",
"timestamp": "",
"source": "github",
"line_count": 97,
"max_line_length": 76,
"avg_line_length": 33.55670103092783,
"alnum_prop": 0.6018433179723502,
"repo_name": "Aleksei-Badyaev/msbackup",
"id": "233acb86a9d265e51b77502ec300492ba7cf0615",
"size... |
'''
Created on 2009-12-29
@author: cfournie
'''
import util
import DocumentStructure
from lxml import etree
IGNORE = 'ignore'
IGNORE_TRUE = 'true'
IGNORE_FALSE = 'false'
ABBR = 'abbrFound'
ABBR_TRUE = 'true'
ABBR_FALSE = 'false'
class _ParseXHTML_Abstract(object):
'''
classdocs
'''
... | {
"content_hash": "40876ad7446ae7253c7efcfc416370ba",
"timestamp": "",
"source": "github",
"line_count": 672,
"max_line_length": 107,
"avg_line_length": 37.21577380952381,
"alnum_prop": 0.6030229117517694,
"repo_name": "cfournie/docstruct",
"id": "18545d80620a6f56fea01978e2626fcdc03f28d9",
"size": "... |
import sys
import os
# If extensions (or modules to document with autodoc) are in another
# directory, add these directories to sys.path here. If the directory is
# relative to the documentation root, use os.path.abspath to make it
# absolute, like shown here.
#sys.path.insert(0, os.path.abspath('.'))
# Get the proje... | {
"content_hash": "049ce884bc9b1b1e76dc38022883fdb4",
"timestamp": "",
"source": "github",
"line_count": 260,
"max_line_length": 76,
"avg_line_length": 31.05,
"alnum_prop": 0.705685618729097,
"repo_name": "regebro/webobentrypoints",
"id": "3394fca72d8a181b7afc51f5a2f4b724e3229aac",
"size": "8518",
... |
from fakeredis import FakeRedis
import redis
from redlock import Redlock
from redlock_fifo.extendable_redlock import ExtendableRedlock
from time import time
import threading
class FakeRedisCustom(FakeRedis):
def __init__(self, db=0, charset='utf-8', errors='strict', **kwargs):
super(FakeRedisCustom, self)... | {
"content_hash": "78ad014e06418ca1f2405a3bdfe7444d",
"timestamp": "",
"source": "github",
"line_count": 80,
"max_line_length": 84,
"avg_line_length": 28.75,
"alnum_prop": 0.6186956521739131,
"repo_name": "internap/redlock-fifo",
"id": "ee89c01a33a868a082c8dbf4294a0dc6b14996d0",
"size": "2873",
"b... |
import unittest, time, sys, random, math
sys.path.extend(['.','..','../..','py'])
import h2o, h2o_cmd, h2o_kmeans, h2o_import as h2i
from operator import itemgetter
# want named tuples
import collections
# a truly uniform sphere
# http://stackoverflow.com/questions/5408276/python-uniform-spherical-distribution
# While... | {
"content_hash": "f088bce646d7c9066e4e26fe875f7073",
"timestamp": "",
"source": "github",
"line_count": 224,
"max_line_length": 159,
"avg_line_length": 40.120535714285715,
"alnum_prop": 0.591409814176032,
"repo_name": "h2oai/h2o",
"id": "34aed7ef2884eea8a38e0e5edf06c33ba285dd62",
"size": "8987",
... |
from __future__ import absolute_import
from .base import WhiteNoise
__version__ = '2.0.4'
__all__ = ['WhiteNoise']
| {
"content_hash": "139ca21e4c1b550cd35390588a24787c",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 38,
"avg_line_length": 16.857142857142858,
"alnum_prop": 0.652542372881356,
"repo_name": "hirokiky/whitenoise",
"id": "f981dfd9eea15a8907ac491aea804e07ecb2b6e5",
"size": "11... |
"""Support for collections of mapped entities.
The collections package supplies the machinery used to inform the ORM of
collection membership changes. An instrumentation via decoration approach is
used, allowing arbitrary types (including built-ins) to be used as entity
collections without requiring inheritance from ... | {
"content_hash": "f2d36894a11660de699b7f5dadd6992c",
"timestamp": "",
"source": "github",
"line_count": 1675,
"max_line_length": 78,
"avg_line_length": 32.05850746268657,
"alnum_prop": 0.5981787031174346,
"repo_name": "wujuguang/sqlalchemy",
"id": "ae96a8c4da59f9ecc6892b73beafda1b6172d4b5",
"size":... |
"""
The basic iterator-classes for iterating over the blocks and transactions of
the blockchain.
"""
from collections import deque
from sortedcontainers import SortedList
from .defs import GENESIS_PREV_BLOCK_HASH, HEIGHT_SAFETY_MARGIN
from .misc import hash_hex_to_bytes, FilePos, Bunch
from .rawfiles import RawDataIt... | {
"content_hash": "a72aa51bb5aad8ec4b7f432e72c5cc6e",
"timestamp": "",
"source": "github",
"line_count": 535,
"max_line_length": 148,
"avg_line_length": 38.822429906542055,
"alnum_prop": 0.580693307655272,
"repo_name": "fungibit/chainscan",
"id": "eb5b3909c45d477f2f8a47c00c7a3cdb25a881b4",
"size": "... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
def fbcode_builder_spec(builder):
return {
'steps': [
# on macOS the filesystem is typically case insensitive.
# We need to ensure th... | {
"content_hash": "33ae5307fb8e870afa521a12d919b858",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 71,
"avg_line_length": 37.55555555555556,
"alnum_prop": 0.628698224852071,
"repo_name": "phoad/rsocket-cpp",
"id": "3d128b9c07b2fcdfe6126aca5e95ac3e359b1d66",
"size": "749"... |
dna = input('Enter your primer sequence: ')
seqsize = len(dna)
if seqsize < 10:
print('The primer must have at least ten nucleotides')
elif seqsize < 25:
print('This size is OK')
else:
print('The primer is too long')
| {
"content_hash": "60244a015552b49e7feb351670424d85",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 58,
"avg_line_length": 28.625,
"alnum_prop": 0.6768558951965066,
"repo_name": "Serulab/Py4Bio",
"id": "71960dc1287b75aa27ca26b9f95359bbf289065a",
"size": "229",
"binary": ... |
"""Import to cause an exception, to test our hooks."""
__author__ = 'rob.galanakis@gmail.com'
raise NotImplementedError | {
"content_hash": "9744b6724e068957082904532ec6ef19",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 54,
"avg_line_length": 24.2,
"alnum_prop": 0.7272727272727273,
"repo_name": "rgalanakis/practicalmayapython",
"id": "1d492baf07fbc2359acfbcaf7f6f759d04ffa8ea",
"size": "121"... |
import argparse
import json
import os
import subprocess
import sys
import urllib2
from utils import commit
from utils import system
import patch
# //base and its dependencies
_base_deps = [
'base',
'testing',
'third_party/ashmem',
'third_party/libevent',
'third_party/libxml', # via //base/test
... | {
"content_hash": "ea1b44109911f21c55afe6a0688c9b2a",
"timestamp": "",
"source": "github",
"line_count": 160,
"max_line_length": 83,
"avg_line_length": 28.30625,
"alnum_prop": 0.6180172223448885,
"repo_name": "qiankunshe/sky_engine",
"id": "4c9c8f1bdd7ea9588219f53d788d42de454cb814",
"size": "4714",
... |
import numpy as np
import pytest
import cirq
def test_external():
for t in ['a', 1j]:
cirq.testing.assert_equivalent_repr(t)
cirq.testing.assert_equivalent_repr(t, setup_code='')
cirq.testing.assert_equivalent_repr(np.array([5]), setup_code='from numpy import array')
with pytest.raises(... | {
"content_hash": "ceea9a6a1c00d50f8aa9f593ace24e76",
"timestamp": "",
"source": "github",
"line_count": 73,
"max_line_length": 92,
"avg_line_length": 32.6986301369863,
"alnum_prop": 0.6154168412232929,
"repo_name": "quantumlib/Cirq",
"id": "de087b6196df835a3f5898cad87a65675b1fac97",
"size": "2972",... |
"""Tests for the Google Drive Sync log log text parser plugin."""
import unittest
from plaso.parsers.text_plugins import gdrive_synclog
from tests.parsers.text_plugins import test_lib
class GoogleDriveSyncLogTextPluginTest(test_lib.TextPluginTestCase):
"""Tests for the Google Drive Sync log text parser plugin.""... | {
"content_hash": "a02454b39b566c3847c0ad687cc43e86",
"timestamp": "",
"source": "github",
"line_count": 110,
"max_line_length": 80,
"avg_line_length": 38.763636363636365,
"alnum_prop": 0.6801125703564728,
"repo_name": "joachimmetz/plaso",
"id": "b34e51f093ad64ea9c81dcc855c387f5d0e1b8b3",
"size": "4... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.