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 |
|---|---|---|---|---|---|---|---|---|---|---|
b27625b24938dddc3c0b9543093d9d9be2f3f5b1 | lucas-kolodzinski/t-i.webapp.selenium | /locators/fake_pages_selectors.py | UTF-8 | 2,372 | 2.515625 | 3 | [] | no_license | __author__ = 'Lucas Kolodzinski'
class FakePagesLocators:
"""Selectors for elements of the rest of training content"""
class PageABtesting:
"""Selectors for: http://the-internet.herokuapp.com/abtest"""
# partial link text
page_link = "A/B"
# tag name
page_header = "h... | true |
45fda476779567e157a49e6c10deb047312930f8 | vsypraktikum/web | /WEB/Klausurvorbereitung/WEB/Praktika/p1/web/p1/webteams/app/database.py | UTF-8 | 3,823 | 2.59375 | 3 | [] | no_license | # coding: utf-8
import os
import os.path
import codecs
import json
#----------------------------------------------------------
class Database_cl(object):
#----------------------------------------------------------
# da es hier nur darum geht, die Daten dauerhaft zu speichern,
# wird ein sehr einfacher Ansatz ve... | true |
ae94fca65a723678accf823a7cdd872216dc2550 | NickMateus11/All-Python-Projects | /TicTacToe/TicTacToe_computer.py | UTF-8 | 1,514 | 3.359375 | 3 | [] | no_license | import random
class computer1:
def __init__(self,game):
self.game = game
def play(self):
moveChosen,betterMove = False,False
availableMoves = self.game.moveSet.count(' ')
attemptedMoveList = []
while availableMoves>0:
self.tempMove = r... | true |
be34d4d2f3a7afc8f7f4a8f3eac0ec78dcc3320a | ZhouningMan/LeetCodePython | /hash_priorityqueue/KthSmallestElementInASortedMatrix.py | UTF-8 | 1,335 | 3.578125 | 4 | [] | no_license | import heapq
class Solution:
"""
@param matrix: List[List[int]]
@param k: a integer
@return: return a integer
"""
def kthSmallest(self, matrix, k):
if k <= 0 or not matrix or not matrix[0]:
raise ValueError(f"matrix = {matrix}, k = {k}")
rows = len(matrix)
c... | true |
76dffc7de160ad4fae5ac2a4af87934019babf5b | hrzp/Singleton-Flask-pattern | /app/common/handlers/response.py | UTF-8 | 500 | 2.546875 | 3 | [] | no_license | from flask import jsonify
class Response:
@staticmethod
def success(message = None,payload = None):
return jsonify({
"isSuccessful":True,
"payload":payload,
"status":200,
"message":message
})
@staticmethod
def failure(message = None,e... | true |
a8054556f629171c4eb4609deb3411e7f195d611 | Kristianuruplarsen/seminar_advanced_microeconometrics | /Code/GEV_MODELLING/likelihood.py | UTF-8 | 1,873 | 2.671875 | 3 | [] | no_license | import numpy as np
import time
class logli:
def __init__(self, data):
self.data = data
self.X = self.data.Xmat
def _Beta(self, betalist, choices, xes):
return np.array(np.array(betalist).reshape(choices,xes))
def generalized(self):
out = np.sum(np.multiply(self.data.Ccol... | true |
79d8234d0224d05a1ba8575a7e99c7ced7654cc8 | zachhornung/django-rest-framework | /bands/tests.py | UTF-8 | 920 | 2.609375 | 3 | [] | no_license | from django.test import TestCase
from django.contrib.auth import get_user_model
from .models import Band
class BandTests(TestCase):
@classmethod
def setUpTestData(cls):
testuser1 = get_user_model().objects.create_user(
username="testuser1", password="pass"
)
testuser1.save()
test_band = Ban... | true |
6305633f06a034a4bcd3a13c0a053302b5f3398f | phtan/sm-tools | /Trafficera-branch2/xmlToShapefile.py | UTF-8 | 9,312 | 2.59375 | 3 | [] | no_license | import os, re
from xml.etree import ElementTree
from shapefileIO import ShapefileWriter, TYPE as SHTYPE
from PyQt4.QtCore import *
from qgis.core import *
class XmlToShapefile(QObject):
# Signal emitted to update progress
prog_sig = pyqtSignal(int)
def __init__(self, xml_path, sh_dir, formula):
QOb... | true |
b6a6115cedc077ce236a1b27e1ff1886bacdae59 | Jhowillies/pdf-merge | /image-to-pdf.py | UTF-8 | 572 | 2.640625 | 3 | [
"MIT"
] | permissive | #!/bin/env/python
import os
from core import get_input_filenames
from core import IMAGE_EXTENSIONS, INPUT_DIRECTORY, OUTPUT_DIRECTORY
from core import convert_to_pdf
def main():
image_filenames = get_input_filenames(INPUT_DIRECTORY, IMAGE_EXTENSIONS)
output_filenames = [f.rsplit('.', 1)[0] + '.pdf' for f in i... | true |
b15062c63952365adb09c2336366d61ebb78def8 | goagain/Contests | /leetcode/889/b.py | UTF-8 | 915 | 3.25 | 3 | [] | no_license | class Solution:
def findAndReplacePattern(self, words, pattern):
"""
:type words: List[str]
:type pattern: str
:rtype: List[str]
"""
ans = []
for word in words:
m = {}
rm = {}
for index in range(len(word)):
c... | true |
535a123f57e48831a0bab282de457e2eb5b4d11f | chwgcc/hogwarts_chw | /test_pytest/tests/fixture1.py | UTF-8 | 680 | 2.765625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
# @Time : 2020/11/15 11:45
# @Author : chw
# @File : fixture1.py
import pytest
from test_pytest.core.calc import Calc
# 查看函数源码的快捷键:ctrl+点击函数名称
# 想要fixture在某一个类中只执行一次,需要修改fixture的scope参数,该参数的默认值为function,即在每一个方法中都执行一次
# scope的可选参数为:function、class、module、package、session(只执行一次)
@pyte... | true |
8cbea840e3d7593958e4bdc7f8b9ce15c59074de | rifatsm/leetCodeFunPractice | /278. First Bad Version.py | UTF-8 | 998 | 4.0625 | 4 | [] | no_license | ####################################
# 278. First Bad Version
####################################
from math import ceil
def isBadVersion(version):
if 1702766719 <= version <= 2126753390:
return True
class Solution(object):
def firstBadVersion(self, n):
left = 1
right = n
while(left < right):
mid = le... | true |
d80dc6b92478e4005abd45a1735aa6c9421ff083 | lydiolectal/terminal-scrabble | /scrabble.py | UTF-8 | 14,537 | 4.03125 | 4 | [] | no_license | # Scrabble - text version
# by Lydia Ding
# 10/09/17
# Fun possible additions:
# Make it possible for user to add in new terms to the Dictionary
# The blank tile freebie in regular Scrabble
# 'AI' player, possibly with varying levels of skill
# Simpler precursor to the AI player: a 'help/hint' function that tells you
... | true |
277953fd4259ddb664dd140c775ca263f81f976e | Larissa-Rodrigues/Python3-CursoEmVideo | /Mundo1/ex013.py | UTF-8 | 359 | 4.53125 | 5 | [
"MIT"
] | permissive | #DESAFIO 013: Faça um algotitmo que leia o salário de um funcionário e mostre seu novo salário, com 15% de aumento.
salario = float(input('Qual é o salário do Funcionário? R$ '))
salario_com_aumento = salario + (salario * 0.15)
print(f'Um funcionário que ganhava R$ {salario:.2f}, com 15% de aumento, passa a receber ... | true |
d456367188af658f06a00d96834d9fc9d6f731e5 | renanstn/exercicios-uri-online-judge | /1116.py | UTF-8 | 316 | 3.328125 | 3 | [] | no_license | # Exercicio referente ao problema numero 1116 do URI ONLINE JUDGE.
# https://www.urionlinejudge.com.br/judge/pt/problems/view/1116
# Por: Renan Santana Desiderio
t = input()
for i in range(t):
n = raw_input().split()
x = float(n[0])
y = float(n[1])
if y==0:
print "divisao impossivel"
else:
print "... | true |
57efdbe964dd07792ae3c22d76094a77662472dd | seandewar/challenge-solutions | /hackerrank/easy/ctci-array-left-rotation.py | UTF-8 | 291 | 3.203125 | 3 | [] | no_license | #!/usr/bin/env python2
# https://www.hackerrank.com/challenges/ctci-array-left-rotation
def array_left_rotation(a, d):
return a[d:] + a[:d]
_, d = map(int, raw_input().strip().split(' '))
a = map(int, raw_input().strip().split(' '))
print ' '.join(map(str, array_left_rotation(a, d)))
| true |
f10da4a1f7f6b0e0fc8e391a67a16a50d26eceee | maxsolberg/CUAutomation | /PythonFiles/Unrelated Math/trianglearea.py | UTF-8 | 165 | 4.125 | 4 | [] | no_license | # Area of a Triangle
# By Jacob Johansen
a= float(input("base of triangle: "))
b= float(input("width of triangle: "))
c=0.5*a*b
print("area of the triangle is: " + str(c))
| true |
83e28e0fddfb1600e6202e35bc47eb7db0996457 | ramesh-khatri/taiko-gauge | /specs/admin/job/payGradePage.spec | UTF-8 | 3,532 | 2.625 | 3 | [] | no_license | # Admin Pay Grade Section Test
## Add pay grade with valid data
* Enter valid Username and Password
* Click "LOGIN" button
* Go to Admin Section
* Go to Job Section
* Click Pay Grades
* Click Add button
* Add Pay Grade name
* Click Save Button
* Verify "Successfully Saved" message is shown
* Enter Currency detail
* Cli... | true |
adb71303714a68bc566fc816450dbe24d3fa284e | Renmusxd/PerturbationLib | /PerturbationLib/Theory.py | UTF-8 | 7,976 | 2.890625 | 3 | [] | no_license | from PerturbationLib import Utilities
from PerturbationLib.Symmetries import Symmetry
from typing import Iterable, MutableMapping, List, Sequence
class Field:
"""
A class containing information about a given field,
maintains a list of multiplets for each symmetry as well
as other important information... | true |
573f0a9eba77bccdc796d6331241a75932a32e9e | Itamar-Farias/TST_P1_UFCG | /unidade2/media_aluno/media_aluno.py | UTF-8 | 205 | 3.21875 | 3 | [] | no_license | # coding: utf-8
# Itamar da Silva Farias 115210021
# Programação I
nota1 = float(raw_input())
nota2 = float(raw_input())
nota3 = float(raw_input())
media = nota1 * 0.2 + nota2 * 0.3 + nota3 * 0.5
print "%.1f" % media
| true |
5edc210b5ef0b9c28e9d66cd0e1e5a9165d5e639 | tfidfwastaken/pyano | /trackGenerator.py | UTF-8 | 2,274 | 2.734375 | 3 | [] | no_license | #trackGenerator
import os
import sys
import subprocess
#Creates directory string of Desktop and Soundtracks(if already created)
if sys.platform.startswith('win'): #Var is assigned 'path of Desktop' (code for windows)
documents = os.path.join(os.path.join(os.environ['USER... | true |
5aa9d2956c1cc4e53a35c7db83c45187fd176757 | HElenZWHU/PhysChem | /net/utils/MaskMatrices.py | UTF-8 | 898 | 2.625 | 3 | [] | no_license | import torch
class MaskMatrices:
def __init__(self, mol_vertex_w: torch.Tensor, mol_vertex_b: torch.Tensor,
vertex_edge_w1: torch.Tensor, vertex_edge_w2: torch.Tensor,
vertex_edge_b1: torch.Tensor, vertex_edge_b2: torch.Tensor):
self.mol_vertex_w = mol_vertex_w
se... | true |
0df8653c52d555bf6b4347880690aaccfa9b3dcc | nikolai-sharp/NAproject3 | /tacoma.py | UTF-8 | 3,815 | 2.78125 | 3 | [] | no_license | # Numerical Analysis 1
# Group Assignment #3 - The Tacoma Narrows Bridge
#
# Authors:
# David Andrews
# Giovanni Arias
# Cameron Bramwell
# William Rooney
# Nikolai Sharp
# Kaiqi Zhang
#delete this
import numpy as np
import matplotlib.pyplot as plt
import math
class tacoma:
def __init__(self, inter, ic,... | true |
90a5f722ec66bff184fb5d0cd388d3c61a65ac7a | phuonglecva/eci-model | /model.py | UTF-8 | 2,960 | 2.609375 | 3 | [] | no_license | from numpy.core.fromnumeric import compress
from data_loader import convert_low2high, get_gdp_data, load_val_from_ggtrends
from sklearn.ensemble import GradientBoostingRegressor
import numpy as np
from pmdarima import auto_arima
import os
import joblib
class ForecastingRegression:
def __init__(self, factors, targ... | true |
67c125fb889cde03818ad3ce17f509fc1232185f | pcmaestro/my_repository | /APUNTES/PYTHON/EJEMPLOS_FORMACION/web02portalAnunciosConCategorias/operaciones_bd/constantes_sql.py | UTF-8 | 1,254 | 2.53125 | 3 | [] | no_license | '''
sql de creacion de tabla:
CREATE TABLE `tabla_anuncios` (
`id` INT NOT NULL AUTO_INCREMENT,
`nombre` VARCHAR(255) NULL,
`precio` DECIMAL(9,2) NULL,
`email` VARCHAR(255) NULL,
`email-valido` VARCHAR(2) NULL DEFAULT 'NO',
PRIMARY KEY (`id`));
'''
#columnas en tabla_anuncios : id , nombre, precio, email,... | true |
9aa18dde30ce66d5da1b1b13f55a4204db2228b3 | carolynemilgo/sightwords | /test.py | UTF-8 | 469 | 2.96875 | 3 | [] | no_license | import requests
BASE = "http://127.0.0.1:5000/"
data = [{"vowel": "a", "name": "hat", "views":10},
{"vowel": "e", "name": "hen", "views":5},
{"vowel": "i", "name": "pig", "views":2} ]
for i in range(len(data)):
response = requests.put(BASE + "word/" + str(i), data[i])
print(response.json()) ... | true |
e130e8b8e19075db40862e3b3169406c106d1c9b | yogeshkhola/python1 | /Datastructure/list.py | UTF-8 | 1,112 | 3.53125 | 4 | [] | no_license | our_list=[12,13,-34,56,34]
print(our_list)
print(type(our_list))
jackson=["A","B","c","D",1,2,3,"Do","Puyi",True,False]
print(jackson[4])
print(jackson[9])
print(jackson[7])
print(jackson[-7])
k=jackson[2]
print(k)
# to get multiple items we do slicing
# i.e - jackson[start:end:step ]
print(jackson[0:10:3])
print(jacks... | true |
5ae22ca019388cb500dce73858940de1498920c6 | MichaelReiter/SENG474 | /Assignment 1/bayes.py | UTF-8 | 3,825 | 3.234375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Michael Reiter
# V00831568
import numpy as np
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.datasets import fetch_20newsgroups
import logging
import sys
from time import time
from math import log
class MyBayesClassifier():
def __init__(se... | true |
f2ddf517b1b25e153f79ff86f6c32ef45b5c032f | zhaijingrong/leetcode | /order_print.py | UTF-8 | 559 | 3.203125 | 3 | [] | no_license | import threading
# 按函数顺序打印字符
""" 使用互斥锁,锁定资源,在"""
def first():
print("first")
job1.release()
def second():
job1.acquire()
print("second")
job2.release()
def third():
job2.acquire()
print("third")
if __name__ == '__main__':
t1 = threading.Thread(target=first)
t2= threading.Threa... | true |
6ff847a32f61c83dc151ba56a066edc38fcbbd84 | esentemov/validation_check_in | /save.py | UTF-8 | 281 | 3.046875 | 3 | [] | no_license | import os
import random
def saveme(data_file):
os.getcwd()
save_data = "database_"+str(random.randint(1, 99999))+".txt"
s = open(save_data, 'w')
s.write(str(data_file) + '\n')
s.close()
print("Файл '" + save_data + "' успешно сохранен")
| true |
dcafddd10852c6fd01d35ec62eb26f96a37bad10 | MalumaDev/bioinf-proj | /download_GDC_data.py | UTF-8 | 6,190 | 2.96875 | 3 | [] | no_license |
import requests
import json
import re
import tarfile
import os
import shutil
'''
----------
getData(disease_type=[], path=".", file_n, unzip=True)
disease_type: list of disease as ["Adenomas and Adenocarcinomas","Squamous Cell Neoplasms"]
path: location where to download and extract genomic files
... | true |
2e3cf693ecb061aa0e8005cbdce5970c051491ef | catcheme/python | /pytest/demo1.py | UTF-8 | 691 | 3.875 | 4 | [] | no_license | # 时间:2021/4/9 17:48
#赋值运算,运算顺序从左到右
i=3+4
print(i)
a=b=c=20
print(a,id(a))
print(b,id(b))
print(c,id(c))
print('----------------支持参数赋值----------------')
a=20
a+=30
print(a) #相当于a=a+30
a-=10
print(a) #相当于a=a-10
a*=2 #相当于a=a*2
print(a)
print(type(a))
a/=3
print(a)
print(type(a))
a//=2
print(a)
a%=3
print(a)... | true |
2073bb9ceec92b95559b3c25172746e2cd579e3a | SeHwanYoo/Deep-Learning-based-Biosignal-Processing | /RAE_apply.py | UTF-8 | 8,209 | 3.078125 | 3 | [] | no_license | """ Biosignal autoencoder practice
KOSOMBE 2019 Summer School of Biomedical Engineering
Deep learning based signal processing: autoencoders & recurrent neural networks
Author: Joonnyong Lee (Seoul National University Hospital, Biomedical Research Institute)
Date: 2019-8-24
"""
# --------... | true |
3f49f8f388d42311b5b3dcc67f7854b6ccdf49a9 | jy-hwang/CodeItPython | /SOLID/Ship_Role.py | UTF-8 | 2,977 | 3.640625 | 4 | [] | no_license | class Ship:
def __init__(self, fuel, fuel_per_hour, supplies, num_crew):
"""연료량, 시간당 연료 소비량, 물자량, 선원 수를 인스턴스 변수로 갖는다"""
self.fuel_tank = FuelTank(fuel)
self.crew_manager = CrewManager(num_crew)
self.supply_hold = SupplyHold(supplies, self.crew_manager)
self.engine = Engine(se... | true |
47b1aeb12d41223f22c67adb04dd694fc67fe316 | vincentgc/Leetcode | /739.Daily Temperature/739.py | UTF-8 | 439 | 3.046875 | 3 | [] | no_license | class Solution(object):
def dailyTemperatures(self, temperatures):
"""
:type temperatures: List[int]
:rtype: List[int]
"""
res = [0 for _ in range(len(temperatures))]
stack = []
for i,v in enumerate(temperatures):
while stack and v > stack[-1][1]:
... | true |
517d9b82505d6e55920165f7991bb83280ca2f90 | upRos3/python_masterclass | /program-flow-control/ifProgramFlow2.py | UTF-8 | 1,195 | 4.78125 | 5 | [] | no_license | age = int(input("How old are you? "))
# if (age >= 16) and (age <= 65):
# can be refactored to:
# if 16 <= age <= 65:
# print("Have a good day at work")
if 16 < age > 65:
print("Enjoy your free time")
else:
print("Have a good day at work")
# Python does not have a boolean data type but instead has two ... | true |
9bb6b7170ed19dbbbda730d7996260af89e23b5a | marvelouscandy/CellOracle | /celloracle/network_analysis/network_structure_analysis.py | UTF-8 | 7,917 | 3.109375 | 3 | [
"Apache-2.0"
] | permissive | # -*- coding: utf-8 -*-
'''
This is a series of custom functions for the inferring of GRN from single cell RNA-seq data.
Codes were written by Kenji Kamimoto.
'''
###########################
### 0. Import libralies ###
###########################
# 0.1. libraries for fundamental data science and data processing
... | true |
8797794e6fd1ee0977928a919668259cf42f422d | aneekroy/ITlab | /asg5/arp_server.py | UTF-8 | 1,283 | 2.828125 | 3 | [] | no_license | import socket
import time
import os
import sys
from uuid import getnode as get_mac
def bind_and_listen(server_socket, port_no):
host_name = ''
server_socket.bind((host_name, port_no))
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.connect(('8.8.8.8', 80))
deviceIP = s.getsockname()[0]
... | true |
6a33c44cdefdc038c8efcaac4f071c72b1500a3f | sowmya89/Kiwi | /Analytics/Sentiment_Classification_Mysql/test_textblob.py | UTF-8 | 2,798 | 2.71875 | 3 | [] | no_license | from textblob import TextBlob
from textblob.sentiments import NaiveBayesAnalyzer
import operator
#import MySQLdb
import mysql.connector
import sys
b= TextBlob(("You are horrible"),analyzer=NaiveBayesAnalyzer())
b1= TextBlob("You are horrible")
print b.sentiment
print b1.sentiment
# Open database connection
DATABASE... | true |
9e736fe08e0c6c86d2458bad503bf42ac44e5a16 | estasney/KVFrame | /kvyouget/custom/scroller.py | UTF-8 | 1,296 | 2.765625 | 3 | [] | no_license | from typing import List
from kivy.core.window import Window
from kivy.properties import ObjectProperty, StringProperty, NumericProperty
from kivy.uix.gridlayout import GridLayout
from kivy.uix.scrollview import ScrollView
from utils import import_kv
import_kv(__file__)
class ScrollingListView(ScrollView):
chil... | true |
1fbda9d9ea5c5efe1f20dd167762d18f29bdf9e7 | fsarachu/python3-essential-training | /03 - Variables, Objects and Values/1_variables.py | UTF-8 | 562 | 4.5625 | 5 | [] | no_license | # In Python 3 EVERYTHING is an object
# Every object has an id, a class type and a value
a = 4
print("id: {}".format(id(a))) # Object id
print("type: {}".format(type(a)))
print("value: {}".format(a))
print("---------------------------")
a = "Hello"
print("id: {}".format(id(a))) # Now 'a' refers to another object
p... | true |
5cbff890117d06fb931cbf30269d68a4dca99c43 | Masha-m/first_repository | /program.py | UTF-8 | 270 | 3.5 | 4 | [] | no_license | my_list = ["5", "65", "90", "127"]
n = 0
while True:
print ("Enter X to exit")
a = input ("Gues a number from the list: ")
if a in my_list:
print ("you are correct!")
if a == "X":
break
else:
print ("try again!") | true |
36816163a5ae72f5b04602f31eb0cf74262db2a5 | Eric-Wonbin-Sang/CS110Manager | /2020F_hw5_submissions/cherukuriharshil/HarshilCP1(HW5).py | UTF-8 | 636 | 4.125 | 4 | [] | no_license | # Pledge: I pledge my Honor that I abide by the Stevens Honor System
def squareValues():
userNumberList = []
squaredNumberList = []
l = int(input("How many numbers are in the list? "))
for i in range(1,l+1):
print("Enter Number",i)
numholder = int(input())
newholder = numholde... | true |
8737c7d98f2ce8c61173b335113b408a70cb42fe | AndriiSokulskyi/UniverStuding2year | /Python/EducPract7/EducPract7.py | UTF-8 | 4,666 | 3.0625 | 3 | [] | no_license | from Strategy import *
from random import randint
from threading import Thread
def position(ll, pos):
if ll.length() != 0:
pos = IntValidation(input('Введіть позицію: '))
if pos < 0:
pos = 0
elif pos >=ll.length():
pos = ll.length()-1
else:
print('Позиці... | true |
2155465dc91a47778cf881e693c6fed7f209e8d1 | BishwasWagle/ANPR | /Main.py | UTF-8 | 9,932 | 2.609375 | 3 | [] | no_license | import cv2
import numpy as np
import os
from tkFileDialog import askopenfilename
import time
#import DetectChars
#import DetectPlates
import PossiblePlate
from Tkinter import *
import pymysql as sq
#import database as db
from database import store,fetch_data
rt=Tk()
rt.geometry("1500x700")
#-------------------... | true |
997ea553199e1e2c0756fa986051c3fd41b2f593 | dsroche/obliv | /tests/test_fstore.py | UTF-8 | 2,657 | 2.953125 | 3 | [
"Unlicense",
"LicenseRef-scancode-public-domain"
] | permissive | #!/usr/bin/env python3
"""Test program for the fstore class."""
import unittest
import tempfile
import random
from obliv import fstore
def randbytes(s):
return bytes(random.getrandbits(8) for _ in range(s))
class TestFstore(unittest.TestCase):
def setUp(self):
tdobj = tempfile.TemporaryDirectory()
... | true |
cd29ec8b4ad36cce322e991a889e2a03e80679df | Aasthaengg/IBMdataset | /Python_codes/p03039/s318463893.py | UTF-8 | 563 | 3.046875 | 3 | [] | no_license | import sys
input = sys.stdin.readline
N,M,K=map(int,input().split())
mod=10**9+7
def Combi2(a,b):#aは大きいが、bは小さいとき
if b>a:
return 0
ANS=1
for i in range(min(b,a-b)):
ANS=ANS*(a-i)*pow(min(b,a-b)-i,mod-2,mod)%mod
return ANS%mod
SUM_N=SUM_M=0
for i in range(N):
SUM_N+=i*(N-i)
for i ... | true |
44e7f9fef13e10e1ec0f2d33bca00ea86bb8e85f | vinodbasalalli/vinb_work | /trial2.py | UTF-8 | 1,423 | 3.4375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Fri Nov 16 18:43:52 2018
@author: vinod
"""
import pandas as pd
import matplotlib.pyplot as plt
from matplotlib import style
style.use('ggplot')
import numpy as np
web_stats = {'Day' : ['A','B','C','D','E','F','G'],
'Window_Shoppers' : [100, 120, 130,... | true |
0f60ab6250b9010cc8e41aaa80636c9d0f2746c8 | kimjinh112/ProblemSolvingAndAlgorithms | /week13/prob2.py | UTF-8 | 503 | 3.34375 | 3 | [] | no_license | class Dog:
def __init__(self, Name, Color, Kind):
self.name = Name
self.color = Color
self.kind = Kind
def sit(self):
print('앉았습니다')
def lay(self):
print('엎드립니다.')
def tail_whip(self):
print('살랑 살랑~')
def bark(self):
print('... | true |
cdaeb7a96114e75b19cf2e66bad54f87be3c472e | samdf96/myrepo | /Assignment_1/Basic_Plots.py | UTF-8 | 4,703 | 2.859375 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Jan 12 05:01:24 2018
@author: sfielder
"""
import yt as yt
#Loading Data from file.
ds = yt.load("~/bigdata/data.0453.3d.hdf5")
ds2 = yt.load("~/bigdata/chk.0453.3d.hdf5")
#Printing Derived Variables to be able to use
for i in sorted(ds.derived_field... | true |
d1dc092564fbc73283bc19c3c2c834d3e49286f5 | le0ra/eplusinterface_diagrams | /sketchup/trunk/workingfiles/test_geometry.py | UTF-8 | 3,973 | 2.703125 | 3 | [] | no_license | #!/usr/local/bin/python
## EPlusInterface (EPI) - An interface for EnergyPlus
## Copyright (C) 2004 Santosh Philip
##
## This file is part of EPlusInterface.
##
## EPlusInterface is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free... | true |
da67c6dd538248b62aff7f2b224592e8e1500a67 | rchangedia/PythonActivities | /PythonTraining/quiz4.py | UTF-8 | 95 | 3.203125 | 3 | [] | no_license | i=7
while i>0:
i-=3
print('*')
if i<=2:
break
else:
print('*')
| true |
f5df37065f9f2a9f196c15251cf21790466d0acd | thawfiqsuhail02/DataStructures | /queuelist.py | UTF-8 | 1,064 | 3.421875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Fri Jan 24 10:31:33 2020
@author: Lenovo
"""
class Node:
def __init__(self,data):
self.data=data
self.next=None
class LinkedList:
def __init__(self):
self.front=None
self.rear=None
def Enqueue(self,da... | true |
c6b299baafeabb82406b2a8e9c63b65c502e8802 | Axe1902/ManyLettersLab-1 | /number_4.py | UTF-8 | 807 | 3.84375 | 4 | [] | no_license | import random
def vector(array, sd, st):
summa = 0
for i in range(st):
for j in range(sd):
summa += array[i][j]
if j == sd-1:
print("Сумма элементов %d-ой строки"%(i+1), summa)
print("Введите минимальный элемент массива:", end=" ")
minimum = int(input())
print("... | true |
c5e8dba010b807a525dcc3e4b9a458587a38686a | xiaohuzhang/binomialvolatility | /binominal_pricing.py | UTF-8 | 2,899 | 3.28125 | 3 | [] | no_license | '''
Created on 1.10.2014
@author: xiaohu zhang
'''
import numpy as np
from scipy.stats import norm
def normpdf(x):
normpdf=np.exp(-x**2/2)/np.sqrt(2*3.1415926)
return normpdf
def blackscholes(s,x,r,v,t):
'''
stock,strike risk free rate volatility time to maturity
return: call delta vega(dollar v... | true |
2e98b3e6a54e3384d6f776a0d0fc44b59463fb63 | reard96/data-structures-and-algorithms | /algorithmic-toolbox/week_4/6_closest.py | UTF-8 | 1,759 | 3.75 | 4 | [] | no_license | #Uses python3
import sys
import math
# utility function for distance between 2 points
def dist(p1, p2):
return math.sqrt((p1[0] - p2[0]) ** 2 + (p1[1] - p2[1]) ** 2)
def min_distance_sorted(x, y):
coordinates = list(zip(x, y))
coordinates = sorted(coordinates, key=lambda x: x[0])
return smallest_dista... | true |
1c41660554b0224cac446d99a98139765ebfe599 | Aasthaengg/IBMdataset | /Python_codes/p03011/s088286698.py | UTF-8 | 75 | 2.59375 | 3 | [] | no_license | l= list(map(int, input().split()))
l.sort
a=l[0]+l[1]+l[2]-max(l)
print (a) | true |
21c63527f6687df8d871d9bce81aabf21fac1b11 | pierre-lebodic/bnb-mip-estimates | /sampling/samplegenerators.py | UTF-8 | 3,438 | 2.71875 | 3 | [
"MIT"
] | permissive | import random as rand
class GenericSG:
def __init__(self,BranchClass,withReplacement,progressmeasure=None,forecast=None):
self.withReplacement = withReplacement
self.branch = BranchClass
self.graphShape = self.branch.graphShape
self.phiBased = self.branch.phiBased
self.bran... | true |
e530bcd5199cec55a555bb916ba5c573b1ba883d | bds511/Flask_app | /Board_App/message.py | UTF-8 | 2,353 | 2.609375 | 3 | [] | no_license | import datetime
from flask import session, request, render_template, redirect, url_for
from Board_App import app
from .model import *
from flask_mail import Mail, Message
mail=Mail(app)
#메시지 보내기
@app.route('/send_message/<int:number>', methods=['GET', 'POST'])
def send_message(number):
if session:
if req... | true |
3b618738162d37353e0f426c24b0aa1d65037626 | prathap03/Kattis | /spavanac.py | UTF-8 | 259 | 3.078125 | 3 | [] | no_license | H,M = list(map(int,input().split()))
if M < 45:
adjustedMinutes = M + 15
if H == 0:
adjustedHours = 23
else:
adjustedHours = H - 1
else:
adjustedMinutes = M - 45
adjustedHours = H
print(F"{adjustedHours} {adjustedMinutes}") | true |
947b5996a16357d743598cec3b5bd342b676f3fd | stevenydc/dianti | /elevator.py | UTF-8 | 3,195 | 3.625 | 4 | [] | no_license | from constants import *
class Elevator():
'''
Elevator controls the logic of elevator movements and passenger loading.
It keeps track of # of passengers it carries (in real life this would be weight), and rejects passenger if full
'''
CAPACITY = 10
def __init__(self):
self.direction = DI... | true |
b402206ea9b9e33211e8271ef011425fed1e8738 | Manju321/FinalCode | /5_Code.py | UTF-8 | 501 | 3.234375 | 3 | [] | no_license |
"""Using Python 3.6
Ans for 4th Program
Write a simple routine that makes a call to the REST end point (http://www.thomas-bayer.com/sqlrest/CUSTOMER/) and prints the response status code and response body"""
from urllib.request import urlopen
url = 'http://www.thomas-bayer.com/sqlrest/CUSTOMER/'
with url... | true |
a97263fbc8cebe20be0a477d8088b726c7febf81 | SmallLogin/UAV_Don | /SingleUAV/Yaw_Angke.py | UTF-8 | 1,013 | 3.1875 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2018/12/7 15:57
# @Author : blvin.Don
# @File : Yaw_Angke.py
import numpy as np
def Angle(x,y,cent):
x = np.array(x)
y = np.array(y)
c = np.array(cent)
x = x - c
y = y - c
# 两个向量
Lx=np.sqrt(x.dot(x))
Ly=np.sqrt(y.dot(y))
... | true |
39a4e812a206418f844c9c98aed9588a902bcb29 | TecProg-20181/T--yesterday_you_said_tomorrow | /chatbot.py | UTF-8 | 1,220 | 2.71875 | 3 | [
"MIT"
] | permissive | import os
import json
import pandas
import yaml
from sklearn.pipeline import Pipeline
from sklearn.feature_extraction.text import TfidfTransformer
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.linear_model import SGDClassifier
class ChatBot:
def chat_bot_start():
"""start the m... | true |
eafb3d7451dd2397ac5d42eadc0dbfd6486786cc | algorithm003/algorithm | /Week_02/id_1/LeetCode_692_01.py | UTF-8 | 792 | 3.234375 | 3 | [] | no_license | # @Author:Kilien
# @lc app=leetcode id=692 lang=python3
# [692] Top K Frequent Words
# https://leetcode.com/problems/top-k-frequent-words/description/
class Solution:
def topKFrequent(self, words: List[str], k: int) -> List[str]:
c=collections.Counter(words)
print(c)
c=dict(c)
maxhe... | true |
f5e42110b119ffc158839132147033c142a64d76 | kentz531/IECEP | /Chapter-01/exercise01.py | UTF-8 | 1,324 | 4.21875 | 4 | [] | no_license | # ------------------------------------------
# INPUT
# ------------------------------------------
print("Budget Calculator . . .")
name = input("What's your Name? ")
budget = input("What is your total Budget for a month? " )
count_apple = input("How many apple/s you consume in a month? ")
count_orange = input("How ma... | true |
cabee530f18a2ed18610bd6432d45c9637b9bb8a | Wewe12/pro-waiter | /Player.py | UTF-8 | 3,259 | 3.21875 | 3 | [] | no_license | import random
from random import shuffle
import time
import Tilemap
import Sprite
class Player(Sprite.Sprite):
# object's constructor overloading
def __init__(self,x,y,texture_down,texture_up,texture_left,texture_right,tilemap):
super(Player,self).__init__(x,y,texture_down)
self.texture_down... | true |
09a0bc6f45872a5fb5a4510827c62047e4a586fc | tborzyszkowski/PythonWyklad | /_08_UnitTest/oop/Calculator.py | UTF-8 | 187 | 3.453125 | 3 | [] | no_license | class Calculator:
def __init__(self) -> None:
self.state = 0
def add(self, number):
self.state += number
def mult(self, number):
self.state *= number | true |
752f0e84abc4dd19379c95c68a51a9dd2bf38f05 | askdfjlas/pokemon-showdown-ai | /replay_learner/get_attributes.py | UTF-8 | 14,222 | 2.78125 | 3 | [] | no_license | # Get attributes given game state objects (current mon and poke lists), and write to a file
from pokemon import *
import tsv_to_2d as tsv
OUTPUT_F = "../data/learning/TRAINING_SET.tsv"
# Move/Pokemon Types
TYPES = {"Normal": 0, "Fire": 1, "Water": 2, "Electric": 3, "Grass": 4, "Ice": 5, "Fighting": 6,
"Poiso... | true |
281712e01c87a1e7b19ed04f99cd42792ffd1530 | hirorylabo/preimage-attacks | /ml/graphs/undirected_graph.py | UTF-8 | 2,324 | 3.140625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import networkx as nx
import matplotlib.pyplot as plt
class UndirectedGraph(object):
def __init__(self, prob, size, max_connections, verbose=True):
self.prob = prob
self.verbose = verbose
self.max_connections = max_connections
self.N, self.n = size # (number of samples, numb... | true |
45b87d8aff8260c6b8b2e0b0fdefbe2cefbebe17 | mate0021/algothink1 | /scratchpad.py | UTF-8 | 419 | 3.640625 | 4 | [] | no_license | a, b = 0, 1
while b < 20:
# print b
a, b = b, a + b
stack = [2, 3, 4]
stack.append(5)
print stack.pop()
print stack
input = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
def f1(x): return x*x
def f2(n): return 2 ** n
print "kwadrat: " + str(map(f1, input))
print "2 ^ n: " + str(map(f2, input))
def sum(x, y): return x +... | true |
7dd1ad41b064f8a15e831c9cca0b14f19bcb1940 | lightsaber-metrics/LightsabersMetrics | /LightsabersMetrics.py | UTF-8 | 2,495 | 2.515625 | 3 | [
"MIT"
] | permissive | from Map import Map
from Berry import Berry
from Set import Set
from Game import Game
from WinCon import WinCon
import numpy as np
from PIL import Image
from mss.windows import MSS as mss
import time
import json
import os
class LSM:
def __init__(self, modules = ["stats", "logging"], scoreboardKey = None):
... | true |
eac0f049848d5495f1ee0fe37b0b283436e57d15 | jamtot/DailyChallenge | /ppm_maker (04jan2016)/ppmaker.py | UTF-8 | 3,255 | 2.96875 | 3 | [
"MIT"
] | permissive | input1 = """5 3
point 0 0 255 0 0
line 100 100 100 0 2 2 4
rect 77 0 0 1 3 2 2"""
challengeInput = """400 300
rect 0 0 255 0 0 300 400
line 255 255 255 0 0 299 399
line 255 255 255 299 0 0 399
rect 200 200 0 100 150 100 100
point 0 0 0 150 200"""
def GetInputText(input):
with open(input) as inputFile:
ret... | true |
89c77b6a43057a6ef0955f8a9422dbbcbc0a4ee7 | charlesCXK/Depth2HHA-python | /getHHA.py | UTF-8 | 2,405 | 2.578125 | 3 | [
"MIT"
] | permissive | # --*-- coding:utf-8 --*--
import math
import cv2
import os
import math
from utils.rgbd_util import *
from utils.getCameraParam import *
'''
must use 'COLOR_BGR2GRAY' here, or you will get a different gray-value with what MATLAB gets.
'''
def getImage(root='demo'):
D = cv2.imread(os.path.join(root, '0.png'), cv2.... | true |
8f293abfea998ce10ae04930911667772d662ab0 | manvitha-tera/project1 | /web/Assignment1/demo1.py | UTF-8 | 108 | 2.9375 | 3 | [] | no_license | class Akhil:
akhil_name="hero"
def Akhil(self):
print("Akhil is Hero")
e1=Akhil()
e1.Akhil() | true |
17bc0cfe8a942b84dff13a8cb30f2e8cb28e4b55 | AdamZhouSE/pythonHomework | /Code/CodeRecords/2718/60602/254722.py | UTF-8 | 623 | 3.078125 | 3 | [] | no_license | def exchangeString(list,string):
judge=True;
i=0;
while(i<len(list)):
if(string[list[i][0]]>string[list[i][1]]):
judge=False;
temp=string[list[i][1]];
string=string[0:list[i][1]]+string[list[i][0]]+string[list[i][1]+1:];
string=string[0:list[i][0]]+tem... | true |
14f32a1376c241eda804f7acdf8535e109ea2fcd | xcabezaderadiox/EDD_Paradigmas | /Documentos/Python/Diagramacion/Ejercicios/1 8.py | UTF-8 | 837 | 3.59375 | 4 | [] | no_license | Alumnos = int(input("Por favor ingrese la cantidad de alumnos por grupo: "))
Grupos = int(input("Por favor ingrese la cantidad de grupos: "))
listapa = []
n = 0
for _ in range(Grupos):
for _ in range(Alumnos):
Nota_1 = int(input("Por favor ingrese el resultado de la primer nota: "))
Nota_2 = int(... | true |
6bd8e2dbefa62b8a7d6dd25d6bbc9a13b2b52574 | tuukka-miettinen/course-vision-server | /search.py | UTF-8 | 296 | 2.640625 | 3 | [] | no_license | import faiss
import numpy
class CourseSearch:
def __init__(self, dimensions):
self.d = dimensions
self.index = faiss.IndexFlatL2(self.d)
def index(self, courses):
nof = len(courses)
vecs = np.zeros((nof, d), dtype=np.float32)
self.index.add(vecs) | true |
2ee1747ff39113cdb1dcbc58e2248732cb27e70f | diegohbrandl/aprendendo-python | /cursoPython/desafio05.py | UTF-8 | 2,707 | 4.4375 | 4 | [] | no_license | #Faça um programa que leia um numero inteiro e mostre na tela seu antecessor e seu sucessor
valor = int(input('Digite o valor! '))
print(' O valor é >> {}\n O antecessor é >> {}\n e o sucessor é >> {}'.format(valor, valor - 1, valor + 1 ))
#Faça um programa que um numero e mostre seu dobro, triplo e a raiz quadrada
... | true |
3277964621382f1025272747e62bd73aa89cd54f | tokaisuDev/Code-Coding-Series | /Python Family/In-book/Middle Book Series/film.py | UTF-8 | 1,415 | 3.390625 | 3 | [] | no_license | woman = ["Một nhà khoa học", "Một nữ hoàng", "Một tên cướp biển", "Một con thỏ khổng lổ"]
man = ["một sĩ quan cảnh sát", "một nghệ sĩ", "ông của bạn", "một rô bốt sát thủ"]
place = ["trên Sao Diêm Vương", "ở siêu thị", "trong một cái hang tối tăm ma quái đầy dơi."]
sheWore = ["bộ đồ lặn biển", "cánh tiên", "một cái túi... | true |
2fd605607caa396c1ccb82fbb9310d662b10f343 | sanyam912/Python-Course | /class (adding the values of objects)(incorrect).py | UTF-8 | 217 | 3.265625 | 3 | [] | no_license | class A:
def __init__(self,a,b):
self.a=a
self.b=b
def __add__(self,other):
return self.a+other.a,self.b+other.b
d=A(10,20)
d1=A(20,30)
d2=A(30,20)
c=d+d1
d3=A(c[0],c[1])
print(d2+d3)
| true |
cc49901d5578e32d33fef427a2e368e9c2bb10ce | cale-i/atcoder | /AtCoder/CODE FESTIVAL 2016 Final.py/B - Exactly N points.py | UTF-8 | 295 | 3.21875 | 3 | [] | no_license | # 2019/08/09
n=int(input())
acc=[0]
for i in range(1,n+1):
acc.append(i+acc[i-1])
if acc[i]==n:
print(*range(1,i+1),sep='\n')
exit()
elif acc[i]>n:
idx=i
break
rem=acc[idx]-n
for i in range(1,idx+1):
if i!=rem:
print(i)
| true |
8119b65dc55ca66acf4800ab469f36d74c17ab13 | DeOlijus/design_patterns | /creational_patterns/factory_method_generic.py | UTF-8 | 1,531 | 3.890625 | 4 | [] | no_license | '''Factory Method:
Provides an interface for creating objects, but lets subclasses decide which
class should be instantiated.
'''
from abc import ABC, abstractmethod
class Factory(ABC):
"""
Factory is an abstract base class. It uses a factory_method that
will create a product instance. (Creator -> Pro... | true |
df3c6e19cbf88bf58458dec72c48fc8af55400b9 | mdebose902/monte-carlo | /pi_animated.py | UTF-8 | 2,060 | 4.34375 | 4 | [] | no_license | #imports turtle, the uniform function and the square root function
from random import uniform
from turtle import *
from math import sqrt
#sets the turtle speed to 0 and draw a circle with radius 200
speed(0)
screensize(1000,1000)
circle (200)
# move the turtle outside the circle and starts drawing the squ... | true |
723f7ed9e07c998e61a40db817638aa3bec4f98e | Kawser-nerd/CLCDSA | /Source Codes/AtCoder/abc118/B/4987482.py | UTF-8 | 337 | 2.890625 | 3 | [] | no_license | # coding: utf-8
N, M = map(int, input().split())
sum = {}
ans = 0
for i in range(0, N):
K = list(map(int, input().split()))
for j in range(1, K[0] + 1):
if K[j] not in sum:
sum[K[j]] = 1
else:
sum[K[j]] += 1
for k in sum:
if sum[k] == N:
ans... | true |
82f84a1c8098f2152e7ac7aac1c1517a29be53cd | fxsheep/8910DM_LVGL | /simulator/lvgl/LVGL.Simulator/lv_examples/src/lv_ex_widgets/lv_ex_table/lv_ex_table_1.py | UTF-8 | 986 | 2.921875 | 3 | [
"MIT"
] | permissive | table = lv.table(lv.scr_act(), None)
table.set_col_cnt(2)
table.set_row_cnt(4)
table.set_size(200,200)
table.align(lv.scr_act(), lv.ALIGN.CENTER, -15, 0)
# Make the cells of the first row center aligned
table.set_col_width(0,100)
table.set_cell_align(0, 0, lv.label.ALIGN.CENTER)
table.set_cell_align(0, 1, lv... | true |
3cfad548e875ad58be83860809d576f6df971bc8 | TracyEOBrien/341 | /scraper.py | UTF-8 | 1,353 | 2.71875 | 3 | [] | no_license | from bs4 import BeautifulSoup
import urllib
def getcontent(url):
try:
page = BeautifulSoup(urllib.urlopen(url).read())
#find title
name = page.find('h1', id='itemTitle')
print(name.string)
#find photograph
photo = page.find('img', id='imgPhoto', itemprop='i... | true |
c245019d390ec876a7764009827a33fa665b585a | Kunal57/MIT_6.00.1x | /final/problem4.py | UTF-8 | 2,377 | 4.21875 | 4 | [
"MIT"
] | permissive | # Problem 4
# 20.0 points possible (graded)
# You are given the following definitions:
# A run of monotonically increasing numbers means that a number at position k+1 in the sequence is greater than or equal to the number at position k in the sequence.
# A run of monotonically decreasing numbers means that a number at... | true |
b520678894612e0c1dd9846c32a21d3ad915d379 | lily-x/image-style-transfer | /style_transfer/transfer.py | UTF-8 | 13,069 | 2.578125 | 3 | [] | no_license | import copy
import matplotlib.pyplot as plt
import numpy as np
import os
import skimage.io
import tensorflow as tf
import pdb
from ext.tf_vgg import vgg19, utils
from optimize import SGD
PAUSE_LEN = 0.01 # length to pause when displaying plots
NUM_CHANNELS = 3 # number of color channels
class Transfer:
def... | true |
4d6d50d31a377a618e6a0a4f99195e27aefccef7 | Toast3y/DungeonDelverRoguelike | /rng.py | UTF-8 | 1,995 | 3.265625 | 3 | [] | no_license | #simple GUI
from Tkinter import *
from ttk import *
##class ApplicationWindow:
##Class that assembles the main window to display the application
##End of class
##Functions on calling actions from the menu
#file_menu
def file_hello():
print "Hello World!"
def file_new():
print "New Map"
f3 = Frame(notebook)
n... | true |
d85f7834a96cb0665a6cafabc42b9548216f58fb | utiasDSL/safe-control-gym | /safe_control_gym/controllers/mpc/mpc_utils.py | UTF-8 | 3,781 | 2.90625 | 3 | [
"MIT"
] | permissive | '''General MPC utility functions.'''
import numpy as np
import casadi as cs
import scipy
from safe_control_gym.envs.constraints import ConstraintList
def get_cost_weight_matrix(weights,
dim
):
'''Gets weight matrix from input args.'''
if len(weights) == ... | true |
73bcefe3a5e53b37fa6a0740e138f41046902cef | mindspore-ai/mindspore | /tests/ut/python/pipeline/parse/test_use_local_vaiable.py | UTF-8 | 6,142 | 2.71875 | 3 | [
"Apache-2.0",
"LicenseRef-scancode-proprietary-license",
"MPL-1.0",
"OpenSSL",
"LGPL-3.0-only",
"LicenseRef-scancode-warranty-disclaimer",
"BSD-3-Clause-Open-MPI",
"MIT",
"MPL-2.0-no-copyleft-exception",
"NTP",
"BSD-3-Clause",
"GPL-1.0-or-later",
"0BSD",
"MPL-2.0",
"LicenseRef-scancode-f... | permissive | # Copyright 2023 Huawei Technologies Co., Ltd
#
# 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 at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... | true |
c2848cfff31a7bcced549b2c669f05cccb60b67b | sanchit247/my-codes | /pythonCodes/day92.py | UTF-8 | 261 | 3.546875 | 4 | [] | no_license |
# insertion sort
from random import randint
size =randint(1,100)
a=[]
for i in range (size):
a.append(randint(1,150))
i=0
while(i!=len(a)-1):
if(a[i]>a[i+1]):
a[i],a[i+1] = a[i+1],a[i]
i=0
else:
i+=1
print(a) | true |
27582e2bd66281e6e2ea842b6981df7f61b868db | 1van-me/telebot | /ivan-me/11.py | UTF-8 | 773 | 3.234375 | 3 | [] | no_license | def add_user(store):
user = raw_input('Create Username: ')
password = raw_input('Create Password: ')
if user in store:
print ("That user already exsist")
return False
else:
store[user] = password
return True
global_store = dict()
for i in range(10):
add_user(global_s... | true |
c1f5a566f1352d1190050fe8779cd1db9d3aca81 | upk240z/monitor | /app/packages/core/db/database.py | UTF-8 | 1,860 | 2.625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import sys
from core.db.resultset import ResultSet
class Database:
def __init__(self, config):
self.config = config
self.db = False
self.cursor = False
def connect(self):
print("This is abstract class!")
sys.exit()
def execute(self, sql, pa... | true |
287c6eaa6aeb566d206b48d2d41444b655f61d4e | zhangxinyao88/Anomaly-based-Intrusion-Detection-System | /ngc.py | UTF-8 | 1,501 | 2.828125 | 3 | [] | no_license | import numpy as np
import pandas as pd
K = 10 # internal layer
epsilon = 0.01
MaxItr = 10
path = 'Train_data_cleaned-2.0.1.csv'
df = pd.get_dummies(pd.read_csv(path)).values
N, D = df.shape
D -= 2
X = df[:, 0:D]
Y = df[:, D:]
print(X.shape)
print(X[:5, :])
print(Y.shape)
print(Y[:5, :])
'''
path = 'Train_data_clea... | true |
e97b86bcefec8181c70f25b1b98b0ff430e6fcd4 | kaleliguray/python_btkakademi | /ileriPython/variablesDemo.py | UTF-8 | 765 | 3.578125 | 4 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
"""
1- Bir müşterinin aşağıdaki bilgileri içeren değişken oluşturunuz
adı,soyadı,ad + soyad, cinsiyet,tc kimlik, doğum yılı, adres bilgisi, yaşı
"""
customerName = "Guray"
customerSurname = "Kaleli"
customer = customerName + " " + customerSurname
customerGender = True # Male => tru... | true |
0340f0d047e53005c25897c47815b184cdc02ef5 | Avinash110/LeetCode | /Stacks/32 Longest Valid Parentheses/test.py | UTF-8 | 197 | 3 | 3 | [] | no_license | from Solution import Solution
sol = Solution()
assert(sol.longestValidParentheses(")()") == 2)
assert(sol.longestValidParentheses("()()") == 4)
assert(sol.longestValidParentheses("((())))") == 6) | true |
7e47098d85b6040b926858c4f3dc18ce18a2f4d0 | meganJalen/adventuresinraspberrypi_chapter4 | /FirstTurtle.py | UTF-8 | 219 | 3.5 | 4 | [] | no_license | import turtle
John = turtle.Turtle()
John.shape("turtle")
John.forward(100)
John.left(72)
John.forward(100)
John.left(72)
John.forward(100)
John.left(72)
John.forward(100)
John.left(72)
John.forward(100)
John.left(72)
| true |
816844385dd5d09f3119f3bbe8151166e115b156 | youm/scipy-tutorials | /source/scientific/laplacien.py | UTF-8 | 4,276 | 2.953125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
ifmain = __name__ == '__main__'
size = 5
image = [[0 for j in range(size)] for i in range(size)]
image[size/2][size/2] = 1
from copy import deepcopy
image2 = deepcopy(image)
def laplacien():
for i in xrange(1, size-1):
for j in xrange(1, size-1):
image2[i][j] = (image[... | true |