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 |
|---|---|---|---|---|---|---|---|---|---|---|
5a7aae7b964d9a089deff9612f0494b3227a643b | s262680/Python_Selenium_Practice | /SeleniumProject/UnitTestingFramework/TestCase3 (UnitTesting-Setup & TearDown).py | UTF-8 | 1,281 | 3.296875 | 3 | [] | no_license | import unittest
# A setUpModule method will be executed before any class or method present in the test case class
def setUpModule():
print("setUpModule")
# A tearDownModule method will be executed after completion of everything present in the test class
def tearDownModule():
print("tearDownModule")
TC = uni... | true |
9d058a986ee736df8dd5b5d11ddecc2afacbe093 | jakemiller13/School | /UCSanDiegoX DSE200x - Python for Data Science/Week 2/Dickens_Word_Count.py | UTF-8 | 514 | 3.046875 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Jan 7 06:24:05 2019
@author: Jake
"""
import string
text = open('./word_cloud/98-0.txt')
punctuation = set(string.punctuation)
word_cloud = {}
for word in text.read().lower().split():
word_set = set(word)
for char in word_set.intersection(s... | true |
bb855f78d628655a33e11dfa886074e0837e6d9a | vkramanuj/willow | /python/data.py | UTF-8 | 891 | 3.140625 | 3 | [] | no_license | """ Generic data class for data processing
Author: Vivek Ramanujan, (Pato)
"""
from random import shuffle
class Data(object):
def __init__(self, data, batch_size, shuf=True, logger=None):
self.logger = logger
self.data = data
self.shuffle = shuf
if self.shuffle:
shuffle... | true |
13620db385ade84a94cb0adbb4f1fff87511d04e | AlenaPiskareva/Tensor | /hw6-7_advanced.py | UTF-8 | 6,919 | 3.875 | 4 | [] | no_license | import math
import cmath
from functools import reduce
# Решение задач с ранних уроков под *
# Задача 1. XOR-шифрование. Выполнение представлено в файле hw6_xor.py
def xor_secret():
print('Выполнение представлено в файле hw6_xor.py')
# Задача 2. Частота использования цифр в диапазоне чисел.
def freq_digits(firs... | true |
b2a6f1a4dca7465c35ae2e2310549c1b4f675c5b | erwin-esgs/calculatorpython | /calculator.py | UTF-8 | 7,164 | 3.203125 | 3 | [] | no_license | import tkinter as tk
from tkinter.ttk import*
master = tk.Tk()
master.title("Calculator Sederhana")
master.geometry("350x150")
value = 0
operation = []
v = tk.StringVar()
entry1 = tk.Entry(master, text=v, width=40)
v.set(str(value))
entry1.configure(state='readonly')
entry1.grid(row=0, column=0, columnspan=3)
def ... | true |
de9479348fe8ccdedfa067fecb850babfe6933da | mucollabo/py100 | /016.py | UTF-8 | 841 | 4 | 4 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Jun 16 22:04:27 2020
@author: charles
"""
import pandas as pd
# dictionary를 데이터프레임으로 변환
dict_data = {'c0':[1, 2, 3, 4, 5], 'c1':[6, 7, 8, 9, 10]}
df1 = pd.DataFrame(dict_data)
print(type(df1), "\n")
print(df1, "\n")
# 행 이름 지정
df2 = pd.DataFrame(dict... | true |
862b00f9ee6fcb2924d04918dca90dca16fd6c0a | dororich/AtCoder | /日立製作所 社会システム事業部 プログラミングコンテスト2020/A - Hitachi String.py | UTF-8 | 200 | 3.125 | 3 | [] | no_license | S = input()
if len(S) != (S.count('h') + S.count('h')):
print('No')
else:
if S.count('h') == S.count('i') and S.count('i') == S.count('hi'):
print('Yes')
else:
print('No')
| true |
3b877aa5aa4d294eaa6de709a16fec314763dbe8 | varun-vijayakumar/learning-Python | /singe_level_inhertiance.py | UTF-8 | 1,725 | 3.78125 | 4 | [] | no_license | # This is a sample Python script.
# Press ⌃R to execute it or replace it with your code.
# Press Double ⇧ to search everywhere for classes, files, tool windows, actions, and settings.
class Animal:
name = "animal"
def __init__(self, color, type):
self.color = color
self.type = type
def g... | true |
4c4c66344b90f4e4fa26461f2dca8f8fd461936c | bortoliotavio/python | /p,p,t/p,p,t/p_p_t.py | UTF-8 | 735 | 3.453125 | 3 | [] | no_license | option1 = ''
while option1 != 'exit':
option1 = str(input('JOGADOR 1: Escolha pedra papel ou tesoura: '))
option2 = str(input('JOGADOR 2: Escolha pedra papel ou tesoura: '))
if option1 == option2:
print ('EMPATE')
elif option1 == 'pedra' and option2 == 'tesoura' or option1 == 'tesoura' a... | true |
005f1878ea2dc1981883cacc6c941d96a1653f3d | DanielBeeman/CIS-313 | /Assignment4/AssignmentFour3.py | UTF-8 | 9,292 | 3.0625 | 3 | [] | no_license | import sys
sys.setrecursionlimit(10000000)
lis = [] #The list that'll do the inorder walk and print it out.
class Node:
def __init__(self, key, color, value):
self.key = key
self.color = color
self.left = value
self.right = value
self.p = value
class RedBlackTree... | true |
b043360ed608cc3dbad5dee75c0b7a49a13e6ad3 | timLarocque/mlhHackAE | /admin-ui/cityecho/echopy/Main.py | UTF-8 | 3,982 | 3.1875 | 3 | [] | no_license | #main file for CityEcho
import json
class Main:
def __init__(self, list):
self.unsorted = json.loads(list)['result']
#gets data from report
def PullData (self, already, unsorted):
if already == len(unsorted):
return (None, None, None, None, None)
st_num =... | true |
b26eb4cc5138fca781633c5872e4f9faae92fe08 | rahulsiddharthdacha/bleugenData | /web_scrapping_2.py | UTF-8 | 948 | 3.15625 | 3 | [] | no_license | import requests
from lxml import html
import pandas as pd
items = []
url = 'https://scrapeme.live/shop/page/{}/'
for i in range(1, 11):
response = requests.get(url=url.format(i))
html_text = response.text
html_response = html.fromstring(html_text)
rows = html_response.xpath('//ul[@class="produc... | true |
3d9a950de2699858135302aa6f5364994800b70a | ceth-x86/programming-challenges | /project-euler/Problem_03/problem_3.py | UTF-8 | 196 | 3.15625 | 3 | [] | no_license | def problem_3(num):
f = 2
while num > 1:
if num % f == 0:
num = num / f
else:
f = f + 1
return f
print problem_3(600851475143)
| true |
8764b57688e378aea7bbf2cb703c42d33bf9b2e1 | mishrakeshav/Competitive-Programming | /Code Forces/Problem Set/B/young_physicist.py | UTF-8 | 180 | 3.140625 | 3 | [
"MIT"
] | permissive | X,Y,Z = 0,0,0
for t in range(int(input())):
x,y,z= map(int,input().split())
X += x
Y += y
Z += z
if (X,Y,Z) == (0,0,0):
print("YES")
else:
print("NO")
| true |
f7c97edef2dc34a6d90a1018bc7b6a71bbf18ace | marlinpohlman/bioinformatics | /ProfileGeneratedString.py | UTF-8 | 3,398 | 2.640625 | 3 | [] | no_license | import sys, argparse, random
from gooey import Gooey, GooeyParser
CL_Flag = False
init_length = len(sys.argv)
if init_length >= 2:
if not '--ignore-gooey' in sys.argv:
sys.argv.append('--ignore-gooey')
CL_Flag = True
else:
CL_Flag = False
@Gooey(program_name="ProfileGeneratedStr... | true |
c2703958c3a1c89954eb8c1b14572414844f3604 | ScofiledGao/python_grammar | /py1.py | UTF-8 | 4,603 | 3.09375 | 3 | [] | no_license | # -*- coding:UTF-8 -*-
import requests
import re
import random
from bs4 import BeautifulSoup
def get_qiushibaike():
content = requests.get('http://www.qiushibaike.com').content
soup = BeautifulSoup(content, 'html.parser')
for div in soup.find_all('div', {'class':'content'}):
print div.text.strip()
def de... | true |
b044e1252fdd7118d925d983a7a30918d7933b40 | benjamingorman/whoosh | /tests/graphics/camera_test.py | UTF-8 | 1,943 | 3.390625 | 3 | [
"MIT"
] | permissive | import unittest
import random
from whoosh.graphics.camera import Camera
from whoosh.maths import Vec2f
class TestCamera(unittest.TestCase):
def test_zoom(self):
cam = Camera()
# Test that zoom is limited to min/max
cam.zoom(1.0)
cam.zoom(1.0)
self.assertEqual(cam.current_... | true |
c5fab9dd91eae4197e0b39ac30b958e3b241eb84 | waitsfornone/munchkin | /utils/player_utils.py | UTF-8 | 5,229 | 2.5625 | 3 | [] | no_license | __author__ = 'time'
# import models
import ast
import utils.player
def class_check(obj,player):
class_limit = ast.literal_eval(obj.class_limit)
if len(class_limit) > 0:
for rec in class_limit.keys():
if rec not in player.card_class and class_limit[rec]:
print("Your class c... | true |
e734079d32b5569e04560397c0160c6f7ac7ee99 | lbeuk/baseconverter | /converter.py | UTF-8 | 2,712 | 3.953125 | 4 | [] | no_license | # Convert from any base to decimal
# Allbases holds up to base 36
allbases = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"]
# Settings
base_from = input("BASE TO CONVERT FROM: ")
base_... | true |
8de7542e363a49f91f31aa2389738838384dc430 | lukenrichard/Blackjack | /Player.py | UTF-8 | 2,538 | 3.953125 | 4 | [] | no_license | from CardLettersToNumbers import cardLettersToNumbers
from CardNumbersToLetters import cardNumbersToLetters
# Player class is used for both VisitingTourist and Dealer classes, includes all basic methods and attributes needed for the Blackjack game.
class Player:
# Initialize any Player object with an empty arra... | true |
1ea8c1f025e678c161b6438f94ece49d4832226d | Estevao-Nicolau/Problemas-resolvidos-em-Python | /Uri.1270.Exibindo_Tabuadas.py | UTF-8 | 476 | 3.75 | 4 | [] | no_license | def desenho_tabuada(numero):
for i in range(1,11):
print(f'{numero} x {i} = {i*numero}')
print("-" *10)
def pegar_numeros(a,b):
numeros = []
for x in range(a,b+1):
numeros.append(x)
return numeros
n1 = int(input())
n2 = int(input())
if n2<n1:
print('Nenhuma tabuada no interva... | true |
83cfc207113b301eabaa84519017e1f95184e47f | JMPercival/enterChoice | /choose/tests.py | UTF-8 | 1,613 | 2.65625 | 3 | [] | no_license | from django.test import TestCase
from random import random
from choose.models import Choices,Rolls
# Create your tests here.
class chooseInputTestCase(TestCase):
def setUp(self):
#next three are valid
Choices(choice='one', ip='111.222.333.444').save()
Choices(choice='two', ip='111.222.333.444').save()
Choices... | true |
02274319a06c783cfca25e635318b82ba391a105 | A-Giordano/LSTM_Step_Detector_explained | /code/raw_data_to_clean_csv.py | UTF-8 | 1,015 | 2.734375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Thu Jul 11 19:19:55 2019
@author: SDis
"""
import Data_manager
from sklearn.preprocessing import MaxAbsScaler
path = r'D:/00 Strathclyde/Final_Project/steps_records'
t_steps=50
mean_value=3
"""add all file cleanded from file's dir"""
sensor_df = Data_manager.get_data_from_dir... | true |
9ccfe805049695558f860b368bf733852fd93788 | kunal768/IET-Makeathon-Smart-Farm-Industrial-IOT | /IET-Makeathon/scripts/ml_script.py | UTF-8 | 813 | 2.703125 | 3 | [] | no_license | from sklearn.linear_model import LinearRegression
from sklearn.model_selection import train_test_split
import pandas as pd
import numpy as np
data = pd.read_csv("C:\\Users\\Kunal K.S. Sahni\\Desktop\\IET-Makeathon\\new_data.csv")
# data = data.fillna(lambda x: x.median())
data = data.fillna(method='ffill')
... | true |
606249bab5415dbd47cbf3d49386a1bcc38b1b86 | GraphRepTeam/GraphicRep | /GraphStorage/Graph.py | UTF-8 | 3,063 | 2.71875 | 3 | [] | no_license | import networkx
from Utils.functionsLib import *
class EntityPeriodGraph:
def __init__(self, entity, period):
self.entity_name = entity
self.reported_period = period
self.graph = networkx.MultiGraph()
def update_dp(self, tid, dp_name, dp_value):
if not self.graph.has_node(dp_... | true |
616f7828f6b8b34cf1f61c055feb98e9186dbea4 | newsapps/tarbell-0.8 | /base/config.py | UTF-8 | 4,851 | 2.75 | 3 | [
"MIT"
] | permissive | from jinja2 import evalcontextfilter, Markup
from time import time
import re
import dateutil.parser
import dateutil.tz
from flask import Blueprint
import markdown as Markdown
import os
URL_ROOT = ''
DOMAIN = 'http://tarbell.tribapps.com'
blueprint = Blueprint('base', __name__)
def static_url(project, path):
"""G... | true |
c3639032bd1eb326f7bb09ee73e776b355930b3c | axelwass/federated-learning-network | /server/training_client.py | UTF-8 | 389 | 2.734375 | 3 | [
"MIT"
] | permissive | from .client_training_status import ClientTrainingStatus
class TrainingClient:
def __init__(self, client_url):
self.client_url = client_url
self.status = ClientTrainingStatus.IDLE
self.model_params = None
def __str__(self):
return "Training client:\n--Client URL: {}\n--Status:... | true |
a32133283e3fc475b202802ea106b86d9b65c203 | oandersonx/gop | /ClientMachine/ClientMachine.py | UTF-8 | 687 | 2.8125 | 3 | [] | no_license | import json
import socket
from time import gmtime, strftime
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
while True:
try:
ip = "192.168.0.123"
s.connect((ip, 9999))
break
except Exception as e:
print("ERRO..Possivel problema na rede..")
break
while True:
... | true |
a8d7e0db320d7e89b9fae8b5d6dfd079c4ae037d | Aasthaengg/IBMdataset | /Python_codes/p03471/s033523422.py | UTF-8 | 211 | 2.6875 | 3 | [] | no_license | N,Y=map(int,input().split())
answer=[-1,-1,-1]
for x in range(N+1):
for y in range(N-x+1):
z=N-x-y
A=Y-10000*x-5000*y-1000*z
if A==0:
answer=[x, y, z]
print(*answer) | true |
fecfab8fca7f22f67019cd35509d2768c6396502 | donkpixi/lowtran | /lowtran/__init__.py | UTF-8 | 4,641 | 2.71875 | 3 | [
"MIT"
] | permissive | """
Michael Hirsch
Python wrapper of the venerable LOWTRAN7 atmospheric absorption and solar transmission
model circa 1992.
Note: specified Lowtran7 model limitations include
wlcminvstep >= 20 cm^-1
0 <= wlcminv <= 50000
historical note:
developed on CDC CYBER, currently runs on 32-bit single float--this can cause lo... | true |
48a8f84922765c1de7d53e5d1d5c9f8dc30aea5e | 0cto98/Clustering-Algorithm | /test_graph.py | UTF-8 | 635 | 3.28125 | 3 | [] | no_license | from graph import *
def test_add_edge():
g = Graph()
g.addEdge('a',1)
assert g.edges == [('a',1)]
def test_count_edges():
g = Graph()
g.addEdge('a',1)
g.addEdge('b',2)
g.addEdge('c',3)
g.addEdge('d',4)
assert g.count_edges()==4
def test_graph_eq():
g = Graph()
g.addEdge('a... | true |
14e3bba05dbe7b728b79c7244ac85c2808d19835 | DrorEf/pythonCourse3.6.5 | /118 - 123/sampleBox/samps - Copy.py | UTF-8 | 506 | 2.65625 | 3 | [] | no_license | from kivy.app import App
from kivy.uix.gridlayout import GridLayout
from playsound import playsound
import time, threading
def runSound(soundName):
playsound(soundName)
class rootWidget(GridLayout):
def playSound(self, s):
eg = threading.Thread(target=runSound,
args=(),
... | true |
987d4ea7a40e819630508066ea613a7e3d0d5b92 | birtnieva/PythonCodesRepository | /HackerRankSolutions/alternatingCharacters.py | UTF-8 | 344 | 3.46875 | 3 | [] | no_license | #!/bin/python3
t = int(input().strip())
for i in range(0,t):
str = input().strip()
c = [s for s in str]
curr = 0
deletion = 0
while curr != len(c)-1:
if c[curr] == c[curr+1]:
del c[curr+1]
deletion = deletion + 1
else:
curr = curr+1
print(... | true |
d2bb378511bc70359cca142fbc38cb727350ede1 | jonathancox1/Python102 | /day_of_the_week.py | UTF-8 | 580 | 4.75 | 5 | [] | no_license | #prompt user for a number 0-6 to be converted to a day of the week
day = int(input('Enter a day as a number (0-6) and Ill tell you the day of the week '))
#create a default prompt
prompt = 'Your chosen day is:'
#determin the numerical value of the day from the user input
if day == 0:
print(f'{prompt} Sunday')
eli... | true |
dffdc52fac5cead39f6a1d08ea12c47415329522 | SCUZxin/DiDiTaxi | /plot/total_flow/plot_weather.py | UTF-8 | 965 | 2.671875 | 3 | [] | no_license | # 分析天气数据的分布,各个天气下订单量的多少等?取影响较大的区域,而不是整体流量? 这点还没做
import pandas as pd
import numpy as np
import Tools.funcTools as ft
import os
from datetime import datetime
# 以30min为时间间隔,将30min内的天气 weather, temperature, pm2.5 提取总结出来,并写入 weather.csv文件
def weather_analysis(file_list, time_interval_para=30):
pass
if __name__ == ... | true |
dd4b36fb36599248f123ae2a64f7c35119925b19 | Jiaaale/pymartini | /bench.py | UTF-8 | 879 | 2.875 | 3 | [
"MIT",
"ISC"
] | permissive | from time import time
from imageio import imread
from pymartini import Martini, decode_ele
path = './test/data/fuji.png'
fuji = imread(path)
terrain = decode_ele(fuji, 'mapbox')
start = time()
martini = Martini(fuji.shape[0] + 1)
end = time()
print(f'init tileset: {(end - start) * 1000:.3f}ms')
start = time()
tile... | true |
2d0e285aa4001e53f4561c6922ebf28c2c18323a | Azraero/snp_index | /tests/test_models.py | UTF-8 | 2,129 | 2.609375 | 3 | [] | no_license | import unittest
import datetime
from flask import current_app
from app.auth.models import User
from app.app import create_app
from app.exetensions import db
class UserTestCase(unittest.TestCase):
"""User tests."""
def setUp(self):
self.app = create_app('test')
self.app_context = self.app.app_c... | true |
ce04d1a20e6c04bcd3e83e91427e29a84d81697e | SamAmco/ProjectEulerSolutions | /22.py | UTF-8 | 331 | 3.515625 | 4 | [] | no_license | import re
def LetterScore(s):
score = 0
for c in s:
score += ord(c.lower()) - 96
return score
with open('p022_names.txt', 'r') as f:
regex = re.compile(r'\w+')
names = regex.findall(f.read())
sortedNames = sorted(names)
s = 0
index = 1
for name in sortedNames:
s += LetterScore(name) * index
index += 1... | true |
97a881d7d6ca4b12895f533a3bb4979597d5602b | neha-58/assignments | /relations/rel.py | UTF-8 | 1,804 | 3.015625 | 3 | [] | no_license | def is_reflexive(X, R):
for i in range(len(X)):
if R[i][i] == 0:
return False
return True
def is_irreflexive(X, R):
for i in range(len(X)):
if R[i][i] == 1:
return False
return True
def is_not_reflexive(X, R):
for i in range(len(X)):
if R[i][i] == ... | true |
dd5693f9a58c8ebf0dff9b630238ac70c25ea231 | SamH1999-eng/Projects | /Space Invaders/main.py | UTF-8 | 7,174 | 3 | 3 | [] | no_license | import pygame
import sys
from player import Player
import obstacle
from alien import Alien, Extra
from random import choice, randint
from laser import Laser
class Game:
def __init__(self):
# Player setup
player_sprite = Player((screen_width // 2, screen_height), screen_width, 5)
self.playe... | true |
b8713989afc1252adbd8463bf66c81d46945bbdc | sandeep-v1404/DSA | /Striver Sheet/Arrays/18_revpairs.py | UTF-8 | 1,370 | 3.625 | 4 | [] | no_license | # Reverse Pairs (Leetcode)
# https://leetcode.com/problems/reverse-pairs/
# Time Complexity: O(nlogn), Space Complexity: O(n)
arr = [1,3,2,3,1]
def reversePairs(nums):
def merge(nums, low, mid, high):
ct = 0
j = mid+1
for i in range(low, mid+1):
while(j<=high and nums[i]>(2*nu... | true |
0b0e324fd2c74a5d2283d8ac0357c797d0401912 | KrutikaKothawale/MusicMood | /Assignment_4/build_and_train_model.py | UTF-8 | 2,842 | 2.9375 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# In[1]:
from sklearn.linear_model import LogisticRegression
from sklearn.metrics import confusion_matrix
from sklearn.metrics import classification_report
import matplotlib.pyplot as plt
import seaborn as sns
import keras
from keras.models import Sequential
from keras.la... | true |
2cb96fc84473644354b6a8953b5de17ba1dc37ec | thekatezhou/CS313E | /Train.py | UTF-8 | 3,965 | 3.53125 | 4 | [] | no_license | # File: Train.py
# Description: use Turtle graphics to draw train
import math, turtle
def drawRect(t, x1, y1, x2, y2, color='blue', fill=False): # UL to LR
if fill:
t.fillcolor("#A9A9A9")
t.begin_fill()
drawLine(t, x1, y1, x2, y1, color=color)
drawLine(t, x2, y1, x2, y2, color=... | true |
be6317fdee59242d85fdbec8bb7240245b04f7d2 | ipwnponies/cryptopals_challenge | /set1/challenge2.py | UTF-8 | 459 | 3.140625 | 3 | [] | no_license | import codecs
from util import xor
def main():
input_string = '1c0111001f010100061a024b53535009181c'
xor_string = '686974207468652062756c6c277320657965'
value1 = codecs.decode(input_string, 'hex')
value2 = codecs.decode(xor_string, 'hex')
result = xor(value1, value2)
hex_result = codecs.enco... | true |
4fc2894e40e3862dbb27c97ddf1e0368ba21e24e | Amudah41/EPAM_homeworks | /hw7/tests/task71_test.py | UTF-8 | 1,188 | 3.40625 | 3 | [] | no_license | import pytest
from hw7.tasks.task71 import find_occurrences
def test_positive_for_example():
example_tree = {
"first": ["RED", "BLUE"],
"second": {
"simple_key": ["simple", "list", "of", "RED", "my_valued"],
},
"third": {
"abc": "BLUE",
"jhl": "... | true |
5e27937f6e329da2e04019ed24a82f4a7a863a52 | MrSSHH/URL-Shortener | /URL_Modules/handler.py | UTF-8 | 3,530 | 2.953125 | 3 | [
"MIT"
] | permissive | __author__ = "Benjamin"
__github__ = "https://github.com/MrSSHH/"
# Run this on server side
import sys
import os
import socket
from errors import *
from url import url
class handler():
main_ip = socket.gethostbyname(socket.gethostname())
"""
Class purpose:
This class redirec... | true |
57cfbf75bb452c1a9aea84ba8d41db38a5b9da12 | iIronside/Solutions | /Lab1/All Task/task8.py | UTF-8 | 1,098 | 3.90625 | 4 | [] | no_license | # Напишите скрипт, генерирующий случайным образом число n в
# диапазоне от 1 до 10000. Скрипт должен создать массив из
# n целых чисел, также сгенерированных случайным образом, и
# дополнить массив нулями до размера, равного ближайшей сверху
# степени двойки. Например, если в массиве было n=100 элементов,
# то массив н... | true |
321d75d6b830aa249dab8241fd323c3a822b522e | Nate711/SedimentLearning | /tests/helper_functions.py | UTF-8 | 4,871 | 2.671875 | 3 | [] | no_license | from os import listdir
from os.path import isfile, join
import cv2
import numpy as np
import test_lin_reg
def get_station_locations(path):
filenames = [path + f for f in listdir(path) if isfile(join(path, f)) and f.endswith('.csv')]
# print filenames
X, y = test_lin_reg.get_data(filenames, ['insitu_la... | true |
3a5ad92f816ea2e013996c6471b07d34495ee7f0 | enderquestral/Reed-CSCI382 | /FloydWarshall/graph.py | UTF-8 | 10,246 | 3.828125 | 4 | [] | no_license | # File: graph.py
"""
This module defines the classes Graph, Node, and Arc, which are
used for working with graphs.
"""
class Graph:
"""Defines a graph as a set of nodes and a set of arcs."""
def __init__(self):
"""Creates an empty graph."""
self.clear()
def clear(self):
"""Remove... | true |
594cb2066484c5ff5834bf152a33b85e52cfa5d6 | mvschaik/taskflowstuff | /flows.py | UTF-8 | 694 | 2.828125 | 3 | [] | no_license | from time import sleep
from taskflow import task
from taskflow.patterns import linear_flow as lf
class TestTask(task.Task):
version = 2
def execute(self, timeout=5, app=None):
print("starting %s for app %s" % (self, app))
time = timeout
while time > 0:
sleep(1)
... | true |
260acb87aaf9ceb1a5c98e211e881b7f5e948690 | LSW1980/FuzzyZones | /FuzzyTSK.py | UTF-8 | 4,718 | 2.78125 | 3 | [] | no_license | import matplotlib.pyplot as plt
import numpy as np, skfuzzy as fuzz
from skfuzzy import control as ctrl
# define domain interval and resolution of fuzzy sets inputs-output
x_err = np.arange(-4,4, 0.1)
x_errRate = np.arange(-10,10, 0.1)
x_outPower = np.arange(-100,100, 0.1)
# define fuzzy set shapes or ... | true |
e52b25f79c8a28b95b3b3155d24848680fb80e6d | shait/heller_course | /1week.py | UTF-8 | 771 | 4.09375 | 4 | [] | no_license | import random
print("я загадал число от 0 до 100, попробуй его угадать!")
min_number = 0
max_number = 100
guessedNumber = random.randint(min_number, max_number)
while guessedNumber != "":
userNumber = int(input("введи число"))
if (userNumber < 0) or (userNumber > 100):
print("введи число от 0 до 100... | true |
fbf88c0d08cd1608e764794188e0353510e09950 | amirkogit/PythonTestGround | /sanbox/comprehensionsdemo.py | UTF-8 | 1,600 | 4.40625 | 4 | [] | no_license | print("comprehensions demo")
# list comprehensions
# general form of list comprehension is;
# [expr(item) for item in iterable]
words = "some random text is included here with this sentence".split()
print(words)
word_length = [len(word) for word in words]
print("length of each word = {}".format(word_length))
# above ... | true |
9f3a8302580b565576f40c538140f6c718dfe024 | mshekhar/random-algs | /epi_solutions/arrays/gas-station.py | UTF-8 | 1,224 | 3.171875 | 3 | [] | no_license | class Solution(object):
def canCompleteCircuit(self, gas, cost):
"""
:type gas: List[int]
:type cost: List[int]
:rtype: int
"""
start = 0
while start < len(gas):
tank = gas[start] - cost[start]
if start < len(gas) - 1:
... | true |
2246b3aa87a44cef87d422ddbd591914bc69c839 | fabriciovale20/AulasExercicios-CursoEmVideoPython | /Exercícios Mundo 1 ( 1 à 35 )/ex005.py | UTF-8 | 280 | 4.46875 | 4 | [] | no_license | """
Exercício 05
Faça um programa que leia um número inteiro e mostre na tela o seu sucessor e seu antecessor.
"""
numero = int(input('Digite um número: '))
print(f'Número digitado {numero}\n'
f'Sucessor: {numero + 1}\n'
f'Antecessor: {numero - 1}')
| true |
f8d9950ae8ba66e9e8f241762ea39cbb732bc8f7 | GrimKriegor/TES3MP-stats | /tes3mp-stats.py | UTF-8 | 1,100 | 2.734375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/python3
import requests
import datetime
master_servers = [
"https://master.tes3mp.com/api/servers/info",
"http://master.tes3mp.com:8080/api/servers/info",
"http://master.tes3mp.com:8081/api/servers/info"
]
def getstats(entrypoint):
try:
stats = requests.get(entrypoint, verify=Fals... | true |
e39344372196a98b0f7d33d515e31fd4f1cc6dad | davepollard/CurvedLayer_FDM | /backup_functions/level_print_bed.py | UTF-8 | 2,081 | 2.59375 | 3 | [
"MIT"
] | permissive | """
David Pollard
FARSCOPE CDT
Bristol Robotics Laboratory
Released under the MIT License
Robot traces square in selected work object to allow leveling of print bed
"""
from __future__ import division
import sys
import os
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
sys.path.append(os.path.join(o... | true |
d05f0b4f7af32c73241b2a8608d584159c801fb5 | Cadair/sunraster | /sunraster/tests/test_meta.py | UTF-8 | 1,360 | 2.890625 | 3 | [
"BSD-2-Clause"
] | permissive |
import pytest
from astropy.io import fits
from sunraster.meta import Meta
KEY = "KEY"
VALUE = 0
COMMENT = "This is a comment."
MISSING_KEY = "NO KEY"
ADDITIVE_KEY = "HISTORY"
ADDITIVE_ENTRY = "1st entry."
@pytest.fixture
def fits_header():
hdr = fits.Header()
hdr[KEY] = (VALUE, COMMENT)
hdr[ADDITIVE_KE... | true |
d9dc8214b12d6e6b33b15777fc73d5433ee290b0 | ejportega/Learn-Python-The-Hard-Way | /ex10a.py | UTF-8 | 226 | 3.25 | 3 | [] | no_license | print('''
First line
Second line
Third line
Fourth line
''')
print("""
First line
Second line
Third line
Fourth line
""")
print("\\ \' \" \a \\a \b \\b \f \\f \n \\n")
print("\r \\r \t \\t \uaaaa")
print("\v \\v \123 \1aa")
| true |
915e417511c77f04009668a707393bf94a2f44b4 | AshutoshDash1999/hackerrank-python-problems | /np-linear-algebra.py | UTF-8 | 261 | 2.890625 | 3 | [] | no_license | # problem-link = https://www.hackerrank.com/challenges/np-linear-algebra/problem
import numpy as np
N = int(input())
A = []
for i in range(N):
row_input = list(map(float, input().strip().split()))
A.append(row_input)
print(round(np.linalg.det(A), 2)) | true |
a20eb2ac3701df112e7bd8bea8f0b7116c489b81 | restavratof/py_sandbox | /core/__add_iadd__.py | UTF-8 | 841 | 3.8125 | 4 | [] | no_license | mylist = [10, 20, 30]
new_items = [40, 50, 60]
mylist += new_items
print(mylist)
print('1', '-'*50)
mylist = [10, 20, 30]
print(mylist + new_items)
print('2', '-'*50)
mylist = [10, 20, 30]
t = (40, 50, 60)
mylist += t
print(mylist)
print('3', '-'*50)
mylist = [10, 20, 30]
t += mylist
print(t)
print('1', '-'*50)
pri... | true |
702e1d7ffb12e89c26768043304e94a88a5d9e1b | ju-sung-kang/algorithm-practice | /BOJ 3860.py | UTF-8 | 1,876 | 3.28125 | 3 | [] | no_license | import sys
# 0 출발이나 아무것도 없음 / 1 출구 / 2 묘비 / 3 귀신구멍 입구
while True:
w, h = map(int, input().split())
if w == 0 and h == 0:
break
else:
gmap = [[0]*w for row in range(h)]
dis = [[float("inf")]*w for row in range(h)]
dis[0][0] = 0
edges = []
gmap[h-1][w-1] = 1 #... | true |
6c2799823b5ce5ebf06d391eb50f8848c2ae69d6 | AllenInstitute/asap-modules | /asap/utilities/schema_utils.py | UTF-8 | 701 | 2.640625 | 3 | [
"BSD-2-Clause"
] | permissive | import logging
import pathlib2 as pathlib
def posix_to_uri(data, pos_key, uri_key, delete_pos=True):
"""
pre_load option for supporting both posix and uri arg specification
"""
if data.get(pos_key) is not None:
if data.get(uri_key) is None:
data[uri_key] = pathlib.Path(
... | true |
49e60168ecdeaee7c97666fdcba19de5fe4ecb7c | allensummer/code | /datamining/CCPP/代码/test.py | UTF-8 | 3,616 | 2.921875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sun Nov 8 15:39:54 2015
@author: wq
"""
import numpy as np
import matplotlib.pyplot as plt
import xlrd
import math
from sklearn import linear_model
data = xlrd.open_workbook('/home/wq/code/datamining/CCPP/ccpp.xls')
#读取数据,将xls中的数据读取出来
sheet1 = data.sheet_by_name('Sheet1')
#x = ... | true |
ce9e656108f1a17e739c37a5d3759adb1f6cc7ba | MrMeowlnir/Games_stud | /matrix/main.py | UTF-8 | 2,138 | 2.71875 | 3 | [] | no_license | import os
import pygame as pg
from random import choice, randrange
class Symbol:
def __init__(self, x, y, speed):
self.x, self.y = x, y
self.value = choice(green_katakana)
self.interval = randrange(5, 30)
self.speed = speed
def draw(self, color):
frames = pg... | true |
825771ecf01b5685ab05ef94f3f6c6d8e3b7fce9 | lfontesm/netWorkTrafficTrainer | /trainer.py | UTF-8 | 4,652 | 3.140625 | 3 | [
"WTFPL"
] | permissive | #!/usr/bin/python3
import numpy as np
from sklearn import tree
from sklearn.ensemble import RandomForestClassifier
from sklearn.model_selection import train_test_split
from sklearn.naive_bayes import GaussianNB
from sklearn.metrics import accuracy_score
# valor default quando chega no final do arquivo
def default():
... | true |
15e6b26ed3d8bea5cf7250fd0452cbdc77488415 | trippingrobot/arsa-sdk-python | /test/test_util.py | UTF-8 | 899 | 2.5625 | 3 | [
"MIT"
] | permissive | import pytest
import json
from arsa.util import to_serializable
from arsa.model import Model, Attribute
from arsa.exceptions import Redirect
class SampleModel(Model):
name = Attribute(str)
phone = Attribute(str, optional=True)
class ComplexTestModel(Model):
test = Attribute(SampleModel)
def test_seriali... | true |
47f91bc149ec3af826dcd2fc01bcdf2ef08f950e | Raniac/NEURO-LEARN | /env/lib/python3.6/site-packages/celery/tests/tasks/test_context.py | UTF-8 | 2,546 | 2.640625 | 3 | [
"Apache-2.0"
] | permissive | # -*- coding: utf-8 -*-'
from __future__ import absolute_import
from celery.app.task import Context
from celery.tests.case import AppCase
# Retreive the values of all context attributes as a
# dictionary in an implementation-agnostic manner.
def get_context_as_dict(ctx, getter=getattr):
defaults = {}
for att... | true |
145de74056dcddf1e900778bbb5c55de1415613a | TrishaMittal/MultipleInstanceRecognition | /codes/accuracy1.py | UTF-8 | 2,244 | 2.578125 | 3 | [] | no_license | false_pos = 0
correct_pos = 0
def findOverlap(r1, r2):
x_overlap = max(0, min(r1[1],r2[1]) - max(r1[0],r2[0]));
y_overlap = max(0, min(r1[3],r2[3]) - max(r1[2],r2[2]));
return x_overlap * y_overlap;
def compare(pred, truth, correct_pos, false_pos):
predict = {}
for t in truth:
t = t.split()
num = int(t[0])
... | true |
662854eb840abc58284bf9ddd3a9f42f6066f4b9 | blikpatrik/python | /hello.py | UTF-8 | 90 | 2.984375 | 3 | [] | no_license | import sys
if(len(sys.argv) == 1):
print('Hey')
else:
print('Hey ' + sys.argv[1])
| true |
0a6af3af920336d39a5abd18058fdc1ffffd2ca9 | HPInc/hippy | /tests/check_device_types.py | UTF-8 | 4,828 | 2.5625 | 3 | [
"MIT"
] | permissive |
# Copyright 2016-2020 HP Development Company, L.P.
# SPDX-License-Identifier: MIT
#
""" This file includes methods to check the various types defined in the SoHal
Device documentation. It is intended to aid in the type checking for the hippy
tests. Each method in this file takes in a value and asserts that the valu... | true |
570868b7ccb728d0cf237a91b8b02b076c9f1c74 | jwk1215/test1 | /31.py | UTF-8 | 109 | 2.65625 | 3 | [] | no_license | #! /usr/bin/env python
Seq1= "AA,AC,AG,AT"
Seq1.split(",")
l = Seq.split(",")
l.append("CA")
print(l)
| true |
515e5a78f65e88060ebf96c7782e2f40ae2a990c | tomboxfan/PythonExample | /exercise/python_1059_matplotlib_pylot_math_logarithmic_function.py | UTF-8 | 638 | 4.4375 | 4 | [] | no_license |
import matplotlib.pyplot as plt
import numpy as np
x = np.linspace(0.001, 256, 256)
# logarithmic function: 2 to the power y is x
# We know x, now we want to know y
#
# logarithmic function:
# x y
# log2(2) = 1
# log2(4) = 2
# log2(8) = 3
# log2(16) = 4
# log2(32) = 5
# log2(64) = 6
# log2(1... | true |
c74cefcf53927bb336c0414188a24c3ec553446d | xxweell/exerciciosPython | /ex050.py | UTF-8 | 174 | 3.921875 | 4 | [] | no_license | s = 0
for c in range(1, 7):
numero = int(input('Digite um número: '))
if numero % 2 == 0:
s += numero
print('A soma dos números pares é de {}.'.format(s))
| true |
f0c30201fcf14f90e0a6205cd2394a69ec57520d | sprataps/Algorithms | /Random Questions/checkPowerof2.py | UTF-8 | 248 | 3.578125 | 4 | [] | no_license | import math
def checkPowerof2_method1(val,p):
return True if (p**math.floor(math.log(val,p)))==float(val) else False
x=int(input("Enter some value"))
p=int(input("Enter the number to check the power of: "))
print( checkPowerof2_method1(x,p))
| true |
94755efeb19b449bdbd218d3208ffc3de44af7f5 | cococastano/TangCodes | /VoiceControlProj/foodProcessor.py | UTF-8 | 7,954 | 3.09375 | 3 | [] | no_license | '''
Raj Palleti
Last revision: 8/15/19
This class gets foods, allergens, and nutrients
from the user's text using the Edamam Food API.
'''
import requests
import json
import sys
class foodProcessor(object):
def __init__(self,appID = None,appKey = None):
'''
Initialize with appID and appKey (nee... | true |
aa55e5c605321106ecf095cf6eb3445d9f8a085e | briancaffey/briancaffey.com | /srgraph/utils.py | UTF-8 | 1,083 | 2.84375 | 3 | [] | no_license | import pandas as pd
import networkx as nx
import numpy as np
from .models import Subreddit
#import the dataframe from pickle file and filter out null values
master_df = pd.read_pickle('master_df.p')
master_df_ = master_df[master_df.notnull()]
#cleanup and remove duplicates in the pandas dataframe
master_df_u = master... | true |
818c9e990cebbb83922e68442058874be8988c21 | chenshenyuan/leetcode | /78. Subsets.py | UTF-8 | 998 | 3.078125 | 3 | [] | no_license | class Solution(object):
def subset_choice(self,numb_list,need_numb):
result_list = []
if need_numb==0:
return [result_list]
elif need_numb==len(numb_list):
return [numb_list]
elif need_numb==1:
for k in numb_list:
result_list.appen... | true |
f9f0a2e0e48f43b855b737ec39b125fc265822f9 | wellmonwu/starquant | /source/data/backtest_data_feed_local.py | UTF-8 | 6,664 | 2.765625 | 3 | [
"MIT",
"Apache-2.0"
] | permissive | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import pandas as pd
from datetime import datetime, timedelta
from .data_feed_base import DataFeedBase
from ..common.datastruct import BarEvent,TickEvent
class BacktestDataFeedLocal(DataFeedBase):
"""
BacktestDataFeed retrieves historical data; which is ... | true |
016efea5c8fb32095d2a4168bd8647dc7562bbbb | SuvarnaDalin/Image_Captioning_With_Attention | /pytorch_model/Flask_App/app.py | UTF-8 | 1,047 | 2.65625 | 3 | [
"MIT"
] | permissive | from flask import Flask, render_template, redirect, request
from predict import load_model, predict_caption
from PIL import Image
app = Flask(__name__)
app.config['MAX_CONTENT_LENGTH'] = 16 * 1024 * 1024
@app.route('/')
def hello():
return render_template("index.html")
ALLOWED_EXTENSIONS = {'png', 'jpg', 'jpeg... | true |
80348589848f3c8afd170f9652dd226800716f9f | kieranmcgregor/Python | /PythonForEverybody/Ch3/Ex3_score_converter.py | UTF-8 | 742 | 4.125 | 4 | [] | no_license | score_empty = True
score_max = 1.0
score_min = 0.0
while score_empty:
score = input("Enter a score between 0.0 and 1.0: (Please enter a number)\n")
try:
score = float(score)
score_empty = False
except:
print ("Invalid input, please enter a number")
continue
if score > s... | true |
029d70209512a6017ba6481e57e7256c882e98f8 | swapnika-20186045/CSPP1 | /CSPP1-Practice/M10/p2/assignment2.py | UTF-8 | 3,495 | 4.28125 | 4 | [] | no_license | '''
Author: Swapnika
Created on 09-08-2018
Exercise : Assignment-2
implement the function hangman, which takes one parameter - the secretWord
the user is to guess. This starts up an interactive game of Hangman between
the user and the computer. Be sure you take advantage of the three helper functions,
isWordGuessed... | true |
d5f1ddf72b43284ea14e6bf4a296ab251e92c66e | BrandonSherlocking/python_document | /图表绘制/方波绘制副本,自己.py | UTF-8 | 516 | 2.9375 | 3 | [] | no_license | import numpy as np
import matplotlib.mlab as mlab
import matplotlib.pyplot as plt
labels = ['China', 'Swiss', 'USA', 'UK', 'Laos', 'Spain']
X = [222, 42, 455, 664, 454, 334]
def trans(n):
if n == 'China':
return 0.1
else:
return 0
a = []
exp1 = list(map(trans, labels))
d = [0.1, 0, 0, 0, 0.1, 0... | true |
bc5ff49fa5dd4e04ff6ff3aacc0abc83bd7f415f | AlexSWeber/AI-Class-Project | /dvc.py | UTF-8 | 7,706 | 3.3125 | 3 | [] | no_license | # %% [markdown]
# # In this kernel we’ll try to identify correctly if the image we’re seeing is a dog=1 or a cat=0 .
# # In order to do so I’ll use dog & cat image dataset as input to a data augmentation generator + CNN .
# # After optimzation process - optimal layers are 5 + 2 FC layers
# # I also run semi grid sear... | true |
4be0bf2cd0feb465115a9162c85975e2b3dd440a | liusiyi641/Speaking-Styles-Capturing-and-Mimicing | /small_data with bert/vectorizer_and_similarity.py | UTF-8 | 845 | 2.984375 | 3 | [] | no_license | from bert_serving.client import BertClient
import numpy as np
from numpy import linalg as LA
def vectorizing(sent):
# give the bert representation of a sentence
"""
Args:
sent list(string): the sentence to transform
Output:
ret list(dtype): the vector representation o... | true |
4daf344f58b9160c47f56610f59e1b639bad5a2c | Stevan-Zhuang/DMOJ | /CCC/CCC '98 S5 - Mountain Passage.py | UTF-8 | 1,282 | 3.03125 | 3 | [] | no_license | from math import inf
directions = [(1, 0), (0, 1), (-1, 0), (0, -1)]
results = []
for case in range(int(input())):
grid_size = int(input())
grid = [[int(input()) for col in range(grid_size)]
for row in range(grid_size)]
min_oxygen = [[inf for col in range(grid_size)]
for row i... | true |
c25c95c83502b5309e92286c2cbc2d4be7032781 | yangzhuang-001/python3.5 | /namedtuple.py | UTF-8 | 328 | 3.296875 | 3 | [] | no_license | #!/usr/bin/env python3
from collections import namedtuple
#测试学习namedtuple
fruit = namedtuple('fruit',['fruitName','fruitNum','fruitSalary'])
buy_fruit = [
fruit('apple',0.45,13.5),
fruit('banana',0.55,23),
fruit('orange',0.56,25)
]
for item in buy_fruit:
result = item._make(item)
print(result) | true |
e4c7d685dcc985e4eca739771d254857f8c0c87c | milnorms/pearson_revel | /ch9/ch9p4.py | UTF-8 | 2,710 | 4.34375 | 4 | [] | no_license | '''
See Exercise 9.15 in the Chapter 9 Programming Exercise from the Book section for the description of this exercise.
Sample Run
Enter the real part of the first complex number: 3.5
Enter the imaginary part of the first complex number: 6.5
Enter the real part of the second complex number: -3.5
Enter the imagina... | true |
9a425a6078dfb610785799610a61e706e8e3944a | maxwellflitton/flitton-fib-py | /flitton_fib_py/fib_calcs/fib_numbers.py | UTF-8 | 404 | 3.609375 | 4 | [
"MIT"
] | permissive | from typing import List
from .fib_number import recurring_fibonacci_number
def calculate_numbers(numbers: List[int]) -> List[int]:
"""
Calculates a range of Fibonacci numbers from a list.
:param numbers: (List[int]) the Fibonacci numbers to be calculated
:return: (List[int]) the calculated Fibonacci... | true |
350661a52e434a481a57726edba2169b96941499 | valuemomentum-gabc2018/Gabc2018Presentations | /CognitiveServices-Track/MachineLearningServices/Demo/demo1.py | UTF-8 | 4,785 | 2.671875 | 3 | [] | no_license | # Use the Azure Machine Learning data preparation package
from azureml.dataprep import package
# Use the Azure Machine Learning data collector to log various metrics
from azureml.logging import get_azureml_logger
from azureml.dataprep.package import run
from sklearn.preprocessing import Imputer
import pandas as pd
imp... | true |
d06ec1ac6a59db73e5f808568b4a5620dd7593f2 | ericchen12377/Leetcode-Algorithm-Python | /1stRound/Medium/215- Kth Largest Element in an Array/Quicksort.py | UTF-8 | 957 | 3.1875 | 3 | [
"MIT"
] | permissive | class Solution:
def findKthLargest(self, nums: List[int], k: int) -> int:
def swap(array, i, j):
temp = array[i]
array[i] = array[j]
array[j] = temp
def partition(array, left, right):
pivotelement = array[right]
partitionidx = left... | true |
21887b718dee8929ad5425ba49343ae08bb4be5e | MarcoPires/movie-trailer-website | /server.py | UTF-8 | 908 | 2.640625 | 3 | [] | no_license | #SimpleHTTPServer python server
#only to simplify access
import app
import sys
import webbrowser;
import BaseHTTPServer
from SimpleHTTPServer import SimpleHTTPRequestHandler
from random import randint
ServerClass = BaseHTTPServer.HTTPServer
Protocol = "HTTP/1.0"
class HandlerClass(SimpleHTTPReques... | true |
bea48f0cfdc1eded9263107913572b563007fead | osama-khalid/govCrawler | /1_SeedGeneration.py | UTF-8 | 3,216 | 2.609375 | 3 | [] | no_license | '''
Seed Generation
input: a Top-Level Domain
output: a list of seed domains stored as <tldName>.tldDump.csv
'''
#Example
seed='gov.br'
#-------------------
import requests
import bs4
import time
counter=10
collections=[]
headers = {"User-Agent": "Mozilla/5.0 (X11; CrOS x86_64 12871.102.0) AppleWebKit/537.36 (... | true |
acd55f8c0330d96dda3fe1093fe60ee1b4343571 | karol-gruszczyk/pswd-snitch | /password_manager.py | UTF-8 | 8,778 | 2.546875 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
import functools
import urwid
import pyperclip
from components import StyledButton, OkDialog, OkCancelDialog, Dialog
from crypto.ninja import EncryptedImageNinja
from crypto.vault import ImageVault, Password
def close_app(*args):
raise urwid.ExitMainLoop()
palette = [
('banner', 'dar... | true |
4fe4f79d67e09481bfae47166cde546f01e8acce | m303382445/AID2004 | /static/ftp_client.py | UTF-8 | 3,088 | 3.359375 | 3 | [] | no_license |
from socket import *
import time
import sys
# 服务器地址
ADDR = ("127.0.0.1",8888)
# 将具体发送请求的方法封装在类中
class FTPClient:
def __init__(self,sock):
self.sock = sock
# 请求文件列表
def do_list(self):
self.sock.send(b"LIST") # 发送请求
result = self.sock.recv(128).decode() # 等待回复
if result ==... | true |
0dd311e3dcf02d8d945da7c70d7f3d1eead8954d | chieko0106/NumberRec | /MNIST_LSTM/Train.py | UTF-8 | 5,845 | 2.953125 | 3 | [] | no_license | # -*- coding: UTF-8 -*-
import numpy as np
import os
import pandas as pd
'''
#载入数据
'''
father_path = os.path.abspath(os.path.dirname(os.getcwd())+os.path.sep+".")
data_path = father_path+'/data/'
train = pd.read_csv(data_path+'train.csv')
test = pd.read_csv(data_path+'test.csv')
pics = np.array(train.iloc[:,1:],dt... | true |
76ec2eec732b08f1643c560042731ef463917f35 | menghanhui/LRU_cache | /qA/qA.py | UTF-8 | 756 | 4.375 | 4 | [] | no_license |
# sample input:
# [1 5] [2 6]
# [1 3] [7 9]
# Assume this function accepts two lists, where in each list there are two numbers,
# which specifies the start and end point of a line.
# Here we assume that for any line [x1, x2], if x1 > x2, such as [5, 1], it is also valid.
# It means this line is: 1->5
def find_overlap... | true |
b6d65363233fac3afb42f8d777cba6d01254bbf0 | evs-dev/PythonVectors | /python_vectors/vector2.py | UTF-8 | 2,641 | 3.890625 | 4 | [
"MIT"
] | permissive | from .sqrt import sqrt
class Vector2():
"""Representation of points and vectors in 2-dimensional space"""
def __init__(self, x=0, y=0):
self.x = x
self.y = y
def get_normalised(self):
"""Return the normalised version of the vector"""
mag = self.get_magnitude()
retur... | true |
fb5fd8b8750934092164597d06bd43e67d19e4c4 | dr-dos-ok/Code_Jam_Webscraper | /solutions_python/Problem_97/768.py | UTF-8 | 1,576 | 2.75 | 3 | [] | no_license | import sys
def nbValidPermutation(i, maxi):
strF = str(i)
nb = 0
finded = []
for j in range(len(strF))[:-1]:
other = int(strF[j+1:]+strF[:j+1])
if other > i and other <= maxi and not other in finded:
finded.append(other)
nb += 1
return nb
def buildKelem(i, maxi):
strF = str(i)
nb = 0... | true |
b77a9e39d283302eb611c204a634d39d2f747b22 | cjbaxt/mySpitzerTransit | /transitFitting_routines (original).py | UTF-8 | 42,504 | 2.5625 | 3 | [] | no_license | from timeseries_routines import *
from astropy.io import fits
import numpy as np
import glob, os, sys, time
import matplotlib.pyplot as plt
from scipy import stats
from scipy.ndimage.measurements import center_of_mass
from scipy.interpolate import LinearNDInterpolator
from scipy.optimize import minimize_scalar
from sci... | true |