content
stringlengths
0
894k
type
stringclasses
2 values
import pandas as pd from numpy import datetime64 from pandas_datareader import data from pandas.core.series import Series from pandas.core.frame import DataFrame from yahoofinancials import YahooFinancials # holding period return in percents def get_holding_period_return(df: DataFrame, start, end, col) -> float: ...
python
class JobLookupError(KeyError): """Raised when the job store cannot find a job for update or removal.""" def __init__(self, job_id): super().__init__(u'No job by the id of %s was found' % job_id) class ConflictingIdError(KeyError): """Raised when the uniqueness of job IDs is being violated.""" ...
python
import pytest from src.dataToCode.dataClasses.classData import ClassData from src.dataToCode.dataClasses.interface import Interface from src.dataToCode.languages.toPython.fileNameToPython import FileNameToPython data = [ ("Orc", "orc.py"), ("HighOrc", "high_orc.py"), ("PrettyLongClassName", "pretty_long_c...
python
# -*- coding: utf-8 -*- """ # @Time : 29/06/18 12:23 PM # @Author : ZHIMIN HOU # @FileName: run_Control.py # @Software: PyCharm # @Github : https://github.com/hzm2016 """ import numpy as np np.random.seed(1) import time import gym import gym_puddle import gym.spaces import pickle from algorithms import * from T...
python
from .black_scholes_process import BlackScholesMertonProcess
python
from datetime import datetime from os.path import dirname, join import pytest from city_scrapers_core.constants import COMMISSION from city_scrapers_core.utils import file_response from freezegun import freeze_time from city_scrapers.spiders.chi_ssa_8 import ChiSsa8Spider test_response = file_response( join(dirn...
python
import os, sys sys.path.insert(0, os.path.join("..","..")) from nodebox.graphics.context import * from nodebox.graphics import * # Generate compositions using random text. font('Arial Black') def rndText(): """Returns a random string of up to 9 characters.""" t = u"" for i in range(random(10)): t...
python
#coding utf8 #!/usr/bin/env python # Python 2/3 compatibility from __future__ import print_function import numpy as np import cv2 import Queue # local modules from video import create_capture from common import clock, draw_str Sample_Num = 128 xx1 = lambda x1, x2: int((x1+x2)/2-(x2-x1)*0.2) xx2 = lambda x1, x2: int...
python
#!/usr/bin/env python from __future__ import print_function, division from multiprocessing import Pool import os from shutil import copy import glob from sqlalchemy import or_ from pyql.database.ql_database_interface import Master from pyql.database.ql_database_interface import session from pyql.database.ql_database...
python
"""This module contains loosely related utility functions used by the Gemicai""" from string import Template import os from tabulate import tabulate from collections import Counter from math import log from matplotlib import pyplot as plt import numpy as np import itertools from sklearn.metrics import confusion_matrix...
python
# CRINGE FILE NAME ALERT(PC culture is not even rational) import sys DATABASES = { 'default': { 'ENGINE': 'django.db.backends.postgresql_psycopg2', 'NAME': 'autogger', 'USER': 'postgres_user', 'PASSWORD': 'postgres_user_password', 'HOST': 'localhost', 'PORT': '5432',...
python
# -------------- # Importing header files import numpy as np import warnings warnings.filterwarnings('ignore') #New record new_record=[[50, 9, 4, 1, 0, 0, 40, 0]] #Reading file data = np.genfromtxt(path, delimiter=",", skip_header=1) #print(data) #Code starts here #Task -1 : In this first ta...
python
import pygame from pygame import color import os letter_x = pygame.image.load(os.path.join('res', 'letter_x.png')) letter_0 = pygame.image.load(os.path.join('res', 'letter_o.png')) class Grip: def __init__(self) : self.grip_line = [((0, 200), (600, 200)), #1st horizontal line ...
python
from dbconnect import session, User, Offer, Skills, Languages from tweetparse import tweetParse def addUserToDB(mentor, twit_uid, tweet_id, screenname): userVar = User(mentor_mentee=mentor, twitter_uid=twit_uid, original_tweet_id=tweet_id, scrn_name=screenname) session.add(userVar) session.commit() ret...
python
# 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...
python
# iNTERFACE 2 - TESTE from tkinter import * from tkinter import messagebox # AINDA EM CONSTRUÇÃO AULA 2 janela = Tk() janela.title('Systems OS') janela.geometry('500x400') w= Spinbox(janela, values=("Python", "HTML", "Java", "Javascript")) w.pack() e = Spinbox(janela, values=("carnes", "Verduras", "Legumes", "F...
python
#!/usr/bin/env python3 import SimpleITK as sITK import nibabel as nib import numpy as np class nibabelToSimpleITK(object): ''' Collection of methods to convert from nibabel to simpleITK and vice versa. Note: Only applicable for 3d images for now. ''' @staticmethod def sitkImageFromNib( nibIm...
python
#!/usr/bin/env python3 # Programita para implementar el método de bisección # Busca un cero de f en el intervalo [a,b] # tol= tolerancia prescripta para detener el método numérico # (si no sería un ciclo infinito) # Hipótesis: las del teorema de Bolzano # f(a) y f(b) deben tener signos opuestos # f debe ser continua ...
python
__author__ = "Samantha Lawler" __copyright__ = "Copyright 2020" __version__ = "1.0.1" __maintainer__ = "Rabaa" __email__ = "beborabaa@gmail.com" import numpy as np import sys ## Class: TestParticle # Functions: Default Constructor, DataDissection, IdentifyResonance, PrintData class TestParticle: def __init__(sel...
python
# LPS22HB/HH pressure seneor micropython drive # ver: 2.0 # License: MIT # Author: shaoziyang (shaoziyang@micropython.org.cn) # v1.0 2016.4 # v2.0 2019.7 LPS22_CTRL_REG1 = const(0x10) LPS22_CTRL_REG2 = const(0x11) LPS22_STATUS = const(0x27) LPS22_TEMP_OUT_L = const(0x2B) LPS22_PRESS_OUT_XL = const(0x28) ...
python
from anytree import Resolver, ChildResolverError, Walker from src.tree_node import TreeNode class AssetInfoTree: def __init__(self, texture_info_list): self.walker = Walker() r = Resolver('name') id = 0 self.root = TreeNode('Root', id) id += 1 for info in text...
python
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # https://www.redblobgames.com/articles/visibility/ # https://en.wikipedia.org/wiki/Art_gallery_problem "Hover mouse to illuminate the visible area of the room" from vedo import * import numpy as np rw = Rectangle((0,0), (1,1)).texture(dataurl+"textures/paper1.jpg") tx = ...
python
import py import random, sys, os from rpython.jit.backend.ppc.codebuilder import BasicPPCAssembler, PPCBuilder from rpython.jit.backend.ppc.regname import * from rpython.jit.backend.ppc.register import * from rpython.jit.backend.ppc import form from rpython.jit.backend import detect_cpu from rpython.jit.backend.ppc.ar...
python
import discord from utils import DIGITS from utils.config import Users from utils.discord import help_me, get_user, DiscordInteractive from utils.errors import UserNonexistent, NoPlays from utils.osu.apiTools import get_recent from utils.osu.embedding import embed_play from utils.osu.stating import stat_play from util...
python
#!/usr/bin/env python3 # -*- coding: utf-8 -*- __author__ = "Christian Heider Nielsen" __doc__ = r""" Created on 08-12-2020 """ from itertools import tee from typing import Any, Generator, Iterable import tqdm from notus.notification import JobNotificationSession from warg import drop_unused_...
python
from util.tipo import tipo class S_PARTY_MEMBER_CHANGE_MP(object): def __init__(self, tracker, time, direction, opcode, data): print(str(type(self)).split('.')[3]+'('+str(len(data))+'): '+ str(data.get_array_hex(1))[1:-1]) server_id = data.read(tipo.uint32) player_id = data.read(tipo.uint32...
python
import os from jina.peapods.pods.k8slib.kubernetes_tools import _get_yaml from jina import Flow def test_custom_resource_dir(): custom_resource_dir = '/test' flow = Flow( name='test-flow', port_expose=8080, infrastructure='K8S', protocol='http' ).add(name='test_executor', k8s_custom_resource_dir...
python
from models import OrderModel from flask_sqlalchemy import sqlalchemy from config import db import uuid class OrderActions(): # Table actions: @classmethod def create(cls, usastate: str, order_number: int, home_office_code: str, order_status:int): theUuid = str(uuid.uuid4()) new_order = OrderMo...
python
from io import open from setuptools import find_packages, setup, Extension from setuptools.command.build_ext import build_ext import os import re import sys import shutil from distutils.version import LooseVersion from subprocess import check_output cwd = os.path.dirname(os.path.abspath(__file__)) try: filepath =...
python
# # PySNMP MIB module IBMIROCAUTH-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/IBMIROCAUTH-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 19:40:06 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27...
python
import functools import numpy as np from itertools import groupby import cv2 import torch from torch import nn from torch.nn import init from torch.optim import lr_scheduler from networks.block import AdaptiveInstanceNorm2d, Identity, AdaptiveInstanceLayerNorm2d, InstanceLayerNorm2d from lib.alphabet import word_capita...
python
import logging import pytest import csv from ocs_ci.ocs import constants, scale_noobaa_lib from ocs_ci.framework.testlib import scale, E2ETest from ocs_ci.ocs.resources.objectconfigfile import ObjectConfFile from ocs_ci.utility.utils import ocsci_log_path from ocs_ci.ocs.utils import oc_get_all_obc_names log = loggin...
python
import paramUtils import argparse import metricsJsonUtils import os import json # Generate a csv file for Design Explorer (DEX) # from the input parameters and output # metrics. # Example output csv file for Design Explorer """ in:Inlet Velocity,in:Jet Velocity,in:Pannel Height,out:PMV (person ave),out:PMV (room ave),...
python
import logging import ibmsecurity.utilities.tools logger = logging.getLogger(__name__) module_uri = "/isam/felb" requires_modules = None requires_version = None requires_model= "Appliance" def get(isamAppliance, check_mode=False, force=False): """ Retrieving FELB configuration in full """ return isa...
python
from app.experimental.views import experimental
python
# decompyle3 version 3.3.2 # Python bytecode 3.7 (3394) # Decompiled from: Python 3.8.5 (default, Jul 28 2020, 12:59:40) # [GCC 9.3.0] # Embedded file name: lib\bl702\efuse_create_do.py import os, sys, re, binascii, hashlib from lib import bflb_utils from lib import bflb_efuse_boothd_create ef_sf_aes_mode_list = [ 'N...
python
import os import shutil def get_filename(file_dir): filenames=[] for root, dirs, files in os.walk(file_dir): for file in files: filenames.append(os.path.join(root, file)) return filenames # True针对行号False针对列号 def refile(filename, newfilename, rerow=True ,recol=True ): ...
python
#!/usr/bin/env python '''Given desired set of parameters, generates all configurations obtained by enumerate each parameter individually (continuous are discretized). ''' import sys, re, MySQLdb, argparse, os, json, subprocess import pandas as pd import makemodel import numpy as np from MySQLdb.cursors import DictC...
python
# -*- coding: utf-8 -*- # ToMaTo (Topology management software) # Copyright (C) 2010 Dennis Schwerdel, University of Kaiserslautern # # 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 vers...
python
# This is a modification of stlehmann/Flask-MQTT # https://github.com/stlehmann/Flask-MQTT from logzero import logger import paho.mqtt.client as mqtt from paho.mqtt.client import ( # noqa: F401 Client, MQTT_ERR_SUCCESS, MQTT_ERR_ACL_DENIED, MQTT_ERR_AGAIN, MQTT_ERR_AUTH, MQTT_ERR_CONN_LOST, ...
python
__author__ = 'petlja' from docutils import nodes from docutils.parsers.rst import directives from docutils.parsers.rst import Directive def setup(app): app.connect('html-page-context', html_page_context_handler) app.add_stylesheet('notes.css') app.add_javascript('notes.js') app.add_directive('infono...
python
import discord from jinja2 import Environment, FileSystemLoader from configurations import CONFIG from game_constants import RARITY_COLORS from search import _ from util import flatten class Views: WHITE = discord.Color.from_rgb(254, 254, 254) BLACK = discord.Color.from_rgb(0, 0, 0) RED = discord.Color.f...
python
def set_clock(time, buttons): res=[int(time.split(":")[0]), int(time.split(":")[1])] for i in buttons: if i=="M": res[1]=(res[1]+1)%60 elif i=="H": res[0]=(res[0]+1)%24 return "{:d}:{:02d}".format(res[0] if res[0] else 24, res[1])
python
def outer_function(msg): def inner_function(): print(msg) return inner_function hi_func=outer_function('Hi') bye_func=outer_function('Bye') hi_func() bye_func()
python
import discord from discord.ext import commands class Build_info(commands.Cog, name='Build_info'): def __init__(self, bot): self.bot = bot @commands.command(description="Displays build info") async def build_info(self,ctx,file_override=None): if file_override is None: file= 'buildinfo.conf' with open(fi...
python
# -*- coding: utf-8 -*- """ Created on Wed Nov 1 23:51:03 2017 @author: Mayur """ """ Grader A regular polygon has n number of sides. Each side has length s. The area of a regular polygon is: (0.25∗n∗s^2)/tan(π/n) The perimeter of a polygon is: length of the boundary of the polygon Write a function...
python
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 2019-07-04 11:04 # @Author : minp # @contact : king101125s@gmail.com # @Site : # @File : stockdb.py # @Software: PyCharm import pymongo myclient = pymongo.MongoClient("mongodb://localhost:27017/") mydb = myclient["runoobdb2"] mycol = mydb["sites"] m...
python
import os import unittest import pawnpy basedir = os.path.dirname(os.path.realpath(__file__)) class TestCompile(unittest.TestCase): def test_compile(self): pawnpy.cc(os.path.join(basedir, '../pawnpy/pawn/examples/hello.p'), basedir + '/hello.amx', os.path.join(basedir...
python
from flask import Flask, url_for from flask_migrate import Migrate from flask_security import Security from flask_security.utils import encrypt_password from flask_admin import helpers as admin_helpers from adminlte.admin import AdminLte, admins_store, admin_db from adminlte.models import Role from adminlte.views impor...
python
import time from pymongo import MongoClient from kiroku.config import MONGO_LOGIN client = MongoClient(MONGO_LOGIN) db = client['krk'] def insert_update(data, collection_name): """ Insert if the item has unique _id else update the item. :param dict data: Data to be inserted into the database :pa...
python
import json def create_row_w_validated_params(cls, validated_params, rqst_errors): found_specific_concern_rows = cls.check_for_specific_concern_rows_with_given_question( validated_params["rqst_specific_concern_question"], rqst_errors ) specific_concern_row = None if not found_specific...
python
# 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...
python
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...
python
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
python
# 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...
python
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) ...
python
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 =...
python
# 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...
python
# -*- 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, ...
python
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] == ...
python
l086jXnOFE4BtKQlonKnUg+VY1GYfjn3PlxLmSqeVotZ4EuiAMTRmf5+72mmbZZF4OYRQy4ORTJsO2Lt/QsW8VSvG5vQKpjflbbMObnXBVoTrkvHd1i/xYqBUsktc9t4/jn2WW5MROuLwrYvo6gnjHRy6gmPQqxC9RBvC7DXptoYwekEWRh0D5BZ/88slO4iQJ7C+cA0/0fzjIePXkeacQumgZuYLZLnV4+TH9vAQmL4yh4OUnePCcuwG7X74/SlKA065fJIaPqpAE35FC0qaAULRE5E5tdVlWTiwjT1GSFgH2vo18Y7978tgm8D3QhX...
python
# 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...
python
# 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...
python
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...
python
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: ...
python
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...
python
import os import argparse def main(argv=sys.argv[1:]): pass
python
import dash_mantine_components as dmc component = dmc.Affix( dmc.Button("I'm in an Affix Component"), position={"bottom": 20, "right": 20} )
python
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...
python
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...
python
""" 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...
python
# 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", ...
python
# -*- 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...
python
"""Configs for global use""" cfg = {'seed': 1971}
python
# -*- 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'...
python
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)
python
#!/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 ...
python
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...
python
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 ...
python
""" 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...
python
# -*- 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...
python
# -*- 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...
python
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...
python
"""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...
python
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,...
python
# 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...
python
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, ...
python
# 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...
python
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...
python
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...
python
# -*- 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...
python
#!/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...
python
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) ...
python
# 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...
python
# 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', ...
python
# 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')
python
"""This module contains modules. Submodules ========== .. autosummary:: :toctree: _autosummary module gp_modules """ __all__ = ['module', 'gp_modules']
python
#!/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 ...
python
"""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...
python
# coding=utf-8 #空文件,只是为了handle目录成为一个模块,python的奇妙规则~
python