text stringlengths 4 1.02M | meta dict |
|---|---|
'''Foundation for all actions
Actions
=======
Actions purpose is to modify along the time some trait of an object.
The object that the action will modify is the action's target.
Usually the target will be an instance of some CocosNode subclass.
Example::
MoveTo(position, duration)
the target will move smoothly... | {
"content_hash": "a717af1c016b9e6e27cceb5dd25b8f7e",
"timestamp": "",
"source": "github",
"line_count": 1004,
"max_line_length": 114,
"avg_line_length": 31.868525896414344,
"alnum_prop": 0.6318289786223278,
"repo_name": "eevee/cocos2d-mirror",
"id": "cd1d7be6d565d5b29b5b50fc08c0813140875d2f",
"size... |
""" EOS-DB Init Module.
Contains routing for EOS-DB API, and callbacks for response modification."""
from pyramid.config import Configurator
from pyramid.events import NewRequest, NewResponse
import logging
import sys, os
from eos_db import server
from eos_db.auth import HybridAuthenticationPolicy, add_cookie_callb... | {
"content_hash": "ea3957f5d16e2bd9fb645e68cfb2875d",
"timestamp": "",
"source": "github",
"line_count": 178,
"max_line_length": 97,
"avg_line_length": 44.99438202247191,
"alnum_prop": 0.6161817954800849,
"repo_name": "cedadev/eos-db",
"id": "506fe26b9f9ff54d3f9933b4f33a1efa5a27dab7",
"size": "8009"... |
import logging
import os
LOGGER = logging.getLogger(__name__)
def setup_module():
"""Ensure the test environment variables are set"""
try:
with open('build/test-environment') as f:
for line in f:
if line.startswith('export '):
line = line[7:]
... | {
"content_hash": "f49511d7b128aae765fd9674ab0c25fb",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 72,
"avg_line_length": 28.77777777777778,
"alnum_prop": 0.5308880308880309,
"repo_name": "gmr/tornado-aws",
"id": "37cc3151db10301deb5da870c40175097f4c7bff",
"size": "518",... |
import time
from threading import *
import joinlist
import os.path
import lurkbotclass
import os
from subprocess import Popen, CREATE_NEW_CONSOLE
import shutil
CREATE_NEW_CONSOLE = (0x00000010)
"""
def alivecheck():
#global bots
#print bots
for i in joinlist.joinlist:
#do som... | {
"content_hash": "4ae319ffc51ce3dac423074d003242c8",
"timestamp": "",
"source": "github",
"line_count": 70,
"max_line_length": 58,
"avg_line_length": 21.542857142857144,
"alnum_prop": 0.5125994694960212,
"repo_name": "thorkd1t/lurkbot",
"id": "c4e00309ba490f60a806cca7a96fcb1f36e04ef8",
"size": "150... |
import unittest
from gfm import *
class TestGitHubFlavoredMarkdown(unittest.TestCase):
def test_does_not_touch_single_underscores_inside_words(self):
self.assertEqual("foo_bar", gfm("foo_bar"))
def test_does_not_touch_underscores_in_code_blocks(self):
self.assertEqual(" foo_bar_baz", gfm(" ... | {
"content_hash": "8c169b7c710c65e94154b187b5c68f82",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 76,
"avg_line_length": 38.644444444444446,
"alnum_prop": 0.60897067280046,
"repo_name": "stewart/gfm",
"id": "b14de1fae006f32ab870e2638a32cc2438f10334",
"size": "1739",
"... |
import pytest
import json
import boto3
import os
import sys
from random import randint
# TEST FILES
source_path = os.path.realpath(os.path.dirname(__file__)+"/../pekl")
print "source path: %s" % str(source_path)
sys.path.append(source_path)
import Pekl
pekl = Pekl.Pekl("pekl-test-transfer-bucket")
@pytest.fixture(sc... | {
"content_hash": "f5054e97fccc1f2d7a309afd8883561a",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 118,
"avg_line_length": 30.654545454545456,
"alnum_prop": 0.666073546856465,
"repo_name": "tamme-io/pekl",
"id": "e535a959587d348085e39aebeba20b98545dceb3",
"size": "1686",... |
""" This example shows how a Bokeh plot can be embedded in an HTML
document, in a way that the plot resizes to make use of the available
width and height (while keeping the aspect ratio fixed).
To make this work well, the plot should be placed in a container that
*has* a certain width and height (i.e. non-scrollable),... | {
"content_hash": "50422a045dc14ef57e900d61b2655ef4",
"timestamp": "",
"source": "github",
"line_count": 84,
"max_line_length": 84,
"avg_line_length": 30.75,
"alnum_prop": 0.6449864498644986,
"repo_name": "quasiben/bokeh",
"id": "57657740bec95e64a0a180c039897fe2430a7244",
"size": "2583",
"binary":... |
"""
20150624
Obtener la fecha actual, la de manana y la del dia anterior
Objetivo: obtener los numeros del ano dia y mes para manipularlos
Fuentes:
Notas:
Keywords:
fechas, operaciones con fechas
Autor: Jaime Andres Cataño Bernal
"""
from datetime import datetime, timedelta
objetofecha = date... | {
"content_hash": "eb0e15ee6227007f17c2e2bcba19c450",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 75,
"avg_line_length": 19.75,
"alnum_prop": 0.7269439421338155,
"repo_name": "jaimeandrescatano/ekorre",
"id": "cb7427b9c460483b19a1e66360acfe0cb1861513",
"size": "600",
... |
import io
import unittest
import mock
from hpOneView.connection import connection
from hpOneView.oneview_client import OneViewClient
from hpOneView.resources.data_services.metric_streaming import MetricStreaming
from hpOneView.resources.facilities.power_devices import PowerDevices
from hpOneView.resources.facilities.... | {
"content_hash": "636c0bc9ca44c75d10706ef90b37e128",
"timestamp": "",
"source": "github",
"line_count": 381,
"max_line_length": 101,
"avg_line_length": 42.509186351706035,
"alnum_prop": 0.7094961718942949,
"repo_name": "andreadean5/python-hpOneView",
"id": "dae7e34b45be3b0c73b943ae0d772cfe625915e7",
... |
from __future__ import absolute_import
import json
import re
from operator import itemgetter
from copy import deepcopy
import itertools
from six.moves.urllib_parse import urlparse
from w3lib.http import basic_auth_header
from scrapy.http import Request, HtmlResponse, FormRequest
import six
try:
from scrapy.spide... | {
"content_hash": "ac148a60a52b58b21ab6b1c90ad0a490",
"timestamp": "",
"source": "github",
"line_count": 267,
"max_line_length": 79,
"avg_line_length": 41.258426966292134,
"alnum_prop": 0.5652687000726216,
"repo_name": "amikey/portia",
"id": "48b3306cbc1aad43fc127c2b6651fb5e4d9f7975",
"size": "11016... |
import importlib
import logging
import os
import re
import sys
from .schedule_handlers import ScheduleHandlerBase
VALID_MODULE_NAME = re.compile(r'^(\w+)\.py$', re.IGNORECASE)
PARENT_DIRNAME = os.path.basename(os.path.dirname(os.path.realpath(__file__)))
BASE_DIR = os.path.dirname(os.path.realpath(
os.path.join(... | {
"content_hash": "038e72b7b3496156a268fe613d90e0be",
"timestamp": "",
"source": "github",
"line_count": 194,
"max_line_length": 79,
"avg_line_length": 30.350515463917525,
"alnum_prop": 0.6003736413043478,
"repo_name": "RedHat-Eng-PGM/schedules-tools",
"id": "814c543c33afbad4a77d09da195b69ab61a395f6",... |
""" Converts .nnw files to a JSON file """
# Purpose: Read JSON files and print results to the command line. Used to determine best params after learning has completed
# Author: Brian Mirletz
# Date: March 2015
import sys
import os
import subprocess
import json
import random
import logging
import collections
impo... | {
"content_hash": "1ecb408ec0602d1e2ba1c247ca770d42",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 124,
"avg_line_length": 24.5,
"alnum_prop": 0.5634110787172012,
"repo_name": "UnionEvoRobo/NTRTsim",
"id": "61aeafa77f3ee931830d1a38fc6baf0bacfa546e",
"size": "2157",
"bi... |
"""Tests for MixedPrecisionLossScaleOptimizer."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
from absl.testing import parameterized
from tensorflow.python.distribute import distribution_strategy_context
from tensorflow.python.distribute imp... | {
"content_hash": "de323314ae16e90252cc9f4a30d4396c",
"timestamp": "",
"source": "github",
"line_count": 252,
"max_line_length": 90,
"avg_line_length": 44.067460317460316,
"alnum_prop": 0.6915803692030617,
"repo_name": "alsrgv/tensorflow",
"id": "c2259cd7ed21df4c9440d64517fd6df9fbbf1943",
"size": "1... |
"""The interface for building Relay functions exposed from C++."""
from tvm._ffi.function import _init_api
_init_api("relay.build_module", __name__)
| {
"content_hash": "faf82b169acc60510adeed254dcf7b8e",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 66,
"avg_line_length": 37.5,
"alnum_prop": 0.7133333333333334,
"repo_name": "mlperf/training_results_v0.7",
"id": "bdbcbefff5238cb26cf792a9faf880a79bc07f71",
"size": "1011",... |
'''
'''
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License");... | {
"content_hash": "b2a1d6fc97685f1a1d19d660b9084793",
"timestamp": "",
"source": "github",
"line_count": 166,
"max_line_length": 332,
"avg_line_length": 55.80120481927711,
"alnum_prop": 0.7500809672892151,
"repo_name": "vmamidi/trafficserver",
"id": "b189060d1ac9c877b78e255059bfe945a5f7420b",
"size"... |
import os
import plugins
import time
class Plugin(plugins.BasePlugin):
__name__ = 'docker'
def run(self, config):
'''
Docker monitoring, needs sudo access!
Instructions at:
https://help.nixstats.com/en/article/monitoring-docker-9st778/
'''
containers = {}
... | {
"content_hash": "8f7dab50c26c55a0fd6095a3939d27ed",
"timestamp": "",
"source": "github",
"line_count": 72,
"max_line_length": 223,
"avg_line_length": 47.34722222222222,
"alnum_prop": 0.5350542681138164,
"repo_name": "vfuse/nixstatsagent",
"id": "231ab3fe8b7ba89b09e73f4a29a6bab298bfa5ed",
"size": "... |
from .acl import ( # noqa
GetACLRequest,
GetACLResponse,
SetACLRequest,
SetACLResponse,
WORLD_READABLE,
AUTHED_UNRESTRICTED,
UNRESTRICTED_ACCESS,
)
from .auth import ( # noqa
AuthRequest,
AuthResponse,
AUTH_XID,
)
from .check import ( # noqa
CheckVersionRequest,
CheckV... | {
"content_hash": "083862666a3ee4a08e496b1de1e212e6",
"timestamp": "",
"source": "github",
"line_count": 89,
"max_line_length": 46,
"avg_line_length": 18.89887640449438,
"alnum_prop": 0.6765755053507729,
"repo_name": "wglass/zoonado",
"id": "f4d52505084d2cfa46f19d0ea2f248ab8732ec32",
"size": "1682",... |
import hou
# return all connections up & downstream
def listConnected( node, visited=None ):
if visited is None:
visited = []
connected = []
visited.append( node )
for n in node.inputs() + node.outputs():
if not n in visited:
connected.append( n )
connected += li... | {
"content_hash": "920778eab7940ac42c2674dcd8e2a00b",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 52,
"avg_line_length": 28.23076923076923,
"alnum_prop": 0.6076294277929155,
"repo_name": "danbethell/vfxbits",
"id": "13f40c0d21b334350df31cc58c71446a98050688",
"size": "36... |
"""
Example demonstrating what happens when a Python script raises an exception
"""
1 + 'blue'
| {
"content_hash": "2c2df59e6cfafc62c68bf263cd4882bb",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 75,
"avg_line_length": 23.75,
"alnum_prop": 0.7368421052631579,
"repo_name": "python-cmd2/cmd2",
"id": "738edaf2861e56b8daa095f7df7de17736ab9b49",
"size": "132",
"binary":... |
import numpy
import os
import pandas
import numpy
from copy import deepcopy
from sklearn.metrics import mean_squared_error
import foldkin.base.target_data
class KingsFeatureModelFactory(foldkin.base.model_factory.ModelFactory):
"""KingsFeatureModelFactory creates a KingsFeatureModel."""
def create_model(self... | {
"content_hash": "2d5c116fb0d99c506965a9345ceeb6bf",
"timestamp": "",
"source": "github",
"line_count": 209,
"max_line_length": 89,
"avg_line_length": 35.83732057416268,
"alnum_prop": 0.6117489986648865,
"repo_name": "grollins/foldkin",
"id": "cb658de62786573af20568f02ec4692f1dd762f4",
"size": "749... |
for node in Query.input.tuples('ast'):
if isinstance(node.ast, IfStatement):
if node.ast.elseBranch.size() > 0:
Query.result.add( node )
| {
"content_hash": "ac1eb107817056aba4fb191ada237bcd",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 38,
"avg_line_length": 35.75,
"alnum_prop": 0.6993006993006993,
"repo_name": "mgalbier/Envision",
"id": "43ed67bde3ed512a646bb3817bec575319ab5ac2",
"size": "143",
"binary"... |
"""Tools for building tensorflow api reference docs."""
from tensorflow_docs.api_generator import doc_controls
from tensorflow_docs.api_generator import doc_generator_visitor
from tensorflow_docs.api_generator import generate_lib
from tensorflow_docs.api_generator import parser
from tensorflow_docs.api_generator impor... | {
"content_hash": "100ea6bf993ff1c0c5fb0fabb52fb005",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 63,
"avg_line_length": 48.9,
"alnum_prop": 0.8425357873210634,
"repo_name": "tensorflow/docs",
"id": "325a9eb075e64c9c50163ec07aa3fb6394e82147",
"size": "1178",
"binary":... |
import unittest
from awacs.aws import BaseARN, Principal
class TestPrincipal(unittest.TestCase):
def test_wildcard_principal(self):
p = Principal("*")
self.assertEqual(p.data, "*")
with self.assertRaises(ValueError):
p = Principal("*", "FAIL")
def test_normal_principal(se... | {
"content_hash": "1f332ba714fa32acdeb24845f590dac3",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 86,
"avg_line_length": 34.4375,
"alnum_prop": 0.6067755595886267,
"repo_name": "cloudtools/awacs",
"id": "12e9b6b71d10c09a59c24ec3fba95f9f488df26a",
"size": "1653",
"bina... |
"""
.. module:: simrun_stats_postclassification
:platform: Unix, Windows
:synopsis: Data object for storing a stats about the post-classification individual sample for a single sim run and generation step.
.. moduleauthor:: Mark E. Madsen <mark@madsenlab.org>
"""
import logging as log
from ming import Sessio... | {
"content_hash": "917f2369f7efdca207a119e324162d61",
"timestamp": "",
"source": "github",
"line_count": 121,
"max_line_length": 163,
"avg_line_length": 37.53719008264463,
"alnum_prop": 0.6695288419198591,
"repo_name": "mmadsen/CTPy",
"id": "dc4027a6b4a276759d2da69c293caa087ed19cb7",
"size": "4971",... |
import requests
import json
import codecs
import time
import datetime
import sys
import segment,location,ttitem
from time import mktime
from datetime import datetime
#reload(sys)
#sys.setdefaultencoding('UTF8')
def search(location1Id, location2Id, departureDate, departureTime,
arrivalDate, arrivalTime):
r... | {
"content_hash": "2c633027a16dfc3941f0b1915bae2fd9",
"timestamp": "",
"source": "github",
"line_count": 106,
"max_line_length": 160,
"avg_line_length": 46.235849056603776,
"alnum_prop": 0.5262191389512344,
"repo_name": "bkach/TravelTerminal",
"id": "205f94d76fe1c3102dbf16fb9dc66a2f72f9f92c",
"size"... |
from __future__ import (absolute_import, unicode_literals, print_function)
import pytest
from creds.ssh import PublicKey
from .sample_data import PUBLIC_KEYS
def test_invalid_public_key_setup():
with pytest.raises(AttributeError):
assert PublicKey()
def test_create_public_key_from_encoded():
for k... | {
"content_hash": "5f7a6fd2bc0d93a5a6c93ca16406fb20",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 74,
"avg_line_length": 28,
"alnum_prop": 0.6601382488479263,
"repo_name": "jonhadfield/creds",
"id": "b858392c7e61e570868833baf21129ccd98d12e0",
"size": "893",
"binary": ... |
TARGETS = [
'lightout.py',
]
PACKAGE = {
'title': 'lightout',
'desc': 'lightout example',
}
def setup(targets):
'''Setup example for translation, MUST call util.setup(targets).'''
util.setup(targets)
def translate():
'''Translate example, MUST call util.translate().'''
util.translate()... | {
"content_hash": "363c524d224fecebb4137f2205f9b19b",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 77,
"avg_line_length": 20.408163265306122,
"alnum_prop": 0.596,
"repo_name": "spaceone/pyjs",
"id": "efcaa4fe7f2988f12afae33bdada9a8e18d80b4d",
"size": "1048",
"binary": ... |
"""
Written by Lucas Sinclair.
MIT Licensed.
Contact at www.sinclair.bio
"""
# Built-in modules #
import os
# First party modules #
from seqsearch.databases import Database
# Third party modules #
# Constants #
home = os.environ.get('HOME', '~') + '/'
###############################################################... | {
"content_hash": "ffa575b825a7789ea93e5b403c183769",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 79,
"avg_line_length": 26.53191489361702,
"alnum_prop": 0.5525260625501203,
"repo_name": "xapple/seqsearch",
"id": "10cc274da8a4078f9c4af2bd279f86d4d1e8c965",
"size": "1295... |
from __future__ import division, print_function, absolute_import
import warnings
import numpy as np
from scipy.lib.six import callable
def binned_statistic(x, values, statistic='mean',
bins=10, range=None):
"""
Compute a binned statistic for a set of data.
This is a generalization ... | {
"content_hash": "934316817b7f45c070af71ca576e06a9",
"timestamp": "",
"source": "github",
"line_count": 402,
"max_line_length": 87,
"avg_line_length": 37.41542288557214,
"alnum_prop": 0.5978990758593179,
"repo_name": "RobertABT/heightmap",
"id": "cb46c494c29b135a65d9495ff07f1bb12bbf4c68",
"size": "... |
from thrift.Thrift import *
from thrift.transport import TTransport
from thrift.protocol import TBinaryProtocol, TProtocol
try:
from thrift.protocol import fastbinary
except:
fastbinary = None
class TestEnum(object):
ENUM_ONE = 0
ENUM_TWO = 1
ENUM_THREE = 2
_VALUES_TO_NAMES = {
0: "ENUM_ONE",
1:... | {
"content_hash": "b38aa6016f0c05451ffe4d395a62bdbc",
"timestamp": "",
"source": "github",
"line_count": 434,
"max_line_length": 256,
"avg_line_length": 31.52995391705069,
"alnum_prop": 0.5849897690733704,
"repo_name": "hortonworks/hortonworks-sandbox",
"id": "9d78e561aa8796abd399294e9ec465b9ccaf939a"... |
"""BSD specific tests. These are implicitly run by test_psutil.py."""
import unittest
import subprocess
import time
import re
import sys
import psutil
from test_psutil import reap_children, get_test_subprocess, sh
def sysctl(cmdline):
"""Expects a sysctl command with an argument and parse the result
return... | {
"content_hash": "a13344e90031f3b078d27802164643ca",
"timestamp": "",
"source": "github",
"line_count": 157,
"max_line_length": 84,
"avg_line_length": 40.6687898089172,
"alnum_prop": 0.5998433829287392,
"repo_name": "tamentis/psutil",
"id": "c03ed7abecbdd5131c6a7bb0c84e1a298f7cc001",
"size": "6594"... |
from django.db import models
from django.core.serializers.json import DjangoJSONEncoder
from django.conf import settings
from django.utils.safestring import mark_safe
from jsonfield import JSONField
import waffle
from waffle.models import Flag
import random
import json
from experiments.dateutils import now
from exp... | {
"content_hash": "e4f38be6c7b8fcb4fec6be460a6bd954",
"timestamp": "",
"source": "github",
"line_count": 240,
"max_line_length": 110,
"avg_line_length": 36.49583333333333,
"alnum_prop": 0.6184495947025916,
"repo_name": "robertobarreda/django-experiments",
"id": "8e4a9034f6fe5b42d2ce8e36ff4d9a319f79b23... |
import logging
import optparse
import requests
import sys
from BeautifulSoup import BeautifulSoup
"""Control a chromecast with python"""
class chromecast_control:
port = "8008"
def __init__(self, ip, app_id=None):
self.ip = ip
self.app_id = app_id
def build_youtube_url(self):
... | {
"content_hash": "38d0637769682b4f05e1c8700a24e126",
"timestamp": "",
"source": "github",
"line_count": 92,
"max_line_length": 86,
"avg_line_length": 27.73913043478261,
"alnum_prop": 0.575626959247649,
"repo_name": "harperreed/chromecast-control",
"id": "003031c2f79fc31fd4a2bc32805b455cdd5c5541",
"... |
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('projects', '0006_merge'),
]
operations = [
migrations.RemoveField(
model_name='projectbudgetline',
name='currency',
),
]... | {
"content_hash": "0d488b016cb06d2810cbc12d0a0f6e5e",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 43,
"avg_line_length": 18.88235294117647,
"alnum_prop": 0.5919003115264797,
"repo_name": "onepercentclub/bluebottle",
"id": "6e7411a093162c339325b8bfe0a25c1e97efe2ed",
"siz... |
from rally.benchmark.scenarios import base
from rally.benchmark.scenarios.neutron import utils
from rally.benchmark import validation
from rally import consts
class NeutronNetworks(utils.NeutronScenario):
"""Benchmark scenarios for Neutron."""
@validation.required_services(consts.Service.NEUTRON)
@valida... | {
"content_hash": "b41f0af410be680efc01fb7c107f66fb",
"timestamp": "",
"source": "github",
"line_count": 316,
"max_line_length": 78,
"avg_line_length": 47.18354430379747,
"alnum_prop": 0.5813547954393025,
"repo_name": "varunarya10/rally",
"id": "d21158ff0b5cea003bc49bfa6a0988bd29814604",
"size": "15... |
'''
Managing python installations with pyenv
========================================
This module is used to install and manage python installations with pyenv.
Different versions of python can be installed, and uninstalled. pyenv will
be installed automatically the first time it is needed and can be updated
later. Th... | {
"content_hash": "3201aa4041b86b34983074888cb95861",
"timestamp": "",
"source": "github",
"line_count": 214,
"max_line_length": 79,
"avg_line_length": 28.757009345794394,
"alnum_prop": 0.5944101397465064,
"repo_name": "smallyear/linuxLearn",
"id": "715256be0333ad2a280451b7ea829677b5674a4a",
"size":... |
from .Machines import Machines | {
"content_hash": "1e42a4e143c37fe530e807c362f93862",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 30,
"avg_line_length": 30,
"alnum_prop": 0.8666666666666667,
"repo_name": "DavidWhittingham/agsadmin",
"id": "e1c0a278f8220c3bd735794632f777a4a1e4f612",
"size": "30",
"bin... |
from six import moves
import testtools
from tempest.api.image import base
from tempest import config
from tempest.lib.common.utils import data_utils
from tempest.lib import exceptions as lib_exc
from tempest import test
CONF = config.CONF
class BasicAdminOperationsImagesTest(base.BaseV2ImageAdminTest):
"""Here ... | {
"content_hash": "b70ed0265681df626813866cda8dc618",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 75,
"avg_line_length": 42.84444444444444,
"alnum_prop": 0.6400414937759336,
"repo_name": "bigswitch/tempest",
"id": "80da7a13b42168d5de5151f06afe53ad52badd0e",
"size": "255... |
import xml.etree.ElementTree as ET
import os
import json
try:
from zabbix_api import ZabbixAPI
except ImportError:
ZabbixAPI = None
from ansible.module_utils.basic import AnsibleModule
DOCUMENTATION = '''
---
module: zabbix_template
short_description: Import templates to Zabbix
description:
- Import Zab... | {
"content_hash": "5734fe42bc69119b177dd497ede79ce4",
"timestamp": "",
"source": "github",
"line_count": 343,
"max_line_length": 119,
"avg_line_length": 29.75801749271137,
"alnum_prop": 0.5681395120995395,
"repo_name": "erigones/esdc-ce",
"id": "4609b5082d91a68346bbd1ff853bc322ae51060e",
"size": "10... |
from __future__ import absolute_import
import inspect
import operator
from itertools import count
from .util import clean_params, collect_doc_classes
from .types import instantiate, Type
from .compat import string_types, Mapping
class Expression(object):
def _collect_doc_classes(self):
return set()
... | {
"content_hash": "cd7a083e76319afd7f44033b46c30913",
"timestamp": "",
"source": "github",
"line_count": 841,
"max_line_length": 79,
"avg_line_length": 28.822829964328182,
"alnum_prop": 0.5827145214521452,
"repo_name": "anti-social/elasticmagic",
"id": "619ea429f4306e94fd85831c6e9707c12d677e09",
"si... |
from __future__ import print_function, absolute_import, division, unicode_literals
import pytest # NOQA
from .roundtrip import dedent, round_trip_load, round_trip_dump
# http://yaml.org/type/int.html is where underscores in integers are defined
class TestBinHexOct:
def test_calculate(self):
# make sur... | {
"content_hash": "f8f969c50549a6f76ac5517dfacff16a",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 82,
"avg_line_length": 26.176470588235293,
"alnum_prop": 0.5202247191011236,
"repo_name": "explosion/srsly",
"id": "6635fcf6b22c8a0f58a263e522da9ca03df6ed58",
"size": "907"... |
import io
import json
import logging
import os.path
import unittest
from . import models.bundle as bundle
from . import models.medication as medication
from . import models.patient as patient
from . import models.questionnaire as questionnaire
from . import models.resource as resource
from . import models.valueset as ... | {
"content_hash": "5663e76758e2a63e852640bb98044062",
"timestamp": "",
"source": "github",
"line_count": 132,
"max_line_length": 104,
"avg_line_length": 43.121212121212125,
"alnum_prop": 0.6698875614898102,
"repo_name": "all-of-us/raw-data-repository",
"id": "3c83679d09fb92b31a4392037c170ea2f387046c",... |
"""The tests for the Yr sensor platform."""
import asyncio
from datetime import datetime
from unittest.mock import patch
from homeassistant.bootstrap import async_setup_component
import homeassistant.util.dt as dt_util
from tests.common import assert_setup_component, load_fixture
NOW = datetime(2016, 6, 9, 1, tzinfo... | {
"content_hash": "55d0ec44ed525b1833278678415dd5f7",
"timestamp": "",
"source": "github",
"line_count": 124,
"max_line_length": 83,
"avg_line_length": 32.07258064516129,
"alnum_prop": 0.6281116419411616,
"repo_name": "fbradyirl/home-assistant",
"id": "dce387b2c8cbb436bd9b4e2f6c0f08484a3d6a6f",
"siz... |
__author__ = 'donal'
__project__ = 'ribcage'
from flask import Blueprint
log_auth = Blueprint('log_auth', __name__)
# goes last
from . import views, view_errors | {
"content_hash": "f10be124759ffab4ec0246c2848a7c14",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 42,
"avg_line_length": 23,
"alnum_prop": 0.6770186335403726,
"repo_name": "carverdo/homer",
"id": "d2ee9d64b868ca1379299666219b9e48dc9fd04c",
"size": "161",
"binary": fals... |
"""
INFORM over multiple transports
+++++++++++++++++++++++++++++++
The following script sends SNMP INFORM notification using the following options:
* with SNMPv2c
* with community name 'public'
* over IPv4/UDP and IPv6/UDP
* send INFORM notification
* to a Manager at demo.snmplabs.com:162 and [::1]:162
* with TRAP I... | {
"content_hash": "7adcc6727c0a4ed2cba0067d14db9bf6",
"timestamp": "",
"source": "github",
"line_count": 96,
"max_line_length": 80,
"avg_line_length": 29.53125,
"alnum_prop": 0.7185185185185186,
"repo_name": "etingof/pysnmp",
"id": "20056466f875fa14bacde332e66d14d628adaf56",
"size": "2835",
"binar... |
"""A `Transform` that performs subtraction on two `Series`."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.contrib.learn.python.learn.dataframe import series
from tensorflow.contrib.learn.python.learn.dataframe import transform
from tens... | {
"content_hash": "4dd165783909c46c393736e097ba8fc3",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 74,
"avg_line_length": 31.942307692307693,
"alnum_prop": 0.6688741721854304,
"repo_name": "natanielruiz/android-yolo",
"id": "b585fceeb63f6f552d86c4a199a9c768ae7388c6",
"si... |
from .fetchers import NUDestinationurlsFetcher
from .fetchers import NUMetadatasFetcher
from .fetchers import NUGlobalMetadatasFetcher
from bambou import NURESTObject
class NUTier(NURESTObject):
""" Represents a Tier in the VSD
Notes:
When the customer creates an HTTP probe, VSD will aut... | {
"content_hash": "cd75738adedfce6d48166aa0ae9b318f",
"timestamp": "",
"source": "github",
"line_count": 325,
"max_line_length": 175,
"avg_line_length": 27.956923076923076,
"alnum_prop": 0.5556900726392252,
"repo_name": "nuagenetworks/vspk-python",
"id": "390a02daeb42e0441ab622d5a7290ac7266c505e",
"... |
from neutron.openstack.common.gettextutils import _
from neutron.openstack.common import log as logging
from neutron.openstack.common import rpc
from neutron.openstack.common.rpc import dispatcher as rpc_dispatcher
from neutron.openstack.common import service
LOG = logging.getLogger(__name__)
class Service(service.... | {
"content_hash": "890ec1c2571013fa9a9aa76828ede63b",
"timestamp": "",
"source": "github",
"line_count": 59,
"max_line_length": 76,
"avg_line_length": 35.016949152542374,
"alnum_prop": 0.6374636979670861,
"repo_name": "vijayendrabvs/ssl-neutron",
"id": "4479dcc3ac9e1994bf5fac6cd2b1d7aec65a426d",
"si... |
import pygame, sys
from pygame.locals import *
pygame.init()
# Set clock speed
FPS = 60
fpsClock = pygame.time.Clock()
# Set up screen
DISPLAYSURF = pygame.display.set_mode((400,300), 0, 32)
pygame.display.set_caption('Animation')
# Define game colors and sprites
WHITE = (255, 255, 255)
catImg = pygame.image.load('... | {
"content_hash": "b31e8a1d562096ccbe60457f9548c112",
"timestamp": "",
"source": "github",
"line_count": 63,
"max_line_length": 60,
"avg_line_length": 22.476190476190474,
"alnum_prop": 0.5614406779661016,
"repo_name": "jeremypedersen/pythonGameDev",
"id": "0b20a230d3685836e858003e6fb03f035230bc41",
... |
"""
Tests the msvs specific msvs_target_platform option.
"""
import TestGyp
import TestCommon
def RunX64(exe, stdout):
try:
test.run_built_executable(exe, stdout=stdout)
except WindowsError as e:
# Assume the exe is 64-bit if it can't load on 32-bit systems.
# Both versions of the error are required ... | {
"content_hash": "0baf077672c7945cead86efeeb44afe8",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 72,
"avg_line_length": 27.470588235294116,
"alnum_prop": 0.7130620985010707,
"repo_name": "chromium/gyp",
"id": "1645d6ec08e36715306ae4ee9cc9379d516b4266",
"size": "1114",
... |
"""
数据库模型类
"""
from sqlalchemy import create_engine,Table,MetaData,Column
from sqlalchemy.sql.sqltypes import String,Integer,TIMESTAMP,DATE
from sqlalchemy.orm import mapper,sessionmaker
import config
import time
db = create_engine("mysql://%s:%s@%s:%d/%s?charset=UTF8"%(config.MYSQL_USER,config.MYSQL_PASSWORD,config... | {
"content_hash": "aa2bc1c2652505652d42760225f7ff3f",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 169,
"avg_line_length": 28.479166666666668,
"alnum_prop": 0.6993416239941478,
"repo_name": "wangjun/notes-2",
"id": "e31d855122df8f8d72e73080c275816774899c5d",
"size": "140... |
"""Tests for _qubit_partitioning.py"""
import unittest
import numpy
from .fermion_partitioning import (pair_within, pair_within_simultaneously,
pair_within_simultaneously_binned,
pair_within_simultaneously_symmetric,
... | {
"content_hash": "584f1564bfb9f2e32fcf86a1ce22486c",
"timestamp": "",
"source": "github",
"line_count": 241,
"max_line_length": 78,
"avg_line_length": 34.024896265560166,
"alnum_prop": 0.5151219512195122,
"repo_name": "kevinsung/OpenFermion",
"id": "895c48592cda5e4ab7879586941f0beaeaa2a474",
"size"... |
import pickle
import numpy as np
import h5py
with open('../data.pkl', 'rb') as f:
samples, labels = pickle.load(f)
sample_size = len(labels)
samples = np.array(samples).reshape((sample_size, 2))
labels = np.array(labels).reshape((sample_size, 1))
h5_filename = 'data.h5'
with h5py.File(h5_filename, 'w') as h:
... | {
"content_hash": "0c49b5962bfc13b86d4cd38a1c8ad79a",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 53,
"avg_line_length": 25.833333333333332,
"alnum_prop": 0.6731182795698925,
"repo_name": "frombeijingwithlove/dlcv_for_beginners",
"id": "bd344fb2aed61462bc89481604aefd1d35b... |
"""Test functions relating to roles and actions."""
from core.domain import role_services
from core.tests import test_utils
import feconf
class RoleDomainUnitTests(test_utils.GenericTestBase):
"""Tests for PARENT_ROLES and ROLE_ACTIONS."""
PARENT_ROLES = role_services.PARENT_ROLES
ACTIONS = role_services... | {
"content_hash": "c3181aa0562a1ad689ab5d0c956d6dca",
"timestamp": "",
"source": "github",
"line_count": 97,
"max_line_length": 80,
"avg_line_length": 38.865979381443296,
"alnum_prop": 0.6079575596816976,
"repo_name": "MAKOSCAFEE/oppia",
"id": "ce8f09d2c8ddd93ea22e49e76452aa81151a33cd",
"size": "439... |
# Copyright (c) 2013 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""
Make sure disable specific warnings is extracted properly.
"""
import TestGyp
import sys
if sys.platform == 'win32':
test = TestGyp.TestGyp... | {
"content_hash": "df07cec64f351d3f03b2a263708818b4",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 78,
"avg_line_length": 29.903225806451612,
"alnum_prop": 0.6731391585760518,
"repo_name": "Jet-Streaming/gyp",
"id": "c264edb52195875a21f10f6799f536e1dc2f1fc9",
"size": "95... |
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('diet', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='diet',
name='deleted',
field=models.Bo... | {
"content_hash": "bd16f66efbfe7b6e670645090272e6f7",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 65,
"avg_line_length": 24.08,
"alnum_prop": 0.5598006644518272,
"repo_name": "ax003d/django-diet",
"id": "0d4f18bd26755f7b8caffd971690bd80071000eb",
"size": "626",
"binar... |
"""
Django settings for sbudget project.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.6/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
im... | {
"content_hash": "42f9d58fc53570aedf48317b2acb0d0a",
"timestamp": "",
"source": "github",
"line_count": 82,
"max_line_length": 71,
"avg_line_length": 24.085365853658537,
"alnum_prop": 0.7184810126582278,
"repo_name": "dsysme/osbudget",
"id": "98c544edac26292c7ac28b0d0d229bfed14ad434",
"size": "1975... |
import sys
_b = sys.version_info[0] < 3 and (lambda x: x) or (lambda x: x.encode("latin1"))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import symbol_database as _symbol_database
from go... | {
"content_hash": "8e2afef4b301a231554f8d500cd373e5",
"timestamp": "",
"source": "github",
"line_count": 370,
"max_line_length": 896,
"avg_line_length": 33.44864864864865,
"alnum_prop": 0.6329185520361991,
"repo_name": "dhermes/gcloud-python",
"id": "3fa4cf235cb2d218859ad15c98e9834b02704f36",
"size"... |
import os
_value = os.getenv('APP_ENV', 'DEVELOPMENT')
_settings = {
'PRODUCTION': {
'ENVIRONMENT': 'Production',
'FLASK_STATIC_FOLDER': '../client/dist',
'FLASK_TEMPLATE_FOLDER': '../client/dist',
'FLASK_CONFIG_OBJECT': 'server.config.flask_production'
},
'STAGING': {
... | {
"content_hash": "d3ced9074fd81b05e0afc166f2d01895",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 64,
"avg_line_length": 28.71794871794872,
"alnum_prop": 0.5821428571428572,
"repo_name": "rhlobo/bigtempo_server",
"id": "35227ad9cdaf7a7f6b9736d5d07ffdba00c9c7f5",
"size":... |
import random
from generator import ContactGenerator
import allure
def test_delete_some_contact(app, db, check_ui):
with allure.step("Given a contact list"):
old_contacts = db.get_contact_list()
if len(old_contacts) == 0:
app.contact.create(ContactGenerator().get_contact())
... | {
"content_hash": "d7c4a83ba673b756d244d68e3fefb9ca",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 108,
"avg_line_length": 39.27272727272727,
"alnum_prop": 0.6655092592592593,
"repo_name": "melipharo/stru-python19",
"id": "907184407acb8bc5e67338699596af6f1b9a0695",
"size... |
import unittest
from housecanary import utilities
class UtilitiesTestCase(unittest.TestCase):
"""Tests for Utilities"""
def test_get_readable_time_string(self):
self.assertEqual('30 Seconds', utilities.get_readable_time_string(30))
self.assertEqual('1 Minute', utilities.get_readable_time_stri... | {
"content_hash": "05d7a82c991d692349bde1f4211be615",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 94,
"avg_line_length": 52.125,
"alnum_prop": 0.7206235011990407,
"repo_name": "housecanary/hc-api-python",
"id": "198d176e26a3e2ee0f72b0f562a58be9ed140697",
"size": "834",
... |
from temboo.core.choreography import Choreography
from temboo.core.choreography import InputSet
from temboo.core.choreography import ResultSet
from temboo.core.choreography import ChoreographyExecution
import json
class ExportViews(Choreography):
def __init__(self, temboo_session):
"""
Create a n... | {
"content_hash": "854322e5e99d588b76b1281994e33805",
"timestamp": "",
"source": "github",
"line_count": 71,
"max_line_length": 145,
"avg_line_length": 38.95774647887324,
"alnum_prop": 0.6840202458423716,
"repo_name": "jordanemedlock/psychtruths",
"id": "a34369222cef1d7ebad3ded0c4493c8cc24e3bc4",
"s... |
import responses
import json
from .helpers import mock_file, ClientTestCase
class TestClientPlan(ClientTestCase):
def setUp(self):
super(TestClientPlan, self).setUp()
self.base_url = '{}/plans'.format(self.base_url)
self.plan_id = 'plan_8kihN0YqhnF8a7'
@responses.activate
def te... | {
"content_hash": "d619016deb678adc569b0cac6d629469",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 79,
"avg_line_length": 35.24324324324324,
"alnum_prop": 0.6303680981595092,
"repo_name": "razorpay/razorpay-python",
"id": "0d2a560e023776c9e5e4c7fb5b1d624004b0f9da",
"size... |
def generate_test(index, labels, data):
def test(self):
for event_id in data[index]:
method = getattr(self, labels[event_id])
method()
return test
def _event_sequence_test_impl(labels, data):
def _(clazz):
for i in range(0, len(data)):
test_name = 'test_... | {
"content_hash": "7dbbfe0cfaf96bf14c60e5b2eee34742",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 84,
"avg_line_length": 32.45454545454545,
"alnum_prop": 0.6092436974789915,
"repo_name": "kaoru2010/test_case_generator",
"id": "97b4c96bb8c594b910114a2a86daed73053d32e8",
... |
from .activations import relu
from .activations import sigmoid
from .activations import softmax
from .loss_functions import softmax_cross_entropy_with_logits
from .utils import softmax_func
from .conv import conv2d
from .pooling import maxPool
__all__ = ['relu', 'sigmoid', 'softmax', 'softmax_cross_entropy_with_logits... | {
"content_hash": "3d4ebbf6cffee629d4b7489fdf2002d4",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 77,
"avg_line_length": 37,
"alnum_prop": 0.7486486486486487,
"repo_name": "upul/Aurora",
"id": "b538bfaeb902a47e70dd386f9a5d40cf9f9281b8",
"size": "370",
"binary": false,... |
import sys, os, getopt, subprocess
from os.path import exists, abspath, dirname, basename
# The PCI device class for ETHERNET devices
ETHERNET_CLASS = "0200"
# global dict ethernet devices present. Dictionary indexed by PCI address.
# Each device within this is itself a dictionary of device properties
devices = {}
#... | {
"content_hash": "fc78f8aa1b8cb53a6ded91fdf8e3834f",
"timestamp": "",
"source": "github",
"line_count": 505,
"max_line_length": 91,
"avg_line_length": 36.73267326732673,
"alnum_prop": 0.5909973045822102,
"repo_name": "catap/mtcp",
"id": "8523f828024f7444f5784a2e580b82012bd62636",
"size": "20229",
... |
import os
import pytest
import oddt
from oddt.utils import check_molecule, chunker, compose_iter
test_data_dir = os.path.dirname(os.path.abspath(__file__))
# common file names
dude_data_dir = os.path.join(test_data_dir, 'data', 'dude', 'xiap')
xiap_crystal_ligand = os.path.join(dude_data_dir, 'crystal_ligand.sdf')
x... | {
"content_hash": "28d334eed17a1ca8de33f760e14226d3",
"timestamp": "",
"source": "github",
"line_count": 65,
"max_line_length": 71,
"avg_line_length": 29.307692307692307,
"alnum_prop": 0.6377952755905512,
"repo_name": "oddt/oddt",
"id": "b69f5448b561ab45fd97cfb71535d4eccc8d008d",
"size": "1905",
"... |
"""
Design the CombinationIterator class:
CombinationIterator(string characters, int combinationLength) Initializes the object with a string characters of sorted distinct lowercase English letters and a number combinationLength as arguments.
next() Returns the next combination of length combinationLength in lexicogra... | {
"content_hash": "fda0d7981c30a8dcc3c1604ea5008449",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 199,
"avg_line_length": 29.448275862068964,
"alnum_prop": 0.6557377049180327,
"repo_name": "franklingu/leetcode-solutions",
"id": "1210ab4563f2b3039080697e5d251c5fb8e38b96",
... |
import sys
import os.path
import argparse
from vortexfitting import fitting
from vortexfitting import schemes
from vortexfitting import detection
from vortexfitting import output
from vortexfitting import classes
def main():
parser = argparse.ArgumentParser(description='Optional app description',
... | {
"content_hash": "6b95d74be7bed4b7105803879c3bf7e0",
"timestamp": "",
"source": "github",
"line_count": 195,
"max_line_length": 118,
"avg_line_length": 46.37435897435898,
"alnum_prop": 0.5389804268494969,
"repo_name": "guilindner/VortexFitting",
"id": "c50c2139d9654eba56ad0b17079674a3402d0076",
"si... |
"""
PURPOSE: For testing syncing utilities
AUTHOR: dylangregersen
DATE: Mon Sep 15 00:52:58 2014
"""
# ########################################################################### #
# import modules
from __future__ import print_function, division, unicode_literals
import os
from unittest import TestCase
from meetup.... | {
"content_hash": "644df971a2c64ea33c9b87914817c43c",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 90,
"avg_line_length": 30.072727272727274,
"alnum_prop": 0.5217654171704957,
"repo_name": "astrodsg/django-meetup",
"id": "1e8b79d32e57f577dd3d868fc4108e5c8f94611d",
"size"... |
def extractNeoluxblogWordpressCom(item):
'''
Parser for 'neoluxblog.wordpress.com'
'''
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or "preview" in item['title'].lower():
return None
tagmap = [
('PRC', 'PRC', 'translated'),
('Loit... | {
"content_hash": "b97c8f5bab0aa0112e0c9a0f743f2080",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 104,
"avg_line_length": 26.61904761904762,
"alnum_prop": 0.6350626118067979,
"repo_name": "fake-name/ReadableWebProxy",
"id": "24419fce41c051e1493957a7d75ca3b787fa7307",
"s... |
from symbolic import *
from reference import *
from head import *
from tag import *
from remote import *
# name fixes
import head
head.RemoteReference = RemoteReference
del(head)
import symbolic
for item in (HEAD, Head, RemoteReference, TagReference, Reference, SymbolicReference):
setattr(symbolic, item.__name__, i... | {
"content_hash": "3933abac1fddbf0c6dd54627f6d27026",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 86,
"avg_line_length": 18.894736842105264,
"alnum_prop": 0.766016713091922,
"repo_name": "qwinner/GitPython",
"id": "fc8ce644cf8f8ca89f17e1de691743284d255011",
"size": "418... |
import RPi.GPIO as GPIO
GPIO.setwarnings(False)
GPIO.setmode(GPIO.BCM)
GPIO.setup(3, GPIO.IN, pull_up_down=GPIO.PUD_UP)
if(GPIO.input(3) ==1):
print('NO')
else:
print('YES')
GPIO.cleanup()
| {
"content_hash": "184b379f0466e868e0c06c443f46e10e",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 48,
"avg_line_length": 17.545454545454547,
"alnum_prop": 0.6994818652849741,
"repo_name": "CAES-Python/Coffee_maker",
"id": "3e19ee57ac41ead72b7a416ad842cd46bdb07e23",
"siz... |
import os
import yaml
import shutil
from unittest import TestCase
from nose.tools import *
from project_generator.generate import Generator
from project_generator.project import Project
from project_generator.settings import ProjectSettings
from project_generator.tools.coide import CoIDEdefinitions, Coide
from .simp... | {
"content_hash": "f8bef7b2c649f834c07936a130067714",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 89,
"avg_line_length": 38.34615384615385,
"alnum_prop": 0.6780341023069207,
"repo_name": "sarahmarshy/project_generator",
"id": "e54a560bdaff0065c69345825b3ba8876ef0bef6",
... |
from django import template
from .. import Menu
register = template.Library()
class MenuNode(template.Node):
def __init__(self):
pass
def render(self, context):
# if a 500 error happens we get an empty context, in which case
# we should just return to let the 500.html template render
... | {
"content_hash": "f3a13750cb3cd6ae8f4523ed8d0e333f",
"timestamp": "",
"source": "github",
"line_count": 66,
"max_line_length": 89,
"avg_line_length": 34.13636363636363,
"alnum_prop": 0.5481580115401686,
"repo_name": "borgstrom/django-simple-menu",
"id": "598c5ae8043ae94aa5048586066d9378b1d479bc",
"... |
"""
visionquest 0.2
Copyright (C) 2012-2013, James Jolly
See MIT-LICENSE.txt for legalese and README.md for usage.
This script crawls a directory of image files grouped
into classes and computes features for each image. It
then writes them to outfile.
"""
import commands
import sys
from visionquest.image_ops import ge... | {
"content_hash": "87cab478bfc92621b6e5a5a022d1d328",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 59,
"avg_line_length": 27.47222222222222,
"alnum_prop": 0.6511627906976745,
"repo_name": "jamesjolly/visionquest",
"id": "c0770b0402799480ddf01ac9f16fcd350eae40a5",
"size":... |
"""Tests for fast_bert_normalizer op in tensorflow_text."""
from absl.testing import parameterized
import numpy as np
import tensorflow as tf
import tensorflow_text as tf_text
from tensorflow.lite.python import interpreter
from tensorflow.python.framework import test_util
from tensorflow.python.ops import string_ops
... | {
"content_hash": "c3b927dee561a6cdd2b5084608411d0d",
"timestamp": "",
"source": "github",
"line_count": 205,
"max_line_length": 82,
"avg_line_length": 38.84878048780488,
"alnum_prop": 0.6560773480662984,
"repo_name": "tensorflow/text",
"id": "d578885abc72ad9385e75420bfea8ae633da5ee0",
"size": "8603... |
from __future__ import print_function, division
from sympy import Basic, Expr, sympify
from .matexpr import ShapeError
class Trace(Expr):
"""Matrix Trace
Represents the trace of a matrix expression.
>>> from sympy import MatrixSymbol, Trace, eye
>>> A = MatrixSymbol('A', 3, 3)
>>> Trace(A)
... | {
"content_hash": "4e67066e4fb873448bca78ab99c8c7d4",
"timestamp": "",
"source": "github",
"line_count": 71,
"max_line_length": 77,
"avg_line_length": 22.3943661971831,
"alnum_prop": 0.5547169811320755,
"repo_name": "Mitchkoens/sympy",
"id": "7f8cae35e0c5e32e92634741b6e4cd60938aae5c",
"size": "1590"... |
from buck import format_watchman_query_params, glob_internal, LazyBuildEnvPartial
from pathlib import Path, PurePosixPath, PureWindowsPath
import os
import shutil
import tempfile
import unittest
class FakePathMixin(object):
def glob(self, pattern):
return self.glob_results.get(pattern)
def is_file(se... | {
"content_hash": "4643153862744df0265b85d2d668ab32",
"timestamp": "",
"source": "github",
"line_count": 285,
"max_line_length": 88,
"avg_line_length": 33.575438596491225,
"alnum_prop": 0.4795694429929982,
"repo_name": "neonichu/buck",
"id": "42c26b9ee96fd21cc954fd5e15e110f599a4e185",
"size": "9569"... |
from pocketworkers import worker
@worker
def custom_compute(a):
result = None
while True:
try:
data = yield result
result = data + a
except GeneratorExit:
break
def test():
mycoroutine = custom_compute(5)
with mycoroutine.start(... | {
"content_hash": "a50a1adf83d33683dbc9c96db257057a",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 62,
"avg_line_length": 19.75,
"alnum_prop": 0.5348101265822784,
"repo_name": "lulupac/quickworkers",
"id": "81a47a64e38c4665b2f46dd7f29168e6e8f0478c",
"size": "632",
"bin... |
from __future__ import absolute_import, division, print_function
import distutils.sysconfig
import os.path
import site
import sys
# Setup
try:
# Third-party
from setuptools import setup
except ImportError:
# Standard library
from distutils.core import setup
# Local/library specific
import logrep
# F... | {
"content_hash": "7bdc045c61b7d96d7087edcdb1bcae78",
"timestamp": "",
"source": "github",
"line_count": 54,
"max_line_length": 77,
"avg_line_length": 32.370370370370374,
"alnum_prop": 0.6413043478260869,
"repo_name": "ClockworkNet/wtop",
"id": "d28c6881c78173559795f803a67708103011b7e3",
"size": "18... |
import mock
from neutronclient.common import exceptions as neutron_client_exc
from neutronclient.v2_0 import client
from oslo_utils import uuidutils
from ironic.common import dhcp_factory
from ironic.common import exception
from ironic.common import pxe_utils
from ironic.conductor import task_manager
from ironic.dhcp... | {
"content_hash": "25edfa25df708eb3b89984ca31b6ea6d",
"timestamp": "",
"source": "github",
"line_count": 401,
"max_line_length": 79,
"avg_line_length": 46.952618453865334,
"alnum_prop": 0.5635755258126195,
"repo_name": "ruyang/ironic",
"id": "8d1005ce61db2e95fcbe603531daead3fd3616a9",
"size": "19465... |
"""
Provide an SQLALchemy connector for the eGenix mxODBC commercial
Python adapter for ODBC. This is not a free product, but eGenix
provides SQLAlchemy with a license for use in continuous integration
testing.
This has been tested for use with mxODBC 3.1.2 on SQL Server 2005
and 2008, using the SQL Server Native driv... | {
"content_hash": "9509fbe643afafea7d2d405fc65540a3",
"timestamp": "",
"source": "github",
"line_count": 143,
"max_line_length": 79,
"avg_line_length": 35.82517482517483,
"alnum_prop": 0.629709154792114,
"repo_name": "alex/sqlalchemy",
"id": "ebdcd27585696b81ff7714e9f4a7a05b84027104",
"size": "5362"... |
import sys, os
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#sys.path.insert(0, os.path.abspath('.'))
# -- General configurat... | {
"content_hash": "9ad3d677307bd28a7d8810fb85187c13",
"timestamp": "",
"source": "github",
"line_count": 251,
"max_line_length": 84,
"avg_line_length": 32.235059760956176,
"alnum_prop": 0.7015202076381164,
"repo_name": "calavera/docker",
"id": "a143e821be17e7231479b754991ffdb43a18255f",
"size": "850... |
"""This code example archives a proposal line item.
To determine which proposal line items exist, run
get_all_proposal_line_items.py.
"""
__author__ = 'Nicholas Chen'
# Import appropriate modules from the client library.
from googleads import dfp
# Set the id of the proposal line item to archive.
PROPOSAL_LINE_ITEM... | {
"content_hash": "2e9983b365a69fddd5592d11388c6f09",
"timestamp": "",
"source": "github",
"line_count": 66,
"max_line_length": 76,
"avg_line_length": 31.484848484848484,
"alnum_prop": 0.6525505293551492,
"repo_name": "coxmediagroup/googleads-python-lib",
"id": "5213530b9f9abe658216de008b44fa3d7660a92... |
"""
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this ... | {
"content_hash": "eab013bd9268c5013d878a71382207ea",
"timestamp": "",
"source": "github",
"line_count": 114,
"max_line_length": 112,
"avg_line_length": 30.657894736842106,
"alnum_prop": 0.6474964234620887,
"repo_name": "alexryndin/ambari",
"id": "606a00099ec38fd67b06c897acff366052cfbfd2",
"size": "... |
"""Custom parser for python-ldap"""
URL = ("http://python-ldap.cvs.sourceforge.net/viewvc/python-ldap/python-ldap"
"/CHANGES")
def get_urls(releases, **kwargs):
return {URL}, set()
| {
"content_hash": "ab8b66e81a742795906d21faca031c56",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 78,
"avg_line_length": 24.375,
"alnum_prop": 0.6564102564102564,
"repo_name": "pyupio/changelogs",
"id": "4e51c841825e3c90aef3dc9295cbdad86a8bf922",
"size": "195",
"binary... |
"""
Example of a custom MQTT component.
Shows how to communicate with MQTT. Follows a topic on MQTT and updates the
state of an entity to the last message received on that topic.
Also offers a service 'set_state' that will publish a message on the topic that
will be passed via MQTT to our message received listener. C... | {
"content_hash": "dbb625be2faef7cb3e390f8de497041f",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 79,
"avg_line_length": 31.581818181818182,
"alnum_prop": 0.7179044329303397,
"repo_name": "justyns/home-assistant",
"id": "b4e5e89a9775525a3fa6df6bb56ff182894cc98f",
"size"... |
"""
This module defines all exception classes in the whole package.
"""
class ISO8601Error(ValueError):
"""Raised when the given ISO string can not be parsed."""
| {
"content_hash": "abff29a842f44e8e7124e649c8baf305",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 63,
"avg_line_length": 24,
"alnum_prop": 0.7202380952380952,
"repo_name": "gweis/isodate",
"id": "068429f2f6730ca37cc17367b78f31ee93f9ea3a",
"size": "168",
"binary": false... |
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'network'}
DOCUMENTATION = '''
---
module: nxos_evpn_global
extends_documentation_fragment: nxos
version_added: "2.2"
short_description: Handles the EVPN control plane for VXLAN.
description:
... | {
"content_hash": "1b1d17bd1d6a4914df05436303905f73",
"timestamp": "",
"source": "github",
"line_count": 90,
"max_line_length": 87,
"avg_line_length": 25.155555555555555,
"alnum_prop": 0.6431095406360424,
"repo_name": "e-gob/plataforma-kioscos-autoatencion",
"id": "ab088f3b35372c933b0c98c382f1809189db... |
from setuptools import setup, find_packages
import os
version = '0.1'
here = os.path.abspath(os.path.dirname(__file__))
README = open(os.path.join(here, 'README.txt')).read()
setup(
name='lfs-shipping-zzw',
version=version,
description='Shipping based on Zone, ZipCode and Weight. For LFS',
long_descr... | {
"content_hash": "39a1aad4cd8b772b83253ca32dcf7f82",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 70,
"avg_line_length": 27.96969696969697,
"alnum_prop": 0.6403033586132177,
"repo_name": "tzicatl/lfs-shipping-zzw",
"id": "03268d9b3451ba3edb702d31f5b6ea525a0b62d1",
"size... |
"""
config tests.
"""
import os
import pickle
import platform
import sys
from unittest import mock
import git
import numpy as np
import pytest
import wandb
from wandb import env
from wandb import wandb_sdk
from wandb.errors import MultiprocessError, UsageError
from wandb.proto.wandb_internal_pb2 import RunPreempting... | {
"content_hash": "477c836af5e15ec184a1da3425d459dc",
"timestamp": "",
"source": "github",
"line_count": 870,
"max_line_length": 118,
"avg_line_length": 33.3632183908046,
"alnum_prop": 0.6241645421346379,
"repo_name": "wandb/client",
"id": "72e87be6e22166292592fc15af26f878e03614c6",
"size": "29026",... |
from nodes import Node
class Iterator(Node):
char = "o"
args = 0
results = 1
contents = 0
def func(self):
"""contents += 1
return contents-1"""
Iterator.contents += 1
return Iterator.contents-1 | {
"content_hash": "19b77d969d5d87aa3a198d21aef2f2f4",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 34,
"avg_line_length": 18.692307692307693,
"alnum_prop": 0.5679012345679012,
"repo_name": "muddyfish/PYKE",
"id": "67f92ae8151dc1f24b21fcc37598fc86245c342c",
"size": "266",... |
import struct
import sys
def _interpret_header(header):
assert len(header) == 8
(magic, length) = struct.unpack('>4sI', header)
assert length >= len(header)
return (magic, length)
def _read_header(file):
return _interpret_header(file.read(8))
def _write_header(file, magic, length):
header ... | {
"content_hash": "4fa730c078b02cf1e5af8d72a4b35882",
"timestamp": "",
"source": "github",
"line_count": 92,
"max_line_length": 76,
"avg_line_length": 26.5,
"alnum_prop": 0.5877768662838392,
"repo_name": "endlessm/chromium-browser",
"id": "86e2e07b663a4cda74547855684667e14f2ea173",
"size": "2921",
... |
from builtins import range
from builtins import object
from proteus import Comm, Profiling
import numpy as np
import numpy.testing as npt
import pytest
import os
comm = Comm.init()
Profiling.procID = comm.rank()
class MockMat(object):
""" petsc4py-based mock SuperLU Matrix for testing. Filled like this:
[ 1... | {
"content_hash": "4edf7188fc2d1bf41bce83f329dae76e",
"timestamp": "",
"source": "github",
"line_count": 349,
"max_line_length": 92,
"avg_line_length": 26.421203438395416,
"alnum_prop": 0.6125149116147923,
"repo_name": "erdc/proteus",
"id": "51f41f999e027d0a60e50bd439e9a1a74ae0adc7",
"size": "9221",... |
from test_framework.test_framework import BitcoinTestFramework
from decimal import Decimal
def check_array_result(object_array, to_match, expected):
"""
Pass in array of JSON objects, a dictionary with key/value pairs
to match against, and another dictionary with expected key/value
pairs.
"""
... | {
"content_hash": "d2c8a1c824f8e5ac102bf14595a04e2d",
"timestamp": "",
"source": "github",
"line_count": 91,
"max_line_length": 105,
"avg_line_length": 48.30769230769231,
"alnum_prop": 0.5070518653321201,
"repo_name": "litecoinz-project/litecoinz",
"id": "e048c816994471439b5792ee2e5a41b085c8ac24",
"... |
"""Tests for training routines."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import logging
import sys
import numpy as np
import six
from tensorflow.python import keras
from tensorflow.python.data.experimental.ops import cardinality
from tensorflow.... | {
"content_hash": "f74d6cb5de4d6286cb236dcb83292dd2",
"timestamp": "",
"source": "github",
"line_count": 573,
"max_line_length": 80,
"avg_line_length": 39.44153577661431,
"alnum_prop": 0.6511504424778761,
"repo_name": "theflofly/tensorflow",
"id": "c2e893dbe0dcc54590225dc8427b4249caed33f8",
"size": ... |
from django.contrib import admin
from gnsite.models import Post
from django.contrib.auth.models import User
# admin registration
admin.site.register(Post)
import random
from datetime import datetime, timedelta
# fixtures & such
def gen_rand_date():
random_recent_date = datetime.now() - timedelta(random.choice(9... | {
"content_hash": "033f878e16a0ac575dc991e8e9917f83",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 129,
"avg_line_length": 32.94642857142857,
"alnum_prop": 0.6205962059620597,
"repo_name": "thomaswilley/geeknews",
"id": "b1a9487f59e90e3f037e7e1a42bcc454e5d2dbf9",
"size":... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from collections import defaultdict
from datetime import datetime, timedelta
import json
import logging
import pandas as pd
import pickle
import re
import time
import tra... | {
"content_hash": "777951b6525d21281c27493e77fb67a9",
"timestamp": "",
"source": "github",
"line_count": 2335,
"max_line_length": 85,
"avg_line_length": 35.2813704496788,
"alnum_prop": 0.5487363744507295,
"repo_name": "BRD-CD/superset",
"id": "b752dd4d487b2419711695b0b99a2ddc136ef7df",
"size": "8238... |
import json
import NetworkTools
import os
import urllib
from ..models import plugin, user, digest
from ..waveapi import waveservice
PYTIDE_LOGIN_URL = "http://pytidewave.appspot.com/account/remotelogin"
class modelConverter:
@staticmethod
def SearchResults(wsresults, page, maxpage):
''' Turns a Data... | {
"content_hash": "3aefc3bfa4b9ddeab15ba7006387b4af",
"timestamp": "",
"source": "github",
"line_count": 86,
"max_line_length": 92,
"avg_line_length": 36.47674418604651,
"alnum_prop": 0.5425565827223462,
"repo_name": "campadrenalin/PyTide",
"id": "f5f79debf87643fbffcb0c69829b508513be28db",
"size": "... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.