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 |
|---|---|---|---|---|---|---|---|---|---|---|
b62e208f2f53c6877f7fd8ea2c928a0a229ab3ad | AK-1121/code_extraction | /python/python_17018.py | UTF-8 | 120 | 3.703125 | 4 | [] | no_license | # Python: Split a list into sub-lists based on index ranges
l = [a, b, c, d, e]
c_index = l.index("c")
l2 = l[:c_index]
| true |
641d6e96dbd9327aaf414d7d4e249887c1fd812a | ky822/Big-Data-Final-Project | /tips_pickuptime/map.py | UTF-8 | 536 | 3.015625 | 3 | [] | no_license | #!/usr/bin/python
import sys
import datetime
for line in sys.stdin:
pickup_datetime, val = line.strip().split('\t')[0].strip(), line.strip().split('\t')[1: ]
new_time = datetime.datetime.strptime(pickup_datetime.strip(), '%Y-%m-%d %H:%M:%S')
trip_time_in_secs = val[0]
try:
time_secs = int(trip... | true |
c82fc40e4f0007130fc0eabb95a3f20c63723640 | jkbhagatio/robo0 | /robo0/test_termios.py | UTF-8 | 883 | 2.734375 | 3 | [] | no_license | # Imports.
import time, os, sys
if os.name == 'nt': # specify keyboard input reader by OS
import msvcrt # Windows
else:
import tty, termios # other
import RPi.GPIO as GPIO
def get_keypress():
'''
Returns the ascii value of the last keypress without blocking thread execution
'''
if os.nam... | true |
1a11e02fab1ae283d7c43ef267372f7b0f5d4b25 | wolfseccyber/projects | /coffee mod/coffee_shop.py | UTF-8 | 713 | 3.453125 | 3 | [] | no_license | """
The coffee shop module contains functions and contains variables
important to implementing a coffee shop.
"""
# Set some variables
shop_name = "RuneScape Beans"
coffee_sizes = ["small", "medium", "large"]
coffee_roasts = ["hot chocolate", "light", "medium", "dark", "espresso"]
milk_type = ["dairy", "almond", "soy"... | true |
615fe833c5e798b5adca72a87e5a00635ac80882 | fidelis111/fidelis1 | /desconto.py | UTF-8 | 102 | 3.796875 | 4 | [] | no_license | n = float(input('Digite um número:'))
n1 = n*0.05
print('O valor com desconto é: {}'.format(n+n1))
| true |
e4dbb037b9a45d97b2ad95bb41c7f5154878483c | MotazBellah/Code-Challenge | /test_path.py | UTF-8 | 1,373 | 3.390625 | 3 | [] | no_license | def path_finder(area):
start = 0, 0
maze = area.split('\n')
target = len(maze) - 1, len(maze[0]) - 1
stack = []
stack.append((start, None, 0))
explored = set()
parent_dict = {}
total = 0
while stack:
node, parent, distance = stack.pop(0)
if node == target:
... | true |
5b11e11e6013e77d91991367b453084c5d32bf43 | CurtisDai/DAPro | /Raymond/raymondNode.py | UTF-8 | 3,327 | 2.75 | 3 | [] | no_license |
class Node(object):
def __init__(self, ip, port,parent_addr=None,cs_addr = None, cs=False, token=False):
self.addr = (ip,port)
self.parent = parent_addr
self.cs_addr = cs_addr
self.cs = cs
self.token = token
self.queue = []
self.monitor = None
def reci... | true |
060fc225ce2a9c45e97ac8b32e709c3cef80d79c | rick42/Simple_Blockchain | /difficulty.py | UTF-8 | 3,182 | 3.453125 | 3 | [] | no_license | class Difficulty:
# this allows you to control the speed at which new blocks can be added
@classmethod
def bits_to_target(cls, bits):
"""converts a decimal number(bits) and converts it
to the 64 bit hexidecimal target which dictates difficulty
"""
bits= int(bits , ... | true |
9cc86800fecd39d78eed576543e5f7763ea0b735 | LucasSargeir/Python-TCP-server | /client.py | UTF-8 | 457 | 3.09375 | 3 | [] | no_license | import socket
from random import random
if __name__ == "__main__":
HOST = 'localhost'
PORT = 7777
senha = int(random() * 1000)
print(F"SENHA: {senha}\n")
client = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
client.connect((HOST, PORT))
client.send(f'Eu sou o cliente com a senha {senha}, pode me prestar... | true |
8cd258abac0dd4b8782399c62ecb9f6466472ef3 | naolwakoya/python | /count.py | UTF-8 | 860 | 3.296875 | 3 | [] | no_license | def countsort(list):
list1 = [0,0,0,0,0,0]
list2 = [list[0]]
final_List = []
#part1
for value in list:
if value == 'A' or value == 0:
list1[0] += 1
elif value == 'B' or value == 1:
list1[1] += 1
elif value == 'C' or value == 2:
list1 [2] += 1
elif value == 'D' or value == 3:
li... | true |
4c69835dde605143c524cbb23e3d86efe7a71fc3 | Zeng-Zer/QuantumSolaceBack | /app/circuit.py | UTF-8 | 2,604 | 3.125 | 3 | [] | no_license | from typing import List
import os
import itertools
import json
class Gate:
@classmethod
def from_json(cls, data):
if data == None:
return None
else:
return cls(**data)
def __init__(self, name: str, option: str):
self.name = name
self.option = option
... | true |
04884802117c137df6c6ea175532ff0141a847bc | asaluja/spectral-scfg | /scripts/analyze_features.py | UTF-8 | 535 | 2.6875 | 3 | [] | no_license | #!/usr/bin/python -tt
import sys, commands, string
def main():
feature_types = {}
for line in sys.stdin:
featureName = line.strip().split(':')[0]
if len(featureName.split('_')) > 1:
featureName = featureName.split('_')[0]
if featureName not in feature_types:
fea... | true |
5c4ca9dbc72ba183a7f4c5fd679e9b849fd816b9 | lewiscj97/pi-football | /football/displayer.py | UTF-8 | 1,122 | 3.125 | 3 | [] | no_license | #!/usr/bin/python
from inky.auto import auto
from PIL import Image, ImageFont, ImageDraw
from font_fredoka_one import FredokaOne
class DisplayText:
def __init__(self):
self.inky_display = auto()
self.inky_display.set_border(self.inky_display.WHITE)
self.img = Image.new("P", (self.inky_dis... | true |
3d4b50c0451434404ee0563a7ca35c1f84096bdf | xwlee9/python | /python/网络通信/3udp_demo.py | UTF-8 | 1,100 | 3.390625 | 3 | [] | no_license | import socket
def send_msg(s_udp):
"""发送消息"""
dst_ip = input("please input the dst ip: ")
dst_port = int(input("please input the dst port: "))
send_data = input("please input the data: ")
s_udp.sendto(send_data.encode("utf-8"), (dst_ip,dst_port))
def rec_msg(s_udp):
"""接收消息"""
rx_data = ... | true |
7a6962b4e7a7f45afc818773b495cb52c3b51da4 | terodea/DSA | /practice/data_engineering/array/8.seggrgate_0_and_1.py | UTF-8 | 2,185 | 4.3125 | 4 | [] | no_license | class Solution:
def segregate0and1(self, arr, n) :
# Counts the no of zeros in arr
count = 0
for i in range(0, n) :
if (arr[i] == 0) :
count = count + 1
# Loop fills the arr with 0 until count
for i in range(0, count) :
arr[i... | true |
2f4bd6a02f4e9a6d596c55c88268c2f6f60473a5 | Khalid-Sultan/Phase-2-Algorithms-Prep | /Leetcode/Greedy/2_-_Medium/1282._Group_the_People_Given_the_Group_Size_They_Belong_To.py | UTF-8 | 447 | 2.859375 | 3 | [
"MIT"
] | permissive | class Solution:
def groupThePeople(self, groupSizes: List[int]) -> List[List[int]]:
d = {}
for ind, i in enumerate(groupSizes):
if i not in d:
d[i] = [[ind]]
else:
if len(d[i][-1])==i:
d[i].append([ind])
else... | true |
777e1f887a6ac7848656e28c5138f6a036794a05 | mengchiehling/Coursera_Advanced_Machine_Learning_Final_Project | /LSTM.py | UTF-8 | 4,243 | 2.53125 | 3 | [] | no_license | import pandas as pd
import numpy as np
import keras
from keras.models import Sequential
from keras.layers import Dense, Flatten, LSTM, Embedding, Input, BatchNormalization
from keras.callbacks import ReduceLROnPlateau, ModelCheckpoint, EarlyStopping
from keras.optimizers import Adam
from keras import backend as K
def... | true |
fefda47ef095c31aa5c9a129f4864bee7569cc1a | NagahShinawy/problem-solving | /pynative/8_dictionary/ex_2.py | UTF-8 | 686 | 4.34375 | 4 | [] | no_license | """
Exercise 2: Merge following two Python dictionaries into one
dict1 = {'Ten': 10, 'Twenty': 20, 'Thirty': 30}
dict2 = {'Thirty': 30, 'Fourty': 40, 'Fifty': 50}
Expected output:
{'Ten': 10, 'Twenty': 20, 'Thirty': 30, 'Fourty': 40, 'Fifty': 50}
"""
def merge_dicts(*dictionaries):
merged = dict()
for dictio... | true |
304932e873d01479281e4bc96192feeb153d1641 | berruezo/conv-neural-network | /main.py | UTF-8 | 2,202 | 3.015625 | 3 | [] | no_license | #coding:utf-8
'''
Clasificador de dígitos escritos a mano
Utiliza la librería Network.py y el dataset de MNIST
'''
import Network as net
import numpy as np
TRAINS = 60000 #Cantidad de tests para entrenar la red
TESTS = 10000 #Cantidad de tests para evaluar la red
SIZE = 784
imgTrain = open("mnist/train-images-idx3-ub... | true |
45f9b3cb42beb231d9ee994d5530e0f88c309022 | jimmyzhoujcc/saltui | /handlers/randompassword.py | UTF-8 | 478 | 2.671875 | 3 | [] | no_license | #!/usr/bin/python
#-*- coding: utf-8 -*-
import json
import sys
reload(sys)
sys.setdefaultencoding('utf8')
import tornado.web
def randpasswd():
import random
a = ""
for j in random.sample(['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', \
'i', 'j', 'k', 'A', 'B', 'C', 'D', 'E', 'F', 'G', ... | true |
38d372f02103dd0826bd332f29a89280bd84fe5d | diyasatanur/main | /main.py | UTF-8 | 1,530 | 3.4375 | 3 | [] | no_license | # import packages
import pygame, random
from pygame.locals import *
from sprite_loader import Spritesheet
from cat import Cat
# initialize game
pygame.init()
# initialize screen
screen_info = pygame.display.Info()
size = (width, height) = (800,600)
screen = pygame.display.set_mode(size)
#initialize clock
clock = (... | true |
150aa4ea49ff6c6e41dfc0db3fe9cc5b20e8bfc3 | c0n73x7/numericke-metody | /numericke_metody/slae/sor.py | UTF-8 | 2,281 | 3.03125 | 3 | [] | no_license | import numpy as np
def sor(A, b, x0, omega, eps=0.001, max_iter=100, show_progress=False):
'''
SOR method
Input Params
------------
A .............. coefficient matrix
b .............. right-hand side vector
x0 ............. vector of the initial approximation
omega .......... relaxat... | true |
24406f17e37ee188998d09349dfe1e235a63d8e3 | artificial-dummies/StarCraft2_AI_BOT | /Bot/kerastmp.py | UTF-8 | 6,590 | 2.765625 | 3 | [] | no_license | import tensorflow as tf
import keras.backend.tensorflow_backend as backend
import keras # Keras 2.1.2 and TF-GPU 1.9.0
from keras.models import Sequential
from keras.layers import Dense, Dropout, Flatten, Activation
from keras.layers import Conv2D, MaxPooling2D
from keras.callbacks import TensorBoard
import numpy as n... | true |
2ec961979034dc8925fcf8641115ecbc6922d373 | Rekkursion/Spanishing_Qt | /utils/utility.py | UTF-8 | 891 | 3.21875 | 3 | [] | no_license | import uuid
from PyQt5.QtWidgets import QWidget, QLayout
class Utils:
# generate a string w/ random characters in a fixed length of 20
@staticmethod
def generate_random_string():
return uuid.uuid4().hex[:20]
# set the enability of a widget or a layout recursively
@staticmethod
def se... | true |
cd7f313c5a230f924e61a22cd333852d613ea094 | simofleanta/Python-learning | /keyword arg functions.py | UTF-8 | 1,537 | 4.03125 | 4 | [] | no_license | def my_function(c0,c1,c2,c3,c4,c5):
print("hello from " + c2)
my_function(c0="FR",c1="Ger",c2="Dk",c3="Nth",c4="KR",c5="BG")
def my_function(**country):
"""This function tells where I am from using multiple keywordargs"""
print("hello from " + country["city"], country['name'],country['hub'])
my_function(c... | true |
47ccc46a7a1110c866becd5608f392c9412d47d0 | Andopio/Radius-of-Circle | /Pints in unit squared.py | UTF-8 | 1,515 | 3.34375 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
import random as rnd
unifRN= rnd.uniform
#square has corners (0.5,-0.5),(0.5,0.5),(-0.5,0.5),(-0.5,-0.5)
def dist2Center(x,y):
if abs(x)<=0.5 and abs(y)<= 0.5 :
d = np.sqrt(x**2 +y**2)
if d <= np.sqrt(2):
return d
else:... | true |
06624d668f37bee955819e421f826ee575747299 | amusecode/amuse | /examples/textbook/stellar_isochrone.py | UTF-8 | 5,316 | 2.671875 | 3 | [
"Apache-2.0",
"LicenseRef-scancode-warranty-disclaimer"
] | permissive | """
Evolve a population of N stars.
Initial mass function between Mmin and Mmax with stellar evolution
for metallicity z.
"""
import sys
import numpy
from amuse.lab import *
from matplotlib import pyplot
from prepare_figure import single_frame, figure_frame, set_tickmarks
from distinct_colours import get_dist... | true |
47f9f0070ccee9fbb4755999928ed15fb3f09bca | watashikarawatashi/team6 | /server/server2/server2_serv/server.py | UTF-8 | 719 | 3.09375 | 3 | [
"MIT"
] | permissive | # server.py
import socket
ip_address = '127.0.0.1'
port = 7010
buffer_size = 4092
# Socketの作成
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
# IP Adress とPort番号をソケット割り当てる
s.bind((ip_address, port))
# Socketの待機状態
s.listen(5)
# while Trueでクライアントからの要求を待つ
while True:
# 要求があれば... | true |
b95436169f893a5ab200aa4591f941f7bb5a08c7 | rutujanalage/HackerRank.-py | /Mod Divmod.py | UTF-8 | 167 | 2.625 | 3 | [] | no_license | # HackerRank.-py
30 days of code python
Friday 24 July
@author-Rutuja Nalage
a=int(raw_input())
b=int(raw_input())
print a/b
print a%b
print divmod(a,b)
| true |
f71f2d7b69c5fd19cda7a32d1b84522acf7679c1 | vanderschuea/AdventOfCode2017 | /14/defrag_1.py | UTF-8 | 1,088 | 3 | 3 | [] | no_license | # see week 10
def knot_hash(input):
lengths = []
for c in input:
lengths += [ord(c)]
lengths += [17, 31, 73, 47, 23]
curr = 0
skip = 0
tab = [x for x in range(256)]
for _ in range(64):
for le in lengths:
# Reversing
for i in range(le // 2):
... | true |
826d7027de4a9a61e068e0e7bcf1127e4ec81587 | victor-consiglio/challenge-accepted-python-Clima-tempo | /ChallangeClimaTempo.py | UTF-8 | 2,670 | 3.015625 | 3 | [] | no_license | import numpy
import matplotlib.pyplot as plt
import matplotlib.dates as mdates
from netCDF4 import Dataset, num2date
from mpl_toolkits.basemap import Basemap, cm
# Definindo o menor ponto de diferença entre latitudes e longitudes e devolvendo o resultado em x e y.
def latlong(latitudes, longitudes, lat,lon):
x... | true |
194a9027ae277f653fa55b9d41b3ec26de2f758b | uic-evl/LymphaticCancerViz | /similarity/Patient.py | UTF-8 | 8,240 | 2.859375 | 3 | [] | no_license | import numpy as np
from Graph import Graph
import sys, math
import itertools
class Patient(object):
def __init__(self, p_id):
self.id = p_id
self.left_graph = None
self.right_graph = None
self.tumor_position = ""
self.gender = ""
self.lymph_nodes = []
self.... | true |
214b29b97f94862cd04014c28d293c58c52eeabf | MakeSchool-17/twitter-bot-python-ignat980 | /reversal.py | UTF-8 | 158 | 2.734375 | 3 | [] | no_license | import sys
if __name__ == '__main__':
if len(sys.argv[1:]) == 1:
print(sys.argv[1][::-1])
else:
print(' '.join(sys.argv[1:][::-1]))
| true |
e891f2d1449782bc50fa37d2626b8602c49d3a7d | gabechu/pii_recognition | /pii_recognition/paths/path.py | UTF-8 | 889 | 3.0625 | 3 | [] | no_license | import re
from abc import ABCMeta, abstractmethod
from typing import Match, Optional
class Path(metaclass=ABCMeta):
valid: bool = False
def __init__(self, path: str):
self.path = path
matches = self.get_pattern()
if matches:
self.valid = True
self._pattern_to_a... | true |
35dfe8dc760dbd2fa2c5285273f8128910742278 | UniTN-KDILab/Spatial-Modeling-2018-19 | /pyosm/pyosm/db_helper.py | UTF-8 | 3,086 | 2.78125 | 3 | [] | no_license | import logging
from pyosm.osm_elements import OSMNode, OSMWay, OSMRelation
from pyosm.db_handler import get_osm_db_connection, merge_relations_with, merge_ways_nodes
logger = logging.getLogger("osm.dbhelper")
logger.addHandler(logging.NullHandler())
class OSMDBHelper:
def __init__(self, db_filename):
se... | true |
41fdceb27537cbe850162b2863183204103cb792 | mellosilvajp/projetos_unipampa | /teste github/exercicios_vetores_13.py | UTF-8 | 2,160 | 3.84375 | 4 | [] | no_license | # https://www.passeidireto.com/arquivo/56813560/listas-em-python-exercicios-iniciais
# Observe que cada letra equivale a um número entre 1 e 26 e o espaço ao 0.
# Faça a função "traduzir", que recebe uma lista com uma mensagem e "traduz" a sequência armazenada de acordo com o código das amigas.
# DICA: ... | true |
568dc073add869f27feafc6be4a21d96dbd6fea7 | shiki7/Atcoder | /ABC126/C.py | UTF-8 | 187 | 3.046875 | 3 | [] | no_license | n, k = map(int, input().split())
ans = 0
for i in range(1, n+1):
for j in range(10**5):
if i*(2**j) >= k:
ans += 1 / (n * (2 ** j))
break
print(ans)
| true |
c98fdfd09656115475d91b2b5f6bc84bac775773 | minm063/CodeTest | /LevelOne/두 정수 사이의 합.py | UTF-8 | 171 | 3.125 | 3 | [] | no_license | def solution(a, b):
answer = 0
tmp=0
if a>b:
tmp=a
a=b
b=tmp
for i in range(a,b+1):
answer=answer+i
return answer
| true |
8301df715607c78e00f2bccc850e4af96ff4c750 | harycane/Leetcode | /Arrays/56_MergeIntervals.py | UTF-8 | 820 | 3.375 | 3 | [] | no_license | # https://leetcode.com/problems/merge-intervals/description/
class Solution:
def merge(self, intervals: list[list[int]]) -> list[list[int]]:
if intervals is None:
return None
n = len(intervals)
start = []
end = []
for i in range(0, n):
start.append... | true |
0fc5670d0759463907444a929d7fa84b69d66e36 | nkkolluru/tweetalizer | /accuracy_calc.py | UTF-8 | 2,461 | 3.015625 | 3 | [] | no_license | # Group 8
# Nanda Kishore Kolluru - 800970494
# Jay Shah - 800326050
# This file is used to compute the accuracy of the classfied and labeled tweets.
import re
import sys
from pyspark import SparkContext
def clean_tweet(tweet_text):
tweet_text = re.sub(r'(\w+://\S+)', '', tweet_text)
# remove those hashtags
... | true |
a90117a71f1ffbe60e4085fc68369c142b25b333 | Xiao-Chen820/01_4 | /Matplotlib/matImage.py | UTF-8 | 536 | 3.171875 | 3 | [] | no_license | import matplotlib.pyplot as plt
from PIL import Image
# 打开指定图片
image = plt.imread('female.jpg')
im = Image.open('female.jpg')
width, height = im.size
print('图片宽为', width, '图片高为', height, '图片格式为', im.format, '图片描述为', im.format_description)
# 指定图片中的红波段
im_r = image[:, :, 0]
# 图片显示红波段
plt.imshow(im_r)
# 窗口中展示图片
plt.show(... | true |
9d082c93c6a7971d9b6e11f02a60d8cf4ba77d9a | Duko-H/PythonAchievements | /PYTB1L4WheresWaldo/Waldo.py | UTF-8 | 391 | 3.6875 | 4 | [] | no_license | import random
people = ["Waldo","Jackson","Ray","Eric","Vaughn","Jesse","Herbert","Robert", "Rodrigo","Elija","Sasha","Nathaniel","Ellie","Allison","Jeremiah", "Paula", "Alisha","Tory","Troy", "Faye"]
random.shuffle(people)
print(people)
for index in range( len(people) ):
print( people[ index ] )
if ( people[ ind... | true |
ed5fab0a708d3057216265328f68c93315404cf3 | ebezzam/cvxpy | /cvxpy/problems/problem_data/matrix_data.py | UTF-8 | 10,597 | 2.578125 | 3 | [
"Apache-2.0"
] | permissive | """
Copyright 2013 Steven Diamond
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software... | true |
71c2d2f20ba427f999458f695dd8319724512304 | tkettu/AdventOfCode2017 | /milliseconds6/milliseconds62.py | UTF-8 | 1,038 | 3.046875 | 3 | [
"MIT"
] | permissive |
import sys
def distribute(blocks):
states = []
same_block = []
li = 0
#while blocks not in states:
while blocks not in states:
states.append(blocks[:])
si = blocks.index(max(blocks))
b = blocks[si]
blocks[si] = 0
blocks = distribute_index(blocks, b, si)
... | true |
6a19efd04f0f0eb525bf9cae8ee595a56c8d391b | KewinLizarraga/HackerRank | /Python/01_Introduction/07_PrintFunction.py | UTF-8 | 276 | 4.4375 | 4 | [] | no_license | """
Read an integer N.
Without using any string methods, try to print the following:
123...N
Note that "..." represents the values in between.
"""
def number(n):
for i in range(n):
print(i+1,end="")
if __name__ == '__main__':
n = int(input())
number(n)
| true |
aede15ab665cc7df9580b6adfd9cb1f6b23dc874 | mrsata/JP-EN-discrepancy-calculator | /jtranscript.py | UTF-8 | 804 | 2.59375 | 3 | [] | no_license | def jtranscript(j):
t = j.replace('-', '').replace(' ','').replace('(','').replace(')','')
t = t.replace('r', 'ɹ')
t = t.replace('ja', 'd͡ʒja')
t = t.replace('ju', 'd͡ʒju')
t = t.replace('jo', 'd͡ʒjo')
t = t.replace('j', 'd͡ʒ')
t = t.replace('sha', 'ʃja')
t = t.replace('shu', 'ʃju')
... | true |
0d208829fbf3dbe1c2dd9acf2c7eacefd67c397e | tiroring09/Study | /Python_DataStructure_and_Algorithm/1장_숫자/3_convert_from_decimal.py | UTF-8 | 645 | 3.9375 | 4 | [] | no_license | """10진수로 주어진 자연수 number를 base진법으로 변환한다."""
def convert_from_decimal(number, base):
multipler = 1
result = 0
while number > 0:
result += number % base * multipler # number를 base로 나눈 나머지에 multipler를 곱함으로써 자리 수 마련한다.
multipler *= 10 # 다음 자릿수로 이동
number = number // base # 다음 자릿수로 이동
... | true |
588cc710ce6ce425b18da34fe3677cf335d19d89 | osydorchuk/ITEA2 | /lesson1/main7.py | UTF-8 | 573 | 2.953125 | 3 | [] | no_license | try:
k = 1/0
except:
print('Exception was caught')
print('-'*5)
try:
k = 1/0
except ZeroDivisionError:
print('Zero Division is not allowed')
except KeyError:
print('KeyError was caught')
print('-'*5)
try:
k = ['key']
except ZeroDivisionError:
print('Zero Division is not al... | true |
5c168aa63a06b7cce808a1280c75f2f1a4d9ea63 | aasislamic/ElectivePriorityManager | /apps/algorithm/__init__.py | UTF-8 | 6,482 | 3.765625 | 4 | [] | no_license | """
The Algorithm goes like this:
STEP 1: First, arrange the priority listing of the students in a TABULAR FORMAT with rows the column header containing the
list of students and rows index containing the list of the subjects and each cell containing the priority for
the students (Column) priority for t... | true |
c6e33deae2a7988d6a53b1936473de8d4c368eb4 | Tanmay53/cohort_3 | /submissions/sm_112_soumik/week_13/day_5/count_masai.py | UTF-8 | 141 | 2.859375 | 3 | [] | no_license | li = open("random_ids.txt", "r")
search = ""
count = 0
for items in li:
if "masai" in items:
count += 1
li.close()
print(count)
| true |
640c82c29de4c4820fa343bc59cf73de74ea8fa6 | qq8282661/learn_py | /learn_os.py | UTF-8 | 958 | 3.9375 | 4 | [] | no_license | import os
'''
文件操作和目录
'''
# 查看系统环境变量
print(os.environ)
print('PATH', os.environ.get('PATH'))
# 查看当前目录的绝对路径:
print('path', os.path.abspath('.'))
# 在某个目录下创建一个新目录,首先把新目录的完整路径表示出来:
abspath = os.path.join(os.path.abspath('.'), 'test_dir')
print('abspath', abspath)
# 创建文件夹如果有会报错,rmdir也会报错
# os.mkdir(abspath)
# os.rmdir(... | true |
f8dccd96434d173d7ed9d50c08709a226dd734c7 | kk6axq/VCC_Bot | /vccbot_testing/src/odomListener.py~ | UTF-8 | 763 | 2.71875 | 3 | [] | no_license | #!/usr/bin/env python
import rospy
from nav_msgs.msg import Odometry
first = True
firstX = 0
firstY = 0
deltaX = 0
deltaY = 0
d = 0
def callback(data):
global first
global firstX
global firstY
global deltaX
global deltaY
global d
if first:
firstX = data.pose.pose.position.x
firstY = data.pose.pose.position.... | true |
e3a61964f68bffd850f8b9892a5d440be41de91d | rebekah-shtayfman/madpy | /madpy.py | UTF-8 | 1,211 | 2.84375 | 3 | [] | no_license | from math import *
import pandas as pd
class Particle:
def __init__(self,pdg=None,status=None,px=0,py=0,pz=0,E=0):
self.pdg=pdg
self.status=status
self.px=px
self.py=py
self.pz=pz
self.E =E
@property
def M(self):
return sqrt(self.E**2-self.... | true |
14bd386aee5cfa2459643c1ceae1770231fd05f4 | mlasevich/sharepoint-tool | /src/sp_tool/sharepoint/exceptions.py | UTF-8 | 398 | 2.640625 | 3 | [
"Apache-2.0"
] | permissive | """
Exceptions for sharepoint api connector
"""
class BaseSharepointException(Exception):
""" Base Sharepoint Exception """
class APICallFailedSharepointException(Exception):
""" Base Sharepoint Exception """
def __init__(self, code, err_msg):
""" Initializer"""
super().__init__(f"Error... | true |
651d6cbc691957a23ab37664899a4ec9b5bab238 | TysonRV/restaurants-scrap | /webscraptripv4.py | UTF-8 | 2,260 | 2.90625 | 3 | [] | no_license | import requests
import bs4
import re
import csv
#change name for link
restaurant_details_class = "wQjYiB7z"
def trip_link_restaurants():
mainpagetrip = "https://www.tripadvisor.co.uk/"
pagenum= 0
restaurant_links= []
#for page in range(1,10):
for page in range(1,2):
subpagetrip = "Restaur... | true |
6d220bb278cda67583817a78def5a69957cd13c8 | dman777/krunch-uploader | /modules/filter.py | UTF-8 | 271 | 2.734375 | 3 | [] | no_license | import logging
class MyFilter(object):
"""Filters for log messages. We want to keep info and error messages seperated"""
def __init__(self, level):
self.__level = level
def filter(self, logRecord):
return logRecord.levelno <= self.__level
| true |
79dbabc950e1978edbf22b6daa2c109e7d906c02 | joscelino/Operacoes-matematicas | /Scripts/numero_reverso.py | UTF-8 | 152 | 3.5 | 4 | [] | no_license | n = int(input())
if n<10:
print(n)
else:
while n >= 10:
print(n % 10, end='')
n = n//10
if n < 10:
print(n) | true |
fc1dd1fefd1b7a86258221f970130cdef790b8cc | Qandi430/python | /chapter6/practice3.py | UTF-8 | 342 | 3.375 | 3 | [] | no_license | # P′=P(1+rn)nt
# P′ : 원리금
# P : 원금
# r : 연이율
# t : 기간
# n : 복리 횟수
def compound_interest_amount(p,r,t,n) :
return p * (1 + r / n) ** (n * t)
print(compound_interest_amount(1500000, 0.043, 6, 4))
print(compound_interest_amount(1500000, 0.043, 6, 1/2))
print(compound_interest_amount(3600000, 0.058, 2, 1)) | true |
7a9a5869fb927407c292175690294d6d46f5cf9a | nishitpatel01/Data-Science-Toolbox | /algorithm/Hashmap/985_Sum_of_Even_Numbers_After_Queries.py | UTF-8 | 874 | 3.109375 | 3 | [
"MIT"
] | permissive | class Solution:
def sumEvenAfterQueries(self, A: List[int], queries: List[List[int]]) -> List[int]:
ans = []
running = sum(val for val in A if val % 2 == 0)
for val, idx in queries:
pre = A[idx]
A[idx] += val
# remember to update running!
... | true |
4e634c77b6475aa41361891a2a71969c7efc3b00 | JonnyAlpha/Robotic_Vision | /maze_steering.py | UTF-8 | 5,346 | 2.984375 | 3 | [] | no_license | import numpy as np
import cv2
import math
# Camera calibration parameters (centimeters)
#
# _______________O camera
# | |
# | ROBOT |height image plane
# |______________| /
# O O <------- ground ----->/
# ... | true |
b12710b7aaceedad9b8ac69e416dc437ce4cdeae | rohithteja/K-Nearest-Neighbours | /code/tuning K.py | UTF-8 | 1,881 | 2.84375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sat Nov 23 23:03:37 2019
@author: User
"""
import turtle
import pandas as pd
import seaborn as sn
from sklearn.neighbors import KNeighborsClassifier
from sklearn.model_selection import train_test_split
from sklearn.model_selection import cross_val_score
from sklearn.p... | true |
9a5e4d813e3d9f4d3b01bdad085c24327890aa00 | VladislavSolovyev/Technomax | /Sequence_Pair.py | UTF-8 | 4,299 | 2.71875 | 3 | [] | no_license | from Technomax.Placement_Routing import Figure, Coordinate, Area
import random
import math
import copy
# TODO Файлик для теста разных SP, протестированы с телеги и Вонговский
class SeqPair:
def __init__(self, X, Y, wid_hei_dict):
self.X = X
self.Y = Y
self.wid_hei_dict = wid_h... | true |
690c805ceffe227f5b4cdd282b8d8180f05b79fa | wldmr/notedown | /parsing/util.py | UTF-8 | 5,549 | 3.9375 | 4 | [] | no_license | import re
class Parser:
r"""This is what a ``§Phrase definition `` looks like.
A phrase is started after the regular expression defined by
``Parser.start`` matches::
>>> p = Parser()
>>> p.start == r'§(?!\s)'
True
and ends before the "phrase ending" regular expression, defi... | true |
c14bcad16942a580811125f104da831bbe5630a6 | kimseoyang2/KioskSW | /Assets/Python Scripts/server.py | UTF-8 | 997 | 3.265625 | 3 | [] | no_license | # Created by Youssef Elashry to allow two-way communication between Python3 and Unity to send and receive strings
# Feel free to use this in your individual or commercial projects BUT make sure to reference me as: Two-way communication between Python 3 and Unity (C#) - Y. T. Elashry
# It would be appreciated if you se... | true |
c8469fa44b58a80d30749142916e5696fa30058d | ashayaan/Machine-Learning-Projects | /data/new_data/kaggle.py | UTF-8 | 3,920 | 2.625 | 3 | [] | no_license | from bs4 import BeautifulSoup
import csv
import sys
import pandas as pd
import time
import dryscrape
reload(sys)
sys.setdefaultencoding('utf-8')
if __name__ == '__main__':
source_code = open('kaggle.html', 'r').read()
soup = BeautifulSoup(source_code, "html.parser")
session = dryscrape.Session()
count = 0
data_l... | true |
fb576c835da63c2e8c664ef452e0d332b5d1c34c | Cranch21/mystuff | /a2-support-master/game_env.py | UTF-8 | 24,082 | 3.203125 | 3 | [] | no_license | import random
from game_state import GameState
"""
game_env.py
This file contains a class representing an Untitled Dragon Game environment. You should make use of this class in your
solver.
COMP3702 2021 Assignment 2 Support Code
Last updated by njc 02/09/21
"""
class GameEnv:
"""
Instanc... | true |
dd9f9e0120ba5fcd470521a891e7adbc1146c67d | Sasa94s/code-your-own-quiz | /model.py | UTF-8 | 512 | 3.171875 | 3 | [] | no_license | import json
class Question(object):
"""This is the structure of any question in quiz"""
# Instance variables
id = None
type = None
question = None
answer = None
explanation = None
solved = False
def __init__(self, id, type, question, answer, explanation):
"""Initializing i... | true |
d927a93db9b3df71b6f43f1ba56f0b2de19631fa | Romulus83/python | /affairs.py | UTF-8 | 4,838 | 3.53125 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Thu Mar 19 17:54:27 2020
@author: user
"""
"""
Code Challenges
Q1. (Create a program that fulfills the following specification.)
affairs.csv
Import the affairs.csv file.
It was derived from a survey of women in 1974 by Redbook magazine, in which married women
were asked abo... | true |
b0a997f83b02a5387bbdcfe44c9f940de0ee855d | ShuangLyu/InformationRetrieval | /getdoc2vec.py | UTF-8 | 1,457 | 2.65625 | 3 | [] | no_license | from sklearn import feature_extraction
from sklearn.feature_extraction.text import TfidfTransformer
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.feature_extraction.text import TfidfVectorizer
import jieba
import numpy as np
import pandas as pd
import codecs
from sklearn import preprocessing... | true |
82d0ac74014210514864e422a29b56cd5a767500 | tapnair/DXFImporter | /DXFImporter/lib/ezdxf/math/points.py | UTF-8 | 529 | 2.734375 | 3 | [
"MIT"
] | permissive | # Copyright (c) 2019 Manfred Moitzi
# License: MIT License
from typing import TYPE_CHECKING, Iterable
from ezdxf.math.vector import Vector
if TYPE_CHECKING:
from ezdxf.eztypes import Vertex
def closest_point(base: 'Vertex', points: Iterable['Vertex']) -> Vector:
base = Vector(base)
min_dist = None
fo... | true |
ac01b95381a31adef243b0ef482f944e730ec0fa | sayands/machine-learning-projects | /Algorithms-From-Scratch/Multivariate-Linear-Regression/M_LR.py | UTF-8 | 1,271 | 3.5 | 4 | [] | no_license | # importing the libraries
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
# Reading the data
my_data = pd.read_csv('home.txt', names = ["size", "bedroom", "price"])
# normalise the data
my_data = (my_data - my_data.mean()) / my_data.std()
my_data.head()
# compute the cost
def computeCost(X, y,... | true |
48568063c88d6ff4dd02c42eced2bd13f16b646d | kaesekaiser/zephyrus | /bot/minigames/boggle.py | UTF-8 | 2,312 | 3.390625 | 3 | [] | no_license | from random import choice, sample
adj = -5, -4, -3, -1, 1, 3, 4, 5
def score(word: str):
return 1 if len(word) < 5 else 2 if len(word) == 5 else 3 if len(word) == 6 else 5 if len(word) == 7\
else 11
class Board:
dice = ["LRNNZH", "EGHWEN", "SESITO", "TOWATO", "JOBABO", "RLYDEV", "DITTYS", ... | true |
1f4ccafa45f6b13236bdfdaeb3bb7db0d1096ef2 | WorksApplications/SudachiPy | /tests/dictionarylib/test_doublearraylexicon.py | UTF-8 | 4,620 | 2.59375 | 3 | [
"Apache-2.0"
] | permissive | # Copyright (c) 2019 Works Applications Co., Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | true |
5decc05e7fb74a11dc0ac7f2c2c40ff526e6e9ec | garrettsc/rover | /tests/motor_tests/motor_test.py | UTF-8 | 301 | 2.75 | 3 | [] | no_license | from gpiozero import Motor
from time import sleep
motor_1 = Motor(forward=26, backward=19)
motor_2 = Motor(forward=13, backward=20)
for i in range(2):
motor_1.forward()
motor_2.forward()
sleep(5)
motor_1.backward()
motor_2.backward()
sleep(5)
motor_1.stop()
motor_1.stop()
| true |
189fed2d29f797df7717132773209085a844477d | d3z/AdventOfCode | /DaySeven/signals.py | UTF-8 | 1,685 | 3.125 | 3 | [] | no_license | import re
instruction_re = re.compile(r"(.+) -> (.+)")
def parse_instruction(instruction):
return instruction_re.match(instruction).groups()
gates = {
"NOT": lambda x: 65536 + ~x,
"AND": lambda x, y: x & y,
"OR": lambda x, y: x | y,
"LSHIFT": lambda x, y: x << y,
"RSHIFT": lambda x, y: x >>... | true |
d8ee86f454c164a07de37d40de76266411aae5f6 | turpure/search | /modifybyapi/namedic.py | UTF-8 | 568 | 3.078125 | 3 | [] | no_license | __author__ = 'james'
import re
'''fomart the data in this way {'SKU':'itemID'}'''
def skuitem():
namearry={}
try:
f=open('/home/james/PycharmProjects/modifybyapi/mfields/rawdata','r')
except IOError as e:
print(e)
pattern=re.compile(r'\d{12}')
for eachline in f:
sku=eachline[... | true |
8df047a05d17e279c1b12a840d29bc64af2b8839 | daskelly/phb_paper | /phb_mapping_workflow.py | UTF-8 | 4,247 | 2.78125 | 3 | [] | no_license | #!/usr/bin/env python
"""Starting with raw reads (fastq), map them and produce a BAM file
that can be input into the PHB HMM.
Outline:
1) Map reads
2) Sort BAM file
3) Mark duplicates in BAM file
4) Filter out reads that are duplicates, non-primary hits, unmapped, or fail QC
"""
import sys, argparse, os, re, subproces... | true |
1dcfa3e6201696a56abcfa423a413128bd8216b7 | mustbepro/toggl-api | /togglin.py | UTF-8 | 5,201 | 3.15625 | 3 | [] | no_license | #!/usr/bin/python3
from random import randint
import calendar
from collections import defaultdict
array = [1, 2 ,3 ,4, 5]
week = []
#for i in array:
# week.append(randint(4,7))
total_time = 20
count = 0
#while (count < total_time):
# entry = randint(4,7)
#
# if((entry + count) < total_time):
# week... | true |
14986bd2e1fa7d90c00af7bda3d7d59be971c9c8 | clrabb/sorts | /sort1.py | UTF-8 | 208 | 2.75 | 3 | [] | no_license | #!/usr/bin/python
import random
words = []
with open( "/usr/share/dict/words", "r" ) as f:
for l in f:
words.append( l.strip() )
random.shuffle( words )
for word in words:
print word
| true |
8e4f671b31b27bd2a67c57b9a5e3c8e03ca7979e | ravi4all/PythonJuneMorningReg_19 | /SetsExamples/MovieSimilarity.py | UTF-8 | 1,251 | 3.203125 | 3 | [] | no_license | dataset = {
"action" : ['superman','batman','antman','thor','hulk','baahubali',
'avengers','kgf'],
"comedy" : ["dhamaal",'golmaal'],
"thriller" : ["lucy","the nun","the ring"],
"horror" : ["the nun","the ring"],
"biopic" : ["ms dhoni"]
}
user_1 = {'superman','batman','a... | true |
e6bcc3abb761ecb8c13945711318a62aa1e50e0f | flerdacodeu/CodeU-2018-Group2 | /SilverSolver/assignment1/Q1.py | UTF-8 | 1,114 | 3.375 | 3 | [] | no_license | from collections import Counter
import re
def are_words_anagram(s1, s2, case_sensitive=False, return_dicts=False):
if not case_sensitive:
s1 = s1.lower()
s2 = s2.lower()
s1 = re.sub(r'[\W\s]', '', s1)
s2 = re.sub(r'[\W\s]', '', s2)
char_counter_1 = Counter(s1)
char_counter_2 = Coun... | true |
98afc9bac9fdea358d4f8af702a12a52be21f0cc | johndamen/datatools | /transformation_example.py | UTF-8 | 2,739 | 2.9375 | 3 | [
"MIT"
] | permissive | from datatools import transformations
from matplotlib import pyplot as plt
import numpy as np
x = np.arange(0, 2*np.pi, .01)
y = np.arange(0, 2*np.pi, .01)
X, Y = np.meshgrid(x, y)
noise = 2 * np.random.random(X.shape) - 1
big_wave = np.sin(2 * X)
small_wave = .3*np.sin(10*Y)
Z = big_wave + small_wave + noise
Z /= Z.m... | true |
5e48177b21af9787db538f074db9762ea4d2dadb | kvarforl/CS434_MachineLearning | /implementation1/q1_4.py | UTF-8 | 3,012 | 3.21875 | 3 | [] | no_license | #!/usr/bin/env python3
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
import argparse
def get_args():
parser = argparse.ArgumentParser()
parser.add_argument("training", help="a .csv file of training data")
parser.add_argument("test_data", help="a .csv file of test data")
return pa... | true |
1bd2e8f8c2a8287fc69ebb182acb2347c115b2c6 | CiscoTestAutomation/genielibs | /pkgs/sdk-pkg/src/genie/libs/sdk/apis/iosxe/cdp/get.py | UTF-8 | 1,026 | 2.84375 | 3 | [
"Apache-2.0"
] | permissive | """Common get info functions for cdp"""
# Python
import logging
# Genie
from genie.metaparser.util.exceptions import SchemaEmptyParserError
log = logging.getLogger(__name__)
def get_cdp_neighbors_info(device):
""" Get details about cdp neighbors from device
Args:
device ('obj'):... | true |
6f0229ea1f2dff3ee5542f573643c81d4153c8d6 | benhunter/py-stuff | /misc/filereading.py | UTF-8 | 313 | 3.140625 | 3 | [
"MIT"
] | permissive | file_name = "text.txt"
with open(file_name, 'w') as f:
for i in range(10):
f.write(str(i) + '\n')
with open(file_name) as f:
# text = f.readlines().rstrip()
# text = f.readlines()
# print(type(text))
# print()
# print(text)
# print()
print([line.rstrip() for line in f])
| true |
878f3178465ad098dd5e7226c5fa4649b53141ba | zyp521/python | /test_code/随机产生20列表,分前后排序.py | UTF-8 | 128 | 2.953125 | 3 | [] | no_license | import random
ls = [random.randint(1, 30) for i in range(20)]
ls = sorted(ls[:10], ) + sorted(ls[10:], reverse=True)
print(ls)
| true |
932ccc31e0ac1b8c4e4fd5b02ae617b540df8ecd | lakshadvani/BuildingAnalytics | /timeseriesanalysis.py | UTF-8 | 6,143 | 2.90625 | 3 | [] | no_license | from pandas import read_csv
from pandas import datetime
from matplotlib import pyplot
# load dataset
from math import sqrt
from pandas import read_csv
from pandas import datetime
from pandas import DataFrame
from pandas import concat
from sklearn.metrics import mean_squared_error
'''
def timeseries_to_supervised(data,... | true |
5a9f929282f5f92058e9253810ac0c8fc7f3f00a | akash-07/issue-prioritiser-evaluation | /final/predict_close_date.py | UTF-8 | 3,762 | 2.609375 | 3 | [] | no_license | import pandas as pd
import re
import copy
import numpy as np
import matplotlib.pyplot as plt
from dateutil.parser import parse
import pickle
import numpy as np
f = open('data/tf_closed_issues.pickle', 'rb')
issues = pickle.load(f)
f.close()
def transformDate(t, t0):
t = parse(t)
t0 = parse(t0)
return (t -... | true |
e9bc0924f2a80bdd5baf28c04f1c7c68e78e2849 | Vivekyadv/LeetCode | /Linked List/Easy/5. add two numbers.py | UTF-8 | 1,233 | 3.859375 | 4 | [] | no_license | # add two numbers represented as linked list
class ListNode:
def __init__(self, x):
self.val = x
self.next = None
def length(head):
leng = 0
while head:
leng += 1
head = head.next
return leng
def printf(node):
while node:
print(node.val, end=' ')
n... | true |
e51787332a53ed99b52e7d4e632f67340a35c7e4 | louisdelloye/m2-lumi-2048 | /main_gym.py | UTF-8 | 2,014 | 2.625 | 3 | [] | no_license | import sys
import numpy as np
import math
import random
import gym
from openai import gym_game
from PyQt5.QtWidgets import QApplication
from GUI import MainWindow
def simulate(g):
global epsilon, epsilon_decay
for episode in range(MAX_EPISODES):
# Init environment
state = env.reset()
total_reward = 0
# A... | true |
cfc6f5939aef8a5e92ba23436a10baf18454e908 | Maybe5115/Cursos_Platzi | /Programacion dinamica y estocastica/estadistica.py | UTF-8 | 544 | 3.65625 | 4 | [] | no_license | import random
import math
def media(X):
return sum(X)/len(X)
def varianza(X):
mu = media(X)
acumulador = 0
for x in X:
acumulador += (x-mu)**2
return acumulador/len(X)
def desviacion_estandar(X):
return math.sqrt(varianza(X))
if __name__ == "__main__":
X = [random.randin... | true |
b9cc8db378196d1528551d9494576db0998ea8f2 | VenmoTools/test-tool-box | /httpclient/funcions.py | UTF-8 | 983 | 3.046875 | 3 | [
"Apache-2.0"
] | permissive | import unittest
def should_none(test: unittest.TestCase, except_value, real_value):
return test.assertIsNone(real_value)
def should_not_none(test: unittest.TestCase, except_value, real_value):
return test.assertIsNotNone(real_value)
def should_equal(test: unittest.TestCase, except_value, real_value):
... | true |
e24aa97aa0b58089d6eb8fdc6405d2e5c3871dce | TonyChengTW/Testing | /list/gx1.py | UTF-8 | 395 | 3.4375 | 3 | [] | no_license | classmates = ['Michael', 'Bob', 'Tracy']
classmates.insert(1,'Jack')
print classmates
classmates = ('Michael', 'Bob', 'Tracy')
classmates = ('Jack',)
print type(classmates)
print classmates
s = set([1, 2, 3])
s.add(4)
print s
s.remove(2)
print s
l = range(100)
print l
print l[1:10]
print l[:10]
print l[3:]
print l... | true |
f5c4865eb14b513c99521b359506746ebfc8db9c | h2oai/h2o-3 | /h2o-py/tests/testdir_algos/glrm/pyunit_PUBDEV_4246_pro_var.py | UTF-8 | 2,450 | 2.671875 | 3 | [
"Apache-2.0"
] | permissive | import sys
sys.path.insert(1,"../../../")
import h2o
from tests import pyunit_utils
from h2o.estimators.glrm import H2OGeneralizedLowRankEstimator
from h2o.estimators.pca import H2OPrincipalComponentAnalysisEstimator as H2OPCA
# This unit test makes sure that GLRM will not return proportional of variance with values e... | true |
f6265e9aefaa5e6fd4f81002731c7504847c6c31 | pierriccardo/RecSys-challenge | /others/SLIMEelasticNetRecommender.py | UTF-8 | 4,298 | 2.625 | 3 | [] | no_license | from base.similarity_matrix_recommender import ItemSimilarityMatrixRecommender
from sklearn.linear_model import ElasticNet
from sklearn.exceptions import ConvergenceWarning
import scipy.sparse as sps
import numpy as np
from tqdm import tqdm
import warnings
class SLIMElasticNetRecommender(ItemSimilarityMatrixRecomme... | true |
d1461d75e9cd9105922ebc46ff43c5d73d6f3e38 | fvckgrimm/Selfbot | /cogs/emote.py | UTF-8 | 1,526 | 2.609375 | 3 | [] | no_license | import discord
from discord.ext import commands
import asyncio
import requests
class emote(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.command(aliases=['e'], brief='enlargen and get link for emotes')
async def emoji(self, ctx, emoji: discord.Emoji):
url = emoji.url
name = emoji... | true |
169c6ec4ce7263083f29adf46a176d9fd368f060 | JarethManrique/edd_1310_2021 | /Tarea_7/Prueba_Tarea_7.py | UTF-8 | 1,495 | 4.34375 | 4 | [] | no_license | from Listas import DoubleLinkedList
l=DoubleLinkedList()
print(f"\n¿La lista L está vacía?: { l.is_empty() } ")
print(f"El número de elementos de la lista L son: {l.get_size()}\n")
print("Agregamos: 10,15,10,20,30,10,40,50\n")
l.append(10)
l.append(15)
l.append(10)
l.append(20)
l.append(30)
l.append(10)
l.append(40)
... | true |
1c5df4f074466851760381bfe5b8321fdd1a701f | calmcat/Algorithm | /find_max_crossing_subarray_liner.py | UTF-8 | 266 | 3.09375 | 3 | [] | no_license | def find_max_subarray(A):
max_ending_here = max_so_far = 0
for x in A:
max_ending_here = max(0, max_ending_here + x)
max_so_far = max(max_so_far, max_ending_here)
return max_so_far
A = [0, -1, 3, -4, 6, -1, 4]
print find_max_subarray(A)
| true |
b8d8b3c31b390e8ba524fd4973b60ee72aa711ef | tjdev7/aerialbot | /aerialbot.py | UTF-8 | 39,230 | 2.765625 | 3 | [
"MIT"
] | permissive | import io
import math
import os
import re
import random
import sys
import time
from datetime import datetime
import argparse
import logging
import logging.config
import traceback
import concurrent.futures
import threading
import requests
from configobj import ConfigObj
import shapefile
import shapely.geometry
fr... | true |
4edc8bc879b0f58f279221748e28a9e7568f9d27 | niteshsarode/LeetCodeProblems | /Container.py | UTF-8 | 1,052 | 3.40625 | 3 | [] | no_license | #Given n non-negative integers a1, a2, ..., an , where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpoints of line i is at (i, #ai) and (i, 0). Find two lines, which together with x-axis forms a container, such that the container contains the most water.
#Note: You may... | true |