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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
b8c1219f460bb198f776193633b58c95f9f1f442 | Python | Riser6/deeplearning | /deepleanning-c1-t3/main.py | UTF-8 | 13,123 | 2.5625 | 3 | [] | no_license | import numpy as np
import h5py
import init_utils
import matplotlib.pyplot as plt
import sklearn
import scipy.io as sio
import reg_utils #第二部分,正则化
import gc_utils #第三部分,梯度校验
import testCases #参见资料包,或者在文章底部copy
from dnn_utils import sigmoid, sigmoid_backward, relu, relu_backward #参见资料包
import lr_utils #参见资料包,或者在文章... | true |
2099e154c63cf9502cd52551394d1646ef0b1a6c | Python | KMIKE94/python_workspace | /random/python-mysql/server.py | UTF-8 | 729 | 2.65625 | 3 | [] | no_license | from flask import Flask
import mysql.connector
import json
app = Flask(__name__)
@app.route("/")
def hello():
# Replace host with internal docker host ip
# docker inspect {NETWORK_ID} | grep Gateway
mydb = mysql.connector.connect(
host="172.24.0.1",
user="user",
password="password"... | true |
e3aba4d9f6aaf4a77f99e7d86fcb89acdcdf060e | Python | AMAN-0228/letsupdgrade-python | /day-6_assign-1.py | UTF-8 | 851 | 3.609375 | 4 | [
"Apache-2.0"
] | permissive | class bankaccount:
def __init__(self,ownername,balance):
self.ownername = ownername
self.balance = balance
def deposits(self,depositing_money):
self.balance += depositing_money
print('NAME =',self.ownername,'\nBALANCE =',self.balance,"\n")
def withdraw(self,mone... | true |
04bdc0bca0d229519bd6e21043c2d1aece4f5d2d | Python | edugarcia98/peiz_converter | /peiz_converter.py | UTF-8 | 18,695 | 2.625 | 3 | [] | no_license | import os
import re
import unidecode
import pyodbc
#Conexão com o banco de dados
DRIVER_SQL_SERVER = os.environ['DRIVER_SQL_SERVER']
SERVER_SQL_SERVER = os.environ['SERVER_SQL_SERVER']
TRUSTED_CONNECTION = os.environ['TRUSTED_CONNECTION']
USERNAME_SQL_SERVER = os.environ['USERNAME_SQL_SERVER']
PASSWORD_SQL_SERVER = ... | true |
7cc89c7cc1093bb07f577b3b342dffae9157386c | Python | hmleal/puzzles | /problem-2/sample.py | UTF-8 | 456 | 3.359375 | 3 | [] | no_license | #!/usr/bin/env python
from least_recently_used_cache import lrudecorator
@lrudecorator(max_size=3)
def plus(a, b):
return a + b
if __name__ == '__main__':
print('Result: {0}'.format(plus(2, 2)))
print('Result: {0}'.format(plus(3, 3)))
print('Result: {0}'.format(plus(4, 4)))
# Re-use this call a... | true |
19fd0b8036f753fede44afd6a1acf3bba01068e5 | Python | Smembe812/inextremis | /__tests__/test_init.py | UTF-8 | 361 | 2.6875 | 3 | [] | no_license | import src
import unittest
class TestInit(unittest.TestCase):
def setUp(self):
self.hello_message = "Hello, Playground"
def test_prints_hello_playground(self):
output = src.hello()
assert(output == self.hello_message)
def test_print_out_string(self):
assert(True)
if __... | true |
74b40249cfed585e0e76a04614f8fa0c5d9d2ed1 | Python | yemaedahrav/CS568_GoldMiners | /Week8/Test/incrementalize/modify.py | UTF-8 | 2,227 | 2.546875 | 3 | [] | no_license |
'''
Code to generate incremental datasets from MED_CRAN_CISI
'''
#modify hyperparameters
batch_size = 500
n_batches = 1
want_randomization = True
#output file paths
f = open("../input.in","w")
h = open("../labels.in","w")
#To test the correctness of generated files using kpartition.cpp
g = open("kpart.in", "w"... | true |
704587780c22f264451e5487ce88dc8c5e435681 | Python | stillermond/Breakout | /main.py | UTF-8 | 1,867 | 3.3125 | 3 | [] | no_license | import pygame
pygame.init()
class Brick:
def __init__(self, xpos,ypos):
self.xpos = xpos
self.ypos = ypos
self.alive = True
def draw(self):
if self.alive:
pygame.draw.rect(screen,(255,0,23),(self.xpos, self.ypos, 50,20))
def collide(self,x,y):
if self.al... | true |
a5447667381e300b06f1798dff2bab1bc877867d | Python | salimuddin87/Python_Program | /python3/oops_concepts/name_mangling.py | UTF-8 | 2,095 | 4.1875 | 4 | [] | no_license | """
“Private” instance variables that cannot be accessed except from inside an
object don’t exist in Python. However, there is a convention that is followed
by most Python code: a name prefixed with an underscore (e.g. _spam) should
be treated as a non-public part of the API (whether it is a function, a method
or a dat... | true |
43ec51206766a0d0d75763dd1ca1afa14648a460 | Python | Khantanjil/grafico-basico | /basic_graph.py | UTF-8 | 337 | 3.703125 | 4 | [] | no_license | #!/usr/bin/python
# Grafico basico em python
# Importacoes
from bokeh.plotting import figure
from bokeh.io import show, output_file
# Preparar dados
x = [1,2,3,4,5]
y = [6,7,8,9,10]
# Preparar o ficheiro html
output_file("grafico.html")
# Criar objeto
f = figure()
# Criar a linha no grafico
f.line(x,y)
# Mostrar ... | true |
e55c494c8819e20c36089df886ace9acfe057671 | Python | srinivasanc22071986/python_all_features | /Exception handling - Completed.py | UTF-8 | 12,710 | 3.515625 | 4 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# In[1]:
'''
The Python Exception class hierarchy - https://airbrake.io/blog/python-exception-handling/class-hierarchy
Syntax Errors
Exceptions
ZeroDivisionError : Occurs when a number is divided by zero.
Name Error : It occurs when a name is not found. It may be loca... | true |
a0c32d2c52dcfd6bbfabe2989af3f08fef5883b8 | Python | DaminduSandaruwan/LearnPython | /Function.py | UTF-8 | 273 | 4.3125 | 4 | [] | no_license | #Function
def greet():
print("Hello")
print("Good Morning")
greet() #calling
def add(x,y):
c = x+y
return c
result = add(10,20)
print(result)
def add_sub(x,y):
c=x+y
d=x-y
return c,d
result1,result2=add_sub(10,6)
print(result1,result2)
| true |
c73d0d7759c722c2142cfa347faa303848433979 | Python | mgh3326/big_data_web | /python/2_1_제출/5번/while_q_2_for.py | UTF-8 | 232 | 3.484375 | 3 | [] | no_license | num = int(input("입력하고 싶은 단 수를 입력하세요."))
for i in range(num, num+1, 1):
print("- %d 단 -" % i)
for k in range(1, 10, 1):
print("%d X %d = %2d" % (i, k, i * k))
# print("")
| true |
d057fd8a419fa5a396968c6c628e5333da533852 | Python | pycontribs/jenkinsapi | /jenkinsapi/nodes.py | UTF-8 | 6,199 | 2.8125 | 3 | [
"MIT"
] | permissive | """
Module for jenkinsapi nodes
"""
from __future__ import annotations
from typing import Iterator
import logging
from urllib.parse import urlencode
from jenkinsapi.node import Node
from jenkinsapi.jenkinsbase import JenkinsBase
from jenkinsapi.custom_exceptions import JenkinsAPIException
from jenkinsapi.custom_exce... | true |
7edc3b7178f44c505a3d8566604ab294abde1cd4 | Python | yashjain12yj/Numpy | /2. arrayCalculation.py | UTF-8 | 456 | 3.65625 | 4 | [] | no_license | a = [2,4,6]
import numpy as np
np_a = np.array(a)
mul = 3
div = 2
# multiplication on simple array
print('multiplication on simple array')
mul1 = a * mul
print(mul1)
# multiplication on numpy array
print('multiplication on numpy array')
mul2 = np_a * mul
print(mul2)
# division on simple array
print('division on s... | true |
ff857e84195d6617ed9f1a9f968dc10cd7e4565a | Python | SBNSoftware/sbnd-commissioning | /CRTCommissioning/timing_studies/Details.py | UTF-8 | 4,259 | 2.828125 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# Author: Harry Scott; hjscott1@sheffield.ac.uk
#ROOT IMPORTS
import uproot
from ROOT import *
#PYTHON IMPORTS
import sys
import matplotlib.pyplot as plt
import matplotlib.colors as colors
import numpy as np
import math
import datetime as dt
import os
from importlib import relo... | true |
63e4b2acd716a5fd394082eaa9aa43442b30044e | Python | SandMV/idao-finals | /submission/client_loader.py | UTF-8 | 657 | 3 | 3 | [
"BSD-3-Clause"
] | permissive | import pandas as pd
def load_client(client_data: str) -> pd.DataFrame:
client = pd.read_csv(client_data, sep=',')
client.education.fillna('MISSING', inplace=True)
client.job_type.fillna('MISSING', inplace=True)
client.citizenship.fillna('MISSING', inplace=True)
client.fillna(0, inplace=True)
... | true |
cc22a69358ebce895d7d9f165381f630cdb49af2 | Python | rebuildingcode/rbc | /rbc/space/utils/base.py | UTF-8 | 342 | 3.015625 | 3 | [
"BSD-3-Clause"
] | permissive |
def get_polygon_label(content):
if hasattr(content, 'name'):
# get label for polygon-type objects with name attribute
label = content.name
else:
# otherwise default to using the area value as the label
# this supports shapely's Polygon object
label = f"AREA: {content.ar... | true |
aa789274e938c5dd1b76e9fc3299e4eecfebc42d | Python | muhammedhassanm/Python | /Sample_Python2/Extract_Contours_Text.py | UTF-8 | 2,041 | 2.71875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sat May 2 12:58:55 2020
@author: Muhammed Hassan M
"""
import cv2
import pytesseract
import numpy as np
image = cv2.imread('C:/Users/Muhammed Hassan M/Desktop/OIl&GAS/vidya/CONTOURS_DETECTED TIF/TIF_103/Table_12.tif',0)
thresh,img_bin = cv2.threshold(image,128,255,cv2.THRESH... | true |
8ff88fce6c59c2e8f91a4bc8f6d960d33c0cfc95 | Python | EParrish/PHYS-410 | /Homework 2/PHYS410HW2-7.py | UTF-8 | 2,737 | 2.84375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Thu Apr 07 12:24:21 2016
@author: brown_000
"""
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
TheArray = pd.read_csv('C://Users/brown_000/Desktop/master1.csv')
TheArray.as_matrix()
TheArray = np.array(TheArray)
Test = []
for i in range(0,np... | true |
0126610dcfaded72b4c73ac7f9ad81ab10353726 | Python | asdfhamiltonian/hyougaibot | /hyougai.py | UTF-8 | 6,092 | 2.640625 | 3 | [] | no_license | # encoding: utf-8
'''
This package uses the KANJIDIC dictionary file.
This file is the property of the Electronic Dictionary Research and
Development Group, and is used in conformance with the Group's license.
(see http://www.csse.monash.edu.au/~jwb/kanjidic.html)
-----
significant parts of the twitter interface for th... | true |
d36acf41492be5357034e048e7018fafc482e03e | Python | HarshilModi10/MCP_Competition | /easy/question520.py | UTF-8 | 629 | 3.453125 | 3 | [] | no_license | class Solution(object):
def detectCapitalUse(self, word):
"""
:type word: str
:rtype: bool
"""
count = 0
capital = False
#check if first letter is capitial
if (ord(word[0]) - ord("A")) < 26:
capital = True
... | true |
51f8a437c399e6fb11e961d219c382a81d88b969 | Python | narinn-star/Python | /Review/Chapter03/3-25.py | UTF-8 | 102 | 3.640625 | 4 | [] | no_license | lst = eval(input("Enter list : "))
for i in lst:
if i[0] >= 'A' and i[0] <= 'M':
print(i) | true |
be7bc0db2cce58b3c0d0a972a5db8822f1faaaa1 | Python | icoding2016/study | /PY/leetcode/longest_increasing_subsequence.py | UTF-8 | 3,215 | 3.71875 | 4 | [] | no_license | """
300. Longest Increasing Subsequence
Medium
Given an integer array nums, return the length of the longest strictly increasing subsequence.
A subsequence is a sequence that can be derived from an array by deleting some or no elements without changing the order of the remaining elements. For example, [3,6,2,7] is a s... | true |
ca9f69ec0990e1f9865b156917a34489f1faff22 | Python | mateuszkochanek/carcassone-game | /backend/tile/AuxFunctions.py | UTF-8 | 1,278 | 3.375 | 3 | [] | no_license | import sys
from backend.tile.Tile import Tile
def merge(a, b, f) -> dict:
# Start with symmetric difference; keys either in A or B, but not both
merged = {k: a.get(k, b.get(k)) for k in a.keys() ^ b.keys()}
# Update with 'f()' applied to the intersection
merged.update({k: f(a[k], b[k]) for k in a.key... | true |
cc05169ab6e68243f4b893ce227225181c869b29 | Python | evturn/wpm | /core/scatter.py | UTF-8 | 1,295 | 2.640625 | 3 | [] | no_license | from matplotlib import pyplot as plt
import numpy as np
from core import scatterplots
class Scatter:
def __init__(self, data):
self.data = data
def draw(self, y_data):
pc_count = len(self.data)
pc_indices = np.arange(pc_count)
sp_count = len(scatterplots)
sp_indices =... | true |
edfbce34e421f464afa36f0f239797766a166c9e | Python | nmessa/Python-2020 | /Lab Exercise 12.10.2020/distance.py | UTF-8 | 739 | 4.15625 | 4 | [] | no_license | ## Lab Exercise 12/10/2020 Problem 1 and 2
## Author: nmessa
## Program to calculate the distance between two points
## Points may be in a plane or a 3D space
import math
from point import Point
from point3D import Point3D
def distance(p1, p2):
dist = math.sqrt((p1.x - p2.x)**2 + (p1.y - p2.y)**2)
... | true |
4a9e1a50ca79ada0577d7109dd14e4f6901b88ad | Python | seguijoaquin/tennis-statistics-HA | /age_calculator/age_calculator.py | UTF-8 | 2,825 | 2.671875 | 3 | [] | no_license | #!/usr/bin/env python3
import logging
from datetime import datetime
from constants import END, OK, CLOSE, OUT_JOINER_EXCHANGE, OUT_AGE_CALCULATOR_EXCHANGE
from rabbitmq_queue import RabbitMQQueue
from watchdog import heartbeatprocess
AGE_CALCULATOR_QUEUE = 'joined_age'
TERMINATOR_EXCHANGE = 'calculator_terminator'
c... | true |
0ed492779b9d528f0a0ea9e3a2b0498884c23b74 | Python | diegoortizmatajira/python-learning | /classes/20210728/Dog.py | UTF-8 | 560 | 4.375 | 4 | [] | no_license | class Dog:
def __init__(self, name: str, age: int):
self.name = name
self.age = age
def can_move(self):
print(f'{self.name} can walk on 4 feet')
def can_eat(self):
print(f'{self.name} can eat anything')
def can_make_sound(self):
print(f'{self.name} can bark')
... | true |
a053b60a44a5dfeac7e40988a9ffacc781c121aa | Python | somecat1996/Homeworks_IS | /2017_3_7/逆元.py | UTF-8 | 711 | 3.078125 | 3 | [] | no_license | a = input("enter a:")
b = input("enter b:")
c = input("enter c:")
if a == 0 or b == 0:
print "error!"
exit(1)
else:
q_array = []
r1 = a
r2 = b
while r1 % r2 != 0:
q_array.append(r1/r2)
tmp = r1 % r2
r1 = r2
r2 = tmp
s_array = [1, 0]
t_array = [0, 1]
fo... | true |
e0a8bceb956f7b4d8dcf044e842ca59f8af4f874 | Python | bulmasen/learn-to-program | /GB_LearnProgramming/Python_Programming/lesson-05/homeWork-lesson05_1.py | UTF-8 | 515 | 3.328125 | 3 | [] | no_license | # Создать программно файл в текстовом формате, записать в него построчно данные,
# вводимые пользователем. Об окончании ввода данных свидетельствует пустая
# строка.
in_str = ' '
with open('proc_file.txt', 'w') as proc_file:
while in_str:
in_str = input('Введите строку для добавления в файл: ')
pro... | true |
a9a34c384e0ba71c8843e6dc126efc6ee2f3facf | Python | 5l1v3r1/rl-agents | /CartPole/gym_test.py | UTF-8 | 2,037 | 2.84375 | 3 | [] | no_license | import gym
from gym import wrappers
import numpy as np
import random
# Use policy gradients to train a linear model.
# Achieves a good success rate after 500 trials.
numFeatures = 8
numActions = 2
def softmax(vec):
divisor = np.sum(np.sum(np.exp(vec)))
return np.exp(vec) / divisor
def trial(env, policy):
... | true |
b9ea98351f38012814c4027c39add40d23e45737 | Python | SamuelManechez/Puissance-4-python | /P4_CLI/game.py | UTF-8 | 5,815 | 3.546875 | 4 | [] | no_license | from tabulate import tabulate
import os, random, time
def p4():
#Initialisation et affichage de la grille
headers = ["0", "1", "2", "3", "4", "5", "6"]
data = [
["", "", "", "", "", "", ""],
["", "", "", "", "", "", ""],
["", "", "", "", "", "", ""],
["", ""... | true |
c6a69e24c275179fa5f3780fd4f4c9cdf339b3c7 | Python | Eliana02/CSP_Files | /Unit_2.1/message_receiver.py | UTF-8 | 316 | 2.828125 | 3 | [] | no_license | import socket
host = ''
port = 5000
buffer = 1024
addr = (host, port)
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.bind(addr)
sock.listen(1)
conn, sender = sock.accept()
print(conn, sender)
while True:
data = conn.recv(buffer)
if not data:
break
print(data)
conn.close()
| true |
42dc43389c854cc4cb0dc1e09f78a7d3ce4f96c8 | Python | Aasthaengg/IBMdataset | /Python_codes/p02624/s292081389.py | UTF-8 | 145 | 3.25 | 3 | [] | no_license | n = int(input())
ans = (n + 1) * n // 2
for i in range(2, n + 1):
j = 1
while i * j <= n:
ans += i * j
j += 1
print(ans)
| true |
4ee242e430e646327889b1e820e75b345bb214d6 | Python | bond-kaneko/nlp100 | /part3/q23.py | UTF-8 | 1,231 | 3.328125 | 3 | [] | no_license | """
23. セクション構造
記事中に含まれるセクション名とそのレベル(例えば"== セクション名 =="なら1)を表示せよ.
(root) kanekojunjunoMacBook-Pro:part3 kanekojunki$ python q23.py
Section name: 国名
Section level 1
Section name: 歴史
Section level 1
Section name: 地理
Section level 1
Section name: 気候
Section level 2
Section name: 政治
Section level 1
... 長いので省略
Section... | true |
d948335bfb06c948a2df430e564db249b701bf3d | Python | mumana98/CS-313E-Elements-Of-Software-Design | /BinaryTreeEncriptionAndDecryption.py | UTF-8 | 5,000 | 4.03125 | 4 | [] | no_license | import os
class Node(object):
def __init__ (self, data = None):
self.data = data
self.rchild = None
self.lchild = None
class Tree (object):
# the init() function creates the binary search tree with the
# encryption string. If the encryption string contains any
# character other... | true |
8cb671f94221550bdaa34bc3a942645cdf361d98 | Python | HelloRicky/CW-pricing | /data/readJsonFile.py | UTF-8 | 648 | 2.875 | 3 | [] | no_license | import json
import csv
fileName = 'document.json'
with open(fileName, 'rb') as fin:
content = json.load(fin)
count = 0
data = ''
for k, v in content.items():
if k=='TimeStamp':
date = v
if k=='Categories':
for k1, v1 in v.items():
for p, cost in ... | true |
330a86af6f1bf50708dde59e62e65d7d516610aa | Python | erafkin/min_edit_distance | /min_edit_distance/spelling_correction.py | UTF-8 | 3,104 | 3.421875 | 3 | [] | no_license | # Emma Rafkin
# CS72 Homework 1
# April 2019
import numpy as np
import sys
insert_cost = 1.0
delete_cost = 2.0
substitution_cost = 3.0
twiddle_cost = 5.0
def insert(char):
if(is_common_double(char)):
return (insert_cost/2)
return insert_cost
def delete(char):
return delete_cost
def substitute(c... | true |
aa2c11ebbc4abd93da6e13348d998bfd4a91762a | Python | mnipshagen/monty | /2018/10/birthday_fun.py | UTF-8 | 4,104 | 4 | 4 | [
"MIT"
] | permissive | """
This module is a test module for the BirthdayCalc class
Requires the module birthday_calc.
"""
from datetime import datetime
import birthday_calc
class TooOldError(Exception):
"""
Error indicating the person is too old to exist.
"""
pass
class TooYoungError(Exception):
"""
Error indicati... | true |
633e7f02b2f38c118f27ab490af312f984cacf3b | Python | Talkytitan5127/pythonpark | /dir_dict/dir_dict2.py | UTF-8 | 1,045 | 3.25 | 3 | [] | no_license | #!/usr/bin/python3
import os
from collections.abc import MutableMapping
class dir_dict(MutableMapping):
def __init__(self, path):
self.path = os.path.abspath(path)
if self.path[-1] != '/':
self.path += '/'
if not os.path.isdir(self.path):
os.mkdir(self.path)
... | true |
b639da40718a99e5261f3e1a17ad2881a311a144 | Python | LouisAsanaka/VoiceBoi | /voiceboi/playlist_manager.py | UTF-8 | 1,605 | 2.671875 | 3 | [] | no_license | from spotify import Spotify
from youtube import Youtube
from typing import List, Dict
import vlc
PAGINATION_LIMIT: int = 5
class PlaylistManager:
def __init__(self):
self.spotify: Spotify = Spotify()
self.current_media_list: vlc.MediaList = vlc.get_default_instance().media_list_new()
sel... | true |
9e341bd0ef7022d08e88889f14c3824fc5f17a68 | Python | geoffrey1330/Image-Classification-WebApp | /model_training/Facemask_training.py | UTF-8 | 3,186 | 2.859375 | 3 | [] | no_license | # import the necessary packages
from sklearn.preprocessing import LabelEncoder
from sklearn.model_selection import train_test_split
from sklearn.metrics import classification_report
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Dense, Dropout, Flatten
from tensorflow.keras.layers im... | true |
c30eb3e373f18eb7d5ed3f3097df9cd4a727474b | Python | Levi-Moreira/Mestrado-Semb | /forward_pass.py | UTF-8 | 3,042 | 2.53125 | 3 | [] | no_license | import time
from data_generator import DataProducer
from forward_pass_data import get_weights, get_bias, get_gamma, get_beta, get_mean, get_variance
from forward_pass_layers import convolution_forward, relu_forward, pool_forward, pure_batch_norm, fc_forward, sigmoid
def forward_pass(file, channels):
data_generato... | true |
a35a7b2af9566f201f0033e198fb937747a67188 | Python | ankithakumari/InformationRetrieval | /bfscrawler.py | UTF-8 | 3,137 | 3.625 | 4 | [] | no_license | """ Python implementation to perform Breadth first crawling of the web.
Starts from the url https://en.wikipedia.org/wiki/Space_exploration and downloads all
links to other wiki articles in a breadth first manner.
Only downloads english articles, ignores links to sections in the same page, links to images e... | true |
79b082c8bdf39cd787d972d99b6a35849f674847 | Python | HappyGreenla/MXJ | /functions.py | UTF-8 | 1,371 | 4.25 | 4 | [] | no_license | #def multiply(a,b):
# result = a*b
# return result
#multiply(4,5)
#print(multiply(-1, -55)) # 55
#print(multiply(3, 'Hello')) # 'HelloHelloHello'
#def isPositive(a):
# if a>0:
# return True
# else:
# return False
#print(isPositive(4))
#print(isPositive(-9.9))
#import ran... | true |
d206a4aa6c8fd504d5e6beb4bd6424985401271d | Python | philomathtanya/Basic-Python-Program | /table.py | UTF-8 | 94 | 3.5625 | 4 | [] | no_license | #table of n
n=int(input("Enter the number:"))
for i in range(11):
print(n,"*",i,"=",n*i)
| true |
8f60e6d8f9f8430581d20a9da339baf77f881990 | Python | arunkamaraj/data | /next.py | UTF-8 | 115 | 3.375 | 3 | [] | no_license | def make_counter(x):
print('entering make_counter')
while True:
yield
print('incrementing x')
x = x + 1
| true |
991c5e964f70e041ab169b66e64e1efafce2e7b9 | Python | dotmons/Python | /DataScience/Chapter 5/5_14_TimeSeries.py | UTF-8 | 837 | 2.921875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sun Apr 12 10:19:34 2020
@author: Dotmons
"""
import statsmodels.api as sm
from matplotlib import pyplot as plt
import urllib.request
import pandas as pd
import numpy as np
dta = sm.datasets.co2.load_pandas().data
'''
#print(dta)
dta.plot()
plt.title("CO2 Levels")
plt.ylabel(... | true |
8afdd623ba180c64211c96c8ab5021e52c3e76c4 | Python | tensorflow/probability | /tensorflow_probability/python/bijectors/fill_scale_tril.py | UTF-8 | 5,406 | 2.84375 | 3 | [
"Apache-2.0"
] | permissive | # Copyright 2018 The TensorFlow Probability 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 applicable law o... | true |
d3e645cca49136cb5cf540b97ee2039cce50d901 | Python | Paridhi1112/PythonTestPrograms | /q10new.py | UTF-8 | 205 | 3.34375 | 3 | [] | no_license | items=set()
s=''
n=input()
for i in n:
if i==" ":
items.add(s)
s=''
continue
else:
s=s+i
items.add(s)
lst=list(items)
lst.sort()
for i in lst:
print(i, end=" ")
| true |
0185f91c91797ae70170d43f95133c04b207ba9b | Python | AchilleBineli/spam_classification | /data_visualization.py | UTF-8 | 3,726 | 3.125 | 3 | [] | no_license | import matplotlib.pyplot as plt
import seaborn as sns; sns.set()
from string import punctuation
import numpy as np
import pandas as pd
def data_visualization():
# Dataset from - https://archive.ics.uci.edu/ml/datasets/SMS+Spam+Collection
data = pd.read_csv('./data/smsspamcollection/SMSSpamCollection',
... | true |
b2f895bce6ad659b04b10812b7f1b56d69b7b3f2 | Python | CA2528357431/python-base--Data-Structures | /35/main.py | UTF-8 | 2,225 | 4.21875 | 4 | [] | no_license | # 有向有权图
# 无向有权图 即网格易做,pass
class graph:
def __init__(self):
self.node = []
self.edge = []
def addnode(self, node):
self.node.append(node)
def addedge(self, p1, p2, weight):
if p1 in self.node and p2 in self.node:
self.edge.append(((p1, p2), weight))
def ... | true |
66bdfa9c88f911bd729c7a637c0ba3576c534023 | Python | rwszymczakiii/Excel_Transcription | /functions.py | UTF-8 | 1,268 | 3.578125 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Fri Mar 22 12:19:30 2019
@author: rszymczak
"""
# this calculates the average from a list of values
def avg(alist):
total = 0
#total starts as 0
for e in alist:
# e will represent each value in the list
total += e
# each value in the list will ... | true |
6c0caf740dd868ab3227ec6711f50021cca85f5a | Python | phlergm/ICS4U | /ICS4U/Main Program/SpotifySorter/Spotify sorter rev. 2.py | UTF-8 | 745 | 2.90625 | 3 | [] | no_license | #----------------------------------------------------------------------
# Name: Humza Anwar
# Purpose: To sort music files by filetype & bitrate, then giving
# a list of files of each filetype
#
# Refererences: http://www.tutorialspoint.com/python/os_walk.htm
#
# Max code length: 80
# Max comment length: 72
... | true |
07e88ddf5ac047720af90d62b1d4b7450240abe6 | Python | langelgjm/yabr | /fetch_threads.py | UTF-8 | 2,319 | 2.75 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Wed May 6 08:55:39 2015
@author: gjm
Fetches
"""
import random
import pickle
import requests
import os
import time
from retrying import retry
from couchdb import CouchDB
db_url = "http://127.0.0.1:5984"
db_name = "yabr"
bgg_url_thread = "http://www.boardgamegeek.com/xmlapi2/... | true |
8ab9e0cba6059d56531b3403b16090480ce48075 | Python | pdavid-i/University | /Second Year/Second Semester/Artificial Intelligence/Knapsack/population.py | UTF-8 | 2,080 | 3.421875 | 3 | [] | no_license | from individ import Individ
from problem import Problem
from random import randint
class Population:
no_individuals = 100
def __init__(self, problem=Problem("input.txt")):
self.problem = problem
self.population = []
for i in range(Population.no_individuals):
p = In... | true |
5f5171f86b81f14669776c94e8125c722cba03cf | Python | sljh0214/DeepLearningZeroToAll | /TensorFlow/lab-02-2-linear_regression_feed.py | UTF-8 | 4,196 | 3.5625 | 4 | [] | no_license | # Lab 2 선형 회귀 Linear Regression
import tensorflow as tf # tensorflow
tf.set_random_seed(777) # 랜덤 생성 시드값 777로 설정 for reproducibility
# Y = W * X + b를 계산하는 것으로 (가중치) W와 (바이어스) b 값을 구하려 한다. Try to find values for W and b to compute Y = W * X + b
W = tf.Variable(tf.random_normal([1]), name="weight") # weight 변수 선언. 초기값... | true |
fefa513bc70a1fce3c0cbeafad39d34e0591a941 | Python | mivanovitch/DeepTiling | /models/TopicTilingModels.py | UTF-8 | 23,741 | 2.84375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Wed Feb 17 12:53:32 2021
@author: Iacopo
Part of the code (i.e. data preparation and model fitting) is based on
https://towardsdatascience.com/topic-modelling-in-python-with-nltk-and-gensim-4ef03213cd21
by Susan Li
"""
import numpy as np
import pandas as pd
import spacy
spacy.... | true |
b98c9916fd531f4856f70fcc95291419180e93c4 | Python | Andrey1310Dov/Python | /task_1/way_3.py | UTF-8 | 223 | 2.53125 | 3 | [] | no_license | #тут используем регулярку
import re
strings = "Этастроканаписана2018-19-22,амоглабыи1982-12-15.1515-26-251254-15-121548-15-15"
print(re.findall(r'\d{4}-\d\d-\d\d', strings))
| true |
64ef5b416d3846b23201e263bfb8cd694a5670e8 | Python | simonfong6/micro-projects | /calendar/listCalendars.py | UTF-8 | 905 | 2.84375 | 3 | [
"MIT"
] | permissive | """
Shows basic usage of the Google Calendar API. Creates a Google Calendar API
service object and outputs a list of the next 10 events on the user's calendar.
"""
from __future__ import print_function
from apiclient.discovery import build
from httplib2 import Http
from oauth2client import file, client, tools
import da... | true |
8666d8b9908ae7b188e4ef375b6fec50f4c6d545 | Python | reichlj/PythonBsp | /Schulung/solutions/100sol34.py | UTF-8 | 318 | 4.28125 | 4 | [] | no_license | def chain(*iterables):
""" This generator is equivalent
to the chain
method of iterables """
for iterable in iterables:
for element in iterable:
yield element
names1 = ["Pete", "Tom"]
names2 = ["Tom", "Oscar"]
c = chain(names1, names2)
for el in c:
print(el)
| true |
c8c889c13321bcc14966fcb48d018e3325f8903d | Python | Evan1987/BaseML | /Python_ML_and_Kaggle/chap02_ensemble_tree.py | UTF-8 | 1,379 | 2.984375 | 3 | [] | no_license |
# coding: utf-8
import pandas as pd
from sklearn.feature_extraction import DictVectorizer
from sklearn.tree import DecisionTreeClassifier
from sklearn.ensemble import RandomForestClassifier
from sklearn.ensemble import GradientBoostingClassifier
from sklearn.metrics import classification_report
from sklearn.model_sel... | true |
e778147d1d0737e666e4dfe4eaac601ad7aeb544 | Python | newstar123/Pythonlab_DEV | /Application/Stock/acquiring-data/acquiring_all_stock_data_v0.3.py | UTF-8 | 2,700 | 2.734375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
#---------------------------------------
# Program: acquiring_all_stock_data_v0.3.py
# Version: 0.3
# Author: Alan Tang
# Date: 2017-08-30
# Language: Python 3.6.2
# Description: 使用MongoDB存储
#---------------------------------------
import requests
from bs4 import BeautifulSoup
impo... | true |
60f522f4812096312928a350228d5933b16b766c | Python | ugobachi/AtCoder | /ABC182/B.py | UTF-8 | 254 | 2.953125 | 3 | [] | no_license | N = int(input())
A = list(map(int, input().split()))
GCDmax = 0
res = 0
for i in range(2,max(A)+1):
GCD = 0
for j in range(N):
if A[j]%i == 0:
GCD += 1
if GCDmax < GCD:
res = i
GCDmax = GCD
print(res)
| true |
62ae035e83c9d0273b9875e7d48c8e8c7e089c06 | Python | Akshidhlavanya/san | /p51.py | UTF-8 | 65 | 2.53125 | 3 | [] | no_license | n=int(input())
l=sorted(map(int,input().split(' ')))
print(l[1])
| true |
53c6e09bbb95b1bee775d2244385b543b68d9035 | Python | djddenis/recurrent-microtext | /TestSimplerMethods.py | UTF-8 | 3,333 | 2.671875 | 3 | [] | no_license | from __future__ import unicode_literals
import numpy as np
import pickle
import os
from ArtificialImprovedDataset import ArtificialImprovedDatasetFactory
from Message import Message, LABELS
from Encodings import get_one_hot, get_c2v_encoded, C2V_ENCODING_SIZE
import BasicArtificialDataset
from sklearn.linear_model imp... | true |
97f92d1306216a89d72442578752d1ed3c7cbf01 | Python | MAYA-MUYI/Python | /black_board/black_board/third/three.py | UTF-8 | 1,277 | 2.546875 | 3 | [] | no_license | import requests
from lxml import etree
se = requests.session()
headers = {
"User-Agent": "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36"
}
login_url = "http://www.heibanke.com/accounts/login"
url = 'http://www.heibanke.com/lesson/crawler_ex02/'
userna... | true |
21b6a913e948308d6b5e1d09a6524ad4eaad6bcb | Python | 61a-su15-website/61a-su15-website.github.io | /lab/labMakeup/labMakeup.py | UTF-8 | 2,598 | 3.1875 | 3 | [] | no_license | ################
# Lab 7: Trees #
################
def lab7_q1():
"""
>>> isinstance(lab7_q1(), str)
True
"""
return """
YOUR EXPLANATION HERE
"""
def lab7_q2():
"""
>>> isinstance(lab7_q2(), str)
True
"""
return """
YOUR EXPLANATION HERE
"""
def lab7_q3():
... | true |
150125f4e55afad64ac5215672d85c73a1924036 | Python | luowensheng/RL_Multi-Armed-Bandit- | /env.py | UTF-8 | 2,402 | 3.6875 | 4 | [] | no_license | '''
Description:
This is an implementation of multi-armed bandit environment.
The rewards are modeled by two distributions:
1. Normal distribution but with different mean and variance (follow Fig 2.1 in the textbook)
2. Bernoulli distribution
NOTE: Please DO NOT edit this file!!!
Author:
... | true |
81741ae176b3a859378ed1fd5900a30786c21528 | Python | huaiyukhaw/product-search | /search.py | UTF-8 | 1,531 | 2.859375 | 3 | [] | no_license |
import pandas as pd
import scipy.spatial
class Search(object):
def __init__(self, dataframe, embedder,corpus, corpus_embeddings):
self.df = dataframe
self.embedder = embedder
self.corpus = corpus
self.corpus_embeddings = corpus_embeddings
def __call__(self, search_term, method... | true |
44c5dbebe1f7d792710fefe0b255367009796618 | Python | adrianocapirchio/python_perceptron | /perceptron1.8.py | UTF-8 | 3,159 | 2.96875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Mon Jun 12 12:03:34 2017
@author: Alex
"""
import numpy as np
import matplotlib.pyplot as plt
#costanti
n = 2
eta = 0.1
trial_time = 100
n_trial = 4
total_trial_time = trial_time * n_trial
#variabili
input1 = np.zeros(total_trial_time)
input2 = np.zeros(tota... | true |
c9a6af05ca93d2cdc7aeb5f6c85ca885efb60496 | Python | rikenbit/onlinePCA-experiments | /Analysis/src/Sklearn_randomized_svd.py | UTF-8 | 737 | 2.703125 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
import sys
import numpy as np
from sklearn.utils.extmath import randomized_svd
from sklearn import preprocessing
# args[1] : Input file
# args[2] : Dimention
# args[3] : Output file (Eigen vectors)
# args[4] : Output file (Eigen values)
args = sys.argv
# Import
data = np.loadtxt(args[1], deli... | true |
af0cdf4f8c52e1ced649da86d9e94776b05cd598 | Python | cabbageGG/play_with_algorithm | /LeetCode/119. 帕斯卡三角形 II.py | UTF-8 | 688 | 3.75 | 4 | [] | no_license | #-*- coding: utf-8 -*-
'''
给定一个索引 k,返回帕斯卡三角形(杨辉三角)的第 k 行。
例如,给定 k = 3,
则返回 [1, 3, 3, 1]。
1
1 1
1 2 1
1 3 3 1
注:
你可以优化你的算法到 O(k) 的空间复杂度吗?
'''
class Solution:
def getRow(self, rowIndex):
"""
:type rowIndex: int
:rtype: List[int]
"""
... | true |
93ba627c0a1c1c76005e4b096076f696165ccad3 | Python | daozlv/AI | /chen435-daozlv-a4/Machine Learning/02_Project/save_train_result_to_excel.py | UTF-8 | 654 | 2.609375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import xlwt
from tempfile import TemporaryFile
import numpy as np
def saveTrainResult(filename,titles,trainResults):
# trainResult = np.load('trainResult.npy')
book = xlwt.Workbook()
sheet1 = book.add_sheet('sheet1',cell_overwrite_ok=True)
supersecretdata = tra... | true |
b41ca1441e2d42f62ba177f8a51df064d074d7f8 | Python | samuelmarina/hambruna-games | /gamesimulator.py | UTF-8 | 6,964 | 3.171875 | 3 | [] | no_license | from db import retrieveData, removeUserByID, getUserByID, submitDeathDatabase, retrieveDeadData
from random import randint
from PIL import Image, ImageDraw
from igbot import uploadPost, logIn
import time
minutes = 59
times = 3
def getRandomNumber(range):
"""Get random number within a range
Args:
range... | true |
204de411fd7b11d864c55654ad8c50d75be2af2f | Python | raphyreyvzla/NollarTipBot | /modules/social.py | UTF-8 | 9,970 | 2.625 | 3 | [] | no_license | import configparser
import logging
import os
from datetime import datetime
from decimal import Decimal, getcontext
import nano
import pyqrcode
import telegram
from . import currency, db
# Read config and parse constants
config = configparser.ConfigParser()
config.read(os.environ['MY_CONF_DIR'] + '/webh... | true |
ae2866fab4d9ab61967f4d609df9d4e572218dbd | Python | burakhanaksoy/PythonAlgorithms | /Algorithms/edabit/stuttering_function/main.py | UTF-8 | 377 | 4.78125 | 5 | [
"MIT"
] | permissive | # Write a function that stutters a word as if someone is struggling to read it.
# The first two letters are repeated twice with an ellipsis ... and space after each,
# and then the word is pronounced with a question mark ?.
word = 'hello'
def stutter(word):
first_two = word[:2] + '... '
result = first_two *... | true |
bbc788f0a100be52647d1f283c9480f4e9561603 | Python | Bernard-js/Python-Basics | /exponent.py | UTF-8 | 346 | 4 | 4 | [] | no_license | def exp_while(base, exponent):
baseOrigin = base
while(exponent > 1):
base *= baseOrigin
exponent -= 1
return base
def exp_for(base, exponent):
result = 1
for i in range(exponent):
result = result * base
return result
print(2 ** 3)
print(exp_while(2, 3))
print(4 ... | true |
7cddae5322934c6708ef91dfeb9913118593e2de | Python | SravaniTeeparthi/harp | /harp/fdops.py | UTF-8 | 3,543 | 3.5 | 4 | [] | no_license | """
The following module contains functions that help in file and directory
operations.
"""
import os
import pdb
import glob
import pathlib
import warnings
import pandas as pd
def check_if_file_exists(file_path):
"""
If file does not exists it raises an exception
Parameters
----------
file_path : ... | true |
f716c0b3e3dbd4022e4af589f526aaae70659430 | Python | aiman9/DL_SpamDetection | /LSTM/lstm_model.py | UTF-8 | 2,135 | 2.71875 | 3 | [] | no_license | import pandas as pd
import numpy as np
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import LabelEncoder
from keras.models import Model
from keras.layers import LSTM, Activation, Dense, Dropout, Input, Embedding
from keras.optimizers import RMSprop, Adam
from keras.preprocessing.text i... | true |
c02abd426cfa9caa4cd9a5fb68e42f0949a3cb43 | Python | vishay28/year-2-project | /generalFunctions.py | UTF-8 | 1,800 | 3.71875 | 4 | [] | no_license | #This program is impoted into most of the other programs as the functions defined in this class are common functions required by many programs
#Importing threading to allow the program to run multiple threads
from threading import Thread
#Importing the datetime function to allow the program to interact with the curr... | true |
1b29973a50a54fa1521f664d23a93c35a2c61a61 | Python | Rookiee/Python | /Python2.7/标准库.py | UTF-8 | 1,461 | 3.1875 | 3 | [] | no_license | #coding: utf-8
# import sys
# # 接受命令行参数
# # print sys.argv[0] # 0: 文件名
# # 查看版本
# print sys.version
# # print sys.version_info
# # 退出
# sys.exit(0) # 强制退出python的执行
#---------------------------------------
import os
# 获取操作系统平台
print os.name # nt: windows posix: macOS
# 获取工作目录(现在程序所在的目录)
print os.getcwd()
print typ... | true |
09258e15d8ab12cb165c68d0cbd5f6a80d201fc8 | Python | esrice/trio_binning | /src/trio_binning/classify_by_alignment.py | UTF-8 | 3,160 | 3.0625 | 3 | [
"MIT"
] | permissive | """Bin reads based on alignment.
Classify reads from an F1 hybrid into parental bins based on whether
each one aligns better to the maternal or paternal assembly.
"""
import argparse
from typing import Iterator
import mappy
import pysam
from trio_binning import seq
def open_sam_or_bam(filename: str) -> pysam.Align... | true |
5df7d5fcb7af7a03c14d006415943ef09af56700 | Python | likc-1117/Python | /Appium_Key_Model/Utils/Read_Case_Infor_Excel.py | UTF-8 | 1,710 | 3.015625 | 3 | [] | no_license | '''
Created on 2020年3月23日
@author: likecan
'''
import xlrd
from xlutils3.copy import copy
class read_case_infor_excel(object):
'''
classdocs
'''
def __init__(self,sheet_name, case_excel_path = '..\\Config\\Case.xls'):
self.excel_path = case_excel_path
self.open_excel = xl... | true |
ba90914eb6c34079769928b69ceae98d820083c9 | Python | enterpriseih/Pytorch_code | /nlp/word2vec/word2vec.py | UTF-8 | 5,462 | 3.03125 | 3 | [] | no_license | import numpy as np
from collections import defaultdict
import jieba
import torch
import torch.nn as nn
from torch.utils.data import DataLoader
from torch.utils.data import Dataset
import sys
import logging
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')
logger = l... | true |
006ac6e3ed37798e5c2fa9845f76abcff5a42bbc | Python | halfwhole/nus-temperature-declaration | /auto.py | UTF-8 | 1,412 | 3.015625 | 3 | [] | no_license | from datetime import datetime
from random import choice
from temperature import *
LOG_FILE = 'temp.log'
def hasDeclared(tempData):
lastDeclaredDate = tempData[0][1].split(', ')[0]
todayDate = datetime.now().strftime('%d/%m/%Y')
if lastDeclaredDate != todayDate: return False
lastTempAM = tempData[0][2... | true |
66ca61b893d87248ef4b6dc0a5ed9478def407d3 | Python | aimuch/AITools | /Evaluation/mmdetection_visualize/visualize.py | UTF-8 | 2,935 | 2.6875 | 3 | [
"MIT"
] | permissive | import json
import matplotlib.pyplot as plt
import sys
import os
from collections import OrderedDict
class visualize_mmdetection():
def __init__(self, path):
self.log = open(path)
self.dict_list = list()
self.loss_rpn_bbox = list()
self.loss_rpn_cls = list()
self.loss_bbox =... | true |
756bc9b3aba77248cff1ff5ffb415559aa3aa752 | Python | vecin2/em_automation | /sqltask/test/utils/main_menu_runner.py | UTF-8 | 1,996 | 2.578125 | 3 | [
"MIT"
] | permissive | from sqltask.docugen.render_template_handler import RenderTemplateHandler
from sqltask.main_menu import (ExitHandler, InputParser, MainMenu,
MainMenuHandler)
class MainMenuDisplayer(object):
def __init__(self, mocked_selections=None):
self.selections = mocked_selections
... | true |
2a542bc71c6c328fb09cd1ef255e1e86aa65eb02 | Python | gabriellaec/desoft-analise-exercicios | /backup/user_148/ch149_2020_04_13_19_46_49_197989.py | UTF-8 | 724 | 3.0625 | 3 | [] | no_license | sb = float(input('Qual o seu salário bruto? '))
dep = int(input('Qual o seu número de dependentes? '))
if sb <= 1045.00:
inss = sb*0.075
if 1045.00 < sb <= 2089.60:
inss = sb*0.09
if 2089.60 < sb <= 3134.40:
inss = sb*0.12
if 3134.40 < sb <= 6101.06:
inss = sb*0.14
if sb > 6101.06:
inss = 671.12
b... | true |
47cd7b4e791d37765c8d6e4f755ccd0d90bb4722 | Python | alexandraback/datacollection | /solutions_2464487_1/Python/kwangswei/problem1.py | UTF-8 | 230 | 2.890625 | 3 | [] | no_license | import sys
import math
t = int(raw_input())
def solve(r,t) :
return (-(2*r-1) + math.sqrt((2*r-1)*(2*r-1)+8*t))/4
for i in range(t):
r, t = raw_input().split()
print "Case #%d: %d" % (i+1,int(solve(int(r),int(t))))
| true |
6f60b8dfd072cb4e008b414883f505167d19832b | Python | carhartt21/semantic-segmentation-pytorch | /smooth_segmentation.py | UTF-8 | 2,345 | 2.796875 | 3 | [
"BSD-3-Clause"
] | permissive | import numpy as np
from scipy import stats
from timeit import default_timer as timer
import imageio
import argparse
import multiprocessing as mp
import os
from utils import find_recursive
from tqdm import tqdm
def modNeighbors(segData, i, j, d=1):
n = segData[max(i-d,0):min(segData.shape[0]-d, i+d+1), max(0,j-d):m... | true |
6873eaf1e84e840f3c04a55479561abcd1d553d9 | Python | Sherin1998/2-ass-13 | /2 ass 13.py | UTF-8 | 2,006 | 4.375 | 4 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# #1
#
# def rep(x):
# y=x[-2:5:-1]
# z=x[:4]+x[-1:3:-1]+x[3:-1]
# return y,z
#
# rep('SherinShaji')
#
# When positive and negative indexing are used simultaneously,it is necessary to give step size.Failing to do so results in a blank string.Using negative numbers a... | true |
ee0bbd75878b5d227ebd75eecd999e8fb95594aa | Python | cmr-bidmc/predictHF | /eval.py | UTF-8 | 3,514 | 2.53125 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
import os
from sklearn.model_selection import StratifiedShuffleSplit
from sklearn.metrics import roc_curve, auc
import tensorflow.keras.backend as K
np.random.seed(2020)
import hyper_params as hp
from dl_models import build_model_predict
from load_data import load_data... | true |
d78594c8b121d645ceebe64240b3f4fe54ec2787 | Python | shollingsworth/unicodes | /src/unicodes_api/screen.py | UTF-8 | 13,561 | 2.796875 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"MIT"
] | permissive | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""test."""
from typing import Any, Callable, Dict, List
import sys
import argparse
import curses
from curses.textpad import Textbox
from abc import abstractmethod, ABC
from unicodes_api.parser import ParserOpts
from unicodes_api.parser import Formatter
# pylint: disable=... | true |
a1ea1ed15a874bbdaec47e35cd5edef90ea63286 | Python | acboulet/advent2020_py | /d7/day7.py | UTF-8 | 4,856 | 3.734375 | 4 | [] | no_license | import re
def process_1(file_name):
"""
Purpose:
Take a .txt file and process so that it returns a list of lists.
Pre:
:param file_name: Name of .txt file
Return:
An arrayed list where each item is described:
[0] = bag that contains all other bags
[1:] = ... | true |
8e0ebd6fb98a09fb2f2b2bf78f47e57fd7e4f1bc | Python | JackaChou/idaes-pse | /idaes/tests/test_have_pynumero.py | UTF-8 | 1,930 | 2.578125 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"BSD-2-Clause"
] | permissive | #################################################################################
# The Institute for the Design of Advanced Energy Systems Integrated Platform
# Framework (IDAES IP) was produced under the DOE Institute for the
# Design of Advanced Energy Systems (IDAES), and is copyright (c) 2018-2021
# by the softwar... | true |
e17163da24054001c22e2bc4d9ac1a7fbe560dec | Python | siddharthcurious/Pythonic3-Feel | /Data-Structures/Binary-Tree/traversal/level_order_traversal.py | UTF-8 | 788 | 3.71875 | 4 | [] | no_license | from collections import deque
class TreeNode:
def __init__(self, val):
self.val = val
self.left = None
self.right = None
def inorder(root):
if not root:
return
inorder(root.left)
print(root.val)
inorder(root.right)
def level_order(root):
q = deque()
q.append... | true |
fa6cfb30db128d9a387bb9716cb86323254c8554 | Python | jaehaaheaj/ProjectEuler | /python/PE085.py | UTF-8 | 586 | 3.546875 | 4 | [] | no_license | # Combination from PE015
def Combination(a, b):
x = 1
for i in range(0, b):
x *= a-i
for i in range(1, b+1):
x /= i
return int(x)
def RectangleCount(a, b):
return Combination(a+1, 2) * Combination(b+1, 2)
# find minimum length of longer edge
longlimit = 1
while RectangleCount(longlimit, longlimit)<2000000:
... | true |
480d58856457226796b05c56552bf50e4dae0c15 | Python | ananthrajsingh/Coding-Practice | /DS_And_Algo_in_Python_Book/3.AlgoAnalysis/prefix_average3.py | UTF-8 | 389 | 3.671875 | 4 | [] | no_license | def prefix_average3(S):
"""Return list such that for all j, A[j] equals average of S[0]...S[j]
Complexity of the Algo: O(n)
"""
n = len(S)
A = [0]*n
total = 0
for j in range(n):
total += S[j]
A[j] = total/(j+1)
return A
if __name__ == '__main__':
S = [... | true |