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
bb10da7a0420c698755f006d380d13431078d1df
aspnetcs/hoptex
/demacro.py
UTF-8
40,544
2.5625
3
[]
no_license
"""Module for removing macros from LaTeX documents Parse macros in LaTeX source code. Supported macros include: - newcommand/renewcommand(*) - DeclareMathOperator - def - input """ import re import os import time import sys import tarfile import multiprocessing as mp import shutil import argparse impo...
true
52c9cf26118ccafe513161258f9bfd3942e7ff32
nemobis/BEIC
/BEIC_records2publishers.py
UTF-8
1,074
2.53125
3
[ "CC0-1.0", "MIT" ]
permissive
#!/usr/bin/env python2 # -*- coding: utf-8 -*- """ Script to extract publisher data from BEIC's APE records in UNIMARC format. """ # # (C) Federico Leva e Fondazione BEIC, 2018 # # Distributed under the terms of the MIT license. # __version__ = '0.1.0' # from pymarc import MARCReader import unicodecsv as csv import re ...
true
8bd6e2c38474f4950c9ca27c54fd346b56cac5c8
9jadev/pythonclass
/inhert/paren.py
UTF-8
434
3.1875
3
[]
no_license
import random class paren: def __init__(self,mommyname,daddyname): self.mommyname = mommyname self.daddyname = daddyname def childrencount(self): self.childrencountnumber = random.randrange(1, 10) return self.childrencountnumber # myparent = paren('mommy','emaka') ...
true
8c42ade7a4151939632e7798ce8d74251eb0b7ec
MattBUWM/WD
/cw10/5.py
UTF-8
398
3.09375
3
[]
no_license
import pandas as pd import numpy as np import matplotlib.pyplot as plt dt=pd.read_table('cw10/datasets/iris.data', header=None, delimiter=',') dt.columns=['sepal lenght','sepal width','petal lenght','petal width','class'] dt['abs']=np.abs(dt['sepal lenght']-dt['sepal width']) dt['c']=np.random.randint(0, 50, dt.shape[...
true
590e0af5b72c21872ec52e81878b23fa1ec58488
caioeps/artificial-intelligence
/2_projeto/classifiers.py
UTF-8
795
3.015625
3
[]
no_license
import numpy as np from sklearn.linear_model import Perceptron from sklearn.neural_network import MLPClassifier class MQClassifier(object): def __init__(self): pass def fit(self, X_train, y_train): # adiciona coluna de 1 nos dados X_train = np.insert(X_train, 0, 1, 1) # (X^T *...
true
eab58b0e30d45550402e758e53d196e5bc87150e
RuijieSong/ECE695DL
/HW2/hw02_ImageNet_Scrapper.py
UTF-8
3,703
2.734375
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Sat Feb 13 17:29:01 2021 @author: 11327 """ import json # initial import calls import argparse parser = argparse.ArgumentParser( description ='HW02 Task1') parser.add_argument('--subclass_list', nargs ='*',type =str,required = True ) parser.add_argument('--image...
true
92581ced6739c9f9003af4cfde7e95cd4072eab5
codedeb/OOPS-DESIgn
/x.py
UTF-8
643
3.96875
4
[]
no_license
class Sentence: def __init__(self, sentence): self.sentence = sentence self.i = 0 self.word = self.sentence.split() def __iter__(self): return self def __next__(self): if self.i >= len(self.word): raise StopIteration result = self.word[...
true
1c0082f3f5782c74ba0a28df1c9f68453e948925
YOGESH-TECH/python-basic-problems
/cubesum.py
UTF-8
302
3.578125
4
[]
no_license
from math import pow num=int(input("enter the no. here: ")) org=num sum=0 for i in range(1,501): new=num%10 t=pow(new,3) sum=sum+t num=num//10 i+=1 print("the sum of the given no. is",int(sum)) y=int(sum) if org==y: print("the given no. is armstrong") else: print("not armstrong")
true
1be15f80cc39bdda5675491f9502a1c4f4654216
ShashankDhungana/gvhj
/venv/Q6.py
UTF-8
451
4.09375
4
[]
no_license
''' 6. Solve each of the following problems using Python Scripts. Make sure you use appropriate variable names and comments. When there is a final answer have Python print it to the screen. A person’s body mass index (BMI) is defined as: BMI=mass in kg / (height in m)2. ''' height = float(input("enter height in cm")) w...
true
dca7b35dc93b3d1818b672928a8271520d9f97be
Omega094/lc_practice
/coin_change/CoinChange.py
UTF-8
1,105
3.328125
3
[]
no_license
class Solution(object): def coinChange(self, coins, amount): """ :type coins: List[int] :type amount: int :rtype: int """ if amount == 0: return 0 coinSet = set(coins) if amount in coinSet: return 1 if amount < min(coins): ...
true
5d3ca9aff7dcca3a4e6f1e30819cad0e1bbb79fa
Zach41/LeetCode
/167_two_sum_ii/solve.py
UTF-8
560
3.46875
3
[]
no_license
#!/usr/bin/env python3 # -*- coding: utf-8 -*- class Solution(object): def twoSum(self, numbers, target): """ :type numbers: List[int] :type target: int :rtype: List[int] """ idx1, idx2 = 0, len(numbers) - 1 while idx1 < idx2: cur = numbers[idx1]...
true
ebe135aefc15ebb5af2fc6373cb5ff6cd564dfa5
Lishat/Basic-Python-Programming
/assign/printpattern.py
UTF-8
97
3.65625
4
[]
no_license
i = 0 j = 0 while j <= 9: i = j while i >= 0: print(i, end = " ") i -= 1 print() j += 1
true
7ef392f7a4c8187e09ce56096f6da5c992b04850
holiday/frogger
/Command.py
UTF-8
2,339
2.953125
3
[]
no_license
import json class Command: '''Base class for basic Commands, this class should be extended and overridden, not used independently''' @staticmethod def encode(cmd): '''Encode a string (cmd) into a proper format the server will understand''' @staticmethod def decode(cmd): '''Decode a command returned fr...
true
8c278cdb0fa37f11a14ab20493521c6795217c57
ostegm/compare-vision-apis
/main.py
UTF-8
3,936
2.578125
3
[]
no_license
"""The main python server which routes requests from the fontend to vapis.""" import base64 import io import logging import os import json import jinja2 import webapp2 from google.appengine.ext import ndb import requests import requests_toolbelt.adapters.appengine requests_toolbelt.adapters.appengine.monkeypatch() JIN...
true
86bce0df5e8881b2972a9b55cea97f23c64af700
CSESoftwareEngineeringSpring2015/Shared-Code
/13/in_class_problem_solving2.py
UTF-8
1,930
3.03125
3
[]
no_license
import numpy as np # I changed some stuff, but kept it similar to what you all wrote for the code. # This was to make sure that the code at least runs correctly. Added some # extra comments. class Data(object): def __init__(self, filename): self.filename = filename self.headers = [] # Better t...
true
62f86830b09b6610b67bb0fad966ce34ee3cf192
bigboateng/robosoc_eurobot_2017
/src/SecondaryRobot/PythonAstar/astar.py
UTF-8
2,816
3.578125
4
[ "MIT" ]
permissive
from math import sqrt import sys class AStarNode(object): def __init__(self, x, y): self.x = x self.y = y self.h = 0 # heuristic cost self.g = 0 # move cost self.obstacle = False self.parent = None def move_cost(self, other): diagonal = abs(self.x - ot...
true
7fe7a5161ccde7248fc879700aa87cf7b00fc96c
lizhe960118/TowardOffer
/LeetCode/79.wordsearch.py
UTF-8
756
3.21875
3
[]
no_license
def exist(board, word): m = len(board) n = len(board[0]) if (m == 0) or (len(word) == 0): return False for i in range(m): for j in range(n): if Search_word(board, word, 0, i, j) == True: return True return False def Search_word(board, word, pos, i, j): m = len(board) n = len(board[0]) if pos == len(...
true
c777aa6e02a2636b8c8c7309010c2740473665ac
solito83/aprendendo-programar-em-python
/e-estruturas condicionais/des-034 condicional-008.py
UTF-8
487
4.03125
4
[ "MIT" ]
permissive
des = 'Desafio-034 estruturas condicionais' print ('{}'.format(des)) #Escreva um programa que pergunte o salário de um funcionário e calcule o valor do seu aumento. Para salários superiores a R$1250,00, calcule um aumento de 10%. Para os inferiores ou iguais, o aumento é de 15%. salario = (float(input('Digite seu salá...
true
21e2dd88e16101358653c9e9345e1abddb5f0181
quachtina96/cancer-ethnicity-study
/scripts/fdr.py
UTF-8
1,196
2.765625
3
[]
no_license
from statsmodels.sandbox.stats.multicomp import fdrcorrection0, multipletests import sys import math # Input filename of genes + pvalues def fdr_correct(filename): genes = [] pvals = [] with open(filename) as f: for line in f: parts = line.strip().split('\t') gene = parts[0] pval = float(parts[1]) if ...
true
9e5b808e7b369307a7477bd8693e6a92a97e8499
redcpp/universidades
/media/CambiarColor.py
UTF-8
406
3.015625
3
[]
no_license
# Python 2.7 from PIL import Image import glob for img_file in glob.glob('*.png'): print img_file ''' Image must be PNG ''' im = Image.open(img_file, 'r') pix_vals = list(im.getdata()) rgb_values = 255,255,255 position=0 for rgba in pix_vals: if rgba[3]: pix_vals[position] = rgb_values+(rgba[3],) posi...
true
dcdb3e5970d38c53768e3c700ee36b5fc94c675a
ajorpheus/deterministic_zip
/deterministic_zip/__init__.py
UTF-8
1,812
2.890625
3
[ "BSD-2-Clause" ]
permissive
import os import stat import sys import zipfile __version__ = "0.1" def add_directory(zip_file, path, zip_path): for item in sorted(os.listdir(path)): current_path = os.path.join(path, item) current_zip_path = os.path.join(zip_path, item) if os.path.isfile(current_path): add_...
true
085f75efda4f78858af9f275e2f858b29b2783f1
config-migration/dozer
/lib/strace/classes.py
UTF-8
69,777
2.8125
3
[]
no_license
"""Strace classes. Classes implemented here represent values parsed from an strace file. """ # Imports from __future__ import annotations from collections import defaultdict from contextlib import ( AbstractContextManager, ContextDecorator, contextmanager, ExitStack, ) from copy import copy from dataclasses impo...
true
b788cb1f7ab01cc63639ef78fe0e4f7cab6b91ba
chubin/ansiwrap
/ansiwrap/ansistate.py
UTF-8
3,911
2.859375
3
[ "Apache-2.0" ]
permissive
import sys _PY2 = sys.version_info[0] == 2 class ANSIState(object): """ Manage running state of a sequence of ANSI codes. """ def __init__(self, fg=None, bg=None, style=None): self.fg = fg self.bg = bg self.style = style self.seen = [] def consume(self, code): ...
true
b9f37e709b6d7187d433370fa348427e84035dee
reobebo/data-science-python
/logistic_regression.py
UTF-8
1,797
2.953125
3
[]
no_license
# coding: utf-8 # In[1]: import numpy as np import pandas as pd from pandas import Series, DataFrame import scipy from scipy.stats import spearmanr import matplotlib.pyplot as plt from pylab import rcParams import seaborn as sb import sklearn from sklearn.preprocessing import scale from sklearn.linear_model impo...
true
2001445eab9729b3a14a07600f6472012ba219ab
lsy-GitHub-Vc/Git_Repository_pro
/numpy/numpy_2.py
UTF-8
995
3.703125
4
[]
no_license
#!/usr/bin/env python3 # -*- coding: utf-8 -*- #@time: #@Author:lsy #@file: #@function:----------- import numpy as np #数组的创建 ''' shape 数组形状 dtype 数据类型,可选 order 有"C"和"F"两个选项,分别代表,行优先和列优先,在计算机内存中的存储元素的顺序。 ''' hf = np.empty([2,2],dtype=int,order='C')#这个可以创建一个空的数组 这种创建只提供了结构 数组的数值都是随机的 因为没有进行初始化 print(hf) ''' [[ 190149...
true
38bebe54df8771a30c06b863f6f3d27a527fe7ae
zenoss/zenoss-prodbin
/Products/Zuul/tests/test_decorators.py
UTF-8
2,014
2.609375
3
[]
no_license
############################################################################## # # Copyright (C) Zenoss, Inc. 2009, all rights reserved. # # This content is made available according to terms specified in # License.zenoss under the directory where your Zenoss product is installed. # ##################################...
true
080489f02a9a8c828f1832a23d7d23c1a2de1bc1
Jeffvan12/UQCoursesBackend
/create_tables.py
UTF-8
1,478
2.796875
3
[]
no_license
import psycopg2 commands = ( """ CREATE TABLE courses ( course_id CHAR(8) PRIMARY KEY, summary TEXT, url TEXT, title TEXT, semesters SMALLINT [] , prereq TEXT, rec TEXT ) """, """ CREATE TABLE programs ( url TEXT PRIMARY KEY, ...
true
8e6ee81ccf7dc455e51fa34453d19d0d00e8082e
suryanjain14/prat
/recursion/allpossiblearrays.py
UTF-8
1,384
4.0625
4
[]
no_license
# Generate all possible sorted arrays from alternate elements of two given sorted arrays # # Given two sorted arrays A and B, generate all possible arrays such that first element is taken from A then from B then # from A and so on in increasing order till the arrays exhausted. The generated arrays should end with an el...
true
f43f7a5e733c4553f288ed4ad4afbb0b431aa751
firikios/Cython_playground
/main.py
UTF-8
1,203
2.65625
3
[]
no_license
import numpy as np import copy from ExtensionTypes.node import CyList from tqdm import tqdm from pylist.pylist import List as PyList import time M = 10000000 D = 13 X = np.random.randn(M*D).reshape((M, D)) X = X.astype(dtype=np.dtype("f")) cylist = CyList(D) pylist = PyList() for i, x in tqdm(enumerate(X)): cyli...
true
47e075ab3aa4e60d027c84d059304172cff90f28
antontomusiak/TopCoder
/srm713/symmetry_detection.py
UTF-8
510
3.34375
3
[]
no_license
class SymmetryDetection: def detect(self, board): flag_v = True flag_h = True for i in board: n = len(i) // 2 for j in range(n): if i[j] != i[len(i)-1-j]: flag_v = False break if not flag_v: break for i in range(len(board)): n = len(board) // 2 if board[i] != board[len(board)-1-...
true
222c0a68fdb2ea429a9debe98bc5e9608c77257b
AmitHasanShuvo/stocksurferbd
/proc_utils/async_class.py
UTF-8
884
3.046875
3
[ "MIT" ]
permissive
import concurrent.futures class AsyncTask(object): def __init__(self, workers=4): self.workers = workers def run_tasks(self, async_task, param_dicts): """ :param async_task: Reference of asynchronous task :param param_dicts: List of parameter dicts for ...
true
3fd37f62266923984d9c3d4c67d0cde28ea35589
whiteblue0/Algorithm
/workshop/임현수_0920/병합 정렬.py
UTF-8
1,037
3.078125
3
[]
no_license
import sys sys.stdin = open("merge_input.txt") def merge_sort(lst): if len(lst) > 1: mid = len(lst)//2 left = lst[:mid] right = lst[mid:] l = merge_sort(left) r = merge_sort(right) return merge(l,r) else: return lst def merge(L,R): global cnt i ...
true
33411388aa13b826f2446f1a7993f2adec4d8a92
ValerianThomas/Cat-Dog_Backend
/API/utils/utils.py
UTF-8
205
2.703125
3
[ "MIT" ]
permissive
ALLOWED_FILES = ['png','jpeg','jpg'] def allowed_file(filename): try : extension = filename.rsplit('.',1)[1] print(extension) except : return False return extension in ALLOWED_FILES
true
f731d2192c705cdc8d23e745efd5d87b2156d414
salthot/my-python-100days
/Day01-15/Day05/code/.ipynb_checkpoints/craps-checkpoint.py
UTF-8
2,646
3.5625
4
[]
no_license
# -*- coding: utf-8 -*- """ Craps赌博游戏 玩家摇两颗色子 如果第一次摇出7点或11点 玩家胜 如果摇出2点 3点 12点 庄家胜 其他情况游戏继续 玩家再次要色子 如果摇出7点 庄家胜 如果摇出第一次摇的点数 玩家胜 否则游戏继续 玩家继续摇色子 玩家进入游戏时有1000元的赌注 全部输光游戏结束 Version: 0.1 Author: 骆昊 Date: 2018-03-02 """ # + """ Version: 1.0 Author: Andy Date: 2019-5-10 """ from random import randint money=1000 while 1000 >...
true
cf0fcd0f2b93801db2eee9a773aec8e05368d23b
rebht78/Python-Exercises
/exercise45.py
UTF-8
637
5.03125
5
[]
no_license
""" In this exercise, we'll learn about methods in strings. We will print string in upper case if it is in lower case. If it is in upper case, then we'll print string in lower case. """ word = raw_input('Enter any string: ') # now, this is routine...no need to explain # above line. # how to identify whether a string ...
true
7e04e625a42646b4dac688da861b954cbb7d271c
EdgarRamirezFuentes/Python
/PCWorld/classes/Monitor.py
UTF-8
1,041
3.25
3
[]
no_license
class Monitor: quantity = 0 def __init__(self, name, brand, price, size): Monitor.quantity += 1 self.__id = Monitor.quantity self.__name = name self.__brand = brand self.__price = price self.__size = size def getName(self): return self.__name de...
true
2f5a0a133df4f3531f1d8f1b487ad041b06a5bb1
hiyoung93/backjoon_exam
/별찍기/별 찍기 8.py
UTF-8
139
3.421875
3
[]
no_license
a = int(input()) i = 0 for i in range(i, a+1): print('*' * (i + 1)) if i = i: return elif i < i : print('*'*(i-1))
true
00633e32f147f90cd872bd478f7489e0b438ce45
Ellachuang/deepnog
/deepnog/client/client.py
UTF-8
22,127
2.71875
3
[ "BSD-3-Clause" ]
permissive
#!/usr/bin/env python3 """ Authors ------- - Roman Feldbauer - Lukas Gosch Date ---- 2019-10-18 Usage ----- `python client.py --help` Description ----------- Provides the ``deepnog`` command line client and entry point for users. DeepNOG predicts protein families/orthologous groups of given protein sequences with d...
true
9c90b4840123bc93aa1a3c39ed3aac163436a18b
minh84/udacity_aind
/AIND_P2-Isolation/test_cases.py
UTF-8
2,338
2.984375
3
[]
no_license
from sample_players import * from game_agent import * from isolation import Board import timeit def test_case1(): player1 = MinimaxPlayer(search_depth=1, score_fn=open_move_score) player2 = GreedyPlayer() game = Board(player1, player2, 9, 9) game._board_state = [0, 0, 0, 0, 0, 0, 0, 0, 0, \ ...
true
a83c29699d74bef18f3366b9a5a91143ab4168bd
shubhamoli/solutions
/leetcode/medium/102-Binary_tree_level_order.py
UTF-8
1,091
3.984375
4
[ "MIT" ]
permissive
""" Leetcode #102 """ from typing import List # Definition for a binary tree node. class TreeNode: def __init__(self, val=0, left=None, right=None): self.val = val self.left = left self.right = right class Solution: def levelOrder(self, root: TreeNode) -> List[List[int]]: ...
true
3097f126731fe8a8c04b7206f4929d7661c5a514
bmistry4/seamless-typewriter
/view/main_frame.py
UTF-8
2,969
2.96875
3
[]
no_license
import tkinter as tk from tkinter import Frame from tkinter.constants import * from tkinter.ttk import Label from view.search.search_frame import SearchFrame from view.video.video_events import Events from view.video.video_frame import VideoFrame from view.youtube_download.youtube_frame import YoutubeFrame class Mai...
true
07afddb8bbfd4ecc4c53c6dc76660f55cb3dabb2
jolly-roger/werp
/orm/log.py
UTF-8
295
2.703125
3
[]
no_license
from .base import * class Log(DBase): __tablename__ = 'log' id = Column(postgresql.UUID, primary_key = True) value = Column(Text) is_parsed = Column(Boolean) def __init__(self, value=None, is_parsed=False): self.value = value self.is_parsed = is_parsed
true
4097d230fe01e799170aae5cca2d78677e18932b
gsomani/computational-physics
/HW5/GauravSomani_HW5/1/1.py
UTF-8
926
2.8125
3
[]
no_license
import numpy as np import matplotlib.pyplot as plt plt.rcParams.update({'font.size': 18}) plt.rcParams["figure.figsize"] = (16,16) def rk4_step(x,t,h,f): k0=f(x,t) k1=f(x+0.5*h*k0,t+0.5*h) k2=f(x+0.5*h*k1,t+0.5*h) k3=f(x+h*k2,t+h) xf = x+h*(k0+2*k1+2*k2+k3)/6 return xf,t+h def rk4(x0,time,h,f): N=int(round...
true
7df80da79e41949652e6d21c772ae56164b3b313
jsennett/ELISA
/src/utils.py
UTF-8
262
2.8125
3
[ "MIT" ]
permissive
import struct def b_to_f(binary): """Convert binary to floating point""" return struct.unpack('f', struct.pack('I', binary))[0] def f_to_b(decimal): """Convert binary to floating point""" return struct.unpack('I', struct.pack('f', decimal))[0]
true
77fd29986d51d4d349745ff70223a26d4da9fdae
MaartenAmbergen/TICT-V1PROG-15-Maarten-Ambergen-
/Les04/ExtraOpdracht4_1.py
UTF-8
193
3.375
3
[]
no_license
Temp=eval(input('Hoe warm is het vandaag? ')) if Temp <=15 and Temp >=0: print('Het is koud vandaag!') elif Temp <0: print('Het vriest!') else: print('Het is lekker weer vandaag!')
true
eeec36109f7e47cd99f6b36389703b08982ef822
stevepentland/swarmer
/db/job_db.py
UTF-8
7,079
3
3
[ "MIT" ]
permissive
import json import redis from log import LogManager class JobDb: """ The JobDb is responsible for handling the redis job tracking """ def __init__(self, rd: redis.StrictRedis): self._redis = rd self._logger = LogManager(__name__) def add_job(self, identifier: str, image_name: str, ...
true
11207b0d33ac3d124391fc6c73cd6d5d8d5dc87f
jacobkloepper/pi-test
/arduino-pi-serial/proj/hexutil.py
UTF-8
230
3.34375
3
[]
no_license
def hexuid(binary: str) -> str: i = 0 hexadecimal = [] while (4*i + 3 < len(binary)): hexadecimal.append(hex(int(binary[4*i:4*i+4], 2))) i += 1 return "".join([x[2:] for x in hexadecimal])
true
1c81533fa6f76c73e5556b990aed5d7152dae0aa
erlinghaugsand/Erling_practice_repo
/pythonScripts/twitter_test.py
UTF-8
788
2.765625
3
[]
no_license
import os import tweepy as tw import pandas as pd consumer_key= input("Enter consumer key: ") consumer_secret= input("Enter consumer secret: ") access_token= input("Enter access token: ") access_token_secret= input("Enter access token secret: ") auth = tw.OAuthHandler(consumer_key, consumer_secret) auth.set_access_to...
true
9126bc20f893b61d907b752037592b165645af19
joewledger/ProjectEuler
/Problems/Euler19/Euler19.py
UTF-8
1,078
3.671875
4
[]
no_license
#Project Euler Problem 19 #Counts the number of sundays that fell on the first of the mounth in the 20th century(1/1/1901 - 12/31/2000) #1/1/1900 was a monday #leap years occur on years evenly divisible by 4 unless it is a century in which case it must be divisible by 400 #30 days have september, april, june and no...
true
6bc2f30cf543ff43ea8edcd46a384146340222e3
Taurin190/NLP100
/chapter2/12divide_text.py
UTF-8
470
3.0625
3
[]
no_license
# coding: utf-8 temperature_data = open("hightemp.txt", "r") col1 = [] col2 = [] for temperature_line in temperature_data.readlines(): tmp_line_cols = temperature_line.split("\t") col1.append(tmp_line_cols[0]) col2.append(tmp_line_cols[1]) with open("col1.txt", "w") as col1file: for col1_item in col1:...
true
0ee4e08abcb30637434e975fe9cddf969ea73bc7
xerip/Mini_projet_simulateur_logique
/projet_ihm_MATTIOLI/modif_niveau.py
UTF-8
4,443
2.828125
3
[]
no_license
import tkinter as tk from tkinter import filedialog import canvas_niveau as cn import os def Modif_lvl(root): # permet de modifier un niveau root.state('withdrawn') # cache la fenetre principale # ouvre une fenetre permettant de choisir un niveau dans l'arborescence de fichiers # qui renvoie le c...
true
df2082b340635cb4d3fe024ccbcf157e9a329164
dr-dos-ok/Code_Jam_Webscraper
/solutions_python/Problem_199/2850.py
UTF-8
1,117
2.859375
3
[]
no_license
def main(): ans = [] with open("A-large.in", "r") as r: count = int(r.readline()[:-1]) for i in range(count): l = r.readline()[:-1] cakes, size = l.split(" ") lc = len(cakes) size = int(size) cakes = list(cakes) fl...
true
77db8e0fb9357c3cdced12fbe80ad696cefa3f33
kyojinatsubori/RoadToRedCoder
/kyoji/ABC166/D.py
UTF-8
478
3.078125
3
[]
no_license
def factorization(n): arr = [] temp = n for i in range(2, int(-(-n**0.5//1))+1): if temp%i==0: cnt=0 while temp%i==0: cnt+=1 temp //= i arr.append([i, cnt]) if temp!=1: arr.append([temp, 1]) if arr==[]: arr...
true
b759d45658c689f1668aa6bb6e3088b0857ae6fd
VictorJuliani/Redes
/projeto2/server.py
UTF-8
1,932
2.625
3
[]
no_license
#!/usr/bin/python # -*- coding: utf-8 -*- from socket import socket, AF_INET, SOCK_DGRAM from reliable_sock import RSock from packet import Packet import thread, sys, os.path, math, random PACKET_SIZE = 10.0 # bytes def newCon(data, addr): sock = RSock(server, addr, cwnd, ploss, pcorr) packet = sock.receivePacket(...
true
436a59e66426e3a8be13b1c496da9f36a6773e69
RahulBendre1/Competitive-Programming
/diceCup.py
UTF-8
97
2.65625
3
[]
no_license
N,M = list(map(int,input().strip().split())) for i in range(min(N,M)+1,max(N,M)+2): print(i)
true
d367726fa0569a518f5305b4e06ddfd6a3bb0908
Tasmaniaz/black-out-board
/blackoutapp/blackoutboard.py
UTF-8
5,569
3.140625
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Thu Oct 29 21:21:53 2020 @author: Janni """ import random class Player: def __init__(self, name): self.name = name self.currentPos = 0 player1n = Player("Jannic") player2n = Player("Rene") player3n = Player("Tobias") player4n = Player("Ich Heis Heise") play...
true
451ff2c08f63eeeaf45fd7bab390b6e5e7f2f56a
harmitsampat96/Machine-Learning
/k means/kMeans.py
UTF-8
1,049
3.40625
3
[ "MIT" ]
permissive
# Importing the libraries import pandas as pd import pylab as pl from sklearn.cluster import KMeans from sklearn.decomposition import PCA # Importing the Iris dataset with pandas variables = pd.read_csv('iris.csv') Y = variables[['sepal_length']] X = variables[['sepal_width']] # Finding the optimum number ...
true
b817a562ded6e05633226839041a257ac811b202
ll2585/BoardGameAI
/play.py
UTF-8
2,249
3.03125
3
[]
no_license
from pprint import pprint import numpy as np from fish.fish_game import FishGame from fish.fish_players import RandomPlayer import tables from pathlib import Path # Setup from tqdm import tqdm num_games = 100 x = None y = None write_data = True wins = { } for i in tqdm(range(num_games)): game = FishGame() pla...
true
b0b930d14e543bb0bbce5d8cbeabe4d111546468
sg48/SciFin
/examples/timeseries/TS1_build_timeseries_from_csv.py
UTF-8
821
3.3125
3
[ "MIT" ]
permissive
# Standard library imports # / # Third party imports # / # Local application imports from scifin.timeseries.timeseries import build_from_csv # Build a time series from a CSV file online ts1 = build_from_csv(filepath_or_buffer='https://raw.githubusercontent.com/selva86/datasets/master/a10.csv', ...
true
bee68fb972960cc9aaea21804f849435f8363f56
shirdha/ss
/extraspace_play.py
UTF-8
55
2.703125
3
[]
no_license
import re s=str(input("")) print(re.sub(' + ', ' ',s))
true
b74c87a30aecdfe2795d676b5090feb635dadc98
hsiaohan416/stancode
/SC_projects/games/caesar.py
UTF-8
1,035
4.1875
4
[ "MIT" ]
permissive
""" File: caesar.py ------------------------------ This program demonstrates the idea of caesar cipher. Users will be asked to input a number to produce shifted ALPHABET as the cipher table. After that, any strings typed in will be encrypted. """ # This constant shows the original order of alphabetic sequence ALPHABE...
true
0678fec4b4ce53240e3e3c7291dadccc790e2a98
TigerRobocop/30-Days-of-Python
/study1.py
UTF-8
1,761
3.296875
3
[]
no_license
# def parse_lists(list): # str_items = [] # num_items = [] # for i in list: # if isinstance(i, float) or isinstance(i, int): # num_items.append(i) # elif isinstance(i, str): # str_items.append(i) # else: # pass # return str_items, num_it...
true
e5cc0920cc6ab02b87ca977f3d797116f2fc06b4
anurag5398/DSA-Problems
/DynamicProgramming/LongestPalindromicSubsequence.py
UTF-8
984
3.734375
4
[]
no_license
""" Given a string A. Find the longest palindromic subsequence (A subsequence which does not need to be contiguous and is a palindrome). You need to return the length of longest palindromic subsequence. """ class Solution: #@param A : string #@return int -> size of LPS def solve(self, A): lps = [[0 ...
true
f7b288fd359dcc17140c9f0fc2404a778a5ba7b6
ONSdigital/eq-questionnaire-runner
/app/views/handlers/pdf_response.py
UTF-8
2,292
2.59375
3
[ "MIT", "LicenseRef-scancode-proprietary-license" ]
permissive
import io import re from datetime import datetime, timezone import pdfkit from flask import current_app from app.data_models import QuestionnaireStore from app.questionnaire import QuestionnaireSchema class PDFResponse: """ Responsible for the PDF generation for the view submitted response. Subclassed ...
true
1d9142e775ba214cc7af0cda71bd16e01ef56efb
wangdanfeng0416/Test
/play2.py
UTF-8
169
2.5625
3
[ "Apache-2.0" ]
permissive
print('给你一张过去的CD') print('给你一个大嘴巴子') print('今天跟主人玩呲牙,主人可高兴了,就给了我一个我最爱吃的大嘴巴子')
true
4ed9a07319a163db14ab26cb9b9d63c98d2f34ea
francis0407/ofo-data-analysis
/spider/iptest.py
UTF-8
1,906
2.53125
3
[]
no_license
import spider import threading def error_handler(): import time time_string = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()) print("ErrorTime:%s"%(time_string)) return def test(i): import time cur_time = time.time() while 1: info = spider.spider_single(121.332,31.297,0) ...
true
24c206d92e0da5bd1ea477a3a994e753da855f9e
jayhsieh/SCU_Financial_Engineering
/python_programming_trading_framewok/PersonalIndex/CalculateOrderAmountDifference.py
UTF-8
462
2.9375
3
[]
no_license
''' Created on 2018年4月30日 @author: Albert ''' from RealTime.function import getOrder #取得報價資訊,詳情請查看技巧51 with open('function.py','r') as f: exec(f.read()) #取得委託資訊 for i in getOrder(): OrderInfo=i.split(',') OrderTime=OrderInfo[0] OrderBAmount=int(OrderInfo[2]) OrderSAmount=int(OrderInfo[4])...
true
e6dbbc98cc4a1daf5d320376ce9ad6033c7164e2
20c/tmpl
/tests/util.py
UTF-8
1,261
2.796875
3
[ "LicenseRef-scancode-warranty-disclaimer", "Apache-2.0" ]
permissive
import filecmp def cmpfiles(expected_dir, actual_dir, files): if isinstance(files, str): files = [files] (match, mismatch, errors) = filecmp.cmpfiles( str(expected_dir), str(actual_dir), files, shallow=False ) assert files == match assert not errors def assert_dircmp(dcmp): a...
true
ca3e1b870db844264aa5d8bfe043bfeace07f3b5
morrislab/plos-medicine-joint-patterns
/scripts/variance_explained/split_sites_localizations.py
UTF-8
1,360
2.984375
3
[ "MIT" ]
permissive
""" Splits scores by localization. """ import pandas as pd import pathlib from click import * from logging import * @command() @option( '--data-input', required=True, help='the CSV file to read site involvements from') @option( '--localization-input', required=True, help='the CSV file to rea...
true
d247bffd489cf124f73f26900aa484deba43bf9c
efren1990/codepy
/PythonMultiplataforma_Udemy/05_Funciones/09_desempaquetamiento_II.py
UTF-8
956
4.28125
4
[]
no_license
""" DESEMPAQUETAMIENTO II ---------------------------------------------------- Como funciona el desempaquetamiento. """ # EJEMPLO 1 print("----------EJEMPLO 1----------") lista = [11, 10, 12] # Funcion que desempaquera la lista def func(a, b, c): print(a) print(b) print(c) # Ordenar la lista - de menor a mayor lista...
true
6e08831b97819756d809e25302ae2ed6668c3da1
EternalPo/PythonTest
/main/tick.py
UTF-8
1,735
3.78125
4
[ "Apache-2.0" ]
permissive
#!/usr/bin/env python #-*- coding: UTF-8 -*- import time # tick 是什么, 时间间隔为浮点数为秒为单位的数字. 在特定的时间瞬间自上午12时00分, 1970年1月1日(纪元)表示, 单位秒 # Python 中可用的流行时间模块, 它提供功能转换. 该功能 time.time() 返回当前时间, 因为上午 12点, 1970年1月1日(时代) ticks = time.time() print "Number of ticks since 12:00am,January 1, 1970 :", ticks # 日期计算是很容易. 不过当日的时代之前, 不能以这...
true
7b102f42bfc5cd5bc9f0cc853dfad2f78a633577
fitri2131/Tugas_1_Pemrograman_Dasar
/get_the_type.py
UTF-8
46
2.828125
3
[]
no_license
x=7 y="Fitri" print(type(x)) print(type(y))
true
ed6fce96221ecd2dbb93177bc9892c70b655404a
dawngerpony/eventbot-web-api
/scripts/check_event_attendees_against_mailchimp.py
UTF-8
5,246
2.546875
3
[ "MIT" ]
permissive
#!/usr/bin/env python import logging from collections import Counter import click import simplejson as json from eventbot import settings from eventbot.integrations import NotFoundException, mailchimp_client, eventbrite_client log = logging.getLogger(__name__) def check_attendees(attendees): results = { ...
true
4960247bf052133f309e43fa5ce40e9b74f0cc45
tingezhang/vtconfig
/tools/color/model_reader.py
UTF-8
4,179
2.84375
3
[]
no_license
import xlrd import model def _getCellString(cell): value = '' if xlrd.XL_CELL_EMPTY == cell.ctype : value = '' elif xlrd.XL_CELL_TEXT == cell.ctype : value = cell.value elif xlrd.XL_CELL_NUMBER == cell.ctype : value = str(int(cell.value)) elif xlrd.XL_CELL_DATE == cell.ctyp...
true
e5e132058dc35c6687fa2c524aefb6f5e8f9c2a2
datarocksAmy/MontePythonWithDeepLearning
/Lab/TF-Lab03/Source/LSTM.py
UTF-8
1,685
3.28125
3
[]
no_license
# ----------------------------- # Keras LSTM # ----------------------------- # Libraries import numpy as np from keras.preprocessing import sequence from keras.models import Sequential from keras.layers import Dense, Dropout, Embedding, LSTM, Bidirectional from keras.datasets import imdb # Parameters max_features = 5...
true
50af12f7352e8958cf813f48f6b877c1c489384e
peterlevi/euler
/169.py
UTF-8
555
3.375
3
[]
no_license
#!/usr/bin/python3 memo = {} def f(n, ones): if n == 0: return 1 if n == 1: return 1 if ones else 0 if (n, ones) in memo: return memo[(n, ones)] result = 0 if not ones: if n % 2 == 1: result = 0 else: result = f(n // 2, Tru...
true
51ae75dbd2076201828b7763be2c7b6580b9df3d
josemalcher/Python_Ignorancia-Zero
/parte01introducao/aula03FuncaoPrint.py
UTF-8
299
3.65625
4
[]
no_license
# Aulas Python - 003 - A Função print # https://www.youtube.com/watch?v=RLK2x7PbG_I&index=4&list=PLfCKf0-awunOu2WyLe2pSD2fXUo795xRe print("Olá Mundo") print("23") print(23) print("Esse e o programa", 2) print("Eu tenho",11,"cachorros") print("Olá MUndo \n Pulando outra lina") help(print)
true
56ac7f55652c67184e67759196fdfb3768268e5e
1sadtrombone/neil_simulator
/neil.py
UTF-8
781
2.90625
3
[]
no_license
import requests import json import random from time import sleep import argparse api_key = "698bcb7032d2e85929e90bdbc49d6bf4" parser = argparse.ArgumentParser() parser.add_argument('words', type=str, nargs='+') args = parser.parse_args() words = args.words out = ['']*len(words) # GET SYNONYMS for i, word in enu...
true
8c81577a4f7ab696b3c1502e2e1bc9d010ee39ca
maciejd/adsb2db
/app.py
UTF-8
593
2.6875
3
[]
no_license
import requests,json,sqlite3,time url = 'http://127.0.0.1/dump1090/data/aircraft.json' conn = sqlite3.connect('app.db') while True: response = requests.get(url) if (response.ok): data = json.loads(response.content) for aircraft in data['aircraft']: c = conn.cursor() c....
true
fda01cfb38c356becbb763285bf7da02d5734f45
KenelyOliveira/SpotifyDataAnalysis
/songsbyseason/src/main.py
UTF-8
2,335
2.765625
3
[]
no_license
import pandas import helpers, spotify, db get_newData = True def get_artists(artists, songs): for song in songs: name = song['track']['artistName'] info = spotify.get_artistByName(name) if (info != {}): artists.append({'id':info['artists']['items'][0]['id'],'name':name,'genres'...
true
26ab85e5db4e531dbabfe1e33eaa13f3f627ae68
justbennet/Workshops
/PythonWorkshop/read_file.py
UTF-8
1,267
4.25
4
[]
no_license
### Read in a file and print the contents # Import the os module so its funcions are available to us import os # Where is our home directory? home_dir = os.path.expanduser('~') # Change to the Workshop folder under it os.chdir(os.path.join(home_dir, "projects", 'PythonWorkshop')) os.getcwd() # Print where we are, j...
true
611ebbc61274e3a8b64bed2f77f2d624bf9b0bfe
kenshinsee/common
/lib/common/timer.py
UTF-8
424
2.90625
3
[]
no_license
import time import datetime from log.logger import Logger class Timer: def __call__(self, func): def _func(*args, **kwargs): start_ts = datetime.datetime.now() msg = func(*args, **kwargs) end_ts = datetime.datetime.now() time_elapsed = end_ts - start_ts ...
true
3c752432d6a38567095d714c3bcf50de5b5acac0
zachfloro/CS7641
/Randomized Optimization/neural_nets.py
UTF-8
37,493
2.671875
3
[]
no_license
''' NOTE: this code makes use of several packages (referenced below) but none of them need to be specifically modified to run this code assuming you install the conda environment in step 2 References: Several python packages were used in this repository that I would like to acknowledge. Jeff Reback, Wes McKinney, jbr...
true
905253d1c59afd6e24176b8fd66d828d12681a69
sugia/leetcode
/Rotate String.py
UTF-8
709
3.765625
4
[ "Apache-2.0" ]
permissive
''' We are given two strings, A and B. A shift on A consists of taking string A and moving the leftmost character to the rightmost position. For example, if A = 'abcde', then it will be 'bcdea' after one shift on A. Return True if and only if A can become B after some number of shifts on A. Example 1: Input: A = 'abc...
true
04f2a9cc73a3409063066cc8922e39188b9e59f6
gabriellaec/desoft-analise-exercicios
/backup/user_105/ch52_2019_09_26_05_54_23_587163.py
UTF-8
320
2.765625
3
[]
no_license
def eh_crescente(lista): new_lista = [] maior_termo = lista[0] new_lista.append(lista[0]) i = 1 while i < len(lista): if maior_termo < lista[i]: new_lista.append(lista[i]) i = i + 1 if len(new_lista)==len(lista): return True else: return False
true
f3e5d56d03d860a436d9642773c9c3821c70f48c
josy0319/algorithm_for_problem_solving
/DivideConquer/1992(!).py
UTF-8
584
3.25
3
[]
no_license
#BOJ - 쿼드트리 ''' 분할정복 ''' import sys input = sys.stdin.readline def solve(x, y, N): color = grid[x][y] for i in range(x, x+N): for j in range(y, y+N): if color != grid[i][j]: print('(', end='') solve(x, y, N//2) solve(x, y+N//2, N//2) ...
true
e25521f54769160c2269758c57b7fb7437e1c78f
bros-bioinfo/bros-bioinfo.github.io
/COURS/M1/SEMESTRE2/ALGO/graph.py
UTF-8
2,679
3.3125
3
[]
no_license
from typing import * from graphviz import Digraph class AlreadyInException(Exception): def __init__(self, message: str): self.message = message pass def __str__(self): return self.message class GraphSimpleOriente: def __init__(self, adjacents: Dict[int, List[int]] = None): ...
true
be86f806c8f3d4bde6227b008bba282c27be543b
silvavn/TicTacToe
/Main.py
UTF-8
493
2.984375
3
[]
no_license
import sys from Game import Game from Players import HumanPlayer, MinimaxPlayer print "teste" P1 = None P2 = None for i in sys.argv: if i == "-m": if P1 == None: P1 = MinimaxPlayer("X") elif P2 == None: P2 = MinimaxPlayer("O") elif i == "-h": if P1 == None: ...
true
e1b5edb8f3305e350f67724f5d72b110a00d3ab7
miguepoloc/guajira
/Pruebas/protocolox.py
UTF-8
862
2.546875
3
[]
no_license
# -*- coding: utf-8 -*- #Importamos la librería serial import serial #Importamos la librería de tiempo import time import paho.mqtt.publish as publish print("Abriendo puerto serie") serie = serial.Serial('/dev/ttyS0', 38400) serie.close() serie.open() serie.write("AT\r\n") time.sleep(1) print("#escribiendo =1") serie.w...
true
847b0f241cb051342323fa1858666a5069fa155f
hubinitp/patches
/test.py
UTF-8
4,019
2.53125
3
[]
no_license
import numpy as np import healpy as hp import matplotlib.pyplot as plt #import pyfits #from astropy.io import fits #import astropy #NSIDE = 32 #m = np.arange(hp.nside2npix(NSIDE)) #hp.mollview(m, title="Mollview image RING") map_I = hp.read_map('../PlanckData/COM_CMB_IQU-nilc_1024_R2.02_full.fits',field=0) #hp.fits...
true
ec12655c8bd074845045ceae27e994a51b303386
dkrhSeniorProject/project
/matplotlib_work/plot.py
UTF-8
388
3.15625
3
[]
no_license
import matplotlib.pyplot as plt from random import randint def update_line(hl, xcoord, ycoord): hl.set_xdata(xcoord) hl.set_ydata(ycoord) plt.draw() plt.ion() fig = plt.figure() ax = fig.add_subplot(111) plt.axis([0,10, 0, 10]) hl, = plt.plot([1], [randint(1,10)], 'ro') plt.ylabel('some numbers') while 1 ...
true
88ea126e353b130b88dd699f17a96e55920f14c8
Gopalkataria/images_to_ascii
/art.py
UTF-8
2,078
3.125
3
[]
no_license
#!/usr/bin/python3 from cv2 import imread, cvtColor, COLOR_RGB2GRAY from sys import argv def write_html(nImage, fname ): f = open( fname + ".html", "w") height = len(nImage) * 20 width = len(nImage[0]) * 10 y = 20 f.write("""<html> <title>ASCII image </title> <body><pre> """.forma...
true
02a15cf0abc3e17828b541597de7045a57994efb
rinatsakaev/python_session
/1/1_1.py
UTF-8
562
3.1875
3
[]
no_license
import types from functools import wraps class DecoratorClass: def __init__(self, func): wraps(func)(self) print("init is called") def __call__(self, *args, **kwargs): print("call is called") return self.__wrapped__(*args, **kwargs) def __get__(self, instance, cls): ...
true
52bac8d64fb3b1da2f11786a649fcc346bac7231
IgorTFromK/BasicAudioDatasetOperations
/basic_audio_data_ops.py
UTF-8
1,164
2.859375
3
[]
no_license
import librosa import soundfile as sf import numpy as np def load(filename: str, sample_rate: int) -> (np.ndarray, int): return librosa.load(filename, sample_rate) def write(x: np.ndarray, filename: str, sample_rate: int): sf.write(filename, x, sample_rate) def resample(x: np.ndarray, src_sample_rate: int...
true
54d7338d1ccdf9d4b5647f8595418747842b211c
sanskarjain2507/full-stack-development
/python/dict49.py
UTF-8
296
3.296875
3
[]
no_license
user={'name':'sanskar','age':20} print(user) user1=dict(name='samay',age=50) print(user1) print(user['name']) user2 ={ 'name':'sanskar jain', 'age':20, 'learning now':['programming','living','engg'], } print(user2['learning now']) user3={} user3['ss']=33 print(user3)
true
fc132c580f025e4133d48c81f96e1ec1ba1146d7
pgw928/TIL
/algorithms/boj/dfs&bfs/11403.py
UTF-8
577
2.984375
3
[]
no_license
import sys from collections import deque input = sys.stdin.readline n = int(input()) graph = [list(map(int, input().split())) for _ in range(n)] def bfs(start): check = [False]*n dq = deque() dq.append(start) while dq: node = dq.popleft() for n_n in [idx for idx, k in enumerate(grap...
true
9e227b1d4ab0e20fcad1143745824e560b405903
sankeerth/Practice
/geeks_for_geeks/longest_common_subsequence.py
UTF-8
856
3.953125
4
[]
no_license
str1 = "abc" str2 = "aed" def lcs(str1, str2, l1, l2): if l1 == 0 or l2 == 0: return 0 elif str1[l1-1] == str2[l2-1]: return 1 + lcs(str1, str2, l1-1, l2-1) else: return max(lcs(str1, str2, l1, l2-1), lcs(str1, str2, l1-1, l2)) print(lcs(str1, str2, len(str1), len(str2))) """ ...
true
9cac4a456616733ddb467331f1bf415ee09787a4
mesmerx/five-video-classification-methods
/plot_trainlog.py
UTF-8
858
3.234375
3
[ "MIT" ]
permissive
""" Given a training log file, plot something. """ import csv import matplotlib.pyplot as plt def main(training_log): with open(training_log) as fin: reader = csv.reader(fin) next(reader, None) # skip the header accuracies = [] top_5_accuracies = [] cnn_benchmark = [] # th...
true
7a5e7dfd1a20ae8238f3144260244fc53803885f
raulgranja/Python-Course
/PythonExercicios/ex097.py
UTF-8
186
3.296875
3
[ "MIT" ]
permissive
def escreva(str): print('~' * (len(str) + 4)) print(f' {str} ') print('~' * (len(str) + 4)) # main escreva('Gustavo Guanabara') escreva('Curso de Python no Youtube') escreva('CeV')
true
0bacb9c679340e6d446294ad5d07375e67fa5c64
Chems93/servier
/bin/main.py
UTF-8
958
2.875
3
[]
no_license
# Import libraries import pandas as pd from lib import (fingerprint_features, fingerprint_array, preprocess, get_features_target, train_and_evaluate, prediction) from sklearn import svm import argparse import logging log = logging.getLogger() logging.basicConfig(format='%(asctime)s %(levelname)s:%(mess...
true