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
4f441b991add468918c9c1caa9eb49492ded55af
GTxx/leetcode
/algorithms/129. Sum Root to Leaf Numbers/main.py
UTF-8
915
3.40625
3
[]
no_license
# 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 sumNumbers(self, root): """ :type root: TreeNode :rtype: int """ def _find(nums, root):...
true
d4365964c58803014d175f3f7909d4767777b513
afcarl/slacktime
/optunity_modified.py
UTF-8
13,185
2.671875
3
[]
no_license
"""Slightly modified version of the Optunity hyperparameter optimization library. Not a complete implementation, so requires Optunity to be installed. (Optunity is available at https://github.com/claesenm/optunity Copyright (c) 2014 KU Leuven, ESAT-STADIUS. All rights reserved.) Current modifications: Added solver_n...
true
f2539861535dafc2e0b521fcf33e83ad11acd31e
ramilmsh/cv_gui
/test/utils/test_OrderedHashSet.py
UTF-8
1,063
3.53125
4
[ "MIT" ]
permissive
from test.BaseTest import BaseTest from src.utils.OrderedHashSet import OrderedHashSet class OrderedHashSetTest(BaseTest): def setUp(self): pass def test_init(self): a = OrderedHashSet() self.assertIsInstance(a, OrderedHashSet, "should be an instance of ordered has set") de...
true
0b3ba33b00a14af7cc3af0122bd5488485196034
Uchencho/studentBot
/google.py
UTF-8
548
2.828125
3
[]
no_license
from selenium import webdriver import time browser = webdriver.Chrome() url = "https://google.com" browser.get(url) time.sleep(2) # Check for the name of the target element """ <input name="q" type="text"> """ # Find the element named q and input in the text field Selenium Python search_el = browser.find_element_by_...
true
3b8a1d2647a907be23ca0967362f206f4c45e9af
afinogeev/worktime
/worktime.py
UTF-8
4,184
2.53125
3
[]
no_license
from PyQt5 import QtWidgets from PyQt5.QtWidgets import QSystemTrayIcon, QStyle, QAction, qApp, QMenu from PyQt5.QtGui import QIcon from PyQt5.QtCore import QTimer import widget import sys import time import coretime ## UI class UiApp(QtWidgets.QWidget, widget.Ui_Form): def __init__(self): super().__init__...
true
a6c2683bf559f72c69aff8511e9d5ec54cb56ad4
carnivorouspeanut/isovar_comp
/test/test_variant_helpers.py
UTF-8
3,757
2.515625
3
[ "Apache-2.0" ]
permissive
# Copyright (c) 2016-2018. Mount Sinai School of Medicine # # 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 ...
true
56655999803e557b47c46e788e0d0d0bd2cf726c
cmerenstein/sport_season_lengths
/mlb/scrape_mlb_schedule.py
UTF-8
793
2.984375
3
[]
no_license
import requests from bs4 import BeautifulSoup for year in range(2000,2018): schedule = [] baseball_reference = "https://www.baseball-reference.com/leagues/MLB/" + str(year) + "-schedule.shtml" print(baseball_reference) page = requests.get(baseball_reference).content soup = BeautifulSoup(page, "html.pars...
true
68da6ffdc17af1e5d5eb1f727d1c672b5a36436b
C1989833902/LukeObserver
/predict_roundplay_video.py
UTF-8
2,661
2.78125
3
[]
no_license
import os import json from argparse import ArgumentParser from datetime import datetime import pytz from collections import OrderedDict from roundplay_info_fetcher import fetch_roundplay_info def load_roundplay_list(roundplay_seq_path): roundplay_seq = OrderedDict() with open(roundplay_seq_path, 'r') as f: ...
true
91a84625295ffbe7475639189abea43e9de1bbbd
o11c/python-simple_event
/simple_event/priority_queue.py
UTF-8
2,045
3.046875
3
[ "ISC" ]
permissive
# Copyright © 2013, Ben Longbons <b.r.longbons@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 IS PROVIDED "AS IS" AND THE A...
true
a73b9e640d819a0bc284070061ca1b13e96785d8
ebrahimpichka/ml-from-scratch
/kmeans.py
UTF-8
2,957
3.25
3
[]
no_license
import numpy as np import pandas as pd from scipy.spatial.distance import cdist # euclidian distance function class KMeans(): """k-means clustering algorithm object """ def __init__(self, K): """k-means clustering with euclidian distance between points Args: K (int): number of...
true
91439fcff931f003dbb00d17318375e18173dc1a
Mistive/pythonVideoControlWithPLC
/union.py
UTF-8
1,059
2.53125
3
[]
no_license
import pyModbus import vlctest import serial import time ser = serial.Serial("/dev/ttyUSB0", 115200, timeout=0.1) # timeout 단위: s modbus = pyModbus.pyModbus(ser) str = ['./videos/01.mp4', './videos/02.mp4', './videos/03.mp4'] player=vlctest.Player() modbus.writeSingleCoil(id=1, address=9, on=True) flag = 0 while...
true
3cf9400d43d86bf41f41249b210a33871dfe4ce0
pizisuan/Learn-Python
/Python语言程序设计基础/Caesar cipher.py
UTF-8
408
3.703125
4
[]
no_license
#加密程序 plaincode = input("请输入明文:") for p in plaincode: if ord("a") <= ord(p) <= ord("z"): print(chr(ord("a") + (ord(p) - ord("a") + 3)%26),end = '') else: print(p,end='') #解密程序 print("\n") ciphertext = input("请输入密文:") for c in ciphertext: if ord("a") <= ord(c) <= ord("z"): print(chr(ord("a") + (ord(c) - ord("...
true
93a4e38a82b0eb3cbb1c5aa33b762dc57a5d6101
matyh/Project_Euler
/PE012.py
UTF-8
3,564
3.78125
4
[]
no_license
import PE007, math """ The sequence of triangle numbers is generated by adding the natural numbers. So the 7th triangle number would be 1 + 2 + 3 + 4 + 5 + 6 + 7 = 28. The first ten terms would be: 1, 3, 6, 10, 15, 21, 28, 36, 45, 55, ... Let us list the factors of the first seven triangle numbers: 1: 1 3: 1,3 6:...
true
c7c994218c055f2fe085eebe87ab4d57cb9b70f4
maladeveloper/algos-and-data-structures
/Graphs/adjacency_list_graph.py
UTF-8
2,605
3.578125
4
[]
no_license
from pprint import pprint from queue import Queue class AdjacencyListGraph: def __init__(self, matrix_ref=None): self.name = "Adjacency List Graph" if matrix_ref is not None: self.convert_matrix_to_list(matrix_ref) else: self.graph = dict() ...
true
59e551d37467529c76d9071fc9ed52dfd0dc45fe
Kungger-git/scripts
/Convert.py
UTF-8
377
3.1875
3
[]
no_license
class stringConvert: def formatBytes(self, size_bytes): power = 2**10 n = 0 power_labels = {0: '', 1: 'K', 2: 'M', 3: 'G', 4: 'T'} while size_bytes > power: size_bytes /= power n += 1 return f'{round(size_bytes, 2)}{power_labels[n]}b' def plural_...
true
f40fd6651b6a6b732c95a1bc6aa9cdbbf22e35a5
newjam/advent_of_code_2018
/day_18/solution.py
UTF-8
2,409
3.40625
3
[]
no_license
#!/usr/bin/env python3 from sys import stdin class lumber_collection_area: def __init__(self, src): self.state = [line.strip() for line in src] self.M, self.N = self.dimensions() def dimensions(self): return len(self.state[0]), len(self.state) def __eq__(self, other): return str(self) == str(...
true
8a250e7e1e090ee9d33c4fc6824d6fedabb07d01
Subheiksha/first-repository
/pana.py
UTF-8
307
3.515625
4
[]
no_license
import string def ispangram(str): alphabet="abcdefghijklmnopqrstuvwxyz" for char in alphabet: if char not in str.lower(): return False return True string=str(input().split()) if(ispangram(string)==True): print("yes") else: print("no")
true
66a37410de6dde8ded8650879d8192dcc600d4f9
hamishivi/pokemongenerator
/wgan.py
UTF-8
4,368
2.703125
3
[]
no_license
''' Main file that runs the vanilla WGAN training algorithm. This was loosely based on https://github.com/eriklindernoren/Keras-GAN/blob/master/wgan/wgan.py but I have changed many elements of it. ''' import os import numpy as np import matplotlib # for server running matplotlib.use('Agg') from matplotlib import pyplot...
true
8f38f6bf72c752d5dc6205f06b990c0397ff4b0d
asaf-kck/python-dev-proje-deposu
/artık_yıl.py
UTF-8
306
3.8125
4
[]
no_license
# Artık Yıl Hesaplama yil = int(input("Yıl değerini giziniz:\t")) if yil % 4 == 0: if yil % 100 == 0: if yil % 400 == 0: print("Artık yıl.") else: print("Artık yıl değil.") else: print("Artık yıl.") else: print("Artık yıl değil.")
true
2ef12ac8b468a6ad57101a2dfd29c40decb3e00f
Sathish-Kumar-A/Codekata-String-Problems
/Codekata-84.py
UTF-8
152
3.125
3
[]
no_license
string,n=input().split(" ") n=int(n) p=n length=len(string)//n arr=[] for i in range(length): arr.append(string[n-1]) n+=p print(*arr)
true
64cda2e24dca377475d5a027cecee61c40598684
elehcimd/metacash
/metacash/readers/inbank.py
UTF-8
5,840
2.765625
3
[ "MIT" ]
permissive
import json import os import re from datetime import datetime import pandas as pd from metacash.transactions import Transactions class InBankCSV: @staticmethod def add_balance(df, pathname): json_pathname = os.path.splitext(pathname)[0] + ".json" with open(json_pathname) as f: ...
true
677648d1631d8b1028c7c544f1491c7ef7b161fd
sanderbrauwers/poloniex
/poloniex/utils.py
UTF-8
863
3
3
[ "MIT" ]
permissive
import ast as _ast import six as _six try: import collections.abc as _collections_abc # only works on python 3.3+ except ImportError: import collections as _collections_abc class AutoCastDict(_collections_abc.Mapping): """Dictionary that automatically cast strings.""" def __init__(self, *args...
true
1111b1a5ac146f3f4dc83dcd09777f1171e821a5
mrudow/Solitaire
/solitaire2.py
UTF-8
7,675
3.421875
3
[]
no_license
#!/usr/bin/python from deck2 import * class Winning_stack: def __init__(self): self.stack=[] self.identifier='winning stack' winning_stacks=[] for i in range(4): winning_stacks.append(Winning_stack()) class Normal_stack: def __init__(self): self.stack=[] self.identifier='n...
true
e5156bd98cbe6f650277134b0df9e3808e9c47fb
lethain/digg-streaming
/python-to-redis/digg_stream/stream.py
UTF-8
4,166
2.984375
3
[ "MIT" ]
permissive
#!/usr/bin/env python """ This file shows an example of listening to the Digg Streaming API and loading the events into Redis. ## Examples Running from the command line: python stream.py python stream.py comment digg python stream.py --host 127.0.0.1 --db 4 --port 6379 python stream.py submission --d...
true
08eca5a505503d6db4907eb98fc751e0eca180c0
dr-dos-ok/Code_Jam_Webscraper
/solutions_python/Problem_60/66.py
UTF-8
810
3.109375
3
[]
no_license
#! /usr/bin/env python # # B. Picking Up Chicks # from __future__ import print_function for case in xrange(1, int(raw_input())+1): nchicks, narrive, barn, time = map(int, raw_input().split()) chicks = zip(map(int, raw_input().split()), map(int, raw_input().split())) canreach = [barn - pos <= spd * time ...
true
7317868c581efd3db2589234c11ee1a496152200
Balaji751/Must-Do-Coding
/Lotto.py
UTF-8
1,808
4.09375
4
[]
no_license
from itertools import combinations while True: d=list(map(int,input().split())) k=d.pop(0) if k==0: break permutation=list(combinations(d,6)) for p in permutation: s="" for i in p: s+=str(i)+" " print(s) print() In the German Lotto you...
true
463ae9f2093dfe8ac80de961bdc0d032595ae895
wyyyl/IE-598-HW
/IE598_F19_HW1.py
UTF-8
4,453
3.25
3
[]
no_license
import sklearn print( 'The scikit learn version is {}.'.format(sklearn.__version__)) #check scikit-learn version #The scikit learn version is 0.21.2. from sklearn import datasets iris = datasets.load_iris() X_iris, y_iris=iris.data, iris.target print (X_iris.shape, y_iris.shape) print (X_iris[0],y_iris[0]) #import the...
true
96ba24101cfc589567652837242b2a9c56095abe
liyangorg/GA_TSP
/ga_optimize_evolution_gens.py
UTF-8
962
2.703125
3
[]
no_license
import init import algorithms import figure import common import matplotlib.pyplot as plt points30 = init.create_points(30) points200 = init.create_points(200) #遗传算法 start_point = [0, 0] population_size = 300 cross_rate = 0.9 mutation_rate = 0.01 gens = 100 #设置变量为种群数量 gens = list(range(100,500,50)) distances1 = [] ...
true
b3d7f6033282c6295adcc83dc00203fd26829d1a
orikhoxha/itmd-513
/hw9/FieldValidator.py
UTF-8
2,013
3.5
4
[]
no_license
''' Name: Orik Hoxha Class: ITMD 513 Description: This script defines the functions for validating fields from CoffeeVendingMachine class. They are used as decorators/extensions of the setter functions in the up-mentioned class. ''' ''' fn: validateNegativeVal(func) Checks if a fi...
true
4957d60c257a9fd5bd09078a3627615575fd7fd9
arelekar2/Reward-Token
/StakingInteraction.py
UTF-8
1,639
2.578125
3
[]
no_license
from web3 import Web3 from smart_contract_dets import contractABI, contractAddress web3 = Web3(Web3.HTTPProvider("http://127.0.0.1:7545")) # set default acc to owner web3.eth.defaultAccount = web3.eth.accounts[0] print(f'\n===== Connected to blockchain: {web3.isConnected()} =====') contract = web3.eth.contract( ...
true
c6c6c798bbbb1c8090f73b54d447167a3d83448b
updownC/python-data_structure
/Stack/stack.py
UTF-8
789
4.375
4
[]
no_license
class Stack(object): def __init__(self): self.stack = [] def isEmpty(self): return not bool(self.stack) def push(self, item): self.stack.append(item) print("Now: ",self.stack) def pop(self): if len(self.stack) != 0: item = self.stack.pop() print("Now: ",self.stack) ret...
true
88fdacfa1c44ed2ec9bbc0215a3d1fd07bc7c518
ArtOfTheWeak/ACT
/004 wordSwapTwitter.py
UTF-8
13,612
2.9375
3
[]
no_license
## The below code is from ScareMail by Ben Grosser ## Any comments that have a double hastag are mine ## ## This iteration will swap words from XXX file and ## The create a new file with a swapped sentence that is less than ## 280 characters #!/usr/bin/python # ScareMail Text Swapper # version 1.0 # # Reads a t...
true
ae53152ffaae4094b034dd785ee5772d46e797ac
doanthanhnhan/learningPY
/01_fundamentals/02_operators/comparison.py
UTF-8
328
4.375
4
[ "MIT" ]
permissive
# Comparisons num1 = 5 num2 = 10 num3 = 10 print(num2 > num1) # 10 is greater than 5 print(num1 > num2) # 5 is not greater than 10 print(num2 == num3) # Both have the same value print(num3 != num1) # Both have different values print(3 + 10 == 5 + 5) # Both are not equal print(3 <= 2) # 3 is not less than or equ...
true
ebd88a8d7ac47afd089ccecfc99628cb3861cc0d
Aasthaengg/IBMdataset
/Python_codes/p03126/s081569279.py
UTF-8
184
2.703125
3
[]
no_license
N,M=map(int,input().split()) cnt=[0 for _ in range(M)] for _ in range(N): A=list(map(int,input().split())) for j in range(1,A[0]+1): cnt[A[j]-1]+=1 print(cnt.count(N))
true
69cc8d1efaf8f63eb360fde84c1bd5463845167a
aligg/advent-of-code-2019
/day4.py
UTF-8
873
3.359375
3
[]
no_license
LOWER_BOUND = 248345 UPPER_BOUND = 746315 def no_decreases(num): numbers = [int(x) for x in str(num)] for i in range(len(numbers)-1): if numbers[i] > numbers[i + 1]: return False return True def has_standalone_dupe(num): numbers = [int(x) for x in str(num)] curr = numbers[0] ...
true
cea0bc3992817a2063bf2d47e4cd282b3210c7e8
Pysion-lin/taxdump_sql
/scrip_sql/sql_client.py
UTF-8
1,450
2.6875
3
[]
no_license
from sqlalchemy.orm import sessionmaker from sqlalchemy import create_engine from sqlalchemy.orm import scoped_session class BaseTaxdump(object): def __init__(self,database): self.engine = create_engine( "mysql+pymysql://root:123456@127.0.0.1:3306/{}?charset=utf8", max_overflow=0, # 超过连接池...
true
e0e02e6c3f55f643629e1fb048da9cfc8c474a4f
ujalapraveen/Function
/function_even_No.py
UTF-8
172
3.1875
3
[]
no_license
def even_No(a): i=1 enum=[] while i< len(a): if a[i]%2==0: enum.append(a[i]) i=i+1 print(enum) even_No([1,2,3,4,5,6,7,8,9])
true
f9bf5657eb25f5d24ef4ccfb335d47fda070a45c
D-Joel/Self-Driving-Car-based-Taxi-System
/Vehicle Movement/lane tracking.py
UTF-8
5,596
2.625
3
[ "Unlicense" ]
permissive
import cv2 import numpy as np from picamera.array import PiRGBArray from picamera import PiCamera import time import ctypes import wiringpi camera = PiCamera() camera.resolution = (640, 480) #640,480 camera.framerate = 60 rawCapture = PiRGBArray(camera, size=(640, 480)) time.sleep(0.1) k=0 left_u...
true
6b2221fe5d164408891ba983acb4a37240b06c9d
wongcyrus/ite3101_introduction_to_programming
/lab/lab11/ch011_t08_pass_list_to_func.py
UTF-8
125
3.078125
3
[]
no_license
from typing import List def list_function(x: List[int]) -> List[int]: return x n = [3, 5, 7] print(list_function(n))
true
86a00d8d24a0f7d2958526501cb18e30e1377796
rowan-smith/Vigenere-Cipher
/utils/IndexOfCoincidence.py
UTF-8
1,252
3.40625
3
[]
no_license
import string from typing import List class IndexOfCoincidence: def __init__(self, index: int, sequence: str, alphabet: str = string.ascii_lowercase): self.index = index self.sequence = sequence self.alphabet = alphabet self.index_coincidence = self.get_index_coincidence() de...
true
62dc024d68f01ddc921def0877dcd971287a3560
jlucier/advent-of-code
/2015/1/p2.py
UTF-8
190
3.421875
3
[]
no_license
with open('input.txt', 'r') as f: inp = f.read().strip() floor = 0 for i, mv in enumerate(inp): floor += 1 if mv == '(' else -1 if floor < 0: print(i + 1) break
true
22a5f05a798ad3f44ac854d5d40cab2f17bd6f62
ignacioparicio/event_registrator
/src/event_registrator.py
UTF-8
6,966
2.71875
3
[]
no_license
""" Created on 17/02/2020 20:29 @author: Ignacio Paricio """ import time import datetime import smtplib import imaplib import email from email.message import EmailMessage import yaml from selenium import webdriver from selenium.webdriver.support.ui import Select from selenium.webdriver.support.wait import WebDriverWai...
true
78e65fdbb8f4b5224c5ee96f7ef78634059528df
buzzzzx/LeetCode_algorithm
/easy/ValidParentheses.py
UTF-8
859
3.546875
4
[]
no_license
""" 这个无法判断"()[]{}"这种类型 只能判断"{(([]))}"这种类型 """ class Solution(object): def isValid(self, s): """ :type s: str :rtype: bool """ left = ['(', '[', '{'] right = [')', ']', '}'] l_dict = { '(': ')', '[': ']', '{': '}' ...
true
1bb0948f4bf981815ab6086ad291ff8b103cef84
dirtyhabits97/Employee-Turnover
/data/data_manager.py
UTF-8
2,609
3
3
[]
no_license
import pandas as pd import numpy as np from sklearn.model_selection import train_test_split from helper_methods.print_methods import print_variables from .data_encoding import one_hot_encode, binary_encode from .feature_selection import recursive_feature_elimination, principal_components_analysis, scale_data_frame cl...
true
637bf277af055df850e213caf80e93ead9bdb5f2
ilalal/lesson4
/lesson9.py
UTF-8
688
4.4375
4
[]
no_license
"""TAsk1""" class Person: def __init__(self, firstname, lastname, age): self.firstname = firstname self.lastname = lastname self.age = age def talk(self): print(f"Hello, my name is {self.firstname} {self.lastname}, and I'm {self.age} years old") person = Person("Ilia","Zhur...
true
e43f3c2136126fefe9b5b1d443b92c124d5e154b
AbdulKhadhar/ML-for-Software-Engineers
/Numpy/Filtering/Filtering3arg.py
UTF-8
354
2.875
3
[]
no_license
np_filter = np.array([[True, False], [False, True]]) positives = np.array([[1, 2], [3, 4]]) negatives = np.array([[-2, -5], [-1, -8]]) print(repr(np.where(np_filter, positives, negatives))) np_filter = positives > 2 print(repr(np.where(np_filter, positives, negatives))) np_filter = negatives > 0 print(repr(np.where(n...
true
383e17ed7340a5754a6e8d6e73a8d9064ce3deed
yejiin/Python-Study
/algorithm/이코테/구현/게임 개발.py
UTF-8
1,107
3.15625
3
[]
no_license
N, M = map(int,input().split()) A, B, d = map(int, input().split()) input_map = [] # 맵 입력 for i in range(N): input_map.append(list(map(int,input().split()))) # 이동할 수 있는 모든 경우 move_steps = [(-1, 0), (0, 1), (1, 0), (0, -1)] # 바라보는 방향의 모든 경우 d_steps = [0, 1, 2, 3] result = 0 # 캐릭터가 회전한 횟수 count = 0 # 현재 좌표 방문 i...
true
a55f3cc7567660fc37c7642dc7a2d187cb1a6237
Lunaresk/dnd_telegram_bot
/dndbot.py
UTF-8
19,276
2.65625
3
[ "MIT" ]
permissive
from telegram import (InlineKeyboardButton, InlineKeyboardMarkup) from telegram.ext import (CommandHandler, MessageHandler, RegexHandler, ConversationHandler, CallbackQueryHandler, Filters) from ..errorCallback import error_callback from . import helpFuncs from . import dbFuncs import logging logging.basicConfig(forma...
true
81aa8204e5a97855440b2b7091091a2cf6475256
since2016/studypython
/datainpython/Graph.py
UTF-8
2,911
3.515625
4
[]
no_license
# 无向图 import heapq class UndirectGraph(object): def __init__(self): self.nodes = [] self.edge = {} def insert(self,a, b): if not(a in self.nodes): self.nodes.append(a) self.edge[a] = list() if not(b in self.nodes): self.nodes.append(b) ...
true
a2732ffb16264e0bfbf2933649cc320a31099d8e
ddelizia/covid-19
/data.py
UTF-8
6,455
2.65625
3
[]
no_license
import os import dash_html_components as html import numpy as np import pandas as pd from expiringdict import ExpiringDict from scipy.optimize import curve_fit cache = ExpiringDict(max_len=100, max_age_seconds=120) class Data: def build_data(self): pass def dash_title(self): pass def ...
true
cd389b65761b6e7bbfcf713d521dbce3179a88c6
OlavEspenes/INF200-2019-Exersices
/src/olav_espenes_ex/ex02/file_stats.py
UTF-8
880
3.65625
4
[]
no_license
def char_counts(textfilename): """Counts characters in a text. """ with open(textfilename, 'r') as myfile: data = myfile.read() counter = {} for element in data: if ord(element) in counter: counter[ord(element)] += 1 else: coun...
true
8ab063aa9ea4ef8d374e70047053a7b1fcd6c912
Atuski/learning
/getip.py
UTF-8
1,390
2.96875
3
[]
no_license
[code]import urllib.request from bs4 import BeautifulSoup import re #获取IP地址 def find_ip(str1): comp = re.compile(r'(([01]{0,1}\d{0,1}\d|2[0-4]\d|25[0-4])\.){3}([01]{0,1}\d{0,1}\d|2[0-4]\d|25[0-5])') ip = re.search(comp,str1) return ip #获取端口号 def find_port(str1): comp = re.compile(r'<td>(([0-9]{0,1}){0,5...
true
26b348d30e8911381a9609d9beb26b34d791a691
utkarshtandon99/Testing
/Basics/prefixinlist.py
UTF-8
226
2.796875
3
[]
no_license
if __name__ == "__main__": s = input().lower().split(" ") pre = str(input()).lower() f = -1 for i in s: if(pre == i[:len(pre)]): print(True) f = 1 exit() print(f)
true
9de11c63bb0f64ac791be24c045d9ca4827d41f1
Zorha/my-first-blog
/python_intro.py
UTF-8
157
2.71875
3
[]
no_license
def hi (name): if name == 'zoro': print('hello my dear') elif name == 'zola': print('hello zola roronoa !! ') else: print('hi miss! ') hi ("zola")
true
a6d8edb677ab25ad2b403102b35b187600b00ed0
ariesduanmu/python3_standard_library
/18_language_tools/03_dis/performance/dis_slow_loop.py
UTF-8
460
3.015625
3
[]
no_license
# -*- coding: utf-8 -*- # @Author: Li Qin # @Date: 2020-03-12 11:13:26 # @Last Modified by: Li Qin # @Last Modified time: 2020-03-12 11:58:42 class Dictionary: def __init__(self, words): self.by_letter = {} self.load_data(words) def load_data(self, words): for word in words: ...
true
be8d645b9b5560a234877b40b06db4d011985b21
lrlab-nlp100/nlp100
/yukawa/chap6/nlp_59.py
UTF-8
1,099
2.890625
3
[]
no_license
# -*- coding: utf-8 -*- import re def nest(s): cnt = 0 num = 0 for c in s: num += 1 if c == ')': cnt -= 1 elif c == '(': cnt += 1 if cnt == 0: return s[:num] pa = re.compile(r'<parse>(.+?)</parse>') pa_NP = re.compile(r'\(NP') pa_n = re.c...
true
1ea96c6fc0f4af7e4eea2448fa5d013faccc343b
serfedor/Programm
/python_work/lists/3-7.py
UTF-8
467
3.578125
4
[]
no_license
#by SerLonic new_list = [] #create list new_list.append('Lina') #add element to list new_list.append('Kris') new_list.append('Logan') new_list.append('Harrisson') new_list.append('Jake') print('I invite only two person') print('Sorry ' + new_list.pop())#remove 3 elements in end of list print('Sorry ' + new_list.pop()...
true
99cdac36252b472679eda30493537a343f608d7c
Udafff/epam-homeworks
/Python/module03/multiple_in_range/multiple_in_range.py
UTF-8
184
3.109375
3
[]
no_license
def multiple_in_range(st_range, en_range): try: return [i for i in range(st_range, en_range + 1) if i % 7 == 0 and i % 5 > 0] except TypeError: raise TypeError
true
1313d2285f1f54ad02708dac6c0fc056e2544b73
summatix/memoize
/tests/forced_delay.py
UTF-8
1,243
3.046875
3
[ "Apache-2.0" ]
permissive
import time from memoize import memoize import unittest class ForcedDelayTests(unittest.TestCase): def forced_delay_normal(self,some_number,some_string,some_list): time.sleep(0.01) return some_number # also tests that this works on class objects @memoize def forced_delay_memoized(se...
true
6ae819f2638b3e780165f4f0ff00134fa0e4388f
guiltedom/donkirkby
/py-art/gcode_display.py
UTF-8
1,350
2.890625
3
[ "MIT" ]
permissive
class GCodeDisplay: __started = False def __init__(self): self.scale = (1, 1) self.offset = (0, 0) self.preamble = "g21 g64 p0.01" self.feed_rate = 50 self.plunge_feed_rate = 50 self.spindle_speed = 4500 self.zsafe = 1.0 self.ztop = 100.0 ...
true
0a050c8b0ef20d36ac30cc4548c0852e6994eb13
doggyeh/Python
/matplotlib/bar.py
UTF-8
798
2.890625
3
[]
no_license
from matplotlib import pyplot as plt x_values = [0, 1, 2, 3, 4, 5] x_values_labels = ['aluminum', 'elegharn', 'symcloudscan', 'virus_total', 'sonar_bypass_rule', 'human'] y_values = [629, 84, 2558, 45, 234, 1868] ax = plt.subplot() bars = ax.bar(x_values, y_values) ax.set_xticks(x_values) ax.set_xt...
true
4c1913fe7ebda5959b42c9174908c79bc720cf66
palmerigarrett/blogger-app
/rest_flask/models.py
UTF-8
2,063
2.5625
3
[]
no_license
from flask_sqlalchemy import SQLAlchemy from flask_bcrypt import generate_password_hash, check_password_hash db = SQLAlchemy() class BlogPost(db.Model): __tablename__ = 'blog_post' # primary_key means that the id will be unique for each object id = db.Column(db.Integer, primary_key=True) title = db.C...
true
b48faca5124d0e68a7c749e503d2d89c1eefe0e1
JPMirandaM/rCNV2
/analysis/paper/scripts/noncoding_association/summarize_ncCNV_counts.py
UTF-8
4,461
2.65625
3
[ "LicenseRef-scancode-unknown-license-reference", "MIT" ]
permissive
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright (c) 2020 Ryan L. Collins <rlcollins@g.harvard.edu> # and the Talkowski Laboratory # Distributed under terms of the MIT license. """ Compute counts of CNV carriers vs non-carriers per phenotype based on overlap with a prespecified gene list """ import panda...
true
9a010e26171ed0f774e013a5459c89a35e05abdd
Cylra/cLearn
/NowCoder/2017_school_recruit/1007.py
UTF-8
213
3.109375
3
[]
no_license
import sys import re s = input() t = input() if t == '': print('Yes') sys.exit(0) list1 = list(t) #用正则,贼方便 pat = '.*'.join(list1) if re.findall(pat, s): print('Yes') else: print('No')
true
ecf667eabc27d343caeed056c7866db388b68981
apierz/dotfiles
/vim/ftplugin/orgmode/menu.py
UTF-8
4,420
2.78125
3
[ "MIT" ]
permissive
# -*- coding: utf-8 -*- import vim from orgmode.keybinding import Command, Plug, Keybinding from orgmode.keybinding import MODE_ALL, MODE_NORMAL, MODE_VISUAL, MODE_INSERT def register_menu(f): def r(*args, **kwargs): p = f(*args, **kwargs) def create(entry): if isinstance(entry, Submenu) or isinstance(entry,...
true
4a7ae8be053783e401d5bc5cfe999efb4fe5a066
ElinaBarabas/Graph-Algorithms
/Laboratory 4/main.py
UTF-8
4,497
3.8125
4
[]
no_license
import random # Write a program that, given an undirected connected graph, constructs # a minumal spanning tree using the Kruskal's algorithm. class UndirectedGraph: def __init__(self, n, m): self._n = n self._m = m self._vertices_list = [] self._cost_dictionary = {} ...
true
3ec4fb3d2c4877be1857b6ef15a1cebcee5f5d0f
jhoward/code_shop
/site_problems/euler/15.py
UTF-8
382
3.203125
3
[ "MIT" ]
permissive
rv = {} def routes(m, n): if m == 0 or n == 0: return 1 return routes(m - 1, n) + routes(m, n - 1) def fastRoutes(m, n): if m == 0 or n == 0: return 1 if not rv.has_key((m, n)): rv[(m, n)] = fastRoutes(m - 1, n) + fastRoutes(m, n-1) return ...
true
f10b85214183c7cbfb4d5126614814111d0e6a6e
atnartur/pyrace
/objects/game/walls.py
UTF-8
3,481
2.828125
3
[ "MIT" ]
permissive
from random import randint from pygame import * import time from core.events import Events from objects.base import Base class Walls(Base): color = (128, 128, 128) def __init__(self, size, margin, cube_size=10, offset=(0, 0)): self.coordinates = [] self.size = size self.cube_size =...
true
0453f5844a6d41e214bb53b9d92b5ecd63208575
lpfan0307/leetcode
/top_interview_questions/plus_one.py
UTF-8
606
2.625
3
[]
no_license
class Solution(object): def plusOne(self, digits): """ :type digits: List[int] :rtype: List[int] """ if digits[-1]<=8: digits[-1]+=1 return digits digits[-1]=0 carray_bit = 1 for i in range(1,len(digits)): index = le...
true
ac45a7cbdd06b88731b378c28831618212ac4d10
YosenChen/CodePractice
/PythonPractice/basic_test/class_instance_method.py
UTF-8
3,166
3.515625
4
[]
no_license
def assign_static(): print "assign_static!" return 1 class TestModule1: var1 = assign_static() @classmethod def incrVar1_clsMethod(cls): cls.var1 += 1 return cls.var1 def incrVar1_insMethod(self): self.var1 += 1 return self.var1 if __name__ == "__main__": ...
true
06887019bbb0c27d53e711a9452b5534f50054c6
BeardicPerformance/python_learn
/Final Assessment/report_email.py
UTF-8
1,242
2.53125
3
[]
no_license
#!/usr/bin/env python3 import os from datetime import date import reports import emails directory = "/home/student-03-b60bd46ecaa6/supplier-data/descriptions/" fruits = [] paragraph = "" for file in os.listdir(directory): content = [] f = open("/home/student-03-b60bd46ecaa6/supplier-data/d...
true
9e9b926ac2baf42d3c3409cb0190dea73d7ecd5c
carlosribas/backend-coding-challenge
/unbabel_api.py
UTF-8
678
2.65625
3
[]
no_license
import os from unbabel.api import UnbabelApi from config import load_dotenv uapi = UnbabelApi(os.environ['USERNAME'], os.environ['API_KEY'], sandbox=True) def post_translation(text): """HTTP request to the translation endpoint. :param text: text to be translated :return: dict with the uid """ re...
true
424eb22518768b501941d803f99085db52ba7204
dkarris/optionstest
/volatility_functions.py
UTF-8
2,610
3.109375
3
[]
no_license
''' In this module functions for MOEX theoritical volatility calculation and Black - Scholes pricing are defined. ''' import math def theoreticalVolatility(strike, asset_price, s, a, b, c, d, e, t): ''' returns MOEX theoretical volatility calculated using moex formula and parameters ''' # s = float(s) ...
true
ceb101dbffb0589ea4bec8735663dcf5a00f8c3a
Mcps4/ifpi-ads-algoritmos2020
/LISTA_2_FABIO_PARTE_1/F2_P1_Q11_OPCAO.PY
UTF-8
586
3.78125
4
[]
no_license
def main(): opcao = float(input('digite a opção: ')) num_1 = float(input('digite o primeiro número ')) num_2 = float(input('digite o segundo número: ')) num_3 = float(input('digite o terceiro número: ')) opcoes(opcao, num_1, num_2, num_3) def opcoes(opcao, num_1, num_2, num_3): if...
true
1c23d0c239b458449c27d9e4dd57e2b8b3a25283
SnapWars/CodingWar
/david/sessions/2018/medium/(*)539_minimum_time_difference.py
UTF-8
365
3.0625
3
[]
no_license
class Solution(object): def findMinDifference(self, A): minutes = sorted(map(self.convert, A)) result = float('inf') for x, y in zip(minutes, minutes[1:] + minutes[:1]): result = min(result, (y - x) % (24 * 60)) return result def convert(self, s): h, m = map(...
true
29663aacbaf1ef988c1592240badf3d6774b0fe8
Aymeenferchichi/MLE_test_2020
/most_similar.py
UTF-8
399
2.75
3
[]
no_license
from content_based_filtering.helpers.movies import get_movie_id, get_movie_name, get_movie_year def get_most_similar(movies,similarity, movie_name, year=None, top=10): index_movie = get_movie_id(movies, movie_name, year) best = similarity[index_movie].argsort()[::-1] return [(ind, get_movie_name(movies, in...
true
a833e25aad38957c9073a8d8b7c0b7d1f306088e
JingyiHU/Hadoop_and_Map_reduce_Udacity
/Final_Project/Post_And_Answer/reducer.py
UTF-8
836
3.015625
3
[]
no_license
#!/usr/bin/python import sys import csv reader = csv.reader(sys.stdin, delimiter='\t', lineterminator='\r\n') writer = csv.writer(sys.stdout, delimiter='\t', quotechar = '"', quoting = csv.QUOTE_ALL) ques_dic = dict() answ_dic = dict() oldnodeid = None for line in reader: if (line != None) and (len(line) == 4): ...
true
ef5f9ce818268be093c37453d335e2fb67f13638
danielzuncke/ai-numbers
/nn.py
UTF-8
5,219
3.21875
3
[]
no_license
# written in IPython for Jupyter notebook # %% # imports and stuff import numpy as np import pickle import scipy.special as sp import scipy.ndimage as spimg import matplotlib.pyplot as plt # %matplotlib inline # not necessary in vscode # %% class neuralNetwork: """ Initialize neural network\n args: ...
true
ab2f43db0c7ccaebb0649abcae570712e278ffab
ajhb/stp
/test_suites/hello_world/helloworld_s_func_load_w_template.py
UTF-8
905
2.6875
3
[]
no_license
#@desc Just hello world with template importing. This test case showcases loading reusable/common # code into a test case to avoid code duplication. # # What's required to run this test, this line should always be the first statement in every python test script requires = [] # START OF TEST LOGIC # Importing load_te...
true
ed514bdf4bd57b4259adbc6ecd138afef193cde0
noahdela/pub-sub-netapp
/pistatsd.py
UTF-8
8,629
2.5625
3
[]
no_license
#!/usr/bin/python """ This file contains pseudo code which describes at a high level what should be implemented for the utilization service (i.e. pistatsd). This is the basic algorithm you will want to follow, although there are other ways to implement this pseudo code. """ import pika import pika.exceptions import s...
true
94315431adb1f27c0f8d84111a9fe6aeeba2ce64
chashikajw/lips-feature-extraction
/detect_face_features.py
UTF-8
6,050
2.609375
3
[]
no_license
from collections import OrderedDict import numpy as np import cv2 import argparse import dlib import imutils import csv import os import math facial_features_cordinates = {} # defined facial landmarks to face regions FACIAL_LANDMARKS_INDEXES = OrderedDict([ ("Mouth", (48, 68)), ("Right_Eyebrow", (17, 22)), ...
true
2279d5b6ec1852fb62558fba48ed5c4b22ef7518
milanmenezes/computer-networks
/crc.py
UTF-8
492
2.8125
3
[]
no_license
import copy x=[eval(i) for i in raw_input("Enter the bits\n")] y=[1,0,0,0,0,0,1,0,0,1,1,0,0,0,0,0,1,0,0,0,1,1,1,0,1,1,0,1,1,0,1,1,1] l1=copy.copy(x) for i in range(33): l1.append(0) def crc32(l1,y): for i in range(len(l1)-32): if(l1[i]==1): for j in range(len(y)): l1[i+j]=(l1[i+j]+y[j])%2 return x[-32:] r...
true
520f24bed2d8ddc8bcdd3cf35fffda5f23901c46
JacR27/benchplotting
/TimeSummeryPlot.py
UTF-8
2,286
2.734375
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Wed Jul 1 01:23:03 2015 @author: jrayner """ import numpy as np import matplotlib.pyplot as plt from matplotlib import cm def compSystems(workflow,systems): subprocesses = {} for system in systems: subprocesses[system] = open('C:/cygwin64/home...
true
22497d669d27ffb9661d0b7e88dcc5ff8db17fcc
jwjeffers/dcc-generator
/CharacterRenamer.py
UTF-8
8,934
2.703125
3
[]
no_license
import random; def d20(): return random.randint(1,20) def humanmale(): result = d20() if result == 1: return "Sam" if result == 2: return "Finn" if result == 3: return "Broggurt" if result == 4: return "Hiemfdal" if result == 5: return "W...
true
8072aff8236aac2e6c81dca0a2eb03245d2ac09b
feitianyiren/python-tactics
/new_sprite.py
UTF-8
6,251
3.359375
3
[]
no_license
# Tile directions # /\ # North / \ East # / \ # \ / # West \ / South # \/ # Types of sprites: # StaticSprite - Does not move or turn in the scene. # Requires: # * 1x image for displaying in all direction # TurnableSprite - Does not move, but can be turned. # R...
true
660305e9f147c19f181b246bdaf14a79358d2726
lhgcs/QR-Droid
/main.py
UTF-8
3,210
2.546875
3
[]
no_license
#!/usr/bin/env python3 ''' @Description: main @Version: 1.0 @Autor: lhgcs @Date: 2019-08-28 10:12:49 @LastEditors: Please set LastEditors @LastEditTime: 2020-02-29 09:44:52 ''' import os import sys import json import time import cv2 import numpy as np from CameraManager import CameraManager from...
true
43669532494ac359bce5e30b635b30a00f14adb9
Kawser-nerd/CLCDSA
/Source Codes/CodeJamData/12/13/3.py
UTF-8
4,101
2.828125
3
[]
no_license
# encoding: UTF-8 from __future__ import absolute_import, division from future_builtins import * range = xrange import collections import itertools import sys from fractions import Fraction as F class gcj: IN = sys.stdin buf = None identity = lambda x: x @classmethod def _read_line_raw(cls): ...
true
0193944cd4b7b7bc82e416447727728adc611178
amb/blender-texture-tools
/cl_abstraction.py
UTF-8
6,286
2.75
3
[]
no_license
from . import pycl as cl import numpy as np from ctypes import c_void_p as void_p def min_ptwo(val, pt): "Gives the minimum divisionally aligned value for input value" assert val > 0 assert pt > 0 return ((val - 1) // pt + 1) * pt class CLType: def __init__(self, cldev, w, h, simple=False): ...
true
bc3e600cf1f153b940031e742bf28ce68b399fe6
vprusso/toqito
/tests/test_channel_props/test_is_quantum_channel.py
UTF-8
732
2.6875
3
[ "MIT" ]
permissive
"""Tests for is_quantum_channel.""" import numpy as np from toqito.channel_props import is_quantum_channel from toqito.channels import depolarizing def test_is_completely_positive_kraus_false(): """Verify non-completely positive channel as Kraus ops as False.""" unitary_mat = np.array([[1, 1], [-1, 1]]) / np...
true
1f00f3a336876447956278dd4cb875feb7da5098
vaibhav443/Bart_ranking
/product_scoring.py
UTF-8
1,284
2.640625
3
[]
no_license
from Bart_scoring_utils import * import pandas as pd import time final_df = pd.read_csv(r"C:\Users\vaibh\Downloads\PM1 Internship\trans_data.csv") #path for the dataset df = final_df[:100] data_dict = df.to_dict() prod_params = { "kwds": ["huile bebe"], "lang": "fr", "data": data_dict, "N_...
true
2686a44cf92a749f5f493c3e1fd7c822fd429d13
ghdwpaks/team_yatch
/hong_main.py
UTF-8
275
3.46875
3
[]
no_license
print("프로그램을 시작합니다.") print("1.게임시작") print("2.게임설명") input_start = input("입력 : ") if input_start == "1" : #게임 시작 코드 추가 필요 pass elif input_start == "2" : #게임 설명 코드 추가 필요 pass
true
c1ef33e79b34d80f0fe49d63e717b8ffc6cd47dd
curiousTauseef/Algorithms_and_solutions
/LeetCode/701_insert-into-a-binary-search-tree.py
UTF-8
1,713
4.3125
4
[]
no_license
""" Given the root node of a binary search tree (BST) and a value to be inserted into the tree, insert the value into the BST. Return the root node of the BST after the insertion. It is guaranteed that the new value does not exist in the original BST. Note that there may exist multiple valid ways for the insertion, as...
true
2e18eac6a119683972fa6e153681c915427d9d12
tchuanromanee/python-sandbox
/shortScripts/hex_ascii_convert.py
UTF-8
1,183
3.53125
4
[]
no_license
import binascii def convert_hex_to_ascii(hex_value): try: # Decode from hex to ascii, replace OOB hex with \ufffd ascii_val = bytes.fromhex(hex_value).decode('ascii', 'replace') # Replace \ufffd with "." to be true to tbl file ascii_val = ascii_val.replace('\ufffd', '.') # R...
true
fab46ec1d52abafa9ef24f33909cde0391318f42
wenjing6711/Amazon-Reviews-Text-Classification
/save_required_input.py
UTF-8
6,896
2.828125
3
[]
no_license
import json import numpy as np import os import csv import re from nltk.corpus import stopwords import pandas as pd cachedStopWords = stopwords.words("english") ## remove stop word def remove_stop_words(text): text = ' '.join([word for word in text.split() if word not in cachedStopWords]) return te...
true
4b5a8bd64752bc8bc6fcb689b9976d6c63924bd5
LinfuYang/Data-driven_2
/GBRegression1.py
UTF-8
2,738
2.84375
3
[]
no_license
import numpy as np import matplotlib.pyplot as plt import pandas as pd from sklearn import ensemble from sklearn import datasets from sklearn.utils import shuffle from sklearn.metrics import mean_squared_error #Load Data a=["date","Appliances","T1","RH_1","T2","RH_2","T3","RH_3","T4","RH_4","T5","RH_5","T6","RH_6","...
true
46a98685c7a09f36bef3d50829a725e3aa34a1f6
aschet01/cookbook
/python/_unittest.py
UTF-8
4,766
3.4375
3
[]
no_license
#!/usr/bin/env python """ _unittest.py - Recipes using unittest """ import os import shutil from pathlib import Path import unittest import unittest.mock def clear_dir(path): """Recursively delete files in a directory. Raise FileNotFoundError if the input path does not exist. Raise ValueError if the inpu...
true
98a27e2422c9e51aebb235d6c03e838336c8a5b2
Dumacrevano/DumacChen_ITP2017_Exercise-5
/exercise 5.py
UTF-8
631
3.6875
4
[]
no_license
import math def calculator(num_1,num_2,opr="+",out="float"): if opr=="+": c=num_1+num_2 elif opr=="-": c=num_1-num_2 elif opr=="*": c=num_1*num_2 elif opr=="/": c=num_1/num_2 else: raise ValueError("please input onl...
true
0132aab251df5b1806757bd4a4974a25f3d35f2f
IvanWoo/kube-secrets-utility
/kube_secrets_utility/entry.py
UTF-8
2,271
2.65625
3
[]
no_license
from functools import partial import click from kube_secrets_utility.log import get_logger from kube_secrets_utility.utils import ( dump_many_by_type, dump_one, is_dir, is_exist, is_file, update_many, update_one, ) logger = get_logger(__name__) # https://github.com/pallets/click/issues/64...
true
59b705c39e11be1284d8925da9669d15310bf78b
prasanth-ashokan/My-Programs
/cf/sep19 long/t.py
UTF-8
627
3.046875
3
[]
no_license
import bisect b=[2,3,0,9] def bis(n): if n==3 or n==4: return 1 else: k=[] for ii in range(2,70): k.append(pow(2,ii)) o=bisect.bisect_left(k,n) o=o%4 return (b[o-1]) def brute(n): a=[0,1] q=[] for y in range(2,n-1): t=a[y-2] ...
true
8954d3d44af9605fc1faee558a6f6cfeb6572c23
aleshkashell/geekbrains_patterns
/rutor.py
UTF-8
3,385
2.828125
3
[]
no_license
import asyncio import aiohttp from aiohttp import client_exceptions from lxml import html from interfaces import TorrentInterface from logger import Log class Rutor(TorrentInterface): def __init__(self): self.log = Log(__name__) self.session = aiohttp.ClientSession() self._init_variables()...
true