content
stringlengths
5
1.05M
# Generated by Django 3.0.8 on 2020-09-10 16:17 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('tensor_site', '0006_applicationmodel_date'), ] operations = [ migrations.AddField( model_name='applicationmodel', na...
def get_map(rei): def get_map_for_user_struct(user_struct): return { 'user_name': str(user_struct.userName), 'irods_zone': str(user_struct.rodsZone), 'user_type': str(user_struct.userType), 'system_uid': user_struct.sysUid, 'authentication_info': ...
import logging import warnings import multiprocessing import time from collections import defaultdict import itertools import numpy as np import scipy as sp import statsmodels import statsmodels.stats import statsmodels.stats.proportion import pandas as pd import plotly.express as px from tqdm import tqd...
def is_prime(x): if x < 2: return False else: for n in range(2,x): if x % n == 0: return False return True counter = 0 value = 1 result = 0 while(counter < 10001): print('testing: ', counter) if is_prime(value): result = value counter ...
from dataclasses import dataclass from pathlib import Path from typing import Any, Dict, List, Optional import pandas import pytest from isolateparser.resultparser.parsers import parse_vcf data_folder = Path(__file__).parent / 'data' / 'Clonal_Output' / 'breseq_output' vcf_filename_real = data_folder / "data" / "out...
#! /usr/bin/python #*********************************************************** #* Software License Agreement (BSD License) #* #* Copyright (c) 2009, Willow Garage, Inc. #* All rights reserved. #* #* Redistribution and use in source and binary forms, with or without #* modification, are permitted provided that the ...
import unittest from gui import GUI from tkinter import * class TestGui(unittest.TestCase): def test_config(self): gui = GUI(Tk(), False) config = gui.read_config() self.assertEqual(True, len((config['commands'])) > 0) self.assertEqual({1: True, 2: True, 3: True, 4: True}, config[...
import microbit import random import math _GOLDEN_RATIO = (1 + 5 ** 0.5) / 2 class BreakOutOfALoop(Exception): pass class ContinueLoop(Exception): pass timer1 = microbit.running_time() item = 0 item2 = True def run(): global timer1, item, item2 item = min(max(item, 1), 100) item2 = (item % 2) == 0 ...
# -*- coding: utf-8 -*- """ myads_service.models ~~~~~~~~~~~~~~~~~~~~~ Models for the users (users) of AdsWS """ from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.ext.mutable import Mutable from sqlalchemy.dialects.postgresql import JSON from sqlalchemy import Column, String, Text fro...
from .time import human_time from .paginator import Paginator, EmbedPaginator from .group import group, CaseInsensitiveDict from .subprocess import run_subprocess
import logging from dsgrid.dimension.dimension_records import DimensionRecords from dsgrid.exceptions import ( DSGInvalidDimension, # DSGInvalidDimensionMapping, ) from dsgrid.utils.timing import timed_debug logger = logging.getLogger(__name__) class DimensionStore: """Provides mapping functionality f...
import os import platform import shutil import subprocess # If on Linux and this script gives a "busy file" error, please run # bash/cleanup_tbb.sh def maybe_build_tbb(): """Build tbb. This function is taken from https://github.com/stan-dev/pystan/blob/develop/setup.py""" stan_math_lib = os.path.abspath(...
""" @Project : Imylu @Module : decision_regression.py @Author : Deco [deco@cubee.com] @Created : 8/22/18 4:29 PM @Desc : """ import copy # from collections import Iterable from typing import List, TypeVar, Tuple, Union, Iterable import numpy as np from work5.load_bike_data import load_bike_sharing_dat...
import os import requests import socket from time import sleep def main(): os.system("clear") print("""\033[1;95m โ–ˆโ–ˆโ•—โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•— โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•—โ–ˆโ–ˆโ•—โ–ˆโ–ˆโ–ˆโ•— โ–ˆโ–ˆโ•—โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•— โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•—โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•— โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•”โ•โ•โ–ˆโ–ˆโ•—โ–ˆโ–ˆโ•”โ•โ•โ•โ•โ•โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ–ˆโ–ˆโ•— โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•”โ•โ•โ–ˆโ–ˆโ•—โ–ˆโ–ˆโ•”โ•โ•โ•โ•โ•โ–ˆโ–ˆโ•”โ•โ•โ–ˆโ–ˆโ•— โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•”โ•โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•— โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•”โ–ˆโ–ˆโ•— โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•‘ โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•— โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•”โ• โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•”โ•โ•โ•โ• โ–ˆโ–ˆโ•”โ•โ•โ• โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•‘โ•šโ–ˆ...
"""Steps for MANAGE ACCOUTN top bar features of Onezone page. """ from pytest_bdd import parsers, when, then from tests.gui.conftest import WAIT_BACKEND, WAIT_FRONTEND from tests.gui.utils.generic import repeat_failed __author__ = "Bartosz Walkowicz" __copyright__ = "Copyright (C) 2017 ACK CYFRONET AGH" __license__ ...
"""backend URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/3.1/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: path('', views.home, name='home') Class-based...
import logging import os import sys import time from typing import Optional import colorlog import redis from flask import Flask, request, render_template from rq import Queue from rq.exceptions import NoSuchJobError from rq.job import Job from dynoscale.config import get_redis_urls_from_environ from dynoscale.wsgi i...
__author__ = 'mnowotka' from tastypie import fields from tastypie.resources import ALL from chembl_webservices.core.utils import NUMBER_FILTERS, CHAR_FILTERS, FLAG_FILTERS from chembl_webservices.core.resource import ChemblModelResource from chembl_webservices.core.serialization import ChEMBLApiSerializer from chembl_...
"""Avatar hashes added Revision ID: 3e056e90c67 Revises: cd0c89e863 Create Date: 2015-04-11 11:36:09.772333 """ # revision identifiers, used by Alembic. revision = '3e056e90c67' down_revision = 'cd0c89e863' from alembic import op import sqlalchemy as sa def upgrade(): ### commands auto generated by Alembic - ...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import os import sys #import cgi #import cgitb #import web #cgitb.enable(display=0, logdir="/opt/scripts/crycsv/cgi.log") # import libraries in lib directory #import matplotlib #import numpy base_path = os.path.dirname(__file__) sys.path.insert(0, os.path.join(base_path, '...
# 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 __...
import time import functools import math import pyglet class AnimatedValue: def __new__(cls, start, end, duration, *w, **ka): if duration <= 0: return ConstantValue(end) return super().__new__(cls) def __init__(self, start, end, duration, easing=lambda x:x): self.start = s...
import os import json import argparse from autogluon.task import TextPrediction as task TASKS = \ {'cola': ('sentence', 'label', 'mcc', ['mcc']), 'sst': ('sentence', 'label', 'acc', ['acc']), 'mrpc': (['sentence1', 'sentence2'], 'label', 'f1', ['acc', 'f1']), 'sts': (['sentence1', 'sentence2'], 'sc...
# This file is part of the Reproducible Open Benchmarks for Data Analysis # Platform (ROB) - Top Tagger Benchmark Demo Template. # # ROB is free software; you can redistribute it and/or modify it under the # terms of the MIT License; see LICENSE file for more details. """This is a dummy example for the Top Tagger tagg...
# coding: utf8 import os import pytest import requests from mtgjson import CardDb, ALL_SETS_URL, ALL_SETS_X_URL def download_set_file(url, fn): tests_path = os.path.dirname(__file__) fn = os.path.join(tests_path, fn) if not os.path.exists(fn): resp = requests.get(url) resp.raise_for_sta...
# from elegantrl.tutorial.run import Arguments, train_and_evaluate import torch import torch.nn as nn import gym import numpy as np import numpy.random as rd import time class QNetTwin(nn.Module): # Double DQN def __init__(self, mid_dim, state_dim, action_dim): super().__init__() self.net_state =...
import numpy as np from core.encoders import default_boe_encoder as boe_encoder from core.encoders import default_bov_encoder as bov_encoder from scipy.spatial import distance class Combiner(): def __init__(self, query, docs): self._query = query self._docs = docs self._features = self._e...
# Copyright 2021 The Pigweed Authors # # 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in ...
import urllib from urllib.request import urlopen from bs4 import BeautifulSoup from selenium import webdriver import webbrowser, time, sys, requests, os, bs4 import pprint site = 'https://www.opensea.io/assets/camelsnft?search[resultModel]=ASSETS&search[sortAscending]=false' hdr = {'User-Agent': 'Mozilla/5.0 (X11; L...
from Graph import Graph from ContextFreeGrammar import ChomskyNormalForm as CNF from pyformlang.cfg import * def test_from_file(): gr = CNF.from_file("cfg_input.txt") word_accepted = list(map(Terminal, 'aaba')) word_declined = list(map(Terminal, 'aabb')) assert gr.contains(word_accepted) assert not...
""" computes various cache things on top of db.py so that the server (running from serve.py) can start up and serve faster when restarted. this script should be run whenever db.p is updated, and creates db2.p, which can be read by the server. """ import time import pickle from sqlite3 import dbapi2 as sqlite3 from ...
import os import sys import logging import time import datetime import csv import requests import sqlite3 def configureLogger(): log_format = "%(levelname)s [%(name)s] %(asctime)s - %(message)s" log_dir = os.path.join(os.path.normpath(os.getcwd() + os.sep), 'logs') log_fname = os.path.join(log_dir, 'mercado_fundo.l...
from typing import Callable, Optional from PyQt5.QtCore import pyqtSignal, Qt from PyQt5.QtGui import QCursor from PyQt5.QtWidgets import QHBoxLayout, QToolButton, QWidget from electrumsv.i18n import _ from .util import KeyEventLineEdit, read_QIcon class ButtonLayout(QHBoxLayout): def __init__(self, parent: Op...
from polyglotdb import CorpusContext from polyglotdb.config import CorpusConfig import polyglotdb.io as pgio import sys import os graph_db = {'host':'localhost', 'port': 7474} path_to_SB = os.path.join("/Volumes","data","corpora","SantaBarbara_aligned", "Part2_aligned") if __name__ == '__main__': config = Corp...
import subprocess import os def sh(cmd, input=""): rst = subprocess.run(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, input=input.encode("utf-8")) assert rst.returncode == 0, rst.stderr.decode("utf-8") return rst.stdout.decode("utf-8") s1 = sh('cat /etc/issue') p1 = sh('python3 --versi...
from da4py.main.utils.formulas import Or, And def petri_net_to_SAT(net, m0, mf, variablesGenerator, size_of_run, reach_final, label_m="m_ip", label_t="tau_it", silent_transition=None,transitions=None): ''' This function returns the SAT formulas of a petrinet given label of variables, size_o...
import json import pytuya # Specify the smoker and get its status d = pytuya.OutletDevice('<gwID>', '<IP>', '<productKey>') data = d.status() # Enable debug to see the raw JSON Debug = False #Debug = True if Debug: raw = json.dumps(data, indent=4) print(raw) # Simple if statement to check if the smoker is on...
from dataclasses import dataclass @dataclass class FuzzyVariable(): name: str fuzzy_sets: list def membership(self, variable): return {fs.name: fs.membership(variable) for fs in self.fuzzy_sets}
""" Implementation for vocabulary with precomputed structures for faster searches and checks. """ from . import molecule_edit as me from . import data_utils from .chemutils import get_mol from typing import NamedTuple class AtomTuple(NamedTuple): symbol: str formal_charge: int implicit_valence: int e...
from channels.generic.websocket import AsyncWebsocketConsumer import json from .serializers import SiteSerializer from .models import Site class UpdateConsumer(AsyncWebsocketConsumer): async def connect(self): await self.channel_layer.group_add( 'All', self.channel_name ) ...
from django.urls import path from . import views urlpatterns = [ path('', views.index, name='index'), path('Book/add/',views.addBook), path('allBooks/',views.allBooks), path('changeGenre/',views.changeGenre) ]
from __future__ import annotations from typing import Optional, Sequence, cast import sqlalchemy as sa import sqlalchemy.orm as so import sqlalchemy_utils as su from quiz_bot.db.base import Base, PrimaryKeyMixin class UserQuery(so.Query): def get_by_external_id(self, value: int) -> Optional[User]: retur...
import numpy as np from tma.objects import Observer, Target from tma.model import Model from tma.algorithms import Algorithms, Swarm from tma.helper_functions import get_df, convert_to_xy observer_x, observer_y, observer_course, observer_velocity = 0.0, 0.0, 0.0, 5.0 observer = Observer( observer_x, observer_y...
import cv2 import numpy as np from imutils.contours import sort_contours import imutils if __name__ == "__main__": raise Exception('Cannot be called as main script') def get_lines(image, output_images, output_image_labels, show=False): """ :return: list of roi parameters for lines """ # grayscale ...
from functools import lru_cache from typing import List class Solution: def lengthOfLIS(self, nums: List[int]) -> int: @lru_cache(None) def dp(i: int) -> int: # base case if i == 0: return 1 # recurrence relation res = 1 f...
import time import numpy as np import serial from file_utils import create_folder_if_absent, save_npy from visualizer import init_heatmap, update_heatmap """ Initialization Serial Parameters - Port, Baud Rate, Start Byte Program Mode - Plot (Debug) / Write Mode """ # SERIAL_PORT = 'COM5' # for windows...
''' Timer stimulus generation - makes videos of shrinking circles of different colours ''' import socket #to get host machine identity import os # for joining paths and filenames sensibly import scipy.misc #for image function import numpy as np #number functions #test which machine we are on and set working directory...
#!/usr/bin/env python """ Rail-RNA-cojunction_enum Follows Rail-RNA-junction_index Precedes Rail-RNA-cojunction_fasta Alignment script for MapReduce pipelines that wraps Bowtie 2. Finds junctions that cooccur on reads by local alignments to transcriptome elements. Input (read from stdin) ----------------------------...
#newcate #args: name #create a new category with name name from . import classes from . import globalvar import sys def newcate(args): if len(args.name) < 2: print('All names for category must be at least 2 characters long.') sys.exit(1) try: globalvar.masterCate[args.name] pri...
import logging import json import pkg_resources import eth_utils from web3 import Web3 from .address import Address class Contract: logger = logging.getLogger() @staticmethod def _get_contract(web3: Web3, abi: list, address: Address): assert(isinstance(web3, Web3)) assert(isinstance(abi,...
# coding: utf-8 from django.conf.urls import patterns, url urlpatterns = patterns('pydesk.apps.configuration.user.views', url(r'^/list[/]?$', 'user_list', name='user_list'), url(r'^/edit[/]?$', 'user_edit', name='user_edit'), url(r'^/add[/]?$', 'user_add', name='user_add'), url(r'^/ajax/list[/]?$', 'u...
from __future__ import print_function # A script to help you with manipulating CSV-files. This is especially necessary when dealing with # CSVs that have more than 65536 lines because those can not (yet) be opened in Excel or Numbers. # This script works with the example wintergames_winners.csv, which is an excerpt f...
import os from dotenv import load_dotenv from datetime import timedelta basedir = os.path.abspath(os.path.dirname(__file__)) load_dotenv(os.path.join(basedir, '.env')) class Config(object): SQLALCHEMY_DATABASE_URI = os.environ.get('DATABASE_URL') or \ 'sqlite:///' + os.path.join(basedir, 'sms.db') JW...
from copy import deepcopy # https://stackoverflow.com/a/7205107 def merge(a, b, path=None): """merges b into a""" if path is None: path = [] for key in b: if key in a: if isinstance(a[key], dict) and isinstance(b[key], dict): merge(a[key], b[key], path + [str(key...
from concurrent.futures import ThreadPoolExecutor from pydash import py_ from cv2 import cv2 import numba import time import re import pathlib import numpy import os import shutil import typing import dataclasses import typing import argparse import sys # ffmpeg็š„ๅธง็ผ–็ ไปŽ1ๅผ€ๅง‹ # render_subtitleๆธฒๆŸ“ๆ‰€ๅพ—ๆ–‡ไปถ็š„ๅธง็ผ–ๅทไนŸไปŽ1ๅผ€ๅง‹ ...
# Generated by Django 1.10.1 on 2017-09-11 05:54 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('show', '0001_initial'), ('venue', '0002_auto_20170710_1818'), ('ticket', '0009_account_phone'), ] operations = [ migrations.AlterUn...
#!/usr/bin/python # -*- coding: utf-8 -*- from mechanize import Browser from lxml.html import fromstring from time import * from thread import start_new_thread import requests import sys class DevNull: def write(self, msg): pass class Main: email = '' password = '' html = '' authenticit...
import datetime from flask_sqlalchemy import SQLAlchemy db = SQLAlchemy() # Reference: # https://flask-sqlalchemy.palletsprojects.com/en/2.x/models/ # https://docs.sqlalchemy.org/en/14/core/metadata.html#sqlalchemy.schema.Column # https://flask-sqlalchemy.palletsprojects.com/en/2.x/models/#many-to-many-relationships ...
# Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import logging from typing import Any, Callable, Dict, List, Optional, Tuple, Union from typing_extensions import Protocol import numpy as ...
# coding=UTF-8 # python version 3.5 # os version win10 import os import sys def getAllWifi(): wifiAll = os.popen('netsh wlan show profiles').read() wifiResultArr = [] infoArr = wifiAll.split('\n') for info in infoArr: if info.find('ๆ‰€ๆœ‰็”จๆˆท้…็ฝฎๆ–‡ไปถ') > -1: wifiArr = info.sp...
#: Check if a field that implements storage, or is a runtime constant, is #: missing it's reset value. MISSING_RESET = 1<<0 #: Check if a field's bit offset is not explicitly specified. #: #: Some organizations may want to enforce explicit assignment of bit offsets to #: avoid unexpected field packing. IMPLICIT_FIELD...
from typing import Optional, Tuple import random import numpy as np import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim class Attacker: def __init__(self, steps: int, quantize: bool = True, levels: int = 256, ...
from __future__ import absolute_import from checkout_sdk.common.enums import Currency from checkout_sdk.payments.payments import PayoutRequest, PaymentRequestCardDestination from tests.checkout_test_utils import VisaCard, phone, LAST_NAME, FIRST_NAME, new_uuid, assert_response, retriable def test_should_request_payo...
from .log import init_logger init_logger()
import os import yaml import testinfra.utils.ansible_runner testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all') def test_hosts_file(host): f = host.file('/etc/hosts') assert f.exists assert f.user == 'root' assert f.group == 'r...
# Functionality so a custom tpose can be made with fk offsets to put into the bind pose ''' TODO: * When reposer exists, copy unlocked translate and rotates * Just copy the values onto the node so the old one can be deleted * Delete old version, if it exists * Rename the old one before making the new one ''' from __fu...
import ast def is_main(node: ast.AST) -> bool: """Returns whether a node represents `if __name__ == '__main__':` or `if '__main__' == __name__:`. """ if not isinstance(node, ast.If): return False test = node.test if not isinstance(test, ast.Compare): return False if len(...
######## # Copyright (c) 2016 GigaSpaces Technologies Ltd. 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...
from math import pi try: import openmm.unit as u except ImportError: # OpenMM < 7.6 import simtk.unit as u kB = u.BOLTZMANN_CONSTANT_kB * u.AVOGADRO_CONSTANT_NA # OpenMM constant for Coulomb interactions in OpenMM units # (openmm/platforms/reference/include/SimTKOpenMMRealType.h) # TODO: Replace this with an...
import sys from gencode.gen import * if __name__ == "__main__" : p = 'C:\\Users\\ISS-Vendor\\Desktop\\gen\\' gen = Gen(p,sys.argv) gen.write()
import pytest import io import json import aiohttpretty from waterbutler.core import streams from waterbutler.core import exceptions from waterbutler.providers.figshare import metadata from waterbutler.providers.figshare import provider from waterbutler.providers.figshare.settings import PRIVATE_IDENTIFIER, MAX_PAG...
import logging from yapsy.IPlugin import IPlugin import simplejson as json import configargparse from mrtarget.modules.GeneData import Gene from mrtarget.Settings import Config from mrtarget.common import URLZSource class HGNC(IPlugin): def __init__(self, *args, **kwargs): self._logger = logging.getLo...
#!/usr/bin/python3 # -*- coding: utf-8 -*- import requests from requests.adapters import HTTPAdapter from bs4 import BeautifulSoup import sys import pymysql se = requests.Session() # ๆจกๆ‹Ÿ็™ป้™† requests.adapters.DEFAULT_RETRIES = 15 se.mount('http://', HTTPAdapter(max_retries=3)) # ้‡่” se.mount('https://', HTTPAdapter(max...
from django.contrib import admin from models import License, Submission, Revision, TagCreation class LicenseAdmin(admin.ModelAdmin): list_display = ('name', 'description') class SubmissionAdmin(admin.ModelAdmin): list_display = ('sub_type', 'slug', 'created_by', 'date_created', 'num_revisi...
import sklearn import numpy as np from sklearn.metrics import mean_squared_error from sklearn.metrics import mean_absolute_error from sklearn.metrics import median_absolute_error from sklearn.metrics import r2_score import matplotlib.pyplot as plt def get_score(model, x, y, plot=True, sparse=50): y_pred = mod...
##list of integers student_score= [99, 88, 60] ##printing out that list print(student_score) ##printing all the integers in a range print(list(range(1,10))) ##printing out all the integers in a range skipping one every time print(list(range(1,10,2))) ## manipulating a string and printting all the modifications x =...
# Copyright (C) 2014-2017 New York University # This file is part of ReproZip which is released under the Revised BSD License # See file LICENSE for full license details. """Package identification routines. This module contains the :func:`~reprozip.tracer.linux_pkgs.identify_packages` function that sorts a list of fi...
'''Editing video and getting images''' from image_tools import * import cv2 import numpy as np def num_frames(filepath): video = cv2.VideoCapture(filepath) # return video.get(cv2.CAP_PROP_FRAME_COUNT) # broken because codecs; I think dolphin doesn't encode the frame count success, _ = video.read() ...
from django.contrib import admin from django.urls import re_path, include from django.conf import settings from django.views.static import serve urlpatterns = [ re_path(r'^admin/', admin.site.urls), re_path(r'^', include('gym.urls')), ] if settings.DEBUG: urlpatterns += [ re_path(r'^media/(?P<pat...
from collections import Hashable print(issubclass(list,object)) print(issubclass(object,Hashable)) print(issubclass(list,Hashable)) """ output: True True False """
# Generated by Django 2.2.1 on 2020-10-14 16:17 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('call_tracking', '0003_auto_20201014_1603'), ] operations = [ migrations.RenameField( model_name='call', old_name='forwarding...
import pandas as pd import numpy as np import logging import matplotlib.pyplot as plt from sklearn.preprocessing import StandardScaler from config import shuffled_csv from NN import NN_model, ReLU, Sigmoid, MSE, L1_reg, L2_reg from NN.utility import batch_train, batch_out, Model_Wrapper from LevelMethod import LevelM...
from pyramid.threadlocal import get_current_registry class ZCAConfiguratorMixin(object): def hook_zca(self): """ Call :func:`zope.component.getSiteManager.sethook` with the argument :data:`pyramid.threadlocal.get_current_registry`, causing the :term:`Zope Component Architecture` 'global' AP...
import pandas as pd import numpy as np column_data = ["packed", "highway", "greennopop", "water", "road", "density" ] testing_df = pd.read_csv('testing.csv', names=column_data, index_col=None) test_x = testing_df[["packed", "highway", ...
""" This module descibes how to load a custom dataset from a single file. As a custom dataset we will actually use the movielens-100k dataset, but act as if it were not built-in. """ from __future__ import (absolute_import, division, print_function, unicode_literals) import os from surprise i...
import sys import os.path import itertools import textwrap import argparse from argparse import RawTextHelpFormatter from math import log from phanotate_modules.edges import Edge from phanotate_modules.nodes import Node import pkg_resources try: __version__ = pkg_resources.get_distribution('phanotate').version ...
#!/usr/bin/env python # -*- coding: UTF-8 -*- import os import time import torch import numpy as np import cv2 import matplotlib.pyplot as plt from torch.autograd import Variable from models import model_create_by_name as model_create from losses.loss import losses import utils.utils as utils import logging #logging...
""" This module pltots all extraceted features with mean and standard dev. :copyright: (c) 2022 by Matthias Muhr, Hochschule-Bonn-Rhein-Sieg :license: see LICENSE for more details. """ import pandas as pd import matplotlib.pyplot as plt import numpy as np from pathlib import Path def save_fig(fig, path, name): ...
#!/usr/bin/env python3 # # This is an example script for migrating single Trello board to already existing # Kanboard project (you # NB: for the sake of example all provided identifiers/tokens/keys here are randomly generated # and you have to provide your own to perform migration. Please consult README for details. # ...
# -*- coding: utf-8 -*- import cv2 import os import sys cap = cv2.VideoCapture(0) # creating camera object def main(): while(cap.isOpened()): ret, im = cap.read() # reading the frames # ็ตๆžœใ‚’่กจ็คบ cv2.imshow("Show Image",im) k = cv2.waitKey(10) # cv2.waitKey(0) # ใ‚ญใƒผๅ…ฅ...
from ..constants import asset_dir from PIL import Image import os.path as osp import os img_library = {} def get_loaded_images(img_dict): for filename in os.listdir(asset_dir): if filename.endswith(".png"): image_loc = osp.join(asset_dir, filename) img = Image.open(image_loc) ...
import requests import requests.auth from functools import lru_cache from tinydb.table import Table from tinydb import TinyDB, where from collections import deque from src.utils import get_logger, get_ttl_hash, get_number_of_seconds_before_time from time import sleep try: from data.config import ( PATH_DB...
# https://codeforces.com/problemset/problem/144/A n = int(input()) sh = list(map(int, input().split())) sh_max = sh.index(max(sh)) sh_min = max(idx for idx, val in enumerate(sh) if val == min(sh)) if sh_max < sh_min: print(sh_max + n - sh_min - 1) else: print(sh_max + n - sh_min - 2)
from m5.SimObject import SimObject from BaseHarvest import BaseHarvest from m5.params import * from m5.proxy import * class BasicHarvest(BaseHarvest): type = 'BasicHarvest' cxx_header = "gem5_hw/basic_harvest.hh" capacity = Param.Float(50000, "capacity of energy system, default 50000")
"""Module providing dataset class for annotated Redwood dataset.""" import json import os from typing import TypedDict, Optional import zipfile from scipy.spatial.transform import Rotation import numpy as np import open3d as o3d import torch from PIL import Image import yoco from cpas_toolbox import camera_utils, poi...
class Solution: def sortColors(self, nums) -> None: """ Do not return anything, modify nums in-place instead. """ if not nums:return [] p0,curr = 0,0 p2 = len(nums) - 1 while curr <= p2: if nums[curr] == 0: nums[p0],nums[curr] = num...
import itertools import datetime import dateparser from loguru import logger from cloudproxy.check import check_alive from cloudproxy.providers import settings from cloudproxy.providers.hetzner.functions import list_proxies, delete_proxy, create_proxy from cloudproxy.providers.settings import config, delete_queue, re...
import torch import torch.nn as nn import numpy as np import matplotlib.pyplot as plt plt.style.use('fivethirtyeight') def plot_images(images, targets, n_plot=30): n_rows = n_plot // 6 + ((n_plot % 6) > 0) fig, axes = plt.subplots(n_rows, 6, figsize=(9, 1.5 * n_rows)) axes = np.atleast_2d(axes) fo...
# Generated by Django 3.0 on 2020-01-18 19:14 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('neighbor', '0004_auto_20200118_1810'), ] operations = [ migrations.DeleteModel( name='Neighborhood', ), ]
# Generated by Django 2.0.13 on 2019-04-15 19:59 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [("users", "0001_initial")] operations = [ migrations.AddField( model_name="user", name="last_user_agent", field=models...