code
stringlengths
1
199k
from os import listdir, sep from os.path import abspath, basename, isdir from sys import argv def tree(dir, padding, print_files=False): print(padding[:-1] + '+-' + basename(abspath(dir)) + '/') padding = padding + ' ' files = [] if print_files: files = listdir(dir) else: files = [x ...
(S'0944451bd301bb4eaa393ea2b50a396c' p1 (ihappydoclib.parseinfo.moduleinfo ModuleInfo p2 (dp3 S'_namespaces' p4 ((dp5 S'SmartsPattern' p6 (ihappydoclib.parseinfo.classinfo ClassInfo p7 (dp8 g4 ((dp9 (dp10 S'__del__' p11 (ihappydoclib.parseinfo.functioninfo FunctionInfo p12 (dp13 g4 ((dp14 (dp15 tp16 sS'_exception_info'...
class Info(object): """ """ def __init__(self, server, handler='info'): self._server = server self._handler = handler def activityinfo(self): """Activity Info. """ return self._server.post("info/activityinfo")
""" cv_bridge_demo.py - Version 0.1 2011-05-29 A ROS-to-OpenCV node that uses cv_bridge to map a ROS image topic and optionally a ROS depth image topic to the equivalent OpenCV image stream(s). Created for the Pi Robot Project: http://www.pirobot.org Copyright (c) 2011 Patrick Goebel. All rights reserv...
import re class DialplanExecutionAnalyzer(object): def analyze(self, dialplan_parse_result, log_parse_result): line_analyses = self._do_lines_analyses(dialplan_parse_result, log_parse_result) return _Analysis(dialplan_parse_result.filename, line_analyses) def _do_lines_analyses(self, dialplan_pa...
from __future__ import unicode_literals __author__ = "mozman <mozman@gmx.at>" import warnings from ..legacy.layouts import DXF12Layout, DXF12BlockLayout from ..lldxf.classifiedtags import ClassifiedTags PAPER_SPACE = '*Paper_Space' TMP_PAPER_SPACE_NAME = '*Paper_Space999999' class Layouts(object): def __init__(self...
''' Created on 8. juli 2014 @author: perroe ''' from PyQt4.QtGui import QFormLayout, QToolButton from ert_gui.ide.keywords.definitions import RangeStringArgument, \ ProperNameFormatStringArgument from ert_gui.models.connectors import EnsembleSizeModel from ert_gui.models.connectors.init import CaseSelectorModel fro...
from .grammar import flags from .tokex_class import Tokex from .tokenizers.tokenizer import TokexTokenizer def compile(input_grammar, allow_sub_grammar_definitions=True, tokenizer=TokexTokenizer, default_flags=flags.DEFAULTS): """ Constructs and returns an instance of _String...
import os from waflib import Utils, Build, Context from waflib.Configure import conf @conf def CHECK_FOR_THIRD_PARTY(conf): return os.path.exists(os.path.join(Context.g_module.top, 'third_party')) Build.BuildContext.CHECK_FOR_THIRD_PARTY = CHECK_FOR_THIRD_PARTY @conf def CHECK_POPT(conf): return conf.CHECK_BUND...
from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('orb', '0004_auto_20150420_2152'), ] operations = [ migrations.CreateModel( name='ResourceCriteria', fields=[ ('id...
import errno import logging import os from itertools import chain from time import sleep, time import re from dateutil.parser import parse as parse_date from onemirror.database import OneDriveDatabaseManager from onemirror.exception import ResyncRequired logger = logging.getLogger('onemirror') EPOCH = parse_date('1970-...
"""Custom topology example Two directly connected switches plus a host for each switch: host --- switch --- switch --- host Adding the 'topos' dict with a key/value pair to generate our newly defined topology enables one to pass in '--topo=mytopo' from the command line. """ from mininet.topo import Topo from mininet...
""" Work with PBS script files """ import shlex import logging def set_options_from_pbs_script(arg_parser, options, pbs_script): """ Add directives in pbs_script to existing options, using arg_parser """ opt_string = '' pbs_fh = open(pbs_script) for line in pbs_fh: if line.startswith('#!'): ...
import time from django.core.management.base import BaseCommand, CommandError from tasks.models import TaskSubmission class Command(BaseCommand): help = 'List all ungraded tasks' def handle(self, *args, **options): ungraded = TaskSubmission.objects.filter(grading_completed=False) i = 1 c...
"""Quaternion methods for finding rotation, reflection, and improper rotation matrices.""" def get_rotation_matrix(a,b): """Find the rotation matrix that takes a to b. """ a = np.array(a) b = np.array(b) a2 = np.dot(a,a) b2 = np.dot(b,b) if not np.isclose(a2, b2): msg = "The vectors ...
from VMWConfigFile import * from pyVim import connect from pyVim.connect import SmartConnect, Disconnect from pyVmomi import vim, vmodl import atexit import os import sys import ssl import requests import argparse import time import getpass requests.packages.urllib3.disable_warnings() context = ssl.SSLContext(ssl.PROTO...
from PySide import QtCore, QtGui class Ui_Accueil(object): def setupUi(self, Accueil): Accueil.setObjectName("Accueil") Accueil.resize(254, 300) Accueil.setMinimumSize(QtCore.QSize(254, 300)) Accueil.setMaximumSize(QtCore.QSize(254, 300)) self.centralwidget = QtGui.QWidget(Ac...
from random import Random from unittest.mock import MagicMock import pytest from randovania.game_description.world.area_identifier import AreaIdentifier from randovania.game_description.assignment import PickupTarget from randovania.game_description.hint import Hint, HintType, PrecisionPair, HintLocationPrecision, Hint...
from __future__ import print_function import importlib import inspect import types from abjad.tools.abctools.AbjadObject import AbjadObject class InheritanceGraph(AbjadObject): r'''Generates a graph of a class or collection of classes as a dictionary of parent-children relationships: :: >>> class A(...
import sys import bottle_session from sqlalchemy import create_engine from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import sessionmaker from bottlereact import BottleReact from bottle.ext import sqlalchemy import bottle PROD = '--prod' in sys.argv MAILGUN_API_KEY = "NOTAREALKEY" Base = dec...
bl_info = { "name": "MecaFace", "author": "Citrine's Animations", "version": (1, 0, 4), "blender": (2, 80, 0), "location": "Side Bar", "description": "Easily Add Face Rigs", "warning": "", "wiki_url": "www.mecabricks.com", "category": "Add Mesh", } import os import bpy from bpy.props...
from common import * properties = ArrayList() properties.add( DoubleProperty( "speed" ) ) class Player(AbstractRole) : def __init__(self) : self.speed = 1 self.collected = 0 def onBirth(self) : self.addTag("player") self.inputClick = Input.find("click") def onSceneCreated(sel...
__prog_name__ = 'update_database_from_ftp.py' __prog_desc__ = ('Update the GTDB with the latest genome downloaded from FTP.' + 'Before this update, make sure all metadata have been generated and CheckM did run on all new genomes') __author__ = 'Pierre Chaumeil' __copyright__ = 'Copyright 2016' __credit...
from pyntc import ntc_device as NTC import json sw1 = NTC(host='192.168.122.10', username='test', password='test', device_type="cisco_ios_ssh") sw1.open() ios_output = sw1.facts sw1.config_list(['router ospf 1', 'network 0.0.0.0 255.255.255.255 area 0'])
import os,sys,struct import numpy as np noargs = len(sys.argv) if ( noargs != 2 ): print( "No filename specified." ) exit() fh = open(sys.argv[1], 'rb' ) header_raw = fh.read(struct.calcsize("llllllliidddddddddddddd")) header = struct.unpack( "llllllliidddddddddddddd", header_raw ) nDims = header[3] nDimX = header[...
import codecs import ConfigParser import json import re import requests import sys import time from os import listdir, remove from os.path import dirname, exists, expanduser, isfile, join, realpath activate_this = join(expanduser('~'), 'ckan_default', 'bin', 'activate_this.py') execfile(activate_this, dict(__file__=act...
from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('lizard_efcis', '0003_auto_20150209_1133'), ] operations = [ migrations.AlterField( model_name='opname', name='waarde_a', ...
""" Copyright 2007-2011, 2016q Free Software Foundation, Inc. This file is part of GNU Radio SPDX-License-Identifier: GPL-2.0-or-later """ from __future__ import absolute_import import ast import functools import random from distutils.spawn import find_executable from itertools import count import six from gi.repositor...
from zope.interface import implementer from ..interfaces import ( IResourceType, ) from ..resources import ( ResourceTypeBase, ) from ..lib.utils.common_utils import translate as _ @implementer(IResourceType) class AssignsResource(ResourceTypeBase): __name__ = 'assigns' @property def allowed_permisi...
import numpy as np xyz2zxy = np.array([[0., 1., 0., 0.], [0., 0., 1., 0.], [1., 0., 0., 0.], [0., 0., 0., 1.]])
import json import time from charitybot2.configurations.event_configuration import EventConfiguration from charitybot2.exceptions import IllegalArgumentException from charitybot2.models.donation import Donation from charitybot2.models.event import NonExistentEventException from charitybot2.sources.url_call import UrlCa...
from optparse import OptionParser from os.path import basename, splitext from sys import exit, stdout from lpod import __version__ from lpod.document import odf_new_document_from_type, odf_get_document from lpod.toc import odf_create_toc from lpod.vfs import vfs from lpod.table import import_from_csv def init_doc(mimet...
""" Test CF-NetCDF file loading and saving. """ from __future__ import (absolute_import, division, print_function) from six.moves import (filter, input, map, range, zip) # noqa import six import iris.tests as tests import os import os.path import shutil import stat import tempfile import netCDF4 as nc import numpy as ...
""" turretFire.py Use vector projection to add a shell to the turret""" import pygame, math pygame.init() class Label(pygame.sprite.Sprite): """ Label Class (simplest version) Properties: font: any pygame font object text: text to display center: desired position ...
import os import subprocess def get_file(formato): ''' Función para petición y validación de un archivo en un formato específico ''' get_file = False while not get_file: # Petición de archivo .p12 archivo = raw_input("Introduzca el archivo .%s: " % (formato)) # Comproband...
""" ai.py - Artificial Intelligence Module Copyright 2009-2011, Michael Yanovich, yanovich.net Licensed under the Eiffel Forum License 2. http://sopel.chat """ from cleverwrap import CleverWrap from sopel.module import rule, priority, rate import random import time import os import html.parser import cleverbot cleverbo...
from django.contrib import admin from candidatos.models import Candidato class CandidatoAdmin(admin.ModelAdmin): fieldsets = [ (None, {'fields': ['nombre', 'apellidos', 'imagen', 'email']}), ('Datos personales', {'fields': ['nif', 'telefono']}), ('Candidatura', {'fields': ['secretario', 'con...
from collections import OrderedDict as OD from math import ceil from util.columns import * from .callbacks import spi_efc_cmd_cb from .ADF4350 import columns from ..regs import RegsData, regs_cb hex_data = ''' R0|FEF| ''' bin_data = ''' R0|0|VGA1 Setpoint R0|3|VGA2 Setpoint R0|6|VGA2 Switch R0|7|VGA1 Maximum Gain R0|9|...
'''Trajectory writers''' from __future__ import division from yaff.sampling.iterative import Hook, AttributeStateItem, PosStateItem, CellStateItem, ConsErrStateItem from yaff.sampling.nvt import NHCThermostat, NHCAttributeStateItem from yaff.sampling.npt import MTKBarostat, MTKAttributeStateItem, TBCombination from yaf...
import os from setuptools import setup, find_packages base_dir = os.path.dirname(__file__) with open(os.path.join(base_dir, "README.md"), encoding="UTF-8") as stream: long_description = stream.read() setup( name="textland", version="0.1", url="https://github.com/zyga/textland", packages=find_package...
import ssl import SocketServer import sqlite3 import os RECEIVE_SIZE = 1024 UPDATE_SERVER_IP_AND_PORT = ('0.0.0.0', 5151) PARAMETER_DELIMITER = ':' LENGTH_PARAM = 0 TOKEN_PARAM = 1 OPCODE_PARAM = 2 NOTIFICATION_PARAM = 3 SETTINGS_REQUEST = "1" NOTIFICATION_UPDATE = "2" CURRENT_WORKING_DIRECTORY = os.getcwd() # Gives e...
from struct import calcsize, unpack from math import fabs PRECISION = 1e-8 def cmpfloat(filename_a, filename_b, precision = PRECISION): A = filename_a B = filename_b fA = open(A) fB = open(B) sizeof_float = calcsize("f") offset = 0 while 1: bA = fA.read(sizeof_float) bB = fB.read(sizeof_float) ...
import sys, os import pygtk, gtk, gobject import pygst pygst.require("0.10") import gst from random import choice import random window=int(sys.argv[1], 16) effects = [ "edgetv", "agingtv", "dicetv", "warptv", "shagadelictv", "vertigotv", "revtv", "quarktv", "optv", "radioactv", "streaktv", "ripp...
""" AST visitor class to convert Python expressions into C++ as used by ThePEG """ import ast convertHerwig=False def py2cpp(expr,con=False): """Convert expr to C++ form. Wraps the converter class.""" global convertHerwig convertHerwig=con result = PyToCpp().parse(expr) return result class PyToCppEx...
import elements import copy import json import os class ElementList(): def __init__(self): self.sorted_atomic_number_symbol_list = None self.sorted_eds_lines_list = None self.element_data_dict = None self.elements_rawdata = elements.elements self.make_sorted_atomic_number_sym...
""" **types.py** **Platform:** Windows, Linux, Mac Os X. **Description:** Defines Application Database types: :class:`IblSet`, :class:`Template` and :class:`Collection` classes. **Others:** """ from __future__ import unicode_literals import os import sqlalchemy.ext.declarative from sqlalchemy import Foreign...
import math import sys from Crypto.PublicKey import RSA keypair = RSA.generate(1024) keypair.p = 275127860351348928173285174381581152299 keypair.q = 319576316814478949870590164193048041239 keypair.e = 65537 keypair.n = keypair.p * keypair.q Qn = long((keypair.p-1) * (keypair.q-1)) i = 1 while (True): x = (Qn * i ) + 1...
from django.db.models.signals import post_syncdb from django.contrib.sites import models as sites_models from shortim.signals import change_site_domain, create_first_shorturl from shortim import models as shortim_models post_syncdb.connect(change_site_domain, sender=sites_models) post_syncdb.connect(create_first_shortu...
""" This module manages is a client for the TS and manages the transformations associated to the productions """ from __future__ import absolute_import from __future__ import division from __future__ import print_function __RCSID__ = "$Id $" import json from DIRAC import gLogger, S_OK, S_ERROR from DIRAC.Transformati...
import argparse import logging import os.path import signal import sys import dbus.mainloop.glib import gobject if not ('/usr/lib/python2.7/site-packages' in sys.path): sys.path.append('/usr/lib/python2.7/site-packages') from tpfancod import settings, control class Tpfancod(object): """main tpfancod process""" ...
from PyQt4.QtGui import QGridLayout, QLabel, QPushButton, QMessageBox from basedialog import VDialog class DMessage(VDialog): def __init__(self, parent): VDialog.__init__(self, parent) self.resize(450, 150) self.gLayout = QGridLayout(self) self.mesaj = QLabel(self) self.gLayo...
"""Integration: njsscan.""" from pathlib import Path from nodejsscan import ( settings, utils, ) from njsscan.njsscan import NJSScan from njsscan.settings import ( IGNORE_PATHS, NODEJS_FILE_EXTENSIONS, TEMPLATE_FILE_EXTENSIONS, ) def all_files(path, search=False, term=None): """Gather all files ...
from django import forms from django.core import serializers from django.contrib import admin from django.contrib.auth import get_user_model from django.contrib.auth.admin import UserAdmin from django.contrib.auth.forms import UserCreationForm, UserChangeForm from django.db.models.fields.related import ManyToManyRel fr...
""" Tests for DropShadowFrame wiget. """ import math from AnyQt.QtWidgets import ( QMainWindow, QWidget, QListView, QTextEdit, QHBoxLayout, QToolBar, QVBoxLayout ) from AnyQt.QtGui import QColor from AnyQt.QtCore import Qt, QPoint, QPropertyAnimation, QVariantAnimation from .. import dropshadow from .. import t...
from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals def DeterminePackageManager(APTCmd, YUMCmd): """Determine and return the package manager using the given command strings.""" PackageManager = "Unknown" for Cmd...
import os, sys, traceback from repository.forms import BaseForm from django.forms.models import ModelChoiceField from django.core.exceptions import ValidationError from repository.models import Snippet class SnippetForm(BaseForm): class Meta: model = Snippet fields = ['name', 'description', 'same_a...
from __future__ import unicode_literals from django import forms class BaseEditor(object): """Editors should inherit from this. See wiki.editors for examples.""" # The editor id can be used for conditional testing. If you write your # own editor class, you can use the same editor_id as some editor edito...
""" Description : Open gtk Authors: Benoit Paquet Date : October 2012 """ from CapraVision.server.core.manager import VisionManager from CapraVision.server.tcp_server import Server from CapraVision.client.controller.controllerProtobuf import ControllerProtobuf def run(): # CLASS NOT CURRENTLY USED # Protobuf ...
""" :mod: ReqClient .. module: ReqClient :synopsis: implementation of client for RequestDB using DISET framework """ from __future__ import absolute_import from __future__ import division from __future__ import print_function import six import os import time import random import json import datetime from DIRAC impo...
""" Started on wed, oct 25th, 2017 @author: carlos.arana Descripcion: """ import pandas as pd import numpy as np import sys module_path = r'D:\PCCS\01_Dmine\Scripts' if module_path not in sys.path: sys.path.append(module_path) from SUN.asignar_sun import asignar_sun from VarInt.VarInt import VarInt from SUN_integri...
""" Multi-class Logistic Regression exploiting uncertainty in the input features. """ import os import sys import argparse import logging import numpy as np import torch from torch import nn logger = logging.getLogger(__name__) class MCLR(nn.Module): """ Multi-class Logistic Regression """ def __init__( ...
import copy from slist import slist class ImageDataSet(object): def __init__(self): self.objs = [] self.height = 0 self.width = 0 #self.xmins = slist() #self.xmaxs = slist() #self.xmin_dict = {} #self.xmax_dict = {} def add_obj(self, obj, height = 0, width...
from sys import argv from sys import path from sys import maxint script, first, second, third = argv print "The script is called: ", script print "Your first variable is: ", first print "Your second variable is: ", second print "Your third variable is: ", third print "The path is: ", path[0] print "The max int is: ", m...
import json from lxml import etree from datetime import datetime from dateutil.relativedelta import relativedelta from openerp import api, fields, models, _ from openerp.tools import float_is_zero from openerp.tools.misc import formatLang from openerp.exceptions import UserError, RedirectWarning, ValidationError import...
import bpy from .exposure import * from .getters import * from .merge_utils import * from ..mat_utils import * from ..matlist_utils import * from ..brick import * def update_materials(bricksdict, source_dup, keys, cur_frame=None, action="CREATE"): """ sets all mat_names in bricksdict based on near_face """ scn,...
""" Mock classes to load in test_dynamicloader.py """ class Parent: pass class Parent2: pass def afunction(): pass class AClass(Parent, Parent2): anattr = "asdf" afunc = afunction class BClass: def __init__(): self.b_method = CClass() def a_method(self): pass class CClass(ACl...
keys = dict( consumer_key = 'your_consumer_key', consumer_secret = 'your_consumer_secret', access_token = 'your_access_token', access_token_secret = 'your_token_secret', )
"""Return sensors and headshape positions""" '''sensors.locationsbyindex(datapdf, ch.channelindexcfg)''' from pdf2py import pdf, channel from numpy import zeros, array, size, append, reshape class locations: def __init__(self, datapdf): '''returns unsorted meg signal sensors... A1,A2,etc''' pdfinsta...
""" Created on Fri Jan 31 13:06:41 2014 @author: samantha SciPy and NumPy """ import numpy as np from scipy.optimize import curve_fit def func(x, a, b, c): return a * np.exp(-(x-b)**2/(2*c**2)) x = np.linspace(0,10,100) y = func(x,1,5,2) yn = y + 0.2 * np.random.normal(size=len(x)) popt, pcov = curve_fit(func, x, y...
from __future__ import absolute_import from celery import group from celery.utils.log import get_task_logger from lib import ConfigManager, get_storage_helper from lib.inspection import HttpScreenshotter from lib.sqlalchemy import get_endpoint_information_for_web_service from ......app import websight_app from .....bas...
import random general_skills = ( 'Astrogation (Int)', 'Athletics (Br)', 'Charm (Pr)', 'Coercion (Will)', 'Computers (Int)', 'Cool (Pr)', 'Coordination (Ag)', 'Deception (Cun)', ...
import unittest from ofxstatement.plugins.utils import \ clean_multiple_whitespaces, fix_amount_string class TestCleanMultipleWhiteSpaces(unittest.TestCase): """Unit tests for clean_multiple_whitespaces helper.""" expected = "This is a test" def test_just_spaces(self): self.assertEqual( ...
from sqlalchemy import ( event, Column, Integer, String, DateTime, UnicodeText, Enum, Text ) from datetime import datetime, timedelta from shortid import ShortId from werkzeug.security import generate_password_hash from kodiak.database import Base class Timestamp(object): created = Column(DateTime, default=date...
import shutil import struct from datetime import datetime import os import re import binascii from zipfile import ZipFile, ZipInfo import time from sparchive import mkstemppath class Archive(object): def __init__(self, archive_path, compress_module): self.archive_path = archive_path self.compress_mo...
"""Endpoints for the UpSkilling tool. See http://go/jobflix:reco-design """ import random import string import typing from typing import Any, Dict, List, Optional, Sequence, Set import flask from bob_emploi.frontend.api import job_pb2 from bob_emploi.frontend.api import upskilling_pb2 from bob_emploi.frontend.api impor...
from functools import wraps from flask import request, redirect, url_for, session, flash def login_required(f): @wraps(f) def decorated_function(*args, **kwargs): if not 'username' in session : return redirect(url_for('login', next=request.url)) return f(*args, **kwargs) return d...
from __future__ import division import numpy as np import matplotlib.pyplot as plt import sys sys.path.append("../../../") from Util import DilutionUtil from PCR.Optimization.PCR_Opt_Analysis import PCR_Analyze_Objects class Gradient: MACHINE_TOUCHGENE = 0 MACHINE_BIORAD = 1 def __init__(self,Temperatures,C...
from gi.repository import Gtk from debugger.debugger_api import StartupInfo from gui.dialog import FileOpenDialog from gui.gui_util import require_gui_thread class EnvVarWidget(Gtk.Box): def __init__(self, *args, **kwargs): Gtk.Box.__init__(self, *args, **kwargs) self.set_orientation(Gtk.Orientation...
""" Turtle graphics is a popular way for introducing programming to kids. It was part of the original Logo programming language developed by Wally Feurzig and Seymour Papert in 1966. Imagine a robotic turtle starting at (0, 0) in the x-y plane. After an ``import turtle``, give it the command turtle.forward(15), and it ...
from collections import Iterable from . import ResourcesQueryBuilder from ...models.resource import Resource from ...models.employee import Employee from ...models.position import Position from ...models.appointment import Appointment from ..bl.structures import query_recursive_tree class AppointmentsQueryBuilder(Resou...
from datetime import datetime from richenum import OrderedRichEnum, OrderedRichEnumValue from ..common.rainbow import rainbow from ..common.settings import CONFIG class LoggingLevel(OrderedRichEnum): DEBUG = OrderedRichEnumValue(index=1, canonical_name='DEBUG', display_name='DEBUG') INFO = OrderedRichEnumValue(...
from __future__ import absolute_import, division, print_function __metaclass__ = type ANSIBLE_METADATA = { 'metadata_version': '1.1', 'status': ['preview'], 'supported_by': 'community' } DOCUMENTATION = ''' --- module: vmware_guest_boot_facts short_description: Gather facts about boot options for the given ...
""" Django settings for djangoStarter project. Generated by 'django-admin startproject' using Django 1.10.2. For more information on this file, see https://docs.djangoproject.com/en/1.10/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.10/ref/settings/ """ import ...
from django.db import models from django.contrib.auth.models import User from django.utils.translation import ugettext_lazy as _ from oioioi.base.utils.deps import check_django_app_dependencies from oioioi.base.utils import generate_key from oioioi.contests.models import Contest check_django_app_dependencies(__name__, ...
import logging import sys from snapcraft.internal.indicators import is_dumb_terminal class _StdoutFilter(logging.Filter): def filter(self, record): return record.levelno <= logging.INFO class _StderrFilter(logging.Filter): def filter(self, record): return record.levelno >= logging.WARNING class ...
""" DB is a base class for multiple DIRAC databases that are based on MySQL. It uniforms the way the database objects are constructed """ __RCSID__ = "$Id$" from DIRAC import gLogger, gConfig from DIRAC.Core.Utilities.MySQL import MySQL from DIRAC.Configuration...
class FB_Prod2Prog: __Prod2Prog_ID = "" #PROD2PROG_ID __Product_ID = "" #PRODUCT_ID __Program_ID = "" #PROGRAM_ID __Prod2Prog_Status_Code = "" #PROD2PROG_STATUS_CODE __Reg_Number = "" #REGISTRATION_NUMBER __Reg_Year = "" #REGISTRATION_...
import re import etl_plugin_core from numerizer import numerize class enhance_extract_money(etl_plugin_core.Plugin): # todo: all other currency signs from Wikidata currency_signs = ['$', '€'] def process(self, parameters=None, data=None): if parameters is None: parameters = {} if...
""" Created on Fri Mar 16 20:30:04 2018 @author: chrisstrods """ import pandas as pd from os.path import dirname, abspath try: import shared_functions as f except ModuleNotFoundError: from etl import shared_functions as f def main(): #load files d = dirname(dirname(abspath(__file__))) summaries = pd...
import os import json import Orange external_datasets = [ ("iris_url", "https://raw.githubusercontent.com/biolab/orange3/master/Orange/datasets/iris.tab"), ] def data_info(name, location): print(location) Orange.data.Variable._clear_all_caches() data = Orange.data.Table(location) attr = data.domain....
import sys, os, argparse from random import randint sys.path.append(sys.path.append(os.path.dirname(os.path.realpath(__file__)) + "/corelib/")) import core def optParse(errorflag): parser = argparse.ArgumentParser(description="Runs RAxML on a single .fa file or a directory full of .fa files. Dependencies: core, RAxML"...
def getReddeningLaw(law='fitzpatrick99',Rv=3.1,inv=False): import numpy as np from scipy import interpolate import extinction # Wavelength ranges (lambda_min - lambda_max) of the various reddening laws # (in Angstroms)... lambda_min = {'ccm89': 1250., 'odonnell94': ...
from distutils.core import setup from distutils.extension import Extension from Cython.Distutils import build_ext setup( cmdclass = {'build_ext': build_ext}, ext_modules = [ Extension('message_passing.message', language='c++', sources=['message_passing/message.pyx'], ...
from ert.cwrap import BaseCClass, CWrapper from ert.enkf import ENKF_LIB, NodeId class BlockObservation(BaseCClass): def __init__(self): raise NotImplementedError("Class can not be instantiated directly!") def getCoordinate(self, index): """ @rtype: tuple of (int, int, int) """ i = Block...
from django.shortcuts import render_to_response from django.views.generic.create_update import * from django.views.generic.list_detail import * from django.http import HttpResponseRedirect from django.contrib.auth.forms import UserCreationForm from django.forms.models import ModelFormMetaclass
from bricolage.experiment import Experiment, Treatment from pathlib import Path from bricolage.threshold3 import Parameters, Population, DefaultTarget def target1(a, b): if a and b: return 1.0 return 0.0 class MyTreatment(Treatment): def run_replicate(self, replicate, lineage): if len(lineag...
import libpylshbox import numpy as np import time print 'prepare test data' float_mat = np.random.randn(100000, 192) float_query = float_mat[0] print '' print 'Test itqLsh' print '' print 'First time, need to constructing index.' # About 7s. start = time.time() itq_mat = libpylshbox.itqlsh() itq_mat.init_mat(float_mat...
import pytest from django.core import mail from apps.public.book.models import Book from apps.public.book.test.factories import BookFactory @pytest.mark.django_db class TestBookQueryset: def test_published_sub_book_is_published_if_parent_is_published(self): book = BookFactory(is_published=True) sub_...
import datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): def forwards(self, orm): # Adding field 'Activity.summary' db.add_column(u'activity', 'summary', self.gf('django.db.models.fields.TextField')(default=''), keep_...
from odoo import api, fields, models import logging _logger = logging.getLogger(__name__) class View(models.Model): """ Add a new selection "Mako" in view types """ _inherit = "ir.ui.view" type = fields.Selection(selection_add=[('mako','Mako')])