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 |
|---|---|---|---|---|---|---|---|---|---|---|
0d2fa295634cda825c0949941b17a14cc10fc81b | DaGutn/david-praktikum | /Documents/Projects/david-praktikum/Geiger-Mueller-Zaehlrohr/Geiger_Mueller_Zaehlrohr.py | UTF-8 | 2,414 | 3.046875 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
import uncertainties.unumpy as unp
from uncertainties import ufloat
from uncertainties.umath import *
from uncertainties.unumpy import (nominal_values as noms, std_devs as stds)
from scipy.optimize import curve_fit
import scipy.constants as const
def f(x, a, b):
r... | true |
d51ae08316b502274c335afee1d7601cfa64f985 | ivanshaba/Entrilo | /server/cost_optimizer.py | UTF-8 | 11,681 | 2.9375 | 3 | [
"MIT"
] | permissive | from amadeus import Client, ResponseError
import networkx as nx
import json
import time
import matplotlib
amadeus = Client(
client_id = '01kBKVCiSvkcgZgC33ASxyiDGMXHC3te',
client_secret = '6zcvK3TOsVqWNIGc'
)
# returns a set of source, dest pairs for every combo of source and destination
def get_sour... | true |
20cd6d6788f846d107bcb8c69829e3d0b6512429 | Ruthvik2127/IEEE-CIS-Fraud-Detection-1 | /src/hyperparameter_tuning.py | UTF-8 | 4,393 | 2.6875 | 3 | [] | no_license | import lightgbm as lgb
from sklearn.model_selection import KFold
from hyperopt import tpe, Trials, STATUS_OK, hp, fmin
from sklearn.metrics import roc_auc_score
import warnings
warnings.filterwarnings("ignore")
def objective(hyperparameters):
# Using early stopping to find number of trees trained
if 'n_estimat... | true |
e8b64ca11862850ff26f2ddae141dfaf4e03565b | ktatineni/GTechCode | /03-Python/3/Activities/08-Par_WrestlingWithFunctions/Unsolved/wrestling_functions.py | UTF-8 | 902 | 3.78125 | 4 | [] | no_license | import os
import csv
# Path to collect data from the Resources folder
# Define the function and have it accept the 'wrestlerData' as its sole parameter
# Find the total number of matches wrestled
# Find the percentage of matches won
# Find the percentage of matches lost
# Find the percentage of matches drawn
# P... | true |
caaf939f55d8440df8ce0c7ffeda4a7756846ae5 | biobricks/bionet-new | /examples/python_json_rpc_client/stream.py | UTF-8 | 465 | 2.71875 | 3 | [] | no_license | #!/usr/bin/env python
from jsonrpc_requests import Server, ProtocolError
# example of using the jsonrpc_requests library
def main():
# bionet nodes have a json_rpc endpoint at /rpc
bionet = Server('http://localhost:8000/rpc')
try:
res = bionet.searchVirtuals('t')
print "foo() said: %s" %... | true |
0ec2272862e6dfb1d6db4c7b1e2b357c2a3766cf | hijongyoon/digital-image-processing | /report2/assignment4_6.py | UTF-8 | 1,160 | 2.890625 | 3 | [] | no_license | import cv2
import numpy as np
def check(num):
if num > 255:
num = 255
elif num < 0:
num = 0
return num
def make_LPF(img, n):
img = np.pad(img, pad_width=1, mode='constant', constant_values=0) # 0 패딩
unsharp_img = np.zeros((column, row), dtype=np.uint8)
high_boost_img = np.ze... | true |
193b2a5a9be85751f7dd77d6c0402471a4f4c3f2 | anu-ka/coding-problems | /Python/shortest_completing_word.py | UTF-8 | 2,711 | 3.828125 | 4 | [
"MIT"
] | permissive | # https://leetcode.com/problems/shortest-completing-word/
# Given a string licensePlate and an array of strings words, find the shortest completing word in words.
# A completing word is a word that contains all the letters in licensePlate.
# Ignore numbers and spaces in licensePlate, and treat letters as case insensiti... | true |
aafff0176861b3dd9ade9d2d74493e20359c9c2e | joelodom/monty | /monty.py | UTF-8 | 747 | 4.15625 | 4 | [
"MIT"
] | permissive | '''Simulate the Monty Hall problem.'''
import random # good enough for this simulation
ITERATIONS = 10000
SWITCH = True # change this to false if you don't want the player to switch
wins = 0 # the number of cars won
for i in range(ITERATIONS):
# initialize the iteration
car = random.randint(0, 2)
#... | true |
366a513727c8492fec79c61ff543d8ed97b79a2a | 99649952/practice | /day5/credit_card.py | UTF-8 | 4,029 | 2.859375 | 3 | [] | no_license | #!/usr/bin/env python
#coding:utf-8
__author__ = 'bobo'
import json,time,opt_log
#time_now=(time.strftime('%Y-%m-%d %H:%M:%S'))
#account={'000000001':['lxb',21,'m',15000,15000],
# '000000002':['liao',22,'w',20000,20000]}
class credit_card(object): #信用卡类
def __init__(self,account_id):#初始化一些信用卡信息
wi... | true |
21ebcb15a7f5e13b0845936f19ad18fcb84085e5 | AndRossi/Kelpie | /scripts/experiments/end_to_end/plot_end_to_end_table.py | UTF-8 | 8,586 | 2.515625 | 3 | [] | no_license | import sys
import os
import argparse
import matplotlib.pyplot as plt
parser = argparse.ArgumentParser(description="Model-agnostic tool for explaining link predictions")
sys.path.append(
os.path.realpath(os.path.join(os.path.abspath(__file__), os.path.pardir, os.path.pardir)))
parser.add_argument("--mode",
... | true |
7099d89c4f44fb921f74d3946a563e4978773e4e | brandonccurran/Past-Coding-Projects---12-23-18-Update | /Strings Carver/strings.py | UTF-8 | 2,188 | 3.609375 | 4 | [] | no_license |
import argparse
def print_strings(file_obj, encoding, min_len):
temp_string = ""
while True:
# read in the bytes
if encoding == 's':
bytes = file_obj.read(1)
else:
bytes = file_obj.read(2)
# end of file; print strings if applicable
if not byt... | true |
2e3c617f0d8c9da4abebdc598a201d6dd4a51bb7 | sravi97/I210_Information_Infrastructure1 | /HW 1.py | UTF-8 | 2,284 | 3 | 3 | [] | no_license | Python 3.7.0 (v3.7.0:1bf9cc5093, Jun 26 2018, 23:26:24)
[Clang 6.0 (clang-600.0.57)] on darwin
Type "copyright", "credits" or "license()" for more information.
>>> -7 + -6 + -5 + -4 + -3 + -2 + -1
-28
>>> ((17*9) + (24*10) + (21*11) + (27*12)) / 89
10.651685393258427
>>> 2 ** -20
9.5367431640625e-07
>>> 4356 / 61
71.4... | true |
bb63dd6933bcbde74bda8b9716e8d851a4e36066 | Julio-Cezar-Candido/CursoemVideo-Python-Exerc | /Exercícios/ex086.py | UTF-8 | 430 | 3.484375 | 3 | [
"MIT"
] | permissive | matrix = [], [], []
for v in range(0, 9):
if v <= 2:
matrix[0].append(int(input(f'Digite um valor para [0, {v}]: ')))
elif 5 >= v >= 3:
matrix[1].append(int(input(f'Digite um valor para [1, {v - 3}]: ')))
else:
matrix[2].append(int(input(f'Digite um valor para [2, {v - 6}]: ')))
prin... | true |
a8d060d7a5a7754ace5cd176d9dc82034a6bb850 | RiyazUlHaque/CALENDAR_APPLICATION | /CALENDAR.py | UTF-8 | 607 | 3.40625 | 3 | [] | no_license |
import calendar
from tkinter import *
gui = Tk()
gui.title("CALENDAR_RIZ")
def cal():
year = e1.get()
month = e2.get()
cal_x = calendar.month(int(year),int(month),w = 2, l = 1)
print (cal_x)
cal_out = Label(gui, text=cal_x, font=('courier', 12, 'bold'), bg='lightblue')
cal_out.pa... | true |
3ba72aa4b2f2b49eb5fc2d7f24c4ba0f3bd5e2b5 | anumsh/QUIZ_IN_PYTHON | /fill_in_the_blank.py | UTF-8 | 4,941 | 4.375 | 4 | [] | no_license | #fill_in_the_blanks QUIZ
# here I have made 4 functions and 3 prompt
# 1st prompt to select difficulty level and 2nd is number of guesses user want to have and 3rd is for filling the correct answer
# 1st function is : difficulty_level(), 2nd function is show_answer(), 3rd is show_question() and 4th is fill_in_the_bla... | true |
796195d98f2992b30dec6cff9b4d4f6e2373f66c | lfbessegato/Python_Basico_Avancado | /Secao02 - Data Types/Exemplo01_Boolean.py | UTF-8 | 183 | 3.328125 | 3 | [] | no_license | myBoolean = True
print(type(myBoolean))
myBoolean = False
num1 = 8
num2 = 4
print(num1 > num2)
print(num1 < num2)
print(num1 == num2)
num2 = 8
print(num1 == num2)
print(num1 != num2) | true |
1f9ac15c4127b6f55107559c5b2e126b1f2940bc | AugurProject/augur | /packages/augur-core/tests/reporting/test_universe_fee_calculations.py | UTF-8 | 24,495 | 2.5625 | 3 | [
"MIT",
"GPL-3.0-or-later",
"GPL-1.0-or-later",
"LGPL-2.1-or-later",
"LGPL-2.0-or-later",
"LicenseRef-scancode-warranty-disclaimer",
"GPL-3.0-only"
] | permissive | from pytest import fixture, mark
from reporting_utils import proceedToInitialReporting, proceedToNextRound, proceedToDesignatedReporting
from utils import BuyWithCash, AssertLog
from decimal import Decimal
ONE = 10 ** 18
@mark.parametrize('numWithCondition, targetWithConditionPerHundred, previousAmount, expectedValue... | true |
9d6ca71402c6005d9f88e07e40bbe62080b6cfba | Skjperez/address | /contactlist/views.py | UTF-8 | 3,457 | 2.609375 | 3 | [] | no_license | from django.shortcuts import render, redirect
from .models import Contact
from .forms import ContactForm
from django.http import HttpResponse, HttpResponseRedirect, Http404
# Create your views here.
def ListContacts(request):
if request.user.is_authenticated is True:
user = request.user
else:
... | true |
53ec13179c640f2f0312adf94da6df1307bc3dae | wontaechoi/algorithm | /BOJ/나무 재테크.py | UTF-8 | 1,640 | 2.703125 | 3 | [] | no_license | dx = [-1, -1,-1,0,0,1,1,1]
dy = [-1, 0,1,-1,1,-1,0,1]
def year(ground, trees):
global N, eat
new_trees = [[[] for _ in range(N)] for __ in range(N)]
new_ground = [[0 for _ in range(N)] for __ in range(N)]
for x in range(N):
for y in range(N):
if trees[x][y]:
trees[x]... | true |
de802048ba360e016f7bf12a5683f72f8c26ac33 | hmooy/Search-COMP90054 | /search/search.py | UTF-8 | 13,838 | 3.46875 | 3 | [] | no_license | # search.py
# ---------
# Licensing Information: You are free to use or extend these projects for
# educational purposes provided that (1) you do not distribute or publish
# solutions, (2) you retain this notice, and (3) you provide clear
# attribution to UC Berkeley, including a link to http://ai.berkeley.edu.
#
# At... | true |
183418049742ea6d9519a13ef1027f8ae59d30ac | MichelangeloZ/python | /python/unittest_2.py | UTF-8 | 2,083 | 3.984375 | 4 | [] | no_license | # _*_coding:utf-8 _*_
# assertEqual(a, b) 核实a == b
# assertNotEqual(a, b) 核实a != b
# assertTrue(x) 核实x 为True
# assertFalse(x) 核实x 为False
# assertIn(item , list ) 核实 item 在 list 中
# assertNotIn(item , list ) 核实 item 不在 list 中
# 测试类
import unittest
class Employee():
def __init__(self, name):
self.name = ... | true |
59a53740cecb71ffbc1ae4baf5bcb0aaecbd9851 | sudoaptgetupgrade/firstai | /main.py | UTF-8 | 988 | 2.9375 | 3 | [
"MIT"
] | permissive | from keras.models import Sequential
from keras.layers import Dense
import numpy
import pandas as pd
numpy.random.seed(7)
#Input the amount of training needed
epochs = input("How many epochs??: ")
batchsize = input("How big of a batch size??: ")
epochs = int(epochs)
batchsize = int(batchsize)
#load pima indians datas... | true |
28260a285e356c56acdfa0b8be3eb4aebf394aac | mjdavy/spider | /downloader.py | UTF-8 | 386 | 2.546875 | 3 | [] | no_license |
from spider import Spider
runningDataStore = '\\\\monster\\RunningData\\'
spider = Spider()
spider.output_folder = runningDataStore
for url in spider.get_base_urls():
filter = url.rsplit('.')[-2][3:]
race_urls = spider.process_url(url,filter)
for race_url in race_urls:
fullUrl = f"http://www.co... | true |
1afde09f471f269d269fa3cabc8acc0499d76f26 | x-peter-alexander-x/grundlagenPython2 | /variable.py | UTF-8 | 698 | 4.34375 | 4 | [] | no_license | #Variable
a = 10
b = 20
aktion = input("Welche Funktion? +/-/*/:")
print("Funktion",aktion,"wird ausgefuehrt")
zahl = input("Zahl 1?")
zahl2 = input("Zahl 2 ?")
zahl = int(zahl)
zahl2 = int(zahl2)
summe = zahl+zahl2
differenz = zahl - zahl2
multiplikation = zahl*zahl2
if(aktion == ":"):
if(zahl2 == 0):
... | true |
15f6d443fe3ba892bef9023b8193dfb146069fdc | zranguai/python-learning | /day27/作业.py | UTF-8 | 1,698 | 3.578125 | 4 | [] | no_license | # 学生选课系统:
# https://www.cnblogs.com/Eva-J/articles/9235899.html
# 1.把类创建出来
# 2.把属性写上
# 3.把函数名写上
# 接下来要完善的两个地方
# 用户的登入---自动识别出身份
# 思考:登入之后从那个功能写起
class Course(object):
def __init__(self, name, price, cycle):
self.name = name
self.price = price
self.cycle = cycle
class Student(object):
... | true |
4862bc9c12dc9e9ee907f83129e8cc3feec3630e | sixty-nine/rpg | /tests/testBox.py | UTF-8 | 2,071 | 3.453125 | 3 | [] | no_license | import unittest
from map.geometry import Box, Directions
from map import Grid
class BoxTestCase(unittest.TestCase):
def testBox(self):
b = Box(5, 10, 10, 20)
self.assertEqual(5, b.x1)
self.assertEqual(10, b.y1)
self.assertEqual(14, b.x2)
self.assertEqual(29, b.y2)
... | true |
718623a3310f8fb892dc6a8ddfd43f524697591d | SaiNikhita/TalentSprint | /ambiguous date.py | UTF-8 | 155 | 3.296875 | 3 | [] | no_license | def is_ambiguous(date):
date = date.split("/")
return int(date[0]) < 12 and int(date[1]) < 12
date = "01/02/1999"
print(is_ambiguous(date)) | true |
0a7f9b11e8fbff4962a4edb09599a1d0727b7e53 | Preshit23/MDD | /Major/GUI3.py | UTF-8 | 4,639 | 2.59375 | 3 | [] | no_license | import tkinter as tk
from PIL import ImageTk,Image
from tkinter import filedialog
path = "path"
from PIL import Image,ImageTk
import tkinter.font as font
from testing import SName
from search import search
species = "species"
def GUImaker():
#intial steps
window = tk.Tk()
window.title("Identification of A... | true |
3e3df22d5af059b1fec523f734a5d1fa5bad379f | FangyangJz/Python_advance_skill | /番外篇_python高级编程/P3_对象引用_可变性和垃圾回收_元类编程/c6_2__getattr__getattribute__.py | UTF-8 | 900 | 3.21875 | 3 | [] | no_license | # !/usr/bin/env python3
# -*- coding:utf-8 -*-
'''
created by Fangyang on Time:2018/9/15
'''
from datetime import date
__author__ = 'Fangyang'
# __getattr__ , 在查找不到属性的时候调用
# __getattibute__ , 无论访问 存在的 还是 不存在的 属性, 都调用这个, 把持了属性访问的入口
# 注意啊, __getattribute__ 尽量不要重写, 写不好容易崩溃
class User:
def __init__(self, name, birth... | true |
7f9fc2d95609d70b4cdb2a2fae1f4593343835a3 | gciruelos/metnum-tp3 | /src/data/graficos.py | UTF-8 | 2,103 | 2.765625 | 3 | [] | no_license | import numpy as np
from pylab import *
from math import *
dic_met = {'0': 'Nearest Neighbour',
'1': 'Interpolacion Lineal',
'2': 'Splines Cubicos (4)',
'3': 'Splines Cubicos (8)',
'4': 'Splines Cubicos (12)'}
dic_ecmlim ={'darthvader': 700.0,
'ff6': 4000.0,
... | true |
d65c97ea1af0c7ab39e15a253a9bbfda30a1a1fb | linannn/LeetCode_Solution | /160.相交链表.py | UTF-8 | 1,019 | 3.078125 | 3 | [] | no_license | #
# @lc app=leetcode.cn id=160 lang=python3
#
# [160] 相交链表
#
# @lc code=start
# Definition for singly-linked list.
# class ListNode:
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution:
def getIntersectionNode(self, headA: ListNode, headB: ListNode) -> ListNode:
... | true |
a208e2d822b918493c1ef9a1398ca2a8dc036864 | jaibheem/trash | /practice/ex10.py | UTF-8 | 254 | 3.140625 | 3 | [] | no_license | tabby_cat = "\tI am tabbed in."
persian_cat = "I'm split \non a line"
backslash_cat = "I'm \\ a \\ cat "
fat_cat = """
I'll do a list:
\t* Cat food
\t* fishes
\t* catnip \n\t Grass
"""
print tabby_cat
print persian_cat
print backslash_cat
print fat_cat | true |
b4f2b95293a0c3d3a15d63c8d83334cbfed38fb1 | dbarga6/appMarkDigital | /app/nlp/action/analisisSentNLTK.py | UTF-8 | 2,575 | 2.796875 | 3 | [] | no_license | import nltk
nltk.download('vader_lexicon') # Obligatorio para usar SentimentIntensityAnalyzer
from nltk.sentiment.vader import SentimentIntensityAnalyzer
sid = SentimentIntensityAnalyzer()
import hunspell # Nos ayudará con los diccionarios en español
# Buscar diccionarios en carpeta de instalacion
# Más diccionarios d... | true |
d1d28b8be8e4794f888dcf67f452e4cadc153129 | tommybutler/mlearnpy2 | /home--tommy--mypy/mypy/lib/python2.7/site-packages/pybasicbayes/distributions/binomial.py | UTF-8 | 4,394 | 2.78125 | 3 | [
"Unlicense"
] | permissive | from __future__ import division
from builtins import zip
__all__ = ['Binomial']
import numpy as np
import scipy.stats as stats
import scipy.special as special
from warnings import warn
from pybasicbayes.abstractions import GibbsSampling, MeanField, \
MeanFieldSVI
class Binomial(GibbsSampling, MeanField, MeanFie... | true |
0f0acb2e957c6db31b391c42a9e2a0a76218a648 | henrywkk/python-pandas | /parent_id_lookup/parent_id_lookup.py | UTF-8 | 2,370 | 3.359375 | 3 | [
"MIT"
] | permissive | ##################################
# Merge multiple rows from same dataframe based on parent id
#
# I have a dataframe where some rows have a parent-child relationship. For example, 1002 is the parent of 1003, 1003
# is the parent of 1004. I want to merge the rows to keep only those rows without child item. However, so... | true |
1f07e943a7effdf3f8098ad4e1f831fe1b7d51c2 | ouroboroscoding/ChainedXML | /ChainedXML.py | UTF-8 | 6,625 | 3.09375 | 3 | [
"Apache-2.0"
] | permissive | # coding=utf8
## ChainedXML module
#
# Wraps ELementTree classes into a more easily usable interface
#
# @author Chris Nasr
# @copyright FUEL for the FIRE
# @created 2015-09-10
# Import python core modules
import xml.etree.ElementTree as ET
from StringIO import StringIO
## New
#
# Starts a new XML document and return... | true |
3de9f8249bd7992b800c3d6e0cb1bce8945854bd | Den4200/pyfrost | /frost/client/events/events.py | UTF-8 | 2,254 | 3.046875 | 3 | [
"MIT"
] | permissive | from typing import Dict, Optional, Union
class Messages:
"""All messages will be stored in this class.
"""
all = dict()
"""All messages stored.
"""
__new = dict()
"""New, unread messages.
"""
@classmethod
def get_new_msgs(cls) -> Dict[int, Dict[str, Dict[str, Union[str, Dict[s... | true |
d6937076542c74115aadb7443330519612e13cfd | amaguri0408/AtCoder-python | /ABS/9-49C.py | UTF-8 | 336 | 3.484375 | 3 | [] | no_license | s = input()
while True:
if s == "":
print("YES")
break
if s[len(s)-7:] == "dreamer":
s = s[:len(s)-7]
elif s[len(s)-6:] == "eraser":
s = s[:len(s)-6]
elif s[len(s)-5:] == "dream" or s[len(s)-5:] == "erase":
s = s[:len(s)-5]
else:
print("NO"... | true |
3b73b10af3bfecf5e406824cf765aa76663e1cb7 | 1337research/scripts | /download_bitmex_candles.py | UTF-8 | 567 | 2.921875 | 3 | [] | no_license | import gzip
import pandas as pd
import requests
url = 'https://1337research-candles.s3-ap-southeast-1.amazonaws.com/bitmex_BTCUSD_1h.csv.gz'
response = requests.get(url)
decompressed = gzip.decompress(response.content)
with open('downloaded_data.csv', 'wb') as f:
f.write(decompressed)
candles = [line.split(',')... | true |
f9ef8364f0a9d63031db181046348920c328065b | bopopescu/aniai | /Tools/Scripts/exportTag.py | UTF-8 | 655 | 2.578125 | 3 | [] | no_license | import csv
import sys
import os
sys.path.insert(0, os.path.abspath('..'))
from Serializable.SerializableToModel import SerializableToModelConverter
converter = SerializableToModelConverter()
fileName = sys.argv[1]
data = converter.convertFromFile(fileName)
header = ["anime_id"] + [genre.genre_name for genre in sorted(... | true |
94a33779065d824968a465cab352135176cee907 | Barometre-de-la-Science-Ouverte/bso3-harvest-publication | /ovh_handler.py | UTF-8 | 1,827 | 2.65625 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0"
] | permissive | import os
import shutil
from glob import glob
from types import SimpleNamespace
from typing import List
from application.server.main.logger import get_logger
from config.logger_config import LOGGER_LEVEL
from domain.ovh_path import OvhPath
from infrastructure.storage.swift import Swift
logger_console = get_logger(__n... | true |
1cf73ab939951fe57eb7b397da9a0f103ea445f5 | mauriciotoro/ST0245-Eafit | /codigos-de-clase/2021-2/LISTAS/nodo.py | UTF-8 | 1,013 | 4.21875 | 4 | [] | no_license |
class Nodo:
def __init__(self,d):
self.__dato__ = d
self.__siguiente__ = None
class Lista:
def __init_(self):
self.__primero__ = None
def __buscar__(self,nodo,numero):
if nodo == None:
return False
if nodo.__dato__ == numero:
return True
... | true |
6b7eb38e3f54c19a4ea5e467898713043c4579ad | SuperArnold/xmusic-crawler | /daemon/authorization/spotify.py | UTF-8 | 1,798 | 2.8125 | 3 | [
"Apache-2.0"
] | permissive | from io import BytesIO
from urllib.parse import urlencode
import pycurl
import base64
import json
class Spotify:
"""
To make the API fast for everybody, rate limits apply. Unauthenticated
requests are processed at the lowest rate limit. Authenticated requests
with a valid access token benefit from hig... | true |
63237fc28316e8d246126ecefee390a2417e24b3 | seraph1122/EPL21-439-Implementation-de-la-fonction-ode45-dans-python | /odeoptions.py | UTF-8 | 6,937 | 3.25 | 3 | [] | no_license | import numpy as np
import numbers as num
from inspect import signature
def odeoptions(options, t, y, varargin):
'''Options helper function for ode45, verifies the options adhear to the sepcifications,
otherwise an error is raised.
Parameters
----------
options : dictionary
Op... | true |
b48e3f078981d59a7fd6ddb1a16b7f685560981f | KaranJaswani/Codes | /LeetCode-Python/48. Rotate Image.py | UTF-8 | 950 | 3.59375 | 4 | [] | no_license | class Solution(object):
def rotate(self, matrix):
"""
:type matrix: List[List[int]]
:rtype: void Do not return anything, modify matrix in-place instead.
"""
i = 0
n = len(matrix) - 1
while i < len(matrix) / 2:
k = 0
while k < n:
... | true |
3a92efceec1790640ef8a65c57cf1f6e760f87fe | idin/internet | /internet/wikipedia/WikipediaMemory.py | UTF-8 | 1,530 | 2.75 | 3 | [
"MIT"
] | permissive | from disk import Path
class WikipediaMemory:
def __init__(self, path):
self._pages = {}
self._dictionary = {
'page_attributes': {},
'n_items': 0,
'request_results': {}
}
if path is None:
self._path = None
else:
self._path = Path(path)
if self._path.exists():
self._dictionary = self.... | true |
faf919dfc2404732327df592c4d926ffc5b8b95e | danaimone/Blind_75 | /Arrays/two_sum.py | UTF-8 | 543 | 3.59375 | 4 | [] | no_license | def twoSum(nums: list[int], target: int) -> list[int]:
"""
Given an array of integers nums and an integer target, return indices of two numbers
such that they add up to target.
:param nums:
:param target:
:return:
"""
nums_dict = {}
for i in range(len(nums)):
complement = tar... | true |
6b28f2ded328c9603aaf19bc30eb09b59ed55726 | ZerocksX/Service-Oriented-Computing-2019 | /lab2/websocket_server.py | UTF-8 | 1,741 | 2.671875 | 3 | [
"Apache-2.0"
] | permissive | import asyncio
import websockets
import json
users = {}
clicks = {}
def add_user(path, websocket):
board_users = users.setdefault(path, [])
board_users.append(websocket)
print(f"New user: {websocket}")
users[path] = board_users
def remove_user(path, websocket):
board_users = users.setdefault(pa... | true |
d5f3184969f07fe574cbce538f72cfe3c43d170f | spencerparkin/SymmetryGroupPuzzle | /PuzzleGenerator/Puzzle11.py | UTF-8 | 1,382 | 2.984375 | 3 | [
"MIT"
] | permissive | # Puzzle11.py
import math
from Puzzle import Puzzle, CutRegion
from math2d_region import Region, SubRegion
from math2d_vector import Vector
class Puzzle11(Puzzle):
def __init__(self):
super().__init__()
radius = 7.0
x = radius * math.cos(math.pi / 3.0)
y = radius * math.sin(math... | true |
9fcca7b56c10ba21c3c6d2e8e9553889ead8ccdf | eliezerfb/MyJarvisBot42 | /myjarvisbot/utils/semana_ano.py | UTF-8 | 209 | 2.828125 | 3 | [] | no_license | from datetime import datetime
def get_semana_ano(date=None):
if not date:
date = datetime.today()
semana = int(date.strftime('%U'))
ano = int(date.strftime('%Y'))
return semana, ano
| true |
321b94d5e6820060999847e9695fe09d6c94fb4b | Aasthaengg/IBMdataset | /Python_codes/p02997/s291113954.py | UTF-8 | 284 | 2.875 | 3 | [] | no_license | from itertools import combinations
N, K = map(int, input().split())
def cmb(x):
return x * (x - 1) // 2
if K > cmb(N - 1):
print(-1)
else:
m = cmb(N - 1) - K
print(N - 1 + m)
for i, j in list(combinations(range(1, N + 1), 2))[:N - 1 + m]:
print(i, j) | true |
1f079059fcf10ca38a572ea0e1d692f8a83d1dff | KislakCenter/beehive-annotation-scripts | /beehive-sort-data-for-wax.py | UTF-8 | 12,425 | 2.90625 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Aug 16 10:35:28 2019
@author: davidnelson
The following script will take the data export from the Beehive and put it in
an order closely approximating Pastorius's order. As of 2019-25-11, all entries
should be correctly placed.
The code assumes that v... | true |
451840592c44f7c125b26b6927025d26a0887366 | mahdimq/adoptionagency | /models.py | UTF-8 | 594 | 2.65625 | 3 | [] | no_license | from flask_sqlalchemy import SQLAlchemy
db = SQLAlchemy()
def connect_db(app):
db.app = app
db.init_app(app)
class Pet(db.Model):
"""Model schema to show pets for adoption"""
__tablename__ = "pets"
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
name = db.Column(db.Text, ... | true |
3ac1ce2d5da12633fc5df6cbed57c7cdee4ea806 | jotaylor/SPAMM | /spamm/components/ReddeningLaw.py | UTF-8 | 7,391 | 2.609375 | 3 | [
"BSD-3-Clause-Clear",
"BSD-3-Clause"
] | permissive | #!/usr/bin/python
import sys
import numpy as np
from .ComponentBase import Component
def Calzetti_ext(spectrum=None, parameters=None):
if spectrum is None:
raise Exception("Need a data spectrum")
ext= [1.]*len(spectrum.spectral_axis)
Rv = 4.05
for j in range(len(spectrum.spectral_axis)):
... | true |
56f2a021d6908a46a033cb70b72e728a74bedfaf | mindnhand/Learning-Python-5th | /Chapter20.ComprehensionsAndGenerations/mymap.py | UTF-8 | 1,393 | 3.90625 | 4 | [
"MIT"
] | permissive | #!/usr/bin/env python3
#encoding=utf-8
#------------------------------------------------------
# Usage: python3 mymap.py
# Description: 4 implementations mymap
#------------------------------------------------------
# 1. for loop
def mymap_for(func, *seqs):
res_lst = []
for args in zip(*seqs):
res_... | true |
11b6dd04ecb1c2a16d4528ef56b4a03efb0961e2 | Gerald-Zhu/leetcode-test | /79 单词搜索.py | UTF-8 | 1,387 | 3.578125 | 4 | [] | no_license | class Solution:
def exist(self, board: List[List[str]], word: str) -> bool:
m, n = len(board), len(board[0])
used = [[False] * n for _ in range(m)]
def dfs(row, col, i): # 判断当前点是否是目标路径上的点. row col 当前点的坐标,i当前考察的word字符索引
if i == len(word): # 递归结束条件 : 找到了单词的最后一个
... | true |
da88f74caa957580b78a7e9ca3bf59c2cfca4181 | MAKENTNU/web | /src/docs/converters.py | UTF-8 | 283 | 2.59375 | 3 | [
"MIT"
] | permissive | from .models import Page
from .validators import page_title_regex
class SpecificPageByTitle:
regex = page_title_regex.strip(r"^$")
def to_python(self, value):
return str(value)
def to_url(self, page_pk: int):
return Page.objects.get(pk=page_pk).title
| true |
1a7a02998581ea5c9d7286afd21380d876be97c6 | yk7-yash/Surge_ML | /Assignment-2/2.Contact_book_cmd.py | UTF-8 | 3,150 | 3.890625 | 4 | [] | no_license | # Create a command line contact book through which user can search for provided details
import csv
from os import path
print("\nContact Book")
# Taking the path of the current working directory
cur_dir = path.dirname(__file__)
# Joining the path with the Excel file
filename = path.join(cur_dir, "Contact_Bo... | true |
0a941fd1dc46cae3be6a7939678feca7ed01f552 | bahar-j/algorithm-study | /문자열/group_word_checker.py | UTF-8 | 404 | 3.109375 | 3 | [] | no_license | from sys import stdin
N = int(stdin.readline().strip())
count = 0
for _ in range(N):
is_group = True
recent = ''
prev = []
word = list(stdin.readline().strip())
while is_group and word:
now = word.pop()
if (now != recent) and (now in prev):
is_group = False
rece... | true |
fd1846432bb7d96d86c7bfe778354dfe5af6b964 | tstrevey/freecell | /src/freecell.py | UTF-8 | 9,119 | 3.078125 | 3 | [] | no_license | import copy
from random import randint
class Card(object):
suits = {0:'h',1:'s',2:'d',3:'c'}
ranks = {1:'A',2:'2',3:'3',4:'4',5:'5',6:'6',7:'7',8:'8',9:'9',10:'10',11:'J',12:'Q',13:'K'}
def __init__(self, suit, rank):
self.suit = suit;
self.rank = rank;
def __repr__(self):
return self.__str__()
def ... | true |
cb0eb5541415c3696204d28fa785de654d0343fb | ArtamoshinN/python | /week6/countSort.py | UTF-8 | 203 | 3.296875 | 3 | [] | no_license | n = list(map(int, input().split()))
o = [0] * 101
def CountSort(n):
for now in n:
o[now] += 1
for nowo in range(len(o)):
print((str(nowo) + ' ') * o[nowo], end='')
CountSort(n)
| true |
b5d5d87b311e1dc6b8c113b2d3b65035b2982c9e | jacobhamblin/little-challenges | /tests/test_change.py | UTF-8 | 2,022 | 2.703125 | 3 | [] | no_license | from lib import change
from . import helpers
expect = helpers.expect_equal
def test_no_change():
helpers.expect_equal(change.fewest_coins(0, []), [])
helpers.expect_equal(change.fewest_coins(0, [1, 5]), [0, 0])
def test_up_to_one_of_each_coin():
helpers.expect_equal(change.fewest_coins(10, [1, 5, 10])... | true |
d9ec776272afe3f32b803fee61df2e043e252c49 | shubhramishrakota2310/CSVtoJSON | /finalpythoncode.py | UTF-8 | 1,799 | 3.59375 | 4 | [] | no_license | import csv
from collections import defaultdict
def ctree():
return defaultdict(ctree)
def build_leaf(name, leaf, level):
res = {}
res["info"] = {}
if (name != ""):
res["info"] = {"name": name}
# after level 1, use the next column as description
i... | true |
1a01fdbf5da5bdd6dc9c927afe255a9df9e024b8 | egj36715/spider | /extractors2s/url_feature.py | UTF-8 | 4,783 | 2.75 | 3 | [] | no_license | import re
import requests
import urllib
from bs4 import BeautifulSoup
from fake_useragent import UserAgent
from extractor import Extractor
from xml.dom import minidom
import alexa_req
AWSAccessKeyId='AKIAJWEULOS4W5J5ZFEQ'
AWSSecretKey='5CmDHmCDNChR1+tGg1iDIaOYXtWgowpgdSmedcXo'
awi = alexa_req.AlexaWebInfoRequest(AWSAc... | true |
d3f2cb3e0ef47fffb01deb3ef6696a8fa832e24e | cafeUncle/python-programming | /test11.py | UTF-8 | 301 | 3.28125 | 3 | [] | no_license | # test_file = open('test.txt', 'wb')
#
# print(test_file.mode)
# print(test_file.name)
#
# test_file.write(bytes('write something', 'UTF-8'))
#
# test_file.close()
test_file = open('test.txt', 'r+')
text_in_file = test_file.read()
print(text_in_file)
test_file.write('write anything')
| true |
e397693a5ad09be60853e270dafeee4d52b3d3a4 | shanewiseman/Garden | /GardenServer/Modules/Helpers/Authentication.py | UTF-8 | 855 | 2.765625 | 3 | [] | no_license | from GardenServer.models import User
import hashlib
import logging
logger = logging.getLogger(__name__)
def authUser( authObj ):
try:
logger.info( "Authenticating User: " + authObj['username'] )
userObj = User.objects.get( identifier = authObj['username'] )
except User.DoesNotExist:
... | true |
42bf59183fb7eabc85234cc99e10a85c158990b0 | stankevo/Python_Essentials | /Chap12_opening_files.py | UTF-8 | 262 | 2.953125 | 3 | [] | no_license | def main():
f = open("/Users/elena/repo/Python/Python_Essentials/Exercise Files/Chap12/lines.txt")
for l in f:
print(l.strip())
f1 = open('/Users/elena/Desktop/NewFile.txt', 'w') ## to create a new file
if __name__ == '__main__': main() | true |
e3402664aa51e27422ba9bbfbc0d3bd7d1f5838c | lixiang2017/leetcode | /problems/0394.0_Decode_String.py | UTF-8 | 815 | 3.46875 | 3 | [] | no_license | '''
Runtime: 24 ms, faster than 95.62% of Python3 online submissions for Decode String.
Memory Usage: 14.2 MB, less than 79.98% of Python3 online submissions for Decode String.
'''
class Solution:
def decodeString(self, s: str) -> str:
stack = []
cur_num = 0
cur_string = ''
for ch in... | true |
e0702aca5c9237151d49debc1287ab97267130c5 | patdaburu/elastalk | /elastalk/seed.py | UTF-8 | 3,604 | 2.921875 | 3 | [
"BSD-3-Clause",
"MIT"
] | permissive | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Created on 1/23/19 by Pat Blair
"""
.. currentmodule:: elastalk.seed
.. moduleauthor:: Pat Daburu <pat@daburu.net>
Prepare your Elasticsearch store with seed data!
"""
import json
import logging
from pathlib import Path
import uuid
from .connect import ElastalkConnectio... | true |
bd831e6ed79a2e3099dc1b3db61747acda1771a4 | Hee-Jae/Algorithm | /boj/15683.py | UTF-8 | 5,648 | 2.765625 | 3 | [] | no_license | import sys
input = sys.stdin.readline
def type1(x,y,d):
global arr
if(d==1):
for i in range(y+1,M):
if(arr[x][i]==6): break
if(arr[x][i]==0): arr[x][i]='#'
elif(d==2):
for i in range(x+1,N):
if(arr[i][y]==6): break
if(arr[i][y]==0): arr[i][y]='#'
elif(d==3):
for i in range(y... | true |
f16ef655d7eca47211f8bed8c009caabfcf1361e | 2648226350/Python_learn | /pych-three/3_4to3_7.py | UTF-8 | 996 | 3.40625 | 3 | [] | no_license | #3-4
guests = ["dante","vergil","nero"]
message = "would you like have dinner with me?"
for guest in guests:
print("Hi "+guest.title()+", "+message)
#3-5
absentees = guests[1]
guests[1] = "v"
message_1 = " can't attend my dinner, but fortunately "
message_2 = " will represent him."
print(absentees.title()+message_1... | true |
dd13b8062d664c7976d8af4b22ad166c49bbd9d0 | msultan/tensorflow-cycle-gan | /utils.py | UTF-8 | 2,286 | 2.90625 | 3 | [] | no_license | import functools
from functools import partial
import tensorflow as tf
import numpy as np
import h5py
from scipy.misc import imread, imsave, imresize
from os import listdir
from os.path import isfile, join, isdir
def compose(func_1, func_2, unpack=False):
"""
compose(func_1, func_2, unpack=False) ... | true |
dfda5187c410469e0af2c9b16c4c9f8402723c9c | niteshsin786/python | /hungman_guessTheWord/guess_the_word.py | UTF-8 | 1,326 | 3.703125 | 4 | [] | no_license | import random
from words import words
import string
def clean_list(inp):
y = []
for i in inp:
if "-" not in inp or " " not in inp:
i = y.append(i)
ret = random.choice(y)
print(ret)
return ret.upper()
def act_game():
get_word = clean_list(words)
word_letter = set(get_wo... | true |
3436825c52f9b8669082546b0a793ea1dc092c14 | starklv/coding-is-life | /web_scraping/4 selenium.py | UTF-8 | 9,481 | 2.953125 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# # Selenium
# ## 基本使用
# In[1]:
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.wait import WebDriverWait... | true |
5ee39519c7a8540359d50c9faf75e0a84e1a9dbc | sanjayr1/Algorithm_fun | /Program_1/algs10.py | UTF-8 | 381 | 2.71875 | 3 | [] | no_license | from algs9_1 import matthewGraph
from algs6 import plot
import csv
import ast
#average outdegree of canvas dataset
#d = 12.703204897371265 so round up to 13
d = 13
matt = matthewGraph(d, 27770)
plot(matt)
#save to csv
with open('alg_10.csv', 'w') as csv_file:
writer = csv.writer(csv_file)
for key, value in m... | true |
ab8954d78e09d15c1f246e48046b6c0d54b9b6a6 | my-my414/PATTERNG-PROGRAM | /main.py | UTF-8 | 173 | 3.1875 | 3 | [] | no_license | #include<stdio.h>
int main()
{
int i,j;
for(i=0;i<=6;i++)
{
for(j=0;j<=i;j++)
{
printf("*");
}
printf("\n");
}
}
| true |
0efa36cfdf3d546be1eeffd1c3e0a35621db095d | ssantichaivekin/codejam-practice | /codejam-2018-1A/B/B.py | UTF-8 | 1,033 | 2.8125 | 3 | [] | no_license | def cal_cost(sorted_cashiers, deleted, n) :
# calculate the cost of everything.
# return -1 if impossible
total_cost = 0
for i, cashier in zip(range(len(sorted_cashiers)), sorted_cashiers) :
if deleted[i] :
continue
s, p, m = cashier
# m = max
# s = cost per q... | true |
8d04d459cea39c4d39ff76a0360c27d56b197342 | Derad6709/aioqiwi | /aioqiwi/core/tooling/htstrings.py | UTF-8 | 860 | 3.1875 | 3 | [
"MIT"
] | permissive | """experimental"""
from typing import ClassVar
_SC = "{-]"
class HeadTailString(str):
"""
HeadTailString helper string inheriting type.
__head__ default head
__tail__ default tail
__skip_constraint__ passed as an argument sets this argument to its default.
NOTE: __skip__constraint__ must ne... | true |
08c1e17f8bdb60fa07403910b9f2d3c778532914 | yxc190029/credit-risk-modeling | /first_step_of_manipulation.py | UTF-8 | 27,083 | 2.5625 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Mar 12 01:19:31 2021
@author: yumingchang
"""
import numpy as np
import pandas as pd
df = pd.read_csv('/Users/yumingchang/Documents/python advance_ML/lending club/loan_data_2007_2014.csv',low_memory=False)
df_c = df.copy()
pd.options.display.max_colu... | true |
e9927de2ac82c15788d37f7894153d44c701a1fd | jamesmold/ebay | /ebay-sqlite.py | UTF-8 | 1,939 | 2.625 | 3 | [] | no_license | #The eBay API date range is limited to 3 months back and 100 records only
key = 'insert your key here -- sign-up at eBay.com for an API key'
import json
import requests
import sqlite3
search_term = input("Enter search term: ")
dbname = input("Enter dB name: ")
conn = sqlite3.connect(dbname + ".sqlite")
cur = conn.c... | true |
3d7e27a5ed6ee472151eadc97a6f014a36bc2f0b | aryanSmalhotra/python | /apps-vcs-master/apps-vcs-master/finding second gratest score in a list.py | UTF-8 | 192 | 3.265625 | 3 | [] | no_license | i=[]
n=int(input('enter how many numbers in list'))
for a in range(0,n):
s=input(("numbers"))
i.append(s)
set_r=set(i)
new_list=list(set_r)
new_list.sort()
print(new_list[-2]) | true |
c8338cb0a0ae62f35840bff9ac8766b263f4c9b2 | jwyx3/practices | /python/binary-tree-maximum-path-sum.py | UTF-8 | 751 | 3.421875 | 3 | [] | no_license | """
Definition of TreeNode:
class TreeNode:
def __init__(self, val):
self.val = val
self.left, self.right = None, None
"""
class Solution:
"""
@param root: The root of binary tree.
@return: An integer
"""
def maxPathSum(self, root):
# write your code here
def dfs(... | true |
bc98fd3fb9ef470569cbd4e60b148e1f4efe64ec | haloz/learnpy | /prog_sem_1/aufgabe19.py | UTF-8 | 1,468 | 4.125 | 4 | [] | no_license | """
Modifizieren Sie Ihr Programm aus der vorangegangen Aufgabe derart, dass das Programm nach der Ausgabe des Maximums den
Benutzer fragt, ob weitere Werte zu bearbeiten sind, und ggf. wieder von vorn beginnt. Nutzen Sie zur Lösung zunächst
die do-Anweisung, dann die while-Anweisung und zum Schluß die for-Anweisung. M... | true |
1b31f1a495322ca7cefbb309e5388b18aa8a06f2 | Programacion-Algoritmos-18-2/ejercicios-clases2bim-002-iaortiz | /tutoria-2-sc/manejo_archivos/paquete_modelo/mimodelo.py | UTF-8 | 4,321 | 3.96875 | 4 | [] | no_license | """
creación de clases
"""
# Creación de clase persona
class Persona(object):
# Constructor de la clase
def __init__(self, n, ape, ed, cod, not1, not2):
"""
"""
# Atributos
self.nombre = n
self.edad = int(ed)
self.codigo = int(cod)
self.apellido = ape
... | true |
71b7a6e22978fc8f6ad58586e3634a0755923422 | rpgoldman/pySBOL3 | /test/test_custom.py | UTF-8 | 6,241 | 2.578125 | 3 | [
"MIT"
] | permissive | import math
import os
import tempfile
import unittest
import rdflib
import sbol3
PYSBOL3_CUSTOM_TOP = 'https://github.com/synbiodex/pysbol3#customTop'
PYSBOL3_CUSTOM_BOOL = 'https://github.com/synbiodex/pysbol3#customBool'
PYSBOL3_CUSTOM_CHILD = 'https://github.com/synbiodex/pysbol3#customChildren'
PYSBOL3_CUSTOM_I... | true |
e4eaded1970c0519e0bafafa5d636854da8f5bd7 | corenel/lintcode | /algorithms/171_group_anagrams.py | UTF-8 | 1,509 | 4.0625 | 4 | [
"MIT"
] | permissive | """
Group Anagrams
--------------
Given an array of strings, group anagrams together.
LintCode Example:
- Given ['lint', 'intl', 'inlt', 'code'], return ['lint', 'inlt', 'intl'].
- Given ['ab', 'ba', 'cd', 'dc', 'e'], return ['ab', 'ba', 'cd', 'dc'].
Note:
- All inputs will be in lowercase.
- The ord... | true |
ef67a17ed718b72a810f671120498f192eb03bee | Joaoffg/pol-disagreement | /classifiers/utils.py | UTF-8 | 477 | 2.953125 | 3 | [] | no_license | import pandas as pd
def preprocess_data(df, xColumnName, yColumnName, removableWords, label2id):
df = df[[xColumnName,yColumnName]]
df.loc[:,yColumnName] = [(float(label2id[label])) for label in df.loc[:,yColumnName]]
remove_words = lambda x: ' '.join([word.lower() for word in x.split() if word not in removableW... | true |
15b560049cb02904872c7af6e6589a5cfcac05fc | HSJung93/AlgorithmPractice_Lucid | /bisect_example.py | UTF-8 | 332 | 3.703125 | 4 | [] | no_license | """
Bisect:
- "Built-in" binary search method in Python.
- Can be used to search for an element in a sorted list.
"""
import bisect
A = [-14, -10, 2, 108, 108, 243, 285, 285, 285, 401]
print(bisect.bisect_left(A, 285))
print(bisect.bisect_right(A, 285))
print(bisect.bisect(A, 285))
print(A)
bisect.insort_right(A, 1... | true |
204decb085ba8450a3218ad2aa0b7feb3ca98050 | redcican/Dynamic-Programming | /05_bestSum.py | UTF-8 | 846 | 3.359375 | 3 | [] | no_license | def best_sum(targetSum, numbers, memo={}):
if (targetSum in memo):
return memo[targetSum]
if targetSum == 0:
return []
if targetSum < 0:
return None
shortestCombination = None
for num in numbers:
remainder = targetSum - num
remainderCombination = bes... | true |
5532812f05954026175c141f1ea280394344fe75 | inkyu0103/BOJ | /DFS , BFS/2468.py | UTF-8 | 2,038 | 3.171875 | 3 | [] | no_license | #2468 안전영역
'''
뭐지 이거
2 <= x <= n-1 까지 모두 조사를 해봐야 하는데요?
'''
import sys
from collections import deque
def find():
for y in range(N):
for x in range(N):
if graph[y][x] < N:
return (y, x)
return -1
def find2():
for y in range(N):
for x in range(N):
if g... | true |
fe11835773c209539c16529386739b240015e9c5 | adavia/python_algorithms | /intermediate/max_char_count.py | UTF-8 | 351 | 3.53125 | 4 | [] | no_license | def max_char_count(st):
mapper = {}
max_char = 0
res = None
for char in st:
mapper[char] = mapper.get(char, 0) + 1
for key, value in mapper.items():
if value > max_char:
res = key
max_char = value
return res
print(max_char_count('abbccccccd'))
print(ma... | true |
6202aa3a70f69f58b6409ffe78104b53167a6357 | Timmy93/IUB_OrderAccount | /order_account.py | UTF-8 | 2,433 | 2.734375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
import os
import logging
from IUBBaseTools import ApiHandler, IUBConfiguration
from random import randint
from time import sleep
#Check if the given path is an absolute path
def createAbsolutePath(path):
if not os.path.isabs(path):
currentDir = os.path.dirname(os.path.realpath(__file__))
p... | true |
8cbe489d707746b2f9a74cccf0912971ac1eebb9 | alex-epp/deep-learning | /exercises/mnist/react-app/public/backend/MLP/grad_descent.py | UTF-8 | 2,765 | 3.109375 | 3 | [] | no_license | import numpy.matlib as np
class SimpleGradDescent:
def __init__(self, learning_rate):
self.learning_rate = learning_rate
def update(self, op, grad):
return -grad * self.learning_rate
class ClippedGradDescent:
def __init__(self, learning_rate):
self.learning_rate = learning_ra... | true |
2af3673622faf58a54a2398eec24716939f90850 | amnon/Sudoku-OCR | /convert.py | UTF-8 | 4,304 | 2.59375 | 3 | [] | no_license | import cv
import numpy as np
# function for conversion between Numpy and OpenCV,
# since OpenCV2.1 default build doesn't come with the documented cv.fromarray
# function
############################
def cvImg2np(cvImg):
"""
Convert OpenCV image to numpy array.
Usage: cvImg2np(cvImg) --> npMat
... | true |
01f333f54f1ccca9e1ab4469b31baf629c4ca87a | cRYP70n-13/Algorithms | /interviews/Array/MaximumSubarray.py | UTF-8 | 395 | 3.203125 | 3 | [] | no_license | def maximumSubArray(arr):
# Here if i initialized this one with nums[0] I will have a problem with the arr with size = 1
helper = 0
max_elem = arr[0]
for i in range(len(arr)):
# helper += arr[i]
helper = max(arr[i], helper + arr[i])
if max_elem < helper:
max_elem = h... | true |
ae02d4c98aecbc661fff1cc990e82c1e30da68e5 | rafiem/Bank-Soal | /IDCC/Crypto/DecryptME/decryptme.py | UTF-8 | 227 | 2.734375 | 3 | [] | no_license | from base64 import *
def enkripsi(plain, keys):
enc = []
plain = b64encode(plain)
for i, l in enumerate(plain):
kunci = ord(keys[i % len(keys)])
teks = ord(l)
enc.append(chr((teks + kunci) % 127))
return ''.join(enc)
| true |
b2c7be3f87e81cbb71e774f79f5df4311e4153e9 | luizdefranca/Curso-Python-IgnoranciaZero | /Aulas Python/Exercícios Extras/Python Brasil/3 - Estrutura de Repetição/Ex 34.py | UTF-8 | 486 | 4.15625 | 4 | [] | no_license | """
Os números primos possuem várias aplicações dentro da Computação,
por exemplo na Criptografia. Um número primo é aquele que é divisível
apenas por um e por ele mesmo.
Faça um programa que peça um número inteiro e determine se ele é ou não
um número primo.
"""
p = int(input("Digite p: "))
k = 2
while k < p:
if p... | true |
62df2b99cedadee3c1ba4a690676ef52f23a9522 | cuiyuhao1996/mmnas | /mmnas/utils/optimizer.py | UTF-8 | 1,497 | 2.84375 | 3 | [
"Apache-2.0"
] | permissive |
class WarmupOptimizer(object):
def __init__(self, lr_base, optimizer, epoch_steps, warmup):
self.optimizer = optimizer
self._step = 0
self.lr_base = lr_base
self._rate = 0
self.epoch_steps = epoch_steps
self.warmup = warmup
self.eta_min = 0.
self.T_m... | true |
1c96184024807aa9cf41fff2baba4cf4dbc56256 | zuozuo12/usualProject | /python/project/shotestPath.py | UTF-8 | 3,171 | 3.046875 | 3 | [] | no_license | def readCsv(path1,path2):
file=open(path1,encoding='utf8');
contents=file.readlines();
contents=contents[1:len(contents)]
station={}
for i in range(len(contents)):
contents[i]=contents[i].strip('\n').split(',');
contents[i][1]=int(contents[i][1])
# print(contents[i])
... | true |
efe34bde8bcb4fec4dab0ed8238145a626be7449 | awfeequdng/Reinforcement_Basic_to_Pro | /DeepRL_MountainCar.py | UTF-8 | 5,940 | 3.671875 | 4 | [] | no_license | import gym
import random
import numpy as np
from keras.models import Sequential
from keras.layers import Dense
from keras.optimizers import Adam
env = gym.make('MountainCar-v0')
env.reset()
goal_steps = 200
score_requirements = -198
initial_game = 5000
def model_data_preparation():
# initializing training_data a... | true |