text stringlengths 4 1.02M | meta dict |
|---|---|
"""Server traits.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import logging
from treadmill import plugin_manager
from treadmill import sysinfo
_LOGGER = logging.getLogger(__name__)
# Invalid trait
INVALID ... | {
"content_hash": "560a5d83e493a1c75cb52997806b096c",
"timestamp": "",
"source": "github",
"line_count": 108,
"max_line_length": 68,
"avg_line_length": 20.49074074074074,
"alnum_prop": 0.5856303660189788,
"repo_name": "ceache/treadmill",
"id": "857c0339409ea32b4490d62554ae5a5e37e21949",
"size": "221... |
from django.db import IntegrityError
from django.contrib.auth.models import Group
from django_odesk.core.clients import DefaultClient
from django_odesk.conf import settings
def get_odesk_permissions(auth_token):
"""
Gets oDesk team roles/permissions for the authenticated user
"""
client = DefaultClien... | {
"content_hash": "b002e04865fc3010ca7c722daf3053c8",
"timestamp": "",
"source": "github",
"line_count": 61,
"max_line_length": 75,
"avg_line_length": 33.295081967213115,
"alnum_prop": 0.6164451009354998,
"repo_name": "solex/django-odesk",
"id": "362f7027118087686befb67c9a9fc88fda0f20d5",
"size": "2... |
import logging
import os
import sys
import tempfile
from fabric import api as fab
LOG = logging.getLogger(__name__)
def ssh_status(ssh):
LOG.debug('Trying to get ssh status')
with fab.settings(
host_string=ssh.host,
user=ssh.user,
key_filename=os.path.join(ssh.env.envdir,... | {
"content_hash": "69432adadf3b67e578543c8aee527961",
"timestamp": "",
"source": "github",
"line_count": 84,
"max_line_length": 77,
"avg_line_length": 33.083333333333336,
"alnum_prop": 0.5548758546239655,
"repo_name": "Axam/nsx-web",
"id": "fc3dc8b4865084b0d0b728d83f003ca87e19ded0",
"size": "3357",
... |
"""Struct proto utilities.
This class provides wrappers for conveniently interacting with protos defined
in struct.proto, mostly ListValue and Value objects. It should primarily be used
by variant_utils and variantcallutils rather than being used directly.
"""
from __future__ import absolute_import
from __future__ imp... | {
"content_hash": "8e88eb2bc0387f76d5dedf0d2c4231d1",
"timestamp": "",
"source": "github",
"line_count": 210,
"max_line_length": 80,
"avg_line_length": 35.84761904761905,
"alnum_prop": 0.6863708820403825,
"repo_name": "google/deepvariant",
"id": "a36337ee1e6a03b0d5a8177c3263274b68006aea",
"size": "9... |
"""
From Exceptions: https://docs.python.org/2/tutorial/errors.html#exceptions
These examples demonstrate common exceptions! Please review why each statement fails.
Don't run this module directly, test each line by typing it into the interpreter.
"""
print undefinedvariable
newstring = 'stringy' + 100
for digit ... | {
"content_hash": "1a825e9f24ca46fc55d40e33a36eccb8",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 85,
"avg_line_length": 21.4375,
"alnum_prop": 0.7638483965014577,
"repo_name": "razzius/PyClassLessons",
"id": "d71ba237d315e9ec6f052b13b3ba8c0a3a899a4c",
"size": "343",
... |
from twisted.internet import defer
from ._base import BaseHandler
import logging
logger = logging.getLogger(__name__)
class AdminHandler(BaseHandler):
def __init__(self, hs):
super(AdminHandler, self).__init__(hs)
@defer.inlineCallbacks
def get_whois(self, user):
res = yield self.sto... | {
"content_hash": "f6459ea4e01ae09f54a2fac1e0038ee5",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 62,
"avg_line_length": 25.23404255319149,
"alnum_prop": 0.4114671163575042,
"repo_name": "illicitonion/synapse",
"id": "1c9e7152c77ef2e67de1b2568acf4837b60fba33",
"size": "... |
from django.core.urlresolvers import reverse
from django.utils.translation import ugettext_lazy as _
from cms.menu_bases import CMSAttachMenu
from menus.base import NavigationNode
from menus.menu_pool import menu_pool
from polls.models import Poll
class PollsMenu(CMSAttachMenu):
name = _("Polls Menu") # give the ... | {
"content_hash": "80f1c6b198e37ff52ccc383fc6e5f947",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 65,
"avg_line_length": 25.857142857142858,
"alnum_prop": 0.7237569060773481,
"repo_name": "AirChen/PythonPractic",
"id": "aabdef76fe0009926e27a0971c36764dd3368378",
"size":... |
"""Word frequency and median for unique words calculation"""
from collections import Counter
from collections import OrderedDict
import sys
from glob import glob
import os
import codecs
import numpy as np
__author__ = "Jigdel"
__copyright__ = "See license"
__credits__ = ["Python for Data Analysis - Wes Mckinney", "St... | {
"content_hash": "8f0a1be2946cc8222f04192d7e7371bd",
"timestamp": "",
"source": "github",
"line_count": 89,
"max_line_length": 75,
"avg_line_length": 29.730337078651687,
"alnum_prop": 0.6141345427059712,
"repo_name": "Jigdel/insightDataScience",
"id": "b8fd914672629559bd955b06e3b87cf38cfc78d7",
"si... |
"""Unit tests for Crocodile."""
import os
import StringIO
import unittest
import croc
#------------------------------------------------------------------------------
class TestCoverageStats(unittest.TestCase):
"""Tests for croc.CoverageStats."""
def testAdd(self):
"""Test Add()."""
c = croc.CoverageSta... | {
"content_hash": "684a277834c61c3560af12ac95150fe9",
"timestamp": "",
"source": "github",
"line_count": 746,
"max_line_length": 79,
"avg_line_length": 32.55764075067024,
"alnum_prop": 0.5594944005270093,
"repo_name": "amyvmiwei/chromium",
"id": "035fcf9f0c93135df6ec36e646844f077aaba795",
"size": "2... |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('bioshareX', '0008_auto_20160805_1826'),
]
operations = [
migrations.CreateModel(
name='Message',
fields=[
('... | {
"content_hash": "3d1939eb9841de28f95f2d1d0728eda8",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 114,
"avg_line_length": 32.75,
"alnum_prop": 0.5699745547073791,
"repo_name": "amschaal/bioshare",
"id": "e20f7275c4453f5fb89ab320123f7b4581b346f8",
"size": "858",
"binar... |
import roslib; roslib.load_manifest('rgoap_ros')
import rospy
import thread
from smach import UserData
from smach_ros import IntrospectionServer
from rgoap import Runner
from rgoap_ros import Introspector
from rgoap_smach import SMACHStateWrapperAction
from rgoap_smach import rgoap_path_to_smach_container
import ... | {
"content_hash": "415f6afc967e109be053191796120d4b",
"timestamp": "",
"source": "github",
"line_count": 118,
"max_line_length": 91,
"avg_line_length": 32.779661016949156,
"alnum_prop": 0.6504653567735263,
"repo_name": "felix-kolbe/executive_rgoap",
"id": "6a329bd5a69167a4c7d086669a5495081f1ff37d",
... |
from __future__ import unicode_literals
import keyword
import re
from collections import OrderedDict
from django.core.management.base import BaseCommand, CommandError
from django.db import DEFAULT_DB_ALIAS, connections
from django.utils.encoding import force_text
class Command(BaseCommand):
help = "Introspects ... | {
"content_hash": "82f6c4e643fb03aa62af71b0b4ba5027",
"timestamp": "",
"source": "github",
"line_count": 284,
"max_line_length": 114,
"avg_line_length": 45.221830985915496,
"alnum_prop": 0.5170910223468037,
"repo_name": "gitaarik/django",
"id": "24310ee390d8078d7fa10ad67fce0d6ee8b7be4d",
"size": "12... |
import sys
import os
import shlex
from recommonmark.parser import CommonMarkParser
# 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... | {
"content_hash": "16f5a54391ca4a88385ad032abf88b22",
"timestamp": "",
"source": "github",
"line_count": 274,
"max_line_length": 79,
"avg_line_length": 32.237226277372265,
"alnum_prop": 0.7061021170610212,
"repo_name": "achernyak/stack",
"id": "33472fdfae0c960e1784f98d9349fea4fea8be37",
"size": "925... |
"""2.0 API features.
this module is legacy as 2.0 APIs are now standard.
"""
from ..engine import Connection as Connection # noqa: F401
from ..engine import create_engine as create_engine # noqa: F401
from ..engine import Engine as Engine # noqa: F401
| {
"content_hash": "b3012b16578f05377a5b086bd45e3952",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 65,
"avg_line_length": 28.666666666666668,
"alnum_prop": 0.7248062015503876,
"repo_name": "sqlalchemy/sqlalchemy",
"id": "c72854680eaa65e6817b8dcbe9895e9731ccf5e2",
"size": ... |
import json
import logging
from lxml import etree
import sys
from oozie.models import Coordinator, BundledCoordinator
from oozie.utils import oozie_to_django_datetime
if sys.version_info[0] > 2:
from django.utils.translation import gettext as _
else:
from django.utils.translation import ugettext as _
LOG = logg... | {
"content_hash": "d45784091df3247b84f24c3818dd2e95",
"timestamp": "",
"source": "github",
"line_count": 116,
"max_line_length": 139,
"avg_line_length": 33.10344827586207,
"alnum_prop": 0.7231770833333333,
"repo_name": "kawamon/hue",
"id": "b929a00f29a626dc74ab4e906738e67c9d4ffbdf",
"size": "4632",
... |
import unittest
from tests.testsuites.reader.uid.threaded import *
from reader.NFC.ACR122.ACR122 import *
class ReaderTestcase(unittest.TestCase):
def setUp(self):
self.dev = ACR122
self.delta = 10
def tearDown(self):
self.dev = None
self.delta = None
def test_NFC_uid(se... | {
"content_hash": "6d673ae0e52b2f040647899c9a26792f",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 50,
"avg_line_length": 22.8,
"alnum_prop": 0.6359649122807017,
"repo_name": "USCC-LAB/Weekly",
"id": "74918301c4ff65c6a9553fcb70bd29f036e15904",
"size": "456",
"binary": ... |
"""
Implementation of SettingsNotebook
"""
import sys
import wx
import h5py
import hashlib
import tempfile
class SettingsNotebook (wx.Notebook) :
"""
GUI container (wx.Notebook) for
"""
def __init__ (self, parent, specs=[], auto_load=True, **kwargs) :
"""
specs -- list of tuple specifying tab settings, e..g,... | {
"content_hash": "ac45c35f28d1b6dc0d3e3d718fa69c54",
"timestamp": "",
"source": "github",
"line_count": 174,
"max_line_length": 99,
"avg_line_length": 26.028735632183906,
"alnum_prop": 0.6431883417973062,
"repo_name": "dibondar/PyPhotonicReagents",
"id": "a288806f90946f07c264abf8d4a7fbe3c55ac466",
... |
from collections import namedtuple
from functools import partial
import numpy.random as npr
from absl.testing import absltest
from absl.testing import parameterized
import itertools as it
import jax.numpy as jnp
from jax import jit, jvp, vjp
import jax._src.test_util as jtu
from jax.config import config
config.parse... | {
"content_hash": "c5353257f6732f478f727acd3d240365",
"timestamp": "",
"source": "github",
"line_count": 270,
"max_line_length": 80,
"avg_line_length": 28.103703703703705,
"alnum_prop": 0.6460200316288878,
"repo_name": "google/jax",
"id": "c61e268ac0bafa58ed9311579d6e31f29f06fb19",
"size": "8171",
... |
from absl.testing import parameterized
import tensorflow as tf
from utils.models import emnist_models
class ModelCollectionTest(tf.test.TestCase, parameterized.TestCase):
def test_conv_dropout_only_digits_shape(self):
image = tf.ones([4, 28, 28, 1])
model = emnist_models.create_conv_dropout_model(only_dig... | {
"content_hash": "11a12c500e284fd680e655348481794f",
"timestamp": "",
"source": "github",
"line_count": 97,
"max_line_length": 80,
"avg_line_length": 42.1958762886598,
"alnum_prop": 0.6630833129733692,
"repo_name": "google-research/federated",
"id": "564930d083754415f5c5ca314443cb84ee8cc6f2",
"size... |
season = ['Spring', 'Summer', 'Fall', 'Winter']
gradesym = '+ -'
grade = 'ABCDF'
gradebook = [('Math 101', 'calculus', 'Fall 2012', 'C'),
('CS 130', 'Python', 'Spring 2013', 'A'),
('CS 132', 'C++', 'Summer 2013', 'A+'),
('Chem 120', 'OChem', 'Winter 2012', 'A-'),
('Phy 125', 'QCD', 'Spring 2013', 'A-')... | {
"content_hash": "e2b01e107859c44a3914452b24e8f8e7",
"timestamp": "",
"source": "github",
"line_count": 171,
"max_line_length": 92,
"avg_line_length": 26.719298245614034,
"alnum_prop": 0.5891880061282556,
"repo_name": "zhangjungh/work",
"id": "9b8398eb9fe68a358d88c02e97d22c14344422a6",
"size": "466... |
from __future__ import absolute_import
from behave.tag_expression.model import Expression, Literal
from behave.tag_expression.model_ext import Matcher
# NOT-NEEDED: from cucumber_tag_expressions.model import Literal, Matcher
# NOT-NEEDED: from cucumber_tag_expressions.model import And, Or, Not, True_
import pytest
#... | {
"content_hash": "0a1ceecd6fcb62ed556e631b54926250",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 79,
"avg_line_length": 40.41509433962264,
"alnum_prop": 0.5718954248366013,
"repo_name": "jenisys/behave",
"id": "71193d48344eebfc51e740b0fafc888f90e12940",
"size": "2200",... |
import os
import numpy as np
import contextlib
with contextlib.redirect_stdout(None):
import pygame
from DeepRTS.python import Sprites
dir_path = os.path.dirname(os.path.realpath(__file__))
class FogTile(pygame.sprite.DirtySprite):
def __init__(self, group, x, y):
pygame.sprite.DirtySprite.__init__... | {
"content_hash": "18bfaf332ec9800994a4d1c3e8624742",
"timestamp": "",
"source": "github",
"line_count": 184,
"max_line_length": 138,
"avg_line_length": 33.04347826086956,
"alnum_prop": 0.5625,
"repo_name": "UIA-CAIR/DeepRTS",
"id": "4417306e067f77debafac4a67c2a5c5dd19b0f73",
"size": "6080",
"bina... |
import pickle
from collections import deque
from socketserver import BaseRequestHandler
from RULEngine.Communication.util.threaded_udp_server import ThreadedUDPServer
from RULEngine.Util.constant import DEBUG_RECEIVE_BUFFER_SIZE
from config.config_service import ConfigService
class UIDebugCommandReceiver(object):
... | {
"content_hash": "443e11c5651aa36113f2624ca8184660",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 78,
"avg_line_length": 40.45,
"alnum_prop": 0.6532756489493201,
"repo_name": "MaximeGLegault/StrategyIA",
"id": "ec6914972b8246cf6c1d0ab660d576151a477754",
"size": "1662",
... |
from . import Command as IFace
from cpk.model import Attribute, session, Node, Edge
from cpk import exc
from pathlib import Path
import os
import traceback
import io
from pprint import pprint
class Command(IFace):
def parent(self, node):
xs = session.query(Edge).filter_by(lower_node=node).all()
i... | {
"content_hash": "048ae1f765dd649135e3382286d91af7",
"timestamp": "",
"source": "github",
"line_count": 79,
"max_line_length": 95,
"avg_line_length": 26.59493670886076,
"alnum_prop": 0.518324607329843,
"repo_name": "yaccz/cpk",
"id": "c4af44810e932aa436339408fc585e119377de99",
"size": "2149",
"bi... |
import logging
import os
from oslo.config import cfg
from sqlalchemy.orm import exc as sa_exc
import webob.exc
from neutron.api import extensions as neutron_extensions
from neutron.api.v2 import attributes as attr
from neutron.api.v2 import base
from neutron.common import constants
from neutron.common import exceptio... | {
"content_hash": "3faf8587149db4a3df4e030d9497fdd9",
"timestamp": "",
"source": "github",
"line_count": 2133,
"max_line_length": 79,
"avg_line_length": 50.84106891701828,
"alnum_prop": 0.5426856257607613,
"repo_name": "CiscoSystems/vespa",
"id": "7dd0152007e164b228fe5a395566e96b97df1bc1",
"size": "... |
from ncclient import manager
import sys
from lxml import etree
# Set the device variables
DEVICE = '172.16.30.101'
USER = 'admin'
PASS = 'admin'
PORT = 830
# create a main() method
def main():
"""
Main method that updates the hostname of the remote device.
"""
new_name = """
<config>
<Syst... | {
"content_hash": "853e742c75f5a436749edc5b04c48eb0",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 75,
"avg_line_length": 23.26829268292683,
"alnum_prop": 0.5681341719077568,
"repo_name": "DevNetSandbox/sbx_nxos",
"id": "0d872365bc74f310f466e528710d37dd31af894a",
"size":... |
import datetime
import uuid
from typing import Union
IntLike = Union[int, str]
UUIDLike = Union[uuid.UUID, str]
DateLike = Union[str, datetime.datetime]
| {
"content_hash": "552cb8888f8e8bf6c2429cc2afd1cc2a",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 40,
"avg_line_length": 22,
"alnum_prop": 0.7727272727272727,
"repo_name": "sirosen/globus-sdk-python",
"id": "2dea03b9d295e440829840e0f229e370a3bf30cf",
"size": "154",
"bi... |
import urllib2
from urllib2 import urlopen
import json
import re
import requests
# Get Public IP
def getPublicIP():
data = requests.get('http://checkip.dyndns.com/').content
return re.compile(r'Address: (\d+.\d+.\d+.\d+)').search(data).group(1)
IP = str(getPublicIP())
# Get Location
url = 'ht... | {
"content_hash": "8ce7416e9d38418a00b4ad3b30690e9a",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 74,
"avg_line_length": 23.733333333333334,
"alnum_prop": 0.6432584269662921,
"repo_name": "Logan1x/Python-Scripts",
"id": "bdf282a114eb49567cd5206b6ba2fc71feb2f116",
"size"... |
"""
WSGI config for cart_project project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLICATI... | {
"content_hash": "cb34c05825c73faf15380fa37a0a3853",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 83,
"avg_line_length": 45.25,
"alnum_prop": 0.7941988950276243,
"repo_name": "marcosmoyano/simple-cart",
"id": "73ebee2cbe0dd48a57e3c66130e7173780232b9e",
"size": "1448",
... |
from .runner import BlackMambaTestRunner
class BlackMambaRunnerMixin(object):
test_runner = BlackMambaTestRunner
def run_suite(self, suite, **kwargs):
"""This is the version from Django 1.7."""
return self.test_runner(
verbosity=self.verbosity,
failfast=self.failfast,
... | {
"content_hash": "fdf9dde83e491678881cf221173e4617",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 50,
"avg_line_length": 28.416666666666668,
"alnum_prop": 0.6510263929618768,
"repo_name": "mlen108/mamba-runner",
"id": "734b09c96bfd70b3f6db4bc75f75a3e44103ab43",
"size": ... |
"""
Base classes for database handling
"""
class DBConnectorComponent(object):
"""
A fixed component of the DBConnector, handling one particular aspect of the
database. Instances of subclasses are assigned to attributes of the
DBConnector object, so that they are available at e.g., C{master.db.model}
... | {
"content_hash": "36864e941185bfc61fb87939ab8060f2",
"timestamp": "",
"source": "github",
"line_count": 62,
"max_line_length": 79,
"avg_line_length": 34.693548387096776,
"alnum_prop": 0.6387726638772664,
"repo_name": "eunchong/build",
"id": "77943dd13b23d03f84cf7b2d6aba8ebe7ba80158",
"size": "2857"... |
"""Various context related utilities, including inference and call contexts."""
import contextlib
import pprint
class InferenceContext(object):
__slots__ = ('path', 'lookupname', 'callcontext', 'boundnode', 'inferred')
def __init__(self, path=None, inferred=None):
self.path = path or set()
s... | {
"content_hash": "0d03767ef49bfb409bef07a59ca7e203",
"timestamp": "",
"source": "github",
"line_count": 72,
"max_line_length": 79,
"avg_line_length": 27.25,
"alnum_prop": 0.5693170234454639,
"repo_name": "rvmoura96/projeto-almoxarifado",
"id": "627bae5dfdcfb25794ff320cc34c86a8a9f07375",
"size": "22... |
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('ebooks', '0094_auto_20200413_1558'),
]
operations = [
migrations.AlterModelOptions(
name='section',
options={'ordering': ['-order_index'], 'verbose_name': 'section', 'verbos... | {
"content_hash": "9351a4507f18d561b49dccaa1a181095",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 113,
"avg_line_length": 24.4,
"alnum_prop": 0.587431693989071,
"repo_name": "flavoi/diventi",
"id": "0ead3adeaa8967ae7a6d4b02b3d68d1d19bd175a",
"size": "416",
"binary": f... |
from cms.exceptions import SubClassNeededError
from .models import PageExtension, TitleExtension
class ExtensionPool(object):
def __init__(self):
self.page_extensions = set()
self.title_extensions = set()
self.signaling_activated = False
def register(self, extension):
"""
... | {
"content_hash": "74104a0a71ec793364348f175f1371c4",
"timestamp": "",
"source": "github",
"line_count": 96,
"max_line_length": 118,
"avg_line_length": 36.333333333333336,
"alnum_prop": 0.6267201834862385,
"repo_name": "wuzhihui1123/django-cms",
"id": "95a590908268c03cc54c1e1a69cecfd7856ea1aa",
"siz... |
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 'Quiz.playcount'
db.delete_column(u'django_simplequiz_quiz', 'playcount')
... | {
"content_hash": "4dd9b30dfafb5eb211e2ab19b7874345",
"timestamp": "",
"source": "github",
"line_count": 174,
"max_line_length": 195,
"avg_line_length": 73.69540229885058,
"alnum_prop": 0.5586056305076815,
"repo_name": "theduke/django-simplequiz",
"id": "cf018cfee753b61b0681c7715c845da55ba12bd0",
"s... |
from django.contrib import admin
from documents.models import Document
class DocumentAdmin(admin.ModelAdmin):
list_display = ('title', 'page',)
admin.site.register(Document, DocumentAdmin)
| {
"content_hash": "8ae1712397c0f8ecc3c029f9cf52e7c4",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 44,
"avg_line_length": 24.75,
"alnum_prop": 0.7676767676767676,
"repo_name": "odyaka341/django-page-cms",
"id": "4d005250d2d31d72caf3a09279ea6e189c59e946",
"size": "215",
... |
from __future__ import unicode_literals
from boto3 import Session
from moto.core import BaseBackend, BaseModel
from collections import OrderedDict
from datetime import date
from .exceptions import ResourceNotFoundException, PolicyNotFoundException
class Container(BaseModel):
def __init__(self, *args, **kwargs):
... | {
"content_hash": "318fd15241cbf0b0548326f11c6b96d8",
"timestamp": "",
"source": "github",
"line_count": 120,
"max_line_length": 85,
"avg_line_length": 36.025,
"alnum_prop": 0.6414526948878094,
"repo_name": "william-richard/moto",
"id": "b26d606b043aa2f53ff1d9e652dbf9bc1013e9bd",
"size": "4323",
"... |
from setuptools import setup
if __name__ == "__main__":
setup(name="django-nsa",
version="0.1",
url="https://github.com/lvm/django_nsa",
license="MIT",
author="Mauro",
author_email="mauro@cacavoladora.org",
description="An easy way for the NSA to see what... | {
"content_hash": "47477b3060b61a14346e6198f0eb1fa1",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 95,
"avg_line_length": 36.53333333333333,
"alnum_prop": 0.5191605839416058,
"repo_name": "lvm/django_nsa",
"id": "82517ce426514692ccfc0dc5ea6362fa58023d2f",
"size": "1096",... |
"""
Tornado 中两种异步 handler 的实现方式
"""
import tornado
class CoroutineHandler(tornado.web.RequestHanlder):
"""
使用 gen.coroutine 实现的异步handler
"""
@tornado.gen.coroutine
def get(self):
http = tornado.httpclient.AsyncHTTPClient()
response = yield http.fetch("http://friendfeed-api.com/v2/... | {
"content_hash": "e70694c226ccc36d2076a50f105d9fa3",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 80,
"avg_line_length": 32.44736842105263,
"alnum_prop": 0.6439578264395782,
"repo_name": "aiden0z/snippets",
"id": "3ef6e6da33993ee2e709974c22c580188ae8e0cc",
"size": "1430... |
from __future__ import division, absolute_import, print_function
import functools
import warnings
import numpy.core.numeric as _nx
from numpy.core.numeric import (
asarray, zeros, outer, concatenate, array, asanyarray
)
from numpy.core.fromnumeric import reshape, transpose
from numpy.core.multiarray import no... | {
"content_hash": "d556667ff7d41f4a4e02b9b16fe92cdf",
"timestamp": "",
"source": "github",
"line_count": 1244,
"max_line_length": 105,
"avg_line_length": 30.543408360128616,
"alnum_prop": 0.5503474049899989,
"repo_name": "kushalbhola/MyStuff",
"id": "a5d0040aa71629dda28dac6821f042f8fbd34978",
"size"... |
module = request.controller
resourcename = request.function
if not settings.has_module(module):
raise HTTP(404, body="Module disabled: %s" % module)
# -----------------------------------------------------------------------------
def index():
""" Module's Home Page """
return s3db.cms_index(module, alt_fu... | {
"content_hash": "2bfedda5bd81e467f648be5126a213f9",
"timestamp": "",
"source": "github",
"line_count": 435,
"max_line_length": 91,
"avg_line_length": 38.85287356321839,
"alnum_prop": 0.373705697887699,
"repo_name": "nck0405/ChennaiEden",
"id": "821529a7f51d30cc7330927a73f595f5c47d27fe",
"size": "1... |
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("PartyListV2", "0007_auto_20180510_2347"),
]
operations = [
migrations.AlterModelOptions(
name="restrictedguest",
options={
... | {
"content_hash": "67394bccda4efc02b655b951da4a48d6",
"timestamp": "",
"source": "github",
"line_count": 69,
"max_line_length": 77,
"avg_line_length": 30.130434782608695,
"alnum_prop": 0.5045695045695046,
"repo_name": "sigmapi-gammaiota/sigmapi-web",
"id": "56f29c76d0d73818ac8707de27f3ede95fdebc42",
... |
import argparse
import pandas as pd
if __name__ == "__main__":
# parse command-line arguments
parser = argparse.ArgumentParser()
parser.add_argument("--emx", help="expression matrix file", required=True)
parser.add_argument("--cmx", help="correlation matrix file", required=True)
parser.add_argument("--output", ... | {
"content_hash": "ec67919033fdc44d6db5dd172fbf7ed5",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 107,
"avg_line_length": 30.18,
"alnum_prop": 0.6792577866136514,
"repo_name": "SystemsGenetics/KINC",
"id": "09e59ca7ab7a8bcc6bd770d7f8d7da26cd96c66a",
"size": "1509",
"b... |
from __future__ import print_function
import numpy as np
from keras.datasets import mnist
from keras.models import Sequential
from keras.layers import Dense, Activation, Dropout
from keras.optimizers import Adam
from keras.utils import np_utils
# seed, so that same random numbers are
# generated every time the progr... | {
"content_hash": "56c64f3ebde03a08486c9b7f3687ed04",
"timestamp": "",
"source": "github",
"line_count": 68,
"max_line_length": 95,
"avg_line_length": 27.147058823529413,
"alnum_prop": 0.728602383531961,
"repo_name": "raul-jr3/dope-learning",
"id": "2ad370d8de774031745105c4eb8490f8d73c88d9",
"size":... |
import sys
try:
import redis
print "Redis python drivier is ok!"
except Exception, e:
print e
sys.exit(1)
finally:
sys.exit(1)
| {
"content_hash": "342500cf612176213b2c3e8b11b7bfff",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 39,
"avg_line_length": 10.2,
"alnum_prop": 0.6209150326797386,
"repo_name": "stanxii/indexRiver",
"id": "12ce0bccc48ab0db3bf45a9a21e4e493a2b5412d",
"size": "189",
"binary... |
"""
Verbose and colourful traceback formatting.
**ColorTB**
I've always found it a bit hard to visually parse tracebacks in Python. The
ColorTB class is a solution to that problem. It colors the different parts of a
traceback in a manner similar to what you would expect from a syntax-highlighting
text editor.
Inst... | {
"content_hash": "d65f76c1b12fc8088f516781a0d39ff1",
"timestamp": "",
"source": "github",
"line_count": 1370,
"max_line_length": 116,
"avg_line_length": 39.895620437956204,
"alnum_prop": 0.566478218709406,
"repo_name": "wolfram74/numerical_methods_iserles_notes",
"id": "34908cd85ec2d0c84e314cbcebac74... |
import sys
import argparse
AVG_COLS = 12
COV_COLS = 78
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument("-a", dest='avg_cols', type=int, required=True, help='number of timbre average columns')
parser.add_argument("-c", dest='cov_cols', type=int, required=True, help='numbe... | {
"content_hash": "77affd19190e1c889fc513340caeb920",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 118,
"avg_line_length": 30.902439024390244,
"alnum_prop": 0.6179952644041041,
"repo_name": "uwescience/raco",
"id": "63ec52ec211aefb26174fa5e0136b1c990702d0f",
"size": "126... |
from __future__ import unicode_literals
from django.conf.urls import *
from . import views
from ..utils import UUID_PATTERN
urlpatterns = [
url(r'^$', views.RecordListView.as_view(), name='list'),
url(r'^(?P<id>%s)/' % UUID_PATTERN, views.RecordDetailView.as_view(), name='detail'),
]
| {
"content_hash": "b5540f0f2f28a4eefdad713f8048c330",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 89,
"avg_line_length": 26.90909090909091,
"alnum_prop": 0.6756756756756757,
"repo_name": "febsn/djangocms-copilot",
"id": "c17524b498e490f894ea14bbf01822cf52c62c44",
"size"... |
"""
Many-to-many relationships via an intermediary table
For many-to-many relationships that need extra fields on the intermediary
table, use an intermediary model.
In this example, an ``Article`` can have multiple ``Reporter`` objects, and
each ``Article``-``Reporter`` combination (a ``Writer``) has a ``posit... | {
"content_hash": "467ca3bedcc332011167fa1268d24e32",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 75,
"avg_line_length": 31.046511627906977,
"alnum_prop": 0.6883895131086142,
"repo_name": "yephper/django",
"id": "b2ce359e49f14c71e210d864d5217d532ff0c629",
"size": "1335"... |
import cgi
import datetime
import json
import urllib
from google.appengine.api import users
from google.appengine.api import search
from google.appengine.api.images import get_serving_url
from google.appengine.ext import ndb
from google.appengine.ext import blobstore
from google.appengine.ext.webapp import blobstore_... | {
"content_hash": "be1135dc8b35db5f3c045e156f222c4d",
"timestamp": "",
"source": "github",
"line_count": 190,
"max_line_length": 120,
"avg_line_length": 39.33684210526316,
"alnum_prop": 0.6762108643296763,
"repo_name": "zachwhaley/connexus-web-python",
"id": "7013acd766a174a038ea21afb850c0c9bcb3193b",... |
"""Tests the mongo data store abstraction."""
# pylint: disable=unused-import
# Support mongo storage
from grr.lib import access_control
from grr.lib import data_store
from grr.lib import data_store_test
from grr.lib import flags
from grr.lib import test_lib
from grr.lib.data_stores import mongo_data_store_old
# pyl... | {
"content_hash": "f988d09fe31b7dd8f8293f76b976c42c",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 79,
"avg_line_length": 35.76923076923077,
"alnum_prop": 0.7263440860215054,
"repo_name": "spnow/grr",
"id": "dcd3b05255b85aafbbccdde3cbf69b41ce7ce0ec",
"size": "1932",
"b... |
import os, subprocess, sys
subprocess.call(['python', 'virtualenv.py', 'flask'])
if sys.platform == 'win32':
bin = 'Scripts'
else:
bin = 'bin'
subprocess.call([os.path.join('flask', bin, 'pip'), 'install', 'flask<0.10'])
subprocess.call([os.path.join('flask', bin, 'pip'), 'install', 'flask-login'])
subprocess.c... | {
"content_hash": "0bba76140a3330665f4c2fa57c5654a2",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 122,
"avg_line_length": 64,
"alnum_prop": 0.6569293478260869,
"repo_name": "caseyalford/tracit",
"id": "fbd302da95c0a4fd60a419b9a7346846ebde45b2",
"size": "1490",
"binary... |
"""Support for esphome devices."""
from __future__ import annotations
from dataclasses import dataclass, field
import functools
import logging
import math
from typing import Any, Callable, Generic, NamedTuple, TypeVar, cast, overload
from aioesphomeapi import (
APIClient,
APIConnectionError,
APIIntEnum,
... | {
"content_hash": "50e09ce613789ca2c7a2ab14075239f1",
"timestamp": "",
"source": "github",
"line_count": 806,
"max_line_length": 105,
"avg_line_length": 34.648883374689824,
"alnum_prop": 0.6175385827335553,
"repo_name": "jawilson/home-assistant",
"id": "8e7f2524a3576484164cd106491b70f03417a326",
"si... |
"""
The MIT License (MIT)
Copyright (c) 2016 Mervin <mofei2816@gmail.com>
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... | {
"content_hash": "c0e0517fd87c9b36ed93d55020d4d4c8",
"timestamp": "",
"source": "github",
"line_count": 89,
"max_line_length": 84,
"avg_line_length": 31.089887640449437,
"alnum_prop": 0.6808818214672931,
"repo_name": "mofei2816/mervinz",
"id": "70b41590871f0d3f26f1da86440bf59c01881ac3",
"size": "27... |
import datetime
from sqlalchemy import (Column, String, Integer, ForeignKey, DateTime,
UniqueConstraint)
from sqlalchemy_utils import ChoiceType
from ircb.config import settings
from ircb.models.lib import Base
CHANNEL_STATUS_TYPES = (
('0', 'Connecting'),
('1', 'Connected'),
('2'... | {
"content_hash": "0092c2b21266889bbb8d364f7f105574",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 70,
"avg_line_length": 30.526315789473685,
"alnum_prop": 0.6189655172413793,
"repo_name": "Ghost-script/ircb",
"id": "544272d9940cf3d620c73a621ee7112e3f1d98b1",
"size": "11... |
from Training import Training | {
"content_hash": "361290fcfa50f522a4948a62d3943b44",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 29,
"avg_line_length": 29,
"alnum_prop": 0.896551724137931,
"repo_name": "aerialhedgehog/VyPy",
"id": "2252aaf02ed034d6a43331af432a54a072454b87",
"size": "30",
"binary": f... |
{"fs": {"rctn": {
"info": {
"name": "RCTN extension",
"version": "0.9.0",
"date": "Feb 21, 2016",
"author": "Jeff Teeters",
"contact": "jteeters@berkeley.edu",
"description": ("Redwood Center for Theoretical Neuroscience extension for the NWB"
" format. Also includes some metadata for ... | {
"content_hash": "a1332735af37fb66fcf54ca69250efac",
"timestamp": "",
"source": "github",
"line_count": 64,
"max_line_length": 87,
"avg_line_length": 38.734375,
"alnum_prop": 0.5344897135941912,
"repo_name": "NeurodataWithoutBorders/api-python",
"id": "9b665c4e041760ea23f8ff3c502afb887f531411",
"si... |
import logging
import six
import yaml
import os
from functools import partial
from collections import namedtuple
from .options import OPTIONS_INFO
from ..utility.notification import Notifier
LOG = logging.getLogger(__name__)
## @brief Data for an option value change notification.
#
# Instances of this class are used... | {
"content_hash": "dc13501d62c6bc05d138555045af5285",
"timestamp": "",
"source": "github",
"line_count": 149,
"max_line_length": 100,
"avg_line_length": 40.4496644295302,
"alnum_prop": 0.6379625020740003,
"repo_name": "mesheven/pyOCD",
"id": "093e28df6b8bb94cb5d29e35082b04112c6a2873",
"size": "6662"... |
"""Tests for Plex server."""
import copy
from unittest.mock import patch
from requests.exceptions import ConnectionError, RequestException
from homeassistant.components.media_player import DOMAIN as MP_DOMAIN
from homeassistant.components.plex.const import (
CONF_IGNORE_NEW_SHARED_USERS,
CONF_IGNORE_PLEX_WEB_... | {
"content_hash": "2cbe21e589ad9ddfdfb459e0f1715e55",
"timestamp": "",
"source": "github",
"line_count": 168,
"max_line_length": 88,
"avg_line_length": 34.791666666666664,
"alnum_prop": 0.6961505560307956,
"repo_name": "aronsky/home-assistant",
"id": "724b34cf729c347f8593d6be88d90aafbb08cf4a",
"size... |
import oslo_messaging
from cinder.api import extensions
from cinder.api.openstack import wsgi
from cinder.api.views import capabilities as capabilities_view
from cinder import exception
from cinder.i18n import _
from cinder import objects
from cinder.volume import rpcapi
def authorize(context, action_name):
exte... | {
"content_hash": "151a4807b73472e38db40cb230f59aa8",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 79,
"avg_line_length": 32.43103448275862,
"alnum_prop": 0.6671982987772461,
"repo_name": "Hybrid-Cloud/cinder",
"id": "fbae6a88105c5841dedddd4f3b6735fa80ec1d72",
"size": "2... |
import pytest
import netmiko
from DEVICE_CREDS import *
def setup_module(module):
module.EXPECTED_RESPONSES = {
'base_prompt' : 'openstack-rb5',
'interface_ip' : '10.254.8.8',
}
show_ver_command = 'show version'
multiple_line_command = 'show interface'
module.basic_command = 's... | {
"content_hash": "fe01d787e029ab38eaf2dd2d11a135ea",
"timestamp": "",
"source": "github",
"line_count": 77,
"max_line_length": 81,
"avg_line_length": 23.766233766233768,
"alnum_prop": 0.6726775956284153,
"repo_name": "nvoron23/netmiko",
"id": "37b057d6504d65cf455bc8ea416b8958ad803abe",
"size": "185... |
"""
Lineup optimizations based on predicted scores for each player
"""
import itertools
import collections
import pandas as pd
import numpy as np
from sqlalchemy.orm.exc import NoResultFound
import db
import features as f
import model as m
from util import Timed, lineup_csv_filename
import fanduel as fd
pd.set_opti... | {
"content_hash": "d7454c2282c14d1055376fd139513932",
"timestamp": "",
"source": "github",
"line_count": 337,
"max_line_length": 120,
"avg_line_length": 31.136498516320476,
"alnum_prop": 0.576765462689412,
"repo_name": "seansu4you87/kupo",
"id": "b84c881d15f83ec70084e5659bba94d92b222966",
"size": "1... |
from google.cloud import dialogflow_v2
async def sample_get_agent():
# Create a client
client = dialogflow_v2.AgentsAsyncClient()
# Initialize request argument(s)
request = dialogflow_v2.GetAgentRequest(
parent="parent_value",
)
# Make the request
response = await client.get_agen... | {
"content_hash": "69c2c1b02dab9f8243b63e176b758b35",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 54,
"avg_line_length": 23.210526315789473,
"alnum_prop": 0.6984126984126984,
"repo_name": "googleapis/python-dialogflow",
"id": "586fbb434070d3a972c763b6c69b88e2eb231b14",
... |
from __future__ import annotations
import logging
import shutil
from datetime import datetime
from airflow.decorators import dag, task
log = logging.getLogger(__name__)
if not shutil.which("virtualenv"):
log.warning("The tutorial_taskflow_api_virtualenv example DAG requires virtualenv, please install it.")
else... | {
"content_hash": "126e28709efb862079b88dc81a76bbd7",
"timestamp": "",
"source": "github",
"line_count": 70,
"max_line_length": 107,
"avg_line_length": 32.81428571428572,
"alnum_prop": 0.5903352198519809,
"repo_name": "apache/airflow",
"id": "a78116d2f74938bcf8ba28e4a846dd07c78edff5",
"size": "3084"... |
'''
Helpful decorators for module writing
'''
# Import python libs
from __future__ import absolute_import
import inspect
import logging
import time
from functools import wraps
from collections import defaultdict
# Import salt libs
import salt.utils
from salt.exceptions import CommandNotFoundError
from salt.log import... | {
"content_hash": "81dadb36cb333098a8d203a8eb2a42dd",
"timestamp": "",
"source": "github",
"line_count": 249,
"max_line_length": 100,
"avg_line_length": 33.64658634538153,
"alnum_prop": 0.5224397230842683,
"repo_name": "smallyear/linuxLearn",
"id": "45d3bd650958084137d0366b3dc1e41c507da67b",
"size":... |
from typing import Text
from zerver.lib.test_classes import WebhookTestCase
class JiraHookTests(WebhookTestCase):
STREAM_NAME = 'jira'
URL_TEMPLATE = u"/api/v1/external/jira?api_key={api_key}"
def test_unknown(self):
# type: () -> None
url = self.build_webhook_url()
result = self.... | {
"content_hash": "306d2d506c49536b6377f71206c79925",
"timestamp": "",
"source": "github",
"line_count": 107,
"max_line_length": 584,
"avg_line_length": 51.23364485981308,
"alnum_prop": 0.6233126596132799,
"repo_name": "amyliu345/zulip",
"id": "bb5905f0f07fca0512278ffc6728a82b5eb4d3e0",
"size": "550... |
def include_me(config, module_name='vaktuk'):
""" Extensibility function for embedding the CMS in other Pyramid apps.
Pyramid will use this function on another application's configuration when
this module is loaded through a call to 'include' on Configurator instances
with the vaktuk module given as an... | {
"content_hash": "28d8018f30c3ee77ba0323a66154d573",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 79,
"avg_line_length": 37,
"alnum_prop": 0.7378378378378379,
"repo_name": "LimpidTech/Vaktuk",
"id": "51b75b3d56a74319e55a8c984af1da859e7f3c8d",
"size": "370",
"binary": ... |
import sys
from steel import base, fields
__all__ = ['Structure']
class Structure(base.Structure):
def __init__(self, *args, **kwargs):
super(Structure, self).__init__(*args, **kwargs)
self._bits_left = 0
self._bit_buffer = 0
def read(self, size=None):
bit_buff... | {
"content_hash": "88f10145af923d53208021d4135849f9",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 66,
"avg_line_length": 32.84444444444444,
"alnum_prop": 0.5006765899864682,
"repo_name": "gulopine/steel",
"id": "f8280fb22badd0c656fb463aac079df9b39d1064",
"size": "1478",... |
import os
import logging
import time
from mpxapi import MPXApi
from mpxapi.entertainment import Program
from mpxapi.adapter import Checksum
logging.basicConfig(level=logging.DEBUG)
username = os.environ["MPX_USERNAME"]
password = os.environ["MPX_PASSWORD"]
account = os.environ["MPX_ACCOUNT"]
api = MPXApi(username=us... | {
"content_hash": "9bcf1f274cff075f78f5165b33071b99",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 77,
"avg_line_length": 21.6875,
"alnum_prop": 0.6926032660902978,
"repo_name": "blockbuster/mpxapi",
"id": "daf0bc48f252f261b468eef1a5c5952f51fe03cc",
"size": "1041",
"bi... |
from troposphere import FindInMap, GetAtt, Join, Output
from troposphere import Parameter, Ref, Template
from troposphere.awslambda import Function, Code
from troposphere.cloudformation import CustomResource
from troposphere.ec2 import Instance
from troposphere.ec2 import SecurityGroup
from troposphere.iam import Role,... | {
"content_hash": "1eb637c50c7b4f3009016fe6ca69f63b",
"timestamp": "",
"source": "github",
"line_count": 134,
"max_line_length": 76,
"avg_line_length": 34.298507462686565,
"alnum_prop": 0.5667972149695387,
"repo_name": "Yipit/troposphere",
"id": "d24b5d668a1c99f535bcd26abeb81a53ba67ed40",
"size": "4... |
def extractPhiarehereWordpressCom(item):
'''
Parser for 'phiarehere.wordpress.com'
'''
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or "preview" in item['title'].lower():
return None
tagmap = [
('Protagonist Harem Delusion', 'There Will Always Be Protag... | {
"content_hash": "502dea46aa0c0e3d695a95c96566393e",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 146,
"avg_line_length": 32.25,
"alnum_prop": 0.6682170542635659,
"repo_name": "fake-name/ReadableWebProxy",
"id": "168323ef173fe2f672f39ed9dcf83bed9ebf3ba8",
"size": "645",... |
"""This is the docstring for the example.py module. Modules names should
have short, all-lowercase names. The module name may have underscores if
this improves readability.
Every module should have a docstring at the very top of the file. The
module's docstring may extend over multiple lines. If your docstring doe... | {
"content_hash": "5288135d5ab8e429cda474a4b290bdd5",
"timestamp": "",
"source": "github",
"line_count": 123,
"max_line_length": 75,
"avg_line_length": 29.10569105691057,
"alnum_prop": 0.6606145251396648,
"repo_name": "jorisvandenbossche/numpy",
"id": "8a5f9948f3cb4ce709804d571ed698b484f212d8",
"siz... |
import SocketServer,sys,os,socket
import urllib2,urllib
import runkey
import random
import pickle
import runkey
local=False
random_port=False #debug 9999
#print ('#handle request from local client in order to encrypt the data then send to remote host')
class MyTCPHandler(SocketServer.BaseRequestHandler):
"""
... | {
"content_hash": "9427cd7453cfbb35ff132ccd2ca2e7b2",
"timestamp": "",
"source": "github",
"line_count": 150,
"max_line_length": 100,
"avg_line_length": 24.7,
"alnum_prop": 0.6650472334682861,
"repo_name": "cellus-sas/heavy-encypted-chat",
"id": "3e5fa83a21a16e814986d4c996e1783ec25f1414",
"size": "3... |
from qpid.testlib import TestBase
class MessageHeaderTests(TestBase):
"""Verify that messages with headers work as expected"""
def test_message_with_integer_header(self):
props={"headers":{"one":1, "zero":0}}
self.queue_declare(queue="q")
q = self.consume("q")
self.assertPublis... | {
"content_hash": "1e5e936795fead79a9abda8cfa27b2b7",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 127,
"avg_line_length": 45.333333333333336,
"alnum_prop": 0.5992647058823529,
"repo_name": "mbroadst/debian-qpid-python",
"id": "3d64adfcf0cf6f60c07f21ea9a4d6aaea7b46539",
... |
"""Collection of tests to run on the rootfs of a built image."""
from __future__ import print_function
import cStringIO
import collections
import itertools
import magic
import mimetypes
import os
import re
import stat
import unittest
from chromite.lib import cros_build_lib
from chromite.lib import cros_logging as lo... | {
"content_hash": "0adb85f464ed462624ef8ea03f9c88d4",
"timestamp": "",
"source": "github",
"line_count": 519,
"max_line_length": 80,
"avg_line_length": 32.252408477842,
"alnum_prop": 0.6401816118047673,
"repo_name": "guorendong/iridium-browser-ubuntu",
"id": "18305e05b89721f862d795b860830705f23e3abf",... |
"""
Management class for migration / resize operations.
"""
import os
from nova.openstack.common import excutils
from nova.openstack.common import log as logging
from nova.virt.hyperv import hostutils
from nova.virt.hyperv import imagecache
from nova.virt.hyperv import pathutils
from nova.virt.hyperv import vhdutils
f... | {
"content_hash": "e84df9f55024aa852991cf764bfdb228",
"timestamp": "",
"source": "github",
"line_count": 225,
"max_line_length": 79,
"avg_line_length": 43.88,
"alnum_prop": 0.5544414058543502,
"repo_name": "sridevikoushik31/nova",
"id": "ff8651efe85de65a9e2d90b7895f67ed422ec212",
"size": "10557",
... |
import functools
import netaddr
from oslo_serialization import jsonutils
import six
from nova import exception
from nova.i18n import _
from nova import utils
# Constants for the 'vif_type' field in VIF class
VIF_TYPE_OVS = 'ovs'
VIF_TYPE_IVS = 'ivs'
VIF_TYPE_DVS = 'dvs'
VIF_TYPE_IOVISOR = 'iovisor'
VIF_TYPE_BRIDGE ... | {
"content_hash": "2480fa586d851aecbb3427259ba7c3b1",
"timestamp": "",
"source": "github",
"line_count": 573,
"max_line_length": 79,
"avg_line_length": 33.26352530541012,
"alnum_prop": 0.6015215110178384,
"repo_name": "Juniper/nova",
"id": "7ee32c2b608eed1e6828b551c74d9985e27fdbda",
"size": "19696",... |
from django.contrib import admin
from symposion.conference.models import Section
from symposion.proposals.models import ProposalBase
from symposion.schedule.models import Schedule, Day, Room, SlotKind, Slot, \
SlotRoom, Presentation
admin.site.register(Schedule, list_display=("section", "published"))
admin.site.... | {
"content_hash": "da57adfcdb9ed71c7eefb27d01dfccad",
"timestamp": "",
"source": "github",
"line_count": 107,
"max_line_length": 99,
"avg_line_length": 33.1588785046729,
"alnum_prop": 0.6302142051860203,
"repo_name": "Diwahars/pycon",
"id": "adc25be03ff07e7556255d6d07ada342c83a2604",
"size": "3548",... |
"""
Copyright 2015 Rackspace
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
dist... | {
"content_hash": "69b42d2f15e7068686c050dac11a048c",
"timestamp": "",
"source": "github",
"line_count": 242,
"max_line_length": 78,
"avg_line_length": 33.37603305785124,
"alnum_prop": 0.6265940324377863,
"repo_name": "grahamhayes/designate",
"id": "d23f94b3ee34df87a844b9af40e5a48c0331ccfe",
"size":... |
"Functional tests for using a swapped user model."
import unittest
from django.conf import settings
from .. import test_views
@unittest.skipUnless(
'allaccess.tests.custom' in settings.INSTALLED_APPS,
'custom user is not installed for testing')
class CustomizedCallbackTestCase(test_views.OAuthCallbackTestC... | {
"content_hash": "cacfa83fa0dab2351aef461ccdfbc107",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 67,
"avg_line_length": 30,
"alnum_prop": 0.719047619047619,
"repo_name": "iXioN/django-all-access",
"id": "21c4c95a2a06538f19891c5b496b489147c2ca0d",
"size": "840",
"bina... |
"""Middleware that can dynamically change the stack based on status or headers
Used in the authentication middleware to intercept 401 responses and put the
appropriate middleware into the stack to prompt the user to sign in.
"""
from paste.auth import multi
import logging
log = logging.getLogger('authkit.authentica... | {
"content_hash": "b7f25ab86cce6da62fc41ad51ee76692",
"timestamp": "",
"source": "github",
"line_count": 139,
"max_line_length": 108,
"avg_line_length": 39.330935251798564,
"alnum_prop": 0.5357600146332541,
"repo_name": "nakato/AuthKit",
"id": "6ccf8652fc4313823fd94c8dc16473d7dd73fd86",
"size": "546... |
"""
Document generation for HTML5.
"""
#import locale
#import lxml
from lxml.builder import E
from lxml import etree
#from lxml import etree
#lxml.html.html5parser
DEFAULT_LANG, DEFAULT_ENCODING = "en", "UTF-8"
MIME_XHTML5="application/xhtml+xml"
xhtml_parser = None
# example doc
#<?xml version="1.0" encoding... | {
"content_hash": "33ba28b8123869b4b0ba31e22d1f84a5",
"timestamp": "",
"source": "github",
"line_count": 135,
"max_line_length": 108,
"avg_line_length": 28.711111111111112,
"alnum_prop": 0.6493808049535603,
"repo_name": "kdart/pycopia",
"id": "a72993f0bf405198c78264a8427f3e73af1be900",
"size": "4513... |
"""Simple inline keyboard bot with multiple CallbackQueryHandlers.
This Bot uses the Updater class to handle the bot.
First, a few callback functions are defined as callback query handler. Then, those functions are
passed to the Dispatcher and registered at their respective places.
Then, the bot is started and runs un... | {
"content_hash": "db2e03a319a36c351fd052f772e2cdbc",
"timestamp": "",
"source": "github",
"line_count": 202,
"max_line_length": 99,
"avg_line_length": 34.56435643564357,
"alnum_prop": 0.6601260383844171,
"repo_name": "tzpBingo/github-trending",
"id": "2276238e4131cb197ef4a331beac9539e0af2ab8",
"siz... |
"""Test HydroData public methods
"""
import os
import unittest
import numpy as np
import freesif as fs
FILES = os.path.join(os.path.dirname(__file__), 'files')
class TestHydroData(unittest.TestCase):
@classmethod
def setUpClass(cls):
# establish HydroData instances and associated verification data... | {
"content_hash": "898a17010b767a87aa36f4f75d266497",
"timestamp": "",
"source": "github",
"line_count": 98,
"max_line_length": 101,
"avg_line_length": 35.673469387755105,
"alnum_prop": 0.6578947368421053,
"repo_name": "agrav/freesif",
"id": "ba73989cc651af1b0cf716c3b15596edfa489f86",
"size": "3520"... |
from hashlib import md5
from typing import Any, Mapping, Sequence, Union
from urllib.parse import urljoin, urlsplit, urlunsplit, urlencode
import requests
from requests import Response
from requests.auth import AuthBase, HTTPBasicAuth, HTTPDigestAuth
from rets.http.parsers import (
parse_capability_urls,
pars... | {
"content_hash": "81b7353ac693475340c7a495558ad248",
"timestamp": "",
"source": "github",
"line_count": 386,
"max_line_length": 107,
"avg_line_length": 45.898963730569946,
"alnum_prop": 0.6223965682677655,
"repo_name": "opendoor-labs/rets",
"id": "c5d2305d8204b97314db55d0ad113c992f89a2be",
"size": ... |
from cloudify import ctx
from cloudify.decorators import operation
import cloudify_nsx.library.nsx_esg_dlr as cfy_dlr
import cloudify_nsx.library.nsx_common as common
@operation
def create(**kwargs):
validation_rules = {
"dlr_id": {
"required": True
},
"areaId": {
"... | {
"content_hash": "2b9daa8b8a0a265b1b3ab2513e899e58",
"timestamp": "",
"source": "github",
"line_count": 94,
"max_line_length": 68,
"avg_line_length": 24.96808510638298,
"alnum_prop": 0.5125692373242438,
"repo_name": "cloudify-cosmo/cloudify-nsx-plugin",
"id": "8f8b08f7ee7a3d4c6b9c16259b255bb3feb617d6... |
"""This package is the url dispatcher for date views.
This urlconf takes a url in the form **/date/...** and can generate a general archive, yearly archive or monthly archive."""
from django.conf.urls import url
from mousedb.animal.views import AnimalYearArchive, AnimalMonthArchive, date_archive_year
urlpatterns = ... | {
"content_hash": "446daeb8e3db5a9250a5bf16f4aede26",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 124,
"avg_line_length": 43.07692307692308,
"alnum_prop": 0.6964285714285714,
"repo_name": "davebridges/mousedb",
"id": "4acd95c980f1da3ac924edad420e4b41e8ec40f7",
"size": "... |
from django.conf.urls import patterns, include, url
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
url(r'^api/topo/', include('topo.urls')),
url(r'^api/quiz/', include('quiz.urls')),
url(r'^admin/', include(admin.site.urls)),
url(r'', include("front.urls")),
)
| {
"content_hash": "a327ecc775a7d5007129fe633c9481a8",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 51,
"avg_line_length": 24.53846153846154,
"alnum_prop": 0.6489028213166145,
"repo_name": "pramodliv1/conceptgrapher",
"id": "1924aedf748f5a9e33a29decd703b2bc59b9ba5e",
"siz... |
"""
Implementation of the Bond-Valence Sum method.
Data sourced from:
http://www.iucr.org/resources/data/datasets/bond-valence-parameters
"""
import numpy as np
import logging
import qmpy
logger = logging.getLogger(__name__)
def get_params(elt1, elt2):
raise NotImplementedError
def v_ij(atom1, atom2, p... | {
"content_hash": "a19f4e8ceac24b105918774eaca8a5dd",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 71,
"avg_line_length": 21.466666666666665,
"alnum_prop": 0.650103519668737,
"repo_name": "wolverton-research-group/qmpy",
"id": "cd724688bac39a1b03b95c7ce3dfbd15b0788685",
... |
'''
Created on 2017. 5. 12.
@author: Byoungho Kang
'''
from keras.utils import np_utils
from keras.datasets import mnist
from keras.models import Sequential
from keras.layers import Dense
'''
Training Set
'''
(X_train, Y_train), (X_test, Y_test) = mnist.load_data()
X_train = X_train.reshape(60000, 784).... | {
"content_hash": "8bbb6e99638c8a82efe6837850b5628a",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 81,
"avg_line_length": 23.5,
"alnum_prop": 0.6636271529888551,
"repo_name": "medit74/DeepLearning",
"id": "707e1185a06845403ec2e31096304ae30972a8e0",
"size": "987",
"bina... |
from django.conf.urls import url
from .views import BookListView, BookDetailView, bookborrow, SuggestBookView
urlpatterns = [
url(r'^$', BookListView.as_view(), name='list'),
url(r'^(?P<id>\d+)/$', BookDetailView.as_view(), name='detail'),
url(r'^(?P<id>\d+)/borrow/$', bookborrow, name='borrow'),
url(r'^suggestbo... | {
"content_hash": "a9efb3600d8178dae3368d36aef5ad50",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 76,
"avg_line_length": 37.6,
"alnum_prop": 0.6835106382978723,
"repo_name": "revaxl/book-lending-library",
"id": "6c1b02afa10cf20e9561ca90d073dc24a069acf8",
"size": "376",
... |
""" Sahana Eden Stats Model
@copyright: 2012-15 (c) Sahana Software Foundation
@license: MIT
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... | {
"content_hash": "0a3ac7be0e073a4b6e1c48902b7ff1f6",
"timestamp": "",
"source": "github",
"line_count": 1839,
"max_line_length": 127,
"avg_line_length": 44.26753670473083,
"alnum_prop": 0.4346624410377358,
"repo_name": "ScottBuchanan/eden",
"id": "ea292478fd53ad461b0b8697315912f23d62f329",
"size": ... |
"""
Use nose
`$ pip install nose`
`$ nosetests`
"""
from hyde.generator import Generator
from hyde.site import Site
from fswrap import File
from pyquery import PyQuery
TEST_SITE = File(__file__).parent.parent.child_folder('_test')
def assert_valid_conversion(html):
assert html
q = PyQuery(html)
assert "i... | {
"content_hash": "e4a8896615f31d9c757460655e049f46",
"timestamp": "",
"source": "github",
"line_count": 117,
"max_line_length": 67,
"avg_line_length": 22.384615384615383,
"alnum_prop": 0.5826651393661703,
"repo_name": "0111001101111010/hyde",
"id": "17d36e6bc2db3c6c924a3b4bf4640693f49cfce7",
"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": "e324523d0fb17281f18342ead1d55216",
"timestamp": "",
"source": "github",
"line_count": 94,
"max_line_length": 100,
"avg_line_length": 36.170212765957444,
"alnum_prop": 0.6970588235294117,
"repo_name": "zouzhberk/ambaridemo",
"id": "8a74bb02dab25e14683861a60b67fec187153e2c",
"size":... |
"""
Python Markdown
===============
Python Markdown converts Markdown to HTML and can be used as a library or
called from the command line.
## Basic usage as a module:
import markdown
html = markdown.markdown(your_text_string)
See <http://packages.python.org/Markdown/> for more
information and instructions ... | {
"content_hash": "36a96d0f6344fa05f28470c32dd21063",
"timestamp": "",
"source": "github",
"line_count": 432,
"max_line_length": 109,
"avg_line_length": 36.31018518518518,
"alnum_prop": 0.5946066556164733,
"repo_name": "mrozekma/Sprint",
"id": "a7ee157bf6584389c3790efa784f61b9bfbc8ff6",
"size": "156... |
from energenie import switch_off
switch_off()
| {
"content_hash": "0be5d37f40c8c43a2ef01836341e0876",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 32,
"avg_line_length": 15.666666666666666,
"alnum_prop": 0.7872340425531915,
"repo_name": "rjw57/energenie",
"id": "2a1da24365de650f7a41a0d51aa428c1bee1c661",
"size": "47",
... |
import sys
import os
import socket
import errno
import time
from math import pi
import threading
sys.path.insert(0, os.path.join(os.path.dirname(os.path.realpath(__file__)), '../mavlink/pymavlink'))
import mavutil
from mavutil import mavlink
from tools import *
# Constants
REQUIRED_NAVDATA = ("DEMO", "GPS", "TIME", "... | {
"content_hash": "a05cfe4c0f2e88d15b947eda7e961767",
"timestamp": "",
"source": "github",
"line_count": 662,
"max_line_length": 131,
"avg_line_length": 51.37764350453172,
"alnum_prop": 0.47924262025167585,
"repo_name": "orchidproject/ar2mav",
"id": "22df383edd4f332d78c9c13efb249777eb8db31b",
"size"... |
from swgpy.object import *
def create(kernel):
result = Creature()
result.template = "object/mobile/shared_dressed_hefsen_zindalai.iff"
result.attribute_template_id = 9
result.stfName("npc_name","human_base_male")
#### BEGIN MODIFICATIONS ####
#### END MODIFICATIONS ####
return result | {
"content_hash": "89818b5e556b13589f26c7db61293f3a",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 69,
"avg_line_length": 23.307692307692307,
"alnum_prop": 0.6963696369636964,
"repo_name": "anhstudios/swganh",
"id": "604b19b2734e2a5d11ea41c9016d454269876d6e",
"size": "44... |
import socket
import logging
from ryu.lib import hub
LOG = logging.getLogger('ldp_util')
def from_inet_ptoi(bgp_id):
"""Convert an IPv4 address string format to a four byte long.
"""
four_byte_id = None
try:
packed_byte = socket.inet_pton(socket.AF_INET, bgp_id)
four_byte_id = long(pac... | {
"content_hash": "aed1d9c94288edce2c2f85b7f027f891",
"timestamp": "",
"source": "github",
"line_count": 137,
"max_line_length": 77,
"avg_line_length": 28.394160583941606,
"alnum_prop": 0.5840616966580977,
"repo_name": "cloudysunny14/ryu_ldp_service",
"id": "ad7bb746a001135c0469ecc69ad785421147ecec",
... |
'''
Copyright 2017 Dell Inc. or its subsidiaries. All Rights Reserved.
This script tests node delayed rediscovery.
This test takes 10 minutes to run and runs against a single node, random or
specified via nodeid. Delayed rediscovery will start and script will send command to reboot the
node. The test will check to see... | {
"content_hash": "9f911b76713fe8ae1961c838150ecf4f",
"timestamp": "",
"source": "github",
"line_count": 204,
"max_line_length": 118,
"avg_line_length": 37.666666666666664,
"alnum_prop": 0.6080166579906299,
"repo_name": "panpan0000/RackHD",
"id": "c07225e59a391ed44dd03c64cc829ef259a725fc",
"size": "... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.