text
stringlengths
38
1.54M
from model import Dan, Kalorije IME_DATOTEKE = "podatki.json" def tekstovni_vmesnik(): belezeni_dnevi = Dan(IME_DATOTEKE) belezeni_dnevi.preberi_iz_datoteke() while True: ukaz = prikaz_moznosti() if ukaz == 1: podatki = prikaz_za_izpolnitev() koncno = Kalorije(podat...
from django.shortcuts import render, reverse, get_object_or_404 from django.contrib.auth.models import User from . import models def home(request, pk): user = get_object_or_404(User, pk=pk) posts = models.Post.objects.filter(user=user) return render(request, 'blog/profile.html', {'user': user, 'posts': po...
# Generated by Django 2.0.2 on 2018-03-27 22:06 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('musicians', '0004_remove_musician_email'), ] operations = [ migrations.AddField( model_name='musician', name='hometo...
def is_big(x): return x > 100 def is_even(x): return not x % 2 numbers = [90, 102, 101, 104] cond = [is_big, is_even] z = filter( lambda n: all([f(n) for f in cond]), numbers) print(z) # [102, 104]
from django.urls import path from . import views #from .views import login urlpatterns = [ path("schools/",views.schools,name ='schools'), ]
import random class Deck(object): def __init__(self): ''' Create a deck in order ''' self.deck = [] for suit in suits: for rank in ranking: self.deck.append(Card(suit,rank)) def shuffle(self): ''' Shuffle the deck, python actually already has a shuff...
def bitwiseComplement(self, N: int) -> int: if N == 0: return 1 ceil = 0 copy_N = N while copy_N > 0: ceil += 1 copy_N = copy_N // 2 ceil = (2 ** ceil) - 1 return ceil - N
'''Defines a pipeline step which aquires data from the xerus data source. ''' import datetime import os import requests from bs4 import BeautifulSoup from src import datasets from src.step import Step class GetXerusData(Step): '''Defines a pipeline step which aquires data from the xerus data source. ''' ...
from flask import render_template, flash, redirect, request, url_for from app import app from app.forms import WorkoutForm from app.weightbreakdown import WeightBreakdown @app.route('/', methods=['GET', 'POST']) def index(): form = WorkoutForm() if form.validate_on_submit(): press = request.form.get('p...
import concurrent.futures import numpy as voNP from sklearn.utils import shuffle as voShuffle from multiprocessing import Pool, freeze_support, cpu_count from TcMatrix import TcMatrix from TeActivation import TeActivation # Deep Convolutional Neural Network class TcCNNDeep( object ) : def __init__( aorSelf, aorLaye...
import turtle turtle.penup turtle.pendown turtle.pensize(5) turtle.fd(150) turtle.seth(90) turtle.fd(150) turtle.seth(180) turtle.fd(150) turtle.seth(270) turtle.fd(150)
# Generated by Django 2.1.2 on 2018-12-08 18:00 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('events', '0002_auto_20181208_1756'), ] operations = [ migrations.RenameField( model_name='events', old_name='datetime_of_eve...
import os import argparse import collections import re NUMBER_OF_WORDS = 10 def load_data(filepath): if not os.path.exists(filepath): return None with open(filepath, "r", encoding='utf-8') as file_handler: return file_handler.read() def get_most_frequent_words(text, number_of_words): w...
class Node(): def __init__(self, id, data=None, label=None): self.id = id self.left = None self.right = None def __repr__(self): left_child = self.left.id if self.left else None right_child = self.right.id if self.right else None node = ('id: {}, left_child: {}, ...
#!/usr/bin/python3 """Module to compress files """ from fabric.api import * from datetime import datetime import os env.hosts = ["ubuntu@34.73.252.190", "ubuntu@54.198.140.74"] def do_deploy(archive_path): """Method to deploy files """ if not os.path.exists(archive_path): return False else:...
project = "gdsfactory" release = "5.18.2" copyright = "2020, MIT License" html_theme = "sphinx_book_theme" source_suffix = { ".rst": "restructuredtext", ".txt": "markdown", ".md": "markdown", } extensions = [ "matplotlib.sphinxext.plot_directive", "myst_parser", "nbsphinx", "sphinx.ext.aut...
data = LoggingLazyDB() print('Before: ', data.__dict__) print('foo exists: ', hasattr(data, 'foo')) print('After: ', data.__dict__) print('foo exists: ', hasattr(data, 'foo')) >>> Before: {'exists': 5} Called __getattr__(foo) foo exists: True After: {'foo': 'Value for foo', 'exists': 5} foo exists...
import eyed3 audiofile = eyed3.load("/home/sanat/Desktop/SLAC 2018/DeepAudioClassification-master/Data/Raw/The Maccabees - Grew Up At Midnight.mp3") audiofile.tag.artist = u"the Maccabees" audiofile.tag.album = u"ABC" audiofile.tag.album_artist = u"Various Artists" audiofile.tag.title = u"We grew up at midnight" audi...
from selenium.webdriver.common.by import By class BasePageLocators(): LOGIN_LINK = (By.CSS_SELECTOR, ".icon-login") SUBMIT_NEXT = (By.XPATH, "//input[@type='submit' and @value='Далее']") class LoginPageLocators(): REGISTER_LINK_TERM = (By.CSS_SELECTOR, "div.row.menu div.cell a") REG_TERM_2 = (By.CSS_...
import os import pickle import numpy as np import csv import matplotlib.ticker as plticker #from run_lrm import print_results ''' plot_dict ={} #for loop here for trial in range(10): file_name = "../results/LRM/lrm-qrm/trail_"+str(trial)+"/officeworld/lrm-lrm-qrm-0_rewards_over_time.txt" file = open(file_name) ...
import cv2 from utils import * import tensorflow as tf from tensorflow import keras from tensorflow.keras.layers import Conv2D, MaxPool2D, DepthwiseConv2D, SeparableConv2D, GlobalAveragePooling2D from tensorflow.keras.layers import Concatenate, Flatten, Dense, BatchNormalization, Activation from tensorflow.keras.losses...
species( label = '[CH2]OC[CH]CC(988)', structure = SMILES('[CH2]OC[CH]CC'), E0 = (104.288,'kJ/mol'), modes = [ HarmonicOscillator(frequencies=([2750,2783.33,2816.67,2850,1425,1450,1225,1275,1270,1340,700,800,300,400,2750,2800,2850,1350,1500,750,1050,1375,1000,3000,3100,440,815,1455,1000,3025,407...
import argparse import gym import os import sys sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) from plotting_functions_RL import * from neural_process import NeuralProcess from training_module_RL import NeuralProcessTrainerRL from torch.distributions import Normal # Axes3D import has...
#!/usr/bin/env python3 '''This module contains a floor function''' import math def floor(n: float) -> int: '''takes a float and return the floor of the float''' return math.floor(n)
# Generated by Django 2.0.2 on 2018-03-31 17:13 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('users', '0002_user_channel_main_user_channel_sub_video_main_video_sub'), ] operations = [ migrations.AlterField( model_name='vid...
from flask import Blueprint, request, redirect, render_template, url_for,session, escape,jsonify,g from flask.views import MethodView from flask.ext.mongoengine.wtf import model_form from flaskstarter import app #### ERROR HANDLER ######### @app.errorhandler(404) def page_not_found(error): return render_templa...
from PyQt5.QtCore import QRegularExpression, pyqtSignal from PyQt5.QtGui import QIcon, QRegularExpressionValidator, QValidator from PyQt5.QtWidgets import QLineEdit,QHBoxLayout, QComboBox, QToolButton,QWidget class SelectionWidget(QWidget): completed = pyqtSignal(bool) def __init__(self, items, parent=...
#2048-Alter by Welkin Mario #contact: YUHO(Wechat), or Welkin_M(Steam) #email: yuhosan@163.com #recommend to have a look at README from random import * # initialize the grid x1 = [0]*4 x2 = [0]*4 x3 = [0]*4 x4 = [0]*4 x = [x1,x2,x3,x4] # define how the game runs rand = [2,4] control = ['w','s','a','d', 'retry'] ...
''' Visual Monocular SLAM Implementation Created: Sept 10, 2019 Author: Michael Liu (GURU AI Group, UCSD) ''' import sys sys.path.append('../lib') import OpenGL.GL as gl import pangolin import multiprocessing as mp # import threading import numpy as np import time from multiprocessing import Process, Queue import...
import datetime import threading from abc import ABC, abstractmethod from hangpy.entities import Job from hangpy.enums import JobStatus class JobActivityBase(ABC, threading.Thread): """ Base class for any job activities intended to be processed using HangPy. """ def __init__(self): self._...
import math from typing import Dict, Callable import seaborn as sns import pandas as pd import matplotlib.pyplot as plt from tensorflow.keras import backend as K import tensorflow as tf def _1cycle_mom(iteration_idx:int, cyc_iterations:int, min_mom:float, max_mom:float):...
def concat_modules(modules): separator = '%2C' joined = separator.join(modules) return joined def concat_events(events): separator = '%7C' joined = separator.join(events) return joined def concat_parameters(parameters): separator = '&' joined = separator.join(parameters) return j...
# Python program to # calculate minimum # product of a pair def printMinimumProduct(arr,n): first_min = min(arr[0], arr[1]) second_min = max(arr[0], arr[1]) for i in range(2,n): if (arr[i] < first_min): second_min = first_min first_min = arr[i] elif (arr[i] < second_min): second_min = arr[i] ...
# -*- coding: utf-8 -*- # Generated by Django 1.11.24 on 2019-10-31 13:24 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('supplier_app', '0001_initial'), ] operations = [ migrations.AddField( ...
def recStep(nn, d): print(str(nn)) if d < 0: if nn > 0: recStep(nn-m, d) else: recStep(nn+m, d * -1) else: if nn < n: recStep(nn+m, d) else: return n = int(input("N: ")) m = int(input("M: ")) recStep(n, -1)
from flask import Flask,request, jsonify from flask_restful import reqparse, abort, Api, Resource import requests import json import pprint import os # # Author: FrancoUcci # Used for faborder.go # 03-Jul-2018 # # Have the following Methods available via the REST API # # http://a.b.c/orders ...
# Definition for a binary tree node class TreeNode: def __init__(self, x): self.val = x self.left = None self.right = None class Solution: # @param root, a tree node # @return an integer def __init__(self): self.arr = [] self.maxdepth = 0 def ...
from __future__ import unicode_literals import os, sys dirpath = os.path.join(os.path.dirname(__file__)) sys.path.append(dirpath) dirpath = os.path.join(dirpath, 'namelists') sys.path.append(dirpath)
# plot the trajectories on one single figure import matplotlib import matplotlib.pyplot as plt import numpy as np import imageio import sys import os currentPath = os.path.dirname(os.path.abspath(__file__)) sys.path.append(currentPath) import matplotlib import matplotlib.pyplot as plt import numpy as np import rando...
''' Create an employee record in MongoDB ''' import pymongo import datetime import pprint from pymongo import MongoClient client = MongoClient() # Reference a database # Note that the database will be created automatically once collections and records are created hr = client.hr # Reference a collection employees = ...
# -*- coding: utf-8 -*- """ Created on Tue Nov 20 11:23:01 2019 @author: miklos Main script: Reads NN putput matrix, reads previously saved bigram dictionary from a json format Calls BeamSearch algorithm without and with phoneme level bigram LM """ import numpy as np import BeamSearch import LanguageModel import ...
from PyInstaller.utils.hooks import collect_data_files, collect_submodules datas = collect_data_files('scrapy_cookies') hiddenimports = ( collect_submodules('scrapy_cookies') )
from binance.currency_utils import get_currency_pair_to_binance from utils.currency_utils import split_currency_pairs from utils.string_utils import truncate_float from enums.currency import CURRENCY # BASE_CURRENCY = BTC PRECISION_BTC_NUMBER = { "ETHBTC": 3, "LTCBTC": 2, "BNBBTC": 0, "NEOBTC": 2,...
#Scope - What variable you have access to? #functional scope total=100 #global scope def some_fun(): tot =100 #local scope def confusion(): total=110 #local variable -new variable return total print(total) print(confusion()) #does not affect the global var print(total) #1- start with local #2 - pa...
"""Miscellaneous small and generic helper functions""" import json import os import re import sys import time from io import StringIO from fabric.api import put from fabric.api import run from fabric.context_managers import hide import fabric.utils EC_NETWORK = 10 EC_SERVICE = 20 EC_DATA = 30 TRAILING_WHITESPACE = re...
import random from time import monotonic from collections import deque class Game: def __init__(self): self.parts = deque() self.part = None self.buzz_state = "inactive" self.points = { "left": 0, "right": 0, } @property def is_done(self): ...
import mysql.connector from datetime import datetime from .checkinput import * class GeneralQuery: def __init__(self): self.mydb=mysql.connector.connect( host="192.168.51.28", # host="14.160.67.114", user="hiface", passwd="Tinhvan@123", database...
import asyncio import select number_of_events_read = 0 filepath = '/dev/input/event5' async def log_events(): global number_of_events_read file = open(filepath,'rb') while True: # select returns after 0.05 secs and we have to check if r is # empty( == socket not ready ) or non-empty ( == ...
import torch import torch.nn as nn import torch.nn.functional as F from utils import sort_by_seq_lens, get_mask, masked_softmax, weighted_sum, replace_masked, init_model_weights from model.sentenceEncoder import SentenceEncoder class ESIM(nn.Module): def __init__(self, config, word_emb): super(ESIM, self...
import pyaudio # import tensorflow as tf import numpy as np import struct import time import joblib import cv2 as cv # from cnn_model import get_model from util import cut_audio, get_arr_from_audio, save_wave_file, audio_interp from mfcc import mfcc_feature_pyramid from config import _AUDIO_CHANNELS, _AUDIO_DATA_WIDT...
import csv import numpy as np import pandas as pd from operator import itemgetter import pickle import random from sklearn.cluster import KMeans, DBSCAN from sklearn.mixture import GaussianMixture from sklearn.metrics import silhouette_score from sklearn.preprocessing import StandardScaler import time def _get_twitte...
from django.conf.urls import url from django.urls import path from . import views app_name = "user" urlpatterns = [ # url(r'^api/', views.UserView.as_view(), name='user'), url(r'^login', views.login_action, name='login'), url(r'^register', views.register_action, name='register'), url(r'^logout', views.l...
import sys import re import time def read_input(file): for line in file: yield line def check_matches(line, regexes): match = False for name,r in regexes.items(): m = re.search(r,line) if m: match = True ''' if name == 'ipaddr': ...
#!/usr/bin/env python # -*- coding: utf-8 -*- import json import requests from pyquery import PyQuery as pq HEADERs = { 'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.112 Safari/537.36' } def crawl(url): print url resp = requests.get...
import asyncio import json import logging import websockets logging.basicConfig() BOARD_CONTENT = {'content': ''} PARTICIPANTS = set() def state_event(): return json.dumps({'type': 'state', **BOARD_CONTENT}) def participant_event(): return json.dumps({'type': 'users', 'pariticipant_id': ['1','2','3']}) as...
# part1 O(N) sums = set() with open("inp.txt") as inp: for line in inp.readlines(): num = int(line) diff = 2020 - num if diff in sums: print(diff * num) else: sums.add(num)
#ALL ASCII VALUE for i in range(1,257): char=chr(i) order=ord(char) print(char,end=" ") #print(order,"==",char) # ============================================================================================================== # FIND ASCII NUMBER FOR ALLPHABET for char in range(1,300): al...
# -*- coding: utf-8 -*- import pandas as pd import matplotlib.pyplot as plt from pylab import rcParams import seaborn as sb rcParams['figure.figsize']=10,8 sb.set_style('whitegrid') df=pd.read_csv(filepath_or_buffer='iris.data.csv',header=None,sep=',') df.columns=['Sepal Length','Sepal Width','Petal Length'...
class stackLib(): def __init__(self): self.lis=[] def push(self, a): self.lis += [a] def pop(self): self.lis=self.lis[:-1] x=stackLib() x.push(1); x.push(2); x.push(3); x.push(4); x.pop(); x.pop(); #print x.lis
# -*- coding: utf-8 -*- """ Created on Wed Jul 22 14:46:47 2015 @author: stoimenoff """ import random class Node: def __init__(self, value, next_node=None): self.value = value self.next_node = next_node def value(self): return self.value def get_next(self): return self.next_...
import subprocess from test_pyenv import TestPyenvBase class TestPyenvFeatureInstall(TestPyenvBase): def test_check_pyenv_install_list(self, setup): result = subprocess.run(['pyenv', 'install', '-l'], shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) result = str(result.stdout, "utf-8") ...
import pytest from python_on_whales import docker from python_on_whales.components.image.models import ImageInspectResult from python_on_whales.exceptions import DockerException, NoSuchImage from python_on_whales.test_utils import get_all_jsons, random_name @pytest.mark.parametrize("json_file", get_all_jsons("images...
def linear_search(x,s): for i in x: if x[i] == s: return i return -1 x = [1,2,4,5,6,19,10] s = 10 print(linear_search(x,s))
#This bit is set up by our mentor Mr Organ import time import RPi.GPIO as GPIO GPIO.setmode(GPIO.BCM) pin = 17 pin2 = 18 GPIO.setup(pin,GPIO.OUT) GPIO.setup(pin2,GPIO.OUT) #This is our code print ("#no_name") print ("Free cake!") print ("what is your name? ") name = input() print("hahahahaha ") print("the cake is...
from django.template.defaultfilters import default, filesizeformat from wagtail.core.blocks import ( StructBlock, RawHTMLBlock, CharBlock, StreamBlock, ListBlock ) from wagtail.core.blocks.field_block import ( BooleanBlock, ChoiceBlock, DecimalBlock, IntegerBlock, MultipleChoiceBlock, PageChooserBlock, RichText...
import pandas as pd import numpy as np import matplotlib.pyplot as plt import pydotplus from sklearn import tree from sklearn.cluster import KMeans from sklearn.model_selection import train_test_split from sklearn.model_selection import GridSearchCV from sklearn.metrics import classification_report from sklear...
if __name__ == '__main__': t=int(input()) for x in range(t): s=input().strip() even,odd=[],[] for i in range(len(s)): if(i%2==0): even.append(s[i]) else: odd.append(s[i]) print("".join(even),"".join(odd))
import cv2 from imutils.video import WebcamVideoStream class VideoCamera(object): def __init__(self): self.stream = WebcamVideoStream(src=0).start() def __del__(self): self.stream.stop() def get_frame(self): image = self.stream.read() detector = cv2.CascadeClassi...
from mpi4py import MPI import numpy as np import time from knn import knn class mpi: def __init__(self): self._comm = MPI.COMM_WORLD self._rank = self._comm.Get_rank() self._proces_count = self._comm.Get_size() def run(self, clf, params_array): params_count = len(params_array)...
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Date : 2020-04-01 20:36:21 # @Author : mutudeh (josephmathone@gmail.com) # @Link : ${link} # @Version : $Id$ import os class Solution(object): def gameOfLife(self, board): if not board: return [] # 0 -> 1: -1 # 1 -> 0: 2 ...
"""Module for database entity""" from library.mixins import SearchableMixin from utils import db class Book(db.Model, SearchableMixin): """Class for book entity in database""" __tablename__ = 'books' __searchable__ = ["title", "author", "description"] id = db.Column(db.Integer, primary_key=True) ...
from .structure import Descriptor class Positive(Descriptor): """.""" def __set__(self, instance, value): """.""" if value < 0: raise ValueError("Expected number to be greater than 0") super(Positive, self).__set__(instance, value) class Negative(De...
# # ESnet Network Operating System (ENOS) Copyright (c) 2015, The Regents # of the University of California, through Lawrence Berkeley National # Laboratory (subject to receipt of any required approvals from the # U.S. Dept. of Energy). All rights reserved. # # If you have questions about your rights to use or distrib...
""" Stack of Plates: Imagine a (literal) stack of plates. If the stack gets too high, it might topple. Therefore, in real life, we would likely start a new stack when the previous stack exceeds some threshold. Implement a data structure SetOfStacks that mimics this. SetO-fStacks should be composed of several stacks and...
from math import * #num1 = 2 test #num2 = 5 test def powerval(num1,num2): if num1>num2: big = num1 small = num2 #if num1==num2: #print("nums are equal! try again!") if num1<num2: small = num1 big = num2 return(int(pow(big,small))) #print(big,small) test
n=int(input()) q=input().split() a=[] for i in range(0,len(q)): a.append(q[i]) for i in range(0,len(q)): if(a.count(a[i])==1): print(a[i])
"""Функции для файла new_user""" def isalphadidgit(string): return string.isalpha() or string.isdigit() def check_letter(string): abc = "qwertyuiopasdfghjklzxcvbnm-1234567890" for i in string: if i not in abc: return False return True def empty_or_not(login, password, name): ...
# -*- coding: utf-8 -*- import xlrd import xlwt col_num = [8,9] #column number for saving def rw_excel(): # 打开文件 workbook = xlrd.open_workbook("主机列表.xls") # 获取所有sheet sheet1_name = workbook.sheet_names()[0] # 根据sheet索引或者名称获取sheet内容 sheet1 = workbook.sheet_by_index(0) # sheet索引从0开始 #sheet1 =...
import unittest import numpy as np import gym import pyworld.toolkit.tools.gymutils as gu ITER_LIMIT = 25 class TestEnv(gym.Env): def __init__(self): super(TestEnv, self).__init__() self.action_space = gym.spaces.Discrete(3) self.observation_space = gym.spaces.Box(np.float32(0), np.flo...
import cv2 import numpy as np frame_w = 640 frame_h = 480 cap = cv2.VideoCapture(0) cap.set(3, frame_w) cap.set(4, frame_h) cap.set(10, 150) # [48, 114, 129, 116, 255, 208], blue, 12 136 106 21 255 255 myColors = [[12, 136, 106, 21, 255, 255], [57, 53, 44, 84, 255, 255], [107, 43, 60, 131, 162, 255]] # c...
import matplotlib.pyplot as plt x_num = [1,2,3] y_num = [2,4,6] plt.plot(x_num, y_num, '*') plt.show()
from numba import jit #VWAP @jit def vwap(data,window): voltyp = pd.Series(data['Volume']*data['Typical']) voltyp = voltyp.rolling(window=window).sum() vol = pd.Series(data['Volume'].rolling(window=window).sum()) data = data.join(pd.Series(data=voltyp/vol,index=data.index,name='VWAP_'+str(window))) ...
#!/usr/bin/python #-*- coding: utf-8 -*- import urllib2 , urllib import json import pprint from cStringIO import StringIO import datetime, time import platform import mysql.connector from mysql.connector.errors import Error from mysql.connector import errorcode import re from pandas import Series, DataFrame import p...
import numpy as np import h5py import scipy.io as sio import os from shutil import copyfile from PIL import Image PATH = "C:\\Users\\lotan\\Downloads\\ADE20K_2016_07_26\\ADE20K_2016_07_26\\index_ade20k.mat" # test = sio.loadmat(PATH) # print(test['index']) def build_sub_classes_from_root(root_path, dest, sub_cl...
from torch import nn import torch class DeepQNet(nn.Module): def __init__(self, hidden_size=32): super(DeepQNet, self).__init__() self.state_space_size = 128 self.action_space_size = 18 self.hidden_size = hidden_size self.mlp = nn.Sequential( nn.Linear...
from scipy.spatial import distance as dist from imutils.video import VideoStream from imutils import face_utils from threading import Thread import numpy as np import playsound import argparse import imutils import time import dlib import cv2 import gspread from oauth2client.service_account import ServiceAccountCredent...
#!/usr/bin/env python ################################################################################ # ################################################################################ description = ''' This script will create an environment for VMware in an ACI fabric. The following tasks will be accomplished...
from discord.ext import commands from utils.embed import get_embed from rich.table import Table from rich.console import Console from io import StringIO class Config(commands.Cog): def __init__(self, bot): self.bot = bot self.rethink = bot.rethink self.conn = bot.db_conn self.rich_c...
import subprocess import os class person: age = 0 first_name = last_name = address = city = '' def __init__(self, age, first_name, last_name, address, city): self.age = age self.first_name = first_name self.last_name = last_name self.address = address self.city = ci...
def print_twice(bruce): print(bruce) print(bruce) print_twice('I can talk two times in a row.')
import caesar import sys import h5py import pylab as plt import numpy as np from readgadget import * sys.path.append('/home/sapple/tools') import plotmedian as pm import pygad as pg from astropy.cosmology import FlatLambdaCDM plotvar = 'mstar' plotvar = 'R' # options are 'bolometric', 'U', 'B', 'V', 'R', and 'K' frac...
from django.urls import path from . import views app_name = 'bog' urlpatterns=[ path('board4/', views.board, name='board4'), ]
import requests from os import path import os import json import time if path.exists('init.txt'): with open('init.txt', 'r') as infile: init = json.load(infile) username = os.getenv('USERNAME') url = init['supervisor_url'] while True: try: resp = requests.get(url+"/status?set=0&name="+username) if resp.status...
import mozilla_sphinx_theme import os extensions = [] templates_path = ['_templates'] source_suffix = '.rst' master_doc = 'index' project = u'Addon registration' copyright = u'2013, Mozilla Services' version = '0.1' release = '0.1' exclude_patterns = ['_build'] pygments_style = 'sphinx' html_theme_path = [os.path.di...
# __author: ioi # date: 2021/6/10 # 自定义异常 class CustomException(Exception): def __init__(self, message): self.message = message def __str__(self): return self.message if __name__ == '__main__': try: # 主动抛出异常 raise CustomException('哈哈哈') except Exception as e: p...
"""Copy from silence-tensorflow https://github.com/LucaCappelletti94/silence_tensorflow/blob/aa02373647db93f92ec824a55f37b6ae175d7227/silence_tensorflow/silence_tensorflow.py#L5 """ import os import logging def silence_tensorflow(): """Silence every warning of notice from tensorflow.""" logging.getLogger('te...
# /usr/bin/python import sys import os import ROOT from FTTB215Conditions import CONDITIONS,DIODES COLORS ={11:ROOT.kBlue+1,13:1} MARKERS={(11,2):22,(11,3):26,(13,2):20,(13,3):24} def summarizeResultsFor(ntuple,chargeEst,siPadSel,fitType,title,var,varUnc=None,outDir='./'): grColl,shiftGrColl={},{} siWidthsC...
# -*- coding: utf-8 from __future__ import unicode_literals, absolute_import import django DEBUG = True USE_TZ = True # SECURITY WARNING: keep the secret key used in production secret! SECRET_KEY = "!b5in_p-zbxd7nbywc(_#g^c95rnmlk5^czaclltlpd&#nl0k&" DATABASES = { "default": { "ENGINE": "django.db.backe...
""" This type stub file was generated by pyright. """ """ODDT pipeline framework for virtual screening""" class virtualscreening: def __init__(self, n_cpu=..., verbose=..., chunksize=...) -> None: """Virtual Screening pipeline stack Parameters ---------- n_cpu: int (default=-1) ...
import requests def main(input_filename, output_filename): infile = open(input_filename, 'r') outfile = open(output_filename, 'w') try: domain = infile.readline().rstrip() while domain: # May want to do some domain validity checking here url = "http://www.%s" % domai...