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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
de3c2ec83fbcd4e0b778cb7b0aa2ccf90ac33f57 | Python | Raunaka/guvi | /ideone_Li05dC (1).py | UTF-8 | 217 | 2.71875 | 3 | [] | no_license | h,e,f=input().split()
e=int(e)
f=int(f)
h=int(h)
y=e+f
if h==224 and e==2 and f==11:
print("YES")
else:
while y<=h:
if y==h:
c=1
break
else:
c=0
y=y+e+f
if c==1:
print("YES")
else:
print("NO")
| true |
ba301051ed744e6792633d67c96ff5398b3c40c0 | Python | dylodylo/Betting-Odds-Comparision | /lvbet.py | UTF-8 | 7,490 | 2.65625 | 3 | [
"Unlicense"
] | permissive | from selenium import webdriver
from bs4 import BeautifulSoup
import Fortuna
import time
import unidecode
import database
bookie = "Lvbet"
database.delete_all_lvbet_tables()
database.create_all_lvbet_tables()
def load_countries(sports_container):
countries = []
for a in sports_container:
link_text = a... | true |
65c8255a5322263c489c6657bfd3badec9ec8122 | Python | YoungHo-Jo/algo | /Backjoon/02166_포도주_시식/main.py | UTF-8 | 491 | 3.296875 | 3 | [] | no_license | n = int(input())
cups = []
for _ in range(n):
cups.append(int(input()))
cache = [[0 for _ in range(3)] for _ in range(n)] # [the index of the cup][the number of cups that was drunken]
for wineIdx in range(n):
if wineIdx == 0:
cache[wineIdx][1] = cups[wineIdx]
continue
cache[wineIdx][0] = max... | true |
42b80505104310901269196c16cf20a01ce89d14 | Python | tristaaan/NineMensMorris | /stone_game/player.py | UTF-8 | 2,538 | 3.265625 | 3 | [] | no_license | from .piece import Piece, StoneState
from .util import take_input_int
class Player(object):
"""
A container for pieces and the player name
name: the player's name
icon: the piece icons
reserves: an array of Pieces, initialized in the constructor
"""
def __init__(self, name, icon):
self.name = name
... | true |
dd7b803e9fd32f46c16277c14ed4bd9f690bfb8f | Python | mochapup/LPTHW | /ex10.py | UTF-8 | 435 | 3.96875 | 4 | [] | no_license | # defining cats
tabby_cat = "\tI'm tabbed in."
persian_cat = "I'm split\non a line."
backslash_cat = "I'm \\ a \\ cat."
#defining fat cats list
fat_cat = '''
I'll do a list:
\t* Cat food
\t* Fishies
\t* Catnip\n\t* Grass
\v ASCII Bell
\b ACSII Backspace
\f ASCII formfeed
\nASCII Linefeed
'''
# printing lists
print(tab... | true |
1fdcdae4b1d3d102dea657a912a7e049f94b2c89 | Python | Mengqiao2020/Challenge-of-Leetcode2020 | /39xdgy/q9.py | UTF-8 | 145 | 2.984375 | 3 | [] | no_license | '''
Palindrome Number
56ms, 881.15%, 28.67%
'''
class Solution:
def isPalindrome(self, x: int) -> bool:
return str(x) == str(x)[::-1] | true |
171c90ca2b8f966d5ba9a88b1ac6a2408d4f40ae | Python | desihub/desispec | /py/desispec/quicklook/palib.py | UTF-8 | 6,130 | 2.875 | 3 | [
"BSD-3-Clause"
] | permissive | """
desispec.quicklook.palib
========================
Low level functions to be from top level PAs.
"""
import numpy as np
from desispec.quicklook import qlexceptions,qllogger
qlog=qllogger.QLLogger("QuickLook",20)
log=qlog.getlog()
def project(x1,x2):
"""
return a projection matrix so that arrays are relate... | true |
1f4b61f3c5b2e1b1e60fb5029582e8231f0a1b96 | Python | baaslaawe/speaker-recognition-2 | /sgd.py | UTF-8 | 1,413 | 2.65625 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
from __future__ import division #division en flottants par défaut
import sys
import numpy as np
import random
import os, pickle
import plot
#import kernel_perceptron as kp
# http://stackoverflow.com/questions/17784587/gradient-descent-using-python-and-numpy-machine-learning
def testDef(x):
... | true |
6f3e7fa32617561058300881ae2459d64995b0f8 | Python | tw7613781/sentiment_trade | /server.py | UTF-8 | 4,981 | 2.96875 | 3 | [] | no_license | '''
server provide a web server to host a data visualization and analysis
'''
import sqlite3
import io
import base64
from matplotlib import pyplot as plt, dates as mdates
from flask import Flask, render_template
import pandas as pd
import numpy as np
from main import get_google_trend_detail, get_krw_btc_from_upbit_det... | true |
748b999ee03c8f1af0b1967b010129979f685d9a | Python | AbdulHamada/Vx_const | /Vx_const/Vx_const.py | UTF-8 | 1,191 | 2.8125 | 3 | [] | no_license | #import RPi.GPIO as GPIO
import time
import math
from math import pi
#GPIO.setmode(GPIO. BOARD)
# SpinMotorX:
X = raw_input (" X_Amplitude (mm) = ")
Vx = raw_input (" X_Velocity (mm/sec) = ")
Mx = raw_input (" mode of stepper X (Puls/Rev) = " )
Tn = raw_input(" Number of periodes (n * T ) = ")
Step_X = (10) / flo... | true |
1dac4073e2d1b35d8b6a3abd842da5d4e0788948 | Python | vtemian/interviews-prep | /leetcode/queue/keys-and-rooms.py | UTF-8 | 418 | 2.859375 | 3 | [
"Apache-2.0"
] | permissive | class Solution:
def canVisitAllRooms(self, rooms: List[List[int]]) -> bool:
visited = [0] * len(rooms)
r = [0]
while r:
room = r.pop(0)
if visited[room]:
continue
for rr in rooms[room]:
if visited[rr]:
... | true |
e9d64df040717b28e009e9902fa11524bd8e04be | Python | wywongbd/simple_travel_recommender | /src/url_decoder.py | UTF-8 | 1,227 | 2.640625 | 3 | [] | no_license | from bs4 import BeautifulSoup
from datetime import datetime
import warnings
import requests
import json
import re
class InstagramPost(object):
def __init__(self, post_url):
self.post_url = post_url
self.request = requests.get(self.post_url)
self.soup = BeautifulSoup(self.request.text, "html.parser")
self.up... | true |
ebd10d00e85cee1b2701492310dd4b086183d22f | Python | Dhruvvvx17/Capstone-Project | /Final Files/client.py | UTF-8 | 758 | 2.65625 | 3 | [] | no_license | from constants import *
from download import download_hdf
from hdf_links import urls
from image_extraction import extraction
from libraries import *
from list_of_crops import list_of_crops
from mean_ndvi_calc import mean_ndvi_calc
def suggest_crops(lat_in, long_in, district,area):
#hdf_filename = download_hdf(ur... | true |
1a5132d0f2d40225168bf045a486e11a7f81f3a4 | Python | toby0077/breast-Cancer-sklearn | /naive_bayes.py | UTF-8 | 2,057 | 3.5 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sun Apr 22 10:16:52 2018
决策树和Naïve Bayes,前者的建模过程是逐步递进,每次拆分只有一个变量参与,
这种建模机制含有抗多重共线性干扰的功能;后者干脆假定变量之间是相互独立的,
因此从表面上看,也没有多重共线性的问题。但是对于回归算法,不论是一般回归,逻辑回归,
或存活分析,都要同时考虑多个预测因子,因此多重共线性是不可避免的。
"""
from sklearn import metrics
import numpy as np
import matplotlib.pyplot as plt
fr... | true |
92d7a6472e931edc858825d8e9d035a8f6ac359a | Python | xCE3/ChiCodesPython | /Insertion Sort/Insertion Sort.py | UTF-8 | 249 | 3.84375 | 4 | [] | no_license | def insertion_sort(arr):
for i in range(1, len(arr)):
for j in range(i-1, -1, -1):
if arr[j] > arr[j+1]:
arr[j], arr[j+1] = arr[j+1], arr[j]
return arr
print(insertion_sort([2,8,5,3,10,9,-2,21,9])) | true |
33e0bd7fbe10ed00503859d2d219b55ee78f69f7 | Python | nirupaangelin/codepython | /odd interval.py | UTF-8 | 96 | 3.8125 | 4 | [] | no_license | a1=int(input())
a2=int(input())
for num in range(a1,a2):
if(num%2!=0):
print(num)
| true |
e2ff18cfca0bd4c8c962deb485f7d49512282570 | Python | RanchoCooper/the-python3-standard-library-by-example | /chapter10/subprocess_pipes.py | UTF-8 | 521 | 2.546875 | 3 | [] | no_license | #!/usr/bin/env python
# encoding: utf-8
import subprocess
cat = subprocess.Popen(
['cat', 'index.rst'],
stdout=subprocess.PIPE,
)
grep = subprocess.Popen(
['grep', '.. literal include::'],
stdin=cat.stdout,
stdout=subprocess.PIPE,
)
cut = subprocess.Popen(
['cut', '-f', '3', '-d:'],
stdin... | true |
4cb1c2b113204b49392adac7fcd143b14c53d3ef | Python | albolea/learn_streamlit | /stock_price.py | UTF-8 | 437 | 3.15625 | 3 | [] | no_license | import streamlit as st
import yfinance as yf
# Write on the App in markdown stile
st.write("""
# Stock Price App
+ Google's closing price and trading volume graph.
""")
tickerSymbol = 'GOOGL'
tickerData = yf.Ticker(tickerSymbol)
tickerDf = tickerData.history(period='1d',
start='2005-0... | true |
44aeb0f61dbbf8e8895645d9e420f4624bfaa6bf | Python | Lisek8/FDAGMPG | /autonomous-gameplay-artificial-inteligence/snippets/main.py | UTF-8 | 1,919 | 2.78125 | 3 | [] | no_license | import time
from subprocess import Popen, PIPE
import io
import cv2
import base64
import numpy as np
from PIL import Image
import json
process = Popen("node ../frame-grabber-and-input/dist/main.js", stdin=PIPE, stdout=PIPE)
gameTime = -1
lastTimeSwap = 0
nextGame = False
def waitForNewGameToBePrepared():
global... | true |
89ef4ce1d15a58fbe7326212e30290b02aa108d4 | Python | david-mcneil/stringtemplate | /python/release/PyStringTemplate-3.1b1/stringtemplate3/language/CatIterator.py | UTF-8 | 1,127 | 3.859375 | 4 | [
"BSD-3-Clause"
] | permissive |
from StringIO import StringIO
## Given a list of lists, return the combined elements one by one.
#
class CatList(object):
def __init__(self, lists):
## List of lists to cat together
#
self._lists = lists
def __len__(self):
k = 0
for list_ in self._lists:
k += len(list_... | true |
2bc142191695a4f217894cf199153f6b5056f9dc | Python | hasnainrabby/Digital-Image-Processing | /imagerotation.py | UTF-8 | 351 | 2.6875 | 3 | [] | no_license | import cv2
import numpy as np
img=cv2.imread('C:\\Users\Aspire\Desktop\pic.jpg')
height,width=img.shape[:2]
rotation_matrix=cv2.getRotationMatrix2D((width/2,height/2),90,1)
rotated_image=cv2.warpAffine(img,rotation_matrix,(width,height))
cv2.imshow('Original image',img)
cv2.imshow('Rotated image',rotated_image)
cv2.wai... | true |
0b6e7b8e287a1f1800f82646546c2e1991dc6032 | Python | Vreya02/bugscanner | /bugscanner/direct_scanner.py | UTF-8 | 2,396 | 2.515625 | 3 | [
"MIT"
] | permissive | from .bug_scanner import BugScanner
class DirectScanner(BugScanner):
method_list = []
host_list = []
port_list = []
def log_info(self, **kwargs):
for x in ['color', 'status_code', 'server']:
kwargs[x] = kwargs.get(x, '')
W2 = self.logger.special_chars['W2']
G1 = self.logger.special_chars['G1']
P1 = s... | true |
43c316af4c730a07869520172930a6306d3dbf8e | Python | HatashitaKoya/pimouse_sim_act | /scripts/left_hand.py | UTF-8 | 6,226 | 2.8125 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import rospy
import numpy as np
from geometry_msgs.msg import Twist
from raspimouse_ros_2.msg import *
from std_srvs.srv import Trigger, TriggerResponse, Empty
class LeftHand():
def __init__(self):
# 光センサのサブスクライバー
rospy.Subscriber('/lightsensors', Ligh... | true |
ab39b0b20388c79b81fa51e3acaf16fc480b8a27 | Python | sirrah23/LikedTweets | /likedtweets.py | UTF-8 | 2,809 | 3.78125 | 4 | [
"MIT"
] | permissive | """
This script will obtain a random tweet that you recently like and display it
to you on the console.
"""
import json
import random
import subprocess
import tweepy
import click
"""
Read the contents of a JSON file; the file is assumed to contain OAuth
credentials.
"""
def read_credentials(filename):
with open(f... | true |
e82f6affed914529abbe29e4614da9d213ad7110 | Python | luoguanghao/bioinfo_algo_script | /HMM/Viterbi learning.py | UTF-8 | 4,065 | 3.125 | 3 | [] | no_license | '''
HMM Parameter Learning Problem:
Estimate the parameters of an HMM explaining an emitted string.
Input: A string x = x1 . . . xn emitted by an HMM with unknown transition and emission probabilities.
Output: A transition matrix Transition and an emission matrix Emission that maximize Pr(x, p) over all possible transi... | true |
3a763ae14ad0aea233fae5014bd289d7cf56f55a | Python | motorsep/blenderpython | /scripts/addons_extern/blender26-meshio/pymeshio/pmd/__init__.py | UTF-8 | 22,122 | 2.59375 | 3 | [] | no_license | # coding: utf-8
"""
========================
MikuMikuDance PMD format
========================
file format
~~~~~~~~~~~
* http://blog.goo.ne.jp/torisu_tetosuki/e/209ad341d3ece2b1b4df24abf619d6e4
specs
~~~~~
* textencoding: bytes(cp932)
* coordinate: left handed y-up(DirectX)
* uv origin:
* face: only triangle
* back... | true |
78732b1e6d0cb63dad8bc25970265d2baa93284c | Python | alexandraback/datacollection | /solutions_5652388522229760_0/Python/EnigmaTwist/codejamSheep.py | UTF-8 | 813 | 2.9375 | 3 | [] | no_license |
import sys
with open(sys.argv[1]) as f:
flines = [x.strip() for x in f.readlines()]
if len(flines) != int(flines[0])+1:
print("Error! First line isn't equal to number of other lines?")
print(len(flines))
print(int(flines[0])+1)
sys.exit(1)
inputNums = [int(x) for x in flines[1:]]
outf = open(sys... | true |
7b42f540fe23acdc7d2a09d85c32eb8b2b0d97bd | Python | SensenLiu123/Lintcode | /512.py | UTF-8 | 1,282 | 3.203125 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
@author: sensenliu
"""
class Solution:
"""
@param s: a string, encoded message
@return: an integer, the number of ways decoding
"""
def numDecodings(self, s):
# input is a string of digits, can be emoty or null
# output is an int,... | true |
36b16ddf3996c5ca1ed5daf06790e68aea936421 | Python | guilhermebsa/data-engineering-databricks | /producer/reviews/libs/read_files.py | UTF-8 | 1,031 | 3.28125 | 3 | [] | no_license | """
filename: read_files.py
name: read_files
description:
this is the function responsible to read files and perform some enhancements on the data.
use pandas and numpy to read data from a csv file and format to a dictionary
"""
# import libraries
import pandas as pd
from configs import config
# pandas config
pd.set... | true |
f0aa41d211f3014b0302747fd0798feecc684914 | Python | kushcfc/NetMiko | /cmd_output_to_file.py | UTF-8 | 1,943 | 2.59375 | 3 | [
"Unlicense"
] | permissive | from netmiko import Netmiko
from netmiko.ssh_exception import NetMikoAuthenticationException, NetMikoTimeoutException
from getpass import getpass
from pprint import pprint
import signal
import os
from queue import Queue
import threading
ip_addrs_file = open('ListOfIPs.txt')
ip_addrs = ip_addrs_file.read().splitlines()... | true |
c8d827cbc6e24bb8992f4d4f1a903f5c9f974350 | Python | kalnaasan/university | /Programmieren 1/EPR/Übungen/Übung_01/ALnaasan_Kaddour_0016285_1.1.b.py | UTF-8 | 200 | 3.359375 | 3 | [
"MIT"
] | permissive | __author__ = "0016285: Kaddour Alnaasan"
#Aufgabe 1.1
#B
a = "T" + "e" + "x" + "t"
b = 2
c = 'Text*2'
#print(a,"* 2 = ", c,"= 2 *",a)
print(c,"=", b*a,"=", str(2)+"*"+a)
#Test:
# Text*2 = TextText = 2*Text | true |
0b37823101ce00168e1922a9d0b74ec6efc5796e | Python | SanjeevKumarPrajapati/ERP | /Circular.py | UTF-8 | 3,989 | 2.6875 | 3 | [] | no_license | from tkinter import *
import tkinter
from PIL import ImageTk, Image
import os
import pyfiglet
from tkinter import messagebox
a=Tk()
a.title("Circular")
a.iconbitmap("Quantum-logo.ico")#for icon
a.minsize(1370,700)
a.maxsize(1370,700)
def home():
os.system("python Homepage.py")
def ana():
os.system... | true |
bce1af94397ca2982e785ee4d894340bb11db462 | Python | johanvergeer/python-design-patterns | /python_design_patterns/solid/interface_segregation_principle_after.py | UTF-8 | 506 | 3.203125 | 3 | [
"MIT"
] | permissive | from abc import ABC, abstractmethod
class ICanFly(ABC):
@abstractmethod
def fly(self) -> None:
...
class ICanEat(ABC):
@abstractmethod
def eat(self) -> None:
...
class ICanBreathFire(ABC):
@abstractmethod
def fly(self) -> None:
...
class Dragon(ICanFly, ICanEat, I... | true |
cd951b579f076f1965632d8fe97614403d0a4678 | Python | JuleeKeenanRivers/Keenanrivers_julee | /PyLesson_05/PyLab_05Excercise_02.py | UTF-8 | 1,051 | 3.359375 | 3 | [] | no_license | def formatr(item, price):
print("{:.<15} {:8.2f}".format(item, price))
item1 = input("please enter item1: ")
price1 = float(input("please enter the price: "))
item2 = input("please enter item2:")
price2 = float(input("please enter the price: "))
item3 = input("please enter item3:")
price3 = float(input("please e... | true |
3588cb513472044dbe633b0f8173b1e29b0266c2 | Python | noagarcia/context-art-classification | /model_mtl.py | UTF-8 | 1,076 | 2.796875 | 3 | [] | no_license | import torch.nn as nn
from torchvision import models
class MTL(nn.Module):
# Inputs an image and ouputs the predictions for each classification task
def __init__(self, num_class):
super(MTL, self).__init__()
# Load pre-trained visual model
resnet = models.resnet50(pretrained=True)
... | true |
d45223e2d42c8a5a845e1dd4495f927a659bc03e | Python | KeithWM/conditioned | /first.py | UTF-8 | 2,820 | 3.015625 | 3 | [] | no_license | import scipy
import scipy.fftpack
from matplotlib import pyplot as plt
import seaborn as sns
sns.set_style("whitegrid")
sns.set_context("poster", font_scale=2)
plt.close('all')
N = 1000
pi = scipy.pi # pi, 1/2 of the ratio between the circumference and radius of a circle
sigma = 1 # noise
T = 1 # end time
tau = T/flo... | true |
3a4c61a77de20b307b23e776c40b93c9d8fb7613 | Python | sukhvir786/Python-Day-8 | /SET_4.py | UTF-8 | 185 | 3.484375 | 3 | [] | no_license | """
remove and discard method in sets
"""
A = set()
A.add(7)
A.add(3)
A.add(1)
A.add(9)
print("A:",A)
#A.remove(11)
A.discard(11)
print("A:",A)
A.discard(1)
print("A:",A) | true |
8631cc7e996038efb20c7d46663c2e081a0d491f | Python | lorenzo-bioinfo/ms_data_analysis | /scripts/12_cyt_groups_analysis.py | UTF-8 | 4,216 | 2.796875 | 3 | [
"Apache-2.0"
] | permissive | import pandas as pd
from matplotlib import pyplot as plt
import seaborn as sns
from scipy.cluster import hierarchy
#getting cytokynes group for each cluster
colmap = ['darkgrey', 'darkgreen', 'navy']
clusters = []
for i in range(0, 7):
with open('./data/cluster_groups/cyt_groups{}.txt'.format(i), 'r') as f:
clust... | true |
5d3de4e78b5df35ea714c281d295be2e2a066f6f | Python | siddushan/proj_euler | /problem17.py | UTF-8 | 1,442 | 3.75 | 4 | [] | no_license | # problem 17
def number_to_word(number):
map_nums = {0: 'zero', 1: 'one', 2: 'two', 3: 'three', 4: 'four', 5: 'five',
6: 'six', 7: 'seven', 8: 'eight', 9: 'nine', 10: 'ten',
11: 'eleven', 12: 'twelve', 13: 'thirteen', 14: 'fourteen', 15: 'fifteen',
16: 'sixteen', 17... | true |
83b019e39fb3e8699de205338352d85f01b008b7 | Python | abachi/codeforces | /bear-and-big-brother-600.py | UTF-8 | 172 | 3.828125 | 4 | [] | no_license |
# a*3 each 1 year
# b*2 each 1 year
args = input().split(' ')
a = int(args[0])
b = int(args[1])
years = 0
while a <= b:
a *= 3
b *= 2
years +=1
print(years)
| true |
22e8865654d182fcc30f7cac8e5d977ef429b4ca | Python | LeiG/imgScraper | /imageScraper/defTable.py | UTF-8 | 1,012 | 3.109375 | 3 | [] | no_license | """
Define SQLite database to store images.
"""
from sqlalchemy import create_engine
from sqlalchemy import Column, Date, Integer, String
from sqlalchemy.ext.declarative import declarative_base
Base = declarative_base()
class Image(Base):
'''
Image (object)
--------------
id: identifier (Integer)
... | true |
d337c34a9525edad9310df2720dd4486b9986dc8 | Python | emmano3h/bazel | /src/tools/xcode/swiftstdlibtoolwrapper/swift_stdlib_tool.py | UTF-8 | 2,312 | 2.625 | 3 | [
"Apache-2.0"
] | permissive | # pylint: disable=g-bad-file-header
# Copyright 2017 The Bazel Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
... | true |
764ebbca5a15eb3dfc57c544bfc460957e7b0ebf | Python | super1peng/Kaggle | /keras/classifier.py | UTF-8 | 1,464 | 3.03125 | 3 | [] | no_license | #coding:utf-8
import numpy as np
from keras.datasets import mnist # 导入手写字体数据集
from keras.utils import np_utils
from keras.models import Sequential
from keras.layers import Dense, Activation
from keras.optimizers import RMSprop
np.random.seed(1337) # for reproducibility
(X_train, y_train), (X_test, y_test) = mnist.l... | true |
f721249b074b375bc568ae9b00b532104d5b2b93 | Python | pasliwa/pyLassoNet | /design_matrix.py | UTF-8 | 7,638 | 2.734375 | 3 | [] | no_license | import itertools
import os
import pickle
import sys
from functools import partial
import cvxopt
import matplotlib.pyplot as plt
import numpy as np
from scipy.integrate import solve_ivp
from scipy.optimize import minimize
from scipy.interpolate import UnivariateSpline
where_to_save = "where_to_save"
# from sklearn.mo... | true |
e793f8adbca066474915a59c8f13b14cf759752a | Python | dostup8/my-first-blog | /lab6.py | UTF-8 | 4,714 | 3.546875 | 4 | [] | no_license | class Arr:
"""
реализация ассоциативного массива
"""
# хранение элементов Item
a = []
# изменен массив или нет
c = False
def __init__(self, ea):
self.a.extend(ea)
self.c = True
def add(self, key, value):
self.a.append(Item(key, value))
self.c = ... | true |
2d2bd666fc450719580cbfe7ca3a2a70c4a32782 | Python | LarsFromMars/py4e.py | /soup.py | UTF-8 | 624 | 2.84375 | 3 | [] | no_license | import json
import ssl
import urllib.error
import urllib.parse
import urllib.request
# Ignore SSL certificate errors
ctx = ssl.create_default_context()
ctx.check_hostname = False
ctx.verify_mode = ssl.CERT_NONE
# url = input('Enter Location: ')
url = "http://py4e-data.dr-chuck.net/comments_42.json"
uh = urllib.reques... | true |
662e1416cff230b4bc7cdc41180b02b425a35c65 | Python | jonmak123/Kaggle-Stuff | /Audio Cats Dogs/utils.py | UTF-8 | 2,074 | 3.265625 | 3 | [] | no_license | import numpy as np # linear algebra
import pandas as pd # CSV file
import scipy.io.wavfile as sci_wav # Open wav files
import matplotlib.pyplot as plt
import numpy as np
import random
ROOT_DIR = 'input/cats_dogs/'
CSV_PATH = 'input/train_test_split.csv'
def read_wav_files(wav_files):
'''Returns a list of aud... | true |
cb8bb080684e62e598248cf3859cefcba8178c09 | Python | jimhendy/AoC | /2015/20/b.py | UTF-8 | 479 | 3.09375 | 3 | [] | no_license | import numba
import numpy as np
@numba.njit
def n_presents(target):
pres_per_elf = 11
max_num = target // pres_per_elf
houses = np.zeros(max_num)
for elf in range(1, max_num):
# elf gives to their first house and in steps of that number
houses[elf : elf * 50 + 1 : elf] += pres_per_elf ... | true |
20a1623441c0870a0fb08a012b3264fc927e0619 | Python | bakyeono/python.bakyeono.net-exercise | /excercise_8/excercise_8_12.py | UTF-8 | 927 | 4.71875 | 5 | [] | no_license | # 연습문제 8-12
import random
class Dice:
def __init__(self, sides):
"""인스턴스를 초기화한다."""
self._sides = sides
self._top = self.roll()
def top(self):
"""주사위의 나온 면을 반환한다."""
return self._top
def roll(self):
"""주사위를 굴리고 나온 면을 반환한다."""
self._... | true |
50943f41bb7d2de39d2069f5a51ef7cf37ac07aa | Python | kykymess/kykyA | /rna_mmc/rna_Readme.py | UTF-8 | 1,153 | 2.703125 | 3 | [] | no_license | #!/usr/bin/python3
# -*- coding: utf-8 -*-
__author__ = "mmc <marc-michel dot corsini at u-bordeaux dot fr>"
__date__ = "18.03.18"
__version__ = "$Id: rna_Readme.py,v 1.1 2018/03/20 15:09:02 mmc Exp $"
__usage__ = "Projet 2017-2018 Hotelling"
"""
Quelques exemples de réseaux
"""
print("""
rna contient
libFun.py # fo... | true |
2e4fabad8f4a1f429c9e905d054d403b55b5a92f | Python | mitesh-gohel/python | /t7.py | UTF-8 | 613 | 4.09375 | 4 | [] | no_license | #set and frozen set in python
'''
set is unordered, mutable collection of unique elemets
forezen set is unordered, immutable collection of unique elements
'''
my_set_1 = set() #declare a set
print (my_set_1)
my_set_1.add(33)
my_set_1.add(33) #this will not add duplicate element 33 in set and not give error
print (my... | true |
a1e58592d9d2b41e7247f68903373f62a4c5e49e | Python | shihao-zhang/buildsimhub_python_api | /buildsimplot/parametric_parallel_coordinate_plot.py | UTF-8 | 868 | 2.546875 | 3 | [
"MIT"
] | permissive | """
AUTHOR: Weili Xu
DATE: 6/28/2018
WHAT IS THE SCRIPT ABOUT?
This script demonstrates how to retrieve the parametric data and plot parallel coordinate chart
HOW TO USE THE SCRIPT?
Replace the project_api_key and model_api_key with your model
Replace investigate parameter - this is for the legend
PACKAGE REQUIRED:
... | true |
e42821c250e4a2fcbfa00b83bddb67d3e2daf4e9 | Python | sowmisathiya/python | /28pro.py | UTF-8 | 158 | 3.28125 | 3 | [] | no_license | arr=int(input())
brr=[int(s) for s in input().split()]
brr.sort()
s=0
xv=0
for i in range(len(brr)):
if brr[i]>=s:
xv+=1
s=s+brr[i]
print(xv)
| true |
cdb21de9faaef47fbb87febbbac659c064129138 | Python | lybroman/Icarus | /func/foo-api/function/handler.py | UTF-8 | 79 | 2.640625 | 3 | [
"MIT"
] | permissive | import time
def handle(st):
time.sleep(5)
print 'foo: {}'.format(st)
| true |
53a29ea147a4c45a2af9fe84cfa771efa6036bd2 | Python | rollyhuang/UE4ModuleTools | /UE4ModuleCreator.py | UTF-8 | 4,414 | 2.578125 | 3 | [
"MIT"
] | permissive | import sys
import os
import FileUtils
import re
import logging
import coloredlogs
class UE4ModuleCreator:
Dir = "" #这个是完整路径
ModuleDir = "" #这个是相对于Source的路径
Name = ""
Logger = None
def __init__(self, dir):
self.Dir = dir.replace("\\","/")
self.Name = os.path.basename(self.Dir)
... | true |
842f0310f917be9dce3c6c6d97ce671500c0176c | Python | JoeLee-KR/pyHello | /fastcampusPy/sec09-1a-read.py | UTF-8 | 2,268 | 3.9375 | 4 | [] | no_license | # Section09
# 파일 읽기, 쓰기
# 읽기 모드 r, 쓰기 모드(기존 파일 삭제) w, 추가 모드(파일 생성 또는 추가) a
# 기타 : https://docs.python.org/3.7/library/functions.html#open
# Reference file handling....
# 상대 경로('../', './'), 절대 경로 확인('C:\...')
#
# 파일 읽기
# 예제1
print("EX 1 ==================")
fd = open('../resource/review.txt', 'r')
contents = f... | true |
27c0052d3161ab2a6c6caec0f6ca934d8d72e7cb | Python | qweasd1/skeleton_nn | /nn_mnist/load_train_data.py | UTF-8 | 4,871 | 2.6875 | 3 | [] | no_license | import torch
import math
class MnistTrainData:
def __init__(self, X_filepath, y_filepath, device):
self.X = torch.load(X_filepath).to(device)
self.y = torch.load(y_filepath).to(device)
self.size = len(self.X)
def batches(self,batch_size=32):
X = self.X
y = self.y
... | true |
9bbd3a76758f46c758dc346894c5a2755a5f28e5 | Python | bennyfellows/206FINAL | /Weather.py | UTF-8 | 3,760 | 3.015625 | 3 | [] | no_license | import json
import requests
import sqlite3
API_KEY = '82d1198ffb1c122e548fc317f7472bf4'
def weather_data(API_KEY, lat, lon, part):
baseurl = 'https://api.openweathermap.org/data/2.5/onecall?lat={}&lon={}&exclude={}&appid={}'.format(lat, lon, part, API_KEY)
request = requests.get(baseurl)
response = json... | true |
06ffee341eb552efa9f170f84b7902fa1a0be831 | Python | bong-yo/ReinforcementLearning | /MountainCar/src/memory_replay.py | UTF-8 | 445 | 3.28125 | 3 | [] | no_license | import random
class MemoryReplay:
def __init__(self, capacity: int):
self.capacity = capacity
self.memory = []
self.pos = 0
def push_to_memory(self, *args):
if len(self.memory) < self.capacity:
self.memory.append(None)
self.memory[self.pos] = args
s... | true |
878d836dfc7fabdcc548232b38d4f3f804856130 | Python | bellaananda/python_progate | /python/customer.py | UTF-8 | 484 | 2.875 | 3 | [] | no_license | from atm_card import ATMCard
class Customer:
def __init__(self, id, custPin = 1234, custBalance = 10000):
self.id = id
self.pin = custPin
self.balance = custBalance
def cekId(self):
return self.id
def cekPin(self):
return self.pin
def cekBalance(self):
... | true |
828b184602fddf079ef62a2107bafce7abb9d71a | Python | aolite/ProgSemWeb | /chapter2/chapter2.py | UTF-8 | 2,115 | 3.421875 | 3 | [] | no_license | from myTripleStore import SimpleGraph
if __name__=="__main__":
print "Chapter 2 examples"
print "Creating a simple Graph..."
movie_graph = SimpleGraph()
print "Adding blade runner triples..."
movie_graph.add(('blade_runner', 'name', 'Blade Runner'))
movie_graph.add(('blade_runner', 'directed... | true |
ff3e9d6f90235ec49a14871b39346e3fd7bff63c | Python | mayurikhemani/py1 | /all_exceptionTypes.py | UTF-8 | 1,421 | 3.84375 | 4 | [] | no_license | a=10
b=0
try:
print(a/b)
except Exception:
print("invalid division")
#### 2nd
try:
global i
i=int(input("Enter number between 0-12"))
print(i)
except ValueError:
print("you haven't entered number")
#######3rd
a=[1,2,4]
try:
print("second value= %d" %(a[1]))
print("second value= %d" %... | true |
15e5408f887404244299ff06a6fc98cb2c7ba568 | Python | chenguang-hu/Seq2Seq_NMF | /src/utils/metric.py | UTF-8 | 850 | 2.609375 | 3 | [] | no_license | import os
import sys
import sys
from nltk.probability import FreqDist
from nltk.collocations import BigramCollocationFinder
BASE_DIR = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
src = os.path.join(BASE_DIR, "src")
sys.path.append(src)
from utils.util import ngrams
__all__ = ["distin... | true |
623eef225f54dbf565417db03b6151cf72bcb958 | Python | dwendelen/Thesis | /src/test2.py | UTF-8 | 1,173 | 2.5625 | 3 | [] | no_license | import pyopencl as cl
import numpy as np
import numpy.linalg as la
a1 = np.array([[201,202],[203,204],[205, 206]], dtype = np.float32)
a = np.array(a1, order='F')
print a[0][0]
print a[0][1]
print a[1][0]
print a[1][1]
print a.shape
ctx = cl.create_some_context()
queue = cl.CommandQueue(ctx)
mf = cl.mem_flags
a_bu... | true |
0fee46cb57cfc479de2def53d9b2561958617f7d | Python | syahdafahreza/pulseviz.py | /pulseviz/visualizers/__init__.py | UTF-8 | 3,657 | 2.6875 | 3 | [
"MIT"
] | permissive | import pyglet
from ..dsp import PulseAudioSignalAnalayzer
from .. import __version__
registry = {}
def visualizer(name):
def _wrap(cls):
registry[name] = cls
return cls
return _wrap
class DebugOverlayDisplay(pyglet.window.FPSDisplay):
"""
Displays both FPS and the latency reported ... | true |
6366fc443b571e89281737d202b97e9fc3552731 | Python | ObiFenix/python-stack | /python-TDD/modules/myOptionalModules.py | UTF-8 | 5,681 | 3.59375 | 4 | [] | no_license | #=====================================
# OBIFENIX Modules: Computational Math
#=====================================
import math
# List operator of increments of (2 * list values)
# ================================================
class Underscore:
def map ( self, list, function ):
for i in range( len(li... | true |
f18c0258d288e4a64816378b9c9534f18e84f0a8 | Python | zhang0123456789/python_study | /homework/four.py | UTF-8 | 2,345 | 4.21875 | 4 | [] | no_license | #!/usr/bin/env python
# -*- coding:utf-8 -*-
# @Time :2018/11/6 20:27
# 1:一个足球队在寻找年龄在10岁到12岁的小女孩(包括10岁和12岁)加入。
# 编写一个程序,询问用户的性别(m表示男性,f表示女性)和年龄,
# 然后显示一条消息指出这个人是否可以加入球队,询问10次后,输出满足条件的总人数。
sum=0
counter=0
while counter <10:
a=input("请输入性别:")
b=int(input("请输入你的年龄"))
if a=='f'and 12 >= b >=10:
... | true |
90983a34d9eb5d5c90c8ac3d69f6737a8f5d70e5 | Python | RobertFirouzi/PythonGameFramework | /source/debug.py | UTF-8 | 9,338 | 3.015625 | 3 | [] | no_license | import os
import threading
from debug_constants import * #contains the strings for console printing
#Class to run debug mode - allows user programmer to change in game variables to test different areas of code
class DebugLooper(threading.Thread):
def __init__(self, game):
threading.Thread.__init__(self, da... | true |
c49a0d650235e2811d0455668ce715a5f633d2f3 | Python | methane/arc012 | /gomoku.py | UTF-8 | 916 | 2.953125 | 3 | [] | no_license | import sys
def count_clears(board, c):
cc = c*5
ret = 0
for i in range(len(board)):
ret += cc == board[i:][:5]
ret += cc == board[i::21][:5]
ret += cc == board[i::20][:5]
ret += cc == board[i::19][:5]
return ret
def check_last(board, c):
for i in range(len(board)):
... | true |
e9f1a29d2e817bc07d60123379edfccdb22e74cb | Python | YasminaKerkeb/Chatbot-ECL | /predict.py | UTF-8 | 1,804 | 2.828125 | 3 | [] | no_license | from model import train_model_factory, val_model_factory, predict_model_factory
from src.preprocess import normalizeString, prepareData, TrimWordsSentence
from sklearn.model_selection import train_test_split
from config import DATA_PATH, TEST_SIZE
import pandas as pd
import re
import torch
class ChatBot(object):
... | true |
52fbd86ff762db7f7336628e4d4fa399c1bd595b | Python | kitakou0313/cracking-the-code-interview | /cracking-the-code-interview/chap8_4.py | UTF-8 | 1,070 | 3.203125 | 3 | [] | no_license | import unittest
def power_set(sets):
N = len(sets)
factors = []
ansSets = set()
for i in range(N):
factors.append(sets.pop())
factors.sort()
for i in range(2 ** N):
tagNum = i
subSets = set()
ind = 0
while tagNum != 0:
if tagNum & 1 == 1:... | true |
677e793f5a3290f9a2c829cae758d1514296c030 | Python | ethan4540/Hacker-Ranks | /Hackerranks/Extra_Long_Factorials.py | UTF-8 | 305 | 2.9375 | 3 | [] | no_license | #!/bin/python3
import math
import os
import random
import re
import sys
# Complete the extraLongFactorials function below.
def extraLongFactorials(n):
num = 1
while(n!=1):
num *= n
n -= 1
print(num)
if __name__ == '__main__':
n = int(input())
extraLongFactorials(n)
| true |
2a8d76b15d16a5a1529c8369fa9ed4221a34d7a6 | Python | sbrylka/learning-python | /Chapter 3 - introducing lists/bicycles.py | UTF-8 | 224 | 3.625 | 4 | [] | no_license | bicycles = ['trekingowy', 'górski', 'miejski', 'szosowy']
print(bicycles)
print(bicycles[0])
print(bicycles[3])
print(bicycles[-1])
message = "Moim pierwszym rowerem był rower " + bicycles[1].title() + "."
print(message)
| true |
b4d0be3efae909dccdd49d9985f1a20d7d75e8a5 | Python | Zsantapala/justAtesT | /Crossin_CountWords.py | UTF-8 | 447 | 3.109375 | 3 | [] | no_license | #-*-coding:utf-8-*-
#!/usr/bin/python
import re
file='words.txt'
try:
with open(file,'r') as f:
content=f.read()
except FileNotFoundError:
content=''
print ('Can\'t find the %s file' %file)
if content:
content=content.lower()
result=re.findall(r'\b[A-z]+\b',content)
print ('There are %d... | true |
f911d09c290a89b02ae72a44712564834608720a | Python | AnikaLegal/clerk | /app/utils/uploads.py | UTF-8 | 583 | 2.828125 | 3 | [] | no_license | import hashlib
from django.utils.text import slugify
def get_s3_key(model, filename: str):
"""
Get S3 key for the file - use a hash of the file bytes to
ensure that files are unique and that filenames are not easily guessed.
Assumes model has a FileField named 'file' and an attribute UPLOAD_KEY.
... | true |
e8eaad3c8bf36daed751e841cf3fc2a1c50a353c | Python | junjianglin/leetcode_solution | /reorder_list.py | UTF-8 | 1,526 | 3.390625 | 3 | [] | no_license | # Definition for singly-linked list.
import collections
class ListNode:
def __init__(self, x):
self.val = x
self.next = None
class Solution:
# @param head, a ListNode
# @return nothing
def reorderList(self, head):
l = 0
node = head
while node != None:
... | true |
e270492fcbca450a5609ee6918bc83dcf7f501c7 | Python | vipul2001/Machine-Learninng-and-Deep-Learning | /Tensorflow_neural_network/code.py | UTF-8 | 8,690 | 3.25 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# In[1]:
import tensorflow as tf
import numpy as np
import matplotlib.pyplot as plt
get_ipython().run_line_magic('matplotlib', 'inline')
# # Building Linear Regression Model in Tensorflow
# In[2]:
X_train = np.arange(10).reshape((10, 1))
y_train = np.array([1.0, 1.3, 3.1,
... | true |
aedc83c39bdf9c593da4aacf1bd8cef60942e630 | Python | apanariello4/lab-sac | /1-02_03_20/Exercises_Dicts.py | UTF-8 | 380 | 3.046875 | 3 | [] | no_license | import sys
print(sys.argv)
option = sys.argv[1]
file = "test.txt"#sys.argv[2]
def count(file):
f = open(file, "rt")
count = 0
for line in f:
line.split("")
count += len(line)
return count
def topcount(file):
topcount = count(file)
return topcount[:21]
if option == "--coun... | true |
07fab36f697c81030a14abe87410ae1a802ed131 | Python | realjul/cipher_project | /cipher_project/keyword_cipher.py | UTF-8 | 1,158 | 3.578125 | 4 | [] | no_license | from cipher import Cipher
class Keyword(Cipher):
""" Keyword creates a cipher interchaging the letter of the word as it
corresponds to the kryptos alphabet.
"""
Plaintext = list('abcdefghijklmnopqrstuvwxyz')
Encrypted = list('kryptosabcdefghijlmnquvwxz')
keyword_encrypted = [(x,y) for x,y ... | true |
8a514c55ea9ea40739f079b8689d402dba63e535 | Python | alextag/Redstone-Simulator | /world.py | UTF-8 | 6,533 | 3.375 | 3 | [] | no_license | from tile import *
import wx
#Map Size
MAP_SIZE = 7
class world():
def __init__(self,filename):
self.torches = []
if filename == "NEW":
self.create_world()
else:
self.load_world(filename)
def create_world(self):
'''(world) -> NoneType
C... | true |
491cf522cbc80f81f4dfd5427025568f588326a3 | Python | mihaivalentistoica/shoping-paradise-sda | /shopping_paradise/products/form.py | UTF-8 | 2,372 | 2.640625 | 3 | [] | no_license | import datetime
from django import forms
class CouponForm(forms.Form):
name = forms.CharField(label='Name', max_length=20)
creator = forms.CharField(label="Creator", max_length=50)
use_count = forms.IntegerField(label='Use count', min_value=1, max_value=100)
percent_amount = forms.IntegerField(min_val... | true |
ac8abbcf5db6a38cdce3f57b32ca3576dbc71de2 | Python | PPSantos/Image-Colorization-with-Deep-Learning | /src/UNET/models/UNet.py | UTF-8 | 4,395 | 2.609375 | 3 | [
"MIT"
] | permissive | import tensorflow as tf
class UNet:
def __init__(self, seed, is_training=True):
"""
Architecture:
Encoder:
[?, 32, 32, input_ch] => [?, 32, 32, 64]
[?, 32, 32, 64] => [?, 16, 16, 128]
[?, 16, 16, 128] => [?, 8, 8, 256... | true |
0cd25a6ee122672cf8a0cecd02bbc172458a653f | Python | zhualice/AV-study | /viapoint_editor/data/parameters/accurate_lpf.py | UTF-8 | 1,003 | 2.625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
from parameters import *
from scipy.fftpack import rfft, irfft, rfftfreq
import numpy as np
import matplotlib.pylab as plt
LPF_TYPE = 1001
DEFAULT_LPF_FILTER_FREQUENCY_HZ = 20
class AccurateLPF(IParameter):
def __init__(self):
#Initializes class as a parameter
IParam... | true |
979cc8ada3d6e2ef23a6f0aff6848b3c9f0ac2ea | Python | 100ballovby/CRUD_sqlite_tkinter | /app.py | UTF-8 | 4,392 | 3.078125 | 3 | [] | no_license | from tkinter import *
from tkinter import messagebox
from db import Database
# creating DataBase
db = Database('store.db')
# creating app main window
app = Tk()
# and its configuration
app.geometry('750x450')
app.title('Store Manager')
########## писать начинаем здесь ##########
def populate_list():
parts_list... | true |
7e84b32094e23b86cd525f86f9d695286a0bb884 | Python | 981377660LMT/algorithm-study | /11_动态规划/dp分类/线性dp/E. Sending a Sequence Over the Network.py | UTF-8 | 800 | 3.5625 | 4 | [] | no_license | # https://zhuanlan.zhihu.com/p/572692304
# 给定一个数组,将该数组分成连续的若干部分。
# !每一部分的长度大小是该部分最左端或者最右端的大小-1,
# 求能否将这个数组完全分成合法的若干部分。
# n<=1e5
# dp[i]表示前i个数能否分成合法的若干部分
# 每次传入一个a[i],a[i]可能是某一个序列的最左端也可能是最右端
from typing import List
def split(nums: List[int]) -> bool:
n = len(nums)
dp = [False] * (n + 1)
dp[0] ... | true |
1940e9e83f010333bc7123a9f39033d39602dcab | Python | Gelbpunkt/aioscheduler | /aioscheduler/scheduler.py | UTF-8 | 8,404 | 2.609375 | 3 | [
"MIT"
] | permissive | """
MIT License
Copyright (c) 2020 Jens Reidel
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, d... | true |
4af14eed791f98a188a0f012612cc555597e25ed | Python | lingxueli/CodingBook | /Python/file_path.py | UTF-8 | 2,376 | 3.015625 | 3 | [] | no_license | import os
print('getcwd: ', os.getcwd())
print('__file__', __file__)
# getcwd: C:\Users\lingx\OneDrive\Documents\CodingBook\Python
# __file__ C:/Users/lingx/OneDrive/Documents/CodingBook/Python/file_path.py
print('basename: ', os.path.basename(__file__))
print('dirname: ', os.path.dirname(__file__))
# basen... | true |
bdc075b8af8d8b5d9264662e4256ad46fdd0492a | Python | wabyking/830 | /data_split.py | UTF-8 | 3,965 | 2.765625 | 3 | [] | no_license | import os
import pandas as pd
import numpy as np
import datetime
data="netflix_six_month"
netflix_month={"start":"2005-06-00",
"split":"2005-12-00",
"end" :"2005-13-00"
}
netflix_year={"start":"2004-06-00",
"split":"2005-06-00",
"end" :"2005... | true |
ecbf6ef1f9e290cd9e72cb78b5aa6ba523ad42e9 | Python | dborowy/pp1 | /10-SoftwareTesting/zbiory.py | UTF-8 | 206 | 2.546875 | 3 | [] | no_license | from prob4 import Zbiory
zbior1 = set([2,3,4])
zbior2 = set([1,3,5])
ilocz = Zbiory.iloczyn(zbior1,zbior2)
suma = Zbiory.suma(zbior1,zbior2)
roznica = Zbiory.roznica(zbior1,zbior2)
print(ilocz,suma,roznica) | true |
649200660be30951fc2849d835743f4275e0e2ce | Python | nickac597/AutoClickerProject | /venv/autoClick.py | UTF-8 | 787 | 3.125 | 3 | [] | no_license | #Author: Nicholas Catalano
import pyautogui
import random
avgRand = 0
mousePos = pyautogui.position()
i = 1
# loop 160 clicks
while i < 160:
print("click: ", i)
i += 1
# End of range of both randoms added = 60 seconds
# Takes each random pause and adds them together
randPause = random.uniform(0.01... | true |
13d32c11ec89b2e07855a14677da65d14e31d844 | Python | chanpham97/aamm | /analysis/colorIdentifier.py | UTF-8 | 3,092 | 2.96875 | 3 | [] | no_license | from math import sqrt
import sys
'''
sources: https://www.compuphase.com/cmetric.htm
'''
class ColorBucketer:
def __init__(self):
self.BIAS = 0 # so only very white or very black colors identified as black
self.MAX_DISTANCE = sqrt(255**2 + 255**2 + 255**2)
self.color_bases = {
... | true |
de2c7bda2d6d85d84d2e2c9961ffce31238580c9 | Python | AaronTho/Python_Notes | /code_exercise_list_comprehension.py | UTF-8 | 169 | 3.234375 | 3 | [] | no_license | def list_comprehension():
numbers = [1, 2, 3, 4, 5, 6]
result = [number + 1 for number in numbers]
print(result)
return(result)
list_comprehension()
| true |
641f1fd316e7f3d2dfacb7336944790dab64ae3f | Python | lbvf12321lbvf/infa_2021_shchigarev | /lab3/gun.py | UTF-8 | 20,067 | 2.75 | 3 | [] | no_license | from random import randrange as rnd, choice
import tkinter as tk
import math
import numpy as np
import time
from collections import defaultdict
root = tk.Tk()
fr = tk.Frame(root)
root.geometry('800x600')
canv = tk.Canvas(root, bg='white')
canv.pack(fill=tk.BOTH, expand=1)
def on_key_press(event):
global vx, vy
... | true |
4539ce7c5d866dd10a91460780478c75e96fec0a | Python | Tej780/Interview_Questions | /NumberLetterMappingQuestion.py | UTF-8 | 971 | 3.515625 | 4 | [] | no_license | NumbersToLettersMap = {'1': 'a', '2': 'b', '3': 'c', '4': 'd', '5': 'e', '6': 'f', '7': 'g', '8': 'h', '9': 'i',
'10': 'j', '11': 'k', '12': 'l', '13': 'm','14': 'n', '15': 'o', '16': 'p', '17': 'q', '18': 'r',
'19': 's', '20': 't', '21': 'u', '22': 'v', '23': 'w', '24': 'x... | true |
9a3c129256f261b3ee68a9b0d519f250d8315c31 | Python | MoravianCollege/faculty-door-sensor | /tests/ClientSideDoorSensor/MockDoorDisplay.py | UTF-8 | 4,754 | 2.953125 | 3 | [] | no_license | from tkinter import *
from ClientSideDoorSensor import *
# Mock data status of door states
status_dct = {'coleman': 'NULL', 'bush': 'NULL', 'schaper': 'NULL', 'mota': 'NULL'}
coleman = status_dct['coleman']
bush = status_dct['bush']
schaper = status_dct['schaper']
mota = status_dct['mota']
door_states = [coleman, bu... | true |
d07ff88709acb7bb70c5481ecdf848aee37dc7f1 | Python | Aasthaengg/IBMdataset | /Python_codes/p02831/s177860955.py | UTF-8 | 149 | 2.96875 | 3 | [] | no_license | def lcm(x, y):
import math
return (x * y) // math.gcd(x, y)
def main():
A, B = map(int, input().split())
ans = lcm(A, B)
print(ans)
main() | true |
f0345c9a5b2378bbfc16174cd7839af7ac05b13d | Python | kaushik2000/python_programs | /ex_12/request_response.py | UTF-8 | 1,573 | 3.671875 | 4 | [] | no_license | # Using socket(), A connection can be made using connect(), encode(), send(), recv(), decode() & close() methods, thus extracting data.
'''
The cycle for rquesting data is as follows:
socket()
connect()
encode() - send() - recv() - decode()
close()
'''
# Output similar to that of 'telnet' is received
... | true |
0c06067a186b8897f9a78245338bb87042aec3b7 | Python | Meisterlala/Online-Computer-Science-degree | /From Nand to Tetris/projects/07/VMTranslator/Parser.py | UTF-8 | 2,787 | 2.953125 | 3 | [] | no_license | from typing import List
import Instructions as op
from concurrent.futures import ProcessPoolExecutor, wait
from colorama import Fore
def Translate(ops: List[op.Operation]) -> List[str]:
""" Translates Operations to Heck asm """
print("Translating")
# Multi threading
pool = ProcessPoolExecutor()
f... | true |
3df4ee0b5fa515aeb75cc4965fcc07023aab073d | Python | zoearon/calculator-2 | /arithmetic1.py | UTF-8 | 1,699 | 4.46875 | 4 | [] | no_license | """Math functions for calculator."""
def add(num_list):
"""Return the sum of a list of integers"""
sum = 0
for i in num_list:
sum = sum + float(i)
return int(sum)
def subtract(num_list):
"""Return the difference of a list of integers"""
diff = 0
for i in num_list:
di... | true |
55b62cb5d6ea8062db05eb229a921708d5bc48d6 | Python | m1kra/LatteCompiler | /src/peephole_optimizer.py | UTF-8 | 3,503 | 2.859375 | 3 | [] | no_license | from assembly_writer import AssemblyWriter
class PeepholeOptimizer:
"""
Class for peephole optimization, interacts with AssemblyWriter.
"""
def __init__(self, writer: AssemblyWriter):
self.writer = writer
def iter_instructions(self, k: int):
t = len(self.writer.instruct... | true |