content stringlengths 5 1.05M |
|---|
import functools
class Solution:
def largestNumber(self, nums: List[int]) -> str:
s = [str(i) for i in nums]
def comp(a, b):
if (a + b) > (b + a):
return 1
if (a + b) < (b + a):
return -1
return 0
# 这里加了一次 int 转换过程,用于处理第... |
# encoding: utf-8
"""Parameterized support akin to Django's ORM or MongoEngine."""
from __future__ import unicode_literals
import operator
from ..query import Filter
from .common import _deferred_method, _operator_choice, _process_arguments
DEFAULT_FILTER = operator.eq
FILTER_PREFIX_MAP = {
'not': operator.inve... |
del "Hello world!"
|
# pylint: disable=no-self-use,invalid-name,bad-continuation
import json
import os
import re
import tempfile
import pytest
from allennlp.common.params import Params, unflatten, with_fallback, parse_overrides
from allennlp.common.testing import AllenNlpTestCase
class TestParams(AllenNlpTestCase):
def test_load_f... |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
from enum import Enum
class DriverType(Enum):
"""Communication driver categories.
- ZMQ: The communication driver mode based on ``ZMQ``.
"""
ZMQ = "zmq_driver"
|
"""A mathematical package for all common learnergy modules.
"""
|
import os
def set_gpus(gpu_index):
if type(gpu_index) == list:
gpu_index = ','.join(str(_) for _ in gpu_index)
if type(gpu_index) ==int:
gpu_index = str(gpu_index)
os.environ["CUDA_VISIBLE_DEVICES"] = gpu_index
|
# direct inputs
# source to this solution and code:
# http://stackoverflow.com/questions/14489013/simulate-python-keypresses-for-controlling-a-game
# http://www.gamespp.com/directx/directInputKeyboardScanCodes.html
import ctypes
SendInput = ctypes.windll.user32.SendInput
keys = {
"ESCAPE" : 0x01,
"1"... |
####################################
# #
# MGRSSET/MGRSLIST PARENT CLASS #
# #
####################################
class _gridStruct(object):
def __containsOnlyGrids(self):
test = [True if isinstance(i,Gri... |
#!/usr/bin/env python
"""Calculates an approximation of the expected $\Delta \alpha/\alpha$ models from the King, et al. (2012).
It also can calculate the expected error of these predictions with some caveats.
Important caveats
=====================
The asymmetric 1-sigma error bars are reported, but without a prec... |
from automile.automile_api import AutomileAPI
api = AutomileAPI(username="xx", password="xx",
api_client="xx.automile.com", api_secret="xx")
def example0():
""" Create a test user in automile to get credentials
:return:
"""
pass
def example1(api):
"""List all trips
"""
... |
from chain.common.interfaces import IPlugin
from .queue import Queue
class Plugin(IPlugin):
name = "process_queue"
def register(self):
return Queue()
|
'''
*
*
* Jython Annotation Tools.
*
* A library enabling Java annotations and
* SpringFramework integration for Jython classes.
*
* http://www.wstech2.net/jat/
*
* Copyright 2016 rotsen.marcello@wstech2.net.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* yo... |
import pandas as pd
import numpy as np
def flights_preclean(df):
"""
Input: Raw dataframe of Flights table.
Output: Cleaned flights table:
- Remove cancelled rows, made available in new dataframe "df_can"
- Drop columns ['Unnamed: 0', 'branded_code_share',
'mkt_carrier', 'cancell... |
# Function to find the waiting time for all processes
def findWaitingTime(processes, n, bt, wt):
wt[0] = 0 # waiting time for first process is 0
# calculating waiting time
for i in range(1, n ):
wt[i] = bt[i - 1] + wt[i - 1]
# Function for turn around time
def findT... |
import numpy as np
import re
input = """on x=-20..26,y=-36..17,z=-47..7
on x=-20..33,y=-21..23,z=-26..28
on x=-22..28,y=-29..23,z=-38..16
on x=-46..7,y=-6..46,z=-50..-1
on x=-49..1,y=-3..46,z=-24..28
on x=2..47,y=-22..22,z=-23..27
on x=-27..23,y=-28..26,z=-21..29
on x=-39..5,y=-6..47,z=-3..44
on x=-30..21,y=-8..43,z=... |
from bottle import route, run, template
@route('/')
def index():
return '<html><b>We are devops rockstars!!</b></html>'
run(host='0.0.0.0', port=8000)
|
# -*- coding: utf-8 -*-
import dao.ReservationDAO as ReservationDAO
import manager.PermissionManager as PermissionManager
import manager.HotelManager as HotelManager
import manager.RoomManager as RoomManager
import dao.HotelDAO as HotelDAO
def make_reservation(person):
if PermissionManager.has_permission_view_h... |
# Generated by Django 3.1.8 on 2021-04-16 12:19
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("barriers", "0104_auto_20210415_0836"),
]
operations = [
migrations.AlterField(
model_name="historicalpublicbarrier",
... |
class Word():
def __init__(self, text, alias, meta):
self.text = text
self.alias = alias
self.meta = meta
@property
def text(self):
return self.__text
@property
def alias(self):
return self.__alias
@property
def meta(self):
return self.__... |
import logging
import aiomysql
import asyncio, os, json, time
from datetime import datetime
from aiohttp import web
from jinja2 import Environment, FileSystemLoader
import orm
from coroweb import *
from handlers import cookie2user, COOKIE_NAME
import functools
import asyncio, inspect
from config import configs
logg... |
import torch.nn as nn
import numpy as np
def compute_flops(module, inp, out, DEBUG=False):
if isinstance(module, nn.Conv2d):
return compute_Conv2d_flops(module, inp, out)
elif isinstance(module, nn.BatchNorm2d):
return compute_BatchNorm2d_flops(module, inp, out)
elif isinstance(module, (nn... |
# -*- coding: utf-8 -*-
"""
Created on Wed Feb 27 14:32:15 2019
conda install pymysql
@author: Usuario
"""
import pymysql
from Produto import Produto
from Individuo import Individuo
from algoritmo_genetico import AlgoritimoGenetico
import matplotlib.pyplot as plt
if __name__ == "__main__":
#p1 = Produto(nome="Iph... |
class Solution:
def letterCombinations(self, digits):
"""
:type digits: str
:rtype: List[str]
"""
if digits == "":
return []
digits_dict = {
'2': 'abc',
'3': 'def',
'4': 'ghi',
'5': 'jkl',
'6': 'm... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import generators
from __future__ import nested_scopes
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import with_statement
import sys
import dicom
from util i... |
from enum import Enum
from serialclass import SerialClass
class ConfigKeys(str, Enum):
attributes = "attributes"
class ConfigAttributeKeys(str, Enum):
name = "name"
type = "type"
min = "min"
max = "max"
default = "default"
class ConfigValidation:
def _key_validation(valid_dict, keys):
... |
import setuptools
with open("README.md", "r", encoding="utf-8") as fh:
long_description = fh.read()
setuptools.setup(
name="popcat_wrapper",
version="1.6",
author="NotFaizen",
author_email="munavir370@gmail.com",
url = "https://github.com/NotFaizen/popcat_wrapper",
description="... |
from django.shortcuts import render, redirect
# Create your views here.
from notes.commans.profile_utilities import get_profile
from notes.users_notes.forms import CreateNote, EditNote, DeleteNote
from notes.users_notes.models import Note
def index(request):
profile = get_profile()
if not profile:
re... |
__version__ = '0.84-57-g73ae3793'
|
import discord
from discord.ext.commands import Bot
from discord.ext import commands
import asyncio
import time
Client = discord.Client()
client = client.Bot(command_prefix = "!")
@client.event
async def on_ready();
print("Bot is ready!")
@client.event
async def on_message(message);
if message.content == "hello"... |
from bert import modeling
from bert import tokenization as tkz
import tensorflow as tf
from models import CWS
import numpy as np,logging, sys, os
class BERT(CWS):
cfg = CWS.cfg.copy()
cfg.bert_config_file = os.path.join(cfg.data_dir,"bert/chinese_L-12_H-768_A-12/bert_config.json")
cfg.vocab_file = os.p... |
# python market_comp_csv_printer.py
import os
import requests
import json # need this to import json string into dictionary
from datetime import datetime # taken from stackoverflow
import csv # so you can write date to .csv
def usd_format(my_price):
return "${0:,.2f}".format(my_price) # This UDF will change nume... |
import datetime
from flask import redirect, request, url_for
from werkzeug.exceptions import BadRequest, NotFound
from pysite.base_route import RouteView
from pysite.constants import BotEventTypes, CHANNEL_MOD_LOG, EDITOR_ROLES
from pysite.decorators import csrf, require_roles
from pysite.mixins import DBMixin, RMQMi... |
from __future__ import print_function
from __future__ import division
import time
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as pl
# random.seed(int(time.time()))
def get_neighbour(img, pixel, pix_val=0):
x_max, y_max = img.shape
i, j = pixel
possible_neighbours = [(i - 1, j - ... |
# -*- coding: utf-8 -*-
# Copyright 2011 Takeshi KOMIYA
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
# -*- coding: utf-8 -*-
import time
from collections import defaultdict
from lumbermill.BaseThreadedModule import BaseThreadedModule
from lumbermill.utils.Decorators import ModuleDocstringParser, setInterval
from lumbermill.utils.DynamicValues import mapDynamicValue
from lumbermill.utils.misc import TimedFunctionManag... |
from Scripts.ClassifyFeaturesIntoCategoricalOrContinuous import ClassifyFeaturesIntoCategoricalOrContinuous
class FillNAsInDf(object):
def fillnas(self, df):
classify_object = ClassifyFeaturesIntoCategoricalOrContinuous()
classified_features_dict = classify_object.classify(df)
categorical_... |
# Generated by Django 3.0.1 on 2020-01-04 04:24
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('judge', '0006_auto_20200104_0423'),
]
operations = [
migrations.AlterField(
model_name='user',
name='num_problems_so... |
from celery import shared_task
from PIL import Image
import os
from . import models
@shared_task
def convert_and_save(image_pk):
try:
i = models.Image.objects.get(pk=image_pk)
f, e = os.path.splitext(i.image_fallback.path)
outfile = f + '.webp'
Image.open(f + e).save(outfile)
... |
import pytest
import torch
from torch import nn
import pugh_torch as pt
|
from logging import getLogger
from flask_socketio import emit
from flask_login import current_user
from .. import socketio, db
from ..models.room import Room
from ..models.user import User
from ..api.log import log_event
from ..socket_logic import room_logic
@socketio.on('room_created')
def room_created(data):
... |
import setuptools
VERSION = '1.0.5'
with open("README.md", "r", encoding="utf8") as fh:
long_description = fh.read()
setuptools.setup(
name="douzero",
version=VERSION,
author="Daochen Zha",
author_email="daochen.zha@tamu.edu",
description="DouZero DouDizhu AI",
long_description=long_descr... |
from collections import defaultdict
from random import uniform
class ZonotopeContext:
"""
A zonotope context creates and transforms affine forms. Each form is
represented as a dictionary. The items of the dictionary are pairs: (i, a)
where `i` is the index of a noise symbol and `a` is the respective
... |
from abc import abstractmethod
from .resultado import Resultado
import pandas as pd
from sklearn.base import ClassifierMixin, RegressorMixin
from typing import List,Union
class MetodoAprendizadoDeMaquina:
@abstractmethod
def eval(self,df_treino:pd.DataFrame, df_data_to_predict:pd.DataFrame, col_classe:str) ->... |
"""Unit tests for the substitute_json_keys module."""
import unittest
from type_extractor.substitute_json_keys import substitute_json_keys_with_natural_numbers
class SimplifyJsonKeysTests(unittest.TestCase):
def test_substitute_func_params_and_ret_type_keys(self):
json = {
"functions": {
... |
import re
import sys
from datetime import datetime
from pathlib import Path
from urllib.parse import urlparse
from git import Repo
def fetch_reset_new_branch_upstream(repo_path: Path):
print("* Starting to fetch from Comma Repo")
repo = Repo(repo_path)
# For people using Windows who use Git on Windows a... |
a = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89]
b = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]
def intersect(a, b):
# the & is for intersection, which will take the common between the two
return list(set(a) & set(b))
def main():
print(intersect(a, b))
if __name__ == "__main__":
main()
|
import json
class Cache:
"""
A Cache object that can store everything.
"""
def __init__(self):
with open("storage/cache.tmp", "r") as f:
self.data = json.loads(f.read())
def __str__(self):
return str(self.data)
def __len__(self):
return len(self.data)
... |
"""
MIT License
Copyright (c) 2021 Suffyx
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, publish, distri... |
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
'''
This tool wraps `yum` and its successor `dnf` to ensure more hermetic
behavior.
- This code should only ever be ... |
import sys, argparse, os
import rpy_parser, rpy_codegen
def main (argv):
parser = argparse.ArgumentParser(description="Convert Ren'py scripts into C code.")
parser.add_argument("source_rpy")
parser.add_argument("destination_folder")
opts = parser.parse_args()
with open(os.path.abspath(opts.source_... |
import logging
import os
from time import time
from typing import List, Optional, Text
import pyproj
import rasterio
from BaseCM.cm_output import validate
from rasterstats import zonal_stats
from shapely.geometry import shape
from shapely.ops import cascaded_union, transform
GEOJSON_PROJ = "EPSG:4326"
DEFAULT_STATS =... |
from django.db import models
from django.core.validators import RegexValidator
from cms.models import CMSPlugin
class ButtonPlugin(CMSPlugin):
foreground = models.ImageField(blank=False, null=True,
upload_to='cms/plugin/button',
verbose_name='Foreground Image')
background = models.Im... |
# coding=utf-8
# -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
# --------------------------------------------------------------------------
import sys
import logging
import os
import datetime
impo... |
#!/usr/bin/env python3
from bs4 import BeautifulSoup
baseUrl = 'https://pip.pypa.io/en/stable/reference/'
output = "output.txt"
outyo = open(output, "w");
import os
from os import path
pages = [f for f in os.listdir('./download/')]
out = {}
for page in pages:
finaltext = ''
hashtable = {}
with open(... |
def copy_dict_partial(
input_dict: dict, include_keys=None, exclude_keys=None
) -> dict:
new_dict = {}
old_keys = list(input_dict.keys())
if include_keys is None and exclude_keys is None:
for key in old_keys:
new_dict[key] = input_dict[key]
return new_dict
if include_ke... |
from extras.plugins import PluginMenuItem
menu_items = (
PluginMenuItem(
link='plugins:netbox_zero:root',
link_text='Netbox Zero',
buttons=()
),
)
|
# Copyright (c) 2020 Jonas Thorsell
import sys
n=[]
for l in sys.stdin:
n.append(int(l))
pre = 25
inv = None
for i in range(pre, len(n)):
n[i]
ok = False
for j in range(i-pre, i):
c = n[i] - n[j]
if (not c == n[j] and c in n[i-pre:i]):
ok = True
break
if no... |
from utils import *
from model import *
import sys
import torch.optim as optim
from torch import nn
import torch
from sklearn.metrics import accuracy_score, classification_report
def calc_true_and_pred(model, iterator):
all_preds = []
all_y = []
for idx,batch in enumerate(iterator):
if torch.cuda.... |
#!/usr/bin/env python
"""Command-line interface."""
import argparse
import subprocess
import sys
import time
import log
import yorm
from . import CLI, DESCRIPTION, VERSION, common, services
from .manager import get_manager
from .models import Application, Data
daemon = Application(CLI, filename=CLI)
def main(ar... |
import os
def execute(args, extra_args, controller):
search_conditions = controller.get_search_conditions(args, extra_args)
if len(args) == 0:
search_conditions['path'] = controller.get_git_root(os.getcwd())
repo_list = controller.get_repos(search_conditions)
index = 0
for repo in repo_... |
# This script santises the sympy latex in the HTML files prior to building the site
import os
import sys
from bs4 import BeautifulSoup
def sanitize_latex(filepath):
'''
Replace {{ with { { inside LaTeX outputs not to confuse Jekyll about what
should be interpolated.
'''
is_modified = False
soup... |
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import copy
import os
import parlai.utils.logging as logging
from parlai.core.agents import create_agent
from parlai.uti... |
"""
restful package
session module: get a session token
stream module: create stream, get stream by name , get stream by id
""" |
import os
from jinja2 import Template
from lan import Yaml, Utils, Log
from lan.commands.it.apis_tpl_code import get_apis_code_tpl
class Make(object):
def __init__(self, path='./'):
# 获取当前执行命令目录
self.project_path = path
# yaml init
self.yaml_apis = Yaml(self.project_path + '/config... |
import libzzuf
input = "a" * 200
print "Input: %s" % input
seed = 0 # A value from -0x7FFFFFE to 0x7FFFFFFF
ratio = 0.01 # A value from 0 to 1, read zzuf documentation
output = libzzuf.fuzz_buffer(seed, ratio, input)
print "Output: %s" % output
|
from pyps import workspace
class CallgraphPrinter:
def __init__(self):
self.indent=0
def visit(self, module):
print " "*self.indent + module.name
self.indent+=4
[ self.visit(n) for n in module.callees ]
self.indent-=4
with workspace("silber.c", verbose=False) as w :
... |
#!/usr/bin/python
from beem import Hive
from beem.account import Account
from beem.amount import Amount
from beem.block import Block
from beem.nodelist import NodeList
from beem.utils import formatTimeString
import pandas as pd
from collections import OrderedDict
from datetime import datetime
def init():
data = O... |
#!/usr/bin/env python
# -*- coding: utf-8 -*
import click
from bson.objectid import ObjectId
import schedule
import itchat
import _thread
import time
import sys
import os
from logbook import Logger, StreamHandler
from momenta.bot.wechat import do_send_message
from momenta.job.client import client, regist_job, get_m... |
from ._db_object import Db
from ._write import make_postgres_write_statement,make_postgres_write_multiple_statement
from ._read import make_postgres_read_statement, prepare_values
from ._update import make_postgres_update_statement
from ._update import make_postgres_update_multiple_statement
from ._delete import make_p... |
# Copyright 2021 Huawei Technologies Co., Ltd
#
# 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... |
import pathlib
text_path = pathlib.Path("../data/raw/test_text_2.txt")
text_l1_path = pathlib.Path("../data/processed/l1_text.txt")
text_l2_path = pathlib.Path("../data/processed/l2_text.txt")
text_l3_path = pathlib.Path("../data/processed/l3_text.txt")
if text_path.is_file():
with text_path.open("r") as reader:... |
from .score import BGe
|
#!/usr/local/bin/python
# -*- coding: utf-8 -*-
##
# A program that calculate an area of a farm with measures given by user
# The result is show in Acres
# @author: rafael magalhaes
SQFT_PER_ACRES = 43560
# Obtain the input from the user
print("Hello farmer, lets calculte your farmer area in acres.")
width... |
from __future__ import absolute_import, division, print_function
# LIBTBX_SET_DISPATCHER_NAME phenix.map_box
import mmtbx.utils
import mmtbx.model
from libtbx import adopt_init_args
from mmtbx.refinement import print_statistics
import libtbx.phil
from libtbx.utils import Sorry
import os, sys
from iotbx import reflecti... |
# -*- coding: utf-8 -*-
from apps.places.models import Place
def check_if_exists(place, session):
exists = session.query(Place).filter(Place.name == place.name).first() is not None
return exists
|
# Generated by Django 2.2.4 on 2020-06-01 16:22
import datetime
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
from django.utils.timezone import utc
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(setting... |
class Solution:
def numSpecial(self, mat: List[List[int]]) -> int:
if not mat and not mat[0]: return 0
rows = defaultdict(int)
cols = defaultdict(int)
for i, row in enumerate(mat):
for j, cell in enumerate(row):
if mat[i][j]:
rows[i] ... |
import numpy as np
import chainer
import os
import glob
from chainer import cuda, optimizers, serializers, Variable
import json
import h5py
from PIL import Image
from .dataset_augmentor import DatasetAugmentor
from chainer.dataset import dataset_mixin
import Augmentor.ImageUtilities
class BaseDataset(dataset_mixin.Da... |
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
def tink_go_deps():
if not native.existing_rule("io_bazel_rules_go"):
# Release from 2019-10-14
http_archive(
name = "io_bazel_rules_go",
urls = [
"https://storage.googleapis.com/bazel-mirro... |
import unittest
from CsvReader import CsvReader, ClassFactory
from pprint import pprint
class MyTestCase(unittest.TestCase):
def setUp(self) -> None:
self.csv_reader = CsvReader('/data/Unit Test Addition.csv')
def test_result_data_as_objects(self):
result = self.csv_reader.return_data_as_clas... |
from perspective import Client, Attributes
API_KEY = "AIzaSyA-yzvgANWE1STU9MTbTLrS3rj1956tVAs"
"""
+--------+-----------+
| Number | Level |
+--------+-----------+
| 50 | CRITICAL |
+--------+-----------+
| 40 | ERROR |
+--------+-----------+
| 30 | WARNING |
+--------+-----------+
| 20 | ... |
"""
Created May 4, 2016
Calculate satellite az/el in sky above observer using SkyField.
@author: EP-Guy
"""
import numpy as np
import pandas as pd
from skyfield.api import load
import matplotlib.pyplot as plt
from . import SkyPlot
from . import Observation
from . import Star
from . import Constellation
class Sa... |
from openedx_webhooks.github.models import GithubEvent
def test_sender(github_client):
expected = 'active-person'
payload = {
'sender': {
'login': expected,
},
}
event = GithubEvent(github_client, 'type', payload)
assert event.openedx_user.login == expected
def test_u... |
import sys
try:
import numpy
except ImportError:
print("Numpy (http://numpy.scipy.org) not found.")
print("This test requires numpy!")
sys.exit(0)
import vtk
from vtk.numpy_interface import dataset_adapter as dsa
from vtk.numpy_interface import algorithms as algs
rt = vtk.vtkRTAnalyticSource()
p2c =... |
from .module import arguments, fromarray, frompandas, fit, helpin, helpout
from PyLFMF._cppkernel import vector_LFMF, LFMF
|
opencv.addListener("publishOpenCVData", "python","onOpenCVData")
pid = Runtime.createAndStart("pid","Pid")
pid.setMode(1)
#set the range of the "correction"
pid.setOutputRange(-1, 1)
#set Kp, kd, ki kp = gain, how strong it react kd = how fast it react ki= take care of the sum of errors (differences between targ... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Feb 25 12:24:07 2018
@author: user
"""
from keras.models import Sequential
from keras.layers import TimeDistributed, Dense, Dropout, Conv2D, Activation, Reshape, InputLayer
from keras.layers.normalization import BatchNormalization
from keras.layers.rec... |
"""
Name: DebitTool_5.py
Author: Erik Anderson
Created: May 5, 2017
Revised: May 6, 2019
Version: Created using Python 2.7.10, Arc version 10.4.1
Requires: ArcGIS version 10.1 or later, Basic (ArcView) license or better;
Spatial Analyst extension
Path to the project's workspace is derived from the p... |
"""
@author:azi
@file:model.py
@time:2021/9/26
"""
from app.utills.core import db
class User(db.Model):
"""
用户的模型
"""
__tablename__ = 'user'
id = db.Column(db.Integer, autoincrement=True, primary_key=True)
username = db.Column(db.String(64), nullable=False, unique=True)
avatar = db.Column(... |
#!/usr/bin/env python
import mclevel
import sys
import os
from box import BoundingBox
import numpy
from numpy import zeros, bincount
import logging
import itertools
import traceback
import shlex
import operator
import codecs
from math import floor
try:
import readline
except:
pass
class UsageError(RuntimeErro... |
import RPi.GPIO as GPIO
import time
# setting a current mode
GPIO.setmode(GPIO.BCM)
#removing the warings
GPIO.setwarnings(False)
#creating a list (array) with the number of GPIO's that we use
pin = 14
#setting the mode for all pins so all will be switched on
GPIO.setup(pin, GPIO.OUT)
#setting the GPIO to HIGH ... |
from abc import ABC, abstractmethod
from typing import Any, List, Optional
import pandas as pd
from yacht.config import Config
class Transform(ABC):
@abstractmethod
def __call__(self, sample: Any) -> Any:
pass
class Compose(Transform):
def __init__(self, transforms: List[Transform]):
s... |
# -*- coding: UTF-8 -*-
import yaml
import re
class Configuration:
__configure_file = ""
__configure_object = None
def __init__(self, configfile):
with open(configfile, "r") as handler:
self.__configure_object = yaml.load(handler)
def __get_workflow(self, name=""):
for i... |
import win32com.client
from getpass import getuser
import pathlib
import datetime
working_directory = str(pathlib.Path(__file__).parent.absolute().parent.absolute())
path_action = str(pathlib.Path(__file__).parent.absolute().parent.absolute())+"\\automatic.py"
computer_name = "" #leave all blank for current computer, ... |
"""
A backport of the fix in Django 2.0 that retains the order of form media.
See https://github.com/django/django/commit/c19b56f633e172b3c02094cbe12d28865ee57772
and https://code.djangoproject.com/ticket/28377
"""
from collections import defaultdict, OrderedDict
import warnings
import django
import django.forms
from... |
# BSD 3-Clause License
#
# Copyright (c) 2020, Erik Larson
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this
# ... |
import pytest
pytest.register_assert_rewrite('tests.helper_single')
pytest.register_assert_rewrite('tests.helper_multi')
|
import logging
import os
import mutagen.mp4
from mutagen.mp4 import MP4Cover
from trax.format.base import Base
from trax.soundcheck import replay_gain_to_soundcheck
log = logging.getLogger(__name__)
class MP4(Base):
attributes = {
'\xa9nam': 'title',
'\xa9alb': 'album',
'\xa9ART': 'artist',
'\xa9... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# lcpfeatures.py - Waqas Bhatti (wbhatti@astro.princeton.edu) - Feb 2019
'''
This contains functions to generate periodic light curve features for later
variable star classification.
'''
#############
## LOGGING ##
#############
import logging
from astrobase import log... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.