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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
2c0d3c64f220bf4eddc5c3577c1aae158db6fdbe | Python | rafaelnunes44/CursoPythonExcript | /Módulo Básico 01 - 70/Aula 30 Operadores de Atribuição.py | UTF-8 | 378 | 4.125 | 4 | [] | no_license | #==========================================
#========= Curso de Phyton =============
#==========================================
"""
Atribuição
o valor ao lado direito do operador é atribuído à variável a esquerda do operador.
#Atribuição
x = y
#Comparação
x == y
"""
a = 9
x = y = z = a
print(a)
print(z)
prin... | true |
adbd95a8be8f1c04dccbb25f886acbb626ae630b | Python | SteveChristian70/MITx | /MITx/Week 3/Lecture 5/ex12GlobalVar.py | UTF-8 | 347 | 3.875 | 4 | [] | no_license | #using Global Varibles
def fibMetered(x):
global numCalls
numCalls += 1
if x == 0 or x == 1:
return 1
else:
return fibMetered(x-1) + fibMetered(x-2)
def testFib(n):
for i in range(n + 1):
global numCalls
numCalls = 0
print ('fib of ' + str(i) + ' = ' + str(fibMetered(i)))
print ('fib called ' + s... | true |
be6fdec92b39ee6c372414fc062557a36af6fd70 | Python | daniel-reich/ubiquitous-fiesta | /KgBqna3XhRkoL2mo7_9.py | UTF-8 | 265 | 2.9375 | 3 | [] | no_license |
def decrypt(s):
h = [i for i, n in enumerate(s) if n=='#']
conv = lambda x: chr(int(x)+96)
is_2d = lambda i: i+1 in h or i+2 in h
dc = [conv(s[i-2:i]) if x=='#' else conv(x)
for i, x in enumerate(s) if x=='#' or not is_2d(i)]
return ''.join(dc)
| true |
516b4dfc5847fa85a03661ec9e5939dfdcb86210 | Python | RohanDeySarkar/DSA | /linked_lists/sumOfLinkedLists/sumOfLinkedLists.py | UTF-8 | 890 | 3.546875 | 4 | [] | no_license | # This is an input class. Do not edit.
class LinkedList:
def __init__(self, value):
self.value = value
self.next = None
def sumOfLinkedLists(linkedListOne, linkedListTwo):
newLinkedList = LinkedList(0)
currentNode = newLinkedList
nodeOne = linkedListOne
nodeTwo = linkedListTwo
carry = 0
wh... | true |
5afb96d4063c297a6ddb864a0e5f3b1ce39b3de5 | Python | Bugnon/minecraft | /virtual_reality/fonctions/jump.py | UTF-8 | 482 | 2.515625 | 3 | [] | no_license | import time
import pyautogui
from mcpi.minecraft import Minecraft
import RPi.GPIO as gpio
mc = Minecraft.create()
x, y, z = mc.player.getPos()
buttonL = 14
gpio.setmode(gpio.BCM)
gpio.setup(buttonL, gpio.IN, pull_up_down=gpio.PUD_UP)
left0 = True
while True:
left = gpio.input(buttonL)
x,y,z = mc.player.getP... | true |
72ac3bcd2292f8c3a4412cf818f9fb71b35097a3 | Python | OOO-AAA/alerter | /cicd/test/unit_test.py | UTF-8 | 1,238 | 2.828125 | 3 | [
"Unlicense"
] | permissive | """Модуль юнит-теста. Проверяет код ответа фласка, проверяет тестовую страницу."""
import unittest
import os
import sys
import inspect
current_dir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
parent_dir = os.path.dirname(os.path.dirname(current_dir))
sys.path.insert(0, parent_dir)
impor... | true |
4355c72be189e7a6a07a63b9c7519ebdd2de197a | Python | SunnyQjm/algorithm-review | /chapter3/12_implement-queue-using-stacks.py | UTF-8 | 2,725 | 4.71875 | 5 | [] | no_license | #!/usr/bin/env python
# coding=utf-8
#################################################################################################
# Leetcode 232 用栈实现队列
#
# 使用栈实现队列的下列操作:
# push(x) -- 将一个元素放入队列的尾部。
# pop() -- 从队列首部移除元素。
# peek() -- 返回队列首部的元素。
# empty() -- 返回队列是否为空。
#
# 示例:
# MyQueue queue = new MyQueue()... | true |
a27dc8af0875d292c3ba7ce37ca3cf58c08f3bc2 | Python | ood-detection-dataset/flows_ood | /flow_ssl/data/toy_datasets.py | UTF-8 | 2,361 | 2.546875 | 3 | [] | no_license | import numpy as np
from sklearn import datasets
from PIL import Image
def make_circles_ssl():
np.random.seed(0)
n_samples = 1000
data = datasets.make_circles(n_samples=n_samples, noise=.05, factor=0.4)[0].astype(np.float32)
labels = np.ones((n_samples,)) * (-1)
idx1 = [0, 1, 3, 4]
labels[idx... | true |
d483ee6a33e4888362322657f5c9c16343895ed7 | Python | NTI-contest/ONTI-2018-19 | /final/command_tour/dzz/task_01/source_1.py | UTF-8 | 506 | 2.5625 | 3 | [] | no_license | def control():
num = 1
print "Reset hyro #%d" % num
hyro_request_reset(num)
sleep(1)
print "Enable hyro #%d" % num
hyro_turn_on(num)
sleep(2)
print "Get RAW data from hyro #%d" % num
for i in range(0,10):
(ret, x, y, z) = hyro_request_raw(num)
if ret==0:
p... | true |
53f45a71c6b94aa4ae5b74d6b673b115f1854a04 | Python | WeDias/RespCEV | /Exercicios-Mundo1/ex012.py | UTF-8 | 224 | 3.875 | 4 | [
"MIT"
] | permissive | item = float(input('Digite o Preço do produto: '))
desc = int(input('Digite o Valor do desconto: '))
preco = float(item - (item * desc / 100))
print('O produto com {}% de desconto, custara R${:.2f}!'.format(desc, preco)) | true |
3f91a0aaee562876bc24d9ab8bd6c3088dbb1bc1 | Python | Toervh/SmartGrid | /code/functions/prompts.py | UTF-8 | 13,018 | 3.65625 | 4 | [] | no_license | import csv
import copy
from code.classes.district import District
from code.algorithms.randomize import Random
from code.algorithms.hillclimber import Hillclimber
from code.algorithms.closest import Closest
from code.algorithms.kmeans import K_means
from code.classes.exceptions import NoBatteryError
from code.classes.b... | true |
ead0e2b7d6038bd9e394949fd4b3e55d06f65e92 | Python | anishnarang/cloaked-octo-lana | /ccbd/static/CCBD/GUI/inputfill.py | UTF-8 | 1,066 | 2.84375 | 3 | [] | no_license | from Tkinter import *
import matplotlib.pyplot as plt
from numpy import *
from math import *
import pylab
def show_entry_fields():
fig,axes=plt.subplots(nrows=1,ncols=1)
data=genfromtxt("q.txt",delimiter="\n")
query=genfromtxt("query.txt",delimiter="\n")
query1=query
x= arange(0, len(data))
insert(data,1,0)
i... | true |
363b80efc15188817e336331fc344c12d4aeca02 | Python | Nischay-Pro/BattleCode2019 | /bc19-scaffold/bots/7.NavBot2/mapping.py | UTF-8 | 781 | 2.90625 | 3 | [] | no_license | def get_nearby_map(x, y, given_map):
return [[given_map[y-2][x-2], given_map[y-2][x-1], given_map[y-2][x], given_map[y-2][x+1], given_map[y-2][x+2]], [given_map[y-1][x-2], given_map[y-1][x-1], given_map[y-1][x], given_map[y-1][x+1], given_map[y-1][x+2]], [given_map[y][x-2], given_map[y][x-1], given_map[y][x], given... | true |
3acfbb4368e956afe16eee90cf7e07d269e48841 | Python | ska-sa/scape | /scape/scan.py | UTF-8 | 24,045 | 2.921875 | 3 | [
"BSD-3-Clause"
] | permissive | """Container for the data of a single scan.
A *scan* is the *minimal amount of data taking that can be commanded at the
script level,* which corresponds to the *subscan* of the ALMA Science Data Model.
This includes a single linear sweep across a source, one line in an OTF map, a
single pointing for Tsys measurement, ... | true |
1f68e06fb2ef3238e7c85443afe3cec565ae9162 | Python | asen-krasimirov/Python-OOP-Course | /10. Testing/tests/cat_tests.py | UTF-8 | 1,097 | 3.671875 | 4 | [] | no_license | from solutions.cat import Cat
import unittest
class CatTests(unittest.TestCase):
def setUp(self):
self.cat = Cat('Boris')
def test_initialization(self):
self.assertEqual(self.cat.name, 'Boris')
def test_cat_size_increases_after_eating(self):
start_result = self.cat.size
... | true |
68c54546a254c75813fefff90786bd036ad7501b | Python | vaspupiy/home_work | /lesson_03/old_lessons/lesson_4_task_2.py | UTF-8 | 431 | 3.390625 | 3 | [] | no_license | while True:
try:
user_input = list(map(int, input("Введите список чисел через пробел: ").split()))
break
except ValueError:
print("Ошибка ввода")
print(f'Результат: {[user_input[i] for i in range(1, len(user_input)) if user_input[i] > user_input[i - 1]]}')
# test: 300 2 12 44 1 1 4 10 7... | true |
aa88a6bc3b66d80d598f8fc3769e20f0fa03af00 | Python | Wonyeaweat/experiments | /HPC&CC/Exp-1/DataAnalyze/main.py | UTF-8 | 311 | 3.09375 | 3 | [] | no_license | import numpy as np
import math
import matplotlib.pyplot as plt
x, y, z = [], [], []
z = np.linspace(-2, 100, 1000)
for i in z:
x.append(i)
y.append(np.sqrt(i**3+7))
x.append(i)
y.append(-np.sqrt(i ** 3 + 7))
fig = plt.figure()
ax = fig.add_subplot()
ax.scatter(x, y)
plt.show() | true |
270fb83a6c7a8079c71edd4f791fa05d6d33fac0 | Python | ketkisharma/insight_project | /autotaggr.py | UTF-8 | 15,102 | 2.640625 | 3 | [] | no_license | import pprint
import pandas as pd
import numpy as np
import string
import random
import collections
import heapq
from nltk.corpus import stopwords
from sklearn.feature_extraction.text import TfidfVectorizer
from bs4 import BeautifulSoup
from sklearn.utils import shuffle
from sklearn.model_selection import train_test_sp... | true |
e4a2a2d303b2e3adcc80fb8fa4bea9bc2e274e65 | Python | aramirez087/nanopool-watcher | /pool_watcher.py | UTF-8 | 2,770 | 2.625 | 3 | [] | no_license | from twilio.rest import Client
from datetime import datetime
from retrying import retry
from config import Config
from halo import Halo
import requests
import time
import os
# setup variables
config = Config().get()
account_sid = config.get('twilio', 'account_sid')
auth_token = config.get('twilio', 'auth_token')
clien... | true |
7bfe5870fbe3d96e156f81f9b643951eeb68e627 | Python | calinraducalin/HumanActivityRecognition | /training.py | UTF-8 | 5,311 | 3.125 | 3 | [] | no_license | import pandas as pd
import numpy as np
from matplotlib import pyplot as plt
import seaborn as sb
from sklearn.cluster import KMeans
import tensorflow as tf
# load data
train = pd.read_csv("train.csv")
test = pd.read_csv("test.csv")
print('Train Data', train.shape,'\n', train.columns)
print('\nTest Data', test.shape)
... | true |
c64f4670c7b5548e74a0c44a8f9e45c5097d2deb | Python | shaun95/arxiv_graph | /bin/create_img_dataset.py | UTF-8 | 10,795 | 2.71875 | 3 | [
"MIT"
] | permissive | '''
File to convert raw arxiv data stored in azure blob into transformed data that can be uploaded
to a graph and other downstream tasks for various learning tasks.
This is the main file that will call multiple other functions.
arxiv_dl
pdf
1991
1992
1993
...
src
1991
... | true |
75cdf672144610ac3aaa4ae419df95da08ea60b1 | Python | Gr1N/pytest-mockservers | /pytest_mockservers/udp_server.py | UTF-8 | 1,729 | 2.5625 | 3 | [
"MIT"
] | permissive | import asyncio
import contextlib
import socket
from asyncio import AbstractEventLoop, DatagramProtocol
from typing import Callable, Optional, Type
import pytest
__all__ = ("UDPServer",)
class DefaultProtocol(DatagramProtocol):
def datagram_received(self, data, _addr):
pass
class UDPServer:
__slots... | true |
93c6fef3cd769a40307904539ac7257a79acf0b6 | Python | ynsgnr/sequencer | /models/word2vec.py | UTF-8 | 512 | 2.796875 | 3 | [] | no_license |
from sklearn.feature_extraction.text import TfidfVectorizer
def get_word_dictionary(sprinkled_subs):
# build all words dictonary for dataset
all_words = {}
for subreddit in sprinkled_subs:
for word in subreddit.split(" "):
if not word in all_words:
all_words[word]=1
... | true |
47aa4cfa39ea1a75ecb9f1fdad787ef124fa04d3 | Python | lunyu520/AI-learning | /CVML/testinf.py | UTF-8 | 2,791 | 3.15625 | 3 | [] | no_license | import tensorflow as tf
from tensorflow.examples.tutorials.mnist import input_data
# 载入数据集
mnist = input_data.read_data_sets("MNIST_data", one_hot=True)
class simpleInfer(object):
def __init__(self, model_path):
self.load_model(model_path)
self.sess = None
def load_model(self, mo... | true |
b18f0eabc755ccbd6a61e92516c034cde4219164 | Python | DincerDogan/Data-Science-Learning-Path | /Data Scientist Career Path/7. Summary Statistics/1. Variable Types/5. match categ.py | UTF-8 | 299 | 3.3125 | 3 | [
"MIT"
] | permissive | import codecademylib3
# Import pandas with alias
import pandas as pd
# Import dataset as a Pandas dataframe
movies = pd.read_csv("movie_show.csv",index_col=0)
# View the first five rows of the dataframe
print(movies.head())
# Print the data types of dataframe with .dtypes
print(movies.dtypes)
| true |
4142bce8681725277b65588c4cf807758a27c72d | Python | aleksandragaworska/Bikes | /bikes/bikesapp/tasks.py | UTF-8 | 924 | 2.609375 | 3 | [] | no_license | from .models import Station, StationState
from .parse import get_data
from celery import task
import logging
logger = logging.getLogger(__name__)
@task()
def update_station_states():
station_states, station_infos = get_data()
for station_info in station_infos:
station = Station()
... | true |
100241dbbd1b08f404c03972260ebff7d80de339 | Python | manzaigit/ntulearndownloader | /ntudownloader.py | UTF-8 | 1,466 | 2.6875 | 3 | [
"MIT"
] | permissive | import os, requests
from bs4 import BeautifulSoup
from settings import NTULEARN_URL
from urllib.parse import urlparse, urljoin
def ntu_login(username, password):
auth = {'user_id': username, 'password': password}
s = requests.Session()
s.post(NTULEARN_URL, data=auth)
return s
def page_pdf_downloa... | true |
5f2fadfd55c0836aeb00c0f1298fd73d7e58bd79 | Python | shardul-shah/Project-Euler | /p4.py | UTF-8 | 540 | 4.3125 | 4 | [] | no_license | """
A palindromic number reads the same both ways. The largest palindrome made from the product of two 2-digit numbers is 9009 = 91 × 99.
Find the largest palindrome made from the product of two 3-digit numbers.
"""
def main():
largestPalindrome = 0
for i in range(100, 1000):
for j in range(100, 1000):
product... | true |
c36b079d192fa41df7af5f114afdf518dab928ee | Python | bpeebles/exifsort | /exifsort.py | UTF-8 | 3,476 | 2.828125 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""exifsort.py
Copy or move digital pictures or movies using EXIF or filesystem
timestamps in a way that was idiosyncratic to the author.
See LICENSE.txt for licensing."""
__version__ = '0.2'
import sys
from glob import iglob
from optparse import OptionParser
import os... | true |
61519cc62149c26ff168193b726c9139ef26ca8e | Python | Nahuan-Abreu/Unicid | /1a. semestre/3.Programação de computadores/Nahuan de Abreu Silva [26363518]- 1C - lista 2/velocidade.py | UTF-8 | 328 | 3.5625 | 4 | [] | no_license | velocidade_do_caro = float(input("Digite a velocidade do carro: "))
velocidade_acima = velocidade_do_caro - 80
if velocidade_do_caro <= 80:
print("Tudo certo!")
else:
print("Você vai ser mutado!")
total = velocidade_acima * 5
print(f"Sua multa será em R${total} pois passou {velocidade_acima} km/h do lim... | true |
5e4eb1d3e731ff48380fd6f7ea1cd84a05602c2c | Python | Oscar0159/AutoDrawEdge | /main.py | UTF-8 | 3,087 | 2.84375 | 3 | [] | no_license | import os
import time
import ctypes
from glob import glob
import cv2
import numpy as np
# 筆畫粗細
LINE_WEIGHT = 5
# 降噪等級
# 過大會導致線條遺失
DENOISE_LEVEL = 6
# 視窗位置
X1, Y1 = 760, 310
X2, Y2 = 1520, 730
# 每 S 秒傳送 N 個滑鼠點擊事件
# 傳送過多可能會導致事件過多而錯誤
S = 1
N = 200
def cv_imread(filename):
img = cv2.imdecode(np.fromfile(filenam... | true |
1e49fe307a9fb1eb6138d33baf49c8f650bf110b | Python | bburgin/pytest-split-tests | /pytest_split_tests/__init__.py | UTF-8 | 3,941 | 2.59375 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
import json
import math
from random import Random
from _pytest.config import create_terminal_writer
import pytest
def get_group_size(total_items, total_groups):
"""Return the group size."""
return int(math.ceil(float(total_items) / total_groups))
def get_group(items, group_size, gr... | true |
68e1ea8ad93041adb22ba882bb99da0ac4b747cf | Python | aCoffeeYin/pyreco | /repoData/shrubberysoft-django-picklefield/allPythonContent.py | UTF-8 | 15,170 | 2.828125 | 3 | [] | no_license | __FILENAME__ = fields
"""Pickle field implementation for Django."""
from copy import deepcopy
from base64 import b64encode, b64decode
from zlib import compress, decompress
try:
from cPickle import loads, dumps
except ImportError:
from pickle import loads, dumps
from django.db import models
from dj... | true |
df70ae73014f8309d5ab5dc504e8b67e23d01e1b | Python | jyodroid/python_training | /personal/sudoku_solver/sudoku_solver.py | UTF-8 | 4,727 | 3.546875 | 4 | [
"MIT"
] | permissive | # Class https://docs.python.org/3/tutorial/classes.html
class SudokuSolver:
def __init__(self, boxes, unitlist):
self.boxes = boxes
self.unitlist = unitlist
# My solution
def set_boxes_values(values):
board = {}
for index in range(len(self.boxes)):
board[self.bo... | true |
f5c833748e33a996edd8d21560985e833ce3b000 | Python | bettybub/depaul | /CSC401/partition.py | UTF-8 | 436 | 4.21875 | 4 | [] | no_license | def partition(soccer):
new = soccer.split() # split string into seperate entities in a list
print(new) # print list
for name in new: # for loop to check each name in the list
if name[0] >= 'A' and name[0] <= 'M':
print('Group 1: ', name)
else:
print('Group 2: ', nam... | true |
f1ef359f7e6c2b0a01146225cbb6331541e428b7 | Python | AlperKoc/LeetCode_Problems | /#7_ReverseInteger.py | UTF-8 | 600 | 3.046875 | 3 | [] | no_license | class Solution:
def reverse(self, x):
reverse = list(reversed(str(x)))
result = []
for i in range(len(reverse)-1):
if reverse[0] == '0':
del reverse[0]
if reverse[-1] == '-' or reverse[-1] == '+':
result = reverse[-1] + "".joi... | true |
694d6a8a86d926d43acd34b32fdf966e82290d11 | Python | Aravindh-vnix/Training | /Code_kata/kata09_back_to_checkout_test.py | UTF-8 | 299 | 2.84375 | 3 | [] | no_license | import unittest
from kata09_back_to_checkout import Checkout
class MyTest(unittest.TestCase):
def test(self):
self.assertEqual(210, Checkout.calculateTotal("AAABBCD"))
self.assertEqual(50, Checkout.calculateTotal("A"))
self.assertEqual(45, Checkout.calculateTotal("BB")) | true |
35abb43d608fc7ba78a47515d8b0f8d8cbf5dc89 | Python | neumic/dicewarePasswordGenerator | /die_test.py | UTF-8 | 1,039 | 3.359375 | 3 | [] | no_license | import unittest
import unittest.mock
from die import Die
class TestDie(unittest.TestCase):
def test_die_functional(self):
die = Die()
for roll in range(100):
value = die.roll()
checkRoll(self, value)
@unittest.mock.patch('die.random')
def test_die_mocked_random(self, randomMock)... | true |
0373a4261febce570c4e5e831e4a5ccd3b23d039 | Python | Shamanou/Neurocryptocracker | /trader/generators/generator.py | UTF-8 | 428 | 2.53125 | 3 | [
"Apache-2.0"
] | permissive | '''
Created on Oct 28, 2017
@author: Shamanou van Leeuwen
'''
import requests
from tgym.core import DataGenerator
class Generator(DataGenerator):
@staticmethod
def _generator(market):
while True:
y = requests.get("https://cex.io/api/tickers/BTC/"+market)
if y.status_c... | true |
5ea649e6426cc8f1cf3102525393bc88f8495c7a | Python | Hyumaio/file-checksum | /main.py | UTF-8 | 3,484 | 3.515625 | 4 | [] | no_license | # @Created Time: 2019.07.16
# @author: hyumaio
import hashlib
import os
import traceback
import click
@click.command()
@click.option('--file', '-f', help='上传文件,请使用绝对路径。')
@click.option('--mode', '-m', default='MD5', help='参考:[1:MD5, 2:SHA1, 3:SHA256],"MD5" 是默认 digest 模式。')
@click.option('--value', '-v', help='原始 has... | true |
af0e54b5541af840ffbe3658d4e0c0b895c9b972 | Python | harshmalik9423/SeleniumPractice | /Selenium methods/links.py | UTF-8 | 438 | 2.921875 | 3 | [] | no_license | from selenium import webdriver
from selenium.webdriver.common.by import By
driver = webdriver.Chrome(executable_path="C:\BrowserDrivers\chromedriver.exe")
driver.get("https://google.com")
links = driver.find_elements(By.TAG_NAME, "a")
print(len(links))
for link in links:
print(link.text)
# Click on link
# driv... | true |
1d9356e312ed81f56801503072640736ea6fc259 | Python | nayanex/Googleinterview | /counting_Valleys.py | UTF-8 | 393 | 3.328125 | 3 | [] | no_license | n = 8
s = "UDDDUDUU"
sea_level = 0
valley_count = 0
mountain_or_valley = s[0]
for index, step in enumerate(s):
if step == 'U':
sea_level += 1
else:
sea_level -= 1
if sea_level == 0:
if mountain_or_valley == 'D':
valley_count +=1
if index < len(s) -1:
... | true |
ccf066e87dc0837003d5455bdba0628614477e49 | Python | LeonPyramid/Messenger_data_treatment | /file_reader.py | UTF-8 | 746 | 3.171875 | 3 | [] | no_license | import json
import os
def ExtractAllDataFromFolder(directory):
"""Return the dicitonnary stored in each .json file in a list
Args:
directory (string): the directory in which the message_x.json are stored
Returns:
list(dict): list of all the dictionnary stored in each .json fil... | true |
f5e178f9ecbc9cfedb3da6c1b1b391011a507b38 | Python | Aasthaengg/IBMdataset | /Python_codes/p02546/s049615114.py | UTF-8 | 71 | 3.28125 | 3 | [] | no_license | S = input()
if(S[len(S)-1] == 's'):print(S + 'es')
else :print(S + 's') | true |
7ed5a00a9aa308572a403782562e833d653910eb | Python | tanjingjing123/LeetcodeAlgorithms | /maze.py | UTF-8 | 818 | 3.265625 | 3 | [] | no_license | import collections
def hasPath(maze, start, destination):
queue = collections.deque()
queue.append(tuple(start))
visited = set()
while queue:
start = queue.popleft()
if list(start) == destination:
return True
visited.add(start)
row, col = start
for r... | true |
b103888adcb9e6ab35958fb8c9ea808cbe8742b1 | Python | Djjimenez895/Directory-Scanner | /DirectoryScanner.py | UTF-8 | 3,131 | 3.96875 | 4 | [] | no_license | import os
from FileStatistics import FileStatistics
import matplotlib.pyplot as plt
import numpy as np
'''
Description: Uses matplob lib to graph the data passed in as input
Input: stats - a FileStatistics object that contains a dictionary with the file extensions (the key) and the number of files with that ex... | true |
fc4811078d3fcf24951c5a978e5c6461b12cca18 | Python | alexismajchrzak/ProjetPythonNoSQL | /code/game.py | UTF-8 | 6,259 | 2.859375 | 3 | [] | no_license | from logging import root
from flask import Flask, redirect, url_for, request
import pymongo as pm
import urllib.parse as urlparse
from urllib.parse import parse_qs
app = Flask(__name__)
@app.route("/jeux")
def game():
'''
il y a 5 tableau pour l'affichage sur la page web
'''
tabCollnameGame = []
... | true |
9021049c9caaaa239dfa758eeeff848f83823678 | Python | santiagoclv/python-3 | /basics_1/week_1/py4e/functions.py | UTF-8 | 1,017 | 4.25 | 4 | [] | no_license | # Built-in functions
max('Hello world') # 'w'
min('Hello world') # ' '
len('Hello world') # 11
int(-2.3)
float('3.14159')
str(32)
import math
degrees = 45
radians = degrees / 360.0 * 2 * math.pi
print(math.sin(radians))
import random
for i in range(10):
x = random.random()
print(x)
random.randint(5, 10) ... | true |
f5059894393803d21a82ee041d18420d7742d53d | Python | alanngo/PythonSummerClass | /UnitTests/TestCalc.py | UTF-8 | 703 | 3.359375 | 3 | [] | no_license | from unittest import *
from UnitTests.Calculator import *
# assertEquals(expected, actual): 2 variables are equal in content
# assertNotEquals(expected, actual): 2 variables are NOT equal in content
# assertTrue(condition): condition is true
# assertFalse(condition): condition is false
# assertRaises(SomeErro... | true |
c25532a2edc89350013bf5e9cfa285adee315cae | Python | OstapHEP/ostap | /ostap/logger/colorized.py | UTF-8 | 8,606 | 3.203125 | 3 | [
"BSD-3-Clause"
] | permissive | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# =============================================================================
## @file
# Simple colorization of strings
# @author Vanya BELYAEV Ivan.Belyaev@itep.ru
# @date 2013-02-10
# =============================================================================
""... | true |
3b19f875fc0dbd285670796ec764e374dcab44a3 | Python | wilsonjlam/bin | /alfred/workflows/user.workflow.77256706-CC9D-4A19-B267-C9E08D885B8B/parsedatetime/tests/TestAlternativeAbbreviations.py | UTF-8 | 6,102 | 2.78125 | 3 | [
"MIT"
] | permissive | import unittest, time, datetime
import parsedatetime as pdt
class pdtLocale_en(pdt.pdt_locales.pdtLocale_icu):
"""Update en locale to include a bunch of different abbreviations"""
def __init__(self):
super(pdtLocale_en, self).__init__(localeID='en_us')
self.Weekdays = [ 'monday', 'tuesday'... | true |
116b5d83519e425b57ff9dc7e5c13a3a78893b40 | Python | MarsJedi/databases | /upload_data.py | UTF-8 | 854 | 2.921875 | 3 | [] | no_license | import mysql.connector as mysql
import pandas as pd
import numpy as np
def connect_to_mysql():
db = mysql.connect(
host="localhost",
user="root",
passwd="Mj887627",
database="Slipher"
)
print(db)
pointer = db.cursor()
return pointer, db
def upload_data():
data... | true |
e4ccbc0dffdf359774b5cf5866e0135604851c88 | Python | parkerahall/dailycodingchallenge | /3-3-19.py | UTF-8 | 703 | 3.90625 | 4 | [] | no_license | def cartesian_product(ranges):
previous = [[]]
for rng in ranges:
new = []
for term in rng:
for prev in previous:
new.append(prev + [term])
previous = new
return ["".join(term) for term in previous]
def possible_characters(digits_to_letters, digit_string)... | true |
bda47385c814fc9094d4d9b8271a436a6a52a3bf | Python | caimengyuan/daydayup | /leetcode/LongestSubstringWithoutRepeating.py | UTF-8 | 1,305 | 4.28125 | 4 | [] | no_license | '''
给定一个字符串,请你找出其中不含有重复字符的 最长子串 的长度。
示例 1:
输入: "abcabcbb"
输出: 3
解释: 因为无重复字符的最长子串是 "abc",所以其长度为 3。
'''
# 滑动窗口的方法
class Solution(object):
def LengthOfLongestSubstring(self, s):
if not s:
return 0
left = 0 # 创建在原字符串的左窗口边界的索引
cur_len = 0 # 窗口的当前长度
max_len = 0 ... | true |
fe166192b92dbc0f2bb847cc34d966ae32d99e32 | Python | IvanaXu/PyTools | /077.Test_BeeWare_windows/beeware-tutorial/beeware-venv/Lib/site-packages/toga/sources/base.py | UTF-8 | 1,001 | 3.046875 | 3 | [
"MIT"
] | permissive |
class Source:
def __init__(self):
self._listeners = []
@property
def listeners(self) -> list:
""" The listeners of this data source.
Listeners can be ``callable`` or :obj:``toga.Widget``.
Returns:
A list of objects that are listening for data change.
"... | true |
2ace070d57f20c8d5f234814430fbecfa99ba9c2 | Python | lozog95/dobor_asortymentu | /piec.py | UTF-8 | 595 | 3.21875 | 3 | [] | no_license | class Piec():
def __init__(self, name, time_per_material, time_limit):
self.name = name
self.time_per_material = time_per_material
self.time_limit=time_limit
def __init__(self, name):
self.name = name
def set_time_per_material(self, time_per_material):
self.time_per... | true |
3d7a7ded2bf8a2f91325be32ff990bbb4c479ee5 | Python | Unathimtwa/Pre-bootcamp-challenge | /task 6.py | UTF-8 | 226 | 3.328125 | 3 | [] | no_license |
def max_of_three_numbers(n1, n2, n3):
if n1 < n2 < n3:
print(n3)
elif n1 < n2 > n3:
print(n2)
else:
print(n1)
return max_of_three_numbers(n1, n2, n3)
(max_of_three_numbers(2, 12, 6))
| true |
1f7508fb387e92f67f057b449b9e16fefb3a5ec8 | Python | maris-terauds/RTR108 | /studentu_darbu_parbaude_2014/3/public_html/darbi2/LD23/234.py | UTF-8 | 760 | 2.96875 | 3 | [] | no_license | # Fails 234.py
# Autors Andrejs Billers
# Rezistota shematiska attela izveidosana -I
from PythonMagick import Image
# Izgatavojam jaunu objektu - bilde
# Objekta izmeers 32x32 pixels
bilde = Image ("32x32", "#ee0000")
for x in range(9):
y=5
bilde.pixelColor(x,y, "#000000")
for y1 in range(2,9):
x1=9
... | true |
94bd089e3bb24e2c23617d95b8f8bcf42e4abf57 | Python | boknowswiki/mytraning | /lintcode/python/0428_pow_x_n.py | UTF-8 | 502 | 3.140625 | 3 | [] | no_license | #!/usr/bin/python -t
# er fen
class Solution:
"""
@param x {float}: the base number
@param n {int}: the power number
@return {float}: the result
"""
def myPow(self, x, n):
# write your code here
if n < 0:
x = 1/x
n = -n
ret = 1
t... | true |
4ef02cebf5d0ae5fd4232294f66696f3e7e79741 | Python | ctvandekamp/adaptive-networks | /Python files/ODEs/Bifurcation diagram mean field Chen/bifurcation_mean_field.py | UTF-8 | 6,877 | 3.359375 | 3 | [] | no_license | '''
Bifurcation diagram of the discrete system in mean field approximation
'''
import numpy as np
from math import fsum
from scipy.integrate import odeint
import matplotlib.pyplot as plt
def MeanField(stateDensities, t, w0w2, k=1, C=5):
# I think Chen uses k=3 ?
# Computing the state dynamics rates
w0 =... | true |
d5afc75ba4d7e1d824890e397883ec325bf0fc3a | Python | SifatHamidi/Bangla-Handwritten-Digit-Recognizer | /test.py | UTF-8 | 887 | 2.671875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""Test
Here the final model are loaded and used to test the images to show its working accuracy.
"""
import cv2
import tensorflow as tf
import matplotlib.pyplot as plt
def prepare(filepath):
IMG_SIZE = 32
img_array = cv2.imread(filepath, cv2.IMREAD_GRAYSCALE)
new_array = cv2.resi... | true |
c2c4fe7a92136ff7966c46707e56d5dff1e0fd95 | Python | khang4/alparune | /old tests/test_base.py | UTF-8 | 578 | 2.578125 | 3 | [] | no_license | import mmax;
import snode;
import timeit;
def main():
maxHeight=10;
minChildren=1;
maxChildren=5;
maxValue=100;
gentreeProgress=1;
tree=snode.genTree(maxHeight,minChildren,maxChildren,maxValue,gentreeProgress);
# snode.levelPrint(tree);
print("nodes generated: ",snode.snode.id);
pr... | true |
2915bc5c31db80822699e0ef652d5f296cd7bb3f | Python | cqkh42/advent-of-code | /aoc_cqkh42/__init__.py | UTF-8 | 549 | 2.78125 | 3 | [
"MIT"
] | permissive | import importlib
from aocd.models import Puzzle
def submit_answers(solution, day, year):
puzzle = Puzzle(year=year, day=day)
solution = solution(puzzle.input_data)
puzzle.answer_a = solution.part_a()
puzzle.answer_b = solution.part_b()
def answer(year: int, day: int, data: str):
module_string ... | true |
33d90350b6f550d1755eb578d4a6b90eb6f77ee5 | Python | louisgry/Algorithm | /python-algo/swordoffer-python/coding.py | UTF-8 | 143 | 2.96875 | 3 | [] | no_license | nm = list(map(int, input().split(" ")))
N = nm[0]
M = nm[1]
data = []
for i in range(M):
data.append(int(input()))
print(N, M)
print(data)
| true |
49d9f67beb3141b654c408dabb40cae3924f7adf | Python | briantdrew/automate | /L44_open_edit_pdfs.py | UTF-8 | 376 | 2.734375 | 3 | [] | no_license | import os
os.chdir('/Users/btdrew/Desktop/docs-pdf')
import PyPDF2
pdfFile = open('meetingminutes1.pdf', 'rb') # opened in read binary mode
reader = PyPDF2.PdfFileReader(pdfFile)
print(reader.numPages)
page = reader.getPage(0)
print(page.extractText())
# to get all the text in the doc
for pageNum in range(reader.numPag... | true |
8821a752561a30ec0f2a7bfc9e71ac8363f29e31 | Python | Vivhchj/LeeeCode_Notes | /33.搜索旋转排序数组_mid.py | UTF-8 | 3,987 | 4.28125 | 4 | [] | no_license | # 假设按照升序排序的数组在预先未知的某个点上进行了旋转。
# ( 例如,数组 [0,1,2,4,5,6,7] 可能变为 [4,5,6,7,0,1,2] )。
# 搜索一个给定的目标值,如果数组中存在这个目标值,则返回它的索引,否则返回 -1 。
# 你可以假设数组中不存在重复的元素。
# 你的算法时间复杂度必须是 O(log n) 级别。
# 示例 1:
# 输入: nums = [4,5,6,7,0,1,2], target = 0
# 输出: 4
# 示例 2:
# 输入: nums = [4,5,6,7,0,1,2], target = 3
# 输出: -1
### Solution:二分法
### 1.函数递归
cl... | true |
94acd996f5527249044c592ccfd4b4a9ee70960d | Python | MaximFirsoff/infa_2020_pussywagon | /lab4/task_1.py | UTF-8 | 846 | 2.953125 | 3 | [] | no_license | import pygame
from pygame.draw import *
pygame.init()
FPS = 30
screen = pygame.display.set_mode((400, 400))
rect(screen, (176,196,222), (0,0,400,400)) # Заливка экрана
circle(screen, (255,255,0), (200, 200), 100) # Рожица
circle(screen, (220,20,60), (170, 170), 20) # Левый глаз
circle(screen, (0,0,0), (170, 170), ... | true |
7442b0cb36155a663a3e4fb55d57f6572c1bf7e4 | Python | JAMKuttan/ChIPseq_Analysis | /workflow/scripts/trim_reads.py | UTF-8 | 4,451 | 2.640625 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
#
# * --------------------------------------------------------------------------
# * Licensed under MIT (https://git.biohpc.swmed.edu/BICF/Astrocyte/chipseq_analysis/LICENSE.md)
# * --------------------------------------------------------------------------
#
'''Trim low quality reads and remove... | true |
9969f307d29a4096dff0242273f6b0f84ba30e01 | Python | AdamZhouSE/pythonHomework | /Code/CodeRecords/2818/60651/234037.py | UTF-8 | 239 | 3.140625 | 3 | [] | no_license | list1=input().split()
n=int(list1[0])
time=int(list1[1])
list2=input().split()
list2=[int(x) for x in list2]
list2.sort()
sum=0
for i in range(n):
t=time-i
if t>1:
sum+=t*list2[i]
else:
sum+=list2[i]
print(sum)
| true |
36955da0949a6970783ba4d324175682431fe919 | Python | orbitalsqwib/scriptlib | /scriptlib/scriptfile.py | UTF-8 | 3,485 | 3.15625 | 3 | [
"MIT"
] | permissive | '''
ScriptFile
File Manager for the scriptlib package
Developed by Orbtial
'''
#Custom Imports
from . import scriptui
#Standard Imports
import os
def initPTPDIR(filePathAttr):
"""
Returns a string representation of the path to the file's parent directory.
Should be initialised and stored before using any other fu... | true |
89ede4357c4800eafb1ff0b462c50186f0cb1818 | Python | QuantumApostle/leetcode2019 | /hash_table/FindAllAnagramsInAString.py | UTF-8 | 627 | 3.265625 | 3 | [] | no_license | # LC 438
from collections import Counter
class Solution:
def findAnagrams(self, s: str, p: str) -> List[int]:
result = []
n, m = len(s), len(p)
p_str = Counter(p)
cur_str = Counter(s[:m])
if p_str == cur_str:
result.append(0)
for i in range(1, n - m + 1)... | true |
c06a356d181b60d4044cf2fa49e2cda08fbb2be5 | Python | BoyangChenFEM/APPfemLinear | /LinearFEMProgram/Elements/tri2d3elem.py | UTF-8 | 7,766 | 2.984375 | 3 | [
"Apache-2.0"
] | permissive | # -*- coding: utf-8 -*-
"""
Class and functions for a 2D 3-node linear triangular element
@author: Boyang CHEN, TU Delft Aerospace, 2019
"""
import numpy as np
import numpy.linalg as la
from .integration_point import igpoint
from ..Materials import linear_elastic
class tri2d3elem:
"""class for tri2d3 ele... | true |
c836f344b09639b32e9efee45958856da8b1f3e1 | Python | razyesh/python-training | /Beeflux-test/q4.py | UTF-8 | 409 | 4.34375 | 4 | [] | no_license | """
Q4.
Whats the difference between tuple and list.
Ans: Tuple is a immutable object and list is mutable.
Tuple gives fast result and List gives comparatively slow result
Consider a list
l = [1,2,3,4,5,6,7,8,9]
how can you get last 4 items in l
"""
#given list
l = [1,2,3,4,5,6,7,8]
count = len(l)
#for loop to ... | true |
3de357d799533a1a35dc8848d1629387e8da71a9 | Python | taraokelly/Problem-Sheet-MNIST-Reader | /solutions/out_img_png.py | UTF-8 | 4,093 | 3.484375 | 3 | [
"MIT"
] | permissive | # Tara O'Kelly - G00322214
# Emerging Technologies, Year 4, Software Development, GMIT.
# Problem set: Read the MNIST data files
# 3. Use Python to output the image files as PNGs, saving them in a subfolder in your repository. Name the images in the format train-XXXXX-Y.png or test-XXXXX-Y.png where XXXXX is the image... | true |
24c73a1ba643a1e9b66c0a27e1fc17c9cf210c44 | Python | dariabajda/slack-helper-flask | /message.py | UTF-8 | 304 | 2.609375 | 3 | [] | no_license | import sys
from flask import jsonify, request
def send_slack_message(message):
try:
return jsonify(
text=message,
response_type="in_channel"
)
except:
return sys.exc_info()[0]
def get_entered_text():
return request.form.get('text').lower()
| true |
9dc643b013000051f70a9d4501226a3c695a3078 | Python | deadsquirrel/courseralessons | /test7.1.py | UTF-8 | 166 | 3.328125 | 3 | [] | no_license | # Use words.txt as the file name
fname = raw_input("Enter file name: ")
print fname
fh = open(fname)
for line in fh:
line = line.strip()
print line.upper()
| true |
f8b51d98b082efec110af3018ae2e381578625e2 | Python | sunshot/LeetCode | /28. Implement strStr()/solution1.py | UTF-8 | 1,361 | 3.46875 | 3 | [
"MIT"
] | permissive | class Solution:
def strStr(self, haystack: str, needle: str) -> int:
if not needle:
return 0
n = len(haystack)
m = len(needle)
if n < m:
return -1
if n == m:
if needle == haystack:
return 0
else:
... | true |
23dd607631e7c7d45803b4f22a2a8a5b05e8982d | Python | k----n/Tactics-War-Game | /powerup/Health_PUP.py | UTF-8 | 927 | 2.859375 | 3 | [
"LicenseRef-scancode-public-domain"
] | permissive | from powerup.base_power import BasePower
import powerup, helper
from tiles import Tile
import pygame
class Health_PUP(BasePower):
"""
The basic health increasing power up.
By default the health increase is set to 10.
"""
sprite = pygame.image.load("assets/Health_PUP.png")
def __init__(se... | true |
d15244241509ee327d27d57d89b06ba2b3511dd7 | Python | ubco-W2020WT1-data301/course-project-group_6005 | /analysis/Scripts/.ipynb_checkpoints/project_functions-checkpoint.py | UTF-8 | 3,041 | 3.25 | 3 | [
"MIT"
] | permissive | import os
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
# Method Chaining
def load_and_process(path):
# Chain 1: Data loaded and missing data removed
df1 = (
pd.read_csv(os.path.join('..','..','data','raw','database.csv'))
.dropna()
... | true |
80aff820445b6ceb4fb28d683365230de717c71e | Python | mkissarli/url-shortener | /src/server.py | UTF-8 | 2,139 | 2.921875 | 3 | [
"MIT"
] | permissive | from quart import Quart, request, abort, redirect
from uuid import uuid4
import sqlite3
from sqlite3 import Error
def create_connection(path):
connection = None
try:
connection = sqlite3.connect(path)
print("Connection to SQLite DB successful")
except Error as e:
print(f"The error '{e}' occu... | true |
a2eb9e47ef904d0dabe8e46eebdc1aa8c76af919 | Python | calvincxz/CS4248_Project | /corpus_process.py | UTF-8 | 570 | 2.78125 | 3 | [] | no_license | import json
sms_corpus_path = r'../Data/archive/smsCorpus_en_2015.03.09_all.json'
def get_sms_data():
sms_corpus_text_list = []
with open(sms_corpus_path, 'r') as sms_corpus_file:
sms_corpus_data = json.loads(sms_corpus_file.read())
sms_corpus_data = sms_corpus_data['smsCorpus']['message']
... | true |
21a4c51aa0d9a4dccf338dcfd35a2c71381576db | Python | priyankakumbha/python | /day17/test15.py | UTF-8 | 141 | 3.28125 | 3 | [] | no_license | print(1)
try:
print(2)
x = 20
y = 10 / 0
print(3)
except:
print("except begin", x)
print("except end")
print(4, x)
| true |
8744f1ef9253cbefa9b5943ebb9b016670105a08 | Python | PrinceofChum/Guvi-CodeKata | /Array/02.py | UTF-8 | 123 | 2.8125 | 3 | [] | no_license | n = int(input())
lst = list(map(int,input().split()))
a = list(set(lst))
b = [i for i in a if lst.count(i) == 2]
print(*b)
| true |
4a595bba0268eed39db9d6ca997a4c1ae11e0a80 | Python | ramyamango123/test | /python/python/src/python_problems/regex/special_character_match.py | UTF-8 | 506 | 3.15625 | 3 | [] | no_license | import re
p = "Pyth#on is 10% $scripting %language&"
#x = 'Python is a #scripting language edited new\n', 'I am learning to? test it!'
#pattern = re.search("(.*)([#,$,%,^,&,<,@,!]*.*)", p)
pattern = re.search("(^.*)([#$%^&<@!_-]+)(.*)$", p)
print pattern.group(1)
print pattern.group(2)
print pattern.gr... | true |
c543a2bc8878931d0fdabcf646bca3b4bf1bc2c5 | Python | Ashwini1799/bootcamp-project | /py_project.py | UTF-8 | 534 | 3.28125 | 3 | [] | no_license | import hashlib
print(hashlib.algorithms_available)
#Challenge 1
hash= hashlib.md5(b"Yeah! I completed my challenge.")
print("MD5 Hash output :- ",hash.digest(), " \n")
#Challenge 2
hash1 = hashlib.sha1(b"Yeah! I completed my challenge.")
print("sha1 hash output :-", hash1.digest())
hash2= hashlib.s... | true |
7e52136215417cc6a9601b09ace50af5abb18cd6 | Python | suyuxi1/Python | /demo/Day19/使用Pillow来处理图像.py | UTF-8 | 1,651 | 3.328125 | 3 | [] | no_license | '''
使用Pillow来处理图像.py
@Author : su
@Time : 2020/04/12 21:12:53
'''
# 图片相关
from io import BytesIO
from PIL import Image
import requests as req
from PIL import Image, ImageFilter
# 系统相关
import os
# 打开图片,打印其格式,大小,图片类型
img = Image.open('/res/img/1.jpg')
print(img.format, img.size, img.mode)
# 复制
Image.open('/res/img/1.... | true |
857c8b169c5914fcac13874873c214ada5f4c0f9 | Python | SuryaNMenon/Python | /Other Programs/upperlowerswap.py | UTF-8 | 197 | 4 | 4 | [] | no_license | #Program to perform toUpper, toLower and swapCase functions
str = input("Enter the string")
print("Uppercase = ",str.upper())
print("Lowercase = ", str.lower())
print("Swapcase = ",str.swapcase())
| true |
6c62e25519c06c45099fd01369e4eaa97ba83a9e | Python | Lana243/Schreier-Sims-algorithm | /SchreierTree.py | UTF-8 | 1,197 | 2.828125 | 3 | [] | no_license | from permutations import Permutation
class SchreierTree:
#Build Schreier Tree recursively
def buildSchreierTree(self, root):
for sigma in self.formingSet:
newElement = sigma.perm[root]
if self.pr.get(newElement) is None:
self.pr[newElement] = root
... | true |
27273d9293cda0069e103339da064111176d7d18 | Python | CGenie/project_euler | /id_0026.py | UTF-8 | 3,079 | 3.34375 | 3 | [] | no_license | #!/usr/bin/python2
# #####################################################################
# id_0026.py
#
# Przemyslaw Kaminski <cgenie@gmail.com>
# Time-stamp: <>
######################################################################
from decimal import *
def generate_digits(n):
s = Decimal(1)/n
tol = Decimal... | true |
508190118447373983ce60f6110630d2415ae5c2 | Python | scipp/scipp | /src/scipp/configuration/__init__.py | UTF-8 | 3,263 | 2.65625 | 3 | [
"BSD-3-Clause"
] | permissive | # SPDX-License-Identifier: BSD-3-Clause
# Copyright (c) 2023 Scipp contributors (https://github.com/scipp)
# @file
# @author Neil Vaytet, Jan-Lukas Wynen
"""
Runtime configuration.
See https://scipp.github.io/reference/runtime-configuration.html
"""
# *** For developers ***
#
# When adding new options, update both th... | true |
b42b57db9c29218829df9455a0407fb683b82077 | Python | mamtapandey1910/data_visualization | /python_repos_visual.py | UTF-8 | 948 | 2.953125 | 3 | [] | no_license | import requests
from plotly.graph_objs import Bar
from plotly import offline
url = 'https://api.github.com/search/repositories?q=language:python&sort=star'
headers = {'Accept': 'application/vnd.github.v3+json'}
r = requests.get(url, headers= headers)
print(f"Status code: {r.status_code}")
# Process result
response_d... | true |
d5ad950acb380efa188fc0193ab8763b0a94d4d3 | Python | mairandomness/Advent-of-code | /advent_of_code_2018/day03/slice_it_part2.py | UTF-8 | 1,403 | 2.90625 | 3 | [] | no_license | def parse_input():
with open("input", "r") as f:
text = f.read()[:-1]
lines = text.split("\n")
lines = [line.split(" ") for line in lines]
lines = [[line[2][:-1].split(','), line[3].split('x')]for line in lines]
lines = [[[int(num) for num in coord] for coord in line]for line in lines]
r... | true |
cb43682f18e797ba1aa9712739a54cbb9b1e655c | Python | Wangjunling1/leetcode-learn | /python/947.py | UTF-8 | 1,858 | 3.53125 | 4 | [] | no_license | # n 块石头放置在二维平面中的一些整数坐标点上。每个坐标点上最多只能有一块石头。
#
# 如果一块石头的 同行或者同列 上有其他石头存在,那么就可以移除这块石头。
#
# 给你一个长度为 n 的数组 stones ,其中 stones[i] = [xi, yi] 表示第 i 块石头的位置,返回 可以移除的石子 的最大数量。
# 解题
# 使用并查集实现该题解释
# 并查集模版
class bing:
def __init__(self,len_list):
self.queue=list(range(len_list))
self.root=set()
def find(self,... | true |
8f37135eb890b7383fa59c81bd6aa5d8d5bab88c | Python | DiegoCodes/Tarea_02 | /porcentajes.py | UTF-8 | 341 | 3.578125 | 4 | [] | no_license | #encoding: UTF-8
# Autor: Diego Perez Villa AKA DiegoCodes, A01373737
# Descripcion: CalculaPorcentajes
# A partir de aqui escribe tu programa
h = int(input("Cuantos hombres hay inscritos?"))
m = int(input("Cuantas mujeres?"))
t = h+m
ph = (h/t)*100
pm = (m/t)*100
print("Entonces son",t,"? El porcentaje de hombres ... | true |
453663c40dc769dc73abfe12b61eeccf707bf6df | Python | chenxiaoyao/stock-strategy | /strategy/total_value_compare/strategy.py | UTF-8 | 748 | 2.828125 | 3 | [] | no_license | #coding=utf-8
import strategy_data as data
import utils
def getStockList():
all = []
for pair in data.info:
all.extend(pair[0 : 2])
return all
def run(price_df):
global df
df = price_df
for pair in data.info:
code1 = pair[0]
code2 = pair[1]
threshold = pair[2]
... | true |
c7a08935e1bd07de7207f3341ddd0f51eb81ebdd | Python | soelves/portfolio | /IN1000/IN1000/Uke 6/testHund.py | UTF-8 | 388 | 3.078125 | 3 | [] | no_license | from hund import Hund
def hovedprogram():
fido = Hund(4,20)
print("Fido er", fido.hentAlder(), "aar gammel.")
fido.spring()
fido.spring()
fido.spring()
fido.spring()
fido.spring()
print(fido.hentVekt())
fido.spring()
print(fido.hentVekt())
fido.spis(1)
print(fido.hent... | true |
e30cef9f6629497f9ab40442a1c4067958b23a4e | Python | betty29/code-1 | /recipes/Python/577719_Chess_Notation_Player/recipe-577719.py | UTF-8 | 18,894 | 3.796875 | 4 | [
"MIT"
] | permissive | # Chess Game
board = ["r", "n", "b", "q", "k", "b", "n", "r", "x", "x", "x", "x", "x", "x", "x", "x", " ", " ",
" ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ",
" ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", "X", "X", "X", "X", "X", "X",
... | true |
85ea35202bc7ab191993e18a14fa455f2ea76c04 | Python | green-fox-academy/FulmenMinis | /week-03/day-03/checkerboard.py | UTF-8 | 1,012 | 3.578125 | 4 | [] | no_license | from tkinter import *
root = Tk()
canvas = Canvas(root, width='300', height='300', bd='0')
canvas.pack()
# fill the canvas with a checkerboard pattern.
size = 37.5
cols = 8
rows = 8
squareList = []
for i in range(cols):
for j in range(rows):
if j%2: colors = ["black", "white"]
else: colors = ["w... | true |
1818e339e504b97b7c774c66e004c04d740b93e6 | Python | robgoyal/OnlineCourses | /cs50/intro-to-cs-round-1/pset7/finance/application.py | UTF-8 | 12,809 | 2.734375 | 3 | [] | no_license | # Name: application.py
# Author: Robin Goyal
# Last-Modified: June 5, 2017
# Purpose: Create a fictional financial portfolio
from cs50 import SQL
from flask import Flask, flash, redirect, render_template, request, session, url_for
from flask_session import Session
from passlib.apps import custom_app_context as pwd_con... | true |
391a7f82a22bffcb63c3972abb2977b16308703f | Python | uotter/fx_alert | /src/fx_search.py | UTF-8 | 4,942 | 2.875 | 3 | [] | no_license | import requests
import json
import configparser
import time
import pandas as pd
class ForeignExchange():
def __init__(self):
self.debug = True
self._init_config()
def _init_config(self):
self.config = configparser.ConfigParser()
self.config.read("config.ini", encoding="utf-8")... | true |