text stringlengths 38 1.54M |
|---|
from environs import Env
import superjob as sj
import headhunter as hh
from table import generate_language_table, prepare_language_table
def main():
languages = (
"JavaScript",
"Python",
"Java",
"TypeScript",
"C#",
"PHP",
"C++",
"C",
"Ruby"... |
# Generated by Django 3.0.3 on 2020-02-24 02:11
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Articulo',
fields=[
('id', models.AutoField... |
#coding:utf8
import json
from app.share.constants import *
from dispatcher import GameServiceHandle
from firefly.server.globalobject import masterServiceHandle, GlobalObject
@GameServiceHandle(COMMAND_TEST)
def testMethod(dynamicId, request):
'''
for test purpose, always return E_OK and a message in data
... |
import sqlite3
conn = sqlite3.connect('6.db')
c = conn.cursor()
#c.execute("""CREATE TABLE name_and_age(
# first text,
# age integer
#
#
# )""")
#c.execute("INSERT INTO name_and_age VALUES ('Sharon','13')")
c.execute("SELECT * FROM name_and_age WHERE first='Sharon'")
print(c.fetchall())
conn.com... |
# run.py
# from the app package __init__.py
from app import create_app, db
# from app.auth.models import User
# My home page is at blog component
if __name__ == '__main__':
flask_app = create_app('dev')
with flask_app.app_context():
db.create_all()
flask_app.run() |
import sys
import numpy as np
import random
import matplotlib as mpl
import matplotlib.pyplot as plt
from scipy.optimize import curve_fit
# This program takes in input files of diffrate/time and the integrated rate/energy threshold
# and samples multiple neutrino start times, which are saved in a histogram.
# Read na... |
personInfo = {
"name": "์ด์ฒ ์",
"birth": "1990๋
3์ 18์ผ",
"address": "๋ถ์ฐ ๋ถ์ฐ์ง๊ตฌ ์ค์๋๋ก 668",
"tel": "010-1234-5678"
}
name = personInfo["name"]
print(name) |
m1 = int(input().split()[0])
m2 = int(input().split()[0])
if m2-m1==1:
print("1")
else:
print("0") |
# -*- coding: utf-8 -*-
__author__ = 'Chunyou<snowtigersoft@126.com>'
import os
import codecs
import json
from datetime import datetime
from .logger import Logger
class FileLogger(Logger):
"""
A file based CTP logger.
"""
def __init__(self, folder, append=True, in_memory_records=1000, datetime_forma... |
from pprint import pprint
from apps.chrome_driver import ChromeDriver
from apps.read_excel import ReadExcel
from apps.write_excel import WriteExcel
sample_read_excel_path = 'assets/sample.xlsx'
sample_read_excel_path = 'assets/20200807_TN_๋๋น์คํค๋ง_sample.xlsx'
sample_write_excel_path = 'assets/result.xlsx'
if __name__ ... |
from mpf.core.custom_code import CustomCode
import random
class Mystery(CustomCode):
def on_load(self):
self.info_log('Enabling')
self.machine.events.add_handler('cmd_get_mystery', self.get_mystery)
self.machine.events.add_handler('cmd_mystery_award_chainsaw_letter', self.on_award_chainsaw_... |
import ics.utils.sps.lamps.controllers.digitalLoggers as digitalLoggers
import ics.utils.sps.lamps.controllers.aten as aten |
from wtforms import Form, StringField, PasswordField, validators, IntegerField, SelectField
from wtforms.widgets import TextArea
from wtforms.fields import TextAreaField
class PlaceSelectionForm(Form):
row = IntegerField('Row', [validators.number_range(0)])
column = IntegerField('Column', [validators.number_ra... |
%% Test_hybridRocketThrustCalc.m
%
% Based on the driver script for AOE 4984: Booster Design, Assignment 4.
% That script is the implimentation of Example 16.4 from the textbook
% "Rocket Propulsion Elements 8th Edition", by Oscar Biblarz George P.
% Sutton. It models the performance of a hybrid rocket.
%
% This sc... |
from django.conf.urls import url
from django.urls import path
from . import views
urlpatterns = [
path('index/', views.home, name='home'),
#url(r'^$', index, name='index'),
path('search/', views.search, name='search'),
path('cart/', views.cart, name='cart'),
path('contact/', views.contact, name='con... |
from .empleado import Empleado
class Departamento:
def __init__ (self, nombre, telefono):
self.nombre = nombre
self.telefono = telefono
self.empleados = {}
self.supervisor = None
def __str__ (self):
cadena = f'''\n DEPARTAMENTO {self.nombre.upper ()} -- Telรฉfono del dep... |
import tkinter as tk
from tkinter import messagebox
import math
class Application(tk.Tk):
def __init__(self, master=None):
tk.Tk.__init__(self, master)
self.title("Triangle Hypotenuse Calculator")
self.create()
def create(self):
self.aLabel = tk.Label(self, text="A Value:").gri... |
from helpers import analytics, primes
analytics.monitor()
limit = 10**7
primesList = primes.primes(int(limit**0.5)+1)
def sf(n):
pcount,pf = 0,[]
for p in primesList:
if p*p > n: break
count = 0
while n%p==0:
n //= p
count += 1
if count > 0:
... |
from abc import ABC, abstractmethod
from collections import OrderedDict
import pandas as pd
import vcf
from intervaltree import Interval as TreeInterval
from intervaltree import IntervalTree
import io_plt
from call import Call, EventType
from interval import Interval
from interval_collection import IntervalCollection... |
#equality and inequality with strings
session = 'discrete structures'
print(session == 'discrete structures')
print(session != 'character building')
#using the .lower() function
place = 'New York'
print(place == 'new york')
print(place.lower() == 'new york')
print(place != 'Vegas')
#numerical tests
number = 9
print(n... |
import requests
import re
from bs4 import BeautifulSoup
import urllib
import pymssql
def hhh1(url):
r=requests.get(url,timeout=30)
r.encoding = r.apparent_encoding
return r.text
def hhh2(url,liebiao):
html=hhh1(url)
soup=BeautifulSoup(html,'html.parser')
name=soup.find_all('a',"ri... |
#Setting the environment
import os, sys, collections
os.environ['SPARK_HOME']="/Users/abhisheksingh29895/Desktop/programming/spark-1.6.0-bin-hadoop2.6"
sys.path.append("/Users/abhisheksingh29895/Desktop/programming/spark-1.6.0-bin-hadoop2.6/bin")
sys.path.append("/Users/abhisheksingh29895/anaconda/lib/python2.7/site-p... |
from microWebSrv.microWebSrv import MicroWebSrv
import json
# from time import sleep
from _thread import allocate_lock # ,start_new_thread
# C:\Users\yaniv\AppData\Local\Programs\Thonny\Lib\site-packages\thonny\plugins\micropython\api_stubs
from machine import Pin
routeHandlers = []
# ( "/test", "GET", _httpH... |
#############################################################
# Quarterly Performance Update Script using Naver Finance
#############################################################
# How to run
# ex> q_perf_update.py 2020.06
#
#
#############################################################
import pandas as pd
import ... |
import getopt
import sys
from mySock import client, close
from myUtil import login
# payloads
comment_payload = '650#{gli&&er}{"glit_id":<glit_id>,"user_id":<user_id>,"user_screen_name":"<screen_name>","id":-1,' \
'"content":"<content>","date":"2020-06-23T06:29:00.751Z"}## '
# params
GLIT_ID = ""
US... |
# heap Implementation
class MinHeap:
def __init__(self,arr=[]):
self.arr=arr
def insert(self,val):
self.arr.append(val)
pointer=len(self.arr)-1
parent_pointer=(pointer-1)//2
while(parent_pointer >=0 and self.arr[parent_pointer]>self.arr[pointer]):
self.arr[pa... |
#coding=utf-8
#@author:xiaolin
#@file:Ensemble_Pipeline.py
#@time:2016/9/1 16:27
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
from sklearn.datasets import make_classification
from sklearn.linear_model import LogisticRegression
from sklearn.ensemble import (RandomTreesEmbedding, Rand... |
#
# @lc app=leetcode.cn id=216 lang=python3
#
# [216] ็ปๅๆปๅ III
#
# @lc code=start
from typing import List
class Solution:
def combinationSum3(self, k: int, n: int) -> List[List[int]]:
nums = list(range(1, 10))
res = []
def helper(index: int, used: List[int], target: int):
if ... |
"""
define a simple logger
"""
import logging
from logging.handlers import TimedRotatingFileHandler
import sys
import requests
from requests.adapters import HTTPAdapter
import os
#the max retries for http connect
MAX_RETRIES=3
s = requests.Session()
s.mount('http://', HTTPAdapter(max_retries=MAX_RETRIES))
s.mount('ht... |
# coding: utf-8
import matplotlib.pyplot as plt
import csv
from itertools import islice
"""
This script is for gathering Thermal conductivity data of GaN 1750&3500 sample
and comparing with DFT result
"""
def plotTC(TCdt,DFTTCdt,OGRTCdt,grp, plotfolder): #Plotting TC data of each sample
#Plot each sample with ... |
from django.contrib import admin
from rank.models import VoteEvent,Individual
admin.site.register(VoteEvent)
admin.site.register(Individual)
|
from math import *
print(2)
print(2.097)
print(-2.097)
print(3 + 4.5)
print(3 - 4.5)
print(3 * 4.5)
print(3 * 4 + 5)
print(3 * (4 + 5))
print(10 % 3)
my_num = 5
print(str(my_num) + " my favorite number")
my_num = -5
print(abs(my_num))
print(pow(3, 2))
print(max(4, 6))
print(min(4, 6))
print(round(3.6))
print(floo... |
# 152. Maximum Product Subarray
class Solution:
def maxProduct(self, nums: List[int]) -> int:
pos_result = [0 for i in range(len(nums))]
neg_result = [0 for i in range(len(nums))]
if len(nums) == 0:
return 0
for i in range(len(nums)):
if i == 0:
... |
import subprocess as sub
import crypt
class UserExist(Exception):
def __str__(self):
return repr("User exist in the system.")
class UserNotExist(Exception):
def __str__(self):
return repr("User don't exist in the system.")
class GroupExist(Exception):
def __str__(self):
retu... |
import random
import datetime as d
def wish():
greetings = ['hey hai i am jeff ....!,i am here to help u out . by the way may i know ur name',
'hello i am jeff ..! how can i help you and tell me yor name !']
return random.choice(greetings)
def welcome(name):
time = d.datetime.now().hour
if time<12:
... |
from django.shortcuts import render
# Create your views here.
from django.http import HttpResponse
from django.views.decorators.csrf import csrf_exempt
from rest_framework.renderers import JSONRenderer
from rest_framework.parsers import JSONParser
from jisho.models import Definition
from jisho.serializers import Defin... |
# Define a function that transform the test dataset into desired format
def transform_test(test_set, pre_trained_d2v, use_infer=True):
'''
Compute question vectors based on indicator use_infer.
If True, then question vectors in test set will be inferred from pre-trained doc2vec object
If False, then tr... |
import numpy as np
def get_cropped_videos(video):
_, r, c, _ = video.shape
X = []
while len(X) < 5:
x = np.random.randint(0, c)
y = np.random.randint(0, r)
if y + 224 <= r and x + 224 <= c:
snippet = video[:, y:y+224, x:x+224, :]
X.append(snippet)
re... |
""" Kujira API is flask/websocket app for serving Ceph cluster data """
from flask import Flask
from flask_socketio import SocketIO
from kujira.blueprints import SERVER_BP, OSD_BP, POOL_BP, MON_BP, CLUSTER_BP
from kujira.rest.controllers import osds, pools, servers, clusters, mons
import eventlet
eventlet.monkey_patc... |
from yahoofinancials import YahooFinancials
import datetime
import smtplib
import json
# Just want to watch some major worldwide indexes
mutual_funds = ['^GSPC', '^DJI', '^IXIC', '^FTSE', '^N100', '^FCHI', '^GDAXI', '^N225', '^TWII', '^HSI']
mutual_funds = YahooFinancials(mutual_funds)
# Define dates for the hist... |
# -*- coding: utf-8 -*-
'''
Helper functions
'''
import flask.json as json
from sqlalchemy.sql import text
from consts import *
from hashlib import md5
def error_resp(code, resp=None):
'''Response from the Flask server
Args:
code (int): Error code number
resp (dict): Response data. Optional... |
import random
import copy
import time
from Exploitation import ShrinkingEncircling
from Exploitation import SpiralUpdating
from MPModel_ALBP import ALBP_Model
from WOA_ALBP import WOAforALBP
import DataGenerator
# Data
d_TaskTimeMin = [7, 1, 6, 8, 15, 11, 3, 12, 8, 14, 4, 8, 5, 21, 3, 8, 6, 3, 1, 4, 43, 13, 6, 25, 24,... |
from __future__ import print_function, unicode_literals
import os
import tempfile
import boto3
import json
import logging
from glob import glob
from shutil import copyfile
from libraries.aws_tools.s3_handler import S3Handler
from libraries.general_tools.file_utils import write_file, remove_tree
from libraries.door43_to... |
#!/usr/bin/env python
import sys
from time import sleep
from random import choice
class Game(object):
'''
A game class for 'Rock', 'Paper', 'Scissors'.
Will play a nominal amount of games, and then exit.
To start playing create an instance, game = Game().
Then simply start playing with game.... |
# Copyright 2020 Alexander Polishchuk
#
# 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 ... |
from django.contrib import admin
from .models import *
# Register your models here.
class EducationAdmin(admin.ModelAdmin):
empty_value_display = '-empty-'
admin.site.register(Education, EducationAdmin)
class StatusAdmin(admin.ModelAdmin):
empty_value_display = '-empty-'
admin.site.register(Status, StatusAdmi... |
#!python
"""
It turns out that 12 cm is the smallest length of wire that can be bent to form an integer sided right angle triangle in exactly one way, but there are many more examples.
12 cm: (3,4,5)
24 cm: (6,8,10)
30 cm: (5,12,13)
36 cm: (9,12,15)
40 cm: (8,15,17)
48 cm: (12,16,20)
In contrast, some lengths of wire... |
"""Math module is simple math module to test student ability to do simple math"""
def add(n_1, n_2):
return n_1 + n_2
def multiply(n_1, n_2):
return n_1 * n_2 |
inp = input().split()
n, m = int(inp[0]), int(inp[1])
mat = [[0] * m for i in range(n)]
#d = [[0] * m for i in range(n)]
for i in range(n):
inp = list(map(int, input().split()))
for j in range(m):
mat[i][j] = int(inp[j])
t = mat[0][0]
for i in range(1, m):
mat[0][i] += mat[0][i - 1]
for i in ran... |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import os, sys
from os import walk
import logging
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from PyQt4 import uic
from view.calculation_session_layout import CalculationSessionLayout
from view.field_session_layout import FieldSessionLayout
from view.comparation_s... |
import sqlalchemy
from sqlalchemy import orm
from .db_session import SqlAlchemyBase
class Chapter(SqlAlchemyBase):
__tablename__ = 'chapters'
id = sqlalchemy.Column(sqlalchemy.Integer,
primary_key=True, autoincrement=True)
num = sqlalchemy.Column(sqlalchemy.Integer)
title ... |
#!/usr/bin/python
import fnmatch
import argparse
import re
import sys
import os
import shutil
import pdb
from tools import line_yielder
parser = argparse.ArgumentParser(
description= "This program can recursively copy the header files "
+ "that are not in the target directory to the target directory "
+ "fr... |
"""This script uses de poker.py module and the Montecarlo methods to calculate
the probability of the different hands of poker.
"""
import poker
from tqdm import tqdm
hands = ['highest card', 'pair', 'two pair', 'three of a kind', 'straight',
'flush', 'full house', 'four of a kind', 'straight flush']
... |
from django import forms
from posts.models import Post
from groups.models import Group
class GroupForm(forms.ModelForm):
class Meta:
model = Group
fields = ('name','description')
|
s = input()
end = len(s)
n = 0
for i in range(len(s)):
n += (s[end - i - 1] == '1') << i
m = int(input())
ans = []
for i in range(m):
a = int(input())
if n % a == 0:
ans += [a]
if len(ans) == 0:
print("Nenhum")
else:
ans.sort()
print(*ans) |
import argparse
import os
from time import sleep
import gym
import numpy as np
import tensorflow as tf
from tqdm import tqdm
class PolicyNetwork(tf.keras.Model):
def __init__(self, output_size):
super().__init__()
self.dense1 = tf.keras.layers.Dense(units=20, activation="relu", input_shape=(4,))
... |
'''
@author: frank
'''
import sys
import inspect
class IPTableTarget(object):
def __ne__(self, other):
return not self.__eq__(other)
@staticmethod
def interpret(args):
return None
class AcceptTarget(IPTableTarget):
tag = 'ACCEPT'
def __eq__(self, other):
return i... |
# Vivek Keshore
# Problem link - http://www.spoj.com/problems/ACPC10A/
while True:
try:
inp = raw_input().split()
except EOFError:
break
x, y, z = int(inp[0]), int(inp[1]), int(inp[2])
if z - y != 0:
if z - y == y - x and z - y:
print 'AP', z + (z-y)
elif z... |
with open(".\Intermediate\Day 24\letter_names.txt") as letter_names:
names = letter_names.readlines()
formatted_names = []
for name in names:
formatted_name = name.strip("\n")
formatted_names.append(formatted_name)
for name in formatted_names:
with open(".\Intermediate\Day 24\starting_letter.txt", ... |
zmienna = 5 #ustalenie ลผe zmianna bฤdzie zwracaฤ wartoลฤ piฤ
tki (czy moลผna tutaj daฤ liczbฤ z kropkฤ
? czyli np. 5.8?)
calkowita = 7 #to samo co wyลผej, tylko tyczy siฤ jedynie liczb caลkowitych.
rzeczywista = 7.5 #przecinek to tutaj jest kropka.
rzeczywista = float(38) #zamiast sลowa rzeczywista mogฤ daฤ sลowo float i... |
import pandas as pd
import numpy as np
import torch
from torch.optim import lr_scheduler
import torch.optim as optim
from torch.autograd import Variable
import torch.nn as nn
from PIL import Image
from sklearn.model_selection import train_test_split
import torch.nn.functional as F
import torchvision.models as models
f... |
from .inputmanager import InputManager, keycodes, ClassContext, GlobalContext, input_manager
add_class_context = input_manager.AddClassContext
add_global_context = input_manager.AddGlobalContext
add_action_callback = input_manager.AddActionCallback |
from django.urls import path
from .import views
urlpatterns = [
path('adminpage/sendmail',views.test_email,name='test_email'),
]
|
from pyramid.view import view_config
@view_config(route_name='home', renderer='templates/mytemplate.pt')
def my_view(request):
return {'project':'json_serialize_demo'}
@view_config(route_name="custom_object", renderer="json")
def custom_object(request):
from objects import CustomObject
results = dict(
... |
#!/usr/bin/env python
# -*-coding: utf-8 -*-
"""
utils
~~~~~
Various utilities (not groovebox specific)
:copyright: (c) 2015 by Mek
:license: see LICENSE for more details.
"""
from datetime import datetime, date
import json
def subdict(d, keys):
"""Create a dictionary containing only `keys... |
import pymongo,random,time
db = pymongo.MongoClient(host='localhost', port=27017)['Falonie']
# collection = db['innotree_็งๅญๆ_filter_duplicates_crawled_result']
collection = db['innotree_ๆ็ฅๆ่ต_filter_duplicates_crawled_result']
collection_filter_duplicates = db['innotree_ๆ็ๆ_filter_duplicates']
for i, j in enumerate(col... |
import torch.nn as nn
import torch.nn.functional as F
import math
from torch.nn.init import kaiming_normal_, xavier_uniform_, constant_
from random import choice
from models.cnn import CNNEncoder
class RNN(nn.Module):
@staticmethod
def generate_params():
params = {}
params['unit_type'] = cho... |
#!/usr/bin/env python
"""
setup.py file for SWIG
"""
from setuptools import setup, Extension
import importlib
import subprocess
import sys
# Solve the chicken-and-egg problem of requiring packages *before* the
# script has been parsed.
for package in ['numpy', 'pkgconfig']:
# Don't try to install packages tha... |
import cv2
import imutils
import numpy as np
from .cv import CVUtils
from .gui import GUIUtils
from .trackbar import (
ColorThreshTrackbar,
GrayThreshTrackbar,
CannyTrackbar,
HoughCircleTrackbar,
HoughLineTrackbar
)
def do_hough_circle(img):
hough = HoughCircleTrackbar(img)
hough.show_image... |
import re
from tqdm import tqdm
import csv
import codecs
from helper import *
import hashlib
import json
from googletrans import Translator
translator = Translator()
translator = Translator(service_urls=[
'translate.google.com.tw',
])
filenamelist = getfilenamelist()
md5 = hashlib.md5()
for filename in fil... |
a=1
while True:
for x in range(1000):
for y in range(1000):
if not((x+2*y<a) or (x<a) or (y<a)):
break
else:
continue
break
else:
print(a)
a+=1
|
from __future__ import absolute_import
from __future__ import print_function
import collections
import math
import random
import gzip
import csv
import os.path
import numpy as np
from six.moves import xrange # pylint: disable=redefined-builtin
import tensorflow as tf
TEXTS = '/Users/remper/Downloads/bk2vec_input/en... |
from common.okfpgaservers.pulser.pulse_sequences.pulse_sequence import pulse_sequence
from RabiExcitation import rabi_excitation, rabi_excitation_no_offset
from BlueHeating import local_blue_heating
from EmptySequence import empty_sequence
from treedict import TreeDict
from labrad.units import WithUnit
class ramsey_de... |
import unittest
from user import User
class TestUser(unittest.TestCase):
'''
Test class that defines test cases for the user class behaviours.
Args:
unittest.TestCase: TestCase class that helps in creating test cases
'''
def setUp(self):
'''
Set up method to run be... |
'''@file data_reader.py
contains a reader class for data'''
from six.moves import configparser
from nabu.processing.processors import processor_factory
class DataReader(object):
'''the data reader class.
a reader for data. Data is not stored in tensorflow format
as was done in data.py. Data is returned... |
'''
Model Hypothesis: The value of a company without revenue from an approved drug is related
to the quality and number of it's clinical trials. So calculate a dollar value per trial for
each company. This assumption is more accurate as the drugs in development. Big companies with high
Market Cap (MC) are going after b... |
import numpy as np
from sklearn.cluster import AgglomerativeClustering
from util import spearman_rank_correlation_matrix, spearman_footrule_matrix, kendalltau_matrix
class Election(object):
def __init__(self, votes=None, num_clusters=2, region_ids=None, affinity=spearman_rank_correlation_matrix):
if votes is None:
... |
import numbers
import sys
class CalculatorError(Exception):
"""An exception class for Calculator
"""
class Calculator():
"""A terrible calculator.
"""
def add(self, a, b):
self._check_operand(a)
self._check_operand(b)
try:
return a + b
except TypeError:
... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2017-04-27 12:32
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.Create... |
# ex) ์จ๋ผ์ธ ๋์ ์ผํ๋ชฐ์ ๋์ ์ ๋ณด๋ฅผ ์คํฌ๋ํ
# yes24.co.kr > ๋ฒ ์คํธ > ๋์์ ์ ๋ชฉ, ์ ์, ์ ๊ฐ ์ถ์ถ
# ์น ๋ฌธ์ ์ ์ฅ์ ํ์ผ๋ช
์ 04yes24_best.html
# http://www.yes24.com/24/category/bestseller
from urllib.request import urlopen
import re
url = 'http://www.yes24.com/24/category/bestseller'
docs = urlopen(url)
encode = docs.info().get_content_ch... |
# -*- coding: utf-8 -*-
#
# $Id: Basic.py 4159 2012-06-20 00:34:40Z jhill $
#
# This file is part of the BCPy2000 framework, a Python framework for
# implementing modules that run on top of the BCI2000 <http://bci2000.org/>
# platform, for the purpose of realtime biosignal processing.
#
# Copyrig... |
l = float(input("Digite a largura do terreno: "))
h = float(input("Digite a altura do terreno: "))
valor = float(input("Digite o valor do metro quadrado: "))
area = float(l*h)
preco = float(area*valor)
print(f"Area do terreno: {area:.2f}")
print(f"Preco do terreno: {preco:.2f}")
|
# politician/models.py
# Brought to you by We Vote. Be good.
# -*- coding: UTF-8 -*-
import re
from datetime import datetime
import gender_guesser.detector as gender
from django.db import models
from django.db.models import Q
import wevote_functions.admin
from candidate.models import PROFILE_IMAGE_TYPE_TWITTER, PROF... |
""" An implementation of the MinHash LSH method that operates on Dask DataFrames.
To do: Convert DataFrame operations to Array operations. This would eliminate
looping and increase computation speed.
"""
from random import random
import pandas as pd
import dask
import dask.dataframe as dd
class MinHashLSH():
de... |
"""
in order of execution priority:
(i) matplotlibrc file
(ii) custom styles
(iii) manual RC parameter configuration
"""
#######################
### (i) matplotlibrc
# find the default local matplotlibrc file:
# (root)# find / -name "*matplotlibrc*" 2> /dev/null
# for example here: /usr/lib/python3.6/site-package... |
import re
def extrae(texto):
lista = []
try:
lista1 = re.findall('href=".+?"', texto)
lista2 = re.findall('src=".+?"', texto)
lista4 = re.findall('"https:.+?"', texto)
lista3 = re.findall('"http:.+?"', texto)
lista = lista1 + lista2 + lista3 + lista4
return list... |
import os
import sys
sys.path.append(os.path.dirname(os.path.dirname(os.path.realpath(__file__))))
from lib.core import utils
from modules import subdomain
from modules import probing
from modules import formatting
from modules import fingerprint
from modules import stoscan
from modules import screenshot
from modules ... |
from aiogram.dispatcher import FSMContext
from .question_text import create_question_text
from .results_calculator import PollResultsCalculator
async def receive_answer(ratio_choice, state: FSMContext):
data = await state.get_data()
character_a, character_b = data.get('characters_combinations')[data.get('cur... |
import sys
input = sys.stdin.readline
def find_parent(parent, x):
if parent[x] != x:
parent[x] = find_parent(parent, parent[x])
return parent[x]
def union(parent, a, b):
a = find_parent(parent, a)
b = find_parent(parent, b)
if a < b:
parent[b] = a
else:
parent[a] = b
... |
# Generated by Django 3.2.8 on 2021-10-29 15:55
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('home', '0018_absentdates_attendanceid'),
]
operations = [
migrations.AlterField(
model_name='absentdates',
name='dat... |
from __future__ import division
from baseagent import Agent
from collections import deque
from copy import deepcopy
import time
import numpy as np
import keras.backend as K
from keras.layers import Lambda, Input, merge, Layer
from keras.models import Model
from rl.core import Agent
from rl.policy import EpsGreedyQPoli... |
from rest_framework import status
from rest_framework.generics import get_object_or_404
from rest_framework.response import Response
from rest_framework.status import HTTP_200_OK
from river.models import Workflow, DONE
from river_admin.views import get, delete
from river_admin.views.serializers import StateDto, Workfl... |
file_path = r"/Users/Kota/Desktop/Python/python/10 Files and Exceptions/pi_digits.txt" # Absolute path
# r is used as a raw string in case the file path includes a \n to avoid taking it as a line break
with open(file_path) as file_object:
contents = file_object.read()
print(contents)
# Opens pi_digits.txt, reads,... |
'''
@name: tic tac toe with dynamic matrix, task completed for Luka Giorgobiani
@file: responsible for tictoc game logic
@AUTHOR: DATO BARBAKADZE
@begin date/time: Saturday August 22, year 2020 / 8.36pm
โโโโโโ โโโโโโ โโโโโโ โโโโโโ โโโโโโ โโโโโโ โโโโโโ โโโโโโ
โโโ โ โโโโ โโโโโโ โ โโโโโโโ โโ โโ โ โโโ โ โ... |
import scrapy
class NbggrItem(scrapy.Item):
title = scrapy.Field()
description = scrapy.Field()
date = scrapy.Field()
|
from django.shortcuts import render, reverse
from django.http import HttpResponseRedirect
from django.utils import timezone
from django.contrib.auth.decorators import login_required
from django.http import JsonResponse
from .models import Popups
from .forms import PopupForm
from banner.views import convertir_imagen_we... |
import atexit
import sys
import time
try:
import curses
except ImportError:
sys.exit('platform not supported')
import psutil
from psutil._common import bytes2human
# --- curses stuff
def tear_down():
win.keypad(0)
curses.nocbreak()
curses.echo()
curses.endwin()
win = curses.initscr()
atexit... |
from nltk.corpus import gutenberg
from nltk.tokenize import sent_tokenize
sample = gutenberg.raw("bible-kjv.txt")
tok = sent_tokenize(sample)
print(tok[5:15]) |
import pymongo
import numpy as np
mongo_uri = 'mongodb://localhost'
mongo_db = 'test'
collection_name = 'ssq_ac'
client = pymongo.MongoClient(mongo_uri) # ็ปๅฝmongo
db = client.test # ๆๅฎๆฐๆฎๅบ
collection = db.ssq_ac # ๆๅฎ้ๅ
try:
# tmp_date = []
# results = collection.find()
results = collection.find().sort('... |
import sublime, sublime_plugin
import json, webbrowser, time, os, sys
from aaweibosdk import APIClient, APIError
APP_KEY = '2596542044'
GET_CODE_URL = 'http://sublime.duapp.com/weibo/authorize_redirect.php'
CALLBACK_URL = 'http://sublime.duapp.com/weibo/callback.php'
ACCESS_TOKEN_FILE = os.path.join(os.getcwd(), 'acce... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.