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
187e308ff7c802057bcb290e85cdd9782362e877
itztejas01/jenkins-push
/first.py
UTF-8
163
3.015625
3
[]
no_license
print("hello i am tejas rajendra chaplot") print("I am from Kj somaiya institute of engineering & information technology") print(f"rasied to the power of two i.e. 2**4 = {2**4}")
true
7b08bf2d6b246008b8809fa3ae0a18ba44cc4257
PrimeF/bomberman_rl
/agent_code/auto_bomber/model.py
UTF-8
5,200
2.546875
3
[]
no_license
import json import os import pickle import shutil from pathlib import Path import numpy as np from tensorboardX import SummaryWriter import agent_code.auto_bomber.model_path as model_path from agent_code.auto_bomber.transitions import Transitions def get_model_dir(): try: return os.environ["MODEL_DIR"] ...
true
570e4943722fe138cfac168b67cd7cd7680733a7
nlllllly/ExcelPython
/xl_cell_set_value_format.py
UTF-8
468
2.5625
3
[]
no_license
import openpyxl import datetime wb = openpyxl.load_workbook("売上データ.xlsx") ws = wb["4月"] c1 = ws["A10"] c1.value = datetime.datetime(2020, 4, 5) c1.number_format = "yyyy/m/d" c2 = ws["B10"] c2.value = "株式会社 鈴木商店" c3 = ws["C10"] c3.value = "商品Z" c4 = ws["D10"] c4.value = 3800 c4.number_format = "#,##0" c5 = ws["E10...
true
05fc8cffe70e4d3e14fe1a68724a9e56b80906f9
aditimallavarapu/Obama-Romney-DM
/Version 1.0/Testmodel_romney.py
UTF-8
26,797
2.765625
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Fri Mar 17 22:58:40 2017 @author: Aditi """ import nltk import pickle from Trainmodel import Naive_Bayes from preprocess import Preprocess from CalculateMetrics import CalculateMetrics from sklearn.metrics import classification_report from sklearn.metrics import accuracy_score fr...
true
d6c4e17b5e436d7e5f2506a68dbacddf297eab4e
matthewrmshin/actiontest
/src/hello/__init__.py
UTF-8
261
3.90625
4
[ "MIT" ]
permissive
#!/usr/bin/env python3 """Classic starter program with a greeting.""" def hello(who: str = 'world') -> str: """Return a greeting. :param who: Who to greet. """ if who: return f'Hello {who}! Hi!' else: return f'Hello! Hi!'
true
7c47e65ae64f62407f45fd43e556202ce1326d4f
Sanyastiy/pyfiles
/theory files/hello_cicles2.py
UTF-8
818
3.59375
4
[]
no_license
for i in range(1,11): print(i) x=10 while x>0: print('{}'.format(x)) x-=1 print('night king') night=True while night: print('jesus') break #Ctrl+C to interrupt qs=['whats your name', 'your favorite colour', 'what are you doing'] n=0 while True: print('Input x for exit') a=inp...
true
736f5e60d9a6a3024c8fbe18db8dfa67bf0e06fe
AK-1121/careercup_com
/max_substr_without_dupls.py
UTF-8
950
4.125
4
[]
no_license
# http://www.careercup.com/question?id=5684278553739264 def max_length(string): # Error code in case of empty string: str_len = len(string) if str_len == 0: return -1 max_len = 1 # Take each letter from the first to the last in the string and find # find substring with unique letters:...
true
062a11048d464d49202430842f232a8c6f03b165
Alexrg/Python_challenges
/simplegui/stop_watch.py
UTF-8
2,385
3.828125
4
[]
no_license
import simplegui import time """ Our mini-project for this week will focus on combining text drawing in the canvas with timers to build a simple digital stopwatch that keeps track of the time in tenths of a second. The stopwatch should contain "Start", "Stop" and "Reset" buttons. This code can only be run in https://p...
true
117d28800ef93a96a36ef80d13fef887b65d6fa3
daniel-ufabc/match-classes
/utils/misc.py
UTF-8
157
2.546875
3
[ "MIT" ]
permissive
import base64 import os import sys def log(msg: str): sys.stderr.write(msg + '\n') def get_token(): return base64.b64encode(os.urandom(64))[:80]
true
fce91d362d1f677db234306d7b6ba4e1f97e4917
piwafp0720/RSNA-STR-Pulmonary-Embolism-Detection
/src/make_csv.py
UTF-8
2,222
2.65625
3
[]
no_license
import numpy as np import pandas as pd from pathlib import Path from sklearn.model_selection import StratifiedKFold from tqdm import tqdm tqdm.pandas() def add_z_pos(p_train_df, jpeg_path): train_csv = pd.read_csv(p_train_df) jpeg_path = Path(jpeg_path) path_list_jpg = list(jpeg_path.glob('**/*.jpg')) ...
true
4a61962785a3fba6a2607d9e050e0bb9129b6a1b
wbianchini/selenium-python-search
/tests/driver_test.py
UTF-8
927
3.1875
3
[]
no_license
import unittest from src.driver import Driver class DriverTest(unittest.TestCase): def setUp(self): """Create new Driver instance""" self.sessionWebDriver = Driver() def test_environment_has_properly_driver(self): """Assert Driver class were able to properly initiate webdriver.""" self.assertT...
true
2961d60c1623cd07ce045120f9f09575237cca8b
jessemyers/pluscal
/pluscal/builders/variable.py
UTF-8
1,727
2.796875
3
[ "Apache-2.0" ]
permissive
from dataclasses import dataclass, field from typing import List, Optional, Union from pluscal.ast import DeclType, Expr, VarDecl, VarDecls, Variable from pluscal.builders.base import Builder from pluscal.builders.source import VariableSource, to_variable def quote(s: str) -> str: return f'"{s}"' @dataclass cl...
true
142ef523ee931eca22c0f01d540c754463acec9b
ktaliaferro/VacationFinder
/data_collection/04_stem_timeline_tweets.py
UTF-8
1,530
3.015625
3
[]
no_license
"""This will stem all of the tweets in the timeline_tweets table and put them in the timeline_tweets_stemmed table.""" import pandas as pd from sqlalchemy import create_engine from sqlalchemy_utils import database_exists, create_database import time import preprocessing from mysql_login_info import sql_username, sql_p...
true
a41748804b65bc9116e633aea53567086afdc89b
willyrv/DHNDiff
/MSPSC_model.py
UTF-8
18,774
2.875
3
[ "MIT" ]
permissive
# -*- coding: utf-8 -*- """ Created on Sun Apr 19 23:31:19 2015 @author: willy """ import numpy as np from scipy.integrate import quad import scipy import os import matplotlib.pyplot as plt from scipy.stats import kstest from scipy.stats import chisquare from mpl_toolkits.mplot3d.axes3d import Axes3D class MSPSCMo...
true
f3f1f6a80190188906e8306a672a464241a4dd19
JosephLevinthal/Research-projects
/5 - Notebooks e Data/1 - Análises numéricas/Arquivos David/Atualizados/logDicas-master/data/2019-1/224/users/3960/codes/1734_2502.py
UTF-8
250
3.421875
3
[]
no_license
from math import * n = int(input("Quantidade de termos desejada para a serie: ")) soma = (1/(1*3**0)) pi = sqrt(12) cont = 1 while(cont < n): soma = soma + (-1)**cont * (1/((cont*2+1)*3**cont)) cont = cont + 1 pi = pi * soma print(round(pi,8))
true
4d05480268c6c659f4622078fd8b0817be595deb
twilight-warlock/Python-Scripts
/File organizer/script.py
UTF-8
566
3.546875
4
[]
no_license
import os, shutil path = input("Enter path: ") path = path.replace('\\',"\\\\") print(path) try: for (path, dirs, files) in os.walk(path): print(path, dirs, files) for file in files: extension = file.split(".")[1] print(extension) if(os.path.exists(path+extension...
true
ce5bb2bcd3670bc1b8d1498929e5535aa2e44775
kcroo/LetsGo
/travelplanner/routes.py
UTF-8
25,429
2.65625
3
[]
no_license
############################################################################# # Author: Kirsten Corrao # Date: 10/1/2019 # Class: CS340 # Sources: # https://github.com/knightsamar/CS340_starter_flask_app # Best Flask CRUD app tutorial: https://github.com/CoreyMSchafer/code_snippets/blob/master/Python/Flask_Blog/ # ...
true
7f481f1b3813e39f1fa24f48771841486623dffc
zhulf0804/Coding.Python
/codeforces/1029B_Creating_the_Contest.py
UTF-8
474
2.921875
3
[]
no_license
import math n = int(input()) a = list(map(int, input().split())) dp = [1] * n mmax = 1 def helper(v, l, r, a): while l < r: mid = (l + r) // 2 if a[mid] < v: l = mid + 1 else: r = mid if a[l] >= v: return l else: return -1 for i in range(...
true
a9852e07d179359d07da1d020794c7a1b27cf240
usm-games/usmgames-page-manager
/tests/test_mail.py
UTF-8
1,076
2.625
3
[]
no_license
import os import pytest from flask import Flask from usmgpm.app import init_app username = os.environ.get('TEST_USERNAME') password = os.environ.get('TEST_PASSWORD') admin_username = os.environ.get('TEST_ADMINNAME') admin_password = os.environ.get('TEST_ADMINPASS') @pytest.fixture() def app(): return init_ap...
true
bd3867cbba038a4764b382303434a5d4aa4ae333
BDanielCS/PersonalizedWeatherAssistant
/deployment2/preferences.py
UTF-8
5,384
3.0625
3
[]
no_license
# preferences.py """ Container for clothing preferences. contains all the the user's current preferences and updates based on agreement with the aws ml model. When the model is incorrect, store current conditions in the weather history db with the user's preferred choice of layers. """ import boto3 import math import...
true
286517555ff439f649f9ae7028caf4f31491495b
mhousworth/MicroBlogging
/userService.py
UTF-8
3,873
2.84375
3
[]
no_license
#!/usr/bin/env python3 # Microblogging - User Service API import bottle from bottle import post, get, request, delete, HTTPResponse import sqlite3 import json # Setup app app = bottle.default_app() @post('/users/') def createUser(): '''Adds a user account to the users database''' headers = {'Content-type'...
true
729e1769db88fea33959b68840066d2ff2a37d4d
SudarshanSelvamani/python_exercise
/list_overlap.py
UTF-8
354
3.703125
4
[]
no_license
def list_overlap(list_1, list_2): unique_number_list_1 = list(set(list_1)) unique_number_list_2 = list(set(list_2)) common_numbers= [] for number in unique_number_list_1: if number in unique_number_list_2: common_numbers.append(number) return common_numbers print(list_overl...
true
925abf66a3be236854f39238d71acef2877436ef
rotempre/TravellingProj
/VIA Proj/viaMain3.py
UTF-8
7,792
2.9375
3
[]
no_license
import sys import json import networkx as nx import matplotlib.pyplot as plt import itertools class RideData: def __init__(self, data): self.grid_size_x = data["gridSizeX"] self.grid_size_y = data["gridSizeY"] self.a = data["a"] self.b = data["b"] self.van_vertex = data["va...
true
5d0a8bcc5358018493cbc6fd7fef9471d615e0ec
anupahuje/CMU-Programming-Excercise
/2. Data Structure Implementation (Mysterious Safeguards)/script.py
UTF-8
2,727
2.78125
3
[]
no_license
#!/usr/bin/env python2 # -*- coding: utf-8 -*- """ Created on Fri Aug 16 20:43:15 2018 @author: Anup """ from intervaltree import Interval, IntervalTree import copy import pandas as pd def get_coverage(t): t_copy = copy.deepcopy(t) t_copy.merge_overlaps() coverage = 0 for item in t_copy.items(): ...
true
3dc01cfb7498aac915236951320f2b3e4ee0a6d5
phanisai22/Python
/100 Days of Code/Day 4/rock_paper_scissors.py
UTF-8
756
3.765625
4
[]
no_license
import random hands = [ """ _______ ---' ____) (_____) (_____) (____) ---.__(___) """, ''' _______ ---' ____)____ ______) _______) _______) ---.__________) ''', ''' _______ ---' ____)____ ______) __________) ...
true
fc3227d7a017b5b60200db59f204cf61e471ce16
focusdroid-python/python-demo
/02-ClassMate.py
UTF-8
667
3.421875
3
[]
no_license
from collections import Iterable from collections import Iterator import time class ClassMate(object): def __init__(self): self.names = list() self.current_num = 0 def add(self, name): self.names.append(name) def __iter__(self): return self def __next__(self): if self.current_num < len(self.names): ...
true
45ffb441c37b78b85a54a57a9fcd0bbf17f8e516
podhmo/individual-sandbox
/daily/20200414/codes/output/code054.py
UTF-8
269
2.78125
3
[]
no_license
import pygal chart = pygal.Line() chart.x_labels = [ 'This is the first point !', 'This is the second point !', 'This is the third point !', 'This is the fourth point !'] chart.add('line', [0, .0002, .0005, .00035]) print(chart.render(is_unicode=True))
true
81c3a48fb3ebe3bfc5843fc4b9a0584023fa3463
awesome01010/aster
/aster/data/data_aug.py
UTF-8
1,684
2.765625
3
[]
no_license
import numpy as np import cv2 def gamma_transform(img, gamma): gamma_table = [np.power(x/255.0, gamma) * 255.0 for x in range(256)] gamma_table = np.round(np.array(gamma_table)).astype(np.uint8) return cv2.LUT(img, gamma_table) def random_gamma_transform(img, gamma_vari): log_gamma_vari = np.log(gamma_vari) alph...
true
2c9e0d88ed8ed4752099c63dc4791a7599d78a50
Mainframed69/lotto-randomizer
/Melotto/Final.py
UTF-8
662
3.375
3
[ "MIT" ]
permissive
#More efficient code and exports all permutations to ".csv" & "txt" via numpy array. import numpy as np from itertools import combinations def rSubset(arr, r): # return list of all subsets of length r # to deal with duplicate subsets use # set(list(combinations(arr, r))) return list(combinations(arr,...
true
39589b6050f078f1eaf83f10ffb319b02bb5e338
aman-kashyap/Python-practice
/loop/refrence.py
UTF-8
147
3.171875
3
[]
no_license
a=12 b=a a=15 print(a,b) x=['a','b','c'] y=x x.append('d') print(x) print(y) z=x.copy() z.append('E') x.append('p') print(x) print(y) print(z)
true
dbe744e8c22863962c1e079642958f6b544258ce
XiaoboHe/turq
/turq/util/logging.py
UTF-8
434
2.640625
3
[ "ISC" ]
permissive
# pylint: disable=invalid-name import collections import logging import threading counts = collections.defaultdict(int) lock = threading.Lock() def getNextLogger(prefix): # This is an easy way to distinguish log messages from different objects, # and to selectively enable debug logging only for some of them...
true
3ece9eb887ece8371ef27a4827a6bf9947e28b45
Robbin003/stock
/k-m.py
UTF-8
7,387
2.9375
3
[]
no_license
#!/usr/bin/env python3 ############# # Least Action Principle # Use the least acion principle to market # Author: Robbin He # Date: 2019-07-11 # Licence: Pravicy ############ # 最小作用量原则是一个普遍的物理性原则,将市场看成物理现象的一部分, # 市场的行为应该也满足这个基本的原则。最小作用量原则和对称性,守恒 # 定律紧密联系,当我们寻找市场中的作用量的具体形式时,无疑可以参考物理 ...
true
0a83308da93e5026713ba03e61f721b3fcf54aa4
serkanh/flask-slack-app-template
/app/auth.py
UTF-8
1,208
3
3
[]
no_license
import os from flask import current_app as app from slackeventsapi.server import SlackServer class SlackAuth(SlackServer): """ Uses Slack Events API Adapter SlackServer class to verify requests are coming from slack. Since we're running our own flask instance we just want to use the specific function ...
true
9739cb92a30dbd0725d0461d36edf377c581ee60
ryota548/CompetitivePG
/atcoder/arc_004_a.py
UTF-8
310
3.5625
4
[]
no_license
size = int(input()) dots = [] for i in range(size): dot = [int(x) for x in input().split()] dots.append(dot) answer = 0 for i in range(size-1): for j in range(i+1, size): tmp = ((dots[j][0] - dots[i][0])**2 + (dots[j][1] - dots[i][1])**2)**0.5 if answer < tmp: answer = tmp print(answer)
true
3fbb3299c353f90ea3496341f4973e56226787b7
GSantos23/Crash_Course
/Chapter10/Exercises/ex10_10.py
UTF-8
1,441
4.34375
4
[]
no_license
# Exercise 10.10 ''' Common Words: Visit Project Gutenberg (http://gutenberg.org/ ) and find a few texts you’d like to analyze. Download the text files for these works, or copy the raw text from your browser into a text file on your computer. You can use the count() method to find out how many times a word or phrase ap...
true
52fcaceb7dc4dfc8fbd7a711ab9871c4848011a6
gimquokka/problem-solving
/CodeUp/Hard_to_once(한번에 맞추기 어려운 문제)/cu_2101.py
UTF-8
306
3.3125
3
[]
no_license
a = int(input()) # a^2 + b^2 = c^2 => a*a = (c-b)(c+b) # a < b < c < a+b cont = 0 # let q = c - b, w = c + b for q in range(1, a): w, remainder = divmod(a**2,q) if remainder == 0: c = (q+w)/2 b = (w-q)/2 if (c == int(c)) and (b == int(b)) and a < b : # print(b, c) cont += 1 print(cont)
true
7fc4bc1252502540a9b43ca628a8a67f39a06c0c
stdg11/text-encryption
/run.py
UTF-8
2,290
3.625
4
[]
no_license
from random import randint def mainMenu(): print("1. Encrypt file\n2. Decrypt file\n3. Extended encrypt\n4. exit") userchoice = input("Select an option: ") if userchoice == "1": plaintext = readFile() print("Encrypted text:", encrypt(plaintext)) elif userchoice == "2": ciphertex...
true
d0fce5dc5d0e9069fcefe5c6e5d6343c15f9a370
R151865/cloud_9_files
/rest/rest_submissions/rest_assignment_001/assignment_001/utils.py
UTF-8
7,593
3.0625
3
[]
no_license
import uuid from datetime import datetime, date from rest_framework import serializers from .constants import EmployeeTypes class Employee(object): def __init__(self, employee_id, age, date_of_joining, last_logged_in, salary_in_inr, employee_type, first_name, is_retired, is_be...
true
0498525d3066e8959848d3cfc45d33e5ea124a6f
brunv/pyCrashCourse
/04 - Trabalhando com listas/tuplas.py
UTF-8
407
4.1875
4
[]
no_license
# # Diferente das listas, as tuplas contém dados imutáveis. # dimensions = (200,50) print(dimensions[0]) # 200 print(dimensions[1]) # 50 # dimensions[0] = 150 Throws an error # # Sobrescrevendo uma tupla # print("Original dimensions: ") for dimension in dimensions: print(dimension) dimensions = (400, ...
true
0a19fe75bc0be767ac02b25e0a5dea202588e76d
benreynwar/wiktionary-parser
/wiktionary_parser/examples/simple_english.py
UTF-8
701
3.25
3
[ "MIT" ]
permissive
# -*- coding: utf-8 -*- """ This example extracts a number of words from the simple.wiktionary xml file. """ from wiktionary_parser.xml_parser import XMLPageParser from wiktionary_parser.languages.simple.page import simplePage xml_file = open('../../wiktionary_data/simplewiktionary-20110514-pages-articles.xml') xml_p...
true
fae1d7b04783bb21c30c1ff65a4cda9716a1fe36
theboocock/genomic_operations
/genomic_operations/sniff/sniffer.py
UTF-8
4,294
3.015625
3
[ "MIT" ]
permissive
import logging from genomic_operations.dts.single_pos import PSEQPos, GeminiPos, TwoColPos class Sniff(object): """ Creates and ordered list of functions that are used to try and sniff the datatype from arbitrary files. """ def __init__(self): self.sniffer_list = [] de...
true
a7792a2eab74f2753ac0a6d1c84de304ba105eb6
cptn3m0grv/Steg-E
/pyModules/Intro/about.py
UTF-8
3,905
3.1875
3
[]
no_license
import random import cowsay import colorama from colorama import Fore, Style colorama.init(autoreset=True) def about_page(): about_banner = [cowsay.cheese, cowsay.daemon, cowsay.dragon, cowsay.kitty, cowsay.meow, cowsay.milk, cowsay.pig, cowsay.stegosaurus, cowsay.turtle, cowsay.trex, 'b'] a = random.choice(...
true
dcfe003a718ad38035108b9a66108605492e73ec
JzsCodegame/MachineLearning
/06.Decision Tree Reggression/Decision_Tree.py
UTF-8
1,141
3.4375
3
[]
no_license
import numpy as np import matplotlib.pyplot as plt import pandas as pd from sklearn.compose import ColumnTransformer # import Dataset dataset = pd.read_csv('Position_Salaries.csv') X = dataset.iloc[:, 1:2].values y = dataset.iloc[:, 2].values # Fitting the non Decision Tree to Data set from sklearn.tree import Deci...
true
a829298e6a3b96fafab1aa4e87a26e5836b51314
MariaTasova/NEFY-Python
/ass5.py
UTF-8
260
3.640625
4
[]
no_license
def is_self_dividing(n): list = str(n) count = 0 for i in range(0, len(list)): if n % int(list[i]) == 0: count += 1 if count == len(list): return True else: return False print(is_self_dividing(315))
true
655947cd5f2b13495cd2454866ae048c1251c4bd
huang-jingwei/Coding-Interview-Guide
/chap9/30.在两个长度相等的排序数组中找到中位数/30_findMedianSortedArrays.py
UTF-8
1,226
3.5625
4
[]
no_license
class Solution: def findMedianSortedArrays(self, nums1: List[int], nums2: List[int]) -> float: array = [] index1 = 0 index2 = 0 while index1 < len(nums1) and index2 < len(nums2): if nums1[index1] <= nums2[index2]: array.append(nums1[index1]) ...
true
5650bb914ea7c9a34b11e4accd3d8e52a8600576
Prince-linux/python_for_everyone
/test/pet.py
UTF-8
354
4
4
[]
no_license
# this is a program to test the composition of a class in python class Dog(): def __init__(self, name, breed, owner): self.name = name self.breed = breed self.owner = owner class Person(): def __init__(self, name): self.name = name dre = Person("Andre Boamah") dog = Dog("Eme...
true
c210bf00912f74cb5bb41b0d5a8b47e46b581a0f
DHaythem/Competitive-Programming-Solutions
/Codeforces/700/A. Two Rival Students.py
UTF-8
150
2.734375
3
[]
no_license
#https://codeforces.com/contest/1257/problem/A t=int(input()) for _ in range(t): n,x,a,b=map(int,input().split()) print(min(n-1,abs(a-b)+x))
true
1eee5f375dc58160c43e99872df83357dcfa4f0e
4dsec/Netlyse
/Geolocation/geolocator.py
UTF-8
3,820
3.046875
3
[]
no_license
import sys import geoip2.database import dpkt import socket import simplekml import os def locator(pcap_obj,kml_file): """function to display all unique IPs and the packet count in the PCAP file and save it to JSON""" ip_list = [] for ts, buf in pcap_obj: eth = dpkt.ethernet.Ethernet(b...
true
a8095f0220624c3739018864c8e1cd6817107b54
fluffyowl/past-submissions
/yukicoder/yuki_0744.py
UTF-8
45
2.640625
3
[]
no_license
S = '285714' N = input() - 1 print S[N % 6]
true
f378ed7d653ba0d370a70209da1524e738084d30
tonechas/layout2graph
/layout2graph/utils.py
UTF-8
5,392
3.125
3
[ "MIT" ]
permissive
import matplotlib.pyplot as plt import matplotlib.colors as mcolors import msvcrt import networkx as nx import os ##################### # Utility functions # ##################### def save_figure(folder, filename, fig): """Save figure to disk""" fn = os.path.join(folder, filename) fig.savefig(fn, dpi=fig...
true
333ce59104e38af8591e799acaebd9b7298369ba
phaeton2040/python-algorithms
/HW-Lesson3/task_2.py
UTF-8
777
3.96875
4
[]
no_license
# Во втором массиве сохранить индексы четных элементов первого массива. Например, если дан массив со значениями 8, 3, # 15, 6, 4, 2, то во второй массив надо заполнить значениями 1, 4, 5, 6 (или 0, 3, 4, 5 – если индексация начинается # с нуля), т.к. именно в этих позициях первого массива стоят четные числа. import ran...
true
5a77a2388210f09bf5547c8f50515932a0d85a41
ibmiti/Python-Multiprocessing
/start.py
UTF-8
1,661
3.265625
3
[]
no_license
import multiprocessing import time start = time.perf_counter() def power_nap(): print('Sleeping for : 1 second...') time.sleep(1.5) print('...yawn....') print('...Awake') def snore(): print("snoring : zzzzzzzzzz") def alarm(): print("alarm : brrrrrrrrrr") print("alarm : brrrrrrrrrrnngggg...
true
aa7bf4df7bfc3708d4600f72f2800e095aea68e5
VachaArraniry/python_portfolio
/contacts.py
UTF-8
465
3.0625
3
[]
no_license
import sqlite3 connection = sqlite3.connect('contactdb.db') insert_contact = "INSERT INTO contacts (name, phone, address) VALUES ('{0}',{1},'{2}')" contact_data_name = (input("Name : ")) contact_data_phone = (input("Phone : ")) contact_data_address = (input("Address : ")) cursor = connection.cursor() curso...
true
b3ab4cc522def8b807de22a31e5938de1cf891e4
jal278/presidential_followers
/plot.py
UTF-8
868
2.671875
3
[ "Apache-2.0" ]
permissive
import matplotlib matplotlib.use('cairo') import seaborn as sns import matplotlib.pyplot as plt sns.set(style="whitegrid") import pandas import pdb # Initialize the matplotlib figure f, ax = plt.subplots(figsize=(5, 5)) data =pandas.read_csv("data.csv") # Load the example car crash dataset # Plot the total crashes...
true
e7ee2ab123ecb0899f6057fdfa01a0ef13002d69
Aasthaengg/IBMdataset
/Python_codes/p03026/s322729058.py
UTF-8
825
2.859375
3
[]
no_license
#!/usr/bin/env python3 import sys, math, itertools, collections, bisect input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8') inf = float('inf') ;mod = 10**9+7 mans = inf ;ans = 0 ;count = 0 ;pro = 1 n = int(input()) G = [[] for i in range(n)] F = [-1]*n AB = [] for i in range(n-1): a,b = map(int,inpu...
true
29bb3df4c0588d2c9343616d6b4e7ed55c122c48
wangyendt/LeetCode
/Biweekly Contests/0-50/biweek 21/1372. Longest ZigZag Path in a Binary Tree/Longest ZigZag Path in a Binary Tree.py
UTF-8
554
2.953125
3
[]
no_license
#!/usr/bin/env python # _*_coding:utf-8_*_ """ @Time : 2020/3/8 19:44 @Author: wang121ye @File: Longest ZigZag Path in a Binary Tree.py @Software: PyCharm """ import sys sys.path.append('..') from Tools.BinaryTree import * class Solution: def longestZigZag(self, root: TreeNode) -> int: def dfs(root...
true
c292241e67fdd74d4fe3e20e11b927ec9b6f5729
SALASJA/HiveMindDev
/test_3_USART/byte_grouping/byte_grouping.py
UTF-8
1,025
3.046875
3
[]
no_license
import serial import glob def main(): """ under my mac /dev/tty.wchusbserial1410 is the port * <--- uses of regular expressions in cases of more than one connection """ ports = glob.glob("/dev/tty.wchusbserial*") + glob.glob("/dev/tty.usbserial*") + glob.glob("COM3") + glob.glob("COM4") BAUDRATE = 9600 choice ...
true
080960596d0f21760caa1440b60230726cc58eca
Mereder/14_image_style_swap
/train.py
UTF-8
2,527
2.765625
3
[]
no_license
# coding:utf-8 from argparse import ArgumentParser from model import WTC_Model # 定义一系列命令行参数 parser = ArgumentParser() # 定义 --target_layer 待训练目标层 parser.add_argument('--target_layer', type=str, dest='target_layer', help='target_layer(such as relu5)', metavar='target_lay...
true
38e79f49e1e79eb777e62d01591c6d748a2e6134
FloraHF/2DSI
/2DSI/NetworkAC.py
UTF-8
1,128
2.578125
3
[]
no_license
import tensorflow as tf from Actor import Actor from Critic import Critic from Config import Config import math class NetworkAC(object): """docstring for NetworkAC.""" def __init__(self): tf.reset_default_graph() self.sess = tf.Session() self.actor = Actor(self.sess, \ ...
true
c6447a8e599322a87bd4f0d474667f37f67a75ff
hakonbyh/TDT4136_Intro_AI
/Assignment2/AStar.py
UTF-8
7,707
4.125
4
[]
no_license
""" Contains the standard A* algorithm implementation. AStar takes the following input: start_state: The state of the first node. func_heuristic(state): Function for estimating the remainding cost for a path from the given state to the goal. func_adjacent_states(state): Func...
true
542ae0954c10df1d196b31ca00afe55003217eb7
KingDededestroyed/Portfolio-Term-2
/Midterm Seth Jones.py
UTF-8
3,401
3.578125
4
[]
no_license
#Midterm Exam 2019 #Seth Jones -- 12/02/2019 import sys from time import sleep divideLines = "-----------------------------------------------" def open_file(file_name,mode): """Opens file in the given mode""" try: the_file = open(file_name,mode) return the_file except IOErr...
true
0f9055d3e758336227dbea8985ec5f48f736a51a
Aasthaengg/IBMdataset
/Python_codes/p02421/s175470857.py
UTF-8
168
3.03125
3
[]
no_license
s=[0,0] for i in range(int(input())): r=input().split() if r[0]<r[1]: s[1]+=3 elif r[1]<r[0]: s[0]+=3 else: s[0]+=1 s[1]+=1 print(str(s[0])+' '+str(s[1]))
true
e78278e6d7427595aa4c243ce9b4ccd30118499c
houyimeng/workspace
/ELM/lineMNIST.py
UTF-8
2,034
2.78125
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Wed Mar 30 12:09:36 2016 @author: houyimeng """ # create a row/column of digits from numpy import zeros,reshape,array,random from MNISTDataset import MNISTDataset from normalize import normalize def lineMNIST(numDigits, edgesize = 0, DigitLane = 10, Lane = 'h', norm_flag = 0):...
true
4b32c5ed6b119f49643af45dd387a55cb2610829
ferpinedax1/srperusatGAN-RGB
/perusat.py
UTF-8
3,761
2.859375
3
[]
no_license
#Dataset perusat imagenes 512x512 # normalizacion perusat_v3 import glob import numpy as np import torch from torch.utils.data import Dataset #import tifffile import cv2 import numpy from torchvision import transforms def my_transform_go(x): imx = x.transpose((2, 0, 1)) return imx def my_transform_back(x): ...
true
a8cc6de24d1c5d29ac2dc055e3ae634017c62196
zhengw060024/pythoncookbookpractice
/excookbook2.5.1.py
UTF-8
977
4.0625
4
[]
no_license
#查找和替换文本 #对于简单的文本使用str.replace()即可比如 text = 'yeah,but no ,but yeah, but no, but yeah' print(text.replace('yeah','yep')) #针对更加复杂的模式,可以使用re模块中的sub()函数/方法。假设我们想把日期从 #"11/27/2012"改写成"2012-11-27" text = 'Today is 11/27/2012.Python starts 3/13/2013.' import re print(re.sub(r'(\d+)/(\d+)/(\d+)',r'\3-\1-\2',text)) datepat = r...
true
81d1220acbeaac10406bcfcfc747fef287784979
SilverYar/TransportDataMiner
/SentimentAnalysis_2/road_spider.py
UTF-8
1,355
2.5625
3
[]
no_license
import scrapy class RoadSpider(scrapy.Spider): name = 'road_spider' start_urls = [ 'http://autostrada.info/ru/reviews/page/1/', ] def parse(self, response): for review in response.css('div.col-md-12.reviewBlock'): tmp = review.css('p.comment.break-word::text').extract_first...
true
15909710ed072087108345dbfc1804487814c4b4
skysign/WSAPT
/leetcode.com 309. Best Time to Buy and Sell Stock with Cooldown/main.py
UTF-8
888
3.125
3
[]
no_license
from typing import List class Solution: def maxProfit(self, prices: List[int]) -> int: # dp[i] 날짜에 최대 이익 dp = [0 for _ in range(len(prices))] # 주식을 우선 buy해야 sell 할 수 있으므로, # 가장 빠른 날짜인 0에 주식을 샀다고 가정하고, # 주식을 가짱 빨리 팔수 있는 1일 부터 시작함 for idx_sell in range(1, len(prices)...
true
443912b2a3e2df386a254182934544d89133a45b
CAMeL-Lab/arafix_ocr
/code/predict_dalma.py
UTF-8
8,561
2.578125
3
[ "Apache-2.0" ]
permissive
# Copyright 2021 New York University Abu Dhabi # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # http://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or agreed ...
true
3e12091f1bf405eecb94faa05c170eb344b6c7eb
kumarnitishbehera/python_class
/Max_of_aand_b.py
UTF-8
183
4.03125
4
[]
no_license
a=int(input("Enter number a :")) b=int(input("Enter number b :")) if (a>b): print("The largest number is a:{}",format(a)) else: print("The largest number is b: {}".format(b))
true
ebe4cbf10266d97a4d730440ed16eec0b15932cb
fiona22/leetcode
/sortTest/insertSort.py
UTF-8
328
3.84375
4
[]
no_license
def insertSort(arr): length = len(arr) for i in range(1, length): x = arr[i] j = i-1 while(j>=0 and x<arr[j]): arr[j+1] = arr[j] j = j-1 arr[j+1] = x def printArr(arr): for item in arr: print(item) arr = [4,7,8,9,0,1] insertSort(arr) printAr...
true
0960794003ec42822bceb2e88b1f61b94f6da3e9
skyuniv/A-Kata-A-Day
/Python/Vowel_Count.py
UTF-8
411
4.125
4
[]
no_license
# Vowel Count # Level: 7kyu ''' Problem Description: Return the number (count) of vowels in the given string. We will consider a, e, i, o, and u as vowels for this Kata. ''' def getCount(inputStr): vowels = ['a', 'e', 'i', 'o', 'u'] num_vowels = 0 # your code here for i in inputStr: if i in v...
true
fef534175d9b32c8e53d377c47ac33e8d1dcda13
sunan0519/ImplicitMatrixFactorization
/main.py
UTF-8
3,218
2.796875
3
[ "MIT" ]
permissive
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sat May 5 22:05:14 2018 @author: sunan """ import scipy.sparse as sp import numpy as np from implicit_mf import * import matplotlib.pyplot as plt sample_matrix = sp.load_npz('sample_matrix.npz') sample_array = sample_matrix.toarray() #Take a look at the...
true
cda48683c6385f299ea96fffc111230ad268a715
x2mercy/Leetcode_Solution
/sameTree/solution1(timeout).py
UTF-8
901
3.21875
3
[]
no_license
# this solution is Time Limit Exceeded # Definition for a binary tree node. # class TreeNode(object): # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution(object): def isSameTree(self, p, q): """ :type p: TreeNode :type q:...
true
f63e1148ec763657958d6cf009a8640bde23462c
dr-dos-ok/Code_Jam_Webscraper
/solutions_python/Problem_135/3012.py
UTF-8
2,133
3.015625
3
[]
no_license
#! /usr/bin/python import sys, getopt def get_params(*defaults): argv = sys.argv[1:] input_problem, input_set, lines_per_case = defaults try: opts, args = getopt.getopt(argv,"p:s:l:",["problem=", "set=","lines="]) except getopt.GetoptError: print sys.argv[0], '-p <problem letter> -s <i...
true
fe826877726850f85231c65dcec7886c1ea239dc
ujjwal123123/Euler
/Python/25.py
UTF-8
953
4.53125
5
[]
no_license
# 1000-digit Fibonacci number (Problem 25) # ======================================== # region Description # The Fibonacci sequence is defined by the recurrence relation: # Fn = Fn−1 + Fn−2, where F1 = 1 and F2 = 1. # Hence the first 12 terms will be: # F1 = 1 # F2 = 1 # F3 = 2 # F4 = 3 # F5...
true
67f835428a59e05b4c523ef0c1e8e515a679917b
vishwakaria/code-summarization
/data/python/original data/AST_unprocessed_train_test_split.py
UTF-8
1,622
2.578125
3
[]
no_license
def load_doc(filename): f = open(filename, encoding="utf8") lines = f.readlines() return lines directory = 'D:/Books/Spring 2019/CS230/Project/code-summarization/data/python/original data/' ast_list = load_doc(directory + "parallel_AST") print(ast_list[0:10]) decl_list = load_doc(directory ...
true
93670a15f5eed7d3393d77cf56fed00eb0c54c69
KaramAbuMokh/Data-Structures
/hash/chained hash.py
UTF-8
1,159
3.515625
4
[]
no_license
class hash: def __init__(self): self.MAX=10 self.arr=[[] for i in range(self.MAX)] def get_hash(self,key): h=0 for c in key: h+=ord(c) return h%self.MAX def __setitem__(self, key, value): h=self.get_hash(key) for i,element in enumerate(...
true
6f671aaca74f8dd2be1c228e5a02a638444e849b
avcaliani/mr-owlf
/mr-owlf-dss/mr_owlf_dss/repository/post.py
UTF-8
1,009
2.59375
3
[ "MIT" ]
permissive
from logging import getLogger from pandas import DataFrame from pymongo.collection import Collection from pymongo.cursor import Cursor from pymongo.database import Database from pymongo.results import InsertOneResult class PostRepository: def __init__(self, db: Database): self.log = getLogger('root') ...
true
f8226286051c335b077a3b6bd76eeddd3464c180
fuzeman/trakt-tools
/trakt_tools/tasks/profile/backup/create/handlers/history.py
UTF-8
774
2.53125
3
[]
no_license
from __future__ import print_function import logging log = logging.getLogger(__name__) class HistoryHandler(object): def run(self, backup, profile): print('History') items = [] for i, count, page in profile.get_pages('/sync/history'): # Append `page` items to list ...
true
d4100cf8bd02bebc088e463295135cf57fd5fe6f
argupta98/Machine_Learning
/Basic_Neural_Net.py
UTF-8
4,525
3.4375
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Sun Sep 17 18:08:15 2017 @author: Arjun Handwrittten Neural Net with 3 layers to create a binary classifier. Code is adapted from this tutorial: http://www.wildml.com/2015/09/implementing-a-neural-network-from-scratch/ """ #Import Packages #import numpy for fast matrix compu...
true
48c656cb54bf73e6a7373b72b35b0f445e6e9aab
Reejash123/Calculator
/CalcTest.py
UTF-8
895
4.53125
5
[]
no_license
class Calculator(): """Performs the four basic mathematical operations Methods: add(number, number) subtract(number, number) multiply(number, number) divide(number,number) """ def add(self, x, y): """Adds two numbers together Arguments: x - Any number ...
true
7c573fd653e2ce0a5877efa8fe0216cec74884c8
OkavianusAuwdri/OktavianusAuwdri_I0320077_AdityaMahendra_Tugas7
/I0320077_soal1_tugas7.py
UTF-8
495
4.28125
4
[]
no_license
# Soal 1 # Metode Center x = "Pendaftaran Beasiswa" y = x.center(40, '|') print(y) # Metode Capitalize a = input("Nama depan anda dalam huruf kecil = ") b = a.capitalize() print(b) # Metode Upper dan Lower c = input("Nama belakang anda dalam huruf kecil = ") d = c.upper() print(d, "\n") # Metode Replace e = a + c pr...
true
4df08fea99108423f2f1476a56cb8b81da2a995a
hadil-alsewaiee/Sign-Language-Numbers-Detection-using-HGR-and-CNN
/segment.py
UTF-8
6,948
3.203125
3
[]
no_license
# ---------------------------------- # create data in this file # ---------------------------------- # organize imports import cv2 import imutils import numpy as np # global variables bg = None # if background is first frame # ------------------------------------------------ # Function to find the ru...
true
5cfefe8c21735c5f915e65d6b1e888c06d08435e
Leopoldarroyo25/progavanzada
/ejercicio45.py
UTF-8
1,948
4.78125
5
[]
no_license
#Positions on a chess board are identified by a letter and a number. The letter identifies #the column, while the number identifies the row, as shown below: #Write a program that reads a position from the user. Use an if statement to determine if the column begins with a black square or a white square. Then use modul...
true
70a0b51a03de696888b77c34f15892b42e53a34b
inhyebaik/Practice-Coding-Questions
/data_structures/LinkedList/delete_node.py
UTF-8
1,648
3.921875
4
[]
no_license
class Node(object): def __init__(self, value, next=None): self.value = value self.next = next class LinkedList(object): def __init__(self, values=None): self.head = None self.tail = None if values: self.add_multiple(values) def __repr__(self): va...
true
1f7782fe2976232d445783fc267737b51e435d8a
Bestest96/ASDM2-TF
/demo/models/Model.py
UTF-8
1,550
2.53125
3
[]
no_license
import tensorflow as tf class ModelParams: def __init__(self, input_size=None, output_size=None, **kwargs): self.input_size = input_size self.output_size = output_size self.params = kwargs def set_defaults(self, defaults: dict): self.params = {**defaults, **self.params} clas...
true
8a93757e2bb13db78442feedd2edc085374f57e5
Saim-Akhtar/Python-Electron-Weather-App
/pythonCode/weather request.py
UTF-8
1,084
3.109375
3
[]
no_license
import requests import sys def get_weather(): city = sys.argv[1] try: api_address = 'http://api.openweathermap.org/data/2.5/weather?q='+city+'&appid=9f162c4a7576a32569f4374bd5fdff7b' json_data = requests.get(api_address).json() '''print ("It's {} in {}, with a temperature of {}, pressur...
true
3fb707288dc3a0bf0daa1cba525c565b0c57f54e
jristow/HTTPS-server-sample
/socket_server.py
UTF-8
910
3.3125
3
[]
no_license
import socket from AEScipher import AESCipher from Crypto.Hash import SHA256 #Initializing key value and certificate information key = 'Sixteen byte key' #iv = Random.new().read(AES.block_size) #cipher = AES.new(key, AES.MODE_CFB, iv) certword = 'notsosecretpassword' hasher = SHA256.new(certword.encode('utf-8')) cert...
true
64d142e954a0ef6b9013bef8216905d5f7fedaeb
DanielEbert/AOC2020
/13/p.py
UTF-8
851
3.015625
3
[]
no_license
#!/usr/bin/env python3 import argparse import pytest def task(s: str) -> int: lines = s.splitlines() cur_time = int(lines[0]) ids = [int(i) for i in lines[1].split(',') if i != 'x'] fastest_time, fastest_id = 100000000000000000000, 0 for _id in ids: next_time = _id - (cur_time % _id) if next_ti...
true
03b939bdbd6b0d8d21e8de252f4a0cc5222f4d79
HotIce0/GR-TEST
/selenium_test.py
UTF-8
850
3.453125
3
[]
no_license
# webdriver就是我们的模拟浏览器驱动 from selenium import webdriver # Keys 是用作关键词输入 from selenium.webdriver.common.keys import Keys # 首先指定driver的浏览器,官方使用的是firefox driver = webdriver.Chrome() # 驱动的get方法即为打开这个网页 driver.get("http://www.python.org") # 确定python在网页源码的title中,即没有打开错网页 assert "Python" in driver.title # 找到name为"q"的元素 elem =...
true
e79aec0071a9ecdba6e773cd8f21a392693f70d2
akushnirubc/pyneta
/Exercises/week_7_xml_nx-api/exercise1d.py
UTF-8
627
3.59375
4
[]
no_license
# Using both direct indices and the getchildren() method, # obtain the first child element and print its tag name. from __future__ import unicode_literals, print_function from lxml import etree # Using a context manager read in the XML file with open("show_security_zones.xml") as infile: # parse string using et...
true
793d8fd7fe65d85a3526707cec3ef666796d9b3a
1769258532/python
/py_core/day5/day4/ex1.py
UTF-8
979
3.328125
3
[]
no_license
#-*-coding:utf-8 -*- #!/usr/bin/python3 # @Author:liulang import time ''' 统计: 函数的调用执行时间 ''' def timethis(fn): def inner(*args, **kwargs): print("----开始调用函数-----") start = time.time() fn(*args,**kwargs) end = time.time() print("----函数调用结束-----,执行时间{}s".format(end -start)) ...
true
8362cbd3793692b95a2af832c2a13a2f1de0a085
EricZLou/microprediction
/microprediction/live/crypto.py
UTF-8
784
3.203125
3
[]
no_license
from pycoingecko import CoinGeckoAPI from pprint import pprint # New video tutorials are available at https://www.microprediction.com/python-1 to help you # get started creating streams (see the 4th module in particular) def names_and_prices(): """ Returns bitcoin and ethereum in USD and EUR """ # Just an exa...
true
f358124dbab390e439744c88ccce9b0ecc96f7f4
bwainstock/lpthw
/ex15.py
UTF-8
414
3.359375
3
[]
no_license
# use argv module from system modules from sys import argv # assign argv propertoes to two variables # this allows you to pass arguments from the CLI and store them as vars script, filename = argv # open filename specified in argument. assign contents to var txt = open(filename) # use read() subcommand to display c...
true
fbf99b6777c118442bbca50c64e5da67357dc389
lavanya-shirur/Big-data-analytics
/ASimilaritymatrix.py
UTF-8
1,833
2.671875
3
[]
no_license
from pyspark import SparkConf, SparkContext from operator import add import time import ast import re from pyspark.sql import SparkSession from pyspark.sql import SQLContext # Load inverted index from a saved text file def loadInvertedIndex(inputFile): text = sc.textFile(inputFile) wordCountPerFile = ...
true
1ae4e680c7d22108cf133c558c0c1903f07a8b2f
Toranian/PyGame-Slither
/Main.py
UTF-8
1,551
3.125
3
[]
no_license
import os, sys, time import pygame from settings import * # Game display: 6 | Title: 7 | Game Exit: 8 | Initialization: 9-10 # Lead X & Y | gameDisplay = pygame.display.set_mode((WIDTH, HEIGHT)) pygame.display.set_caption("Slither") gameExit = False init = pygame.init() print("{} Successes, {} Failures".format(init[0]...
true
ab54564901cac6b49e153919be3d926bef5af324
grozhnev/yaal_examples
/Python+/Python3/src/module/datetime/get_current_date.py
UTF-8
406
3.9375
4
[]
no_license
# Obtaining the current date and time import datetime current_date_time = datetime.datetime.now() print("Current datetime: ", current_date_time) current_date = datetime.datetime.now().date() print("Current date: ", current_date) current_year = datetime.datetime.now().date().year print("Current year: ", current_year)...
true
dda6201dd670088f8dde4544eb847114137d0965
WannaBeSuperteur/2020
/AI/kaggle/2021_07_pakdd-cup-2014/sale_eda.py
UTF-8
2,017
3.046875
3
[]
no_license
import math import pandas as pd import numpy as np import matplotlib.pyplot as plt import seaborn as sns # EDA from RepairTrain.csv # option : 'all', 'M' (module), 'P' (component) # categoryNo : for example, 2 of 'M2', 6 of 'P06' # y : count # x : year/month (sale), Jan 2005 ~ Feb 2008, 38 months def ...
true
79a9a27d49aa3b2dedf5bddc44eee778a31838bb
junanote/Algorithm
/code04-05.py
UTF-8
2,517
3.96875
4
[]
no_license
## 함수 선언부 (클래스 선언) class Node() : def __init__(self): self.data =None self.link = None def printNodes (start) : current = start print(current.data, end=' ') while current.link !=None : current = current.link print(current.data, end=' ') def insert_node(findData, in...
true
bad3686b5b69fbc7e21076c5e981fc216b94fcff
amritbhat786/Sentdex-ML-tutorial
/neural-nets/body_data_analyzer.py
UTF-8
1,265
2.984375
3
[ "MIT" ]
permissive
import pandas as pd import numpy as np from sklearn.preprocessing import StandardScaler from sklearn.manifold import TSNE import matplotlib.pyplot as plt #Download the data from website df_all = pd.read_csv('https://d396qusza40orc.cloudfront.net/predmachlearn/pml-training.csv') num_rows = df_all.shape[0] pr...
true