content
stringlengths
5
1.05M
# MIT License # # Copyright (c) 2020 Tri Minh Cao # # 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, merg...
from django.urls import path from . import views urlpatterns = [ path("",views.home), path("posts/",views.PostList.as_view()), path("posts/api/v1/",views.getDataJson), path("posts/<int:pk>",views.PostDetails.as_view()), path("post/search/<int:pk>",views.get_Data), path('modules/',views.ModuleLi...
import sys fname = sys.argv[1] ofname = fname + '.raw' idx = 0 with open(ofname, 'w') as fo: for line in open(fname).readlines(): fo.write("# ::id %d\n"%(idx, )) fo.write("# ::snt %s\n"%(line.rstrip())) fo.write("(d / dummy)\n\n") idx += 1
# Modify print_tree_inorder so that it puts parentheses around every operator and pair of operands. # Is the output correct and unambiguous? Are the parentheses always necessary? class Tree: def __init__(self, cargo, left=None, right=None): self.cargo = cargo self.left = left self.right = r...
from flask_login import UserMixin from sqlalchemy import Column, Integer, String, UniqueConstraint, CheckConstraint from .base import Base class User(UserMixin, Base): """ Class representing an application user """ __tablename__ = "Users" #: Primary key id = Column(Integer, primary_key=True) ...
import requests from bs4 import BeautifulSoup import sqlite3 from sqlite3 import Error from datetime import date #แƒ•แƒ˜แƒ’แƒ”แƒ‘แƒ— แƒ“แƒฆแƒ”แƒ•แƒแƒœแƒ“แƒ”แƒš แƒ แƒ˜แƒชแƒฎแƒ•แƒก แƒ—แƒ•แƒ”แƒก แƒ“แƒ แƒฌแƒ”แƒšแƒก today = date.today() d = today.strftime('%d/%m/%y') page = 1 #แƒกแƒแƒ˜แƒขแƒ˜แƒก แƒ’แƒ•แƒ”แƒ แƒ“แƒ˜ #แƒ•แƒฅแƒ›แƒœแƒ˜แƒ— แƒ‘แƒแƒ–แƒแƒก แƒกแƒแƒ“แƒแƒช แƒจแƒ”แƒ•แƒ˜แƒœแƒแƒฎแƒแƒ•แƒ— แƒ“แƒแƒกแƒ™แƒ แƒแƒžแƒฃแƒš แƒ˜แƒœแƒคแƒแƒ แƒ›แƒแƒชแƒ˜แƒแƒก conn = sqlite3.connect('data.db') c =...
# Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. # SPDX-License-Identifier: Apache-2.0 import nltk import numpy as np from nltk.metrics import * from nltk.util import ngrams import enchant # spell checker library pyenchant from enchant.checker import SpellChecker from nltk.stem import PorterS...
# -*- coding: utf-8 -*- """ Created on Tue May 03 16:32:53 2016 @author: Peter A collection of functions that can be used to generate a mask for a given tissue. These functions were fine tuned on a personnal data. They can be used at your own risk. """ import numpy as np from skimage.morphology import disk, opening, ...
from itertools import product def is_triangle(sides) -> bool: return all(sum(pair[:2]) >= pair[2] != 0 for pair in product(sides, repeat=3)) def equilateral(sides): return is_triangle(sides) and sides[0] == sides[1] == sides[2] def isosceles(sides): return is_triangle(sides) and ( sides[0] == ...
l086jXnOFE4BtKQlonKnUg+VY1GYfjn3PlxLmSqeVotZ4EuiAMTRmf5+72mmbZZF4OYRQy4ORTJsO2Lt/QsW8VSvG5vQKpjflbbMObnXBVoTrkvHd1i/xYqBUsktc9t4/jn2WW5MROuLwrYvo6gnjHRy6gmPQqxC9RBvC7DXptoYwekEWRh0D5BZ/88slO4iQJ7C+cA0/0fzjIePXkeacQumgZuYLZLnV4+TH9vAQmL4yh4OUnePCcuwG7X74/SlKA065fJIaPqpAE35FC0qaAULRE5E5tdVlWTiwjT1GSFgH2vo18Y7978tgm8D3QhX...
# Copyright Contributors to the Packit project. # SPDX-License-Identifier: MIT from tests.testbase import BaseClass import tempfile from requre.simple_object import Simple from requre.online_replacing import replace def x(): return tempfile.mktemp() class Duplicated(BaseClass): @replace("tests.test_duplica...
# 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, software # d...
from django.db import models class Conta(models.Model): descricao = models.CharField(max_length=150, verbose_name="Descriรงรฃo") def __str__(self): return '{}'.format(self.descricao) class Responsavel(models.Model): nome = models.CharField(max_length=150, verbose_name="Nome") def __str__(self...
class serverLoginValidation(): def __init__(self, email, passwd): self.email = email self.passwd = passwd def validateUser(self): self.db = DataBase() self.userdata = self.db.userDefined(self.email, self.passwd) if self.userdata: return True else: ...
from ep.utils import * def first_run(download=False): """ Create csv files from stratch :param download: boolean. Set to False if files have been downloaded and saved to ./resources Set to True to download files from EIA website """ setupDirectories() interest_dataframes = get...
import os import argparse def main(argv=sys.argv[1:]): pass
import dash_mantine_components as dmc component = dmc.Affix( dmc.Button("I'm in an Affix Component"), position={"bottom": 20, "right": 20} )
import re import math import tweepy import feedparser from tweepy import OAuthHandler from textblob import TextBlob class TwitterClient(object): # keys and tokens from the Twitter Dev Console consumer_key = '' consumer_secret = '' access_token = '' access_token_secret = '' positi...
import sys from .bv import get_bv_circuit from .qaoa import get_qaoa_circuit from .qgan import get_qgan_circuit from .ising import get_ising_circuit from .parallel_cnot import get_parallel_cnot, get_parallel_cnot_barriers from .parallel_swap import get_parallel_swap from .xeb import get_xeb_circuit, get_xeb_iswap_circ...
""" Canvas Indexer A flask web application that crawls Activity Streams for IIIF Canvases and offers a search API. """ import atexit from flask import Flask from flask_cors import CORS from canvasindexer.config import Cfg from canvasindexer.crawler.crawler import crawl from apscheduler.schedulers.background i...
# Generated by Django 3.1.8 on 2021-08-25 14:00 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ("river", "0004_batch_completed_canceled"), ] operations = [ migrations.RemoveField( model_name="error", name="deleted_at", ...
# -*- coding: utf-8 -*- # Copyright 2015 The Chromium OS Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """Module containing release engineering related builders.""" from __future__ import print_function from chromite.lib import par...
"""Configs for global use""" cfg = {'seed': 1971}
# -*- coding: utf-8 - import codecs import io import os from setuptools import setup with io.open(os.path.join(os.path.dirname(__file__), 'README.md'), encoding='utf-8') as f: long_description = f.read() setup( name = 'bernhard', version = '0.2.6', description = 'Python client for Riemann'...
import asyncio, pathlib, importlib parent = pathlib.Path(__file__).resolve().parent for _ in parent.iterdir(): if _.is_dir() and not _.name.startswith('.'): importlib.import_module('.main', _.name)
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 2019/11/6 ไธŠๅˆ11:33 # @Title : 58. ๆœ€ๅŽไธ€ไธชๅ•่ฏ็š„้•ฟๅบฆ # @Link : https://leetcode-cn.com/problems/length-of-last-word/ QUESTION = """ ็ป™ๅฎšไธ€ไธชไป…ๅŒ…ๅซๅคงๅฐๅ†™ๅญ—ๆฏๅ’Œ็ฉบๆ ผย ' 'ย ็š„ๅญ—็ฌฆไธฒ๏ผŒ่ฟ”ๅ›žๅ…ถๆœ€ๅŽไธ€ไธชๅ•่ฏ็š„้•ฟๅบฆ ๅฆ‚ๆžœไธๅญ˜ๅœจๆœ€ๅŽไธ€ไธชๅ•่ฏ๏ผŒ่ฏท่ฟ”ๅ›ž 0ย ใ€‚ ่ฏดๆ˜Ž๏ผšไธ€ไธชๅ•่ฏๆ˜ฏๆŒ‡็”ฑๅญ—ๆฏ็ป„ๆˆ๏ผŒไฝ†ไธๅŒ…ๅซไปปไฝ•็ฉบๆ ผ็š„ๅญ—็ฌฆไธฒใ€‚ ็คบไพ‹: ่พ“ๅ…ฅ: "Hello World" ่พ“ๅ‡บ: 5 """ THINKING ...
from __future__ import absolute_import, print_function from django.conf.urls import patterns, url from .metadata import CloudflareMetadataEndpoint from .webhook import CloudflareWebhookEndpoint urlpatterns = patterns( "", url(r"^metadata/$", CloudflareMetadataEndpoint.as_view()), url(r"^webhook/$", Clou...
from sparkpost import SparkPost import requests import os class SparkPostIPNotifier: current_ip = None fetched_ip = None def __init__(self, sparkpost_api_key, subject, from_email, recipients): self.subject = subject self.from_email = from_email self.recipients = recipients ...
""" Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution. SPDX-License-Identifier: Apache-2.0 OR MIT """ # Test case ID : C4976201 # Test Case Title : Verify that the value assigned to the Mass of the object, gets a...
# -*- coding: utf-8 -*- """ Query permutator to match multiword queries. Given a query with n tokens we assume the first n-1 to be complete while the last might be partial. From that we want to match using the following algorithm. Bag of words reordering is applied to the first n-1 tokens, n-th token (partial) is ke...
# -*- coding: utf-8 -*- # Generated by Django 1.11.10 on 2018-10-25 19:58 from __future__ import unicode_literals from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('s3pooler', '0001_initial'), ] operations = [ migrations.DeleteModel( n...
import matplotlib.pyplot as plt def main(): # The iteration number 0 corresponds to 0 DAger's iteration, which corresponds to the simple behavioral cloning model iterations = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19] dagger_mean_return = [499, 491.00752037626864, 280.3549345571...
"""broccoliใƒ•ใƒฌใƒผใƒ ใƒฏใƒผใ‚ฏๅ†…ใƒ‡ใƒผใ‚ฟใฎใ€ใ‚ทใƒชใ‚ขใƒฉใ‚คใ‚บใƒปใƒ‡ใ‚ทใƒชใ‚ขใƒฉใ‚คใ‚บใซ้–ขใ™ใ‚‹ใƒขใ‚ธใƒฅใƒผใƒซใ€‚""" import json from broccoli import register from broccoli.layer import BaseLayer, BaseItemLayer, BaseObjectLayer, BaseTileLayer from broccoli.material import BaseTile, BaseObject, BaseItem, BaseMaterial MANAGER = 'Manager' LAYER = 'Layer' TILE = 'Tile' OBJECT = 'Object...
import numpy as np import rasterio as rio import geopandas as gpd import cartopy.crs as ccrs import matplotlib.pyplot as plt from shapely.ops import cascaded_union from shapely.geometry.polygon import Polygon from cartopy.feature import ShapelyFeature import matplotlib.patches as mpatches def generate_handles(labels,...
# coding=utf-8 # Copyright 2018 The Google AI Language Team Authors and The HugginFace Inc. team. # # 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/LICENS...
from apistar import http, Route from apistar.backends.sqlalchemy_backend import Session from db import Auto def make_auto_dict(auto: Auto) -> dict: """ Returns a dictionary of the relevant attributes from an Auto object """ return { "id": auto.id, "name": auto.name, "make": auto.make, ...
# MIT License # Copyright (c) 2016 Alexis Bekhdadi (midoriiro) <contact@smartsoftwa.re> # 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...
import unittest import time from datetime import datetime from sqlalchemy.exc import IntegrityError from app import mail from flask import current_app from app import create_app, db from app.models import User, AnonymousUser, Role, Permission, Follow class AdditionModelTestCase(unittest.TestCase): def setUp(self...
from django.test import TestCase from accounts.forms import RegisterForm, SignInForm from django.contrib.auth.models import User class TestAccountForm(TestCase): def test_register_form(self): form = RegisterForm( data={ "email": "test@gmail.com", "username": "te...
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'settings_widget.ui' # # by: pyside-uic 0.2.15 running on PySide 1.2.2 # # WARNING! All changes made in this file will be lost! from tank.platform.qt import QtCore, QtGui class Ui_SettingsWidget(object): def setupUi(self, SettingsW...
#!/usr/bin/env python import logging from lxml import etree from ncclient import manager from ncclient.xml_ import * def connect(host, port, user, password): conn = manager.connect(host=host, port=port, username=user, password=pass...
import shlex def parse_query(query): tokens = shlex.split(query) dsl = {'search': []} key = '' for token in tokens: if token.endswith(':'): key = token[:-1] else: value = token or '' if ':' in token: key, word = token.split(':', 1) ...
# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved. # # 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 b...
# Generated by Django 3.2.7 on 2021-10-30 21:49 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('workOrder', '0001_initial'), ] operations = [ migrations.RenameField( model_name='directive', old_name='workOders', ...
# Excreva um programa que leia um valor em metros e o exiba convertido em centimetros e em milimetros medida = float(input('Digite a sua medida: ')) print(f'A medida de {medida}m corresponde a {medida*100}cm e {medida*1000}mm')
"""This module contains modules. Submodules ========== .. autosummary:: :toctree: _autosummary module gp_modules """ __all__ = ['module', 'gp_modules']
#!/usr/bin/env python3 # -*- coding: utf-8 -*- ''' alphabet.py Automation sketch to fire LEDs to display clue words. usage: python3 alphabet.py [-h] [-s SERVER] [-p PORT] [-d] [-l LOGGER] optional arguments: -h, --help show this help message and exit -s SERVER, --server SERVER ...
"""empty message Revision ID: fd51d3fa9aef Revises: 1c96aaeccb0b Create Date: 2022-03-14 12:16:43.830823 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = 'fd51d3fa9aef' down_revision = '1c96aaeccb0b' branch_labels = None depends_on = None def upgrade(): pa...
# coding=utf-8 #็ฉบๆ–‡ไปถ๏ผŒๅชๆ˜ฏไธบไบ†handle็›ฎๅฝ•ๆˆไธบไธ€ไธชๆจกๅ—๏ผŒpython็š„ๅฅ‡ๅฆ™่ง„ๅˆ™~
#!/usr/bin/env python3 # If imports fail, try installing scispacy and the model: # pip3 install scispacy # pip3 install https://s3-us-west-2.amazonaws.com/ai2-s2-scispacy/releases/v0.2.0/en_core_sci_md-0.2.0.tar.gz import sys import os import re import scispacy import spacy from sspostproc import refine_split DOC...
# -*- coding: utf-8 -*- """ Created on Mon Dec 14 18:17:10 2020 @author: Manuel Camargo """ import tests.read_log as rl import tests.analyzer_test as ats import tests.timeit_tests as tit import tests.timeline_split_tests as tst if __name__ == "__main__": ats.timeseries_test() ats.log_test() tit.execute_te...
#!/usr/bin/env python # -*- coding=utf-8 -*- ########################################################################### # Copyright (C) 2013-2017 by Caspar. All rights reserved. # File Name: fzcmeans.py # Author: Shankai Yan # E-mail: sk.yan@my.cityu.edu.hk # Created Time: 2017-01-23 12:52:12 #########################...
# Faรงa um programa que leia o nome completo de uma pessoa, mostrando em seguida o primeiro e o รบltimo nome separadamente. n = str(input('\nType your full name:\n>>> ')).strip().title() n1 = n.split() print('\nYour first name {} and your last name {}.\n'.format(n1[0], n1[-1]))
from selenium.webdriver.common.by import By from selenium.webdriver.support import expected_conditions as ec from selenium.webdriver.support.ui import WebDriverWait from page_objects.login_page import LoginPage from tools.webdriver_factory import WebdriverFactory class TestLogin: def setup_method(self, method):...
class Config(object): DEBUG = False SQLALCHEMY_DATABASE_URI = '' SECRET_KEY = 'dbbc933946e04a729b17c0625b72e3db' MAIL_SERVER = 'smtp.gmail.com' MAIL_USERNAME = '' MAIL_PASSWORD = '' MAIL_PORT = 465 MAIL_USE_SSL = True MAIL_USE_TLS = False MAIL_SUPPRESS_SEND = False SQLALCHEM...
# -*- coding: utf-8 -*- ''' :codeauthor: :email:`Nicole Thomas <nicole@saltstack.com>` ''' # Import Python libs from __future__ import absolute_import # Import Salt Testing libs from salttesting import TestCase, skipIf from salttesting.helpers import ensure_in_syspath from salttesting.mock import ( NO_MOCK, ...
import os from distutils.version import StrictVersion from pathlib import Path from warnings import warn from ..utils.translations import trans try: from qtpy import API_NAME, QtCore except Exception as e: if 'No Qt bindings could be found' in str(e): raise type(e)( trans._( ...
__version__ = '0.1.1' from .tools import underline2hump, hump2underline, json_hump2underline
import pywikibot import redis from api.translation_v2.core import Translation from page_lister import get_pages_from_category from redis_wikicache import RedisPage, RedisSite if __name__ == '__main__': # print(translate_using_postgrest_json_dictionary('mat', '[[mine|Mine]]', 'en', 'mg')) # print(translate_usi...
keysDict = { 'YawLeftButton': 0x1E, # Key A 'YawRightButton': 0x20, # Key D 'PitchUpButton': 0xB5, # NUM / 'PitchDownButton': 0x37, # NUM * 'RollLeftButton': 0x4E, # NUM + 'RollRightButton': 0x9C, # NUM ENTER 'EnableFSD': 0x24, # Key J 'EngineBoost': 0x0F, # Key Tab 'Speed100': 0x47,...
import torch from .stft import STFT from librosa.filters import mel as librosa_mel_fn from .functional import dynamic_range_compression, dynamic_range_decompression import numpy as np class MelSTFT(torch.nn.Module): def __init__(self, filter_length=1024, hop_length=16 * 8, win_length=1024, n_mel_...
#!/usr/bin/python # -*- coding: utf-8 -*- """ Created on 26/04/2016 Versรฃo 1.0 @author: Ricieri (ELP) Python 3.4.4 """ """ Reviewed on 15/10/2020 Versรฃo 1.0 rev.A - rounded printing values to 3 decimal places and displays 'ยฐC' instead of 'ยบC'. @author: Marcelo (ELP) Python 3.8.6 """ """ Reviewed on 06/05/2021 Versรฃo 1...
DEBUG = False BCRYPT_LEVEL = 12 # Configuration for the Flask-Bcrypt extension from settings.local_settings import *
import requests, json def activities(activity): # Get Activity ID switch = { 1: "755600276941176913", 2: "755827207812677713", 3: "773336526917861400", 4: "814288819477020702" } return switch.get(activity, "755600276941176913") print("--------------------------------") # He...
# # 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, software # ...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Fri Feb 14 09:31:37 2020 @author: natnem """ import math def countingSort(array, exp): n = len(array) out = [0]*n count = [0]*10 for i in range(n): index = (array[i]//exp) % 10 count[index] += 1 for i in range(1,10): ...
from django.shortcuts import redirect from rest_framework import permissions, viewsets from rest_framework.decorators import api_view, permission_classes from . import models from . import serializers from ..scraps.models import Scrap class ScrapBookViewSet(viewsets.ModelViewSet): queryset = models.ScrapBook.obj...
import numpy as np import os.path from keras.models import load_model, Model from keras.callbacks import ModelCheckpoint, EarlyStopping, CSVLogger from python_research.experiments.utils import ( TimeHistory ) from python_research.experiments.multiple_feature_learning.builders.keras_builders import ( bui...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- from collections import Iterable, Iterator def g(): yield 1 yield 2 yield 3 print('Iterable? [1, 2, 3]:', isinstance([1, 2, 3], Iterable)) print('Iterable? \'abc\':', isinstance('abc', Iterable)) print('Iterable? 123:', isinstance(123, Iterable)) print('It...
from tkinter import ttk, Frame, Label, Entry, Button, LEFT, font from models.repositories.credentials_repository import CredentialsDatabase from settings import CREDENTIALS_DB, SALT import sys sys.path.append("..") from providers.password_encrypt_provider import PasswordEncryptProvider class PasswordPage(Frame): ...
import pygame from pygame.locals import * import random import sys from settings import * pygame.font.init() pygame.init() class Pad(pygame.sprite.Sprite): def __init__(self): super(Pad, self).__init__() self.width, self.height = 95,95 self.image = pygame.Surface((self.wid...
""" # Script: polyEvaluateTest.py # # Description: # Unit test for the polyEvaluate command. # ############################################################################## """ import maya.cmds as cmds import unittest class PolyEvalutateTest(unittest.TestCase): def testPolyEvaluate(self)...
#---------------------------------------------------------------------- # LinMoTube # by Jake Day # v1.2 # Basic GUI for YouTube on Linux Mobile #---------------------------------------------------------------------- import ctypes, os, requests, io, sys, subprocess, gi, json, threading from urllib.parse import urlpars...
""" @author: maffettone SVM models for classification and regression """ from sklearn.svm import SVC from sklearn.svm import SVR def gen_classifier(params): clf = SVC(probability=False, C=params['C'], gamma=params['gamma'] ) return clf def gen_regressor(params): ...
from .data_archive import * # noqa from .limit_monitor import * # noqa from .openmct import * # noqa
#!/usr/bin/python # -*- coding:utf-8 -*- # ้ๅކๆ น่ต„ไบง็š„ๅญๅŸŸๅ import sys import requests import threading import time,json,re from bs4 import BeautifulSoup class subdomain(object): def __init__(self,url): self.url = url self.set_dns = set() self.set_ip138 = set() self.set_crt = set() ...
from pkwscraper.lib.controller import Controller """ This example shows the invalid votes percentage in communes (gminy). It also shows how much of these votes where invalid because of putting voting mark next to 2 or more candidates. This is considered to be main indication of probability of elections falsification....
# coding=utf-8 # Copyright 2018 The Tensor2Tensor Authors. # # 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...
import os class GeneralConfig: # General validation_split = 0.2 seed = 42 verbose = True architecture_type = "PretrainedResNet50" # Data image extension image_extension = ".jpg" pip_packages = [ "tensorflow==2.2", "numpy", "pandas", "matplotlib", ...
from .GeometricRestriction import GeometricRestriction class SizingClusterAreas(GeometricRestriction): """The SizingClusterAreas object defines a sizing cluster areas geometric restriction. The SizingClusterAreas object is derived from the GeometricRestriction object. Notes ----- This object can...
import logging import logging.handlers from traceback import format_stack from brotab.inout import in_temp_dir def _init_logger(tag, filename: str): FORMAT = '%(asctime)-15s %(process)-5d %(levelname)-8s %(filename)s:%(lineno)d:%(funcName)s %(message)s' MAX_LOG_SIZE = 50 * 1024 * 1024 LOG_BACKUP_COUNT = ...
import cv2 import numpy as np from numpy.linalg import norm import os import json SZ = 20 PROVINCE_START = 1000 MAX_WIDTH = 2000 def point_limit(point): if point[0] < 0: point[0] = 0 if point[1] < 0: point[1] = 0 def deskew(img): m = cv2.moments(img) if abs(m['mu02']) < 1e-2: ...
""" Test method for Sub opcode """ from easier68k.simulator.m68k import M68K from easier68k.core.opcodes.cmpi import Cmpi from easier68k.core.models.assembly_parameter import AssemblyParameter from easier68k.core.enum.ea_mode import EAMode from easier68k.core.enum.register import Register from easier68k.core.enum.op_...
from typing import Mapping from collections import OrderedDict import copy from torch.utils.data import DataLoader from catalyst.core.callback import Callback, CallbackOrder from catalyst.core.runner import IRunner class PeriodicLoaderCallback(Callback): """Callback for runing loaders with specified period. ...
from google.appengine.ext.webapp.mail_handlers import InboundMailHandler from google.appengine.runtime import apiproxy_errors from google.appengine.ext import ndb from models.rawmail import RawMail from models.post import Post from models.settings import Settings from models.userimage import UserImage from models.slug ...
"""Multiple Correspondence Analysis (MCA)""" import numpy as np import pandas as pd from sklearn import utils from . import ca from . import one_hot class MCA(ca.CA): def fit(self, X, y=None): utils.check_array(X, dtype=[str, np.number]) if not isinstance(X, pd.DataFrame): X = pd.D...
listOfWords = ['wordOne', 'wordTwo', 'wordThree', 'wordFour', 'wordFive'] listOfInts = [] for i in listOfWords: listOfInts.append(len(i)) print("List of words:" + str(listOfWords)) print("List of wordlength:" + str(listOfInts))
import asyncio import logging import os import random from aiohttp import WSServerHandshakeError, ClientConnectorError from cryptology import ClientWriterStub, Keys, run_client, exceptions from datetime import datetime from decimal import Context, ROUND_DOWN, Decimal from pathlib import Path from typing import Optiona...
#!/usr/bin/python #coding:utf-8 from bs4 import BeautifulSoup import requests url='http://www.moko.cc/mtb.html' r=requests.get(url, verify=False) content=r.content soup=BeautifulSoup(content,'lxml') modlist=soup.find_all('div','sub_show') link=[] for i in modlist: if i==modlist[-1] or i==modlist[0]: continu...
import pytest # run tests only if snappy is available snappy = pytest.importorskip("snappy") def test_snappy(): import snappy from snappy import (ProductIO, ProductUtils, ProgressMonitor, jpy)
from collections import Counter import nltk from nltk import * import numpy as np import xml.etree.ElementTree as ET import tmx trigram_measures = nltk.collocations.TrigramAssocMeasures() bigram_measures = nltk.collocations.BigramAssocMeasures() class CorpusUtil(object): __slots__ = 'tokenFrequencies', 'nGr...
from aiogram import types from aiogram.dispatcher import FSMContext from aiogram.dispatcher.filters import Text from misc import bot, dp, admin_ids from certificate import Certificate, get_all_certificates, set_all_certificates import logging from .menu import menu_keyboard from .states import AdminState, admin_keyboar...
n1 = float(input("Digite um nรบmero: ")) print("O sucessor de {} รฉ {} e o seu antecessor รฉ de {}" .format(n1,n1+1,n1-1))
# vim: tabstop=4 shiftwidth=4 softtabstop=4 """ [VRM DRIVER] VRM CLIENT. """ from cinder.openstack.common import log as logging from cinder.openstack.common.gettextutils import _ from cinder.volume.drivers.huawei.vrm.base_proxy import BaseProxy TASK_WAITING = 'waiting' TASK_RUNNING = 'running' TASK_SUCCESS = 'suc...
from collections import namedtuple from csv import QUOTE_ALL from unittest import TestCase import pytest from bonobo import CsvReader, CsvWriter from bonobo.constants import EMPTY from bonobo.util.testing import ( BufferingNodeExecutionContext, ConfigurableNodeTest, FilesystemTester, ReaderTest, WriterTest ) csv...
from textwrap import dedent import re from ansi2html import Ansi2HTMLConverter import mistune from jinja2 import Markup import pygments import pygments.lexers from pygments.lexer import RegexLexer, bygroups from pygments.token import Generic, Text, Comment import pygments.formatters.html ansi_convertor = Ansi2HTMLCo...
class Cell: pass class Fish(Cell): name = 'F' @staticmethod def update(neighbours): cnt = neighbours.count(Fish.name) if cnt == 2 or cnt == 3: return Fish() else: return Void() class Crayfish(Cell): name = 'C' @staticmethod def update(nei...
# flake8: noqa from __future__ import unicode_literals import sys import django from django.conf import settings # removed get_queryset <> get_query_set see, #29 #from django.db.models import Manager ## Monkey patch: # #try: # Manager.get_query_set = Manager.get_queryset #except AttributeError: # Manager.get_q...
name = 'lib_csv' title = 'lib_csv: functions to read and write csv files' version = '0.1.0' url = 'https://github.com/bitranox/lib_csv' author = 'Robert Nowotny' author_email = 'rnowotny1966@gmail.com' shell_command = 'lib_csv' def print_version() -> None: print('version: 0.1.0') def print_info() -> None: p...
# -*- coding: utf-8 -*- # Generated by Django 1.11.1 on 2017-09-12 19:12 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('logger', '0040_auto_20170912_1504'), ] operations = [ migrations.AlterField...