content string |
|---|
import bitmath
from crispy_forms.helper import FormHelper
from dal import autocomplete
from django import forms
from django.forms import ModelForm
import drivetracker.drives.models as models
def get_capacity_units():
return [('{}B'.format(prefix),
'{}B'.format(prefix)) for prefix in bitmath.SI_PREFI... |
#!/usr/bin/env python
# coding=utf-8
"""Environment Information.
# Authors: MohammadHossein GohariNejad <<EMAIL>>
# Sajjad Azami <<EMAIL>>
# License: BSD 3 clause
Utils package for environment information extraction.
"""
import tf
import rospy
import rosservice
from gazebo_information_plugins.srv import ... |
# -*- coding: utf-8 -*-
'''
Various network validation utilities
'''
# Import python libs
import re
import socket
# Import salt libs
from salt._compat import string_types
def mac(addr):
'''
Validates a mac address
'''
valid = re.compile(r'''
(^([0-9A-F]{1,2}[-]){5}([0-9A-F]{1,2... |
#! /usr/bin/env python3
import config
import os
import json
import datetime
import marshmallow
import traceback
from odie import app, sqla, ClientError
from login import get_user
from functools import wraps
from flask import Flask, Response, request
from jsonquery import jsonquery
from marshmallow import Schema, fie... |
from django.conf.urls import url
from django.urls import path
from public.views import *
# /public/ URLs
# NB there are also public views for Invoice view and email unsubscribe defined in members app
urlpatterns = [
url(r"^$", PublicHomeView.as_view(), name="public-home"),
path("enquiry/create/", EnquiryCreate... |
import time
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import *
class TimestampIndexTest(BitcoinTestFramework):
def setup_chain(self):
print("Initializing test directory "+self.options.tmpdir)
initialize_chain_clean(self.options.tmpdir, 4)
def se... |
"""Test query factories."""
from __future__ import absolute_import, print_function
import pytest
from invenio_records_rest.errors import InvalidQueryRESTError
from invenio_records_rest.query import default_query_factory, es_query_factory
def test_default_query_factory(app, user_factory):
"""Test default query ... |
# -*- coding: utf-8 -*-
"""
Created on Feb 20, 2014
@author: Aaron Ponti
"""
import re
from ch.systemsx.cisd.openbis.dss.etl.dto.api import SimpleImageDataConfig
from ch.systemsx.cisd.openbis.dss.etl.dto.api import SimpleImageContainerDataConfig
from ch.systemsx.cisd.openbis.dss.etl.dto.api.impl import MaximumIntens... |
from __future__ import division, print_function
import os, json
from glob import glob
import numpy as np
from scipy import misc, ndimage
from scipy.ndimage.interpolation import zoom
import keras
from keras import backend as K
from keras.models import Sequential, Model
from keras.layers.core import Flatten, Dense, Dro... |
import pytest
import unittest
import sys
import os
import SocketServer
import threading
import time
import json
DOSSIER_COURANT = os.path.dirname(os.path.abspath(__file__))
DOSSIER_PARENT = os.path.dirname(DOSSIER_COURANT)
sys.path.append(DOSSIER_PARENT)
from vespa.node import Node
from vespa.agent_controller import ... |
'''
Common utilities for the Proxy Verifier extensions.
'''
# 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... |
# -*- coding: utf-8 -*-
""" The expression editor present in some locations of CFME.
"""
from functools import partial
from selenium.common.exceptions import NoSuchElementException
from multimethods import singledispatch
from utils.wait import wait_for, TimedOutError
from utils import version
import cfme.fixtures.pyt... |
from __future__ import with_statement
import os
import unittest
import IECore
import Gaffer
import GafferTest
class StringPlugTest( GafferTest.TestCase ) :
def testExpansion( self ) :
n = GafferTest.StringInOutNode()
self.assertHashesValid( n )
# nothing should be expanded when we're in a non-computation ... |
import base64
import httplib, os
import re
import urllib
import urllib2
import xml.dom.minidom
import duplicity.backend
from duplicity import globals
from duplicity import log
from duplicity.errors import * #@UnusedWildImport
from duplicity import urlparse_2_5 as urlparser
from duplicity.backend import retry_fatal
cl... |
# coding: utf-8
# In[ ]:
import json
import sys
import time
import os
import mimetypes
from sys import platform
import requests
from login import s, _print
dic = {}
file_index = 0
def upload_media(fpath, is_img=False):
global file_index
url = 'http://file.api.wechat.com/cgi-bin/media/upload?access_toke... |
"""Unittests for the partial_mock test helper code."""
from __future__ import print_function
from chromite.lib import cros_test_lib
from chromite.lib import partial_mock
# pylint: disable=protected-access
class ComparatorTest(cros_test_lib.TestCase):
"""Test Comparitor functionality."""
TEST_KEY1 = 'monkey'
... |
import h5py
from bapsflib.utils.errors import HDFMappingError
from typing import (Dict, Tuple, Union)
from .n5700ps import HDFMapControlN5700PS
from .nixyz import HDFMapControlNIXYZ
from .nixz import HDFMapControlNIXZ
from .sixk import HDFMapControl6K
from .templates import (HDFMapControlTemplate, HDFMapControlCLTemp... |
"""
The FilterScheduler is for creating instances locally.
You can customize this scheduler by specifying your own Host Filters and
Weighing Functions.
"""
import random
from oslo_config import cfg
from oslo_log import log as logging
from nova import exception
from nova.i18n import _
from nova import rpc
from nova.s... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals, absolute_import
from django.utils.translation import ugettext_lazy as _
import django.forms.widgets
from .conf import settings
from . import constants
class BootstrapMediaMixin(object):
class Media:
css = {
'all': (
... |
from . import Image, ImageFile
from ._binary import i8
__version__ = "0.1"
##
# Image plugin for PhotoCD images. This plugin only reads the 768x512
# image from the file; higher resolutions are encoded in a proprietary
# encoding.
class PcdImageFile(ImageFile.ImageFile):
format = "PCD"
format_description ... |
from rest_framework.decorators import api_view, renderer_classes
from rest_framework.response import Response
from rest_framework.renderers import JSONPRenderer,JSONRenderer
from django.utils import simplejson
from bike_routing.serializers import NodeSerializer, WaySerializer
from bike_routing.graphmaker import Graphm... |
# -*- coding: utf-8 -*-
#======================================================================
# ライブラリ
#======================================================================
# GUIを扱う
import tkinter
#======================================================================
# クラス定義
#=====================================... |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import os
import tweepy
from tweepy.error import TweepError
# import random
import json
import time
from bad_words import BAD_WORDS
# from replies import replies_dict, nothing_found
API_KEY = os.getenv('API_KEY', '')
API_SECRET = os.getenv('API_SECRET', '')
CLIENT_TOKEN = o... |
# -*- coding: utf-8 -*-
from ..state.signedprekeystore import SignedPreKeyStore
from ..state.signedprekeyrecord import SignedPreKeyRecord
from ..invalidkeyidexception import InvalidKeyIdException
class InMemorySignedPreKeyStore(SignedPreKeyStore):
def __init__(self):
self.store = {}
def loadSignedPr... |
from collections import defaultdict
import ldnsx
import sys
system_res = ldnsx.resolver();
def name2ipset(name):
"""Returns a set of IPv4 and IPv6 addresses associated with a name"""
arecords = system_res.query(name, 'A').answer(rr_type="A")
aaaarecords = system_res.query(name, 'AAAA').answer(rr_type="AA... |
import unittest
from numpy import alltrue, arange, array, ravel, transpose, zeros, inf, isinf
from numpy.testing import assert_equal, assert_
from chaco.api import DataRange2D, GridDataSource, PointDataSource
class DataRange2DTestCase(unittest.TestCase):
def test_empty_range(self):
r = DataRange2D()
... |
#!/usr/bin/env python2
# NOTE: https://pymodbus.readthedocs.io/en/latest/examples/asynchronous-server.html
from pymodbus.server.async import StartTcpServer
from pymodbus.server.async import StartUdpServer
from pymodbus.server.async import StartSerialServer
from pymodbus.device import ModbusDeviceIdentification
from ... |
from sys import exit, stderr
from os.path import isfile
from argparse import ArgumentParser, ArgumentTypeError
class DefaultParser(ArgumentParser):
"""Override ArgumentParser's handing of no argument error.
Only print help message if error is for missing argument,
otherwise, only print the error."""
d... |
import os
from pip.compat import get_path_uid
import pytest
def test_get_path_uid():
path = os.getcwd()
assert get_path_uid(path) == os.stat(path).st_uid
@pytest.mark.skipif("not hasattr(os, 'O_NOFOLLOW')")
def test_get_path_uid_without_NOFOLLOW(monkeypatch):
monkeypatch.delattr("os.O_NOFOLLOW")
pat... |
import sys
sys.path.insert(1,"../../../")
import time
from h2o.estimators.xgboost import *
from tests import pyunit_utils
'''
The goal of this test is to compare the results of H2OXGBoost and natibve XGBoost for binomial classification.
The dataset contains both numerical and enum columns.
'''
def comparison_test_den... |
import os
import sys
try:
import builtins
except ImportError:
import __builtin__ as builtins
def _select_qt_binding(binding_name=None):
global QT_BINDING, QT_BINDING_VERSION
# order of default bindings can be changed here
if 'PYTHON_QT_BINDING' in os.environ:
DEFAULT_BINDING_ORDER = [os.en... |
"""All low level structures used for parsing Estimote packets."""
from construct import Struct, Byte, Switch, Int8sl, Array, Int8ul, Const, Int16ul
from ..const import ESTIMOTE_TELEMETRY_SUBFRAME_A, ESTIMOTE_TELEMETRY_SUBFRAME_B, \
ESTIMOTE_NEARABLE_FRAME
# pylint: disable=invalid-name
EstimoteTe... |
# -*- coding: UTF-8 -*-
import os
from django import forms
from django.forms import ModelForm
from django.utils.translation import ugettext_lazy as _
from .models import PDFDocument,Category
class PDFDocumentCreateForm(ModelForm):
class Meta:
model = PDFDocument
exclude = ('slug', 'help_text','cre... |
import logging
import re
import scipy.sparse as sp
import numpy as np
import tensorflow as tf
from sklearn.base import ClassifierMixin, BaseEstimator
from sklearn.utils import check_X_y, check_array, check_random_state
from sklearn.utils.multiclass import type_of_target
from sklearn.exceptions import NotFittedError
f... |
"""
Unit tests for the course bookmarks feature.
"""
import ddt
from django.test import RequestFactory
from xmodule.modulestore import ModuleStoreEnum
from xmodule.modulestore.tests.django_utils import CourseUserType, SharedModuleStoreTestCase
from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory... |
import os
import gzip
import numpy as np
import nibabel as nib
from ..algorithm.graph_tool import node_attr2array
from .io import GiftiReader, CiftiReader
def read_mgh(fpath):
"""
read MGH/MGZ file data
If the data in the file is a 3D array, it will be raveled as a surface map.
If the data in the fil... |
# -*- coding: utf-8 -*-
import bunch
import simplejson as json
from graph import GraphException
from url_operations import add_path, update_query_params
import eventlet
requests = eventlet.import_patched('requests.__init__')
requests_adapters = eventlet.import_patched('requests.adapters')
session = requests.Session(... |
from builtins import str
import dns.query
import dns.tsigkeyring
import dns.update
import dns.resolver
import time
from cobbler.cexceptions import CX
logf = None
def nslog(msg):
if logf is not None:
logf.write(msg)
def register():
if __name__ == "cobbler.modules.nsupdate_add_system_post":
... |
import re
import cfg
from SkunkExcept import SkunkStandardError
cfg.Configuration.mergeDefaults(
strictMessageCatalogs = 1,
DefaultLanguage="eng"
)
class NO_DEFAULT: pass
def getMessage(catalog,
message,
lang = cfg.Configuration.DefaultLanguage,
fmt = lambda x... |
from __future__ import division
import pyhsmm
from states import HMMSLDSStatesPython, HMMSLDSStatesEigen, HSMMSLDSStatesPython, \
HSMMSLDSStatesEigen
class _SLDSMixin(object):
def __init__(self,dynamics_distns,emission_distns,init_dynamics_distns,**kwargs):
self.init_dynamics_distns = init_dynamics_... |
"""
evaluation.py
Evaluation of RNN for Treebank sentiment
Written by Alex Bain (https://github.com/convexquad/treebank)
"""
from rnn import RNN, softmax
import numpy
import treebank
# Fine-grained / all nodes accuracy results (Table 1 Socher 2013).
def show_node_results(rnn, trees):
node_count = 0
correct_pr... |
#!/user/bin/python
# vim: et sw=2 ts=2 sts=2
# Demo file for adding user-defined functions to a game.
# Add the following commands to the file during a class demonstration
# - Actor() command
# - set_location() command
# - add_phrase() command with Say()
# - add_phrase() command with Verb()
# - Animal() command
#... |
import commands
import linecache
import os
#program to delete the duplicate files in any directory
#it is based on fact that hash value of two same file are same
# even if there names are diffrent.
#\033[xm are used for ansi colour code.
os.system("clear")
print """\033[33m
##########################... |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'Price_Tier'
db.create_table('products_price_tier', (
('id', self.gf('django.db.m... |
__author__ = "Felix Brezo, Yaiza Rubio <<EMAIL>>"
__version__ = "2.0"
from osrframework.utils.platforms import Platform
class Wishlistr(Platform):
"""A <Platform> object for Wishlistr"""
def __init__(self):
self.platformName = "Wishlistr"
self.tags = ["social", "news"]
############... |
import cv2
import time
import argparse
import logging
import pprint
import os
import sys
from config.config import config, update_config
import _init_paths
import shutil
import numpy as np
import mxnet as mx
import mxnet.metric
from symbols import *
from core import callback, metric
from core.loader import AnchorLoad... |
#!/usr/bin/env python
import os, sys, copy
import numpy as np
import cPickle as pickle
import sim, pickleTraj, measurelib
Recompute = False
ExposeBlocks = False # True to reveal block wise data
# Inputs
AtomNames2Types = False
LammpsTraj = None
NBins = 25
Normalize = True
NBlocks = 1
BlockSize = None
# Traj details
... |
#!/usr/bin/env python
"""Main entry point with default configuration."""
from __future__ import with_statement
__author__ = 'Manuel Holtgrewe <<EMAIL>>'
import logging
import optparse
import sys
import main as lm
def createDefaultConfig():
return [], []
def main(ast_checks, file_checks):
# Setup option p... |
"""This code example creates new activity groups.
To determine which activity groups exist, run get_all_activity_groups.py.
The LoadFromStorage method is pulling credentials and properties from a
"googleads.yaml" file. By default, it looks for this file in your home
directory. For more information, see the "Caching a... |
from plumbum import local, FG
import tempfile
import os
# constants
FZF_URL = "https://github.com/junegunn/fzf"
class FzfPrompt:
def __init__(self):
self.sh = local['sh']
try:
self.fzf = local['fzf']
except:
raise SystemError("Cannot find 'fzf' installed on PATH. (... |
import re
class ParseError(Exception):
def __init__(self, message, line, line_num):
formatted_msg = "{}\nLine {}: {}".format(message, line_num, line)
super(ParseError, self).__init__(formatted_msg)
def parse(name):
r_decomment = re.compile(r"^(.*?)\s*(?:\/\/.*)?$")
r_group = re.compile(r"... |
import re
import math
import subprocess
import os
BIB_OPT_NS = "{http://www.bibblelabs.com/BibbleOpt/5.0/}"
CR_OPT_NS = "{http://ns.adobe.com/camera-raw-settings/1.0/}"
RDF_NS = "{http://www.w3.org/1999/02/22-rdf-syntax-ns#}"
EXT_REGEX = re.compile('\.[a-zA-Z]+$')
def xmp_filenames(filename):
bib_file = filename... |
# setup.py
#
# David J. Lampert (<EMAIL>)
#
# the setup file for PyHSPF
_version = '0.1.16'
# check for the required and optional dependencies
try:
import numpy
except:
print('error: required package "NumPy" is not installed')
raise
try:
import scipy
except:
print('error: required package "Sci... |
"""
Django settings for myweather project.
Generated by 'django-admin startproject' using Django 1.8.3.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.8/ref/settings/
"""
# Build pa... |
import logging
from extract_msg import constants
from extract_msg.properties import Properties
from extract_msg.utils import properHex
logger = logging.getLogger(__name__)
logger.addHandler(logging.NullHandler())
class Attachment(object):
"""
Developer version of the `extract_msg.attachment.Attachment` clas... |
from rest_framework import serializers
from rest_framework.reverse import reverse
from parties.api.next.serializers import MinimalPartySerializer
from popolo.api.next.serializers import (
BallotOnCandidacySerializer,
PersonOnBallotSerializer,
CandidacyOnBallotSerializer,
CANDIDACY_ON_PERSON_FIELDS,
)
f... |
__problem_title__ = "Modular inverses"
__problem_url___ = "https://projecteuler.net/problem=451"
__problem_description__ = "Consider the number 15. There are eight positive numbers less than 15 " \
"which are coprime to 15: 1, 2, 4, 7, 8, 11, 13, 14. The modular " \
"... |
import sys, csv, json, argparse, datetime
from collections import defaultdict
with open("../SETTINGS.json") as fp:
settings = json.loads(fp.read())
dt = datetime.datetime.now()
def main():
parser = argparse.ArgumentParser()
parser.add_argument('-d', type=int, action='store',
dest='city_num', ... |
import bisect
import supriya.synthdefs
from supriya.nonrealtime.bases import SessionObject
class Bus(SessionObject):
"""
A non-realtime bus.
::
>>> import supriya.nonrealtime
>>> session = supriya.nonrealtime.Session()
>>> bus = session.add_bus("control")
>>> print(repr(... |
import sys
from PyQt5.QtCore import QObject, pyqtSignal
from PyQt5.QtGui import QIcon
from PyQt5.QtWidgets import QMessageBox, QSystemTrayIcon
from plover import __name__ as __software_name__
from plover import log
class TrayIcon(QObject):
def __init__(self):
super().__init__()
self._supported ... |
"""Actions definitions."""
from qgis.core import Qgis, QgsAction, QgsVectorLayer
from qgis.utils import iface, plugins
from QuickOSM.core.utilities.utilities_qgis import open_webpage
from QuickOSM.qgis_plugin_tools.tools.i18n import tr
from QuickOSM.qgis_plugin_tools.tools.resources import resources_path
__copyright... |
import unittest
from gameboard.gameboard import Coordinate
from chess.piece import Type as Piece_Type, Color
from chess.piece import Pawn, Knight, Bishop, Rook, Queen, King
from chess.chess import Chess
class TestChess(unittest.TestCase):
def setUp(self):
self.chess = Chess()
def _print(self):
... |
import urllib
import sys
import json
from collections import defaultdict as dd
import argparse
from tabulate import tabulate
# Usage https://asciinema.org/a/18026
url_format = 'http://query.yahooapis.com/v1/public/yql?{0}&format=json'
query_format = '''select LastTradePriceOnly,symbol,Name
from yahoo.finan... |
from pathlib import Path
from unittest.mock import patch
from django.conf import settings
from django.test import TestCase, override_settings
from lib.l10n_utils import fluent
from lib.l10n_utils import translation
L10N_PATH = Path(__file__).with_name('test_files').joinpath('l10n')
def get_l10n(locales=None, ftl_... |
"""Preprocess seqeuences consistently and with respect to sequence modality.
These functions generalize tf.image functions to handle sequences of images.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow.compat.v2 as tf
def adjust_seq... |
XL_INVALID_PORTHANDLE = -1
XL_ACTIVATE_NONE = 0
XL_ACTIVATE_RESET_CLOCK = 8
XL_NO_COMMAND = 0
XL_RECEIVE_MSG = 1
XL_CHIP_STATE = 4
XL_TRANSCEIVER = 6
XL_TIMER = 8
XL_TRANSMIT_MSG = 10
XL_SYNC_PULSE ... |
# Modified from tabular_logger.py from OpenAI's evolutionary-strategies-starter project
import os
import shutil # ???
import sys
import time
from collections import OrderedDict
import tensorflow as tf
from tensorflow.core.util import event_pb2 # ???
from tensorflow.python import pywrap_tensorflow # ???
from tens... |
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Deleting field 'HiiCart.thankyou'
db.delete_column('hiicart_hiicart', 'thankyou')
def backwards(se... |
#!/usr/local/bin/python
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.mlab as mlab
from numpy import mean, var, sqrt
from matplotlib import cm
from mpl_toolkits.mplot3d import Axes3D
def loadfile(fileName):
return np.loadtxt(fileName)
def getTotalDelay(a):
t1 = a[0] - a[1]
t2 = a[2... |
from . import Image, FontFile
from ._binary import i8, i16le as l16, i32le as l32, i16be as b16, i32be as b32
# --------------------------------------------------------------------
# declarations
PCF_MAGIC = 0x70636601 # "\x01fcp"
PCF_PROPERTIES = (1 << 0)
PCF_ACCELERATORS = (1 << 1)
PCF_METRICS = (1 << 2)
PCF_BITM... |
"""Keyring implementation on Windows."""
from json import loads, dumps
from twisted.internet.threads import deferToThread
USERNAME = 'ubuntu_sso'
class Keyring(object):
"""A Keyring for a given application name."""
def __init__(self, keyring=None):
"""Create a new instance."""
if keyring i... |
from dtk.ui.button import SwitchButton
from dtk.ui.label import Label
from dtk.ui.draw import draw_text, draw_hlinear
from dtk_cairo_blur import gaussian_blur
from dtk.ui.utils import (propagate_expose, color_hex_to_cairo, cairo_disable_antialias, is_in_rect)
import gtk
import cairo
import pango
import gobject
from ... |
"""d3d10misc.h"""
from winapi import *
from d3d10 import *
ID3D10Blob = Interface("ID3D10Blob", IUnknown)
LPD3D10BLOB = Pointer(ID3D10Blob)
ID3D10Blob.methods += [
Method(LPVOID, "GetBufferPointer", []),
Method(SIZE_T, "GetBufferSize", []),
]
D3D10_DRIVER_TYPE = Enum("D3D10_DRIVER_TYPE", [
"D3D10_DRIVE... |
# -*- coding: utf-8 -*-
from 臺灣言語資料庫.資料模型 import 外語表
from 臺灣言語資料庫.資料模型 import 影音表
from 臺灣言語資料庫.資料模型 import 文本表
from 臺灣言語資料庫.關係模型 import 翻譯影音表
from 臺灣言語資料庫.關係模型 import 影音文本表
from 臺灣言語平臺.項目模型 import 平臺項目表
import json
from django.test import TestCase
from django.urls.base import resolve
from django.core.cache import c... |
from pylons import tmpl_context as c
from ming.orm.ormsession import ThreadLocalORMSession
from allura.websetup import bootstrap
from allura.lib import helpers as h
from allura.lib import plugin
from allura import model as M
from alluratest.controller import setup_basic_test
def setUp():
setup_basic_test()
cla... |
"""File to interact with cache folder to isolate cache handling functionality
from main controllers code.
The CacheHandler should only be accessed by controller classes.
"""
#.-------------------.
#| imports |
#'-------------------'
import os
import pickle
#.-------------------.
#| main ... |
##################################################################
# This file is part of the POPE implementation. #
# Paper at https://eprint.iacr.org/2015/1106 #
# U.S. Government work product, in the public domain. #
# Written in 2015 by Daniel S. Roche, <EMAIL> ... |
from tilegen import rendering
import os
import mapnik
class TilingParams:
def __init__(self, extent, minZoom, maxZoom, mapnik_map):
self.extent = extent
self.minZoom = minZoom
self.maxZoom = maxZoom
self.mapnik_map = mapnik_map
def getExtent(self):
return self.e... |
from datetime import datetime, date
import re
_multipliers = {
'': 1,
'kib': 2**10,
'mib': 2**20,
'gib': 2**30,
'tib': 2**40,
'kb': 10**3,
'mb': 10**6,
'gb': 10**9,
'tb': 10**12
}
_monthabbrs = ['jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', 'sep', 'oct', 'nov', 'dec']
de... |
from __future__ import unicode_literals
from .base import Base
class Edge(Base):
"""
The base class for a top level object that represents a connection between two devices
"""
def __init__(self, parent=None, **kwargs):
Base.__init__(self, parent, **kwargs)
@property
def source(self)... |
#!/usr/bin/env python
import threading
import socket
import sys
import time
from dnsdisttests import DNSDistTest, Queue
class TestCarbon(DNSDistTest):
_carbonServer1Port = 8000
_carbonServer1Name = "carbonname1"
_carbonServer2Port = 8001
_carbonServer2Name = "carbonname2"
_carbonQueue1 = Queue()
... |
"""Commands: "!addquote", "!delquote"."""
import json
from bot.commands.command import Command
from bot.paths import QUOTES_FILE
from bot.utilities.permission import Permission
class editQuoteList(Command):
"""Add or delete quote from a json-file."""
perm = Permission.Moderator
def __init__(self, bot):... |
import logging
import datetime
import hashlib
import os
import re
import time
import urllib
import urlparse
import jinja2
GITHUB_VIEW_TEMPLATE = 'https://github.com/%s/blob/%s/%s#L%s'
GITHUB_COMMIT_TEMPLATE = 'https://github.com/%s/commit/%s'
LINKIFY_RE = re.compile(
r'(^\s*/\S*/)(kubernetes/(\S+):(\d+)(?: \+0x[... |
from __future__ import unicode_literals
from os.path import basename, join, splitext
from glob import fnmatch
from hashlib import sha1
from django.conf import settings
from django.db import models
from django.db.models import Sum
from django.core.exceptions import ValidationError
from django.core.exceptions import Ob... |
''' Classes that represent audio clips. '''
from moviepy.audio.io.AudioFileClip import AudioFileClip
from moviepy.video.io.ffmpeg_reader import ffmpeg_parse_infos
from .base import Stim
class AudioStim(Stim):
''' Represents an audio clip.
Args:
filename (str): Path to audio file.
onset (fl... |
from __future__ import absolute_import
from __future__ import print_function
import shutil
import fileinput
import re
import sys
import os
import pwd
import socket
import dns.name
from ipaserver.install import service
from ipaserver.install import installutils
from ipapython import sysrestore
from ipapython import ip... |
from msrest.paging import Paged
class ExpressRouteServiceProviderPaged(Paged):
"""
A paging container for iterating over a list of :class:`ExpressRouteServiceProvider <azure.mgmt.network.v2016_09_01.models.ExpressRouteServiceProvider>` object
"""
_attribute_map = {
'next_link': {'key': 'nextL... |
# -*- coding: utf-8 -*-
'''
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in... |
#! env python
import sys
from pyweed import __version__, __app_name__, __pkg_path___
import os
from shutil import copy2
import pkg_resources
def build_mac_launcher():
"""
Build an .app bundle on Mac
"""
base_path = "%s.app" % __app_name__
os.makedirs(os.path.join(base_path, "Contents", "MacOS"),... |
#############################
# Testing for the `filters` utility module
#############################
import unittest
from scinet3.model import (Keyword, Document)
from scinet3.filters import (FilterRepository,
fb_threshold_filter,
kw_fb_threshold_filter,
... |
from collections import namedtuple
import os
import statistics
import sys
import tempfile
import time
from unittest_mixins.mixins import make_file
import coverage
from coverage.backward import import_local_file
from tests.helpers import SuperModuleCleaner
class StressResult(namedtuple('StressResult', ['files', 'ca... |
import proto # type: ignore
__protobuf__ = proto.module(
package='google.ads.googleads.v6.enums',
marshal='google.ads.googleads.v6',
manifest={
'UserListPrepopulationStatusEnum',
},
)
class UserListPrepopulationStatusEnum(proto.Message):
r"""Indicates status of prepopulation based on th... |
import functools
from typing import Callable, Dict, List, Tuple, Union, Iterator, cast, Sequence, Iterable, Set, Any
import cirq
import stim
@cirq.value_equality
class TwoQubitAsymmetricDepolarizingChannel(cirq.Gate):
def __init__(self, probabilities: Sequence[float]):
if len(probabilities) != 15:
... |
from __future__ import print_function
import time
import commands_proto as CP
import serial, os, inspect,platform
class Handler():
def __init__(self,timeout=1.0,**kwargs):
self.burstBuffer=b''
self.loadBurst=False
self.inputQueueSize=0
self.BAUD = 1000000
self.RPIBAUD = 500000
self.timeout=timeout
se... |
"""
Unit tests for datastore module.
"""
import mock
from oslo_utils import units
from cinder import test
from cinder.volume.drivers.vmware import datastore as ds_sel
from cinder.volume.drivers.vmware import exceptions as vmdk_exceptions
class DatastoreTest(test.TestCase):
"""Unit tests for Datastore."""
d... |
from unittest import TestCase
try:
from urllib.parse import parse_qs
except ImportError:
from urlparse import parse_qs
from google.appengine.api import apiproxy_stub_map
from google.appengine.api import urlfetch_stub
from minimock import mock
from prices import Price
from . import (Event, Item, PageView, repo... |
{
"name" : "Ineco Account Reports",
"description" : """
""",
"version" : "0.1",
"depends" : ["base","account"],
"author" : "INECO",
"category": "Report",
"url": "http://openerp.tititab.com",
"data": [ ],
'update_xml': [
'report_view.xml',
],
... |
from __future__ import unicode_literals, division, absolute_import
from builtins import * # pylint: disable=unused-import, redefined-builtin
import time
import pytest
from flexget.entry import Entry
from flexget.manager import Session
from flexget.plugins.internal.api_trakt import TraktUserAuth
from flexget.plugins... |
import warnings
import numpy as np
import itertools
from skimage import (img_as_float, img_as_float32, img_as_float64,
img_as_int, img_as_uint, img_as_ubyte)
from skimage.util.dtype import convert
from skimage._shared._warnings import expected_warnings
from skimage._shared import testing
from ski... |
# -*- coding: utf-8 -*-
__version__ = '0.7.0'
__author__ = 'Tomasz Czyż <<EMAIL>>'
__license__ = "Apache 2"
import os
import re
import sys
import json
import copy
import uuid
import hashlib
import argparse
import functools
import posixpath
import pkg_resources
import sphinx
from sphinx.locale import _
from sphinx.en... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.