content
stringlengths
5
1.05M
"""scrapli.driver.core.cisco_iosxr""" from scrapli.driver.core.cisco_iosxr.driver import IOSXRDriver __all__ = ("IOSXRDriver",)
import pandas as pd import os import json from settings import * from src.utils.sampu import interp_multi, sel_pos_frame, normalize import seaborn as sns sns.set(style="darkgrid") """Given some keyframe numbers (normalized kf), encodes them and interpolates their latent datapoints. Saves the z interpolants and t...
#!/usr/bin/env python3 # # Copyright (c) 2019 Roberto Riggio # # 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 applicabl...
import pytest from aiosnow.exceptions import SchemaError from aiosnow.models import ModelSchema, Pluck, fields from aiosnow.query.fields import IntegerQueryable, StringQueryable def test_model_schema_field_registration(): class TestSchema(ModelSchema): test1 = fields.String() test2 = fields.Integ...
#!/usr/bin/env python2 # XXX: Refactor to a comand line tool and remove pylint disable """Merge columns of multiple experiments by gene id.""" from __future__ import absolute_import import argparse import csv import os import sys from itertools import chain import utils parser = argparse.ArgumentParser( descript...
from torchvision import models from PIL import Image import matplotlib.pyplot as plt import torch import numpy as np import cv2 import torchvision.transforms as T def decode_segmap(image, source, nc=21): label_colors = np.array([(0, 0, 0), # 1=aeroplane, 2=bicycle, 3=bird, 4=boat, 5=bottle ...
# -*- coding: utf-8 -*- from django.db.models.query import QuerySet class PublisherQuerySet(QuerySet): """Added publisher specific filters to queryset. """ def drafts(self): return self.filter(publisher_is_draft=True) def public(self): return self.filter(publisher_is_draft=False)
# # Copyright (c) 2019 Jonathan Weyn <jweyn@uw.edu> # # See the file LICENSE for your rights. # """ Upload settings to a theta-e website loaded dynamically from the theta-e.conf. """ import os import string template_file = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'template.txt') def main(config, s...
# Generated by Django 3.2.5 on 2021-09-01 16:27 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('api', '0008_alter_workspacerole_role'), ] operations = [ migrations.AlterModelOptions( name='upload', options={}, ),...
# Copyright 2015-2017 ARM Limited # # 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 w...
import os f = open("test.txt" "w") list1 = ["Shoes", "Socks", "Gloves"] quantity = [10, 5, 32] f.write("{:<10} {:10} {:10}\n".format("S/N", "Items", "Quantity")) for item in list1: f.write("{:<10} {:10} {:10}\n".format("S/N", "Items", "Quantity") + "\n") f.close()
import os import subprocess import sys try: import pty except ImportError: PTY = False else: PTY = True from mklibpy.common.string import AnyString from mklibpy.terminal.colored_text import get_text, remove_switch from mklibpy.util.path import CD __author__ = 'Michael' TIMEOUT = 0.5 print("""`mklsgit` ...
#coding: utf-8 ''' # * By : # * # * โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•— โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•— โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•— โ–ˆโ–ˆโ•—โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•— โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•—โ–ˆโ–ˆโ•— โ–ˆโ–ˆโ•—โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•— โ–ˆโ–ˆโ–ˆโ•— โ–ˆโ–ˆโ•—โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•—โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•— # * โ–ˆโ–ˆโ•”โ•โ•โ•โ–ˆโ–ˆโ•—โ–ˆโ–ˆโ•”โ•โ•โ–ˆโ–ˆโ•—โ–ˆโ–ˆโ•”โ•โ•โ–ˆโ–ˆโ•—โ–ˆโ–ˆโ•‘โ•šโ•โ•โ–ˆโ–ˆโ•”โ•โ•โ• โ•šโ•โ•โ–ˆโ–ˆโ•”โ•โ•โ•โ–ˆโ–ˆโ•‘ โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•”โ•โ•โ–ˆโ–ˆโ•—โ–ˆโ–ˆโ–ˆโ–ˆโ•— โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•”โ•โ•โ•โ•โ•โ–ˆโ–ˆโ•”โ•โ•โ–ˆโ–ˆโ•— # * โ–ˆโ–ˆโ•‘ โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•”โ•โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•”โ•โ–ˆโ–ˆโ•‘ โ–ˆโ–ˆโ•‘ โ–ˆโ–ˆโ•‘ โ–ˆโ–ˆโ•‘ โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•”โ•โ–ˆโ–ˆโ•”โ–ˆ...
from mySecrets import connectStr import json import pyodbc DATABASE_USERACCOUNTS = "[dbo].[UserAccounts]" DATABASE_PROBLEMS = "[dbo].[Problems]" DATABASE_SUBMISSIONS = "[dbo].[Submissions]" def executeCommandCommit(cmd: str) -> None: cnxn = pyodbc.connect(connectStr) cursor = cnxn.cursor() cursor.execute...
import csv import os import sqlite3 import pytest import shutil from tempfile import gettempdir from openpyxl import Workbook TMP_DIR = gettempdir() ws_summary_B5_rand = [ 'Cookfield, Rebuild', 'Smithson Glenn Park Editing', 'Brinkles Bypass Havensmere', 'Folicles On Fire Ltd Extradition', 'Pudd...
from . import * class TestDefaults(BrokerTestCase): def test_basic_submit(self): f = self.queue.submit_ex(name=self.id() + '.0', pattern=None) self.assertTrue(f.id) self.assertEqual(self.broker.fetch(f.id)['status'], 'pending') self.assertEqual(self.broker.fetch(f.id)['priority'],...
from django.db import models class Job(models.Model): """Class describing a computational job""" # currently, available types of job are: TYPES = ( ("fibonacci", "fibonacci"), ("power", "power") ) STATUSES = ( ("pending", "pending"), ("started", "started"), ("finished", "finished"), ...
from pathlib import Path from math import inf def get_image_layers(raw_data, width, height): digits = map(int, raw_data.strip()) layers = list() curr_layer = list() layer_size = width * height for digit in digits: curr_layer.append(digit) if len(curr_layer) == layer_size: ...
import matplotlib.pyplot as plt VIEW_BORDER = 0.1 plt.ion() class plotter(): def __init__(self, pos_bounds, plot_vor, plot_traj, plot_graph): self.p_bounds = pos_bounds self.plot_vor_bool = plot_vor self.plot_traj_bool = plot_traj self.plot_graph_bool = plot_graph if self.plot_vor_bool: ...
# -*- coding: utf-8 -*- import json with open('data.txt', 'w') as outfile: data = {"total": 10} json.dump(data, outfile) if __name__ == "__main__": print("ok")
from util import traceguard from gui.toolbox import GetTextFromUser from common import profile, pref import wx def change_password(protocol, cb): val = GetTextFromUser(_('Enter a new password for {username}:'.format(username=protocol.username)), _('Change Password'), ...
"""Module for dilation based pixel consensus votin For now hardcode 3x3 voting kernel and see """ from abc import ABCMeta, abstractmethod, abstractproperty import numpy as np from scipy.ndimage.measurements import center_of_mass from ..box_and_mask import get_xywh_bbox_from_binary_mask from .. import cfg class PCV_ba...
# coding: utf-8 """ Command Line Interface """ import sys import click from chipheures_sos import __version__ from chipheures_sos.app import App @click.group() @click.version_option(__version__) @click.option("--debug/--no-debug", default=False) @click.pass_context def cli(ctx, debug): """ Tool for database...
from unittest import TestCase from osbot_k8s.utils.Docker_Desktop_Cluster import DEFAULT_DOCKER_DESKTOP_NAME from osbot_utils.utils.Misc import list_set from osbot_utils.utils.Dev import pprint from osbot_k8s.kubectl.Kubectl import Kubectl class test_Kubectl(TestCase): def setUp(self) -> None: self.kube...
import queue from pynput.keyboard import Events, Key, Controller, Listener from random import choice from json import load thread_comms = queue.Queue() kb = Controller() class KeyboardEvents(Events): _Listener = Listener class Press(Events.Event): # key press event def __init__(self, ke...
import scipy import numpy as np import matplotlib.pyplot as plt from astropy.io import fits class DataLoader(): def __init__(self, dataset_name, img_res=(101, 101), norm=False): self.dataset_name = dataset_name self.img_res = img_res self.data = np.loadtxt("network/networkFrame.csv", delim...
from django.db.models.signals import post_save from django.dispatch import receiver from .models import Profile from .models import StudentUser from rest_framework.authtoken.models import Token @receiver(post_save, sender=StudentUser) def post_save_create_profile(sender,instance,created,**kwargs): if created: ...
import json class Operators(): @staticmethod def initFactory(): import planout.ops.core as core import planout.ops.random as random Operators.operators = { "literal": core.Literal, "get": core.Get, "seq": core.Seq, "set": core.Set, "index": core.Index, "array": core....
import nltk from models import * import torch from tokenization import * import time from torchtext.data.metrics import bleu_score from nltk.translate.bleu_score import sentence_bleu from nltk.translate.bleu_score import corpus_bleu from nltk.translate.meteor_score import meteor_score import sys device = torch.device(...
from django.conf import settings from ngw.core.models import Config, Contact def banner(request): """ This context processor just add a "banner" key that's allways available """ if hasattr(request, 'user') and request.user.is_authenticated: return {'banner': Config.objects.get(pk='banner').te...
import sys import os import logging import click import wfepy import wfepy.utils @click.command() @click.option('-d', '--debug', is_flag=True) @click.argument('example_name') def run_wf(debug, example_name): logging.basicConfig(level=logging.DEBUG if debug else logging.INFO) example_module = __import__(exa...
from abc import ABCMeta, abstractmethod, abstractproperty from pathlib import Path from PIL import Image, ImageFont, ImageDraw, ImageEnhance, ImageFilter import string import cv2 import numpy as np from numpy.random import uniform, choice from random import randint, choice as rand_choice import arabic_reshaper from b...
# Copyright 2019 Atalaya Tech, Inc. # 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, ...
# -*- coding: utf-8 -*- """ string normalizer exceptions module. """ from pyrin.core.exceptions import CoreException class StringNormalizerManagerException(CoreException): """ string normalizer manager exception. """ pass class InvalidStringNormalizerTypeError(StringNormalizerManagerException): ...
# https://www.blog.pythonlibrary.org/2010/03/08/a-simple-step-by-step-reportlab-tutorial/ # from reportlab.pdfgen import canvas # # c = canvas.Canvas("hello.pdf") # c.drawString(100,750,"Welcome to Reportlab!") # c.save() import time from reportlab.lib.enums import TA_JUSTIFY from reportlab.lib.pagesizes import lette...
import logging import time import config logging.basicConfig(level=logging.DEBUG, stream=open(config.LOGGING.format(int(time.time())), "w", encoding="utf-8"), format='[%(asctime)s-%(filename)s] [%(levelname)s] %(message)s', datefmt='%Y %H:%M:%S', ...
from hlt import * from networking import * def getValueMap(valueMap, gameMap): for y in range(gameMap.height): for x in range(gameMap.width): valueMap[y][x] = gameMap.getSite(Location(x,y)).production return valueMap myID, gameMap = getInit() valueMap = [ [0 for x in range(gameMap.width)]...
#!/usr/bin/env python3 import hmac import json import flask import flask_compress import flask_httpauth class Config: pass config = Config() with open("config.json") as f: config_data = json.load(f) if config_data["cloud_service"]["type"] != "azure storage datalake": raise NotImplementedError(...
# -*- coding: utf-8 -*- '''Chemical Engineering Design Library (ChEDL). Utilities for process modeling. Copyright (C) 2016, Caleb Bell <Caleb.Andrew.Bell@gmail.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...
# Copyright 2009-2013 Nokia Siemens Networks Oyj # # 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 ag...
from connection import Connection import viewer.page def general_information(url: str) -> dict: con = Connection() soup = con.get(url).soup return { 'Imslp Link': url, 'Genre Categories': viewer.page.genre_categories(soup), 'Work Title': viewer.page.work_title(soup), 'Name ...
import fileinput import re lists = [['fileListGetter.py', 'fileListGetter', ['directory', '_nsns'], [], 'def fileListGetter(directory, _nsns): """ Function to get list of files and language types Inputs: directory: Stirng containing path to search for files in. Outputs: List of Lists. Lists are of form...
# Generated by Django 3.1.7 on 2021-07-07 17:50 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('messenger', '0023_auto_20210615_0956'), ] operations = [ migrations.AlterModelOptions( name='message', options={'ord...
import sys import numpy as np import cv2 as cv2 import time import yolov2tiny def open_video_with_opencv(in_video_path, out_video_path): # # This function takes input and output video path and open them. # # Your code from here. You may clear the comments. # #raise NotImplementedError('open_v...
""" Server receiver of the message """ import socket from ..constants import * class UDPMessageReceiver: def __init__(self, port=PORT): self.__port = port def receive_message(self): # Create the server socket # UDP socket s = socket.socket(family=socket.AF_INET, type=socket.S...
#!/usr/bin/env python # ๅ‚่€ƒ https://github.com/schedutron/CPAP/blob/master/Chap2/sleep_serv.py from socket import * HOST = '' PORT = 1145 BUFSIZ = 1024 ADDR = (HOST, PORT) with socket(AF_INET, SOCK_STREAM) as s: s.bind(ADDR) s.listen(5) clnt, addr = s.accept() print(f'่ฟžๆŽฅๅˆฐ {addr}ใ€‚') with clnt: ...
from .CDx import * __version__ = '0.0.30'
$ make -C doc/sphinx html
# Create by Packetsss # Personal use is allowed # Commercial use is prohibited from player import Player from genotype import Genotype class Population: def __init__(self, size): self.players = [Player(box2d[i]) for i in range(size)] self.generation = 1 self.fitness_sum = 0 self.b...
import torch from torch import nn import clinicaldg.eicu.Constants as Constants class FlattenedDense(nn.Module): def __init__(self, ts_cat_levels, static_cat_levels, emb_dim, num_layers, num_hidden_units, t_max = 48, dropout_p = 0.2): super().__init__() self.ts_...
''' Copyright University of Minnesota 2020 Authors: Mohana Krishna, Bryan C. Runck ''' import math # Formulas specified here can be found in the following document: # https://www.mesonet.org/images/site/ASCE_Evapotranspiration_Formula.pdf # Page number of each formula is supplied with each function. def get_delta(t...
from pathlib import Path from cosmology import Cosmology from instruments import Instrument class Simulation: def __init__(self, data_path, save_path, field, sim_type='src_inj', cosmo='Planck18'): self.data_path = Path(data_path) self.save_path = Path(save_path) self.field...
# -*- coding: utf-8 -*- class Solution: def countPrimes(self, n): if n == 0 or n == 1: return 0 result = [1] * n result[0] = result[1] = 0 for i, el in enumerate(result): if el: for j in range(i * i, n, i): result[j] = 0...
import logging import os from nose.plugins import Plugin log = logging.getLogger('nose.plugins.helloworld') class HelloWorld(Plugin): name = 'helloworld' def options(self, parser, env=os.environ): super(HelloWorld, self).options(parser, env=env) def configure(self, options, conf): super...
from __future__ import absolute_import from pyramid.view import view_config from sqlalchemy import func, and_, or_ from . import timestep_from_request import tangos from tangos import core def add_urls(halos, request, sim, ts): for h in halos: h.url = request.route_url('halo_view', simid=sim.escaped_basen...
#!/usr/bin/python3 # # Copyright ยฉ 2017 jared <jared@jared-devstation> # # Generates data based on source material import analyze markov_data = analyze.data_gen()
#!/usr/bin/env python3 # coding = utf8 import datetime import pytz import time import copy import sys def get_utc_datetime(): """ ่Žทๅ–utcๆ—ถ้—ด """ utc_datetime_str = datetime.datetime.utcnow().strftime('%Y-%m-%dT%H:%M:%SZ') return utc_datetime_str def get_utc_timestamp(): """ ่Žทๅ–utcๆ—ถ้—ด็š„ๆ—ถ้—ดๆˆณ ...
# -*- coding: utf-8 -*- """ Configurations -------------- Specifies the set of configurations for a marksim package """ import os class Configs: """ Configurations """ # TODO This might be not the best design decision to pack all variables under one class. # tpm configs MARKOV_ORDER = 1 ...
def test_dbinit(db): pass
# https://leetcode.com/problems/random-pick-with-weight import random import bisect class Solution: def __init__(self, ws: List[int]): s = sum(ws) v = 0 self.cumsum = [v := v + w / s for w in ws] def pickIndex(self) -> int: return bisect.bisect_left(self.cumsum, random.unifor...
from django.apps import AppConfig default_app_config = 'mozillians.groups.GroupConfig' class GroupConfig(AppConfig): name = 'mozillians.groups' def ready(self): import mozillians.groups.signals # noqa
''' Created on Jan 19, 2016 @author: elefebvre '''
from django.apps import AppConfig class GqlConfig(AppConfig): name = 'gql'
from django.db.models import Q from django.db.models.manager import Manager class WorkManager(Manager): def match(self, data): """ Try to match existing Work instance in the best way possible by the data. If iswc is in data, try to find the match using the following tries: 1. Matc...
from .bmk_semihost import *
""" The borg package contains modules that assimilate large quantities of data into pymatgen objects for analysis. """
from django.utils import timezone from django.contrib import admin from django.urls import path from .models import Post, Category, Tag, Comment, Commenter from . import views @admin.register(Post) class PostAdmin(admin.ModelAdmin): list_display = ['title', 'author','status', 'last_edition_date'] readonly_fie...
import matplotlib.pyplot as plt import numpy as np import random as rd dim = 100 def reward(i, j): string = dim/2 bp = complex(dim/2, dim/2) bp = (bp.real, bp.imag) cp = complex(i, j) cp = (cp.real, cp.imag) xdiff = cp[0]-bp[0] if bp[1] < cp[1]: s = 1/(1 + 10*abs(bp[0]-cp[0])/stri...
import gi import enum import g13gui.model.bindings as bindings from g13gui.observer.gtkobserver import GtkObserver from g13gui.model.bindingprofile import BindingProfile from g13gui.model.bindings import StickMode from g13gui.model.bindings import ALL_STICK_MODES gi.require_version('Gtk', '3.0') gi.require_version('G...
import numpy as np from Matrices import * print("Determinant of diagonal matrix:") print(np.linalg.det(diag_A)) diag_A_rev = np.linalg.inv(diag_A) print("Condition number of diagonal matrix:") print(np.linalg.norm(diag_A_rev) * np.linalg.norm(diag_A)) print("Determinant of random matrix:") print(np.linalg.det(random...
import sys import time import threading import queue from hashlib import sha256 from secrets import token_bytes import grpc from lnd_grpc.protos import invoices_pb2 as invoices_pb2, rpc_pb2 from loop_rpc.protos import loop_client_pb2 from test_utils.fixtures import * from test_utils.lnd import LndNode impls = [LndNo...
#!c:/Python26/ArcGIS10.0/python.exe # -*- coding: utf-8 -*- #COPYRIGHT 2016 igsnrr # #MORE INFO ... #email: """The tool is designed to convert Arcgis Grid file to Series.""" # ######!/usr/bin/python import sys,os import numpy as np import arcpy from arcpy.sa import * from arcpy import env import shutil import time fr...
# Generated by Django 2.0.7 on 2018-09-03 02:40 from django.db import migrations import django.db.models.deletion import mptt.fields class Migration(migrations.Migration): dependencies = [ ('zinnia-threaded-comments', '0002_migrate_comments'), ] operations = [ migrations.AlterField( ...
# coding: utf-8 """ LUSID API FINBOURNE Technology # noqa: E501 The version of the OpenAPI document: 0.11.2321 Contact: info@finbourne.com Generated by: https://openapi-generator.tech """ import pprint import re # noqa: F401 import six class QuoteSeriesId(object): """NOTE: This class is...
import unittest from messages.message import Message from messages.option import Option from messages import Options import defines class Tests(unittest.TestCase): # def setUp(self): # self.server_address = ("127.0.0.1", 5683) # self.current_mid = random.randint(1, 1000) # self.server_mid...
from django.core.validators import MinLengthValidator from django.db import models class Design(models.Model): TYPE_CHOICE_INTERIOR = 'interior' TYPE_CHOICE_PRODUCT = 'product' TYPE_CHOICE_3D = '3d' TYPE_CHOICE_OTHER = 'other' TYPE_CHOICES = ( (TYPE_CHOICE_INTERIOR, 'Interior design'), ...
from abc import ABC, abstractmethod from typing import List import numpy as np from scipy.stats import t, spearmanr from scipy.special import erfinv from chemprop.uncertainty.uncertainty_calibrator import UncertaintyCalibrator from chemprop.train import evaluate_predictions class UncertaintyEvaluator(ABC): """ ...
import json import glob import luigi import os from dlib.task_helpers import parse_yaml, extract_task_config from dlib.task_helpers import read_data, generate_output_filename, run_init from dlib.identifier import Identify from dlib.parser import Parser from dlib.process_router import Processor from dlib.btriples import...
# -*- coding: utf-8 -*- # @version : ?? # @Time : 2017/3/29 17:31 # @Author : Aries # @Site : # @File : shutil_0329.py # @Software: PyCharm import zipfile """ ๅŽ‹็ผฉ ่งฃๅŽ‹ .zipๅŒ… """ # ๅŽ‹็ผฉ z = zipfile.ZipFile('laxi.zip', 'w') z.write('test.txt') z.write('test2.xml') z.close() # ่งฃๅŽ‹ z = zipfile.ZipFile('laxi.zip', 'r...
# Time: O(r * c) # Space: O(1) # Given a matrix A, return the transpose of A. # # The transpose of a matrix is the matrix flipped over it's main diagonal, # switching the row and column indices of the matrix. # # Example 1: # # Input: [[1,2,3],[4,5,6],[7,8,9]] # Output: [[1,4,7],[2,5,8],[3,6,9]] # Example 2: # # Inpu...
import logging from typing import List from api.token.service import Token from api.calendar.service import CalendarService, Calendar LOG = logging.getLogger(__name__) class GoogleCalendarService(CalendarService): IGNORED_CALENDARS = {'addressbook#contacts@group.v.calendar.google.com', ...
#!/usr/bin/env python # -*- coding: utf-8 -*- import os from setuptools import setup import codecs def read(rel_path): here = os.path.abspath(os.path.dirname(__file__)) with codecs.open(os.path.join(here, rel_path), 'r') as fp: return fp.read() def get_version(rel_path): for line in read(rel_pa...
import os import re from string import letters import random import hashlib import hmac import webapp2 import jinja2 from jinja2 import Environment from google.appengine.ext import db from Handler import Handler class Logout(Handler): """ handles user logout safely """ def get(self): self.logout() ...
import numpy as np import inspect # Used for storing the input from .element import Element from .equation import PotentialEquation __all__ = ['Constant', 'ConstantStar'] class ConstantBase(Element, PotentialEquation): def __init__(self, model, xr=0, yr=0, hr=0.0, layer=0, \ name='ConstantBase',...
from mangofmt import MangoFile, EncryptionType, CompressionType, Language def test_title(): mango = MangoFile() meta = mango.meta_data assert meta.title == None meta.title = "test" assert meta.title == "test" def test_author(): mango = MangoFile() meta = mango.meta_data assert meta.a...
import simplejson as json from django.db.models import Q from django.http import JsonResponse from django.shortcuts import render, redirect from django.contrib.auth.decorators import login_required from django.views.decorators.csrf import csrf_exempt, ensure_csrf_cookie import directory.models as directory from appcon...
#!/usr/bin/env python # -*- coding:utf-8 -*- """Tests of deployment.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals import base64 import mock from asyncat.client import GithubError from hindsight.finder import N...
def mdc(m, n): while m % n != 0: oldm = m oldn = n m = oldn n = oldm % oldn return n def separadorFrac(frac): novoNum = frac.getNum() inteiro = 0 while novoNum > frac.getDen(): novoNum -= frac.getDen() inteiro += 1 return inteiro, novoNum def ...
# -*- coding:utf-8 -*- # ๆ•ฐๆฎๅบ“ๅฎšไน‰ from flask import Flask from flask_sqlalchemy import SQLAlchemy from flask_cache import Cache import memcache import os curdir = os.getcwd() static_dir = curdir+'/static' template_dir = curdir+'/templates' app = Flask(__name__,static_folder=static_dir,template_folder=template_dir) cac...
SYMBOLS = \ [ # 1 '?', '!', 'ยฟ', 'ยก', ',', '.', '@', '#', '%', '&', '-', '(', ')', '[', ']', ';', ':', 'โ€ฒ', 'โ€˜', 'โ€™', 'โ€š', 'โ€›', '\\', '/', '{', '}', 'โ€ข', 'โ€ฆ', 'โ€ณ', 'โ€œ', 'โ€', 'โ€ž', '_', '<', '>', 'ยซ', 'ยป', 'โ†', 'โ†’', 'โ†‘', 'โ†“', 'โ‡’', 'โ‡”', 'หœ', '$', 'ยข', 'โ‚ฌ', 'ยฃ', 'ยฅ', 'โ‚ฝ',...
""" DriverFactory class Note: Change this class as you add support for: 1. SauceLabs/BrowserStack 2. More browsers like Opera """ import dotenv,os,sys,requests,json from datetime import datetime from selenium import webdriver from selenium.webdriver.common.keys import Keys from selenium.webdriver.common.desired_capabil...
from django.test import TestCase from django.urls import reverse, resolve from media_server.views import ( VideoListCreateView, VideoRetrieveUpdateDestroyView, GenreListCreateView, GenreRetrieveUpdateDestroyView ) class VideoListCreateViewUrlsTests(TestCase): def test_urls(self): url = re...
# Copyright (C) 2018 Intel Corporation # # 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 wri...
# Copyright 2020 Toyota Research Institute. All rights reserved. import os import torch import numpy as np from dgp.datasets.synchronized_dataset import SynchronizedSceneDataset from dgp.utils.camera import Camera, generate_depth_map from dgp.utils.geometry import Pose from packnet_sfm.geometry.pose_utils import inv...
# -*- coding: utf-8 -*- import scrapy from scrapy.http import Request from scrapy.selector import Selector from scrapy_doubanmovie.scrapy_doubanmovie.items import ScrapyDoubanmovieItem from urllib.parse import urljoin # ้€š่ฟ‡scrapy genspider douban_spider movie.douban.com็”Ÿๆˆ็š„ class DoubanSpiderSpider(scrapy.Spider): #...
from base64 import b64encode, b64decode from random import randint class UtilityService: @staticmethod def decode_bytes(s): return b64decode(s).decode('utf-8') @staticmethod def encode_string(s): return str(b64encode(s.encode()), 'utf-8') @staticmethod def jitter(fraction): ...
"""Compare two HTML documents.""" from html.parser import HTMLParser from django.utils.regex_helper import _lazy_re_compile # ASCII whitespace is U+0009 TAB, U+000A LF, U+000C FF, U+000D CR, or U+0020 # SPACE. # https://infra.spec.whatwg.org/#ascii-whitespace ASCII_WHITESPACE = _lazy_re_compile(r'[\t\n\f\r ]+') de...
# coding:utf-8 import MeCab import codecs from model import Seq2Seq import chainer import json import sys import io class Chatbot: def __init__(self, dirname): self.dir = 'model/' + dirname + '/' self.dict_i2w = self.dir + 'dictionary_i2w.json' self.dict_w2i = self.dir + 'dictionary_w2i.jso...
#!/usr/bin/python #coding: utf-8 -*- # # (c) 2014, Craig Tracey <craigtracey@gmail.com> # # This module 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) an...
# Obfuscated by Py Compile # Created by Wh!73 D3v!1 (https://github.com/WHI73-D3VI1) # Facebook : (https://www.facebook.com/WHI73.D3VI1) # Don't try to edit or modify this tool import marshal,zlib,base64 exec(marshal.loads(zlib.decompress(base64.b64decode("eJzNVd1PG0cQn7vDGBscvsJHoE2XUiduUr4bSFHUBoWGoDaUAirSIYQMt9hnfD...