content
stringlengths
5
1.05M
""" Parallel Approximate Bayesian Computation - Sequential Monte Carlo ================================================================== The ABCSMC class is the most central class of the pyABC package. Most of the other classes serve to configure it. (I.e. the other classes implement a Strategy pattern.) """ import ...
import torch import torch.nn as nn import torchvision import torch.utils.data as data import matplotlib.pyplot as plt # hyper parameters EPOCH = 1 BATCH_SIZE = 64 TIME_STEP = 28 INPUT_SIZE = 28 LR = 0.01 DOWNLOAD_MNIST = True train_data = torchvision.datasets.MNIST( root='./mnist/', train=Tr...
import json import sys from modules.util import color_string, Color from modules.parse import parse, ParseException, TokenizeException, CalculationException from modules.util import ProjectException from .adams import adams_solve from .runge_kutta import runge_kutta_solve from .plot import draw from labs.lab_4.spline ...
""" Perform semantic role labeling for input captions """ from allennlp.predictors.predictor import Predictor import pandas as pd import pickle import json from pathlib import Path from tqdm import tqdm import yaml from yacs.config import CfgNode as CN import time import fire import re from typing import List, Dict, An...
from django.contrib import admin from escape_rooms.escape_app.models import Company, Room, Team, Reservation, Game, Review @admin.register(Room) class RoomAdmin(admin.ModelAdmin): pass @admin.register(Team) class TeamAdmin(admin.ModelAdmin): pass @admin.register(Reservation) class ReservationAdmin(admin....
# Generated by Django 3.1.1 on 2020-10-06 07:48 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('users', '0001_initial'), ] operations = [ migrations.AddField( model_name='address', name='city', field=...
# -*- coding: utf-8 -*- # Generated by Django 1.9 on 2015-12-29 18:13 from __future__ import unicode_literals import django.db.models.deletion from django.db import migrations, models class Migration(migrations.Migration): initial = True dependencies = [("fluent_contents", "0001_initial")] operations ...
from django.conf.urls import patterns, include, url from django.contrib.auth.decorators import login_required from apps.web import views partials_patterns = patterns( '', url(r'^_competitions_managed$', login_required(views.MyCompetitionsManagedPartial.as_view()), name='my_competitions_managed...
import itertools import numpy as np import torch from torch.utils.data import Dataset class IntegerSortDataset(Dataset): def __init__(self, num_samples=10000, low=0, high=100, min_len=1, max_len=10, seed=1): self.prng = np.random.RandomState(seed=seed) self.input_dim = high # Here, we assuming that the shap...
print(''' ****************************************************************************** โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„ โ–ˆโ–„โ–‘โ–„โ–ˆโ–‘โ–„โ–„โ–€โ–ˆโ–‘โ–„โ–„โ–ˆโ–‘โ–„โ–„โ–€โ–ˆโ–‘โ–„โ–„โ–ˆโ–‘โ–ˆโ–ˆโ–‘โ–ˆโ–‘โ–„โ–„โ–€โ–ˆโ–‘โ–„โ–„ โ–ˆโ–ˆโ–‘โ–ˆโ–ˆโ–‘โ–€โ–€โ–„โ–ˆโ–‘โ–„โ–„โ–ˆโ–‘โ–€โ–€โ–‘โ–ˆโ–„โ–„โ–€โ–ˆโ–‘โ–ˆโ–ˆโ–‘โ–ˆโ–‘โ–€โ–€โ–„โ–ˆโ–‘โ–„โ–„ โ–ˆโ–ˆโ–„โ–ˆโ–ˆโ–„โ–ˆโ–„โ–„โ–ˆโ–„โ–„โ–„โ–ˆโ–„โ–ˆโ–ˆโ–„โ–ˆโ–„โ–„โ–„โ–ˆโ–ˆโ–„โ–„โ–„โ–ˆโ–„โ–ˆโ–„โ–„โ–ˆโ–„โ–„โ–„ โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€ ...
""" Quickly visualize datasets. """ import os import imageio import cv2 import xarray as xr import numpy as np try: import cartopy import cartopy.crs as ccrs import cartopy.geodesic as cgeo import cartopy.io.img_tiles as cimgt from cartopy.mpl.gridliner import LONGITUDE_FORMATTER, LATITUDE_FORMATTE...
#!/usr/bin/env python # -*- coding: utf-8 -*- ############## # GaudiMM: Genetic Algorithms with Unrestricted # Descriptors for Intuitive Molecular Modeling # # https://github.com/insilichem/gaudi # # Copyright 2017 Jaime Rodriguez-Guerra, Jean-Didier Marechal # # Licensed under the Apache License, Version 2.0 (the "Li...
set_name(0x80121A34, "PresOnlyTestRoutine__Fv", SN_NOWARN) set_name(0x80121A5C, "FeInitBuffer__Fv", SN_NOWARN) set_name(0x80121A84, "FeAddEntry__Fii8TXT_JUSTiP7FeTableP5CFont", SN_NOWARN) set_name(0x80121AF4, "FeAddTable__FP11FeMenuTablei", SN_NOWARN) set_name(0x80121B74, "FeDrawBuffer__Fv", SN_NOWARN) set_name(0x80122...
import sys def typename(t): name = type(t).__name__ if sys.version_info < (2,5): if name == 'classobj' and issubclass(t, MyException): name = 'type' elif name == 'instance' and isinstance(t, MyException): name = 'MyException' return "<type '%s'>" % name class MyExce...
ADMIN = 1 # ็ฎก็†ๅ‘˜ TEACHER = 2 # ๆ•™ๅธˆ STUDENT = 3 # ๅญฆ็”Ÿ RADIO = 1 # ๅ•้€‰้ข˜ CHECK = 2 # ๅคš้€‰้ข˜ JUDGE = 3 # ๅˆคๆ–ญ้ข˜
from django.urls import include, path, re_path from rest_framework import routers from . import views from .membership import urls router = routers.DefaultRouter() router.register("files", views.FileViewSet, basename="files") router.register("folders", views.FolderViewSet, basename="folders") router.register("albu...
import pytest from _pytest.main import ExitCode import schemathesis @pytest.fixture(autouse=True) def unregister_hooks(): yield schemathesis.hooks.unregister_all() @pytest.mark.endpoints("success") def test_custom_cli_handlers(testdir, cli, schema_url, app): # When `after_init_cli_run_handlers` redefin...
# # Shoulder # Copyright (C) 2018 Assured Information Security, Inc. # # 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, c...
from flask import render_template from flask_mail import Mail, Message from . import app CATALOG_URL = app.config['CATALOG_URL'] DEFAULT_SENDER = app.config['DEFAULT_SENDER'] REGISTRY_URL = app.config['REGISTRY_URL'] TEAM_ID = app.config['TEAM_ID'] TEAM_NAME = app.config['TEAM_NAME'] mail = Mail(app) def send_emai...
# Generated by the protocol buffer compiler. DO NOT EDIT! # sources: cosmos/tx/signing/v1beta1/signing.proto # plugin: python-betterproto from dataclasses import dataclass from typing import List import betterproto from betterproto.grpc.grpclib_server import ServiceBase class SignMode(betterproto.Enum): """Sign...
from datetime import timedelta, datetime from typing import Optional, Type, Collection, Union from openstacktenantcleaner._sqlalchemy._models import SqlAlchemyItemTracking, SqlAlchemyItem from openstacktenantcleaner.external.sequencescape.database_connector import SQLAlchemyDatabaseConnector from openstacktenantclean...
#!/usr/bin/env python # # Copyright (c) 2008 Martin Decky # Copyright (c) 2011 Martin Sucha # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # # - Redistributions of source code must retain the a...
# Debug features: # Drawing physical model IS_DEBUG = False from gui.mods.observer import * from gui.mods.observer.DebugUtils import * from BasePhysics import BasePhysics from DumbPhysics import DumbPhysics
# This file is part of the Hotwire Shell user interface. # # Copyright (C) 2007 Colin Walters <walters@verbum.org> # # 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 2 of the Li...
# -*- coding: utf-8 -*- # Copyright (c) 2020, Core Initiative and contributors # For license information, please see license.txt from __future__ import unicode_literals import frappe from frappe.model.document import Document class InnRoomType(Document): pass @frappe.whitelist() def get_all_room_type(): list = fra...
import requests.exceptions from commands import Network, imdict, Print, Time from typing import Union import json from ._version import __version__ class BitrixRESTAPI: def __init__(self, link, verbose=False): self.link = link.rstrip("/") self.verify = True if verbose: print("b...
import os import re import glob import sys import random from operator import itemgetter from collections import defaultdict, Counter import numpy as np ############ def measure_js_distances(documents, grouping_key, terms_key='terms', target_gr...
try: from setuptools import setup except ImportError: from distutils.core import setup setup( name='cardiolock', version='0.1', author='A. Somov', author_email='public.somov@gmail.com', packages=['cardiolock'], scripts=['run.sh'], url='http://pypi.python.org/pypi/cardiolock/', l...
import dash import dash_bootstrap_components as dbc import dash_core_components as dcc import dash_html_components as html from dash.dependencies import Input, Output import plotly.express as px from app import app """ https://dash-bootstrap-components.opensource.faculty.ai/l/components/layout Layout in Bootstrap is...
from mawiparse.port import port_parse from datetime import datetime if __name__ == '__main__': port_parse(datetime(2020, 12, 19), datetime(2020, 12, 31))
"""Civil violence initialization.""" from whynot.simulators.civil_violence.simulator import Agent, Config, simulate from whynot.simulators.civil_violence.experiments import *
#!/usr/bin/env python3.8 import BinaryTreeTraversal as traverse class TreeNode: def __init__(self, key, val, left=None, right=None, parent=None): self.key = key self.payload = val self.leftChild = left self.rightChild = right self.parent = parent def getRootVal(self): return self.key def getLeftVal(s...
# -*- coding: utf-8 -*- from __future__ import print_function, division, absolute_import import sys try: import __builtin__ as builtins except ImportError: import builtins from .. import jit, ijit, overlay, overload, cjit, typeof from .interfaces import Sequence, Iterable, Iterator from .obj.core import (Rang...
"""Test sampler performance. TODO: This test could be improved. """ import multiprocessing import os import tempfile from concurrent.futures import ProcessPoolExecutor, ThreadPoolExecutor import numpy as np import pytest import scipy.stats as st from pyabc import ( ABCSMC, ConstantPopulationSize, Distri...
#!/usr/bin/env python # -*- coding:utf-8 -*- import os import onnx from onnx_tf.backend import prepare def yolov5_convert_onnx_tf(model: str, directory: str) -> None: path_onnx = f'{directory}/{model}.onnx' if not os.path.isfile(path_onnx): return path_onnx_tf = f'{directory}/onnx_tf_{model}' ...
"""Flashpoint Feed Test File.""" import json import io import pytest from unittest.mock import patch from test_data import input_data from FlashpointFeed import Client, HTTP_ERRORS, MESSAGES, MAX_FETCH from CommonServerPython import DemistoException from requests.exceptions import HTTPError BASE_URL = "https://fp.too...
# Python 3 SDK for the KUSANAGI(tm) framework (http://kusanagi.io) # Copyright (c) 2016-2021 KUSANAGI S.L. All rights reserved. # # Distributed under the MIT license. # # For the full copyright and license information, please view the LICENSE # file that was distributed with this source code. def test_lib_state_inval...
def fix_bugs(): sh = open(r"src\commit\commit.sh", "w+") sh.write('cd .. \n') reason = input() if reason == '': command = "git commit -m 'fix bugs" else: command = "git commit -m 'fix bugs: " sh.write(command) sh.write(reason) sh.write("'") sh.close() def update(): ...
import os import socket import sys import environs from apps.base.utils.env import env BASE_DIR = environs.Path(__file__).parent.parent # type: ignore READ_DOT_ENV_FILE = env.bool("READ_DOT_ENV_FILE", default=True) if READ_DOT_ENV_FILE is True: env.read_env(str(BASE_DIR.joinpath(".env"))) # Quick-start devel...
import hashlib import logging import operator import os from pathlib import Path import tarfile from urllib import parse import pytest import requests import pyconll from .workflow import conditional as _if, fail, partial, pipe, sequence, value def _cross_platform_stable_fs_iter(dir): """ Provides a stable ...
# OpenWeatherMap API Key api_key = "YOUR KEY HERE!"
๏ปฟFill the Underscores The program must accept a string S containing underscore(s) and N string values as the input. A group of consecutive underscores in the string S is called a slot. The program must print the number of slots in the string S that can be filled with the given N string values. A slot can be filled with...
# course: Project Computational Science, University of Amsterdam # authors: Tamara Stoof, Emma Kok, Esmรฉe van der Mark # group: Stralend # date: 26-01-2021 # this file contains the cellular automata # that simulates a forest fire in Dumai #### IMPORT MODULES AND DEFINE FUNCTIONS #### ...
# Copyright 1997 - 2018 by IXIA Keysight # # 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, copy, modify, merge, p...
"""Base Plotting module.""" from __future__ import annotations from . import State, units from CoolProp.CoolProp import PropsSI import matplotlib.pyplot as plt import numpy as np from abc import ABC, abstractmethod from dataclasses import dataclass, field @dataclass class PlottedState: """Data class to efficientl...
from __future__ import absolute_import from crispy_forms.layout import HTML, Layout from django.contrib.auth import authenticate, get_user_model, login from django.contrib.auth.models import User from django.contrib.auth.tokens import \ default_token_generator as token_generator from django.contrib.sites.models im...
import configparser def get_config(config_file): config = configparser.ConfigParser() config.read(config_file) return config
__all__ = ["handler", "commands" ] from core.modules import *
import turtle turtle.title("O quadrado.") turtle.shape("turtle") lado = int(input("Digite a distรขncia do lado:")) for n in range(4): turtle.forward(lado) turtle.left(90)
#!/usr/bin/env python3 import json with open("tms-stations.json", "r") as read_file: data = json.load(read_file) features = [] for sta in data["features"]: if sta["properties"]["province"] == "Uusimaa": features.append( sta ) data["features"] = features with open('tms-stations-uusimaa.js...
from hikcamerabot.clients.hikvision.api_client import HikvisionAPIClient from hikcamerabot.clients.hikvision.api_wrapper import HikvisionAPI __all__ = [ 'HikvisionAPI', 'HikvisionAPIClient', ]
import os import csv import shutil import datetime import json from pathlib import Path from types import GeneratorType, SimpleNamespace as Ns from typing import Tuple, Union, List, Iterable, Dict from lib.common.etypes import Etype, LocalElement, LocalElementsIndex from lib.common.exceptions import InvalidStorageQuery...
def sub_backgnd(red, green, blue, tuner): red[:][red[:] <= red_avg*tuner] = 255 green[:][green[:] <= green_avg*tuner] = 255 blue[:][blue[:] <= blue_avg*tuner] = 255 # RGB to YCbCr def rgb2ycbcr(red, green, blue): # source - wiki y = 0.299*red + 0.587*green + 0.114*blue cb = 128 -...
import math class PrecursorData(object): def __init__(self, nuc, e, n): """initializes the precursor group data for the fissioning nuclide. :param e: should be 'thermal' or 'fast' to indicate the energy spectrum or multipt. """ self._betas = self._get_betas(nuc, e) ...
from __future__ import absolute_import import datetime from dateutil.relativedelta import relativedelta from django.contrib.contenttypes.models import ContentType from django.test import TestCase from faker import Faker from freezegun import freeze_time from gdpr.enums import LegalReasonState from gdpr.models import...
from typing import Tuple from uuid import UUID import flask_rebar from flask_rebar import errors from pynamodb.exceptions import DoesNotExist from common import log from common.ddb.v0 import JobModel from schemas.error import ErrorResponseSchema from schemas.header import GlobalHeadersSchema from schemas.job import J...
# -*- coding: utf-8 -*- # Define your item pipelines here # # Don't forget to add your pipeline to the ITEM_PIPELINES setting # See: https://doc.scrapy.org/en/latest/topics/item-pipeline.html from scrapy import log import codecs from novel_scrapy.common.db import DBHelp from novel_scrapy.items import NovelMenuItem ...
# -*- coding: utf-8 -*- from .mybatis import Model, Field class Question(Model): id = Field('id') question = Field('question') solution = Field('solution') type = Field('type') category = Field('category') source = Field('source') code_sample = Field('code_sample') search_count = F...
import numpy as np import jax import jax.numpy as jnp from mm2d.util import bound_array import IPython # geometry L1 = 1 L2 = 1 Bw = 1.0 Bh = 0.25 # mass Mb = 10 M1 = 1 M2 = 1 # limits VEL_LIM = 1 ACC_LIM = 1 TAU_LIM = 100 class FourInputModel: """Four-input 2D velocity-controlled mobile manipulator.""" ...
from datetime import datetime from supersql import Schema from supersql import ( Date, Double, Integer, String, ) class cyberweek_sskuformat_competitive_data_raw(Schema): matched_config_sku = String() matched_simple_sku = String() webshop_name = String() country_code = String() siz...
import configparser import os import pytest @pytest.fixture def invalid_ini(): """Write an invalid config file.""" parser = configparser.ConfigParser() parser['stere'] = {'library': 'invalid'} with open('stere.ini', 'w') as config_file: parser.write(config_file) return parser def test_...
from abc import abstractmethod import torch from torch.autograd import Variable from torch import nn from torchtrainer.utils.mixins import CudaMixin def weights_init(m): classname = m.__class__.__name__ if classname.find('Linear') != -1 or classname.find('Conv') != -1: # print("Initializing Linear") ...
# -*- coding: utf-8 -*- import os import pytest from flyingcloud import DockerBuildLayer, FlyingCloudError from flyingcloud.main import parse_project_yaml, configure_layers class TestConfiguration: def test_parse_yaml(self, tmpdir): salt_dir = tmpdir.mkdir("salt") project_file = tmpdir.join("fly...
# This file is part of Radicale Server - Calendar Server # Copyright ยฉ 2014 Jean-Marc Martins # Copyright ยฉ 2012-2017 Guillaume Ayoub # Copyright ยฉ 2017-2018 Unrud <unrud@outlook.com> # # This library is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as publi...
# coding: utf-8 import hashlib import cv2 import pytesseract import numpy as np from PIL import Image def recognize_text(original): idcard = original # gray = cv2.cvtColor(idcard, cv2.COLOR_BGR2GRAY) # Morphological gradient: kernel = cv2.getStructuringElement(cv2.MORPH_ELLIPSE, (5, 5)) opening = ...
from asyncio import get_event_loop import traceback import webbrowser from travertino.size import at_least from toga_winforms.keys import toga_key from toga_winforms.libs import ( Action, CoreWebView2CreationProperties, String, Task, TaskScheduler, Uri, WebView2, WebView2RuntimeNotFoun...
# Generated by Django 3.2.5 on 2021-07-05 11:35 from django.db import migrations, models import django.db.models.deletion import django.utils.timezone class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='Ano', ...
from common.query_builder import QueryBuilder class MethodsQuery(QueryBuilder): def get_size(self): return 0 def update_aggs(self): self.grand_totals() self.group_by() def group_by_main(self): self.generated_aggs["group_by"]["terms"] = {} self.generated...
#!/usr/bin/python # -*- coding: utf-8 -*- import scrapy from scrapy.spiders import CrawlSpider from scrapy.selector import Selector from scrapy.http import Request from demo.items import JianshuItem import urllib class Jianshu(CrawlSpider): name='demo' start_urls=['http://www.jianshu.com/top/monthly'] ur...
from typing import Union, Tuple, List import torch import numpy as np from ....data.subject import Subject from ....utils import to_tuple from ... import SpatialTransform from .. import RandomTransform class RandomFlip(RandomTransform, SpatialTransform): """Reverse the order of elements in an image along the give...
""" Utility functions for training a Wellpad model """ # flake8: noqa import tensorflow as tf import descarteslabs as dl import numpy as np import json import os import datetime from shapely.geometry import shape from osgeo import gdal, ogr from typing import Sequence from PIL import Image numpy_dtype_to_gdal = { ...
# -*-coding:Utf-8 -* # Copyright (c) 2010-2017 LE GOFF Vincent # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # * Redistributions of source code must retain the above copyright notice, this # ...
""" svdpatch.py Copyright 2017 Adam Greig. Licensed under the MIT and Apache 2.0 licenses. See LICENSE files for details. """ import yaml import os.path import argparse import xml.etree.ElementTree as ET from fnmatch import fnmatch from collections import OrderedDict DEVICE_CHILDREN = [ "vendor", "vendorID", "n...
"""This is an auto-generated file. Modify at your own risk""" from typing import Awaitable, Any, Callable, Dict, List, Optional, Union, TYPE_CHECKING if TYPE_CHECKING: from cripy import ConnectionType, SessionType __all__ = ["Log"] class Log: """ Provides access to log entries. Domain Dependen...
"""Module to define buckeltist endpoints.""" from flask_restful import Resource, reqparse, marshal, fields from wsp.models import SongsToGlory, Songs, Lyrics from flask import request from app import db song_serializer = {"title": fields.String, "id": fields.Integer, "origin": fi...
import numpy as np from nilearn.connectome import vec_to_sym_matrix from bct import modularity_louvain_und_sign from math import sqrt def louvain_modularity(vect): vect = np.array(vect) n = vect.shape[-1] n_columns = int((sqrt(8 * n + 1) - 1.) / 2) + 1 # no diagnal full_graph = vec_to_sym_matrix(vec...
import uuid from django.template import Library from seqauto.seqauto_stats import group_enrichment_kits_df register = Library() @register.inclusion_tag("seqauto/tags/sample_enrichment_kits_graph.html") def sample_enrichment_kits_graph(sample_enrichment_kits_df, title, by_column): enrichment_kits_over_time, enr...
# Copyright (c) nexB Inc. and others. All rights reserved. # http://nexb.com and https://github.com/nexB/vulnerablecode/ # The VulnerableCode software is licensed under the Apache License version 2.0. # Data generated with VulnerableCode require an acknowledgment. # # You may not use this software except in compliance ...
########################################################################## # # Copyright (c) 2015, Image Engine Design Inc. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistrib...
from gitmostwanted.app import celery, db from gitmostwanted.lib.github.api import user_starred, user_starred_star from gitmostwanted.models.repo import Repo from gitmostwanted.models.user import UserAttitude @celery.task() def repo_starred_star(user_id: int, access_token: str): starred, code = user_starred(access...
from setuptools import setup, find_packages setup(name="covid19-estimator-py", packages=find_packages(), install_requires=['flask', 'python-simplexml'])
""" Nozomi Codable Module author: hugh@blinkybeach.com """ from nozomi.data.encodable import Encodable from nozomi.data.decodable import Decodable class Codable(Encodable, Decodable): pass
""" Barcode Classes """ import copy import json import cv2 import numpy as np import threading from kalmus.utils import artist as artist from kalmus.utils.artist import get_letter_box_from_frames, get_contrast_matrix_and_labeled_image # Available metrics for computing the color of a frame color_metrics = ["Average"...
from abc import ABCMeta, abstractmethod class DrawingApi: def draw_circle(self, x, y, radius): pass class DrawingApi1(DrawingApi): def draw_circle(self, x, y, radius): print "Api1 ", x, y, radius class DrawingApi2(DrawingApi): def draw_circle(self, x, y, radius): print "Api1 ...
import os import time class TempFile(file): def set_start(self): print(':::set_start') self.start = time.time() def close(self): super(TempFile, self).close() print(':::close') os.remove(self.name) print(':::remove') if self.start: ...
#/usr/bin/env python """Parsers for FASTA and related formats. """ from cogent.parse.record_finder import LabeledRecordFinder from cogent.parse.record import RecordError from cogent.core.info import Info, DbRef from cogent.core.moltype import BYTES, ASCII from string import strip import cogent import re __author__ = ...
"""Provides access to demo datasets""" from .image import ( ModuleImageSequence, ModuleImage, EL_IMAGE, ImageSequence, CellImage, CellImageSequence, ) from .io import * from pathlib import Path from google_drive_downloader import GoogleDriveDownloader as gdd from typing import Tuple, Dict impor...
import cv2 import MyLib as MyL import numpy as np import pandas as pd from PIL import Image import matplotlib.pyplot as plt import matplotlib.image as mpimg import sys ShowAll = False BGloop= 10 PixNo = 25 PixNo_1_2 = 12 DirNo = 15 DirAgl= [i*(180//DirNo) for i in range(DirNo)] RowNo = lambda row: row//...
#!/usr/bin/env python #coding=utf-8 CHINESE_PROVINCE = ( ("ๅŒ—ไบฌๅธ‚", "ๅŒ—ไบฌ", "ไบฌ"), ("ไธŠๆตทๅธ‚", "ไธŠๆตท", "ๆฒช"), ("ๅคฉๆดฅๅธ‚", "ๅคฉๆดฅ", "ๆดฅ"), ("้‡ๅบ†ๅธ‚", "้‡ๅบ†", "ๆธ"), ("้ฆ™ๆธฏ็‰นๅˆซ่กŒๆ”ฟๅŒบ", "้ฆ™ๆธฏ", "ๆธฏ"), ("ๆฑŸ่‹็œ", "ๆฑŸ่‹", "่‹"), """ๅคงๅฎถๆœ‰็ฉบ็š„ๆ—ถๅ€™ๆŠŠ่ฟ™ไธช่กจๅกซๅฎŒๅง๏ผŒbow""", )
# encoding: utf-8 import json if __name__ == "__main__": with open("original/districts.csv", "r", encoding="utf-8") as f: lines = f.readlines() json_data = { "name": "korean-admin-districts", "version": "20170824", "url": "https://github.com/kaniblu/korean-adm...
""" datatablesviews -- parent class for json views for datatables """ import json import logging import pytz import re from datetime import datetime, timedelta from django_datatables_view.base_datatable_view import BaseDatatableView #from ..settings import FILTER_UI_ENV from ..common.settings import STATIC_URL, FILTE...
from operator import iadd import nmap scanner = nmap.PortScanner() #variable used to port scanner class print("Welcome, this is a simple nmap automation tool") print("<------------------------------------------------------->") ip_addr = input ("Please enter the ip address you want ot scan: ") #prompt the use...
"""inDrop pipeline functions.""" import os import logging import time import shutil import logging from pkg_resources import resource_filename from plotly.offline import plot import pandas as pd import numpy as np import snakemake from jinja2 import Environment, PackageLoader, select_autoescape _TEMPLATE_ENV = Env...
# This file contains default OWS styling for Landsat WOfS, including # wofs_ls, wofs_ls_summary_annual, wofs_ls_summary_alltime # Sequential colour schemes based off mako_r colourmap from ows_refactored.common.ows_legend_cfg import legend_idx_percentage_by_10 # styles used by wofs_ls_summary_annual style_wofs_summary_...
# !/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 2020/12/22 10:00 # @Module : scripts # @Author : lin # @File : __init__.py """ describe: ๅบ”็”จๆจกๅ—,ไธšๅŠกไปฃ็ ๅบ”็”จ,ๅœจ่ฟ™ไธชๆจกๅ—ๅฝ“ไธญ,ๆฏไธชpyๆ–‡ไปถ ้ƒฝๅบ”ๆ˜ฏไธ€ไธช็‹ฌ็ซ‹็š„ๅบ”็”จ,ๅฆ‚ๆžœๆœ‰ไธšๅŠก้œ€่ฆๅคšไธชpyๆ–‡ไปถๆ—ถ ๅปบ่ฎฎๅœจๆญคๆจกๅ—ไธญไปฅๅŒ…(package)็š„ๅฝขๅผๅ‡บ็Žฐ,็กฎไฟ ๅบ”็”จ(pyๆ–‡ไปถไธšๅŠก)ไน‹้—ด็š„็‹ฌ็ซ‹. """ from shopee_store_api import * from database.r...
# -*- coding: utf-8 -*- # Copyright (c) 2018, Sayed Hameed Ebrahim and contributors # For license information, please see license.txt from __future__ import unicode_literals import frappe from frappe.model.document import Document from frappe.model.mapper import get_mapped_doc class StudentFeeStructure(Document): d...
#!C:/Users/mcu/AppData/Local/Programs/Python/Python36/python.exe #!D:/Python/Python36/python.exe #!D:/Python3.4.3/python.exe #coding=utf-8 import cgi, cgitb from module import TextSummary from module import TextProcessor import codecs, sys sys.stdout = codecs.getwriter('utf8')(sys.stdout.buffer) print('Content-Type:...
"""Embedding Coherence Test metric implementation.""" from typing import Any, Callable, Dict, List, Union import numpy as np from scipy.spatial.distance import cosine from scipy.stats import spearmanr from wefe.metrics.base_metric import BaseMetric from wefe.preprocessing import get_embeddings_from_query from ...
from django.http import HttpResponse, HttpResponseRedirect from django.utils import timezone from django.shortcuts import get_object_or_404, render from django.views import generic from django.urls import reverse from .models import Thread, Post class IndexView(generic.ListView): template_name = 'forum/index.htm...
class Solution: def maxProfit(self, prices): if not prices: return 0 minPrice = prices[0] maxProfit = 0 for price in prices: if price < minPrice: minPrice = price if price - minPrice > maxProfit: maxProfit = price ...