index
int64
0
1,000k
blob_id
stringlengths
40
40
code
stringlengths
7
10.4M
995,500
9e7a701b11f184cafaf0f80f7e256fb6bec33afe
months_map = {"Jan":1,"Feb":2,"Mar":3,"Apr":4,"May":5,"Jun":6,"Jul":7,"Aug":8,"Sep":9,"Oct":10,"Nov":11,"Dec":12} def compareDates(date1, date2): date1Arr = date1.split(' ') date2Arr = date2.split(' ') if int(date1Arr[-1])>int(date2Arr[-1]): return 1 elif int(date2Arr[-1])>int(date1Arr[-1])...
995,501
ab62c4552c4864d594374bb7de7d69b2e8ac72d5
''' Copyright (C) 2015 Pistiwique, Pitiwazou Created by Pistiwique, Pitiwazou This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your o...
995,502
0610ca8868793420e35a190ad63d1a5c5e7efddc
from django import forms class LoginForm(forms.Form): username = forms.CharField(label='Username', max_length=100) password = forms.CharField(label = 'Password', widget=forms.PasswordInput) class ProfileForm(forms.Form): profile_description = forms.CharField(widget=forms.Textarea(attrs={ ...
995,503
f3dc8509d5b68f26d401535acbf2431f2fbc0a22
import shutil import pandas as pd from tqdm import tqdm, trange def copyUniqueImages(coordinates_path, source_path, destination_path): image_file = pd.read_csv( coordinates_path, sep=',', header=None) image_names = image_file[3] for i in tqdm(range(1, len(image_names))): shutil.cop...
995,504
1a42945f2a48e1d4281aac7baf7823a24e9c1e48
#classes and subclasses to import import cv2 import numpy as np import os ################################################################################################# # DO NOT EDIT!!! ################################################################################################# #subroutine to write rer...
995,505
28db7bbc4d2c1fc57f4977683f90cbf748d6238a
""" Marco Fernandez Pranno Ejercicio 1 """ def extendedGcd(a, b): """ Greatest common divisor d of a and b, and x and y integers satisfying ax + by = d """ if b == 0: return a, 1, 0 x1 = 0 x2 = 1 y1 = 1 y2 = 0 while b != 0: q = a // b r = a - q * b x = x2 - q * x1 y = y2 - q...
995,506
2ec655a9f8cb5777b47d9f0cd8802081fac07fd1
#n大于5时,将n分成3的倍数越多,乘积越大,如果最后剩余1,表示前一个分割为4,需要将4分为2个2,而不是1和3 class Solution: def cuttingRope(self, n: int) -> int: if n == 2: return 1 if n == 3: return 2 num3 = n // 3 res = n - num3 * 3 if res == 1: num3 -= 1 num2 = (n - n...
995,507
1ced1ef23ccef4eae6670fc5f0f1ae6935643559
conf={'19223239': '2018-06-21 16:01:30', '40892716': '2018-06-21 16:02:07', '70712': '2018-06-21 16:00:21', '40891010': '2018-06-21 16:02:05', '40979217': '2018-06-21 16:02:10', '40791012': '2018-06-21 16:02:03', '1838993': '2018-06-21 16:00:28', '18744865': '2018-06-21 16:01:14', '40247513': '2018-06-21 16:01:55', '40...
995,508
205d688d187f92acb384a910798d37335b912eda
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'd:\pythoncode\6.ui_files\first_view.ui' # # Created by: PyQt5 UI code generator 5.13.2 # # WARNING! All changes made in this file will be lost! from PyQt5 import QtCore, QtGui, QtWidgets from PyQt5.QtWidgets import * import sys class First...
995,509
36af93032e30dab543159eee0f803421a9656217
# Copyright 2019 The TensorFlow Authors. 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 # # Unless required by applica...
995,510
ccd2c932e2ab86ebde26af90fb930f7e2937ed44
import numpy as np from XFP import XFP, LeducRLEnv seed = 100 np.random.seed(seed) env = XFP() env.compute_p2_best_response() env.compute_p1_best_response() p1 = 0.0 p2 = 0.0 for i in range(100): cards = env.possible_cards_list[np.random.randint(24)] game_state = "" while True: if game_state in e...
995,511
bacd8fa09dfb5921ea12e316d59a5dd810fce58a
from chalicelib import recipients_service from chalicelib.donations.donation import Donation from chalicelib.donations.donations_repository import DonationsDynamoDBRepository DONATIONS = DonationsDynamoDBRepository.create() def send_donation(donation_request): donation = Donation.create_new_from(donation_request...
995,512
d1ea643ad4f6f094baffee5032b61b1d3c1828d3
from django import template from django.urls import reverse from django.apps import apps import random register = template.Library() @register.filter def to_class_name(value): return value.__class__.__name__ @register.inclusion_tag('GBEX_app/links.html') def links(selected_model): menus = {} selected_m...
995,513
20b61b31cd8f0e1d7c625874e90beb8fa1fa3ff6
from datetime import timedelta import time import paramiko from utils.helper_functions import do_ssh def take_snapshot(bot=None, msg=None, remote=None, ssh_user=None, ssh_password=None): chat_id = msg.message.chat.id user = msg.message.chat.first_name +" "+msg.message.chat.last_name ssh, established = do_...
995,514
af3d7469541ce436c5716c4f39fa4ac21391238f
from django.contrib.auth import get_user_model from django.db import models User = get_user_model() class Activities(models.Model): """ Model represents various activities that user can add to his Travel Plan. """ WARSAW = 'WAR' KRAKOW = 'KRK' GDANSK = 'GDA' CITIES = [ (WARSAW, '...
995,515
ca14e7c7c4a4e5d6514c5b664f918a110c8431a9
import pandas as pd @transform_pandas( Output(rid="ri.vector.main.execute.ac452cb8-5902-4044-a251-a10617f9ee6d"), s_interact_invars=Input(rid="ri.foundry.main.dataset.56725eae-2284-4cb3-a920-ac17601fcc18") ) def unnamed_4(s_interact_invars): @transform_pandas( Output(rid="ri.foundry.main.dataset.c586...
995,516
0676e6b060472cc60002eeb0998717bd3bef9dcf
from d08lib import read_d08, State, run_until_loop def main(): orig_ops = tuple(read_d08()) *_, cand_ops = run_until_loop(State(opc=0, acc=0), orig_ops) for i in cand_ops: if orig_ops[i][0] == "acc": continue ops = list(orig_ops) ops[i] = ("jmp" if ops[i][0] == "nop" el...
995,517
fc19ccef78b16da9a178f12942421d3bc3006d2a
""" Balanced strings are those who have equal quantity of 'L' and 'R' characters. Given a balanced string s split it in the maximum amount of balanced strings. Return the maximum amount of splitted balanced strings. Example 1: Input: s = "RLRRLLRLRL" Output: 4 Explanation: s can be split into "RL", "R...
995,518
e30a866ed33caaefd5bd07595248ebcfbcc6978e
# -*- coding: utf-8 -*- from . import LiuYue from ..util import LunarUtil class LiuNian: """ 流年 """ def __init__(self, da_yun, index): self.__daYun = da_yun self.__lunar = da_yun.getLunar() self.__index = index self.__year = da_yun.getStartYear() + index self._...
995,519
77c95ab52dc0108c348d557cc756469de98a844c
# -*- coding: utf-8 -*- # @Time : 2021/5/25 16:57 # @Author : haojie zhang """ 516. 最长回文子序列 给定一个字符串 s ,找到其中最长的回文子序列,并返回该序列的长度。可以假设 s 的最大长度为 1000 。 示例 1: 输入: "bbbab" 输出: 4 一个可能的最长回文子序列为 "bbbb"。 """ class Solution: def longestPalindromeSubseq(self, s: str) -> int: n = len(s) dp = [[0] * n for _ i...
995,520
bde62132a0190f7a98d80784082a03f9213f74c6
import tensorflow as tf import keras from keras import layers, optimizers from keras.models import Model from keras.layers import Dense, Activation, Flatten, Conv2D, MaxPool2D, AveragePooling2D, BatchNormalization, \ ZeroPadding2D, Input, GlobalAveragePooling2D import numpy as np import cv2 import os x_train = [];...
995,521
13b633a1a7a0d1d6a69b9074f7c0118625dd3a12
from unittest import TestCase from ipynb.fs.full.index import * class TxTest(TestCase): def test_coinbase_height(self): raw_tx = bytes.fromhex('01000000010000000000000000000000000000000000000000000000000000000000000000ffffffff5e03d71b07254d696e656420627920416e74506f6f6c20626a31312f4542312f4144362f43205914...
995,522
2f837ae3e3a8c08692e75453446316ebbe777ee6
from __future__ import division import argparse import pandas as pd import re # regular expression # useful stuff import numpy as np from scipy.special import expit from sklearn.preprocessing import normalize __authors__ = ['Antoine Guiot', 'Arthur Claude', 'Armand Margerin'] __emails__ = ['antoine.guiot@supelec.fr',...
995,523
ef66a8c7e9c68731b2840991cedfe0c44f48c4a9
#!/usr/bin/env python3 import sys from math import sqrt def overlap(x1=0, y1=0, r1=1, x2=0, y2=0, r2=1): return sqrt((x2 - x1) ** 2 + (y2 - y1) ** 2) < r1 + r2
995,524
f817e9a2c1cf9e520a64b683ecee1250f7ea23dd
from PyQt4 import QtCore, QtGui from PyQt4.QtCore import * from PyQt4.QtGui import * from PyQt4.QtWebKit import * import sys import codecs import download import time import os class Downloader(QObject): # To be emitted when every items are downloaded done = pyqtSignal() def __init__(self, urlList, teams, out = ...
995,525
caf312b4eaa016ad5a711921c87d669f0ae0982b
from flask import Flask, render_template import random #시작점인지 검증하기 위해 Flask에서 내부적으로 구현해놓은 부분 app = Flask(__name__) @app.route("/") def hello(): return "Hello World!" @app.route("/ara") def ara(): return "This is Ara!!!!" #pass variable routing @app.route('/greeting/<string:name>') #<string:name> 이 부분 변화 가능...
995,526
e71503cee57cd4545eac3b1a2c2f50f278cb5b92
'''Functions for validating and sprucing-up inputs.''' def validate_sidewalks(sidewalks): sidewalks_ls = sidewalks[sidewalks.type == 'LineString'] n = sidewalks_ls.shape[0] if n: if n < sidewalks.shape[0]: m = sidewalks.shape[0] - n print('Warning: Removed {} non-LineString...
995,527
1dd9be0e09c74d5666015e33957d9a6d8793a332
import simple_dense X = np.array([[0, 0, 0], [1, 0, 1], [0, 1, 1], [1, 1, 0], [0, 1, 1]]) y = np.array([[0], [1], [1], [0], [1]]) print("Learning start") net = simple_dense.network(X, y, 10, 10) for j in ra...
995,528
f78a79c275e90a90394269b230cdef39dbc4d979
""" Python program to find the largest element and its location. """ def largest_element(a): """ Return the largest element of a sequence a. """ return None if __name__ == "__main__": a = [1,2,3,2,1] print("Largest element is {:}".format(largest_element(a)))
995,529
5d35c6ce0373b36c1d0cbfe85d9d89a39a41a77f
nota1 = float(input('Insira a primeira nota do aluno: ')) nota2 = float(input('Insira a segunda nota do aluno: ')) media = (nota1 + nota2) / 2 if media < 5: print('\033[41mREPROVADO\033[m') elif media >= 5 and media < 7: print('\033[43mRECUPERAÇÃO\033[m') else: print('\033[42mAPROVADO\033[m')
995,530
43e9948b96522ddae75a530d489e7ca16cfaf632
# mendefinisikan array dengan nilai awal import array A = array.array('i', [100,200,300,400,500]) print("Nilai awal sebelum diubah :", A) # mengubah nilai dari elemen tertentu A[1] = -700 # mengubah elemen kedua A[4] = 800 # mengubah elemen kelima print("Nila akhir setelah diubah :", A) #exercise9.10 # nilai awal (s...
995,531
11a5ab5775a3ff85db3b4f2a6a64c173f6670537
#!/usr/bin/env python import subprocess import Utils APPNAME = 'HDTraceWritingCLibrary' VERSION = '0svn20090617' srcdir = '.' blddir = 'build' def _getconf (key): # FIXME Maybe use os.confstr(). p = subprocess.Popen(['getconf', key], stdout=subprocess.PIPE, close_fds=True) v = p.communicate()[0].strip() if no...
995,532
38c28cb45893172567e3db15e90677b35e6d5830
#!/usr/bin/python import sys import json import base64 import requests file_contents = open(sys.argv[1], 'rb').read() encoded_contents = base64.b64encode(file_contents) payload = {'app': encoded_contents} r = requests.post('https://192.168.38.110/rest/app', auth=('admin', sys.argv[2]), d...
995,533
71d0ccfb56369e20f58b1dc8333a88694380bae6
# -*- coding: utf-8 -*- # Generated by Django 1.11 on 2017-04-21 20:14 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('menus', '0002_auto_20170224_1508'), ] operations = [ migrations.RemoveField( ...
995,534
6f3a9e3e2bb0fb1cc7dea844dfdf3942f8b80039
# -*- coding: utf-8 -*- # Copyright (C) 2006-2008 Vodafone España, S.A. # Author: Pablo Martí # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your o...
995,535
b159f761180622de9e2d158350516e18690495b0
# This is a test service class TestService(object): pass def init(): return dict(service_class=TestService)
995,536
fec55e03bc70d1b4b7bd0c12ac9029c8f581e455
# Developed by Redjumpman for Redbot # Credit to jonnyli1125 for the original work on Discordant # Standard Library import aiohttp import re import urllib.parse # Red from redbot.core import commands # Discord import discord BaseCog = getattr(commands, "Cog", object) class Jisho(BaseCog): ...
995,537
370b3f1150ec790a59b0bbcb39932375a60b30de
#user enters a number i_num1=int(input("please enter a number")) i_num2=int(input("please enter another number")) #code outputs greatest number if i_num1 > i_num2: print(i_num1) else: print(i_num2) ##ACS - end if (this should appear after each construct)
995,538
2f9c0c723041f0c4427c2201d526c9aefad71116
#!/usr/bin/env python3 # -*- coding: utf-8 -*- ## Frank@Villaro-Dixon.eu - DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE, etc. __version__ = "1.0" from .Elevation import Elevation # vim: set ts=4 sw=4 noet:
995,539
4084ecfa02b6492abeab8f02bb2e3794863d483b
# coding: utf-8 # Here goes the imports import csv import matplotlib.pyplot as plt # Let's read the data as a list print("Reading the document...") with open("chicago.csv", "r") as file_read: reader = csv.reader(file_read) data_list = list(reader) print("Ok!") # Let's check how many rows do we have print("N...
995,540
466cf315c28ee71b1e3127eec4aa892e37065782
#!/usr/bin/python3 import argparse import toml import os import sys from getosmapsgpx import get_gpx curl_help_str="A good firefox curl command to get an OS maps GPX file\n\ Go to firefox, perform a legitimate GPX download with the network monitor open\n\ Then right click the event, copy curl, then paste into this f...
995,541
d474678c63a51ce4794a5ab31794376ca546f42a
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sun Jul 25 22:55:17 2021 @author: ayla """ import rospy from geometry_msgs.msg import Twist, Point from nav_msgs.msg import Odometry from tf.transformations import euler_from_quaternion from math import atan2 import numpy as np import random import operato...
995,542
fb4f92e9d94c51e9bdde05a4a0f76eb82819e39d
from socket import MsgFlag import pytest import numpy as np import CompOSE_to_SC.conversion as conversion import CompOSE_to_SC.download as dl import h5py import os import shutil h5_files = [] def look_for_test_file(): '''Looks for test files in the TestFiles directory. If no files are found, LS220 is download...
995,543
b99a19d0e43f3d95c92fe7cce5d8977b6c2c5be4
# -*- coding: utf-8 -*- __all__ = ["Base_cir", "Orig_cir", "Elev_cir", "Slope_cir", "Tpi_cir"] from .base_cir import Base_cir from .orig_cir import Orig_cir from .elev_cir import Elev_cir from .slope_cir import Slope_cir from .tpi_cir import Tpi_cir
995,544
18ed417c08c6dd597aa1be60bc95824fa44faf49
import FWCore.ParameterSet.Config as cms rootTupleTracks = cms.EDProducer("BristolNTuple_Tracks", Prefix = cms.string('Track.'), Suffix = cms.string(''), )
995,545
66027a655aab49f67ee891f399687e770757ae6b
import itertools from multiprocessing import Pool def genc(ab, p): a, b = ab c = p-a-b if c < 0: return None elif a**2 + b**2 == c**2: return (a, b, c) def lengths(p): ab = itertools.combinations(range(1, p+1), 2) coords = map(lambda x: genc(x, p), ab) coords = [x for x i...
995,546
56924c634d810eba166c4290d335569c074e34a8
import turtle def main(): #put label on top of page turtle.title("Hello World") #set up screen size turtle.setup(500, 500, 0, 0) #move turtle to origin turtle.penup() turtle.goto(0,0) # set the color to navy turtle turtle.color("navy") # write the message turtle.write("Hello World", fo...
995,547
978327732d78f6f9e8eabd507e35021ac44995de
from django.db import models class AudioBook(models.Model): file_field = models.FileField(upload_to='documents/')
995,548
614cd5d5a27acd607b46c4517c2b678e5a201979
import sys import math T = int(sys.stdin.readline().rstrip()) for i in range(T): x, y = map(int, sys.stdin.readline().rstrip().split()) dist = y - x p = int(math.sqrt(dist)) remain = math.ceil((dist - (p * p)) / p) print(p * 2 - 1 + remain)
995,549
119c51a43dc12b746b1e77b6a5038765f3377e03
from notification.webhook import Discord
995,550
ec902e2fcc06489abaa56839de28d22e55dd13b3
#FTP Client Side Code import socket s = socket.socket() #declare socket variable port = 8888 s.connect(('192.168.56.101', port)) #established connection to the server print("connected to server:") filename = input(str("Rename file as : ")) #enter what name file you want to save, you can rename it file ...
995,551
218700713b29ab3e1cf0c211ebcb9eec19902634
from datetime import datetime, timedelta from jose import JWTError, jwt from schema import TokenData # for production is value has to be newly generated with: # opensl rand -hex 32 SECRET_KEY = "09d25e094faa6ca2556c818166b7a9569b93f7099f6f0f4caa6cf63b88e8d3e7" ALGORITHM = "HS256" ACCESS_TOKEN_EXPIRE_MINUTES = 120 d...
995,552
0cb71baceb4ef32b2e1ff80843c4ab42b6cade55
""" This file contains Belief classes, which store and update the belief distributions about the user whose reward function is being learned. :TODO: GaussianBelief class will be implemented so that the library will include the following work: E. Biyik, N. Huynh, M. J. Kochenderger, D. Sadigh; "Active Preference-Ba...
995,553
607b7628467d5a2ff88103f315478393653fa5c5
# -*- coding: utf-8 -*- """ Das Modul pickle ist genau dafuer gedacht persistente Speicherung von Objekten & Lesen von Objekten Serialisierung & Deserialisierung Folgende Typen gehen: None, False, True numerische Typen(int, float, complex, bool) str, bytes sequentielle Typen (tuple, list) Mengen(set, fr...
995,554
47c2c7d568dd75b56d16e6892eacc6170b225b7d
def sayHi(): print('Hi, this is my module speaking. ') __version__ = "0.1" #end of module, will be used in mymodule_demo.py
995,555
d72eeb084e580d54f3830ddfb88bc90c7d5f7f83
# -*- coding: utf-8 -*- # @Time : 2018/01/11 1:33 # @Author : Yu Bowen # @Site : www.ybwsfl.xin # @File : OpenCV转换成PIL.Image格式.py # @Software: PyCharm # @Desc : # @license : Copyright(C), NJUST # @Contact : yubowen_njust@163.com # @Modified : import cv2 from PIL import Image import numpy img = cv2.imrea...
995,556
9ce16fa272d7d99a749375f82a9ed49299c6dbde
from gPhoton.gMap import gMap def main(): gMap(band="NUV", skypos=[219.137042,1.636906], skyrange=[0.0333333333333,0.0333333333333], stepsz = 30., cntfile="/data2/fleming/GPHOTON_OUTPUT/LIGHTCURVES/sdBs/sdB_LBQS_1434+0151/sdB_LBQS_1434+0151_movie_count.fits", cntcoaddfile="/data2/fleming/GPHOTON_OUTPUT/LIGHTCURVES/sd...
995,557
661a44f6e222121715858c79cd75849f6c5bd5ef
#!/usr/bin/env python import numpy as np import sys import os from globalfile import readglobal from parallelfuncs import hist import argparse import matplotlib.pyplot as plt parser = argparse.ArgumentParser(description='Transform numpy vectors to txt') parser.add_argument("file", type = str, nargs='+', help = "files...
995,558
79c6783e33dadd8620b0f41552ff6c4406993c9b
from django.core.exceptions import ObjectDoesNotExist from django.shortcuts import render, redirect, get_object_or_404 from cart.models import Cart, CartItem from shop.models import Product import stripe from django.conf import settings from order.models import Order, OrderItem from django.template.loader import get_te...
995,559
e931ad586028b0ed3b0d49fdc13f7a1e1e453b19
class Customer: def __init__(self, name: str, cpf: str): self.__name = name self.__cpf = cpf @property def name(self): return self.__name @property def cpf(self): return self.__cpf
995,560
b3e16a1cd2f1bc4c1120650d8b87182874da0944
from sqlalchemy import Column, String from sqlalchemy.orm import relationship from gtfsjpdb.models.base import Base class Office(Base): filename = "office_jp.txt" __tablename__ = "office" id = Column(String(255), primary_key=True, nullable=False) name = Column(String(255), nullable=False) url = ...
995,561
33d69c9f60b026c3e2830914e38ebb1455a8488d
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Sep 15 18:58:14 2020 @author: olamijojo """ from graphics import * #def createWindow(): # Creates a 500x500 window titled "Linear Regression" and draws # a "Done Button" in the lower left corner. The window coords # run from 0,0 to 10...
995,562
bc779ab073060a898135543e12214d2ec6f623a7
# coding=UTF-8 # 分析继承关系 import re import iwc_heder_db import os # class-dump 导出头文件所在的目录 IPA_HEADER_PATH = '/Users/wangsuyan/Desktop/baidu/reverse/header/wechat' def iwc_parse_header(): dirs = os.listdir(IPA_HEADER_PATH) for file_name in dirs: header_path = IPA_HEADER_PATH + '/' + file_name # 解析 hea...
995,563
e72eea4b90fca7e8d706174ef7ee5af5964beefe
a = int(input("ingresa un numero ")) b = int(input("ingresa otro numero ")) if a%2 == 0 and b%2 == 0: print("los 2 numeros son pares") elif a%2 == 0 and b%2!=0: print("el numero "+str(a) + " es par y el numero "+str(b)+" no es par") elif a%2!= 0 and b%2 == 0: print("el numero "+str(b) + " es par y el num...
995,564
9ceaafda4708a8c062c952eb4f8058f5db17437f
from django.contrib import admin from formularioPersona.models import Persona class PersonaAdmin (admin.ModelAdmin): list_filter=("genero","experiencia","cargo") list_display=("nombre","email","tamano_empresa","pais","edad","estudios","genero","ingles_hablado","ingles_escrito","actividad","contrato","cargo","ex...
995,565
b97180d1c2ae030fbeceeda7a282a1fde24246d1
""" Binomial Coeffiecient nCk using DP. DP - Pascals' Triangle Using 2D Array to built up to n rows of the triangle """ def nCk(n, k): C=[[0]*(k+1) for i in range(n+1)] for i in range(n+1): for j in range(min(i+1,k+1)): if j == 0 or j == i: C[i][j]=1 ...
995,566
368b005c943703aead9b3439b2bd38ac9a0f0691
import details name='mukesh' print details.name print name
995,567
948d445195088d0830d98421f2c06ede806b01ac
import pandas as pd def display_scraped_data(ids, names, p_links, c_links, cl_links): """ Helper function to display the list of data scraped from the FIFA website :param ids: IDs of players from all scraped pages :param names: Names of players from all scraped pages :param p_links: Links of playe...
995,568
39a462d9e783a94efdefba4dc763f6566e9db13e
# Copyright (c) 2019 Riverbed Technology, Inc. # # This software is licensed under the terms and conditions of the MIT License # accompanying the software ("License"). This software is distributed "AS IS" # as set forth in the License. import os import unittest import shutil import logging from reschema.util import ...
995,569
e82682efec459bfa30bcf025b854068202e197cd
from django import forms from .models import unidad,leccion class Unidad(ModelForm): class Meta: model = unidad
995,570
acb7d5dec2ea2a6f215e37099126d7a533404a10
import os import time import dill as pickle import browser_cookie3 from requests_html import HTMLSession import smtplib def save_cookies(output_path): cookies = browser_cookie3.chrome(domain_name=".amazon.com") with open(output_path, "wb") as f: pickle.dump(cookies, f) def check_availability(url, c...
995,571
437a055172a8cc174224553737a2af913c2efc9c
# -*- coding: utf-8 -*- from flask import Flask, render_template, request, session, send_file, send_from_directory, redirect, url_for from werkzeug.wrappers import BaseRequest, BaseResponse from urlparse import urlparse import sys, time, io, os import urllib import gradeScore reload(sys) def uri_validator(x): if x.f...
995,572
556b95e5572c04dd87af8eafa74aef3449d4e03f
import pytest from pmast import ast_type, Pattern from ast import * @pytest.mark.parametrize('text,t', [ ('FunctionDef', FunctionDef), ('Sub', Sub), ('DoesNotExistAtAll', None), ('copy_location', None), # Actually a function ('*', AST), ]) def test_ast_type(text, t): if t is None: with ...
995,573
3391be0425e2e7985babcbb3269105600004abf6
#!/usr/bin/env python3 from contextlib import contextmanager import json import logging import os import sys import tarfile extension_name = "aum" current_dir = os.path.dirname(__file__) archive_root = os.path.join(current_dir, "..", "archive") src_root = os.path.join(current_dir, "..", "src") common_file = "FujirouCo...
995,574
c46b5d23de7eff1504bd7f95ac117adbcb968c0e
import os import shutil import subprocess import sys import tempfile import threading _g_failed = [] def this_location(): return os.path.abspath(os.path.dirname(__file__)) def checkenv(sd_license, release, ssh_key_path): required_vars = ['AWS_ACCESS_KEY_ID', 'AWS_SECRET_ACCESS_KEY',...
995,575
5d42591e0d225cca36e44d4a038cff6b3d51b896
from decorator.translators.translator import TranslatorBase class GermanTranslator(TranslatorBase): def Translate(self, input): self._translator.Translate(input) print("The German translation is: " + self._google_trans.translate(input, lang_tgt='de')) class FrenchTranslator(Transl...
995,576
96cec453891d7219fea8cb5f20a3c2fb7ba32830
# AUTHOR = '' SITENAME = 'telegram logs' SITEURL = 'index.html' # options are taken/set from there as well THEME = '../pelican-themes/Flex' CUSTOM_CSS = 'main.css' PATH = 'tmp/' # general settings MAIN_MENU = False TYPOGRIFY = True TIMEZONE = 'US/Central' USE_FOLDER_AS_CATEGORY = True DELETE_OUTPUT_DIRECTORY = True...
995,577
6c32c2d5d99f4f465ed062dbff2b8d93f6f91e3f
# encoding:utf-8 import os import sys from os.path import dirname father_path = dirname(dirname(os.path.abspath(dirname(__file__)))) base_path = dirname(dirname(os.path.abspath(dirname(__file__)))) path = dirname(os.path.abspath(dirname(__file__))) sys.path.append(path) sys.path.append(base_path) sys.path.append(fathe...
995,578
8ba3d9d368e5fe9fdb34ddf36ad0ee082f8a68a8
# -*- coding: utf-8 -*- ######################################################################## # # Copyright (c) 2016 Baidu.com, Inc. All Rights Reserved # ######################################################################## import md5 import time import urllib import re import sys import scrapy from scrapy.htt...
995,579
ae3f7b0c1b2abc91de8c764054edb3960114612b
nums = [val for val in range(9)] print(nums) class stack(): def __init__(self): self.data = [] def push(self,item): self.data.append(item) def pop(self): return self.data.pop() def __len__(self): return len(self.data) def reverse(sequence): s = stack() rever...
995,580
3e747aa4d0b3f351e9b81f6103661be8bfe9ac7f
import math import os import random import re import sys # Complete the triplets function below. def triplets(a, b, c): #triplet pairs cond a<=b, b>=c a.sort() b.sort() c.sort() c=0 for t1 in a: for t2 in b: if t1<=t2: for t3 in c: if t3>=...
995,581
7e25f3c6495bfb5e9d1f936ca71c1cb4ac30f24b
# Definition for a binary tree node. # class TreeNode: # def __init__(self, val=0, left=None, right=None): # self.val = val # self.left = left # self.right = right from collections import deque class Solution: def levelOrder(self, root: TreeNode) -> List[List[int]]: if not root:...
995,582
3c9405cd158627e712c6eb5d3d812302d60b6d46
import datetime import io import json import os import threading from PIL import Image, ImageDraw, ImageFont from azure.cognitiveservices.vision.face.models import FaceAttributeType from msrest.authentication import CognitiveServicesCredentials from azure.cognitiveservices.vision.face import FaceClient key = "<ENTER ...
995,583
526cc9978923822025240be9c115d16fd135c6b1
'''from tastypie.resources import ModelResource from fuel.models import Vechicle from django.core.serializers import json from django.utils import simplejson class CarDataResource(ModelResource): class Meta: queryset = Cars.objects.all() allowed_methods = ['get'] class ModelResource(ModelResour...
995,584
f6c79522f46a9ddf1e27402ba71261509b9c11d3
import numpy as np def sigmoid(x): x[np.where(x < -60)] = -60 x[np.where(x > 60)] = 60 return 1 / (1 + np.exp(-x)) def relu(x): return np.maximum(x, 0)
995,585
7018f34642e21520856ea328c55f7f7e771f7d62
for num in range (1,100+1): if num>1: for j in range(2,num): if(num % j==0): break else: print (num)
995,586
3789cfda02146a79f1e2e82afc6d0c2e2170ad28
""" UI class. Calls between program modules ui -> service -> entity ui -> entity """ from services.service import ListComplexNr, FilterEndPoint, FilterStartPoint, start_tests from domain.entity import Complex, RealPartException, ImagPartException import random from termcolor import colored class UI...
995,587
8415b19daa7c7d31eab9d55e6da497f9abbdc662
# Copyright (c) 2017 roseengineering import os, sys # bluezero import dbus from gi.repository import GObject from bluezero import dbus_tools from bluezero import constants from bluezero import adapter from bluezero import advertisement from bluezero import localGATT from bluezero import GATT # mqtt import paho.mqt...
995,588
1386fbaea5834169575af940c6eaeb95b7f5741a
poly = { 1: {"id": 1, "hasBlock": False, "hasConcave": False, "hasMirrored": False, "count": 3, "form": [(0, 0), (0, 1), (1, 0)]}, 2: {"id": 2, "hasBlock": False, "hasConcave": False, "hasMirrored": True, "count": 4, "form": [(0, 0), (0, 1), (1, 0), (2, 0)]}, -2: {"id": -2, "hasBlock": False, "hasConcave": ...
995,589
902a0e2d541ebf68a7e5926f3dfdd8248ebc320f
import datetime import sys import re from functools import total_ordering import calendar # Represent a single event on a calendar @total_ordering class Event: # The inputs are of the following types, although endTIme is allowed to be None. # datetime.date date # datetime.time startTime # datetime.time endTime...
995,590
064a9b3ae98f14fe0335b343a9d4dbf3f41ed7c1
from django.db.models import fields from rest_framework import serializers from .models import State, District class StateSerializers(serializers.ModelSerializer): class Meta: model = State fields = ['state_id', 'state_name'] class DistrictSerializers(serializers.ModelSerializer): class Meta: ...
995,591
6482b77ebe857947802a01d174cc4de0816fcbd8
#!/usr/bin/env python import time, math import numpy as np import rospy from sensor_msgs.msg import JointState from std_msgs.msg import Header import ikpy from ikpy import geometry_utils from ikpy.chain import Chain from scipy.spatial.transform import Rotation as R class Rbx1_Kinematics(object): def __init__...
995,592
8bd3f601fd9647d249bfe723ac3ee4549fc82244
"""This module houses functions for parsing file objects from Plotly Dash upload components, hanldes the files with data cleaning and preparation before returning figure objects for charts in the app. This module does the work behind the file selection and uploading of a site userself. author: Babila Lima date: Decem...
995,593
bcb1c881fe76095e5464c5fd229a421138bae1eb
import numpy as np from scipy import signal from scipy.interpolate import interp1d import scipy.integrate as integrate from scipy.special import spherical_jn, sph_harm from scipy.signal import butter, filtfilt, iirdesign, zpk2tf, freqz, hanning import matplotlib.pyplot as plt import matplotlib.mlab as mlab #import ...
995,594
c5e46e0058eec6bbd3d321d6d1f12f4088c075d0
from django.urls import path, re_path from django.conf.urls import url from . import views urlpatterns = [ path('', views.index, name='index'), re_path(r'^keywords/(?P<campaign_id>\d+)/', views.keywords, name='keywords'), #path('keywords/(?P<campaign_id>\w{0,50})/$', views.keywords, name='keywords'), ]
995,595
358cca0af91975aa5a87755e375483105d06ae9a
from enum import Enum class HakAkses(Enum): Admin = 1 Petugas = 2
995,596
48ee38f54ab1464e2cde9e0e8cb06bae461969dc
import scrapy class PollItem(scrapy.Item): date = scrapy.Field() pollster = scrapy.Field() client = scrapy.Field() party = scrapy.Field() share = scrapy.Field()
995,597
f47fbe7bed878cef08fb1760b41c1a81ba4e7cd8
import json def read_json(filename): data = None with open(filename, "r") as f: data = json.loads(f.read()) return data def write_json(data, filename, pretty=False): with open(filename, "w") as f: if pretty: f.write(json.dumps(data, indent=4, sort_keys=True)) else...
995,598
14a307c0ddd2e319a1a09f539b032fed59eac6e5
# Copyright 2021 National Technology & Engineering Solutions of # Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with # NTESS, the U.S. Government retains certain rights in this software. """Test metric descriptors.""" import unittest from random import randint import threading from .metric_descriptor...
995,599
1e33385f586fcbdddb1505ac90c9d50d083eea80
import string as st def print_cat(df, col): gb = df.groupby(col)["churn"].value_counts().to_frame().rename({"churn": "Number of Customers"}, axis = 1).reset_index() t = col[:1].upper() + col[1:] xlabel_rotation = 0 if len(col)>10: xlabel_rotation = 90 ax = sns.barplot(x = col, y = "Number o...