blob_id
stringlengths
40
40
language
stringclasses
1 value
repo_name
stringlengths
5
133
path
stringlengths
2
333
src_encoding
stringclasses
30 values
length_bytes
int64
18
5.47M
score
float64
2.52
5.81
int_score
int64
3
5
detected_licenses
listlengths
0
67
license_type
stringclasses
2 values
text
stringlengths
12
5.47M
download_success
bool
1 class
ef58867886d1dcd131fcade905058179d44fbfa5
Python
cohock13/atcoder
/abc/38/test.py
UTF-8
102
2.90625
3
[]
no_license
from bisect import bisect_left,bisect a = [1,2,3,4,5,6] print(bisect_left(a,2.5),bisect(a,2.5))
true
7d1d26c8b388e7e79316f74cae2f5eb783105000
Python
Ndiaye01/check_kippo_honeypot.py
/locationcsv.py
UTF-8
637
2.84375
3
[]
no_license
import MySQLdb import sys import csv import requests import json dbServer='' dbPass='' dbUser='' dbQuery='SELECT DISTINCT ip FROM sessions ;' def geolocation (ip): s="" result =requests.get("https://extreme-ip-lookup.com/json/" +ip) json_result=json.loads (result.text) s = json_result["query"]+";"+j...
true
c5e8ba98b45242ad16e6bc977a2fde882eb30642
Python
untalinfo/holbertonschool-low_level_programming
/0x1C-makefiles/5-island_perimeter.py
UTF-8
1,126
3.765625
4
[]
no_license
#!/usr/bin/python3 """ Perimeter of island """ def island_perimeter(grid): """ Calculates perimeter of island Args: grid ([list]): list of list with representation island Returns: [Int]: [perimeter] """ perimeter = 0 for i in range(len(grid)): for j in range(len(g...
true
a8fe319d1a4b6c918afe8400e6ba2f66d23ec952
Python
hebeard/BootCamp2018
/ProbSets/Comp/ProbSet1/Harrison_Beard_ProbSet1.py
UTF-8
45,264
3.71875
4
[]
no_license
# coding: utf-8 # # Intro to NumPy # Note: If any of the lines of code are too long to fit on the page, then please reference the $\mathtt{.py}$ or the $\mathtt{.tex}$ file with this same title, in this directory. # ## Problem 1 {-} # In[3]: import numpy as np ### PART 1: INTRO TO NUMPY # Problem 1 def problem...
true
facef40860303696b2805e030a06907bcf21a955
Python
9-hokage/ryadomteka
/drugs/management/commands/create_users_from_csv.py
UTF-8
2,253
2.6875
3
[]
no_license
import csv from django.core.management.base import BaseCommand, CommandError from django.contrib.auth import get_user_model from django.utils.crypto import get_random_string class Command(BaseCommand): """manage.py import_users --csv='/Users/user/usuariosweb.csv' --encoding='iso-8859-1'""" help = 'Imports use...
true
6012a1c84954d06e193ea5f05f79e109be3dc4c6
Python
Bieneath/LeetCode_training
/Week-1024/210.py
UTF-8
2,390
3.796875
4
[]
no_license
# BFS时候需要从根课程开始遍历,逐渐扩散到所有课程;与DFS不同,BFS加了一个indegree参数,代表还有多少前置课程未被选修 # 只有当indegree=0时候,当前课程才能被选修!!! from collections import defaultdict, Counter, deque class Solution: def findOrder(self, N: int, pres: List[List[int]]) -> List[int]: dic, indegree = defaultdict(set), Counter() for u, v in pres: ...
true
6ddeef9878fe455595801cc1b6f6c7cf7ca7d38b
Python
bokveizen/leetcode
/45_Jump Game II.py
UTF-8
1,251
3.015625
3
[]
no_license
# https://leetcode-cn.com/problems/jump-game-ii/ class Solution: def jump(self, nums: List[int]) -> int: dp = [0 for _ in nums] n = len(nums) if n <= 1: return 0 for i in range(n - 1): pos = -2 - i jump_range = nums[pos] if jump_range >...
true
bb0ab4870a90285173b7d77f2fc137ef1d3e61ef
Python
zhch-sun/leetcode_szc
/377.combination-sum-iv.py
UTF-8
863
3.671875
4
[]
no_license
# # @lc app=leetcode id=377 lang=python # # [377] Combination Sum IV # # @lc code=start class Solution(object): def combinationSum4(self, nums, target): """ :type nums: List[int] :type target: int :rtype: int """ f = [0] * (target + 1) f[0] = 1 for i ...
true
4fd93ad638750d7ca2c3045aeeed5fd19e80e963
Python
ottermegazord/nltk
/vectorizer.py
UTF-8
1,393
2.65625
3
[]
no_license
#!/usr/bin/python import os import pickle import re import sys sys.path.append( "../tools/" ) from email_parser import parseOutText """ dataset in pickle format """ from_sara = open("from_sara.txt", "r") from_chris = open("from_chris.txt", "r") from_data = [] word_data = [] temp_counter = 0 for name, from_...
true
80fd2bb713910f1fdc8ee96ad0f49e34cb50b57e
Python
Kikallazz/runnergame
/runnergameSubmission-Day/testingpygame.py
UTF-8
6,703
3.234375
3
[]
no_license
import random import pygame pygame.init() WIDTH = 800 HEIGHT = 600 screen = pygame.display.set_mode((WIDTH, HEIGHT)) hero = pygame.sprite.Sprite() hero.image = pygame.image.load('spriteguyc.png') hero.rect = hero.image.get_rect() hero_group = pygame.sprite.GroupSingle(hero) TILE_SIZE = 10 # This makes ...
true
fa2e086bcb9e8d8fd6102f3951e03c011467e264
Python
M4M4R0/game-of-life
/controller.py
UTF-8
1,272
3.03125
3
[]
no_license
from kivy.uix.boxlayout import BoxLayout from kivy.properties import ObjectProperty from kivy.clock import Clock from collections import Counter from world_parser import * import model # game controller class Game(BoxLayout): grid = ObjectProperty(None) fps = 1 is_running = False # start iterations , updat...
true
0f15a41d64875563aa528b1bf6ee33e80e80f838
Python
wwijatkowski/FavouriteMoviesApp
/app.py
UTF-8
7,820
2.5625
3
[]
no_license
from flask import Flask, render_template, request, redirect, url_for, session, jsonify, flash from flask_bootstrap import Bootstrap from flask_sqlalchemy import SQLAlchemy import requests import os import logging from datetime import date from forms import SearchField, UserForm, UserFormEdit app = Flask(__name__) app....
true
f2b997a772ce065a4c59ac66cfb1f9ba74342415
Python
protocol7/advent-of-code
/2017/7/foo.py
UTF-8
1,146
3.34375
3
[]
no_license
import sys from collections import Counter discs = {} for line in sys.stdin: line = line.split() w = int(line[1].strip("()")) children = set() if len(line) > 3: children = set([x.strip(",") for x in line[3:]]) discs[line[0]] = (w, children) all_children = set() for _, c in discs.values():...
true
81fec874bcec8e66e19805c2c7d9c146c5e5543e
Python
rockobonaparte/bfsr
/scripts/level_id_nbt_remap.py
UTF-8
1,368
2.953125
3
[ "CC0-1.0" ]
permissive
# This takes a remap file and uses it to migrate a player.dat ID table. It requires the NBT Python module in order to # open up and manipulate the NBT files from nbt import nbt import argparse from migration_map import load_remap_as_dict, MinecraftThing, MinecraftMetadataThing if __name__ == "__main__": parser = ...
true
eca37ad4f1497b52f2dbd8b7d12f432722c58244
Python
Lintik/hackerrank
/Core CS/Data Structure/Arrays/Arrays - DS/reverseArray.py3
UTF-8
110
2.75
3
[]
no_license
import sys N = input() A = [int(x) for x in input().split()] print(' '.join([str(x) for x in reversed(A)]))
true
82befe89ac2c38ea33f0e3c67ac02a6d6b183c5a
Python
485629/AdventOfCode2020
/16/1.py
UTF-8
1,250
3.296875
3
[]
no_license
class TrainTicket: def __init__(self, data, my_ticket, nearby_tickets): self.dic = {} for i in data.split("\n"): item = i.split(": ") ranges = item[1].split(" or ") self.dic.setdefault(item[0], []).append([int(x) for x in ranges[0].split("-")]) self.d...
true
e8df1239012f89abaee81ff959841d4772a9a4af
Python
NeilGraham/cli-notes
/tests/bump.py
UTF-8
3,088
2.578125
3
[]
no_license
def main(): count = 0 action = {'type':None, 'options':[], ''} while action != 'exit': action = input('') if action == '': count += 1 if action == 'p': print('\r\r\r') print(count) if if action[0:2] == 'ft': # RETURNS parsed # Pa...
true
98220a59b9f0aa3d3b9b8240c9cf82e98ac2b6fa
Python
Davidcruz123/Primer-proyecto-did-ctico-
/correos.py
UTF-8
711
2.859375
3
[]
no_license
import smtplib def mail(asunto,mensaje,correo): message = mensaje subject = asunto message = 'Subject:{}\n\n{}'.format(subject, message) # ojo, el subject debe ir escrito así, sino no lo identifica server = smtplib.SMTP('smtp.gmail.com', 587) # Definir objeto smtp...primero...
true
3f47c284287e54202eb0cdfb17f39567d839bc2d
Python
Aasthaengg/IBMdataset
/Python_codes/p03265/s200451310.py
UTF-8
178
3.109375
3
[]
no_license
li = list(map(int,input().split())) xy1,xy2 = (li[0],li[1]),(li[2],li[3]) div=(xy2[0]-xy1[0],xy2[1]-xy1[1]) print(xy2[0]-div[1],xy2[1]+div[0],xy1[0]-div[1],xy1[1]+div[0],sep=" ")
true
1f7276d99e03bd4e62cb805ff499f5b6120af0aa
Python
HelenMaksimova/python_lessons
/lesson_1/lesson_1_3.py
UTF-8
416
4.4375
4
[]
no_license
# Узнайте у пользователя число n. Найдите сумму чисел n + nn + nnn. # Например, пользователь ввёл число 3. Считаем 3 + 33 + 333 = 369. user_num = input('Введите число: ') result = int(user_num) + int(user_num*2) + int(user_num*3) print(f'Сумма чисел {user_num}, {user_num*2} и {user_num*3} равна {result}')
true
0616e642d2724beccb71686d31fb0593876b37d2
Python
Karishma00/NewPythonData
/Advanced Topics/CharacterSetDemo.py
UTF-8
335
3.421875
3
[]
no_license
#Character Set Syntex example import re def find_multi_pattern(patterns,strings): for p in patterns: print('Searching in the string %r'%p) print(re.findall(p,strings)) print('\n') str1='aaaabbbaa..ababa..aabbbbb.babaa..aaabbb' t=['ab*','ab+','ab?','ab{2}','ab{2,5}'] find_multi_pat...
true
941357d00c26cb4ebb89d03d5d685b46400ca37a
Python
garciaha/DE_daily_challenges
/2020-08-17/diamond.py
UTF-8
2,281
4.40625
4
[ "MIT" ]
permissive
"""Build a Diamond Machine You are a skilled diamondsmith whose business is getting better by the day. Eventually, you decided that you needed to scale to keep up with demand. - Build a diamond-cutting machine (i.e. write a function that takes in a positive integer representing the raw stone's carat). - The output...
true
9c08244d88ce1df1e1ce49e663cdf4aee23ea1d1
Python
StudyForCoding/ProgrammersLevel
/Level1/Lessons12901/yang_12901.py
UTF-8
181
3.1875
3
[ "MIT" ]
permissive
def solution(a, b): label = ['MON','TUE','WED','THU','FRI','SAT','SUN'] import datetime answer = label[datetime.date(2016,a,b).weekday()] return answer print(solution(1, 2))
true
8f630ddeee616943e10f2a910e84ce447265bcf0
Python
AdityaChirravuri/CompetitiveProgramming
/Codechef/Practice/Beginner/SmallFactorial.py
UTF-8
99
3.34375
3
[ "MIT" ]
permissive
import math t = int(input()) for _ in range(t): k = int(input()) print(math.factorial(k))
true
8be6473b3ee21c1a9d4c4c297626c25c19b4d581
Python
shagunbidawatka/Music-player
/mediaplayer.py
UTF-8
6,622
2.796875
3
[]
no_license
from tkinter import * import threading import os import tkinter.messagebox from mutagen.mp3 import MP3 import time from tkinter import filedialog from pygame import mixer root=Tk() root.geometry("5000x10000") root.configure(bg='#ff0055') statusbar=Label(root,text="Welcome to melody",relief=SUNKEN,anchor=W) ...
true
eeccd77d72e92ce025edc4f384d1b251b8322a85
Python
Ravikumar1997/Daily-pracitce
/python/hw/learn_class/meta_class/empty.py
UTF-8
180
3.21875
3
[]
no_license
__author__ = 'zzt' class Empty: pass if __name__ == '__main__': e = Empty() e.a = 1 e.b = '...' e.c = lambda x: x ** 2 e1 = Empty() print(e.c(10))
true
e1b8516e6ef2a79bb47be7d03015140458da8d53
Python
agutierreza/drl-unity-tennis
/agentcommon.py
UTF-8
2,761
2.75
3
[]
no_license
import numpy as np import random import copy from collections import namedtuple, deque #from model import Actor, Critic from actoragent import ActorAgent from criticagent import CriticAgent from noise import OUNoise from replaybuffer import ReplayBuffer import torch import torch.nn.functional as F import torch.optim...
true
700c12ef929030acdf923d0e830c799758091ee4
Python
mcuny/Wi-Fi_ing1
/src/rc4.py
UTF-8
2,097
3.34375
3
[ "MIT" ]
permissive
from binascii import unhexlify from scapy.utils import hexstr def rc4(data: bytes, key: bytes)-> str: """ RC4 is a stream cypher. There are two parts to the algorithm. KSA: Key Scheduling Algorithm PRGA: Pseudo Random Generator Algorithm The goal here is to build a keystream from the key to...
true
9a247ef739f6c025aa76c1ba962284308e32bec7
Python
kaylarobinson077/ahs
/ahs_boxplots.py
UTF-8
4,859
2.578125
3
[]
no_license
import seaborn as sns import pandas as pd import numpy as np import matplotlib.pyplot as plt # data from: http://www2.census.gov/programs-surveys/ahs/2017/AHS%202017%20National%20PUF%20v3.0%20Flat%20CSV.zip?# fname = 'Data/ahs2017n.csv' raw_data = pd.read_csv(fname) # give readable names for division raw_data["DIVISI...
true
59af219021907b8dfdf96deae593b9371d01e8f8
Python
pyjka/OS_Stuff
/Max Sum Contiguous Subarray.py
UTF-8
356
3.71875
4
[]
no_license
""" Find the contiguous subarray within an array (containing at least one number) which has the largest sum. """ def maxSubArray(A): # Solution implementing dynamic programming max_yet = A[0] max_sofar = A[0] for i in range(1,len(A)): max_yet = max(A[i],max_yet + A[i]) max_sofar = max(max...
true
8f7f060cea2ff59744495c4fb052a699f17012b7
Python
Iseez/mex-covid-19
/scripts/scraping/get-pdfs-ctd.py
UTF-8
3,496
2.765625
3
[]
no_license
import requests import bs4 import urllib.request import os from datetime import timedelta, date import time import argparse ag = argparse.ArgumentParser() ag.add_argument("mode",help="Mode of operation, 'all' will download all the pdf technical files in the designated folder while 'update' will only download the missin...
true
842414afde518ba387512ebc307ef87786eab8c9
Python
lotreklab/vue-experiments-stage
/core/utils.py
UTF-8
394
2.53125
3
[]
no_license
import random import string ALPHANUMERIC_CHARS = string.ascii_lowercase + string.digits STRING_LENGTH = 6 def generate_random_string(chars=ALPHANUMERIC_CHARS, length=STRING_LENGTH): return "".join(random.choice(chars) for _ in range(length)) #genero una stringa a partire da una seriei di caratteri causuali in...
true
a877d8623685b73abcae19b550510f75fa508787
Python
poonamangne/Programming-Exercises-1
/Chapter04_04.py
UTF-8
572
4.9375
5
[]
no_license
# 4.4 Write a program that generates two integers under 100 and prompts the user to enter # the sum of these two integers. The program then reports true if the answer is correct, false otherwise import random # Import random module # Generate two random integers under 100 number1 = random.randint(0, 99) number2 = ra...
true
ca58d64bd0591914c3d85854a3a35dc11a3c6d1c
Python
SSaquif/python-notes
/7-exceptions/2-raising-exceptions.py
UTF-8
1,246
4.5625
5
[]
no_license
from timeit import timeit # Rasing exceptions : Inefficient Way def throwException(age): if age <= 0: raise ValueError('Age cant be 0 or less') return 10/age # We must call this function in a try block try: throwException(-1) except ValueError as error: print(error) # Rasing Exceptions Eff...
true
1f4b6fe33bbbb97eff363608ea171575627227d2
Python
DMNT68/primeros-pasos-python
/funciones.py
UTF-8
1,279
4.0625
4
[]
no_license
def mi_funcion(nombre): print(f"soy {nombre}") # mi_funcion("Andres") def suma(a,b): res = a+b return "soy una suma", res tipo, resultado = suma(2,3) # print(tipo) # print(resultado) # import random # def get_stats(): # dados = [random.randint(1,6) for i in range(4)] # dados.sort() # max_dad...
true
7e43159df259fe81eb38ebc8f9b969a88fad7fd6
Python
DeliaPascaru/Workspace
/calculator.py
UTF-8
1,225
4.09375
4
[]
no_license
# Temperature converter: def f_to_c(f_temp): '''''' c_temp = (f_temp - 32) * 5/9; return c_temp; def c_to_f(c_temp): f_temp =c_temp* (9/5) + 32; return f_temp; def get_force (mass,acceleration): return mass*acceleration; def get_energy(mass,c=3*10**8): return mass*c**2; def get_work(mass...
true
d868ac23ff09e7564ffa9b2ee9b6a47d311ea6f3
Python
1byte-yoda/Machine_Learning_A-Z
/Part 3 - Classification/Section 14 - Logistic Regression/Logistic_Regression/logistic_regression_mark.py
UTF-8
2,299
3.375
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Mon Dec 3 18:20:25 2018 @author: Razer """ """importing libraries""" import numpy as np import matplotlib.pyplot as plt import pandas as pd from sklearn.model_selection import train_test_split from sklearn.preprocessing import StandardScaler from sklearn.linear_model import Logi...
true
43689bb85021f41591f97d900868e6de29440064
Python
tengxing/py3-learn
/base/6.py
UTF-8
738
3.640625
4
[]
no_license
#!/usr/bin/env python # -*- coding:utf-8 -*- # Mail: tengxing7452@163.com # Author: StarryTeng # Description: 数据类型 ################################## # Py3.X去除了long类型,现在只有一种整型——int,但它的行为就像2.X版本的long # 新增了bytes类型,对应于2.X版本的八位串 # dict的.keys()、.items 和.values()方法返回迭代器,而之前的iterkeys()等函数都被废弃。同时去掉的还有 dict.has_key(),用 in替代它吧...
true
244f9098683d598231d0ba1b6a26ed769d0cae88
Python
liubei90/leetcode
/29.两数相除.py
UTF-8
2,265
3.390625
3
[]
no_license
''' Author: liubei Date: 2021-07-26 10:57:42 LastEditTime: 2021-07-26 11:49:30 Description: ''' # # @lc app=leetcode.cn id=29 lang=python3 # # [29] 两数相除 # # https://leetcode-cn.com/problems/divide-two-integers/description/ # # algorithms # Medium (20.61%) # Likes: 622 # Dislikes: 0 # Total Accepted: 100.3K # Tot...
true
1ed0928ac664631d77ce0c4379d77cb7df8a904c
Python
TMcMac/AirBnB_clone
/console.py
UTF-8
6,825
2.921875
3
[]
no_license
#!/usr/bin/env python3 '''Command line interpreter for HBNB Clone''' import cmd import json import sys from models.base_model import BaseModel from models.user import User from models.state import State from models.city import City from models.amenity import Amenity from models.place import Place from models.review im...
true
c3e64ba046700c3752b3e84d6a7292551bca7b0f
Python
clarkwkw/GEStatProj
/tp_analysis/preprocessing/filter.py
UTF-8
1,114
2.9375
3
[]
no_license
import math import numpy as np def score_portion(samples, get_score, high_portion, low_portion, separate = False): n_high, n_low = None, None n_samples = len(samples) if high_portion + low_portion > 1: raise Exception("sum of low_portion and high_portion can not exceed 1") n_high = math.floor(n_samples*high_port...
true
be3de1f6b783ac1966ea48aecf3f12d0206be87f
Python
albammiguel/trafficSignClassifier
/src/FileManager.py
UTF-8
2,117
2.9375
3
[]
no_license
from ImageInfo import ImageInfo from SignInfo import SignInfo import os import cv2 class FileManager: def countNumberOfFiles(self, path): listPath = os.listdir(path) print("Numero de archivos: " + str(len(listPath))) return len(listPath) def loadTrainData(self, path, numberOfFiles): ...
true
d922da74ff84be5a721805aeb95fed22d9748bb3
Python
evilpegasus/google-trends-financial-modeling
/get_csvs.py
UTF-8
402
2.84375
3
[]
no_license
from pytrends import dailydata """ Makes requests for each word in words.txt Run this on a server overnight Takes about 9 hours before failing """ with open("words.txt") as f: words = f.readlines() words = [x.strip() for x in words] words = words[49] print(words) for word in words: try: dailydata.get_...
true
a46a51fa741f7a2ede40678ba2764c269d5b7a9c
Python
PabRod/pendulum
/scripts/animation_nipendulum.py
UTF-8
1,613
3.15625
3
[ "MIT" ]
permissive
## Import the required modules from pendulum.models import * import matplotlib.pyplot as plt import matplotlib.animation as animation ## Set-up your problem g = 9.8 # Acceleration of gravity l = 1 # Pendulum length d = 1 # Damping # Pivot's position ## The pivot is moving, so its position is a function of time pos_x ...
true
99394f13dd17b83678d7fcd13b5fccc687aecfff
Python
NoahtheDeveloper/Learning-Python
/Hello.py
UTF-8
457
3.625
4
[ "MIT" ]
permissive
#Says hello # Imported Modules # import time # 10 Seccond Timer time.sleep(10) print ("Hello World I am Daddy") # Another 5 Seccond wait time.sleep(5) print ("Your coding is very Basic Right Now.") #Note: If you are having multiple print lines or having other lines you need to have print (" Inser...
true
9054632f762f4677d985e73dba28f6f331e3d65b
Python
yoshikipom/leetcode
/solve_1/559.maximum-depth-of-n-ary-tree.py
UTF-8
627
3.234375
3
[]
no_license
# # @lc app=leetcode id=559 lang=python3 # # [559] Maximum Depth of N-ary Tree # class Node: def __init__(self, val=None, children=None): self.val = val self.children = children # @lc code=start """ # Definition for a Node. """ class Solution: def maxDepth(self, root: 'Node') -> int: i...
true
40a573958144ed32b6e5a3aefb81917b0c07931d
Python
rafaelpllopes/Selenium-Python
/aula 14/aula_selene03.py
UTF-8
561
2.59375
3
[]
no_license
from selene import Browser, Config from selenium.webdriver import Firefox """ Navegação Selenium | Selene get() | open() back() | driver.back() forward() | driver.forward() current_url | driver.current_url title | driver.title page_source | driver.page_source """ browser = Browser( ...
true
a3bb4aca833bbb2e0d950ab3698b13eb43e1155c
Python
Aasthaengg/IBMdataset
/Python_codes/p03608/s039061004.py
UTF-8
1,604
2.859375
3
[]
no_license
import bisect, collections, copy, heapq, itertools, math, string import sys def I(): return int(sys.stdin.readline().rstrip()) def MI(): return map(int, sys.stdin.readline().rstrip().split()) def LI(): return list(map(int, sys.stdin.readline().rstrip().split())) def S(): return sys.stdin.readline().rstrip() def LS(): r...
true
be82f2a7f5fa328a87944a63fde2d85a7e604060
Python
htc1159/python
/d05/judge.py
UTF-8
494
3.546875
4
[]
no_license
#!/usr/bin/env python3 # -*- coding: utf-8 -*- age = input('please input your age: \n') age = int(age) if age >= 18: print('age:%d' % age) print ('adult') else : print('kid') if age >=18 : print ('a') elif age>=6: print('b') else: print('c') height = 1.75 weight = 80.0 bmi = weight/(heigh...
true
b9fa9719ece2152d3002db04c9856b579ad38c6b
Python
tecnalia-advancedmanufacturing-robotics/vulcano_common
/vulcano_base_navigation/scripts/path2posearray.py
UTF-8
665
2.546875
3
[]
no_license
#!/usr/bin/env python import rospy from geometry_msgs.msg import Pose, PoseArray from nav_msgs.msg import Path class Path2PoseArray(object): def __init__(self): self.value = 0 rospy.init_node('path2posearray') self.pub = rospy.Publisher('plan_posearray', PoseArray, queue_size = 1) ...
true
1d3bd7295383ee4eb6bc763a487df1d6f9994c3b
Python
adepril/virusSpreadSimulation
/simul_covid_plotting_tkinter.py
UTF-8
4,374
2.796875
3
[]
no_license
from tkinter import * import random #courbes from matplotlib import pyplot as plt fig = plt.figure() WIN_W = 700 WIN_H = 600 POPULATION = 100 contamines_au_depart = 3 rayon_contamination = 12 duree_maladie = 500 SIZE=5 go=True COULEUR_CONTAMINE = "red" COULEUR_SAINT = "DarkOliveGreen2" COULEUR_RETABLI = "green" # c...
true
e8f4d91d2ff5f5106aebb6f58bf4d06d5349207c
Python
bertinsz93/otros
/puntos.py
UTF-8
2,505
2.84375
3
[]
no_license
import cv2 import numpy as np #Iniciamos la camara captura = cv2.VideoCapture(0) # Parametros para la funcion de Lucas Kanade lk_params = dict( winSize = (15,15), maxLevel = 2, criteria = (cv2.TERM_CRITERIA_EPS | cv2.TERM_CRITERIA_COUNT, 10, 0.03)) #Capturamos una ...
true
f8167d0865b5fc5d4e323c63bd32b15cfad9a70f
Python
ArunkumarRamanan/toxic-comment-classification
/code/preprocessing/clean_text.py
UTF-8
1,003
3.15625
3
[]
no_license
import re import pandas as pd # text cleaning def clean_text(text): text = re.sub(r"\W+", " ", text.lower()) text = bytes(text, encoding="utf-8") text = text.replace(b"\n", b" ") text = text.replace(b"\t", b" ") text = text.replace(b"\b", b" ") text = text.replace(b"\r", b" ") text = regex....
true
a3b2f5b00f1e935a6bb514a13921ab1812e8dc73
Python
Englishadmin/xxx
/flask/day4/orm/sql2.py
UTF-8
1,957
2.671875
3
[]
no_license
from sqlalchemy import create_engine,Integer,String,Column from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import sessionmaker hostname='127.0.0.1' port=3306 database='professional_master' username='root' password='123456' db_url='mysql+pymysql://{}:{}@{}:{}/{}'.format(username,password,ho...
true
2b5d86d6dad587b1a36441af3f105ff5fe2910d8
Python
mimilazarova/DD2418-Language-Engineering
/Assignment2/LanguageModels/Generator.py
UTF-8
4,402
3.65625
4
[]
no_license
import math import argparse import codecs from collections import defaultdict import random """ This file is part of the computer assignments for the course DD1418/DD2418 Language engineering at KTH. Created 2018 by Johan Boye and Patrik Jonell. """ class Generator(object): """ This class generates words fro...
true
1ab2ef790384b97f325dba31b93d83aa7b990111
Python
OopsL/Machine_Learning_in_Action
/MLActionTest/ch13/pca.py
UTF-8
1,215
2.671875
3
[]
no_license
import numpy as np def loadDataSet(filename,delim='\t'): dataMat = [] fr = open(filename) for line in fr.readlines(): curline = line.strip().split('\t') lineArr = [] for i in range(len(curline)): lineArr.append(float(curline[i])) # flt = map(float,curline) ...
true
6055dd50ef0c2b00fa07ff382f205e15412063af
Python
Aasthaengg/IBMdataset
/Python_codes/p03096/s241868890.py
UTF-8
377
2.609375
3
[]
no_license
from collections import defaultdict M = 10**9 + 7 N = int(input()) C = [0]*N for i in range(N): C[i] = int(input()) P = [0]*N Q = [0]*N QS = defaultdict(int) Q[0] = QS[C[0]] = 1 for i in range(1,N): if C[i] == C[i-1]: Q[i] = 0 else: Q[i] = (P[i-1] + Q[i-1]) % M P[i] = QS[C[i]] QS[...
true
4335f982d55aa7bded544c2ed6701c70146a13a6
Python
Daniel-Conte/Exercicios-de-Algoritmo
/Algoritmo(Python)/Alg_S6_4.py
UTF-8
338
3.9375
4
[ "MIT" ]
permissive
#input altura = float(input("Digite sua altura: ")) sexo = input("Qual é o seu sexo?[M/F] ") #process if(sexo.upper() == "M"): pideal = ((altura * 72.7) - 58) elif(sexo.upper() == "F"): pideal = ((altura * 62.1) - 44.7) else: pideal = 0 print("Sexo inválido") #output print("O seu peso ideal é: {0:.2f}"....
true
49559957cef3429de9698c4640239f5ee9f3011f
Python
gjwlsdnr0115/algorithm-study
/pre-warmup/5.1d-array/array_03.py
UTF-8
147
3.453125
3
[]
no_license
a = int(input()) b = int(input()) c = int(input()) mul = a*b*c digits = [int(d) for d in str(mul)] for i in range(10): print(digits.count(i))
true
1af4d6fffa03acec2ae8ac89440f41245004a03e
Python
garciaha/DE_daily_challenges
/2020-08-19/treasure_hunting.py
UTF-8
1,816
4.40625
4
[ "MIT" ]
permissive
"""Helping Alex with Treasure Alex and Cindy, two students who recently spent some time on treasure hunting. Apart from scrap metal, they found a number of boxes full of old coins. Boxes are of different value and now are lined up in a row. Cindy proposes an idea to divide the treasure into two parts. She thinks tha...
true
93ad7b7162fc9e0da41d1abc4208fec3f27cfef4
Python
rursvd/pynumerical
/6_13.py
UTF-8
79
2.875
3
[]
no_license
from numpy import array a = array([0,1,2,3,4,5,6,7,8]) print('a[:3] = ',a[:3])
true
a957d19a744d6f8936ce15ded58e6f32130fad66
Python
mosquito/simpleaes
/src/simple_aes.py
UTF-8
6,314
3.125
3
[ "MIT" ]
permissive
# encoding: utf-8 import hashlib import tempfile from Crypto.Cipher import AES from Crypto import Random import base64 import struct import gzip from StringIO import StringIO class SimpleAES: """ >>> from simple_aes import SimpleAES >>> enc = SimpleAES('test') >>> encrypted = enc.encrypt('...
true
ad4567a5dcfc72b701657a91268bf8e4f7a8f38e
Python
Gokul13/Zinc-Plating
/EIS_Plotting.py
UTF-8
1,414
3.078125
3
[]
no_license
##Author: Gokulanand Iyer ##Date Started: 3/31/18 ##Notes: Plating experiments with EIS run in between intervals of equal charge passed. Plot of EIS curves for experiments from pithy import * import math import numpy as np import pandas as pd import matplotlib.pyplot as plt import glob #Function for Parsing and ploti...
true
013823f211209845ccc250eae9451a82b9904da8
Python
weihengSu/hadoop-mapReduce
/reducer1.py
UTF-8
550
3.109375
3
[ "MIT" ]
permissive
#!/usr/bin/python from operator import itemgetter import sys import math import operator worstSystems = dict() for line in sys.stdin: line = line.strip() words = line.split("\t") tempDifference = words[0] system = words[1] if (system in worstSystems): worstSystems[system] += int(tempDifference)...
true
6ae91889c322fe6ac6a302b0773bbf219f747770
Python
tangsttw/DrawingMachine
/main_program.py
UTF-8
5,551
2.546875
3
[ "MIT" ]
permissive
import random import sqlite3 from flask import Flask, render_template, request, g, flash, redirect, url_for from flask_sqlalchemy import SQLAlchemy GROUPS = ['Downtown', 'neighboring'] app = Flask(__name__) app.config['SECRET_KEY'] = "random string" @app.route('/') def index(): return render_template('index.ht...
true
c9179d050391fca06f1874b8c9fbb1762a0561b4
Python
jonorthwash/xparser
/src/xrp/parser.py
UTF-8
9,643
3.21875
3
[ "MIT" ]
permissive
import abc import itertools import re import collections COMMENT_START = '!' DEFINE_START = '#' RESOURCE_SEP = ':' WHITESPACE_CHARS = (' ', '\n') class XParseError(Exception): pass class MissingTokenError(XParseError): def __init__(self, token, line=None): msg = f'missing token "{token}"' ...
true
4871043cc72adc1ed50ae23bf1cbf04ddea964bc
Python
nayribeiro/credit_card
/card_validator.py
UTF-8
1,671
3.421875
3
[]
no_license
from datetime import datetime,date # Valida def validate_card_exp_date(card_exp_date): print("Validando data") date_now = date.today() month, year = card_exp_date.split("/") month = int(month) year = int(year) if year < int(date_now.year): exit("Ano expirado") if month < 1 or...
true
d9ea24c05d964c3273ca791410f3c98582438eeb
Python
rfverbruggen/easydriverpy
/easydriver.py
UTF-8
2,932
2.671875
3
[]
no_license
#!/usr/bin/python import time try: import RPi.GPIO as gpio except: print("Error importing RPi.GPIO") '''EasyDriverPy module Take control over the EasyDriver stepperdriver from the RaspberryPi ''' __author__ = 'Robbert Verbruggen' __version__ = '0.1' class EasyDriver(object): '''EasyDriver class''' def __i...
true
5f7e767242866b50453e60d69d1c5e0b3e9f2037
Python
shebu18/quantum
/qa_simple_qft.py
UTF-8
1,043
2.828125
3
[]
no_license
#============================================================================== # DFT #============================================================================== import numpy as np x = np.array([0.5, 0.5, 0.5, 0.5]) y = np.fft.fft(x, norm='ortho') print(y) x = np.fft.ifft(y, norm='ortho') print(x) #===...
true
17af7ce6c1dc25eec3edcdbf76efe204d01a00ee
Python
vivekpisal/Dstructure
/dstructure/ll/SLL.py
UTF-8
1,385
3.46875
3
[ "MIT" ]
permissive
class Node: def __init__(self,value): self.data=value self.next=None class SLL: def __init__(self): self.root=None def insert(self,value): if self.root==None: self.root=Node(value) else: traversal=self.root while traversal.next!=None: traversal=traversal.next traversal.next=Node(value) ...
true
e018efa202e22b7902148b3394113aeb512ab3f4
Python
YsabellaCalderon/Algoritmos-y-Estructura-de-Datos
/Parciales/Parcial 1/main.py
UTF-8
334
3.140625
3
[]
no_license
import codigos import time n=0 inicio = time.time() codigos.caso1 (n) tiempo_caso1 = time.time() - inicio inicio = time.time () codigos.caso2 (n) tiempo_caso2 = time.time() - inicio print (tiempo_caso1) print (tiempo_caso2) if tiempo_caso1>tiempo_caso2: print ("El mejor caso es el 2") else: print ("El mejor c...
true
de7ae707c6f6cfef5d38ea434c8703141345ef36
Python
Aasthaengg/IBMdataset
/Python_codes/p03711/s014401965.py
UTF-8
234
3.265625
3
[]
no_license
x, y = (int(i) for i in input().split()) a = (1, 3, 5, 7, 8, 10, 12) b = (4, 6, 9, 11) c = (2,) if x in a and y in a: print("Yes") elif x in b and y in b: print("Yes") elif x == y == 2: print("Yes") else: print("No")
true
363a853403112db2966ec1252d12fc7f3e5d132b
Python
jackmahoney/j2s3
/j2s3/file_service.py
UTF-8
208
2.84375
3
[]
no_license
def get_file_content(path): with open(path, 'r') as file: return file.read().replace('\n', '') def write_file_content(path, content): with open(path, 'w') as file: file.write(content)
true
0d7a29612c94c3aff018646361474a2b36fa2b89
Python
sfnanalytics/rf
/rf-main/src/recency_frequency.py
UTF-8
2,188
3.09375
3
[ "MIT" ]
permissive
# Membership Recency + Frequency # Membership Recency + Frequency import pandas as pd import glob import os import sys path = os.getcwd() # use your path all_files = glob.glob(path + "/*.xlsx") # print(all_files) li = [] for filename in all_files: df = pd.read_excel(filename, #engine='openpyxl', skiprows=2...
true
9c3b868559b63326a28b7857abd7a82397ef9d69
Python
adimanav/sennalabs
/unit_test_sorted_last_name.py
UTF-8
478
2.796875
3
[]
no_license
import unittest from sorted_last_name import SortedLastName class TestSortedLastName(unittest.TestCase): def test_output(self): sln = SortedLastName("names.csv") expected = [ "Frodo Baggins", "Bill Gates", "Steve Jobs", "Michael Jordan", ...
true
a283406c853dd4a97ccd19d6c47b75197b64bb87
Python
hcz28/style_transfer
/test.py
UTF-8
1,742
2.515625
3
[]
no_license
import pdb, transform import tensorflow as tf import numpy as np from argparse import ArgumentParser from utils import exists, list_files, get_img, save_img OUTPUT_PATH = 'results' def build_parser(): parser = ArgumentParser() parser.add_argument('--style', type=str, dest='style', help='style ...
true
92280d8679168badb274ae4554c7345175b037fa
Python
weezybusy/tubee
/tubee/tubee.py
UTF-8
10,639
2.609375
3
[ "MIT" ]
permissive
#!/usr/bin/env python # coding: utf-8 # author: Vitaliy Pisnya from __future__ import unicode_literals from tkinter import ttk, filedialog, messagebox from pathlib import Path import tkinter as tk import youtube_dl class MyLogger(object): def debug(self, msg): pass def warning(self, msg): ...
true
133275ba4aa580093e2aeb160f724b9cf2346df8
Python
Lina9201/WebUIAutomation
/Website/test_case/model/function.py
UTF-8
665
2.53125
3
[]
no_license
# -*- encoding: utf-8 -*- #@Time :2020/3/6 13:59 #@Author :shenfeifei import os from selenium import webdriver import time def insert_img(driver , filename): func_path = os.path.dirname(__file__) base_dir = os.path.dirname(func_path) base_dir = str(base_dir) base_dir = base_dir.replace("\\" , "/"...
true
72f1e8f1c8a59af39452b8c90547479e653a3927
Python
pamela-quiros/Python-From-The-Beginning
/Assigments/practice_1.py
UTF-8
625
5.03125
5
[]
no_license
#1 Create two variables – one with your name and one with your age name = 'Pamela' age = 22 #2 Create a function which prints your data as one string def display_data(): print(name + " " + str(age)) #3 Create a function which prints ANY data (two arguments) as one string def display_random_data(data1, data2): ...
true
6ba2c4539c9badec81fee1e2b4281e57da032238
Python
merzbow7/testbots
/cbr.py
UTF-8
1,738
2.71875
3
[]
no_license
from bs4 import BeautifulSoup from datetime import datetime, timezone, timedelta import aiohttp import asyncio class Currency(object): def __init__(self, session, offset=3): self.session = session self.url = 'https://www.cbr.ru/currency_base/daily/' self.offset = offset self.updat...
true
d9f9c8d3b3614086edc9f45baf7a46509afcfb5a
Python
pannkotsky/sheets
/tests.py
UTF-8
899
3.3125
3
[]
no_license
import unittest import tempfile import sheets class Example(sheets.Row): name = sheets.StringColumn() birthday = sheets.DateColumn(format='%d.%m.%Y') age = sheets.IntegerColumn() class Dialect: has_header_row = True class TestSheets(unittest.TestCase): def test_sheets(self): wi...
true
5128f138e2bf8feda9a839e43118353938caed15
Python
SinglePIXL/CSM10P
/Testing/8-21-19 Lecture/format.py
UTF-8
166
3.546875
4
[ "MIT" ]
permissive
pi =float(input('Enter Pi value:')) radius = float(input('Enter radius value:')) area = pi * radius ** 2 print(format(area, '.2f')) print(format(78135.6394, ',.3f'))
true
fe39897e6a44d853a8134e1a794ae2ec59c081ae
Python
kdshop/pythonPodstawy2019
/zadanie17.py
UTF-8
583
3.71875
4
[]
no_license
def transpose(matrix): temparr = [] for y in range(len(matrix[0])): temprow = [] for x in range(len(matrix)): temprow.append(matrix[x][y]) temparr.append(temprow) return temparr def inputMacierz(kolumn, wierszy): temparr = [] print('Wprowadz macierz') for ...
true
4276a1b4465094a1b62ba1ead8629c30d25e03f0
Python
StevenMDF/github-actions
/test_sample.py
UTF-8
288
3.6875
4
[]
no_license
def capitalize_string(s): if not isinstance(s, str): raise TypeError('Please provide a string') return s.capitalize() def test_capitalize_string(): assert capitalize_string('test') == 'Test' def inc(x): return x + 1 def test_answer(): assert inc(3) == 4
true
a86173deff66ac931a3a1becfc406f21ca4738d9
Python
bsch0111/python1
/v0.02/0.03/20200416siftknn.py
UTF-8
4,791
2.65625
3
[]
no_license
#MATPLOTLIBDATA Warning 무시 import warnings warnings.filterwarnings("ignore", "(?s).*MATPLOTLIBDATA.*", category=UserWarning) import cv2 import cv2.xfeatures2d as cv import numpy from matplotlib import pyplot as plt import os #------------------------------------------SIFT와 KNN을 이용한 이미지 매칭-----------------------------...
true
f515cb47da0931b4e25fe76d48382ee8cefcde2d
Python
Robinysh/asc19-super-resolution
/face_preprocess/face_alignment.py
UTF-8
2,897
2.59375
3
[]
no_license
import sys import glob import dlib import os from progress_bar import ProgressBar from multiprocessing import Pool import os # Load the image using Dlib def init(predictor_path): global detector global sp detector = dlib.get_frontal_face_detector() sp = dlib.shape_predictor(predictor_path) def worker...
true
06442ffa61ca3cdb8aed2b53c4e8ff0c31534a3d
Python
upendra-k14/Trustmodel
/main_h.py
UTF-8
3,954
2.5625
3
[]
no_license
import argparse import numpy as np import networkx as nx import sampleutil import simops import data_helper import trustmodel_h as trustmodel import os.path import pickle class Logger(object): def __init__(self, file_object): self._fobject = file_object def write(self, wstring): print(wstring...
true
5672d2ab81e7962eb60ebfa73510bf9828c5cf85
Python
cathyxl/Project-Consumer-Groups
/消费群组行为预测/motion_state_data_generator.py
UTF-8
4,034
2.71875
3
[]
no_license
from positioning_data_read.file_reader import FileReader from typing import Dict from random import random class _ConfigReader: def __init__(self, config_path: str): self.__motion_probability_dict: Dict[int,Dict[int,float]]={} # 用于存放每个区域中可能发生的各个动作的发生概率,形式为{region_id: {motion_state_id: probability, ... }, ...
true
4420b2362586faa61027413ad2a670810b9f12fe
Python
agermain/Leetcode
/solutions/1741-sort-array-by-increasing-frequency/sort-array-by-increasing-frequency.py
UTF-8
965
3.890625
4
[]
no_license
# Given an array of integers nums, sort the array in increasing order based on the frequency of the values. If multiple values have the same frequency, sort them in decreasing order. # # Return the sorted array. # #   # Example 1: # # # Input: nums = [1,1,2,2,2,3] # Output: [3,1,1,2,2,2] # Explanation: '3' has a freque...
true
157c149e6c272a4d8f01183cce8e751d704e5909
Python
jainamshah95/CodeEval
/string_list_permutations.py
UTF-8
1,809
3.921875
4
[]
no_license
''' Author: Sheldon Logan Description: Credits: Challenge contributed by Max Demian. You are given a number N and a string S. Print all of the possible ways to write a string of length N from the characters in string S, comma delimited in alphabetical order. Input sample: The first argument will be the path to the...
true
2e00440f19e66122b0b3eefc222081506417bd9e
Python
bluerelay/windyquery
/windyquery/builder/insert.py
UTF-8
1,805
2.515625
3
[ "MIT" ]
permissive
from typing import Dict from ._crud_base import CrudBase class Insert(CrudBase): def insert(self, *items: Dict): if len(items) == 0: raise UserWarning('inserts cannot be empty') columns = list(items[0].keys()) if len(columns) == 0: raise UserWarning('insert cannot...
true
4f0900c3420753bb02911b9c856b4edee5f2ef20
Python
pangrr/nlp
/disambiguate/main.py
UTF-8
6,734
3.078125
3
[]
no_license
from __future__ import print_function import yaml class Translator: def __init__ (self, sentFile, ontoFile): # The ontology used by this translator. self.onto = Ontology (ontoFile) # A list of sentences to translate. self.sents = self.loadSent (sentFile) # A dictionary in...
true
d182b3b3d00697e815b94b8b487239ad7d804da0
Python
zarkaltair/Data-Scientist
/Course_on_stepik/Python_on_stepik/python_bases_and_practice/part_1/week_1_tast_4.py
UTF-8
6,613
3.453125
3
[]
no_license
''' Реализуйте программу, которая будет эмулировать работу с пространствами имен. Необходимо реализовать поддержку создания пространств имен и добавление в них переменных. В данной задаче у каждого пространства имен есть уникальный текстовый идентификатор – его имя. Вашей программе на вход подаются следующие запросы:...
true
c962d037b17a12d758e5182bd3777861c1c832fc
Python
pythoncanarias/eoi
/05-libs/docs/external/watchdog/ejemplo02.py
UTF-8
908
2.953125
3
[]
no_license
#!/usr/bin/env python # -*- coding: utf-8 -*- import sys import logging import time from watchdog.observers import Observer from watchdog.events import PatternMatchingEventHandler def on_created(event): print(f"hay un nuevo {event.src_path} fichero python!") def monitoriza_python_files(path): ...
true
04b5b14bea6fa45333dd32fe403eafcb9496e0e0
Python
gsravank/ds-algo
/codechef/feb_contest/temp.py
UTF-8
1,304
3.421875
3
[]
no_license
def my_lcs(x_string, y_string): matrix = [[0 for each_x in range(0, len(y_string) + 1)] for each_y in range(0, len(x_string) + 1)] for each_y in range(len(y_string)): for each_x in range(len(x_string)): prev_x = each_x - 1 prev_y = each_y - 1 if (x_string[prev_x] == y...
true
47ab2ed14b8e58790d1b9aed0f9ff383016b44ca
Python
gitpusha/CS50x
/2018/pset6/similarities/less/helpers.py
UTF-8
1,700
4
4
[]
no_license
# Imported modules and functions from nltk.tokenize import sent_tokenize def lines(a, b): """Return lines in both a and b""" # Split each string a,b into lines a = a.splitlines() b = b.splitlines() # Compute a list of all lines that appear in both a and b lines_matches = set(line for line i...
true
fe4e0c1292f0aa9452b04cb6d3e660f8a8285a57
Python
sneharnair/DFS-1
/Problem-2_0_1_matrix.py
UTF-8
5,397
3.703125
4
[]
no_license
# APPROACH 1 # Time Complexity : O(nm), n: number of rows of the matrix, m: number of columns of the matrix # Space Complexity : O(m*n): space taken up by queue # Did this code successfully run on Leetcode : Yes # Any problem you faced while coding this : None # # # Your code here along with comments explaining your a...
true
afe12b885fd9edf8f48e2cfcd7415b961978a389
Python
DorStern1990/Backend---REST-API-python-
/PointsDict.py
UTF-8
867
3.34375
3
[]
no_license
class Dict2D: def __init__(self): self.dict = dict() self.index = 0 def isDictNotEmpty(self): return len(self.dict) def insert(self, jyson): key = self.index assert (key not in self.dict) x_coor = jyson['x'] # What if not received appropriately...
true
2ec8713c105612ba4b628282997c54babb667578
Python
Morgan1you1da1best/Unit6-1
/longestWord.py
UTF-8
271
3.09375
3
[]
no_license
#Morgan Baughman #12/6/17 #fileDemo.py - how to read a file dictionary = open('engmix.txt') longest = 0 word = '' for words in dictionary: length = len(word) if length > longest: lenght = longest words = word print('The longest word is', word)
true
001a169cc29cfb1876ea602265f95da9cdfd002b
Python
alliance-genome/agr_archive_initial_prototype
/indexer/src/files/pickle_file.py
UTF-8
1,220
2.921875
3
[ "MIT" ]
permissive
import cPickle as pickle class PickleFile: def __init__(self, filename): self.filename = filename def save(self, objects): print "Saving objects into file (" + self.filename + ") ..." with open(self.filename, "wb") as f: pickle.dump(objects, f, pickle.HIGHEST_PROTOCOL) ...
true