content
stringlengths
0
894k
type
stringclasses
2 values
__all__ = ['auth', 'constants', 'controllers', 'forms']
python
#!/bin/python import sys S = raw_input().strip() try: r = int(S) print r except ValueError: print "Bad String"
python
#!/usr/bin/env python3 # coding: utf-8 """Automatic EcoFlex sequences annotation pipeline. Edits: - Recolor all AmpR with the same color as YTK parts - Add AmpR terminator feature with standard color """ import copy import io import itertools import json import re import os import warnings import sys import bs4 as ...
python
# hsrp parameters ng_order = (3072,) _ng_const = ( # 3072 ( """\ FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E08\ 8A67CC74020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B\ 302B0A6DF25F14374FE1356D6D51C245E485B576625E7EC6F44C42E9\ A637ED6B0BFF5CB6F406B7EDEE386BFB5A899FA5AE9F24117C4B1FE6\ 492866...
python
import random import kivy from kivy.app import App from kivy.uix.boxlayout import BoxLayout kivy.require('1.9.0') class MyRoot(BoxLayout): def __init__(self): super(MyRoot, self).__init__() def generate_affirmation(self): affirmations = ["I am the architect of my life; \nI build its foundati...
python
# Copyright 2020 Regents of the University of Minnesota. # # 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 applic...
python
from rpcb.message_dispatch import MessageDispatch from rpcb.service import Service import threading import time import random import pika import queue import logging import pika.adapters.blocking_connection """ 消息调度器实现,用于批处理数据,多个数据来了会打包为一个batch输入到模型中,从而提高整体的吞吐量 """ class BatchMessageDispatcher(MessageDispatch): d...
python
import vcs import cdms2 import os x = vcs.init() f = cdms2.open(os.path.join(vcs.sample_data, 'clt.nc')) u = f("u") v = f("v") V = x.createvector() V.linecolor = 242 V.scale = 5. V.type = "arrows" V.reference = 6. V.list() x.plot(u[::2], v[::2], V) x.png("vectors") x.interact()
python
# OpenWeatherMap API Key api_key = "Goes here if needed"
python
# Note that only the currently used fields are shown unless show_all is set to True. import os import pandas as pd import anytree from anytree.search import find from anytree.exporter import DotExporter import collections PolicyTuple = collections.namedtuple('PolicyTuple','layer_id agg_id calc_rules') CalcRuleTuple = ...
python
# -*- coding: utf-8 -*- import os from Crypto import Random from Crypto.Cipher import AES from Crypto.Hash import SHA256 from common import xJiPZbUzlGCIdemowYnQNONypdeudgmd, ckAjUaLEXnferbefRGpQeOZRysoqlffQ FFVGFOvcuiKjdGKFcTRNoKJcuBaGjGEf = 'b14ce95fa4c33ac2803782d18341869f' class LVPFsEGShJELnCwtpptaZvXDbVmShyns(Exce...
python
#!/usr/bin/env python3 import os import re import sys LOWP_SEARCH = "lowp" MEDIUMP_SEARCH = "mediump" HIGHP_SEARCH = "highp" VERTEX_SHADER_EXT = ".vsh.glsl" FRAG_SHADER_EXT = ".fsh.glsl" GLES3_PREFIX = "GLES3_" GLES3_SHADER_PREFIX = "gles3_" SHADERS_LIB_COMMON_PATTERN = "// Common" SHADERS_LIB_VS_PATTERN = "// VS" S...
python
#!/usr/bin/env python3.8 # Copyright 2019 The Fuchsia Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import argparse import json import os import platform import sys def main(): parser = argparse.ArgumentParser() # TODO(fxbu...
python
import filecmp import os def exists(path): return os.path.isfile(path) class FileApprover(object): def verify(self, namer, writer, reporter): base = namer.get_basename() approved = namer.get_approved_filename(base) received = namer.get_received_filename(base) writer.write_r...
python
import socket import serial from config import DEFAULT_VELOCITY from config import TIME_INTERVAL import time import math import os class Robot: def __init__(self, mac: str, color: str, com: str): if os.name == 'posix': self.socket = socket.socket( socket.AF_BLUETOOTH, socket.S...
python
# THIS FILE IS GENERATED FROM KIVY SETUP.PY __version__ = '1.11.0.dev0' __hash__ = '9b90467ec9efea3891e07be92c9bb4ba638a7ca0' __date__ = '20190329'
python
# Tara O'Kelly - G00322214 # Emerging Technologies, Year 4, Software Development, GMIT. # Problem set: Python fundamentals # 6. Write a function that returns the largest and smallest elements in a list. user_list = [] # get user input n = int(input('How many numbers: ')) for x in range(n): numbers = int(input('E...
python
#%% import numpy as np import pandas as pd # Load the data data = pd.read_csv('./input/2021-02-11_REL606_NCM3722_diauxie.csv') # DO some serious tidying melted = data.melt('Cycle Nr.') # Get the time indices time = melted[melted['Cycle Nr.']=='Time [s]'] time.sort_values(by='variable', inplace=True) time = time['val...
python
"""Library for CIM sparql queries""" __version__ = "1.9.0"
python
# -*- coding: utf-8 -*- """ Script to make test """ from indeed import params def test_indeed_params(): assert params('my_username', 'my_password') == ('my_username', 'my_password') assert params('your_username', 'your_password') == ('your_username', 'your_password')
python
# # Copyright 2017-2018 Amazon.com, Inc. and its affiliates. All Rights Reserved. # # Licensed under the MIT License. See the LICENSE accompanying this file # for the specific language governing permissions and limitations under # the License. # import mount_efs import os import pytest from datetime import datetime ...
python
from chibi.units.base import Unit from unittest import TestCase class Test_unit( TestCase ): def setUp( self ): self.unit = Unit( 10 ) def test_should_print_the_value_when_is_str( self ): self.assertIn( '10', str( self.unit ) ) def test_when_add_a_int_should_work( self ): r = 10 ...
python
################################################################################################################### # Uses a trained network to predict the class for an input image # Notes - Run train.py first before this script # Basic usage: python predict.py /path/to/image checkpoint # Options: # Return top KK most ...
python
from datetime import datetime import hashlib import uuid from google.cloud import firestore SONG_TEMPLATE = '{verse}\n\n{pre_chorus}\n\n{chorus}\n\n{pre_chorus}\n\n{chorus}\n\n{bridge}' class Song: collection_name = 'songs' def __init__(self, id, chorus_id=None, pre_chorus_id=None, verse_id=None, ...
python
"""This module contains various decorators. There are two kinds of decorators defined in this module which consists of either two or three nested functions. The former are decorators without and the latter with arguments. For more information on decorators, see this `guide`_ on https://realpython.com which provides a...
python
from typing import Tuple, List import pytest from predicates.state import State from predicates import guards, actions from predicates.guards import AlwaysTrue, AlwaysFalse from model.model import the_model, Model from model.operation import Operation, Transition from planner.plan import plan # -----------------------...
python
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('core', '0004_review'), ] operations = [ migrations.AddField( model_name='location', name='alcohol', ...
python
#导入requests模块 import requests import urllib.parse class Xiaoniu(object): def __init__(self): self.headers={ 'Accept': 'application/json, text/plain, */*', 'Content-Type': 'application/x-www-form-urlencoded', 'Origin': 'https://niutrans.vip', 'Referer': 'https://niutrans.vip/...
python
import warnings from pyro import params from pyro.distributions.distribution import Distribution from pyro.poutine.util import is_validation_enabled from .messenger import Messenger class LiftMessenger(Messenger): """ Messenger which "lifts" parameters to random samples. Given a stochastic function with...
python
from fastapi import FastAPI from fastapi.middleware.cors import CORSMiddleware from app.dialogue.routers import dialogues_router from app.message.middleware import WebSocketStateMiddleware from app.message.routers import message_router from app.notification.routers import notification_router from config import PROJECT...
python
import numpy as np from glob import glob as glob #This will probably change astrotable = '/Users/Arthur/Documents/School/MetaPak/GradPak_code/extras/gradpak_w_sky_astrometry_table.txt' basedir = '/Users/Arthur/Documents/School/891_paper/GP_data' #astrotable = '/usr/users/eigenbrot/research/Pak/gradpak_w_sky_astrometry...
python
def bisection(fun, y, xl, xr, tol, maxiter): """ The program uses the bisection method to solve the equation f(x)-y = 0 input: fun:the function(x) y : y=f(x) xl: lower bound xr: upper bound tol: tolerance maxiter: max iter return: ...
python
import sqlite3 conn = sqlite3.connect('northwind_small.sqlite3') cur = conn.cursor() top_products = cur.execute('SELECT ProductName, UnitPrice FROM Product \ ORDER BY UnitPrice DESC LIMIT 10').fetchall() print(top_products) """[('Côte de Blaye',), ('Thüringer Rostbratwurst',), ('Mishi Kobe Niku ("Sir Rodney's Marmalad...
python
from distutils.core import setup from distutils.extension import Extension from Cython.Distutils import build_ext ext_modules = [ Extension("NVEnc", ["NVEnc.py"]), Extension("QSVEnc", ["QSVEnc.py"]), Extension("StaxRip", ["StaxRip.py"]), ] install_requires=[ 'requests', 'tqdm', 'b...
python
# coding=utf-8 import logging import os import scrapy from scrapy.exceptions import DropItem from scrapy.pipelines.files import FilesPipeline from .folder_path import get_file_size import settings as project_settings from items import AppDetail from utils import cal_file_hash from database import Database from pipelin...
python
from keras.models import Sequential from keras.layers import Conv2D, MaxPooling2D, MaxPool2D from keras.layers import Activation, Dropout, Flatten, Dense from keras.preprocessing.image import ImageDataGenerator from keras.callbacks import ModelCheckpoint, Callback from keras import optimizers from skimage import expos...
python
''' Created on Mar 26, 2014 @author: Simon ''' from datahandler.abstract_statistics import AbstractStatistics class ImageStats(AbstractStatistics): ''' Image statistics ''' def __init__(self): pass def encode(self): return [] def decode(self, encoded_stats): return ...
python
# This is open-source software licensed under a BSD license. # Please see the file LICENSE.txt for details. """ Save images to output files. **Plugin Type: Global** ``SaveImage`` is a global plugin. Only one instance can be opened. **Usage** This global plugin is used to save any changes made in Ginga back to outp...
python
from math import inf,nan from ursina import * from numpy import dot,cross from hit_info import HitInfo #fix bug where ray starts right from face boundary class voxelcaster(): def __init__(self,chunks,size=16): self.chunks=chunks self.size=size self.cubeTemplate=[[[0,0,0],[0,0,...
python
# # Copyright (C) 2015, Stanislaw Adaszewski # s.adaszewski@gmail.com # http://algoholic.eu # # License: 2-clause BSD # from markdown import Extension from markdown.blockprocessors import BlockProcessor from markdown.treeprocessors import Treeprocessor from markdown.util import etree, AtomicString import numpy as np ...
python
""" zoom.snippets """ import zoom import zoom.html as h class SystemSnippet(zoom.utils.Record): """SystemSnippet A chunk of text (usually HTML) that can be rendered by placing the {{snippet}} tag in a document or template. >>> db = zoom.database.setup_test() >>> snippets = get_snippets(db) ...
python
# -*- coding: utf-8 -*- # from flask import Flask, Blueprint, make_response, jsonify, request from flask.ext.bcrypt import check_password_hash from app import db, app, return_response # # Import module models (i.e. User) from app.mod_user.models import User # Define the blueprint: 'auth', set its url prefix: app.u...
python
import os from unittest import mock import pytest import requests_mock from ewtwitterbot.imagery import get_quote_image from ewtwitterbot.mastodon_bot import ( MastodonConfigurationError, MastodonMediaError, get_credentials_from_environ, get_last_toot_id, respond_to_toots, save_last_toot_id, ...
python
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sat Nov 24 19:04:13 2018 @author: kyungdoehan """ import numpy as np #%% Making square arrays of x, y, z of the overall topography class XYZ_data: def __init__(self, a, x, y, z): self.X = np.zeros((a, a)) self.Y = np.zeros((a, a)) ...
python
# -*- coding: utf-8 -*- import itertools import os import plistlib import unicodedata import sys from xml.etree.ElementTree import Element, SubElement, tostring """ You should run your script via /bin/bash with all escape options ticked. The command line should be python yourscript.py "{query}" arg2 arg3 ... """ U...
python
"""This module serves as a container to hold the global :class:`~.ShowBase.ShowBase` instance, as an alternative to using the builtin scope. Note that you cannot directly import `base` from this module since ShowBase may not have been created yet; instead, ShowBase dynamically adds itself to this module's scope when i...
python
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Jun 3 19:26:47 2019 @author: sercangul """ a, b = map(float, input().split()) x= float(input()) print(round(sum([(1 - (a / b))**(5 - x) * (a / b) for x in range(1, 6)]), 3))
python
# -*- coding: utf-8 -*- from pygraph.fillpolygon_edge import fillPolygonEdge from pygraph.util import mkGraph, saveG, enLarge g = mkGraph((80, 60)) points = [ (10, 40), (20, 10), (30, 10), (40, 5), (60, 10), (75, 25), (30, 50) ] fillPolygonEdge(g, points) saveG("polygon_edge.png", g) sav...
python
from .fasta import is_fasta from .fasta import read_fasta
python
import streamlit as st st.title('Streamlit custom theme tutorial') st.subheader('Powered by @dataprojectswithMJ') st.multiselect('Choose your favourite coding language(s)', options=['Python','Java','Golang','C++']) st.radio('Choose your favourite operation system:', ['Windows','Linux','MacOS'...
python
import json import requests class Answer: def __init__(self, client, input): self.__client = client self.id = input['id'] self.answer = input['answer'] self.likes_count= input['likesCount'] self.created_at = input['createdAt'] self.tell = input['tell'] self....
python
import mysql.connector from mysql.connector import errorcode try: con = mysql.connector.connect(user='niminimda', password='123456', host='127.0.01', database='test') except mysql.connector.Error as err: if err.errno == errorcode.ER_ACCESS_DENIED_ERROR: print("something is wrong with user or password")...
python
import os, sys import json, requests # TODO: NEED TO UPDATE TO HAVE FILES RIGHT OUT AS THE TEAM ID NUMBER # TODO: NOT THE TEAM NAME. TEAM_ID = { 'fuel' : 4523, 'fusion' : 4524, 'outlaws' : 4525, 'uprising' : 4402, 'excelsior' : 4403, 'shock' : 4404...
python
from ._Session import Session from ._User import User from ._UserAffiliation import UserAffiliation from ._UserEntityPermission import UserEntityPermission from ._UserRoles import UserRoles
python
""" Get reaction forces at the support nodes of a form diagram. """ from ghpythonlib.componentbase import executingcomponent as component import rhinoscriptsyntax as rs class SupportNodeResultsComponent(component): def RunScript(self, form, support_node_keys): if form: support_node_keys = sup...
python
from carts.models import Cart from django.http import HttpRequest from products.models import Product from products.api.serializers import ProductSerializer from rest_framework import serializers class CartSerializer(serializers.ModelSerializer): products = serializers.SerializerMethodField() class Meta: ...
python
import os import re import json from setuptools import setup with open('Setup.lock') as f: c = json.loads(f.read()) with open(os.path.join(c['name'], '__init__.py')) as f: version = re.findall("^__version__ = '(.*)'", f.read())[0] with open('Pipfile.lock') as f: p = json.loads(f.read()) def _install_req...
python
""" openconfig_local_routing This module describes configuration and operational state data for routes that are locally generated, i.e., not created by dynamic routing protocols. These include static routes, locally created aggregate routes for reducing the number of constituent routes that must be advertised, summa...
python
import time import json from pathlib import Path import torch import torch.nn as nn from torch.nn.parallel import DistributedDataParallel from torch.utils.tensorboard import SummaryWriter from radam import RAdam from model import GPT, GPTLMHead, GPTClsHead def timeit(method): def timed(*args, **kw): _arg...
python
import os import subprocess files = [ "001", "001a", "001b", "002", "002a", "002b", "003", "003a", "003b", "004", "004a", "004b", "005", "005a", "005b", "006", "006a", "006b", "007", "007a", "007b", "008", "008a", "008b", ...
python
#! /usr/bin/env python import io import os from setuptools import setup mydir = os.path.dirname(__file__) def read_project_version(): # Version-trick to have version-info in a single place. # http://stackoverflow.com/questions/2058802/how-can-i-get-the-version-defined-in-setup-py-setuptools-in-my-package ...
python
import os from unittest.mock import patch from util.job import get_job_id def test_create_job_id(): assert get_job_id() == os.getenv('JOB_ID'), 'job id is created' @patch.dict('os.environ', {'JOB_ID': 'job_123'}) def test_retrieve_job_id(): assert get_job_id() == 'job_123', 'job id is retrieved'
python
from kelvin.tests.test_cc_utils import * from kelvin.tests.test_ccsd import * from kelvin.tests.test_ft_cc_2rdm import * from kelvin.tests.test_ft_cc_ampl import * from kelvin.tests.test_ft_cc_relden import * from kelvin.tests.test_ft_ccsd import * from kelvin.tests.test_ft_ccsd_rdm import * from kelvin.tests.test_ft_d...
python
from person import Person from bounding_box import BoundingBox from typing import List from video_frame import VideoFrame from sort import Sort import numpy as np class Tracker: """ Trackes detected person and groups people with close trajectories. Attributes ---------- minDist: ...
python
__version__ = "0.2.8" from . import utils from . import common from . import manager from .common import Module from .common import Sequential from .common import Linear from .common import Identity from .common import ModuleList from .common import MultiModule from .common import Parameter from .manager import regist...
python
from src.abstract_load_balancer import AbstractLoadBalancer, LoadBalancerQueue class UtilisationAwareLoadBalancer(AbstractLoadBalancer): def __init__(self, APISERVER, DEPLOYMENT): self.apiServer = APISERVER self.deployment = DEPLOYMENT self.internalQueue = [] def UpdatePodList(self): ...
python
# Copyright (c) 2021 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 ...
python
"""Utilities for reading configuration from settings.""" from collections import namedtuple from functools import partial from django.conf import settings from django.core.exceptions import ImproperlyConfigured from django.utils.text import slugify import six import logging logger = logging.getLogger(__name__) # Dec...
python
import pytest from karp.domain.models.resource import create_resource from karp.domain.models.entry import EntryRepository, create_entry from karp.infrastructure.sql import sql_entry_repository from karp.infrastructure.unit_of_work import unit_of_work @pytest.fixture def resource_blam(): resource = create_resou...
python
# coding=utf-8 from __future__ import unicode_literals, print_function import re import datetime from ..models import RawLog, DummyLogger, MacAddress, UserAction CODE_WLAN_JOIN = "WLAN-Gerät angemeldet" CODE_WLAN_LEAVE = "WLAN-Gerät hat sich abgemeldet" CODE_WLAN_REMOVED = "WLAN-Gerät wurde abgemeldet" def parse_...
python
# Load library import numpy as np # Create matrix matrix = np.array([[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12]]) # View number of rows and columns matrix.shape # (3, 4) # View number of elements (rows * columns) matrix.size # 12 # View number of dimensions matrix.ndim # 2
python
from django.core.cache import cache from django.test import TestCase, override_settings from django.urls import reverse from posts.models import User, Post, Group, Follow class TestPostCreation(TestCase): """Test for proper post creation and protection from anons""" def setUp(self): self.text = 'tes...
python
import unittest from entity_embeddings.util import processor_utils class TestProcessorUtils(unittest.TestCase): def test_get_invalid_target_processor(self): self.assertRaises(ValueError, processor_utils.get_target_processor, 1000)
python
import torch import numpy as np import os from datasets.base_dataset import BaseDataset from models.base_model import Model from torch.utils.data import DataLoader from torch.utils.tensorboard import SummaryWriter from tqdm import tqdm from utils.metrics import compute_chamfer_l1 from utils.util import quantize, downsa...
python
""" factoidbot.py - A plugin for remembering facts. Copyright (C) 2007 Kevin Smith SleekBot 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 License, or (at your opt...
python
from django.apps import AppConfig from django.utils.translation import gettext_lazy as _ class FilesConfig(AppConfig): """Application config for files.""" name = "apps.files" verbose_name = _("Files") label = "files"
python
import numpy as np import cv2 import matplotlib.pyplot as plt import copy import argparse import os def histogram(image): # determine the normalized histogram m, n = image.shape hist = [0.0] * 256 for i in range(m): for j in range(n): #for every intensity add the count h...
python
from json import JSONDecodeError from typing import Dict import pytest from common.serializers.serialization import node_status_db_serializer from plenum.common.constants import LAST_SENT_PRE_PREPARE from plenum.common.util import getNoInstances from plenum.test.test_node import ensureElectionsDone, getPrimaryReplica...
python
__author__ = 'etuka' __date__ = '22 March 2019' import os import csv import ntpath import pandas as pd from django.conf import settings from dal.copo_da import Sample, Description from django.core.files.storage import FileSystemStorage from web.apps.web_copo.lookup.copo_enums import Loglvl, Logtype lg = settings.LOGG...
python
from FeatureModel import pointPillarFeatureNet from ModelBackbone import pointPillarModel from ModelBackbone import model class TrainingPipeline: def __init__(self, trainPillars, trainLabels, testPillars, testLabels): self.trainPillars = trainPillars self.trainLabels = trainLabels self.test...
python
import markdown from atomicpress.app import app from atomicpress.models import Post, PostStatus, PostType from flask import send_from_directory from sqlalchemy import desc from werkzeug.contrib.atom import AtomFeed from flask import request @app.route("/uploads/<filename>") def uploaded_file(filename): return sen...
python
#!/usr/bin/python import csv import os.path from collections import namedtuple import sn import os import sys,string import numpy as np import math import vcf import fnmatch #try: # file_map = sys.argv[1];dir_files_phenotype1 = sys.argv[2];dir_files_phenotype2 = sys.argv[3];outfilename = sys.argv[4] #except: # ...
python
""" This is a utility script for updating the spacy meta.json Sample call python --meta meta.json --augment metrics/dane_augmented_best_dacy_small_trf-0.1.0.json -- """ import json def main(meta_json, meta_augment_json, size, decimals=3): with open(meta_json) as f: meta = json.load(f) with open(meta...
python
import numpy as np import torch import torch.nn as nn import torch.nn.functional as F from mmcv.cnn import kaiming_init, normal_init from mmdet.ops import ConvModule from ..builder import build_loss from ..registry import HEADS @HEADS.register_module class GridHead(nn.Module): def __init__(self, ...
python
#!/usr/bin/env python import os import shutil import subprocess import difflib import filecmp import sys rootdir = "." for subdir, dirs, files in os.walk(rootdir): for file in files: if "RLBin" in (os.path.join(subdir, file)): os.remove(os.path.join(subdir, file)) print(os.path.join(subd...
python
#!/usr/bin/env python2 # Copyright (c) 2019 Erik Schilling # 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 ...
python
from .db_api import DbApi from .meta import Db from .schema import * class Impl(DbApi): def __init__(self, db): assert isinstance(db, Db) DbApi.__init__(self) self.__db = db def __del__(self): self.close() def close(self): if self.__db is not None: sel...
python
# vpe6080 Analog Input Thermistor Module 8 Channel # Demo Program reads 8 channels # Thermistor 10K Ohm 3380 Beta installed in Channel 1 to read room temperature import asyncio from pywlmio import * NodeID = 7 #NodeID location is the Bacplane ID (Jumpers) and Power Supply Slot location async def main(): init() ...
python
#!/usr/bin/python3 -OO # Copyright 2007-2021 The SABnzbd-Team <team@sabnzbd.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 License, or (at your option) any late...
python
from setuptools import find_packages, setup setup( name = 'upbit_wrapper', version = '0.0.9', description = 'Python wrapper for upbit', long_description = open('README.md','rt').read(), long_description_content_type='text/markdown', author = 'BS LEE', ...
python
from fqf_iqn_qrdqn.agent.base_agent import BaseAgent from DMoGDiscrete.DMoGQ import DMoGQ from fqf_iqn_qrdqn.utils import disable_gradients, update_params from torch.optim import Adam import torch from DMoGDiscrete.utils import calculate_dmog_loss, evaluate_mog_at_action class DMoGQAgent(BaseAgent): def __init__(...
python
# 用random.randint(1,10),随机生成一个有100个元素的列表,然后按照元素出现次数的高低,从高到底排序并输出 import random numbers = [random.randint(1, 10) for i in range(100)] numbers_info = {} def sorted_by_freq(numbers): for number in numbers: # 遍历随机数列表 if number not in numbers_info: # 若该元素没有统计过 numbers_info[number] = numbers.count(nu...
python
# Copyright 2018, Kay Hayen, mailto:kay.hayen@gmail.com # # Part of "Nuitka", an optimizing Python compiler that is compatible and # integrates with CPython, but also works on its own. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in complianc...
python
# 5 Faça um Programa que converta metros para centímetros. distancia = int(input('Digite uma distância em metros: ')) converção = distancia * 100 print(f'De acordo com a distância informada: {distancia} M, Sua conversão em centímetros é: {converção} CM ')
python
#!/usr/bin/env python3 # -*- coding: utf8 -*- from io import StringIO import os import subprocess import sys import types from .exceptions import (DeliveryTransportError, DeliveryPackingError) from .pickle import pickle, unpickle, ModulePickle class DeliveryBox(object): """Container for data exchange""" #...
python
# Кириллов Алексей, ИУ7-22 from math import sqrt from tkinter import * root = Tk() draw_pole = Canvas(root, width = 800, height = 600, bg = "white") def dist(x, y, x1, y1, x2, y2): lenth = abs((x-x1) * (y2-y1) - (y-y1) * (x2-x1)) /\ sqrt((x2-x1)**2 + (y2-y1)**2) #print(lenth) return lenth ...
python
# -------------------------------------- #! /usr/bin/python # File: 7. Reverse Integer.py # Author: Kimberly Gao # My solution: (Run time: 28ms) # Memory Usage: 14.4 MB class Solution: def _init_(self,name): self.name = name def reverse1(self, x: int) -> int: string = str(x) list1 = li...
python
from abaqusConstants import * from .Section import Section from ..Connector.ConnectorBehaviorOptionArray import ConnectorBehaviorOptionArray class ConnectorSection(Section): """A ConnectorSection object describes the connection type and the behavior of a connector. The ConnectorSection object is derived from ...
python
#!/usr/bin/env python # encoding: utf-8 #use nc -u 127.0.0.1 8888 to communicate with the server 1-way """A non-blocking, single-threaded TCP server.""" from __future__ import absolute_import, division, print_function, with_statement import errno import os import socket import ssl import stat import sys from tornado...
python
from django.contrib.gis import admin from leaflet.admin import LeafletGeoAdmin from world.models import Border, School, Facility, Busstop class BorderAdmin(LeafletGeoAdmin): search_fields = ['n03_001','n03_003','n03_004'] list_filter = ('n03_003') admin.site.register(Border, LeafletGeoAdmin) admin.site.reg...
python