src stringlengths 721 1.04M |
|---|
# latency.py Benchmark for uasyncio. Author Peter Hinch July 2018.
# This measures the scheduling latency of a notional device driver running in the
# presence of other coros. This can test asyncio_priority.py which incorporates
# the priority mechanism. (In the home directory of this repo).
# When running the test t... |
###############################################################################
##
## Copyright (C) 2014-2015, New York University.
## Copyright (C) 2011-2014, NYU-Poly.
## Copyright (C) 2006-2011, University of Utah.
## All rights reserved.
## Contact: contact@vistrails.org
##
## This file is part of VisTrails.
##
## ... |
from greedy import *
import time
filename = 'circuit_sensor_1_Simplified.net'
G = nx.DiGraph()
G = read_netlist(filename)
uncon_comp_tups = []
contactor_tups = []
declaration = init(G, uncon_comp_tups, contactor_tups)
sensors = ['S1', 'S2']
con_conts = ['C1', 'C3', 'C4', 'C6']
result = generate_database(G, sensors, c... |
import sys
import unittest
class Command():
"""Use factory method 'create(command_name)' to instantiate"""
def __init__(self, arguments, executionEngine):
self.arguments = arguments
self.executionEngine = executionEngine
def execute(self):
raise NotImplementedError()
class StartC... |
# The MIT License (MIT)
# Copyright (c) 2017 Microsoft Corporation
# 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 without limitation the rights
# to use, copy... |
"""Special dicts"""
__author__ = 'thor'
from collections import defaultdict, UserDict
from ut.pdict.get import set_value_in_nested_key_path
val_unlikely_to_be_value_of_dict = (1987654321, 8239080923)
class keydefaultdict(defaultdict):
def __missing__(self, key):
ret = self[key] = self.default_factory(ke... |
AR = '/usr/bin/ar'
ARFLAGS = 'rcs'
CCFLAGS = ['-g']
CCFLAGS_MACBUNDLE = ['-fPIC']
CCFLAGS_NODE = ['-D_LARGEFILE_SOURCE', '-D_FILE_OFFSET_BITS=64']
CC_VERSION = ('4', '6', '1')
COMPILER_CXX = 'g++'
CPP = '/usr/bin/cpp'
CPPFLAGS_NODE = ['-D_GNU_SOURCE']
CPPPATH_NODE = '/usr/local/include/node'
CPPPATH_ST = '-I%s'
CXX = [... |
__author__ = 'Michael Andrew michael@hazardmedia.co.nz'
import random
import pygame
from pygame import mixer
from pygame.mixer import Sound
from nz.co.hazardmedia.sgdialer.config.Config import Config
from nz.co.hazardmedia.sgdialer.models.SoundModel import SoundModel
from nz.co.hazardmedia.sgdialer.events.EventType im... |
# -*- coding: utf-8 -*-
# Copyright 2012 Loris Corazza, Sakis Christakidis
#
# 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
#
# U... |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Copyright 2012 Nebula, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# no... |
import os
import unittest
from coala_quickstart.info_extractors.PackageJSONInfoExtractor import (
PackageJSONInfoExtractor)
from coala_quickstart.info_extraction.Information import (
LicenseUsedInfo, ProjectDependencyInfo, IncludePathsInfo, ManFilesInfo,
VersionInfo)
from tests.TestUtilities import generat... |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from datetime import datetime, timedelta
import json
from odoo import models, api, fields, _
from odoo.exceptions import UserError
from odoo.http import request
class WebsiteVisitor(models.Model):
_inherit = 'webs... |
#!/usr/bin/env python
class Solution(object):
def isMatch(self, s, p):
"""
Returns a boolean indicating if the pattern p matches string s. See
LeetCode problem description for full pattern spec.
"""
n = len(s)
m = len(p)
# If the pattern has more non-star c... |
from django import forms
from django.utils.translation import ugettext_lazy as _
from django.conf import settings
# Frank Sokolic: June 2018 - Disabled all the recaptcha code as version 1 is no longer supported
#from cmsplugin_contact.nospam.widgets import RecaptchaChallenge, RecaptchaResponse
from registration.forms ... |
from __future__ import with_statement
import decimal
from sympy import (Rational, Symbol, Float, I, sqrt, oo, nan, pi, E, Integer,
S, factorial, Catalan, EulerGamma, GoldenRatio, cos, exp,
Number, zoo, log, Mul, Pow, Tuple)
from sympy.core.basic import _aresame
from sympy.core.powe... |
import pytest
from src.knapsack import _knapsack_0, _knapsack_1, _knapsack_2, _knapsack_3
knapsacks = [_knapsack_0, _knapsack_1, _knapsack_2, _knapsack_3]
@pytest.mark.parametrize("knapsack", knapsacks)
def test_one_element_0(knapsack):
assert knapsack(0, [1], [1]) == 0
@pytest.mark.parametrize("knapsack", ... |
"""
Bot code for creating chemical items in wikidata from UNII
Adapted from: https://github.com/sebotic/cdk_pywrapper/blob/master/cdk_pywrapper/chemlib.py
"""
import os
import re
import subprocess
import time
import zipfile
import pandas as pd
import wikidataintegrator.wdi_core as wdi_core
data_folder = "unii_data"
... |
from __future__ import unicode_literals
from django.db import models
from basicviz.models import Document, Experiment, Mass2Motif
from basicviz.constants import EXPERIMENT_STATUS_CODE
from decomposition.models import Decomposition, GlobalMotif
## tables for LDA experiment
class Sample(models.Model):
name = models... |
import gflags
import grpc
import logging
import riotwatcher
import sys
import time
import threading
from concurrent import futures
from powerspikegg.rawdata.public import match_pb2
from powerspikegg.rawdata.public import constants_pb2
from powerspikegg.rawdata.fetcher import cache
from powerspikegg.rawdata.fetcher im... |
#!/usr/bin/env python
"""MySQL implementation of the GRR relational database abstraction.
See grr/server/db.py for interface.
"""
import contextlib
import logging
import math
import random
import time
from typing import Callable
import warnings
# Note: Please refer to server/setup.py for the MySQLdb version that is ... |
# -*- coding: utf-8 -*-
################################################################################
### Copyright © 2012-2013 BlackDragonHunt
###
### This file is part of the Super Duper Script Editor.
###
### The Super Duper Script Editor is free software: you can redistribute it
### and/or modify it under the ... |
"""
Copyright 2015 INFN (Italy)
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 to in writing, ... |
#!/usr/bin/env python
import functools
import math
import random
import numpy as np
import matplotlib.pyplot as plt
plt.rc('text', usetex=True)
plt.rc('font', family='serif')
# 1D model
def model(x):
a = 2.7; d = 0.1; y_0 = 2
sigma = 0.001
result = y_0 - 0.04 * (x - a) - d * (x - a)**2
return resul... |
# Copyright 2015 Cloudbase Solutions Srl
# All Rights Reserved.
#
# 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 r... |
'''
# Description.
This is a minimal module in order to perform a circular arc slope stability
analysis by the limit equilibrium model by Fellenius and Bishop symplified
methods.
'''
#------------------------------------------------------------------------------
## Add functions directory
import sys
sys.pa... |
"""Test suite to test forwarders
Invoke with `python3 -m pytest forwarder_check.py --forwarder [IP of forwarder]`"""
# pylint: disable=C0301,C0111,C0103
# flake8: noqa
import ipaddress
import dns.message
# NOTE silence incorrectly reported error, may be removed once it passes in CI
import pytest # pylint: disable=wro... |
# -*- coding: utf-8 -*-
#
# jenkinsflow documentation build configuration file, created by
# sphinx-quickstart on Wed Apr 16 09:04:01 2015.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#... |
# This file is part of the syzygy-tables.info tablebase probing website.
# Copyright (C) 2015-2020 Niklas Fiekas <niklas.fiekas@backscattering.de>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Fo... |
# -*- coding: utf-8 -*-
# Copyright 2020 Google LLC
#
# 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... |
import logging
from datetime import datetime
from pajbot.tbutil import time_since, tweet_prettify_urls
from pajbot.models.db import DBManager, Base
import tweepy
from sqlalchemy import Column, Integer, String
log = logging.getLogger('pajbot')
class TwitterUser(Base):
__tablename__ = 'tb_twitter_following'
... |
# -*- coding: utf-8 -*-
u"""PyTest for :mod:`pykern.pkunit`
:copyright: Copyright (c) 2015 Bivio Software, Inc. All Rights Reserved.
:license: http://www.apache.org/licenses/LICENSE-2.0.html
"""
from __future__ import absolute_import, division, print_function
import pytest
def test_assert_object_with_json():
fro... |
import pp
from pp.component import Component
from pp.components.coupler_straight import coupler_straight
from pp.components.coupler_symmetric import coupler_symmetric
from pp.cross_section import get_waveguide_settings
from pp.snap import assert_on_1nm_grid
from pp.types import ComponentFactory
@pp.cell_with_validato... |
"""Test steps that are related to authorization tokens for the server API and jobs API."""
import os
import datetime
import json
from behave import when, then
import jwt
from jwt.contrib.algorithms.pycrypto import RSAAlgorithm
DEFAULT_AUTHORIZATION_TOKEN_FILENAME = "private_key.pem"
# try to register the SHA256 alg... |
#
"""test_cmdline - Test command line functionality."""
# Copyright © 2011-2019 James Rowe <jnrowe@gmail.com>
#
# SPDX-License-Identifier: GPL-3.0+
#
# This file is part of rdial.
#
# rdial is free software: you can redistribute it and/or modify it under the
# terms of the GNU General Public License as published by th... |
from __future__ import absolute_import
import abc
from uuid import uuid4
import responses
from exam import patcher
from mock import Mock, patch
from six import add_metaclass
from sentry.snuba.models import QueryDatasets, QuerySubscription, SnubaQuery, SnubaQueryEventType
from sentry.snuba.tasks import (
apply_da... |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import http
from odoo.http import request
from odoo.tools.translate import _
class WebsiteBackend(http.Controller):
@http.route('/website/fetch_dashboard_data', type="json", auth='user')
def fetch_da... |
#!/usr/bin/env python
# File created on 08 Jun 2012
from __future__ import division
__author__ = "Greg Caporaso"
__copyright__ = "Copyright 2011, The QIIME project"
__credits__ = ["Greg Caporaso"]
__license__ = "GPL"
__version__ = "1.8.0-dev"
__maintainer__ = "Greg Caporaso"
__email__ = "gregcaporaso@gmail.com"
from... |
# 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):
# Adding field 'CountryStockStats.days_of_stock_data'
db.add_column('vaxapp_countrystockstats', 'days_of_s... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import math
a = 6378.137 # km
f = 1/298.257222101 # GRS80
lon0 = 121
N0 = 0 # km
E0 = 250 # km
k0 = 0.9999
n = f / (2 - f)
A = a / (1 + n) * (1 + math.pow(n, 2) / 4 + math.pow(n, 4) / 64)
a1 = n / 2 - math.pow(n, 2) * 2 / 3 + math.pow(n, 3) * 5 / 16
a2 = math.pow(n, 2... |
import json
import pytest
from kuma.core.urlresolvers import reverse
from kuma.plus.models import LandingPageSurvey
@pytest.mark.django_db
def test_ping_landing_page_survey_happy_path(client, settings):
# This sets the needed session cookie
variant_url = reverse("api.v1.plus.landing_page_variant")
respo... |
# Copyright 2011 Dan Smith <dsmith@danplanet.com>
#
# 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 ... |
# Copyright 2012 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Copyright 2012 Nebula, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the... |
#!/usr/bin/env python
"""
Given strings S and T, finds the minimum substring of S which contains all the
characters in T. Done in O(n) time.
"""
def min_window(S, T):
freq = {}
for letter in T:
freq[letter] = 0
# search S until we find a substring with all chars
start = 0
... |
__author__ = 'jatwood'
import sys
import numpy as np
from sklearn.metrics import f1_score, accuracy_score
from sklearn.linear_model import LogisticRegression
import data
import kernel
def baseline_node_experiment(model_fn, data_fn, data_name, model_name):
print 'Running node experiment (%s)...' % (data_name,)
... |
"""
https://github.com/renmengye/revnet-public/blob/master/resnet/data/cifar_input.py
MIT License
Copyright (c) 2017 Mengye Ren
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 restrictio... |
"""
Pyhton script for resizing existing images
@author: wimmer simon-justus
@param dir: 1 directory that contains the raw data
@param w: width of file
@param h: height of file
"""
import sys
import os
import cv2
import numpy as np
from time import sleep
# function for resizing existing images
def resize_images(dir,w... |
# Legge il file di configurazione per produrre il lod
# import urllib
import sys
import csv
import string
try:
file_csv_config_main = open ('campi_config.csv')
except:
print 'File non trovato, provo da rete.'
def_campi=[]
# LEGGIAMO IL FILE CON IL NOME DEI TIPI DI CAMPO (Attenzione le prime 10 righe descriv... |
# -*- encoding: utf-8 -*-
from supriya.tools.synthdeftools.CalculationRate import CalculationRate
from supriya.tools.ugentools.Filter import Filter
class Lag3UD(Filter):
r'''An up/down exponential lag generator.
::
>>> source = ugentools.In.ar(bus=0)
>>> lag_3_ud = ugentools.Lag3UD.ar(
... |
"""
The MIT License (MIT)
Copyright (c) 2018 Zuse Institute Berlin, www.zib.de
Permissions are granted as stated in the license file you have obtained
with this software. If you find the library useful for your purpose,
please refer to README.md for how to cite IPET.
@author: Gregor Hendel
"""
from .StatisticReader ... |
import logging
from pyvisdk.exceptions import InvalidArgumentError
########################################
# Automatically generated, do not edit.
########################################
log = logging.getLogger(__name__)
def TaskReasonAlarm(vim, *args, **kwargs):
'''Indicates that the task was queued by an al... |
import sim, sim_items, main
from util import *
import random
class ReinforcedPrefix(sim_items.Prefix):
"""
"reinforced" prefix boosts armor by increasing its PV or EV (whichever would
normally be greater) by 1-3 points.
"""
def __init__(self):
super(ReinforcedPrefix, self).__init__(
... |
# 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 to in writing, software
# distributed under the ... |
# -*- coding: utf-8 -*-
"""
Functions and classes for generating analytics on physiological data
"""
import numpy as np
from scipy.signal import welch
from scipy.interpolate import interp1d
class HRV():
"""
Class for calculating various HRV statistics
Parameters
----------
data : Physio_like
... |
#!/usr/bin/env python
# ptp_fuzz.py - Fuzz a PTP implementation
# Copyright (C) 2016 Matthias Kruk
#
# 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 2 of the License, or
# (at yo... |
"""
Created on Jan 25, 2012
@author: Trung Dong Huynh
"""
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import unittest
import logging
import os
from prov.model import ProvDocument, ProvException
from prov.tests import examples
from prov.tests.attributes... |
#
# PySTDF - The Pythonic STDF Parser
# Copyright (C) 2006 Casey Marshall
#
# 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 2
# of the License, or (at your option) any later versi... |
from __future__ import absolute_import
import responses
import six
from six.moves.urllib.parse import parse_qs, urlencode, urlparse
from sentry.integrations.slack import SlackIntegrationProvider, SlackIntegration
from sentry.models import (
AuditLogEntry,
AuditLogEntryEvent,
Identity,
IdentityProvide... |
try:
from functools import wraps
except ImportError:
def curry(_curried_func, *args, **kwargs):
def _curried(*moreargs, **morekwargs):
return _curried_func(*(args+moreargs), **dict(kwargs, **morekwargs))
return _curried
### Begin from Python 2.5 functools.py ###########... |
'''
Created on 4 sept. 2017
@author: worm
'''
from django.views.generic.list import ListView
from snapshotServer.models import TestCaseInSession, StepResult, Snapshot
import json
from snapshotServer.views.LoginRequiredMixinConditional import LoginRequiredMixinConditional
class TestResultView(LoginRequiredMixinConditi... |
import commonware.log
import simplejson
from django.shortcuts import get_object_or_404 # render_to_response,
from django.http import HttpResponse, HttpResponseBadRequest
from amo import tasks
from amo.constants import STATUS_UPLOAD_FAILED, STATUS_UPLOAD_SCHEDULED
from amo.helpers import get_addon_details as _get_add... |
from Worker import Worker
import gevent, time, logging, random
MAX_WORKERS = 10
# Worker manager for site
class WorkerManager:
def __init__(self, site):
self.site = site
self.workers = {} # Key: ip:port, Value: Worker.Worker
self.tasks = [] # {"evt": evt, "workers_num": 0, "site": self.site, "inner_path": inne... |
"""
Parameters for DREIDING force field.
"""
DREIDING_DATA = {
# Atom, R1, theta, R0, D0, phi, S
"H_": (0.33, 180.0, 3.195, 0.0152, 0.0, 12.382),
"H__HB": (0.33, 180.0, 3.195, 0.0001, 0.0, 12.0),
"H__b": (0.510, 90.0, 3.195, 0.0152, 0.0, 12.382),
"B_3": (0.880, 109.471, 4.02, 0.095, 0.0, 14.23),
... |
import dbus
def search():
bus = dbus.SystemBus()
udisks = dbus.Interface(
bus.get_object('org.freedesktop.UDisks2',
'/org/freedesktop/UDisks2'),
'org.freedesktop.DBus.ObjectManager')
listDevices = udisks.get_dbus_method('GetManagedObjects')
result = []
for key, value in listDevices... |
# -*- coding: utf-8 -*-
"""
sphinx.theming
~~~~~~~~~~~~~~
Theming support for HTML builders.
:copyright: Copyright 2007-2016 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import os
import shutil
import zipfile
import tempfile
from os import path
from six import str... |
# FMSPy - Copyright (c) 2009 Andrey Smirnov.
#
# See COPYRIGHT for details.
"""
Application rooms.
"""
class Room(object):
"""
Room (scope, context) is location inside application where clients meet.
Room holds server objects: streams, shared objects, etc. It can be
used to iterate over clients in ro... |
# Copyright (c) 2014 Greg James, Visual6502.org
#
# 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 without limitation the rights
# to use, copy, modify, merge, p... |
try:
from setuptools import setup, find_packages
except ImportError:
from ez_setup import use_setuptools
use_setuptools()
from setuptools import setup, find_packages
Name='quantum-common'
ProjecUrl=""
Version='0.1'
License='Apache License 2.0'
Author='Tyler Smith'
AuthorEmail='tylesmit@cisco.com'
Maint... |
#!/usr/bin/env python
# encoding: utf-8
import pytest
import datetime
from itertools import zip_longest
from tbone.data.fields import *
from tbone.data.models import *
from tbone.testing.fixtures import event_loop
def test_model_repr():
''' Test Model repr function '''
class M(Model):
pass
m = M(... |
'''
Copyright 2013 Cosnita Radu Viorel
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 without limitation
the rights to use, copy, modify, merge, publish, distribute... |
# copyright (c) David Wilson 2015
# This file is part of Icarus.
# Icarus 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.
# Icarus is... |
#!/usr/bin/env python
# Filename: base.py
#=====================================================================#
# Copyright (c) 2015 Bradley Hilton <bradleyhilton@bradleyhilton.com> #
# Distributed under the terms of the GNU GENERAL PUBLIC LICENSE V3. #
#===========================================================... |
#!/usr/bin/env python
import datetime
import logging
import os
import sys
from mpi4py import MPI
from optparse import OptionParser
from iointegrity.iotools import create_random_file, FileMD5
from iointegrity.dbtools import IOIntegrityDB
def main(options, args):
comm = MPI.COMM_WORLD
rank = comm.Get_rank()
... |
# coding: utf-8
import nose, os, tempfile
import anki
from anki import DeckStorage
from anki.exporting import *
from anki.stdmodels import *
deck = None
ds = None
testDir = os.path.dirname(__file__)
def setup1():
global deck
deck = DeckStorage.Deck()
deck.addModel(BasicModel())
deck.currentModel.card... |
import sys
import os
from tests import ErtTest
try:
from synthesizer import OilSimulator
except ImportError as e:
share_lib_path = os.path.join(ErtTest.createSharePath("lib"))
sys.path.insert(0, share_lib_path)
synthesizer_module = __import__("synthesizer")
OilSimulator = synthesizer_module.OilSi... |
#!/usr/bin/env python2
##
# PyChat
# https://github.com/leosartaj/PyChat.git
#
# Copyright (c) 2014 Sartaj Singh
# Licensed under the MIT license.
##
"""
Helper functions for starting a server
"""
# Twisted Imports
from twisted.internet import reactor
from twisted.internet.error import CannotListenError
# factory/p... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('blog', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='blog',
name='file',
... |
"""
shapefile.py
Provides read and write support for ESRI Shapefiles.
author: jlawhead<at>geospatialpython.com
date: 20140507
version: 1.2.1
Compatible with Python versions 2.4-3.x
version changelog: Fixed u() to just return the byte sequence on exception
"""
__version__ = "1.2.1"
from struct import pack, unpack, ca... |
from asyncio import iscoroutinefunction, coroutine
from contextlib import contextmanager
from functools import partial
import re
from .exceptions import MultipleExceptions
class Undefined:
pass
def make_if_none(obj, default):
if obj is not None:
return obj
return default
def dict_partial_copy... |
# Copyright 2021 The Kubeflow Authors.
#
# 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 to in ... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.conf import settings
from django.conf.urls import include, url
from django.conf.urls.static import static
from django.contrib import admin
from django.views.generic import TemplateView
from django.views import defaults as default_views
urlpat... |
from rest_framework import serializers
from rest_framework.reverse import reverse
from .models import Experiment, Result
class ResultSerializer(serializers.ModelSerializer):
class Meta:
model = Result
exclude = ('experiment',)
# class ExperimentSerializer(serializers.HyperlinkedModelSerializer):
# results = ser... |
from helper import CompatTestCase
from validator.compat import TB7_DEFINITION
class TestTB7Compat(CompatTestCase):
"""Test that compatibility tests for Thunderbird 7 are properly executed."""
VERSION = TB7_DEFINITION
def test_nsIMsgThread(self):
for method in self.run_xpcom_for_compat(
... |
import puppeteer as p
import logging
try:
import standard_logging # pylint: disable=W0611
except ImportError:
pass
#logging.getLogger("puppeteer.connection").setLevel(logging.DEBUG)
#logging.getLogger("puppeteer.manipulator").setLevel(logging.DEBUG)
#logging.getLogger("puppeteer.vuln_decorators").setLevel(logg... |
import os.path
import random
import inspect
import importlib
import string
PACKAGE_ROOT = os.path.abspath(
os.path.dirname(
os.path.dirname(__file__)
)
)
PACKAGE_NAME = os.path.basename(PACKAGE_ROOT)
def random_string(count, charset=string.lowercase + string.digits):
return ''.join(random.sample... |
#
# ent.py module tests
#
# Copyright (c) 2015 Red Hat, Inc.
# Author: Nikolai Kondrashov <Nikolai.Kondrashov@redhat.com>
#
# This 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; version 2 only
#
# This progra... |
# 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 to in writing, software
# distributed under t... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# AppDynamicsREST documentation build configuration file, created by
# sphinx-quickstart on Tue Jul 9 22:26:36 2013.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in th... |
#!/usr/bin/env python
import sys
import os
import shutil
import re
import json
import time
import rpm
import subprocess
import stat
import tarfile
import time
import hashlib
import anchore.anchore_utils
analyzer_name = "file_checksums"
try:
config = anchore.anchore_utils.init_analyzer_cmdline(sys.argv, analyzer... |
# -*- coding: utf-8 -*-
import unittest
import pathlib2 as pathlib
from refmanage import BibFile
from refmanage.ref_exceptions import UnparseableBibtexError
from pybtex.database import BibliographyData
# Base classes
# ============
class Base(unittest.TestCase):
"""
Base class for tests
This class is int... |
# -*- coding: utf-8 -*-
"""Test the CrawlPage object."""
import pytest
from parker import parser, crawlpage, parsedpage
from test_client import client_fixture_crawl, client_fixture
from test_page import page_fixture_crawl, page_fixture
import utils
TEST_URI = "http://www.staples.co.uk/"
TEST_CONSUME_SELECTOR = "#Page... |
#!/usr/bin/python
from lxml import etree
import gzip, re, copy, tempfile, subprocess, os
SVG_NAMESPACE="http://www.w3.org/2000/svg"
INKSCAPE_NAMESPACE="http://www.inkscape.org/namespaces/inkscape"
_safe = re.compile("^[A-Za-z]+$")
sizes=[64,32,16,8,4]
tree = etree.parse(gzip.open("Markers.svgz"))
labels = etree.ETX... |
from django.db import models
from django import forms
from django.forms import ModelForm
# Create your models here.
class Settings(models.Model):
# General gallery informations
general_title = models.CharField(max_length=255)
intro = models.TextField(blank=True)
url = models.CharField(max_length=255)... |
import pytest
from borgmatic.config import override as module
@pytest.mark.parametrize(
'value,expected_result',
(
('thing', 'thing'),
('33', 33),
('33b', '33b'),
('true', True),
('false', False),
('[foo]', ['foo']),
('[foo, bar]', ['foo', 'bar']),
... |
from functools import reduce
import operator
from django.contrib.auth.models import Group, Permission
from django.db.models import Q
from django.test import TestCase, override_settings
from django.urls import reverse
from django.utils.crypto import get_random_string
from accounts.models import User
from zentral.contrib... |
#!/usr/bin/python
import urllib, inflect, string, json, sys, Algorithmia
# tests
# python n7.py '{"h2t":"http://slashdot.org", "auth":"API_KEY"}'
# python n7.py '{"url":"http://derstandard.at"}'
# python n7.py '{"text":"life is a miracle"}'
# initialize
p = inflect.engine()
text = ""
offset = 7
start_line = -1
... |
"""
RenderPipeline
Copyright (c) 2014-2016 tobspr <tobias.springer1@gmail.com>
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 without limitation the rights
to use... |
# coding: utf-8
from __future__ import unicode_literals
import re
from .adobepass import AdobePassIE
from ..utils import (
int_or_none,
determine_ext,
parse_age_limit,
urlencode_postdata,
ExtractorError,
)
class GoIE(AdobePassIE):
_SITE_INFO = {
'abc': {
'brand': '001',
... |
###################
### DESCRIPTION ###
###################
"""
Tic-tac-toe (or Noughts and crosses, Xs and Os) is a game for two players, X and O, who take
turns marking the spaces in a 3×3 grid. The player who succeeds in placing three respective marks
in a horizontal, vertical, or diagonal row wins the game.
... |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
'''-------------------------------------------------------------------------
Copyright IBM Corp. 2015, 2015 All Rights Reserved
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 c... |
# canaryd
# File: canaryd/__main__.py
# Desc: entry point for canaryd
import logging
import signal
from time import time
from canaryd_packages import click
from canaryd.daemon import run_daemon
from canaryd.log import logger, setup_logging, setup_logging_from_settings
from canaryd.plugin import (
get_and_prepar... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.