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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
eb4f71301a1a176179f5760fb3a1280e16e5ab95 | Python | wanchaol/AWSTools | /awsdestroy.py | UTF-8 | 662 | 2.90625 | 3 | [] | no_license | # usage: python awsdestroy.py inputfile
import sys
from sys import argv
import json
import subprocess
def desctroyInstances():
idfile = open("instance_ids.txt", "r")
allIds = idfile.readlines()
destroycmd = ["aws", "ec2", "terminate-instances", "--instance-ids"]
for singleId in allIds:
sin... | true |
fb4464e24c99879e61787332bd874868d92f8819 | Python | awesome-archive/AlphaDraughts | /alphadraughts/draughts/game.py | UTF-8 | 1,957 | 3.8125 | 4 | [
"MIT"
] | permissive | from .board import Board
class Game:
def __init__(self, white, black):
self.white = white
self.black = black
self.turn = "white" # Start with white
self._board = Board()
self._move_list = []
self._pieces_remaining = {"white": 8, "black": 8}
def play(self):
... | true |
a963314fcd3909587e413454bc54fa0347a8632a | Python | lyceum-allotments/herdem | /tilemap.py | UTF-8 | 1,499 | 2.640625 | 3 | [] | no_license | import cocos
import pymunk as pm
from constants import coll_types
class TileMap(cocos.layer.Layer):
def __init__(self, pathname, controller):
super(TileMap, self).__init__()
# bg = cocos.tiles.load(pathname)['map0']
bg = cocos.tiles.load(pathname)['Tile Layer 1']
collision_tile_li... | true |
bb430bb54298f199ac2038b70516f3cfa80a84cf | Python | pandey-ankur-au17/Python | /coding-challenges/week03/day05/ccQ2.py | UTF-8 | 609 | 4 | 4 | [] | no_license | def arithmetic_operation(n=3, m=5, opname="+"):
# provide input as Add Sub Multiply And Divide for this operations
if opname == "+":
Sum = n + m
print(Sum)
return Sum
elif opname == "-":
Diff = n - m
print(Diff)
return Diff
elif opname == "*":
M... | true |
d2adc2d027598e542d0cacbe094d163f4216748d | Python | srmoura/ygg-crawl | /api/max-min.py | UTF-8 | 1,131 | 2.9375 | 3 | [
"Unlicense"
] | permissive | #!/usr/bin/env python
#max/min for the day with nodes
import psycopg2
import time
#run every hour
DB_PASS = "password"
DB_USER = "yggindex"
DB_NAME = "yggindex"
DB_HOST = "localhost"
# count peer alive if it was available not more that amount of seconds ago
# I'm using 1 hour beause of running crawler every 15 min... | true |
0b41ff6a21b6ef79eb07a82904a2f9f747ae8224 | Python | edagotti689/PYTHON-11-LAMBDA | /8_generator.py | UTF-8 | 595 | 4.34375 | 4 | [] | no_license | '''
1. Using generator we can execute a block of code based on demand using next() function.
2. using yield keyword we can create a generator.
'''
def gen_fun(n):
for i in range(n):
print('Before return')
yield i
print('After return')
yield i
gen_obj = gen_fun(10)
prin... | true |
bcd819d072cff34cbe21086c4456ff73a9b259ca | Python | phillybenh/LP3THW_Exercises | /ex8.py | UTF-8 | 516 | 3.34375 | 3 | [] | no_license | formatter = "{} {} {} {}"
print(formatter.format(1, 2, 3, 4))
print(formatter.format("one", "two", "three", "four"))
print(formatter.format(True, False, False, True))
print(formatter.format(formatter, formatter, formatter, formatter))
print(formatter.format(
"Try your",
"Own text here", # lolz, no
"Maybe ... | true |
bc60dfdf2610a6df17255200098c261b572198df | Python | agustinfernandez/Python_Unsam | /ejercicios_python/Clase 5/plot_bbin_vs_bsec.py | UTF-8 | 4,855 | 3.578125 | 4 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Sep 8 23:01:25 2020
@author: agustin18
"""
import random
def busqueda_secuencial(lista, x):
'''Si x está en la lista devuelve el índice de su primera aparición,
de lo contrario devuelve -1.
'''
pos = -1
for i,z in enumerate(lista)... | true |
6220a3efebcb1fdef74a1e5e9ad11f0c826dbf0d | Python | gocome/ANN-SoLo | /src/ann_solo/util.py | UTF-8 | 3,436 | 3 | 3 | [
"Apache-2.0"
] | permissive | import itertools
import numpy as np
import pyteomics.auxiliary
def filter_fdr(psms, fdr=0.01):
"""
Filter PSMs exceeding the given FDR.
The following formula is used for FDR calculation: #D / #T.
Args:
psms: An iterable of `SpectrumMatch` PSMs to be filtered based on FDR.
fdr: The m... | true |
56c616caab60b83f08833476d795df908783520b | Python | python-myway/flask_webhook | /__init__.py | UTF-8 | 2,187 | 2.8125 | 3 | [] | no_license | """ Flask WebHook """
import os
import subprocess
from flask import jsonify
class WebHook:
def __init__(self, app=None):
self.app = app
self.webhook = {}
self.prefix = []
if app is not None:
self.init_app(app)
def init_app(self, app):
# 检查是否配置了WebHook&WE... | true |
c683ec8ef3ebeba0d6af1f058d53faede790c1bc | Python | rogerroxbr/pysuinox-sprint-zero | /capitulo 08/exercicio-08-13.a.py | UTF-8 | 426 | 3.8125 | 4 | [] | no_license |
def valida_entrada(mensagem, opções_válidas):
opções = opções_válidas.lower()
while True:
escolha = input(mensagem)
if escolha.lower() in opções:
break
print("Erro: opção inválida. Redigite.\n")
return escolha
print(valida_entrada("Escolha uma opção:", "abcde"))
#
# Qu... | true |
010a780d9591da37a95506b05dc4f691c7a3fe0d | Python | vcomm/dafsm-py | /mngeng.py | UTF-8 | 7,680 | 2.59375 | 3 | [
"MIT"
] | permissive | import json
import asyncio
from dafsm import Dafsm
class ValidateException(Exception):
# Constructor or Initializer
def __init__(self, value):
super()
self.value = value
class Content:
"""
_arg_ = {
"logic": None,
"keystate": None,
"complete": True
}
_... | true |
87837f572657e633cb1d20ffdca09f7b2749f5c6 | Python | ChristianFMartin/I211 | /Lecture 4.py | UTF-8 | 1,138 | 4 | 4 | [] | no_license | #Algorithm
#create function
#set my_pass equal to valid_pass
#if pass is 8+ char prints that it's valid
#if under 8 char, pass not valid
#loop if not valid pass
#print your valid password is:
##def valid_pass():
## while True:
## my_pass = input("Please enter your password: ")
## if le... | true |
255adbbf75a7a56597876b0fea2e4c92569a880e | Python | davidlipkin/edge-detector | /Edge-Detector.py | UTF-8 | 2,287 | 3.328125 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# In[ ]:
#David Lipkin
#11/20/2019
#Homework 6 for PIC 16
#Professor Ji
# In[ ]:
def detect_edge(im, method):
"""
detect_edge(im, method) takes a gray-scale image and detects edges,
with the option of horizontal, vertical or both.
"""
get_ipython().magic... | true |
d4b032f23300eb04af62e3473c5cc55038500e05 | Python | Under0Cover/Curso_Em_Video | /Python/tipos_primitivos.py | UTF-8 | 1,220 | 4 | 4 | [] | no_license | # TIPOS PRIMITIVOS
# ni = input('Digite um número: ')
# n2 = input('Digite outro número: ')
"""s = n1 + n2
O MAIS NESSE CASO NÃO REPRESENTA SOMA, REPRESENTA CONTATENAÇÃO
TODO VALOR DIGITADO NO INPUT É CONSIDERADO UMA STRING, NÃO UM NÚMERO
UTILIZA-SE O *INT* (TIPO PRIMITIVO) PARA RECEBER UM INTEIRO"""
numero1... | true |
d2f3378081fa3eff4dda8b6305e64b694ac4c15e | Python | AdamZhouSE/pythonHomework | /Code/CodeRecords/2382/60644/286516.py | UTF-8 | 945 | 2.78125 | 3 | [] | no_license | n=int(input())
arr=[]
for i in range(0,n):
arr=arr+[input().split()]
for j in range(0,len(arr[i])):
arr[i][j]=int(arr[i][j])
res=[arr[0]]
for k in range(0,n):
res=[arr[0]]
for i in range(1, len(arr)):
p = True
l = arr[i][0]
r = arr[i][1]
for j in range(0, len(res)... | true |
b85e134ed5eb03def2f735cbc5d9b8bfc7d0ec49 | Python | WinterShiver/HPC | /OpenMP/3-gauss-elimi/draw3.py | UTF-8 | 2,391 | 3.1875 | 3 | [] | no_license | import math
map_log = lambda lst: list(map(math.log, lst))
log_scale = [7, 8, 9, 10, 11]
scale = ['$2^{' + str(elem) + '}$' for elem in log_scale]
x_label = []
for elem in scale:
x_label.append('')
x_label.append(elem)
y1 = [0.00605488, 0.0294092, 0.208391, 1.74074, 13.8348]
y2 = [0.00615766, 0.019629, 0.119481, ... | true |
e01c7c45b80a5731349ed14086a760b195eeeab6 | Python | katemartin9/handson_ML_practice | /nn_deep_learning/faster_optimizers.py | UTF-8 | 2,198 | 2.78125 | 3 | [] | no_license | from tensorflow import keras
from functools import partial
import numpy as np
# exponential scheduling at each epoch
def exponential_decay(epoch, lr=0.01, s=20):
return lr * 0.1**(epoch / s)
lr_scheduler = keras.callbacks.LearningRateScheduler(exponential_decay)
K = keras.backend
# exponential decay at each i... | true |
c79082962d59279c6da6714d46acfa7d04c67ed2 | Python | ameenmanna8824/PYTHON | /Day 3/Classes/Classes/employeeclass.py | UTF-8 | 582 | 3.515625 | 4 | [] | no_license | class employee: #class classname
num_employee = 0 #
raise_amount = 1.04 #
def __init__(self, first, last, sal):
self.first = first
self.last = last
self.sal = sal
self.email = first + '.' + last + '@company.com'
employee.num_employee += 1
def f... | true |
e0f4be064e2dc2de21ae4c4f54ce6ea1db8bbcbf | Python | xiaogaogaoxiao/StochasticProximalMethods | /python_src/method_ProxSGD.py | UTF-8 | 9,941 | 2.96875 | 3 | [
"BSD-3-Clause"
] | permissive | """! @package method_ProxSGD
Implementation of ProxSGD algorithm presented in
* S. Ghadimi, G. Lan, and H. Zhang. **[Mini-batch stochastic approximation methods for nonconvex stochastic composite optimization](https://link.springer.com/article/10.1007/s10107-014-0846-1)**. Math. Program., 155(1-2):267–305, 2016.
The... | true |
fe66ca09b8802f609af6993af28eeda389aa0dc1 | Python | 3dmikec/python | /fibonacci-sequence.py | UTF-8 | 304 | 4.1875 | 4 | [] | no_license | '''
INPUTS A NUMBER AND PROVIDES THE FIBONACCI SEQUENCE UP TO THAT NUMBER
'''
def fib_func(n):
a = 0
b = 1
for i in range(n):
a,b = b,b+a
i = a + b
yield i
n = int(input("Enter a number: "))
for x in fib_func(n):
print(x)
input("Press ENTER to exit") | true |
f780da00751e870b909f899c7b1c53ce9a8da1e8 | Python | ishivvers/GalacticMaps | /scripts/iAstro.py | UTF-8 | 5,717 | 3.34375 | 3 | [
"MIT"
] | permissive | """
A few functions pulled from my old iAstro library
-I.Shivvers
"""
import re
from jdcal import gcal2jd
def parse_ra( inn ):
'''
Parse input RA string, either decimal degrees or sexagesimal HH:MM:SS.SS (or similar variants).
Returns decimal degrees.
'''
# if simple float, assume decimal degrees... | true |
7c1cd9317a35cc3319ab24db1eca2fc1f2b23910 | Python | chaserhkj/COCCharGen | /src/COCCharGen/Generator.py | UTF-8 | 932 | 2.546875 | 3 | [
"MIT"
] | permissive | class Generator():
"""Virtual class for Generators."""
def generate_char(self, char):
self.generate_basic_info(char)
self.generate_characteristics(char)
self.generate_status(char)
self.generate_combact_stat(char)
self.generate_skills(char)
self.generate_weapons(ch... | true |
8604eda562321b8f311807e8af34852cfb713e57 | Python | ArDrift/InfoPy_scripts | /12_het/2_fa-kiirasa.py | UTF-8 | 762 | 3.15625 | 3 | [
"Unlicense"
] | permissive | #!/usr/bin/env python3
class BinFa:
def __init__(self, ertek):
self.ertek = ertek
self.bal = None
self.jobb = None
def beszur(gyoker, ertek):
if gyoker is None:
gyoker = BinFa(ertek)
elif ertek < gyoker.ertek:
gyoker.bal = beszur(gyoker.bal, ertek)
elif ertek... | true |
504c2faa23caeccc01c046463e859a58835c8701 | Python | umeshnmenon/mlflow | /mlflow/helpers/evaluation_helper.py | UTF-8 | 7,217 | 3.109375 | 3 | [] | no_license | import numpy as np
import pandas as pd
import logging
from autologging import logged
from sklearn.metrics import confusion_matrix,accuracy_score, precision_score,average_precision_score, recall_score, f1_score, roc_curve ,auc, matthews_corrcoef, roc_auc_score, classification_report
class EvaluationHelper:
"""
... | true |
d8ff2a79b98610aa344b3c6734a8d23cb44a236c | Python | arthurguerra/cursoemvideo-python | /exercises/CursoemVideo/ex103b.py | UTF-8 | 309 | 3.546875 | 4 | [
"MIT"
] | permissive | def ficha(j='<desconecido>', gol=0):
print(f'O jogador {j} fez {gol} gol(s) no campeonato.')
nome = str(input('Nome do Jogador: '))
gols = str(input('Número de Gols: '))
if gols.isnumeric():
gols = int(gols)
else:
gols = 0
if nome.strip() == '':
ficha(gol=gols)
else:
ficha(nome, gols)
| true |
95a4fb46ccaf7b8dc737200857a5625791106f5f | Python | phychaos/tf_srnn | /utils.py | UTF-8 | 2,550 | 2.75 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @author: Linlifang
# @file: utils.py
# @time: 18-8-30下午3:50
import pandas as pd
import numpy as np
from keras.utils.np_utils import to_categorical
from keras.preprocessing.text import Tokenizer
from keras.preprocessing.sequence import pad_sequences
# load data
df = p... | true |
6ce2ae3f474e618b492faff4bd46726469deeb75 | Python | Indhuyogadh/indhujavijayama | /Greater_of_3.py | UTF-8 | 115 | 3.53125 | 4 | [] | no_license | a,b,c=int(input()).split()
if((a>=b) and (a>=c)):
print(a)
elif((b>=a) and (b>=c)):
print(b)
else:
print(c)
| true |
82831b00dfd3682c4388bce9df756b52b21c6c6f | Python | robertmuil/muiltools | /dev/python/generator.py | UTF-8 | 3,351 | 2.8125 | 3 | [] | no_license | import calendar, random, pdb
import numpy as np
msg='well hallelujah'
holiday = {'2011':[[1],[],[],[22,25],[1],[2,13],[],[],[],[3],[],[25,26]],
'2012':[[1],[],[],[6,9],[1,17,28],[],[],[],[],[3],[],[25,26]],
'2013':[[1],[],[29],[1],[1,9,20],[],[],[],[],[3],[],[25,26]]}
year = int(raw_input("Gen... | true |
cf9c49b8490f588f50257b8f6a47f346daececde | Python | park-seonju/Algorithm | /구현/1051.py | UTF-8 | 468 | 2.65625 | 3 | [] | no_license | N,M=map(int,input().split())
matrix=[]
for _ in range(N):
matrix.append(list(map(int,input().rstrip())))
if N>=M:
bound=M
else:
bound=N
ans = 0
for i in range(N):
for j in range(M):
for k in range(1,bound):
if i+k<=N-1 and j+k<=M-1:
if matrix[i][j]==matrix[i][j+k] a... | true |
2b21e3357bd3ef6d1b46e05bc91bff636bd786e8 | Python | JorgeCarlosPB/jcperezb | /Laboratorio1/Laboratorio01_MapaBolivia.py | UTF-8 | 14,027 | 3.109375 | 3 | [] | no_license | # Búsqueda Coste Uniforme - Uniform Cost Search
from Nodos import Nodo
def Comparar(nodo):
return nodo.get_costo()
def busqueda_BCU(conecciones, estado_inicial, solucion):
resuelto = False
nodos_visitados = []
nodos_frontera = []
nodo_raiz = Nodo(estado_inicial)
nodo_raiz.set_costo(0)
nodo... | true |
6d354cda39a586a8cdc75bbda11d0e9074b32732 | Python | nick-hu/pyintermediate | /tests/pyfltk2.py | UTF-8 | 577 | 2.734375 | 3 | [] | no_license | #!/usr/bin/env python
from fltk import *
def but_cb(wid):
lab_clicked.value(lab_clicked.value() + wid.label())
sum_clicked.value(str(int(sum_clicked.value()) + int(wid.label())))
win = Fl_Window(320, 320, 320, 320)
win.begin()
x, y = 0, 0
for num in xrange(1, 10):
but = Fl_Button(40 + 40*(x % 3), 40 +... | true |
1ab928518c03131285b9621a879f31a652653861 | Python | michaelawyu/nanopie | /src/nanopie/misc/errors/base.py | UTF-8 | 1,849 | 2.59375 | 3 | [
"Apache-2.0"
] | permissive | """This module includes the base classes for nanopie exceptions.
"""
from typing import Any, Optional, Union
class ServiceError(Exception):
"""The base class for all nanopie exceptions."""
def __init__(self, *args, response: Optional["RPCResponse"] = None):
"""Initializes a service error.
A... | true |
14876b312592ccced1764d499d16757ef7a2d7e5 | Python | nssiw1/Machine-Learning-For-Trading-1 | /optimize_something/optimization.py | UTF-8 | 4,288 | 3.34375 | 3 | [] | no_license | """MC1-P2: Optimize a portfolio."""
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
import datetime as dt
from util import get_data, plot_data
import scipy.optimize as sco
# This is the function that will be tested by the autograder
# The student must update this code to properly implement the... | true |
6da847a0672019f789fd51f25add41841c56de53 | Python | shikixyx/AtCoder | /ABC/168/168_C.py | UTF-8 | 388 | 2.890625 | 3 | [] | no_license | import sys
import math
sys.setrecursionlimit(10 ** 7)
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
A, B, H, M = map(int, input().split())
H = H % 12
X = H * 60 + M
AX = X / 720.0 * 360
BX = M / 60.0 * 360
D = abs(AX - BX + (10 ** -10))
ANS = A ** 2 + B ... | true |
ab92eca73906d8b7c6f243f93f45124e9a09b55d | Python | liqueur/leetcode | /sol_Median_of_Two_Sorted_Arrays.py | UTF-8 | 981 | 3.828125 | 4 | [] | no_license | """
Example 1:
nums1 = [1, 3]
nums2 = [2]
The median is 2.0
Example 2:
nums1 = [1, 2]
nums2 = [3, 4]
The median is (2 + 3)/2 = 2.5
"""
class Solution:
def findMedianSortedArrays(self, nums1, nums2):
"""
:type nums1: List[int]
:type nums2: List[int]
:rtype: float
"""
... | true |
0e0d28bdb6339c47e85a0c5fc7fd50f115af6d52 | Python | bstriner/ctc-process | /asr_vae/models/callbacks/asr_hook.py | UTF-8 | 1,086 | 2.5625 | 3 | [] | no_license | import csv
import os
import tensorflow as tf
from tensorflow.python.training.session_run_hook import SessionRunHook
class AsrHook(SessionRunHook):
def __init__(self, true_strings, generated_strings, path):
self.true_strings = true_strings
self.generated_strings = generated_strings
self.pa... | true |
87be0fd00070f4f4e72c49616fb8b6c5ef24917d | Python | Softcatala/adaptadorvariants | /adaptador.py | UTF-8 | 725 | 2.765625 | 3 | [] | no_license | #!/bin/env python3
# -*- coding: utf-8 -*-
# (c) 2014 Pau Iranzo
#
# Released under the GNU General Public Licence, either version 3
# or at your option, any later version
# NO WARRANTY!
#
# Version 0.0.1
# Initial version, just a first implementation to import adaptation rules
# and apply them to an example string
im... | true |
c5aac169847438fac506a80951e6990f3eb18f32 | Python | CoasterFreakDE/pybot | /Folge4/gist.py | UTF-8 | 1,198 | 2.65625 | 3 | [
"MIT"
] | permissive | import random
from discord import Member, Guild
antworten =['Ja', 'Nein', 'Vielleicht', 'Wahrscheinlich', 'Sieht so aus', 'Sehr wahrscheinlich',
'Sehr unwahrscheinlich']
colors = [discord.Colour.red(), discord.Colour.orange(), discord.Colour.gold(), discord.Colour.green(),
discord.Colour.blu... | true |
40215069fccc3b788b524f2731fa92e8b0250937 | Python | Aasthaengg/IBMdataset | /Python_codes/p03304/s841909478.py | UTF-8 | 291 | 2.890625 | 3 | [] | no_license | #!/usr/bin/env python3
def main():
n, m, d = (int(x) for x in input().split())
a_at_d0 = (m - 1) / n
if d == 0:
res = a_at_d0
else:
unit = a_at_d0 * 2
res = (n - d) / n * unit
print("{:.10f}".format(res))
if __name__ == '__main__':
main()
| true |
41ea6a0ec4cae9abc5097d8108feefae32fcf6c8 | Python | amriikk/CS31-Python | /ICA/Ch9Pt2.py | UTF-8 | 1,617 | 3.40625 | 3 | [] | no_license | # Week 14, ICA 2
import pickle
def main():
pacific = set()
pacific.add('CA')
pacific.add('NV')
print('pacific =',pacific)
mountain = set(['AZ', 'NM'])
mountain.update(('UT','CO','WT','MT'))
print('mountain =', mountain)
combo = set(['OR','ID', 'ND', 'SD'])
combo.remove('ND')
comb... | true |
e17392a043f69a0761adf4d400259c38b14d818a | Python | haugenmitch/adventofcode2019 | /day08/part2/image_reader.py | UTF-8 | 605 | 2.90625 | 3 | [
"MIT"
] | permissive | import sys
with open(sys.argv[1]) as f:
image = [int(d) for d in f.read().strip()]
layers = []
while len(image) > 0:
layers.append([])
for i in range(150):
layers[-1].append(image.pop(0))
base = layers[0]
for i, n in enumerate(base):
if n == 2:
for layer in layers:
if lay... | true |
b73fccef8ff314e572fa8523b04ada9b6369cc6a | Python | tomoya-1010/python-training | /str.py | UTF-8 | 346 | 4.03125 | 4 | [] | no_license | text1 = 'シングルクォートで囲む'
text2 = "ダブルでもオッケー"
text = "得意なプログラミング言語は\"Python\"です。"
print(text)
text3 = text1 + text2
print (text3)
num = 5
print (num)
l = [1, 2, 3]
print (l)
text4 = 'Today is '
text5 = 15
text6 = ' May. '
text7 = text4 + str(text5) + text6
print (text7)
| true |
27e2b69a176edbb4c582e3faf49f443bcfcda9b0 | Python | Aasthaengg/IBMdataset | /Python_codes/p03448/s681954911.py | UTF-8 | 375 | 3.140625 | 3 | [] | no_license | from sys import stdin
data = stdin.read().splitlines()
a = int(data[0])
b = int(data[1])
c = int(data[2])
x = int(data[3])
count = 0
l = min(x//500, a)
while l >= 0:
x = x - 500*l
m = min(x//100, b)
while m >= 0:
x = x - 100*m
if c >= x//50:
count += 1
x = x + 100*m
... | true |
7eb7aa4642fdcb5a8b83332c2d5a32477ff2a176 | Python | pumbaapeng/Leetcode | /8_string_to_integer.py | UTF-8 | 633 | 3.046875 | 3 | [] | no_license | class Solution:
def myAtoi(self, s: str) -> int:
sign, i = 1, 0
my_min, my_max = (1 << 31) * -1, (1<<31) - 1
while i < len(s) and s[i] == ' ':
i += 1;
if i < len(s) and (s[i] == '+' or s[i] == '-'):
sign = 1 if s[i] == '+' else -1
i += 1
my... | true |
841124c8b9bb6f512f1315fc567078bf1562d966 | Python | kwonyoungbok/rgbd_camera | /interface/device.py | UTF-8 | 883 | 2.546875 | 3 | [] | no_license | import abc
from enum import Enum
from typing import Optional
from .frame import FrameInterface
class DeviceStatus(Enum):
Init = 0
Enable = 1
Disable = 2
class DeviceInterface(metaclass=abc.ABCMeta):
_status:DeviceStatus = DeviceStatus.Disable
@abc.abstractmethod
def get_device_id(self) ->... | true |
4ef353fa71317a376e848e5327a6c25120ad3c02 | Python | IvanBlock/calendar | /event_calendar/models.py | UTF-8 | 1,495 | 2.78125 | 3 | [] | no_license | from django.db import models
# Create your models here.
type_tuple = (('first', 'Тип1'),
('second', 'Тип2'),
('third', 'Тип3'),
('forth', 'Тип4')
)
repeat_type_tuple = (('week', 'Раз в неделю'),
('month', 'Раз в месяц'),
('year', 'Раз в год'),
)
class Event(models.Mo... | true |
ae68c442b48afddf0f451333396ac0c061d328a3 | Python | aconser/Greek-Poetry | /Greek_Prosody/trimeter.py | UTF-8 | 9,790 | 3.3125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sun Jan 7 19:01:06 2018
Trimeter Scansion
This program will take a line of iambic trimeter and return the scansion, as far
as can be determined. It was able to scan 70 of 73 lines from the beginning of
Sophocles' Trachiniae. Lines where it failed involved repeated resolutions... | true |
1c19c8df5b29af255116c990fab8193ab3e3929b | Python | m-bazzell/IT-412A | /Week_1/assignment_1.py | UTF-8 | 1,199 | 4.28125 | 4 | [] | no_license | #First Name lower case
name_low = " mindy"
#Last name all capilatizes
lastname_cap = " BAZZELL"
#print statement with lower and upper case letters as requested
print("Hello," + name_low.upper() + lastname_cap.lower())
#print statement with new lines
print("Hello," +"\n" + name_low.upper()+"\n" + lastname_cap.lower()... | true |
e879a8ea70ac1b4b8dcb316c850aa69f9297a250 | Python | rawtoast24/inf1340_2015_asst2 | /test_exercise2.py | UTF-8 | 1,591 | 3.21875 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
""" Assignment 2, Exercise 2, INF1340, Fall, 2015. DNA Sequencing
Test module for exercise2.py
"""
__author__ = 'Susan Sim'
__email__ = "ses@drsusansim.org"
__copyright__ = "2015 Susan Sim"
__license__ = "MIT License"
import pytest
import mock
from exercise2 import find, multi_find
def test... | true |
eab3331638dbb6ad49a4ca8acd5d6dd2223a9a0c | Python | oilmcut2019/final-assign | /jupyter-u07157110/Quiz_Python_20190309.git/Quiz_5.py | UTF-8 | 238 | 3.25 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# In[9]:
a=int(input())
if a<=5 and a>=3:
print("spring")
elif a<=8 and a>=6:
print("summer")
elif a<=9 and a>=11:
print("fall")
elif a<=12 and a>=2:
print("winter")
# In[ ]:
| true |
32bc8a9dad72fa643db266684fe0f33de0a72c07 | Python | Gabrield28/Data-Structure-Algorithm-Python | /Elementary data structures/Linked List.py | UTF-8 | 1,892 | 4.46875 | 4 | [] | no_license | class node:
def __init__(self, data=None):
self.data=data
self.next=None #la data suivante
class linked_list:
def __init__(self):
self.head = node()
def append(self, data): #ajouter
new_node = node(data)
cur = self.head
while cur.next!=None:
... | true |
b46fafc8107ee998f5a882cfa658f82a346eaab9 | Python | jason-the-j/practice-makes-perfect | /백준 알고리즘/monkey.py | UTF-8 | 1,787 | 2.71875 | 3 | [] | no_license | import sys
from collections import deque
def bfs(start):
while start:
dot=start.popleft()
for _,j,l in direc1:
b,c=dot[1]+j, dot[2]+l
if b>=0 and c>=0 and b<n and c<m and mapp[b][c]=='0' and path[dot[0]][b][c]==0:
... | true |
0b164b744c87108d95adc767894686a4f9513eb7 | Python | gabriellaec/desoft-analise-exercicios | /backup/user_048/ch86_2020_04_27_13_32_03_403756.py | UTF-8 | 136 | 2.671875 | 3 | [] | no_license | with open('dados.csv', "r") as file:
x=file.read()
y=x.replace(',' , ' ')
with open('dados.tsv',"w+") as file:
z=file.write(y)
| true |
ceabdcdc461ebaadca08171cf84c362c62bb03db | Python | davebryson/py-evm | /evm/vm/flavors/frontier/blocks.py | UTF-8 | 5,990 | 2.53125 | 3 | [] | no_license | import itertools
import rlp
from rlp.sedes import (
CountableList,
)
from eth_bloom import (
BloomFilter,
)
from trie import (
Trie,
)
from evm.constants import (
EMPTY_UNCLE_HASH,
)
from evm.state import (
State,
)
from evm.rlp.receipts import (
Receipt,
)
from evm.rlp.blocks import (
O... | true |
8d1428666ed6b65b8b955f21b226b1245283f756 | Python | techhype/python | /strvalid0.py | UTF-8 | 484 | 3.703125 | 4 | [] | no_license | if __name__ == '__main__':
s = input()
#check each char in string
#whether it conatins alphanumeric characters
print(any(c.isalnum() for c in s))
#whether it conatins alphabet characters
print(any(c.isalpha() for c in s))
#whether it conatins digits
print(any(c.isdigit() for c in s))
#wh... | true |
6cef03304a7bbc7adb6683f20a1f24932135282d | Python | regularcoder/aoc-2020 | /py_solutions/day19_2.py | UTF-8 | 1,632 | 3.015625 | 3 | [] | no_license | # To run: python day19_2.py < input_19.txt
import sys
import re
lines = [l.rstrip('\n') for l in sys.stdin]
rules = lines[:lines.index('')]
rules.reverse()
ruleDict = {}
for rule in rules:
ruleParts = rule.split(":")
ruleDict[ruleParts[0]] = ruleParts[1].replace("\"", "").lstrip()
def generateRule(ruleDict... | true |
e464b3ea1d64854f51e2fef3f20fd45bd7f2653a | Python | cltrudeau/purdy | /extras/tools/colours.py | UTF-8 | 1,892 | 2.75 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
import urwid
# ===========================================================================
def exit_on_q(key):
if key in ('q', 'Q'):
raise urwid.ExitMainLoop()
# ===========================================================================
colour_groups = [
# all colours
('b... | true |
164217936312923f4035a12b905881c9afb12222 | Python | andresum97/Automatas | /thompson.py | UTF-8 | 18,415 | 2.875 | 3 | [] | no_license | import node
from graphviz import Digraph
class Thompson:
def __init__(self,r,w):
self.expression = r
self.word = w
self.values = []
self.operators = []
self.cont_nodes = 0
self.all_nodes = []
self.alphabet = []
self.last_final = None
self.firs... | true |
d9702784cbcc9a057f4017ddbabe77dc0a7a8668 | Python | sotoiwa/prometheus_csv_exporter | /export_pod_cpu.py | UTF-8 | 7,118 | 2.609375 | 3 | [] | no_license | import argparse
import collections
import csv
import datetime
import logging
import re
import subprocess
import pprint
import requests
import urllib3
formatter = '%(asctime)s %(name)-12s %(levelname)-8s %(message)s'
logging.basicConfig(level=logging.WARNING, format=formatter)
logger = logging.getLogger(__name__)
#... | true |
0b3f530418e249c8fe1c83eefd8164ed20846ea3 | Python | ZGingko/Python-002 | /week07/AnimalBreeder/Animal.py | UTF-8 | 1,491 | 3.703125 | 4 | [] | no_license | from abc import ABCMeta, abstractmethod
class Animal(metaclass=ABCMeta):
ani_type_dict = {"食肉": 1, "食草": 2}
body_type_dict = {"小": 1, "中等": 2, "大": 3}
character_dict = {"温顺": 1, "凶猛": 2}
def __init__(self, ani_type, body_type, character):
if ani_type not in Animal.ani_type_dict:
r... | true |
fc0133dd2406ce182f111e59610e6f46ebaa1f81 | Python | SaulGarGar/Bot-meetup-Pythonista | /prueba.py | UTF-8 | 328 | 2.90625 | 3 | [] | no_license | from selenium import webdriver
import time
def meetup():
driver = webdriver.Chrome()
driver.get('https://es.wikipedia.org/wiki/Wikipedia:Portada')
barra = driver.find_element_by_name('search')
barra.send_keys('gatitos')
boton = driver.find_element_by_class_name('searchButton')
boton.click()
time.sleep(5)
... | true |
3e678c011789442351400d043028340086efe95c | Python | ChinaSSS/python_tkinter | /Listbox2.py | UTF-8 | 681 | 3.484375 | 3 | [] | no_license | import tkinter
win = tkinter.Tk()
win.title("ironman")
win.geometry("400x400+200+100")
#绑定变量
lbv = tkinter.StringVar()
#不支持鼠标移动选中位置
lb = tkinter.Listbox(win,selectmode=tkinter.SINGLE,listvariable=lbv)
lb.pack()
for i in [1,2,3,4,5,6]:
#按顺序添加
lb.insert(tkinter.END,i)
#在开始添加
lb.insert(tkinter.A... | true |
9f268e05a212f1ac3fadd77f34170f514f7c2202 | Python | someOne404/Python | /pre-exam1/if_func.py | UTF-8 | 1,095 | 4.0625 | 4 | [] | no_license | def how_many_days(year):
'''
leap year if multiple of four unless multiple of 100 and not multiple 400
'''
# No.1
if (year % 4) == 0:
if (year % 400) == 0:
return 366
elif (year % 100) == 0:
return 365
else:
return 366
else:
... | true |
3114e1c55d344c10539118fb6d6b7b8a5ce4604a | Python | BinbinBian/Parable | /logs/logs_util.py | UTF-8 | 601 | 3.09375 | 3 | [] | no_license | import os
import time
def time_string(precision='minute'):
"""
Author: Isaac
returns a string representing the date in the form '12-Jul-2013' etc.
intended use: handy naming of files.
"""
t = time.asctime()
precision_bound = 10 # precision == 'day'
yrbd = 19
if precision == 'minut... | true |
84019a791594299cb0b014d10dda6691e8995b88 | Python | DmitryIT/MITx6.00.1x | /week1/problem1.py | UTF-8 | 157 | 3.84375 | 4 | [] | no_license | vowels_cnt = 0
vowels = ['a', 'e', 'i', 'o', 'u']
for char in s:
if char in vowels:
vowels_cnt += 1
print("Number of vowels: " + str(vowels_cnt)) | true |
50438964f2ffdeeebe4b5672989aebbe2ec0d09b | Python | gugarosa/nalp | /nalp/encoders/word2vec.py | UTF-8 | 2,999 | 3.28125 | 3 | [
"Apache-2.0"
] | permissive | """Word2vec encoding.
"""
import multiprocessing
from typing import List, Optional
import numpy as np
from gensim.models.word2vec import Word2Vec as W2V
from nalp.core.encoder import Encoder
from nalp.utils import logging
logger = logging.get_logger(__name__)
class Word2vecEncoder(Encoder):
"""A Word2vecEncod... | true |
07aee6944f11ab6b1d3c1de6d7e71870f4ef6128 | Python | gusn0905/Problems | /BOJ/BOJ17135 캐슬디펜스.py | UTF-8 | 2,097 | 2.875 | 3 | [] | no_license | # BOJ 17135 캐슬디펜스
import copy
def push(lst):
empty = [0 for _ in range(M)]
del lst[-2]
lst.insert(0, empty)
return lst
def end(lst):
l = len(lst)
s = 0
for le in range(l-1):
s += sum(lst[le])
if s == 0:
return True
else:
return False
def archer(m):
lst... | true |
e48a1df63a0aabf309db59a9cbcd3c529d042683 | Python | PenguinDan/Reference | /Python_Flask/Rendering_Templates.py | UTF-8 | 448 | 2.796875 | 3 | [] | no_license | from flask import render_template
@app.route('/hello/')
@app.route('/hello/<name>')
def hello(name=None):
return render_template('hello.html', name=name)
# Case 1, if your application is a module, the following folder structure is expected
'''
/application.py
/templates
/hello.html
'''
# Case 2, If your appl... | true |
165e3d27434c5e10f36fa8b4fac0b83ef1e7bb0c | Python | jorsanpe/schedbot | /test/user_repository_test.py | UTF-8 | 610 | 2.859375 | 3 | [
"Apache-2.0"
] | permissive | import unittest
from user_repository import UserRepository
from user import User
class UserRepositoryTest(unittest.TestCase):
def test_user_repository_should_assign_unique_id_after_adding_user(self):
user_repository = UserRepository()
user = User()
user_repository.add_user(user)
... | true |
31d6096b771e5a96e2b8b3b6edd27a307fa053d0 | Python | brentru/NYCR-CPY | /08_temp_alarm.py | UTF-8 | 448 | 3.390625 | 3 | [
"MIT"
] | permissive | import time
from adafruit_circuitplayground.express import cpx
# Maximum temperature, in degrees C
MAX_TEMP = 24
# Minimum temperature, in degrees C
MIN_TEMP = 14
while True:
# Take the temperature
temp = cpx.temperature
# Evaluate the temperature
if temp > MAX_TEMP:
cpx.play_tone(587, 5)
... | true |
cf25d1d8b98be9dab4dd8ae6bb7e7bb3735905e1 | Python | dekunle02/TicTacToeAI | /exp.py | UTF-8 | 3,094 | 4.0625 | 4 | [] | no_license | """
-find all available spots, know whose turn it is
-check score for each spot, and put it in a list
choose the highest score.
- use the score to pick the index of the move, and return that
.. we have 2 possible moves, it checks first and realizes it will score -10 checks second and wins with that so +10
picks the... | true |
56edb9e76856bdcd31e7f735c7bc81f072f06752 | Python | TheNizzo/hackathon-epita | /approaches_testing/data_clean.py | UTF-8 | 591 | 3.390625 | 3 | [] | no_license | import matplotlib.pyplot as plt
import pandas as pd
"""Identification des valeurs aberrantes avec la règle 1,5 x écart interquartile"""
def detect_outliers(df: pd.DataFrame):
df = df.drop('label', 1)
plt.figure(1)
for i in range(100):
df.iloc[i].plot.line()
df1 = pd.DataFrame()
for co... | true |
b05d0a5b5cc538ca6761c733884567541488ddf4 | Python | shjang1013/Algorithm | /Programmers/Level2/기능개발.py | UTF-8 | 893 | 3.421875 | 3 | [] | no_license | # 나의 코드
import math
def solution(progresses, speeds):
answer = []
day = [0] * len(progresses)
for i in range(len(progresses)):
day[i] = math.ceil((100-progresses[i])//speeds[i])
# 뒤에 있는 기능이 앞에 있는 기능보다 먼저 개발될 수 있고, 이때 뒤에 있는 기능은 앞은 있는 기능이 배포될 때 함꼐 배포
for i in range(1, len(day)):
... | true |
4128570f29e898edc6441b45573de7b14f53bcc1 | Python | lilylin2018/python-exercise | /SVM/SVM_stock.py | UTF-8 | 626 | 2.953125 | 3 | [] | no_license | from sklearn import svm
from sklearn.model_selection import train_test_split
from sklearn.model_selection import cross_val_score
from sklearn.svm import SVC
import pandas as pd
data = pd.read_csv("D:/python_exercise/SVM/UniversalBank.csv")
# print(data.head())
X = data.iloc[:,1:13].values
y = data.iloc[:,-1].values
X... | true |
b430ec2d75102b1030c550b123d156cf0e7cf157 | Python | elviswf/machine_learning | /machine_learning_tensorflow/tensorflow/3c_cnn_mnist.py | UTF-8 | 3,517 | 2.59375 | 3 | [] | no_license | import argparse
import sys
from tensorflow.examples.tutorials.mnist import input_data
import tensorflow as tf
import numpy as np
FLAGS = None
def main(_):
# Import data
mnist = input_data.read_data_sets(FLAGS.data_dir, one_hot=True)
### Building a model with 2 Convolution layers
### followed by 2 fully co... | true |
6c8434cf6051a6d8c2eaf58e96650ec9e4d8edae | Python | sergiosvieira/short-fu | /short-fu.py | UTF-8 | 2,202 | 3.140625 | 3 | [] | no_license | # -*- encodig: utf-8 -*-i
#/bin/bash/python
import glob
import json
import random
from pprint import pprint
class bcolors:
HEADER = '\033[95m'
OKBLUE = '\033[94m'
OKGREEN = '\033[92m'
WARNING = '\033[93m'
FAIL = '\033[91m'
ENDC = '\033[0m'
BOLD = '\033[1m'
UNDERLINE = '\033[4m'
class ... | true |
761f178442e302216dbbffd035b4bb36a979d51a | Python | paulmorio/grusData | /naiveBayes/naivebayes.py | UTF-8 | 2,744 | 3.734375 | 4 | [
"MIT"
] | permissive | import re
from collections import defaultdict
# get distinct words out of the txt file
def tokenize(message):
message = message.lower()
all_words = re.findall("[a-z0-9']+", message)
return set(all_words)
# for training set we will create a datastructure to work with, it
# will count the words in a labeled training... | true |
95d58a922b67222595e2c8da13b46b7beca6cc2e | Python | quaidb5/python-challenge | /PyBank/change_loop.py | UTF-8 | 700 | 3.59375 | 4 | [] | no_license | # using a list
import os
import csv
import statistics
# grabbing the csv file for budget data
csvpath = os.path.join('budget_data.csv')
with open(csvpath, newline='') as csvfile:
csvreader = csv.reader(csvfile, delimiter=',')
csv_header = next(csvreader)
profit_list = []
for row in csvreader:
... | true |
abc259ec7892bef721c724f40cf0937b01cd1594 | Python | cedadev/ceda-elasticsearch-tools | /ceda_elasticsearch_tools/cmdline/nla_sync_es.py | UTF-8 | 6,848 | 2.65625 | 3 | [] | no_license | '''
nla_sync_fbs.py
Updates the file location on the target elasticsearch index using the NLA as a baseline.
Files which are not visible on disk at the time of scanning will not be in ES. Use the
--index-doc flag to put these missing documents in elasticsearch.
If NLA status ONDISK or RESTORED and scan level is set > ... | true |
ee6bd4d4f8e230753b3c93cea92cc3715ab3ed79 | Python | LiCody/Software | /src/software/thunderscope/field/obstacle_layer.py | UTF-8 | 1,899 | 2.5625 | 3 | [
"LGPL-3.0-only"
] | permissive | import queue
import pyqtgraph as pg
from proto.geometry_pb2 import Circle, Polygon
from proto.visualization_pb2 import Obstacles
from pyqtgraph.Qt import QtCore, QtGui
from software.thunderscope.colors import Colors
import software.thunderscope.constants as constants
from software.networking.threaded_unix_listener im... | true |
9741f14989dfae08b7bd5549e79817ccd4af90b8 | Python | gadeuneo/Python | /Python Programs Into to CS/baern.py | UTF-8 | 3,334 | 4.21875 | 4 | [] | no_license | # baern.py
# Input corpus in command line
# Output random sentances
from sys import *
from random import *
def corpusWordList(corpus):
"""Reads a file and creates a list containing all of the words in the
in order, with capitalization and punctuation retained"""
inputFile = open(corpus)
corpusText = inputFile.... | true |
d9d7ea1c07aea0d48ec5f9e0759de6bdd8c422b2 | Python | nbock/dragons | /propagators.py | UTF-8 | 6,376 | 3.515625 | 4 | [] | no_license | '''This file will contain different constraint propagators to be used within
bt_search.
propagator == a function with the following template
propagator(csp, newly_instantiated_variable=None)
==> returns (True/False, [(Variable, Value), (Variable, Value) ...]
csp is a CSP object---the prop... | true |
d16b22e94394171ace5383b5907d95d0b403f11e | Python | AdityaSP/ora-py-jun18-22 | /proj/filehanding/xmlhandling.py | UTF-8 | 590 | 2.640625 | 3 | [] | no_license | import xml.dom.minidom as dom
import pdb
pdb.set_trace()
doc_model = dom.parse('persons.xml')
persons = doc_model.getElementsByTagName('Person')
for person in persons:
print "-" * 30
children = [child for child in person.childNodes if child.nodeType == 1]
for child in children:
print ch... | true |
aed3df0939a5efbf642b42a4665f4743ec853238 | Python | highlando/pystokes | /exactstoksol.py | UTF-8 | 3,835 | 3.234375 | 3 | [] | no_license | import sympy as smp
from sympy import diff, sin, cos, pi
x, y, t, nu, om = smp.symbols('x,y,t,nu,om')
ft = smp.sin(om*t)
u1 = ft*x*x*(1-x)*(1-x)*2*y*(1-y)*(2*y-1)
u2 = ft*y*y*(1-y)*(1-y)*2*x*(1-x)*(1-2*x)
p = ft*x*(1-x)*y*(1-y)
# Stokes case
rhs1 = smp.simplify(diff(u1,t) - nu*(diff(u1,x,x) + diff(u1,y,y)) + diff(p... | true |
7e2c2abeee4326eaf544c6b35e59716bf9b850af | Python | jonesmat/goldtown | /main.py | UTF-8 | 1,160 | 2.765625 | 3 | [
"MIT"
] | permissive | import sys
import pygame
from pygame import locals
from input_parser import PygameInputParser
from ui.overworld_scene import OverworldScene
from characters.human import Human
pygame.init()
clock = pygame.time.Clock()
surface = pygame.display.set_mode((640, 480))
pygame.display.set_caption('Goldtown')
# A list of ... | true |
c65a8d15f536f109ed24b94468f202b02a5b73df | Python | sandrahelicka88/codingchallenges | /Google/numberofIslands.py | UTF-8 | 1,303 | 3.90625 | 4 | [] | no_license | import unittest
'''
Given a 2d grid map of '1's (land) and '0's (water), count the number of islands. An island is surrounded by water and is formed by connecting adjacent lands horizontally or vertically. You may assume all four edges of the grid are all surrounded by water.
'''
def dfs(grid,i,j):
if i<0 or i>=len... | true |
7f931f5cc4717fb2ce6ce64c98283d5897f92652 | Python | rseholland/learning_python | /vat2.py | UTF-8 | 739 | 3.265625 | 3 | [] | no_license | VAT = 20 ; calculatedVAT = 1 + (VAT / 100)
"Price List"
shoes = 65
socks = 15
hat = 20
shorts = 105
trousers = 150
top = 75
jacket = 200
"calculate prices with VAT"
calculatedShoes = shoes * calculatedVAT
calculateSocks = socks * calculatedVAT
calculatedHat = hat * calculatedVAT
calculatedShorts = shorts * calculat... | true |
45bd1fdd687e2fdb2d7cb780d863bbaca98ed036 | Python | smaityumich/Transfer-learning | /without-label-V2/experiments.py | UTF-8 | 4,467 | 2.875 | 3 | [] | no_license | from kdeClassifier import *
from withLabelV3 import *
from withoutLabelV3 import *
import numpy as np
from dataGenerator import *
from mixtureClassifier import *
class Experiments():
def __init__(self, kernel = 'gaussian'):
self.kernel = kernel
def _getData(self, n_source = 500, n_target = 200, n_te... | true |
5c68f56df26880f508fb02804f6890db3cb4513f | Python | zhouyang123200/multimedia-manager-backend | /src/api/models/file.py | UTF-8 | 2,336 | 2.546875 | 3 | [] | no_license | """
all kinds of file model and related schema
"""
import os
from datetime import datetime
from flask import current_app
from marshmallow_sqlalchemy import SQLAlchemySchema, auto_field
from marshmallow import fields
from api.utils.database import db, BaseMixin
class FileMixin:
"""
base model for file
"""
... | true |
29b3e6095abbfec2b607b359791c0b6f744b623f | Python | anantkaushik/leetcode | /1539-kth-missing-positive-number.py | UTF-8 | 1,987 | 4.0625 | 4 | [] | no_license | """
Problem Link: https://leetcode.com/problems/kth-missing-positive-number/
Given an array arr of positive integers sorted in a strictly increasing order, and an integer k.
Find the kth positive integer that is missing from this array.
Example 1:
Input: arr = [2,3,4,7,11], k = 5
Output: 9
Explanation: The missing po... | true |
7ab519ffc2613aa716c3b10d161a5814197dba3d | Python | Aasthaengg/IBMdataset | /Python_codes/p03592/s658193234.py | UTF-8 | 366 | 2.796875 | 3 | [] | no_license | import sys
stdin = sys.stdin
sys.setrecursionlimit(10**6)
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
nn = lambda: list(stdin.readline().split())
ns = lambda: stdin.readline().rstrip()
n,m,k = na()
for i in range(m+1):
for j in range(n+1):
if n*i+m*j-2*i*j == k:
... | true |
89bd10610d53e61c56dcc969d24f9f4d0c68b308 | Python | Aasthaengg/IBMdataset | /Python_codes/p03786/s036305425.py | UTF-8 | 268 | 2.71875 | 3 | [] | no_license | N = int(input())
A = list(map(int, input().split()))
A.sort()
cum = [A[0]]
for i in range(1,N):
cum.append(cum[-1]+A[i])
for i in reversed(range(N-1)):
if cum[i] * 2 >= A[i+1]:
continue
else:
print(N-1-i)
break
else:
print(N) | true |
6225defe5c7675b69f9d932b3894f4263a7c094f | Python | ngard/CarND-Behavioral-Cloning-P3 | /model.py | UTF-8 | 5,577 | 2.765625 | 3 | [] | no_license | import csv, cv2
import numpy as np
import os
from PIL import Image
import sklearn
import random
train_samples = []
validation_samples = []
def sample_generator(validation_rate = 0.2):
record_path = "./record/"
for record in os.listdir(record_path):
with open(record_path + record + "/driving_log.csv")... | true |
15696eeb9dd755978143d707fe7e1d69dc6d0f2d | Python | Aasthaengg/IBMdataset | /Python_codes/p03078/s884727387.py | UTF-8 | 644 | 2.828125 | 3 | [] | no_license | import sys
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
f_inf = float('inf')
mod = 10 ** 9 + 7
def resolve():
X, Y, Z, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
AB = []
for i in range... | true |
2e06585da4605c8fd355509e8eb817b913457279 | Python | AdrianPierzga216820/pp1-1 | /03-FileHandling/22.py | UTF-8 | 249 | 3.484375 | 3 | [] | no_license | import csv
with open('students.txt', 'r') as file:
reader = csv.DictReader(file, delimiter=',')
for row in reader:
if int(row['age']) < 30:
print(f"""{row['first_name']:10}{row['last_name']:10}{row['email']:20}""") | true |
c9cbac4e38d59f3e008f03a480d94bbc090145d6 | Python | lili10000/football | /cal_rank.py | UTF-8 | 3,880 | 2.59375 | 3 | [] | no_license | from db.mysql import sqlMgr
import json
sql = sqlMgr('localhost', 'root', '861217', 'football')
games = sql.queryByTypeAll("k_gamedic_v2")
index = 1
for game in games:
gameName = game[1]
data = sql.queryByType(gameName, "k_gameInfoDetail")
print(gameName, " size:", len(data))
if len(data) == 0 :
... | true |
ddeecd76e0b753363e83eb210cbcd58d5ae991f7 | Python | xurui1217/scrapy_movie_name | /test_pd.py | UTF-8 | 187 | 3 | 3 | [] | no_license | import pandas as pd
import numpy as np
df = pd.DataFrame(pd.read_csv('movie.csv'))
df = df[0:10]
# print(item[0])
df_np = np.array(df)
print(df_np)
df_lis = df_np.tolist()
print(df_lis)
| true |
612530b27e7f1fcca08a813e35dcba7402f71f42 | Python | NDAKOTA1026/Kattis | /aaah.py | UTF-8 | 261 | 2.984375 | 3 | [] | no_license | from sys import stdin
def aaah() -> str:
"""
return go or no based on whether he meets the doctor's requirement
"""
in1 = input()
in2 = input()
print( "go" if len(in1) >= len(in2) else "no" )
if __name__ == "__main__":
aaah()
| true |
fed3a1040074dbddb212f2fb5a8c8bcdcee98c6a | Python | Sandy4321/LDA_Gibbs_Sampler_Lib | /python/crawler/pc2.py | UTF-8 | 3,847 | 2.609375 | 3 | [] | no_license | from bs4 import BeautifulSoup
from nltk.stem import PorterStemmer
from nltk.stem import WordNetLemmatizer
import urllib
import re
import random
import urllib2
import nltk
import os
user_agent = "Mozilla/5.0 (X11; U; Linux i686) Gecko/20071127 Firefox/2.0.0.11"
urlUsed = set()
urlUnused = set()
def getHt... | true |