text stringlengths 4 1.02M | meta dict |
|---|---|
"""
Boxing and unboxing of native Numba values to / from CPython objects.
"""
from llvmlite import ir
from .. import cgutils, numpy_support, types
from ..pythonapi import box, unbox, reflect, NativeValue
from . import listobj
#
# Scalar types
#
@box(types.Boolean)
def box_bool(c, typ, val):
longval = c.builde... | {
"content_hash": "fbff8d1925978fae58fd00ff5ba508c6",
"timestamp": "",
"source": "github",
"line_count": 615,
"max_line_length": 91,
"avg_line_length": 33.66341463414634,
"alnum_prop": 0.6138723856445926,
"repo_name": "pombredanne/numba",
"id": "ff7dd0204ecd7c0f24c6e27bd8aa3183c909a447",
"size": "20... |
from django import forms
from django.contrib.auth.forms import (
UserChangeForm as DjangoUserChangeForm,
UserCreationForm as DjangoUserCreationForm
)
from .models import User
class UserForm(forms.ModelForm):
class Meta:
# Set this form to use the User model.
model = User
# Const... | {
"content_hash": "d6d4c4e60fa8633b820ddb995257bd99",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 78,
"avg_line_length": 24.72972972972973,
"alnum_prop": 0.687431693989071,
"repo_name": "wldcordeiro/cookiecutter-django-essentials",
"id": "00e36128dc46b51f6fdadcb997c99c53e... |
from functools import update_wrapper
from weakref import WeakSet
from django.apps import apps
from django.contrib.admin import ModelAdmin, actions
from django.contrib.auth import REDIRECT_FIELD_NAME
from django.core.exceptions import ImproperlyConfigured
from django.db.models.base import ModelBase
from django.http imp... | {
"content_hash": "9a1281f4aef334c6cec6bc5d957df58e",
"timestamp": "",
"source": "github",
"line_count": 520,
"max_line_length": 109,
"avg_line_length": 38.58653846153846,
"alnum_prop": 0.5931223523548468,
"repo_name": "scifiswapnil/Project-LoCatr",
"id": "e70a27a152a3d8d5d8fd844b5ee9eb3811e23b63",
... |
import datetime
from typing import Optional, Type
from unittest.mock import Mock
import pytest
from anchore_engine.db.entities.policy_engine import (
DistroNamespace,
FeedGroupMetadata,
GrypeDBFeedMetadata,
)
from anchore_engine.services.policy_engine.engine.policy.gate_util_provider import (
GateUtil... | {
"content_hash": "5ae9722c6f0190e7d8ad0933ac4316d3",
"timestamp": "",
"source": "github",
"line_count": 127,
"max_line_length": 98,
"avg_line_length": 32.503937007874015,
"alnum_prop": 0.564922480620155,
"repo_name": "anchore/anchore-engine",
"id": "aa0bf074a83c73ea5a6db07d32153cc68af3392d",
"size"... |
import logging
import sys
from framework.mongo import database
from framework.transactions.context import TokuTransaction
from scripts import utils as script_utils
from website.app import init_app
from website.models import PreprintService
from website.preprints.tasks import on_preprint_updated
from website import set... | {
"content_hash": "52f34ef83489378ecefd74f2c5854130",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 113,
"avg_line_length": 31.696428571428573,
"alnum_prop": 0.6563380281690141,
"repo_name": "rdhyee/osf.io",
"id": "58f2d06f265cb5ff9799299c605a669ed2a2c4d3",
"size": "1775"... |
"""
Test model API
"""
import six
import copy
import collections
from datetime import datetime
from unittest import TestCase
from pynamodb.throttle import Throttle
from pynamodb.connection.util import pythonic
from pynamodb.exceptions import TableError
from pynamodb.types import RANGE
from pynamodb.constants import (
... | {
"content_hash": "bb761e25f9efacb2ce914d61c16deaff",
"timestamp": "",
"source": "github",
"line_count": 1430,
"max_line_length": 128,
"avg_line_length": 36.765034965034964,
"alnum_prop": 0.47706090462966483,
"repo_name": "mtsgrd/PynamoDB2",
"id": "0f679086e7ad458a840741791791082567700daf",
"size": ... |
from cx_Freeze import setup, Executable
executables = [Executable('example.py', targetName='hello_world.exe')]
excludes = ['unicodedata', 'logging', 'unittest', 'email', 'html', 'http', 'urllib',
'xml', 'pydoc', 'doctest', 'argparse', 'datetime', 'zipfile',
'subprocess', 'pickle', 'threading',... | {
"content_hash": "9294afcf322ec534872d2a4e656442c2",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 84,
"avg_line_length": 34.8,
"alnum_prop": 0.5890804597701149,
"repo_name": "Jenyay/cx_freeze_examples",
"id": "a1268e900f5e6db5d9f5753de572a8d074b2897b",
"size": "1061",
... |
'''
Custom filters for use in openshift-master
'''
import copy
import sys
import yaml
from ansible import errors
from ansible.runner.filter_plugins.core import bool as ansible_bool
class IdentityProviderBase(object):
""" IdentityProviderBase
Attributes:
name (str): Identity provider Name
... | {
"content_hash": "821087246c6b1ed3868bdec0704d8e8c",
"timestamp": "",
"source": "github",
"line_count": 504,
"max_line_length": 120,
"avg_line_length": 38.970238095238095,
"alnum_prop": 0.5733923934626547,
"repo_name": "themurph/openshift-tools",
"id": "c41367f05c4ac542736575496cba78f4021fb830",
"s... |
from __future__ import unicode_literals
import frappe, json, os
from frappe.website.website_generator import WebsiteGenerator
from frappe import _, scrub
from frappe.utils import cstr
from frappe.website.utils import get_comment_list
from frappe.custom.doctype.customize_form.customize_form import docfield_properties
fr... | {
"content_hash": "0a0101bd960fa9d47ecbac771eb1ee54",
"timestamp": "",
"source": "github",
"line_count": 592,
"max_line_length": 173,
"avg_line_length": 29.716216216216218,
"alnum_prop": 0.6928149158708504,
"repo_name": "RicardoJohann/frappe",
"id": "c8daef95e288d8f04b701c78ac6927c7330dcffd",
"size"... |
"""
SQLite3 backend for django.
Python 2.3 and 2.4 require pysqlite2 (http://pysqlite.org/).
Python 2.5 and later can use a pysqlite2 module or the sqlite3 module in the
standard library.
"""
from django.db.backends import *
from django.db.backends.signals import connection_created
from django.db.backends... | {
"content_hash": "29cec0ab86291939ebc5930b93363824",
"timestamp": "",
"source": "github",
"line_count": 235,
"max_line_length": 125,
"avg_line_length": 40.714893617021275,
"alnum_prop": 0.6292851170568562,
"repo_name": "greggian/TapdIn",
"id": "e8f4cb53b0de17546b99f45fc3949211b5da454f",
"size": "95... |
'''Unit tests for the twitter.py library'''
__author__ = 'dewitt@google.com'
import os
import simplejson
import time
import unittest
import twitter
class StatusTest(unittest.TestCase):
SAMPLE_JSON = '''{"created_at": "Fri Jan 26 23:17:14 +0000 2007", "id": 4391023, "text": "A l\u00e9gp\u00e1rn\u00e1s haj\u00f3m ... | {
"content_hash": "c4ad37313a01f97de1aef619ee9c7824",
"timestamp": "",
"source": "github",
"line_count": 520,
"max_line_length": 462,
"avg_line_length": 42.80384615384615,
"alnum_prop": 0.6567975559349447,
"repo_name": "google-code-export/django-hotclub",
"id": "7eca10083eeb7776e8030b3b20810cd383310f5... |
import logging
import pickle
from ray.rllib.utils.annotations import PublicAPI
logger = logging.getLogger(__name__)
try:
import requests # `requests` is not part of stdlib.
except ImportError:
requests = None
logger.warning(
"Couldn't import `requests` library. Be sure to install it on"
... | {
"content_hash": "06a9d66d86c753df1fed187f35a750f7",
"timestamp": "",
"source": "github",
"line_count": 124,
"max_line_length": 77,
"avg_line_length": 31.532258064516128,
"alnum_prop": 0.591304347826087,
"repo_name": "stephanie-wang/ray",
"id": "6071c258c33741d03d41a77872906eb6e1ff0974",
"size": "3... |
from __future__ import absolute_import
from django.utils.datastructures import SortedDict
from cloud.api import neutron
neutronclient = neutron.neutronclient
class Vip(neutron.NeutronAPIDictWrapper):
"""Wrapper for neutron load balancer vip."""
def __init__(self, apiresource):
super(Vip, self).__i... | {
"content_hash": "1d17a298d85715ab72ef103d160d9c8e",
"timestamp": "",
"source": "github",
"line_count": 333,
"max_line_length": 78,
"avg_line_length": 33.28528528528528,
"alnum_prop": 0.6157524359437027,
"repo_name": "eoncloud-dev/eonboard",
"id": "7806777ea2a1ae1c97fea99480bfc5b76155c9d2",
"size":... |
import copy
import simplejson as json
from gettext import gettext as _
from django.core.exceptions import ValidationError, ObjectDoesNotExist
from django.forms.util import ErrorList, ErrorDict
from django.shortcuts import render
from django.http import Http404
import reversion
from mozdns.address_record.models impor... | {
"content_hash": "c3d40409afbdf6244fc77c2ef5e86f80",
"timestamp": "",
"source": "github",
"line_count": 269,
"max_line_length": 78,
"avg_line_length": 28.687732342007436,
"alnum_prop": 0.6071012051315278,
"repo_name": "rtucker-mozilla/mozilla_inventory",
"id": "ba6eea22fe6e919926bc5c1d6a24a8930515973... |
from views_generator import ViewsStyleGenerator
import unittest
class ViewsStyleGeneratorTest(unittest.TestCase):
def setUp(self):
self.generator = ViewsStyleGenerator()
def assertEqualToFile(self, value, filename):
with open(filename) as f:
contents = f.read()
self.as... | {
"content_hash": "ef3beb97a435b8243ff5b1f1e09bac11",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 72,
"avg_line_length": 32.34615384615385,
"alnum_prop": 0.5909631391200951,
"repo_name": "endlessm/chromium-browser",
"id": "49563e270c57a82048dd248d93745d940f5027ab",
"siz... |
"""Support for Recollect Waste curbside collection pickup."""
from datetime import timedelta
import logging
import recollect_waste
import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.const import CONF_NAME
import homeassistant.helpers.config_validation as cv
from ho... | {
"content_hash": "b66651586befa575f1d8efb7814aef27",
"timestamp": "",
"source": "github",
"line_count": 96,
"max_line_length": 77,
"avg_line_length": 29.1875,
"alnum_prop": 0.6384725196288366,
"repo_name": "tchellomello/home-assistant",
"id": "bc1ace5369f21dfb7791bb91835cc839f172bead",
"size": "280... |
import os
from setuptools import setup, find_packages
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
if __name__ == '__main__':
setup(name='zahpeeapi',
version='0.0.16',
description='Zahpee API Python Client',
long_description=read('README.md... | {
"content_hash": "cc57e9ba3d711402034c6124c5249b6c",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 92,
"avg_line_length": 32.625,
"alnum_prop": 0.5542784163473818,
"repo_name": "hekima/zahpee-api-python-client",
"id": "47b89c6d4c5d0042bf150b13a7524e0644053f37",
"size": "... |
from .ar_model import AR
from .arima_model import ARMA, ARIMA
from . import vector_ar as var
from .arima_process import arma_generate_sample, ArmaProcess
from .vector_ar.var_model import VAR
from .vector_ar.svar_model import SVAR
from .vector_ar.dynamic import DynamicVAR
from .filters import api as filters
from . impor... | {
"content_hash": "1b4b6d6ba21b45fe270f342aff569a28",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 70,
"avg_line_length": 38.69565217391305,
"alnum_prop": 0.8134831460674158,
"repo_name": "gef756/statsmodels",
"id": "3b8335949e753843028ca883af98c9981dfaf89d",
"size": "89... |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('lots_admin', '0025_auto_20161129_0909'),
]
operations = [
migrations.AlterField(
model_name='address',
name='street_dir',
... | {
"content_hash": "2aa11aee326d4d36c49acfe0a54746c9",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 61,
"avg_line_length": 27.181818181818183,
"alnum_prop": 0.5518394648829431,
"repo_name": "datamade/large-lots",
"id": "f5121fcdf1d95223a7496ee944c417ccedd69487",
"size": "... |
from os import path
import pandas as pd
from econtools.metrics.api import reg, ivreg
class TestOLS_savemem(object):
@classmethod
def setup_class(cls):
"""Stata reg output from `sysuse auto; reg price mpg`"""
test_path = path.split(path.relpath(__file__))[0]
auto_path = path.join(tes... | {
"content_hash": "4c12de58418190c3afafa3c4c2c91adc",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 77,
"avg_line_length": 27.035714285714285,
"alnum_prop": 0.5898282694848085,
"repo_name": "dmsul/econtools",
"id": "3d1dbfef0b22fe043ec3a1fa192e9521252b2cbe",
"size": "1514... |
from __future__ import unicode_literals
from django.db import models
from .constants import nutrition_endpoints
from kolibri.core.auth.models import FacilityUser
from kolibri.core.auth.permissions.general import IsOwn
from kolibri.core.fields import JSONField
class PingbackNotification(models.Model):
id = mode... | {
"content_hash": "53327d364f51c0fe7c16dc15c86d25e7",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 81,
"avg_line_length": 30.966666666666665,
"alnum_prop": 0.7545748116254036,
"repo_name": "mrpau/kolibri",
"id": "b09ba8709594d5d2a8a682678b7183234c7df704",
"size": "953",
... |
"""Support for Wink binary sensors."""
import logging
import pywink
from homeassistant.components.binary_sensor import BinarySensorDevice
from . import DOMAIN, WinkDevice
_LOGGER = logging.getLogger(__name__)
# These are the available sensors mapped to binary_sensor class
SENSOR_TYPES = {
"brightness": "light"... | {
"content_hash": "3ea7068a2cfeaa0dddc79aa7caefd415",
"timestamp": "",
"source": "github",
"line_count": 186,
"max_line_length": 79,
"avg_line_length": 35.11290322580645,
"alnum_prop": 0.6239473281273924,
"repo_name": "qedi-r/home-assistant",
"id": "6dd22a3f7b8fd8686a5d8d1ccf8e9009d6ecdea3",
"size":... |
"""
Description:
- Simple Factory Pattern implementation
- To notice them main idea a base class App was created and two other subclasses
@author: Paul Bodean
@date: 10/08/2017
"""
from typing import Union
from selenium.webdriver import Chrome, Firefox
from src.factory.pages.menu import Menu
from src.factory.pages.... | {
"content_hash": "2c2d04a4f967d9d78448b0547c3d1372",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 80,
"avg_line_length": 21.536585365853657,
"alnum_prop": 0.6058890147225368,
"repo_name": "paulbodean88/automation-design-patterns",
"id": "4226d5d6d64c3e5f2b4d46ac45f94d3a7e... |
"""
The modelgen module provides classes for specifying designs for individual
subject analysis of task-based fMRI experiments. In particular it also includes
algorithms for generating regressors for sparse and sparse-clustered acquisition
experiments.
These functions include:
* SpecifyModel: allows specification o... | {
"content_hash": "c0050708e50264d431e2c053b7b0ec8c",
"timestamp": "",
"source": "github",
"line_count": 795,
"max_line_length": 98,
"avg_line_length": 43.59496855345912,
"alnum_prop": 0.5355762017427433,
"repo_name": "wanderine/nipype",
"id": "4114aa308347abfa41825e2b995ad8e402dd56aa",
"size": "347... |
import os
import sys
from unittest import defaultTestLoader, TextTestRunner, TestSuite
TESTS = ('form', 'fields', 'validators', 'widgets', 'webob_wrapper', 'csrf', 'ext_csrf', 'i18n')
OPTIONAL_TESTS = ('ext_django.tests', 'ext_sqlalchemy', 'ext_dateutil', 'locale_babel')
def make_suite(prefix='', extra=(), force_al... | {
"content_hash": "30c8fb2d5aceaddf4ae61327f6ff9b11",
"timestamp": "",
"source": "github",
"line_count": 78,
"max_line_length": 104,
"avg_line_length": 34.08974358974359,
"alnum_prop": 0.6039864610755923,
"repo_name": "pawl/wtforms",
"id": "c65ecd52a65165ce37d64264541ff9af9c16cfe1",
"size": "2681",
... |
"""
Provides a command container for additional tox commands, used in "tox.ini".
COMMANDS:
* copytree
* copy
* py2to3
REQUIRES:
* argparse
"""
from glob import glob
import argparse
import inspect
import os.path
import shutil
import sys
import collections
__author__ = "Jens Engel"
__copyright__ = "(c) 2013 ... | {
"content_hash": "5341459a265c52aebc968197e1bead77",
"timestamp": "",
"source": "github",
"line_count": 268,
"max_line_length": 84,
"avg_line_length": 35.61194029850746,
"alnum_prop": 0.5420159262363788,
"repo_name": "connorsml/behave",
"id": "c7b99f773444f36ddc45d0299eb05324e23f498e",
"size": "959... |
from var_plots import plot_forecast
plot_forecast()
| {
"content_hash": "d9e7255fa048624bdb4ea098070c0d5f",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 35,
"avg_line_length": 17.666666666666668,
"alnum_prop": 0.7924528301886793,
"repo_name": "josef-pkt/statsmodels",
"id": "596890ffe3e3cc8b3be9c28d0dbf0315b87054e0",
"size": ... |
"""
Implementations of several key algorithms, such as: TSP, Graph, SuperMap, Linear Programming, ML, etc. used by other modules.
"""
from jcvi.apps.base import dmain
if __name__ == "__main__":
dmain(__file__)
| {
"content_hash": "c3010e7cac04de97c39d0edbfb8c53be",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 125,
"avg_line_length": 24.11111111111111,
"alnum_prop": 0.6682027649769585,
"repo_name": "tanghaibao/jcvi",
"id": "baf6ccd7ed9226058421e2262c2233a92e16a404",
"size": "263",... |
import pytest
from stix2.datastore import (
CompositeDataSource, DataSink, DataSource, DataStoreMixin,
)
from stix2.datastore.filters import Filter
from .constants import CAMPAIGN_MORE_KWARGS
def test_datasource_abstract_class_raises_error():
with pytest.raises(TypeError):
DataSource()
def test_da... | {
"content_hash": "d799225360f5cc528108d6148a3a5934",
"timestamp": "",
"source": "github",
"line_count": 127,
"max_line_length": 134,
"avg_line_length": 37.51968503937008,
"alnum_prop": 0.7164742917103882,
"repo_name": "oasis-open/cti-python-stix2",
"id": "8bb5494c48181e5c69dcf8b07e39330c06215d2f",
... |
from copy import deepcopy
from typing import Any, TYPE_CHECKING
from azure.core.rest import HttpRequest, HttpResponse
from azure.mgmt.core import ARMPipelineClient
from . import models
from ._configuration import ServiceFabricManagementClientConfiguration
from ._serialization import Deserializer, Serializer
from .ope... | {
"content_hash": "8d27ce6cb474a1fba9ad2b4a9f2ffff8",
"timestamp": "",
"source": "github",
"line_count": 119,
"max_line_length": 119,
"avg_line_length": 46.42857142857143,
"alnum_prop": 0.7154751131221719,
"repo_name": "Azure/azure-sdk-for-python",
"id": "7b2941cf9f5d2b688aeb423c3df36df979d44c48",
"... |
import os
import numpy as np
from numpy.testing import assert_array_almost_equal
from nose.tools import assert_true, assert_equal, assert_raises
try:
from nose.tools import assert_list_equal
except ImportError:
from landlab.testing.tools import assert_list_equal
from landlab.testing.tools import cdtemp
from l... | {
"content_hash": "0b88888c6c57901d125c84e7c0ad8245",
"timestamp": "",
"source": "github",
"line_count": 111,
"max_line_length": 78,
"avg_line_length": 37.32432432432432,
"alnum_prop": 0.6162201303403331,
"repo_name": "SiccarPoint/landlab",
"id": "c0a02f888c30783b7426a43c0840fd7debd3a742",
"size": "... |
import time
import unittest
from autothreadharness.harness_case import HarnessCase
class SED_6_5_1(HarnessCase):
role = HarnessCase.ROLE_SED
case = '6 5 1'
golden_devices_required = 1
def on_dialog(self, dialog, title):
if title.startswith('Reset DUT'):
time.sleep(self.child_time... | {
"content_hash": "d3ab7c476da91637951d644bc2cafda8",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 54,
"avg_line_length": 22.09090909090909,
"alnum_prop": 0.5946502057613169,
"repo_name": "bukepo/openthread",
"id": "f50f4565070a1da3730af4cbccbdf27abbe2ef38",
"size": "206... |
__all__ = ['Report', 'TestHelperTMP']
from storm.twisted.transact import transact
from storm.locals import *
from oonib.report.db import getStore, transactor
class OModel(object):
transactor = transactor
@transact
def create(query):
store = Store(database)
store.execute(query)
st... | {
"content_hash": "3dd5f118cd62ddbba076cac5ee7bb907",
"timestamp": "",
"source": "github",
"line_count": 83,
"max_line_length": 87,
"avg_line_length": 30.337349397590362,
"alnum_prop": 0.6350277998411438,
"repo_name": "hackerberry/ooni-probe",
"id": "21e60eb9d1dd45cb7d3df9adada8ccef06af4ba4",
"size"... |
import rospy
from sensor_msgs.msg import PointCloud2, Image
from cv_bridge import CvBridge
import cv, cv2
import numpy
import matplotlib
import copy
from rosCV import rosCV as rcv
# import code # FOR TESTING
class Bound():
def __init__(self, topic):
# self.defaultManip = rospy.get_param('boundingBox/defa... | {
"content_hash": "f0f19842b572786b05e00437fc5c44bc",
"timestamp": "",
"source": "github",
"line_count": 79,
"max_line_length": 132,
"avg_line_length": 39.392405063291136,
"alnum_prop": 0.5909383033419023,
"repo_name": "OSUrobotics/privacy-interfaces",
"id": "9ff07f676dee9c1243b30a7d0ad552c6ee4d1097",... |
from nosuch.midiutil import *
from nosuch.midifile import *
from nosuch.oscutil import *
from nosuch.midiosc import *
from traceback import format_exc
from time import sleep
import sys
time0 = time.time()
def mycallback(ev,outfile):
global time0
tm = time.time()-time0
line = "[%.6f"%tm
for m in ev.oscmsg:
line ... | {
"content_hash": "152a19cc8df72412908ee76e1b0d4235",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 60,
"avg_line_length": 23.35135135135135,
"alnum_prop": 0.6678240740740741,
"repo_name": "nosuchtim/MultiMultiTouchTouch",
"id": "ae5f0c663284eb388385f4effd2580e31e523618",
... |
from OvmCommonModule import *
from OVSSiteRMServer import get_master_ip, register_server
from OVSCommons import *
from OVSXMonitor import xen_get_xm_info
from OVSXSysInfo import get_agent_version
from OVSSiteRMServer import get_srv_agent_status
from OVSXMonitor import sys_perf_info
from OVSDB import db_get_vm
from OvmS... | {
"content_hash": "e68181413b3cf0c088bbe04ce5601981",
"timestamp": "",
"source": "github",
"line_count": 290,
"max_line_length": 176,
"avg_line_length": 44.5,
"alnum_prop": 0.578767919411081,
"repo_name": "cinderella/incubator-cloudstack",
"id": "3c61500630d7aef191c5cc95d41a5be784740748",
"size": "1... |
from horizon import views
class IndexView(views.APIView):
# A very simple class-based view...
template_name = 'monitor/regulation/index.html'
def get_data(self, request, context, *args, **kwargs):
# Add data to the context here...
return context
| {
"content_hash": "f30f7281c2a7339d88346105b1eebf59",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 58,
"avg_line_length": 27.7,
"alnum_prop": 0.6678700361010831,
"repo_name": "zouyapeng/horizon_change",
"id": "d7b11a100ae9d260617d3bf716ae9b58eaff9c2f",
"size": "277",
"... |
from django.apps import AppConfig
class RentalsConfig(AppConfig):
name = 'rentals'
| {
"content_hash": "5c5d330e9abc2e6ee514130c9c40fbda",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 33,
"avg_line_length": 17.8,
"alnum_prop": 0.7528089887640449,
"repo_name": "s-take/myequipment",
"id": "282370175c336a7f49c4791edf522754bf4d7718",
"size": "89",
"binary":... |
from __future__ import print_function
import sys
import os
import tempfile
import time
import multiprocessing as mp
import unittest
import random
import mxnet as mx
import numpy as np
import unittest
import math
from nose.tools import assert_raises
from mxnet.test_utils import check_consistency, set_default_context, as... | {
"content_hash": "8d0a62bc1c4badf73aeb8fdb2f1934b6",
"timestamp": "",
"source": "github",
"line_count": 397,
"max_line_length": 162,
"avg_line_length": 40.72544080604534,
"alnum_prop": 0.6147946561108362,
"repo_name": "ptrendx/mxnet",
"id": "54bfcee4734778f68ecb6cc9c2da8730536ca55b",
"size": "16954... |
from copy import deepcopy
from typing import Any, Awaitable, TYPE_CHECKING
from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.mgmt.core import AsyncARMPipelineClient
from .. import models
from ..._serialization import Deserializer, Serializer
from ._configuration import ComputeManagementClientConfi... | {
"content_hash": "ab72e1713c9107617323832d1ec368d9",
"timestamp": "",
"source": "github",
"line_count": 248,
"max_line_length": 119,
"avg_line_length": 54.806451612903224,
"alnum_prop": 0.7496321365509123,
"repo_name": "Azure/azure-sdk-for-python",
"id": "5aa07c3b3d0f924f67f85db0f397fea51a084e0b",
... |
"""Custom application specific yamls tags are supported to provide
enhancements when reading yaml configuration.
These allow inclusion of arbitrary files as a method of having blocks of data
managed separately to the yaml job configurations. A specific usage of this is
inlining scripts contained in separate files, alt... | {
"content_hash": "1a60f6750848f0458f34bb4377d41328",
"timestamp": "",
"source": "github",
"line_count": 143,
"max_line_length": 78,
"avg_line_length": 35.83916083916084,
"alnum_prop": 0.6394146341463415,
"repo_name": "varunarya10/jenkins-job-builder",
"id": "27df904aaf52853984f5cd5cb47bc0a9a8ff09ca",... |
#!/usr/bin/python
# -*- coding: utf-8; -*-
#
# Copyright (C) 2011 Google Inc. All rights reserved.
# Copyright (C) 2009 Torch Mobile Inc.
# Copyright (C) 2009 Apple Inc. All rights reserved.
# Copyright (C) 2010 Chris Jerdonek (cjerdonek@webkit.org)
#
# Redistribution and use in source and binary forms, with or without... | {
"content_hash": "b7043098282316debf0296416a378c7c",
"timestamp": "",
"source": "github",
"line_count": 4866,
"max_line_length": 170,
"avg_line_length": 45.636251541307026,
"alnum_prop": 0.5141264308809093,
"repo_name": "leighpauls/k2cro4",
"id": "6de7df61979de989b04d6d9884fc19f104a34079",
"size": ... |
"""Converting code to AST.
Adapted from Tangent.
"""
import ast
import inspect
import linecache
import re
import sys
import textwrap
import tokenize
import astunparse
import gast
import six
from tensorflow.python.autograph.pyct import errors
from tensorflow.python.autograph.pyct import inspect_utils
from tensorflow... | {
"content_hash": "6af9c257c8f887f7f28231719618ec48",
"timestamp": "",
"source": "github",
"line_count": 382,
"max_line_length": 81,
"avg_line_length": 32.824607329842934,
"alnum_prop": 0.6826700693835234,
"repo_name": "Intel-Corporation/tensorflow",
"id": "8e65084e1bbea62c50f52f5eea4885fb2d88c483",
... |
import binascii
import hashlib
import os
import sys
from ecdsa import SigningKey, VerifyingKey, curves
from ecdsa import ecdsa
from ecdsa import util as ecdsautil
DEFAULT_KEYTYPE = curves.NIST192p
def get_keys_folder(datafolder):
"""
:param datafolder:
:return:
"""
return os.path.join(datafolder,... | {
"content_hash": "dfd3bd9583fea59cdbe96d2942f5bc23",
"timestamp": "",
"source": "github",
"line_count": 160,
"max_line_length": 99,
"avg_line_length": 21.9,
"alnum_prop": 0.636986301369863,
"repo_name": "inorton/NULLTeamPlugin",
"id": "04533e7da07212f6edfcc8bf7a0aa3636452a510",
"size": "3504",
"b... |
from tests.beeswax.impala_beeswax import ImpalaBeeswaxClient, QueryResult
from thrift.transport.TSocket import TSocket
from thrift.protocol import TBinaryProtocol
from thrift.transport.TTransport import TBufferedTransport, TTransportException
from getpass import getuser
import abc
import logging
import os
LOG = loggi... | {
"content_hash": "0bea16ab075b58d81cc686cd56eac834",
"timestamp": "",
"source": "github",
"line_count": 185,
"max_line_length": 89,
"avg_line_length": 35.178378378378376,
"alnum_prop": 0.7034419176398279,
"repo_name": "rampage644/impala-cut",
"id": "bc6d17d7f36ea5ddb22fb2dfa0b1b8c585bec1b6",
"size"... |
import RPi.GPIO as GPIO
from time import sleep
class Shifter:
"""Set pins for data, clock and latch; chain length and board mode respectively"""
def __init__(self, dataPin, clockPin, latchPin, chain = 1,
boardMode = GPIO.BOARD):
self.DATA = dataPin
self.CLOCK = clockPin
self.... | {
"content_hash": "a290ae1ddb4514ca94aa5a545fc104ba",
"timestamp": "",
"source": "github",
"line_count": 54,
"max_line_length": 86,
"avg_line_length": 32.2962962962963,
"alnum_prop": 0.5997706422018348,
"repo_name": "kneitinger/RPiShift",
"id": "56cf85389675db0e80b94afe9136c5c064e82dcf",
"size": "19... |
"""Scoring functions relating to the ground station v2."""
from makani.avionics.common import pack_avionics_messages
from makani.lib.python.batch_sim import scoring_functions
import numpy as np
from scipy.signal import periodogram
import scoring_functions_util as scoring_util
def diff_wrap_angle(n_revs, angle):
""... | {
"content_hash": "732932c44b74fbd4cf32f62cab6bb1e1",
"timestamp": "",
"source": "github",
"line_count": 296,
"max_line_length": 80,
"avg_line_length": 37.49662162162162,
"alnum_prop": 0.6511397423191279,
"repo_name": "google/makani",
"id": "cf808477e87609c582b1f72130a4902470989e8d",
"size": "11688"... |
from ..common import SummaryBase
class CGPointSyntheticProvider(SummaryBase.SummaryBaseSyntheticProvider):
"""
Class representing CGPoint structure.
"""
# struct CGPoint {
# CGFloat x;
# CGFloat y;
# };
# typedef struct CGPoint CGPoint;
def __init__(self, value_obj, internal_di... | {
"content_hash": "64cdcdebb27e943f1dd10dd1c190b632",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 107,
"avg_line_length": 36.64705882352941,
"alnum_prop": 0.6869983948635634,
"repo_name": "bartoszj/Mallet",
"id": "9339fc86c71e581e7b2a26a739558fa5d55c7469",
"size": "1788... |
from __future__ import absolute_import
import os
import random
import sys
import time
import traceback
import types
from collections import defaultdict
from copy import deepcopy
from shutil import move
from tempfile import mkstemp
from django.conf import settings
from django.core.cache import cache
import six
try:
... | {
"content_hash": "81ebe3caf227fb2305083e8039a493c5",
"timestamp": "",
"source": "github",
"line_count": 540,
"max_line_length": 106,
"avg_line_length": 35.757407407407406,
"alnum_prop": 0.5638303381842664,
"repo_name": "criteo-forks/graphite-web",
"id": "71232e300d77f62a97fa1ddfed78c30b66926c61",
"... |
from altair.vega import SCHEMA_VERSION, SCHEMA_URL
def test_schema_version():
assert SCHEMA_VERSION in SCHEMA_URL
| {
"content_hash": "de651459578826df94bf298a94686c60",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 50,
"avg_line_length": 24,
"alnum_prop": 0.7666666666666667,
"repo_name": "altair-viz/altair",
"id": "c569b86b758989b550fa3993653fe653b9709630",
"size": "120",
"binary": f... |
"""Test logic for setting nMinimumChainWork on command line.
Nodes don't consider themselves out of "initial block download" until
their active chain has more work than nMinimumChainWork.
Nodes don't download blocks from a peer unless the peer's best known block
has more work than nMinimumChainWork.
While in initial... | {
"content_hash": "563445b67b072bcb69b4da4cc495620d",
"timestamp": "",
"source": "github",
"line_count": 97,
"max_line_length": 100,
"avg_line_length": 42.7319587628866,
"alnum_prop": 0.6463208685162847,
"repo_name": "cculianu/bitcoin-abc",
"id": "c3b46513274a06b98a0ffbff85e2147a607f095f",
"size": "... |
""" Test for the pillow example """
import os
import multiprocessing
import shutil
# Provide access to the helper scripts
def modify_path():
scripts_dir = os.path.dirname(__file__)
while not 'Scripts' in os.listdir(scripts_dir):
scripts_dir = os.path.abspath(os.path.join(scripts_dir, '..'))
scrip... | {
"content_hash": "2d69e81fd2d46d5db826def3ef1fa314",
"timestamp": "",
"source": "github",
"line_count": 80,
"max_line_length": 71,
"avg_line_length": 30.8875,
"alnum_prop": 0.5742614326183731,
"repo_name": "mkraska/CalculiX-Examples",
"id": "68d9c4fcde4b7c77219908891530d350af1fb42e",
"size": "2490"... |
"""
Sensor for displaying the number of result on Shodan.io.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/sensor.shodan/
"""
import logging
from datetime import timedelta
import voluptuous as vol
import homeassistant.helpers.config_validation as cv
f... | {
"content_hash": "fb90269166edff8da699cb0d976e2b54",
"timestamp": "",
"source": "github",
"line_count": 110,
"max_line_length": 74,
"avg_line_length": 26.318181818181817,
"alnum_prop": 0.6490500863557859,
"repo_name": "ct-23/home-assistant",
"id": "c95d975ec4777bcf156cf9082039c3790dcf11de",
"size":... |
import os
import sys
import yaml
import yoci_config
import logging
import logging.config
DEFAULT_BASE_LOGGING_LEVEL = logging.INFO
DEFAULT_VERBOSE_LOGGING_LEVEL = logging.DEBUG
DEFAULT_CONFIG_FILE = 'config.yml'
def init_logger(base_level=DEFAULT_BASE_LOGGING_LEVEL,
verbose_level=DEFAULT_VERBOSE_LOG... | {
"content_hash": "6e0fa872ac8e93198f1882ff2c0b1be5",
"timestamp": "",
"source": "github",
"line_count": 86,
"max_line_length": 79,
"avg_line_length": 35.91860465116279,
"alnum_prop": 0.6448688896082875,
"repo_name": "cloudify-cosmo/yo-ci",
"id": "e6a4f35d2317ca7856b7aa481392f280a6d88b56",
"size": "... |
import os
import sys
# Edit this if necessary or override the variable in your environment.
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'verese.settings')
try:
# For local development in a virtualenv:
from funfactory import manage
except ImportError:
# Production:
# Add a temporary path so that we... | {
"content_hash": "765c5e5afa3a55c817b61c330dd11ff6",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 71,
"avg_line_length": 27.923076923076923,
"alnum_prop": 0.6707988980716253,
"repo_name": "vereseproject/verese",
"id": "47ba94219f064a5fdb8a8f0efb3a46578d946bf0",
"size": ... |
from django import forms
from django.utils.translation import ugettext as _
from .models import Run
class RunInputForm(forms.ModelForm):
distance = forms.FloatField(label=_("Distance (km)"),
widget=forms.TextInput(),
localize=True)
start_date = ... | {
"content_hash": "7e04b437c7bd17db2a58ecbd48219264",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 79,
"avg_line_length": 36.64102564102564,
"alnum_prop": 0.47725682295311406,
"repo_name": "Socialsquare/RunningCause",
"id": "3626ae593f49584cb12a3f150732cb7739cb4813",
"si... |
"""
Support for tracking the proximity of a device.
Component to monitor the proximity of devices to a particular zone and the
direction of travel.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/proximity/
"""
import logging
import voluptuous as vol
... | {
"content_hash": "da4af3768c7b292bef63808b39ee9484",
"timestamp": "",
"source": "github",
"line_count": 258,
"max_line_length": 79,
"avg_line_length": 36.554263565891475,
"alnum_prop": 0.612342275474499,
"repo_name": "robjohnson189/home-assistant",
"id": "73e72149b3714f8e458a9d3a7a815a7c3a462600",
... |
import pytest
from . import db
from .db import database
from tagtrain import data
def test_unknown_user(database):
with pytest.raises(data.Group.DoesNotExist):
data.by_owner.blacklist_user('non-existent', 'blockee', 'permalink', db.GROUP_NAME)
def test_unknown_group(database):
with pytest.raises(da... | {
"content_hash": "09214a567f631109550f045f77e80141",
"timestamp": "",
"source": "github",
"line_count": 102,
"max_line_length": 105,
"avg_line_length": 30.61764705882353,
"alnum_prop": 0.6871597822606468,
"repo_name": "c17r/TagTrain",
"id": "458a53d32ff0de663a7ae49361d01363d9917848",
"size": "3123"... |
import json
"""Python class to hold message data"""
class Message(object):
"""
Holder for message attributes used by python IoAdapter send/receive.
Interface is like proton.Message, but we don't use proton.Message here because
creating a proton.Message has side-effects on the proton engine.
@iv... | {
"content_hash": "48211dddbef901532edc1f7f495f546a",
"timestamp": "",
"source": "github",
"line_count": 46,
"max_line_length": 93,
"avg_line_length": 31.456521739130434,
"alnum_prop": 0.6095369730476848,
"repo_name": "ErnieAllen/qpid-dispatch",
"id": "3301a69fc80733cb1ad2b4070ea7f7f0cd2302e0",
"siz... |
from setuptools import setup, find_packages
setup(
name='zseqfile',
description="Library to simplify sequential access to compressed files",
author="Wouter Bolsterlee",
author_email="uws@xs4all.nl",
url="https://github.com/wbolster/zseqfile",
version='0.1',
packages=find_packages(),
lic... | {
"content_hash": "4b2eef080ebfec3af1c28983371b8f02",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 76,
"avg_line_length": 27.733333333333334,
"alnum_prop": 0.6658653846153846,
"repo_name": "wbolster/zseqfile",
"id": "265fe54a9cf24b8454f913a00b9fedbbe256b723",
"size": "41... |
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
connection = db._get_connection()
cursor = connection.cursor()
try:
cursor.execute('select site_description from... | {
"content_hash": "6bd6e79bf64de5281f0e3f57a55de3a8",
"timestamp": "",
"source": "github",
"line_count": 358,
"max_line_length": 208,
"avg_line_length": 87.12569832402235,
"alnum_prop": 0.5471450097784617,
"repo_name": "praekelt/jmbo-foundry",
"id": "53a672786a28894ea96317935e5e508b62afe1ee",
"size"... |
"""
:module: watchdog.observers.api
:synopsis: Classes useful to observer implementers.
:author: yesudeep@google.com (Yesudeep Mangalapilly)
Immutables
----------
.. autoclass:: ObservedWatch
:members:
:show-inheritance:
Collections
-----------
.. autoclass:: EventQueue
:members:
:show-inheritance:
Clas... | {
"content_hash": "b922badb5fafb6060a6c4933ed7c2367",
"timestamp": "",
"source": "github",
"line_count": 407,
"max_line_length": 79,
"avg_line_length": 27.479115479115478,
"alnum_prop": 0.6596924177396281,
"repo_name": "austinwagner/sublime-sourcepawn",
"id": "1de80e264a30aa37f03c56e079db71bbd359fd6a"... |
from catstalk.cli import parser
def test_init():
# With default path
args = parser.parse_args("init".split())
assert args.command[0] == "init"
# With specific path
args = parser.parse_args("init test".split())
assert args.command[0] == "init"
assert args.command[1] == "test"
def test_bui... | {
"content_hash": "5a1d19f4a2a0d121d74c0bc745f82732",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 50,
"avg_line_length": 27.857142857142858,
"alnum_prop": 0.629059829059829,
"repo_name": "helloqiu/Catstalk",
"id": "ecf6186c653ff96f3b6017fa21c76159bb7ddf30",
"size": "610... |
"""
sphinx.util.jsdump
~~~~~~~~~~~~~~~~~~
This module implements a simple JavaScript serializer.
Uses the basestring encode function from simplejson by Bob Ippolito.
:copyright: Copyright 2007-2014 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import re
from sp... | {
"content_hash": "9bcd0013f4ecee1b06d610e9a3cbb1a5",
"timestamp": "",
"source": "github",
"line_count": 194,
"max_line_length": 72,
"avg_line_length": 28.695876288659793,
"alnum_prop": 0.44817675588288125,
"repo_name": "kiwicopple/MyMDb",
"id": "85845a7225d226bcce521654fe532adccd4f796e",
"size": "5... |
import logging
from ._collections import RecentlyUsedContainer
from .connectionpool import HTTPConnectionPool, HTTPSConnectionPool
from .connectionpool import get_host, connection_from_url
from .exceptions import HostChangedError
from .request import RequestMethods
__all__ = ['PoolManager', 'ProxyManager', 'proxy_fr... | {
"content_hash": "8e9592a22c19fc2fc062518572c61b5d",
"timestamp": "",
"source": "github",
"line_count": 127,
"max_line_length": 80,
"avg_line_length": 30.661417322834644,
"alnum_prop": 0.6420133538777607,
"repo_name": "mikewesner-wf/glasshouse",
"id": "482ee4ad9fbdaf2f0ef13af29ef7c819e35cfa34",
"si... |
"""Tests for execution_util.py."""
from __future__ import absolute_import
from __future__ import print_function
from __future__ import division
from __future__ import unicode_literals
import mock
import subprocess
from gslib.tests import testcase
from gslib.utils import execution_util
class TestExecutionUtil(testc... | {
"content_hash": "f8ce141d8c203a459dc461de624f78a1",
"timestamp": "",
"source": "github",
"line_count": 75,
"max_line_length": 76,
"avg_line_length": 37.89333333333333,
"alnum_prop": 0.6586910626319493,
"repo_name": "catapult-project/catapult",
"id": "868c6b6c0e477c5de5b6992baa3ab363f02d7f97",
"siz... |
'''
Created on 2013-10-17
@author: nicolas
'''
import MessageField
import Exception
class Field(MessageField.Field):
'''
This class is part of an ensemble of classes
that can be used as an utility for packing and unpacking A429 messages.
LabelField is more specifically dedicated to managing messages ... | {
"content_hash": "334df6015852cb1ad3294258dd4965c6",
"timestamp": "",
"source": "github",
"line_count": 116,
"max_line_length": 109,
"avg_line_length": 35.33620689655172,
"alnum_prop": 0.49597462795803854,
"repo_name": "superliujian/Py429",
"id": "58b79f4d4639f5ac10267cefbce3b592877d96cd",
"size": ... |
import unittest
from django.core.exceptions import FieldDoesNotExist
from django.db import connection, migrations, models, transaction
from django.db.migrations.migration import Migration
from django.db.migrations.operations import CreateModel
from django.db.migrations.state import ModelState, ProjectState
from django... | {
"content_hash": "7d2c9d18e08b23ae6c012c6d35430d86",
"timestamp": "",
"source": "github",
"line_count": 2574,
"max_line_length": 119,
"avg_line_length": 48.85081585081585,
"alnum_prop": 0.617820616818565,
"repo_name": "reinout/django",
"id": "fb429e19cf3d31f4b3ecfc5c5dbcf3416145b585",
"size": "1257... |
DEBUG = True
SECRET_KEY = 'lalalalalalala'
SENTRY_DSN = ""
SQLALCHEMY_ECHO = DEBUG
SQLALCHEMY_DATABASE_URI = "sqlite:///database.db"
CACHE_TYPE = "simple"
CACHE_KEY_PREFIX = "{{cookiecutter.app_name}}::"
DEBUG_TB_ENABLED = DEBUG
PROFILE = False
| {
"content_hash": "d15b2158e9c44ef3eaf21171c348e4a9",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 49,
"avg_line_length": 19.153846153846153,
"alnum_prop": 0.7068273092369478,
"repo_name": "makmanalp/flask-chassis",
"id": "b1f11107f6d0a01aab49029a8f4ee9ff59ac7b3d",
"size... |
import os
import re
import csv
from optparse import OptionParser
def getFeatureFiles(path):
files = []
for dirname, dirnames, filenames in os.walk(path):
for filename in filenames:
if filename[-7:]=='feature':
files.append(os.path.join(dirname, filename))
return files
def makeTagMap(feature_files, path... | {
"content_hash": "5b9e0574278f33e630c319efe0ea7967",
"timestamp": "",
"source": "github",
"line_count": 120,
"max_line_length": 168,
"avg_line_length": 30.55,
"alnum_prop": 0.6636661211129297,
"repo_name": "inbloom/secure-data-service",
"id": "fdb60d948fb0fb425d3afe26b469f9d62d3da75e",
"size": "366... |
import yaml
from yaml import error as yaml_error
from cloudferry import cfglib
from cloudferry import config
from cloudferry.lib.utils import log
class ConfigMixin(object):
def __init__(self, app, app_args, cmd_name=None):
super(ConfigMixin, self).__init__(app, app_args, cmd_name)
self.config = N... | {
"content_hash": "4d38fa67959120f484c253e07791ca6d",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 73,
"avg_line_length": 36.410714285714285,
"alnum_prop": 0.6194212849435998,
"repo_name": "SVilgelm/CloudFerry",
"id": "ef652613f7b25be6a02731638e480d85ce1dc393",
"size": "... |
try:
from django.conf.urls import patterns, include
except ImportError:
from django.conf.urls.defaults import patterns, include
urlpatterns = patterns(
"",
(r"^", include("pinax.boxes.urls")),
)
| {
"content_hash": "dd66f533c37925267b76d3ec367e7d7e",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 59,
"avg_line_length": 21.3,
"alnum_prop": 0.6901408450704225,
"repo_name": "pinax/pinax-boxes",
"id": "47a36ddd14669a14f2756aecd03a7931c63371e5",
"size": "213",
"binary"... |
import torch
from .Module import Module
class MV(Module):
"""Module to perform matrix vector multiplication on two minibatch inputs,
producing a minibatch.
"""
def __init__(self, trans=False):
super(MV, self).__init__()
self.trans = trans
self.gradInput = [torch.Tensor(), ... | {
"content_hash": "b504c442a357b49a6bbfc6f96cde9b42",
"timestamp": "",
"source": "github",
"line_count": 67,
"max_line_length": 119,
"avg_line_length": 35,
"alnum_prop": 0.5343283582089552,
"repo_name": "RPGOne/Skynet",
"id": "ad9ff4619e41c5ac8fcad5479d1ce870232ee92b",
"size": "2345",
"binary": fa... |
"""
Copyright (c) 2015, Nagoya University
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions a... | {
"content_hash": "59f7b5dfbbe4f74cfccc94b451187667",
"timestamp": "",
"source": "github",
"line_count": 3446,
"max_line_length": 122,
"avg_line_length": 29.3476494486361,
"alnum_prop": 0.6394217458371237,
"repo_name": "suzlab/Autoware",
"id": "31d55c940f5ec064b4f1732cc004b4c2a3d32d75",
"size": "101... |
import math
from base import Layout
from .. import utils, manager
ROWCOL = 1 # do rows at a time left to right top down
COLROW = 2 # do cols top to bottom, left to right
GOLDEN_RATIO = 1.618
class GridInfo(object):
"""
Calculates sizes for grids
>>> gi = GridInfo(.5, 5, 600, 480)
>>> gi.calc()
(... | {
"content_hash": "634eeddb49ed15c3f4eefd37a7bf0b05",
"timestamp": "",
"source": "github",
"line_count": 347,
"max_line_length": 104,
"avg_line_length": 32.21325648414986,
"alnum_prop": 0.4990159241366971,
"repo_name": "andrelaszlo/qtile",
"id": "1d234bd926cd3350d0e82f20aac582d1df1ae2a3",
"size": "1... |
import json
import flask
from google.appengine.api import urlfetch
import github
import auth
import config
import model
import util
import task
from main import app
@app.route('/<username>/<path:repo>')
@app.route('/<username>')
def gh_account(username, repo=None):
username_ = username.lower()
account_db = mod... | {
"content_hash": "bce1fb7deb8e14d007ee94f9cd7227f7",
"timestamp": "",
"source": "github",
"line_count": 124,
"max_line_length": 151,
"avg_line_length": 29.379032258064516,
"alnum_prop": 0.6390337633818282,
"repo_name": "lipis/github-stats",
"id": "3a9ffd94ee9608ed5f0b646bccb70bb1ba9795b1",
"size": ... |
from __future__ import absolute_import, division, generators, nested_scopes, print_function, unicode_literals, with_statement
import locale
import os
import string
from django.conf import settings
from django.utils.encoding import smart_text
from django.utils.translation import get_language, ugettext_lazy as _
try:
... | {
"content_hash": "e65904f5dfb81c1b6369274cc683c013",
"timestamp": "",
"source": "github",
"line_count": 87,
"max_line_length": 125,
"avg_line_length": 31.28735632183908,
"alnum_prop": 0.6204996326230713,
"repo_name": "misli/cmsplugin-articles",
"id": "1b310a24a6b266f9ecf1d27e4e2e1d368fb5f271",
"siz... |
from django import forms
from django.contrib.auth.forms import AuthenticationForm, PasswordChangeForm
from django.utils.translation import ugettext_lazy as _
class AdminAuthenticationForm(AuthenticationForm):
"""
A custom authentication form used in the admin app.
"""
error_messages = {
'inval... | {
"content_hash": "7e97671b50a52e4b6a1d1741416593ad",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 77,
"avg_line_length": 33.392857142857146,
"alnum_prop": 0.6524064171122995,
"repo_name": "auready/django",
"id": "7c3d196012d182b07c765d0b81f352c14c50327a",
"size": "935",... |
import pygame
import widget.button
import screens.sound as sound
class ExitScreen:
def __init__(self, canvas, prev=None):
self.canvas = canvas
self.image = pygame.image.load('resources/screens/' + canvas.language + '/termination.jpg')
self.close_app = widget.button.Button((340, 350), (84, 8... | {
"content_hash": "9b8afb0bbdfaddccbc3cad298ae2ffd4",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 99,
"avg_line_length": 34.78378378378378,
"alnum_prop": 0.6449106449106449,
"repo_name": "sinoz/boat-wars",
"id": "60f7ecd09815b32df25b39ff925c25f303221fdf",
"size": "1287"... |
"""blogular URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.8/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-ba... | {
"content_hash": "45dd7e64afb27e1f760d0a2ea8412ca7",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 77,
"avg_line_length": 42.2962962962963,
"alnum_prop": 0.6987740805604203,
"repo_name": "amaozhao/blogular",
"id": "bb2375203d8036428e2ab66107ad99ea3eae84fd",
"size": "1142... |
from setuptools import setup, find_packages
from factory_alchemist import __version__
setup(name='Factory-Alchemist',
version=__version__,
packages=find_packages(exclude=['*test*']),
url='https://github.com/eduardo-matos/Factory-Alchemist',
author='Eduardo Matos',
keywords='sql sqlalchem... | {
"content_hash": "a60698307371afdb9b32e66ec7c65188",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 63,
"avg_line_length": 33.9,
"alnum_prop": 0.6991150442477876,
"repo_name": "eduardo-matos/Factory-Alchemist",
"id": "93501e74f8e83b46aa5ec030e554775852e2c1e5",
"size": "33... |
from collections import OrderedDict
import copy
import itertools
import regex as re
import random
def reverse_enumerate(iterable):
'''
Enumerate through an iterable in reverse, reporting the index consistent
with the original iterable.
'''
return itertools.izip(reversed(xrange(len(iter... | {
"content_hash": "cbe230dd779e5b9f3f0094e5b05df48f",
"timestamp": "",
"source": "github",
"line_count": 202,
"max_line_length": 78,
"avg_line_length": 27.836633663366335,
"alnum_prop": 0.45296105281878,
"repo_name": "NIEHS/muver",
"id": "4bd336bb32d987a63ea82b2b27122b6ce7159945",
"size": "5623",
... |
from distutils.core import setup
import os, sys
bbdir = os.path.join(sys.prefix, 'share', 'bitbake')
docdir = os.path.join(sys.prefix, 'share', 'doc')
# bbdir = os.path.join('bitbake')
# docdir = os.path.join('doc')
def clean_doc(type):
origpath = os.path.abspath(os.curdir)
os.chdir(os.path.join(origpath, 'do... | {
"content_hash": "832b36798c3513cb015ce752ccdc3d7d",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 527,
"avg_line_length": 48.22,
"alnum_prop": 0.6366652841144753,
"repo_name": "KDAB/OpenEmbedded-Archos",
"id": "0433af32b3fdf4446dccc3f73bb26fc4f27a3bcf",
"size": "3203",
... |
az.plot_posterior(data, var_names=['mu', '^the'], filter_vars="regex", rope=(-1, 1))
| {
"content_hash": "6983e4d3f3657a82e2609e41d0ba44c0",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 84,
"avg_line_length": 85,
"alnum_prop": 0.6235294117647059,
"repo_name": "mcmcplotlib/mcmcplotlib",
"id": "4a58d4209f7202869e3de52975128fbefd2fa93a",
"size": "85",
"binar... |
import tornado.httpserver
import tornado.gen
import tornado.ioloop
import tornado.web
import os
_CHUNK_OF_128_BYTES = '000000000000000,111111111111111,222222222222222,333333333333333,444444444444444,' \
'555555555555555,666666666666666,777777777777777\n'
class FakeCsvHandler(tornado.web.Reques... | {
"content_hash": "f31e5f97b8e42894d166b79ef84e387c",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 112,
"avg_line_length": 35.183673469387756,
"alnum_prop": 0.6571925754060325,
"repo_name": "butla/fake_csv_server",
"id": "5c6fb9b69a2f4f67c0e90bdced8a7e20c817fbf7",
"size"... |
import os
import shutil
import wx
from .. import context
from ..action import ActionInfo
from ..pluginapi import Plugin
from ..publish import PUBLISHER, RideExecuteSpecXmlImport
from .xmlreaders import get_name_from_xml
class SpecImporterPlugin(Plugin):
HEADER = 'Import Library Spec XML'
def enable(self):
... | {
"content_hash": "40da73573455b98027760eec966e9123",
"timestamp": "",
"source": "github",
"line_count": 60,
"max_line_length": 145,
"avg_line_length": 34.11666666666667,
"alnum_prop": 0.6013678553981436,
"repo_name": "robotframework/RIDE",
"id": "f1b9688f1cc126b6de1f083f63f3f1dc76fd38ab",
"size": "... |
class WordDictionary(object):
def __init__(self):
"""
initialize your data structure here.
"""
self.trie = {}
def addWord(self, word):
"""
Adds a word into the data structure.
:type word: str
:rtype: void
"""
trie=self.trie
... | {
"content_hash": "d961399534fa541e31cf8033dda7e44c",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 69,
"avg_line_length": 27.80851063829787,
"alnum_prop": 0.486610558530987,
"repo_name": "saai/codingbitch",
"id": "f7a9b688f1a9ab7a54f71599354f3c9ca156d3ba",
"size": "1307"... |
""" Personality formatter """
from aquilon.aqdb.model import Personality
from aquilon.worker.formats.formatters import ObjectFormatter
from aquilon.worker.formats.list import ListFormatter
from aquilon.worker.templates.base import TEMPLATE_EXTENSION
class ThresholdedPersonality(object):
def __init__(self, dbpers... | {
"content_hash": "1d27fac30fc1e3f26c732fd490ee4784",
"timestamp": "",
"source": "github",
"line_count": 174,
"max_line_length": 101,
"avg_line_length": 41.06896551724138,
"alnum_prop": 0.6137699412258606,
"repo_name": "stdweird/aquilon",
"id": "95b59501c5c81f924a6444e0685742eea9ac74e2",
"size": "78... |
"""
This file is part of the TheLMA (THe Laboratory Management Application) project.
See LICENSE.txt for licensing, CONTRIBUTORS.txt for contributor information.
Sample molecule mapper.
"""
from sqlalchemy.orm import relationship
from everest.repositories.rdb.utils import mapper
from thelma.entities.sample import Mol... | {
"content_hash": "37fd02c6ea2464be339e1a3703f67ad7",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 80,
"avg_line_length": 32.0625,
"alnum_prop": 0.6393762183235867,
"repo_name": "helixyte/TheLMA",
"id": "739f9dc92a299f791ae34ac060485864aba3889f",
"size": "1026",
"binar... |
'''Substitution Matrix data structures and constants'''
from .substitution_matrix import SubstitutionMatrix
from .dna import DNA
from .dna_simple import DNA_SIMPLE
from .blosum62 import BLOSUM62
| {
"content_hash": "b840bc1b4865ff49680cf0b4b216fe0e",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 55,
"avg_line_length": 39,
"alnum_prop": 0.8205128205128205,
"repo_name": "klavinslab/coral",
"id": "a0552e97a0f4ed79eba8664cd9a0b1138c076070",
"size": "195",
"binary": fa... |
from oauthlib.oauth1.rfc5849.utils import *
from tests.unittest import TestCase
class UtilsTests(TestCase):
sample_params_list = [
("notoauth", "shouldnotbehere"),
("oauth_consumer_key", "9djdj82h48djs9d2"),
("oauth_token", "kkk9d7dh3k39sjv7"),
("notoautheither", ... | {
"content_hash": "ba40ae485c1b6ccd8e41705828e5cff8",
"timestamp": "",
"source": "github",
"line_count": 137,
"max_line_length": 94,
"avg_line_length": 38.802919708029194,
"alnum_prop": 0.626410835214447,
"repo_name": "idan/oauthlib",
"id": "013c71a910da91b623c5addfa2f3e61a4a6293c0",
"size": "5340",... |
from subprocess import Popen, PIPE
less = Popen("less", stdin=PIPE)
less.communicate(bytes("Text I want to send to less", encoding='utf-8'))
| {
"content_hash": "68145399a9803b39048d0adca460e066",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 72,
"avg_line_length": 28.6,
"alnum_prop": 0.7272727272727273,
"repo_name": "boarpig/tidbits",
"id": "eb772be7970091fc2fdf8636208c41982da7f8cf",
"size": "162",
"binary": f... |
"""(c) All rights reserved. ECOLE POLYTECHNIQUE FEDERALE DE LAUSANNE, Switzerland, VPSI, 2017"""
import os
from django.core.exceptions import ImproperlyConfigured
from unipath import Path
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.10/howto/deployment/check... | {
"content_hash": "e07887a10dd6d6b4064ac1a5b75e9788",
"timestamp": "",
"source": "github",
"line_count": 140,
"max_line_length": 108,
"avg_line_length": 27.32857142857143,
"alnum_prop": 0.6738107684265552,
"repo_name": "epfl-idevelop/amm",
"id": "0eb6e1479821846831ffe4ab41ad9043011e48db",
"size": "3... |
"""Blowfish symmetric cipher
Blowfish_ is a symmetric block cipher designed by Bruce Schneier.
It has a fixed data block size of 8 bytes and its keys can vary in length
from 32 to 448 bits (4 to 56 bytes).
Blowfish is deemed secure and it is fast. However, its keys should be chosen
to be big enough to withstand a br... | {
"content_hash": "f3fe67fb07a93b92d1836468f6d11682",
"timestamp": "",
"source": "github",
"line_count": 99,
"max_line_length": 86,
"avg_line_length": 33.80808080808081,
"alnum_prop": 0.6495368987152674,
"repo_name": "nmercier/linux-cross-gcc",
"id": "2ce78e9d4b317d5093d64521df4f445907bf4918",
"size... |
"""The tests for the rest command platform."""
import asyncio
import aiohttp
import homeassistant.components.rest_command as rc
from homeassistant.setup import setup_component
from tests.common import (
get_test_home_assistant, assert_setup_component)
class TestRestCommandSetup(object):
"""Test the rest co... | {
"content_hash": "11d1988301abdafed0d443bb4688b9b7",
"timestamp": "",
"source": "github",
"line_count": 223,
"max_line_length": 71,
"avg_line_length": 32.63677130044843,
"alnum_prop": 0.5846386369881835,
"repo_name": "morphis/home-assistant",
"id": "a62bddc4a0fa23c884380e100d88fd387483dec0",
"size"... |
from google.cloud import discoveryengine_v1beta
async def sample_import_documents():
# Create a client
client = discoveryengine_v1beta.DocumentServiceAsyncClient()
# Initialize request argument(s)
inline_source = discoveryengine_v1beta.InlineSource()
inline_source.documents.schema_id = "schema_id... | {
"content_hash": "4e7476f47d50a235d057fa0f0f8fe3da",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 78,
"avg_line_length": 28.296296296296298,
"alnum_prop": 0.731675392670157,
"repo_name": "googleapis/google-cloud-python",
"id": "1ab3aa1b0e94fb179f5b4b9fc20a7a971831c2d2",
... |
import sqlite3 as lite
from contextlib import contextmanager
# Database operations
#####################
# TODO use this to implement a streaming API to handle BIG data
def fetch(cursor, batch_size=1e3):
'''An iterator that uses fetchmany to keep memory usage down'''
while True:
records = cursor.fetchmany(int... | {
"content_hash": "84db646e1103c0a86f3bb8f413a9d358",
"timestamp": "",
"source": "github",
"line_count": 75,
"max_line_length": 88,
"avg_line_length": 32.16,
"alnum_prop": 0.650497512437811,
"repo_name": "pcattori/freetxt",
"id": "46c02360387b6db4b190150e112c4293ade36f05",
"size": "2412",
"binary"... |
"""
$description Japanese live TV streaming website with multiple channels including news, sports, entertainment and anime.
$url abema.tv
$type live, vod
$region Japan
"""
import hashlib
import hmac
import logging
import re
import struct
import time
import uuid
from base64 import urlsafe_b64encode
from binascii import... | {
"content_hash": "208d7e7c11412b8c5a37e5c5f7f9c8d6",
"timestamp": "",
"source": "github",
"line_count": 262,
"max_line_length": 119,
"avg_line_length": 37.87404580152672,
"alnum_prop": 0.5784540965433841,
"repo_name": "streamlink/streamlink",
"id": "6881b44fd2180f2e7feeb96f889c83a83a650a83",
"size"... |
from __future__ import annotations
import pickle
import pytest
pytestmark = pytest.mark.gpu
from distributed.protocol import deserialize, serialize
cuda = pytest.importorskip("numba.cuda")
np = pytest.importorskip("numpy")
@pytest.mark.parametrize("shape", [(0,), (5,), (4, 6), (10, 11), (2, 3, 5)])
@pytest.mark.... | {
"content_hash": "72619061e26c51ef5e9b41ab34c37f36",
"timestamp": "",
"source": "github",
"line_count": 59,
"max_line_length": 86,
"avg_line_length": 32.50847457627118,
"alnum_prop": 0.6444212721584984,
"repo_name": "dask/distributed",
"id": "b1b05d2e0bee1f37db1ea23dc52c2a7e01ed38c1",
"size": "1918... |
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import Select
from selenium.common.exceptions import NoSuchElementException
from selenium.common.exceptions import NoAlertPresentException
import unittest, time, ... | {
"content_hash": "888eb5e52284912b8821f1abbbf3b43b",
"timestamp": "",
"source": "github",
"line_count": 59,
"max_line_length": 94,
"avg_line_length": 32.932203389830505,
"alnum_prop": 0.6289243437982501,
"repo_name": "Slonik20007/python_training",
"id": "efed277562ab0a2968899dfbc3be89594ec331d4",
"... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.