text stringlengths 4 1.02M | meta dict |
|---|---|
import os
from pathlib import Path
import pytest
from django.core.files.base import ContentFile
from grandchallenge.components.backends.docker import DockerConnection
from grandchallenge.components.backends.utils import user_error
from grandchallenge.components.models import InterfaceKindChoices
from tests.components... | {
"content_hash": "af2b4929cc0742b1bccdf28da5f97b2a",
"timestamp": "",
"source": "github",
"line_count": 141,
"max_line_length": 102,
"avg_line_length": 36.94326241134752,
"alnum_prop": 0.6584757151084661,
"repo_name": "comic/comic-django",
"id": "62f0a56802114331f8b44e52c00cdf3f0438e750",
"size": "... |
from __future__ import division
from __future__ import unicode_literals
from django.core.exceptions import ImproperlyConfigured
from django.utils import six
from django.utils.encoding import force_text
from django.utils.encoding import python_2_unicode_compatible
from django.utils.formats import number_format
from dja... | {
"content_hash": "d9113ae79484e7caf7010f82ecc9ee30",
"timestamp": "",
"source": "github",
"line_count": 291,
"max_line_length": 117,
"avg_line_length": 35.27147766323024,
"alnum_prop": 0.5516367887763055,
"repo_name": "django-bmf/django-bmf",
"id": "395eb15da3868d512bf41541f201f4a444816b67",
"size"... |
class Animal(object):
pass
## Dog is-a animal
class Dog(Animal):
def __init__(self, name):
## __init__ has-a reference with Dog's name
self.name = name
## Cat is-a animal
class Cat(Animal):
def __init__(self, name):
## __init__ has-a reference with Cat's name
self.name = ... | {
"content_hash": "3f8bbd27244b5dae020b7cbd5939d78c",
"timestamp": "",
"source": "github",
"line_count": 75,
"max_line_length": 67,
"avg_line_length": 18.413333333333334,
"alnum_prop": 0.6075307748008689,
"repo_name": "chrisortman/CIS-121",
"id": "5ef71437ecdcd7fc3bbf42a64a4e88a4fededed9",
"size": "... |
'''
Created on May 6, 2017
This file is subject to the terms and conditions defined in the
file 'LICENSE.txt', which is part of this source code package.
@author: David Moss
'''
from devices.device import Device
class CameraDevice(Device):
"""Camera Device"""
def __init__(self, botengine, device_id, d... | {
"content_hash": "b7ec2e860228742a4a8962d9a88fffdb",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 129,
"avg_line_length": 30.870967741935484,
"alnum_prop": 0.6530825496342738,
"repo_name": "peoplepower/composer-sdk-python",
"id": "aaf931e76c18f3741ed95395d9a2825fe87a2ef3"... |
from pages import settings
from django.contrib import admin
from django.forms import ModelForm
from django.core.urlresolvers import get_mod_func
import django
def get_connected():
if not settings.PAGE_CONNECTED_MODELS:
return []
models = []
for capp in settings.PAGE_CONNECTED_MODELS:
model... | {
"content_hash": "b83800697f2328135071efe84048d914",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 99,
"avg_line_length": 33.875,
"alnum_prop": 0.5928659286592866,
"repo_name": "ArabellaTech/django-page-cms",
"id": "895239230d7340d40bee2e68c4e1dd0102708ac4",
"size": "165... |
from django.test import TestCase
from django.core.urlresolvers import reverse
from django.utils.text import truncate_words
from django.contrib.auth.models import User
from userena.contrib.umessages.models import Message, MessageRecipient, MessageContact
class MessageContactTests(TestCase):
fixtures = ['users', 'm... | {
"content_hash": "18e8f42daebb7b8f9650e00104ac45ef",
"timestamp": "",
"source": "github",
"line_count": 59,
"max_line_length": 86,
"avg_line_length": 35.559322033898304,
"alnum_prop": 0.6310772163965681,
"repo_name": "pjdelport/django-userena",
"id": "fd025f199694c271c06dc4b69a42ec57358db03c",
"siz... |
import sys
import traceback
import re
from xml.etree import ElementTree
from xml.etree.ElementTree import ParseError
from urllib import urlencode
from twisted.internet.defer import inlineCallbacks
from twisted.web import http
from twisted.web.resource import Resource
from twisted.web.server import NOT_DONE_YET
from ... | {
"content_hash": "ab6607034c26ebbd5e80503327b4ef93",
"timestamp": "",
"source": "github",
"line_count": 143,
"max_line_length": 89,
"avg_line_length": 37.26573426573427,
"alnum_prop": 0.5792831675736536,
"repo_name": "texttochange/vusion-backend",
"id": "0e1309dd730a22ed21fc572bc23e7e32934f2167",
"... |
import typing as t
from dataclasses import (
InitVar,
dataclass,
field,
)
from .container import (
DIContext,
get_di_container,
)
from .errors import (
ConfigError,
DIErrors,
)
@dataclass(frozen=True)
class Inject:
"""
A class that can serve as:
* a descriptor for a `Comp... | {
"content_hash": "7db660ba1ac52be8af55a64dc8651835",
"timestamp": "",
"source": "github",
"line_count": 76,
"max_line_length": 99,
"avg_line_length": 28.81578947368421,
"alnum_prop": 0.5785388127853881,
"repo_name": "lhaze/dharma",
"id": "09f15f126d5b623ef16b9122981feb6e2b274848",
"size": "2190",
... |
from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
class UserPermissionforPageandReport(Document):
def get_custom_roles(self):
args = self.get_args()
self.set('roles', [])
name = frappe.db.get_value('Custom Role', args, "name")
if name:
doc = frappe.get_doc('C... | {
"content_hash": "c5edb4231c9f2228408bb8cb6ea5bbe6",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 70,
"avg_line_length": 24.844444444444445,
"alnum_prop": 0.6654740608228981,
"repo_name": "maxtorete/frappe",
"id": "7efe3397f6f46a1d27e50c06b0df70539aae3761",
"size": "125... |
'''
JSON related utilities.
This module provides a few things:
1) A handy function for getting an object down to something that can be
JSON serialized. See to_primitive().
2) Wrappers around loads() and dumps(). The dumps() wrapper will
automatically use to_primitive() for you if needed.
3) Th... | {
"content_hash": "ec7609b6f6ce948a61255f58769ef3a4",
"timestamp": "",
"source": "github",
"line_count": 169,
"max_line_length": 79,
"avg_line_length": 35.15384615384615,
"alnum_prop": 0.6310385456993772,
"repo_name": "subramani95/neutron",
"id": "581b8c051d944b2cf0c50fc20a61694af4409cc4",
"size": "... |
"""MediaPipe vision task base api."""
import math
from typing import Callable, Mapping, Optional
from mediapipe.framework import calculator_pb2
from mediapipe.python._framework_bindings import packet as packet_module
from mediapipe.python._framework_bindings import task_runner as task_runner_module
from mediapipe.tas... | {
"content_hash": "e658ed05f70cd006a15b764a3446a741",
"timestamp": "",
"source": "github",
"line_count": 180,
"max_line_length": 106,
"avg_line_length": 38.49444444444445,
"alnum_prop": 0.6868234954538894,
"repo_name": "google/mediapipe",
"id": "016170398259dba142ba0bf705dbd36acb6414be",
"size": "75... |
"""Define convex relaxations for primitives."""
import dataclasses
import functools
from typing import Callable, Optional, Sequence, Tuple, Union
import jax
from jax import lax
import jax.numpy as jnp
from jax_verify.src import bound_propagation
from jax_verify.src import mccormick
from jax_verify.src import synthetic... | {
"content_hash": "def437b4004b65f063c94f2d1fb0f57a",
"timestamp": "",
"source": "github",
"line_count": 556,
"max_line_length": 80,
"avg_line_length": 40.080935251798564,
"alnum_prop": 0.6689252860668611,
"repo_name": "deepmind/jax_verify",
"id": "cd8f8449b9fa571a6ac96f220cea80d684f0c9cf",
"size": ... |
'''
__author__ = "Stefan Stanacar"
__copyright__ = "Copyright 2014 Intel Corporation"
__credits__ = ["Stefan Stanacar"]
__license__ = "GPL"
__version__ = "2.0"
__maintainer__ = "Stefan Stanacar"
__email__ = "stefanx.stanacar@intel.com"
'''
from buildbot.steps.shell import ShellCommand
class RunOeSelftest(ShellComman... | {
"content_hash": "debd4ccbe43392b4b7cfd8d139f0196c",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 166,
"avg_line_length": 34.80769230769231,
"alnum_prop": 0.6353591160220995,
"repo_name": "denny820909/builder",
"id": "3d95583953f050a6d57fb89a1c6026dbfa8fac72",
"size": "... |
"""
Manage ceph with salt.
.. versionadded:: 2016.11.0
"""
import logging
import salt.utils.json
from salt.exceptions import CommandExecutionError, CommandNotFoundError
log = logging.getLogger(__name__)
def _unchanged(name, msg):
"""
Utility function: Return structure unchanged
"""
return {"name":... | {
"content_hash": "adc72f9d63934c91243867cd978e40fa",
"timestamp": "",
"source": "github",
"line_count": 79,
"max_line_length": 77,
"avg_line_length": 24.658227848101266,
"alnum_prop": 0.6319301848049281,
"repo_name": "saltstack/salt",
"id": "328e9f52e781cde82aa954a09e9d08300f18c574",
"size": "1948"... |
import asyncio
import configparser
import sys
import unittest
import peewee
# Testing module
import peewee_async
# Shortcuts
execute = peewee_async.execute
count = peewee_async.count
scalar = peewee_async.scalar
get_object = peewee_async.get_object
create_object = peewee_async.create_object
delete_object = peewee_asy... | {
"content_hash": "e26f2a8eb9fa2f9a817222af0c3a0d3e",
"timestamp": "",
"source": "github",
"line_count": 230,
"max_line_length": 99,
"avg_line_length": 28.917391304347827,
"alnum_prop": 0.5851751616298301,
"repo_name": "ezc/peewee-async",
"id": "11141fc2fc6548edb5fc4c0fe3b7b22048d943d8",
"size": "66... |
r"""
This code was generated by
\ / _ _ _| _ _
| (_)\/(_)(_|\/| |(/_ v1.0.0
/ /
"""
from twilio.base.version import Version
from twilio.rest.lookups.v1.phone_number import PhoneNumberList
class V1(Version):
def __init__(self, domain):
"""
Initialize the V1 version of Lookups... | {
"content_hash": "c7ecba25b9ca8b442725c66e268c5f24",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 67,
"avg_line_length": 24.121951219512194,
"alnum_prop": 0.5551061678463094,
"repo_name": "tysonholub/twilio-python",
"id": "b5a74c806caea475a7ad275636023aef04ad3430",
"siz... |
"""Pocketwalk shell interfaces."""
# [ Static Checking ]
# stop flake8 from complaining these imports aren't used. They're exposed as API.
# They're used.
# flake8: noqa
# [ Imports ]
from pocketwalk.shell.cancellation import Cancellation
from pocketwalk.shell.vcs import VCS
from pocketwalk.shell.config import Con... | {
"content_hash": "17a0e0b230f25ccf99e6b95be3e1a8a3",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 82,
"avg_line_length": 29.066666666666666,
"alnum_prop": 0.7912844036697247,
"repo_name": "toejough/pocketwalk",
"id": "d827d70da0c3ff20bf33a8c880a9607750387648",
"size": "... |
from swgpy.object import *
def create(kernel):
result = Creature()
result.template = "object/mobile/shared_dressed_hermit_of_tatooine.iff"
result.attribute_template_id = 9
result.stfName("npc_name","rodian_base_male")
#### BEGIN MODIFICATIONS ####
#### END MODIFICATIONS ####
return result | {
"content_hash": "96709e5a188ceefa849fca8fc2d6af2a",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 72,
"avg_line_length": 23.615384615384617,
"alnum_prop": 0.6970684039087948,
"repo_name": "obi-two/Rebelion",
"id": "e46e7d9adbf6ef0f42b4813560882b426a31faa7",
"size": "452... |
"""Unit tests for ComputeManager()."""
import copy
import datetime
import time
from cinderclient import exceptions as cinder_exception
from cursive import exception as cursive_exception
from eventlet import event as eventlet_event
import mock
import netaddr
import oslo_messaging as messaging
from oslo_serialization i... | {
"content_hash": "67e0f41d4da1d93b57d93870e514a833",
"timestamp": "",
"source": "github",
"line_count": 6076,
"max_line_length": 79,
"avg_line_length": 49.72432521395655,
"alnum_prop": 0.5920529582126604,
"repo_name": "Juniper/nova",
"id": "e01e51015d1a20fa46f145ab74da21c50cdb2cc8",
"size": "302698... |
"""Implementation of SQLAlchemy backend."""
import datetime as dt
import functools
import sys
import threading
import time
import uuid
import warnings
from oslo_config import cfg
from oslo_db import exception as db_exc
from oslo_db import options
from oslo_db.sqlalchemy import session as db_session
from oslo_log imp... | {
"content_hash": "924996de41eb3f19c32a3cba3934d79e",
"timestamp": "",
"source": "github",
"line_count": 4059,
"max_line_length": 79,
"avg_line_length": 34.55925104705592,
"alnum_prop": 0.5955829935270467,
"repo_name": "scottdangelo/RemoveVolumeMangerLocks",
"id": "622b7eb0d320f22109dd98131a0338f394c0... |
import os
import click
from . import fix
@click.command()
@click.argument('input_source', required=True)
def startup(input_source):
if os.path.isdir(input_source):
files_to_fix = get_source_files(input_source)
elif os.path.isfile(input_source):
files_to_fix = [input_source]
else:
... | {
"content_hash": "343474a9a1f02894fc48e526d4cf81ee",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 61,
"avg_line_length": 24.214285714285715,
"alnum_prop": 0.6268436578171092,
"repo_name": "pallets/flask-ext-migrate",
"id": "58f9a1daf12905a30925f1e0ab57630fa8eb5ab1",
"si... |
from trading_ig.rest import IGService
import responses
import json
import pandas as pd
import datetime
import pytest
"""
unit tests for historical prices methods with flat output formatting
"""
class TestHistoricalPricesFlat:
@responses.activate
def test_historical_prices_v3_defaults_happy(self):
#... | {
"content_hash": "7e4d78472cb07e0a15bc234d1d2c0fd5",
"timestamp": "",
"source": "github",
"line_count": 227,
"max_line_length": 104,
"avg_line_length": 40.23348017621145,
"alnum_prop": 0.573634074236286,
"repo_name": "femtotrader/ig-markets-stream-api-python-library",
"id": "7df63290f8bd5fb254054ca6c... |
"""Fixer for it.next() -> next(it), per PEP 3114."""
# Author: Collin Winter
# Things that currently aren't covered:
# - listcomp "next" names aren't warned
# - "with" statement targets aren't checked
# Local imports
from ..pgen2 import token
from ..pygram import python_symbols as syms
from .. import fi... | {
"content_hash": "c06a8e74374e1f366e136945058f0b77",
"timestamp": "",
"source": "github",
"line_count": 102,
"max_line_length": 77,
"avg_line_length": 31.941176470588236,
"alnum_prop": 0.5316144874155924,
"repo_name": "babyliynfg/cross",
"id": "1afb1aaf40b2c5415dc420325f62dc06fd84b59b",
"size": "32... |
from axolotl.state.signedprekeystore import SignedPreKeyStore
from axolotl.state.signedprekeyrecord import SignedPreKeyRecord
from axolotl.invalidkeyidexception import InvalidKeyIdException
class LiteSignedPreKeyStore(SignedPreKeyStore):
def __init__(self, dbConn):
"""
:type dbConn: Connection
... | {
"content_hash": "cbfc7aaf6bd61833882935745d364f0b",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 106,
"avg_line_length": 37.775862068965516,
"alnum_prop": 0.6576905522592423,
"repo_name": "biji/yowsup",
"id": "0a977c57592c45a890fe41ff87fce29c0b8aa9d7",
"size": "2191",
... |
"""Implements Hamming distance and loss."""
import tensorflow as tf
from tensorflow_addons.metrics.utils import MeanMetricWrapper
from tensorflow_addons.utils.types import FloatTensorLike, TensorLike, AcceptableDTypes
from typeguard import typechecked
from typing import Union, Optional
def hamming_distance(actuals:... | {
"content_hash": "761ba6e5ce8f337cb9352905ed4f6c56",
"timestamp": "",
"source": "github",
"line_count": 149,
"max_line_length": 87,
"avg_line_length": 34.29530201342282,
"alnum_prop": 0.5874755381604697,
"repo_name": "tensorflow/addons",
"id": "215bf9ce7aa5f13cc81ea4d77ea5be8e1e8c81a3",
"size": "57... |
from inputData import *
lights = [[0 for i in range(1000)] for j in range(1000)]
# This just needed slight modification.
def process_light(instruction, x, y):
type = instruction[0]
if type == 1:
lights[x][y] += 1
elif type == 2:
turn_off_light(x, y)
else:
lights[x][y] += 2
... | {
"content_hash": "5da5bc2e651bdef5d5f8ee64f1f235e8",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 59,
"avg_line_length": 21.3,
"alnum_prop": 0.5837245696400626,
"repo_name": "gytdau/advent",
"id": "77cbe98e3d782a8338fc614c46a4d8115c08f99d",
"size": "639",
"binary": fa... |
"""Broadlink entities."""
from homeassistant.helpers import device_registry as dr
from homeassistant.helpers.entity import DeviceInfo, Entity
from .const import DOMAIN
class BroadlinkEntity(Entity):
"""Representation of a Broadlink entity."""
_attr_should_poll = False
def __init__(self, device):
... | {
"content_hash": "1fe125aa55cae512aa15267959e276ce",
"timestamp": "",
"source": "github",
"line_count": 63,
"max_line_length": 83,
"avg_line_length": 33.698412698412696,
"alnum_prop": 0.6457842675459255,
"repo_name": "aronsky/home-assistant",
"id": "080cd5bab719022213853415c47ff2b7b0afa56f",
"size"... |
from datadog_checks.base.utils.models.fields import get_default_field_value
def shared_service(field, value):
return get_default_field_value(field, value)
def instance_application_name(field, value):
return 'datadog-agent'
def instance_aws(field, value):
return get_default_field_value(field, value)
... | {
"content_hash": "b65c3f725a9785109bc628f70cf36244",
"timestamp": "",
"source": "github",
"line_count": 177,
"max_line_length": 75,
"avg_line_length": 19.033898305084747,
"alnum_prop": 0.732264766993173,
"repo_name": "DataDog/integrations-core",
"id": "79579dd422069de59b1102603202d9473d54e97f",
"si... |
import pytest
from gamecology.public.forms import LoginForm
from gamecology.user.forms import RegisterForm
from .factories import UserFactory
class TestRegisterForm:
def test_validate_user_already_registered(self, user):
# Enters username that is already registered
form = RegisterForm(username=us... | {
"content_hash": "8a1247a197aa30769783e81ea39f024f",
"timestamp": "",
"source": "github",
"line_count": 60,
"max_line_length": 74,
"avg_line_length": 36.96666666666667,
"alnum_prop": 0.6749323715058612,
"repo_name": "karimtabet/gamecology",
"id": "a46a1f5403434790dd143319e620684de41e16f7",
"size": ... |
import os
from moto.xray import xray_backends
import aws_xray_sdk.core
from aws_xray_sdk.core.context import Context as AWSContext
from aws_xray_sdk.core.emitters.udp_emitter import UDPEmitter
class MockEmitter(UDPEmitter):
"""
Replaces the code that sends UDP to local X-Ray daemon
"""
def __init__(s... | {
"content_hash": "46159da9dd8e21c977e7b646c1002714",
"timestamp": "",
"source": "github",
"line_count": 102,
"max_line_length": 125,
"avg_line_length": 34.78431372549019,
"alnum_prop": 0.6476888387824127,
"repo_name": "spulec/moto",
"id": "eca1ffe5b579b37cad4c38eb0a0785d7ff11a1a7",
"size": "3548",
... |
"""
Routines for testing WSGI applications.
Most interesting is TestApp
"""
from __future__ import unicode_literals
import os
import re
import json
import random
import fnmatch
import mimetypes
from base64 import b64encode
from six import StringIO
from six import BytesIO
from six import string_types
from six import... | {
"content_hash": "4b20d0bbf8fd3c9a04f76b545661b10f",
"timestamp": "",
"source": "github",
"line_count": 726,
"max_line_length": 79,
"avg_line_length": 36.92837465564738,
"alnum_prop": 0.5447967176426707,
"repo_name": "marcoantoniooliveira/labweb",
"id": "b57814adab2930fb0acae3c3e85b885aca37ee4b",
"... |
"""
PlugIn for Nexus OS driver
"""
import logging
from quantum.common import exceptions as exc
from quantum.db import api as db
from quantum.openstack.common import importutils
from quantum.plugins.cisco.common import cisco_constants as const
from quantum.plugins.cisco.common import cisco_credentials_v2 as cred
from q... | {
"content_hash": "184b83b6a85b69b4535c50ee83cfa45d",
"timestamp": "",
"source": "github",
"line_count": 203,
"max_line_length": 79,
"avg_line_length": 37.98522167487685,
"alnum_prop": 0.5820256776034237,
"repo_name": "ruijie/quantum",
"id": "d73a70c11192b8f4d8cfb586417393ce32120ce3",
"size": "8487"... |
""" Loosely based on https://github.com/bottlepy/bottle/blob/cafc15419cbb4a6cb748e6ecdccf92893bb25ce5/bottle.py#L270 """
class lazy_loading(object):
"""Our lazy loading descriptor"""
def __init__(self, function):
self.function = function
def __get__(self, obj, type_):
if obj is None: retu... | {
"content_hash": "3a9307ec162da5385e9b03beb16cb083",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 120,
"avg_line_length": 31.620689655172413,
"alnum_prop": 0.6815703380588877,
"repo_name": "wswld/python-notes",
"id": "11992c9036c558b75f774cc994e8d1aa014dc095",
"size": "... |
"""
celery.app
~~~~~~~~~~
Celery Application.
"""
from __future__ import absolute_import
import os
from celery.local import Proxy
from celery import _state
from celery._state import (
get_current_app as current_app,
get_current_task as current_task,
connect_on_app_finalize, set_default_app, ... | {
"content_hash": "70b7d26a427a56a647f1eb5ca7d810f3",
"timestamp": "",
"source": "github",
"line_count": 149,
"max_line_length": 76,
"avg_line_length": 29.23489932885906,
"alnum_prop": 0.6134067952249771,
"repo_name": "johankaito/fufuka",
"id": "952a8746d08cdad220b94cc21bfbc979bed7099e",
"size": "43... |
from thrift.Thrift import TType, TMessageType, TFrozenDict, TException, TApplicationException
from thrift.protocol.TProtocol import TProtocolException
import sys
import airavata.model.commons.ttypes
import airavata.model.application.io.ttypes
from thrift.transport import TTransport
class ApplicationState(object):
... | {
"content_hash": "32a97df113d0dc251f9ec63fa3437671",
"timestamp": "",
"source": "github",
"line_count": 1366,
"max_line_length": 251,
"avg_line_length": 38.52269399707174,
"alnum_prop": 0.5295123712515678,
"repo_name": "apache/airavata",
"id": "70f7497706711910a8f8ee681d96d8dc81d6422e",
"size": "52... |
from pandac.PandaModules import *
from direct.showbase.DirectObject import DirectObject
from otp.nametag import NametagGlobals
class ClickablePopup(PandaNode, DirectObject):
CS_NORMAL = 0
CS_CLICK = 1
CS_HOVER = 2
CS_DISABLED = 3
def __init__(self, cam=None):
PandaNode.__init__(self, 'popu... | {
"content_hash": "f4c9e877e23fb79a2be5a9614ebbeded",
"timestamp": "",
"source": "github",
"line_count": 162,
"max_line_length": 90,
"avg_line_length": 33.91358024691358,
"alnum_prop": 0.5848198034219149,
"repo_name": "ksmit799/Toontown-Source",
"id": "ed9b8aecdbc8cf44f630f0d524225fda505ffe56",
"siz... |
"""
This module contains numerous plugin interfaces and the Extension points that
they extend. Included below is a list of interfaces available in this module.
Intefaces:
- ShelfI: Interface into the L{Shelf}
- MainWindowI: Interface into L{ed_main.MainWindow}
- AutoCompI: Interface for adding autocompletion hel... | {
"content_hash": "cc23e886d6fd7f2615bfa2f2179b2594",
"timestamp": "",
"source": "github",
"line_count": 162,
"max_line_length": 80,
"avg_line_length": 32.67283950617284,
"alnum_prop": 0.6066502928395995,
"repo_name": "DaniilLeksin/gc",
"id": "0e8b59ad6ba7d0f42787492c601ac7b2e30166d9",
"size": "5854... |
import logging
import requests
import re
from urllib.parse import urlsplit, urlunsplit, urljoin
_logger = logging.getLogger("spiralx.rest")
_logger.setLevel(logging.DEBUG)
# -------------------------------------------------------------
_has_scheme = lambda u: re.match(r"(?:https?:)?//", u) is not None
def slack_... | {
"content_hash": "fde915b0b69eb95177445067aec35bb0",
"timestamp": "",
"source": "github",
"line_count": 65,
"max_line_length": 110,
"avg_line_length": 25.446153846153845,
"alnum_prop": 0.528415961305925,
"repo_name": "spiralx/mypy",
"id": "7945e84ac77ed501741ba28a1738db2827a220a3",
"size": "1666",
... |
from __future__ import print_function
import scrapy
from scrapy.commands import ScrapyCommand
from scrapy.utils.versions import scrapy_components_versions
class Command(ScrapyCommand):
default_settings = {'LOG_ENABLED': False,
'SPIDER_LOADER_WARN_ONLY': True}
def syntax(self):
... | {
"content_hash": "f67d84451edc846b2716fd39a21215ad",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 86,
"avg_line_length": 30.939393939393938,
"alnum_prop": 0.6003917727717923,
"repo_name": "umrashrf/scrapy",
"id": "577365c3b3df1915d1bd9b64e4b6bcd63d2d263a",
"size": "1021... |
try:
import MySQLdb
except:
pass
from datetime import datetime, date
def flatten_list(result=[]):
'''将给定的查询结果(两列:中文,数值)打平为一行字符串
'''
assert(isinstance(result, list))
result_str = ' '.join([ '%s:%.1f' % (row[0], row[1]) for row in result ])
return result_str
def time_format(dt):
'''时间格式化,转为 str 类型,如果不是 datetime... | {
"content_hash": "826b53cbb7eb1d91f9be9c5bfa1f3873",
"timestamp": "",
"source": "github",
"line_count": 60,
"max_line_length": 113,
"avg_line_length": 24.9,
"alnum_prop": 0.6392235609103079,
"repo_name": "haolloyin/iPhoneChartsDemo",
"id": "cda8be5abaa822e4ceeccbd323650302df0386df",
"size": "1626",... |
import sqlite3
from plugit.utils import action, cache, only_logged_user, only_member_user, user_info, json_only, PlugItRedirect, PlugItSendFile, xml_only, crossdomain
# ## Basic sample service: polls
# Anonymous users can see polls
# Registered users can vote
# Members can create polls
# Administrators can see who sel... | {
"content_hash": "cc52c58ab297c7d4aeaa3cff77c1f5d4",
"timestamp": "",
"source": "github",
"line_count": 189,
"max_line_length": 151,
"avg_line_length": 31.497354497354497,
"alnum_prop": 0.632286242230808,
"repo_name": "ebu/PlugIt",
"id": "055c02b800457800c28795941809f9807e34193b",
"size": "5978",
... |
from __future__ import unicode_literals
import datetime
import os
import re
import unittest
from django.contrib.admin import ModelAdmin
from django.contrib.admin.helpers import ACTION_CHECKBOX_NAME
from django.contrib.admin.models import ADDITION, DELETION, LogEntry
from django.contrib.admin.options import TO_FIELD_V... | {
"content_hash": "1e53c062f6377d60ed3e1e98e6e08173",
"timestamp": "",
"source": "github",
"line_count": 6279,
"max_line_length": 251,
"avg_line_length": 48.09539735626692,
"alnum_prop": 0.632018834998394,
"repo_name": "ryangallen/django",
"id": "942f033b6fc669b9a4daf4935d79e807f6bc0415",
"size": "3... |
from distutils.core import setup
from distutils.command.build_scripts import build_scripts
from distutils.file_util import copy_file
class BuildScripts(build_scripts):
def run(self):
super(BuildScripts, self).run()
# content = open("bin/plano-self-test.in").read()
# content.replace(...)
... | {
"content_hash": "da25e8bc5f57cd30840328184ec80ca0",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 70,
"avg_line_length": 37.875,
"alnum_prop": 0.5896589658965896,
"repo_name": "ssorj/blinky",
"id": "a4dfc00cb33006fbc60b9b0ca1cc02939a76e596",
"size": "1718",
"binary": ... |
from __future__ import absolute_import
import collections
import functools
import logging
from ._collections import RecentlyUsedContainer
from .connectionpool import HTTPConnectionPool, HTTPSConnectionPool
from .connectionpool import port_by_scheme
from .exceptions import LocationValueError, MaxRetryError, Pro... | {
"content_hash": "3433b5164e92021148c838e3c45fb4d7",
"timestamp": "",
"source": "github",
"line_count": 440,
"max_line_length": 92,
"avg_line_length": 38.14772727272727,
"alnum_prop": 0.6047065832588621,
"repo_name": "ncos/lisa",
"id": "607ae0f70c1a37943653ff00802464874b608c96",
"size": "16785",
... |
import unittest
import numpy as np
from pyspark.ml.evaluation import ClusteringEvaluator, RegressionEvaluator
from pyspark.ml.linalg import Vectors
from pyspark.sql import Row
from pyspark.testing.mlutils import SparkSessionTestCase
class EvaluatorTests(SparkSessionTestCase):
def test_java_params(self):
... | {
"content_hash": "c8a7b9b0c0e6052b0cdd6a57530e4185",
"timestamp": "",
"source": "github",
"line_count": 46,
"max_line_length": 100,
"avg_line_length": 43.52173913043478,
"alnum_prop": 0.6573426573426573,
"repo_name": "wzhfy/spark",
"id": "7883df7882769368f015488802800b8f3aabf4d4",
"size": "2787",
... |
import sendgrid
import json
import os
sg = sendgrid.SendGridAPIClient(apikey=os.environ.get('SENDGRID_API_KEY'))
##################################################
# Retrieve email statistics by country and state/province. #
# GET /geo/stats #
params = {'end_date': '2016-04-01',
'country': 'US',
... | {
"content_hash": "0b68fbd95fd18a51f5a0f688d2666efc",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 74,
"avg_line_length": 26.523809523809526,
"alnum_prop": 0.5906642728904847,
"repo_name": "blackpioter/sendgrid-python",
"id": "78bf1552f8a773e1ab2c3fedafb8a8f5ff21d365",
"... |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [("request_token", "0005_auto_20160103_1655")]
operations = [
migrations.AlterModelOptions(
name="requesttokenlog",
options={
... | {
"content_hash": "f257ff7b161673cd529a5e931f869770",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 65,
"avg_line_length": 24.38888888888889,
"alnum_prop": 0.5763097949886105,
"repo_name": "yunojuno/django-expiring-links",
"id": "5a78f874d168abc3417fe3d77270f77015a231cf",
... |
from __future__ import absolute_import
from datetime import date, datetime # noqa: F401
from typing import List, Dict # noqa: F401
from tapi_server.models.base_model_ import Model
from tapi_server.models.tapi_topology_gettopologylist_output import TapiTopologyGettopologylistOutput # noqa: F401,E501
from tapi_serve... | {
"content_hash": "c54de5a74ee6488b9b220c6b16428696",
"timestamp": "",
"source": "github",
"line_count": 63,
"max_line_length": 120,
"avg_line_length": 30.41269841269841,
"alnum_prop": 0.6691022964509394,
"repo_name": "karthik-sethuraman/ONFOpenTransport",
"id": "12c84809059bdd09827bc89074fcb9bdca619e... |
import itk
from sys import argv
itk.auto_progress(2)
dim = 2
IType = itk.Image[itk.US, dim]
OIType = itk.Image[itk.UC, dim]
reader = itk.ImageFileReader[IType].New( FileName=argv[1] )
kernel = itk.strel(dim, 5)
filter = itk.BinaryErodeImageFilter[IType, IType, kernel].New( reader,
ErodeValue=200,
... | {
"content_hash": "fa39ddffffd356b39b67c01d55f82c27",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 71,
"avg_line_length": 28.647058823529413,
"alnum_prop": 0.6919917864476386,
"repo_name": "daviddoria/itkHoughTransform",
"id": "f94b97fc124c545ad492c2f261b8500b131a613f",
... |
"""Demo lock platform that has two fake locks."""
from homeassistant.const import STATE_LOCKED, STATE_UNLOCKED
from homeassistant.components.lock import SUPPORT_OPEN, LockDevice
async def async_setup_platform(hass, config, async_add_entities, discovery_info=None):
"""Set up the Demo lock platform."""
async_a... | {
"content_hash": "02e9af5220619f14548f842f254bbef1",
"timestamp": "",
"source": "github",
"line_count": 66,
"max_line_length": 86,
"avg_line_length": 28.227272727272727,
"alnum_prop": 0.6060118089103597,
"repo_name": "qedi-r/home-assistant",
"id": "923469f045c4009df3c7cb52635282547858c6ed",
"size":... |
__author__ = 'greg'
#don't mention subject_id because that MUST always be first
global_required_param = {"user_name":str,"time_stamp":str,}
required_param = dict()
required_param["animalMarking"] = dict(global_required_param.items() + {"animal":str}.items())
possible_param = dict()
possible_param["animalMarking"] = {"... | {
"content_hash": "b3e288a752fcd2864da94f4f9e535e7f",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 94,
"avg_line_length": 44.625,
"alnum_prop": 0.6946778711484594,
"repo_name": "zooniverse/aggregation",
"id": "214936a974795c63eef44e23d173854d12f669b5",
"size": "357",
"b... |
import os
import click
import shutil
from .configs import (
get_masters_count,
get_inventory_destination,
get_cluster_ips
)
from .utils import (
run_shell_cmd,
)
def copy_sample_inventory(target):
if not os.path.exists(target):
shutil.copytree('/opt/kubespray/inventory/sample', target)
@c... | {
"content_hash": "9c041f308a8753f0f85b433341483c29",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 113,
"avg_line_length": 32.2,
"alnum_prop": 0.6699201419698314,
"repo_name": "Magnitus-/ServerSetupScripts",
"id": "b784fe26e8ea712793dca622dd068d0696e7f7e6",
"size": "1127... |
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
import datetime
import mock
from dashboard.common import math_utils
from dashboard.pinpoint.models import job
from dashboard.pinpoint.models import job_state
from dashboard.pinpoint.models import timing_record... | {
"content_hash": "8c7bae3171e6ccaec3ede82ec0205c1c",
"timestamp": "",
"source": "github",
"line_count": 260,
"max_line_length": 77,
"avg_line_length": 28.842307692307692,
"alnum_prop": 0.5831444192559008,
"repo_name": "catapult-project/catapult",
"id": "ad6be9f859f8630a70db5c6983c399f17e847dc0",
"s... |
import args
from nose.tools import ok_
def compare_values(a, b):
ok_(a == b)
def test_args_all():
arguments = ['test', '--number', 'one', 'two', 'three']
arg = args.ArgsList(args = arguments)
ok_(arg.all == arguments)
def test_flags():
flags = ['--one', '--two']
arguments = [flags[0], 'a', fl... | {
"content_hash": "06ae81b56ca8d2b282055da51f8d6ad8",
"timestamp": "",
"source": "github",
"line_count": 63,
"max_line_length": 75,
"avg_line_length": 30.158730158730158,
"alnum_prop": 0.5826315789473684,
"repo_name": "kennethreitz/args",
"id": "7e1b7d2eee0eb21fa2c9a2b7f8c5a7ba8831b51d",
"size": "19... |
import argparse
import torch
from ort_utils import my_loss, transformer_model_description_dynamic_axes
from pt_model import TransformerModel
from utils import get_batch, prepare_data
import onnxruntime
def train(trainer, data_source, device, epoch, args, bptt=35):
total_loss = 0.0
for batch, i in enumerate(... | {
"content_hash": "9067c7e845917d5255840a4381a78d53",
"timestamp": "",
"source": "github",
"line_count": 89,
"max_line_length": 116,
"avg_line_length": 37.97752808988764,
"alnum_prop": 0.6177514792899408,
"repo_name": "microsoft/onnxruntime",
"id": "fdca0f20a9385ac8b6805bd720245187bcc19ce1",
"size":... |
"""
TODO: Switch to a fileformat class that iterates the source data, instead of loading
all into memory...
"""
# import builtins
import os
import csv
import codecs
import itertools
import warnings
# import fileformat modules
import shapefile as pyshp
class Shapefile(object):
def __init__(self, filepath, en... | {
"content_hash": "1b1bc2426a70ab4e78ae6e9f368c4998",
"timestamp": "",
"source": "github",
"line_count": 63,
"max_line_length": 95,
"avg_line_length": 26.714285714285715,
"alnum_prop": 0.5733808674985146,
"repo_name": "karimbahgat/PythonGis",
"id": "30b4f956dd16dbe1d691c3608ce4f36655029676",
"size":... |
import numpy
from celery import Celery
import time
from decimal import Decimal
celery_app = Celery('fibs', backend='amqp', broker='amqp://guest@localhost//')
@celery_app.task
def crappy_fib(num):
return str(do_crappy_fib(num))
def do_crappy_fib(num):
if num < 2:
return num
if num > 30:
... | {
"content_hash": "0bcee7abbaf5acf6d6a96eb15bc4e227",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 78,
"avg_line_length": 21.64,
"alnum_prop": 0.634011090573013,
"repo_name": "elbow-jason/thunder-bunny",
"id": "a7c76a74f7c93abe5f9e8fe71471dbc15cca8135",
"size": "542",
... |
from __future__ import absolute_import, division, print_function
import abc
import six
from cryptography.exceptions import UnsupportedAlgorithm, _Reasons
@six.add_metaclass(abc.ABCMeta)
class Ed448PublicKey(object):
@classmethod
def from_public_bytes(cls, data):
from cryptography.hazmat.backends.op... | {
"content_hash": "7e5c86f1a91674df2c53309845ca703e",
"timestamp": "",
"source": "github",
"line_count": 75,
"max_line_length": 72,
"avg_line_length": 28.546666666666667,
"alnum_prop": 0.6296123306865951,
"repo_name": "jinie/sublime-wakatime",
"id": "939157ab5901a48f8ee1fe078d5f5c040b5ed56b",
"size"... |
"""
This DAG will use Papermill to run the notebook "hello_world", based on the execution date
it will create an output notebook "out-<date>". All fields, including the keys in the parameters, are
templated.
"""
from __future__ import annotations
import os
from datetime import datetime, timedelta
import scrapbook as ... | {
"content_hash": "2acf38850070ffded8ab5c75c3ca4795",
"timestamp": "",
"source": "github",
"line_count": 62,
"max_line_length": 101,
"avg_line_length": 30.580645161290324,
"alnum_prop": 0.7083333333333334,
"repo_name": "nathanielvarona/airflow",
"id": "a4075754c38483e2c4fbfbc3ceb77005b214131b",
"siz... |
import argparse
from datetime import datetime, timezone
import github3
import os
import toml
import json
import re
from .database import Database
from . import utils
import logging
from threading import Thread, Lock
import time
import traceback
import requests
from contextlib import contextmanager
from functools import... | {
"content_hash": "ece0a9eff4e43018ace7adc879e089c0",
"timestamp": "",
"source": "github",
"line_count": 869,
"max_line_length": 185,
"avg_line_length": 37.863060989643266,
"alnum_prop": 0.5028112938029967,
"repo_name": "coupa/homu",
"id": "b277cfd2d86c9bbfc9a79f8e76d6ed2065180961",
"size": "32903",... |
"""Services implemented by the AWS provider."""
import ipaddress
import logging
import string
import uuid
from botocore.exceptions import ClientError
import tenacity
import cloudbridge.base.helpers as cb_helpers
from cloudbridge.base.middleware import dispatch
from cloudbridge.base.resources import ClientPagedResult... | {
"content_hash": "17bbcb6b2fcf538bf02973da7bcc595e",
"timestamp": "",
"source": "github",
"line_count": 1533,
"max_line_length": 87,
"avg_line_length": 41.50815394651011,
"alnum_prop": 0.6108718883580588,
"repo_name": "gvlproject/libcloudbridge",
"id": "525a3a07552a900dc1bc4d7340f1ed7215c39894",
"s... |
"""
Provides simple type check for resistive networks
"""
import numpy as np
from pyunicorn import ResNetwork
res = ResNetwork.SmallTestNetwork()
def testAdmittiveDegreeType():
print "testing types"
assert isinstance(res.admittive_degree(), np.ndarray)
| {
"content_hash": "90a1e4114c6e97e0273fd18813a8ac3b",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 57,
"avg_line_length": 17.8,
"alnum_prop": 0.7565543071161048,
"repo_name": "leftaroundabout/pyunicorn",
"id": "d035ff11df42fda8ddccbbfef3a9ca6fefdc069a",
"size": "423",
... |
"""Package containing the Python Aboard default services.
The services defined here are generic and can be useful for many different
applications. A developer can change a service behaviour by inheriting a
new service (with the same name) and replace some (or all) of its methods.
"""
from ext.aboard.service.default... | {
"content_hash": "ee37e7405caea44f75b2ecb070fc66fe",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 75,
"avg_line_length": 32.42857142857143,
"alnum_prop": 0.7951541850220264,
"repo_name": "v-legoff/pa-poc2",
"id": "e396b7655e629ff8cd8b607b8b426c667ff77988",
"size": "1997... |
import datetime
import os
#Returns a reformatted folder path
def getFolderPath(path):
#Replace the \ slashes with / so we don't get unicode errors
temp = path.replace('\\', '/')
#Add a / to the end if there isn't one
if temp[-1:] != "/":
temp += "/"
return temp
#checks if date is in range
#t... | {
"content_hash": "8dfffc020ab81f36ba134e1d3e50339f",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 132,
"avg_line_length": 38.735849056603776,
"alnum_prop": 0.5927910375060886,
"repo_name": "nomadpenguins/opeNPSnake",
"id": "f2f11ddb3373bf94d3c5a5c0fa7de7670c742c15",
"si... |
"""
Example Airflow DAG for testing Google Dataflow Beam Pipeline Operator with Python.
"""
from __future__ import annotations
import os
from datetime import datetime
from pathlib import Path
from airflow import models
from airflow.providers.apache.beam.operators.beam import BeamRunPythonPipelineOperator
from airflow... | {
"content_hash": "75be41e0f40eacae6fafd2e110bcbb9c",
"timestamp": "",
"source": "github",
"line_count": 105,
"max_line_length": 105,
"avg_line_length": 31.047619047619047,
"alnum_prop": 0.6677914110429448,
"repo_name": "apache/airflow",
"id": "c53fde5505a1cbca509dd657d3889df70d6ad979",
"size": "404... |
"""Drop NSX table in favor of the extra_attributes one
Revision ID: 884573acbf1c
Revises: 5589aa32bf80
Create Date: 2013-01-07 13:47:29.093160
"""
revision = '884573acbf1c'
down_revision = '5589aa32bf80'
from alembic import op
import sqlalchemy as sa
def _migrate_data(old_table, new_table):
engine = op.get_b... | {
"content_hash": "a879ec888c1c1437fb0b117fd513e807",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 71,
"avg_line_length": 38.12068965517241,
"alnum_prop": 0.5852555404794211,
"repo_name": "jumpstarter-io/neutron",
"id": "2d1938b9ac3a54263032aa9c9df9522914d65279",
"size":... |
import unittest
import pandas as pd
import pandas.util.testing as pdt
import qiime2
from qiime2.plugins import dummy_plugin
class TestProvenanceIntegration(unittest.TestCase):
def test_chain_with_metadata(self):
df = pd.DataFrame({'a': ['1', '2', '3']}, index=['0', '1', '2'])
a = qiime2.Artifac... | {
"content_hash": "97ae80b6c40f9c5a623298da46ba8596",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 79,
"avg_line_length": 30.647058823529413,
"alnum_prop": 0.5969289827255279,
"repo_name": "nervous-laughter/qiime2",
"id": "6dae5c05abe843113cd1eb6077353e196e6edf91",
"size... |
"""The tests for the Entity component helper."""
# pylint: disable=protected-access
import asyncio
from collections import OrderedDict
import logging
import unittest
from unittest.mock import patch, Mock, MagicMock
from datetime import timedelta
import homeassistant.core as ha
import homeassistant.loader as loader
fro... | {
"content_hash": "a56bc3c3863ccd01b535361128935340",
"timestamp": "",
"source": "github",
"line_count": 580,
"max_line_length": 79,
"avg_line_length": 34.686206896551724,
"alnum_prop": 0.6177055373297544,
"repo_name": "MungoRae/home-assistant",
"id": "11717c75e202979b08799e4d895448e3ed78a50e",
"siz... |
import uuid
from msrest.pipeline import ClientRawResponse
from msrestazure.azure_exceptions import CloudError
from msrestazure.azure_operation import AzureOperationPoller
from .. import models
class GlobalSchedulesOperations(object):
"""GlobalSchedulesOperations operations.
:param client: Client for service... | {
"content_hash": "98abf728d53f1364ee0683b0dc990d78",
"timestamp": "",
"source": "github",
"line_count": 615,
"max_line_length": 152,
"avg_line_length": 45.920325203252034,
"alnum_prop": 0.63298041854042,
"repo_name": "AutorestCI/azure-sdk-for-python",
"id": "df426fa2316432c0a72a5f562664da985b5fc0f8",... |
__author__ = 'wittawat'
from abc import ABCMeta, abstractmethod
import math
#import matplotlib.pyplot as plt
import numpy as np
import util
import matplotlib.pyplot as plt
import scipy.stats as stats
class PairedData(object):
"""Class representing paired data for independence testing
properties:
X, Y: nu... | {
"content_hash": "296795c8d4f0227af5932c84f60b533f",
"timestamp": "",
"source": "github",
"line_count": 787,
"max_line_length": 111,
"avg_line_length": 29.7712833545108,
"alnum_prop": 0.5491677336747759,
"repo_name": "Diviyan-Kalainathan/dependency_criteria",
"id": "5a91554720c167f2c6b881b4b73f5db062... |
"""This module contains Google Dataproc operators."""
from __future__ import annotations
import inspect
import ntpath
import os
import re
import time
import uuid
import warnings
from datetime import datetime, timedelta
from typing import TYPE_CHECKING, Sequence
from google.api_core import operation # type: ignore
fr... | {
"content_hash": "509a1619b6e783b8d23528dd10c0f8cc",
"timestamp": "",
"source": "github",
"line_count": 2339,
"max_line_length": 118,
"avg_line_length": 44.12740487387772,
"alnum_prop": 0.6352432809502587,
"repo_name": "apache/airflow",
"id": "24ca7de40100d122aea6b16a5d9637db78014a7b",
"size": "104... |
from manila.api import common
class ViewBuilder(common.ViewBuilder):
"""Model a server API response as a python dictionary."""
_collection_name = 'share_instances'
def detail_list(self, request, instances):
"""Detailed view of a list of share instances."""
return self._list_view(self.det... | {
"content_hash": "b250936f136b6cd013d6dfe2cb288094",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 79,
"avg_line_length": 41.84090909090909,
"alnum_prop": 0.5866376969038566,
"repo_name": "jcsp/manila",
"id": "f23bdd852571178bb72b8baef995487fd5de79c9",
"size": "2414",
... |
from django.test import TestCase
from django.core.urlresolvers import reverse
from django.db.models import signals
from hypermap.aggregator.models import Service, Layer, Catalog
from hypermap.aggregator.models import layer_post_save, service_post_save
SERVICE_NUMBER = 2
LAYER_PER_SERVICE_NUMBER = 2
TIMES_TO_CHECK =... | {
"content_hash": "57b135224a09065d840fabf39a819c90",
"timestamp": "",
"source": "github",
"line_count": 78,
"max_line_length": 85,
"avg_line_length": 34.243589743589745,
"alnum_prop": 0.5735679520778735,
"repo_name": "cga-harvard/HHypermap",
"id": "15f259cd595f71e208318c37c0b5eadfe6c6ca72",
"size":... |
from __future__ import annotations
from pre_commit_mirror_maker.languages import node_get_package_versions
from pre_commit_mirror_maker.languages import python_get_package_versions
from pre_commit_mirror_maker.languages import ruby_get_package_versions
from pre_commit_mirror_maker.languages import rust_get_package_ver... | {
"content_hash": "356e4fb4103bd8070dad37d83e3d2876",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 73,
"avg_line_length": 27.34285714285714,
"alnum_prop": 0.7345872518286312,
"repo_name": "pre-commit/pre-commit-mirror-maker",
"id": "8f5833ff1ebe0b753bae078fd04981876271e24d... |
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('query', '0007_auto_20150611_1211'),
]
operations = [
migrations.CreateModel(
name='Period',
fields=[
('id', ... | {
"content_hash": "d7d06affefbf26fa4f90f6bd41a7b5ad",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 114,
"avg_line_length": 27.36,
"alnum_prop": 0.5248538011695907,
"repo_name": "UUDigitalHumanitieslab/texcavator",
"id": "9ccc9e562342c6e39a24ecd09742b147b50cbc24",
"size":... |
from __future__ import print_function
import errno
import os.path
import sys
import json
from traitlets.config.application import Application
from jupyter_core.application import (
JupyterApp, base_flags, base_aliases
)
from traitlets import Instance, Dict, Unicode, Bool, List
from . import __version__
from .ker... | {
"content_hash": "e69149c5ee882c2e37fd7bfb4bbd5d18",
"timestamp": "",
"source": "github",
"line_count": 273,
"max_line_length": 103,
"avg_line_length": 37.223443223443226,
"alnum_prop": 0.5827592993505215,
"repo_name": "lancezlin/ml_template_py",
"id": "595cf9573e0cd4b8671ee412ced5989a6e96b937",
"s... |
"""import3031.py - Script to import the backup into Gluu Server 3.0.x
Usage: python import3031.py <path_to_backup_folder>
Example: python import3031.py /root/backup_3031
This script imports the data from backup folder generated by export3031.py.
Read complete migration procedure at:
https://www.gluu.org/docs/depl... | {
"content_hash": "fe3253d647c3f65fb581bf5b3e90df78",
"timestamp": "",
"source": "github",
"line_count": 1265,
"max_line_length": 416,
"avg_line_length": 41.61897233201581,
"alnum_prop": 0.5379501595502203,
"repo_name": "GluuFederation/community-edition-setup",
"id": "6383af8a26dc47eb6027c8e76452275a5... |
import csv
import pydoc
import subprocess
import tempfile
class Analyzer():
'''Analyze sequences in fasta file by RDP Classifier.
Parameters
----------
fasta_file : str
Path to the fasta file containing sequences to be analyzed (default: None)
analyzer_file : str
Path to the RDP C... | {
"content_hash": "2412a3190ac2c898896c8eb0a5b2c532",
"timestamp": "",
"source": "github",
"line_count": 191,
"max_line_length": 89,
"avg_line_length": 36.66492146596859,
"alnum_prop": 0.5741824932171926,
"repo_name": "vrbacky/proceseq_16s",
"id": "9ff6f1a5d73d561a6fda94fdab1ba36584cc9a4f",
"size": ... |
from helpers.tree import BinNode
from helpers.utils import load_matrix
from helpers.utils import build_path | {
"content_hash": "604060d9ba40349d5423355e332f5b58",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 37,
"avg_line_length": 35.666666666666664,
"alnum_prop": 0.8504672897196262,
"repo_name": "ikumen/project-euler",
"id": "3aad682acc7f6375930a7e633cdfbe52db33390c",
"size": "... |
try:
from AG_fft_tools import correlate2d,fast_ffts
from AG_fft_tools import dftups,upsample_image,shift
except ImportError:
from image_registration.fft_tools import correlate2d,fast_ffts
from image_registration.fft_tools import dftups,upsample_image,shift
import warnings
import numpy as np
__all__ = ... | {
"content_hash": "9650286047dfc87283000dd9242efaca",
"timestamp": "",
"source": "github",
"line_count": 330,
"max_line_length": 171,
"avg_line_length": 43.25757575757576,
"alnum_prop": 0.5944658493870403,
"repo_name": "alexlib/image_registration",
"id": "24790a1630f5001c3e47eff80087a00b5ba0b818",
"... |
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('logging', '0006_event_feed'),
]
operations = [
migrations.AlterUniqueTogether(name='alert', unique_together=set([]),),
migrations.RemoveField(model_name='alert', name='content_type',),
... | {
"content_hash": "8633462f739002b65b861880bedf6110",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 79,
"avg_line_length": 26.357142857142858,
"alnum_prop": 0.6449864498644986,
"repo_name": "opennode/nodeconductor-assembly-waldur",
"id": "09a90948b8c9f3b424feee4ec19ae10fe6e... |
import warnings
warnings.warn("The regcheck module has been pending deprecation since build 210",
category=PendingDeprecationWarning)
import win32con
import regutil
import win32api
import os
import sys
def CheckRegisteredExe(exename):
try:
os.stat(win32api.RegQueryValue(regutil.GetRootKey() ... | {
"content_hash": "cdc4922f8187f8daace984c997163651",
"timestamp": "",
"source": "github",
"line_count": 122,
"max_line_length": 120,
"avg_line_length": 28.31967213114754,
"alnum_prop": 0.678726483357453,
"repo_name": "facelessuser/Pywin32",
"id": "e3879cd1b87826d642b5cedaecf561a30f50fdfe",
"size": ... |
"""Tests to check annotation consistency
"""
from __future__ import print_function
import unittest
import csv
import os
import glob
import numpy as np
from medleydb import AUDIO_AVAILABLE
from medleydb import ANNOT_PATH
from medleydb import MultiTrack
from medleydb import TRACK_LIST_V1
from medleydb.annotate import m... | {
"content_hash": "c9468dda1478ee762b0bb8b0e79bee43",
"timestamp": "",
"source": "github",
"line_count": 119,
"max_line_length": 77,
"avg_line_length": 35.621848739495796,
"alnum_prop": 0.6416607690493041,
"repo_name": "marl/medleydb",
"id": "b63b25737b0a201276e09a253939d3b73deb1b4b",
"size": "4239"... |
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('shipping', '0009_auto_20180629_1055'),
]
operations = [
migrations.AlterModelOptions(
name='shippingmethod',
options={'permissions': (('manage_shipping', 'Manage shipping.')... | {
"content_hash": "fb1b96ec846a75634ea4bf7738baa3e2",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 80,
"avg_line_length": 22.8,
"alnum_prop": 0.5906432748538012,
"repo_name": "UITools/saleor",
"id": "874fa4db516e8f2a8417c645b0e3d50693e946b6",
"size": "391",
"binary": f... |
import wx
from cairis.core.armid import *
from cairis.core.ARM import *
from RiskEnvironmentListCtrl import RiskEnvironmentListCtrl
from DimensionListCtrl import DimensionListCtrl
from cairis.core.MitigateEnvironmentProperties import MitigateEnvironmentProperties
__author__ = 'Shamal Faily'
class MitigateEnvironmentP... | {
"content_hash": "55ac2e9c4f550666bd28cd1754089778",
"timestamp": "",
"source": "github",
"line_count": 171,
"max_line_length": 177,
"avg_line_length": 43.64912280701754,
"alnum_prop": 0.7471864951768489,
"repo_name": "nathanbjenx/cairis",
"id": "586107ef9270139ea3703bb83483c1400b447e96",
"size": "... |
import sys
import socket
import unittest
import udt
import _udt
class TestSocket(unittest.TestCase):
def create_socket(self):
return udt.socket(socket.AF_INET, socket.SOCK_STREAM, 0)
def create_int_socket(self):
return _udt.socket(socket.AF_INET, socket.SOCK_STREAM, 0)
def test_init(... | {
"content_hash": "64bdf9a7fdde322fbf808552ec9f9239",
"timestamp": "",
"source": "github",
"line_count": 205,
"max_line_length": 85,
"avg_line_length": 30.68780487804878,
"alnum_prop": 0.5954538229216341,
"repo_name": "beano/udt_py",
"id": "fb53986c08eccddd4997d026452db16890f20eac",
"size": "6314",
... |
"""This code example updates the notes of each order up to the first 500. To
determine which orders exist, run get_all_orders.py."""
__author__ = 'api.shamjeff@gmail.com (Jeff Sham)'
# Locate the client library. If module was installed via "setup.py" script, then
# the following two lines are not needed.
import os
im... | {
"content_hash": "eeea34759461da5cf98ceaa7336c3cea",
"timestamp": "",
"source": "github",
"line_count": 54,
"max_line_length": 80,
"avg_line_length": 31.72222222222222,
"alnum_prop": 0.6760070052539404,
"repo_name": "lociii/googleads-python-lib",
"id": "eceb61bf3653c09c94378cc480d403fc8ee288cb",
"s... |
from pyramid.settings import asbool, aslist
from .controller import DescribeController
from .util import pick, resolve
GLOBAL_PREFIX = 'describe'
OPTION_PREFIXES_NAME = GLOBAL_PREFIX + '.prefixes'
OPTION_PREFIXES_DEFAULT = 'describe'
OPTION_CLASS_NAME = GLOBAL_PREFIX + '.class'
OPTION_CLASS_DEFAULT ... | {
"content_hash": "f6557e8136b6c9a7dad566485a4152cf",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 80,
"avg_line_length": 39.57575757575758,
"alnum_prop": 0.6278713629402757,
"repo_name": "cadithealth/pyramid_describe",
"id": "e8c653b7eb0d9799dc84c9da0ca12573d786694a",
"... |
'''copyleft.py
--------------
Copyright information for python-gnupg.
'''
from __future__ import absolute_import
from . import _util
authors = { 'lovecruft_isis': _util.author_info(
'Isis Agora Lovecruft', 'isis@leap.se', '0xA3ADB67A2CDB8B35'),
'sajip_vinay': _util.author_info(
... | {
"content_hash": "a0474bafb36a3712d94abb5a4eb9b6d9",
"timestamp": "",
"source": "github",
"line_count": 730,
"max_line_length": 79,
"avg_line_length": 50.556164383561644,
"alnum_prop": 0.7868097328347694,
"repo_name": "82604716/shadowsicks",
"id": "6e81e1cb69e9c843c174d22ea2a2022db9ff384c",
"size":... |
import pytest
from selenium import webdriver
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
@pytest.fixture
def driver(request):
wd = webdriver.Firefox()
request.addfinalizer(wd.quit,20,10)
return wd
def test_example(driver):
... | {
"content_hash": "e06d665f2413edd85366b02106292b82",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 78,
"avg_line_length": 31.944444444444443,
"alnum_prop": 0.7408695652173913,
"repo_name": "olga121/Selenium_Webdriver",
"id": "496236500d1a3829f2f509bda601899d7d1f574d",
"s... |
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import symbol_database as _symbol_database
from google.pr... | {
"content_hash": "5eb7695a4fc3724f152c4b86b5bb7dc4",
"timestamp": "",
"source": "github",
"line_count": 87,
"max_line_length": 244,
"avg_line_length": 32.804597701149426,
"alnum_prop": 0.7049754730203224,
"repo_name": "AnsgarSchmidt/antikeimena",
"id": "4a094c1d7b7aa87a80ab10ea8aa5d74b1952896e",
"s... |
from .base import AbstractPositionSizer
class FractionalPositionSizer(AbstractPositionSizer):
def __init__(
self, fraction=1.0, use_dvar=False,
dollar_per_contract=0.0, units_per_position=1
):
self.fraction = fraction
self.use_dvar = use_dvar
self.dollar_per_con... | {
"content_hash": "61e4870c05dc7bfae49e1ac7c6345ea8",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 84,
"avg_line_length": 37.18181818181818,
"alnum_prop": 0.6034229828850856,
"repo_name": "nwillemse/nctrader",
"id": "24d63f404c1464fd70141b6924e11246e222386b",
"size": "20... |
from languages.asp.answer_sets import AnswerSets
import re
from languages.asp.answer_set import AnserSet
import traceback
class ClingoAnswerSets(AnswerSets):
"""Represents Clingo's answersets"""
def __init__(self, out, err=None):
super(ClingoAnswerSets, self).__init__(out, err)
def _p... | {
"content_hash": "add1ca6d4581ef2de6de81f8edcd7458",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 121,
"avg_line_length": 35.73076923076923,
"alnum_prop": 0.48277717976318624,
"repo_name": "SimoneLucia/EmbASP-Python",
"id": "3be66f752293f1a2f3172f718cddeaf0f265f70a",
"s... |
import sys
import socket
import traceback
import urllib
import struct
####
## You might find it useful to define variables that store various
## stack or function addresses from the zookd / zookfs processes,
## which you can then use in build_exploit(); the following are just
## examples.
stack_buffer = 0x34567890
s... | {
"content_hash": "9722b9a903437aa4c8daae385da81bfc",
"timestamp": "",
"source": "github",
"line_count": 85,
"max_line_length": 119,
"avg_line_length": 28.376470588235293,
"alnum_prop": 0.6467661691542289,
"repo_name": "emzhang/6858lab2",
"id": "b14500bde7fc512e7cb8d2cdc00229e250c6e818",
"size": "24... |
"""
The :class:`DXObject` class is the abstract base class for all remote
object handlers, and its subclass :class:`DXDataObject` is the abstract
base class for all remote data object handlers.
"""
from __future__ import print_function, unicode_literals, division, absolute_import
import time, copy, re
import dxpy.ap... | {
"content_hash": "688924b0723b6f0510d6672da8081214",
"timestamp": "",
"source": "github",
"line_count": 684,
"max_line_length": 209,
"avg_line_length": 36.83771929824562,
"alnum_prop": 0.6059451522006588,
"repo_name": "dnanexus/dx-toolkit",
"id": "3f4f012b68e1b8c8884f5e78126e958d6799fa67",
"size": ... |
"""Common decoder interface."""
import collections
import lingvo.compat as tf
from lingvo.core import base_layer
from lingvo.core import beam_search_helper
from lingvo.core import py_utils
from lingvo.core import target_sequence_sampler
# metrics: Dict[Text, Tuple[float, float]] A dict of named metrics, which must
#... | {
"content_hash": "48fe2b2682ec0d00942dcc66463fcf2f",
"timestamp": "",
"source": "github",
"line_count": 841,
"max_line_length": 89,
"avg_line_length": 42.979785969084425,
"alnum_prop": 0.6623416145631605,
"repo_name": "tensorflow/lingvo",
"id": "3f9673ac728e76b3f67f13431adf101183926c3e",
"size": "3... |
import sys
try:
from django.conf import settings
settings.configure(
DEBUG=True,
USE_TZ=True,
DATABASES={
"default": {
"ENGINE": "django.db.backends.sqlite3",
}
},
ROOT_URLCONF="oscar_payonline.urls",
INSTALLED_APPS=[
... | {
"content_hash": "6c832a6a1152d08f49b33534bf73d31f",
"timestamp": "",
"source": "github",
"line_count": 54,
"max_line_length": 85,
"avg_line_length": 21.35185185185185,
"alnum_prop": 0.5585429314830876,
"repo_name": "okfish/django-oscar-payonline",
"id": "887f82bf4307dddc3407ce9202d773e7a2113836",
... |
from argparse import ArgumentParser
import bisect
from datetime import datetime
from datetime import timedelta
import prettytable
import sys
from textwrap import dedent
from launchpadlib.launchpad import Launchpad
import pytz
from reviewstats import utils
offsets = {
'critical': 1,
'high': 2,
'undecided... | {
"content_hash": "4d6ac1a93b63e7d436a79fe20d300b3d",
"timestamp": "",
"source": "github",
"line_count": 191,
"max_line_length": 79,
"avg_line_length": 40.774869109947645,
"alnum_prop": 0.5910374935798665,
"repo_name": "openstack-infra/reviewstats",
"id": "9a1c6acfd673a2fd89e77463de261f050337750d",
... |
default_app_config = 'tests.core.plugins.another_plugin.apps.AnotherPluginConfig'
| {
"content_hash": "ff2e62ef09a8917daeb7c91db0c086de",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 81,
"avg_line_length": 82,
"alnum_prop": 0.8292682926829268,
"repo_name": "lsj1292/Abacus",
"id": "7815e36df5ac2fb1aaaf41498a362d3e045f543a",
"size": "82",
"binary": false... |
from django.db import models
class Device(models.Model):
owner = models.TextField()
live_url = models.URLField(null=True)
| {
"content_hash": "df1361a7b5abeb5dc8aca9dd645d2356",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 41,
"avg_line_length": 19,
"alnum_prop": 0.7142857142857143,
"repo_name": "easyCZ/SLIP-A-2015",
"id": "92edd85d755b0c57e14249e5a5cabad999cae7ac",
"size": "133",
"binary": ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.