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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
d842a463d752ea0b51d54038155f765f14790a2b | Python | rtnF14/rdef | /rdef.py | UTF-8 | 713 | 2.59375 | 3 | [] | no_license | import urllib2
import sys
from xml.dom import minidom
#x = raw_input("Input Word : ")
#print 'Looking definition for word "' + x + '"'
x = sys.argv[1]
url = "http://www.dictionaryapi.com/api/v1/references/collegiate/xml/" + x + "?key=473f46b5-fd91-4d80-b0d0-dd19502e1022"
f = urllib2.urlopen(url)
proxy... | true |
e6cb33ad7cb91b1c7d0a763f07e33851c735dd40 | Python | MengSunS/daily-leetcode | /sweeping_line/1229.py | UTF-8 | 522 | 2.609375 | 3 | [] | no_license | class Solution:
def minAvailableDuration(self, A: List[List[int]], B: List[List[int]], k: int) -> List[int]:
C = list(filter(lambda x: x[1] - x[0] >= k, A + B))
C.sort()
if not C: return []
n = len(C)
last_end = C[0][1]
for i in range(1, n):
if C[... | true |
1465c4a18e67922f982ef108d60fd99560e1fc63 | Python | Has3ong/OpenCV-SimpleProject | /Project1/src/Section5-1.py | UTF-8 | 919 | 2.625 | 3 | [] | no_license | import numpy as np
import cv2
import os
def null(x):
pass
def ImageProcessing():
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
imgsrc = BASE_DIR + '/document.jpg'
img = cv2.imread(imgsrc, cv2.IMREAD_GRAYSCALE)
r = 600.0 / img.shape[0]
dim = (int(img.shape[1] * r), 600)
img = cv2.r... | true |
5e2617a26fbca460e452d620d5d8fc4e589a9071 | Python | GauthamAjayKannan/guvi | /indexmatch.py | UTF-8 | 167 | 2.65625 | 3 | [] | no_license | # your code goes here
#indexmatch
n=input()
l=list(map(int,input().split(" ")))
t=enumerate(l)
l=[i[0] for i in t if i[0]==i[1]]
if l==[]:
print(-1)
else:
print(*l)
| true |
e853ab608958f1a6cbb6add83f165d9a4bb211f6 | Python | RShveda/pygame-practice | /catch-ball-game/test_game.py | UTF-8 | 1,028 | 3 | 3 | [] | no_license | """
Tests can be run from command line: python -m unittest
"""
import unittest
from models import load_scores, save_scores
# Models tests
class LoadScores(unittest.TestCase):
def test_output(self):
scores = load_scores()
self.assertTrue(len(scores) == 3)
class SaveScores(unittest.TestCase):
... | true |
254e8d2eb025038f3dad437ae31b697fe0342118 | Python | davidcGIThub/pythonControls | /ballOnBeam/bobParam.py | UTF-8 | 1,476 | 2.6875 | 3 | [] | no_license | # Ball on Beam Parameters file
import numpy as np
# Physical parameters of the ball and beam system
m1 = 0.35 # Mass of ball, kg
m2 = 2.0 # Mass of beam, kg
L = .5 # Length of Beam, m
g = 9.8 # gravit constant, m/s^2
#Uncertain parameters
uncertian = False
sign = -1
if(np.random.rand() > .5 ):
sign = 1
m1_ = m1 ... | true |
5895b6be7a08b21dc2225c3f194dedcdf686ceb0 | Python | lacklust/coding-winter-session | /homework/oop/challenge_1.py | UTF-8 | 2,893 | 4.15625 | 4 | [
"MIT"
] | permissive | """
Create a menagerie of animals
NOTE: inheritance layer
Some suggestions:
Animal:
Dog
Tiger
Wolf
ALTERNATE:
Animal
Domesticated:
Dog
Tiger
Wild:
Wolf
Write some test code to experiment with the behavior and functionality of your code!
"""
class Animal:
def __ini... | true |
5fd6947536ff75394c7a80a6208bc37a334ace32 | Python | Nizor22/Python-Automation | /threading/old_way.py | UTF-8 | 681 | 3.90625 | 4 | [] | no_license | import threading
import time
start = time.perf_counter()
# Sleeps the program for {sec} second(s)
def do_something(secs):
print(f'Sleeping {secs} second(s)...')
time.sleep(secs)
print(f'Done Sleeping...')
threads = []
# _ is a throw away variable(throw away=not used in a loop)
# Running the do_something(sleep)... | true |
fc42c2529a1aba2107f497d68a9ac2796769b9f2 | Python | veronikaKochugova/algorithms | /py/task2_1.py | UTF-8 | 399 | 3.421875 | 3 | [] | no_license | # f0 = 0, f1 = 1, f2 = 2, fk = fk–1 + fk–3
# f1, f2, f3 ... fn
n = int(input())
k_array = [int(i) for i in input().split()]
def func(n):
if n <= 2: return n
return func(n - 1) + func(n - 3)
result = list()
result.append(func(k_array[0]))
result.append(func(k_array[1]))
result.append(func(k_array[2]))
for k... | true |
10edfd837e9dd10d234205b8e9d810ab6279c5ac | Python | ngyygm/chia-plot-copy | /chia-plot-copy.py | UTF-8 | 5,640 | 2.703125 | 3 | [] | no_license | import os, shutil, time
import platform
import ctypes
def get_free_space_mb(folder):
"""
获取磁盘剩余空间
:param folder: 磁盘路径 例如 D:\\
:return: 剩余空间 单位 G
"""
if platform.system() == 'Windows':
free_bytes = ctypes.c_ulonglong(0)
ctypes.windll.kernel32.GetDiskFreeSpaceExW(ctype... | true |
4f3d8df3750b169a9fd4a18f515c4a6209507c55 | Python | DaHuO/Supergraph | /codes/CodeJamCrawler/16_0_2/shanna/program.py | UTF-8 | 726 | 3.328125 | 3 | [] | no_license | #!/usr/bin/python
def solve(sequence):
flips = 0
while True:
if all(i for i in sequence):
return flips
elif all(not i for i in sequence):
return flips + 1
if sequence[0]:
flips += 2
else:
flips += 1
for i in range(sequence... | true |
a479219ee3b6685049adcb4a1acd5e4441d2a3c6 | Python | ArnarJonasson/Ejercicios | /Ejercicio1/ejercicio1.py | UTF-8 | 439 | 3.78125 | 4 | [] | no_license |
numbers_list = [46, 56, 112, 28, 17, 496, 23, 555, 8128, 156, 6544, 1235455]
def check_if_perfect(numbers_list):
for n in numbers_list:
sum = 0
for i in range(1, n):
if n%i == 0:
sum +=i
if sum < n: print('Number is defective')
if... | true |
0b782d82f641ffe563afa0bff2170c36d080423d | Python | kaizhiyu/libharmo.github.io | /code/py/py_code/UserEmail/Test.py | UTF-8 | 110 | 2.625 | 3 | [] | no_license | import requests
if __name__ == '__main__':
r = requests.get("https://www.youtube.com")
print(r.text)
| true |
7a78a3ebdf3c6cd82e3a8db517a582c19524e886 | Python | seasign10/TIL | /00_startcamp/03_day/naver_rank.py | UTF-8 | 1,033 | 2.96875 | 3 | [] | no_license | import requests
from bs4 import BeautifulSoup
url = 'https://www.naver.com/'
# 요청 보내서 html 파일 받고
html = requests.get(url).text
# 뷰숲으로 정체
soup = BeautifulSoup(html, 'html.parser')
# select 메서드로 사용해서 list 를 얻어낸다
rank = soup.select('#PM_ID_ct > div.header > div.section_navbar > div.area_hotkeyword.PM_CL_realtimeKey... | true |
13790a34fab653e594a81a5be3bd4f1c45b8e258 | Python | Pingxia/Image-denoise-and-segmentation | /code/em.py | UTF-8 | 5,301 | 2.65625 | 3 | [] | no_license | from io_data import read_data, write_data
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.image as imageplt
import cv2
import sys
import warnings
'''
EM algorithm
input params:
pixels - array of values, H - img height, W - img width, k - number of clusters
output:
segments - segments of original ... | true |
6ff9b18478bf551852b3f9491b10cb77d80d0376 | Python | nakanishi-akitaka/python2018_backup | /1001/gtm-generativetopographicmapping-master/Python/demo_gtmmlr.py | UTF-8 | 3,721 | 2.78125 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
# %reset -f
"""
@author: Hiromasa Kaneko
"""
# Demonstration of GTM-MLR (Generative Topographic Mapping - Multiple Linear Regression)
import matplotlib.figure as figure
import matplotlib.pyplot as plt
import numpy as np
# import pandas as pd
from sklearn.datasets.samples_generator i... | true |
797d3f46a4c117ab629574a8507a2643ef23e98e | Python | srlindemann/amp | /im/ib/metadata/extract/ib_metadata_crawler/pipelines.py | UTF-8 | 2,219 | 2.828125 | 3 | [
"BSD-3-Clause"
] | permissive | import csv
import pathlib
from typing import Union
import ib_metadata_crawler.items as it
import ib_metadata_crawler.spiders.ibroker as ib
import scrapy
import scrapy.exceptions as ex
class ExchangeUniquePipeline:
seen = set()
def process_item(
self, item: scrapy.Item, spider: ib.IbrokerSpider
)... | true |
4d12cad7ed6d8c5cdb68f8d7ab1a6f602c1015cd | Python | seihad/Dataquest-Data-Engineer | /Step 5 - Handling Large Data Sets in Python/1. Numpy for Data Engineers/3_broadcasting_numpy_arrays.py | UTF-8 | 1,847 | 3.875 | 4 | [] | no_license | '''
1.Introduction
'''
# import numpy as np
# x = np.array([
# [7., 9., 2., 2.],
# [3., 2., 6., 4.],
# [5., 6., 5., 7.]
# ])
# ones = np.ones((3,4))
# print(ones)
# x = x - ones
# print(x)
'''
2.Broadcasting With a Single Value
'''
# import numpy as np
# x = np.array([3, 2, 4, 5])
# r = 1 / x
# print(r)
'''
3.Broa... | true |
a2ba5f70a83e501ff23bc2d88d7a8025c40ffeaf | Python | tommyhall/sc2django | /sc2/sc2stats/models.py | UTF-8 | 1,102 | 2.703125 | 3 | [] | no_license | from django.db import models
class Player(models.Model):
""" A model representing a StarCraft 2 player """
player_id = models.CharField(max_length=128, unique=True)
race = models.CharField(max_length=10)
def __unicode__(self):
return self.player_id
class Map(models.Model):
""" A model ... | true |
60ea8ba4c9d1da6b3f8545defcef41ca9fe5f7b1 | Python | indo-seattle/python | /Sandesh/Week3_0324-0330/IntFloatnComplex/2_PrintNumericTypes.py | UTF-8 | 226 | 3.671875 | 4 | [] | no_license | x = 1
y = 1.1
z = 1.2j
print("The value of", x, "is which is a numeric type of ", type(x))
print("The value of", x, "is which is a numeric type of ", type(y))
print("The value of", x, "is which is a numeric type of ", type(z)) | true |
74a4ce51e5d26cd4312478e651538b996f59573b | Python | pragyanetic20/Sales-Analysis | /scripts/clean.py | UTF-8 | 1,045 | 3.546875 | 4 | [] | no_license | from csv import writer
from csv import reader
import re
# open the input_file in read mode and output_file in write mode
with open('file.csv', 'r') as read_obj, \
open('file_1.csv', 'wb') as write_obj:
isFirstRow = False
csv_reader = reader(read_obj) # creating a csv.reader object from the input file ... | true |
790be9f3605adc5904ca12fc49d3eda5dd19a633 | Python | innerr/stars | /core/prop.py | UTF-8 | 873 | 2.640625 | 3 | [
"MIT"
] | permissive | #coding:utf-8
#nature@20100825
import os
class Props:
def __init__(self, file=os.path.join(os.path.dirname(os.path.realpath(__file__)), 'props.data')):
self._file = file
self._data = {}
self._load()
def _load(self):
if not os.path.isfile(self._file):
o... | true |
d8eae6039e854e147c542a90a0eef078962385a5 | Python | parkikbum/Jump-to-python | /백준/python/11720.py | UTF-8 | 104 | 2.921875 | 3 | [] | no_license | n = int(input())
nn = input()
n_sum = list(nn)
sum = 0
for x in n_sum:
sum = sum + int(x)
print(sum) | true |
8f42aa5e151817844bbfb60aa1cea210bd702b08 | Python | uoi00/ai-couplet | /model.py | UTF-8 | 17,753 | 3.125 | 3 | [
"MIT"
] | permissive | """model.py
Build the language model using encoder-decoder with attention
"""
import numpy as np
import tensorflow as tf
import time
import os
class Model():
def __init__(self, char2idx, idx2char, param_dict):
# parse the parameters
vocab_size = param_dict['vocab_size']
embedding_dim = ... | true |
e750ba8bd03393ca196a0da652da8a57f6a1fce3 | Python | TINY-KE/floorplan-MapGeneralization | /src/data_analysis.py | UTF-8 | 2,026 | 2.734375 | 3 | [] | no_license | import os
import networkx as nx
import numpy as np
def get_labels(nxg_):
# Get labels from netx graph
label_dict = nx.get_node_attributes(nxg_, 'label')
return list(label_dict.values())
folder = r'C:\Users\Chrips\Aalborg Universitet\Frederik Myrup Thiesson - data\scaled_graph_reannotated'
data_list = '../... | true |
5bd004ee9f606b1f10ba122e03239b036136b022 | Python | nargiza-web/python-exercise | /1_to_10.py | UTF-8 | 63 | 3.140625 | 3 | [] | no_license | number = 1
while number<11:
print (number)
number += 1
| true |
139188036554bb8cc8a4884f4c7445d335d4c1d6 | Python | aul007/laceTracker | /laceTracker.py | UTF-8 | 3,582 | 2.9375 | 3 | [] | no_license | from bs4 import BeautifulSoup
from probChars import clean
from brandUrls import url_list
import urllib2
import MySQLdb
import re
db = MySQLdb.connect("localhost","root","+r1t0n$k1k1b0uDiN", "lacetest1")
cursor = db.cursor()
#cursor.execute("DROP TABLE IF EXISTS listing")
sql = """CREATE TABLE listing (
id ... | true |
a4987ea57cf433568c28d8953735084c48907306 | Python | Python-study-f/Algorithm-study_1H | /Algorithm_2021/May_2021/210523/8911 - turtle/8911_210509_asura.py | UTF-8 | 924 | 3.25 | 3 | [] | no_license | N = int(input())
ans = []
dic = [(0, 1), (1, 0), (0, -1), (-1, 0)]
for _ in range(N):
x,y = 0, 0
x_max,x_min,y_max,y_min = 0,0,0,0
index = 0
lst = list(str(input()))
SET = set()
SET.add((0, 0))
for c in lst:
if index % 4 == 0:
index = 0
nx,n... | true |
b86830dc7769938a06aab9273c4f47ea3c3d1e58 | Python | Rabbid76/graphics-snippets | /example/python/utility/opengl_mesh.py | UTF-8 | 4,262 | 2.609375 | 3 | [] | no_license |
import ctypes
from OpenGL.GL import *
class SingleMesh:
def __init__(self, mesh_specification):
attr_array = mesh_specification.attributes
index_array = mesh_specification.indices
stride, format = mesh_specification.format
self.__no_indices = len(index_array)
vertex_attri... | true |
f76d72e8c307ad828cc081c3478d50f551a6eda2 | Python | divyanshk/algorithms-and-data-structures | /PeakElement.py | UTF-8 | 828 | 3.375 | 3 | [] | no_license | # Problem: https://leetcode.com/problems/find-peak-element/description/
class Solution(object):
def findPeakElement(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
lo = 0
hi = len(nums)-1
while (lo < hi):
mid = (hi+lo)/2
if (hi... | true |
8a3de760e4da6db67b32d0a4128bc48d538ee48a | Python | hughdbrown/advent-code | /advent-code-20.py | UTF-8 | 1,939 | 3.4375 | 3 | [] | no_license | #!/usr/bin/env python
from __future__ import print_function
from collections import defaultdict
def primes(n):
def mark(low, high, m):
for j in range(low * low, high + 1, low):
m[j] = 0
m = [0, 0] + ([1] * (n + 1))
mark(2, n, m)
for i in range(3, n + 1, 2):
if m[i]:
... | true |
2fe9bbfb4d0b1e8f61eafa19d19ccaeb868aa087 | Python | dlondonmedina/intro-to-programming-python-code | /1-2/main.py | UTF-8 | 494 | 3.703125 | 4 | [] | no_license | # Question 1
name = input()
print()
# Question 2
hours = input()
rate = input()
# do your calculations and prints here.
# don't forget to convert hours and rate to
# integers or floats accordingly.
# Question 3
fahrenheit = input()
# your calculation goes here
# Question 4
income1 = input()
income2 = input()
income3... | true |
bdf431ea0eb00ef878e4549f633275ee3999904d | Python | luoyanhan/Algorithm-and-data-structure | /Leetcode/medium/1642.py | UTF-8 | 840 | 3.0625 | 3 | [] | no_license | class Solution:
def furthestBuilding(self, heights, bricks, ladders):
height_difference = [0] + [max(0, heights[i] - heights[i-1]) for i in range(1, len(heights))]
def check(idx):
tmp = height_difference[:idx+1]
if idx <= ladders:
return True
tmp.s... | true |
f16a646e6cb6cd4eabcf10d612811df82dac5e8e | Python | pipdax/frelation | /frelation.py | UTF-8 | 13,297 | 3.484375 | 3 | [
"BSD-2-Clause"
] | permissive | import pyecharts
from pyecharts import Graph
from collections import Iterable
class frelation():
'''
这个脚本用来展示机器学习中,feature的构造关系,以便于更好的观察feature的构造情况
This script is used to display the relationships between features in machine learning.
This script will help you find the manufacture features more easily... | true |
d0db0d31c9f6e90e787b00aa01ee720f40fc8498 | Python | xiaofu98/cv_projects | /text_detection/location_detection.py | UTF-8 | 698 | 2.53125 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/pyty1on3
# -*- coding: utf-8 -*-
# @File : location_detection.py
import cv2
import pytesseract
pytesseract.pytesseract.tesseract_cmd = 'C:\\Program Files\\Tesseract-OCR\\tesseract.exe'
img = cv2.imread('1.png')
img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB) # OpenCV默认使用BGR
boxes = pytesseract.image_to_box... | true |
0a431947b5614f6d9862d4269e23351defca6f86 | Python | Suyash906/survey-form | /survey.py | UTF-8 | 4,544 | 3.609375 | 4 | [] | no_license | # This is a sample Python script.
# Press Shift+F10 to execute it or replace it with your code.
# Press Double Shift to search everywhere for classes, files, tool windows, actions, and settings.
"""
“Have you ever been diagnosed with diabetes?” is a screening question that would be asked to evaluate for the eligibilit... | true |
5122fb5f46eb68d1a7c21584b406bca7c312eeab | Python | Registea2267/CSC221 | /M1LAB_Register.py | UTF-8 | 501 | 3.140625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
CSS 221
M1LAB
Ashley Register
Jan 23, 2019
"""
def main():
"""Bottles of beer song"""
# 1 see a var
bottles = 99
while bottles >= 0:
print(bottles, "bottles of beer")
bottles = bottles - 1
# 2 see a for loops
"""for beer in range(99, -1,... | true |
f60ffc5f7ca6427b82cf5e6b108eca20e11e2202 | Python | Krishna-124/AI-Assistant | /VIOLET.py | UTF-8 | 7,704 | 2.703125 | 3 | [] | no_license | from selenium import webdriver
from getpass import getpass
import pyttsx3
import datetime
import speech_recognition as sr
import wikipedia
import os
import webbrowser
import random
#c_driver = 'Dir of chromedriver.exe'
engine = pyttsx3.init('sapi5')
voices = engine.getProperty('voices')
# print(voices[1].id)
engine.s... | true |
d6e1c2f3b99d6dba1507a9d969c764936b970eef | Python | JohnWiest/Visuals | /visuals/visuals_1.py | UTF-8 | 2,779 | 2.828125 | 3 | [] | no_license | import pygame
import math
import random
import sys
import os
from object import *
pygame.init()
def main():
os.environ['SDL_VIDEO_CENTERED'] = '1'
screen = pygame.display.set_mode((2560,1440),)
boundary = pygame.image.load("boundary.png")
center_dot = pygame.image.load("center.png")
center = [1280,... | true |
01e2dc67294017597e24433e63e1917e8a0d6b79 | Python | firstshinec/leetcode | /longestPalindrome.py | UTF-8 | 2,396 | 3.25 | 3 | [] | no_license | # Move the middle points for the largest loopback sequence, disgarding the possible sequence with less length
class Solution:
def longestPalindrome(self, s: str) -> str:
MedIcr = 0
MaxLen = 1
MaxIdx = [0, 0]
if len(s) <= 1:
SubStr = s
elif len(s) == 2:
... | true |
a5a475d4fc6385283d9851d183fe0659d5d2654a | Python | NetworkRanger/python-core | /chapter14/goognewsrss.py | UTF-8 | 1,225 | 2.8125 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
# -*- coding:utf-8 -*-
# Author: NetworkRanger
# Date: 2019/8/11 4:39 PM
try:
from io import BytesIO as StringIO
except ImportError:
try:
from cStringIO import StringIO
except ImportError:
from StringIO import StringIO
try:
from itertools import izip as zip
excep... | true |
5503a60bf2e5b7bc4e431421f67fbeadd05c617f | Python | dialup/python_usp | /usp_1/semana3/fatorial.py | UTF-8 | 147 | 3.546875 | 4 | [
"BSD-2-Clause"
] | permissive | import math
n = int(input("Digite o valor de n: "))
count = 1
valor = 1
while (count <= n):
valor = valor * count
count += 1
print(valor)
| true |
7baaf9128ab53947d37042c95885edc9daeb409d | Python | xpxu/regex | /re_write_url.py | UTF-8 | 1,378 | 3.078125 | 3 | [] | no_license | # -*- coding:utf-8 -*-
'''
Purpose: Filtering Nimbula APIs using Apache Proxy
--------------------------------------
RewriteCond /federation/@SITENAME@/vpnendpoint/,%{REQUEST_URI} ^([^,]+),\1
RewriteRule ^/(.*) balancer://api%{REQUEST_URI} [P]
注:比较前面的字符串和后面的正则表达式,看是否匹配。如果匹配,那么
执行RewriteRule,将前面正则表达式匹配的url重写成后面的url.
---... | true |
e152063cde76b8e2d8cd8c5a2eff8ad0f11e9c37 | Python | Leonardo-Reis/Meu-Curso-Python | /ex108/teste.py | UTF-8 | 311 | 3.625 | 4 | [] | no_license | import moeda
p = float(input('Digite o preço: '))
print(f'O dobro do preço é {moeda.moeda(moeda.dobro(p))}')
print(f'O triplo do preço é {moeda.moeda(moeda.triplo(p))}')
print(f'Aumentando 10% temos {moeda.moeda(moeda.aumentar(p, 10))}')
print(f'Diminuindo 30% temos {moeda.moeda(moeda.diminuir(p, 30))}') | true |
16417b237ede6b15fb66153431471279838531a6 | Python | sriramsk1999/midas-2021-task | /task2/mnist_wrong.py | UTF-8 | 3,222 | 2.640625 | 3 | [] | no_license | '''
Contains the implementation of the MNISTWrong DataModule
'''
import os
from typing import Optional
import torch
from torchvision import transforms, datasets
from torch.utils.data import Dataset, DataLoader
from sklearn.model_selection import train_test_split
from skimage import io
import pytorch_lightning as pl
c... | true |
1de0b452ec143f959fc620ade678a5edcf365cf3 | Python | kennyjoseph/twitter_dm | /examples/simple_pull_down_user_data_print.py | UTF-8 | 1,654 | 2.875 | 3 | [] | no_license | """
This is the most basic script for using twitter_dm.
From here, you may want to go look at some of the more complex examples
that leverage the library's NLP/rapid collection tools, as this is basically
a replication of tweepy with less documentation :)
"""
from twitter_dm.TwitterAPIHook import TwitterAPIHook
from t... | true |
8a4bfe56f6ebe53e7dc8181cb6ac071485a8455f | Python | chrispun0518/personal_demo | /leetcode/Counting Elements.py | UTF-8 | 358 | 3.078125 | 3 | [] | no_license | class Solution(object):
def countElements(self, arr):
"""
:type arr: List[int]
:rtype: int
"""
counter = {}
counts = 0
for i in arr:
counter[i] = counter.get(i, 0) + 1
for i in counter:
if i + 1 in counter:
count... | true |
e643ce46cada17b1c4ac049e1cde6c6dd2e2b037 | Python | mburakaltun/ENGR421-Biweekly-Homeworks | /Homework 02 - Discrimination by Regression.py | UTF-8 | 3,021 | 2.671875 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
# getting data from csv files
X = np.genfromtxt('hw02_data_set_images.csv', delimiter=',')
Y = np.genfromtxt('hw02_data_set_labels.csv', usecols=0, dtype=str)
X_train = np.concatenate((X[0:25], X[39:64], X[78:103], X[117:142], X[156:181]))
X_test ... | true |
bede320b7d019c8392f70a8d017d9259b59d2121 | Python | IOLevi/backend-homework | /util/utilities1.py | UTF-8 | 4,318 | 3.4375 | 3 | [] | no_license | """
Utilities1 Module
"""
import datetime
import json
import requests
def iso_to_datetime(input_str):
"""
Removes final colon from input string to conform to python 3.6 %z format specifier.
Returns a datetime object based on the ISO input string.
"""
format = '%Y-%m-%dT%H:%M:%S%z'
if input_st... | true |
32f1977228f54b9220557bf9b1f070b34b0731f5 | Python | sirkon/tutor | /vector.py | UTF-8 | 4,486 | 3.71875 | 4 | [] | no_license | #!/usr/bin/env python
#
# a python Vector class
# A. Pletzer 5 Jan 00/11 April 2002
#
import math
"""
A list based Vector class that supports elementwise mathematical operations
In this version, the Vector call inherits from list; this
requires Python 2.2 or later.
"""
class Vector(list):
"""
A list based ... | true |
15a587a3c08616a3ee8d2fbccd738028f353e31d | Python | khushboobajaj25/Python | /Testing/TupleAndSet.py | UTF-8 | 328 | 3.109375 | 3 | [] | no_license | tup = (5, 16, 23, 25, 38, 54)
print(tup.__getitem__(0))
print(tup)
print(len(tup))
seteg = {1, 2, 3, 4, 5, 5, 6}
seteg1 = {1, 2, 4, 8, }
print(seteg)
tup2 = (2, 2);
tup3 = tup.__add__(tup2)
print(tup3)
print(seteg.intersection(seteg1))
seteg1.intersection_update(seteg)
print(seteg)
print(seteg.symmetric_difference(set... | true |
7cd8ec8dac0eb973cf4d28755f557a4aa33468e5 | Python | AugustDixon/SeniorDesign | /tower/Obstacles/Drone.py | UTF-8 | 5,585 | 2.890625 | 3 | [] | no_license | #Drone Class definition
#Author: August Dixon
#LSU Senior Design 2018-2019 Team #72
from ..Coordinate.Point import *
from ..Coordinate.Vertex import *
import math
INV_THOUSAND = 1 / 1000
#Finds euclidean distance of two points
# Arguments:
# Point arg1
# Point arg2
# Returns:
# double dist - E... | true |
f41731f3fbb6622fee0407f6be4257545f7a496f | Python | RashadGhzi/Python-with-Anis | /anis31.py | UTF-8 | 98 | 3.5 | 4 | [] | no_license |
matrix = [
[1,2,3],[4,5,6]
]
for row in matrix:
for column in row:
print(column)
| true |
865b5549619e994b15e899483f69d4f0d0dfed9a | Python | lisasboylanportfolio/PortfolioJinja2 | /utils.py | UTF-8 | 5,613 | 3.125 | 3 | [] | no_license | import os
import glob
import re
import os.path
from jinja2 import Template
DEBUG = False
#
# Remove all *.html file from directory
#
# Input: directory : a pathname to the directory from which to remove hhtml files
# Return:
# True : if files were removed
# False : No files were removed
#
def cleanDir(directory)... | true |
c445bd1c63603e037c346e2f07215b5b9910408b | Python | geovanij2/UFSC | /ES1/app.py | UTF-8 | 7,818 | 3.015625 | 3 | [] | no_license | import pygame
import Client
from time import sleep
class App():
def __init__(self):
pygame.init()
pygame.font.init()
(width, height) = (800, 600)
self.black = (0,0,0)
self.white = (255, 255, 255)
self.bg_green = (0,100,0)
self.blue = (0,255,0)
self.inactive_blue = (0,180,0)
self.light_blue = (... | true |
3562bf927bee8a96dc694a074a7edaf10b3937c8 | Python | KseniaZikova/Case_04 | /main.py | UTF-8 | 3,692 | 3.1875 | 3 | [] | no_license | # Developers: Zikova K. 60%, Bateneva M. 80%, Shlapakova K. 90%
import os
def acceptCommand(): # проверка на ввод номера
kk = '1234567'
while True:
s = input('Выберите пункт меню: ')
if s in kk:
return s
else:
continue
def runCommand(command, path):
if co... | true |
c2ab0bcfa84f86e5266d17823d0b868b6b49657a | Python | DHANUSHVARMA1/IBMLabs | /HCF.py | UTF-8 | 330 | 3.5 | 4 | [] | no_license | def compute_hcf ( x , y ):
if x>y :
smaller = y
else:
smaller = x
for i in range ( 1, smaller+1 ):
if(x%i == 0 ) and ( y%i == 0):
hcf = i
return hcf
num1 = int(input("Enter number 1 : "))
num2 = int(input("Enter number 2 : "))
print("HCF = ",compute_hcf(num... | true |
2bdc4e84ae9f968ad447a5dd2b52d353372c7e90 | Python | kannanmavila/coding-interview-questions | /interview_cake/5_ways_to_make_change.py | UTF-8 | 714 | 3.921875 | 4 | [] | no_license | def ways_to_make_change_bottom_up(n, denominations):
"""O(Nk) solution - uses the coins bottom-up.
Start with a particular coin, update all amounts
up till n, and never come back to that coin again.
"""
ways = [1] + [0] * n
for coin in denominations:
# For amounts higher than coin
for amount in xran... | true |
841648b8d687252b5903018a079b08dfac36bdb4 | Python | VladimirMerkul/pythonProject1 | /lessons/lesson 2/task_2_1.py | UTF-8 | 87 | 3.5 | 4 | [] | no_license | x = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
n = x[2]
print (x)
print ("third_number=" + str(n)) | true |
24ba9f46ad36dee3393684c2225b7de0b4a2d2ea | Python | rrwielema/ezgoogleapi | /ezgoogleapi/bigquery/schema.py | UTF-8 | 1,258 | 2.84375 | 3 | [
"MIT"
] | permissive | from typing import List
import pandas as pd
from datetime import datetime
class SchemaTypes:
'''
Class to easily assign a data type to a BigQuery-table column.
'''
INT64 = 'INT64'
BOOL = 'BOOL'
FLOAT64 = 'FLOAT64'
STRING = 'STRING'
OBJECT = 'STRING'
BYTES = 'BYTES'
TIMESTAMP = ... | true |
61b8cf85f90dc571de51a47f7fdc4ed6ca05c052 | Python | Hitesh20/OpenCV-Practice-Learning | /contours.py | UTF-8 | 459 | 2.578125 | 3 | [] | no_license | import cv2
import numpy as np
img = cv2.imread('opencv-logo.png', 1)
imgray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
ret, thresh = cv2.threshold(imgray, 127, 255, 0)
contours, herarchy = cv2.findContours(thresh, cv2.RETR_TREE, cv2.CHAIN_APPROX_NONE)
print("No of contours " + str(len(contours)))
cv2.drawContours(img,... | true |
fbb42fa1e15f3c2ca8169d7377c012e1a2d6d445 | Python | skjha1/SRM-Python-Elab-solution | /01 Session input Output.py | UTF-8 | 5,319 | 4.09375 | 4 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# Input and Output
#
#
# Q. 1 Multiplication Table
#
# Write a python program to print the table of a given number
#
# In[1]:
# Code By Shivendra
num = int(input(""))
for i in range(1, 11):
print(num,"x",i,"=",num*i)
# Q. 2: Height Units
#
#
# Many people ... | true |
0de26086e030e4d64f511a1578c8b00e267e3ce8 | Python | RobbeVer/BW_Stitching | /Test_files/Movement models/finding_translation_rotation.py | UTF-8 | 1,857 | 2.609375 | 3 | [
"Apache-2.0"
] | permissive | import numpy as np
import matplotlib.pyplot as plt
import cv2
import os
from skimage import data
from skimage.registration import phase_cross_correlation
from skimage.registration._phase_cross_correlation import _upsampled_dft
from skimage.transform import warp_polar, rotate, rescale
from scipy.ndimage import fourier_... | true |
0ad9cf0feffe0cb9b3440fa38c1b9fc846e1f072 | Python | datafolklabs/cement | /cement/core/config.py | UTF-8 | 6,248 | 3.078125 | 3 | [
"BSD-3-Clause"
] | permissive | """Cement core config module."""
import os
from abc import abstractmethod
from ..core.interface import Interface
from ..core.handler import Handler
from ..utils.fs import abspath
from ..utils.misc import minimal_logger
LOG = minimal_logger(__name__)
class ConfigInterface(Interface):
"""
This class defines ... | true |
920c427456f7cbfc81a55015798a2f2072630909 | Python | rajKarra69420/CryptoPals | /Cryptopals Set 4/set4_challenge26.py | UTF-8 | 1,111 | 2.84375 | 3 | [
"MIT"
] | permissive | import set3_challenge18 as ctr
import random
import os
key = os.urandom(16)
nonce = os.urandom(8)
def ctr_encrypt(message):
plaintext = (b'comment1=cooking%20MCs;userdata=' + message + b'comment2=%20like%20a%20pound%20of%20bacon'). \
replace(b';', b'%3b').replace(b'=', b'%3d')
return ctr.transform(pla... | true |
a97bbf401f59c0d410ebf04a5c7d57d4e87805db | Python | gistable/gistable | /all-gists/1599710/snippet.py | UTF-8 | 484 | 2.84375 | 3 | [
"MIT"
] | permissive | plugins = {}
def get_input_plugins():
return plugins['input'].items()
class Plugin(object):
plugin_class = None
@classmethod
def register(cls, name):
plugins[cls.plugin_class][name] = cls
class InputPlugin(Plugin):
plugin_class = 'input'
def process_input(self, something):
r... | true |
f521ae72896cd9e1407004ad81212dea5f9dc818 | Python | DrZhouKarl/LiDAR-Road-Analysis | /viewer.py | UTF-8 | 1,351 | 2.546875 | 3 | [] | no_license | import project_utils as ut
import argparse
import numpy as np
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
import sys
def viewer(chunk, draw_elevation=False, c=None, s=1, get=False):
np_chunk = np.array(chunk)
fig = plt.figure()
if draw_elevation:
ax = fig.add_subplot(111, projection='3... | true |
42ddabc63643491c3b4de68d082e8e91df574bcb | Python | Orik236/Web_Orka236 | /week8/informatics/Problems4/E.py | UTF-8 | 73 | 3.375 | 3 | [] | no_license | n = int(input())
cnt = 0
while n != 0:
n //= 2
cnt+=1
print(cnt) | true |
9a07877c5b1f9b1888e17559a201d67585771758 | Python | gschen/sctu-ds-2020 | /1906101061-杨超/day0331/test1.py | UTF-8 | 936 | 4.09375 | 4 | [] | no_license | class Stack(object):
def __init__(self,limit = 10):#创建空栈
self.stack = []
self.limit = limit
def is_empty(self):#判断是否为空,空则返回true
return len(self.stack)==0
def push(self,date):#入栈,使数据成为新的栈顶
if len(self.stack)>=self.limit:
print("栈溢出")
else:
self.... | true |
5dd5a7153cb2060d67a50fe3bfd914a674b2fd7c | Python | cnbdragon/GundamPy | /bubbles.py | UTF-8 | 1,412 | 2.53125 | 3 | [] | no_license | import nimble
import random as rand
import numpy as np
from nimble import cmds
from nimble import cmds as cmd
decRange = np.arange(-1,1,.1)
decRange2 = np.arange(0,1,.1)
r = 2
a = 2.0*r
y = (0, 1, 0) # y up
#polyPlane -w 1 -h 1 -sx 10 -sy 10 -ax 0 1 0 -cuv 2 -ch 1;
p = cmd.polyPlane(
w=100, h=100, sx=10, sy=10, ax=... | true |
2b2c3d9f9f87922732eb76a2004372948ca041e5 | Python | rhtm123/ProjectEuler | /prob_33.py | UTF-8 | 1,169 | 3.25 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat Feb 11 21:57:46 2017
@author: fun
"""
def str_array(n):
a=[]
while n > 0:
kuch = n % 10
a.append(kuch)
n = n//10
return a
nom = 1
de = 1
for i in range(11,99):
for j in range(i+1,99):
array1 = s... | true |
7baa170740d5d96483d91678bc7f842ff8ba2a78 | Python | KPW10452025/SQlite-and-Python | /02_insert_one_record.py | UTF-8 | 983 | 3.6875 | 4 | [] | no_license | # reference from
# "SQLite Databases With Python - Full Course"
# https://youtu.be/byHcYRpMgI4
import sqlite3
conn01 = sqlite3.connect('customer.db')
# Insert One Record Into Table
c01 = conn01.cursor()
c01.execute("INSERT INTO customers VALUES ('Ban', 'Takahashi', 'ban@gmail.com')")
c01.execute("INSERT INTO custo... | true |
a5a36119780301a504ea70af5c1374f84e98c57d | Python | veloquant/buildcloth | /test/test_dependency_checks.py | UTF-8 | 5,359 | 2.59375 | 3 | [] | no_license | from buildcloth.err import DependencyCheckError
from buildcloth.dependency import DependencyChecks
from unittest import TestCase, skip
import sys
import os
import time
def touch(fname, times=None):
with open(fname, 'a'):
os.utime(fname, times)
def write(fname, content):
with open(fname, 'w') as f:
... | true |
896b384ec40207dfca95686e22ccb8b9bf7939f4 | Python | omgimanerd/experimental | /ritcs/look-at-datman/sql/generate_populate.py | UTF-8 | 5,684 | 2.71875 | 3 | [] | no_license | #!/usr/bin/env python3
from xml.etree import cElementTree as ElementTree
import random
import time
STREET_SUFFIXES = ['RD', 'ST', 'BLVD', 'AVE', 'LN', 'DR']
STATES = ['NY', 'NH', 'MA', 'PA', 'NJ', 'VT', 'ME', 'OH',
'IN', 'IL', 'RI', 'CT']
ENGINES = ['V8', 'V6', 'W', 'Inine', 'Electric', 'Diesel', 'Petrol']... | true |
fdce0f64d4d024e0653a98bd90b914e22d0374e1 | Python | qsoo/algorithm | /CKS/0824_day1/BOJ2491.py | UTF-8 | 922 | 3.625 | 4 | [] | no_license | # https://www.acmicpc.net/problem/2491
N = int(input()) # 수열의 길이
sequence = list(map(int, input().split())) # 수열 들어있는 list
max_bigger, max_smaller = 1, 1 # 수열의 길이
total = 1
# bigger
for idx in range(N - 1): # out of index 막자
# out of index가 아닌 것 and 3개 더한게 2개 더한거 보다 클 때
if sequence[idx] <= sequence... | true |
8ead6edc68d544181f20a5302a4f3c0a1594f0f0 | Python | abhi204/cryptchat | /client.py | UTF-8 | 5,891 | 2.828125 | 3 | [] | no_license | import socket
import threading
import json
import os
import time
class Signal:
REGISTER_AND_WAIT = 'register' # register and wait for peer to connect to you
REGISTER_AND_CONNECT = 'connect' # register and send the peername you want to connect to
ACK_REGISTER = 'ack_register'
PEER_INFO = 'peer_info'
... | true |
704e2f2a9b1b4d1e87305129d316b862f2d4481f | Python | maotouying665/SortAlgorithms | /MergeSort.py | UTF-8 | 928 | 3.625 | 4 | [] | no_license | # 归并排序,体现分治的思想
# 分裂和归并
# 切片操作可读性强,但是会增加时间复杂度,不必要
# 使用了多一倍的存储空间用于归并,特大的数据集要注意一下
def mergesort(list):
if len(list)>1:
left=list[:len(list)//2] # python的切片操作
right=list[len(list)//2:]
left=mergesort(left)
right=mergesort(right)
list=merge(left,right)
return list
def merge(l... | true |
948af6cd033fe9df476c8ade7d940c70770d8967 | Python | zhenh65671/Math_Quiz_v2 | /start_GUI.py | UTF-8 | 3,258 | 3.234375 | 3 | [] | no_license | from tkinter import *
from functools import partial # to prevent unwanted windows
import random
class Start:
def __init__(self, parent):
# GUI to get starting balance and stakes
self.start_frame = Frame(padx=10, pady=10)
self.start_frame.grid()
# Maths Heading (row 0)
sel... | true |
2f95e76836352bf371099e4feea9a95c49fa9dc7 | Python | shahidshabir055/python_programs | /mass.py | UTF-8 | 196 | 2.84375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sat Mar 7 11:06:28 2020
@author: eshah
"""
n=int(input())
k=int(input())
m=[1][2]
print(m)
#for i in range(0,n):
# x,y=int(input())
| true |
364e75eca2fa9ebb836b3261f60408892ed372b3 | Python | Thukor/MazeSolver | /MazeSolving/Solver/MazeSolver.py | UTF-8 | 315 | 2.625 | 3 | [
"MIT"
] | permissive | from PathFinder import *
from pathfinding_algorithms import *
class MazeSolver:
@staticmethod
def solve_maze(maze):
pf = PathFinder(nx_shortest_path)
start_end = sorted([node for node in maze.nodes() if node.is_possible_start])
heuristic = manhattan_distance
return pf.find_shortest_path(maze,*start_end) | true |
07598f430aa15c103b45e36a001640ec55fcf037 | Python | Aasthaengg/IBMdataset | /Python_codes/p02879/s783193659.py | UTF-8 | 95 | 3.140625 | 3 | [] | no_license | a,b = list(map(int,input().split()))
if(a > 9 or b > 9):
print("-1")
else:
print(a*b) | true |
5311cffd4d88269a554134707f58d665cd7b6a75 | Python | jhmenke/dummyPy | /dummyPy/dummyPy.py | UTF-8 | 9,436 | 3.40625 | 3 | [
"MIT"
] | permissive | from collections import defaultdict
from pickle import load, dump
import numpy as np
import pandas as pd
from scipy.sparse import coo_matrix, hstack
def sort_mixed(levels):
try:
return sorted(levels)
except TypeError:
str_list = [l for l in levels if isinstance(l, str)]
other_list = [... | true |
1bbc86260cb6d9bda7e266e982ab559c33bb6b85 | Python | ranog/python_work | /capitulo_19-Contas_de_usuario/blog/blogs/models.py | UTF-8 | 617 | 2.8125 | 3 | [] | no_license | from django.db import models
# Create your models here.
from django.contrib.auth.models import User
class BlogPost(models.Model):
"""
Um assunto sobre o qual o usuário está aprendendo.
"""
title = models.CharField(max_length=200)
text = models.TextField()
date_added = models.DateTimeField... | true |
66f2263947c168fc289be1b66e2338466a468ee9 | Python | thegrill/grill-names | /grill/names/__init__.py | UTF-8 | 10,132 | 2.8125 | 3 | [
"MIT"
] | permissive | from __future__ import annotations
import uuid
import typing
import itertools
import collections
from datetime import datetime
import naming
try:
from pxr import Sdf
_USD_SUFFIXES = tuple(ext for ext in Sdf.FileFormat.FindAllFileFormatExtensions() if ext.startswith('usd'))
except ImportError: # Don't fail if... | true |
62c2a4a97b59b1d450bca6df8302644ed9f550e0 | Python | kiwishall/ASCVD_Cal | /RA_CAL.py | UTF-8 | 4,027 | 2.65625 | 3 | [] | no_license | # -*- encoding: utf-8 -*-
'''
@File : RA_CAL.py
@Time : 2021/04/03 10:12:44
@Author : Kaiqiang Li
@Version : V1.0
'''
# here put the import lib
import ERS_RA
import pandas as pd
# 读取金宇的数据
io = r".\data.xlsx"
data_jinyu =pd.read_excel(io, sheet_name = "金宇", header = None)
# data_jinyu.drop(index=[0,1], i... | true |
53bbb9e43632c667705cd9347681abd2ae125a0d | Python | gsrr/Programs | /zeroJudge/20131015_python_unitTest.py | UTF-8 | 215 | 2.953125 | 3 | [] | no_license | import unittest
def sum(a , b):
return a + b
class executeUnitTest(unittest.TestCase):
def test_sum(self):
a = 1
b = 2
c = sum(a , b)
self.assertEqual(3 , c)
if __name__ == "__main__":
unittest.main()
| true |
7712ee24f9d619da02055716eb4a63feb105d636 | Python | moonhyeji/Python | /Python00/com/test01/type03.py | UTF-8 | 466 | 4.34375 | 4 | [] | no_license | #list = 배열
#생성자
a = list()
print(a)
a.append(1)
print(a)
a.append('a')
print(a)
a[1] = 'b'
print(a)
#a[2] = 'c'
#print(a)
#[]사용
b = [1,2,3,4,5]
print(b)
print(b[0] +b[3]) #5
print('-----------------')
#list의 reverse()함수
b.reverse()
print(b)
b.append(6)
b.sort() #sort = 정렬
print(b)
#중첩
c =['a','b','... | true |
128b4ecbdf051e38463168edc17f6e229d9a7488 | Python | Animesh420/automated_email | /readMail.py | UTF-8 | 1,723 | 2.65625 | 3 | [] | no_license | import imaplib
import email
from config import SMTP_SERVER, FROM_EMAIL, FROM_PWD
def read_email_from_gmail(content_email, subject):
""" Reads the email using a prescribed email
id and subject
"""
details = {}
mail = imaplib.IMAP4_SSL(SMTP_SERVER)
mail.login(FROM_EMAIL, FROM_PWD)
mail.sel... | true |
95b1327b79798b0a7f5fac7ebf10106cba52b90b | Python | Mamofish/py_netBooter_Terminal | /np_term.py | UTF-8 | 1,660 | 3.296875 | 3 | [] | no_license | import socket
import time
import sys
def connect(ip_value, port_value):
HOST = str(ip_value) # The remote host IP address
PORT = int(port_value) # The server port number
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.connect((HOST, PORT))
time.sleep(0.1) ... | true |
bb7554ea181c1f59fb245aa3033fb90a4153bc7f | Python | ksaidev/TransBot | /src/bot/responder/channel.py | UTF-8 | 1,548 | 2.65625 | 3 | [] | no_license | from src.data.channel_db import ChannelDatabase
from data.private import ADMIN_CHANNEL
from src.constants import messages
class ChannelResponder:
"""
An object for managing channels
Called directly on join and included in chat object as instance variable on message
Contains channel instance and channel... | true |
a8d523bcfea6dd04672c4cf3c2c074cd5ecfc025 | Python | liucheng2912/py | /leecode/剑指offer/python基础/数据类型/字符串string/strip.py | UTF-8 | 56 | 2.609375 | 3 | [] | no_license | field = '----hello----world----'
print(field.strip('-')) | true |
3f7a3e2846863b53498a197846498fd95d5d484b | Python | HenryBalthier/Python-Learning | /Leetcode_easy/math/367.py | UTF-8 | 338 | 3.453125 | 3 | [] | no_license | class Solution(object):
def isPerfectSquare(self, num):
"""
:type num: int
:rtype: bool
"""
r = num
while r * r > num:
r = (r + num/r) /2
print(r)
return r * r == num
if __name__ == '__main__':
s = Solution()
x = 9
print(s.i... | true |
18000df6ca94fb4faace6ce72f9066a585a65771 | Python | wasiqrumaney/MLMI | /src/VAEs/vae16.py | UTF-8 | 2,236 | 2.578125 | 3 | [] | no_license | import torch
from torch import nn
Z_DIMS = 64
device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
# VAE Model
class VAE(nn.Module):
def __init__(self):
super(VAE, self).__init__() # input 1x16x16x16
self.relu = nn.ReLU()
self.conv1 = nn.Conv3d(1, 1, kernel_size=2, str... | true |
a3cbb0cc4bc4c43fe88391e1c80f431fb7db74dd | Python | Shisan-xd/testPy | /python_work/day10_05返回值作为参数传递.py | UTF-8 | 1,079 | 4.5 | 4 | [] | no_license | # @Time :2021/10/11 09:16
# @Author :
# @File :day10_05返回值作为参数传递.py
# -- 函数的参数
# # 1、定义两个函数;2、函数一有返回值50;函数二把返回值50作为参数传入(定义函数二要有形参)
# def T1():
# return 5
#
#
# def T2(num):
# print(num)
#
#
# # 先拿到函数一的返回值,再把返回值传到函数二
# result = T1()
# # print(result)
# T2(result)
# def r_e():
# return 10
# r... | true |
a16e3746f01d62c44e15274e09d4a82789bbee34 | Python | agozdogan/Piece-Of-Programming | /CodeSignal/SumNumbers/question1.py | UTF-8 | 173 | 3.140625 | 3 | [
"Apache-2.0"
] | permissive | def add(param1, param2):
if param1 <=1000 and param1 >=-1000 and param2 >=-1000 and param2 <=1000:
total = param1 + param2
return total
print(add(10,19)) | true |
6181dcb5b18716d394a2e0dd7cc77f8e0cef7440 | Python | JhonesBR/python-exercises | /3 - Python Loop Exercise/ex06.py | UTF-8 | 224 | 3.984375 | 4 | [] | no_license | # Given a number count the total number of digits in a number
# Solution: https://github.com/JhonesBR
def numberOfDigits(n):
print(f"{n} has {len(str(n))} digits")
n = int(input("Insert a number: "))
numberOfDigits(n) | true |
7ed2bf40b0bc744c1e6cdd497976c770622be02d | Python | prblthp/Insertion_Sort_Adv_Analysis | /Insertion_Bin_Search.py | UTF-8 | 1,520 | 2.890625 | 3 | [] | no_license | # Enter your code here. Read input from STDIN. Print output to STDOUT
# !/bin/python3
import math
import os
import random
import re
import sys
# Complete the insertionSort function below.
cnt = 0
def binarySearch(arr, l, r, x):
global cnt
while l <= r:
mid = l + (r - l) // 2
... | true |
9d950b8baf8805b32e94c2131bb6dade7377bf97 | Python | pcranger/learning-Flask | /section2/OOP/oveview.py | UTF-8 | 764 | 4.46875 | 4 | [] | no_license | """ student = {
"name": "Rolf",
"grades": (89, 90, 93, 78, 90)
}
def average(sequence):
return sum(sequence) / len(sequence)
#passing data to function
print(average(student["grades"])) """
# dot(.) means inside e.g Student.average() means average function inside Student class
class Student:
def __ini... | true |
8f643555e45fc31c324424eaecc60dbcd4906f9d | Python | TomasBalbinder/Projekty | /list.py | UTF-8 | 1,463 | 4 | 4 | [] | no_license | '''
Uprav predchozi program znamky
tak aby program hodnoty ukladal do seznamu.
Seznam vypis pred a po setrideni.
Vypis nejlepsi a nejhorsi a prumernou znamku seznamu.
'''
znamky = int(input("Zadej 1. znamku: "))
pocitadlo = 1
seznam = []
if znamky > 0:
while znamky in range(1,6):
seznam.appen... | true |
96501012d45d3fd5e906b6cd85085133056a2f42 | Python | matthewsgerling/Python_Class_Work | /Week10/Invoice/invoiceClass.py | UTF-8 | 855 | 3.515625 | 4 | [] | no_license | # Author: Matthew Gerling
# File: invoiceClass.py
# Date: 7/1/2020
class Invoice:
def __init__(self, iid, cid, ln, fn, pn, add):
self.invoice_id = iid
self.customer_id = cid
self.last_name = ln
self.first_name = fn
self.phone_number = pn
self.address = add
s... | true |