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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
9f604ea2e3951a4fe114a46457ec486e1156d26a | Python | Kevinfu510/TridentFrame | /tridentframe_cli.py | UTF-8 | 10,338 | 2.96875 | 3 | [
"MIT"
] | permissive | import os
import string
from random import choices
from pprint import pprint
import click
from click import ClickException
from click import FileError
from PIL import Image
from apng import APNG
from colorama import init, deinit
@click.group()
def cli():
pass
img_exts = ['png', 'jpg', 'jpeg', 'gif', 'bmp']
sta... | true |
122abbd7ecf65e6047035d8779e44a72dc07b745 | Python | NikiDimov/SoftUni-Python-Advanced | /exam_preparation_10_21/problem_2 - string_concatenation.py | UTF-8 | 1,004 | 3.5 | 4 | [] | no_license | text = input()
N = int(input())
matrix = [list(input()) for r in range(N)]
def find_player():
for r in range(N):
for col in range(N):
if matrix[r][col] == 'P':
return r, col
def move(x, y, text_line):
global player_position
if x not in range(0, N) or y not in range(0,... | true |
7dae295d4916eb51fe783071b51312e88ce9348a | Python | JJnotJimmyJohn/CBA-stats-dev | /Archive/Sina_Scrape.py | UTF-8 | 1,043 | 2.625 | 3 | [] | no_license | import requests
# from bs4 import BeautifulSoup
import lxml.html as lh
import pandas as pd
import datetime
header = {'User-Agent': r'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/537.36 (KHTML, like Gecko) '
r'Chrome/41.0.2227.1 Safari/537.36'}
session = requests.Session()
base_ur... | true |
2e02a7fd34b5e086b063dee16f03762353d01f23 | Python | seidenfeder/neap | /parameterFitting/binImportance.py | UTF-8 | 2,999 | 3.0625 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
##################################################################################################
#
# This script runs the specified prediction method (regression or classification) with every bin
# to evaluate which is the most important bin
#
#########################... | true |
9a2c45997fd807a5b69aabf160cd1faa62246c2f | Python | mortie23/mssql-to-teradata | /function-lib/ddl-generate.py | UTF-8 | 6,996 | 2.625 | 3 | [] | no_license | #!/drives/c/Python38/python
# Author: Christopher Mortimer
# Date: 2020-08-26
# Desc: A script to generate the DDL for the staging tables and the views
# The output may need some manual modications but this is a starter
# Usage: Run from local session from the root repo directory
# ./function... | true |
3fa78a930bdcea8f9d7cdfe14b507cad4eb6bf40 | Python | zwhitchcox/science-stuff | /combinatorics/0010_possibilities.py | UTF-8 | 250 | 3.75 | 4 | [] | no_license | import sys
# program to count password possibilities
n = int(input("Enter number of characters allowed in password (e.g. A-Z, a-z, 0-9 = 62): "))
k = int(input("Enter length of password: "))
print(f'The number of possible characters is {n**k:,}.') | true |
8422e64bfbf4e0608408c2d108bd4df449824fba | Python | it-zyk/PythonCode | /13_多任务/06_多线程共享全局变量_02.py | UTF-8 | 819 | 3.453125 | 3 | [] | no_license | import threading
import time
# 定义一个全局变量
g_num = 100
gl_list = ["11", "22"]
def test1(tempt):
global g_num
g_num += 1
tempt.append("34")
print("----- in test1 g_num=%s --------" % str(tempt))
def test2(tempt):
global g_num
g_num += 1
tempt.append("45")
print("----- in test2 g_num... | true |
84602dc2a3ba898c1a29e74190a3f2b1cc1001b4 | Python | NikhilaBanukumar/GeeksForGeeks-and-Leetcode | /remove_duplicates_ll.py | UTF-8 | 1,561 | 3.359375 | 3 | [] | no_license | def median_3(a,b,c):
return a+b+c-(max(a,b,c)+min(a,b,c))
def median_4(a,b,c,d):
return (a+b+c+d-(max(a,b,c,d)+min(a,b,c,d)))/2
def median_two_sorted_arrays(a,b):
na=len(a)
nb=len(b)
mida=int((na-1)/2)
midb=int((nb-1)/2)
if na == 0 or nb == 0:
if nb == 0:
if na % 2 != 0:... | true |
1ed584528c5cd41c914d852327b9c12d4c791f14 | Python | LuizFelipeBG/CV-Python | /Mundo 2/ex54.py | UTF-8 | 272 | 3.59375 | 4 | [] | no_license | c1 = 0
c2 = 0
for c in range(1,8):
nas = int(input('Digite a data de nascimento: '))
if 2018 - nas > 18:
c1 += 1
else:
c2 += 1
print('existem {} pessoas que já são maiores de idade e {} que ainda não atingiram a maioridade!!'.format(c1,c2))
| true |
5d59327a9ed7dc2603aab97245ece07e67e68184 | Python | KidQuant/Finance | /algo_trading/quandl_data.py | UTF-8 | 2,453 | 3.375 | 3 | [] | no_license |
#quandl_data.py
from __future__ import print_function
import matplotlib.pyplot as plt
import pandas as pd
import requests
def construct_futures_symbols(symbol, start_year=2010, end_year=2014):
"""
Constructs a list of futures contract codes
for a particular symbol and timeframe.
"""
futures = []... | true |
b0d39a2978216e6637db6ab842f9850fe34d1e89 | Python | JancisWang/leetcode_python | /593. 有效的正方形.py | UTF-8 | 1,031 | 3.375 | 3 | [] | no_license | '''
给定二维空间中四点的坐标,返回四点是否可以构造一个正方形。
一个点的坐标(x,y)由一个有两个整数的整数数组表示。
示例:
输入: p1 = [0,0], p2 = [1,1], p3 = [1,0], p4 = [0,1]
输出: True
注意:
所有输入整数都在 [-10000,10000] 范围内。
一个有效的正方形有四个等长的正长和四个等角(90度角)。
输入点没有顺序。
来源:力扣(LeetCode)
链接:https://leetcode-cn.com/problems/valid-square
著作权归领扣网络所有。商业转载请联系官方授权,非商业转载请注明出处。
'''
class Solu... | true |
90b1894601533f819103d38962509892ac0106bd | Python | Schiggebam/FightOfAIs3 | /src/ai/ai_blueprint.py | UTF-8 | 7,429 | 3.046875 | 3 | [] | no_license | from __future__ import annotations
from src.ai.AI_GameStatus import AI_GameStatus, AI_Move
from src.misc.game_constants import DiploEventType, debug, hint, Definitions
from src.misc.game_logic_misc import Logger
class AI_Diplo:
"""
Example class for inter-player diplomatics. Events are defined in the constan... | true |
b55327695f48c613466ad67ca2ceb540364d7e5f | Python | stefanpejcic/python | /if/lcalculator.py | UTF-8 | 1,309 | 4.25 | 4 | [] | no_license | """
Modification from this exercise: https://github.com/stefanpejcic/python/blob/master/if/calculator.py
to let user first specify a language and then run the calculator in their language.
"""
phrase1 = "Enter first operand? "
phrase2 = "Enter second operand? "
phrase3 = "Choose operation (add,sub,mul,div): "
phrase4 ... | true |
25941577cbc92e3f8eb7c8f304e1f0feb62543f5 | Python | QAMilestoneAcademy/PythonForBeginners | /ProgramFlow/if_learn.py | UTF-8 | 1,160 | 4.53125 | 5 | [] | no_license | #Statement following if condition are indented within if
#indented statements excute if condition within if bracket meets
name="Anuradha"
# if(name == "Anuradha"):
if(10>5):
print("10 is greater then 5")
#will execute in any condition
print("program ended")
#Let's guess the output:
spam = 7
if spam > 5:
print(... | true |
8543b3e334a2c43ef04f49d0b35a215a2a6eedbe | Python | Axl-M/telegram_bot | /convbot.py | UTF-8 | 4,046 | 2.765625 | 3 | [] | no_license | import logging
from typing import Dict
from telegram import ReplyKeyboardMarkup, Update
from telegram.ext import (
Updater,
CommandHandler,
MessageHandler,
Filters,
ConversationHandler,
CallbackContext,
)
TOKEN = "1485482332:AAHmcJJf1uFjfhEDxDQAK3m6eb4lOTb2LhE"
# Enable logging
logging.basic... | true |
e16f3bf50854c33ce941584799156f328099ba10 | Python | tomstelk/BuyToLet-Tool | /mother.py | UTF-8 | 2,633 | 2.59375 | 3 | [] | no_license | __author__ = 'tomstelk'
import urlSearchResults
import htmlSearchResults
import unicodedata
import sqlite3
#Zoopla html navigation data
import zooplaHTMLSetup
#AirBnB html navigation data
import airBnBHTMLSetup
import insertTable
import time
#Text file containing postal districts
txtfilePostalDistrict... | true |
4dc965c309061e198cc0ce6cb6b7bb6af20eaf0d | Python | ignition-is-go/lucid-control | /django/lucid_api/services/groups_service_OLD.py | UTF-8 | 8,226 | 2.625 | 3 | [] | no_license | '''
Google Groups Service
for Lucid Control
JT
06/26/2017
'''
import service_template
import httplib2, json
import os
import re
from apiclient import discovery, errors
from oauth2client.service_account import ServiceAccountCredentials
class GroupsService(service_template.ServiceTemplate):
def __init__(self)... | true |
9daef5250758a0f0950eae891bc7d34b6a3c187e | Python | skarensmoll/algorithms-tlbx | /week2_algorithmic_warmup/4_least_common_multiple/lcm.py | UTF-8 | 510 | 3.578125 | 4 | [] | no_license | # Uses python3
import sys
def gcd(a, b):
reminder = a % b
if reminder == 0 :
return b
return gcd(b, reminder)
def lcm_naive(a, b):
for l in range(1, a*b + 1):
if l % a == 0 and l % b == 0:
return l
return a*b
def lcm(a, b):
return int(a * b / gcd(a, b))
if __... | true |
4bb5807d735b7bb21bd56e083dd13489ce8315ca | Python | JunguangJiang/FTP | /client/src/cmd.py | UTF-8 | 3,598 | 2.921875 | 3 | [
"MIT"
] | permissive | '''
FTP客户端的命令行程序
'''
from client import Client
import getpass
import sys
DEBUG_MODE=False
class ClientCmd:
'''ftp客户端命令行程序'''
def __init__(self, ip='127.0.0.1', port=21):
self.client = Client()
self.command_map = {
"get": self.client.get,
"reget": self.client.reget,
... | true |
14c7495e4230221e7d8ff42f5a07062f7d87ec03 | Python | YonseiMVP/DeepForAll | /lab06/lab-06-1-softmax_classifier.py | UTF-8 | 2,725 | 3.28125 | 3 | [] | no_license | # Lab 6 Softmax Classifier
import tensorflow as tf
tf.set_random_seed(777) # for reproducibility
use_gpu = False
# 4개의 feature , 8개의 instance, 차원은 instance x feature = 8 X 4
x_data = [[1, 2, 1, 1],
[2, 1, 3, 2],
[3, 1, 3, 4],
[4, 1, 5, 5],
[1, 7, 5, 5],
[1, 2, 5, 6],
... | true |
3c5bb7e25a3db93838ef367943904191c77afbb5 | Python | Didero/Ophidian | /ScrollableFrame.py | UTF-8 | 1,161 | 3.125 | 3 | [
"LicenseRef-scancode-secret-labs-2011",
"MIT"
] | permissive | import Tkinter
class ScrollableFrame(Tkinter.Frame):
def __init__(self, parentFrame, width, height):
Tkinter.Frame.__init__(self, parentFrame)
self.canvasWidth = width
self.canvasHeight = height
# For some reason you can't scroll Frames though, so we have to put everything in a Frame in a Canvas
self.can... | true |
53cc50280141c81127cb798c9154a4b5124ea167 | Python | luabras/open-cv-basics | /opencv_resize.py | UTF-8 | 800 | 3.03125 | 3 | [] | no_license | import imutils
import cv2
path = "C:/pyimage/OpenCV 101 - OpenCV Basics/imagens/teste.jpg"
img = cv2.imread(path)
cv2.imshow("Original", img)
cv2.waitKey(0)
(h, w) = img.shape[:2]
# vamos mudar a largura para 150, entao vamos calcular o aspect ratio da nova largura
# para que a imagem n fique desproporc... | true |
c028ec7b91af8cd4b2a0f5dd9bfcf27ac9044df3 | Python | GrupoProgramacion/programacion-1-utec | /lunesSemana7.py | UTF-8 | 1,612 | 3.3125 | 3 | [] | no_license | # promedio
from functools import reduce
def mainPromedio():
n = int(input())
x = list(map(lambda x: int(input()), range(n)))
promedio = reduce(lambda x , y : (x + y), x) / len(x)
print(max(x))
print(min(x))
print(int(round(promedio,0)))
#mainPromedio()
def toString(n):
if n == 0... | true |
96bb5adf68e9a327fe488f6b837055d4f14d5958 | Python | jingxm/RssReader | /app/models.py | UTF-8 | 4,359 | 2.53125 | 3 | [] | no_license | # coding:utf-8
from . import db, login_manager, app
from flask_login import UserMixin
from werkzeug.security import generate_password_hash, check_password_hash
from datetime import datetime
import sys
from flask_table import Table, Col
'''
subscriptions = db.Table('Subscriptions',
db.Column('feed_id', db.Integer, ... | true |
13cb20564686795c75199c06b68f997682194832 | Python | wtarr/GPX_UI | /Logic/CoordinateCalculations.py | UTF-8 | 813 | 3.21875 | 3 | [] | no_license | __author__ = 'William'
import math
class CoordinateCalculations:
""" A class to do necessary calculations
on lat/long coord data"""
__earthRadius = 6371
def calculateDistance(self, long1, lat1, long2, lat2):
""" Calculate distance between 2 coordinates
Source for algorithm
htt... | true |
946c07cf1c27bec76d6b08ecbfe49bb907fe1491 | Python | ch-tseng/handGesture | /handGesture.py | UTF-8 | 2,170 | 2.53125 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import numpy as np
import cv2
import os
from libraryCH.device.lcd import ILI9341
lcd = ILI9341(LCD_size_w=240, LCD_size_h=320, LCD_Rotate=270)
videoDisplay = 2 #1 -> image, 2 -> bw
cap = cv2.VideoCapture(0)
fgbg = cv2.BackgroundSubtractorMOG()
while(True):
... | true |
359a1a65d7ed1e695f0bfa4ee6006978c94db475 | Python | django-stars/guitar | /guitar-package/guitar/guitar/patcher/item_patchers.py | UTF-8 | 7,206 | 2.875 | 3 | [
"MIT"
] | permissive | import re
class ValidationError(Exception):
pass
class CantApplyPatch(Exception):
pass
class ItemPatcher(object):
def apply_patch(self, content, patch):
"""
Write your code to apply patch to file content.
:param content: (str) file content
:param patch: patch objects
... | true |
7356d4b83515da5cdbe91b9f4cf68296a5f3b73d | Python | joan-kii/Automate-boring-stuff-with-Python | /Chapter 14/convertingSpreadsheetsOtherFormats.py | UTF-8 | 1,000 | 3.34375 | 3 | [] | no_license | #!python3
#convertingSpreadsheetsOtherFormats.py Convierte spreadsheets a otros formatos.
import ezsheets
def convertidor(archivo, formato):
""" Esta función convierte un archivo spredsheet a un formato
específico: '.xlsx', '.ods', '.csv', '.tsv', '.pdf'
o '.html'. """
# Carga el arch... | true |
cb5a742ef48f521e30ecec9d122bd59e38627ae6 | Python | disonvon/IP_multi_production | /IP_Solve.py | UTF-8 | 9,917 | 2.796875 | 3 | [] | no_license | from gurobipy import *
"""
use integer programming to solve 6 periods production decision problem with gurobi
in the case we have labor hourconstraint, reliability constraint, dynamic labor cost,
raw material constraint, storing, shipping constraints and advertising budget constraints
demands created by advertisements ... | true |
791facc61852748232b25bd621320ea4f1ee66b5 | Python | mareathj/thinkpython | /ch4/polygon.py | UTF-8 | 317 | 3.75 | 4 | [] | no_license | import turtle
import math
bob = turtle.Turtle()
def polygon(t,length,n):
for i in range(n):
t.fd(length)
t.lt(360/n)
def circle(t,r):
l = 2*r/100
polygon(t,l,100)
#def arc(t,r,angle):
l = 2*r/100
polygon(t,l, int(360/angle))
arc(bob,100,30)
#circle(bob,100)
#polygon(bob,20,7)
| true |
8e7019b32e61d1eefac8c6dad1d5573bad2ff81b | Python | chiakiphan/ner-product | /word2vec.py | UTF-8 | 3,790 | 2.671875 | 3 | [] | no_license | from dictionary_load import DictionaryLoader
import re
from underthesea import pos_tag
words = DictionaryLoader("/home/citigo/Downloads/1M_san_pham_my_pham.csv").words
lower_words = set([word.lower() for word in words])
def word2features(sent, position):
word = sent[position][0]
postag = sent[position][1]
... | true |
3ff414cbb46204920fd569bab5619e1184ced694 | Python | yanghh0/CV | /Facial Expression Recognition/preprocess.py | UTF-8 | 972 | 2.65625 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding:utf8 -*-
import os
import cv2
import numpy as np
import pandas as pd
df = pd.read_csv(os.path.join('dataset', 'train.csv'))
x = df[['feature']]
y = df[['label']]
x.to_csv(os.path.join('dataset', 'data.csv'), index=False, header=False)
y.to_csv(os.path.join('dataset', 'label.csv'), ... | true |
a22f99a1490537d87e8e7b4ea70f991c2ddebb34 | Python | KimaniKibuthu/pneumonia-classification | /app.py | UTF-8 | 1,540 | 2.96875 | 3 | [] | no_license | import cv2
import numpy as np
import streamlit as st
import tensorflow as tf
@st.cache(allow_output_mutation=True)
def load_model():
model = tf.keras.models.load_model("tuned_model.h5")
return model
def main():
html_temp = """
<div style="background-color:tomato;padding:10px">
<h2 style="color:w... | true |
1fb2de00b2c7527244dfbbdb61ed71a8b2a30992 | Python | EyssK/adventofcode2017 | /Day18.py | UTF-8 | 4,436 | 2.578125 | 3 | [] | no_license |
# part1
def step(regs, cmd, args, freq):
pc_diff = 1
args = args.split()
if len(args) > 1:
try:
args[1] = int(args[1])
except ValueError:
args[1] = regs[args[1]]
if cmd == "set":
regs[args[0]] = args[1]
elif cmd == "add":
regs[args[0]] += a... | true |
298192c88a293781f67efc5878d99657181be4c4 | Python | VRumay/WhatsappToCSV | /WhatsappToCSV.py | UTF-8 | 4,649 | 3.5 | 4 | [] | no_license |
"""
Whatsapp to CSV: Converts any chat file exported from whatsapp as .txt to a .csv file
with the most relevant columns for analysis.
Supports group chats, currently supporting english exports, with a possibility to extend it to spanish
"""
import os
import pandas as pd
import re
chatfile = r"C:\Users\Rumay-Paz\D... | true |
64263fd4d8f00cabffed4695ed53619adbe69657 | Python | mart00n/introto6.00 | /ps1/ps1b_redo.py | UTF-8 | 482 | 3.28125 | 3 | [] | no_license | # mart00n
# 10/09/2016
bal = float(input('Enter balance: '))
intrate = float(input('Enter your annual interest rate: '))
monthrate = intrate / 12.0
payment = 10.0
loopbal = bal
while loopbal >= 0:
for i in range(1,13):
loopbal = loopbal * (1.0 + monthrate) - payment
if loopbal <= 0:
br... | true |
124cce782235cee629023d2df490ffab1bb22091 | Python | syseleven/python-cloudutils-libs | /syseleven/cloudutilslibs/utils.py | UTF-8 | 5,520 | 2.703125 | 3 | [] | no_license | #!/usr/bin/env python
from neutronclient.common.exceptions import NotFound as neutronclientNotFound
from novaclient.exceptions import NotFound as novaclientNotFound
from heatclient.exc import HTTPNotFound as heatclientHTTPNotFound
from copy import deepcopy
import sys
import logging
global LOG
LOG = logging.getLogg... | true |
ded654f8afa4c0d6808422abb18728a61bc7b4c6 | Python | argriffing/xgcode | /20081201a.py | UTF-8 | 8,708 | 2.765625 | 3 | [] | no_license | """For each tree, reconstruct the topology from a single eigendecomposition.
"""
from StringIO import StringIO
import numpy as np
from SnippetUtil import HandlingError
import SnippetUtil
import Newick
import FelTree
import NewickIO
import TreeComparison
import MatrixUtil
import iterutils
from Form import CheckItem
i... | true |
3d6aab6e684a4a0778ea32525ae325e15673fbc8 | Python | amaotone/competitive-programming | /AtCoder/ABC089/D_practical_skill_test.py | UTF-8 | 390 | 2.78125 | 3 | [] | no_license | H, W, D = map(int, input().split())
p = {}
for i in range(H):
for j, value in enumerate(map(int, input().split())):
p[value] = (i, j)
cost = {}
for i in range(1, W * H + 1):
cost[i] = cost[i - D] + abs(p[i][0] - p[i - D][0]) + abs(p[i][1] - p[i - D][1]) if i > D else 0
Q = int(input())
for _ in range(... | true |
43061213659f7d98a7fab15d7d13875edd770edd | Python | laika-monkey/optimal_estimation | /shiscpltm.py | UTF-8 | 707 | 3.09375 | 3 | [] | no_license |
"""Print the begin and end times of an SHIS file"""
from argparse import ArgumentParser
from datetime import datetime, timedelta
from pyhdf import SD
def main():
parser = ArgumentParser(description=__doc__)
parser.add_argument('shis_file', help='NetCDF SHIS file')
args = parser.parse_args()
shis_sd... | true |
e76d891134892ec95ce6fc82ce04afc5026e6a0d | Python | haitaoss/flask_study | /flask_code/day02_request/02_upload.py | UTF-8 | 755 | 2.75 | 3 | [
"Apache-2.0"
] | permissive | # coding:utf-8
from flask import Flask, request
import sys
# 创建flask应用
app = Flask(__name__)
@app.route(r'/upload', methods=['POST'])
def upload():
"""接受前段传送过来的文件"""
file_obj = request.files.get('pic')
if file_obj is None:
# 表示没有发送文件
return '未上传文件'
# 将文件保存到本地
# with open('./demo.j... | true |
75d8b9493eb19b5d7af213c43017bcbc27dc1080 | Python | LucasCFM/TP-Redes | /app/server/socket_connector.py | UTF-8 | 2,250 | 3.359375 | 3 | [] | no_license | '''
Client UPD connector
implements retransmission of messages sent
'''
import socket, json
from time import sleep
from app.utils.data import byte_to_json, json_to_byte
bufferSize = 1024
# Create a UDP socket at client side
UDPServerSocket = socket.socket(family=socket.AF_INET, type=socket.SOCK_DGRAM... | true |
e9286d8b92258dba49ceda01ea0a0a77f551b3c5 | Python | Liset97/Sistema-de-Recuperacion-de-Informacion | /proccon.py | UTF-8 | 2,202 | 2.75 | 3 | [] | no_license | import json
import numpy as np
import procdoc as pd
#Realmente esto no lo hare asi, sino q para utilizar el modulo este tenga que mandar el diccionario de terminos
#
#En ListQuery guardare tuplas de la forma <id_q,text,[vector con todas las palabras]>
#
ListQuery=[]
def Query(query,list_term):
with open('datase... | true |
e0505c45690be67b1987383e0ffa8b4293df0f82 | Python | KomaTech12/PiperWave3_PersonalPJ | /RasPi/senosrdata.py | UTF-8 | 3,100 | 2.8125 | 3 | [] | no_license | #! /usr/bin/python3
import RPi.GPIO as GPIO
import time
import datetime
import requests
import json
import redis
# Define GPIO Pin
Trigger = 16
Echo = 18
# Connect RedisCloud on PWS
r = redis.Redis(host='XXX', port='XXX', password='XXX')
# Initialize List
r.rpush('point0', 'NoData', 'NoData')
r.rpush('point10', 'No... | true |
373423ca612a7692b22e81dead7a5f45cbcec091 | Python | willyrv/LDA_20newsgroups | /04_compose_matrices.py | UTF-8 | 2,448 | 2.78125 | 3 | [] | no_license | import numpy as np
import os
import h5py
from numpy.core.fromnumeric import size
path2partialresults = "./partial_0-1-2-15_35"
n_points = 140
# Create the files
with h5py.File("./distances_matrix.hdf5", "w") as f:
dset = f.create_dataset('distances', (n_points, n_points),
dtype=np.flo... | true |
9942d7eca5555f8e1d29f3184746a7e5d41a573d | Python | Ogaday/sapi-python-client | /tests/test_base.py | UTF-8 | 1,867 | 2.53125 | 3 | [
"MIT"
] | permissive | import unittest
import os
from requests import HTTPError
from kbcstorage.base import Endpoint
class TestEndpoint(unittest.TestCase):
"""
Test Endpoint functionality.
"""
def setUp(self):
self.root = os.getenv('KBC_TEST_API_URL')
self.token = 'some-token'
def test_get(self):
... | true |
269d8ad77c16e79e6cf8a1b1107e5a8ad29f0bb8 | Python | shg9411/algo | /algo_py/boj/bj4179.py | UTF-8 | 1,633 | 2.96875 | 3 | [] | no_license | import sys
from collections import deque
input = sys.stdin.readline
R, C = map(int, input().split())
visited = [[False for _ in range(C)] for _ in range(R)]
miro = []
jh = deque()
fire = deque()
for i in range(R):
miro.append(list(input().rstrip()))
for j in range(C):
if miro[i][j] == '.':
... | true |
ca90af8d771c85e2eed9db230c04107892991026 | Python | AA19BD/PythonSummer | /Python-Inform/Списки/B.py | UTF-8 | 104 | 3.03125 | 3 | [] | no_license | l=list(map(int,input().split()))
for i in range(len(l)):
if l[i]%2==0:
print(l[i],end=" ") | true |
3ac18ff7eeafa8029801bd57b763f549c039d7c0 | Python | Saurabh23/Sentiment-Analysis-for-Predicting-Elections | /tweetsPreProcessing/pos_tagging.py | UTF-8 | 755 | 2.640625 | 3 | [] | no_license | import sys
import nltk
from nltk import word_tokenize, pos_tag
TAGFILE = 'tags.csv'
def collectPOSTAGS():
f = open(TAGFILE,'r+')
tags = f.read().split('\n')
print tags
return tags
def main(filename):
f = open(filename, 'r+')
text = f.read()
text = ''.join((c for c in text if 0 < ord(c) < 127))
tweets = text.... | true |
07e5b243d0129b71b7a7ac8e58f2b8cf97e70580 | Python | JosephLevinthal/Research-projects | /5 - Notebooks e Data/1 - Análises numéricas/Arquivos David/Atualizados/logDicas-master/data/2019-1/226/users/4132/codes/1836_1273.py | UTF-8 | 172 | 2.5625 | 3 | [] | no_license | from numpy import *
from numpy.linalg import *
mat = array([[1,-1,0,0],[0,1,-1,0],[0,0,1,0],[1,0,0,1]])
vet= array([50,-120,350,870])
flu=dot(inv(mat),vet.T)
print(flu)
| true |
7043613876ad13d253f842eb1e45870ec5c3ad60 | Python | beddingearly/LMM | /151_Reverse_Words_in_a_String.py | UTF-8 | 494 | 3.390625 | 3 | [] | no_license | # coding=utf-8
'''
@Time : 2018/11/27 12:36
@Author : Zt.Wang
@Email : 137602260@qq.com
@File : 151_Reverse_Words_in_a_String.py
@Software: PyCharm
'''
class Solution(object):
def reverseWords(self, s):
"""
:type s: str
:rtype: str
"""
a = s.strip().split(" ")
... | true |
b5c88eb87bc7a303bebd4d1dd4975fb046a1ed07 | Python | Userfix/pytrain | /generator/contact.py | UTF-8 | 2,071 | 2.6875 | 3 | [
"Apache-2.0"
] | permissive | # -*- coding: utf-8 -*-
import string
import random
import os
import jsonpickle
import getopt
import sys
from model.contact import Contact
try:
opts, args = getopt.getopt(sys.argv[1:], "n:f:", ["number of contacts", "file"])
except getopt.GetoptError as err:
getopt.usage()
sys.exit(2)
n = 3
f = "data/con... | true |
ece0e047a17f1961c134614fce6eea3c3c69f4eb | Python | nabendu96/end_sem | /Q_8.py | UTF-8 | 1,435 | 3.46875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Fri Jun 5 12:04:59 2020
@author: nabendu
"""
#question_8
#solving boundary value problem #relaxation method
import numpy as np
import matplotlib.pyplot as plt
#boundary conditions
x0=0
y0=0
xf=1
yf=2
N=100 #number of mesh points
x=np.linspace(x0,xf,... | true |
10eeb83ede14cb92eab532560d99bf3906149c9b | Python | Niklesh99/Vehicle-Detection-and-tracking-count-using-OpenCV | /main2.py | UTF-8 | 3,000 | 3.03125 | 3 | [] | no_license | import cv2
import numpy as np
from time import sleep
width_min=80 #MIN WIDHT
height_min=80 #min height
offset=6
pos_line=550 #LINE POSITION
delay= 60 # VIDEO FPS
detect = []
cars= 0 # NO of CARS
def takes_center(x, y, w, h): # FRAME CENTER
x1 = int(w ... | true |
d0318b34c85c17585a4252bebfba21f81c3a005c | Python | masumrumi/Parser | /Parser.py | UTF-8 | 4,802 | 3.1875 | 3 | [] | no_license | # resources
# https://sly.readthedocs.io/en/latest/sly.html
# how to run:
# step one:
# pip install sly
# step two:
# python Parser.py
# step three:
# "language >" will show up.
# step 4:
# test the following programs.
# a = 7
# a = 3+4*8
# a = (4+7)*5
from sly import Lexer
from sly import Parser
class BasicL... | true |
b1befa1dc28e90bd65798aa04eb7c7e48ae89977 | Python | quigleyj97/COS125Project2 | /ControllerIntegration.py | UTF-8 | 1,781 | 3.3125 | 3 | [] | no_license | import pygame
import math
pygame.init()
gameDisplay = pygame.display.set_mode((800,600))
gameExit = False
x_coord = 300
y_coord = 300
joystick = pygame.joystick.Joystick(0)
joystick.init()
axes = joystick.get_numaxes()
## 0=Left_Stick X-axis, Left == Negative, Right == Positive
## 1=Left_Stick Y-axis, Up == Negat... | true |
76cf9699e77955b893f57c6c7309f60b189eb60a | Python | stankevichea/daftacademy-python4beginners-autumn2018 | /Python_Funkcjonalny_Kod/praca_domowa/zadanie5.py | UTF-8 | 1,007 | 4.15625 | 4 | [] | no_license | # Zadanie 5
# Napisz 2 funkcje:
# Jedna o nazwie prime ma sprawdzić czy zadana liczba <n> jest liczbą pierwszą
# zwracając True/False
# Druga funkcja twins ma sprawdzić czy danae liczbay <n>, <k> są liczbami bliźniaczymi.
# Funkcja może przyjmować też jeden parametr
# Jeżeli podana liczba jest liczbą bliźniaczą zwróć j... | true |
06381128e7ca315951502a097c6e24ad8881caa1 | Python | jkjung-avt/tensorrt_demos | /utils/mtcnn.py | UTF-8 | 17,091 | 2.875 | 3 | [
"MIT",
"CC-BY-NC-SA-4.0",
"Apache-2.0"
] | permissive | """mtcnn_trt.py
"""
import numpy as np
import cv2
import pytrt
PIXEL_MEAN = 127.5
PIXEL_SCALE = 0.0078125
def convert_to_1x1(boxes):
"""Convert detection boxes to 1:1 sizes
# Arguments
boxes: numpy array, shape (n,5), dtype=float32
# Returns
boxes_1x1
"""
boxes_1x1 = boxes.cop... | true |
a87f60624d25883e8928a43eef10660fc2b21b98 | Python | cesclee/intflowtest | /linktest01.py | UTF-8 | 327 | 2.53125 | 3 | [] | no_license | #mysqldb python으로 연동가능여부확인
import pymysql
conn=pymysql.connect
conn=pymysql.connect(host='localhost', user='root',password='rhtmxhq12@L', db="task01_intflowtest",charset='utf8')
curs=conn.cursor()
sql="select * from member"
curs.execute(sql)
rows = curs.fetchall()
print(rows)
conn.close()
| true |
081dd9751b014be0323a6a271f4436988f4556d7 | Python | bellyfat/Volunter_Scheduler | /Volunteer_Scheduler.py | UTF-8 | 6,315 | 2.828125 | 3 | [] | no_license | import xlwings as xw
from pandas import DataFrame
class Volunteer():
id = -1
consecutiveWorkday = 0
totalDaysOff = 0
schedule = []
def __init__(self, id, consecutiveWorkingDay,totalDaysOff,schedule):
self.id = id
self.consecutiveWorkday = consecutiveWorkingDay
s... | true |
596886fab76d4e3d1b319e6d223caaab5b07c08f | Python | fdm1/financier | /budget_builder/budget_builder/budget_event.py | UTF-8 | 2,809 | 3.484375 | 3 | [] | no_license | """Object to represent budget events"""
from datetime import date
class UnsupportedEventType(Exception):
"""Error for when unknown event types are given"""
pass
class BudgetEvent(object):
"""
An item used to define a recurring or one-time
budgeting event (e.g. payday, bills, bonuses, trips)
... | true |
dbb6f06d6e3c8c79c7b7ab19b52906c31194f46c | Python | AnaGVF/Programas-Procesamiento-Imagenes-OpenCV | /NumeroPrimo_Version2.py | UTF-8 | 288 | 4 | 4 | [] | no_license | # Nombre: Ana Graciela Vassallo Fedotkin
# Fecha: 13 de Enero 2021.
numero = 5
contador = 0
for i in range(1, numero+1):
if(numero%i == 0):
contador = contador + 1
if(contador == 2):
print("El número",{numero}, "es primo")
else:
print("El número",{numero}, "no es primo") | true |
49b5770870c9a26293a5fb8da249aa860c9ef2a5 | Python | tijgerkaars/AdventofCode2019 | /Day_9/Main.py | UTF-8 | 1,688 | 2.890625 | 3 | [] | no_license | import time
import math
from intComp import opComp
def get_input(name = '', test = False):
if not name:
if test:
name = r'/'.join(__file__.split(r'/')[-3:-1]) + r'/test_input.txt'
else:
name = r'/'.join(__file__.split(r'/')[-3:-1]) + r'/input.txt'
if name != '':
... | true |
a3117501938f1278da1dfa43de77a2193a0588ed | Python | benkiel/python_workshops | /2018_3_Cooper_Type/Samples/set_vertical_metrics.py | UTF-8 | 936 | 2.546875 | 3 | [
"MIT"
] | permissive | fonts = AllFonts()
min = 0
max = 0
maxGlyph = ''
minGlyph = ''
for font in fonts:
for glyph in font:
if glyph.box is not None:
if glyph.box[1] < min:
min = glyph.box[1]
minGlyph = glyph.name + ' ' + font.info.familyName + font.info.styleName
if glyph.... | true |
ff7d69e7eb2802e00133c9f4718d65a012626f28 | Python | sandipsinha/python_bits | /pythonBST.py | UTF-8 | 798 | 3.640625 | 4 | [] | no_license | class Node:
def __init__(self, value):
self.value = value
self.leftChild = None
self.rightChild = None
def insert(self, data):
if self.value < data:
if self.rightChild is not None:
self.rightChild.insert(data)
else:
self.ri... | true |
a0b8547f79c3c867c5324da72ced7de37abe04dd | Python | vaidyaenc/vaidya | /201902-aruba-py-1/multi-threadinig-demos/demo03-count-down.py | UTF-8 | 430 | 3.03125 | 3 | [] | no_license | import threading as t
import sys
def count_down():
name=t.current_thread().name
max=100
while max>0:
print('{} counts {}'.format(name,max))
max-=1
print('{} ends'.format(name))
def main(name,args):
t1=t.Thread(target=count_down)
t2=t.Thread(target=count_down)
t1.start()... | true |
53447f28c36164416a25f5e5775033a5d8568ea5 | Python | stoddabr/research_robotics_arm | /ResearchRobotics/run_server.py | UTF-8 | 2,564 | 2.609375 | 3 | [] | no_license | import time
import os
from flask import Flask, send_file, request
from markupsafe import escape
import json
import random
import db_txt as db
def reset():
default_grasp_data = [0,0,False] # [angle, object_coords, is_grasp]
default_blobs_data = [ # TODO double check format
{'x': '50','y': '50', ... | true |
9c804f6149ccd71cfbfd550ad465a0f6fc6f36d5 | Python | awaq96/ISS-Flyover-Time | /test/open_notify_service_test.py | UTF-8 | 3,967 | 2.578125 | 3 | [] | no_license | import unittest
from open_notify_service import *
from unittest.mock import patch, Mock
import open_notify_service
class open_notify_service_test(unittest.TestCase):
def test_canary(self):
self.assertTrue(True)
def test_get_raw_response(self):
location = (29.7216, -95.3436)
api_response = get_raw_r... | true |
046e21d7279f1299eeb09eedc79ff2803c41d603 | Python | Anmol406/Automation-code-sample | /working with frames.py | UTF-8 | 1,279 | 2.6875 | 3 | [] | no_license | #IN FRAME WORK XPATH DONT WORK TO FIND THE FRAME
# from selenium import webdriver
# from selenium.webdriver.common.by import By
# import time
# driver=webdriver.Chrome(executable_path="C:\driver\chromedriver.exe")
# driver.get("https://seleniumhq.github.io/selenium/docs/api/java/index.html")
# driver.switch_to.frame(... | true |
b4c782a90afb1b9d5fe4ab1260893e55f91e597e | Python | talpallikar/ml-python-book | /adaline/plot.py | UTF-8 | 746 | 2.6875 | 3 | [] | no_license | import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
from matplotlib.colors import ListedColormap
import adaline
fig, ax = plt.subplots(nrows=1, ncols=2, figsize=(8, 4))
ada1 = adaline.AdalineGD(n_iter=10, eta=0.01).fit(X, y)
ax[0].plot(range(1, len(ada1.cost_) + 1), np.log10(ada1.cost_), marker='... | true |
1011e709107c55a2f6644173237bd71704dc67b8 | Python | mayerll/Via | /listExeFile.py | UTF-8 | 195 | 2.9375 | 3 | [] | no_license | # List all the execlusive files in a given dir (Python)
import os
path = '/home/data_analysis/tools/'
files = os.listdir(path)
for f in files:
if f.lower().endswith('*.exe'):
print(f)
| true |
3aca67637f893b39de474448926206c7f5745c34 | Python | ravisjoshi/python_snippets | /DataStructure/Trees/SymmetricTree.py | UTF-8 | 924 | 4.125 | 4 | [] | no_license | """
Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center).
For example, this binary tree [1,2,2,3,4,4,3] is symmetric:
1
/ \
2 2
/ \ / \
3 4 4 3
But the following [1,2,2,null,3,null,3] is not:
1
/ \
2 2
\ \
3 3
Follow up: Solve it both recursiv... | true |
da384667920c21ccb9bae113a71f71efb33750cf | Python | DarkAlexWang/leetcode | /Huawei/sherlock_date.py | UTF-8 | 1,250 | 3.21875 | 3 | [] | no_license | import sys
#strings = []
#for i in range(4):
# line = sys.stdin.readline().strip()
# values = list(map(str, line.split()))
# for string in values:
# strings.append(string)
strings = ['3485djDkxh4hhGE',
'2984akDfkkkkggEdsb',
's&hgsfdk',
'd&Hyscvnm'
]
s1 = strings[0]
s2 = ... | true |
d19ad90d8c09e30ca54b535f02262aa8aef1faa0 | Python | BrunoPanizzi/sudoku | /sudoku.py | UTF-8 | 4,110 | 3.078125 | 3 | [] | no_license | import pygame
'''
TO DO:
solver algorithm
generator algorithm
'''
board = [[' ' for i in range(9)] for i in range(9)]
board = [
[ 6 , 2 ,' ', 9 ,' ',' ',' ',' ',' '],
[' ',' ', 9 ,' ',' ',' ',' ', 5 , 2 ],
[' ',' ',' ', 7 ,' ', 1 , 9 ,' ',' '],
[' ',' ',' ', 6 ,' ',' ',' ', 1 ,' '],
[ 4 ,' ', 6 ,'... | true |
ff86d332b2a6ce058bdcf63165255e9ab3c31b59 | Python | PaulienvandenNoort/Elliptische_krommen | /Backdoor.py | UTF-8 | 5,769 | 3.34375 | 3 | [] | no_license | import math
import copy
class ElliptischeKromme:
def __init__(self,a,b,p):
self.a = a
self.b = b
self.p = p
def __str__(self):
if -16*(4*self.a**3+27*self.b**2)!=0:
return 'E: y^2 = x^3 + ' + str(self.a) + 'x + ' + str(self.b)
else:
... | true |
6b83df1846cd379c16d52559a3f8cf770528aa15 | Python | MariaIsabelLL/Python_NLTK | /ch03/ejercicios03.py | UTF-8 | 8,523 | 3.84375 | 4 | [] | no_license | ''' https://www.nltk.org/book/ch03.html
'''
import nltk
from urllib import request
from bs4 import BeautifulSoup
from nltk.corpus import names
from nltk import word_tokenize
from nltk.corpus import words
import re
# loads an list full of names
options = names.fileids()
name_options = [names.words(f) for f in options]... | true |
dcf6a46087648db47ebe40b327c42941bf2f2957 | Python | JanKulbinski/Compression | /lab7/code.py | UTF-8 | 1,056 | 2.90625 | 3 | [] | no_license | from sys import argv
import sys
def readFile(name):
with open(name, "rb") as file:
byte = file.read()
bits = str(bin(int.from_bytes(byte,"big")))[2:]
front = '0'*((8 - (len(bits) % 8)) % 8)
return front + bits
def codeHamming(bits):
p1 = (int(bits[0]) + int(bits[1]) + int(bits[3]))... | true |
7597ae68adc85c5d145985328503f54a9ff148f8 | Python | valen214/new-app | /code/multi.py | UTF-8 | 2,425 | 3.0625 | 3 | [] | no_license |
import hashlib
import multiprocessing as mp
X = "ManChingChiu"
Y = "17051909D"
hX = hashlib.sha256(bytes(X, "utf-8"))
hY = hashlib.sha256(bytes(Y, "utf-8"))
hX6 = hX.copy().digest()[:6]
def func(q):
"""
how to further optimize depends on which
operation takes the most time
"""
suffix = q.get()
... | true |
996c68d38abde8c209a86703bfb786e817b099c3 | Python | jenh/epub-ocr-and-translate | /eoat-printlang.py | UTF-8 | 724 | 3.4375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
# Takes an input and prints only the language specified
# Usage: python print-lang.py [filename] [lang-code]
# i.e., python print-lang.py 04.md ru or python print-lang.py 04.md en
import sys
from langdetect import detect
input_file = sys.argv[1]
lang = sys.argv[2]
output_file = (input_file.rsp... | true |
9060d147c3cc09cbbd5ac641508948306ca4a974 | Python | chinudev/hacker | /misc/geometric_trick.py | UTF-8 | 5,628 | 3.890625 | 4 | [] | no_license | #https://www.hackerrank.com/contests/w32/challenges/geometric-trick
import math
class FactorClass:
# we will be asked to factor a number <= maxN
def __init__(self, maxN):
"Create a prime store with primes <= sqrt(maxN)"
self.maxN = maxN
self.sqrtN = int(math.sqrt(maxN))
self.num... | true |
d8f4140d2bb256c738ede90637c097b913bb3ffe | Python | fr33zik/servo_arm | /sources/rpi/rpi_gpio/demo_sw_rpigpio.py | UTF-8 | 391 | 2.921875 | 3 | [] | no_license | import RPi.GPIO as GPIO
from time import sleep
GPIO.setmode(GPIO.BCM)
GPIO.setup(21, GPIO.OUT)
sw_pwm = GPIO.PWM(21, 50)
sw_pwm.start(2.5)
try:
while 1: # Loop will run forever
sw_pwm.ChangeDutyCycle(10) # Move servo to 90 degrees
sleep(1) ... | true |
6672eea595a242b4198316e0881e5c9d918954ae | Python | EugeneJenkins/pyschool | /Strings/21.py | UTF-8 | 195 | 3.296875 | 3 | [] | no_license | def isAllLettersUsed(word, required):
for c in required:
if c not in word:
return False
else:
return True
a=isAllLettersUsed('apple', 'google')
print (a) | true |
15d34333c9c01ffd072fdc024317140bb2a295c3 | Python | lsmoriginal/RPS_games | /players/Psychology.py | UTF-8 | 635 | 3.171875 | 3 | [] | no_license |
def win_action(action):
'''
return the action that would win the given action
'''
return (action + 1)%3
mymoves = [0]
oppmoves = []
def psycholoy_method(observation, configuration):
opp_last_act = observation.lastOpponentAction if observation.step != 0 else 0
oppmoves.append(opp_last_act)
... | true |
6d613d8a84686ff284e9661636423258c5baa40a | Python | ryotosaito/sukkirisu | /src/sukkirisu.py | UTF-8 | 2,812 | 2.984375 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
from bs4 import BeautifulSoup
import json
import urllib.parse
import urllib.request
import re
import sys
url = 'http://www.ntv.co.jp/sukkiri/sukkirisu/index.html'
def lambda_handler(event, context):
birth_month = int(urllib.parse.parse_qs(event['body'])['text'][0].rstrip())
result = g... | true |
b41f255751b756f4fb9ba589628d9406bbb4bb02 | Python | Yuudachi530/Assignment | /Programming Ex/s-2017-qp-23/q5_SearchFile.py | UTF-8 | 505 | 3.109375 | 3 | [] | no_license | LoginEvents = []
FileHolder = open('LoginFile.txt', 'r')
InfoHolder = FileHolder.readlines()
FileHolder.close()
def SearchFile():
UserIDInput = input('enter the user ID: ')
for i in InfoHolder:
if i[:5] == UserIDInput:
if i[-1:] == '\n':
s = i[:-1]
... | true |
ac9c8d6dc1f6f1b2fae1c23fa54b3f2456895434 | Python | kvarada/constructiveness | /src/data/constructiveness_data_collector.py | UTF-8 | 11,480 | 2.90625 | 3 | [
"MIT"
] | permissive | #!/usr/local/bin/python3
__author__ = "Varada Kolhatkar"
import pandas as pd
import numpy as np
from normalize_comments import *
COMMENT_WORDS_THRESHOLD = 4
CONSTRUCTIVENESS_SCORE_THRESHOLD = 0.6
class ConstructivenessDataCollector:
'''
A class to collect training and test data for constructiveness
fr... | true |
c7145352f7da20cca584a19a59bd8cf64a1cac64 | Python | satojkovic/algorithms | /problems/test_move_zeros.py | UTF-8 | 1,115 | 2.953125 | 3 | [] | no_license | import unittest
from move_zeros import move_zeros1, move_zeros2, move_zeros3, move_zeros4
from nose.tools import eq_
class TestMoveZeros(unittest.TestCase):
def setUp(self):
self.test_cases = []
self.test_cases.append([0, 1, 0, 3, 12])
self.test_cases.append([0])
self.test_cases.app... | true |
c8c6270292d42b41ea136e26c5ac4b7a75a6bc11 | Python | johnbrannstrom/zipato-extension | /src/error.py | UTF-8 | 402 | 2.703125 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
"""
.. moduleauthor:: John Brännström <john.brannstrom@gmail.com>
Error
******
This module contains exceptions.
"""
class ZipatoError(Exception):
def __init__(self, message):
"""
Constructor function.
:param str message:
"""
self._message = mes... | true |
6a99b44f633f35f38c788d2e123fa0d507c50cc9 | Python | exe1099/Backplane | /Debugging/curses_table.py | UTF-8 | 482 | 3.0625 | 3 | [] | no_license | import tableprint as tp
import numpy as np
import time
print(tp.header(["A", "B", "C"], width=20) )
for x in range(3):
data = np.random.randn(3)
print(tp.row(data, width=20), flush=True)
time.sleep(1)
data = np.random.randn(3)
print(tp.row(data, width=20), flush=True)
time.sleep(1)
data = ... | true |
9839c36b84c2a0d43c22db8dcbc2664d0ea1a103 | Python | Buenz/python | /1/price.cost.py | UTF-8 | 423 | 3.046875 | 3 | [] | no_license | import os, pandas as pd, math
dirpath = os.getcwd()
print("Current directory is the following: " + dirpath)
g=input("Please insert path to file + file.txt: ")
print("Please see minimum price below:\n")
#g="/Users/harrisonbueno/Desktop/NMI/product_costs.txt"
file_txt=pd.read_csv(g, sep=" ", header=None)
for i in r... | true |
ce673e16210e72b7cba0120dea899165bc5d7348 | Python | jakecoffman/euler-solutions | /5.py | UTF-8 | 231 | 3.5625 | 4 | [] | no_license | def is_divisible(number):
for i in xrange(21, 2, -1):
if number%i != 0:
return False
return True
i = 20
while True:
if is_divisible(i):
print i
break
i += 20
| true |
5b7ce5b356f9fbae6acb10ee6736e7e0075cd9a6 | Python | amoantony/python-codes-begginers- | /divisible by number.py | UTF-8 | 172 | 3.765625 | 4 | [] | no_license | print("Enter no of numbers ")
ra=int(input())
for i in range(ra):
mylist[i]=int(input("Enter number ",i))
for i in range(5):
print("Number 1 is :",mylist[i])
| true |
bfb888b4feeb501302b393155fab270d6322f110 | Python | AdvTop-ML-Team3/Project | /main.py | UTF-8 | 4,983 | 2.890625 | 3 | [] | no_license | import argparse
import numpy as np
import specifications
from wrapped import train, predict
def main():
parser = argparse.ArgumentParser()
parser.add_argument('--num_train', "-train", type=int, default=100, help='Size of the training dataset, 1 to 1000')
# -4, -5 denotes extra tasks "shortest path" and ... | true |
2f75992f55b740abf7374ff787c1837355d2e3ce | Python | nazhimkalam/Complete-Python-Crash-Couse-Tutorials-Available | /completed Tutorials/Functions.py | UTF-8 | 367 | 4.5 | 4 | [] | no_license | #Functions have to be declared at first then later only the main program comes
def firstFunc():
print ('This is my first function')
def secondFunc(number,string):
print('This function takes in parameters of two types\n')
print('This is a number ' + str(number))
print('This is a string ' + string)
#m... | true |
49d52dff2dc39748b570e265aeb55e37c23262c9 | Python | D4r7h-V4d3R/Ornekler | /reduce().py | UTF-8 | 584 | 3.65625 | 4 | [] | no_license | from functools import reduce
#Bir Listenin en Büyük elemanını bulmak
#Birinci Yol
liste = [1,2,32,54,3,63,74,2,45,24,62,4]
print(max(liste))
#İkinci Yol
q = lambda a,b: a if (a>b) else b
print(reduce(q,liste))
#Bence bir yolu daha var X)
yenil = []
for i in liste:
if i >50:
yenil.appe... | true |
64649bd48473b3905b43103791f3deb4b018ef10 | Python | msullivancm/CursoEmVideoPython | /Mundo2-ExerciciosEstruturasDeRepeticao/ex068.py | UTF-8 | 695 | 4.03125 | 4 | [] | no_license | from random import randrange
print('=-'*20)
print('Vamos jogar Par ou Impar')
print('=-'*20)
while True:
n = int(input('Digite um valor: '))
pi = input('Par ou ímpar? [P/I]')
comp = randrange(0,10,1)
total = (n + comp)
if total % 2 == 0:
print(f'Você jogou {n} e o computador jogou {comp}. To... | true |
e904e7da2d606ab03163f14398553d0f9f5a9685 | Python | kragebein/PythonFun | /pat/durr.py | UTF-8 | 1,847 | 3.1875 | 3 | [] | no_license | #!/usr/bin/python3.8
import requests
from bs4 import BeautifulSoup
search = 'https://mrplant.se/en/product-search/'
url = 'https://mrplant.se/'
input = ''
with open('input.txt', 'r') as brrt:
input = brrt.read().split('\n')
brrt.close()
print('parsing {} items\n'.format(len(input)))
def get(id):
x = re... | true |
d4364810822a927dd61b5cbc322d404e1801e8fd | Python | SudhirGhandikota/LeetCode | /Python_solutions/twoSum.py | UTF-8 | 418 | 3.21875 | 3 | [] | no_license | class Solution:
def twoSum(self, nums: list[int], target: int) -> list[int]:
visited = {}
for idx, num in enumerate(nums):
diff = target - num
if diff in visited:
return [visited[diff], idx]
visited[num] = idx
if __name__ == '__main__':
nums =... | true |
976957ba5ea0c557e39b76126b423b181c73a991 | Python | mrfourfour/tcp_to_http | /HTTP/Http.py | UTF-8 | 2,376 | 2.890625 | 3 | [] | no_license | import socket
# 서버키는거, 라우트 매핑, 반환< 이건 해야댐
class Http(object):
def __init__(self, host, port):
self.host = host
self.port = port
self.routers = {}
def not_found(self):
return "404 Not Found"
def route(self, routerName, methods=["GET"]):
def wraps(f):
self... | true |
1fc25fba92542c70729bb78fdd68a1f82aa7b3b0 | Python | Aasthaengg/IBMdataset | /Python_codes/p03074/s842788646.py | UTF-8 | 339 | 2.671875 | 3 | [] | no_license | n, k = map(int, input().split())
s = input()
l = [0]
for i in range(n - 1):
if s[i] != s[i + 1]:
l.append(i + 1)
l += [n]
le = len(l)
ans = 0
for i in range(le - 1):
if s[l[i]] == "0":
ans = max(ans, l[min(le - 1, k * 2 + i)] - l[i])
else:
ans = max(ans, l[min(le - 1, k * 2 + i + 1)]... | true |