text stringlengths 4 1.02M | meta dict |
|---|---|
import sys
import MkDict
print("Test1 - create a dictionary")
keys = ['Australia', 'Eire', 'France', 'Finland', 'UK', 'US']
values = ['Canberra', 'Dublin', 'Paris', 'Helsinki', 'London', 'Washington']
countries = MkDict.MkDict(keys = keys, values = values)
print(countries)
print("Ref count:", sys.getrefcount(countr... | {
"content_hash": "b1f83b63c2127184f9713e99b8e8f415",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 76,
"avg_line_length": 32.2,
"alnum_prop": 0.6509316770186335,
"repo_name": "rbprogrammer/advanced_python_topics",
"id": "fb683ad805b5c4c277963800c8177c4e387e1be1",
"size":... |
from radish.stepregistry import step
from radish import given, when, then
@step("I have the following quote")
def have_quote(step):
step.context.quote = step.text
@when("I add it to the database")
def add_quote_to_db(step):
step.context.database.quotes.append(step.context.quote)
@then("I expect {number:g}... | {
"content_hash": "0bac712b85bb9eb44c9534d3c23888b2",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 59,
"avg_line_length": 26.058823529411764,
"alnum_prop": 0.7336343115124153,
"repo_name": "radish-bdd/radish",
"id": "08457e88a8dd50dbcc45f49d77e8aecd2cd610d3",
"size": "46... |
class GramFuzzError(Exception): pass
class OptGram(GramFuzzError): pass
class FlushGrams(GramFuzzError): pass
| {
"content_hash": "a4aade9413572a2a99ba98cb8976e2ed",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 37,
"avg_line_length": 22.4,
"alnum_prop": 0.8214285714285714,
"repo_name": "mseclab/PyJFuzz",
"id": "46e3d7d9f4a106d8e275c15db9058e7d88f83c81",
"size": "154",
"binary": f... |
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_Form(object):
def setupUi(self, Form):
Form.setObjectName("Form")
Form.resize(739, 497)
self.gridLayout = QtWidgets.QGridLayout(Form)
self.gridLayout.setContentsMargins(0, 0, 0, 0)
self.gridLayout.setSpacing(0)
self... | {
"content_hash": "a8fd026e5f86e3181ae6e6550342ddb6",
"timestamp": "",
"source": "github",
"line_count": 106,
"max_line_length": 114,
"avg_line_length": 56.75471698113208,
"alnum_prop": 0.7167553191489362,
"repo_name": "pmaunz/pyqtgraph",
"id": "c8c2cbacdba3643bbe95d80ffc7c0311b38d5396",
"size": "62... |
from google.cloud import aiplatform_v1
def sample_get_model_evaluation():
# Create a client
client = aiplatform_v1.ModelServiceClient()
# Initialize request argument(s)
request = aiplatform_v1.GetModelEvaluationRequest(
name="name_value",
)
# Make the request
response = client.ge... | {
"content_hash": "17fa3a426f7ea6144e8cab6d3d790b89",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 68,
"avg_line_length": 24.894736842105264,
"alnum_prop": 0.718816067653277,
"repo_name": "googleapis/python-aiplatform",
"id": "2a365ca607e72834e70df7c3a6acfbf581304554",
"... |
import mock
from oslo.config import cfg
from neutron.agent.common import config as a_cfg
import neutron_fwaas.services.firewall.drivers.linux.iptables_fwaas as fwaas
from neutron.tests import base
from neutron.tests.unit import test_api_v2
_uuid = test_api_v2._uuid
FAKE_SRC_PREFIX = '10.0.0.0/24'
FAKE_DST_PREFIX = '... | {
"content_hash": "c97be87f4efb1b8906cdcd5e3767d169",
"timestamp": "",
"source": "github",
"line_count": 235,
"max_line_length": 79,
"avg_line_length": 46.61702127659574,
"alnum_prop": 0.5477863989046098,
"repo_name": "dougwig/x-neutron-fwaas",
"id": "5302f0cb3e42455e62c3970d59fa7116706ce1bf",
"size... |
'''
Covenant Add-on
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the... | {
"content_hash": "310172bb7b72c591e85e67a07d72c0ba",
"timestamp": "",
"source": "github",
"line_count": 230,
"max_line_length": 180,
"avg_line_length": 41.66086956521739,
"alnum_prop": 0.45481110415362136,
"repo_name": "TheWardoctor/Wardoctors-repo",
"id": "4e5be74251e3f2cd061e1a3b85eae57f72d6e18b",
... |
import os
import tarfile
import zipfile
import redis
from datetime import datetime
from flask import Blueprint, request, jsonify, current_app
from flask_recaptcha import ReCaptcha
from werkzeug.utils import secure_filename
from routes.file_utils import fix_uri, handle_tar, handle_zip
from modules.gc import blob_gc_enqu... | {
"content_hash": "42dfbd1ecaee51bde448cbe6c003ddc9",
"timestamp": "",
"source": "github",
"line_count": 177,
"max_line_length": 97,
"avg_line_length": 41.186440677966104,
"alnum_prop": 0.5683127572016461,
"repo_name": "superphy/backend",
"id": "40bd4e640ff6d09b254956c955777d9747e94e4e",
"size": "72... |
__author__ = 'maxim'
class Model(object):
DATA_WITH_BIAS = False
EXPECTS_TIME_PARAM = False
def __init__(self, **params):
self._features = params['features']
def session(self):
class Dummy:
def __enter__(self): pass
def __exit__(self, exc_type, exc_val, exc_tb): pass
return Dummy()
... | {
"content_hash": "df8a67e5a1081e113a7e76234b9f8151",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 57,
"avg_line_length": 19.037037037037038,
"alnum_prop": 0.6264591439688716,
"repo_name": "maxim5/time-series-machine-learning",
"id": "0161aa0b90329882ec146d2eefd86e02c10da9... |
import dis
import os.path
import re
import subprocess
import sys
import types
import unittest
from test.support import findfile, run_unittest
def abspath(filename):
return os.path.abspath(findfile(filename, subdir="dtracedata"))
def normalize_trace_output(output):
"""Normalize DTrace output for comparison.... | {
"content_hash": "7edb196f707248a1c8d09b64e19d501d",
"timestamp": "",
"source": "github",
"line_count": 178,
"max_line_length": 80,
"avg_line_length": 30.089887640449437,
"alnum_prop": 0.6120238984316654,
"repo_name": "FFMG/myoddweb.piger",
"id": "8612e276d765884634bf3a033542a4fb14021f69",
"size": ... |
import re
import unicodedata
from socketio import socketio_manage
from socketio.namespace import BaseNamespace
from socketio.mixins import RoomsMixin, BroadcastMixin
from werkzeug.exceptions import NotFound
from gevent import monkey
from flask import Flask, Response, request, render_template, url_for, redirect
from fl... | {
"content_hash": "6020a77b79a11f15667701d3cd3d8b09",
"timestamp": "",
"source": "github",
"line_count": 162,
"max_line_length": 78,
"avg_line_length": 27.51851851851852,
"alnum_prop": 0.6336922386720503,
"repo_name": "abourget/gevent-socketio",
"id": "1ecd5a38fac69b191e6c86fa2ba1738a75289fcd",
"siz... |
"""
A vtkTkImageViewerWidget for python, which is based on the
vtkTkImageWindowWidget.
Specify double=1 to get a double-buffered window.
Created by David Gobbi, Nov 1999
"""
import Tkinter
import math, os, sys
import vtk
from vtkLoadPythonTkWidgets import vtkLoadPythonTkWidgets
class vtkTkImageViewerWidget(Tkinter... | {
"content_hash": "8d19dbd738a7b26ed75ec89c257688c4",
"timestamp": "",
"source": "github",
"line_count": 362,
"max_line_length": 78,
"avg_line_length": 30.433701657458563,
"alnum_prop": 0.5962603249523464,
"repo_name": "daviddoria/PointGraphsPhase1",
"id": "0dca9a7e3578037e750f5fd5fae084ed3b86c94a",
... |
import rdflib
import unittest
import threading
def makeNode():
i = 0
while i < 9999:
i += 1
rdflib.term.BNode()
class TestRandomSeedInThread(unittest.TestCase):
def test_bnode_id_gen_in_thread(self):
"""
"""
th = threading.Thread(target=makeNode)
th.daemo... | {
"content_hash": "e249849c639fd329e70bdbafa54b703d",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 48,
"avg_line_length": 16.64,
"alnum_prop": 0.5600961538461539,
"repo_name": "armandobs14/rdflib",
"id": "1feb0615b360e05dfb7d51504922cca04ea7a73e",
"size": "416",
"binar... |
from . import chime as app
from flask import current_app, render_template, session, request
from urlparse import urlparse
from functools import wraps
from .error_functions import common_error_template_args, make_email_params, summarize_conflict_details, extract_branch_name_from_path
from .view_functions import common_t... | {
"content_hash": "269e735cf21700ddee0cf9a58d4dff37",
"timestamp": "",
"source": "github",
"line_count": 104,
"max_line_length": 133,
"avg_line_length": 41.26923076923077,
"alnum_prop": 0.6966449207828518,
"repo_name": "chimecms/chime",
"id": "d4f1e3d9235ab6e8178e50adec0f866e867acb40",
"size": "4292... |
"""Classes representing statistical distributions and ops for working with them.
See the @{$python/contrib.distributions} guide.
## Distribution Object
@@ReparameterizationType
@@Distribution
## Individual Distributions
@@Binomial
@@Bernoulli
@@BernoulliWithSigmoidProbs
@@Beta
@@BetaWithSoftplusConcentration
@@Categ... | {
"content_hash": "1230513af53c4687aad2bdc9bb69f80c",
"timestamp": "",
"source": "github",
"line_count": 131,
"max_line_length": 95,
"avg_line_length": 36.25954198473283,
"alnum_prop": 0.8347368421052631,
"repo_name": "whn09/tensorflow",
"id": "257aefa8572351f00ddcb77d2a49c4d79d660826",
"size": "543... |
import atexit
import sys
def all_done():
print('all_done()')
print('Registering')
atexit.register(all_done)
print('Registered')
print('Exiting...')
sys.exit()
| {
"content_hash": "decb0cecd692d2c93f9fe581501206cc",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 25,
"avg_line_length": 10.625,
"alnum_prop": 0.6705882352941176,
"repo_name": "jasonwee/asus-rt-n14uhp-mrtg",
"id": "ccf8d406a19e9d737827d3cd4cf0de4bd966a7f7",
"size": "172... |
stringVar = S('"a String"', "application/json")
booleanVar = S(False, "application/json")
integerVar = S(42, "application/json")
listVar = S(["Waldo", "Hugo", "Kermit"], "application/json")
| {
"content_hash": "5622df16b08b57db7b0ae31d33f1ae35",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 60,
"avg_line_length": 27.571428571428573,
"alnum_prop": 0.6683937823834197,
"repo_name": "camunda/camunda-spin",
"id": "ba873f16e602782522fe5f2a908e65483c6fb0ff",
"size": "... |
"""
Django settings for gomera_app project.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.6/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)... | {
"content_hash": "324292cb150cbfd3c395417561c7f82e",
"timestamp": "",
"source": "github",
"line_count": 84,
"max_line_length": 71,
"avg_line_length": 24.785714285714285,
"alnum_prop": 0.7219020172910663,
"repo_name": "amartinez1/geo-clinic",
"id": "c55b2649f6726a4023a29840b04261489bbff6fd",
"size":... |
from __future__ import absolute_import
from django.dispatch import Signal
# signal used when an Event has been created or updated
event_updated = Signal(providing_args=['instance'])
# signal used when an EventGroup has been created or updated
eventgroup_updated = Signal(providing_args=['instance'])
| {
"content_hash": "233a0a37c82005d045f1d2ce087e1736",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 60,
"avg_line_length": 37.75,
"alnum_prop": 0.7814569536423841,
"repo_name": "ox-it/talks.ox",
"id": "26535ff3b22d6d7319fb339f6e8ed963f92be375",
"size": "302",
"binary": f... |
__all__ = [
"timeseries",
"exponential_distributions",
"harmonic_oscillators",
"gaussian_work",
"HarmonicOscillatorsTestCase",
"ExponentialTestCase",
]
from pymbar.testsystems.harmonic_oscillators import HarmonicOscillatorsTestCase
from pymbar.testsystems.exponential_distributions import Expone... | {
"content_hash": "c04c23f9d46f4b2f08ad99c2b8ad443e",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 79,
"avg_line_length": 36.38461538461539,
"alnum_prop": 0.8012684989429175,
"repo_name": "Lnaden/pymbar",
"id": "8fcf1aba775de491fd963f5769fe7a84b0947dcb",
"size": "473",
... |
"""GPU implementation of //testing/skia_gold_common/skia_gold_properties.py."""
import subprocess
import sys
from typing import Optional
import gpu_path_util
from skia_gold_common import skia_gold_properties
class GpuSkiaGoldProperties(skia_gold_properties.SkiaGoldProperties):
@staticmethod
def _GetGitOriginMa... | {
"content_hash": "57a238488693aabf9bdfeca56cb9b37b",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 79,
"avg_line_length": 26.32,
"alnum_prop": 0.7021276595744681,
"repo_name": "chromium/chromium",
"id": "2947eabf3ea462cfec04eeddc161a3dedf7732ad",
"size": "798",
"binary... |
from distutils.core import setup
version = "0.15"
"""Setup script for pexif"""
setup (
name = "pexif",
version = version,
description = "A module for editing JPEG EXIF data",
long_description = "This module allows you to parse and edit the EXIF data tags in a JPEG image.",
author = "Ben Leslie",
... | {
"content_hash": "73d8de866a20fe9780068ebc4b83ed34",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 102,
"avg_line_length": 39.84615384615385,
"alnum_prop": 0.5907335907335908,
"repo_name": "bennoleslie/pexif",
"id": "be98223a2a4c47e456790439ed1ad4ea84f648e5",
"size": "10... |
import logging
import fmcapi
import time
def test__protocol_port(fmc):
logging.info("Test ProtocolPort. Post, get, put, delete Port Objects.")
starttime = str(int(time.time()))
namer = f"_fmcapi_test_{starttime}"
obj1 = fmcapi.ProtocolPortObjects(fmc=fmc)
obj1.name = namer
obj1.port = "1234... | {
"content_hash": "dcd3972354b7694acebba2a4a12b98fe",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 76,
"avg_line_length": 23.56,
"alnum_prop": 0.6468590831918506,
"repo_name": "daxm/fmcapi",
"id": "13c34311cda0a338835373cf83a0bd2e4d0ee2aa",
"size": "589",
"binary": fal... |
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import division
from __future__ import absolute_import
from builtins import range
from future import standard_library
standard_library.install_aliases()
import sys
PYTHON_VERSION = sys.version_info[:3]
PY2 = (PYTHON_VERSION[0... | {
"content_hash": "aa410d4d6b9e9d612d38ec70bf58785c",
"timestamp": "",
"source": "github",
"line_count": 419,
"max_line_length": 105,
"avg_line_length": 43.298329355608594,
"alnum_prop": 0.5887443501267776,
"repo_name": "andreadean5/python-hpOneView",
"id": "a2cf6b2fea11c5a27b7d43f24c0f23bdc2bcbfef",
... |
import mock
import pytest
import sqlalchemy as sa
import sqlalchemy.dialects.mysql
import sqlalchemy.dialects.oracle
import sqlalchemy.dialects.postgresql
import sqlalchemy.dialects.sqlite
from sqlalchemy import inspect
from sqlalchemy_utils import Password, PasswordType, types # noqa
@pytest.fixture
def extra_kwar... | {
"content_hash": "46988d0fe7531ac534fdab68839b72e4",
"timestamp": "",
"source": "github",
"line_count": 257,
"max_line_length": 78,
"avg_line_length": 27.6147859922179,
"alnum_prop": 0.5879949274341271,
"repo_name": "konstantinoskostis/sqlalchemy-utils",
"id": "eea3b32450f74e5621a514f27e64a4417710adc... |
from __future__ import absolute_import
from urllib import *
from ..version_info import PY2
if PY2:
from . import error, parse, request, robotparser
| {
"content_hash": "a7e45188f0a3af720b14eea76fa7c7ec",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 52,
"avg_line_length": 19.375,
"alnum_prop": 0.7290322580645161,
"repo_name": "AbsoluteMSTR/pies",
"id": "d6a12ffb761600b53331d397f4f7e9fefab507dd",
"size": "155",
"binary... |
import os
from cmt.components import ChannelsDynamWave as Component
from . import example_dir
cfg_file = os.path.join(example_dir, 'June_20_67_channels_dynamic_wave.cfg')
def test_irf():
component = Component()
component.initialize(cfg_file)
component.update(1.0)
component.finalize()
| {
"content_hash": "51b874a06fd5c5bada6aa4120108c09f",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 76,
"avg_line_length": 23.46153846153846,
"alnum_prop": 0.7344262295081967,
"repo_name": "Elchin/topoflow-cmi-testing",
"id": "b5d9a6aad5b97099fc82cf283beaf7c1f04af04d",
"s... |
from paddle.trainer_config_helpers import *
settings(
batch_size=1000,
learning_rate=1e-5
)
din = data_layer(name='data', size=30)
seq_op = [
first_seq,
last_seq
]
agg_level = [
AggregateLevel.EACH_SEQUENCE,
AggregateLevel.EACH_TIMESTEP
]
opts = []
for op in seq_op:
for al in agg_level... | {
"content_hash": "48b779eb4ed196d81586d3f1235bc0cd",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 48,
"avg_line_length": 14.807692307692308,
"alnum_prop": 0.6493506493506493,
"repo_name": "zuowang/Paddle",
"id": "d54a1c49fd3fdf9eb8a675dd94561e6da5b310bc",
"size": "385",... |
import logging
import pprint
import shlex
import sys
from telemetry.core import exceptions
from telemetry.core import util
from telemetry import decorators
from telemetry.internal.backends import browser_backend
from telemetry.internal.backends.chrome import extension_backend
from telemetry.internal.backends.chrome im... | {
"content_hash": "b59e8577bcb707c32203509912c76c91",
"timestamp": "",
"source": "github",
"line_count": 309,
"max_line_length": 80,
"avg_line_length": 37.420711974110034,
"alnum_prop": 0.6982616967914901,
"repo_name": "catapult-project/catapult-csm",
"id": "2133ca53af3a7e4c13c08e1e0477c0b3e4285132",
... |
from .server import WechatConfig, WechatServer
from .models.common import TestStorage
from .config import VERSION
from .controllers.envtest import env_test
from .log import set_logging
__version__ = VERSION
instanceList = []
def new_instance():
newInstance = WechatServer(None, None, None)
insta... | {
"content_hash": "8ac1aad8df1c3795813004d2e8264157",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 71,
"avg_line_length": 30.74418604651163,
"alnum_prop": 0.7586989409984871,
"repo_name": "littlecodersh/itchatmp",
"id": "00042bb6c3a9cfcbbbd649bb59a35bf15b3859c7",
"size":... |
def extractFullybookedtranslationsWordpressCom(item):
'''
Parser for 'fullybookedtranslations.wordpress.com'
'''
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or "preview" in item['title'].lower():
return None
tagmap = [
('PRC', 'PRC', ... | {
"content_hash": "4025d92e94923151b22a731fa22aba2e",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 104,
"avg_line_length": 27.857142857142858,
"alnum_prop": 0.6512820512820513,
"repo_name": "fake-name/ReadableWebProxy",
"id": "e799eab720a0b7a09805d6faf6bdc3c139bb556d",
"... |
from .codec_service import CodecService
from .crud_service import CRUDService
from .netconf_service import NetconfService
from .executor_service import ExecutorService
from ydk.ext.services import Datastore
__all__ = [ "CodecService", "CRUDService",
"ExecutorService", "NetconfService", "Datastore" ]
| {
"content_hash": "8306cbe32b93453480f96f57086b90c2",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 62,
"avg_line_length": 35,
"alnum_prop": 0.765079365079365,
"repo_name": "psykokwak4/ydk-gen",
"id": "e34750907c7315755cf350c49cc781d776854c23",
"size": "1029",
"binary": ... |
import re
import os
def parse(document_name):
with open(document_name, 'r') as html_file:
pattern = re.compile('https://exhentai.org/g/[0-9]+/[0-9a-z]{10}/')
file_text = html_file.read()
matches = re.findall(pattern, file_text)
return matches
if __name__ == "__main__":
with op... | {
"content_hash": "ad0439fb48dd085296fbf42202ad4669",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 138,
"avg_line_length": 43.32258064516129,
"alnum_prop": 0.5822784810126582,
"repo_name": "ChristophorusX/ehentai-downloader",
"id": "31daedbbab1e6db2d1c249580809e0b41ec23e7a... |
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('employees', '0002_schedule'),
]
operations = [
migrations.RenameField(
model_name='schedule',
... | {
"content_hash": "040021dd296e8f473e17374787120614",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 162,
"avg_line_length": 27.916666666666668,
"alnum_prop": 0.6119402985074627,
"repo_name": "lmann4/cis526-final-project",
"id": "8c3a2e3664d2a475d2e9314097a99742e03ae55f",
... |
import re
from ansible.errors import AnsibleError
from ansible.plugins.lookup import LookupBase
class LookupModule(LookupBase):
# pylint: disable=too-many-branches,too-many-statements,too-many-arguments
def run(self, terms, variables=None, zones_enabled=True, short_version=None,
deployment_type=N... | {
"content_hash": "222db506bc1b0c1673904546ac2ebf13",
"timestamp": "",
"source": "github",
"line_count": 115,
"max_line_length": 119,
"avg_line_length": 44.18260869565217,
"alnum_prop": 0.5308010234205865,
"repo_name": "ivanhorvath/openshift-tools",
"id": "fe488f49c73921649d56d5c9125699302fdf3cfd",
... |
'''
A Multilayer Perceptron implementation example using TensorFlow library.
This example is using the MNIST database of handwritten digits
(http://yann.lecun.com/exdb/mnist/)
Author: Aymeric Damien
Project: https://github.com/aymericdamien/TensorFlow-Examples/
'''
from __future__ import print_function
import tensorf... | {
"content_hash": "1de35b1cad578d01d20913172b682dba",
"timestamp": "",
"source": "github",
"line_count": 138,
"max_line_length": 89,
"avg_line_length": 28.492753623188406,
"alnum_prop": 0.6169888097660223,
"repo_name": "trhongbinwang/data_science_journey",
"id": "ce6c8198785c9e1005e16ea8fd6a8fa4823518... |
from base64 import b64encode
from itertools import count
import logging
from elftools.dwarf import constants
from .datatype import TypeReference
from .dwarftools import get_attr_val, iter_ranges, iter_expressions
class Variable(object):
vid_gen = count()
def __init__(self, debug_info, die):
assert d... | {
"content_hash": "55f943ed1333576a9dc8cac76287daef",
"timestamp": "",
"source": "github",
"line_count": 164,
"max_line_length": 147,
"avg_line_length": 41.920731707317074,
"alnum_prop": 0.5403636363636364,
"repo_name": "Samsung/ADBI",
"id": "14aeaff5fc9f27daa80dc7c4cef8b1c8d7110b0a",
"size": "6875"... |
import os
import subprocess
from typing import Iterable
import pytest
from dev_tools import shell_tools
from dev_tools.test_utils import only_on_posix
def run(
*,
script_file: str,
tmpdir_factory: pytest.TempdirFactory,
arg: str = '',
setup: str = '',
additional_intercepts: Iterable[str] = (... | {
"content_hash": "0fbd41ed85c85364e75bfbef2e8610a2",
"timestamp": "",
"source": "github",
"line_count": 698,
"max_line_length": 99,
"avg_line_length": 33.401146131805156,
"alnum_prop": 0.6107060135540877,
"repo_name": "quantumlib/Cirq",
"id": "792bd5829072c784ea66c89823509ee644e923a8",
"size": "238... |
import logging
import couchdb
import urlparse
import json
import urllib2
import threading
import re
from pylons import request, response, session, tmpl_context as c, url
from pylons.controllers.util import abort, redirect
from lr.model import LRNode as sourceLRNode, \
NodeServiceModel, ResourceDataModel, L... | {
"content_hash": "62fd0fe3bbb90a87cd880d88da6bb9d3",
"timestamp": "",
"source": "github",
"line_count": 232,
"max_line_length": 128,
"avg_line_length": 51.952586206896555,
"alnum_prop": 0.6162781050360906,
"repo_name": "LearningRegistry/LearningRegistry",
"id": "ecc14cb4c92a1e51e6ce3d21273899de544ee8... |
from omics_pipe.parameters.default_parameters import default_parameters
from omics_pipe.utils import *
p = Bunch(default_parameters)
def fastqc(sample, extension, fastqc_flag):
'''QC check of raw .fastq files using FASTQC.
input:
.fastq file
output:
folder and zipped ... | {
"content_hash": "e0a33ad5c29755918fafdedf2e632584",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 439,
"avg_line_length": 44.205882352941174,
"alnum_prop": 0.6067864271457086,
"repo_name": "adammaikai/OmicsPipe2.0",
"id": "bf7dd2a9ac2907bb0c80ced124df5113089abede",
"siz... |
import os
import sys
import re
import logging
from optparse import OptionParser
from ksscommand import KssCommand, KssCommandException, KssCommandOptException
import __cmd__
try:
import karesansui
from karesansui import __version__
from karesansui.lib.utils import load_locale, execute_command
from kar... | {
"content_hash": "6a5d3d72032675442e18b3b4e495ac2d",
"timestamp": "",
"source": "github",
"line_count": 78,
"max_line_length": 128,
"avg_line_length": 33.5,
"alnum_prop": 0.6261002678913127,
"repo_name": "karesansui/karesansui",
"id": "52cfca89f4f19787eeb420997f350838da0a34a9",
"size": "3789",
"b... |
''' Provide the ``Application`` class.
Application instances are factories for creating new Bokeh Documents.
When a Bokeh server session is initiated, the Bokeh server asks the Application
for a new Document to service the session. To do this, the Application first
creates a new empty Document, then it passes this ne... | {
"content_hash": "320880fe1d4fad1b5e8964d1bab4aba6",
"timestamp": "",
"source": "github",
"line_count": 423,
"max_line_length": 102,
"avg_line_length": 31.319148936170212,
"alnum_prop": 0.5375905797101449,
"repo_name": "stonebig/bokeh",
"id": "02fabd4acb0ec710d1b919479390bad212ea25f1",
"size": "135... |
from operator import attrgetter
from pyangbind.lib.yangtypes import RestrictedPrecisionDecimalType
from pyangbind.lib.yangtypes import RestrictedClassType
from pyangbind.lib.yangtypes import TypedListType
from pyangbind.lib.yangtypes import YANGBool
from pyangbind.lib.yangtypes import YANGListType
from pyangbind.lib.ya... | {
"content_hash": "13cb6445f0324826085d7d87d26e02b5",
"timestamp": "",
"source": "github",
"line_count": 332,
"max_line_length": 375,
"avg_line_length": 37.825301204819276,
"alnum_prop": 0.5746137920050963,
"repo_name": "napalm-automation/napalm-yang",
"id": "ad139a7fbde7e11180961b2511106855b94c5d3b",... |
"""Keras metrics in TF-Ranking.
NOTE: For metrics that compute a ranking, ties are broken randomly. This means
that metrics may be stochastic if items with equal scores are provided.
WARNING: Some metrics (e.g. Recall or MRR) are not well-defined when there are
no relevant items (e.g. if `y_true` has a row of only ze... | {
"content_hash": "fd54574eb91e21a9db7a84823b7e6e75",
"timestamp": "",
"source": "github",
"line_count": 1051,
"max_line_length": 83,
"avg_line_length": 30.174119885823025,
"alnum_prop": 0.6039163749881752,
"repo_name": "tensorflow/ranking",
"id": "6dfb31f64f92c13eef08e5dd75528c4dd2cb2662",
"size": ... |
"""A simple number and datetime addition JSON API.
Run the app:
$ python examples/flaskrestful_example.py
Try the following with httpie (a cURL-like utility, http://httpie.org):
$ pip install httpie
$ http GET :5001/
$ http GET :5001/ name==Ada
$ http POST :5001/add x=40 y=2
$ http POST :5001... | {
"content_hash": "4a0abf25133c9708e3f71d7accc78327",
"timestamp": "",
"source": "github",
"line_count": 87,
"max_line_length": 79,
"avg_line_length": 28.413793103448278,
"alnum_prop": 0.642799352750809,
"repo_name": "hyunchel/webargs",
"id": "fde08fd6d26efb0220f911371e05dc7061b439da",
"size": "2496... |
from __future__ import with_statement
import os
import sys
import re
import string
import inspect, traceback
# get type names
from types import *
from m5.util.grammar import Grammar
debug=False
###################
# Utility functions
#
# Indent every line in string 's' by two spaces
# (except preprocessor directive... | {
"content_hash": "9fa1ab2d2c42d8016b9c7d8749f077a7",
"timestamp": "",
"source": "github",
"line_count": 2403,
"max_line_length": 89,
"avg_line_length": 36.71993341656263,
"alnum_prop": 0.562070763163263,
"repo_name": "SanchayanMaity/gem5",
"id": "8d609ae5ff870b3ebb49db25a9c9bd29ca3387b0",
"size": "... |
def includeme(config):
config.add_static_view('static', 'static', cache_max_age=3600)
# default.py
config.add_route('home', '/')
# docs.py
config.add_route('list', 'docs/list')
config.add_route('get', 'docs/get/{docid}')
| {
"content_hash": "24039ec37e1daeead332a85edee13051",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 66,
"avg_line_length": 28.444444444444443,
"alnum_prop": 0.59375,
"repo_name": "sitn/sitn_portal",
"id": "07077a930a824728f2ffed63cfc81b5da9626fae",
"size": "256",
"binary... |
from six.moves import urllib
from cinder import context
from cinder import exception
from cinder.tests.unit import fake_constants as fake
from cinder.tests.unit.fake_volume import fake_volume_obj
from cinder.tests.unit.volume.drivers.dell_emc import scaleio
from cinder.tests.unit.volume.drivers.dell_emc.scaleio import... | {
"content_hash": "5b452f30fe00457c585a0df04bf176fa",
"timestamp": "",
"source": "github",
"line_count": 93,
"max_line_length": 79,
"avg_line_length": 42.354838709677416,
"alnum_prop": 0.592028433612592,
"repo_name": "eharney/cinder",
"id": "90e1adcc50394cb872047be85de5d44db55ccc96",
"size": "4581",... |
outputs = [ "out.exr" ]
command = testrender("-r 256 256 -aa 4 --llvm_opt 13 bumptest.xml out.exr")
# Note: we pick this test arbitrarily as the one to verify llvm_opt=13 works
| {
"content_hash": "9dd5e6658a7cdeda92071878f3570e66",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 76,
"avg_line_length": 44.5,
"alnum_prop": 0.702247191011236,
"repo_name": "lgritz/OpenShadingLanguage",
"id": "dd3646c70451a93f50dbbfcbf0a915fa014eaef0",
"size": "372",
"... |
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "aspc.settings")
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()
| {
"content_hash": "e87787aa14003b15e37548a489435c1a",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 64,
"avg_line_length": 32.6,
"alnum_prop": 0.7975460122699386,
"repo_name": "aspc/mainsite",
"id": "f70128eaa726355d32230de7fc3c58190f5ad3f0",
"size": "163",
"binary": fal... |
from pygame.locals import *
from zort.hex_model import *
class LevelSceneMode(object):
""" provides various handlers to abstract gameplay into modes
"""
def __init__(self, scene):
self.scene = scene
def handle_click(self, button, cell):
pass
def draw(self, surface):
pass... | {
"content_hash": "02ac7dc74bb45e178f9b489200f6bf58",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 65,
"avg_line_length": 27.86111111111111,
"alnum_prop": 0.5712861415752741,
"repo_name": "bitcraft/pyweek19",
"id": "2f50d8de9abe5f35e0f2c32cbf0d79deefc1cac5",
"size": "100... |
from django import template
register = template.Library()
@register.filter
def col_input_class(taxcalc_param):
cols = len(taxcalc_param.col_fields)
display_cols = 12
display_size = min([int(display_cols / cols), 6])
return "col-xs-{0}".format(display_size)
| {
"content_hash": "3491986572aff2648d8f1e0851f1182c",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 53,
"avg_line_length": 25.09090909090909,
"alnum_prop": 0.6956521739130435,
"repo_name": "PeterDSteinberg/webapp-public",
"id": "b8b52e2cb93816af4a9722613d0de6f55c2855d3",
... |
import os
import re
from smtplib import SMTPException
from django import forms
from django.conf import settings
from django.core.files.storage import default_storage as storage
from django.contrib.auth import forms as auth_forms
from django.forms.util import ErrorList
import captcha.fields
import commonware.log
impor... | {
"content_hash": "1eac07f0902b79a62fa3493e00668fe2",
"timestamp": "",
"source": "github",
"line_count": 466,
"max_line_length": 79,
"avg_line_length": 40.122317596566525,
"alnum_prop": 0.5792373107985238,
"repo_name": "spasovski/zamboni",
"id": "6a643d0f0d6978e48b5daf0b48476bf7684a6f04",
"size": "1... |
"""
.. _tut-report:
===============================
Getting started with mne.Report
===============================
:class:`mne.Report` is a way to create interactive HTML summaries of your data.
These reports can show many different visualizations for one or multiple
participants. A common use case is creating diagn... | {
"content_hash": "f8382e25719c2e46e1481179454e4835",
"timestamp": "",
"source": "github",
"line_count": 713,
"max_line_length": 79,
"avg_line_length": 38.85694249649369,
"alnum_prop": 0.6921133369427901,
"repo_name": "kingjr/mne-python",
"id": "fe373e535bb53d8cfd55e22a0aad5ae954219e2a",
"size": "27... |
"""Creates windows and posix stub files for a given set of signatures.
For libraries that need to be loaded outside of the standard executable startup
path mechanism, stub files need to be generated for the wanted functions. In
windows, this is done via "def" files and the delay load mechanism. On a posix
system, a ... | {
"content_hash": "cc1bcbd30cfaa38c25f7b362000aef8b",
"timestamp": "",
"source": "github",
"line_count": 1153,
"max_line_length": 80,
"avg_line_length": 36.78577623590633,
"alnum_prop": 0.6631772527938888,
"repo_name": "vadimtk/chrome4sdp",
"id": "7d2f91b8b67879dcd542a0e7d94e71db6e3f19d2",
"size": "... |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('domain_api', '0010_topleveldomain_slug'),
]
operations = [
migrations.AlterField(
model_name='topleveldomain',
name='slug',
... | {
"content_hash": "f7032386062686f06f0493ee294a02a6",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 76,
"avg_line_length": 23.68421052631579,
"alnum_prop": 0.6022222222222222,
"repo_name": "heytrav/drs-project",
"id": "3516279cf0c214d2c767accae1fc20f833c10688",
"size": "5... |
import refcycle
import gc
gc.disable()
gc.collect()
class A(object):
pass
a = A()
b = A()
a.foo = b
b.foo = a
del a, b, A
graph = refcycle.garbage()
graph.export_image('garbage.svg')
graph.export_image('garbage.pdf')
sccs = graph.strongly_connected_components()
sccs
sccs.sort(key=len)
sccs[-1].export_image('s... | {
"content_hash": "7bcb02e7a8ada2a94a82153117d9e943",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 44,
"avg_line_length": 16.06896551724138,
"alnum_prop": 0.6866952789699571,
"repo_name": "mdickinson/refcycle",
"id": "6d8e7e53e4e05a486c716371662a798fb7cfab90",
"size": "4... |
import argparse
import base64
import hashlib
import re
import os
import sys
def ComputeIntegrity(input_path):
hasher = hashlib.sha256()
with open(input_path, 'rb') as f:
hasher.update(f.read())
return base64.b64encode(hasher.digest())
def WriteHeader(input_paths_and_integrity, output_path):
with open(ou... | {
"content_hash": "baa6d1a9203abce81f6de1d3ab1610cd",
"timestamp": "",
"source": "github",
"line_count": 54,
"max_line_length": 79,
"avg_line_length": 28.51851851851852,
"alnum_prop": 0.6441558441558441,
"repo_name": "endlessm/chromium-browser",
"id": "228aa139c6046a7d1c4a55e1507b257cf8dc3075",
"siz... |
import http.client
from lxml import html
from datetime import datetime
import csv
import os
import time
conn = http.client.HTTPSConnection("www.hockey-reference.com")
def writeCsv(coach, years):
if len(years) == 0:
print("No years")
return
directory = "./stats/coach"
filename = "%s/%s.cs... | {
"content_hash": "6220976bacfb56892a1969f61020578d",
"timestamp": "",
"source": "github",
"line_count": 124,
"max_line_length": 78,
"avg_line_length": 34.774193548387096,
"alnum_prop": 0.6076066790352505,
"repo_name": "icambridge/hockeystats",
"id": "2b3ab8c0a401e787f4b62943203f36e37c14de03",
"size... |
"""
Currency exchange rate support that comes from Yahoo Finance.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/sensor.yahoo_finance/
"""
import logging
from datetime import timedelta
import voluptuous as vol
from homeassistant.components.sensor impor... | {
"content_hash": "9fcd6c2468cbd5d22b1919dec223ab3c",
"timestamp": "",
"source": "github",
"line_count": 125,
"max_line_length": 74,
"avg_line_length": 29.792,
"alnum_prop": 0.6345327604726101,
"repo_name": "leoc/home-assistant",
"id": "822c50823fc1d472074faad6b96cd99320588ea4",
"size": "3724",
"b... |
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('contriblog', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='Tag',
fields=[
('id', models.Au... | {
"content_hash": "f29a7a5fc8d756ad2f3d8788a0b8a254",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 114,
"avg_line_length": 26.68,
"alnum_prop": 0.553223388305847,
"repo_name": "Heasummn/contributr",
"id": "19ae07d7657047f68843fb8de243bab076099281",
"size": "691",
"bina... |
import re
import threading
import pyfirmata
from util import EventEmitter, setInterval, debounce
class ArduinoNotSuppliedException(Exception):
pass
class ServoOutOfRangeException(Exception):
pass
class InvalidPercentageException(Exception):
pass
class Component(EventEmitter):
def __init__(self,... | {
"content_hash": "3cf991abf7659ae09f3fc0fa445ab27c",
"timestamp": "",
"source": "github",
"line_count": 328,
"max_line_length": 103,
"avg_line_length": 23.03048780487805,
"alnum_prop": 0.5536139793486894,
"repo_name": "andyclymer/ControlBoard",
"id": "8a2fafd616e336bbc03d423f6c4105d083283e29",
"siz... |
from pathlib import Path
from synthtool.gcp import samples
from . import util
FIXTURES = Path(__file__).parent / "fixtures"
def test_load_node_samples():
with util.chdir(FIXTURES / "node_templates" / "standard"):
all_samples = samples.all_samples(["samples/*.js"])
# should have loaded samples.
... | {
"content_hash": "d78f804bad2ecad7d04f60d830fdec0b",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 68,
"avg_line_length": 39.5,
"alnum_prop": 0.6392405063291139,
"repo_name": "googleapis/synthtool",
"id": "090b376873ce207ec772a4f25363e8c54b3a6faa",
"size": "1840",
"bin... |
from nipype.testing import assert_equal
from nipype.interfaces.freesurfer.utils import ApplyMask
def test_ApplyMask_inputs():
input_map = dict(args=dict(argstr='%s',
),
environ=dict(nohash=True,
usedefault=True,
),
ignore_exception=dict(nohash=True,
usedefault=True,
),
in_file=dict(... | {
"content_hash": "572e8d1ddc7629469d30a6fe06c35ba9",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 78,
"avg_line_length": 24.821428571428573,
"alnum_prop": 0.6071942446043166,
"repo_name": "carlohamalainen/nipype",
"id": "a2a1c4fa49533868a6e8b566d92b968af32625f7",
"size"... |
from yowsup.layers import YowLayer
from yowsup import ProtocolTreeNode
from .mediadownloader import MediaDownloader
import shutil, os, logging
logger = logging.getLogger(__name__)
class YowMediaPictureLayer(YowLayer):
def send(self, data):
self.toLower(data)
def receive(self, node):
if Protoco... | {
"content_hash": "4120811ea5755d5accf092345ca279b5",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 101,
"avg_line_length": 34.935483870967744,
"alnum_prop": 0.6768236380424746,
"repo_name": "ongair/yowsup",
"id": "36fec459d0b5a038d7e4dca42e58aabc992fd398",
"size": "1083"... |
from elasticsearch_raven.udp_server import run_server
if __name__ == '__main__':
run_server()
| {
"content_hash": "19f20f32b686fdc896db38a1b4cb8e60",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 53,
"avg_line_length": 20,
"alnum_prop": 0.65,
"repo_name": "pozytywnie/elasticsearch-raven",
"id": "a500a5917c51ced8ecf669df1a34416e2c1bc431",
"size": "122",
"binary": fa... |
from django.db import migrations
from django.db import models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
("lizard_auth_server", "0008_auto_20160824_1640"),
]
operations = [
migrations.AlterField(
model_name="profile",
... | {
"content_hash": "499c9008b51fc7b76979ba7495029414",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 60,
"avg_line_length": 25.03846153846154,
"alnum_prop": 0.543778801843318,
"repo_name": "lizardsystem/lizard-auth-server",
"id": "8f24adc4086b038d0f7593b12a865e3b1be55d50",
... |
from msrest.serialization import Model
class JobScheduleDisableOptions(Model):
"""Additional parameters for the JobSchedule_disable operation.
:param timeout: The maximum time that the server can spend processing the
request, in seconds. The default is 30 seconds. Default value: 30 .
:type timeout: ... | {
"content_hash": "b3b03873f12e1a0b7548e9f8febd7b2d",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 191,
"avg_line_length": 52.4,
"alnum_prop": 0.7251908396946565,
"repo_name": "SUSE/azure-sdk-for-python",
"id": "cf6d2b7b81736e10ed490a8ceb99acea6685dd84",
"size": "3094",
... |
from __future__ import unicode_literals, division, absolute_import
from builtins import * # pylint: disable=unused-import, redefined-builtin
from flexget.plugin import get_plugin_by_name
class TestURLRewriters(object):
"""
Bad example, does things manually, you should use task.find_entry to check exista... | {
"content_hash": "ee8630d2971437c90f6206f4c98ee483",
"timestamp": "",
"source": "github",
"line_count": 88,
"max_line_length": 114,
"avg_line_length": 43.06818181818182,
"alnum_prop": 0.6213720316622692,
"repo_name": "oxc/Flexget",
"id": "df6a70c4b90edda9fdd12189a88b7a242073f30c",
"size": "3790",
... |
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
def _fromUtf8(s):
return s
try:
_encoding = QtGui.QApplication.UnicodeUTF8
def _translate(context, text, disambig):
return QtGui.QApplication.translate(context, text, disambig, _encoding)
ex... | {
"content_hash": "df5971a3729269768d1f3dd39c066041",
"timestamp": "",
"source": "github",
"line_count": 456,
"max_line_length": 144,
"avg_line_length": 60.29824561403509,
"alnum_prop": 0.6848268839103869,
"repo_name": "lamotriz/sistemas-de-aterramento",
"id": "d46baf612e156916c4377b2c6adba876ada22266... |
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('contacts', '0004_person_yatra'),
]
operations = [
migrations.AlterField(
model_name='person',
name='first_name',
... | {
"content_hash": "b34aaf0f219b22a0edbd17acaf2a4b1f",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 99,
"avg_line_length": 27.92,
"alnum_prop": 0.5845272206303725,
"repo_name": "mayapurmedia/tovp",
"id": "651563ba8ae6c288f94c34d82c8aa467f1000305",
"size": "722",
"binary... |
from djangoappengine.settings_base import *
import os
import sys
PROJECT_ROOT = os.path.dirname(os.path.abspath(__file__))
PROJECT_NAME = os.path.split(PROJECT_ROOT)[-1]
MEDIA_ROOT = os.path.join(PROJECT_ROOT, 'static/')
#applications
#sys.path.insert(0, os.path.join(PROJECT_ROOT, 'src'))
sys.path.insert(0, os.path.... | {
"content_hash": "202311ac2f8aa3ea3827c70aca885bb6",
"timestamp": "",
"source": "github",
"line_count": 105,
"max_line_length": 100,
"avg_line_length": 30.885714285714286,
"alnum_prop": 0.7190872648781992,
"repo_name": "MediaSapiens/wavesf",
"id": "f4fdde3b9b31910770b495bcd17f378824d620a7",
"size":... |
from django import forms
from satchmo.contact import signals
import logging
log = logging.getLogger('contact.listeners')
def au_postcode_validator(sender, postcode=None, country=None, **kwargs):
if country.iso2_code == 'AU':
from satchmo.l10n.validators import aupostcode
try:
pc = aupo... | {
"content_hash": "a42a3137df354a24922c3e1b18bf8642",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 87,
"avg_line_length": 38.857142857142854,
"alnum_prop": 0.6769957983193278,
"repo_name": "roadhead/satchmo",
"id": "4518f63840356630268d46d778cae18d22b68598",
"size": "190... |
"""
Examples to show how to create async EventHubProducerClient and EventHubConsumerClient that connect to custom endpoint.
"""
import os
from azure.servicebus import ServiceBusClient, ServiceBusMessage
CONNECTION_STR = os.environ['SERVICEBUS_CONNECTION_STR']
QUEUE_NAME = os.environ["SERVICEBUS_QUEUE_NAME"]
# The cu... | {
"content_hash": "67d92580954e9a14e8a124e4bb4f8efd",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 119,
"avg_line_length": 42.81818181818182,
"alnum_prop": 0.7763623496107572,
"repo_name": "Azure/azure-sdk-for-python",
"id": "78af7e885659482352d93dafa5897cfbb5129f65",
"s... |
"""--- Day 2: I Was Told There Would Be No Math ---
The elves are running low on wrapping paper, and so they need to submit an
order for more. They have a list of the dimensions (length l, width w, and
height h) of each present, and only want to order exactly as much as they need.
Fortunately, every present is a box ... | {
"content_hash": "ed0930da5605d2bd780541691aaf7640",
"timestamp": "",
"source": "github",
"line_count": 98,
"max_line_length": 84,
"avg_line_length": 35.755102040816325,
"alnum_prop": 0.708904109589041,
"repo_name": "MattJDavidson/python-adventofcode",
"id": "45896c85a489a7eb2718ac18217e71b65ac35bff"... |
from aquilon.aqdb.model import ResourceGroup
from aquilon.worker.broker import BrokerCommand # pylint: disable=W0611
from aquilon.worker.commands.show_resource import show_resource
class CommandShowResourceGroup(BrokerCommand):
required_parameters = []
def render(self, session, hostname, cluster, all, reso... | {
"content_hash": "71c52f98617cb14759667ec39d2f0158",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 72,
"avg_line_length": 34.857142857142854,
"alnum_prop": 0.7110655737704918,
"repo_name": "jrha/aquilon",
"id": "18db27061cbf3cf3ca69ee5f390021c9c96c4570",
"size": "1198",
... |
"""YAML utility functions."""
import glob
import logging
import os
import sys
from collections import OrderedDict
from typing import Union, List, Dict
import yaml
try:
import keyring
except ImportError:
keyring = None
from homeassistant.exceptions import HomeAssistantError
_LOGGER = logging.getLogger(__name_... | {
"content_hash": "5185f1642a4793c0d71e34d12163dc2b",
"timestamp": "",
"source": "github",
"line_count": 223,
"max_line_length": 79,
"avg_line_length": 36.54708520179372,
"alnum_prop": 0.6131288343558282,
"repo_name": "hexxter/home-assistant",
"id": "035a96b657e4c6e6e61608a15790bca70176f0fb",
"size"... |
"""
Collects sidekiq data from Redis
#### Dependencies
* redis
"""
from itertools import izip
try:
import redis
from redis.sentinel import Sentinel
except ImportError:
redis = None
import diamond.collector
class SidekiqCollector(diamond.collector.Collector):
def get_default_config_help(self):
... | {
"content_hash": "849601b285d17fe808a37230cd007431",
"timestamp": "",
"source": "github",
"line_count": 168,
"max_line_length": 73,
"avg_line_length": 32.75595238095238,
"alnum_prop": 0.5615119025985826,
"repo_name": "MichaelDoyle/Diamond",
"id": "dcaa1e7df740b50189a0edadcd9b5faca3e9cff5",
"size": ... |
import sys
import os
import numpy
from osgeo import gdal, gdal_array
TAIL_TRIM = 0.01
def get_band(filename, target_percent):
ds = gdal.Open(filename)
xsize = int(ds.RasterXSize * target_percent / 100.0)
ysize = int(ds.RasterYSize * target_percent / 100.0)
image = ds.GetRasterBand(1).ReadAsArray(resa... | {
"content_hash": "8b754d816d1118e7ca6d1b8212a9608f",
"timestamp": "",
"source": "github",
"line_count": 113,
"max_line_length": 79,
"avg_line_length": 30.150442477876105,
"alnum_prop": 0.5917229233930144,
"repo_name": "landsat-pds/landsat_ingestor",
"id": "61e5ee2bfbb9dc946691b3a31ce01d9f0c994a1d",
... |
from threading import Thread
from abc import ABC, abstractmethod
class AbstractWindow(ABC):
def __init__(self, config):
self.config = config
self.setup(config)
def setup(self, config):
pass
@abstractmethod
def get_outer_window_rect(self):
pass
@abstractmethod
... | {
"content_hash": "ea6aa846c08f0756b321ae686ca0f5f6",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 65,
"avg_line_length": 21.77777777777778,
"alnum_prop": 0.6224489795918368,
"repo_name": "Frizz925/gbf-autopilot",
"id": "9d9c8f7af98d705003bee70848879e58c7880ce6",
"size":... |
"""Ghost Buster. Static site generator for Ghost.
Usage:
buster.py setup [--gh-repo=<repo-url>] [--dir=<path>]
buster.py generate [--domain=<local-address>] [--dir=<path>]
buster.py preview [--dir=<path>]
buster.py deploy [--dir=<path>]
buster.py add-domain <domain-name> [--dir=<path>]
buster.py (-h | --he... | {
"content_hash": "a45e73312bd27ddcbf2b778382ec00c2",
"timestamp": "",
"source": "github",
"line_count": 228,
"max_line_length": 146,
"avg_line_length": 39.34649122807018,
"alnum_prop": 0.5137665812061085,
"repo_name": "Timebutt/timebutt.github.io",
"id": "1715c996685e9fa19e395ab75b5918c1b24678e9",
... |
"""
Target builder factories for the ``pyltc`` framework.
Target builders are objects implementing ``ITarget`` (see the ``pyltc.core.target``
package for the default implementations). The main target builder flavor is
``TcTarget`` with two subclasses, representing a ``tc``-compatible commands target.
The ``tc`` comm... | {
"content_hash": "2783f7ca5f19d1d92176d2e79d89fd27",
"timestamp": "",
"source": "github",
"line_count": 61,
"max_line_length": 103,
"avg_line_length": 43.85245901639344,
"alnum_prop": 0.7401869158878505,
"repo_name": "yassen-itlabs/py-linux-traffic-control",
"id": "48ee1c4edac70fec002dd11f7a526aa6823... |
import copy
from itertools import chain
from django import forms
from django.contrib.postgres.validators import (
ArrayMaxLengthValidator, ArrayMinLengthValidator,
)
from django.core.exceptions import ValidationError
from django.utils import six
from django.utils.translation import ugettext_lazy as _
from ..utils... | {
"content_hash": "00d8d31e9ff5d9038a34977e45ac8e82",
"timestamp": "",
"source": "github",
"line_count": 201,
"max_line_length": 102,
"avg_line_length": 35.60696517412935,
"alnum_prop": 0.5623864747799358,
"repo_name": "mbayon/TFG-MachineLearning",
"id": "4fbeca88776c36ff405203daf85d59067542f8d9",
"... |
import unittest
from telemetry import decorators
# These are not real unittests.
# They are merely to test our Enable/Disable annotations.
class DisabledCases(unittest.TestCase):
def testAllEnabled(self):
pass
@decorators.Disabled('all')
def testAllDisabled(self):
pass
@decorators.Enabled('maveric... | {
"content_hash": "c98edef4a42905e8d2dadb326abffd3e",
"timestamp": "",
"source": "github",
"line_count": 59,
"max_line_length": 57,
"avg_line_length": 18.28813559322034,
"alnum_prop": 0.7025023169601483,
"repo_name": "Workday/OpenFrame",
"id": "bb4641a5897f04c8c7a42d5cfd663b748ab4de5d",
"size": "124... |
from collections import OrderedDict
import argparse
import httplib
import json
import os.path
import re
import sys
import time
# Seconds to wait for the admin address output file to appear. The script exits
# with failure if the file is not found.
ADMIN_FILE_TIMEOUT_SECS = 20
# Because the hot restart files are yam... | {
"content_hash": "f29dd064d0cb217c32ac0c011cb35781",
"timestamp": "",
"source": "github",
"line_count": 106,
"max_line_length": 100,
"avg_line_length": 35.16981132075472,
"alnum_prop": 0.5971030042918455,
"repo_name": "dnoe/envoy",
"id": "da41dc5c5bbdc5ee67983a33141cea2870a3fe9c",
"size": "4190",
... |
"""SNR agent."""
from acme.agents.jax.sac.config import target_entropy_from_env_spec
from jrl.agents.snr import config
from jrl.agents.snr import networks
from jrl.agents.snr.builder import SNRBuilder
from jrl.agents.snr.learning import SNRLearner
from jrl.agents.snr.networks import apply_policy_and_sample
from jrl.u... | {
"content_hash": "459df5dd665dd6fb661d9c7aba3de29d",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 75,
"avg_line_length": 34.170731707317074,
"alnum_prop": 0.715203426124197,
"repo_name": "google-research/google-research",
"id": "fea3a9a2452d1cef5855f69402766d9e5561e4ee",
... |
from google.cloud import secretmanager_v1
def sample_destroy_secret_version():
# Create a client
client = secretmanager_v1.SecretManagerServiceClient()
# Initialize request argument(s)
request = secretmanager_v1.DestroySecretVersionRequest(
name="name_value",
)
# Make the request
... | {
"content_hash": "7c1b236dbde777287a2faf54b90d462c",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 81,
"avg_line_length": 26.789473684210527,
"alnum_prop": 0.7387033398821218,
"repo_name": "googleapis/python-secret-manager",
"id": "3c2a0bf564de76974ee72b3fb775e23cdc02efe1"... |
from looker_sdk import methods, models40
import looker_sdk
import exceptions
sdk = looker_sdk.init40("../looker.ini")
def create_simple_schedule(dashboard_id:int,user_id:int,schedule_title:str, format:str, email:str,type:str, message:str, crontab:str):
### For more information on the Params accepted https://githu... | {
"content_hash": "b530758ddf27c327c534a72f86bdf212",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 307,
"avg_line_length": 86.4,
"alnum_prop": 0.7376543209876543,
"repo_name": "looker-open-source/sdk-codegen",
"id": "8e21888289d14a4f057b1d7a6ce4004fbd045aa8",
"size": "12... |
"""oslo.i18n integration module.
See http://docs.openstack.org/developer/oslo.i18n/usage.html
"""
try:
import oslo_i18n
# NOTE(dhellmann): This reference to o-s-l-o will be replaced by the
# application name when this module is synced into the separate
# repository. It is OK to have more than one tr... | {
"content_hash": "04267b614d563acf6da2b4e2be677ac9",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 73,
"avg_line_length": 35.06060606060606,
"alnum_prop": 0.682800345721694,
"repo_name": "muraliselva10/designate",
"id": "fd1b98e6df54951b5c1b910dbffa6386b49923f4",
"size":... |
from sanic import Sanic
from sanic.blueprints import Blueprint
from sanic.response import json
app = Sanic(name="blue-print-group-version-example")
bp1 = Blueprint(name="ultron", url_prefix="/ultron")
bp2 = Blueprint(name="vision", url_prefix="/vision", strict_slashes=None)
bpg = Blueprint.group([bp1, bp2], url_pre... | {
"content_hash": "f6b7b2a2baa46fffdda67a0f11cae150",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 95,
"avg_line_length": 27.514285714285716,
"alnum_prop": 0.6843198338525441,
"repo_name": "channelcat/sanic",
"id": "77360f5d6f4b896f8a53cfa70ef18d37567923c5",
"size": "963... |
"""Tests for tensorflow_model.object_detection.metrics.coco_tools."""
import json
import os
import re
import numpy as np
from pycocotools import mask
import tensorflow as tf
from object_detection.metrics import coco_tools
class CocoToolsTest(tf.test.TestCase):
def setUp(self):
groundtruth_annotations_list =... | {
"content_hash": "f37a86e12cd21286756cf65c7722d9c2",
"timestamp": "",
"source": "github",
"line_count": 281,
"max_line_length": 80,
"avg_line_length": 39.704626334519574,
"alnum_prop": 0.5678945953213229,
"repo_name": "CUFCTL/DLBD",
"id": "cfb73d8c332420d93e19029f53e4068c9fc7b23b",
"size": "11846",... |
import os, hashlib, hmac, base64
from ConfigParser import SafeConfigParser
from fabric.operations import prompt
def loadcredentials():
config = SafeConfigParser()
config_file_path = os.path.join(os.path.dirname(__file__), 'venv', 'aws.ini')
if not os.path.isfile(config_file_path):
config.add_secti... | {
"content_hash": "86c4f543862ce36b057d953f3f0f22f3",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 81,
"avg_line_length": 37.266666666666666,
"alnum_prop": 0.648479427549195,
"repo_name": "tomcz/aws_py",
"id": "72e0c006a3666851a560dd6a8bf40009cb3c9e9d",
"size": "1118",
... |
from setuptools import setup, find_packages
setup(
name='pymongopager',
version="0.1",
packages=find_packages(),
include_package_data=False,
install_requires=[],
)
| {
"content_hash": "2c65119905fdf8244abfaeeac7f7aebc",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 43,
"avg_line_length": 20.555555555555557,
"alnum_prop": 0.6756756756756757,
"repo_name": "guneysus/pymongopager",
"id": "965ba9721e9e895cc5cfc6d6065520711242884a",
"size": ... |
"""
The MIT License (MIT)
Copyright (c) [2015-2022] [Andrew Annex]
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, modif... | {
"content_hash": "659cfd7efdf10261d505a62e91a9ed47",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 80,
"avg_line_length": 38.70909090909091,
"alnum_prop": 0.7130108031939878,
"repo_name": "AndrewAnnex/SpiceyPy",
"id": "ffd09bb5e71fbcced3c3638eb816a9cc0f7374a5",
"size": "... |
import fixtures
from nova import test
from nova.virt.vmwareapi import fake
from nova.virt.vmwareapi import vim_util
def _fake_get_object_properties(vim, collector, mobj,
type, properties):
fake_objects = fake.FakeRetrieveResult()
fake_objects.add_object(fake.ObjectContent(None... | {
"content_hash": "7ffa483538499db5335b11adb29972e5",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 73,
"avg_line_length": 37.94871794871795,
"alnum_prop": 0.6263513513513513,
"repo_name": "SUSE-Cloud/nova",
"id": "495ee4a47b3f9d55c68ede68da9e698c2495ded2",
"size": "2134"... |
import os
from .repository import require_repo
from .config import set_value
themes_dir = '_themes'
default_theme = 'default'
class ThemeNotFoundError(Exception):
"""Indicates the requested theme was not found."""
def __init__(self, theme):
super(ThemeNotFoundError, self).__init__()
self.the... | {
"content_hash": "8fc4ec42a23e9288b94633d3e427b2d9",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 103,
"avg_line_length": 28.806451612903224,
"alnum_prop": 0.6886898096304591,
"repo_name": "joeyespo/gitpress",
"id": "a18cba26276334eda71b55a0ec5f16e85fcf54ea",
"size": "8... |
import tkinter as Tk
from tkinter import filedialog, simpledialog, colorchooser
# An implementation with many features without OOP
def init_menubar():
# Create menubar
menubar = Tk.Menu()
# Set menubar as menu for root
root.config(menu=menubar)
# Fill menubar with "File" menu
filemenu = Tk.... | {
"content_hash": "3f901352a8d324ab820c31aa73901481",
"timestamp": "",
"source": "github",
"line_count": 251,
"max_line_length": 89,
"avg_line_length": 26.422310756972113,
"alnum_prop": 0.6117310012062727,
"repo_name": "introprogramming/exercises",
"id": "ee9e60347a6d3dfbef9ed6464aa5c082b9708fb8",
"... |
"""OpenSSL/M2Crypto 3DES implementation."""
from .cryptomath import *
from .tripledes import *
if m2cryptoLoaded:
def new(key, mode, IV):
return OpenSSL_TripleDES(key, mode, IV)
class OpenSSL_TripleDES(TripleDES):
def __init__(self, key, mode, IV):
TripleDES.__init__(self, key, ... | {
"content_hash": "5a716a6c30544b693cbb907a9ccc291b",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 98,
"avg_line_length": 37.90909090909091,
"alnum_prop": 0.5989208633093526,
"repo_name": "splunk/splunk-webframework",
"id": "3f014dabc8b2665a50e3c78465a63443e7c0bd42",
"si... |
"""
homeassistant.components.switch.wemo
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Support for WeMo switches.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/switch.wemo/
"""
import logging
from homeassistant.components.switch import SwitchDevice
from homeas... | {
"content_hash": "f17310d7c9405c64c766d6d61ac465c2",
"timestamp": "",
"source": "github",
"line_count": 187,
"max_line_length": 78,
"avg_line_length": 31.106951871657753,
"alnum_prop": 0.5908543922984356,
"repo_name": "Theb-1/home-assistant",
"id": "1d569449ff7caf7747956d297495b04153de1514",
"size"... |
import unittest, random, sys, time
sys.path.extend(['.','..','../..','py'])
import h2o, h2o_cmd, h2o_browse as h2b, h2o_import as h2i, h2o_glm, h2o_util, h2o_jobs, h2o_gbm, h2o_exec as h2e
DO_BUG = False
DO_HDFS = False
DO_ALL_DIGITS = False
print "Uses numpy to create dataset..I guess we have to deal with jenkins no... | {
"content_hash": "7756cdd6ac79626214eae632182881d7",
"timestamp": "",
"source": "github",
"line_count": 168,
"max_line_length": 112,
"avg_line_length": 38.529761904761905,
"alnum_prop": 0.5300478912405376,
"repo_name": "eg-zhang/h2o-2",
"id": "a9ed7becb880268808a52042e8e9fad3eca5862e",
"size": "647... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.