text stringlengths 4 1.02M | meta dict |
|---|---|
"""
byceps.services.brand.service
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:Copyright: 2014-2022 Jochen Kupperschmidt
:License: Revised BSD (see `LICENSE` file for details)
"""
from __future__ import annotations
from typing import Optional
from ...database import db
from ...typing import BrandID
from .dbmodels.brand import Br... | {
"content_hash": "2698e3ada6dbbb542937c0274bb373ba",
"timestamp": "",
"source": "github",
"line_count": 124,
"max_line_length": 76,
"avg_line_length": 23.532258064516128,
"alnum_prop": 0.6288553803975325,
"repo_name": "homeworkprod/byceps",
"id": "21740a1bc08c2d03657e18745bada034e9461c6b",
"size": ... |
"""
isort:skip_file
"""
from django_mysql.models.base import Model # noqa
from django_mysql.models.aggregates import BitAnd, BitOr, BitXor, GroupConcat # noqa
from django_mysql.models.expressions import ListF, SetF # noqa
from django_mysql.models.query import ( # noqa
add_QuerySetMixin,
ApproximateInt,
... | {
"content_hash": "c90e4b07f39e1488edfe85d5466658d6",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 85,
"avg_line_length": 24.357142857142858,
"alnum_prop": 0.7199413489736071,
"repo_name": "arnau126/django-mysql",
"id": "d162b77e508802975fd6c32a97bbd3aa90fc02fb",
"size":... |
from django.http import HttpResponse
def index(request):
return HttpResponse('Ok')
| {
"content_hash": "8b707f2259ce0f84221c00406f85a3b6",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 36,
"avg_line_length": 17.8,
"alnum_prop": 0.7528089887640449,
"repo_name": "igr-santos/tracker",
"id": "940346a4721f3e290a5773d4d0029d4a83f3e585",
"size": "89",
"binary":... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import os
import copy
import six
import requests
import json
import jsonschema
import datapackage_registry
from datapackage_registry.exceptions import DataPackageRegistry... | {
"content_hash": "18ab681ca23235ed2f70149b17063bd9",
"timestamp": "",
"source": "github",
"line_count": 123,
"max_line_length": 77,
"avg_line_length": 33.36585365853659,
"alnum_prop": 0.5869883040935673,
"repo_name": "okfn/datapackage-validate-py",
"id": "6ada4b7aea676d4095a5ed15926c996876e279b2",
... |
"""
This module is largely inspired by django-rest-framework settings.
Settings for the OAuth2 Provider are all namespaced in the OAUTH2_PROVIDER setting.
For example your project's `settings.py` file might look like this:
OAUTH2_PROVIDER = {
'CLIENT_ID_GENERATOR_CLASS':
'oauth2_provider.generators.Client... | {
"content_hash": "39ad38abae9b05a4600355a5fc70085f",
"timestamp": "",
"source": "github",
"line_count": 137,
"max_line_length": 111,
"avg_line_length": 32.8978102189781,
"alnum_prop": 0.671400044375416,
"repo_name": "ramcn/demo3",
"id": "fa7eef1355db378ecec5cd875ac6b426afeeaa94",
"size": "4507",
... |
__author__ = 'luckydonald'
from pytg.receiver import Receiver
from pytg.utils import coroutine
@coroutine
def example_function(receiver):
try:
while True:
msg = (yield)
print('Full dump: {array}'.format(array=str( msg )))
except KeyboardInterrupt:
receiver.stop()
print("Exiting")
if __name__ == '__main_... | {
"content_hash": "cae8c6976006419ad8865ae29565514a",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 140,
"avg_line_length": 32.75,
"alnum_prop": 0.732824427480916,
"repo_name": "kalloc/pytg",
"id": "1ecfb7a81771871527c93c361e1812de1f188670",
"size": "679",
"binary": fal... |
"""The share snapshots api."""
from oslo_log import log
import six
import webob
from webob import exc
from manila.api import common
from manila.api.openstack import wsgi
from manila.api.v1 import share_snapshots
from manila.api.views import share_snapshots as snapshot_views
from manila.common import constants
from ma... | {
"content_hash": "77094c2840b2a56027737507af95b0cf",
"timestamp": "",
"source": "github",
"line_count": 271,
"max_line_length": 79,
"avg_line_length": 38.35793357933579,
"alnum_prop": 0.6096200096200096,
"repo_name": "vponomaryov/manila",
"id": "257469020c0a9a7f1805702655bf182a8c0b82d0",
"size": "1... |
"""
Vanilla product models
"""
from oscar.apps.catalogue.abstract_models import * # noqa
class ProductClass(AbstractProductClass):
pass
class Category(AbstractCategory):
pass
class ProductCategory(AbstractProductCategory):
pass
class Product(AbstractProduct):
pass
class ContributorRole(Abstra... | {
"content_hash": "4755a60e96d909acad2fdbe7c035604e",
"timestamp": "",
"source": "github",
"line_count": 66,
"max_line_length": 59,
"avg_line_length": 14.833333333333334,
"alnum_prop": 0.780388151174668,
"repo_name": "Idematica/django-oscar",
"id": "e5e40f636519bb1223a8967182b4011fc41852c4",
"size":... |
'''
This module provides one useful class: NodeHandler
The NodeHandler class is designed to be subclassed. Each subclass
should support the processing that createpdf.RstToPdf needs to do
on a particular type of node that could appear in a document tree.
When the subclass is defined, it should reference Nod... | {
"content_hash": "7a8d3075e5743f6bfb9d1917754f23ce",
"timestamp": "",
"source": "github",
"line_count": 285,
"max_line_length": 84,
"avg_line_length": 39.47017543859649,
"alnum_prop": 0.6204995999644413,
"repo_name": "ddd332/presto",
"id": "2aaa0526bddd17fa559142017f707bb0839634fc",
"size": "11471"... |
from html.parser import HTMLParser
class MyHTMLParser(HTMLParser):
def handle_starttag(self, tag, attrs):
print ('Start :',tag)
for ele in attrs:
print ('->',ele[0],'>',ele[1])
def handle_endtag(self, tag):
print ('End :',tag)
def handle_st... | {
"content_hash": "3ae6266253365c1590499a045551294a",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 70,
"avg_line_length": 32.8235294117647,
"alnum_prop": 0.525089605734767,
"repo_name": "nifannn/HackerRank",
"id": "dce79df1e2155076549d87e4fb2b0b0e47649565",
"size": "558"... |
import argparse
from barbicanclient import client
IDENTITY = 'https://identity.api.rackspacecloud.com/v2.0'
ENDPOINT = 'https://barbican.api.rackspacecloud.com/v1/'
def connect(username, password, tenant, endpoint):
connection = client.Connection(IDENTITY,
username,
... | {
"content_hash": "0cf8dba83d1b4a843986b3ded9f1064c",
"timestamp": "",
"source": "github",
"line_count": 65,
"max_line_length": 76,
"avg_line_length": 27.046153846153846,
"alnum_prop": 0.5819112627986348,
"repo_name": "wyllys66/python-barbicanclient",
"id": "7aefee8fba4aa891c0ed213411ed3862b902e3b2",
... |
import pymongo # setup: sudo pip install pymongo
from ConfigParser import ConfigParser
import os.path
import sys
conf_file = ""
conf = ConfigParser({ # defaults
"mongo-db-name":"swift_usage",
"mongo-db-host":"localhost",
"mongo-db-port":"27017"
})
if os.path.exists("/etc/sw... | {
"content_hash": "9c4d8f401d8d18e372a730ce48e58232",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 99,
"avg_line_length": 31.869565217391305,
"alnum_prop": 0.6671214188267395,
"repo_name": "cloudops/swift_usage",
"id": "45afc7718884f6b2faad6ac1accd50d589f627cb",
"size": ... |
"""
Inside the .../moose-examples/CA1PyramidalCell/ directory supplied with MOOSE, run
python testNeuroML_CA1.py
(other channels and morph xml files are already present in this same directory).
The soma name below is hard coded for CA1, else any other file can be used by modifying this script.
"""
import moose
from mo... | {
"content_hash": "b697235f434a938b67d03d5eb66802e7",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 100,
"avg_line_length": 35.41818181818182,
"alnum_prop": 0.6591375770020534,
"repo_name": "h-mayorquin/camp_india_2016",
"id": "06f437ec27534244d4291f65767de66dc9b98d2d",
"... |
__author__ = 'ganeshchand'
# This is a comment
print('Hello, World')
| {
"content_hash": "297d4e5ec6b806a7917960cc0928c4dd",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 26,
"avg_line_length": 23,
"alnum_prop": 0.6666666666666666,
"repo_name": "ganeshchand/python3",
"id": "833330aa3059aa06f05e8a99564150dbd9afb95f",
"size": "69",
"binary": ... |
from app.admin.auth_view import AuthView
from app.pages.models import ShortLink
class ShortLinkModelView(AuthView):
column_display_pk = True
form_columns = ShortLink.__table__.columns._data.keys() | {
"content_hash": "dae29f87544586d74426c5446ca3ea91",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 57,
"avg_line_length": 33.5,
"alnum_prop": 0.7810945273631841,
"repo_name": "nickofbh/kort2",
"id": "bfbb6b9ca074bc8bfdf426ab8935908c390bf03e",
"size": "201",
"binary": fa... |
from org.apache.helix.participant.statemachine.StateModelFactory import StateModelFactory
class DistClusterControllerStateModelFactory(StateModelFactory<DistClusterControllerStateModel>):
"""
Parameters:
String zkAddr
"""
def __init__(self, zkAddr):
self._zkAddr = zkAddr
def ... | {
"content_hash": "0b68e231e8d4422ad51c4e7898b499f9",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 97,
"avg_line_length": 19.482758620689655,
"alnum_prop": 0.6761061946902654,
"repo_name": "davzhang/helix-python-binding",
"id": "de38bdefa3749a4f662306f87318eccdf2c6b71f",
... |
import datetime
import os
import sys
import time
import warnings
try:
import pytz
except ImportError:
pytz = None
from django.conf import settings
from django.core import serializers
from django.core.urlresolvers import reverse
from django.db import connection
from django.db.models import Min, Max
from django... | {
"content_hash": "9c442958b784669a4a22e73611623ccd",
"timestamp": "",
"source": "github",
"line_count": 1031,
"max_line_length": 146,
"avg_line_length": 47.99321047526673,
"alnum_prop": 0.6171257654453225,
"repo_name": "mitar/django",
"id": "bd9c7658f92492d4a1abe25ea7683e18814463fd",
"size": "49481... |
from oslo_config import cfg
from oslo_log import log as logging
# Import extensions to pull in osapi_compute_extension CONF option used below.
from jacket.tests.compute.functional import api_paste_fixture
from jacket.tests.compute.functional import integrated_helpers
CONF = cfg.CONF
LOG = logging.getLogger(__name__)
... | {
"content_hash": "5aa8beeb904e4f87c28a8aacd1db6814",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 78,
"avg_line_length": 36.46875,
"alnum_prop": 0.689802913453299,
"repo_name": "HybridF5/jacket",
"id": "723db993425f8f61a7d6208a444d371f849f2ab6",
"size": "1803",
"binar... |
import numpy as np
def weighted_percentile(a, q, weights=None, sorter=None):
"""
Returns the weighted percentile of a at q given weights.
Parameters
----------
a: array-like, shape=(n_samples,)
samples at which the quantile.
q: int
quantile.
weights: array-like, shape=(n_... | {
"content_hash": "a9682e9ff3b814bfd68726d340d77f34",
"timestamp": "",
"source": "github",
"line_count": 81,
"max_line_length": 87,
"avg_line_length": 29.703703703703702,
"alnum_prop": 0.5997506234413965,
"repo_name": "MechCoder/scikit-garden",
"id": "dae425f63419542ca1f72b7d691064737d1b9879",
"size... |
"""Tests for config_lib classes."""
import os
from grr.lib import config_lib
from grr.lib import flags
from grr.lib import test_lib
class YamlConfigTest(test_lib.GRRBaseTest):
"""Test the Yaml config file support."""
def testParsing(self):
conf = config_lib.GrrConfigManager()
conf.DEFINE_list("Section1... | {
"content_hash": "1c54768a8b188e04c510975ad16e1512",
"timestamp": "",
"source": "github",
"line_count": 388,
"max_line_length": 80,
"avg_line_length": 31.765463917525775,
"alnum_prop": 0.6666125760649088,
"repo_name": "simsong/grr-insider",
"id": "c3f32f1f36197f163ccf306eceeb65d0150e5b1f",
"size": ... |
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('asados', '0005_auto_20171023_1311'),
]
operations = [
migrations.RenameField(
model_name='asado',
old_name='estimated_price',
... | {
"content_hash": "180850b78eeb9a9631e92f0560dc0eb7",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 46,
"avg_line_length": 20.555555555555557,
"alnum_prop": 0.5837837837837838,
"repo_name": "TenStrings/organizador-de-asados",
"id": "62d49eedff5eba5669af7b4aa987110e57b51d44"... |
"""Test for the database used fo tasks.
"""
from pytest import raises
from exopy.tasks.tasks.database import TaskDatabase
# TODO add tests checking that the notifiers did run properly
# =============================================================================
# --- Edition mode tests ----------------------------... | {
"content_hash": "a1bc4dcb52e4e54ebba72a95be873f83",
"timestamp": "",
"source": "github",
"line_count": 349,
"max_line_length": 79,
"avg_line_length": 33.48424068767908,
"alnum_prop": 0.609532774259798,
"repo_name": "Ecpy/ecpy",
"id": "f5ad6b76fde6f6a2bc121ebfb82fbe12360defda",
"size": "12069",
"... |
"""
Support for the Netatmo cameras.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/camera.netatmo/.
"""
import logging
import requests
import voluptuous as vol
from homeassistant.const import CONF_VERIFY_SSL
from homeassistant.components.netatmo impor... | {
"content_hash": "014d2b5a714f8b44e8703ec2f3548caa",
"timestamp": "",
"source": "github",
"line_count": 110,
"max_line_length": 79,
"avg_line_length": 34.40909090909091,
"alnum_prop": 0.6015852047556143,
"repo_name": "PetePriority/home-assistant",
"id": "93ad2cd055b7cddd91ffc657985a25bff8cc1d97",
"... |
"""
WSGI config for vales 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.7/howto/deployment/wsgi/
"""
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "vales.settings")
from djang... | {
"content_hash": "754f317d5503138a6b9ca4ad8ebeb3af",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 78,
"avg_line_length": 28.5,
"alnum_prop": 0.7443609022556391,
"repo_name": "diego-d5000/MisValesMd",
"id": "b9786cde4849b58ea47cd15fe0d5a7056fd345eb",
"size": "399",
"bi... |
from connector import channel
from google3.cloud.graphite.mmv2.services.google.dataproc import autoscaling_policy_pb2
from google3.cloud.graphite.mmv2.services.google.dataproc import (
autoscaling_policy_pb2_grpc,
)
from typing import List
class AutoscalingPolicy(object):
def __init__(
self,
... | {
"content_hash": "9e7a16676eabed0e645090884a02d11c",
"timestamp": "",
"source": "github",
"line_count": 396,
"max_line_length": 91,
"avg_line_length": 37.26767676767677,
"alnum_prop": 0.6503591272530154,
"repo_name": "GoogleCloudPlatform/declarative-resource-client-library",
"id": "29c3ce0cba3297742f... |
"""
SendGrid notification service.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/notify.sendgrid/
"""
import logging
import voluptuous as vol
from homeassistant.components.notify import (
ATTR_TITLE, ATTR_TITLE_DEFAULT, PLATFORM_SCHEMA, BaseNotifi... | {
"content_hash": "ffc685a63b0669ac006b71c8ea873cd9",
"timestamp": "",
"source": "github",
"line_count": 78,
"max_line_length": 77,
"avg_line_length": 30.03846153846154,
"alnum_prop": 0.5928297055057619,
"repo_name": "ma314smith/home-assistant",
"id": "54f0f4b8cb35335df97aaddc7b0e439372515c31",
"siz... |
from __future__ import (absolute_import, division, print_function)
import os
from setuptools import setup, find_packages
# http://peak.telecommunity.com/DevCenter/setuptools#developer-s-guide
# Get version info
__version__ = None
__release__ = None
exec(open('kajiki/version.py').read())
def content_of(*files):
i... | {
"content_hash": "f34495ff192bfb52c0b6fd81ed0e5cc8",
"timestamp": "",
"source": "github",
"line_count": 67,
"max_line_length": 75,
"avg_line_length": 38.53731343283582,
"alnum_prop": 0.6134779240898528,
"repo_name": "ollyc/kajiki",
"id": "1c9f22d5151e512a30a087aa6b21ad5b3d2e19e4",
"size": "2629",
... |
"""Define tests for endpoints."""
| {
"content_hash": "03e129129f78e5ff7fae5f97b56640b7",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 33,
"avg_line_length": 34,
"alnum_prop": 0.6764705882352942,
"repo_name": "bachya/regenmaschine",
"id": "45d4fecd64298dd7a27c41c29bc4ca464a012d60",
"size": "34",
"binary":... |
class Solution(object):
def killProcess(self, pid, ppid, kill):
"""
:type pid: List[int]
:type ppid: List[int]
:type kill: int
:rtype: List[int]
"""
table = collections.defaultdict(list)
for i in range(len(pid)):
table[ppid[i]].append(pid[i... | {
"content_hash": "895e36045c817e8259d7eee4bde020b6",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 45,
"avg_line_length": 28,
"alnum_prop": 0.4714285714285714,
"repo_name": "Mlieou/lXXtcode",
"id": "676d219b731d7bf54fb6da3fa465af4451dc80ab",
"size": "560",
"binary": fa... |
import coba
print(coba.addGlobal(5))
print(coba.powerGlobal(2))
print(coba.addGlobal(12345))
print(coba.powerGlobal(-1)) | {
"content_hash": "c92226cba267be2ca876d999aafe255c",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 28,
"avg_line_length": 20.166666666666668,
"alnum_prop": 0.7768595041322314,
"repo_name": "yahya09/liga-badr",
"id": "9fe801332cc30903478f4763357236cbc5b74a91",
"size": "121... |
"""drop_user_and_chart
Revision ID: cf5dc11e79ad
Revises: 41f5f12752f8
Create Date: 2019-01-24 15:30:35.834740
"""
from alembic import op
from sqlalchemy.dialects import mysql
from sqlalchemy.engine.reflection import Inspector
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'cf5dc11e79ad... | {
"content_hash": "dd68323b80b26b960547ee76c1f5dc37",
"timestamp": "",
"source": "github",
"line_count": 83,
"max_line_length": 107,
"avg_line_length": 35.795180722891565,
"alnum_prop": 0.6405250757320767,
"repo_name": "r39132/airflow",
"id": "52f20681697682de296b463c308cb5cb7e3f7fa7",
"size": "3757... |
from setuptools import setup
setup(
name='restpi',
version='0.1',
description='Nifty Library written in Python for controlling Raspberry Pi based devices remotely.',
url='http://github.com/andela-cnnadi/restpi',
author='Chidiebere Nnadi',
author_email='chidiebere.nnadi@gmail.com',
license='... | {
"content_hash": "2cae64ef5042dbcc904a61bf576fff7f",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 103,
"avg_line_length": 26.681818181818183,
"alnum_prop": 0.616695059625213,
"repo_name": "andela-cnnadi/restpi",
"id": "943573b06bade825137d5667a2b20394204a1712",
"size": ... |
""" This module describes system wide enums.
"""
class Enum(object):
""" Base class for enums
"""
__global_increment = 1
def __init__(self, for_str):
""" Initialize base class for enumerates.
:param for_str: return value for build in str() function
"""
self.value = Enu... | {
"content_hash": "652781819633b13cd033735cff655987",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 64,
"avg_line_length": 19.69811320754717,
"alnum_prop": 0.5967432950191571,
"repo_name": "Nikolay-Kha/PyCNC",
"id": "31a1833fc1a35649c7ce17753e87789d9e021783",
"size": "104... |
import logging
def classifiedCount(request):
print "testclient.classifiedCount called for user %s!" % request['user']
return {'count': 0}
# These are copy/pasted from our first client, the carshare study
def getSectionFilter(uuid):
from dao.user import User
from datetime import datetime, timedelta
logging.... | {
"content_hash": "ac9777a30b55f3c2944c22ccc2966877",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 78,
"avg_line_length": 33.75555555555555,
"alnum_prop": 0.6747860434496379,
"repo_name": "sdsingh/e-mission-server",
"id": "f36b46f146563929953e1391387e8d85dc517994",
"size... |
from __future__ import division
"""Toyplot has been implemented to work equally well in Python 2 and Python 3,
without the use of code-modification tools like `2to3`. The
`toyplot.compatibility` module contains code to facilitate this.
"""
try:
string_type = basestring
except: # pragma: no cover
string_type ... | {
"content_hash": "39463ca53fb3365a27aef5a889e3ae78",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 78,
"avg_line_length": 23.952380952380953,
"alnum_prop": 0.7017892644135189,
"repo_name": "cmorgan/toyplot",
"id": "0b5a257cb52d7399c0bbaf9528057758a60640e0",
"size": "678"... |
import sys, os
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
sys.path.insert(0, os.path.abspath('../../'))
# -- General config... | {
"content_hash": "8d3aa58d78a858e5758ea5baec863896",
"timestamp": "",
"source": "github",
"line_count": 235,
"max_line_length": 145,
"avg_line_length": 32.35744680851064,
"alnum_prop": 0.7001578116780641,
"repo_name": "uranix/ttpy",
"id": "736fa4ff3104ae14abe151213e3d0d8c46d059de",
"size": "8019",
... |
from google.cloud import retail_v2
def sample_add_catalog_attribute():
# Create a client
client = retail_v2.CatalogServiceClient()
# Initialize request argument(s)
catalog_attribute = retail_v2.CatalogAttribute()
catalog_attribute.key = "key_value"
request = retail_v2.AddCatalogAttributeRequ... | {
"content_hash": "1b8fcb42009526f8d3a62c328f7f0dc8",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 67,
"avg_line_length": 27.391304347826086,
"alnum_prop": 0.7222222222222222,
"repo_name": "googleapis/python-retail",
"id": "858c3e3114b441f4033a350b2ea971265bfbafed",
"siz... |
"""
Tests for F() query expression syntax.
"""
from django.db import models
class Employee(models.Model):
firstname = models.CharField(max_length=50)
lastname = models.CharField(max_length=50)
def __unicode__(self):
return u'%s %s' % (self.firstname, self.lastname)
class Company(models.Model):
... | {
"content_hash": "5337f93d962304e9269cc21764b872a6",
"timestamp": "",
"source": "github",
"line_count": 71,
"max_line_length": 125,
"avg_line_length": 34.70422535211268,
"alnum_prop": 0.6866883116883117,
"repo_name": "chewable/django",
"id": "4043f5ec341515e246c074f6d4f03191c7fe57be",
"size": "2464... |
import sys
sys.dont_write_bytecode = True
sys.path.append( 'devices' )
sys.path.append( 'libs' )
import getopt
# interface handler...
#from libPyArdyApp import PyArdyApp
import libPyArdyApp
# connection
from libArdySer import ArdySer
# support libraries
import GS_Timing
from GS_Timing import delay,micros,millis
fro... | {
"content_hash": "a304366befe89b738f16de0ae928ee9b",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 80,
"avg_line_length": 21.25,
"alnum_prop": 0.5542483660130719,
"repo_name": "BleuLlama/LlamaPyArdy",
"id": "f9b02993f10a8f98101d3af4c31223b5201c532a",
"size": "1069",
"b... |
$license
try:
sqlite_ok = True
import cyclone.sqlite
except ImportError as sqlite_err:
sqlite_ok = False
import cyclone.redis
from twisted.enterprise import adbapi
from twisted.internet import defer
from twisted.internet import reactor
from twisted.python import log
class DatabaseMixin(object):
mys... | {
"content_hash": "78feac73f27200f01174eb11ebfca059",
"timestamp": "",
"source": "github",
"line_count": 78,
"max_line_length": 77,
"avg_line_length": 38.55128205128205,
"alnum_prop": 0.4968407050216162,
"repo_name": "fiorix/cyclone",
"id": "826c4a25c75508a8c0f29fa129195495c6ddc0c6",
"size": "3025",... |
from __future__ import absolute_import, print_function, unicode_literals
from attr import attrib, attrs
from attr.validators import provides
from automat import MethodicalMachine
from zope.interface import implementer
from . import _interfaces
@attrs
@implementer(_interfaces.ILister)
class Lister(object):
_timi... | {
"content_hash": "afd12211c9dbcd92e2641f86d301189c",
"timestamp": "",
"source": "github",
"line_count": 93,
"max_line_length": 79,
"avg_line_length": 34.10752688172043,
"alnum_prop": 0.674968474148802,
"repo_name": "warner/magic-wormhole",
"id": "de085fac4039a1b8094df0605ae7f71f1feb1e43",
"size": "... |
import capnp
import capnp.lib.capnp as cpl
capnp.remove_import_hook()
fs_capnp = capnp.load('schemas/fs.capnp')
def create_ffi(capnp_file):
GenericFFI = type('GenericFFI', (object,), {})
capnp_schema = capnp.load(capnp_file)
for interface in dir(capnp_schema):
interface = getattr(capnp_schema, inte... | {
"content_hash": "2a5259c617449a80ce016655caf08251",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 134,
"avg_line_length": 42.7027027027027,
"alnum_prop": 0.6056962025316456,
"repo_name": "waynenilsen/capnp-ffi",
"id": "e23b82739a10c615aa4121312bb52461952f8e70",
"size": ... |
from airflow.contrib.hooks.gcs_hook import GoogleCloudStorageHook
from airflow.operators.sensors import BaseSensorOperator
from airflow.utils.decorators import apply_defaults
class GoogleCloudStorageObjectSensor(BaseSensorOperator):
"""
Checks for the existence of a file in Google Cloud Storage.
"""
t... | {
"content_hash": "50ab4374bf85b1c8bb8f24c317a3cf82",
"timestamp": "",
"source": "github",
"line_count": 155,
"max_line_length": 110,
"avg_line_length": 38.8,
"alnum_prop": 0.639008979048886,
"repo_name": "jfantom/incubator-airflow",
"id": "a45923a6b0d5d044ee1fdad273643868c115c05f",
"size": "6580",
... |
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
from textwrap import wrap
from colors import blue, cyan, green, red
from pants.help.help_info_extracter import HelpInfoExtracter
class HelpFormatter(object):
def... | {
"content_hash": "c4460b37423624a40259379b6fe6681d",
"timestamp": "",
"source": "github",
"line_count": 75,
"max_line_length": 99,
"avg_line_length": 35.346666666666664,
"alnum_prop": 0.6190116937004904,
"repo_name": "Gabriel439/pants",
"id": "d028a143a9fa75d0d7686a3815c1383866d97763",
"size": "279... |
"""
Example of running an RLlib policy server, allowing connections from
external environment running clients. The server listens on
(a simple CartPole env
in this case) against an RLlib policy server listening on one or more
HTTP-speaking ports. See `cartpole_client.py` in this same directory for how
to start any numb... | {
"content_hash": "5370ed6c21e4290a0f49185b281bb899",
"timestamp": "",
"source": "github",
"line_count": 264,
"max_line_length": 88,
"avg_line_length": 33.92424242424242,
"alnum_prop": 0.5969182670835195,
"repo_name": "ray-project/ray",
"id": "11c76f85536806282f4ad4f32f176de8a5556220",
"size": "8978... |
from pyrep.robots.mobiles.nonholonomic_base import NonHolonomicBase
class LoCoBot(NonHolonomicBase):
def __init__(self, count: int = 0):
super().__init__(count, 2, 'LoCoBot')
| {
"content_hash": "92a3fe55db7ee429c559efc938967ae9",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 67,
"avg_line_length": 31.5,
"alnum_prop": 0.6878306878306878,
"repo_name": "stepjam/PyRep",
"id": "04645debebc13549f125391d5af60107a638e9e7",
"size": "189",
"binary": fal... |
"""Middleware for account-related functionality."""
import pytz
from django.conf import settings
from django.contrib import auth
from django.utils import timezone
from djblets.siteconfig.models import SiteConfiguration
from reviewboard.accounts.backends import X509Backend
def timezone_middleware(get_response):
... | {
"content_hash": "456cabef7ac38c19c550c0fcbf0412eb",
"timestamp": "",
"source": "github",
"line_count": 140,
"max_line_length": 79,
"avg_line_length": 32.5,
"alnum_prop": 0.605934065934066,
"repo_name": "reviewboard/reviewboard",
"id": "27323d050e5e56ae35587528c6fffd325295bc7b",
"size": "4550",
"... |
import os
import re
import argparse
import PyPDF2
def strip_punctuation(full_name):
things_to_remove = ["'", "-", ".", " "]
for thing in things_to_remove:
full_name = full_name.replace(thing, "")
return full_name
def get_oen_re():
return re.compile('OEN Number: +[0-9]{3}-[0-9]{3}-[0-9]{3}')... | {
"content_hash": "ef95ee1d68ceb969a5fab7aaa3870efb",
"timestamp": "",
"source": "github",
"line_count": 109,
"max_line_length": 76,
"avg_line_length": 31.889908256880734,
"alnum_prop": 0.5253164556962026,
"repo_name": "gregorysenyshyn/timetable-mailer",
"id": "a47c07407f4b3e2ca4dd1a603582bf8060d83bc3... |
import boto3
import json
# Create an S3 client
s3 = boto3.client('s3')
bucket_name = 'my-bucket'
# Create the bucket policy
bucket_policy = {
'Version': '2012-10-17,
'Statement': [{
'Sid': 'AddPerm',
'Effect': 'Allow',
'Principal': '*',
'Action': ['s3:GetObject'],
'Res... | {
"content_hash": "4d998bcfe07cd7e7b4685d96e97ad396",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 62,
"avg_line_length": 21.48,
"alnum_prop": 0.6256983240223464,
"repo_name": "imshashank/aws-doc-sdk-examples",
"id": "775be0ccef553c736b9c8bde4ecca0001d6b07e5",
"size": "1... |
import os
import numpy as np
from numpy.testing import assert_array_almost_equal
from nose.tools import assert_true, assert_raises
from nose.plugins.skip import SkipTest
import warnings
from mne.fixes import tril_indices
from mne.connectivity import spectral_connectivity
from mne.connectivity.spectral import _CohEst
... | {
"content_hash": "c9f23a6eb19d7b4754d04671e5da3411",
"timestamp": "",
"source": "github",
"line_count": 227,
"max_line_length": 79,
"avg_line_length": 43,
"alnum_prop": 0.5087593484274152,
"repo_name": "ARudiuk/mne-python",
"id": "8678f5b315c35ad3b3a7ce7c25333d92c5677974",
"size": "9761",
"binary... |
from codecs import open as codecs_open
from setuptools import setup, find_packages
# Get the long description from the relevant file
with codecs_open('README.md', encoding='utf-8') as f:
long_description = f.read()
setup(name='mltools',
version='0.0.1',
description=u'Machine Learning Tools',
l... | {
"content_hash": "06d097971cfe6c3d45c030295500cfdc",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 72,
"avg_line_length": 26.236842105263158,
"alnum_prop": 0.5777331995987964,
"repo_name": "vidalalcala/ml-tools",
"id": "f6714271e7414153526564d9f74ae76d77aa9e86",
"size": ... |
from temboo.core.choreography import Choreography
from temboo.core.choreography import InputSet
from temboo.core.choreography import ResultSet
from temboo.core.choreography import ChoreographyExecution
import json
class TSVToJSON(Choreography):
def __init__(self, temboo_session):
"""
Create a new... | {
"content_hash": "b6e13475ef6241cc59e12c3499705aa8",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 152,
"avg_line_length": 35.964285714285715,
"alnum_prop": 0.702085402184707,
"repo_name": "jordanemedlock/psychtruths",
"id": "3b026090e55d0b1e4c5d387c2b374e09529a22c2",
"s... |
"Errors and warnings reported by the Tango framework."
class TangoException(Exception):
"Base exception for Tango-specific errors."
class ParseError(TangoException):
"Error when parsing markup or scraping screens."
class NoSuchWriterException(TangoException):
"Error when getting a response writer by a... | {
"content_hash": "fa6b897b9f81a6d44a16dde6187aca35",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 78,
"avg_line_length": 26.333333333333332,
"alnum_prop": 0.7746835443037975,
"repo_name": "willowtreeapps/tango-core",
"id": "8b8afcd46d4d15ce00d14e4f94fd591c2e5cd0fd",
"si... |
"""
testing_processer
-----------------
The testing function for test the processer utilities.
"""
import os
from processer import Processer
from ..Logger import Logger
from processer import check_subprocess, create_empty_list_from_hierarchylist,\
store_time_subprocess, initial_message_creation
## Code a dummy ... | {
"content_hash": "34f84d3885063e744fd23f5d2b2b16ba",
"timestamp": "",
"source": "github",
"line_count": 114,
"max_line_length": 78,
"avg_line_length": 30.44736842105263,
"alnum_prop": 0.6101987899740708,
"repo_name": "tgquintela/pythonUtils",
"id": "1b3952fd71bf08bf9195843ddc69ebb7af593b88",
"size"... |
"""
Unit tests for MLlib Python DataFrame-based APIs.
"""
import sys
if sys.version > '3':
xrange = range
basestring = str
try:
import xmlrunner
except ImportError:
xmlrunner = None
if sys.version_info[:2] <= (2, 6):
try:
import unittest2 as unittest
except ImportError:
sys.std... | {
"content_hash": "d896e64e7e83418488ad088d121143d5",
"timestamp": "",
"source": "github",
"line_count": 2279,
"max_line_length": 100,
"avg_line_length": 42.70206230802984,
"alnum_prop": 0.5995910314638607,
"repo_name": "cin/spark",
"id": "2f1f3af957e4dbc0c5de7e4a22e6b5d41ecb9052",
"size": "98129",
... |
import logging
from programy.clients.clients import BotClient
class ConsoleBotClient(BotClient):
def __init__(self):
BotClient.__init__(self)
self.clientid = "Console"
def set_environment(self):
self.bot.brain.predicates.pairs.append(["env", "Console"])
def run(self):
if... | {
"content_hash": "ca522c086f1e6dda78708d3e8c6d6eeb",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 123,
"avg_line_length": 36.24528301886792,
"alnum_prop": 0.5642894325871942,
"repo_name": "dkamotsky/program-y",
"id": "56065a254fdf823849c4be4f2de426c1bb46186f",
"size": "... |
import math
# This is a fairly naive implementation of the algorithm described in
# "Effective Computation of Biased Quantiles over Data Streams"
class Quantiles(object):
def __init__(self, f=None):
self.points = None
self.n = 0
self.f = f or biased_quantiles_f
def insert(self, val):
... | {
"content_hash": "acd23e28cf61e145716b208d3b8d4e5a",
"timestamp": "",
"source": "github",
"line_count": 393,
"max_line_length": 108,
"avg_line_length": 32.05343511450382,
"alnum_prop": 0.5780741446376121,
"repo_name": "doublereedkurt/faststat",
"id": "90a3f1a377a77d9f6a520d972519b591cf44bfd0",
"siz... |
import functools
import httplib as http
import itertools
import waffle
from operator import itemgetter
from dateutil.parser import parse as parse_date
from django.utils import timezone
from flask import request, redirect
import pytz
from framework.database import autoload
from framework.exceptions import HTTPError
f... | {
"content_hash": "63ace23db4e763d514ca5c6780df518d",
"timestamp": "",
"source": "github",
"line_count": 358,
"max_line_length": 159,
"avg_line_length": 37.20670391061452,
"alnum_prop": 0.6653903903903904,
"repo_name": "mattclark/osf.io",
"id": "06bae1bf0da354748eca54cf34658f404778ef7e",
"size": "13... |
from django.contrib.contenttypes import generic
from django.contrib.contenttypes.models import ContentType
from django.db import models
from . import managers
class RelatedType(models.Model):
title = models.CharField(max_length=100)
def __unicode__(self):
return self.title
class RelatedContent(mod... | {
"content_hash": "b1e589ead830d7951278e80f4445c16e",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 73,
"avg_line_length": 31.91176470588235,
"alnum_prop": 0.6940092165898617,
"repo_name": "armstrong/armstrong.apps.related_content",
"id": "aff0641b697977318a8a9a82ff72da16fb... |
from datetime import date
from sphinx_readable_theme import get_html_theme_path
from topology import __version__
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.inheritance_diagram',
'sphinx.ext.intersphinx',
'autoapi.sphinx',
'plantweb.directive',
]
# Add any paths that contain templates here,... | {
"content_hash": "8276377fdb710bd2817b89fb1cebb650",
"timestamp": "",
"source": "github",
"line_count": 137,
"max_line_length": 79,
"avg_line_length": 30.83941605839416,
"alnum_prop": 0.7053254437869823,
"repo_name": "HPENetworking/topology",
"id": "a626bdf65ffd7568d4b090b8f18a3d5bdc27b845",
"size"... |
from __future__ import unicode_literals, division, absolute_import
from builtins import * # noqa pylint: disable=unused-import, redefined-builtin
import logging
from flexget import plugin
from flexget.entry import Entry
from flexget.event import event
from flexget.utils.requests import RequestException
from flexget.... | {
"content_hash": "a316bcbfc526b21f9fed71f42f29f8a6",
"timestamp": "",
"source": "github",
"line_count": 108,
"max_line_length": 125,
"avg_line_length": 37.2962962962963,
"alnum_prop": 0.5240814299900695,
"repo_name": "jawilson/Flexget",
"id": "e162352f0cca435caad169c39c82985a12efdb9a",
"size": "402... |
from django.db import models
import pickle
class RestModelBase(models.Model):
"A base model which includes the ability to have a schema free extension field called rest"
rest = models.TextField(verbose_name="JSON data.", default=pickle.dumps({}, 0),
help_text="Additional fields with... | {
"content_hash": "f5af1a1807d90949e5ccfd333c580a3b",
"timestamp": "",
"source": "github",
"line_count": 78,
"max_line_length": 116,
"avg_line_length": 46.794871794871796,
"alnum_prop": 0.6249315068493151,
"repo_name": "DanielCasner/Context-Server",
"id": "4e5d35677f26302700da0286d3980c578ce7e005",
... |
# -*- coding: utf-8 -*-
# ProjectEuler/src/python/problem051.py
#
# Prime digit replacements
# ========================
# Published on Friday, 29th August 2003, 06:00 pm
#
# By replacing the 1st digit of the 2-digit number *3, it turns out that six of
# the nine possible values: 13, 23, 43, 53, 73, and 83, are all pri... | {
"content_hash": "84d1051ee26414562d72ebf40e06d574",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 79,
"avg_line_length": 38.291666666666664,
"alnum_prop": 0.7018498367791077,
"repo_name": "olduvaihand/ProjectEuler",
"id": "318438ec7acd4d940a3d47006f3871fcf8acb506",
"siz... |
import logging
from itertools import chain
from unittest import mock
from django.contrib.auth.models import Group, Permission
from django.contrib.messages import constants as message_constants
from django.core import mail
from django.core.mail import EmailMultiAlternatives
from django.test import TestCase, override_s... | {
"content_hash": "4fd77133927c834f19cf7d6f80839030",
"timestamp": "",
"source": "github",
"line_count": 323,
"max_line_length": 115,
"avg_line_length": 39.56346749226006,
"alnum_prop": 0.6638234603646608,
"repo_name": "kaedroho/wagtail",
"id": "becbc58660017821ed0ced240f47ad6fc7dd425d",
"size": "12... |
from __future__ import absolute_import
import json
import logging
import warnings
from pip._vendor import six
from pip._vendor.six.moves import zip_longest
from pip._internal.basecommand import Command
from pip._internal.cmdoptions import index_group, make_option_group
from pip._internal.exceptions import CommandErr... | {
"content_hash": "ad311edecff2e6d78deedb4e9cfdbf3a",
"timestamp": "",
"source": "github",
"line_count": 343,
"max_line_length": 79,
"avg_line_length": 33.8600583090379,
"alnum_prop": 0.5559669364560014,
"repo_name": "kushalbhola/MyStuff",
"id": "09f633f392d1489f65da21a7391539e42c4f1f21",
"size": "1... |
'''The script reads alignments in PSL format and prints out
unmapped sequences in FASTA format.
'''
import sys
from Bio import SeqIO
def parse_mapped(pslfile):
mapped = set()
for line in open(pslfile):
name = line.strip().split()[9]
mapped.add(name)
return mapped
def select_seq(mapped_se... | {
"content_hash": "fd918468168e8083d1c0835c2e5855c0",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 72,
"avg_line_length": 28.666666666666668,
"alnum_prop": 0.6325581395348837,
"repo_name": "likit/BioUtils",
"id": "8ccc043fb083396171f8c3a79fce7e19cf95a1ae",
"size": "860",... |
from networktables.util import ChooserControl
autonomous_seconds = 15
def test_all_autonomous(control, fake_time, robot):
'''
This test runs all possible autonomous modes that can be selected
by the autonomous switcher.
This should work for most robots. If it doesn't work for your... | {
"content_hash": "b52e7004f6ada760d7e5d649dbf50f5e",
"timestamp": "",
"source": "github",
"line_count": 74,
"max_line_length": 109,
"avg_line_length": 34.027027027027025,
"alnum_prop": 0.49682287529785546,
"repo_name": "Twinters007/robotpy-wpilib-utilities",
"id": "c7109459238d82ee1309ff81362c79b2ce2... |
import json
import sys
import six
from keystone.common import dependency
from keystone import config
from keystone import exception
from keystone import token
from keystone.token import provider
from keystone import trust
from keystone.openstack.common import log
from keystone.openstack.common import timeutils
LO... | {
"content_hash": "becbf4aa3313a6276d7c7d9a0b1e756a",
"timestamp": "",
"source": "github",
"line_count": 579,
"max_line_length": 79,
"avg_line_length": 43.59240069084629,
"alnum_prop": 0.5265055467511885,
"repo_name": "derekchiang/keystone",
"id": "48925ac6d03b261454c8a7aeca895d6e04b3771a",
"size": ... |
import json
import pycurl
import re
import sys
if sys.version_info >= (3,):
from StringIO import BytesIO
else:
from StringIO import StringIO
import occi
# for curl helper callback function
header = []
def get_header2(buff):
global header
header.append(buff)
def get_header3(buff):
global heade... | {
"content_hash": "ad0404064e6223570872b575c0e33399",
"timestamp": "",
"source": "github",
"line_count": 399,
"max_line_length": 123,
"avg_line_length": 34.19799498746867,
"alnum_prop": 0.5419567607182117,
"repo_name": "CESNET/pOCCI",
"id": "1b9258ee2025c9450a0d65c53ce742de0f584333",
"size": "13645"... |
from filter import FilterException
from common import PluginType
from yapsy.IPlugin import IPlugin
import logging
class CanonicalFilter(IPlugin):
category = PluginType.HEADER
id = "canonical"
def __init__(self):
self.__log = logging.getLogger(__name__)
self.__conf = None
def setConf... | {
"content_hash": "0fde75c31c7e59310a8189e32460f2cd",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 71,
"avg_line_length": 27.035714285714285,
"alnum_prop": 0.5970937912813739,
"repo_name": "eghuro/crawlcheck",
"id": "a06e9562ff5fb8f682107b78e99a6914535fde5c",
"size": "75... |
import os
import sys
from pprint import pprint
root = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
sys.path.append(root + '/python')
import ccxt # noqa: E402
# WARNING!
# This example measures the round-trip time by fetching the orderbook from an exchange
# In order to measure the s... | {
"content_hash": "53e76d63d609502a03f38bc743348593",
"timestamp": "",
"source": "github",
"line_count": 54,
"max_line_length": 119,
"avg_line_length": 30.203703703703702,
"alnum_prop": 0.6971183323114654,
"repo_name": "ccxt/ccxt",
"id": "13d51adffc99574cb5d8fa6eedfa466c045e2b6d",
"size": "1656",
... |
from twisted.trial import unittest
class AppTests(unittest.TestCase):
def test_something(self):
pass | {
"content_hash": "a04a2c2a6db1cd7362614a4fe6837fd8",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 34,
"avg_line_length": 19,
"alnum_prop": 0.7280701754385965,
"repo_name": "fiorix/cyclone",
"id": "fa5c841623261200f908d9c199bebda0b0737375",
"size": "696",
"binary": fals... |
from flask import Blueprint, g, url_for
from service import get_flashes
class APIBlueprint(Blueprint):
def route(self, rule, versions, **options):
'''
works just like the original route decorator but registers for
multiple prefixes based on the version parameter.
Endpoints get ... | {
"content_hash": "c9e93807a48bea4aeac07787ad009ef4",
"timestamp": "",
"source": "github",
"line_count": 81,
"max_line_length": 75,
"avg_line_length": 28.11111111111111,
"alnum_prop": 0.5893719806763285,
"repo_name": "glennyonemitsu/MarkupHiveServer",
"id": "75c85c33b1059daa870c1adf9862a00849ec8f84",
... |
import logging
from struct import pack, unpack
import androguard.decompiler.dad.util as util
from androguard.decompiler.dad.instruction import (ArrayLengthExpression,
ArrayLoadExpression, ArrayStoreInstruction,
AssignExpression, BaseClass, BinaryCompExpression,
... | {
"content_hash": "969635270c0ef02954d0e46f21fa1904",
"timestamp": "",
"source": "github",
"line_count": 1961,
"max_line_length": 78,
"avg_line_length": 31.79704232534421,
"alnum_prop": 0.6179715816146518,
"repo_name": "xysec/androguard",
"id": "e37d456daf2e803767c22a64e12f2c6ee05d3801",
"size": "63... |
from django.contrib.auth.models import Group
from django.contrib.auth import get_user_model
from rest_framework import status
from coupons.tests.base import BasicTest
class CouponRedeemedSettingsTests(BasicTest):
def setUp(self):
u = get_user_model()
u.objects.create_superuser('admin', 'john@sno... | {
"content_hash": "809c0fccebbde28b017de476746bc162",
"timestamp": "",
"source": "github",
"line_count": 90,
"max_line_length": 97,
"avg_line_length": 40.166666666666664,
"alnum_prop": 0.5883817427385892,
"repo_name": "pstrinkle/drf-coupons",
"id": "dfd46690c3fcb737517add07c09e265ba51e2c4b",
"size":... |
"""
Graphical User Interface
Copyright (c) 2014, 2015 Andrew Hawkins
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, mod... | {
"content_hash": "831b4286c26428f49d42c9c0e214decd",
"timestamp": "",
"source": "github",
"line_count": 488,
"max_line_length": 77,
"avg_line_length": 26.420081967213115,
"alnum_prop": 0.6046692003412705,
"repo_name": "achawkins/Forsteri",
"id": "038347cd82830d12ff4e5622c47d2fb2b573c92a",
"size": "... |
from rest_framework import viewsets, mixins
from .models import FileModel, ImageModel
from .serializers import FileSerializers, ImageSerializers
class FileViewSet(mixins.CreateModelMixin,
viewsets.GenericViewSet):
queryset = FileModel.objects.all()
serializer_class = FileSerializers
class... | {
"content_hash": "665392bb933855cb8494ff0a9fd90537",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 58,
"avg_line_length": 30.25,
"alnum_prop": 0.7458677685950413,
"repo_name": "DreamColl/WebBaihe",
"id": "2a33efccb3f15a3a3a2ecc5c745ef1add5ccb906",
"size": "484",
"binar... |
from django.conf.urls import url
from ..views import servers as views
urlpatterns = [
url(r'^$',
views.ServerList.as_view(),
name='server-list'),
url(r'^/(?P<pk>\d+)/?$',
views.ServerDetail.as_view(),
name='server-detail'),
url(r'^/(?P<pk>\d+)/components/?$',
view... | {
"content_hash": "d03b5129e6c6113361f6d5cd9d50791d",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 44,
"avg_line_length": 23.952380952380953,
"alnum_prop": 0.5566600397614314,
"repo_name": "baffolobill/mb_test_1",
"id": "b6989e6f4ffd17054a3d38183b523376df5f03f8",
"size":... |
import sys
import time
import logging
logging.basicConfig(level=logging.DEBUG)
logging.info(time.time())
time.sleep(3)
print("exiting from echo !")
sys.exit(3)
| {
"content_hash": "4b500a8299a9a62bb848a8c645ab63b0",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 40,
"avg_line_length": 16.2,
"alnum_prop": 0.7654320987654321,
"repo_name": "ybrs/single-beat",
"id": "fa18e83745162b0f285965d9c2480603670923ef",
"size": "162",
"binary":... |
import os
import six
import st2common.content.utils as content_utils
from st2common import log as logging
from st2common.constants.meta import ALLOWED_EXTS
from st2common.bootstrap.base import ResourceRegistrar
from st2common.models.api.action import ActionAliasAPI
from st2common.persistence.actionalias import Action... | {
"content_hash": "aa6f4a46359e496c291e47d6867202fb",
"timestamp": "",
"source": "github",
"line_count": 166,
"max_line_length": 93,
"avg_line_length": 35.66867469879518,
"alnum_prop": 0.5884141192366155,
"repo_name": "tonybaloney/st2",
"id": "d0857a9752d894565e441e531ce6074ab20fd98e",
"size": "6701... |
"""
The Plaid API
The Plaid REST API. Please see https://plaid.com/docs/api for more details. # noqa: E501
Generated by: https://openapi-generator.tech
"""
import re # noqa: F401
import sys # noqa: F401
from plaid.model_utils import ( # noqa: F401
ApiTypeError,
ModelComposed,
ModelNormal... | {
"content_hash": "bc871dc360280a724ebea16d02baecce",
"timestamp": "",
"source": "github",
"line_count": 173,
"max_line_length": 199,
"avg_line_length": 41.23699421965318,
"alnum_prop": 0.5618166526492852,
"repo_name": "plaid/plaid-python",
"id": "91f21f01dcfbfe925c2289f676d9cc5d830a0b14",
"size": "... |
class ScrapyBlPipeline(object):
def process_item(self, item, spider):
return item
| {
"content_hash": "3581a6a42869eb9e985f15775850658d",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 41,
"avg_line_length": 31.333333333333332,
"alnum_prop": 0.6914893617021277,
"repo_name": "mblaauw/scrapy_bl",
"id": "ef369d4fdffdcb203d70f784b081b8b94a1b1323",
"size": "252... |
"""
Tests for the fitting function classes defined in `plasmapy.analysis.fit_functions`.
"""
import numpy as np
import pytest
from abc import ABC, abstractmethod
from contextlib import nullcontext as does_not_raise
import plasmapy.analysis.fit_functions as ffuncs
class TestAbstractFitFunction:
"""
Tests for... | {
"content_hash": "f26e0533af74ea1abd77b02cd1bbcddd",
"timestamp": "",
"source": "github",
"line_count": 603,
"max_line_length": 87,
"avg_line_length": 32.72139303482587,
"alnum_prop": 0.5320054736201916,
"repo_name": "StanczakDominik/PlasmaPy",
"id": "a5da598f39dc6aab09d07673059e13917c40435a",
"siz... |
"""
fritzmonitor.py
Implement a tkinter-based grafic interface to view basic status- and
traffic-informations.
"""
__version__ = '0.1.0'
import argparse
try:
# python 2
import Tkinter as tk
import tkFont as tkfont
except ImportError:
# python 3
import tkinter as tk
import tkinter.font as tkf... | {
"content_hash": "20a3363eb016c497df0f357d48cc3a90",
"timestamp": "",
"source": "github",
"line_count": 197,
"max_line_length": 79,
"avg_line_length": 38.23857868020305,
"alnum_prop": 0.5455993628036638,
"repo_name": "lukasklein/fritzconnection",
"id": "c2519bdee9525df3f475e1085223f42c824e611f",
"s... |
import os.path
import re
from collections import namedtuple
from uuid import UUID
from Common import *
from CommandExecutor import *
from BekUtil import *
from DiskUtil import *
from EncryptionConfig import *
class OSEncryptionState(object):
def __init__(self, state_name, context):
super(OSEncryptionStat... | {
"content_hash": "b03cf945837954290d87926828a57551",
"timestamp": "",
"source": "github",
"line_count": 165,
"max_line_length": 125,
"avg_line_length": 44.412121212121214,
"alnum_prop": 0.5832423580786026,
"repo_name": "varunkumta/azure-linux-extensions",
"id": "c0651cc0d5ebb1294fe5030b129498a453bb79... |
from unittest import mock
from nova import objects
from nova.scheduler import weights
from nova.scheduler.weights import affinity
from nova import test
from nova.tests.unit.scheduler import fakes
class SoftWeigherTestBase(test.NoDBTestCase):
def setUp(self):
super(SoftWeigherTestBase, self).setUp()
... | {
"content_hash": "ca2ca36691ea214a4b7bc01fa56e29ff",
"timestamp": "",
"source": "github",
"line_count": 243,
"max_line_length": 78,
"avg_line_length": 40.477366255144034,
"alnum_prop": 0.5554087027246848,
"repo_name": "openstack/nova",
"id": "3048e9f06c3498751cee0c5822e361adf1c2fbc2",
"size": "1046... |
import base64
from functools import wraps
from django.contrib.auth.models import AnonymousUser as DjangoAnonymousUser, User as DjangoUser
from django.http import HttpResponse
from apps.canvas_auth.backends import authenticate
from apps.canvas_auth.http import HttpUnauthorizedException
from apps.canvas_auth.models imp... | {
"content_hash": "ac28f44348669e610e3038782b60e797",
"timestamp": "",
"source": "github",
"line_count": 71,
"max_line_length": 117,
"avg_line_length": 36.88732394366197,
"alnum_prop": 0.6842306223749522,
"repo_name": "canvasnetworks/canvas",
"id": "f6fc758affb6f4a02f0756aed318459637eb7173",
"size":... |
import uuid
from django.db import models
from core.models.base import StandardModel
from core.models.base import CaseInsensitiveNamedModel
from core.models import Material
from core.models import Source
from core.models import SampleType
from core.models import Storage
from core.models import Project
from core.models i... | {
"content_hash": "2a5bae6064db8f8328e91267fd920b93",
"timestamp": "",
"source": "github",
"line_count": 176,
"max_line_length": 92,
"avg_line_length": 28.52840909090909,
"alnum_prop": 0.6954789882493527,
"repo_name": "slohr/paperlims",
"id": "1a34e386a228d6e08ad91f2065f14420bfcdf2e1",
"size": "5021... |
"""Check design."""
from __future__ import print_function
import os
from os.path import basename, splitext
from plumbum.cmd import stringtie, featureCounts
# from piret.runs import Map
import pandas as pd
from luigi.util import inherits, requires
from luigi.contrib.external_program import ExternalProgramTask
from luigi... | {
"content_hash": "2280e85544780415fc3eb81aee328cec",
"timestamp": "",
"source": "github",
"line_count": 111,
"max_line_length": 80,
"avg_line_length": 48.77477477477478,
"alnum_prop": 0.38585149612116737,
"repo_name": "mshakya/PyPiReT",
"id": "94eb14653e8d0cd6dd8f614434706e14248207d4",
"size": "543... |
import json
import requests
from pylons import app_globals as g
COUNTRIES_URL = 'https://api.adzerk.net/v1/countries'
HEADERS = {
'X-Adzerk-ApiKey': g.secrets['az_ads_key'],
'Content-Type': 'application/x-www-form-urlencoded',
}
def get_locations(exclude_regions_without_metros=True):
"""
Get countr... | {
"content_hash": "790da71a09f652fa24000c38ca0e0ac4",
"timestamp": "",
"source": "github",
"line_count": 64,
"max_line_length": 77,
"avg_line_length": 29.90625,
"alnum_prop": 0.5679205851619644,
"repo_name": "madbook/reddit-plugin-adzerk",
"id": "e1f83a84de227306ab59cff6f3978e6002283630",
"size": "1... |
from __future__ import absolute_import, division, print_function
import re
from .core import common_subexpression
from .expressions import Expr
from .reductions import Reduction, Summary, summary
from ..dispatch import dispatch
from .expressions import dshape_method_list
from datashape import dshape, Record, Map, Un... | {
"content_hash": "2742a3627944b4d31915b81c44e65869",
"timestamp": "",
"source": "github",
"line_count": 106,
"max_line_length": 71,
"avg_line_length": 27.68867924528302,
"alnum_prop": 0.5884156729131176,
"repo_name": "ContinuumIO/blaze",
"id": "4a787dbb6bf501fec0a457df962fec4cc5bce6a1",
"size": "29... |
import unittest
import os.path
import re, gc, sys
from lxml import etree
def make_version_tuple(version_string):
l = []
for part in re.findall('([0-9]+|[^0-9.]+)', version_string):
try:
l.append(int(part))
except ValueError:
l.append(part)
return tuple(l)
IS_PYPY =... | {
"content_hash": "9d5aefd662f0f7bcc53244287c0ca3d0",
"timestamp": "",
"source": "github",
"line_count": 273,
"max_line_length": 95,
"avg_line_length": 30.095238095238095,
"alnum_prop": 0.5884858812074002,
"repo_name": "ioram7/keystone-federado-pgid2013",
"id": "c528a3cabd0b7dbd16dc6cde98933fb92b5e480... |
from typing import Dict, Generator
from pip._vendor.requests.models import CONTENT_CHUNK_SIZE, Response
from pip._internal.exceptions import NetworkConnectionError
# The following comments and HTTP headers were originally added by
# Donald Stufft in git commit 22c562429a61bb77172039e480873fb239dd8c03.
#
# We use Acc... | {
"content_hash": "753632450165d0eff8c4751a18d5cce5",
"timestamp": "",
"source": "github",
"line_count": 96,
"max_line_length": 76,
"avg_line_length": 42.427083333333336,
"alnum_prop": 0.6511171126933464,
"repo_name": "pypa/pip",
"id": "134848ae526e54e2b18738f83088c4a17efcce96",
"size": "4073",
"b... |
from skimage import morphology
from scipy import ndimage as ndi
import voxie
import numpy as np
args = voxie.parser.parse_args()
context = voxie.VoxieContext(args)
instance = context.createInstance()
if args.voxie_action != 'RunFilter':
raise Exception('Invalid operation: ' + args.voxie_action)
with context.make... | {
"content_hash": "3ae16dc69daa8aa185b8a52cd877bc6f",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 162,
"avg_line_length": 45.214285714285715,
"alnum_prop": 0.627172195892575,
"repo_name": "voxie-viewer/voxie",
"id": "d27217ff7bd9d37f2f32f34d107454eeeeec3854",
"size": "3... |
from os.path import exists
from setuptools import setup, find_packages
setup(
name='python-hue-client',
version=open('VERSION').read().strip(),
# Your name & email here
author='Adam Charnock',
author_email='adam@adamcharnock.com',
# If you had hueclient.tests, you would also include that in t... | {
"content_hash": "af513f74a8353dd454418f4cf024a229",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 79,
"avg_line_length": 31.939393939393938,
"alnum_prop": 0.6404174573055028,
"repo_name": "adamcharnock/python-hue-client",
"id": "d20cecf2730f6a799607797301f5de037fb19095",
... |
__author__ = 'yinjun'
"""
Definition of TreeNode:
class TreeNode:
def __init__(self, val):
this.val = val
this.left, this.right = None, None
"""
class Solution:
'''
@param root: An object of TreeNode, denote the root of the binary tree.
This method will be invoked first, you should des... | {
"content_hash": "ffd1a896be31921973a60c4055cd0f4a",
"timestamp": "",
"source": "github",
"line_count": 163,
"max_line_length": 77,
"avg_line_length": 25.57668711656442,
"alnum_prop": 0.5233869033341328,
"repo_name": "shootsoft/practice",
"id": "be308fe8773ee3cfed66a663af3b6845c0ad7c0a",
"size": "4... |
import math
import sys
import re
help = \
"""Usage : %s [ --verbose ] file1 file2 ... fileN
Display indentation used in the list of files. Possible answers are (with X
being the number of spaces used for indentation):
space X
tab 8
mixed tab X space Y
mixed means that indentation style is tab at the beginning of the... | {
"content_hash": "fd2aa9fb3f8a6e864cd97cd61fc1e75c",
"timestamp": "",
"source": "github",
"line_count": 413,
"max_line_length": 145,
"avg_line_length": 34.738498789346245,
"alnum_prop": 0.5548895239422876,
"repo_name": "jirutka/editorconfig-tools",
"id": "39bb710383693d6b20bf19aa485c3275d54a95c5",
... |
from django.conf.urls import url
from person import views
urlpatterns = [
url(r'^person/$', views.JSONResponse.person_list),
url(r'^person/(?P<pk>[0-9]+)/$', views.JSONResponse.person_detail)
]
| {
"content_hash": "8ac7dc4dbba512f4320347b86b2e3d4f",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 70,
"avg_line_length": 29,
"alnum_prop": 0.6896551724137931,
"repo_name": "gnzandrs/opencare",
"id": "b4b5de637d756d9bd54ea83018278f1c5cc55055",
"size": "203",
"binary": f... |
from django.http import HttpResponse
from django.shortcuts import render_to_response
import time, random, math, os, json
import Stemmer
from utils import *
global_counts = load_json("data/global_counts.json")
sorted_global_counts = sort_by_value(global_counts)
stem_to_terms = load_json("data/stem_to_terms.json")
per... | {
"content_hash": "f7c073cf66d82d1e6738d667763f1ef7",
"timestamp": "",
"source": "github",
"line_count": 213,
"max_line_length": 226,
"avg_line_length": 34.25821596244131,
"alnum_prop": 0.6120323420583802,
"repo_name": "hassy/informatics-explorer",
"id": "75e52f253106fad625781f573b7886dc9a47460b",
"... |
from .Base import *
from .helper import containsChnChar
class FEDTransChnFontFamilyNameIntoEng(RuleChecker):
'''{
"summary":"字体设置时使用英文",
"desc":"有的字体设置可以通过中文和英文两者方式来声明,比如<br>
<code>微软雅黑</code> 和 <code>Microsoft Yahei</code> ,我们推荐用英文的方式来实现"
}'''
def __init__(self):
... | {
"content_hash": "6b43161466d17966aaf4db08d96e7e56",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 82,
"avg_line_length": 28.708333333333332,
"alnum_prop": 0.6052249637155298,
"repo_name": "wangjeaf/CSSCheckStyle",
"id": "c662fe57cc07146bdc6151fe21b6b370656825c3",
"size"... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.