text stringlengths 4 1.02M | meta dict |
|---|---|
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import ray
from ray.rllib.evaluation.postprocessing import compute_advantages, \
Postprocessing
from ray.rllib.policy.tf_policy_template import build_tf_policy
from ray.rllib.policy.sample_batch import Samp... | {
"content_hash": "ab0d6c81d9cbddb4d5b9df46ac8d2cef",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 69,
"avg_line_length": 33.91891891891892,
"alnum_prop": 0.69800796812749,
"repo_name": "ujvl/ray-ng",
"id": "1b8f6a4b6fcb6c9040a2dad1be5d4229c5fbe840",
"size": "1255",
"b... |
import MapReduce
import sys
"""
SQL style Joins in MapReduce
"""
mr = MapReduce.MapReduce()
# =============================
# Do not modify above this line
def mapper(record):
# key: document identifier
# value: document contents
value = str(record[0])
num = str(record[1])
mr.emit_intermediate(num, (value... | {
"content_hash": "d535cb9d4812f86aa2fda2c1786de87c",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 44,
"avg_line_length": 20.75,
"alnum_prop": 0.5850066934404283,
"repo_name": "P7h/IntroToDataScience__Coursera_Course",
"id": "2241d0bcc483df8ae598bcac2ffa98c9d73b4660",
"s... |
""" Optimizations of built-ins to built-in calls.
"""
import math
import sys
from nuitka.nodes.ParameterSpecs import (
ParameterSpec,
TooManyArguments,
matchCall
)
from nuitka.utils.Utils import python_version
class BuiltinParameterSpec(ParameterSpec):
def __init__(self, name, arg_names, default_cou... | {
"content_hash": "e91dc01a23fa981594264537255def1d",
"timestamp": "",
"source": "github",
"line_count": 409,
"max_line_length": 114,
"avg_line_length": 35.826405867970664,
"alnum_prop": 0.5987169862826724,
"repo_name": "wfxiang08/Nuitka",
"id": "9c82725f90bee1a8a8a525ee383287c759d267f5",
"size": "1... |
'''
Relative Layout
===============
.. versionadded:: 1.4.0
This layout allows you to set relative coordinates for children. If you want
absolute positioning, use the :class:`~kivy.uix.floatlayout.FloatLayout`.
The :class:`RelativeLayout` class behaves just like the regular
:class:`FloatLayout` except that its chil... | {
"content_hash": "39db0e296bcb2784f8d01627a35416e3",
"timestamp": "",
"source": "github",
"line_count": 220,
"max_line_length": 79,
"avg_line_length": 36.722727272727276,
"alnum_prop": 0.6849857655650452,
"repo_name": "ehealthafrica-ci/kivy",
"id": "d7566a83f43e63e6cd5c1af6dbaf069182b7a36f",
"size"... |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('operacion', '0026_merge_20161006_1512'),
]
operations = [
migrations.AlterField(
model_name='orden',
name='fin',
... | {
"content_hash": "c6bff11c8a552cf37f85d35754a65261",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 62,
"avg_line_length": 21.61111111111111,
"alnum_prop": 0.596401028277635,
"repo_name": "exildev/AutoLavadox",
"id": "5233ec3e595914c3512325aa2a0c21ae055fa0af",
"size": "46... |
import os
import urllib2
from contextlib import closing
from pysolar.files.utils import MissingFileError
class FileManager:
"""
Builds more complex file download behaviours.
config: An instance of the Configuration class.
"""
def __init__(self, config):
self.remote = RemoteManager(config)... | {
"content_hash": "c53515e26605b27d41b46a08052e3b72",
"timestamp": "",
"source": "github",
"line_count": 129,
"max_line_length": 77,
"avg_line_length": 32.3875968992248,
"alnum_prop": 0.5866443274293921,
"repo_name": "conceptric/pysolar",
"id": "a62b549d68fdaf19c7f0a2c3f29fca26ae602865",
"size": "41... |
import os
import subprocess
import sys
from os import access
from os import getenv
from os import X_OK
jar_file = 'SearchGUI-2.9.0.jar'
default_jvm_mem_opts = ['-Xms512m', '-Xmx1g']
# !!! End of parameter section. No user-serviceable code below this line !!!
def real_dirname(path):
"""Return the symlink-resolve... | {
"content_hash": "584f3a25385b923acbad3aca2fabb0e3",
"timestamp": "",
"source": "github",
"line_count": 81,
"max_line_length": 82,
"avg_line_length": 28.51851851851852,
"alnum_prop": 0.6220779220779221,
"repo_name": "zwanli/bioconda-recipes",
"id": "6d34917380664c24e5073e650bd1da9e95c01cf9",
"size"... |
"""Tests for the AVM Fritz!Box integration."""
from __future__ import annotations
from unittest.mock import Mock
from aiohttp import ClientSession
from homeassistant.components.diagnostics import REDACTED
from homeassistant.components.fritzbox.const import DOMAIN as FB_DOMAIN
from homeassistant.components.fritzbox.d... | {
"content_hash": "b20a7b60953f97c5afbce9d60495b599",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 82,
"avg_line_length": 33.72727272727273,
"alnum_prop": 0.7601078167115903,
"repo_name": "nkgilley/home-assistant",
"id": "9efe6c23902b280c060981a58aeb71081c061b84",
"size"... |
import os
import argparse
# Creates a new fileset with all the necessary files.
# In case the module does not exist, also the module is created.
def generate_fileset(base_path, metricbeat_path, module, fileset):
generate_module(base_path, metricbeat_path, module, fileset)
fileset_path = base_path + "/module... | {
"content_hash": "83db6adf4d306df9e04535678299698b",
"timestamp": "",
"source": "github",
"line_count": 107,
"max_line_length": 77,
"avg_line_length": 32.467289719626166,
"alnum_prop": 0.6269430051813472,
"repo_name": "taitan-org/inflog",
"id": "2f5b0dd6043b6dc7a59b04a805c60e79285eb638",
"size": "3... |
from __future__ import print_function, unicode_literals, absolute_import
import sys
disclaimer = """# Copyright 2017 Battelle Energy Alliance, LLC
#
# 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 Licens... | {
"content_hash": "1388c78e6ac1848e56a844ea31083650",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 101,
"avg_line_length": 33.68888888888889,
"alnum_prop": 0.7170184696569921,
"repo_name": "joshua-cogliati-inl/raven",
"id": "ea47328913fea64a6d34b8c511684eb2abcefc9f",
"si... |
"""Tests for learn.estimators.dynamic_rnn_estimator."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tempfile
import numpy as np
from tensorflow.contrib import rnn
from tensorflow.contrib.layers.python.layers import feature_column
from tensorflo... | {
"content_hash": "6a840534dba132aa2652ceedd0daae8c",
"timestamp": "",
"source": "github",
"line_count": 765,
"max_line_length": 86,
"avg_line_length": 39.25228758169935,
"alnum_prop": 0.6438657253230319,
"repo_name": "ageron/tensorflow",
"id": "c3e9e3af9427037a4e7be6b86417cd081c42ef67",
"size": "30... |
import qibuild.config
import qitoolchain.toolchain
def test_simple(qitoolchain_action):
qitoolchain_action("create", "foo")
qibuild.config.add_build_config("foo", toolchain="foo")
word_package = qitoolchain_action.get_test_package("world")
qitoolchain_action("add-package", "-c", "foo", word_package)
... | {
"content_hash": "29236d5961ec7076d2957a290466abfd",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 83,
"avg_line_length": 43.411764705882355,
"alnum_prop": 0.6978319783197832,
"repo_name": "dmerejkowsky/qibuild",
"id": "91d73a663ea7dc821521aa1f2f095d3922d8f8bf",
"size": ... |
"""
These are almost end-to-end tests. They create a Prompt, feed it with some
input and check the result.
"""
from functools import partial
import pytest
from prompt_toolkit.clipboard import ClipboardData, InMemoryClipboard
from prompt_toolkit.enums import EditingMode
from prompt_toolkit.filters import ViInsertMode
... | {
"content_hash": "5e39c37adf2f1a9f65fbb6870b9fd4c5",
"timestamp": "",
"source": "github",
"line_count": 947,
"max_line_length": 91,
"avg_line_length": 29.633579725448786,
"alnum_prop": 0.6110537006022164,
"repo_name": "jonathanslenders/python-prompt-toolkit",
"id": "c360d8ebf14889bc9a780b0ad5fdd74e03... |
"""Development settings and globals."""
from .base import *
########## DEBUG CONFIGURATION
# See: https://docs.djangoproject.com/en/dev/ref/settings/#debug
DEBUG = True
# See: https://docs.djangoproject.com/en/dev/ref/settings/#template-debug
TEMPLATE_DEBUG = DEBUG
########## END DEBUG CONFIGURATION
########## EM... | {
"content_hash": "934e94e460ff72bce9219d9ac8b57fd8",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 80,
"avg_line_length": 25.617021276595743,
"alnum_prop": 0.6461794019933554,
"repo_name": "aymara/verbenet-editor",
"id": "0f933e71671a30d6c6c2be3843dea035bce3757e",
"size"... |
import unittest
import numpy as np
import paddle
from paddle.static import Program, program_guard
# In static mode, inplace strategy will not be used in Inplace APIs.
class TestStaticAutoGeneratedAPI(unittest.TestCase):
def setUp(self):
paddle.enable_static()
self.init_data()
self.set_np_... | {
"content_hash": "5d53a73edf865e7be87aa2ddd2bca50c",
"timestamp": "",
"source": "github",
"line_count": 265,
"max_line_length": 80,
"avg_line_length": 25.41509433962264,
"alnum_prop": 0.6580549368968077,
"repo_name": "luotao1/Paddle",
"id": "d8f8b5dbc72ce1a98915a55e3db39fefa77ac6b5",
"size": "7348"... |
'''NeuroM neurom morphology analysis package
Examples:
Load a neuron
>>> import neurom as nm
>>> nrn = nm.load_neuron('some/data/path/morph_file.swc')
Obtain some morphometrics using the get function
>>> ap_seg_len = nm.get('segment_lengths', nrn, neurite_type=nm.APICAL_DENDRITE)
>>> ax_sec... | {
"content_hash": "a1d9b7d87029b983d938eca42c41ca7d",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 88,
"avg_line_length": 35.08,
"alnum_prop": 0.7109464082098061,
"repo_name": "eleftherioszisis/NeuroM",
"id": "cbae5e84e1bb19fb6ba536b744a5cbc04329d552",
"size": "3448",
... |
from calvin.actor.actor import Actor, ActionResult, condition, guard, manage
class Alternate(Actor):
"""
Alternating between two streams of tokens
Inputs:
token_1 : first token stream
token_2 : second token stream
Outputs:
token : resulting token stream
"""
@manage(['token... | {
"content_hash": "af32a419cfdb46014d09ba52c9fb2b76",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 76,
"avg_line_length": 24.21276595744681,
"alnum_prop": 0.5272407732864675,
"repo_name": "josrolgil/exjobbCalvin",
"id": "93b57fa4d010999d7fdd21ab80562212dd40f8e4",
"size":... |
"""
Source: http://docs.python.org/3/library/datetime.html → "Example tzinfo classes"
Idea: http://stackoverflow.com/a/2071364/183995
"""
from datetime import datetime as dt, tzinfo, timedelta
import time as _time
ZERO = timedelta(0)
STDOFFSET = timedelta(seconds = -_time.timezone)
if _time.daylight:
D... | {
"content_hash": "b531c028a2261532f75c4506262d2ff7",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 85,
"avg_line_length": 23.42222222222222,
"alnum_prop": 0.5986717267552182,
"repo_name": "HesselTjeerdsma/Cyber-Physical-Pacman-Game",
"id": "1e38e4bb52acc0ae2733b82395710588... |
from flask import Blueprint, session, render_template, abort, request, jsonify
import mysql.connector
from handlers.moment import publicMoments, userMoments, listMoments
from handlers.watch import allWatch
from handlers.like import userLike
from handlers.comment import userComments
import secret
lists_routes = Bluepri... | {
"content_hash": "46bace1d72d91eefc75cbe8e054367b1",
"timestamp": "",
"source": "github",
"line_count": 147,
"max_line_length": 81,
"avg_line_length": 29.64625850340136,
"alnum_prop": 0.5378614043139055,
"repo_name": "byn9826/Thousand-Day",
"id": "ed1f6080ef162afaeb6174f50a08ee7af81efd61",
"size": ... |
import pytest
import github3
from .helper import (UnitHelper, UnitIteratorHelper, create_url_helper,
create_example_data_helper)
url_for = create_url_helper(
'https://api.github.com/users/octocat'
)
get_users_example_data = create_example_data_helper('users_example')
example_data = get_use... | {
"content_hash": "67e8d1d1f6a158f19f87af815d402fec",
"timestamp": "",
"source": "github",
"line_count": 158,
"max_line_length": 77,
"avg_line_length": 29.556962025316455,
"alnum_prop": 0.582441113490364,
"repo_name": "ueg1990/github3.py",
"id": "fad34bbf9ff383955ff4f96d2ee31dc2b939257a",
"size": "4... |
__author__ = 'Ming'
import threading
import socket
import serial
import cv2
import numpy as np
import math
import sys
# distance data measured by ultrasonic sensor
sensor_data =b""
class NeuralNetwork(object):
def __init__(self):
self.annmodel = cv2.ml.ANN_MLP_load('mlp_mlp2.xml')
def predict(self... | {
"content_hash": "d0ae226e8b02623db1ea80cb6537adfe",
"timestamp": "",
"source": "github",
"line_count": 95,
"max_line_length": 123,
"avg_line_length": 31.08421052631579,
"alnum_prop": 0.534371825262445,
"repo_name": "lurenlym/BPnetwork_smartcar",
"id": "fc4dbde5183cf3908d446bad8fa2f5b92d4a0f11",
"s... |
import os
import logging
import subprocess
def spawn(args, **kwargs):
"""Spawn a subprocess and return it back
"""
if not 'cwd' in kwargs:
kwargs['cwd'] = os.path.dirname(os.path.abspath(__file__))
kwargs['bufsize'] = -1
if os.name == 'nt':
startupinfo = subprocess.STARTUPINFO()
... | {
"content_hash": "15a98fade473f89bcb45a939e12d553f",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 74,
"avg_line_length": 25.2,
"alnum_prop": 0.5984126984126984,
"repo_name": "j5shi/ST3_Config",
"id": "04c3e7f93726fcbe1554d3562be39e6df0cbbbc5",
"size": "759",
"binary":... |
import logging
from paramiko import client as pmclient
import time
class SSHSession(object):
def __init__(self, hostname, username, password, logger=None):
self.logger = logger or logging
self.client = ssh = pmclient.SSHClient()
ssh.set_missing_host_key_policy(pmclient.AutoAddPolicy())
... | {
"content_hash": "c75d5dc80159ae525a1fa63166ec00c9",
"timestamp": "",
"source": "github",
"line_count": 76,
"max_line_length": 110,
"avg_line_length": 29.105263157894736,
"alnum_prop": 0.6030741410488246,
"repo_name": "kfsone/tinker",
"id": "93351d962b325c4e457a88da77e281626a7f8afd",
"size": "2212"... |
import os
import sys
import subprocess
import glob
swift_container_input = "anders-test"
swift_container_output = "anders-test"
os_password = os.environ["OS_PASSWORD"]
os_username = os.environ["OS_USERNAME"]
try:
# This command is example of providing all parameters as one environment variable named "envparams"
... | {
"content_hash": "b86ec2b3490d73b50e0b246e6eabd9c8",
"timestamp": "",
"source": "github",
"line_count": 74,
"max_line_length": 602,
"avg_line_length": 78.39189189189189,
"alnum_prop": 0.7160834338907085,
"repo_name": "phnmnl/MTBLS233-POP",
"id": "811f87075757f190af07e7386bfdad70813bf1c6",
"size": "... |
from subprocess import call
import os
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("-p", "--port", help="port to start service on")
args = parser.parse_args()
if (args.port == None):
port = "8080"
else:
port = args.port
call(["docker", "run", "-i", "-p", port+":8080", "-t", "wut"])
| {
"content_hash": "b330631f3edc9e1036c7d84d5476ae4f",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 68,
"avg_line_length": 21.066666666666666,
"alnum_prop": 0.6455696202531646,
"repo_name": "WebUtilityKit/api-server",
"id": "5bed21771ba3f1ffa0e1a4c858792d3d490744d8",
"siz... |
import random
import string
from ..base import Factory
class RandomLengthStringFactory(Factory):
MIN_CHAR_DEFAULT = 3
MAX_CHAR_DEFAULT = 100
def __init__(self, min_chars=None, max_chars=None, prefix=None, suffix=None):
super(RandomLengthStringFactory, self).__init__()
self._min_chars = ... | {
"content_hash": "d22d6421606e3ffe7d204d2030f9d79b",
"timestamp": "",
"source": "github",
"line_count": 64,
"max_line_length": 94,
"avg_line_length": 36.15625,
"alnum_prop": 0.6806395851339672,
"repo_name": "arieb/python-testdata",
"id": "fc02d9c9e775b5c83ce403d1e719f62e6fe97894",
"size": "2314",
... |
from __future__ import absolute_import
from . import common
from .. import rw
from .call_continue import CallContinueMessage
from .types import Types
class CallResponseContinueMessage(CallContinueMessage):
"""Represent a continuation of a call response (across multiple frames)."""
message_type = Types.CALL_R... | {
"content_hash": "fb8561f7880bcb40508f32d12b6cf4d6",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 79,
"avg_line_length": 29.27777777777778,
"alnum_prop": 0.6299810246679317,
"repo_name": "uber/tchannel-python",
"id": "f01c47d922c72f979e08b72a5b2d4f74c876670c",
"size": "... |
from flask import Blueprint
bp = Blueprint('personal_access_token.web', __name__)
@bp.before_request
def before_request():
bp.app.call_before_request_funcs()
@bp.route('/')
def index():
return render_template('personal_access_token/index.html')
| {
"content_hash": "e9caed28e66887f4af563acb08fa2ff3",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 62,
"avg_line_length": 23.272727272727273,
"alnum_prop": 0.7109375,
"repo_name": "soasme/flask-personal-access-token",
"id": "6061726c59c4ba897363c3d3da2484f55f17a666",
"si... |
from django import forms
class ConfirmationWidget(forms.TextInput):
template_name = "account/widgets/confirmation.html"
def __init__(self, phrase, **kwargs):
self.phrase = phrase
super(ConfirmationWidget, self).__init__(**kwargs)
def get_context(self, *args):
context = super(Conf... | {
"content_hash": "11eb290b52f40833f9c5bfb792a0efd7",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 68,
"avg_line_length": 31.571428571428573,
"alnum_prop": 0.6628959276018099,
"repo_name": "fin/froide",
"id": "caa3e6889e3916afbe8185e7f85c7de4a49f3410",
"size": "442",
"... |
"""
gettext for openstack-common modules.
Usual usage in an openstack.common module:
from openstack.common.gettextutils import _
"""
import copy
import gettext
import locale
from logging import handlers
import os
from babel import localedata
import six
_AVAILABLE_LANGUAGES = {}
# FIXME(dhellmann): Remove this... | {
"content_hash": "07941796dac7890e9346b5311705dcdb",
"timestamp": "",
"source": "github",
"line_count": 463,
"max_line_length": 79,
"avg_line_length": 37.54427645788337,
"alnum_prop": 0.6367140309497785,
"repo_name": "e0ne/python-brickagentclient",
"id": "98d5a738740f28c1592eb5de40ebcae60caff9fa",
... |
from libqtile.config import Key, Screen, Group, Drag, Click
from libqtile.lazy import lazy
from libqtile import layout, bar, widget
from typing import List # noqa: F401
mod = "mod4"
keys = [
# Switch between windows in current stack pane
Key([mod], "k", lazy.layout.down()),
Key([mod], "j", lazy.layout.u... | {
"content_hash": "9cfba0783b831cecfa4fcd31274c7337",
"timestamp": "",
"source": "github",
"line_count": 206,
"max_line_length": 84,
"avg_line_length": 32.737864077669904,
"alnum_prop": 0.5631672597864769,
"repo_name": "tiagocoutinho/tc",
"id": "5702d8a4ab664198e8de2f225c8d554d42195a8b",
"size": "67... |
from __future__ import absolute_import, division, print_function, unicode_literals
import pytest ; pytest
#-----------------------------------------------------------------------------
# Imports
#-----------------------------------------------------------------------------
# Standard library imports
# External impo... | {
"content_hash": "ca0675e1913ee8c27544a95549d26d08",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 111,
"avg_line_length": 32.679245283018865,
"alnum_prop": 0.3608545034642032,
"repo_name": "timsnyder/bokeh",
"id": "42ed5c1dbb73c8b46ed96b4213eb94cdfde21ba6",
"size": "223... |
from testtools import TestCase
from mock import Mock
from troveclient import users
from troveclient import base
"""
Unit tests for users.py
"""
class UserTest(TestCase):
def setUp(self):
super(UserTest, self).setUp()
self.orig__init = users.User.__init__
users.User.__init__ = Mock(retur... | {
"content_hash": "748aab0ee0d98a9a0b5db46e52945856",
"timestamp": "",
"source": "github",
"line_count": 126,
"max_line_length": 76,
"avg_line_length": 32.42857142857143,
"alnum_prop": 0.5758688203622124,
"repo_name": "neumerance/deploy",
"id": "0fc32f683da11c2934722ebdff6541cc65a7b43c",
"size": "40... |
from __future__ import unicode_literals
import pyxb
import pyxb.binding
import pyxb.binding.saxer
import io
import pyxb.utils.utility
import pyxb.utils.domutils
import sys
import pyxb.utils.six as _six
# Unique identifier for bindings created at the same time
_GenerationUID = pyxb.utils.utility.UniqueIdentifier('urn:u... | {
"content_hash": "8b0508c74c82a38acbbdb96abdd641bc",
"timestamp": "",
"source": "github",
"line_count": 822,
"max_line_length": 465,
"avg_line_length": 70.00973236009732,
"alnum_prop": 0.7716167373323138,
"repo_name": "getodacu/eSENS-eDocument",
"id": "8201259248d4f9696cff7e5fe4c64a644aa3a0eb",
"si... |
from sklearn import datasets
import numpy as np
from sklearn.cross_validation import train_test_split
from sklearn.preprocessing import StandardScaler
iris = datasets.load_iris()
X = iris.data[:, [2,3]]
y = iris.target
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.3, random_state=0)
sc = Sta... | {
"content_hash": "2d8116f988f1e94db01a83553f3ae8ac",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 88,
"avg_line_length": 22.31578947368421,
"alnum_prop": 0.7287735849056604,
"repo_name": "finger563/learningTF",
"id": "aaedb3c0f879431556b867f26dcf421e98a54ea0",
"size": "... |
from dal.test import case, stories
from dal.test.utils import OwnedFixtures
from dal_select2.test import Select2Story
from .models import TModel
class AdminLinkedDataTest(Select2Story,
case.AdminMixin,
case.OptionMixin,
case.AutocompleteT... | {
"content_hash": "cdef234aa489e71d6b0f8a30223fba3d",
"timestamp": "",
"source": "github",
"line_count": 69,
"max_line_length": 65,
"avg_line_length": 31.28985507246377,
"alnum_prop": 0.6016674386289949,
"repo_name": "yourlabs/django-autocomplete-light",
"id": "b45fb6586eb41fc27e5cef10dd22c9c5e7d91704... |
from .node import TrieNode
class CarbonIndex:
"""
an index for carbon-cache instances.
"""
def __init__(self, name='carbon_index', sep='.'):
self.name = name
self.root = TrieNode('root', is_leaf=False)
self.sep = sep
def insert(self, metric):
"""
insert me... | {
"content_hash": "b1b71416993e77670f258a702f0e8378",
"timestamp": "",
"source": "github",
"line_count": 90,
"max_line_length": 67,
"avg_line_length": 27.31111111111111,
"alnum_prop": 0.532546786004882,
"repo_name": "yunstanford/carbon-index",
"id": "14623327cc5e9eed4a0b4ff9f678a1984d6cfda2",
"size"... |
import os
import sys
from neutron.tests import base
from neutron.tests import tools
from neutron.tests.unit import tests # noqa
EXAMPLE_MODULE = 'neutron.tests.unit.tests.example.dir.example_module'
class ImportModulesRecursivelyTestCase(base.BaseTestCase):
def test_object_modules(self):
sys.modules.... | {
"content_hash": "52824d614af504f50bfefe9f3a0cfd7f",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 70,
"avg_line_length": 28.80952380952381,
"alnum_prop": 0.7024793388429752,
"repo_name": "wolverineav/neutron",
"id": "1ab3e939fda9e31a8cb89662ae52ed20895a21b1",
"size": "1... |
import requests
import xmltodict
from workitem import Workitem
# Suppress the warnings for now
requests.packages.urllib3.disable_warnings()
class IDS(object):
'''
A class to encapsulate the work needed to send REST calls to the IBM Devops Service RTC backend.
'''
def __init__(self, url, user, passwor... | {
"content_hash": "2d6e58f1f4b9b157a0f894f265aaae2d",
"timestamp": "",
"source": "github",
"line_count": 102,
"max_line_length": 108,
"avg_line_length": 33.73529411764706,
"alnum_prop": 0.5646614356291776,
"repo_name": "jroyal/pyIDS",
"id": "7fda86fc841e28bf1b28666f5dc43588d07d2930",
"size": "3441",... |
"""S3 file system implementation for accessing files on AWS S3."""
# pytype: skip-file
from apache_beam.io.aws import s3io
from apache_beam.io.filesystem import BeamIOError
from apache_beam.io.filesystem import CompressedFile
from apache_beam.io.filesystem import CompressionTypes
from apache_beam.io.filesystem import... | {
"content_hash": "93fc3cd8e8884dcc6acc1123f089fe98",
"timestamp": "",
"source": "github",
"line_count": 280,
"max_line_length": 79,
"avg_line_length": 32.107142857142854,
"alnum_prop": 0.6737486095661847,
"repo_name": "axbaretto/beam",
"id": "8a5e94e3fc7644e1195ae1bdc0577da4f7a75050",
"size": "9775... |
# Copyright 2018 Google LLC
#
# 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, s... | {
"content_hash": "026d7fb485d227d6964cb207ac867654",
"timestamp": "",
"source": "github",
"line_count": 80,
"max_line_length": 116,
"avg_line_length": 32.175,
"alnum_prop": 0.6398601398601399,
"repo_name": "quartzmo/gcloud-ruby",
"id": "5cf194d8f1031f4139e8bd3a830cad69ae0acf6e",
"size": "2574",
"... |
import numpy as np
from .. import smooth as sm
from numpy.testing import assert_equal
import copy
import math
def test_smooth():
x = {}
y = sm.smooth(x)
assert_equal(len(x), 0) | {
"content_hash": "dbd44a2b67c1dda61c4a6d9203090c46",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 38,
"avg_line_length": 18,
"alnum_prop": 0.7111111111111111,
"repo_name": "berkeley-stat159/project-zeta",
"id": "a175c1cfc60d0ff841d5c1b04cded9a6025d5239",
"size": "180",
... |
""" Sahana Eden Automated Test - HRM003 Create Staff Training
@copyright: 2011-2012 (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 Softwar... | {
"content_hash": "08b0169677b954d50a48050b90711eb3",
"timestamp": "",
"source": "github",
"line_count": 77,
"max_line_length": 110,
"avg_line_length": 38.36363636363637,
"alnum_prop": 0.5883547731888964,
"repo_name": "snpabilonia/rgims",
"id": "3a6d5327e442080c6db47d2bc037f3620cd3aa6c",
"size": "29... |
"""Unit tests for the bytes and bytearray types.
XXX This is a mess. Common tests should be moved to buffer_tests.py,
which itself ought to be unified with string_tests.py (and the latter
should be modernized).
"""
import os
import re
import sys
import copy
import functools
import pickle
import tempfile
import unitt... | {
"content_hash": "7c40d1033e4bc769d17fc5011a4d63c7",
"timestamp": "",
"source": "github",
"line_count": 1152,
"max_line_length": 96,
"avg_line_length": 38.68836805555556,
"alnum_prop": 0.5695662904709552,
"repo_name": "azoft-dev-team/imagrium",
"id": "19454fd4ffb85f62410b0d314e2016205ad4723d",
"siz... |
from __future__ import annotations
from typing import *
from edb import errors
from edb.common import verutils
from edb.edgeql import ast as qlast
from edb.edgeql import qltypes
from edb.edgeql import parser as qlparser
from . import annos as s_anno
from . import delta as sd
from . import name as sn
from . import o... | {
"content_hash": "5f46819629c6145bd0ee50b6e34b714d",
"timestamp": "",
"source": "github",
"line_count": 261,
"max_line_length": 79,
"avg_line_length": 28.402298850574713,
"alnum_prop": 0.6251180358829084,
"repo_name": "edgedb/edgedb",
"id": "e8418fc22dfaea32037c3f862d604db22b8ae28b",
"size": "8094"... |
"""
Credit Card Validator - Takes in a credit card number from a
common credit card vendor (Visa, MasterCard, American Express,
Discoverer) and validates it to make sure that it is a valid
number (look into how credit cards use a checksum).
This program works with *most* credit card numbers.
Uses Luhn Algorithm (http... | {
"content_hash": "0b90a79cc099ce789360cc8d680044d9",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 116,
"avg_line_length": 39.292682926829265,
"alnum_prop": 0.6654252017380509,
"repo_name": "Mitali-Sodhi/CodeLingo",
"id": "7bb0a39cfdcd8a093f4cf7577ab996d1aa5a9b2c",
"size... |
"""
Script used interact with different tools in hots comp builder
Load and compare data from the iv_data database.
Provide amount of players, favorite heroes, and map name.
Output a map score based on input and build best comp between players.
"""
import datetime
import argparse
import json
import re
import os
fr... | {
"content_hash": "1c7c190bb7e7e0f7914e1681748fa217",
"timestamp": "",
"source": "github",
"line_count": 398,
"max_line_length": 92,
"avg_line_length": 35.91708542713568,
"alnum_prop": 0.460930395243092,
"repo_name": "jup3/hots",
"id": "32a1984ed4a9cd3757bcd07786a270938de5c43e",
"size": "14317",
"... |
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('report_ia', '0059_remove_aantalstarts_totaal_vliegdagen'),
]
operations = [
]
| {
"content_hash": "22397f5cc34485d6c88dd09242901b1a",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 68,
"avg_line_length": 18.307692307692307,
"alnum_prop": 0.6722689075630253,
"repo_name": "jefke-glider/gliding",
"id": "2174ebce1efee3f856e83929c62a579dae4ce018",
"size": ... |
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('imager_images', '0011_auto_20170201_1906'),
]
operations = [
migrations.RemoveField(
model_name='album',
name='tags',
),
... | {
"content_hash": "eaa88cd982fd24e3dbe972a4dc948fe4",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 53,
"avg_line_length": 19,
"alnum_prop": 0.5851393188854489,
"repo_name": "clair3st/django-imager",
"id": "b5b1c9ca90642d2b94959382d80fbafa8fc64df6",
"size": "396",
"bina... |
import unittest
import numpy as np
import paddle
import paddle.static
from paddle.fluid.tests.unittests.ipu.op_test_ipu import IPUOpTest
class TestBase(IPUOpTest):
def setUp(self):
self.set_atol()
self.set_training()
self.set_data_feed()
self.set_feed_attr()
self.set_op_at... | {
"content_hash": "2c59d09449881ef9b0ca5ffa971a7f39",
"timestamp": "",
"source": "github",
"line_count": 78,
"max_line_length": 77,
"avg_line_length": 30.03846153846154,
"alnum_prop": 0.5821596244131455,
"repo_name": "luotao1/Paddle",
"id": "784a6a41a41f563d650ba559252739f3c3af54cb",
"size": "2954",... |
from urllib import parse
import pkg_resources
from spring.cbgen_helpers import backoff, quiet, time_all, timeit
cb_version = pkg_resources.get_distribution("couchbase").version
if cb_version[0] == '2':
from couchbase import experimental, subdocument
from couchbase.bucket import Bucket
from couchbase.n1ql... | {
"content_hash": "f7bc574ed6560971055e586f379fda48",
"timestamp": "",
"source": "github",
"line_count": 142,
"max_line_length": 88,
"avg_line_length": 34.13380281690141,
"alnum_prop": 0.5364142768722922,
"repo_name": "couchbase/perfrunner",
"id": "872832a2d87f4b8aa7537b7187a73a560cf9abe5",
"size": ... |
"""
docker_registry.drivers.azure
~~~~~~~~~~~~~~~~~~~~~~~~~~
Microsoft Azure Blob Storage driver.
"""
import io
import logging
import os
import shutil
from docker_registry.core import driver
from docker_registry.core import exceptions
from docker_registry.core import lru
import azure
from azure.storage import Blob... | {
"content_hash": "b281b27f3a2669206e4d9d39fb83d527",
"timestamp": "",
"source": "github",
"line_count": 141,
"max_line_length": 78,
"avg_line_length": 31.843971631205672,
"alnum_prop": 0.5665924276169265,
"repo_name": "ahmetalpbalkan/docker-registry-driver-azure",
"id": "37d246d54a16d24cb5d3a581f0fef... |
import sys
def readfile(filepath):
content_arr = []
fp = open(filepath, 'r')
while True:
line = fp.readline()
if not line:
break
content_arr.append(line.strip())
fp.close()
return content_arr
def maketable(content_arr):
"""Convert content to table.
The ... | {
"content_hash": "8cd0ba90e80543b543d561bd1c20562b",
"timestamp": "",
"source": "github",
"line_count": 117,
"max_line_length": 123,
"avg_line_length": 25.905982905982906,
"alnum_prop": 0.5123721544044869,
"repo_name": "guozengxin/common_tools",
"id": "cc7cf581e6b63e1d84f874db86fccc0650f5dc6f",
"si... |
import logging
from random import randint
from django import template
from django.contrib import auth
from django.template.response import TemplateResponse
from connection import views
from connection.models import *
__author__ = 'Sami'
register = template.Library()
@register.assignment_tag()
def random_number():
... | {
"content_hash": "5717ff70544b4d3bc959c2de35253493",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 66,
"avg_line_length": 24.904761904761905,
"alnum_prop": 0.6768642447418738,
"repo_name": "le2s/LibreCoach",
"id": "58f3b16467e63cd76caaf8d77e2d8303bee5f6e9",
"size": "1046... |
import os
import scipy.io as sio
from matplotlib.pyplot import savefig, imshow, annotate, imread, figure
import numpy as np
from utils import split_filename
def getname(filename):
_,name,ext = split_filename(filename)
oldname = os.path.join('uploads',name+ext)
newname = os.path.join('downloads',name+'.jpg'... | {
"content_hash": "3b9dbb4581b9676c0b8076b1211c8aa3",
"timestamp": "",
"source": "github",
"line_count": 81,
"max_line_length": 82,
"avg_line_length": 31.098765432098766,
"alnum_prop": 0.591901548233426,
"repo_name": "akeshavan/img_utils",
"id": "6e2ce277e18ea6d9d56ffd1bac263819be0d5d74",
"size": "2... |
from __future__ import unicode_literals
from django.conf import settings
from django.conf.urls import include, url
from django.conf.urls.static import static
from django.contrib import admin
from django.views.generic import TemplateView
from django.views import defaults as default_views
urlpatterns = [
url(r'^', ... | {
"content_hash": "720f178859303c388c87aa2b40f33e24",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 110,
"avg_line_length": 39.515151515151516,
"alnum_prop": 0.6886503067484663,
"repo_name": "watchdogpolska/petycja-norweskie",
"id": "349393e23efda40c314f29c95b43a43f10b36c91... |
"""Datasets."""
# --- import --------------------------------------------------------------------------------------
import pathlib
from .. import kit as wt_kit
# --- define --------------------------------------------------------------------------------------
here = pathlib.Path(__file__).parent.resolve()
# ... | {
"content_hash": "f9c21c24921b26df75973d00d2f32f6e",
"timestamp": "",
"source": "github",
"line_count": 112,
"max_line_length": 99,
"avg_line_length": 24.178571428571427,
"alnum_prop": 0.5107090103397341,
"repo_name": "wright-group/WrightTools",
"id": "e9762b445899b5590ae8bcfaca7ff9da0bdeca59",
"si... |
from __future__ import unicode_literals, division, absolute_import
import urllib
import urllib2
import logging
import re
from flexget import plugin
from flexget.entry import Entry
from flexget.event import event
from flexget.plugins.plugin_urlrewriting import UrlRewritingError
from flexget.utils.soup import get_soup
f... | {
"content_hash": "620faa25af32d6d394a86e8cf860e416",
"timestamp": "",
"source": "github",
"line_count": 129,
"max_line_length": 111,
"avg_line_length": 37.674418604651166,
"alnum_prop": 0.5936213991769548,
"repo_name": "vfrc2/Flexget",
"id": "3daef35b4c9be15fefefc134a6c95e9fa8b75019",
"size": "4860... |
from auth import *
test()
| {
"content_hash": "71c17fd916df359bdd9a7528500c8884",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 18,
"avg_line_length": 9,
"alnum_prop": 0.6666666666666666,
"repo_name": "val314159/old.authsvr",
"id": "36a10304755a95c63f038467467ec195fe1ca8e8",
"size": "27",
"binary":... |
"""The signac framework aids in the management of large and
heterogeneous data spaces.
It provides a simple and robust data model to create a
well-defined indexable storage layout for data and metadata.
This makes it easier to operate on large data spaces,
streamlines post-processing and analysis and makes data
collec... | {
"content_hash": "5ff17718f3c9ca596cd8a5856aa5bff6",
"timestamp": "",
"source": "github",
"line_count": 54,
"max_line_length": 84,
"avg_line_length": 34.370370370370374,
"alnum_prop": 0.7133620689655172,
"repo_name": "csadorf/signac",
"id": "6eea4e4b8ae049c03132a134e8718377fe54da0b",
"size": "2002"... |
from flask import Flask, request, make_response, render_template, redirect, session, url_for
import json
import os
import datetime
import config
import loader
import dbutils
mypseudo = Flask(__name__, static_folder="static", template_folder="templates")
mypseudo.debug = True
mypseudo.secret_key = os.urandom(24)
@myps... | {
"content_hash": "b5c66a1ae738a05555732fab5545580d",
"timestamp": "",
"source": "github",
"line_count": 72,
"max_line_length": 139,
"avg_line_length": 28.77777777777778,
"alnum_prop": 0.6906370656370656,
"repo_name": "wufufufu/mypseudo",
"id": "707b2e453382c9d94a65bcac7951ab05dae19a0a",
"size": "20... |
import os
import platform
import shutil
import behave
from test.behave_utils.utils import drop_database_if_exists, start_database_if_not_started,\
create_database, \
run_command, check_user_permissions, run_gpcommand
from steps.mi... | {
"content_hash": "2a74550ece233e9221eab3152eb5ae69",
"timestamp": "",
"source": "github",
"line_count": 163,
"max_line_length": 139,
"avg_line_length": 47.969325153374236,
"alnum_prop": 0.6568614912392889,
"repo_name": "ashwinstar/gpdb",
"id": "08ed9425f99adfc924566646b0a33b3d2b204c48",
"size": "78... |
from pysnmp.carrier.asynsock.dispatch import AsynsockDispatcher
from pysnmp.carrier.asynsock.dgram import udp, udp6
from pyasn1.codec.ber import decoder
from pysnmp.proto import api
from pysnmp.proto.rfc1902 import ObjectName
from urlparse import urlparse
from websocket import create_connection
import httplib
import ... | {
"content_hash": "eec391addb84153aa8d73bd4734bccdc",
"timestamp": "",
"source": "github",
"line_count": 302,
"max_line_length": 123,
"avg_line_length": 36.890728476821195,
"alnum_prop": 0.5285880980163361,
"repo_name": "HuaweiSNC/OPS2",
"id": "4066fa5d891ef5d30ab084adee2e9bc782e22945",
"size": "112... |
import usa.emissions
#import usa.food_sector
| {
"content_hash": "8fddf48c914179f960ec46bf6736f7a4",
"timestamp": "",
"source": "github",
"line_count": 2,
"max_line_length": 23,
"avg_line_length": 22.5,
"alnum_prop": 0.8222222222222222,
"repo_name": "sonya/eea",
"id": "5f0eb9ec576fa92ae7c28d8fd57425fa74196e27",
"size": "111",
"binary": false,
... |
import sys
import traceback
import copy
import listservers
import buckets
import info
import util_cli as util
import cb_bin_client
import stats_buffer
class StatsCollector:
def __init__(self, log):
self.log = log
def seg(self, k, v):
# Parse ('some_stat_x_y', 'v') into (('some_stat', x, y), ... | {
"content_hash": "e188e6ee86fae8c4c0ef547c1ee5248c",
"timestamp": "",
"source": "github",
"line_count": 228,
"max_line_length": 122,
"avg_line_length": 45.90350877192982,
"alnum_prop": 0.5320084081788649,
"repo_name": "TOTVS/mdmpublic",
"id": "874c3a215c6b317ccd317d5cbaae01fcbc7a039d",
"size": "105... |
import numpy as np
import cv2
cap = cv2.VideoCapture('media/video_test.avi')
while(cap.isOpened()):
ret, frame = cap.read()
print frame.shape
gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
cv2.imshow('frame', gray)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
cap.release()
cv2.destroyAllWin... | {
"content_hash": "53125d86db04b4c74459f26591c89907",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 50,
"avg_line_length": 21.866666666666667,
"alnum_prop": 0.6554878048780488,
"repo_name": "rajat1994/ComputerVisionSamples",
"id": "58ed9f502e24ad8555f44a211c55220868395c3c",... |
from plotly.basedatatypes import BaseLayoutHierarchyType as _BaseLayoutHierarchyType
import copy as _copy
class Minor(_BaseLayoutHierarchyType):
# class properties
# --------------------
_parent_path_str = "layout.xaxis"
_path_str = "layout.xaxis.minor"
_valid_props = {
"dtick",
"... | {
"content_hash": "94799236be5224d7b95844f6c155eeea",
"timestamp": "",
"source": "github",
"line_count": 723,
"max_line_length": 84,
"avg_line_length": 36.98755186721991,
"alnum_prop": 0.5510806970308877,
"repo_name": "plotly/plotly.py",
"id": "08ccaacfc71a66dd62c25c3e91b538e7ff46a9f5",
"size": "267... |
"""
Created on Sun Mar 5 10:27:24 2017
@author: mje
"""
import numpy as np
from sklearn.linear_model import LogisticRegression
from sklearn.model_selection import (permutation_test_score, StratifiedKFold)
from sklearn.externals import joblib
from my_settings import (data_path, source_folder, step_size, window_size)
... | {
"content_hash": "1b5030de3095e29d206a75a7cf7c175b",
"timestamp": "",
"source": "github",
"line_count": 78,
"max_line_length": 78,
"avg_line_length": 29.705128205128204,
"alnum_prop": 0.6340094950366854,
"repo_name": "MadsJensen/RP_scripts",
"id": "25e816582ef6abb09e1abfc178c6eeb64b606b4e",
"size":... |
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('Grundgeruest', '0004_ganzesmenue'),
]
operations = [
migrations.RemoveField(
model_name='ganzesmenue',
... | {
"content_hash": "d6b43d48cd233bce666e447e7ad99a6c",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 123,
"avg_line_length": 26.5,
"alnum_prop": 0.6132075471698113,
"repo_name": "wmles/scholarium",
"id": "ad21dad8d0c0c2f50db7d814b00a93570bcbc8e5",
"size": "709",
"binary"... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import random
import numpy as np
import tensorflow as tf
from tensorflow.contrib.learn.python import learn
from tensorflow.contrib.learn.python.learn import datasets
fr... | {
"content_hash": "6cb9e62f72240c71bd7a2a558c056915",
"timestamp": "",
"source": "github",
"line_count": 133,
"max_line_length": 88,
"avg_line_length": 40,
"alnum_prop": 0.656578947368421,
"repo_name": "peterbraden/tensorflow",
"id": "99c35f638db389a67decfd62b60395a1512afcaf",
"size": "5944",
"bin... |
from iris_sdk.models.maps.base_map import BaseMap
class FeatureDldaMap(BaseMap):
address = None
list_address = None
listing_name = None
listing_type = None
status = None
subscriber_type = None | {
"content_hash": "13f49043788ccc176a2fd33be323d9a5",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 49,
"avg_line_length": 21.8,
"alnum_prop": 0.6926605504587156,
"repo_name": "scottbarstow/iris-python",
"id": "516a8d945d23a5b77da3c92c6e49eede63edb360",
"size": "241",
"... |
"""The Tornado web server and tools."""
from __future__ import absolute_import, division, print_function, with_statement
# version is a human-readable version number.
# version_info is a four-tuple for programmatic comparison. The first
# three numbers are the components of the version number. The fourth
# is zero ... | {
"content_hash": "f173c718f348447882c7476d3044def2",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 80,
"avg_line_length": 40.53846153846154,
"alnum_prop": 0.7533206831119544,
"repo_name": "bdh1011/wau",
"id": "5588295e49e064b1c542aeca0ff94eb0178bd529",
"size": "1124",
... |
from google.cloud import functions_v2
async def sample_generate_upload_url():
# Create a client
client = functions_v2.FunctionServiceAsyncClient()
# Initialize request argument(s)
request = functions_v2.GenerateUploadUrlRequest(
parent="parent_value",
)
# Make the request
respons... | {
"content_hash": "4ebf17e6fcc10219a5882b2d67350816",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 75,
"avg_line_length": 26.210526315789473,
"alnum_prop": 0.7289156626506024,
"repo_name": "googleapis/python-functions",
"id": "e05b5f414a25597f36ffa3062daf9b6acd1373d9",
"... |
import abc
from typing import Awaitable, Callable, Dict, Optional, Sequence, Union
import pkg_resources
import google.auth # type: ignore
import google.api_core
from google.api_core import exceptions as core_exceptions
from google.api_core import gapic_v1
from google.api_core import retry as retries
from google.auth ... | {
"content_hash": "0d189fc1b69a9b96f5e74ae6d540dd0a",
"timestamp": "",
"source": "github",
"line_count": 190,
"max_line_length": 101,
"avg_line_length": 36.1578947368421,
"alnum_prop": 0.6119359534206695,
"repo_name": "googleapis/python-workflows",
"id": "fb5d62e01513c3553773a9d3dd30f99f462d0ebd",
"... |
import os
import re
import uuid
from flask import render_template, Blueprint, flash, \
redirect, url_for, current_app, abort, request, Response, make_response
import psycopg2
from flask.ext.babel import gettext as _
from flask.ext.login import login_required, current_user
from sqlalchemy.sql.expression import de... | {
"content_hash": "10eeaa309670bc509ee76a923e32ad83",
"timestamp": "",
"source": "github",
"line_count": 340,
"max_line_length": 155,
"avg_line_length": 36.08529411764706,
"alnum_prop": 0.6438177520580325,
"repo_name": "omniscale/gbi-server",
"id": "87bb41cf713c367247acaed8dd7b2937d89a50ec",
"size":... |
import fixtures
import six
from senlin.common import exception
from senlin.common.i18n import _
from senlin.tests.unit.common import base
class TestException(exception.SenlinException):
msg_fmt = _("Testing message %(text)s")
class TestSenlinException(base.SenlinTestCase):
def test_fatal_exception_error(s... | {
"content_hash": "650518236d43a7d5dd3bf59368d40ecd",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 69,
"avg_line_length": 29.583333333333332,
"alnum_prop": 0.7112676056338029,
"repo_name": "Alzon/senlin",
"id": "a9ae58158b0a3618bd874f17f2741f6e17e1c96e",
"size": "1260",
... |
"""
This module defines a few common generators for slicing over arrays.
They are defined on ndarray, so they do not depend on Image.
* data_generator: return (item, data[item]) tuples from an iterable object
* slice_generator: return slices through an ndarray, possibly over many
indices
* f_generator: return a gen... | {
"content_hash": "35a0e87ac271d2490986d254a803bbff",
"timestamp": "",
"source": "github",
"line_count": 250,
"max_line_length": 84,
"avg_line_length": 30.072,
"alnum_prop": 0.5497472732109604,
"repo_name": "arokem/nipy",
"id": "d762a7249c41ec1527a9b40c6aa3f461280ce054",
"size": "7632",
"binary": ... |
from cattr._compat import is_bare, is_py37, is_py38
if is_py37 or is_py38:
def change_type_param(cl, new_params):
if is_bare(cl):
return cl[new_params]
return cl.copy_with(new_params)
else:
def change_type_param(cl, new_params):
cl.__args__ = (new_params,)
return... | {
"content_hash": "94bd9edd8e2eb11f459faf12433c0539",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 51,
"avg_line_length": 21.6,
"alnum_prop": 0.5925925925925926,
"repo_name": "Tinche/cattrs",
"id": "92a00fcd294ecc1dee2f1d16f1cf7c40c6bf17e0",
"size": "324",
"binary": fa... |
from msrest.serialization import Model
class EventsResult(Model):
"""An event query result.
:param aimessages: OData messages for this response.
:type aimessages: list[~azure.applicationinsights.models.ErrorInfo]
:param value:
:type value: ~azure.applicationinsights.models.EventsResultData
""... | {
"content_hash": "03d7d4db05c62648d6e70172053f6532",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 73,
"avg_line_length": 32.333333333333336,
"alnum_prop": 0.6377025036818851,
"repo_name": "Azure/azure-sdk-for-python",
"id": "3c66e4efaf267749b131f085de0a7a794abf0d5b",
"s... |
from bambou import NURESTFetcher
class NUScheduledTestSuitesFetcher(NURESTFetcher):
""" Represents a NUScheduledTestSuites fetcher
Notes:
This fetcher enables to fetch NUScheduledTestSuite objects.
See:
bambou.NURESTFetcher
"""
@classmethod
def managed_class(... | {
"content_hash": "ebd51274115efc5e0f76d8c57fb25cf5",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 71,
"avg_line_length": 22.64,
"alnum_prop": 0.6431095406360424,
"repo_name": "nuagenetworks/vspk-python",
"id": "cb45a279293aee9cf7edfb8deefd80f4628b0802",
"size": "2177",
... |
import re
import urllib.parse, urllib.request
# Address of the login web page
captivePortailUrl = "https://portail-promologis-lan.insa-toulouse.fr"\
":8001"
# Perform the connection process
# return the disconnection token if the connection is succesful
def connect(username, password):
paramet... | {
"content_hash": "caf26035305f97636393f8e5032c5463",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 71,
"avg_line_length": 38.80357142857143,
"alnum_prop": 0.6336861481822366,
"repo_name": "remy-phelipot/PromoConnect",
"id": "34f3ae9fc7dac5cdfb74c24f000ff26dc9a4934a",
"si... |
"""Path related utilities."""
import os
import sys
from os.path import commonprefix, abspath, join, splitext
def sub_path(path, parent):
"""Returns the portion of ``path`` that lies under ``parent``"""
path = abspath(path)
parent = abspath(parent)
return path[len(commonprefix((path, parent))) + 1:]
... | {
"content_hash": "88c91e52f436a8518c314c0a4e532c51",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 77,
"avg_line_length": 27.288888888888888,
"alnum_prop": 0.5977198697068404,
"repo_name": "flupke/pyflu",
"id": "a4829e956e6a16efa0bfed3a60aa9661f4013f98",
"size": "1228",
... |
import sys
from inspect import getsourcefile
from os import path
CURRENT_DIR = path.dirname(path.abspath(getsourcefile(lambda: 0)))
sys.path.insert(0, CURRENT_DIR[: CURRENT_DIR.rfind(path.sep)])
import click # pylint: disable=wrong-import-position
from ghlint import config # pylint: disable=wrong-import-position
fr... | {
"content_hash": "3f4cd718f6cbed921d2cd389c824dc5d",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 66,
"avg_line_length": 23.59090909090909,
"alnum_prop": 0.7283236994219653,
"repo_name": "martinbuberl/ghlint",
"id": "f4725dab71f52ffad653ec06e31da53d72f282e2",
"size": "5... |
"""
WSGI config for nuremberg project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/howto/deployment/wsgi/
"""
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "nuremberg.settings")
from django.co... | {
"content_hash": "e789f92710f18b47f1da2e994ddad09a",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 78,
"avg_line_length": 28.071428571428573,
"alnum_prop": 0.7760814249363868,
"repo_name": "harvard-lil/nuremberg",
"id": "585f1a3326c1e30d6497f8a6517ad7a0dfc464fa",
"size":... |
n = int(raw_input())
res = 1
# Factorial in Python, easy because big integers :-P
for i in range(1,n+1):
res *= i
print res
| {
"content_hash": "05e9c5e8f8aad6f39674c58fc9a531cf",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 52,
"avg_line_length": 21.333333333333332,
"alnum_prop": 0.640625,
"repo_name": "zubie7a/CPP",
"id": "f24937bcd2d5688511d4a8d0c67f5318f335c0e2",
"size": "190",
"binary": f... |
from django.conf import settings
from django.core.files.storage import get_storage_class
import path
def getRoot():
"""Convenience to return the media root with forward slashes"""
storage = get_storage_class()()
root = storage.location.replace("\\", "/")
if not root.endswith("/"):
root += "/"... | {
"content_hash": "bc0313f47be795c0bed587f6d8d4d1fc",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 67,
"avg_line_length": 24.928571428571427,
"alnum_prop": 0.66189111747851,
"repo_name": "theiviaxx/Frog",
"id": "e0299191f7109e29510a56d85e2e9f70ccbcdf66",
"size": "1634",
... |
from common import * # NOQA
from cattle import ApiError
SERVICE_KIND = 'kubernetesService'
def from_context(context):
return context.client, context.agent_client, context.host
def test_bad_agent(super_client, new_context):
_, account, agent_client = register_simulated_host(new_context,
... | {
"content_hash": "eedf9e28f34aa91bc2ee178473ee24ba",
"timestamp": "",
"source": "github",
"line_count": 314,
"max_line_length": 75,
"avg_line_length": 30.671974522292995,
"alnum_prop": 0.6037794621534628,
"repo_name": "vincent99/cattle",
"id": "eb0c75d857ad7283ce33ca0419890878a5d60a55",
"size": "96... |
import os
import urllib
import re
from flask import Blueprint, request, Response, abort
from flask_negotiate import consumes
from flask.ext.cors import cross_origin
import settings
from model.utils import Utils
from model.loader import PluginLoader
slack = Blueprint('slack', __name__, url_prefix='/api/slack')
@sla... | {
"content_hash": "7d9bd4c6504238eaa1a00e51c7124c45",
"timestamp": "",
"source": "github",
"line_count": 70,
"max_line_length": 93,
"avg_line_length": 30.285714285714285,
"alnum_prop": 0.6264150943396226,
"repo_name": "supistar/Botnyan",
"id": "8722de76b3202d5beb2a3385581b3d3465c55731",
"size": "214... |
from __future__ import absolute_import
from django import http
from django.test.utils import override_settings
from django.utils.translation import ugettext_lazy as _
from mox3.mox import IsA # noqa
from horizon import exceptions
from openstack_dashboard import api
from openstack_dashboard.api import cinder
from ope... | {
"content_hash": "d2e72e96744bc976a6ebe7263a658469",
"timestamp": "",
"source": "github",
"line_count": 383,
"max_line_length": 78,
"avg_line_length": 48.81201044386423,
"alnum_prop": 0.5451190157796202,
"repo_name": "bac/horizon",
"id": "25ea0a9cd3434f52d2ea64a16e5718c98ac34dde",
"size": "19521",
... |
from bokeh.io import show
from bokeh.models import CustomJS, Select
select = Select(title="Option:", value="foo", options=["foo", "bar", "baz", "quux"])
select.js_on_change("value", CustomJS(code="""
console.log('select: value=' + this.value, this.toString())
"""))
show(select)
| {
"content_hash": "a1c48e6c254ef712b510201430c19208",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 84,
"avg_line_length": 31.666666666666668,
"alnum_prop": 0.6736842105263158,
"repo_name": "bokeh/bokeh",
"id": "49aae60730032dfed26c384687ef7ceca6c17767",
"size": "285",
"... |
import os
import sys
from setuptools import setup
settings = dict()
# Publish
if sys.argv[-1] == 'publish':
os.system('python setup.py sdist upload')
sys.exit()
settings.update(
name='django-heroku-mongoify',
version='0.2.0',
description='Friendly MongoDB for Django on Heroku',
long_descript... | {
"content_hash": "9a83ffe3631ab42894bb7fb54a23d6b1",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 71,
"avg_line_length": 32.06976744186046,
"alnum_prop": 0.625090645395214,
"repo_name": "dirn/django-heroku-mongoify",
"id": "9fd32750b2b0ff074c09546d61b0ee7d900bbada",
"si... |
import html.entities
import re
import unicodedata
from gzip import GzipFile
from io import BytesIO
from django.utils.encoding import force_text
from django.utils.functional import (
SimpleLazyObject, keep_lazy, keep_lazy_text, lazy,
)
from django.utils.safestring import SafeText, mark_safe
from django.utils.transl... | {
"content_hash": "dd488ce60f784b9b92b7e7d57ec02848",
"timestamp": "",
"source": "github",
"line_count": 437,
"max_line_length": 90,
"avg_line_length": 32.86270022883295,
"alnum_prop": 0.5504491330687278,
"repo_name": "mjtamlyn/django",
"id": "0336b3fe795d9eb857413eaf35109a28b8bc9e77",
"size": "1436... |
"""
Logging package for Python. Based on PEP 282 and comments thereto in
comp.lang.python, and influenced by Apache's log4j system.
Should work under Python versions >= 1.5.2, except that source line
information is not available unless 'sys._getframe()' is.
Copyright (C) 2001-2007 Vinay Sajip. All Rights Res... | {
"content_hash": "22f1064fa597b2ce2c95b2c4bed21940",
"timestamp": "",
"source": "github",
"line_count": 1357,
"max_line_length": 93,
"avg_line_length": 35.01473839351511,
"alnum_prop": 0.5617804903714616,
"repo_name": "ericlink/adms-server",
"id": "a07f5fa41e5893d649984c488f9e28130df98760",
"size":... |
"""
Multiple concurrent notifications
+++++++++++++++++++++++++++++++++
Send multiple SNMP notifications at once using the following options:
* SNMPv2c and SNMPv3
* with community name 'public'
* over IPv4/UDP
* send INFORM notification
* to multiple Managers
* with TRAP ID 'coldStart' specified as a MIB symbol
* inc... | {
"content_hash": "b15e3285d95496199bcc426328909b18",
"timestamp": "",
"source": "github",
"line_count": 60,
"max_line_length": 110,
"avg_line_length": 32.56666666666667,
"alnum_prop": 0.6581371545547595,
"repo_name": "filippog/pysnmp",
"id": "5dfdfdbc17469344f30005d6dd85ed0cfaf9f5a9",
"size": "1954... |
from django.shortcuts import render
import logging
logger = logging.getLogger(__name__)
def index(request):
return render(request, 'home/index.html', {}) | {
"content_hash": "16f8c5dd5ad702ab4cb67164b914bcd4",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 46,
"avg_line_length": 22.285714285714285,
"alnum_prop": 0.75,
"repo_name": "aldencolerain/boringmanclan",
"id": "60d45af86a161b9b5f2fc33df855bbe19d5ba58c",
"size": "156",
... |
import requests
from flexbe_core import EventState, Logger
"""
Created on 17/05/2018
@author: Lucas Maurice
"""
class WonderlandPatchPerson(EventState):
'''
Patch (update) a person.
># entity sara_msgs/Entity the entity
<= done return when the add correctly ... | {
"content_hash": "e59ada85668c1ebdfc455b8ad1d46a7b",
"timestamp": "",
"source": "github",
"line_count": 92,
"max_line_length": 108,
"avg_line_length": 31.880434782608695,
"alnum_prop": 0.5789294237981589,
"repo_name": "WalkingMachine/sara_behaviors",
"id": "9cc33722be21f4a63decc77b57a7f5aeabd29bf2",
... |
import os
from types import ModuleType
from .bdist import BDist
from .develop import Develop
from .installed import Installed
from .sdist import SDist
from .wheel import Wheel
def get_metadata(path_or_module, metadata_version=None):
""" Try to create a Distribution 'path_or_module'.
o 'path_or_module' may be... | {
"content_hash": "b2e3c5dda67d1c0e2a515227e05f5a23",
"timestamp": "",
"source": "github",
"line_count": 62,
"max_line_length": 71,
"avg_line_length": 28.806451612903224,
"alnum_prop": 0.6142217245240762,
"repo_name": "sonntagsgesicht/regtest",
"id": "306630ab3c8e3c03b911d6e4ef7c720fb3bce19a",
"size... |
import vim
from sys import version_info
import re
from os.path import abspath, basename, dirname, expanduser, splitext, isfile, relpath, exists, join
from os import remove, mkdir
from shutil import move
from glob import glob
from .timestamps import timestamp
from .vim_interface import *
from .modelines import format_m... | {
"content_hash": "868e78ff83639f907104a65a7926a5b1",
"timestamp": "",
"source": "github",
"line_count": 167,
"max_line_length": 99,
"avg_line_length": 34.47904191616767,
"alnum_prop": 0.5078152136158388,
"repo_name": "fmoralesc/vim-pad",
"id": "6d68b3df662d2559afd1b67719db2682fb4348ac",
"size": "57... |
from datetime import datetime
from flask_restless import APIManager
from keepmydevices import app, db
from models import Device, User
from flask_jwt import JWT, jwt_required
from werkzeug.security import check_password_hash
from flask import request, json, abort, jsonify
def authenticate(username, password):
us... | {
"content_hash": "1c32703571c4b12a2e344b8be5732b34",
"timestamp": "",
"source": "github",
"line_count": 74,
"max_line_length": 95,
"avg_line_length": 31.513513513513512,
"alnum_prop": 0.5913379073756432,
"repo_name": "MiloJiang/KeepMyDevices",
"id": "be8660a2564d6f4056dfcf5229301acd41743703",
"size... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
from configurable import Configurable
from bucket import Bucket
#***************************************************************
class Metabucket(Configurable):
""""""
#=============... | {
"content_hash": "93a27b9b348b76673ff7c4e340305b04",
"timestamp": "",
"source": "github",
"line_count": 80,
"max_line_length": 92,
"avg_line_length": 28.1125,
"alnum_prop": 0.48421520675855934,
"repo_name": "Northeaster/TargetSentimentAnalysis",
"id": "cf086318523253eb11ce1bd444ce877d9b558d63",
"si... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.