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 |
|---|---|---|---|---|---|---|---|---|---|---|
754a0665323d2c6f70913a5814b388745cef5c92 | stkim123/kr.ac.jbnu.ssel.stkim.tensorflow | /traffic_analysis/01_Visualization.py | UTF-8 | 1,933 | 2.96875 | 3 | [] | no_license | import tensorflow as tf
import numpy as np
import os
import pandas as pd
from sklearn.preprocessing import scale
import xlrd
class Visualizer:
def __init__(self, fileName):
workbook = xlrd.open_workbook(fileName)
self.sheet = workbook.sheet_by_index(0)
self.rows = self.sheet.nrows
... | true |
0fed16dbdc5f6ecd3e7cc3a61075134762727b30 | nice0001-angelo/Python | /SafeFourCal.py | UTF-8 | 308 | 2.96875 | 3 | [] | no_license | from MoreFourCal import *
class SafeFourCal(MoreFourCal):
def div(self):
if self.second == 0:
return 0
else:
result = self.first / self.second
return result
if __name__ == '__main__':
a=SafeFourCal(10,6)
print("SafeFourCal의 add", a.add()) | true |
0ed8489e006b3d6eee3a4be56c72c19d8bb623f5 | oldxie/pygraphic | /sample/animal.py | UTF-8 | 1,694 | 2.53125 | 3 | [] | no_license | from Image import *
from component import *
from device import *
import matplotlib.image as mpimg
def rabit_texture():
vb=loadfromobj('./model/rabbit.obj')
img = mpimg.imread("./model/rabbit_texture.png")
#plt.imshow(img[0:512,0:512])
#plt.show()
#"""
#L1=light([0,0.5,-1.2],[-2,-1,-1]... | true |
1cb81459722e17bcdf5a4121ec0a7f36bb14ff49 | gotofritz/quick_and_dirty | /styled_markdown/features/steps/main.py | UTF-8 | 2,960 | 3.109375 | 3 | [] | no_license | import glob
from pathlib import Path
from behave import *
from subprocess import run
CMD = "styled_markdown"
@given("there are no previously generated outputs")
def step_impl(context):
for file in glob.glob("*.html"):
Path(file).unlink()
@given("I have the command in the path")
def step_impl(context)... | true |
981427bbc16cf40c55ee52fc0ef73f2364d7d6da | ken-fu/db_viewer | /gui/base_widgets.py | UTF-8 | 2,108 | 2.546875 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
from PyQt5.QtWidgets import QTreeView, QAbstractItemView
from PyQt5.Qt import Qt
from PyQt5.QtCore import QAbstractTableModel
class MyTableModel(QAbstractTableModel):
def __init__(self, list, headers=[], parent=None):
QAbstractTableModel.__init__(self, parent)
self.list = li... | true |
2dae920cac1988d8af8d124876c8af17395432c5 | xhottestxp/downloader | /core/service/service.py | UTF-8 | 1,339 | 2.9375 | 3 | [] | no_license | from core.model.file import File
from core.download.download import Download as DLoad
from core.singleton.singmessage import SingMessage as SMsg
class Service:
"""Regra de Negócio, onde os parametros do
arquivo são testados.
Author:
bcarsoft
"""
def __init__(self):
"""Novo Servi... | true |
5f86b58554b841e5e4f134ee538b5422d650dc23 | mrgyange/python-project | /wait.py | UTF-8 | 762 | 4.09375 | 4 | [] | no_license | class Person:
def __init__ (self, firstname, lastname):
self.firstname = firstname
self.lastname = lastname
def __str__ (self):
return "{} {}".format(self.firstname, self.lastname)
class Student(Person):
def __init__ (self, firstname, lastname, school = ""):
super()._... | true |
55325a42c6dce94b6ad757b714b5840e1911ef2c | nayuki/Nayuki-web-published-code | /next-lexicographical-permutation-algorithm/nextperm.py | UTF-8 | 1,709 | 4.1875 | 4 | [] | no_license | #
# Next lexicographical permutation algorithm (Python)
# by Project Nayuki, 2014. Public domain.
# https://www.nayuki.io/page/next-lexicographical-permutation-algorithm
#
# -- Basic version --
#
# Computes the next lexicographical permutation of the specified list in place,
# returning whether a next permutation ... | true |
caffc923d59374377ade20c096d1e2c9b6ed1a73 | kaizenmaru/othelo | /othelo.py | UTF-8 | 6,605 | 3.140625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
from tkinter import *
import tkinter.messagebox as mb
from random import randint
class Othelo():
WIDTH, HEIGHT = 640, 640
def __init__(self):
self.win = Tk()
self.cv = Canvas(self.win, width=Othelo.WIDTH, height=Othelo.HEIGHT)
self.cv.pack()
... | true |
e16bf86c937dd492f393837a1d26e1b611f41c72 | kadir014/Kithare | /build.py | UTF-8 | 14,141 | 2.578125 | 3 | [
"MIT"
] | permissive | """
This file is a part of the Kithare programming language source code.
The source code for Kithare programming language is distributed under the MIT
license.
Copyright (C) 2021 Kithare Organization
build.py
Builder script to build Kithare.
On Windows and MinGW:
You must have MinGW (AKA MinGW-w64) installed, and... | true |
2ca84104a9cb5c3f84b2a81e141f49423beb557c | AlanLee97/Study_Python3 | /MyStudy/ex10_module.py | UTF-8 | 1,277 | 4.0625 | 4 | [] | no_license |
"""
1. import 语句
想使用 Python 源文件,只需在另一个源文件里执行 import 语句
"""
# import test
# test.hello()
# num = test.sumf()
# print(num)
"""
2. from … import 语句
Python 的 from 语句让你从模块中导入一个指定的部分到当前命名空间中,语法如下:
这样就调用模块中的变量和函数等时可以不用每次都加上模块名
可以直接使用变量或函数等
"""
# from test import hello,sumf
# hello()
# num = sumf()
# print(num)
# from … imp... | true |
21966c1a524d3172e5f4dbb665c0c74646930382 | s-majumdar7/Machine-Learning-in-Python | /Codes and Datasets/Part 4 - Clustering/Hierarchical Clustering/HierarchialCluster.py | UTF-8 | 1,318 | 3.46875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Mon Jun 29 12:51:17 2020
@author: Subhasmita
"""
"""K-Means Clustering"""
"""Importing the libraries"""
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
"""Importing the dataset"""
df=pd.read_csv('Mall_Customers.csv')
X=df.iloc[:,[3,4]].values
print(X)
"... | true |
8e7f3bd9439cb9989913b3ea1508e0bb93bb00fe | AnuLakshmi26/ucla-2019 | /Dictionaries.py | UTF-8 | 372 | 3 | 3 | [] | no_license | dictionary = {
"dekho ":" look",
"na" : "please",
"Yaar":"hey!dude",
"bultaoreune":"I'm on fire",
}
sentence=("Yaar dekho na (Hindi to English). bultaoreune (Korean to English ) ")
wordList=sentence.split(" ")
print(wordList)
for word in wordList:
if word in dictionary.keys():
print(... | true |
b2a8dcab64f1583a0ba3d5dd3ced84ea32a895f1 | knudhansen/scripting | /python/generators/generator_tutorial.py | UTF-8 | 431 | 3.265625 | 3 | [] | no_license | import math
## my first generator
def knudsGenerator():
yield 1
yield 2
i = 3
while True:
iPrime = True
for k in range(3, int(math.sqrt(i) + 1), 2):
if i % k == 0:
iPrime = False
break
if iPrime:
yield i
i = i+2
kg... | true |
b860fb1be79845ac7bca047d93fe8fa5619f32d1 | deltahalo099/physics-251 | /hw0/hw0_4.py | UTF-8 | 518 | 3.40625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Mon Jan 27 16:52:17 2020
@author: Ziron
"""
import numpy as np
a = np.zeros((3, 3))
b = np.zeros((3, 3))
print('a.ij = 1 b.ij = 1\n')
for i in range(0, 3):
for j in range(0, 3):
a[i][j] = 1
b[i][j] = 1
c1 = a.dot(b)
c2 = b.dot(a)
c3 = (a.transpose()).dot(b)
c4 = ... | true |
e687f3f4d2367fc8020109e9286d279ed1cc39eb | harry75369/kids-programming | /python/exercises/primes.py | UTF-8 | 587 | 3.359375 | 3 | [] | no_license | def primes(n):
store = {}
def calcPrimes(n):
if n == 0:
return 2
elif n in store:
return store[n]
else:
ps = [calcPrimes(i) for i in range(n)]
np = ps[n-1]
is_prime = False
while not is_prime:
is_pr... | true |
514b6d92621b8aa7b4a971032cf52a5b3dcb2a65 | jonasht/cursoIntesivoDePython | /exercisesDosCapitulos/10-arquivosEExcecoes/10.11-numerosFavoritos/numeroFavorito-load.py | UTF-8 | 257 | 3.15625 | 3 | [] | no_license | import json
def enfeitar():
print('=-'*30+'=')
def get_numeroFavorito():
with open('numero.json') as arquivo:
conteudo = json.load(arquivo)
return conteudo
enfeitar()
print(f'seu numero favorito é {get_numeroFavorito()}')
enfeitar()
| true |
d99fe9bb93e40661b0f44a33ccb69cb0997504dc | ntumirlab/Speaker-Verification | /TrainSet/GE2EDataset.py | UTF-8 | 5,804 | 2.609375 | 3 | [] | no_license | import os
import torch.utils.data as data
import torch
from tqdm import tqdm
from glob import iglob
import pickle as pkl
import random
import numpy as np
from sklearn import preprocessing
class GE2EDataset(data.Dataset):
'''
'''
def __init__(self, utt_dir, step=3000, speaker_num=64, utterance_num=10, wind... | true |
361e4d07975ca9bfa13fde5395e05cfab57a2474 | arsalansaad/webcrawler | /main2.py | UTF-8 | 443 | 2.890625 | 3 | [] | no_license | import requests
from bs4 import BeautifulSoup
url = "http://www.hindustantimes.com/editorials/"
sourcecode = requests.get(url).text
soup = BeautifulSoup(sourcecode, "html.parser")
for link in soup.findAll("div",{ "class": "media-heading headingfour"}):
print(link.text)
for item in link.findAll('a'):
... | true |
0d8280211198137bdb02f45a0a5157e19fc1666a | TimurNurlygayanov/test-tasks-example | /algs/dummy_hash_table.py | UTF-8 | 1,270 | 4.03125 | 4 | [] | no_license | # This is the very simple implementation of hashtable
# data structure based on the video from
# https://www.youtube.com/watch?v=54iv1si4YCM
#
class HashTable(object):
size = 1000
elements = [[] for i in range(size)]
def get_hash(self, key: str) -> int:
hash_value = 0
for character in ke... | true |
687c3be6012ae34c6d6c6ec148eb451215fbdc21 | martin-mcgloin/SparseMatrix | /Test_SparseMatrix.py | UTF-8 | 4,722 | 2.8125 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Jan 11 16:04:28 2018
@author: martinmcgloin
"""
from scipy import *
from pylab import *
from SparseMatrix import *
import unittest
class TestSparseMatrix(unittest.TestCase):
def setUp(self):
self.matrix1 = numpy.array([
... | true |
07d6faba61e81d2bb89d52a5e2e561d699add6a0 | shellingford1412/python | /ex2.py | UTF-8 | 54 | 2.5625 | 3 | [] | no_license | 1+1
print('你是居居')
print('你是二傻子')
1+2 | true |
a3844144ba7a3da2e2cc5114cb7b04af3fce60e7 | podhmo/jsonschemawalker | /jsonschemawalker/tests/test_to_python.py | UTF-8 | 8,601 | 2.59375 | 3 | [] | no_license | # -*- coding:utf-8 -*-
import pytest
from datetime import datetime
import pytz
def _callFUT(*args, **kwargs):
from jsonschemawalker import to_python
return to_python(*args, **kwargs)
def test_atom__no_convert():
schema = {"type": "string"}
result = _callFUT(schema, "foo")
assert result == "foo"
... | true |
c42e99052fe9aa4a07753220d76f719d6dd01899 | jivthesh/Pick-Parser | /pdf_to_png.py | UTF-8 | 852 | 2.515625 | 3 | [
"MIT"
] | permissive | from PIL import Image
import pytesseract
import sys
from pdf2image import convert_from_path
import os
#pytesseract.pytesseract.tesseract_cmd = "/usr/share/tesseract-ocr/4.00/tessdata"
def generate_images_and_text_from_pdf(PDF_file,target_dir):
pages = convert_from_path(PDF_file, 500)
image_counter = 1
... | true |
ded6fa8238666f4c3a6fd866fe88714b482d122b | dr-dos-ok/Code_Jam_Webscraper | /solutions_python/Problem_74/936.py | UTF-8 | 3,025 | 3.21875 | 3 | [] | no_license |
import sys
import collections
import numpy as np
#For debugging.
from IPython.Shell import IPShellEmbed
ipshell = IPShellEmbed()
if len(sys.argv) < 2:
print('Need an input file!')
exit()
input_filename = sys.argv[1]
output_filename = input_filename + '.out'
input_file = file(input_filename)
output_file = ... | true |
b4b630fbe31572eccdc83a2f1c51b5d897f58747 | DongHyunByun/algorithm_practice | /past_archive/swexpert/5431(checkingReport).py | UTF-8 | 258 | 2.890625 | 3 | [
"MIT"
] | permissive | for t in range(int(input())):
N,K=map(int,input().split())
studentList=[i for i in range(1,N+1)]
ReportDoneList=list(map(int,input().split()))
for k in range(K):
studentList.remove(ReportDoneList[k])
print(f"#{t+1}",*studentList)
| true |
dc658981b818b5b6e09f7b5f59bf323467cc383d | AlexK168/BSUIR-PYTHON-2020 | /Solutions/Task2/853506_Kulsha_Alexander/test_vector.py | UTF-8 | 2,982 | 3.28125 | 3 | [] | no_license | import unittest
from vector import Vector
class TestVector(unittest.TestCase):
def setUp(self):
self.v1 = Vector([2, 5, 3])
self.v2 = Vector([1, 4, 2])
self.v3 = Vector([3, 9, 8, 13])
self.v4 = Vector([1, 4, 3])
self.sub_v = Vector([1, 1, 1])
self.add_v = Vector([3,... | true |
6e8d9cd7d1c192bb7e49dfed2270d8148fde1b00 | zizi0308/StudyRaspberry21 | /webcrawling.py | UTF-8 | 777 | 3.03125 | 3 | [] | no_license | from bs4 import BeautifulSoup as bs
from pprint import pprint
import requests as req
# 검색 url
url = 'https://search.naver.com/search.naver?query=날씨'
html = req.get(url) # 웹사이트 가져오기
# pprint(html.text)
soup = bs(html.text, 'html.parser') # beautifulsoul으로
datas = soup.find('div', {'class' : 'detail_box'}) # 미세먼지 영역찾... | true |
eb0d6966498f9f463d0f7f4f0f076d0b71b0a857 | marvingrosser/ads1unileipzig | /quicksort.py | UTF-8 | 791 | 3.4375 | 3 | [] | no_license | import sys
def Quicksort(arr):
if len(arr)==1:
return arr
liste1 = ([])
liste2 = ([])
for i in range(len(arr)-1):
if arr[0]>arr[i+1]:
liste1.append(arr[i+1])
else:
liste2.append(arr[i+1])
if len(liste1)<=len(liste2):
liste1.append(arr[0])
... | true |
51e7c6b3714b7f7ce97e00cc97220002c9164d87 | Zahidsqldba07/CodeSignal-26 | /Python/Picturing the Parsibilities/086 - xmlTags.py | UTF-8 | 866 | 2.65625 | 3 | [] | no_license | from xml.etree import ElementTree as ET
def xmlTags(xml):
root = ET.fromstring(xml)
#print (root.tag)
res = getChilds(root,0,{})
final = [root.tag + "("+ ", ".join( sorted(list(root.attrib.keys()))) +")"]
for key in res.keys() :
atribs = res.get(key)
final += [ str( key.repl... | true |
ba74cd51709eb85012ee6792d795f5e4c5691f74 | aluisq/Python | /estruturas_logicas_condicionais/ex8.py | UTF-8 | 313 | 3.71875 | 4 | [] | no_license | import math
a = float(input("Digite um número qualquer: "))
b = float(input("Digite um número qualquer: "))
c = (a + b)/2
if a < 10 and b < 10 and a > 0 and b > 0:
print("Tudo jóia")
else:
print("Tem algum valor errado, por gentileza repita os passos anteriores e insira o valor correto. Obrigado") | true |
cf6f5764412653b8cd2be6a79a86a028e0fd72ae | NebulaTheus/PlaneWars | /scoreboard.py | UTF-8 | 704 | 2.96875 | 3 | [] | no_license | import pygame.font
class Scoreboard():
def __init__(self,ai_set,screen,stats):
self.screen=screen
self.screen_rect=screen.get_rect()
self.ai_set=ai_set
self.stats=stats
self.text_color=192,192,192
self.font=pygame.font.SysFont(None,38)
self.prep_score()
... | true |
89e8d3e66dd16650af30f68d2da80d5f70990546 | TyroneRed/CVS-Covid-Vaccine | /mi_covid_vaccine_finder.py | UTF-8 | 5,348 | 2.640625 | 3 | [] | no_license | from selenium import webdriver
from selenium.webdriver.common.by import By
import time
import json
import tweepy
#age of person receiving vaccine, >= 18 for all vaccines, 16 or 17 for Pfizer
age = 16
#time in seconds to wait between tweeting at the same location
tweet_wait = 7200
driver = webdriver.Chrome(... | true |
c1e02118ac648dd35f80e078a46880d5df9c9dea | ninjawil/pyenergenie | /energenie/radio.py | UTF-8 | 10,842 | 2.578125 | 3 | [
"MIT"
] | permissive | # test1.py 26/09/2015 D.J.Whale
#
# Simple low level test of the HopeRF interface
# Uses direct SPI commands to exercise the interface.
#
# Receives and dumps payload buffers.
#
# Eventually a lot of this will be pushed into a separate module,
# and then pushed back into C once it is proved working.
import spi
impor... | true |
22f1650b36e7dfdb9df182bfc4917bdd9aee965f | dr-dos-ok/Code_Jam_Webscraper | /solutions_python/Problem_76/902.py | UTF-8 | 3,876 | 3.171875 | 3 | [] | no_license | '''
Created on 07/05/2011
@author: Shinjidev
'''
def obtenerSumaListaBinary(lista):
suma = "000000000000000000000000"
for i in lista:
suma = sumaStr(suma, i)
return suma
def obtenerSumaDecimal(lista):
suma = 0
for i in lista:
suma+=i
return suma
def ob... | true |
088565d031f32927ff0dbacf36d38790cbea1516 | langlixiaobailongqaq/python-selenium | /WebDriverAPI_第二章/2.1_操作元素基本方法/2.1.1_打开网页.py | UTF-8 | 332 | 2.5625 | 3 | [] | no_license | # 2.1.1打开网页
# coding:utf-8
# 导入webdriver模块
from selenium import webdriver
# 打开浏览器
driver = webdriver.Chrome() # 谷歌
# driver = webdriver.Ie() # IE
# driver = webdriver.Firefox() # 火狐
# 打开百度
driver.get("https://www.baidu.com")
# 教程:https://www.cnblogs.com/zidonghua/p/7430083.html | true |
37c183f57efff400a4e447903ce069be05aaebcd | Akash9varun/Proctor-Computer-Vision-Models | /objectdetect.py | UTF-8 | 2,581 | 2.59375 | 3 | [] | no_license | import cv2
import numpy as np
import urllib.request
# Load Yolo
print("LOADING YOLO")
net = cv2.dnn.readNet("yolov3.weights", "yolov3.cfg")
#save all the names in file o the list classes
classes = []
with open("coco.names", "r") as f:
classes = [line.strip() for line in f.readlines()]
#get layers of the network
la... | true |
4e4e0fde681a7f4aa9324db40bceaec0e78a287c | dev-daeun/algo-quiz | /baekjoon/4963_bfs.py | UTF-8 | 1,843 | 3.34375 | 3 | [] | no_license | from sys import stdin
'''
(i, j) 칸에서 걸어갈 수 있는 경로
-------------------------------
i-1, j-1 | i-1, j | i-1, j+1
-------------------------------
i, j-1 | i, j | i, j+1
-------------------------------
i+1, j-1 | i+1, j | i+1, j+1
-------------------------------
(i, j)의 adjacent vertexes = 주변 8개 칸들
1. 전체 각... | true |
4ddf8587515abcdf1251205ed8d58748ca43756b | lkusters/oud_contexttree | /contexttree/sequences_operate.py | UTF-8 | 751 | 3.015625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Thu Oct 6 13:52:50 2016
@author: Lieneke Kusters
functions that use FullTree class to operate on DNA sequences
"""
from contexttree.FullTree import FullTree
from Bio.Seq import Seq
def seqdistance(depth, seq1, seq2, rev):
"""
Compare 2 DNA sequences, by constructing ... | true |
ff1d702453b4370e08f23a8169c70ea7c7ab08e9 | VladislavZhukovsky/python-scripts | /source/Apps/PythonApp1/oop.py | UTF-8 | 1,231 | 4.0625 | 4 | [] | no_license | class Animal():
def __init__(self):
print('Animal created')
def who_am_i(self):
print('I am an animal!')
def eat(self):
print('I am eating')
#example for abstract class
def speak(self):
raise NotImplementedError('abstract class')
class Dog(Animal):
#class obje... | true |
8ca4e4095aa2cf4162e0c12b2b8d8465aeb101c7 | Ildarets/dz_4_ | /borndayforewer.py | UTF-8 | 179 | 3.21875 | 3 | [] | no_license | def game(answer_gamer, true_answer, answer):
while answer_gamer != true_answer:
print("Не верно!")
answer_gamer = input(answer)
print("Верно!") | true |
2219df2dd49e99a95e063298e15cc91e31ef4644 | nmoore32/Python-Workbook | /2 Decision Making/exercise56.py | UTF-8 | 762 | 3.890625 | 4 | [] | no_license | ##
# Program that categorizes electromagnetic radiation based on frequency
#
# Define constants that represent maximum frequency for each category
RADIO_WAVE = 3e9
MICROWAVE = 3e12
INFRARED = 4.3e14
VISIBLE = 7.5e14
ULTRAVIOLET = 3e17
XRAY = 3e19
# Read frequency from user
freq = float(input("Enter frequency in Hz: "... | true |
b577307769e43e4cc05613843fafa88dfb65ba33 | BerilBBJ/scraperwiki-scraper-vault | /Users/G/ghall09/huffingtonpost_rss_scrape_v3.py | UTF-8 | 986 | 2.71875 | 3 | [] | no_license | from urllib import urlopen
from BeautifulSoup import BeautifulSoup
import re
#open and read webpage
webpage = urlopen("http://feeds.huffingtonpost.com/huffingtonpost/raw_feed").read()
#determine what to titles / links to grab (2nd through 16th)
listiterator = []
listiterator[:] = range(2,16)
soup = BeautifulSoup(we... | true |
ae87d44ef483eeabefc6f19845e38491c359c59d | 1MLightyears/clarisse | /clarisse/GUI.py | UTF-8 | 7,339 | 2.65625 | 3 | [
"Apache-2.0"
] | permissive | """
Clarisse
Window drawing module.
analyze the interface of a function/class.
by 1MLightyears@gmail.com
on 20201211
"""
from . import analyze
from . import page
from . import log
import sys
import os
from PySide2.QtWidgets import QMainWindow, QApplication, QLabel, QTabWidget, QWidget
from PySide... | true |
473a59bc091b855f0818cf2a91d4f2d509236863 | shadykdc/AdventOfCode | /2021/6.py | UTF-8 | 1,381 | 3.28125 | 3 | [] | no_license | from collections import defaultdict
fish_ages = [1,4,1,1,1,1,1,1,1,4,3,1,1,3,5,1,5,3,2,1,1,2,3,1,1,5,3,1,5,1,1,2,1,2,1,1,3,1,5,1,1,1,3,1,1,1,1,1,1,4,5,3,1,1,1,1,1,1,2,1,1,1,1,4,4,4,1,1,1,1,5,1,2,4,1,1,4,1,2,1,1,1,2,1,5,1,1,1,3,4,1,1,1,3,2,1,1,1,4,1,1,1,5,1,1,4,1,1,2,1,4,1,1,1,3,1,1,1,1,1,3,1,3,1,1,2,1,4,1,1,1,1,3,1,1,... | true |
ec1d40da8acad4b76939871c81ccc61577d76963 | jeromeku/mininet | /mininet.py | UTF-8 | 14,248 | 2.96875 | 3 | [
"BSD-3-Clause"
] | permissive | import cPickle
import gzip
import tempfile
import os
import numpy as np
import time
import theano
import theano.tensor as T
from theano.compat.python2x import OrderedDict
def load_data(dataset):
''' Loads the dataset
:type dataset: string
:param dataset: the name of the dataset (here MNIST)
'''
... | true |
b28c07fa96194012a22c104338893bfadf3266bd | shaodan/coder | /leetcode/451.sort_characters_by_frequency.py | UTF-8 | 484 | 3.046875 | 3 | [] | no_license | class Solution(object):
def frequencySort(self, s):
"""
:type s: str
:rtype: str
"""
if len(s) < 3:
return s
ord_A = ord(' ')
count = [0]*(ord('z') - ord_A+1)
for c in s:
count[ord(c)-ord_A] += 1
count_f = filter(lambda ... | true |
0c8c0c9d5f14676f1fa7d12f649c37c41c973ca5 | parmveersingh/Machine-Learning | /04.Logistic regression/main.py | UTF-8 | 1,431 | 2.8125 | 3 | [] | no_license | import numpy as np
import pandas as pd
import matplotlib.pyplot as mp
data= pd.read_csv("plants_data.csv")
data=data.replace({"Iris-setossa":"Iris-setosa","versicolor":"Iris-versicolor"})
data= data.dropna(subset=['petal_width_cm'])
data= data[data["classes"] != "Iris-versicolor"]
data=data.replace({"Iris-setosa":0,... | true |
c56101d216d7d5cd67eca917d589d1801b93e42f | rmkamari/web_scrap | /scrapping.py | UTF-8 | 1,787 | 2.515625 | 3 | [] | no_license | from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
import time
from pymongo import MongoClient
driver = webdriver.Chrome()
driver.get("https://www.farsnews.com/")
time.sleep(4)
a = driver.find_element(By.XPATH, '/html/body/div[2]/main/div[1]/div/... | true |
86d1230684718f5a91ca03b36ccced7ad75c1a9a | softicer-67/ALGORITMS | /Lesson_1/8.py | UTF-8 | 440 | 3.953125 | 4 | [] | no_license | """
8. Определить, является ли год, который ввел пользователем, високосным или невисокосным.
"""
x = int(input('Введите год: '))
if x % 100 == 0 and x % 400 != 0:
print('Этот год обычный')
elif x % 100 == 0 and x % 400 == 0 or x % 4 == 0:
print('Этот год високосный')
else:
print('Этот год обычный')
| true |
d2fb2f69ebae7099343803c3c6395de1ad4ac1a3 | pengkingli/DataMining | /Bayes/bayesi.py | UTF-8 | 4,461 | 2.875 | 3 | [] | no_license | # coding=utf-8
import numpy as np
import pandas as pd
import math
def loadData(filename):
DataSet = []
#考虑不在数据集中“是/否”之后加,如何正常导入数据集,避免\n和之后的编号在一起
DataSet = open(filename).read().split(',') #读入为一个字符串并以,进行切分; 但是没能将是和之后的数字区分开
'''
for line in fr.readlines():
curline = line.strip().split('\t')
... | true |
39e98f5264a761238c3aabcab797385338b30043 | Ahsanul-kabir/Python-Learning-Codes | /Mosh_37_Inheritance.py | UTF-8 | 586 | 3.890625 | 4 | [] | no_license |
# Inheritance holo existing code ke bar bar use kora
class Phone: # Super Class, Parent Class, Base Class
def call(self):
print('You Can call')
def message(self):
print('You Can message')
class Samsung(Phone): # Sub Class, Child Class, Derived Class
# Call and Message Method c... | true |
4018c307f8b359258dc89f6ea843d7dd9e4584a6 | Bubujka/python-learning | /code/random/shuffle.py | UTF-8 | 146 | 3.125 | 3 | [] | no_license | #!/usr/bin/env python3
"""Перемешать массив"""
import random
arr = list(range(1,13))
print(arr)
random.shuffle(arr)
print(arr)
| true |
3b9c5dbb1e55cd0ba48e2cad6cd0ae9e37eda3b7 | PanTiany/Matrix-Product-in-Hadoop | /Code/mapper.py | UTF-8 | 554 | 3.171875 | 3 | [] | no_license | #!/usr/bin/env python3
import sys
for line in sys.stdin:
line = line.split('\t')
# print(line[0])
if(line[0] == 'A'):
for k in range(1,10001):
key = str(line[1]).zfill(3)+'0'+str(k).zfill(3)
value =[line[0],line[2],line[3].replace('\n','')]
print(key,... | true |
a8573ffd1bee4a4932ff519f2986fa17dd85dfa8 | Basty3lol/Tarea1_Criptografia | /Pagina Chilena/recuperar_pass.py | UTF-8 | 648 | 2.5625 | 3 | [] | no_license | import random
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import time
import string
driver = webdriver.Chrome()
def change_password(user):
driver.get("https://mybox.cl/iniciar-sesion")
driver.find_element_by_xpath('/html/body/main/section/div[2]/div/section/section/section/... | true |
649800cf7db2e95aaac74f82d00ed068b7cc7e2d | KhanChan18/this-algo | /algo-py/pzy/rle.py | UTF-8 | 456 | 3.140625 | 3 | [] | no_license | def rle(data):
res_mapping = {}
for d in data:
if d in res_mapping:
res_mapping[d] += 1
else:
res_mapping[d] = 1
return res_mapping
def get_output(res_mapping):
res = []
for c in sorted(res_mapping.keys()):
res.append('{}{}'.format(
c, res... | true |
532cf2d4202773f40080da09713f0be0c306ef8c | pankajkgoswami/Projects | /Python/Learning/Pandas/LearnPandaDataFrames.py | UTF-8 | 679 | 3.53125 | 4 | [] | no_license | import pandas as pd
import numpy as np
web_data = {'Days':[1,2,3,4,5,6],'Visitors':[20,32,23,44,43,22],'Bounce_Rate':[65,56,77,34,66,72]}
df =pd.DataFrame(web_data)
#Prints all the data
#print(df)
# Prints the number of records from top . Default is 5
#print(df.head(3))
# Prints the number of records fr... | true |
4a03188388dbcf21ddf825d8f98114331be89dd0 | DKU-STUDY/Algorithm | /BOJ/2792.보석 상자/6047198844.py | UTF-8 | 452 | 3.140625 | 3 | [] | no_license | import heapq
import sys
N, M = map(int, sys.stdin.readline().split())
colors = []
for _ in range(M):
marble = int(sys.stdin.readline().rstrip())
heapq.heappush(colors, (-marble, marble))
for _ in range(N-M):
max_color = heapq.heappop(colors)[1]
heapq.heappush(colors, (-(max_color // 2 + max_color % 2)... | true |
5589e6b5d6833d6758df4146610483e50c1f5c19 | SatoKeiju/AtCoder-Python3 | /ABC141/d.py | UTF-8 | 284 | 2.859375 | 3 | [] | no_license | def main():
import heapq as hq
n, m = map(int, input().split())
a = [-int(i) for i in input().split()]
hq.heapify(a)
for _ in range(m):
hq.heappush(a, -(-hq.heappop(a) // 2))
print(sum(a) * -1)
if __name__ == '__main__':
main()
| true |
98b72aeabc9df046fe380db953a23d21802fbc33 | jorgepauloS/CRIP162Final | /CRIP/cipher.py | UTF-8 | 2,032 | 3.8125 | 4 | [] | no_license | # -*- coding: utf-8 -*-
""" Classe com metodos basicos para cifras classicas """
class Cipher(object):
""" Classe base para as cifras classicas """
plain_alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
plain_alphanum = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'
def format_str(self, text):
'''Re... | true |
d06c31a9a470e432c073c598d9c4640eb969d38f | siscaramelo/python | /puzzle/State-Space_Seach.py | UTF-8 | 2,037 | 2.6875 | 3 | [] | no_license | '''
Created on 08/02/2015
@author: pablo
'''
import funciones as f
import copy
if __name__ == '__main__':
vInit =[['S','B','B'],['S','C','B'],['S','A','C'],['R','B','B'],['R','C','B']]
vParametros = {'x2': None, 'x3': None, 'x1': None}
# Action op1: Precondiciones
vPrecond... | true |
26fb9b749efa9e45881fe44d0807bc5b1e59b051 | hallielarsson/datatransfer | /skillImporter.py | UTF-8 | 2,483 | 2.625 | 3 | [] | no_license | from baxterSlate import Student, DemonstrationSkill, Demonstration
import datetime
import csv
import re
import urllib2
def IsCompetency(data):
return data["Type"] == "Competency Statement"
class SkillImporter:
competencies = []
skills = []
def __init__(self, compIndex, skillIndex, compsByCode, skillsByCode, s... | true |
5b174055c26ed78178fe37c240e1d09b487692a6 | ContinualAI/avalanche | /avalanche/training/checkpoint.py | UTF-8 | 3,106 | 2.734375 | 3 | [
"MIT"
] | permissive | import os.path
from copy import copy
import dill
import torch
from avalanche.training.determinism.rng_manager import RNGManager
def maybe_load_checkpoint(strategy, fname, map_location=None):
"""Load the strategy state from a checkpoint file.
The method returns the strategy with the state deserialized from ... | true |
a399e4ab8daaabde91c5fe1e9d46654b45ff88dd | kberkey/ccal | /ccal/_fit_skew_t_pdfs.py | UTF-8 | 663 | 2.796875 | 3 | [
"MIT"
] | permissive | from numpy import full, nan
from pandas import DataFrame
from .fit_skew_t_pdf import fit_skew_t_pdf
def _fit_skew_t_pdfs(df):
skew_t_pdf_fit_parameter = full((df.shape[0], 5), nan)
n = df.shape[0]
n_per_print = max(1, n // 10)
for i, (index, series) in enumerate(df.iterrows()):
if i % n_... | true |
5a991f7341bc4fad79f3509f8f01bde88337110e | Rithie/Socket-Play | /command-server/command_client.py | UTF-8 | 372 | 3.109375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
'''Sends and receives python command data.'''
import socket
host = 'michaelkilby.me'
port = 9999
rec_sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
rec_sock.connect((host,port))
bashCommand = raw_input("Enter bash command: ")
rec_sock.send(bashCommand)
data = rec_sock.recv(2048)
rec_... | true |
7f758f88351b7d27967872c2a4b1635fe9f23cdb | misterwilliam/smaps_experiments | /summarizer.py | UTF-8 | 2,001 | 3 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
"""Summarizes smaps
"""
import collections
import sys
class SmapsParser(object):
SECTION_HEIGHT=16
CATEGORIES=[
"Size",
"Rss",
"Pss",
"Shared_Clean",
"Shared_Dirty",
"Private_Clean",
"Private_Dirty",
"Referenced",
... | true |
171a531bd60a07fa70749c13784332f629807693 | gigafide/youtube-live-sream-camera | /pygame_test.py | UTF-8 | 1,831 | 3.578125 | 4 | [] | no_license | #IMPORT REQUIRED DEPENDENCIES
import pygame
import os
from time import sleep
import random
#SETUP ENVIRONMENT TO USE THE LCD SCREEN AND TOUCH
os.environ['SDL_FBDEV']= '/dev/fb1'
os.environ["SDL_MOUSEDEV"] = '/dev/input/touchscreen'
os.environ['SDL_MOUSEDRV'] = 'TSLIB'
#INITIALIZE PYGAME
pygame.init()
#SET A VARIABLE... | true |
2e0f46b492173aa4e35b9b32072a46a9848f2509 | attacker2001/Algorithmic-practice | /leetcode/728. Self Dividing Numbers.py | UTF-8 | 3,008 | 4.53125 | 5 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
@file: 728. Self Dividing Numbers.py
@time: 2019/04/26
A self-dividing number is a number that is divisible by every digit it contains.
For example, 128 is a self-dividing number because 128 % 1 == 0, 128 % 2 == 0, and 128 % 8 == 0.
Also, a self-dividing number i... | true |
83308e5e13425346472d320a83e263b2689c5802 | mnpappo/date_sort_nn | /pickel_data.py | UTF-8 | 1,413 | 2.546875 | 3 | [] | no_license | import gzip, cPickle
from glob import glob
import numpy as np
from PIL import Image
import os
from tqdm import tqdm
import hickle as hkl
import h5py
print("converting image to numpy array rgb format ---- White")
imlist = os.listdir('./resized_images_white_x/')
# imlist = imlist[0:20:1]
pbar = tqdm(total=len(imlist)... | true |
004964e0482b067adb8eb6d9683a11f4fb0ea5b8 | vmarquar/Raster-Processing-Pipeline | /createCC.py | UTF-8 | 4,193 | 2.515625 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Script that automates the data import,
data renaming and flattening of the downloads.
Secondly, it crops the provided raster images by its shapefile counterparts
Finally, it transforms the raster datasets into a EPSG:3857 (Google Web Mercator) Projection
"""
import sub... | true |
ad378cd527b422191ce5419a3e44c8dffd29c57c | vivianrdu/Language-Indexing | /wikitongues/wikitongues/language.py | UTF-8 | 819 | 2.859375 | 3 | [] | no_license | class Language:
"""
The Language class is (part of) the input to the program.
It contains details used to locate web resources about a language.
More fields will be added as we go.
"""
def __init__(
self, iso_code, standard_name, wikipedia_url, airtable_id=None):
"""
... | true |
d0467fe857752a15c388c41f2cf595bd2834b010 | asdfsx/worker4aws | /aws_operator/dynamodb.py | UTF-8 | 3,697 | 2.59375 | 3 | [] | no_license | """
Functions used to operate dynamodb
"""
import types
def updateworker(client, current_time, worker_id, worker_status, worker_job):
"""update worker status
"""
client.update_item(
ExpressionAttributeNames={
"#ws": "Workerstatus",
"#wj": "Workerjob",
"#ut": "Up... | true |
183995bb6a83581aea2c5593359212e74034c1fc | yusheng88/PythonChallenge | /Challenge007.py | UTF-8 | 2,136 | 3.4375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
# @Time : 11:52
# @AUTHOR : yusheng
# @File : Challenge007.py
# @SoftWore : PyCharm
"""
http://www.pythonchallenge.com/pc/def/oxygen.html
https://www.hackingnote.com/en/python-challenge-solutions/level-7
https://docs.python.org/zh-cn/3.7/library/io.html
"""
# pillow 是 PIL 派生的库,所以要导入PIL中的Image
f... | true |
248bfa3db7a68908b37f238880f4de4f55b2d828 | ishiahirake/leetcode | /python/solutions/s0020_valid_parentheses.test.py | UTF-8 | 501 | 3.0625 | 3 | [] | no_license | import unittest
from s0020_valid_parentheses import Solution
solution = Solution()
class MyTestCase(unittest.TestCase):
def test_solution(self):
self.assertTrue(solution.isValid('()'))
self.assertTrue(solution.isValid('()[]{}'))
self.assertFalse(solution.isValid('(]'))
self.asse... | true |
d723d189daf2d545326466f0a98c8c6c373e25f3 | sunnychaudhari/greenarc_test | /Q3.py | UTF-8 | 456 | 4 | 4 | [] | no_license | def matrix_search(mat, n, input_x):
i = 0
j = n - 1
while ( i < n and j >= 0 ):
if (mat[i][j] == input_x ):
return str("Found at "+ str([i+1,j+1]))
if (mat[i][j] > input_x ):
j = j - 1
else:
i = i + 1
return "Element not found"
matrix = [ [10,20,30],
[16,26,35],
[27, 29, 37,... | true |
683678f2b69eb37fe53386015072eb6253720ea0 | Josef-Friedrich/audiorename | /audiorename/meta.py | UTF-8 | 21,385 | 2.515625 | 3 | [
"MIT"
] | permissive | """Extend the class ``MediaFile`` of the package ``phrydy``.
"""
import re
from typing import Any, Dict, List, Optional, Tuple
from phrydy import MediaFileExtended
from tmep import Functions
import audiorename.musicbrainz as musicbrainz
Diff = List[Tuple[str, Optional[str], Optional[str]]]
PerformerRaw = List[List[... | true |
83e48319d7274dce3954d582421d86e4fd04b004 | legend01/DeepLearningWithOpenCV | /Mobile_Document_Scanner/scan.py | UTF-8 | 2,735 | 2.765625 | 3 | [
"MIT"
] | permissive | '''
@Description: 制作一个文档文字扫描器
@version:
@Author: HLLI8
@Date: 2020-03-14 17:27:41
@LastEditors: HLLI8
@LastEditTime: 2020-03-16 17:32:37
'''
import sys
sys.path.append ("D:/ProgramFile/Anaconda/Lib/site-packages")
import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3' #只显示warning和Error
from outsideLibrary.transform impo... | true |
edf2760b531e7620188ee03aa5b8a56578c3efd0 | emrahnl/Odevler-hafta2 | /2.6.Not Hesaplama.py | UTF-8 | 660 | 2.796875 | 3 | [] | no_license | vize1 =int(input("1.vize notunuz: "))
vize2 =int(input("2.vize notunuz: "))
final =int(input("final notunuz: "))
yilsonu_notu=vize1*0.3 + vize2*0.3 + final*0.4
print("yil sonu notunuz:",yilsonu_notu)
if yilsonu_notu >= 90:
print("Notunuz: AA")
elif yilsonu_notu >=85:
print("Notunuz:BA")
elif yilsonu_notu >=... | true |
38152fe52e92b7d73732fdbe7a2674cee9a80606 | KevinPei777/show-me-the-code | /017/017.py | UTF-8 | 779 | 3.046875 | 3 | [] | no_license | from xml.etree import ElementTree as ET
import json
import xlrd
def read_execl(excel_name):
excel = xlrd.open_workbook(excel_name)
excel_sheet = excel.sheet_by_name('student')
data = {}
for i in range(excel_sheet.nrows):
data[(excel_sheet.row_values(i))[0]] = excel_sheet.row_values(i)[1:]
... | true |
eba97667ecf2240f5febf9b69687b3041e1d3b54 | angelluk/FinanceRead | /NormalDistrib.py | UTF-8 | 782 | 3.53125 | 4 | [] | no_license | import math
from matplotlib import pyplot as plt
def normal_pdf(x, mu = 0, sigma = 1 ):
'''
calculate x for normal distribution
'''
sqrt_two_pi = math.sqrt(2 * math.pi)
return (math.exp(-(x-mu) ** 2 / 2 / sigma ** 2 ) / (sqrt_two_pi * sigma))
# plot example of Normal Distributions
... | true |
450175f8acd76a442e9fb4bc8777d9c44dd2ce71 | JonkeDAB/GissaNummer | /GissaNummer.py | UTF-8 | 771 | 3.34375 | 3 | [] | no_license | import random, time
randomTal = random.randint(1,10)
spel = False
meny = False
datorPoäng = 0
spelarPoäng = 0
spel = 1
while spel == 1:
gissning = int(input("Gissa ett tal mellan 1-10: "))
if gissning == randomTal:
time.sleep(0.5)
exit(print("Du vann, fuck you"))
spelarPoäng = spelar... | true |
05b794931edc17ffbba17e253f935a7d37938460 | rwebster2012/Personal_Portfolio | /Python cheat sheets/unique_in_order_CW.py | UTF-8 | 882 | 3.125 | 3 | [] | no_license | #unique_in_order('AAAABBBCCDAABBB') == ['A', 'B', 'C', 'D', 'A', 'B']
#unique_in_order('ABBCcAD') == ['A', 'B', 'C', 'c', 'A', 'D']
#unique_in_order([1,2,2,3,3]) == [1,2,3]
def unique_in_order3(s):
output = ''
for i in range(len(s)):
if i == 0:
output = output + str(s[i])
... | true |
c64d4a09d622f0144acf50155c3dbd31058bc604 | manolasn/linear-algebra-methods | /P16MINDA.py | UTF-8 | 958 | 3.78125 | 4 | [] | no_license | """
Minimum degree algorithm
Cost(j) = (nzc(j)-1)(nzr(j)-1)
nzc(j) : number of nonzero elements in column j of `active' matrix
nzr(j) : number of nonzero elements in row j of `active' matrix
"""
# number of nonzero elements in column j of `active' matrix
def nzc(A, cn): # A is the matrix, cn is the column ... | true |
4361903fa364dbfd800d031fd7b936223decf0d3 | micaminoff/Project-Euler | /Problem 007.py | UTF-8 | 657 | 3.734375 | 4 | [] | no_license | # What is the 10 001st prime number?
# 7.5s
# O(n) but could be massively improved with spigot or sieve
import time
start_time = time.time()
primes = [2, 3, 5, 7, 11, 13]
i = 6
largest_prime = 17
def is_prime(test):
for prime in primes:
if test % prime == 0:
return False
else:
... | true |
f2548c82eeb8f8772ff904a5664946355a8ab046 | reihan35/inital_subpath_stream_isomorphism | /bfs_hamissi.py | UTF-8 | 1,439 | 3.375 | 3 | [] | no_license | from queue import Queue
def neighbours(node,E):
n = []
for i in range(0,len(E[node])):
if E[node][i]==1:
n.append(i)
return n
def bfs(gprim,start):
visited = []
for x in range(0,len(gprim)):
visited.append(0)
queue = []
all_paths = []
queue.append([start])
... | true |
3b7cfbfefdf5b48a0ca0cb55a349958603dc61ed | Nirperm/MachineLearning_Python | /NLP_programing/chapter1/model.py | UTF-8 | 379 | 2.9375 | 3 | [] | no_license | class Model:
def __init__(self, file_name):
self.file_name = file_name
self.word_dict = {}
def read_model(self):
with open(self.file_name, 'r', encoding='utf-8') as f:
for line in f:
split_line = line.split(' ')
prob = float(split_line[1])
... | true |
e0547a11b5d00c5dfc9edf43475ebc90f9b2dc87 | katiekloss/rta | /rta.py | UTF-8 | 2,610 | 2.578125 | 3 | [
"BSD-2-Clause"
] | permissive | #!/usr/bin/python2.7
import requests
import geopy
import geopy.distance
import time
import psycopg2
from datetime import datetime
from datetime import timedelta
routes_url = "http://www.nextconnect.riderta.com/Arrivals.aspx/getRoutes"
vehicles_url = "http://www.nextconnect.riderta.com/GoogleMap.aspx/getVehicles"
defau... | true |
ca663b9d63ab4dbf2f1eddbe7d7465dbf867fb14 | MrbioDT/Behaviour-Analysis-Codes | /Tailfitting vol.3/tailfitting_code.py | UTF-8 | 3,856 | 2.765625 | 3 | [] | no_license | # Modified by DT on 2019 June 24th
# most updated version of tailfitting code with following function
# 1. click the first_point close to the swim bladder
# 2. batch processing, can choose to display the tailfitting or not
# 3. scaling, change the image of video size in case the video are too large
# 4. save the p... | true |
a8f58fd8eedff3199389e4b3880e02ec383582f1 | JasonCYH/Tibame-class-quizzes | /20190822_pchome_shopping.py | UTF-8 | 1,163 | 2.828125 | 3 | [] | no_license | import sys
sys.path.append("C:\\Users\\su\\PycharmProjects\\demo.py\\venv\\Lib\\site-packages") # 因自己的電腦讀取modules有問題而設
import os
import requests
import json
import prettytable
a = input("關鍵字:")
os.system("cls")
website = requests.get(
"https://ecshweb.pchome.com.tw/search/v3.3/all/results?q="+a+"&page=1&sort=sale/dc",... | true |
1ead0fd513806bcfc5911ed6733e338ea6c7ffc7 | santhameena13/snapshot | /client.py | UTF-8 | 9,631 | 2.5625 | 3 | [] | no_license | import socket
from thread import *
import threading
import time
import json
import Queue
import traceback, random
import re
import logging
logging.basicConfig(level = logging.INFO)
send_channels = {}
recv_channels = []
message_queue = Queue.Queue()
lock=threading.Lock()
message_queue_lock = threading.Lock()
class Sn... | true |
07f0a9ad8b7a60faafac36e8645fc114866a5b52 | thijsBoet/courses | /python/functions.py | UTF-8 | 586 | 4.1875 | 4 | [] | no_license | def triangle_area(base, height):
area = (1.0 / 2) * base * height
return area
a1 = triangle_area(23, 25)
print(a1)
a2 = triangle_area(14, 2)
print(a2)
def fahrenheit2celsius(fahrenheit):
celsius = (5.0 / 9.0) * (fahrenheit - 32)
return celsius
c1 = fahrenheit2celsius(32)
c2 = fahrenheit2celsius(212)
print(c1... | true |
d44fd1a79e41281e8c6e55db0fea841ef8594005 | Hybrid-Skills/Codeforces | /Educational Codeforces Round 70/B. Decimal String.py | UTF-8 | 225 | 2.75 | 3 | [] | no_license | s = list(map(int,input().split()))
a = [[[1] for _ in range(10)] for _ in range(10)]
def call(i,j,c1,c2):
if c1 > c2:
x = c1 - c2 - 10
y = c1 - c2
else:
x = c2 - c1
y = c2 - c1 - 10
| true |
8370dda935b4ff415ae565b85eb952747be59d66 | sfatgc/appoptics_palyground | /submit.py | UTF-8 | 2,968 | 2.609375 | 3 | [] | no_license | #!/usr/bin/env python3
import argparse
import sys
import appoptics_metrics
import lib.config
import lib.data
import lib.charts
ctx = {
'data': None,
'charts': None
}
oArgParser = argparse.ArgumentParser(description="Setup AppOptics dashboard, charts, and submit probes data.")
oArgParser.add_argument("api_token", ... | true |
a5e425c9899354c5fa66e99ad57c3900dd53a5e0 | SunnyMaximo/micropython-watson-iot | /example/quickstart.py | UTF-8 | 632 | 2.90625 | 3 | [
"Apache-2.0"
] | permissive | """
This example shows how a device can publish an event using Quickstart.
Get a device ID from https://quickstart.internetofthings.ibmcloud.com
"""
from watson_iot import Device
import utime as time
# options can be loaded from watson_iot.json by omitting parameters.
# see watson_iot.example.json for example
device... | true |
567946a89736b39db98d1f0d0ee51f8c8f40bae6 | Dawyer/Code | /problems/LeetCode/20210428Day15-LeetCode633. 平方数之和.py | UTF-8 | 841 | 4.09375 | 4 | [] | no_license | # 第15天
#
# 给定一个非负整数 c ,你要判断是否存在两个整数 a 和 b,使得 a2 + b2 = c 。
import math
# 方法一,用b*b = c - a*a,判断b是否是平方数
# 数字的开方可以用1.pow(c,0.5);2.math.sqrt(c)
def judgeSquareSum(c: int) -> bool:
if c == 0:
return True
for a in range(int(math.sqrt(c) + 1)):
b = c - a * a
if (int(math.sqrt(b)) ** 2) == b:
... | true |
afe507f65326b5e19c0cc8692973a1e79b17473b | kaiqinhuang/Python_hw | /movies.py | UTF-8 | 548 | 4.875 | 5 | [] | no_license | """
movies.py
Name: Kaiqin Huang
Date: 1/9/17
Print the titles and years of three movies in a list.
Inputs: a list of three movies including their titles and years
Effects: use a for loop to iterate over every movie and print out the title of the movie and the year it cam... | true |
46454719cf43f103c6971a247fe281d53ac64426 | RKJO/Classes-and-Objects | /exercise_1.1_ShoppingCard.py | UTF-8 | 1,644 | 4.0625 | 4 | [] | no_license | from exercise_1_Product import Product
class ShoppingCart:
def __init__(self):
self.products = {}
def __str__(self):
desc = 'Zawartość koszyka:\n'
for k, v in self.products.items():
desc += '%s %s\n' % (k, v)
return desc
def add_product(self, new_product):
... | true |
8e3bb34cad48186ff46704a9ad79528ee2ccd202 | stefanpie/advent-of-code-2020 | /day-18/solution.py | UTF-8 | 2,656 | 4.15625 | 4 | [] | no_license |
class Stack:
def __init__(self):
self.items = []
def isEmpty(self):
return self.items == []
def push(self, item):
self.items.append(item)
def pop(self):
return self.items.pop()
def peek(self):
return self.items[len(self.items) - 1]
def size(self):
... | true |
7afac2624be1d7b136a284693d941fd7ff4602f5 | FedeMatt/Algorithms-for-bioinformatics | /problems_week3/Problem_16.py | UTF-8 | 174 | 2.828125 | 3 | [] | no_license | def ReconstructStringFromGenomePath(text):
list_ = text.split("\n")
output = list_[0]
for word in list_[1:]:
output = output + word[-1]
return output
| true |
c0ed0b4877bcff4d700b71195b879bf5b4290cb3 | glyph/brytly | /brytly/phantestic.py | UTF-8 | 4,917 | 2.703125 | 3 | [
"MIT"
] | permissive |
from deferred import maybeDeferred, Deferred, Failure
class TestFailure(Exception):
"""
A test failed.
"""
class SuiteRun(object):
counter = 0
def __init__(self, suiteID, caseIterator, result):
SuiteRun.counter += 1
self.instanceNumber = SuiteRun.counter
self.suiteID = su... | true |