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
d2f2e2af41591e3c776278ca909d6874963c1aaf
zhu-y11/tweuralparser
/scripts/tweet/unlabelled/lang_filter.py
UTF-8
1,929
2.5625
3
[]
no_license
# -*- coding: UTF-8 -*- import codecs import sys import os import langid import argparse import Queue import logging import threading logging.basicConfig(level=logging.INFO, format='%(asctime)-15s %(levelname)s: %(message)s') LOG = logging.getLogger('Language ID') def worker(mq): while True: payload = mq...
true
1d4fb2ca947232b6479b7b8f832d1b184ce03c49
seconddream/face_album
/Experiment/find_emotions.py
UTF-8
3,251
2.578125
3
[]
no_license
import os, shutil, cv2 emotion_root_dir = 'Emotion/' image_root_dir = 'cohn-kanade-images/' emotion_data_1 = [] emotion_data = [] test_data = [] emotion_dict = ['anger', 'contempt', 'disgust', 'fear', 'happy', 'sadness', 'suprise'] testing_target = ['happy', 'sadness', 'suprise'] emotion_cout = [0,0,0,0,0,0,0] faceCa...
true
853173196ec82535a3233fbe56088f51bb0ea0c6
RacovitaMadalina/Simplex
/SimplexImplementation/two_phase_algorithm/two_phase_algorithm_main.py
UTF-8
5,073
2.890625
3
[]
no_license
from two_phase_algorithm.phase_one_input_conversion import * from two_phase_algorithm.phase_two_input_conversion import * from two_phase_algorithm.simplex_algorithm import * def run_two_phase_on_instance(lp_system, z, z_free_term, optimization_type): if optimization_type == "max": z, z_free_term = from_ma...
true
97880cd6262cf56c83917e40df1899a01e897237
tahoeivanova/neu_uni_py_10
/fool_game_module.py
UTF-8
19,786
3.296875
3
[ "MIT" ]
permissive
import random import sys class Fool_game: def __init__(self): cards_set = [] self.cards_set_6_10 = [x for x in range(6, 11)] # генерируем список карт от 6 до 10 # создаем список cards_set_1_suit - карты одной масти cards_set_1_suit = list(map(str, self.cards_set_6_10)) + 'Валет Дама ...
true
d15a01896d4a811914f275c5ed663762a40b7218
jungbomp/AlphaBetaPruning
/hw1cs561s18_alphabeta.py
UTF-8
9,993
2.75
3
[]
no_license
import sys import re import copy MAX_NUM = 2147483647 MIN_NUM = -2147483648 with open(sys.argv[2], "rt") as fi: inputList = [line.rstrip() for line in fi] # get the day (Contains "today" or Yesterday" indicating which day the RPL was posted) day = inputList[0].upper() # get the player (Contains either "R1" or...
true
ba351702a73a59e8588fd4227cd22cfa5d571999
codeAligned/LEETCodePractice
/Python/IntersectionArray2.py
UTF-8
484
3.09375
3
[ "MIT" ]
permissive
class Solution(object): def intersect(self, nums1, nums2): """ :type nums1: List[int] :type nums2: List[int] :rtype: List[int] """ dict = {} for n in nums2: if n not in dict: dict[n] = 1 else: dict[n] +=...
true
fff1f72334b3a548d214143385f5aeaf676dd188
taitujing123/my_leetcode
/191_hammingWeight.py
UTF-8
1,056
3.375
3
[]
no_license
""" 编写一个函数,输入是一个无符号整数,返回其二进制表达式中数字位数为 ‘1’ 的个数(也被称为汉明重量)。   示例 1: 输入:00000000000000000000000000001011 输出:3 解释:输入的二进制串 00000000000000000000000000001011 中,共有三位为 '1'。 来源:力扣(LeetCode) 链接:https://leetcode-cn.com/problems/number-of-1-bits 著作权归领扣网络所有。商业转载请联系官方授权,非商业转载请注明出处。 """ class Solution(object): d...
true
561bb80a664456564dfdc4b7eb459bedac8e53ba
szahran1/Geography-Quiz-GUI
/gui.py
UTF-8
2,351
3.171875
3
[]
no_license
from tkinter import * from questions import questions, choices, answer class Quiz: def __init__(self, master): self.opt_selected = IntVar() self.qn = 0 self.correct = 0 self.ques = self.create_q(master, self.qn) self.opts = self.create_options(master, 4) ...
true
6f123229c746b9dcd7d21802e6b9aadaceb22a0c
jralipe/ccs221
/mandala/mandala_TheodoreWalterGalve.py.py
UTF-8
3,902
3.828125
4
[]
no_license
import turtle #pattern1 def draw_square(some_turtle): for i in range(1,5): some_turtle.forward(210) some_turtle.right(90) def draw_art(moving_angle): window = turtle.Screen() window.bgcolor('black') pattern = turtle.Turtle() pattern.color('red') pattern.pensize(4...
true
8fa021476c00d76e9fc79d39b94df614f2a3cdb6
edlanglois/cbuffer
/tests/test_circular_buffer.py
UTF-8
11,825
2.921875
3
[ "MIT" ]
permissive
import pytest from edl_cbuffer import CircularBuffer def test_circular_buffer_init_unsized_error(): with pytest.raises(TypeError): CircularBuffer() def test_circular_buffer_init_empty(): b = CircularBuffer(5) assert list(b) == [] def test_circular_buffer_init_partial(): b = CircularBuffer...
true
6e91563bc44ebb05c5ece7ddfd6bda66263e7718
choco9966/Algorithm-Master
/programmers/코딩테스트 대비반/1주차/전염병.py
UTF-8
3,460
3.34375
3
[ "Apache-2.0" ]
permissive
from collections import deque from itertools import chain import copy def solution(m, n, infests, vaccinateds): ''' BFS 이용 - 속도 초과 ''' answer = 0 infests = deque(infests) infested = [[0] * n for _ in range(m)] visited = [[0] * n for _ in range(m)] # 방문한 곳을 다시 방문할 이유가 없음 for i in infe...
true
0f35f67252259a48ca8666d813298e52d338d760
epinapala/chevy-charge-status
/app.py
UTF-8
3,085
2.703125
3
[ "MIT" ]
permissive
#!/usr/local/bin/python3 import os import getpass from selenium import webdriver from selenium.webdriver.chrome.options import Options from selenium.webdriver.common.keys import Keys from selenium.common.exceptions import TimeoutException from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver...
true
df59d1c7e038e716d1e89e7bdaa666916d1a0f68
lfochamon/ai
/ai_msmtp.py
UTF-8
1,013
2.90625
3
[ "MIT" ]
permissive
#!/usr/bin/python import fileinput, re, collections # Output email header print "From: cloud@lps.usp.br" print "To: cloud@lps.usp.br" print "Subject: msmtp.log AI" print '' print 'Unprocessed lines:' toList = [] dateList = [] for line in fileinput.input(): # Strip blank spaces line = line.strip() # Count ...
true
aa2522d4fa5b4fac4e404924b28852cfc106ffa1
rbnset/Teknik_Pemrogaman
/Topik1_Menyiapkan Python dan Struktur Program/Program4.py
UTF-8
42
2.59375
3
[]
no_license
umur = 50 print(umur) print('umur', umur)
true
20141799520f2e37ff9c8baafbb499eac2d281dd
varsha04kshirsagar/LetsUpgrade-AI-ML
/Day10/Attrition.py
UTF-8
2,922
3.328125
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Wed Jul 22 18:02:43 2020 @author: varsh """ #Step1 - Launching import pandas as pd import numpy as np import matplotlib.pyplot as plt dataset1=pd.read_csv("general_data.csv") print(dataset1.head() ) print(dataset1.columns) #Step 2 - Data Treatment: print(datas...
true
eddb05553e44bc053db844013b6a8d5fa6cd0885
tammavarapu/PredictingHeartDisease
/src/utils/all_utils.py
UTF-8
333
3.28125
3
[]
no_license
import yaml import os def read_yaml(path_to_yaml : str) -> dict: with open(path_to_yaml, 'r') as yaml_file: content = yaml.safe_load(yaml_file) return content def create_dir(dirs : list): for dir_path in dirs: os.makedirs(dir_path, exist_ok=True) print(f"directory is created in...
true
ff8071bd09ba00206f6e412c473f6a7174b79258
MSilva98/MultiGoal_Nav_Mobile_Robot_HRL
/HRL_epuck/Multi_Goal_no180/run_multiGoal.py
UTF-8
14,618
2.640625
3
[]
no_license
"""train_multiGoal controller.""" # python script to control the robot with a QTable after training # You may need to import some classes of the controller module. Ex: from os import path, stat from controller import Supervisor import numpy as np from lowLevel import Agent as lowLvlAgent from highLevel import Agent as...
true
ac899deba5d8a42d60ee37f20502546651a0d5f6
JomoSmith/proj1and2Info3180
/app/views.py
UTF-8
2,046
2.78125
3
[]
no_license
""" Flask Documentation: http://flask.pocoo.org/docs/ Jinja2 Documentation: http://jinja.pocoo.org/2/documentation/ Werkzeug Documentation: http://werkzeug.pocoo.org/documentation/ This file creates your application. """ from app import app from flask import render_template, request, redirect, url_for from fl...
true
9c0f8fed4fba747ba83e5b1c9d8b1853ed2e7229
jasonbrackman/advent_of_code_2016
/day_03.py
UTF-8
1,321
3.46875
3
[]
no_license
import helpers import re def parse_lines(): lines = helpers.get_lines("./data/day_03.txt") pattern = re.compile(r"(\d+)\s+(\d+)\s+(\d+)") results = list() for line in lines: found = pattern.search(line) a, b, c = found.groups() results.append((int(a), int(b), int(c))) retu...
true
b36e65c832cdefb4423920f6f0868b6fbaf5b953
digarg-bestpeers/python-training
/oops/inheritence/multilevelInheritence.py
UTF-8
1,242
3.875
4
[]
no_license
class Person: "Base class person information" def __init__(self, name, age): self.name = name self.age = age def displayPerson(self): return 'Person Information:-\nName: {}\nAge: {}'.format(self.name, self.age) class Student(Person): 'Student information derived from person class' def __init__(self, name, ...
true
7b0ed46d6bf3145db247f60e7584fedc35bd5f7c
wanggn/CommercialLargeDataAnalysisTechnologyOfWIFIProbe
/源代码,可执行程序/Spark/计算源码-python/mkjson/mkjson.py
UTF-8
4,175
2.515625
3
[]
no_license
#coding: utf-8 ''' Match: 2017 China Software Cup Topic: Commercial large data analysis technology based on WIFI probe. School: CCUT(Changchun University Of Technology) Date: 2017.03 - 2017-06 Team: teamName --- Victors teamLeader --- Jiahui Tang teamMember --- Pengyue Zhao teamMember --- Xinguang Guo ''' ...
true
5a2d6adcf88aa479d18ab2f780884b68bc966216
Pedenite/Maratonas
/UnB/2021tep/lista1/h_boy_girl.py
UTF-8
170
3.25
3
[]
no_license
s = input() qtd = 0 for c in range(ord('a'), ord('z')+1): if chr(c) in s: qtd += 1 if qtd%2 == 0: print("CHAT WITH HER!") else: print("IGNORE HIM!")
true
0ef4753629df19194eaf75215dfd6f740dce58d9
Glaucus-2G/Hindsight-Experience-Replay
/dqn_without_her/main.py
UTF-8
2,241
2.71875
3
[]
no_license
import os import matplotlib.pyplot as plt import BitFlipEnv as bflip from dqn_without_her import DQNAgent as dqn if __name__ == '__main__': n_bits = 8 env = bflip.BitFlipEnv(n_bits) n_episodes = 30000 epsilon_history = [] episodes = [] win_percent = [] success = 0 load_checkpoint = ...
true
620fe187316be6b0b1bad5c492bb3f364e4c6607
Irreq/omnivariate-pso
/pso.py
UTF-8
11,825
3.484375
3
[ "MIT" ]
permissive
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # # pso.py # # Author : Irreq """ Omni Dimensional Particle Swarm Optimization without external libraries (RAW Python) DOCUMENTATION: Read this or see: 'README.md' or read comments in functions. Note functions: 'random' and 'uniform' ...
true
63c754ac304ee3498f63a3173e2c26543d3bdc49
Krzysztof-Lewandowski89/Python
/kurs-python/roz7/t7-7.py
UTF-8
176
3.765625
4
[]
no_license
# Scope, zasięg zmiennych x = 1 def fn(): global x #teraz mozemy pracowac na "x" z zasięgu globalnego x += 1 y = 3 print(x,y) fn() print(x)
true
fb9df589c823cc8f5e32177f082326a2f16d2e02
ctb/meep
/util/echo/echo-server-threaded
UTF-8
908
2.953125
3
[]
no_license
#! /usr/bin/env python import sys import socket import threading def handle_connection(sock): while 1: try: data = sock.recv(4096) if not data: break print 'data:', (data,) sock.sendall(data) if '.\r\n' in data: ...
true
7d9a176f4757bd51ed475286b4836fb209e80386
Ramcharanprc/Framework
/Exit.py
UTF-8
65
2.90625
3
[]
no_license
# Exit function. def Exit(): print("You have exited!") exit(1)
true
b086112e7afab26f3906be12317244dcf23c39ab
adamrodger/google-code-jam
/2009/Qualification/A - Alien Language/main.py
UTF-8
619
2.9375
3
[]
no_license
import re filename = "A-large-practice.in" outputs = [] lines = [] words = [] patterns = [] with open(filename) as f: lines = [l.strip() for l in f] L, D, N = lines[0].split(" ") D = int(D) for i in xrange(1, D+1): words.append(lines[i]) patterns = [re.compile(l.replace("(", "[").replace(")", "...
true
d6e847f6562c1f0e95e4e16506be630ffd8c72d9
lin13k/practice
/algo_problems/q421-440/q424.py
UTF-8
662
3.375
3
[]
no_license
from collections import defaultdict class Solution: def characterReplacement(self, s, k): """ :type s: str :type k: int :rtype: int """ c = defaultdict(int) start = end = 0 n = len(s) maxCnt = 0 while end < n: c[s[end]] +=...
true
a5b5caacb193ffda4ee4311440dcf3b9e627909b
JetBrains/intellij-community
/python/testData/inspections/PyUnusedLocalInspection/py2.py
UTF-8
6,443
3.09375
3
[ "Apache-2.0" ]
permissive
def foo1(): <weak_warning descr="Local variable 'aaa' value is not used">aaa</weak_warning> = 1 #fail <weak_warning descr="Local variable 'aaa' value is not used">aaa</weak_warning> = 2 #fail bbb = 1 #pass return bbb def bar(<weak_warning descr="Parameter 'self' value is not used">self</weak_warning>): #fail ...
true
63abdd930a760f9646dc11a5ff5abdf74d084907
Oleg0079912/progr.1299.student
/lessons_hillel/Exercises1,2,3.py
UTF-8
897
4.375
4
[]
no_license
# Exercise 2 numbers = [] strings = [] names = ["John", "Erica", "Jessica"] # Codding numbers.append(1) numbers.append(2) numbers.append(3) strings.append("привет") strings.append("иир") second_name = 0 second_name = names[1] print(numbers) print(strings) print("The second name on the names list is %s" % second_nam...
true
4d4063a08e291325b66b86b936811400afdca42a
lbjhuang/pystudy
/prictice/demo4.py
UTF-8
514
3.734375
4
[]
no_license
# -*- coding: UTF-8 -*- import datetime if __name__ == '__main__': print(datetime.date.today().strftime('%Y/%m/%d')) #格式化输出今天的日期 myBirthday = datetime.date(1991, 8, 27) #自定义日期并格式化输出 print(myBirthday.strftime('%Y-%m-%d')) # 日期算术运算 hisbirthday = myBirthday + datetime.timedelta(days=1) print(h...
true
fb220d084b8d2f4cb642be1011323c72d90066d5
JiajunBernoulli/silkbag
/dynamic_programming/max_sum_sub.py
UTF-8
1,166
4.03125
4
[]
no_license
''' 数组最大连续子序列和 如arr[] = {6,-1,3,-4,-6,9,2,-2,5}的最大连续子序列和为14。即为:9,2,-2,5 创建一个数组a,长度为原数组长度,不同位置数字a[i]代表0...i上最大连续子序列和, a[0]=arr[0]设置一个最大值max,初始值为数组中的第一个数字。 当进来一个新的数字arr[i+1]时,判断到他前面数字子序列和a[i]+arr[i+1]跟arr[i+1]哪个大, 前者大就保留前者,后者大就说明前面连续数字加起来都不如后者一个新进来的数字大,前面数字就可以舍弃, 从arr[i+1]开始,每次比较完都跟max比较一下,最后的max就是最大值。 ''' arr = [6, -1...
true
6f416a1dfe78323728d60f96d1170bedf868c31d
TESLA-Self-Driving-Car/smart-car-parking-system
/preprocessing/create tests/test.py
UTF-8
151
2.828125
3
[]
no_license
import winsound frequency = 200 # Set Frequency To 2500 Hertz duration = 500 # Set Duration To 1000 ms == 1 second winsound.Beep(frequency, duration)
true
c852cbc90d1a10a6bad85ddf74d878519f0e4fe8
samirad123/Lab_7
/q6.py
UTF-8
2,647
3.359375
3
[]
no_license
from tkinter import * root=Tk() root.title('Calculator') root.configure(background="#d6d2d2") root.geometry('500x500') result = " " equation = StringVar() def press(num): global result result= result + str(num) equation.set(result) def equal(): global result total = str(eval(result)) equat...
true
8fa9561f826a450cdc82aad02b54486abd707b2c
fabiofilz/python_scripts
/file_read_write_append.py
UTF-8
1,347
3.28125
3
[]
no_license
############################################## # READ / WRITE / APPEND FILE ############################################## def save(student, tp): try: f = open("students.txt", tp) ### append f.write(str(student) + "\n") f.close() except Exception: print("Cannot save") def read_file(): try: ...
true
ff11ca1a3d03b8fdb6a3b6a7e61844c930d9686c
wangyuhui12/AID1804
/python/day16/code/08_stdout_stderr.py
UTF-8
234
3.03125
3
[]
no_license
# import sys # # sys.stdout.write("hello world\n") # # sys.stderr.write("我的出现是个错误!\n") import time f = open('info.txt', 'w') f.write('hello') time.sleep(15) print("程序睡醒了,继续执行。") f.close()
true
62add309fdd54747ef8d97bb4d3eec695c799359
devciscode/attack-cli
/attack_cli/attack_navigation.py
UTF-8
4,859
2.515625
3
[ "Apache-2.0" ]
permissive
from .models import Tactic, Technique, APT, TacticTechniqueMap, TechniqueAPTMap from .setup import SetupAPTGroups, SetupTactic, SetupTechniques from attack_cli import enterprise_attack class AttackNavigator(object): def __init__(self): self.apts = {} self.tactics = {} self.techniques = {} ...
true
ee9a238db0235bd6b6ba87c5ffe7a97243fc69e1
dockerizeme/dockerizeme
/hard-gists/053b89bd6975f89f043871335dce8c5b/snippet.py
UTF-8
885
2.546875
3
[ "Apache-2.0" ]
permissive
import pprint import requests import os from urllib.request import urlopen accessToken = "xxxxxxxxxx" boardId = "0000000000" folderPath = "./images" response = requests.get( 'https://api.pinterest.com/v3/boards/'+boardId+'/pins/', params={'access_token':accessToken, 'fields':'pin.images[750x],pin....
true
f20b1bb96e0652101cd826df34b4984250e1fc0b
anushka243/UGV-Path-Planning
/Reinforcement-Learning/runDQ.py
UTF-8
3,613
3.125
3
[ "GPL-3.0-only", "MIT" ]
permissive
""" Reinforcement learning robot path planning for small grid. Main DRL file Red rectangle: UGV. Black rectangles: IoT regions [reward = 5]. Yellow bin circle: goal [reward = 10 + x*5 where x is the number of users]. All other states: ground [reward = -1]. This script is the mai...
true
3dcacf146ef9b192c86ea9f9798d380e9a28efa9
guibuenorodrigues/fifa21-teams-scrapping
/repository.py
UTF-8
708
2.828125
3
[ "MIT" ]
permissive
import mysql import pandas as pd import numpy as np class Repository(): def __init__(self, host: str, user: str, password: str, db: str): self.mysql = mysql.Mysql(host=host, user=user, password=password, db=db) self.first_execution = True def dataframe_to_my...
true
80e27d2627150bfdbc24734410a022800da1c013
subhiksha610/guvi
/Beginner/exp.py
UTF-8
174
3.765625
4
[]
no_license
def subi(base,exp): if(exp==1): return(base) if(exp!=1): return(base*subi(base,exp-1)) base=int(input(" ")) exp=int(input(" ")) print(subi(base,exp))
true
045d59e834b373484a471000167943cd46dee348
WolverineSportsAnalytics/basketball
/Scrapers/DailyMinutes.py
UTF-8
3,765
2.890625
3
[]
no_license
from bs4 import BeautifulSoup import demjson import mysql.connector import constants import urllib2 ''' This scrapes rotogrinders for daily Minutes projections in order to insert and use in our regression model ''' def rotogrinders_season_scraper(): url = "https://rotogrinders.com/game-stats/nba-play...
true
af928f23112ce0c2035b9d3e9efc7b61651a4860
erikedin/aoc2016
/aoc2016/day6.py
UTF-8
1,195
2.671875
3
[ "LicenseRef-scancode-unknown-license-reference", "MIT" ]
permissive
from collections import Counter def parse(lines): return [x.strip() for x in lines] def step1(input): """ >>> step1([ \ "eedadn", \ "drvtee", \ "eandsr", \ "raavrd", \ "atevrs", \ "tsrnev", \ "sdttsa", \ "rasrtv", \ "nssdts", \ ...
true
473c3c4b498a3b23b4bb5bf32f1e7cd1d7dc9bf8
lizyang95/leetcode
/leetcode1/reverseVowels.py
UTF-8
738
3.65625
4
[]
no_license
class Solution(object): def reverseVowels(self, s): """ :type s: str :rtype: str """ list = ['a','e','i','o','u','A','E','I','O','U'] left = 0 right = len(s)-1 string = [char for char in s] while left < right: while s[left] not in l...
true
32f0bd438344ba369780229c22f4284db436df47
NiKiZe/pybcd
/common.py
UTF-8
2,373
2.6875
3
[ "MIT" ]
permissive
import re from colors import * # how many characters are reserved for an element name when dumping DUMP_SPACING = 24 def enum(*sequential, **named): enums = dict(zip(sequential, range(len(sequential))), **named) reverse = {value: key for key, value in enums.items()} enumsl = {key.lower():value for ke...
true
2ddd119de8994f3a38fd17cf01f5a879bdc3fcf6
Xiyor/Million_Hero_Helper
/ocr_api.py
UTF-8
1,414
2.75
3
[]
no_license
# coding:utf-8 import urllib, urllib.request, base64 import json def access_token_obtain(): # client_id 为官网获取的AK, client_secret 为官网获取的SK AK = "???" SK = "???" host = 'https://aip.baidubce.com/oauth/2.0/token?grant_type=client_credentials&client_id={}&client_secret={}'.format(AK, SK) request = urll...
true
1340c23a78847d136208a3f4bf2f2c1e699508a0
alexander-ahappydandelion/kts
/kts/utils.py
UTF-8
1,510
2.609375
3
[ "MIT" ]
permissive
import hashlib import inspect from itertools import zip_longest import numpy as np import time def captcha(): np.random.seed(int(time.time())) a, b = np.random.randint(5, 30, size=2) c = int(input(f"{a} + {b} = ")) if a + b != c: return False return True def list_hash(lst, length): r...
true
93946e31b0d0ce3d173bbc0b4897e92802d11a44
newoni/BaekJoon
/python/11812.py
UTF-8
3,082
3.484375
3
[]
no_license
#<21.01.18> # made by KH import math class K_leaf: def __init__(self, number, maxSonNum, motherNum): self.number = number self.maxSonNum = maxSonNum self.motherNum = motherNum def calc_height(self): cnt = 0 std = self.number while std>0: std -= maxSo...
true
d49709ba95fc71d29382660cc135bf5a4deb5d5f
isaac-portela/Estudos-Python
/Lista3/matriz_quadrada2.py
UTF-8
752
3.46875
3
[]
no_license
# Isaac Portela da Silva # matriculate: 20192004900 while True: n = int(input()) if n == 0: break matriz = [] for i in range(n): linha = [] aux = 0 for j in range(n): if i == 0: linha.append(j+1) else: ...
true
a9ff40cfb46e746fbe764a9ccddc9af6aac19645
Rexyyj/fipy-project
/Exercise2/Ex2-1 MQTT/Fipy/main.py
UTF-8
3,897
2.609375
3
[ "Apache-2.0" ]
permissive
# main.py -- put your code here! ################################ # @Time : 5/25/2021 # @Author : Yenchia Yu # @Mail : jiafish@outlook.com # @Github : https://github.com/Rexyyj # @Note : ################################ from mqtt import MQTTClient from network import WLAN import machine import time import u...
true
47f5e35ce66e51c1afb782172e524829d5f17588
radeknavare/pythonPractice
/first.py
UTF-8
235
3.21875
3
[]
no_license
#!/usr/bin/env python3 # print("Addition " + str(1+10)) print(7//3) n = 10 d = 11 if n == 10: print("YES") else: print("NO") print(n) i = "10" print(10+int(i)) print("Value of N is %d %d" % (n, d)) import sys print(sys.path)
true
b5b821ca7ba2049ba6b74bb219b298bab986bc7c
krshubham/compete
/college_life/codechef/Practice/beginner/alphabet.py
UTF-8
132
3.09375
3
[]
no_license
s = set(input()) t = int(input()) for i in range(t): if(len(s.union(set(input()))) == len(s)): print('Yes') else: print('No')
true
78fb2d982bf03a627ed28e7fc26a9eeae47670b4
BinRoot/Maya-Cloth-Simulation
/generate_shirt.py
UTF-8
2,847
2.6875
3
[]
no_license
# Takes 1 command line arguments # 1) string; path to CSV point file # Generates files in the /models/ directory # 1) an OBJ file called shirt.obj # 2) a Maya Binary file called shirt.mb import sys #sys.path.insert(0, "/Applications/Autodesk/maya2015/Maya.app/Contents/Frameworks/Python.framework/Versions/Curren...
true
dd23d402f455e890757f51ded00f9f1ec3f90316
edyoda/PDDS-150520-Python-Program-
/Session 30 - PYTEST AND PDB/test_3.py
UTF-8
459
3.140625
3
[]
no_license
## Way of Selecting or filtering Test Cases: # 1-> Marking the test cases # 2-> Running the test cases with substring matching approach. import pytest #1st method def correct_fun(x): return x+5 @pytest.mark.one def test_method1(): assert correct_fun(4) == 9 @pytest.mark.aadarsh def test...
true
898f2bce029e0edb863e1733b2ae0a6b62042f0c
AlxndrB/Flipping-The-Course
/FTC/Installation/DB_vullen/Oud/vuldieshit.py
UTF-8
3,457
2.65625
3
[]
no_license
from main.models import Questions, Modules # ========================================================= questions # studie vragen q = Questions( question='Weet je welke opleidingen er zijn?', gebied='studie' ) q.save() q = Questions( question='Vind je de studie leuk', gebied='studie' ) q....
true
919903bec1acb266d06e313e05e79efe4a6d9ef5
Menelisi-collab/ClubExercise
/ClubPack/Fans.py
UTF-8
436
3.25
3
[]
no_license
# Module class Fans: def __init__(self, first_name, last_name, status): self.first_name = first_name self.last_name = last_name self.status = status def move(self): print("Getting into Stadium...") def cheer(self): print("Cheering and chantign songs..") def je...
true
af1cc4acde8a8d7c7734e61f6a507b2e49e41bcc
s1879281/datagrand
/my_model.py
UTF-8
7,790
2.59375
3
[]
no_license
import os import re import argparse from sklearn.model_selection import train_test_split from sklearn.metrics import f1_score def get_parser(): parser = argparse.ArgumentParser(description='Datagrand Parser') parser.add_argument('--train-data', default='train.txt', help='path of training data') parser.add_...
true
1f5b6a1729c82244b1c9c7c0174f4a5dd038c018
gupta-vivek/deep-learning
/MNIST/network_test.py
UTF-8
3,301
2.9375
3
[]
no_license
import pandas as pd import numpy as np import tensorflow as tf # One hot vector function. def one_hot_vector(label, output_label, size): for i in label: a = np.zeros(size, dtype='float') a[i] = 1 output_label.append(a) # Divide into batches. def divide_batches(input_batch, output_batch, ...
true
7b626b941577db47ed6553cb78fb88cce56b9ef3
rajdeepdev98/MailSender
/textparser.py
UTF-8
324
2.671875
3
[]
no_license
#Returns the customized template object import os import sys from string import Template def read_template(filename): with open(os.path.join(sys.path[0],filename), mode='r', encoding='utf-8') as template_file: template_file_content = template_file.read() return Template(template_file_cont...
true
28b7dded3c34fed1b1d35ae61a415d609987b75d
ryanmoyer/counting-cards
/tests/test_header.py
UTF-8
1,013
3.296875
3
[]
no_license
#!/usr/bin/env python import unittest from counting_cards.header import header class TestHeader(unittest.TestCase): def test_empty(self): self.assertEqual(header(''), '\n') def test_default(self): self.assertEqual( header('This is a test'), 'This is a test\n' ...
true
fdab062e73abfb96efa9ff49be212fe49c13e8e9
lxndr-rl/PyGetter
/PyGetterConsole.py
UTF-8
2,212
2.9375
3
[ "WTFPL" ]
permissive
import requests import json import os import urllib.request liste = requests.get('https://api.lxndr.live/pygetter/listener.php') listener=json.loads(json.dumps(liste.json())) print('\n') for item in listener['entries']: id = (item['id']) autor = (item['autor']) url = (item['url']) filename = (item['fi...
true
46319c7b07718b0fdb1cc341bb959446f09235ce
boyac/pyUndefined
/Project_undefined/getSuspiciousActivity/getSuspiciousActivity.py
UTF-8
1,688
3.765625
4
[]
no_license
__author__ = 'Boya Chiou' import itertools class NameSpot: """ Return suspicious name of a transaction spending more than $3000; and a transaction for which the next transaction for the same person differs in location, and is less than an hour later. """ def __init__(self, result1=[], result2=[]): self.resu...
true
29dd10ac54d36ed6dcce064824d3f6d539e0fc91
lxxhk/Example.TRKD.Python.HTTPJSON
/trkd_interday.py
UTF-8
4,806
2.625
3
[]
no_license
''' The TRKD API sample code is provided for informational purposes only and without knowledge or assumptions of the end users development environment. We offer this code to provide developers practical and useful guidance while developing their own code. However, we do not offer support and troubleshooting of issue...
true
73198f0fb041d82e9d99ab2304ff32c6c00c6dff
vanngocthuyla/bitc-PPL-benchmark
/scripts/bitc_pymc3.py
UTF-8
9,709
2.546875
3
[]
no_license
#!pip install pymc3==3.8 #!pip install arviz==0.4.1 import os import time import pickle import arviz import matplotlib.pyplot as plt import numpy as np import pymc3 import theano.tensor as tt start = time.time() KB = 0.0019872041 # in kcal/mol/K INJ_VOL = 1.2e-5 # in liter CELL_CONCENTR = 0.1 # m...
true
7a37399c2779e0cf339faa5556ebd000bdb31b93
vietdat/Configurate-Analist
/Backend/ReadFromFile.py
UTF-8
221
3.328125
3
[]
no_license
class ReadFromFile: def ReadFileText(self, url): with open(url, 'r') as myfile: data=myfile.readlines() return data def PrintData(self, url): print(self.ReadFileText(url))
true
a095fa58ecf9cfa2b02fc1a2d16613b1b7e976b7
965929275/learn_new
/python MYSQL/数据库删除操作(删).py
UTF-8
356
2.78125
3
[]
no_license
#encoding:utf8 import pymysql #打开数据库连接 db = pymysql.connect('localhost','root','1234','db_demo1') # 使用 cursor() 方法获取操作游标 cursor = db.cursor() #SQL数据库删除语句 sql = "DELETE FROM EMPLOYEE WHERE AGE > '%d'" % (200) try: cursor.execute(sql) db.commit() print(u'删除成功') except: db.rollback() db.close()
true
983765026622f3251da59aac56ec21b12f71ccd5
alexrez/python_basics_-msu-
/4_LookSay.py
UTF-8
306
2.9375
3
[]
no_license
def LookSay(): seq=[1] yield seq[0] while(True): k=1 last=seq[0] result=[] for i in range(1,len(seq)): if last==seq[i]: k+=1 else: result.append(k) result.append(last) k=1 last = seq[i] result.append(k) result.append(last) for _ in result: yield _ seq=result
true
dba226b0751f134aa3e6f4c4f58f8218e0a93a5a
AutumnColeman/python_fileio
/count_lines.py
UTF-8
335
3.59375
4
[]
no_license
#Write a program which when given the name of a file as a command line argument, will print the number of lines there are in the file. from sys import argv script, filename = argv count = 0 #used xreadlines method to count lines for line in open(filename).xreadlines( ): count += 1 print "The input file is %d lines...
true
5738c2a3895a4d67bcb6fc9af14712e78f8bcef1
fjcamillo/Neural-Chess-Player
/src/models/conv.py
UTF-8
2,415
2.5625
3
[]
no_license
import tensorflow as tf import numpy as np import pandas as pd def cnn_model(train_x, train_y, test_x, test_y, device='/cpu:0', epoch=1): with tf.device(device): x = tf.placeholder(tf.float32, [None, 48, 48, 3]) y = tf.placeholder(tf.float32, [None, 12]) keep_prob = tf.placeholder(tf.float...
true
eff478d00326da4ac6c044cdc80ddc9685a4a908
vidalchile/data_science_g14
/regresion/contenido_sesion_online/lec5_graphs.py
UTF-8
8,521
3.0625
3
[]
no_license
#!/usr/bin/env python # -*- coding: utf-8 -*- """ File: lec5_graphs.py Author: Ignacio Soto Zamorano Email: ignacio[dot]soto[dot]z[at]gmail[dot]com Github: https://github.com/ignaciosotoz Description: Ancilliary file for intro to data science - adl """ import matplotlib.pyplot as plt import numpy as np import scipy...
true
c08883ad9fda2d28779cd8a94e0ca584d6f7dc3e
PacoV3/taller-turtle-une
/Ejemplos de Variables/Tortugas.py
UTF-8
696
3.9375
4
[]
no_license
import turtle from random import choice # Variable con una lista de posibles colores lista_de_colores = ['yellow', 'gold', 'orange', 'red', 'maroon', 'violet', 'magenta', 'purple', 'navy', 'blue', 'skyblue', 'cyan', 'turquoise', 'lightgreen', 'green', 'darkgreen', 'chocolate', 'brown', 'gray'] radio = int(input("Radi...
true
006cfcb734da7fe3e103e94a317d7eeb5aad5e1b
marinegor/still-utils
/stilutils/bin/explorestream.py
UTF-8
1,242
2.828125
3
[]
no_license
#!/usr/bin/env python from __future__ import print_function import os import sys try: input_stream = sys.argv[1] except IndexError: print("Usage: python explorestream.py output.stream") exit(1) if input_stream == "-h" or input_stream == "--help": print("Usage: python explorestream.py output.stream") ...
true
050e05e96d754ff07cdf0b297ce190e8bab7ebc8
Pyp-o/D-D_bouffe
/Code python/SalleGardeManger.py
UTF-8
608
2.90625
3
[]
no_license
import time from SalleEvenement import * class SalleGardeManger(SalleEvenement): def __init__(self, isExplore, x, y, salleDroite, salleGauche, salleHaut, salleBas): SalleEvenement.__init__(self, isExplore, x, y, salleDroite, salleGauche, salleHaut, salleBas) self.__visite = False def declanch...
true
944eeec3fb24f4ff7eea19f5ea72f0d3470a38b8
jacktweddle/DCF_project
/tool_v2/unit_conversions.py
UTF-8
12,152
2.96875
3
[]
no_license
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import numpy as np import pandas as pd def cel_to_K(x): '''Convert Celsius to Kelvin''' if type(x) is np.ndarray: if x.any() < -273.15: raise ValueError('Cannot have temperature lower than -273.15 Celsius!') if type(x) in [int, float, np.i...
true
0dadb26cdcd8a87b87827c7a2dc4c9877be837e1
metaopt/torchopt
/torchopt/schedule/polynomial.py
UTF-8
4,387
2.6875
3
[ "Apache-2.0" ]
permissive
# Copyright 2022-2023 MetaOPT Team. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable l...
true
7f78231c5bc5c4faea881ff65a983390fb8ed285
lamphej/ClarksonCode
/Cryptography/A1/crack_a1.py
UTF-8
3,411
3.171875
3
[]
no_license
import os import string import json output_joiner = ' | ' cipher_file = "substitution_correct" CURRENT_CIPHER = json.loads(open("ciphers\\%s" % cipher_file, "r").read()) CURRENT_CIPHER['\n'] = '\n' CURRENT_CIPHER[' '] = ' ' def display_word(da_word): """ da_word='CRYPTOGRAPHY' output= 1 2 ...
true
0c0c7f930d76144b26e7210f37e7c1fc450656e1
RuomeiYan/CCC-My-solutions
/2015/15-S3 disjoint-set.py
UTF-8
692
3.1875
3
[]
no_license
import sys root = [0 for i in range(100001)] #find the set this index belongs to def find(x): if x!=root[x]: root[x] = find(root[x]) return root[x] #merge index x into y def merge(x,y): root[find(x)] = find(y) numGates = int(sys.stdin.readline()) numPlanes = int(sys.stdin.readline...
true
5a17d3376b3bd67d5a75e0b223517c039b474d29
LuckyLaharlTim/CyberSecurity-Fool
/Programs/Final/Typing.py
UTF-8
1,472
2.875
3
[]
no_license
''' ================= MANUAL ================= python3 <typing profile> > typing-final.py ================= NOTES ================= - <typing profile> comes from the executable given by the challenge/professor. - You will receive keys like 'a' 'c' 'f' with timings for each like '0.4' '0.9' '0.3' - <typing profile...
true
efa2a462f0e6741e6b0d5cdfcde196ece4998370
daxiongshu/cifar10
/finetune/pl-ddp-resnet.py
UTF-8
4,916
2.59375
3
[]
no_license
from time import time import pytorch_lightning as pl from pytorch_lightning.metrics.functional import accuracy from pytorch_lightning.metrics import Metric from pytorch_lightning.loggers import TensorBoardLogger import torch import torchvision import torchvision.transforms as transforms import torch.nn as nn import ...
true
aee3d0f77debefe1877b292ed98e5b22118114cb
AmoghJohri/ComputationalGeometryProject
/TwoDimensions/demostrationScreen.py
UTF-8
12,008
3.25
3
[]
no_license
# importing standard libraries import tkinter as tk from tkinter import ttk # defining the font FONT="Times 10 italic bold" LARGE_FONT="Times 25 italic bold" class DemonstrationScreen: # This is used for demonstrating and visualizing the various aspects related to the algorithm # initialization method ...
true
6e02df097a336ef6e6ddae660545a4f3884aa46a
dilip-krishnan/Nano
/plugins/wiki.py
UTF-8
4,310
2.65625
3
[ "MIT" ]
permissive
# coding=utf-8 import wikipedia import logging import configparser import aiohttp from discord import Message from bs4 import BeautifulSoup from data.stats import MESSAGE from data.utils import is_valid_command, StandardEmoji logger = logging.getLogger(__name__) logger.setLevel(logging.INFO) QUERY_TOO_LONG = "Search ...
true
6f3371bb5cd3dafe74efc0deb4a77054cb3e1d49
TNurdan/Tursynbek-Nurdan
/Пересечение множеств.py
UTF-8
121
2.671875
3
[]
no_license
N = list(map(int, input().split())) M = list(map(int, input().split())) n = set(N) m = set(M) print(*sorted(n & m))
true
f6418c75d061743e6a541e6016a1d181a15c4a71
lhd0320/AID2003
/official courses/month01/day06/exercise02.py
UTF-8
218
3.375
3
[]
no_license
list_province = [] while True: province = input("请输入疫情地区:") if province=="": break else: list_province.append(province) str_province="-".join(list_province) print(str_province)
true
ecec5879133ba9852f0437b59921b59587e498b9
lungen/Project_Euler
/p49-prime-permutations-03001.py
UTF-8
1,171
3.703125
4
[]
no_license
# -*- coding: utf-8 -*- import time import itertools as it def isPrime(x): n = abs(int(x)) if n < 2: return True if n == 2: return True # check if even number if not n & 1: return False for i in range(3, int((n ** 0.5)) + 1, 2): if not n % i: ret...
true
8cc57f0a056e42a2e923bb01c5e2e507e6e97050
jackstellwagen/comp_bio_project
/seq_dataset.py
UTF-8
2,813
2.875
3
[]
no_license
# list only import os class SeqDataSet: def ReadFeatureSource(self, src): if(isinstance(src, list)): return src with open(src) as srcFile: buf = srcFile.readlines() for i in range(len(buf)): buf[i] = buf[i].strip().split(' ') for j in range(len(buf[i])): buf[i][j] = float(buf[i][j]) return b...
true
45f13817d62288f1898ed735c270b8f369f351ea
kachan1208/nlp
/nlp_categorise.py
UTF-8
857
2.578125
3
[]
no_license
from sklearn.datasets import fetch_20newsgroups from sklearn.feature_extraction.text import TfidfVectorizer from sklearn.svm import LinearSVC from sklearn import metrics import numpy data_train = fetch_20newsgroups(subset='train', shuffle=True, random_state=42) data_test = fetch_20newsgroups(subset='test', shuffle=Tru...
true
0ad412a77f3c4c89c185b2ce7cd91d8305d50367
afreese1/CS201
/programming assignment 1.py
UTF-8
6,605
3.703125
4
[]
no_license
''' Alyssa Freese CS201 October 20, 2014 Programming Assignment #1 Test Cases: Pay Code 10 1) rate=$100/week, worked total of 52 hours for the week worked over 50 hours, receive a 5% increase in weekly rate pay=rate*.5=100*.05=105, contribution=pay*.04=105*.04=4.2, ...
true
f6dbc9d96ba96f9843dee7d07aa7b1825750e6af
PrimerLi/maxEntLambda
/src/generateInput_new.py
UTF-8
7,121
2.703125
3
[]
no_license
def gauss(x, mu, sigma): import numpy as np return 1.0/np.sqrt(2*np.pi*sigma**2)*np.exp(-(x-mu)**2/(2*sigma**2)) def main(): import os import sys import numpy as np import numpy.linalg ifile = open("Niom", "r") string = ifile.readline() Niom = int(string) ifile.close() if...
true
d609986d6f611d12a09077de7d09250f9e2d4d6d
gaopengxiang417/helloworld
/com/gao/pythoncourse/BaseTypeTest.py
UTF-8
2,892
3.6875
4
[]
no_license
__author__ = 'wangchen' #coding=utf-8 import math #字符串的转义 print "\\\t\\" print r"\\\t\\" print r"""\\\t\\ sdf sds """ True False None print None print True a = "xyz" b = a a = "lll" print b #tuple一定初始化,就不能修改,这里应该是引用不能修改 classmated = ("first", "second", "third") print classmated t = (1,2) print t tt = (1...
true
cb6d4f189f7322273a1008ed2ddfe1727b46b8a3
dp-rice/multiplemergers
/src/helpers.py
UTF-8
10,302
2.78125
3
[ "MIT" ]
permissive
import numpy as np import gzip def tajimasD(n, eta): theta_pi = sfs2pi(eta, n) theta_w = np.sum(eta) / np.sum(1/np.arange(1,n)) return (theta_pi - theta_w) / theta_pi def pairwise_diversity(allele_counts, sample_size): f = allele_counts / sample_size return 2*f*(1-f) / (1 - (1/sample_size)) de...
true
f1f80df50877b195e5426bb50f0ca74d33bee284
jinxjinxagain/pyentry
/entry.py
UTF-8
1,684
2.5625
3
[]
no_license
#!/usr/bin/python3 import logging import logging.handlers import os import argparse import yaml def get_argparser(): parser = argparse.ArgumentParser( formatter_class=argparse.ArgumentDefaultsHelpFormatter) parser.add_argument( '-c', '--config', default='../conf/conf.yaml', help='confi...
true
12a87feec0d1587280f7798135656fd5b56744b1
GreatLakesEnergy/emonhub
/src/interfacers/EmonHubVEDirectInterfacer.py
UTF-8
6,417
2.703125
3
[]
no_license
import time import serial import Cargo from pydispatch import dispatcher import emonhub_interfacer as ehi """class EmonhubSerialInterfacer Monitors the serial port for data """ class EmonHubVEDirectInterfacer(ehi.EmonHubInterfacer): (WAIT_HEADER, IN_KEY, IN_VALUE, IN_CHECKSUM) = range(4) def __init__...
true
ade1aedf656f8488cdc36fe4dcab5a971b843fcf
CartoDB/cartoframes
/cartoframes/viz/themes.py
UTF-8
365
2.5625
3
[ "BSD-3-Clause" ]
permissive
class Themes: # pylint: disable=too-few-public-methods """UI color theme applied to Widgets and Legends. When selecting the DarkMatter basemap, the Dark theme is used by default. Example: Create an embedded map using CARTO's Positron style with the dark theme >>> Map(theme=themes.dark) ...
true
890a2ce6d3d5c030cf28130987b7a3adb7166d32
MissShreya/Health-Management-System-Project
/health.py
UTF-8
1,993
3.328125
3
[]
no_license
""" This is a HEALTH MANAGEMENT SYSTEM project. In this project:- 1. client_list is given {1:"SHREYANSHI",2:"ANURAG",3:"AYUSHI",4:"ABHINAV",5:"AWNI",6:"SHASHANK"} and when executed program u takes as input client name after input client name u locked ur daily routine exercise and food and print the locked result ...
true
0be7289a3b7f4c09d67d42acae66fba3303ffb85
16348104/PythonDemo
/icoures/4week/N.py
UTF-8
266
3.625
4
[]
no_license
# __author__ = 'zb' def main(): n = eval(input("How many nunmbers are there?")) max = eval(input("Enter a number.")) for i in range(n - 1): x = eval(input("Enter a number.")) if x > max: max = x print("最大的是", max) main()
true
597cd98da5dbc3ae5fb1c6e670dc163b3351b295
Ranjana151/python_programming_pratice
/lcm_number.py
UTF-8
252
3.65625
4
[]
no_license
# print lcm of two numbers x=int(input("Enter the first number")) y=int(input("Enter the second number")) if x>y: z=x else: z=y while(True): if((z%x==0 and z%y==0)): Lcm=z break print("Lcm of two number is",Lcm)
true
e52e110feaec620e93ed743f195b31ef90a0b49b
fayas0711/codekata
/comeonvolwel.py
UTF-8
170
3.390625
3
[]
no_license
am=raw_input() if (am.isalpha()): if(am=='a' or am=='e' or am=='i' or am=='o' or am=='u'): print("Vowel") else: print("Consonant") else: print("invalid")
true
76555f48bf17d5ecbcae554d30e143a47c64de0d
pabogdan/pynn_object_serialisation
/pynn_object_serialisation/experiments/mnist_testing/summary_plotter.py
UTF-8
725
2.953125
3
[]
no_license
#Plots everything in a master_summary file import argparse import matplotlib.pyplot as plt import csv #Parse args parser = argparse.ArgumentParser( description='data summary plotter', formatter_class=argparse.RawTextHelpFormatter) parser.add_argument('summary_file', type=str, help='summar...
true
e40a2379c90079999731acb2c9108a976ad91ab4
datamaning/PythonCore
/P2/Udacity/entertainment.py
UTF-8
1,316
3.15625
3
[]
no_license
import media import fresh_tomatoes toy_story=media.Movie('Toy Story',"A story of a boy and his toys that come to life",'http://upload.wikimedia.org/wikipedia/en/1/13/Toy_Story.jpg', 'https://www.youtube.com/watch?v=vwyZH85NQC4') avatar=media.Movie('Avatar','A marine on an aline planet','http://upload.wikimedia.org/w...
true