code
stringlengths
1
199k
from __future__ import print_function from yambopy import * lower_vb = 1 upper_vb = 232 final_vb = 161 lower_cb = upper_vb + 1 upper_cb = 1000 final_cb = 256 jobname='ssGW_kdep' yambo_exe = '/home/pr1eeh00/pr1eeh01/program/yambo-4.2.0/bin/yambo' ypp_exe = '/home/pr1eeh00/pr1eeh01/program/yambo-4.2.0/bin/ypp' yambo = Ya...
import unittest from fluggo.media import timecode class test_format(unittest.TestCase): def test_Frames(self): t = timecode.Frames() self.assertEqual(t.format(3), '3') self.assertEqual(t.format(-200), '-200') def test_TimeAndFrames30(self): t = timecode.TimeAndFrames(30) ...
''' (c) Copyright 2017 Hewlett Packard Enterprise Development LP Created on Jan 17, 2017 version 0.1 @author: senthilt ''' import sys import subprocess import json class MXService(object): ''' This module starts a MXOAS Service. ''' def __init__(self,params): ''' Constructor ''' ...
import os, sys import re import time import csv import json import requests def cvtrow(row, index): empty= True for k in row: if row[k]!='': empty= False if empty: return #~ for cat in [ #~ count= aggregatefoo(query, row['Station'], index, row['Adresse'], cat['name'], 55) #~ if c...
import unittest from owlapy.model import OWLIndividual from owlapy.model import OWLObjectVisitor from owlapy.model import OWLRuntimeException class TestOWLIndividual(unittest.TestCase): def test___eq__(self): """OWL individual vs. OWL individual --> equal in all other cases, e.g. OWL individual vs. ...
from datetime import datetime import calendar import time import yaml import argparse import os import sys import requests import logging from subprocess import call from subprocess import check_call from hardware_services.inventory_service import InventoryService class QuadsNativeInventoryDriver(InventoryService): ...
import os import sys import re def readPackageList (dir): pkgmap = {} # Form the regex to find matching lines regfind = re.compile (r'.*{CMAKE_SOURCE_DIR}.*') # Form the regexes to extract package name and path. # A package line looks like: # set(MACIO_SOURCE_DIR ${CMAKE_SOURCE_DIR}/MAC/MACIO)...
import time import json import random import signal import os import os.path import argparse import MPVVJState import JSONSocket import MPV TPS = 20 DEFAULT_MPV = "/usr/bin/mpv" DEFAULT_SOCKET = "/tmp/mpvsocket" DEFAULT_PORT = 12345 DEFAULT_BIND_ADDRESS = "127.0.0.1" def hupHandler(signum, frame): print("SIGHUP rec...
from __future__ import print_function import IMP.multifit from IMP import OptionParser __doc__ = "Generate indexes of fitting solutions." def parse_args(): usage = """%prog [options] <assembly name> <assembly input> <number of fits> <indexes filename> Generate indexes of fitting solutions. """ parser = OptionPa...
from __future__ import print_function import logging import itrade_config from itrade_logging import setLevel from itrade_quotes import quotes, Quote from itrade_local import message, getGroupChar, getDecimalChar if not itrade_config.nowxversion: import itrade_wxversion import wx from wx.lib import masked from itra...
import sys import re state = 0 device = "" register_low = 0 register_high = 0 register_list = [] line_no = 1 def err(msg): print str(line_no) + ": " + msg class bit (dict): def __init__ (self, name, index): self['name'] = name self['index'] = index def debug(self): print " bit %s ind...
from .SQL import SQL
import simplegui import math width = 450 height = 300 ball_list = [] ball_radius = 15 ball_color = "Red" def distance(p, q): return math.sqrt((p[0] - q[0]) ** 2 + (p[1] - q[1]) ** 2) def click(pos): ball_list.append(pos) def draw(canvas): for ball_pos in ball_list: canvas.draw_circle(ball_pos, ball_...
from django.conf import settings from django.contrib.auth.backends import ModelBackend from django.core.exceptions import ImproperlyConfigured from django.db.models import get_model class CustomerModelBackend(ModelBackend): def authenticate(self, username=None, password=None): try: user = self.user_class.objects....
from dataclasses import dataclass @dataclass(frozen=True) class Result: title: str size: int url: str provider: str kind: str matches: bool
from src.net import Net from src.utils.misc import uniform, xavier import numpy as np def _fc_with_wb(net, x, w, b, activate): linear = net.plus_b(net.matmul(x, w), b) return activate(linear) def _fc(net, x, inp_dim, out_dim, activate): w = net.variable(xavier((inp_dim, out_dim))) b = net.variable(np.on...
import MySQLdb import sys import getopt import prettytable as pt import os import fnmatch import numpy as np import XALTQuery as xq import ReportUtil as ru from code_def import CodeDef def main(argv): #======================================================= # Configuration #=================================...
from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('productor', '0011_producto_unidadmedida'), ] operations = [ migrations.AlterField( model_name='producto', name='unidadMedida', ...
''' ''' from zope.interface import implements from Interfaces.ProteinInformation import IProteinInformation import ProteinInformation from datetime import datetime class DomainArchitecture(object): ''' A domain architecture consists of a set of (possibly overlapping) sequence regions, and identifiers into s...
from glob import glob import os import time import db2video PATH = "/data/ethoscope_results" files = [y for x in os.walk(PATH) for y in glob(os.path.join(x[0], '*.db'))] def touch(fname, times=None): with open(fname, 'a'): os.utime(fname, times) for f in sorted(files): ts_file = os.path.join(os.path.dir...
""" Tests for `indico.core.index` module """ import zope.interface from indico.core.index.base import IIIndex, IOIndex, IUniqueIdProvider, \ ElementNotFoundException, ElementAlreadyInIndexException from indico.tests.python.unit.util import IndicoTestCase class TestIIIndex(IndicoTestCase): def setUp(self): ...
from gettext import gettext as _ from gettext import ngettext import logging import os from gi.repository import GObject from gi.repository import GLib from gi.repository import Gtk from gi.repository import Gdk from gi.repository import Gio from gi.repository import SugarExt from sugar3.graphics import style from suga...
from res.job_queue import JobStatusType, Driver, QueueDriverEnum, JobQueue, JobQueueNode from tests import ResTest from tests.utils import wait_until from ecl.util.test import TestAreaContext import os, stat, time from threading import BoundedSemaphore def dummy_ok_callback(args): print(args) def dummy_exit_callbac...
from typing import Any, DefaultDict, Dict, List, Optional, Set, Tuple, Union from collections import namedtuple, defaultdict from itertools import chain, islice from functools import partial from networkx import Graph, single_source_shortest_path from django.db import connection from django.http import HttpRequest, Htt...
""" MultiQC module to parse output from Slamdunk """ from __future__ import print_function import logging import re from collections import OrderedDict from multiqc import config from multiqc.modules.base_module import BaseMultiqcModule from multiqc.plots import table, bargraph, linegraph, scatter log = logging.getLogg...
ANSIBLE_METADATA = {'metadata_version': '1.0', 'status': ['preview'], 'supported_by': 'core'} DOCUMENTATION = """ --- module: junos_config version_added: "2.1" author: "Peter Sprygada (@privateip)" short_description: Manage configuration on devices running Juniper JUNOS descripti...
import unittest from cStringIO import StringIO from tempfile import NamedTemporaryFile import os.path from subprocess import check_output from Bio.Seq import Seq from Bio.SeqRecord import SeqRecord from crumbs.utils.bin_utils import BIN_DIR from crumbs.seq.seq import assing_kind_to_seqs, get_str_seq from crumbs.seq.uti...
"""Shortcut management""" from __future__ import print_function import os import os.path as osp import sys from qtpy.QtWidgets import (QButtonGroup, QGroupBox, QInputDialog, QLabel, QLineEdit, QMessageBox, QPushButton, QVBoxLayout) from spyder.config.base import _ from spyder.plugins.configd...
from enum import Enum class TypePawn(Enum): dame = 1 roi = 2 pion = 3 cavalier = 4 tour = 5 fou = 6 class TypeColor(Enum): noir = 1 blanc = 2 class TypeLife(Enum): vivant = 1 mort = 2 class Pawn(object): def __init__(self, nom, couleur): self.nom = nom self.co...
from module.common.json_layer import json_loads as loads from module.plugins.internal.SimpleHoster import SimpleHoster class RapideoPl(SimpleHoster): __name__ = "RapideoPl" __version__ = "0.01" __type__ = "hoster" __description__ = "Rapideo.pl hoster plugin" __license__ = "GPLv3" __authors__ = [...
import graphene from graphene_django.types import DjangoObjectType from hav.apps.webassets.schema import WebAssetType from django.urls import reverse from .models import ArchiveFile class ArchiveFileType(DjangoObjectType): mime_type = graphene.String() webassets = graphene.List(lambda: WebAssetType) downloa...
from setuptools import setup import os setup( name='SprinklerSwitch', version='0.1', description='Use a Raspberry Pi to switch on/off a home irrigation system based on public weather data.', author='DeckerEgo', author_email='deckerego@gmail.com', url='https://github.com/deckerego/SprinklerSwitch...
from pathlib import Path from urllib.parse import urljoin import requests class APIPath(object): """Represents an API URL that is mirrored on the filesystem.""" def __init__(self, base_path, base_url, segments=None): self.base_path = base_path self.base_url = base_url self.segments = seg...
import requests from . import errors SEARCH_URL = "http://pypi.python.org/pypi/{name}/json" SEARCH_HEADERS = {"Content-Type": "application/json"} def search_by_name(package_name): """Search Python package on PyPI by package name only. Parameters ---------- package_name : str Returns ------- ...
import sys, os cwd = os.getcwd() parent = os.path.dirname(cwd) sys.path.insert(0, parent) import qcic extensions = ['sphinx.ext.autodoc', 'sphinx.ext.viewcode', 'sphinxcontrib.aafig'] templates_path = ['_templates'] source_suffix = '.rst' master_doc = 'index' project = u'qcic' copyright = u'2016, Jonathan Adrian Treloa...
from marionette import MarionetteTestCase class TestPageSource(MarionetteTestCase): def testShouldReturnTheSourceOfAPage(self): test_html = self.marionette.absolute_url("testPageSource.html") self.marionette.navigate(test_html) source = self.marionette.page_source self.assertTrue("<h...
from tabletop import * @Session.model_mixin class SessionMixin: def entrants(self): return (self.query(TabletopEntrant) .options(joinedload(TabletopEntrant.reminder), joinedload(TabletopEntrant.attendee), subqueryload(TabletopEntran...
from datetime import timedelta from wtforms import Form from wtforms.csrf.session import SessionCSRF class CsrfForm(Form): class Meta: csrf = True csrf_class = SessionCSRF csrf_time_limit = timedelta(minutes=10)
import os import sys import netsvc import logging from openerp.osv import osv, orm, fields from datetime import datetime, timedelta from openerp.tools import DEFAULT_SERVER_DATE_FORMAT, \ DEFAULT_SERVER_DATETIME_FORMAT, DATETIME_FORMATS_MAP, float_compare import openerp.addons.decimal_precision as dp from openerp.t...
from __future__ import unicode_literals from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('ifbAMPdatabase', '0005_auto_20161104_1809'), ] operations = [ migrations.DeleteModel( name='peptide', ), ]
from ogn.parser.pattern import PATTERN_SPOT_POSITION_COMMENT from .base import BaseParser class SpotParser(BaseParser): def __init__(self): self.beacon_type = 'spot' self.position_pattern = PATTERN_SPOT_POSITION_COMMENT def parse_position(self, aprs_comment): match = self.position_patter...
import os import sys import openerp.netsvc as netsvc import logging import xmlrpclib from openerp.osv import osv, fields from datetime import datetime, timedelta from openerp.tools import DEFAULT_SERVER_DATE_FORMAT, DEFAULT_SERVER_DATETIME_FORMAT, DATETIME_FORMATS_MAP, float_compare import openerp.addons.decimal_precis...
import os.path import numbers import operator import numpy from openquake.baselib.general import groupby, split_in_blocks, humansize from openquake.baselib.performance import PerformanceMonitor from openquake.commonlib import parallel from openquake.commonlib.oqvalidation import OqParam from openquake.commonlib.datasto...
from registration.backends.default import DefaultBackend from codewiki.models import Scraper, UserCodeRole import datetime standardemailercode = """ import scraperwiki emaillibrary = scraperwiki.utils.swimport("general-emails-on-scrapers") subjectline, headerlines, bodylines, footerlines = emaillibrary.EmailMessagePart...
from odoo import fields, models class StaMandate(models.Model): _inherit = "sta.mandate" candidature_id = fields.Many2one( comodel_name="sta.candidature", string="Candidature" )
import os def backup(): # Copia de seguridad de la base de datos ruta = os.path.join (request.folder, "private" , "backup.csv") arch = open (ruta, "wb") db.export_to_csv_file (arch) arch.close() response.view = "generic.html" return 'Backup Realizado' def restauracion(): # Restaura la bas...
from __future__ import unicode_literals from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('papers', '0027_alter_paperworld'), ('papers', '0033_remove_oairecord_abstract'), ] operations = [ ]
from fnpdjango.deploy import * env.project_name = 'infoscreen' env.hosts = ['giewont.icm.edu.pl'] env.user = 'infoscreen' env.app_path = '/srv/infoscreen' env.services = [ DebianGunicorn('infoscreen'), ]
from . import account_invoice
from openerp.osv import orm, fields from tools.translate import _ from openerp import SUPERUSER_ID import logging _logger = logging.getLogger(__name__) _logger.setLevel(logging.DEBUG) class sale_order(orm.Model): _inherit = 'sale.order' def _read_project(self, cr, uid, ids, field_name, args, context): r...
{ 'name': 'CRM Deadline Notifications', 'version': '1.1', 'category': 'Customer Relationship Management', 'author': 'IT Libertas', 'website': 'http://itlibertas.net/', 'depends': ['crm'], 'data': [ 'views/crm_view.xml', 'data/notification_lead_data.xml' ],...
from flask import Flask, request, g, render_template, make_response from flask.json import jsonify import math, json, sys, socket, struct import bitmap def aton(h): return struct.unpack('>I', socket.inet_aton(h))[0] def ntoa(i): return socket.inet_ntoa(struct.pack('>I', i)) ALLOWED_SUBNET = aton('0.0.0.0') ALLOWED_MA...
from osv import fields, orm from tools.translate import _ class crm_lead(orm.Model): """ CRM Lead Case """ _inherit = "crm.lead" _rec_name = 'nao_name' _columns = { 'nao_name': fields.char( 'NAO Reference', size=64, required=False, readonly=True, states={'draft': [('reado...
from odoo import fields, models, tools class SaleLastSaleReport(models.Model): _name = 'sale.last.sale.report' _description = 'Last Sale Statistics' _auto = False _order = 'id' partner_id = fields.Many2one('res.partner', 'Partner', readonly=True) product_id = fields.Many2one('product.product', '...
""" Implements the 'PhoneBook' filesystem - a filesystem which rips off the 'deniable encryption' ideas of the rubberhose.org project """ import sys, os, time, struct, StringIO, socket from UserString import MutableString import array import traceback import thread, threading from errno import * from stat import * from...
import random try: import json except ImportError: import simplejson as json from django.contrib.auth.models import User from django.db import transaction, IntegrityError from django.test import TestCase from django_test_utils.model_utils import TestUser from django_test_utils.random_generators import random_ui...
from . import mrp from . import mrp_bom from . import sale_order
""" The ``Paste Class`` =================== Use it to create an object from an existing paste or other random file. Conditions to fulfill to be able to use this class correctly: ------------------------------------------------------------- 1/ The paste need to be saved on disk somewhere (have an accessible path) 2/ The...
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 'Round2ApplicantConfirmation' db.create_table('confirmation_round2applicantconfirmation', ( ('id', self.gf('...
from datetime import datetime from django.core.urlresolvers import reverse from django.http import HttpResponseRedirect, HttpResponseBadRequest, HttpResponseNotAllowed from django.utils.decorators import method_decorator from django.views.generic import View, DetailView, ListView, FormView from django.shortcuts import ...
import time def convert_gmtime(date): """ Convert UTC timezone :param date: str date :return: time """ return time.strftime("%Y-%m-%d %H:%M:%S", time.gmtime(time.mktime(time.strptime(date, "%Y-%m-%d %H:%M:%S"))))
"""Script for fetching dyntaxa data from SLU """ import sys, getopt import os.path from suds.client import Client from suds import WebFault from ConfigParser import SafeConfigParser __author__ = "Markus Skyttner" __license__ = "AGPLv3" CFG = "dyntaxa-credentials.cfg" IDS="0" manual = "dyntaxa.py --cfg <default:" + CFG ...
""" Tests for the custom REST framework renderers. """ from mock import MagicMock, PropertyMock from django.test import TestCase from analytics_data_api.renderers import PaginatedCsvRenderer class PaginatedCsvRendererTests(TestCase): def setUp(self): super(PaginatedCsvRendererTests, self).setUp() se...
from odoo import fields from odoo.exceptions import UserError from odoo.tests.common import Form, TransactionCase class TestPurchaseWorkAcceptanceEvaluation(TransactionCase): def setUp(self): super().setUp() self.Config = self.env["res.config.settings"] self.WorkAcceptance = self.env["work.a...
""" sr.gui.utils.external ======================== External libraries needed for Spyder to work. Put here only untouched libraries, else put them in utils. """ import sys from ....gui.baseconfig import get_module_source_path sys.path.insert(0, get_module_source_path(__name__))
import sys, os import xml.etree.ElementTree as ET from char import Character, CharacterLibrary from module import Module, Weapon from util import XmlRetrieval, DataRetrieval class Fitting: def __init__(self, name, character, ds_name): self.name = name self.char = character self.ds_name = ds_name #self.dropsuit...
from south.utils import datetime_utils as 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 'RSSArticle.identifier' db.add_column(u'content_rssarticle', 'identifier', ...
from __future__ import print_function, absolute_import __author__ = "Gina Häußge <osd@foosel.net>" __license__ = "GNU Affero General Public License http://www.gnu.org/licenses/agpl.html" __copyright__ = "Copyright (C) 2014 Gina Häußge - Released under terms of the AGPLv3 License" import dateutil.parser, dateutil.tz imp...
from reportlab.lib.units import inch from reportlab.lib.utils import asNative from reportlab.graphics.barcode.common import MultiWidthBarcode _patterns = { '0' : ('AcAaAb', 0), '1' : ('AaAbAc', 1), '2' : ('AaAcAb', 2), '3' : ('AaAdAa', 3), '4' : ('AbAaAc', 4), '5' : ('AbAbAb', 5), '6' : ('AbAcAa', 6), '7' : ...
import logging import logging.config import ConfigParser import sys import os DEBUG = True logging.basicConfig( level = logging.DEBUG, format = '[%(asctime)s]:[%(levelname)s][%(name)s:%(lineno)d] %(message)s', filename = '/var/log/tangaza-web/tangaza.log', filemode = 'a', ) APP_CONFIG = '/etc/tangaza/se...
from __future__ import absolute_import from bs4 import BeautifulSoup from collections import OrderedDict import urllib from datetime import datetime from dateutil.tz import gettz, tzutc from dateutil.parser import parse from django import template from django.conf import settings from django.urls import reverse from dj...
from odoo import models, fields class ProductPlaneNumber(models.Model): _name = 'product.plane.number' _description = 'Plane number' name = fields.Char( string='Plane number', required=True)
""" TODO: add me """ from util.organizations_helpers import add_organization # pylint: disable=import-error def add_org_from_short_name(short_name): """ TODO: add me """ org_data = { "name": short_name, "short_name": short_name, "description": "Organization {}".format(short_name...
""" tests for overrides """ import datetime from unittest import mock import pytz from ccx_keys.locator import CCXLocator from django.test.utils import override_settings from edx_django_utils.cache import RequestCache from xmodule.modulestore.tests.django_utils import SharedModuleStoreTestCase from xmodule.modulestore....
{ 'name': 'Price Security with planned price', 'version': '13.0.1.1.0', 'category': 'Sales Management', 'author': 'ADHOC SA', 'website': 'http://www.adhoc.com.ar/', 'license': 'AGPL-3', 'depends': [ 'price_security', 'product_planned_price', ], 'data': [ 'view...
from django.contrib import admin from omerostats.registry.models import Version, Hit, Agent, AgentVersion, \ OSName, OSArch, OSVersion, JavaVendor, JavaVersion, \ PythonVersion, PythonCompiler, PythonBuild, \ IP, Continent, Country, City, Organisation, Host, Domain, Suffix admin.site.register(Version) admin...
''' Created on Mon Nov 23 2015 @author: Li Nayu ''' from __future__ import division from time import time import numpy as np def readTrainingData(): fp = open("c:/Users/Li Nayu/Desktop/Machine Learning/project/HMM-Machine_Learning/POS/train") xTrain = [] yTrain = [] y = [] # to get distinct y=>yTrain, distinct x =...
def main_redo(redo_flavour, targets): import builder, state targets = state.fix_chdir(targets) return builder.main(targets) def main_redo_log(redo_flavour, targets): import state, logger targets = state.fix_chdir(targets) return logger.main(targets, toplevel=True) def main_redo_exec(redo_flavour...
from basetest import BaseTest, StringIO import sys, tempfile, os, logging import unittest sys.path.insert(0, '..') from zeroinstall.injector import model, gpg, namespaces, reader, run, fetch from zeroinstall.injector.requirements import Requirements from zeroinstall.injector.driver import Driver from zeroinstall.suppor...
from __future__ import with_statement import os import tempfile import itertools from ConfigParser import SafeConfigParser import pkg_resources import scapi import scapi.authentication import logging import webbrowser logger = logging.getLogger(__name__) logger.setLevel(logging.DEBUG) _logger = logging.getLogger("scapi...
import os import sys from setuptools import setup, find_packages _local_dir = os.path.abspath(os.path.dirname(__file__)) def read_file(filename): abs_path = os.path.join(_local_dir, filename) with open(abs_path, mode='rt') as f: return f.read() about = {} exec(read_file(os.path.join('gnr', '__about__.py...
import fileinput import re import os import glob import xml.etree.ElementTree as ET fileDir = os.path.dirname(os.path.realpath("__file__")) relative_dir = "../../Arduino-SDI-12Doxygen/xml/" abs_file_path = os.path.join(fileDir, relative_dir) abs_file_path = os.path.abspath(os.path.realpath(abs_file_path)) all_files = [...
import __builtin__ import maps from tendrl.commons.utils.alert_utils import alert_job_status as tendrl_alert _test_curr_value = "failed" _test_message = "TEST" def test_alert_job_status_fail(): setattr(__builtin__, "NS", maps.NamedDict()) NS.publisher_id = 2 NS.tendrl_context = maps.NamedDict(integration_id...
from pysignfe.corr_unicode import * from pysignfe.xml_sped import * from pysignfe.cte.v300 import ESQUEMA_ATUAL from .modais_300 import Multimodal, Duto, Ferrov, Aquav, Aereo, Rodo import os DIRNAME = os.path.dirname(__file__) class AutXML(XMLNFe): def __init__(self): super(AutXML, self).__init__() ...
import HP_ICF_VG_RPTR OIDMAP = { '1.3.6.1.4.1.11.2.14.10.2.11': HP_ICF_VG_RPTR.hpicfVgRptrMib, '1.3.6.1.4.1.11.2.14.10.2.11.1': HP_ICF_VG_RPTR.hpicfVgRptrConformance, '1.3.6.1.4.1.11.2.14.10.2.11.1.1': HP_ICF_VG_RPTR.hpicfVgRptrCompliances, '1.3.6.1.4.1.11.2.14.10.2.11.1.2': HP_ICF_VG_RPTR.hpicfVgRptrGroups, '1.3.6.1.4...
from __future__ import print_function, division import itertools import numpy as np import os import xml.etree.ElementTree as etree from collections import namedtuple from mdtraj.core import element as elem from mdtraj.core.residue_names import (_PROTEIN_RESIDUES, _WATER_RESIDUES, ...
""" This file shows how to use pyDatalog using facts stored in python objects. It has 3 parts : 1. define python class and business rules 2. create python objects for 2 employees 3. Query the objects using the datalog engine """ from pyDatalog import pyDatalog """ 1. define python class and business rules "...
from gaphor.conftest import Case, case, test_models
from six.moves import builtins from ..types import MediaRecord from .encoding import encode_commands from .turtle import Turtle from .color import Colors _canvas_id_counter = 0 class DrawingObject: def __init__(self, canvas, id_, args): self._canvas = canvas self._id = id_ self._type = args[...
from __future__ import unicode_literals import re from guessit import base_text_type group_delimiters = ['()', '[]', '{}'] sep = r'[][,)(}{+ /\._-]' # regexp art, hehe :D _dash = '-' _psep = '[\W_]?' def build_or_pattern(patterns): """Build a or pattern string from a list of possible patterns """ or_patter...
from sardana.macroserver.macro import imacro, Type @imacro() def ask_number_of_points(self): """asks user for the number of points""" nb_points = self.input("How many points?", data_type=Type.Integer) @imacro() def ask_for_moveable(self): """asks user for a motor""" moveable = self.input("Which moveable...
import logging logger = logging.getLogger(__name__) from addons.captcha.recaptcha import PluginRecaptcha BASE_URL = "http://bitshare.com" WAITING = 60 class PluginDownload(PluginRecaptcha): def parse(self): link = self.link page = self.get_page(link) m_pattern = 'var ajaxdl[^"]+"(?P<ajaxid>[...
import argparse import collections import logging import os import re import sys sys.path.append(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(sys.argv[0]))))) from core.config import * from core.job import * from core.pipeline import * from bfx.design import * from bfx.readset import * from bfx impor...
from typing import Generator class Solution: """遍历到叶子节点,添加值到列表中,或者用生成器""" def leafSimilar(self, root1: TreeNode, root2: TreeNode) -> bool: return list(self.get_leaves(root1)) == list(self.get_leaves(root2)) def get_leaves(self, root: TreeNode) -> Generator[int, None, None]: if not root.left ...
from setup_helpers import ( description, get_version, long_description, require_python) from setuptools import setup, find_packages require_python(0x20600f0) __version__ = get_version('src/mailmanclient/constants.py') setup( name='mailmanclient', version=__version__, packages=find_packages('src'), p...
import os, sys import unittest import StringIO __data__ = [] __raw__ = ''' 6.0 8.0 5.0 0.0 0.0 5.0 ''' fIn = StringIO.StringIO(buf=__raw__) for item in fIn: item = item.strip() if (len(item) > 0): toks = item.split() if (len(toks) == 3): __data__.append(toks) else: print >>sys.stderr, 'WARNING: Can...
import socket import serial import threading import sys import struct import time import cPickle import os import subprocess import re import logging import logging.handlers import psutil import pprint from gpio.pwmpin import pwmpin from gpio.pin import pin from gpio.servo import servo from tracks import Tracks from gs...
""" fakers.py file for dummy models of our test app """ from . import models from djfaker import replacers, ModelFaker class FakerTestAFaker(ModelFaker): """ Faker for FakerTestA model """ FAKER_FOR = models.FakerTestA QS_FOR_DELETION = lambda x: models.FakerTestA.objects.filter(old=True) QS_FOR_UPDATE ...
from sys import path from os.path import abspath, expanduser, dirname _P_BASE = abspath(expanduser(dirname(__file__))) _P_ADD = [ '/../', '/../../' ] for x in _P_ADD: path.insert(0, _P_BASE + x) from comine.maps.tools import Tools, Rinf from comine.maps.span import Span from comine.maps.ring imp...
""" :class:`LLVMIRGenerator` transforms ARTIQ intermediate representation into LLVM intermediate representation. """ import os, re, types as pytypes, numpy from collections import defaultdict from pythonparser import ast, diagnostic from llvmlite_artiq import ir as ll, binding as llvm from ...language import core as la...