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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
12be1326197a8526f903a1122dd01dd543339535 | Python | tuahk/NiaPy | /examples/run_de.py | UTF-8 | 2,630 | 2.53125 | 3 | [
"MIT",
"LicenseRef-scancode-free-unknown"
] | permissive | # encoding=utf8
# This is temporary fix to import module from parent folder
# It will be removed when package is published on PyPI
import sys
sys.path.append('../')
# End of fix
import random
import logging
from margparser import getArgs
from NiaPy.algorithms.basic import DifferentialEvolutionAlgorithm
from NiaPy.benc... | true |
56813b97a3cb6360a7dea732dc13d144170a3b98 | Python | sanfelice/AsyncSocket | /WebSocketClient/torn.py | UTF-8 | 1,181 | 2.578125 | 3 | [] | no_license | #!/usr/bin/python
# -*- coding: utf-8 -*-
import tornado.ioloop
import tornado.web
import tornado.websocket
import threading
from time import gmtime, strftime, sleep
app = None
def running():
while(True):
global app
if app != None:
today = strftime("%Y-%m-%d %H:%M:%S", ... | true |
1d2ba035ca729d44ced439654329c8a42698c63f | Python | PabloPie/eina-privacy-violations | /humans.db/load.py | UTF-8 | 4,178 | 2.796875 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Author: Guillermo Robles
#
# Extract data from the register file
import csv
import re
import sqlite3
def remove_tildes(string):
"""Removes tildes. Nothing more to say
"""
return string.replace('á', 'a')\
.replace('é', 'e')\
... | true |
139c6e60c4cde2edc0b8e573cc8d9e6b17fc3894 | Python | SDurneva/Abaza_database | /abaza_data.py | UTF-8 | 3,825 | 2.578125 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import sqlite3
from openpyxl import load_workbook
def create_db():
f = open('abaza_db.sql', 'r', encoding='utf-8')
conn = sqlite3.connect('abaza_database.db')
c = conn.cursor()
command = f.read()
c.executescript(command)
def some_data():
commands... | true |
9cc43319dfb1d210f71956e7ad0e2e1abac8a27e | Python | ryanmcg86/Euler_Answers | /113_Non-bouncy_numbers.py | UTF-8 | 1,409 | 4.59375 | 5 | [] | no_license | '''Working from left-to-right if no digit is exceeded by the digit to its left it is called an increasing number; for example, 134468.
Similarly if no digit is exceeded by the digit to its right it is called a decreasing number; for example, 66420.
We shall call a positive integer that is neither increasing nor decre... | true |
3d44317087a6ac556fb477699e244578018195b2 | Python | chunweiliu/leetcode2 | /merge_intervals.py | UTF-8 | 1,095 | 3.4375 | 3 | [] | no_license | """Merge intervals
<< [1, 3], [2, 6], [8, 10], [15, 18]
=> [1, 6], [8, 10], [15, 18]
<< [1, 2]
=> [1, 2]
Time: O(n log n)
"""
class Solution(object):
def merge(self, intervals):
"""
:type intervals: List[Interval]
:rtype: List[Interval]
"""
... | true |
3a39b12bc0fca4ffa0b2014fe7e6db4f7a79c4fd | Python | boringbear21/balloon | /testing/typing.py | UTF-8 | 168 | 2.765625 | 3 | [] | no_license | from sense_hat import SenseHat
sense = SenseHat()
sense.set_rotation(180)
while 1:
red = (255, 0, 0)
sense.show_message(input(), text_colour=red, scroll_speed=0.07)
| true |
82c7c8e33b528b5405fc158e08c9ba25b4791cf9 | Python | humzaiqbal/tensor_flow_network | /tensor_network.py | UTF-8 | 2,043 | 2.71875 | 3 | [] | no_license | import tensorflow as tf
import numpy as np
from sklearn.preprocessing import normalize
"""
This class acts as a wrapper for the tensorflow neural network
"""
class tensor_Network:
def __init__(self, learning_rate = 0.01, num_iterations=2000, DROPOUT = 0.5):
self.learning_rate = learning_rate
self.num_iteratio... | true |
7d56f2158844928095f16d866de7f4f615083284 | Python | jacob-r-smith/LetterCounter | /Letter Counter.py | UTF-8 | 309 | 3.71875 | 4 | [] | no_license |
word = ''
def word_input():
print('Please enter any word: ')
word = input()
return word
def letter_count(word):
print(word + ' has ' + str(len(word)) + ' letters in it.')
word = word_input()
letter_count(word)
#look into incorporating fstrings
#look into beep boop
#testing
| true |
d462ebdf4146a15d70a1d2e0ccebd20e38ec1b37 | Python | wang264/JiuZhangLintcode | /AlgorithmAdvance/L7/require/403_continuous-subarray-sum-ii.py | UTF-8 | 887 | 4 | 4 | [] | no_license | # 连续子数组求和 II · Continuous Subarray Sum II
# LintCode 版权所有
# 子数组
# 数组
# 描述
# Given an circular integer array (the next element of the last element is the first element), find a continuous
# subarray in it, where the sum of numbers is the biggest. Your code should return the index of the first number
# and the index of t... | true |
a6a2a7552e8ac25bf0c0d2f0728e722addd20d89 | Python | henribunting/machine_learning | /E2/2_2.py | UTF-8 | 5,405 | 3.171875 | 3 | [] | no_license | import matplotlib.pyplot as mplt, numpy, pylab
filehandle = open('applesOranges.csv')
filelines = filehandle.readlines()[1:]
dataread = numpy.array([[float(entry[0]),float(entry[1]),int(entry[2])] for entry in [line.strip().split(",") for line in filelines]])
data = dataread[:,:-1].T
classifications = dataread[:,-1:]... | true |
1f1611c89c8c38af39b4d0dab07e1d00a663fb36 | Python | arbeitandy/mywaytoday | /daily_linear_trip/quick_pythons.py | UTF-8 | 29,013 | 2.84375 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
some quick basic stuffs
"""
# === install/update python ===
sudo apt update
sudo apt install python python-dev python3 python3-dev
# === virtualenv ===
pip install virtualenv
pip install -I isa==3.4.2 # pip install module of ver
cd this_proj... | true |
b72b1f2ca190a97ca16b47213b8c4a33ece6404b | Python | agasthyarana/macPickUp | /pickup/db.py | UTF-8 | 619 | 2.53125 | 3 | [] | no_license | from pymongo import MongoClient
import json
def load_mongo(db='MacPickUp'):
password = input('Password: ')
client = MongoClient(
"mongodb+srv://aar0npham:{}@food-izclc.mongodb.net/test?retryWrites=true&w=majority".format(password))
return client[db]
def write_db(col='Food', file='pickup.json'):
... | true |
25dd081be8fee12c38a2956c1e03e6948d0d6427 | Python | Koozzi/Algorithms | /BJ/implementation/G4_17779_20210128.py | UTF-8 | 4,236 | 3.03125 | 3 | [] | no_license | from sys import stdin
from collections import deque
def make_boundary(N, boundary):
X, Y, D1, D2 = boundary[0], boundary[1], boundary[2], boundary[3]
boundary_board = [[0 for i in range(N+1)] for i in range(N+1)]
boundary_board[X][Y] = 5
boundary_board[X+D2][Y+D2] = 5
boundary_board[X+D1][Y-D1] = ... | true |
3267e8bebf33adf3f11c7eea658557d489ba3181 | Python | jgerardsimcock/Interactive-Python | /data_structures/python_data_structures.py | UTF-8 | 2,141 | 3.59375 | 4 | [] | no_license | import timeit
import random
#Analysis of native python data structures and the runtime
#lists
#concatenate
def test1():
l = []#create empty data structure to store result
for i in range(1000):
l += [i]
#append
def test2():
l = []
for i in range(1000):
l.append(i)
#list comprehension
def test3():
l... | true |
184b03343ab6a46331f1e482e69a3eefc082b5b8 | Python | grulon/pyWork-learn | /scratchFile.py | UTF-8 | 408 | 3.5 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Mon Aug 28 10:05:58 2017
@author: glrulon
"""
def hello():
print("Hello world!")
print(100 < 101 or 1==2)
def cube(number):
return number ** 3
def by_three(number):
if number % 3 == 0:
return cube(number)
else:
return False
... | true |
2e42d5a847c8a572eaefa9605ec6d7db59ae3750 | Python | Rithik57/AI | /Informed and Uninformed/TSP brute force.py | UTF-8 | 1,159 | 3.46875 | 3 | [
"Apache-2.0"
] | permissive | from itertools import permutations
from sys import maxsize
V = 4
def TSP(graph, S): #receives the graph and the starting vertex
# store all non active vertices in a list
vertex = []
for i in range(V): # V -> number of vertices
if i != S:
vertex.append(i)
minPath = maxsi... | true |
c01775e1db515a3dc0f8aec628fd0f39cfa0ee84 | Python | JamEnergy/Soph | /question.py | UTF-8 | 11,626 | 2.6875 | 3 | [] | no_license | import spacy
from nlp import get
import re
from spacy.symbols import nsubj, VERB
import spacy.symbols
import spacy.tokens
from enum import Enum
import inspect
def print_token(tok):
props = dir(tok)
ret = {}
for prop in props:
if not prop.startswith("__") and prop not in {"sent_start"}:
... | true |
eccde521fdb6d46702d7743103fd646e014de5c8 | Python | demkonst/geekbrains-python-basic | /L4/2.py | UTF-8 | 266 | 3.765625 | 4 | [] | no_license | def max_of_three(n1, n2, n3):
return max(n1, n2, n3)
n1 = int(input('Первое число: '))
n2 = int(input('Второе число: '))
n3 = int(input('Третье число: '))
print('Максимальное: {}'.format(max_of_three(n1, n2, n3)))
| true |
01b6d3745e67f15c97f4e95b85d7e636165cc531 | Python | beadoer1/algorithm | /spartacodingclub/week_1/04_is_number_exist.py | UTF-8 | 215 | 3.671875 | 4 | [] | no_license | input = [3, 5, 6, 1, 2, 4]
def is_number_exist(number, array):
# 풀이
for num in array:
if number == num:
return True
return False
result = is_number_exist(3, input)
print(result) | true |
6ead57a38b34003f64b4d6098b281a1563e1ef1e | Python | BertJorissen/pybinding | /pybinding/support/pickle.py | UTF-8 | 3,105 | 3.03125 | 3 | [
"BSD-2-Clause",
"BSD-3-Clause",
"LicenseRef-scancode-free-unknown"
] | permissive | """Utility functions for getting data to/from files"""
import gzip
import os
import pathlib
import pickle
from pathlib import Path
from ..utils.misc import decorator_decorator
from typing import Union
__all__ = ['pickleable', 'save', 'load', 'normalize']
def normalize(file: Union[str, Path]) -> str:
"""Convenie... | true |
5b4151b0938c625939b55ac108a14700a9fc6062 | Python | SebastianLie/ievan-polkka | /A0000000X-v3/obj2_weather.py | UTF-8 | 5,836 | 3.640625 | 4 | [] | no_license | '''
NUS CS4248 Assignment 1 - Objective 2 (Weather)
Class Weather for handling Objective 2
Assumption:
The assignment task states, "it’s also good for a bot to have some social skills. Weather is a
common subject for passing time."
We thus assume that the bot's purpose is to provide ... | true |
38261894615dfe961d03b91d988ae9bd3f9d43a2 | Python | MasisaLab/Python-Pro | /PYTHON/piedra,papel o tijera.py | UTF-8 | 1,990 | 3.46875 | 3 | [] | no_license | player= input("Elija Piedra,Papel o Tijera ")
rock = '''
_______
---' ____)
(_____)
(_____)
(____)
---.__(___)
'''
paper = '''
_______
---' ____)____
______)
_______)
_______)
---.__________)
'''
scissors = '''
_______
---' ____)___... | true |
cddff59e44e129be1faed26c3061583bd1f451c3 | Python | vinithegit/PracticalPython-OpenCV | /flipping.py | UTF-8 | 511 | 2.90625 | 3 | [] | no_license | import cv2
import argparse
ap=argparse.ArgumentParser()
ap.add_argument("-i", "--image", required=True, help="Path to the image")
args= vars(ap.parse_args())
image= cv2.imread(args["image"])
cv2.imshow("Original", image)
# cv2.waitKey(0)
# Flipping
flipped= cv2.flip(image, 1)
cv2.imshow("Flipped horizontally", flipped)... | true |
2b0c2f1b80ec72035e0e45610f3018c5c57f2b3f | Python | daviddwlee84/LeetCode | /Python3/Array/TopKFrequentElements/Naive347.py | UTF-8 | 235 | 2.96875 | 3 | [] | no_license | from typing import List
from collections import Counter
class Solution:
def topKFrequent(self, nums: List[int], k: int) -> List[int]:
counts = Counter(nums)
return sorted(counts, key=counts.get, reverse=True)[:k]
| true |
3c62fbc78a92fe7a2ddbfb7f7368b118200eeeb3 | Python | valeriacavalcanti/POP-2021-EM-T1 | /reunioes/003/ex_matriz.py | UTF-8 | 337 | 3.484375 | 3 | [] | no_license | # matriz
matriz = []
for i in range(2):
matriz.append([0] * 4)
print(matriz)
matriz[0][1] = 16
print(matriz)
print(len(matriz))
print(len(matriz[0]))
for i in range(len(matriz)):
for j in range(len(matriz[i])):
matriz[i][j] = 100
print(matriz)
for i in range(len(matriz[0])):
matriz[0][i] = 20... | true |
79e69642f7cc0e2a67e204a21e09ebe5b9542867 | Python | junweifu/OlderDriver | /RL_EXP/Double_DQN/run_Pendulum.py | UTF-8 | 1,676 | 2.625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import gym
from RL_brain import DoubleDQN
import numpy as np
import matplotlib.pyplot as plt
import tensorflow as tf
env = gym.make('Pendulum-v0')
env = env.unwrapped
env.seed(1)
MEMORY_SIZE = 3000
ACTION_SPACE = 11
sess = tf.Session()
with tf.variable_scope('Natural_DQN'):
natrual_DQN = ... | true |
20fd1edfb554004e532b153766921d0ad08ed7e6 | Python | dburt4/UnrolledLinkedList | /list/unrolled_linked_list/module.py | UTF-8 | 7,909 | 4.1875 | 4 | [] | no_license |
import math
"""
My implementation of an unrolled linked list
Combines the best of arrays and linked lists
Works by having node objects that have arrays in them of a certain max length (16 default)
Append and delete are the basic functions. Dunder methods have been added for all the regular items as well
"""
class Unr... | true |
7444eacbb11602b16016fc9918d28ae30a509cb1 | Python | 10992340/DataProcessing | /Homework/Week_4/converttojson.py | UTF-8 | 490 | 2.90625 | 3 | [] | no_license | # Milou van Casteren
# Data processing
# convert KNMI text file to csv to json
import csv
import json
import pandas as pd
# read in csv file using pandas library
input = pd.read_csv('data.csv', usecols=[0,5,6])
location = input["LOCATION"]
time = input["TIME"]
value = input["Value"]
# select rows specific for the N... | true |
41d9aba9b3a21a21a315ce128c2961ef833a5025 | Python | marc-ortuno/VOPEC | /Prototype/core/utils/gui.py | UTF-8 | 7,692 | 2.578125 | 3 | [
"MIT"
] | permissive | from matplotlib import pyplot as plt
import numpy as np
import librosa
import librosa.display
import pandas as pd
import seaborn as sn
from scipy.interpolate import make_interp_spline, BSpline
from matplotlib.colors import ListedColormap
"""
Comparative plot of original signal and processed signal
"""
... | true |
59f5bf151f17439248b473e64a0d79057bc92fc7 | Python | Aasthaengg/IBMdataset | /Python_codes/p03696/s732712755.py | UTF-8 | 316 | 3.34375 | 3 | [] | no_license | n = input()
s = input()
count = 0
max_l = 0
max_r = 0
for c in s:
if c =="(":
count -= 1
else:
count += 1
max_l = max(max_l, count)
count = 0
for c in s[::-1]:
if c =="(":
count += 1
else:
count -= 1
max_r = max(max_r, count)
print("("*max_l + s + ")"*max_r) | true |
ba089db6d4f9fbc2be369b7c11f4e6e66a9dc4e5 | Python | PETEletricaUFBA/Pega_Visao | /Exemplos Python OpenCV/Seção 1/Ep 4 - basic_functions.py | UTF-8 | 778 | 3.390625 | 3 | [
"MIT"
] | permissive | #pylint:disable=no-member
import cv2 as cv
img = cv.imread('Exemplos Python OpenCV/Resources/Photos/park.jpg')
cv.imshow('Park', img)
# Converting to grayscale
gray = cv.cvtColor(img, cv.COLOR_BGR2GRAY)
cv.imshow('Gray', gray)
# Blur
blur = cv.GaussianBlur(img, (7,7), cv.BORDER_DEFAULT)
cv.imshow('Blur', blur)
# ... | true |
3d8b7f0148aaf54f98d2d6878320070a10e00e84 | Python | hypr-88/alpha | /OPs.py | UTF-8 | 13,402 | 3.15625 | 3 | [] | no_license | import numpy as np
import pandas as pd
from scipy.stats import rankdata
from Operands import Scalar, Vector, Matrix
np.seterr(all="ignore")
pd.options.mode.chained_assignment = None
'''
Notes: s stands for Scalar, v stands for Vector, m stands for Matrix
Definition of 67 functions of operations:
1. s = s +... | true |
735727fe26a81c76cf2490f1735348134d5efa74 | Python | xiaoshitoucoding/Quantitative_Trading | /common/Util/StockUtil.py | UTF-8 | 1,156 | 2.75 | 3 | [] | no_license | import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import talib
#用来处理股票数据的类
class StockUtil:
def __init__(self, stock_pd_data):
self.m_stock_pd_data = stock_pd_data
#用来获取移动平均线
def GetMA(self, days):
return self.m_stock_pd_data.close.rolling(days).mean()
def GetGold... | true |
9e34452cd53fe912ababee780e594acf80f09fe8 | Python | sufian27/weather-app | /app.py | UTF-8 | 1,135 | 2.953125 | 3 | [] | no_license | from flask import Flask, render_template, request
from flask_cors import CORS
from weather import get_weather\
app = Flask(__name__)
CORS(app)
@app.route("/")
def index():
return render_template("index.html")
@app.route("/weather", methods=["GET", "POST"])
def render_weather():
#When the JS code sends t... | true |
6f76e4f4fd0ed38167f044c9d635d7eb8d0c4392 | Python | maxslimmer/advent-of-code-2019 | /day04/script.py | UTF-8 | 711 | 3.359375 | 3 | [] | no_license | with open("input.txt", "r") as input_file:
input_ = input_file.read().strip()
start, stop = [int(i) for i in input_.split("-")]
first_part_count = 0
second_part_count = 0
for candidate in range(start, stop+1):
candidate = str(candidate)
candidate_set = set(candidate)
if len(candidate_set) != len(ca... | true |
a5b7ddff942e9f762589bf619f676352fbd53001 | Python | Aasthaengg/IBMdataset | /Python_codes/p03239/s329910579.py | UTF-8 | 202 | 2.890625 | 3 | [] | no_license | n,t=map(int,input().split())
ct=[]
ans=[]
for i in range(n):
ct=[int(x) for x in input().split()]
if ct[1] <=t:
ans.append(ct[0])
if ans==[]:
print("TLE")
else:
print(min(ans))
| true |
5a087eb33e0e9869166f89ff6918f1a8a43d12e3 | Python | chipinvision/text-to-speech-python | /tts.py | UTF-8 | 1,011 | 3.28125 | 3 | [] | no_license | # IMPORT ALL REQUIRED MODULES AND PACKAGES
from tkinter import *
import pyttsx3
# TEXT TO SPEECH CONVERSION FUNCTION
def convert():
text = txt.get()
engine.say(text)
engine.runAndWait()
# MAIN APPLICATION
main = Tk()
main.title('Text to Speech')
main.geometry('300x200')
main.resizable(0,0)
# VOICE SETTIN... | true |
470457ea2f3452e80580796976161c4b6b6153c4 | Python | tarees01/pythonfun | /subset.py | UTF-8 | 249 | 3.609375 | 4 | [] | no_license | def subset(target,list):
if (list == []):
return []
elif (list[0] - target > 0):
return subset(target-list[0],list[1:])
elif (list[0] - target < 0):
return subset(list[1:])
elif (list[0] - target == 0):
return True
return False | true |
53f06ad3e937bac95c860da2f13a07f9a9ecdc3d | Python | zoui520/TableCell | /extract-table.py | UTF-8 | 14,391 | 3.171875 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-#
# -------------------------------------------------------------------------------
# Name: extract-table.py
# Author: wdf
# Date: 2019/7/9
# IDE: PyCharm
# Parameters:
# @param:
# @param:
# Return:
#
# Description:
# 参考:
# https://answers.opencv.org... | true |
513190e1e9c93e34aa4155ad1a4743c87c143efc | Python | adhocmaster/WebAppForPic2Story | /routes.py | UTF-8 | 5,142 | 2.515625 | 3 | [
"Apache-2.0"
] | permissive | from flask import Blueprint, render_template, abort
from jinja2 import TemplateNotFound
from webLlib.ResponseProcessor import ResponseProcessor
from classifiers.ClassifierManager import Classifiermanager
from flask import request
import numpy as np
import pprint
from library.Configuration import Configuration
from data... | true |
9a5599f77f113737b33fdec6a6133c465bdc2199 | Python | ppvalluri09/Facial-Keypoint-Detection | /.ipynb_checkpoints/data_prep-checkpoint.py | UTF-8 | 732 | 2.59375 | 3 | [] | no_license | from torch.utils.data import Dataset
import pandas as pd
import numpy as np
from preprocess import *
class KeyPointGen(Dataset):
def __init__(self, train=True):
self.train = train
if self.train:
df = pd.read_csv('./data/training.csv')
df = preprocess(df)
self.data = df['Image'].values/255.0
self.y = d... | true |
2f6aa5892f87f9de81fbefe5c4ac0ca84e2a3893 | Python | Clint-Portfolio/Graph-coloring | /Code/boxplot.py | UTF-8 | 431 | 2.890625 | 3 | [] | no_license |
def boxplot(filename):
import csv
import pandas as pd
import matplotlib.pyplot as plt
data = pd.read_csv(filename, sep=';', header=None)
print()
# plot boxplot
#data.boxplot(column='4', return_type='axes')
data.plot.box()
plt.title('Boxplots for the cost functions')
plt.show... | true |
47f2a5d9cc95ce8ad359f3e4bab8545b9698f069 | Python | echoque/Test | /beautifulsoup/fenyelianjie.py | UTF-8 | 1,749 | 2.53125 | 3 | [] | no_license | #!/usr/bin/python
# -*- encoding:utf-8 -*-
import requests,json
import commonmethod
from bs4 import BeautifulSoup
def req(url):
res=requests.get(url)
res.encoding='utf-8'
resdic=res.text.lstrip(' newsloadercallback(').rsplit(');')
result=json.loads(resdic[0])
#reg=re.findall(r'url ',res... | true |
96ddf99e0e3953480a20af4b25eb2a0e7a2a6abf | Python | nhi-huynh/PIoT-A1-weather-analysis | /analytics.py | UTF-8 | 6,459 | 3.09375 | 3 | [] | no_license | from bokeh.plotting import figure, output_file, show
from bokeh.models import DatetimeTicker, FactorRange
from database import Database
from defineTimezone import *
import logging
import matplotlib.pyplot as plt
import matplotlib.axes
import numpy as np
import pandas as pd
logging.basicConfig(level = logging.DEBUG)
... | true |
4b11ae03f4b4953b6d218a21d0c031bad4ac84a3 | Python | wjosew1984/ejerciciospython1 | /bucle2.py | UTF-8 | 371 | 4.46875 | 4 | [] | no_license | #Ahora modifica el bucle para que escriba en 3 segundos 99 números. Piensa con cuidado los valores iniciales y finales del rango.
for n in range (3, 100, 3):
print ( n )
#4. Programa un bucle que haga una cuenta atrás de 10 hasta 1 y por último escriba el mensaje ‘¡Despegue!’:
for cuenta in range (10, 0, -1):
... | true |
0bebe30b4b07cdb576b8f9febbbc676dd6a937a2 | Python | alexfeitler/Programming2_Alex | /Notes/sorting.py | UTF-8 | 2,478 | 4.625 | 5 | [] | no_license | # sorting
# Swap Values
import random
a = 1
b = 2
print(a, b)
temp = a # temporarily store one value before I overwrite
a = b
b = temp
print(a, b)
# pythonic way
a, b = b, a # one line swap
print(a, b)
# Selection sort
# make a random list of 100 numbers from 1-99
rand_list = [random.randrange(1, 100) for x i... | true |
d961b7e8a9444d09949d82bd3c4401ffc8cb5738 | Python | oyedeepak/assignments-exc | /Naive Bayes/NB_spam.py | UTF-8 | 1,289 | 3.109375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Mon Apr 20 00:39:58 2020
@author: oyedeepak
"""
#Naive Bayes
# importing libs
import pandas as pd
import numpy as np
from sklearn.naive_bayes import MultinomialNB
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.metrics import accuracy_score,precision_sc... | true |
1b0842cf39edacde8721f89e41c659e9c395b986 | Python | contejus/Muter | /bot.py | UTF-8 | 2,160 | 2.515625 | 3 | [] | no_license | import os
import random
from discord.ext import commands
from discord.ext.commands.errors import CommandInvokeError
from discord.utils import get
from dotenv import load_dotenv
load_dotenv()
TOKEN = os.getenv('DISCORD_TOKEN')
bot = commands.Bot(command_prefix='!')
@bot.event
async def on_ready():
print(f'{bot.... | true |
c58256a222c4bed8240ffcc6990e3394c5989db7 | Python | MaximeDaigle/UltimateTic-Tac-Toe | /tp1_20043325_0909760.py | UTF-8 | 636 | 3.265625 | 3 | [] | no_license | import sys
from MetaGame import MetaGame
try:
parametre = sys.argv[1]
except IndexError:
parametre = input("rentrer un entier")
#mode arbre
if parametre == 'a':
stateOfGame = MetaGame(int(sys.argv[3]))
stateOfGame.childrenMaker(int(sys.argv[2]), None, True)
#mode affichage
elif para... | true |
3be8e9ef655150bced2276c0e44900a2df534eb0 | Python | jhubar/PI | /BruteForceModel/test.py | UTF-8 | 611 | 3.15625 | 3 | [] | no_license | import numpy as np
from scipy.stats import norm
import matplotlib.pyplot as plt
def normal_density(sigma_sq, dx):
return (np.exp(((dx ** 2) / sigma_sq) * (-0.5)) / np.sqrt(sigma_sq * 2 * np.pi))
x = np.linspace(-5, 20, 35)
y = []
ev = 12
for item in x:
sigma_sq = np.fabs(ev)
dx = np.fabs(item - ev)
... | true |
84f7b822d5ee469993003e69cfe2959a56bb64be | Python | andeersg/christmas-tree | /webserver.py | UTF-8 | 6,986 | 2.546875 | 3 | [] | no_license | from flask import Flask, render_template, request, jsonify
import datetime, json, time, requests, yaml
import array, fcntl, time, signal, sys, random, re
app = Flask(__name__)
spi = file("/dev/spidev0.0", "wb")
fcntl.ioctl(spi, 0x40046b04, array.array('L', [400000]))
# Message Class
class Message:
def getSettings(s... | true |
c12d1db7975c2fe066ae71bc3dc760845b8cffa7 | Python | digitalladder/leetcode | /problem1394.py | UTF-8 | 345 | 3.171875 | 3 | [] | no_license | #problem 1394 / find lucky interger in an array
class Solution(object):
def findLucky(self, arr):
"""
:type arr: List[int]
:rtype: int
"""
count = collections.Counter(arr)
res = -1
for i in count.keys():
if i == count[i]:
res = max(... | true |
2bf2c49b1cbe31443e8cedfc16c4f0f0ef221ca2 | Python | code-of-the-future/Automated-Messaging | /Automated_Messaging.py | UTF-8 | 292 | 3.28125 | 3 | [] | no_license | # Automated text messaging
# Import relevant modules
import time
import pyautogui
# Let's do some coding!
def SendMessage():
time.sleep(4)
text = open('message.txt')
for each_line in text:
pyautogui.typewrite(each_line)
pyautogui.press('enter')
SendMessage()
| true |
7adb7ebf7dd9d7d73d4c88f71f255c32892a5515 | Python | aitoehigie/unofficial-nairalandAPI | /venv/lib/python2.7/site-packages/zope/testbrowser/wsgi.py | UTF-8 | 8,774 | 2.515625 | 3 | [] | no_license | ##############################################################################
#
# Copyright (c) 2010-2011 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THI... | true |
723298bbbf730892fc47d9e36e9bf1657153d5c9 | Python | Abhinavs476/365daysofcode | /Day 7/1365.py | UTF-8 | 805 | 3.78125 | 4 | [] | no_license | ''' Given the array nums, for each nums[i] find out how many numbers in the array are smaller than it.
That is, for each nums[i] you have to count the number of valid j's such that j != i and nums[j] < nums[i].
Return the answer in an array. '''
class Solution(object):
def smallerNumbersThanCurrent(self, nums):
... | true |
e35c0c667f20d1b5e84f3eda31a3d1babc0c6b7a | Python | achoraev/SoftUni | /PythonBasics/WhileLoops/Labs/graduation.py | UTF-8 | 596 | 3.828125 | 4 | [
"Apache-2.0"
] | permissive | name = input()
current_class = 1
average_score = 0
total_grade = 0
is_graduated = False
count_excluded = 0
while True:
if current_class == 13:
is_graduated = True
break
grade = float(input())
if grade < 4:
count_excluded += 1
if count_excluded == 2:
... | true |
68e602c884ffe5470e03753ad8102999c327cdcb | Python | ralphd60/VegasHotel | /AnalysisType.py | UTF-8 | 676 | 3.578125 | 4 | [] | no_license |
# receives a label and a value and totals to provide a sum of that value
def type_label_and_total(row, col, col2, counts_dict2):
'''this function will take 2 columns, one will be the x axis (label- like country or hotel)
and a colmn with numbers and adds the total'''
if row[col] in counts_dict2.keys():... | true |
47e61039efafad643d5f3dd11a620d5bdd7439d2 | Python | ssanderson/turing.py | /turing.py | UTF-8 | 2,182 | 3.171875 | 3 | [
"MIT"
] | permissive | required_states = ['accept', 'reject', 'init']
class TuringMachine(object):
def __init__(self, sigma, gamma, delta):
self.sigma = sigma
self.gamma = gamma
self.delta = delta
self.state = None
self.tape = None
self.head_position = None
return
... | true |
1529c6ad7b99b6c8ef08e922adfbc5e1a2d8d76e | Python | RamitPahwa/CV | /1.py | UTF-8 | 1,561 | 2.9375 | 3 | [] | no_license | # import the necessary packages
import matplotlib.pyplot as plt
import numpy as np
import argparse
import cv2
# construct the argument parser and parse the arguments
ap = argparse.ArgumentParser()
ap.add_argument("-i", "--image", required = True, help = "Path to the image")
args = vars(ap.parse_args())
# load the i... | true |
8379d7bf2ac9877b50e1f8dde1a720230ec8cb75 | Python | xietingfeng/xiaoyuer | /agile/test1.py | UTF-8 | 66 | 2.859375 | 3 | [] | no_license | # coding:utf-8
a=[1,2,3,66]
print len(a)
print sum(a)
print max(a) | true |
152d8687cd5e5e45bd45663a27f0011eed7dfeb3 | Python | felipemcm3/ExerPython | /Pythonexer/ExerPython/aprendendopython/ex004.py | UTF-8 | 622 | 4 | 4 | [
"MIT"
] | permissive | variavel = input('Informe alguma coisa')
print('Essa váriavel é do tipo {}'.format(type(variavel)))
print('Essa váriavel é estaços {}'.format(variavel.isspace()))
print('Essa várivel é numero {}'.format(variavel.isnumeric()))
print('Essa váriavel é letras {}'.format(variavel.isalpha()))
print('Essa várivel é capitaliza... | true |
853c7f5aa1aa4570859fa0e0c1dbf7101e76937e | Python | float1251/AOJ | /Introduction/ITP1_3_A.py | UTF-8 | 49 | 2.59375 | 3 | [] | no_license | for i in xrange(0,1000):
print "Hello World"
| true |
6b9e297efd131873639f92c08105a7e6743ed599 | Python | juancferrer/kombu | /kombu/tests/utils/test_functional.py | UTF-8 | 5,211 | 2.90625 | 3 | [
"BSD-3-Clause"
] | permissive | from __future__ import absolute_import
import pickle
import sys
from itertools import count
from kombu.five import THREAD_TIMEOUT_MAX, items
from kombu.utils.functional import LRUCache, memoize, lazy, maybe_evaluate
from kombu.tests.case import Case, SkipTest
def double(x):
return x * 2
class test_LRUCache(... | true |
4febd8bf61bfa832232bc8146cf7d467d9a9327d | Python | Aussiroth/cpy5python | /Practical 04/q7_find_largest.py | UTF-8 | 577 | 3.890625 | 4 | [] | no_license | #File Name: q7_find_largest.py
#Author: Alvin Yan
#Date Created: 15/2/2013
#Date Modified: 15/2/2013
#Description: Finds largest integer in array
def find_largest(alist):
if len(alist)==2:
if alist[0]>alist[1]:
return alist[0]
return alist[1]
else:
if alist[0]>alist[1]:
... | true |
5f91554e31eb3045b59602dba310f1ed8a18ebcd | Python | geranazavr555/string-finder | /src/utils/trigram_counter.py | UTF-8 | 1,055 | 3.328125 | 3 | [] | no_license | import os.path
import sys
import os
def count_trigrams(filepath):
try:
with open(filepath, "rb") as file:
content = file.read()
except Exception as e:
return -1, 0
ans = 0
trigrams = set()
for i in range(len(content) - 2):
trigram = (content[i], content[i + 1], ... | true |
b211dddb2985cfd6e09739eb51471642fb81cafe | Python | paik11012/Algorithm | /study/백준im/temp.py | UTF-8 | 457 | 3.09375 | 3 | [] | no_license | def dfs(i):
visited[i] = True
for j in info[i]:
if not visited[j]:
# print(visited)
visited[j] = True
p.append(j)
dfs(j)
nums = [1, 2, 1, 3, 2, 4, 2, 5, 4, 6, 5, 6, 6, 7, 3, 7]
info = [[] for _ in range(8)]
for k in range(len(nums)//2):
info[nums[2 *... | true |
e840e28a8d224f4e4a0c01e62bbc777eaf5b298b | Python | qamine-test/codewars | /kyu_6/array_to_html_table/test_list_to_html_table.py | UTF-8 | 4,778 | 3.25 | 3 | [
"Unlicense",
"BSD-3-Clause"
] | permissive | # Created by Egor Kostan.
# GitHub: https://github.com/ikostan
# LinkedIn: https://www.linkedin.com/in/egor-kostan/
# FUNDAMENTALS ARRAYS
import allure
import unittest
from utils.log_func import print_log
from kyu_6.array_to_html_table.to_table import to_table
@allure.epic('6 kyu')
@allure.parent_suite('Novice')... | true |
d78790503ecdb6bfe28e60661a145f0cd22db9d7 | Python | izabelcavassim/Genome_scale_algorithms | /gsa-read-mapper-master/mappers_src/border_map_src/parsers.py | UTF-8 | 1,901 | 3.15625 | 3 | [] | no_license | # Course in Genome scale algorithms
from collections import OrderedDict
import random
def fasta_parser(filename):
file = open(filename, 'r').read()
file_separe = file.split('>')
# print file_separe
file_separe.remove('')
dict_fasta = OrderedDict()
for entry in file_separe:
seq = entry... | true |
421754ad3382547e98c254b75b76a2868e31fb06 | Python | PhotonCatcherYT/model-rocket-one | /magaccel.py | UTF-8 | 3,138 | 3.3125 | 3 | [] | no_license | # Simple demo of the FXOS8700 accelerometer and magnetometer.
# Will print the acceleration and magnetometer values every second.
import time
from datetime import datetime
import board
import busio
import adafruit_fxos8700
import adafruit_fxas21002c
import csv
from Adafruit_BMP085 import BMP085
from datetime impor... | true |
36c765220c11be18197419eb6f1d4dca082255b7 | Python | Arthur-Miertschink/ExerciciosPhyton | /Lista1/Exercicios pt. 2/ConvertendoMoedas.py | UTF-8 | 1,738 | 4.3125 | 4 | [] | no_license | print('Convertendo moedas')
moedaDeEntrada = int(input('Digite a moeda que deseja converter ( 1: Real // 2: Dólar // 3: Libra ): '))
moedaDeSaida = int(input('Digite a moeda desejada ( 1: Real // 2: Dólar // 3: Libra ): '))
if (moedaDeEntrada != 1 and moedaDeEntrada != 2 and moedaDeEntrada != 3):
print('A moed... | true |
57e5f04687bf61be083aba40138263d515fc6fa6 | Python | zconnect-iot/zconnect-django | /zconnect/testutils/util.py | UTF-8 | 5,065 | 2.65625 | 3 | [
"MIT"
] | permissive | import datetime
import inspect
from itertools import chain
import json
import re
import time
from django.db.models.fields import DateTimeField
from django.db.models.fields.files import FileField, ImageField
from django.db.models.fields.related import ManyToManyField
import jsonfield
import pytest
# pylint: disable=at... | true |
c649a19071d65b50e1f4a3ef808d6afab22a10bd | Python | fujimaki3968/atcoder | /ABC167/d.py | UTF-8 | 509 | 2.546875 | 3 | [] | no_license | N, K = map(int, input().split())
A = list(map(int, input().split()))
now = 1
B = [0] * N
cycle = -1
bC = -1
if K < N:
for _ in range(K):
now = A[now - 1]
print(now)
exit()
else:
for i in range(N+1):
now = A[now - 1]
if B[now - 1] == 0:
B[now - 1] = i
else:
... | true |
bb5440a5e76c71cf0288e32847abd7d7c63d5673 | Python | anepaul/ChallegeQuestions | /ProductArray/ProductArray.py | UTF-8 | 1,000 | 4.09375 | 4 | [] | no_license | # source https://www.interviewcake.com/question/java/product-of-other-numbers
# Write a function getProductsOfAllIntsExceptAtIndex() that takes an array of integers and returns an array of the products.
# Do not use division in your solution.
def get_products_of_all_ints_except_at_index(arr):
result_arr = [0] * le... | true |
ad1e2d80cb44accbf2348cd3014e4e412cc1c778 | Python | BiliBiLL/CS519 | /leetcode_problems/coinchange.py | UTF-8 | 1,213 | 3.921875 | 4 | [] | no_license | """
You are given coins of different denominations and a total amount of money amount. Write a function to compute the fewest number of coins that you need to make up that amount. If that amount of money cannot be made up by any combination of the coins, return -1.
Example 1:
coins = [1, 2, 5], amount = 11
return 3 (... | true |
8692d80b067e92d1aca6c342637826c884c6c44c | Python | Yogev911/DataRetrieval | /utils/sandbox.py | UTF-8 | 4,779 | 2.734375 | 3 | [] | no_license | import conf
import re
def findWholeWord(w):
return re.compile(r'\b{}\b'.format(w)).search
def is_in_order(arg1, arg2, list):
any([arg1, arg2] == list[i:i + 2] for i in xrange(len(list) - 1))
operator = ['OR', 'AND', 'NOT']
data = []
query = 'hi two "two birds in the sky" my "hello\'" name AND is OR (... | true |
48e44e13e39e365ddaff4c21b6756642cd98a324 | Python | steampunc/toy-box | /controls/intro-pid/block.py | UTF-8 | 1,970 | 3.203125 | 3 | [] | no_license | import pygame
import time
class Block():
def __init__(self, center, width, height):
self.center = center
self.point1 = (center[0] - (width / 2.0), center[1] - (height / 2.0))
self.point2 = (center[0] + (width / 2.0), center[1] - (height / 2.0))
self.point3 = (center[0] - (width / 2.... | true |
7a26adc2e785d34660bd4f86ee23bfcd18efe989 | Python | SonDog0/bigdata | /R_re/py1812/MachineLeaning/05bDataType.py | UTF-8 | 832 | 4.5625 | 5 | [] | no_license | # 튜플
# 리스트와 비슷한 자료형이지만
# 리스트는 []를 사용하지만, 튜플은 () 사용
# 튜플은 삭제, 수정이 불가능
tuple1=()
tuple2=(1,2,3,4,5) # (1,2,3,4,5,)처럼 써도 문제 없음
tuple3=('a','b','c','d','e')
tuple4=(1,2,3,'a','b','c')
print(tuple2, tuple4)
# 튜플 삭제나 수정해보기
# tuple1.append(1) # 추가불가
# tuple2[2] = 100 # 수정불가
# del(tuple4[3]) # ... | true |
b1403f0051a18dc51c500de25af61cc8f31ece6b | Python | badilladrian/python_concepts | /Herencia/ejerc_herencia.py | UTF-8 | 1,607 | 4.78125 | 5 | [] | no_license |
"""Aqui vamos a ver herencia, lo que es super()
y la diferencia entre method overloading y method overriding
el constructor de python se llama init"""
#esta es mi clase base
class Humano1:
def __init__(self,nombre,edad):
self.nombre=nombre #definiendo las propiedades
self.edad=edad #de la clase
... | true |
cb135486f81478cf86e852a92ab36ee36cf08513 | Python | PatrickPitts/Principia | /main.py | UTF-8 | 1,142 | 2.84375 | 3 | [] | no_license | import ReportBuilder as RB
from Kinematics import ProjectileMotion2d as pm
from Mathematics import deg_to_rad
def main():
while True:
print("Welcome to the Projectile Motion Report Builder.")
print("Create a new Report, or press 'q' to quit")
i = input(">>>")
if i == "q":
... | true |
5ca8d4111045cca939d82f3fb71506ad35fc9c87 | Python | artbycrunk/service-monitor | /src/service_monitor/storage.py | UTF-8 | 2,488 | 2.875 | 3 | [
"MIT"
] | permissive | import sqlite3
from sqlite3 import Error
import os
import logging
logger = logging.getLogger(__name__)
DB = None
def get_db():
"""Build a valid storage path for a sqlite db."""
pkg_dir = os.path.dirname(os.path.dirname(os.path.dirname(__file__)))
data_dir = os.path.join(pkg_dir, "data")
if not os.pat... | true |
8fc660dfd2df28c619ee7a51320c6c764225a6d9 | Python | bitcores/adventofcode2015 | /d14.py | UTF-8 | 1,491 | 2.625 | 3 | [] | no_license | import operator
allset = set()
deer = {}
race = {}
lrace = {}
runtime = 2503
with open("input14.txt") as fp:
cnt = 0
for line in fp:
roudis = line.split(" ")
if not roudis[0] in deer:
deer[roudis[0]] = {}
if not roudis[0] in race:
race[roudis[0]... | true |
5dcdbc288cd9c32ee827fbf59b9a99c90b38325a | Python | sharaalfa/s7Airlines | /pairRelation.py | UTF-8 | 493 | 2.515625 | 3 | [] | no_license | import index
import function
x = index.data['Weight'].values
y = index.data['Height'].values
z = index.data['BMI'].values
# get picture pair ralations x, y and z
function.Determinator().createPair(x, y, z)
# box
#index.data.plot(kind='box')
# scatter
#index.data[['BMI', 'Height']].plot(x='BMI', y='Height', kind='... | true |
6b2d92cc138839537f1c9ebe1ec27d1d068b848e | Python | Mutyala-Rupesh/Data_structures | /lists.py | UTF-8 | 203 | 3.53125 | 4 | [] | no_license | list1 = [1,2,3,"hello"]
list1.append((2,0))
list1.extend((2,0))
list1.insert(3,"example")
print(list1)
del list1[3]
print(list1)
a = list1.pop(4)
print(a)
list1.remove(2)
print(list1) | true |
a6fa8279b1592a05c8b6a5bc49e859ee7349f3e1 | Python | powellquiring/bridgepy | /src/bridgepy/fast.py | UTF-8 | 2,388 | 2.546875 | 3 | [] | no_license | import bridgepy
import fastapi
from starlette.responses import Response
import click
import pathlib
import uvicorn
app = fastapi.FastAPI()
hands = []
@app.get("/")
async def index():
#return Response(content=score())
return Response("""
We | They
50 | 0
30 | 0
-------------
40 | 0
----------... | true |
526140125fe490a8fd795f43bea639d81bdf0251 | Python | calista95/Leetcode | /Easy/romanToInt.py | UTF-8 | 592 | 3.859375 | 4 | [] | no_license |
#Title: Roman to Int
#Date: 4/5/2019
rome = {"I":1, "V":5, "X":10, "L":50, "C":100, "D":500, "M":1000}
def getInt(s):
stack=[]
sum=0
for char in s:
if len(stack) ==0:
stack.append(char)
sum+=rome[char]
else:
if rome[stack[-1]] >= rome[char]:
... | true |
c2eeda3305442c29cdcb3b99e7c1d8addfd8083f | Python | sivanagarajumolabanti/Chromata | /asyncbasic/chainawait.py | UTF-8 | 705 | 2.734375 | 3 | [
"MIT"
] | permissive | import asyncio
import logging
logger = logging.getLogger('example')
async def Gf():
print('gf')
logger.info('gf')
await F()
return 'gf'
async def F():
print('f')
await C()
return 'f'
async def C():
print('c')
await asyncio.sleep(5)
return 'c'
def main():
loop = asyncio.... | true |
b5e928a1f47ab39c10d88a2588a450f579759593 | Python | zhanxinjie/pthon | /爬取校花网/python_xiaoww_demo1.py | UTF-8 | 1,320 | 2.828125 | 3 | [] | no_license | #函数封装版
import re
import requests
import hashlib
import time
def get_index(url):
respose = requests.get(url)
if respose.status_code==200:
return respose.text
def parse_index(res):
urls=re.findall(r'class="items".*?href="(.*?)"',res,re.S)#re.S把文本信息转换成1行匹配
## print(urls)
return urls
def get_... | true |
e69d24fa42b303480ce1f71cf736a86365894e9d | Python | RayPm/waymen_bi_hw | /util.py | UTF-8 | 585 | 2.859375 | 3 | [] | no_license | import matplotlib.pyplot as plt
import statsmodels.api as sm
'''
通过statsmodels工具
返回三个部分 trend(趋势),seasonal(季节性)和residual (残留)
'''
def plot_stl(data, isShow=True):
result = sm.tsa.seasonal_decompose(data, period=30)
fig = plt.figure(figsize=(12, 8))
ax1 = fig.add_subplot(311)
ax2 = fig.add_subp... | true |
85ffe8a0600ce241141f18df38a41c60ede9c361 | Python | syed-gilani/sputnik | /sputnik/sputnik/spiders/sputnikbot.py | UTF-8 | 965 | 2.625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import scrapy
from scrapy.spiders import SitemapSpider
from datetime import date
from sputnik.items import SputnikItem
class SputnikbotSpider(SitemapSpider):
name = 'sputnikbot'
allowed_domains = ['sputniknews.com']
sitemap_urls = ['https://sputniknews.com/sitemap_article_index.xml?... | true |
156e45908afadc99b5bbccfb96ef0b9a937bd9d1 | Python | aselvais/PythonOOPexample | /libs/orm/User.py | UTF-8 | 508 | 3.625 | 4 | [] | no_license | """
User class
"""
class User:
first_name = ""
last_name = ""
date_of_birth = ""
email = ""
phone_number = ""
account_sum = 0
def __init__(self, row=[]):
self.first_name = row[0]
self.last_name = row[1]
self.date_of_birth = row[2]
self.email = row[3]
... | true |
76190a787189fa092d7ff5a443a50d70365481d9 | Python | oliabhi/Machine-Learning | /K-NN/knnReg.py | UTF-8 | 845 | 3.15625 | 3 | [] | no_license | import pandas as pd
import numpy as np
df = pd.read_csv("/Users/ao/Desktop/09 - Practical Machine Learning /Cases/Real Estate/Housing.csv")
dum_df = pd.get_dummies(df, drop_first=True)
from sklearn.model_selection import train_test_split
from sklearn.neighbors import KNeighborsRegressor
X = dum_df.iloc[:,1... | true |
96955cc96167ddfbed96bb1079ac94eb4f444aa2 | Python | attitudeyu/Plate-Detection | /Generate_image_label.py | UTF-8 | 1,781 | 2.84375 | 3 | [] | no_license | import cv2
import numpy as np
import os
Width = 64
Height = 64
Imgs_num = 50
def generate_labels(Imgs_num):
labels = []
for num in range(Imgs_num):
# 随机生成坐标
x1 = np.random.randint(8,18)
labels.extend([x1])
y1 = np.random.randint(21,31)
labels.extend([y1])
x2 = n... | true |
e6beb7b67f9eab738cd6d822f6c3d2eed69fe5bf | Python | otulakdominik/Bookstx | /library/utils.py | UTF-8 | 2,273 | 2.71875 | 3 | [] | no_license | from typing import Union
from .models import (
Book,
Author,
Categories,
)
import re
import requests
import datetime
def fetch_book(title: str) -> Union[None, dict]:
google_books = requests.get(url='https://www.googleapis.com/books/v1/volumes?q={title}'.format(title=title,))
books_json = google... | true |
b7ec8ae365134537f6a9bacb5f9caeb14edc7867 | Python | ddiazpinto/python-crawlerfeeder | /crawlerfeeder/sources.py | UTF-8 | 2,159 | 2.703125 | 3 | [
"MIT"
] | permissive | """
Data sources
All the data sources must extend DataSource abstract class and define `crawl` and `feed` methods.
This methods are automatically called during the crawl and feed processes.
"""
import httplib2
from abc import ABCMeta, abstractmethod
from apiclient.discovery import build
from oauth2client.service_accoun... | true |
9b1b011265cdd36fe3e0e793ddbd97ad88b1e42f | Python | overtime3/overtime | /overtime/components/trees.py | UTF-8 | 1,514 | 3.359375 | 3 | [
"MIT"
] | permissive |
from overtime.components.digraphs import TemporalDiGraph
from overtime.components.nodes import ForemostNodes
from overtime.components.arcs import TemporalArcs
class ForemostTree(TemporalDiGraph):
"""
A class which represents a static, undirected graph consisting of nodes and edges.
P... | true |
24da0d7fe3071b884a122dd5a097573423484c6d | Python | bugwumba/Project_Playground | /WebScraper.py | UTF-8 | 24,340 | 3.15625 | 3 | [] | no_license | #The purpose of this prgoram is to create a web scrapper that
#will eventually act as a ticker for the stock discord channel
# "Price Going Up? (On a Tuesday)"
import unittest
import pandas as pd
import selenium
import array as arr
from selenium import webdriver
from selenium.webdriver.support.select import Select
fro... | true |
d8915aebef737424782c0f3e740ae3ad0bcfc988 | Python | Seferan/picoCTF2018 | /super_safe_rsa_COMPLETE/get_flag.py | UTF-8 | 1,103 | 3.296875 | 3 | [] | no_license | #!/usr/bin/env python
from pwn import unhex
#c: 6248240025043854684405555049971462176821736811257920561518478991864242765793684
#n: 12251761860944483606751883449696528080072010141745857839539893207146089191955171
#e: 65537
#https://stackoverflow.com/a/9758173/5387119
def egcd(a, b):
if a == 0:
return (b... | true |
573dc9a25942aa613c914e6917f7390a82a5f7f4 | Python | gamble27/HW_Python | /sem2/z4/examples/matfiz_wars_a_new_hope.py | UTF-8 | 3,989 | 2.515625 | 3 | [] | no_license | import html.parser
import os
import re
from urllib.error import HTTPError
from urllib.request import urlretrieve, urlopen
# from works.urlparsing_guide.url_get import *
P_ENC = r'\bcharset=(?P<ENC>.+)\b'
def getencoding(http_file):
'''Отримати кодування файлу http_file з Інтернет.... | true |
0a5343d3d2d7a87b845be59d1dc3cde3b227d3d3 | Python | ericflo/awesomestream | /awesomestream/utils.py | UTF-8 | 2,624 | 3.1875 | 3 | [
"BSD-3-Clause"
] | permissive | import time
import datetime
def coerce_ts(value=None):
'''
Given a variety of inputs, this function will return the proper
timestamp (a float). If None or no value is given, then it will
return the current timestamp.
'''
if value is None:
return time.time()
if isinstance(value, int... | true |