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 |
|---|---|---|---|---|---|---|---|---|---|---|
d50c5e1685bb53da5f4825242dc756d01154c61d | qiao-xin/Nd1_PacBio | /check_TEs_for_overlap_with_genes.py | UTF-8 | 2,958 | 2.546875 | 3 | [] | no_license | ### Boas Pucker ###
### bpucker@cebitec.uni-bielefeld.de ###
import re
import matplotlib.pyplot as plt
# --- end of imports --- #
def load_all_gene_positions( gene_gff3_file ):
gene_positions = []
with open( gene_gff3_file, "r" ) as f:
line = f.readline()
while line:
if line[0] != '#':
parts = line.... | true |
9f87239bd637dcc100acc62e6222fb86b524b913 | zewaru/PyLadies | /Beginner/2013-08-04/bikeride.py | UTF-8 | 6,332 | 3.578125 | 4 | [] | no_license | def katie():
guilt_count = 0
while guilt_count < 2:
kitten_status = "definitely_alive"
kitten_answer = raw_input("""You see the CIC in front of you. There it is! So beautiful.\
But, oh no! You see a stray kitten looking very scared of all the big cars.\
Do you want to try to cat... | true |
e61dc5619ea5b764d60dd40851cd180b11245316 | ssquirrel0911/Python-Projects | /SamanthaSquirrelProgramAssignment9-18-2018.py | UTF-8 | 5,292 | 4.46875 | 4 | [] | no_license | #Samantha Squirrel
#samantha.squirrel001@albright.edu
import time
#Assignment 9-18-2018 Exercises 4 - 8
#Exercise 4
romanNumeral = int(input("Input a number in the range of 1 through 10:", )) #User should put in a number in the range of 1 through 10
if romanNumeral == 1:
print("I")
elif romanNumeral... | true |
45dad0cc17e60dfe9ad492258a34c7f19c2aea91 | meghana-np/Streaming-data-to-GCP | /Cloud_function.py | UTF-8 | 2,109 | 2.65625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Mon Jul 5 20:40:51 2021
@author: megha
"""
import logging
from base64 import b64decode
from pandas import DataFrame
from json import loads
from google.cloud.storage import Client
class LoadToStorage:
def __init__(self,event,context):
self.context = context
... | true |
1f2f00d788a1d5088bb40de28c9174d27f43298c | kencordero/monopsony | /tests.py | UTF-8 | 719 | 2.765625 | 3 | [] | no_license | import sys
sys.path.insert(0,'..')
import json
import unittest
from game import Game
class TestDataLoad(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls._game = Game()
def test_properties(self):
self.assertEqual(self._game.properties[14]['name'], 'Kentucky Ave.')
def te... | true |
28e50100ca2e547faa303e541d5c9faff194c535 | Marie-EveGauthier/whatIShouldWatch | /bin/get-data/spiders/tutorial/spiders/get_crew_urls.py | UTF-8 | 2,580 | 3.078125 | 3 | [] | no_license | import scrapy
import csv
def geturls():
with open('movieinfo.csv') as csvfile:
reader = csv.reader(csvfile)
movieinfo = list(reader) #stores characters, words spoken
movieinfoforurls = movieinfo
#print '\n movieinfo ', movieinfo[0], '\n'
movieurls = ['http://www.imdb.com/title/' + movi... | true |
a37c183e9a49dcb884baa66ae272b247c72aee35 | michelman2/RigolDS1000Z | /code/testModule/add_path.py | UTF-8 | 597 | 2.78125 | 3 | [] | no_license | import sys
import os
def add_subfolder_to_path( project_base_folder):
## checking the input to the make file
# current_folder = sys.argv[0]
# if(len(sys.argv) > 1):
# run_file = sys.argv[1]
# else:
# raise NoFileSelectedException
## Add all subfolders of the project in... | true |
0a3cd753e9b63221bb4f968b5ced8571ff214e11 | maidanglao990/algo | /测试.py | UTF-8 | 18,028 | 3.171875 | 3 | [] | no_license | class Solution(object):
def partitionLabels(self, S):
last = {c:i for i,c in enumerate(S)}
start = 0; end = last[S[0]]; cnt = 0; r = []
for i,c in enumerate(S):
end = max(end, last[c])
if i == end:
r.append(end-start+1)
if i <... | true |
1ce35a2b726b4f222132a43723bc2fff67d727e2 | August1s/LeetCode | /Disjoint Set/No200岛屿数量.py | UTF-8 | 957 | 3.125 | 3 | [] | no_license |
# 连通性问题的一个直接的解决方法是并查集
def numIslands(self, grid: List[List[str]]) -> int:
def Find(x, p):
x_root = x
while p[x_root]!=-1:
x_root = p[x_root]
return x_root
def Union(x:tuple, y:tuple, p:dict):
x_root, y_root = Find(x,p), Find(y,p)
if x_root != y_root:
... | true |
bca86b7e13a3b5e157049d9b1555b7e056dd4c48 | duongntbk/steganosaurus | /tests/test_otp_cryptor.py | UTF-8 | 3,259 | 2.640625 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
"""
Test for otp_cryptor.
"""
import builtins
import hashlib
import os
import unittest.mock as mock
import pytest
import steganosaurus.constants as constants
from pytest_mock import mocker
from steganosaurus.otp_cryptor import OTPCryptor
otp_cryptor = OTPCryptor()
# File content for test_l... | true |
e51d361f129f36553eef4eeacb0e611b2ab51e45 | edrobot/PythonRoguelike_Spring-2014 | /StateMachine.py | UTF-8 | 3,440 | 3.53125 | 4 | [] | no_license | #-------------------------------------------------------------------------------
# Name: SateMachine
# Purpose:
#
# Author: Michael
#
# Created: 16/04/2014
# Copyright: (c) Michael 2014
# Licence: <your licence>
#-------------------------------------------------------------------------------
clas... | true |
b9dae469ac52d0ead5a590425cc176950388ec55 | Sgggser/python_homework | /hw17.py | UTF-8 | 309 | 3.09375 | 3 | [] | no_license | def solve_quadratic_equation(a, b, c): #returns 2 values: either 2 roots, 1 root and none, 2 Nones
discrim = b*b - 4*a*c
if discrim > 0:
return ((-b + discrim**0.5)/ (2*a), (-b - discrim**0.5)/ (2*a))
elif discrim == 0:
return (-b / (2*a), None)
else:
return None, None | true |
7223991c204fe41b96e2e05105bf08fc0f81980d | michaelrkost/LocalPyUtilities | /ibUtils/buildExcelDiary.py | UTF-8 | 6,880 | 2.796875 | 3 | [] | no_license |
import sys
from pathlib import Path
sys.path.append('/home/michael/jupyter/local-packages')
import pandas as pd
import os.path
from localUtilities import dateUtils
theBaseCompaniesDirectory = '/home/michael/jupyter/earningDateData/Companies/'
csvSuffix = '.csv'
excelSuffix = '.xlsx'
# ============================... | true |
ebc7653f1db9b3510522f7b192dda9227a01d837 | geneahn/nomadiq_repo | /collaborative_filter.py | UTF-8 | 2,659 | 2.9375 | 3 | [] | no_license | # General libraries.
import numpy as np
import pandas as pd
import pickle
import boto3
import sys
# Set S3 environment
client = boto3.client('s3')
resource = boto3.resource('s3')
my_bucket = resource.Bucket('sagemaker-nomadiq-data')
# for object in my_bucket.objects.all():
# print(object)
my_bucket.download_file('... | true |
bfc296b3c1570a3386feaa975c3c7c3356539950 | noelkonagai/Machine_learning | /HW1 - Perceptron/ReadEmails.py | UTF-8 | 2,594 | 2.765625 | 3 | [] | no_license | import timeit, json
import numpy as np
features = []
stop = 0
f_train = open('spam_train.txt', 'r')
f_test = open('spam_test.txt', 'r')
f_words = open('words_dict.txt', 'r')
f_frequency = open('words_frequency.txt', 'w')
f_words_5000 = open('words_dict_5000.txt', 'w')
f_frequency_5000 = open('words_frequency_5000.tx... | true |
03f062c2fe1131975df5993e93598d010391a940 | Equinox4/Enigma | /enigma.py | UTF-8 | 2,159 | 3.390625 | 3 | [] | no_license | #!/usr/bin/python3
from string import ascii_uppercase
from random import seed, sample
from sys import exit
ALPHABET = list(ascii_uppercase)
ROTORS_CONF = [
{ 'seed': '7', 'position': 'U' },
{ 'seed': '4', 'position': 'H' },
{ 'seed': '9', 'position': 'G' },
]
PERMUTATIONS = {
'J': 'K',
... | true |
2f0cbe95a2b218fdae85028da11c8979ac068e03 | barraponto/supersalarios | /supersalarios/spiders/dgrh.py | UTF-8 | 1,394 | 2.609375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import csv
from itertools import islice
import scrapy
class DgrhSpider(scrapy.Spider):
name = "dgrh"
allowed_domains = ["siarh.unicamp.br"]
custom_settings = {
'CONCURRENT_REQUESTS': 1,
'DOWNLOAD_DELAY': 6
}
search_url = ('http://www.siarh.unicamp.br/'
... | true |
8e5bf135247dfedf48ff80d87728fd0fe41c7782 | GuillaumeLe/mba-apriori-python | /test.py | UTF-8 | 3,204 | 2.890625 | 3 | [
"MIT"
] | permissive | import unittest
from apriori import *
class AprioriTest(unittest.TestCase):
def test_getDistinctElt(self):
transactions = [
['A','B','D','E'],
['C','A','D','B','F'],
['D','A','H','B','C'],
['E','F','B','C','E']
]
self.assertEqual(
... | true |
a8267928c216d417e2322564374f6068a1259060 | Helix720/crawler | /setup.py | UTF-8 | 1,398 | 2.703125 | 3 | [] | no_license | # coding: utf-8
import os
# --> colors
O = "\033[0m"
R = "\033[91m"
G = "\033[32m"
Y = "\033[93m"
B = "\033[94m"
PASS = G + "[+] " + O
ERROR = R + "[-] " + O
INFO = B + "[!] " + O
def setup():
print PASS + "Let's install the tool :)"
try:
import socks
except ImportError:
print ERROR + "Module socks not insta... | true |
cd42dc7b6c67429a296d250440526ca9f5abdb6d | yortug/electoral-campaign | /data_structures/DSAHash_test.py | UTF-8 | 4,937 | 3.171875 | 3 | [] | no_license | from DSAHash import *
#from Processing import *
#import matplotlib.pyplot as plt
## REMEMBER TO UNCOMMENT OUT THE RETURN STATEMENT ON THE PUT() FUNCTION WHEN SHOWCASING TEST FILE
# FITS TABLE?
# PROPERTY 1: YES... all hashed indexes are mod'd by the length of the current hash table, thus it is
# impossible for them t... | true |
e82331e5fa89e6b3299b2b0f27aa49f40ad6da99 | fresty/chinese-subtitle-ocr | /tools/detection/generate_dataset_artificially.py | UTF-8 | 4,419 | 2.8125 | 3 | [
"MIT"
] | permissive | import csv
import os
import random
import numpy as np
from PIL import ImageFont, ImageDraw, Image, ImageFilter, ImageEnhance
IMAGE_SIZE = (300, 300)
ITERATIONS = 1
OUTPUT_FILE = "output.csv"
OUTPUT_FOLDER = "images_output"
IMAGE_FOLDER = "images"
RESIZE = True
FILTER = Image.NEAREST
KEEP_ASPECT_RATIO = False
RANDOM_... | true |
46ebe9fc18f0a0d599303e55d8e4db21a5266e74 | moak13/GroceriesMaster | /NewGroceries.py | UTF-8 | 1,438 | 3.171875 | 3 | [] | no_license | #! /usr/bin/env python2.7
#Ryan Fu 2015
from xlrd import open_workbook
import sys
excelFile = 'groceries.xls'
print excelFile
xls = open_workbook(excelFile)
for sheets in xls.sheets():
lists = [[] for _ in xrange(100)]
counter = 0
for row in range(sheets.nrows):
for col in range(sheets.ncols):
... | true |
87377768e7ff66d8ff0cbd7efea1d8fd372115dc | rorybolt/learning_python | /hydrophobicity.py | UTF-8 | 3,000 | 2.890625 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
import argparse
import biotools as bt
# Write a program that computes hydrophobicity in a window
# Let the user choose the method (see below)
# https://en.wikipedia.org/wiki/Hydrophilicity_plot
# https://en.wikipedia.org/wiki/Hydrophobicity_scales
# setup
parser = argparse.ArgumentParser(
... | true |
c1e2e6d4b59fcbf6a301de8494eeb10b32776c31 | aswinipk/30-Days-of-code | /Day1.py | UTF-8 | 1,193 | 4.65625 | 5 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# # Data Types
#
#
# Complete the code in the editor below. The variables i,d , and s are already declared and initialized for you. You must:
#
# Declare 3 variables: one of type int, one of type double, and one of type String.
# Read 3 lines of input from stdin (according to... | true |
166135780aa385ce4dcd968e4812d5f801956c3a | app-johndpope/ST | /msservice/api/learning_module/ml/mlp.py | UTF-8 | 6,279 | 3.078125 | 3 | [] | no_license | '''
A Multilayer Perceptron implementation example using TensorFlow library.
This example is using the MNIST database of handwritten digits
(http://yann.lecun.com/exdb/mnist/)
Author: Aymeric Damien
Project: https://github.com/aymericdamien/TensorFlow-Examples/
'''
import tensorflow as tf
import numpy as np
import os
... | true |
ff0863395cd9032081ec248489e9b6fb6da4e33d | saikpr/short_codes | /py/MultiThread_Matrix_Multiplication_clear.py | UTF-8 | 1,429 | 3.453125 | 3 | [] | no_license | from __future__ import print_function
import threading
from time import time
from random import randint
class matrixThread(threading.Thread):
def __init__(self,mat1,mat2,row,colm,size):
threading.Thread.__init__(self)
self.colm=colm
self.row=row
self.size=size
... | true |
3dc2ebe0de699d3b691304b7047dde35f8a5efbf | tut-tuuut/advent-of-code-shiny-giggle | /2020/14/code.py | UTF-8 | 3,308 | 3.0625 | 3 | [
"MIT"
] | permissive | import re
import itertools
from collections import defaultdict
import utils as u
with open(__file__ + ".input.txt", "r+") as file:
raw_input = file.read()
example_program = """mask = XXXXXXXXXXXXXXXXXXXXXXXXXXXXX1XXXX0X
mem[8] = 11
mem[7] = 101
mem[8] = 0"""
# mem[33783] = 33161
MEMORY_INSTRUCTION = re.compile(... | true |
f70bad9770d843dbfdd6197d9a7751c0768174e4 | ai-guild/SQuADQA | /framework/datapoint.py | UTF-8 | 628 | 2.828125 | 3 | [] | no_license | import sys
from info import highlighted_answer
from nltk import word_tokenize
'''
Datapoint
- dataitem (dict of field-value pairs)
'''
class Datapoint(object):
def __init__(self, dataitem):
self.dataitem = dataitem
# unique index
self._idx = dataitem.get('idx')
# sep... | true |
290870b151ef4caf4781c29d1101ece8e6846e0c | YumaRuchi/m03 | /python/deures/ejercicio-pares/ejercicio-pares.py | UTF-8 | 293 | 4.34375 | 4 | [] | no_license | #Lee un número del teclado
#Si es par: Escribe “Qué bonito número par”
#Si es impar: Escribe “Qué número más vulgar”
#Pista: usar módulo %
numero=int(input("Introduce un numero"))
if(numero%2==0):
print("Qué bonito número par")
else:
print("Qué número más vulgar")
| true |
a0bfa32a63bf33af8bdc9ed5285672a99d3400b8 | praffulmanwani/MachineLearning-Python | /k means clustering.py | UTF-8 | 1,187 | 3.125 | 3 | [] | no_license | #import libraries
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
#load data set into x varibale
dataset = pd.read_csv("Mall_Customers.csv")
x = dataset.iloc[:,[3,4]].values
#find the optimal no of clusters
from sklearn.cluster import KMeans
wcss = []
for i in range(1,11):
kmeans =KMeans(n_c... | true |
9a43170c25a6f067050cdd25011647aa3a215e60 | AshutoshFreak/Codeforces_Solutions | /SuffixThree.py | UTF-8 | 220 | 3.53125 | 4 | [] | no_license | t = int(input())
for i in range(t):
word = input()
if word[-2:] == 'po':
print('FILIPINO')
elif word[-4:] == 'desu' or word[-4:] == 'masu':
print('JAPANESE')
else:
print('KOREAN')
| true |
d0248c1c877e0a685d7657816134a10302cd913a | ethanrowe/python-merky | /merky/serialization.py | UTF-8 | 821 | 3.078125 | 3 | [
"MIT"
] | permissive | import json
def _json_default(item):
try:
return item.__merky_annotated__
except:
raise TypeError(
"object of type %s is not JSON-serializable." % str(type(item)))
def json_serializer(sort=True):
"""
Returns a function that can serialize to JSON, with unicode enabled,
... | true |
9b6e3e7c7822e20392c7ab5f10585aee13a06ddc | Jameskelsom/Download-Manga | /DownloadManga.py | UTF-8 | 4,926 | 2.90625 | 3 | [] | no_license | import requests
import os #sistema ope
from bs4 import BeautifulSoup #atualizado
import re
from tqdm import tqdm #progressbar
import requests_cache #criar o cache de todos os requests
requests_cache.install_cache('DownloadManga_cache')
class downloadManga:
def setUp(self, manga):
self.url_base = 'http://c... | true |
8a573c2291449ee95d4930cf9c92eed43a4f09da | ShubhShukla12/PPCN | /train/models.py | UTF-8 | 6,506 | 2.640625 | 3 | [] | no_license | import tensorflow as tf
from ops import *
def teacher(input_image):
input = adjust_contrast(input_image)
with tf.variable_scope("generator_t"):
W0 = weight_variable([1, 7, 3, 16], name="W0") # shape=[filter_height, filter_width, in_channel, out_channel], name
b0 = bias_variable([16], name="b0"... | true |
1d0035db543cd16aec7a40b3cc1e55e27d8ee3c4 | dentrado/machine-learning-project | /rotational-forest.py | UTF-8 | 2,719 | 3.21875 | 3 | [] | no_license | __author__ = 'roc'
import csv
import mdp
import random
import scipy
import scipy.stats as stat
#################################################
#Stuff that is done elswhere
#################################################
#Guillaume part???
def split():
return []
#############################################... | true |
f16f655671470a6f0b1717a655f3498b41419e2b | vanavski/Data-Science | /AD/Python/PracticeTask/CompareORGANICSPolinom&LogisticROCcurve/p&l.py | UTF-8 | 3,860 | 2.8125 | 3 | [] | no_license | #TODO: need to know how change or throw out miss values, how to convert string type to float
import numpy as np
np.random.seed(10)
import matplotlib.pyplot as plt
#from sklearn.datasets import make_classification
from sklearn.linear_model import LogisticRegression
from sklearn.ensemble import RandomForestClassifier
... | true |
708b36e22a6a3aaa42d061e5394a51af55db4f8e | Moremar/advent_of_code_2015 | /day14/script2.py | UTF-8 | 1,111 | 3.078125 | 3 | [
"Apache-2.0"
] | permissive | from day14.script1 import parse
def solve(deers):
state = {}
for deer_name in deers:
state[deer_name] = {"score": 0, "distance": 0}
# play the race turn by turn
top_deers = []
top_distance = 0
for turn in range(1, 2503 + 1):
for deer_name in deers:
deer = deers[dee... | true |
40eaec8afd33a5c21dfd53101b112873ab495e51 | xionghhcs/leetcode | /huawei/53.py | UTF-8 | 282 | 2.765625 | 3 | [] | no_license | class Solution:
def maxSubArray(self, nums: List[int]) -> int:
ans = 0
max_val = -1e10
for v in nums:
ans += v
if ans > max_val:
max_val = ans
if ans < 0:
ans = 0
return max_val
| true |
5164e3d040d3bfe3ed019cec6a0e953a47fbb0f3 | alexcolombari/Pymail-Sender | /interface.py | UTF-8 | 2,381 | 2.9375 | 3 | [
"MIT"
] | permissive | import smtplib
import webbrowser
from tkinter import *
def main():
def connect():
#try:
server = smtplib.SMTP('smtp.gmail.com', 587)
server.ehlo()
server.starttls()
print('Server connected!')
msg_status.config(fg = 'green', text = 'Connected!')
msg_status.pl... | true |
fa3b7b5b283d493b791e8f72cb62f52863fec786 | JurgenKniest/TICT-V1PROG-15 | /Practice Exercises Les 2/pe2_1.py | UTF-8 | 150 | 3.140625 | 3 | [] | no_license | letters = ('A', 'C', 'B', 'B', 'C', 'A', 'C', 'C', 'B')
A = letters.count('A')
B = letters.count('B')
C = letters.count('C')
ABC = [A,B,C]
print(ABC)
| true |
ef9dca9e92b8e54a85535af29590bd4aafc2a026 | ZuchniakK/ComputationalPhysics | /ComplexNetworks/GraphDensity.py | UTF-8 | 8,782 | 2.96875 | 3 | [] | no_license | import networkx as nx
import matplotlib.pyplot as plt
import numpy as np
def calculate_weights(G, initial_nodes, pos, edge_dict, show=False):
nodes_distance = {}
nodes_weight = {}
nodes_distance[initial_nodes] = 0
nodes_weight[initial_nodes] = 1
actual_neighbors = []
done_nodes = [initial_node... | true |
1eb65e24115850589b8734a3df148e2bfa6cee05 | TristanTrim/mbrl-practice | /A1/TT_vi_and_pi.py | UTF-8 | 9,923 | 3.5625 | 4 | [] | no_license |
### MDP Value Iteration and Policy Iteration
import numpy as np
import gym
import time
from lake_envs import *
np.set_printoptions(precision=3)
"""
For policy_evaluation, policy_improvement, policy_iteration and value_iteration,
the parameters P, nS, nA, gamma are defined as follows:
P: nested dictionary
... | true |
4ea90302e3fa9c87c07f3442ccf32c8df5658d1d | hbouvier/spacy-poc | /analyze.py | UTF-8 | 2,749 | 3.34375 | 3 | [] | no_license | import spacy
import collections
# Load a document and parse it.
def analyze(nlp, filename):
# Load the Moby Dick book from the Gutenberg project (downloaded by the Makefile)
# the `raw_document` will contain the whole book as one big string
mobydick_file = open(filename)
raw_document = unicode(mobydick_file.r... | true |
92413fe28e7e7e372c92fa27bedc3ba510706470 | cafecinqsens/PY | /Chapter12_185_1.py | UTF-8 | 1,150 | 3.765625 | 4 | [] | no_license |
import pandas as pd
from numpy import NaN
robots = [
[24, 23680],
[35, NaN],
[46, 47350],
[27, NaN]
]
print(robots)
data = pd.DataFrame(robots, columns=['max_speed', 'price'])
mean = data['price'].mean() # price 항목의 평균을 연산
data.replace(NaN, mean) # 결측을 하기 위해 NaN을 mean으로 대체하겠다는 의도
print(data) # 이전에도 설명했지만... | true |
0bdc906703acdc2baae5d04cd06ae209b09d71e5 | samanthadrago/lgtm_bot | /lgtm.py | UTF-8 | 3,704 | 2.625 | 3 | [] | no_license | from base64 import b64decode
import boto3
from datetime import datetime, timedelta
import re
import os
import random
from slacker import Slacker
pr_match = re.compile(r'<https:\/\/github\.com\/DataDog\/.+\/pull\/\d+>')
ENCRYPTED = os.environ['SLACK_TOKEN']
DECRYPTED = boto3.client('kms').decrypt(CiphertextBlob=b64dec... | true |
f6f8b345074e21baf91ec49d7cee0925f0f083cd | lordloop4700/Playground | /python/2_botten.py | UTF-8 | 575 | 3.1875 | 3 | [] | no_license | from tkinter import *
root = Tk()
root.title("gui programming")
btn1 = Button(root, text="버튼1")
btn1.pack()
btn2 = Button(root, padx=5, pady=10, text="버튼2222222222222")
btn2.pack()
btn3 = Button(root, width=10, height=3, text="버튼3")
btn3.pack()
btn4 = Button(root, fg="red", bg="yellow", text="버튼4")
btn4.pack()
ph... | true |
a8ae2efad088ff6cdf37ae76a688fd4e042ec5f9 | linvis/leetcode | /linked_list/142_Linked_List_Cycle_II/solu.py | UTF-8 | 1,639 | 3.734375 | 4 | [] | no_license |
# 题目:判断链表中是否有回路,并返回回路的第一个节点
# 思路:限制O(1)空间复杂度的前提下,快慢指针,当使用快慢指针找到回路后,
# 此时快慢指针有可能停在回路中的任意一个节点上,因此,从头开始,
# 依次检查该节点是否在回路内, 该方法时间复杂度很高
# Definition for singly-linked list.
# class ListNode(object):
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution(object):
... | true |
49c6a44e7bcca9455d7ac0d514ed066390023290 | bksaini078/Python-PageRank | /PageRank.py | UTF-8 | 3,139 | 3.515625 | 4 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# In[1]:
import pandas as pd
def adjacencyMatrix(Nodes_Detail,Connec_Details):#,Connec_Details
length_M=len(Nodes_Detail)
#print(length_M)
#creating Adjacency Matrix with 0 connections
Adj_Matrix=[]
for i in range(length_M):#Adjacency Matrix created with no ... | true |
9916025d3ed0a731b7261f9c28a84a94ae2d0dad | gitter-badger/AgentNet | /agentnet/experiments/boolean_reasoning/__init__.py | UTF-8 | 7,899 | 3.125 | 3 | [
"MIT"
] | permissive |
__doc__="""
This is a dummy experiment setup that requires agent to make advantage of
a simple logical formula in order to maximize expected reward.
The world agent exists in has a number of boolean hidden factors:
X1, X2, X3, Y1, Y2.
The factors are not independent. Namely,
- Y1 is true if X1
- Y2 is true if not... | true |
173797c583a7af237f4c4422e02786731eb72858 | JohnDMcMaster/project2064 | /fuzzer/clb_lut/theorem.py | UTF-8 | 2,414 | 2.609375 | 3 | [
"ISC"
] | permissive | '''
Given CLB_NM
N row => frame bit offset
M col => frame number
'''
lut_r2off = {
'A': 0x3e,
'B': 0x36,
'C': 0x2e,
# +
'D': 0x25,
'E': 0x1d,
'F': 0x15,
# +
'G': 0x0c,
'H': 0x04,
}
# Potential vs observed
# LUT_NOFF = 0x08
LUT_NOFF = 0x02
lut_c2frame = {
'A': 0x8b,
'... | true |
2d39adf2f23968e83327bc61eaf852862bcaaa9f | andriiburka/Web-Development-with-Python | /course2_python_fundamentals/07-Dictionaries/tmp/3E_Legendary_Farming.py | UTF-8 | 2,347 | 2.90625 | 3 | [] | no_license | legendary_recipes = {'shards': 'Shadowmourne', 'fragments': 'Valanyr', 'motes': 'Dragonwrath'}
key_materials = {'shards': 0, 'fragments': 0, 'motes': 0}
do_i_get_legendary_item = False
junk = {}
while True:
if do_i_get_legendary_item:
break
else:
user_input = input().lower().split(" ")
... | true |
8661fc3a6d8bea78b77a0734a6f924515274718d | fmasanori/ED | /boyermoore.py | UTF-8 | 567 | 3.625 | 4 | [] | no_license | def boyermoore(p, t):
m = len(p)
n = len(t)
if m > n: return -1
pulo = [m for k in range(256)]
for k in range(m - 1): pulo[ord(p[k])] = m-k-1
pulo = tuple(pulo) #imutável é mais rápido
k = m - 1
while k < n:
j = m - 1
i = k
while j >= 0 and t[i] == p... | true |
001cfa8e2e140c92f5eeb66aafef738697ae9c32 | csmith50/AMSCO_Cipher | /Amsco_Cipher.py | UTF-8 | 3,374 | 3.875 | 4 | [] | no_license | def calcCollumnNumber(keyLength, stringLength):
colNum = [0] * keyLength
charNum = 1
indexCol = 0
counter = stringLength
while counter > 0:
colNum[indexCol] += charNum
counter -= charNum
indexCol = (indexCol + 1) % keyLength
if charNum == 1:
charNum = 2
... | true |
468f51c8e283b1cb9b8da17ede79d2f66a159344 | Jcazub/AutomateTheBoringStuffProjects | /commaCode.py | UTF-8 | 336 | 3.625 | 4 | [] | no_license |
def convertToSentence(passedList):
sentence = ""
for i in range(len(passedList)):
if i == len(passedList) - 1:
sentence += "and " + str(passedList[i])
else:
sentence += str(passedList[i]) + ", "
return sentence
print(convertToSentence(['spam','eggs','bacon', '... | true |
73b05b21a9531990add1e9233be7da2b7cc3a2fc | air-upc/chimera | /chimera/py/leetcode_82.py | UTF-8 | 941 | 3.6875 | 4 | [
"MIT"
] | permissive | # coding=utf-8
"""
chimera.leetcode_82
~~~~~~~~~~~~~~~~~~~
Remove Duplicates from Sorted List II
Given a sorted linked list, delete all nodes that have duplicate numbers,
leaving only distinct numbers from the original list.
For example,
Given 1->2->3->3->4->4->5, return 1->2->5.
Given 1->1->1->2->3, return 2->3.
"... | true |
b69dd17cb246698801c23843c0b604a5126fde99 | abrianas/RLHW3 | /pendulum_reinforce_gaussianbaseline.py | UTF-8 | 8,210 | 3.046875 | 3 | [] | no_license | import numpy as np
import scipy.signal
import pdb
import matplotlib.pyplot as plt
from pendulum import *
class ContinuousPolicy(object):
def __init__(self, num_states, num_actions, no_rbf):
self.num_states = num_states
self.num_actions = num_actions
# here are the weights for the policy -... | true |
f5f652f746d22e39ae500fd2cc7a3ea1c926244a | Data-Wan/python-project-lvl1 | /brain_games/games/logic_for_brain_progression.py | UTF-8 | 1,259 | 3.703125 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""Module with logic for game brain_progression.
brain_brain_progression - game with random numbers
User must answer fill missed number in a arithmetic progression.
"""
import random
import prompt
def prog(): # noqa: WPS210
"""Return True or False, user input and right answer.
Tru... | true |
bf026c1354bc13dc18b33762e9b92f1709c9d114 | DerendeevaNastya/diploma | /key_skills_ready.py | UTF-8 | 6,450 | 2.6875 | 3 | [] | no_license | import re
import warnings
import numpy as np
import pandas as pd
from nltk.stem import SnowballStemmer
from sklearn.cluster import KMeans
from sklearn.decomposition import TruncatedSVD
warnings.filterwarnings("ignore")
pd.set_option("display.max_colwidth", 200)
from settings import stopwords, stem, clusters_count, main... | true |
299b12298398489e9423fb833f1ac61f9a420b65 | nicoddemus/ward | /tests/test_config.py | UTF-8 | 1,923 | 2.640625 | 3 | [
"MIT"
] | permissive | import tempfile
from pathlib import Path
import click
from ward import test, fixture, expect, raises
from ward.config import read_config_toml
def temp_conf(conf: str) -> tempfile._TemporaryFileWrapper:
with tempfile.NamedTemporaryFile(delete=False) as temp:
temp.write(bytes(conf, encoding="utf-8"))
... | true |
b4b279a40b82930c644a765b531039d80442a022 | Jose991019/PenarandaJose_Ejercicio18 | /kmeans_fotos.py | UTF-8 | 1,401 | 2.796875 | 3 | [
"MIT"
] | permissive | import glob
import numpy as np
import matplotlib.pyplot as plt
import sklearn.cluster
path = './Imagenes/*.png'
paths = glob.glob(path)
imagenes = []
for i in paths: imagenes.append(plt.imread(i))
imagenes = np.array(imagenes)
X = imagenes.reshape((87,-1))
inercias = []
for i in range(20):
k_means = sklearn.clus... | true |
9bb525e8d068e306d516716f60f4ff4735effed6 | nerewarin/adventofcode2019 | /15.py | UTF-8 | 6,975 | 3.578125 | 4 | [] | no_license | """
--- Day 15: Oxygen System ---
https://adventofcode.com/2019/day/15
"""
import collections
from _intcode_computer import IntcodeComputer
TILE2DRAW = {
0: '#',
1: '.',
2: '~',
-1: ' ',
}
class PathFinder:
def __init__(self, to_draw=False):
self.to_draw = to_draw
def find_oxygen... | true |
bee81a4d74555ae1213393d7cb74cb7aa56e5e6f | Nemecle/Heimdall | /markov_test.py | UTF-8 | 7,663 | 3.1875 | 3 | [] | no_license | #!/usr/bin/python
# -*- coding: latin-1 -*-
"""
markov chain experimentation
call by giving a original set of word to start with (more than nbrkey)
The program cut the given text by word, based on space
It takes a certain number (nbrkey) of following words, for instance two
by two, and associate to this tuple another... | true |
b30c5511ec62514a150fffbf458542ddb657fd46 | nazrulworld/fhirpath | /src/fhirpath/enums.py | UTF-8 | 3,004 | 2.515625 | 3 | [
"Apache-2.0"
] | permissive | # _*_ coding: utf-8 _*_
import enum
import operator
from typing import Any, Callable
__author__ = "Md Nazrul Islam <email2nazrul@gmail.com>"
class FHIR_VERSION(enum.Enum):
"""Release:str : Version:str """
DEFAULT: str = "R4"
STU3: str = "3.0.2"
R4: str = "4.0.1"
DSTU2: str = "1.0.2"
@static... | true |
f6188dbe93711b699784820506488116e5322878 | ssah0401/terraform-aws-shepherd | /scripts/create_csv.py | UTF-8 | 24,970 | 2.734375 | 3 | [
"MIT",
"LicenseRef-scancode-us-govt-public-domain",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | #! /usr/bin/env python3
"""
Recommended Glue environment:
Type: Python shell
Python version: Python 3 (Glue Version 1.0)
Glue Python job to create a timeframe-bounded CSV of policy or parent policy triggers from an Athena table.
Each row identifies a single policy hit captured by Shepherd DNS.
If a single req... | true |
84ac42f8a6415808175f3c0ac818db3d3c081f41 | StrykerEbanks-Robinson/tic-tac-toe | /main.py | UTF-8 | 2,714 | 4.1875 | 4 | [] | no_license |
# This is a game of tic-tac-toe that you can play against a human or bot!
import random
import Board
from Player_Information import Player
from Player_Information import define_players
import Turns
def play_again(player1, player2):
if player1.name == "quit" and player2.name == "quit":
Board.pause()
... | true |
76226bb5247eeb1f19629632be91e220e14399d1 | mnevadom/pythonhelp | /2_condicionales/Ejercicio1.py | UTF-8 | 441 | 4.71875 | 5 | [] | no_license | '''
Ejercicio 1:
Hacer un programa que pida 2 números y se de cuenta cuál de ellos es par,
o si ambos lo son.
'''
num1 = int(input("Digite un numero: "))
num2 = int(input("Digite otro numero: "))
if num1%2==0 and num2%2==0:
print("Ambos numeros son pares")
elif num1%2==0 and num2%2!=0:
print(f"{nu... | true |
51e21b3ebd03d91e561521130bbdc6995a57eff2 | alxgmpr/Monitor | /main.py | UTF-8 | 690 | 2.546875 | 3 | [] | no_license | # coding = utf-8
# Shopify Monitor
# By Alex Gompper https://github.com/alxgmpr
from classes.logger import Logger
from classes.monitor import Monitor
def main():
log = Logger('main').log
log('starting monitor')
with open('sites.txt') as sitelist:
sites = sitelist.read().splitlines()
log('lo... | true |
d00cb87ee6a85ac89156a43d5fb2547d711cbc80 | zm1046989153/Python | /socket/server.py | UTF-8 | 1,088 | 3.171875 | 3 | [] | no_license | #-*- coding:utf-8 -*-
import socket
from time import sleep
hostname=socket.gethostname()
HOST=socket.gethostbyname(hostname)
PORT=1234
#新建一个服务端,和客户端对象
s=socket.socket(socket.AF_INET,socket.SOCK_STREAM)
s.bind((HOST,PORT))
#设置监听最多两个,默认1
s.listen(2)
while True:
conn,addr=s.accept()#accept()等待客户请求一个连接
#conn是新... | true |
f28eebfc8ed48fc00f74c9552befc2174d542897 | Shibaram404/Example | /004_Python_function/basic_function.py | UTF-8 | 138 | 2.859375 | 3 | [] | no_license | def message():
print("Enter a value: ")
message()
a = int(input())
message()
b = int(input())
message()
c = int(input())
| true |
80382c491149c6d399c0467896db7e6110bfc0aa | chaerui7967/K_Digital_Training | /Python_KD_basic/Function/function_biltin.py | UTF-8 | 1,931 | 3.71875 | 4 | [] | no_license | #내장 함수 ~~all(내용) 내용이 모두 참일때 true, any() 내용이 하나라도 참이면 true
all(['','123',1])
any([0,1,2,3])
#아스키코드 chr
chr(65)
#문자를 아스키코드
ord('A')
#eval() 주어진 표현식을 계산해서 출력
eval('4+5')
#함수설명 help(함수)
#pow() 거듭제곱
pow(2,3) #8
#min , max
#divmod 몫과 나머지를 튜플형태 출력
divmod(7,3) #(몫,나머지)
#sum
#round() 반올림
round(9.87,1)
#abs 절댓값
#enumerate() 리스트 ... | true |
cc6cb3a5e251b45b5cf4f25b9d5464a57960233f | rivforthesesh/aoc-2020 | /19b.py | UTF-8 | 7,135 | 3.421875 | 3 | [] | no_license | # languages
# grab itertools for cartesian product
import itertools
# grab math for max number of repeats needed
import math
# input
with open('19.txt', 'r') as file:
input = file.read()
# turn the input into a list
input_list = list(input.split('\n'))
# read in the rules; these are up to the line... | true |
02d477620724b29b81c169a7d9495c63c9088fc7 | sammanthp007/Weirdos | /interview cake/40 nth fibonacci number.py | UTF-8 | 667 | 4.5 | 4 | [] | no_license | # Write a program that finds the nth fibonacci number
def get_nth_fibonacci_number(n):
fibo_number = {1:1, 2:1}
if (n in fibo_number):
return fibo_number.get(n)
for i in range(3, n + 1):
fibo_number[i] = fibo_number.get(i - 1) + fibo_number.get(i - 2)
return fibo_number[n]
n = 6
print... | true |
c5e88116702e7737650040bc533d4dabf2a3a687 | Jimmy-INL/google-research | /dedal/preprocessing/utils.py | UTF-8 | 9,066 | 2.53125 | 3 | [
"Apache-2.0",
"CC-BY-4.0"
] | permissive | # coding=utf-8
# Copyright 2022 The Google Research Authors.
#
# 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 applicab... | true |
c12ddfb644b1b34daf47380d0b3c75743dbef325 | ddoucette/apphost | /base/interface.py | UTF-8 | 12,208 | 2.703125 | 3 | [] | no_license | """
Interface class.
Provides basic threading functionality to enable processing
of received messages from 1 or more sockets, and processing
of commands from the protocol API layer.
"""
import threading
import time
import zmq
import types
from apphost.base import zhelpers, zsocket, log
class Interface... | true |
79c2742884118c146d140aa3c201ce61912e1edc | noraworld/ctfpack | /rot.py | UTF-8 | 1,237 | 3.4375 | 3 | [] | no_license | import sys
def rot(char, num):
if 'a' <= char <= 'z':
return chr((ord(char) - ord('a') + int(num)) % 26 + ord('a'))
elif 'A' <= char <= 'Z':
return chr((ord(char) - ord('A') + int(num)) % 26 + ord('A'))
else:
return char
def output(string, num):
result = (rot(char, num) for ... | true |
ae8f5f47e875a31082d8b9042bb70b0a879c0641 | CAfor2015/getwuhanitem | /wuhanitems/spiders/item_spider.py | UTF-8 | 1,423 | 2.578125 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import scrapy
from wuhanitems.items import WuhanitemsItem
class WhSpider(scrapy.Spider):
name = 'whspider'
allowed_domain = ['dianping.com']
start_urls = [
'http://www.dianping.com/search/category/16/45/g147'
]
def parse(self, response):
_root_url = '... | true |
4404f1005a79b2b38eab24242d524655be1f23eb | lftuo/spider | /com/spider/incrementalSpider/ScalableBloomFilter.py | UTF-8 | 348 | 2.5625 | 3 | [] | no_license | #!/usr/bin/python
# -*- coding:utf8 -*-
# @Author : tuolifeng
# @Time : 2017-12-2 18:52:44
# @File : ScalableBloomFilter.py
# @Software : IntelliJ IDEA
from pybloom import ScalableBloomFilter
sbf = ScalableBloomFilter(mode=ScalableBloomFilter.SMALL_SET_GROWTH)
count = 10000
for i in range(0,count):
sbf.add(i)
print... | true |
8248631435db7a76176adf0cdc909d84dc941f7a | kulala2014/LeetCode_python | /test_num.py | UTF-8 | 334 | 3.15625 | 3 | [] | no_license | import random
import itertools
def get_num_count():
data = [1,2,3,4,5,6,7,8,9]
result = [random.sample(data, 3) for i in range(len(data))]
return result
x = itertools.combinations(range(4), 3)
data = [1,2,3,4,5,6,7,8,9]
x = itertools.combinations(data, 3)
result = [i for i in list(x) if sum(i) == 15]... | true |
94c0ae6d4886ec1a07d0030ce6993aec7942bacb | Zaysman/PythonNestedFunctions | /NestedFunctions.py | UTF-8 | 933 | 4.09375 | 4 | [] | no_license | def outer():
def inner1():
def inner2():
def inner3():
v5 = "You just got dominated, Comrade."
print("inner3()")
print(v1 + ", " + v2 + ", " + v3 + ", " + v4 + ", " + v5)
#end of inner3
v4 = "You are like the c... | true |
f06e2bf2f1b9a1373ea5325228fe5c8639cfe5fd | drewgandy/spotcheck | /test.py | UTF-8 | 1,568 | 2.671875 | 3 | [] | no_license | from unidecode import unidecode
import config as cfg
import glob
import logging
s="Montréal, über, 12.89, Mère, Françoise, ñoël, 889"
#s.encode("ascii") #doesn't work - traceback
t=unidecode(s)
t.encode("ascii") #works fine, because all non-ASCII from s are replaced with their equivalents
print(t) #gives: 'Montreal... | true |
5bb2e7861c7b82b70fa8353cf491ce705e538651 | Karagul/Data-Science-Research | /Modulo 2/2.2 p-Values.py | UTF-8 | 1,131 | 3.140625 | 3 | [] | no_license | # MODULO 2 LAB 2 P-VALUES
# THE NULL HYPOTHESIS
# set seed to make random number generation reproducible
import numpy as np
import numpy.random as nr
from scipy import stats
nr.seed(51120122)
#collect a sample of 100 males
males = nr.normal(5, 3, 100)
#collect a sample of 100 females
females = nr.norm... | true |
07d214b22b6821a929c66b84c868ee1c7a506e58 | SohaibSaqib1/OSAssignments | /Shortest Job First.py | UTF-8 | 973 | 3.1875 | 3 | [] | no_license | process =[]
b_time = []
a_time = []
f_time =[]
w_time =[]
sum =int(0)
print "No. of processes"
n = input()
print "Arrival time is set at 0 for every process"
a_time = [int(0) for i in range(n)]
print "Burst time of the processes"
b_time = [input() for i in range(n)]
for i in range(n):
for j in range(n-... | true |
5a685a6bc6ff131b1fc3a507abe19debd21e09c6 | litaojun/unittestExBase | /opg/util/yamlOper.py | UTF-8 | 407 | 2.90625 | 3 | [] | no_license | from ruamel import yaml
#写json数据为YAML格式文件
def dumpDataToYmlFile(filePath = None,data = None):
with open(filePath, 'w', encoding="utf-8") as f:
yaml.dump(data,f,Dumper=yaml.RoundTripDumper, default_flow_style=False, allow_unicode=True)
def readYmlFile(filePath = None):
with open(filePath, 'r', encodi... | true |
2348dae39f317dfd8e088cf670f8e226f8f6b1bd | learningpeople/PythonTest | /python_test/HTTP/confighttp.py | UTF-8 | 6,557 | 2.609375 | 3 | [] | no_license | #eaort/bin/python
#-*- coding:utf-8 -*-
__author__ = 'xu'
import urllib
import configparser
#import urllib.parse
import json
import unittest
#from htmlreport import *
import htmlreport
html_report = htmlreport.HtmlReport()
class ConfigHttp:
"""
用于封装http请求方法,http头设置
"""
def __init__(self,host,port):
... | true |
18ea7ce1ea0a7aafc6eeb28bc4cd46426c13ab18 | SullyJHF/python-dev | /uni/tca/new_christmas.py | UTF-8 | 165 | 3.046875 | 3 | [] | no_license | with open('Words.txt', 'w') as write_file:
write_file.write('Merry Christmas!')
with open('Words.txt', 'r') as read_file:
text = read_file.read()
print(text)
| true |
fc43ce014c1188f3eac9fd47e9968f03dcab4242 | mymarilyn/clickhouse-driver | /tests/numpy/columns/test_low_cardinality.py | UTF-8 | 7,595 | 2.515625 | 3 | [
"MIT",
"Python-2.0"
] | permissive | try:
import numpy as np
except ImportError:
np = None
try:
import pandas as pd
except ImportError:
pd = None
from tests.numpy.testcase import NumpyBaseTestCase
# from decimal import Decimal
class LowCardinalityTestCase(NumpyBaseTestCase):
required_server_version = (19, 3, 3)
stable_support... | true |
979625ffd3b3e8b6eb5a6fb8f7d2df727180c867 | willsound/PyStu | /Python-Learn/1/catchhtml.py | UTF-8 | 613 | 2.71875 | 3 | [] | no_license | import urllib.request as request
import urllib.parse as parse
import string
def baidu_tieba(url, begin_page, end_page):
for i in range(begin_page, end_page + 1):
sName = 'd:/crawler/test/'+str(i).zfill(5)+'.html'
print('正在下载第'+str(i)+'个页面, 并保存为'+sName)
m = request.urlopen(url+st... | true |
9e20ff7ca5efba4c913523087265a1ebea80b594 | deepakbhavsar43/Python-to-ML | /Machine_Learning/Case_Study/Linear_Regression_Least_Square/Inbuilt/Inbuilt.py | UTF-8 | 522 | 3.46875 | 3 | [] | no_license | from sklearn.linear_model import LinearRegression
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
data = pd.read_csv("data.csv")
X = data.iloc[:, 0]
Y = data.iloc[:, 1]
X = np.array(X).reshape((-1,1))
linear_model = LinearRegression()
linear_model.fit(X, Y)
y_predict = linear_model.predict(X)
p... | true |
77d90cb81fc0d035e8f439e175db555bf4fd06ce | toniramon/CFGS_Web_Development_Dual | /Programacion/Python/Sudoku/numeroEnRango.py | UTF-8 | 2,214 | 3.9375 | 4 | [] | no_license | #Casos Tests: comprobar si los números del sudoku están comprendidos entre 1 y el máx de la línea.
"""
funciona pero no comprueba el caso 1.5
def numeroEnRango(sudoku):
for lista in sudoku:
for numero in lista:
if isinstance(numero, str) or numero <= 0 or numero > len(lista):
ret... | true |
0ed23ccf984b38584bad8dc3eeee1cc5e63a8f9e | theraaz/python-vdmlab | /vdmlab/utils.py | UTF-8 | 5,812 | 3.203125 | 3 | [
"MIT",
"BSD-3-Clause"
] | permissive | import numpy as np
from matplotlib.offsetbox import AnchoredOffsetbox
def find_nearest_idx(array, val):
"""Finds nearest index in array to value.
Parameters
----------
array : numpy array
val : float
Returns
-------
Index into array that is closest to val
"""
return (np.abs(... | true |
294fc4ea5fb58ed3fbaf4b9459a1ce5828406e8d | scottherlihy/personal-projects | /basketball/knapsack.py | UTF-8 | 9,282 | 3.015625 | 3 | [] | no_license | import math
import matplotlib.pyplot as plt
import random
from operator import add
from collections import namedtuple
from GetPlayers import _
players = _()
AVAILABLE_PGS = [player for player in players if 'PG' in player.position]
AVAILABLE_SGS = [player for player in players if 'SG' in player.position]
AVAILABLE_P... | true |
b7fd79c213c6ae881113df177a6b3f7fc53a1e7c | sindarusco/Python_learning | /scratches/check_primality.py | UTF-8 | 552 | 3.484375 | 3 | [] | no_license | def get_integer(help_text):
return int(input(help_text))
def get_remainder(x, y):
return int(x % y)
# number = get_integer('please input a number:')
#print(number)
number = 2^32 + 1
i = 2
while i < number:
if get_remainder(number,i) == 0:
print('this is not a prime number')
break
if ge... | true |
4b4da0656af99eeb7e8add48914779bbf5c20398 | edgarramos92/Ejercicio_Flask | /SnippetPy/video14.py | UTF-8 | 145 | 3.34375 | 3 | [] | no_license | #Snippet Codes for Python
#Video 14
a = []
i = 0
while i < 10:
b = float(raw_input('Please enter a number: \n'))
a.append(b)
i += 1
print a
| true |
f1750717c4ab4de71da28d8ddc670c1d6207005b | AP-MI-2021/lab-4-simona-sidau | /main.py | UTF-8 | 4,397 | 3.65625 | 4 | [] | no_license | from collections import Counter
def citire_lista():
"""
Citeste o lista de numere intregi cu n elemente
:param lst:
:return:
"""
lst=[]
n = int(input("Introduceti numarul de elemente: "))
for i in range(n):
lst.append(int(input("l[" + str(i) + "]=")))
return lst
def gaseste... | true |
f0a5c2ce633f78fca1f19a56b148ce851280e239 | r50206v/Leetcode-Practice | /Easy/21-MergeTwoSortedLists.py | UTF-8 | 2,521 | 3.578125 | 4 | [] | no_license | # My Solution
'''
Runtime: 40 ms, faster than 92.34% of Python3 online submissions for Merge Two Sorted Lists.
Memory Usage: 13.3 MB, less than 25.04% of Python3 online submissions for Merge Two Sorted Lists.
'''
# Definition for singly-linked list.
# class ListNode:
# def __init__(self, x):
# self.val = x
... | true |
102a7a97bd71780b448840828547cb4bb0e39d5c | gregzb/advent_of_code_2020 | /day23/b.py | UTF-8 | 1,915 | 3.21875 | 3 | [] | no_license | from collections import *
import math
import bisect
data = None
with open('in.txt') as f:
data = int(f.read().strip())
d = {}
class Node:
def __init__(self, val):
self.val = val
self.next = None
self.prev = None
def remove_3(node):
# 0 1 2 3 4
# node.prev is 0
# node is ... | true |
3b16908f70ce0b19324115e3149e31f00a2cf394 | MsRuby3108/pipx | /src/pipx/commands/list_packages.py | UTF-8 | 1,268 | 2.578125 | 3 | [
"BSD-3-Clause",
"MIT"
] | permissive | try:
# Instantiating a Pool() attempts to import multiprocessing.synchronize,
# which fails if the underlying OS does not support semaphores.
# Here, we import ahead of time to decide which Pool implementation to use:
# one backed by Processes (the default), or one backed by Threads
import multiproc... | true |
6d71b72b91fa0df87d8df4797e150784ade0de55 | monil-bansal/Graph-Visualiser | /bfs.py | UTF-8 | 813 | 3.109375 | 3 | [] | no_license | import pygame
import math
from queue import Queue
def reconstruct_path(came_from, current, draw):
while current in came_from:
current = came_from[current]
current.make_path()
draw()
def algorithm(draw, grid, start, end):
open_set = Queue()
visited = {start}
came_from = {}
open_set.put(start)
while not op... | true |
221dd601cfb16b70303398ba6d5e10fd1ed84b8a | mfalcirolli1/Python-Exercicios | /ex106.py | UTF-8 | 421 | 3.875 | 4 | [] | no_license | # Sistema interativo de ajuda em Python
from time import sleep
c = ('\033[m')
def ajuda(com):
help(com)
comando = ''
while True:
print('~' * 25)
print(' SISTEMA DE AJUDA PyHELP')
print('~' * 25)
sleep(1)
comando = str(input('Função ou Biblioteca >> ')).strip()
sleep(1)
if comando.up... | true |
d5332ef8fd3e0051c6876bbaf4b685da744db873 | rursino/carbon-cycle-feedbacks | /tests/test_inv_flux.py | UTF-8 | 7,089 | 2.75 | 3 | [] | no_license | """ pytest: inv_flux module.
"""
""" IMPORTS """
from core import inv_flux as invf
import numpy as np
import xarray as xr
from cftime import Datetime360Day
import pandas as pd
import pytest
""" SETUP """
def setup_module(module):
print('--------------------setup--------------------')
global original_ds, te... | true |