blob_id stringlengths 40 40 | language stringclasses 1
value | repo_name stringlengths 5 133 | path stringlengths 2 333 | src_encoding stringclasses 30
values | length_bytes int64 18 5.47M | score float64 2.52 5.81 | int_score int64 3 5 | detected_licenses listlengths 0 67 | license_type stringclasses 2
values | text stringlengths 12 5.47M | download_success bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|
383c7361273387eeaa932f37f850197e5645db7c | Python | vidstige/aoc | /2019/9.py | UTF-8 | 362 | 2.515625 | 3 | [] | no_license | from intvm import Intcode
def load():
with open('input/9') as f:
return f.read()
def parse(data):
return [int(d) for d in data.split(',')]
ex1 = [109,1,204,-1,1001,100,1,100,1008,100,16,101,1006,101,0,99]
ex2 = [1102,34915192,34915192,7,4,7,99,0]
ex3 = [104,1125899906842624,99]
vm = Intcode(parse(lo... | true |
791eaf79ad3525cc6e834f05a68afb344b25937a | Python | cassandrawendlandt/cs2613 | /labs/L14/test_client.py | UTF-8 | 558 | 2.765625 | 3 | [] | no_license | #!/usr/bin/python3
from client import approximate_size
def test_1000():
assert approximate_size(1000000000000) == "1.0 TB"
def test_1024():
assert approximate_size(1000000000000,True) == "931.3 GiB"
def test_4000_case1():
assert approximate_size(4000,a_kilobyte_is_1024_bytes=False) == "4.0 KB"
def test... | true |
e52fc844b1579e9471a5074a805426206ad34b60 | Python | SanjeevPhilip/Data-Science | /left_vs_right_baseball_batting.py | UTF-8 | 2,023 | 3.8125 | 4 | [] | no_license | import scipy.stats
import pandas as pd
def compare_averages(filename):
"""
Performs a t-test on two sets of baseball data
(left-handed and right-handed hitters).
The source file a csv file that has three columns. A player's
name, handedness (L for lefthanded or R for righthanded) and their
c... | true |
93bac76c3ed71fd3a052ad367adadff15f961081 | Python | sneharchalla/QAA | /Code/Combined_plot.py | UTF-8 | 2,331 | 3.25 | 3 | [] | no_license | #!/usr/bin/env python
import argparse, re
import gzip
import Bioinfo
import matplotlib.pyplot as plt
import numpy as np
def get_args():
parser = argparse.ArgumentParser(description ="A program to calculate quality score distribution per nucleotide")
parser.add_argument("-f1", required=True)
parser.add_argument("-... | true |
c7a457856454f624bd0a7c5897e2d73114cc0c48 | Python | Alexfordrop/Basics | /checkbut.py | UTF-8 | 572 | 2.78125 | 3 | [] | no_license | from tkinter import *
root = Tk()
root.title("GUI на Python")
root.geometry("300x250")
python_lang = IntVar()
python_checkbutton = Checkbutton(text="Python", variable=python_lang,
onvalue=1, offvalue=0, padx=15, pady=10)
python_checkbutton.grid(row=0, column=0, sticky=W)
javascrip... | true |
b326ed7a4490b032ad912e207c3d48523c4f36f3 | Python | WillCorrigan/advent-of-code | /day 3/day 3 part 1.py | UTF-8 | 523 | 3.140625 | 3 | [] | no_license | filename = "C:\\Users\\wcorr\\Desktop\\Advent of Code\\day 3\\data.txt"
with open(filename) as f:
content = f.readlines()
split_routes = [coord.strip() for coord in content]
number_of_trees = 0
x_coord = 0
y_coord = 0
while y_coord < len(split_routes):
if x_coord >= len(split_routes[0]):
x_coord -= l... | true |
3a4688346a8e6230c0bc2087ff11426e4714ace8 | Python | maurosilber/cherno1 | /cherno1/tests/test_common.py | UTF-8 | 1,371 | 3.078125 | 3 | [] | no_license | import numpy as np
from cherno1.common import find_first_equal, find_last_equal, similarity
from ward import test
def similarity_numpy(x, y):
return ((x == y) & (x != 1) & (y != 1)).sum()
def find_first_zero_numpy(x):
x = x == 0
if not x.any():
return None
else:
return x.argmax()
@... | true |
738391870e6a133787aedd602225f4e0df6e6b39 | Python | sperturbed/CQU_bigdata | /Experiment/Ex3_KmeansI/iris.py | UTF-8 | 1,776 | 3.125 | 3 | [] | no_license | #!/usr/bin/env python3
#coding: utf8
"""
@author: huangwanghui
@time: 2020/1/29 11:07
"""
from pyspark.sql import Row
from pyspark.ml.linalg import Vectors
from pyspark import SparkConf, SparkContext
from pyspark.sql import SparkSession
from kmeans import Kmeans
DATAPATH = 'hdfs://master:9000/ex/ex3dataset/iris.data... | true |
576509f2d65999296ee90ffb0eab36d7c2823b80 | Python | revoteon/aiokubernetes | /examples/multi_cluster.py | UTF-8 | 1,661 | 2.828125 | 3 | [
"Apache-2.0"
] | permissive | """Watch all namespaces in two clusters."""
import argparse
import asyncio
import aiokubernetes as k8s
async def watch_resource(cluster_name, resource, **kwargs):
async for event in k8s.Watch(resource, **kwargs):
print(f"{event.name} {event.obj.kind} {event.obj.metadata.name}")
async def start(kubeconf... | true |
88e265b32c982a179cb6d445d493be04eb53eec3 | Python | opmishra08/First-Repository | /MACHINE-LERNING/LogisticRegression12.py | UTF-8 | 812 | 3.34375 | 3 | [] | no_license | #Train a logistic regression classifier to predict verginica or not
from sklearn import datasets
from sklearn.linear_model import LogisticRegression
import numpy as np
import matplotlib.pyplot as plt
iris= datasets.load_iris()
# print(list(iris.keys()))
# print(iris['data'].shape)
# print(iris['target'])
# print(iris['... | true |
f5c5ba6040779fa8b0a87bf956179515a43bd2b2 | Python | free1002/poormans-git | /backup.py | UTF-8 | 1,054 | 2.515625 | 3 | [] | no_license | import subprocess
def git_add():
result = subprocess.check_output(['git', 'add', '.'])
print result
def git_register_removed():
result = subprocess.check_output(['git', 'status'])
not_staged_for_commit_deleted = []
mode_not_staged_for_commit = False
for e in result.splitlines():
if '# ... | true |
0e247377fa39334bec6c980f59006b0537d5471c | Python | samflahive/math_blocks | /tests/algebra/polynomials/creation/simple_polys.py | UTF-8 | 500 | 3.1875 | 3 | [] | no_license | import unittest
from math_blocks.algebra.polynomials import Variable, SimplePoly
class basic_simple_poly(unittest.TestCase):
def test_basic_latex(self):
x = Variable("x")
p = SimplePoly(coeffs=[1,-2,1], var=x)
self.assertEqual(p.latex(), "1x^{2}-2x+1")
def test_basic_eval(self):
... | true |
847623b9aee35a04b98750801ee48ae0a40223b4 | Python | tamslo/koala | /scripts/count_insertions_and_deletions/utils.py | UTF-8 | 742 | 2.84375 | 3 | [
"MIT"
] | permissive | import csv
import os
import re
insertion_type = "I"
deletion_type = "D"
def get_fields(line, min_fields):
fields = line.split("\t")
if len(fields) < min_fields:
print("[WARINING] Line is skipped because it is not tab separated")
return None
return fields
# def increase_values(values, line... | true |
d2dfcc7f88c81b537a7754883ab85654e78c24db | Python | nildiert/holbertonschool-machine_learning | /math/0x00-linear_algebra/4-line_up.py | UTF-8 | 271 | 3.75 | 4 | [] | no_license | #!/usr/bin/env python3
""" Function that adds two arrays element-wise """
def add_arrays(arr1, arr2):
""" Function that adds two arrays element-wise """
if (len(arr1) == len(arr2)):
return [x+y for x, y in zip(arr1, arr2)]
else:
return None
| true |
c3186a9b80bcd016fb7b4106fdddebff1229b500 | Python | 7vik/fake-news-ibm-hackathon | /Online-submission/author.py | UTF-8 | 3,441 | 3.03125 | 3 | [] | no_license | love = '''I suppose that only a single mountain-top,
the hideous monolith-crowned citadel
whereon great Cthulhu was buried,
actually emerged from the waters. When I
think of the extent of all that may be
brooding down there I almost wish to kill
myself forthwith. Johansen and his men
were awed by the cosmic majesty of ... | true |
6dcdcb5f4f7775623b2131370cd1c89d8ffa8459 | Python | gschen/sctu-ds-2020 | /1906101046-赵燕/day0229/作业3.py | UTF-8 | 134 | 3.21875 | 3 | [] | no_license | def list(x):
list1=[]
for i in x:
if i%2!=0:
list1.append(i)
return list1
print(list((1,2,3,4,5,6,7))) | true |
486db957697166fea289044cde2c23fa5cc4f692 | Python | fanshaohua001/tfnote | /code/tf_v.py | UTF-8 | 303 | 2.6875 | 3 | [
"MIT"
] | permissive | #tensorflow 1.2.1
import tensorflow as tf
var = tf.Variable(0)
add_operation = tf.add(var,1)
update_operation = tf.assign(var,add_operation)
with tf.Session() as sess:
sess.run(tf.global_variables_initializer())
for _ in range(3):
sess.run(update_operation)
print(sess.run(var))
| true |
2950e3d6d5be15a42df82e34449f68db4d4614d4 | Python | Deniz1999/SNAP | /main.py | UTF-8 | 1,032 | 3.53125 | 4 | [] | no_license | import random
import time
from threading import Thread
from player import Player
from deck import Deck
me = Player()
opponent = Player()
players = [me, opponent]
deck = Deck()
print("How many decks would you like to play with?")
numberOfDecks = int(input())
cards = []
for x in range(numberOfDecks):
deck = Dec... | true |
968f6e073cf3ebf305c72ed6a3a67da3f3780ddd | Python | Wannieee/HBA | /test.py | UTF-8 | 8,726 | 2.640625 | 3 | [] | no_license | import numpy as np
from matplotlib import pyplot as plt
from integrated_channel_and_test import channel_rss
def node_to_beam_idx(m, p):
# m is the binary number of beam. For example, beams = 128, m = log2(128) = 7.
# p is the list of tree p recorded in every iteration
# Obviously, when len(p) should is mo... | true |
cfe8f5dd4e723690346260bfa60ce583fe41f138 | Python | jsheradin/CAM | /autorun.py | UTF-8 | 2,488 | 2.734375 | 3 | [
"MIT",
"BSD-2-Clause"
] | permissive | # Begin autonomous run
import remote
import importlib
import logging
import multiprocessing
import motor
import lidar
port = 42071 # Port for communication
script = None # Runfile to execute
started = None # If thread has been run
# Get runfile from houston
def get_name(name):
global script
... | true |
544249615e14b5f44941abd3606b2e28fee0e503 | Python | pur3-extreme/arcanists_2_aimbot | /swag_farmer_2000.py | UTF-8 | 13,234 | 2.578125 | 3 | [] | no_license | import pyautogui as pag
import tkinter as tk
import math
import random
import time
from pynput import keyboard
default_center = (960, 540)
default_time = 1.5
max_power = 2110
min_v = 176.71
max_v = 559.76+min_v
default_radius = 100
g = 441.79473198085058122053071945108
# g = 442
y_offset = 0
dot_rad = 2
scribble = Tru... | true |
8a268ea6adedc41dc230e90cb81279435aa88ed8 | Python | Kaushik2804/Billing_System | /main.py | UTF-8 | 25,031 | 2.6875 | 3 | [] | no_license | from tkinter import *
import random, math, os
from tkinter import messagebox
class Bill_app:
def __init__(self, root):
self.root = root
self.root.geometry("1250x700+0+0")
self.root.title("Reciept Generator")
bg_color = "#17202A"
title = Label(self.root, text="FAS... | true |
1c94c0c49a7d8d0db47000f8031acabb19994f8b | Python | AugustoQueiroz/ODE-Solver | /plotter.py | UTF-8 | 687 | 3.34375 | 3 | [] | no_license | #-*- coding: utf-8 -*-
import matplotlib.pyplot as plt
class Plotter:
def print(self, problem, verbose=True):
print(problem.method_name())
if verbose:
for i, t in enumerate(problem.ts):
print("y(%f) = %f" % (t, problem.ys[i]))
else:
t = problem.ts[-1... | true |
20909f81a0515dce0c6bf297a62e298e4c38ffbf | Python | gbordyugov/playground | /coding/codility-and-leetcode/grocery-store.py | UTF-8 | 252 | 3.125 | 3 | [] | no_license | # Codility demo test
def grocery_store(A):
n = len(A)
size, result = 0, 0
for i in xrange(n):
if A[i] == 0:
size += 1
else:
size -= 1
return max(result, -size)
print(grocery_store([0, 1, 1, 1])) | true |
577ba7916271bd9d8bd8f539ca43869e57df8a51 | Python | xshi0001/base_function | /read_config.py | UTF-8 | 352 | 2.546875 | 3 | [
"Apache-2.0"
] | permissive | # -*-coding=utf-8-*-
__author__ = 'xda'
def getUserData():
f = open("data.cfg", 'r')
account = {}
for i in f.readlines():
ctype, passwd = i.split('=')
#print ctype
#print passwd
account[ctype.strip()] = passwd.strip()
return account
if __name__ == "__main__":
dat... | true |
16bcb54d6a63d859d4deccf1cfeb9f8fa3caea40 | Python | targueriano/MxM | /PyMxM_serial/pymxm_s.py | UTF-8 | 761 | 2.921875 | 3 | [] | no_license | """
* pymxm_s.py
*
* Created on: Jun 17, 2016
* Author: targueriano
*/
/*
* pymxm_s.py
*
* Created on: Jun 17, 2016
* Author: targueriano
"""
from random import randint
import numpy as np
SIZE = 1000
class MxM_serial:
def __init__(self,A,B,C):
self.A = A
self.B = B
self.C = C
def mu... | true |
d506b9ae6b0f2734d97be5707204b545aff87c93 | Python | metabismuth/esalg-week2-tarefa1 | /table.py | UTF-8 | 1,029 | 3.421875 | 3 | [] | no_license | from stack import Stack
class Table:
def __init__(self):
self.stacks = {
"tea": {
"cup": Stack(),
"plate": Stack()
},
"coffee": {
"cup": Stack(),
"plate": Stack()
}
}
def check_compatible(self, item):
wear = None
if item.wear == "cup": wear =... | true |
8486196e41c6f7012690cac84cb9c99bdf35ece2 | Python | jwelyl/trading_pigeon_backend | /tradingpigeon/service/trading_service.py | UTF-8 | 667 | 2.65625 | 3 | [] | no_license | from pandas_datareader import data
class TradingService:
def getTradingInfo(self, code: str, start_date: str, end_date: str):
"""
임시 : yahoo financial 정보 불러오기
Temp : Getting information of yahoo financial
"""
# TODO : code 불러오기, 코스피는 .ks, 코스닥은 .kq
# TODO 2 : 일단 stat... | true |
d79f3c58320b56e900e08b9972bc509c3d46cef8 | Python | duartecgustavo/PythonProgress | /desafios/Mundo 1/Ex019EXTRAcriadorDEaleatoriedades.py | UTF-8 | 255 | 3.859375 | 4 | [
"MIT"
] | permissive | import random
aleatorio = input('Digite algo que você \033[35mdeseja muito\033[m: ')
lista = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
escolha = random.choice(lista)
print (f'Sua chance de conquistar \033[35m{aleatorio}\033[m isto é de \033[31m{escolha}\033[m!') | true |
b41b0485445cd1258de2291a1949d59e97c2b870 | Python | DauletMaksut/Learn_Python | /Field_Cady||The_Data_Science/file6.py | UTF-8 | 464 | 3.34375 | 3 | [] | no_license | # Example of code, first code
import pandas as pd
import matplotlib.pyplot as plt
import sklearn.datasets as dts
def get_iris_df():
ds = dts.load_iris()
df = pd.DataFrame(ds['data'], columns = ds['feature_names'])
code_species_map = dict(zip(range(3), ds['target_names']))
df['species'] = [code_species_... | true |
6e05607abd491bd22187804d3b9499cf8e28f746 | Python | gabriell-ferreira/Atividade-Python | /ListaEncadeada.py | UTF-8 | 3,830 | 4.09375 | 4 | [] | no_license | class Node:
def __init__(self, name, age): # define as variaveis utilizadas
self.name = name
self.age = age
self.next = None
def getName(self):
return self.name
def setName(self, name):
self.name = name
def getAge(self):
return self.age
... | true |
7c788e1d532c1303f1ebda14faee226e1965f750 | Python | jeffreyziegler/PythonClass-2015 | /Class6-SortSearch/hw4/JZhw4_test.py | UTF-8 | 523 | 3.234375 | 3 | [] | no_license | import unittest
from JZhw4 import *
class JZhw4Test(unittest.TestCase):
def testInsertionSort(self):
x = [10, 5, 100, 3, 1, 19, 78, 0, 5, 34, 29]
insertion_sort(x)
for i in range(1, len(x)):
if x[i - 1] > x[i]:
print self.fail("Insertion sort failed.")
def testSelectionSort(self):
x = ... | true |
1387f5327fbdbed09c3873513c6bb39c734fcba7 | Python | F7Alexa/Aula_Entra21 | /aula12/tarefa_dados.py | UTF-8 | 202 | 3.671875 | 4 | [] | no_license | from random import randrange
lista = []
for i in range(100):
lista.append(randrange(1,7))
print(lista)
for i in range (1,7):
print(f'O número {i} apareceu', lista.count(i), 'vezes') | true |
e3b1316f30318aefc72598f57ecaeaac86ca2409 | Python | NeniscaMaria/AI | /1.RandomVariables/lab1TaskC/main.py | UTF-8 | 2,428 | 3.890625 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sat Feb 29 15:54:46 2020
@author: nenis
"""
from sudoku import Sudoku
from geometricForms import GeometricForms
from cryptoarithmeticGame import CryptoarithmeticGame
def showMenu():
print("\nPlease choose one from below:")
print("0.Exit")
print("1.Sudoku")
print(... | true |
e36874d80344468e186eda67437cb783bb7840f4 | Python | gabriellaec/desoft-analise-exercicios | /backup/user_366/ch88_2019_06_05_01_28_04_948995.py | UTF-8 | 383 | 3.609375 | 4 | [] | no_license | class Retangulo():
def __init__(self, ponto1, ponto2):
self.altura = ponto1.y - ponto2.y
self.largura = ponto1.x - ponto2.x
def calcula_perimetro(self):
self.perimetro = 2*self.altura + 2*self.largura
print(self.perimetro)
def calcula_area(self):
se... | true |
51d8990566af840b1336a602822a5cd3a98323f7 | Python | CharlieL7/BEM_analysis_scripts | /d_plot/old_code/deform_plot.py | UTF-8 | 2,193 | 3.109375 | 3 | [] | no_license | """
Makes the deformation parameter, defined as (x axis length - y axis length) / (x axis length + y axis length)
plots from raw simulation data.
DOES NOT ROTATE MESH.
This will only really make sense for extensional flows as the vesicle might
have some orientation outside of purely x or y axis
"""
import sys
import gl... | true |
53638913291d11cd7c1e2f0561c7a19bdb957c0f | Python | liusiqi/BME-PythonWrapper | /bmeapi_listSearchContacts.py | UTF-8 | 726 | 2.703125 | 3 | [
"MIT"
] | permissive | #Get the contact lists in your account.
from BMEApi import *
import config
client = BMEApi(config.USERNAME,config.PASSWORD,config.APIURL)
if client.isLogin:
# Login Successful
emailAddress = "sanketdsawant@gmail.com"
result = client.listSearchContacts(emailAddress)
if client.isOk:
print "sequence | id | listna... | true |
9609b455505670571bb5771497933521e8565a62 | Python | andreaslundin47/Advent-Of-Code-2020 | /day24/day24.py | UTF-8 | 1,980 | 3.734375 | 4 | [] | no_license | from dataclasses import dataclass
# Tile values: White => False, Black => True
# x-axis: horizontal toward east
# y-axis: Diagonally toward north east
deltas = {'e':(1,0), 'se':(1,-1), 'sw':(0,-1), 'w':(-1,0), 'nw':(-1,1), 'ne':(0,1)}
@dataclass
class Path:
path: [str]
def parse(text):
path = []
... | true |
2672739fce717c27c400cdb000e9cd87b132fd1e | Python | TrendingTechnology/handwritten-digit-recognition | /PythonScript/mnist_baseline_model.py | UTF-8 | 1,183 | 2.828125 | 3 | [
"MIT"
] | permissive | import tensorflow as tf
mnist = tf.keras.datasets.mnist
# loading data
(x_train, y_train),(x_test, y_test) = mnist.load_data()
# converting from 0-255 to 0-1
x_train, x_test = x_train / 255.0, x_test / 255.0
# building a model
model = tf.keras.models.Sequential()
# flatten first layer of neurons
model.add(tf.keras... | true |
16d46bf6dac31c3059f2cfa6f243b88c17463164 | Python | vredlight/Python | /Backtracking/nqueens.py | UTF-8 | 2,341 | 3.65625 | 4 | [] | no_license | '''
# prints one of the possible solution of the nqueens problem
# in nqueens problem, we try to place n queens in n*n board such that no queen attack any other queen
'''
def initialize(n):
for keys in ['queens','row','col','nwtose','swtone']:
board[k... | true |
946aaf85548279e8c3237149478fab587c11daad | Python | jxtsai/learn-to-code | /python/pp/average3.py | UTF-8 | 320 | 3.921875 | 4 | [] | no_license | print "Welcome to the average calculator, please insert a number"
currentaverage = 0
numofnums = 0
while True:
newnumber = int(raw_input("New number: "))
numofnums += 1
currentaverage = (round((((currentaverage*(numofnums-1) + newnumber)/numofnums), 3))
print "The current average is", str(round(currentaverage, 3))
| true |
94c6bcc51fe4f2c3aac392989df70f5c8a4db67c | Python | gregarendse/adventofcode | /2020/06/main.py | UTF-8 | 819 | 3.140625 | 3 | [
"MIT"
] | permissive | from typing import List, Set
count: int = 0
everyone_count: int = 0
with open('input.txt', 'r') as file:
read = file.read()
for group in read.strip().split('\n\n'):
answers: List = []
for person in group.split('\n'):
person_answers: Set[str] = set()
for answer in perso... | true |
71e7bc8fd205a302f7a367b4a44ee58d7fe5be1c | Python | vihowe/Algorithm | /leetcode/7_19.py | UTF-8 | 1,486 | 3.15625 | 3 | [
"MIT"
] | permissive | from curses.ascii import SO
class ListNode:
def __init__(self, val=0, next=None):
self.val = val
self.next = next
class Solution:
def detectCycle(self, head: ListNode) -> ListNode:
slow, fast = head, head
while fast and fast.next:
slow = slow.next
fast ... | true |
ea3cac62f474b8619a0307ef7f5cd00e90c5dcfc | Python | fooyou/Exercise | /python/lock.py | UTF-8 | 651 | 2.78125 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Author: joshua
# @Date: 2014-11-19 13:46:34
# @Last Modified by: joshua
# @Last Modified time: 2014-11-19 14:07:09
import threading
import time
counter = 0
mutex = threading.Lock()
class MyThread(threading.Thread):
def __init__(self):
threading.Thread._... | true |
f4c4e4e061d89449fe8bec4c062429877488c776 | Python | DianaSalk/ProgPrin2 | /TSIS 1/3_if.py | UTF-8 | 765 | 4.21875 | 4 | [] | no_license | # A максимум двух чисел
a=int(input())
b=int(input())
if(a>=b):
print(a)
else:
print(b)
# B какое число больше?
a=int(input())
b=int(input())
if(a>b):
print(1)
elif(a<b):
print(2)
else:
print(0)
# C знак числа
a=int(input())
if(a>0):
print(1)
elif(a<0):
print(-1)
else:
print(0... | true |
402f8732da25ec728b66fc94a7473261ad424550 | Python | hunkim/DeepLearningZeroToAll | /tf2/tf2-05-1-logistic_regression.py | UTF-8 | 856 | 3.5 | 4 | [] | no_license | # Lab 5 Logistic Regression Classifier
import tensorflow as tf
x_data = [[1, 2],
[2, 3],
[3, 1],
[4, 3],
[5, 3],
[6, 2]]
y_data = [[0],
[0],
[0],
[1],
[1],
[1]]
tf.model = tf.keras.Sequential()
tf.model.add(tf.keras.la... | true |
3d5611e098a9c9567790f63f72b22faa163bbbcb | Python | matefriki/DQfD | /load_data.py | UTF-8 | 16,169 | 2.65625 | 3 | [
"MIT"
] | permissive | # load_data.py
import urllib.request
import tempfile
import zipfile
import tarfile
import os
import numpy as np
import pandas as pd
import cv2
from experience_replay import PrioritizedExperienceReplay
from atari_preprocessing import atari_montezuma_processor
class LoadAtariHeadData:
"""
*****************... | true |
34dc3c9a29526c40be1dc66e1479296eeac1eef8 | Python | taohu88/primus | /test/impute/pandas/test_util.py | UTF-8 | 959 | 3.09375 | 3 | [
"MIT"
] | permissive | import numpy as np
import pandas as pd
from primus.impute.pandas import empty_to_none, strs_to_none
def test_empty_to_none():
df = pd.DataFrame({'A': ['', "Hello", "world"]})
print("\n")
print(df)
df2 = empty_to_none(df)
print(df2)
expected = pd.DataFrame({'A': [np.nan, "Hello", "world"]})
... | true |
c327454c594b4c557ac55c331536b089de083cb4 | Python | Marco9966/Python-for-Data-Science-and-Machine-Learning-Bootcamp | /1-numpy/1-numpy-arrays.py | UTF-8 | 2,538 | 4.09375 | 4 | [] | no_license | import numpy as np
# python list
my_list = [1, 2, 3]
print(str(type(my_list)) + ' - ' + str(my_list))
print('\n')
# numpy array
my_array = np.array(my_list)
print(str(type(my_array)) + ' - ' + str(my_array))
print('\n\n')
# python list of lists
my_list_of_lists = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
print(str(type(my... | true |
92fc81ea80c37b048a9151f8e809a6f75529e401 | Python | ttamse/Python_naloge | /loto.py | UTF-8 | 399 | 3.734375 | 4 | [] | no_license | # -*- encoding: utf-8 -*-
from random import randint
def loto_stevilke(stevilo):
iter = 0
stevila = []
while iter < stevilo:
st = randint(1, 39)
if st in stevila:
"""Do nothing"""
else:
stevila.append(st)
iter += 1
stevila.sort()
return s... | true |
a8fbbd399bbe2de2e94fb06ac2f570391aae0d2b | Python | qianrenjian/MachineLearning-7 | /MLCodes/Stocks/DataPreparation/DataProcess.py | UTF-8 | 4,299 | 2.5625 | 3 | [
"CC-BY-4.0"
] | permissive | import numpy as np
import pandas as pd
from sqlalchemy import create_engine
from pymongo import MongoClient
from DBOperation import DBOperation as DBOper
import DataPreparation.getStocks as gtStock
def getDetailInforForAllStocks():
df = DBOper.read_mongo('gupiaoDB','fulldata',None)
labels_df = df.columns.valu... | true |
e487bdc20873b22568d09ee7cab69cb1b12b25e4 | Python | casper01/AdventOfCode2018 | /18/main.py | UTF-8 | 2,699 | 3.5 | 4 | [] | no_license | """
Day 18: Settlers of The North Pole
"""
import copy
def getNeighs(grid, y, x):
neighs = []
for i in range(y - 1, y + 2):
for j in range(x - 1, x + 2):
if i == y and j == x:
continue
neighs.append((i, j))
ans = []
for pt in neighs:
if pt[0] < ... | true |
56e8d25cc842a3e147056e30822e9fee8c03d149 | Python | jDU4e67R4p/TelegramYouTubeSubscribersCounter | /parser.py | UTF-8 | 444 | 2.9375 | 3 | [] | no_license | import requests
def get_content(html):
findStr = '"subscriberCountText":{"runs":[{"text":"'
i = html.index(findStr) + len(findStr)
count = ''
while html[i] != '"':
count += html[i]
i += 1
return count
def parser(channel_url):
html = requests.get('https://www.youtube.com/channel/'+channel_url)
if html.statu... | true |
9e5e1fcb221c76f08ee45c3df48a5378ea0ffcd5 | Python | eilmiv/puzkox | /server/House.py | UTF-8 | 578 | 3.03125 | 3 | [] | no_license | from server.Square import Square
from time import time
import server.options as options
class House(Square):
def __init__(self, position, site_length=1, description="House"):
super(House, self).__init__(position, site_length, description)
self.last_hit = 0
def serialize(self):
damage ... | true |
470e1b621d093ebb358800520339de971804597e | Python | Craig-Robson/resilience_gui | /modules/metric_calcs.py | UTF-8 | 3,247 | 2.921875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Fri Sep 20 20:46:53 2013
@author: Craig
This stores all the metric calculation scripts
"""
import networkx as nx
def count(G):
degree_sequence=sorted(nx.degree(G).values(),reverse=True) # degree sequence
dmax=max(degree_sequence)
graph_count_1 = []
num_of_nod ... | true |
bb1f8940bfbf790bc0357721309ec33fb3df9c87 | Python | judyfun/python | /db-example/pymysql/mysqldb-demo1.py | UTF-8 | 545 | 2.703125 | 3 | [] | no_license | from __future__ import print_function
import sys
print(sys.version)
sql = ('SELECT * from users limit 10')
# MySQLdb
# print('MySQLdb'.center(50, '='))
# import MySQLdb
#
# def connect_mysql(db_host="localhost", user="root",
# passwd="root",db="test", charset="utf8"):
# conn = MyS... | true |
270b0328226712c0d8199adf6da75c34bfa067cb | Python | rohiniy/tripReco | /content_based_filetering.py | UTF-8 | 2,006 | 2.921875 | 3 | [] | no_license | import pandas
import numpy
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.metrics.pairwise import linear_kernel
varToPass = 'City'
#ignoring warnings
numpy.seterr(divide='ignore', invalid='ignore')
# get places data set
placesUrl = "./placesWithSpace.csv"
placesColumns = ['City_id', 'City', ... | true |
ae66c2dc4c2e6ccbaf945cc896f1bb2a85855dc2 | Python | satyamgupta8340/pythonassignment3 | /assign3q2.py | UTF-8 | 192 | 3.765625 | 4 | [] | no_license | # 2.Write a Python function to multiply all the numbers in a list¶
def multiplynum(num):
r= 1
for i in num:
r=r*i
return r
print(multiplynum)
multiplynum([2,2,2,4]) | true |
1e7cbb526b05575cf785ea76f6a633ccbb5704da | Python | siddarthjha/Python-Programs | /Tkinter/tk_2.py | UTF-8 | 318 | 3 | 3 | [] | no_license | import tkinter as tk
p = tk.Tk()
p.title('Fuck off giphy')
print('I have inserted a image on window to Mr.Jha')
p.geometry('400x400')
l1 = tk.PhotoImage(file='giphy.gif')
w = tk.Label(p, image=l1).pack(side='right')
w1 = tk.Label(p, justify=tk.LEFT, padx=10, text='Fuck off').pack(side='left')
p.mainloop()
| true |
9edadcb895d210f462988f38af7ed763a00a9f0a | Python | Kerman07/dijkstra-visualization | /dijkstra.py | UTF-8 | 4,363 | 3.265625 | 3 | [] | no_license | # Visualization of Dijkstra's pathfinding algorithm
import pygame as pg
from os import environ
from sprites import *
from settings import *
environ['SDL_VIDEO_CENTERED'] = '1'
class Dijkstra:
# main loop class
def __init__(self):
pg.init()
self.screen = pg.display.set_mode((WIDTH, HEIGHT))
... | true |
81fbae783a3bbec450b45a7559209334ddfec0d1 | Python | valdimirbarrosti/sistemaescolarharvard | /validarLogin.py | UTF-8 | 2,440 | 3.03125 | 3 | [] | no_license | ####validaLogin.py####
import sys #bibliotecas do sistema
contasCord =[['jose.renato' , 'jose123']]
boasVindas = 'Seja bem vindo(a)!\nVocê está logado como: {}'
### funcao que valida o login e senha no banco de dados SQLite3 ###
def validarLoginUsuario(login, senha):
contaProfessorExistente = 'nao'
... | true |
cda9a8f0a3117d6879a9c66474c45da70f7c1263 | Python | mbhushan/pycode | /hr_py_strings/join_string.py | UTF-8 | 111 | 3.25 | 3 | [] | no_license | # https://www.hackerrank.com/challenges/python-string-split-and-join
s = input().split(" ")
print("-".join(s))
| true |
281431e125545139d1d26f6b02705d4752e72d19 | Python | sarahvestal/ifsc-1202 | /Unit 1/content/01.00.06 Python Strings.py | UTF-8 | 434 | 4.65625 | 5 | [] | no_license | # String literals are surrounded by either single quotation marks,
# or double quotation marks.
print("Hello")
print('Hello')
# Blank Line
print("")
# Example of a multiline string
a = """Lorem ipsum dolor sit amet,
consectetur adipiscing elit,
sed do eiusmod tempor incididunt
ut labore et dolore magna aliqua.""... | true |
73117c201541f00e078fd236573801924978ab28 | Python | nadong/leetcode | /bianryTree/55_is_balanced_tree_easy.py | UTF-8 | 875 | 3.65625 | 4 | [] | no_license | """
输入一棵二叉树的根节点,判断该树是不是平衡二叉树。如果某二叉树中任意节点的左右子树的深度相差不超过1,那么它就是一棵平衡二叉树。
示例 1:
给定二叉树 [3,9,20,null,null,15,7]
3
/ \
9 20
/ \
15 7
返回 true 。
示例 2:
给定二叉树 [1,2,2,3,3,null,null,4,4]
1
/ \
2 2
/ \
3 3
/ \
4 4
返回 false
"""
class Solution:
def isBalanced(self, root... | true |
822e96bcefffc541beb72c03f6536e90819945a7 | Python | wangyongfei0306/Data-structure-and-algorithm | /Object_Oriented_programming/chapter3.py | UTF-8 | 2,948 | 2.96875 | 3 | [] | no_license | class Hand:
def __str__(self):
return ', '.join(map(str, self.card))
def __repr__(self):
return '{__class__.__name__} ({dealer_card!r}, {_cards_str})'.format(
___class__=self.__class__, __cards_str=', '.join(map(repr, self.card)),
**self.__dict__)
class Hand_Lazy(Hand)... | true |
1a6fbd1486799ae7ef2afb346c65f4149f09d863 | Python | guofenggitlearning/sssegmentation | /ssseg/modules/backbones/bricks/transformer/embed.py | UTF-8 | 1,607 | 2.625 | 3 | [
"MIT"
] | permissive | '''
Function:
Image to Patch Embedding
Author:
Zhenchao Jin
'''
import torch
import torch.nn as nn
import torch.nn.functional as F
from ..normalization import BuildNormalization
'''Image to Patch Embedding'''
class PatchEmbed(nn.Module):
def __init__(self, in_channels=3, embed_dims=768, kernel_size=16, st... | true |
96fb09b472cdfbba99eb1986eeaa4b5f51c75daa | Python | Nateque123/python_tutorials | /chapter18_files/2_w_a_r+_mode.py | UTF-8 | 452 | 3.421875 | 3 | [] | no_license | # w - Write mode
# a - append mode
# r+ - read and write mode
# with open('txt1.txt', 'w') as f:
# f.write('Hello, how are you?\n')
# with open('txt1.txt', 'a') as f:
# f.write('i am fine\n')
# with open('txt1.txt', 'r+') as f:
# f.seek(len(f.read()))
# f.write('good\n')
# how to write... | true |
b6a129885693ba135e00013bf12b0668184ad203 | Python | WandrilleD/ConcentricTree | /cropTree.py | UTF-8 | 3,078 | 3.265625 | 3 | [] | no_license | import networkx as nx
def computeAgeLineage(G,n):
""" compute the number of generation to the last (previous) speciation event """
age = 0
S = G.successors(n)
P = G.predecessors(n)
if len(S)>1:
return 0
elif len(P)==0: ## root of the tree
return 0
return 1 + computeAgeLi... | true |
d10d1e2f0cfbbf353f9d3c719e9a0a0b63b32784 | Python | AidenBurgess1992/CRUD-Python-App- | /ab-mini-project-main/src/persistence/core.py | UTF-8 | 943 | 3.21875 | 3 | [] | no_license | import csv
def read_data(filename):
data = []
with open(filename) as the_file:
for line in the_file.readlines():
data.append(line.strip())
return data
def write_data(filename, data):
with open(filename, mode="w") as the_file:
for row in data:
the_file.write(f"... | true |
b52ca1f04b92e26b30f45e7cd611bde3728d8c29 | Python | jf20541/BGRU-BLSTM-GloVe-fastText-NLP | /src/train.py | UTF-8 | 4,716 | 2.71875 | 3 | [
"MIT"
] | permissive | import pandas as pd
import numpy as np
from sklearn.metrics import accuracy_score, confusion_matrix, precision_score
from sklearn.model_selection import train_test_split
import torch
import tensorflow as tf
from keras.preprocessing.text import Tokenizer
from dataset import IMDBDataset
from bilstm_model import BILSTM
fr... | true |
173aea116666177c04ff48ee74e77b17f47042ca | Python | huangwenzi/MinYue | /qinShi/view/actorView.py | UTF-8 | 1,777 | 2.546875 | 3 | [] | no_license |
# 三方模块
import pygame
# 项目模块
import modules.view.viewVessel as viewVesselMd
import modules.view.viewBase as viewBaseMd
import modules.control.instanceMgr as instanceMgrMd
import qinShi.control.cfgMgr as cfgMgrMd
# 角色视图
class ActorView(viewVesselMd.ViewVessel):
# 左边的站立图像资源
left_stand = None
# 左边的战斗图像资源
... | true |
618b478ad6ec59b582775216215cab6237759a39 | Python | nathanhere/sharingan | /sharingan/main.py | UTF-8 | 9,507 | 2.671875 | 3 | [
"MIT",
"BSD-3-Clause"
] | permissive | import random
import sys
import os
from glob import glob
import cv2
import numpy as np
from tesseract import Tesseract
from constants import WINDOW, POINT_COLOR, SEGMENTED_PLACEHOLDER
class Image:
class THRESHOLD:
MEAN = cv2.ADAPTIVE_THRESH_MEAN_C
GAUSSIAN = cv2.ADAPTIVE_THRESH_GAUSSIAN_C
... | true |
196c7839cac805932eb439e9ff8ba13e26b86964 | Python | Quyetsama/PythonQ | /ToolHana/GiaiPt2tkinter.py | UTF-8 | 2,200 | 2.9375 | 3 | [] | no_license | from cmath import sqrt
from tkinter import *
from Makecenterlib import *
def Restart():
hesoa.set('')
hesob.set('')
hesoc.set('')
def Giai():
a=float(hesoa.get())
b = float(hesob.get())
c = float(hesoc.get())
# d=b**2-(4*a*c)
# x1=(-b-sqrt(d))/2*a
# x2 = (-b + sqrt(d)) / 2 * a
# ... | true |
2c100521e0f4d1d15ece04f4427b62da399fb41b | Python | opyate/linkbaiter | /linkbaiter/middleware.py | UTF-8 | 3,940 | 2.84375 | 3 | [] | no_license | import random
from scrapy.exceptions import IgnoreRequest
import re
from scrapy.exceptions import DropItem
from datetime import datetime
from hashlib import md5
from twisted.enterprise import adbapi
import os
class AlertRegexesPipeline(object):
"""A pipeline for alerting items which match certain regexes in their
... | true |
7e60ed8930a5776d1b133c65a811a72394250e95 | Python | clareisaacson/pid-neural-network | /pid_neural_net_xor.py | UTF-8 | 5,083 | 3.3125 | 3 | [] | no_license | import numpy as np
import random
class NeuralNet:
def __init__(self, num_hidden1, num_hidden2, learning_rate):
"""
Initialize the Neural Network.
:param num_hidden1: number of hidden units in the first hidden layer
:type num_hidden1: int
:param num_hidden2: number of hidden units in the second h... | true |
91218042907955ca16f7d34a38d039a00f90e881 | Python | grigart97/Algorithms_Python_GB | /HW_2/les_2_task_6.py | UTF-8 | 382 | 3.859375 | 4 | [] | no_license | from random import randint
m = randint(0, 100)
for i in range(10):
n = int(input('Постарайтесь угадать число: '))
if m == n:
print('Угадал')
break
elif m > n:
print('Загаданное число больше')
elif m < n:
print('Загаданное число меньше')
if m != n:
print(m)
| true |
338c47fd89bc9986a96640800771c42ca437a576 | Python | umitdincel/soyouhaveanidea | /menu.py | UTF-8 | 4,011 | 3.0625 | 3 | [] | no_license | #!/usr/bin/env python2
from collections import namedtuple
import curses
from curses import panel
class EntityDetail(object):
def __init__(self, entity, parent_window):
self.window = parent_window.derwin(15,0)
self.window.border(0,0,0,0,0,0,0,0)
self.window.addstr(entity.formatted)
... | true |
7f62fd0084c7bcd3a53ecd42a2efeb15c0587219 | Python | drewitz/VIPer | /pentagon.py | UTF-8 | 916 | 2.96875 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
import uppergeodesic as gd
import numpy as np
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('lengths', nargs = 2, type=float)
args = parser.parse_args()
# try 0.3 and 3
# should plot a pentagon in upper half space given two parameters whose
# logarithms are the side le... | true |
fcf0da2b995cb84386e8607a78d3357687e61af3 | Python | mohitbishnoi/Intermedaite-Python | /Data Extraction.py | UTF-8 | 1,482 | 2.734375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sun Mar 24 11:03:05 2019
@author: Mohit
"""
import pandas as pd
import numpy as np
import os
import pyodbc
os.chdir("C:/Users/Mohit/Desktop/Nikhil Analytics Material/Python/Python Part 2/Class 7/Assignments")
os.getcwd()
os.listdir()
#Reading Text Files - read_ta... | true |
e193b003eae5835331a1c2fae5991b651e8d8dfb | Python | shllybkwrm/enpm661-p2 | /project_2_obstacles.py | UTF-8 | 6,048 | 2.9375 | 3 | [
"MIT"
] | permissive | # ENPM661, Spring 2020, Project 2
# Shelly Bagchi & Omololu Makinde
import math
import numpy as np
import cv2
height = 200 #mask2.shape[0]
width = 300 #mask2.shape[1]
# Create a white base image to draw map onto
map_img = 255*np.ones((height, width, 3), np.uint8)
# Old function for drawing mask
def draw_map(map):... | true |
554ba2dfb84000aeb094031d68d1fe55fdc085fd | Python | ahsouri/MSATwtdenoiser | /MSATwtdenoiser/MSATwtdenoiser.py | UTF-8 | 4,054 | 2.6875 | 3 | [
"MIT"
] | permissive | # UTF-8
# Perform a wavelet denoising method
# Amir Souri (ahsouri@cfa.harvard.edu;ahsouri@gmail.com)
# heavily inspired by MATLAB's wdenoise2()
# July 2021
class MSATdenoise(object):
def __init__(self,data,wtname='db4',level=5,flag=None):
'''
Removing details based on the SURE threshold
... | true |
7e339f07bdf18ca25ea0541fe547ffad9f091704 | Python | dima-yurchuk/project_web_flask | /app/contact_form/form.py | UTF-8 | 905 | 2.546875 | 3 | [] | no_license | from flask_wtf import FlaskForm
from wtforms import StringField, TextField, SubmitField, TextAreaField
from wtforms.validators import DataRequired, Length, Email
class ContactForm(FlaskForm):
name = StringField(
'Name',
validators=[DataRequired(message="Поле не можу бути пустим!")],
... | true |
2dc8dcfc582900f8de53a444677c536b50dcae86 | Python | E-Kolotilko/python_usefull_stuff | /audio/extractFromVideo/audio_extractor.py | UTF-8 | 1,061 | 3.25 | 3 | [] | no_license | import moviepy.editor
#Note: moviepy is much richer in fuctionality that just extraction audio:
#cut video, compress, work with subtitles
import sys
from pathlib import Path
warning_string = """
Warning! This script creates audio files next to videos. Name is built by adding .mp3.
Enter y if you are ok with it
"""
d... | true |
d26de7d233de489a430d91c5424cdbcc4164cc08 | Python | completium/training-gitpod | /examples/charity/charity.py | UTF-8 | 729 | 2.75 | 3 | [] | no_license | import smartpy as sp
owner = sp.address("tz1eGd1Gzh9cpZjW1hpzre2fLSnMAsXqRdJy")
class Account(sp.Contract):
def __init__(self):
self.init()
@sp.entry_point
def collect(self, requestedAmount):
sp.verify(sp.sender == owner)
sp.send(owner, requestedAmount)
@sp.entry_point
de... | true |
b558ab266b64dba57f6099d4034eb57f7a570f2f | Python | AlexeyBazanov/algorithms | /sprint_3/flowerbeds.py | UTF-8 | 1,755 | 3.40625 | 3 | [] | no_license | import sys
def merge_sort(array, key):
array_len = len(array)
if array_len == 1:
return array
left = merge_sort(array[:array_len // 2], key)
right = merge_sort(array[array_len // 2:], key)
result = [None] * array_len
left_len = len(left)
right_len = len(right)
left_idx, ri... | true |
57e25642ea1a8c08e867d4bba8efddc3b606a39f | Python | xalex7/python | /vowels.py | UTF-8 | 627 | 4.5 | 4 | [] | no_license | def main():
def vowel_count(str):
vowels_array = [0, 0, 0, 0, 0]
for char in str:
if char in ('A', 'a'):
vowels_array[0] += 1
elif char in ('E', 'e'):
vowels_array[1] += 1
elif char in ('I', 'i'):
vowels_array[2] +=... | true |
b3dbc5507ef719c087b22ce17d4ecfa68b628791 | Python | Kishankr09/First-Repo | /first/arrayinsert.py | UTF-8 | 186 | 3.59375 | 4 | [] | no_license | from array import *
arr = array('i',[])
n = int(input("Enter the length of an array "))
for i in range(n):
x=int(input("Enter the value "))
arr.append(x)
print(arr)
| true |
cec775e0b7660962b5edb19df857da422f9e5779 | Python | PinkNoize/tls-observatory | /scripts/observatory_utils.py | UTF-8 | 466 | 3.15625 | 3 | [
"MIT"
] | permissive | import json
def get_creds():
with open('./output/dbcreds.json', 'r') as f:
data = f.read()
return json.loads(data)
def print_results(title, res_iter):
header_len = 50
header = '-'*((header_len-len(title)+2)//2)
header += f' {title} '
header += '-'*(header_len - len(header))
print(h... | true |
c8ac320d51957a5eb61ed7c81473c5b8d6a91011 | Python | arifaulakh/Competitive-Programming | /DMOJ/special_day/specialday.py | UTF-8 | 284 | 3.171875 | 3 | [] | no_license | month = int(input())
date = int(input())
if month <= 2 and date < 18:
print("Before")
if month < 2 and date >= 18:
print("Before")
if month == 2 and date == 18:
print("Special")
if month == 2 and date > 18:
print("After")
if month >= 3 and date > 0:
print("After") | true |
68f16fea447238525dc1642bee0dadab18921711 | Python | frclasso/turma1_Python_Modulo2_2019 | /Cap02_Classes/04_myclass.py | UTF-8 | 333 | 3.9375 | 4 | [] | no_license | #!/usr/bin/env python3
# template de classes
class MyClass:
"""Definindo a classe MyClass"""
a = 10 # variavel de classe
def func(self): # metodo /comportamento
print('Hello Python')
obj = MyClass()
# Acessando variaveis de classe
print(obj.a)
print(obj.func())
print(MyClass.func(obj))
print... | true |
9eee60916f23c8f931d5e615ab59b99d262d8c19 | Python | graceliu2006/LearnToCode | /python/hw9.py | UTF-8 | 2,957 | 3.8125 | 4 | [] | no_license | print("Question 1")
class Pagination(object):
def __init__(self, items, pageSize):
self.items = items
self.pageSize = pageSize
self.paginized_list = []
self.current_page = 0
self.paginize()
def paginize(self):
for k in range (0, 1+len(self.it... | true |
08ad52a6907d783856dedce17d5ec158a0c57751 | Python | Kevinrobot34/atcoder | /others/tenka1-2019-beginner/a.py | UTF-8 | 111 | 3.09375 | 3 | [] | no_license | a, b, c = map(int, input().split())
if a < c < b or b < c < a:
ans = 'Yes'
else:
ans = 'No'
print(ans)
| true |
e0681db59dd201d65ad1ecb2012a863b23e46d51 | Python | pilipolio/recs | /recs/test/pop.py | UTF-8 | 282 | 2.5625 | 3 | [] | no_license | import pandas as pd
from datetime import datetime
def test_last_day_only_decay_return_ones_for_last_date():
last_datetime = datetime(2015, 2, 1)
other_datetime = datetime(2015, 1, 31)
timestamps_df = pd.DataFrame.from_dict({'ts': [last_datetime, other_datetime]})
| true |
793c4a3998ded7bc30401a84d80267bd05232b48 | Python | dean2727/AI-Basics | /Proj4/mapcolor.py | UTF-8 | 1,636 | 3.40625 | 3 | [] | no_license | '''
File name: mapcolor.py
Creates all of the rules in CNF for the knowledge base
of the Australia Map Coloring problem, writing to standard output
(output is meant to be redirected into a .cnf file)
Name: Dean Orenstein
Class: CSCE 420
Date: 04/09/2021
'''
if __name__ == "__main__":
numStates = 7
states = ["W... | true |
2405d92e325d9ac0bf3b927b14eda22e3c3196dc | Python | ITUPythonStudyGroup/analyzer | /1/answer_simon.py | UTF-8 | 347 | 2.53125 | 3 | [] | no_license | import rethinkdb as r
import pandas as pd
DB = {
'host': '46.101.205.29',
'db': 'kickstarter',
}
connection = r.connect(**DB).repl()
res = []
for doc in r.table('projects_recently_launched').run():
res.append(doc)
df = pd.DataFrame(res)
df["days"] = (df["deadline"] - df["launched_at"]) / 60 / 60 / ... | true |
eaf54bd52b353561ba744e2c0663abceb2da270b | Python | ben-harper27/AdventOfCode.2020 | /day_three/day_three.py | UTF-8 | 748 | 3.609375 | 4 | [] | no_license | import math
f = open("input.txt", "r")
lines = f.read().splitlines()
f.close()
def part1(file):
trees = 0
x = 3
for y in range(1, len(file) - 1):
line = file[y] * 100
if line[x] == '#':
trees += 1
x += 3
return trees
def part2(file):
slopes... | true |
b6f3bbfbfbf601760c2283bab0704ad5535e7c00 | Python | AbdallahNU/CSCI-201 | /sheet3.py | UTF-8 | 2,528 | 3.953125 | 4 | [] | no_license | def grade():
Grade = eval(input("Enter your score: "))
if 90 <= Grade <= 100 :
letter = 'A'
elif 80 <= Grade:
letter = 'B'
elif 70 <= Grade:
letter = 'C'
elif 60 <= Grade:
letter = 'D'
elif 0 <= Grade:
letter = 'F'
else:
return 'Enter valid sco... | true |
c30e0ea774aabe46005144f2c2448f77e729c6ca | Python | amah001/cs179project | /app.py | UTF-8 | 2,425 | 2.765625 | 3 | [] | no_license | import tweepy
import time, sys, json
import os, errno
#opens keys
file = open("key.txt", "r")
key_lines = file.readlines()
file.close()
# accesses keys
access_token=key_lines[0].rstrip()
access_token_secret=key_lines[1].rstrip()
consumer_key=key_lines[2].rstrip()
consumer_secret=key_lines[3].rstrip()
hundredMB=1024 ... | true |
cb3ac633a654c969a4c83491fc186440b6175b4b | Python | tmdefreitas/algorithms | /python/max_subarray.py | UTF-8 | 2,159 | 3.78125 | 4 | [] | no_license | import unittest
## Maximum common subarray problem O(n log(n))
## see Intro to Algorithms, Ch. 4.1, pp 68
class MaxSubArray(object):
def __init__(self, A):
self.A = A
self.low, self.high, self.max = self.max_subbarray(0, len(self.A)-1)
self.subbarray = list(self.A[self.low:self.high+1])
def max_crossing_su... | true |
1f5b32368686814a4f232bc8fc1b43c5bfeda1bc | Python | renzon/git-boas-praticas | /meu_print.py | UTF-8 | 72 | 2.65625 | 3 | [
"MIT"
] | permissive | def mue_print(x):
''' meu_print '''
x += 4 # sum 4
print(x)
| true |