blob_id
large_string
repo_name
large_string
path
large_string
src_encoding
large_string
length_bytes
int64
score
float64
int_score
int64
detected_licenses
large list
license_type
large_string
text
string
download_success
bool
d2ac67c61bd5e156a1900338cf8768d5dd11afd3
SmallMelody/CNN_Scrapy
/CNN_Spider/CNN/spiders/CNNspider.py
UTF-8
9,062
2.78125
3
[]
no_license
# coding = utf-8 import scrapy from scrapy.http import Request import re from CNN.items import CnnItem class cnnSpider(scrapy.spiders.Spider): name = "CNNspider" #爬虫名,供命令scrapy crawl cnnspider使用 allowed_domains = ["cnn.com"] #允许爬虫运行的域 start_urls = ["https://edition.cnn.com/","http://money.cnn.com/"] ...
true
839e6552476922adc6b93a76bd4b9c25512ffa2e
wu00ti/python-practice
/practice13/pictrue.py
UTF-8
784
2.96875
3
[]
no_license
from PIL import Image,ImageDraw,ImageFont import string import random def generate_authenticode(): letters = ''.join([random.choice(string.ascii_letters) for i in range(4)]) width = 100 height = 40 im = Image.new("RGB",(width,height),(255,255,255)) dr = ImageDraw.Draw(im) font = ImageFont.t...
true
d8e8b3369dc7e0a7cdf912985081d4a4bdb769d4
viniCerutti/credit-risk-analysis
/utils.py
UTF-8
1,390
3.703125
4
[]
no_license
import pandas as pd import seaborn as sns import matplotlib.pyplot as plt def plot_hist_box_plot(dados,y,x=None,figsize=(10,5)): """ Metodo que constroi um grafico de boxplot, histograma e analise descritiva sobre aquelas variaveis Parametros ---------- dados : {pandas dataframe} conjunto de dados y : {pand...
true
1773d916ca1edca17182aef39b7531e6a13787b9
levtomer66/cyber_security_trainings
/doulingo/hack_doul.py
UTF-8
2,990
2.96875
3
[]
no_license
# from selenium import webdriver # from selenium.webdriver.chrome.options import Options # chrome_options = Options() # chrome_options.add_experimental_option("debuggerAddress", "127.0.0.1:9014") # driver = webdriver.Chrome(options=chrome_options) import pyautogui import time pyautogui.PAUSE = 0.5 def search_and_cli...
true
0eeb5c85b5a53d4fcb0630c6440326655bcbb79d
nasim-shourav/P2P-OFE
/Off-chain/Step 1/5. HK2.py
UTF-8
1,267
2.578125
3
[]
no_license
############################################################################################### #### This program will hashed the key2 and generate a file of that hash value as an output #### ############################################################################################### from Crypto.Hash import SHA2...
true
cde1b57fd30a12a7fda7b1408f128389d73daef1
RyanLadley/agility
/api/core/workflow/card_workflow.py
UTF-8
7,037
2.546875
3
[]
no_license
from api.core.workflow import workflow from flask import request import api.DAL.data_context.cards.card_update as card_update import api.DAL.data_context.cards.card_insert as card_insert import api.DAL.data_context.cards.card_select as card_select from api.core.enum.card_type import CardType from api.core.admin.auth...
true
a46d621b08fc3f5a3f83cd92ca63ec988df45a9f
Aasthaengg/IBMdataset
/Python_codes/p03102/s654572908.py
UTF-8
269
2.734375
3
[]
no_license
import sys import numpy as np rm = lambda: map(int, sys.stdin.readline().split()) rl = lambda: list(map(int, sys.stdin.readline().split())) n, m, c = rm() b = np.array(rl()) cnt = 0 for _ in range(n): a = np.array(rl()) if np.sum(a*b) > -c: cnt += 1 print(cnt)
true
337af9751eb5aa3e6bda611393763af36ed49512
manpritkaurACST890/git-github.com-manpritkaurACST890-public-repoository
/fiboseq.py
UTF-8
1,601
4.5625
5
[]
no_license
#creating a fibonacci sequence def fibonacci(): num = int(input("How many numbers that generates?:")) # it prints the string and asks the total number to be generated i = 1 if num == 0: # if the given number is 0 i.e if the statement is true fib = [...
true
b83bbe5884df9b96a599a5e67a4c742ce659090b
Bgumel/Automate-The-Boring-Stuff
/Practice-Projects/Ch 18 - Looking Busy
UTF-8
1,449
3.453125
3
[]
no_license
#! python3 # looking_busy.py - will slightly nudge the cursor to prevent from looking idle """ Many instant messaging programs determine whether you are idle, or away from your computer, by detecting a lack of mouse movement over some period of time—say, ten minutes. Maybe you’d like to sneak away from your desk for a ...
true
93222b6adb605b5bc2b7d86f805b86577811c191
lily-dev/RSA-Algo-python
/enc.py
UTF-8
876
2.8125
3
[]
no_license
from Crypto.PublicKey import RSA from Crypto.Random import get_random_bytes from Crypto.Cipher import AES, PKCS1_OAEP class Enc: def encrypt(self): data = "I met aliens in UFO. Here is the map.".encode("utf-8") file_out = open("encrypted_data.bin", "wb") recipient_key = RSA.import_k...
true
a6225b30dbb8599dd3d26de2012be7aac4b04d66
TatyanaGreenkina/AutomatedModule
/app.py
UTF-8
1,328
2.515625
3
[]
no_license
import json from flask import Flask, request, abort, render_template import NeuralNet.CNN as cnn from rankin import Ranking rank = Ranking() cnn_net, prep, index_to_count = cnn.prom_cnn() app = Flask(__name__) @app.route('/add_message', methods=['POST']) def add_message(): if not request.json or not 'str' in re...
true
6341c8c8482f630ef9e40dfe946dabeb340d5b7e
nadjarutsch/InterventionDesign
/causal_graphs/graph_generation.py
UTF-8
8,127
2.609375
3
[]
no_license
import numpy as np from copy import copy, deepcopy from random import shuffle import importlib import random import string import math import sys sys.path.append("../") from causal_graphs.graph_utils import * from causal_graphs.graph_visualization import * from causal_graphs.variable_distributions import * from causa...
true
8bb62447be6b2c97427277ad06a02b15ce14da19
pamtabak/projecteuler
/problem9.py
UTF-8
856
4.28125
4
[]
no_license
# Special Pythagorean triplet # Problem 9 # A Pythagorean triplet is a set of three natural numbers, a < b < c, for which, # a2 + b2 = c2 # For example, 32 + 42 = 9 + 16 = 25 = 52. # There exists exactly one Pythagorean triplet for which a + b + c = 1000. # Find the product abc. def is_pythagorean_triplet(a, b, c):...
true
66bdaa8eade0aa18ee8bdfa0b7e273c2463d12b3
jeffshuang/stockAnalysis
/modules/messageExtract.py
UTF-8
4,484
2.671875
3
[]
no_license
import datetime from dateutil.parser import parse from .helpers import convertToEST from .hyperparameters import constants # ------------------------------------------------------------------------ # ----------------------------- Variables -------------------------------- # ------------------------------------------...
true
56fd8d55065e0e2f253ec4837870909fcc7ee317
SilviuCristian45/Cracking-The-Coding-Interview
/chapter5/5.1/main.py
UTF-8
1,072
3.765625
4
[]
no_license
#You are given two 32-bit numbers, N and M, and two bit positions, i and j Write a method to set all bits between i and j in N equal to M #(e g , M becomes a substring of N located at i and starting at j) EXAMPLE:Input: N = 10000000000, M = 10101, i = 2, j = 6Output: N = 10001010100 #N = int(in...
true
faf47c0deeb3fe8cc17790fc491d4895f842fbee
tiger80156/pythonBasic
/NTUPythonCourse/1024.py
UTF-8
751
2.90625
3
[]
no_license
n = eval(input ("n = ")) x = "" for l in range(int((2*n-1)/2)): x += "-" for l in range(1): x += "*" for l in range(int((2*n-1)/2)): x += "-" print(x) i = 1 x = "" while i < 2*n-3: k = 0 for j in range(3): for l in range(int((2*n-1-k-i)/2)): x += "-" ...
true
3fdc1274266a57419eaa058e43fdcc9dfbf124de
alu0100833218/prct06
/src/eje1.py
UTF-8
436
3
3
[]
no_license
#! /usr/bin/python #!encoding: UTF-8 import sys PI = 3.14159265358979323846264338327950288 n = int(sys.argv[1]) v = int(sys.argv[2]) lista = [] def g(n): if (n!=0): suma=0 for i in range (1, n+1): a = float (i-1)/n b = float (i)/n xi = (i-0.5)/n fxi = 4.0/(1.0 + xi*xi) suma += f...
true
278231e37e9d07454e84d05bd34a8fd53956b949
pave-sh/stepik-auto-tests-course
/part_2/lesson_3/step_4.py
UTF-8
1,173
2.921875
3
[]
no_license
import os import math import time from selenium import webdriver cur_path = os.path.dirname(os.path.abspath(__file__)) file_to_upload = os.path.join(cur_path, 'text.txt') with open(file_to_upload, mode='w', encoding='utf-8') as f: f.write('test') def calc(x): return str(math.log(abs(12*math.sin(int(x)))))...
true
4b1b88d1cb4e41e35c1bf2a2bb5467b4cbd85630
timed1975/testrepos
/loan/showloan.py
UTF-8
3,278
2.84375
3
[]
no_license
import LoanModule import os from sys import argv attributes_table = "\ <tr> <td>Origination Date</td> <td>{:s}</td> </tr>\ <tr> <td>Amount</td> <td>${:.2f}</td> </tr>\ <tr> <td>Interest Rate</td> <td>{:.2f}%</td> </tr>\ <tr> <td>Lifetime</td> <td>{:d}</td> ...
true
0e8d6f51ef49ccdebcff95a002f3e8f0bb8ec97d
smksevov/Grokking-the-coding-interview
/two pointers/remove duplicates.py
UTF-8
1,326
4.46875
4
[ "MIT" ]
permissive
# Given an array of sorted numbers, remove all duplicates from it. # You should not use any extra space; after removing the duplicates in-place return the new length of the array. # Example: # Input: [2, 3, 3, 3, 6, 9, 9] # Output: 4 # Explanation: The first four elements after removing the duplicates will be [2, 3, ...
true
6e583c92d14595f0959be4413bf59df2dbabceb5
Shiv2157k/leet_code
/goldman_sachs/longest_word_in_dictionary.py
UTF-8
1,290
3.96875
4
[]
no_license
from typing import List class TrieNode: def __init__(self): self.children = {} self.end = False class Dictionary: def longest_word(self, words: List[int]): """ Approach: Trie Data Structure Time Complexity: O(Ewi) Space Complexity: O(Ewi) :param word...
true
e503800c1423fba841e1bdd39363508787a4658e
alfredolimams/DrawGraph
/Test.py
UTF-8
364
2.84375
3
[]
no_license
import DrawGraph V, E = map( int , input().split() ) vertices = [] edges = [] for i in range(V): vertices.append( input() ) for i in range(E): u , v = input().split() edges.append( (u,v) ) draw = DrawGraph.DrawGraph( vertices = vertices , edges = edges , weight = [1,2] , directed=True ) draw.colorVertices([], '...
true
6b1b62fd0f35c2b5144249043dbf8ff696b0694a
codeezer/cgp-robots
/main.py
UTF-8
976
2.671875
3
[]
no_license
import numpy as np from pd import track import time import math def main(): #scaling factors #sfx = 30.0/140.0 #sfy = 30.0/144.0 #scaling factors sfx = 30.0/152.0 sfy = 30.0/152.0 tfx = 68 tfy = 60 y_off = 2/sfy ball = np.array([]) robot1 = np.array([]) robot2 = np....
true
f2af4c1eb1f04c63854a3869a04a68ea86797adf
ScoutTex/RacingLine
/rct.py
UTF-8
1,746
3.234375
3
[]
no_license
from pos import Pos from vel import Vel class Rct(Pos): # rectangle width = 0 height = 0 def __init__(self, left=0, bot=0, width=0, height=0): self.left = left self.bot = bot self.width = width self.height = height def __str__(self): return 'Rct(%.2f, %.2f, %...
true
7742066fb425b7cb42adf7646eeabfb7352725b4
bullet1337/codewars
/katas/Python/4 kyu/Chess Fun 8 Amazon Checkmate 5897f30d948beb78580000b2.py
UTF-8
1,493
3.078125
3
[]
no_license
# https://www.codewars.com/kata/5897f30d948beb78580000b2 def amazon_check_mate(king, amazon): desk = [[0] * 8 for _ in range(8)] k_x, k_y = ord(king[0]) - ord('a'), int(king[1]) - 1 a_x, a_y = ord(amazon[0]) - ord('a'), int(amazon[1]) - 1 for move in [[0, 1], [0, -1], [1, 0], [-1, 0], [1, 1], [1, -1],...
true
6d44c997ec3f73434d611a4394a00ff666114686
OLC-LOC-Bioinformatics/genemethods
/genemethods/coreGenome/core.py
UTF-8
15,439
2.703125
3
[ "MIT" ]
permissive
#!/usr/bin/env python3 from olctools.accessoryFunctions.accessoryFunctions import MetadataObject from genemethods.geneseekr.blast import BLAST from Bio import SeqIO from csv import DictReader from glob import glob import operator import logging import os __author__ = 'adamkoziol' class CoreGenome(BLAST): def pa...
true
0e114b44006a81645cd5bee5b68f9630429ee216
Lexxsage/Networks2020
/5 broadcat chat/main.py
UTF-8
1,210
3.234375
3
[]
no_license
import socket from threading import Thread import queue def receiver(socket, message): while True: # socket.recvfrom (bufsize) which returns us data and the address of the socket from which this data was received message, addr = socket.recvfrom(1024) print('from:', addr, ': ', message.deco...
true
c2e33f646e95742b62da2c68d60c9519ba1511fa
Aasthaengg/IBMdataset
/Python_codes/p02973/s628246146.py
UTF-8
540
2.90625
3
[]
no_license
from bisect import bisect icase=1 if icase==1: n=int(input()) a=[0]*n for i in range(n): a[i]=-int(input()) elif icase==2: n=5 a=[-2,-1,-4,-5,-3] elif icase==3: n=4 a=[0,0,0,0] def loopa(): n=len(a) dp = [10**10]*(n+1) dp[0] = -10**10 for i in range(n): # ...
true
25d338ab8ce6e9ba97ff6b7eb81a39c495d56464
Shubhanshu-Nishad/python-pratices-series
/ap.py
UTF-8
554
3.796875
4
[]
no_license
# Python Program to find nth terms & Sum of Arithmetic of nth terms # Sum of A.P. Series : Sn = n/2(2a + (n – 1) d) # Tn term of A.P. Series: Tn = a + (n – 1) d # where, a= first terms=2 ,3,100 # d= constant difference =2,3 # n= no of terms # example: 2,4,6,8,10,... # 3,6,9,12,... # ...
true
2d05b0dfba20cfde24d21b50917c65854210725d
MikhailRyskin/Lessons
/Module14/05_least_divisor/main.py
UTF-8
372
3.796875
4
[]
no_license
import math def min_divider(number): min_divider = number for k in range(2, int(math.sqrt(number)) + 1): if n % k == 0: min_divider = k break return min_divider n = int(input('Введите число: ')) print('Наименьший делитель, отличный от единицы:', min_divider(n)) # зачёт!
true
0a47002d426273d25e23b6e377ae88c8d9fe45f1
nullg0re/firefox-launcher
/firefox-launcher.py
UTF-8
1,211
3.15625
3
[]
no_license
#!/usr/bin/python3 import sys, os, subprocess import argparse from colorama import Fore, Style def cut_list(list_, n): for i in range(0, len(list_), n): yield list_[i:i +n] def get_args(): parser = argparse.ArgumentParser(description="Firefox Launcher") parser.add_argument('-f','--file',type=argparse.FileType('r...
true
6c49373dcb44723de58608b9fd6cb28cfd1eb6fe
gitgirish2/HydPy
/code/memory_game.py
UTF-8
1,108
3.03125
3
[ "MIT" ]
permissive
# This examples also demonstrates the use of "SLOTS" along with INTENTS # and is built on top of flask ask import logging from random import randint from flask import Flask, render_template from flask_ask import Ask, statement, question, session app = Flask(__name__) ask = Ask(app, "/") logging.getLogger("f...
true
0e6cb18b721b54fb5bd3181ec147e520bc6799ab
yuodajima/ProgrammingLanguageExperiment
/L09-11/source/kadai4.py
UTF-8
3,326
2.625
3
[]
no_license
# -*- coding: utf-8 -*- import numpy as np import scipy as sp import scipy.fftpack as spf from scipy.io.wavfile import read, write import matplotlib.pyplot as plt ifname1 = 'KnoiseColored.wav' # 入力ファイル名 ifname2 = 'HAL0001noiseColored.wav' # 入力ファイル名 ifname3 = 'HAL0002noiseColored.wav' # 入力ファイル名 o1fname1 = 'voice...
true
d31d9644860881f4ea20101fabfdaa1a92b283dd
frikky/WALKOFF
/api_gateway/server/problem.py
UTF-8
3,685
2.75
3
[ "CC0-1.0" ]
permissive
import json from flask import Response, current_app from http import HTTPStatus class Problem(Response): """Returns a Problem Details object complying with RFC 7807 .. https://tools.ietf.org/html/rfc7807 Args: status (int): The HTTP status code generated for this occurrence of the problem ...
true
b939466bfe15174a6580c6be05eb3822ffc0bea9
arw2019/AlgorithmsDataStructures
/Pour Water/Leetcode_755.py
UTF-8
1,303
3.046875
3
[]
no_license
from heapq import heappush, heappop class Solution: def pourWater(self, hts: List[int], V: int, K: int) -> List[int]: n, lHeap, rHeap = len(hts), [], [] def moveLeft(l: int) -> int: while l>0 and hts[l] >= hts[l-1]: l -= 1 heappush(lHeap,...
true
13383515630f5fb5f0bc26fc399fc9e0cf1b6d3b
mcfair/Algo
/Union Find/547. Friend Circles.py
UTF-8
1,083
3.203125
3
[]
no_license
class Solution(object): def findCircleNum(self, M): """ :type M: List[List[int]] :rtype: int """ if not M or not M[0]: return 0 m = len(M) self.papa = {} self.rank = {} self.count= 0 for i in range(m): ...
true
f367f6c744175c08c3d4f0c32d3ede10d92cbcae
micktsai/NP_HW
/server.py
UTF-8
5,213
2.5625
3
[]
no_license
import socket import argparse import random import threading import time HOST = '127.0.0.1' PORT = 8000 parser = argparse.ArgumentParser() parser.add_argument("-host","--host", nargs='?', default=HOST) parser.add_argument("-port","--port", nargs='?', default=PORT) args = parser.parse_args() PORT = int(args.port) HOST ...
true
8face4d317f0f9057e1fcea574274cc0fa26dc1c
3JohnJL/Correlation-Matrix
/main.py
UTF-8
2,361
2.5625
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Tue Nov 1 01:16:05 2016 @author: lydia jj """ xS={} xDr={} xSc={} xDrc={} data=open('maindata2.txt','r') for i in range(6): mydata=data.readline() s=mydata.split() point=s[0] S=float(s[1]) Sc=float(s[2]) Dr=float(s[8]) D...
true
3323b73a5039906e9f267a1635c7d49b371dba7c
PHoenjx/PHoenjx_Backup
/Backup.py
UTF-8
5,373
2.640625
3
[]
no_license
#!/usr/bin/python3 # -*- coding: utf-8 -*- from PIL import ImageTk, Image import tkinter as tk from tkinter import filedialog from tkinter import ttk import zipfile import datetime import os today = datetime.datetime.today() backup_filename = 'Backup_' + today.strftime('%d-%m-%Y_%H.%M') language_dict = { 'RU': ...
true
81098d3b4ffcd2dbb25fc13cf01bb3146b3683eb
lyx-1/Python-Spider
/58_urllib.py
UTF-8
1,020
2.875
3
[]
no_license
import urllib.request import re import ssl def crawl_58(position): try: # urllib打开https连接的时候会验证ssl证书 # 如果对方的ssl证书是自带的就会报错 # 这时候可以选择取消全局证书验证 、 或者创建一个未验证的证书传入到urlopen context = ssl._create_unverified_context() url = "https://nj.58.com/tech/?key=python&cmcskey=" + position + ...
true
6f469bf4089144f8168663c1eb1a0018e3fec8b8
SeemSach/meter_to_feet
/backend.py
UTF-8
100
3.21875
3
[]
no_license
def meter_to_feet(meters, coefficient=3.28084) : feet = meters*coefficient return feet
true
e9484c1d77bc044ebf98159e5f2068d85307eccd
samguns/rubik_stuffs
/serial_test/main_bcc.py
UTF-8
869
2.71875
3
[]
no_license
# -*- coding: utf-8 -*- __author__ = 'sam' from serial import * ser = Serial() ser.port = 3 ser.timeout = 0 try: ser.open() except: print("Can not open COM3") while(1): out_data = '\x09\x00\x80\x09\x05\x05\x41\x42\x43\x44\x00' ser.write(out_data) try: #print ("Read %d" % i) text = se...
true
8e61b86168287cda53b3f6529d1e90ea992e2838
NWood-Git/other_challenge_questions
/product_range.py
UTF-8
737
4.21875
4
[]
no_license
# F(6,20) -> 3 Done 3/6/2020 # Given F(A,B) return the number of integers from the range [A,B] that can be expressed as a product of 2 consequtive numbers # F(6,20) = 3 because 6=3*2, 12=3 * 4 and 20 = 4* 5 # neat question, can be done in O(B-A) # actually can be done in O(1) import math def product_range_old(num1, ...
true
1ce8ee5e35567073921f87c8ee27787f1606eb8e
SscorpionK/python_stuff
/ej2-3-salario.py
UTF-8
146
3.125
3
[]
no_license
horas = raw_input("introduzca horas: ") tarifa = raw_input("introduzca Tarifa: ") salario = int(horas) * float(tarifa) print("Salario:"), salario
true
3387976b2e289417c3eb0b251d52aea1df803653
tperez/shiny-new-project
/reminder/reminder.py
UTF-8
554
3.15625
3
[]
no_license
from datetime import date, timedelta from average_days_between import AverageDaysBetween class Reminder: def __init__(self, today): self.today = today self.averageDaysBetween = AverageDaysBetween(self.today) def shouldRemind(self, dates): if len(dates) < 2: return False averageDays = self.a...
true
490bea4fd1e8614ca4191303ebf525788c695ed6
rakiasomai/holbertonschool-higher_level_programming
/0x10-python-network_0/6-peak.py
UTF-8
141
2.734375
3
[]
no_license
#!/usr/bin/python3 ''' find the peak ''' def find_peak(list_of_integers): ''' def find_peak ''' return find_peak(list_of_integers)
true
7f902e9ca849da2b9e28e7f8405a665cca08babd
mheden/adventofcode2020
/08.py
UTF-8
1,282
3.328125
3
[ "MIT" ]
permissive
from utils import read_file def run(program): seen = set() ip = 0 acc = 0 while True: if ip in seen: return ("hang", acc) seen.add(ip) try: op, arg = program[ip].split(" ") except IndexError: return ("done", acc) arg = int(arg...
true
c63fefaa7631cd1e026bf5aabcbb34893f526c87
V07D/findastupid
/randomusers.py
UTF-8
723
2.671875
3
[]
no_license
# coding: utf-8 from flask import Blueprint, jsonify import random import os randomusers = Blueprint('randomusers', __name__, static_folder='static') names = [ 'Чоткий', 'Ровный', 'Мутный', ] surnames = [ 'Честный', 'Сложный', 'Дерзкий' ] directory = os.path.join('static', 'img', 'avatars') ...
true
644b66f59eb8e1ed538398c4f48d0a788a2ca9d1
luukhoai/flask-simple-project
/models/users.py
UTF-8
777
3.046875
3
[]
no_license
from settings.settings import app user_id = 0 class User(object): def __init__(self, name): self.user_id = self.generate_id() self.name = name @staticmethod def generate_id(): """ Generate user_id :return: eg: user_1 """ global user_id u...
true
ffbbd394031ff328cb66e0f25adc3bb45483df93
hamzaghojaria/Projects
/Email Classification.py
UTF-8
1,340
3.046875
3
[]
no_license
import pandas as pd from nltk.corpus import stopwords from nltk import stem from sklearn.model_selection import train_test_split from sklearn.feature_extraction.text import TfidfVectorizer from sklearn import svm from sklearn.metrics import confusion_matrix from nltk.stem.porter import PorterStemmer data = pd...
true
577d901aa8d19b17d429a09565e1cdb387994986
andshin/Intro-to-Python
/Chapter 2/3-variables.py
UTF-8
404
3.96875
4
[]
no_license
# Page 16. Finger exercise. # Write a program that examines x,y,z and prints the largest odd nubmer among them. If none of them are odd, print some msg. x,y,z = 2,54,1 a,b,c,k = 0,0,0,0 if x % 2 != 0: a = x else: k += 1 if y % 2 != 0: b = y else: k += 1 if z % 2 != 0: c = z else: k += 1 ...
true
42b94a3d4760824ae9e02902320573a2cbc5f7cd
enderst3/challenges
/written_numbers.py
UTF-8
892
4.71875
5
[]
no_license
""" Write a function that asks for a number in base-10 that's between 1 and 99 then prints out the name of it in English. >>> written(42) 'fourty-two' >>> written(1) 'one' >>> written(99) 'ninety-nine' """ ones_teens = {1: 'one', 2: 'two', 3: 'three', 4: 'four', 5: 'five', 6: 'six', 7: 'seven', 8: 'ei...
true
2be0dcc4bc09df9d8bbbdc4cc2605b569a01ffb3
sadighian/crypto-rl
/indicators/indicator.py
UTF-8
6,464
3.03125
3
[]
no_license
from abc import ABC, abstractmethod from collections import deque from typing import List, Tuple, Union from configurations import INDICATOR_WINDOW from indicators.ema import ExponentialMovingAverage, load_ema class Indicator(ABC): def __init__(self, label: str, window: Union[int, None] = INDIC...
true
29c3cdbc48be8f14c015a2b17b3155bfecfe6c63
liucheng2912/py
/100例/46.py
UTF-8
237
3.515625
4
[]
no_license
""" 求输入数字的平方,如果平方运算后小于 50 则退出。 """ def f(n): sum=n**2 if sum<50: return else: print(sum) return sum if __name__=='__main__': n = int(input()) f(n)
true
fbd501e523ecdbc94e28e872d09ed7dd94ff981f
TheFuryPT/MotherTips
/bot.py
UTF-8
14,861
2.953125
3
[]
no_license
import os import random import discord #------------------------------------------------------------------------------------------------------------------------------ token_txt = open('token.txt', 'r') token = token_txt.read() dicas = [ "**A tua mae é como uma lareira: cabe sempre mais um pau!**", ...
true
3fca2b05ec5801ecb6cbb38c76c5de0bc687f55d
jacopofar/markov-avro-tools
/remove_punctuation.py
UTF-8
840
3.265625
3
[]
no_license
import argparse import re parser = argparse.ArgumentParser(description="creates a lowercase, no-punctuation copy of a plain text file") parser.add_argument("-input_file", type=str, help="the path of the input file") parser.add_argument("-output_file", type=str, help="the output text file", default="nopunct.txt") parse...
true
3a7c99f9548f7e6f7b9f0e16f946e3dbb3eae5ac
naomi397liu/AlgorithmPactice
/search_insert.py
UTF-8
473
2.703125
3
[]
no_license
def searchInsert(self, nums, target): """ :type nums: List[int] :type target: int :rtype: int """ if target <= nums[len(nums)-1] and target >= nums[0]: for i, num in enumerate(nums): if num == target: return i elif num < target and nums[i+1] > tar...
true
f7a454c551659cd190b0072deffd9192fc2a9baf
xlq246860/Estimation-of-distribution-algorithms
/Algorithms/Old/test_exp.py
UTF-8
392
2.625
3
[]
no_license
import random import math theta = 1 j = 1 n=5 sum_probs = 0 def Psi_j(j,Theta,n): return (1-math.exp(-(n-j+1)*Theta))/(1-math.exp(-Theta)) def SampleProbDist(theta, j, n): prob = 0 rand = random.random() n = 5 prob = 0 for r in range(n): prob += math.exp(-theta*r)/Psi_j(j,theta,n) print(prob) ...
true
740950c13ddbf3b4ddb60c6f319c44223ab0e564
azwad-chowdhury/Quote_wc
/quote/quote/spiders/khabib.py
UTF-8
462
2.515625
3
[]
no_license
# -*- coding: utf-8 -*- import scrapy class KhabibSpider(scrapy.Spider): name = 'khabib' allowed_domains = ['brainyquote.com'] start_urls = ['http://brainyquote.com/authors/khabib-nurmagomedov-quotes/'] def parse(self, response): info = response.xpath('.//*[@class = "clearfix"]') for...
true
29ed7b84e93744b06f87a23799df22087fb8c28c
do-while-1/josephus
/josephus.py
UTF-8
384
3.234375
3
[]
no_license
N = 500 K = 1 group = [] for i in range(1, N+1): group.append(i) def remove(lista): osoitin = K - 1 while len(lista) > 1: lista.pop(osoitin) osoitin += K - 1 if osoitin > len(lista): osoitin = osoitin - len(lista) if osoitin == len(lista): osoit...
true
8c8de24be6740dbd430af067494c3c74c6f277bd
Indigo744/ovh-manage-email-alias-python
/ovh_mail_alias_ls.py
UTF-8
685
2.640625
3
[ "MIT" ]
permissive
# -*- encoding: utf-8 -*- import config # config file import os # Make sure we are in script's directory for ovh module to find its ovh.conf file os.chdir(os.path.dirname(os.path.realpath(__file__))) # OVH API python wrapper import ovh # API endpoint for email redirection base_api_endpoint = "/email/domain/%s/redirec...
true
8b6eb2890122a1c3670ed95f60ddc99fd9c320a1
Aasthaengg/IBMdataset
/Python_codes/p03737/s142148537.py
UTF-8
74
3.0625
3
[]
no_license
a = input().split() print(a[0][0].upper()+a[1][0].upper()+a[2][0].upper())
true
2ef5d536438562ac21f541498f45f55593339b7e
gustavoortega/urlscan-api-wrapper
/urlscan-api-wrapper.py
UTF-8
5,085
3
3
[]
no_license
import requests import json import boto3 import time import argparse my_parser = argparse.ArgumentParser(description='Escanear una url con UrlScan y subir el resultado a S3') my_parser.add_argument('--url', metavar='url', type=str, requ...
true
26feae8a91949000bdb4656732ec5221691673e6
filipolszewski/aoc2020
/day12/solution.py
UTF-8
1,992
3.4375
3
[]
no_license
north, south, east, west = (0, -1), (0, 1), (1, 0), (-1, 0) rotation_dict = {"R": {east: south, south: west, west: north, north: east}, "L": {east: north, north: west, west: south, south: east}} direction_dict = {"N": north, "S": south, "E": east, "W": west} def get_relative_pos(waypoint): ...
true
92f0a1a78fa5aa607a64cfe251f2217cc7f18cb4
CristyanGil/CursoBase
/variables.py
UTF-8
473
3.46875
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Tue Nov 19 16:37:58 2019 @author: Cristyan Gil """ ### Variables #### saludo = "Hola Mundo" n = 522 pi = 3.1416 c = 6.32+45j condicion = True print(saludo) print(n) print(pi) print(c) print(condicion) ### Modificar Variables ### n = 1290 print(n) ### Nombres inco...
true
12233c41ab8fe842723ae4f9841bea083074c68a
msaidzengin/leetcode
/46_permutations/4.py
UTF-8
565
3.078125
3
[]
no_license
class Solution(object): def permute(self, nums): """ :type nums: List[int] :rtype: List[List[int]] """ res = [[]] for num in nums: new_res = [] for i in range(len(res)): prev = res[i] prev.append(num) ...
true
81a709b6a502228318ced25dfcfe6fbc241319f6
MattDawson2020/Python-basics
/more_about_functions/multiple_arguments.py
UTF-8
1,191
4.4375
4
[]
no_license
#multiple arguments def area(a, b): return a * b #keyword and non keyword arguments print(area(4,5)) #non keyword argument print(area(b=4, a=8)) #keyword argument, similar to ruby hash arguments, position does not matter and can be specific #default parameters def default_area(a=5, b=5): return a * b #defaul...
true
671c29499a0b62edfebf1d06abb7a2de69151080
solaxu/Touhou-Tactics
/GUI.py
UTF-8
51,008
2.578125
3
[]
no_license
# _*_ coding: utf-8 _*_ import pygame import Queue from Event import * from Skill import * class Gui_Enum(Enum): WND_BORDER_WIDTH = 2 Character_Plane = 10000 Character_Control_Menu = 10001 Character_Skill_Item_Menu = 10002 Character_Ban_Pick = 10003 class GuiElement(EventObject): def __ini...
true
d544d4b4bd5655a0cf3166c316a1ba141c2815bb
syurskyi/Python_Topics
/090_logging/examples/github/_logging_examples-master/py26_logger/src/main.py
UTF-8
2,053
2.78125
3
[ "MIT" ]
permissive
#!/usr/bin/env python2 # -*- coding: utf-8 -*- """Python2.6+ compatible logging setup module to be used as point-of-entry to a program.""" import os import optparse import logging import logging.config import example_package.example_module # We imported example_module before setting logging configuration. # This can...
true
099a8192bd25cde80f0acdb45ab5152fe16de861
BenedictSu/CViA-Parser-Analyser
/Analyser.py
UTF-8
1,703
2.921875
3
[]
no_license
from sets import Set from Parser import Parser class Analyser: pLang = Set(["c++", "objective c", "c#", "java", "swift", "python", "cobol", "haskell", "javaSctipt", "latex", "matlab", "objective-c", "pascal", "php", "prolog", "ruby", "scheme", "tex", "unity", "unix shell"]...
true
0b515ba7c5452f418fbabae6e6d391e909f3c1b1
HayaoSuzuki/atcoder
/abc_python/abc143/abc143_c.py
UTF-8
196
3.140625
3
[]
no_license
N = int(input()) S = input() current = "" result = [] for slime in S: if slime == current: continue else: current = slime result.append(slime) print(len(result))
true
34895f75071622168947c0d6aa732e7670a637ae
VinicciusSantos/CeV-Python
/Mundo1/ex023.py
UTF-8
294
4.46875
4
[]
no_license
# Faça um programa que leia um número de 0 a 9999 e mostre na tela cada um dos dígitos separados. num = str(int(input('Digite um número: '))) print(f'Analisando o número {num}:') print(f'Unidade: {num[3]}') print(f'Dezena: {num[2]}') print(f'Centena: {num[1]}') print(f'Milhar: {num[0]}')
true
65087c2980db11efaa5bd7cd3cbaf40128d2aae1
SherlockT94/PythonHacking
/WebApplicationHacking/extract_forms.py
UTF-8
1,148
2.578125
3
[]
no_license
# Using beautifulsoup4 to parse html and extract forms and its attributes import requests from bs4 import BeautifulSoup import urllib def request(url): try: return requests.get("http://" + url) except Exception: pass target_url = "10.0.2.6/mutillidae/index.php?page=dns-lookup.php" response = r...
true
110b190f96c57d969691afe05833eb88265e69ec
Kunal3Kumar/Assignment
/factors.py
UTF-8
205
3.953125
4
[ "MIT" ]
permissive
# WAP to display factors of an inputted number. num = int(input("Please Enter any Number: ")) val = 1 while (val <= num): if(num % val == 0): print("{0}".format()) val = val + 1
true
fd5cdab6b8fea2328878e20cc6d80559826d083b
theedward/python_nodejs
/src/send_HTTP_reqs_by_freq.py
UTF-8
1,753
3.046875
3
[]
no_license
#!/usr/bin/python import httplib import sys import hashlib import time import random from datetime import datetime from threading import Thread def request(parameter, round): try: c = httplib.HTTPConnection("130.233.42.118", 9999, timeout=120) c.request("GET", "/" + str(parameter)) start_t = datetime.now() # ...
true
e17e9980d52530d8035066234b5e2e8fff328429
Mohamud-Dev/Job-hunter
/app/models.py
UTF-8
1,828
2.546875
3
[ "MIT" ]
permissive
from werkzeug.security import generate_password_hash,check_password_hash from flask_login import UserMixin from flask import Flask from . import db from . import login_manager @login_manager.user_loader def load_user(user_id): return User.query.get(int(user_id)) class User(UserMixin, db.Model): __tablen...
true
034a303c5236c1711b6cd9c33c29072dbae5547b
aaqingsongyike/Python
/Python_Reptlie/demo-03.py
UTF-8
1,028
2.8125
3
[]
no_license
import urllib.request import random url = "http://www.baidu.com" # 可以是User-Agent列表,也可以是代理列表 ua_list = [ "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv2.0.1) Gecko/20100101 Firefox/4.0.1", "Mozilla/5.0 (Windows NT 6.1; rv2.0.1) Gecko/20100101 Firefox/4.0.1", "Opera/9.80 (Macintosh; I...
true
9372420b9a11b6be0fe4a2aa2587d0d0b1cacecd
Lukeholt21/Year-13-Project
/Save_Load.py
UTF-8
3,494
3
3
[]
no_license
import pickle class user(): def __init__(self,userID,firstName,surname,simsCode,accessLevel,password): self.userID = userID ##PRIMARY KEY## ##userID will be generated by the code#100-9999## self.firstName = firstName self.surname = surname self.simsCode = simsCode ...
true
e87c5dbb7146dd2df3bf8345055dc23c7c1f44e0
FROSADO/jira-offline
/test/utils/test_convert.py
UTF-8
2,086
2.6875
3
[ "MIT" ]
permissive
''' Tests for the issue_to_jiraapi_update function in utils.convert module ''' import pytest from fixtures import ISSUE_1 from jira_offline.models import Issue from jira_offline.utils.convert import issue_to_jiraapi_update @pytest.mark.parametrize('modified', [ {'assignee'}, {'fix_versions', 'summary'}, ]) d...
true
24c62c1f44f87cbcb820c57ab312b95ddb371382
Yotambu100/PythonCalculator
/string_validator.py
UTF-8
19,066
3.578125
4
[]
no_license
from equation_status_code import InvalidEquationCode from string_to_list_converter import StringToListConverter class StringValidator: """ Class that responsible on checking the validation of the equation. the class preform several tests the equation as string and as list(different tests) """ ...
true
829fc0008740252a54549d7558e8125369c8bd10
rahulkmr/python3_musings
/euler2.py
UTF-8
194
3.421875
3
[]
no_license
#!/usr/bin/env python def fib_gen(): a, b = 1, 2 while a <= 4000000: # yield even fibs. if not a & 0o1: yield a a, b = b, a+b print(sum(fib_gen()))
true
cf4d190fda92d5d0db37cd12350557ccdb295da0
bhardwajRahul/bootstrap-flask
/examples/list-bootswatch.py
UTF-8
759
2.828125
3
[ "BSD-3-Clause", "Apache-2.0", "MIT" ]
permissive
"""List Bootstrap themes RadioField.""" from os import listdir def list(version): """List template file names.""" print(f"To add to bootstrap{version}/app.py") print(" theme_name = RadioField(") print(" default='default',") print(" choices=[") print(" ('default', '...
true
f1cf1a6f6fd9f53e4fb0105fc4ac82ad4cad4b06
MaxBerry27/modulus-questions
/modulus-question/Q2.py
UTF-8
176
2.765625
3
[]
no_license
frame_count = int(input("how many frames have passed: ")) # you do % 60 and if it equals 0 it will shoot therefore it will shoot if the number of frames is a multiple of 60
true
0356b1bd23a4c9f653624652fc65c957902a04c8
Woody-1018/Python-Autotest_learning
/test20170815/Webdriver API/1.浏览器操作.py
UTF-8
1,201
3.53125
4
[]
no_license
# coding = utf-8 # 引入WebDriver from selenium import webdriver # 引入计时器 import time # 定义浏览器 driver = webdriver.Chrome() # get方式打开链接 driver.get("https://www.baidu.com") # 最大化窗口 driver.maximize_window() # 浏览器刷新 driver.refresh() # 等待时间 time.sleep(5) # 打印信息 print("设置浏览器宽度为480,高度为800") # 自定义窗口大小 driver.set_window_size(480, 80...
true
ffc912217b20cd4e7019c8c2f132da84c251f5bf
boldfield/decanter
/decanter/cli/shell.py
UTF-8
2,663
2.625
3
[]
no_license
from cement.core import controller class ShellController(controller.CementBaseController): class Meta: label = 'shell' description = "Opens a bpython, ipython or python interactive shell." epilog = "By default, the first interpreter found is used. The " \ "order of look u...
true
66ae5432cc6ac6a8fa229f9cacbb4c24fdb3c477
jimuyang/use-python
/liaoxuefeng/RegExpression/RegExpression.py
UTF-8
855
3.5625
4
[]
no_license
#!/usr/bin/env python3 # encoding: utf-8 """ @file: RegExpression.py @user: muyi-macpro @time: 2018/4/11 下午11:13 @desc: """ # .可以匹配任意字符 # 用\d可以匹配一个数字,\w可以匹配一个字母或数字 # 匹配变长的字符,在正则表达式中, # 用*表示任意个字符(包括0个), # 用+表示至少一个字符,用?表示0个或1个字符, # 用{n}表示n个字符,用{n,m}表示n-m个字符: # ^表示行的开头,^\d表示必须以数字开头。 # $表示行的结束,\d$表示必须以数字结束 import re ...
true
5555d8be28558794d2f242b0ff7fa806d28ee744
isaiasMachado/LocFac
/main.py
UTF-8
11,603
2.859375
3
[]
no_license
import random import math from math import inf import datetime import os import numpy as np from Construtiva import estratGulosa from Entrada.leitura import le_instancia as le tam_loop = 1000 # Condição de parada temp_max = 100 # Parâmetro da temperatura: usado no SA temp_min = 0.5 # Parâmetro da temper...
true
82316b1f1de7e52b61bf68f7501f3869335c889d
Aasthaengg/IBMdataset
/Python_codes/p03193/s136800214.py
UTF-8
270
2.65625
3
[]
no_license
from sys import stdin, stdout import math import bisect import queue N,H,W = map(int,stdin.readline().strip().split()) ans = 0 for i in range(N): A, B = map(int, stdin.readline().strip().split()) ans += min(A // H, B // W) stdout.writelines(str(ans) + '\n')
true
3d23d37f4e9067abcfc9c7a8ac5f0ab38c772e6c
h2oai/h2o-3
/h2o-py/tests/testdir_apis/Data_Manipulation/pyunit_h2oH2OFrame_isax.py
UTF-8
821
2.640625
3
[ "Apache-2.0" ]
permissive
import sys sys.path.insert(1,"../../../") import h2o from tests import pyunit_utils from h2o.frame import H2OFrame from h2o.utils.typechecks import assert_is_type def h2o_H2OFrame_isax(): """ Python API test: h2o.frame.H2OFrame.isax(num_words, max_cardinality, optimize_card=False) copied from pyunit_isax....
true
929b4f850a0356bd6e20394a2e2ce964d756aab6
fugbk/pystu-N27
/day11-02 池/01 线程池.py
UTF-8
1,692
3.125
3
[ "Apache-2.0" ]
permissive
# encoding = utf-8 __author__ = "mcabana.com" import threading import datetime import time import logging from concurrent.futures import ThreadPoolExecutor start = datetime.datetime.now() FORMAT = "%(asctime)s %(threadName)s %(thread)d: %(message)s" logging.basicConfig(format=FORMAT, level=logging.INFO) # 先定义一个线程...
true
70930ada652edb5be353e77813a3298b09a950fb
parkjinhong03/KorailTalk-with-Flask-PyQt5
/Server/App/Train/View/get.py
UTF-8
3,119
2.671875
3
[]
no_license
import pymysql import datetime from DB.connect import db, cursor from flask_restful import reqparse date_dict = { "Monday": '1', "Tuesday": '2', "Wednesday": '3', "Thursday": '4', "Friday": '5', "Saturday": '6', "Sunday": '7' } train_korean_name = { 'Seoul': '서울', 'Gwangmye...
true
d9ac95b8e1bc5348a51d4c49d7b6b80cd1591cd3
apdaza/bookprogramming
/ejercicios/python/ejercicio006.py
MacCentralEurope
378
4
4
[]
no_license
from math import * A = int(input("Ingrese el valor de A (A > 1):? ")) B = int(input("Ingrese el valor de B (B > 1):? ")) if A > 1 and B > 1: print("Divisin entera " + str(A) + "/" + str(B) + " = " + str(A//B)) print("Residuo Divisin " + str(A) + "%" + str(B) + " = " + str(A%B)) else: print("Error en ...
true
af89fa6051feaf8b6e4adba468beea432d850ce9
ratschlab/uRNN
/tf/options.py
UTF-8
15,209
2.84375
3
[]
no_license
#!/usr/bin/env ipython # -*- coding: utf-8 -*- # # For the Experiment class. # # ------------------------------------------ # author: Stephanie Hyland (@corcra) # date: 17/5/16 # ------------------------------------------ import numpy as np from unitary_np import unitary_matrix, complex_reflection from s...
true
161b4512b138421ac40ff39032ffcf5dfca5116c
DnLKnR/Backgammon_AI
/Parser.py
UTF-8
204
3.0625
3
[]
no_license
import re def parseInputString(s): inputList = s.split() if (inputList[0] == "q"): return inputList else: for each item in inputList: re.match("\d/\d")
true
c138fbfacbb6ac07efb345dca6ec63897074659a
0giru/Algorithm_Practice
/Problem4.py
UTF-8
699
3.765625
4
[]
no_license
# 상하좌우 N = int(input()) x, y = 1, 1 #operation will be R L U D operation = input().split() while True: if not operation: break else: temp = operation.pop(0) if temp == 'R': if y < N: y += 1 elif y >= N: pass el...
true
cfa5c50fd69a17573e42659b922d24a60a0a4fd7
cyliu1991/hogwarts_apitest
/hogwarts_apitest/api.py
UTF-8
1,688
2.703125
3
[ "Apache-2.0" ]
permissive
import requests import requests.structures session = requests.sessions.Session() class BaseApi(object): url = "" method = "" params = "" data = "" json = {} headers = {} def set_params(self, **params): self.params = params return self def set_data(self, data): ...
true
bd595619a4e33bdb3a1af7781924eb088be4dea2
magierska/dna-methylation
/ChromosomeAreas.py
UTF-8
565
3.015625
3
[]
no_license
class ChromosomeAreas: def __init__(self, islands=None, shores=None, shelves=None, seas=None): self.areas = { 'islands': ChromosomeAreas.init_array(islands), 'shores': ChromosomeAreas.init_array(shores), 'shelves': ChromosomeAreas.init_array(shelves), 'seas': ...
true
a9e6a9b760f8c4e3c27eb7481ad01a5c4264c079
bill0119/python-tensorflow
/src/example/lab1_tensor2.py
UTF-8
399
2.859375
3
[]
no_license
import tensorflow as tf # define a tensor for calculation ta = tf.placeholder(dtype=tf.int32, shape=(None,)) tb = tf.placeholder(dtype=tf.int32, shape=(None,)) tc = tf.add(ta, tb) print(type(ta), type(tb), type(tc)) # do real calculation with tf.Session() as session1: result1 = session1.run(tc, feed_dict=...
true
72798990c1cf2f6373158fcc5da3bea231b0764d
enplus/ess.k
/VannaCalc.py
UTF-8
2,427
2.796875
3
[]
no_license
import numpy as np import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D import math from matplotlib import cm import OptionsAnalytics from OptionsAnalytics import BSMerton # Option parameters sigma = 0.12 # Flat volatility strike = 105.0 # Fixed strike epsilon = 0.4 # The % on the ...
true
edf24690203a8d4b27b97111353a863aca9538ed
cristo92/gene-symulation
/BienZakrz.py
UTF-8
970
2.578125
3
[]
no_license
import math from BaseModel import BaseModel class EwaModel(BaseModel): def run(self, samples): k0 = self.k0 k1 = self.k1 alpha = self.alpha beta = self.beta gamma = self.gamma tau = self.tau delta = (k0 * alpha * tau + 2 * k0 + (alpha * gamma) / beta + 2 * (alpha *k0) / gamma - alpha + alpha * alpha /...
true