content
string
"""Helpers for unittests themselves.""" import asyncio import functools import unittest from unittest import mock import gpg def _tear_down_class_wrapper(original, cls): """Ensure that doClassCleanups is called after tearDownClass.""" try: original() finally: cls.doClassCleanups() def ...
# -*- coding: utf-8 -*- from django.views.generic import ListView, DetailView from django.views.generic.edit import CreateView, FormView from django.views.generic.base import View from django.utils.translation import ugettext_lazy as _ from django.core.exceptions import PermissionDenied from django.shortcuts import g...
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models import datetime import music.models class Migration(migrations.Migration): dependencies = [ ] operations = [ migrations.CreateModel( name='Album', fields=[ ...
"""Test for base sequences filters. """ import pytest from exopy_pulses.pulses.api import BaseSequence from exopy_pulses.pulses.sequences.conditional_sequence\ import ConditionalSequence from exopy_pulses.pulses.infos import SequenceInfos from exopy_pulses.pulses.filters import (SequenceFilter, PySequenceFilter, ...
import gzip import json import networkx as nx import pandas as pd from pyprojroot import here from tqdm import tqdm root = here() datasets = root / "data" def load_seventh_grader_network(): # Read the edge list df = pd.read_csv( datasets / "moreno_seventh/out.moreno_seventh_seventh", skiprow...
#!/usr/bin/env python import argparse import sys, os, re import yaml import codecs yamlPattern = re.compile(r'\---[\n\s]*((?:\s|\S)*)[\n\s*]---', flags=re.DOTALL|re.MULTILINE) regionStartPattern = re.compile(r'\s*#\s*region\s+(\S+)\s*{') regionEndPattern = re.compile(r'\s*}') interpolatePattern = re.compile(r'\{\s*(\S...
# -*- coding: utf-8 -*- from DateTime import DateTime from imio import history as imio_history from imio.history.interfaces import IImioHistory from imio.history.testing import IntegrationTestCase from imio.history.utils import add_event_to_history from imio.history.utils import get_all_history_attr from imio.history....
""" .. module: security_monkey.datastore :platform: Unix :synopsis: Contains the SQLAlchemy models and a few helper methods. .. version:: $$VERSION$$ .. moduleauthor:: Patrick Kelley <<EMAIL>> @monkeysecurity """ from security_monkey import db, app from sqlalchemy.dialects.postgresql import JSON from sqlal...
# -*- coding: utf-8 -*- import pytest parametrize = pytest.mark.parametrize from pychess_engine.main import Game, Board from unittest import TestCase class test_Board(TestCase): def setUp(self): self.board = Board() def tearDown(self): pass def test_expand_blanks(self): expand...
from __future__ import print_function # import the main and action components from maincomponent import maincomponent from action1 import action1component from action2 import action2component from action3 import action3component #import manager components from action3components import animationmanager from action3com...
##=============== ##==== libraries ##=============== import numpy as np from numpy.linalg import inv from scipy.stats import wishart from scipy.stats import bernoulli import math from numpy import linalg as LA # import matplotlib.pyplot as plt # import seaborn as sns ##===================== ##==== global variables ##=...
import sys from django.conf import settings from django.contrib import admin from django.contrib.admin.widgets import AdminTextInputWidget from django.core.exceptions import ImproperlyConfigured from django.utils.encoding import force_text from django.utils.html import escape from django.utils.translation import ugette...
from tests.common import RuleTestCase class CommentsIndentationTestCase(RuleTestCase): rule_id = 'comments-indentation' def test_disable(self): conf = 'comments-indentation: disable' self.check('---\n' ' # line 1\n' '# line 2\n' ' # li...
from .ir_map import IRMap def validate_after_resolve_references(ir_map): _validate_literal_constant_type(ir_map) def _all_constants(ir_map): accumulated = [] irs = ir_map.irs_of_kinds(IRMap.IR.Kind.CALLBACK_INTERFACE, IRMap.IR.Kind.INTERFACE, IRMap.IR.Kind.NAMESPACE) fo...
import collections import gevent from oslo.config import cfg import logging import netaddr from ryu import exception as ryu_exc from ryu.app import conf_switch_key as cs_key from ryu.app import rest_nw_id from ryu.base import app_manager from ryu.controller import (conf_switch, handler, ...
from spack import * class Eagle(MakefilePackage): """EAGLE: Explicit Alternative Genome Likelihood Evaluator""" homepage = "https://github.com/tony-kuo/eagle" url = "https://github.com/tony-kuo/eagle/archive/v1.1.2.tar.gz" version('1.1.2', sha256='afe967560d1f8fdbd0caf4b93b5f2a86830e9e4d399fee4...
# based on http://anthony-tresontani.github.io/Django/2012/09/20/multilingual-search/ from django.conf import settings from django.utils import translation from haystack import connections from haystack.backends import BaseEngine, BaseSearchBackend, BaseSearchQuery from haystack.backends.simple_backend import SimpleEng...
from django.conf.urls import patterns, include, url # Uncomment the next two lines to enable the admin: from django.contrib import admin admin.autodiscover() urlpatterns = patterns('', # Examples: # url(r'^$', 'degustare.views.home', name='home'), # url(r'^degustare/', include('degustare.foo.urls')), ...
from six.moves.urllib.parse import urlparse, parse_qs, urlencode from logging.config import dictConfig import logging try: import gevent except: gevent = None def parse_redis_connection(url): split = urlparse(url) protocol = split.scheme netloc = split.netloc path = split.path db = int(pars...
"""Tests for GCPServing Deployer.""" import json import httplib2 from unittest.mock import patch from kubeflow.fairing.deployers.gcp.gcpserving import GCPServingDeployer from googleapiclient.errors import HttpError def create_http_error(error_code, message): error_content = json.dumps({ 'error': { ...
"""boilerplate URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/1.11/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') Clas...
from typing import Any, Dict, Iterable, Sequence, Tuple, Union from kitty.conf.utils import KittensKeyDefinition, key_func, parse_kittens_key func_with_args, args_funcs = key_func() FuncArgsType = Tuple[str, Sequence[Any]] @func_with_args('scroll_by') def parse_scroll_by(func: str, rest: str) -> Tuple[str, int]: ...
import itertools import os import posixpath from devil.android import device_errors from devil.android import device_temp_file from devil.android import ports from pylib import constants from pylib.gtest import gtest_test_instance from pylib.local import local_test_server_spawner from pylib.local.device import local_d...
"""Handles everything related to the actual build process.""" import time from os import chmod, path, unlink from tempfile import NamedTemporaryFile import berth.utils as utils def build(config): """Run the build part of the configuration.""" utils.log('Building project.') script_path = create_build_sc...
import semantic_version from trove.common import cfg from trove.guestagent.datastore.mysql import service from trove.guestagent.datastore.mysql_common import manager CONF = cfg.CONF class Manager(manager.MySqlManager): def __init__(self): status = service.MySqlAppStatus(self.docker_client) app =...
#-*-coding:UTF-8-*- import ast import os import pysvn import re import shutil import urllib from Common import get_log_message from Common import get_login from Common import set_externals from Common import set_log_message from Common import test_url version = '2.0.39' baselib_rev = 0 efmweb_rev = 0 ...
import uuid import logging as log from datetime import datetime from laniakea import LocalConfig, LkModule from laniakea.db import session_scope, config_get_value, Job, JobStatus, JobKind, JobResult, \ SparkWorker, SourcePackage, ArchiveSuite, ImageBuildRecipe from laniakea.msgstream import create_message_tag from ...
from sentence_builder import Test import sentence_builder as sb print "RELOAD" reload(sb) reload(sb.rr.deptree) reload(sb.deptree) reload(sb.deptree.rr) transforms = [("dobj","tens of thousands of people"), ("nsubj","tens of thousands of people")] def TestAll(**kwargs): Test("dog eats",**kwargs) ...
import functools import sys from memoize.core import * from .common import * def py3k_only(func): @functools.wraps(func) def _decorated(*args, **kwargs): if sys.version_info[0] < 3: return return func(*args, **kwargs) return _decorated class TestMain(TestCase): def ...
# -*- coding: utf-8 -*- import datetime import logging import re import time import flask import flask_cors from docker_registry.core import compat from docker_registry.core import exceptions json = compat.json from . import storage from . import toolkit from .app import app from .lib import config from .lib import...
from ctypes import * from ctypes.util import find_library import os import sys dirname = os.path.dirname(os.path.abspath(__file__)) if sys.platform == 'darwin': liblinear = CDLL(os.path.join(dirname, 'liblinear.dylib')) elif os.name == 'posix': liblinear = CDLL(os.path.join(dirname, 'liblinear.so')) else: raise...
from pyramid import testing from raggregate.tests import BaseTest from raggregate.queries import users from raggregate.queries import general from raggregate.models.user import User class TestUsers(BaseTest): def create_user(self, username = None): if not username: username = 'test' us...
from Csmake.CsmakeModule import CsmakeModule import subprocess import os.path import os class SystemBuildDisk(CsmakeModule): """Purpose: Set up a disk for a system build. Library: csmake-system-build Phases: build, system_build - create the file and definition clean, clean_build - dele...
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations from django.conf import settings import django.core.validators class Migration(migrations.Migration): dependencies = [ ('auth', '0006_require_contenttypes_0002'), ] operations = [ mi...
# Movement class. Takes care of validation of all the movements (Beware! No cheating!! :-)) from collections import deque from helpers import * class Movement: def __init__(self, board, piece): self.board = board self.piece = piece def make_non_capture_move(self, move): move_posit...
# -*- coding: utf-8 -*- # * Authors: # * TJEBBES Gaston <<EMAIL>> # * Arezki Feth <<EMAIL>>; # * Miotte Julien <<EMAIL>>; import pytest import datetime @pytest.fixture def income_measure_type_categories(dbsession): from autonomie.models.accounting.income_statement_measures import ( Incom...
from test_framework.test_framework import BitcoinTestFramework from test_framework.util import * from time import * class Wallet2Test (BitcoinTestFramework): def setup_chain(self): print("Initializing test directory "+self.options.tmpdir) initialize_chain_clean(self.options.tmpdir, 4) # Start...
# -*- coding: utf-8 -*- import datetime import github.GithubObject import github.PaginatedList import github.NamedUser import github.Label class Release(github.GithubObject.CompletableGithubObject): @property def created_at(self): """ :type: datetime.datetime """ self._comp...
import json import unittest import datetime import mock import pandas as pd from airflow import DAG from airflow.contrib.hooks.aws_dynamodb_hook import AwsDynamoDBHook import airflow.contrib.operators.hive_to_dynamodb DEFAULT_DATE = datetime.datetime(2015, 1, 1) DEFAULT_DATE_ISO = DEFAULT_DATE.isoformat() DEFAULT_D...
"""@package blocks This file contains blocks specific to LEDA-OVRO. """ # Python2 compatibility from __future__ import print_function import sys if sys.version_info < (3,): range = xrange import os import bandfiles import bifrost import json import numpy as np from bifrost import block # Read a collection o...
#!/usr/bin/env python from __future__ import print_function import sys import argparse import json import os from cnsparser import CNSParser parser = argparse.ArgumentParser( description='Save filled in model data back to a run.cns file', ) parser.add_argument( '-V', '--version', action = 'version', ...
import suds.client import suds.store import logging import sys def client_from_wsdl(wsdl_content, *args, **kwargs): """ Constructs a non-caching suds Client based on the given WSDL content. The wsdl_content is expected to be a raw byte string and not a unicode string. This simple structure suits u...
from pymeeus.base import TOL from pymeeus.Mars import Mars from pymeeus.Epoch import Epoch # Mars class def test_mars_geometric_heliocentric_position(): """Tests the geometric_heliocentric_position() method of Mars class""" epoch = Epoch(2018, 10, 27.0) lon, lat, r = Mars.geometric_heliocentric_position...
#!/usr/bin/python # -*- coding: utf-8; tab-width: 4; indent-tabs-mode: t; python-indent: 4 -*- """ Overview ======== Yapsy's main purpose is to offer a way to easily design a plugin system in Python, and motivated by the fact that many other Python plugin system are either too complicated for a basic use or depend o...
"""Generalized mesosite archive_begin computation For backends that implement alldata(station, valid)""" import sys from pyiem.network import Table as NetworkTable from pyiem.util import get_dbconn, logger LOG = logger() ALLDATA = {"USCRN": "uscrn_alldata"} def main(argv): """Go Main""" (dbname, network) =...
"""Tests for reproject.py.""" import mock import os from django.test import TestCase from lizard_neerslagradar import reproject class TestReprojectedImage(TestCase): @mock.patch('lizard_neerslagradar.reproject.cache_path', return_value="dummy") @mock.patch('os.path.exists', return_value=Tru...
# -*- coding: utf-8 -*- from cms.toolbar.constants import ALIGNMENTS from django.conf import settings from django.core.exceptions import ImproperlyConfigured from django.utils import simplejson from django.utils.encoding import force_unicode from django.utils.functional import Promise class Serializable(object): ...
__author__ = 'JordSti' import object_wrap import surface import color import font #todo decorated button method class style(object_wrap.object_wrap): def __init__(self, ptr=None): object_wrap.object_wrap(self) if ptr is None: self.obj = self.lib.Style_new() else: se...
import numpy as np import paddle import paddle.fluid as fluid import unittest paddle.disable_static() SEED = 2020 np.random.seed(SEED) paddle.seed(SEED) class Generator(fluid.dygraph.Layer): def __init__(self): super(Generator, self).__init__() self.conv1 = paddle.nn.Conv2D(3, 3, 3, padding=1) ...
# 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 model 'FilerImage' db.create_table('cmsplugin_filerimage', ( ('cmsplugin_ptr', self.g...
import threading import wx from styled_text_ctrl import StyledTextCtrl class ThreadOutputCtrl(StyledTextCtrl): def __init__(self, parent, env, auto_scroll=False): StyledTextCtrl.__init__(self, parent, env) self.auto_scroll = auto_scroll self.__lock = threading.Lock() self.__queue ...
""" Results wrapper class. """ from __future__ import absolute_import from __future__ import print_function from __future__ import division import time from rl_benchmark.benchmark.wrapper.environment_wrapper import EnvironmentWrapper class ResultsWrapper(EnvironmentWrapper): def __init__(self, env): su...
# -*- coding: utf8 -*- from django.core.urlresolvers import reverse from django.db import models class Artist(models.Model): name = models.CharField(max_length=255) def __unicode__(self): return self.name class Role(models.Model): label = models.CharField(max_length=255) def __unicode__(se...
# -*- coding: utf-8 -*- import re from bok_choy.page_object import PageObject class GitHubSearchResultsPage(PageObject): """ GitHub's search results page """ # You do not navigate to this page directly url = None def is_browser_on_page(self): # This should be something like: u'Search...
from __future__ import absolute_import, division, print_function, unicode_literals import os import sys import numpy as np import requests import warnings import PIL from astropy import table from astropy.io import ascii from astropy.wcs import WCS from marvin.core.exceptions import MarvinError, MarvinUserWarning fro...
from eos.util.frozendict import frozendict from .cleaner import Cleaner from .converter import Converter from .normalizer import Normalizer from .validator_preclean import ValidatorPreClean from .validator_preconv import ValidatorPreConv class EveObjBuilder: """Builds Eos-specific eve objects from passed data."""...
#!/usr/bin/python # import some libraries import os import time import argparse from datetime import datetime # get params from user # TODO change this to a more automatic form: # rewrite in brainfuck parser = argparse.ArgumentParser(description='Log surrounding temp.') parser.add_argument("-s" "--seconds", type=int,...
from __future__ import print_function import subprocess import os import tempfile import shutil from simlammps import read_data_file def get_particles(y_range): """ get particles for benchmarking Parameters ---------- y_range : float range of particle domain in y Returns ------- ...
# -*- coding: utf-8 -*- """ python-2gis ============ A Python library for accessing the 2gis API """ from setuptools import setup, find_packages setup( name='2gis', version='1.3.1', author='svartalf', author_email='<EMAIL>', url='https://github.com/svartalf/python-2gis', description='2gis l...
""" 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 "License"); you may not use this ...
""" ARCHES - a program developed to inventory and manage immovable cultural heritage. Copyright (C) 2013 J. Paul Getty Trust and World Monuments Fund 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 Founda...
# This file contains server code that responds to user interaction, # communicates with the model, # and updates the view. from flask import Flask, render_template, redirect, request, session, flash from flask import session as flask_session from model import Marker, User from utils import convert_markers_to_geojson...
import gc import pandas as pd from qlknn.dataset.filtering import * def filter_megarun1(): dim = 9 gen = 4 filter_num = 10 root_dir = '.' basename = ''.join(['gen', str(gen), '_', str(dim), 'D_nions0_flat']) store_name = basename + '.h5.1' input, data, const = load_from_store(store_name...
"""Log messages display. """ from gi.repository import Gtk from gettext import gettext as _ from advene.gui.views import AdhocView name="Log messages" def register(controller): controller.register_viewclass(LogMessages) class LogMessages(AdhocView): """Display the content of the log buffer. """ vie...
__author__ = 'Hojjat Salehinejad' import time import sys import numpy as np import random import fgeneric import bbobbenchmarks as bn import os import logging def saver(path_to_savein, data_to_save, name_file): if not os.path.exists(path_to_savein): os.makedirs(path_to_savein) path_to_save = path_to_sa...
from flask import Flask, url_for, redirect, render_template, request from flask.ext.sqlalchemy import SQLAlchemy from wtforms import form, fields, validators from flask.ext import admin, login from flask.ext.admin.contrib import sqla from flask.ext.admin import helpers # Create Flask application app = Flask(__name__...
#! /usr/bin/env python # encoding: utf-8 ''' When using this tool, the wscript will look like: def options(opt): opt.load('compiler_cxx cryptopp') def configure(conf): conf.load('compiler_cxx cryptopp') conf.check_cryptopp() def build(bld): bld(source='main.cpp', target=...
""" vg adjust command Adjust image cubes (calibrate, rotate 180, dereseau, ...) """ import csv import os import os.path import config import lib import libimg import libisis import vgImport def vgAdjust(filterVolume='', filterImageId='', optionOverwrite=False, directCall=True): "Adjust image cubes for given ...
import datetime from alert.lib.string_utils import trunc from alert.search.models import Document from django.contrib.syndication.views import Feed from django.shortcuts import get_object_or_404 from django.utils.feedgenerator import Atom1Feed class CitedByFeed(Feed): """Creates a feed of cases that cite a case, ...
""" vidlockers urlresolver plugin Copyright (C) 2015 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. This program is ...
"""Copyright 2012-2013 Eindhoven University of Technology Bogdan Vasilescu This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later...
# -*- coding: UTF-8 -* ''' Created on 2015年7月2日 @author: RobinTang https://github.com/sintrb/Bmob-Py ''' import json import copy import functools import requests from urllib import parse def _urljoin(func): @functools.wraps(func) def _wrapper(self, resource_path, *args, **kwargs): url = self.apiurl ...
''' @author Luke Campbell <<EMAIL>> @file ion/services/dm/utility/resource_tree.py @description Builds a D3 JSON Hierarchy Tree based on a resource ''' from pyon.container.cc import Container from ion.service.utility.jsonify import JSONtree as jt tree_depth_max = 5 def build(resource_id, depth=0): ''' Constructs ...
import datetime import logging import multiprocessing from sqlalchemy import create_engine, Column, Integer, String, DateTime from sqlalchemy.exc import SQLAlchemyError from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import sessionmaker from setproctitle import setproctitle import time impor...
""" Support for Linky. For more details about this component, please refer to the documentation at https://home-assistant.io/components/sensor.linky/ """ import logging import json from datetime import timedelta import voluptuous as vol from homeassistant.const import CONF_USERNAME, CONF_PASSWORD, CONF_TIMEOUT from ...
from django.core.exceptions import ValidationError from simple_accounting.models import Transaction, CashFlow, Split, LedgerEntry from simple_accounting.models import AccountType from simple_accounting.exceptions import MalformedTransaction def transaction_details(transaction): """ Take a ``Transaction`` mod...
#!/usr/bin/env python """Application controller for FastTree designed for FastTree v1.1.0 . Also functions with v2.0.1, v2.1.0, and v2.1.3 though only with basic functionality""" from cogent.app.parameters import ValuedParameter, FlagParameter, \ MixedParameter from cogent.app.util import CommandLineApplicati...
from __future__ import print_function, division import matplotlib matplotlib.use('Agg') # Must be before importing matplotlib.pyplot or pylab! from neuralnilm import Net, RealApplianceSource, BLSTMLayer, DimshuffleLayer from lasagne.nonlinearities import sigmoid, rectify from lasagne.objectives import crossentropy, mse...
''' Constants for geoio ''' import numpy as np ##### DigitalGlobe File Suffixes and Search Strings ########################### # DG meta file endings # If XML exists, it should contains same info as the rest of the files. DG_META = ['.XML','.IMD','.RPB','.RAD'] # Various strings that describe the same DigitalGlobe b...
import logging from csv import DictWriter from io import StringIO import pdfkit from celery import shared_task from django.conf import settings from django.db.models import Q from django.template.loader import render_to_string from django.utils import timezone from waldur_core.core import utils as core_utils from wal...
import requests import memdam.blobstore.api class Blobstore(memdam.blobstore.api.Blobstore): """ Save and load files from a remote server via our HTTPS REST API. :attr _client: the method for actually making calls to the remote server :type _client: memdam.common.client.MemdamClient """ def ...
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin class Corosync(Plugin): """ corosync information """ plugin_name = "corosync" packages = ('corosync',) def setup(self): self.add_copy_specs([ "/etc/corosync", "/var/lib/corosync/fdata", ...
import os.path from flask import abort from flask.config import Config from flask_assets import Environment from flask_debugtoolbar import DebugToolbarExtension from flask_sqlalchemy import BaseQuery, Pagination, SQLAlchemy assets = Environment() db = SQLAlchemy() toolbar = DebugToolbarExtension() def fix_paginate(...
import os import unittest from badgebot import TPPBotFacade, BadgeBot POKEDEX = os.environ.get('POKEDEX', 'veekun_pokedex.sqlite') class MockTPPBotFacade(TPPBotFacade): def __init__(self): self.commands = [] self.prev_command = None def _send_tpp_bot_whisper(self, command): print("w...
# encoding=utf8 import datetime from distutils.version import StrictVersion import hashlib import os.path import random from seesaw.config import realize, NumberConfigValue from seesaw.item import ItemInterpolation, ItemValue from seesaw.task import SimpleTask, LimitConcurrent from seesaw.tracker import GetItemFromTrac...
import argparse import asyncio import math import sys from .config import ScrapaConfig from .utils import json_dumps, json_loads class CommandLineMixin(): def run_from_cli(self): args = self.get_command_line_args() getattr(self, args['command_name'])(**args) def get_command_line_args(self): ...
# encoding=utf-8 from __future__ import print_function from test_tools import * import ez_crypto as ec import ez_message as em import ez_database as ed import ez_user as eu text01 = """ If your public attribute name collides with a reserved keyword, append a single trailing underscore to your attribute name. This is ...
import os from lizard_ui.settingshelper import setup_logging from lizard_ui.settingshelper import STATICFILES_FINDERS DEBUG = True TEMPLATE_DEBUG = True # SETTINGS_DIR allows media paths and so to be relative to this settings file # instead of hardcoded to c:\only\on\my\computer. SETTINGS_DIR = os.path.dirname(os.pa...
import sys, os, platform from gi.repository import Gtk from gi.repository import Vte from gi.repository import GLib from sugar3.activity import activity from sugar3.graphics.toolbarbox import ToolbarBox from sugar3.activity.widgets import ActivityButton from sugar3.activity.widgets import TitleEntry from sugar3.activ...
#!/usr/bin/env python # coding: utf-8 from __future__ import unicode_literals import json from django.test import Client, TestCase from django.core.urlresolvers import reverse from table import Table from table.columns import Column from table.models import Person class TestTable(Table): id = Column('id', heade...
from compat import guichan, in_fife import widgets from fife.extensions import fife_timer as timer import fonts from exceptions import * from traceback import print_exc def get_manager(): """ Get the manager from inside pychan. To avoid cyclic imports write:: from internal import get_manager """ ...
''' Checkout gitwash repo into directory and do search replace on name ''' from __future__ import (absolute_import, division, print_function) import os from os.path import join as pjoin import shutil import sys import re import glob import fnmatch import tempfile from subprocess import call from optparse import Optio...
""" Various add-ons to the SciPy morphology package """ import numpy as np from scipy.ndimage import morphology, measurements, filters def label(image: np.array, **kw) -> np.array: """ Redefine the scipy.ndimage.measurements.label function to work with a wider range of data types. The default function is...
import struct from app.services.dataset import MSSQL class Manager: def __init__(self, name, fullname): self.name = name self.fullname = fullname def find(self): return None def FindUser(user, pwd): sql_str = "SELECT PassWord FROM userPass Where userName='%s'" % user ms = M...
# coding: utf-8 """ informer tests for views """ import mock import json import pytest from django.test import TestCase, Client from informer.models import Raw from informer.factories import RawFactory pytestmark = pytest.mark.django_db class DefaultViewTest(TestCase): """ Tests to Default View """ ...
#!/usr/bin/env python """ See https://edx-wiki.atlassian.net/wiki/display/ENG/PO+File+workflow This task merges and compiles the human-readable .po files on the local filesystem into machine-readable .mo files. This is typically necessary as part of the build process since these .mo files are needed by Django when se...
# coding=utf-8 import os import unittest import mock import pytest from parameterized import parameterized from conans.client.cmd.export import _capture_scm_auto_fields from conans.client.tools.scm import Git from conans.model.ref import ConanFileReference from conans.test.utils.mocks import TestBufferConanOutput fr...
""" Django settings for mysite project. For more information on this file, see https://docs.djangoproject.com/en/1.7/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.7/ref/settings/ """ # Build paths inside the project like this: os.path.join(BASE_DIR, ...) imp...
#!/usr/bin/env python # -*- coding: utf-8 -*- import json import re import time from bs4 import BeautifulSoup # https://github.com/openlabs/Microsoft-Translator-Python-API # Also, yes, my API key is public from microsofttranslator import Translator def translate(text, language): global translator for i in range(...
import numpy as np import pytest from pandas import ( DataFrame, DatetimeIndex, PeriodIndex, Series, date_range, period_range, ) import pandas._testing as tm class TestToPeriod: def test_to_period(self, frame_or_series): K = 5 dr = date_range("1/1/2000", "1/1/2001", freq=...