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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
54124b431890f909225b91effeec27bde1035547 | Python | Xiangfeidetangyuan/Medicine | /Inform/Inform_DB_helper.py | UTF-8 | 3,882 | 2.734375 | 3 | [] | no_license | import sqlite3
class Inform:
def __init__(self, medicineName, remarks, frequency, hour, minute, id):
self.medicinename = medicineName
self.remarks = remarks
self.frequency = frequency
self.hour = hour
self.minute = minute
self.id = 1
class InformDBHelper:
def ... | true |
01ab82a4b8b92bdfe6ff932b11bf4cdab01e8b44 | Python | Aravind-Venugopal/TitanicRoulette | /titanic_model.py | UTF-8 | 2,198 | 2.890625 | 3 | [] | no_license | import pandas as pd
import numpy as np
import re, joblib
from sklearn.ensemble import RandomForestClassifier
train = pd.read_csv('train.csv')
test = pd.read_csv('test.csv')
deck = {"A": 1, "B": 2, "C": 3, "D": 4, "E": 5, "F": 6, "G": 7, "U": 8}
data = [train, test]
for dataset in data:
dataset['Cabin'] = dataset... | true |
cc5e892addaaa7b8aeec7d79d90a7eb8dc531f5a | Python | a-johnston/pls-not-concave | /optimize.py | UTF-8 | 1,580 | 3.515625 | 4 | [] | no_license | """ Some experiment with convex optimization
"""
def _eval_offset(f, X, i, offset):
temp = list(X)
temp[i] += offset
return f(*temp)
def _subgradient(f, X, step=1e-12):
G = [0] * len(X)
for i in range(len(X)):
y1 = _eval_offset(f, X, i, step)
y2 = _eval_offset(f, X, i, -step)
... | true |
10c0ed3d5a7208cc045c3d426fac3fa82bfce55d | Python | SilasHenderson/Python_OpenGL | /snake.py | UTF-8 | 2,589 | 3.65625 | 4 | [] | no_license | # gl Snake {Silas Henderson 2019}
# -- press keys up, down, left, right to move snake
import numpy
import pygame
from pygame.locals import *
from OpenGL.GL import *
from OpenGL.GLU import *
# -------------------------- Snake Class ----------------------------------
class... | true |
e717a56782f3a3d47d067f544ac52a4cd62f4e7e | Python | rhender007/python-ps | /built_in_functions/zip_ex02.py | UTF-8 | 172 | 3.59375 | 4 | [] | no_license | a = [1, 2, 3, 4, 5]
b = [11, 12, 13, 14, 15]
result = []
for first, second in zip(a, b):
result.append(first + second)
print(result)
# output: [12, 14, 16, 18, 20]
| true |
f74acadb3112cc6623cb47ccc50ab4e4f8397171 | Python | Aasthaengg/IBMdataset | /Python_codes/p03838/s579436739.py | UTF-8 | 227 | 3.28125 | 3 | [] | no_license | x, y = map(int, input().split())
if x*y < 0:
print(abs(abs(x)-abs(y))+1)
elif x*y == 0:
if x < y:
print(y-x)
else:
print(x-y+1)
else:
if x < y:
print(y-x)
else:
print(x-y+2)
| true |
3dbf0d8287a871b8b3cd91ccfaad5dc1b4e03a4b | Python | Scavi/RpgCrawler | /AppStart.py | UTF-8 | 3,594 | 2.96875 | 3 | [] | no_license | import os
import logging
import argparse
from core.RpgCrawler import RpgCrawler
from interaction.AbstractIO import AbstractIO
from interaction.ConsoleIO import ConsoleIO
from sheet.AbstractSpreadAccess import AbstractSpreadAccess
from sheet.GSpreadAccess import GSpreadAccess
def create_argument_parser() -> argparse.A... | true |
50c08eba4237452e1cf76b1412390254a85a6a89 | Python | jjguti/aoc2020 | /4/1.py | UTF-8 | 616 | 2.671875 | 3 | [] | no_license | def validate(entry, required_fields):
for field in required_fields:
if field not in entry:
return False
return True
entries = []
entry = {}
with open("input") as f:
for line in f:
line = line.strip()
if not line:
entries.append(entry)
entry = {}
... | true |
140734be7b0ebe08a193862c606524fd6b803cb2 | Python | mohitraj/mohitcs | /Learntek_code/10_july_18/list3.py | UTF-8 | 90 | 2.53125 | 3 | [] | no_license | GoT = ["Tyrion","Sansa", "Arya","Joffrey","Ned-Stark"]
a = GoT.pop(2)
print a
print GoT | true |
ded370bd1ef6fc56ccea309ef447f581815150ba | Python | ch3rolll/CarND-Behavioral-Cloning-P3 | /model_nvi.py | UTF-8 | 5,513 | 2.609375 | 3 | [] | no_license | import os
import csv
import pandas
import cv2
import sklearn
import numpy as np
from random import shuffle
from sklearn.model_selection import train_test_split
from keras.models import Sequential, Model
from keras.regularizers import l2
from keras.layers import Flatten, Dense, Activation, Lambda, Conv2D, pooling, Cropp... | true |
b648ec1c1dbe3dd69568c117a45f199e94805a63 | Python | ITISFoundation/osparc-simcore | /services/dask-sidecar/src/simcore_service_dask_sidecar/computational_sidecar/task_shared_volume.py | UTF-8 | 1,758 | 2.515625 | 3 | [
"MIT"
] | permissive | import asyncio
import logging
import shutil
from dataclasses import dataclass
from pathlib import Path
from types import TracebackType
logger = logging.getLogger(__name__)
@dataclass(frozen=True)
class TaskSharedVolumes:
base_path: Path
def __post_init__(self) -> None:
for folder in ["inputs", "outp... | true |
db868a76b8ddc2fbabf60e033e21c264c21ee556 | Python | singcl/pypy | /python_100_days/1.11_csv1.py | UTF-8 | 454 | 3.28125 | 3 | [] | no_license | #!usr/bin/python
# -*- coding: utf-8 -*-
"""
读取CSV数据
Version: 0.1
Author: singcl
Date: 2019-01-30
"""
import csv
filename = 'example.csv'
try:
with open(filename) as f:
reader = csv.reader(f)
data = list(reader)
except FileNotFoundError:
print("无法打开文件", filename)
else:
for item in data:
... | true |
591b5335d4506564825caa7e73feaf40ecfa4b11 | Python | ScottBogen/current-song-lyrics | /connector.py | UTF-8 | 1,058 | 2.921875 | 3 | [] | no_license | import requests
import json
import spotipy
from song import Song
from spotipy.oauth2 import SpotifyOAuth
# This class will represent the part of the program that fetches Spotify's API and returns a song object
class SongFetcher():
def __init__(self, scope):
self.sp = spotipy.Spotify(auth_manager=Spotify... | true |
756de45127fec174edca13b6cf1dd5493d25db54 | Python | saitejapa/new | /new_multiple.py | UTF-8 | 310 | 3.65625 | 4 | [] | no_license | def main():
num = input('Insert number:')
output = sumOfMultiples(num)
print(output)
def sumOfMultiples(param):
j = 0
i = 0
for i in range(i, param):
if (i % 3 ==0) or (i % 5 == 0) and (i % 15 != 0):
j = j + i
return j
if __name__ == '__main__':
main()
| true |
41b56fe11c2a320e938cbe8f40985508df408e90 | Python | mrchenbo/jvm-in-python | /instructions/base/method_invoke_logic.py | UTF-8 | 388 | 2.921875 | 3 | [] | no_license | def InvokeMethod(invokerFrame, method):
thread = invokerFrame.Thread()
newFrame = thread.NewFrame(method)
thread.PushFrame(newFrame)
argSlotSlot = method.ArgSlotCount()
if argSlotSlot > 0:
i = argSlotSlot - 1
while i>=0:
slot = invokerFrame.OperandStack().PopSlot()
... | true |
0a454319ece95305db588167fa0a35f7988a72c8 | Python | perkinsml/dfsummary_package_PyPI | /dfsummary/dfsummary.py | UTF-8 | 12,056 | 3.359375 | 3 | [
"MIT"
] | permissive | from .dfsummary_helpers import return_df_summary, return_heatmap_data
from matplotlib import cm, pyplot as plt
import pandas as pd
import numpy as np
import seaborn as sns
class DfSummary(object):
"""The DfSummary object is a dataframe object with methods to provide
descriptive statistics and formatted visual... | true |
519831dc8f85dcf2b6dcb3a26ceda35429711f40 | Python | tomer-melamed/dataScienceProject | /Scrappers/scrapper_one.py | UTF-8 | 2,054 | 2.78125 | 3 | [] | no_license | from Scrappers.scrappers import Scrapers
from lxml import etree
class ScrapperOne(Scrapers):
BASE_URL = 'http://www.fullbooks.com'
MAX_REQUESTS = 100
def get_text(self):
response = self.request(url=self.BASE_URL)
tree = etree.HTML(response.text)
refrences = tree.xpath('... | true |
88d3678b6449d1e4af65268b911f3ca3c1e73fef | Python | tible/TT | /tileMatrixPool.py | UTF-8 | 452 | 3.015625 | 3 | [] | no_license | import time
tilePool = []
tilePoolCount = []
for i in range(0,11):
for j in range(0,11):
print '*********', i, '*', j, '=', i*j
if i*j not in tilePool:
tilePool.append(i*j)
tilePoolCount.append(1)
else:
tilePoolCount[tilePool.index(i*j)]+=1
# time.... | true |
9e42ca38fb9beec93741c63dc1187455ac186d02 | Python | Stephanie199/NTU-FYP-URECA | /topic_detection/preproc.py | UTF-8 | 2,614 | 3.078125 | 3 | [] | no_license | #!/usr/bin/env python
#Preprocessing files
import nltk
from nltk.corpus import stopwords
from nltk.stem.wordnet import WordNetLemmatizer
from nltk.stem import PorterStemmer
from num2words import num2words
from ast import literal_eval
import numpy as np
import itertools
import sys
import codecs
import re
import string
... | true |
c34b3c77a7ce57bd274aadcc9e82b634b7f1b6d4 | Python | zzz136454872/leetcode | /allCellsDistOrder.py | UTF-8 | 1,115 | 3.125 | 3 | [] | no_license | from typing import *
class Solution:
def allCellsDistOrder(self, R: int, C: int, r0: int, c0: int) -> List[List[int]]:
queue=[]
visited=[[False for j in range(C)] for i in range(R)]
visited[r0][c0]=True
queue.append([r0,c0])
out=[[r0,c0]]
while len(queue)>0:
... | true |
f3cd52078453b8d710cca3b8e7706f9954d1e921 | Python | lpmeyer/pyiron_base | /pyiron_base/database/manager.py | UTF-8 | 6,490 | 2.546875 | 3 | [
"BSD-3-Clause"
] | permissive | # coding: utf-8
# Copyright (c) Max-Planck-Institut für Eisenforschung GmbH - Computational Materials Design (CM) Department
# Distributed under the terms of "New BSD License", see the LICENSE file.
"""
A class for mediating connections to SQL databases.
"""
from pyiron_base.generic.util import Singleton
from pyiron_b... | true |
3cf8c7dc71ad0acc78666fb3897bcfb6ef10a08e | Python | menstruated/discord-leave-groups | /leave.py | UTF-8 | 3,357 | 2.6875 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import discord, asyncio
import os
import shutil
import subprocess
from discord.ext import commands
import json
import time
import sys
import datetime
import random
import ctypes
if not os.path.exists('config.json'):
data = {
'token': "",
'prefix': "",
... | true |
47ca9b85e69454cceb01a635759ca73e92271b91 | Python | micdm/loto-tools | /btce/prices.py | UTF-8 | 2,183 | 2.703125 | 3 | [] | no_license | #!/usr/bin/env python
# curl https://btc-e.nz/api/3/ticker/ltc_rur-eth_rur-eth_btc-dsh_btc-nmc_usd-ppc_usd-nmc_btc-dsh_usd-eur_usd-eth_eur-ltc_usd-nvc_btc-dsh_eur-usd_rur-ltc_eur-btc_usd-ltc_btc-eth_ltc-ppc_btc-btc_eur-dsh_rur-eth_usd-nvc_usd-dsh_ltc-eur_rur-btc_rur-dsh_eth > data/last.data 2> /dev/null && curl https:/... | true |
dbb377282dd81783b6bb1b55b628fb1f2eab4e60 | Python | destinationunknown/HackerRank | /Contests/Week of Code 37/average rating of top employees.py | UTF-8 | 605 | 3.328125 | 3 | [] | no_license | '''input
5
84
92
61
50
95
'''
#!/bin/python
from __future__ import print_function
import os
import sys
from decimal import Decimal, ROUND_HALF_UP
def averageOfTopEmployees(rating):
#r
average = 0.0
count = 0
for rat in rating:
if rat >= 90 and rat <= 100:
average += rat
count += 1
average = Decimal(av... | true |
3733280a1d43002ccaf2c28e7499cf331aff788b | Python | vaspahomov/chess | /game_serializer.py | UTF-8 | 302 | 2.75 | 3 | [] | no_license | import pickle
class GameSerializer:
def __init__(self):
pass
def save_game(self, figures):
with open("figures.json") as figures_file:
pickle.dump(figures, figures_file)
def load_game(self):
figures = pickle.load("game.json")
return figures
| true |
afdd0990e1d7ce8d7de79649dab1a0165cc796c2 | Python | demisto/content | /Packs/AzureSentinel/Scripts/MicrosoftSentinelConvertEntitiesToTable/MicrosoftSentinelConvertEntitiesToTable_test.py | UTF-8 | 1,485 | 3.40625 | 3 | [
"MIT"
] | permissive | def test_format_entity():
"""
Given:
- An entity
When:
- calling format_entity function
Then:
- Validate the entity is formatted correctly
"""
entity = {'name': 'test', 'kind': 'test_kind', 'type': 'test_type', 'properties': {'testProp': 'test_value'}}
expected = {'n... | true |
e82ac23da9ac3f6b4b9e4a27d85b416fd347b4cd | Python | kmgowda/kmg-leetcode-python | /flower-planting-with-no-adjacent/flower-planting-with-no-adjacent.py | UTF-8 | 716 | 3.34375 | 3 | [
"Apache-2.0"
] | permissive | // https://leetcode.com/problems/flower-planting-with-no-adjacent
class Solution(object):
def gardenNoAdj(self, N, paths):
"""
:type N: int
:type paths: List[List[int]]
:rtype: List[int]
"""
neighbors = dict()
for i, j in paths:
neighbors.setdefa... | true |
9cb7c116ef373c34d76648f8ca7e5e71e3d5bbfd | Python | chenchingnien/III_Project | /PTT_Crawler/defmeta.py | UTF-8 | 1,655 | 2.859375 | 3 | [] | no_license | import requests
from bs4 import BeautifulSoup
title = str()
def get_page_meta(url):
jar = requests.cookies.RequestsCookieJar()
jar.set("over18", "1", domain="www.ptt.cc")
# 先做最基礎的判斷, 非公告和版規我回傳答案
if not "公告" in title and not "版規" in title:
response = requests.get(url, cookies=jar).tex... | true |
f6af38af46ed2f72406558e15cdfe4c0687f75e7 | Python | nachtsky1077/word_embedding_brand | /brand/main.py | UTF-8 | 2,636 | 2.921875 | 3 | [] | no_license | from argparse import ArgumentParser
import traceback
import gensim
import numpy as np
import json
from .debiasing import EmbeddingDebias
from .utils import get_embedding_mat
if __name__ == '__main__':
parser = ArgumentParser()
parser.add_argument('--pretrained_file', action='store', type=str, required=True, he... | true |
a9c3539f330740dd3419f4906e60ca7844fa6f61 | Python | jiadaizhao/LeetCode | /0601-0700/0668-Kth Smallest Number in Multiplication Table/0668-Kth Smallest Number in Multiplication Table.py | UTF-8 | 439 | 2.859375 | 3 | [
"MIT"
] | permissive | class Solution:
def findKthNumber(self, m: int, n: int, k: int) -> int:
if m > n:
m, n = n, m
low = 1
high = m * n
while low < high:
mid = (low + high) // 2
count = 0
for i in range(1, m + 1):
count += min(mid // i, n)
... | true |
edcb6ead35a3e0f365fe71591a008fea06b33061 | Python | starschen/learning | /introduction_MIT/12_4强队的获胜概率.py | UTF-8 | 1,807 | 3.65625 | 4 | [] | no_license | #encoding:utf8
#12.4强队的获胜概率
#模拟世界职业棒球大赛
import random
import pylab
def playSeries(numGames,teamProb):
'''假定是numGames奇数,teamProb是0到1之间的浮点数,如果强队会获胜返回True'''
numWon=0
for game in range(numGames):
if random.random()<=teamProb:
numWon+=1
return (numWon>numGames//2)
def simSeries(numSeri... | true |
b9924b546c35f3ee58579e4efc41c274183ca739 | Python | camdentest/public-test | /NameProgram.py | UTF-8 | 508 | 4.625 | 5 | [] | no_license | # Sample Program
name = input("Hi! What is your name? ")
print("\nHello " + name + "!")
firstLetter = name[0].capitalize()
if firstLetter >= "A" and firstLetter <= "H":
print("Your name is at the beginning of the alphabet")
elif firstLetter >= "I" and firstLetter <= "R":
print("Your name is in the middle... | true |
9bf009c67eed9d5e3054dedd19da012aef00ff3a | Python | asmodehn/aiokraken | /aiokraken/model/tests/strats/st_asset.py | UTF-8 | 734 | 2.671875 | 3 | [
"GPL-1.0-or-later",
"MIT"
] | permissive | import functools
import pandas as pd
from aiokraken.model.asset import AssetClass, Asset
from hypothesis import strategies as st
# Using partial call here to delay evaluation (and get same semantics as potentially more complex strategies)
AssetClassStrategy = functools.partial(st.sampled_from, AssetClass)
@st.com... | true |
7dc3dda377b0bf72b6cd363dcc722365adaaa0c2 | Python | akashrl/Apriori-Algorithm-Python | /association-rules.py | UTF-8 | 8,499 | 2.734375 | 3 | [] | no_license | #alankala
import pandas as pd
import numpy as np
from collections import Counter
import itertools
from pprint import pprint
import copy
from random import randint
import matplotlib.pyplot as plt
import sys
filename = sys.argv[1]
minsup = float(sys.argv[2])
minconf = float(sys.argv[3])
df = pd.read_csv(filename, ke... | true |
f583c9fb165af3966bad7024f5e605896a98257f | Python | Sennevs/custom_tensorflow_snippets | /metrics/backward_kl_divergence.py | UTF-8 | 894 | 3.125 | 3 | [
"MIT"
] | permissive | import tensorflow as tf
class BackwardKLDivergence(tf.keras.metrics.KLDivergence):
def __init__(self, name='backward_kl_divergence', **kwargs):
"""
Custom Keras metric that calculates backward KL-Divergence, which is just the KLDivergence metric class in Keras
with the y_true and y_pred p... | true |
2980d2db7eec31248f67b36616111e2143353c01 | Python | gconybear/soccer-highlights | /app.py | UTF-8 | 2,201 | 2.65625 | 3 | [] | no_license | import dash
import dash_bootstrap_components as dbc
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output
import api_call
app = dash.Dash(__name__, external_stylesheets=[dbc.themes.DARKLY])
server = app.server
DROPDOWN_WIDTH = '500px'
DROPDOWN_COLOR = '#000... | true |
3c62e862e56a06aabb5cc2633a8d1ac6b9e2df17 | Python | Tawkat/Bengali-Spell-Checker-and-Auto-Correction-Suggestion-for-MS-Word | /spell checker/spell_checker.py | UTF-8 | 2,726 | 2.9375 | 3 | [] | no_license | from flask import Flask, jsonify
import re
import sys
import tkinter as tk
import numpy as np
import pandas as pd
import json
import codecs
words = []
with codecs.open('freq_lt_15.txt', mode='r',
encoding='utf-8') as f:
for line in f:
words.append(line.split(' ')[0])
w_rank... | true |
0b28357b3c769cfc3bd5d3cb4b79fce2f79bc7d2 | Python | mkalinin/eth2.0-specs | /test_libs/pyspec/eth2spec/debug/random_value.py | UTF-8 | 4,841 | 3.15625 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"CC0-1.0"
] | permissive | from random import Random
from typing import Any
from enum import Enum
UINT_SIZES = [8, 16, 32, 64, 128, 256]
basic_types = ["uint%d" % v for v in UINT_SIZES] + ['bool', 'byte']
random_mode_names = ["random", "zero", "max", "nil", "one", "lengthy"]
class RandomizationMode(Enum):
# random content / length
... | true |
945f773e2d9fc40b592f830c7c97d1262869944c | Python | priyadharshinikrishnana/pro | /pro7.py | UTF-8 | 272 | 3.03125 | 3 | [] | no_license | priya1=int(input())
priya2=list(map(int,input().split()))
viji=0
for x in range(len(priya2)-2):
for y in range(x+1,len(priya2)-1):
for z in range(y+1,len(priya2)):
if priya2[x]<priya2[y]<priya2[z] and x<y<z:
viji=viji+1
print(viji)
| true |
33bbce4312f752fc595d5103b023aeaab31b7ff4 | Python | Ntakato/AtCoder | /ABC133/b.py | UTF-8 | 495 | 3.15625 | 3 | [] | no_license | import math
def dis(n,x,y):
distance = 0
for i in range(len(x)):
distance += (x[i]-y[i])*(x[i]-y[i])
# print(distance)
return math.sqrt(distance)
n,d = [int(i) for i in input().split()]
x = [[int(i) for i in input().split()] for i in range(n)]
# print(x)
ans = 0
for i in range(n):
for j... | true |
7a35a586185aa441183a08b6ae4f31af4f347a22 | Python | channghiep/snake_game | /main.py | UTF-8 | 1,257 | 3.234375 | 3 | [] | no_license | from turtle import Turtle, Screen
import time
from snake import Snake
from food import Food
from scoreboard import Scoreboard
screen = Screen()
screen.setup(width=600, height=600)
screen.bgcolor("black")
screen.tracer(0)
snake = Snake()
food = Food()
scoreboard = Scoreboard()
screen.listen()
screen.onkey(snake.snake_... | true |
7d3af9e433d5cbaf94699721f0b9ab8b7dcd9254 | Python | jiyabing/learning | /开班笔记/python基础部分/day16/code/try_except1.py | UTF-8 | 929 | 4.34375 | 4 | [] | no_license | #此示例示意用try-except语句来捕获异常
def div_apple(n):
'此示例用分苹果来示意捕获异常'
print('%d个苹果你想要分给几个人?' %n)
s = input('输入人数:')
cnt = int(s) #<--此处可能会引起ValueError类型的错误
result = n / cnt #<--此处可能会引起ZeroDivisionError类型的错误
print('每人分了',result,'个苹果')
try:
div_apple(10)
#第一种
except ValueError:
print('发生了值错误,以转... | true |
0fd6640655df9fb6e97f357cd5a2feb27b9b2517 | Python | kalvare/machine_learning | /core/unit_tests/test_activations.py | UTF-8 | 493 | 2.578125 | 3 | [
"MIT"
] | permissive | import unittest
import torch
import numpy as np
from core.activations.activations import relu_grad
class TestActivations(unittest.TestCase):
def test_relu_gradient(self):
x = torch.zeros(4, 100)
x[2, 62] = 1
x[3, 79] = 15
x[1, 43] = 0
x[0, 29] = -5
grad = relu_gra... | true |
3a5e080ee20cd348ced277f49c79b5ad762b0073 | Python | leduykhanh/codehehiew | /question3.py | UTF-8 | 5,619 | 3.328125 | 3 | [] | no_license | from collections import OrderedDict, deque
from copy import copy, deepcopy
class Vertex(object):
def __init__(self, name, weight):
self.name = name
self.weight = weight
def __eq__(self, other):
if isinstance(other, self.__class__):
return self.__dict__ == other.__dict__
... | true |
b0952fe725570375d3f8dd23f0cf0ed191b03e42 | Python | SimonBerens/StuyHacksVII | /utils/authenticate.py | UTF-8 | 2,533 | 3.296875 | 3 | [] | no_license | import sqlite3
from werkzeug.security import generate_password_hash, check_password_hash
def register_user(username, password, repassword):
'''
Attempts to register a user and enter it in the users table.
Returns a tuple containing a boolean indicating success
and a message to flash to the user.
''... | true |
d1421b78db5ba84d402752f4f0a9edce9f28a433 | Python | gjwlsdnr0115/Computer_Programming_Homework | /lab4_2015198005/lab4_p1.py | UTF-8 | 557 | 4.1875 | 4 | [] | no_license | # user input
income = int(input('Enter the taxable income in USD: '))
# initializing tax variable
tax = 0
if income <= 750:
tax = income * 0.01
elif income <= 2250:
tax = (income - 750) * 0.02 + 7.50
elif income <= 3750:
tax = (income - 2250) * 0.03 + 37.50
elif income <= 5250:
tax = (income - 3750) *... | true |
c0fb26d9cb757c972f03f4ccd27a46c227e98046 | Python | handevmin/DataStructure-and-Algorithm | /DP/1904_01타일.py | UTF-8 | 182 | 2.921875 | 3 | [] | no_license | import sys
n = int(sys.stdin.readline())
memory = [0]*1000001
memory[1] = 1
memory[2] = 2
for i in range(3,n+1):
memory[i] = (memory[i-1] + memory[i-2]) %15746
print(memory[n])
| true |
5157c5df50c576c7b12ac81fa84a9f6f52fde196 | Python | ashutosh-narkar/LeetCode | /stock_market_1.py | UTF-8 | 860 | 4.65625 | 5 | [] | no_license | #!/usr/bin/env python
'''
Beating the stock market
Say you have an array for which the ith element is the price of a given stock on day i.
If you were only permitted to complete at most one transaction (ie, buy one and sell one share of the stock),
design an algorithm to find the maximum profit.
'''
def bestBuySell... | true |
a114eed2c512166df0689cc5050d156d668abbc0 | Python | daniel-reich/ubiquitous-fiesta | /4gDNqQB355FFGFFWN_9.py | UTF-8 | 137 | 2.625 | 3 | [] | no_license |
def available_spots(lst, num):
return sum([ (lst[idx-1] % 2) == num % 2 or (lst[idx] % 2 == num %2) for idx in range(1,len(lst)) ])
| true |
221c51da39c5f021ab042e8c3820e22cfa38d879 | Python | ukyo/roman-ngram | /roman2ngram.py | UTF-8 | 1,751 | 3.015625 | 3 | [] | no_license | #!/usr/bin/python
#coding: utf8
import sys
alphabet = 'abcdefghijklmnopqrstuvwxyz-,.'
row = [a for a in alphabet]
spliter = ' '
def print_row_label():
return spliter + spliter.join(row)
def build_col_label(n):
short_col = []
if n > 2:
short_col = ['^']
short_col_ = short_col[:]
f... | true |
e2823ceb160865a3c2432956daf6d5a3b73f6dde | Python | wkuling/Clash-of-Clans-Bot-TH10 | /Balloonion.sikuli/Alligator_farmer.py | UTF-8 | 37,375 | 2.71875 | 3 | [] | no_license | from datetime import *
from math import *
from random import *
#cocWindow = False
# things to do:
# 1) full troop employment certainty 2) hold down click instead of once at a time
cocWindow = App("Bluestacks").window(0)
timestamps = {
'testing': False,
'start': False,
'trainT... | true |
ed575178d2aa0e477ed988c7c8f8565660e3f1f6 | Python | KumarAmbuj/GEEKSFORGEEKS-DYNAMIC-PROGRAMING | /96.TABULATION.py | UTF-8 | 459 | 3.015625 | 3 | [] | no_license | def findmaxvalue(arr):
dp=[[0 for i in range(len(arr))]for j in range(len(arr))]
for g in range(len(arr)):
i=0
j=g
turn=g+1
while(j<len(arr)):
if g==0:
dp[i][j]=arr[i]
else:
dp[i][j]=max(arr[i]*turn+dp[i+1]... | true |
e4ae4360924eae832f965b9f0e49ffea49020ef3 | Python | tncardoso/dermis | /src/gen.py | UTF-8 | 3,091 | 2.71875 | 3 | [
"BSD-3-Clause"
] | permissive | from jinja2 import Template
from enum import Enum
class Type(Enum):
UINT = 0
INT = 1
CHARP = 2
FILEP = 3
VOIDP = 4
SIZET = 5
def c_type(self):
if self.value == Type.UINT.value: return 'unsigned int'
elif self.value == Type.INT.value: return 'int'
elif self.value == ... | true |
e16d2b94c66cc8e618aab0198d291c4b7cd7955a | Python | lcsm29/project-euler | /py/py_0219_skew-cost_coding.py | UTF-8 | 1,046 | 3.5625 | 4 | [
"MIT"
] | permissive | # Solution of;
# Project Euler Problem 219: Skew-cost coding
# https://projecteuler.net/problem=219
#
# Let A and B be bit strings (sequences of 0's and 1's). If A is equal to the
# leftmost length(A) bits of B, then A is said to be a prefix of B. For
# example, 00110 is a prefix of 001101001, but not of 00111 or 10... | true |
d3086f904bdba90b49619f34af4323f49313fc7e | Python | brian-rose/lowtran | /lowtran/plots.py | UTF-8 | 523 | 2.703125 | 3 | [
"MIT"
] | permissive | from matplotlib.pyplot import figure
def plottrans(trans,log):
ax = figure().gca()
for tran in trans.T:
ax.plot(tran.wavelength_nm,tran,label=str(tran.zenith_angle.values))
ax.set_xlabel('wavelength [nm]')
ax.set_ylabel('transmission (unitless)')
ax.set_title('zenith angle [deg] = '+str(tr... | true |
a7dffeb1a23f0c20bf8bb372c3747a74dce90423 | Python | ApexPredator-InfoSec/header_check | /headers.py | UTF-8 | 4,744 | 2.96875 | 3 | [
"MIT"
] | permissive | #!/usr/bin/python3
#Title: headers.py
#Author: ApexPredator
#License: MIT
#Github: https://github.com/ApexPredator-InfoSec/header_check
#Description: This script take a URL or list or URLs as arguments and tests for the headers: 'Strict-Transport-Security', 'Content-Security-Policy', 'X-Frame-Options', and 'Server'
imp... | true |
9f38bec32b42b9ab003e2bc7516560dd365b92b7 | Python | Vaziri-Mahmoud/travisTest | /code.py | UTF-8 | 597 | 3.4375 | 3 | [] | no_license |
class mahmoud98():
'''
def pr():
print("Hi\nTravis CI test lang:python ")
print("Happy new year : ", 1398, " :) ")
print("\n")
def nump():
import numpy as np
arr = np.array([1, 2, 3, 4, 5, 6, 7, 8, 9, 10])
arr2 = np.power(arr, 2)
print(arr2)
'''
def op(a, b):
if a == b:
... | true |
d44305e0877321dd1332ce3b6051284a2422e6c3 | Python | changhoonhahn/Gal_agar | /util.py | UTF-8 | 2,059 | 2.71875 | 3 | [] | no_license | import os
import numpy as np
from numpy import Inf
def code_dir():
return os.path.dirname(os.path.realpath(__file__)).split('util')[0]
def elements(vals, lim=[-Inf, Inf], vis=None, vis_2=None, get_indices=False, dtype=np.int32):
'''
Get the indices of the input values that are within the input limit... | true |
0e355404626c871f21ef5bf4e9136fa19f6e5f6c | Python | WhateverYoung/openmc | /openmc/filter.py | UTF-8 | 28,338 | 2.640625 | 3 | [
"MIT"
] | permissive | from collections import Iterable
import copy
from numbers import Real, Integral
import sys
import numpy as np
from openmc import Mesh
from openmc.summary import Summary
import openmc.checkvalue as cv
if sys.version_info[0] >= 3:
basestring = str
_FILTER_TYPES = ['universe', 'material', 'cell', 'cellborn', 'su... | true |
0cae4b7ea5266dfd655c8543ffd1edf8cbcc7350 | Python | Sheikh-A/El_Gamal_Ecryption_v1 | /elgamal.py | UTF-8 | 907 | 2.703125 | 3 | [] | no_license | import random
#import random from library
from params import p
from params import g
def keygen():
get_random = random.randint(1,p)
#set SK
sk = get_random
#set pk
pk = pow(g, sk, p)
return pk,sk
def encrypt(pk,m):
#define r
rand = random.randint(1,p)
r = rand
# formula goes he... | true |
98bb79074b5a4eeb0df29456b91e855307cbd517 | Python | lshapz/video-workbook | /012.py | UTF-8 | 218 | 3.71875 | 4 | [] | no_license | # my_range = range(1, 21)
# my_list = list(my_range)
# new_list = []
# for i in my_list:
# i *= 10
# new_list.append(i)
# print(new_list)
print([10 * x for x in my_range])
# list comprehension
# a lot faster! | true |
86b15f58bb5b9e0123d051975d6e0c3d8c22b37b | Python | J051p/Python | /Operators.py | UTF-8 | 537 | 3.71875 | 4 | [] | no_license | # Aritmetički operatori
x = 5
y = 5
print (x + y)
print (x - y)
print (x * y)
print (x / y)
print (x % y)
print (x ** y)
print (x // y)
# Operatori pridruživanja
x = 5
print(x) # x = 5
x +=3
print(x) # x = x + 3
x-=3
print(x) # x = x - 3
x *=3
print(x) # x = x * 3
x /=3
print(x) # x = x / 3
x %=3
print(x) # x ... | true |
f9099edc4b8f7ee2570cff2591ae0a025a5dcec0 | Python | samdawes/iD-Emory-Python-Projects | /Pygame/Platformer/coinBase.py | UTF-8 | 390 | 3.53125 | 4 | [] | no_license | #Expand to see the coin class.
import pygame
class Coin(pygame.sprite.Sprite):
image = None
#When a coin is created, provide an x and
#y position for it to be drawn at.
def __init__(self, x, y):
super().__init__()
self.image = self.image = pygame.Surface([20, 20])
self.im... | true |
560f8b98f53596061d037666ed34b1134f6776fc | Python | iangat/pdsnd_github | /bikeshare_igt.py | UTF-8 | 12,750 | 3.828125 | 4 | [] | no_license | # -----------------------------------------------------------------------------
#
# Project 2 - Python
# Explore US Bikeshare Data
#
# Description
# Use Python to understand U.S. bikeshare data. Calculate statistics and have an
# interactive environment where a user chooses the data and filter for a dataset
# to analyz... | true |
36a7a59983508bbae10078b0bad4b665d4fba956 | Python | michallkanak/artificial-intelligence | /GeneticAlgoritm/source.py | UTF-8 | 7,682 | 2.921875 | 3 | [
"MIT"
] | permissive | import numpy as np
from operator import itemgetter
import random
import time
# time waching
start_time = time.time()
population_size = 100
gen = 100
Px = 0.7
# 0.8 roul # 0.7 tour
Pm = 0.15
# 0.04 roul # 0.1 tour
Tour = 5
repeats_range = 10;
global_best = 0
global_worst = 0
global_mean = 0
file = open("data/had12.d... | true |
72d066f9561670619539fd4901edc07d59b96ebe | Python | Karzen/SoundGuard | /Scripts/soundguard_control.py | UTF-8 | 3,668 | 2.84375 | 3 | [] | no_license | #This module is used for communication between the service and the controller
import socket
""" Control options:
l - Reload settigs
v - Reload volume limit
p - Pause timer
c - Resume timer
r - Reset timer
d - Disconnect
t - Request timer status
m - Request device status
i - Request pause status
"""
class ... | true |
8930e4067e5ec17634e107d8327bd47898446e81 | Python | michaelpradel/LExecutor | /src/lexecutor/predictors/NaiveValuePredictor.py | UTF-8 | 742 | 2.890625 | 3 | [
"MIT"
] | permissive | from .ValuePredictor import ValuePredictor
from ..Logging import logger
class Toy:
pass
class NaiveValuePredictor(ValuePredictor):
def name(self, iid, name):
v = Toy()
logger.info(f"{iid}: Predicting for name {name}: {v}")
return v
def call(self, iid, fct, fct_name, *args, **kwar... | true |
90af2dfc7fefa65f99b18b023e7b32294679391d | Python | betty29/code-1 | /recipes/Python/221132_Generator_integer_partitions_iterative/recipe-221132.py | UTF-8 | 624 | 2.9375 | 3 | [
"MIT",
"Python-2.0"
] | permissive | def partitions(n):
if n <= 0: return
m = int((1 + sqrt(1 + 8 * n)) / 2) - 1
p = [(1, n)]
yield p
while p[-1][0] != n: # or equivalently p[0][1] != 1
rest = 0
times, number = p.pop()
if number == 1:
rest += times
times, number = p.pop()
times -=... | true |
7d2820bdf55e2a62e6d84252e732224188ef09c4 | Python | Aasthaengg/IBMdataset | /Python_codes/p03776/s265286417.py | UTF-8 | 795 | 2.796875 | 3 | [] | no_license | import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)
N, A, B = mapint()
Vs = list(mapint())
Vs.sort(reverse=True)
from collections import defaultdict, Counter
from math import factorial, gcd
count = defaultdict(int)
c = Counter(Vs)
ans... | true |
1b09345c2a53f60460d0b38375fd09c52af1d1ed | Python | TsinghuaWangZiXuan/Flybrain | /Codes/Bert/tokenization.py | UTF-8 | 811 | 2.546875 | 3 | [] | no_license | import sentencepiece as spm
def tokenization(mode, dna_file=None):
if mode == 'build':
sp = spm.SentencePieceTrainer
sp.Train(input='./data/all_gene_sequence.txt',
vocab_size=5000,
model_prefix='./model/mypiece',
model_type='bpe')
el... | true |
d465ce6512ce049f65d29aa9ddb5a872bb96dd55 | Python | huzichunjohn/python_study | /thread_test.py | UTF-8 | 513 | 3.125 | 3 | [] | no_license | #!/bin/env python
import threading
import time
class TestThread(threading.Thread):
is_stop = False
def __init__(self):
threading.Thread.__init__(self)
def run(self):
print self.is_stop
while not self.is_stop:
print "this is a test."
time.sleep(2)
print "exit ......"
... | true |
3db4070a600587a7be300954c70f1ebbe5515b80 | Python | yunqu/PYNQ | /pynq/lib/arduino/arduino_grove_buzzer.py | UTF-8 | 4,446 | 2.625 | 3 | [
"BSD-3-Clause",
"MIT"
] | permissive | # Copyright (c) 2016, Xilinx, Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of ... | true |
1b09cdd1b6987de67b7f860ce9903b67f54e159b | Python | minrk/ipython-svn-archive | /google-rkern/trunk/notabene/formatter.py | UTF-8 | 3,420 | 2.953125 | 3 | [] | no_license | """Base Formatter class for notebooks.
"""
import textwrap
class Formatter(object):
"""Abstract base class implementing some useful common methods.
Subclass and implement a format_sheet(sheet) method.
"""
def __init__(self, notebook):
self.notebook = notebook
## self.inputs = {}
## ... | true |
00008a4ef1c4f0f8b5ec161ab280c497edbfdc07 | Python | wk1219/Data-Science | /Analysis/linear_regression.py | UTF-8 | 374 | 2.96875 | 3 | [] | no_license | from sklearn.linear_model import LinearRegression
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
df = pd.read_csv("random-linear-regression/test.csv")
df.head()
X = df["x"]
y = df["y"]
line_fitter = LinearRegression()
line_fitter.fit(X.values.reshape(-1,1), y)
plt.plot(X, y, 'o')
plt.plot(X, l... | true |
9916c5b84b9af77107e8fe7950257beee6c4ea39 | Python | Aashish07/PythonPractice | /DataTypes/Iterations.py | UTF-8 | 582 | 4.96875 | 5 | [] | no_license | # Iterations or looping can be performed in python by ‘for’ and ‘while’ loops.
# Apart from iterating upon a particular condition, we can also iterate on strings, lists, and tuples.
# 1. While loop :-----
i = 1
while (i < 10):
print(i)
i += 1
# Output :-
1 2 3 4 5 6 7 8 9
# 2. Fo... | true |
6a493c460891ab7afeab34665053aca27d41724e | Python | thefuyang/testpython | /work2/cookie.py | UTF-8 | 573 | 2.546875 | 3 | [] | no_license | # coding=utf-8
__author__ = 'YIN'
import cookielib
import urllib2
import urllib
filename = 'cookie.txt'
values = {"username": "admin", "password": "hisense"}
data = urllib.urlencode(values)
cookie = cookielib.MozillaCookieJar(filename)
handler = urllib2.HTTPCookieProcessor(cookie)
url = 'http://localhost/guke/admin/p... | true |
251c103647744e8b9196ad8f979a0b8ef074641e | Python | hersle/euler | /003/3.py | UTF-8 | 176 | 3.1875 | 3 | [] | no_license | def factorize(n):
for d in range(2, int(n**0.5) + 1):
if n % d == 0:
return [d] + factorize(n / d)
return [n]
print (max(factorize(600851475143)))
| true |
97df2ed06f5af65bd895e078a80cef7243f464ea | Python | jiafangdi-guang/CDA2.0_tools | /Step1.1_File_preprocessing/专利数据库导出数据.py | UTF-8 | 1,855 | 2.90625 | 3 | [] | no_license | # 构建的合作关系网络是一个无向有权图
import json
import os
def get_graph_inf(graph_path, json_path):
txt_file = open(graph_path, 'r', encoding='UTF-16')
nodes_list = []
links_list = []
for each_line in txt_file:
if each_line[:4] == 'pad:':
nodes_temper = each_line[4:-1].replace(' ', '').split('|')... | true |
3dc6b34efb50a20b941a900aacf2d956173bb492 | Python | rifatmondol/Python-Exercises | /125 - [Strings] Letra Por Símbolo.py | UTF-8 | 432 | 4.25 | 4 | [] | no_license | #125 - Write a Python program to get a string from a given string where all occurrences of its first char
# have been changed to '$', except the first char itself.
def subst(frase):
if letra in frase:
subs = frase.rsplit(letra, 1)
novo = simb.join(subs)
return novo
else:
retur... | true |
0e5f32a8615360778ad04eecf8a4c6d478fe956a | Python | poojaaj/Coding_practice | /bestTimeToBuyStock.py | UTF-8 | 257 | 3.5 | 4 | [] | no_license | def bestTimeToBuyStock(prices):
j = 1
sum = 0
for i in range(len(prices)-1):
if prices[j]-prices[i] > 0:
sum += prices[j] - prices[i]
j = j + 1
return sum
prices = [7,1,5,3,6,4]
print(bestTimeToBuyStock(prices)) | true |
3f1ec0d6336428143671963f057c2e3509bf9761 | Python | Aasthaengg/IBMdataset | /Python_codes/p03450/s263780883.py | UTF-8 | 1,006 | 3.140625 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# In[13]:
import sys
from collections import deque
input = sys.stdin.readline
# In[14]:
N, M = map(int, input().split())
# In[2]:
link = [[] for _ in range(N)]
for _ in range(M):
L, R, D = map(int, input().split())
link[L-1].append((R-1, D))
link[R-1].append(... | true |
c4c9819e3bc1a0220c35ebc8e44b8dd5b653566d | Python | Speaky10k/teletext-twitter | /teletext-twitter/processor.py | UTF-8 | 1,423 | 2.703125 | 3 | [
"MIT"
] | permissive | # teletext-twitter - creates pages for vbit2 teletext system
# (c) Mark Pentler 2018 (https://github.com/mpentler)
# see README.md for details on getting it running or run with -h
# text processor module
import textwrap
import re
def tweet_remove_emojis(tweet):
# remove pesky emoji characters
emoji_pattern = ... | true |
0a055984630963e2d69a779531401ed450f36919 | Python | Vedant-Dev/leetcode-solution | /Python/search_in_rotated_sorted_array.py | UTF-8 | 233 | 3.265625 | 3 | [] | no_license | class Solution:
def search(self, nums: List[int], target: int) -> int:
lb = 0
ub = len(nums) - 1
while lb <= ub:
if nums[lb] == target:
return lb
if nums[ub] == target:
return ub
lb += 1
ub -= 1
return -1 | true |
1712f09a30ae4ca8ceff6212fe64613d06cc16a4 | Python | samaypanwar/Algorithms | /SortingAlgorithms/main.py | UTF-8 | 607 | 2.703125 | 3 | [] | no_license | import os
os.chdir("SortingAlgorithms/")
from sorting import Sort
import numpy as np
import yaml
if __name__ == "__main__":
with open('config.yaml') as file:
config = yaml.safe_load(file)
file.close()
try:
MAX_SIZE = config.get("MAX_SIZE")
except: raise ValueError('Max size of random... | true |
91cd7a074a954562ee4ca871ebcf0a1f5ca3da69 | Python | renlei-great/git_window- | /python数据结构/python黑马数据结构/排序于搜索/插入排序_test.py | UTF-8 | 1,177 | 4.03125 | 4 | [] | no_license | lista = [12, 4, 5, 6, 22, 3, 43, 654, 765, 7, 234]
# 插入排序
# 将前面看做有序集合,将后面看做无序,操作后面每一个无序元素,
def insert_sort(lista):
n = len(lista)
for j in range(1, n):
for i in range(j, 0, -1):
if lista[i] > lista[i-1]:
break
lista[i], lista[i-1] = lista[i-1], lista[i]
inser... | true |
147cd93ba88bd50ce02468a63ebf68ed5a0e0439 | Python | betty29/code-1 | /recipes/Python/578415_Truecolor_Mandelbrot_Fractal/recipe-578415.py | UTF-8 | 1,512 | 3.40625 | 3 | [
"MIT"
] | permissive | # True-color Mandelbrot Fractal
# FB36 - 20130113
import math
from PIL import Image
imgx = 800; imgy = 800
image = Image.new("RGB", (imgx, imgy))
pixels = image.load()
xa = -2.0; xb = 1.0
ya = -1.5; yb = 1.5
maxIt = 256 # of iterations
# find max values for |x|, |y|, |z|
maxAbsX = 0.0; maxAbsY = 0.0; maxAbsZ = 0.0
for... | true |
d1adef5795b5919175f8381186ccda0df85d578d | Python | tichmangono/python_interactive_programming | /CourseraMainProj.py | UTF-8 | 19,849 | 3.484375 | 3 | [] | no_license |
#-----------------------------------------
# EXTENDED GUESS THE NUMBER MINI-PROJ
#-----------------------------------------
# This is the same project as week 2 and allows user to input guesses
# in a range of their choice (>10) until they run out of guesses, quit,
# guess the right number
# Extra Features added
#--in... | true |
5e1d5e7a2fc30bf1f5bab85d28e9cc213989a319 | Python | Amara-Manikanta/Python-GUI | /PYQT5/Games/RockPapperScissorsGame.py | UTF-8 | 4,072 | 2.890625 | 3 | [
"MIT"
] | permissive | import sys
from PyQt5.QtWidgets import *
from PyQt5.QtGui import QFont, QPixmap
from PyQt5.QtCore import QTimer
from random import randint
font = QFont("Times", 14)
buttonFont = QFont("Arial", 12)
computerScore = 0
playerScore = 0
class Windows(QWidget):
def __init__(self):
super().__init__()
sel... | true |
a8b8bc715a16dafd0549c5f6793fe7e11999fc66 | Python | nihal-wadhwa/Computer-Science-1 | /Labs/Lab02/scenery.py | UTF-8 | 4,758 | 4 | 4 | [] | no_license | """
Author: Nihal Wadhwa
Turtle Scenery: This program's purpose is to create a scenery with two houses of varying sizes and a tree.
"""
import turtle as tt
import math
def init() :
"""
Moves the turtle 275 units to the left to set up for the beginning of the phrase.
Precondition: turtle is down... | true |
6d531d5cdec17148cc495952735943d18bb734a3 | Python | Egor-Ozhmegoff/Python-for-network-engineers | /solutions/07_files/task_7_2b.py | UTF-8 | 1,420 | 2.84375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Задание 7.2b
Дополнить скрипт из задания 7.2a:
* вместо вывода на стандартный поток вывода,
скрипт должен записать полученные строки в файл config_sw1_cleared.txt
При этом, должны быть отфильтрованы строки, которые содержатся в списке ignore.
Строки, которые начинаются на '!' отфильтровы... | true |
45ee30bbe8e533b63d30bcb70063983ca86524bd | Python | MichaelK8/Media-library-Clean-PY3 | /image-test.py | UTF-8 | 442 | 2.6875 | 3 | [] | no_license | import pyautogui as pg
print("skript jede\n")
btnMove = pg.locateCenterOnScreen('btn-move-middle.png')
locPath = pg.locateOnScreen('path.png')
if locPath != None:
print("našel jsem screenshot path")
print(locPath)
elif btnMove != None:
print("našel jsem screenshot move\n")
pg.moveTo(btnMove, duration=0.4, tween=... | true |
c7f68bffcde6efdebc363baad3559f4a420bf3b0 | Python | fgerce/DSP-Entregas | /Pruebas TP1/Prueba FFT y desparramo.py | UTF-8 | 2,399 | 3.0625 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Aug 28 21:06:34 2019
@author: fede
"""
from Modulos import instrumentos as ins
import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as np
N = 1000 # muestras
fs = 1000 # Hz
a0 = 1 # Volts
p0 = 0 # radianes
f0 = f... | true |
10ac23146ce36b4bd2b2b6c674ce5e150e46466e | Python | A-Jatin/Chat-Bot | /bot.py | UTF-8 | 950 | 2.890625 | 3 | [] | no_license | import pandas as pd
import re
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.metrics.pairwise import cosine_similarity
pd.set_option('display.max_colwidth',200)
df=pd.read_csv('a.csv')
convo = df.iloc[:,0]
clist = []
def qa_pairs(x):
cpairs = re.findall(": (.*?)(?:$|\n)", x)
... | true |
e68a3e089acbe173178500fb81ae3d278933de8d | Python | Tospaa/NamazVakit | /namaz2.py | UTF-8 | 6,920 | 3 | 3 | [] | no_license | # -*- coding: cp1254 -*-
"""This is basically a web scraping program for getting praying times from a site.
You use a city name as the input and program scrapes it to give you the wanted values.
This program uses tkinter as GUI library and bs4 as parsing and manipulating html data.
Written by Musa Ecer musaecer... | true |
a3e3ae1f672cc9429f08375274e0683f9585cf4b | Python | bryangalindo/centrans_soc_scraper | /utils.py | UTF-8 | 562 | 2.875 | 3 | [
"MIT"
] | permissive | from bs4 import BeautifulSoup
from database import Database
import requests
def make_soup(url):
''' Retrieves html code from url '''
headers = {'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/605.1.15 (KHTML, like Gecko)'
' Version/11.1.2 Safari/605.1.15... | true |
1c55658b754016da81f280a3500352c52ea1225c | Python | Abhiroopmokshagna/Dynamic_Programming | /fibonacci.py | UTF-8 | 278 | 3.515625 | 4 | [] | no_license | def fibonacci(n, lookup):
if(lookup[n] == None):
lookup[n] = fibonacci(n-1,lookup) + fibonacci(n-2, lookup)
return lookup[n]
lookup = [None] * 101
lookup[0] = 0
lookup[1] = 1
def main():
print(fibonacci(16, lookup))
if __name__ == '__main__':
main() | true |
84132de9f878e0a531d1e997ed75bf3af6dac36e | Python | Smy281677623/PowerTool | /test/MathUtil.py | UTF-8 | 950 | 3.390625 | 3 | [] | no_license | # -*- coding:utf-8 -*-
import numpy as np
import math
class MathUtils(object):
def __init__(self):
self.a_ = None
self.b_ = None
self.c_ = None
def fit(self, x_train, y_train):
assert x_train is not None and y_train is not None, \
"x_train, y_train can not be None"... | true |
3ed9623a6689509349714a6898350f7b3757db5d | Python | wafarifki/Hacktoberfest2021 | /Python/Get Free Courses/free-course/freecourse.py | UTF-8 | 1,753 | 3.28125 | 3 | [] | no_license | import requests
from bs4 import BeautifulSoup
'''
Scrapes Free Courses Detail from Disudemy
'''
baseurl = "https://www.discudemy.com/search/"
def req(url):
respponse = requests.get(url).text
return respponse
class Courses:
def __init__(self, topic) -> None:
self.topic = topic
content ... | true |
7d4cd6e96bc232d0d45f050937f01ae5f1d0c67e | Python | KJfamily33/NSFW_Detection | /detector.py | UTF-8 | 3,477 | 2.890625 | 3 | [
"MIT"
] | permissive | from keras.models import Sequential
from keras.layers.core import Dense, Dropout, Activation, Flatten
from keras.layers.normalization import BatchNormalization
from keras.models import Model
from keras.layers import Input, Dense, merge
from keras.applications.resnet50 import ResNet50
import numpy as np
class Detector(... | true |
78a60757ec97de757f81bb1bd1c030d2a12a28dd | Python | tavog96/distribuidosProyecto | /lacusClient_p2pTest/app_infrastructure/resourceManagement/resourceDirectoryScan.py | UTF-8 | 1,221 | 2.796875 | 3 | [
"MIT"
] | permissive | import os
class filesScaner:
defaultAppPath = ''
def __init__(self, appPath = '.'):
super().__init__()
self.defaultAppPath = appPath
def filesPathScan (self):
files = []
# r=root, d=directories, f = files
for r, d, f in os.walk(self.defaultAppPath):
fo... | true |