content
stringlengths
4
20k
import time import datetime import pytz from unittest import TestCase from nose.tools import eq_, assert_raises from mock import patch from airmozilla.base import utils class Response(object): def __init__(self, content=None, status_code=200): self.content = content self.status_code = status_cod...
from pprint import PrettyPrinter from .platform import IRONPYTHON, JYTHON from .robottypes import is_bytes, is_unicode def unic(item, *args): # Based on a recipe from http://code.activestate.com/recipes/466341 try: return unicode(item, *args) except UnicodeError: try: return u...
# -*- coding: utf-8 -*- from openerp import http from openerp.http import request from openerp import SUPERUSER_ID from openerp.addons.survey.controllers.main import WebsiteSurvey import json import logging _logger = logging.getLogger(__name__) class MyLearning(http.Controller): @http.route('/mylearn...
#!/usr/bin/env python import sys import gfxprim.core as core import gfxprim.gfx as gfx import gfxprim.backends as backends import gfxprim.input as input def fill(bk): color = bk.pixmap.rgb_to_pixel(0xee, 0xee, 0xee) bk.pixmap.gfx.fill(color) bk.flip() def hline(bk): fg = bk.pixmap.rgb_to_pixel(0xee,...
""" Scenario: upgrade Generic scenario that tries many tests on a platform with or without a relay. This is the base scenario that should be run to test a release. """ from scenario.lib import * import os # test begins, register start time start(__doc__) class Scenario(): def __init__(self, data): self.data = ...
#!/usr/bin/env python # Example to illustrate stranding options using an artificial # east-west oscillating current field # Knut-Frode Dagestad, Feb 2017 from opendrift.readers import reader_ROMS_native from opendrift.readers import reader_oscillating from opendrift.models.oceandrift import OceanDrift o = OceanDrif...
import multiprocessing import requests import time import logging import simplejson as json logger = logging.getLogger(__name__) class Stream(object): '''Allows you to connect to the Nimvelo (Sipcentric) streaming API and register callbacks to your own functions. ''' def __init__(self, parent): sel...
''' Determine number of H-semi-primes between 1 and the input number Status: Accepted ''' ############################################################################### def main(): """Read input and print output count of H-semi-primes""" limit = 1000002 limit_root = 1002 is_prime = [(i % 4 == 1) fo...
import time, sys, os, shutil, subprocess, distutils.dir_util sys.path.append("../../configuration") if os.path.isfile("log.log"): os.remove("log.log") log = open("log.log", "w") from scripts import * from buildsite import * from process import * from tools import * from directories import * printLog(log, "") printLo...
# -*- coding:utf-8 -*- """ 统一config调配 """ __author__ = 'zcj' import www.config_default class Dict(dict): ''' Simple dict but support access as x.y style. ''' def __init__(self, names=(), values=(), **kw): super(Dict, self).__init__(**kw) for k, v in zip(names, values): ...
import os from django import template from django.template.defaultfilters import filesizeformat from bs4 import BeautifulSoup from core import models register = template.Library() @register.simple_tag() def file_size(file, article): try: return filesizeformat(file.get_file_size(article)) except Ba...
"""Test the abandontransaction RPC. The abandontransaction RPC marks a transaction and all its in-wallet descendants as abandoned which allows their inputs to be respent. It can be used to replace "stuck" or evicted transactions. It only works on transactions which are not included in a block and are not currently...
""" Classes and functions to handle storage devices. This exports: - two functions for get image/blkdebug filename - class for image operates and basic parameters """ import logging import os import shutil import re from autotest.client import utils try: from virttest import iscsi except ImportError: from ...
#!/usr/bin/env python import os from pathlib import Path from typing import Dict, List import fire import torch from transformers import AutoModelForSeq2SeqLM, AutoTokenizer from transformers.utils.logging import get_logger logger = get_logger(__name__) def remove_prefix(text: str, prefix: str): if text.star...
from django.db import models from django.contrib.auth.models import User class MasterAttribute(models.Model): """Cotton, Linen""" TYPE_CHOICES = ((1, 'Material'),) label = models.TextField() attribute_type = models.IntegerField(choices=TYPE_CHOICES) class Meta: unique_together = (("labe...
from __future__ import print_function, unicode_literals, absolute_import import os import sys __all__ = ['vera_path', 'bitmap_to_ascii'] def vera_path(): """ The path to the copy of Bitstream Vera Sans that ships with freetypy for testing purposes. """ return os.path.join(os.path.dirname(__fil...
import logging import os from certmaster.config import read_config from func.commonconfig import FuncdConfig # from the comments in http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/66531 class Singleton(object): def __new__(type, *args, **kwargs): if not '_the_instance' in type.__dict__: ...
"""Unit tests for the ``activation_keys`` paths. :Requirement: Activationkey :CaseAutomation: Automated :CaseLevel: Acceptance :CaseComponent: API :TestType: Functional :CaseImportance: High :Upstream: No """ from fauxfactory import gen_integer, gen_string from nailgun import client, entities from requests.excep...
from django.test import TestCase from wagtail.core.models import Collection class TestCollectionTreeOperations(TestCase): def setUp(self): self.root_collection = Collection.get_first_root_node() self.holiday_photos_collection = self.root_collection.add_child( name="Holiday photos" ...
#!/usr/bin/env python # # Allows user to label the face on each image. # Creates mask of face pixels to be used as ground truth. # import rospy import os import sys import rosbag from sensor_msgs.msg import Image import numpy import cv2 from cv_bridge import CvBridge class ImageHandler(): """ Holds Image info;...
{% include 'misc/header.py' %} """Sphinx configuration.""" from __future__ import print_function import os import sphinx.environment # -- General configuration ------------------------------------------------ # If your documentation needs a minimal Sphinx version, state it here. #needs_sphinx = '1.0' # Do not war...
""".. module:: Test_Mail Test cases for DIRAC.Core.Utilities.DAG module. """ #pylint: disable=protected-access,invalid-name,missing-docstring import unittest # sut from DIRAC.Core.Utilities.Mail import Mail __RCSID__ = "$Id $" ######################################################################## class MailTe...
#!/usr/bin/env python2.6 ''' 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 the Apache License, Version 2.0 (the "Licens...
import os import fnmatch import sys import getopt import re import math import shutil def find_file(path, pattern): fio_data_file=[] # For all the local files for file in os.listdir(path): # If the file math the regexp if fnmatch.fnmatch(file, pattern): # Let's consider this file fio_data_file.append(...
import StringIO import base64 import errno import hashlib import json import os import re import socket from httplib import HTTPException from google.oauth2 import service_account import google.cloud.storage from chirribackup.Logger import logger from chirribackup.StringFormat import format_num_bytes, dump from chirr...
from datetime import datetime, timedelta import numpy as np import numexpr as ne from netCDF4 import Dataset from scipy.interpolate import CubicSpline from typhon.utils import Timer import xarray as xr from .common import NetCDF4, expects_file_info from .testers import check_lat_lon __all__ = [ 'AVHRR_GAC_HDF', ...
verhoeff_table_d = ( (0,1,2,3,4,5,6,7,8,9), (1,2,3,4,0,6,7,8,9,5), (2,3,4,0,1,7,8,9,5,6), (3,4,0,1,2,8,9,5,6,7), (4,0,1,2,3,9,5,6,7,8), (5,9,8,7,6,0,4,3,2,1), (6,5,9,8,7,1,0,4,3,2), (7,6,5,9,8,2,1,0,4,3), (8,7,6,5,9,3,2,1,0,4), (9,8,7,6,5,4,3,2,1,0)) verhoeff_table_p = ( (0,1...
#!/usr/bin/env python # encoding: utf-8 # Christoph Koke, 2013 """ Writes the c and cpp compile commands into build/compile_commands.json see http://clang.llvm.org/docs/JSONCompilationDatabase.html Usage: def configure(conf): conf.load('compiler_cxx') ... conf.load('clang_compilation_data...
import numpy as np import matplotlib.pyplot as plt from numpy import exp,cos,sin,pi,sqrt import traces.transformations as tran import traces.sources as sources import traces.lenses as lenses import traces.analyses as anal import traces.surfaces as surf import pdb import copy import utilities.imaging.fitting as fit from...
#!/usr/bin/python # coding: utf-8 class Person(object): role = 'person' def __init__(self, name, aggressivity, life_value, money): self.name = name self.aggressivity = aggressivity self.life_value = life_value self.money = money def attack(self, dog): dog.life_val...
#!/usr/bin/env python import time import sys import psycopg2 from argparse import ArgumentParser # django needs to be loaded import django django.setup() from django.core.management import call_command from core.models import ChrisInstance parser = ArgumentParser(description="Check database service connection") p...
"""TopologyView app unit tests.""" # Copyright 2016 Solinea, 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 app...
from fxpt.qt.pyside import QtWidgets, isPySide2 from fxpt.fx_prefsaver import prefsaver, serializers if isPySide2(): from fxpt.fx_refsystem.replace_with_ref_dialog_ui2 import Ui_Dialog else: from fxpt.fx_refsystem.replace_with_ref_dialog_ui import Ui_Dialog OPT_VAR_NAME = 'fx_refsystem_replaceDlg_prefs' cl...
import maptools import chartools import os CURSOR = ">>> " START_X = 1 START_Y = 1 START_Z = 0 def create_map(): worldMap = maptools.coordSystem("World Map", 3,3,1) worldMap.getLocation(0,0,0).name = "SWVille" worldMap.getLocation(1,0,0).name = "SVille" worldMap.getLocation(2,0,0).name = "SEVille" worldMap.getLo...
#!/usr/bin/env python # -*- coding: utf8 -*- import os, sys, io, csv, argparse from bs4 import BeautifulSoup # Paramètres parser = argparse.ArgumentParser() parser.add_argument('-f', '--file', required=True, type=str, default=False, dest...
from .base import AuthenticationBase class RevokeToken(AuthenticationBase): """Revoke Refresh Token endpoint Args: domain (str): Your auth0 domain (e.g: username.auth0.com) """ def revoke_refresh_token(self, client_id, token, client_secret=None): """Revokes a Refresh Token if it has ...
# -*- coding: utf-8 -*- from django.test import TestCase from django.db import IntegrityError from django.contrib.auth.models import User from friends.models import FriendLink from friends.utils import get_following_set, get_follower_set, get_mutual_set class FriendLinkTestCase(TestCase): def setUp(self): ...
import sys # check python version if sys.version_info < (3, 4, 0): print("CloudBot requires Python 3.4 or newer.") sys.exit(1) import json import logging.config import logging import os __version__ = "1.0.8" __all__ = ["util", "bot", "connection", "config", "permissions", "plugin", "event", "hook", "log_dir...
"""Miscellaneous classes/functions/etc.""" import ctypes from itertools import cycle import os import struct import time if os.name != 'nt': import fcntl import termios else: import ctypes.wintypes DEFAULT_TERMINAL_WIDTH = None NOW = time.time SPINNER = cycle(('/', '-', '\\', '|')) class _WindowsCSBI(ob...
from setuptools import setup, find_packages with open('README.rst') as fp: long_description = fp.read() setup( name='rovicli', version='0.1.0', description='Command line access to the Rovi API', long_description=long_description, author='Devin Sevilla', author_email='<EMAIL>', url...
'Generate datasets' # Authors: Afshine Amidi <<EMAIL>> # Shervine Amidi <<EMAIL>> # MIT License import numpy as np import pandas as pa import os from tqdm import tqdm from enzynet.PDB import PDB_backbone from enzynet.tools import read_dict, dict_to_csv # Date of retrieval of raw datasets from rcsb.org: ...
"""Tests for kws_streaming.layers.depthwise_conv1d.""" from absl import logging import numpy as np from kws_streaming.layers import depthwise_conv1d from kws_streaming.layers import modes from kws_streaming.layers.compat import tf from kws_streaming.layers.compat import tf1 import kws_streaming.layers.test_utils as tu...
import sys sys.path.insert(1,"../../../") import h2o from tests import pyunit_utils import itertools from h2o.grid.grid_search import H2OGridSearch from h2o.estimators.deeplearning import H2ODeepLearningEstimator def iris_dl_grid(): train = h2o.import_file(path=pyunit_utils.locate("smalldata/iris/iris_wheader.csv"))...
#!/usr/bin/env python ''' Faraday Penetration Test IDE - Community Version Copyright (C) 2013 Infobyte LLC (http://www.infobytesec.com/) See the file 'doc/LICENSE' for the license information ''' import threading import logging import logging.handlers from gui.customevents import (LogCustomEvent, ...
from __future__ import absolute_import, division, print_function, unicode_literals import os from builtins import str from pex.fetcher import Fetcher from pex.resolver import resolve from twitter.common.collections import OrderedSet from pants.backend.python.pex_util import expand_and_maybe_adjust_platform from pant...
from flask import * from mim.models import * from mim.ext import * from flask.ext.restful import Resource class CommentListAPI(Resource): ''' Get all comments from a specific widget ''' def get(self, widget_id): # May I replace by Widget.object.only("comments") widget = Widget.objects.get(id=widget_id) return...
{ 'name': 'Installation Request Report using Webkit Library', 'version': '1.1.0', 'category': 'Reports/Webkit', 'description': """ New webkit report. """, 'author': 'Camptocamp', 'website': 'http://www.camptocamp.com', 'depends': ['base', 'report_webkit', 'base_headers_webkit', 'cr...
import pygame # By Willi Kappler <<EMAIL>> # Licensed under GPL class Options: "This class loads, saves and manages all the options" def __init__(self): self.left = pygame.K_LEFT self.right = pygame.K_RIGHT self.jump = pygame.K_UP self.duck = pygame.K_DOWN self.action =...
""" Rest API for Home Assistant. For more details about the RESTful API, please refer to the documentation at https://home-assistant.io/developers/api/ """ import json import logging from time import time import blumate.core as ha import blumate.remote as rem from blumate.bootstrap import ERROR_LOG_FILENAME from blum...
from calvin.actor.actor import Actor, ActionResult, manage, condition, guard class MediaPlayer(Actor): """ Play media file <mediafile>. Inputs: play: Play <mediafile> when True """ @manage(['media_file']) def init(self, media_file): self.media_file = media_file self.s...
#!/bin/python import time import sys import random class Node : def __init__( self, data ) : self.data = data self.next = None self.prev = None class LinkedList(object) : def __init__( self ) : self.head = None def add( self, data ) : node = Node( data ) if self.head == None :...
import argparse import os import subprocess import sys ANDROID_LOG_CLASS = 'android.util.Log' FLUTTER_LOG_CLASS = 'io.flutter.Log' def main(): parser = argparse.ArgumentParser(description='Checks Flutter Android library for forbidden imports') parser.add_argument('--stamp', type=str, required=True) parser.add_a...
import pathlib import supriya manifest_path = ( pathlib.Path(supriya.__path__[0]) / "assets" / "applications" / "Test.yml" ) def test_01(server): application = supriya.live.Application(manifest_path) # Buffers assert len(application.buffers) == 1 assert "birds" in application.buffers assert ...
""" FCKeditor - The text editor for Internet - http://www.fckeditor.net Copyright (C) 2003-2007 Frederico Caldeira Knabben == BEGIN LICENSE == Licensed under the terms of any of the following licenses at your choice: - GNU General Public License Version 2 or later (the "GPL") http://www.gnu.org/license...
import pytest from plenum.test.helper import sdk_send_random_requests from stp_core.loop.eventually import eventually from plenum.common.messages.node_messages import Commit from plenum.test.delayers import delay from plenum.test.propagate.helper import recvdRequest, recvdPropagate, \ sentPropagate, recvdPrepareFo...
import unittest import arnold import IECore import IECoreArnold class ParameterAlgoTest( unittest.TestCase ) : def testTypeErrors( self ) : self.assertRaisesRegexp( TypeError, "Expected an AtNode", IECoreArnold.ParameterAlgo.setParameter, None, "test", IECore.IntData( 10 ) ) def testSetParameter( s...
import sys import collections from assertpy import assert_that,fail def test_ignore_key(): assert_that({'a':1}).is_equal_to({}, ignore='a') assert_that({'a':1,'b':2}).is_equal_to({'a':1}, ignore='b') assert_that({'a':1,'b':2}).is_equal_to({'a':1,'b':2}, ignore='c') assert_that({'a':1,'b':{'x':2,'y':3}...
import numpy as np import pytest from pandas import Series, timedelta_range import pandas._testing as tm class TestSlicing: def test_partial_slice(self): rng = timedelta_range("1 day 10:11:12", freq="h", periods=500) s = Series(np.arange(len(rng)), index=rng) result = s["5 day":"6 day"] ...
import imp import os import sys # Some common lists we'll need to know about. PLUGINS = [ 'actions', 'callbacks', 'filters', 'lookups', ] ANSIBLE_DIRS = ['playbooks', 'inventory', 'library', 'plugins'] # A list that holds the paths that have been activated for our importer. _VALID_PATHS = [] class ...
""" An app script for running calibration of a camera from the command line. Copyright (C) Microsoft Corporation. All rights reserved. """ # Standard Libraries. import argparse # Calibration tools. from camera_tools import calibrate_camera # --------------------------------------------------------------------------...
""" A Lake Winnipeg Basin Information Network (BIN) harvester for the SHARE project Example API request: http://130.179.67.140/api/3/action/package_search?q= (problematic) http://130.179.67.140/api/3/action/current_package_list_with_resources (currently using) It oddly returns 5 more datasets than all searchable ones ...
from optparse import OptionParser import os import sys from naive_bayes_nearest_neighbor import caltech_util from sift import sift_descriptors_pb2 from sift import sift_util def main(): parser = OptionParser() # This option points to the root directory of the image # dataset. Under the root directory shou...
from django.contrib import admin from django.utils.translation import ugettext as _ from salud.models import ( Alergenos, Alergicos, ObraSocial, PlanMedico, Clinica, MedicoCabecera, CoberturaMedica) @admin.register(Alergenos) class AlergenosAdmin(admin.ModelAdmin): actions_on_bottom = ...
""" tknorris shared module Copyright (C) 2016 tknorris 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. ...
#!/usr/bin/env python # coding=utf-8 ################################################################################ import os import sys import optparse import configobj import traceback import tempfile sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), 'src'))) def getIncludePaths(path): ...
from myhdl import * from ssd1306_8x64bit_driver import * ''' This python script simulates the design and generates a trace-file which can be opened with gtkwave. As a side-note: This is NOT sufficient to verify the design. I'm new to myHDL and digital hardware design/verification in general and don't know any better, ...
#!/usr/bin/python import argparse import os import sys import subprocess import shlex import time OMNIPLAY = "/home/mcchow/omniplay" pthread_lib = "/home/mcchow/omniplay/eglibc-2.15/prefix/lib" PIN = "/home/mcchow/pin-2.13" def main(args): rec_dir = args.replay_directory num_runs = 1 if args.runs: ...
"""Provides data from video object segmentation datasets. This file provides both images and annotations (instance segmentations) for TensorFlow. Currently, we support the following datasets: 1. DAVIS 2017 (https://davischallenge.org/davis2017/code.html). 2. DAVIS 2016 (https://davischallenge.org/davis2016/code.html...
# despite what the book says it's actually bad practice to use either: #from tkinter import * #from tkinter import Tk import tkinter HEIGHT = 500 WIDTH = 800 window = tkinter.Tk() window.title('Bubble Blaster') c = tkinter.Canvas(window, width=WIDTH, height=HEIGHT, bg='darkblue') c.pack() ship_id = c.create_polygon...
# Remove Duplicates from Sorted List II # # Given a sorted linked list, delete all nodes that have duplicate numbers, leaving only distinct numbers from the original list. # # For example, # Given 1->2->3->3->4->4->5, return 1->2->5. # Given 1->1->1->2->3, return 2->3. # from CommonClasses import * # hxl: ...
#!/usr/bin/env python3 """ Use a new key to reorder label numbers in label volumes. Usage ---- remap_labels.py -ok <Old Key> -nk <New Key> <Label Volumes> ... remap_labels.py -h Example ---- >>> remap_labels.py -ok old.txt -nk new.txt labels1.nii.gz labels2.nii.gz Authors ---- Mike Tyszka, Caltech, Division of Human...
"""Interactive shell""" import sys import code import random import pylibmc tips = [ "Want to use 127.0.0.1? Just hit Enter immediately.", "This was supposed to be a list of tips but I...", "I don't really know what to write here.", "Really, hit Enter immediately and you'll connect to 127.0.0.1.", ...
import pytest import numpy as np import itertools from pyquil.wavefunction import ( get_bitstring_from_index, Wavefunction, _octet_bits, ) @pytest.fixture() def wvf(): amps = np.array([1.0, 1.0j, 0.000005, 0.02]) amps /= np.sqrt(np.sum(np.abs(amps) ** 2)) return Wavefunction(amps) def test_...
# -*- coding: utf-8 -*- """ ____ ____ ____ ___ ____ _____ | \ / || \ | \ / |/ ___/ | o ) o || _ || \ | o ( \_ | _/| || | || D || |\__ | | | | _ || | || || _ |/ \ | | | | | || | || || | |\ | |__| |__|__||__|__||_____||__|__| \___| sour...
import contextlib import errno import os import tempfile from oslo.utils import excutils from sahara.openstack.common import log as logging LOG = logging.getLogger(__name__) _FILE_CACHE = {} def ensure_tree(path): """Create a directory (and any ancestor directories required) :param path: Directory to cre...
import boto3 class GlacierCtx(object): """Context manager for glacier, sets defaults""" def __init__(self, ctx, region=None): self.region = region or ctx.config['glacier']['region'] self.glacier = boto3.resource('glacier', region_name=self.region) def __enter__(self): return self...
import os import re import sys from lettuce import core from lettuce import strings from lettuce import terminal from lettuce.terrain import after from lettuce.terrain import before def wrt(what): if isinstance(what, unicode): what = what.encode('utf-8') sys.stdout.write(what) def wrap_file_and_li...
#!/usr/bin/env python from .unit import unit, dimensionless # # The basic SI units # meter = unit(1.0, (1, 0, 0, 0, 0, 0, 0)) kilogram = unit(1.0, (0, 1, 0, 0, 0, 0, 0)) second = unit(1.0, (0, 0, 1, 0, 0, 0, 0)) ampere = unit(1.0, (0, 0, 0, 1, 0, 0, 0)) kelvin = unit(1.0, (0, 0, 0, 0, 1, 0, 0)) mole = unit(1.0, (0, 0,...
from django.shortcuts import render # Create your views here. from api.libs.base import CoreView from cmdb.models import Asset, BusinessUnit, Cabinet, Tags, EventLog from django.db.models import Q from api.libs.cmdb_agent import CmdbCollector from api.libs.asset_handler import AssetHandler from guardian.shortcuts impo...
# Test osqp python module import osqp from osqp._osqp import constant # import osqppurepy as osqp from scipy import sparse import scipy as sp import numpy as np # Unit Test import unittest class primal_infeasibility_tests(unittest.TestCase): def setUp(self): sp.random.seed(6) """ Setup p...
"""Tests for struct2tensor.reroot.""" from absl.testing import absltest from struct2tensor import calculate from struct2tensor import create_expression from struct2tensor import path from struct2tensor.expression_impl import proto_test_util from struct2tensor.expression_impl import reroot from struct2tensor.test impor...
#!/usr/bin/env python """Master program for the Organ Donor "Organelle" This program is mainly responsible for monitoring the physical rotary switch that allows users to select a major mode of operation for the Organelle. When it detects that the switch has been moved, it asks the current program to clean up and exit ...
import flask import json import hashlib import os import urllib.parse import http.client from oauth2client import client from oauth2client import crypt app = flask.Flask(__name__) app.secret_key = '3512a68c-3b77-474f-b807-0a24d73ac98b' app.debug = True SCOPE = ['https://www.googleapis.com/auth/calendar.readonly', ...
import os.path import wx from timelinelib.config.paths import ICONS_DIR from timelinelib.wxgui.dialogs.eventlist.view import EventListDialog class GuiCreator(object): def _create_gui(self): self.icon_size = (16, 16) self._create_close_button() self._create_search_box() self._cre...
#! /usr/bin/env python import os import ssl import sys import bs4 import time import json import socket import urllib2 import requests import threading import subprocess from rottentomatoes import RT # Setup the IRC connection irc = socket.socket() irc = ssl.wrap_socket(irc) # List of currently active threads threa...
# -*- coding: utf-8 -*- ''' :codauthor: :email:`Mike Place <<EMAIL>>` ''' import os.path DEBUG = {{ pillar["debug"] }} TEMPLATE_DEBUG = DEBUG ADMINS = ( # ('Your Name', '<EMAIL>'), ) MANAGERS = ADMINS DATABASES = { 'default': { 'ENGINE': '{{ pillar["dbengine"] }}', 'NAME': '{{ pillar["db...
from manila.api import common from manila.openstack.common import log as logging class ViewBuilder(common.ViewBuilder): """Model a server API response as a python dictionary.""" _collection_name = 'snapshots' def summary_list(self, request, snapshots): """Show a list of share snapshots without m...
#!/usr/bin/python # -*- coding: utf-8 -*- import os from PyQt5.QtCore import (QObject, pyqtSignal, pyqtSlot, pyqtProperty, QVariant) from PyQt5.QtQml import QJSValue, qmlRegisterType from .qmodel import ModelMetaclass # class ListModel(QAbstractListModel): # def __init__(self, fields, paren...
import re import os import sys import errno import shutil import filecmp import argparse import subprocess parser = argparse.ArgumentParser(description ='run scheduler test'); parser.add_argument('program', help='.c, .cpp, or .ll program to run test on') parser.add_...
# -*- coding: utf-8 -*- """ Tests for training models and serializers (common to student and AI training). """ import copy import mock from django.db import IntegrityError from openassessment.test_utils import CacheResetTest from openassessment.assessment.models import TrainingExample from openassessment.assessment.ser...
__author__ = "James Diprose" import bpy import mathutils from mathutils import Matrix, Vector from math import acos, degrees from xml.dom.minidom import parseString from xml.etree.ElementTree import Element, SubElement, Comment, tostring class LinkRef(object): def __init__(self, name, link_type): self.na...
from typing import List, Optional from rx.core import Observable from rx.core.typing import Scheduler, RelativeTime from rx.scheduler import NewThreadScheduler new_thread_scheduler = NewThreadScheduler() def _to_marbles(scheduler: Optional[Scheduler] = None, timespan: RelativeTime = 0.1): def to_marbles(source...
from Crypto.Cipher import AES from hashlib import sha256 # http://thecodelesscode.com/case/195 # A fitting quote for a RE challenge, I think. flag = 'CTF{ThLssOfInncncIsThPrcOfAppls}' seed = [211, 52, 228, 33, 61, 253, 49, 167, 48, 53, 117, 165, 170, 56, 212, 158, 21, 110, 4, 22, 86, 26, 36, 90, 155, 52, 212, 16, 19...
# Задача 4. Вариант 20. #Напишите программу, которая выводит имя, под которым скрывается Мари Фрасуа Аруэ. Дополнительно необходимо вывести область интересов указанной личности, место рождения, годы рождения и смерти (если человек умер), вычислить возраст на данный момент (или момент смерти). Для хранения всех необходи...
# -*- coding: utf-8 -*- from __future__ import absolute_import, unicode_literals from wechatpy.client.api.base import BaseWeChatAPI class WeChatUser(BaseWeChatAPI): def get(self, user_id, lang='zh_CN'): """ 获取用户基本信息 详情请参考 http://mp.weixin.qq.com/wiki/14/bb5031008f1494a59c6f71fa0f...
from __future__ import (absolute_import, division, generators, nested_scopes, print_function, unicode_literals, with_statement) import logging import os from pants.backend.jvm.targets.java_library import JavaLibrary from pants.backend.jvm.tasks.nailgun_task import NailgunTask from pants.base.e...
""" WSGI config for partner project. This module contains the WSGI application used by Django's development server and any production WSGI deployments. It should expose a module-level variable named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover this application via the ``WSGI_APPLICATION`` ...
import os import unittest import subprocess import IECore import Gaffer import GafferTest import GafferScene import GafferArnold import GafferArnoldTest class ArnoldRenderTest( GafferTest.TestCase ) : __scriptFileName = "/tmp/test.gfr" def testExecute( self ) : s = Gaffer.ScriptNode() s["plane"] = GafferSc...
""" Test of client upload/download functionality """ import pytest import test.integration.library as lib from omero.util.temp_files import create_path def tmpfile(): file = create_path() file.write_lines(["abc", "def", "123"]) return file class TestFiles(lib.ITest): def testUploadDownload(se...
"Módulo para manejo de archivos CSV (planillas de cálculo)" __author__ = "Mariano Reingart (<EMAIL>)" __copyright__ = "Copyright (C) 2010 Mariano Reingart" __license__ = "GPL 3.0" import csv from decimal import Decimal import os def leer(fn="entrada.csv", delimiter=";"): "Analiza un archivo CSV y devuelve un di...