text stringlengths 4 1.02M | meta dict |
|---|---|
"""Unit test for treadmill.scheduler
"""
import time
import unittest
import sys
# Disable too many lines in module warning.
#
# pylint: disable=C0302
import mock
import numpy as np
from treadmill import scheduler
from functools import reduce
_TRAITS = dict()
# Helper functions to convert user readable traits to... | {
"content_hash": "8cda7ecee7d3acfbc6f9ba43a340ae06",
"timestamp": "",
"source": "github",
"line_count": 1322,
"max_line_length": 79,
"avg_line_length": 38.60665658093797,
"alnum_prop": 0.5710255104040127,
"repo_name": "keithhendry/treadmill",
"id": "526ca0559e67d11f71279e5b7a7bb52f0e88d879",
"size"... |
from PyQt4 import QtCore, QtGui
import sys
from Settings_win import SettingsWindow
from preferences import Preferences
from data_dumper import DataDumper
try:
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
def _fromUtf8(s):
return s
try:
_encoding = QtGui.QApplication.UnicodeUTF8
... | {
"content_hash": "6bfd215c44c13ce4086939d8ca9e3091",
"timestamp": "",
"source": "github",
"line_count": 234,
"max_line_length": 113,
"avg_line_length": 53.67948717948718,
"alnum_prop": 0.6882413820555688,
"repo_name": "kevintpeng/Data-Dumper",
"id": "f11bb809309e4b14619886810caf65adb2c10119",
"size... |
import unittest
from ctypes import *
import re, sys
if sys.byteorder == "little":
THIS_ENDIAN = "<"
OTHER_ENDIAN = ">"
else:
THIS_ENDIAN = ">"
OTHER_ENDIAN = "<"
def normalize(format):
# Remove current endian specifier and white space from a format
# string
if format is None:
retur... | {
"content_hash": "72a0c14009eaabd4a09b0780cdaa18c3",
"timestamp": "",
"source": "github",
"line_count": 203,
"max_line_length": 98,
"avg_line_length": 38.389162561576356,
"alnum_prop": 0.4288464006159374,
"repo_name": "DirtyPiece/dancestudio",
"id": "3e007e1b41d5b6beb34499eaeae1f578161a6df7",
"size... |
from random import randint
from datetime import date
from time import sleep
from lettuce import *
from rapidsms.contrib.locations.models import *
from django.template.defaultfilters import slugify
from survey.features.page_objects.households import NewHouseholdPage, HouseholdsListPage, HouseholdDetailsPage, EditHous... | {
"content_hash": "6ddc41977ec221c014973e727c9888d1",
"timestamp": "",
"source": "github",
"line_count": 235,
"max_line_length": 252,
"avg_line_length": 40.646808510638294,
"alnum_prop": 0.7364949748743719,
"repo_name": "unicefuganda/mics",
"id": "5423382f32d8c64694870ddec514b4e2ec594d40",
"size": "... |
"""Implements ProcessPoolExecutor.
The follow diagram and text describe the data-flow through the system:
|======================= In-process =====================|== Out-of-process ==|
+----------+ +----------+ +--------+ +-----------+ +---------+
| | => | Work Ids | | | ... | {
"content_hash": "8820075232cef6865bfa6ed3812dc19b",
"timestamp": "",
"source": "github",
"line_count": 670,
"max_line_length": 82,
"avg_line_length": 40.07761194029851,
"alnum_prop": 0.5710934008639952,
"repo_name": "huguesv/PTVS",
"id": "ce7d642b098a71f5150e64bd4d16c1f2f804ff47",
"size": "26955",... |
from contextlib import contextmanager
import onnx
class ModelAccessor:
"""This class stores the onnx model that is manipulated by the onnx blocks."""
def __init__(self, model):
self._model = model
self._eval_model = None
@property
def model(self):
"""ModelAccessor property t... | {
"content_hash": "8bcea20508951a05342051f2653ea449",
"timestamp": "",
"source": "github",
"line_count": 62,
"max_line_length": 118,
"avg_line_length": 30.806451612903224,
"alnum_prop": 0.6727748691099477,
"repo_name": "microsoft/onnxruntime",
"id": "1e1780345e278f29ad891497f3d9049832cc35b9",
"size"... |
import os
import shutil
import tempfile
import unittest
from lobster.core import Dataset
from lobster import fs, se, util
class TestDataset(unittest.TestCase):
@classmethod
def setUpClass(cls):
path = os.path.expandvars(
os.environ.get('LOBSTER_STORAGE', '/hadoop/store/user/') +
... | {
"content_hash": "1149751f4dfe94a6610b9ada22612262",
"timestamp": "",
"source": "github",
"line_count": 75,
"max_line_length": 91,
"avg_line_length": 36.29333333333334,
"alnum_prop": 0.5242468772961058,
"repo_name": "matz-e/lobster",
"id": "d02d581df1b0e45e7cef7bb406285f120bfe8e51",
"size": "2722",... |
import copy
import logging.handlers
import os
from configparser import DEFAULTSECT, ConfigParser
from typing import Dict
from sydent.config.crypto import CryptoConfig
from sydent.config.database import DatabaseConfig
from sydent.config.email import EmailConfig
from sydent.config.general import GeneralConfig
from syden... | {
"content_hash": "1552948e5d72edd2a209df019b02409a",
"timestamp": "",
"source": "github",
"line_count": 248,
"max_line_length": 99,
"avg_line_length": 40.84274193548387,
"alnum_prop": 0.6167440023694343,
"repo_name": "matrix-org/sydent",
"id": "b835468550c1d1824c7c473ed64f2185fc0cec4e",
"size": "10... |
import mxnet as mx
from mxnet.test_utils import *
from get_data import get_libsvm_data
from linear_model import *
import argparse
import os
parser = argparse.ArgumentParser(description="Run sparse linear classification " \
"with distributed kvstore",
... | {
"content_hash": "1f254c69f37ca3bf4ad6d566e9626675",
"timestamp": "",
"source": "github",
"line_count": 116,
"max_line_length": 102,
"avg_line_length": 42.86206896551724,
"alnum_prop": 0.6108205953338697,
"repo_name": "kkk669/mxnet",
"id": "70f896386cbc8249ef3042ac1ddbcd84d1731cb7",
"size": "5758",... |
try:
from unittest import mock
except ImportError:
import mock
from docker_custodian.docker_autostop import (
build_container_matcher,
get_opts,
has_been_running_since,
main,
stop_container,
stop_containers,
)
def test_stop_containers(mock_client, container, now):
matcher = mock.M... | {
"content_hash": "d556d1b2ee11fece092d5a25ab3ea46e",
"timestamp": "",
"source": "github",
"line_count": 83,
"max_line_length": 74,
"avg_line_length": 30.903614457831324,
"alnum_prop": 0.6881091617933723,
"repo_name": "dnephin/docker-custodian",
"id": "83b428a382d0c4f64efcd78bec84f6d6280b329c",
"siz... |
"""
:Copyright: 2006-2020 Jochen Kupperschmidt
:License: Modified BSD, see LICENSE for details.
"""
import pytest
from byceps.events.user_badge import UserBadgeAwarded
from byceps.services.user import event_service
from byceps.services.user_badge import (
command_service as badge_command_service,
service as b... | {
"content_hash": "e31f0aec36511e223b65a60964223e33",
"timestamp": "",
"source": "github",
"line_count": 168,
"max_line_length": 78,
"avg_line_length": 27.904761904761905,
"alnum_prop": 0.702005119453925,
"repo_name": "m-ober/byceps",
"id": "a13033c18a985950fac977430b14fcc52bcaefa6",
"size": "4688",... |
from __future__ import unicode_literals
import sys, os, os.path
# 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.inser... | {
"content_hash": "346331d22f0e75fa020fc0457e8f2d05",
"timestamp": "",
"source": "github",
"line_count": 257,
"max_line_length": 170,
"avg_line_length": 33.24124513618677,
"alnum_prop": 0.7064263139412384,
"repo_name": "jabbrwcky/selenium",
"id": "6ae1a201bd1a434fa75293919e288b9594cf1a1a",
"size": "... |
import os
import os.path
import sys
if os.path.exists('../bind2nsd/Config.py'):
sys.path.append('../bind2nsd')
from Config import *
from Parser import *
from Zone import *
from Utils import *
else:
from bind2nsd.Config import *
from bind2nsd.Parser import *
from bind2nsd.Zone import *
from b... | {
"content_hash": "14afb1839b2e595e117db5bc6f707c8e",
"timestamp": "",
"source": "github",
"line_count": 223,
"max_line_length": 77,
"avg_line_length": 23.62780269058296,
"alnum_prop": 0.5991649269311065,
"repo_name": "jmkeyes/nsd",
"id": "4b9149579e6074e2b721f556dfdb650a0c5e311b",
"size": "6452",
... |
"""
Run Regression Test Suite
This module calls down into individual test cases via subprocess. It will
forward all unrecognized arguments onto the individual test scripts, other
than:
- `-extended`: run the "extended" test suite in addition to the basic one.
- `-win`: signal that this is running in a Windows... | {
"content_hash": "b32cff02428ab9dd9373e21eb7cf049a",
"timestamp": "",
"source": "github",
"line_count": 267,
"max_line_length": 90,
"avg_line_length": 30.05992509363296,
"alnum_prop": 0.6172439571392973,
"repo_name": "sinraf96/electrum",
"id": "4dcd1f90f736339ed90f624edc25c04b16d22458",
"size": "82... |
import functools
import itertools
import operator
from oslo_log import log as logging
from oslo_serialization import jsonutils
from oslo_utils import excutils
import six
from nova import block_device
import nova.conf
from nova import exception
from nova.i18n import _LE
from nova.i18n import _LI
from nova.i18n import ... | {
"content_hash": "de0412cced30e05d7268df4097ae135c",
"timestamp": "",
"source": "github",
"line_count": 556,
"max_line_length": 79,
"avg_line_length": 38.19604316546763,
"alnum_prop": 0.5716909167961577,
"repo_name": "alaski/nova",
"id": "9e7f0253dcf64cb1155abe9472ead6a1803f6a4c",
"size": "21835",
... |
import maya
import os
import sys
def __makeStubFunc(command, library):
pass
def processCommandList():
"""
Process the "commandList" file that contains the mappings between command names and the
libraries in which they are found. This function will install stub functions in maya.cmds
for all comm... | {
"content_hash": "2fe28e8412bea99a44fd899fd83e036b",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 96,
"avg_line_length": 21.043478260869566,
"alnum_prop": 0.7252066115702479,
"repo_name": "CountZer0/PipelineConstructionSet",
"id": "14c27d56912efd341c51cf0681c64df3e8b6ea4c... |
"""Tests for tf.layers.convolutional."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
from tensorflow.python.framework import ops
from tensorflow.python.framework import tensor_shape
from tensorflow.python.layers import convolutional ... | {
"content_hash": "0a438b21d3509cd0513e90c07bcda58b",
"timestamp": "",
"source": "github",
"line_count": 810,
"max_line_length": 80,
"avg_line_length": 45.71111111111111,
"alnum_prop": 0.6506238859180036,
"repo_name": "alisidd/tensorflow",
"id": "42a2d775349042f20c48e40385c440705d92912b",
"size": "3... |
import enum
import uuid
from datetime import datetime
from typing import List, Optional
import odin
from odin.annotated_resource import Options
class Author(odin.AResource):
name: str
class Meta:
namespace = None
class Publisher(odin.AResource):
name: str
class Meta:
namespace = N... | {
"content_hash": "626bf06e098c8402f0753938523af941",
"timestamp": "",
"source": "github",
"line_count": 96,
"max_line_length": 61,
"avg_line_length": 19.260416666666668,
"alnum_prop": 0.5981611681990265,
"repo_name": "python-odin/odin",
"id": "721bf1c11caf1dd46e85657e82405a4497c1c008",
"size": "184... |
from .visualize import MODALITY_ORDER
n_events = 'Number of alternative events'
def tidify_modalities(modality_assignments, name='event_id'):
modalities_tidy = modality_assignments.stack().reset_index()
modalities_tidy = modalities_tidy.rename(
columns={'level_1': name, 0: "modality"})
return mod... | {
"content_hash": "31d05535c172660333b013216a1b15c4",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 79,
"avg_line_length": 39.43333333333333,
"alnum_prop": 0.7109044801352493,
"repo_name": "YeoLab/anchor",
"id": "1248440ef4d9a1acc4045fb22658a30d1d4d90ca",
"size": "1183",
... |
from __future__ import annotations
import itertools
import logging
from dataclasses import dataclass
from enum import Enum
from pathlib import PurePath
from typing import Dict, Iterable, Optional
from pants.backend.python.dependency_inference import module_mapper, parse_python_dependencies
from pants.backend.python.d... | {
"content_hash": "d3f5b27aa510d557cdd2f56781db32f5",
"timestamp": "",
"source": "github",
"line_count": 702,
"max_line_length": 100,
"avg_line_length": 35.8988603988604,
"alnum_prop": 0.6812428078250863,
"repo_name": "pantsbuild/pants",
"id": "c1ae9274c523f40bf4f3a7c374d40d49db6a869e",
"size": "253... |
import gimpbbio.gpio as gpio
import time
import datetime
count = 0
data_file = open("/var/tmp/test_data.txt", "w+")
def callback(pin):
data_file.write(str(datetime.datetime.now()) + '\n')
global count
count += 1
input_pin = gpio.pins.p8_8
input_pin.open_for_input()
input_pin.watch(gpio.RISING, callback)
while Tr... | {
"content_hash": "587488b5f5a25a4a1f59f9a596a0f43e",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 53,
"avg_line_length": 18.85,
"alnum_prop": 0.6923076923076923,
"repo_name": "SaintGimp/BeagleBoneHardware",
"id": "cba0500b8b0950262585f022fb109ae630d12dd3",
"size": "377"... |
"""Sort parameter interpreter API."""
from invenio_records_resources.services.records.params.sort import SortParam
class CommunitiesSortParam(SortParam):
"""Evaluate the 'sort' parameter."""
def apply(self, identity, search, params):
"""Evaluate the sort parameter on the search.
If sort is ... | {
"content_hash": "ddff467f8a8f1bd4a8e903117a584ef2",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 83,
"avg_line_length": 40.333333333333336,
"alnum_prop": 0.6845730027548209,
"repo_name": "inveniosoftware/invenio-communities",
"id": "e7e7b0985331602b4643201d09ae51807691fa... |
import unittest
import os.path
import requests_mock
import tableauserverclient as TSC
TEST_ASSET_DIR = os.path.join(os.path.dirname(__file__), 'assets')
GET_XML = os.path.join(TEST_ASSET_DIR, 'site_get.xml')
GET_BY_ID_XML = os.path.join(TEST_ASSET_DIR, 'site_get_by_id.xml')
UPDATE_XML = os.path.join(TEST_ASSET_DIR, '... | {
"content_hash": "9b4c7179216c2bf9c5a93599114a2234",
"timestamp": "",
"source": "github",
"line_count": 117,
"max_line_length": 101,
"avg_line_length": 48.52991452991453,
"alnum_prop": 0.6502289538569919,
"repo_name": "Talvalin/server-client-python",
"id": "311f9524f08cefa90c7446f31378226c1a6049d4",
... |
""" Sahana Eden GIS Model
@copyright: 2009-2012 (c) Sahana Software Foundation
@license: MIT
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including... | {
"content_hash": "1e8f64ba3fe7079b7827d5675eceeb3b",
"timestamp": "",
"source": "github",
"line_count": 3787,
"max_line_length": 289,
"avg_line_length": 47.446263533139685,
"alnum_prop": 0.4203384925339077,
"repo_name": "flavour/iscram",
"id": "b8afeb49d6ae34121d9fa4629e08f90d979d62b9",
"size": "17... |
import os
import unittest
import IECore
import IECoreScene
import IECoreImage
import Gaffer
import GafferTest
import GafferScene
import GafferSceneTest
import GafferImage
import GafferOSL
import GafferAppleseed
from AppleseedTest import compileOSLShader
class InteractiveAppleseedRenderTest( GafferSceneTest.Interact... | {
"content_hash": "1719563448a6b66ac6b86ab22f1d15ab",
"timestamp": "",
"source": "github",
"line_count": 84,
"max_line_length": 79,
"avg_line_length": 25.035714285714285,
"alnum_prop": 0.7646219686162625,
"repo_name": "appleseedhq/gaffer",
"id": "39355d1f499862a686c8fa360cf4b5472b1f6c4c",
"size": "3... |
"""
Tests For Scheduler Host Filters.
"""
import inspect
from unittest import mock
from oslo_utils.fixture import uuidsentinel as uuids
from nova import filters
from nova import loadables
from nova import objects
from nova import test
class Filter1(filters.BaseFilter):
"""Test Filter class #1."""
pass
cl... | {
"content_hash": "0452f5d81ba66e9d1539fa785dba17b0",
"timestamp": "",
"source": "github",
"line_count": 222,
"max_line_length": 79,
"avg_line_length": 41.28378378378378,
"alnum_prop": 0.5804691762138571,
"repo_name": "mahak/nova",
"id": "64f4121eb03a9ef368c481352d0aca062ba8e134",
"size": "9801",
... |
from flask.ext.assets import Bundle, Environment
less = Bundle(
'less/main.less',
filters='less',
output='css/main.css',
depends=('less/*.less', 'less/**/*.less', 'less/**/**/*.less')
)
assets = Environment()
assets.register('css_all', less) | {
"content_hash": "bce1f5bd65a363b7cbe33b73b33c91dd",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 66,
"avg_line_length": 23.545454545454547,
"alnum_prop": 0.6254826254826255,
"repo_name": "codeforamerica/template-maker",
"id": "ab8b239805deeb59fd5adb65bbca34aeaa1fa852",
... |
"""tfprof is a tool that profile various aspect of TensorFlow model."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.contrib.tfprof.python.tools.tfprof import tfprof_logger
from tensorflow.python.util.all_util import make_all
| {
"content_hash": "72418cdc1cc680c86d93787862548d45",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 71,
"avg_line_length": 43.857142857142854,
"alnum_prop": 0.7915309446254072,
"repo_name": "pierreg/tensorflow",
"id": "ce777979b96fd6a9dacb8ea764a833d64674d8ef",
"size": "99... |
import uuid
from msrest.pipeline import ClientRawResponse
from msrestazure.azure_exceptions import CloudError
from msrestazure.azure_operation import AzureOperationPoller
from .. import models
class SchedulesOperations(object):
"""SchedulesOperations operations.
:param client: Client for service requests.
... | {
"content_hash": "5bbf31865b046763d4c84bb0944eb903",
"timestamp": "",
"source": "github",
"line_count": 534,
"max_line_length": 168,
"avg_line_length": 46.153558052434455,
"alnum_prop": 0.6296762152073359,
"repo_name": "AutorestCI/azure-sdk-for-python",
"id": "dbf56db4b91030175ec151ff6c62eeeebb1d2f96... |
from ducktape.services.service import Service
from kafkatest.services.trogdor.task_spec import TaskSpec
class RoundTripWorkloadSpec(TaskSpec):
def __init__(self, start_ms, duration_ms, client_node, bootstrap_servers,
target_messages_per_sec, partition_assignments, max_messages):
super(Rou... | {
"content_hash": "28e6274820e8f335162dd117b28fdd8f",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 89,
"avg_line_length": 37.515151515151516,
"alnum_prop": 0.6849757673667205,
"repo_name": "MyPureCloud/kafka",
"id": "588bba8d20eefe81fd8e70bf36a37feb6134427b",
"size": "20... |
import sys, os
import Queue
import traceback
# GUI imports
from ginga.gtkw import gtksel
import gtk
import gobject
import pango
# Local application imports
from ginga import ImageView
from ginga import cmap, imap
from ginga.misc import Bunch
moduleHome = os.path.split(sys.modules[__name__].__file__)[0]
sys.path.inse... | {
"content_hash": "d5066d1a7b224768a55d84d5b0dedbf0",
"timestamp": "",
"source": "github",
"line_count": 801,
"max_line_length": 93,
"avg_line_length": 32.169787765293385,
"alnum_prop": 0.5339180378764359,
"repo_name": "Rbeaty88/ginga",
"id": "c45e55db742f9fb90f1b1acabc754db7c47fff20",
"size": "2604... |
import os
import struct
import sys
import argparse
import subprocess
import irc.client
import jaraco.logging
class DCCSend(irc.client.SimpleIRCClient):
def __init__(self, receiver, filename):
irc.client.SimpleIRCClient.__init__(self)
self.receiver = receiver
self.filename = filename
... | {
"content_hash": "e518c6c794050c9ee50c102b9a4620a7",
"timestamp": "",
"source": "github",
"line_count": 93,
"max_line_length": 76,
"avg_line_length": 28.49462365591398,
"alnum_prop": 0.5988679245283018,
"repo_name": "jaraco/irc",
"id": "72a97b10460db482926245965c035fcec0e637a0",
"size": "2827",
"... |
"""Unit tests for temporal utilities."""
import datetime
import unittest
import iris
import numpy as np
from iris.exceptions import CoordinateNotFoundError
from iris.tests import IrisTest
from improver.synthetic_data.set_up_test_cubes import (
add_coordinate,
set_up_variable_cube,
)
from improver.utilities.t... | {
"content_hash": "c1980515357f3189cb4cd155f41477bf",
"timestamp": "",
"source": "github",
"line_count": 811,
"max_line_length": 88,
"avg_line_length": 39.30209617755857,
"alnum_prop": 0.6051013365125181,
"repo_name": "fionaRust/improver",
"id": "0e21408e44c29597463247bc7c9907cd7dc53384",
"size": "3... |
import logging
import os
import re
from rbtools.clients import SCMClient, RepositoryInfo
from rbtools.utils.checks import check_install
from rbtools.utils.filesystem import make_tempfile
from rbtools.utils.process import die, execute
class PlasticClient(SCMClient):
"""
A wrapper around the cm Plastic tool th... | {
"content_hash": "0b97ae35f874679c4933114019920d2e",
"timestamp": "",
"source": "github",
"line_count": 260,
"max_line_length": 96,
"avg_line_length": 38.13076923076923,
"alnum_prop": 0.5093806737946338,
"repo_name": "clach04/rbtools_0.4.1",
"id": "c2192d78ce8004dce70719dacfe6530ea03658c1",
"size":... |
from midonetclient import vendor_media_type
from midonetclient.admin_state_up_mixin import AdminStateUpMixin
from midonetclient.pool import Pool
from midonetclient.resource_base import ResourceBase
class HealthMonitor(ResourceBase, AdminStateUpMixin):
"""The health monitor JSON model of L4LB feature
"""
m... | {
"content_hash": "324b92336f83ea6556e31087783303f0",
"timestamp": "",
"source": "github",
"line_count": 62,
"max_line_length": 70,
"avg_line_length": 27.919354838709676,
"alnum_prop": 0.608318890814558,
"repo_name": "midokura/python-midonetclient",
"id": "6de5b912d05b218c698030444ddf2d7a760fd003",
... |
"""
ActionPP is an abstract interface for action postprocessors.
Action postprocessor receives an action just before it goes to the
adapter.
ActionPPChain is a list in which you can add postprocessors with
ordinary append.
"""
class ActionPP:
def __init__(self):
self._params={}
def log(self,msg): pa... | {
"content_hash": "fba01328ba91c7d3a5c75e162dca1724",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 70,
"avg_line_length": 25.483870967741936,
"alnum_prop": 0.6835443037974683,
"repo_name": "tema-mbt/tema-tg",
"id": "da87c427a1b38193c851f0df832a77389503862d",
"size": "191... |
"""Utilities to construct a TF subgraph implementing distributed All-Reduce."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import collections
import math
from tensorflow.python.framework import device as device_lib
from tensorflow.python.framework imp... | {
"content_hash": "3d7f3ca9971f2648e9f38627cf780e32",
"timestamp": "",
"source": "github",
"line_count": 852,
"max_line_length": 96,
"avg_line_length": 37.83098591549296,
"alnum_prop": 0.6722822040208488,
"repo_name": "ppwwyyxx/tensorflow",
"id": "ab5e62106d3aa23572d202350f89c145e25db6ec",
"size": "... |
"""
Provides the ability to run test on a standalone Django app.
"""
import sys
from optparse import OptionParser
import django
from settings import configure_settings
# Configure the default settings
configure_settings()
django.setup()
# Django nose must be imported here because it depends on the settings being c... | {
"content_hash": "cb45976ae10b3940d572df58dd596378",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 93,
"avg_line_length": 23.91891891891892,
"alnum_prop": 0.7084745762711865,
"repo_name": "travistruett/django-localized-recurrence",
"id": "87acee4479cc0f650a1b7b59669063e410... |
from lib.utils import util
from lib.base_controller import CommandHelp, ShellException
from .live_cluster_command_controller import LiveClusterCommandController
@CommandHelp(
'"asinfo" provides raw access to the info protocol.',
" Options:",
" -v <command> - The command to execute",
' -l ... | {
"content_hash": "5714d188e791b0738a1034e6ceca690b",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 88,
"avg_line_length": 34.74545454545454,
"alnum_prop": 0.5201465201465202,
"repo_name": "aerospike/aerospike-admin",
"id": "8386fa3be58b282aaa2ef747617eb69556d34b73",
"siz... |
from django.core.urlresolvers import reverse
from django.views.generic import CreateView, ListView
from chatter.base.forms import ChatForm
from chatter.base.models import Chat
class ChatListView(ListView):
"""List all chats in the system.
"""
model = Chat
class UserChatListView(ListView):
"""List a... | {
"content_hash": "da66e8267bc5a006686cc78c45791703",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 62,
"avg_line_length": 25.5,
"alnum_prop": 0.6666666666666666,
"repo_name": "scott-w/pyne-django-tutorial",
"id": "7b6bb47f7967a920aed76a8c19d4d418a6814e68",
"size": "969",... |
from graph_lib import import_graph, INPUT_TYPES
import json
from optparse import OptionParser
import os
import time
import networkx as nx
# Name of input file
DEF_INPUT_NAME = 'followers'
# Input type
DEF_INPUT_TYPE = 'original'
# Name of output file
DEF_OUTPUT_NAME = None
# Default max number of lines to parse
D... | {
"content_hash": "0ec2a7611c774f65a3055028fc83b775",
"timestamp": "",
"source": "github",
"line_count": 208,
"max_line_length": 84,
"avg_line_length": 36.80288461538461,
"alnum_prop": 0.5184846505551927,
"repo_name": "emarschner/gothub",
"id": "55e72590cdd3f9d25cfb3192f61f814124366a28",
"size": "77... |
import time
import argparse
import struct
from fyproto import Packet
from fyserial import GimbalPort
parser = argparse.ArgumentParser(description='Simple remote for the Feiyu Tech gimbal')
parser.add_argument('--port', default='/dev/ttyAMA0')
parser.add_argument('--on', action='store_true')
args = parser.parse_args()
... | {
"content_hash": "161646e1642c20642c8dd764bb7dc81d",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 87,
"avg_line_length": 28.071428571428573,
"alnum_prop": 0.7786259541984732,
"repo_name": "scanlime/fygimbal",
"id": "658145a8de2064bdfb4e02e6a365fe6cd81c39bc",
"size": "41... |
from __future__ import print_function
from DefaultKIDSBuildInstaller import DefaultKIDSBuildInstaller
""" This is an example of custom installer to handle post install questions
Requirement for custom installer python script:
1. Must be a class named CustomInstaller
2. The constructor __init__ takes the ex... | {
"content_hash": "261ea3ee42ba367588be30dce8bf2ddd",
"timestamp": "",
"source": "github",
"line_count": 46,
"max_line_length": 75,
"avg_line_length": 45.76086956521739,
"alnum_prop": 0.6693586698337293,
"repo_name": "josephsnyder/VistA",
"id": "0fd2f848224d8d37606ec2e382d24c8b5374003a",
"size": "28... |
import qcodes as qc
from qcodes.instrument import visa
instr = visa.VisaInstrument('SCOPE', address='TCPIP0::192.168.0.3')
import numpy as np
import matplotlib.pyplot as plt
import sys
sys.path.append("D:/Repository/PyCQED_py3")
import PycQED_py3.pycqed.measurement.waveform_control_CC.waveform as wvf
from time import s... | {
"content_hash": "7e97ce46373a2a228c5363fd307f9450",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 78,
"avg_line_length": 37.65384615384615,
"alnum_prop": 0.7124616956077631,
"repo_name": "DiCarloLab-Delft/PycQED_py3",
"id": "5694e93cf74c97c9fb89a28439d42c9d771b802e",
"s... |
"""
Admin interface for knowhow
"""
from flask_admin import Admin
admin = Admin(name='Knowhow',
template_mode='bootstrap3')
| {
"content_hash": "56e3497b200e87a2dfe3dff7fa7ff94d",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 41,
"avg_line_length": 17.5,
"alnum_prop": 0.6571428571428571,
"repo_name": "abkfenris/knowhow",
"id": "2097640c313c64ed99a97286dd00bfbfe29fd3f1",
"size": "140",
"binary":... |
import os
import random
import re
import subprocess
import time
import fixtures
from heatclient import exc as heat_exceptions
from oslo_log import log as logging
from oslo_utils import timeutils
import six
from six.moves import urllib
import testscenarios
import testtools
from heat_integrationtests.common import clie... | {
"content_hash": "bf185c6a2ae32e62f6172a56294f3655",
"timestamp": "",
"source": "github",
"line_count": 513,
"max_line_length": 78,
"avg_line_length": 41.514619883040936,
"alnum_prop": 0.5667934450861624,
"repo_name": "takeshineshiro/heat",
"id": "46911f07a310c5d013e57ff3b1fb3deabc3c8ef8",
"size": ... |
import numpy as np
import os
import cv2
import random
class BOWClassifier(object):
def __init__(self, detector_type, descriptor_type, voc_size):
self.detector = cv2.FeatureDetector_create(detector_type)
self.descriptor_extractor = cv2.DescriptorExtractor_create(descriptor_type)
self.voc_s... | {
"content_hash": "eb84cfe20d9815992996b51fe50fb373",
"timestamp": "",
"source": "github",
"line_count": 129,
"max_line_length": 104,
"avg_line_length": 37.46511627906977,
"alnum_prop": 0.6300434512725015,
"repo_name": "tz3/ml_homework",
"id": "c3dc3071739cb87e4cf2491e32f634ab8fe945af",
"size": "483... |
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
import geotrek.authent.models
class Migration(migrations.Migration):
dependencies = [
('sensitivity', '0015_auto_20180206_1238'),
]
operations = [
migrations.AlterField(
... | {
"content_hash": "9069acb498a1621dbc220de8a375453a",
"timestamp": "",
"source": "github",
"line_count": 152,
"max_line_length": 192,
"avg_line_length": 37.2171052631579,
"alnum_prop": 0.5729185080431324,
"repo_name": "GeotrekCE/Geotrek-admin",
"id": "2f6b49c9914d45593fa18138f174841444d4d278",
"size... |
"""Test the wallet."""
from decimal import Decimal
import time
from test_framework.test_framework import DigiByteTestFramework
from test_framework.util import (
assert_array_result,
assert_equal,
assert_fee_amount,
assert_raises_rpc_error,
connect_nodes,
wait_until,
)
class WalletTest(DigiByt... | {
"content_hash": "4e3a5a796b944b27e7ee6f150d06bf8e",
"timestamp": "",
"source": "github",
"line_count": 530,
"max_line_length": 193,
"avg_line_length": 50.81698113207547,
"alnum_prop": 0.6291166969888241,
"repo_name": "aurarad/auroracoin",
"id": "816fe7c5d492dc3c668ab65e1414b5d85e3d26e4",
"size": "... |
def configuration(parent_package='',top_path=None):
from numpy.distutils.misc_util import Configuration
config = Configuration('modalities', parent_package, top_path)
config.add_subpackage('fmri')
return config
if __name__ == '__main__':
from numpy.distutils.core import setup
setup(**configur... | {
"content_hash": "ddef34e34d404b5a4448fcd3635d0011",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 66,
"avg_line_length": 31.727272727272727,
"alnum_prop": 0.6962750716332379,
"repo_name": "yarikoptic/NiPy-OLD",
"id": "8cc7ebb527e98db05b1b36df0743144b2d248a21",
"size": "... |
"""Tests for rlds_utils."""
from absl.testing import absltest
import dm_env
from envlogger import step_data
from envlogger.backends import rlds_utils
from envlogger.backends import tfds_backend_testlib
import numpy as np
import tensorflow_datasets as tfds
class RldsUtilsTest(absltest.TestCase):
def test_build_ste... | {
"content_hash": "ba8a579410d3cb5aab7b5c4f523049ad",
"timestamp": "",
"source": "github",
"line_count": 266,
"max_line_length": 80,
"avg_line_length": 34.142857142857146,
"alnum_prop": 0.5926007487337591,
"repo_name": "deepmind/envlogger",
"id": "8f760917f5d24011348afec01f324bfad9af129a",
"size": "... |
from oslo_concurrency import processutils
from oslo_config import cfg
from oslo_log import log
from manila.common import constants as const
from manila import exception
from manila.i18n import _
from manila.i18n import _LE
from manila.i18n import _LI
from manila.i18n import _LW
from manila.share import driver
from man... | {
"content_hash": "c3bb086fcd65fbec71e6d49b31fcdcc3",
"timestamp": "",
"source": "github",
"line_count": 406,
"max_line_length": 79,
"avg_line_length": 36.889162561576356,
"alnum_prop": 0.5679375041730653,
"repo_name": "scality/manila",
"id": "e330e036da6aa8f3994ff0ef9a253eb701e012ea",
"size": "1560... |
import datetime
from decimal import Decimal
from freezegun import freeze_time
from django.test import TestCase
from django.contrib.auth import get_user_model
from budgets.models import Budget
from records.models import Record
class BudgetsTests(TestCase):
def setUp(self):
UserModel = get_user_model()
... | {
"content_hash": "518716d72c1efad02d83f0f48cb93d4b",
"timestamp": "",
"source": "github",
"line_count": 156,
"max_line_length": 87,
"avg_line_length": 35.17948717948718,
"alnum_prop": 0.5973032069970845,
"repo_name": "saks/hb",
"id": "6b22c52594f0c6efb42e02410acfa090f13483e8",
"size": "5488",
"bi... |
import numpy as np
import pandas as pd
import pandas.util.testing as tm
import pytest
from pandas import MultiIndex
from pandas.compat import PYPY
def test_contains_top_level():
midx = MultiIndex.from_product([['A', 'B'], [1, 2]])
assert 'A' in midx
assert 'A' not in midx._engine
def test_contains_with_... | {
"content_hash": "abf6241fd96711be33047184fd17d0ae",
"timestamp": "",
"source": "github",
"line_count": 91,
"max_line_length": 74,
"avg_line_length": 33.956043956043956,
"alnum_prop": 0.5867313915857605,
"repo_name": "pratapvardhan/pandas",
"id": "aaed4467816da5050684fef2d03fd0446b4ed5c7",
"size": ... |
import json
from os.path import exists
from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from selenium.common.exceptions import TimeoutException
class GoogleGroupsScraper(object):
""" A simple class to scrape a google group. """
#### object interface #####################... | {
"content_hash": "8cec8f69cfe0a1cfd16af218cc929499",
"timestamp": "",
"source": "github",
"line_count": 263,
"max_line_length": 79,
"avg_line_length": 31.29277566539924,
"alnum_prop": 0.5504252733900364,
"repo_name": "voidabhi/python-scripts",
"id": "536b638b9fc70f7b117b9f7e321a6d8aa5a12ff3",
"size... |
"""
"""
# Python 2.6 and newer support
from __future__ import (absolute_import, division,
print_function, unicode_literals)
from future.builtins import (
bytes, dict, int, list, object, range, str,
ascii, chr, hex, input, next, oct, open,
pow, roun... | {
"content_hash": "a2cd3a205d7faef009279f289b59aabc",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 85,
"avg_line_length": 27.951219512195124,
"alnum_prop": 0.6265270506108203,
"repo_name": "sfinucane/deviceutils",
"id": "21d2e3881da0570d3bbf37b7eebf290c2cf79ad9",
"size":... |
class GAECurrency(object):
def __init__(self, model):
self.model = model
def support(self, currency):
self.model.support(currency)
def not_support(self, currency):
self.model.not_support(currency)
def get(self, code):
return self.model.get(code)
| {
"content_hash": "bfbf47b72a47a32e2b4c21fa8d267bec",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 40,
"avg_line_length": 22.923076923076923,
"alnum_prop": 0.6241610738255033,
"repo_name": "cescobarresi/Rockefeller",
"id": "0e689e66a7cc068b9e07c1980254cb31bea0154b",
"siz... |
from zope.interface import Interface, implements
from twisted.python import usage
from ...utils.twisted_ext import merge_options
from ...common.backend import PbProxy, ProxyOptions
class IBackend(Interface):
def echo(text):
"""
returns the text
"""
class ServerOptions(usage.Options):
... | {
"content_hash": "57007547c23bd6ce6693d77ee399c5d2",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 67,
"avg_line_length": 21.637931034482758,
"alnum_prop": 0.650996015936255,
"repo_name": "mdrohmann/txtemplates",
"id": "4c2483df46ad3deea32d6718415ef490b3bc96c6",
"size": ... |
import eventlet
import mock
import netaddr
import testtools
from neutron.common import constants
from neutron.common import exceptions as n_exc
from neutron.common import utils
from neutron.plugins.common import constants as p_const
from neutron.plugins.common import utils as plugin_utils
from neutron.tests import bas... | {
"content_hash": "c0f687c12682d8407ae60ec07de64185",
"timestamp": "",
"source": "github",
"line_count": 651,
"max_line_length": 77,
"avg_line_length": 37.65745007680491,
"alnum_prop": 0.5959616561289006,
"repo_name": "SmartInfrastructures/neutron",
"id": "48e59b428b28a6fd90cfd430eecc4b59fc6cf688",
... |
from oslo_log import log as logging
from oslo_utils import excutils
import six
from heat.common.i18n import _
from heat.common.i18n import _LE
from heat.engine import attributes
from heat.engine import constraints
from heat.engine import properties
from heat.engine import resource
from heat.engine import support
LOG ... | {
"content_hash": "6511732e5fa0789c7ae944f008739a9e",
"timestamp": "",
"source": "github",
"line_count": 163,
"max_line_length": 77,
"avg_line_length": 32.809815950920246,
"alnum_prop": 0.5796559461480928,
"repo_name": "srznew/heat",
"id": "b82b5d978cacac0a92f1f6798eeee9966a42a0f6",
"size": "5923",
... |
import unittest
from binascii import unhexlify
from Cryptodome.SelfTest.st_common import list_test_cases
from Cryptodome.Util.py3compat import tobytes
from Cryptodome.Cipher import AES, DES3, DES
from Cryptodome.Hash import SHAKE128
def get_tag_random(tag, length):
return SHAKE128.new(data=tobytes(tag)).read(leng... | {
"content_hash": "8a30dc9b5fa64d24e184e96c103c30f5",
"timestamp": "",
"source": "github",
"line_count": 185,
"max_line_length": 85,
"avg_line_length": 37.432432432432435,
"alnum_prop": 0.644043321299639,
"repo_name": "cloudera/hue",
"id": "f00ad9f82bd01b8dcb2b446fc2e080e6394e8388",
"size": "8438",
... |
"""
WavyTool is a simple program that allows you to acquire data from input
devices, e.g. microphones, and export it as file (csv, png). Also, you
can perform some simple data processing as spectral analysis.
"""
app_name = "WavyTool"
__version__ = "2.1"
__all__ = ['images']
| {
"content_hash": "f52c592ef65b5b8a4310f047817aa929",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 71,
"avg_line_length": 25.363636363636363,
"alnum_prop": 0.6953405017921147,
"repo_name": "dpizetta/wavy",
"id": "a6eef104a615601c6835159f40969014ab05901a",
"size": "314",
... |
from django.contrib.contenttypes.models import ContentType
from hyperadmin.resources.models import ModelResource
from hyperadmin.tests.test_resources import ResourceTestCase
from mock import MagicMock
class MediaTypeTestCase(ResourceTestCase):
def setUp(self):
super(MediaTypeTestCase, self).setUp()
... | {
"content_hash": "875315dc9b37dd94b8535124ddf93882",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 71,
"avg_line_length": 33.4,
"alnum_prop": 0.7275449101796407,
"repo_name": "zbyte64/django-hyperadmin",
"id": "33f3c0fe25e7a8078c0c2b0b6277cfe31d54c200",
"size": "668",
... |
from __future__ import absolute_import, unicode_literals
from .base import *
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'j^z1y2*xivcg89csavhg6jhkhxkx-2&2*@()(_c(!a7)42kgui'
EMAIL_BACKEND = 'django.co... | {
"content_hash": "d0449ea5eb05e0ebcfa8f4af217a5d97",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 66,
"avg_line_length": 23.333333333333332,
"alnum_prop": 0.7380952380952381,
"repo_name": "marteinn/wagtail-alt-generator",
"id": "11b39aadd6ba1e35d62cc58c0ee467cc635d43ff",
... |
import re
from typing import Optional
from django.conf import settings
from django.http import HttpRequest
from zerver.models import Realm, UserProfile
def get_subdomain(request: HttpRequest) -> str:
# The HTTP spec allows, but doesn't require, a client to omit the
# port in the `Host` header if it's "the ... | {
"content_hash": "5b905257a573722ed3946c478ae6196b",
"timestamp": "",
"source": "github",
"line_count": 54,
"max_line_length": 94,
"avg_line_length": 38.351851851851855,
"alnum_prop": 0.6875905359729599,
"repo_name": "synicalsyntax/zulip",
"id": "824c95937db2c38288f9c73354959023dc6b996c",
"size": "... |
import utils
def print_workflow_logs(workflow_name):
output = get_workflow_logs(workflow_name)
print(f"workflow logs:\n", output.decode())
def find_in_logs(workflow_name, sub_str):
logs = get_workflow_logs(workflow_name).decode()
return logs.find(sub_str) >= 0
def get_workflow_logs(workflow_name):... | {
"content_hash": "aea7a8d8e0efc51bd39494671a31f332",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 73,
"avg_line_length": 26.90909090909091,
"alnum_prop": 0.6976351351351351,
"repo_name": "kubeflow/pipelines",
"id": "e1a5510aad8a51666507456f6242e075dba3c9ab",
"size": "59... |
import re
import unicodedata
keys_merchandising = ['FIGURAS', 'FIGURA', 'FIG', 'ESTATUAS', 'ESTATUA',
'CAMISETA', 'TAZA', 'LLAVERO', 'BUSTO', 'CABEZON', 'PELUCHES', 'PELUCHE',
u'MUÑECOS', u'MUÑECO', 'IMANES', 'IMAN']
keys_merchandising_alias = {
"FIG" : "FIGURAS",
"FIGURA" : "FIGURAS",
"IMAN" : "IMANES... | {
"content_hash": "f317cc265166f823b51a8e81c00934c8",
"timestamp": "",
"source": "github",
"line_count": 293,
"max_line_length": 141,
"avg_line_length": 42.54948805460751,
"alnum_prop": 0.523301516002246,
"repo_name": "fcalo/crawler_comics",
"id": "cb17e037427d190f4808ab776149bb98c2892dd1",
"size": ... |
from south.v2 import DataMigration
class Migration(DataMigration):
def forwards(self, orm):
"Perform a 'safe' load using Avocado's backup utilities."
from avocado.core import backup
backup.safe_load('0001_avocado_metadata', backup_path=None,
using='default')
def backwards(... | {
"content_hash": "67ff053303f95adcb5b40e59bbe9d829",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 67,
"avg_line_length": 30,
"alnum_prop": 0.6615384615384615,
"repo_name": "murphyke/avocado",
"id": "006340530593145a5e6fcae8e5ea8c35dcb01c79",
"size": "414",
"binary": f... |
from model import *
from utils import *
import logging
import prefix
MAX_RESULTS = 100
class Results(Handler):
def search(self, criteria, new_search):
if new_search:
return indexing.search(Person, criteria, MAX_RESULTS)
else:
query = Person.all().order('entry_date')
query = prefix.filter_... | {
"content_hash": "b74d15d7eb7695b18b4719119e766899",
"timestamp": "",
"source": "github",
"line_count": 67,
"max_line_length": 90,
"avg_line_length": 35.92537313432836,
"alnum_prop": 0.6373078520980474,
"repo_name": "jgeewax/googlepersonfinder",
"id": "25100db201227f1182faf29db65ff0f0c1f8e239",
"si... |
import endpoints
import webapp2
from findit_api import FindItApi
from handlers import build_failure
from handlers import check_duplicate_failures
from handlers import failure_log
from handlers import help_triage
from handlers import list_analyses
from handlers import monitor_alerts
from handlers import triage_analysis... | {
"content_hash": "0c32c7e3ee36594210e290260d1ba739",
"timestamp": "",
"source": "github",
"line_count": 46,
"max_line_length": 80,
"avg_line_length": 35.78260869565217,
"alnum_prop": 0.7539489671931956,
"repo_name": "nicko96/Chrome-Infra",
"id": "64ec595b9624f3e6b56465c95ccde8d370d49630",
"size": "... |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('persons', '0006_auto_20151111_1118'),
]
operations = [
migrations.RenameField(
model_name='person',
old_name='update_time',
... | {
"content_hash": "78c11a0f1c678ebb83ef341da664618e",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 47,
"avg_line_length": 20.72222222222222,
"alnum_prop": 0.5817694369973191,
"repo_name": "JxMeta/simplepay",
"id": "785b794a3b14c1967a87bea9526d592f3c94a280",
"size": "397"... |
from django.contrib.auth.models import User
from django.core.exceptions import ValidationError
from django.core.urlresolvers import reverse
from django.template import Context, Template
from django.test import TestCase, Client
class GroupTest(TestCase):
def setUp(self):
# users
self.users = {
... | {
"content_hash": "20869f0a19e9e634d9acb8fdb7ca1032",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 112,
"avg_line_length": 41.05,
"alnum_prop": 0.6364190012180267,
"repo_name": "suselrd/django-social-network",
"id": "20dc4c8aac9ee95495e8ea609086ccf3d80ec811",
"size": "16... |
import codecs
from os import path
from setuptools import setup, find_packages
def read(*parts):
filename = path.join(path.dirname(__file__), *parts)
with codecs.open(filename, encoding='utf-8') as fp:
return fp.read()
setup(
name='django-hosts',
description='Dynamic and static host resolving ... | {
"content_hash": "8d26ec3af02cf0970385f9b4dcd58108",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 64,
"avg_line_length": 34.348837209302324,
"alnum_prop": 0.5978334461746784,
"repo_name": "jezdez/django-hosts",
"id": "5a7a54f2fa7f2701005d34ee1c5df817787ddef4",
"size": "... |
from django import forms
from django.utils.translation import ugettext_lazy as _
from feedback.models import Feedback
from tinymce.widgets import TinyMCE
class FeedbackForm(forms.ModelForm):
description = forms.CharField(label=_("description"), widget=TinyMCE)
class Meta:
model = Feed... | {
"content_hash": "a7cd92d510b270fadba84e782f87ff5b",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 106,
"avg_line_length": 34,
"alnum_prop": 0.6176470588235294,
"repo_name": "caseywstark/colab",
"id": "71f7670af4f5a429f6a2a655ef72280f2a311014",
"size": "1020",
"binary"... |
"""The Query class and support.
Defines the :class:`.Query` class, the central
construct used by the ORM to construct database queries.
The :class:`.Query` class should not be confused with the
:class:`.Select` class, which defines database
SELECT operations at the SQL (non-ORM) level. ``Query`` differs from
``Selec... | {
"content_hash": "775fd46bf1b3fd8240b3407f8e3b868f",
"timestamp": "",
"source": "github",
"line_count": 3558,
"max_line_length": 92,
"avg_line_length": 36.98482293423272,
"alnum_prop": 0.565437108638823,
"repo_name": "CodeMath/jinrockets",
"id": "afcbf3500c696c2cb98103bb33a8e4ce26162f72",
"size": "... |
try:
from setuptools import setup
from setuptools.extension import Extension
except Exception:
from distutils.core import setup
from distutils.extension import Extension
from modules.helpers import env_or_default
from Cython.Build import cythonize
from Cython.Distutils import build_ext
import numpy
import mpi... | {
"content_hash": "edc17ac1ffbcbe89c9d01fc658262d2d",
"timestamp": "",
"source": "github",
"line_count": 71,
"max_line_length": 61,
"avg_line_length": 19.619718309859156,
"alnum_prop": 0.6381909547738693,
"repo_name": "inconvergent/differential-line-mpi",
"id": "7b48efb3e886b5e21aaccc1f690c8601403437d... |
'''
Destroy all security groups (find from ZStack database).
@author: Youyk
'''
import zstackwoodpecker.operations.resource_operations as res_ops
import zstackwoodpecker.operations.config_operations as con_ops
import zstackwoodpecker.operations.net_operations as net_ops
import zstackwoodpecker.operations.account_op... | {
"content_hash": "a0218c5d6462779852360400aa9adddf",
"timestamp": "",
"source": "github",
"line_count": 87,
"max_line_length": 105,
"avg_line_length": 35.71264367816092,
"alnum_prop": 0.6665593820405535,
"repo_name": "SoftwareKing/zstack-woodpecker",
"id": "2524fbc2d6b76770e5401395d92b65ab0b2b07b8",
... |
"""
mbed CMSIS-DAP debugger
Copyright (c) 2016 ARM Limited
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law o... | {
"content_hash": "9b3c4f5b3d29d5a556266a55d897de06",
"timestamp": "",
"source": "github",
"line_count": 145,
"max_line_length": 94,
"avg_line_length": 35.56551724137931,
"alnum_prop": 0.6077176653092884,
"repo_name": "matthewelse/pyOCD",
"id": "f7ddd9e5708a600055a5d0504cab05576813fe2a",
"size": "51... |
import unittest
import os, sys
from oti_search import OTISearch
from ConfigParser import SafeConfigParser
class TestOTISearch(unittest.TestCase):
@classmethod
def setUp(self):
conf = SafeConfigParser(allow_no_value=True)
if os.path.isfile("../private/localconfig"):
conf.read("../pri... | {
"content_hash": "181422f9715fc186ff1be332ef3cc010",
"timestamp": "",
"source": "github",
"line_count": 59,
"max_line_length": 102,
"avg_line_length": 30.1864406779661,
"alnum_prop": 0.6030320044918585,
"repo_name": "leto/new_opentree_api",
"id": "80cbe04acb40d71be2319e3be540b3eedda0ff81",
"size": ... |
import unittest
import craynn
from craynn.viz import draw_to_file
from craynn.layers import *
from craynn.subnetworks import *
from craynn.networks import *
from lasagne import *
class TestPropNet(unittest.TestCase):
def test_import(self):
test_input = layers.InputLayer(shape=(None, 1, 28, 28))
block = la... | {
"content_hash": "1ccf9baddf8544e79793d7f0850b2f7d",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 60,
"avg_line_length": 21.818181818181817,
"alnum_prop": 0.6444444444444445,
"repo_name": "maxim-borisyak/craynn",
"id": "be1e232ba6aaabca49d56b80793d63d9f22ae8ca",
"size":... |
import pygame
from pygame import locals
from pygame import Rect
class Scene():
def __init__(self):
self.viewport_rect = Rect(0, 0, 1, 1)
self.device_rect = Rect(0, 0, 1, 1)
def get_vp_x_from_dev_x(self, dev_x):
ratio = self.device_rect.w / self.viewport_rect.w
device_shif... | {
"content_hash": "f3d00a769aa7022d9965bd468402f978",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 57,
"avg_line_length": 25.754716981132077,
"alnum_prop": 0.6087912087912087,
"repo_name": "jonesmat/goldtown",
"id": "9a4549b7e0beff60db3598c6db69027b4131fa12",
"size": "13... |
from txgossip.state import PeerState
class Scuttle(object):
def __init__(self, peers, local_peer):
self.peers = peers
self.local_peer = local_peer
def digest(self):
digest = {}
for peer, state in self.peers.items():
digest[peer] = state.max_version_seen
re... | {
"content_hash": "dfc8e30454581f53e23ccb16913a8847",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 81,
"avg_line_length": 33.5,
"alnum_prop": 0.528049408131755,
"repo_name": "jrydberg/txgossip",
"id": "34579659686e6d7794531a62798f67c3a9bf33af",
"size": "3072",
"binary"... |
"""pypyr step that executes a cmd as a sub-process.
Alias for pypyr.steps.cmd
You cannot use things like exit, return, shell pipes, filename wildcards,
environment,variable expansion, and expansion of ~ to a user’s home
directory.
"""
import logging
import pypyr.steps.cmd
# logger means the log level will be set cor... | {
"content_hash": "35703357c363ce36830dc59bf8fa22a2",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 76,
"avg_line_length": 30.272727272727273,
"alnum_prop": 0.6762762762762763,
"repo_name": "pypyr/pypyr-cli",
"id": "dc3f61b3cae03e79e3ea877e892da11e377275ed",
"size": "1667... |
import os
import torch
import numpy as np
import torch.distributed as dist
from torchvision import datasets, transforms
from timm.data import create_transform
try:
from torchvision.transforms import InterpolationMode
def _pil_interp(method):
if method == 'bicubic':
return InterpolationMod... | {
"content_hash": "1f425959ec800a481439d3ac9104fcaf",
"timestamp": "",
"source": "github",
"line_count": 143,
"max_line_length": 109,
"avg_line_length": 36.43356643356643,
"alnum_prop": 0.647024952015355,
"repo_name": "NVIDIA/FasterTransformer",
"id": "ce368ac2d423743e564a54ffe4e74fa8f68b1317",
"siz... |
"""A module containing a visual representation of the connection
This is the "View" of the MVC world.
"""
import os
import webbrowser
try:
import tkinter as tk
from tkinter.ttk import Notebook, Label, PanedWindow, Sizegrip
import tkinter.messagebox as tkMessageBox
except ImportError:
import Tkinter as... | {
"content_hash": "105a2d5516ac1c75a406018dd69c2363",
"timestamp": "",
"source": "github",
"line_count": 498,
"max_line_length": 153,
"avg_line_length": 41.170682730923694,
"alnum_prop": 0.5504072574745159,
"repo_name": "pybee/duvet",
"id": "442aafa13dc8614c58a61ffcb98bc65fe592162c",
"size": "20531"... |
"""
Unit tests for the configuration component.
"""
from sleekxmpp.test import SleekTest
from rhobot.components.storage import StoragePayload, ResultCollectionPayload, ResultPayload
from rdflib.namespace import FOAF
import time
class CreateNodeTestCase(SleekTest):
def setUp(self):
from rhobot.components ... | {
"content_hash": "1d0388aa4cc91cfa4a7fd3c52da0965e",
"timestamp": "",
"source": "github",
"line_count": 113,
"max_line_length": 111,
"avg_line_length": 33.11504424778761,
"alnum_prop": 0.5686798503474078,
"repo_name": "rerobins/rhobot_framework",
"id": "f332564f939fb2cf541480869154e994ebbcd1be",
"s... |
"""
Based on http://vaig.be/2009/03/getting-client-os-in-django.html
"""
import re
def client_os(user_agent):
'''
Context processor for Django that provides operating system
information base on HTTP user agent.
A user agent looks like (line break added):
"Mozilla/5.0 (X11; U; Linux i686; en-US; r... | {
"content_hash": "fb87ed09f45f61c7ea05d9fc07ba6609",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 87,
"avg_line_length": 31.103448275862068,
"alnum_prop": 0.5493348115299335,
"repo_name": "underbluewaters/marinemap",
"id": "30f97a8707a5431a6c41b5ab800691334b2f799e",
"si... |
""" This package defines a set of methods to deal with web services.
It requires suds library to be installed. Click on configure to add wsdl
urls to the package (use a ; to separate the urls).
"""
from core.configuration import ConfigurationObject
identifier = 'edu.utah.sci.vistrails.sudswebservices'
name = 'SUDS We... | {
"content_hash": "bc88eaa78ee93b30e0267f65a66210f2",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 72,
"avg_line_length": 34.588235294117645,
"alnum_prop": 0.66921768707483,
"repo_name": "CMUSV-VisTrails/WorkflowRecommendation",
"id": "42de19fb3b0f068f7af5bfead5471976d70a3... |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('song', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='song',
name='track_id',
field=models.I... | {
"content_hash": "6b81bd18dd9805330a2b967b3f21b352",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 52,
"avg_line_length": 23.166666666666668,
"alnum_prop": 0.5575539568345323,
"repo_name": "colajam93/dihts",
"id": "05de6a566d1dc8fd00abc38e646dd61a01681ae6",
"size": "628"... |
'''
Created on Jan 19, 2015
@author: sstober
'''
import os
import glob
import logging
log = logging.getLogger(__name__)
import numpy as np
from deepthought.util.fs_util import load, save
from scipy.io import loadmat
def load_eeglab_data(filepath, xlsx_metadata={}):
log.info('loading EEGLab data from {}'.... | {
"content_hash": "c52eb8f16f488d19c45caddff241f3f8",
"timestamp": "",
"source": "github",
"line_count": 115,
"max_line_length": 95,
"avg_line_length": 32.97391304347826,
"alnum_prop": 0.6039029535864979,
"repo_name": "sstober/deepthought",
"id": "64dfdd91b739c1944fb5be7bae979692c23cb72e",
"size": "... |
from cms.forms.widgets import PlaceholderPluginEditorWidget
from cms.models.pluginmodel import CMSPlugin
from cms.utils import get_language_from_request
from cmsplugin_blog.models import Entry, EntryTitle
from cmsplugin_blog.widgets import AutoCompleteTagInput
from django import forms
from django.contrib import a... | {
"content_hash": "65ef38847f67df1f0e1a922db3568c27",
"timestamp": "",
"source": "github",
"line_count": 145,
"max_line_length": 122,
"avg_line_length": 40.744827586206895,
"alnum_prop": 0.5954637779282329,
"repo_name": "divio/cmsplugin-blog",
"id": "6cf41c57eb6958dae55ec7db0485c07bf4535d13",
"size"... |
"""Context objects for views."""
from urllib.parse import unquote, urlparse
from h_vialib import Configuration
from pyramid.httpexceptions import HTTPBadRequest
from via.exceptions import BadURL
class _URLResource:
"""Methods for routes which accept a 'url'."""
def __init__(self, request):
self._re... | {
"content_hash": "e9864d81929a4a0050065efd61af2535",
"timestamp": "",
"source": "github",
"line_count": 112,
"max_line_length": 80,
"avg_line_length": 28.401785714285715,
"alnum_prop": 0.6133291417793146,
"repo_name": "hypothesis/via",
"id": "9b602167d449910efeb99b506c1ba9d699988ed9",
"size": "3181... |
from django.test import RequestFactory
from test_plus.test import TestCase
from . import views
from .models import Customer
class BaseCustomerTestCase(TestCase):
def setUp(self):
self.user = self.make_user()
self.customer = Customer.objects.get_or_create(
... | {
"content_hash": "b6e0e20779c84c7288411a31c35ad130",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 76,
"avg_line_length": 34.3,
"alnum_prop": 0.5860058309037901,
"repo_name": "BCriswell/crud-fusion",
"id": "1816743552c5fee5e0d07692d34beb52064a698a",
"size": "1372",
"bi... |
"""
Schedule module
"""
from yoyo import step
__depends__ = {}
steps = [
step("""CREATE TABLE schedule (
id integer primary key autoincrement,
user_id integer not null,
command varchar(100) not null,
interval integer not null
)""", "DROP TABLE schedule"),
step("CREATE UNIQ... | {
"content_hash": "4fc5a9e45bd95da49c390380ca6350c2",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 82,
"avg_line_length": 22.58823529411765,
"alnum_prop": 0.6302083333333334,
"repo_name": "Tarinu/taribot",
"id": "77b8db3f477fc399fff5432504b293e65174a751",
"size": "384",
... |
"""
__rule1_2_exists_MDL.py_____________________________________________________
Automatically generated AToM3 Model File (Do not modify directly)
Author: levi
Modified: Thu Aug 22 14:05:43 2013
____________________________________________________________________________
"""
from stickylink import *
from widthXfillXde... | {
"content_hash": "e0d6ab21049f8054540da0993428898b",
"timestamp": "",
"source": "github",
"line_count": 476,
"max_line_length": 76,
"avg_line_length": 35.205882352941174,
"alnum_prop": 0.6956080677885189,
"repo_name": "levilucio/SyVOLT",
"id": "ce9ebefc04e61473e47129f80f62a14e16bb179f",
"size": "16... |
"""Sparse logistic regression models."""
import functools
import tensorflow.compat.v2 as tf
import tensorflow_probability as tfp
from tensorflow_probability.python.internal import prefer_static as ps
from inference_gym.internal import data
from inference_gym.targets import bayesian_model
from inference_gym.targets i... | {
"content_hash": "b65210a25329aeadc4238a93109f7c1b",
"timestamp": "",
"source": "github",
"line_count": 186,
"max_line_length": 95,
"avg_line_length": 36.88172043010753,
"alnum_prop": 0.6274052478134111,
"repo_name": "tensorflow/probability",
"id": "b90815e96c9be9312bc3f5dc27c34e04a8c1f26c",
"size"... |
import os
import pytest
import main
@pytest.fixture
def client():
main.app.testing = True
return main.app.test_client()
def test_handler_no_env_variable(client):
r = client.get("/")
assert r.data.decode() == "Hello World!"
assert r.status_code == 200
def test_handler_with_env_variable(client... | {
"content_hash": "0d547efcd84e6e54ab0bbf64b3456c77",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 44,
"avg_line_length": 18.12,
"alnum_prop": 0.6379690949227373,
"repo_name": "GoogleCloudPlatform/cloud-build-samples",
"id": "838ff5d75e8a3ad784ab982855ec210f4c6eef0a",
"s... |
import re
import sys
def percent_difference(new, old):
response = (new - old)/old*100
return response
def compare_delete_timing(json_1, json_2):
for k1, v1 in json_1.items():
for k2, v2 in json_2.items():
if k1 == k2:
print('\tnumber of projects ' + str(k1))
... | {
"content_hash": "d51980db2c8436247c8ab6fe41d5c1dd",
"timestamp": "",
"source": "github",
"line_count": 83,
"max_line_length": 75,
"avg_line_length": 24.759036144578314,
"alnum_prop": 0.5231143552311436,
"repo_name": "mffiedler/svt",
"id": "493d2fc7fbead8efc7bd1b53cb4c530175aeef72",
"size": "2055",... |
"""
SALTFTP tar gzips and transfers PI-collated data to the FTP server
for collection by the PI.
Author Version Date
-----------------------------------------------
Martin Still (SAAO) 0.2 21 Jul 2006
S M Crawford (SAAO) 0.3 21 Jul 2007
UPDATES
---------------------... | {
"content_hash": "4c039486a769009554e7323694512674",
"timestamp": "",
"source": "github",
"line_count": 268,
"max_line_length": 183,
"avg_line_length": 34.67910447761194,
"alnum_prop": 0.626748439853669,
"repo_name": "saltastro/pipetools",
"id": "38641ae00f28b292b8da4b65e71db0431416759d",
"size": "... |
import contextlib
import tempfile
from path import path
def extract(dictionary, keys):
"""
Extract only the specified keys from a dict
:param dictionary: source dictionary
:param keys: list of keys to extract
:return dict: extracted dictionary
"""
return dict(
(k, dictionary[k]) ... | {
"content_hash": "dddbd9e3c846ad8bf1d76b586f91ff3e",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 61,
"avg_line_length": 20.78048780487805,
"alnum_prop": 0.6255868544600939,
"repo_name": "goldsborough/changes",
"id": "3b80b3ae20f36e50c23cd39b60fd5e2bd9c1c4d9",
"size": "... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.