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 |
|---|---|---|---|---|---|---|---|---|---|---|
ced7dc2db4bd0cf1231406e237e0e2aba77140c7 | tothegump/obsolate | /obsolate/snap.py | UTF-8 | 4,173 | 2.703125 | 3 | [] | no_license | # -*- coding:utf8 -*-
import re
REQUEST_MAPPING = {
'GET': [],
'POST': [],
'PUT': [],
'DELETE': [],
}
HTTP_MAPPINGS = {
200: '200 OK',
201: '201 CREATED',
202: '202 ACCEPTED',
404: '404 NOT FOUND',
500: 'INTERNAL SERVER ERROR',
}
class NotFound(Exception):
pass
class Reques... | true |
3b5ae10d6824ae1e616d1cda6efd2a5e41f418d1 | creednaylor/publicProjects | /python/fundamentals/gui/tkinterTrial.py | UTF-8 | 182 | 3.09375 | 3 | [] | no_license | import tkinter
labelText = "Welcome"
windowObj = tkinter.Tk()
windowObj.title("Welcome!")
labelObj = tkinter.Label(windowObj, text=labelText)
labelObj.pack()
windowObj.mainloop()
| true |
8b8fd3e8c5612aa27a1154ce13ed57264c84f195 | BokyLiu/onnxexplorer | /onnxexplorer/onnxexplorer.py | UTF-8 | 3,634 | 2.671875 | 3 | [
"Apache-2.0"
] | permissive | """
This script provides
various exploration on onnx model
such as those operations:
- summary:
this command will summarize model info mation such as:
1. model opset version;
2. if check pass;
3. whether can be simplifiered or not;
4. inputs node and outputs node;
5. all nodes number;
6. I... | true |
2b5ea2068ac769b0c2b519b3a78d5bd810b932f6 | AnonymerNiklasistanonym/RaspiForBeginners | /scripts/gpio/e-Ink/custom_main_text.py | UTF-8 | 1,094 | 2.890625 | 3 | [
"MIT"
] | permissive | import epd1in54
import time
from PIL import Image, ImageDraw, ImageFont
from datetime import datetime
def main():
epd = epd1in54.EPD()
epd.init(epd.lut_full_update)
# For simplicity, the arguments are explicit numerical coordinates
# Clear the whole frame with the code 255
image = Image.new('1', (... | true |
18c13d53aeeacbc22bade3691550aa5e2aeeea72 | bereziat/PSTL-2017 | /pstl/org/common/stream.py | UTF-8 | 530 | 3.59375 | 4 | [] | no_license | class Stream():
def __init__(self, sequence):
self.sequences = sequence.splitlines()
self.totalLines = len(self.sequences)
self.lineNumber = 0
def peekNextLine(self):
return self.hasNext() and self.sequences[self.lineNumber] or None
def getNextLine(self):
if self.h... | true |
6e8202840670b6b891a04cacde0a27e7f414219a | ConyYang/WebApp_ProtocolThroughput | /CSMAProtocol/onePersistent.py | UTF-8 | 560 | 2.734375 | 3 | [] | no_license | '''
One Persistent ALoha:
'''
__author__ = 'Yang Yubei'
import math
a = 0.05
def oneP_CSMA(G):
"""
:param G: offered channel traffic rate
:return: S - throughput (utilization)
"""
S = []
for i in range(len(G)):
S.append(
(G[i] * (1 + G[i] + a * G[i] ... | true |
f381a7f3471b22801761b69e4c5c3786680a18b7 | seanjaffe1/fake_news | /hw2/utils/utils.py | UTF-8 | 3,968 | 3.03125 | 3 | [] | no_license | import os
import string
from tqdm import tqdm
import numpy as np
import json
from easydict import EasyDict
from pprint import pprint
# utilities for reading files and creating pre-trainied embedding matrices
# Used only once before all training experiments
class Vocab():
def __init__(self):
self.words = ... | true |
b145d64a8d92e31253f4c172b188691e1f2990f8 | khadkeshwarkp/fare-optimizer | /Regression_distvsprice.py | UTF-8 | 1,195 | 3.71875 | 4 | [
"BSD-3-Clause"
] | permissive | # Importing Necessary Libraries
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
plt.rcParams['figure.figsize'] = (20.0, 10.0)
# Reading Data
data = pd.read_csv('F:\ccd.csv')
print(data.price)
data.head()
# Collecting X and Y
X = data['distance'].values
Y = data['price']... | true |
21b71c2e50237fd1f655d2fe399c97c61c23e73d | yujiahuang/DM | /src/merge_data.py | UTF-8 | 768 | 2.8125 | 3 | [] | no_license | # python merge_data.py (1) output_path (2) -b (3) basis_data (4) -a (5) append_data
import sys
basis_data = None
append_data = None
output = open(sys.argv[1], 'w+')
if sys.argv[2] == '-b':
basis_data = open(sys.argv[3], 'r')
# copy lines in basis_data
for line in basis_data:
output.write(line)
basis_data.seek(0... | true |
8a2e1063a9979ab369cc51ec93351dee4be04490 | mckev/pyweb | /pyweb/engine/routing.py | UTF-8 | 3,555 | 3.015625 | 3 | [
"MIT"
] | permissive | import importlib
import os
import re
class Routing:
"""
URL Dispatch mechanism
Every .py files in "controller" directory and its sub-directory is accessible and can be called directly by client.
Note that only one routing object exists for all client connections!
"""
def __init__(self):
... | true |
1a6dccd650a0d25ce61383b31d58890caa844568 | ketch/optimized-erk-sd-rr | /optimal_rk_methods/erk.py | UTF-8 | 13,826 | 2.75 | 3 | [] | no_license | # python module erk
#
# Description:
#
# Module to extract the ERK 3S* coefficients from the textfiles, as python lists,
# which can be used to configure the ERK schemes implemented in coolfluid
#
#
# Usage:
#
# 1) as module to be imported
# import erk
# erk_coeffs = erk.parse(filepath)
#
# 2) standalone script to test... | true |
4b3b2eeb1051567d0fc2237de03c310493435ff5 | erengulum/plate-detection-cv2 | /hough-transform.py | UTF-8 | 6,428 | 2.890625 | 3 | [] | no_license | import cv2
import numpy as np
import math
from skimage.feature import peak_local_max
def getEdgedimage(image):
gray = cv2.cvtColor(image,cv2.COLOR_BGR2GRAY)
filtered = cv2.bilateralFilter(gray, 9, 75,75) # it is recommended to use d=9 for offline applications that need heavy noise filtering. For s... | true |
a342149014cbd9e6e5c8a10842195c6476c8b9d9 | cinegreg/vid_maker_CS | /libs.py | UTF-8 | 611 | 2.75 | 3 | [] | no_license | #!/usr/bin/python
import csv
import string
import sys
def splitCategoriesConnections( catconn ):
categories = []
connections = []
items = catconn.split(' ')
for i in items:
if i[:1] == '#':
categories.append(i)
elif i[:1] == '@':
connections.append(i)
else:
if i != "":
print >> sys.stderr, "... | true |
d77189243fa9b0497dafb4413c3c03de7eeda117 | elfiyang16/python-30-day-challenge | /command-line-tool/cli_fire.py | UTF-8 | 202 | 2.90625 | 3 | [] | no_license | import fire
def hellp(name="world"):
return f"Hellp {name}"
# python cli_fire.py # Hello World!
# python cli_fire.py --name=David # Hello David!
if __name__ == "__main__":
fire.Fire(hello)
| true |
536499ce7298c177ea6b7c9e8592787b440459e1 | mixflow/neural-style | /test.py | UTF-8 | 3,893 | 2.65625 | 3 | [
"MIT"
] | permissive | import unittest
from unittest.mock import Mock
from neuralstyle import load_image, restore_image, extract_features, content_loss, gram_matrix, style_loss
from PIL import Image
import torch, torchvision
from torchvision import transforms
from torch.autograd import Variable
import numpy as np
class TestImageMethods(u... | true |
ed8817ba2b6e1f94a0bff53209d56a64a821c073 | tridungle/Security | /CaesarCrypto.py | UTF-8 | 2,259 | 3.65625 | 4 | [] | no_license | #author TanThinh s3357678
import SpellCheckingEN
import Alphabet
#Use to create the cipher table based on how many number shifting
def cipher_table(number):
initial = 0
table_bottom = []
while initial < Alphabet.table_length:
index = initial + number
if index >= Alphabet.table_length:
... | true |
2e3792f9541a0a51ebf1cedb31b85ac8e39df82d | soldiers1989/trade-1 | /app/svc/tms/mds/smd/net/http.py | UTF-8 | 8,306 | 2.875 | 3 | [] | no_license | """
http request definition using <requests> module, define a http client using multi sessions, each
session with different remote hosts
"""
import threading, time, requests
# remote server error
class ServerError(Exception):
def __init__(self, err):
self._err = err
def __str__(self):
... | true |
c796c4a44697df5fcc1279ef499499de0ac6a9ce | jjp9624022/PageBot | /Lib/pagebot/contexts/svgcontext/svgbezierpath.py | UTF-8 | 3,725 | 2.96875 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
# -*- coding: UTF-8 -*-
# -----------------------------------------------------------------------------
#
# P A G E B O T
#
# Copyright (c) 2016+ Buro Petr van Blokland + Claudia Mens
# www.pagebot.io
# Licensed under MIT conditions
#
# Supporting DrawBot, www.drawbot.com
# ... | true |
4e6842d9f53c4758de4a8bdb5814dd3832d27866 | Zahidsqldba07/CodeSignal-26 | /Intro/Rains of Reason/028 - alphabeticShift.py | UTF-8 | 151 | 3.1875 | 3 | [] | no_license | def alphabeticShift(inputString):
res = ''
for c in list(inputString) :
res += chr(97) if ord(c)==122 else chr(ord(c)+1)
return "".join(res)
| true |
ca5261c9d0084d86798768354035e491d0cd22e3 | khamusa/spazi-unimi | /test/dxf_room_ids_resolver_test.py | UTF-8 | 7,296 | 2.546875 | 3 | [] | no_license | from model import Building
from tasks.mergers import DXFRoomIdsResolver
import unittest
class DXFRoomIdsResolverTest(unittest.TestCase):
"""
Test the room merging procedures of DXFRoomIdsResolver, i.e, the ability of
associating DXF rooms with other souces rooms.
"""
def setUp(self):
# Usa... | true |
d2c1124673a729d6cc62d823d1d82211ec26c4f7 | zmdsn/MANSP | /instances/gdb/graph_2_matrix_gdb.py | UTF-8 | 1,455 | 2.65625 | 3 | [
"MIT"
] | permissive | #!/usr/bin/python
import networkx as nx
file_name = "gdb24.dat"
f = open(file_name,'r')
read_data = 0;
G = nx.Graph()
n=0
if (f) :
for eachline in f:
fstr = eachline
containe_str = fstr.split( )
print( containe_str)
if (containe_str[0]=="VERTICES") :
n = int(containe_str[2])
if (containe_str[0]=="DEPOSIT... | true |
19d6ae40d331415a4ddd2ab0ae574f0abd1dcc53 | oritb-eng/oritbPublic | /CurrencyRouletteGameClass.py | UTF-8 | 1,623 | 3.1875 | 3 | [] | no_license | import urllib.request
import json
import random
import time
import sys
from LiveClass import GenGame
class CurrencyRollette():
def __init__(self):
self.money = random.randint(1, 101)
def get_money_interval(self, difficulty):
json_url = "https://api.exchangeratesapi.io/latest?base=USD"
... | true |
226aebeea6eaddcb81c87e8cc1f869dc57f45ae3 | dr-dos-ok/Code_Jam_Webscraper | /solutions_python/Problem_75/393.py | UTF-8 | 1,447 | 3.09375 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# vi:ts=4 sw=4 et
from __future__ import division
import sys
def run_testcase():
bases = {}
opposing = {}
input_tokens = raw_input().strip().split()
# How many base strings?
C = int(input_tokens.pop(0))
for i in range(C):
s = input_toke... | true |
7233fd95e785ed18901a43dabd791aecbe5789ba | lxy6688/lianxi | /python/clawer/downloadMusic.py | UTF-8 | 1,654 | 2.65625 | 3 | [] | no_license | # baidu vip music
import requests
import re
class BaiduMusic(object):
def __init__(self):
self.url = 'http://musicapi.taihe.com/v1/restserver/ting?method=baidu.ting.song.playAAC&format=jsonp&songid={}'
self.headers = {
'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537... | true |
ac3c7a4ead4e6de0aa4325d6e50999f30d56f1e8 | briffraff/SoftUni_ | /01.Programing basics/Python/complex-conditional-statements/volleyball.py | UTF-8 | 277 | 3.03125 | 3 | [] | no_license | year = input()
p = float(input())
h = float(input())
totalPlays = h
normalWeekends = 48 - h
totalPlays = totalPlays + (normalWeekends * 0.75)
totalPlays = totalPlays + (p * 2 / 3)
if (year == "leap"):
totalPlays = totalPlays + (totalPlays * 0.15)
print(int(totalPlays))
| true |
d3f808171b44dfd8a7ccd8ccec4bccaf6c732e98 | Kawser-nerd/CLCDSA | /Source Codes/AtCoder/abc057/D/4421116.py | UTF-8 | 788 | 2.71875 | 3 | [] | no_license | n,a,b = map(int,input().split())
v = list(map(int,input().split()))
v = sorted(v,reverse=True)
max_ave = sum(v[0:a])/a
index_max_ave = -1
for i in range(a,b+1)[::-1]:
max_ave = max(sum(v[0:i])/(i),max_ave)
if max_ave == sum(v[0:i])/(i):
index_max_ave = i
print(max_ave)
def combination(n,r):
... | true |
cede48c09b0c7ebc3ef2ab73d19f1955c52d92e8 | Yea-chanKim/kimyeachan | /python_0923_1/python_0923_1/python_0923_1.py | UTF-8 | 2,036 | 3.890625 | 4 | [] | no_license |
# 자바에서 다중상속은 인터페이스(= 추상메소드만을 가지고 있는 클래스 - > 추상메소드 그대로 쓰면 컴파일x 링크 과정에서 에러가 발생한다.)
# 다이아몬드 형태로 클래스를 상속했을 떄 , 함수가 중복된다면 문제가 생긴다.
#class A : 처럼 D의 형태
#def __init__(self):
#print("A 생성자 호출")
#class B(A) :
#def __init__(self):
#A.__init__(self)
#print("B 생성자 호출")
#class C(A) :
#def __init__(self):
#A.__init__(self)
#pr... | true |
4908488986cda855a63a9f878ced720e37e90573 | FedericoMolinaChavez/tesis-research | /Definitive/Genetic/preprocessingForRunning.py | UTF-8 | 455 | 2.578125 | 3 | [
"MIT"
] | permissive | import numpy as np
import pickle as pk
def bringDataFromArchive(path):
f = open(path, 'r')
contentInArchive = f.readlines()
# print(contentInArchive)
test = []
for i in contentInArchive:
aux = i [ : len(i) - 2]
ans1 = aux.split(' ')
a2 = [int(i) for i in ans1]
... | true |
bd4f25b84bfe7c562b484fba03415e31e5a51694 | jacob-rym/Python | /us-states-game/main.py | UTF-8 | 1,344 | 3.078125 | 3 | [] | no_license | from turtle import Screen, Turtle
from annotation import Annotation
import pandas
import os
import sys
# noinspection PyBroadException
def resource_path(relative_path):
""" Get absolute path to resource, works for dev and for PyInstaller """
try:
# PyInstaller creates a temp folder and stores path in ... | true |
3cf488d994f4e00862baa04611116c1881f159f9 | Shambhavi-gupta19/DigitalAlpha | /30thMarch/ques2.py | UTF-8 | 434 | 3.078125 | 3 | [] | no_license | fo = open("foo.txt", "w")
l=[]
n=int(input("Enter no of places u want to enter:"))
for i in range(n):
fo.write(input("Enter place name , population and area with spaces"))
fo.write("\n")
fo.close()
fo=open("foo.txt","r")
value=fo.readlines()
for i in value:
l.append(i.rstrip('\n'))
l.sort()
fo.close()
f... | true |
67ae91aae6edb7b6ee8288e93017ee7050d769d8 | timothyshull/python_scratchpad_old | /interleaving_string.py | UTF-8 | 1,426 | 3.4375 | 3 | [] | no_license | import unittest
class Solution(object):
def isInterleave(self, s1, s2, s3):
"""
:type s1: str
:type s2: str
:type s3: str
:rtype: bool
"""
idx1 = 0
idx2 = 0
idx3 = 0
while idx1 < len(s1) and idx2 < len(s2) and idx3 < len(s3):
... | true |
1bb203c60716e4b932383a534232c874a27f33ef | hanane-djeddal/Vertex-Cover-problem | /implementation.py | UTF-8 | 16,543 | 2.875 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
DJEDDAL HANANE 3803192
TOUZARI LITICIA 3802643
Binome 4
"""
import numpy as np
import copy
import math
import time
import matplotlib.pyplot as plt
#1==============================OPERATIONS DE BASE
def creer_graphe (Nfichier):
fichier=open(Nfichier,'r+')
Tgrap... | true |
09f6f9659da4809268c987b347325d321f992a86 | pictexam/CL-3 | /A3/A3.py | UTF-8 | 777 | 2.828125 | 3 | [] | no_license | from flask import *
from bitstring import BitArray
app=Flask(__name__)
@app.route('/')
def fun():
return render_template('index.html')
@app.route('/',methods=['POST'])
def g():
text1=int(request.form['text1'])
text2=int(request.form['text2'])
n,m=booth(text1,text2,8,8)
return "Answer in binary: "+str(n)+"<br>An... | true |
9e79ba364e59c2c478920528908e60cc00cebd31 | outOrdinary/algorithm | /listObject.py | UTF-8 | 4,188 | 4.28125 | 4 | [] | no_license | """思路一
这个方法是在网上看到的,在列表里创建两个列表分别存储两个栈
属于投机取巧
"""
class stack(object):
def __init__(self):
self.array = [[],[]]
def i_push(self, data):
self.array[0].append(data)
def i_pop(self):
if len(self.array[0]) == 0:
print('stack I is empty')
else:
... | true |
00ca726ed6275602a12f33d34b5b303bef147f09 | pgrespan/ctapipe | /ctapipe/plotting/camera.py | UTF-8 | 5,199 | 2.96875 | 3 | [
"BSD-3-Clause"
] | permissive | """Module to handle plotting of camera event specific items, e.g.
camera images and waveforms.
"""
from matplotlib import pyplot as plt
from ctapipe.visualization import CameraDisplay
from astropy import units as u
from astropy import log
class CameraPlotter:
"""
Plotter object for basic items that are cam... | true |
9a8514a2ac6a2663c42322c19fe5192fcba62e65 | nuwanlakshitha/song_search_engine | /es/es.py | UTF-8 | 448 | 2.640625 | 3 | [] | no_license | import json
out = open('songs_to_es.json', 'w',encoding='utf-8')
with open('../scrape/songs.json',encoding='utf-8') as json_in:
docs = json.loads(json_in.read())
i = 1
for doc in docs:
doc['visits'] = int(doc['visits'].replace(',',''))
out.write('%s\n' % json.dumps({'index': {'_index': 'so... | true |
ebe2fd6e7b4b71ee195916d95178a3343a995f24 | euanc/urlsWaybackChecker | /urlsWaybackChecker.py | UTF-8 | 2,516 | 3.03125 | 3 | [] | no_license | # This program will take two inputs at the command line:
# 1. a source csv file that is produced by the twitter archive download and normally called "tweets.csv"
# 2. a destination directory
# and will look up each url you tweeted that was included in the tweets.csv file
# and check to see if it is included in the wayb... | true |
931404c2d4e30923d061d9ef6fdd6618fb2bc544 | kmfonagy/Python_3_Bootcamp | /code_files/first_program.py | UTF-8 | 124 | 2.625 | 3 | [] | no_license | print()
print("print('<details>') returns something like:")
print("Hello World!") #Prints Hello World! as a String
| true |
47d95bde0e155f57babef0ed5855ffc59920f76b | vbrame/MinasCode | /LinkedStack.py | UTF-8 | 1,351 | 3.828125 | 4 | [] | no_license | from Empty import Empty
class LinkedStack:
# Nested Node Class
class Node:
def __init__(self, element, next):
self.__element = element
self.__next = next
def get_next(self):
return self.__next
def get_element(self):
return self.__elemen... | true |
8b105a4ee199d5b3bd89cc7a0102c4bf2bfbfff4 | molobrakos/dbdbscrape | /filter.py | UTF-8 | 2,322 | 2.75 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import scrape
from pandas import read_csv, merge
FILE_RESULT = "result.csv"
FILE_SELECTION = "selection.csv"
def make_list():
selection = read_csv(FILE_SELECTION,
header=None, names=["phenotype"],
encoding="utf-8")... | true |
c9c14434cc2725a9c362ebf1aa4598c2b1cf7401 | chengryan96/backtest | /src/stock_price.py | UTF-8 | 1,293 | 2.546875 | 3 | [] | no_license | from tiingo import TiingoClient
import yaml
import pandas as pd
import os
yaml_path = os.path.abspath(os.path.join((__file__), '..', '..', 'yaml'))
stock_json_path = os.path.abspath(os.path.join(
(__file__), '..', '..', 'json', 'stockprice'))
with open(os.path.join(yaml_path, "stock_data_config.yaml"), 'r') as str... | true |
9e1b2450b3db7f4d7657648b8534c7193c18321c | yjfdl123/leetcode | /easy/165compare_version_numbers.py | UTF-8 | 992 | 3.484375 | 3 | [] | no_license | class Solution(object):
def compareVersion(self, version1, version2):
"""
:type version1: str
:type version2: str
:rtype: int
"""
v1list, v2list = version1.split('.'), version2.split('.')
minlen = min(len(v1list), len(v2list))
for index in range(minlen):
... | true |
d8b963f1c1d6d8e07013c302052ed9637b2f91b7 | Willy-Angole/AgeRegression-project | /age_regression/imbalanced_sampler.py | UTF-8 | 787 | 2.75 | 3 | [
"MIT"
] | permissive | from collections import defaultdict
import torch
import torch.utils.data as data
from .dataset import AllAgeFacesDataset
class ImbalancedDatasetSampler(data.sampler.Sampler):
def __init__(self, dataset: AllAgeFacesDataset):
self.num_samples = len(dataset)
# distribution of classes in the datase... | true |
af5f3d97c16230871c9636067a1f765afb19be20 | ianliu-johnston/full-stack-duo-day | /pair/closest.py | UTF-8 | 648 | 3.296875 | 3 | [] | no_license | #!/usr/bin/python3
def get_distance(coord_a=(0,0), coord_b=(0,0)):
a = float(coord_a[0] - coord_b[0])
b = float(coord_a[1] - coord_b[1])
return((a ** 2 + b ** 2) ** 0.5)
if __name__ == "__main__":
lst1 = [(4,2),(1,6),(1,2),(1,3),(5,6),(1,1),(0,2),(2,3)]
lst2 = [(-1,-5),(4,3),(3,-6),(4,-6),(7,... | true |
0eeb53b52713745777c6e6752c5cd046ef77a6c8 | odedbarz/Vitay-2016 | /code/Fig1.py | UTF-8 | 9,082 | 3.03125 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | # Script allowing to reproduce Fig. 1 of:
#
# Laje, R. and Buonomano, D.V. (2013). Robust timing and motor patterns by taming chaos in recurrent neural networks. Nat Neurosci.
#
# Author: Julien Vitay (julien.vitay@informatik.tu-chemnitz.de)
# Licence: MIT
from __future__ import print_function
import numpy as np
impo... | true |
492ad443b8330d416a2d01138048dd5fb8f3f42f | kimdanny/python-exercise | /odd_even.py | UTF-8 | 312 | 4.40625 | 4 | [] | no_license | # Exercise 2
# program that asks the user for a number.
# whether the number is even or odd print out an appropriate message
#
user_input = int(input("Please type any one integer : "))
if user_input % 2 == 0:
print(user_input, 'is an even number')
else:
print(user_input, ' is an odd number')
| true |
2f8adb15299c77d9d7fe89b11391ba46693ff3f0 | andrefqms/TST---Programacao-1 | /medida/medida.py | UTF-8 | 256 | 2.90625 | 3 | [] | no_license | # coding: utf-8
#André Filipe Queiroz
# medidas
#andre.soares@ccc.ufcg.edu.br
milhas = float(raw_input())
libras = float(raw_input())
galoes = float(raw_input())
a = 1.60934
b = 0.453592
c = 3.78541
km = milhas * 1.60934
kg = libras * 0.453592
li = galoes * 3.78541
print km , kg, li
| true |
5eeacb8664757811407b212096e65d52b4159688 | Monologuethl/Monologuethl | /code/leetcode/771. 宝石与石头.py | UTF-8 | 432 | 3.5 | 4 | [] | no_license | class Solution(object):
def numJewelsInStones(J, S):
"""
:type J: str
:type S: str
:rtype: int
"""
counter: int = 0
for s in S:
for j in J:
if s == j:
counter += 1
return counter
sl = Solution.numJewels... | true |
7476070f432a050af069d93d5f21df8713184d5d | vastutsav/CodechefPractices | /cielab.py | UTF-8 | 120 | 3.171875 | 3 | [] | no_license | # cook your dish here
a,b = map(int, input().split())
c = abs(a-b)
l = c%10
if l == 9:
c-=1
else:
c+=1
print(c)
| true |
9f90a460b9a743b57e8839de273231047fda7b79 | igorgoncalves/NutriData | /server/tests/test_selenium.py | UTF-8 | 970 | 3.109375 | 3 | [] | no_license | from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import WebDriverWait, Select
def test_alteracao_titulo():
# Cria instacia do navegador
firefox = webdriver.Firefox()
# Acessa um link
firefox.get('http://localhost:5000')
# Espera event... | true |
c106c70a01cab5493dbbae89d0abb015e7453fbb | caravan4eg/Tender_Monitor_project | /backend/scrapy_project/pipelines.py | UTF-8 | 4,834 | 3.015625 | 3 | [] | no_license | import psycopg2
from .items import TenderItem
from scrapy.exceptions import DropItem
class TenderPipeline(object):
"""Save extracted data to database"""
def open_spider(self, spider):
# Connect to database
try:
hostname = 'localhost'
username = 'postgres'
... | true |
0f617a6757f3abf852232e7a0e0375a0b3bbe771 | Peter554/adventofcode | /2022/day05/solution.py | UTF-8 | 1,775 | 3.3125 | 3 | [] | no_license | import re
from typing import Protocol
class InstructionHandler(Protocol):
def handle(
self, *, n_move: int, from_stack: list[str], to_stack: list[str]
) -> None:
...
def solve(file_path: str, instruction_handler: InstructionHandler) -> str:
with open(file_path) as f:
init, instru... | true |
75205fd015319ae191580a771abc4b032f702090 | priyanka-111-droid/100daysofcode | /Day050/auto-tinder-swiping-bot/main.py | UTF-8 | 2,913 | 2.578125 | 3 | [] | no_license | #We will login in to Tinder using our Facebook account
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.common.exceptions import ElementClickInterceptedException, NoSuchElementException
import time
from dotenv import load_dotenv
import os
MY_EMAIL=os.getenv('MY_EMAIL') #Fac... | true |
aec8d148e1daab2b30de91ffd04acc60c8655383 | AgbaD/LMS | /student/tests.py | UTF-8 | 589 | 2.546875 | 3 | [] | no_license | from django.test import TestCase
from .models import Student
class StudentModelTest(TestCase):
def test_get_cart(self):
s = Student()
s = s.get_cart()
self.assertIsInstance(s, list)
def test_clear_cart(self):
s = Student()
s.clear_cart()
self.assertEqual(s.get... | true |
ca3e57d210551fc81c49251f442d4b152583d97e | orianac/data_assimilation | /tools/gen_synthetic_meas/gen_synthetic_meas.daily_last_time_step.py | UTF-8 | 3,787 | 2.859375 | 3 | [] | no_license | '''
This script simulates surface soil moisture measurements
- by perturbing VIC-simulated top-layer soil moisture by Gaussian white
noise
'''
import sys
import os
import numpy as np
import xarray as xr
import matplotlib.pyplot as plt
import pandas as pd
from tonic.models.vic.vic import VIC
from tonic.io im... | true |
b6f70264a60da9ecfb2ebed82de8e94eeaf97b31 | KMU-AELAB/Active_Learning | /utils/metrics.py | UTF-8 | 3,361 | 2.515625 | 3 | [
"MIT"
] | permissive | import torch
import numpy as np
def _fast_hist(label_pred, label_true, num_classes):
mask = (label_true >= 0) & (label_true < num_classes)
hist = np.bincount(
num_classes * label_true[mask].astype(int) +
label_pred[mask], minlength=num_classes ** 2).reshape(num_classes, num_classes)
return... | true |
d0ceb11540a51c42844673a5792a678157ee1d37 | Jarar14/IoT-Robotics-CS490 | /ICP 4/Sensor Data to Twitter.py | UTF-8 | 640 | 2.59375 | 3 | [] | no_license | # Reads serial monitor information and posts it to Twitter
import sys
from twython import Twython
import serial
import time
# Twitter API Information; From Project Details on Twitter Developers
apiKey = 'xxxxxxxxxxxxxx'
apiSecret = 'xxxxxxxxxxxxxx'
accessToken = 'xxxxxxxxxxxxxx'
accessTokenSecret = 'xxxxxxxxxx... | true |
bc00c766d5eef46621d8f066bbadf4e091102f71 | sirrah23/Roulette | /bintest.py | UTF-8 | 603 | 2.84375 | 3 | [] | no_license | import unittest
from outcome import Outcome
from bin import Bin
o1 = Outcome('1',35)
o2 = Outcome('2',35)
o3 = Outcome('3',35)
o4 = Outcome('split bet', 17)
class bintest(unittest.TestCase):
def test_outcomes(self):
self.assertEqual(Bin(o1,o2,o3).outcomes,frozenset([o1,o2,o3]))
self.assertNo... | true |
e29bec64569f0d0148613acf24f23555c1c1fa2a | eronekogin/leetcode | /2023/change_minimum_characters_to_satisfy_one_of_three_conditions.py | UTF-8 | 651 | 3.53125 | 4 | [] | no_license | """
https://leetcode.com/problems/change-minimum-characters-to-satisfy-one-of-three-conditions/
"""
from collections import Counter
class Solution:
def minCharacters(self, a: str, b: str) -> int:
m, n = len(a), len(b)
base = ord('a')
c1 = Counter(ord(c) - base for c in a)
c2 = Co... | true |
ec6a889ce358fc0ad0bd1f7a8ed861e062c7d8a7 | Xuser2018/Course | /Computer-Networking/Assignment1/TCP_client.py | UTF-8 | 350 | 2.8125 | 3 | [] | no_license | from socket import *
severName = '192.168.199.109'
severPort = 12001
clientSocket = socket(AF_INET,SOCK_STREAM)
clientSocket.connect((severName,severPort))
sentence = input('Input lowercase sentence:')
clientSocket.send(sentence.encode())
modifiedSentence = clientSocket.recv(1024)
print('From Server:',modifiedSentence.... | true |
f45b6f1bb14270993b7b987a60d27467c68e4dd8 | pdferreira/adventofcode2020 | /day20/day20.py | UTF-8 | 3,051 | 3.203125 | 3 | [] | no_license | from __future__ import annotations
from os import path
from itertools import takewhile
from functools import reduce
from typing import Optional
import time
import re
class Tile:
id: int
content: list[str]
sides: list[str]
flipped_sides: list[str]
num_flips: int = 0
def __init__(self, id: int, ... | true |
6f2e4571df05f1cbe6bd431af701d245a5f748e4 | YasasRangika/Keras | /testing/input.py | UTF-8 | 624 | 2.703125 | 3 | [] | no_license | import pandas as pd
df = pd.read_csv("t1.csv")
# group by ip address
by_state = df.groupby("ip_address")
count = 0
# taking all ip address to name list
name = df['ip_address']
# take one by one grouped ips
for state, frame in by_state:
df = pd.DataFrame(frame)
# IP, token and other non changing columns remo... | true |
01b1c24383c5debfdd919255a30a5f4a7439a0a8 | ctgk/pyautocast | /pyautocast/__init__.py | UTF-8 | 2,008 | 3.421875 | 3 | [
"MIT"
] | permissive | from pyautocast._autocast import _autocast, autocast
class CustomCast(object):
"""Class to perform custom type casting.
Example
-------
>>> from pyautocast import CustomCast
>>> mycast = CustomCast()
>>> mycast.add_cast_rule(int, tuple, lambda x: (x, x))
>>> @mycast.autocast(x=tuple)
... | true |
a9183700d6ea69faabe799423fb30d3e517f68c3 | ClaudioBorges/Master | /PEL202_fundamentos_da_inteligencia_artificial/IDC3/ia-exercise-3.py | UTF-8 | 9,374 | 3.5625 | 4 | [
"Apache-2.0"
] | permissive | # IDC3 implementation for the Iris flower data set implementation
# https://en.wikipedia.org/wiki/ID3_algorithm
#
# The iris flower data set was introduced by Ronald Fisher in his 1936 paper,
# as an example of linear discriminant analysis using multiple measurements
# in taxonomic problem.
# The data set can be retrie... | true |
3830c7f8ba33fff32359c7198fdf8f988ed2dffd | Odzinic/Linux_Scripts | /Pinetab_Check_Script.py | UTF-8 | 790 | 2.6875 | 3 | [] | no_license | # cron template
#* * * * * XAUTHORITY=/home/user/.Xauthority DISPLAY=:0 python /home/user/Documents/Pinetab_Check_Script.py
from lxml import html
import requests
import tkinter as tk
import sys
# URL page for PineTab
pinePage = requests.get("https://pine64.com/product/pinetab-10-1-linux-tablet-with-detached-backlit-k... | true |
13c0d96df30a3cd64f862a8d7b006114882218ff | Magicard/quickhash | /main.py | UTF-8 | 1,060 | 3.46875 | 3 | [] | no_license | import hashlib
""""This code allows you to create a file in which to store a username and hashed password."""
def hash_pass(input_pass):
salt= user_name # the salt is the username in case two users have the same password, the hash is still different
hashed= hashlib.md5(salt.encode())
hashed.update(input_pas... | true |
10d33406948721b3348b120cdcb7ee0028c31d7a | yixellet/totalStationProcess | /Parser.py | UTF-8 | 3,823 | 2.78125 | 3 | [] | no_license | from sdr33_structure import units, options, instrOpts
class Parser:
"""
Парсер SDR33-файла
"""
def __init__(self):
"""Constructor"""
pass
def readSDR(self, file):
"""Выполняет чтение файла и создает массив строк"""
with open(file, 'r') as sdr:
self.sdrLi... | true |
13ec387a6d6f281182eb2abd97f3d4ee6edf2b5c | haiou90/aid_python_core | /day10/exercise_personal/01_exercise.py | UTF-8 | 379 | 3.859375 | 4 | [] | no_license | class Dog:
def __init__(self, type, name, age, weight):
self.type = type
self.name = name
self.age = age
self.weight =weight
def eat(self):
print(self.type,"eat")
def yell(self):
print(self.type,"yell")
d01 = Dog("金毛","毛毛",3,30)
d02 = Dog("牧羊","壮壮",2,100)... | true |
dd28b0b1ea65c360fe8128549cd12ec6e02beaab | LucXyMan/starseeker | /Source/game/systems/accumulate.py | UTF-8 | 1,906 | 3.328125 | 3 | [
"BSD-3-Clause"
] | permissive | #!/usr/bin/env python2.7
# -*- coding:UTF-8 -*-2
u"""accumulate.py
Copyright (c) 2019 Yukio Kuro
This software is released under BSD license.
ダメージ管理モジュール。
"""
import utils.const as _const
class Accumulate(object):
u"""ダメージ管理。
溜まったダメージとエフェクトを処理する。
"""
__slots__ = "__effects", "__pressure"
__NUMBE... | true |
98af9ac80960fbb3e30cd8dca446414ec3f6db96 | Tom520class/AnacondaProject | /Data analysis project practice/7-4 Risk analysis in stock market analysis.py | UTF-8 | 2,119 | 3.265625 | 3 | [] | no_license | __author__='zhongyue'
# 股票市场分析实战之风险分析
# 基本信息
import numpy as np
import pandas as pd
from pandas import Series,DataFrame
# 股票数据的读取
import pandas_datareader as pdr
# 可视化
import matplotlib.pyplot as plt
import seaborn as sns
sns.set()
# 是在使用jupyter notebook 或者 jupyter qtconsole的时候,调用matplotlib.pyplot的绘图函数plot()进行绘图的时候,... | true |
1611375a2222f74f5e7ab5ffad716454ab380855 | zachgoll/finance_to_code | /web_scraping_udemy/section_06/intro-to-soup.py | UTF-8 | 545 | 3.625 | 4 | [] | no_license | from bs4 import BeautifulSoup
def read_file():
file = open('tags.html')
data = file.read()
file.close()
return data
html_file = read_file()
# Make a 'soup' which represents an html file
soup = BeautifulSoup(html_file, 'lxml')
body = soup.body
# prints the value of the attribute 'class' but only the... | true |
e35ec87c590fa05b4027b2442e17ede2cfce5233 | ToLearnDataScience/Data-Analysis | /Regression.py | UTF-8 | 3,168 | 3.34375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Tue Aug 3 12:26:17 2021
@author: 82108
"""
"""
predict UCLA grad admission result
- Logistic Regression
source : Kaggle.com
"""
# Step01 : load data
import pandas as pd
path = "C:/Users/82108/Desktop/Study/Educational Background/Programming/개인 공부/★_Github/D... | true |
da46b7f682e015cebbe9ffdfec3f57e063a96648 | SoftwareDevEngResearch/flowdist | /flowdist/tests/test_fluidmechanics.py | UTF-8 | 878 | 3.25 | 3 | [
"MIT"
] | permissive | from ..fluidmechanics import initial_conditions
import numpy as np
em1 = 'Initial velocity should be positive'
em2 = 'Velocity must be scalar or function of x and y coordinates and grid must be numpy array'
def test_initial_conditions_1():
def negvelfunc(grid):
return - 0.5 * grid
assert initial_co... | true |
69107401452028a30c4e41cf72b78f061390ae64 | billlaw6/python_utils | /syslogsample.py | UTF-8 | 1,091 | 2.5625 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf8 -*-
# File Name: syslogsample.py
# Author: bill_law6
# mail: bill_law6@163.com
# Created Time: Thu 19 Jan 2017 02:26:05 PM CST
# Description:
import syslog, sys, traceback, os
from io import StringIO
def logexception(includetraceback = 0):
exctype, exception, exctracebac... | true |
33381644009b6fc4372c8005bc5e5e9066bb2b7d | rpicard92/raspberry-pi-time-based-camera | /Python/real_time_object_detection.py | UTF-8 | 5,956 | 2.640625 | 3 | [
"MIT"
] | permissive | # USAGE
# python real_time_object_detection.py --picamera 1 --time 60
# import the necessary packages
from imutils.video import VideoStream
from imutils.video import FPS
import numpy as np
import argparse
import imutils
import time
import cv2
from smtp import EmailMessageBuilder
import pytz
from datetime import dateti... | true |
476e578cf4c02779c99452d79c17288ca80a3e8f | seushermsft/active-learning-detect | /functions/pipeline/shared/onboarding/__init__.py | UTF-8 | 2,580 | 2.875 | 3 | [
"MIT"
] | permissive | import os
import logging
# TODO: Modify this function to return a JSON string that contains a "succeeded" list and a "failed" list.
def copy_images_to_permanent_storage(image_id_url_map, copy_source, copy_destination, blob_service):
# Create a dictionary to store map of new permanent image URLs to image ID's
u... | true |
158d6a3195d209d1bd2c7da6c2dc822e5256750c | chelmes/JobLog | /test.py | UTF-8 | 951 | 3.046875 | 3 | [
"MIT"
] | permissive | #!/usr/bin/python
# Small script to demonstrate the features of JobLog
# Best used with python -i test.py
from pylab import *
import matplotlib.pyplot as plt
import numpy
import pandas as pd
import logger.item.item as litem
# We want to have distinctive column names for the final dataframe
columns=['Start','End','ne... | true |
3814f5b4e575390f778b769f9ef02b16019a3193 | jiangzhuolin/my_blog | /blog/templatetags/myfilter.py | UTF-8 | 603 | 2.9375 | 3 | [] | no_license | # -*- coding:utf-8 -*-
import logging
from django import template
register = template.Library()
# Initial a logger handler
logger = logging.getLogger("blog.views")
# 定义一个将日期中的月份转换为中文月份的过滤器,如:1转换为一
@register.filter
def month_to_upper(key):
try:
month_upper_list = ['一','二','三','四','五','六','七','八','九','十','... | true |
f3783a602d1d092d9b555dcf84878189bba6eec4 | toelt-llc/TOELT-tfrabbit | /code/mnist_rpi9.py | UTF-8 | 9,503 | 2.96875 | 3 | [] | no_license | #!/usr/bin/env python3
import sys, getopt
import tensorflow as tf
import pandas as pd
import numpy as np
import time
from tensorflow.keras.utils import to_categorical
from tensorflow.keras.datasets import mnist, fashion_mnist
from tensorflow.keras import Sequential
from keras.layers import Dense, Flatten
# Global res... | true |
cf0dcea2cf6f8bb6cb6ac5412b4d1348a86c0fd8 | AkimuneKawa/AtCoder | /ABC/ABC171/C.py | UTF-8 | 296 | 3.640625 | 4 | [] | no_license | N = int(input())
def get_name(N):
alphabets = [chr(i) for i in range(97, 97+26)]
length = len(alphabets)
shou = (N - 1) // length
amari = N % length
if N <= 26:
return alphabets[amari-1]
else:
return get_name(shou) + get_name(amari)
print(get_name(N)) | true |
8df69218798c662e95cad970a43c394ca885f043 | domroselli/yt-audio-gen | /yt_audio_gen.py | UTF-8 | 3,101 | 2.765625 | 3 | [
"MIT"
] | permissive | from __future__ import unicode_literals
import argparse
import os
import shutil
import sys
import youtube_dl
DOWNLOAD_ARCHIVE_FILE = 'download_archive.txt'
NEW_FILE_DIR = './new'
DARKSTREAM_URL = 'https://www.youtube.com/channel/UCGJNdaSwFeP3pLd1MhN0dRg'
class MyLogger(object):
def debug(self, msg):
print... | true |
e84e02b63c96d7e67d10bcae35555f55b04698d1 | Reekomer/kivy-designer | /treeviewproperties.py | UTF-8 | 3,920 | 2.515625 | 3 | [] | no_license | import kivy
kivy.require('1.0.9')
from kivy.uix.widget import Widget
from kivy.uix.togglebutton import ToggleButton
from kivy.uix.layout import Layout
from kivy.uix.floatlayout import FloatLayout
from kivy.uix.boxlayout import BoxLayout
from kivy.properties import ObjectProperty, BooleanProperty, ListProperty, \
... | true |
764eeb90cbb78766f50d264fe19ddc62928ecb5b | pranita-s/CTCI | /Moderate/FactorialZeroes.py | UTF-8 | 136 | 3.5 | 4 | [] | no_license |
def countZeroes(n):
i = 5
count =0
while n/i:
count += n//i
i*=5
return count
print(countZeroes(100))
| true |
0cfe04fdb19f31da902952e8f0d9fecd806bb983 | kelsielam/mask-detection-workflow | /bin/plot_images.py | UTF-8 | 1,200 | 3.140625 | 3 | [] | no_license | #!/usr/bin/python
from bs4 import BeautifulSoup
import matplotlib.pyplot as plt
import matplotlib.patches as patches
def generate_box(obj):
xmin = int(obj.find('xmin').text)
ymin = int(obj.find('ymin').text)
xmax = int(obj.find('xmax').text)
ymax = int(obj.find('ymax').text)
return [xmin, ymin, x... | true |
005591e91452a32b8868ba3cf9fb8d8617f3431f | qq516249940/my_learn_pyqt5- | /test4.py | UTF-8 | 1,691 | 2.734375 | 3 | [] | no_license | import sys
from PyQt5.QtWidgets import QMainWindow, QApplication, QDesktopWidget, QHBoxLayout, QWidget, QPushButton
from PyQt5.QtGui import QIcon
class QMainWin(QMainWindow):
def __init__(self, parent=None):
super(QMainWin, self).__init__(parent)
# 设置主窗口的标题
self.setWindowTitle("主窗口应用")
... | true |
5191986f251472ede951b76148f9905cdf891203 | Alexfordrop/Basics | /stat_metd.py | UTF-8 | 138 | 3.28125 | 3 | [] | no_license | class SomeClass(object):
@staticmethod
def hello():
print('Привет')
SomeClass.hello()
obj = SomeClass()
obj.hello() | true |
bf139de457cfe4c0d684e517d4b22ccc29cc8614 | amol-17/gesture-media-control | /handRecog.py | UTF-8 | 1,564 | 2.609375 | 3 | [
"MIT"
] | permissive | import cv2
import mediapipe as mp
class handDetector():
def __init__(self, mode=False, maxHands=2, detectionConfi=0.5, trackConfi=0.5):
self.mode = mode
self.maxHands = maxHands
self.detectionConfi = detectionConfi
self.trackConfi = trackConfi
self.hand_sol = mp.solutions.h... | true |
6845cfc417bd1853c1b5807de751ce646ed18ad0 | rahulakkina/LoksabhaElectionCaseStudy-2019 | /python/src/analyse_candidates.py | UTF-8 | 20,680 | 2.578125 | 3 | [] | no_license | import logging
import codecs
import json
import requests
import pandas as pd
import feedparser
from functools import lru_cache
from sortedcontainers import SortedSet
from bs4 import BeautifulSoup
# Loads json configuration from the configuration file.
def get_config(conf_path):
with codecs.open(conf_path, 'r', 'u... | true |
51998da7e3686e19b6bdb4da6c18354401e257fe | DeepakAtariya/Machine-Learning-Tutorials | /nptel/simplelinearregression/slr.py | UTF-8 | 1,152 | 2.6875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sat Sep 21 20:16:53 2019
@author: Deepak
"""
import numpy as np
import pandas as pd
#import random as rd
import matplotlib.pyplot as plt
#from sklearn.datasets.samples_generator import make_blobs
#from sklearn.model_selection import train_test_split
data = pd.read_csv('data.csv... | true |
4ce9ea2e261acb3a8a8f5f9d5c1f8a93e4e33fc7 | dalyulbam-cmd/Pattent_attorney | /Progress_before/ProvisionQuiz_Demo.py | UTF-8 | 9,241 | 2.9375 | 3 | [] | no_license | import random
from docx import Document
from docx.shared import Pt
from docx.enum.text import WD_ALIGN_PARAGRAPH
##################################################################################
OrderInLaw = ["편","장","절","관","조","항","호","목"]
paragraph_symbol = ['①','②','③','④','⑤','⑥','⑦','⑧','⑨','⑩','⑪','⑫','⑬','⑭'... | true |
8ffbffba093f3d0767035380d10e996a3ceb0dd4 | Sanjulata19/hacktoberfest-2021 | /consoleParsing.py | UTF-8 | 768 | 3.8125 | 4 | [
"MIT"
] | permissive | """
This simple script shows how to use the library argparse
included within Python to start making a simple calculator.
Example use
###############
In the console:
python consoleParsing.py --add 1 -s 2 -d 4
In the debugger (pydb):
vars(args)
# Should return:
{'add': ['1'], 'sub': ['2'], 'div': ['4']}
##############... | true |
43fe21581ec0e6aaf7d89f7eb361dffb1ddbe5e1 | CompPhysics/ComputationalPhysics2 | /doc/LectureNotes/_build/jupyter_execute/boltzmannmachines.py | UTF-8 | 72,230 | 3.84375 | 4 | [
"CC0-1.0"
] | permissive | #!/usr/bin/env python
# coding: utf-8
# # Boltzmann Machines
#
# Why use a generative model rather than the more well known discriminative deep neural networks (DNN)?
#
# * Discriminitave methods have several limitations: They are mainly supervised learning methods, thus requiring labeled data. And there are tasks ... | true |
bd425ed26d02a0148a6bca324778d46e08c22d3f | LuckyLi0n/prog_golius | /graphics/game.py | UTF-8 | 922 | 3.265625 | 3 | [] | no_license | from tkinter import *
import random
import graphics as gr
root = Tk()
root.geometry('800x600')
canv = Canvas(root, bg='white')
canv.pack(fill=BOTH, expand=1)
score = 0
def tick():
global x, y, score
x = random.randint(1, 500)
y = random.randint(1, 500)
red = random.randint(0, 255)
blue = random.r... | true |
86411b6a94b26b4647861020f2cfef94a0d82dd9 | thaiduy1704/CS112.L21 | /Homework/Group_10_13/Problem_2.py | UTF-8 | 377 | 2.90625 | 3 | [] | no_license | n = int(input())
c = [int(x) for x in input().split()]
def getWays(n, c):
flag = n
if n==0:
return 1
if len(c) == 0 and n==0:
return 1
if len(c) == 0 and n!=0:
return 0
res = [1]+[0]*n
for i in range(len(c)):
for j in range(c[i], n+1):
res[j] += res[j ... | true |
408a328d30f5e0f83f70b4dbc40e87c3cac1c000 | hamzaghojaria/Hacker-Rank-Solutions | /Python/92) Validating UID.py | UTF-8 | 313 | 3.046875 | 3 | [] | no_license | #Solution:
import re
result = ''
for _ in range(int(input())):
uid = input()
if len(set(uid)) == 10 and len(re.findall("[A-Z]",uid)) > 1 and len(re.findall("[0-9]",uid)) > 2 and len(re.findall("[^[A-Za-z0-9]]",uid)) == 0:
result += "Valid\n"
else:
result += "Invalid\n"
print(result)
| true |
2e24caa859c1d8b39a9402b977c894adf9cfc1d4 | gilvbp/data_science | /CRUD_operations/CRUD_with_SQLite3/generate_data.py | UTF-8 | 1,151 | 2.765625 | 3 | [] | no_license | import sqlite3
from contextlib import closing
def create_data():
with sqlite3.connect('data.db') as conn:
with closing(conn.cursor()) as cursor:
cursor.execute("""CREATE TABLE IF NOT EXISTS work(
id INTEGER PRIMARY KEY AUTOINCREMENT,
occupation VARCHAR(20) NOT NULL
... | true |
b47faa472d0a71471dd3f7f59e98f6fb53e540da | mitsurukikkawa/Python | /DeepQNetwork/RL_Q_reversi_tf.py | UTF-8 | 15,284 | 3.234375 | 3 | [] | no_license | '''
http://qiita.com/ryo_grid/items/72e1b64050650be3504b
'''
# POS State
EMPTY=0
PLAYER_X=1
PLAYER_O=-1
MARKS={PLAYER_X:"X",PLAYER_O:"O",EMPTY:" "}
DRAW=2
class TTTBoard:
def __init__(self,board=None):
if board==None:
self.board = []
for i in range(64):self.board.append(EMPTY)
... | true |
aaba8ae1ead0fd0125e60c709c3c5461f1101fe0 | ZalkinV/TIPiS.Project | /GAN_splitter.py | UTF-8 | 2,494 | 2.96875 | 3 | [] | no_license | import os
import shutil
import numpy as np
import matplotlib.pyplot as plt
# Paths for input data
nodules_path = "./GAN_nodules/"
labels_file_path = "./GAN_nodules/full_label.csv"
# Paths for results
nodules_paths_res = ["./GAN_results/benign/",
"./GAN_results/malignant/",]
images_path_res = "./... | true |
4bcc477b2968fc0c9374c49f5c103c9e526688a6 | rtreccani/ARBBox | /byteShooter.py | UTF-8 | 397 | 3.203125 | 3 | [] | no_license | val = 0
import serial
ser = serial.Serial('COM15', 3000000) #1000000)
while (True):
try:
val = (input('> ')) #home sweet home
if(val == 'V'):
print(ser.in_waiting)
elif(val == 'R'):
print(ser.read(1))
else:
valByte = int(val).to_bytes(1, 'big')
... | true |
58bd468d07403fd7614d0a01fc8898ab2c7cd05b | mfuery/markov | /src/server/dad_jokes.py | UTF-8 | 1,313 | 2.734375 | 3 | [] | no_license | import math
import requests
from requests import HTTPError
I_CAN_HAZ_DAD_JOKES_API_URL = "https://icanhazdadjoke.com/search"
MAX_JOKE_REQUEST_SIZE = 30
def fetch_jokes(api_endpoint_url, count=100, current_page=1):
results = []
n_requests = math.floor(count / MAX_JOKE_REQUEST_SIZE)
n_requests += 1 if co... | true |