text stringlengths 4 1.02M | meta dict |
|---|---|
"""
The MIT License (MIT)
Copyright (c) 2015-2019 Rapptz
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, modify, merge, ... | {
"content_hash": "c60237508943f279f32f333073686ad5",
"timestamp": "",
"source": "github",
"line_count": 628,
"max_line_length": 118,
"avg_line_length": 34.97452229299363,
"alnum_prop": 0.5891458750682935,
"repo_name": "imayhaveborkedit/discord.py",
"id": "556e41cabda8882943771d5030e49fb54da5a50d",
... |
'''
Program: tempsPlotly.py
Author: Jeff VanSickle
Created: 20160811
Modified: 20170130
Program creates visualization of temperature data using tempsDB.sqlite as
source. Visualization created using Plotly, cribbed from examples that were
themselves cribbed from examples.
https://plot.ly/python/lin... | {
"content_hash": "b1c60c24fbee0f7a57c1bda963e3b6e1",
"timestamp": "",
"source": "github",
"line_count": 222,
"max_line_length": 82,
"avg_line_length": 35.486486486486484,
"alnum_prop": 0.6482609799441482,
"repo_name": "vsx-gh/PfE_Capstone",
"id": "36ece47553118bd30051655def2085d12819f1f8",
"size": ... |
from django.contrib.auth.models import User
print User.objects.count() | {
"content_hash": "2425fccd964b314340237adca8ed278b",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 43,
"avg_line_length": 23.666666666666668,
"alnum_prop": 0.8169014084507042,
"repo_name": "weigj/django-multidb",
"id": "8f81cf35e17ffe747b4507f1128c7d8bfb7d4aef",
"size": "... |
"""Base class for nbviewer tests.
Derived from IPython.html notebook test case in 2.0
"""
#-----------------------------------------------------------------------------
# Copyright (C) 2013 The IPython Development Team
#
# Distributed under the terms of the BSD License. The full license is in
# the file COPYING, ... | {
"content_hash": "5beaeab05e27450370f2c21f30d0cefa",
"timestamp": "",
"source": "github",
"line_count": 128,
"max_line_length": 78,
"avg_line_length": 26.8203125,
"alnum_prop": 0.5653946985144189,
"repo_name": "christophelec/nbviewer",
"id": "31e522863ea6678e86db6591c02c8dc331438152",
"size": "3433... |
"""Simple pattern matcher for man-like command synopsis.
A synopsis pattern is made of several kind of tokens:
- place-holders : words spelled in lower cases are assumed to
be place-holders for user supplied values. The same
place-holder might appends several times in the same
synopsis. In that case all u... | {
"content_hash": "64de2c9060404582009cedf45ebce7b3",
"timestamp": "",
"source": "github",
"line_count": 311,
"max_line_length": 83,
"avg_line_length": 28.073954983922828,
"alnum_prop": 0.548047188180048,
"repo_name": "s-leroux/sql-moins",
"id": "51a0a916c4d56a0ec6ce1c96811675259abdb0ed",
"size": "8... |
"""Utility functions for Web2Executable
This module holds utility functions that are useful to both the command line
and GUI modules, but aren't related to either module.
"""
from __future__ import print_function
import os
import zipfile
import io
import platform
import urllib.request as request
import tempfile
import... | {
"content_hash": "21dba7574906bc634ea7f718e61444fa",
"timestamp": "",
"source": "github",
"line_count": 279,
"max_line_length": 78,
"avg_line_length": 29.734767025089607,
"alnum_prop": 0.5888379942140791,
"repo_name": "jyapayne/Web2Executable",
"id": "9a41cb771994f58a8fb66256b242a7a34ee2aa83",
"siz... |
from __future__ import absolute_import
from __future__ import print_function
import inspect
from ..task import Task
from .. import utils
def command(parent_parser):
parser = parent_parser.add_parser(
'task',
help=inspect.getdoc(Task))
subcommands = [
]
subparsers = parser.add_subparsers()
... | {
"content_hash": "0b4ed5f33293337ca72f744914538202",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 38,
"avg_line_length": 19.1,
"alnum_prop": 0.693717277486911,
"repo_name": "karth295/yaas",
"id": "60c339b68e41ef5744c9dff407b1ebd1cdaf4624",
"size": "399",
"binary": fal... |
import abc
import functools
import os
import fixtures
from oslotest import base as test_base
import six
from murano.openstack.common.db.sqlalchemy import provision
from murano.openstack.common.db.sqlalchemy import session
from murano.openstack.common.db.sqlalchemy import utils
class DbFixture(fixtures.Fixture):
... | {
"content_hash": "51acfaae743250a18a2c3836692ec123",
"timestamp": "",
"source": "github",
"line_count": 150,
"max_line_length": 77,
"avg_line_length": 30.293333333333333,
"alnum_prop": 0.6558098591549296,
"repo_name": "ativelkov/murano-api",
"id": "d37f3cf4d599c3e118322ab4828704e9a1c94bb7",
"size":... |
"""Read status of growatt inverters."""
from __future__ import annotations
from dataclasses import dataclass
import datetime
import json
import logging
import re
import growattServer
from homeassistant.components.sensor import (
STATE_CLASS_TOTAL_INCREASING,
SensorEntity,
SensorEntityDescription,
)
from ... | {
"content_hash": "37493fbab7197a2d7ba9054e7bb346b3",
"timestamp": "",
"source": "github",
"line_count": 1051,
"max_line_length": 144,
"avg_line_length": 34.46241674595623,
"alnum_prop": 0.6250138045278851,
"repo_name": "sander76/home-assistant",
"id": "03da4fe4b570b6b09f75dc444922833f474d5378",
"si... |
"""Support for IP Cameras."""
import asyncio
import logging
import aiohttp
import async_timeout
import requests
from requests.auth import HTTPDigestAuth
import voluptuous as vol
from homeassistant.components.camera import (
DEFAULT_CONTENT_TYPE,
PLATFORM_SCHEMA,
SUPPORT_STREAM,
Camera,
)
from homeassi... | {
"content_hash": "b00493dcc88dd698320d65a62029b1fb",
"timestamp": "",
"source": "github",
"line_count": 163,
"max_line_length": 86,
"avg_line_length": 35.61963190184049,
"alnum_prop": 0.6260764726145367,
"repo_name": "leppa/home-assistant",
"id": "3d39d75ff4a49d0fc19b2d207dbf33cec51ac515",
"size": ... |
from setuptools import setup, find_packages
setup(
author='Chris Pickett',
author_email='chris.pickett@gmail.com',
classifiers=[
'Development Status :: 3 - Alpha',
'Environment :: Web Environment',
'Intended Audience :: Developers',
'License :: OSI Approved :: MIT License',
... | {
"content_hash": "3851827b8763cf87d82bdecc4745b6af",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 81,
"avg_line_length": 34.52,
"alnum_prop": 0.6210892236384704,
"repo_name": "bunchesofdonald/django-echo",
"id": "b9bbb9249005c4e5e6273491b7cfdb767e0c2aaf",
"size": "863",... |
import datetime
import bottle
import mtwsgi
class MTServer(bottle.ServerAdapter):
def run(self, handler):
thread_count = self.options.pop('thread_count', None)
server = mtwsgi.make_server(self.host, self.port, handler, thread_count, **self.options)
server.serve_forever()
if __name__ == ... | {
"content_hash": "8dcd0f50f2e1b530361e65a21ffd70e9",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 96,
"avg_line_length": 24.666666666666668,
"alnum_prop": 0.6141141141141141,
"repo_name": "hubertokf/lupsEdgeServer",
"id": "f971d05bd7c8d79aae7682b58f7905741199cc5c",
"siz... |
from random import uniform, gauss
class Speci:
def __init__(self, n, min, max):
self.fit = None
self.genotype = []
for i in range(n):
self.genotype.append(uniform(min, max))
def evaluate(self, fnc):
self.fit = fnc.apply(self.genotype)
def mutate(self, sigma):... | {
"content_hash": "d8a7dbaac69387cca6fd663609105028",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 68,
"avg_line_length": 24.375,
"alnum_prop": 0.5820512820512821,
"repo_name": "lucekdudek/si",
"id": "9ecf62f4011d0cd5d45e8887dd28f0ba2701e9a1",
"size": "390",
"binary": ... |
from pyrekall.models.registry import Registry
from pyrekall.models.processes import Process
from pyrekall.models.services import Service
from pyrekall.models.sample import Sample
from pyrekall.models.executable import PE
from pyrekall.models.user import User
import unittest
import os
class MockSample(Sample):
de... | {
"content_hash": "144b03af97930ef279558b8d7c9595ae",
"timestamp": "",
"source": "github",
"line_count": 145,
"max_line_length": 120,
"avg_line_length": 41.42758620689655,
"alnum_prop": 0.6720492758448476,
"repo_name": "Scalvando/pyrekall",
"id": "a3a276a11ae8d316d78db466048c7796d1819d0c",
"size": "... |
"""Make the standard library cooperative.
The functions in this module patch parts of the standard library with compatible cooperative counterparts
from :mod:`gevent` package.
To patch an individual module call the corresponding ``patch_*`` function. For example, to patch
socket module only, call :func:`patch_socket`... | {
"content_hash": "b2270d32f945ba354274f850fd52084d",
"timestamp": "",
"source": "github",
"line_count": 248,
"max_line_length": 161,
"avg_line_length": 34.141129032258064,
"alnum_prop": 0.6330459430731074,
"repo_name": "jt6562/XX-Net",
"id": "36d4f91590912e2fc03d19d0ce85ecb478bfbad3",
"size": "8533... |
"""
Tests for miscellaneous functionality in the `funcs` module
"""
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import numpy as np
from ...tests.helper import pytest
from ... import units as u
from ...time import Time
def test_sun():
"""
Tes... | {
"content_hash": "35fd2a3daf76a517921d1b3045f15550",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 90,
"avg_line_length": 26.520833333333332,
"alnum_prop": 0.6362922230950511,
"repo_name": "piotroxp/scibibscan",
"id": "c2f5cb504091fb305b8716beec0c659875a4bbd8",
"size": "... |
"""
This module contains integration with Azure CosmosDB.
AzureCosmosDBHook communicates via the Azure Cosmos library. Make sure that a
Airflow connection of type `azure_cosmos` exists. Authorization can be done by supplying a
login (=Endpoint uri), password (=secret key) and extra fields database_name and collection_... | {
"content_hash": "adac7442976575a664c455bb672f2e4f",
"timestamp": "",
"source": "github",
"line_count": 335,
"max_line_length": 108,
"avg_line_length": 37.319402985074625,
"alnum_prop": 0.5871060630299152,
"repo_name": "bolkedebruin/airflow",
"id": "007273a3957c26fbfad9fa817b9f6714729da1e8",
"size"... |
if __name__ == "__main__":
import unittest
unittest.main(module=None, argv=["unittest", "discover", "--start-directory", "test"]) | {
"content_hash": "0b1f16bbc4de9019dae7a68e80b0aa61",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 87,
"avg_line_length": 43.666666666666664,
"alnum_prop": 0.6412213740458015,
"repo_name": "Varabe/Guild-Manager",
"id": "38be3ea7469ab9d5a73fdbb0780d97ae7d429673",
"size": "... |
from pybamboo.dataset import Dataset
from pybamboo.exceptions import PyBambooException
from pybamboo.tests.test_base import TestBase
class TestDataset(TestBase):
def setUp(self):
TestBase.setUp(self)
self._create_dataset_from_file()
def _create_dataset_from_file(self):
self.dataset =... | {
"content_hash": "05b232a175a846fe833f0a94cf641b7b",
"timestamp": "",
"source": "github",
"line_count": 558,
"max_line_length": 75,
"avg_line_length": 37.5573476702509,
"alnum_prop": 0.5758934962065181,
"repo_name": "SEL-Columbia/pybamboo",
"id": "e3211222328e39bbb720369eeff58c6a5f819f1c",
"size": ... |
'''
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this ... | {
"content_hash": "fb7aefbd636c47c70bee3c7aff3e75a8",
"timestamp": "",
"source": "github",
"line_count": 341,
"max_line_length": 121,
"avg_line_length": 37.354838709677416,
"alnum_prop": 0.7006594441827603,
"repo_name": "sekikn/ambari",
"id": "3bcd0bbd6ce571798b27e434f26213b8b630c6e0",
"size": "1276... |
"""
deprecated!
This module defines few algorithms for filtering declarations.
"""
import os
import algorithm
class filtering:
"""deprecated!
defines few algorithms for filtering declarations
"""
@staticmethod
def normalize_path( some_path ):
"""return os.path.normcase( os.path.normpath... | {
"content_hash": "652770832f2a11cefc4e0fda80b5e08f",
"timestamp": "",
"source": "github",
"line_count": 74,
"max_line_length": 94,
"avg_line_length": 36.67567567567568,
"alnum_prop": 0.6521739130434783,
"repo_name": "jgresula/jagpdf",
"id": "8afd064ab36aeabcb818c51dbbcf4599edba0ac0",
"size": "2902"... |
__version__ = 0.1
__author__ = 'weldpua2008@gmail.com'
class BaseHeaders(object):
#expression = re.compile("^(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?$")
# def process_request(self, req, res):
# #
# # """Process the request before entering in the API
# # Before we proces... | {
"content_hash": "b5094c1d7b482be4d28fe68bb5720155",
"timestamp": "",
"source": "github",
"line_count": 71,
"max_line_length": 140,
"avg_line_length": 51.29577464788732,
"alnum_prop": 0.5837451949478308,
"repo_name": "theadviceio/executer",
"id": "e585c586e7515a59c234c9c7f8413580f21f3a47",
"size": ... |
'''
Created on Mar 2, 2015
@author: Stefan-Code
'''
import unittest
import os
import pickle
import copy
from gglsbl3 import storage
from nose.tools import *
class StorageTest(unittest.TestCase):
def setUp(self):
self.dbpath = "./testdb.sqlite"
if os.path.exists(self.dbpath):
os.remo... | {
"content_hash": "07c753d73d7f6a436541b3dd10c81dba",
"timestamp": "",
"source": "github",
"line_count": 66,
"max_line_length": 87,
"avg_line_length": 30.075757575757574,
"alnum_prop": 0.6282115869017633,
"repo_name": "Stefan-Code/gglsbl3",
"id": "0b410cc829cb058d121e5a9c3de177965172b53d",
"size": "... |
""" command line options, ini-file and conftest.py processing. """
import argparse
import copy
import inspect
import os
import shlex
import sys
import types
import warnings
from functools import lru_cache
from pathlib import Path
import attr
import py
from packaging.version import Version
from pluggy import HookimplMa... | {
"content_hash": "8b6b0493725c292ca4c2a9214c20d4fd",
"timestamp": "",
"source": "github",
"line_count": 1133,
"max_line_length": 112,
"avg_line_length": 35.02471315092674,
"alnum_prop": 0.5770481062419676,
"repo_name": "tomviner/pytest",
"id": "e39c63c4b52de1fc848d6f7b226cebca3e0cac2a",
"size": "39... |
"""Packing and unpacking of ndb.Key.
End users are only given packed keys, which permits to not expose internal
schema details to the user.
"""
from google.appengine.ext import ndb
from components import datastore_utils
from components import utils
# Mask to TaskRequest key ids so they become decreasing numbers.
T... | {
"content_hash": "2071f715a96088973209ddb7ae9fccc4",
"timestamp": "",
"source": "github",
"line_count": 164,
"max_line_length": 79,
"avg_line_length": 35.798780487804876,
"alnum_prop": 0.7095895077499574,
"repo_name": "madecoste/swarming",
"id": "192364143f61a44162c000c9a03102e4248db761",
"size": "... |
import strings
if __name__ == "__main__":
strings.call_main()
| {
"content_hash": "435d1db689329e5a248add83d54ebb9c",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 26,
"avg_line_length": 16.75,
"alnum_prop": 0.5671641791044776,
"repo_name": "bozzzzo/quark",
"id": "6ca3382fab0cdc5eb74245a24dca97a1a23d3e05",
"size": "67",
"binary": fal... |
import collectd
import collectd_base as base
INTERVAL = 60
class CephOSDStatsPlugin(base.CephBase):
""" Collect per OSD stats about store size and commit latency."""
def __init__(self, *args, **kwargs):
super(CephOSDStatsPlugin, self).__init__(*args, **kwargs)
self.plugin = 'ceph_osd'
... | {
"content_hash": "0150f806d1e152cff687d8cca133331a",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 75,
"avg_line_length": 24.884615384615383,
"alnum_prop": 0.5680061823802164,
"repo_name": "TAJaroszewski/lma_contrail_monitoring",
"id": "de948ae46edeb71d93415169827138a24712... |
import pytest
from collections.abc import Mapping, Sequence
@pytest.mark.asyncio
async def test_endpoint(client):
name = "<CoordinateEndpoint(%r)>" % str(client.address)
assert repr(client.coordinate) == name
@pytest.mark.asyncio
async def test_datacenters(client, server):
datacenters = await client.coo... | {
"content_hash": "5b56c301b6bbdc878c5ff422f16720d1",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 74,
"avg_line_length": 30.807692307692307,
"alnum_prop": 0.7303370786516854,
"repo_name": "johnnoone/aioconsul",
"id": "845db54f0f28e368f224b2a267c7d01e253ec4a6",
"size": "... |
"""
Mock classes for use in pack testing.
"""
from __future__ import absolute_import
from logging import RootLogger
from mock import Mock
from st2common.models.api.trace import TraceContext
from st2reactor.container.sensor_wrapper import SensorService
from st2tests.mocks.datastore import MockDatastoreService
__all... | {
"content_hash": "2274a60cbf99f351c75624442b022974",
"timestamp": "",
"source": "github",
"line_count": 68,
"max_line_length": 97,
"avg_line_length": 31.426470588235293,
"alnum_prop": 0.673373888628919,
"repo_name": "Plexxi/st2",
"id": "c65825786cde1ed45920412d4462d3be58495e3b",
"size": "2765",
"... |
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'CustomUser.timezone'
db.add_column(u'account_customuser', 'timezone',
... | {
"content_hash": "a6324838d93b6f5bd71f9ca9091e51b3",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 194,
"avg_line_length": 61.96551724137931,
"alnum_prop": 0.5695603784084585,
"repo_name": "gunnery/gunnery",
"id": "6a0f529851003edb894805d994f346c6cd357d58",
"size": "3618... |
from abc import ABCMeta, abstractmethod
from six import add_metaclass
from ems.event.hook import EventHookProperty, EventHook
@add_metaclass(ABCMeta)
class Identifiable(object):
def __init__(self, id_=None):
self.id = id_
class Orderer(Identifiable):
"""
An Orderer is the causer of an order
... | {
"content_hash": "12072dffae1ad27cd3e02637fda5b437",
"timestamp": "",
"source": "github",
"line_count": 364,
"max_line_length": 94,
"avg_line_length": 29.403846153846153,
"alnum_prop": 0.6486966271138933,
"repo_name": "mtils/ems",
"id": "68d8173dc932f8d20086dc276a7557c4ba532811",
"size": "10704",
... |
"""
Recurrent layers.
TODO: write more documentation
"""
__docformat__ = 'restructedtext en'
__authors__ = ("Razvan Pascanu "
"KyungHyun Cho "
"Caglar Gulcehre ")
__contact__ = "Razvan Pascanu <r.pascanu@gmail>"
import numpy
import copy
import theano
import theano.tensor as TT
# Nicer i... | {
"content_hash": "4d5266dd202b10787f41a3df37bed34e",
"timestamp": "",
"source": "github",
"line_count": 1177,
"max_line_length": 119,
"avg_line_length": 40.91588785046729,
"alnum_prop": 0.4840109639104614,
"repo_name": "codeaudit/GroundHog",
"id": "b62bdf737e6d249916f739f2d39c2a043aac6d44",
"size":... |
"""Magic functions for running cells in various scripts."""
# Copyright (c) IPython Development Team.
# Distributed under the terms of the Modified BSD License.
import errno
import os
import sys
import signal
import time
from subprocess import Popen, PIPE
import atexit
from IPython.core import magic_arguments
from I... | {
"content_hash": "1e6ecb9a99ec9bbe292fd83dad3e2241",
"timestamp": "",
"source": "github",
"line_count": 279,
"max_line_length": 93,
"avg_line_length": 31.666666666666668,
"alnum_prop": 0.5084323712507074,
"repo_name": "unnikrishnankgs/va",
"id": "2ed31126e4f1b37bce1695de5782a5f394608ed3",
"size": "... |
from RGT.XML.SVG.Filters.baseFilterNode import BaseFilterNode
from types import StringType
from RGT.XML.SVG.basicSvgNode import BasicSvgNode
class FeCompositeNode(BaseFilterNode):
svgNodeType = BasicSvgNode.SVG_FE_COMPOSITE_NODE
ATTRIBUTE_IN = 'in'
ATTRIBUTE_IN2 = 'in2'
ATTRIBUTE_OPERATOR =... | {
"content_hash": "c543284e2d00193a64dd8bf538ddea3f",
"timestamp": "",
"source": "github",
"line_count": 113,
"max_line_length": 85,
"avg_line_length": 32.15929203539823,
"alnum_prop": 0.5610897083104017,
"repo_name": "danrg/RGT-tool",
"id": "8188d8220e0fa009d271ad96f66701be191f6766",
"size": "3634"... |
"""Common functions for MongoDB and DB2 backends
"""
import pymongo
from ceilometer.event.storage import base
from ceilometer.event.storage import models
from ceilometer.openstack.common.gettextutils import _
from ceilometer.openstack.common import log
from ceilometer.storage.mongo import utils as pymongo_utils
from c... | {
"content_hash": "31e2bc1d9b1b8599faf95674f69af53a",
"timestamp": "",
"source": "github",
"line_count": 142,
"max_line_length": 79,
"avg_line_length": 41.15492957746479,
"alnum_prop": 0.5438056125941136,
"repo_name": "m1093782566/openstack_org_ceilometer",
"id": "bac948b2cd35d2dad0784b489023e2092df92... |
from django.db import models
from django.core.urlresolvers import reverse
# Tag class
class Tag(models.Model):
slug = models.SlugField(max_length=200, unique=True)
def __str__(self):
return self.slug
# Custom queryset manager that only displays posts that have publish set to true.
class PostQuerySet... | {
"content_hash": "d57249c261a6c2c29b894523f3c2ebe9",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 81,
"avg_line_length": 28.325,
"alnum_prop": 0.6831421006178288,
"repo_name": "SanketDG/contributr",
"id": "f9cdd721f6884a43e2267e03716ab9009b36bcd9",
"size": "1133",
"bi... |
from django.db.models import get_model
Notification = get_model('customer', 'Notification')
def notify_user(user, msg, category=None):
"""
Send a simple notification to a user
"""
Notification.objects.create(
recipient=user,
subject=msg,
category=category)
def notify_users(u... | {
"content_hash": "63e58b88aafc73483716be6d015f47cf",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 54,
"avg_line_length": 22.952380952380953,
"alnum_prop": 0.6493775933609959,
"repo_name": "elliotthill/django-oscar",
"id": "536f33d5e15fc992edfdfdb5062b331c29be2219",
"siz... |
from pathlib import Path
from urllib import request
from urllib.error import URLError, HTTPError
from lxml import html, etree
from flask import Flask, Response, request as flask_request, jsonify, render_template, send_file, abort
from werkzeug.contrib.atom import AtomFeed
from werkzeug.utils import secure_filename
from... | {
"content_hash": "adf98fdb3f26e8f46f44eaeb91fd5102",
"timestamp": "",
"source": "github",
"line_count": 299,
"max_line_length": 211,
"avg_line_length": 36.94314381270903,
"alnum_prop": 0.6702878870179251,
"repo_name": "sgornick/orovilledam.org",
"id": "4f2636c63c50f2a64fe17d7cf771960a9e65692a",
"si... |
def list_max(list_number: list):
return max(list_number)
def list_mean(list_number: list) -> float:
""" Give the mean of a list of numbers
:param list_number:
:return:
"""
return sum(list_number) / len(list_number)
def indexes_of_elements_greater_than_mean(list_number: list, list_names):
... | {
"content_hash": "5c0c70055d2c005b4b929ed7a19e8445",
"timestamp": "",
"source": "github",
"line_count": 75,
"max_line_length": 245,
"avg_line_length": 33.693333333333335,
"alnum_prop": 0.5718242975860705,
"repo_name": "bros-bioinfo/bros-bioinfo.github.io",
"id": "9858228b937944f1a7044e5891f816ab7affd... |
"""The tests for the LG webOS media player platform."""
import json
import os
from unittest.mock import patch
import pytest
from sqlitedict import SqliteDict
from homeassistant.components import media_player
from homeassistant.components.media_player.const import (
ATTR_INPUT_SOURCE,
ATTR_MEDIA_VOLUME_MUTED,
... | {
"content_hash": "37f64c8d84c0eb9d9b41c927bfd2c9d9",
"timestamp": "",
"source": "github",
"line_count": 175,
"max_line_length": 113,
"avg_line_length": 28.14857142857143,
"alnum_prop": 0.6731628095818109,
"repo_name": "sander76/home-assistant",
"id": "716c496d88a87f2b11d8d1629bd31f515e6cd13e",
"siz... |
import sys
import os
import shlex
# 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('.'))
sys.p... | {
"content_hash": "145e313520c8a89b2c1ebc8023183281",
"timestamp": "",
"source": "github",
"line_count": 279,
"max_line_length": 132,
"avg_line_length": 33.28673835125448,
"alnum_prop": 0.7065790890492085,
"repo_name": "wdm0006/categorical_encoding",
"id": "f26c1286a8374dc52a0fab728842ef61e51b12c3",
... |
from __future__ import unicode_literals
from django.db import models
class Author(models.Model):
name = models.TextField()
def __str__(self):
return self.name
class FundedAuthor(models.Model):
name = models.TextField()
def __str__(self):
return self.name
class Paper(models.Model)... | {
"content_hash": "a9044abb41e397b5ce709e99b8b2684f",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 48,
"avg_line_length": 24.35,
"alnum_prop": 0.662217659137577,
"repo_name": "Spferical/cure-alzheimers-fund-tracker",
"id": "906ef38efa21d855cfcb15477406e08be3722674",
"siz... |
from django.db import models
import fnmatch
import os
from socket import gethostname
host = gethostname()
ori = ['LPS','RPI','RAS','LAI','PLI','PRS','ALS','ARI'] #X(>),Y(\/),Z(X).
orien = [str(x).replace('R','right-').replace('L','left-').replace('P','posterior-').replace('A','anterior-').replace('S','superior').repl... | {
"content_hash": "0df9e2ce5467a0e92871210f4d3cfcea",
"timestamp": "",
"source": "github",
"line_count": 109,
"max_line_length": 171,
"avg_line_length": 46.84403669724771,
"alnum_prop": 0.6623580101840971,
"repo_name": "Robbie1977/AlignmentPipe",
"id": "a363a9fd10a53b33460bf9d760e893ce34541027",
"si... |
import socket
import sys
from random import choice
if not socket.has_ipv6:
raise Exception("the local machine has no IPv6 support enabled")
config = None
app_exfiltrate = None
def send(data):
if config.has_key('proxies') and config['proxies'] != [""]:
targets = [config['target']] + config['proxies']
... | {
"content_hash": "cb7e4f49bb1fc79241070a83fd7c83a7",
"timestamp": "",
"source": "github",
"line_count": 81,
"max_line_length": 100,
"avg_line_length": 33.71604938271605,
"alnum_prop": 0.6195532771878433,
"repo_name": "chokepoint/DET",
"id": "28ab4abe6c2104dd1f1cf26cbffafa3625d51247",
"size": "2731"... |
class Line(object):
"""NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually."""
def __init__(self):
"""
Attributes:
swaggerTypes (dict): The key is attribute name and the value is attribute type.
attributeMap (dict): T... | {
"content_hash": "a4d6289098caf02717bf8f8d7b5fff3d",
"timestamp": "",
"source": "github",
"line_count": 57,
"max_line_length": 528,
"avg_line_length": 41.578947368421055,
"alnum_prop": 0.5649789029535865,
"repo_name": "asposecells/Aspose_Cells_Cloud",
"id": "7fc5052f16e7dbd9ad4338d9805b1165dc70b74c",... |
from django.apps import AppConfig
class UploadConfig(AppConfig):
name = 'upload'
| {
"content_hash": "9fa371e98b4128ad2f85a1a61c229d70",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 33,
"avg_line_length": 17.4,
"alnum_prop": 0.7471264367816092,
"repo_name": "SUMPaul/dblog",
"id": "00a986c7655103c6b2e25304c640c2317293bfd0",
"size": "87",
"binary": fals... |
"""YAPF.
YAPF uses the algorithm in clang-format to figure out the "best" formatting for
Python code. It looks at the program as a series of "unwrappable lines" ---
i.e., lines which, if there were no column limit, we would place all tokens on
that line. It then uses a priority queue to figure out what the best format... | {
"content_hash": "eb18c4ad4ef0839597a0489adba94873",
"timestamp": "",
"source": "github",
"line_count": 217,
"max_line_length": 80,
"avg_line_length": 36.944700460829495,
"alnum_prop": 0.6331545465884995,
"repo_name": "lucius-feng/yapf",
"id": "c34049401724f37ffaaeb222b1babbfe1623d7cc",
"size": "86... |
"""Tests for SessionManager."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import tensorflow as tf
from tensorflow.python.framework import errors
from tensorflow.python.platform import gfile
class SessionManagerTest(tf.test.TestCase):
d... | {
"content_hash": "58120f9bbe448d0f133ff3f4ccca9175",
"timestamp": "",
"source": "github",
"line_count": 256,
"max_line_length": 80,
"avg_line_length": 44.94140625,
"alnum_prop": 0.609387222946545,
"repo_name": "plowman/python-mcparseface",
"id": "01cc4f11d68dfd4788ea97b895323a332fa4952b",
"size": "... |
from __future__ import unicode_literals, division, absolute_import
from builtins import * # pylint: disable=unused-import, redefined-builtin
from mock import patch
from flexget.manager import Session
from flexget.plugins.filter import series
from flexget.utils import json
class TestSeriesAPI(object):
config = ... | {
"content_hash": "525bb6c983fca59c14e9914eef8dd822",
"timestamp": "",
"source": "github",
"line_count": 289,
"max_line_length": 119,
"avg_line_length": 41.40138408304498,
"alnum_prop": 0.626744671959883,
"repo_name": "qvazzler/Flexget",
"id": "b38b5043d89cf0e230ac0a5e7775e755a17bb78d",
"size": "119... |
"""
Python's multiprocessing.Pool class doesn't interact well with
``KeyboardInterrupt`` signals, as documented in places such as:
* `<http://stackoverflow.com/questions/1408356/>`_
* `<http://stackoverflow.com/questions/11312525/>`_
* `<http://noswap.com/blog/python-multiprocessing-keyboardinterrupt>`_
Various worka... | {
"content_hash": "6e51074c39c32b85d68376172ef9846b",
"timestamp": "",
"source": "github",
"line_count": 98,
"max_line_length": 78,
"avg_line_length": 32.92857142857143,
"alnum_prop": 0.6519987604586303,
"repo_name": "jellis18/emcee3",
"id": "9f32426e5b64593c0a528581f97f5b82452cd030",
"size": "3252"... |
"""Martel based parser to read CDD formatted files.
This is a huge regular regular expression for CDD, built using
the 'regular expressiona on steroids' capabilities of Martel.
http://www.ncbi.nlm.nih.gov/Structure/cdd/cdd.shtml
Notes:
Just so I remember -- the new end of line syntax is:
New regexp syntax - \R
... | {
"content_hash": "3b449ff5b6d60c88f977ac87a5a8b587",
"timestamp": "",
"source": "github",
"line_count": 149,
"max_line_length": 91,
"avg_line_length": 41.711409395973156,
"alnum_prop": 0.715526950925181,
"repo_name": "dbmi-pitt/DIKB-Micropublication",
"id": "d244635b064cd4650d47ae35a68fe3ae5fc47fbc",... |
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Deleting field 'Issue.name'
db.delete_column(u'issues_issue', 'name')
def backwards(self,... | {
"content_hash": "b97e0d34d22ed790773dc9224a45ad7d",
"timestamp": "",
"source": "github",
"line_count": 157,
"max_line_length": 195,
"avg_line_length": 77.57961783439491,
"alnum_prop": 0.5389162561576355,
"repo_name": "akulakov/mangotrac",
"id": "85af3e94bd12a39a89ed4f87212fee5631f910e3",
"size": "... |
from __future__ import absolute_import
from __future__ import print_function
from enable.component_editor import ComponentEditor
from traits.api import HasTraits, Any
from traitsui.api import View, Item
# ============= standard library imports ========================
# ============= local library imports ==========... | {
"content_hash": "743e18357cda5d5cfe65e7bc90b4597c",
"timestamp": "",
"source": "github",
"line_count": 93,
"max_line_length": 91,
"avg_line_length": 27.946236559139784,
"alnum_prop": 0.5479030396306271,
"repo_name": "UManPychron/pychron",
"id": "112b38f1338fc9fce154d15373e95929181f02c8",
"size": "... |
"""DICOM Upper Layer Protocol Data Units (PDUs).
There are seven different PDUs:
- A_ASSOCIATE_RQ
- A_ASSOCIATE_AC
- A_ASSOCIATE_RJ
- P_DATA_TF
- A_RELEASE_RQ
- A_RELEASE_RP
- A_ABORT_RQ
::
from_primitive encode
+----------------+ ------> +------------+ -----> +-------------+
... | {
"content_hash": "7223aae037a57c3783357393de709951",
"timestamp": "",
"source": "github",
"line_count": 2118,
"max_line_length": 88,
"avg_line_length": 34.04579792256846,
"alnum_prop": 0.5265639517951989,
"repo_name": "scaramallion/pynetdicom",
"id": "24a8b6dc5d1863f735e8cddbe7844ae9758fc60f",
"siz... |
import unittest
import numpy as np
from GPy.core.parameterization.index_operations import ParameterIndexOperations,\
ParameterIndexOperationsView
one, two, three = 'one', 'two', 'three'
class Test(unittest.TestCase):
def setUp(self):
self.param_index = ParameterIndexOperations()
self.param_in... | {
"content_hash": "4773150c667879cc04c1362b79e9c8cf",
"timestamp": "",
"source": "github",
"line_count": 134,
"max_line_length": 107,
"avg_line_length": 49.83582089552239,
"alnum_prop": 0.4788858939802336,
"repo_name": "maaskola/GPy",
"id": "a97f1beba0fa221a8b5f6b09b6ab389b979a4566",
"size": "6775",... |
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
"""
Verify that --site-dir=otherdir loads the site_init.py script
from the other dir;
the usual site_scons/site_init.py should NOT be loaded.
"""
import TestSCons
test = TestSCons.TestSCons()
test.subdir('site_scons', ['site_scons', 'site_tools'])
test.... | {
"content_hash": "09cd57ad355731fb9a33bab0128a2a2c",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 61,
"avg_line_length": 20.714285714285715,
"alnum_prop": 0.6364532019704433,
"repo_name": "datalogics-robb/scons",
"id": "a05817e7f14f3f5ef56ec5516d48ad2daab72b4e",
"size":... |
__author__ = 'emorway'
import sys
import numpy as np
from ..pakbase import Package
from ..utils import Util2d, read1d, MfList
class Mt3dLkt(Package):
"""
MT3D-USGS LaKe Transport package class
Parameters
----------
model : model object
The model object (of type :class:`flopy.mt3dms.mt.M... | {
"content_hash": "0eeae30bd3695b1148f80d8d69b5eaa1",
"timestamp": "",
"source": "github",
"line_count": 433,
"max_line_length": 92,
"avg_line_length": 36.91224018475751,
"alnum_prop": 0.5428267534255146,
"repo_name": "bdestombe/flopy-1",
"id": "91a4b7be75b28183cb1bf298fd9d57704ec1d67f",
"size": "15... |
"""Utils to slurp stuff"""
__author__ = 'thorwhalen'
def slurp_with_login_and_pwd():
import sys
import mechanize
# sys.path.append('ClientCookie-1.0.3')
# from mechanize import ClientCookie
# sys.path.append('ClientForm-0.1.17')
# import ClientForm
# Create special URL opener (for User-... | {
"content_hash": "240d52f1ad1126bd3d77f23a797148c9",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 77,
"avg_line_length": 29.256410256410255,
"alnum_prop": 0.6319018404907976,
"repo_name": "thorwhalen/ut",
"id": "7ea903399392786ef6a3bc1c9fc4deaff6d0a40d",
"size": "1141",... |
from oslo_db.sqlalchemy import utils as db_utils
from oslo_utils import uuidutils
from neutron.tests.functional.db import test_migrations
class QosStandardAttrMixin(object):
"""Validates qos standard attr migration."""
def _create_qos_pol(self, pol_id, description):
otable = db_utils.get_table(self.... | {
"content_hash": "59d82c6dfe8b52874dde9012d1f7f699",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 77,
"avg_line_length": 39.28888888888889,
"alnum_prop": 0.6425339366515838,
"repo_name": "igor-toga/local-snat",
"id": "eb0c864034fe015c9d8b7708dc9bef36854e8536",
"size": "... |
import gobject, pygst
pygst.require('0.10')
import gst
import pandora
import webbrowser
import urllib
import re
import tempfile
import os
CachePath = tempfile.gettempdir()
class volcanoPlayer(object):
def __init__( self ):
self.pandora = pandora.Pandora()
self.curStation = ""
self.curSong... | {
"content_hash": "9cfa7f23a2812abc55acdc359af8e989",
"timestamp": "",
"source": "github",
"line_count": 197,
"max_line_length": 142,
"avg_line_length": 31.700507614213198,
"alnum_prop": 0.5596477181745396,
"repo_name": "JeffHoogland/qAndora",
"id": "b2ef808c443b17bf66141f2f8a5f789455b02be1",
"size"... |
from random import seed, randint
from os import path
# Gui framework
# ==============================================================================
# framework for easy user interface creation.
# Canvas creation and printing.
# ------------------------------------------------------------------------------
# Create... | {
"content_hash": "7f76bb123f06030927852d557306d384",
"timestamp": "",
"source": "github",
"line_count": 590,
"max_line_length": 120,
"avg_line_length": 26.674576271186442,
"alnum_prop": 0.5544541873173211,
"repo_name": "Groupe24/CodeInSpace",
"id": "9f76e2c497a3dcb2f1113d3eddcd25ca0d91bb83",
"size"... |
__author__ = 'heddevanderheide'
# Django specific
from django.db import models
from django.utils.translation import ugettext_lazy as _
# App specific
from networth.models import NetworthModel
class Topping(models.Model):
name = models.CharField(max_length=140, blank=True, null=True)
class Meta:
ver... | {
"content_hash": "60a84f523ca832d9623457056d488163",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 68,
"avg_line_length": 24.243243243243242,
"alnum_prop": 0.6265328874024526,
"repo_name": "Hedde/django-networth",
"id": "d03073e4a05eadfd87572124f4accd39acfd24ec",
"size":... |
class SquirrelException(Exception):
pass
class SquirrelApiException(SquirrelException):
"""
Custom exception for Squirrel API
"""
ERROR_CODES = {
0: 'Success',
2000: 'Password errors',
2001: 'Type parameter issues',
2002: 'Func parameter issues',
2003: 'Ext... | {
"content_hash": "77463ef11d2c23c1342f6eaf16d81889",
"timestamp": "",
"source": "github",
"line_count": 63,
"max_line_length": 73,
"avg_line_length": 32.57142857142857,
"alnum_prop": 0.5930799220272904,
"repo_name": "ox-it/python-squirrelapi",
"id": "54070eb1d2e6098a54975ca2c4fdc4fb3bce61b9",
"size... |
"""
Enhanced Meta File
"""
from construct import *
record_type = Enum(ULInt32("record_type"),
ABORTPATH = 68,
ANGLEARC = 41,
ARC = 45,
ARCTO = 55,
BEGINPATH = 59,
BITBLT = 76,
CHORD = 46,
CLOSEFIGURE = 61,
CREATEBRUSHINDIRECT = 39,
CREATEDIBPATTERNBRUSHPT = 94,
CREATEMONOBR... | {
"content_hash": "0a9b00875af1e4aefb96fd7660f1b537",
"timestamp": "",
"source": "github",
"line_count": 198,
"max_line_length": 84,
"avg_line_length": 24.424242424242426,
"alnum_prop": 0.5901571546732837,
"repo_name": "ArcherSys/ArcherSys",
"id": "5c9537325b08135ebdf9fe187e0e30478a503a09",
"size": ... |
__author__ = 'peter'
from django import template
register = template.Library()
@register.filter
def sort_by(queryset, order):
return queryset.order_by(order)
| {
"content_hash": "bef7fe15802af29c4a6617e7c195af9b",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 35,
"avg_line_length": 23.285714285714285,
"alnum_prop": 0.7361963190184049,
"repo_name": "Plaudenslager/ITDB",
"id": "8fdbe1d313332b46b8b95bf68869c0a379a511a2",
"size": "16... |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('base', '0065_auto_20160713_2118'),
]
operations = [
migrations.AddField(
model_name='userprofile',
name='from_django_browser... | {
"content_hash": "44ce99eba3acfeb73aaa7adc56df7de4",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 53,
"avg_line_length": 22,
"alnum_prop": 0.6060606060606061,
"repo_name": "participedia/pontoon",
"id": "38ab6411ee5de09cf8e6521216594567ceb5f2de",
"size": "468",
"binary... |
import re
from functools import wraps
from django.conf import settings
from django.http import HttpResponse
class HttpResponseTooManyRequests(HttpResponse):
status_code = getattr(settings, 'RATELIMIT_STATUS_CODE', 403)
def _method_match(request, method=None):
if method is None:
method = ['GET', 'POST... | {
"content_hash": "70fb6b977ca7345e2142ff37e3b14c15",
"timestamp": "",
"source": "github",
"line_count": 93,
"max_line_length": 101,
"avg_line_length": 28.483870967741936,
"alnum_prop": 0.5620989052472631,
"repo_name": "skorokithakis/django-brake",
"id": "ddc2c8ab8b548293613a78988074d4d49a39c9f4",
"... |
import sys, os
from timtools.sdoc.environment import Body, Story, ParseError
from timtools.sdoc.tables import TablesMixin
from timtools.sdoc.lists import ListsMixin
from timtools.sdoc import styles
from timtools.misc.etc import isnumber
from timtools.misc import debug
from timtools.sdoc.feeders import getFeeder
fro... | {
"content_hash": "e4a786ab1a9ad0b62030e20169ceecc2",
"timestamp": "",
"source": "github",
"line_count": 168,
"max_line_length": 65,
"avg_line_length": 20.958333333333332,
"alnum_prop": 0.679920477137177,
"repo_name": "lsaffre/timtools",
"id": "6a43bb180e0a17301b9551a48751e906fde0576b",
"size": "423... |
"""Markov Decision Process (MDP) Toolbox
=====================================
The MDP toolbox provides classes and functions for the resolution of
descrete-time Markov Decision Processes.
Available modules
-----------------
:mod:`~mdptoolbox.example`
Examples of transition and reward matrices that form valid MD... | {
"content_hash": "74881e561509471314155efac640cf5c",
"timestamp": "",
"source": "github",
"line_count": 81,
"max_line_length": 79,
"avg_line_length": 38.41975308641975,
"alnum_prop": 0.7374678663239075,
"repo_name": "sawcordwell/pymdptoolbox",
"id": "3f09396728c57be9760d8d86cedb983fe2118aeb",
"size... |
class Solution:
# @param head, a ListNode
# @return a boolean
def hasCycle(self, head):
d = dict()
h = head
while h != None:
if h in d:
return True
else:
d[h] = 1
h = h.next
ret... | {
"content_hash": "399cc155008232e581be4c3db6ccbc61",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 35,
"avg_line_length": 21.11764705882353,
"alnum_prop": 0.42896935933147634,
"repo_name": "shootsoft/practice",
"id": "542cd817d62bd8d673e5c90871a321e3e86c55f9",
"size": "8... |
from pathlib import Path
from time import monotonic_ns
import pytest
from baby_steps import given, then, when
import vedro
from vedro.core import Dispatcher
from vedro.core import MonotonicScenarioScheduler as Scheduler
from vedro.events import StartupEvent
from ._utils import (
dispatcher,
fire_arg_parsed_e... | {
"content_hash": "e5ebc4c503a2b18103cda11566aaf3a4",
"timestamp": "",
"source": "github",
"line_count": 176,
"max_line_length": 98,
"avg_line_length": 28.880681818181817,
"alnum_prop": 0.6311233523509738,
"repo_name": "nikitanovosibirsk/vedro",
"id": "f123c3c3b558b8597bbf824641356a88d09b58cd",
"siz... |
import logging
from django.db import transaction
from haystack import indexes
LOGGER = logging.getLogger(__name__)
class TxnAwareSearchIndex(indexes.SearchIndex):
_backend_queue = None
def __init__(self, *args, **kwargs):
LOGGER.debug("Initializing TxnAwareSearchIndex ...")
super(TxnAwareSe... | {
"content_hash": "ec76ecf2799159af4094530d5fea596f",
"timestamp": "",
"source": "github",
"line_count": 100,
"max_line_length": 146,
"avg_line_length": 47.03,
"alnum_prop": 0.5647459068679567,
"repo_name": "swcurran/TheOrgBook",
"id": "abaac592eed968c2cf54833a6c334687f537b016",
"size": "4703",
"b... |
"""
mistune
~~~~~~~
The fastest markdown parser in pure Python with renderer feature.
:copyright: (c) 2014 - 2015 by Hsiaoming Yang.
"""
import re
import inspect
__version__ = '0.6dev'
__author__ = 'Hsiaoming Yang <me@lepture.com>'
__all__ = [
'BlockGrammar', 'BlockLexer',
'InlineGrammar', '... | {
"content_hash": "42c89638d0db9e06cce946e51bb8292b",
"timestamp": "",
"source": "github",
"line_count": 1092,
"max_line_length": 79,
"avg_line_length": 29.96794871794872,
"alnum_prop": 0.4953093964858671,
"repo_name": "MrGba2z/Xtr",
"id": "0db5de8d5c079f66bac326159e4496c4adf758ae",
"size": "32741",... |
"""
Meta Schedule search strategy that generates the measure
candidates for measurement.
"""
from typing import List, Optional, TYPE_CHECKING
from tvm._ffi import register_object
from tvm.runtime import Object
from tvm.tir.schedule import Schedule
from .. import _ffi_api
from ..arg_info import ArgInfo
from ..runner i... | {
"content_hash": "96eefa5c3476ffa14e307a549151ea7e",
"timestamp": "",
"source": "github",
"line_count": 162,
"max_line_length": 113,
"avg_line_length": 31.864197530864196,
"alnum_prop": 0.6191398682681132,
"repo_name": "dmlc/tvm",
"id": "411fecb2b69829c8259bdbb9df456f4cde058f0b",
"size": "5947",
... |
class SideNum(object):
def __init__(self,default = 1):
self.default = default
def __get__(self,instance,owner):
return self.default
def __set__(self, instance, val):
if 1 <= val <= 6:
self.default = val
else:
print('must between 1 and 6')
def _... | {
"content_hash": "8711297c1a0e7feb365cc954977b66a2",
"timestamp": "",
"source": "github",
"line_count": 110,
"max_line_length": 92,
"avg_line_length": 22.936363636363637,
"alnum_prop": 0.5517241379310345,
"repo_name": "kiya-z/Kython",
"id": "171e2364f7c6056484efd5e7cba732d9858ee634",
"size": "2523"... |
from dockdev.dockdev import parse_args
from nose.tools import assert_equal
from nose.tools import assert_not_equal
from nose.tools import assert_raises
from nose.tools import assert_in
from nose.tools import raises
class TestArguments(object):
def test_defaults(self):
(local, branch, retag, default, check... | {
"content_hash": "3c87dcbcda701621c58ba2e410043648",
"timestamp": "",
"source": "github",
"line_count": 114,
"max_line_length": 135,
"avg_line_length": 38.18421052631579,
"alnum_prop": 0.5818975419251091,
"repo_name": "alphagov/dockdev",
"id": "d65297526526e04512e5b6faf2f11df396af8d91",
"size": "43... |
import os
import sys
import platform
def is_active():
return True
def get_name():
return "X11"
def can_build():
if (os.name != "posix"):
return False
if sys.platform == "darwin":
return False # no x11 on mac for now
errorval = os.system("pkg-config --version > /dev/null")
... | {
"content_hash": "8a8f7678084b54da5666f54d4cfa2a3f",
"timestamp": "",
"source": "github",
"line_count": 256,
"max_line_length": 140,
"avg_line_length": 35.43359375,
"alnum_prop": 0.587586815125124,
"repo_name": "pixelpicosean/my-godot-2.1",
"id": "a2171901e99a497739e35d3d4d7a741b715059c1",
"size": ... |
"""Box Head.
Contains Box prediction head classes for different meta architectures.
All the box prediction heads have a predict function that receives the
`features` as the first argument and returns `box_encodings`.
"""
import functools
import tensorflow as tf
from tensorflow.contrib import slim as contrib_slim
from... | {
"content_hash": "4727762bbedaff80331a300785839ee0",
"timestamp": "",
"source": "github",
"line_count": 267,
"max_line_length": 80,
"avg_line_length": 39.20224719101124,
"alnum_prop": 0.6596923664851437,
"repo_name": "alexgorban/models",
"id": "41f63554c284bceba35e05447cb35d215fa2063f",
"size": "11... |
"""
PEP HTML Writer.
"""
__docformat__ = 'reStructuredText'
import sys
import os
import os.path
import codecs
import docutils
from docutils import frontend, nodes, utils, writers
from docutils.writers import html4css1
class Writer(html4css1.Writer):
default_stylesheet = 'pep.css'
de... | {
"content_hash": "0b7d1b917b22add0f30286a27c35c1bb",
"timestamp": "",
"source": "github",
"line_count": 102,
"max_line_length": 79,
"avg_line_length": 34.529411764705884,
"alnum_prop": 0.5718341851220897,
"repo_name": "cuongthai/cuongthai-s-blog",
"id": "0657419d84171aefdd13448c58b1ab6b7b5b39a6",
"... |
"""
gcfetch
"""
import collections
import json
import itertools
import re
import sys
import time
import urlparse
import argparse
import gevent
from gevent import monkey
from lxml import html
import matplotlib.pyplot as plt
import networkx
import pylab
import requests
monkey.patch_all()
DONE = """
*******************... | {
"content_hash": "464b0e1dffa5778f4e8821a2b404e271",
"timestamp": "",
"source": "github",
"line_count": 285,
"max_line_length": 117,
"avg_line_length": 23.287719298245612,
"alnum_prop": 0.6233237908693687,
"repo_name": "davidmiller/gcfetch",
"id": "9f9e1283188f127a10bd6104b77c50fcbadfcf8e",
"size":... |
from django.db import transaction
from openslides.poll.serializers import default_votes_validator
from openslides.utils.rest_api import (
DecimalField,
DictField,
IntegerField,
ListField,
ListSerializer,
ModelSerializer,
SerializerMethodField,
ValidationError,
)
from ..utils.validate i... | {
"content_hash": "4f45c273d7ed8ec347959e560ab07817",
"timestamp": "",
"source": "github",
"line_count": 273,
"max_line_length": 115,
"avg_line_length": 31.26007326007326,
"alnum_prop": 0.5849543004452777,
"repo_name": "boehlke/OpenSlides",
"id": "02cd0d945af9d5f9898f70cc2e8d88c6577b4ae5",
"size": "... |
from nova.tests.functional.api_sample_tests import test_servers
class DeferredDeleteSampleJsonTests(test_servers.ServersSampleBase):
sample_dir = "os-deferred-delete"
def setUp(self):
super(DeferredDeleteSampleJsonTests, self).setUp()
self.flags(reclaim_instance_interval=1)
def test_rest... | {
"content_hash": "bd2b38428b7c9bdd4ec00ad4b3080647",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 68,
"avg_line_length": 35.77777777777778,
"alnum_prop": 0.6097308488612836,
"repo_name": "cloudbase/nova",
"id": "2639487481a405c2cb0f8f639be6e73df4f92119",
"size": "1598",... |
"""
fission.package
~~~~~~~~~~~~~~
Download and expand tar.gz file.
:copyright: (c) 2010-2011 Shinya Ohyanagi, All rights reserved.
:license: BSD, see LICENSE for more details.
"""
from paver.easy import task, cmdopts, path, sh
from datetime import datetime
import os
import sys
import urllib
imp... | {
"content_hash": "af30eee95020bc582d6a52c9648b7db1",
"timestamp": "",
"source": "github",
"line_count": 183,
"max_line_length": 83,
"avg_line_length": 23.78688524590164,
"alnum_prop": 0.5743165632896853,
"repo_name": "heavenshell/fission",
"id": "65cdb11e6defaffe803c73b9c8e34afce25eb105",
"size": "... |
import IECore
import IECoreAlembic
import Gaffer
class AlembicPath( Gaffer.Path ) :
def __init__( self, fileNameOrAlembicInput, path, root="/", filter=None ) :
Gaffer.Path.__init__( self, path, root, filter=filter )
if isinstance( fileNameOrAlembicInput, basestring ) :
self.__rootInput = IECoreAlembic... | {
"content_hash": "291299f999d747399c6d37ea7dc520ef",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 94,
"avg_line_length": 22.32,
"alnum_prop": 0.6586021505376344,
"repo_name": "DoubleNegativeVisualEffects/gaffer",
"id": "aa900d1602c803664e7ab03f0d163eb590bb1e7e",
"size":... |
"""
local path implementation.
"""
from __future__ import with_statement
from contextlib import contextmanager
import sys, os, re, atexit, io
import py
from py._path import common
from py._path.common import iswin32
from stat import S_ISLNK, S_ISDIR, S_ISREG
from os.path import abspath, normpath, isabs, exists, isdir... | {
"content_hash": "b0938d874fd260b340cf73a6ede599a8",
"timestamp": "",
"source": "github",
"line_count": 905,
"max_line_length": 88,
"avg_line_length": 35.18563535911602,
"alnum_prop": 0.5147128097227021,
"repo_name": "brandonium21/snowflake",
"id": "774ac235b8d9280d5b0dd4f3364586ceaf7f8854",
"size"... |
from model.group import Group
def test_group_list(app, db):
ui_list = app.group.get_group_list()
def clean(group):
return Group(id=group.id, name=group.name.strip())
db_list = map(clean, db.get_group_list())
assert sorted(ui_list, key=Group.id_or_max) == sorted(db_list, key=Group.id_or_max) | {
"content_hash": "8947ccfa2c6369b6310300070bba82df",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 87,
"avg_line_length": 35.22222222222222,
"alnum_prop": 0.6656151419558359,
"repo_name": "blizzak1234/python",
"id": "8f283104cb5bb09b5d784d8adbcad3408b60f337",
"size": "317... |
import glob
import hashlib
import os
import platform
import sysconfig
import sys
import shutil
import tarfile
import textwrap
import zipfile
from tempfile import mkstemp, gettempdir
from urllib.request import urlopen, Request
from urllib.error import HTTPError
# 0.3.19 fails AVX512_SKX tests, issue 20654, comments in... | {
"content_hash": "547fdf22e1f2367f44246bfd0bdbd62f",
"timestamp": "",
"source": "github",
"line_count": 342,
"max_line_length": 81,
"avg_line_length": 33.985380116959064,
"alnum_prop": 0.5488256044050589,
"repo_name": "seberg/numpy",
"id": "c89cb9284b1eb5f683853df192ece061588dd6b0",
"size": "11623"... |
"""Sitemaps for the `multilingual_news` app."""
from django.contrib.sitemaps import Sitemap
from .models import Document
class DocumentSitemap(Sitemap):
changefreq = "monthly"
priority = 0.5
def items(self):
return Document.objects.published()
def lastmod(self, obj):
return obj.crea... | {
"content_hash": "41cb2ee8689eb340e6d2e2dd026f979d",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 47,
"avg_line_length": 22,
"alnum_prop": 0.693939393939394,
"repo_name": "bitmazk/django-document-library",
"id": "18dfca4cf1e3301a033b6f63baf92159d7a6d982",
"size": "330",... |
import subprocess
KEY = 'GIT_COMMITID'
def commitid():
command = 'git log -1 --format="%H"'
print("run command [%s]" % command)
result = subprocess.check_output(command, shell=True)
result = result.rstrip('\n')
print("result command [%s]" % result)
return result
mycommitid = "undefined"
d... | {
"content_hash": "c9787b68f46bb9e8a851eeaf36f3f8ce",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 57,
"avg_line_length": 20.958333333333332,
"alnum_prop": 0.6461232604373758,
"repo_name": "koenbok/Cactus",
"id": "9be08e7aea5ea6dc492b16ea26a4f797dafe51bc",
"size": "503",... |
__author__ = 'dmorina'
from crowdsourcing import models
from datetime import datetime
from rest_framework import serializers
from django.db.models import Avg
from django.db.models import Max
from django.db.models import Min
from django.contrib.auth.models import User
from django.core.exceptions import ObjectDoesNotExis... | {
"content_hash": "5eefaadb30212170dce73f899d87caf1",
"timestamp": "",
"source": "github",
"line_count": 267,
"max_line_length": 178,
"avg_line_length": 40.943820224719104,
"alnum_prop": 0.674624954262715,
"repo_name": "radhikabhanu/crowdsource-platform",
"id": "42690c2722177a5358aa0c8dc4f6ea45cbf5316... |
import openpnm.models as mods
from openpnm.geometry import GenericGeometry
class StickAndBall_2D(GenericGeometry):
r"""
2D Stick and Ball subclass of GenericGeometry. This subclass is meant as a
basic default geometry to get started quickly.
Pore diameters are randomly assigned between 0 and the lar... | {
"content_hash": "e4f0d1907997b9c00b49aa025b8a7c2b",
"timestamp": "",
"source": "github",
"line_count": 233,
"max_line_length": 79,
"avg_line_length": 53.042918454935624,
"alnum_prop": 0.3357876850877903,
"repo_name": "TomTranter/OpenPNM",
"id": "58dc05542f4555c23d2723e5e9699c259ecf14a0",
"size": "... |
"""Tests for tf_record.TFRecordWriter and tf_record.tf_record_iterator."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import gzip
import os
import random
import string
import zlib
import six
from tensorflow.python.framework import errors_impl
from te... | {
"content_hash": "3430a691fe1cd741627b49ad9575c5b2",
"timestamp": "",
"source": "github",
"line_count": 580,
"max_line_length": 84,
"avg_line_length": 36.62931034482759,
"alnum_prop": 0.6849140974346906,
"repo_name": "gunan/tensorflow",
"id": "dfdbb663a9c8889f5d44526e67c07ea92ce4415b",
"size": "219... |
"""Treadmill install dependencies"""
import logging
import click
from treadmill import TREADMILL
from subprocess import call
_LOGGER = logging.getLogger(__name__)
def init():
"""Install treadmill dependencies"""
@click.command()
def pid1():
"""Install dependencies"""
call(TREADMILL + '/... | {
"content_hash": "e17fa32b86a43ca60d4c79c8186d8c8d",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 64,
"avg_line_length": 19.736842105263158,
"alnum_prop": 0.6826666666666666,
"repo_name": "keithhendry/treadmill",
"id": "1a3bdeb0d19f8c987f9d2bd6a769fb8b7606a25e",
"size":... |
from projects.util.ZohoHttpClient import ZohoHttpClient
from projects.api.Api import Api
from projects.parser.FoldersParser import FoldersParser
base_url = Api().base_url
zoho_http_client = ZohoHttpClient()
parser = FoldersParser()
class FoldersApi:
"""Folders Api class is used to
1.Get all the folders in a... | {
"content_hash": "51b44932c2f38173b10d329926694d45",
"timestamp": "",
"source": "github",
"line_count": 91,
"max_line_length": 132,
"avg_line_length": 30,
"alnum_prop": 0.5798534798534799,
"repo_name": "zoho/projects-python-wrappers",
"id": "6fb582c08c23073a2cf6faf1eb3464c242d46cd9",
"size": "2737"... |
import os
from collections import OrderedDict
import numpy as np
import scipy.io
try:
import pandas as pd
HAS_PANDAS = True
except ImportError:
HAS_PANDAS = False
class GenericSpikeExporter:
def __call__(self,spikes, catalogue, seg_num, chan_grp, export_path,
split_by_cluster... | {
"content_hash": "a980cdcedc36ebb73179d63d328248e8",
"timestamp": "",
"source": "github",
"line_count": 148,
"max_line_length": 99,
"avg_line_length": 32.78378378378378,
"alnum_prop": 0.5892415498763397,
"repo_name": "tridesclous/tridesclous",
"id": "7a0c2f85f0a938b283bea72ba0b2c70bac5c42af",
"size... |
"""Read data from a GEBCO NetCDF file into a RasterModelGrid."""
try:
import netCDF4 as nc4
except ImportError:
import warnings
warnings.warn('Unable to import netCDF4.', ImportWarning)
from scipy.io import netcdf as nc
from landlab import RasterModelGrid
from landlab.io.netcdf.errors import NotRasterGr... | {
"content_hash": "8464409b8579210c0729e2799ecf5973",
"timestamp": "",
"source": "github",
"line_count": 116,
"max_line_length": 77,
"avg_line_length": 24.836206896551722,
"alnum_prop": 0.6161055189170427,
"repo_name": "RondaStrauch/landlab",
"id": "63cbe0e7bdca51d210beb8d57543d6a0ed33d491",
"size":... |
import pytest
import torch
from pyro.distributions import constraints
from pyro.ops.tensor_utils import safe_normalize
@pytest.mark.parametrize("dim", [2, 3, 4, 5, 6, 7, 8, 9, 10, 100, 1000, 10000, 100000])
def test_sphere_check(dim):
data = torch.randn(100, dim)
assert not constraints.sphere.check(data).any... | {
"content_hash": "7e7176ae12b47f2e940459a49f212203",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 87,
"avg_line_length": 30.21212121212121,
"alnum_prop": 0.6720160481444333,
"repo_name": "uber/pyro",
"id": "0abe1c90a374aaa17a15e9c489c4c0685a2818ea",
"size": "1082",
"b... |
from __future__ import print_function
"""
strypes
TODO:
- [ ] how to adapt from one to another
(w/o zope.interfaces)
"""
import cgi
import urllib
import warnings
def shell_escape(shellstr):
warnings.warn('shell_escape NotImplemented')
return shellstr
def shell_escape_single(shellstr):
warning... | {
"content_hash": "90ec8b518c05f0b114a07588fc8fdc63",
"timestamp": "",
"source": "github",
"line_count": 211,
"max_line_length": 65,
"avg_line_length": 18.028436018957347,
"alnum_prop": 0.5786014721345951,
"repo_name": "westurner/strypes",
"id": "cbc9d868159ddc0236b742dfd13667268bea1081",
"size": "3... |
from __future__ import print_function
import unittest
from test_lrn_op import TestLRNOp
class TestLRNMKLDNNOp(TestLRNOp):
def get_attrs(self):
attrs = TestLRNOp.get_attrs(self)
attrs['use_mkldnn'] = True
return attrs
def test_check_output(self):
self.check_output(atol=0.002)
... | {
"content_hash": "52a0dc8d06a431f9561e93fbf9e67102",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 77,
"avg_line_length": 26.513513513513512,
"alnum_prop": 0.5912334352701325,
"repo_name": "QiJune/Paddle",
"id": "f6bb2ab7a696c40cb61dd5b38ca702b577fe7ea2",
"size": "1594",... |
"""Tests runner for modoboa_admin."""
import unittest
from modoboa.lib.test_utils import TestRunnerMixin
class TestRunner(TestRunnerMixin, unittest.TestCase):
"""The tests runner."""
extension = "modoboa_admin_relaydomains"
dependencies = [
"modoboa_admin",
"modoboa_admin_limits",
... | {
"content_hash": "0fac4ef01b48968c9aa8e8cc6296110b",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 53,
"avg_line_length": 20.125,
"alnum_prop": 0.6801242236024845,
"repo_name": "disko/modoboa-admin-relaydomains",
"id": "80c48a6f3c274543bf4b346d0379cd4c711ec67f",
"size": ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.