code stringlengths 1 199k |
|---|
from mock import patch
from httmock import urlmatch, HTTMock
from django.core import cache
from django.test import TestCase
from django.test.utils import override_settings
from url_sso.context_processors import login_urls
from url_sso.tests.utils import RequestTestMixin, UserTestMixin
from url_sso.exceptions import Req... |
"""as http://sleepyti.me/, give you the best time to go to bed"""
import re
import imp
from datetime import datetime, timedelta, timezone
from hooks import hook
nemubotversion = 3.4
from more import Response
def help_full():
return ("If you would like to sleep soon, use !sleepytime to know the best"
" t... |
from pres import *
from pv import *
__version__ = '1.5'
__all__ = ['wrf_to_pres','wrf_to_pv'] |
import os.path
import re
from pkg_resources import resource_filename
from deform import Form
try:
import psycopg2
psycopg2.__version__
except ImportError: # pragma: no cover
# psycopg2cffi is psycopg2 compatible for pypy
from psycopg2cffi import compat
# by calling this hook SQLAlchemy will find th... |
import inspect
import os
import re
import shutil
import llnl.util.tty as tty
from llnl.util.filesystem import (
filter_file,
find,
get_filetype,
path_contains_subdirectory,
same_path,
working_dir,
)
from llnl.util.lang import match_predicate
from spack.directives import extends
from spack.packag... |
"""GtkButton support for the Kiwi Framework"""
import datetime
from gi.repository import GObject, Gtk, GdkPixbuf
from kiwi import ValueUnset
from kiwi.datatypes import number
from kiwi.ui.proxywidget import ProxyWidgetMixin
from kiwi.utils import gsignal
class ProxyButton(Gtk.Button, ProxyWidgetMixin):
"""
A Pr... |
from pycopia.aid import Enum
import pycopia.SMI.Basetypes
Range = pycopia.SMI.Basetypes.Range
Ranges = pycopia.SMI.Basetypes.Ranges
from pycopia.SMI.Objects import ColumnObject, MacroObject, NotificationObject, RowObject, ScalarObject, NodeObject, ModuleObject, GroupObject
from SNMPv2_SMI import OBJECT_TYPE, MODULE_IDE... |
""" Exception types used by the justbytes class. """
import abc
class RangeError(Exception, metaclass=abc.ABCMeta):
"""Generic Range error."""
class RangeValueError(RangeError):
"""
Raised when a parameter has an unacceptable value.
May also be raised when the parameter has an unacceptable type.
"""... |
import sys
OUT = 1
IN = 2
class PopupNotice:
def __init__(self):
self.w = None
self.deferred = None
def popup(self, text, buttons=('OK',), timeout=5000):
import gtk, gtk.gdk
from twisted.internet import defer
self.deferred = defer.Deferred()
self.win = gtk.Window(... |
l = [x for x in range(4)]
l[0] ## type int |
"""": # -*-python-*-
bup_python="$(dirname "$0")/bup-python" || exit $?
exec "$bup_python" "$0" ${1+"$@"}
"""
import os, sys, struct
from bup import options, git
from bup.helpers import *
suspended_w = None
dumb_server_mode = False
def do_help(conn, junk):
conn.write('Commands:\n %s\n' % '\n '.join(sorted(com... |
from abc import ABCMeta, abstractmethod
import os
import sqlite3
import logging
logger = logging.getLogger(__name__)
class BaseDb(metaclass=ABCMeta):
""" Abstract class that provides an interface to a SQLite db """
class Point:
def __init__(self, x, y):
self.x, self.y = x, y
def __re... |
from __future__ import unicode_literals, print_function, division
__author__ = "mozman <mozman@gmx.at>"
from .xmlns import CN, etree
from .nodestructuretags import TABLE_ROWS
from .tablenormalizer import normalize_table
from .tableutils import get_table_rows, new_empty_cell, is_table
from .conf import config
class Tabl... |
from spack import *
class PyPudb(PythonPackage):
"""Full-screen console debugger for Python"""
homepage = "http://mathema.tician.de/software/pudb"
url = "https://pypi.io/packages/source/p/pudb/pudb-2017.1.1.tar.gz"
version('2017.1.1', '4ec3302ef90f22b13c60db16b3557c56')
version('2016.2', '457... |
import pycurl
import unittest
class PycurlObjectTest(unittest.TestCase):
def setUp(self):
self.curl = pycurl.Curl()
def tearDown(self):
self.curl.close()
def test_set_attribute_curl(self):
self.instantiate_and_check(self.check_set_attribute, 'Curl')
def test_get_attribute_curl(se... |
"""Test of line navigation output of Firefox."""
from macaroon.playback import *
import utils
sequence = MacroSequence()
sequence.append(KeyComboAction("<Control>r"))
sequence.append(KeyComboAction("<Control>Home"))
sequence.append(utils.StartRecordingAction())
sequence.append(KeyComboAction("Down"))
sequence.append(ut... |
"""
Convert between bytestreams and higher-level AMQP types.
2007-11-05 Barry Pederson <bp@barryp.org>
"""
from __future__ import absolute_import
import calendar
import sys
from datetime import datetime
from decimal import Decimal
from io import BytesIO
from struct import pack, unpack_from
from time import mktime
from ... |
"""
Comparison of parallel modified vorticity balance.
"""
import pickle
import matplotlib.pylab as plt
import numpy as np
import scipy.constants as cst
from boututils.options import BOUTOptions
import os, sys
commonDir = os.path.abspath("./../../../common")
sys.path.append(commonDir)
from CELMAPy.plotHelpers import (S... |
"""
Satellite Simulation
Class Algorithms
This class is responsible for keeping the algorithms in place, and
seperate them from data.
Author: Patryk Zabkiewicz
Date: 09.08.2015
"""
class Algorithms:
def __init__(self):
self.__data = []
def trilateration(self):
pos = []
return pos
de... |
from abc import abstractmethod
from CachedMethods import class_cached_property
from collections import defaultdict
from typing import Optional, Tuple, Dict, Set, List, Type
from .core import Core
from ..._functions import tuple_hash
from ...exceptions import IsNotConnectedAtom, ValenceError
class Element(Core):
__s... |
"""
Contains XML text for documents to be distributed
with the suds lib. Also, contains classes for accessing
these documents.
"""
from io import StringIO
from logging import getLogger
log = getLogger(__name__)
encoding = \
"""<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema... |
from pycp2k.inputsection import InputSection
class _xalpha4(InputSection):
def __init__(self):
InputSection.__init__(self)
self.Section_parameters = None
self.Xa = None
self.Scale_x = None
self._name = "XALPHA"
self._keywords = {'Xa': 'XA', 'Scale_x': 'SCALE_X'}
... |
from collections import OrderedDict
import pytest
from frozendict import frozendict
from traitlets import HasTraits
from uchroma.traits import FrozenDict
class FrozenDictTest(HasTraits):
popsicle = FrozenDict()
def __init__(self, *args, **kwargs):
super(FrozenDictTest, self).__init__(*args, **kwargs)
ob... |
import re
import settings
from analyzer import Analyzer
from mutagen.easyid3 import EasyID3
class MusicFileMetadataReader(object):
def get_file_type(self):
return self.file.full_path.split('.')[-1].lower()
def __init__(self, file):
self.file = file
def get_from_mp3(self):
id3_file = ... |
from casadi import *
import numpy as NP
import matplotlib.pyplot as plt
nk = 20 # Control discretization
tf = 10.0 # End time
coll = True # Use collocation integrator
numStates = 3
numActions = 1
def actionIdx(actionK, timestepK):
if timestepK > nk - 1:
raise ValueError("timestepK > nk - 1")
if timestep... |
from __future__ import print_function
from rez.vendor import yaml
from rez.serialise import FileFormat
from rez.package_resources_ import help_schema, late_bound
from rez.vendor.schema.schema import Schema, Optional, And, Or, Use
from rez.vendor.version.version import Version
from rez.utils.sourcecode import SourceCode... |
import urllib2
from sgmllib import SGMLParser
class ListName(SGMLParser):
def __init__(self):
SGMLParser.__init__(self)
self.is_h5=""
self.name=[]
def start_h5(self,attrs):
self.is_h5=1
def end_h5(self):
self.is_h5=""
def handle_data(self,text):
if self.is... |
import libebkvfd
vfd = libebkvfd.EbkVfd("192.168.21.151")
vfd.send(u"Hello world!")
vfd.send(u"äöüÄÖÜß") |
class Monster:
def __init__(self, name, char, color):
self.name = name
self.char = char
self.color = color |
import bs
import bsUtils
import random
def bsGetAPIVersion():
return 4
def bsGetGames():
return [Siege]
class SiegePowerupFactory(bs.PowerupFactory):
def getRandomPowerupType(self,forceType=None,excludeTypes=['tripleBombs','iceBombs','impactBombs','shield','health','curse','snoball','bunny']):
while... |
import sys
with open(sys.argv[1], 'r') as f:
while True:
x = f.read(1)
if len(x) == 0:
break
if ord(x) not in (0, 13):
sys.stdout.write(x) |
new test class from UI;
another test line for usage of diffs;
Final messege ;
Again;
Collision test
Some new features
One new line |
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
from numpy.random import randn
from pandas import Series, date_range, DataFrame
ts = Series(randn(1000), index=date_range('1/1/2000', periods=1000))
ts = ts.cumsum()
ts.plot()
plt.savefig("test.png")
df = DataFrame(randn(1000, 4), index=ts.index, c... |
"""
Accessing web helping functions module
"""
import unittest
import unittest.mock
import sys
import os
import argparse
import re
import random
import subprocess
import getpass
import shutil
import tempfile
import urllib.request
import random
import warnings
class Webhelp(urllib.request.FancyURLopener, object):
""... |
"""Module containing config classes helpers"""
import logging
LOGGER = logging.getLogger(__name__)
import sys
import os
import json
from clu.common.base import Configurable
class ConfiguratorException(Exception):
"""
Exceptions raised by Configurator
"""
pass
class Configurator(Configurable):
"""
Class cont... |
import ops.cmd
import util.mac
import dsz
from scanengine2 import scan
def _whats_your_job():
return 'netbios'
def _whats_your_name():
return 'netbios'
def _support_ipv6():
return False
class netbios(scan, ):
def __init__(self, job, timeout=None):
scan.__init__(self, job)
self.scan_type ... |
'''
Created on Sep 6, 2013
@author: Stephen O'Hara
Module with functions helpful to generate cross-validation
splits of data.
This module is a refactoring and extension of code previously
found in the data_mgmt module.
'''
import scipy as sp
def getMinClassSize(L):
minsize = sp.inf
for label in sp.unique(L):
... |
import os, functools, json, logging
from flask import Flask, redirect, session, request, g, jsonify, make_response, abort, send_from_directory
from flask_sqlalchemy import SQLAlchemy
from flask_login import LoginManager, login_user, logout_user, current_user, login_required
from flask_socketio import SocketIO, emit
fro... |
import sys
sys.dont_write_bytecode = True
from traceback import format_exc as formatted_exception, extract_stack
from inspect import currentframe as inspect_currentframe, getmembers as inspect_getmembers
from os.path import split as path_split, exists as path_exists
from copy import deepcopy
get_globals = globals
get_... |
from itertools import count, takewhile
def fib():
a, b = 1, 0
while(True):
a, b = a + b, a
yield a
print sum(filter(lambda y: not y % 2, takewhile(lambda x: x <= 4000000, fib()))) |
from . import common
from ..context_mgr import ZIBEException
from .. import zbutil
import logging
@common.zibe_plugin('process_services', 'Process Management Plugin')
class ProcessServicesPlugin(common.ZBCommandPlugin):
def help_pslist(self):
return '\n'.join(['pslist [reg] - List all currently running proc... |
from __future__ import unicode_literals
from django.apps import AppConfig
class EpicsConfig(AppConfig):
name = 'epics' |
"""Async gunicorn worker for aiohttp.web"""
import asyncio
import os
import re
import signal
import sys
from types import FrameType
from typing import Any, Awaitable, Callable, Optional, Union # noqa
from gunicorn.config import AccessLogFormat as GunicornAccessLogFormat
from gunicorn.workers import base
from aiohttp i... |
__version__ = "0.2.4.dev" |
import setuptools, os
with open(os.path.join("README"), 'r') as r:
README_TEXT = r.read()
__description__ = """
Differential expression detection between gene expression time series experiments with confounder correction and timehift detection.
"""
def get_recursive_data_files(path):
out = []
for (p... |
import proto # type: ignore
from google.cloud.aiplatform_v1.types import (
migratable_resource as gca_migratable_resource,
)
from google.cloud.aiplatform_v1.types import operation
from google.rpc import status_pb2 # type: ignore
__protobuf__ = proto.module(
package="google.cloud.aiplatform.v1",
manifest={... |
from model.contact import Contact
import re
class ContactHelper:
def __init__(self, app):
self.app = app
def get_contact_from_view_page(self, index):
wd = self.app.wd
self.open_contact_view_by_index(index)
text = wd.find_element_by_id("content").text
homephone = re.search... |
import numpy as np
import pandas as pd
import pytest
import tensorflow as tf
from autokeras import test_utils
from autokeras.adapters import output_adapters
def test_clf_head_transform_pd_series_to_dataset():
adapter = output_adapters.ClassificationAdapter(name="a")
y = adapter.adapt(
pd.read_csv(test_u... |
import re
import sys
inputString = sys.argv[1]
underScoreCount = len(re.findall('_', inputString))
if underScoreCount < 1:
print 'ERROR: >>>', inputString, '<<< is missing a suffix seperated by an underscore.'
if underScoreCount > 1:
print 'ERROR: >>>', inputString, '<<< contains underscore other than to denot... |
"""
nntpPyClient main window
Here is main window definition in Tkinter
author: Miroslav Slivka
"""
import sysconfig
import threading
from tkinter import *
from nntplib import *
from idlelib.IOBinding import encoding
class TGetGrps(threading.Thread):
def __init__(self,container,lst):
threading.Thread.__init_... |
from google.cloud import contact_center_insights_v1
def sample_delete_conversation():
# Create a client
client = contact_center_insights_v1.ContactCenterInsightsClient()
# Initialize request argument(s)
request = contact_center_insights_v1.DeleteConversationRequest(
name="name_value",
)
... |
from google.cloud import aiplatform_v1
async def sample_update_entity_type():
# Create a client
client = aiplatform_v1.FeaturestoreServiceAsyncClient()
# Initialize request argument(s)
request = aiplatform_v1.UpdateEntityTypeRequest(
)
# Make the request
response = await client.update_entity... |
from setuptools import setup
setup(
name='humancrypto',
version='0.5.0',
description='Cryptography for Humans',
author='Matt Haggard',
author_email='haggardii@gmail.com',
url='https://github.com/iffy/humancrypto',
packages=[
'humancrypto',
],
package_data={'humancrypto': ['VE... |
import ConfigParser
import os,sys
class ConfigManager(object):
def __init__(self):
super(self.__class__,self).__init__()
self.__config = {}
@property
def config(self):
return self.__config
@config.setter
def config(self,Map):
# for key in Map:
# self.__co... |
from django.core.urlresolvers import reverse
from mock import patch
from model_mommy import mommy
from apps.boards.models import Board, Step, BoardPosition
from apps.core.tests.utils import LoggedTestCase
from apps.issues.models import Issue
from apps.issues.views import IssueAdvanceView
class IssueAdvanceViewTest(Logg... |
"""IANA registered Content-Type type and subtype values."""
__version__ = '1.0'
__copyright__ = """Copyright 2011 Lance Finn Helsten (helsten@acm.org)"""
__license__ = """
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 co... |
"""Experiment class collecting information needed for a single training run."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import time
from tensorflow.python.platform import tf_logging as logging
class Experiment(object):
"""Experiment is a class conta... |
from __future__ import with_statement
import os
import sys
import textwrap
import unittest
import subprocess
import tempfile
try:
# Python 3.x
from test.support import strip_python_stderr
except ImportError:
# Python 2.6+
try:
from test.test_support import strip_python_stderr
except ImportEr... |
from django import forms
from django.conf import settings
from django.http import HttpResponse, HttpResponseRedirect, Http404
from django.contrib.auth import authenticate, login
from manager import models as pmod
from . import templater
import decimal, datetime, string, random
from django.core.mail import send_mail, Em... |
import json
from django.test.utils import override_settings
from restclients_core.exceptions import DataFailureException
from uw_sws.models import Registration
from myuw.test.api import MyuwApiTest, fdao_sws_override, fdao_pws_override
from myuw.views.api.instructor_section import InstSectionDetails,\
LTIInstSectio... |
"""Template platform that aggregates meteorological data."""
import voluptuous as vol
from homeassistant.components.weather import (
ATTR_CONDITION_CLOUDY,
ATTR_CONDITION_EXCEPTIONAL,
ATTR_CONDITION_FOG,
ATTR_CONDITION_HAIL,
ATTR_CONDITION_LIGHTNING,
ATTR_CONDITION_LIGHTNING_RAINY,
ATTR_COND... |
"""Axis binary sensor platform tests."""
from unittest.mock import Mock
from homeassistant import config_entries
from homeassistant.components import axis
import homeassistant.components.binary_sensor as binary_sensor
from homeassistant.setup import async_setup_component
EVENTS = [
{
"operation": "Initializ... |
"""Testing dockerized apps
"""
import argparse
import random
import shutil
import time
import pytest
from parsl.providers import LocalProvider
from parsl.app.app import App
from parsl.config import Config
from parsl.dataflow.dflow import DataFlowKernel
from parsl.executors.ipp import IPyParallelExecutor
config = Config... |
from bulbs.config import Config
from bulbs.titan import Graph
import sys
c = Config("http://localhost:8182/graphs/enron")
g = Graph(c)
try:
f = open("email_graph.txt")
f.readline()
except IOError as e:
raise
verts = {}
report = 1000
g.vertices.index.create_key("email")
for (i, line) in enumerate(f):
try... |
import myunittest
class Common(myunittest.TestCase):
def test_k(self):
self.assertEqual(len(self.config.goroutines), 1)
self.assertEqual(self.config.goroutines[0].k, "$unit")
def test_c_type(self):
self.assertEqual(len(self.config.channels), 1)
self.assertEqual(self.config.channels[0].type, int)
... |
from parsl.config import Config
from parsl.executors import HighThroughputExecutor
from parsl.providers import KubernetesProvider
from parsl.addresses import address_by_route
config = Config(
executors=[
HighThroughputExecutor(
label='kube-htex',
cores_per_worker=1,
max_w... |
import streamcorpus as sc
from .data import Resource, get_resource_manager
import os
import signal
import Queue
import gzip
import numpy as np
import pandas as pd
import marisa_trie
from sklearn.cluster import AffinityPropagation
def get_loc_sequences(doc):
seqs = []
for sentence in doc:
buff = []
... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tempfile
import numpy as np
import tensorflow as tf
from tensorflow import flags
from tensorflow.examples.tutorials.mnist import input_data
from tensorflow.lite.experimental.examples.lstm.tflite_rnn impor... |
"""
Copyright [2009-2020] EMBL-European Bioinformatics Institute
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed... |
"""Tails the oplog of a shard and returns entries
"""
import bson
import logging
import pymongo
import sys
import time
import threading
from mongo_connector import util
from mongo_connector import errors
try:
from pymongo import MongoClient as Connection
except ImportError:
from pymongo import Connection
class ... |
from distutils.core import setup
import glob
import os.path
setup(name='bat',
version='37.0',
description='Binary Analysis Tool',
author='Binary Analysis Project',
author_email='info@binaryanalysis.org',
url='http://www.binaryanalysis.org/',
packages=['bat'],
license="Apache 2.... |
"""
This module for test.
"""
import os
import sys
import unittest
import uuid
file_path = os.path.normpath(os.path.dirname(__file__))
sys.path.append(file_path + '/../../')
import baidubce
from baidubce.auth.bce_credentials import BceCredentials
from baidubce.bce_client_configuration import BceClientConfiguration
from... |
from ..broker import Broker
class BasicServicesBroker(Broker):
controller = "basic_services"
def authenticate(self, **kwargs):
"""Authenticates the user with NetMRI.
**Inputs**
| ``api version min:`` None
| ``api version max:`` None
| ``required:`` True... |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('iho', '0003_request'),
]
operations = [
migrations.RemoveField(
model_name='request',
name='request',
),
migratio... |
import os
import sys
import imp
import json
from buildcontext import Context, DeferredDependency
from buildtarget import BuildTarget
from compositors import BuildTargetList
from buildcontextfseventhandler import BuildContextFsEventHandler
from helpers import pout, perror
from time import sleep
from watchdog.observers i... |
"""
Checks if a log message contains one or more valid MANTIS ID,
with a MANTIS ID <#> that is set to status 'in_progress' and
handled by the correct user.
"""
from modules import Mantis
import re
def run(transaction, config):
mantis = Mantis.Mantis(config)
logMessage = transaction.getCommitMsg()
pattern = ... |
from .model import RFModel # noqa # pylint: disable=unused-import |
r"""Entry point for evaluating agents on the Balloon Learning Environment.
"""
import json
import os
from typing import Sequence
from absl import app
from absl import flags
from balloon_learning_environment.env import balloon_env # pylint: disable=unused-import
from balloon_learning_environment.env import generative_w... |
import logging
import operator
import os
from argparse import Namespace
from unittest import mock
import numpy as np
import pytest
import torch
import yaml
from omegaconf import OmegaConf
from pytorch_lightning import Trainer
from pytorch_lightning.loggers import TensorBoardLogger
from pytorch_lightning.utilities.impor... |
"""Writers for Travis-CI script files."""
from __future__ import unicode_literals
import os
from l2tdevtools.dependency_writers import interface
class TravisInstallScriptWriter(interface.DependencyFileWriter):
"""Travis-CI install.sh file writer."""
_TEMPLATE_FILE = os.path.join('data', 'templates', 'install.sh')
... |
from download_single_item import LesionImageDownloader as ImgDownloader, SegmentationDownloader as SegDownloader
import argparse
import os
import sys
import requests
from os.path import join
from multiprocessing.pool import Pool, ThreadPool
from itertools import repeat
from tqdm import tqdm
def download_archive(num_ima... |
"""Tests for the domain_objects_validator."""
from __future__ import annotations
import os
from core import feconf
from core import python_utils
from core import utils
from core.controllers import domain_objects_validator
from core.tests import test_utils
class ValidateExplorationChangeTests(test_utils.GenericTestBase)... |
import os, sys, re
this_dir = os.path.dirname(os.path.abspath(__file__))
sys.path.append(os.path.abspath(os.path.join(this_dir, "..")))
from common import dict_has_non_empty_member
module_support_dir = os.path.abspath(os.path.join(this_dir, "..", "..", "support", "module", "support"))
sys.path.append(module_support_dir... |
'''
email utilities
'''
import sys
import smtplib
from config import panda_config
from pandalogger.PandaLogger import PandaLogger
_logger = PandaLogger().getLogger('MailUtils')
class MailUtils:
# constructor
def __init__(self):
pass
# main
def send(self,toAddr,mailSubject,mailBody):
_log... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import numpy as np # type: ignore
import onnx
from ..base import Base
from . import expect
class EyeLike(Base):
@staticmethod
def export_without_dtype(): # type:... |
import os
from django.conf import settings
engines = {
'sqlite': 'django.db.backends.sqlite3',
'postgresql': 'django.db.backends.postgresql_psycopg2',
'mysql': 'django.db.backends.mysql',
}
def db_config():
service_name = os.getenv('DATABASE_SERVICE_NAME', '').upper().replace('-', '_')
if service_na... |
import django_tables2 as tables
from rapidsms.backends.database.models import BackendMessage
class MessageTable(tables.Table):
class Meta:
model = BackendMessage
sequence = ('date', 'identity', 'direction', 'text')
exclude = ('id', 'name', 'message_id', 'external_id')
order_by = ('-d... |
import logging
from django.core.urlresolvers import reverse
from django.utils.http import urlencode
from django.utils import safestring
from django.utils.translation import ugettext_lazy as _
from horizon import tables
from openstack_dashboard import api
from openstack_dashboard.api import cinder
from ...volumes import... |
"""
Basic tests for verify functions
"""
import libnacl
import unittest
class TestVerify(unittest.TestCase):
def test_verify16(self):
v16 = libnacl.randombytes_buf(16)
v16x = v16[:]
self.assertTrue(libnacl.crypto_verify_16(v16, v16x))
self.assertTrue(libnacl.bytes_eq(v16, v16x))
... |
"""Utilities for boxes.
Axis-aligned utils implemented based on:
https://github.com/facebookresearch/detr/blob/master/util/box_ops.py.
Rotated box utils implemented based on:
https://github.com/lilanxiao/Rotated_IoU.
"""
from typing import Any, Union
import jax
import jax.numpy as jnp
import numpy as np
PyModule = Any
... |
from pprint import pprint
import unittest
import kfp.deprecated as kfp
import kfp_server_api
import os
from minio import Minio
from .lightweight_python_functions_v2_with_outputs import pipeline
from kfp.samples.test.utils import KfpMlmdClient, run_pipeline_func, TestCase
def verify(run: kfp_server_api.ApiRun, mlmd_conn... |
import subprocess
import argparse
import json
import sys
import os
import threading
import json
class RunWithTimeout(threading.Thread):
def __init__(self, command):
self.command = command
threading.Thread.__init__(self)
def run(self):
self.process = subprocess.Popen(self.command)
... |
values = []
with open('values.txt', 'r') as myfile:
data = myfile.read()
data = data.split("\n")
for d in data:
result = d.split(" = ")
values.append(result[0].replace(" ", ""))
with open('rust_formats.txt', 'r') as myfile:
data = myfile.read()
data = data.replace("\n", "").replace("... |
EXCLUDED_FILES = [
# Third-party code that doesn't match our style
"puppet/zulip/lib/puppet/parser/functions/join.rb",
"puppet/zulip/lib/puppet/parser/functions/range.rb",
"puppet/zulip/files/nagios_plugins/zulip_nagios_server/check_website_response.sh",
"scripts/lib/third",
"static/third",
... |
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'CustomBuildingHeaders.super_organization'
db.add_column(u'seed_custombuildingheaders... |
'''
Custom filters for use in openshift-ansible
'''
from ansible import errors
from operator import itemgetter
import pdb
class FilterModule(object):
''' Custom ansible filters '''
@staticmethod
def oo_pdb(arg):
''' This pops you into a pdb instance where arg is the data passed in
from t... |
import logging
import itertools
import math
import urllib
import httplib as http
from modularodm import Q
from modularodm.exceptions import NoResultsFound
from flask import request
from framework import utils
from framework import sentry
from framework.auth.core import User
from framework.flask import redirect # VOL-a... |
class Solution(object):
def minPathSum(self, grid):
"""
:type grid: List[List[int]]
:rtype: int
"""
row = len(grid)
if row == 0:
return 0
col = len(grid[0])
if col == 0:
return 0
dp = [[0] * col for _ in range(row)]
... |
import sys, os
import win32api, win32pdhutil, win32con
if sys.platform != 'win32':
import pwd
import commands
from mozrunner import killableprocess
import logging
import signal
import exceptions
from StringIO import StringIO
from time import sleep
import subprocess
from subprocess import Popen, PIPE, call
from date... |
"""Benchmark log2."""
from __future__ import print_function
import timeit
import sys
NAME = "log2"
REPEATS = 3
ITERATIONS = 1000000
def print_version():
"""Print the TAP version."""
print("TAP version 13")
def print_summary(total, passing):
"""Print the benchmark summary.
# Arguments
* `total`: tota... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.