text stringlengths 8 6.05M |
|---|
from app import app
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output
import charts
import helpers
# Generate Plotly content
content = html.Section(
children = [
html.Div([
html.H2("Network Analysis at a glance...", className="a... |
# Generated by Django 3.0.6 on 2020-06-07 16:27
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('musicRun', '0006_spotifyuser'),
]
operations = [
migrations.AddField(
model_name='song',
name='duration',
... |
import sys
from src.HistData.File.FileParser import FileParser
from src.HistData.Service.TimeRangeChecker import hour_range_stadistics, range_percentage
# Time is in Eastern Standard Time (EST) WITHOUT Day Light Savings adjustments
def main():
filename = 'data/HistData/2019_EUR_USD_M1.csv'
parser = FileParse... |
import queue
masks = [[2, 1, 0, 2],
[1, 1, 1, 1],
[0, 0, 2, 1],
[0, 3, 0, 0],
[1, 0, 0, 1]]
cases = int(input())
def r(a, b, c, d):
if [a, b, c, d] in mem:
return mem[[a, b, c, d]]
else:
if a - 2 > -1 and b - 1 > -1 and d - 2 > -1:
r(a - 2, b - 1, c, d - 2)
r(a - 1, b - 1, c - 1, d -... |
import random
def set_the_value(): # Функція для задання і перевірки значень
while True:
try:
value = input()
if value == 'exit':
print('Програма завершила роботу')
exit()
else:
return int(value)
break
... |
from flask import Flask, render_template
from flask_socketio import SocketIO, send, emit
app = Flask(__name__)
app.config['SECRET_KEY'] = 'ekisde'
app.config['DEBUG'] = True
socketio = SocketIO(app)
@app.route('/')
def index():
return render_template('index.html')
@socketio.on('message')
def chat(msg):
pr... |
from safedelete.managers import SafeDeleteManager
class IipManager(SafeDeleteManager):
pass |
import os
import sys
import subprocess
sys.path.insert(0, 'scripts')
import experiments as exp
def find_string_between(input_str, marker1, marker2):
start = input_str.find(marker1) + len(marker1)
end = input_str.find(marker2, start)
return input_str[start:end]
def run(alignment, tree, trees, model, iqtree_pref... |
def removeDuplicates(nums):
original_len=len(nums)
initial_count = 0
for i in range(0,len(nums)-1):
j=i+1
if(nums[i]==nums[j]):
j=j+1
else:
nums[initial_count+1]=nums[j]
initial_count+=1
print nums[0:initial_count+1]
nums... |
def variance(array):
nums = map(len, array)
length = float(len(nums))
average = sum(nums) / length
return round(sum((average - a) ** 2 for a in nums) / length, 4)
|
from texttable import Texttable
import numpy as np
def inserir_matriz(matriz, restricao, pos_linha, lista_pos):
qtdColunas = len(matriz[0])
lista_aux = [0] * qtdColunas
tam = len(restricao)
for i in range(len(lista_pos)): #
pos = lista_pos[i]
lista_aux[pos] = restricao[i]
lista_a... |
import cv2 as cv
import numpy as np
from popupMessage import popupmsg
def fSwap():
city_img = cv.imread("city.jpg")
city_img = cv.cvtColor(city_img, cv.COLOR_BGR2GRAY)
city_ft = np.fft.fft2(city_img)
face_img = cv.imread("face.jpg")
face_img = cv.cvtColor(face_img, cv.COLOR_BGR2GRAY)
face_ft =... |
#!/usr/bin/env python
#
# Copyright 2017 Google 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 required by applicable law o... |
import unittest
from logic.car import Car
class TestCar(unittest.TestCase):
def setUp(self):
self.car_obj = Car()
def test_reg_no(self):
self.car_obj.reg_no = "1234"
self.assertEqual(self.car_obj.reg_no, "1234")
def test_colour(self):
self.car_obj.colour = "red"
... |
# %%
# Load libraries
import pandas as pd
import numpy as np
from bs4 import BeautifulSoup
import os
import re
import seaborn as sns
import matplotlib.pyplot as plt
# %%
# set plot styles
sns.set_style("darkgrid")
# %%
def load_docs(dir_path):
"""
- Parameters: dir_path (string) for a directory containing tex... |
import dash_bootstrap_components as dbc
from dash import Input, Output, html
color_selector = html.Div(
[
html.Div("Select a colour theme:"),
dbc.Select(
id="change-table-color",
options=[
{"label": "primary", "value": "primary"},
{"label": "s... |
# coding=utf-8
# Copyright 2021 The Google Research 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... |
# Generated by Django 3.1.7 on 2021-02-25 09:18
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('home', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='item',
name='image',
field=mod... |
print("Starting up...")
# import necessary libraries
from time import time
start = time()
import os
import argparse
import rdkit.Chem as Chem
from utils import *
from rdkit.Chem import AllChem
from pathlib import Path
import rdkit.Chem.rdchem as rdchem
import rdkit.Chem.Draw as Draw
import rdkit.Chem.Descriptors
from... |
from pwn import *
import time
import sys
def add(key, size, data):
proc.sendlineafter(b'>>', b'1')
proc.sendlineafter(b':', key)
proc.sendlineafter(b':', f'{size}'.encode())
proc.sendafter(b':', data)
def view(key):
proc.sendlineafter(b'>>', b'2')
proc.sendlineafter(b':', key)
proc.recvu... |
# Copyright (c) 2017-2023 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
# fmt: off
# isort: skip_file
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
"""Client and server classes corresponding to protobuf-defined services."""
imp... |
import random
from midiutil import MIDIFile
def duration():
duration=random.uniform(5.0,30.0)
return duration
def pause():
pause=random.randrange(20,100,10)
pause2=pause/100.0
return pause2
def volume():
volume=random.randrange(60,100,1)
return volume
def insertionSort(no... |
from ..FeatureExtractor import ContextFeatureExtractor
import ned
class distance_in_kpc_to_nearest_galaxy(ContextFeatureExtractor):
"""distance_in_kpc_to_nearest_galaxy"""
active = True
extname = 'distance_in_kpc_to_nearest_galaxy' #extractor's name
cutoff = 1000.0 ## kpc
verbose = False
def extract(self):
... |
from django.contrib.auth import login, authenticate
from django.contrib.auth.decorators import login_required
from django.contrib.auth.forms import UserCreationForm
from django.shortcuts import get_object_or_404, render, redirect
from django.http import HttpResponse
from .models import Beer, BeerStyle, Brewery, Hops, ... |
# Generated by Django 3.2.3 on 2021-06-12 03:51
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('pizza_app', '0006_auto_20210612_0334'),
]
operations = [
migrations.RemoveField(
model_name='ingredientsize',
name='type_siz... |
import socket
import sys
from time import sleep
from flask import Flask
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
server_address = ('dgonyeoraspi.csh.rit.edu', 10001)
app = Flask(__name__)
@app.route('/')
def hello_world():
return 'Hello World!'
if __name__ == '__main__':
print('connecting')... |
from django.shortcuts import render
from django.http import HttpResponse
# Create your views here.
def index(request):
convolutions = range(1)
return render(request,
'convolution/index.html',
{'convolutions':convolutions})
def add(request):
return HttpResponse("add") |
from collections import namedtuple
import pandas as pd
from promise import Promise
from promise.dataloader import DataLoader
from graphql import GraphQLError
from app import db
from app.util import (
_SemesterContent,
ProposalInactiveReason,
ProposalStatus,
ProposalType,
)
ProposalContent = namedtuple... |
import stage
import ugame
PALETTE = (b'\xf0\x0f\x00\x00\xcey\xff\xff\xf0\x0f\x00\x19\xfc\xe0\xfd\xe0'
b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00')
game = stage.Stage(ugame.display, 12)
text = stage.Text(16, 16, palette=PALETTE)
game.layers = [text]
i = 0
for y in range(16):
fo... |
#!/usr/bin/env python
"""
pyjld.os.tools
Various OS utilities
@author: Jean-Lou Dupont
"""
__author__ = "Jean-Lou Dupont"
__email = "python (at) jldupont.com"
__fileid = "$Id$"
__all__ = ['safe_mkdir','psyspaths','safe_oneup','safe_walkup', 'versa_copy',
'copyFiles', 'copyUpdatedFiles', 'genUpdate... |
from carbon_black.endpoints.base_endpoint import Endpoint
from shared.models import News_Event
from datetime import datetime
class News(Endpoint):
def __init__(self) -> None:
super().__init__()
return
def get(self, api_endpoint: str, transaction_id: int) -> dict:
try:
res... |
from spack import *
import platform
import sys,os
sys.path.append(os.path.join(os.path.dirname(__file__), '../../common'))
from scrampackage import write_scram_toolfile
class Geant4Toolfile(Package):
url = 'file://' + os.path.dirname(__file__) + '/../../common/junk.xml'
version('1.0', '68841b7dcbd130afd7d236a... |
# Given a string, determine if it is a palindrome, considering
# only alphanumeric characters and ignoring cases.
# Note: For the purpose of this problem, we define empty string as
# valid palindrome.
# Example 1:
# Input: "A man, a plan, a canal: Panama"
# Output: true
# Example 2:
# Input: "race a car"
# Output: ... |
from django.db import models
# from project.models import Project
# Create your models here.
class Assetmaster(models.Model):
asset_master_id = models.AutoField(primary_key=True)
project = models.ForeignKey('project.Project')
asset = models.ForeignKey('Device')
sn = models.CharField(max_length=100)
no_registrasi ... |
# coding=utf-8
""" Finetuning BioBERT models on MedMentions.
Adapted from HuggingFace `examples/run_glue.py`"""
import argparse
import glob
import logging
import os
import random
import math
import numpy as np
import torch
from torch.utils.data import DataLoader, RandomSampler, SequentialSampler, T... |
# 2. Write a python program for the following:
# Input the string “Python” as a list of characters from console, delete at least 2 characters, reverse the resultant string and print it.
# users enters string input
text = list(input("Enter the text to be processed: "))
# excluding/ deleting first character of the strin... |
# Generated by Django 3.2.4 on 2021-07-13 08:03
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('data_aggregator', '0012_alter_jobtype_type'),
]
operations = [
migrations.RenameField(
model_name='participation',
o... |
# -*- coding: utf-8 -*-
if __name__ == "__main__":
fid = open('rosalind_revc.txt','r')
output = open('main.out','w')
s = fid.readline().strip()
#read string
sta = s.replace('T','t').replace('t','a').replace('A','T').replace('a','A')
scg = sta.replace('C','c').replace('c','g').repla... |
#
# @lc app=leetcode.cn id=509 lang=python3
#
# [509] 斐波那契数
#
# @lc code=start
class Solution:
def fib(self, n: int) -> int:
"""DP:自底向上"""
# 31/31 cases passed (28 ms)
# Your runtime beats 91.1 % of python3 submissions
# Your memory usage beats 17.92 % of python3 submiss... |
#!/usr/bin/python
# createTables.py
import psycopg2
import sys
con = None
try:
con = psycopg2.connect(database='devel', user='mpozulp')
cur = con.cursor()
print 'Creating jobs table'
cur.execute("CREATE TABLE jobs ( \
jobid INT PRIMARY KEY, \
date CHAR(35), \
ncpus INT, \
... |
from flask_restplus import Api
from .authenticate_api import api as ns_authenticate
from .park_api import api as ns_park
from .generate_parking_lot_api import api as ns_generate_parking_lot
API_PREFIX = '/pp/v1'
# authorizations = {}
api = Api()
api.add_namespace(ns_authenticate, path=API_PREFIX+'/authenticate')
api... |
from PIL import Image
import numpy as np
import pandas as pd
import sys
# pass in pixel1, and pixel2 as np arrays
def directional_derivative(pixel1, pixel2):
return pixel1 - pixel2
# pass in a pixel as an np array
def norm(pixel):
return np.inner(pixel, pixel)
def edge_detection(pixel, epsilon, image, n):
# find... |
#!/usr/bin/env /data/mta/Script/Python3.8/envs/ska3-shiny/bin/python
#############################################################################
# #
# create_sib_data.py: create sib data for report #
# ... |
from numba import jit
ifunc = {
"dunkin": {"love": 1, "rayleigh": 2},
"fast-delta": {"love": 1, "rayleigh": 3},
}
ipar = {
"thickness": 0,
"velocity_p": 1,
"velocity_s": 2,
"density": 3,
}
def jitted(*args, **kwargs):
"""Custom :func:`jit` with default options."""
kwargs.update(
... |
# 各个不同网络的冻结与微调
# 冻结和微调
from keras.models import Sequential
from keras.layers import Dense
from keras.optimizers import Adam, SGD
import numpy as np
from keras.applications import ResNet50, VGG19, InceptionV3, MobileNet, NASNetMobile, Xception,DenseNet121
import matplotlib.pyplot as plt
import gc
# tf.test.gpu_device_... |
'''Fibonacci iterator'''
class Fib:
'''iterator that yields numbers in the Fibonacci sequence'''
def __init__(self, max):
self.max = max
def __iter__(self):
self.a = 0
self.b = 1
return self
def __next__(self):
fib = self.a
if fib > self.max:
... |
import cv2
import os
import time
# import matplotlib.pyplot as plt
from grabscreen import grab_screen
from getkeys import key_check
# Define keys/classes
w = [1,0,0,0,0,0,0,0,0]
s = [0,1,0,0,0,0,0,0,0]
a = [0,0,1,0,0,0,0,0,0]
d = [0,0,0,1,0,0,0,0,0]
wa = [0,0,0,0,1,0,0,0,0]
wd = [0,0,0,0,0,1,0,0,0]
sa = [0,0,0,0,... |
#!/usr/bin/env python
"""
eclipse_features -- generate a dict of features related to
classification of eclipsing systems
in pulsational variables
is_suspect Is there a reason not to trust the orbital period measurement?
p_pulse Pulsational period (dom... |
#!/usr/bin/env python3
# Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
# for details. All rights reserved. Use of this source code is governed by a
# BSD-style license that can be found in the LICENSE file.
"""Tests for dartgenerator."""
import logging.config
import os.path
import re
impor... |
"""
CSC148, Winter 2019
Assignment 1
Task 1 Tests
"""
import datetime
import pytest
from typing import List, Dict, Union
from application import create_customers, process_event_history
from customer import Customer
from contract import TermContract, MTMContract, PrepaidContract
from phoneline import PhoneLine
from ta... |
# Andrew Cargill
# Game Night Tweeter
# 2021-06-01 - v2.1 - Migrating From SNS to Twilio To Send SMS Messages
import base64
import boto3
import os
import random
import requests
import twitter
# AWS Constants
BUCKET_NAME = os.environ['BUCKET_NAME']
# Twitter Constants
ACCESS_KEY_TOKEN = os.environ['ACCESS_KEY_TOKEN'... |
"""
Returns the iterable 'iter' with the value 'val'
added to its front and back.
i.e., surround(['a', 'b'], 'c') will return ['c', 'a', 'b', 'c']
"""
def surround(iter, val):
iter.append(val)
iter.insert(0, val)
return iter
"""
Returns a list of items from the dictionary 'dicti'
where the key is equal to the v... |
# Day 8: Dictionaries and Maps
# Learn about key-value pair mappings using Map or a Dicitionary structure
# Given n names and phone numbers, assemble a phone book that maps
# friend's names to their respective phone numbers
# Query for names and print "name=phoneNumber" for each line, if not found
# print "Not found... |
lista_de_weas = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
for numero_de_wea in lista_de_weas:
if numero_de_wea > 5 and numero_de_wea < 9:
continue
print(numero_de_wea) |
import cv2
import numpy as np
import random
class HandPartClassifier:
@staticmethod
def showClassImage(window_name, inputImage):
height = inputImage.shape[0]
width = inputImage.shape[1]
classMap = np.zeros((height, width, 3), np.uint8)
colorMap = {}
for i in xrange(he... |
# -*- coding:utf-8 -*-
""" 数字游戏
让a[i]和b[i],关于b降序排列。减少得多的先被擦掉,就可以让剩下的和尽可能的大
dp[i][j]表示前i个数字在第j轮的时候的最大取值
dp[i][j] = max(dp[i-1][j], dp[i-1][j-1]+a[i]-b[i]*(j-1))"""
# O(n log n)
def max_num(a, b, m, dp):
temp = []
for i in range(len(a)):
temp.append([a[i], b[i]])
temp.sort(key=lambda ... |
import math
import mathutils
def correct_ges_rotation(rot: mathutils.Vector):
rot.x += math.pi
rot.y *= -1
rot.z *= -1
|
from .augmentation import *
from .helper import *
#from .trainer import *
from .loss import *
from .metrics import *
from .download import * |
# -*- coding:utf-8 -*-
'''
选择排序算法:
基于比较的排序算法
将数据分为已排区间和未排区间
从未排区间中遍历出最小值及其索引
将其和当前遍历的索引位置互换
'''
def SelectionSort(arr):
length = len(arr)
for i in range(length):
minIndex = i
minValue = arr[i]
for j in range(i+1,length):
if arr[j] < minValue:
minIndex = j
minValue = arr[minIndex]
arr[i],arr[mi... |
import cv2
# import imutils
import numpy as np
def simple_return(image):
return image
def crop_image(image):
return image[0:350, 0:350]
detector = cv2.CascadeClassifier('image_processing/cascades/haarcascade_frontalface_default.xml')
def face_detection(image, rect_color, rotation):
if rotation == 9... |
import pytest
import os
import sys
import threading
from pprint import pprint
sys.path.insert(1, os.path.join(sys.path[0], '..'))
from utils import *
def test_listen_func():
# The agent's IP
IP = '127.0.0.1'
# The port where the agent listens for messages
PORT = 5005
listening_socket = socket.s... |
from django.db import models
class Autor(models.Model):
nome = models.CharField(max_length = 255)
idade = models.IntegerField()
def __str__(self):
return self.nome
class Editora(models.Model):
nome = models.CharField(max_length = 255)
avaliacao = models.IntegerField()
def __str__(sel... |
# -*- coding:utf-8 -*-
from setuptools import setup
setup(
name = 'python-dbpool',
version = '0.1.0a0',
author = 'Claus Prüfer',
author_email = 'pruefer@webcodex.de',
maintainer = 'Claus Prüfer',
description = 'A tiny static postgresql database pool for threaded wsgi webserver (apache2).',
... |
from tqdm import tqdm
import random
import csv
import sys
import os
#=========1=========2=========3=========4=========5=========6=========7=
# Generates a new dataset in "dest" called "n-ary_toy_dataset" which
# is a directory hierarchy with n-ary tree structure. The leaf nodes
# contain 100 text files each, where e... |
# Standard Libraries
import csv
import re
# additional libraries (pip install ...)
import bs4
from bs4 import BeautifulSoup
# Local Libraries
from src.data_manager import get_bible_book_id_map
from src.paths import *
from src.data_manager import BOOK_KEY, CHAPTER_KEY, VERSE_KEY, TEXT_KEY, ID_KEY
def parse_wycliffe... |
#!/usr/bin/python
# -*- coding: UTF-8 -*-
import sqlite3
import pandas as pd
def importSimTradeToSQLite():
"""excel"""
with sqlite3.connect('C:\sqlite\db\hxdata.db') as db:
insert_template = "INSERT INTO simtrade " \
"(usrmobile, createtime, tradedays) " \
... |
from battle.arena_sc2 import BattleType, make, ids, spec
import battle.arena_sc2.arenas
import battle.arena_sc2.envs
import battle.arena_sc2.agents
from absl import app
def list_agent_spec(unused_argv):
agent_ids = ids(BattleType.agent)
print(agent_ids)
for agent_id in agent_ids:
agent_spec = spec(agent_id... |
import os
import sqlite3
from win32 import win32crypt
import sys
class retreive:
def chrome():
try:
path = sys.argv[1]
except IndexError:
w = os.getenv('LOCALAPPDATA')
path = str(w) + r'\Google\Chrome\User Data\Default\Login Data'
# Connect to the Databa... |
import datetime
import sys
import log
from status import Status
logging = log.getLogger()
class History(object):
def __init__(self, db):
self.db = db
def _interpretFilter(self, filter):
parts = filter.split( ',' )
def listPrevious(self, chord_name):
previous = self.db.getExecuti... |
import conway
def test_get_live_neighbours():
assert conway.get_live_neighbours_count(0, 0, [[0, 1, 0],[0, 0, 1],[1, 1, 1],[0, 0, 0]]) == 1
assert conway.get_live_neighbours_count(0, 1, [[0, 1, 0],[0, 0, 1],[1, 1, 1],[0, 0, 0]]) == 1
assert conway.get_live_neighbours_count(0, 2, [[0, 1, 0],[0, 0, 1],[1, 1,... |
import discord
from discord.ext import commands
import discord.utils
from discord.utils import get
import asyncio
import random
import datetime
import json
prefixes = ['!']
bot = commands.Bot(
command_prefix=prefixes,
description='Public testing bot',
... |
import api
import ai
import time
toeken = ""
while True:
token = api.login()
while True:
try:
game_id, card = api.begin_game(token)
res = ai.solve(card)
api.play(game_id, res, token)
print("--------比赛结果---------")
time.sleep(1)
# a... |
import torch
import torch.nn as nn
import torch.nn.functional as F
class PairNet(nn.Module):
def __init__(self, dim_in, dim_out):
super(PairNet, self).__init__()
self.fc1 = nn.Linear(dim_in, 512)
self.fc2 = nn.Linear(512, 256)
self.fc3 = nn.Linear(256, dim_out)
def forward(sel... |
"""
Given a binary tree, each node has value 0 or 1.
Each root-to-leaf path represents a binary number starting with the most significant bit.
For example, if the path is 0 -> 1 -> 1 -> 0 -> 1, then this could represent 01101 in binary, which is 13.
For all leaves in the tree, consider the numbers represented by the p... |
# I, Alvin Radoncic, abide by the Stevens Honor Code
# Problem 2, Homework 5
# This program accepts a list of numbers and returns the sum of the numbers.
def summed_list():
number_of_terms = int(input("How many numbers do you want to list? "))
sum = 0
for i in range(number_of_terms):
x = float(in... |
class Solution:
# @param A : string
# @return an integer
def solve(self, A):
"""
This was simplified by the constraint that you can only add characters to the beginning of
the string, so I'm just checking is the whole string a palindrome, is the string length - 1
a palindrome... |
import os
ADMINS = (
('Przemyslaw Pietrzkiewicz', 'pietrzkiewicz@gmail.com'),
)
MANAGERS = ADMINS
try:
from settings_production import DATABASES
from settings_production import SECRET_KEY
from settings_production import EMAIL_HOST
from settings_production import EMAIL_HOST_USER
from setting... |
# -*- encoding: utf-8 -*-
import datetime
import os
import unittest
from io import StringIO
from textwrap import dedent
import jinja2
import mocker
from bloggertool.exceptions import FileNotFoundError, UserCancel, ConfigError
from bloggertool.str_util import Template as _
from bloggertool.config import Config
from ... |
#!/bin/python
# Script updater.py
# Check update for application to the latest version
import urllib.request as request
import os.path as path
import os
import ctypes
import logging
# define
OK = 1
NOK = 0
htpdir = path.abspath(path.join(os.getcwd(), '../../..'))
log_file = path.join(htpdir + '\\log','updater.log'... |
wordcount={}
c = 0
x = ''
with open('dataset_3363_3.txt') as inf:
for line in inf:
line = line.strip()
for word in line.lower().split():
if word not in wordcount:
wordcount[word] = 1
else:
wordcount[word] += 1
for k,v in sorted(wordcount.items(... |
from torch.utils.data import DataLoader
from parseridge.corpus.training_data import ConLLDataset
from parseridge.parser.loss import Criterion
from parseridge.parser.training.base_trainer import Trainer
from parseridge.parser.training.callbacks.base_callback import StopEpoch, StopTraining
from parseridge.parser.trainin... |
class Store:
store_name = None
store_sale = {}
def generate_Report(self,store_name=None):
if store_name is None:
print('provide the store(name) of the you want the { Generate_Report }')
else:
|
#!/usr/bin/env python
# coding: utf-8
# In[2]:
def printAll(*args): # All the arguments are 'packed' into args which can be treated like a tuple
print("No of arguments:", len(args))
for argument in args:
print(argument)
#printAll with 3 arguments
printAll('Horsefeather','Adonis','Bone')
#printAll wi... |
import shutil
from unittest import TestCase
from segmentation_rt.rs2mask.dcm2mask import Dataset
TEST_IPP = 'tests/test_data/cheese_dcm'
TEST_RS = 'tests/test_data/cheese_dcm/cheese_dcm_1/RS1.2.752.243.1.1.20210208111802158.1580.88111.dcm'
class TestDataset(TestCase):
def setUp(self):
structures = ['Ex... |
def main():
run()
a = A(1)
def run():
print("I am running")
class A(object):
def __init__(self, arg):
pass
if __name__ == '__main__':
main()
|
from google.appengine.ext import ndb
from models.AppUserModel import AppUserMethods
import datetime
from models.TaskboardModel import TaskboardMethods
class Task(ndb.Model):
# taskboard task belongs to
taskboard = ndb.KeyProperty()
# title of task
title = ndb.StringProperty()
# description of tas... |
#!/usr/bin/python3
"""Fabric script (based on the file 1-pack_web_static.py) that
distributes an archive to your web servers, using the function do_deploy:"""
from fabric.api import *
import time
from os import path
env.hosts = ['35.237.41.190', '3.90.183.111']
def do_deploy(archive_path):
if path.isfile(archiv... |
import smtplib, ssl
from datetime import datetime, timezone
from flask import Flask
from flask_restx import Api, Resource, fields
from werkzeug.middleware.proxy_fix import ProxyFix
from config import Config, log
app = Flask(__name__)
app.wsgi_app = ProxyFix(app.wsgi_app)
api = Api(app, version='1.0', title='SMTP AP... |
#!/usr/bin/env python
# Authors: Trevor Sherrard,
# Since: 02/10/2020
# Project: RIT MSD P20250 Finger Lakes ROV Exploration
# filename: flask_node.py
# import required libraries
import rospy
import time
import threading
from std_msgs.msg import Float32MultiArray
from std_msgs.msg import Int8
from flask import Flask
... |
import csv, sys, os
if len(sys.argv) != 2:
print "Usage: python %s <spreadsheet.csv>" % os.path.basename(__file__)
sys.exit(0)
filename = sys.argv[1]
print "---Battle Tower CSV Parser---"
print " version 0.0.3 "
print
print "Loading " + filename + "..."
print
#list to store the items
floors = [... |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.3 on 2016-11-08 13:01
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('recursos', '0001_initial'),
]
operations = [
... |
from django.urls import path, include
urlpatterns = [
path('', include('api.users.urls', namespace='users')),
path('', include('api.menu.urls', namespace='menus')),
path('', include('api.orders.urls', namespace='orders')),
path('', include('api.token.urls', namespace='token')),
] |
###
# Copyright (c) 2009-2014, Torrie Fischer
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# this list of cond... |
#!/usr/bin/python3
'''
'''
import pysam
from globals import *
#Assess read based on quality, alignment, sequence complexity,
class ShortReadAssessment(object):
def __init__(self, samread):
self.alignedread_=samread
self.meanphread_=sum(samread.query_qualities)/len(samread.query_qualities)
... |
import argparse
import datetime
import logging
import os
import sys
from typing import List, Dict, Tuple
import torch
from torch.nn import DataParallel
from torch.optim import Optimizer
from transformers import PreTrainedModel
from transformers import PreTrainedTokenizer
from spert import util
from spert.opt import t... |
from scrapy import Spider, Request
from beer_advocate.items import BeerRatingItem
from beer_advocate.masking_utilities import *
from lxml.html import fromstring
import pandas as pd
import numpy as np
import re, os, requests
import datetime as dt
class BABeerReviewsSpider(Spider):
name = "beer_reviews_spider"
... |
import os
import sys
import subprocess
import shutil
import fam
sys.path.insert(0, 'scripts')
sys.path.insert(0, 'tools/mappings')
import experiments as exp
import time
import saved_metrics
import ete3
import get_dico
import random
import species_analyze
import time
def build_supermatrix(datadir, subst_model, supermat... |
# portage.py -- core Portage functionality
# Copyright 1998-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
VERSION="2.1.11.31"
# ===========================================================================
# START OF IMPORTS -- START OF IMPORTS -- START OF IMPORTS -- START OF... |
from flask import Flask
from threading import Thread
app = Flask('')
@app.route('/')
def home():
return ("I'm simping :}", 200, None)
def run():
app.run(host='0.0.0.0',port=8081)
def keep_alive():
t = Thread(target=run)
t.start()
|
def max_product(nums):
biggest = second_biggest = 0
for num in nums:
gt_second_biggest = num > second_biggest
if gt_second_biggest and num > biggest:
second_biggest, biggest = biggest, num
elif gt_second_biggest:
second_biggest = num
return second_biggest * bi... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.