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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
e8b19cb400c858bc28d1ac1b33e8a1b3f7192903 | Python | j-rossi-nl/coliee-2019 | /Task_01/dataset_with_high_scores.py | UTF-8 | 1,259 | 2.765625 | 3 | [] | no_license | """
"""
import pandas as pd
INPUT_FILE = 'ranking/v3_train_scores.txt'
WITH_QRELS = 'text_summarized_200.csv'
def main():
scores = pd.read_csv(INPUT_FILE).set_index(['case_id', 'candidate_id'])
original = pd.read_csv(WITH_QRELS).set_index(['case_id', 'candidate_id'])
full_mix = scores.join(original).rese... | true |
105f437782b818e66122b84088377d775b1b04a8 | Python | 1997priyam/Data-Structures | /arrays&mix/countandsay.py | UTF-8 | 633 | 4.40625 | 4 | [] | no_license | """
The count-and-say sequence is the sequence of integers beginning as follows:
1, 11, 21, 1211, 111221, ...
"""
def countAndSay(A):
num = "1"
for i in range(A-1):
count = 0
prev = num[0]
new_num = ""
for j in range(len(num)):
if num[j] == prev:
count... | true |
0986876ba4b10cfe40a4acb6acb4c2b08ee379fd | Python | ZhengPeng7/MaoJuXiWu | /OS_final_project/FCFS_and_SJF.py | UTF-8 | 3,913 | 3.171875 | 3 | [
"BSD-2-Clause"
] | permissive | #!/usr/bin/python3.5
## Modify the SJF and FCFS algorithm in the topic of dealing with jobs.
job_num = 5
class Job():
# 定义作业
def __init__(self, arr_time=-1, sev_time=-1, cpt_time=-1, wghted_run_time=-1):
self.arr_time = arr_time
self.sev_time = sev_time
self.cpt_time = cpt_time
... | true |
093c265a12b28dcaa27b9876fc5a3998a29a3c0b | Python | gf234/python_problem_solving | /프로그래머스/JadenCase 문자열 만들기.py | UTF-8 | 476 | 3.25 | 3 | [] | no_license | def solution(s):
jadencase = []
words = s.split()
for word in words:
temp = word.lower()
if temp[0].isalpha():
jadencase.append(temp[0].upper() + temp[1:])
else:
jadencase.append(temp)
ans = ''
i = 0
flag = True
for c in s:
if c == ' ':... | true |
0e9dec060f2ff8d4a22d145c352abc43374fd031 | Python | senthilknatesan/home-sales-weather | /sap1.py | UTF-8 | 2,552 | 3.0625 | 3 | [] | no_license | #############################################################################
# File Name: sap1.py
# Creats the median listings and sold data files to be loaded into the mysql
#############################################################################
input_sold_file = '/Users/senthilnatesan/Desktop/job-search/sa... | true |
d074c80ff22d1909eb2eb9a301eefc1cf02c1f5c | Python | NilanjanaLodh/lab_sem5 | /DBMSlab/comparingDB_FS/addRecord | UTF-8 | 305 | 2.984375 | 3 | [] | no_license | #!/usr/bin/python
from sys import argv
import csv
filename= argv[1]
fileobj= open(filename,'r')
print fileobj.readline()
inputline = raw_input();
inputrow= inputline.split(',')
with open(filename,'a') as fileobj:
csvwriter = csv.writer(fileobj, delimiter=",")
csvwriter.writerow(inputrow)
| true |
1d5a709ca47eaf8eca132f2b6b2bd13638c72033 | Python | Anvesh8263/python-lab-30 | /perfectnumber.py | UTF-8 | 275 | 3.78125 | 4 | [] | no_license | num=int(input("Enter the number"))
sum=0
for i in range(1,num):
if(num%i==0):
sum=sum+i
if (sum==num):
print("The number is a perfect number")
else:
print("The number is not a perfect") | true |
aec9c04bc63d7fb0d5b65f2e8f2f6fdb159abbfc | Python | hoh1/MIS3640 | /In-Class-Activities/In-Class-5/shape3.py | UTF-8 | 883 | 3.953125 | 4 | [] | no_license | import turtle
import math
draw = turtle.Turtle()
turtle.speed(10)
draw.hideturtle()
def position (x,y):
turtle.penup()
turtle.setx(x)
turtle.sety(y)
turtle.pendown()
def polyline(t, n, length, angle):
for i in range(n):
turtle.fd(length)
turtle.lt(angle)
def arc... | true |
3a70f8d1710dab910d547a7e94ec57dba1c5b829 | Python | abespitalny/CodingPuzzles | /Leetcode/valid_sudoku.py | UTF-8 | 1,876 | 3.65625 | 4 | [] | no_license | from leetcode import *
class Solution:
# Time: O(n^2) where n is 9 in this case.
# Space: O(n)
def isValidSudoku(self, board: List[List[str]]) -> bool:
for i in range(9):
colSet = set()
rowSet = set()
for j in range(9):
if board[i][j] != '.':
... | true |
2adcc9536e7293cbcc571cc04b3224cf5a56b1d5 | Python | jacksonmoreira/Curso-em-video-mundo1- | /Exercicios/script023.py | UTF-8 | 157 | 3.796875 | 4 | [
"MIT"
] | permissive | from math import trunc
n1 = float(input('Digite um número:'))
n2 = trunc(n1)
print('{} foi o número digitado, sua porção inteira é {}.'.format(n1, n2))
| true |
1d22cab16424e2a52fed07478be8694c06339190 | Python | Prasantacharya/Stonk-bot | /bot/stonk.py | UTF-8 | 2,785 | 2.78125 | 3 | [
"MIT"
] | permissive | import sqlite3
import io
import json
import urllib3
http = urllib3.PoolManager()
'''
# Purpose: Helper function for getting stocks data,
# Args: stock ticker
# Returns: json data for stock from yahoo finance api
# Ex: getStonk('AMD') => {price: 15, currency: USD, ... }
'''
def getStonk(stonk):
r = http.request('G... | true |
1f294bf9031721065df392d5bc65b89ca54b790b | Python | StevenColeHart/CodingDojo | /Python/Django/BE_Wishlist/apps/my_wishlist/models.py | UTF-8 | 2,704 | 2.65625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models
import re
import bcrypt
email_regex = re.compile(r"(^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+$)")
# Create your models here.
class UserManager(models.Manager):
# in classes when you are defining function they must ha... | true |
4166c003f52083b6cf0fb6e29f01466181f8bcea | Python | taborns/vulneralapi | /vulneral/analyze/printer.py | UTF-8 | 854 | 2.546875 | 3 | [] | no_license | class Printer:
HEADER = '\033[95m'
OKBLUE = '\033[94m'
OKGREEN = '\033[92m'
WARNING = '\033[93m'
FAIL = '\033[91m'
ENDC = '\033[0m'
BOLD = '\033[1m'
UNDERLINE = '\033[4m'
@staticmethod
def createColorBlock( block, data):
return block + str(data) + Printer.ENDC
... | true |
7358fade85538fa2169ab74520332964ce85cca5 | Python | simonstead/imageserver | /app.py | UTF-8 | 379 | 2.640625 | 3 | [] | no_license | from flask import Flask, send_file, jsonify
from os import listdir
app = Flask(__name__)
@app.route('/')
def index():
return "GET @ /images/<filename>"
@app.route('/images/<image>')
def send_image(image):
if image in listdir('static/images'):
return send_file('static/images/{}'.format(image), mimetyp... | true |
171bd35231e7afc908c4ffc7272217eb1896f588 | Python | MertNuhuz/dabl | /dabl/pipelines.py | UTF-8 | 1,796 | 3.0625 | 3 | [] | permissive | from sklearn.dummy import DummyClassifier, DummyRegressor
from sklearn.preprocessing import MinMaxScaler
from sklearn.naive_bayes import GaussianNB, MultinomialNB
from sklearn.tree import DecisionTreeClassifier, DecisionTreeRegressor
from sklearn.pipeline import make_pipeline
from sklearn.linear_model import LogisticRe... | true |
8025fbb3e96ee62a80eb0bb441968b6bdc83de10 | Python | libing7569/stp | /stp/core/task.py | UTF-8 | 897 | 2.9375 | 3 | [] | no_license | #!/usr/bin/env python
#coding: utf-8
class Task:
def __init__(self, task_id, priority, tasktype, data, *subtasks):
self.task_id = task_id
self.priority = priority
self.state = None
self.type = tasktype
self.data = data
self.subtasks = {t.task_id: t for t in subtasks... | true |
d66aa50e79ab37c718d92a6b48a27d9040025c75 | Python | MrHamdulay/csc3-capstone | /examples/data/Assignment_5/hrrbha001/question1.py | UTF-8 | 978 | 4.25 | 4 | [] | no_license | # bbs simulator
# hs
# 23 march 2011
choice = ""
message = "no message yet"
while choice != "X":
print ("Welcome to UCT BBS")
print ("MENU")
print ("(E)nter a message")
print ("(V)iew message")
print ("(L)ist files")
print ("(D)isplay file")
print ("e(X)it")
print ("Enter your selection:")
... | true |
57a4a2488561ad1efa4bf681438f43dde6e892dd | Python | r8d8/lastlock | /QCA4020_SDK/target/sectools/qdn/sectools/common/utils/datautils/hex16_handler.py | UTF-8 | 2,257 | 2.703125 | 3 | [
"BSD-3-Clause",
"LicenseRef-scancode-free-unknown",
"LicenseRef-scancode-proprietary-license",
"LicenseRef-scancode-warranty-disclaimer",
"GPL-1.0-or-later",
"MIT",
"LicenseRef-scancode-public-domain-disclaimer",
"LicenseRef-scancode-unknown-license-reference",
"HPND",
"GPL-2.0-only",
"Apache-2.... | permissive | # ===============================================================================
#
# Copyright (c) 2013-2017 Qualcomm Technologies, Inc.
# All Rights Reserved.
# Confidential and Proprietary - Qualcomm Technologies, Inc.
#
# ===============================================================================
from .data... | true |
500f6906bb51bca7600a103a4403f29900052093 | Python | cjoewong/General_Edge | /lambda_functions/linear_regression_lambda.py | UTF-8 | 4,641 | 2.6875 | 3 | [] | no_license | '''
A linear regression model that runs on AWS Lambda
AWS needs a zip file because it doesn't have numpy (so I can't use the console editor)
Make sure the zip file name, .py name and the handler name on Lambda coincide.
@ Original Author : Liang Zheng
@ Modified by : Chege Gitau
'''
#__________________... | true |
86b40bb6f222b56c53fe5ed229d1eb5f5672e54e | Python | sds1vrk/Algo_Study | /Programers_algo/Greedy/pro_3_re_re.py | UTF-8 | 718 | 2.875 | 3 | [] | no_license | def solution(number, k):
num_size = len(number) - k
# 10-4 =6 개
start = 0
answer = ""
for i in range(num_size):
max_num = number[start]
max_idx = start
for j in range(start, k + i + 1):
if max_num < number[j]:
max_num = number[j]
m... | true |
0207b26718e9f675382aef505275fd39c2436b06 | Python | smadala/IIIT-PG11 | /sce/slides/python/pra/Python_example_scripts/Exceptions/try_finally.py | UTF-8 | 215 | 3.609375 | 4 | [] | no_license | #!/usr/bin/python
# demo of the try...finally construct
try:
n=float(raw_input('Enter your number:'))
double = 2 * n
finally:
print 'Who can stop me from executing?'
print 'Double=', double
| true |
468ea90b75a3af854757b51bb899f4e1c39c5d7d | Python | checheanya/HSE_bioinformatics | /HW3/needle_lin.py | UTF-8 | 639 | 2.84375 | 3 | [] | no_license | a = [i for i in (input()).upper()]
b = [i for i in (input()).upper()]
match, mut, gap = 5, -4, -10
leng = len(a) + 1
high = len(b) + 1
matrix = []
for i in range(high):
zero_row = [0] * leng
matrix.append(zero_row)
matrix[0] = [i * (-10) for i in range(leng)]
for i in range(1, high):
matr... | true |
9ed3f7bc024c4bbf3215190349941a598c3706e4 | Python | Ahmad-Shafique/Python-Problem-Solving | /Problem solutions/11.py | UTF-8 | 244 | 3.25 | 3 | [] | no_license | def QuestionEleven():
Input=input()
List = Input.split(",")
resultList = []
for item in List:
ni=item
if(number_conversion_helper.convertToBase(ni,2,10)%5==0):
resultList.append(item)
print(",".join(resultList))
QuestionEleven()
| true |
a002983634b80e6af5297e9d3d431b54c595e8ef | Python | deprofundis/deprofundis | /datasets.py | UTF-8 | 662 | 2.65625 | 3 | [
"MIT"
] | permissive | import numpy as np
import pandas as pd
from ipdb import set_trace as pause
class Dataset(dict):
def __init__(self, **kwargs):
dict.__init__(self, kwargs)
self.__dict__ = self
def load_mnist(filen='../data/mnist_train.csv.gz', nrows=None):
"""
Reads in the MNIST dataset and returns a Data... | true |
690bc3a4236dc41f21e40655bcd123bc7eaefbd9 | Python | wolfdale/Imgur-Image-Ripper | /imager.py | UTF-8 | 663 | 3.03125 | 3 | [
"MIT"
] | permissive | import urllib
from bs4 import BeautifulSoup
print 'Welcome to Imager'
a=int(raw_input("Enter Number of Images to be scratched: --> "))
for i in range(0,a):
web=urllib.urlopen('http://imgur.com/random')
soup=BeautifulSoup(web)
##soup.prettify()
for link in soup.find_all('img'):
if(0==0):##loop ... | true |
243f4942284e3e5adabf3a22c2e3bf5b472cdf47 | Python | Py-Za/basics02 | /homework02_part2.py | UTF-8 | 1,250 | 4.375 | 4 | [] | no_license | # Zadanie 2:
# Utwórz w nim klasę o dowolnej, sensownej nazwie. Klasa powinna zawierać pole counter, możliwe do ustawienia dla każdej instancji przy tworzeniu obiektu (jako argument w funkcji __init__()).
# Klasa powinna implementować bezargumentową metodę raise_counter(), która zwiększa pole counter w obiekcie o jeden... | true |
cbf8a66d925b21569cc1e1d9e63db9934466253d | Python | ldhjj77/ldhjj77.github.io | /python/A/A025_Stock.py | UTF-8 | 2,694 | 2.859375 | 3 | [] | no_license | from bs4 import BeautifulSoup
import urllib.request as req
import urllib.request
###################### 환율
def Exchange_Rate():
url = 'https://finance.naver.com/marketindex/'
res = req.urlopen(url)
soup = BeautifulSoup(res,'html.parser', from_encoding='euc-kr')
name_nation = soup.selec... | true |
00a74c6fdab1966e8905b5af3cb3547024e23714 | Python | recycledbeans/PigeonPi | /check_follows.py | UTF-8 | 1,677 | 2.90625 | 3 | [] | no_license | #!/usr/bin/env python
# Import all of the necessary modules
import os
import sys
import tweepy
import pygame
from credentials import * # <---- Be sure to put your Twitter application's credentials here
# Tweepy OAuth (Authentication)
auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(acce... | true |
bab766b2e8fa59431a3d183308b4f965b21dd5c5 | Python | ArdaCemBilecan/PythonProjects | /MatPlobLib.py | UTF-8 | 2,437 | 3.53125 | 4 | [] | no_license | import matplotlib.pyplot as plt
import pandas as pd
# matplotlib kutuphanesi
# gorsellestime kotuphanesi
# line plot, scatter plot, bar plot, subplots, histogram
df = pd.read_csv("iris.csv")
print(df.columns)
print(df.Species.unique())
print(df.info())
print(df.describe())
setosa = df[df.Species == "Iris-setosa"]... | true |
c9bef4a68e8bb9e29f66c29fb1770c765397afca | Python | yukikawana/PhotographicImageSynthesis | /vislog.py | UTF-8 | 369 | 2.53125 | 3 | [
"MIT"
] | permissive | import pandas as pd
import matplotlib as mpl
import matplotlib.pyplot as plt
import sys
window = 1000
fl=sys.argv[1]
ind=int(sys.argv[2])
if(len(sys.argv)>3):
window=int(sys.argv[3])
frame = test_df = pd.read_csv(fl, header=None, skiprows=17, sep=" ")
print(frame.ix[0,0])
frame.ix[:,ind].rolling(window=window).m... | true |
8297af6d0cc8c85435642602c65c5cc171b4f6d4 | Python | ItManHarry/Python | /PythonCSDN/code/chapter6/MultiExceptElse.py | UTF-8 | 196 | 3.578125 | 4 | [] | no_license | try:
a = int(input('Number A:'))
b = int(input('Number B:'))
print('a / b is : ', a / b)
except (ValueError, ArithmeticError) as e:
print(e)
print(type(e))
else:
print('Everything is OK!!!') | true |
bec5080cc20805dab29b6e27c9ec4a5d283da36b | Python | wesleyjr01/Harvard-CS50_2020 | /cs50_IntroductionToCS/week07_SQL/submission/houses/import.py | UTF-8 | 1,385 | 2.921875 | 3 | [] | no_license | import sys
import csv
import cs50
# Create database
db = cs50.SQL("sqlite:///students.db")
if len(sys.argv) != 2:
print("we need argv=2")
sys.exit()
else:
with open(sys.argv[1], "r") as csvfile:
students_csv = csv.DictReader(csvfile)
for student in students_csv:
array_name = st... | true |
ce202115737a9b7115e6371602dbde02dcdde5e9 | Python | WellingtonTorres/PythonExercicios | /ex035.py | UTF-8 | 436 | 3.984375 | 4 | [] | no_license | from time import sleep
print('=-='*10)
print('ANALISANDO UM TRIÂNGULO')
print('=-='*10)
a = float(input('Primeiro segmento: '))
b = float(input('Segundo segmento: '))
c = float(input('Terceiro segmento: '))
print("Analisando se as condições foram verdadeiras...")
sleep(3)
if a < b + c and b < a + c and c < a + b:
... | true |
5846e5df9180db5d72a1172570b2cede2f94d469 | Python | blockheads/ConquerorGame | /NPC/NordicHuman.py | UTF-8 | 894 | 2.796875 | 3 | [] | no_license | import codecs
import sys
import Sprites
from NPC.Npc import Npc, DATA_PATH
from util import Reader
class NordicHuman(Npc):
def __init__(self):
super().__init__(self.genName(),Sprites.NPC_H)
"""
Generates a nordic human name
"""
def genName(self):
# ensure proper encoding
... | true |
4962ebfec97c2c0cfbaba6d518103ffcec6bd560 | Python | dbarbella/analogy | /finding_analogies/fixes.py | UTF-8 | 720 | 2.65625 | 3 | [] | no_license | #array containing regular expressions for common scanning errors and the corrected strings
#TODO add RE for <end of sentence .Begin of next sentence> you'd and other would
fixes = [("\s*'\s*t\s*", "'t "),
("\s*'\s*ve\s*", "'ve "),
("\s*'\s*s\s*", "'s "),
("s\s*'\s*", "s' "),
... | true |
633a15c4c9701aeb95b4bd4e28531de25691a49e | Python | Voidoz/PyDecode | /Decode.py | UTF-8 | 1,300 | 3.421875 | 3 | [
"MIT"
] | permissive | #############################
# Import dependencies #
#############################
import html
import re
#############################
# Print intro #
#############################
print(str(
"######################################################\n" +
"# Welcome to PyDecod... | true |
47880ce7cc3084c123c5b69b5bfb222f85e9e689 | Python | FergusInLondon/Runner | /test/runner.py | UTF-8 | 3,377 | 2.90625 | 3 | [] | no_license | import unittest
import json
import pandas as pd
from unittest.mock import patch
from runner import Runner
def get_payload(fixture):
with open(f"test/fixtures/{fixture}.json") as json_file:
data = json.load(json_file)
return data
class MockStrategy(object):
def start(self, control):
self.... | true |
e24a03057372bfacacdbac1b3441203a2e19f108 | Python | syurskyi/Algorithms_and_Data_Structure | /Data Structures & Algorithms - Python/Section 6 Data Structures Stacks & Queues/src/48.SOLUTION-Queue-Enqueue.py | UTF-8 | 985 | 4.21875 | 4 | [] | no_license | class Node:
def __init__(self, value):
self.value = value
self.next = None
class Queue:
def __init__(self, value):
new_node = Node(value)
self.first = new_node
self.last = new_node
self.length = 1
def print_queue(self):
temp = self.first
... | true |
9e09f102876f0e2ba8526b3fb55cd6989beb3c5e | Python | openvinotoolkit/mmaction2 | /tools/data/hvu/merge_annot.py | UTF-8 | 4,028 | 2.921875 | 3 | [
"Apache-2.0"
] | permissive | from os import makedirs
from os.path import exists
from argparse import ArgumentParser
from collections import defaultdict
from tqdm import tqdm
def ensure_dir_exists(dir_path):
if not exists(dir_path):
makedirs(dir_path)
def get_valid_sources(all_sources):
return [s for s in all_sources if exists(s... | true |
51319ab10bd0f36bd1dd82e91e322c8c580d44b2 | Python | enterstudio/bokeh | /examples/plotting/file/color_data_map.py | UTF-8 | 1,411 | 2.671875 | 3 | [] | permissive | import numpy as np
from bokeh.io import show
from bokeh.layouts import gridplot
from bokeh.models import (
ColumnDataSource,
ColorBar,
LinearColorMapper,
LogColorMapper,
)
from bokeh.palettes import Viridis3, Viridis256
from bokeh.plotting import figure
x = np.random.random(2500) * 140 - 20
y = np.ran... | true |
14a2e0eedd37265cc952713f59fc7946bdeb5deb | Python | tectronics/geditcom-ii | /trunk/Scripts/Development/Miscellaneous/Decode Lat Lon.py | UTF-8 | 804 | 2.609375 | 3 | [] | no_license | #!/usr/bin/python
#
# Decode Lat Lon (Python Script for GEDitCOM II)
# Load GEDitCOM II Module
from GEDitCOMII import *
import math
################### Main Script
# Preamble
gedit = CheckVersionAndDocument("Decode Lat Lon",1.6,2)
if not(gedit) : quit()
gdoc = FrontDocument()
print str(GetScreenSize())
print str(Ge... | true |
c0581477a822bff7002ab1b310d1063db236761a | Python | MaGabriela21/flujoenredes | /Tarea1/instancias.py | UTF-8 | 1,781 | 2.859375 | 3 | [] | no_license | basicUnit = []
neighbors = []
with open("2DU60-05-1.dat",'r') as archivo:
n = int(archivo.readline())
for i in range(n):
stringLine = archivo.readline()
splitLine = stringLine.split(" ")
valueList = [float(e) for e in splitLine]
index, x, y, a, b, c = valueList
... | true |
41d58bc6cb7d2370a6cea67fdc9b01b0a09fedb7 | Python | b72uno/courses | /udacity/RND/perception/Exercise-1/RANSAC.py | UTF-8 | 4,420 | 3.09375 | 3 | [
"MIT"
] | permissive | # Import PCL module
import pcl
# Load Point Cloud file
cloud = pcl.load_XYZRGB('tabletop.pcd')
## Voxel Grid filter
# Create a VoxelGrid filter object for our input point cloud
vox = cloud.make_voxel_grid_filter()
# Choose a voxel (also known as leaf) size
# Note: this (1) is a poor choice of leaf size
# it implie... | true |
f4081a5394e8b58da9896046eb8ffaaa01e39dbb | Python | DaianeFeliciano/python-fatec | /atv40.py | UTF-8 | 547 | 4.21875 | 4 | [] | no_license | """Escreva um programa que pergunte o salário de um funcionário e calcule o valor do seu aumento.
Para salários superiores a R$1250,00, calcule um aumento de 10%. Para os inferiores ou iguais, o aumento é de 15%."""
salario = float(input("Digite o salário: "))
if salario > 1250:
aumento = (salario*0.10)+salario #(... | true |
f8125d14dce303f0c44e67c0a7999388ab1c73d1 | Python | kafedra-bit/resela-plus | /resela/model/User.py | UTF-8 | 6,110 | 2.75 | 3 | [] | no_license | """
User.py
*******
"""
import json
from flask import session as flask_session
from flask_login import UserMixin, AnonymousUserMixin
from keystoneauth1 import session
from keystoneclient.auth.identity import v3
from resela.app import APP, LOGIN_MANAGER
from resela.backend.managers.UserManager import UserManager
cl... | true |
26190ef4267c3f7880a815d16081ae770bf4fe8f | Python | kapitsa2811/STN-OCR-Tensorflow | /src_code/models/resnet_stn.py | UTF-8 | 3,317 | 2.734375 | 3 | [] | no_license | """
The script is the implementation of Resnet detection(Localisation network) and Recognition Network
"""
import tensorflow as tf
from tensorflow.keras import layers
from tensorflow.keras import regularizers
from src_code.models.resnet_tf import ResnetModel_18_34
kernel_regularizer = regularizers.l1_l2(l1=1e-4, l2=1e... | true |
6344e550031f9b7787efb21553d7b0b8db5cf976 | Python | shailenderacc/PythonProg | /ifProgramFlow/ifprogramflow.py | UTF-8 | 313 | 3.484375 | 3 | [] | no_license | _author_ = 'shail'
name = input("Please provide your name :")
age = int(input("Please provide your age, {0} :".format(name)))
if age >= 18:
print("You are old enough to vote {0}".format(name))
print("Please put X in the ballot box")
else:
print("Please come back after {0} years".format(18 - age))
| true |
7cd01abfa2650beb236195e93e419ac7e9477f49 | Python | dyeap-zz/CS_Practice | /Leetcode/79.py | UTF-8 | 1,560 | 3.546875 | 4 | [] | no_license | '''
var:
1. use a dictionary {let:adjacent letters}
1. go through all letters in grid.
if match first letter call search
2.
valid (row,col,grid)
search (word, index, row, col,grid )
1. base case:
return True
2. for row in (-1,1)
for col in (-1,1)
if valid(row,col,grid)... | true |
bf16b415385eeb08a4b6bbdd8f67bbf15db3b757 | Python | shahed-shd/Online-Judge-Solutions | /Codeforces/1100C - NN and the Optical Illusion.py | UTF-8 | 602 | 3.34375 | 3 | [] | no_license | # ==================================================
# Problem : 1100C - NN and the Optical Illusion
# Run time : 0.109 sec.
# Language : Python 3.7.2
# ==================================================
import sys
import math
def main():
# sys.stdin = open("in.txt", "r")
# sys.stdout = open("out.... | true |
931ff1b83959d3d3e12c1c5936be0822ef045202 | Python | VerifierIntegerAssignment/DailyBackUp | /2/test1.py | UTF-8 | 331 | 2.765625 | 3 | [] | no_license | import wadze
with open('test/test1.wasm', 'rb') as file:
data = file.read()
module = wadze.parse_module(data)
# If you also want function code decoded into instructions, do this
module['code'] = [ wadze.parse_code(c) for c in module['code']]
for exp in module['code']:
for inst in exp.instructions:
p... | true |
97ef5b51bd3c3f2d6a8b1e30de3bb7f0fcabdc9a | Python | mariotto1/CPI | /classifiers.py | UTF-8 | 3,609 | 2.5625 | 3 | [] | no_license | from sklearn import svm
from sklearn.ensemble import RandomForestClassifier
import keras as kr
import numpy
import utils
import preprocessing
import configuration as conf
nn_layers = {
'lstm': kr.layers.LSTM,
'gru': kr.layers.GRU,
'dense': kr.layers.Dense
}
optimizers = {
'sgd': kr.optimizers.SGD,
... | true |
ed398b9242baea0828f041b66f988066aec24ec6 | Python | dorlivne/Segmentation | /Augmentations.py | UTF-8 | 3,415 | 2.828125 | 3 | [] | no_license | import numpy as np
from scipy.ndimage.interpolation import map_coordinates
from scipy.ndimage.filters import gaussian_filter
import random
import matplotlib.pyplot as plt
from configs import config
IMAGE_HEIGHT = 512
IMAGE_WIDTH = 640
def flip_randomly(image, seg):
prob = random.random()
if rand... | true |
25a3f4d1d009ed9ed88f9d2d20c5eb3a23b7a080 | Python | Cristiandsh/Scaffold | /hello.py | UTF-8 | 127 | 3 | 3 | [] | no_license | def toyou(x):
return print("hi %s" % x)
def add(x):
return x + 2
def subtract(x):
return x - 1
toyou(2)
| true |
8d759f2fa9a5e38bda7d072809fe19310855023d | Python | TheWinch/flask-tuto | /tests/test_customer_api.py | UTF-8 | 1,802 | 2.640625 | 3 | [] | no_license | from flask import json
from app.apis.customer_api import customer_model
from app.models import Customer
from tests.base import FlaskTestCase, BasicAPITester
class TestCustomerApi(FlaskTestCase, BasicAPITester):
def setup(self):
FlaskTestCase.setup(self)
self.api_endpoint = '/api/customers/'
... | true |
869a964f41eb432e5b292729ee9465791a09b830 | Python | BYU-University/Robot_Soccer | /src/robot_soccer/scripts/mat.py | UTF-8 | 2,710 | 3 | 3 | [] | no_license | #!/usr/bin/python
from numpy import matrix
from numpy import linalg
import math
#define s1,s2,s3
realWorldOffset = 1 #1.698
s = .0282977488817 #radius of wheel
r = .092 #radius from center to center of wheel
r1theta = -math.pi/3.0
r1x = math.cos(r1theta)*r
r1y = math.sin(r1theta)*r
r2theta = math.pi/3.0
r2x = math.c... | true |
1afe668ba940b09e16c63a1df4ad361a0ec971d7 | Python | sidorkinandrew/stepik | /course-4852-introToDSandML/lesson-1.5-step-6.py | UTF-8 | 336 | 2.53125 | 3 | [] | no_license | import requests, zipfile, io
import pandas as pd
import numpy as np
dataset_url = 'https://stepik.org/media/attachments/course/4852/StudentsPerformance.csv'
r = requests.get(dataset_url)
df = pd.read_csv(io.BytesIO(r.content))
# count share of 'free/reduced'-lunch students
print(np.sum(df['lunch'].isin(['free/reduced... | true |
9240c0f92984232f8581236979e3db63b0731081 | Python | kartikanand/wikilooper-cli | /main.py | UTF-8 | 1,123 | 3.0625 | 3 | [
"MIT"
] | permissive | import requests
from bs4 import BeautifulSoup
args = input("Enter Starting wiki topic : ")
while(args != "Philosophy"):
print(args)
wiki_url = "http://en.wikipedia.org/wiki/"
r = requests.get(wiki_url+args)
if r.status_code != 200:
print(args + "Not a valid wiki link")
break... | true |
c9e0c14c6fb60472284003b42cf859c92e0bbe91 | Python | majo-z/ChessProject | /src/main/python/chess-bot/tests.py | UTF-8 | 2,460 | 3.28125 | 3 | [
"MIT"
] | permissive | from game import *
from pieces import *
import unittest
def init_board():
return Board({
"G1": "wKnight",
"G2": "wPawn",
"E1": "wQueen",
"E2": "wPawn",
"C1": "wBishop",
"C2": "wPawn",
"A1": "wRook",
"G7": "bPawn",
"A2": "wPawn",
"G8":... | true |
5d7edd3a69dbb2f7a0da566e0d505bd71e4d6d82 | Python | RickyHuo/leetcode | /python/python2/minimum-index-sum-of-two-lists.py | UTF-8 | 590 | 3.375 | 3 | [] | no_license | class Solution(object):
def findRestaurant(self, list1, list2):
"""
:type list1: List[str]
:type list2: List[str]
:rtype: List[str]
"""
items = {}
for i in list1:
items[i] = 0
values = []
for i in list2:
try:
... | true |
c1df504737ff558bd8603a4baba322f8f78593c3 | Python | franloza/hackerrank | /warmup/acm.py | UTF-8 | 944 | 3.1875 | 3 | [
"MIT"
] | permissive | #!/bin/python3
from itertools import combinations
import os
# Complete the acmTeam function below.
def acmTeam(topic):
n_combinations = 0
max_n_topics = 0
for topic_items in combinations(topic, 2):
n_topics = 0
for i in range(len(topic_items[0])):
if int(topic_items[0][i]) or in... | true |
d1224573eeafde63dcfbfc70b35f44b32244279d | Python | snow-king/software-engineering | /Task_one/sum_and_multiplication.py | UTF-8 | 1,773 | 4.21875 | 4 | [] | no_license | import re
from functools import reduce
class Num(object):
sumNumbers = 0
multiplyNumbers = 1
def __init__(self):
self.numbers = []
# I know what is so stupid , but I needed to add this method :D
def sum(self):
self.sumNumbers = sum(self.numbers)
return self.sumNumbers
... | true |
75de723c91b7111376a7226827f34798d6d38d6e | Python | TermanEmil/CartpoleV1_OpenAIGym | /ddqn_carpole/train.py | UTF-8 | 4,276 | 2.6875 | 3 | [] | no_license | import random
import gym
import numpy as np
from tensorflow.keras import Sequential
from tensorflow.keras.layers import Dense
from tensorflow.keras.optimizers import Adam
from collections import deque
# Constants
c_env_name = "CartPole-v1"
c_max_nb_of_steps = 2000
c_discount_rate = 0.99
c_learning_rate = 0.001
c_me... | true |
5c6aa71d008eff3699a90ee122ff1b6a188f047f | Python | 0xDmtri/Gradient_Descent | /GradientDescent/usage_examples.py | UTF-8 | 2,842 | 3.4375 | 3 | [
"MIT"
] | permissive | from GradientDescent.NesterovDescent import NesterovAcceleratedGradient
from GradientDescent.CoordinateDescent import CoordinateGradientDescent
from GradientDescent.SteepestDescent import SteepestGradientDescent
""" Three-Hump Camel Function (thcf) is taken in order to find global minimum
and demostrate the capabi... | true |
11efdc9d17e48f717d9ee7eeed28084c2707c84f | Python | lewis-cooper/SUVAT-Calculator | /suvat_calculator.py | UTF-8 | 4,510 | 3.484375 | 3 | [] | no_license | import math
'''
__ _______ __________ _____ ______ __ ________
/ / / / ___// ____/ __ \ / _/ | / / __ \/ / / /_ __/
/ / / /\__ \/ __/ / /_/ / / // |/ / /_/ / / / / / /
/ /_/ /___/ / /___/ _, _/ _/ // /| / ____/ /_/ / / /
\____//____/_____/_/ |_| /___/_/ |_/_/ \____/ /_/
'''
def u... | true |
af05cb578366f4d9f35c7504f18aeb9c05387069 | Python | Zhangbeibei1991/Stock-Embeddings | /code/run.py | UTF-8 | 3,093 | 2.828125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Wed Aug 11 12:27:31 2021
@author: 莱克斯
"""
import torch
import torch.nn as nn
from torch.utils.data import DataLoader
from model import GRU,Mydata
from tool import train_test_split,get_sj,get_mj,gru_data
import random
seed=2021
random.seed(seed)
#np.random.seed(seed)
torch.manu... | true |
ea2d4f9c4e843f4bdfd51fb163f6e6623ee4a8fe | Python | pianowow/projecteuler | /121/121.py | UTF-8 | 1,108 | 3.375 | 3 | [] | no_license | #-------------------------------------------------------------------------------
# Name: module1
# Purpose:
#
# Author: CHRISTOPHER_IRWIN
tries = 15
bluedraws = [0]*tries
reddraws = [0]*tries
totaldraws = [0]*tries
def binarystrings(n):
if n == 1:
for x in range(2):
... | true |
df18301908c36838a2b4f67b8dbbfdb973c2533d | Python | celsopa/theHuxley | /HUX - 2066.py | UTF-8 | 105 | 3.296875 | 3 | [] | no_license | qtd = int(input())
numeros = []
for x in range(qtd):
numeros.append(int(input()))
print(sum(numeros)) | true |
2e59a2eebe7ce8fb87a8c66b32f7b9fd2a0e0267 | Python | namakemono-sub/Test-Repository | /modules/functions.py | UTF-8 | 1,223 | 2.765625 | 3 | [] | no_license | import sys
import json
import crayons
import datetime
config = open("conf/config.json","r",encoding="UTF-8")
config = json.load(config)
def now():
return datetime.datetime.now().strftime('%H:%M:%S')
def lang(key: str, value: str):
try:
if config["lang"] == "ja":
lang = open(... | true |
634e30904b133ba3a550d918d4e9c3b84fd9b83b | Python | rohitishu/SpyChat-AV | /spy_details1.py | UTF-8 | 1,010 | 2.984375 | 3 | [] | no_license | # PROJECT : *****SPY-CHAT***** ! [ ACADVIEW ] ||||| spy_details1.py
from datetime import datetime
# CLASS SPY WHICH CONTAINS ALL THE DETAILS OF THE SPY
class Spy:
def __init__(self,name,salutation,rating,age):
self.name = name
self.salutation = salutation
self.rating = rating
self.... | true |
905b2316bd3a042d989f66af656ae3d7fa32369a | Python | henryiii/hepvector | /hepvector/numpyvector.py | UTF-8 | 15,380 | 3.078125 | 3 | [
"BSD-3-Clause"
] | permissive | # Licensed under a 3-clause BSD style license, see LICENSE.
"""
Vector classes
==============
Three vector classes are available:
* ``Vector2D`` : a 2-dimensional vector.
* ``Vector3D`` : a 3-dimensional vector.
* ``LorentzVector``: a Lorentz vector, i.e. a 4-dimensional Minkowski space-time vector
... | true |
6d463d5bbf79fdbf281aa74801d438c69292e2f3 | Python | lucas-ipsum/rendite-pv-neu | /backend/functions/ephemeris.py | UTF-8 | 3,017 | 2.765625 | 3 | [] | no_license | def ephemeris(time, latitude, longitude, pressure=101325, temperature=12):
import pandas as pd
import numpy as np
Latitude = latitude
Longitude = -1 * longitude
Abber = 20 / 3600.
LatR = np.radians(Latitude)
# the SPA algorithm needs time to be expressed in terms of
# decimal UTC hours... | true |
6da5c768bfd212984edebe3adb786d26b84fbe68 | Python | DanielGeorgeMathew/EGEN_CAPSTONES | /cloud_function_capstone1.py | UTF-8 | 1,361 | 2.59375 | 3 | [] | no_license | import logging
from base64 import b64decode
from pandas import DataFrame
from json import loads
from google.cloud.storage import Client
class LoadToStorage:
def __init__(self,event,context):
self.event = event
self.context = context
self.bucket_name = "capstone1-crypto-storage"
... | true |
c72f2cb4a42f7c6132fac3ee5a7383ec51503729 | Python | slawektestowy/czyst_selenium | /Amazontest.py | UTF-8 | 1,067 | 2.75 | 3 | [] | no_license | from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager
import time
driver = webdriver.Chrome(ChromeDriverManager().install())
driver.get("https://www.amazon.com/")
driver.maximize_window()
# rozne metody lokalizacji elemntow
#driver.find_element_by_xpath('//*[@id="a-autoid-0-announc... | true |
71d826a7af222040708c816f939b4de81635e099 | Python | fw1121/galaxy_tools | /transFIC_web/transFIC_web.py | UTF-8 | 4,402 | 2.5625 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
import requests
import pycurl
import os
from os.path import getsize
import argparse
import sys
import cStringIO
from functools import wraps
import tempfile
import shutil
import time
__url__ = "http://bg.upf.edu/transfic/taskService"
def stop_err(msg, err=1):
sys.stderr.write('%s\n' % msg)
... | true |
e0ff484ee170b218fa394ba9dd80d8c8ea12743c | Python | cordis/pycloudia | /pycloudia/services/channels.py | UTF-8 | 890 | 2.53125 | 3 | [
"MIT"
] | permissive | from pycloudia.services.beans import Channel
from pycloudia.services.interfaces import IServiceChannelFactory, IChannelsFactory
class ChannelsFactory(IChannelsFactory):
channel_cls = Channel
def create_by_address(self, service, address):
return self.channel_cls(service=service, address=address)
... | true |
1163f980af22007ffa16cc6e3fc51d6a9930de7a | Python | luckydimdim/grokking | /in_place_reversal_of_a_linked_list/reverse_a_sub_list/main.py | UTF-8 | 2,722 | 4.1875 | 4 | [] | no_license | from __future__ import print_function
class Node:
def __init__(self, value, next=None):
self.value = value
self.next = next
def print_list(self):
temp = self
while temp is not None:
print(temp.value, end=" ")
temp = temp.next
print()
def reverse_sub_list2(head, p, q):
'''
Gi... | true |
ce8f4084254894d6a66a87e56c5a36196f5d86d0 | Python | brian-green/User-Unmerge | /user_unmerge.py | UTF-8 | 1,996 | 2.609375 | 3 | [] | no_license | # Import modules
import requests
import json
# Authentication Data and Routes
url = 'https://SUBDOMAIN.zendesk.com/api/v2/users/SOURCE-USER-ID/tickets/requested.json'
user = 'user@email.com/token'
token = 'TOKEN'
print('Creating the Session')
s = requests.Session()
s.auth = (user, token)
s.headers = {'Content-Type':'... | true |
b20ed704e5cb2f58c39aa7d6f85d9a08327f91f9 | Python | walterwsmf/astroscripts | /astroscripts/mlstats.py | UTF-8 | 1,576 | 3.328125 | 3 | [
"CC-BY-4.0"
] | permissive | """
MLSTATS: MACHINE LEARNING AND STATISTICS ROUTINES
This package has an optimized set of functions for my daily work.
"""
import numpy as np
from sklearn.decomposition import PCA
import pandas as pd
import scipy #pearson correlation
import matplotlib.pyplot as plt
def rotate_axis(x):
mean_value = np.mean(x)
... | true |
8c99e8c53ee936db9ef0aaf7f0586711eb793f2d | Python | madhuri-majety/IK | /Leetcode/repeating_elements.py | UTF-8 | 3,185 | 4.53125 | 5 | [] | no_license | """
You are given an array of n+2 elements. All elements of the array are in range 1 to n.
And all elements occur once except two numbers which occur twice. Find the two repeating numbers.
For example, array = {4, 2, 4, 5, 2, 3, 1} and n = 5
The above array has n + 2 = 7 elements with all elements occurring once excep... | true |
732566f8f2653a1eea3756bb15e9174d639bf28f | Python | Rupesh-1901/Python-Task-1 | /prgm 2.py | UTF-8 | 219 | 4.0625 | 4 | [] | no_license |
def findTrailingZeros(n):
if(n < 0):
return -1
count = 0
while(n >= 5):
n //= 5
count += n
return count
n = 100
print("Count of trailing 0s " +
"in 100! is", findTrailingZeros(n))
| true |
cfe2c5d25071473240f55b81274f7ee850856035 | Python | Jason-Yuan/Interview-Code | /CTCI/Python/Chapter1-7.py | UTF-8 | 3,067 | 3.859375 | 4 | [] | no_license | # define a print matrix method
def ShowMatrix(matrix):
for row in matrix:
print row
# end define
##############################################################################################################################
# Method 1
# Ideas: Loop each elements in the M*N matrix, and keep record the row number an... | true |
efe61a3ed1f9e52781ecf4ee202ab9ff971bf6b2 | Python | TythonLee/lop | /Code/main_lop.py | UTF-8 | 7,288 | 2.703125 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf8 -*-
# Main script for LOP
import unicodecsv as csv
import os
import numpy as np
# Hyperopt
import pickle
import time
from hyperopt import fmin, tpe, hp, STATUS_OK, Trials
# Select a model (path to the .py file)
# Two things define a model : it's architecture and the time gran... | true |
def689badce47a93def3a4c75e36b117f0d2cdb0 | Python | tushar176/Notepad-plus | /linebar.py | UTF-8 | 562 | 2.625 | 3 | [
"MIT"
] | permissive | from tkinter import Text
'''here only gui of line bar is implemented its functionality is in statusbar class
dus to some reasons(if here functionality is defined then Allignment and calling made difficult)'''
class Linebar:
def __init__(self,main_application):
self.root=main_application
... | true |
624e661a0d641cadb43f36fa141dd35bcb1120ab | Python | jesuswr/cp-codes-and-problems | /RPC_1_2022/aux.py | UTF-8 | 132 | 3.046875 | 3 | [] | no_license | import random
import string
X = 200000
s = ''.join(random.choice("abcdefghijklmnopqrstuvwxyz") for x in range(X))
print(s)
print(0) | true |
84005ca9c07783dc0aaf16a558470fb834f947c4 | Python | Bzyli/PythonTradingShit | /TradingBotV3.py | UTF-8 | 1,478 | 3 | 3 | [] | no_license | from Wallet import *
from ApiGetter import *
def get_variation():
if not is_it_possible(): return
if get_values()[0] > get_values()[1] > get_values()[2]: # Not stonks
return 0
elif get_values()[0] < get_values()[1] < get_values()[2]: # Stonks
return 1
elif get_values()[0] >... | true |
98d504f1aa5a2b0be4576b543986a18bd545d895 | Python | esrabozkurt/programlama | /fonksiyonlar2-4.soru.py | UTF-8 | 1,270 | 3.640625 | 4 | [] | no_license |
def donemBasi(koltuk,yatak,dolap):
stok=koltuk+yatak+dolap
global donemBasi
return stok
def donemSonu (satilanKoltuk=25,satilanYatak=20,satilanDolap=10,alinanKoltuk=10,alinanYatak=15,alinanDolap=5):
stokSon=(satilanKoltuk+satilanYatak+satilanDolap)-(alinanKoltuk+alinanYatak+alinanDolap)
glob... | true |
66a1c503f5f82ef528fb69a9a7e186933fabfe7d | Python | spenceslx/code_dump | /EECE5698/Assignment1/TextAnalyzer.py | UTF-8 | 5,364 | 3.421875 | 3 | [] | no_license | import sys
import argparse
import numpy as np
from pyspark import SparkContext
def toLowerCase(s):
""" Convert a sting to lowercase. E.g., 'BaNaNa' becomes 'banana'
"""
return s.lower()
def stripNonAlpha(s):
""" Remove non alphabetic characters. E.g. 'B:a,n+a1n$a' becomes 'Banana' """
return ''.jo... | true |
d18922a099127b32e0c487bc6d746832d6aa9ce7 | Python | dr-dos-ok/Code_Jam_Webscraper | /solutions_python/Problem_201/1885.py | UTF-8 | 1,926 | 3.5625 | 4 | [] | no_license | """
Created on 08/04/2017
@author: Dos
Problem C.
https://code.google.com/codejam/contest/3264486/dashboard#s=p2
***Sample***
Input
5
4 2
5 2
6 2
1000 1000
1000 1
Output
Case #1: 1 0
Case #2: 1 0
Case #3: 1 1
Case #4: 0 0
Case #5: 500 499
"""
def read_word(f):
return next(f).strip()
def read_int(f, b=10)... | true |
6529a7c8148cddb70d7d7c90db05eee5d13862a5 | Python | ebenp/adventcode | /code/adventday2.py | UTF-8 | 1,051 | 3.078125 | 3 | [] | no_license | #http://adventofcode.com/day/2
from __future__ import absolute_import, division, print_function
from builtins import (bytes, str, open, super, range,
zip, round, input, int, pow, object)
from future import standard_library
standard_library.install_aliases()
if __name__ == '__main__':
import n... | true |
6bf301c7e624ab205d87eca126314a0b7b36f922 | Python | kttaroha/AtCoder | /src/ABC0xx/ABC02x/ABC023/ABC023D.py | UTF-8 | 772 | 3.171875 | 3 | [] | no_license | def main():
N = int(input())
A = [list(map(int, input().split())) for _ in range(N)]
max_h = sorted(A, reverse=True, key=lambda x: x[0])[0][0]
max_s = sorted(A, reverse=True, key=lambda x: x[1])[0][1]
left = max_h - 1
right = max_h + max_s*N + 1
while abs(left-right) > 1:
mid = (lef... | true |
58e872467b1bf406c6231b9972bd693dbfefdd54 | Python | calispotato/python-1 | /triva | UTF-8 | 1,139 | 3.21875 | 3 | [] | no_license | #!/usr/bin/env python3
import colors as c
from utils import ask
print(c.red + 'welcome 2 trivia!*hint no capital letters.' + c.reset)
print(c.orange + 'control c to quit' + c.reset)
def ask(question):
print(question)
answer = input(c.green + '> ')
print(c.reset)
return answer
def q1():
answer = as... | true |
40aebb2c3b1214e76a9c21a7d5c547bac647325f | Python | sungjun-ever/algorithm | /baekjoon/bj_1406.py | UTF-8 | 483 | 3.078125 | 3 | [] | no_license | import sys
stk = list(sys.stdin.readline().strip())
M = int(input())
temp_stk = []
for _ in range(M):
menu = sys.stdin.readline().strip().split()
if menu[0] == 'L':
if stk:
temp_stk.append(stk.pop())
elif menu[0] == 'D':
if temp_stk:
stk.append(temp_stk.pop())
... | true |
65c6fae3a0aa4e60c7ae794916050bced04ce0ac | Python | eurodev/conferences | /liveinstaller/gee3 | UTF-8 | 1,788 | 2.578125 | 3 | [] | no_license | #!/usr/bin/python
# G u a d a l i n e x E a s t e r E g g
# by Alfonso E.M.
# Free (GPL) but a bit obfuscated code :-)
def stuff():
return '''
I05vbmUsNDAsMTAwLDIwMCwxMDAKI05vbmUsMzIsMTAwLDE1MCwxMDAKI05vbmUsMjgsOTAsMTIw
LDkwCiNOb25lLDI4LDEyMCwxMDAsMTAwCiNOb25lLDYwLDIwMCwyMDAsMjAwCgpAMApHdWFkYWxp
bmV4IFYzCgoKCkAxCk... | true |
1363ece8d9caa8d840ab1cb79f23b02ebefc3913 | Python | umyuu/Sample | /src/Python3/Q109871/exsample_1.py | UTF-8 | 2,092 | 3.15625 | 3 | [
"MIT"
] | permissive | # -*- coding: UTF-8 -*
from tkinter import ttk
from tkinter import *
import functools
class VolumeWindow(Toplevel):
def __init__(self, root):
super().__init__()
# ウィンドウを閉じたときのイベントを登録
self.protocol('WM_DELETE_WINDOW', functools.partial(self.on_window_exit, param=2))
self.volumes = S... | true |
7feae52230578ca784ced1f4a0e8c1e78469d68d | Python | twtmiss/Spider | /廖雪峰爬虫/d2/request.py | UTF-8 | 2,087 | 3.203125 | 3 | [] | no_license | import requests
import urllib.request
import json
class RequestSpider(object):
def __init__(self):
url = "https://www.baidu.com"
header = {
"User-Agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.86 Safari/537.36"
}... | true |
0a4a334076d7f12b91f016c82d4b9a50817c4793 | Python | armando555/Calculate-Sum-Of-SubMatrix | /CalculateSubMatrix.py | UTF-8 | 3,014 | 3.21875 | 3 | [] | no_license | import java.util.Scanner;
public class CalculateSubMatrix{
private int matrix [][]=
{{ 1, 2, 3, 4, 5 },
{ 6, 7, 8, 9, 10 },
{ 6, 3, 4, 6, 2 },
{ 7, 3, 1, 8, 3 },
{ 1, 5, 7, 9, 4 }
};
private int sum [][];
public CalculateSubMatrix (){
Scanner sc = new Sca... | true |
2a551e9989a32e8a5f1dba96269cde240e155e20 | Python | EugenenZhou/leetcode | /countdigitone.py | UTF-8 | 2,363 | 3.953125 | 4 | [] | no_license | ####################################################################
# 我们可以观察到每 1010 个数,个位上的’1’ 就会出现一次。
# 同样的,每 100100 个数,十位上的’1’ 就会出现一次。
# 这个规律可以用 (n/(i*10))*i(n/(i∗10))∗i 公式来表示。
# 同时,如果十位上的数是 ’1’,那么最后’1’ 的数量要加上 x+1,其中 x 是个位上的数值。
# 如果十位上的数大于’1’,那么十位上为’1’ 的所有的数都是符合要求的,这时候最后’1’ 的数量要加 10。
# 这个规律可以用公式 min(max((n mod (i*10... | true |
208b5bb7dab4c751231b2695974c80ae51a27ad9 | Python | marcinpanfil/advent-of-code | /2020/day08.py | UTF-8 | 3,023 | 3.171875 | 3 | [] | no_license | import copy
from file_utils import file_reader
class Operation:
def __init__(self, name, value):
self.name = name
self.value = value
def __str__(self):
return self.name + " " + str(self.value)
def __repr__(self):
return self.name + " " + str(self.value)
def __eq__(... | true |
a06aabb6f5597bda39c8cb66087df9b0a96a9e5d | Python | rxia/Data_Incubator | /project/allrecipes_scraper.py | UTF-8 | 1,409 | 2.625 | 3 | [] | no_license | from recipe_scrapers import scrape_me
import pickle
import numpy as np
import time
data_allrecipes = []
for ID in np.arange(129001,299999):
try:
scrape_result = scrape_me('http://allrecipes.com/Recipe/{}'.format(ID))
recipe_i = {}
recipe_i['id'] = ID
recipe_i['title'] = scrape_resu... | true |
0ee45f9e7879fc4f9144af61e7654db90f3f67cc | Python | alanbernstein/geometry | /font.py | UTF-8 | 7,523 | 2.96875 | 3 | [] | no_license | from collections import defaultdict
import matplotlib.pyplot as plt
import numpy as np
from mpltools import unpack_plot_kwargs
# implement a vector font for use in laser designs
# lower case letters:
# y=0 baseline
# centered horizontally
# n-width = 1
# https://mzucker.github.io/2016/08/03/miniray.html
# https://git... | true |