content
stringlengths
5
1.05M
""" A GUI for applying a shoulder constraint. \b Requirements: AM_ShoulderConstraint.py To use this tool, first select your shoulder object, then add the constrained object (your first shoulder twist joint) to your selection and enter the desired data into the option fields before pressing either the Create or Apply ...
#! coding:utf-8 import requests import sys from bs4 import BeautifulSoup import csv import urllib import json import time,datetime import re #from adsl import Adsl import codecs reload(sys) sys.setdefaultencoding('utf8') h1 = {'Accept':'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8', ...
# Generated by Django 3.2.3 on 2021-10-29 08:09 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='AdBanner', fields=[ ...
""" hvmCodeWriter.py -- Emits assembly language code for the Hack VM translator. Skeletonized by Janet Davis March 2016 Refactored by John Stratton April 2017 Refactored by Janet Davis March 2019 """ import os from hvmCommands import * # If debug is True, # then the VM commands will be written as comments into the o...
# coding=utf-8 # Copyright 2017-2020 The THUMT Authors from __future__ import absolute_import from __future__ import division from __future__ import print_function import numbers import torch import torch.nn as nn import thumt.utils as utils from thumt.modules.module import Module class LayerNorm(Module): def...
#!/usr/bin/env python3 "classic Hello World example in Python." if __name__ == '__main__': # output of hello world print("Hello World")
from pydantic import BaseModel class User(BaseModel): id: int name: str account: str
""" soapdenovo2_pregraph_sparse.py A wrapper script for SOAPdenovo2 pregraph sparse module Copyright Peter Li - GigaScience and BGI-HK """ import optparse, os, shutil, subprocess, sys, tempfile def stop_err(msg): sys.stderr.write(msg) sys.exit() def cleanup_before_exit(tmp_dir): if tmp_dir and os.path....
from django.db import models # Create your models here. from django.db import models from django.utils import timezone from django.urls import reverse class Resource(models.Model): title = models.CharField(max_length=50) introduce = models.TextField() location = models.TextField() key = models.TextFie...
# coding=utf-8 from collections import OrderedDict expected = [ OrderedDict( [ ("type", "person"), ( "name", OrderedDict( [("preferred", u"Karsten Weis"), ("index", u"Weis, Karsten")] ), ), (...
#!/usr/bin/python3 # Create a scatter plot for visualizing all my job experences and # programming activities. # Note that Python 3 is required. # # Copyright (C) 2016-2021 Davide Madrisan <davide.madrisan.gmail.com> import matplotlib matplotlib.use('Agg') matplotlib.rc('font', family='sans-serif') matplotlib.rc('tex...
# -*- coding: utf-8 -*- # MIT License # # Copyright (c) 2020 Northwave B.V. (www.northwave-security.com) # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including with...
# Generic diagnostics methods used from by QGModel and QGNIW Kernel # These methods are adaptations from pyqg (https://doi.org/10.5281/zenodo.30517) import numpy as np def get_diagnostic(self, dname): return (self.diagnostics[dname]['value'] / self.diagnostics[dname]['count']) def _set_active_diag...
def f(): y = 'from f' class C(): y = 'from C' def g(self): nonlocal y print(y) C().g() f()
""" Given a binary tree, return the level order traversal of its nodes’ values. (ie, from left to right, level by level). Example : Given binary tree 3 / \ 9 20 / \ 15 7 return its level order traversal as: [ [3], [9,20], [15,7] ] Also think about a version of the question where you are ask...
from spylunking.log.setup_logging import test_logger from antinex_utils.consts import SUCCESS from antinex_utils.consts import ERR from antinex_utils.consts import FAILED from tests.mock_model import MockModel log = test_logger(name='mock-predictions') def build_response_data( req): """build_response_da...
bidi_dir = 'ltr' test = '测试 host'
import re import os import pymongo from flask import Flask, render_template, redirect, request, url_for,escape, session, json, flash from flask_pymongo import PyMongo from bson.objectid import ObjectId import bcrypt app = Flask(__name__) #bcrypt = Bcrypt(app) #config.py file set to ignore by gitignore. #config vars ...
from selenium.webdriver import Chrome from selenium.webdriver.common.keys import Keys from selenium import webdriver from selenium.webdriver.common.by import By from selenium.webdriver import ActionChains import time url = 'https://finance.yahoo.com/' browser = webdriver.Chrome() browser.get(url) accept_consent = b...
from django.views.generic import TemplateView from django.conf.urls import patterns, url from djgeojson.views import GeoJSONLayerView urlpatterns = patterns('', url(r'^$', TemplateView.as_view(template_name='sandbox/index.dtl'), name='home'), )
import time import os from config import CHROMEDRIVER from selenium import webdriver from selenium.webdriver.common.keys import Keys chrome = webdriver.Chrome(executable_path=CHROMEDRIVER) chrome.get("https://konflic.github.io/examples/editor/index.html") input_field = chrome.find_element(value="editor_text") inpu...
import numpy as np import os import utils import copy # for combine_trajs const_default_models = [ 'singleagent_1', 'multiagent_1', 'singleagent_2', 'multiagent_2', 'singleagent_3', 'multiagent_3' ] def create_val_dir_str(base='singleagent', basedir='../../data/experiments/'): return os.p...
#!/usr/bin/env python import unittest from flask_testing import TestCase import dress from dress.models import * from manager import seed class ModelSettingTestCase(TestCase): def create_app(self): app = dress.create_app() app.config.testing = True return app def setUp(self): ...
""" mxDateTime - Date and time handling routines and types Copyright (c) 1998-2000, Marc-Andre Lemburg; mailto:mal@lemburg.com Copyright (c) 2000-2015, eGenix.com Software GmbH; mailto:info@egenix.com See the documentation for further information on copyrights, or contact the author. All Rights Reserve...
from CommonServerPython import * import demistomock as demisto from distutils.util import strtobool def get_value_to_set(args): value = args.get('value') apply_if_empty = strtobool(args.get('applyIfEmpty', 'false')) if value is None or (apply_if_empty and is_value_empty(value)): value = args.get(...
from flask_restx import Resource from flask import request class ServicesFactory: def __init__(self): pass @staticmethod def create_service(input_model, output_model, route, ns, on_call): input_de...
from abc import ABC, abstractmethod from typing import Iterable, Mapping, Generator, Generic, TypeVar, List, Any import utils from model.neural_network.neural_network import NeuralNetwork from model.simulation import SimState, Simulation, FIXED_DELTA_TIME, CarState from model.track.track import Track T_CONTEXT = Type...
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import unicode_literals import codecs import os from setuptools import find_packages, setup def read(file_name): file_path = os.path.join(os.path.dirname(__file__), file_name) return codecs.open(file_path, encoding='utf-8').read() PACKAGE = "ad...
# Study of Fibonacci sequence and relationship to prime numbers # Test edit from Linux (WSL) # https://math.stackexchange.com/questions/913287/relationship-between-primes-and-fibonacci-sequence # https://en.wikipedia.org/wiki/Fibonacci_prime # https://en.wikipedia.org/wiki/Lucas_number#:~:text=The%20Lucas%20numbers%20...
import os import wget import tarfile import argparse import subprocess from utils import create_manifest import shutil LIBRI_SPEECH_URLS = { "train": ["http://www.openslr.org/resources/12/train-clean-100.tar.gz", "http://www.openslr.org/resources/12/train-clean-360.tar.gz", "http://www....
from __future__ import absolute_import from rouge.rouge import FilesRouge, Rouge __version__ = "1.0.1" __all__ = ["FilesRouge", "Rouge"]
"""Working example of Soft Q-Learning.""" import numpy as np import torch.optim from rllib.agent import SoftQLearningAgent from rllib.environment import GymEnvironment from rllib.util.training.agent_training import evaluate_agent, train_agent ENVIRONMENT = ["NChain-v0", "CartPole-v0"][1] NUM_EPISODES = 50 MAX_STEPS...
# -*- coding: utf-8 -*- # try something like def removeNonAscii(s): return "".join( i for i in s if ord(i) < 128) # para remover los caracteres basuras del archivo CSV en los campos q haga falta def to_name(texto): texto = IS_SLUG()(texto)[0] texto = texto.replace("-", "_") return texto+"_" @...
from typing import Dict from eth_utils import ( decode_hex, event_abi_to_log_topic, ) from web3.utils.abi import filter_by_type from web3.utils.events import get_event_data from eth_utils import to_checksum_address from web3.utils.filters import construct_event_filter_params from raiden_contracts.contract_mana...
from thingset.cansocket import CANsocket import json, requests, time sock = CANsocket('can0') # or other interface emonstring = 'http://192.168.178.26/emoncms/input/post?node=' apikey = 'dc8ae3d6a908d75b370ae83b1733a564' dataObject = {0x00:{0x4001: 'vBat', 0x4002: 'vLoad', 0x4003: 'vCell1', 0x4004: 'vCell2', 0x4...
import json import time import re import oauth2 as oauth import os from secret import keys from flask import (Flask, jsonify, render_template) from model import (connect_to_db, db, Tweet) from sqlalchemy import desc key = keys.key() app = Flask(__name__) # key generated by OS app.secret_key = key['Flask_Key'] link...
# Copyright 2018 Shengyang Sun # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, so...
''' :copyright: Copyright 2006-2009 by Oliver Schoenborn, all rights reserved. :license: BSD, see LICENSE.txt for details. ''' import weakref from topicutils import stringize, WeakNone from validatedefnargs import verifySubset ### Exceptions raised during check() from sendMessage() class SenderMissingReqdArgs(Ru...
import requests as req from ndj_toolbox.fetch import (xml_df, save_files) url_base = 'https://www.al.sp.gov.br/repositorioDados/' url_file = 'legislacao/legislacao_subtemas.xml' url = url_base + url_file def main(): xml_data = req.get(url).content dataset = xml_df(xml_data).process_data() dataset = data...
class Solution: def numMovesStones(self, a: int, b: int, c: int) -> List[int]: x, y, z = sorted([a, b, c]) if x + 1 == y == z - 1: min_steps = 0 elif y - x > 2 and z - y > 2: min_steps = 2 else: min_steps = 1 max_steps = z - x - 2 ...
import os import sys def free_file(start_id, end_id): for i in range(start_id, end_id, 1): os.system('./bin/alluxio fs persist /tests/%s' % i) os.system('./bin/alluxio fs free /tests/%s' % i) if __name__ == "__main__": free_file(int(sys.argv[1]), int(sys.argv[2]))
# -*- coding: UTF-8 -*- import json import requests from bs4 import BeautifulSoup class Spyder(object): def __init__(self,times,init="TWEET--1017190186269184001"): self.URL="https://twitter.com/i/search/timeline?f=tweets&q=from:realdonaldtrump&max_position=" self.HEADER={'user-agent': 'Mozilla/5.0 ...
import os import setuptools ########## autover ########## def embed_version(basepath, ref='v0.2.2'): """ Autover is purely a build time dependency in all cases (conda and pip) except for when you use pip's remote git support [git+url] as 1) you need a dynamically changing version and 2) the environme...
# coding: utf-8 """ Copyright 2016 SmartBear Software Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applica...
from subprocess import check_output import argparse import os from multiprocessing import Pool parser = argparse.ArgumentParser() parser.add_argument("--xtc", help="trajectory xtc file",required=True) parser.add_argument("--pdb", help="reference pdb file",required=True) parser.add_argument("--nproc", help="number of c...
import numpy as np import torch # import torch # import cupy as cp # BASE = 2**16 def float_to_binary(array): sign_array = np.signbit(array) array = np.abs(array).view(np.uint32) exponent_array = (((array & 0b01111111100000000000000000000000) >> 23) - 127).astype(np.uint8) # TODO: interpret as uint or int...
from app import app from flask import request, render_template, redirect, url_for, flash, abort from flask.ext.login import login_required, current_user, login_user, logout_user from models import * from forms import * from sqlalchemy import desc import random from utility import bbparser @app.errorhandler(404) def p...
from django.conf.urls import url from . import views urlpatterns = [ url( regex=r'^explore/$', view=views.ExploreUsers.as_view(), name='explore_users' ), url( regex=r'^(?P<user_id>[0-9]+)/follow/$', view=views.FollowUser.as_view(), name='follow_user' ), ...
shopping_list = ["milk","pasta","eggs","spam","bread","rice"] # code 1 # for item in shopping_list: # if item != "spam": # print("Buy " + item) # code 2 # for item in shopping_list: # if item == "spam": # # continue causes everything else in the loop to be ignored # # you ll never have to ...
# -*- coding: utf-8 -*- """ Microsoft-Windows-Winsock-WS2HELP GUID : d5c25f9a-4d47-493e-9184-40dd397a004d """ from construct import Int8sl, Int8ul, Int16ul, Int16sl, Int32sl, Int32ul, Int64sl, Int64ul, Bytes, Double, Float32l, Struct from etl.utils import WString, CString, SystemTime, Guid from etl.dtyp import Sid from...
''' books.py Zack Johnson and Alia Babinet, September 30, 2021 Revised by Zack Johnson and Alia Babinet, October 11, 2021 Searches the books data set using BooksDataSource. For use in the "books" assignment at the beginning of Carleton's CS 257 Software Design class, Fall 2021. ''' import books...
from image_pylib import IMGLIB import os import shutil if __name__ == '__main__': imglib = IMGLIB() imageDir = 'image/' anoDir = 'ano/' saveImgDir = 'saveDir/' thr = 0.99 imageNames = [] if os.path.isdir(saveImgDir): shutil.rmtree(saveImgDir) os.mkdir(saveI...
# Nama : Aditya Alif Nugraha # NIM : 1301154183 # Kelas : IF-39-01 import numpy as np import matplotlib.pyplot as plt def load_environment(filename): """Meload file environment.""" env = [] with open(filename) as f: for line in f: env.append(line.split()) return np.array(env, d...
import unittest from ng_lgas import NG_LGA ng_lgas = NG_LGA() class NGLGASTestCase(unittest.TestCase): def test_get_state_codes_is_not_empty(self): self.assertFalse(len(ng_lgas.get_state_codes()) == 0) def test_get_states_is_not_empty(self): self.assertFalse(len(ng_lgas.get_states()) == 0) ...
# Modified based on the HRNet repo. from __future__ import absolute_import from __future__ import division from __future__ import print_function import time import logging import torch from core.cls_evaluate import accuracy logger = logging.getLogger(__name__) def train(config, train_loader, model, criterion, o...
from __future__ import unicode_literals from django.conf.urls import url from .api_views import APIResourceTypeListView from .views import APIBase, BrowseableObtainAuthToken urlpatterns = [] api_urls = [ url(r'^$', APIBase.as_view(), name='api_root'), url( r'^resources/$', APIResourceTypeListView.a...
""" module to compute saliency map for fully conected layers """ import numpy as np import chainer import pandas as pd from chainer import cuda, Function, gradient_check, report, training, utils, Variable from chainer import datasets, iterators, optimizers, serializers from chainer import Link, Chain, Chain...
def in_array(arr1, arr2): r = [] for i in arr1: found = False for j in range(len(arr2)): for y in range(len(arr2[j])): if arr2[j][y] == i[0]: if arr2[j][y:len(i)] == i: ...
# Generated by Django 2.2.5 on 2019-11-09 19:08 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('fichas', '0013_auto_20191109_1559'), ] operations = [ migrations.RemoveField( model_name='detalle', name='descripcio...
''' This module is responsible for the mcmc ''' import arginfer.treeSequence as treeSequence import copy from tqdm import tqdm import sys import os import shutil from arginfer.initialARG import * from arginfer.plots import * # for recursion issue # print("current recursion limit is ", sys.getrecursionlimit()) sys.setre...
import fiepipedesktoplib.container.shells.manager import fiepipedesktoplib.sites.shells.abstractsite import fiepipelib.fiepipeserver.client import fiepipelib.sites.data.localsite import fiepipelib.container import fiepipelib.legalentity.registry.data.registered_entity import sys import fiepipedesktoplib.applauncher.gen...
from django.contrib.auth import views as original_auth_views from django.urls import re_path from django.conf import settings from rest_framework.urlpatterns import format_suffix_patterns from custom_auth import views as custom_auth_views urlpatterns = [ # endpoints related to querying User info: re_path(r'...
# -*- coding: utf-8 -*- import logging import os import alembic.config import alembic.command import click import sqlalchemy from h import db from h import search log = logging.getLogger(__name__) @click.command() @click.pass_context def init(ctx): # In production environments a short ES request timeout is ty...
# coding: utf-8 """ Stitch Connect https://www.stitchdata.com/docs/developers/stitch-connect/api # noqa: E501 The version of the OpenAPI document: 0.4.1 Generated by: https://openapi-generator.tech """ import pprint import re # noqa: F401 import six from stitch_connect_client.configuration impo...
#!/usr/bin/env python ''' popup frame for 2D XRD image control ''' import numpy as np import matplotlib.cm as colormap import wx ################################### class ImageToolboxFrame(wx.Frame): def __init__(self,imageframe,image): #,mask=False,bkgd=False): ''' Frame for visual toolbox ...
# coding=UTF-8 """ Reading and writing TSLF records. """ from __future__ import print_function, absolute_import, division import six import logging import struct from tslfformat.framing.shortcodes import ShortCodeDatabase, ShortCodeType logger = logging.getLogger(__name__) HEADER = b'TSLFFORMAT00' __all__ = ('HEAD...
""" @copyright: 2010 - 2019 by Pauli Rikula <pauli.rikula@gmail.com> @license: MIT <http://www.opensource.org/licenses/mit-license.php> """ from typing import Set, List, Callable """ These classes are used for connection operation serialization so that the connections can be manipulated before applying em. ""...
#!/usr/bin/python # -*- coding: utf-8 -*- # # CATEGORIES_DICT is a dictionary rendering of the DSL research categories JSON # # last updated: 2019-09-23 # # how to create: # # > search publications return category_for limit 1000 # (for each of the categories) # # Then remove '_stats' section, and combine them all int...
from rest_framework import serializers from tarefas.models import Tarefa from usuarios.models import Usuario class UsuarioSerializer(serializers.ModelSerializer): class Meta: model = Usuario fields = '__all__' class TarefaSerializer(serializers.ModelSerializer): class Meta: model = T...
import hashlib from pyramid.events import subscriber from pyramid.events import NewRequest from pyramid.exceptions import NotFound from pyramid.httpexceptions import HTTPBadRequest from pyramid.security import NO_PERMISSION_REQUIRED from pyramid.response import Response from pyramid.view import view_config from pyram...
#!/usr/bin/env python3 # SPDX-License-Identifier: MIT import sys, pathlib sys.path.append(str(pathlib.Path(__file__).resolve().parents[1])) from m1n1.setup import * from m1n1.fw.smc import SMCClient smc_addr = u.adt["arm-io/smc"].get_reg(0)[0] smc = SMCClient(u, smc_addr, None) smc.start() smc.start_ep(0x20) smc.sm...
from matplotlib import cm import matplotlib.pyplot as plt import numpy as np from mpl_toolkits.mplot3d import Axes3D unison = np.load("numpy_table_3D_union_cardinalities.txt") x,y,z = (unison>24).nonzero() #outfile = open('4_columns.csv','w') #outfile.write('coor_x,coor_y,coor_z,cases\n') fig = plt.figure() print x pr...
import RPi.GPIO as RPIO import sys, os, time import config from models import Photo flash_pin = 4 RPIO.setmode(RPIO.BCM) #set the way GPIO pins are counted RPIO.setwarnings(False) RPIO.setup(flash_pin, RPIO.OUT, initial=RPIO.HIGH) #RPIO.output(flash_pin, True) #turn off pin class CameraController(object): def pr...
class ModbusException(Exception): @staticmethod def fromExceptionCode(exception_code: int): if exception_code == 1: return IllegalFunctionError elif exception_code == 2: return IllegalDataAddressError elif exception_code == 3: return IllegalDataValueError elif exception_code == 4: ...
# Copyright 2019 Pascal Audet # # This file is part of PlateCurie. # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, cop...
from rlbot.utils.logging_utils import get_logger from framework.input_formatter.base_input_formatter import BaseInputFormatter from framework.output_formatter.base_output_formatter import BaseOutputFormatter from framework.model.base_model import BaseModel from framework.reward_manager.base_reward_manager import ...
#coding:utf-8 #0导入模块 ,生成模拟数据集 import tensorflow as tf import numpy as np import matplotlib.pyplot as plt BATCH_SIZE = 30 seed = 2 #基于seed产生随机数 rdm = np.random.RandomState(seed) #随机数返回300行2列的矩阵,表示300组坐标点(x0,x1)作为输入数据集 X = rdm.randn(300,2) #从X这个300行2列的矩阵中取出一行,判断如果两个坐标的平方和小于2,给Y赋值1,其余赋值0 #作为输入数据集的标签(正确答案) Y_ = [int(x0*x...
#Write a Python program to swap comma and dot in a string. samp_strng = "32.054,23" num = samp_strng.maketrans swapper = samp_strng.translate(num(".,", ",.")) print(swapper)
#!/usr/bin/env python # -*- coding: utf-8 -*- #!/usr/bin/env python # -*- coding: utf-8 -*- from periphery import SPI import time #if you are using RaspberryPi use from RPi import GPIO as io #if you are using OrangePi use following library #from pyA20.gpio import gpio as io #from pyA20.gpio import port #for Raspber...
def calc_mes(valor, rent): val_mes = valor * rent return val_mes def calc_ano(valor, rent): montante = valor * (1+rent)**2 return montante #dale dale !!!!!!!!!!!!
import os import sys import django proj_path='/var/www/boranga' sys.path.append(proj_path) os.environ.setdefault("DJANGO_SETTINGS_MODULE", "boranga.settings") django.setup() from boranga.components.proposals.models import Proposal p=Proposal.objects.last() print(p.__dict__)
from django.contrib import admin from .models import Location, FeaturedPeak, FeaturedRoute @admin.register(FeaturedPeak) class FeaturedPeakAdmin(admin.ModelAdmin): list_display = ['peak', 'order', 'name_override'] list_editable = ['order', 'name_override'] @admin.register(FeaturedRoute) class FeaturedRoute...
""" PDB Electron Density Analysis (pdb_eda.densityAnalysis) ------------------------------------------------------- This module provides methods for the creation of the :class:`pdb_eda.densityAnalysis` class given a PDB id, along with methods to analyze its 2Fo-Fc and Fo-Fc electron density maps. """ import copy impo...
# Algorithm 1, polynomial regression for Q_l + explicit formula + truncation import numpy as np from scipy.misc import comb from scipy.special import hermitenorm from tqdm import tqdm from joblib import Parallel, delayed from itertools import product from sklearn.preprocessing import PolynomialFeatures import math de...
import os class Config: """ General configurations parent class """ SECRET_KEY = os.environ.get('SECRET_KEY') SQLALCHEMY_DATABASE_URI = 'postgresql+psycopg2://Pasaris:maisiewilliams7@localhost/pitchez' SQLALCHEMY_TRACK_MODIFICATIONS = False UPLOADED_PHOTOS_DEST = 'app/static/photos' ...
# # This file is part of LiteX (Adapted from Migen for LiteX usage). # # This file is Copyright (c) 2013-2014 Sebastien Bourdeauducq <sb@m-labs.hk> # This file is Copyright (c) 2013-2021 Florent Kermarrec <florent@enjoy-digital.fr> # This file is Copyright (c) 2013-2017 Robert Jordens <jordens@gmail.com> # This file is...
# Copyright 2022 Overflow Digital # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or...
#Python 2.7.0 #William Skagerstrom, Teodor Karlgren from Tkinter import Tk, Text, TOP, BOTH, X, N, LEFT from Tkinter import * from ttk import Frame, Label, Entry from ttk import * from doctorForm import * from nurseForm import * from queuePicker import * #from main import * import psycopg2 class Menu(Frame): def...
import sys class Token(object): def __init__(self, line, token_type, data = False): self.line = line self.token_type = token_type if not data: self.data = token_type else: self.data = data def __repr__(self): if self.token_type in ['integer', 'identifier']: return "{}<{}>@{}"....
from typing import Any, Callable, Sequence, Union class undefined: pass CommandType = Union[str, bytes] ErrorFuncType = Callable[[Exception], Exception] TransformFuncType = Callable[[Any], Any] TransformType = Union[Sequence[TransformFuncType], TransformFuncType]
from django.db import models from django.contrib.auth.models import User from quiz.models import Category # from ckeditor.fields import models.TextField # Create your models here. class Article(models.Model): author = models.ForeignKey("auth.User",on_delete = models.CASCADE,verbose_name = "Author") title = mod...
from rubicon.domain.mixin import TagMixin class Taggable(TagMixin): def __init__(self, tags=[]): self.tags = tags def test_add_tags(): taggable = Taggable() taggable.add_tags(["x"]) assert taggable.tags == ["x"] def test_add_duplicate_tags(): taggable = Taggable(tags=["x"]) taggab...
import os basedir = os.path.abspath(os.path.dirname(__file__)) class Config: SECRET_KEY = os.environ.get('SECRECT_KEY') or 'to be fixed later' WTF_CSRF_ENABLED = False @staticmethod def init_app(app): pass class DevelopmentConfig(Config): def __init__(self): pass SERVER_NA...
#!/usr/bin/env python import os import unittest from pykronos.common.runner import KronosRunner KRONOS_DIR = os.path.join(os.pardir, 'kronos') KRONOS_CONF = os.path.join(os.pardir, 'pykronos/tests/conf/kronos_settings.py') if __name__ == '__main__': kronos_runner = KronosRunner(KRONOS_D...
from typing import Any, Dict, List, Union import pytest from us_pls._variables.fy2018 import ( outlet_data_vars, state_summary_data_vars, system_data_vars, ) from us_pls._variables.models import Variables def get_expected_keys(_variables: Union[Variables, Dict[str, Any]]) -> List[str]: expected_keys...
from collections import OrderedDict import os def ParseLogFile(path): # read the log file filename = os.path.join(path, 'log.txt') file = open(filename) allLines = file.readlines() # split into all epochs epochIdces = [] for ind, curLine in enumerate(allLines): if curLine[0:5] == ...
#-*- coding: utf-8 -*- import usaio ''' добавляет строку в фиксирванный файл ''' def printStrToFile(string, fname): filename = fname # Create a file object: # in "write" mode FILE = open(filename,"at") # Write all the lines at once: FILE.writelines(string) # Alternatively write them one by one: FILE.clos...
import pytest from sequences.longest_balanced_subsequence import * class TestLongestBalancedSubsequence: @staticmethod def _is_left(char): return char == "a" @staticmethod def _is_right(char): return char == "1" def test_given_unknown_char_then_raise_error(self): ...
## # @file extract_place.py # @author Keren Zhu, Mingjie Liu # @date May 2019 # @brief The main part of the extracting placement into image project # import parser import placement_ds as ds import geometry as geo import os import glob import numpy as np from matplotlib import cm import matplotlib.pyplot as plt fro...
from .context_block import ContextBlock __all__ = [ 'ContextBlock', ]