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
eef8ce40de3bef0074c9099d74c4873a3f0e24c0
muzzu001/Python-for-Hacktoberfest
/Rotate Array by K step/array.py
UTF-8
928
4.09375
4
[]
no_license
'''Given an array, rotate the array to the right by k steps, where k is non-negative. 📌Example 1: Input: [1,2,3,4,5,6,7] and k = 3 Output: [5,6,7,1,2,3,4] Explanation: rotate 1 steps to the right: [7,1,2,3,4,5,6] rotate 2 steps to the right: [6,7,1,2,3,4,5] rotate 3 steps to the right: [5,6,7,1,2,3,4] 📌Note: Try ...
true
8a3e910ef56851fc26d4d331c9bc89f930699aff
thomas-weigel/cs101
/wizard/test_wizard.py
UTF-8
566
2.78125
3
[ "MIT" ]
permissive
#!/usr/bin/env python3 import unittest import _11 class WizText(unittest.TestCase): def test_travel_tower(self): wiz = _11.Wizard(location="village") self.assertEqual( wiz.task("tower"), "You travel to your modest one-story wizard tower." ) def test_travel...
true
7a34c7d569abf3b17e3ae48054ad62c20fbe8387
jeffreydking04/machine-learning-assignments
/python_for_everybody/problems/arithmetic/main.py
UTF-8
2,054
3.421875
3
[]
no_license
import re def get_suffix(index, number_of_problems): if index == number_of_problems - 1: return '\n' else: return ' ' def arithmetic_arranger(problems, show_answers = False): number_of_problems = len(problems) if number_of_problems > 5: return('Error: Too many problems.') ...
true
690275c468b27bdf418a8ee2fc0e0656497a8a29
hamdiranu/backUp_Alta
/Alta Batch 4/Phase 1/Week 2/Day 1/Problem Regex/2 - Validasi Login Sistem.py
UTF-8
1,660
3.171875
3
[]
no_license
import re def validasiLogin(email, password): database = [ {'email':'johndoe@gmail.com', 'password': '123456'}, {'email':'johndoe@yahoo.co.id', 'password': '123456'}, {'email':'john_doe@gmail.com', 'password': 'asdfasdfds'} ] hasil = {} patternemail = '([a-zA-Z_]+@[a-z]+\.[a-zA-Z.]{2,3})' patte...
true
7a6db2daa7657669027641da85815b9d72e2d0df
pyre/pyre
/packages/pyre/config/pml/Package.py
UTF-8
1,789
2.625
3
[ "BSD-3-Clause" ]
permissive
# -*- coding: utf-8 -*- # # michael a.g. aïvázis # orthologue # (c) 1998-2023 all rights reserved # from .Node import Node class Package(Node): """ Handler for the package tag in pml documents """ # constants elements = ("component", "package", "bind") # interface def notify(self, par...
true
1d1372cd9d19213fcc98a5ffd0a83a7f1e72635a
AnnaBarczyk/Board_Games_ERP
/ui.py
UTF-8
1,681
4
4
[]
no_license
# Interface programu def print_menu(title, commands): ''' Przedstawia menu przyjazne dla użytkownika. Paramtery: commands (list), title (str). ''' index_change = 1 print(title) for key,value in enumerate(commands): print(f"{key + index_change}.{value}") def print_table(games...
true
c509bb1a602e567e1cb7d39cd08fe2efba272ac8
PKW97/2021-python
/4주/2.py
UTF-8
286
3.421875
3
[]
no_license
from random import randint money = 12000 for i in range(5): n = randint(35,50) if n <= 40: print("근로 시간 %d시간, 주급 %d" % (n, n * money)) else: print("근로 시간 %d시간, 주급 %d" % (n, (40 * money) +(n - 40) * (money * 1.5)))
true
7ef5c99d2463b81f192cf57e09ec4a68a4daad7c
MikeNordMan/TDNikel
/window_class.py
UTF-8
6,681
2.59375
3
[]
no_license
import PySimpleGUI as sg from workWithRow import visibleRow from workWithRow import visibleRowUn from check import checkNullStr from testZasor import zasor, findEvent from try_check import Check, StrCheck class MyWindow(): '''Переменные класса''' keys ={'exit': '-exit_', 'print': '-print-', 'delete': '-del-',...
true
1b92bf298cc113e5fecc629b2b3c5dd6b2205c15
pawelc/NeuralLikelihoods
/code/models/tensorboard.py
UTF-8
735
3
3
[]
no_license
import os class Tensorboard: def __init__(self, log_dir): self.log_dir = log_dir def log_table(self, tag, table): table_str = " | ".join(table[0]) + "\n" table_str += "|".join(["---"] * len(table[0])) + "\n" for row in table[1:]: table_str += " | ".join([str(col) f...
true
43983d544fd7358f36f59746f4004f5402ae4a45
Amenshawi/maze-solver
/app.py
UTF-8
5,187
3.203125
3
[]
no_license
# by: Abdulrhman Menshawi # @Amenshawi on github from PIL import Image import math import numpy as np import timeit draw_start = timeit.default_timer() img = Image.open(r'maze101x101.png') pix_list = list(img.getdata()) length = int(math.sqrt(pix_list.__len__())) path = list() start = None # variables for stats o...
true
b52e31bc7e32cb5c3038b125466acc962e9387d6
Aasthaengg/IBMdataset
/Python_codes/p02624/s075144150.py
UTF-8
414
2.734375
3
[]
no_license
import sys read = sys.stdin.readline import time import math import itertools as it def inpl(): return list(map(int, input().split())) st = time.perf_counter() # ------------------------------ N = int(read()) ans = 0 for i in range(1, N+1): n = N // i ans += 0.5 * n * (2*i + i * (n-1)) print(int(ans)) # -...
true
008a763aa3fde6b035cda1548f8f918872a7866c
ONSdigital/eq-survey-runner
/app/forms/custom_fields.py
UTF-8
4,042
2.546875
3
[ "MIT", "LicenseRef-scancode-proprietary-license" ]
permissive
from decimal import Decimal, InvalidOperation from babel import numbers from wtforms import TextAreaField, IntegerField, DecimalField, SelectMultipleField, SelectField from app.settings import DEFAULT_LOCALE class MaxTextAreaField(TextAreaField): def __init__(self, label='', validators=None, maxlength=10000, **...
true
1612f3b8c246b2a13f45d3d21b064a6b568c9ea1
SiyuanYan1/leetcode
/二叉树/二叉搜索树的后序遍历序列.py
UTF-8
1,047
3.59375
4
[]
no_license
import copy # -*- coding:utf-8 -*- # class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None #输入一颗二叉树的跟节点和一个整数,打印出二叉树中结点值的和为输入整数的所有路径。 #路径定义为从树的根结点开始往下一直到叶结点所经过的结点形成一条路径。(注意: 在返回值的list中,数组长度大的数组靠前) class Solution: # 返回二维列表,内部每个列表表示找到的路径 def __...
true
a7bf3c4dbb34cbe5192c266e71427140cd492e39
tanvircs/Protein_Protein_Data_Analysis_Networkx
/src/kegg_source.py
UTF-8
2,381
3.03125
3
[]
no_license
import os import numpy as np import scipy.io as sio # Load the dataset file = os.path.join('data','KEGG_04022019.txt') first_dict = {} labels = [] # Interate into dataset line by line. # Make dictionay called first_dict which keys are connected with all the labels data. # Besides create a list labels which contai...
true
7c7c7f8427b26252772913293d814448525e6631
gmhshr123/Intro-to-Python
/bedfiles.py
UTF-8
1,838
3.234375
3
[]
no_license
# bedfiles # Manipulate with the bedfile data # Minghao Guo # March 4th , 2020 ########################################## # import pandas module import pandas as pd # read file # create columns names fields = ["scaffold","start","stop","element","score","strand","family","sub-family","divergence"...
true
ca77d3cd65b66a8dbff021d0a3f5113c5e8d51cf
hyperrixel/dof
/dof/services.py
UTF-8
7,948
3.21875
3
[ "MIT" ]
permissive
""" DoF - Deep Model Core Output Framework ====================================== Submodule: services """ from abc import ABC, abstractmethod from .file import DofFile from .information import ContainerInfo class DofSearch(ABC): """ Abstract class for DoF's search functionality =======================...
true
45c9321903f76de8892c9a7c889487f5a898f7cd
wanghuan203/AI
/learnpython/lesson3.py
UTF-8
2,091
3.609375
4
[]
no_license
''' @author: whuan @contact: @file: lesson3.py @time: 2018/10/21 11:09 @desc:numpy数组运算操作 ''' # ndarry是一个多维数组对象 # 实际数据和元数据 # numpy比原生list速度快,效率高,大部分由c写成,开源免费 # Python3 range() 函数返回的是一个可迭代对象(类型是对象),而不是列表类型, 所以打印的时候不会打印列表。 # Python3 list() 函数是对象迭代器,可以把range()返回的可迭代对象转为一个列表,返回的变量类型为列表。 # Python2 range() 函数返回的是列表。 import ...
true
d3306ed497245fc51e842c5b7d46072235d0848a
gitlcj/Internet_Technology_django
/rango/views.py
UTF-8
12,890
2.59375
3
[]
no_license
from django.shortcuts import render, redirect from rango.models import Category from rango.models import Page from rango.forms import CategoryForm from rango.forms import PageForm from django.urls import reverse from rango.forms import UserForm, UserProfileForm from django.http import HttpResponse from django.contrib.a...
true
1e6455a5f9a1ef5f122d72f2a1bb387c6eb3cdb9
itagaev/webdev2019
/10 week/informatics/Условный оператор/E.py
UTF-8
91
3.3125
3
[]
no_license
a, b = int(input()), int(input()) if a > b: print(1) elif a == b: print(0) else: print(2)
true
680c39785cc47694da86c7db1dfbe4c196ae7873
HoneyGrace08/save22-calib-test
/calculator/calculator.py
UTF-8
2,508
3.734375
4
[]
no_license
def add (num1, num2): ## if not isinstance(num1, int): #checking #value datatype ## return None return num1 + num2 def subtract (num1, num2): return num1 - num2 def multiply (num1, num2): return num1 * num2 def divide (num1, num2): num1 = float(num1) num2...
true
faefb9abbd9a78765f765e4ced94d8de22c3cb8c
omega87910/learning
/Program-Design/Python/Python-100/p46.py
UTF-8
180
3.015625
3
[]
no_license
import random as rd rd.seed(input()) answer = str(rd.randint(1000,9999)) summ=0 inp = input() for i in range(0,len(answer)): if inp[i] == answer[i]: summ+=1 print(summ)
true
b39e5d09accf28bc9c68b60f1fa12f201f571f11
guitarbug/kaishu
/scripts/utils.py
UTF-8
767
2.84375
3
[]
no_license
import os VERIFY = True def make_dirs(file_dir): """ 创建目录 :param file_dir: :return: """ if not os.path.exists(file_dir): os.makedirs(file_dir) def delete_gap_dir(gap_dir, del_hide=True): """ 移除空目录 :param gap_dir: :param del_hide: :return: """ if os.path.i...
true
fe3b5db076b8165d9060dbe0581c3a9851e2e60f
EvaSedlarova/pyladies
/03/hvezda.py
UTF-8
1,135
3.578125
4
[]
no_license
from turtle import setposition, left, right, speed, hideturtle, forward, color, penup, pendown, bgcolor, begin_fill, end_fill from random import randrange speed(0) # rychlost kreslení, rozmezí 0 - 10, 0 je téměř okamžitá, 10 nejrychlejší, 1 nejpomalejší hideturtle() # schová šipku bgcolor('Midnight Blue') # barva p...
true
53838ad673455b9d187fa11b2ea391a84778aeac
Wxshy/Code
/NEW-Chapter2-Challenges-SW.py
UTF-8
833
3.46875
3
[]
no_license
bad_varaibles = ['v', 'var', 'c1', 'atp', '123', 'var 1'] good_varaibles = ['account_name', 'password'] #------------------------------------------------------------ fav1 = input('Please enter your first favourite food: ') fav2 = input('Please enter your second favourite food: ') print('Here is the new food', fav1+f...
true
38db6a2bee25f69ea498935c79c80c36a52e0b9a
kevinkatsura/Tugas-Besar-III-IF2211-Strategi-Algoritma
/src/task_regex.py
UTF-8
1,091
2.78125
3
[]
no_license
import re # Baca file berisi daftar kata penting untuk tipe task file_kata_tipe = open("../test/file_kata_tipe.txt", "r") Lines = file_kata_tipe.readlines() Lines = [line.strip('\n\r') for line in Lines] regex_tipe = "|".join(line for line in Lines) def regex_search(text): # --> Funsgi untuk identifikasi apakah strin...
true
69ae1bc3f80a5c3256e5b06a65b84a9202b0ca0a
Vivekter/aiohttp-client-cache
/aiohttp_client_cache/docs/forge_utils.py
UTF-8
5,918
3.421875
3
[ "MIT", "BSD-2-Clause" ]
permissive
"""Utilities for dynamically modifying function signatures. The purpose of this is to generate thorough documentation of arguments without a ton of copy-pasted text. This applies to both Sphinx docs hosted on readthedocs, as well as autocompletion, type checking, etc. within an IDE or other editor. """ import inspect ...
true
523de9d103d5bcf46790e54b7c7d155f5a610080
cjn9414/AdventOfCode2018
/18/part2.py
UTF-8
906
3.109375
3
[]
no_license
from helper import * def day18_part2(): lumber_area, past = [], [] """ LOAD DATA INTO LIST FROM FILE """ load_file('input.txt', lumber_area) """ FIND WHEN PATTERN REPEATS """ minute = 0 while True: temp = lumber_area[:] change_lumber_area(temp, lumber_area) minute += ...
true
898a4b983ac42313214af8538e6705b181ec0884
wfelipe3/KnowBag
/python/bus-stop/portafolio.py
UTF-8
829
3.328125
3
[]
no_license
f = open("data.csv", mode='r') data = f.read() print(data) f.close() def openData(file="data.csv", mode='r', error="warn"): if error not in {"warn", "silent", "raise"}: raise ValueError("Error must be warn, silent or raise") try: return open(file, mode) except FileNotFoundError as e: ...
true
9649668fc38511c7aeefeaffb6c8f05796d7f1fc
BerniHacker/Python
/MostFrequentEmailAddress.py
UTF-8
1,677
4.21875
4
[]
no_license
# This program reads a e-mail file and finds out who has sent the greatest number of messages. # An example of such a file can be found at http://www.py4e.com/code3/mbox-short.txt # # Retrieving data fname = input('Enter file name:') # Asking for user input fhandle = open(fname) # Opening the file # Building a ...
true
4ee0310467440dfc54ba780e521008ac2fad10ae
donuthack/cryptography
/rsa_encode.py
UTF-8
964
3.09375
3
[]
no_license
def stepin (x, d, n): d2 = [] while(d!=0): d2.append(d%2) d = d//2 d2.reverse() z = 1 for k in range(len(d2)): z=z**2 if d2[k] == 1: z=z*x z = z%n return z def evkld(a, b): r1 = a r2 = b s1 = 1 s2 = 0 t1 = 0 t2 = 1 ...
true
9a460ceaee21a8dc9d18cb53bd7adc9718c61b7a
mcanthony/js-image-suite
/rotation-app/server.py
UTF-8
1,433
2.578125
3
[]
no_license
#!/usr/local/bin/python import os import tornado.httpserver import tornado.ioloop import tornado.web from tornado.options import define, options import Image define("port", default=8888, help="run on the given port", type=int) class RootHandler(tornado.web.RequestHandler): def get(self): ...
true
6c7c3aac65ca957d9be5ef9ba5f3f24f8ccda2bd
youjeongk/IT-project
/path/histogram.py
UTF-8
994
3.09375
3
[]
no_license
import numpy as np, cv2 def calc_histo(image, histSize, ranges=[0,256]): #행렬 원소의 1차원 히스토그램 계산 hist = np.zeros((histSize, 1), np.uint8) #히스토그램 누적 행렬 /문제의 줄. 'list' object cannot be interpreted as an integer gap = ranges[1] / histSize #계급 간격 for row in image: #2차원 행렬 순회 방식...
true
e0fa87160a8ee9eaa1e83dc02ed3a6d9d54eef1a
uswdnh47/608-mod2
/central-native.py
UTF-8
391
3.546875
4
[]
no_license
values = [47,95,88,73,88,84] print (len(values)) #count print (sum(values)) #sum #mean mean = (sum(values)/len(values)) print (mean) #median n = len(values) values.sort() if n % 2 == 0: median1 = values[n//2] median2 = values[n//2-1] median = (median1 + median2)/2 else: median = values[n//2] print (...
true
c11b440910eb2c67f522486e678f6c4e94e9a3cd
Twishka/atm-task
/app/test.py
UTF-8
1,815
2.609375
3
[]
no_license
import requests import json import unittest from flask import jsonify, Flask url = 'http://localhost:5000/atm/api/money' class ATMTest(unittest.TestCase) : def setUp(self): global app # ? app = Flask(__name__) # do not create here, load only config self.app_context = app.app_context() self.app_contex...
true
2367f747c0cf6742b7819c5bae5818be61062e15
silverpond/smoothness_from_imu
/scripts/myrobotics.py
UTF-8
3,134
3.0625
3
[]
no_license
"""Module containing robotics related functions and classes. Author: Sivakumar Balasubramanian Date: 24 May 2018 """ import numpy as np def rotx(t): ct, st = np.cos(t), np.sin(t) return np.array([[1.0, 0.0, 0.0], [0.0, +ct, -st], [0.0, +st, +ct]]) def roty(t): ...
true
cd276ff8dce9e52f51015edd3ae8436456cb94a0
Nacili/IPprojekat
/Tex/KNN.py
UTF-8
801
2.75
3
[]
no_license
features1 = df.columns[1:2].tolist() features2 = df.columns[6:].tolist() features = features1 + features2 x_original=df[features] x=pd.DataFrame(prep.MinMaxScaler().fit_transform(x_original)) x.columns = features y=df["sample"] x_train, x_test, y_train, y_test = train_test_split(x, y, train_size=0.95, stratify=y) k...
true
2dca53f93406f546a2fc66eee598222169bb9ba2
terryhn1/portfolio
/src/assets/scripts/convertJSON.py
UTF-8
400
2.609375
3
[]
no_license
import json from collections import defaultdict import os def leagueIcons(): icons = os.listdir('src/assets/league_icons') container = defaultdict(list) for i in icons: container["images"].append("/assets/league_icons/" + i) f = open('src/assets/league_icons/collector.json', 'w') json...
true
f8b604ec846d8884888c32a9d88545e9145420a9
n-ika/abx_test_strut
/model/supervised/scripts/equiprobable_lm.py
UTF-8
1,167
2.546875
3
[]
no_license
import pandas as pd import sys #read abkhazia text.txt file FILE = sys.argv[1] COMP = sys.argv[2] LEXICON = sys.argv[3] OUT_FOLD = sys.argv[4] text_df = pd.read_csv(FILE, sep=" ", header=0,\ names=['utt_id', 'text']) comp_df = pd.read_csv(COMP, sep=",") lexi_df = pd.read_csv(LEXICON, sep=" ", he...
true
36984978fc17e916defd2c9bb3ed47ea589c556f
BeefCakes/CS112-Spring2012
/Day8-3.py
UTF-8
1,835
3.3125
3
[]
no_license
#/usr/bin/env python from random import randint import pygame from pygame import draw from pygame.locals import * pygame.init() screen = pygame.display.set_mode((800,600)) screen.fill((0,0,0)) #black color background done = False def draw_tie(surf, color, pos, size=40): x, y = pos width = size/8 draw.re...
true
2e6f00566d5762ae24f200925548104ff1961a51
skripkar/noc
/services/web/apps/kb/parsers/loader.py
UTF-8
3,152
2.578125
3
[ "BSD-3-Clause" ]
permissive
# -*- coding: utf-8 -*- # ---------------------------------------------------------------------- # Parser loader # ---------------------------------------------------------------------- # Copyright (C) 2007-2018 The NOC Project # See LICENSE for details # ----------------------------------------------------------------...
true
6429efaaef583765276e946a9d2411d62db060e9
GitZW/LeetCode
/leetcode/editor/cn/day_013.py
UTF-8
1,576
4.125
4
[]
no_license
""" You have two numbers represented by a linked list, where each node contains a single digit. The digits are stored in reverse order, such that the 1's digit is at the head of the list. Write a function that adds the two numbers and returns the sum as a linked list.   Example: Input: (7 -> 1 -> 6) + (5 -> 9 -> 2)....
true
d604d14685ae22bff4b62eb49b6ff312f8d43479
ankit-shrivastava/flask-cognito-auth
/flask_cognito_auth/decorators.py
UTF-8
7,368
2.671875
3
[ "MIT" ]
permissive
#!/usr/bin/env python3 """ File handle the decorators for AWS Cognito login / logout features. On successfull login, add "groups" in session object if user is part of AWS Cognito group. This helps application for authorization. """ import logging import json import requests from requests.auth import HTTPBasicAuth fro...
true
3db1f02396550c375b09eeafa421bbe2b19acd95
StephenLi55/Bacillus_RNA_crosslinking_analysis
/Combining_all_single_end_output.py
UTF-8
2,243
2.609375
3
[]
no_license
#simply throw all single end alignment output (both chimeric and non-chimeric together). # That should allow normalisation based on the #set working directory import os import sys PATH="/home/wms_stephen/Adam/STAR_output" #set working directory os.chdir(PATH) #========================================================...
true
dbd84fae3744a156e8df1b15a4e928ef513a8301
shostetter/DataModeling_NoSQLDB
/CassandraPreprocessing.py
UTF-8
2,534
3.15625
3
[]
no_license
# Import Python packages import re import os import glob import numpy as np import json import csv def get_filepaths_to_process_event_data(): ''' Creating list of filepaths to process original event csv data files ''' # Get your current folder and subfolder event data filepath = os.getcwd()...
true
5fd3f0304f838214aa576a3c34f1c77401bfe336
christopherfelt/Zombie_Game
/Level_Layout.py
UTF-8
171
3.109375
3
[]
no_license
import pygame class Wall(object): walls = [] def __init__(self, pos): Wall.walls.append(self) self.rect = pygame.Rect(pos[0], pos[1], 20, 20)
true
a09153f70d20e60204b13c7b48b97cd8130399a5
lostloch/zhongyi
/LagouSpider_TaoLin/proxies.py
UTF-8
921
3.015625
3
[]
no_license
# -*- coding:utf-8 -*- # 设置代理,使用代理为:西瓜代理 def obtainProxy(): import requests # 设置header user_agent = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.122 Safari/537.36' referer = "http://www.xiguadaili.com/" headers = {"user-agent": user_ag...
true
52a6b1e13d4712509570429063e90050b29bc571
guillu97/NeyqohBot
/commands/players_commands.py
UTF-8
2,387
2.609375
3
[]
no_license
import discord from discord.ext import commands import asyncio import constant from data_struct.bot import Bot from data_struct.player import Player from data_struct.roles import * from roles_compute import calc_roles from data_struct.target import Target bot = Bot() @bot.command(name='join', help='rejoindre une pa...
true
fbe1a85c3619abd5b78c5f3f454ab2c8f9f91ae5
ojakkawi/AWS_Info
/aws-info.py
UTF-8
4,442
2.8125
3
[ "MIT" ]
permissive
#!/usr/bin/env python # -*- coding: UTF-8 -*- import cgi import os import subprocess import json # Enable debugging import cgitb cgitb.enable() # Set the command to use for obtaining AWS information aws_script='./aws_info.sh' # # Function to traverse JSON object and produce an HTML table representation # Argument:...
true
e54697d2024699dcf380bd821a2dd616e6c9f306
EmrahTfn/Anomaly-Based_Intrusion_Detection_Case_Study
/CNN_model.py
UTF-8
3,902
2.640625
3
[]
no_license
# This script was written in google colab jupyter notebook environment, # some functions might be environment-specific. # imports import tensorflow as tf import pandas as pd import numpy as np from sklearn.model_selection import train_test_split import io import keras from tensorflow.python.keras.layers import Dense,...
true
2a3de7ef85e466cd1b4f315bc6171f95bace5ff4
wanghuafeng/lc
/191. 位1的个数.py
UTF-8
1,489
4.15625
4
[]
no_license
#!-*- coding:utf-8 -*- """ 编写一个函数,输入是一个无符号整数,返回其二进制表达式中数字位数为 ‘1’ 的个数(也被称为汉明重量)。 示例 1: 输入:00000000000000000000000000001011 输出:3 解释:输入的二进制串 00000000000000000000000000001011 中,共有三位为 '1'。 示例 2: 输入:00000000000000000000000010000000 输出:1 解释:输入的二进制串 00000000000000000000000010000000 中,共有一位为 '1'。 示例 3:...
true
7d42741ae35ef1ed6b36f9665c47943a8275bd9d
Wolnosciowiec-Archive/boautomate
/boautomate/boautomatelib/tokenmanager.py
UTF-8
945
2.734375
3
[]
no_license
from contextlib import contextmanager from .persistence import Pipeline, Execution, Token from .repository import TokenRepository class TokenManager: _repository: TokenRepository def __init__(self, repository: TokenRepository): self._repository = repository def request(self, pipeline: Pipeline,...
true
f4eccbfead2c95e6bf7f8c4b1613d02288eefc92
larspet/pitch-actor
/src/audio.py
UTF-8
5,203
2.65625
3
[]
no_license
import numpy as np import librosa as rosa import pyaudio import wave import time from struct import unpack, pack MIN_FREQ = 30 MAX_FREQ = 350 class Audio(): RECORD_RATE = 11025 TEMP_WAV = 'tmp.wav' # Where to save recordings. FRAME_LEN = 1024 HOP_LEN = 512 CURSOR_OFFSET = 0.1 # How many seconds to delay the p...
true
c4ec884cd803016facda4a0dca0e0ed13aa20142
aura08/Python-ML
/MultivariateLinearRegression/classification.py
UTF-8
1,004
2.84375
3
[]
no_license
# -*- coding: utf-8 -*- from numpy import loadtxt,zeros,append,floor,savetxt from Gradient import gradientDescend alpha=0.001 #learning rate iteration=10000 #iteratıonn of thetas update function x=loadtxt('Test',delimiter=',',usecols=(0,1,2,3))#take xValues from Test set y=loadtxt('Test',delimiter=',',usecols=...
true
5411798e7e9d0477cb4b4273976ba8a5c292c541
lucyowusu/Lab_Python_02
/Question3.py
UTF-8
178
3.578125
4
[]
no_license
print 'Question 3' print'' i=0 print "The output is=\n", while i < 10: i+=1 if i%2 == 0: print i print'' print'The loop is run through 10 times ie from 0-9.'
true
4297df465b39d4676bc7fa1c567dd0ec63cfe26f
JoonVan/devide
/modules/insight/cannyEdgeDetection.py
UTF-8
4,365
2.78125
3
[]
no_license
# Copyright (c) Charl P. Botha, TU Delft # All rights reserved. # See COPYRIGHT for details. import itk import module_kits.itk_kit as itk_kit from module_base import ModuleBase from module_mixins import ScriptedConfigModuleMixin class cannyEdgeDetection(ScriptedConfigModuleMixin, ModuleBase): def __init__(self, m...
true
f23a508debf6e925a553b5ff829340a81d8f01d5
blitzmann/adventofcode
/2016/day9/solve.py
UTF-8
1,649
3.625
4
[]
no_license
s = '' with open('input.txt', 'r') as file: for line in file: s += line.strip() decompress = '' i = 0 while i < len(s): c = s[i] if c == "(": # start finding our expansion variables start = i end = None for i2, c2 in enumerate(s[i:]): if c2 == ")": ...
true
189a66577cdc042d34151c0324d2c06cb7da9196
ihmeuw/vivarium
/src/vivarium/framework/values.py
UTF-8
23,704
3.5
4
[ "BSD-3-Clause" ]
permissive
""" ========================= The Value Pipeline System ========================= The value pipeline system is a vital part of the :mod:`vivarium` infrastructure. It allows for values that determine the behavior of individual :term:`simulants <Simulant>` to be constructed across across multiple :ref:`components <compo...
true
a66a2735ba109b8d6a055bc0f355cd4e440016f2
boubinjg/SoftwarePilot
/externalModels/python/Brightness/Brightness.py
UTF-8
1,702
2.890625
3
[ "MIT" ]
permissive
import argparse from PIL import Image, ImageStat import math parser = argparse.ArgumentParser() parser.add_argument('fname') parser.add_argument('top') parser.add_argument('right') parser.add_argument('bottom') parser.add_argument('left') parser.add_argument('pref', default="", nargs="?") args = parser.parse_args() d...
true
11929cafc765542f063caa9da0857cc053aca156
kirankumargosu/MissileGame
/tank.py
UTF-8
2,021
3.40625
3
[]
no_license
from graphics import Graphics import pygame class Tank: __instance = None __tankImage = pygame.image.load("resources/images/tank.png") # __tankImage = pygame.image.load("resources/images/boom01.jpg") __currentPosition = [290, 400] __graphics = None @staticmethod def getInstance(): ...
true
de04ca7627edf866cb8a17132fd540ebfd2727bf
Ankit-Developer143/Programming-Python
/edabit/burrp.py
UTF-8
85
2.734375
3
[]
no_license
def long_burp(num): return "Bu{}p".format("r" * num) print(long_burp(3)) #op:-Burrrp
true
acb47c61250427d72c8714dd47ba7640506bf226
arimendelow/python_games
/eskiv/eskiv.py
UTF-8
7,000
3.625
4
[ "MIT" ]
permissive
import pygame import random import math pygame.init() # Always need to do this gameName = "Eskiv" # Control the size of the elements playerRad = 8 objRad = 8 obstRad = 5 # Controls the speed of the elements playerVel = 12 obstVel = 10 # Allow us to set our FPS clock = pygame.time.Clock() # Commonly used colors bla...
true
eef2403e6ea5bd5f1b7768e7b0c8f1f2c010366e
AnhellO/DAS_Sistemas
/Ene-Jun-2022/andrea-horizel-garcia-fuentes/Practica-2/Capitulo-10/num_fav_recordado.py
UTF-8
387
3.34375
3
[ "MIT" ]
permissive
import json try: with open('favorite_number.json') as filenombre: numero = json.load(filenombre) except FileNotFoundError: numero = input("Cual es tu numero favorito? ") with open('favorite_number.json', 'w') as filenombre: json.dump(numero, filenombre) print("gracias!, Lo recordare.") ...
true
afe4d9b0ffd57bd528ca8f010c27af64b459f437
milleva/PythonFiddle
/sum.py
UTF-8
161
3.03125
3
[]
no_license
summa = 0 lkm = 0 while 1: try: x = int(input('number: ')) except: break summa += x print(summa)
true
d3ea64a4d7f6731afad7e5a9dd9e76442f8c2107
pdirita/Computer-Vision-Applets
/whitebalance/prob2.py
UTF-8
2,769
3.3125
3
[]
no_license
## Default modules imported. Import more if you need to. import numpy as np from skimage.io import imread, imsave ## Fill out these functions yourself ## Take color image, and return 'white balanced' color image ## based on gray world, as described in Problem 2(a). For each ## channel, find the average intensity ac...
true
3a249470b9c551a574dadecb7bc2956c26e721ac
zaqwes8811/cpp-tricks
/edu/courses/m6_006/py_mit6_006/heap/__init__.py
UTF-8
465
3.390625
3
[ "Apache-2.0" ]
permissive
# coding: utf-8 def shift_idx(f): def wrapper(*args): return f(*args)-1 return wrapper class Heap(object): def __init__(self): pass @staticmethod @shift_idx def parent(i): return i/2 @staticmethod @shift_idx def left(i): return 2*i @staticme...
true
3f44416548d524287b7a9484451abb4de1792aff
qamine-test/codewars
/kyu_6/row_of_the_odd_triangle/test_odd_row.py
UTF-8
2,676
3.609375
4
[ "Unlicense", "BSD-3-Clause" ]
permissive
# Created by Egor Kostan. # GitHub: https://github.com/ikostan # LinkedIn: https://www.linkedin.com/in/egor-kostan/ # ALGORITHMS PERFORMANCE import unittest import allure from utils.log_func import print_log from kyu_6.row_of_the_odd_triangle.odd_row import odd_row @allure.epic('6 kyu') @allure.parent_suite('Nov...
true
a1612e78546d1908d9b1b7be36e086c53cedba62
dfki-ric/phobos
/phobos/scripts/convert.py
UTF-8
5,137
2.6875
3
[ "BSD-3-Clause" ]
permissive
#!python3 def can_be_used(): return True def cant_be_used_msg(): return "" INFO = 'Converts the given input robot file to SDF/URDF/PDF/THUMBNAIL/SMURF/SMURFA/SMURFS.' def main(args): import argparse import os.path as path from ..core import Robot, World from ..utils import misc, resource...
true
87d5a483281309ebc1e7d0da04ddeda26b062913
DanijelMisulic/Petnica-assigments
/Key points.py
UTF-8
3,419
2.609375
3
[]
no_license
import os import numpy as np if __name__ == "__main__": a_dir = raw_input() za_split = os.path.basename(a_dir) for subdir, dirs, files in os.walk(a_dir): for file in files: putanja = os.path.join(subdir, file) with open(putanja, 'r') as f: fajl = ...
true
9776c827ba4c3613536d1e2f516b6b682c01d2d8
liuchangling/leetcode
/7.整数反转.py
UTF-8
1,723
3.65625
4
[]
no_license
# # @lc app=leetcode.cn id=7 lang=python3 # # [7] 整数反转 # 假设我们的环境只能存储得下 32 位的有符号整数,则其数值范围为 [−2**31, 2**31 − 1]。 # 请根据这个假设,如果反转后整数溢出那么就返回 0。 # 方案1: 转字符串,切片,转会int 就搞定了。实际上,传入 ‘-123’就错啦.需要特殊处理一下 # 这种方法的问题,判断多,转换类型多,还涉及字符串拼接操作,导致速度只打败66% # 方案2: 有没有办法通过纯数字搞定这个问题? # q = x % 10 # r = 10 * r + q 咦 结果也是66.72% 哈哈哈哈哈 # 方法3 # ...
true
fbf351c21da52e65b3cf84b92b97301a51b83174
trungtruc123/Python-Crawdata-OpenCV
/thread.py
UTF-8
688
3.234375
3
[]
no_license
import threading from queue import Queue import time print_lock =threading.Lock() def exampleJob(worker): time.sleep(0.5) with print_lock: print(threading.current_thread().name, worker) def threader(): while True: worker = q.get() exampleJob(worker) q.task_done(...
true
2a18893d9cfa3779c0666b00feac7f7a570ee257
GitJavaProgramming/python_study
/py_pkg_games/game_functions.py
UTF-8
7,333
2.90625
3
[]
no_license
# 游戏公共函数模块 import sys from time import sleep import pygame from game.alien import Alien from game.bullet import Bullet ''' 事件处理 ''' def check_keydown_events(e_key, cfg, screen, ship, bullets): if e_key == pygame.K_RIGHT: ship.moving_right = True elif e_key == pygame.K_LEFT: ship.moving_left...
true
1a8ef6a58e06634be944caceaa3beb7fa43ec1de
ThermoDev/Capstone-Project
/backend/repository/base_repository.py
UTF-8
2,069
3.515625
4
[]
no_license
from typing import Iterable, Optional class BaseRepository: def build_select_all_query(self, table: str, identifiers: Optional[Iterable[str]] = None) -> str: query_string = f'SELECT * from {table}\n' if identifiers: query_string += self._build_identifiers_clause(identifiers) r...
true
d47845a91a6ec60b18988bb719a5a2b614213366
asswecanfat/git_place
/杂项/单词长度比较.py
UTF-8
685
3.078125
3
[]
no_license
class Word(str): def __init__(self,a=''): ass = list(a) self.a = len(a) i = 0 for each in ass: if each != ' ': i += 1 else: self.a = i print(self.a) break ...
true
da57e96b748ddaa54e83fa52bfcfc30d91eb9d6b
dsreliete/TV
/tv.py
UTF-8
1,485
3.640625
4
[]
no_license
class Televisao(): """ Classe Televisão criada em 21/05/16 """ def __init__(self): self.canais = 0 self.volume = 5 self.ligada = False def ligar(self): if self.ligada == False: self.ligada = True print('TV foi ligada') else: ...
true
a09214241c6c5cf36f57be31f2035ee09cf531d1
bilgiday/sca-tutorial
/cpa_singlebyte.py
UTF-8
5,744
2.640625
3
[]
no_license
import numpy as np import matplotlib.pyplot as plt import random ################## DON'T TOUCH: Utilities for later use ################## # An array to keep Hamming weight values of all numbers from 0 to 255 # Hamming Weight(x) = Number of ones in a given x # Example: # hw[146] = hw[1001_0010] = 3 # hw[211]...
true
a5038d9a1743aebcd867d8ab27a3a5bc8466aa66
UtkarshaVidhale/Mask-detector
/data_prep.py
UTF-8
2,068
2.75
3
[]
no_license
#!/usr/bin/env python # coding: utf-8 from os import listdir from os.path import isfile, join import pandas as pd import numpy as np from sklearn.utils import shuffle import cv2 from tqdm import tqdm # python -m pip install --upgrade pip # pip install opencv-python #download link: https://drive.google.com/u/0/uc?id...
true
bb1e293e0540b2f5351ddcee0a6e67eef6a0a6af
aelerin/webproject
/webservices/src/models/user_model.py
UTF-8
2,144
2.625
3
[]
no_license
from flask_sqlalchemy import SQLAlchemy db = SQLAlchemy() # création d'une classe qui permettra de faire des objets qui mettront en forme les informations recus depuis la BDD class User(db.Model): __tablename__ = 'users' id = db.Column(db.Integer, primary_key=True) nom = db.Column(db.String, nullable=Fa...
true
db1fcc18b4fcc4f343f0aa0208b8799a3b978b32
jtlai0921/yuanta_python3-master
/yuanta_python3-master/lesson09/Exception4.py
UTF-8
127
3.015625
3
[]
no_license
a = 100 b = 0 try: c = a / b except BaseException as e: print(type(e).__name__) print(e.args) else: print(c)
true
49de48d49a9d900ec2cec986433aef0c9bd7edda
ArisPavlides/Saxophone_Practice
/saxophone_practice.py
UTF-8
314
3.5625
4
[]
no_license
import random import time notes = ["ντο", "ντο# AKA ρεβ", "ρε", "ρε#", "μι", "φα", "φα#", "σολ", "σολ#", "λα", "λα#", "σι"] octave = ["medium", "high"] random.shuffle(notes) while True: print("Give me a: " + random.choice(octave) + " " + random.choice(notes)) time.sleep(6)
true
b57f02d169943d541350df241197b67902e680d5
limitusus/snippet
/aws-ec2-type-offerings/offerings-to-table
UTF-8
1,462
2.84375
3
[ "MIT" ]
permissive
#!/usr/bin/env python3 import csv import sys import argparse import json class OfferingsConveter: def __init__(self): self._args = None def options(self, argv): parser = argparse.ArgumentParser( description="Convert EC2 Instance type offerings" ) parser.add_argume...
true
834ff233cfc1f41c35324406b1109748b3ce1821
gtalarico/revitapidocs.code
/0-python-code/HowTo_GetPhaseByName.py
UTF-8
610
2.765625
3
[ "MIT" ]
permissive
""" Retrieves a phase by its Name TESTED REVIT API: - Author: Gui Talarico | github.com/gtalarico This file is shared on www.revitapidocs.com For more information visit http://github.com/gtalarico/revitapidocs License: http://github.com/gtalarico/revitapidocs/blob/master/LICENSE.md """ from Autodesk.Revit.DB impor...
true
461ed312f1d37f3c0ef974bfff04515d38ef9e01
Roshi407/Python_HW
/PyPoll/main.py
UTF-8
1,178
3.1875
3
[]
no_license
import os import csv candidates = {} filepath = "/Users/williamplymouth/Desktop/Python_HW/PyPoll/Resources/election_data.csv" with open(filepath, 'r') as csvfile: csvreader = csv.reader(csvfile, delimiter=',') header = next(csvreader) print(f"{header}") csvreader = csv.reader(csvfile, delimiter=',') ...
true
d0a8e654e9eaa4e46aae09a3f800f26c95204369
muffinkilla/Project-Euler
/python/20/twenty.py
UTF-8
267
3.484375
3
[]
no_license
from math import factorial def facdigsum(n): """Returns the sum of the digits of the factorial of n.""" facstr = str(factorial(n)) sum = 0 for x in facstr: sum += int(x) return sum if __name__ == "__main__": print(facdigsum(100))
true
e74d6b94f1d448f8e0c58a00bc52d5cf1feb64c6
JohannesBetz/Udacity-Project3-Behavorial-Cloning
/CarND-Behavioral-Cloning-P3-master/projectNN_Neu.py
UTF-8
5,704
2.578125
3
[]
no_license
import csv import os os.environ['TF_CPP_MIN_LOG_LEVEL']='2' #Delete Warnings import tensorflow as tf import cv2 import numpy as np import h5py from keras.models import Sequential from keras import metrics from keras.layers import Flatten, Dense, Lambda, Dropout, MaxPooling2D, Convolution2D, Cropping2D, Activation,...
true
c1cca20eaa099e965178284526735718f89d0b1d
viveksunder77/My-Projects
/python/quiz/main.py
UTF-8
1,628
3.328125
3
[]
no_license
from files.superuser import * from files.config import * from files.student import * superuser=superusers() st=student() n=True print("**************welcome to quiz**************") while(n): print("1.create a super user \n2.super user login\n3.register a student \n4.student login\n5.check result\n6.exit ")...
true
d906cf811a439ed293ef545689f762a40eafd6eb
Piotr9923/Projekt_PAMiW
/kamien_milowy_5/invoicer/invoicer.py
UTF-8
1,842
2.546875
3
[]
no_license
import pika from sys import exit from dotenv import load_dotenv from os import getenv import json from terminaltables import AsciiTable from datetime import datetime load_dotenv('.env') Q_HOST = getenv("Q_HOST") Q_LOGIN = getenv("Q_LOGIN") Q_PASSWORD = getenv("Q_PASSWORD") Q_VH = getenv("Q_VH") credentials = pika.Pl...
true
bcfcf1d9366a6b81a726f0d09ebea69bb3e879e0
w495/python-video-shot-detector
/shot_detector/charts/event/trend/mean_atan_vote_event_chart.py
UTF-8
6,979
2.59375
3
[]
permissive
# -*- coding: utf8 -*- """ This is part of shot detector. Produced by w495 at 2017.05.04 04:18:27 """ from __future__ import (absolute_import, division, print_function, unicode_literals) import logging import numpy as numeric from shot_...
true
51ee52704bc2c618dd8f048c3d0d3f023ea25ae6
ShashvatS/anonstake
/anonstake/scripts/binomial_constants.py
UTF-8
3,234
2.71875
3
[]
no_license
from mpmath import mp, mpf, log, exp mp.prec = 80 numcoins = mpf(2**60 - 1) negl = mpf(1.0) * pow(mpf(0.5), 80) def log_nck(n, k): if k == 0 or k == n: return log(mpf(1)) nint = n kint = k n = mpf(n) k = mpf(k) ans = mpf(0) for i in range(nint, nint - kint, -1): ans += log...
true
920587d943135f8eab6005d34cb5e34b97c7c9ec
cvdb/betty
/app/run_betty.py
UTF-8
7,542
2.578125
3
[]
no_license
import argparse import os import datetime import time import json import pandas as pd import numpy as np import pytz import betfairlightweight from betfairlightweight import filters from betfairlightweight.resources.bettingresources import ( PriceSize, MarketBook ) # create trading instance certs_path = r'/h...
true
ade5b800fd3ed6c5713c9596ddc469df42e829f9
ameroyer/TFDatasets
/dataset_utils/cartoonset.py
UTF-8
9,513
2.625
3
[ "MIT" ]
permissive
from __future__ import print_function ######################################## # CartoonSet dataset # # https://google.github.io/cartoonset/ # ######################################## import base64 import csv import os import numpy as np from matplotlib import image as mpimg from .tfrecords_utils impo...
true
8a1bedf6dfc47d44be64e4ad5456f58151e87f0c
CarsonScott/Intelligent-Logical-Framing
/src/Grouping.py
UTF-8
615
3.234375
3
[]
no_license
from Object import * def frequency(G, X, k): # Determine the total number of objects in a group that are equivalent to a given object with respect to a certain property y = 0 for j in range(len(G)): y += Equal(X, G[j], k) return y * 1 / len(G) def accordance(G, X): # Determine the sum of frequencies fo...
true
cb8c4721cf96e4aa609f4431ae28453924e935f1
HeCongjie/DataMining
/第一次作业/code.py
UTF-8
446
3.609375
4
[]
no_license
#!/usr/bin/env python def find_len(str_arr, point): end = point+1 start = point max_len = 0 while start>=0 and end<=len(str_arr)-1: if str_arr[start] == str_arr[end]: start -=1 end +=1 max_len +=2 else: return max_len return max_len if __name__ == '__main__': str_ = input("Input string:") str_a...
true
e29aa233894c6d95ea1a0c3cba324b3b2fe5baca
Leo-Malay/Python-Scripts
/Ceaser_cipher_dencrypt.py
UTF-8
1,868
3.515625
4
[]
no_license
# This is a Ceaser Dencryption algorithm which works on a simple key. # [Log]: Code improved for efficiency. Dt.05-02-2020 # Importing module import os # Taking the cipher file as input(! With extension !) file_name = input("Enter Cipher Filename: ") file_data = open(f"{file_name}","r") cipher = file_data.re...
true
4af1a13c09846d080efcc258ded9368a0400afb9
AntoniyaV/SoftUni-Exercises
/Fundamentals/01-Basic-Syntax-Conditional-Statements-and-Loops/06-next-happy-year.py
UTF-8
1,120
3.703125
4
[]
no_license
year = int(input()) counter = 0 new_year = '' while new_year == '': year += 1 str_year = str(year) for i in str_year: counter = str_year.count(i) if counter == 1: new_year += i else: new_year = '' break print(new_year) # year = (input()) # # h...
true
767dd31d370478ea6abdb75f8d912fa844ce7c7a
fernandolfmm/masiveMsg
/whats.py
UTF-8
308
2.5625
3
[]
no_license
import pywhatkit # Usamos Un try-except try: # Enviamos el mensaje pywhatkit.sendwhatmsg("+5218991012727", "Hola soy un robot, Mensaje De Prueba", 2,11) print("Mensaje Enviado") except: print("Ocurrio Un Error")
true
71401bb24f8e74583e187df4f4aac27c5ae244e4
Fischerlopes/EstudosPython
/cursoEmVideoMundo1/ex026.py
UTF-8
145
3.484375
3
[]
no_license
a = str(input('Digite uma frase: ').strip().lower()) b = a[:1] d = len(b) in a #print('A letra {}, aparece {} vezes na frase'.format(b,d))
true
5e489437fbfdcb6340de403743201c39cefb20bb
njovujsh/crbdjango
/CRB/validators/subsystems/csvwriters/processcsvs.py
UTF-8
1,455
2.78125
3
[]
no_license
import csv from django.http import HttpResponse from django.utils.encoding import smart_str class ProcessCSV(object): """ Object which will be used to process csv fileformat. """ def __init__(self, filename, dialect, delimiter="|", response=None): self.response = HttpResponse(content_type...
true
e944828968acd1233c71a924f00e8c12b13c5715
daniel-reich/ubiquitous-fiesta
/2nciiXZN4HCuNEmAi_7.py
UTF-8
263
3.09375
3
[]
no_license
def flatten(r): lists = False e = type([]) x = [] for i in r: if type(i) == e: for z in i: x.append(z) lists = True else: x.append(i) if lists: return flatten(x) else: return x
true
b56fc8ba076d0c9eddbfdbedfeb41e9898ca71ec
SR2k/leetcode
/4/394.字符串解码.py
UTF-8
2,391
3.65625
4
[]
no_license
# # @lc app=leetcode.cn id=394 lang=python3 # # [394] 字符串解码 # # https://leetcode-cn.com/problems/decode-string/description/ # # algorithms # Medium (55.90%) # Likes: 1116 # Dislikes: 0 # Total Accepted: 161.1K # Total Submissions: 287.7K # Testcase Example: '"3[a]2[bc]"' # # 给定一个经过编码的字符串,返回它解码后的字符串。 # # 编码规则为: ...
true
30fcc39585174cc62c9e2b02e7af9f4c4f8d8482
Cami-Jahr/Magireco_wikia
/upload_memoria.py
UTF-8
8,696
2.546875
3
[]
no_license
import os from json import loads from pathlib import Path from effect_translator import ( remove_repeated_target, translate, translate_jap_to_eng, translate_roman_to_ascii) from helpers import ( get_char_list, get_memo_list) from uploader import uploader memoria_header = """{{ {{PAGENAME}} |St...
true