blob_id stringlengths 40 40 | language stringclasses 1
value | repo_name stringlengths 5 133 | path stringlengths 2 333 | src_encoding stringclasses 30
values | length_bytes int64 18 5.47M | score float64 2.52 5.81 | int_score int64 3 5 | detected_licenses listlengths 0 67 | license_type stringclasses 2
values | text stringlengths 12 5.47M | download_success bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|
cf5842964302039a8adacf0584d996a9b129d7aa | Python | mergeMingJ/BOJ_Algo_python | /210701/14501. 퇴사_dp.py | UTF-8 | 864 | 3.078125 | 3 | [] | no_license | import sys
sys.stdin = open('input/14501.txt', 'r')
N = int(input())
arr = [list(map(int, input().split()))for _ in range(N)]
arr.insert(0, [0,0])
total = [0] * (N+1)
# N만큼 돌면서 검사
for i in range(1, N+1):
# 만약 현재 날짜와 끝나는 날짜를 했을때 기간내에 끝낼 수 있다면
if i + arr[i][0] <= N+1:
# 현재 날짜까 벌수 있는 돈 기록
total[... | true |
cbfd695fa437758cc12d796f629f33d310d33a63 | Python | e-hendry/coding_projects | /most_frequent.py | UTF-8 | 4,124 | 3.890625 | 4 | [] | no_license |
def read_file(filename):
"""
opens file with input file name, reads the data, removes the new line characters ("\n") and stores it in a list
one element of the list is a single line of the text file
"""
with open (filename,"r") as f:
lines = f.readlines()
data_clean_line = []
... | true |
d8dfd728110aa243c0f3183203ef587c178034c9 | Python | TobyBoyne/advent-of-code | /aoc-2015/2015-05.py | UTF-8 | 951 | 3.90625 | 4 | [] | no_license | def read_input():
strings = []
with open("day05.txt") as f:
for line in f:
strings.append(line.strip("\n"))
return strings
def nice_string1(s):
vowel_count = 0
letter_repeat = False
for i, c in enumerate(s):
vowel_count += c in 'aeiou'
pair = s[i:i+2]
if len(pair) == 2 and pair[0] == pair[1]:
lett... | true |
0c599fbb34ffbd797ffa500fa76f7e4270630a48 | Python | Jatin7385/Basic_ML | /irisclassifier.py | UTF-8 | 313 | 3.046875 | 3 | [] | no_license | from sklearn.datasets import load_iris
from sklearn.neighbors import KNeighborsClassifier
data=load_iris()
x=data.data
y=data.target
knn=KNeighborsClassifier(n_neighbors=5)
knn.fit(x,y)
p=knn.predict([[3,5,4,2]])
if p==1:
print("Versicolor")
elif p==0:
print("Setosa")
elif p==2:
print("Virginica")
| true |
c7d5be4aff8761dac2938d3d123460733110afcc | Python | nilutz/sbb_ocr_postcorrection | /qurator/sbb_ocr_postcorrection/mt/models/gan.py | UTF-8 | 16,898 | 2.53125 | 3 | [
"Apache-2.0"
] | permissive | import math
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from .seq2seq import AttnDecoderLSTM, EncoderLSTM
class DiscriminatorCNN(nn.Module):
def __init__(self,
input_size,
hidden_size,
filter_sizes=[3,4,5],
... | true |
78ddb614e506a7863b657899bfc54b2f2e3e0328 | Python | DanielWherry/ProjectEuler | /Problem6/Solution6.py | UTF-8 | 236 | 3.640625 | 4 | [] | no_license | sumOfSquares = 0
squareOfSum = 0
sumOfFirstHundred = 0
for i in range(1, 101):
sumOfSquares += i**2
for i in range(1,101):
sumOfFirstHundred += i
squareOfSum = sumOfFirstHundred**2
diff = squareOfSum - sumOfSquares
print(str(diff)) | true |
cd53647c13ceb7e4becfac2aa38425d8ecc36863 | Python | prashanthkc/Decision-tree | /decision tree/decisiontree_py_assign.py | UTF-8 | 18,904 | 3.453125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sat Mar 20 11:20:37 2021
@author: prashanth
"""
################################# Problem 1 ################################
#loading the data
import pandas as pd
import numpy as np
company = pd.read_csv("F:/assignment/decision tree/Datasets_DTRF/Company_Data.csv")
... | true |
7b27c8f5eade50cfb165fa38a4fbfdb078a3b43f | Python | danatok/Leetcode-and-HackerRank-practice | /Arrays/easy/#Array Partition I 561 Easy.py | UTF-8 | 236 | 2.890625 | 3 | [] | no_license | #Array Partition I 561 Easy
class Solution(object):
def arrayPairSum(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
sorted_a = sorted(nums)
return sum(sorted_a[::2])
| true |
4023442bd3014116147965bd6e7458849eb0ff61 | Python | matthewkover/aoc | /Day 6/6-1.py | UTF-8 | 522 | 3.234375 | 3 | [] | no_license | #Advent of Code 2020 Day 6 Part 1
def getUnique(response):
questions = []
for char in response:
if char not in questions:
questions.append(char)
return len(questions)
with open('Day 6/data.txt') as f:
d = f.readlines()
d = [ line.strip() for line in d ]
sum = 0
currentRespon... | true |
d54d8dd549a49f3184b89d7fb29bd01899b30b0d | Python | sanchezolivos-unprg/trabajo | /calculadora14.py | UTF-8 | 195 | 3.421875 | 3 | [] | no_license | #14 volumen de una esfera:
cadena: cuerpo
real: pi, volumen
entero: radio
booleano: es_una_esfera
cuerpo= "esfera"
pi= 3.1415
radio= 36
es_una_esfera= True
volumen= 4*(pi/3)*(radio**3) | true |
7707591e7f9ead76aa957d3bf0fadd4d446f06eb | Python | kukunak/lesson2 | /home_2/compare.py | UTF-8 | 1,412 | 4.21875 | 4 | [] | no_license | #Написать функцию, которая принимает на вход две строки
#Проверить, является ли то, что передано функции, строками. Если нет - вернуть 0
#Если строки одинаковые, вернуть 1
#Если строки разные и первая длиннее, вернуть 2
#Если строки разные и вторая строка 'learn', возвращает 3
#Вызвать функцию несколько раз, передавая ... | true |
064c230e176435f98fc9b755f7835d93d835c444 | Python | shidoutsuruya/PythonQt | /HelloWorld/p11_hello_world.py | UTF-8 | 548 | 2.734375 | 3 | [] | no_license | import sys
from PyQt5 import QtWidgets,QtCore,QtGui
app=QtWidgets.QApplication(sys.argv)#create app
widgetHello=QtWidgets.QWidget() #create widget
widgetHello.resize(300,150) #set height and width
widgetHello.setWindowTitle('Demo2_1') #set title text
LabHello=QtWidgets.QLabel(widgetHello)# set log
LabHello.setText(... | true |
e7732f505bbc5222bae3d56aadfa0e367974655a | Python | ManiacalLabs/BiblioPixelAnimations | /BiblioPixelAnimations/cube/wave_spiral.py | UTF-8 | 1,222 | 2.921875 | 3 | [
"MIT"
] | permissive | from bibliopixel.animation.cube import Cube
def spiralOrder(matrix):
return matrix and list(matrix.pop(0)) + spiralOrder(list(zip(*matrix))[::-1])
class WaveSpiral(Cube):
def __init__(self, layout, offset=1, dir=True, **kwds):
super().__init__(layout, **kwds)
self.offset = offset... | true |
48097be623492ac402d2c98cc17ec6e14becb9fb | Python | brandonlyon24/Python-Projects | /Websitebuilder/websitebuilder.py | UTF-8 | 1,622 | 2.96875 | 3 | [] | no_license | #
# Author: Brandon Lyon
#
#
#
#
#
import webbrowser
import tkinter
import tkinter as tk
from tkinter import *
import Body_func
f = open("websitebuilder.html", "w")
f.write("""<html>
<body>
<h1>Stay tuned for our amazing summer sale! </h1>
<h2>Please wite the body here<h2>
<input type="te... | true |
6c95411eab441f6dda8c0e593dbc4b81edc1598a | Python | SaskiaDeVries/506finalproject | /final.py | UTF-8 | 17,602 | 3.15625 | 3 | [] | no_license | import urllib
import requests
import json
import random
import unittest
# Used a Census Bureau file online to create a list of valid ZIP codes (i.e., recognized by Census API). Cached data provided.
try:
#Open cached list of valid ZIP codes
ziplist = open("validzipcodes.txt", 'r')
zcta5_codes = json.loads(ziplist.r... | true |
ab76a479ad2d3794dfff59c2446f27b6c8cedde1 | Python | kric1929/exception | /name_owners.py | UTF-8 | 4,177 | 3.71875 | 4 | [] | no_license | documents = [
{'type': 'passport', 'number': '2207 876234', 'name': 'Василий Гупкин'},
{'type': 'invoice', 'number': '11-2', 'name': 'Геннадий Покемонов'},
{'type': 'insurance', 'number': '10006', 'name': 'Аристарх Павлов'}
]
directories = {
'1': ['2207 876234', '11-2', '5455 028765'],
'2': ['10006... | true |
4f39d008881001d951003fcfe5b1f8807652b84b | Python | deZakelijke/Evolutionary_Computing | /src/compile.py | UTF-8 | 754 | 2.6875 | 3 | [] | no_license |
import os
cwd = os.getcwd()
# open file met .java names
f = open("sources.txt", "r")
# set right prefix
stringBuilder = ""
for line in f:
stringBuilder = stringBuilder + line.replace("./", "./model/") + "\n"
f.close()
# save that
f = open("sources.txt", "w")
for line in stringBuilder:
f.write(line)
f.close... | true |
b0832eb755c3051728c42276d19aa616b7ec9b8b | Python | lucasg1/wind_sensor | /log.py | UTF-8 | 934 | 2.875 | 3 | [] | no_license | import os
import time
import Adafruit_ADS1x15
from time import sleep
from datetime import datetime
adc = Adafruit_ADS1x15.ADS1115()
GAIN = 1
scale = 6.144/32767
file = open("./data_log.csv","a")
while True:
wind_ads = adc.read_adc(1, gain = 2/3)
temp_ads = adc.read_adc(2, gain = 2/3)
battery_ads = adc.rea... | true |
7cb128255568af35797ab3f14bc159f5230e01c6 | Python | maniksejwal/College | /Sem 6/OS/6. page replacement.py | UTF-8 | 739 | 3.59375 | 4 | [] | no_license | """wap to implement page replacement policy using
(A) least recently used (LRU)
(B) FIFO
(C) Optimal
maintain a capacity
insert page one by one until the size of the frame reaches the max
simultaneously maintain the queue to maintain the
whoen the next page is not available and replacement is needed"""
# input - 1... | true |
ca59765647f4d5da9997b7b938d5c761d205ed27 | Python | Vishallimgire/Python_stuff | /codewars/find_two_max.py | UTF-8 | 287 | 3.09375 | 3 | [] | no_license | v = [8,11,6,9]
if v[0] >= v[1]:
first_max, second_max = v[0], v[1]
else:
first_max, second_max = v[1], v[0]
for i in v[2:]:
if i >= first_max:
second_max, first_max = first_max, i
elif i >= second_max:
second_max = i
print(first_max, second_max)
| true |
6d32b0de3a5dd0167ea5c2f5a38170a6048f2fae | Python | lufanx/python_usage_summary | /function/function_usage.py | UTF-8 | 832 | 3.671875 | 4 | [] | no_license | #!/usr/bin/env python
def my_power(mun, n = 2):
i = 1
val = 1
while (i <= n):
val = val * mun
i += 1
return val
def first_usage():
'''about power valuse'''
val = my_power(5)
print (val)
def my_two(*args):
for i in args:
print (i),
print
def two_u... | true |
e826da05cc75951d2a197f228fbbfe0121f3cacd | Python | leandroli/Smartphone-Price-Analysis | /scrap_taobao&Analysis/scrap_taobao.py | UTF-8 | 6,945 | 2.609375 | 3 | [] | no_license | from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import time
import json
file = open('../phone_info.json', 'w', encoding='utf-8')
file.write('[\n')
opt = webdriver.ChromeOptions()
opt.headless = False
driver = webdriver.Chrome(executable_path='C:\Program Files (x86)\Google\Chro... | true |
3c4b57e344410d423fd698b365b82a14e3bc2b2d | Python | Gambrinus/Euler | /Python/p15.py | UTF-8 | 525 | 3.75 | 4 | [] | no_license | #!/usr/bin/env python
""" Project Euler - Problem 15
Starting in the top left corner of a 22 grid, there are 6 routes (without backtracking) to the bottom right corner.
How many routes are there through a 2020 grid?
"""
__author__ = "Daniel J. Barnes"
__email__ = "ghen2000@gmail.com"
__status__ = "Working"
import t... | true |
3572846aae6f53b125b2c575eb182913d03303ae | Python | tianhm/InplusTrader_Linux | /InplusTrader/dataEngine/DK.py | UTF-8 | 20,939 | 2.65625 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
"""
Create on 2017/02/18
@author: vinson zheng
@group: inpluslab
@contact: 1530820222@qq.com
"""
import sys, os
import pickle
import math
import datetime
import numpy as np
import pandas as pd
import talib as ta
import pymongo
from pymongo import MongoClient
import matplotlib
# 这个要紧跟在 import m... | true |
039db6f203270b920b44a0c025b2e7599c820ef8 | Python | alcorzheng/learn_python | /Learn_pkgs/learn/BeautifulSoup/spider_dlt.py | UTF-8 | 2,622 | 2.546875 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/python
# -*- coding:utf-8 -*-
# auth: alcorzheng<alcor.zheng@gmail.com>
# date: 2018-03-14
# desc: 大乐透开奖结果爬取
from bs4 import BeautifulSoup
from Spiders.spiders.lottery import lottery_model
from Spiders.common import config, database, utils, utils_html
def get_page_num(url, headers):
"""获取url总页数"""
... | true |
6f2bc4053aae51ba24f86e32685b3f077b3d6a0d | Python | paulmadore/funkshelper | /sopel/modules/keyexchange.py | UTF-8 | 2,955 | 2.546875 | 3 | [
"EFL-2.0"
] | permissive | # coding=utf-8
"""
Woodcoin IRC GPG Key Association Module copyright 2015 phm.link
Licensed under Mozilla Public License Version 2.
Synopsis: a module that will register a user with their designated GPG key.
Behavior: should import the public key it is told to import, then store that in a file it then associates with... | true |
2680325cfdcf1ff5f21cb0c7facfc7957f3a4b75 | Python | wangyu9/MDGCNN | /MDGCNN/rotation_generator.py | UTF-8 | 3,662 | 3.109375 | 3 | [] | no_license | """Random rotation matrix generators."""
import numpy as np
import keras
def generate(dim):
"""Generate a random rotation matrix.
Args:
dim (int): The dimension of the matrix.
Returns:
np.matrix: A rotation matrix.
Raises:
ValueError: If `dim` is not 2 or 3.
... | true |
e4261b440d193d4c6b99fe01cd40982848e44884 | Python | koukyo1994/DeepHPMs | /Mine/core/plot.py | UTF-8 | 1,414 | 2.65625 | 3 | [
"MIT"
] | permissive | import sys
import matplotlib
matplotlib.use("agg")
sys.path.append("..")
def plt_saver(u_pred, sol_exact, sol_lb, sol_ub, path):
import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec
from mpl_toolkits.axes_grid1 import make_axes_locatable
from Codes.plotting import newfig, savefig
... | true |
feb908e78ee99ee450a25fbbe39b236c927a4e7d | Python | HOHO-00/test_00 | /webcode/Selenium0/test_02.py | UTF-8 | 1,758 | 2.6875 | 3 | [] | no_license | import time
from selenium import webdriver
from selenium.webdriver.common.action_chains import ActionChains
driver = webdriver.Chrome(executable_path='chromedriver.exe')
driver.maximize_window() # 网页最大化
driver.get("http://tomcat-69.gis-data.cn:7080/tdfkweb/#/user-login")
driver.find_element_by_xpath('//*[@id=... | true |
ab504cbc382e13bb141fe51335175e09e7f7bf5b | Python | Keesiu/meta-kaggle | /data/external/repositories/237806/Kaggle_HomesiteQuoteConversion-master/Python/xgb_stop_to_pythonV1.py | UTF-8 | 3,288 | 2.59375 | 3 | [
"MIT"
] | permissive | #based on
# https://www.kaggle.com/sushize/homesite-quote-conversion/xgb-stop/log
# abd
#https://www.kaggle.com/mpearmain/homesite-quote-conversion/xgboost-benchmark/code
import pandas as pd
import numpy as np
import xgboost as xgb
from sklearn import preprocessing
from sklearn.cross_validation import train_test_spli... | true |
988fc9cbec1b9b54fef214de9c79dbb3d5162915 | Python | tyf287/demo | /fm_new_add/other/time_change.py | UTF-8 | 1,523 | 2.828125 | 3 | [] | no_license | import random
import time
def str_to_stamp(get_time):
in_time = get_time
timeArray = time.strptime(in_time, "%Y-%m-%d %H:%M:%S")
timeStamp = int(time.mktime(timeArray))
return timeStamp
def stamp_to_str(get_time):
in_time = get_time
timeArray = time.localtime(in_time)
otherStyleTime = ... | true |
b7584c470bdafa040529daa8e4a2775391da51f5 | Python | brybyrd/blackjack | /blackjack.py | UTF-8 | 3,348 | 3.53125 | 4 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# In[17]:
cards = ["A", "2", "3", "4", "5", "6", "7", "8", "9", "10", "J", "Q", "K"]
cards_values = {"A": 11, "2":2, "3":3, "4":4, "5":5, "6":6,
"7":7, "8":8, "9":9, "10":10, "J":10, "Q":10, "K":10}
def blackjack_game(deck):
player_cards = []
dealer_... | true |
a38e32f5a2636e9c77627dd5395ac00df67a6c9e | Python | pankhurikumar23/w4156-lecture-code | /lectures/testing/theory/mood_calculator.py | UTF-8 | 1,272 | 3.53125 | 4 | [
"Apache-2.0"
] | permissive | from enum import Enum
class Mood(Enum):
Joyful = 1
Grumpy = 2
Irritated = 3
Hulk = 4
class MoodCalculator:
def calculate_mood(self, sleep_deprivation: int, blood_sugar: int) -> Mood:
"""
Calculate humans Mood based on and blood sugar
:param sleep_deprivation: hours sinc... | true |
861d9f67473474671a3b368e5b547e659e0f5851 | Python | SY-Xuan/ml | /k-means聚类图像.py | UTF-8 | 1,206 | 2.9375 | 3 | [] | no_license | import numpy
import matplotlib.pyplot
data = numpy.loadtxt("./datafile/irisNoLabel.txt",delimiter=",")
print(data.shape)
data = data[:,1:3]
mu = numpy.array([[2.7,5.1],[5,6.1]])
error = mu.copy()
c = numpy.zeros((150,))
temporary = numpy.zeros((2,))
def oDistance(vector1,vector2):
a = abs(vector1 - vector2)
ret... | true |
a52fe3697470121f1bf3f3c65411699b9a1545cd | Python | ssyed23/makeup_lovers | /search_products.py | UTF-8 | 886 | 3.015625 | 3 | [] | no_license | import requests
import json
r = requests.get('https://makeup-api.herokuapp.com/api/v1/products.json?product_type=foundation')
print("____________________________")
# print (r.json())
# print(r['price'])
data = r.json()
print(len(data))
print(data[165])
print(data[165]['id'])
for i in range(0,166):
print(data[i][... | true |
58d4393bd812a5cb0b793a8b070a6f5163df4596 | Python | Riwuko/inzynierka-django-server | /raspberry/run.py | UTF-8 | 3,742 | 2.515625 | 3 | [] | no_license | from bh1750 import readLight
import requests
import time
from light import LightController
from heater import HeaterController
from humidity import readTemperature, readHumidity
import threading
LIGHT_SENSOR_ID = 3
BULB_IP = "192.168.1.96"
HEATER_PIN = 6
BULB_ID = 2
HEATER_ID = 3
TERMOMETER_ID = 4
HYGROMETER_ID = 5
gi... | true |
fa86237787f6d82be72ee1db8a7d738eaf18ddae | Python | arpitverma9335/greyatom-python-for-data-science | /Loan-Approval/code.py | UTF-8 | 1,772 | 2.953125 | 3 | [
"MIT"
] | permissive | # --------------
# Importing header files
import numpy as np
import pandas as pd
from scipy.stats import mode
import warnings
warnings.filterwarnings('ignore')
#Reading file
bank_data = pd.read_csv(path)
print(bank_data.shape)
#Code starts here
categorial_var = bank_data.select_dtypes(include = 'o... | true |
ddf23a0c0398c5b66a7f3f637713a30c04a1157a | Python | Fleford/GAN_with_Kalman_filters | /gan_for_gradient_based_inversion/training/utils.py | UTF-8 | 2,356 | 2.578125 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
"""
Created on Thu Aug 30 11:54:17 2018
@author: elaloy
"""
import os
import numpy as np
from PIL import Image
from PIL.Image import FLIP_LEFT_RIGHT
def image_to_tensor(img):
# tensor = np.array(img).transpose( (2,0,1) )
# tensor = tensor / 128. - 1.
i_array=np.array(img)
if len(... | true |
9fe44d54fa8fcdd76d2abf1e857af9ca7c3123c9 | Python | rugbyprof/5143-Operating-Systems | /.trunk/00-OS-OOP_Modules/myrich.back.py | UTF-8 | 7,243 | 3.046875 | 3 | [] | no_license | #!/usr/local/bin/python3
"""
Demonstrates a dynamic Layout
"""
from datetime import datetime
from time import sleep
from rich.align import Align
from rich.console import Console
from rich.layout import Layout
from rich.live import Live
from rich.text import Text
from rich.table import Table
from rich.panel import Pane... | true |
a1b3ac50be0455a47b0481908391b938136a50d7 | Python | ShionHXC/learn_python3 | /j_generator.py | UTF-8 | 1,213 | 3.8125 | 4 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# 生成器
L = [x * x for x in range(10)]
G = (x * x for x in range(10))
for n in G:
print(n)
def fib(max):
n,a,b = 0,0,1
while n < max:
print(b)
a,b = b, a + b
n = n + 1
return 'done'
fib(10)
# 要把fib函数变成generator,只需要把print(b)改为yield b... | true |
85452ddcf5412b5bca31ed0d596e4f156449538a | Python | BeratYesbek/python_form_app | /python_form_app/Entity/User.py | UTF-8 | 438 | 2.546875 | 3 | [] | no_license | class User:
Id = ""
firstName = ""
lastName = ""
email = ""
password = ""
userImage = ""
userType = ""
def __init__(self, Id, firstName, lastName, email, userImage, userType, password):
self.Id = Id
self.firstName = firstName
self.lastName = lastName
self... | true |
c4ef6d615dd425e88c5d4935b901f5ee4c43614e | Python | Ghack9/hacktoberfest2021 | /Python/Pick_and_Drop.py | UTF-8 | 6,436 | 2.5625 | 3 | [
"CC0-1.0"
] | permissive | import os
from subprocess import call
import sys
try:
from Tkinter import *
except ImportError:
from tkinter import *
try:
import ttk
py3 = False
except ImportError:
import tkinter.ttk as ttk
py3 = True
class Pick_Drop:
def __init__(self):
root = Tk()
ro... | true |
25afab1106b9d4ac94265b62d2472cf9d944889b | Python | zemi4/Currency-OOP | /currency/parsing.py | UTF-8 | 959 | 2.796875 | 3 | [] | no_license | import requests
import json
class ParserNBRB:
# создание парсера
def __init__(self, url):
self.URL = url
# Получить JSON
def update_JSON(self):
self.response = requests.get(self.URL).json()
return self.response
# ЗАПИСАТЬ JSON В ФАЙЛ
def write_json(self):
try... | true |
88d1becb954d24d192717967f867c9c0151a01f7 | Python | xiongmengmeng/xmind-other | /4.珍大户经济学/3.经济学的核心逻辑.py | UTF-8 | 4,051 | 2.75 | 3 | [] | no_license |
import os,sys
parentdir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.insert(0,parentdir)
import xmind
from xmind.core.markerref import MarkerId
xmind_name="经济学的核心逻辑"
w = xmind.load(os.path.dirname(os.path.abspath(__file__))+"\\"+xmind_name+".xmind")
s2=w.createSheet()
s2.setTitle("经济学的核心... | true |
ddec732f4e3736d76e9e31863c2cfb7f74b760b0 | Python | nicholasinatel/GALILEO_ONBOARD | /python_codes2/build6.py | UTF-8 | 2,841 | 2.75 | 3 | [] | no_license | import paho.mqtt.client as HERO
import time
#General Usage Flow
#Create Client Instance
#Connect to a broker using one of the connect*() functions
#Call one of the loop*() functions to maintain network traffic flow with the broker
#Use subcribe() to subscribe to a topic and receibe messages
#Use publish() to publish m... | true |
00e1d1087b7162b54007d0eb4a566895b88c51c6 | Python | ZengyuanYu/Python-Web-Flask | /DataBase/Others/session_demo.py | UTF-8 | 729 | 2.515625 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Created by XiaoYu on 18-1-30
from flask import Flask, session
import os
app = Flask(__name__)
app.config['SECRET_KEY'] = os.urandom(24)
# 添加数据到session
@app.route('/')
def hello_world():
session['username'] = 'zhiliao'
return 'Hello World!'
@app.route('/get/')
de... | true |
b9591bfa9bbade33758e2a0b7895a0c0f608f8f6 | Python | carlhinderer/python-algorithms | /classic_cs_problems/code/ch02/dna_search.py | UTF-8 | 1,606 | 3.96875 | 4 | [] | no_license | from enum import IntEnum
Nucleotide = IntEnum('Nucleotide', ('A', 'C', 'G', 'T'))
def string_to_gene(s):
gene = []
for i in range(0, len(s), 3):
if (i + 2) >= len(s): # Don't run off end!
return gene
codon = (Nucleotide[s[i]], Nucleotide[s[i + 1]], Nucleotide[s[i + 2]])
... | true |
a2c60b7c25786f043bd70ad822cbf6a56d7bc990 | Python | sanghoonkim0918/2020_summer_internship | /RL_demo/evaluation.py | UTF-8 | 4,171 | 2.515625 | 3 | [] | no_license | from simulation import run_simulation
import numpy as np
from policies import *
from environment import Servers
from estimators import Evaluation
import sys
if __name__ == "__main__":
# Initialize basic variables
num_seeds = 5#int(input("num_seeds: "))
num_requests = 15#int(input("num_requests: "))
num... | true |
0ae464681b481a66a7e3f0369ea788607fe0eb23 | Python | yaochuanting/Python-Crash-Course | /05_if语句/5.3if语句.py | UTF-8 | 1,279 | 4.1875 | 4 | [] | no_license | # 判断一个人是否满足投票年龄
age = 19
if age >= 18:
print("You are old enough to vote!")
# if-else语句
age = 18
if age >= 18:
print("You are old enough to vote!")
print("Have you registered to vote yet?")
else:
print("Sorry, you are too young to vote.")
print("Please register to vote as soon as possible as you ... | true |
69fdc2c2c5a24f49185fe35fe0fcc2d25a24465e | Python | Wjonke/Intro-Python-II | /src/adv.py | UTF-8 | 2,965 | 3.515625 | 4 | [] | no_license | from src.room import Room
from src.player import Player
from src.item import Food, Egg, Sandwich, Rock
# Declare all the rooms
room = {
'outside': Room("Outside Cave Entrance",
"North of you, the cave mount beckons"),
'foyer': Room("Foyer", """Dim light filters in from the south. Du... | true |
899cae1d7ff9da73ea71fc50708d6ff129d51a85 | Python | RMULTILLIONER/hello-git | /hello-git/acadview/assignment/assignment6/assign6_1.py | UTF-8 | 342 | 4.375 | 4 | [] | no_license | #Q2
print("\n\n Q.2- Write an infinite loop.An infinite loop never ends. Condition is always true")
output = list()
print("\nEnter values to List : ")
for i in range(10):
int_val = int(input(("Enter %d value : ") %(i+1)))
output.append(int_val)
print("Integer List : " ,output)
while range(10):
prin... | true |
80ddababe673bc8cf7d00aaac1f329053497eab3 | Python | shenny88/python_casestudies | /cs4/10_sort_string.py | UTF-8 | 291 | 4.28125 | 4 | [] | no_license | # 10. Write a program that accepts a comma separated sequence of words as input and
# prints the words in a comma-separated sequence after sorting them alphabetically.
mystr = input("Enter string seperated by comma: ")
mystr_list = sorted(mystr.split(","))
print(",".join(mystr_list))
| true |
1eec38f553132bc5ef2684daed6fe0daf864b74a | Python | CryptoCrane2601/CSCX | /exercise_28.py | UTF-8 | 140 | 2.59375 | 3 | [] | no_license | #swap
import sys
for line in sys.stdin:
value1, value2 = line.split()
line = line.strip()
print(value2,value1)
| true |
863250cc5f19260ccc5c60cfdad403e044d8cc70 | Python | BerilBBJ/scraperwiki-scraper-vault | /Users/A/arjunmathai/infolinescraper_1.py | UTF-8 | 11,068 | 2.796875 | 3 | [] | no_license | import scraperwiki
# Blank Python
"""
Data will be stored in the following format: (one row for each company)
URL, Company Name, Revenue, ....
"""
import scraperwiki
from lxml import etree
def get_company_info(url):
try:
text = scraperwiki.scrape(url)
tree = etree.HTML(text)
... | true |
15e177c8b8712a27dbf0d0998ab99dcf3ada6339 | Python | humanoiA/Python-ML-Sessions | /unsup10.py | UTF-8 | 997 | 2.53125 | 3 | [] | no_license | from sklearn.decomposition import PCA
from sklearn.cluster import KMeans
#from plotly.offline import init_notebook_mode
import pandas as pd
#init_notebook_mode()
p1=pd.read_excel('RESPONSEDATA.xlsx','Campaign')
p2=pd.read_excel('RESPONSEDATA.xlsx','Response')
p2['n']=1
print(p1.tail())
print(p2.tail())
df=pd.... | true |
69a266c05ac3537a37d09ffbecb78ab9555edfef | Python | Siddhesh4501/Crypto-systems | /diff_hellmen_key_exchange.py | UTF-8 | 2,698 | 3.78125 | 4 | [
"MIT"
] | permissive |
print ("Both parties agree to a single prime")
prime=int(input("Enter the prime number to be considered: "))
# Primitive root to be used use
print ("Both must agree with single primitive root to use")
root=int(input("Enter the primitive root: "))
# Party1 chooses a secret number
alicesecret=int(input("Enter... | true |
40fd7d272c774ab6e089abd2d8f363a98a6253d8 | Python | RdelaCruzMartinez/Python | /Poo/Tarjeta_Prepago/TarjetaPrepago.py | UTF-8 | 2,909 | 3.515625 | 4 | [] | no_license |
from check_dni import *
from ClaseHora import *
class TarjetaPrepago:
'''
Clase que simula una tarjeta prepago permite al usuario efectuar acciones como ingresar saldo, enviar mensajes,
realizar llamadas... llevando un control del saldo actual.
Propiedades de la Clase:
numeroTelefono
saldo
nif
co... | true |
90df629749cad9a5d9058ce68d966e944b7ad6d2 | Python | kokishimi/Python | /62/622.py | UTF-8 | 2,924 | 2.71875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sun Aug 18 17:24:44 2019
@author: kokis
"""
import numpy as np
from sklearn.model_selection import train_test_split
from keras.models import Sequential
from keras.layers import Dense, Activation
from keras.layers.recurrent import LSTM
from keras.layers.wrappers import TimeDistri... | true |
4af160093f1b19b3c22f5802cf076afb355860cf | Python | claudiaaw/kopiCTF | /vigenere.py | UTF-8 | 1,657 | 2.75 | 3 | [] | no_license | original=['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']
##key=key
encryptionList = [['k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','a','b','c','d','e','f','g','h','i','j'],['e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u',... | true |
9c23eae2851e4702e4a4fab9413562cbb1589c8d | Python | NeonGhost35/CryptTool | /Crypt_Decrypt.py | UTF-8 | 1,634 | 2.734375 | 3 | [] | no_license | import os
import pyAesCrypt
from colorama import Fore, init
def crypt(filetocrp, password):
bufferSize = 512*1024
pyAesCrypt.encryptFile(str(filetocrp), str(filetocrp) + ".crp", password, bufferSize)
os.remove(filetocrp)
def decrypt(filetocrp, password):
bufferSize = 512*1024
pyAesCrypt.decryptFi... | true |
1890da59b1d3589acdfbf7422dd8b663dca257dc | Python | markpolyak/news-parser | /ttelegraf.ru/main.py | UTF-8 | 4,602 | 2.75 | 3 | [] | no_license | import requests
from bs4 import BeautifulSoup
import fake_useragent
from requests.adapters import HTTPAdapter
from requests.packages.urllib3.util.retry import Retry
HOST = 'https://www.ttelegraf.ru'
FILE = 'news.tsv'
def requests_retry_session(retries=3, backoff_factor=0.5):
session = requests.Session()
ret... | true |
51e2e0ea07dd5efd88635a73e758a50f26431799 | Python | Garry3930/Audiobook | /audiobook1.py | UTF-8 | 466 | 2.9375 | 3 | [] | no_license | #------------------------use this code to read pdf from scratch to end-----------------------
import PyPDF2
path = input("Enter the path of pdf file:")
pdfReader = PyPDF2.PdfFileReader(open(f'{path}','rb'))
import pyttsx3
speaker=pyttsx3.init()
for page_num in range(pdfReader.numPages):
text=pdfReader.getPage... | true |
86ed7227765399a743a31c7177e4baf7efb2a6fd | Python | syurskyi/Python_Topics | /125_algorithms/_examples/_algorithms_challenges/pybites/intermediate/324/pretty_string.py | UTF-8 | 136 | 2.796875 | 3 | [] | no_license | import pprint
from typing import Any
def pretty_string(obj: Any) -> str:
pp = pprint.pformat(obj, depth=2, width=60)
return pp | true |
3d03e14198c59eb09b71a531b407f37bc789d5d1 | Python | banmedo/WumpusWorld | /src/renderer.py | UTF-8 | 3,996 | 3.03125 | 3 | [] | no_license | import pygame
from .config import *
class Renderer:
"""This is the interactive renderer for the game.
"""
def __init__(self, env):
self.env = env
WIDTH = env.size_x * DIMS.CELL_SIZE
HEIGHT = env.size_y * DIMS.CELL_SIZE
pygame.init()
self.window_surface = p... | true |
c6bb350593a085e7233324c79d3dfba7d9fd0341 | Python | fearless1012/RobotArm | /hiwonder-toolbox/hw_find.py | UTF-8 | 1,485 | 2.53125 | 3 | [] | no_license | import os
import sys
import getopt
import socket
def get_cpu_serial_number():
f_cpu_info = open("/proc/cpuinfo")
for i in f_cpu_info.readlines():
if i.find('Serial',0, len(i)) == 0:
serial_num = i.replace('\n', '')[::-1][0:16].upper()
return serial_num
if __name__ == "__main__":
ho... | true |
a5e27635a1cccf7eba615272c96542f9c4a22914 | Python | patriacaelum/expense-report | /category_manager.py | UTF-8 | 6,531 | 3.421875 | 3 | [] | no_license | import json
import logging
from difflib import get_close_matches
logger = logging.getLogger(__name__)
class CategoryManager:
"""A json-based manager for categories.
This class is meant to handle all file reading and writing regarding the
categories, and for querying and adding categories as needed.
... | true |
2c46d0d69fdcbf7a0dd27bda2c3d3db25a0405c6 | Python | jbenden/deployer | /src/deployer/loader.py | UTF-8 | 590 | 2.671875 | 3 | [
"Apache-2.0"
] | permissive | """Pipeline Loader."""
from collections import OrderedDict
import yaml
# @staticmethod
def ordered_load(stream, loader=yaml.SafeLoader, object_pairs_hook=OrderedDict):
"""Load YAML, preserving the ordering of all data."""
class OrderedLoader(loader):
pass
def construct_mapping(loader, node):
... | true |
59211522e53469744f1328a5e6b7a11eb6720abd | Python | pasbahar/python-practice | /Activity_selection.py | UTF-8 | 1,157 | 3.65625 | 4 | [] | no_license | '''Given N activities with their start and finish times. Select the maximum number of activities that can be performed by a single person, assuming that a person can only work on a single activity at a time.
Note : The start time and end time of two activities may coincide.
Input:
The first line contains T denoting t... | true |
62bb0c22c4e508c5c205ce1dbe6f926492642fca | Python | RoadRunner11/data-warehouse-aws-pipeline | /blueFuel/gaToAws/functions/enrichment/utils/logger.py | UTF-8 | 275 | 3.28125 | 3 | [
"Apache-2.0"
] | permissive | from typing import Generator
def log_generator(iterations: int, xs: Generator[str, None, None]) -> ():
counter = 0
for x in xs:
if counter == iterations:
break
else:
counter += 1
print(x)
print(len(x))
| true |
15c1444489073ff50b1b7de8794be99d60ed1b5f | Python | veezard/game11 | /src/gameplay.py | UTF-8 | 11,750 | 2.984375 | 3 | [
"MIT"
] | permissive | import random
random.seed()
class Players:
def __init__(self):
self.names_logged_in = 0
self.names = []
self.websockets = {} # dictionary {name: websocket}
def register(self, ws, name):
if name in self.websockets: # Someone is already logged in with the name
retu... | true |
36b121a122b6367c3af4440fadaa270cf12c82f7 | Python | Erivks/aprendendo-python | /Solyd/banco/conta.py | UTF-8 | 522 | 3.625 | 4 | [] | no_license | class Conta():
def __init__(self, cliente, saldo):
self.cliente = cliente
self.saldo = saldo
def depositar(self, valor):
if valor < 0:
print('Erro no deposito.')
else:
self.saldo += valor
def sacar(self, valor):
if self.saldo + valor < 0:
... | true |
d4918ec7568656a71b64acc19de556ffe59e39c3 | Python | wannasmile/DM-Competition-Getting-Started | /AV-last-man-standing/xgb_gridsearchCV.py | UTF-8 | 2,083 | 2.609375 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding:utf-8 -*-
import pandas as pd
import matplotlib.pyplot as plt
from sklearn import metrics
from sklearn.cross_validation import train_test_split
from sklearn.ensemble import RandomForestClassifier
from sklearn.cross_validation import KFold
import xgboost as xgb
import time
from sklea... | true |
e4d3705f3fd74b98a8d6f16317739efa70fbcc7f | Python | antilost/heap | /python/group_logogriphs.py | UTF-8 | 1,204 | 3.375 | 3 | [] | no_license | #!/usr/bin/env python
from collections import defaultdict
import random
def group_logogriphs(input):
groups = dict()
for s in input:
key = ''.join( sorted(s) )
if key not in groups:
groups[key] = [s]
else:
i = 0
while (i < len(groups[key])) and (grou... | true |
c9cdf72cb776e1e5bacdbfdd9cd4ce648d5d6ae5 | Python | mark-mo/saiqa | /django-saiqa/saiqa/Model/Sentence.py | UTF-8 | 1,050 | 3.390625 | 3 | [
"Apache-2.0"
] | permissive | # A base sentence model for storing information related to sentences
# Created by: Mark Mott
class Sentence:
# A single underline denotes a private method/variable.
# Default is the property category
def __init__(self, sentence, subject, category='Property'):
self.setsentence(sentence)
self.... | true |
7cc7dc94db3b486faffb1a9a618347f261cca36b | Python | mattische/fiip | /client/ping.py | UTF-8 | 2,948 | 2.875 | 3 | [] | no_license |
def ping(host):
"""
returns True if host responds to ping request
"""
import os, platform
#Ping parameters as function of OS
ping_str = "-n 1" if platform.system().lower()=="windows" else "-c 1"
#Do the ping
return os.system("ping " + ping_str + " " + host) == 0
def get_ip_add... | true |
371c9ea9361a73ae1de1c072887d28d1d88a1593 | Python | pyomeca/bioptim | /bioptim/examples/torque_driven_ocp/example_soft_contact.py | UTF-8 | 5,926 | 2.78125 | 3 | [
"MIT"
] | permissive | """
A very simple optimal control program playing with a soft contact sphere rolling going from one point to another.
The soft contact sphere are hard to make converge and sensitive to parameters.
One could use soft_contacts_dynamics or implicit_dynamics to ease the convergence.
"""
import numpy as np
from bioptim im... | true |
009695c33d811229758e993888f3010101b7bcbb | Python | dr-masha/drp_wordcloud | /generate_word_cloud_project_titles.py | UTF-8 | 5,832 | 3.046875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Fri Dec 11 21:26:52 2020
@author: masa prodanovic, phd
@edited by: ankita singh, phd
This code produced an image of a word cloud based on
project titles from Digital Rocks Portal in Dec 2020.
The code is provided as is in hopes of being useful.
This is one of the ex... | true |
02039b7afa5bb2fb0ebc0871d57a71c3ce46aa57 | Python | jatodavid/git_test1 | /exercise01.py | UTF-8 | 647 | 2.734375 | 3 | [] | no_license | from socket import socket
def handel(connfd):
request = connfd.recv(1024)
if not request:
return
print(request.decode())
# 组织响应
response = "HTTP/1.1 200 OK\r\n"
response += "Content-Type:text/html\r\n"
response += "\r\n"
with open("my.html") as f:
response+=f.read()
... | true |
3559cd8e4e87b0f812e9a0968c861639764ca150 | Python | h4rr9/gymcube | /gymcube/wrappers/GetChildren.py | UTF-8 | 1,228 | 2.84375 | 3 | [] | no_license | from pickle import dumps, loads
import numpy as np
from gym import Wrapper
class GetChildren(Wrapper):
"""Returns the children of the current state"""
def __init__(self, env):
super(GetChildren, self).__init__(env)
def step(self, action):
obs, rew, done, info = self.env.step(action)
... | true |
510c88e149ae28d1e8d40bdc55d7abd7db747844 | Python | Tiagoksio/estudandoPython | /exercicios005/triangulos.py | UTF-8 | 604 | 4.34375 | 4 | [] | no_license | # Desenvolva um programa que leia o comprimento de 3 retas e diga ao usuário se elas podem ou não formar um triângulo.
segmento = []
while len(segmento) < 3:
segmento.append(float(input('Informe o {}º segmento: '.format(len(segmento) + 1))))
if segmento[0] < segmento[1] + segmento[2] and segmento[1] < segmento[0] +... | true |
6c54a04421627cdf5058414d5656229a946b2857 | Python | SCStatistics/symptomchallenge | /eb_with_features/eb_estimate_with_impute_data.py | UTF-8 | 3,739 | 2.859375 | 3 | [] | no_license | from EmpBayes import EmpBayes
import pandas as pd
import numpy as np
from sklearn.preprocessing import StandardScaler
WEEKLY = True
id_columns = ['date','fips']
response_column = 'pct_avoid_contact_all_or_most_time'
non_feature_columns = id_columns + ['pct_avoid_contact_all_or_most_time','n', 'x']
# Load data
combin... | true |
9fe5f7b7d24ed0ad89009e37c82c7e4fab315cfc | Python | costachina2018/imglab | /imglib.py | UTF-8 | 6,861 | 3.140625 | 3 | [] | no_license | import numpy
import urllib.request
from PIL import Image, ImageDraw
import random
import io
import math
import os
# 初始化应用文件夹
if not os.path.exists('cache'):
os.mkdir('cache') # 用于缓存远程图片
if not os.path.exists('save'):
os.mkdir('save') # 用于保存输出图片
# 初始化设备常量
def createScreenWidth(device): # 工厂模式
r = 750 # ... | true |
29286d8555c770282512a7cd0597223ca57367b5 | Python | mauricioszabo/learning | /tetris/pyTetris/Main.py | UTF-8 | 2,739 | 3.1875 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import pygame
from Board import Board
class Principal:
def __init__(self):
pygame.init()
self.screen = pygame.display.set_mode([806,604])
self.tabuleiro = pygame.image.load("Tabuleiro.png")
self.peca = pygame.image.load("Bloco.png")
... | true |
ab99de57375952ae6cf3be5bab87d717ef604dda | Python | swarnim321/ms | /dataStructures_Algorithms/MergeSort.py | UTF-8 | 592 | 3.46875 | 3 | [] | no_license | import sys
def mergesort(A,first,last):
if first<last:
mid = (first+last)//2
mergesort(A,first ,mid)
mergesort(A,mid+1,last)
merge(A,first,mid,last)
def merge(A,first,mid,last):
left = A[first:mid+1]
right = A[mid+1:last+1]
left.append(sys.maxsize)
right.... | true |
a7d66209f46272ab5fc8fb1e8bb1a2cb025fb9e1 | Python | YazanWAsaad/GitAppPy | /Base/Files.py | UTF-8 | 725 | 2.8125 | 3 | [] | no_license | import os
from pathlib import Path
import configparser
def WorkingDir()->str:
return(os.getcwd() + os.path.sep)
# Text File handlers API
def TextRead(file_name:str)->str:
file_path = WorkingDir() + file_name;
f = open(file_path, 'r')
return(f.read())
def TextReadLines(file_name:str)->str:
r... | true |
f746c1a8cb9be0d449d83627d3ad8d69b9a1c87d | Python | cmoiccool/newsblaster | /feature-extraction/article_extractor/charmeleon.py | UTF-8 | 5,042 | 3.09375 | 3 | [] | no_license | from collections import defaultdict
class Charmeleon():
# Iterate character-wise through text and compute featureDict
def compute_features(self, text):
# Setup dict for counts
featureDict = defaultdict(int)
featureDict['len'] = len(text)
decodedText = text.encode('ascii','repla... | true |
7b327ad5d26c37d1a627903ff84503158a9e9a70 | Python | rcard6/classificadors | /src/LogisticRegressor.py | UTF-8 | 502 | 2.84375 | 3 | [] | no_license | from Classificador import Classificador
import numpy as np
from sklearn.linear_model import LogisticRegression
class LogisticRegressor(Classificador):
def __init__(self, path, applicationmethod):
Classificador.__init__(self, path, applicationmethod)
self.classificador = LogisticRegression(C=2.0, ... | true |
4f321af915a903279c04092f1f9d40c4fe8393a1 | Python | Skydler/practica-web-semantica | /TP1-Scrapper/src/db/merge.py | UTF-8 | 3,825 | 3.09375 | 3 | [] | no_license | from deep_translator import GoogleTranslator
from fuzzywuzzy import fuzz
class MergeStrategy:
def __init__(self, repository_movies):
self.merged_movies = repository_movies
self.titles_cache = {}
self.translator = GoogleTranslator(source='auto', target='es')
self.rate_rules = [
... | true |
ea78716a41e162922e271c6caba1c3e4ec6a36a2 | Python | ayyyushhhhh/automatic_email_sender | /send_mail.py | UTF-8 | 2,322 | 2.65625 | 3 | [] | no_license | import smtplib
import ssl
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
from email.mime.application import MIMEApplication
from email.mime.base import MIMEBase
from email import encoders
from data_model import Data
class Mail:
def __init__(self):
self.message = MIMEMul... | true |
36cebad13fc5987dc93e3729a7782430bf0e5265 | Python | RRCHcc/python_net | /pythonNet/day03/作业_server.py | UTF-8 | 1,090 | 3.140625 | 3 | [] | no_license | """
使用tcp服务端和客户端编程,
将一个文件从客户端发送到服务端,
文件类型为图片或者普通文本皆可
while True:
time.sleep(0.1)
data = fd.readline(27)
if not data:
break
sockfd.send(data)
"""
from socket import *
#创建套接字对象
sockfd = socket(AF_INET, SOCK_STREAM)
sockfd.setsockopt(SOL_SOCKET,SO_REUSEADDR, True)
#绑定地址
... | true |
1b4758623ab22e080a82bb45ab37109e1121aa38 | Python | tudorcebere/PySyft | /test/generic/pointers/test_callable_pointer.py | UTF-8 | 2,643 | 2.953125 | 3 | [
"Apache-2.0"
] | permissive | import torch
from syft.generic.pointers import callable_pointer
from syft.generic.pointers.object_wrapper import ObjectWrapper
def test_create_callable_pointer(workers):
"""
Asserts that a callable pointer is correctly created.
"""
alice = workers["alice"]
bob = workers["bob"]
p = callable_poi... | true |
1e938b69d109a689a989e10098f33fe71d1ead1f | Python | kerupuksambel/paa-quiz-2 | /main.py | UTF-8 | 1,557 | 3.625 | 4 | [] | no_license | import BellmanFord, Dijkstra
import random
vertices = 0
while vertices < 5:
vertices = int(input("Enter the vertices of the graph (minimum 5) >> "))
graf = range(vertices)
graf_table = []
graf_existed = [[0 for column in range(vertices)] for row in range(vertices)]
is_negative = False
for src in graf:
for dst in ... | true |
abfb59e11b7650a6f98f7365ff09b8984f043832 | Python | sifathasib/Multimedia-Using-Python | /image/composite.py | UTF-8 | 382 | 2.578125 | 3 | [] | no_license | from PIL import Image,ImageDraw,ImageFilter
size = (512,512)
im1 = Image.open('assets\\lena.jpg').resize(size)
im2 = Image.open('assets\\bridge.png').resize(size)
mask = Image.new("L",size,0)
draw = ImageDraw.Draw(mask)
draw.ellipse((100,100,(512-100),(512-100)),fill= 255)
mask = mask.filter(ImageFilter.GaussianBlur... | true |
f696510ab7ff2a945d649c4ca397c637f5d1c3e9 | Python | CurroValero05/TIC-2-BACH | /Contrasena_2.py | UTF-8 | 268 | 4.0625 | 4 | [] | no_license | #Escribe un programa que genere una contrasena
#con 3 letras de tu nombre y 3 del aellido
def contrasena_2():
nombre=raw_input("Introduce el nombre: ")
apellido=raw_input("Introduce el apellido: ")
print nombre[-3:]+apellido[-3:]
contrasena_2()
| true |
85d57aa2429d7b977b0e6d56203dcd496436bf4f | Python | emiltayl/mud.tilde.town | /src/player.py | UTF-8 | 12,518 | 2.75 | 3 | [] | no_license |
from colors import *
from combat import *
from functions import formatinput, pMatch
from objects import *
import pickle
from random import randint, choice
from human import *
class player(human):
def __init__(self, protocol, factory, time):
super(player, self).__init__(time, factory)
#these must b... | true |
8e5ffdc62b4cd7a8a023bbe615210d45704f8786 | Python | EngineerReversed/sample_repo_abhishek | /Python_Assignments/Q15.py | UTF-8 | 541 | 3.8125 | 4 | [] | no_license |
def main(total, numLegs):
for rabbits in range(total + 1):
chickens = total - rabbits
if 2 * chickens + 4 * rabbits == numLegs:
return chickens, rabbits
return None, None
if __name__ == '__main__':
try:
numHeads = int(raw_input("Input number of heads: "))
numLe... | true |
18f365caf30ce91b57c26d2a22557321e5e04357 | Python | RadoslawPotyka/DataVisualiser | /Visualiser/modules/common/controllers.py | UTF-8 | 10,268 | 2.6875 | 3 | [] | no_license | from abc import abstractmethod
from .forms import FormHandler
from .services import CommonServiceProvider as Services
from .errors import VisualiserError, UnhandledError, FileNotUploadedError
class BaseController(object):
"""
Base interface for view controllers. Gathers and handles data for later display to ... | true |
3ed2121e7504405d7ebf50dc108d936c61191a05 | Python | jackcarroll5/Python-Work | /HelloWorld/ranges.py | UTF-8 | 381 | 3.703125 | 4 | [] | no_license | for i in range(0, 10, 2):
print("i is now {}".format(i))
print()
for i in range(10, 0, -2):
print("i is now {}".format(i))
print()
for i in range(10, 2):
print("i is now {}".format(i))
print()
for i in range(0, 10):
print("{}".format(i))
print()
for i in range(0, 101, 7):
print(i)
print()
... | true |
0f26d82a5ee25755cb3c32b7149d44f9afcd02f9 | Python | ankurhanda/python_plotting | /subplot_tighest.py | UTF-8 | 383 | 3.21875 | 3 | [] | no_license | import matplotlib.pyplot as plt
import numpy as np
#Random Image
someImage = np.random.random((10,10,1))
# Creare your figure and axes
fig,ax = plt.subplots(1)
# Set whitespace to 0
fig.subplots_adjust(left=0,right=1,bottom=0,top=1)
# Display the image
ax.imshow(someImage[:,:,0],extent=(0,1,1,0))
# Turn off axes a... | true |
83801cd0a4c1820f7e2eec27ad2812fa887a9d1a | Python | azusa1115/study-python | /basic/chapter4.py | UTF-8 | 1,274 | 3.84375 | 4 | [] | no_license | #for文
for a in [1,2,3,4,5]:
print(a)
print("こんにはち")
for a in range(1,5+1):
print(a)
print("こんにちは")
for a in range(100):
print( a + 1 )
print("こんにちは")
# while文(繰り返す)
#ずっと動きっぱなしになったらこんとろーる+cキー
#else
total = 0
a = 1
while total <= 50:
total = total +a
a = a + 1
print(total)
# and 二つの条件が成り立つ時
# or 二つ... | true |