code
stringlengths
1
199k
from __future__ import print_function, unicode_literals import unittest from .. import _datestrings from ...lib.date import Date class DateStringsTest(unittest.TestCase): def setUp(self): from ...utils.grampslocale import GrampsLocale self.ds = _datestrings.DateStrings(GrampsLocale()) # whatever the...
""" Exports an eXe package as a SCORM package """ import logging import copy import re import time import os import imp import StringIO from cgi import escape from zipfile import ZipFile, ZIP_DEFLATED from exe.webui import common from exe.engine.path ...
import os.path, os, sys import versions def getwcdir(): if 'TBP_WC' in os.environ: return os.environ['TBP_WC'] fd = open(os.path.expanduser('~/.tla-buildpackage')) return fd.readline().strip() def pkginit(): debver = versions.getverfromchangelog() upstreamver = versions.getupstreamver(debver...
""" Functions for loading and saving data and analyses """ import json import os.path as op import warnings import numpy as np from peakdet import physio, utils EXPECTED = ['data', 'fs', 'history', 'metadata'] def load_physio(data, *, fs=None, dtype=None, history=None, allow_pickle=False): """ R...
'''Item 24 from Effective Python''' ''' you’re writing a MapReduce implementation and you want a common class to represent the input data, define such a class with a read method that must be defined by subclasses ''' class InputData(object): def read(self): raise NotImplementedError ''' a concrete subclass ...
""" This file defines the tests for ModuleBase """ import unittest from API.ModuleBase import ModuleBase from API.IModule import IModule class ModuleBaseDummy(ModuleBase): '''Test Module''' def __init__(self): '''constructor''' super(ModuleBaseDummy, self).__init__() def _birth(self, config)...
SCMA_CONFIG_DIR_ENVIRONMENT_VARIABLE="SCMA_CONFIG_DIR" SCMA_ENABLE_CGITB="SCMA_ENABLE_CGITB"
""" CRAIS - Middleware for Device Management through Selenium GRID Copyright (C): 2015 Buongiorno S.p.A. Author: Aniello Barletta <aniello.barletta@buongiorno.com> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software ...
import unittest from unittest.mock import patch from tmc import points from tmc.utils import load, get_out module_name="src.compliment" main = load(module_name, "main") @points('p01-02.1') class Compliment(unittest.TestCase): def test_first(self): with patch('builtins.input', side_effect=['France']) as prom...
import wx import wx.grid import wx.lib.scrolledpanel as scrolled import perfectmeal as perfmeal import sys # sys is only used for one try/except loop, can easily be disabled class NutrientGridDataTable(wx.grid.PyGridTableBase): ## The preferred method of using wxGrids is to have a data table that ## handles the...
from setuptools import setup, find_packages import sys import os import os.path as path os.chdir(path.realpath(path.dirname(__file__))) setup( name = 'arom_helper', version = '0.0.1', author = 'Roman Dvorak', author_email = 'romandvorak@mlab.cz', description =...
""" """ import multiprocessing def worker(d, key, value): d[key] = value if __name__ == '__main__': mgr = multiprocessing.Manager() d = mgr.dict() jobs = [ multiprocessing.Process(target=worker, args=(d, i, i*2)) for i in range(10) ] for j in jobs: j.start() for...
import os import numpy as np from nose.tools import assert_true, assert_equal, assert_not_equal from hyperspy._signals.spectrum import Spectrum from hyperspy.hspy import create_model from hyperspy.components import Gaussian class TestSetParameterInModel: def setUp(self): g1 = Gaussian() g2 = Gaussia...
import os.path as op import unittest import pysolr FIXTURE_ROOT = op.join(op.dirname(__file__), 'fixtures') class SolrqTestCase(unittest.TestCase): def setUp(self): super(SolrqTestCase, self).setUp() self.client = pysolr.Solr('http://dummy.test', timeout=10)
#Copyright © 2018 Naturalpoint import socket import struct import copy import time from MAVProxy.modules.mavproxy_optitrack import DataDescriptions from MAVProxy.modules.mavproxy_optitrack import MoCapData def trace( *args ): # uncomment the one you want to use #print( "".join(map(str,args)) ) pass def tra...
""" The Web mode for the Mu editor, using Flask. Copyright (c) 2015-2017 Nicholas H.Tollervey and others (see the AUTHORS file). 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...
from packages import generic class CrystalSMD(generic.GenericModelFilter): def __init__(self): super().__init__(CrystalSMD.PIVOT_BOUNDING_BOX_CENTER) class CrystalTH(generic.GenericModelFilter): def __init__(self): super().__init__(CrystalTH.PIVOT_BOUNDING_BOX_CENTER) types = [CrystalSMD, Crysta...
version = '0.3.4'
import cv2 import numpy as np from myutils import get_colors def get_range_hsv(bgr_color): hsv = cv2.cvtColor(np.uint8([[bgr_color]]), cv2.COLOR_BGR2HSV) hue = hsv[0][0][0] lower_color = np.array([hue - 10, 50, 50]) upper_color = np.array([hue + 10, 255, 255]) return lower_color, upper_color while 1...
import re import copy import objects import utils class Environment(objects.VarContainer): """Environment Variables Instanciate a dict() like object that stores PhpSploit environment variables. Unlike settings, env vars object works exactly the same way than its parent (MetaDict), excepting the fact...
"""Runtime exports""" from philologic.runtime.access_control import check_access, login_access from philologic.runtime.find_similar_words import find_similar_words from philologic.runtime.FragmentParser import FragmentParser from philologic.runtime.get_text import get_concordance_text, get_tei_header from philologic.ru...
import codecs import json import urllib.request from constants import constants from datetime import datetime from model.plan import PlanAdapter from model.repositories import channel_repository from utils.util import cacheResult plan_request_endpoint_template = constants["linkSky"] + "/" + constants["linkPlan"] + "/{d...
from django.db import models from datetime import datetime from django.conf import settings from django.core.mail import send_mail from django.utils.translation import ugettext_lazy as _ from core import mail import pytz import hashlib class NewsletterRecipient(models.Model): class Meta: verbose_name = _("Newsletter...
from __future__ import (unicode_literals, division, absolute_import, print_function) __license__ = 'GPL v3' __copyright__ = '2009, Kovid Goyal <kovid@kovidgoyal.net>' __docformat__ = 'restructuredtext en' import sys, os, shutil, subprocess, re, platform, signal, tempfile, hashlib, errno import...
''' Created on Jun 01, 2018 @author: bcopy ''' from drivar.Drivar import Drivar import time from browser import document as doc from browser import window from javascript import JSObject,JSConstructor class DrivarThreejs(Drivar): def __init__(self, enforceSleepingTime=True): self.THREE = window.THREE ...
""" MultiQC submodule to parse output from RSeQC read_distribution.py http://rseqc.sourceforge.net/#read-distribution-py """ from collections import OrderedDict import logging import re from multiqc.plots import bargraph log = logging.getLogger(__name__) def parse_reports(self): """Find RSeQC read_distribution repo...
from lxml.builder import ElementMaker from apps.ows.utils import Namespace, NamespaceSet from apps.gml.utils import namespace_gmlcov, namespace_gml namespace_wcs = Namespace("http://www.opengis.net/wcs/2.0", "wcs") namespace_swe = Namespace("http://www.opengis.net/swe/2.0", "swe") namespace_ows = Namespace("http://www....
""" *Some time functions to be used with logging etc* :Author: David Young """ from builtins import str import sys import os os.environ['TERM'] = 'vt100' def get_now_sql_datetime(): """ *A datetime stamp in MySQL format: 'YYYY-MM-DDTHH:MM:SS'* **Return** - ``now`` -- current time and date in MySQL f...
import urllib import urllib2 import json import chardet import base64 import comm_message_pb2 def encode(s): return ' '.join([bin(ord(c)).replace('0b', '') for c in s]) def decode(s): return ''.join([chr(i) for i in [int(b, 2) for b in s.split(' ')]]) test_data = {'open_id':'163'} test_data_urlencode = urllib.u...
class Calisan(): def __init__(self): self.kabiliyetleri = [] self.unvani = '' ahmet = Calisan() ## Calisan sınıfından ahmet adlı bir örnek çıkarıyoruz mehmet = Calisan() ## Calisan sınıfından mehmet adlı bir örnek çıkarıyoruz ahmet.kabiliyetleri.append('konuşkan') ## ahmet'in örnek niteikler...
"""Test class for Repository UI :Requirement: Repository :CaseAutomation: Automated :CaseLevel: Acceptance :CaseComponent: UI :TestType: Functional :CaseImportance: High :Upstream: No """ import time from fauxfactory import gen_string from nailgun import entities from robottelo import manifests, ssh from robottelo.api....
import os import redis ip_folder = 'S:\\DATA\\opendata\\ontology\\OpenCyc' op_folder = os.path.abspath(ip_folder + os.sep + ".." + os.sep + ".." + os.sep + "data" ) print ('ip = ', ip_folder) print ('op = ', op_folder) files = ['open-cyc.n3.csv'] files = ['open-cyc_sample.n3.csv'] lookup = ['gauge', 'mind', 'post'] de...
""" Common terminal messages used across the framework. """ import os, sys, types from config import veil from modules.common import helpers def title(): """ Print the framework title, with version. """ os.system(veil.TERMINAL_CLEAR) print '========================================================================='...
"""Service of send messages.""" import sys import json from google.appengine.ext import ndb from google.appengine.api import taskqueue reload(sys) sys.setdefaultencoding('utf8') def create_message(sender_key, current_institution_key=None, receiver_institution_key=None, sender_institution_key=None): """Create a mess...
""" PboxHttp """ import time import json import uuid import requests import imx6_ixora_led as led class PboxHttp: """Pbox http""" def __init__(self, ip='127.0.0.1', table_name='default', timeout=3): super(PboxHttp, self).__init__() self.sess = requests.session() self.table = table_name +...
msg1 = "All it takes for evil to flourish is for good men to remain silent" if not(msg1.startswith("Pickle")): print("Doesn't start with pickle") else: print("Starts with Pickle") msg2 = "filename.txt" if msg2.endswith(".txt"): print ("Text file") else: print("Not a text file") print(msg2.upper()) print(msg2....
''' Created on 21.07.2013 @author: bronikkk ''' functions = [ ] variables = [ ] modules = [ ] classes = [ ] def getAll(): return (functions, variables, modules, classes)
import os.path import tempfile from GangaCore.GPIDev.Lib.File import LocalFile import GangaCore.Utility.logging from GangaLHCb.Lib.LHCbDataset import LHCbDataset from GangaCore.Core.exceptions import ApplicationConfigurationError from GangaCore.Utility.files import expandfilename logger = GangaCore.Utility.logging.getL...
from config import Config from icgc_utils.common_queries import * from icgc_utils.processes import * def remove_duplicates(table_rows, other_args, verbose=False): table = other_args[0] db = connect_to_mysql(Config.mysql_conf_file) cursor = db.cursor() switch_to_db(cursor,"icgc") # loop over all duplicate...
import mechanize, os, json, sys import lxml.html info_db = './info.json' if os.path.exists(info_db): with open(info_db) as data_file: info = json.load(data_file) else: print "ERROR: download info.json here: https://github.com/jackyliang/Drexel-Shaft-Protection/blob/master/info.json" sys.exit(0) try:...
from django.urls import path from .views import IngredientList, IngredientCreate, IngredientUpdate, IngredientDeleteView app_name = 'ingredient' urlpatterns = [ path('', IngredientList.as_view(), name='index'), path('add/', IngredientCreate.as_view(), name='add'), path('<int:pk>/update', IngredientUpdate.as...
""" Copyright 2014 Alexey Kuzin <amkuzink@gmail.com> Copyright 2014 Yegor Mazur <yegor.mazur@gmail.com> This file is part of Melange. Melange 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...
try: import lightblue except: ightblue = None RFCOMM=11 def discover_devices(lookup_names=False): # parameter is ignored pairs = [] d = lightblue.finddevices() for p in d: h = p[0] n = p[1] pairs.append((h, n)) return pairs class BluetoothSocket: def __init__(self, p...
''' ZetCode PyQt5 tutorial In this example, we create a simple linux in PyQt5. author: bruce ''' import sys from PyQt5.QtWidgets import QApplication, QWidget if __name__ == '__main__': app = QApplication(sys.argv) w = Qwidget() w.resize(250, 150) w.move(300, 300) w.setWindowTitle('Simple') w.sho...
import cocos from cocos.scenes.transitions import * class GameOverController(cocos.layer.Layer): is_event_handler = True def __init__(self, model): super(GameOverController, self).__init__() self.model = model def on_key_press(self, symbol, modifiers): cocos.director.director.pop()
from drawman import * from time import sleep A = [(0,0), (100,0), (100,100), (0,100)] pen_down() for x, y in A: to_point(x, y) to_point(A[0][0], A[0][1]) pen_up() sleep(3)
""" WebRTC test : """ import threading import random import string import time from selenium import webdriver from pyvirtualdisplay import Display URL = "http://mute-collabedition.rhcloud.com/peer/doc/" DOCID = ''.join(random.choice(string.ascii_lowercase) for i in range(10)) CHROME_LOCATION = "/usr/bin/google-chrome" ...
import os import sys import unittest import activation import costs import data import experiment import layers import learning_rates import network import oasis import optimisation import output import sample import report class Definition( experiment.ExperimentDefinition ): @property def label_count( self ): ...
from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('citation', '0004_move_flagged_status_to_flagged_field'), ] operations = [ migrations.AddField( model_name='author', name='researc...
import pygame class Drawer(): # initialise l'image en fonction de sa taille def __init__(self, width, height): self.width = width; self.height = height; self.screen = pygame.display.set_mode( (width, height) ); self.count = 0; def setSize(self, width, height): self.__i...
import os from edc_base.logging import verbose_formatter, file_handler from edc_sync.loggers import loggers as edc_sync_loggers from edc_sync_files.loggers import loggers as edc_sync_files_loggers file_handler['filename'] = os.path.join(os.path.expanduser('~/'), 'bcpp.log') loggers = {} loggers.update(**edc_sync_logger...
""" Fetch a url from live web and apply rewriting rules """ from requests import request as live_request import mimetypes import logging import os from six.moves.urllib.parse import urlsplit import six from pywb.utils.loaders import is_http, LimitReader, LocalFileLoader, to_file_url from pywb.utils.loaders import extra...
import os, sys, os.path script_path = os.path.dirname(os.path.realpath(sys.argv[0])) version_filename = script_path + "\\version.id" version_file = open(version_filename,"r") version = version_file.read() version_file.close() print("Python DNS Server version %s" % version) version_num = float(version) update_settings_t...
import sys, pprint, logging from couchpy.client import Client from couchpy.database import Database from couchpy.doc import Query from httperror import * log = logging.getLogger( __name__ ) def test_query() : log.info( "Testing query ..." ) q = Query(params={ 'startkey' : '...
import json import logging from odoo import api, fields, models, _ from odoo.addons.base.models.res_partner import WARNING_MESSAGE, WARNING_HELP from odoo.tools.float_utils import float_round _logger = logging.getLogger(__name__) class ProductTemplate(models.Model): _inherit = 'product.template' service_type = ...
from numpy import array, ndarray, log from scipy.stats import rankdata, chi2 from typing import Union, List, Tuple def global_simes_test(x: Union[List, ndarray]) -> float: '''Global Simes test of the intersection null hypothesis. Computes the combined p value as min(np(i)/i), where p(1), ..., p(n) are the o...
import unittest from .. import morse class MorseTestCase(unittest.TestCase): def setUp(self): self.morse = morse.Morse() def test_translate_text(self): text = self.morse.translate('the quick brown fox jumps over the lazy dog') morse = '-,....,.;--.-,..-,..,-.-.,-.-;-...,.-.,---,.--,-.;.....
import serial print "Warning: does not work with NOOBS 9.1.1, works with 9.1.0" print "Warning: works with Raspberry Pi 2 only, NOT v3" port = serial.Serial("/dev/ttyAMA0", baudrate=115200, timeout=3.0) cmd = "s60\n" while True: port.write(cmd) print "I sent " + cmd rcv = port.readline() print "You sent...
from PyQt4.QtCore import * from colors import * from datamanager import DataManager (DescriptionRole, ColorRole, RateRole) = range(Qt.UserRole, Qt.UserRole + 3) class NoteItem: def __init__(self, title, description=None, color=None, rate=None): self.title = title self.description = description ...
import xml.etree.ElementTree as etree import fnmatch import shutil import os import re import datetime import time import sys from slugify import slugify import magic import zipfile import tarfile reload(sys) sys.setdefaultencoding('utf8') def locate(pattern, root=os.curdir): '''Locate all files matching supplied f...
from .ert_script import ErtScript class CancelPluginException(Exception): def __init__(self, cancel_message): super(CancelPluginException, self).__init__(cancel_message) class ErtPlugin(ErtScript): def getArguments(self, parent=None): """ @rtype: list """ return [] def getName(self):...
class Solution: """ @param: triangle: a list of lists of integers @return: An integer, minimum path sum """ def minimumTotal(self, triangle): # write your code here if not triangle or len(triangle) == 0: return 0 if len(triangle) == 1: return triangle[0][0] n = len(tr...
from __future__ import division from .core import * from .discontinuity import Discontinuity from .mugp import MuGP class JumpClassifier(object): def __init__(self, kdata, hp, window_width=100, kernel='e', use_gp=False): assert isinstance(kdata, KData) assert isinstance(use_gp, bool) assert ...
import string import gobject import gtk from gtk import gdk import pango def wm_withdraw(window): window.hide() def wm_deiconify(window): window.present() def wm_map(window, maximized=None): window.show() def makeToplevel(parent, title=None, class_=None, gtkclass=gtk.Window): window = gtkclass() if ...
import bpy from bpy.app.handlers import persistent from bpy.types import ( Object, Operator ) from bpy.props import ( EnumProperty, BoolProperty ) animated = {} @persistent def archipack_animation_onload(dummy): """ Fill in animated dict on file load """ global animated for o in bp...
''' Written by Dmitry Chirikov <dmitry@chirikov.ru> This file is part of Luna, cluster provisioning tool https://github.com/dchirikov/luna This file is part of Luna. Luna 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 Founda...
""" A simple example. Two animals are displayed, one is the 'correct' one. If the correct one is clicked, one event happens (sound playing). If the other is clicked, an alternate sound is played. The trial number and result (picked correctly true or false) is printed to the console. The main method ( present_trial...
n = 10 sum( [ k * k for k in range(0, n) ] )
"""twod TwoDNS host IP updater daemon. twod is a client for the TwoDNS dynamic DNS service. Copyright (C) 2014 Thomas Kager <tablet-mode AT monochromatic DOT cc> 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 Fo...
import rnd_gen class string_maker: def __init__(self): self.reasons = { "clover": "nutrients", "dandelion": "nutrients", "aronia": "erosion control", "apple": "protection", "cherry": "protection", "boletus": "increased nutrients", ...
import opiniongame.config as og_cfg import opiniongame.IO as og_io import opiniongame.coupling as og_coupling import opiniongame.state as og_state import opiniongame.opinions as og_opinions import opiniongame.adjacency as og_adj import opiniongame.selection as og_select import opiniongame.potentials as og_pot import op...
import unittest from owlapy.model import OWLOntologyManagerProperties class TestOWLOntologyManagerProperties(unittest.TestCase): def test___init___(self): man_props = OWLOntologyManagerProperties() self.assertTrue(man_props.load_annotation_axioms) self.assertTrue( man_props.treat...
import unittest from pyelt.mappings.transformations import FieldTransformation class TestCase_Transformations(unittest.TestCase): def test_something(self): t = FieldTransformation() t.field_name = 'id' t.new_step('lower({fld})') t.new_step("concat({fld}, '01')") t.new_step("c...
import colorsys from datetime import datetime, timedelta import enum import logging from random import random import re import sys from typing import Any, Dict, Tuple import urllib import urllib.parse import uuid from django import forms from django.conf import settings from django.contrib.auth import get_user_model fr...
import sys import os extensions = [] templates_path = ['_templates'] source_suffix = '.rst' master_doc = 'index' project = u'AssetManager' copyright = u'2016, Sam Wilson' version = '0.1' release = '0.1.0' exclude_patterns = ['_build'] pygments_style = 'sphinx' html_theme = 'default' html_static_path = ['_static'] htmlh...
FACTION = None PLAYER_NAME = None PLAYER = None BUILD_ORDER = None TICKS = 0 AUTO_BUILD = False BUILD_TICK_FUNC = None BELONGS_TO_A_TEAM = {} def LoadHumvee(actors): UTIL_LoadOnto("jeep", actors, None, None) def LoadTran(actors): UTIL_LoadOnto("tran", actors, None, None) ANYPOWER = "ANYPOWER" MCVS = ["gamcv", "...
from typing import Sequence, Union, Any from collections import OrderedDict from numpy import Inf, exp import pandas as pd from hbayesdm.base import TaskModel from hbayesdm.preprocess_funcs import ra_preprocess_func __all__ = ['ra_noLA'] class RaNola(TaskModel): def __init__(self, **kwargs): super().__init_...
import cgi from datetime import datetime from dateutil.relativedelta import relativedelta from pyramid.httpexceptions import HTTPFound from pyramid.response import Response from pyramid.view import view_config import re from ticketing.boxoffice.coding import Coding from ticketing.macros.baselayout import BaseLayout fro...
from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('documents', '0001_initial'), ] operations = [ migrations.AlterField( model_name='document', name='name', field=models...
import sys instantiatedSet = set() definitionSet = set() parentChildDict = {} definitionToFileDict = {} with open("mergeclasses.log") as txt: for line in txt: if line.startswith("instantiated:\t"): idx1 = line.find("\t") clazzName = line[idx1+1 : len(line)-1] if (clazzNam...
import sys import os sys.path.append(os.path.join(os.path.abspath('.'), 'venv/Lib/site-packages')) import logging logging.basicConfig(format='%(asctime)s - %(name)s - %(levelname)s - %(message)s', level=logging.INFO) logger = logging.getLogger(__name__) from telegram import Bot from telegram.ext imp...
import numpy as np import time,os,random
from PySide2.QtCore import * from PySide2.QtGui import * from PySide2.QtWidgets import * class TablePage(QTableWidget): style = ''' QTableWidget#DTableWidget{ border: none; color: white; background-color: transparent; selection-color: transparent; selection-background...
from __future__ import print_function import time import serial def blink_flares(): filename = 'cleaned_data.txt' flare_delays = open(filename, 'r').read().split(',') try: port = serial.Serial('/dev/cu.usbmodem1421', 9600) except IOError: raise('Please reconnect the Arduino device') ...
from __future__ import (absolute_import, division, print_function) from Muon.GUI.Common.dummy.dummy_view import DummyView from Muon.GUI.Common.dummy.dummy_presenter import DummyPresenter class DummyWidget(object): """ """ def __init__(self,name,parent=None): view=DummyView(name,parent) model...
import Queue import threading import time exitFlag = 0 queueLock = threading.Lock() class myThread (threading.Thread): def __init__(self, threadID, name, q): threading.Thread.__init__(self) self.threadID = threadID self.name = name self.q = q def run(self): print "Startin...
import os import csv from reportlab.graphics.barcode.qr import QrCodeWidget from reportlab.graphics.shapes import Drawing from reportlab.lib.pagesizes import A4, landscape, portrait from reportlab.pdfbase import pdfmetrics from reportlab.pdfbase.ttfonts import TTFont from reportlab.pdfgen import canvas from reportlab.p...
from commons import * from species import Component from snapshot import save N = 8 mass = ρ_mbar*boxsize**3/N components = Component('GADGET halo', 'matter', N=N, mass=mass) d = 0.005 components.populate(asarray([0.25 - d]*4 + [0.75 + d]*4)*boxsize, 'posx') components.populate(asarray([0.25, 0.25, 0.75, 0.75]*2 )*boxs...
import pickle import regbay_node import numpy def load_data(filename): src = open(filename, "r") X, Y = eval(src.readline()) src.close() return X, Y def main(): print "Loading data..." X, Y = load_data("training_set.py") print "len(X):", len(X), "len(X[0]):", len(X[0]), "len(Y):", len(Y) rnode = regbay_node.Reg...
from core.dao.baseDao import BaseDao from datetime import datetime from pymongo import MongoClient class ClienteDao(BaseDao): def __init__(self): super().__init__() super().set_coll(self.db.cliente) def insert(self, entity): entity["data_conversao"] = str(datetime.now().date()) e...
""" This file is part of Candela. Candela 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. Candela is distributed in the hope that it will be ...
from gi.repository import GdkPixbuf, Gtk import os import person import pickle class AddressBook: def __init__(self): self.AB_dict = {} self.AB_file = 'addressbook.pkl' # Set up Window self.window = Gtk.Window() self.window.set_title("GTK AddressBook") self.window.set...
import logging from flask import request from xivo import tenant_helpers logger = logging.getLogger(__name__) class Tenant: token_service = None user_service = None tenant_service = None def __init__(self, uuid, name=None): self.uuid = uuid self.name = name @classmethod def autod...
"""Tests for pyneric.django.db.models.fields.pguuid""" import uuid import warnings try: from django import VERSION as DJANGO_VERSION from django.db import connection from django.test import TestCase from django_test_app import models except ImportError: warnings.warn("The tests for pyneric.django.db...
'''Pychemqt, Chemical Engineering Process simulator Copyright (C) 2009-2017, Juan José Gómez Romera <jjgomera@gmail.com> This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License...
from __future__ import absolute_import from __future__ import print_function from __future__ import unicode_literals from __future__ import generators import unittest from lizard_connector.jsdatetime import * import datetime class JavascriptDatetimeConverterTestCase(unittest.TestCase): datestring_regex = r"(0[1-9]|...
""" StdoutBackend wrapper """ import logging import sys from DIRAC.Resources.LogBackends.AbstractBackend import AbstractBackend from DIRAC.FrameworkSystem.private.standardLogging.Formatter.ColoredBaseFormatter import ColoredBaseFormatter class StdoutBackend(AbstractBackend): """ StdoutBackend is used to create ...
import bottle import json import sqlite3 dbfile="risklog.db" wwwPath = "/home/graham/risk/www-yo" maxRiskId = 100 riskParameters = ['id', 'riskNo','type','status','parent','bu','epri','title','data'] bottle.debug(True) from datetime import datetime def row2dict(cursor, row): retVal = {} for (attr, val) in zip((...
'''Pychemqt, Chemical Engineering Process simulator Copyright (C) 2009-2017, Juan José Gómez Romera <jjgomera@gmail.com> This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License...
from distutils.core import setup long_description = ''' **rft1d** is a Python package for exploring and validating Random Field Theory (RFT) expectations regarding upcrossings in univariate and multivariate 1D continua. These expectations can be used to make statistical inferences regarding signals observed in experime...