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
f2530cc915953805e66b59f7374b919943781149
Palash51/Python-Programs
/old_prgm/str.py
UTF-8
548
3.703125
4
[]
no_license
'''a = "new string" print(a.find('g')) #9 print(a.find('p')) #-1 if not there print(a.find('S')) # case sensitive '''''' a = "this is our string" print(a.index('is')) print(a.index) ''' #print('2.3'.isalnum()) #print('a'.isalnum()) '''print('-'.join(['This','is', 'a', 'string'])) a =' - '.join('m...
true
c2178748c4de0035c1d7f2ed9355fe0e678aa143
fogcitymarathoner/rma
/helpers/test/utils.py
UTF-8
4,251
2.578125
3
[]
no_license
# -*- coding: utf-8 -*- """ helpers.test.utils Utility functions for tests (using Django test runner). * created: 2013-07-20 kevin chan <kefin@makedostudio.com> * updated: 2013-11-21 kchan """ from django.contrib.auth.models import User from garage.utils import safe_unicode from garage import get_setting as _s from...
true
a845de0f36d6cae681139e928329b10cd14c0a01
annaokes/100daysofcoding
/main.py
UTF-8
621
2.78125
3
[]
no_license
PLACEHOLDER = '[name]' with open("../Mail Merge Project Start/input/names/invited_names.txt") as names_file: names = names_file.readlines() print(names) with open("../Mail Merge Project Start/input/letters/starting_letter.txt") as letter_to_automate: letter_contents = letter_to_automate.read() for nam...
true
bfd7cf9033820a14eeffb592f8b63c99a5b31b08
achicha/py_samples
/codeforces/71A.py
UTF-8
661
4.09375
4
[]
no_license
"""Input The first line contains an integer n (1 ≤ n ≤ 100). Each of the following n lines contains one word. All the words consist of lowercase Latin letters and possess the lengths of from 1 to 100 characters. Output Print n lines. The i-th line should contain the result of replacing of the i-th word from the input ...
true
e4b38af2a356ca244d97b8d00aae20781930bfdb
InsightSoftwareConsortium/ITK
/Modules/ThirdParty/pygccxml/src/pygccxml/declarations/namespace.py
UTF-8
8,089
2.578125
3
[ "IJG", "Zlib", "LicenseRef-scancode-proprietary-license", "SMLNJ", "BSD-3-Clause", "BSD-4.3TAHOE", "LicenseRef-scancode-free-unknown", "Spencer-86", "LicenseRef-scancode-llnl", "FSFUL", "Libpng", "libtiff", "LicenseRef-scancode-warranty-disclaimer", "LicenseRef-scancode-other-permissive", ...
permissive
# Copyright 2014-2017 Insight Software Consortium. # Copyright 2004-2009 Roman Yakovenko. # Distributed under the Boost Software License, Version 1.0. # See http://www.boost.org/LICENSE_1_0.txt """ Describe a C++ namespace declaration. """ from . import scopedef from . import declaration_utils class namespace_t(sc...
true
ff24289ba9d2ab4832565610aaa1ab44eb6e84cd
valleyceo/code_journal
/1. Problems/c. Array/2_Max_Number_of_Eaten_Apples.py
UTF-8
2,086
4.1875
4
[]
no_license
""" LC 1705. Maximum Number of Eaten Apples There is a special kind of apple tree that grows apples every day for n days. On the ith day, the tree grows apples[i] apples that will rot after days[i] days, that is on day i + days[i] the apples will be rotten and cannot be eaten. On some days, the apple tree does not gro...
true
7446600f535a2cd8a6037e9b9dc34a7bb24b0241
RajGite/Hotel_Management_Website
/hotel_web/booking/models.py
UTF-8
715
2.625
3
[]
no_license
from __future__ import unicode_literals from django.db import models # Create your models here. class RoomType(models.Model): description = models.CharField(max_length=250, primary_key=True) # Luxury, Deluxe, Double, Single. description is PK max_capacity = models.IntegerField() price = models.IntegerF...
true
1b8149867b0130716f3c72d60f0250671c6ec999
JoKerDii/Thinkpy-mySol
/Exercise10.6.py
UTF-8
311
3.828125
4
[]
no_license
def is_anagram(string1, string2): """Te check whether two words are anagrams Two words are anagrams if one can be rearranged the letters to spell the other.""" return sorted(string1) == sorted(string2) # test # string1 = 'boots' # string2 = 'boost' # ans = is_anagram(string1,string2) # print(ans)
true
8405b1ea964c1bf24cd7a54e77d5e55ac5830464
OHeimlich/Telegram_Edison_Bot
/sensors.py
UTF-8
708
2.640625
3
[ "MIT" ]
permissive
import pyupm_grove as grove import pyupm_i2clcd as edi_lcd from multiprocessing import Process temperature = grove.GroveTemp(0) led = grove.GroveLed(3) lcd = edi_lcd.Jhd1313m1(0, 0x3E, 0x62) def led_on(): led.on() def led_off(): led.off() def get_temp(): return temperature.value() def write_lcd_fir...
true
760c64552d80cf82b5310d107f2be6d0f48ba76f
Anthony-Mckale/talks-presentations
/2021/2021-05-14-python-101-testings/converter.py
UTF-8
3,380
3.46875
3
[ "MIT" ]
permissive
#!/usr/bin/env python ########################################################################################## ########################################################################################## ########################################################################################## # IF YOU ARE DOING THE N...
true
a74dfef285680d58fb80f678d6a6abb7e762efb7
TechieBoy/deepfake-detection
/experiments/face_features.py
UTF-8
1,594
2.765625
3
[ "MIT" ]
permissive
import cv2 from skimage import feature from skimage.transform import integral_image from skimage.feature import haar_like_feature, local_binary_pattern import numpy as np import timeit # OpenCV # def get_HOG_features_using_CV(imagePath): # im = cv2.imread(imagePath) # im = cv2.cvtColor(im, cv2.COLOR_BGR2GRAY...
true
ca9ad655149a38bd31f16d77f85245a4a1495020
liseyko/CtCI
/leetcode/p0257 - Binary Tree Paths.py
UTF-8
919
3.3125
3
[]
no_license
class Solution: def binaryTreePaths(self, root: TreeNode) -> List[str]: def dfs(r=root, path=[]): if not r: return path.append(str(r.val)) if not r.left and not r.right: self.res.append('->'.join(path)) dfs(r.left, path) ...
true
6a792fe4894fbafe444da81678c27cd730fb1618
audreyroumieux/projet1webNumber
/models/modelCNN.py
UTF-8
2,096
3
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Mon Apr 23 11:45:30 2018 @author: audrey roumieux Projet: web Description : Model Convolutional """ import numpy as np import keras from keras.utils import to_categorical from keras.datasets import mnist from keras.layers import Dense from keras.layers import Conv2D, MaxPooling2D ...
true
f73e49d5dfac9cffe824509d677b9d95f314db3f
clchiou/garage
/python/g1/containers/g1/containers/images.py
UTF-8
21,353
2.59375
3
[ "MIT" ]
permissive
"""Manage images. We make an important design decision: Importing images requires root privilege; unlike rkt, which does not. We make this decision for the simplicity of implementation. To not require root privilege, rkt has to split import into two steps: * The first step, the ``fetch`` command, merely copies a ta...
true
df379d11eeaeb21485df49192c5528c997708adb
zeerakt/Python-Chatbot
/client.py
UTF-8
2,051
3.078125
3
[]
no_license
""" Client side operation, using Tkinter for the GUI """ from socket import AF_INET, socket, SOCK_STREAM from threading import Thread import tkinter def receiveMessage(): while True: try: msg = client_socket.recv(BUFSIZ).decode("utf8") msgList.insert(tikinter.END, msg) except OSError: #If the client leav...
true
65f13996a4a7f6a8838ba2f6204e6d9ef9b27a0c
DaHuO/Supergraph
/codes/CodeJamCrawler/16_0_1_neat/16_0_1_niftony_A.py
UTF-8
567
2.59375
3
[]
no_license
file=open("A-large.in","r") file_out=open("A-small.out","wr") case_n=file.readline() for x in xrange(int(case_n)): case_id=x+1 case_v=int(file.readline()) buffer=[] tmp=case_v if tmp==0: file_out.writelines("Case #"+str(case_id)+": "+"INSOMNIA\n") else: count=1 while le...
true
d7693c097f491fc395115db1f1dd99e08e2b3804
pns845/Selenium
/autocomplete.py
UTF-8
1,744
2.578125
3
[]
no_license
from selenium import webdriver from selenium.webdriver.common.by import By import time from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as EC from selenium.common.exceptions import * class AutoComplete(): def auto(self): driver = we...
true
f67831b16dcfce655c40762653b02363e79c50b4
iu7dreamteam/Movie-quotes-backend
/src/apps/movie_quotes/views/LoginView.py
UTF-8
2,581
2.578125
3
[]
no_license
from rest_framework import status from rest_framework.views import APIView from rest_framework.response import Response from apps.movie_quotes.domain.repositories.UserProfileRepo import UserProfileRepo from apps.movie_quotes.infrastructure.django.TokenAuthorizer import TokenAuthorizer from apps.movie_quotes.domain.us...
true
4f073022613789837f531a508950b1ff64f0c5a7
mindpool/www.mindpool.io
/twisted/mindpoolsite/content/auth.py
UTF-8
282
2.6875
3
[]
no_license
loggedout = """ Thanks for Visiting ------------------- Thanks for visiting our site and taking the time to log in. If you've logged out by accident, you can log back in using the login link in the upper right of the navigation menu at the top of the page. Have a great day! """
true
3a025ece9d75b5e18474046e1851552f5d1bd6c1
surendiran10/suren
/max.py
UTF-8
98
3.3125
3
[]
no_license
n=int(input("")) l=[] for i in range(0,n): ele=int(input()) l.append(ele) l.sort() print(l[-1])
true
c79ff7b60ffc1fedb466f52c4307fe6b21263f7a
moonlighf/CronJob
/epic_game/GetFreeEpicGames.py
UTF-8
4,858
2.65625
3
[ "Apache-2.0" ]
permissive
# -*- coding: utf-8 -*-# # ------------------------------------------------------------------------------- # Name : GetFreeEpicGames # Description : 免费获取epic每周的免费游戏 # Author : skymoon9406@gmail.com # Date : 2020/11/13 # -------------------------------------------------------------------------...
true
9954166de763a64fe1b9bffd44f3c6e5f498656a
berindererikjanos/Gyakorlo-feladatok-2018-2
/lambda_kettoharomoszthato.py
UTF-8
140
2.75
3
[]
no_license
isDiv6= lambda n : True if n%2 == 0 and n%3 == 0 else False print(isDiv6(12)) ls = [12,15,17,23,56,21,64,312] print(list(filter(isDiv6,ls))
true
a624b682878b2b3f94a347d8b43135f691516c50
KimMooGyeong/Neuralnetwork-Regression
/network_module.py
UTF-8
7,041
3.125
3
[]
no_license
import numpy as np import numpy.linalg as lin from numpy.random import randn from scipy.special import expit class SimpleNetwork: """ Class of neural network such that has M hidden units in one hidden layer, D input units and one output unit.""" # initialzation def __init__(self, M=3, D=2, etha=0.0...
true
004be94e0dbb924e9afb01fcbef108b23b7b42fe
lvchenyang1/fenci
/fenci_middleV1.0/middle_fenci/model/pynlpir/pynlpir_wrap.py
UTF-8
3,201
2.53125
3
[]
no_license
import pynlpir class Pynlpir_fenci(object): def __init__(self,content,**kwargs): self.pynlpir_content = content self.separator = kwargs.get("separator") self.flag = kwargs.get("flag") def pynlpir_fenci(self): if self.separator: pynlpir.open() ...
true
016bf69689f553d4b9f34e3fe41aaf08d40b8c51
jimmyauyeung/generative_art
/processing_python/dirty_mirrors/dirty_mirrors.pyde
UTF-8
5,658
3.265625
3
[ "MIT" ]
permissive
########################################################################## # Code and images by Aaron Penne # https://github.com/aaronpenne/generative_art # # Released under the MIT license (https://opensource.org/licenses/MIT) ########################################################################## import datetime ...
true
d6db9706174d0bbfbc40b2315fe28823b07f743e
dr-dos-ok/Code_Jam_Webscraper
/solutions_python/Problem_136/1950.py
UTF-8
537
3.0625
3
[]
no_license
def run(i, o): cases = int(i.readline()) case = 0 while case < cases: case+=1 income = 2 total = 0 c, f, x = [float(n) for n in i.readline().split()] while True: t = c/income total += t if (x-c)/income < x/(income+f): total += (x-c)/income break else: income += f o...
true
463b91b13bde1b4ee8ab0520942cc21c244fe1e6
Arunavaskar/TicTacToe-Python-Console
/TicTacToe_Modular/start_game.py
UTF-8
1,445
4.46875
4
[]
no_license
def start_game(): #playerone_marker = input("Player One, choose your marker.. 'X or O': ") #playertwo_marker = input("Player Two, choose your marker.. 'X or O': ") #MARKER ONE while True: playerone_marker = input("Player One, choose your marker.. 'X or O': ") if playerone_marker.lo...
true
c88c4ecc9a4ee45f05ca2fd12888ed3c913ad782
koda186/WeGo_Autonomous_Vehicle_Delivery_Simulator
/cs/usersDB.py
UTF-8
1,800
2.875
3
[]
no_license
import pymysql class Database: def __init__(self): pass def get_connection(self): conn = pymysql.connect(host="localhost", user="team12", passwd="pandapanda", db="team12_wego") return conn def insert_user(self, email, name, password): connection = self.get_connection() ...
true
304178a36b4d25686c165b711185a8e827b216a1
allanfs1/ChatBox_PYTHON
/selenium/tx.py
UTF-8
1,513
2.703125
3
[]
no_license
from time import sleep from selenium import webdriver from selenium.webdriver.common.keys import Keys from selenium.common.exceptions import TimeoutException import socket phone = [5511975512897] try: st = open("conversas/conversa.txt",'r') message_text=st.read() # message except Exception as e: print("E...
true
f592cbec99f8ca13cae2c0f88cc6a7466a793dd3
ionorins/ballotbox
/emotion_analysis/tidyData.py
UTF-8
1,932
3.15625
3
[]
no_license
import pandas as pd import numpy as np from sklearn.utils import shuffle data = pd.read_csv("nlp_datasetfull.txt", sep = ";", header = None) # Remove Surprise! data.columns = ["text","label"] data = data[data.label != "surprise"] # Adjust the frequencies ! # [JOY ANGER FEAR SADNESS LOVE] # [0.35 0.10 0.05 0.20 0....
true
d530b19ac43da30dcf9706113cb3b241f9b38357
DevelopersRede/erede-python
/erede/Refund.py
UTF-8
379
2.8125
3
[ "MIT" ]
permissive
class Refund: def __init__(self): self.amount = None self.refundDateTime = None self.refundId = None self.status = None @staticmethod def unserialize(dict=None): if dict is None: dict = {} instance = Refund() for k, v in dict.items(): ...
true
dcb0504e32337768810a25d6a021c0a0917818e5
xu1718191411/AT_CODE_BEGINNER_SELECTION
/CONTEXT_130/enough_array.py
UTF-8
587
2.9375
3
[]
no_license
# n = 4 # k = 10 # arr = [6, 1, 2, 7] # # n = 3 # k = 5 # arr = [7, 7, 7] # n = 10 # k = 53462 # arr = [103,35322,232,342,21099,90000,18843,9010,35221,19352] # S = input().split(" ") # n = int(S[0]) # k = int(S[1]) # # S = input().split(" ") # arr = [int(s) for s in S] def calculate(n,k,arr): ans = 0 j = 0...
true
69b6c63808881cb233987f5ba193224b21878a90
purepython/lpthw
/ex5/ex5ec4.py
UTF-8
159
3.796875
4
[]
no_license
# Exercise 5 Extra Credit 4 i = 25 c = 2.54 p = 40 k = 2.2 print "25 inches in centimeters is %f" % (i * c) print "40 pounds in kilograms is %f" % (p / k)
true
49ed89ebbbbef2773fc727175495950e314a3192
Al3xTen/python_lessons
/qalab.py
UTF-8
1,003
3.40625
3
[]
no_license
# print('hi') # message='Sasha' # print(type(message.upper())) # message=5 # # print(type(message)) # number=5.5 # print(int('5')) # print(type(5)) # # temp_c=36.6 # temp_f=temp_c*1.8+32 # print(temp_f) # print(100*'$') # print('$'+98*' '+'$') # print('$'+42*' '+message.upper()+51*' '+'$') # print('$'+98*' '+'$') # pr...
true
79d6a7cb0f76d54eb50f1ebe8b33974a6c327e42
Nduwal3/python-Basics
/soln13.py
UTF-8
514
4.21875
4
[]
no_license
""" Write a Python program that accepts a comma separated sequence of words as input and prints the unique words in sorted form (alphanumerically). Sample Words : red, white, black, red, green, black Expected Result : black, green, red, white,red """ comma_separated_list = input("Enter a sequence of words separat...
true
3b07d53fe1a776313799b7eab9e6c759de28e602
chishu-amenomoriS/wiktionary-tools
/python/en-verb/en-verb-5.py
UTF-8
615
2.65625
3
[ "CC0-1.0" ]
permissive
import sys for line in sys.stdin: forms = line.strip().split("\t") if len(forms) == 4: forms.append(forms[3]) verb, _, _, past, pp = [f.replace("'", "").replace("-", "") for f in forms] if past == pp: if not past: continue if past.endswith("ed"): if verb.endswith("e") and ver...
true
75867914ef8396ff46ddff7fcd8383ef13f66e95
epiviz/epivizFileParser
/tests/test_BamFile.py
UTF-8
865
2.71875
3
[ "MIT" ]
permissive
# -*- coding: utf-8 -*- import pytest import os from epivizFileParser import BamFile __author__ = "jkanche, alexanv8" __copyright__ = "jkanche" __license__ = "mit" """ The file test.bigBed and test assertions come from the pyBigWig library """ bb = BamFile("tests/data/test.bam") def test_getRange(): ...
true
5997ac271988130efc51d571711c0f0dc5f098de
yijingx/SSD
/SSD_framework/utils.py
UTF-8
9,581
2.671875
3
[]
no_license
import numpy as np import cv2 from dataset import iou from dataset import iou_NMS colors = [(255, 0, 0), (0, 255, 0), (0, 0, 255)] #use red green blue to represent different classes def visualize_pred(windowname, pred_confidence, pred_box, ann_confidence, ann_box, image_, boxs_default,epoch = 500,save=False,threshol...
true
cbbec45552aebf9a42ebaa1928124de32f3b1bdf
kartverket/where
/where/estimation/constraints/__init__.py
UTF-8
1,511
2.609375
3
[ "MIT" ]
permissive
"""Framework for running estimators Description: ------------ Each estimator should be defined in a separate .py-file. The function inside the .py-file that should be called need to be decorated with the :func:`~midgard.dev.plugins.register` decorator as follows:: from midgard.dev import plugins @plugins.re...
true
14e270d0d55580baf023ecf15c73a79eb3d0a461
qsdfo/LOP_database
/LOP_database/utils/reconstruct_pr.py
UTF-8
1,696
2.53125
3
[]
no_license
#!/usr/bin/env python # -*- coding: utf-8-unix -*- import numpy as np from LOP_database.utils.event_level import from_event_to_frame def instrument_reconstruction(matrix, mapping): # Reconstruct an orchestral dictionnary pianoroll from # - matrix : (time * pitch) # - mapping : a dictionnary mapping i...
true
83301cffb3fc0709cf463fd357265eb795a3dbdd
AzadDeihim/Face-Generation
/DCGAN_net.py
UTF-8
3,704
2.71875
3
[]
no_license
import torch.nn as nn import torch ######################################################################################################################## # DCGAN ######################################################################################################################## # generator returns an 'image': ...
true
ad9647b49f155db7075120d04263629e6ba6fd12
krisrajzlive/IITACSE-IoTProject
/M02-01-Project-HealthCare-IoT-Cloud/main.py
UTF-8
1,752
2.703125
3
[]
no_license
# this programs should be called only after running BedSideMonitor.py simulator program # this program is used to invoke aggregator and alert programs, also we can separately run them # # usage: python main.py -s "startdate" -e "endstate" -p "aggregates" # usage: python main.py -s "startdate" -e "endstate" -p "rules" #...
true
768202c4594ebe25bdf290bb2380afd042f2a8f5
jrivo/prisma-client-py
/tests/test_create.py
UTF-8
3,473
2.78125
3
[ "Apache-2.0" ]
permissive
import pytest from prisma import errors, Client from .utils import assert_time_like_now @pytest.mark.asyncio async def test_create(client: Client) -> None: """Basic record creation""" post = await client.post.create( { 'title': 'Hi from Prisma!', 'published': True, ...
true
c04160b029a634bb9445bb6c2798296ad71abe87
kchmielewski/python_basics
/basics/typy danych/12.py
UTF-8
211
2.796875
3
[]
no_license
'''Otrzymałeś wiaodomość zakodowaną w sytmie utd-16: '\xff\xfe|\x01\xf3\x00B\x01\x07\x01''' en = '\xff\xfe|\x01\xf3\x00B\x01\x07\x01' x = en.encode('utf-16') print(u'\xff\xfe|\x01\xf3\x00B\x01\x07\x01')
true
c3291d16058b2348231591bbf84cb69456931be9
maxyharr/blog_prediction
/app.py
UTF-8
874
2.546875
3
[]
no_license
from flask import Flask, jsonify, request from nltk.corpus import gutenberg, wordnet from nltk.tokenize import sent_tokenize import nltk import os nltk.download('gutenberg') nltk.download('punkt') nltk.download('wordnet') port = int(os.environ.get("PORT", 5000)) app = Flask(__name__) @app.route('/', methods=['GET'])...
true
c879aa2bdea52f596e292556b1ef1d39e1cbfdac
dylancreaven/projectGraphTheory
/regex.py
UTF-8
7,281
3.59375
4
[ "MIT" ]
permissive
#Dylan Creaven - G00354442 #Graph Theory Project 2020 import shunting import argparse class State: """A State with one or two edges/arrows, with all edges/arrows labelled w/ label""" # Constructor. def __init__(self, label=None, edges=None): # Every state has 0, 1, or 2 edges from it. self.edg...
true
03488ff1765d6a93f75a813c3a2aa9c680565274
CoinsOfPixel/LocalBitcoinVendosByMethod
/sellerbymethod.py
UTF-8
912
2.5625
3
[]
no_license
import json import urllib2 url = 'https://localbitcoins.com/buy-bitcoins-online/USD/.json' url2 = url json_obj = urllib2.urlopen(url2) offer = json.load(json_obj) position = 0 size = len(offer['data']['ad_list'][position]['data']['profile']) for i in range(size): position += 1 seller = offer['data']['ad_...
true
8ffe38c39c5e63fe9d815ae0fe356ea9edeaf732
deronaucoin/pfquiz
/viz/transform.py
UTF-8
1,482
2.96875
3
[]
no_license
#Slightly modified from: https://github.com/alexland/d3-data-adapter/blob/master/d3-graph-data-adapter.py import os import random as RND import numpy as NP import itertools import networkx as NX import json as JSON #---------------------- convert adj matrix to JSON ---------------------# def adjmatrix_tojson(adj_ma...
true
bf2757fe0f9a66be861ddffd3ee2c7c55637764d
diegodebruyn/si_dashbord
/ping_test.py
UTF-8
451
2.609375
3
[]
no_license
import subprocess def ping_test(): return "OI" for ping in range(1,2): address = "127.0.0." + str(ping) res = subprocess.call(['ping', '-c', '3', address]) result="" if res == 0: result+= "".join(["ping to",address,"OK"]) elif res == 2: result+=""....
true
82ea75d4707feff3e9c4b4445890999db6196776
jianjunyue/KmmtML
/Test/tensorflow_线性回归.py
UTF-8
1,753
3
3
[]
no_license
import tensorflow as tf import numpy as np import matplotlib.pyplot as plt from keras.models import Sequential # 产生训练数据集 train_X = np.asarray([3.3,4.4,5.5,6.71,6.93,4.168,9.779,6.182,7.59,2.167,7.042,10.791,5.313,7.997,5.654,9.27,3.1]) train_Y = np.asarray([1.7,2.76,2.09,3.19,1.694,1.573,3.366,2.596,2.53,1.221,2.827,3...
true
2c01ac6845f2519d4001776f95576d0ff52e5cca
galid1/Algorithm
/python/baekjoon/2.algorithm/greedy/백준_주식.py
UTF-8
1,170
3.203125
3
[]
no_license
import sys # 가지고 있다가 떨어질 때 팔면, 뒤에 있을 더 높은 주가가 올 때 파는것에 대한 이익을 챙기지 못한다. def solve(): global n, stocks standard_idx = n-1 holdings = [] ans = 0 idx = standard_idx - 1 while standard_idx > 0: while True: # idx가 끝났거나, 현재 기준보다 더 비싼 주가가 나타난 경우 if idx < 0 or stocks[i...
true
ec24d65f441d4b8888db36e9bcf61361bd89059d
asliioktayy/algorithms
/binary_search.py
UTF-8
342
4.03125
4
[]
no_license
def binary_search(arr, l, r, x): mid = (l + r) / 2 while r >= l: if arr[mid] == x: return mid elif arr[mid] > x: r = mid - 1 mid = (l + r) / 2 else: l = mid + 1 mid = (l + r) / 2 return -1 arr = [1,5,34,67,99] result = binary_search(arr, 0, len(arr) - 1, 10) if result == -1: print('not found')...
true
721176fa4dfcda6ebdee93fcad59398ee4a69524
jbradmil/RA2016
/scripts/agg_bins.py
UTF-8
4,419
2.78125
3
[]
no_license
## defines all aggregate signal regions, stores sets of them in a dictionary from search_bin import SearchBin from ROOT import TH1D from math import sqrt ## here define aggregate regions as lists of the bin indices asr1 = [i for i in range(1,161) if SearchBin(i).inb == 0 and SearchBin(i).imht > 1] asr2 = [i for i in...
true
f7ac498d5f846164deb3631b839c67e874a3421d
TheCommonCold/KCK1
/main.py
UTF-8
1,124
2.890625
3
[]
no_license
import matplotlib.pyplot as plt import csv import numpy from matplotlib import rc nazwy=('2cel-rs.csv','rsel.csv','2cel.csv','cel-rs.csv','cel.csv') symbole=('o','v','D','s','d') def czytacz(nazwa): dane = [] effort = [] with open(nazwa, newline='') as f: reader = csv.reader(f) reader.__ne...
true
0798fd96868e1c07d4cbe0b7870c19eb2307bdaa
thecodacus/deep-learning-nmt-using-tf-keras
/seq2seq.py
UTF-8
3,558
2.84375
3
[]
no_license
import tensorflow as tf from tensorflow.python.keras.models import Model from tensorflow.python.keras.layers import Input from tensorflow.python.keras.layers import LSTM from tensorflow.python.keras.layers import Dense import numpy as np class Seq2Seq: def __init__(self,decode_max_len,start_seq_index,input_bits,o...
true
b6e262cadca95584e46510e47cc6b5f8e8031636
seyeon0409/sparta-git
/python/homework4.py
UTF-8
1,389
2.71875
3
[]
no_license
from flask import Flask, render_template, jsonify, request app = Flask(__name__) from pymongo import MongoClient # pymongo를 임포트 하기(패키지 인스톨 먼저 해야겠죠?) client = MongoClient('localhost', 27017) # mongoDB는 27017 포트로 돌아갑니다. db = client.dbsparta # 'dbsparta'라는 이름의 db를 만듭니다. ## HTML을 주는 부분 @ap...
true
f7731140e34d4e98e6cff53f49e0a347d3df1140
HoversineCrew/hoversine_cc_server
/tests.py
UTF-8
78
3.3125
3
[]
no_license
x = 5 y = 3 liste = [x,y] print(liste) x = 1 liste = [x,y] print(liste * 0.9)
true
287060b64e0c83af56358dd04d7d8bfd67696eff
chongtoa/PythonProject
/Flask/template_flask/app.py
UTF-8
456
2.59375
3
[]
no_license
from flask import Flask, render_template app = Flask(__name__) # # 重定向 # @app.route('/') # def index(): # login_url = url_for('login') # return redirect(login_url) # return '这是首页!' # 模板渲染以及传参 @app.route('/') def index(): context={ 'username': 'hello', 'age':18, 'gender': 'mal...
true
8ecc16bb94b2e2fd2a309962e7fa88949f623e03
PedroL7/hello-world
/Week7Ex1,4.py
UTF-8
145
3.359375
3
[]
no_license
a = [ 66.25, 333, 333, 1, 1234.5 ] #a.insert(2, -1) #a.append(333) #a.index(333) #a.remove(333) a.reverse() print(a) print(a.index(333))
true
488a1077c2c49c8b733bf3677ce0977ffe28a3be
devtlv/Python-S19
/Classes/class_15/telephones.py
UTF-8
780
2.953125
3
[]
no_license
class Smartphone: def __init__(self, number, password, brand): self.number = number self.password = password self.brand = brand def unlock_phone(self): user_pwd = input("Input password: ") if user_pwd == self.password: print("Phone unlocked !") ...
true
3dfa306f1fc42738926d2b2088a9c62880d9f249
Miguel-Bit-Debug/Curso-em-Video-Python
/ex082.py
UTF-8
914
3.28125
3
[]
no_license
'''n1 = [] n2 = [] n3 = [] while True: num = int(input('Digite um valor: ')) n1.append(num) print('Valor adicionado...') r = str(input('Quer continuar? [S/N]: ')) if num % 2 == 0: n2.append(num) else: n3.append(num) if r in 'nN': break print(f'Você digitou {len(n1)} v...
true
c5cad0cb277dac2708429b14ff21355630ff7db9
SokoPaulSokool/MyDiary
/tests/test_signup_api.py
UTF-8
3,633
2.59375
3
[]
no_license
from api.v1.endpoints import app import unittest import pytest import json # Testing the signup feature class test_signup(): def __init__(self, app): self.test_client = app.test_client() # signs up user with the provided args def signup(self, name, email, password): return self.test_cl...
true
2858ba6d8ebe3af27f33171ab812b4ab30856a66
e-koch/CubeAnalysis
/cube_analysis/tests/test_shifter.py
UTF-8
4,974
2.6875
3
[ "MIT" ]
permissive
import numpy as np import astropy.units as u from spectral_cube import SpectralCube from scipy.optimize import curve_fit import os from cube_analysis.spectra_shifter import fourier_shift, cube_shifter from cube_analysis.tests.utils import generate_hdu def test_shifter(shape=(100, 100, 100), sigma=8., amp=1.): '...
true
475284c37cb6df5c800f5c0de1883f793d73afed
mavniselimi/_PYTHON_
/aç/mustafa efe/fibonacci sayısı.py
UTF-8
214
3.671875
4
[]
no_license
sayi = int(input("Ne kadar devam etsin")) a = 1 b = 1 fibonacci = [a,b] for i in range(sayi): a,b = b,a+b #b'yi a'ya attık, a+b'yi de b'ye attık fibonacci.append(b) #listeye ekliyoruz. print(fibonacci)
true
52409a520e97bba3b60d6d2ba03fc256d0023c4e
leeminnn/PLayFoo
/Server/simple/game.py
UTF-8
4,796
2.5625
3
[]
no_license
from flask import Flask, request, jsonify from flask_sqlalchemy import SQLAlchemy from os import environ import requests import json from flask_cors import CORS app = Flask(__name__) app.config['SQLALCHEMY_DATABASE_URI'] = environ.get('dbURL') app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False cors = CORS(app) db =...
true
86cfac3bf2c123133601e8013e7adb76c30802dc
DustinY/pygame_digger
/new_player.py
UTF-8
8,328
3.34375
3
[]
no_license
"""NewPlayer This module creates a Player by loading sections of the character from a spritesheet. The sections are loaded into lists. """ import pygame import spritesheet_functions as spsh from constants import * class NewPlayer(pygame.sprite.DirtySprite): """The NewPlayer class creates a NewPlayer object ...
true
565bc631baf8ed5ead66c0e96a678b93ff5945fc
creatoryoon/CSE2003_1_2021_1_Sogang_-
/실습/12장 실습_3_1.py
UTF-8
542
3.484375
3
[]
no_license
def wd_remove(L): rWord = input("Enter word to remove: ") chk=0 for i in range(len(L)-1,-1, -1): if rWord == L[i]: del L[i] chk=chk+1 if chk == 0: print(rWord, "is not in the input words.") return chk else: return chk input_string = input...
true
548d5cda02c3a1ef66cf68e95e7dcadc4e3e661d
hernanbs/calculadora-ui
/app/Calculator/calculadora.py
UTF-8
1,619
4.125
4
[]
no_license
from inteiro import Inteiro class Calculadora: """Calcula de dois numeros""" def __init__(self): self.__num1 = Inteiro() self.__num2 = Inteiro() def sumOp(self): if self.getNum1() is None or self.getNum2() is None: return None return self.getNum1() + self.getNu...
true
941b7c3e595ec80a31bd2738c29efee44280f6f9
S-W-R/hitori-solver
/main.py
UTF-8
1,629
3.15625
3
[]
no_license
import argparse from typing import Iterable from puzzle_parser.puzzle_parser import PuzzleParser from puzzle_solver.puzzle_solver import PuzzleSolver from ui.console_ui import ConsoleUi def init_parser() -> argparse.ArgumentParser: parser = argparse.ArgumentParser() parser.add_argument('width', ...
true
ec7ba7476681b5cfd761b7cdfd1ed6428873a775
CharleG/DOS-calculation
/python/material.py
UTF-8
2,104
2.640625
3
[ "MIT" ]
permissive
"""This file defines an example system whose density of states will be calculated with MPB. This is analogous to the file ``3Dexample.ctl``. """ import numpy as np import meep from meep import mpb from util import TqdmWrappedIterable, _array_to_vec3s, interpolate_path basis_size = np.ones(3) * np.sqrt(3) / 2 basis =...
true
91a1ec8e913b65dbe9b07c05adf4c7f89ff8d901
Aasthaengg/IBMdataset
/Python_codes/p02818/s604284231.py
UTF-8
104
2.828125
3
[]
no_license
a_m, b, k = map(int, input().split()) a = max(0,a_m-k) b = max(0,b-(k-(a_m-a))) print(str(a)+" "+str(b))
true
974283f49a369c63ea4d872c9aba529f480aecfb
penguin138/digger_bot
/manage.py
UTF-8
1,873
2.53125
3
[]
no_license
from elasticsearch import Elasticsearch import os import sys import time import re ES_HOST = os.getenv('ES_HOST', default='localhost') es = Elasticsearch([ES_HOST]) good = False while not good: good = False time.sleep(1) try: while not es.ping(): print("Waiting for elasticsearch to lau...
true
0d7b3ee64330d95048ba22ae7d89352eeb66bcfd
acep-uaf/MiGRIDS
/MiGRIDS/UserInterface/ResultsModel.py
UTF-8
3,258
2.6875
3
[ "MIT" ]
permissive
from PyQt5 import QtWidgets class ResultsModel(QtWidgets.QWidget): def __init__(self, parent): super().__init__(parent) self.init() def init(self): self.layout = QtWidgets.QGridLayout() self.setObjectName("modelResult") self.refreshButton = self.createRefreshButton()...
true
e2011fb1105d6ab7e057d4dee6b978b15faf8eb0
OptimisticReservoir/mazebert-bot
/ganesha.py
UTF-8
3,458
2.59375
3
[ "MIT" ]
permissive
#!/usr/bin/python3 import discord import logging import sys # I guess this needs to be global. client = discord.Client() def main(args): if(len(args)>1): discord_token = args[1] else: f = open("token_file") discord_token = f.read(60).rstrip() f.close() discord_logger = set_...
true
416e347d504ae5465eae9b24c54d04ee73bac11e
GeertFolkertsma/AoC2020
/day12.py
UTF-8
2,643
3.4375
3
[]
no_license
#!/Users/geert/opt/anaconda3/bin/python3 class Ship: dps = [(0,1),(1,0),(0,-1),(-1,0)] dirs = "NESW" def __init__(self, p0=None, dir_="E", wp0=None): if p0 is None: self.p = [0,0] else: self.p = p0 self.d = self.dirs.index(dir_) ...
true
b0e86201b8b4ddcc798a21e017b7ec6e385c6701
pyfisch/keyboard-types
/convert.py
UTF-8
7,369
2.6875
3
[ "Apache-2.0", "MIT" ]
permissive
import re import requests def parse(text): display = [] for match in re.findall(r"id=\".*?\">\"(.*?)\"</code>\n.*\n.*<td>(((.*?)\n)+?)\s+(<tr>|</table>)", text): # Skip F keys here if re.match("^F\d+$", match[0]): continue doc = re.sub(r"[ \t][ \t]+", "\n", match[1]) ...
true
d3337f4f147f7e28ed1069983b09570338b6b81c
ausaki/data_structures_and_algorithms
/leetcode/swap-adjacent-in-lr-string/283683137.py
UTF-8
1,323
3.078125
3
[]
no_license
# title: swap-adjacent-in-lr-string # detail: https://leetcode.com/submissions/detail/283683137/ # datetime: Wed Dec 4 22:05:34 2019 # runtime: 40 ms # memory: 12.8 MB class Solution: def canTransform(self, start: str, end: str) -> bool: S = len(start) E = len(end) if S != E: r...
true
186f783697918d3ee963a566a9afccbd1fad78bb
swapnil96/Online-Judge-Contest
/CC_Dec/BASE.py
UTF-8
663
3.5
4
[]
no_license
'''Link - https://www.codechef.com/DEC16/problems/BASE''' import math def root(num, base): var = int(math.pow(num, 1.0/base)) if (var+1)**base == num: return var + 1 else: return var tt = int(raw_input()) for i in xrange(tt): num = int(raw_input()) if num == 0: print 0 ...
true
eded9f83b5824f8cb80c1bb0af67ca9b9f225d4f
anirudhc1229/Advent-of-Code-2020
/aoc2.py
UTF-8
639
3.140625
3
[]
no_license
min = [] max = [] letter = [] password = [] output = [] with open('aoc2input.txt') as fobj: data = fobj.read() lines = data.split("\n") for line in lines: min.append(int(line[0 : line.index("-")])) max.append(int(line[line.index("-") + 1 : line.index(" ")])) letter.append(line[line.in...
true
b4929c60c28ac6b12c8e4580ca73987af9d63712
AlisterH/QGISflowEstimator
/FlowEstimator_utils.py
UTF-8
3,904
2.546875
3
[]
no_license
# -*- coding: utf-8 -*- """ /*************************************************************************** FlowEstimator A QGIS plugin Estimates steady, uniform flow using the Manning equation for trapezoidal and DEM sampled channels. ------------------- ...
true
4a2377f3d4096662691def8fbb6bb0b86bb7cbe1
vinobc/UGE1176
/cond.py
UTF-8
561
3.5625
4
[]
no_license
def main(): # a,b = 20,10 # if a < b: # print("a is less than b") # elif a > b: # print("a is greater than b") # else: # print("a is equal to b") # res = "a is less than b" if (a < b) else "a is greater than or equal to b" # print(res) # i = int(input()) # if i...
true
88eabb735b24d930b3c4351b9253d1ff99b64a89
DtxdF/reverse-shell-sdc
/server.py
UTF-8
1,619
2.734375
3
[ "MIT" ]
permissive
# -*- coding: UTF-8 -*- from core.sdc import Connection from thread import start_new_thread import sys # El Host/IP, si quiere que se detecte coloque: "0.0.0.0" o "" (Una cadena vacia) host = '0.0.0.0' # El puerto donde recibira la conexion port = 8443 # La contrasena que debe ser de 32 caracteres ...
true
301fc38959effa357559706d6b60e136da79cb7e
AnudeeP-1/Codes
/Python/Sample/1.py
UTF-8
345
3.640625
4
[]
no_license
from random import randint x = randint(1,100) trialNo = 1 guess= -1 print(x) while x!=guess : print("Trial %d: " %trialNo, end='') guess = int(input("Enter the number ")) if x == guess: print("Correct number") break elif guess > x: print("Larger") else: print("Small")...
true
3679d32d3c725a31b13f0bd55543c57af5d099db
Amatsukan/SCB---Simple-Cipher-Broken
/enigma.py
UTF-8
4,968
2.71875
3
[]
no_license
import re class PermutationUtils: def permutation(self, char, steps, permutation): if char not in permutation: return char if steps < 0: permutation = self.inverse_permut(permutation) steps *= -1 for i in range(steps): char = permutation[char] return char def inverse_permut(self, permutation): ...
true
d120ed402d8704b4b0b2fa9dbb023128a22da355
AndrewMurd/CSCI1030
/Lab6.py
UTF-8
1,293
4
4
[]
no_license
#Andrew Murdoch #CSCI 1030U #Lab4 #2018-10-25 import random import matplotlib.pyplot as plt ''' size = 15 unsorted_arr = [] unsorted_arr2 = [] for x in range(size): unsorted_arr.append(random.randint(1, 101)) unsorted_arr2.append(random.randint(1, 101)) plt.title("Random Plot") plt.xlabel(...
true
dd4e6de5b4659e814de8432bd9f4d6522f323f58
MichaelM1/Living-Labyrinth
/game.py
UTF-8
20,328
2.671875
3
[]
no_license
import math import random import pygame import items import maze import player pygame.init() pygame.font.init() pygame.mixer.init() pygame.mixer_music.set_volume(0.5) WINDOW = pygame.display.set_mode((1296, 720)) pygame.display.set_caption("Living Labyrinth") CLOCK = pygame.time.Clock() BACKGROUND = pygame.image.load(...
true
57f73c77cfbc42bc1ce72230b9d28de012538870
tech4GT/Image-Processing-Lab
/highPass.py
UTF-8
1,541
2.859375
3
[]
no_license
import cv2 import numpy as np import math # A function to get the iterm or padding item def get(img, x, y, channel): if x < 0: x = 0 if x >= img.shape[0]: x = img.shape[0]-1 if y < 0: y = 0 if y >= img.shape[1]: y = img.shape[1]-1 return img.item(x, y, channel) d...
true
653a53e5d805673d47a2a7fe77ed03673ba080ae
youjeonghan/pytorch_study_iml
/src/Word2Vec/version2/data_handler.py
UTF-8
8,806
3.078125
3
[ "MIT" ]
permissive
import numpy as np from collections import defaultdict from collections import deque np.random.seed(1) class DataHanlder: ''' input data handler for storing/sampling data, etc. ''' def __init__(self, log_filename, min_count=5, sub_sampling_t=1e-5...
true
25e34c737bec94fed0f177d5cd01071eacf4f7c7
smarkuck/Asteroids-NEAT-algorithm
/neat/connection.py
UTF-8
651
3.171875
3
[]
no_license
import random class Connection: def __init__(self, inputNode, outputNode, weight, innovationNumber): self.inputNode = inputNode self.outputNode = outputNode self.weight = weight self.innovationNumber = innovationNumber self.isEnabled = True def mutate(self): rnd...
true
28ffc4d25f44d3c67189011dc709a41a328049e2
u-t-autonomous/heterogenous_assumptions
/Code/samplingprism.py
UTF-8
5,289
2.671875
3
[]
no_license
from __future__ import division import stormpy import stormpy.core import stormpy.logic import stormpy.pars import re import stormpy.examples import stormpy.examples.files import time import numpy as np import time from tqdm import tqdm from gurobipy import * # Approximation of binomial cdf with continuity correctio...
true
ef47320d151d8220b26a83ce0cf561186e1258a7
Wang-Xiaojuan/DataEngine
/Lesson 3/car_cluster
UTF-8
856
3.15625
3
[]
no_license
#!/usr/bin/env python # coding: utf-8 # In[15]: from sklearn.cluster import KMeans from sklearn import preprocessing import pandas as pd #数据加载 data = pd.read_csv('D:\Data Engine\Python\Lesson 3\car_data.csv') train_x = data [["人均GDP","城镇人口比重","交通工具消费价格指数","百户拥有汽车量"]] # 规范化到[0,1]空间 min_max_scaler=preprocessing.MinM...
true
af47b52237471d3d5afd144574bb1c5031553517
harrygreg/Exercicios-LP
/Lp2/Pessoa.py
UTF-8
657
2.6875
3
[]
no_license
class Pessoa(object): def __init__(self): self._nome = None self._email = None self._celular = None def retorna_Nome(self): return self._nome def retorna_Email(self): return self._email def retorna_Celular(self): retur...
true
b7dee8a3d3f2b75aa57152e3fe6207a37cd8e537
MontyThibault/centre-of-mass-awareness
/forcePlates/MayaIntegration/plugin/gridcalibration/generator.py
UTF-8
1,907
3.046875
3
[ "MIT" ]
permissive
## Centre of Pressure Uncertainty for Virtual Character Control ## McGill Computer Graphics Lab ## ## Released under the MIT license. This code is free to be modified ## and distributed. ## ## Author: Monty Thibault, montythibault@gmail.com ## Last Updated: Sep 02, 2016 ## ------------------------------------...
true
329f8a408e4501e3cc75c23df853e997609fb6df
aroranubhav/DailyBit
/MergeIntervals.py
UTF-8
1,066
3.984375
4
[]
no_license
""" Given an array of intervals where intervals[i] = [starti, endi], merge all overlapping intervals, and return an array of the non-overlapping intervals that cover all the intervals in the input. Example 1: Input: intervals = [[1,3],[2,6],[8,10],[15,18]] Output: [[1,6],[8,10],[15,18]] Exp...
true
fdf35dc30b71283c6c65fbcc4a20241f2b92a75f
wleepang/learn
/version_support.py
UTF-8
4,213
2.78125
3
[]
no_license
#!/usr/bin/env python """ A script to gather data about python packages and the versions of python they support Method: Uses PyPI as a list of python packages. This is easier to mine than GitHub and represents the repository that would most commonly be used when users install packages - i.e. via `pip` Lists publish...
true
8d9477e243aba03a996dd6643251dcc1ec5bdc82
dflemin3/CSE_546
/HW1/hw1_7.4.py
UTF-8
11,837
2.703125
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Mon Oct 11 2016 @author: dflemin3 [David P Fleming, University of Washington] @email: dflemin3 (at) uw (dot) edu This file contains routines to answer HW1 Question 7.4 for yelp star data """ from __future__ import print_function, division import validation as val import regres...
true
785cb7286c5139af2dbebd7bc8fc2211dbe45374
zyang22/BinaryRNN
/model.py
UTF-8
3,102
2.515625
3
[]
no_license
import torch import torch.nn as nn from brnn import BRNN, BLinear from utils import smoothBinerazer class RNNModel(nn.Module): """Container module with an encoder, a recurrent module, and a decoder.""" def __init__(self, rnn_type, ntoken, ninp, nhid, nlayers=1, dropout=0., tie_weights=True, use_cuda=True): ...
true
0dfb60cead2652e569fb41c3238db75738dc0439
gwangmin/tools
/socket/python/tcp_echo_server.py
UTF-8
289
2.609375
3
[]
no_license
''' sock.py example ''' import sock HOST = '' PORT = 8322 servSock = sock.sock('tcp', log=True) servSock.bind(HOST, PORT) servSock.listen() s, addr = servSock.accept() while True: s.send(s.recv_with_delimiter('\n')) #s.send(s.recv_fixed_length(3)) s.close() servSock.close()
true
e707f02cb049c977eb24123be87aeaec5a44545b
LearnSphere/WorkflowComponents
/nlpNGrams/program/n_grams.py
UTF-8
12,706
2.71875
3
[]
no_license
#!/usr/bin/env python # coding: utf-8 # In[4]: import argparse import numpy as np import pandas as pd import pathlib import math import matplotlib.pyplot as plt plt.style.use(style='seaborn') from collections import defaultdict from sklearn.model_selection import train_test_split import string import seaborn as sns ...
true
9ad7a179ea4565bf10c88f873744453acb1eb6ae
raz789/ProjectEulerProblems
/util/Prime.py
UTF-8
1,955
3.984375
4
[]
no_license
from itertools import islice class Prime: def __init__(self, limit): self.limit = limit self.plist = [True] * limit self.plist[0] = self.plist[1] = False def __iter__(self): for i, isprime in enumerate(self.plist): if isprime: yield i ...
true