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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
120619f54431f83fb7cba20d4393f406956ed0c7 | Python | MOE-Geomatics/PGMN | /Precipitation/Convert.py | UTF-8 | 1,495 | 2.59375 | 3 | [] | no_license | # ---------------------------------------------------------------------------
# Convert.py
# Created on: Thu May 16 2013 04:13:29 PM
# (generated by ArcGIS/ModelBuilder)
# ---------------------------------------------------------------------------
# data input: an Access file with all stations in tables.
# 1) Use Arc... | true |
fbddbf22e784ec42b25f67adc035cf829134c07f | Python | recuraki/PythonJunkTest | /atcoder/ABC/206_d.py | UTF-8 | 4,837 | 3.03125 | 3 | [] | no_license | import sys
from io import StringIO
import unittest
import logging
logging.basicConfig(level=logging.DEBUG)
def resolve():
# https://note.nkmk.me/python-union-find/
# https://qiita.com/Kerzival/items/6923c2eb3b91be86f19f
class UnionFindAtCoder():
# 作りたい要素数nで初期化
# 使用するインスタンス変数の初期化
... | true |
839ef96c0db7d47f219b7f1390d93c16379c9ebb | Python | Justin-Keener/CS-1301 | /HW 2/hw2.py | UTF-8 | 13,496 | 4.46875 | 4 | [] | no_license | """ Fruitful functions and conditionals """
"""
Function name (1): is_in_stock
Parameters: item(str), quantity(int)
Return Value: True, false, or None (None Type)
Description: Write a function that determines whether or not the parameter item is in stock. If so, you also need
to check that there ... | true |
bb44c4ec9baadd7359c271ba7f5f4781dd7d84e2 | Python | sixxchung/damdam | /test.py | UTF-8 | 519 | 3 | 3 | [] | no_license | import sixx
import json
inline_JSON = '{"id":1, "name": ["abc", "xyz"]}'
jsonData = json.loads(inline_JSON)
jsonData.get("name")
json.dumps(jsonData)
print(json.dumps(jsonData, indent='\t'))
path_JSON = './jsondata/jsn2.json' # String
### Read File <way1>
jsonFile = open(path_JSON,'r') #'r'ead,'w'rite,'a'ppend
jsonD... | true |
8d3159548777a7dc503fe21d686fa44b1ffbf084 | Python | omerkarabacak/serverless-csv-to-dynamodb | /app.py | UTF-8 | 746 | 2.5625 | 3 | [] | no_license | import boto3
import csv
def lambda_handler(event, context):
for record in event['Records']:
bucket = record['s3']['bucket']['name']
file_key = record['s3']['object']['key']
s3 = boto3.client('s3')
csvfile = s3.get_object(Bucket=bucket, Key=file_key)
csvcontent = csvfile['Bo... | true |
e091c286fbd0c2ba26955880964b0349dc4f2b52 | Python | wempem/Scripting | /src/python/Function_Basic.py | UTF-8 | 643 | 4.09375 | 4 | [] | no_license | #!/usr/bin/python
## Function_Basic.py
def get_name(): #(A)
"Get from the user his/her first and last names" #(B)
first = raw_input( "Enter your first name: " ) #(C)
last = raw_input( "Enter your last name: " ) ... | true |
7ad336274a2335185a39a72056eeedd0ee7bfc15 | Python | SamChen1981/image-recognition | /OTSU.py | UTF-8 | 1,001 | 2.796875 | 3 | [] | no_license | """
python 大津法实现 计算阀值 网上摘录
弃用原因: cv2的threshold 自带大津法
"""
import numpy as np
def OTSU_enhance(img_gray, th_begin=0, th_end=256, th_step=1):
assert img_gray.ndim == 2, "must input a gary_img"
max_g = 0
suitable_th = 0
for threshold in range(th_begin, th_end, th_step):
bin_img = img... | true |
f1976347b9c87feaa09226962ae05c4f5d235efe | Python | Zakaria9494/python | /learn/oop/Main.py | UTF-8 | 1,008 | 3.21875 | 3 | [] | no_license | from oop.Author import *
from oop.Book import Book
from oop.Library import Library
author1 = Author("Mhamad", "+96170123456", "mhamad@gmail.com")
author2 = Author("Salem", "+9664021833", "salem@gmail.com")
author3 = Author("Rola", "+9631249392", "rola@gmail.com")
book1 = Book("Learn Java", "12-20-2019", 1, autho... | true |
33790ec9ca005342222157f6724f0a3da1ba35e6 | Python | Savital/monitorkbd | /models/db.py | UTF-8 | 4,787 | 2.546875 | 3 | [
"MIT"
] | permissive | # Savital https://github.com/Savital
import sqlite3
class Users():
createTableSQL = "CREATE TABLE IF NOT EXISTS users(username CHAR)"
dropTableSQL = "DROP TABLE IF EXISTS users"
selectSQL = "SELECT * FROM users"
selectByNameSQL = "SELECT * FROM users WHERE username='{0}'"
insertSQL = "INSERT INTO ... | true |
4c7f58eed7e3d8a95602c62eed059cb6473cbeed | Python | qianshuang/ant_exam | /test.py | UTF-8 | 1,679 | 2.578125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import os
from scipy import stats
import random
from data.cnews_loader import *
from numpy import *
base_dir = 'data/cnews'
all_dir = os.path.join(base_dir, 'cnews.all.txt')
balance_all_dir = os.path.join(base_dir, 'cnews.balance_all.txt')
balance_train_dir = os.path.join(base_dir, 'cnews.bala... | true |
eef5099b3418e502b0861cab1829b89d1a22d114 | Python | Evg3sha/lesson3 | /bot/bot_wordcount.py | UTF-8 | 1,593 | 3.03125 | 3 | [] | no_license | # Импортируем нужные компоненты
from telegram.ext import Updater, CommandHandler, MessageHandler, Filters
import settings
import logging
logging.basicConfig(format=('%(name)s - %(levelname)s - %(message)s'), level=logging.INFO, filename='bot_wordcount.log')
# Функция, которая соединяется с платформой Telegram, "т... | true |
77b0d4af240a1502ea822ac69f108b2dff090dcf | Python | chaitraliv/Assignments | /P06.py | UTF-8 | 373 | 3.796875 | 4 | [
"MIT"
] | permissive | mylist=['x','a','m','a','x']
start = 0
end = len(mylist)-1
count=0
for item in mylist:
if mylist[start] == mylist[end]:
start+=1
end-=1
count=1
else:
start += 1
end -= 1
count-=1
if count > 0:
print(f'Yes! Given list {mylist} is a Palindrome !')
else:
pr... | true |
754ff288099a9d8266af8e2ede629df7cf0b2047 | Python | JaisonST/PartionsPython | /pt.py | UTF-8 | 3,945 | 3.171875 | 3 | [] | no_license | #-------------------Intro Note----------------------------------#
#Function: Backend Functiond for Partions Program
#Made by: Jaision Thomas
#---------------------------------------------------------------#
#---------------Create Partion Function-------------------------#
def getPartitions(n):
retval = []
p = [0] ... | true |
040872c0586290f40cbc61865e0e1b67a476168c | Python | Kesin11/Python-study | /src/multi_reduce.py | UTF-8 | 2,306 | 3.109375 | 3 | [] | no_license | #coding: utf-8
import multiprocessing as mp
from time import time, sleep
import os
'''
マルチプロセスでReduceを実装
'''
def add(x, y):
sleep(0.1)
print 'pid: %s, add:%d, %d' % (os.getpid(), x, y)
return x+y
def in_reduce(func, li):
return reduce(func, li)
def multi_reduce(func, arg_list, core=mp.cpu_... | true |
2017945b19759c5781cca74fa75546ae7b9c7a66 | Python | fdurant/kiva_project | /src/KivaLoans.py | UTF-8 | 4,771 | 2.609375 | 3 | [] | no_license | from KivaLoan import KivaLoan
from KivaPartners import KivaPartners
from os.path import expanduser
from SldaTextFeatureGenerator import SldaTextFeatureGenerator
class KivaLoans(object):
''' Class representing a collection of loans at kiva.org '''
def __init__(self, loanIdList=None, loanDictList=None):
... | true |
66af88db005b6d4a24cf4595b897ba0edba2a111 | Python | Yuliya-Karuk/get-repo | /lesson04/easy_homework.py | UTF-8 | 1,900 | 4.375 | 4 | [] | no_license | # Все задачи текущего блока решите с помощью генераторов списков!
# Задание-1:
# Дан список, заполненный произвольными целыми числами.
# Получить новый список, элементы которого будут
# квадратами элементов исходного списка
# [1, 2, 4, 0] --> [1, 4, 16, 0]
import random
lst_beg = [random.randint(-10, 10) for i in ra... | true |
b77533b1d15e0b05f21e36220d4619dddc39d0db | Python | Anya1234/1c_task | /parse_image.py | UTF-8 | 4,399 | 3.09375 | 3 | [] | no_license | import numpy as np
def find_black(image_data):
print(image_data)
result = np.full((image_data.shape[0], image_data.shape[1]), False)
for i in range(image_data.shape[0]):
for j in range(image_data.shape[1]):
if image_data[i][j][0] < 50 and image_data[i][j][1] < 50 and \
... | true |
dbdf245acdac888f7866467dca1a778cfcb64d17 | Python | rajarameshmamidi/NLP | /nlp_text_generation.py | UTF-8 | 2,023 | 3.984375 | 4 | [] | no_license | # Read in the corpus, including punctuation!
import pandas as pd
#Build a Markov Chain Function
from collections import defaultdict
#Create a Text Generator
import random
data = pd.read_pickle('corpus.pkl')
data
# Extract only Ali Wong's text
ali_text = data.transcript.loc['ali']
ali_text[:200]
print('da... | true |
eee031351c4115a1057b3b81293fe25a17ad8066 | Python | jrinder42/Advent-of-Code-2020 | /day15/day15.py | UTF-8 | 767 | 3.515625 | 4 | [] | no_license |
'''
Advent of Code 2020 - Day 15
'''
lookup = {0: [1],
3: [2],
1: [3],
6: [4],
7: [5],
5: [6]}
turn = 7
prev = 5
while turn != 2020 + 1: # Part 1
#while turn != 30_000_000 + 1: # Part 2
if prev in lookup and len(lookup[prev]) == 1:
prev = 0
i... | true |
1919e76da1680f882731f7dcf908d89472ff10f6 | Python | ysli16/coverage-path-generation | /old versions/waypointpart/singlearearoute.py | UTF-8 | 8,057 | 2.953125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Spyder Editor
This is a temporary script file.
"""
import numpy as np
import matplotlib.pyplot as plt
import math
from shapely import geometry
def rotate(point):
x=cos*point[0]-sin*point[1]
y=cos*point[1]+sin*point[0]
rpoint=np.array([[x,y]]).reshape(1,2)
retur... | true |
db28c4e8be1c953d983d16260b8883a4d8892711 | Python | drewkarpov/python_pytest | /test_framework/helpers/BrowserApi.py | UTF-8 | 1,470 | 2.859375 | 3 | [
"BSD-3-Clause"
] | permissive | import allure
from selenium.webdriver.support import expected_conditions
from selenium.webdriver.support.wait import WebDriverWait
DEFAULT_ELEMENT_WAIT_TIMEOUT = 40
class BrowserApi:
def __init__(self, driver):
self._driver = driver
def __wait_for_element_present(self, locator, time=None):
r... | true |
ba41627f50138051c2dfd85d490a26e6466c753d | Python | jairGil/Libreria-BDDII | /modelo/Persona.py | UTF-8 | 471 | 2.6875 | 3 | [] | no_license | from modelo.Direccion import Direccion
class Persona:
rfc: str
nombre: str
apellido_paterno: str
apellido_materno: str
direccion: Direccion
def __init__(self, rfc: str, nombre: str, apellido_paterno: str, apellido_materno: str, direccion: Direccion) -> None:
self.rfc = rfc
sel... | true |
5499a86b969a3d8bd1b98e408c2efa35294f598d | Python | WeiProtein/Self-replicating-repo | /create_repo/routes.py | UTF-8 | 4,836 | 2.765625 | 3 | [] | no_license | #!/usr/bin/env python
from flask import Flask, render_template, url_for, flash, redirect, request
from create_repo import app,db
from create_repo.forms import InfoForm
from create_repo.models import User
import os
import getpass
import subprocess
from subprocess import Popen, PIPE
#routes start
@app.route("/",methods... | true |
b0e5f025e0dc92d97646b5fde9c52ebfb8ea8144 | Python | EDITD/riak-python-client | /riak/client/index_page.py | UTF-8 | 6,155 | 2.578125 | 3 | [
"Apache-2.0"
] | permissive | # Copyright 2010-present Basho Technologies, Inc.
#
# 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 a... | true |
6359e923d2fcb2edee64b0905f245136722b65af | Python | yellowracecar/chiffer | /chiffer.py | UTF-8 | 514 | 3.609375 | 4 | [] | no_license | key = 0
letters = []
crypt = []
meny = 0
while meny != 3:
print("1. Kryptera")
print("2. Dekryptera")
print("3. Avsluta")
meny = int(input("Vad vill du göra? "))
if meny == 1:
word = input("Vad vill du kryptera? ")
key = input("vad vill du ha för nyckel? ")
for letter in w... | true |
fdf60411085508e9ae4335081c60d48f37ea434f | Python | jainshubhi/find_people | /find_people.py | UTF-8 | 3,094 | 2.875 | 3 | [] | no_license | import json
import time
import os
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
def read_config():
'''
Read config.json file. config.json should have companies and jobs keys.
'''
with open('config.json') as f:
config = json.load(f)
return config['companies... | true |
162d18d1aa1b81c2da5cb092c70bd1716f09aae1 | Python | smarden1/data-tools | /datatools/HistogramPlot.py | UTF-8 | 553 | 3.34375 | 3 | [] | no_license | import math
class HistogramPlot(object):
defaultRange = 50
def __init__(self, data, zero_start = False, displayRange = defaultRange):
self.data = data
self.range = displayRange
self.bin_size = math.ceil(self.data.range(zero_start) / self.range) + 1
def result(self):
r... | true |
c4aabea30604281b3bb48966961a4faf3695b811 | Python | MrHamdulay/csc3-capstone | /examples/data/Assignment_7/bgrtej001/util.py | UTF-8 | 2,593 | 4.1875 | 4 | [] | no_license | """Tejasvin Bagirathi BGRTEJ001
Assignment 7, Question 2
util.py"""
global grid
grid = []
#Create grid function to make empty grid
def create_grid(grid):
for i in range(4):
#Create new row
row_x = []
for j in range(4):
#Add zero's to row
row_x.append(0... | true |
db63756e771ec099046d9a4848f874437875db72 | Python | srikantviswanath/Algo-Practice | /dfs/count_paths_for_a_sum.py | UTF-8 | 1,150 | 3.75 | 4 | [] | no_license | """Given a binary tree and a number ‘S’, find all paths in the tree such that the sum of all
the node values of each path equals ‘S’. Please note that the paths can start or end at any
node but all paths must follow direction from parent to child (top to bottom)"""
from trees import TreeNode, build_binary_tree
from ty... | true |
25e82d30ca9c54bd17ed91944044cdd673607ff5 | Python | zdd0819/MsPacman_DQN | /gifMaker.py | UTF-8 | 668 | 2.703125 | 3 | [] | no_license | import imageio
import os
class GifAgent:
def __init__(self):
self.storage = []
self.max_score = 0
self.max_storage = []
def store(self, img):
self.storage.append(img)
def commit(self, score, auto_output=False):
if score > self.max_score:
self.max_score... | true |
b6d9c69286a64cd8db453a19dd2d057353daf4ad | Python | bayguang/FruitRecognition | /models/vgg_model.py | UTF-8 | 1,377 | 2.609375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3.7
# -*- coding: utf-8 -*-
from keras import backend as K
from keras.models import Sequential
from keras.layers import Conv2D, MaxPooling2D, Activation
from keras.layers import Reshape, Lambda, BatchNormalization, ZeroPadding2D
from keras.layers.core import Dense, Dropout, Activation, Flatten
d... | true |
584171e2ae6965b58f39adf551361ddd074caaa9 | Python | DiffeoInvariant/pytex | /pytex/code.py | UTF-8 | 8,537 | 2.640625 | 3 | [] | no_license | from .environment import Environment
from .command import Command, UsePackage, TextModifier
from .text import TextLines
from collections.abc import Iterable
def _comma_separated_tuple(tpl):
n = len(tpl)
csv = []
for i,val in enumerate(tpl):
if i < n-1:
csv.append(str(val)+',')
e... | true |
0c1298415ecc68977583cfc5ff98dd6e99d69101 | Python | cginternals/khrbinding-generator | /khrapi/API.py | UTF-8 | 3,533 | 2.734375 | 3 | [
"MIT"
] | permissive |
from .Version import Version;
from .Extension import Extension;
class API(object):
def __init__(self, identifier, revision):
self.identifier = identifier
self.revision = revision
self.apis = []
self.versions = []
self.extensions = []
self.types = []
self.fun... | true |
48d56dd12959623bd19450b1024c889691277e80 | Python | tsemach/pyexamples | /pyexamples/contextmanager/contextmanager-04.py | UTF-8 | 944 | 3.875 | 4 | [] | no_license |
"""
from: https://jeffknupp.com/blog/2016/03/07/python-with-context-managers/
The decorator generate another function behind the scenes which wrap the defined method
Using the @contextmanager decorator.
- The decorate a generator function that calls yield exactly once.
- Everything before the call to yield is consid... | true |
0ee1282af27a60f2531b85f8052e2eada0d8112e | Python | Aasthaengg/IBMdataset | /Python_codes/p03427/s960365152.py | UTF-8 | 329 | 2.875 | 3 | [] | no_license | #-*-coding:utf-8-*-
import sys
input=sys.stdin.readline
def main():
n = list(map(int,input().rstrip()))
digit=len(n)
ans1=0
ans2=0
if digit==1:
print(n[0])
exit()
else:
ans1=sum(n)
ans2=n[0]-1+(digit-1)*9
print(max(ans1,ans2))
if __name__=="__main__":
... | true |
99e76f3f180e2c9c276e337b969587003aa2fe42 | Python | huozhiwei/Python3Project | /TCPAndUDP/TCP客户端代码.py | UTF-8 | 908 | 3.203125 | 3 | [] | no_license | #coding:utf-8
from socket import *
print("=====================TCP客户端=====================")
HOST = '127.0.0.1' #服务器ip地址,等价于localhost
PORT = 21567 #通信端口号
BUFSIZ = 1024 #接收数据缓冲大小
ADDR = (HOST, PORT)
tcpCliSock = socket(AF_INET, SOCK_STREAM) #创建客户端套接字
tcpCliSock.connect(ADDR) #发起TCP连接
while True:
data = input('> ') #... | true |
033a6e0d9d95e7a7f6cfa93b65fc1084030f3935 | Python | giuscri/problem-solving-workout | /Drools.py | UTF-8 | 1,730 | 3.375 | 3 | [] | no_license | import itertools
def f0(g):
return len(list(filter(lambda x: x=='red', \
map(lambda t: t[1], g)))) == 1
def f1(g):
fred_pos = list(filter(lambda t: t[0]=='fred', g))[0][-1]
lst = list(filter(lambda t: t[-1]==fred_pos+1, g))
return len(lst) > 0 and lst[0][1] == 'blue'
def... | true |
f8c76709c52d45dae58792a402164a16f9688fce | Python | williamvdev/genetic | /python/knapsack.py | UTF-8 | 4,115 | 3.296875 | 3 | [] | no_license | from random import randint, random
import json
POPULATION_SIZE = 100
GENERATIONS = 100
KNAPSACK_MAX_WEIGHT = 15000
TREASURE_FILE = 'python/treasures.json'
INHERITANCE_FACTOR = 0.5 # What fraction of bits are copied from parent A
MUTATION_FACTOR = 0.01 # What fraction of bits are flipped in a child.
def treasure_gener... | true |
cab4f24e669a87cef9633c9f0867231e26c396d9 | Python | Sunghwan-DS/TIL | /Python/Programmers/Level_2_더_맵게.py | UTF-8 | 1,525 | 3.203125 | 3 | [] | no_license | # def solution(scoville, K):
# if sum(scoville) < K:
# return -1
#
# scoville.sort()
# scoville.insert(0, 0)
# answer = 0
# print("초기조건:", scoville)
#
# while scoville[1] < K:
# scoville[1], scoville[-1] = scoville[-1], scoville[1]
# min_s = scoville.pop(-1)
# tar... | true |
48c3cf1f0c4fb897959f1735d0a2fce5f0c8ab62 | Python | nandansn/pythonlab | /durgasoft/chapter41/function-return-another-function.py | UTF-8 | 256 | 2.8125 | 3 | [] | no_license | def outer():
print('outer function')
def inner():
print('inner function')
print('outer returning innner function...')
def inner2():
print('inner 2 function')
return inner, inner2
f1,f2=outer()
f1()
f2()
| true |
db3c37faa847ced223e675090befd9f750b9a1fd | Python | Derhks/AirBnB_clone_v3 | /api/v1/views/cities.py | UTF-8 | 3,003 | 2.78125 | 3 | [
"LicenseRef-scancode-public-domain"
] | permissive | #!/usr/bin/python3
"""
This module create a new view for City objects
"""
from api.v1.views import app_views
from flask import Flask, jsonify, make_response, request
from models.state import State
from models.city import City
from models import storage
@app_views.route('/states/<state_id>/cities',
st... | true |
79eb0b4a21c6f0a67e881be58dc722e1f1af3b79 | Python | Luodian/Data-Structure | /HashSet/HashSet/plot.py | UTF-8 | 4,949 | 2.921875 | 3 | [] | no_license | #!/urs/bin/python
# -*- coding: UTF-8 -*-
import matplotlib
matplotlib.use("Agg")
import matplotlib.pyplot as plt
def readFile(fileName,words,times):
file = open(fileName);
print "Name of file: ", file.name
scale = ""
time = ""
for line in file.readlines():
index = line.find(' ', 0, len(li... | true |
659d94446094880a10ea9676bf34117feab863c0 | Python | plusEV/xgboost_to_c | /xgb_to_c.py | UTF-8 | 3,344 | 2.6875 | 3 | [] | no_license | mport contextlib
from sklearn.tree.tree import DecisionTreeRegressor, DTYPE
from sklearn.ensemble.gradient_boosting import GradientBoostingRegressor
from sklearn.ensemble.forest import ForestRegressor
#ALWAYS_INLINE = "__attribute__((__always_inline__))"
ALWAYS_INLINE = "ALWAYS_INLINE"
class CodeGenerator(object):
... | true |
83cc7f64d393d8763ac93f462ef27bf7dd873b51 | Python | stankiewiczm/contests | /ProjectEuler/UC solutions/Successful 1-50/Q024.py | UTF-8 | 643 | 2.765625 | 3 | [] | no_license | from Numeric import *
N = 1000000-1; D = zeros(10);
def Translate(d):
e = zeros(10);
e[0] = d[0];
for i in arange(1,10):
Cnt = 0;
Fre = zeros(10-i);
for j in arange(10):
Mis = 1;
for k in arange(i):
if e[k] == j:
Mis = ... | true |
bfdd290394cfeead24bb8eb1dccc0b5703f92a24 | Python | amagee/mongofrog | /mongofrog.py | UTF-8 | 2,492 | 2.53125 | 3 | [] | no_license | import asyncio
import curses
from typing import List, Optional, Callable
from blessed import Terminal
import motor.motor_asyncio
import urwid
client = None
state = {
'database': None,
'collection': None,
}
urwid_loop = None
def main():
global loop, client, urwid_loop
client = motor.motor_asyncio.As... | true |
155bae86a37adb84a5ae7dca935111cbd4a9e0b4 | Python | FFFutureflo/CodingChallenges | /codeforces/800/WordCapitalization.py | UTF-8 | 338 | 3.9375 | 4 | [] | no_license | """
https://codeforces.com/problemset/problem/231/A
"""
def function():
word = input()
first_letter = word[0:1]
print(word.replace(first_letter, first_letter.upper(), 1))
if __name__ == "__main__":
function()
"""
Read Input as String
Get first letter
Replace first letter with upper letter one time... | true |
a34e5da793f8f8a6e4dfc28c7cb7431dd3de4c45 | Python | Ruwzy/Python-Crash-Course-Practises | /PCC_4/PCC_4_13.py | UTF-8 | 332 | 3.390625 | 3 | [] | no_license | res_foods = ("sparking water", "pizza", "stark", "chicken", "french fries")
print("The restaurant provides food:")
for food in res_foods:
print(food)
res_foods = ("ice cream", "pizza", "stark", "chicken", "french fries", "tomato")
print("The restaurant's new menu is: ")
for food in res_foods:
print(f... | true |
e52e648d0550ff37e25a783b5108d0ab64b6f490 | Python | satyam-cyc/MASS-Learning | /scripts/plotting/PlotMASSLossTermsTrainingCurves.py | UTF-8 | 3,221 | 2.671875 | 3 | [
"MIT"
] | permissive | import os
import pandas as pd
import seaborn as sns
sns.set()
sns.set_style("whitegrid")
# Expects data downloaded from tensorboard. You have to do this manually from within tensorboard; the file paths below
# are example placeholders.
# Your CSVs will have different filenames. You need to set datadir to be where... | true |
a633d8cffa68d24d9e668f8b684c0f2752393eb1 | Python | Talengi/phase | /src/dashboards/dashboards.py | UTF-8 | 1,151 | 2.859375 | 3 | [
"MIT"
] | permissive | class DashboardProvider(object):
es_date_format = '%Y-%m-%dT%H:%M:%S.%fZ'
def __init__(self, **kwargs):
self.category = kwargs.get('category', None)
def query_elasticsearch(self):
"""Performs actual query to Elastic Search.
The method must return a dict, as in the `to_dict` functi... | true |
f32de78f226af34b14d0bf5ca4c2356c19da1107 | Python | Saf1n/python_algorythm | /HomeWork3/test3_9.py | UTF-8 | 548 | 3.984375 | 4 | [] | no_license | __author__ = 'Сафин Ильшат'
# 9. Найти максимальный элемент среди минимальных элементов столбцов матрицы.
print('Введите 12 цифр:')
matrix = [[int(input()) for _ in range(4)] for _ in range(3)]
for i in range(3):
print(matrix[i])
mx = -1
for i in range(3):
mn = 10
for j in range(4):
if matrix[i][... | true |
36494e3765f35cb7a104a349bf3c63543b1d279a | Python | xlui/DsAlgoDp | /BucketSort.py | UTF-8 | 2,548 | 4.125 | 4 | [] | no_license | # 桶排序
# 如果一个数组 A,包含 N 个整数,值从 1 到 M,那么我们可以得到一种非常快的排序,桶排序。
# 留置一个数组,里面有 M 个桶,初始化为 0
# 然后遍历数组 A,读入 Ai 时,S[Ai]增一。
# 所有输入被读入后,扫描数组 S 得出排好的表
# 该算法时间花费 O(M+N),空间上不能原地排序
import random
class BucketSort(object):
def _max(self, old_list):
_max = old_list[0]
for i in old_list:
if i > _max:
... | true |
1411d9757180b083796e84becbd669bbedccc6d8 | Python | ffhan/lingua | /automata/nfa.py | UTF-8 | 8,430 | 3.046875 | 3 | [
"MIT"
] | permissive | """
Defines Non-deterministic finite automata, including epsilon non deterministic finite automata.
"""
import copy
import automata.fa as fa
import automata.state as st
import misc.helper as helper
class NFA(fa.FiniteAutomaton):
'''
Non-deterministic finite automata.
'''
def distinguish(self):
... | true |
0604d6facc5a85d7c73506d247311404c7fb67c8 | Python | zeppertrek/my-python-sandpit | /pibm-training/sample-programs/user_input.py | UTF-8 | 141 | 3.71875 | 4 | [] | no_license | #user_input.py
# Accept input from the user
print('Please enter some text:')
x = input()
print('Text entered:', x)
print('Type:', type(x))
| true |
5c94840913b6e4af81c607e839e917396e662d92 | Python | inkyu0103/BOJ | /Simulation/11723.py | UTF-8 | 1,108 | 3.75 | 4 | [] | no_license | # 집합
'''
add x
remove x
check x
toggle x
all
empty
'''
import sys
input = sys.stdin.readline
def add(target):
S.add(target)
def remove(target):
if target not in S:
return
S.remove(target)
def toggle(target):
if target in S:
remove(target)
else:
add(target)
def check(tar... | true |
7449a160311eec070bb7794e07339fe3ad3c7a17 | Python | hcoliver97/InfectionSim | /Rv.py | UTF-8 | 1,476 | 3.640625 | 4 | [] | no_license | import random
import math
class Uniform():
def __init__(self):
self.max = 0
self.min = 0
def generate(self, max, min):
self.max = max
self.min = min
r = self.max - self.min
if r < 0:
raise RuntimeError("Min must be less than max")
rand = self... | true |
5a5c9aa07a902bbf31034138b789e4f419943b8d | Python | doosea/god_like | /myRecommendation/PersonalRank/mat_util.py | UTF-8 | 1,672 | 2.546875 | 3 | [] | no_license | from scipy.sparse import coo_matrix
from myRecommendation.PersonalRank.read import *
import numpy as np
def graph_to_mat(graph):
"""
:return:
matrix M,
a list 所有(item+user)顶点,
a dict 所有(item+user)顶点位置
"""
vertex = list(graph.keys())
address_dict = {}
for index in ran... | true |
6b45189513baece77570c961ebae3946b309b580 | Python | hamatz/efppap | /enc_and_sign.py | UTF-8 | 1,923 | 2.59375 | 3 | [
"Apache-2.0"
] | permissive | import sys
import binascii
import json
import base64
from utils.aes_util import AESUtil
from utils.rsa_util import RSAUtil
def main(target_file_name, path_to_rsa_pub_key, result_file_name, prv_key, pass_phrase):
p_version = "0.1.0"
aes_util = AESUtil()
with open(target_file_name, 'rb') as f:
targ... | true |
bfbfafa90515bcdd5cb52c7e9d449548c0b0b8a2 | Python | kapilsinha/botnet-surf | /old_files/tests/test4.py | UTF-8 | 2,340 | 2.65625 | 3 | [] | no_license | import sys
import gi
gi.require_version("Gtk", "3.0")
from gi.repository import Gtk
# Documentation: https://graph-tool.skewed.de/static/doc/index.html
class SpecialBox(Gtk.Box):
def __init__(self, GUI):
Gtk.Box.__init__(self)
self.GUI = GUI
self.liststore = Gtk.ListStore(str, int, int)... | true |
8634e749611e8da654358e92a9d0f9c87c247a6a | Python | Sally-E/sample | /hello.py | UTF-8 | 70 | 2.71875 | 3 | [] | no_license | #! -*-coding* utf-8-*-
for i in [0, 1, 2, 3]:
print "hello world"
| true |
336c8f19079f70d35a21d4529c17d5130a7efc9e | Python | zopefoundation/zExceptions | /src/zExceptions/tests/test_unauthorized.py | UTF-8 | 4,264 | 2.546875 | 3 | [
"ZPL-2.1"
] | permissive | ##############################################################################
#
# Copyright (c) 2010 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOF... | true |
b0b16c6b284014463772a8be2f58b67ca91806a1 | Python | JMine97/ProblemSolvingByPy | /week1/gyuri/1013.py | UTF-8 | 298 | 3.015625 | 3 | [] | no_license | # 해님님, 준범님 코드 참고해서 코드
import re
n = int(input())
p = re.compile('(100+1+|01)+')
result = []
for i in range(n):
case = str(input())
if p.fullmatch(case):
result.append('YES')
else:
result.append('NO')
for i in range(n):
print(result[i])
| true |
c1867dd03a56e7c8a3a87afab234d7e3a0f27e84 | Python | Lyubov-smile/SEP | /String/task08.py | UTF-8 | 1,910 | 4.4375 | 4 | [] | no_license | # 8 Написати функцію, що перетворює рядок в дробове або ціле число.
''' # converts a string to a number
num_0_19 = {'One': 1, 'Two': 2, 'Three': 3, 'Four': 4, 'Five': 5, 'Six': 6, 'Seven': 7, 'Eight': 8, 'Nine': 9,
'Ten': 10, 'Eleven': 11, 'Twelve': 12, 'Thirteen': 13, 'Fourteen': 14, 'Fifteen': 15, 'Sixte... | true |
7738e4ec0dfc2563ec24ce8589a164898e8a6b4a | Python | KorobovMS/Algorithms | /sorting/heapsort.py | UTF-8 | 688 | 3.421875 | 3 | [] | no_license | def heapsort(A):
heapify(A)
end = len(A) - 1
while end > 0:
A[0], A[end] = A[end], A[0]
end = end - 1
siftDown(A, 0, end)
def heapify(A):
start = int((len(A) - 2)/2)
while start >= 0:
siftDown(A, start, len(A) - 1)
start = start - 1
def siftDown(A, start, en... | true |
57091dd9381b05f3a826b1616bd43107e37f473d | Python | didud1798/Algorithm_Lecture | /yoh/lec01/2442.py | UTF-8 | 96 | 3.171875 | 3 | [] | no_license | n = input()
for i in range(1, n+1):
Star = '*'*(2*i - 1)
Blank = ' '*(n-i)
print Blank + Star | true |
426d3948115a9e4a0433650eaede00a29ee5b967 | Python | manoharendla/PycharmProjects | /YourAge.py | UTF-8 | 126 | 3.359375 | 3 | [] | no_license | __author__ = '619635'
my_age=input("Enter your age:")
print("After one year, your age will be " + str(int(my_age)+1) )
| true |
230ba8f47384a961ba702315a603ea48cdab677b | Python | wangbaorui/MHAN | /models/SRCNN.py | UTF-8 | 2,926 | 2.75 | 3 | [] | no_license | import torch
from torch import nn
from torch import autograd
from torch.autograd import Variable
from torch.nn import functional as F
import math
import pdb
import time
import numpy as np
from math import sqrt
import argparse
class Net(torch.nn.Module):
def __init__(self, num_channels = 3, base_filter = 128, upscal... | true |
51a432390c0a689e974381d1a7b85fb912459baf | Python | berthih/Codewars | /python_kyu/kyu4/sudoku_validator.py | UTF-8 | 590 | 3.359375 | 3 | [] | no_license | from itertools import product
DIGITS = set(range(1, 10))
THREES = [(0, 1, 2), (3, 4, 5), (6, 7, 8)]
def correct(groups):
return all(set(group) == DIGITS for group in groups)
def validSolution(grid):
assert isinstance(grid, list)
if len(grid) != 9 or not all(len(row) == 9 for row in grid):
ret... | true |
b68be736893d3bc09570ac66352e7b9c8eed145b | Python | lukas-blecher/LaTeX-OCR | /pix2tex/dataset/postprocess.py | UTF-8 | 695 | 2.78125 | 3 | [
"MIT"
] | permissive | import argparse
from tqdm.auto import tqdm
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument('-i', '--input', required=True, help='input file')
parser.add_argument('-o', '--output', default=None, help='output file')
args = parser.parse_args()
d = open(args.input, 'r... | true |
e85d9100cf9d39f86acdd46de80743dbd435b1e4 | Python | sarmabhamidipati/UCD | /Specialist Certificate in Data Analytics Essentials/DataCamp/01-python-data-science-toolbox-part-1/e27_reduce_and_lambda_function.py | UTF-8 | 971 | 4.25 | 4 | [] | no_license | '''
Reduce() and lambda functions
The reduce() function is useful for performing some computation on a list and,
unlike map() and filter(), returns a single value as a result. To use reduce(), you must import it from the functools module.
mbda function that concatenates strings together.
Instructions
Import the ... | true |
e339b99866b05d4256b240cc72d54cedb13eb5d2 | Python | I-am-Fine-1994/DeepLearningCode | /pycode/TensorFlow/Practice/simline5.py | UTF-8 | 2,881 | 2.6875 | 3 | [] | no_license | import tensorflow as tf
import numpy as np
import os.path
import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'
#~ 加入epoch
#~ Note: if num_epochs is not None, this function creates local counter epochs.
#~ Use local_variables_initializer() to initialize local variables.
x = np.random.uniform(0, 5, [10, 4, 4, 2])
y = 3*x... | true |
261b7e3ba722d3cc37d9cedc92edfc3a4eee73b7 | Python | kyomukyomupurin/LINE_bot | /contest_info.py | UTF-8 | 1,545 | 2.640625 | 3 | [] | no_license | import requests
import json
import datetime
import time
contest_url = 'https://codeforces.com/api/contest.list'
line_url = 'https://notify-api.line.me/api/notify'
num_future_contest = 20
def convert_time(timestamp : int) -> str:
day = timestamp // (60 * 60 * 24)
s1 = ' day ' if day == 1 else ' days '
ti... | true |
35e385503f75b0f8b745d04e39301f91d9b7e565 | Python | calebespinoza/python-opp-tasks | /task_3/machine.py | UTF-8 | 2,733 | 3.859375 | 4 | [] | no_license |
from ticket import Ticket
from timer import Timer
from payment import Payment
class Machine:
"""This class offers funcionalities to register the entrance, exit and payments when someone wants to park a vehicle.
"""
def __init__(self):
"""Machine constructor
"""
self.__ticket =... | true |
2f480cc2b4b4bd631a628aa43defbbaf17a51cad | Python | dfdf/hello-world | /Python_Codes/verify_pair.py | UTF-8 | 1,541 | 2.59375 | 3 | [] | no_license | from shutil import copyfile
from os import listdir
from os.path import isfile, join
import os
import numpy as np
path = "C:\\Users\\dfdf\\Documents\\Imagens_DATABASE\\BENCHMARK\\faces\\BENCHMARK_1\\HIT\\"
path_dest = "C:\\Users\\dfdf\\Documents\\Imagens_DATABASE\\BENCHMARK\\faces\\BENCHMARK_1\\HIT_POSITIVO_1\\"
path_... | true |
163c0b9bfdb207e1d78f8ed1d1e83b97d61ecd0c | Python | DavidCastilloAlvarado/PPO_reinforcement_learning | /PPO_pendulum.py | UTF-8 | 5,982 | 3.015625 | 3 | [
"Apache-2.0"
] | permissive | """
A simple version of Proximal Policy Optimization (PPO)
Based on:
1. [https://arxiv.org/abs/1707.02286]
2. [https://arxiv.org/abs/1707.06347]
View more on this tutorial website: https://morvanzhou.github.io/tutorials
"""
import tensorflow as tf
import numpy as np
import matplotlib.pyplot as plt
import gym
EP_MAX = ... | true |
41d6420d1a8811be137ff133dfdf40295706cdfd | Python | pelson/namehash | /run_test.py | UTF-8 | 785 | 2.59375 | 3 | [
"BSD-3-Clause"
] | permissive | from namehash import *
def roundtrip(n, n_words=3):
hash = encode(n, n_words)
actual = decode(hash)
if n != actual:
next_hash = encode(actual, n_words)
raise ValueError('{} -> {} -> {} -> {}'.format(n, hash, actual, next_hash))
return hash
if __name__ == '__main__':
roundtrip(0)
... | true |
6a1507f178533e329fb6c664f49e757413a8f61f | Python | PakornChaenglew/6230403882-oop-labs | /pakorn-6230403882-lab6/Prob4.py | UTF-8 | 334 | 2.5625 | 3 | [] | no_license | with open("kku2.txt", 'w', encoding='utf8') as f:
with open("kku.txt", encoding="utf-8") as o:
pr = o.read()
g = "\nMotto: วิทยา จริยา ปัญญา\nMotto in English: Knowledge"
f.write(pr)
f.write(g)
with open("kku2.txt", encoding='utf8') as e:
p = e.read()
print(p) | true |
baa6b546cd2193e468be6006802a40d0fa8459a4 | Python | simranluthra/Movies-Trailer | /moviestrailer.py | UTF-8 | 3,037 | 2.828125 | 3 | [] | no_license | import fresh_tomatoes
import movies
Beauty_and_the_beast = movies.Movie("Beauty and the beast",
"A story of a bright, beautiful \
and independent young woman",
"http://t2.gstatic.com/images?q=tbn:ANd9 \
... | true |
6b851c6b3a93a91d99abcbff0380c18aabc50d83 | Python | chubby-panda/shecodes-python-work | /project_2/part1/part1.py | UTF-8 | 5,590 | 4.09375 | 4 | [] | no_license | import json
from datetime import datetime
DEGREE_SYBMOL = u"\N{DEGREE SIGN}C"
def format_temperature(temp):
"""Takes a temperature and returns it in string format with the degrees and celcius symbols.
Args:
temp: A string representing a temperature.
Returns:
A string contain the tempe... | true |
f305a623f18a83ecfa29c707f3a9a5a6815ad83a | Python | premkashyap/PythonTrilogyPluralsight | /PythonGettingStarted/Module7/platform_specific.py | UTF-8 | 432 | 2.546875 | 3 | [] | no_license | try:
import mscvrt
def getkey():
return mscvrt.getch()
except:
import sys
import tty
import termios
def getkey():
fd =sys.stdin.fileno()
original_attributs = termios.tcgetattr(fd)
try:
tty.setraw(sys.stdin.fileno())
ch = sys.stdin.read(... | true |
8804b3a349c4d6553b17d8b53194c2a38e9a0605 | Python | bazelbuild/rules_apple | /tools/bundletool/bundletool_test.py | UTF-8 | 12,583 | 2.578125 | 3 | [
"Apache-2.0"
] | permissive | # Copyright 2017 The Bazel Authors. All rights reserved.
#
# 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 la... | true |
b00b5f36378cd82f448c3d139927d8868e3bc47b | Python | Dyr-El/advent_of_code_2017 | /dlofstrom-python/day5.py | UTF-8 | 386 | 3.03125 | 3 | [] | no_license | import sys
input = sys.stdin.read()
input = [int(r) for r in input.split('\n') if r]
#Part 1
i = 0
s = 0
l = list(input)
while i < len(input):
s += 1
l[i] += 1
i += l[i]-1
print "Part 1:", s
#Part 2
i = 0
s = 0
l = list(input)
while i < len(input):
s += 1
lt = l[i]
if l[i] >= 3:
l[i... | true |
b3470f0904ff60a72fc3a85cb86aa4d7fa4ab1bf | Python | IGS/cvd-scripts | /TIGRFAM_processing/build_custom_TIGRFAM_HMM_LIB.py | UTF-8 | 2,243 | 2.828125 | 3 | [] | no_license | #!/usr/bin/python
# The purpose of this script is to build a custom TIGRFAM HMM LIB after
# extracting the desired TIGRFAM ids using extract_TIGRFAM_IDs_from_IT.py
#
# HOWTO: (python) build_custom_TIGRFAM_HMM_LIB.py path_to_extracted_ids_file path_to_tigrfam_hmm_lib_file
#
# Author: James Matsumura
import sys, os, r... | true |
c244cf50787518aadbaca84df00c384b934c8a06 | Python | deostroll/deohttp | /main.py | UTF-8 | 1,123 | 2.890625 | 3 | [
"MIT"
] | permissive | from deohttp import HttpClient
from machine import Pin
import time
# pin 12 is output - connects led in series with
# 39E resistance
# pin 5 is input pin - in series with a 1k resistor
# in series with 10k resistor which is grounded
# 3.3V output from wemos goes to the switch
# which connects parallel to... | true |
3fb51cbaa1fe8b5fa8431dda8d6246adc22aa79b | Python | alexandraback/datacollection | /solutions_5631572862566400_0/Python/mikebot/C.py | UTF-8 | 1,330 | 3.046875 | 3 | [] | no_license | from sys import argv
from os.path import expanduser
from itertools import permutations
# Import the file as a list of lines:
problem = argv[1]
path = expanduser('~/Github/codejam/2016/Round1A/')
file_in = path + problem + '.in.txt'
file_out = path + problem + '.out.txt'
with open(file_in,'rb') as fin:
lines = fin.re... | true |
25ef2cf4e38791dcc498bcb0b480dd110e187c49 | Python | rusinchuk/lesson_3_homework | /Lesson_3_task_5.py | UTF-8 | 727 | 3.515625 | 4 | [] | no_license | s = ' We are not what we should be! We are not what we need to be. But at least we are not what we used to be (Football Coach) '
l = s.strip()
s = l
print(l, '\n', l.count(" ") + 1)
while (l.find('.') > 0) or (l.find('!') > 0) or (l.find('(') > 0) or (l.find(')') > 0):
l1 = l.find(".")
s1 = l[0:l1]
s2 = l... | true |
046632d0e7b4a7563a7e3c0edab92650a3d11bab | Python | GuyRobot/RL-Python | /TabularLearnBellmanEquation/FrozenLakeQL/SolveFrozenLakeUsingValueFunc.py | UTF-8 | 8,238 | 3.875 | 4 | [] | no_license | """
The central data structures in this example are as follows:
Reward table: A dictionary with the composite key "source state" +
"action" + "target state". The value is obtained from the immediate
reward.
Transitions table: A dictionary keeping counters of the experienced
transitio... | true |
ef37c3012bbf9ee8111be4cd5173e31e930683be | Python | rimow/NeuroPrononciation | /neuroPro/phonemesAnalysis/featuresGeneration.py | UTF-8 | 11,511 | 2.78125 | 3 | [] | no_license | import pywt
import numpy as np
import scipy as sc
import scipy.io.wavfile
import librosa
from librosa import feature
from librosa import filters
from librosa import util
import matplotlib.pyplot as plt
import math
from numpy import shape
from Erreurs import initialisationError
from phonemesAnalysis.analyse import *
fro... | true |
b634572cf6c875c03496992ecdd5fe275512c787 | Python | Krishnap641/ABC_Fin_App | /setupDB.py | UTF-8 | 815 | 2.71875 | 3 | [] | no_license | import sqlite3
# The database will be created in the location where 'py' file is saved
conn = sqlite3.connect('loan_data.db')
c = conn.cursor()
# Create table - "loan_application"
#c.execute('''CREATE TABLE CLIENTS
# ([generated_id] INTEGER PRIMARY KEY,[Client_Name] text, [Country_ID] integer, ... | true |
639cce4ce0431e059ccb8b8a297c4b257a80ccb9 | Python | cyogita97/Project | /CoeffGenerator.py | UTF-8 | 2,596 | 2.671875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sun Jul 21 19:04:57 2019
@author: yogit
"""
import numpy as np
from sympy import *
from z3 import *
import math
import time
start_time = time.time()
def CoefficientGenerator(B,v,x0,x1,pop,ca,ga,x,yy,u,w,nml,nsamp):
pp=len(B)
p=[]
for j1 in range(pp):
... | true |
761955364869f1d4aa5654e0e9c855a7ead0e52b | Python | papagr/everest | /everest/repositories/manager.py | UTF-8 | 4,885 | 2.640625 | 3 | [
"MIT"
] | permissive | """
The repository manager class.
This file is part of the everest project.
See LICENSE.txt for licensing, CONTRIBUTORS.txt for contributor information.
Created on Jan 25, 2013.
"""
from everest.repositories.constants import REPOSITORY_DOMAINS
from everest.repositories.interfaces import IRepository
from everest.utils... | true |
9028322fda081f40df81691407391919184a45f7 | Python | angeeranaser/Rosalind | /Python/rosalind_perm.py | UTF-8 | 971 | 3.84375 | 4 | [
"MIT"
] | permissive | # Rosalind: Enumerating Gene Orders
# Given: A positive integer n < 7.
# Result: The total number of permutations of length n, followed by a list of all such permutations (in any order).
import itertools
def converter(input):
result = " ".join(input)
return result
def main():
# open file... | true |
05be55cda0a268c2bbb356c2122a3da0d4468094 | Python | jasonthename/python-triplesec | /triplesec/test/test.py | UTF-8 | 9,856 | 2.53125 | 3 | [
"BSD-3-Clause"
] | permissive | import sys
if sys.version_info < (2, 7):
import unittest2 as unittest
else:
import unittest
from binascii import unhexlify as unhex
from binascii import hexlify
import json
import os.path
import six
import struct
import triplesec
from triplesec import TripleSec, TripleSecError
from triplesec.versions import _v... | true |
c850b86511d64a5f8ad1a41841e36be1fda4b34a | Python | phong010198/multimediaGroup11 | /bai5/bai5.py | UTF-8 | 1,901 | 3.21875 | 3 | [] | no_license | import matplotlib.pyplot as plt
from numpy import zeros
# khoi tao figure
fig = plt.figure(figsize=(5, 5))
# khởi tạo ma trận điểm ảnh rỗng
imga = zeros([800, 800, 3])
h = len(imga)
w = len(imga[0])
R = 0
G = 1
B = 2
# khởi tạo bàn cờ trắng đen
check = False
for y in range(h):
if y % (h / 8) =... | true |
dd78719e3b7e861b00e630c4b8fb958585ae1ec7 | Python | OskarKozaczka/pp1-OskarKozaczka | /08-DataStructures/dict.py | UTF-8 | 463 | 3.234375 | 3 | [] | no_license | osoba = { "imie": "Marek",
"nazwisko": "Banach",
"wiek": 25,
"hobby": ["programowanie","wycieczki"],
"student": True,
"telefon":{"stacjonarny":"2233","komorkowy":"7788"}
}
print(osoba)
print(osoba["imie"])
print(osoba["hobby"])
osoba["nazwisko"]="Nowak"
pr... | true |
6af6c1f7a1774a367acee389a23e016895b83e25 | Python | timohouben/python_scripts | /ogs_multi_folder/ogs_multi_folder.py | UTF-8 | 1,755 | 2.640625 | 3 | [] | no_license | #!/usr/bin/env python2 ### this has to be changed to your python2 executable
# -*- coding: utf-8 -*-
"""
Created on Fri Apr 13 11:14:41 2018
@author: houben
script to run multiple ogs runs in a directory
Script will search for all .gli files in directory and subdirectory in CURRENT WORKING DIRECTIORY!
First... | true |
536e1842757ac7a44fb249514c8373a0a225a187 | Python | simonbowly/strong-graphs | /strong_graphs/output.py | UTF-8 | 841 | 2.859375 | 3 | [
"MIT"
] | permissive |
def output(graph, sum_of_distances, output_dir="output/"):
"""
Converts a graph in `extended DIMACS format' which is what is expected
by the algorithms in SPLib
Note that the node ordering is indexed from 1 not 0 so our nodes must be increased.
"""
n = graph.number_of_nodes()
m = graph... | true |
d34f3d53cd0db6284f250e79fca25e42b06a2a09 | Python | vivianbuan/cs3240-s15-team20 | /Standalone/decrypt.py | UTF-8 | 1,448 | 2.796875 | 3 | [
"MIT"
] | permissive | from Crypto import Random
from Crypto.Cipher import AES
import sys
#def pad(s):
# return s + b"\0" * (AES.block_size - len(s) % AES.block_size)
#def decrypt(ciphertext, key):
# iv = ciphertext[:AES.block_size]
# cipher = AES.new(key, AES.MODE_CBC, iv)
# import pdb; pdb.set_trace()
# plaintext = cipher.d... | true |
3d9573af6d1278f4f736bc710c8e2c0d7db3dea4 | Python | benbendaisy/CommunicationCodes | /python_module/examples/105_Construct_Binary_Tree_from_Preorder_and_Inorder_Traversal.py | UTF-8 | 1,186 | 3.515625 | 4 | [] | no_license | # Definition for a binary tree node.
class TreeNode:
def __init__(self, val=0, left=None, right=None):
self.val = val
self.left = left
self.right = right
from typing import List, Optional
class Solution:
def buildTree(self, preorder: List[int], inorder: List[int]) -> Optional[TreeNode]... | true |
e2cd2c5a03f126a0d74a175334b0ea0a43f949d5 | Python | Michielvsb/automatic-environment-map | /data_sources/squarewavesequence.py | UTF-8 | 4,321 | 2.75 | 3 | [] | no_license | from torch.utils.data import Dataset
import csv
import cv2
import numpy
from math import floor
from random import uniform
from math import radians, cos, sin
class SquareWaveSequence():
def __init__(self, file, translate=10, amount=1, crop_size=(256, 256), patch_size=(128, 128), patch_location = (128, 128)):
... | true |
f2709dbe0f07b5219e443f7b55ad8c4bfef3689f | Python | CDog5/AutoUpdate | /Generators.py | UTF-8 | 1,113 | 4.15625 | 4 | [] | no_license | # generator object that splits a sentence into words
def sentence_to_words(words):
punctuation = [".",",","?","!","-"," ",":",";"]
for punc in punctuation:
words = words.replace(punc," ")
words = words.split()
yield from words
# generator object that splits a string into certain chars
de... | true |