content stringlengths 5 1.05M |
|---|
from toolbox.exp.OutputSchema import OutputSchema
from toolbox.utils.ModelParamStore import ModelParamStoreSchema
from toolbox.utils.Visualize import VisualizeSchema
class Self:
pass
def init_by_output(self: object, output: OutputSchema):
self.debug = output.logger.debug
self.log = output.logger.info
... |
from setuptools import setup, find_packages
import os
version = '0.3.dev0'
setup(name='Hyperkit',
version=version,
url="http://yaybu.com/",
description="Hypervisor tools",
long_description = open("README.rst").read(),
author="Isotoma Limited",
author_email="support@isotoma.com",
... |
"""
File: weather_master.py
-----------------------
This program should implement a console program
that asks weather data from user to compute the
average, highest, lowest, cold days among the inputs.
Output format should match what is shown in the sample
run in the Assignment 2 Handout.
"""
EXIT = -100
def main():... |
from .... pyaz_utils import _call_az
def list(gateway_name, resource_group):
'''
List redirect configurations.
Required Parameters:
- gateway_name -- The name of the application gateway.
- resource_group -- Name of resource group. You can configure the default group using `az configure --defaults ... |
# -*- coding: utf-8 -*-
import unittest
from unittest import TestCase
from random import uniform, randint
import numpy as np
import matplotlib.pyplot as plt
import time
from knapsack_problem.knapsack_ga import Candidate, ObjectsList, stop_search, search, apply_selection, apply_crossover, apply_mutation, create_initia... |
from utils import *
import subprocess
import types
Language.PYTHON = Language("python", "", ">>>", "py")
doctest = re.compile(r" *# Q.* - .*")
# https://stackoverflow.com/questions/940822/regular-expression-syntax-for-match-nothing
expect = re.compile(r"$^")
test = re.compile(r" *>>> .*\n")
no_tests = re.compile(r"$^... |
"""
Main command line entry point to manage all other sub commands
"""
import os
import click
import insar
import matplotlib.pyplot as plt
# Main entry point:
@click.group()
@click.option('--verbose', is_flag=True)
@click.option(
'--path',
type=click.Path(exists=False, file_okay=False, writable=True),
def... |
import numpy as np
from scipy import signal
def extract_color(frame, channel):
return np.mean(frame[:, :, channel])
def butter_bandpass(low_cut, high_cut, fs, order=5):
nyq = 0.5 * fs
low = low_cut / nyq
high = high_cut / nyq
b, a = signal.butter(order, [low, high], btype='band')
return b, a... |
from environment.constants import ROTATE_LEFT, RIGHT, LEFT, ROTATE_RIGHT, FIRE, BREAK, DOWN, UP
class Enviroment:
def __init__(self):
self.action_space = self.create_action_space()
def create_action_space(self):
action_space = [LEFT, RIGHT, UP, DOWN, ROTATE_LEFT, ROTATE_RIGHT, FIRE, BREAK]... |
import json
import xmltodict
from csv_to_xml import *
def json_to_xml(filePath, outputFilePath):
f = open(filePath, "r")
data = json.load(f)
f.close()
first_data = data["data"][0]
rows = len(data["data"])
data_keys = list(first_data.keys())
csv_string = ",".join(data_keys)
for i in ... |
import PyQt5
import matplotlib.pyplot as plt
import sys
import os
import scale_plots
class SCALE_PLOTS_GUI(PyQt5.QtWidgets.QMainWindow):
def __init__(self):
PyQt5.QtWidgets.QMainWindow.__init__(self)
# Grab the plots object
self.plots = scale_plots.Plots()
# Variables for filena... |
import logging
logger = logging.getLogger('classla')
logger.setLevel(logging.DEBUG) |
from linora.utils.Message._bot import * |
from pandac.PandaModules import *
class ChatBalloon:
TEXT_SHIFT = (0.1, -0.05, 1.1)
TEXT_SHIFT_PROP = 0.08
NATIVE_WIDTH = 10.0
MIN_WIDTH = 2.5
BUBBLE_PADDING = 0.3
BUBBLE_PADDING_PROP = 0.05
BUTTON_SCALE = 6
BUTTON_SHIFT = (-0.2, 0, 0.6)
def __init__(self, model):
self.mode... |
from .analyze import *
from .data import *
from .geophotos import * |
# -*- coding: utf-8 -*-
"""
Created on 17 July 2019
@author: Jonas Karthein
@contact: jonas.karthein@cern.ch
@license: MIT license
"""
import sys, os, glob, json, csv
import numpy as np
import pandas as pd
import matplotlib as mpl
import matplotlib.pyplot as plt
import scipy.optimize
class Freq_ratio():
# clas... |
"""Demo views for `django-docusign`."""
from __future__ import unicode_literals
import os
from django.core.files.base import ContentFile
from django.utils.text import slugify
from django.utils.timezone import now
from django.views.generic import FormView, RedirectView, TemplateView
from django.views.generic.detail im... |
from django.core.urlresolvers import reverse
from django.db.models import Min
from django.http import HttpResponse
from django.forms.models import modelformset_factory
from django.shortcuts import redirect, get_object_or_404
from django.template import loader
from django.utils import timezone
from event_cal.models imp... |
from .Constants import Ops, Addr
from .Image import Image
from .RTIBlock import RTIBlock
from .Position import Position
class Sequence:
def __init__(self, bank, index):
self.bank = bank
self.index = index
self.repeat = 1
# Add 8 RTI blocks
self.images = []
for ind... |
from click.core import Context, Command, Group
from emmet.cli import emmet
def recursive_help(cmd, parent=None):
ctx = Context(cmd, info_name=cmd.name, parent=parent)
print("```")
print(cmd.get_help(ctx))
print("```")
commands = getattr(cmd, "commands", {})
for sub in commands.values():
... |
from models import TransformerNet
import cv2
from utils import *
import torch
from torch.autograd import Variable
import argparse
import os
import tqdm
from PIL import Image
import numpy as np
import cv2
import collections
def get_frame(cap):
while (True):
# Capture frame-by-frame
ret, frame = ... |
# Just a silly test file.
execfile("textadv/basicsetup.py")
#from textadv.basicsetup import *
world[Global("game_title")] = "Test Game"
world[Global("game_author")] = "Kyle Miller"
world[Global("game_description")] = "Let's see if we can't get this engine to work..."
world.activity.def_obj("room0", "room")
world[Nam... |
from dash_bootstrap_components._components.Button import Button
import dash_html_components as html
import dash_core_components as dcc
import dash_bootstrap_components as dbc
from dash_html_components.B import B
from dash_html_components.Br import Br
from components.oversampling.input import OversamplingInput, oversam... |
# -*- coding: utf-8 -*-
from django.core.exceptions import FieldError
from django.template.loader import render_to_string
from rest_framework.response import Response
from rest_framework.generics import ListAPIView
from rest_framework.filters import BaseFilterBackend
from rest_framework.permissions import IsAuthentic... |
# -*- coding: utf-8 -*-
import logging
from odoo import http
_logging = logging.getLogger(__name__)
class HrAttendaceExtend(http.Controller):
@http.route('/hr_attendace_extend', methods=['GET', 'POST'], type='json',
auth='public')
def index(self, **kw):
records = http.request.params.g... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from compas.geometry import centroid_points
from compas.geometry import transform_points
from compas.geometry import Transformation
from compas.geometry import Frame
from compas.geometry import Vector
from com... |
import sys
from BTreeUtils import BTreeHelper, TreeNode
class Solution:
def serialize(self, root):
arr = []
self.preoder_t(root, arr)
result = ''
for idx, ele in enumerate(arr):
result += str(ele)
if idx < len(arr) - 1:
result += ','
... |
# Generated by Django 2.0.13 on 2019-04-07 12:22
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('videos', '0006_auto_201... |
#!/usr/bin/env python3
from pathlib import Path
import sys
import cv2
import depthai as dai
import numpy as np
from time import monotonic
# Get argument first
mobilenet_path = str((Path(__file__).parent / Path('models/mobilenet.blob')).resolve().absolute())
video_path = str(Path("./construction_vest.mp4").resolve().a... |
import pdb
import torch
from torch import optim, nn
from torch.utils.data import Dataset, DataLoader
from load import Mapping
from model import TransE
from prepare_data import TrainSet, TestSet
import os
import torch.multiprocessing as mp
device = torch.device('cpu')
train_batch_size = 32
test_batch_size = 256
num_epo... |
# Copyright 2016 The Bazel 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 by applicable la... |
#!/usr/bin/env python
# encoding: utf-8
#!/usr/bin/env python
# encoding: utf-8
'''
静态配置
'''
import logging
from logging.config import dictConfig
import sys
import os
import shutil
from os.path import expanduser
VERSION = "0.3.0"
PROJECT_NAME = "danmufm"
MODULE_NAME = PROJECT_NAME.lo... |
#------------------------------------------------------------------------------
# Copyright (c) 2008, Riverbank Computing Limited
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD license.
# However, when used with the GPL version of PyQt the additional terms described in ... |
import pprint
import arxiv
import pandas as pd
l = arxiv.query(query='au:"Grisha Perelman"')
print(type(l))
# <class 'list'>
print(len(l))
# 3
print(type(l[0]))
# <class 'feedparser.FeedParserDict'>
pprint.pprint(l[0], width=200)
# {'affiliation': 'None',
# 'arxiv_comment': '39 pages',
# 'arxiv_primary_category... |
#! usr/bin/python3.6
"""
Module initially auto generated using V5Automation files from CATIA V5 R28 on 2020-07-06 14:02:20.222384
.. warning::
The notes denoted "CAA V5 Visual Basic Help" are to be used as reference only.
They are there as a guide as to how the visual basic / catscript function... |
from gui import *
from element import *
from container import *
from clickable import *
from hoverable import *
from hbox import *
from vbox import *
from grid import *
from events import *
from event_manager import *
from nineslice import *
from textable import *
from scrollable import *
|
import os
import fnmatch
def find_music(start, extension):
for path, dirs, files in os.walk(start):
for file in fnmatch.filter(files, '*.{}'.format(extension)):
absolute_path = os.path.abspath(path)
yield os.path.join(absolute_path, file)
for f in find_music('music', 'emp3'):
... |
def plotTrajectory(figNumStart, ydata, steps):
"""
ydata is in format ['%i-%i'%(conc, inp.ntot-conc)]['box2'][sim]
Iterate over first keys for columns of trajectory subplot, and over first two
indexes of 2nd keys for rows in subplot
"""
colors = ['aqua', 'black', 'blue', 'brown',
... |
import random
import string
import unittest
from src.interpreter.interpreter import Interpreter
def int_list(lis):
return [i.value for i in lis]
def random_word(length):
letters = string.ascii_lowercase
return ''.join(random.choice(letters) for _ in range(length))
class InterpreterTes... |
#!/usr/bin/env python
import math
import rospy
from hopper_msgs.msg import HopperMoveCommand
import pyglet
class HopperTeleop(pyglet.window.Window):
def __init__(self):
super(HopperTeleop, self).__init__()
rospy.init_node('hopper_teleop', disable_signals=True)
self.publisher = rospy.Publis... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Date : 2017-09-29 10:33:20
# Author : moling3650
import re
import time
import random
import pymysql
import requests
from bs4 import BeautifulSoup
HEADERS = {'user-agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:51.0) Gecko/20100101 Firefox/51.0'}
class ZhiLianSpider... |
from tkinter import *
from app_tools import *
from app_selector import *
from app_dictionary import _, load_dictionary
class AppField(Toplevel):
"""Window object for managing a field to fill an alias or to define a function
Arguments:
Toplevel {Toplevel (tkinter)} -- Window blocking actio... |
def status_code_event(self, url, r, aggregation_key):
self.event({
'timestamp': int(time.time()),
'event_type': 'http_check',
'msg_title': 'Invalid reponse code for %s' % url,
'msg_text': '%s returned a status of %s' % (url, r.status_code),
'aggregation_key': aggregation_key
... |
#!/usr/bin/env python
"""
The screen to be used when a screen transition happens
"""
from Microsoft.Xna.Framework import Color, Rectangle
from base import BaseScreen
class Transition:
speed = 1.5 # seconds
color = Color.Black
is_finished = False
def __init__(self, to_opaque=True):
self.... |
# ----------------------------------------------------------------------------------------------------------------------
# PACKAGES
# ----------------------------------------------------------------------------------------------------------------------
import torch
import torch.nn as nn
import torchvision
import torch... |
import sys
import requests
import json
import math
from matplotlib import pyplot as plt
import numpy as np
from aix360.datasets import MNISTDataset
import time
from skimage.color import gray2rgb, label2rgb # since the code wants color images
print('************************************************************')
print(... |
import os
import sys
import pathlib
from object2urdf import ObjectUrdfBuilder
# Build single URDFs
object_folder = str(pathlib.Path(__file__).parent.absolute()) + "/basketball"
builder = ObjectUrdfBuilder(object_folder, urdf_prototype='_prototype_ball.urdf')
builder.build_urdf(filename=str(pathlib.Path(__file__).pare... |
def print_palindrome(s, palindrome):
print("The largest palindrome substring in \"{}\" is \"{}\"".format(s, palindrome))
def longestPalindromicSubstring(string):
n = len(string)
if n <= 2:
palindrome = ""
if n <= 1 or (n == 2 and string[0] == string[1]):
palindrome = string
... |
from .colors import blue, red, green
from .controllers import clearConsole
from pathlib import Path
def start():
clearConsole()
_main_dir = main_dir()
_app_lang = 'react'
use_folder = create_folder_opt()
use_index = False
if (use_folder):
use_index = create_index_file_opt()
langua... |
# coding: utf-8
from enum import Enum
from six import string_types, iteritems
from bitmovin_api_sdk.common.poscheck import poscheck_model
class DolbyDigitalPlusDownmixingPreferredMode(Enum):
LO_RO = "LO_RO"
LT_RT = "LT_RT"
PRO_LOGIC_II = "PRO_LOGIC_II"
|
import json
from typing import List
from dataclasses import dataclass
from auctions.domain.entities.bid import Bid
from auctions.domain.value_objects.money import Money
class Auction:
def __init__(self, id: int, title: str, initial_price: Money, bids: List[Bid]):
assert isinstance(initial_price, Money)
... |
# -*- coding: utf-8 -*-
"""
Created on Tue Apr 12 14:41:27 2016
@author: Perk
"""
import json
import requests
import csv
from tqdm import tqdm
from itertools import izip_longest
with open('sunlight API.txt','r') as api_file:
api_key = api_file.read()
phrase_url='http://capitolwords.org/api/1/phrases... |
import time
__author__ = 'renhao.cui'
import json
import twitter
import properties
def oauth_login():
# credentials for OAuth
CONSUMER_KEY = properties.twitter_cred2['c_k']
CONSUMER_SECRET = properties.twitter_cred2['c_s']
OAUTH_TOKEN = properties.twitter_cred2['a_t']
OAUTH_TOKEN_SECRET = properti... |
import unittest
from sqrt import lazy_sqrt, builtin_sqrt, newton_sqrt1
class SqrtTests(unittest.TestCase):
"""obligatory docstring, tests square root functions"""
def test_sqrt9(self):
self.assertEqual(newton_sqrt1(9), 3)
self.assertEqual(lazy_sqrt(9), 3)
def test_sqrt2(self):
... |
from densevid_eval3.evaluate2018 import main as eval2018
from densevid_eval3.evaluate2021 import main as eval2021
def eval_dvc(json_path, reference, no_lang_eval=False, topN=1000, version='2018'):
args = type('args', (object,), {})()
args.submission = json_path
args.max_proposals_per_video = topN
args.... |
#!/usr/local/headphones/env/bin/python
import os
import ConfigParser
config = ConfigParser.SafeConfigParser()
config.read('/usr/local/headphones/var/config.ini')
protocol = 'http'
port = int(config.get('General', 'http_port'))
print 'Location: %s://%s:%d' % (protocol, os.environ['SERVER_NAME'], port)
print
|
#encoding:utf-8
from config import *
from .data_tools import *
from .equ_tools import *
from .chinese import convertChineseDigitsToArabic
import numpy as np
import json
import pdb
import jieba
#args = get_args()
class DataLoader():
def __init__(self, args, emb_dim=128):
self.args = args
self.math2... |
# coding: utf-8
from __future__ import division, unicode_literals, print_function
"""
Input sets for VASP GW calculations
Single vasp GW work: Creates input and jobscripts from the input sets for a specific job
"""
__author__ = "Michiel van Setten"
__copyright__ = " "
__version__ = "0.9"
__maintainer__ = "Michiel v... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# @Time : 2019/12/17 下午5:46
# @Author : MaybeShewill-CV
# @Site : https://github.com/MaybeShewill-CV/bisenetv2-tensorflow
# @File : __init__.py.py
# @IDE: PyCharm |
import requests
import encode_utils
from generate_from_subnets import *
def _get_keywords_from_google(url='https://gist.githubusercontent.com/zythum/2848881/raw/4bae5bd21da3ed44b8a2cc9d2c1d6cd4c70dc74c/gistfile1.txt'):
r = requests.get(url)
if r.status_code != 200:
return []
r.encoding = 'utf-8'
... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import cv2
import os
import numpy as np
import time
import torch
from torchvision.ops import nms
from .utils.decode import ctdet_decode
from .utils.image import get_affine_transform, affine_transform
from .util... |
from garpixcms.urls import * # noqa
urlpatterns = [] + urlpatterns # noqa
|
from django.contrib.auth.models import User
from django.shortcuts import render, get_object_or_404, redirect
from userprofile.models import UserProfileData
from .forms import *
from django.contrib.auth.decorators import login_required
from annoying.decorators import ajax_request
@login_required(login_url='/accounts/l... |
from .discovery import FeedUrl, discover_web_page_feeds
__all__ = ["discover_web_page_feeds", "FeedUrl"]
|
# Copyright 2021 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import annotations
import os
from dataclasses import dataclass
from typing import Callable, Iterator
from pants.engine.fs import AddPrefix, Digest, MergeDigests, Snapshot... |
#!/usr/bin/env python3
import sys
import actionlib
import rospy
from actionlib_msgs.msg import GoalStatus
from geometry_msgs.msg import Twist
from bitbots_msgs.msg import JointCommand, DynUpAction, DynUpGoal
import math
def callback(msg):
output_string = "{\n \"author\": \"walkready_script\", \n \"description\":... |
from rest_framework import serializers
from rest_framework import viewsets
from .models import Bot, TransactionHistory
class BotSerializer(serializers.Serializer):
'''
id = models.AutoField(primary_key=True)
user = models.ForeignKey(User, on_delete=models.CASCADE)
balance = models.FloatField(max_length... |
from django.contrib import admin
from blog.models import Article, Comment, Tag
admin.site.register(Article)
admin.site.register(Comment)
admin.site.register(Tag)
|
def AddSysPath(new_path):
import sys, os
# standardise
new_path = os.path.abspath(new_path)
# MS-Windows does not respect case
if sys.platform == 'win32':
new_path = new_path.lower()
# disallow bad paths
do = -1
if os.path.exists(new_path):
do = 1
# check against all paths currently available
for ... |
# 01_blink4.py
# This program blinks the LEDs randomly at random timed intervals
import time
import random
from rrb3 import *
rr = RRB3()
print("Press CTRL-c to quit the program")
while True:
rr.set_led1(random.randint(0,1))
rr.set_led2(random.randint(0,1))
time.sleep(random.uniform(0,0.2))
|
from userDetails import UserAccount
from credentialsDetails import UserCredentials
def welcome():
print(' __ __ __ _____ ')
print(' || / \\ || ||=== ||')
print(' ||// \\ || ||=== || ')
print(' |_/ \_| ||=== ||====')
welcome()
def createNewUserA... |
import napari
from waver.datasets import load_simulation_dataset
# Define root path for simulation
path = './simulation_dataset.zarr'
dataset = load_simulation_dataset(path)
# Load data into napari
viewer = napari.Viewer()
for data in dataset:
viewer._add_layer_from_data(*data)
napari.run() |
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
from matplotlib import get_backend
from numba import jit
from scipy.integrate import odeint
#################################################################... |
import ipywidgets as widgets
from IPython.display import display
class UserInputUI:
def __init__(self):
self.submission_id_tb = widgets.Text(
description='Submission Id:',
value=None,
placeholder='XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX',
style={'description_wi... |
# -*- coding: utf-8 -*-
"""
Created on 9 May 2018
@author: Dylan Jones
This module contains the Constants object, wich gets initialized for later use
"""
from scipy import constants as c
_m = 1 # mass of the particle: Set to one for atomic units
_hbar = 1 # hbar: Set to one for atomic units
class Constants:
... |
import six
import operator
def generate(client):
xsd_schema = client.wsdl.types
wsdl = client.wsdl
for service in wsdl.services.values():
print(service.name)
print('=' * len(service.name))
print()
print('.. py:class:: ServiceProxy')
print()
for port in ser... |
import os
from pathlib import Path
import pytest
from tbm_utils import convert_unix_path
@pytest.mark.skipif(os.name != 'nt', reason="Windows-only test")
@pytest.mark.parametrize(
'value',
[
'/cygdrive/d/Music/test.mp3',
'/d/Music/test.mp3',
'D:/Music/test.mp3',
'D:\\Music\\test.mp3',
r'D:\Music\test.mp... |
import dataclasses
import os
from typing import Any, Dict
import yaml
from snappy.cli.constants import YAML_FILE
from snappy.cli.helpers.common import get_app_dir
YamlData = Dict[str, Any]
def get_yaml_path() -> str:
app_dir = get_app_dir()
return os.path.join(app_dir, YAML_FILE)
def write_configuration_y... |
# -*- coding: utf-8 -*-
import sys
import inquirer
from inquirer.render.console import ConsoleRender
from . import CLITheme
from .schema import CLIRecordBuilder
from ..schema import SCHTree
from ..db import DataBase
from ..utils import get_root_value_ids
def new_record(schema_path="schema.json",
db_... |
#dcel implementation
#DCEL.py
import math as m
# Utils
def findHAngle(dx, dy):
"""Determines the angle with respect to the x axis of a segment
of coordinates dx and dy
"""
l = m.sqrt(dx*dx + dy*dy)
if dy > 0:
return m.acos(dx/l)
else:
return 2*m.pi - m.acos(dx/l)
class Vertex:... |
from typing import Any
from ssz.exceptions import DeserializationError, SerializationError
from ssz.sedes.basic import BasicSedes
class UInt(BasicSedes[int, int]):
def __init__(self, num_bits: int) -> None:
if num_bits % 8 != 0:
raise ValueError("Number of bits must be a multiple of 8")
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# File: 'petitdb.py'
"""Simple interface to store/retreive objects from shelves."""
import os
import copy
import shelve
__version__ = '1.2'
########################
# Exceptions
########################
class DBError(Exception):
"""Base error"""
pass
class D... |
from __future__ import print_function
import os
import shutil
import numpy as np
from functools import partial
import tensorflow as tf
from tensorflow import keras
from tensorflow.keras.datasets import fashion_mnist
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Dense, Dropout, Flatt... |
from collections import defaultdict
def freqQuery(queries):
val_counts = defaultdict(int)
freq_counts = defaultdict(int)
answers = []
for i, j in queries:
if i == 1:
# O(1)
if j in val_counts:
# decrement the value's old count
if freq... |
# TouchCircle.py - The circle that moves and supports being clicked on.
# Created by Josh Kennedy on 19 May 2014
#
# Pop a Dots
# Copyright 2014 Chad Jensen and Josh Kennedy
# Copyright 2015-2016 Sirkles LLC
import pygame
import random
import Circle
import Colors
import HelperAPI
import Vector2
# We're inheriting f... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# 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 ... |
#
# @lc app=leetcode id=746 lang=python
#
# [746] Min Cost Climbing Stairs
#
# https://leetcode.com/problems/min-cost-climbing-stairs/description/
#
# algorithms
# Easy (45.67%)
# Total Accepted: 64.9K
# Total Submissions: 141.6K
# Testcase Example: '[0,0,0,0]'
#
#
# On a staircase, the i-th step has some non-nega... |
import numpy as np
import torch as th
from PoisDenoiser.networks.PoisNet.net import PoisNet
from pydl.networks.UDNet.net import UDNet
from PoisDenoiser.dataset_loader import FMD
from torch.utils.data import DataLoader
from torch.optim import Adam
from torch.optim.lr_scheduler import ReduceLROnPlateau, MultiStepLR
fr... |
a = int(input())
lista = []
lista2 = []
lista3 = []
alunos = 0
novanota = 0
while a != alunos:
n=float(input())
lista.append(n)
alunos += 1
for i in lista[0:]:
n1 = float(input())
lista2.append(n1)
while n1 == 10:
if (lista[i] + 2) <= 10:
lista3.append(lista[i]+ 2.00)
... |
import tensorflow as tf
import matplotlib.pyplot as plt
import keras
from keras.models import model_from_json
from BirdRoostLocation import utils
import BirdRoostLocation.LoadSettings as settings
KERAS_SAVE_FILE = "{}{}.h5"
LOG_PATH = "model/{}/{}/"
LOG_PATH_TIME = "model/{}/{}/{}/"
CHECKPOINT_DIR = "/checkpoint/"
d... |
#
# author: Jungtaek Kim (jtkim@postech.ac.kr)
# last updated: March 22, 2021
#
"""It defines Student-:math:`t` process regression."""
import time
import numpy as np
import scipy.stats
from bayeso import covariance
from bayeso import constants
from bayeso.tp import tp_kernel
from bayeso.utils import utils_gp
from bay... |
import logging
logging.basicConfig(level=logging.WARNING) |
# Generated by Django 3.1.4 on 2020-12-24 15:25
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('articles', '0003_auto_20201224_1516'),
]
operations = [
migrations.AlterField(
model_name='freearticle',
name='tier'... |
import unittest
import solution
class TestQ(unittest.TestCase):
def test_case_0(self):
self.assertEqual(solution.buildString(4, 5, 'aabaacaba'), 26)
self.assertEqual(solution.buildString(8, 9, 'bacbacacb'), 42)
def test_case_1(self):
self.assertEqual(solution.buildString(1, 2, 'cbaas... |
#! /usr/bin/env python
# Print the product of age and size of each file, in suitable units.
#
# Usage: byteyears [ -a | -m | -c ] file ...
#
# Options -[amc] select atime, mtime (default) or ctime as age.
import sys, os, time
from stat import *
# Use lstat() to stat files if it exists, else stat()
try:
statfunc ... |
import pyblish.api
import pype.api
class ValidateShotDuplicates(pyblish.api.ContextPlugin):
"""Validating no duplicate names are in context."""
label = "Validate Shot Duplicates"
hosts = ["standalonepublisher"]
order = pype.api.ValidateContentsOrder
def process(self, context):
shot_names... |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
#
# generated by wxGlade 0.6.8 (standalone edition) on Tue Aug 27 13:49:40 2013
#
import wx
# begin wxGlade: dependencies
# end wxGlade
# begin wxGlade: extracode
# end wxGlade
class MyFrame(wx.Frame):
def __init__(self, *args, **kwds):
# begin wxGlade: MyF... |
import socket
import sys
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
host = sys.argv[1]
port = None
try:
port = int(sys.argv[2])
except IndexError:
port = 1166
print("Starting client to {} on port {}...".format(host, port))
s.connect((host, port))
print("Connected!")
while True:
msg = input(":"... |
# -*- coding: utf-8 -*-
"""
Defines PNCursorTableModel class.
"""
from PyQt6 import QtCore, QtGui, QtWidgets # type: ignore[import]
from pineboolib.core.utils import logging, utils_base
from sqlalchemy import exc, orm, inspect, engine
from pineboolib.application.utils import date_conversion, xpm
from .orm import u... |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from .. import _utilities
__a... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.