text
stringlengths
1
927k
from __future__ import (absolute_import, division, print_function, unicode_literals) import sys from .frontend import Frontend from math import log10 __all__ = ['ConsoleFrontend'] class ConsoleFrontend(Frontend): """Console frontend for Minuit. This class prints stuff directly via pr...
import os from models.database import DATABASE_NAME import create_database as db_creator if __name__ == '__main__': db_is_created = os.path.exists(DATABASE_NAME) if not db_is_created: db_creator.create_database()
# -*- coding: utf-8 -*- import collections import itertools import json import os import posixpath import re import time import uuid from datetime import datetime from django.conf import settings from django.core.exceptions import ObjectDoesNotExist from django.db import IntegrityError, models, transaction from djang...
#!/usr/bin/env python # coding: utf-8 import argparse import struct import kenshin from datetime import datetime from kenshin.utils import get_metric def timestamp_to_datestr(ts): try: d = datetime.fromtimestamp(ts) return d.strftime('%Y-%m-%d %H:%M:%S') except: return 'invalid timest...
# # Copyright (c) 2015 Juniper Networks, Inc. All rights reserved. # """ This file contains config data model for schema transformer """ import gevent.monkey gevent.monkey.patch_all() import sys reload(sys) sys.setdefaultencoding('UTF8') import copy import uuid import itertools import socket import cfgm_common as c...
#!/home/james/PYTHON/django-module/neighbourhood-watch/virtual/bin/python3 from django.core import management if __name__ == "__main__": management.execute_from_command_line()
from django import forms from django.conf import settings from django.contrib.admin.widgets import AdminRadioSelect from django.core.exceptions import ImproperlyConfigured from django.db import models from django.template.loader import render_to_string from django.utils.translation import ugettext_lazy as _ from feincm...
""" Django settings for ecommerce_site project. Generated by 'django-admin startproject' using Django 2.2.1. For more information on this file, see https://docs.djangoproject.com/en/2.2/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/2.2/ref/settings/ """ impor...
import sys from setuptools import setup, find_packages, Extension long_description = ''' imagededup is a python package that provides functionality to find duplicates in a collection of images using a variety of algorithms. Additionally, an evaluation and experimentation framework, is also provided. Following details ...
import os import redis import json from flask import Flask, render_template, redirect, request, url_for, make_response if 'VCAP_SERVICES' in os.environ: VCAP_SERVICES = json.loads(os.environ['VCAP_SERVICES']) if VCAP_SERVICES: CREDENTIALS = VCAP_SERVICES["rediscloud"][0]["credentials"] r = red...
#!/pxrpythonsubst # # Copyright 2017 Pixar # # Licensed under the Apache License, Version 2.0 (the "Apache License") # with the following modification; you may not use this file except in # compliance with the Apache License and the following modification to it: # Section 6. Trademarks. is deleted and replaced with: # ...
#Standard Modules from random import choice, randint from time import sleep #Third-party Modules from telebot import TeleBot from telebot.types import (CallbackQuery, InlineKeyboardMarkup, InlineKeyboardButton, Message) #Local Modules import bot_token from greeting_handler import Greetin...
import json import logging import numpy as np import os import torch from ..utils.various import create_missing_folders, load_and_check logger = logging.getLogger(__name__) class Estimator: """ Abstract class for any ML estimator. Subclassed by ParameterizedRatioEstimator, DoubleParameterizedRatioEstimator...
# -*- coding: utf-8 -*- """ Created on Mon Nov 23 21:29:10 2020 @author: ZongSing_NB """ from BHPSOGWO import BHPSOGWO import numpy as np import pandas as pd from sklearn.neighbors import KNeighborsClassifier from sklearn.model_selection import StratifiedKFold from sklearn.model_selection import cross_val_score impor...
# -*- coding: utf-8 -*- # # michael a.g. aïvázis <michael.aivazis@para-sim.com> # (c) 1998-2022 all rights reserved # support import qed # my superclass from .Producer import Producer # the workflow class Channel(Producer, family="qed.channels"): """ A channel is a visualization workflow """ # end of ...
# -*- coding: utf-8 -*- # Generated by Django 1.9.8 on 2018-04-19 20:11 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('users', '0004_auto_20180418_1732'), ] operations = [ migrations.AlterField( ...
# Copyright 2001-2014 by Vinay Sajip. All Rights Reserved. # # Permission to use, copy, modify, and distribute this software and its # documentation for any purpose and without fee is hereby granted, # provided that the above copyright notice appear in all copies and that # both that copyright notice and this permissio...
import sys import os plugin = os.path.abspath(os.path.split(__file__)[0]) # libpath = os.path.join(plugin, 'lib') if not plugin in sys.path: sys.path.append(plugin) # if not libpath in sys.path: # sys.path.append(libpath) VERSION = '0.1.0'
# -*- coding: utf-8 -*- # Copyright 2017 Kakao, Recommendation 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/LICENSE-2.0 # # Unless required by a...
"""Run Foremast web UI.""" import click from .routes import APP @click.command() @click.option('-d', '--debug', is_flag=True, help='Enable DEBUG mode') @click.option('-p', '--port', type=int, help='Port to run webserver') def main(debug, port): """Foremast UI entry point.""" APP.run(port=port, debug=debug) ...
# -*- coding: utf-8 -*- # # CVXPY documentation build configuration file, created by # sphinx-quickstart on Mon Jan 27 20:47:07 2014. # # This file is execfile()d with the current directory set to its containing dir. # # Note that not all possible configuration values are present in this # autogenerated file. # # All c...
from __future__ import with_statement from alembic import context from sqlalchemy import engine_from_config from sqlalchemy.engine.base import Engine from pyramid.paster import get_appsettings, setup_logging from www.models.meta import Base config = context.config setup_logging(config.config_file_name) engine = en...
# -*- coding: utf-8 -*- # Copyright 2016 Google Inc. 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 require...
# Author: Kevin Köck # Copyright Kevin Köck 2017-2019 Released under the MIT license # Created on 2017-10-30 """ example config: { package: .switches.gpio component: GPIO constructor_args: { pin: D5 active_high: true #optional, defaults to active high # mqtt_topic: sometop...
"""ACP Inheritance Settings Class""" from fmcapi.api_objects.apiclasstemplate import APIClassTemplate from .accesspolicies import AccessPolicies import logging class InheritanceSettings(APIClassTemplate): """The InheritanceSettings Object in the FMC.""" VALID_JSON_DATA = [] VALID_FOR_KWARGS = VALID_JSON_...
import os import numpy as np from maskrcnn.lib.data.preprocessing import mold_inputs from maskrcnn.lib.config import cfg from maskrcnn.lib.utils import io_utils def test_mold_inputs_ones(): image = np.ones((cfg.IMAGE.MAX_DIM, cfg.IMAGE.MAX_DIM, 3), dtype=np.uint8) * 255 molded_images, image_metas = mold...
#!/usr/bin/env python # ---------------------------------------------------------------------- # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF lic...
# -*- coding: utf-8 -*- """ @date Created on Tue Feb 02 11:31:45 2016 @copyright (C) 2015-2016 EOMYS ENGINEERING. @author pierre_b """ from unittest import TestCase from ddt import ddt, data from pyleecan.Classes.Segment import Segment from pyleecan.Classes.SurfLine import SurfLine from pyleecan.Classes.LamHole impo...
#!/usr/bin/env python3 from whatdo.main import main if __name__ == "__main__": main()
import threading from subprocess import Popen, PIPE import math import time import os import sys import inspect import re import atexit import collections import json # Protocol constants KEY = 'k' VALUE = 'v' TIME = 't' CUSTOM_DISPLAY = 'custom_display' VIEW = 'view' VIEW_BOX = 'view_box' GUI_COMMAND = 'python gui_...
class Solution: def judgeCircle(self, moves: str) -> bool: """String. Running time: O(n) where n == len(moves). """ r, l, u, d = 0, 0, 0, 0 for m in moves: if m == 'U': u += 1 elif m == 'D': d += 1 elif m ==...
''' Reference tzinfo implementations from the Python docs. Used for testing against as they are only correct for the years 1987 to 2006. Do not use these for real code. ''' from datetime import tzinfo, timedelta, datetime from pytz import HOUR, ZERO, UTC __all__ = [ 'FixedOffset', 'LocalTimezone', 'USTime...
import requests from datetime import datetime USERNAME = "samitha" TOKEN = "" pixela_endpoint = "https://pixe.la/v1/users" user_params = { "token": TOKEN, "username": USERNAME, "agreeTermsOfService": "yes", "notMinor": "yes", } # response = requests.post(url=pixela_endpoint, json=user_params) # print...
# coding: utf-8 """ Isilon SDK Isilon SDK - Language bindings for the OneFS API # noqa: E501 OpenAPI spec version: 7 Contact: sdk@isilon.com Generated by: https://github.com/swagger-api/swagger-codegen.git """ from __future__ import absolute_import import unittest import isi_sdk_8_2_0 from i...
# Copyright (C) 2017 Google Inc. # Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file> import json from logging import getLogger from sqlalchemy.orm import backref from ggrc import db from ggrc.models import all_models from ggrc.builder import simple_property from ggrc.models.context import ...
""" Allows to configure a switch using BBB GPIO. Switch example for two GPIOs pins P9_12 and P9_42 Allowed GPIO pin name is GPIOxxx or Px_x switch: - platform: bbb_gpio pins: GPIO0_7: name: LED Red P9_12: name: LED Green initial: true invert_logic: true """ import log...
import unittest import tools.db_tools as dbt import tools.sql_queries as sqt import tools.docker_tools as dtt class TestDb_tools(unittest.TestCase): # @source:http://stezz.blogspot.com/2011/04/calling-only-once-setup-in-unittest-in.html ClassIsSetup = False ClassIsTeardown = 1 # TODO automaticly coun...
from phi import math, struct from phi.geom import GLOBAL_AXIS_ORDER from .analytic import AnalyticField @struct.definition() class AngularVelocity(AnalyticField): def __init__(self, location, strength=1.0, **kwargs): AnalyticField.__init__(self, rank=None, **struct.kwargs(locals())) def sample_at(s...
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import with_statement import sys # Fields def main(source, target, sep, fields, old, new): with open(source) as s: with open(target, 'w') as t: for row in s: if not row or row.startswith('#'): ...
#------------------------------------------------------------------------------ # Copyright 2013 Esri # 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...
import math import time from data import obstacles from data.Map import Map from data.plotting import plot_set_title, plot_map, plot_visited, plot_path, plot_set_button_click_callback, \ plot_show, plot_clear, plot_after_compute class AnytimeDStar: def __init__(self, env, start, goal, eps, heuristic_type): ...
DOMAIN = 'https://www.dcard.tw/' forums_url = DOMAIN + '_api/forums' post_url_pattern = DOMAIN + '_api/posts/{post_id}' posts_meta_url_pattern = DOMAIN + '_api/forums/{forum}/posts' post_links_url_pattern = DOMAIN + '_api/posts/{post_id}/links' post_comments_url_pattern = DOMAIN + '_api/posts/{post_id}/comments'
# 归并排序 class Solution: def MergeSort(self, arrayList): arrayLen = len(arrayList) # 判断输入参数的正确性 if arrayLen < 1: return [] # 归并的出口是当分解到长度为1的时候 if arrayLen == 1: return arrayList # 获取中间索引值 middleIndex = arrayLen >> 1 # 递归左边部分 ...
import re import json import sys import os args = sys.argv if (len(args) < 2): sys.exit(1) path = args[1] if(path[-1:] == "/"): path = path[:-1] result_filedata_list = [] interface_info = {} target_filepath_list = [] target_filepath_list.append('/1/stdout.txt') target_filepath_list.append('/2/stdout.txt') ...
from colorama import init as initColorama from colorama import Fore, Back, Style initColorama() inputPrefix = ">> " def input_(message): return input(Fore.LIGHTGREEN_EX + inputPrefix + Style.RESET_ALL + message)
import math import tkinter import time import random import turtle import os ZLOS=input('请输入: 1.计算器 2.随机数生成器(原创) 3.猜随机数(原创) 4.时钟 5.exit') if ZLOS==str(1): root = tkinter.Tk() root.resizable(width=False, height=False) '''hypeparameter''' # 是否按下了运算符 IS_CALC = False # 存储数字 STORAGE = [] # 显示...
#!/usr/bin/python import sys import re from operator import itemgetter, attrgetter import bisect from datetime import * import traceback valid_cigar = set("0123456789MNID") read_len_margin = 0 ### Adds missing starting points when exon length is 1 ########## def update_missing_points(points_idx, points): poi...
from .base_stage import PipelineStage from .data_types import FiducialCosmology, SACCFile import numpy as np class TXTwoPointTheoryReal(PipelineStage): """ Compute theory in CCL in real space and save to a sacc file. """ name = "TXTwoPointTheoryReal" inputs = [ ("twopoint_data_real", SACC...
# coding=utf-8 from __future__ import absolute_import from __future__ import print_function from __future__ import unicode_literals from unittest import TestCase from po_localization.strings import escape, unescape, UnescapeError class EscapeTextCase(TestCase): def test_empty(self): self.assertEqual("",...
from output.models.nist_data.atomic.unsigned_int.schema_instance.nistschema_sv_iv_atomic_unsigned_int_max_inclusive_4_xsd.nistschema_sv_iv_atomic_unsigned_int_max_inclusive_4 import NistschemaSvIvAtomicUnsignedIntMaxInclusive4 __all__ = [ "NistschemaSvIvAtomicUnsignedIntMaxInclusive4", ]
import sys from .parent_parser import ParentParser class ListSitesParser: """ Parser to list sites """ @staticmethod def list_site_parser(): """Method to parse list sites arguments passed by the user""" parent_parser = ParentParser() parser = parent_parser.parent_parser_wit...
import requests import re from pathlib import Path import os def get_file_name_from_cd(cd): """ GET FILE NAME FORM CONTENT-DISPOSITION ATTRIBUTE OF RESPONSE HEADER Arguments: cd {string} -- content-disposition attribute of a response header, usually: r.headers.get('content-disposition') """ if...
from rest_framework import serializers from shop.conf import app_settings from shop.serializers.bases import BaseOrderItemSerializer class OrderItemSerializer(BaseOrderItemSerializer): summary = serializers.SerializerMethodField( help_text="Sub-serializer for fields to be shown in the product's summary.")...
import typing import re import jk_prettyprintobj from .CfgKeyValueDefinition import CfgKeyValueDefinition class CfgComponent_Defs(jk_prettyprintobj.DumpMixin): ################################################################################################################################ ## Constructors ###...
""" This module lets you practice DEBUGGING when LOGIC ERRORS occur. That is, no run-time exception occurs, but the function simply does not do the right thing. Authors: David Mutchler, Dave Fisher, Valerie Galluzzi, Amanda Stouder, their colleagues and Yi Li. """ # DONE: 1. PUT YOUR NAME IN THE ABOVE LINE....
#!/usr/bin/env python3 # Copyright (c) 2015-2016 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. # # Test new Bitcoinevelin multisig prefix functionality. # from test_framework.test_framework import Bi...
""" Django settings for MiG project. Generated by 'django-admin startproject' using Django 1.10.5. For more information on this file, see https://docs.djangoproject.com/en/1.10/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.10/ref/settings/ """ import os imp...
# -*- coding: utf-8 -*- # # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the #...
# -*- coding: utf-8 -*- """ oauthlib.oauth2.rfc6749.grant_types ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ """ from __future__ import absolute_import, unicode_literals import json import logging from .. import errors from ..request_validator import RequestValidator from .base import GrantTypeBase log = logging.getLogger(_...
from unittest import TestCase from brain.models.sqlobjects import Job class TestModelsJob(TestCase): def setUp(self): self.scan_id = "scan_id" self.filename = "filename" self.probename = "probename" def test___init__(self): job = Job(self.scan_id, self.filename, self.probenam...
import os from deep_utils.utils.os_utils.os_path import split_extension class ModelCheckPoint: def __init__(self, model_path, model, monitor='min', save_best_only=True, overwrite=True, verbose=True, ...
from __future__ import absolute_import from __future__ import division import cv2 import numpy as np import torch from PIL import Image, ImageOps def dortmund_distort(img, random_limits=(0.8, 1.1)): """ Creates an augmentation by computing a homography from three points in the image to three randomly gen...
""" Micro Python driver for SD cards using SPI bus. Requires an SPI bus and a CS pin. Provides readblocks and writeblocks methods so the device can be mounted as a filesystem. Example usage on pyboard: import pyb, sdcard, os sd = sdcard.SDCard(pyb.SPI(1), pyb.Pin.board.X5) pyb.mount(sd, '/sd2') os.l...
import gym from rlberry.spaces import Discrete from rlberry.spaces import Box from rlberry.spaces import Tuple from rlberry.spaces import MultiDiscrete from rlberry.spaces import MultiBinary from rlberry.spaces import Dict def convert_space_from_gym(gym_space): if isinstance(gym_space, gym.spaces.Discrete): ...
import base64 def makeEncryptString(Crypto, createLogger): def encryptString(publicKey, string): logger = createLogger(__name__) pubKey = Crypto.PublicKey.RSA.importKey(str.encode(publicKey)) encryptedString = pubKey.encrypt(string.encode('utf-8'),5000) base64StringEncrypted = base64...
# -*- coding: utf-8 -*- import collections Nodo = collections.namedtuple('Nodo', 'diametro nodo_izq nodo_der') def puede_colocar_tira(info_tiras): diametro_mayor, _ = info_tiras[0] arbol_pelotitas = crear_arbol_pelotas(diametro_mayor) arbol_luces = crear_arbol_luces(info_tiras[1]) puede_colocar = co...
DOMAIN = "midea_ac_lan" DEVICES = "devices" MANAGERS = "managers" CONF_K1 = "k1" CONF_MAKE_SWITCH = "make_switch" FAN_VERY_LOW = "very low" FAN_VERY_HIGH = "very high" FAN_FULL_SPEED = "full speed" TEMPERATURE_MAX = 30 TEMPERATURE_MIN = 17
import sys import os _force_color = None def set_force_color(force_color): global _force_color _force_color = force_color def support_color(): if _force_color is not None: return _force_color if not sys.stdout.isatty(): return False if os.name == 'posix': return True i...
""" Copyright (c) 2019 Intel Corporation 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,...
import sys sys.path.insert(1, "../../../") import h2o def binop_lte(ip,port): iris = h2o.import_file(path=h2o.locate("smalldata/iris/iris_wheader.csv")) rows, cols = iris.dim iris.show() #frame/scaler res = iris <= 5 res_rows, res_cols = res.dim assert res_rows == rows and res_c...
from django.apps import AppConfig from django.utils.translation import ugettext_lazy as _ class AdsConfig(AppConfig): name = 'dartcms.apps.ads' verbose_name = _('Ads')
# -*- coding: utf-8 -*- # vispy: gallery 30 # ----------------------------------------------------------------------------- # Copyright (c) Vispy Development Team. All Rights Reserved. # Distributed under the (new) BSD License. See LICENSE.txt for more info. # -----------------------------------------------------------...
import logging from .Container import Container class SyslogUdpClientContainer(Container): def __init__(self, name, vols, network, image_store, command=None): super().__init__(name, 'syslog-udp-client', vols, network, image_store, command) def get_startup_finished_log_entry(self): return "Sys...
#coding=utf-8 """ Django settings for workPush project. Generated by 'django-admin startproject' using Django 1.8. For more information on this file, see https://docs.djangoproject.com/en/1.8/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.8/ref/settings/ """...
# Copyright (c) 2014-present PlatformIO <contact@platformio.org> # # 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 appli...
from typing import List from functools import lru_cache class Solution: def canPartitionKSubsets(self, nums: List[int], k: int) -> bool: numsSum = sum(nums) if numsSum % k != 0: return False else: subSum = int(numsSum / k) cntSum = 0 midNums =...
import pyaf.Bench.TS_datasets as tsds import tests.artificial.process_artificial_dataset as art art.process_dataset(N = 32 , FREQ = 'D', seed = 0, trendtype = "ConstantTrend", cycle_length = 0, transform = "Anscombe", sigma = 0.0, exog_count = 20, ar_order = 12);
#!/usr/bin/env python # # Electrum - lightweight Futurocoin client # Copyright (C) 2012 thomasv@gitorious # # 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 wi...
import itertools import copy import numpy as np import warnings from pettingzoo import AECEnv, ParallelEnv import gym from pettingzoo.utils.agent_selector import agent_selector from pettingzoo.utils import wrappers, conversions def env(**kwargs): env = raw_env(**kwargs) env = wrappers.AssertOutOfBoundsWrappe...
from math import sqrt from random import random from cell_workers.utils import distance from human_behaviour import random_lat_long_delta, sleep class StepWalker(object): def __init__(self, bot, dest_lat, dest_lng): self.bot = bot self.api = bot.api self.initLat, self.initLng = self.bot...
import discord import subprocess import os, random, re, requests, json import asyncio from datetime import datetime from discord.ext import commands class Economy(commands.Cog): def __init__(self, bot): self.bot = bot @commands.Cog.listener() async def on_ready(self): print('[+] Shop Code ACTIVE!') @commands...
from datetime import datetime from PIL import Image, ImageDraw, ImageFont def date_the_image(src: str, desc: str, size=800) -> None: """日付を付けて、保存する :params src: 読み込む画像のパス :params desc: 保存先のパス :params size: 変換後の画像のサイズ """ # 開く im = Image.open(src) # 800 x Heig...
#!/usr/bin/python3CircuitLine # -*- coding: utf8 -*- # Copyright (c) 2020 Baidu, Inc. 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/licen...
# -*- coding:utf-8 -*- from .api import Stain
from enum import Enum from .utils import ParamReprMixin class Edge(ParamReprMixin): DIRECTIONS = Enum('DIRECTIONS', ('forward', 'backward')) def __init__(self, backward_node, forward_node, direction=None): self.backward_node = backward_node self.forward_node = forward_node self.direc...
import unittest from sdk.signature_generator import SignatureGenerator class TestSignatureGenerator(unittest.TestCase): def setUp(self): pass def tearDown(self): pass def test_with_empty_body(self): method = "GET" path = "/v1/wallets" timestamp = 1581850266351 ...
""" The script converts the columns to categorical features & removes the outliers """ from utility import create_log, parse_config, read_data from prepare_data_util import balance_the_dataset, convert_cat, cols_with_ouliers create_log("prepare_data.log") # Creating log file #####################################...
# No.1/2019-06-03/80 ms/13.3 MB class Solution: def lengthOfLongestSubstring(self, s): l=[] length=0 for letter in s: if letter in l: l=l[l.index(letter)+1:] l.append(letter) if len(l)>length: length=len(l) return l...
import requests from allauth.socialaccount.providers.discord.provider import DiscordProvider from allauth.socialaccount.providers.oauth2.views import OAuth2Adapter from allauth.socialaccount.providers.oauth2.views import OAuth2CallbackView from allauth.socialaccount.providers.oauth2.views import OAuth2LoginView class...
# -*- coding: utf-8 -*- from bottle import Bottle, response, request, run, route, HTTPResponse, hook, static_file import json import traceback from lib.db import engine, plugin, sqlalchemy, db from models import Category, FireHydrant from utils.formatter import convert_to_integer from utils.validator import ErrorMessag...
#!/usr/bin/python3 from brownie import SimpleCollectible, accounts, network, config token_uri = "ipfs://QmberWNJ1Y169SKx2NPkM6Pk7hffUEXDFyGe9Zq789zYrV/" def main(): dev = accounts.add(config["wallets"]["from_key"]) print(network.show_active()) # Get the token ID. simple_collectible = SimpleCollectib...
#!/usr/bin/env python import os import sys from pathlib import Path if __name__ == "__main__": os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings.local") try: from django.core.management import execute_from_command_line except ImportError: # The above import may fail for some...
import asyncio import json import ssl from contextlib import asynccontextmanager from pathlib import Path from typing import Any, Dict, Optional import websockets from chia.types.blockchain_format.sized_bytes import bytes32 from chia.util.config import load_config from chia.util.json_util import dict_to_json_str from...
# -*- coding: utf-8 -*- # Copyright 2015 Mirantis, Inc. # # 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 requi...
from sklearn.model_selection import ShuffleSplit, StratifiedShuffleSplit from sklearn.utils import shuffle as skshuffle def shuffle(x, random_state=None): return skshuffle(x, random_state=random_state) def split_shuffle(X,y=None, random_state=None): sss = ShuffleSplit(n_splits=1, test_size=0.25, random_state=...
from rest_framework import generics, authentication, permissions from rest_framework.authtoken.views import ObtainAuthToken from rest_framework.settings import api_settings from user.serializers import UserSerializer, AuthTokenSerializer class CreateUserView(generics.CreateAPIView): """Create a new user in the s...
load("@rules_pmd//pmd:dependencies.bzl", "rules_pmd_dependencies") load("@bazelrio//:defs.bzl", "setup_bazelrio") load("@bazelrio//:deps.bzl", "setup_bazelrio_dependencies") def setup_dependencies(): rules_pmd_dependencies() setup_bazelrio_dependencies( toolchain_versions = "2022-1", wpilib_ver...
#!/usr/bin/env python from Utils.WAAgentUtil import waagent import Utils.HandlerUtil as Util ExtensionShortName = "SampleExtension" def main(): #Global Variables definition waagent.LoggerInit('/var/log/waagent.log','/dev/stdout') waagent.Log("%s started to handle." %(ExtensionShortName)) operation =...
from scout.parse.variant.coordinates import ( get_cytoband_coordinates, get_sub_category, get_length, get_end, parse_coordinates, ) class CyvcfVariant(object): """Mock a cyvcf variant Default is to return a variant with three individuals high genotype quality. """ def __...
#@+leo-ver=4 #@+node:@file redirect.py """ Insert a redirect from a uri to an existing URI This is the guts of the command-line front-end app fcpredirect Example usage: $ fcpredirect KSK@darknet USK@PFeLTa1si2Ml5sDeUy7eDhPso6TPdmw-2gWfQ4Jg02w,3ocfrqgUMVWA2PeorZx40TW0c-FiIOL-TWKQHoDbVdE,AQABAAE/Index/35/ Inserts key...