code
stringlengths
1
199k
from openerp import models, api, fields class mrp_bom(models.Model): _inherit = 'mrp.bom' def _bom_explode(self, cr, uid, bom, product, factor, properties=None, level=0, routing_id=False, previous_products=None, master_bom=None, context=None): res = super(mrp_bo...
import lxml ''' A set of functions related to Data Manager and the <data_manager> node in Opus Project Configuration files. ''' def get_tool_nodes(project): ''' Retrieve a list of all nodes that represent tools in the given project @param project (OpusProject) project to fetch nodes from @return a list ...
""" End-to-end tests for Student's Profile Page. """ from contextlib import contextmanager from datetime import datetime from bok_choy.web_app_test import WebAppTest from nose.plugins.attrib import attr from ...pages.common.logout import LogoutPage from ...pages.lms.account_settings import AccountSettingsPage from ...p...
from datetime import datetime from pymongo import DESCENDING from libs.lib import tee_db from libs.statisticator import Job class SuicidesJob(Job): def __init__(self): """ Job to get player suicides Collection name: kill_results Struture: {'player': STR , ...
""" Package for creating the Flask application. This exports: - create_app a function that creates the Flask application """ from flask import Flask from mnemosyne.frontend import frontend from mnemosyne.model import db try: import mnemosyne.settings as settings except: print "Settings file is missing" def ...
import glob import os import shutil import sys import tarfile import traceback from model import Model from subprocess import Popen, PIPE class Apsim75(Model): def run(self, latidx, lonidx): try: apsim_bin = self.config.get('executable') # The apsim 'executable' is a gzipped tarball ...
from matrix import constants, decompositions, errors, approximation, nearest from matrix.calculate import (is_positive_semidefinite, is_positive_definite, is_invertible, decompose, solve) from matrix.constants import ( DECOMPOSITION_TYPES, LDL_DECOMPOSITION_TYPE, LDL_DECOMPOSITION_...
from logging import getLogger from ckan.lib.base import request, BaseController, abort, json, c from ckan.plugins import toolkit import ckan.plugins as p import json import pylons.config as config import subprocess import shlex import os, sys log = getLogger(__name__) class Resource_api_harvestController(BaseController...
from flask import url_for class Hateoas(object): def link(self, rel, title, href): return "<link rel='%s' title='%s' href='%s'/>" % (rel, title, href) def create_link(self, item, rel='self'): title = item.__class__.__name__.lower() method = ".api_%s" % title href = url_for(method...
import sys sys.path.append("itextpdf-5.4.1.jar") from java.io import FileOutputStream from com.itextpdf.text.pdf import PdfReader,PdfStamper,BaseFont import time from SimpleXMLRPCServer import SimpleXMLRPCServer def pdf_fill(orig_pdf,new_pdf,vals): #print "pdf_fill",orig_pdf,new_pdf,vals t0=time.time() #pri...
""" Unit tests for embargo app admin forms. """ from __future__ import absolute_import import six from config_models.models import cache from django.test import TestCase from opaque_keys.edx.locator import CourseLocator from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase from xmodule.modulestore.test...
@VOLT.Command( # Uses all default except last is safemode switch availability bundles = VOLT.ServerBundle('recover', needs_catalog=False, supports_live=False, default_host=True, safemo...
from django.contrib.gis.geos import GEOSGeometry, GeometryCollection from arches.app.utils.betterJSONSerializer import JSONSerializer, JSONDeserializer class GeoUtils(object): def create_geom_collection_from_geojson(self, geojson): geoms = [] for feature in geojson['features']: geoms.app...
from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('mendel', '0008_auto_20160613_1911'), ] operations = [ migrations.RenameField( model_name='context', ...
from __future__ import unicode_literals import frappe from frappe.utils import getdate, validate_email_add, today from frappe.model.naming import make_autoname from frappe import throw, _ import frappe.permissions from frappe.model.document import Document from frappe.model.mapper import get_mapped_doc from erpnext.uti...
from . import setup_db, teardown_db from opmuse.security import User, hash_password class TestSecurity: def setup_method(self): setup_db(self) def teardown_method(self): teardown_db(self) def test_login(self): user = self.session.query(User).filter_by(login="admin").one() has...
import datetime from django.db import models, transaction class Key(models.Model): uid = models.CharField(max_length=255, unique=True) name = models.TextField() created = models.DateTimeField(default=datetime.datetime.utcnow) class Meta: ordering = ('-created',) get_latest_by = 'created'...
from odoo import fields, models class AccountAccountType(models.Model): _inherit = 'account.account.type' _order = 'sequence asc' sequence = fields.Integer( string=u'Sequence', )
""" Views to support bulk email functionalities like opt-out. """ import logging from six import text_type from django.contrib.auth.models import User from django.http import Http404 from bulk_email.models import Optout from courseware.courses import get_course_by_id from edxmako.shortcuts import render_to_response fro...
""" This config file extends the test environment configuration so that we can run the lettuce acceptance tests. """ from .test import * from .sauce import * DEBUG = True SITE_NAME = 'localhost:{}'.format(LETTUCE_SERVER_PORT) import logging logging.basicConfig(filename=TEST_ROOT / "log" / "lms_acceptance.log", level=lo...
from django import forms from trc_me.core.models import Tag class TagForm(forms.ModelForm): """Used when creating tags. tag.user is set to authenticated user. """ class Meta: model = Tag exclude = ('user', 'img_width', 'img_height', 'created_at')
{ "name": "BoM Warning", "version": "4.0.1.2", "depends": [ "mrp", "base", "product", "warning" ], "author": "Didotech srl", "description": """ This module is aim to track the warning on Bills of Material. """, "website": "https://www.didotech.com", ...
''' .. module:: genomics.config :synopsis: library configuration :noindex: :copyright: Copyright 2014 by Tiago Antao :license: GNU Affero, see LICENSE for details .. moduleauthor:: Tiago Antao <tra@popgen.net> ''' import os import configparser as cp config_file = os.path.expanduser('~/.config/pygenomics/mai...
from odoo.tools import convert_file def import_csv_data(cr, registry): """Import CSV data as it is faster than xml and because we can't use noupdate anymore with csv""" filenames = ['data/res.better.zip.csv'] for filename in filenames: convert_file( cr, 'l10n_ch_zip', fil...
from openerp import models, fields, api class ResPartner(models.Model): _inherit = 'res.partner' zip_id = fields.Many2one('res.better.zip', 'City/Location') @api.one @api.onchange('zip_id') def onchange_zip_id(self): if self.zip_id: self.zip = self.zip_id.name self.ci...
from __future__ import unicode_literals, absolute_import from django.test import TestCase from ..forms import QuoteForm class TestQuoteForm(TestCase): def setUp(self): pass def test_validate_emtpy_quote(self): form = QuoteForm({'message': ''}) self.assertFalse(form.is_valid()) fo...
import re from openerp.osv import fields, osv class logistic_company(osv.osv): _inherit="logistic.company" def _get_company_code(self, cr, user, context=None): res = super(logistic_company, self)._get_company_code(cr, user, context=context) res.append(('fedex', 'FedEx')) return list(set...
from dace.processinstance.gateway import ( ExclusiveGateway, ParallelGateway, InclusiveGateway) from .core import FlowNodeDefinition, Path class GatewayDefinition(FlowNodeDefinition): factory = NotImplemented class ExclusiveGatewayDefinition(GatewayDefinition): factory = ExclusiveGateway def find_starta...
import json from urllib.parse import urlencode from tests import TestCase from tests.fixtures.factories import ProfessorFactory, CourseFactory class SearchTestCase(TestCase): def setUp(self): super().setUp() ProfessorFactory(first_name='Mathias') CourseFactory(title='Math Stuff') def tes...
""" Model mixins for `lino_welfare.modlib.aids`. .. autosummary:: """ from __future__ import unicode_literals from builtins import str import logging logger = logging.getLogger(__name__) from django.conf import settings from django.db import models from django.core.exceptions import ValidationError from django.utils.tr...
import unittest import ccs import time class Valid(unittest.TestCase): def setUp(self): self.stock = ccs.constants.OKCOINCOM self.base = ccs.constants.BTC self.quote = ccs.constants.USD self.trades = ccs.trades(self.stock, self.base, self.quote) self.m = ccs.okcoincom.public....
''' Copyright (C) 2016-2019 Vanessa Sochat. 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 option) any later version. This program is distributed i...
from PyQt4 import QtCore, QtGui try: _fromUtf8 = QtCore.QString.fromUtf8 except AttributeError: def _fromUtf8(s): return s try: _encoding = QtGui.QApplication.UnicodeUTF8 def _translate(context, text, disambig): return QtGui.QApplication.translate(context, text, disambig, _encoding) exce...
import logging import os from openfisca_france_data import default_config_files_directory as config_files_directory from openfisca_france_data.erfs.input_data_builder import ( # analysis:ignore step_01_pre_processing as pre_processing, step_02_imputation_loyer as imputation_loyer, step_03_fip as fip, s...
""" tests for the models """ import json from datetime import datetime, timedelta import ddt from pytz import utc from student.roles import CourseCcxCoachRole from student.tests.factories import AdminFactory from xmodule.modulestore.tests.django_utils import TEST_DATA_SPLIT_MODULESTORE, ModuleStoreTestCase from xmodule...
from dynamics.dynamics.rotating_machine import RotatingMachine from google.appengine.ext import db class GenSync(RotatingMachine): """ Synchronous generator model. A single standard synchronous model is defined for the CIM, with several variations indicated by the 'model type' attribute. This model can be used for...
''' Copyright (C) 2017 The Board of Trustees of the Leland Stanford Junior University. Copyright (C) 2016-2017 Vanessa Sochat. 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 o...
import os, sys from polib import pofile from config import CONFIGURATION from extract import SOURCE_WARN from execute import execute TRANSIFEX_HEADER = 'Translations in this file have been downloaded from %s' TRANSIFEX_URL = 'https://www.transifex.com/projects/p/edx-studio/' def push(): execute('tx push -s') def pu...
import multiprocessing import time import zmq from streambug import cmd_interface from streambug import mplogger mplogger.setup(debug=True) log = mplogger.getLogger() def server_thread(zeromq_context, address, port_pull, port_pub): server = cmd_interface.Server(zeromq_context, address, port_pull, port_pub) serv...
from django.conf import settings as settings from django.contrib.auth.decorators import login_required from django.core.context_processors import csrf from django.core.urlresolvers import reverse from django.db.models import Q from django.http import HttpResponse, HttpResponseRedirect, Http404 from django.utils import ...
"""pdbquery RAPD plugin""" """ This file is part of RAPD c Copyright (C) 2017, Cornell University All rights reserved. RAPD 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, version 3. RAPD is distributed in ...
from django.dispatch import Signal compute_scores_encodings_deadlines = Signal(providing_args=["offer_year_calendar"]) compute_student_score_encoding_deadline = Signal(providing_args=["session_exam_deadline"]) compute_all_scores_encodings_deadlines = Signal(providing_args=["academic_calendar"])
__author__ = 'sweemeng' from rest_framework import status from popit.signals.handlers import * from popit.models import * from popit.tests.base_testcase import BasePopitAPITestCase class PersonLinkAPITestCase(BasePopitAPITestCase): def test_view_person_link_list_unauthorized(self): response = self.client.ge...
""" (Future home of) Tests for program enrollment writing Python API. Currently, we do not directly unit test the functions in api/writing.py. This is okay for now because they are all used in `rest_api.v1.views` and is thus tested through `rest_api.v1.tests.test_views`. Eventually it would be good to directly test the...
import datetime import os from django.conf import settings from django.core.files.storage import FileSystemStorage from django.core.urlresolvers import reverse from django.db import models from django.utils import timezone from comics.core.managers import ComicManager class Comic(models.Model): LANGUAGES = ( ...
from osv import osv,fields import time from datetime import datetime from dateutil import rrule class qingjia_calendar(osv.osv): _name='qingjia.calendar' _columns={ 'start_date':fields.datetime('start_date'), 'end_date':fields.datetime('end_date'), 'calendar_line_ids':f...
__author__ = 'sweemeng' from rest_framework import status from popit.signals.handlers import * from popit.models import * from django.conf import settings import json import logging from popit.tests.base_testcase import BasePopitTestCase from popit.tests.base_testcase import BasePopitAPITestCase from popit.serializers....
import pytest from gaphas.painter import BoundingBoxPainter from gaphas.view import GtkView from gaphor.diagram.painter import ItemPainter from gaphor.diagram.selection import Selection from gaphor.diagram.tests.fixtures import diagram, element_factory, event_manager @pytest.fixture def view(diagram): view = GtkVie...
import json import numpy as np from glob import glob inputs = { 'xml_file_path' : "./data/single_wavelength_copy", 'file_set' : {'p38' : glob( "./data/single_wavelength_copy/*.xml")}, 'section' : '280_480_TOP_120', 'ligand_order' : ['Bosutinib','Bosutinib Isomer','Erlotinib','Gefitinib',...
""" Linux ioctl macros. Taken from /usr/include/asm/ioctl.h """ import struct sizeof = struct.calcsize _IOC_NRBITS = 8 _IOC_TYPEBITS = 8 _IOC_SIZEBITS = 14 _IOC_DIRBITS = 2 _IOC_NRMASK = ((1 << _IOC_NRBITS)-1) _IOC_TYPEMASK = ((1 << _IOC_TYPEBITS)-1) _IOC_SIZEMASK = ((1 << _IOC_SIZEBITS)-1) _IOC_DIRMASK = ((1 << _IOC_D...
"""autogenerated by genpy from hrl_lib/Pose3DOF.msg. Do not edit.""" import sys python3 = True if sys.hexversion > 0x03000000 else False import genpy import struct import std_msgs.msg class Pose3DOF(genpy.Message): _md5sum = "646ead44a0e6fecf4e14ca116f12b08b" _type = "hrl_lib/Pose3DOF" _has_header = True #flag to...
from gtk import * from gnome.ui import * win = GtkWindow() win.connect('destroy', mainquit) win.set_title('Canvas test') canvas = GnomeCanvas() canvas.set_size(300, 300) win.add(canvas) canvas.show() canvas.root().add('line', points=(10,10, 90,10, 90,90, 10,90), width_pixels=10, fill_color='blue') win.show() ...
""" Driver Capability management. """ from numbers import Real from typing import Optional from stoqdrivers.exceptions import CapabilityError class Capability: """ This class is used to represent a driver capability, offering methods to validate a value with base in the capability limits. """ def __init...
from setuptools import setup import picuplib setup( name = 'picuplib', packages = ['picuplib'], version = picuplib.__version__, description = 'Picflash upload library', author = 'Arvedui', author_email = 'arvedui@posteo.de', url = 'https://github.com/Arvedui/picuplib', in...
import os import pytest import spack from llnl.util.filesystem import join_path, touch, working_dir from spack.spec import Spec from spack.version import ver from spack.util.executable import which pytestmark = pytest.mark.skipif( not which('svn'), reason='requires subversion to be installed') @pytest.mark.parametr...
''' Created on 2015年1月19日 @author: Guan-yu Willie Chen ''' from selenium import webdriver from selenium.webdriver.support.select import Select from selenium.webdriver.common.keys import Keys import time browser = webdriver.Chrome("chromedriver.exe") URL = "" browser.get(URL+"/insurance/gs/sp/spLogin") browser.find_elem...
from scipy.spatial import distance as dist class Searcher: def __init__(self, index): self.index = index def search(self, queryFeature): results = {} for (k, feature) in self.index.items(): d = dist.euclidean(queryFeature, feature) results[k] = d results = sorted([(v, k) for (k, v) in results.items()]) ...
from .spec import BASIC_PROPS_SET, encode_basic_properties def encode_message(frame, headers, body, frame_size): """Encode message headers and body as a sequence of frames.""" for f in frame.encode(): yield f props, headers = split_headers(headers, BASIC_PROPS_SET) if headers: props['hea...
from openturns import coupling_tools import os import time import sys wanted_lines = '# ooo\nE=@E\nE1=@E\nFE1=@F#oo\nZ=@Z@Z\n# ooo\n' semi_parsed = '# ooo\nE=2\nE1=2\nFE1=@F#oo\nZ=@Z@Z\n# ooo\n' parsed = '# ooo\nE=1.6\nE1=1.6\nFE1=5#oo\nZ=66\n# ooo\n' howbig = 256 max_time = divmod(howbig, 5)[0] def create_template(): ...
"""microarray.py - cMonkey microarray related processing This module captures the microarray-specific scoring component of cMonkey. This file is part of cMonkey Python. Please see README and LICENSE for more information and licensing details. """ import numpy as np import logging import datamatrix as dm import util imp...
from bacpypes.apdu import SubscribeCOVRequest, SimpleAckPDU, RejectPDU, AbortPDU from bacpypes.iocb import IOCB from bacpypes.core import deferred from bacpypes.pdu import Address from bacpypes.object import get_object_class, get_datatype from bacpypes.constructeddata import Array from bacpypes.primitivedata import Tag...
from django.conf.urls import patterns, include, url from kylin_log.views import * urlpatterns = patterns('', url(r'^list/(\w+)/$', log_list, name='log_list'), url(r'^detail/(\w+)/$', log_detail, name='log_detail'), url(r'^history/$', log_history, name...
"""Generates out a Closure deps.js file given a list of JavaScript sources. Paths can be specified as arguments or (more commonly) specifying trees with the flags (call with --help for descriptions). Usage: depswriter.py [path/to/js1.js [path/to/js2.js] ...] """ import logging import optparse import os import posixpath...
from openturns import * TESTPREAMBLE() try : try : # Instanciate one distribution object meanPoint = NumericalPoint(1) meanPoint[0] = 1.0 sigma = NumericalPoint(1) sigma[0] = 1.0 R = CorrelationMatrix(1) distribution = Normal(meanPoint, sigma, R) print...
"""Hypertext Transfer Protocol (HTTP) These objects provide support for :rfc:`HTTP <2616>`. .. seealso:: :mod:`HTTP authentication <bedframe.auth.http>` """ __copyright__ = "Copyright (C) 2014 Ivan D Vasin" __docformat__ = "restructuredtext" from ._exc import * from ._services import *
import asyncio import logging import aioxmpp.service import aioxmpp.callbacks as callbacks import aioxmpp.errors as errors import aioxmpp.stanza as stanza import aioxmpp.structs as structs from . import xso as roster_xso logger = logging.getLogger(__name__) _Sentinel = object() class Item: """ Represent an entr...
from dolfin import * from dolfin_adjoint import * parameters["adjoint"]["cache_factorizations"] = True mesh = UnitSquareMesh(3, 3) V = FunctionSpace(mesh, "R", 0) test = TestFunction(V) trial = TrialFunction(V) def main(m): u = interpolate(Constant(0.1), V, name="Solution") F = inner(u*u, test)*dx - inner(m, te...
__author__ = 'soporte' from .base import * DEBUG = True TEMPLATE_DEBUG = True ALLOWED_HOSTS = [] DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': Path.join(BASE_DIR, 'db.sqlite3'), } } STATIC_URL = '/static/'
import sys import subprocess import os.path as op import socket def this_abs_path(script_name): return op.abspath(op.join(op.dirname(__file__), script_name)) def monitor_process(key_word, cmd): p1 = subprocess.Popen(['ps', '-ef'], stdout=subprocess.PIPE) p2 = subprocess.Popen(['grep', key_word], stdin=p1.st...
from . import stock_return_picking
from skimage import measure import numpy as np import struct import math as m from PIL import Image from simplify import simplify import argparse parser = argparse.ArgumentParser(description='convert apk heightmaps to floating point tiff') parser.add_argument('file', type=str, help='the apk heightmap file') args = pars...
""" Covariance estimators using shrinkage. Shrinkage corresponds to regularising `cov` using a convex combination: shrunk_cov = (1-shrinkage)*cov + shrinkage*structured_estimate. """ from __future__ import division import warnings import numpy as np from .empirical_covariance_ import empirical_covariance, EmpiricalCova...
def load_velocity(filename): import os if not os.path.exists(filename): return None from numpy import zeros from vtk import vtkPolyDataReader, vtkCellDataToPointData reader = vtkPolyDataReader() reader.SetFileName(filename) reader.ReadAllVectorsOn() reader.Update() data = rea...
from django.shortcuts import render, redirect, get_object_or_404 from django.views.generic import TemplateView from farxiv.forms import * class Index(TemplateView): template_name = 'index.html' def get_context_data(self, **kwargs): context = super(TemplateView, self).get_context_data(**kwargs) c...
data = [set(open(i).read().split()) for i in ('C:\\Users\\Aliwka\\Desktop\\ДЗ-курсы\\Homework6\\first.txt', 'C:\\Users\\Aliwka\\Desktop\\ДЗ-курсы\\Homework6\\second.txt')] diff = data[0].difference(data[1]) if diff: print(diff, 'слова которые есть в первом файле, но нет во втором') print(data[1],data[0],'слова ...
import sys sys.path.append('../..') import codestudio a = codestudio.load('s1level32') a.speed = 'fastest' for count in range(360): a.move_backward(1) a.left(1) a.check()
from setuptools import setup install_requires = [ 'requests', 'beautifulsoup4' ] setup( name='urbandefinition', install_requires=install_requires, version=0.3, description='Get Urban Dictionary definitions from the terminal', author='Asad Dhamani', author_email='dhamaniasad+code@gmail.co...
import st2tests.config as tests_config tests_config.parse_args() import mock from unittest2 import TestCase from st2actions.runners.fabric_runner import BaseFabricRunner from st2common.constants.action import LIVEACTION_STATUS_SUCCEEDED, LIVEACTION_STATUS_FAILED from st2common.models.system.action import RemoteScriptAc...
"""Supported pricing models.""" import enum from typing import Any import dataclasses class InterestRateModelType(enum.Enum): """Models for pricing interest rate derivatives. LOGNORMAL_RATE: Lognormal model for the underlying rate. NORMAL_RATE: Normal model for the underlying rate LOGNORMAL_SMILE_CONSISTENT_REP...
"""A CLI to import whisper data into Cassandra.""" from __future__ import print_function import argparse import datetime import io import logging import multiprocessing import os import re import struct import sys import time from multiprocessing import dummy as multiprocessing_dummy import progressbar import scandir i...
""" This module implements a reactor wrapper which will cause all traffic on connections set up using that reactor to be logged. """ __all__ = ['loggedReactor'] from weakref import ref from StringIO import StringIO from collections import namedtuple from zope.interface import providedBy from twisted.python.components i...
"""A module to control the application global properties. This module will manage a singleton object for the PyreRing global properties. These properties include: root_dir, testdatabase etc. These properties are stored as a dictionary which is referred through a global variable and managed by some module level methods ...
from nssrc.com.citrix.netscaler.nitro.resource.base.base_resource import base_resource from nssrc.com.citrix.netscaler.nitro.resource.base.base_resource import base_response from nssrc.com.citrix.netscaler.nitro.service.options import options from nssrc.com.citrix.netscaler.nitro.exception.nitro_exception import nitro_...
__author__ = 'BeyondSky' from collections import defaultdict class Solution(object): def getHint(self, secret, guess): """ :type secret: str :type guess: str :rtype: str """ bulls = cows = 0 digits = defaultdict(int) # first pass: count bulls and non-m...
"""Test utils.""" import os from typing import Dict, Optional from absl.testing import parameterized from jax.lib import xla_bridge import numpy as np class TestCase(parameterized.TestCase): """Custom test class containing additional useful utility methods.""" def assertArrayEqual(self, actual: np.ndarray, expected...
''' More information at: http://www.pymolwiki.org/index.php/elbow_angle Calculate the elbow angle of an antibody Fab complex and optionally draw a graphical representation of the vectors used to determine the angle. NOTE: There is no automatic checking of the validity of limit_l and limit_h values or of the assignment ...
from unittest import TestCase, main from lucene import * from PyLuceneTestCase import PyLuceneTestCase class TestRegexQuery(PyLuceneTestCase): FN = "field" def setUp(self): PyLuceneTestCase.setUp(self) writer = self.getWriter(analyzer=SimpleAnalyzer(self.TEST_VERSION)) doc = Document() ...
"""Benchmark scipy.stats.arcsine.""" from __future__ import print_function import timeit REPEATS = 3 COUNT = [0] # use a list to allow modification within nested scopes def print_version(): """Print the TAP version.""" print("TAP version 13") def print_summary(total, passing): """Print the benchmark summar...
import logging from collections import OrderedDict from contextlib import contextmanager import tensorflow.compat.v1 as tf import fedlearner.data_join.common as common from fedlearner.data_join.raw_data_iter_impl.raw_data_iter import RawDataIter class TfExampleItem(RawDataIter.Item): def __init__(self, record_str, ...
import os,re,fnmatch from ehive.runnable.IGFBaseJobFactory import IGFBaseJobFactory class FastqFileFactory(IGFBaseJobFactory): ''' A job factory class for creating fan jobs for demultilexed fastq files ''' def param_defaults(self): params_dict=super(FastqFileFactory,self).param_defaults() params_dict.up...
from .global_state import State Global = State()
"""Generate the wide baseline stereo image dataset from the Matterport3D. We generate the data by randomly sample different perspective views from panoramic images in Matterport3D to create a large scale dataset with a large varieties of motion. The dataset contains a pair of perspective images labeled with the relativ...
"""Implements a parallel data reader with queues and optional shuffling.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function from tensorflow.python.framework import dtypes as tf_dtypes from tensorflow.python.framework import ops from tensorflow.python.ops impo...
from osgeo import gdal, osr, ogr import numpy as np import scipy.misc import logging logging.basicConfig(level=logging.INFO) logger = logging.getLogger("banner-generator") def create_raster_from_band( red, green, blue, output_file): logger.debug("Create big raster in output_file : %s"%output_file) red_ds = gdal...
from scipy import sparse import re class VectorEncoder(object): def __init__(self): self.n_size = 0 self.idmap = {} def fit(self, X): for row in X: units = re.split("\\s+", row) for unit in units: if unit == '-1': unit = 'null:0' en...
"""Test study generator.""" from typing import Collection from vizier.pyvizier import pythia as vz def flat_space_with_all_types() -> vz.SearchSpace: """Search space with all parameter types.""" space = vz.SearchSpace() root = space.select_root() root.add_float_param('lineardouble', -1., 2.) root.add_float_pa...
from bs4 import BeautifulSoup class RunParameter_xml: ''' A class for reading runparameters xml file from Illumina sequencing runs :param xml_file: A runparameters xml file ''' def __init__(self, xml_file): self.xml_file = xml_file self._read_xml() def _read_xml(self): ''' Internal function ...
import threading from .sysdic import entries, mmap_entries, connections, chardef, unknowns # type: ignore from .dic import RAMDictionary, MMapDictionary, UnknownsDictionary class SystemDictionary(RAMDictionary, UnknownsDictionary): """ System dictionary class """ __INSTANCE = None __lock = threadin...
from collections import Iterable d = {'a':1, 'b':2, 'c':3} for key in d: print(key) for value in d.values(): print(value) for ch in 'ABC': print(ch) print(isinstance('abc', Iterable) ) print(isinstance(123,Iterable)) for i, value in enumerate(['a', 'b', 'c']): print(i, value) for x,y in [(1,1), (2,4), (3,9)]: prin...
"""Training helper functions that are shared across tasks.""" import contextlib import functools import operator import signal import typing from typing import Any, Callable, Dict, Iterable, Optional, Sequence, Tuple, Union from absl import logging import dataclasses import flax import gin import jax import jax.numpy a...