src stringlengths 721 1.04M |
|---|
##############################################################################
# For copyright and license notices, see __manifest__.py file in module root
# directory
##############################################################################
from odoo import models, fields
import logging
_logger = logging.getLogge... |
# coding: utf-8
#2019.11.24 refixed in ubuntu19.10
#使用前需安装yamdi
#sudo apt install yamdi
#ubuntu 16.04LTS
#与win机器mount命令示例:
#sudo mount -t cifs -o username="用户名",password="密码",uid=1000 //192.168.2.90/raid5_5-9/直播录像 /mnt2
#若目录不存在,terminal中
#sudo mkdir mnt2
#sudo chown -R linux用户名:linux用户名 mnt2
#使用方法 :
#1.修改脚本预计遍历flv的目... |
import argparse
import os
class Rapid:
def __init__(self):
self.boiler_plate_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', 'boilerplate'))
self.supports = list(os.listdir(self.boiler_plate_dir))
def boilerplate(self, language):
if language in self.supports:
... |
from collections import OrderedDict
from datetime import datetime
from decimal import Decimal
from urllib.request import urlopen
from urllib.error import HTTPError
from xml.sax import handler, make_parser
import xml.etree.ElementTree
import json
import re
import time
from typing import Any, Callable, ClassVar, Dict, Li... |
# -*- coding: utf-8 -*-
import os.path
import sys
import vim
class Citation(object):
@staticmethod
def connect():
"""
Returns source from builder,
printing any errors from python to the vim console.
wrapping everything in "try: except:" is bad practise generally,
bu... |
# Copyright 2015 Cisco Systems, Inc.
#
# 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 writ... |
# -*- coding: utf-8 -*-
import weakref
from instlatte.logger import logger
logger = logger(__name__)
class Subsystem(object):
manager = None
package_dir = None
module_name = None
name = None
config = dict()
plugins = list()
def __init__(self, manager=None, package_dir=None, modul... |
'''
Created on Mar 5, 2016
A module for preprocessing raw data files from the KDD Cup 2009 dataset.
@author: Nicolas Metts
'''
import csv
import numpy as np
import argparse
import os
import pandas as pd
from sklearn.preprocessing import LabelEncoder
from sklearn.preprocessing import OneHotEncoder
from sklearn.preproc... |
import tensorflow as tf
import numpy as np
import time
class DetectorAPI:
def __init__(self, path_to_ckpt):
self.path_to_ckpt = path_to_ckpt
self.detection_graph = tf.Graph()
with self.detection_graph.as_default():
od_graph_def = tf.compat.v1.GraphDef()
with tf.io.g... |
#!/usr/bin/env python3
"""
Test development server.
"""
import socket
import ssl
import testlib
import traceback
import sys
bindsocket = socket.socket()
bindsocket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
bindsocket.bind(("", 8675))
bindsocket.listen(5)
while True:
print("Waiting for a client...")
... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
###############################################################################
# Copyright (c) 2015, Julius Sky
#
# 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... |
from work_queue import *
import sys
def compose_task(i,j):
id = (i-1)*20+j
d_rate = i*0.05
r_blok = j
outfile = "results%d.csv" % id
command = "./script.sh results%d.csv %f %d" % (id,d_rate,r_blok)
t = Task(command)
t.specify_file("env.tar.gz", "env.tar.gz", WORK_QUEUE_INPUT, cache=True)
t.specify_file("dat... |
# Copyright 2016 ACSONE SA/NV (<http://acsone.eu>)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
import json
import logging
import urlparse
import werkzeug
from odoo import _, http
from odoo.http import request
from odoo.exceptions import AccessError
from odoo.addons.web.controllers import main
... |
import redis
import redlock
import time
import datetime
import json
import time
class JobLockHasExpiredException(Exception):
"""This Exception is raised when access or modify is attempted on a job that had its lock expire"""
pass
class JobNotValidException(Exception):
"""This Exception is raised when access or mod... |
""" CSHelpers
Module containing functions interacting with the CS and useful for the RSS
modules.
"""
import errno
from DIRAC import gConfig, gLogger, S_OK, S_ERROR
from DIRAC.Core.Utilities.SitesDIRACGOCDBmapping import getGOCSiteName
from DIRAC.ResourceStatusSystem.Utilities import Utils
from DIRAC.Resources.S... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import numpy as np
from ROOT import TH1, Double, ROOT, TF1
def prob_dist_1comp(x, par):
dt = x[0]
amp = par[0]
pL = par[1]
tauL = par[2]
tauTh = par[3]
T = np.exp(-dt / tauTh)
L = np.exp(-dt / tauL)
pTot = 0
pTot += T * (1. - pL) / tauTh... |
# --------------------------------------------------------
# (c) Copyright 2014 by Jason DeLaat.
# Licensed under BSD 3-clause licence.
# --------------------------------------------------------
from pymonad.Monad import *
class Either(Monad):
"""
Represents a calculation that may either fail or succeed.
An altern... |
#
# Copyright © 2012 - 2021 Michal Čihař <michal@cihar.com>
#
# This file is part of Weblate <https://weblate.org/>
#
# 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 Lice... |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
import sys
from pdfminer.pdfdocument import PDFDocument
from pdfminer.pdfparser import PDFParser
from pdfminer.pdfinterp import PDFResourceManager, PDFPageInterpreter
from pdfminer.pdfpage import PDFPage
from pdfminer.layout import LAParams
from pdfminer.converter import P... |
from test_plus.test import TestCase
from django.test import Client
# from unittest import skip
class Testnew_chart(TestCase):
def setUp(self):
self.client = Client()
# self.client.login(username='fred', password='secret')
def test_charts_renders_new_charts(self):
response = self.clie... |
# -*- coding: utf-8 -*-
#---------------------------------------------------------------------
'''
Created on 07 Nov. 2015
@author: Seko
@summary: Advanced Downloader
'''
#---------------------------------------------------------------------
# ____________________ I M P O R T ____________________
impor... |
#Copyright (C) 2011 Gabriel Gregori Manzano
#
#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 version.
#
#This program is distribute... |
import json
import random
import math
import unittest
import os
import unicodecsv as csv
from enum import Enum
from data.fixtures.test_data import ComparisonTestData
from compair.models import Answer, Comparison, \
WinningAnswer, AnswerScore, AnswerCriterionScore, \
PairingAlgorithm, ScoringAlgorithm
from comp... |
class PolymorphicNoun(object):
# TODO: Doc
def __init__(self, singular, plural):
self.singular = singular
self.plural = plural
def decline(self, quantity=1):
# TODO: Doc
if quantity == 1:
return self.singular
elif (quantity > 1) or (quantity == 0):
... |
"""
Helper functions for working with tor's configuration file.
"""
import os
import time
import socket
import threading
import stem.version
from util import sysTools, torTools, uiTools
from stem.util import conf, enum, log, str_tools, system
def conf_handler(key, value):
if key == "config.important":
# stor... |
#!/usr/bin/env python
import email
import threading
import urllib.parse
import urllib.request
import http.server
import unittest
import hashlib
from test import support
# Loopback http server infrastructure
class LoopbackHttpServer(http.server.HTTPServer):
"""HTTP server w/ a few modifications that make it usefu... |
class InvalidIndexNameError(ValueError):
pass
class MockValidationException(ValueError):
def __init__(self, message):
self.exception_msg = message
class InvalidUpdateExpressionInvalidDocumentPath(MockValidationException):
invalid_update_expression_msg = (
"The document path provided in t... |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'ankipubsub_settings.ui'
#
# Created by: PyQt4 UI code generator 4.11.4
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
def _fr... |
from gpumeanshift import filter
import unittest
import numpy as np
import cv2
from cv2.cv import PyrMeanShiftFiltering
class TestGPUMeanShiftFilter(unittest.TestCase):
def test_emptyNDArray(self):
empty_array = np.array([], dtype = np.uint8)
self.assertRaises(TypeError, filter, *[empty_array, 12, 12])
def test... |
import math
import requests
from requests.exceptions import *
import json
import astral
import datetime
import hashlib
from enum import Enum, unique
from kivy.clock import Clock
from kivy.logger import Logger
# Using I2C on RasPi for reading a light sensor
import platform
if 'arm' in platform.uname().machine:
im... |
import re
from math import cos, sqrt, tan, sin, atan, trunc, radians, degrees
def getFloat(value):
try:
return float(value)
except ValueError:
value = str(value).replace('B', '8').replace('O', '0').replace(',', '.')
_errcount = 0
for i in value:
if not re.match(r'[0... |
#!/usr/bin/env python
# -*- coding: utf8 -*-
import sys
import argparse
import couchdb
import ssl
import s3stash.s3tools
from deepharvest.deepharvest_nuxeo import DeepHarvestNuxeo
def main(argv=None):
parser = argparse.ArgumentParser(
description='print differences between Nuxeo and CouchDB for a '
... |
# cerbero - a multi-platform build system for Open Source software
# Copyright (C) 2012 Andoni Morales Alastruey <ylatuya@gmail.com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
# License as published by the Free Software Foundation; eit... |
from operator import ne
from py_search.utils import compare_searches
from py_search.uninformed import depth_first_search
from py_search.uninformed import breadth_first_search
from py_search.uninformed import iterative_deepening_search
from py_plan.total_order import StateSpacePlanningProblem
from py_plan.base import ... |
from .math_helpers import kl_divergence_dict
from .graph import Graph
from .edges import edges_to_edge_dict
from nose.tools import assert_almost_equal
def check_detailed_balance(edges, s, places=7):
"""
Check if the detailed balance condition is satisfied.
Parameters
----------
edges: list of tu... |
# Copyright (c) 2012 Tim Neumann
# Copyright (c) 2012, 2014 Tycho Andersen
# Copyright (c) 2013 Tao Sauvage
# Copyright (c) 2014 Sean Vig
#
# 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 wit... |
"""
Django settings for mmsn project.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.6/ref/settings/
"""
import socket
import dj_database_url
from django.utils.crypto import get_rando... |
#!/usr/bin/env python
# vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import sys
import os
from test import prompty
from test import UnitTestWrapper
class My... |
# -*- coding: utf-8 -*-
"""
This file contains the Qudi sequence generator logic for general sequence structure.
Qudi 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 ... |
import json
from wtforms import ValidationError
from userver.object.application import Application
from . import api, root
from flask import request, Response
from userver.object.group import Group
from binascii import hexlify
from utils.errors import KeyDuplicateError, PatchError
from .decorators import group_filter_... |
"""
import glob
import os
import time
picPathes = (path for path in glob.glob(r"F:/美图录/*/*.jpg"))
for pic in picPathes:
os.popen(pic)
time.sleep(3)
#体验不好的第一点是背景音乐太正了,应该去找AV里面的背景音乐;第二点是看到不想看的人可以跳过,这样就很好。这样怎么做呢?
"""
import time
import glob
import random
import os
from selenium import webdriver
chromedriver... |
# 477. Total Hamming Distance
# The Hamming distance between two integers is the number of positions at which the corresponding bits are different.
# Now your job is to find the total Hamming distance between all pairs of the given numbers.
# Example:
# Input: 4, 14, 2
# Output: 6
# Explanation: In binary represe... |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
# ----------------------------------------------------------------
# tests/test_parser.py
#
# Test input arguments parser
# ----------------------------------------------------------------
# copyright (c) 2015 - Domen Ipavec
# Distributed under The MIT License, see LICENS... |
from datetime import datetime, timedelta
import curator
from . import CuratorTestCase
class TestTimeBasedDeletion(CuratorTestCase):
def test_curator_will_properly_delete_indices(self):
self.create_indices(10)
self.run_curator(delete_older=3)
mtd = self.client.cluster.state(index=self.args... |
## Copyright 2003-2006 Luc Saffre
## This file is part of the Lino project.
## Lino 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 version... |
#!/usr/bin/python
"""
(C) Copyright 2018-2021 Intel Corporation.
SPDX-License-Identifier: BSD-2-Clause-Patent
"""
# pylint: disable=too-few-public-methods
# pylint: disable=pylint-missing-docstring
import ctypes
# DAOS api C structures
class RankList(ctypes.Structure):
""" For those DAOS calls that take a ra... |
#!/usr/bin/env python3
# -*- coding: utf8 -*-
# Gaik Tamazian, 2019
# mail (at) gtamazian (dot) com
"""Routines for reading, writing and processing eggNOG output files."""
import sys
from . import gff3
from . import snpeff
from . import vcf
assert sys.version_info >= (3, 5), "Python 3.5 or higher required"
def lo... |
#!/usr/bin/env python
from atexit import register
from random import randrange
from threading import Thread, Lock, currentThread
from time import sleep, ctime
class CleanOutputSet(set):
def __str__(self):
return ', '.join(x for x in self)
lock = Lock()
loops = (randrange(2, 5) for x in xrange... |
#!/usr/bin/env python
#-*- coding: utf-8 -*-
"""
Hacker bot
Designed as a way to interact with the host machine
Also comes with a Lis.py interpreter (thanks Peter Norvig)
Requires: cowsay, screenfetch, cowfortune
"""
from botinfo import *
from bs4 import BeautifulSoup as BS
from requests import get as re_get
from ra... |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2010 Openstack, LLC.
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# ... |
#!/usr/bin/env python
# encoding: utf-8
# The MIT License (MIT)
# Copyright (c) 2014 CNRS (Hervé BREDIN - http://herve.niderb.fr)
# 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 re... |
__author__ = "Christian Kongsgaard"
__license__ = 'MIT'
# -------------------------------------------------------------------------------------------------------------------- #
# IMPORTS
# Modules
import pytest
import numpy as np
# RiBuild Modules
from delphin_6_automation.delphin_setup import weather_modeling
from ... |
##############################################################################
# Copyright (c) 2013-2018, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... |
"""
This page is in the table of contents.
Skeiniso is an analyze viewer to display a gcode file in an isometric view.
The skeiniso manual page is at:
http://fabmetheus.crsndoo.com/wiki/index.php/Skeinforge_Skeiniso
==Operation==
The default 'Activate Skeiniso' checkbox is off. When it is on, the functions described... |
import libadjoint
import backend
import ufl
import ufl.algorithms
import adjglobals
import adjlinalg
import utils
def find_previous_variable(var):
''' Returns the previous instance of the given variable. '''
for timestep in range(var.timestep, -1, -1):
prev_var = libadjoint.Variable(var.name, timestep... |
import tensorflow as tf
import numpy as np
from PIL import Image
from caffe_to_tf import load_caffemodel
from data import transform_from_train
def pool(x, ksize, stride, padding="SAME"):
return tf.nn.max_pool(x, ksize=[1, ksize, ksize, 1],
strides=[1, stride, stride, 1],
... |
#!/Library/Frameworks/Python.framework/Versions/3.1/bin/python3
# -*- coding: utf-8 -*-
# wiki: ΞBGF
import os
import sys
sys.path.append(os.getcwd().split('slps')[0]+'slps/shared/python')
import slpsns
import BGF3
import xml.etree.ElementTree as ET
class Sequence:
def __init__(self):
self.steps = []
def parse(sel... |
import json
import tornado.web
import apymongo
from apymongo import json_util
import base
class InsertHandler(tornado.web.RequestHandler):
"""
Inserts a test record, and shows a record count.
"""
@tornado.web.asynchronous
def get(self):
self.connection = apymongo.Conn... |
import numpy as np
import theano
import theano.tensor as T
import matplotlib
matplotlib.use('Agg')
from matplotlib import pyplot as plt
from scipy.misc import imsave
def initialize_weight(n_vis, n_hid, W_name, numpy_rng, rng_dist):
if 'uniform' in rng_dist:
W = numpy_rng.uniform(low=-np.sqrt(6. / (n_vis ... |
#!/usr/bin/env python
"""Method of exact solution driver"""
from bout_runners.bout_runners import basic_runner
import numpy as np
import sys, os
# If we add to sys.path, then it must be an absolute path
common_dir = os.path.abspath('./../../../common')
# Sys path is a list of system paths
sys.path.append(common_dir)
... |
#!/usr/bin/python
# coding: utf-8
# Copyright (C) 2010 Lucas Alvares Gomes <lucasagomes@gmail.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 2 of the License, or
# (at you... |
from django.conf.urls import include, url, patterns
from django.contrib import admin
from HealthApp import views
"""
The urlpatterns is how we map the site urls to specific views in the views.py. The first part is
a regular expression to describe the url pattern, followed by the view that should be called.
Lastly, a n... |
# -*- coding: utf-8 -*-
"""Functions that operate on lists and dicts.
.. versionadded:: 1.0.0
"""
from __future__ import absolute_import
from functools import partial
import random
import pydash as pyd
from .helpers import itercallback, iterator, callit, getargcount, NoValue
from ._compat import cmp_to_key, _cmp
... |
import numpy as np
import pandas as pd
import geopandas as gpd
from geopandas import tools
census_old = '/home/kircheis/data/shp/census/census_tracts_all/census_tracts_1990.shp'
census_new = '/home/kircheis/data/shp/census/census_tracts_all/census_tracts_2014.shp'
df_90 = gpd.read_file(census_old)
df_14 = gpd.read_fi... |
# -*- coding: utf-8 -*-
"""
Defines the unit tests for the
:mod:`colour.models.rgb.transfer_functions.st_2084` module.
"""
import numpy as np
import unittest
from colour.models.rgb.transfer_functions import (eotf_inverse_ST2084,
eotf_ST2084)
from colour.utilities impo... |
from sklearn.metrics import confusion_matrix
from sklearn.model_selection import train_test_split
from sklearn.neighbors import KNeighborsClassifier
from sklearn.ensemble import VotingClassifier
from sklearn.tree import DecisionTreeClassifier
from sklearn.neighbors import KNeighborsClassifier
from sklearn.ensemble impo... |
try:
import unittest2 as unittest
except ImportError:
import unittest
from mongokit import Document, Connection
class DescriptorsTestCase(unittest.TestCase):
def setUp(self):
self.connection = Connection()
self.col = self.connection['test']['mongokit']
def tearDown(self):
... |
#!/usr/bin/python
##
# Copyright 2012-2016 Ghent University
#
# This file is part of EasyBuild,
# originally created by the HPC team of Ghent University (http://ugent.be/hpc/en),
# with support of Ghent University (http://ugent.be/hpc),
# the Flemish Supercomputer Centre (VSC) (https://vscentrum.be/nl/en),
# Flemish Re... |
# -*- coding: utf-8 -*-
import os
import urllib2
import urllib
from mechanize import Browser
from bs4 import BeautifulSoup
import re
from PIL import Image
import pyimgur
favi = "/home/ozgur/mount/media/Series/Conan/ConanTheBarbarian/Conan.the.Barbarian.1982.iNTERNAL.DVDRiP.XViD.CD1-HLS.avi"
fmkv = "/home/ozgur/mount/... |
numbers = [37107287533902102798797998220837590246510135740250,
46376937677490009712648124896970078050417018260538,
74324986199524741059474233309513058123726617309629,
91942213363574161572522430563301811072406154908250,
23067588207539346171171980310421047513778063246676,
... |
# -*- coding: utf-8 -*-
# Code for Life
#
# Copyright (C) 2016, Ocado Innovation Limited
#
# 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 Foundation, either version 3 of the
# License, or (at your o... |
#
# Copyright 2019 The FATE Authors. 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 required by appli... |
import numpy as np
from sklearn.utils import check_random_state
from nn.model.recurrent import RecurrentNetwork
random_state = check_random_state(None)
def nback(n, k, length):
"""Random n-back targets given n, number of digits k and sequence length"""
Xi = random_state.randint(k, size=length)
yi = np.ze... |
# 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
# d... |
# -*- coding: utf-8 -*-
__license__ = 'GPL 3'
__copyright__ = '2008, Kovid Goyal <kovid at kovidgoyal.net>, ' \
'2009, John Schember <john@nachtimwald.com>'
__docformat__ = 'restructuredtext en'
import errno, os, sys, subprocess, shutil, re
from functools import partial
from calibre.ebooks import Con... |
# -*- coding: utf-8 -*-
"""
Mocks for testing a WARPER service type.
"""
from httmock import response, urlmatch
import os
NETLOC = r'(.*\.)?warper\.example\.com$'
HEADERS = {'content-type': 'application/json'}
GET = 'get'
API_PATH = os.path.abspath(os.path.dirname(__file__))
class Resource:
""" A WARPER resou... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('simsoexp', '0003_auto_20150717_1118'),
]
operations = [
migrations.RemoveField(
model_name='testcategory',
... |
import re
import os
from socket import *
from Components.Console import Console
from Components.PluginComponent import plugins
from Plugins.Plugin import PluginDescriptor
from boxbranding import getBoxType
class Network:
def __init__(self):
self.ifaces = {}
self.configuredNetworkAdapters = []
self.NetworkState ... |
# -*- coding: utf-8 -*-
#!/usr/bin/env python
from __future__ import print_function
import os
import re
import sys
import json
import argparse
import fileinput
def translation_qml(file_path):
j = json.load(open(file_path))
layers = j['layers']
qml_out = """import QtQuick 2.0
/*
* Auto-generated by sbi... |
# Copyright 2014-2016 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""Tests for :py:mod:`maasserver.clusterrpc.utils`."""
import random
from unittest.mock import Mock, sentinel
from django.core.exceptions import NON_FIELD_ERRORS, Validatio... |
# -*- coding: utf-8 -*-
# Default theme of Beampy
# Main keys of the dict should be the name of the beampy modules or class
# Each modules default options need to be defined here!
THEME = {}
THEME['document'] = {
'format': 'html5', #could be svg // pdf // html5
'width': 800,
'height': 600,
'optimize'... |
# Copyright 2014 Stefan Winterfeldt <stefan.winterfeldt@bitz.it>
# <stefan.winterfeldt@outlook.de
# BITZ GmbH <info@bitz.it>
#
#This file is part of Buildicator.
#
#Buildicator is free software: you can redistribute it and/or modify
#it under the terms of the GN... |
__author__ = 'kris'
class Queue(object):
def __init__(self, size=16):
self.queue = []
self.size = size
self.front = 0
self.rear = size - 1
def isEmpty(self):
return self.rear == 0
def isFull(self):
if (self.front - self.rear + 1) == self.size:
... |
from django.test import TestCase
from django.core.cache import cache as djcache
from avocado.columns.cache import cache
from avocado.models import Column
__all__ = ('ColumnCacheTestCase',)
class ColumnCacheTestCase(TestCase):
fixtures = ['test_data.yaml']
def setUp(self):
djcache.clear()
def te... |
# -*- coding: utf-8 -*-
##############################################################################
#
# Author: Damien Crier
# Copyright 2015 Camptocamp SA
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# publis... |
# generation of mails
import re
from django.utils.html import strip_tags
from django.utils.text import wrap
from django.conf import settings
from django.core.urlresolvers import reverse as urlreverse
from ietf.utils.mail import send_mail, send_mail_text
from ietf.mailtrigger.utils import gather_address_lists
def ... |
from setuptools import setup
CLASSIFIERS = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"License :: OSI Approved :: BSD License",
"Operating System :: MacOS :: MacOS X",
"Operating System :: Microsoft :: Windows",
"Operating System :: POSIX",
"Programm... |
from ..core import Mul
from ..core.compatibility import default_sort_key
from ..functions import DiracDelta, Heaviside
def change_mul(node, x):
"""change_mul(node, x)
Rearranges the operands of a product, bringing to front any simple
DiracDelta expression.
If no simple DiracDelta expression was foun... |
from django.shortcuts import render, get_object_or_404,redirect
from django.views import View, generic
from django.http import HttpResponse, HttpResponseRedirect
from django.contrib import messages
from django.contrib.auth import authenticate, login
from django.contrib.auth.decorators import login_required
from star_ra... |
#
# Copyright (c) 2013-2019 Contributors to the Eclipse Foundation
#
# See the NOTICE file distributed with this work for additional information regarding copyright
# ownership. All rights reserved. This program and the accompanying materials are made available
# under the terms of the Apache License, Version 2.0 which... |
import unittest
import uuid
from motey.models.image import Image
from motey.models.service import Service
from motey.models.service_state import ServiceState
class TestServiceModel(unittest.TestCase):
@classmethod
def setUp(self):
self.service_id = uuid.uuid4().hex
self.expecting_service = Se... |
r"""wamp is a module that provide classes that extend any
WAMP related class for the purpose of vtkWeb.
"""
import inspect, types, string, random, logging, six, json
from threading import Timer
from twisted.python import log
from twisted.internet import reactor
from twisted.internet import defer... |
# Code for MAEC AV Classification Idiom
from maec.package.package import Package
from maec.package.malware_subject import MalwareSubject
from maec.package.analysis import Analysis
from maec.bundle.bundle import Bundle
from maec.bundle.av_classification import AVClassification
from cybox.core import Object
from cybox.ob... |
"""
Tests for runners and related code
"""
from temci.run.run_driver import is_perf_available
from temci.scripts.cli import ErrorCode
from tests.utils import run_temci, run_temci_proc
def test_parse_output_option():
out = run_temci("short exec 'echo foo: 3' --runner time --parse_output").out
assert "time " ... |
"""Dump Text
Interface designed to dump text files.
"""
import ctypes
from six.moves import cStringIO as StringIO
from excentury.core import XCStruct, XC_TYPES, CTYPES
from excentury.core import Communicator, data, xc_type, c_type
CHAR_MAP = {
'C': '%c',
'I': '%d',
'N': '%d',
'R': '%f'
}
class Tex... |
#!/usr/bin/python
'''
Extract _("...") strings for translation and convert to Qt4 stringdefs so that
they can be picked up by Qt linguist.
'''
from subprocess import Popen, PIPE
import glob
import operator
import os
import sys
OUT_CPP="qt/lakestrings.cpp"
EMPTY=['""']
def parse_po(text):
"""
Parse 'po' format... |
# stdlib
from nose.plugins.attrib import attr
# 3p
# project
from tests.checks.common import AgentCheckTest
instance = {
'host': '127.0.0.1',
'port': 6222,
}
GLOBAL_STATS = set([
'curr_connections',
'total_connections'
])
POOL_STATS = set([
'client_eof',
'client_err',
'client_connectio... |
# Copyright 2020 The TensorFlow Authors. 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 required by applica... |
# -*- coding: utf-8 -*-
import urllib
from core import httptools
from core import scrapertools
from platformcode import logger
def test_video_exists(page_url):
if 'googleusercontent' in page_url:
return True, "" # desactivada verificación pq se encalla!
response = httptools.downloadpage(page_url, h... |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2007 Christopher Lenz
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution.
import doctest
import os
import unittest
import StringIO
import time
import tempfile
from lifedb import ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.