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
7317f964c3f0a4eb8631140cd12185ab81d43db6
m-aykurt/ITF-008-CLARUSWAY
/1-Python/PreClass/ASSİGMENT/1-7.slack-ornek-calısma.py
UTF-8
25,768
3.359375
3
[]
no_license
# -*- coding: utf-8 -*- ### 1 """ Proje sorumlusu olarak genis katilimli bir projede calisiyorsunuz ve coronadan dolayi tum toplantilarinizi online yapiyorsunuz. Toplantiya katilan 200 personelden bazilari toplantiya gecikmeli katilim gostermeye basladi. Siz de proje sorumlusu olarak bunu toplantiyi bolmeden ve kisil...
true
5e17d23a79ed583b1d6f125f36d349ee26803d79
EdwardHuang119/Stock-master
/HP_VIEW/RSI回测演示.py
UTF-8
3,728
2.546875
3
[]
no_license
# -*- coding: utf-8 -*- import pandas as pd import numpy as np import datetime as dt import time import matplotlib.pyplot as plt import math import tushare as ts from HP_formula import * from HP_sys import * def RSI(N1=6, N2=12, N3=24): """ RSI 相对强弱指标 """ LC = REF(CLOSE, 1) RSI1 = SMA(MAX(CLOSE...
true
13bfff98b9adfd1542251d56b897a7c0ed4670e8
CCExtractor/sample-platform
/database.py
UTF-8
5,822
2.796875
3
[ "ISC" ]
permissive
"""handles database session and data-type across app.""" from __future__ import annotations import re import traceback from abc import ABCMeta from typing import Any, Dict, Iterator, Tuple, Type, Union from sqlalchemy import create_engine from sqlalchemy.dialects.sqlite.pysqlite import SQLiteDialect_pysqlite from sql...
true
2e93e354c7042dd22a7faad5385f13d1a0749767
AdamZhouSE/pythonHomework
/Code/CodeRecords/2458/60653/293900.py
UTF-8
524
2.84375
3
[]
no_license
from itertools import * n, k = map(int, input().split(' ')) ls = [] max = 0 for i in range(0, k): ls.append(list(int(m) for m in input().split(' '))) for t in range(1, n): for a in combinations(ls[0], t): flag = False res = [] for i in range(1, k): for b in combinations(ls[i]...
true
2bb4fc3c12776594d9a6c47130675e42fbe66af0
nkanungo/session6-epfi
/test_session6.py
UTF-8
35,496
2.875
3
[]
no_license
import pytest import session6 import os import inspect import re README_CONTENT_CHECK_FOR = [ 'lambda', 'ValueError', 'map', 'zip', 'for', 'spades', 'hearts', 'clubs', 'diamonds', 'bool' ] CHECK_FOR_THINGS_NOT_ALLOWED = [ ] def test_readme_exist...
true
487d7e93d7365b5236da3ef8420a81134a2d5158
simple2source/macugEx
/macugEx/src/python_circle/006/exc.py
UTF-8
150
3.328125
3
[]
no_license
def gen(): c = 0 while True: yield 0 c += 1 if c > 3: raise GeneratorExit() for x in gen(): print(x)
true
bb5949b089728623605dca99ee4d4e62a0cdebcb
shmansouri/ParticleModel
/reference_model/Sample/ReferenceKinetics.py
UTF-8
2,021
3.09375
3
[]
no_license
# -*- coding: utf-8 -*- """Reference kinetics module This module includes reference kinetic from Nagy et al. """ # Importing dependencies import numpy as np class Kinetics: def __init__(self, nucleation=None, growth=None, shrinkage=None, agglomeration=None, breakage=None): self.models = dict() s...
true
fef163b321739395ed1de496c7462dca6d09c443
tradr-project/TRADR_frame_classifiers
/english_frame_classifiers/test_baseline.py
UTF-8
5,462
2.578125
3
[]
no_license
# A script to evaluate the performance of the model # on test data import tensorflow as tf import torch from torch.utils.data import TensorDataset, DataLoader, RandomSampler, SequentialSampler from transformers import AdamW, BertForSequenceClassification, BertTokenizerFast from sklearn.preprocessing import LabelEncode...
true
b992fa4ea1a2ff19e2d7d4b9569b01542492249e
kihira/AdventOfCode2017
/day5/part2.py
UTF-8
404
3.296875
3
[ "MIT" ]
permissive
with open("part1.txt", "r") as file: offsets = [] for row in file: offsets.append(int(row.strip())) position = 0 steps = 0 while position < len(offsets): instruction = offsets[position] if instruction >= 3: offsets[position] -= 1 else: offsets...
true
9d3217290bab73199f7ee70ddf185318d89209b5
tusharGOEL1/Content-Based-Music-Retrieval
/project/crawler.py
UTF-8
1,624
3.25
3
[]
no_license
import requests from bs4 import BeautifulSoup import os def get_audio_links(url): # searches the HTML page and extracts urls ending with mp3 r = requests.get(url) soup = BeautifulSoup(r.content, "html.parser") links = soup.findAll('audio') audio_links = [link['src'] for link in links if ...
true
f380aaf8922d5dbc9c56d6a29ff7a6ad3fea1e7f
pedrobn23/Genetic
/utils.py
UTF-8
382
2.703125
3
[]
no_license
from numpy import numpy as np def simple_real_mutation(element): mutation = np.random.randint(len(self[0])) deviation = np.random.normal(0.5, sigma) mutated_characts = self[element].characteristics a = mutated_characts[mutation] + deviation a = 0 if a < 0 else a if a < 1 else 1 # normalize m...
true
3d7faa57a6f9ba7929661bbfa9930d9c2729043f
MrHamdulay/csc3-capstone
/examples/data/Assignment_7/hmldhr001/push.py
UTF-8
3,620
3.40625
3
[]
no_license
#Dhriven Hamlall def push_up (grid): """merge grid values upwards""" for t in range (3): for i in range(3): for k in range(4): if grid[i][k] == 0: grid[i][k] = grid[i+1][k]#makes the top...the bottom number grid[i+1...
true
6d82b2f24c7020d1f7132992193e96eb1d8ac796
alucardthefish/OldPCRepo
/frogol/project/sample.py
UTF-8
2,020
2.890625
3
[]
no_license
#!/usr/bin/env python import sys version = sys.version_info if version[0] < 3: from Tkinter import * from tkMessageBox import * print("Version 2") else: from tkinter import * from tkinter import messagebox print("Version 3") class Application(Frame): """docstring for Application""" def __init...
true
4ef1f9e8071bf5058d5934172820b9b5d84f206f
dasbro6/newtry
/coursera practice/lesson423-1.py
UTF-8
2,020
3.015625
3
[]
no_license
import pandas as pd import numpy as np import requests import re from datetime import datetime import time from sklearn.cluster import KMeans #美股个股股票信息fromYahoo def retrieve_quotes_historical(stock_code): start = datetime.now() headers = { 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleW...
true
2867600b5bd9dee97f1b8201db83c9fc70da5ed0
TIPYexe/CSGO_Trade-Up_Scrapper
/Case_Skins.py
UTF-8
378
2.625
3
[]
no_license
# pentru fiecare calitate stim pretul class Skin: def __init__(self): self.name = "" self.weapon = "" self.prices = [] self.rarity = "" # fiecare cutie cu skin-uri + link-ul cu date despre skin-urile din ea class Case: def __init__(self): self.name = "" self.lin...
true
2c06d7c2ac922ecb11945342c8e2dc2400d59327
SobrancelhaDoDragao/Exercicio-De-Programacao
/Exercicios-Python/Basico/Exercicios/exercicio93.py
UTF-8
963
4.0625
4
[]
no_license
''' Crie um programa que gerencie o aproveitamento de um jogador de futebol. O programa vai ler o nome do jogador e quantas partidas ele jogou. Depois vai ler a quantidade de gols feitos em cada partida. No final, tudo isso será guardado em um dicionário, incluindo o total de gols feitos durante o campeonato. ''' d...
true
8811196bcc7c60f89f244c50e0642f06e4525513
kevinyiyang/tictactoe-opencv-python
/single_image.py
UTF-8
2,968
2.890625
3
[]
no_license
import cv2 import imutils # initialize board state # -1: Human piece # 0: empty # 1: Computer piece boardState = [[0, 0, 0], [0, 0, 0], [0, 0, 0]] # image from webcam img = cv2.imread("board-m01.png") # isolate board from whole image # convert to grayscale/apply blur/canny gray = cv2.c...
true
d4bf88e907eb44a45b8291547acd3799023a2fca
Florian-Barthel/style-gan
/dataset/resize_ffhq.py
UTF-8
473
2.71875
3
[]
no_license
from tqdm import tqdm import os from PIL import Image src_folder = 'E:/ffhq_merge' dest_folder = 'E:/ffhq_256' if not os.path.exists(dest_folder): os.makedirs(dest_folder) num_kept = 0 for file in tqdm(os.listdir(src_folder)): src_img = src_folder + '/' + file dest_img = dest_folder + '/' + file img...
true
cfd2a29d3adce208c426fa6e1b57c9b0fa91457a
reshma-jahir/GUVI
/proset1two.py
UTF-8
204
2.84375
3
[]
no_license
num,kit=input().strip().split(" ") kit=int(kit) i=0; while i<len(num)-1 and kit: if(num[i]>num[i+1]): kit-=1 num=num[:i]+num[i+1:] if(i!=0): i-=1 else: i+=1 rey=num[:len(num)-kit] print(rey)
true
79594b919437d09ec99ed667cea1ef375eadb347
kf9480/opsclass
/py_lab2/myprog_pkg.py
UTF-8
445
3.015625
3
[]
no_license
#!/usr/bin/python import sys import my_pkg while(True): select = int(input("Select menu : 1) conversion 2) union/intersection 3) exit ")) if (select == 1): binstr = input("input binary number : ") my_pkg.binto_oct(binstr) my_pkg.binto_dec(binstr) my_pkg.binto_hex(binstr) ...
true
22e919fc7981e2249af23e798ce5f1b9a043ec4c
ChangRui-Yao/pygame
/每日任务/爬虫的自我修养/gui的最终选择 tkinter/Canvas绘图组件/五角星.py
UTF-8
1,093
3.59375
4
[]
no_license
from tkinter import * import math as m #------要使用到sin cos tan需要这个模块 root = Tk() w = Canvas(root, width=200, height=100,background="red")#---设置一张画布 长度200 高度100 底色白色 w.pack() center_x = 100 center_y = 50 r = 50 points = [\ #左上点 center_x - int(r * m.sin(2 * m.pi / 5)), center_y - int(r * m.cos(2 * ...
true
6c792d657970441753e3bd0768e495537e76fcf5
bucioluis/python-exercises
/vowels.py
UTF-8
1,560
3.78125
4
[]
no_license
############################################################################### # Description: Draws each vowel using turtle with specific coorindates and directions ############################################################################### from turtle import * def draw_a(): pendown() left(90) forwar...
true
c2bf3000a6b7a8f5df00cd8c4e3540f939dcf2df
chintaujhwal/Python
/sum_of_numbers.py
UTF-8
124
3.640625
4
[]
no_license
i = 0 while True: num = int(input("enter a number :")) if num == 0: break i += num print("sum is", i)
true
5b7cdaa55c8076bae3e0c6c8a1ce40f180d51ae9
RITFIRSTRobotics/2018-robot-code
/libs/piconzero.py
UTF-8
11,036
2.875
3
[]
no_license
# Python library for 4tronix Picon Zero # Dowloaded from http://4tronix.co.uk/piconzero/piconzero.py # Note that all I2C accesses are wrapped in try clauses with repeats # Run through 2to3 and edited by Connor Henley, @thatging3rkid import sys import time import smbus # note that you have to install smbus using apt im...
true
df585dcb7af4baa44fb1f6a248231e736e7363f3
ShekhRaselMasrurAhmmadNissan/URI-Online-Judge
/Beginner/1011_sphere.py
UTF-8
261
3.984375
4
[]
no_license
# The formula to calculate the volume is: (4/3) * pi * R3 # Reading the value of Radius... R = float(input()) PI = 3.14159 # Calculating the value of Sphere... sphere = (4.0 / 3) * PI * (R ** 3) # Printing the Result... print('VOLUME = {0:.3f}'.format(sphere))
true
7a60ea722a01122920624e5f5debccab3a8460ab
pradneshkolluru/NEO_project
/extract.py
UTF-8
1,890
3.53125
4
[]
no_license
"""Extract data on near-Earth objects and close approaches from CSV and JSON files. The `load_neos` function extracts NEO data from a CSV file, formatted as described in the project instructions, into a collection of `NearEarthObject`s. The `load_approaches` function extracts close approach data from a JSON file, for...
true
227d2b4b68857ee313e1812b3c2b383f57f6a129
DavidAbdelmalek/Problem-Solving
/leetcode/p904.py
UTF-8
754
3.09375
3
[]
no_license
class Solution: def totalFruit(self, fruits: List[int]) -> int: if len(fruits) == 0: return 0 max_val = 1 dict_map = {} i =0 j = 0 while j < len(fruits): if len(dict_map) <= 2: dict_map[fruits[j]] = j if len(dict_m...
true
f5800e49609ec82fee7e305f2c13fb1d20aa65b0
ryanp543/agrobotarmcontrol
/scripts/rviz_start.py
UTF-8
2,260
2.671875
3
[ "MIT" ]
permissive
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import time import numpy as np import rospy import csv from sensor_msgs.msg import JointState from std_msgs.msg import Header from agrobot_arm_v2.msg import FloatList from struct import * FILEPATH = './rviz_data/new_rviz_data_RENAME.csv' def callback(motor_data): ...
true
c06288c703aac4b47a8218db4dc7f37d9218118c
Baaart25/Hungarian-diacritic-restoration
/Hungarian-diacritic-restoration/model.py
UTF-8
946
2.640625
3
[]
no_license
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, embedding_dim, hidden_dim, n_layers, vocab_size, dropout=0.5): super().__init__() self.hidden_dim = hidden_dim self.embedding_dim = embedding_dim self.vocab_size = vocab_size self.n_layers = n_lay...
true
dcc59c0bd5bf9355415c8f6f118cf2472c586ff0
Lameus/Simple_virus_checker-test_task
/train.py
UTF-8
1,305
3.015625
3
[]
no_license
import pandas as pd from sklearn.feature_extraction.text import TfidfVectorizer from sklearn.linear_model import LogisticRegression from sklearn.pipeline import Pipeline import joblib def model(data): ''' Function to create and fit model. Uses tf-idf for processing and logistic regretion ...
true
dbff43ff3f3435c1d6e12116af69a0511c7bb77b
jiangsiwei2018/BigData
/data_common/configure/configure.py
UTF-8
1,420
2.734375
3
[]
no_license
# -*- coding: utf-8 -*- import time import os import socket import configparser from data_common.configure import constant from data_common.designs.singleton import SingletonType class Configure(metaclass=SingletonType): CONFIG_FILE_PATH = os.path.dirname(__file__) + '/setting.ini' def __init__(self): ...
true
fa10351c0abb522b352eb358c3ff005e5eff4c85
roguextech/Stanford-KevinCrispie-Prop-Analysis
/cea_anal.py
UTF-8
2,236
2.546875
3
[ "MIT" ]
permissive
# -*- coding: utf-8 -*- """ Spyder Editor This is a temporary script file. """ import numpy as np import matplotlib.pyplot as plt from rocketcea.cea_obj_w_units import CEA_Obj from rocketcea.cea_obj import add_new_fuel ## inputs P = range(150,500,20) # range of chamber pressures to test ## add PMMA definition card_s...
true
5850b81309816af890a6144915adc100ab0d5a2e
korepwx/ipwxlearn
/ipwxlearn/utils/misc.py
UTF-8
5,950
3.03125
3
[]
no_license
# -*- coding: utf-8 -*- from __future__ import absolute_import import contextlib import copy import re import six def require_object_name(name): """ Check whether or not :param:`name` could be used as the name of some object. When defining any layer or variable, we require the user to provide a name wh...
true
527bb3f83227b9fb935d3d5a828348d0a83f9ee1
infernoDison/off-chain-pki
/accumulator.py
UTF-8
8,721
3.046875
3
[]
no_license
import copy from eth_utils import ( keccak, remove_0x_prefix, ) from web3._utils.encoding import hex_encode_abi_type class HashTreeEntry: def __init__(self, entry_hash='00'*32): self.entry_hash = entry_hash class NameEntry(HashTreeEntry): def __init__(self, name_hash, next_hash, public_key, ...
true
25e56eaa5bf2d05fee8b8eda45e4e1d169618b6f
BenMeehan/BestEnlist
/Day 19/Day 19.py
UTF-8
687
2.875
3
[]
no_license
# Day 19 import pandas as pd import mysql.connector mydb = mysql.connector.connect( host="localhost", user="root", password="", database="studentmanagement" ) mycursor = mydb.cursor() df = pd.read_excel("C:\\Users\\Ben\\Desktop\\BestEnlist\\Day 19\\student.xlsx") cols = list(df) names = df[cols[0]] ...
true
b1ef4379029021dce0ad5aefa083dec98bdbc49c
rebusched/udacity-rebusched
/ps2.py
UTF-8
1,638
3
3
[]
no_license
form=""" <!--Basert på samarbeid mellom Benedicte og Peter--> <form method="post"> <h2>Enter some text to ROT13:</h2> <p> <label><textarea name="rot13text" id="rot13text" cols="45" rows="5">%(rot13text)s</textarea></label> </p> <p> <label><input type="submit" name="button" id="button" value="Submit" /></label...
true
f810879dd53f2474195fbe533f924eff6a934359
MondayYuan/FaceClassifcationAndDetection
/classify/logistic_model.py
UTF-8
4,844
2.734375
3
[]
no_license
import sys import os current_dir = os.path.dirname(os.path.abspath(__file__)) os.chdir(os.path.abspath(os.path.dirname(current_dir))) sys.path.append(os.getcwd()) from preprocess.data_loader import data_loader import numpy as np import matplotlib.pyplot as plt import math import random from skimage.feature import hog...
true
12cb1641a2af6ea5d6f54945bd997eb4e08271cd
bryant/libramp
/pytest/rampsim.py
UTF-8
4,120
3.109375
3
[]
no_license
from math import sqrt def ramp(freq, accel, vel): c_n = int(freq * sqrt(float(2) / accel)) n = 0 rest = 0 target_c = freq / vel yield c_n, rest while True: n += 1 f, rest = divmod(2*c_n + rest, 4*n + 1) c_n = c_n - f #c_n, rest = divmod(c_n*(4*n - 1) + rest, 4*n...
true
877742728b9d25555f500692479c276df199b62d
morningspider/projecteluer
/PE303.py
UTF-8
375
3.03125
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Fri Jan 16 15:22:20 2015 @author: Joe Vandagriff """ def f(n): if n == 9999: return 1111222222222222212201 if n == 999: return 11122222222221201 if n == 99: return 1122222222 multiple = n digits = set(str(multiple)) while max(digits) > "2": multip...
true
91dbd1bcdd126ef08a425c00b16a760b99add8cb
idobarkan/my-code
/exercises/tests/test_formatting_proxy.py
UTF-8
1,464
2.84375
3
[]
no_license
import unittest import add_parent_path # PyFlakesIgnore from formatting_proxy import FormattingProxy, format class TestFormattingProxy(unittest.TestCase): def test_sanity(self): dct = {'x':1, 'y':2} fp = FormattingProxy(dct) x = fp['x'] self.assertEqual(x,1) self...
true
fe82ff71fedb9b187d6cebe559cc99e459d4d5e2
ksjksjwin/practice-coding-problem
/CodeSignal/variableName.py
UTF-8
700
3.46875
3
[]
no_license
''' Correct variable names consist only of English letters, digits and underscores and they can't start with a digit. Check if the given string is a correct variable name. Example For name = "var_1__Int", the output should be variableName(name) = true; For name = "qq-q", the output should be variableName(name) = fal...
true
6501a5adf62ade6f2d931df5da92407dad1442ed
state-sampler/numerical-experiments
/counting_states.py
UTF-8
5,060
3.15625
3
[]
no_license
import numpy as np from BipartiteMatching import matching from sampler import gibbs_sampler def create_bipartite_graph(partial_order): graph = {} for i in range(partial_order.shape[0]): graph[i] = np.flatnonzero(partial_order[i, :] == 1) graph[i] = np.setdiff1d(graph[i], np.array([i...
true
56a3d017a3c9309e99f90cf188a14bc9d47e1a4a
kirillovmr/telegram-support-bot
/handlers.py
UTF-8
1,670
2.578125
3
[]
permissive
import os from telegram.ext import CommandHandler, MessageHandler, Filters from settings import WELCOME_MESSAGE, WELCOME_EMOJI, TELEGRAM_SUPPORT_CHAT_ID # To be executed once the user starts a bot def start(update, context): # Send welcome message to the user update.message.reply_text(WELCOME_MESSAGE) upd...
true
503c2fefff64dee4c0a9a95de1fc226dd130db40
13950090228/Web-Python-LearningNotes
/Web+Python学习笔记/day8(文件操作)/作业练习.py
UTF-8
1,298
3.1875
3
[]
no_license
#import os #import time #with open('懒趴.txt', mode='r',encoding='utf-8') as f1,\ # open('a2.txt', mode='w',encoding='utf-8')as f2: # for i in f1: # if i == '慢慢你会发现\n': # # f2.write('哈哈哈\n') # # f2.write(i) #os.remove('懒趴.txt') #time.sleep(3) ...
true
df446f9c287d0a9acaa1e0ef0523da71056ac195
GeoscienceAustralia/fetch
/fetch/scripts/now.py
UTF-8
766
2.515625
3
[ "Apache-2.0" ]
permissive
# -*- coding: utf-8 -*- """ Download specific rules immediately (if not currently running/locked) """ from __future__ import absolute_import import sys def main(): """ Run once for the given rules. """ return_usage = any((len(sys.argv) < 2, '-h' in sys.argv, '--help' in sys.argv)) if return_usag...
true
27cee918f903993a73028a97adb1051e125ac643
jacoloves/python_tool
/opt/src/atcoder/202101/2.py
UTF-8
901
3.03125
3
[]
no_license
a = list(map(str, input().split())) R = False L = False winner = "" for i in range(len(a)): if a[i] == "RU" and R == False: R = True elif a[i] == "RU" and R == True: winner = "Alice" break elif a[i] == "RD" and R == False: winner = "Alice" break elif a[i] == "RD...
true
35e0f74009043fce6e81132d22d03693b80aadeb
arslanislam845/DevNation-Python-assignments
/5.May26/q1.py
UTF-8
738
4.0625
4
[]
no_license
def ascii_sum(s): sum=0 for i in range(len(strinput)): sum = sum + ord(strinput[i]) return sum def ascii_sum_odd(s): oddsum=0 for i in range(len(strinput)): if ord(strinput[i])%2!=0: oddsum=oddsum+ ord(strinput[i]) return oddsum def ascii_sum_even(s): evensum=0 ...
true
0e9eace51e990d7474916cbe6f7bdd2198a17bdc
BenjaminUJun/slick
/pox/ext/slick/elements/More/More.py
UTF-8
3,265
2.890625
3
[]
no_license
""" More: An element that is used to forward More packets than the incoming packets. """ import os.path import datetime from slick.Element import Element class More(Element): def __init__( self, shim, ed ): Element.__init__(self, shim, ed ) self.file_handle = None # If this value is 2 =...
true
fb94d094d892ee84482c7e18302b6b117423232a
ophwsjtu18/ohw
/students/ChaoWang/Minecraft/MinecraftBuliding.py
UTF-8
1,432
2.75
3
[]
no_license
from mcpi.minecraft import Minecraft import mcpi.block as block mc = Minecraft.create() pos = mc.player.getTilePos() class House(): #房子坐标([x,y,z]) def __init__(self,data): self.pos = data self.x = data[0] self.y = data[1] self.z = data[2] #房顶花纹 def Roof(): x0 ...
true
21a48a032611bbdee67cb1be8a6cca5f4eca3c56
ChisatoKasebayashi/Study
/AutoEncoder/jupyter/I_cvae/net.py
UTF-8
10,544
2.671875
3
[]
no_license
import six import chainer import chainer.functions as F from chainer.functions.loss.vae import gaussian_kl_divergence import chainer.links as L import numpy as np import cupy class MyCVAE(chainer.Chain): """Conditional Variational AutoEncoder""" def __init__(self, n_in, n_latent, n_h, n_label): super...
true
82714330193760724081330d5028ece5a498e6cc
jakub-szczepaniak/xliff
/transunit.py
UTF-8
1,615
2.890625
3
[ "MIT" ]
permissive
class TransUnit(object): "Container for XLIFF trans-unit element" def __init__(self, argument): self.origin_unit = argument self.attributes = argument.attrib self.id = '' self.ns = '' self.state = '' self._source = '' self._target = '' @staticmethod...
true
a4cd92800d0ec9c456b3878b0fe52df9768e1cac
frankieliu/problems
/leetcode/python/246/246.strobogrammatic-number.py
UTF-8
721
3.34375
3
[]
no_license
# # @lc app=leetcode id=246 lang=python3 # # [246] Strobogrammatic Number # # https://leetcode.com/problems/strobogrammatic-number/description/ # # algorithms # Easy (41.84%) # Total Accepted: 49.1K # Total Submissions: 117.4K # Testcase Example: '"69"' # # A strobogrammatic number is a number that looks the same w...
true
bdef9244baa336ff7ede84854b3dfaff320e1ab7
wegfawefgawefg/docker_notes
/sockets/listener.py
UTF-8
538
3.015625
3
[]
no_license
import socket import time host = '' port = 12345 while True: print("...awaiting connnection") with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s: s.bind((host, port)) s.listen(1) conn, addr = s.accept() with conn: print(f"Connection: {addr}") wh...
true
543d5bda1bb9536c219ab4ea5dd7aff3e3f68b05
immortal1ty6/codewars
/8kyu/python/invert-values.py
UTF-8
73
2.734375
3
[]
no_license
def invert(lst): return [a * -1 for a in lst] if len(lst) > 0 else[]
true
f6774fc92e9166e23bc527c4babe08bf6e206322
vithalsamp/AlgosWithPython
/find_max_subarray.py
UTF-8
1,557
3.765625
4
[]
no_license
# Find max subarray program import math #from find_max_crossing_subarray import find_max_crossing_subarray def find_max_crossing_subarray(arr, low, mid, high): # max sum in LEFT subarray left_sum = -9999999999999999 sum = 0 for i in range(mid, low-1, -1): sum = sum + arr[i] if sum > left...
true
ca51d13ec3553e6a85d2450d2c71c2049569fb13
Raviteja8209/teja
/49.py
UTF-8
50
2.578125
3
[]
no_license
b,m=list(map(int,input().split())) a=b+m print(a)
true
a2f6691992f07b91c07bd029a90a1eef6a7c1f8c
miniyk2012/leetcode
/interestings/logger_study/demo1.py
UTF-8
748
3.21875
3
[]
no_license
# 创建一个日志器logger并设置其日志级别为DEBUG import logging import sys logger = logging.getLogger('simple_logger') logger.setLevel(logging.DEBUG) # 创建一个流处理器handler并设置其日志级别为DEBUG handler = logging.StreamHandler(sys.stdout) handler.setLevel(logging.INFO) # 创建一个格式器formatter并将其添加到处理器handler formatter = logging.Formatter("%(asctime)s -...
true
da569bb97360017506dc9fb90a22b36f6e9d5fbb
WesleyPereiraValoes/Python
/Curso em Python Mundo 2/ex071.py
UTF-8
954
3.90625
4
[]
no_license
print(''' ------------------------------------------- - Caixa eletronico do santander - ------------------------------------------- ''') cedula50 = 50 cedula20 = 20 cedula10 = 10 cedula01 = 1 c50 = 0 c20 = 0 c10 = 0 c01 = 0 print('-='*40) sac = int(input('Digite o valor a ser sacado:R$ ')) print('=-'*40) tot ...
true
e17f1bc0838b5b60426a5f197095e6f05a13c59f
Ahmed-Magdy0/Embedded-Automotive-Networking
/ADAS(Python)/ADAS(Send Duty Cycle)/ADAS Simulator (gui).py
UTF-8
2,448
2.8125
3
[]
no_license
from os import system from parameters import * import wx, time, serial import com class MyFrame(wx.Frame): def __init__(self, parent, title): super(MyFrame, self).__init__(parent, title=title, size=(320,200), ...
true
4555193bbc83d118c6ef1061d0dd2d1660ec2edb
dankoga/URIOnlineJudge--Python-3.9
/URI_2003.py
UTF-8
280
2.9375
3
[]
no_license
while True: try: departure_H, departure_M = map(int, input().split(':')) except EOFError: break delay = 60 * departure_H + departure_M - 420 if delay > 0: print('Atraso maximo: {}'.format(delay)) else: print('Atraso maximo: 0')
true
3d4a003103168727298eda7e9ecc54aef12354e4
ray-project/ray
/python/ray/data/_internal/execution/operators/union_operator.py
UTF-8
4,262
2.75
3
[ "MIT", "BSD-3-Clause", "Apache-2.0" ]
permissive
from typing import List, Optional from ray.data._internal.execution.interfaces import ( ExecutionOptions, PhysicalOperator, RefBundle, ) from ray.data._internal.execution.operators.base_physical_operator import NAryOperator from ray.data._internal.stats import StatsDict class UnionOperator(NAryOperator):...
true
d85cb4225de4882d746410acf46fac3da9847ab6
taran933933/html1
/cipher.py
UTF-8
447
3.390625
3
[]
no_license
text= "abcd" shift= 3 key = "abcdefghijklmnopqrstuvwxyz" def encrypt(text,shift): result='' for char in text: i=(key.index(char) + shift) % 26 result += key[i] return result text2 = encrypt(text,shift) def decrypt(text2,shift): result1='' for char in text2: i=(key.index(char) - shif...
true
1d855597d3ebb0c801e8b6c58e3922e50d28fd9e
brillantescene/Coding_Test
/Programmers/Level1/sum-btwn-a-b.py
UTF-8
115
3.140625
3
[]
no_license
# 연습문제 # 두 정수 사이의 합 def solution(a, b): return sum(range(a, b+1)) or sum(range(b, a+1))
true
f3708aef6b5cd2d158ebe857dedcdf12e3c30e1b
diri-daniel/C.I.D.S_projects_ibinabo_daniel
/wk1/wk1_ex7.py
UTF-8
102
3.734375
4
[]
no_license
n = int(input("enter n: ")) s_m = int(n*(n+1)/2) print(f'The sum of the first {n} integers is {s_m}')
true
3308799ced02d624152ce6bbfacc6962669d9b0b
SkyThonk/Albot_Discord
/qsql.py
UTF-8
1,264
2.5625
3
[]
no_license
import sqlite3 conn = sqlite3.connect("botdata.db") c = conn.cursor() def insert_game_id(id,valo=None,rockstar=None,epic=None, steam=None,Quote="You can add your custom quote here by using $quote"): c.execute(f"insert into Gameid values({id},'{valo}','{rockstar}','{epic}','{steam}','{Quote}')") conn.commit() ...
true
278cea2abf928c32b28dd2f3b80e1227aea8d8b4
GDGGranada/python_django_dic13
/examples/variables.py
UTF-8
211
3.171875
3
[]
no_license
int = 7 float = 1.23 boolean = True print int,float,boolean # Ahora reasignamos y machacamos int int = True print int int = 8.76*4 print int int = False and True or not(False or 6<10) print int
true
d8fc2ca05c29f799a797a44e1b0475dadb34a4ec
dr-dos-ok/Code_Jam_Webscraper
/solutions_python/Problem_34/229.py
UTF-8
1,023
3.09375
3
[]
no_license
#!/usr/bin/python # Solution to alien problem # Googld Code Jam, 2009 Qualification round # Alex Roper <alexr@ugcs.caltech.edu> # California Institute of Technology import sys, re def read_tokens(f): for line in f: for t in line.split(): yield t def trans_regex(word): """Turn a gcj regex into a re one...
true
a5e87bd2f9602baa6e3773e12d22e8bb7b04e101
jrlivesey/protoplanet
/protoplanet
UTF-8
3,389
3.109375
3
[]
no_license
#!/usr/bin/python3 ##################################################### # PROTOPLANET is a simple Python code for quickly # # making new VPLANET input directories from pre- # # existing ones. Run PROTOPLANET from a directory # # containing .in files (sun.in, b.in, vpl.in, etc.) # # and a new directory with you...
true
6701cf57a01ab67ba7128a0e9dbc918683afa7a0
Code-Grown/floppy-etl
/app/application.py
UTF-8
656
2.609375
3
[]
no_license
#!/usr/local/bin/python from vendor import Argument, Log from config import DEBUG import sys, pdb class Application(Argument): def __init__(self): pass def init_application(self): try: Log.info('Init Application, reading arguments.') self.read_arguments() exce...
true
27f1e74f6b7efbd4ff68560d8d7b05717b2b6bd6
Subbu786/5143-OpSys-Shaik
/assignments/cpu_simulation/components/Scheduler.py
UTF-8
12,912
2.71875
3
[]
no_license
from queue import Queue from components.CPU import CPU from components.Process import Process from components.Event import Event from components.Semaphore import Semaphore class Scheduler: def __init__(self, eventMap, events): self.eventMap = eventMap self.events = events # mu...
true
2b4646d4f399f74b3e9688fc3e906acf17abb6fd
HCassiano/drones
/dronekit/simulator.py
UTF-8
286
2.71875
3
[]
no_license
print "Start simulator (SITL)" import dronekit_sitl sitl = dronekit_sitl.start_default() connection_string = sitl.connection_string() print "Connecting to vehicle on: %s" % (connection_string) # Shut down simulator while True: if raw_input("enter c to close: "): sitl.stop() break
true
1c47734cd6e8d35cdbe7d510b4bb29d54538e593
miloszhoc/LearningEnglishFromSubtitles
/tests/translate_microsoft/modules/test_language_checker_subtitles.py
UTF-8
882
2.609375
3
[ "MIT" ]
permissive
import unittest from translate_microsoft.modules import language_checker_subtitles from exceptions import translator_exceptions class TestLanguageCheckerSubtitles(unittest.TestCase): def setUp(self): self.lc = language_checker_subtitles.CheckLanguageSubtitles() def test_show_all_languages_translati...
true
97b4474680a95ce9ce9ec19b1e13d84ed2f0d7d1
adityasiriguppa/Codes
/Spoj/FCTRL/FCTRL-14316725.py
UTF-8
117
2.734375
3
[]
no_license
# your code goes here t=gets.to_i for i in 1..t n=gets.to_i j=5 res=0 while j<=n res+=n/j j=j*5 end puts "#{res}" end
true
212d58db91125ee32c963e357bde720be7400135
No1d3a/GradProject
/BeautifulSoup.py
UTF-8
1,299
2.78125
3
[]
no_license
from bs4 import BeautifulSoup import requests import re import tldextract SITE_LINK = "https://www.filgoal.com/" LIST_OF_LINKS = [] ext = tldextract.extract(SITE_LINK) domain = "{}.{}".format(ext.domain, ext.suffix) def extract_links(site_link): r = requests.get(site_link) if r.status_code == requests.codes...
true
275b9f11931686c9ee5dce58342fbe27a77c112e
VadaGuilherme/tv_control_samsungctl
/app/main.py
UTF-8
1,341
2.734375
3
[]
no_license
from fastapi import FastAPI import uvicorn try: from control.tv import Tv except: from .control.tv import Tv app = FastAPI() tv = Tv() @app.post("/volume/{option}", tags=['Volume control']) def volume(option: str): """ /volume/{option} - Options to control the volume of the TV. \n /volume/up - in...
true
3136d3c96dfd9bf991c626ce26fcbf7b1ed6d807
qwp-ryan/rango
/my_rango/populate_rango.py
UTF-8
5,636
2.75
3
[]
no_license
import os os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'my_rango.settings') import django django.setup() from rango.models import * import pandas as pd def populate(): python_pages = [ {"title":"Official Python Tutorial", "url":"http://docs.python.org/2/tutorial"}, {"title":"how to th...
true
c7b0ec7e1587e2f3973861fe50b0b78d8f0c18b7
ariadnarouco/flask-blog-app
/flaskblog.py
UTF-8
1,550
2.6875
3
[]
no_license
from flask import Flask, render_template, url_for app = Flask(__name__) posts = [ { "author":"Stephany Spencer", "title": "There and Back Again : Scaling Multi Tenant Kubernetes Clusters", "content":"They say there are lessons to be learned in IT 'war stories'. But maybe the real lessons a...
true
0ec404db7c76871a51779fedec4709bff17cbbc0
BigfooTsp/Apuntes_python
/Librerías.doc/_Módulo Itertools.py
UTF-8
2,119
4.3125
4
[]
no_license
# APUNTES LIBRERÍA ITERTOOLS #http://python-para-impacientes.blogspot.com.es/2015/08/bucles-eficientes-con-itertools.html # FUNCIONES QUE DEVUELVEN ITERABLES INFINITOS: ''' itertools.count(start=0 [, step=1]) Devuelve iterable ininterrumpido ''' from itertools import * for valor in count(5, 3): print(valor...
true
a1231d3edd3dc7482cc1a8ded3bcba59301de106
salavattt/Okrugnosty
/main.py
UTF-8
965
2.640625
3
[]
no_license
import sys from PyQt5 import uic from PyQt5.QtWidgets import QApplication, QWidget, QMainWindow from PyQt5.QtCore import Qt from random import randint from PyQt5.QtGui import QPainter, QPen, QColor class MyWidget(QMainWindow): def __init__(self): super().__init__() uic.loadUi('UI.ui', self) ...
true
7ac28a1996d67a0cc579cd9e118c3842b21844ec
fernandozanutto/competitive_programming
/ICPC/Latin America Final/2019/E.py
UTF-8
445
2.875
3
[]
no_license
bolo = input() n = len(bolo) s = int(input()) soma = 0 bolo += bolo[0:s-1] indices = [0]*len(bolo) ind = 1000000 for i in range(len(bolo)-1,-1, -1): if bolo[i] == 'E': ind = i else: if ind - i < s: indices[i] = ind-i cont = 0 for i in range(n): if indices[i] == 0 ...
true
e1bf7145a1c2e1e048252df8ee6382c9a3d9d819
RyanNguyen0203/Udacity_FullStackNanodegree_Project01_MovieTrailerPage
/create_web_page.py
UTF-8
2,311
3.296875
3
[]
no_license
import classes import functions # Initialize Movie instances ''' Batman Begins movie: movie title, storyline, poster image url and movie trailer url''' batman_begins = classes.Movie( 'Batman Begins', 'A rich dude in his bat suite', 'https://upload.wikimedia.org/wikipedia/en/8/8a/Dark_Knight.jpg', 'htt...
true
ca967df953a1eb9bcd414f572566a8e85e08366b
tataurova/lessons-gb-python
/lesson_4/lambda function.py
UTF-8
827
3.9375
4
[]
no_license
def some_f(): return 10 result = some_f() print(result) a = some_f print(a) print(type(a)) print(a()) def f(): print('Hello from other function') def to(f_param): # параметром будет функция # поэтому в теле функции мы ее вызовем f_param() to(f) def my_filter(numbers, function): result...
true
5574953edf602bd80dcd668e261069fe6ea13fc1
xiaopeng-whu/OCR_video_extract
/ciyun.py
UTF-8
868
3.203125
3
[]
no_license
# -*- coding: utf-8 -*- # 生成词云图 import matplotlib.pyplot as plt from wordcloud import WordCloud, ImageColorGenerator import numpy as np from PIL import Image # 获取文本信息 text = open(u'./result/result.csv', 'r').read() # text = open(u'result.txt', 'r').read() print(text) # 获取图片 img = np.array(Image.open("image...
true
9f2a678769ab1c11d254486916659dda86eb9017
Randazzo93/Python
/UnnecessaryScheduledFlows.py
UTF-8
2,780
2.65625
3
[]
no_license
# Pulls lineage data from tableau server to understand tableau's servers from tableau_api_lib import TableauServerConnection import pandas as pd import psycopg2 # Tableau Server credentials tableau_server_config = { 'tableau_prod': { 'server': 'http://test', 'api_version': '3.10', 'usernam...
true
a7e1b257a2be9ba9ec6f0669cdd157855748e86e
jayinai/inf1340
/inf1340_ass2/test_papers.py
UTF-8
2,827
2.875
3
[ "MIT" ]
permissive
#!/usr/bin/env python3 """ Module to test papers.py """ __author__ = "Shuai Wang" __email__ = "info.shuai@gmail.com" # imports one per line import pytest from papers import decide def test_complete_info(): """ Test if required info is complete """ # 8 entries: 1st is complete, and the rest 7 miss...
true
91abfe27ca3a11391dda486b3ac5fdf26f00e8eb
ranazia517/analyze-tremor-bradykinesia-PD
/classifiers/hand_movement_classifier.py
UTF-8
4,782
3.609375
4
[ "MIT" ]
permissive
''' This file contains code to run a hand movement classifier based on accelerometer data obtained from a wearable device located on the wrist. ''' import pandas as pd import numpy as np from scipy import signal def compute_rolling_mean(x, window_length): ''' Method to compute rolling mean. :param x: 1D n...
true
62618ebd8b262ead07c7c7632f21e62f078ec613
nattofriends/kochira_caa
/kochira_caa/brain.py
UTF-8
1,730
2.90625
3
[]
no_license
""" Artificial (un)intelligence. Allows the bot to reply whenever its nickname is mentioned. """ import re from kochira import config from kochira.service import Service, background, Config from cobe.brain import Brain from cobe.scoring import LengthScorer service = Service(__name__, __doc__) @service.config class...
true
50018b33549b9c6a9edb6300095f63e6947605df
ma-sadeghi/OpenPNM
/openpnm/phases/_water.py
UTF-8
2,494
2.953125
3
[ "MIT" ]
permissive
from openpnm.phases import GenericPhase import openpnm.models as mods class Water(GenericPhase): r""" Creates Phase object with preset values for Water Parameters ---------- network : GenericNetwork The Network to which this phase object will be associated. Examples -------- ...
true
1ecc3d72e3ba482d5a2b95f5bcb846aea2f88214
santo2077/jheremy
/jheremy.py
UTF-8
2,112
3.4375
3
[]
no_license
from msvcrt import getche from msvcrt import putch import os import random import time """ Programa para el menu del seg parcial """ def menu(): x=' ' while True: os.system('cls') print("Metodos de ordenamiento") print("1. Tablas") print("2. numeros primos ") print("3....
true
80251c74dc11227ed8f806a3a34641654052a0f7
5l1v3r1/openCV-example
/AgirlikliToplama.py
UTF-8
931
3.0625
3
[]
no_license
import cv2 import numpy as np def main(): image1=cv2.imread("misaka.jpg") image2=cv2.imread("eren.jpg") print("eren resim değerleri: Yükseklik:{},Genişlik:{},KanalSayısı:{}".format(image1.shape[0],image1.shape[1],image1.shape[2])) print("misaka resim değerleri: Yükseklik:{},Genişlik:{},KanalSa...
true
fde19b7d0ac37d33863c3d96aa84ab24b78e7fa0
Haider93/puck-world
/GBFARL.py
UTF-8
16,038
2.546875
3
[]
no_license
import math import gym from gym import spaces from gym.utils import seeding import numpy as np import copy import scipy.stats import random from agent import ApproxQAgent from agent import SarsaAgent import matplotlib.pyplot as plt RAD2DEG = 57.29577951308232 class PuckWorldEnv(gym.Env): me...
true
8a6d8b8f87c07c16c7076fdc23a2a018f53c7dba
jnchen/Learning
/python/multi_line_str.py
UTF-8
127
3.015625
3
[]
no_license
#!/usr/bin/python str = '''"To be,or not to be",that is the question. Whether it's nobler in the mind to suffer.''' print(str)
true
afcfdfd03c0c42eb92673588ed9cc3e7ca53677f
214031230/Python21
/day18/课件/mysite/日期格式化.py
UTF-8
132
2.828125
3
[]
no_license
import datetime now = datetime.datetime.now() print(now, type(now)) ret = now.strftime("%Y-%m-%d %H:%M:%S") print(ret, type(ret))
true
735ad8179f2bf851a77e6059bef7e6920f029aea
bayupuspanugraha/lets-solve-it
/count-string-similarities-basedon-suffixes/python/main.py
UTF-8
1,033
3.46875
3
[ "MIT" ]
permissive
import time def calculateSimilarites(suffix, original): counter = 0 for it in range(0, len(suffix)): suffixChar = suffix[it:it+1] originalChar = original[it:it+1] if suffixChar == originalChar: counter = counter + 1 else: break return counter def s...
true
70156315d2c676b134e63b543f445d1be3cd9450
lepidodendron/lepidodendron
/src/util_io.py
UTF-8
795
3.125
3
[ "MIT" ]
permissive
from os.path import expanduser, join import pickle def pform(path, *names, sep= ''): """formats a path as `path` followed by `names` joined with `sep`.""" return join(expanduser(path), sep.join(map(str, names))) def load_txt(filename): """yields lines from text file.""" with open(filename) as file: ...
true
b299a7271436ccc8f88fc11b2735db8dd342bf9c
sieczkah/Codewars_KATA
/4 kyu/Twice linear.py
UTF-8
418
3.4375
3
[]
no_license
"""https://www.codewars.com/kata/5672682212c8ecf83e000050""" def dbl_linear(n): dbl = [1] x = 0 y = 0 while len(dbl) <= n: a = dbl[x] * 2 + 1 b = dbl[y] * 3 + 1 if a < b: dbl.append(a) x += 1 elif a == b: dbl.append(a) x += ...
true
efe52a4035849c50bdf184f69c159c649be686f5
zhvasilisa/2017-osnov-programm
/project/dict_entries.py
UTF-8
394
2.703125
3
[]
no_license
import sys import re s = open('jamalov.txt', 'r') print('# Word', file=open("entries.txt", "w")) for line in s.readlines(): line = line.strip() if line == '': continue m = re.search(r'^[А-Я\'1-]+', line) if not m: continue entry = m.group() if len(entry) > 1: entry = entry.replace('\'', '').lower().replac...
true
3337015fe73c986c69e6187842cf2fe6217f42ac
Patryk-Kumor/University
/Python/Zbiory innych zadań/prog1.py
UTF-8
304
3.578125
4
[]
no_license
def kwadrat(n): for i in range(n): for j in range(n): print ("*", end="") print() def kwadrat2(n): for i in range(n): print (n * "#") for i in range(10): print ("Przebieg:",i) if i < 5 : kwadrat(2*i+3) else: kwadrat2(i-2) print()
true
d59affb657a23ea5ac85bcd334f783b8aa2f035c
bobgo1111/bitlings2
/RegexPractice.py
UTF-8
413
3.46875
3
[]
no_license
import re text = '' while True: print("-------------------------- %s ----------------------"%(text)) newText = input('New text (just press ENTER use same): ') if newText: text = newText regEx = input('Regex: ') try: matcher = re.compile(regEx) print("RegEx<%s> matches %s"%(r...
true
67bb406274177163ea01de28c1cd37807db2acd3
mak705/Analytytix
/project/k2k_transform.py
UTF-8
2,445
2.921875
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Fri Nov 16 15:19:15 2018 @author: [NikhilKadayinti, MakbulHussain] """ # ============================================================================= # imports the necesary libraries # Reads from the topic "earth_before" and proces each event # write the data to another...
true