index
int64
0
1,000k
blob_id
stringlengths
40
40
code
stringlengths
7
10.4M
988,500
26eb1553391bfe90209b54213935cb6e79445598
# -*- coding: utf-8 -*- from odoo import http # class Warehouse(http.Controller): # @http.route('/warehouse/warehouse/', auth='public') # def index(self, **kw): # return "Hello, world" # @http.route('/warehouse/warehouse/objects/', auth='public') # def list(self, **kw): # return http.r...
988,501
aefe32e5606bd8b0a2da3eeb3285c41067b7e801
# There are a total of n courses you have to take, labeled from 0 to n-1. # Some courses may have prerequisites, for example to take course 0 you have to first take course 1, which is expressed as a pair: [0,1] # Given the total number of courses and a list of prerequisite pairs, return the ordering of courses you shou...
988,502
cb8cfb1824fcc2d831f280397ca73f6aeabdf4a1
import turtle turtle = turtle.Turtle() for i in range(500): # 重复500次 turtle.forward(i) turtle.left(91)
988,503
2ee01e17fc812c4735ca7576e1ea3d6ea0016d62
#!/usr/bin/python import os import sys from monitor.wrapper import plc from monitor.database.info.model import * api = plc.cacheapi api.AuthCheck() # for each site, find total number of assigned slivers # find median, high, low, average site_list = [] for site in api.GetSites({'peer_id': None}): sl = api.GetSli...
988,504
fc28a2b93c60c6a08ee1fe2592d3137336bdc04d
# -*- coding: utf-8 -*- """ Some stuff to query and populate the database """ # python imports # import decimal # Scientific imports import numpy as np import pandas as pd from decimal import Decimal from decimal import getcontext # Astronomical imports from astroquery.simbad import Simbad from astropy.coordinates i...
988,505
64897eb349b4a09fba528c02ec369a95dc062fed
import pandas as pd import numpy as np import random import math from numpy import linalg as LA from sklearn.decomposition import FastICA import matplotlib.pyplot as plt from knn import Knn class IrisICA: def __init__(self, file_name): df = pd.read_csv(file_name) df['class'] = df['class'].apply(la...
988,506
077eb5b6f7104b157b804c682679a5974a58d717
# Generated by Django 2.0.5 on 2018-06-22 17:27 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('pdfanalyzer', '0016_auto_20180622_1925'), ] operations = [ migrations.RenameField( model_name='uploadfile', old_name...
988,507
d4246ad3f8de6a09798d025eade7629c034bce9f
""" Copyright (c) 2018-2019 Qualcomm Technologies, Inc. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted (subject to the limitations in the disclaimer below) provided that the following conditions are met: * Redistributions of source code must retain...
988,508
ccb142967088bdc85a1d1a99bb0c5a076954d290
# Copyright (C) 2015-2018 by Yuri Victorovich. All rights reserved. # This code is licensed under BSD license. ## This is the module that recomputes IP and UDP packet checksums import socket import struct import array def is_big_endian(): return struct.pack("H",1) == "\x00\x01" # Checksums are specified in rfc...
988,509
cc500477173a9a869a16f18031c47600ecc9bc6d
# -*- coding: utf-8 -*- """ -------------------------------------------------------------------------- glmnetCoef computes coefficients from a "glmnet" object. -------------------------------------------------------------------------- DESCRIPTION: This function extracts coefficients at certain lambdas if they ar...
988,510
2a51fdf19b99c29d36d3768b319f8834ebf3547e
##################################################### Import system libraries ###################################################### import matplotlib as mpl mpl.rcdefaults() mpl.rcParams.update(mpl.rc_params_from_file('meine-matplotlibrc')) import matplotlib.pyplot as plt import numpy as np import scipy.constants as c...
988,511
cd526e9f9426fc9fc9040e33661e9a26909af291
import unittest import time from app import BASE_DIR from script.hr_login import Login from script.hr_test_emp import TestEmp from script.hr_test_login import TestIHRMLogin from tools.HTMLTestRunner import HTMLTestRunner suite = unittest.TestSuite() suite.addTest(unittest.makeSuite(Login)) #导入登录员工和员工管理 suite.addTest...
988,512
c369be26cb4f6dca2cc79937d342339bc30c8b10
from __future__ import print_function, absolute_import, division import time import sys class PID: def __init__(self, dt=0.05, Kp=0, Ki=0, Kd=0): self.dt = dt self.Kp = Kp self.Ki = Ki self.Kd = Kd self.reset() def feedback(self, err): if type(self.err_p) == ...
988,513
ac5d0e51859c97185072630dd5e8189d9820366c
import requests, json, os from pprint import pprint def busca_dicionario(p, d): key2 = 'AIzaSyDaY5QRWxXSN-2PCncnGv3R3oyjVJffJPE' link = "https://maps.googleapis.com/maps/api/directions/json?origin={0}&destination={1}&key={2}&language=pt".format(p, d, key2) req = requests.get(link) return json.loads(req...
988,514
9a3638d197df206afc415eaf465960829311e54f
# python-holidays # --------------- # A fast, efficient Python library for generating country, province and state # specific sets of holidays on the fly. It aims to make determining whether a # specific date is a holiday as fast and flexible as possible. # # Authors: dr-prodigy <dr.prodigy.github@gmail.com> (c) 2...
988,515
8ae441cb69282646af2f00abb26bc1f8729dad48
import random import tkinter import pandas BACKGROUND_COLOR = "#B1DDC6" current_card = {} try: data = pandas.read_csv("words_to_learn.csv") except FileNotFoundError: data = pandas.read_csv("Japanese_words.csv") data_dict = data.to_dict(orient="records") else: data_dict = data.to_dict(orient="records...
988,516
3e8a4a5a4d17d3a0561e182fbff7969e1fa6bec7
class INIDefaults: class Bullet: ALIGN = 0 BACKGROUND_COLOR = 'background.default' BACKGROUND_COLOR_ON_SWITCH = 'reverse' BULLET = '●' BULLET_COLOR = 'foreground.default' INDENT = 0 MARGIN = 0 PAD_RIGHT = 0 SHIFT = 0 WORD_COLOR = 'foreg...
988,517
3a7952f0da29c61993910e0b4ef20d1efb581f18
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'particularly_search_singer.ui' # # Created by: PyQt5 UI code generator 5.13.0 # # WARNING! All changes made in this file will be lost! from PyQt5 import QtCore, QtGui, QtWidgets class Ui_MainWindow(object): def setupUi(self, MainWind...
988,518
4791ecde2bc4d8b2e93b3056a41e1da64eb8e6d5
#-*- coding: utf-8 -*- import os import smtplib import mimetypes from email import encoders from email.header import Header from email.mime.base import MIMEBase from email.mime.text import MIMEText from email.mime.multipart import MIMEMultipart from email.utils import parseaddr, formataddr def _format_addr(s): nam...
988,519
2a401ecf44fab5075259d485c234a7bfb2efeb29
import random, os running = True games_history = [] if 'results.txt' in os.listdir('.'): f = open('results.txt', 'r') loaded = f.readlines() f.close() for items in loaded: newlist = items.strip('\n') games_history.append(newlist) def initilize(): max_num = int(input("what would y...
988,520
db5d56de1c9bf5d76cda47b5a1dd73cdc51028cd
import numpy as np def quaternRotate(v, q): rows, col = v.shape z = np.zeros((1, col)) return quaternion_multiply(quaternion_multiply(q, np.concatenate((z, v), axis=0)), quaternConj(q))[1:, :] def quaternion_multiply(quaternion1, quaternion0): w0, x0, y0, z0 = quaternion0 w1, x1, y1, z1 = quater...
988,521
9766b2dde621b13c3b2de074de2ee2c41fe004c8
from django.contrib import admin from .models import * # Register your models here. class EventAdmin(admin.ModelAdmin): list_display = ('id','title', 'event_date','event_address','desc') class BoothAdmin(admin.ModelAdmin): list_display = ('id','event', 'number','group_name','desc') class UserProfileAdmin(admi...
988,522
59b6663564538d9f94e04b6ed4be3036ec31ccbf
import matplotlib.pyplot as plt import numpy as np import pandas as pd import pickle from sklearn.linear_model import SGDClassifier from sklearn.model_selection import cross_val_score, StratifiedShuffleSplit, train_test_split from sklearn.pipeline import Pipeline from sklearn.preprocessing import MinMaxScaler df = pd....
988,523
d7ca9b8489a51874be92d99ee1fbd2f92a0d490d
from PIL import Image, ImageDraw, ImageFont from datetime import datetime import numpy as np import time from .device import Device from .display import Display from .widgets.cpu import Cpu from .widgets.mpd import Mpd from .widgets.linux import Linux from .widgets.clock import Clock from .widgets.nvidia import Nvidia...
988,524
82801d1f4ce9c723a39fcc4bee4e95c6fe144f8b
import uuid class Producto: def __init__(self, nombre, categoria, color, marca, precio, *args, **kargs): self.nombre = nombre self.categoria = categoria self.color = color self.marca = marca self.precio = precio self.id = uuid.uuid4() def __str__(self): ...
988,525
3a0854bd4ef9025e36eb760820af49c649c0f2ca
def DikdortgenAlanCevreHesapla(): uzun_kenar = int(input("Uzun kenarı girin:")) kisa_kenar = int(input("Kısa kenarı girin:")) alan = uzun_kenar * kisa_kenar cevre = (uzun_kenar * 2) + (kisa_kenar * 2) print ("Alanı: ", alan) print ("Çevresi: ", cevre ) while True: DikdortgenAlanCevreHesapla(...
988,526
d465ea9f7a3531e9f161c9b53c1710fbc21f3cc6
from gobject import timeout_add from scribes_helpers import weak_connect from .signals import Signals class Reseter(object): def __init__(self, signals, editor): editor.response() self.editor = editor self.signals = signals self.lines = () self.update = True weak_connect(editor, "reset-buffer", se...
988,527
765727bbbd7a565638cde5a34762fadb03f78030
from datetime import datetime from typing import Type from bson import ObjectId from django.urls import reverse from JellyBot.systemconfig import HostUrl from models import Model, ExtraContentModel from mongodb.factory.results import ModelResult, RecordExtraContentResult, WriteOutcome from tests.base import TestOnMod...
988,528
196d778f5ba72a443477d9f476605c6b267f4333
from django.contrib import admin from .models import Exercise admin.site.register(Exercise)
988,529
e4dbf10ef31a77c71ed2d6da82b038129504dba3
# Generated by Django 2.0.3 on 2019-06-06 20:43 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('carts', '0009_auto_20190606_2321'), ] operations = [ migrations.AddField( model_name='cartitem', name='unit_price', ...
988,530
bea19dd3db03b8e0bba0594c7fabc2129d0a6f59
#-*-coding:utf-8-*- import paho.mqtt.client as mqtt #Paho-MQTT 패키지 불러오기 from flask import Flask, render_template, request #Flask 패키지 불러오기 app = Flask(__name__) #Flask 모듈 불러오기 #matt 클라이언트를 생성하여 연결 mqttc=mqtt.Client() mqttc.connect("localhost",1883, 60) mqttc.loop_start(...
988,531
9616c478fd73985bfac004b856baba0da199fbdc
#!/usr/bin/env python # -*- encoding: utf-8 -*- # __author__ someone import traceback import os import json from multiprocessing import Process import tornado.ioloop import tornado.web #from bson.json_util import dumps #import bson from tornado.escape import json_decode from lib.portscaner import PortScaner from li...
988,532
4cace889197961d4ecafca896e11efde0686e09f
# -*- coding: utf-8 -*- from config import * import collections from classes.Main import Main if __name__ == "__main__": main = Main() """ Example code to import tweets """ # file_path = os.path.realpath(PROJECT_ROOT_DIRECTORY+DATASET_TXT_DIR_NAME+"TTNetTweets2012.txt") # main.retrieve_tweets...
988,533
a582d1ec280c92eefe062b2ac2c9b94d17f8edd6
from __future__ import absolute_import import os import h5py import cgp D = os.path.dirname(os.path.abspath(__file__)) + '/' geometry_file = D + 'data/geometry.h5' results_file = D + 'data/geometry-results.h5' def dataset_name(command, cell_order=None, label=None): name = command if cell_order is not None: ...
988,534
a566e96f87af2d58e2f0e162f562f28f01d070aa
''' Bringing it all together: Festivus! In this exercise, you will be throwing a party—a Festivus if you will! You have a list of guests (the names list). Each guest, for whatever reason, has decided to show up to the party in 10-minute increments. For example, Jerry shows up to Festivus 10 minutes into the party's st...
988,535
f901360ead9e788b354a3d94eedff90438d76f5f
import scrapy import re from scrapySchool_England.clearSpace import clear_space, clear_lianxu_space from scrapySchool_England.items import ScrapyschoolEnglandItem1 from scrapySchool_England.getItem import get_item1 from scrapySchool_England.remove_tags import remove_class from scrapySchool_England.getStartDate import g...
988,536
baf90b3b7a424965c8e34e80de601f3a340205d2
for x in [0, 1, 2, 123]: print("Hello World!!") for x in [0,1, 2,3, 597]: print(x, end="") for x in [3, 4, 5, 6]: print("x 값은 =", x) for x in [25, 11, 23, 3]: print(x, end=" ")
988,537
9b9b0f88b2c12b020e0bdc9d46e6e2624b2f7624
from typing import Union, List from sqlalchemy.ext.asyncio import AsyncConnection from box import Box from db import mysql_client from utils import current_time, obj_id from core.exceptions import NotFoundError async def create_votes(session: AsyncConnection, data: List, poll: Box) -> List[Box]: payload = [Box(...
988,538
f9d3bdc0f737b2b1b6ce4945304407bfcbf3dfd2
#Embedded file name: /Users/versonator/Jenkins/live/output/Live/mac_64_static/Release/python-bundle/MIDI Remote Scripts/iRig_Keys_IO/mixer.py from __future__ import absolute_import, print_function, unicode_literals from ableton.v2.base import forward_property, liveobj_valid from ableton.v2.control_surface.components im...
988,539
f735a8612b0a21e97af4257a7f96a8c018a67049
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import enum from typing import Iterator, IO UNARY_OPS = ["neg","not"] BINARY_OPS = ["add","sub","and","or"] CMP_OPS = ["gt","lt","eq"] ARITHMETIC_OPS = UNARY_OPS + BINARY_OPS + CMP_OPS class CmdType(enum.Enum): ARITH = enum.auto() PUSH = enum.auto() POP = enu...
988,540
bee4c4f5177b34f8368bd3e959610492e350f66d
import math import random import numpy as np random.seed(1) def Failure(): global Clock # simulation clock global NextFailure # time of next failure event global NextRepair # time of next repair event global S # system state global Slast # prev...
988,541
8df3cd40b1f3735819380deaf146ed005d895b1c
#!usr/bin/env python # -*- coding:utf-8 -*- '''Mask R-CNN coco inference Using the trained model to detect and segment objects.''' import os import sys import random import colorsys import skimage.io import numpy as np from skimage.measure import find_contours import matplotlib.pyplot as plt from matplotlib import ...
988,542
8f52a60ec1b8f8849364753488ebfcd9dc3baca7
#!/usr/bin/env python # -*- coding:utf-8 -*- # @Time : 2019/8/13 14:30 # @Author: Tu Xinglong # @File : DataSource.py # 内置模块 import os import sys import warnings from datetime import datetime warnings.filterwarnings("ignore") import tushare as ts import pandas as pd CurrentPath = os.path.abspath(os.path.dirname(__f...
988,543
75cd55bdc1128437a8f30d35841a6259916b911c
import json import os class ERC20: abi = None def __init__(self, web3) -> None: self.web3 = web3 with open( "{dir}/{file}".format(dir=os.path.dirname(__file__), file="abi.json") ) as f: self.abi = json.load(f)
988,544
38323e8d7a16f70b8ff15b0c59776b251041dbd6
import json import core.neural_network.builder.building_strategy as BuildingStrategy from core.neural_network.drawer.main import draw_net class IBuilder: def build_net(self, building_data): raise NotImplementedError() class Builder(IBuilder): def __init__(self, building_strategy=BuildingStrategy.Coe...
988,545
7eaa56638de830329ecf41e1fef90d8a15dfb763
import time import os import argparse import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from torch.optim import lr_scheduler from torchvision import datasets, transforms, utils from tensorboardX import SummaryWriter from util_ import * from entropy_model import * from PIL im...
988,546
a740ede2dcd1b80ddc6b21dc51cff0ec68839f55
import sys import os import numpy as np import cv2 import matplotlib.pyplot as plt from utils import helpers from tensorflow.keras.backend import set_learning_phase from tensorflow.keras.models import load_model def annotate_image(file_path, coordinates): """ Annotates supplied image from predicted coordina...
988,547
9951fa118724303290be136663c132805d9daa83
import _init_paths import os import numpy as np import h5py import time import datetime import sg_utils from caffe.proto import caffe_pb2 import google.protobuf as pb2 import traceback as tb import code try: from python_layers.loss_tracking_layer import loss_tracker_dict; # global loss_tracker_dict; except: ...
988,548
2478c48acfe55bf777b0cf4f26ce307df5532d37
''' Created on 2021-05-31 @author: Bartosz Walewski ''' import requests import json from PyQt5 import QtGui import data_operations headers = { 'x-rapidapi-key': "ENTER_KEY_HERE", 'x-rapidapi-host': "weatherapi-com.p.rapidapi.com" } def get_history_weather(date): url = "https://weatherapi-co...
988,549
bc4dd434af9d6b8eb6855a664379870d0a9bbb98
# Apparently cattle needs python 2.7.8 (2.7.11 doesn't work) import os import time import argparse import json from wranglib.cattle import init as initcattle from wranglib.cattle import report from AdAnalysis import AdAnalysis def parse_args(): parser = argparse.ArgumentParser( description='Push data ...
988,550
0bd51f78823c5a38e232dfbe3a4e2e8207296e6c
from bs4 import BeautifulSoup import requests import json import config class DataExtraction: def html_tags(self, element_arr): # bool function checks if first element of data is html tag if(element_arr[0] == 'p' or element_arr[0] == 'h1' or element_arr[0] == 'h2' or element_arr[0] == 'a' or eleme...
988,551
fce90b25227f407902728bbc7f1d7fc6ff10aceb
import paramiko from os import path from .command import SSHCommand, TEST_FAIL, TEST_SUCCESS class SSHChannelException(Exception): pass class SSHChannel: def __init__(self, host: str, port: int, username: str, password: str = None, keyfile: str = None): # error check if not isinstance(port, in...
988,552
3b25174f6323b4e960d3daa2c616523140dc615c
# Generated by Django 2.2.4 on 2019-08-20 13:41 from django.db import migrations, models def nullEmptyNonces(apps, schema_editor): Person = apps.get_model('issuer', 'Person') for row in Person.objects.filter(nonce=''): row.nonce = None row.save() class Migration(migrations.Migration): ...
988,553
f4d54db839a6ea070d261f8937649f66a4a05a34
n = int(input()) if n % 2 == 1 : print("Weird") elif n % 2 == 0 and 2 <= n <= 5 : print("Not Weird") elif n % 2 == 0 and 6 <= n <= 20 : print("Weird") else: print("Not Weird") """ Python If-Else - Hacker Rank Solution Python If-Else - Hacker Rank Solution Task Given an integer, , p...
988,554
7bd9e39a5349a5f7ff9793c90e38ce0bafaa5799
# 1. Crie uma coleção que suportará números inteiros. Após isso, adicione a esta lista cinco valores inteiros. # Em sequência, exiba estes valores. Por fim, ordene os valores e remove o elemento da posição 3. Exiba # novamente a lista. def exercicio1(): lista = [2, 1, 3, 4, 0] print(lista) listaOrdenada = ...
988,555
4991767f8010193839daa6959c559740d0df72e4
pendingMessagesMap = dict() # holds an array containing all pending messages by tuples: (client id source, msg) usersMap = dict() # holds users and their public keys def register_user(client_id, public_key): print("Registering user!") usersMap[client_id] = public_key def get_public_key(client_id): pr...
988,556
385fb75466f922d4ed4305437126a68ecf4faeb0
__author__ = 'ckomurlu' import utils.properties import numpy as np import types import datetime import os def standard_error_depr(sample): flat = sample.flatten() stddev = flat.std() sample_size = flat.shape[0] return stddev/(sample_size**.5) def standard_error(sample_array, axis=0): stddev = ...
988,557
3cadac75e2399bd9fc6b694457e65cf5c654da2e
import os, sys sys.path.append('/home/ruihan/coiltraine/') import yaml import torch from network.models.coil_icra import CoILICRA from coilutils import AttributeDict # from attribute_dict import AttributeDict # # Sample from PyTorch docs: https://pytorch.org/tutorials/beginner/saving_loading_models.html#warmstartin...
988,558
0758033cf6f6d29b6423737d5784b53b70f2c8ab
#!/usr/bin/env python import os from setuptools import setup from setuptools import find_packages def read(*rnames): return open(os.path.join(os.path.dirname(__file__), *rnames)).read() setup( name = 'Talkmore SMS', version = "0.0.1", description = "Talkmore SMS library for Python 3", author = "...
988,559
a00a9e1850a530efb7e73d3e3d3743dfc5d8d532
"""Version module.""" __version__ = '1.2.3'
988,560
eecc78e7136a8f505a141a01081bacf29253df96
class Solution: def reverse(self, x: int) -> int: #todo reasearch functions with self # print("\n") # # # # x = 1234 # # print(str(x)) # Code #1 # string_name = "3245" # # Iterate over the string # for element in string_name: # print(element, end=' ') # #print("\n")
988,561
782e0f847a2eb86756e68396afcc19160ae1cc81
# Discrete time observation inference # packages import numpy as np from scipy.stats import skellam from scipy.stats import poisson from scipy.stats import gaussian_kde import matplotlib.pyplot as plt from random import choices from scipy.integrate import simps import seaborn as sns from matplotlib.gridspec import Grid...
988,562
3b653f4b5c4a6ccf060572f2a8f314c72306a5a0
import requests from spellchecker import SpellChecker def escape_meme_text(text): """ Replaces special characters in text for use with the memegen.link API """ replacements = { " ": "_", "?": "~q", "%": "~p", "#": "~h", "/": "~s", "''": "\"", } for r in replacem...
988,563
fb58f9af5f0c7f5b03cb4465ec9c19b4784a690a
class TreeNode: def __init__(self, val=0, left=None, right=None): self.val = val self.left = left self.right = right class Solution: def findTarget(self, root: TreeNode, k: int): if not root: return leftNode, rightNode = root.left, root.right l1, l2 ...
988,564
a5f08c6d7fb0a7baee13d646e45846a601a86130
# https://matplotlib.org/gallery/user_interfaces/embedding_in_gtk3_sgskip.html # Though a FigureCanvasGTK3Agg is used, the default renderer is still TkAgg import gi gi.require_version('Gtk', '3.0') from gi.repository import Gtk import matplotlib as mpl mpl.use('GTK3Agg') print(mpl.rcParams['backend']) from matplotlib....
988,565
07ceb5ebdb77a4b62a717d3079c23829c574ef44
CMA = input("input :") cma = CMA.replace(",", "") print(int(cma) + 100)
988,566
828ddbd8893ae2b38aaa2b9386fb7b33cd19351b
#!/usr/bin/python3 # stefan (dot) huber (at) stusta (dot) de # http://adventofcode.com/2017/day/10 def getInput(input): result = "" with open(input, 'r') as inputfile: for line in inputfile: result = result + line.strip() return result def inputPart1(inpt): result = [] for number in inpt.split(','): resu...
988,567
47139fdfc1a36cf503880de89291af90d12f23a0
# -*- encoding: utf-8 -*- ############################################################################## # # Copyright (c) 2013 BroadTech IT Solutions. # (http://wwww.broadtech-innovations.com) # contact@boradtech-innovations.com # # This program is free software: you can redistribute it and/or modify # ...
988,568
d4898bb5b8c54dffba660e6cae8b36789f13f3e7
# coding: utf-8 # In[185]: # bulk of Dependencies import tweepy import base64 import pandas as pd import requests import time import json import dateutil.parser as parser # API Keys from config import (consumer_key, consumer_secret, access_token, access...
988,569
92d14c1c38c3fc2b5d6327591583c12fad1dd0ed
#!/usr/bin/env python # Step 1. Generate phonetic name # Step 2. Figure out how to spell it. #//********************************************************************** #// #// Name Generator #// #// C - starting consonant #// V - vowel #// D - multi-consant #// c - end consonant #// d - ending multi-consona...
988,570
4d4f228e15a7a28bb8ed70e514f36bae6e2a4c0b
mystring = 'hello' mylist = [letter for letter in mystring] print(mylist) mylist = [num**2 for num in range(0,11)] print(mylist) mylist = [x for x in range(0,11) if x%2 == 0] print(mylist) celcius = [0,10,23,34] fahrenheit = [( (9/5)*temp +32) for temp in celcius] print(fahrenheit) results = [x if x%2==0 else 'O...
988,571
08791666fdebb10c7eca5623b527851811d1bee9
"""Return order of pop, push ops to make given arr :input: 8 4 3 6 8 7 5 2 1 :return: + + + + - - + + - + + - - - - - url: https://www.acmicpc.net/problem/1874 """ import sys sys.setrecursionlimit(10 ** 6) class Stack: def __init__(self, arr=[]): self._stack = list(arr) self._len = len(self._st...
988,572
25f5dfefd652623046e4e8c91d703a318d0f48a0
import sys import collections tests = int(input()) while(tests > 0): size = int(input()) inEvents = list(map(int, input().split())) outEvents = list(map(int, input().split())) inC = collections.Counter(inEvents) oC = collections.Counter(outEvents) inEvents = set(inEvents) outEvents = set(outEvents) totalEs = ...
988,573
e25023ba806b46a00ba95ac6fa220e17c3764496
from django.db import models from django.db.models.constraints import UniqueConstraint from django.contrib.postgres.fields import ArrayField from django.db.models.fields import BigIntegerField class SmsUser(models.Model): email = models.EmailField(max_length=100, unique=True) password = models.CharField(max_le...
988,574
a40ac6dde22875f9ab8a95156ff10fcca0827ddd
# 请定义一个队列并实现函数 max_value 得到队列里的最大值,要求函数max_value、push_back 和 pop_front 的均摊时间复杂度都是O(1)。 # # 若队列为空,pop_front 和 max_value 需要返回 -1 # # 示例 1: # # 输入: # ["MaxQueue","push_back","push_back","max_value","pop_front","max_value"] # [[],[1],[2],[],[],[]] # 输出: [null,null,null,2,1,2] # 示例 2: # # 输入: # ["MaxQueue","pop_front","max_...
988,575
0a34517c7a9e968ac4e1a30ece6e2bab06d9013e
""" FapolicydRules - file ``/etc/fapolicyd/rules.d/*.rules`` ======================================================== """ from insights import parser from insights.core import LogFileOutput from insights.specs import Specs @parser(Specs.fapolicyd_rules) class FapolicydRules(LogFileOutput): """ Parse the cont...
988,576
4cd4d9ef0ea2f6f07e1fba070875f898ddcdeb38
from pyvolcafm import * voice = Voice() voices = [] for i in xrange(32): voice = Voice() voice.algo = 6 for j in xrange(6): # voice.operators[j].detu = pass for j in [1, 3, 5]: voice.operators[j].egl = [50, 80, 90, 50] voice.operators[j].egr = [40, 40, 40, 40] v...
988,577
8711880206c06a158ea7a4648c6370d34d658f52
import ael def getroot(prf,*rest): par = getparent(prf) ''' if par.prfid != '9806': return getroot(par) else: if prf: return prf.prfid else: return '1' ''' if par: if par.prfid != '9806': return getroot(par) ...
988,578
56f39ce5421912d45d47a7d4ec49116e522abdd3
from brawlbracket.app import app print('\n\n\n----------------test----------------\n\n\n')
988,579
74b024ae0aeb5a57966788b12f4df64b33039aab
''' Problem: The set [1,2,3,…,n] contains a total of n! unique permutations. By listing and labeling all of the permutations in order, We get the following sequence (ie, for n = 3): "123" "132" "213" "231" "312" "321" Given n and k, return the kth permutation sequence. Note: Given n will be between 1 and 9 inclusi...
988,580
678ce0b5ec08b095e5ba7d31a20a0dbb42378472
import os.path DIR_DEFAULT = os.path.join(os.environ['HOME'], '.Dominik') DIR_DIC = os.path.join(DIR_DEFAULT, 'dictionary') DIR_DIC_YML = os.path.join(DIR_DEFAULT, 'dictionary', 'yml') DIR_SQLITE = os.path.join(DIR_DEFAULT, 'sqlite') DIR_LOG = os.path.join(DIR_DEFAULT, 'log') DATABASE_URI_CHAT_DEFAULT = 'sqlite:///' +...
988,581
0d3f63ba72f7a313f3754fad188a509a66767185
from django.contrib.auth.models import User from django.http import JsonResponse from security.models import SystemUser from utils.security.generators import generate_account_id from utils.security.utils import * from utils.security.generators import _generate_jwt_token from django.utils.datetime_safe import date def ...
988,582
a98c7e5ec1f3c0bb25cdedbe2b893d7bbb4990a5
import unittest from pychembldb import chembldb, Cell class CellTest(unittest.TestCase): def setUp(self): self.target = chembldb.query(Cell).get(1) def test_cell_id(self): self.assertEqual(self.target.cell_id, 1) def test_cell_name(self): self.assertEqual(self.target.cell_name, "...
988,583
878d14b919f1e568dd985a13716fae44324e96ff
# Module: say # Description: Uses powershell and a TTS engine to make your computer say something # Usage: !say "Something to say" # Dependencies: time, os import os, asyncio, configs async def say(ctx, txt): if configs.operating_sys == "Windows": await ctx.send("Saying: " + txt) os.system( ...
988,584
45ef956f03a8f532582877af71ecfaf185d5d001
class Node(object): def __init__(self, name, andrewID): self.name = name self.andrewID = andrewID def __hash__(self): return hash(self.name) def __eq__(self, other): return isinstance(other, Node) and self.name == other.name def __repr__(self): return self.name class Queue(o...
988,585
102eea560916b13b4140b17730b523c7703d2fe8
from flask import Flask, jsonify, Response, request from wrapper import * app = Flask(__name__) @app.route('/multiple-issue',methods=['GET']) def multipleIssue(): if request.method == 'GET': return getMultipleIssues() @app.route('/img',methods=['GET']) def image(): theme = request.args.get("issue") ...
988,586
5dd2e38b3ff766ae1e52ff81de85dedf3ccf67d1
from django.shortcuts import render, redirect, get_object_or_404 from django.views import generic from django import forms from django.template import Template from django.utils import timezone from django.contrib.auth.models import User from django.contrib.auth.mixins import LoginRequiredMixin from django.contrib impo...
988,587
1ae7a36d922338f32def2e1b3ed6a6e1572137b2
import argparse import datetime import math import os import time import matplotlib.pyplot as plt import numpy as np import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from torch.utils.data import DataLoader import shape from shape import ShapeDataset, MixShapeDataset from ...
988,588
3fb98eb68b61ad9968065ebf555fe75c62f98c16
# -*- coding: utf-8 -*- """ Created on Mon May 3 10:09:13 2021 @author: Keyur Asodariya Time com:- O(n^1.585) """ X=int(input("Enter number 1 :")) Y=int(input("Enter number 2 :")) def karatsuba(X,Y): #base condition if X<10 or Y<10: return X*Y m=max(len(str(X)),len(str(Y))) ...
988,589
6751cbdad700f3cc793eda01f4412f2c71ab5823
# Copyright 2020 Google LLC # # 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, ...
988,590
6eb88ef84533d7e52566087d55b995d8364e94fe
import numpy as np import serial import cv2 pi = 3.14159265359 def distance(ax, ay, bx, by): return np.sqrt((ax - bx) ** 2 + (ay - by) ** 2) def getangle(xx, yy, dxx, dyy): if dxx == xx: if dyy < yy: de = -pi/2 else: de = pi/2 elif dxx < xx: if dyy < yy: ...
988,591
faf73df787ae8b2208c8383ab1cb9567573b21f9
""" Enforce the nocase collation on the email table Revision ID: 049fed905da7 Revises: 49d77a93118e Create Date: 2018-04-21 13:23:56.571524 """ # revision identifiers, used by Alembic. revision = '049fed905da7' down_revision = '49d77a93118e' from alembic import op import sqlalchemy as sa def upgrade(): with o...
988,592
1bf724f02c54b128a008a8dfe1f8b4985e262f0c
from random import choice from random import random from model.utils import * class Ant: def __init__(self, graph): self.__graph = graph self.__path = [choice(self.__graph.nodes)] def computeProduct(self, node): # trace^alpha * (1/cost)^beta return (self.__graph.trace[self....
988,593
dc3ca11c1c567df72dd2823a6950c6051feee90c
#! /usr/bin/env python # encoding: utf-8 import os import hashlib class HttpResolver(object): """ Http Resolver functionality. Downloads a file. """ def __init__(self, url_download, dependency, source, cwd): """Construct a new instance. :param url_download: An UrlDownload instance ...
988,594
2d7a1fd80f1cf61c402495bcd3678991895fefa3
""" This module is not operational. Sorry. All the features in this module will automatically be extracted by the FeatureExtractor object. They must all receive a line and a context, and return a value. """ # import nltk # import en_core_web_md # from nltk.sentiment.vader import SentimentIntensityAnalyzer #load wo...
988,595
ad5f5a178c5a6a0fc927ae2142b5b484edc1ea2c
import os import re from datetime import timedelta import numpy as np from dateutil import rrule, parser from library import yaml from library.xlwings_pd import OperatingExcelPd CONT_PAT = r"(?<=[\>|\)])\n(.*)" SIGN_PAT1 = r"打[卡|开](.*)次(.*)" SIGN_PAT2 = r"打[卡|开](.*)\D(.*)次" NICK_PAT = r":\d{2} (.*)[\(|\<]([^\)|\>]*)...
988,596
eec9ff36e9e96db44820cd548d0ff43572e461aa
import json import scrapy BASE_IFOOD_URL = 'https://www.ifood.com.br/delivery/' BASE_AVATAR_URL = 'https://static-images.ifood.com.br/image/upload/f_auto,t_high/logosgde/' BASE_URL = 'https://marketplace.ifood.com.br/v1/merchants?latitude=-23.19529&longitude=-45.90321&channel=IFOOD' class Restaurant(scrapy.Item): ...
988,597
7956419d9ce6a24458d2d575382ba8c645206935
import sys from random import randint, random, uniform, choice, shuffle import numpy as np from .individual import Individual from .problem import Problem from .algorithm_genetic import GeneralEvolutionaryAlgorithm from .operators import RandomGenerator, PmMutator, ParetoDominance, EpsilonDominance, crowding_distance,...
988,598
fef0d38df4ef197b8d70cab342b5cc3e603f8d24
#!/usr/bin/env python3 # _*_ coding=utf-8 _*_ import csv from urllib.request import urlopen from bs4 import BeautifulSoup from urllib.request import HTTPError try: html = urlopen("https://en.wikipedia.org/wiki/List_of_U.S._states_and_territories_by_historical_population?oldformat=true") except HTTPError as e: p...
988,599
c9a3dc10d8b0c93b16b4caf125f35e0171355960
from re import template from fastapi import FastAPI, Body from starlette.templating import Jinja2Templates from starlette.requests import Request import sqlalchemy engine = sqlalchemy.create_engine( 'mysql+pymysql://root:Makt0112pc-49466@localhost:3306/db_fastapi') app = FastAPI( title='FastAPIでつくるtoDoアプリケー...