text stringlengths 4 1.02M | meta dict |
|---|---|
import unittest
from airflow import configuration
from airflow.utils import db
from airflow import models
try:
from unittest import mock
except ImportError:
try:
import mock
except ImportError:
mock = None
from airflow.contrib.hooks.ssh_hook import SSHHook
HELLO_SERVER_CMD = """
import s... | {
"content_hash": "764779fe11e9c41739c98af62c0410a9",
"timestamp": "",
"source": "github",
"line_count": 159,
"max_line_length": 87,
"avg_line_length": 37.125786163522015,
"alnum_prop": 0.4846688124682365,
"repo_name": "gtoonstra/airflow",
"id": "ad5621fe92357d189aed293cd6f4e25b3b3bad6f",
"size": "6... |
import six
import os
import time
import itertools
import tempfile
import requests
from quantrocket.master import download_master_file
from quantrocket.exceptions import ParameterError, NoHistoricalData, NoRealtimeData
from quantrocket.history import (
download_history_file,
get_db_config as get_history_db_confi... | {
"content_hash": "4cb41587a597bc8350735084b95bb890",
"timestamp": "",
"source": "github",
"line_count": 729,
"max_line_length": 118,
"avg_line_length": 40.344307270233195,
"alnum_prop": 0.6277923226003876,
"repo_name": "quantrocket-llc/quantrocket-client",
"id": "90c33a31d27924d0d336beb06e3281183729e... |
"""Aruba OS support"""
from __future__ import unicode_literals
import time
import re
from netmiko.cisco_base_connection import CiscoSSHConnection
class ArubaSSH(CiscoSSHConnection):
"""Aruba OS support"""
def session_preparation(self):
"""Aruba OS requires enable mode to disable paging."""
del... | {
"content_hash": "0b3cbfdfa1a7800db88e871b85afe5ee",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 81,
"avg_line_length": 36.064516129032256,
"alnum_prop": 0.610912343470483,
"repo_name": "fooelisa/netmiko",
"id": "98e929b2998e41b26888a7233cabedaf9dfe9067",
"size": "1118... |
"""Common code for working with ceph object stores
"""
from keystoneauth1 import exceptions
from oslo_config import cfg
from oslo_log import log
from oslo_utils import timeutils
import six.moves.urllib.parse as urlparse
from ceilometer.agent import plugin_base
from ceilometer import keystone_client
from ceilometer im... | {
"content_hash": "65b4bf8199d54a6b7ccff61e91891f12",
"timestamp": "",
"source": "github",
"line_count": 203,
"max_line_length": 79,
"avg_line_length": 36.49261083743843,
"alnum_prop": 0.5437365010799136,
"repo_name": "idegtiarov/ceilometer",
"id": "e3ef290c7b3d54499b8ca49e24c47bfbe7d33242",
"size":... |
from __future__ import unicode_literals
import ckeditor_uploader.fields
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_USE... | {
"content_hash": "530f825d4563e46810179e8da3432150",
"timestamp": "",
"source": "github",
"line_count": 64,
"max_line_length": 136,
"avg_line_length": 41.390625,
"alnum_prop": 0.5587013967534918,
"repo_name": "aodarc/tennis_club",
"id": "362c0b45260848fb6ba8b5cee4d891ae00967f5f",
"size": "2837",
... |
from .base import SimSootExpr
class SimSootExpr_InstanceFieldRef(SimSootExpr):
def _execute(self):
field_ref = self._translate_value(self.expr)
self.expr = self.state.memory.load(field_ref, none_if_missing=True)
| {
"content_hash": "5d196bdfe8a425373bcc3e49728965ac",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 75,
"avg_line_length": 33.42857142857143,
"alnum_prop": 0.717948717948718,
"repo_name": "iamahuman/angr",
"id": "b42d9c2f5faec2148a6f6c40dd553e2b255e42e0",
"size": "235",
... |
"""Setuptools setup script for the package."""
from setuptools import setup
def _get_version():
# pylint: disable=missing-docstring
with open(".version") as version:
return version.read().rstrip("\n")
setup(
name="mock-open",
version=_get_version(),
description="A better mock for file I/... | {
"content_hash": "745af48593e4939bcb7a85cdba63e723",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 71,
"avg_line_length": 28.903846153846153,
"alnum_prop": 0.5635395874916833,
"repo_name": "janusnic/mock-open",
"id": "359a34b5a281afed7d47025f1f1f15243816a68f",
"size": "1... |
"""Optimizer that implements cross-shard gradient reduction for TPU."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.python.framework import ops
from tensorflow.python.keras.optimizer_v2 import optimizer_v2
from tensorflow.python.ops.los... | {
"content_hash": "95cb5efc5854f90329caa1ac4ce98fed",
"timestamp": "",
"source": "github",
"line_count": 209,
"max_line_length": 80,
"avg_line_length": 39.038277511961724,
"alnum_prop": 0.673489398210565,
"repo_name": "xzturn/tensorflow",
"id": "e233bbb007c79b01d88374cdcfc3333c16d72c67",
"size": "88... |
from scipy import misc
from skimage import color
import numpy as np
import os
import random
import pickle
import som as mySom
patch_sizes = [ [5,5] ] #to be generated, sizes must be odd
directoryData = 'dataset/Opencountry' #raw data
som_sizes = [[3,3]] #soms to use
patches_per_img = 10000
def createDa... | {
"content_hash": "4e71db821ab898609ae47617f5566936",
"timestamp": "",
"source": "github",
"line_count": 110,
"max_line_length": 165,
"avg_line_length": 39.21818181818182,
"alnum_prop": 0.507185906351414,
"repo_name": "mrichart/NNcoloring",
"id": "8d1d2d4e2c8df3998a19c4b0340242263b4caba9",
"size": "... |
import unittest
from conans import tools
from conans.test.utils.tools import TestServer, TestClient
from conans.paths import CONANFILE
from conans.util.files import save
from conans.model.ref import ConanFileReference
import os
conan_content = """
from conans import ConanFile
class OpenSSLConan(ConanFile):
name ... | {
"content_hash": "aacbbe12b7631266231ecb42f6113820",
"timestamp": "",
"source": "github",
"line_count": 97,
"max_line_length": 101,
"avg_line_length": 48.68041237113402,
"alnum_prop": 0.5789919525624735,
"repo_name": "tivek/conan",
"id": "bb21405f8af204b504ff0eb0d323c138b46f19c9",
"size": "4722",
... |
__all__ = ['']
#make core available on flat import
from .core import *
#verbose flags for the entire module
_verbose = False
def getVerbose(verbose=None):
"""resolve verbose flag, using module settings if verbose=None"""
global _verbose
if verbose is None:
return _verbose
_verbose = verbose
return verbose
| {
"content_hash": "7385942c9115092ba4f16fb3d60dad77",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 66,
"avg_line_length": 21.133333333333333,
"alnum_prop": 0.7255520504731862,
"repo_name": "PMBio/limix",
"id": "14799bced5fcbd549233f1defa8fcd7044314862",
"size": "956",
... |
'''
New Integration Test for creating volume under PS maintain mode.
@author: SyZhao
'''
import zstackwoodpecker.test_util as test_util
import zstackwoodpecker.test_lib as test_lib
import zstackwoodpecker.test_state as test_state
import zstackwoodpecker.operations.primarystorage_operations as ps_ops
import zs... | {
"content_hash": "60021ad45bfd5cebf27294bc34193398",
"timestamp": "",
"source": "github",
"line_count": 106,
"max_line_length": 98,
"avg_line_length": 34.009433962264154,
"alnum_prop": 0.6618585298196948,
"repo_name": "zstackio/zstack-woodpecker",
"id": "d195cc877d2bfc71054b54fe45dc45f4970a907d",
"... |
"""Exports a convolutional feature extractor for MNIST in SavedModel format.
The feature extractor is a convolutional neural network plus a hidden layer
that gets trained as part of an MNIST classifier and then written to a
SavedModel (without the classification layer). From there, use_mnist_cnn.py
picks it up for tra... | {
"content_hash": "bb2aa765c5fc3a64e5fe1e477601c7ce",
"timestamp": "",
"source": "github",
"line_count": 175,
"max_line_length": 79,
"avg_line_length": 42.52,
"alnum_prop": 0.6706087891412444,
"repo_name": "ageron/tensorflow",
"id": "7c1a356e661dd1917414cb3846db8ab994d8f843",
"size": "8130",
"bina... |
import os
from twisted.internet import stdio as twistedStdio
from twisted.protocols.basic import LineReceiver
from src.shared.logconfig import newLogger
log = newLogger(__name__)
def setupStdio(backend):
twistedStdio.StandardIO(StdioHandler(backend))
class StdioHandler(LineReceiver):
# The default delimi... | {
"content_hash": "15021490096b664b8f5cf0836ed2b906",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 79,
"avg_line_length": 28.256410256410255,
"alnum_prop": 0.6860254083484574,
"repo_name": "CheeseLord/warts",
"id": "cf5c127691acfa4ed795a9a775ec618182412717",
"size": "110... |
from __future__ import absolute_import
from chaco.abstract_overlay import AbstractOverlay
from traits.trait_types import List
# ============= standard library imports ========================
# ============= local library imports ==========================
from pychron.spectrometer.graph.marker_line import MarkerLine
... | {
"content_hash": "eb426969b7be83ca4562d0148f7cfd23",
"timestamp": "",
"source": "github",
"line_count": 46,
"max_line_length": 76,
"avg_line_length": 37.5,
"alnum_prop": 0.5176811594202898,
"repo_name": "UManPychron/pychron",
"id": "8088c629a2d3270226d9fbcd83cc59b84d1dfc5c",
"size": "2525",
"bina... |
"""
Constants: Machine Settings Info
---------------------------------
Specific constants relating to the retrieval of machine settings information to be used in
``PyLHC``, to help with consistency.
"""
from pylhc.constants.general import TFS_SUFFIX
# TFS-File Conventions #############################################... | {
"content_hash": "5a291d1c5ebf093e8ce4ce502e8b0367",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 90,
"avg_line_length": 27.5,
"alnum_prop": 0.679144385026738,
"repo_name": "pylhc/PyLHC",
"id": "acd637894553e8d62bca3a0baa42c7148c7a7c6b",
"size": "935",
"binary": false... |
"""Converts GitHub flavored markdown changelogs to release notes.
"""
import argparse
import re
import subprocess
import string
import six
NO_HEADING = 'PRODUCT HAS NO HEADING'
PRODUCTS = {
'FirebaseABTesting/CHANGELOG.md': '{{ab_testing}}',
'FirebaseAppCheck/CHANGELOG.md': 'App Check',
'FirebaseAppDis... | {
"content_hash": "6c5e3ffebd1ea5fdeff75248063632a4",
"timestamp": "",
"source": "github",
"line_count": 278,
"max_line_length": 79,
"avg_line_length": 26.949640287769785,
"alnum_prop": 0.6014415376401495,
"repo_name": "firebase/firebase-ios-sdk",
"id": "8056b17bcb975133c09441d4344dc52451b89ba0",
"s... |
from datetime import datetime
import graphene
from graphene_django.filter import DjangoFilterConnectionField
from app.timetables.models import ServingAutoUpdate, Timetable, Vendor
from .cruds.dish_crud import (DishNode, CreateDish, UpdateDish, DeleteDish,
DishFilter,)
from .cruds.event_... | {
"content_hash": "eade30076221cb2f0769aa4e99e473ab",
"timestamp": "",
"source": "github",
"line_count": 83,
"max_line_length": 92,
"avg_line_length": 38.21686746987952,
"alnum_prop": 0.7049180327868853,
"repo_name": "teamtaverna/core",
"id": "2bd8b5ef8b9299a2c41de384aff426a843053ca9",
"size": "3172... |
"""Tests for distutils.file_util."""
import unittest
import os
import shutil
from distutils.file_util import move_file, write_file, copy_file
from distutils import log
from distutils.tests import support
class FileUtilTestCase(support.TempdirManager, unittest.TestCase):
def _log(self, msg, *args):
if len... | {
"content_hash": "5d576dbfa925e19f309620319b76ff89",
"timestamp": "",
"source": "github",
"line_count": 80,
"max_line_length": 69,
"avg_line_length": 30.6625,
"alnum_prop": 0.5886669384427232,
"repo_name": "xxd3vin/spp-sdk",
"id": "dbc62839817f6e8324cdad64e33bdcc20fddb133",
"size": "2453",
"binar... |
from django.db import models
from django.contrib import admin
from django.utils.translation import ugettext as _
from koalixcrm.crm.reporting.resource_price import ResourcePrice
class Estimation(models.Model):
task = models.ForeignKey("Task",
verbose_name=_('Task'),
... | {
"content_hash": "2af792f6d931949d4e6e9b1ba38f5972",
"timestamp": "",
"source": "github",
"line_count": 65,
"max_line_length": 115,
"avg_line_length": 38.815384615384616,
"alnum_prop": 0.4803804994054697,
"repo_name": "dario61081/koalixcrm",
"id": "68daa1bd89eaf49036adae1756a708831e586b1b",
"size":... |
"""Fetch some events from github and put them on a page."""
from __future__ import print_function, division
import sys
import os
import json
import shutil
from datetime import datetime
import requests
from jinja2 import Template
from flask import Flask
app = Flask(__name__)
USERS_FILE = "users.txt"
TEMPLATE_DIR = ... | {
"content_hash": "4e0229caecb62223d3817753ce6823aa",
"timestamp": "",
"source": "github",
"line_count": 456,
"max_line_length": 79,
"avg_line_length": 29.82236842105263,
"alnum_prop": 0.5656298257224796,
"repo_name": "kbarbary/ghdash",
"id": "666683a65ecb1799ed225334428f80fb46945ff0",
"size": "1362... |
"""
Support the sensor of a BloomSky weather station.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/sensor.bloomsky/
"""
import logging
from homeassistant.const import TEMP_FAHRENHEIT
from homeassistant.helpers.entity import Entity
from homeassistant.... | {
"content_hash": "22532199a995a7ff5cd5cd831a5824a3",
"timestamp": "",
"source": "github",
"line_count": 93,
"max_line_length": 79,
"avg_line_length": 32.086021505376344,
"alnum_prop": 0.599195710455764,
"repo_name": "emilhetty/home-assistant",
"id": "a9d2c0c6631c7f9c2cc8fbafd9e54b88d1fa2dc1",
"size... |
"""Constants for the Harmony component."""
DOMAIN = "harmony"
SERVICE_SYNC = "sync"
SERVICE_CHANGE_CHANNEL = "change_channel"
PLATFORMS = ["remote"]
UNIQUE_ID = "unique_id"
ACTIVITY_POWER_OFF = "PowerOff"
HARMONY_OPTIONS_UPDATE = "harmony_options_update"
ATTR_ACTIVITY_LIST = "activity_list"
ATTR_DEVICES_LIST = "devices... | {
"content_hash": "822f02fa40b3a5d27ba639d44c07bac4",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 53,
"avg_line_length": 36.142857142857146,
"alnum_prop": 0.7569169960474308,
"repo_name": "sdague/home-assistant",
"id": "f6315b57b57a498337adeae8763ff0e2ba1340b9",
"size":... |
import re
from datetime import datetime
from flask_sqlalchemy import SQLAlchemy
from sqlalchemy.event import listens_for
from cachetools import TTLCache, cached
db = SQLAlchemy()
class Message(db.Model):
__tablename__ = "messages"
timestamp = db.Column(db.Integer, primary_key=True)
timestamp_order = db.C... | {
"content_hash": "db89a431a5c462c4c7541f03a416a6b6",
"timestamp": "",
"source": "github",
"line_count": 104,
"max_line_length": 261,
"avg_line_length": 51.14423076923077,
"alnum_prop": 0.6939274299680391,
"repo_name": "Uberi/botty-bot-bot-bot",
"id": "d553fd75caeb658dadb483060fc7621fcf83331c",
"siz... |
import os
import json
from collections import defaultdict
try:
from . import shared as G
from . import utils
except (ImportError, ValueError):
import shared as G
import utils
def rename_floobits_dir():
# TODO: one day this can be removed (once all our users have updated)
old_colab_dir = os.pa... | {
"content_hash": "0190f7d06bb6e080e22fd26db504a4f7",
"timestamp": "",
"source": "github",
"line_count": 68,
"max_line_length": 112,
"avg_line_length": 33.30882352941177,
"alnum_prop": 0.5849889624724062,
"repo_name": "Floobits/floobits-neovim-old",
"id": "33f1df76a5475fbc970b0f597bf6ef5f21174e10",
... |
import os
import yaml
with open('/etc/rpc_deploy.OLD/rpc_environment.yml', 'r') as f:
rpc_environment = yaml.safe_load(f.read())
for root, _, files in os.walk('/etc/openstack_deploy/env.d'):
for item in files:
env_file = os.path.join(root, item)
with open(env_file, 'r') as f:
os_en... | {
"content_hash": "bbf91a677d464dfacfd3e484dcfc2a48",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 63,
"avg_line_length": 30.0625,
"alnum_prop": 0.4857934857934858,
"repo_name": "VaneCloud/openstack-ansible",
"id": "e1daf31b4f28a9eaf91d7648112d9b6021cdaebb",
"size": "204... |
import yaml
def create_bgp_peer(host, scope, ip, asNum, metadata=None):
assert scope in ('node', 'global')
testdata = {
'apiVersion': 'projectcalico.org/v3',
'kind': 'BGPPeer',
'metadata': {
'name': host.name,
},
'spec': {
'peerIP': ip,
... | {
"content_hash": "7b178c40776264bb5f9ba9699c775e0c",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 59,
"avg_line_length": 28.041666666666668,
"alnum_prop": 0.5482912332838039,
"repo_name": "gunjan5/calico",
"id": "16c03492facfe90a75e3beb33697cf2f661816cd",
"size": "1279"... |
import json
import threading
from oslo_log import log as oslo_logging
import pbr.version
import requests
import six
_UPDATE_CHECK_URL = 'https://www.cloudbase.it/checkupdates.php?p={0}&v={1}'
_PRODUCT_NAME = 'Cloudbase-Init'
LOG = oslo_logging.getLogger(__name__)
def _read_url(url):
# Disable certificate verif... | {
"content_hash": "039590d3fe6ca680cf2d57a28e9cfe8e",
"timestamp": "",
"source": "github",
"line_count": 59,
"max_line_length": 75,
"avg_line_length": 28.10169491525424,
"alnum_prop": 0.6531966224366706,
"repo_name": "ader1990/cloudbase-init",
"id": "025ceb85e04bd751da6f020bb589e7b007bcc829",
"size"... |
import socket
import sys
from pydhcplib. dhcp_packet import DhcpPacket
from random import Random
from pydhcplib.type_ipv4 import ipv4
import time
hl = {}
for i in range(0,120):
hl[i] = 0
#print hl
r = Random()
r.seed()
#time.sleep(1)
def genNum():
i = []
for z in xrange(6):
i.append(r.randint(0,255))
return '... | {
"content_hash": "4431509b082bb48af6008368018022f9",
"timestamp": "",
"source": "github",
"line_count": 83,
"max_line_length": 74,
"avg_line_length": 22.85542168674699,
"alnum_prop": 0.6536636794939378,
"repo_name": "schneor13/nodejs-dhcp-server",
"id": "1a9dbc245ca10af61a37db2d6fb6a4021b0c2de7",
"... |
import csv
import pandas as pd
import sys
def main():
output_file = sys.argv[1]
input_file = sys.argv[2]
target_name = sys.argv[3]
model_name = sys.argv[4]
data = pd.read_csv(input_file)
train = data[data["is_test"] == False]
test = data[data["is_test"] == True]
classes_list = lis... | {
"content_hash": "f3f7048ad7fba3248ee66745b0b5c13c",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 85,
"avg_line_length": 31.53846153846154,
"alnum_prop": 0.616260162601626,
"repo_name": "JuliaPackageMirrors/MachineLearning.jl",
"id": "c6d5c9d6fe473cdad64a6188f71244aedd727... |
from brain import Brain, ToyBrain
import tensorflow as tf
from bot import Bot
import numpy
import os
class TFBrain(Brain):
DUALCOPYFREQ = 1000
SESS = None
WRITER = None
MERGER = None
SESS_HOLDERS = 0
# https://stats.stackexchange.com/questions/200006/q-learning-with-neural-network-as-functio... | {
"content_hash": "e6e41e80128715261ad187656e94ed13",
"timestamp": "",
"source": "github",
"line_count": 216,
"max_line_length": 119,
"avg_line_length": 39.80555555555556,
"alnum_prop": 0.5758315887415678,
"repo_name": "Renmusxd/RSwarm",
"id": "0303e318677bc53f7adf66cf196225f7d75b4804",
"size": "859... |
import inspect
import json
import multiprocessing
import os
import pprint
import re
import traceback
import warnings
from datetime import datetime
from time import sleep
import znc
# noinspection PyPep8Naming
class zlog_sql(znc.Module):
description = 'Logs all channels to a MySQL/SQLite database.'
module_typ... | {
"content_hash": "8e9eeefae39c8bb2cefb578f0f7067e7",
"timestamp": "",
"source": "github",
"line_count": 529,
"max_line_length": 119,
"avg_line_length": 33.332703213610586,
"alnum_prop": 0.5438099018885045,
"repo_name": "stil/zlog-sql",
"id": "0a102123fab49ffb17e90494a24f32fe313a6915",
"size": "1763... |
from typing import Callable, Dict, Optional, Sequence, Tuple, Union
import warnings
from google.api_core import gapic_v1, grpc_helpers
import google.auth # type: ignore
from google.auth import credentials as ga_credentials # type: ignore
from google.auth.transport.grpc import SslCredentials # type: ignore
import gr... | {
"content_hash": "120f27a71b27f9a42e7769c87d193e7c",
"timestamp": "",
"source": "github",
"line_count": 254,
"max_line_length": 88,
"avg_line_length": 44.681102362204726,
"alnum_prop": 0.6105383734249714,
"repo_name": "googleapis/python-service-directory",
"id": "965a4db1bc1decb8f9a3fa791e4efe3d76dc6... |
from __future__ import unicode_literals
import django.contrib.postgres.fields.jsonb
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('contentcuration', '0001_squashed_0094_auto_20180910_2342'),
]
operations = [
migrations.AddField(
mo... | {
"content_hash": "b865729fc1f6460bf39e79d1b376782a",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 79,
"avg_line_length": 25.31578947368421,
"alnum_prop": 0.6548856548856549,
"repo_name": "fle-internal/content-curation",
"id": "919b892d9f98aa3bed1bde685f826457302db963",
... |
from graphql.core.language.location import SourceLocation
from graphql.core.validation.rules import LoneAnonymousOperation
from utils import expect_passes_rule, expect_fails_rule
def anon_not_alone(line, column):
return {
'message': LoneAnonymousOperation.anonymous_operation_not_alone_message(),
'... | {
"content_hash": "467b2f8d99a1857a16d54e2fd79e2047",
"timestamp": "",
"source": "github",
"line_count": 76,
"max_line_length": 82,
"avg_line_length": 19.092105263157894,
"alnum_prop": 0.5761543762922122,
"repo_name": "gabriel-laet/graphql-py",
"id": "a9b74885da26b7129b2108433789adf26caad5a7",
"size... |
"""
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLICATION`` setting.
Usually you will have th... | {
"content_hash": "a67a1fe1fd12378ec7723bac9c243b88",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 89,
"avg_line_length": 38.361702127659576,
"alnum_prop": 0.7398779811425402,
"repo_name": "EarthSystemCoG/COG",
"id": "27733709cefe5dac3096b5ba8ebf3f4b04b43713",
"size": "1... |
import abc
import itertools
from neutron_lib import constants as const
from neutron_lib.db import constants as db_const
from neutron_lib.utils import net
from oslo_serialization import jsonutils
from neutron.common import constants
from neutron.objects import common_types
from neutron.tests import base as test_base
f... | {
"content_hash": "f6a15093d18309c8b5cb7166490583e9",
"timestamp": "",
"source": "github",
"line_count": 272,
"max_line_length": 79,
"avg_line_length": 40.7389705882353,
"alnum_prop": 0.6017507445176428,
"repo_name": "noironetworks/neutron",
"id": "e3587b6ed89d25bd086e61eeb6c57d788533f294",
"size": ... |
from flask_sqlalchemy import SQLAlchemy
from flask_bcrypt import Bcrypt
db = SQLAlchemy()
bcrypt = Bcrypt()
| {
"content_hash": "e651a41bfcf7b71342b8998a62fd6e95",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 39,
"avg_line_length": 21.8,
"alnum_prop": 0.7889908256880734,
"repo_name": "soasme/flask-perm",
"id": "d30bee83d7b7c1f8c063ebf1b7207cd0189186e8",
"size": "134",
"binary":... |
from django.contrib import admin, messages
from django.contrib.sites.requests import RequestSite
from django.contrib.sites.models import Site
from django.utils.translation import ugettext_lazy as _
from registration.models import RegistrationProfile
class RawMixin(object):
def formfield_for_dbfield(self, db_field, ... | {
"content_hash": "177d0b7ae36f89248ccf39a8809f68a3",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 76,
"avg_line_length": 38.80952380952381,
"alnum_prop": 0.7220858895705522,
"repo_name": "chriscauley/django-registration",
"id": "119854a99fcce10c838ffed80997dff625abb231",
... |
"""
Resource class and its manager for LBaaS backend members in Networking V2 API
"""
from osclient2 import base
from osclient2 import mapper
from osclient2 import utils
ATTRIBUTE_MAPPING = [
('id', 'id', mapper.Noop),
('address', 'address', mapper.Noop),
('protocol_port', 'protocol_port', mapper.Noop),
... | {
"content_hash": "5aa5eaff8af80aabbd177535d6bf60d4",
"timestamp": "",
"source": "github",
"line_count": 69,
"max_line_length": 77,
"avg_line_length": 33.21739130434783,
"alnum_prop": 0.5885689354275742,
"repo_name": "yosshy/osclient2",
"id": "427ae8be502ff9f3fb3ade4643f700911a8f1203",
"size": "2959... |
from django.db import models
from django.contrib.auth.models import User
# Create your models here.
class UserProfile(models.Model):
user = models.OneToOneField(User)
display_name = models.CharField(max_length=128)
can_direct_edit = models.BooleanField(default=False)
def __unicode__(self):
ret... | {
"content_hash": "ef4cef36a3205ba6b632b02beef6257b",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 56,
"avg_line_length": 31.181818181818183,
"alnum_prop": 0.7346938775510204,
"repo_name": "AndrewRook/game_designer",
"id": "ccad7a6020ae6c55624e30176804fd4ae4299ccc",
"siz... |
"""Discrete distribution used for nonparametric functions."""
import math
from distributions.distribution import Distribution
class NumericDistribution(Distribution):
"""Class representing a discretization of a distribution, which is
required after certain mathematical operations (eg convolution).
The d... | {
"content_hash": "12890d9ba6491110d04f9a5b093119ed",
"timestamp": "",
"source": "github",
"line_count": 67,
"max_line_length": 76,
"avg_line_length": 33.343283582089555,
"alnum_prop": 0.6029543419874664,
"repo_name": "ggould256/libpmp",
"id": "49de2818c354ea151b9328641b26c393407dde36",
"size": "281... |
"""
WSGI config for group_meeting 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.6/howto/deployment/wsgi/
"""
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "group_meeting.settings")
from d... | {
"content_hash": "b8a5c012a325dd8442a0fca5bde3ba50",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 78,
"avg_line_length": 28.642857142857142,
"alnum_prop": 0.7755610972568578,
"repo_name": "scavedo159/group_meeting",
"id": "8d5e199d6c4a87c4def06e0ef9810f2672e9a495",
"siz... |
import functools as ft
import types
import typing
import warnings
from typing import Any, Callable, Dict
import jax
import jax.interpreters.ad as ad
import jax.tree_util as jtu
from jaxtyping import Array, PyTree
from .custom_types import BoolAxisSpec, sentinel
from .doc_utils import doc_strip_annotations
from .filte... | {
"content_hash": "7da41c94630f1ffc9c4855464884b0e2",
"timestamp": "",
"source": "github",
"line_count": 537,
"max_line_length": 89,
"avg_line_length": 36.4096834264432,
"alnum_prop": 0.6248465630114566,
"repo_name": "patrick-kidger/equinox",
"id": "b34dca02e0fedf5521ab01cf2bda3cb3d607cb53",
"size":... |
from typing import List
#---------------------------- FIO HIST LOG PARSE CODE -----------------------------------------------------------------
# Copy-paste from fio/tools/hist/fiologparser_hist.py.
# Because that's impossible to understand or improve,
# you can only copy such a pearl.
def _plat_idx_to_val(idx: in... | {
"content_hash": "7099b45ec7d21936dd9425d8839ca66f",
"timestamp": "",
"source": "github",
"line_count": 60,
"max_line_length": 120,
"avg_line_length": 37.833333333333336,
"alnum_prop": 0.6044052863436123,
"repo_name": "Mirantis/disk_perf_test_tool",
"id": "fc32d0dae8a8422494f6ca939b99b21efc35e0c3",
... |
"""Creates a RevNet with the bottleneck residual function.
Implements the following equations described in the RevNet paper:
y1 = x1 + f(x2)
y2 = x2 + g(y1)
However, in practice, the authors use the following equations to downsample
tensors inside a RevNet block:
y1 = h(x1) + f(x2)
y2 = h(x2) + g(y1)
In this case, ... | {
"content_hash": "a3f9e6ece0b1b3bdc541102fa32a9ba0",
"timestamp": "",
"source": "github",
"line_count": 424,
"max_line_length": 80,
"avg_line_length": 35.695754716981135,
"alnum_prop": 0.663164849686158,
"repo_name": "tensorflow/tensor2tensor",
"id": "05b21b0f7cdf354c3298f1607ac1149c175930ef",
"siz... |
from django.contrib import admin
from .models import Question
class QuestionAdmin(admin.ModelAdmin):
fields = ['pub_date', 'question_text']
admin.site.register(Question, QuestionAdmin) | {
"content_hash": "5c5ba391e5df3b95a4390181c13da7be",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 44,
"avg_line_length": 21.333333333333332,
"alnum_prop": 0.7708333333333334,
"repo_name": "zbassett/curling-robot",
"id": "3edfcb78bc8e761f3fcb491ea6be4bef3be86bdc",
"size":... |
import os
from supriya.tools import osctools
from supriya.tools.requesttools.BufferAllocateRequest import BufferAllocateRequest
class BufferAllocateReadRequest(BufferAllocateRequest):
r'''A /b_allocRead request.
::
>>> from supriya.tools import requesttools
>>> request = requesttools.BufferA... | {
"content_hash": "cbb729ba4f01f621da874a0727ee8f49",
"timestamp": "",
"source": "github",
"line_count": 128,
"max_line_length": 82,
"avg_line_length": 25.5859375,
"alnum_prop": 0.5661068702290076,
"repo_name": "andrewyoung1991/supriya",
"id": "74749da400b2784cf1eae063dc871352ca91ca23",
"size": "330... |
"""Introduce Export model
Revision ID: 5b681871c1ab
Revises: 18f53aae83ae
Create Date: 2020-07-28 11:26:26.392701
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
# revision identifiers, used by Alembic.
revision = "5b681871c1ab"
down_revision = "18f53aae83ae"
def upgr... | {
"content_hash": "136568fb70471b170efcac9b2b840bdf",
"timestamp": "",
"source": "github",
"line_count": 51,
"max_line_length": 82,
"avg_line_length": 37.431372549019606,
"alnum_prop": 0.643268727082242,
"repo_name": "pudo/aleph",
"id": "9ba8ce11d87321b861214c9f5f4a4431f6734daf",
"size": "1909",
"... |
from pysb.core import *
from pysb.annotation import Annotation
__all__ = ['Observable', 'Initial', 'MatchOnce', 'Model', 'Monomer',
'Parameter', 'Compartment', 'Rule', 'Expression', 'ANY', 'WILD',
'Annotation']
try:
import reinteract # fails if reinteract not installed
reinteract... | {
"content_hash": "e09b8ad741bfebf106a3eb7342cab145",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 89,
"avg_line_length": 40.13333333333333,
"alnum_prop": 0.6694352159468439,
"repo_name": "spgarbet/pysb",
"id": "33b41ede61c518885f97969f9cfcc307a60556ea",
"size": "602",
... |
"""
Integration tests which cover state convergence (aka smart recreate) performed
by `docker-compose up`.
"""
from __future__ import unicode_literals
import os
import shutil
import tempfile
from .testcases import DockerClientTestCase
from compose.config import config
from compose.const import LABEL_CONFIG_HASH
from ... | {
"content_hash": "257f5851495f0a116eaddc494a00cec6",
"timestamp": "",
"source": "github",
"line_count": 307,
"max_line_length": 85,
"avg_line_length": 32.83387622149837,
"alnum_prop": 0.5913690476190476,
"repo_name": "mnowster/compose",
"id": "3230aefc61a5863195edec8dddfeb42316e1839a",
"size": "100... |
from django.test import TestCase
from django import template
from django.template import Template, Context
from django.shortcuts import render_to_response
# Parser creation factory for testing
import django.template.base as template_base
def make_parser(template_string):
return template_base.Parser(
templ... | {
"content_hash": "3811e2fe8ae3a6b856fb891ec9a873cf",
"timestamp": "",
"source": "github",
"line_count": 1052,
"max_line_length": 78,
"avg_line_length": 39.79277566539924,
"alnum_prop": 0.5780421384549234,
"repo_name": "nalourie/django-macros",
"id": "8e811e0a7187bc5eada6621d692b9cd192ee07f5",
"size... |
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('mybbs', '0003_auto_20150731_1504'),
]
operations = [
migrations.AlterField(
model_name='bbs',
name='cai_id',
fie... | {
"content_hash": "54d0651d1f1f4c658359acd7cd172100",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 48,
"avg_line_length": 23.56,
"alnum_prop": 0.5449915110356537,
"repo_name": "oliver1996/BLEACH_BBS",
"id": "5fcc1533fa389345cbd4ae5ed71bb866ec446e3c",
"size": "613",
"bi... |
from setuptools import find_packages, setup
import os
import re
# Recommendations from https://packaging.python.org/
here = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(here, "README.md"), encoding="utf-8") as f:
long_description = f.read()
def read(*parts):
with open(os.path.join(here... | {
"content_hash": "ac3ca76295cbd624952ddbb355d216ec",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 88,
"avg_line_length": 29.6,
"alnum_prop": 0.6142506142506142,
"repo_name": "e3nn/e3nn-jax",
"id": "11ad0a9a43903a87bbf266523e81dc4d18726622",
"size": "1628",
"binary": f... |
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('campaigns', '0002_auto_20150318_1926'),
]
operations = [
migrations.AlterField(
model_name='campaignpixel',
name='pixel_type... | {
"content_hash": "d73d9f4516bc073ba89cb84d35dccf5b",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 92,
"avg_line_length": 24.055555555555557,
"alnum_prop": 0.5981524249422633,
"repo_name": "theonion/django-bulbs",
"id": "e2ec33c1770ef8f9225b964e9f61e387c4528eec",
"size":... |
import datetime
import calendar
import pandas as pd
import numpy as np
import zipline.finance.risk as risk
from zipline.utils import factory
from zipline.finance.trading import SimulationParameters
from zipline.testing.fixtures import WithTradingEnvironment, ZiplineTestCase
from zipline.finance.risk.period import Ri... | {
"content_hash": "a4de8bbb10a6071faa86ece705775784",
"timestamp": "",
"source": "github",
"line_count": 547,
"max_line_length": 79,
"avg_line_length": 39.44058500914077,
"alnum_prop": 0.5518216371558358,
"repo_name": "bartosh/zipline",
"id": "4ed87f476d21850bceacc69d8ad695a3d96c88f6",
"size": "2215... |
import collections
import os
import re
import numpy
from . import spectra_reader
ENVI_TO_NUMPY_DTYPE = {'1': numpy.uint8,
'2': numpy.int16,
'3': numpy.int32,
'4': numpy.float32,
'5': numpy.float64,
... | {
"content_hash": "720a9ca4ced9be6e362b4239dcdfbf6d",
"timestamp": "",
"source": "github",
"line_count": 156,
"max_line_length": 112,
"avg_line_length": 36.1025641025641,
"alnum_prop": 0.5330255681818182,
"repo_name": "pmlrsg/PySpectra",
"id": "c24277ba7f21b666a52458566c04a5d325fa03a6",
"size": "589... |
""" Cisco_IOS_XR_tty_server_oper
This module contains a collection of YANG definitions
for Cisco IOS\-XR tty\-server package operational data.
This module contains definitions
for the following management objects\:
tty\: TTY Line Configuration
Copyright (c) 2013\-2016 by Cisco Systems, Inc.
All rights reserved.
... | {
"content_hash": "fcecb5cd90c47d93b72cab0ee4b5524e",
"timestamp": "",
"source": "github",
"line_count": 3080,
"max_line_length": 269,
"avg_line_length": 39.61071428571429,
"alnum_prop": 0.420078523946525,
"repo_name": "111pontes/ydk-py",
"id": "057cc32c53d3634176c7d8f555c3a87a7d9bb4a8",
"size": "12... |
from abc import ABC, abstractmethod
import logging
# from time import sleep
log = logging.getLogger("Port")
class Port(ABC):
@abstractmethod
def send_and_receive(self, *args, **kwargs) -> dict:
raise NotImplementedError
def connect(self) -> None:
log.debug("connect not implemented")
... | {
"content_hash": "1c8f0ad68a34ca71b50f9f9178cfac40",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 118,
"avg_line_length": 30.92452830188679,
"alnum_prop": 0.6034167175106773,
"repo_name": "jblance/mpp-solar",
"id": "1eeea21fe77903cdfcd952aa726e2fed52a9ecda",
"size": "16... |
"""
This file demonstrates writing tests using the unittest module. These will pass
when you run "manage.py test".
Replace this with more appropriate tests for your application.
"""
from django.test import TestCase
from django.shortcuts import get_object_or_404
from django.utils.translation import ugettext as _
from... | {
"content_hash": "1e7ce489ff9982e3f185b447867d27ac",
"timestamp": "",
"source": "github",
"line_count": 266,
"max_line_length": 162,
"avg_line_length": 29.533834586466167,
"alnum_prop": 0.5631364562118126,
"repo_name": "yejia/order_system",
"id": "502ee8a1542598198dfb853a0b69a3f2332e853d",
"size": ... |
from django.contrib import auth
from dddp import THREAD_LOCAL
from dddp.api import API, Publication
from dddp.logging import LOGS_NAME
class ClientVersions(Publication):
"""Publication for `meteor_autoupdate_clientVersions`."""
name = 'meteor_autoupdate_clientVersions'
queries = []
class Logs(Publicat... | {
"content_hash": "29f9b91db3d80e610e16f4ce34afb956",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 61,
"avg_line_length": 23.8125,
"alnum_prop": 0.6181102362204725,
"repo_name": "django-ddp/django-ddp",
"id": "6583844fd8bd620effdcd185e90cf50eca31b3b9",
"size": "762",
"... |
'''
Test IPsec
@author: Quarkonics
'''
import zstackwoodpecker.test_util as test_util
import zstackwoodpecker.test_lib as test_lib
import zstackwoodpecker.test_state as test_state
import zstackwoodpecker.operations.ipsec_operations as ipsec_ops
import zstackwoodpecker.operations.resource_operations as res_o... | {
"content_hash": "d4d61e4c4a1267a7fda2288b8b17047e",
"timestamp": "",
"source": "github",
"line_count": 142,
"max_line_length": 145,
"avg_line_length": 48.2887323943662,
"alnum_prop": 0.6775557824121335,
"repo_name": "zstackio/zstack-woodpecker",
"id": "2a351e108b15608b90d1278fdbcbb36f1d9302f1",
"s... |
from sqlalchemy.dialects.oracle import base, cx_oracle, zxjdbc
base.dialect = cx_oracle.dialect
from sqlalchemy.dialects.oracle.base import \
VARCHAR, NVARCHAR, CHAR, DATE, DATETIME, NUMBER,\
BLOB, BFILE, CLOB, NCLOB, TIMESTAMP, RAW,\
FLOAT, DOUBLE_PRECISION, LONG, dialect, INTERVAL
__all__ = (
'VARCHAR... | {
"content_hash": "1bafba8d0f0e8f1c3b8558eab1598176",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 62,
"avg_line_length": 32.53333333333333,
"alnum_prop": 0.6782786885245902,
"repo_name": "obeattie/sqlalchemy",
"id": "eb47e80cb290f5eb6bc59665608a3c8c7193fd4d",
"size": "4... |
"""
Purpose
Shows how to use the AWS SDK for Python (Boto3) with Amazon Pinpoint to
send SMS messages using a message template.
"""
# snippet-start:[pinpoint.python.pinpoint_send_templated_sms_message.complete]
import logging
import boto3
from botocore.exceptions import ClientError
logger = logging.getLogger(__name_... | {
"content_hash": "6b5bde906af242701a628dbaa759415a",
"timestamp": "",
"source": "github",
"line_count": 85,
"max_line_length": 87,
"avg_line_length": 32.76470588235294,
"alnum_prop": 0.6021543985637343,
"repo_name": "awsdocs/aws-doc-sdk-examples",
"id": "500e9c4864b7c88651bcb08b6ae8a9e1681c2ce5",
"... |
import sys
sys.path.insert(0, "src")
from setuptools import setup, find_packages
from reversion import __version__
# Load in babel support, if available.
try:
from babel.messages import frontend as babel
cmdclass = {"compile_catalog": babel.compile_catalog,
"extract_messages": babel.extract_me... | {
"content_hash": "ea4ba621e3f0340e027cf1d66d0474c2",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 116,
"avg_line_length": 31.775862068965516,
"alnum_prop": 0.5816603364080304,
"repo_name": "MikeAmy/django-reversion",
"id": "e285854fcbd0a5d1267340357341948ca4baec00",
"si... |
import os
import math
import hashlib
import unicodedata
import string
from typing import Sequence, Dict
from types import MappingProxyType
from .util import resource_path, bfh, bh2u, randrange
from .crypto import hmac_oneshot
from . import version
from .logging import Logger
# http://www.asahi-net.or.jp/~ax2s-kmtn/r... | {
"content_hash": "902788302814485b652868e80ba0c335",
"timestamp": "",
"source": "github",
"line_count": 248,
"max_line_length": 140,
"avg_line_length": 33.88306451612903,
"alnum_prop": 0.5966916577412829,
"repo_name": "spesmilo/electrum",
"id": "5db4a4a999a657a23ef971badb9b3edf22dbc46e",
"size": "9... |
import collections
import sys
Conn = collections.namedtuple('Conn', ['node', 'weight'])
def info(*tt):
print(*tt, file=sys.stderr)
class Node:
finf = float('inf')
def __init__(self):
self.connected = []
self.origin = None
self.dist = self.finf
info("Created node")
de... | {
"content_hash": "388c00e97f95c10644823b6908cb8c1f",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 66,
"avg_line_length": 27.2,
"alnum_prop": 0.5639705882352941,
"repo_name": "Samuel-Phillips/python-graph-theory",
"id": "d2c00d663830122d4725445f6a733bfc12844d41",
"size":... |
'''
'''
#-----------------------------------------------------------------------------
# Boilerplate
#-----------------------------------------------------------------------------
from __future__ import absolute_import, division, print_function, unicode_literals
import logging
log = logging.getLogger(__name__)
#---... | {
"content_hash": "4890f86d06c2f4c2aadaf25ca94d99b8",
"timestamp": "",
"source": "github",
"line_count": 145,
"max_line_length": 127,
"avg_line_length": 33.241379310344826,
"alnum_prop": 0.5180497925311204,
"repo_name": "jakirkham/bokeh",
"id": "7b868f28d0347832e97ca506847ab16029bebcf1",
"size": "51... |
import os
import tempfile
from mysos.common import pkgutil, zookeeper
from .http import MysosServer
from .scheduler import MysosScheduler
from .state import LocalStateProvider, Scheduler, StateProvider
from .zk_state import ZooKeeperStateProvider
from kazoo.client import KazooClient
import mesos.interface
from meso... | {
"content_hash": "f86689751748e66cb567f61bf61ddf66",
"timestamp": "",
"source": "github",
"line_count": 314,
"max_line_length": 100,
"avg_line_length": 33.789808917197455,
"alnum_prop": 0.6602262016965127,
"repo_name": "programwithebay/ApacheMysos",
"id": "7ff6a251496ad536385e0d1e92acd74795877f6e",
... |
""" Defines the HighlightTool class.
"""
# Major library imports
from numpy import ones
# Enthought library imports
from traits.api import Enum, Float, Str
from enable.api import BaseTool
# Chaco imports
from chaco.api import BasePlotContainer
class HighlightTool(BaseTool):
""" A tool that enables the user to s... | {
"content_hash": "91e407613e8d6932223db5d960d66d93",
"timestamp": "",
"source": "github",
"line_count": 96,
"max_line_length": 92,
"avg_line_length": 34.375,
"alnum_prop": 0.5781818181818181,
"repo_name": "ContinuumIO/chaco",
"id": "40eee5a159edd4a2f1c3c20cff8e12835c493a40",
"size": "3300",
"bina... |
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('database', '0048_settingscontract'),
]
operations = [
migrations.RenameField(
model_name='settingsapp',
old_name='auto_hide_notes',
... | {
"content_hash": "41f8b2cb092960cbae31272c749b822c",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 46,
"avg_line_length": 20.61111111111111,
"alnum_prop": 0.5876010781671159,
"repo_name": "ACLARKNET/aclarknet-database",
"id": "ddb612d3d11a32d4fc552687cadf95752a70f8b3",
"... |
import logging
from werkzeug import (
BaseResponse, Request
)
from werkzeug.datastructures import Headers
from kay.utils.test import Client
from kay.app import get_application
from kay.conf import LazySettings
from kay.ext.testutils.gae_test_base import GAETestBase
from kay.utils import url_for
from kay.tests.rest... | {
"content_hash": "afe321d41131dddad9e58541110f9554",
"timestamp": "",
"source": "github",
"line_count": 219,
"max_line_length": 162,
"avg_line_length": 35.89497716894977,
"alnum_prop": 0.666073018699911,
"repo_name": "yosukesuzuki/let-me-notify",
"id": "2b10369499ff65a9c8927551fc525e115844ab2f",
"s... |
import copy
from nova.api.openstack.compute.schemas import block_device_mapping_v1
from nova.api.openstack.compute.schemas import server_tags
from nova.api.validation import parameter_types
from nova.objects import fields
block_device_mapping_new_item = {
# defined in nova/block_device.py:from_api()
# NOTE: ... | {
"content_hash": "ecdb2626ea02d41a1690641504bf97d8",
"timestamp": "",
"source": "github",
"line_count": 75,
"max_line_length": 76,
"avg_line_length": 30.266666666666666,
"alnum_prop": 0.6162995594713656,
"repo_name": "sebrandon1/nova",
"id": "81097f936f603a83fd6ac288aeb385f71c51d304",
"size": "2901... |
from __future__ import absolute_import
import pytest
from sentry.ownership.grammar import Rule, Matcher, Owner, parse_rules, dump_schema, load_schema
fixture_data = """
# cool stuff comment
*.js #frontend m@ROBENOLT.com
# good comment
url:http://google.com/* #backend
path:src/sentry/* da... | {
"content_hash": "7afe20e1f65fc77536f7f9b21fbb175b",
"timestamp": "",
"source": "github",
"line_count": 127,
"max_line_length": 100,
"avg_line_length": 31.543307086614174,
"alnum_prop": 0.5199700449326011,
"repo_name": "beeftornado/sentry",
"id": "4d1467483d460cc0963fde8dea6ce46dfcde3856",
"size": ... |
"""Tests the output methods."""
import json
from monitorstack.common import formatters
SAMPLE_RESULT = {
'exit_code': 0,
'message': 'uptime is ok',
'measurement_name': 'system_uptime',
'meta': {
'platform': 'example_platform',
},
'variables': {
'uptime': '29587.75'
}
}
SAM... | {
"content_hash": "c73d2528e4a951f58e703416eae1d237",
"timestamp": "",
"source": "github",
"line_count": 195,
"max_line_length": 72,
"avg_line_length": 32.00512820512821,
"alnum_prop": 0.591892324947925,
"repo_name": "major/monitorstack",
"id": "3cdf78570d5477b64745059311b9b5a59e8963e0",
"size": "68... |
"""
Test lldb Python API object's default constructor and make sure it is invalid
after initial construction.
There are also some cases of boundary condition testings sprinkled throughout
the tests where None is passed to SB API which expects (const char *) in the
C++ API counterpart. Passing None should not crash ll... | {
"content_hash": "6fb26377ed1e8050ed19e2966fd486e0",
"timestamp": "",
"source": "github",
"line_count": 418,
"max_line_length": 79,
"avg_line_length": 31.629186602870814,
"alnum_prop": 0.6032826563800016,
"repo_name": "apple/swift-lldb",
"id": "e48b90e2ee940db76c45496e5d32dcfc635e89e3",
"size": "13... |
"""
Volume driver library for NetApp C-mode block storage systems.
"""
from oslo_log import log as logging
from oslo_utils import units
import six
from cinder import exception
from cinder.i18n import _
from cinder.objects import fields
from cinder import utils
from cinder.volume.drivers.netapp.dataontap import block_... | {
"content_hash": "b9005c2b7cb2cd8a9180d1ce4c99995f",
"timestamp": "",
"source": "github",
"line_count": 586,
"max_line_length": 79,
"avg_line_length": 43.35665529010239,
"alnum_prop": 0.5979060888731452,
"repo_name": "eharney/cinder",
"id": "09d6f3ff0f6e8b22c00aa014688f546227e2d179",
"size": "26558... |
import sys
import json
import logging
log = logging.getLogger('wikitables')
def ftag(*args):
return lambda node: node.tag in args
def jprint(obj):
if isinstance(obj, str):
obj = json.loads(obj)
print(json.dumps(obj, indent=2, sort_keys=False, cls=TableJSONEncoder))
def guess_type(value):
... | {
"content_hash": "b8a7a196d9d30e126e0a9900ab0cbba1",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 76,
"avg_line_length": 21.01923076923077,
"alnum_prop": 0.6075022872827082,
"repo_name": "bcicen/wikitables",
"id": "dc36a94ee77ee46e0e3b79440ea844534bfbb44e",
"size": "109... |
"""
This module implements the functionality to take any Python expression as a
string and fix all numbers and other things before evaluating it,
thus
1/2
returns
Integer(1)/Integer(2)
We use the Python ast module for that, which is in python2.6 and later. It is
well documented at docs.python.org.
Some tips to und... | {
"content_hash": "7019187e992a32b4d50930b44b36f3bb",
"timestamp": "",
"source": "github",
"line_count": 97,
"max_line_length": 89,
"avg_line_length": 35.09278350515464,
"alnum_prop": 0.604289071680376,
"repo_name": "srjoglekar246/sympy",
"id": "8b4a9f39f621001c696b1e27db2a262009ac7383",
"size": "34... |
"""
Cost model optimizer based on simulated annealing
"""
import heapq
import logging
import time
import numpy as np
from ..util import sample_ints
from .model_based_tuner import ModelOptimizer, knob2point, point2knob
logger = logging.getLogger('autotvm')
class SimulatedAnnealingOptimizer(ModelOptimizer):
"""p... | {
"content_hash": "5673e6048df4e3c8c8f8131bcbf95bbd",
"timestamp": "",
"source": "github",
"line_count": 149,
"max_line_length": 97,
"avg_line_length": 32.57046979865772,
"alnum_prop": 0.5503812075005151,
"repo_name": "mlperf/training_results_v0.6",
"id": "77c7e919593b488a2376025dd66a988f51d06a95",
... |
import json
from social.exceptions import AuthUnknownError, AuthCanceled
from social.tests.backends.oauth import OAuth2Test
class FacebookOAuth2Test(OAuth2Test):
backend_path = 'social.backends.facebook.FacebookOAuth2'
user_data_url = 'https://graph.facebook.com/v2.3/me'
expected_username = 'foobar'
... | {
"content_hash": "ba4a12a1fc3215a62ad710d64209a3e5",
"timestamp": "",
"source": "github",
"line_count": 66,
"max_line_length": 77,
"avg_line_length": 28.893939393939394,
"alnum_prop": 0.6140534871525957,
"repo_name": "paulsoh/moxie",
"id": "166d75327a24acea3a270174b228abe58d62d4bb",
"size": "1907",... |
__all__ = ["tabulate_prime"]
"""
Extend `tabulate` module with prime print format.
"""
import tabulate as tabulate_module
from tabulate import DataRow, Line, TableFormat
prime_format = TableFormat(
lineabove=None,
linebelowheader=Line("", "-", "-", ""),
linebetweenrows=None,
linebelow=None,
head... | {
"content_hash": "543306ba9781072a6942bc4e8965553b",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 73,
"avg_line_length": 28.017857142857142,
"alnum_prop": 0.6163161249203314,
"repo_name": "mvj3/prints_a_multiplication_table_of_primes_numbers",
"id": "0a41f84ced61e542e61f5... |
from httplib import HTTPConnection
import os
from subprocess import Popen, PIPE
import sys
from time import sleep, time
from collections import defaultdict
import unittest
from nose import SkipTest
from swiftclient import get_auth, head_account
from swift.obj.diskfile import get_data_dir
from swift.common.ring import... | {
"content_hash": "d2faa401d7667ac230e9788075682ef9",
"timestamp": "",
"source": "github",
"line_count": 335,
"max_line_length": 79,
"avg_line_length": 36.82686567164179,
"alnum_prop": 0.5526465104968793,
"repo_name": "jungle90/Openstack-Swift-I-O-throttler",
"id": "7d1e754014451ab18983b3cb4042b72292c... |
from django.conf.urls import patterns, include, url
from darkoob.group import views as group_view
from darkoob.social import views as social_view
urlpatterns = patterns('',
url(r'^(?P<group_id>\d+)/(?P<group_slug>[-\w]+)/$', group_view.group, name='group_page'),
url(r'^new/$', group_view.create_group, name='cr... | {
"content_hash": "627dde9a9b1130f7997765227f244308",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 115,
"avg_line_length": 48.42857142857143,
"alnum_prop": 0.6504424778761062,
"repo_name": "s1na/darkoob",
"id": "a7148f86514a453300905d626d4624eca647fd5b",
"size": "678",
... |
import pygtk
pygtk.require('2.0')
import gtk
import gobject
import cairo
import getopt
import sys
import os
import os.path
import glob
import cStringIO
import errno
import ConfigParser
import gconf
import tarfile
import tempfile
import subprocess
try:
# Try to use XDG Base Directory standard for config files.
... | {
"content_hash": "fde5cad6c76a99bce0ff2b8b7c64dfb5",
"timestamp": "",
"source": "github",
"line_count": 1037,
"max_line_length": 79,
"avg_line_length": 38.56894889103182,
"alnum_prop": 0.553055305530553,
"repo_name": "nvazquez/Turtlebots",
"id": "614fbed70ebc2940ef4747d3d94d4b6e5cbbc7c9",
"size": "... |
import json
import datetime
from decimal import Decimal
from django.db import transaction
from django.conf import settings
from django.contrib.auth.models import User
from django.contrib.contenttypes.models import ContentType
from boto.mturk.connection import MTurkConnection, MTurkRequestError
from boto.mturk.qualifi... | {
"content_hash": "e20de48bb51c8b3aeb4d43872b9e7ecf",
"timestamp": "",
"source": "github",
"line_count": 464,
"max_line_length": 84,
"avg_line_length": 37.831896551724135,
"alnum_prop": 0.6344992594280506,
"repo_name": "seanbell/opensurfaces",
"id": "5fa57ccadc2fdf2c3ef394522329fd69825a224b",
"size"... |
"""Analysis plugin that labels events according to rules in a tagging file."""
from plaso.analysis import interface
from plaso.analysis import manager
from plaso.engine import tagging_file
class TaggingAnalysisPlugin(interface.AnalysisPlugin):
"""Analysis plugin that labels events according to rules in a tagging f... | {
"content_hash": "d2a5fd78a638157015a48c0e25eed5f9",
"timestamp": "",
"source": "github",
"line_count": 57,
"max_line_length": 80,
"avg_line_length": 35.07017543859649,
"alnum_prop": 0.704352176088044,
"repo_name": "kiddinn/plaso",
"id": "3133e721e62406f2f195eb6e90ecb1d8d243fc76",
"size": "2023",
... |
from typing import Dict, List, NewType
from backend.common.consts.api_version import ApiMajorVersion
from backend.common.models.team import Team
from backend.common.queries.dict_converters.converter_base import ConverterBase
TeamDict = NewType("TeamDict", Dict)
class TeamConverter(ConverterBase):
SUBVERSIONS = ... | {
"content_hash": "bc231322472b0cfb384b6fdfe2a916d1",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 92,
"avg_line_length": 35.62068965517241,
"alnum_prop": 0.6205227492739593,
"repo_name": "the-blue-alliance/the-blue-alliance",
"id": "bffc4722c1ec653f036f0849306213317e34ec9... |
""""""
import importlib
import os
import traceback
from collections import defaultdict
from pathlib import Path
from typing import Any, Callable
from datetime import datetime, timedelta
from concurrent.futures import ThreadPoolExecutor
from copy import copy
from tzlocal import get_localzone
from vnpy.event import Eve... | {
"content_hash": "0f219c9541c3c19701e0c871c54f174a",
"timestamp": "",
"source": "github",
"line_count": 937,
"max_line_length": 110,
"avg_line_length": 30.76947705442903,
"alnum_prop": 0.5719537997294579,
"repo_name": "bigdig/vnpy",
"id": "64bbee9664eb90b3f9ca8b1c6289d59007083677",
"size": "29227",... |
from bigbuild.models import PageList
from django.core.management.base import BaseCommand
class Command(BaseCommand):
help = 'Tests if page directories are valid'
def handle(self, *args, **options):
page_list = PageList()
self.stdout.write(
self.style.SUCCESS('All %s pages are vali... | {
"content_hash": "09d35e73b01e5eb3e3e66ad861ce4d2e",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 73,
"avg_line_length": 29.25,
"alnum_prop": 0.6638176638176638,
"repo_name": "datadesk/django-bigbuild",
"id": "717447d095e0e92f9fce176db1239b337e79364a",
"size": "397",
... |
import setuptools
import os.path
import datetime
setuptools.setup(
name = "doublecheck",
version = "0.1pre" + datetime.datetime.utcnow().replace(microsecond=0).isoformat(),
url = "https://github.com/kennknowles/python-doublecheck",
maintainer = "Kenn Knowles",
maintainer_email = "kenn.knowles@g... | {
"content_hash": "54befd9fc13e1c849d1fbd5adb7c4fa0",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 141,
"avg_line_length": 40.75,
"alnum_prop": 0.6785276073619632,
"repo_name": "kennknowles/python-doublecheck",
"id": "eb7b6f05925faa046972f2a52d38e5fe5db847a4",
"size": "8... |
import fileinput, optparse, sys
# Command-line parser
parser = optparse.OptionParser(
usage="""
%prog [options] [files]
Expand tab to spaces, printing to the standard output by default.
When no files are given, read from the standard input.
Examples:
expand in one file
% expand_tabs.py -t 4 file.txt
ex... | {
"content_hash": "e7cc1521ab239d25537db5de62877f6e",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 118,
"avg_line_length": 36.55172413793103,
"alnum_prop": 0.7047169811320755,
"repo_name": "ActiveState/code",
"id": "014ba47ef8b4a0abb152e703b7757be40f5add87",
"size": "108... |
import logging
import os
from pathlib import Path
from atom.api import Event
# Set up a verbose debugger level for tracing
TRACE_LEVEL_NUM = 5
logging.addLevelName(TRACE_LEVEL_NUM, "TRACE")
def trace(self, message, *args, **kws):
# Yes, logger takes its '*args' as 'args'.
if self.isEnabledFor(TRA... | {
"content_hash": "aa22f9ca55f78ec4b84c5ed21ce9591d",
"timestamp": "",
"source": "github",
"line_count": 156,
"max_line_length": 82,
"avg_line_length": 29.71794871794872,
"alnum_prop": 0.6084987057808455,
"repo_name": "bburan/psiexperiment",
"id": "3a29bfa9ca80ad21d74b8dc151329fa5ecd6e1b0",
"size": ... |
from unittest.mock import MagicMock, patch
import orjson
from zerver.lib.test_classes import ZulipTestCase
from zerver.models import Message, Stream, get_realm, get_user
class TestIntegrationsDevPanel(ZulipTestCase):
zulip_realm = get_realm("zulip")
def test_check_send_webhook_fixture_message_for_error(se... | {
"content_hash": "54887d7a74ff25a8ecc187fa3cc13505",
"timestamp": "",
"source": "github",
"line_count": 264,
"max_line_length": 478,
"avg_line_length": 51.28030303030303,
"alnum_prop": 0.6193677057172403,
"repo_name": "showell/zulip",
"id": "bd2155402ee44cc394061c6dfffcf6f023524c46",
"size": "13549... |
from django.conf.urls import patterns
from django.conf.urls import url
from rest_framework_swagger.views import SwaggerResourcesView, SwaggerApiView, SwaggerUIView, \
SwaggerEditorView, SwaggerAPISettingView, SaveSwaggerAPISettingView, ManageSwaggerEditorView, \
SwaggerAPIJsonView
urlpatterns = patterns(
'',
... | {
"content_hash": "5cae154936f491f6fb200221127dd050",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 114,
"avg_line_length": 60.94444444444444,
"alnum_prop": 0.7283500455788514,
"repo_name": "yoku2010/api-specification-system",
"id": "931b376f38cdc357ca59f6f38c0a5a063530def4... |
"""
WSGI config for opencodereview 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.8/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
from whitenoise.django import... | {
"content_hash": "e4ff66b9e4c98c04e3ebbd08a8e5ef9a",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 78,
"avg_line_length": 27.555555555555557,
"alnum_prop": 0.7963709677419355,
"repo_name": "lukasmartinelli/opencodereview",
"id": "5ef8d25db4e8d4ff0d4be810140563f19d6516b7",
... |
"""## Functions for copying elements from one graph to another.
These functions allow for recursive copying of elements (ops and variables)
from one graph to another. The copied elements are initialized inside a
user-specified scope in the other graph. There are separate functions to
copy ops and variables.
There is a... | {
"content_hash": "323519e8a56804eded23b59fd795876e",
"timestamp": "",
"source": "github",
"line_count": 241,
"max_line_length": 79,
"avg_line_length": 33.087136929460584,
"alnum_prop": 0.6798344620015049,
"repo_name": "jart/tensorflow",
"id": "5931c8a27996534cca80797e8b840559c124297c",
"size": "866... |
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('projects', '0001_initial_after_reset'),
]
operations = [
migrations.AlterField(
model_name='project',
... | {
"content_hash": "d2c306688f4606c745ea57e0664e52f4",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 209,
"avg_line_length": 34.310344827586206,
"alnum_prop": 0.6211055276381909,
"repo_name": "DMPwerkzeug/DMPwerkzeug",
"id": "def99e39879865c0b5cf9f102453e6289f488410",
"siz... |
"""Common pathname manipulations, OS/2 EMX version.
Instead of importing this module directly, import os and refer to this
module as os.path.
"""
import os
import stat
__all__ = ["normcase","isabs","join","splitdrive","split","splitext",
"basename","dirname","commonprefix","getsize","getmtime",
... | {
"content_hash": "aa5f6287f04d721caac20862aeaefefd",
"timestamp": "",
"source": "github",
"line_count": 420,
"max_line_length": 79,
"avg_line_length": 30.042857142857144,
"alnum_prop": 0.5688698684419083,
"repo_name": "OS2World/APP-INTERNET-torpak_2",
"id": "09982aadc1656a77dd3f9da44f1b26720de93f1c",... |
from __future__ import unicode_literals
"""Utilities for testing Motor with Tornado."""
from tornado import gen
from test import version, SkipTest
def one(s):
"""Get one element of a set"""
return next(iter(s))
def delay(sec):
# Javascript sleep() available in MongoDB since version ~1.9
return 's... | {
"content_hash": "0af1a874524cd5b18fc2dc53fe7e0596",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 68,
"avg_line_length": 25.057692307692307,
"alnum_prop": 0.6891788181120491,
"repo_name": "asvetlov/motor",
"id": "e43a73cd982b2118feb6a2ef331be9763d208148",
"size": "1882"... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.