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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
8bb37bb464d97c50faca4fb42dc99deb5756e409 | Python | dlin94/leetcode | /array/496_next_greater_element.py | UTF-8 | 863 | 3.671875 | 4 | [] | no_license | def next_greater_element(nums1, nums2):
max_num = 0
return_list = []
for i in range(0, len(nums1)):
next_greater = -1
for j in range(0, len(nums2)):
if nums2[j] == nums1[i]:
for k in range (j+1, len(nums2)):
if nums2[k] > nums2[j]:
... | true |
98ad43be156da186afbc5c39d3557c4d1243e8b8 | Python | Arvintian/pretty-log-py | /pretty_logging/escape.py | UTF-8 | 969 | 3.15625 | 3 | [] | no_license | # -*- coding:utf-8 -*-
import sys
PY3 = sys.version_info >= (3,)
if PY3:
unicode_type = str
basestring_type = str
else:
# The names unicode and basestring don't exist in py3 so silence flake8.
unicode_type = unicode # noqa
basestring_type = basestring # noqa
_TO_UNICODE_TYPES = (unicode_type, ... | true |
c7a6262ea89c52031e393343e8fa9224c18dd1fc | Python | lekha-badarinath/CodingForInterview | /Concepts/linkedLists.py | UTF-8 | 1,349 | 4.09375 | 4 | [] | no_license | class Element(): #Creating a container for linked list
def __init__(self,value):
self.value = value
self.next = None
class LinkedList():
def __init__(self,head = None): #Creating head of the linked list
self.head = head
def atBeginning(self,b... | true |
85e1cdb1ebd34b383eb560e002b4258488bdcc9e | Python | BaoAdrian/interview-prep | /Algorithms/merge_sort.py | UTF-8 | 1,885 | 3.984375 | 4 | [] | no_license | class Node:
def __init__(self, value):
self.value = value
self.next = None
def __str__(self):
return_str = ""
curr = self
while curr:
return_str += "[ {} ] > ".format(curr.value)
curr = curr.next
return return_str
def merge_sort_linked_li... | true |
bf8cc6c5f6f83a48677231bc47847156e6e46bee | Python | dxt9140/CV_Frogger | /src/BlueMSX.py | UTF-8 | 2,146 | 2.53125 | 3 | [] | no_license | import threading
import os
from pynput.keyboard import Controller, Key
import shutil
import subprocess
from definitions import PROJECT_DIR
import time
class BlueMSX(threading.Thread):
def __init__(self, kb):
threading.Thread.__init__(self)
self._stop_event = threading.Event()
self.should_... | true |
0c2a77ad7445960599d610087de6e2f5bed6f2f0 | Python | dsacchet/domot-api | /src/handlers/vmc/unelvent/mode/put | UTF-8 | 1,061 | 2.8125 | 3 | [
"BSD-3-Clause"
] | permissive | #!/usr/bin/python
import minimalmodbus
import sys
value=['low','boost','bypass']
instrument = minimalmodbus.Instrument('/dev/ttyVMC1',0)
instrument.serial.baudrate = 19200
instrument.serial.bytesize = 8
instrument.serial.parity = 'E'
instrument.serial.stopbits = 1
def read_value(address):
while True:
try:
... | true |
34752204492c137e3e26f70884ce958ce33ff736 | Python | dibsonthis/Movie-Randomizer | /movie_randomizer.py | UTF-8 | 4,152 | 2.875 | 3 | [
"MIT"
] | permissive | import requests
from bs4 import BeautifulSoup
import json
import random
genres = ['action-and-adventure', 'animation', 'anime', 'biography', 'children', 'comedy', 'crime', 'cult', 'documentary', 'drama', 'family', 'fantasy', 'history', 'horror', 'mystery', 'romance', 'science-fiction', 'thriller', 'all']
def g... | true |
56a733ee86926b08cc3306a37725d587d3128455 | Python | jawang35/project-euler | /python/lib/problem28.py | UTF-8 | 1,000 | 4.0625 | 4 | [
"MIT"
] | permissive | '''
Problem 28 - Number Spiral Diagonals
Starting with the number 1 and moving to the right in a clockwise direction a 5
by 5 spiral is formed as follows:
21 22 23 24 25
20 7 8 9 10
19 6 1 2 11
18 5 4 3 12
17 16 15 14 13
It can be verified that the sum of the numbers on the diagonals is 101.
43 44 45 46 47... | true |
6f1ea24d336ab20139733dbbbefbbac92cdd6224 | Python | quake0day/oj | /tree_S_expression.py | UTF-8 | 2,066 | 3.40625 | 3 | [
"MIT"
] | permissive | class TreeNode(object):
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution(object):
def SExp(self, pair):
links = [[None, None, None] for _ in xrange(26)]
edges = pair.split(";")
for edge in edges:
edge = edge.replace('(','').replace(')','').replace(' ','')
a,b ... | true |
121e1baf276dcf7c15946471e55d7c5a87c292e9 | Python | Centpledge/BUILDING-2 | /asd.py | UTF-8 | 76 | 2.625 | 3 | [] | no_license | a = ['1']
b = ['1']
if a !=[] :
print 'a'
if len(b) ==1 :
print 'b'
| true |
62354d19eba554c96444766fd29eb4011a0e2fdb | Python | kalleaaltonen/csolve | /chess.py | UTF-8 | 8,019 | 2.75 | 3 | [] | no_license | from itertools import chain,product,combinations
import copy
import operator
import string
import datrie
import time
# R Rook
# N knight
# B Bishop
# Q Queen
# K King
PIECES = set("RNBQK")
def prune(iter,bx,by):
return ((x,y) for (x,y) in iter if x >= 0 and y >= 0 and x < bx and y < by)
def threatens(piece, x, y... | true |
a16f6727b5453f125540b1546271fd1137b6c799 | Python | jtsherba/db-factfinder | /factfinder/special.py | UTF-8 | 4,393 | 2.5625 | 3 | [
"MIT"
] | permissive | import math
import numpy as np
import pandas as pd
def pivot(df: pd.DataFrame, base_variables: list) -> pd.DataFrame:
dff = df.loc[:, ["census_geoid", "pff_variable", "e", "m"]].pivot(
index="census_geoid", columns="pff_variable", values=["e", "m"]
)
pivoted = pd.DataFrame()
pivoted["census_g... | true |
0742e552432ce87e37388e14aa4dda441a27df90 | Python | Lee-121/sHIeR | /sHIeR_hogwarts/homework_0731/homework_1.py | UTF-8 | 661 | 4.3125 | 4 | [] | no_license |
# 用类和面向对象的思想,“描述”生活中任意接触到的东西
# 比如动物、小说里面的人物,不做限制,随意发挥),数量为5个
# 定义House类
class House:
window = "明亮的"
door = "安全的"
people = "有人"
ceiling = "天花板"
def people(self):
print("房间里有人吗?")
def high_wind(self):
print("要关窗吗?")
def open_door(self):
print("谁开的门?")
def up... | true |
db602103bce918c27603a7dacc77356b8e2c013d | Python | 0x913/python-practice-projects | /python practice projects/Control Structures/List Functions.py | UTF-8 | 328 | 4 | 4 | [] | no_license | nums = [1, 2, 3]
nums.append(4)
print(nums)
#
nums = [1, 3, 5, 2, 4]
print(len(nums))
#
words = ["Python", "fun"]
index = 1
words.insert(index, "is")
print(words)
#
letters = ['p', 'q', 'r', 's', 'p', 'u']
print(letters.index('r'))
print(letters.index('p'))
print(letters.ind... | true |
acdc661ef48286e117c4624e8f2c92cf26484436 | Python | rogeriomfneto/compgeo_algorithms | /geocomp/closest/divide.py | UTF-8 | 4,977 | 2.828125 | 3 | [] | no_license | #!/usr/bin/env python
"""Algoritmo por divisão e conquista"""
from geocomp.common.segment import Segment
from geocomp.common import control
from geocomp.common import prim
from geocomp.common import guiprim
import math
# COMPATING FUNCTIONS
def compareX(p1, p2):
if (p1.x == p2.x): return p1.y - p2.y
return ... | true |
34abe73092995fe669ca57734e8daa8459b52d7e | Python | mickeyhoang/SchoolAnalysis | /graphs.py | UTF-8 | 4,307 | 2.9375 | 3 | [] | no_license | import matplotlib.pyplot as plt
import numpy as np
import json
schools = ['PaloAltoHighSchool', 'MontaVistaHighSchool', 'Menlo-AthertonHighSchool', 'WoodsideHighSchool', 'ApolloHighSchool', 'NationalAverages']
colors = ['#4286f4', '#4286f4', '#4286f4', '#4286f4', '#4286f4', '#fcb65a']
data = []
for name in schools:
... | true |
db32259c0fcd4a339c67c25f908d7a8e8374db64 | Python | HongyuHe/leetcode-new-round | /dp/70_again.py | UTF-8 | 613 | 3.203125 | 3 | [] | no_license | class Solution:
def climbStairs(self, n: int) -> int:
# * Base case: 0 -> 1
# * 1 -> 1
# * 2 -> 1 + 1 = 2
# * 3 -> 2(2->1) + 1 = 3
# count = [0] * (n+1)
# count[0] = 1
# count[1] = 1
if n <= 2: return n
one_step = 2
two_steps = 1
... | true |
98581dca0e9cb64b13dcb71e03674ba2a2faa1df | Python | gdcfornari/recuperacao02 | /soma.py | UTF-8 | 236 | 3.15625 | 3 | [] | no_license | class Soma:
@staticmethod
def calcula(array):
result = 0
for numero in array:
result = result + numero
return result
bytearray = [5,8,3]
resultado = Soma.calcula(bytearray)
print(resultado)
| true |
e9cc13aadedbbe42af4e98f5bf91d48696f35fac | Python | jehoons/sbie_weinberg | /module/ifa/tutorial/boolean2/projects/immune/localdefs.py | UTF-8 | 2,356 | 3 | 3 | [] | no_license | """
Bordetella Bronchiseptica simulation
- local function definitions that are loaded into the generated code
"""
import time, sys
from random import random, randint, seed
from boolean2.plde.defs import *
seed(100)
#
# There is a stochasticty in the expiration, each number gets
# and expiration between MIN_AGE an... | true |
f292afb55ed9c1d05c40c8453dd819ce5bc24a15 | Python | linlicro/python100 | /day14/t04-server.py | UTF-8 | 1,708 | 3.296875 | 3 | [
"MIT"
] | permissive | #!/usr/bin/python3
"""
实现TCP服务器: 服务器是能够同时接纳和处理多个用户请求的。
设计一个使用多线程技术处理多个用户请求的服务器,该服务器会向连接到服务器的客户端发送一张图片。
version: 0.1
author: icro
"""
from socket import socket
from base64 import b64encode
from json import dumps
from threading import Thread
def main():
# 自定义线程类
class FileTransferHandler(Thread):
... | true |
676f264d116a7b5d32cf32697470f44b6b0277b4 | Python | Shatrugna-Strife/N-Gram-Extractor | /chisquare.py | UTF-8 | 2,541 | 3.015625 | 3 | [] | no_license | # import these modules
import nltk
from collections import Counter
from nltk.tokenize import RegexpTokenizer
import re
from nltk.stem import PorterStemmer
from nltk.tokenize import word_tokenize, sent_tokenize
import pandas as pd
from nltk.corpus import stopwords
from nltk import ngrams
tokenizer = RegexpT... | true |
2b090097336428b76e8e303dbe28ef6af3c79d47 | Python | keiouok/atcoder | /2020/0423/ki.py | UTF-8 | 1,288 | 2.703125 | 3 | [] | no_license | import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii... | true |
e4d6370c00e0765cbcb72e5328b93a67e39d5a9a | Python | azimjohn/leetcode | /algorithms/reverse_words.py | UTF-8 | 207 | 3.359375 | 3 | [] | no_license | # https://leetcode.com/problems/reverse-words-in-a-string/submissions/
class Solution:
def reverseWords(self, s: str) -> str:
words = s.strip().split()
return " ".join(reversed(words))
| true |
2599587e914343909cc6a822102e2ee81e86334e | Python | 1Mr-Styler/ner-spacy | /model/snert.py | UTF-8 | 144 | 2.53125 | 3 | [] | no_license | import spacy
import sys
nlp = spacy.load("en_core_web_sm")
doc = nlp("--text--")
for ent in doc.ents:
print(ent.label_ + "---" +ent.text) | true |
0e088c21a75ac73cd3b1d46b498f75fe2273a822 | Python | vijju3335/MovieTrailer | /fresh_tomatoes.py | UTF-8 | 3,676 | 2.734375 | 3 | [] | no_license | #!/usr/bin/env python
import webbrowser
import os
import re
# Styles and scripting for the start page
start_page_content = '''<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-sc... | true |
b42f792a14bba5dab11cdbebe0c0b559936ffef7 | Python | matanbroner/StocksPlatform | /data/nlp/retrieve_news.py | UTF-8 | 1,663 | 2.828125 | 3 | [] | no_license | import concurrent.futures
import pandas as pd
from nlp.news_sources import GeneralNewsData, RedditData
from multiprocessing import Lock
lock = Lock() # used in pipeline
from nlp.nlp_pipeline import to_pipeline
def retrieve_news_data(src):
"""
Called when subprocess is started.
Retrieves news data usi... | true |
589fb730a229be2b098acef6b243b9e6cc53f02c | Python | williamneto/twitter-capture | /src/stream.py | UTF-8 | 2,592 | 2.578125 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Stream tweets by keywords and send to API.
Requires API key/secret and token key/secret.
More information on query operators can be read at:
https://dev.twitter.com/rest/public/search
"""
from requests import post
from twython import TwythonStreamer
from config im... | true |
f7b6acbb6c09bc56aceb800d57a1864c24d171a5 | Python | christophmeise/OOP | /2_übung/u2.py | UTF-8 | 3,921 | 3.703125 | 4 | [] | no_license | import math
import time
import random
# 1. Aufgabe
def apply_if(f, p, xs):
# assumes f, p is a function and xs is a list
res = []
for x in xs:
if p(x) == True:
res.append(f(x))
else:
res.append(x)
return res
# Hilfsfunktion für 1. Aufgabe
def odd(x):
if x % ... | true |
c7a345cf637c8f7d05aae9a5cdac6d633a5c5add | Python | daniel-reich/ubiquitous-fiesta | /uKPc5faEzQkMwLYPP_14.py | UTF-8 | 154 | 2.765625 | 3 | [] | no_license |
def end_corona(recovers, new_cases, active_cases):
num1 = active_cases / (recovers - new_cases)
return num1 if num1 % 1 == 0 else int(num1) + 1
| true |
cef8d2bae281ee25d29086ddf9b99e07d2a040bd | Python | cristinarivera/python | /untitled-33.py | UTF-8 | 171 | 2.984375 | 3 | [] | no_license | def proc3(n):
if n <=3:
return 1
return proc3(n-1) + proc3(n-2) + proc3(n-3)
print proc3(1)
print proc3(0)
print proc3(-1)
print proc3(4)
print proc3(3) | true |
b5332ffb9de4324983670a8de4e67ef7ea7b3c37 | Python | Aasthaengg/IBMdataset | /Python_codes/p03544/s646363318.py | UTF-8 | 138 | 3.109375 | 3 | [] | no_license | N = int(input())
lucas = (N+2)*[0]
lucas[0] = 2
lucas[1] = 1
for i in range(2,N+2):
lucas[i] = lucas[i-1]+lucas[i-2]
print(lucas[N]) | true |
c921a4781950dc97810d54789ecde22c44a1180c | Python | imNKnavin/google-foobar | /solutions/bomb_baby/test.py | UTF-8 | 805 | 2.75 | 3 | [] | no_license | import unittest
from . import solution
class TestCase(unittest.TestCase):
def test_case_1(self):
self.assertEqual(
solution.answer('2', '1'),
'1'
)
def test_case_2(self):
self.assertEqual(
solution.answer('4', '7'),
'4'
)
def... | true |
98f009378cc2930a1bce0c3b91c5ebfa69d0fb72 | Python | scrapehero/selectorlib-scrapy-example | /scrapeme_shop/spiders/scrapeme_with_formatter.py | UTF-8 | 1,351 | 2.765625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import scrapy
import os
import selectorlib
from selectorlib.formatter import Formatter
class Price(Formatter):
def format(self, text):
price = text.replace('£','').strip()
return float(price)
class ScrapemeSpider(scrapy.Spider):
name = 'scrapeme_with_formatter'
all... | true |
a0f63d03956e1f91394cf847db16650ad1a0c5fb | Python | pombreda/comp304 | /Assignment4/atom3/Kernel/ATOM3Types/ATOM3Enum.py | UTF-8 | 11,802 | 3.09375 | 3 | [] | no_license | # __ File: ATOM3Enum.py __________________________________________________________________________________________________
# Implements : class ATOM3Enum
# Author : Juan de Lara
# Description : A class for the ATOM3 Enum type.
# Modified : 23 Oct 2001
# Changes :
# - 19 DEc 2001 : Modified the set... | true |
68f14ee63e4336a811876927d075ef0307d053d4 | Python | DyassKhalid007/MIT-6.001-Codes | /Week5Part1/Why_OPP.py | UTF-8 | 1,537 | 4.28125 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sun Jun 24 11:18:22 2018
@author: Dyass
"""
"""
Topics:
Why OOP
"""
"""
The power of OOP:
Bundle together objects that share:
common attributes and
procedures that operate on those attributes
Use abstraction to make a disti... | true |
c2ab05f19ded99cf722f628aaf03f427c4f75508 | Python | SuperGuy10/LeetCode_Practice | /Python/443. String Compression.py | UTF-8 | 1,766 | 4.03125 | 4 | [] | no_license | '''
Given an array of characters, compress it in-place.
The length after compression must always be smaller than or equal to the original array.
Every element of the array should be a character (not int) of length 1.
After you are done modifying the input array in-place, return the new length of the array.
Follow up:
... | true |
0122646c11b2363409fa30ef52974b436231396a | Python | huanghyw/akshare | /akshare/futures_derivative/nh_index_volatility.py | UTF-8 | 8,194 | 2.75 | 3 | [
"MIT"
] | permissive | # -*- coding:utf-8 -*-
# /usr/bin/env python
"""
Date: 2020/10/14 16:52
Desc: 南华期货-商品指数历史走势-收益率指数-波动率
http://www.nanhua.net/nhzc/varietytrend.html
1000 点开始, 用收益率累计
目标地址: http://www.nanhua.net/ianalysis/volatility/20/NHCI.json?t=1574932291399
"""
import time
import requests
import pandas as pd
def num_to_str_data(str... | true |
9f48263193b6395b34827e10ff548f7a267a012c | Python | anthony2v/InternetRelayChat | /tests/test_server.py | UTF-8 | 3,280 | 2.515625 | 3 | [] | no_license | import asyncio
import socket
from irc_server.server import Server
import pytest
from unittest import mock
def test_server_send_sends_message_to_all_connections_when_no_exclude():
server = Server()
server._connections = [
mock.MagicMock() for _ in range(5)
]
server.send('PING')
for conn ... | true |
142a6019222b2ae247918305ed9fb41f44e693d6 | Python | Capocaccia/amazon-giveaway-bot | /amazoncontest.py | UTF-8 | 19,238 | 2.640625 | 3 | [] | no_license | from myimports import os
from myimports import sys
from myimports import time
from myimports import datetime
from myimports import random
from myimports import webdriver
from myimports import Keys
from myimports import Select
from myimports import Options
from myimports import get
from myimports import put
f... | true |
08142ed1672f83593ff551cd0b6984eb1ed4e5b7 | Python | moudii04/urban-winner | /game.py | UTF-8 | 3,098 | 3.25 | 3 | [] | no_license | import pygame
from comet_event import CometEvent
from player import Player
from monster import Mummy
from random import randint
from sounds import SoundManager
class Game:
def __init__(self):
self.is_playing = False
self.all_players = pygame.sprite.Group()
self.player = Playe... | true |
d8fa13b97f4e995020ddcbb6dbb8372730046a30 | Python | ArchLaelia/MiniProject | /mini_main.py | UTF-8 | 2,844 | 3.484375 | 3 | [] | no_license | # FindFiles, första funktionen
# FindFileExt, andra funktionen
# FindInfo, tredje funktionen
#
#
# Saker som behöver fixas
# #1: Optimera FindInfo med de två for loopar
# Kanske kan kombinera de två i en enda loop
# #2: Ska se om jag kan kombinera FindFileExt med FindInfo
# Det gäller när man filtrerar extension, då de... | true |
c5c823eaad65ae42e25f64c29510b1c1b519d7e6 | Python | sathulkiran/CS313E-A0 | /A11/Triangle.py | UTF-8 | 4,273 | 3.75 | 4 | [] | no_license |
# File: Triangle.py
# Description: Min path sum for triangle
# Student Name: Athul Srinivasaraghavan
# Student UT EID: as84444
# Partner Name: None
# Partner UT EID: N/a
# Course Name: CS 313E
# Unique Number:
# Date Created: 03/28/2021
# Date Last Modified:
import sys
from timeit import timeit
... | true |
22f525c3d6b4b5a0d28e6d54266fbe2fb6a90aaa | Python | papazianz/Trading | /Bot.py | UTF-8 | 1,057 | 2.90625 | 3 | [] | no_license | """
Created on Aug 5th, 2018
-Nick Papazian
"""
from Keys import *
import datetime
from time import sleep
from binance.client import Client
client = Client(api_key, api_secret)
def sys():
#Check System Status
try:
status = client.get_system_status()
print("\nExchange Stat... | true |
0424de1bec02a139f3dfba650849d909ad834367 | Python | Ciasterix/NEO-Revisited | /model/run.py | UTF-8 | 2,023 | 2.5625 | 3 | [] | no_license | import tensorflow as tf
from model.Attention import Attention
from model.Decoder import Decoder
from model.Encoder import Encoder
if __name__ == "__main__":
BATCH_SIZE = 64
vocab_inp_size = 32
vocab_tar_size = 32
embedding_dim = 256
units = 1024
# Encoder
encoder = Encoder(vocab_inp_size,... | true |
8e525259a1b13647c64a6f944f91649df6b2d9b6 | Python | videan42/cs280_final_project | /annotate_db.py | UTF-8 | 4,542 | 2.640625 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python2
# Standard lib
import os
import json
import argparse
# 3rd party
import numpy as np
from PIL import Image
import matplotlib.pyplot as plt
# Constants
THISDIR = os.path.dirname(os.path.realpath(__file__))
# Class
class ImageTagger(object):
def __init__(self, imgdir):
self.imgd... | true |
747de288e536179e0b844baf4518337849e461d8 | Python | ramyasutraye/Guvi_Python | /set4/31.py | UTF-8 | 79 | 3.15625 | 3 | [] | no_license | a=input("Enter the String:").split(' ')
print(len("".join(str(x) for x in a)))
| true |
a49b2906de30bf70e8cb9bfff79b882ea1ae90be | Python | Kal103/Algorithm | /string/count_char_in_string.py | UTF-8 | 158 | 3.03125 | 3 | [] | no_license | s=str(input())
ans=[]
for i in range(len(set(s))):
ans.append(s.count(s[0]))
s=s.replace(s[0],"")
print(ans)
"""
input:
aaabbc
output:
3 2 1
"""
| true |
d491b7668c25d6276ef5d0e24c71dd97b5d8f9fa | Python | oplatek/tdb | /tdb/debug_session.py | UTF-8 | 6,803 | 2.625 | 3 | [
"Apache-2.0"
] | permissive |
from .ht_op import HTOp
from . import op_store
import tensorflow as tf
# debug status codes
INITIALIZED = 'INITIALIZED'
RUNNING = 'RUNNING'
PAUSED = 'PAUSED'
FINISHED = 'FINISHED'
class DebugSession(object):
def __init__(self, session=None):
super(DebugSession, self).__init__()
if session is N... | true |
472ed9779c54a9dbd2d6c75eab3d9b01ca2da715 | Python | bdcolosi/pythonexercises | /tip_calculator.py | UTF-8 | 391 | 3.734375 | 4 | [] | no_license | bill_amount = int(input("How much was the bill? "))
service_level = input("Level of service? ")
def service(service_level):
if service_level == "good":
print((.2 * bill_amount) + bill_amount)
if service_level == "fair":
print((.15 * bill_amount)+ bill_amount)
if service_level == "bad":... | true |
61185649ce31951fba9feb746a5659db53b5f3fa | Python | akshala/Data-Structures-and-Algorithms | /graph/journey_2.py | UTF-8 | 1,068 | 3.21875 | 3 | [] | no_license | class Graph:
def __init__(self, n):
self.vertices=n
self.graph={}
self.incomingGraph={}
self.ans = 0
def addEdge(self, u, v):
if u in self.graph.keys() and v not in self.graph.values():
self.graph[u].append(v)
else:
self.graph[u]=[v]
def remainingEdge(self):
for vertex in range(0, self.vertices... | true |
c8d594008a7f01e9e8ab7b47aef469a135d90e15 | Python | samsonleegh/poem_generator | /scripts/RNN_utils.py | UTF-8 | 8,128 | 3.34375 | 3 | [] | no_license | from __future__ import print_function
import numpy as np
from random import random
# method for generating text, using model
def generate_text(model, length, vocab_size, ix_to_char, use_subwords, temp = 0.8, end_symbol = "$"):
# starting with random character
ix = np.random.randint(vocab_size)
y_char = [ix... | true |
1cc6077fe53733223dd281f4ab8c1f28a44f3f39 | Python | rohitkeshav/stack_question_match | /classification.py | UTF-8 | 13,322 | 2.9375 | 3 | [] | no_license | # use MultinomialNB algorithm
import pandas as pd
import re
import numpy as np
from nltk.corpus import stopwords
from nltk.stem import SnowballStemmer
from sklearn.feature_extraction.text import TfidfVectorizer, CountVectorizer
from sklearn.svm import LinearSVC
from sklearn.pipeline import Pipeline
from sklear... | true |
52e52e06a68e91824ad7929eded8f09868e2d2d7 | Python | alan010/MyBrain | /cell_maker.py | UTF-8 | 1,337 | 2.875 | 3 | [] | no_license | #! /usr/bin/python
import sys, os, random
TEMP='/root/MyBrain/cell_temp.py'
BASIC_DIR='/MyBrain'
def open_temp(cell_temp):
return open(cell_temp).read().splitlines()
def gen_axon():
while True:
path = '/'.join([BASIC_DIR, str(random.randint(0,255)), str(random.randint(0,255)), str(random.randint(... | true |
b6a2ee13fa7304ba1f0afeeed1dcf7efb215a43c | Python | jell0213/2048game | /2048game.py | UTF-8 | 14,501 | 2.71875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Fri Mar 26 23:08:07 2021
@author: li
"""
from Tkinter import *
import time
print '程式執行中...'
window = Tk()
window.title('2048game')
window.geometry('330x330')
import random
aicontrol = 1
gameover = 0
i=0
l=[]
rec = []
recnum = 0
while i < 16 : ... | true |
bddb3f457b9b65773f04fe05366bd247ad0ee003 | Python | jiangshanmeta/lintcode | /src/0103/solution.py | UTF-8 | 1,051 | 3.65625 | 4 | [
"MIT"
] | permissive | """
Definition of ListNode
class ListNode(object):
def __init__(self, val, next=None):
self.val = val
self.next = next
"""
class Solution:
"""
@param head: The first node of linked list.
@return: The node where the cycle begins. if there is no cycle, return null
"""
def detectCy... | true |
03d742ce4c7e45ecbbdc3e434ff42c96d3465d01 | Python | Kawser-nerd/CLCDSA | /Source Codes/AtCoder/abc035/B/4831046.py | UTF-8 | 293 | 3.25 | 3 | [] | no_license | hoge=input()
t=input()
kyori_1=abs(hoge.count("U")-hoge.count("D"))
kyori_2=abs(hoge.count("R")-hoge.count("L"))
hatena=hoge.count("?")
if(t=="1"):
print(kyori_1+kyori_2+hatena)
elif(t=="2" and hatena>kyori_1+kyori_2):
print(len(hoge)%2)
else:
print(kyori_1+kyori_2-hatena) | true |
9a6a3f7e5fb799433b40b8d5c4f62109d491d552 | Python | tonysosos/leetcode | /leetcode-py/two-sum.py | UTF-8 | 272 | 2.9375 | 3 | [] | no_license | class Solution:
# @return a tuple, (index1, index2)
def twoSum(self, num, target):
map = {}
for x in range(len(num)):
if num[x] in map:
return map[num[x]]+1, x+1
else:
map[target - num[x]] = x | true |
04f160c29901f8ed8f6df7edb1f6bf5032c171d4 | Python | NgocVTran/daily-coding | /200. Number of Island/main.py | UTF-8 | 2,481 | 4.28125 | 4 | [] | no_license | # Number of Island
from test_data import input_matrices
class Island():
def __init__(self, input_matrix):
self.input_matrix = input_matrix
self.row = len(input_matrix) # number of matrix row
self.col = len(input_matrix[0]) # number of matrix column
self.nr_of_island = 0
... | true |
22e611dbe8d30be2a99b99ceca818c1d3f013db6 | Python | iam3mer/mTICP172022 | /Ciclo I/Unidad 1 y 2/primos2.py | UTF-8 | 273 | 3.734375 | 4 | [] | no_license | def esPrimo(num: int, n: int):
if n >= num:
return print('Es primo.')
elif num % n != 0:
return esPrimo(num, n+1) # Recursividad
else:
return print(f"{num} No es primo. {n} es divisor")
esPrimo(555555412154746465465456874946, 2) | true |
197e57fffaa1c3c23f85daac6406e346ee5094f9 | Python | n5g/Py | /letskodeit/126windowSize.py | UTF-8 | 521 | 2.96875 | 3 | [] | no_license | from selenium import webdriver
import time
class Screenshots():
def test(self):
driver = webdriver.Chrome()
driver.maximize_window()
#driver.get("https://learn.letskodeit.com/p/practice")
driver.implicitly_wait(3)
height = driver.execute_script("return window.innerHeight;")... | true |
a2d3bfbbfc460a5d89911265d7545bd4682b83b0 | Python | rresender/python-samples | /emailformart.py | UTF-8 | 174 | 3.109375 | 3 | [
"MIT"
] | permissive | import re
n = int(input())
regex = '<[a-z][a-z0-9_.-]+@[a-z]+\.[a-z]{1,3}>'
for x in range(n):
in_put = input()
if re.search(regex, in_put):
print(in_put)
| true |
2b0293a0bd0452e9e94a7c6aea0d13a803cc9dbd | Python | Demesaikiran/MyCaptainAI | /Fibonacci.py | UTF-8 | 480 | 4.03125 | 4 | [] | no_license | def fibonacci(r, a, b):
if r == 0:
return
else:
print("{0} {1}".format(a, b), end = ' ')
r -= 1
fibonacci(r, a+b, a+ 2*b)
return
if __name__ == "__main__":
num = int(input("Enter the number of fibonacci series you want: "))
if num =... | true |
8a31ccc0f2d704fc3a93320c196073df8027dd64 | Python | tjian123/OnosSystemTest | /TestON/tests/FUNC/FUNCgroup/dependencies/group-bucket.py | UTF-8 | 1,090 | 2.65625 | 3 | [] | no_license | def addBucket( main , egressPort = "" ):
"""
Description:
Create a single bucket which can be added to a Group.
Optional:
* egressPort: port of egress device
Returns:
* Returns a Bucket
* Returns None in case of error
Note:
T... | true |
84c62fc83085eb221f64c45ad111d04bf6e78e05 | Python | Patel-Jenu-1991/SQLite3_basics | /hw_cars.py | UTF-8 | 587 | 3.34375 | 3 | [] | no_license | #!/usr/bin/env python3
# Create a new database called cars
# that has a table inventory
# I'm gonna use a functional approach this time
import sqlite3
conn = sqlite3.connect("cars.db")
cursor = conn.cursor()
def main(): create_inventory()
def create_inventory():
''' This function creates a table in
t... | true |
cc891a1e43208c40267c169a68b213f9ee17b857 | Python | Melwyna/Algoritmos-Taller | /77.py | UTF-8 | 352 | 3.171875 | 3 | [] | no_license | usua="g0812"
cotr="081215"
for x in range(0,3):
usuario=str(input("Ingrese su usuario:"))
contraseña=str(input("Ingrese su contraseña:"))
if usuario==usua and contraseña==cotr:
print("SU USUARIO Y CONTRASEÑA SON CORRECTOS")
else:
print("SU USUARIO Y CONTRASEÑA SON INCORRECTOS")
print("YA LLEVA 3 INTENTOS, VUELV... | true |
00b5b1fea6118b56eca14237f21325a24cd1101a | Python | Athenian-ComputerScience-Fall2020/functions-practice-yesak1 | /return_practice.py | UTF-8 | 418 | 4.125 | 4 | [
"Apache-2.0"
] | permissive | # Add comments to explain what the output from this program will be and how you know.
def math1():
num1 = 50
num2 = 5
return num1 + num2
def math2():
num1 = 50
num2 = 5
return num1 - num2
def math3():
num1 = 50
num2 = 5
return num1 * num2
output_num = math2()
print(output_num)
'''
Add pr... | true |
4b93f9e804ffca8fa905acf5342dbdd4b75802bc | Python | wistbean/learn_python3_spider | /stackoverflow/venv/lib/python3.6/site-packages/pip-19.0.3-py3.6.egg/pip/_vendor/progress/helpers.py | UTF-8 | 2,931 | 2.53125 | 3 | [
"MIT"
] | permissive | # Copyright (c) 2012 Giorgos Verigakis <verigak@gmail.com>
#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE A... | true |
c27e3b46b22a7db182a3062ad934a052c9743de6 | Python | taboomz/TaxxLenguaje | /Taxx.py | UTF-8 | 521 | 2.546875 | 3 | [] | no_license | import taxxLexico
import codecs
import ply.lex as lex
class Taxx(object):
"""docstring for Taxx"""
def __init__(self):
super(Taxx, self).__init__()
def compilar(self,archivo):
fp=codecs.open(archivo,'r')
texto=fp.read()
analizador=lex.lex()
i=0
analizador.input(texto)
print('['+'/'*i... | true |
4bfaa30cf9509526bf58b0240fa26d86bbf399ec | Python | lucaseduardo101/MetodosII | /Integrais Duplas/leitura.py | UTF-8 | 927 | 3.5 | 4 | [] | no_license | # -*- coding: utf-8 -*-
def ler(arq):
a = open(arq,"r") #Abre um arquivo chamado dados.txt
m = a.readline().split() #Le a primeira linha do arquivo, salva o valor dela na variavel m e a ponta para a segunda linha do arquivo
for i in range (0,len(m)):
m[i] = int(m[i])
l = []#Declara uma lista vazia que... | true |
d55eadb490c217a412ee41bd7c0b6711552553a2 | Python | giuggy/Thesis | /Project/controllers/venv/lib/python3.6/site-packages/pypacker/statemachine.py | UTF-8 | 3,823 | 2.953125 | 3 | [] | no_license | """
Logic to build state machines. Borrowed from Scapy's Automata concept.
"""
import threading
import collections
import logging
logger = logging.getLogger("pypacker")
STATE_TYPE_BEGIN = 0
STATE_TYPE_INTERM = 1 # default
STATE_TYPE_END = 2
class TimedCallback(threading.Thread):
def __init__(self):
self._obj =... | true |
bf42205bccf7fce2d9b99351860f3610fe8d02c8 | Python | juliusdeane/beginningfrida | /simple/3/create_struct_in_memory64.py | UTF-8 | 1,224 | 2.53125 | 3 | [
"MIT"
] | permissive | import frida
session = frida.attach("simple3")
# The invented struct we want to build, but in a 64bit architecture:
#
# Now we are on 64bits so:
# short - 2 bytes
# long - 8 bytes
#
# typedef struct my_INVENTED_STRUCT {
# USHORT counter;
# ULONG starCount;
# ULONG blackholeCount;
# } INVENT... | true |
eb2850761b8420c8019072a981dd4d4b772a9a93 | Python | viktorpi/algorithms | /algorithms/max_slice/max_profit.py | UTF-8 | 341 | 2.71875 | 3 | [
"Apache-2.0"
] | permissive | def solution(A):
# kadane's approach for max slice problem
a_normalized = [0] * len(A)
for i in range(1, len(A)):
a_normalized[i] = A[i] - A[i - 1]
max_ending = max_slice = 0
for a in a_normalized:
max_ending = max(a, max_ending + a)
max_slice = max(max_slice, max_ending)
... | true |
3f7f6d19d6ae6d99f12e4dc5495dd709af893dce | Python | george-galli/python-usp | /imprimirfatorial.py | UTF-8 | 174 | 3.875 | 4 | [] | no_license | n = int(input("Digite um número natural: "))
n_fat = 1
i = 1
while i <= n:
n_fat *= i
i += 1
print(n_fat)
| true |
95e4a78cd606440cc8b34f0651ab8898306a05be | Python | munsangu/20190615python | /START_PYTHON/6日/13.バンボクムンfor/05.問題.py | UTF-8 | 170 | 3.65625 | 4 | [] | no_license | print("\n === 문제 1번 ===")
num = int(input("숫자 입력:"))
for i in range(num,0,-1):
print(i,end=" ")
# for i in range(1,num+1)[::-1]:
# print(i,end=" ")
| true |
f998ebd926f014ad8ddb3feaa80198390098503c | Python | GuillaumeLagrange/advent-of-code | /2018/2.py | UTF-8 | 839 | 3.375 | 3 | [] | no_license | #!/bin/python3
data = [x.strip() for x in open("input/2.txt", "r").readlines()]
def main():
two = 0
three = 0
for line in data:
letters = dict.fromkeys(line, 0)
for letter in line:
letters[letter] += 1
if 2 in letters.values():
two += 1
if 3 in lett... | true |
481610301f018ee6908c3200b6645530ac6edc4c | Python | onesMas46/BCS-2021 | /src/chapter8/exercise5.py | UTF-8 | 331 | 3.234375 | 3 | [
"MIT"
] | permissive | fname = "mbox_short.txt"
file = open(fname)
index = 0
count = 0
for line in file:
line = line.rstrip()
if not line.startswith('From'):
continue
count += 1
index = line.find('From') + 1
word = line.split()
print(word[index])
print("There were",count,"lines in the file with From as the f... | true |
ca16e54fdca65f98ce674b6a1cda60d82f2e1cfa | Python | mipt-m06-803/Slava-Inderiakin | /test6/ex2.1.py | UTF-8 | 61 | 2.703125 | 3 | [] | no_license | for a, b in zip(A, B):
print(' '.join([str(a), str(b)]))
| true |
1551f3ff91e1424b0d1eba1c185d754e65e8d881 | Python | yamachu/codecheck-asahi-coef | /app/main.py | UTF-8 | 3,646 | 2.6875 | 3 | [] | no_license | #!/usr/bin/env python3
import json
import collections
import datetime
import asyncio
import aiohttp
from .AsahiNewsArchives.api import AsahiNewsAPI
import numpy
# for debug
# from pprint import pprint
def _strdate_to_datetime(strdate):
return datetime.date(*[int(part_ymd) for part_ymd in strdate.split('-')])
de... | true |
95ec9e069ce937deaa3a50816b0a68dd0b3de59b | Python | InoveAlumnos/mongodb_python | /ejemplos_clase.py | UTF-8 | 4,938 | 3.25 | 3 | [] | no_license | #!/usr/bin/env python
'''
MongoDB [Python]
Ejemplos de clase
---------------------------
Autor: Inove Coding School
Version: 1.2
Descripcion:
Programa creado para mostrar ejemplos prácticos de los visto durante la clase
'''
__author__ = "Inove Coding School"
__email__ = "alumnos@inove.com.ar"
__version_... | true |
2b2ff28b02d38a53bd1e75bfe15c22bb1ef7dfe0 | Python | JOravetz/Data_Analysis | /read_csv.py | UTF-8 | 686 | 2.578125 | 3 | [] | no_license | import unicodecsv
def read_csv(filename):
with open(filename, 'rb') as f:
reader = unicodecsv.DictReader(f)
return list(reader)
enrollments = read_csv('enrollments.csv')
daily_engagement = read_csv('daily_engagement.csv')
project_submissions = read_csv('project_submissions.csv')
row_count = sum(1... | true |
50d9deac397624f2c5e7a0a0644dbbc04fccf028 | Python | ivanilsonjunior/2018.2-Redes-PRC | /Avaliação/B1/20180926/menu.py | UTF-8 | 679 | 3.828125 | 4 | [] | no_license | def menu():
print("Programa da Agenda:\n\t1 - Inserir\n\t2 - Apagar\n\t3 - Listar\n\t0 - sair")
return input("Digite uma opção: ")
def inserir():
print ("Aqui voce deve recuperar os dados da agenda e inserir no banco")
def apagar():
print ("Aqui voce deve receber o contato que vc queira apagar e apag... | true |
6c874727afa3c28817af1dbbc14be7e19d400e64 | Python | nathanstuart01/coding_assessment | /app/business_logic/helper_functions.py | UTF-8 | 2,283 | 3.203125 | 3 | [] | no_license | import pandas as pd
import math
def create_df(file_path, columns: list, sep='\t'):
df = pd.read_csv(file_path, usecols=columns, sep=sep)
return df
def merge_dfs(df_1, df_2, left_on='tconst', right_on='tconst'):
merged_df = df_1.merge(df_2, left_on=left_on, right_on=right_on)
return merged_df
def proc... | true |
8cf6e47ee5fca9874e39944417325b5cb13f60cc | Python | TheUninvitedGuest/tmh-challenge | /challenge/src/hh_sim/hh_sim.py | UTF-8 | 1,246 | 3.03125 | 3 | [] | no_license | #!/usr/bin/env python3
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from broker.broker import Publisher
class HHSim:
""" Simple household simulator that generates random uniform numbers between -9 and 0 for a given time range.
The output corresponds to the household consumption ... | true |
2d15b6ca04b01b31c69f0c87ba59797740aff2d2 | Python | wakafengfan/Leetcode | /tree/same_tree.py | UTF-8 | 877 | 3.734375 | 4 | [] | no_license | """
Given two binary trees, write a function to check if they are the same or not.
Two binary trees are considered the same if they are structurally identical and the nodes have the same value.
Example 1:
Input: 1 1
/ \ / \
2 3 2 3
[1,2,3], [1,2,3]
Output: tr... | true |
f2e589acb68f11a500fc097856414baf6e202f59 | Python | lavanya2495/seattleu_projects | /chord_node.py | UTF-8 | 15,761 | 2.6875 | 3 | [] | no_license | """
CPSC 5520, Seattle University
Lab 4: DHT
Author: Sai Lavanya Kanakam
Usage: python chord_node.py 0
"""
import sys
import pickle
import hashlib
import threading
import socket
import time
import ast
from datetime import datetime
TIME_FORMAT = '%H:%M:%S.%f'
NODE_NAME_FORMAT = '{}:{}'
M = 3 # FIXME: Test environment,... | true |
990e9cc37100d3bea07d9f89c2c56c5047d8a350 | Python | yxzhang2/Projects | /AI_ML/CS440_mp1code/mp1-code/search.py | UTF-8 | 10,789 | 3.5 | 4 | [] | no_license | # search.py
# ---------------
# Licensing Information: You are free to use or extend this projects for
# educational purposes provided that (1) you do not distribute or publish
# solutions, (2) you retain this notice, and (3) you provide clear
# attribution to the University of Illinois at Urbana-Champaign
#
# Created... | true |
eef1843039d386b62a9c6f3d91fcb52cf61e69b5 | Python | icevivian/Hello_offer | /567.字符串的排列.py | UTF-8 | 1,096 | 3.015625 | 3 | [] | no_license | #
# @lc app=leetcode.cn id=567 lang=python3
#
# [567] 字符串的排列
#
# @lc code=start
class Solution:
def checkInclusion(self, s1: str, s2: str) -> bool:
left = right = 0
minlen = float('INF')
need = dict()
for i in s1:
if i in need:
need[i] += 1
el... | true |
d3c4d997c65d474f233511a3fafe10d4227a930b | Python | GeoMukkath/python_programs | /All_python_programs/anagram.py | UTF-8 | 210 | 4.125 | 4 | [] | no_license | #Q. Check whether the given string is an anagram or not.
str1 = input("Enter string1 : ");
str2 = input("Enter string2 : ");
if sorted(str1) == sorted(str2):
print("The given strings are anagrams");
| true |
d76738d968cfebc2c5bfe151d7fa035d8a131912 | Python | iotgopigo/gopigo1st_season | /array.py | UTF-8 | 251 | 3.359375 | 3 | [] | no_license |
def array (rect):
del rect[:]
rect.append([1,2])
rect.append([3,4])
rect.append([5,6])
rect.append([7,8])
return True
if __name__ == "__main__":
rect = []
for num in range(2):
array(rect)
print rect
| true |
aafe37d2ff453d5f6a816f6b66929008a72177d0 | Python | CutiePizza/holbertonschool-higher_level_programming | /0x0F-python-object_relational_mapping/14-model_city_fetch_by_state.py | UTF-8 | 744 | 2.59375 | 3 | [] | no_license | #!/usr/bin/python3
"""
Start link class to table in database
"""
import sys
from model_city import Base, City
from model_state import Base, State
from sqlalchemy import (create_engine)
from sqlalchemy.orm import sessionmaker
if __name__ == "__main__":
engine = create_engine('mysql+mysqldb://{}:{}@localhost/{}'.for... | true |
d91bf20756de79ae39e3bbefdbeac1ee15f0bc6b | Python | elonca/LWB-benchmark-generator | /defs.py | UTF-8 | 8,282 | 3.234375 | 3 | [] | no_license | import sys
sys.setrecursionlimit(1000001)
class Formula:
pass
class TRUE_(Formula):
def __init__(self):
pass
def __str__(self):
return "true"
def write(self, file):
file.write("true")
class FALSE_(Formula):
def __init__(self):
pass
def __str__(self):
re... | true |
d2da9d74cfc052af1835c8c549ad4e6ac544a7e3 | Python | Rorodu29/monClasseurNSI | /Robin NSI/mouvements.py | UTF-8 | 647 | 2.796875 | 3 | [] | no_license | #!/usr/bin/env pybricks-micropython
from pybricks.hubs import EV3Brick
from pybricks.ev3devices import Motor
from pybricks.robotics import DriveBase
from pybricks.parameters import Port, Stop, Direction
from time import sleep
ev3 = EV3Brick()
left_motor = Motor(Port.B)
right_motor = Motor(Port.C)
robot = DriveBase(l... | true |
e247a495e2ffbe3fa434b19486ebbf5fdc3de3df | Python | HarshKothari21/Covid-19_System_and_Analysis | /India_StateAnalysis_Notifications.py | UTF-8 | 1,004 | 2.875 | 3 | [] | no_license | from plyer import notification
import requests
from bs4 import BeautifulSoup
import time
def notifyMe(title, message):
notification.notify(
title = title,
message = message,
app_icon = None,
timeout =15
)
def getData(url):
r = requests.get(url)
return r.text
if __name__ == "__main__":
notifyMe("Harsh... | true |
1061443c2482979e7f63a4ddcc7434f7eea3b5b6 | Python | soarhigh03/baekjoon-solutions | /solutions/prob3009/solution_python.py | UTF-8 | 292 | 3.375 | 3 | [] | no_license | """
Baekjoon Online Judge #3009
https://www.acmicpc.net/problem/3009
"""
a = []
b = []
for _ in range(3):
x, y = map(int, input().split())
if x in a:
a.remove(x)
else:
a.append(x)
if y in b:
b.remove(y)
else:
b.append(y)
print(a[0], b[0])
| true |
9da2ace699b2aa242eed15c3a4f5bedb3817b086 | Python | ximet/algoset | /src/datastructures/hashTable/test/HashTableNode_test.py | UTF-8 | 351 | 3.171875 | 3 | [] | no_license | from src.datastructures.hashTable.HashTableNode import HashTableNode
def test_linkedListNodeWithoutLink():
node = HashTableNode(1, 2)
assert node.key == 1
assert node.value == 2
assert node.next == None
def test_stringPresentation():
node = HashTableNode(1, 2)
assert str(node) == 'HashTableN... | true |
1cc44bad904bef774a73a26ed3b69b6fe9bf916b | Python | Nigam-Niti/deep_learning_practice | /pytorch/pytorch_practice_1/02.logistic_regression.py | UTF-8 | 1,863 | 2.703125 | 3 | [] | no_license | import torch
import torch.nn as nn
import torchvision
import torchvision.transforms as transforms
# Hyperparams
inp_size = 28*28
num_classes = 10
num_epochs = 2
batch_size = 64
learning_rate = 0.001
# MNIST dataset
train_dataset = torchvision.datasets.MNIST(
root='~/.pytorch-datasets/',
train=True,
transform = tra... | true |
74f47d75436d5ee6120a89d38445f902a1a35a45 | Python | boringlee24/combinatorial_optimization | /bruteforce.py | UTF-8 | 1,529 | 2.9375 | 3 | [] | no_license | import itertools
import random
from time import time
import pdb
import json
from joblib import Parallel, delayed
import os
def bruteforce(x_list, target):
optimal = 0
start_t = time()
time_lim = 600 # 10 min
for x in powerset(x_list):
if target == 2000 and sum(x) == 1999:
pdb.set_tr... | true |
ad84e502aee8ad2ab67a58ec0665b395ed0d20fb | Python | vishnusak/DojoAssignments | /10-MAY-2016_Assignment/python/alphaorder.py | UTF-8 | 1,136 | 4.59375 | 5 | [] | no_license | # Is Word Alphabetical
# Nikki, a queen of gentle sarcasm, loves the word facetiously. Lance helpfully points out that it is the only known English word that contains all five vowels in alphabetical order, and it even has a 'y' on the end! Nikki takes a break from debugging to turn and give him an acid stare that could... | true |
e91be4977481e7f46e6cedbe4c258047cc681036 | Python | RyanBusby/fishery | /image_prep.py | UTF-8 | 2,574 | 2.921875 | 3 | [] | no_license | import numpy as np
from skimage import exposure
from skimage import filters
from skimage.color.adapt_rgb import adapt_rgb, each_channel
from skimage.transform import resize
from skimage.util import pad
def fix_nv(image):
'''
INPUT: numpy.3darray
OUTPUT: numpy.3darray
if an image has a green or blue/gre... | true |
09fc95c912b43ac99aed5b63f96b436cb33dbf46 | Python | Radmirkus/MelBo | /simplevk.py | UTF-8 | 2,903 | 2.546875 | 3 | [
"MIT"
] | permissive | import logging
import json
import time
from html.parser import HTMLParser
try:
import requests
except ImportError:
print('установите библиотеку requests')
class vk:
app_id = ''
user_id = ''
access_token = ''
v = '5.64'
def authorize(self, app_id, login, password, scope, v):
self... | true |