text
stringlengths
38
1.54M
# Generated by Django 2.2.5 on 2021-07-29 17:03 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('app', '0003_comment'), ] operations = [ migrations.RemoveField( model_name='comment', name='list', ),...
#!/usr/bin/env python3 import sys DEBUG = False def str2num(s): lookup = [ "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten", "eleven", "twelve", "thirteen", ...
from OneD import OneD class OneDProbabilistic(OneD): def default_rule(neighbors, prob=0.9): """implements the rule_30 CA rule but gives the rule a propagation probability of 90% """ from random import random p1,p2,p3 = neighbors if (p1) != (p2 or p3): if random() < prob: return 1 else: ret...
from flask import Flask, render_template, request, jsonify from elasticsearch import Elasticsearch import json app = Flask(__name__) es = Elasticsearch() @app.route('/', methods=["GET", "POST"]) def index(): # field list for selection menu fields=['@context', '@id', '@type', 'author', 'citation', 'creator',...
#!/usr/bin/env python import xml.etree.ElementTree as ET from optparse import OptionParser import os if __name__=='__main__' : parser = OptionParser() parser.add_option("-f", "--from", dest="from_xml", help="XML File A", metavar="foo.xml") (options, args) = parser.parse_args() if n...
from allennlp.predictors.predictor import Predictor import dash from dash.dependencies import Output, Input import dash_core_components as dcc import dash_html_components as html import json import pandas as pd import plotly app = dash.Dash(__name__) app.layout = html.Div( html.Div( [ html.I( ...
from zope.interface import Interface from zope.interface import implementer class Interfaz(Interface): def agregarAuto(insert): pass def mostrarAuto(v1): pass def cambiarPrecio(): pass def autoMasEconomico(): pass def mostrarTodoLosAutos(): ...
# Copyright (C) 2016 Ross Wightman. 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 # =================================...
#!/usr/bin/env python3 def diff(row): values = sorted([int(i) for i in row.split() if int(i)], reverse=True) for i in range(len(values)): for j in values[i+1:]: tmp = values[i] / j if int(tmp) == tmp: return int(tmp) return 0 def solve(content): return s...
from django.conf.urls import include, re_path from . import views urlpatterns = [ re_path(r'^login_modal$', views.login_modal), re_path(r'^login$', views.login_authentication), re_path(r'^logout$', views.logout_authentication), ]
""" Random Forest Model Training_Batch ================================== Purpose: ======== This module is used to train a series of random forest models. Description: ============ Inputs: ******# - RF_parameter_dir = '/raidb/wli/Final_Results/ROC/results/RF_parameters/RF_parameter_Method_II_Model_I_...
import abc class Scanner(abc.ABC): @abc.abstractmethod def scan_document(self): pass @abc.abstractmethod def get_scanner_status(self): pass
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
from src.commons.methods import generate_random_points, get_distance def test_random_generation(prepared_fixed_points): assert prepared_fixed_points == generate_random_points(1.0, 1.0, 10) def test_distance(prepared_fixed_points): assert get_distance(prepared_fixed_points[0], prepared_fixed_points[1]) == 0....
from django.shortcuts import render, get_object_or_404 from django.utils import timezone from django.shortcuts import redirect from django.contrib.auth.decorators import login_required from django.contrib.auth import login, authenticate from django.contrib.auth.forms import UserCreationForm from .models import Post, Co...
# -*- coding: utf-8 -*- """ Created on Wed Feb 8 20:59:21 2017 @author: alphy """ my_range = range(1,21) print ([str(i) for i in my_range]) print(list(map(str,my_range)))
#!/usr/bin/env python import os from resgds.resonatorshapes import shapes as rs from resgds.resonatorshapes import restempfiles as rst from resgds.braggshapes import bragg from resgds.interface import interface # from resgds import * # import bragg # from interface import Interface import gdspy # gds library import nu...
""" Unit test for SLSQP optimization. """ from __future__ import division, print_function, absolute_import import pytest from numpy.testing import (assert_, assert_array_almost_equal, assert_allclose, assert_equal) from pytest import raises as assert_raises import numpy as np from scipy.opt...
import os import random import re from typing import Pattern from utilities import error_print, color_print from utilities.utils import handle_user_input def guessed(word: str, guessed_letters: set) -> bool: """ :param word: word to be guessed :param guessed_letters: already guessed letters :return:...
#!/usr/bin/env python3 import sys def splitDirections(line: str) -> list: directions = [] i = 0 while i < len(line): if line[i] == "n" or line[i] == "s": directions.append(line[i : i + 2]) i += 2 else: directions.append(line[i]) i += 1 r...
#!/usr/bin/env python # TODO: # ! add option for padding # - fix occasionally missing page numbers # - treat large h-whitespace as separator # - handle overlapping candidates # - use cc distance statistics instead of character scale # - page frame detection # - read and use text image segmentation mask # - pick up str...
""" Challenge 184 Task 2""" import re def split_array(my_input: list) -> list: """Do the task""" list09 = [] listaz = [] for item in my_input: temp09 = [] tempaz = [] for char in item: if re.match(r"\d", char): temp09.append(int(char)) ...
import supybot.conf as conf import supybot.registry as registry def configure(advanced): # This will be called by supybot to configure this module. advanced is # a bool that specifies whether the user identified himself as an advanced # user or not. You should effect your configuration by manipulating t...
import html import json from copy import deepcopy from django.http import HttpResponse, JsonResponse from django.views.generic import TemplateView from mymodels.models import Posts, PostsPhotos, Tags from mypackage.pakage import get_user_permission, get_user_session, slice_url_photo from mypackage.compress_image impo...
"""Simple chat application for client""" import argparse import grpc from google.protobuf.internal.well_known_types import Timestamp import simple_chat_pb2 import simple_chat_pb2_grpc def create_arg_parser(): """Creates and returns the ArgumentParser object""" parser = argparse.ArgumentParser(description='S...
from django.db import models import datetime class UserManager(models.Manager): def basic_validator(self, postData): errors = {} if 'change' in postData and postData['change'] == 'register_': if len(postData[f"{postData['change']}name_input"]) <= 3: errors[f"{postData['...
#e. Linear Search def linear_search(items, find_item): for index in range(0,len(items)): if find_item == items[index]: return index res = linear_search([1,3,4,6,5,8,9,2,7], 5) print(res)
import pandas as pd from datetime import datetime if __name__ == "__main__": dates = pd.date_range(start="2011-11-01", end="2014-02-27") dff = pd.DataFrame(data=None, index=dates) for i in range(0,112): df = pd.read_csv("inputs/tabular/daily_dataset/block_"+str(i)+".csv") df = df[['day', 'L...
# -*- coding: utf-8 -*- """PyMzn is a Python library that wraps and enhances the MiniZinc tools for modelling and solving constraint programs. It is built on top of the MiniZinc toolkit and provides a number of off-the-shelf functions to readily solve problems encoded in MiniZinc and parse the solutions into Python obj...
# -*- coding: utf-8 -*- """ Created on Sun Jan 14 16:53:51 2018 @author: misakawa """ from linq.standard.general import Map from pipe_fn import infix, and_then import numpy as np poisson_noise = and_then( lambda x: x.astype(float), # 转化为浮点数组 infix/np.transpose@(2, 0, 1), # 将图片的(m x n x 3)转为(3 x m x n) i...
from z3 import * # Add a constraint that at least one of # the found values must be different from the # last time def force_new_solution(s): m = s.model() s.add(Or([f() != m[f] for f in m.decls() if f.arity() == 0]))
#! /usr/bin/env python #coding=utf-8 from miio import chuangmi_plug #from yeelight import discover_bulbs import time #print discover_bulbs() plug = chuangmi_plug.ChuangmiPlug("192.168.28.229",'ede445d92432153996ae77bd7c3a1d5c') while 1: print("IN LOOP!") #plug.on() #time.sleep(2) plug.off() time....
"""Contains the GameManagement cog, for commands related to game management.""" from discord.ext import commands from lib import checks from lib.logic.Effect import Good, Evil from lib.logic.Player import Player from lib.logic.converters import to_character from lib.logic.playerconverter import to_player, to_member f...
#!/usr/bin/env python3 import binaries import db import flask import json import os import redis import threading import time from ast import literal_eval from celery import Celery from flask import request from flask_cors import CORS, cross_origin from shutil import copy queue_poll_interval = 10 default_product = "c...
import scipy.optimize # Objective Function: 50x_1 + 80x_2 # 2 machines: X1 ($50/hr), X2 ($80/hr) # Constraint 1: 5x_1 + 2x_2 <= 20 # X1 costs 5 units of labor per hour; X2 costs 2. Have 20 units of labor to spend. # Constraint 2: -10x_1 + -12x_2 <= -90 # X1 produces 10 units/hr; X2 produces 12 units/hr. Co...
from pandas.io.data import DataReader import datetime as dt import pandas as pd import numpy as np import matplotlib.pyplot as plt randn = np.random.randn #p = pd.Period('2012Q4', freq='Q-JAN') p = pd.Period('2012Q4', freq='Q-JAN') p4pm = (p.asfreq('B', 'e') - 1).asfreq('T', 's') + 16 * 60 #print p4pm dr ...
import unittest import convertcurrency as cc class ParsingTestCase(unittest.TestCase): def setUp(self): self.default_from = ('PLN', ) self.default_to = ('GBP', 'USD') self.default_amount = 13 cc.set_default_currencies_to_convert_from('pln') cc.set_default_currencies_to_conv...
""" Boyer moore's linear time pattern matching algorithm with the bad character rule, good suffix rule, match prefix rule and galil's optimization """ from reverse_z import z_suffix from z_algo import z_algorithm def bad_character_preprocess(pattern, alphabet_size): """ Returns an array of size alphabet_s...
from mamba import description, context, it, before, \ fdescription, fcontext, fit from expects import expect, equal, raise_error, contain from contacts.models import User, UserPhone, UserEmail from spec.common.utils import clean_database, prevent_request_warnings from spec.common.endpoint_client import EndpointCli...
#!/usr/bin/env python2 # -*- coding: utf-8 -*- ################################################## # GNU Radio Python Flow Graph # Title: Top Block # Generated: Mon Jun 12 17:20:55 2017 ################################################## from gnuradio import blocks from gnuradio import eng_notation from gnuradio import ...
import wandb import os import torch import torch.nn as nn import torch.nn.functional as F import torchaudio import pandas as pd from sklearn import preprocessing from torch.utils.data import Dataset, DataLoader, WeightedRandomSampler, random_split import numpy as np from torch import distributions import seaborn as sns...
class Solution: def searchRange(self,nums,target): def search(lo,hi): #if numbers from lo to hi are all target, return that section of nums list if nums[lo]==target==nums[hi]: return [lo,hi] #otherwise, if only one side is equal to target or target is in side the range of lo to hi #recursively call s...
""" Read in a netcdf file and copy over all attributes and variables with compression turned on """ from netCDF4 import Dataset from pathlib import Path import numpy as np with Dataset(theFile,'r') as old_nc: with Dataset(newFileName,'w') as new_nc: theDims=old_nc.dimensions for key,value in theD...
from functools import lru_cache from typing import Callable, Generic, Optional, TypeVar T = TypeVar("T") class GameOfLife(Generic[T]): def __init__( self, initial_state: Optional[list[list[T]]] = None, x_size: Optional[int] = None, y_size: Optional[int] = None, ) -> None: if initial_state is None: if ...
# Elastic search mapping definition for the Molecule entity from glados.es.ws2es.es_util import DefaultMappings # Shards size - can be overridden from the default calculated value here # shards = 3, replicas = 1 analysis = DefaultMappings.COMMON_ANALYSIS mappings = \ { 'properties': { ...
import networkx as nx import matplotlib.pyplot as plt G = nx.DiGraph() f = open('higgs-retweet_network.edgelist','r') most = 10000 for line in f: nodes = line.split() nodeFrom = int(nodes[0]) nodeTo = int(nodes[1]) G.add_edge(nodeFrom, nodeTo) #print "Add edge from ", nodeFrom, " to ", nodeTo # if most == 0: #...
#!/usr/bin/env python """gschedarchitect @author: Dillon Hicks @organization: KUSP @contact: hhicks[at]ittc[dot]ku[dot]edu @summary: """ import sys import os import types import copy import pykusp.configutility as config from pygsched.gsstructures import * from PyQt4.QtGui import * from PyQt4 import ...
import json import os from collections import OrderedDict from os.path import join import core.case.database as case_database import core.case.subscription as case_subs import core.config.paths import server.flaskserver as server import tests.config from core.case.subscription import set_subscriptions, clear_subscript...
"""This module contains performance tests of oneclient using sysbench benchmark. """ __author__ = "Jakub Kudzia" __copyright__ = "Copyright (C) 2015 ACK CYFRONET AGH" __license__ = "This software is released under the MIT license cited in " \ "LICENSE.txt" from tests.utils.docker_utils import run_cmd fr...
import gi import json gi.require_version('Gtk', '3.0') from gi.repository import Gtk class NewNoteWindow(Gtk.Window): def __init__(self, nid): Gtk.Window.__init__(self, title="Note") with open('notes.json') as data_file: data = json.load(data_file) notes = data["notes"] ...
#!/usr/bin/env python3 from argparse import ArgumentParser import yaml import extract_features def get_args(): parser = ArgumentParser( description="Takes a list of input VCFs with known contamination levels and outputs training data with which to train the SVR" ) parser.add_argument( "...
__author__ = 'alex' from unittest import TestCase import threading import time from processor.taskdistributor import TaskSender from processor.taskexecutors import TaskProcessLTE,TaskProcess3G from processor.taskworker import TaskWorker from processor.taskdistributor import Task class TestTaskWorker(TestCase): ...
from flask import Blueprint from app.api.v1 import index def create_blueprint_v1(): bp_v1 = Blueprint('v1', __name__) index.api.register(bp_v1) return bp_v1
import cx_Freeze executables = [cx_Freeze.Executable("game.py")] cx_Freeze.setup( name="Space Attack", options={"build_exe": {"packages":["pygame"],"include_files":['assets/alien_bullet.png', 'assets/alien1.png', 'assets/alien2.png', 'assets/alien3.png', 'assets/alien4.png', 'assets/alien5.png', 'assets/bg.pn...
#!/usr/bin/env python import sys import numpy as np import time sys.path.append('./functions') from variables import * from IO import * from domain import * from init import * from timeIntegrate import * # read input parameters from input.in inputDict = readInput() # create domain createDomain(inputDict) # Initializ...
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'test_concept.ui' # # Created by: PyQt5 UI code generator 5.10.1 # # WARNING! All changes made in this file will be lost! from PyQt5 import QtCore, QtGui, QtWidgets class Ui_MainWindow(object): def setupUi(self, MainWindow): Mai...
"""Interact with a Fish REPL. """ import os import sys import subprocess from subprocess import PIPE from threading import Thread import tempfile try: from queue import Queue except ImportError: from Queue import Queue def write_thread(q, f): while True: data = q.get() f.write(data) ...
""" There is a robot starting at position (0, 0), the origin, on a 2D plane. Given a sequence of its moves, judge if this robot ends up at (0, 0) after it completes its moves. The move sequence is represented by a string, and the character moves[i] represents its ith move. Valid moves are R (right), L (left), U (up), ...
# coding: utf-8 u''' Helper functions to process Conda recipes. .. versionadded:: 0.18 ''' from __future__ import absolute_import, unicode_literals, print_function from ruamel.yaml import YAML from ruamel.yaml.constructor import DuplicateKeyError import pydash as _py def find_requirements(recipe_obj, package_name=...
import matplotlib matplotlib.use('agg') import matplotlib.pyplot as plt import numpy as np import sys sys.path.append("/Users/jasonkhadka/Documents/git/plantdev") sys.path.append('/home/jkhadka/plantdev') sys.path.append('/home/jkhadka/plantdev/python_quadedge') sys.path.append('/home/jkhadka/transferdata/scripts/strai...
import re, os from bson import ObjectId from datetime import datetime from mongoengine import signals, ValidationError from flask import url_for, render_template, flash, request, redirect from flask_login import current_user, logout_user from cerberus import Validator from werkzeug.security import check_password_hash f...
from flask import Flask, request, send_from_directory import json, os from werkzeug import secure_filename app = Flask(__name__) UPLOAD_FOLDER = '/tmp' @app.route("/") def hello(): return "Hello World!" @app.route("/todos/<udid>", methods=['GET', 'POST']) def todos(udid): print udid print request.form ...
# -*- coding: utf-8 -*- # Generated by Django 1.11.1 on 2017-05-20 11:44 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='Email'...
import os import pathlib description = "Create a React project using create-react-app utility" def new_project(where: pathlib.Path): print("Creating new React project") os.system(f"create-react-app {str(where)}")
sI = 45 mI = 100 bI = 455 eI = 0 spI = -23 sS = "Rubber baby buggy bumpers" mS = "Experience is simply the name we give our mistakes" bS = "Tell me and I forget. Teach me and I remember. Involve me and I learn." eS = "" aL = [1,7,4,21] mL = [3,5,7,34,3,2,113,65,8,89] lL = [4,34,22,68,9,13,3,5,7,9,2,12,45,923] eL = [] s...
# encoding: utf-8 from django.conf.urls import patterns, url import rd.views urlpatterns = patterns('', url(r'^excel/main/$', rd.views.excel_upload), url(r'^update_urls/$', rd.views.update_urls), )
from __future__ import division from builtins import object import numpy as np from sporco.dictlrn import cbpdndl class TestSet01(object): def setup_method(self, method): N = 16 Nd = 5 M = 4 K = 3 np.random.seed(12345) self.D0 = np.random.randn(Nd, Nd, M) ...
# IMPORTING CONFIGURATIONS import yaml try: with open('config.yaml', 'r') as configfile: cfg = yaml.load(configfile) except: with open('../config.yaml', 'r') as configfile: cfg = yaml.load(configfile) def placeholder(): pass ## EXAMPLE - SENTIMENT ANALYSIS from vaderSentiment.vaderSenti...
# Accepted # Python 3 m, n = input().split() m, n = int(m), int(n) x, y = m//2, n//2 if not (m&1) and not(n&1): print(x*y) elif (m&1) and (n&1): print((x*y)+x+y+1) else: print((x*y)+y) if m&1 else print((x*y)+x)
class TreeNode: def __init__(self, x): self.val = x self.left = None self.right = None from typing import List class Solution: def levelOrderBottom(self, root: TreeNode) -> List[List[int]]: if not root: return [] res = [] queue = [root] while queue: ...
# -*- coding: utf-8 -*- #!/usr/bin/env python """* @module jscribe.core.docgenerator @author Rafał Łużyński """ import json import importlib from jscribe.utils.file import discover_files from jscribe.conf import settings from jscribe.core.docstringparser import DocStringParser from jscribe.core.htmldocgenerator impo...
import pandas as pd import numpy as np import cv2 word_infos=[] dict={} f = open('Input.txt','r') for line in f: dict={"boundingBox":line.strip().split('\'')[3], "text":line.strip().split('\'')[7]} word_infos.append(dict) #Convert word_infos dictionary to Dataframe and converts boundaries to 4 ind...
from openerp import _, models, fields class SchoolTrainingFinancialConcept(models.Model): """Financial Concept""" _name = 'school.training.financial.concept' _description = 'Financial Concept' name = fields.Char(_('Name'), size=64, required=True) property_account_expense = fields.Many2one( ...
from tkinter import Tk, Radiobutton, Button, Label, StringVar, IntVar, Entry class TipCalculator(): def __init__(self): window = Tk() window.title("Tip Calculator App") window.configure(background="sky blue") window.geometry("375x250") window.resizable(width=False, height=Fa...
''' This script - Loads the pre-trained model from the checkpoint path passed through the argsparser - Predicts and prints the top 5 probabilities and the corresponding label values ''' # import as required import sys import os import json import argparse import numpy as np from collections import OrderedDict im...
# Copyright (c) Jeremías Casteglione <jrmsdev@gmail.com> # See LICENSE file. from _sadm.utils import builddir from .configure import getInfo __all__ = ['build'] def build(env): dn = env.dist() + '.' for opt in env.settings['sync']: if not opt.startswith(dn): continue inf = getInfo(env.settings, opt) _syn...
import pygame from pygame.sprite import Sprite #Class representing a ship class Ship(Sprite): #init ship with starting position def __init__(self, game): super().__init__() self.screen = game.screen self.screen_rect = game.screen.get_rect() self.settings = game.settings ...
from selenium import webdriver class FindElemetBy_CSS_Advance(): def test(self): baseUrl = "https://letskodeit.teachable.com/pages/practice" driver = webdriver.Firefox() driver.get(baseUrl) # finding element using css selector by tag with particular class which ending displayed-cl...
def longestBalancedString( string ): idxsStack = [-1] maxLength = 0 for i in range(len(string)): char = string[i] if char == '(': idxsStack.append(i) else: idxsStack.pop() if len(idxsStack) == 0: idxsStack.append(i) else...
#/usr/bin/env python # -*- coding: utf-8 -*- import numpy as np def radix_sort(numbers): """ :param numbers: List[int] :return: List[int] """ length = len(numbers) for i in range(2): counting_list = [[] for i in range(10)] for j in range(length): counting_list[int(n...
a) a = 3 def f(y): global a a = 9 return 2*y + a print(a) print('\nAntwoord is B') b) x = 1 y = 4 def fun(): x = 2 global y y = 3 print(y, end = ' ') fun() print(y, end = ' ') print('\nAntwoord is D') c) x = 2 y = 5 def fun(): y = 3 global x x = 1 print(x*y, end = ' ')...
import operator f=open("B-large.in","r") T=f.readline() T=int(T) fo=open("output.txt","w") cnt=1 def flip_subarray(lst): #flip 1--->-1 and -1--->1 for i in range(len(lst)): if lst[i]==0: lst[i]=1 else: lst[i]=0 return lst while T>=cnt: N=f.readline().replace('\n','') num_lst=[] print N,type(N),l...
from robocup_knowledge import knowledge_loader common = knowledge_loader.load_knowledge("common") operator_name = "john" starting_point = "initial_pose" waypoint_door = {'id': 'entry_door', 'radius': 0.5} waypoint_livingroom = {'id': 'livingroom', 'radius': 0.5}
#!/usr/bin/env python2 import time from params import * from utils import clear_topic, set_topic import sys from Producer import Stream """ if CLEAR_PRE_PROCESS_TOPICS: # Clear raw topic clear_topic(TOPIC) print("DONE CLEANING") # set partitions for frame topic set_topic(TOPIC, SET_PARTITIONS) # Wait time....
import csv from datetime import date, timedelta from matplotlib.finance import quotes_historical_yahoo_ochl # retrieve symbol lists markets = ['amex','nasdaq','nyse','otcbb'] symbols = [] for m in markets: fname = 'symbols-' + m + '-unique.txt' with open(fname, 'r') as f: symbols += f.read().splitlines...
"""Utilities for model builder or input size.""" import efficientnet_builder from condconv import efficientnet_condconv_builder from edgetpu import efficientnet_edgetpu_builder from lite import efficientnet_lite_builder from tpu import efficientnet_tpu_builder def get_model_builder(model_name): """Get the model_b...
import unittest import n_gram class TestFunctions(unittest.TestCase): def test_witten_bell(self): bigram_count = {('Tottori', 'is'):2, ('Tottori', 'city'):1} self.assertEqual(n_gram.witten_bell_weights(bigram_count)['Tottori'], 0.6) def test_n_gram(self): self.assertEqual(n_gram.n_gr...
#! /usr/bin/python # -*- coding: utf-8 -*- import sys from datetime import datetime from pymongo import MongoClient import subprocess import json import random import imp from scipy import spatial date_begin = '2018-10-14' day_range = 7 date_end = '2018-10-08' BEGIN = datetime.strptime(date_begin,('%Y-%m-%d')).date(...
import sys import random def get_ratings(): """Get restaurant ratings from file. file_name: text file which contents names of restaurants and its ratings """ filename = sys.argv[1] openfile = open(filename) ratings = {} # split line into lists for line in openfile: #unpack...
# split train to trainminusval and val (500) import csv import os, random train_ann_path = '/data/xiaobing.wang/xiangyu.zhu/FashionAI/data/train/Annotations/train.csv' output_dir = '/data/xiaobing.wang/xiangyu.zhu/FashionAI/data/train/Annotations/' val_num = 500 info = [] anns = [] with open(train_ann_path,...
# -*- coding: utf-8 -*- """ ██████╗ ███████╗███╗ ██╗███████╗████████╗██╗ ██████╗ ██████╗██╗████████╗██╗ ██╗ ██╔════╝ ██╔════╝████╗ ██║██╔════╝╚══██╔══╝██║██╔════╝ ██╔════╝██║╚══██╔══╝╚██╗ ██╔╝ ██║ ███╗█████╗ ██╔██╗ ██║█████╗ ██║ ██║██║ ██║ ██║ ██║ ╚████╔╝ ██║ ██║██╔══╝ ██║╚██╗█...
# -*- coding: utf-8 -*- # Define here the models for your scraped items # # See documentation in: # https://doc.scrapy.org/en/latest/topics/items.html import scrapy # class ProjectItem(scrapy.Item): # # define the fields for your item here like: # # name = scrapy.Field() # pass class ProjectItem(scrapy....
#!/usr/bin/env python """Base test classes for API handlers tests.""" import functools from typing import Type from grr_response_core.lib.rdfvalues import structs as rdf_structs from grr_response_proto import tests_pb2 from grr_response_server.gui import api_call_context # This import guarantees that all API-related R...
import unittest from crawlers.politeh_crawler import PolitehCrawler class PolitehCrawlerUnitTests(unittest.TestCase): def test_correct_theme(self): self.assertEquals(PolitehCrawler.standardize_theme("Достижения"), "Достижения студентов") def test_theme_not_in_list(self): self.assertEquals(Pol...
from django.shortcuts import render,redirect,get_object_or_404 from django.http import HttpResponse, HttpResponseRedirect, Http404 from .models import Post from .forms import PostCreateForm, UserLoginForm, UserRegistrationForm, PostEditForm from django.contrib.auth import authenticate, login, logout from django.urls im...
# -*- coding: utf-8 -*- #--------------------------------------------------------------------------- # Copyright 2018 VMware, Inc. All rights reserved. # AUTO GENERATED FILE -- DO NOT MODIFY! # # vAPI stub file for package com.vmware.nsx_policy.infra. #-----------------------------------------------------------------...
#Author: Zach Gee #Date: 11/12/2020 #Description: Create AddThreeGame class that allows two players to play a game in which they alternately choose numbers from 1-9. They may not choose a number that has already been selected by either player. If at any point exactly three of the player's numbers sum to 15, then that p...
from flask import Flask from . import db from . import urls def create_app(test_config=None): app = Flask(__name__, instance_relative_config=True) if test_config: app.config.from_mapping(test_config) # set up application db.client.init_db(app) app.register_blueprint(urls.bp) return ...
#!/usr/bin/env python3 # c-basic-offset: 4; tab-width: 8; indent-tabs-mode: nil # vi: set shiftwidth=4 tabstop=8 expandtab: # :indentSize=4:tabSize=8:noTabs=true: # # SPDX-License-Identifier: GPL-3.0-or-later """ Programa que crea listas dinamicamente que ingresa el usuario Hacer un programa que me llene una matriz nX...
""" Module with functions to process raw data into classifiable form. This code uses the Template method design pattern. The AbstractDataProcessor class has a method `process` which is an example of an abstract template method definition. """ from abc import ABC, abstractmethod from typing import Tuple import pandas ...