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 |
|---|---|---|---|---|---|---|---|---|---|---|
ee319f521b663e6c0d35e74b8b746775a11caf6d | rahulcs754/Encripted-Decripted-python | /code/Dcry.py | UTF-8 | 597 | 3.1875 | 3 | [] | no_license | my_dict = { "E":"A","F":"B","G":"C","H":"D","I":"E",
"J":"F","K":"G","L":"H","M":"I","N":"J",
"O":"K","P":"L","Q":"M","R":"N","S":"O",
"T":"P","U":"Q","V":"R","W":"S","X":"T",
"Y":"U","Z":"V","A":"W","B":"X","C":"Y",
"D":"Z"," ":" ","4":"1","5":"2","6":"3","7":"4",
"8":"5","9":"6","0":"7",... | true |
7f1e6183ed67080c265c1aca9a7323970cd220e0 | clesiomatias/Python_Projects | /BlackJack/BlackJack_Alg.py | UTF-8 | 27,183 | 2.84375 | 3 | [] | no_license |
import random as rnd
from bib_support import get_card_val
AVALIABLE_ALGS = ["NEVER", "ALWAYS", "50X50", "BJ_BASIC_STRAT_FULL", "BJ_BASIC_STRAT_NOSPLIT_NODOUBLE", "MURCH", "DEALER"]
# Default algoritm for the dealer. Follows the rules of the game for the dealer
def blackjack_alg_DEALER(caller: object, hit_on_soft_... | true |
d3fd313c44a52bcd4dd498c3c59c2332f805462c | mjakubow/coding-problem-samples | /list-remove-duplicates.py | UTF-8 | 695 | 3.90625 | 4 | [] | no_license | #
# Problem: Given a list of strings on the command line, print all unique values in the list.
#
# Difficulty: 1
#
# Follow-up questions:
# - What is the complexity of your solution (in O-notation)?
# - What are some methods you can use to make this as efficient as possible?
# - What are some space-time trade-off... | true |
2967c43aabc865b0099c88c0a34b1f192f7d2e1a | Saptarshidas131/NPTEL | /Joy of Comuting using Python/assignments/2020JOC_Assignments/W9PA1_Swap_the_case.py | UTF-8 | 299 | 4.3125 | 4 | [] | no_license | '''
Given a string, you need to convert all lowercase letters to uppercase letters and vice versa.
Input Format:
A single line containing a string S.
Output Format:
Print the modified string S.
Sample Input:
Hello World!!
Sample Output:
hELLO wORLD!!
'''
s = input()
print(s.swapcase(),end="")
| true |
484a264e906a0766ff88bb81167e6455b9326d07 | cohock13/atcoder | /abc/159/4.py | UTF-8 | 536 | 3.046875 | 3 | [] | no_license |
N = int(input())
A = list(map(int,input().split()))
num = {}
for i in A:##O(N)
if i not in num:
num[i] = 1
else:
num[i] += 1
values = list(num.values())
keys = list(num.keys())
S = 0
for i in range(len(keys)):##O(N*2)
if values[i] >= 2:
S += values[i]*(values[i]-... | true |
5a7f803051768e3d89c6401f0f674d863238a38a | LoseSynchronization/grade_monitor | /notice/__init__.py | UTF-8 | 2,211 | 2.828125 | 3 | [] | no_license | import smtplib
from email.mime.text import MIMEText
from email.utils import formataddr
from utils import mylogger
class MailNotice:
"""
邮箱通知
使用邮箱服务器发送通知
"""
def __init__(self, sender, server, secret, sender_name="monitor", port="465"):
"""初始化
:param sender: 邮件发送者地址
... | true |
ee6246564e20631f0c2d487d7efa649fb39d9b57 | azusa-tarola/Pygame-Shoryuken | /tutorial.py | UTF-8 | 2,523 | 3.0625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import sys
import pygame
from pygame.locals import *
def main():
(width, height) = (400, 400) # 画面サイズ
pygame.init() # pygame初期化
pygame.display.set_mode((width, height), 0, 32) # 画面設定
screen = pygame.display.get_surface()
font = pygame.font.Font(None, 55)
screen.... | true |
3cff864061de57fe6becc7a36a2547947822efc0 | ernsnl/Intro-To-BackEnd | /Intro-Project/classes/error.py | UTF-8 | 188 | 3.25 | 3 | [] | no_license | class Error(object):
def __init__(self, id, error_msg):
self.id = id
self.error_msg = error_msg
def __str__(self):
return self.id + ': ' + self.error_msg
| true |
61794e80659cf18dc67b553b59db5dc1ca74baa8 | 0x00-0x00/shemutils | /src/timer.py | UTF-8 | 1,404 | 3.65625 | 4 | [
"MIT"
] | permissive | import time
class Timer(object):
"""
Timer object to track periods of time.
"""
def __init__(self):
self.start = time.time()
self.stop = None
def _rearm(self):
self.start = time.time()
self.stop = None
return 0
def stop(self):
"""
Set ... | true |
24c870f86661f0f3a9d52b5f373bd74a4f59b455 | csse120-201910/07-Exam1 | /src/problem3.py | UTF-8 | 4,250 | 3.78125 | 4 | [] | no_license | """
Exam 1, problem 3.
Authors: David Mutchler, Vibha Alangar, Valerie Galluzzi, Mark Hays,
Amanda Stouder, their colleagues and PUT_YOUR_NAME_HERE.
""" # TODO: 1. PUT YOUR NAME IN THE ABOVE LINE.
import rosegraphics as rg
def main():
""" Calls the TEST functions in this module. """
run_test_p... | true |
a6ed861f19ca2a88c0420d3e4b6db4f2c26609a7 | Chezacar/SJTU-EE382 | /hw4/toolbox/show.py | UTF-8 | 496 | 2.546875 | 3 | [] | no_license | from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
def show(x,y,transformed):
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
ax.scatter(x[0,:], x[1,:], x[2,:], c='m', marker='v')
ax.scatter(y[0,:], y[1,:], y[2,:], c='r', marker='^')
ax.scatter(transformed[0,:], t... | true |
c3c496df2a75c4b3a50a0d3727fb2e1798ab5937 | BuildIT-Society/Magic-Mirror | /Software/test.py | UTF-8 | 243 | 3.1875 | 3 | [
"MIT"
] | permissive | # need config.py file so api keys are hidden
import config
api = config.api_token
print api
# python testing
# array intialization
#numbers = [0,1,2,3,4,5,6,7,8,9]
# for-loop
#for number in numbers:
# print "Hello World! %d" % number
| true |
45a78882271bcedb1add18ec5a50bf6c5d74f2de | ChaoMneg/Offer-python3 | /二叉树/Tree_Print.py | UTF-8 | 1,904 | 4.21875 | 4 | [] | no_license | # -*- coding: utf-8 -*-
# @Time : 2020/2/6/006 12:56
# @Author : mengchao
# @Site :
# @File : Tree_Print.py
# @Software: PyCharm
"""
题目:按之字形顺序打印二叉树
请实现一个函数按照之字形打印二叉树,即第一行按照从左到右的顺序打印,第二层按照从右至左的顺序打印,第三行按照从左到右的顺序打印,其他行以此类推。
解题:
1、两个list分别存放奇数行跟偶数行
2、奇数行从左到右
3、偶数行从右到左
"""
# class TreeNode:
# def __init__(s... | true |
5904be0b2eaa49e8b8e6a5544c41e99875d38601 | anarsiel/University | /ml/CF/M.py | UTF-8 | 406 | 3.265625 | 3 | [] | no_license | import numpy
n, x1, x2 = int(input()), [], []
for _ in range(n):
a, b = [int(x) for x in input().split()]
x1.append(a)
x2.append(b)
array1 = numpy.array(x1)
order1 = array1.argsort()
ranks1 = order1.argsort()
array2 = numpy.array(x2)
order2 = array2.argsort()
ranks2 = order2.argsort()
s = 0
for i in ran... | true |
a2ec7d29216b86e8d71b5bb1aeb4a55594eddfc5 | aasaanjobs/jira-worklog | /app.py | UTF-8 | 1,352 | 2.515625 | 3 | [] | no_license | import hashlib
# import the Flask class from the flask module
import hmac
import os
from flask import Flask, request
from add_work_log_helper import log_work_on_jira
# create the application object
app = Flask(__name__)
GITHUB_SECRET_TOKEN = os.getenv('GITHUB_SECRET_TOKEN')
@app.route('/')
def home():
retur... | true |
6d2b786a72f77ba509cc48b2ed11af8ccd2192d6 | annah2/phasefield-fracture | /postprocessing/extract_crack.py | UTF-8 | 2,974 | 2.734375 | 3 | [] | no_license | import netCDF4 as nc
import matplotlib.pyplot as plt
import numpy as np
from matplotlib import cm
import sys
print(sys.argv)
if (sys.argv == None):
rundir = ''
else:
rundir = sys.argv[1]
Lx = 800
nx = 2047
Ly = Lx
ny = nx
fname = rundir+'test.nc'
ds = nc.Dataset(fname)
print(ds['phi'].shape[0])
for j in ra... | true |
e0b4f50d0d8dcaeeafe93f3798a86610672afc36 | ejuarezg/NM4P | /Python/Raw Python/Orbit.py | UTF-8 | 3,596 | 3.203125 | 3 | [] | no_license | # orbit - Program to compute the orbit of a comet.
# Set up configuration options and special features
import numpy as np
import matplotlib.pyplot as plt
from nm4p.rk4 import rk4
from nm4p.rka import rka
#* Define the gravrk function used by the Runge-Kutta routines
def gravrk(s,t,GM):
"""Returns right-hand side... | true |
6797e76ff679023cbaa1230e90949eb8e4e1de90 | quanlidavid/Getting_Started_with_Python_Web_Scraping | /usingAPIs.py | UTF-8 | 218 | 2.859375 | 3 | [] | no_license | import requests
url='https://api.ip2country.info/ip?12.45.6.15'
response=requests.get(url)
print(response)
print(response.content)
obj = response.json()
print(obj)
countryName=obj['countryName']
print(countryName) | true |
310cbe18cf621d85e1a9ca355a655883032ac09f | wilsongis/census_data | /src/census.py | UTF-8 | 2,188 | 3.234375 | 3 | [] | no_license | #manipulate dataframes in python
import pandas as pd
import sys
#make API calls with python
import requests
# sys.path.insert(0, '/path/to/application/app/folder') used to import local python file, in this case local keys
sys.path.insert(0, '../src/')
import localvars
#allows us to store results of API call cleanly
... | true |
f7c209d65f04160f6e2450e749bfc1a8f65d9395 | zakmatt/molecules | /utils/loss_validate_callback.py | UTF-8 | 1,825 | 2.796875 | 3 | [] | no_license | import numpy as np
import os
from keras.callbacks import Callback
class LossValidateCallback(Callback):
""""""
def __init__(self, loss_validate_data, transform_features, results_file):
"""Loss validate callback saving training results after each epoch
:param loss_validate_data: method return... | true |
234969fa199a575dc31f365c1e5167546ff1b33d | mischelay2001/WTCSC121 | /CSC121Lab12_Modular/CSC121Lab12Problem2_Modular_ConvertLength/convert_length.py | UTF-8 | 511 | 3.921875 | 4 | [] | no_license | # Create a module length, which includes the following three functions:
def inch_to_cm(a_inch):
# inches_to_cm(inches): Convert inches to cm. 1 inch = 2.54 cm. Return cm.
cm = 2.54 * a_inch
return cm
def feet_to_m(a_feet):
# feet_to_m(feet): Convert feet to m. 1 foot = 0.30 m. Return m... | true |
e5df28e0eb081f01cf6d27f24fec710ce5ad07ac | Aituglo/Checkers | /checkers/classes/Game.py | UTF-8 | 21,464 | 3.53125 | 4 | [] | no_license |
from time import time
from math import fabs
from .Board import Board
from .PlayerBlack import PlayerBlack
from .PlayerWhite import PlayerWhite
from .MinMax import MinMax
class Game:
def __init__(self):
"""
Classe Game, principale du jeu
"""
# ID du joueur
self.player = 0
... | true |
b17f6839912ecedf30c67c4f431a3c0413660359 | DaHuO/Supergraph | /codes/CodeJamCrawler/16_0_3_neat/16_0_3_Joker_911_jamcoin.py | UTF-8 | 974 | 3.296875 | 3 | [] | no_license | import math
def mrange(start, stop, step):
while start < stop:
yield start
start += step
def add(a):
a.reverse()
carry=1
for i in range(1,len(a)-1):
if a[i]==0:
a[i]=1
carry=0
break
else:
a[i]=0
carry=1
return a
def baseconv(num,bs,n):
tot=0
for i in range(n):
tot+=num[... | true |
f36041497c6e9ea517d404098e9f3660a2f1bbd8 | Murega14/holbertonschool-higher_level_programming | /0x0A-python-inheritance/100-my_int.py | UTF-8 | 377 | 3.84375 | 4 | [] | no_license | #!/usr/bin/python3
"""myInt class"""
class MyInt(int):
"""instance of MyInt"""
def __init__(self, value):
"""initializes class"""
self.value = value
def __eq__(self, b):
"""reverse equals to not equals"""
return self.value != b
def __ne__(self, b):
"""reverse... | true |
637688149ad90a86bf0c8b8910f671812761c834 | abwolf/general_scripts | /macs_select_iteration.py | UTF-8 | 814 | 3 | 3 | [] | no_license | #For extracting only the 7th iteration (sim_6) of a macs simulation raw output.
import sys
count = 0
print sys.stdin.readline().strip() #print the first line of macs output, the command line paramters
print sys.stdin.readline().strip() #print the seed used for the simulation
for line in sys.stdin:
if 'END_... | true |
0d865c224462d6a5a8bcceccbeaf1088e8b64bdf | JiangHaoyang/AdvExample | /BoundSearchProject/attackModel.py | UTF-8 | 6,444 | 2.6875 | 3 | [] | no_license | import torch
import torch.nn as nn
import numpy as np
def FGSM(net, image, label):
#set the net in eval mode
net.eval()
# set eps
eps = 0.25
#copy image as valid input
x = image.clone()
x = torch.autograd.Variable(x,requires_grad=True)
y = label
#define loss... | true |
0cb0e4cbb387ba9c4af2871ba74b0a9c0cef64ff | nicozorza/curso-deep-learning | /src/classifier/Classifier.py | UTF-8 | 13,437 | 2.609375 | 3 | [] | no_license | import os
import random
import time
from tensorflow.python.framework import graph_io
import tensorflow as tf
from src.classifier import NetworkData
import numpy as np
class Classifier:
def __init__(self, network_data: NetworkData):
self.graph: tf.Graph = tf.Graph()
self.input_feature = None
... | true |
6a53c610ab479e330cc63068303835ef5b219899 | normallytangent/exercism-python | /reverse-string/reverse_string.py | UTF-8 | 89 | 2.671875 | 3 | [] | no_license | #!usr/bin/env/ python3
# -*- coding: utf-8 -*-
def reverse(text):
return text[::-1]
| true |
ace63405d5d78187604c9d15286a3775f2c3f150 | sid-verma/Coding-Interview-Questions | /Trees and Graphs/LowestCommonAncestor.py | UTF-8 | 1,039 | 3.59375 | 4 | [] | no_license | # KEY STEP: Find out the path list for both the nodes using DFS.
# Them compare the path list until nodes become dissimilar.
# Definition for a binary tree node.
# class TreeNode(object):
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution(object):... | true |
0947c4d9cc59611ddd33fa6d9659862f610e4de9 | liuyaqiao/Algorithms | /src/77.py | UTF-8 | 527 | 2.84375 | 3 | [] | no_license | class Solution:
def combine(self, n: int, k: int) -> List[List[int]]:
if k == 0:
return []
nums = [i + 1 for i in range(n)]
result = []
self.helper(nums, [], result, 0, k)
return result
def helper(self, nums, temp, result, index, k):
if len(temp) ... | true |
fb8451c841b666fc68d88698094ccec947254000 | mach856549/Admission_Procedure | /university.py | UTF-8 | 8,364 | 3.203125 | 3 | [] | no_license | global departments, dict_department_applicants, placed_students, test_score_column, original_scores, full_applicant_list
departments = sorted(["Biotech", "Chemistry", "Engineering", "Mathematics", "Physics"])
# Test Scores from original input "applicant.txt"
original_scores = {"Physics": 2, "Chemistry": 3, "Mathematics... | true |
07e600354286ce7775b3949e907c943b6f979666 | mdjukic/repos | /q_python_scripts/read_pandas.py | UTF-8 | 1,058 | 2.84375 | 3 | [] | no_license | #!/usr/bin/env python
from __future__ import print_function
import pandas as pd
import numpy as np
import sys
def read_dataframe():
"""
Inititalizing dataframe from csv file
"""
filename = "C:\\Users\mdjuk\\repos\\q_python_scripts\\titanic.csv"
#df = pd.read_csv(filename, header=True, sep=',' )
... | true |
3b01efae8ca98a55273587d2d036cea9fe1fa481 | metodj/CNNtest | /CNNfinal/bj_loss.py | UTF-8 | 1,299 | 3.09375 | 3 | [] | no_license | import theano
def align_targets(predictions, targets):
"""Helper function turning a target 1D vector into a column if needed.
This way, combining a network of a single output unit with a target vector
works as expected by most users, not broadcasting outputs against targets.
Parameters
----------
... | true |
be749f6db0c70a05478e3325841c1c3c3fc31b33 | captainjack331089/25-python-simple-problems | /1_Remove_Duplicates_Function.py | UTF-8 | 886 | 3.8125 | 4 | [] | no_license | """
Automation is a huuuuge part of Python’s playbook and an equally big part of why programmers love the language so much. When it comes to programming and web development (or data science or machine learning or any of the other fields Python is used for), being able to automate processes that would otherwise take for... | true |
ce8ddc9b7d90a27860fab76541dbad18b3089a1c | itsolutionscorp/AutoStyle-Clustering | /all_data/exercism_data/python/hamming/3ee58e8dc43f48fabb61026a44f24df9.py | UTF-8 | 221 | 3.0625 | 3 | [] | no_license | def distance(seq_a, seq_b):
if len(seq_a) != len(seq_b):
raise ValueError
diff = 0
for i in range(len(seq_a)):
if seq_a[i] != seq_b[i]:
diff += 1
return diff
| true |
af595fa55417134ad99aba2419e7e5ce1acfcafa | taku-yaponchik/tasks4.2 | /task4.2.2.py | UTF-8 | 176 | 3.6875 | 4 | [] | no_license | def is_year_leap(year):
if year%4==0:
return "True"
else:
return "False"
leap_year=int(input('Enter the year: '))
print(is_year_leap(leap_year))
| true |
1233abeea72068c7d1e22294ab1466e1ebb6a1c1 | danielsava/python-helloword | /02_curso_alura_oo/modelo.py | UTF-8 | 2,833 | 3.890625 | 4 | [] | no_license | """
Modelo : Programa
"""
class Programa:
def __init__(self, nome, ano):
self._nome = nome.title()
self._likes = 0
self.ano = ano
def dar_likes(self):
self._likes += 1
@property
def nome(self):
return self._nome
@nome.setter
def nome(self, nome)... | true |
12493c4b99bb5d317fa1ede034c081fc35514842 | millenc/gilded-rose-kata | /gilded_rose.py | UTF-8 | 3,202 | 3.03125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import re
MIN_ITEM_QUALITY = 0
MAX_ITEM_QUALITY = 50
MIN_ITEM_SELL_IN = 0
class GildedRose(object):
def __init__(self, items):
self.items = items
self.updater = NameBasedQualityUpdater([
('^Aged Brie$', SellInQualityUpdater(IncreasingQualityUpdater(), Decreasing... | true |
3caa4010932bf3834d562c3ecb6a1a352d0eff25 | liyong561/python_research | /deep_learning_primary/learn_tensorflow/visualize_layer.py | UTF-8 | 2,593 | 3.34375 | 3 | [] | no_license | from keras.models import load_model
from keras import models
from keras.preprocessing import image
import numpy as np
import matplotlib.pyplot as plt
def test01():
model = load_model('cat_and_dog_small.h5')
layers = [layer for layer in model.layers] # for语句组成list,对各个layer详细分析
length = len(layers)
pri... | true |
86d304da3a9eff26bb7335293442eb9b964b2ce0 | affan-ansari/travel_management | /agency/business_logic/car_list.py | UTF-8 | 882 | 2.625 | 3 | [] | no_license | # from agency.business_logic.car_model import Car_Model
from .car import Car
from ..models import CAR
from django.core.exceptions import ObjectDoesNotExist
class CarList:
def __init__(self):
pass
def add_car(self,reg_no,make,model,seats,color,image,fare):
reg_no = reg_no.upper()
color ... | true |
fb31b77d1456f6bebb3e1da65c8d86bc8a5f7fbb | tensorflow/tfjs-examples | /translation/python/translation.py | UTF-8 | 12,945 | 2.578125 | 3 | [
"Apache-2.0"
] | permissive | # Copyright 2018 Google LLC. 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 law or a... | true |
c0ed9041e7e37657f17468d9fc6c0cad270b2263 | robotframework/robotframework | /utest/model/test_control.py | UTF-8 | 7,768 | 2.671875 | 3 | [
"Apache-2.0",
"CC-BY-3.0"
] | permissive | import unittest
from robot.model import For, If, IfBranch, TestCase, Try, TryBranch, While
from robot.utils.asserts import assert_equal
IF = If.IF
ELSE_IF = If.ELSE_IF
ELSE = If.ELSE
TRY = Try.TRY
EXCEPT = Try.EXCEPT
FINALLY = Try.FINALLY
class TestFor(unittest.TestCase):
def test_string_reprs(self):
... | true |
32825b8b03e166b83620c9308e978e5cf50f20c8 | mzshieh/2019-nctu-annual | /H/submissions/wrong_answer/wa2.py | UTF-8 | 121 | 2.703125 | 3 | [] | no_license | toks = input().split()
n, k = [int(x) for x in toks[:2]]
a = float(toks[-1])
for i in range(1,n):
print(*([i+1]*k))
| true |
11ff7411f7b4ecae5852404ae7a522dc7878a99d | genius-2/python-files | /dartz.py | UTF-8 | 981 | 2.984375 | 3 | [] | no_license | x=int(input("кол-во игр "))
for i in range(x):
k=int(input("№ черной мишени"))
n=int(input("число секторов"))
score=[]
max=-1
if (k == -1):
for i in range(n):
score.append(int(input()))
for i in range(n):
sum = 0
for j in range(n):
... | true |
c3d7f0b03ecaf78ebeec3a5dccddebf1d767f725 | fk903801959/spider | /03get.py | UTF-8 | 892 | 3 | 3 | [] | no_license | from urllib.request import urlopen,Request
from urllib.parse import quote,urlencode
url = "http://www.baidu.com/"
url1 = "https://www.baidu.com/s?wd=python"
# 搜索字符为中文汉字时可以使用quote或urlencode方法进行编码转换
# 这是通过quote方法进行转码,适用于仅编码wd为汉字的情况
url2 = "https://www.baidu.com/s?wd={}".format(quote("尚学堂"))
# 使用urlencode方式转码,需创建一个字典对... | true |
e9fd2bc50d813ab22cfcc00916ef88d9de6683d6 | krbyktl/Python | /perc_func.py | UTF-8 | 393 | 3.140625 | 3 | [] | no_license | #!/bin/usr/env python3
#kleo1:20180409:perc_func.py
"""
Machine learning with a perceptron!
"""
def weight_sum(x1,x2,x3,w1,w2,w3):
S=x1*w1+x2*w2+x3*w3
return S
def step_func(S):
if S >= 0:
return 1
else:
return 0
def perc_output(x1,x2,x3,w1,w2,w3):
y=step_func(weight_sum(x1,x2,x3,w1,w2,w3))
ret... | true |
a92645c25048f33a109be4f251e589a996aaf309 | richie-cs/InstaBot | /venv/grambot.py | UTF-8 | 3,110 | 2.703125 | 3 | [] | no_license | from selenium import webdriver
from time import sleep
from data import user
from data import password
class GramBot:
def __init__(self, username, password):
if (username == ''):
print("Enter your Instagram username: ")
username = str(input())
if (password == ''):
... | true |
2e732d5c08982458a5965791cc0989ef06adea61 | makzyt4/discogs-tagger | /discogstagger/settings.py | UTF-8 | 1,087 | 2.703125 | 3 | [
"MIT"
] | permissive | import os
class SettingsManager:
def __getitem__(self, item):
return self.settings[item]
def __init__(self, filename=os.path.expanduser('~') + os.sep + 'discogs-tagger.settings'):
self.filename = filename
self.default_settings = {
'format': '${d-}${n} - ${t}',
... | true |
c1b784d8497bb7bdd6bb28b6888730dcae6390db | likit/mdv_rnaseq_paper | /sort-fasta.py | UTF-8 | 797 | 3.09375 | 3 | [] | no_license | #!/usr/bin/env python
'''Description'''
import sys
from Bio import SeqIO
def read_list(infile):
seqlist = []
for line in open(infile):
seqlist.append(line.strip())
return seqlist
def sort(infile, seqlist, outfile):
seqdict = {}
for rec in SeqIO.parse(infile, 'fasta'):
seqdict[r... | true |
c0c3f8ffffee33d1b900b6154146d1eda87549d0 | GithuiVictor/SkaeHub-Developer-Program-Boot-Camp | /DAY 3/challenge3.py | UTF-8 | 320 | 3.5625 | 4 | [] | no_license | import numpy as np
# X = np.array([1, 7, 13, 105])
x = []
x_length = 5
for i in range(int(x_length)):
num = input("num :")
x.append(int(num))
print("Original array:")
print(x)
x = np.array(x)
size = (x.size * x.itemsize)
print("Size of the memory occupied by the said array:")
print("{} bytes".format(size) )
| true |
010543b05158e75201d48fdb565fc0d7167ddb97 | Lizonghang/learn-gluon | /cv/run_plot_bbox.py | UTF-8 | 718 | 2.59375 | 3 | [] | no_license | import gluonbook as gb
from mxnet import image
def bbox_to_rect(bbox, color):
return gb.plt.Rectangle(xy=(bbox[0], bbox[1]),
width=bbox[2]-bbox[0],
height=bbox[3]-bbox[1],
fill=False,
edgecolor=color,
... | true |
fee863e88928f98fa48197288a25073026629d01 | Sujandeep123/Python-Tutorial | /nested_list_dict.py | UTF-8 | 632 | 3.796875 | 4 | [] | no_license | #%%
# Nested Array
full_name = [
['Sujan', 'Shrestha'],
['Pratuat', 'Amatya']
]
# for name in full_name:
# for n in name:
# print(n)
# Nested Dictionary
shop_items = {
'electronics' : {
'tv' : 5,
'ps4' : 2
},
'sports' : {
'basketball': 20,
'football' : 30
}
}
for key, value in sh... | true |
f7474bc49b124d6cd418161724b6b22594944f10 | jaklimoff/slack-sage | /slack_sage/mixins.py | UTF-8 | 395 | 2.59375 | 3 | [] | no_license | import aiohttp
class RequestsMixin:
"""
Allow handlers to use async requests
"""
session = aiohttp.ClientSession()
async def _request(self, method, url, **kwargs):
async with getattr(self.session, method)(url, **kwargs) as resp:
return await resp.text()
async def get(self... | true |
82a13b1bb5bf3665415ec8521d79bb6f07b8f7bb | yash-0501/python-poc | /basics/loops/while.py | UTF-8 | 48 | 3.4375 | 3 | [] | no_license | i = 1
while(i<=5):
print(i,end="")
i+=1
| true |
86601247a177954f0ed4b2c7a8494189916adf1c | tedtang77/kaggle-databowl2017 | /utils_databowl.py | UTF-8 | 2,021 | 3.1875 | 3 | [] | no_license | import os, sys
import numpy as np # linear algebra
import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)
import dicom
import scipy.ndimage
import matplotlib.pyplot as plt
MIN_BOUND = -1000.0
MAX_BOUND = 400.0
def normalize(image):
'''
Normalization
Our values currently range... | true |
2386e44298c87c97d027ed5da275c37ad524072b | aviallon/autologicgate | /autologicgate.py | UTF-8 | 25,444 | 2.859375 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Dec 17 13:46:34 2019
@author: aviallon
"""
import math
DEFAULT_WIDTH = 4
NULL = [0]*DEFAULT_WIDTH
BIAS = 1e-8
global DEBUG
DEBUG = True
call_stack = []
class Warning:
def __init__(self, message):
import sys
print(f"\033[1;33m{self.__class__._... | true |
49e87b028227a290277bcbcb5f7f012677eafe5d | alternaDev/RolfFMReloaded | /lib/player.py | UTF-8 | 1,163 | 2.75 | 3 | [] | no_license | import random
import subprocess
import os
import logging
import platform
import time
logger = logging.getLogger(__name__)
class Player(object):
def __init__(self):
self.DEVNULL = open(os.devnull, 'wb')
self.current_playback_process = None
self.last_playback = 0
def play(self, path):... | true |
1112a73f88fc07be6ec8c8b156fe3fa8a3b63712 | jmenken/Microtops_eval | /utils/datahandler/man_reader.py | UTF-8 | 3,504 | 2.71875 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import glob
import os
import pandas as pd
import numpy as np
import xarray as xr
from .MainReader import MainReader
class MANReader(MainReader):
def __init__(self, sampled="daily", level=20):
super().__init__()
self.sampled = sampled
self... | true |
ecdc053ae8568fc77b723a414b8ed54dbcb606f7 | jgrt/programming-problems | /programs/mathematics/problem1/test_solution.py | UTF-8 | 526 | 3.40625 | 3 | [] | no_license | import pytest
from mathematics.problem1.solution import create_pattern
def test_create_pattern_on_output_size():
val = 4
resp = create_pattern(val)
assert len(resp) == val
def test_create_pattern_on_order_of_list_element():
resp = create_pattern(3)
assert list(resp[-1]) == sorted(list(resp[-1]),... | true |
934b03dd38bdde3f00101ae3b569b8604d5567b5 | soominok/cheese-ai | /com_cheese_api/resources/user_modeling.py | UTF-8 | 3,810 | 2.734375 | 3 | [
"MIT"
] | permissive | # import pandas as pd
# class UserModel:
# def __init__(self):
# self.user = None
# self.user_top = None
# def userFile(self):
# self.user = pd.read_csv("com_cheese_api/resources/data/user_dataset.csv")
# print(f'##### user 원본 데이터 출력#####')
# print(self.user)
# ... | true |
fb4742397397541252de15c117762a762265c19e | jaredtlove/ASR33 | /bin/twitchbot | UTF-8 | 2,589 | 2.609375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Based on (link below) which is copyright (c) 2017-2019 TwitchIO
# https://github.com/TwitchIO/TwitchIO/blob/rewrite/examples/subclass_bot.py
import os
import stat
import sys
import click
import asyncio
from twitchio.ext import commands
async def wait_for_mesg():
#... | true |
6100a94577a17d82e7f29d17960f5d7e1064523e | abkenov/fourier_transofrms | /my_fourier.py | UTF-8 | 9,441 | 3.75 | 4 | [] | no_license | import numpy as np
from tqdm import tqdm_notebook
def naive_DFT(signal):
'''
Naive implementation of Discrete Fourier Transform with double loop
Works long, has complexity of O(n^2)
Parameters
----------
signal: one-dimensional array of numbers
Signal or sound that we want to transofrm
Output
---... | true |
5ff007aaf562f76d5ec2ecab0cab6aaba9704052 | romalukin777/vector-exploit | /src/edn2/2014-004-AndroidBrowser/stage1_xml.py | UTF-8 | 2,707 | 2.875 | 3 | [] | no_license | #!/usr/bin/python
# stage1_xml generates the correct XML stage1 exploit document based on
# the base address specified as a parameter
import sys
import os
import struct
class InvalidParameterError(Exception):
pass
def toascii(data):
"""
Encodes a 32-bit integer as an ascii string. raises InvalidParamete... | true |
f3d5f79c5658d1a42ad160b4039b718f8fef6152 | Dovermore/artificial_intelligence_project | /part_a_archive/artificial_idiot/state.py | UTF-8 | 4,040 | 3.328125 | 3 | [
"MIT"
] | permissive | from util.class_property import classproperty
from util.misc import print_board
from copy import copy
from util.mycopy import deepcopy
class State:
"""
State class stores current node state, the state is represented
as two dictionaries of forward position mapping and backward position
mapping.
pie... | true |
0c5474adaf54143333bcd50b85d96c29caea9e5c | davidyuqiwei/davidyu_stock | /scripts/functions/common/TimeMake.py | UTF-8 | 3,409 | 3.578125 | 4 | [
"MIT"
] | permissive | import datetime
class timeFunc():
'''
@start_date: 起始日期
@stat_days: 历史统计日期
@pred_days: 预测日期
输入起始日期,历史统计日期,预测日期
返回: 统计结束日期
预测起始日期
预测结束日期
'''
def __init__(self, start_date, stat_days, pred_days):
self.start_date = start_date
self.stat_days = stat_days
sel... | true |
3dda68dd94a7432bd8362d10f5ee7d8be15ec03f | littlewine/snorkel-ml | /treedlib/treedlib/features.py | UTF-8 | 2,527 | 2.515625 | 3 | [
"Apache-2.0"
] | permissive | from templates import *
import lxml.etree as et
def compile_relation_feature_generator(dictionaries=None, opts={}):
"""
Given optional arguments, returns a generator function which accepts an xml root
and two lists of mention indexes, and will generate relation features for this relation
Optional args are:
... | true |
dc20342b734a8c4c6019a4cc542c491456a3f096 | vishnu2709/practice_solvers | /DG/DG_1D_linear.py | UTF-8 | 3,640 | 3 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as pl
from scipy.integrate import quad
from scipy.misc import derivative
# 1D Scalar Conservation Equation solved using Discontinuous Galerkin method
# Only linear basis used
c = 2 # flow speed
x_start = 0.0
x_end = 1.0
t_start = 0.0
t_end = 5.0
t_elements ... | true |
d324bd1af30e5f6f3693c8890d4379f3b7de1b82 | iciclespider/fabric | /fabric/context_managers.py | UTF-8 | 1,558 | 3.203125 | 3 | [
"BSD-2-Clause"
] | permissive | """
Context managers for use with the ``with`` statement.
"""
from contextlib import contextmanager
from state import env
@contextmanager
def warnings_only():
"""
Context manager which temporarily sets ``env.abort_on_failure`` to False.
`warnings_only` will preserve and then reinstate the previous valu... | true |
16d7980224611fc0f17c9e602e4e783a0de1d592 | akhileshsantoshwar/Python-Program | /Numpy/P07_NumpyMathematicalFunctions.py | UTF-8 | 875 | 4.03125 | 4 | [
"MIT"
] | permissive | # Author: AKHILESH
import numpy as np
angles = np.array([0, 30, 45, 60, 90, 180, 360])
# Convert to radians by multiplying with pi/180
# for getting sine of angles
print(np.sin(angles * np.pi/180))
# for getting cosine of angles
print(np.cos(angles * np.pi/180))
# for getting tangent of angles
print(np.tan(angles ... | true |
cae1ab178cd385cde84e39a17c9f0cc0ab708040 | alexdcodes/Networking-Automation | /webscraping.py | UTF-8 | 3,012 | 2.6875 | 3 | [] | no_license | from bs4 import BeautifulSoup
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import re
import pandas as pd
import itertools
update_mode = False
debug_mode = True
driver = webdriver.Chrome("C:/Users//Downloads/chromedriver_win32/chromedriver.exe")
if update_mode == True:
file_name... | true |
e7e1258cb1c1a35e87940494b88397546e47aa11 | mikoada/CA116 | /practice/16Q3b.py | UTF-8 | 406 | 3.84375 | 4 | [] | no_license | #Returns largest Fibonacci number less than n.
import sys
n = input()
def fib(n):
prev = 0
curr = 1
while curr < n:
print curr
tmp = curr + prev
prev = curr
curr = tmp
fib(n)
#Fibonacci sequence
#def fib(n):
#prev = 0
#curr = 1
#i = 0
#while i < n:
#print ... | true |
b4d380127b70a31abb0a405e0d81654fc97e9ecc | pohlinwei/pohlinwei.github.io | /projects/utilities/projectdecoder.py | UTF-8 | 339 | 2.625 | 3 | [] | no_license | from .Project import Project
def as_project(dct):
if not '__project__' in dct:
raise TypeError('Not all entries in .json represent a valid project')
return Project(dct['name'], dct['image'], dct['summary'], dct['description'], dct['tools'],
dct['date'], dct['page'], dct['screenshots... | true |
452bf740d7e856c2913a4a26c5f5c9558b371ec7 | kgori/phylo_utils | /phylo_utils/substitution_models/abstract.py | UTF-8 | 5,843 | 2.75 | 3 | [] | no_license | from abc import ABCMeta
import numpy as np
from phylo_utils.substitution_models.utils import compute_b_matrix, check_frequencies, check_rates, compute_q_matrix, \
get_eigen, expm
MIN_BRANCH_LENGTH = 1/2**16
class Model(object):
__metaclass__ = ABCMeta
_name = None
_rates = None
_freqs = None
... | true |
ae3cc7f84e3a6086026af413b9e0c6d168973fa7 | rwydaeghe/circuit-reconstruction-ML | /circuit_reconstruction.py | UTF-8 | 1,829 | 2.78125 | 3 | [] | permissive | #! /usr/bin/env
import argparse
import os
import inspect
from pathlib import Path
import random
import numpy
import circuitgen
def main():
parser = argparse.ArgumentParser(description="Use deep neural networks to reconstruct circuits")
parser.add_argument(
"operation",
choices=["train", "evalu... | true |
a4b29e6e887e7df77940b8d271f306f8a5adb2b2 | Aasthaengg/IBMdataset | /Python_codes/p03250/s241743854.py | UTF-8 | 67 | 2.65625 | 3 | [] | no_license | a=list(map(int,input().split()))
x=max(a)*10
print(sum(a)-max(a)+x) | true |
5223d209dc5aa390b2454c6cf1dd9c13b3bdf75d | nayanika2304/DataStructuresPractice | /Practise_array_strings/zero_matrix.py | UTF-8 | 800 | 3.859375 | 4 | [] | no_license | '''
Write an algorithm such that if an element in an MxN matrix is 0,
its entire row and column are set to O.
'''
def setZeroes(A):
m = len(A) # number of rows, len of a column
n = len(A[0]) # number of columns, len of a row
zero_rows_indices = set()
zero_cols_indices = set()
for i in range(m):
... | true |
016a3d91d5ca584e471e670f47a4d92678e1681d | shank7485/OVSDB-Python-Wrapper | /wrapper.py | UTF-8 | 999 | 2.796875 | 3 | [] | no_license | import socket
import json
import time
"""
Testing the way OVSDB receives json RPC from a client
"""
value = {
"method":"transact",
"params":[
"Open_vSwitch",
{
"op":"select",
"table":"Bridge",
"where":[]
}
],
"id":"test"
}
"""
In the above... | true |
14826032202eeea402826fa46abb147d7ed3a6f3 | AlekseyMolchanov/sugar_test | /sugar_test/test_sugar.py | UTF-8 | 7,961 | 2.5625 | 3 | [] | no_license | #!/usr/bin/env python
# encoding: utf-8
import os
import re
from random import randint
import generate
import check
import pytest
from sugarcrm import Session, Account, Contact
assert os.environ['SUGAR_CRM_COUNT']
assert os.environ['SUGAR_CRM_URL']
assert os.environ['SUGAR_CRM_USERNAME']
assert os.environ['SUGAR_C... | true |
419ac23196dfbb4c82155681793584a8f908350f | sgettel/science-in-paradise | /worldmap.py | UTF-8 | 1,347 | 2.859375 | 3 | [] | no_license | #/usr/bin/env python3
# Plot conferences on world map per year.
import glob;
import numpy;
import json;
from matplotlib import pyplot;
pyplot.ion();
from mpl_toolkits.basemap import Basemap;
# Parse coordinates into these arrays.
latArray = [];
longArray = [];
for filename in numpy.sort(glob.glob("data/meeting_list_... | true |
ee88c625977367b0e07880aa999b6f9e82ae50a1 | AdityaStark7/blockchain_backend | /blockchain-env/Lib/site-packages/pubnub/dtos.py | UTF-8 | 990 | 2.546875 | 3 | [
"MIT"
] | permissive | class SubscribeOperation(object):
def __init__(self, channels=None, channel_groups=None, presence_enabled=None, timetoken=None):
assert isinstance(channels, (list, tuple))
assert isinstance(channel_groups, (list, tuple))
assert isinstance(presence_enabled, bool)
assert isinstance(tim... | true |
c384389c7da195cb336cd2fa10ce7ecab5cfc1e2 | esmaclo/empresa_epd7 | /src/Empresa.py | UTF-8 | 719 | 3.34375 | 3 | [] | no_license | __author__ = 'Esmir Acosta'
class Empresa():
"""
Clase que representa un empleado
"""
def __init__(self, nombre_empresa, cif, razon_social):
"""
Metodo constructor de la clase Empresa
Se inicializaran 3 atributos con los parametros pasados y aparte se creara una lista de depart... | true |
4a806a80b92822aff49b09b2e8c6222dd1531eb5 | toshikish/atcoder | /abc/abc241_e.py | UTF-8 | 423 | 2.59375 | 3 | [] | no_license | N, K = map(int, input().split())
A = list(map(int, input().split()))
visited = [-1] * N
total = [0]
X = 0
i = 0
c = 0
while visited[i] == -1:
visited[i] = c
X += A[i]
total.append(X)
i = X % N
c += 1
init = visited[i]
loop = c - visited[i]
if K <= init:
ans = total[K]
else:
over = K - init... | true |
ab5d692a55f856d2954e9974a6287c9d274bd5d6 | alina-timir/Playground-1 | /Pyton_stuff/Teme_BD/Tema3_test7_5.py | UTF-8 | 1,094 | 2.671875 | 3 | [] | no_license | __author__ = 'darakna'
__author__ = 'darakna'
import subprocess
from subprocess import PIPE
import threading
threadList = []
num_threads=5
proces_vanat="PyAppReadCons.exe"
mesaje_trimise=["test1", "test2", "test3", "exit"]
proc = subprocess.Popen(proces_vanat,stdin=PIPE,stdout=PIPE)
print ("...alocare ok...")
def trimi... | true |
301caf19cab58ac8528b2c6481531691fe563a74 | wangfree86/pyproject | /learn/xml/demo.py | UTF-8 | 1,710 | 3.28125 | 3 | [] | no_license | import xml.dom.minidom
#根据名称获取Excel表格中的数据 参数:file:Excel文件路径 colnameindex:表头列名所在行的索引 ,by_name:Sheet1名称
def savexml(managerList):
doc = xml.dom.minidom.Document()
#创建一个根节点Managers对象
root = doc.createElement('Managers')
#设置根节点的属性
# root.setAttribute('company', 'xx科技')
# root.setAttribute(... | true |
1dff535b0b4850613960e404a94d9cc9e302d1eb | charles8ff/proyecto-hambre | /src/api/models.py | UTF-8 | 11,291 | 2.546875 | 3 | [] | no_license | import enum
from flask_sqlalchemy import SQLAlchemy
import json
from dataclasses import asdict, dataclass
from sqlalchemy.ext.hybrid import hybrid_property, hybrid_method
from sqlalchemy import UniqueConstraint
db = SQLAlchemy()
class Business(db.Model):
__tablename__ = 'business'
id = db.Column(db.Integ... | true |
ea08c826b22c11e916641f6378d0d0600fbbc342 | predatory123/byhytest | /python_practice/python0613/time.py | UTF-8 | 1,450 | 3.703125 | 4 | [] | no_license | # import time
# before = time.time()
# func1()
# after = time.time()
# print(f调用func1,花费时间{before-after}’)
from datetime import datetime
# asd = str(datetime.now().strftime('%Y-%m-%d ** %H:%M:%S'))
# time.strftime('%Y-%m-%d %H:%M:%S',time.localtime())
# print(asd)
aa= datetime.now()
print(aa)
# datetime.datetime(2018... | true |
4b83cdf316569ab934deccbb71abc158fbe99fc9 | kaclark/DHS_intergenic_analysis | /lone_DHS_sites_chart.py | UTF-8 | 1,694 | 2.703125 | 3 | [
"MIT"
] | permissive | #Finds DHS sites that aren't included in intersects, ie DHS sites that are of the highest variability
#analyzed_intersects.csv generated in variabilty_chart.py
#DHSs_intergeinc_#.csv generated in UNKONWN
import pandas as pd
#load intersects
intersects = pd.read_csv("data/mm10_data/analyzed_intersects.csv", header=No... | true |
67756660b7d9ad242b43517b9a9862e2392cc94c | shabbir22/Learn-to-Code | /ch4/pg-130/Determining_the_final_output_of_a_set_of_codes.py | UTF-8 | 624 | 3.21875 | 3 | [] | no_license | eighties=['','duran duran','B-52s','muse']
newwave=['flock of seagulls','postal service']
remember=eighties[1]
eighties[1]='cultural club'
band=newwave[0]
eighties[3]=band
eighties[0]=eighties[2]
eighties[2]=remember
print(eighties)
length=len(eighties) #Length of the list
print(length) #4
#Obtaining the last ... | true |
dd9170e9952acba69db763db44b7c507a55b01f1 | lasote/conan | /conans/util/windows.py | UTF-8 | 3,139 | 2.5625 | 3 | [
"MIT"
] | permissive | import os
from conans.util.files import load, mkdir, save, rmdir
import tempfile
CONAN_LINK = ".conan_link"
def conan_expand_user(path):
""" wrapper to the original expanduser function, to workaround python returning
verbatim %USERPROFILE% when some other app (git for windows) sets HOME envvar
"""
#... | true |
d5553461eedc18dff405919a1e969a03491cad3f | LexanRad/DZshka | /DZ2/Hello_name.py | UTF-8 | 499 | 3.296875 | 3 | [] | no_license | names_list = ['инженер-конструктор Игорь', 'главный бухгалтер МАРИНА', 'токарь высшего разряда нИКОЛАй',
'директор аэлита']
for elem_of_list in names_list:
# Приводим элемент к заглавным буквам, разделяем строку на список, вытаскиваем последний элемент - Имя
name_in_str = elem_of_list.title().spl... | true |
3e31fc11ad548eeda16e22ed102c07ed6b705fc0 | natgaertner/noipytraining | /additional_material.py | UTF-8 | 705 | 3.84375 | 4 | [] | no_license | #remove
li = ['coke','coffee','mimosa','water','bloody mary','ice tea']
li.remove('water')
li
li.append('coffee')
li
li.remove('coffee')
li
#extend
li2 = ['pancakes','eggs','potatoes']
li.extend(li2)
li
raw_input('a while loop with break')
while True:
inp = raw_input('did you find it? ')
if inp == 'yup':
... | true |
0a7cb50fbdeee0ab5f85e6302f44319957fcbaf0 | miltondp/phenomexcan | /src/plots.py | UTF-8 | 1,224 | 2.984375 | 3 | [
"MIT"
] | permissive | import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
def scatterplot(df, col1, col2, xlabel=None, ylabel=None, title='', dpi=200, sample=None, add_identity_line=True, **kwargs):
if sample is not None:
df = df.sample(sample)
xlabel = col1 if xlabel is None else xlabel
ylabel = ... | true |
5cad1d316bb02c8e06138912df0513bd195cba60 | yjh8806/python-2019-July | /13일/15.함수/03.function.py | UTF-8 | 485 | 4.1875 | 4 | [] | no_license | def odd_even(num):
if num % 2 == 0:
print("짝수입니다.")
else:
print("홀수입니다.")
num = int(input("정수 입력 : "))
odd_even(num)
def total(a):
result = 0
for i in range(1, a + 1):
result += i
return result #반환값
print("누적합계 : %d"%total(10))
#제곱
def power(a, b):
... | true |
fea5d59a8d6278271cbe6f7fad01e44d32a782ee | jatinck1601/Secret-Message-App | /SMA.py | UTF-8 | 1,635 | 3.46875 | 3 | [] | no_license | from tkinter import messagebox, simpledialog, Tk
def get_task():
task = simpledialog.askstring('Task', 'Do you want to encrypt or decrypt?')
return task
def get_message():
message = simpledialog.askstring('Message', 'Enter the secret message: ')
return message
root = Tk()
while True:
task = get_task()
if task == 'encry... | true |
0904fcd93e7885ed4570c829498725403a7b1946 | daniel-reich/ubiquitous-fiesta | /4xZFisQX8NnYB3nv4_6.py | UTF-8 | 245 | 2.765625 | 3 | [] | no_license |
def maximum_seating(lst):
s=sum(lst)
i=0
while i<len(lst):
if i<2:
A=lst[:i+3]
elif 2<=i<len(lst)-2:
A=lst[i-2:i+3]
else:
A=lst[i-2:]
if all(x==0 for x in A):
lst[i]=1
i+=1
return sum(lst)-s
| true |
0cea12899b1fd84992267ba2e780211036c5a59a | Manvichauhan/python-project | /logic operator.py | UTF-8 | 139 | 3.375 | 3 | [] | no_license | a = 10
b = 10
c = 20
if (a==b and b==c):
print("yes")
else:
print("no")
if (a==b or b==c):
print("yes")
else:
print("no") | true |
d2b90d06e6c2f9849b8b627637f5ee7cc33eb4dd | vishnukey/Scheme-Py | /parser.py | UTF-8 | 2,652 | 3.421875 | 3 | [
"MIT"
] | permissive | import re
def OPEN_PAREN():
return ('(', None)
def CLOSE_PAREN():
return (')', None)
def NUM(data):
return ('NUM', data)
def STRING(data):
return ('STRING', data)
def IDENTIFIER(data):
return ('IDENTIFIER', data)
def BOOL(data):
return ('BOOL', data)
def read_until(str_iter, matcher):
... | true |
ba509bf2a9d4cc530d922f0156527e59ee3e2c13 | rishabhgupta03/Hacker-Rank-python | /Tuple(hash).py | UTF-8 | 115 | 2.96875 | 3 | [] | no_license | n = int(input())
m = input().split()
for i in range(n):
m[i] = int(m[i])
tup = tuple(m)
print(hash(tup))
| true |
3c2e58317b971b2c1045a3d000363c1622b8a764 | siriS88/py_coding | /createminimalBST.py | UTF-8 | 273 | 2.890625 | 3 | [] | no_license | from Tree import Node2
def createMinimalBST(arr,start,end):
if end<start
return None
mid = int(math.floor(start+end)/2)
n = Node2(arr[mid])
n.left = createMinimalBST(arr[start:mid-1],start,mid-1)
n.right = createMinimalBST(arr[mid+1:end],mid+1,end)
return n
| true |
c6726c490c37905c71f5f680734c3cd7cb735d9c | corrodedHash/battleships | /battleships/battleshell.py | UTF-8 | 4,100 | 3.03125 | 3 | [] | no_license | """Contains BattleShell class"""
import cmd
from typing import Optional
from . import util
from .management import field, shotfinder, battleprinter
class BattleShell(cmd.Cmd):
"""Shell to manually access the battlefield"""
intro = "Welcome to the [b]4ttl3shell. "
"Type help or ? to list commands.\n"
... | true |