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
9cad07eb0a275dcc8ad381b4b9751c0b31a0173b
commoncode/shopifyplus
/apps/shops/management/commands/delete_orders.py
UTF-8
1,029
2.75
3
[]
no_license
from django.core.exceptions import ValidationError, ObjectDoesNotExist from django.core.management.base import BaseCommand, CommandError from ordering.models import Order class Command(BaseCommand): args = '<number-of-orders>' help = 'delete the first \'x\' orders. No args for number of possible order...
true
60d3c4c87081d0d6c7d5b450779ae131059aadff
Prasanna-Kumar-1/Python
/functionexample3.py
UTF-8
426
4.375
4
[]
no_license
# Given two integers, print if the sum of the integers is 20 or # if one of the integers is 20. If not, print message def functionexample3(n1, n2): if n1 + n2 == 20: print("Sum of the numbers is 20") elif n1 == 20: print("First Number is 20") elif n2 == 20: print("Second Number is ...
true
0077fd8765c03d7973b1fda5d13193e5704d8d0b
mattias-lundell/aoc2020
/15.py
UTF-8
1,188
2.875
3
[ "MIT" ]
permissive
def part1(data): seen = {} t0 = 0 d = -1 for t0, d in enumerate(data[0].split(',')): d = int(d) seen[d] = (t0 + 1, t0 + 1) last = d last = d for t in range(t0 + 2, 2020 + 1): (t1, t2) = seen[last] if t1 == t2 and t1 == t - 1: # new (t1, t2) ...
true
44c3709710d79f7c4268158a7b4f237dc55c6d86
charlottelist/Python-Implementation
/Black Jack Game/blackjackgame_withbet.py
UTF-8
14,096
3.875
4
[]
no_license
#Charlotte and Scott #Programming Assignment 5 #COM 110 #Due: November 11, 2014 from playingcard import PlayingCard from deck import Deck from buttonclass import Button from graphics import * from random import * from blackjack import BlackJack def main(): win = GraphWin("Play Black Jack!", 800, 600) #make a...
true
c7a10f88e4955a3d1701adbf47613f433239c63b
little-small-bai/Face_Recognition
/VideoCamera.py
UTF-8
381
2.828125
3
[]
no_license
import cv2 class VideoCamera(object): def __init__(self, url=0): self.video = cv2.VideoCapture(url) self.url = url def __del__(self): self.video.release() def get_frame(self, in_gray_scale=False): _, frame = self.video.read() if in_gray_scale: frame = ...
true
3d77360e4a4b7b20a9fa9f35ba4ba96b6b0b0772
gargvishesh/machine_translation_scripts
/copy_common_files.py
UTF-8
3,629
3.359375
3
[]
no_license
#!/usr/bin/python # -*- coding: utf-8 -*- """ Copy files with same names (but different extensions) from 2 separate folders to a third folder. Useful to filter out the files in one language which have a counterpart in another language - such as in the context of Whispers messages, because not all French whispers might...
true
1fb0694ea1482e83d2a532c2d84b7950b7fb92f5
aliirshayyid/cooperative_platooning
/src/lane_keeping/src/waypoint_maker/src/waypoint_maker.py
UTF-8
1,820
2.609375
3
[]
no_license
#!/usr/bin/env python # Import libraries: import rospy from geometry_msgs.msg import Point32,Pose,Point from sensor_msgs.msg import NavSatFix import csv import math import utm import time import os global previous_x global previous_y global current_x global current_y previous_x = 0 previous_y = 0 current_x = 0 curre...
true
cf6cca4c8ecfb2451fe49e0a85ae5d099dcd5fd5
JeremySilverTongue/Euler
/99.py
UTF-8
807
3.390625
3
[]
no_license
import math # total = 1000 # for x in range(total): # print x, total-x, float(x)/(total-x), x ** (total-x) with open("p099_base_exp.txt") as numbers: line_number = 0 data = [] for row in numbers: line_number += 1 base, exponant = map(int, row.split(",")) data.append((line_number,...
true
0e62d67f8e041556197b33dd514de158104074b9
SecureThemAll/CquenceR
/processing/pre/metadata.py
UTF-8
816
2.875
3
[ "MIT" ]
permissive
import json from datetime import datetime from pathlib import Path class Metadata: def __init__(self, total_records: int): self.total_records = total_records self.discarded = 0 self.processed = 0 def __call__(self, processed, discarded): self.processed += processed sel...
true
1d53a1ebe05e763197913c9572b9f4ea547a1596
jb-neubauer/Anti-virus
/python/linuxconfig.org/lesson5.py
UTF-8
193
3.28125
3
[]
no_license
phrase_string = "This phrase is a string" print(phrase_string[0]) print(phrase_string[4]) print(phrase_string[-1]) print(phrase_string.find("is")) print(phrase_string.replace(" is ", " was "))
true
26aca30e0a730b70c024a2cb31ff68e85b55a0d0
Jeevesh8/relational-pt
/src/cmv_modes/utils.py
UTF-8
7,229
3.03125
3
[ "MIT" ]
permissive
import copy from functools import wraps from typing import List, Optional, Tuple import tensorflow as tf from .configs import config def convert_outputs_to_tensors(dtype): def inner(func): @wraps(func) def tf_func(*args, **kwargs): outputs = func(*args, **kwargs) return tu...
true
c87cac5cbee66b0d512bf10ee815a35f0cbfcc44
feverdreme/wugbot
/cogs/wugs.py
UTF-8
1,006
2.59375
3
[]
no_license
import random import discord from discord.ext import commands from discord_slash import cog_ext from src.decorators import wccmd from src.wugcache import WugCache class Wugs (commands.Cog): def __init__(self, bot) -> None: self.bot = bot # @wccmd @cog_ext.cog_slash(name="twowug", description=...
true
525510ed87f681200ed5c6254b18ab41fa874538
joemehltretter/USC
/CSCI 561/homework3/hw3cs561s2018.py
UTF-8
3,866
3.078125
3
[]
no_license
import DecisionMaking import numpy as np import MDPInfo as mdp def main(): testPath = 'Sample_test_cases/input1.txt' with open(testPath, 'r') as openFile: fileData = openFile.readlines() openFile.close() gridInfo = [line.strip() for line in fileData] count = 0 #Grid info gridNums = gridInfo[count].s...
true
9d47664df50645ab631ff413eaa68d4ff7fe2691
jesuslou/LouEngine-multiframework
/build/scripts/LouEngineProjectGenerator.py
UTF-8
8,830
2.875
3
[]
no_license
import sys import os from stat import S_IWUSR import argparse import subprocess from subprocess import DEVNULL def path_to_os(path): full_path = os.path.abspath(path) parts = full_path.split("/") return os.path.sep.join(parts) def remove_folder_recursively(path_to_folder): path_to_folder_exists = os.path.isdir(pa...
true
32637b546a7b5a6be6e2779f921fd7f72fb98b06
sumukhatv/cpu_util
/cpu_usage.py
UTF-8
1,669
2.984375
3
[]
no_license
import time import string import sys import commands cpu_time_p = 0.0 idle_time_p = 0.0 def get_cpu_usage(): global cpu_time_p global idle_time_p text = commands.getoutput("cat /proc/stat | grep '^cpu '").split() idle_time = float(text[4]) cpu_time = float(text[1])+float(text[2])+float(text[3])+float(text[4])...
true
75bcbf82e4baf605a21a03164fe5134421784dc7
wwqgtxx/Lulu
/lulu/extractors/lizhi.py
UTF-8
2,440
2.828125
3
[ "MIT" ]
permissive
#!/usr/bin/env python import re import json from lulu.common import ( match1, url_info, print_info, get_content, download_urls, ) __all__ = ['lizhi_download'] site_info = '荔枝 lizhi.fm' # radio_id: e.g. 549759 from http://www.lizhi.fm/549759/ # # Returns a list of tuples (audio_id, title, url) ...
true
cf35844e70bce3104eb13b545238a60cfb0537d6
yunhui21/CB_Ai_NLP
/Python_lecture/Day_02_01_Loop.py
UTF-8
4,443
4.03125
4
[]
no_license
# Day_02_01_Loop.py # count = input('count:') # print('Good morning!') # 문제 # count에 0~3 사이의 숫자를 입력 받아서 # 입력 받은 숫자만큼 아침 인사를 해봇니다. # 2가지 종류의 코드를 만들어 봅니다. def not_use(): count = int(input('count:')) # 01 if count == 1: print('Good Morning') elif count == 2: print('Good Morning') ...
true
e631e6eab8622b9ee50c58686d6a0de6353325cb
Enariel/Schoolwork-and-Portfolio
/Programming/Conover_O_DOK_5_Part_2.py
UTF-8
284
3.140625
3
[]
no_license
f = open(r"C:/Python/Unit4DOK.txt") def toList(intString): bits = list newString = "" for ints in intString: if ints != " ": newString += str(ints) bits.append(newString) print(bits) def main(): intString = f.read() toList(intString) if __name__ == "__main__": main()
true
edda091530e1231da51f389a820d451ee35e0dcc
kionkina/listen
/list.py
UTF-8
1,375
3.375
3
[]
no_license
''' Karina Ionkina SoftDev2 pd07 K #15 -- Do You Even List? 2018-04-25 ''' UC_LETTERS = "QWERTYUIOPASDFGHJKLZXCVBNM" LC_LETTERS = UC_LETTERS.lower() NUMBERS = "1234567890" CHARS = ".?!&#,;:-_*" def min_thres(pswd): ''' Returns whether a password meets minimum threshold: It contains a mixture of upper-...
true
4aa991b12e20d6d22af25485da85639dd6327ef5
gbehnam/SimpleLineChart
/AltairFunctionHTML/main.py
UTF-8
2,383
3.453125
3
[]
no_license
import pandas as pd import numpy as np import altair as alt x = np.arange(-2, 3, 1) y = [2*x_val+1 for x_val in x] d = {"x":x, "y":y} df = pd.DataFrame(d) print(df) # chart = alt.Chart(df).mark_line(point=True).encode( # alt.X("x"), # alt.Y("y") # ).properties( # title='A line chart for a simple function...
true
90bb9251b955c1ef44593a0e7fb39a85f34fc6d6
jatintaneja90/Information-Retrieval
/PageRank Algorithm/Task2_q2_partc/directed_graph.py
UTF-8
1,000
2.796875
3
[]
no_license
from file_handler import * class Directed_Graph: dic={} #links=[] #links= file_list(crawled_file) #create a dictionary with crawled links. #dict = dict.fromkeys(links.split[-1],"") #for i in range(0,len(Crawler.crawled)): # links.append(Crawler.crawled.split[-1]) #print dict # prepare ...
true
5249f8bdee62960f6c290720045b7730afb11d8e
sandeepanmukherjee/covid19-kaggle
/information_retrieval.py
UTF-8
5,902
2.921875
3
[]
no_license
from embeddings import Embeddings import numpy as np from nltk import tokenize import pickle import re from statistics import mean class Embedding_retrieval: """ Information Retrieval class using embeddings trained on our dataset. Attributes ------------ """ def __init__(self, path = 'Data/...
true
fc6f880e1bc8a4225dcb495029a66f034f49325e
malcabaut/AprendiendoPython
/100 Curso aulapharos/003 ListasTuplasDiccionarios/Listas.Eliminardplicados.py
UTF-8
433
3.625
4
[ "MIT" ]
permissive
numeros = [1,2,2,3,4,2,2,5,6,7,2] print(numeros) nuevaListaNumeros = [] for elemento in numeros: if elemento not in nuevaListaNumeros: nuevaListaNumeros.append(elemento) print(nuevaListaNumeros) nombres = ['Pedro', 'Juan', 'Ana', 'Maria', 'Eva', 'Ana'] print(nombres) nuevaListaNombres = [] for elemento in ...
true
8880aa72ecc0ec49649d596243fabe9b90bd1e3b
wandersonsiqueira/tabhack
/tabhack/tab/management/commands/epos.py
UTF-8
1,609
2.5625
3
[]
no_license
# -*- coding: utf-8 -*- import random from django.core.management.base import BaseCommand, CommandError from tab import models class Command(BaseCommand): def handle(self, *args, **options): while True: SAMPLE_ITEMS = [ models.Item(name="Gin & Tonic", amount=600, ...
true
5af7852169d362098f87921ae91f417969b0dfa2
sonu98513/python
/square.py
UTF-8
119
2.65625
3
[ "MIT" ]
permissive
from turtle import * forward(150) right(90) forward(150) right(90) forward(150) right(90) forward(150) done()
true
66ddbf5a58e02b1eff1eab58a6486fbb6b4570fe
clockhart7/controller
/rootfs/scheduler/tests/test_ingress.py
UTF-8
2,073
2.671875
3
[ "MIT" ]
permissive
""" Unit tests for the Deis ingress module. Run the tests with './manage.py test ingress' """ from scheduler import KubeHTTPException from scheduler.tests import TestCase class IngressTest(TestCase): """Tests scheduler ingress calls""" def test_create_ingress(self): # Ingress assumes that the namesp...
true
817782f73d152dc6dc00c19d070f65ddb99da2f7
Hallyson34/uPython
/temperatura.py
UTF-8
187
3.796875
4
[]
no_license
#N fazer desse jeito t = float(input()) if t<0: print("Muito frio") if t>=0 and t<14: print("Um pouco frio") if t>=14 and t<23: print("Agradavel") if t>23: print("Calor")
true
91fc61a2db50b4e2aad68f0d3e4eb6ed5e2f0f0c
udaytejam/pypractice
/9_function.py
UTF-8
324
3.96875
4
[]
no_license
def example(): #indented code is inside the function. print('basic function') example() #with parameters def simple_addition(x, y): answer = x + y print('y is:', y) print('answer is', answer) simple_addition(2,3) #you could also call in any order by following way below simple_addition(y=3, x=2...
true
9df3db4fa309d8bb7a3eb1126e262663ea8821f8
hanx11/wxpy
/wxpy/ext/iBot.py
UTF-8
2,464
2.578125
3
[ "MIT" ]
permissive
# -*- coding:utf-8 -*- import collections import hashlib import traceback import requests import logging from random import randint from wxpy import Message logger = logging.getLogger(__name__) class IBot(object): """ * 与 wxpy 深度整合的小i机器人 * 需获取 Key和Secret: http://cloud.xiaoi.com/ """ def __init__(self, app_ke...
true
b20c51c3a522c213457186b33fcf3b24e7881269
williamff11/bachelor-software-engineering
/scraping/request.py
UTF-8
250
2.75
3
[]
no_license
import requests url = "https://www.gta.ufrj.br/grad/07_1/ass-dig/index.html" # Usando requests requisicao = requests.get(url, timeout=5) if requisicao.status_code != 200: requisicao.raise_for_status() else: print("Conectado com sucesso!")
true
d535e14ce78fc28f82718f1c2bd556601194e38b
anoadragon453/nio-template
/tests/test_callbacks.py
UTF-8
1,693
2.671875
3
[ "Apache-2.0" ]
permissive
import unittest from unittest.mock import Mock import nio from my_project_name.callbacks import Callbacks from my_project_name.storage import Storage from tests.utils import make_awaitable, run_coroutine class CallbacksTestCase(unittest.TestCase): def setUp(self) -> None: # Create a Callbacks object an...
true
eee1e7ddbddc2afce0a495c80939bc6cd983bc58
mmason27/DigitalCraftsAssignments
/todo.py
UTF-8
1,134
3.875
4
[]
no_license
tasks = {} while True: choice = input("Press 1 to add task, press 2 to delete tasks, press 3 to view all tasks, press q to quit: ") if choice == "1": title = input("Enter your task: ") priority = input("Enter the priority (high/medium/low): ") tasks[title] = priority # this print...
true
3a98a733fa38123186fa990a9e006f8e7a1ac7e5
praneelrathore/python
/selflocate.py
UTF-8
399
2.6875
3
[]
no_license
from googlemaps import Client import requests import json from geopy.geocoders import Nominatim # Add you API key here mapService = Client('your key here') send_url = 'http://freegeoip.net/json' r = requests.get(send_url) j = json.loads(r.text) lat = j['latitude'] lon = j['longitude'] geolocator = Nominatim() a = str(...
true
2f3321774b0544d9cc3c370a43005806d96746b7
ludl/radialf
/src/molecular/molecules.py
UTF-8
1,030
3.421875
3
[]
no_license
""" the class Molecules provides a basic represenation of a collection of atoms with: - number - kind - positions - bonds - some functions to manipulate them (subsets etc) """ class molecule: elements=[[]] bonds=[] def __init__(self): initialize this object """ the fu...
true
0b04b6d2b1f694770487f6247dafc5f53f3655e0
Minzhe/AppliedDataScienceWithPython_Note
/AppliedTextMiningInPython/assignment2.py
UTF-8
3,311
2.984375
3
[]
no_license
import nltk import pandas as pd import numpy as np import operator import re from nltk.corpus import words # If you would like to work with the raw text you can use 'moby_raw' with open('moby.txt', 'r') as f: moby_raw = f.read() # If you would like to work with the novel in nltk.Text format you can use 'text1...
true
3e5d739d01e8b465346081900b1106d5766a9fdd
dazcona/code-assistant
/src/messages.py
UTF-8
10,002
2.84375
3
[]
no_license
#!/usr/bin/python # IMPORTS import string from utils import get_prediction, get_recommendation, get_work from gist_scrapper import gist GREETING = '''Hi %s %s! I am CoderBot 🤖 Thanks for taking a step towards becoming a better coder. ''' + \ '''Please reply this message with the code provided to you for validation ...
true
05572e57a1261c1f0d2cae56d8d2f400c244ebec
BennoStaub/CodingInterview
/Sort/mergesort.py
UTF-8
1,242
3.78125
4
[]
no_license
class MergeSort(): def __init__(self, input_list): self.list = input_list def sort(self, unsorted_list): print "unsorted list" + str(unsorted_list) if len(unsorted_list) <= 1: return unsorted_list # Find the middle point and devide it middle = len(unso...
true
27228ffb49e69ce2bf11728162ea8a0b80a428c6
kate16/machine-evaluation
/final_project/grade-test
UTF-8
2,363
2.90625
3
[]
no_license
#!/usr/bin/env python # adapted from compute-bleu script by Adam Lopez import optparse import sys import bleu optparser = optparse.OptionParser() optparser.add_option("-r", "--reference", dest="reference", default="data-test/translations.tsv", help="Target language reference sentences") (opts,_) = optparser.parse_ar...
true
6f389dfd93165e6c46eb1a22bf28766abfca2461
ASH1998/SuZu
/chatbot/de.py
UTF-8
1,549
2.578125
3
[ "Apache-2.0" ]
permissive
import praw import time import sqlite3 reddit = praw.Reddit('suzu', user_agent='suzu') # for submission in reddit.subreddit('learnpython').hot(limit=10): # print(submission.title) subreddit = reddit.subreddit('Naruto') # print(subreddit.display_name) # Output: redditdev # print(subreddit.id) # Output: ...
true
7e0a4c6e19c08b2f1f3967bf1936c7d8544945ed
Brychlikov/matura_solutions
/2015c/zad6..py
UTF-8
2,042
3.265625
3
[]
no_license
digit_codes = [] with open("cyfra_kodkreskowy.txt") as digit_code_file: _ = digit_code_file.readline() # wiersz nagłówkowy for line in digit_code_file: line = line.strip() data = line.split("\t") digit_codes.append(data[1]) def control_subsum(num: str) -> (int, int): even = 0 ...
true
3e5ed3f3e661279c531e2d791d150305fa65a26f
Larisf/Work
/Drucker.py
UTF-8
5,176
2.765625
3
[]
no_license
#!/usr/bin/env python # -*- coding: iso-8859-1 -*- import RPi.GPIO as GPIO import time import os import signal #Define Pins INPUT = 21 #Globalen Wert setzen, um bei Änderungen nur eine Zeile ändern zu müssen HIGH...
true
effdb50ef5b26afcc0eae3369c41596b2c533132
Modest-as/gzipstream
/examples/streaming_commoncrawl_from_s3.py
UTF-8
1,119
2.578125
3
[ "MIT" ]
permissive
import boto from boto.s3.key import Key from gzipstream import GzipStreamFile import warc if __name__ == '__main__': # Let's use a random gzipped web archive (WARC) file from the 2014-15 Common Crawl dataset ## Connect to Amazon S3 using anonymous credentials conn = boto.connect_s3(anon=True) pds = conn.get_bu...
true
4424593f8f53bd8568c1d4835b2254de4b68ee38
leanstartpad/PythonPlayground
/dictionaries.py
UTF-8
648
3.515625
4
[]
no_license
myCat = {'size':'fat', 'color':'orange', 'disposition':'angry'} print(myCat['size']) #unordereds bln = 'name' in myCat print(bln) k = list(myCat.keys()) #.items(), .items() print(k) if 'age' not in myCat: myCat['age'] = 1 #makes sure it doesnt' exist first myCat.setdefault('size','small') myCat.setdefault('...
true
1011fe8d8c042d9320daab24dc63231561688ad8
AlexKonkin92/SkillBox_analiz
/Объединение таблиц/Объединение таблиц по некольким столбцам (функция рекурсии).py
UTF-8
1,814
3.5
4
[]
no_license
#!/usr/bin/env python # coding: utf-8 # In[14]: def fillLevels( lineRemainder ): #создаем словарь с большим кол-вом вложенных ключей dict2fill = {} if len( lineRemainder ) > 1: dict2fill[ lineRemainder[0] ] = fillLevels( lineRemainder[1:] ) else: return lineRemainder[0] return dict2fi...
true
c90390701d68a5d161eaaf4b1dff47b6cfedbd7e
yangluo0901/Python_basics_2019
/Stocks/dbmanager.py
UTF-8
1,358
2.765625
3
[]
no_license
import pymysql from dbhelper import DbHelper class DbManager(object): HOST = "localhost" PORT = 3306 USER = "root" PASSWD = "root" DB = "PythonDataBase" def __init__(self): self.__db_helper = DbHelper(self.HOST, self.USER, self.PORT) self.cursor = self.__db_helper.cursor ...
true
7ae2041aadca0874a12c0fc353ec8479a5658ac1
wulalakuaipao/api_auto
/week_7/class_0225/配置文件学习.py
UTF-8
1,195
3.546875
4
[]
no_license
# -*- coding: utf-8 -*- # @Time : 2019/2/25 20:44 # @Author : lemon_huahua # @Email : 204893985@qq.com # @File : 配置文件学习.py # 什么是配置文件 .conf .ini .config .properties .xml # A:怎么写配置文件---[section] option value # B:怎么读取配置文件---configparser 模块里面的ConfigParser类 可以定位 from configparser import ConfigParser # 1.创建对象: cf =...
true
fac12d1ac3e3e0ebe0d8cd813193d67033c14d3c
PariffinAxe/Python_Project
/repositories/playlist_repo.py
UTF-8
1,428
3
3
[]
no_license
from db.run_sql import run_sql from models.playlist import Playlist import repositories.league_type_repo as league_type_repo # save an instance def save(playlist): sql = "INSERT INTO playlists(league_type_id, no_of_teams, round_no, id) VALUES (%s, %s, %s, %s)" values = [playlist.league_type.id, playlist.no_of...
true
b816b1fe700c35eb65e9cb412024f7a8852985ed
tahmid1234/Contest-Solution
/CodeForce/Codeforces Round #686 (Div. 3)/B. Unique Bid Auction.py
UTF-8
389
3.046875
3
[]
no_license
for _ in range(int(input())): n = int(input()) a = list(map(int, input().split())) dict = {} b = [] for i in a: if i in dict: dict[i] = dict[i] + 1 else: dict[i] = 1 index = -1 for key, value in sorted(dict.items()): if (value == 1): ...
true
37e61efa9bcda54882e5b112d01de4f977a3ffcb
quangloan17/hocThayTung
/1.T6/BNTL/b1_chia_nho_dong_tren_file.py
UTF-8
613
3.453125
3
[]
no_license
N = 50 #Số ký tự trong dòng không quá 50 ký tự. f = open('input.txt',encoding='utf-8') lines = f.readlines() f.close() d = [] for line in lines: while len(line) > 0: line = line.strip() pos = len(line) if pos > N: pos = N while pos > 0 and line[pos] != ' ': ...
true
d4748769b291f94b1635293521ab5fa8f7c4aa11
Ankush1099/Fashion_Class
/fashion.py
UTF-8
3,879
2.890625
3
[]
no_license
#IMPORTING THE LIBRARIES import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns #IMPORTING THE DATASET fashion_train_df = pd.read_csv('fashion-mnist_train.csv', sep = ',') fashion_test_df = pd.read_csv('fashion-mnist_test.csv', sep = ',') #VISUALIZING THE DATASET fashi...
true
6803354f9fed3a40441daf0ac73b0926282580f2
selam-weldu/algorithms_data_structures
/miscellenous/data_structure_implementations/linked_list.py
UTF-8
1,870
4.15625
4
[]
no_license
class Node(object): def __init__(self,val): self.val = val self.next = None class SinglyLinkedList(object): def __init__(self): self.head = None self.tail = None self.size = 0 def length(self): return self.size # O(1) def insertAtStart(self,val): ...
true
82281f91887b6b003ab3c1987a7d49cd4b6d0927
HenryRobertRice/advent-of-code-2020
/day-04-1.py
UTF-8
549
2.9375
3
[]
no_license
from sys import stdin def main(): valid = 0 buffer_ = [] for line in stdin: if line != "\n": buffer_.append(line.strip()) else: valid += int(is_valid(buffer_)) buffer_ = [] print(valid) def is_valid(buffer_): required_keys = [ "byr", "i...
true
a53c5c21ca8cea0d5792667ca0160449520046fa
liuruijin17/LICA
/LICA/db/label_scripts/spline_creator.py
UTF-8
11,026
2.640625
3
[ "BSD-3-Clause" ]
permissive
""" Scripts to create the curves between lanes. (Splines here) """ import pdb import cv2 import numpy from db.common import helper_scripts from db.label_scripts import label_file_scripts from db.label_scripts import dataset_constants as dc def _draw_points(image, points, color=(255, 0, 0)): for point in map(tup...
true
ca10c33c5ffb50be273b9078499a004a54963e52
synetkim/attention-lvcsr
/bin/create_lexicon.py
UTF-8
1,907
3.296875
3
[ "MIT" ]
permissive
#!/usr/bin/env python """ Read an LM in ARPA format wnd write the following files: - words.txt containing words and their numerical ids - characters.txt containing characters and their ids - lexicon.txt spelling out each word into characters """ import sys def main(filename): chars = {'<eps>': 0, '<spc>': 1, '#0...
true
7eb00d0b9ef3b0338503c18a423a3b128de4d7fc
seanyx/RivWidthCloudPaper
/RivWidthCloud_Python/rwc_landsat_one_image.py
UTF-8
3,935
2.578125
3
[ "MIT" ]
permissive
if __name__ == '__main__': import ee import numpy as np import getopt import argparse import sys from functions_landsat import id2Img from rwc_landsat import rwGenSR parser = argparse.ArgumentParser(prog = 'rwc_landsat_one_image.py', description = "Calculate river centerline and wi...
true
074e2078db72442fe68e5421ac32ed30a6535a16
TjarkMiener/ctapipe
/ctapipe/image/tests/test_modifications.py
UTF-8
3,134
2.6875
3
[ "BSD-3-Clause" ]
permissive
import numpy as np from ctapipe.image import modifications from ctapipe.instrument import CameraGeometry def test_add_noise(): """ Test that adding noise changes a dummy image in the expected way. """ image = np.array([0, 0, 5, 1, 0, 0]) rng = np.random.default_rng(42) # test different no...
true
f27889e54d19ee8e8ecd9c55189e893f09d9fe18
bhicks11/Python
/Dictionaries/MboxDayCounter.py
UTF-8
382
2.5625
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Tue Sep 7 09:00:29 2021 @author: Blair Hicks """ def MboxDayCounter(sourceFile): fhandle = open(sourceFile) dow = dict() for line in fhandle: if line.find('From ') == -1: continue line = line.split() dow[line[2]] = dow.get(line[2], 0) + ...
true
18d3be98000ed7db729a66df3c3121d0ebe72a29
SuzyWu2014/coding-practice
/python practice/Hashtable/347_top_k_elem.py
UTF-8
1,524
3.671875
4
[]
no_license
# -*- coding: utf-8 -*- # 347. Top K Frequent Elements # Given a non-empty array of integers, return the k most frequent elements. # For example, # Given [1,1,1,2,2,3] and k = 2, return [1,2]. # Note: # You may assume k is always valid, 1 ≤ k ≤ number of unique elements. # Your algorithm's time complexity must be bet...
true
583e809ee7a9966bcb04df00c48aa2e111e5d672
bmiro/carmageddon
/aima/carmageddon_threads.py
UTF-8
3,334
2.96875
3
[]
no_license
# -*- coding: utf-8 -*- from utils import * from search import * from copy import copy from passenger import * from driver import * from state import * import threading myLock = threading.Lock() class successorSwitch(threading.Thread): def __init__(self,state,l): threading.Thread.__init__(self) self.stat...
true
b256f858ec125585b53ff452b86167dff2c3537d
comp-think/comp-think.github.io
/exercises/understanding/advanced/exercise_3.py
UTF-8
1,413
2.953125
3
[ "CC-BY-4.0", "ISC", "CC0-1.0", "LicenseRef-scancode-public-domain" ]
permissive
# -*- coding: utf-8 -*- # Copyright (c) 2019, Silvio Peroni <essepuntato@gmail.com> # # Permission to use, copy, modify, and/or distribute this software for any purpose # with or without fee is hereby granted, provided that the above copyright notice # and this permission notice appear in all copies. # # THE SOFTWARE I...
true
46f39498023a3c90912eebfc0deeaa6f20befccd
bayernmunich/IBM1
/bin/retrieveVMwareCertificate.py
UTF-8
1,547
2.5625
3
[]
no_license
# # Script for retrieving signer certificate from the specified VMWare server # # author: Anil Ambati (aambati@us.ibm.com) # import sys hostName = "" portNumber = "" def getCellName(): cell = AdminConfig.getid('/Cell:/') name = AdminConfig.showAttribute(cell,"name") return name def getAliasName(hostName...
true
e3758d1b6c3d5774d154676f740ad680e2937f58
inwk6312winter2019/week4labsubmissions-navya0511
/lab5/lab5task1.py
UTF-8
193
2.96875
3
[]
no_license
import string file1 = open("58820-0.txt") for line in file1: line = line.strip() line = line.lower() line = line.split() for word in line: print(word.strip(string.punctuation))
true
616c4573fe9ba51a34296ad3233ebdf3bb0156fb
natrix-fork/webcomment
/webcomment.py
UTF-8
3,195
2.703125
3
[]
no_license
#!/usr/bin/env python3 import argparse from argparse import RawTextHelpFormatter import urllib.request import urllib.parse import re import sys parser = argparse.ArgumentParser( epilog='./webcomment.py -m url -t http://www.blog.btbw.pl \n' './webcomment.py -m url -t http://www.blog.btbw.pl -f example...
true
84cf57451e5a95246686b1aef0b4ffb625afd1c6
yamn15/U_Python3
/3-10_Numerical-value.py
UTF-8
2,208
4.40625
4
[]
no_license
print('******************************************************************') #単純な足し算 print(2 + 2) print('**********************************************************************') #単純な引き算 print(5 - 2) print('**********************************************************************') #単純なかけ算 print(5 * 6) print('********...
true
7746289aca013b6677531a2df1be554c208cb920
LosSherl/GAWWN.Pytorch
/GAWWN/tools/tools.py
UTF-8
1,887
2.515625
3
[]
no_license
import torch import torch.nn as nn import numpy as np import display import cv2 from GAWWN.tools.config import cfg def replicate(x, dim, times): x = torch.unsqueeze(x, dim) dims = [1] * len(x.shape) dims[dim] = times x = x.repeat(dims) return x def weights_init(m): classname = m.__class__.__n...
true
f268ef154f82598c8e53f785d1e81ac92e95604b
ikaros274556330/my_code
/python_1000phone/语言基础/day13-文件操作和异常捕获/code/02-文件操作.py
UTF-8
4,458
4.0625
4
[]
no_license
"""__author__=吴佩隆""" # 1.数据的储存 """ 1)数据储存的特点 计算机的内存分为硬盘和运行内存: 硬盘是用来储存文件的,除非手动删除或者硬盘出问题, 否则储存在硬盘中的文件一直存在不会销毁 运行内存是用来存储,程序在运行过程中产生的数据; 当程序运行结束后会自动销毁 如果希望程序中产生的数据在程序运行结束后不销毁, 就需要将数据存到硬盘中(文件中) 2)常用的文件 txt文件、json文件、plist文件、数据库文件等 -- 文本数据 图片文件(png、jpg等)、音频文件(mp3、wav)、视频文件... -- 二进制文件 """ # 2.文件操作 - 操作文件内容 """ 文件的基本步骤: ...
true
8ce848735ec0b00672ad79d4afa18edd08f8fbf2
Dylan7675/US_Name_Stats
/django_app/name_stats/validators.py
UTF-8
179
2.96875
3
[]
no_license
import re def name_validation(val): if not re.match('^[a-zA-Z]+$', val): raise ValueError("Enter a Valid Name(Letters Only)") if __name__ == "__main__": main()
true
0379ff060da7ced732e0e12ca92cadd4c4be57a7
sreekeshiyer/IT-Sem4
/Python Lab/Codes/Exp 7/exception7.py
UTF-8
645
4.125
4
[]
no_license
class FractionalQuotientError(Exception): pass while(1): try: y = 100 s = int(input("Enter a number to divide 100: ")) assert s>=0 z = y/s if (z-int(z)) != 0: raise FractionalQuotientError print("Quotient: ",z) except ValueError as arg: print("Invalid Input!",arg) except Arith...
true
3bdb3d8f4f5d61502313bd8a5cc4033778a859bd
dreamingpug/VLP
/mutant_list_His_combi.py
UTF-8
2,386
2.75
3
[]
no_license
import sys, os, subprocess from itertools import combinations #-----variables------------------------------------ protein = '5uu5_origin_combination_' # pdb file name chain = 'A' # first chain for seq_extractor.py mutation = 'H' # mutated amino acid #candidates = 'candidates.txt' # candidates file with text, do...
true
84a90d92ac8fe986049fdeebbc699059930a3cc9
Dobot-bach/werkendetekening
/LineTransform.py
UTF-8
4,551
3.125
3
[]
no_license
""" @file hough_lines.py @brief This program demonstrates line finding with the Hough transform """ import sys import math import cv2 as cv import numpy as np import matplotlib.pyplot as plt def afstand(c0, c1, c2, maxlen, hoek): if c0[0] == c1[0]: alpha1 = np.pi * np.sign(c1[1] - c0[1]) ...
true
7cba8ac0ee5fb47b3980c7f7319152a8f35644e5
Benkassmi/immo_scrap
/COMPLET/pap_scrap.py
UTF-8
2,350
2.953125
3
[]
no_license
from bs4 import BeautifulSoup import requests import re import math import time def parse_page(url, annonces): #OUVERTURE DE LA PAGE headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36'} session = requests.Session() ...
true
caf689f88772af1511b908c57ae5971af49bba21
ndaley7/BodySlide-Group-Generator
/.venv/Lib/site-packages/pyffi/formats/egm/__init__.py
UTF-8
14,454
2.5625
3
[ "BSD-3-Clause" ]
permissive
""" :mod:`pyffi.formats.egm` --- EGM (.egm) ======================================= An .egm file contains facial shape modifiers, that is, morphs that modify static properties of the face, such as nose size, chin shape, and so on. Implementation -------------- .. autoclass:: EgmFormat :show-inheritance: :membe...
true
85611c7aaaadaf1edb8e4708f785091794e887c4
su-3i025-projet/coop-pathfinding-ortiza
/coop/advanced_players.py
UTF-8
18,001
3.1875
3
[]
no_license
""" .. module:: advanced_players :synopsis: This file contains the advanced cooperative players. .. moduleauthor:: Angelo Ortiz <github.com/angelo-ortiz> """ import random from functools import reduce from .players import CoopPlayer from .strategies import NaiveStrategy from .tools import AStar, Node class Time...
true
24959bf525fb41a7045dfd0012288db4857a6472
fferrin/pytopojson
/tests/test_mesh.py
UTF-8
2,022
2.84375
3
[ "ISC" ]
permissive
import json import math import unittest from pytopojson import ( feature, mesh, stitch, ) class MeshTestCase(unittest.TestCase): def setUp(self): self.feature = feature.Feature() self.mesh = mesh.Mesh() self.stitch = stitch.Stitch() def test_mesh_ignores_null_geometries(s...
true
c638cff29d669f8c9fef870524df8b42c74f1f37
r-tran/data-structures-and-algorithms
/python-dsa/stack/arraystack.py
UTF-8
863
4.28125
4
[]
no_license
""" This module implements a stack ADT using an array """ class ArrayStack(object): """Stack ADT implementation using list""" def __init__(self): self._data = [] def __len__(self): return len(self._data) def pop(self): """Removes and returns the top element from the stack""" ...
true
df191f19065073037f624b4da72df50a6b55fae1
kand/aws_pipeline
/pipeline/util/misc.py
UTF-8
457
3.265625
3
[]
no_license
import os def getDir(file): '''Get the directory that a script is contained in. File should be the __file__ variable.''' return os.path.split(os.path.abspath(file))[0] def getPath(file,relPath): '''Get the path of a file relative to the directory a script is contained in. file should be th...
true
dec6df757467c330b6a7ac3acde005dba3ccb41d
Weaasel/MAB_Offline_Test
/Monitord_TS.py
UTF-8
2,254
2.71875
3
[]
no_license
import numpy as np from MAB import MAB class Monitord_TS(MAB): def __init__(self, itemid, select_num, rng = 4, b = 0.005): super(Monitord_TS,self).__init__(itemid, select_num) self.S = [0 for _ in range(self.K)] #clicks self.N = [0 for _ in range(self.K)] #imps self.rng = rng ...
true
b60bd53387bc7458f78e808a767d6453a67ad271
rarlala/django_instagram
/app/posts/models.py
UTF-8
3,696
2.6875
3
[]
no_license
import re from django.db import models from members.models import User class Post(models.Model): TAG_PATTERN = re.compile(r'#(\w+)') # 인스타그램의 포스트 author = models.ForeignKey(User, on_delete=models.CASCADE) content = models.TextField(blank=True) content_html = models.TextField(blank=True) like_...
true
916082e7d62fb1be5ccaf9eb95b8a6fbc96035df
jaychsu/algorithm
/lintcode/598_zombie_in_matrix.py
UTF-8
1,158
3.203125
3
[]
no_license
class Solution: PEOPLE = 0 ZOMBIE = 1 WALL = 2 """ @param: grid: a 2D integer grid @return: an integer """ def zombie(self, grid): if not grid: return -1 vector = ( ( 0, -1), ( 0, 1), (-1, 0), ( 1, 0), ...
true
81afc153a3cfebff1a7247628d324a5eced170bc
Craigvkm/Python-Training
/import.py
UTF-8
131
3.234375
3
[]
no_license
import math print(math.sqrt(25)) print(dir(math)) #shows all functions available from math from math import sqrt print(sqrt(9))
true
9cdab647605e2b4dad5ab62a9809df6d17143cf2
LyAllence/YOCB
/unittest_yocb/chain_struct/unittest_yocb_node.py
UTF-8
1,083
2.65625
3
[]
no_license
import unittest from yocb.chain_struct.Node import Node from datetime import datetime class NodeTest(unittest.TestCase): @unittest.skip(u'skip') def test_register(self): node = Node.register('1', 'this is local node', str(datetime.now()), 'agent') print(node.__dict__) self.assertEqual...
true
971f769c685db8e6aca2383cd0f32815ee4af88a
hmchen47/Programming
/Python/UoM/book-exercises/median.py
UTF-8
1,227
4.75
5
[]
no_license
''' median The median is the middle number in a sorted sequence of numbers. Finding the median of [7,12,3,1,6] would first consist of sorting the sequence into [1,3,6,7,12] and then locating the middle value, which would be 6. If you are given a sequence with an even number of elements, you must average the two elem...
true
4b6e1ea9e24b00904e604ae7c9893f16953b9ee3
dkimpara/localMaxCut
/poljakTest.py
UTF-8
6,419
2.96875
3
[]
no_license
#testing feasibility of Poljak's (SICOMP 1995) method on finite simple graphs with #maximum degree 4. outputs objective function vector c and matrix m as text file #for input into mathematica LinearProgramming(c,m,b,lu,dom) solver. # #IP formulation: given graph G with n vertices V(G) = {0, 1, ..., n-1} # ...
true
a40e0096f7454d834ed99ac5603dd0ee947f2a48
makkalot/pysse
/client/sse_client.py
UTF-8
970
2.78125
3
[]
no_license
import re import json import requests def _check_evensource(b): re_obj = re.compile(r"^(data: (.*)\n\n).*") buf_s = "".join(b) m = re_obj.match(buf_s) if not m: return b, False b = b[m.end(1):] return b, m.group(2) def iter_content(resp): """ Iterates over a requests.Respon...
true
8beedd869d3621b1bb9d210aeaddd7e69fb71a52
WetBones-sys/advent_of_code
/task_1_day_3.py
UTF-8
615
3.234375
3
[]
no_license
f = open("Day 3\\puzzle.txt", "r") map = f.readlines() position = [0,0] num_of_trees = 0 #print(map) #print(len(map)) #print(len(map[0])) #print(len(map[322])) for line in map: # each line from top to bottom position[0] = position[0] + 2 position[1] = position[1] + 1 # new position if pos...
true
3b3b731e2f58e3cd34a56fff9c27da12ced138b4
Reznnov/Homework_05.11.20
/ft_even_parts_list.py
UTF-8
141
2.640625
3
[]
no_license
def ft_even_parts_list(mass): spisok = [] for i in mass: if i % 2 == 0: spisok.append(i) return spisok
true
db32649573b137020f73aaad356164bb3f14f1d6
pronob1010/Codeforces_Solve
/cf_1445_B.py
UTF-8
112
3.046875
3
[]
no_license
t = int(input()) for i in range(t): a, b, c, d = list(map(int, input().split())) print(max((a+b),(c+d)))
true
a4ed589183ebef2a41541b44d73a9cd5f70dba09
alessandrobalata/pyrlmc
/tests/objects/control_test.py
UTF-8
635
2.59375
3
[ "MIT" ]
permissive
from objects.cont_value import ContValue from objects.control import Control import numpy as np from tests.paramtest import ParametersTest class ControlTest(ParametersTest): def setUp(self): super().setUp() self.control = Control() self.cont_value = ContValue() def test_compute(self)...
true
d9286d47265918e2b2cffd99c465ff3cefb377e3
reshmarn28/Python-Programs
/Training/03.operators.py
UTF-8
388
4.125
4
[]
no_license
#Mathematical Operators a=9 b=2 c = a**b #a^b f = a//b #floor division d = a % b print(c) print(f) print(d) #Comparative Operators '''a==b a!=b or a<>b < > <= >=''' #identity operators '''is is not''' a=10 b=10 print(a is b) a1= a2= [1,2,3] print (a1 is a2) print(id(a1)) #print address of the list print(id(a2)) ...
true
7dd1cea6cb2c0637a9ec34e81e17284abcad4bb7
wwoods/lamegame_cherrypy_slates
/lg_slates/slates.py
UTF-8
20,314
2.75
3
[]
no_license
"""LameGame Productions' Slate implementation for CherryPy. We use cherrypy.request to store some convenient variables as well as data about the session for the current request. Instead of polluting cherrypy.request we use a Session object bound to cherrypy.session to store these variables. Also provides cherrypy.sla...
true
2824030690abc27078bfb25952711b1591d8b2a8
johannalbino/app-feedback-with-flask
/src/db/crud.py
UTF-8
1,221
2.578125
3
[]
no_license
from sqlalchemy.orm import Session from src.models import User, Address import src.db.schemas as schemas def get_user(db: Session, user_id: int): return db.query(User).filter(User.id == user_id).first() def get_user_by_address(db: Session, address: str): return db.query(Address).filter(Address.email_address...
true
a930be2738fb60bc44d1a2719fd6e9ca6f3e8e26
imade-osi/py_tester
/Task2.py
UTF-8
1,946
3.703125
4
[]
no_license
""" Read file into texts and calls. It's ok if you don't understand how to read files """ import csv import os with open('texts.csv', 'r') as f: reader = csv.reader(f) texts = list(reader) with open('calls.csv', 'r') as f: reader = csv.reader(f) calls = list(reader) max_time = None max_num = '' numb...
true
176f83c31dd65f8e4ffaa455daa92b6a581d7e05
KovalchukValentin/VMessanger
/server.py
UTF-8
5,201
2.609375
3
[]
no_license
from flask import Flask, request, abort from datetime import datetime from db_server import DB db = DB() dateformat = db.dateformat app = Flask(__name__) @app.route("/") def hello(): return "Working..." @app.route("/sing_up", methods=['POST']) def sing_up(): user = request.json if not isinstance(user,...
true
520bd06d4d83ec70e6ce8ec3ac5ad970ffa068fb
PopkovS/stepik---auto-tests-course
/3lesson6_step3.py
UTF-8
1,189
2.78125
3
[]
no_license
import time import math import pytest from selenium import webdriver # answer = str(math.log(int(time.time()))) # print(answer) @pytest.fixture(scope="class") def browser(): print("\nstart browser for test..") browser = webdriver.Chrome() yield browser print("\nquit browser..") browser.quit() ...
true
856b1f431aabb09b9670f0de27bc153858e70671
hello-igor/python-selenium-example
/tests/test_change_profile.py
UTF-8
1,054
2.71875
3
[]
no_license
import pytest import allure from src.pages import * from data.users import * @pytest.mark.usefixtures("setup") class TestChangeProfile: @allure.feature('Проверка изменения данных профиля') @allure.story('Изменение данных студента') def test_change_student_profile(self): builder = StudentBuilder()...
true
d636d9c6d96b56b5888008cf71745b4652064e2f
leotang1218/cookiecutter-flask-restful
/{{cookiecutter.project_name}}/generate_deploy_pyc.py
UTF-8
2,081
2.671875
3
[ "MIT" ]
permissive
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ obfuscate.py ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 遍历工程目录,并对目录里的*.py文件进行混淆 :author: leo :copyright: (c) 2020, Tungee :date created: 2020-04-27 11:14 """ import os import shutil import click APP_NAME = '{{cookiecutter.app_name}}' @clic...
true
08684dd5edbbb647347da165040c203aa9def661
haruyasu/PySide
/56_pickerWidget.py
UTF-8
1,575
2.734375
3
[]
no_license
import os, sys from PySide.QtCore import * from PySide.QtGui import * class GUI(QMainWindow): def __init__(self): super(GUI, self).__init__() self.initUI() def initUI(self): self.setWindowTitle("Widget ALL") self.resize(600, 600) wrapper = QWidget() self.setCent...
true
7c632ae611c54a1f448806bb42a23c3c602fcb67
nkartashov/advent_of_code
/2019/5/main.py
UTF-8
3,834
3.109375
3
[]
no_license
import copy from typing import NamedTuple, Any, List from enum import Enum def ass(want, f, *args, **kwargs): got = f(*args, **kwargs) if got != want: print(f"{f.__qualname__} returned {got}, expected {want}") class ArgMode(Enum): POSITION = 0 IMMEDIATE = 1 class OpCode(Enum): SUM = 1 ...
true
d2bbc2207a530ee749d0948ebd7f9605ad27d443
greenhy/ML-DL
/tuple_max.py
UTF-8
3,387
4
4
[]
no_license
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Jul 23 00:19:41 2020 @author: frederic Manipulation of nested tuples of integers Consider a nested tuple T. For example, T = ((10, -8), ((-9, 3, 6, -7), (6,), (2, 7), 6)) You can get an indented display of its associated tree with a call to p...
true
b956b32bdff91cddc61f31ee87f88c17227fea18
kaharkapil/Python-Programs
/GUI_3MENU.py
UTF-8
875
2.796875
3
[]
no_license
from tkinter import* from tkinter import Menu window=Tk() window.title("welcome") def newwindow(): window1=Tk() window1.title("New Registration") window1.geometry('400x200') lb1=Label(window1,text="W_E_L_C_O_M_E ..........!!!!!!!") lb1.grid(column=0,row=2) menu =Menu(window) #tearoff is used foe f...
true