text
stringlengths
8
6.05M
'''Test ORM ''' from flask.ext.sqlalchemy import SQLAlchemy from news.models import NewsArticle @pytest.fixture(scope='function') def db(app): db = SQLALchemy(app) return db def test_create_tables(db): db.create_all() assert True db.drop_all()
# -*- coding: utf-8 -*- """ Least square fit using trained stress-strain GPR metamodel for the Holzapfel model """ import matplotlib.pyplot as plt import os import sys import numpy as np import pandas as pd import pickle import csv import torch import torch.nn as nn from torch.autograd import Variable import torch.nn...
def max_char(string1): ASCII=256 L=len(string1) count=[0]*256 for i in string1: count[ord(i)]=count[ord(i)]+1 max=0 c='' for i in string1: if(count[ord(i)])>max: max=count[ord(i)] c=i print "The max character is",c ," occuring...
# BASIC GOAL Imagine that your friend is a cashier, but has a hard time counting back change to customers. Create a program that allows him to input a certain amount of change, and then print how how many quarters, dimes, nickels, and pennies are needed to make up the amount needed. # # For example, if he inputs 1.47, ...
import json import boto3 from elasticsearch import Elasticsearch, RequestsHttpConnection from requests_aws4auth import AWS4Auth TABLE_NAME = 'yelp-restaurants' SAMPLE_N = '5' host = 'https://search-cloud-elastic-search-ybmh47fjqd7qokijii7kfebh74.us-east-1.es.amazonaws.com' queue_url = 'https://sqs.us-east-1.amazonaws.c...
from enum import Enum from random import random from pydantic import BaseModel, Field from quart import Quart, abort, jsonify, request from quart.views import MethodView from spectree import Response, SpecTree app = Quart(__name__) spec = SpecTree("quart") class Query(BaseModel): text: str = "default query str...
import pymongo from random import randint def save_results(identifier, clusters, set_to_plot, alive_indexes, samples_to_analyze, pids_array): myclient = pymongo.MongoClient("mongodb://localhost:27017/") mydb = myclient["results"] mycol = mydb["elements"] element_to_insert = {"ident":identi...
from django.db import models class student(models.Model): first_name=models.CharField(max_length=20) last_name=models.CharField(max_length=30) contact=models.IntegerField() email=models.EmailField(max_length=50) age=models.IntegerField()
import sys import math def graham_scan(points): """Implementation of the Graham Scan Algorithm""" start_vertex, start_index = find_lowest(points) if points[0] != start_vertex: points[0], points[start_index] = points[start_index], points[0] sorted_points = populate_list(points, start_index) return_stack = sorte...
# Copyright (c) 2013, Indictrans and contributors # For license information, please see license.txt from __future__ import unicode_literals import frappe from frappe import _ def execute(filters=None): columns, data = [], [] columns = get_columns() data = get_data(filters) return columns, data def get_data(fil...
# JTSK-350112 # appropiparam.py # Taiyr Begeyev # t.begeyev@jacobs-university.de from graphics import * from random import randrange from sys import * def main(): print("Enter the length of the window") d = int(input()) if d > 1000: print("Window size shouldn't exceed 1000") sys.exit() ...
# Copyright 2020 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). from __future__ import annotations import os from abc import ABC from dataclasses import dataclass from typing import ClassVar, Iterable, Mapping, Optional, Sequence, Tuple from pants.cor...
import sys def floyd_warshall(): global matrix, N for k in range(N): for i in range(N): for j in range(N): if matrix[i][j] > matrix[i][k] + matrix[k][j]: matrix[i][j] = matrix[i][k] + matrix[k][j] N, M = map(int, raw_input().split()) ...
#Create an application to convert Dollar to Rupees in python tkinter from tkinter import * from tkinter import messagebox def convert(): rupee = data.get()*77 messagebox.showinfo('Converted---','the Rupee is:'+str(rupee)) window =Tk() window.title("Frame window") window.geometry('500x200') frame1=F...
class Queue(): def __init__(self): self.items = [] def enqueue(self, item): self.items.insert(0, item) def dequeue(self): return self.items.pop() def isEmpty(self): return self.items == [] def size(self): return len(self.items) if __name__ == "__main__": queue = Queue() print queue.isEmpty() ...
# something else import csv from sqlmethods import PrioriDataDB db_methods = PrioriDataDB() class Csv_helper(): def readFile(self, filename): with open(filename, 'r') as csvfile: csvfile.readline() reader = csv.reader(csvfile) names_ids = [] for item in read...
#Created on July 23, 2015 #@author: rspies # Lynker Technologies # Python 2.7 # Description: parse through a csv file with date and variable and generate a # formatted datacard for chps import. Note: script does not check for missing # time steps import os import datetime import collections maindir = os.getcwd() os....
# KVM-based Discoverable Cloudlet (KD-Cloudlet) # Copyright (c) 2015 Carnegie Mellon University. # All Rights Reserved. # # THIS SOFTWARE IS PROVIDED "AS IS," WITH NO WARRANTIES WHATSOEVER. CARNEGIE MELLON UNIVERSITY EXPRESSLY DISCLAIMS TO THE FULLEST EXTENT PERMITTEDBY LAW ALL EXPRESS, IMPLIED, AND STATUTORY WARRANT...
#00 01 02 03 04 05 06 07 #10 11 12 13 14 15 16 17 #20 21 22 23 24 25 26 27 def isValid(board,x,y): if(x>-1 and x<5 and y>-1 and y<5 and board[x][y]==-1): return True else: return False def solve(): board= [[-1 for i in range(8)]for i in range(8)] board[0][0] = 0 moveX = [1,2,-1,-2...
def join_batman_network(network_name = 'squids_network', ap_mac = '02:12:34:56:78:9A', channel = '1'): '''Create a BATMAN network using Raspbian. ARGS: @network_name -- The name of the network you would like to create @ap_mac -- The MAC address to assign the Access Point @channel -- The channe...
import cv2 import numpy as np import face_recognition # STEP 1 : Loading the images... imgNM = face_recognition.load_image_file('ImagesBasic/NM.jpg') imgNM = cv2.cvtColor(imgNM, cv2.COLOR_BGR2RGB) imgTest = face_recognition.load_image_file('ImagesBasic/AB.jpg') imgTest = cv2.cvtColor(imgTest, cv2.COLOR_BGR2RGB) # ST...
import matplotlib.pyplot as plt from DataSet.iris import learn_iris from LogisticRegression import LogisticRegression # 独自ロジスティック回帰のテスト lr = LogisticRegression(n_iter=15,eta=0.01,random_state=1) # 学習させる learn_iris(classifier=lr, title='LogisticRegression') # コスト量の遷移グラフ plt.plot(range(1, len(lr.cost_)+1), lr.cost_, ...
import sys sys.path.append('../500_common') import lib_taisei dirname = "kyoto01_kuronet" lib_taisei.main(dirname)
def count_letters(word,letter): """ Count letter in a word :param word: input word :param letter: input letter :return: """ count = 0 for i in word: if i == letter: count += 1 return (count) print(count_letters("banana", "n"))
import time import numpy as np import pandas as pd import csv import itertools from sklearn.svm import SVC from sklearn.metrics import mean_squared_error, r2_score from sklearn.preprocessing import StandardScaler from sklearn.metrics.classification import accuracy_score,precision_score from sklearn.model_selection imp...
from queue import PriorityQueue class Graph: def __init__(self, vertices): self.v = vertices self.edges = [[-1 for i in range(vertices)] for j in range(vertices)] self.visited = [] def add_edge(self, u, v, weight): self.edges[u][v] = weight self.ed...
# Check if a sudoku board is valid testBoard = """ 1 3 7 2 6 4 5 9 8 5 9 2 8 7 3 4 6 1 8 4 6 5 1 9 7 2 3 2 6 3 7 9 5 8 1 4 4 7 5 1 8 6 2 3 9 9 8 1 4 3 2 6 7 5 6 2 9 3 4 8 1 5 7 7 5 8 9 2 1 3 4 6 3 1 4 6 5 7 9 8 2 """ def parse_board(tb): tb = tb.rstrip("\n").lstrip("\n") board = [] rows = tb.split("\...
# stats from statsd import StatsClient # vibe from vibepy.class_postgres import PostgresManager from vibepy import read_config # logging import logging import graypy # local from exchange_callback import ExchangeCallback from rabbit_consumer import RabbitConsumerProc, RabbitConsumerThread class AbstractBot(object)...
__author__ = 'Justin' from math import ceil tuple = ['1',[[1,2,3,4],[1,1,1,1],[2,2,2,2]]] paths = tuple[1] finalpaths = [] for path in paths: if(not(path in finalpaths)): finalpaths.append(path) paths = finalpaths print(paths) finalpaths = [] for path in paths: for j in range(0,paths.index(path)): ...
from rest_framework.permissions import IsAuthenticated from rest_framework.views import APIView from rest_framework import serializers from rest_framework.response import Response from rest_framework import status from .services import * from .permissions import * from utils.serializer_validator import validate_serial...
""" Robotritons in-use module for gps communication. Based on tbe Emlid GPS.py example. Purpose: Define classes to handle communications with the Ublox NEO-M8N Standard Precision GNSS Module and methods to handle data retrieval. Requirements: The python modules copy, Queue, spidev, math, struct, navio.util, and one o...
import os import json path = f"chest_xray" path = "state-farm-distracted-driver-detection/train" path="dogsvscats/train" db = {"path":path, "lum":-1,"std":-1,"lummin":-1,"lummax":-1, "count":0, "data":[] } id = 0 def scan(path): global id items = os.listdir(path) for item in items: if os.path.isdi...
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). from __future__ import annotations import dataclasses import logging from typing import Iterable, Mapping, Sequence from pants.base.build_environment import get_buildroot from pants.base...
import argparse import os import shutil from zipfile import ZipFile parser = argparse.ArgumentParser(description="zip files with the same prefix recursively") parser.add_argument('to_exclude', type=str, help='The type to be excluded') parser.add_argument('home', type=str, help='Home of folders') parser.add_argument('...
__author__ = 'martslaaf' import numpy as np from random import shuffle from wavelets import Morlet etta = 0.01 def from_signal_freq(signal, nyq_freq): fourier = abs(np.fft.fft(signal)) positive = fourier[:int(fourier.shape[-1]/2)] needed = sum(list(positive)) * 0.95 maximum = np.argmax(positive) ...
import os from flask_wtf import Form from wtforms import StringField, PasswordField, SelectField, BooleanField from wtforms.validators import DataRequired, Length, StopValidation class BaseForm(Form): pass def is_cf_enabled(form, field): if not form.setup_cf.data: # clear out processing errors ...
def merge_testcase_special(string): string = string.replace(' ','') if len(string) == 0: return('') a_raw = string.split(',') tempt = '' tempt_t = '' for i in a_raw: tempt = i.split('~') print(tempt) if tempt[0] == tempt[1]: tempt_t = temp...
from src.main.model.model import Config, Parameters from src.main.dataset.dataset import Dataset import matplotlib.pyplot as plt import numpy as np import tensorflow as tf from sklearn import datasets from src.main.model.classification.kernelsvm import SVM # model configurations config = Config(feature_num=2, batch_s...
""" Author : Bastien RATAT Analyzing CAC40 30 best stocks on Yahoo Finance """ import re import pandas as pd from matplotlib import pyplot as plt import seaborn as sns import os import datetime cwd = os.getcwd() # C:\Users\Bastien\Desktop\Python\data_scrapping _, file_extension = os.path.splitext( 'C:/Users/Bas...
from SignalGenerationPackage.SignalData import SignalData class EdgeSignalData(SignalData): def __init__(self): super().__init__() self.StartTime = 0 self.AccelerationTime = 0 self.PlateauTime = 0 self.DecelerationTime = 0 self.EndTime = 0 self.WholePeriod...
# -*- coding: utf-8 -*- """ Created on Tue Nov 21 01:31:45 2017 @author: Rafal """ from collections import Counter import pandas as pd def extract_mdb_to_pd(collection): # Get data from mongodb and convert into dataframe col = collection.find({}) return pd.DataFrame(list(col)) def get_frequencies(df, ...
"""Test the analog.utils module.""" from __future__ import (absolute_import, division, print_function, unicode_literals) from collections import Counter import os import tempfile import textwrap from analog import utils def test_analog_argument_parser(): """Analog uses a custom argumentpa...
from django.urls import path from .views import ( PostListView, PostDetailView, PostCreateView, PostUpdateView, PostDeleteView, UserPostListView ) from . import views urlpatterns = [ path('', PostListView.as_view(), name='blog-home'), path('user/<str:username>', UserPostListView.as_view...
import re def valid_email(email): """Checks that email includes '@' and '.'. Args: email: String of representation of an email address. Returns: The email address string if it matches ('True'), or 'None' if no match. """ return re.match(r"(^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\...
from PyQt4.QtGui import * class MyDialog(QDialog): def __init__(self): QDialog.__init__(self) label = QLabel() # 레이블에 텍스트 쓰기 #label.setText("Normal") label.setText("<a href='https://www.google.com'>www.google.com</a>") # Layout layout = QVBoxLayout() ...
import os from dataclasses import dataclass import matplotlib.pyplot as plt import torch import torch.nn as nn import torch.nn.functional as F import math from ray import tune from ray.tune.schedulers import ASHAScheduler from torch.utils.data import DataLoader from torch.utils.data.sampler import SubsetRandomSampler ...
# Generated by Django 3.0.7 on 2020-08-20 22:22 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('qualification', '0004_maindocument_documents'), ] operations = [ migrations.AddField( model_name='staffdocument', na...
import copy import json from typing import Dict, List, Type from django.db import connection from duckql import Query, Count, Constant, Operator from . import Schema class QueryWrapper: def __init__(self, query: str, base_model: Type, user=None): Query.update_forward_refs() Operator.update_forwa...
# -*- coding: utf-8 -*- # Generated by Django 1.11.6 on 2017-10-25 20:39 from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('API', '0001_initial'), ] operations = [ mi...
#!/usr/bin/env python # coding: utf-8 import numpy as np from time import sleep from redis import Redis def range_generator(step=0.1): """ Simulates range readings from 4 sensors """ p = 0. phase = np.array([0, 0.5, 1, 1.5]) * np.pi center = 300 k = 200 while True: radii = center ...
from django.urls import path, include, re_path from shopify import views urlpatterns = [ re_path(r'order', views.WebHook.as_view()), ]
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Date : 2020-04-24 21:52:26 # @Author : Fallen (xdd043@qq.com) # @Link : https://github.com/fallencrasher/python-learning # @Version : $Id$ # 用户输入用户名密码性别 # 实例化对象 # 用户任意输入内容 : 不能用异常处理 # 如果输入的是属性名 打印属性值 # 如果输入的是方法名 调用fangfa # 如果输入的什么都不是 不做操作 class User:...
from django.db import models from tracking.settings import DEFAULT_IDENTIFIER_SHOP # Create your models here. class LinkShop(models.Model): key = models.CharField(max_length = 15, verbose_name = 'code', primary_key = True, default = DEFAULT_IDENTIFIER_SHOP) link = models.CharField(max_length = 300, verbos...
from selenium import webdriver driver = webdriver.Chrome() driver.get('https://web.whatsapp.com') name = input('Enter name of user / group : ') msg = input('Enter message : ') count = int(input('Enter count : ')) msgList = msg.split() input('Enter anything after scanning QR code') user = driver.find_element_by_xpa...
__author__ = 'nulysse' import csv import simplekml import os import ConfigParser import collections import sys from geopy.distance import great_circle line = collections.namedtuple('line', 'name lat_col_index lon_col_index color mark_time timestep') _CSV_Path = r'C:\Ascent\Development\A350-FFS\DEVELOPMENT\Tools\CSVT...
# I pledge my Honor that I have abided by the Stevens Honor System from math import sqrt global response_3 def intro(): try: print("\nThis program will allow you to perform either mathematical or string operations") print("For Mathematical Functions, Please Enter the Number 1") print("For ...
from flask import Flask, render_template, redirect, url_for, flash, abort, request, send_from_directory from flask_bootstrap import Bootstrap import os from datetime import datetime from os import listdir from os.path import isfile, join import xlsxwriter app = Flask(__name__) def create_directories(): """Adds a...
from maintenance import * print('*** Maintenance Mode ***')
# Generated by Django 3.1.4 on 2021-06-28 13:53 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('Car', '0005_auto_20210627_2013'), ] operations = [ migrations.AlterField( model_name='car_rent', name='status', ...
# -*- coding: utf-8 -*- # Generated by Django 1.11.4 on 2017-09-18 08:30 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('issue', '0001_initial'), ] operations = [ migrations.AddField( ...
import unittest from katas.kyu_6.persistent_bugger import persistence class PersistenceTestCase(unittest.TestCase): def test_equals(self): self.assertEqual(persistence(39), 3) def test_equals_2(self): self.assertEqual(persistence(4), 0) def test_equals_3(self): self.assertEqual(...
# Generated by Django 2.0 on 2018-03-16 05:52 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('stocks', '0001_initial'), ] operations = [ migrations.RemoveField( model_name='stock', name='price', ), ...
from rdflib.namespace import RDF from source.utils import id2uri, g_add_with_valid import csv import json def create_ttl(g, u, row): """ geneid: 10018 genename: BCL2L11 geneclaimname: BCL2L11 interactionclaimsource: PharmGKB interactiontypes: NULL sid: 103245522 cid: 5291 drugname: ...
from django.shortcuts import render from django.urls import reverse_lazy from django.views.generic import ListView, DetailView, CreateView, UpdateView, DeleteView from django.contrib.auth.mixins import PermissionRequiredMixin, UserPassesTestMixin from django.contrib.admin.views.decorators import staff_member_required f...
#!/usr/bin/env python3 import datetime import json import pathlib import fire import toml def main(chain_name, subdir='gaia', skip_sig_checks=True): if not skip_sig_checks: # idea is for request submitter to sign with account key raise Exception('not implemented!') genesis = dict() gene...
# Generated by Django 2.0.3 on 2018-03-13 07:24 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('stock', '0003_auto_20180313_0417'), ] operations = [ migrations.CreateModel( name='Pixel', ...
""" Запросить у пользователя 3 числа Вывести все числа Найти и вывести максимальное и минимальное число. Вывести числа по возрастаю и убыванию. """ pervoechislo = int(input("Введите 1 число\n")) vtoroechislo = int(input("Введите 2 число\n")) tretiechislo = int(input("Введите 2 число\n")) max = 0 max = int(max) m...
#!/usr/bin/env python3 # # A tool to test the effect (number of pgs, objects, bytes moved) of a # crushmap change. This is a wrapper around osdmaptool, hardly relying # on its --test-map-pgs-dump option to get the list of changed pgs. # Additionally it uses pg stats to calculate the numbers of objects # and bytes moved...
__all__ = ['zookeeper', 'mcpack'] import zookeeper import mcpack
#!/usr/bin/env python3 """ classify swiss german dialects """
#!/usr/bin/python """ Using the tau amino acid sequence from 5o3l, this script threads a sliding frame of 6 tau residues into the substrate of Htra1 protease 3nzi then runs a FastRelax. The aim is to determine the most favorable docking points along the tau chain based only on sequence. """ from os import make...
from torch.utils.data import Dataset, DataLoader class TrainSet(Dataset): def __init__(self, dataset): self.dataset = dataset def __getitem__(self, index): type1, type2, label = self.dataset[index] return type1, type2, label def __len__(self): return len(self.dat...
from piipod.utils.csp import * import pytest @pytest.fixture def events(): return [chr(97+i) for i in range(3)] @pytest.fixture def users(): return list(map(str, range(10))) def test_signupModel(users, events): """test that CSP accurately reflects signup relationships""" csp = SignupCSP(users, even...
#! /bin/env python3 # This script is used to load the output data from evaluation.py for guard and exit files # Further, it is used to truncate the data to the <t> top AS found within the file # The output files are further used to generate both the client_top and destination_top graphs import argparse import csv impo...
import os import re import requests import sys from lxml import etree import pandas as pd '''下面的URL是ajax加载的内容,用BeautifulSoup或Xpath直接获取从网站链接返回的HTML文件的数据的方式往往得不到,目前暂时机械的手动 复制链接''' urls = ['https://fe-api.zhaopin.com/c/i/sou?pageSize=60&cityId=530&workExperience=-1&education=-1&companyTy' 'pe=-1&employmentType=-1&...
from unittest import TestCase from mock import patch, Mock from app.core import file_operations as file import mock class FileOperationTestCase(TestCase): @patch("app.core.file_operations.get_os_directory") def test_get_json_file_path_from_data(self, os_dir): os_dir.return_value = "dir" self...
from django.contrib.auth.models import User, Group from api.models import Submission, Conference from rest_framework import serializers as ser from django_countries.fields import CountryField class UserSerializer(ser.HyperlinkedModelSerializer): class Meta: model = User fields = ('username', 'email...
import numpy as np import numpy.testing as npt import pandas as pd from stumpy import ( gpu_stump, _get_QT_kernel, _ignore_trivial_kernel, _calculate_squared_distance_kernel, _update_PI_kernel, ) from stumpy import core, _get_QT from numba import cuda import math import pytest THREADS_PER_BLOCK = 1...
def _partition(data): mid = int(len(data) // 2) return data[:mid], data[mid:] def _merge(left, right): result = [] left_idx = right_idx = 0 while True: if left[left_idx] < right[right_idx]: result.append(left[left_idx]) left_idx += 1 else: result....
from calc import add,div,name # print(calc.add(10,20)) # name 'calc' is not defined print(add(10,20)) print(div(10,20)) #print(sub(10,20))# name 'sub' is not defined print(name)
import requests, os, argparse, dotenv from dotenv import load_dotenv def create_bitlink(url_to_check, token): headers = {"Authorization" : "Bearer {}".format(token)} url = 'https://api-ssl.bitly.com/v4/bitlinks' body = { "long_url": url_to_check } response = requests.post(url, headers=headers, js...
import json,httplib,sys username = sys.argv[1] if sys.argv[2] = "final" pushmsg = "The previous player skipped their turn. It is your turn to make a whisper!" else if sys.argv[2] = "warn" pushmsg = "Hurry up! Your turn expires in 1 hour!" connection = httplib.HTTPSConnection('api.parse.com', 443) connection....
from django import forms from .models import Document, Item from django.forms.extras import SelectDateWidget from datetime import date from django.views.generic.edit import CreateView class ItemForm(forms.ModelForm): class Meta: model = Item fields = ['name', 'quantity', 'unit_of_measurement', 'pri...
from __future__ import division import numpy as np import cv2 as cv from matplotlib import pyplot as plt from os.path import join from os import listdir class Hsv: def __init__(self, filename, path=None): if path: print('fname in hsv ', join(path, filename)) self.img = cv.imread(join(path, filename)) e...
import matplotlib.pyplot as plt def noah_scatterplot(noah_dataset): FF_data = noah_dataset[noah_dataset.pitch_type == 'FF'] CH_data = noah_dataset[noah_dataset.pitch_type == 'CH'] CU_data = noah_dataset[noah_dataset.pitch_type == 'CU'] fig = plt.figure() ax1 = fig.add_subplot(111) ax2 = fig.a...
import os input_path = os.path.join(os.path.dirname(__file__), 'input.txt') with open(input_path) as file: original_polymer = file.read() def react(polymer): reactions = True while reactions: reactions = False for lowercase, uppercase in zip(set(x.lower() for x in polymer), set(x.upper(...
from googletrans import Translator sentence=str(input('Say..............')) translator=Translator() translated_sentence=translator.translate(sentence,src='en',dest='bn') print(translated_sentence.text)
"""Module containing all SQLalchemy Models.""" from . import recipient_alias, sender_alias # noqa
#This is python comment '''And this is python multi line comment'''
class Solution: def singleNumber(self, nums: List[int]) -> int: myhash = {} for i in range(0, len(nums)): if nums[i] in myhash: del myhash[nums[i]] else: myhash[nums[i]] = 1 key, = myhash return key
#import the required functions import pickle import numpy as np import argparse import sys import pylab import matplotlib.pyplot as plt """ KNOWN BUGS: -Certain files are 'unrecognized arguments' """ #Handles the arguments given in the console def parse_args(args): parser = argparse.ArgumentParser(descriptio...
# Copyright 2021 DAI Foundation # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing,...
# -*- coding: utf-8 -*- # -------------------------------- # Name: text_normal.py # Author: devshilei@gmail.com # @Time 2020/7/14 下午4:16 # Description: # -------------------------------- import json def normal_dbc_to_sbc(text): """ description: 对文本进行标准化【全角字符替换为半角字符】 注:此...
numero = int(input("digite um numero: ")) calculo = numero%15 if calculo == 0 : print("FizzBuzz") else: print(numero)
n1 = int(input('Digite um nº:')) db = n1*2 tr = n1*3 rq = n1**2 print('O nº digitado é: {}'.format(n1)) print('O dobro é: {}, o triplo é: {} e a raiz quadrada é: {}'.format(db, tr, rq))
# This file is part of beets. # Copyright 2016, Adrian Sampson. # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, ...
#!/usr/bin/env python # -*- coding: utf-8 -*- import sys from tkinter import * from Node import * from Edge import * from Obstacle import * if len(sys.argv) < 2: exit(1) def str_to_bool(s): return s in ["true", "True", "1", "y", "Y", "yes", "Yes"] nodes = [] edges = [] obstacles = [] f = open(sys.argv[1]) ...
# 네이버 영화 데이터 수집 import requests from bs4 import BeautifulSoup raw = requests.get("https://movie.naver.com/movie/running/current.nhn#", headers = {"User-Agent":"Mozilla/5.0"}) html = BeautifulSoup(raw.text, 'html.parser') # 컨테이너 dl.lst_dsc movies = html.select("dl.lst_dsc") for m in movies: # ...
from django.db import models from aristo.models import * # Create your models here. class Package(models.Model): name = models.CharField(max_length=200,verbose_name="License's Name",null=True) description = models.CharField(max_length=200,verbose_name="Description",null=True) offered_days = models.IntegerF...
import requests response = requests.get('http://zhihu.com') print(response.text)