blob_id large_string | repo_name large_string | path large_string | src_encoding large_string | length_bytes int64 | score float64 | int_score int64 | detected_licenses large list | license_type large_string | text string | download_success bool |
|---|---|---|---|---|---|---|---|---|---|---|
9f863403790a77b05f1ad7a581a91fd1bc035568 | jsturtz/CS467_ProjectMidas | /Midas/ML_pipeline.py | UTF-8 | 22,063 | 2.8125 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Nov 13 18:03:05 2019
References:
https://www.kdnuggets.com/2017/03/simple-xgboost-tutorial-iris-dataset.html
https://towardsdatascience.com/support-vector-machine-python-example-d67d9b63f1c8
https://scikit-learn.org/stable/modules/generated/... | true |
dbb716f722acdced8c652d341de64b7dea5aa0cc | bengwall3/ProjectEuler | /Python/004.py | UTF-8 | 390 | 3.984375 | 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.
m = 0
for i in range(100, 1000):
for j in range(i, 1000):
n = i * j
if str(n) == str(n)[... | true |
72e6bd21fcb484edc7d2b7f2a61eb70657692aa7 | cdigap/Python_Project_2018 | /Iris_Data_Analysis_Menu.py | UTF-8 | 2,255 | 4 | 4 | [
"Apache-2.0"
] | permissive | # Ashok Gangadharan 2018-04-20
# Python Project...
#
# Analysing Data from the file...
#
import numpy as np
import pandas as pd
from pandas.plotting import scatter_matrix
import matplotlib.pyplot as plt
#Assigning the data File to dfile
dfile = "iris_data.csv"
#Defining Headers to the file
colms = ['Sepal_Length... | true |
e3079853eda77937411455d2d4a12c79b98f2141 | seangibbons/BlackQueen | /Main.py | UTF-8 | 3,031 | 2.53125 | 3 | [] | no_license | #Preliminary model for the Cooperation experiments
import numpy as np
import math
import random
from time import clock
import os
import Parameters as Par
from Interactions import *
from Output import *
from Agents import *
from Initialize import *
#####################################################################... | true |
2778877329a5c19f992844dc6c78265aab14e1ab | Starxy/Eureka | /Eureka/DeckManager/DeckPrice.py | UTF-8 | 2,718 | 2.84375 | 3 | [] | no_license | from Eureka.SteamMarket.MarketPrice import get_market_current_lowest_price
from Eureka.DeckManager.DeckDecoder import CADD
from Eureka.DeckManager.DeckManager import DeckManager
class DeckPrice(object):
def __init__(self, deck_code):
self.tootle_price = 0
self.deck_code = deck_code
self.na... | true |
d10c43c26340425e36495577dc95239f0af83ca5 | eljayan/bomextraction | /main.py | UTF-8 | 3,704 | 2.796875 | 3 | [] | no_license | import xlrd
import openpyxl
from traceback import print_exc
from tkFileDialog import askdirectory
from tkMessageBox import showinfo
from tkMessageBox import showerror
import Tkinter
import re
import os
def main():
#crear diccionario para los boms-descripciones
bomdict = {}
#seleccionar la carpet
#fold... | true |
0976c18c210ce0d65ab2da5d90206869ac3ff25a | hehichens/Strabismus-detection | /hichens/detect_eye/detect_eye.py | UTF-8 | 5,672 | 2.671875 | 3 | [] | no_license | import dlib
import numpy
import sys
import os
from math import *
import cv2
# 获取原始图片
def getAllImg(folder):
assert os.path.exists(folder)
assert os.path.isdir(folder)
imgList = os.listdir(folder)
imgList = [item for item in imgList if os.path.isfile(os.path.join(folder, item))]
return imgList
imgList = getAllI... | true |
479cf832d2ae78b90c3eddfad83e86dd1578bcdd | codpro880/project_euler | /python/problem_5.py | UTF-8 | 1,061 | 4.5 | 4 | [] | no_license | """
Problem: What is the smallest positive number that is evenly divisible by all of the numbers from 1 to 20?
"""
"""
This doesn't even require any programming. You just need to include the "highest power possible" for each prime factor
under 20. "highest power possible" means using the highest possible power withou... | true |
d82987207ec520fad344cffd6fbaa7f5931875bb | redhog/webwidgets | /Utils/Mail.py | UTF-8 | 4,211 | 2.765625 | 3 | [] | no_license | #! /bin/env python
# -*- coding: utf-8 -*-
# vim: set fileencoding=utf-8 :
# Webwidgets web developement framework
# Copyright (C) 2008 FreeCode AS, Egil Moeller <egil.moeller@freecode.no>
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as ... | true |
c4d464c476c39b7cd15122f0289a89466bce473c | samuelcorralesc/programacion | /9_3.py | UTF-8 | 648 | 3.125 | 3 | [] | no_license | def fun(ar):
if ar[-2]=='i' and ar[-1]=='x':
return 'Galo'
if ar[-2]=='u' and ar[-1]=='s':
return 'Romano'
if ar[-2]=='a' and ar[-1]=='s':
return 'Griego'
if ar[-2]=='i' and ar[-1]=='c':
return 'Godo'
if ar[-2]=='a' and ar[-1]=='f':
return 'Normand... | true |
608c6c939ed9b3c28ae2552d0f352adff7dfa39d | cityuCompuNeuroLab/TVpgGLM | /test/practice1.py | UTF-8 | 1,855 | 4.25 | 4 | [
"MIT"
] | permissive | # Practice 1
x = 56
def change_value(num):
num = 90
print(x)
change_value(x)
print(x)
class Boat():
def __init__(self):
self.cargo_weight = 23
def change_cargo_weight(ship):
ship.cargo_weight = 45
boat = Boat()
print(boat.cargo_weight)
change_cargo_weight(boat)
print(boat.cargo_weight)
# Prarice 2
class Hum... | true |
280b8ed6fd287308a49fe8ded6c8e2c9bc2c92fb | stanilevitch/python_06102018 | /zjazd_3/Zadanie7.py | UTF-8 | 536 | 3.796875 | 4 | [] | no_license | class PremiumEmployee:
def __init__(self, imie, nazwisko, stawka):
self.imie = imie
self.nazwisko = nazwisko
self.stawka = stawka
def give_bonus(self):
pass
def test_employee():
employee = PremiumEmployee('Jan', 'Nowak', 100.0)
assert employee.imie == "Jan"
assert ... | true |
9f5426606f96725fdbcaa78e9fbe8e9a0b8e83e5 | mars2020/ML-practice | /ml.py | UTF-8 | 405 | 3.09375 | 3 | [] | no_license | import tensorflow as tf
import numpy as np
# create model
model = tf.keras.Sequential([tf.keras.layers.Dense(units=1)])
# define optimization algorithm and loss function
model.compile(optimizer='sgd',loss='mean_squared_error')
# define data
x = np.array([-1,0,1,2,3,4],dtype=int)
y = np.array([3,4,5,6,7,8],dtype=int)... | true |
bd6aa52b8c75f462aedfcc687c26d6741049a502 | yinshengLi/exercise | /exercise/chapter9_3.py | UTF-8 | 1,693 | 3.265625 | 3 | [] | no_license | #__author:iruyi
#date:2018/10/31
scientists = {'Newton': 1642, 'Darwin': 1809, 'Turing': 1912}
print(scientists.get('Newton'))
print('Specified', scientists.get('Newton2', 1500)) # if key does not exist in dict ,return the designated value
print(scientists['Newton'])
print('items:', scientists.items())
temp = {'Curie... | true |
a3c95854a865e8901d03973be13ddcae69025f8a | visavis2k/MakehardSub | /utils/file_utils.py | UTF-8 | 555 | 2.890625 | 3 | [] | no_license | import os
def extract_filename(file):
return os.path.basename(file)
def extract_base_filename(file):
basename = os.path.basename(file)
return '.'.join(basename.split('.')[:-1])
def extract_file_extension(file):
basename = os.path.basename(file)
return '.' + str(basename.split('.')[-1])
def c... | true |
194073816a65e60c935dc6453572e936ae3b3e94 | tburton12/Text-Interceptor | /settings.py | UTF-8 | 1,425 | 2.9375 | 3 | [] | no_license | import configparser
from pynput.keyboard import Key
import os.path
class Settings:
"""
Program settings such as assigned keys
"""
@staticmethod
def __generate_config_file():
"""
Generate new conf file with default settings
"""
print("Creating conf.ini")
conf... | true |
75f2f09a60effdb0c452568b65d2747ea8e55ee4 | adramsamayush/Kloudone_Algo | /Binary_Exponentiation.py | UTF-8 | 212 | 3.46875 | 3 | [] | no_license | def mod_pow(x,n,M):
if(n==0):
return 1
elif(n%2==0):
res=pow(x,n/2)%M
return (res * res) % M
else:
return ((x%M) *pow(x,n-1)%M) % M
p=mod_pow(7,2,3)
print(p) | true |
f81a45dabb59f472935f8d3549193a83b8096fab | mameer1/ClassifyTriangle | /classifyTriangle.py | UTF-8 | 1,283 | 3.78125 | 4 | [] | no_license | def classify_triangle(*args):
argCount = len(args)
if argCount != 3:
return "ERROR: Number of arguments must equal 3"
a = args[0]
b = args[1]
c = args[2]
try:
int(a)
int(b)
int(c)
except (TypeError,ValueError):
return "ERROR: Invalid Input(... | true |
c7a861e358b5065281765990e1d47c8e23386e8a | Valentin-cruz/Python_Stack | /django/django_intro/django_project/apps/first_app/models.py | UTF-8 | 860 | 3.015625 | 3 | [] | no_license | from django.db import models
class Users(models.Model):
first_name = models.CharField(max_length=45)
last_name = models.CharField(max_length=45)
email_address = models.CharField(max_length=45)
age = models.IntegerField()
created_at = models.DateTimeField(auto_now_add=True)
updated_at = models.D... | true |
ea15e1aa208dfbc698fb965d6102b0fefb415e94 | mishajw/aidio | /aidio/audio_reader.py | UTF-8 | 1,399 | 3.078125 | 3 | [] | no_license | import wave
from typing import List, Tuple
import numpy as np
BUFFER_SIZE = 32
MAX_NUM_FRAMES = 1000
def read_audio(path: str) -> np.array:
pieces: List[np.array] = []
with wave.open(path, 'r') as f:
assert f.getsampwidth() == 2
audio_dtype = np.dtype("int16").newbyteorder("L")
for ... | true |
3b86a9153033a82be4aea08df973f393436d52be | refeed/PAlgoritmaTRPLA | /NOV_3_2020/bab6_quiz1.py | UTF-8 | 203 | 3.71875 | 4 | [
"MIT"
] | permissive | input_num = int(input())
is_prime = True
for i in range(2, input_num):
if input_num % i == 0:
is_prime = False
break
if is_prime:
print('PRIMA')
else:
print('BUKAN PRIMA')
| true |
df24675ba23b10d4672534e75f46a7c0654a1083 | bsod90/django-token-auth | /tests/test_middleware.py | UTF-8 | 1,851 | 2.65625 | 3 | [
"MIT"
] | permissive | import mock
from django.test import TestCase
from django.test import RequestFactory
from django_token_auth.middleware import TokenAuthenticationMiddleware
def mocked_authenticate(*args, **kwargs):
assert 'token' in kwargs
return mock.Mock(
is_authenticated=lambda: True,
username='john'
)
... | true |
f3cf811f96ab7ad06c4a704e8307c36819fabd66 | ignasheva/My_HW | /tests/homework3/test_task1.py | UTF-8 | 343 | 2.6875 | 3 | [] | no_license | import pytest
from homework3.task1 import cache
def test_cache_is_working():
times_called = 0
@cache(times=3)
def func(a, b):
nonlocal times_called
times_called += 1
return (a ** b) ** 2
assert func(2, 2) == 16
assert times_called == 1
assert func(2, 2) == 16
as... | true |
1bb6519d11c716884f44d7f138a84d4f2ec551d0 | srdecny/cryptopals | /utils/utils.py | UTF-8 | 619 | 3.078125 | 3 | [] | no_license | import random
def chunks(lst, n=16):
"""Yield successive n-sized chunks from lst."""
for i in range(0, len(lst), n):
yield lst[i:i + n]
# Flattens a list of bytearrays
def flatten(lst):
res = b""
for arr in lst:
res += arr
return res
def random_bytearray(length):
rng = random.... | true |
7da860faa53620c0210da7a4fb45242e10714a45 | sachingupta63/hacktoberfest20 | /palindrome.py | UTF-8 | 194 | 4.15625 | 4 | [] | no_license | def is_palindrome(string):
if string[-1::-1]==string[:]:
print("Palindrome String")
else:
print("Not an Palindrom")
char=input("Enter the String :")
is_palindrome(char)
| true |
dfde8361ef59956924ac02af5d02329616291745 | MRitter95/GraphCodes | /GraphCodes/LayoutGenerator5.py | UTF-8 | 90,867 | 2.8125 | 3 | [] | no_license | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Wed Jun 28 12:51:45 2017
@author: kollar2
starting Kollarlab version 1-20-20
v3 - adding square and possibly hexagonal planar lattices togain intuition
Also fix a bug with the radial linkes at self.vertex>3
switch to scipy.linalg.eigh for ... | true |
742d17a243ae747561a9c9ce53e30762f8ce2f72 | a46461440/python_study | /test/fun_code/return_fun.py | UTF-8 | 405 | 3.515625 | 4 | [] | no_license | def lazy_sum(arg) :
def sum() :
sum_real = 0
for per in arg :
sum_real = sum_real + per
return sum_real
return sum
list1 = [1,2,3,4,5,6]
f = lazy_sum(list1)()
print(f)
print(f)
def count():
fs = []
for i in range(1, 4):
def f():
return i*i
... | true |
3d40393d8c95908c961fd5b716980032a7aae5e2 | GH-Jo/HMQ_practice | /common/single_best.py | UTF-8 | 596 | 4 | 4 | [] | no_license | class IsBest(object):
def __init__(self):
"""
This class check if a given value is the best so far
"""
self.val = None
def is_best(self, val) -> bool:
"""
This function returns the status of the current value and update the best value.
:param val: The cur... | true |
912f489b5aa6bc20c026e1c711eede9a4abd0110 | HappyAfrican/SJTB | /tools/box/downloadBook/spyder/aszwDownloader.py | UTF-8 | 929 | 2.546875 | 3 | [
"Apache-2.0"
] | permissive | # -*- coding: utf-8 -*-
import urllib.request
import urllib.parse
class Downloader:
def m_download(self, url, cookie,user_agent='Mr.Zhang', proxy=None, num_retries=2):
headers = {'User-agent': user_agent,'cookie':cookie['content']}
print(cookie['content'])
request = urllib.request.Reques... | true |
9ba5a993eea077b9865f677f7eb2d8d907152af6 | dcormar/pyScripts | /Regex2.py | UTF-8 | 1,426 | 3.328125 | 3 | [] | no_license | import re
from functools import reduce
def presses(phrase):
phraseText = phrase if type(phrase) is str else str(phrase)
return int(reduce((lambda x, y: int(x) + int(y)), [x for x in re.sub(r'[SZ]', '4',
re.sub(r'[CFILORVY]', '3',
re.sub(r'[0BEHKNQUX]', '2',
re... | true |
2df22489628fa08042ee834d1b96f7981e0657fa | rmhsilva/CS110-Assignments-Python | /week08/lab8ArrowheadCurve.py | UTF-8 | 1,259 | 3.921875 | 4 | [
"MIT"
] | permissive | import turtle
def createLSystem(numIters,axiom):
startString = axiom
endString = ""
for i in range(numIters):
endString = processString(startString)
startString = endString
return endString
def processString(oldStr):
newstr = ""
for ch in oldStr:
newstr = newstr + appl... | true |
c3fb59e7baa777d61e0f3f4153da529bb570ff8f | jaliagag/21_python | /UCEMA/06.py | UTF-8 | 793 | 5.0625 | 5 | [] | no_license | """print("Multiplicación")
print(5 * 4)
print("División")
print(5 / 4)
print("Potencia")
print(5 ** 4)
print("Módulo")
print(5 % 4)
print("Parte entera")
print(5 // 4)
1. Declarar las variables "numero1" y "numero2" y pedirle al usuario que ingrese estas con la linea "Ingrese un número entero: "
2. Imprimir solam... | true |
e871f74510ea28d6aac7f1013ee919aee494b173 | SKorablyov/Pranam | /functions+test_plot.py | UTF-8 | 5,491 | 2.625 | 3 | [] | no_license | import tensorflow as tf
import time
import inputs
from math import pi
from math import exp
import os,sys,time
import numpy as np
import matplotlib
from matplotlib import pyplot as plt
from matplotlib import cm
from mpl_toolkits.mplot3d import Axes3D
import tensorflow as tf
import utils,embedders
from scipy.signal impor... | true |
8685631257ac3566878c69a25e11ba018709b7a8 | dr-dos-ok/Code_Jam_Webscraper | /solutions_python/Problem_118/1456.py | UTF-8 | 640 | 2.96875 | 3 | [] | no_license | #!/usr/bin/python
from collections import deque
from decimal import *
'''
Ahmed Medhat Othman
AMedOs
amedhat.cs@gmail.com
'''
def main():
fin = open('C-small-attempt0.in', 'r')
fout = open('C.out','w')
T = long(fin.readline())
for tc in range(1,T+1):
mn, mx = map(long, fin.readline().split())
def is_pal(nu... | true |
00a328ffb2a551d7c84882141bae3aaa92f765e7 | ornachmias/vist-verification | /hitCounter.py | UTF-8 | 1,008 | 3 | 3 | [] | no_license | import os
class HitCounter(object):
def __init__(self, root_path, story_max_hits):
self._counter_path = os.path.join(root_path, "HitCounters")
if not os.path.exists(self._counter_path):
os.makedirs(self._counter_path)
self._story_max_hits = story_max_hits
def is_max_hit(... | true |
05eb908a4e23cdd057e292aeed92bb79b5989fb6 | Greyvend/tradersite | /strategy_runner/stockdata.py | UTF-8 | 8,748 | 3.296875 | 3 | [] | no_license | __author__ = 'mosin'
import urllib2
import csv
import numpy as np
from datetime import date, datetime
import pca
def _get_prices(stock, start_date, end_date):
# Use URL template and fill in stock symbol, start date and end date
"""
Get dates and prices on that dates.
:param stock: name of stock to ge... | true |
030005331e46836b8a76df8aa72d6894f4cd4409 | texttest/storytext-selftest | /swing/appevents/wait_for_enable/target_ui.py | UTF-8 | 1,235 | 2.921875 | 3 | [] | no_license | from javax.swing import JFrame, JPanel, JButton, Timer
from java.awt import BorderLayout
from java.awt.event import ActionListener
class ApplicationEventApp:
def make_ui(self):
self.frame = JFrame("Close Buttons")
self.frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE)
self.frame.setLa... | true |
52cf206f445550b312727535899cdcae757f5e62 | codebankss/CorePython | /removing_duplicates2.py | UTF-8 | 192 | 3.25 | 3 | [] | no_license | x= [1,2,5,4,2,7,5,7,4,8,1,1,1,1,4,2,6,3,8,3]
i = 0
while i < len(x):
j = i + 1
while j < len(x):
if(x[i] == x[j]):
del(x[j])
else:
j = j+1
i = i+1
print(x)
| true |
bf2d292a43f16ff2450b088adacfa72e2d2e050f | ehbaker/ice2O | /utils/DbImport.py | UTF-8 | 4,949 | 2.859375 | 3 | [
"LicenseRef-scancode-warranty-disclaimer"
] | no_license | """
PURPOSE
------------------------------------------------------------------------------
Provide a variety of functions to facilitate easy import of external data to the Ice2O Cloud-hosted postgres database.
CREATION
------------------------------------------------------------------------------
Created by Emily Bake... | true |
3c8ecd5ed866ebd459aed2c176383053d655034b | mono--/aoc2017 | /14/14.py | UTF-8 | 2,367 | 2.703125 | 3 | [] | no_license | def reverse(text, repeat):
knot = list(range(256))
pos = 0
skip = 0
for isntevenused in range(repeat):
for i in text:
temp = []
for j in range(i):
temp.append(knot[(pos+j) % 256])
for j in range(i):
knot[(pos+i-1-j) % 256] = temp[j]
pos += skip + i... | true |
bf8cd026465efa27fb054cff6675821a8220a524 | tejadeep/Python_files | /tej_python/basics/files/demo.py | UTF-8 | 125 | 3.8125 | 4 | [] | no_license | fh=open("text","r")
count = 0
text = fh.read()
for character in text:
if character.isupper():
count += 1
print count
| true |
2aa236c2d892ef8d33732677434afb83ff9dd52f | liushui9404/cloze | /survey_best_performing_clozes.py | UTF-8 | 14,400 | 2.65625 | 3 | [] | no_license | import numpy as np
import tensorflow as tf
from tensorflow.contrib.tensorboard.plugins import projector
import time
import pickle
FLAGS = tf.app.flags.FLAGS
NUM_CLOZES = 127
# Model Parameters
tf.app.flags.DEFINE_integer(
'num_steps', 1, 'Number of unrolled steps before backprop.')
tf.app.flags.DEFINE_integer('em... | true |
b89b12e60873ae9973928d596a13c602b75d10c0 | hychrisli/PyAlgorithms | /src/solutions/part2/q023_merge_k_sorted_lists.py | UTF-8 | 2,142 | 3.15625 | 3 | [
"Apache-2.0"
] | permissive | from src.base.solution import Solution
from src.tests.part2.q023_test_merge_k_sorted_lists import MergeKSortedListsTestCases
from src.structures.listnode import ListNode
class MergeKSortedLists(Solution):
def gen_test_cases(self):
return MergeKSortedListsTestCases()
def run_test(self, input):
... | true |
a3b381510404d73951becc8156c6dcf1ff4911b2 | shanpramuditha/CS4642-vehicle-index | /scraper/spiders/ikmanbot.py | UTF-8 | 1,857 | 2.640625 | 3 | [] | no_license | import scrapy
from urllib.parse import urljoin
import logging
import re
class IkmanBot(scrapy.Spider):
name = "ikmanbot"
# allowed_domains = ["https ://ikman.lk"]
start_urls = []
for i in range(300,500):
start_urls.append("https://ikman.lk/en/ads/sri-lanka/cars-vehicles?page="+str(i))
custo... | true |
0689386b5ecf7d58f2de32a65e195b281cbbc526 | Cain96/nlp100 | /chap4/k35.py | UTF-8 | 545 | 3.015625 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# k35.py
from chap4.utils import morphological
if __name__ == '__main__':
long_nouns = []
for sentence in morphological():
nouns = []
for word in sentence:
if word["pos"] == "名詞":
nouns.append(word["surface"])
... | true |
3e82c682c2b1e0bc88bdf0c60f98935edbabb4d9 | patriciobaez/algoritmos1 | /ejercicios/ejercicio7.py | UTF-8 | 1,327 | 4.59375 | 5 | [] | no_license | '''
Crear un programa que permita ingresar N números enteros positivos y luego mostrar por pantalla
la suma total de esos números y el promedio.
Una vez hecho, crear otro programa que utilice lo anterior pero que permita hacerlo 3 veces.
Es decir, calcular 3 sumas totales y 3 promedios, una vez hecho eso, verificar en... | true |
e5edb9bdb6ce3519923de6595bd7b028aa0fc2d0 | why1679158278/python-stu | /python资料/day8.10/day08/demo06.py | UTF-8 | 542 | 3.703125 | 4 | [
"MIT"
] | permissive | """
作用域
变量起作用的范围
全局变量:大范围(多个函数)需要操作的数据
局部变量:小范围(一个函数)需要操作的数据
"""
# -------全局变量--------
# 全局作用域:文件内部
# 全局变量能在整个文件中使用(函数内部可以读取)
b = 20
# -------创建函数--------
def func01():
# 局部作用域:函数内部
# 局部变量只能在函数内部使用
a = 10
print(b)
# -------调用函数--------
func01() | true |
a8ed0387fe39577938549309fcfd30a7af6b7f50 | Larionov0/Steam_dataset_GroupA | /task2.py | UTF-8 | 3,345 | 3.296875 | 3 | [] | no_license | import plotly
import plotly.graph_objs as go
def super_split(string, sep, bracket='"'):
ignore = False
words = []
start_index = 0
for i in range(len(string)):
if string[i] == bracket:
ignore = not ignore
elif string[i] == sep and not ignore:
substring = string[s... | true |
7034fe8feb520a0f190dfb4499d34dc12f0dcb91 | JuliusDantas/dev_api | /habilidades.py | UTF-8 | 1,499 | 2.703125 | 3 | [] | no_license | from flask_restful import Resource
from flask import request
import json
lista_habilidades = [{'id': '0', 'nome': 'Python'},
{'id': '1', 'nome': 'Java'},
{'id': '2', 'nome': 'SQL'},
{'id': '3', 'nome': 'Django'},
{'id': '4', 'nome': 'P... | true |
aef87d47535802896e986dd60909568de4e87947 | ozgeksuz/python-min-projeler | /ohm_kanunu_hesaplama.py | UTF-8 | 706 | 3.953125 | 4 | [] | no_license | #elektrik akıma göre direnç bulma
# V=I*R
secenek = input("Ohm Kanunu V=I*R (Gerilim = Akim * Direnc) \n Bulmak istediginiz degeri giriniz: 1)V gerilim 2)I akim 3)R direnc")
if (secenek == "1"):
akim = float(input("akim degerini giriniz: "))
direnc = float(input("direnc degerini giriniz: "))
gerilim = aki... | true |
d9c297c26565d14de4f98783360ceb7617e86885 | xxuejie/WAVM | /Test/spec/simd/meta/simd_int_arith2.py | UTF-8 | 14,284 | 2.515625 | 3 | [
"BSD-3-Clause",
"Apache-2.0"
] | permissive | #!/usr/bin/env python3
"""
Generate [min_s, min_u, max_s, max_u] cases for i32x4, i16x8 and i8x16.
"""
from simd import SIMD
from test_assert import AssertReturn, AssertInvalid, AssertMalformed
from simd_lane_value import LaneValue
from simd_integer_op import IntegerSimpleOp as IntOp
class SimdLaneWiseInteger:
... | true |
83b1bf5ba094fc4bac271d59518ace0025db0b0c | shulu/python_note | /spider_py/demo1.py | UTF-8 | 3,152 | 2.734375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import io
import sys
import requests
import json
import pymysql
sys.stdout = io.TextIOWrapper(sys.stdout.buffer,encoding='utf8') #改变标准输出的默认编码
# r.status_code #响应状态码
# r.raw #返回原始响应体,也就是 urllib 的 response 对象,使用 r.raw.read() 读取
# r.content #字节方式的响应体,会自动为你解码 gzip 和 deflate 压缩
# r.text #字符串方式的响应体... | true |
d33c3eedd5c40be5584927ae12d0a6f438ee6e9a | AdamZhouSE/pythonHomework | /Code/CodeRecords/2777/47961/315384.py | UTF-8 | 212 | 2.984375 | 3 | [] | no_license | a=int(input())
for i in range(0,a):
c=int(input())
d=[int(i) for i in input().split()]
d.sort()
if c%2==1:
print(d[c//2])
else:
nums=(d[c//2-1]+d[c//2])//2
print(nums)
| true |
2289877f828e7e94b2f5102b8dfe86fb849f1f9a | IanGallacher/dotfiles | /lib/.config/i3/py3status/repeat_rate.py | UTF-8 | 972 | 2.703125 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
import os
"""
Sets the repeat rate for differnt tasks - starcraft rapidfire or reasonable for coding
"""
class Py3status:
def __init__(self):
self._set_typing_mode()
def click_info(self):
template = 'Typing Mode: {label}'
data = { 'label': self.label }
r... | true |
60410239735c844c475386d046a6ae042b572aeb | jingmouren/etna-ts | /tests/test_analysis/test_outliers/test_hist_outliers.py | UTF-8 | 4,825 | 2.578125 | 3 | [
"Apache-2.0",
"MIT"
] | permissive | import numpy as np
import pytest
from etna.analysis.outliers import get_anomalies_hist
from etna.analysis.outliers.hist_outliers import compute_f
from etna.analysis.outliers.hist_outliers import hist
from etna.analysis.outliers.hist_outliers import v_optimal_hist
@pytest.mark.parametrize(
"series,bins_number,exp... | true |
44cdbc0591af441d723f14098ae40c1cdaa8be24 | shreyash0023/Python-Implementations | /Basics of Python/StringsTuplesAndLists.py | UTF-8 | 700 | 3.5625 | 4 | [] | no_license | L1 = ['Hello\tWorld','My\tName\tis\tKhan']
L2 = ['Hello World','My Name is Khan']
for x in L1:
x.split('\t')
L3 = []
'''List Comprehension for spliting with delimiter'''
L2 = [x.split(' ') for x in L2]
L1 = [x.split('\t') for x in L1]
L1_new = []
print L1
for x in range(len(L1)):
new_str =""
for y in r... | true |
9dc2569a024f9f43097cfc4e5fecbf49d3144361 | ethanjurman/robot-hat | /pattern_checker.py | UTF-8 | 1,062 | 3.3125 | 3 | [
"MIT"
] | permissive | import nltk
def lexico_syntax_translator(text, patterns):
tokenized = nltk.word_tokenize(text)
tags = nltk.pos_tag(tokenized)
print(tags)
# check each pattern
for p in patterns:
# check that the length of the tokens match the pattern
if len(p[0]) == len(tags):
print("pos... | true |
23f238ecdb20b21832b561daf71e77cab71b87fa | ROpsal/python-hangman | /button.py | UTF-8 | 2,201 | 3.90625 | 4 | [
"MIT"
] | permissive | # button.py
from graphics import *
class Button:
""" A button is a labled rectangle in a window.
It is activated or deactivated with the activate() and deactivate() methods.
The clicked(p) method returns true if the button is active and p is inside it."""
def __init__(self, win, center, width, height... | true |
4962ab30c171df6951c9074b56b74561b925f30e | sujiea/hackerrank-codility | /activityNotifications.py | UTF-8 | 973 | 3.5 | 4 | [] | no_license | # Complete the activityNotifications function below.
import bisect
def activityNotifications(expenditure, d):
count = 0
sub_array = sorted(expenditure[0:d])
m = medium(sub_array, d)
for i in range(d, len(expenditure)):
if expenditure[i] >= m * 2:
count += 1
insert_x = expen... | true |
74c13636576387286f623c0ed2dd987695890322 | jocagos/competitive | /UVa/UVa462.py | UTF-8 | 1,938 | 2.765625 | 3 | [] | no_license | import sys
lines = sys.stdin.readlines()
for line in lines:
suits = { "S":[[],0, False], "H":[[],0, False], "D":[[],0, False], "C":[[],0, False] }
s = line.split()
for t in s:
suits[t[1]][0].append(t[0])
handB = 0
for suit in suits:
if 'A' in suits[suit][0]:
... | true |
b8c105d6d81216b20e2363579559890385c63be6 | RiceProjectTeam/OpenRice-Crawler | /scripts/price_popularity_relationship.py | UTF-8 | 1,381 | 3.109375 | 3 | [] | no_license | import food_search_engine
import re
import matplotlib.pyplot as plt
#get MK restaurants
search_engine = food_search_engine.Food_Search_Engine("openrice_data.json")
filter_conditions = {"district": ["Mong Kok"]}
search_engine.filter(filter_conditions)
MK_restaurants_list = search_engine.query_result
#getting list of p... | true |
643d78daf721643f21611e1162806ca1c23c0b30 | edwang09/my_work | /python/european_option.py | UTF-8 | 4,849 | 3.25 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Fri Jan 15 22:27:43 2016
@author: mahone
"""
#
# This program define an object called eropean_option, that has attributes S0 (initial underlying level),
# K (option strike price), t (pricing date), M (maturity date), r (constant risk-free short rate),
# sigma (volatility), d (con... | true |
9236328b5caa26788746afd9204f8e5891902ba8 | spcl/dace | /tests/python_frontend/test_propagate_strict.py | UTF-8 | 755 | 2.9375 | 3 | [
"BSD-3-Clause",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | # Copyright 2019-2021 ETH Zurich and the DaCe authors. All rights reserved.
""" Test that the simplify argument to to_sdfg is propagated when parsing calls to other dace programs """
import dace
@dace
def nested_prog1(X: dace.int32[2, 2]):
return X + 1
@dace
def nested_prog2(X: dace.int32[2, 2]):
return ne... | true |
c3f9e50c2596151cafeba12a5094de901ae11935 | hanying32/Simple-Image-to-Speech-App | /SimpleImagetoSpeechApp.py | UTF-8 | 4,164 | 2.84375 | 3 | [] | no_license | #App Design
import OCR
import TTS
import key
import os,shutil
from kivy.app import App
from kivy.lang import Builder
from kivy.uix.screenmanager import Screen
from kivy.uix.button import Button
from kivy.core.audio import SoundLoader
from kivy.uix.gridlayout import GridLayout
from kivy.uix.anchorlayout import AnchorLay... | true |
18bfcd70b939b4f5ec7466e7bb96f374314063ab | TumTum23/The-Kyber-Project | /dpipe/match.py | UTF-8 | 646 | 3.296875 | 3 | [] | no_license | from itertools import combinations
def extract_values(d:dict):
""" We only want to compare lower level topics. """
h = []
for k in d.keys():
s = []
for j,v in d[k].items():
s.extend(v)
h.append((k, set(s)))
return h
def jaccard(d:dict, r=2):
""" Find the ja... | true |
e7f323740392b74e4b49f893ba019defd746801c | kcjuntunen/daily_reading | /test.py | UTF-8 | 466 | 2.515625 | 3 | [] | no_license | #!/bin/env python
import unittest
import daily_reading
class TestMethods(unittest.TestCase):
def test_list(self):
dr = daily_reading.DailyReading("biay.json")
x = dr.get_passages()
print("".join(x))
def test_print(self):
dr = daily_reading.DailyReading("mcheyne.json")
... | true |
2f142dc2609d04401fe183e31fe37b78fc1e6944 | Hameem1/Step-Detection-using-Machine-Learning | /dataset_operations/data_structs.py | UTF-8 | 6,374 | 3.203125 | 3 | [] | no_license | """
This module implements the data structures used to store the dataset_operations.
"""
import pandas as pd
from dataset_operations.dataset_manipulator import get_subjects_list, sensor_paths
from config import FILE_STATUS_MESSAGES, STORAGE, Fs, Path
# Every label in "labels" contains data which belongs to it's 'Cla... | true |
d3f2f0008b2413e028b99ed0b1fe891b28347da7 | mengyx-work/CS_algorithm_scripts | /leetcode/LC_1_two_sum.py | UTF-8 | 709 | 3.09375 | 3 | [] | no_license | class Solution:
def twoSum(self, nums, target):
numsDict = {i:elem for i, elem in zip(range(len(nums)), nums)}
indxList = sorted(numsDict.items(), key=lambda x: x[1])
indx1 = 0
indx2 = len(nums)-1
while indx1<indx2:
if (indxList[indx1][1] + indxList[indx2][1])==t... | true |
a242969c8f0e3e4876e305917d60b670ee2b8b65 | savtanet/savtaapp | /Server/Clients/Connection.py | UTF-8 | 618 | 3.15625 | 3 | [] | no_license | import socket
def BindToPort(port):
try:
# Create a TCP/IP socket
listening_sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
# Binding to port
server_address = ('', port)
listening_sock.bind(server_address)
except Exception as e:
print("Error: ", e)
... | true |
48a575889ee61327086f9c4686fef4185c4e3778 | yujokang/APEx | /analysis/run_analyses.py | UTF-8 | 2,489 | 2.96875 | 3 | [] | no_license | # a simple script for running multiple analyses of AutoEPExParser,
# and combining them into AutoEPExSum, and generating an error specification
from auto_epex_parser import AutoEPExParser, AutoEPExSum, ErrorSpec
from time import time
from sys import argv, path
from file_utilities import get_extensionless_name, get_dir... | true |
0bb1f1e6e64249c291230528ccdcf23f1adf693a | meihuisu/UCVM-reallyOld | /ucvm/bin/ucvm_plot_cross_section | UTF-8 | 9,089 | 2.515625 | 3 | [
"LicenseRef-scancode-warranty-disclaimer",
"Apache-2.0"
] | permissive | #!/usr/bin/env python
"""
Defines the utility that walks the user through plotting a cross section.
Copyright 2017 Southern California Earthquake Center
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License... | true |
bfb13a36946c9990267af7d98d4ade5c68f90fdc | Tavial/cursophyton | /Receta6Bienvenida/main.py | UTF-8 | 1,806 | 3 | 3 | [] | no_license | '''
Módulo principal del Mensaje de Bienvenida
'''
from PyQt5.QtWidgets import QDialog, QApplication, QMessageBox
import sys
from ventanas import DialogoSaludo
class DialogoSaludoAplicacion (QDialog): # Creamos nuestra clase que hereda de QDialog
def __init__(self): # Definimos el método constructor de... | true |
e7d836f51579b1cdbec3ce2e2c381feafefc884f | RhythmIIITD/BDMH | /preprocessing_analysis/Amino_Acid_frequency.py | UTF-8 | 3,354 | 3.25 | 3 | [] | no_license | #Code snippet for finding the average whole amino acid composition of Non-ACPs.
#(The same code was used to get the whole amino acid composition of ACPs and
#AMPs by changing the dataset file that was opened using the file handle.
from collections import Counter
countpep=0
#Total count gives the count of the number of ... | true |
d319031afe44910b2bd7603a6eada7b52b82f75a | projectinnovatenewark/csx | /Students/Semester1/lessons/2_python/11_conditions/11_conditionstodo.py | UTF-8 | 1,102 | 4.625 | 5 | [] | no_license | """
Practing using condionals
"""
# TODO: Section 1
# Below are 3 variables, "num1", "num2", and "num3". Use these three variables for the following
# exercises.
num1 = 82
num2 = 100
num3 = -45
# Write a condition that prints "num1 is greater than num3" if num1 is greater than num3.
# If that condition isn't true, ... | true |
f74c508a1e79c515cdd85108ae9aad45ccf1eb60 | FabioParaiso/speech_correction | /speech/visualization.py | UTF-8 | 954 | 3.265625 | 3 | [] | no_license | import seaborn
import matplotlib.pyplot as plt
def plot_spectrogram(spectrogram):
"""Plot the multiple channels of the supplied mel spectrogram
Parameters
----------
mel_spectrogram : torch.Tensor
Tensor with all the information of the mel spectrogram
"""
number_channels = spe... | true |
853a265c4649fdd9de0f4ada145afe05d16c377f | rachel-min/Fin_Forecast | /cls_cfo.py | UTF-8 | 2,650 | 3.21875 | 3 | [] | no_license | import pandas as pd
class cfo():
def __init__(self, date_start, freq, date_end, scen):
self._date_start = date_start
self._freq = freq
self._date_end = date_end
self._scenario = scen
self._dates = None
self._date_dict = None
self._fib_dict = {}
def lo... | true |
2d020e98ab89b320ddab4f7be7c725386565e7df | phoenixlch/study | /small/list_01.py | UTF-8 | 161 | 3.8125 | 4 | [] | no_license | #!/usr/bin/env python
namelist=[]
print 'Please enter the five names:'
for i in range(5):
name=raw_input()
namelist.append(name)
print "The name is:",namelist | true |
e466f73bc75792b67a7d39fe53185090af36e70e | Dyr-El/advent_of_code_2017 | /psgandalf-python/day06/1/day06-1.py | UTF-8 | 524 | 3.109375 | 3 | [] | no_license | import re
turns = 0
banks = []
states = []
cursor = 0
tempcursor = 0
dup = False
file = open('input.txt', 'r')
input = file.readline()
row = re.sub('\s+', ' ', input)
banks = map(int, row.split(' '))
states.append(banks[:])
while not dup:
maxv = max(banks)
cursor = banks.index(maxv)
banks[cursor] = 0
for counte... | true |
817e07eeaf1bd701c85446bda1ca80ddccd0d266 | xuelang201201/FluentPython | /04_文本和字节序列/fp_21_使用surrogateescape错误处理方式.py | UTF-8 | 830 | 4.125 | 4 | [] | no_license | # 在 Unix 衍生平台中,这些函数使用 surrogateescape 错误处理方式以避免遇到意外字节序列时卡住。
import os
print(os.listdir('.')) # 列出目录里的文件,有个文件名中包含非 ASCII 字符。
print(os.listdir(b'.')) # 假设我们不知道编码,获取文件名的字节序列形式。
pi_name_bytes = os.listdir(b'.')[3] # pi_names_bytes 是包含 π 的文件名。
# 使用 'ascii' 编解码器和 'surrogateescape' 错误处理方式把它解码成字符串。
pi_name_str = pi_... | true |
c8fcab6c7a0260d50d01a6cb422c08659034c263 | yashoss/CraigsReList | /cl_renew.py | UTF-8 | 1,637 | 2.59375 | 3 | [] | no_license | import time
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.common.exceptions import TimeoutException
from selenium.common.exceptions import ElementNotV... | true |
68a261ad335c65929ce172d6d6d65507cb262718 | xdlgj/chaoboliu | /练习5.py | UTF-8 | 1,790 | 4.4375 | 4 | [] | no_license | # 一.设一个车类
class Car():
# 二.设初始化函数 放最前 括号后面的参数 首位必须self 然后跟后面的值
def __init__(self,name,luntai,color,men):
# 三.传值
self.name=name
self.color=color
self.luntai=luntai
self.men=men
# 四.设魔法方法__str__ 他可以将变量abc里的值 用return打印出来 不用在实例化里写print步骤 所以是个不错的方法
def __str__(self):
abc="您好,车辆制造完毕"+"\n车名:"+self.name+ "车辆的颜色是:"... | true |
ea5e5375a1b8796dbf276ab46dafcf8d1fc45386 | jhonvo/UsersCR | /users_app/models/users.py | UTF-8 | 1,336 | 3.15625 | 3 | [] | no_license | from typing import ClassVar
from users_app.config.mysqlconnection import connectToMySQL
class User:
def __init__(self,id,first_name,last_name,email):
self.id = id
self.first_name = first_name
self.last_name = last_name
self.email = email
@classmethod
def get_all_users (cls)... | true |
252c29d85faeb7b21e523061ff3e134441b73bd5 | Keshav1506/competitive_programming | /Dynamic_Programming/005_geeksforgeeks_Longest_Common_Substring/Solution.py | UTF-8 | 3,293 | 3.984375 | 4 | [] | no_license | #
# Time :
# Space :
#
# @tag : Dynamic Programming
# @by : Shaikat Majumdar
# @date: Aug 27, 2020
# **************************************************************************
# Geeks For Geeks : Longest Common Substring
#
# Description:
#
# Given two strings X and Y. The task is to find the length of the longest com... | true |
c4e9f6e335fa168175f5e5b8bf42d3dcdb16c8d4 | NeilWangziyu/Leetcode_py | /maxWidthRamp.py | UTF-8 | 1,746 | 3.515625 | 4 | [] | no_license | class Solution(object):
def maxWidthRamp(self, A):
"""
:type A: List[int]
:rtype: int
"""
if not A:
return 0
if len(A) < 2:
return 0
res = 0
for i in range(len(A)):
for j in range(i+1, len(A)):
if A[i... | true |
a8f48cc0e3b059f1026afb151e76ba95affe976e | yishishizi/offer-code | /58.py | UTF-8 | 368 | 3.1875 | 3 | [] | no_license | class Solution:
def maxProfit(self, prices):
if prices==[]:return 0
vals,minprice=0,int(1e9)
for i in range(len(prices)):
vals=max(prices[i]-minprice,vals)
minprice=min(prices[i],minprice)
return vals
if __name__ == "__main__":
S=Solution()
... | true |
4cf9988fc67481e61eecc251efb8a3fe78b348b9 | dragosprju/sysinfo | /inc/sysinfo/engine.py | UTF-8 | 401 | 2.671875 | 3 | [] | no_license | class Engine(object):
def __init__(self, window, tab):
self.window = window
self.tab = tab
self.bodies = []
self.functions = []
def initialize(self):
pass
def loadPredefined(self):
pass
def createRow(self, header, function):
body = self.tab.addRow(header, "...")
self.bodies.append(body)
self.... | true |
04940fd9bd78e8e29f34b63c8e892c5154058324 | cquinone/Practice | /InterviewPrep/CTCI92.py | UTF-8 | 713 | 3.796875 | 4 | [] | no_license | """
Imagine a robot sitting on the upper left corner of an X by Y grid. The robot
can only move in two directions: right and down. How many possible paths are
there for the robot to go from (0,0) to (X,Y)?
"""
def directions(grid):
return dirhelper(grid,0,0)
def dirhelper(grid,x,y):
if ((x>len(grid)-1) or (y... | true |
eda0ee3056fbcbc21cd1373e4d27978a2e3d61ff | Viole-Grace/Information_Retrieval | /crawler.py | UTF-8 | 2,429 | 3.15625 | 3 | [] | no_license | from __future__ import print_function
from bs4 import BeautifulSoup as SOUP
from Feeling import get_emotion
import re as regex
import requests as HTTP
import math
import networkx as nx
def target(emotion):
url = ""
if emotion == "disgust":
url = 'http://www.imdb.com/search/title?genres=musical&ti... | true |
99bcc3f70a6192ea10b3e1f350df5de4639f767c | nosy0411/Deep-learning-project | /stock deep learning/4-6.K-Means.py | UTF-8 | 4,519 | 3.21875 | 3 | [
"MIT"
] | permissive | # K-Means clustering
# 참고 자료 : Jordi Torres, First contact with tensorflow (page 27)
#
# 2018.08.21, 아마추어퀀트 (조성현)
# ----------------------------------------------------------------
import tensorflow as tf
import matplotlib.pyplot as plt
from matplotlib.pyplot import cm
import numpy as np
def createData(n):
xy = []... | true |
18829e4cc100bae8ae2a70cab3f32fda47d516a3 | jsafra/blackjack | /tests/validate_test.py | UTF-8 | 2,923 | 3.40625 | 3 | [] | no_license | import unittest
from blackjack_cli import validate, rule_odd, rule_greater_equal, rule_pattern_match
class ValidateTest(unittest.TestCase):
def test_no_ruleset_validation(self):
"""If no ruleset is given then anything is valid"""
result = validate("Anything")
self.assertEqual(True, result)... | true |
b969f2baaa52d5bee9f2965f978b34c597188498 | Anirban2404/Python_Coursera | /Geo_JSON.py | UTF-8 | 3,178 | 3.734375 | 4 | [] | no_license | # Calling a JSON API
# In this assignment you will write a Python program somewhat
# similar to http://www.pythonlearn.com/code/geojson.py.
# The program will prompt for a location, contact a web service
# and retrieve JSON for the web service and parse that data, and
# retrieve the first place_id from the JSON. A pla... | true |
5a91cd00d56d1adc2af1c4462f626a18f95f16b9 | Amit06/Codes-Mix- | /CODEFORCES/364/B.py | UTF-8 | 565 | 2.71875 | 3 | [] | no_license | n,m=map(int,raw_input().split())
x=[0 for _ in range(n)]
y=[0 for _ in range(n)]
noc,nor=0,0
z=[]
count=n**2
i=0
for col in range(m):
p,q=map(int, raw_input().split())
if x[p-1]==0 and y[q-1]==0:
count-=2*n-1
count+=noc+nor
noc+=1
nor+=1
x[p-1]+=1
y[q-1]+=1
... | true |
ba3c02d039c0874e037c4b3b77f16dcf7b08aeab | ruan916/memory_puzzle | /script.py | UTF-8 | 4,009 | 2.859375 | 3 | [] | no_license | from tkinter import *
import random
from tkinter import messagebox
root = Tk()
root.title('Memory Puzzle')
root.geometry("600x600")
global winner
winner = 0
matches = [1,1,2,2,3,3,4,4,5,5,6,6]
random.shuffle(matches)
my_frame = Frame(root)
my_frame.pack(pady=10)
count = 0
answer_list = []
answer_dict = {}
def res... | true |
aab57dd1ddc12d5ae98b7fd5e9ebbc68676e4ae1 | lizzzcai/leetcode | /python/array/0041_First_Missing_Positive.py | UTF-8 | 3,911 | 4.21875 | 4 | [] | no_license | """
21/09/2019
41. First Missing Positive - Hard
Tag: Array, in-place
Given an unsorted integer array, find the smallest missing positive integer.
Example 1:
Input: [1,2,0]
Output: 3
Example 2:
Input: [3,4,-1,1]
Output: 2
Example 3:
Input: [7,8,9,11,12]
Output: 1
"""
from typing import List
class Solution:
d... | true |
c3d5408ee43239bf889f51f28a00e520963ea873 | uabrc/rabbitmq_agents | /prod_rmq_agents/user_reg_event_logger.py | UTF-8 | 911 | 2.671875 | 3 | [] | no_license | #!/usr/bin/env python
import json
from rc_rmq import RCRMQ
task = "user_reg_event_log"
# Instantiate rabbitmq object
rc_rmq = RCRMQ({"exchange": "RegUsr", "exchange_type": "topic"})
# Define your callback function
def log_user_reg_events(ch, method, properties, body):
# Retrieve message
msg = json.loads(bo... | true |
6a5221658a29055b98a8ba4ba10b51a8670a3dde | akhilnair111/100DaysOfCode | /Week4/Cyborg Cantina RBC/Cyborg_Cantina.py | UTF-8 | 2,069 | 3.0625 | 3 | [] | no_license | from collections import Counter
from responses import responses, blank_spot
from user_functions import preprocess, compare_overlap, pos_tag, extract_nouns, compute_similarity
import spacy
word2vec = spacy.load('en')
exit_commands = ("quit", "goodbye", "exit", "no")
class ChatBot:
#define .make_exit() below:
d... | true |
d2155fd9fdc8e645a09f7a081bfa75aba77be0a0 | MinjinP/ops_20201 | /py_lab/fibo_num.py | UTF-8 | 391 | 3.59375 | 4 | [] | no_license | #!/usr/bin/python3
import sys
if __name__=='__main__':
num = int(input("fibonacci number? "))
fiboList = [0, 1]
if (num>2) :
for i in range(2, num+1):
y = fiboList[i-1]+fiboList[i-2]
fiboList.append(y)
for i in range(1, num+1) :
print(fiboList[i], ... | true |
2e8312f74c90cd3d46825c60080f2b9c0a975739 | TheDoctorTimeLord/defragmenter | /error_in_fat.py | UTF-8 | 12,618 | 2.828125 | 3 | [] | no_license | import random
import ImageTools
from FileSystem import FileSystem
from enums import TypeOfFAT
class ErrorDetector:
"""
Класс, необходимый для выявляения ошибок и их исправления
"""
def __init__(self, fat_processor: ImageTools.FatProcessor):
self._fat_proc = fat_processor
self.differen... | true |
89657ebc7722d5113d44a94475d1cda642ca52ca | nikhithagoli/basic | /cspp1-practice/m5/p2/square_root.py | UTF-8 | 405 | 3.9375 | 4 | [] | no_license | "'to find the square root of the given number using approximation method'"
def main():
"""using approximation method"""
given_number = int(input())
epsilon = 0.01
increment = 0.1
guess_value = 0.0
while abs((guess_value ** 2) - given_number) >= epsilon and guess_value <= given_number:
gu... | true |
cce40564221eebf5092c5b1b0f2c25cc20bcaef6 | sravya-19/HackerRank | /coin_change_iter.py | UTF-8 | 471 | 3.125 | 3 | [] | no_license | def coin_count(s, m, n):
table = [[0] * m for i in range(n + 1)]
for i in range(m):
table[0][i] = 1
for i in range(1, n + 1):
for j in range(m):
x = table[i - s[j]][j] if i - s[j] >= 0 else 0
y = table[i][j - 1] if j >= 1 else 0
table[i][j] = x + y
return table[n][m - 1]
if __name__... | true |