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 |
|---|---|---|---|---|---|---|---|---|---|---|
09d11e13a8c4fc7ef1e1dffd99b37ea8bd4a6d61 | RPGLite/analysis | /legacy_scripts/games_played_over_time.py | UTF-8 | 2,732 | 2.515625 | 3 | [
"MIT"
] | permissive | # William Kavanagh
from pymongo import MongoClient
from pprint import pprint
from datetime import date
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.dates as mdates
from matplotlib.offsetbox import OffsetImage, AnnotationBbox
import datetime
from Constants import *
from helper_fns import *
impor... | true |
3b5414d25afaf522f4aa0e0efecfebb57fb3e63b | STEP1313/24-7-Bot | /disk.py | UTF-8 | 1,026 | 2.703125 | 3 | [] | no_license | import discord
from discord.ext import commands
from discord.utils import get
import asyncio
import os
bot = commands.Bot( command_prefix = ',')
bot.remove_command('mute')
@bot.event
async def ready():
print('ready')
@bot.command()
@commands.has_permissions(administrator = True)
async def muting(ctx, member: disco... | true |
8d2998b301b957e1a3b5e9ac33ea7067e45fcc94 | MichelleZ/leetcode | /algorithms/python/heaters/heaters.py | UTF-8 | 520 | 3.03125 | 3 | [] | no_license | #! /usr/bin/env python3
# -*- coding: utf-8 -*-
# Source: https://leetcode.com/problems/heaters/
# Author: Miao Zhang
# Date: 2021-02-15
class Solution:
def findRadius(self, houses: List[int], heaters: List[int]) -> int:
res = 0
n = len(heaters)
j = 0
heaters.sort()
house... | true |
88cac7f0018a473ff714fdfbae25580ac86a4edc | C0C0AN/MSc_thesis_MalteGueth | /Behavioural_and_self_report_data/behavioral_descriptives_inferential.py | UTF-8 | 5,254 | 2.578125 | 3 | [] | no_license | """
Created on Mon Jan 22 16:06:13 2018
@author: Malte R. Gueth
"""
# Read in reaction times and reaction types by block, trial and trialtype ('rawdata.txt')
# Get some basic descriptive and inferential statistics using pandas data frame, statsmodels,
# seaborn and scipy statistics
import pandas as pd
import seaborn... | true |
2b1b10e1633a738d46fb74066e3b54afc73151e9 | pabhi-pete/ICMP_ping_test | /icmp_pinger.py | UTF-8 | 2,679 | 2.546875 | 3 | [] | no_license | from socket import *
import os
import sys
import struct
import time
import select
import binascii
ICMP_ECHO_REQUEST = 8
def checksum(str):
str = bytearray(str)
csum = 0
countTo = (len(str) // 2) * 2
count = 0
while count < countTo:
thisVal = (str)[count+1] * 256 + (str)[count]
csu... | true |
c41b0617a8f78d4c68e2680326465b593dd8079d | Amy8866/Numerical-Aalysis-S211 | /HW4/problem2.py | UTF-8 | 878 | 3.34375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sun Oct 28 23:53:46 2018
@author: MinF
"""
import numpy as np
from scipy.integrate import quad
def f1(x):
return x**3
def f2(x):
return np.exp(x)
def f3(x):
return np.sin(x)
def Simpson_integral(x,f):
H = (x[1]-x[0])/2.
ff = H/3.*(f(x[0]) + 4. * f((x[0] + x... | true |
570948667a6c02d72a4c6fbb53bd58fd48cb640a | milkrong/Basic-Python-DS-Algs | /LeetCode/triple/2.py | UTF-8 | 279 | 3.5625 | 4 | [
"MIT"
] | permissive | def bracket_match(bracket_string):
res = 0
for b in bracket_string:
if b == "(":
res += 1
elif b == ")":
res -= 1
else:
continue
res = 0 if res ==0 else 1
return res
print(bracket_match("(((())")) | true |
ecf556be339b68507af624908e844c0aaeddfb56 | Aasthaengg/IBMdataset | /Python_codes/p02743/s118280786.py | UTF-8 | 160 | 3.015625 | 3 | [] | no_license | a,b,c = map(int,input().split())
ab= (a*b)*4
C= (c-a-b)**2
if c-a-b>=0:
if ab<C:
print("Yes")
else :
print("No")
else :
print("No")
| true |
ac7ecabd9ed8fb51180419b01054607b8339f975 | Krishna-dubey/test-jenkins | /test_circle_area.py | UTF-8 | 818 | 3.5 | 4 | [] | no_license | '''Importing required module'''
import unittest
from math import pi
from circle_area import circle_area
class TestCircleArea(unittest.TestCase):
'''Class to unit test circle_area function'''
def test_area(self):
'''Testing area when radius >= 0'''
self.assertAlmostEqual(circle_area(1), pi)
... | true |
c8c5db4298fee280a6ca7b2cdc721880b1ff5d47 | ArunRamachandran/BinaryTree-Python | /9.mirror.py | UTF-8 | 996 | 3.796875 | 4 | [] | no_license | """ Python code to implement a mirror fn """
class Node :
""" Node of a tree """
def __init__(self) :
self.data = None
self.left = None
self.right= None
def NewNode(elem) :
node = Node()
node.data = elem
node.left = None
node.right= None
return node
def Insert(head,elem) :
if head == None:
return Ne... | true |
e5f081fd65033cefdeed503f62519e9498bce562 | obhalerao/student-pi-imaging | /time_lapse.py | UTF-8 | 832 | 2.71875 | 3 | [] | no_license | import os
import datetime
from datetime import tzinfo
import math
from picamera import PiCamera
from time import sleep
import time
# Enter the path where the raspberry pi will store its file
RASPI_PATH = "images_{}".format(time.asctime().replace(" ","_"))
os.mkdir(RASPI_PATH)
INTERVAL = 2# the time interval (in sec... | true |
ada2f462bccdb001f3b3539d9d291a1db16ef470 | 1egoman/quail-flask | /plugins/weather/weather.py | UTF-8 | 3,354 | 2.796875 | 3 | [
"MIT"
] | permissive | import datetime as dt
import urllib2
import json
def parse_weather(self, when, where, API_KEY):
conditions = None
today = False
# if there is no time, create one (means most likely that weather for today is requested)
if not (type(when) == list and when[2] != dt.datetime.now().day):
when = [d... | true |
ea4ef66d783f5eed3e6f2c6657515d18b6405e3d | WladimirTavares/lfa2020.2 | /codigos/pda3.py | UTF-8 | 2,559 | 3.8125 | 4 | [] | no_license | # Pushdown automata
# L = { w | n_a(w) = n_b(w) }
# L = { w | número de a's em w é igual ao número de b's em w }
# Context-Free Grammar
# S -> aSbS | bSaS | epsilon
# Seja w uma string em L então podemos encontrar um prefixo de w com o mesmo número de #a's e b's então a string w pode ser reescrita como w = w1w2.
#... | true |
c6505a17d0c63fcea6f563a759314292c1c984fc | zcongchao/learning | /python/spiders/threading_spider.py | UTF-8 | 3,821 | 2.84375 | 3 | [] | no_license | # -*- coding:utf-8 -*-
# _auth:kaliarch
import requests
from bs4 import BeautifulSoup
import urllib
import os
import threading
class DutuSpider():
# 定义全局页面url列表
page_url_list = []
# 定义具体各表情图片url列表
img_url_list = []
# 定义rlock进程锁
rlock = threading.RLock()
def __init__(self,... | true |
babc9db265ffa37dfcf1ebd7b13f94639cb5095d | truonghieu0511/truongminhhieu-fundamental-c4e24 | /session3/while_intro.py | UTF-8 | 140 | 3.515625 | 4 | [] | no_license | count = 0
# while count < 3:
# print("hi")
# count += 1
while True:
print("hi")
count += 1
if count >= 3:
break | true |
a4a6e8f0a7b45a93ce793e0fe9fd2d2514e23417 | dxcv/repo_dp | /Proyectos/return_report/return_report_controller.py | UTF-8 | 33,518 | 2.59375 | 3 | [] | no_license | """
Created on Thu Jul 22 11:00:00 2016
@author: Fernando Suarez
"""
import sys
sys.path.insert(0, '../libreria/')
from libreria_fdo import *
def send_mail_report():
'''
Envia el mail a fernando suarez 1313.
'''
print("****ENVIANDO MAIL****")
path_agf = get_self_path() + "output_return_report\\A... | true |
f121ffbea4613f5e1dae57a1205f82b365753969 | basilfx/flask-daapserver | /tests/test_provider.py | UTF-8 | 1,516 | 2.671875 | 3 | [
"MIT"
] | permissive | from daapserver.provider import Provider
from daapserver.models import Server
import unittest
class Latch(object):
"""
Provide a way to test if hooks were fired.
"""
def __init__(self):
"""
Construct a new latch.
"""
self.toggled = False
self.args = None
... | true |
cb48147e54f323bb4406d063b5e94dc5461e52a1 | ii6uu99/ipynb | /python/hard_python/guess/587/guess2.py | UTF-8 | 549 | 3.03125 | 3 | [
"MIT"
] | permissive | from guess2_util import *
next_cyle = True
while(next_cyle):
#玩一轮
answer = generate_answer()
win = False
guess_count = 0
while(not win):
try:
guess = make_guess() #交卷
result = check_guess(answer, guess) #批卷 2A2B
guess_count += 1
win = process_result(guess_count, guess, result) #结果处理
except ValueE... | true |
f231af81306e23c528015402353b4c8b151b16c4 | tabakg/diffusion_maps | /vp_trees_cpp/vp_trees_cpp/python_tests_2.py | UTF-8 | 1,975 | 3.21875 | 3 | [] | no_license | #!/usr/bin/env python
import vp_tree
import time
import numpy as np
from numpy.random import normal
import random
import pprint
pp = pprint.PrettyPrinter(indent=4)
dim = 1
data_size = 1000
mu = 0.0
sigma = 1.0
epsilon = 0.2
NN = 100
print("\n Test for euclidean metric #2. : \n")
print("Data are " + str(data_size)... | true |
762c92b25d74b5540e15321282dcb69783d75daa | lixxj/ivr_assignment | /src/image2.py | UTF-8 | 3,410 | 2.640625 | 3 | [] | no_license | #!/usr/bin/env python
import roslib
import sys
import rospy
import cv2
import numpy as np
from std_msgs.msg import String
from sensor_msgs.msg import Image
from std_msgs.msg import Float64MultiArray, Float64
from cv_bridge import CvBridge, CvBridgeError
class image_converter:
# Returns an array of the x-coordin... | true |
645d300722a809af4b6b5880efd6e8d2c4a51b70 | pavandk7/Samples | /reverse.py | UTF-8 | 99 | 3.40625 | 3 | [] | no_license | def fun(x):
return x[::-1]
mytxt = input("enter a string\n")
text = fun (mytxt)
print(text)
| true |
7bc1883c2dfba7a4d029922f54b4faca164dc808 | davor10105/Bioinformatika-2019 | /readers.py | UTF-8 | 3,875 | 2.96875 | 3 | [] | no_license | from alignment import Utils
class Overlap():
'''
Defines an overlap, basically PAF format overlap in a class.
'''
def __init__(self, args):
self.args = args[:12]
arg_names = [('query_name', str), ('query_length', int), ('query_start', int), ('query_end', int),
('re... | true |
364e39bcc4f80addfc94756b1047f67675f767dd | Aakash310/OpenCv-python | /face_detection_camera.py | UTF-8 | 407 | 2.65625 | 3 | [] | no_license | import cv2
face_cascade = cv2.CascadeClassifier('haarcascade_frontalface_default.xml')
img = cv2.imread('WIN_20191027_21_03_06_Pro.jpg')
img = cv2.resize( img , (512,512))
gray = cv2.cvtColor( img , cv2.COLOR_RGB2GRAY)
faces = face_cascade.detectMultiScale(gray , 1.1 , 4)
for x,y,w,h in faces:
cv2.rect... | true |
5c047739ba753e57b9dbb5e17e9a4cc59d972a48 | iEatTomatoesJack/MentorMateAssignments | /Python Version/MentorMateClass.py | UTF-8 | 2,926 | 3.53125 | 4 | [] | no_license | #used for rounding
import math
class DoubleMLetter:
#setting variables and iterating the lines.
def print_logo(self,width):
self.m_width = width
self.logoStarNum = width
self.logoSideDashNum = width
self.logoUpperDashNum = width
self.logoBottomHalfDashNum = 1
f... | true |
915e924f2c97e46eb3b9260a587d43cf43726b62 | utkarsh04apr/python | /python-coding-W3school/string/1-app.py | UTF-8 | 205 | 3.546875 | 4 | [] | no_license | str = "Hello World!"
print("Whole string",str)
print("Ist letter",str[0])
print("from 3rd to end",str[2:])
print("from 3rd to 5th and total 3 letters",str[2:5])
print("concat",str + "test")
print(str*2)
| true |
d8b32c31aaa151074c9fc4f918c1a3061ddc41a5 | spanktastic2120/fun | /HackerRank/By Contest/Master/Find Digits/solution.py | UTF-8 | 427 | 3.203125 | 3 | [] | no_license | #!/bin/python
import sys
def findDigits(n):
# Complete this function
N = n
count = 0
while n > 0:
d = n % 10
n = n // 10
if not d:
continue
count += 1 if N % d == 0 else 0
return count
if __name__ == "__main__":
t = int(raw_input().strip())
for ... | true |
30a1ac5fd6dfa1b164e008be0c323d7ed10f5fb1 | Rockyzsu/StudyRepo | /python/ac/反转整数.py | UTF-8 | 898 | 3.890625 | 4 | [] | no_license | # coding:utf-8
"""
给定一个 32 位有符号整数,将整数中的数字进行反转。
示例 1:
输入: 123
输出: 321
示例 2:
输入: -123
输出: -321
示例 3:
输入: 120
输出: 21
注意:
假设我们的环境只能存储 32 位有符号整数,其数值范围是 [−231, 231 − 1]。根据这个假设,如果反转后的整数溢出,则返回 0。
"""
class Solution(object):
def reverse(self, x):
"""
:type x: int
:rtype: int
"""
... | true |
aa30465ae861b5c2fc14905364f3064a6bca1bac | Maquiavelosan/Python-cousre | /5 Condiciones/Tarea 5-1.py | UTF-8 | 526 | 3.703125 | 4 | [] | no_license | """ 1 - Crea una lista que contenga algunos nombres de usuarios incluido 'admin', para cada usuario imprime un mensaje de bienvenida:
'Hola {username}, bienvenido'. Unicamente para el usuario admin debe imprimir el mensaje 'Hola admin, quieres visualizar el reporte de uso?' """
usuarios= ["admin", "alfredo", "sergi... | true |
6a18fae10ff3afdf0107301571aae3ccf7f78826 | Ruyuz/python_hw | /python hw2/[ruyuz].p1.py | UTF-8 | 509 | 3.234375 | 3 | [] | no_license | path_1 = input('Please enter file path 1: ')
path_2 = input('Please enter file path 2: ')
fg1 = open(path_1)
fg2 = open(path_2)
list1 = fg1.readlines()
list2 = fg2.readlines()
length1 = len(list1)
length2 = len(list2)
min1 = min(length1, length2)
max1 = max(length1, length2)
list_linenum = []
for i in range(0,min1):
i... | true |
bd68681b1cd15ba67f4375a36d3b1c7a80ccf53d | HAASLEWER/pyramid_sqlalchemy_continuum | /pyramid_sqlalchemy_continuum3/plugin.py | UTF-8 | 2,119 | 2.546875 | 3 | [
"MIT"
] | permissive | # encoding: utf-8
"""
Port of the python package: pyramid-sqlalchemy-continuum
Taken from the contributor, Jordi Fernández <jfernandez@bioiberica.com>.
PyramidPlugin offers way of integrating Pyramid framework with
SQLAlchemy-Continuum. Pyramid-Plugin adds two columns for Transaction model,
namely `user_id` and `remote... | true |
6092531ba6d0aee8ba5bd9316d2471c6373a2430 | Kazjon/SurpriseEval | /clustering/M.py | UTF-8 | 1,562 | 2.6875 | 3 | [] | no_license |
class Measure:
def __init__(self, tree):
self.tree = tree
def delta(self):
if self.tree.children == []:
return {0:[0,1]}
delta_dict = {0:[1,0]}
for c in self.tree.children:
delta_c = c.measure.delta()
for k in delta_c.keys():
delta_dict.setdefault(k+1, [0,0])
delta_dict[k+1][0] += delta_c[... | true |
6f7c4c55367823587ad8afd1845af5bd42c30517 | ovntatar/pycli | /pycli/tests/test_base.py | UTF-8 | 2,017 | 2.515625 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import io
import argparse
from unittest import mock
import unittest
from pycli import CLI
class TestBase(unittest.TestCase):
@mock.patch("sys.stdout", new_callable=io.StringIO)
def test_common(self, mock_stdout):
cli = CLI()
@cli.command
... | true |
54ade3b2d5248fcb94f8a11ad7a771751dc42e6e | Am3ra/CS | /CS600/hw/ps4/ps4.py | UTF-8 | 9,986 | 3.953125 | 4 | [
"Beerware",
"MIT"
] | permissive | # 6.00 Problem Set 4
#
# Caesar Cipher Skeleton
#
import string
import random
WORDLIST_FILENAME = "/Users/macbookpro/Documents/CS/CS600/hw/ps4/words.txt"
# -----------------------------------
# Helper code
# (you don't need to understand this helper code)
def load_words():
"""
Returns a list of valid words. W... | true |
0c5fcaceb2e61edaf11c431a19fdbf45d92561c0 | kmad1729/oneFeed | /oneFeed/models.py | UTF-8 | 445 | 2.9375 | 3 | [] | no_license | import os.path
import csv
competer_list_file = os.path.join(os.path.dirname(__file__), 'competers.csv')
def add_competer_to_file(company):
with open(competer_list_file, "a") as f:
f.write(company)
f.write(',')
def get_competer_list():
reader = csv.reader(open(competer_list_file, "rb")... | true |
2ebabc35fd6b7d575a50584d568591e09081d037 | zahramajd/ECT-distance-clustering | /cluster.py | UTF-8 | 329 | 2.828125 | 3 | [] | no_license |
class Cluster:
def __init__(self, id ,prototype):
self.prototype = prototype
self.members = set()
self.members.add(self.prototype)
self.id = id
def __str__(self):
return 'id: ' + str(self.id) + ', members: ' + str(len(self.members)) + ', prototype: ' + str(self.pr... | true |
527cec406ac05a0930b28a8c205a2843eadbe52b | cksoest/paxos | /message.py | UTF-8 | 548 | 2.875 | 3 | [
"MIT"
] | permissive | class Message:
def __init__(self, tick, src, dst, message_type, propose_id=None, value=None):
self.tick = tick
self.src = src
self.dst = dst
self.message_type = message_type
self.propose_id = propose_id
self.value = value
def send(self, network):
network... | true |
41dc9923832e1adbe3383330a86719f9b82529ea | Svanfridurjulia/FORRITUN-SJS-HR | /Verkefni í tímum/assignment 6 strings/assignment6.3.py | UTF-8 | 298 | 4.4375 | 4 | [] | no_license | a_str = input("Input a string: ")
lower_count = 0
upper_count = 0
for letter in a_str:
if (letter.islower()):
#Check if the letter is lower case
lower_count = lower_count + 1
elif (letter.isupper()):
upper_count = upper_count + 1
print(lower_count, upper_count)
| true |
b63ab4a03112046574ef0d36c79ca58300e23c99 | kedpak/holbertonschool-higher_level_programming | /0x0B-python-input_output/10-class_to_json.py | UTF-8 | 212 | 2.84375 | 3 | [] | no_license | #!/usr/bin/python3
'''module: 10-class_to_json
'''
def class_to_json(obj):
'''return dictionary description with simple data structure
for json serialization of object
'''
return (obj.__dict__)
| true |
ad56ffd914478718be56b2f1ebaa5f2bae3b6e35 | Sanich11/QAP-6 | /PycharmProjects/Mod14/Task14_5_11.py | UTF-8 | 807 | 3.8125 | 4 | [] | no_license | """
реализовать функцию equal(N, S), проверяющую, совпадает ли сумма цифр числа N
с числом S. При написании программы следует обратить внимание на то, что,
если S стала отрицательной, то необходимо сразу вернуть False.
"""
# def sum_num(N):
# if N < 10:
# return N
# return N % 10 + sum_num(N /... | true |
74452a91b31747ef09eff2bc547969dc6520f540 | vinh869163/IOT-SmartHome | /RaspberryPi/mqtt_gateway.py | UTF-8 | 6,158 | 2.546875 | 3 | [] | no_license | import paho.mqtt.client as mqtt
import air_sensor_parser
import threading
class Device:
def __init__(self):
self.subscriptions = {}
def subscribe(self, topic, callback):
self.subscriptions[topic] = callback
def start_listeners(self, client):
... | true |
6130a1afd2bdc6098694e36bf03f8cb361377472 | Skyvaxs/Mod-lisation-d-une-voie-d-autoroute | /Mod_embouteillage.py | UTF-8 | 3,657 | 3.03125 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Jun 4 13:40:59 2019
@author: Abdelmajid
"""
from tkinter import *
from random import *
import matplotlib.pyplot as plt
from time import *
# Paramètres
largeur = 1000
hauteur = 700
n=1
lim_x = int(largeur * 0.90)
x0, y0 = 100, 100
dt = 1
vx = 5
tau ... | true |
9f473db4e5997fab1e199e172b535f0734baed1d | rachel-bot/WASP | /Fig4F.py | UTF-8 | 5,658 | 2.78125 | 3 | [] | no_license | # R. Brunetti, 210331
# Script that compares WASP puncta appearance in WT and Cdc42 KO cells
# Due to limited observations per cell, statistics were applied to replicate means.
# Position of appearance was not significantly different in these cell backgrounds
# via an unpaired two-tailed t-test. Figure here is paper Fi... | true |
b415c44c04a995c0706bb2b0163a1cd31f21ebaf | swifty-sheep/Coding_Interview | /gfg/dp/longest-common-subsequence.py | UTF-8 | 1,374 | 4.21875 | 4 | [] | no_license | """longest common subsequence"""
class LCS:
def __init__(self):
self.lcs = ""
def longest_common_subsequence(self, x: str, y: str, m: int, n: int):
if m == 0 or n == 0:
return 0
elif x[m - 1] == y[n - 1]:
return 1 + self.longest_common_subsequence(x, y, m - 1, ... | true |
47f30d47ad921556918522aa74b5f084ef9199dd | scaniasvolvos/python-basics | /strings-palindrome.py | UTF-8 | 382 | 3.890625 | 4 | [] | no_license | def isPalindrome(s):
#s_rev = s[::-1]
#boolean = bool(s == s[::-1])
if (s == s[::-1]):
return ("YES")
else:
return("NO")
def isPalindrome_2(s):
w = ""
for i in s:
w = i + w
if (s == w):
return "YES"
return "NO"
s = input("Ent... | true |
84e3c543f664f30a7c73f8bd0e0eeb587a41d017 | KainosSoftwareLtd/security-testing-framework | /attackfiles/certificates/certificate_chain_attack.py | UTF-8 | 2,411 | 2.59375 | 3 | [] | no_license | from sslyze.ssl_settings import TlsWrappedProtocolEnum
from sslyze.plugins.certificate_info_plugin import CertificateInfoPlugin, CertificateInfoScanCommand
from sslyze.server_connectivity_tester import ServerConnectivityTester, ServerConnectivityError
from utils.AttackResult import AttackResult
"""
This attack verifi... | true |
c40d15d98ddeab44f662276775df36b65ea8d422 | LucasRizzo/OOSD-2019-2020 | /OOP/Week2/basketball.py | UTF-8 | 731 | 3.125 | 3 | [] | no_license | points_ahead_int = [n for n in range(1,100000)]
seconds_remaining = [n for n in range(1,1000000)]
has_the_ball = ["Yes", "No"]
iterations = 0
for points in points_ahead_int:
for seconds in seconds_remaining:
for ball in has_the_ball:
iterations += 1
lead_calculation_float = float(po... | true |
0cc9e14d7963a32e61d3435879e66b703ca68b27 | AJain2810/CodingWebsites | /gfg/Sudo Placement 2019/Strings/palindrome.py | UTF-8 | 278 | 2.921875 | 3 | [] | no_license | test=int(input())
for i in range(test):
size = int(input())
origi = input()
stri = list(origi)
stri.reverse()
#print(stri)
stri = ''.join(stri)
if stri==origi:
print('YES')
else:
print('NO')
#print(stri)
#print(origi)
| true |
d0525cada2dab8a5773a982caf4690f52113cf27 | hchen13/LeetCode | /CountAndSay.py | UTF-8 | 410 | 3.375 | 3 | [] | no_license | class Solution:
def read(self, seq):
ret = ""
current = seq[0]
cnt = 1
for i in range(1, len(seq)):
if seq[i] == current:
cnt += 1
else:
ret += str(cnt) + str(current)
current = seq[i]
cnt = 1
ret += str(cnt) + str(current)
return ret
def countAndSay(self, n):
if n == 1:
return... | true |
b204de6f719e9b593d3fbbaf8aafa77063f56157 | mushahiroyuki/beginning-python | /Chapter09/0907-list-counter.py | UTF-8 | 1,094 | 3.953125 | 4 | [] | no_license | #@@range_begin(list1) # ←この行は無視してください。本文に引用するためのものです。
#ファイル名 Chapter09/0907-list-counter.py
class CounterList(list):
def __init__(self, *args):
super().__init__(*args)
self.counter = 0
def __getitem__(self, index):
self.counter += 1
#@# return super(CounterList, self).__getitem_... | true |
81b227799c5675ff8b65ef94ab6ad1e057e6ffd7 | s0ap/arpmRes | /scripts/sources/S_CorrNonSynchronousData.py | UTF-8 | 5,724 | 2.515625 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# ---
# jupyter:
# jupytext:
# text_representation:
# extension: .py
# format_name: light
# format_version: '1.4'
# jupytext_version: 1.1.4
# kernelspec:
# display_name: Python 3
# language: python
# name: python3
# ---
# # S_Co... | true |
993ee5480a7ae87e4b03604799d08036f8290615 | diegoasanch/Fundamentos-de-Progra-2019 | /TP6/TP6.10 Ingresa dos listas y genera 3 distintas.py | UTF-8 | 1,611 | 4.625 | 5 | [] | no_license | # Cargar dos listas de números A y B. Se solicita construir e imprimir tres nuevas
# listas C, D y E que contengan:
# · La concatenación de los valores pares de A con los impares de B.*
# · La concatenación de los valores pares de A con el reverso de los valores
# pares de B. ("valores pares" o "valores impares" se ref... | true |
bc665e5a09e990cba6e5d68055a818029407696e | tmjnow/python-for-everybody-2 | /3-web-data/ch11/11_2.py | UTF-8 | 338 | 2.71875 | 3 | [] | no_license | # -------------------------------------
# Python for Informatics
# -------------------------------------
# Course Three
# Using Python to Access Web Data
#
# Assignment 11.2
#
# -------------------------------------
fname = raw_input('Enter file: ')
try:
fhand = open(fname)
except:
print 'File cannot be opened:', f... | true |
21517c61d8ff8956e434b5baac3fa10a563d284c | Shkiperon/Scripts | /Python/combinatorika.py | UTF-8 | 468 | 3.546875 | 4 | [] | no_license | #!/usr/bin/python3
import sys
import os
abc = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
summator = 0
count = 0
iteration = 0
needsum = 20
for a in abc:
for b in abc:
for c in abc:
for d in abc:
for e in abc:
summator = a+b+c+d+e
iteration = iteration+1
if(summator == needsum):
print(iteration)
... | true |
63a0f942b7e898f0ac7a7e5ab8ef295a85ccbb3b | matyasm1995/cviceni | /test_search.py | UTF-8 | 407 | 3.28125 | 3 | [] | no_license | #import pytest
import sys
from binear_search import bin_search
def test_bin_search():
assert bin_search([],0,len([]),4) == False
assert bin_search([1,3,5], 0, len([1,3,5]), 3) == True
def test_beyond_limits():
l = [1,4,6,7]
assert bin_search(l,0,len(l),0) == False
assert bin_search(l, 0, len(l), 2... | true |
125a88a7e029b33412109873c5bde317fc1ec718 | suatakbulut/Visualization | /Climate Change/climateChange.py | UTF-8 | 2,868 | 3.234375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sun May 3 04:56:24 2020
@author: akbul
"""
"""
DATA:
You can access the data set by visiting Kaggles's website':
https://www.kaggle.com/berkeleyearth/climate-change-earth-surface-temperature-data#GlobalLandTemperaturesByCountry.csv
"""
import pandas as pd
import plotly.expres... | true |
49ba00fe48fd8fe5b429226eca0953979ee07cdc | mocatfrio/computational-intelligence | /2019/final-project/script/preparing.py | UTF-8 | 2,525 | 3.734375 | 4 | [] | no_license | """
Preparing
- Normalize data
- Split data as test and train, input and output
"""
from pandas import read_csv, DataFrame
from numpy import reshape, array
from sklearn.preprocessing import MinMaxScaler
from preprocessing import get_metadata, print_data
def prepare(dataset_path):
# get initial data and metadata
... | true |
b9f41f0e93ba08a1bf3c3f8914ada075ad26dc0e | roceys/tools_python | /Python执行JS总结/node_demo.py | UTF-8 | 547 | 2.78125 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/env python
# encoding: utf-8
"""
@version: v1.0
@author: xag
@license: Apache Licence
@contact: xinganguo@gmail.com
@site: http://www.xingag.top
@software: PyCharm
@file: node_demo.py
@time: 2020-07-22 22:19
@description:使用node命令调用js
"""
import os
def func1():
# 组成调用js的命令
cmd = 'nod... | true |
3061e597635dd37cc7f5fc1d2c502a1e426b43ee | tmulherin/ProgPy4 | /03_ScriptExec/writer2.py | UTF-8 | 87 | 2.671875 | 3 | [] | no_license | #!/usr/bin/env python3.3
for myData in (123, 0, 999, 42):
print('%03d' % myData)
| true |
17592b5171d7b373ad8179301a5a903e0afad95f | exdarku/PyreBase-LoginSystem | /login.py | UTF-8 | 1,287 | 2.796875 | 3 | [] | no_license | '''
Script made by exdarku
Follow me on github for more python projects!.
https://github.com/exdarku
MythSecPH
https://mythsecph.xyz/profile/exdarku
'''
import os
import getpass
import pyrebase
config = {
# Your pyrebase config
}
firebase = pyrebase.initialize_app(config)
auth = firebase.auth()
db = firebase.datab... | true |
b668d4f489db56d46d01b5125a2b9099b21be5bb | rasidin/SVNManager | /PathLineEdit.py | UTF-8 | 557 | 2.671875 | 3 | [] | no_license | # PathLineEdit
# brief : Qt util
# date : 2017/12/19
from PySide.QtGui import *
class PathLineEdit(QLineEdit):
def __init__(self):
super(PathLineEdit, self).__init__()
self.setAcceptDrops(True)
def dragEnterEvent(self, event):
mime = event.mimeData()
if mime.hasUrls():
event.accept()
else:
event.i... | true |
ebaaad2163df9e719b336663a76d6a25fad0cd75 | SoyamDarshan/Python_data_structures_and_algorithms- | /Duplicate in a array.py | UTF-8 | 330 | 3.296875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Thu Dec 13 15:05:49 2018
@author: ThinkPad
How do you find the duplicate number on a given integer array?
"""
a = [2, 321, 43, 14, 12, 32, 13, 21, 12]
# SET
# Count
# re-insert in a new array and if element is already present
# sort and compare with next e... | true |
3fdead1d1a423978d9f8945007327287c812fd0b | gomsterX/competitive_programming | /code_chef/ELEVSTRS.py | UTF-8 | 241 | 3.546875 | 4 | [] | no_license | #Problem ID: ELEVSTRS
#Problem Name: From heaven to earth
import math
for _ in range(int(input())):
n, v1, v2 = map(int, input().split())
if(2*n/v2 < math.sqrt(2)*n/v1):
print("Elevator")
else:
print("Stairs")
| true |
eb2e2778a86c96dc2271af2ecddd49147123b337 | codeagram/flask-boiler | /application/__init__.py | UTF-8 | 453 | 2.578125 | 3 | [] | no_license | """ Top level application module """
import os
from flask import Flask
def create_app():
""" Application Factory """
app = Flask( __name__)
environ = app.config["ENV"]
if environ == "development":
app.config.from_object("config.DevelopmentConfig")
elif environ == "testing":
... | true |
006ae48413ee4273a415f1430d8728404f2f1147 | rsmedleystevenson/pyamg | /pyamg/dev/new_pairwise_aggregate.py | UTF-8 | 9,168 | 2.984375 | 3 | [
"MIT"
] | permissive | import amg_core
def pairwise_aggregation(A, B, Bh=None, symmetry='hermitian',
algorithm='drake', matchings=1,
weights=None, improve_candidates=None,
strength=None, **kwargs):
""" Pairwise aggregation of nodes.
Parameters
----------
... | true |
4be78cc37e079ced2c5c7579afbcae3b72c5ef24 | sk3l/ghish | /ghish/api/ghish_http.py | UTF-8 | 4,282 | 2.796875 | 3 | [] | no_license | import logging
from requests import Session
from requests.exceptions import RequestException
LOG = logging.getLogger("ghish")
class HttpResultSet:
def __init__(self):
self._data = []
def append(self, jsonobj):
if isinstance(jsonobj, dict):
self._data.append(jsonobj)
eli... | true |
b977a53d6dc1bf8534b6340a495b0de52d81a8ae | nadvamir/gofish | /gofish_project/charts/optimise/yieldsimulation.py | UTF-8 | 5,886 | 3.125 | 3 | [] | no_license | import gofish.engine.gamedef as gamedef
import gofish.models as models
from math import sqrt
# moving costs
MOV_C = [60, 60, 40, 20, 20]
# a simulator, that calculates average yields
# for every game level
class YieldSimulation(object):
############################################################
# Public API... | true |
1d053ce9dd1e2df7d1f85a3fecf8feb851d0f7f4 | mayweed/6.00x | /6.00.1x/quizz/dotProduct.py | UTF-8 | 415 | 3.984375 | 4 | [] | no_license | #!/usr/bin/python
def dotProduct(listA, listB):
'''
listA: a list of numbers
listB: a list of numbers of the same length as listA
'''
product=0
#lists got same length...(way easier...)
length=len(listA)
while length !=0:
product+=(listA.pop()*listB.pop())
... | true |
2af5fe60aa2ca6e3aac2a3571f67f38cba7c4725 | aquariusrick/PyCheckers | /CheckersGame.py | UTF-8 | 7,518 | 3.28125 | 3 | [] | no_license | import math
from enum import Enum, unique
import GameBoard
class InvalidCheckerMoveException(Exception):
def __init__(self, message):
self.message = message
class CheckerBoardLocation(object):
def __init__(self, col, row):
self.col = col
self.row = row
def __str__(self):
... | true |
b83eed4b9e1d5310c5c0180dbacd9e3167f09bbe | jamiejamiebobamie/pythonPlayground | /tictactoe1.py | UTF-8 | 3,051 | 4.53125 | 5 | [] | no_license | # A Tic-Tac-Toe board is given as a string array board.
# Return True if and only if it is possible to reach this board position during
# the course of a valid tic-tac-toe game.
# The board is a 3 x 3 array, and consists of characters " ", "X", and "O".
# The " " character represents an empty square.
# Here are the r... | true |
2b15686160a49b920ebb603909c060eb752633f2 | agb2k/Scanner-Compiler-Design | /scanner2.py | UTF-8 | 2,449 | 3.75 | 4 | [] | no_license | # Scanner/Lexer built with NLTK library
from nltk.tokenize import word_tokenize
# Allows the user to select the filename they would like to scan
print("Enter Filename: ")
file = input()
# Opens the file selected by the user
f = open(file, "r", encoding='utf-8')
code = f.read()
tokens = word_tokenize(code)
# Deals w... | true |
9ee8e73320465d0561457053d0731b108d488b9f | MihailButnaru/MongoIngestorS3 | /src/serializers/serializer_factory.py | UTF-8 | 775 | 2.65625 | 3 | [
"MIT"
] | permissive | # Copyright | 2019 | All rights reserved
# MIHAIL BUTNARU
from src.serializers.csv_serializer import CSVSerializer
from src.serializers.json_serializer import JSONSerializer
class SerializerFactory:
"""
Serializer Interface, customized behaviour
based on different type object, different format
"""
... | true |
cffa48896523a7bee2256368246a0f3a173879c2 | AmberPark/TIL | /algorithms/swea/algo2/APS응용/start/Start_연습문제2_박소영.py | UTF-8 | 1,394 | 3.046875 | 3 | [] | no_license | lst = input()
bin = []
def Bbit_print(i):
global output
output = ""
for j in range(3, -1, -1): # 앞에 비트가 많을텐데 앞에꺼 다 빼고 4개만 생각한다
output += "1" if i & (1 << j) else "0"
# print(output)
for i in range(len(lst)):
if lst[i].isdigit():
Bbit_print(int(lst[i]))
bin.append(output)
... | true |
8bf83d1ac49a9d13db93ddafa872d85929010f8a | Edox93/ACA | /Homeworks/hw_3_ex_1.py | UTF-8 | 449 | 3.53125 | 4 | [] | no_license | provided_list = ["1", 1, "abc", 123, 124.6, ['123', 1, 45], (1, 2), 3456, 567]
integer_list = list()
for instance in provided_list:
if type(instance) == int:
integer_list.append(instance)
elif type(instance) == list or type(instance) == tuple:
for list_int in instance:
if type(list_i... | true |
e82678abb242f123ed189019bc9814587b579405 | yhs3434/Algorithms | /baekjun/exercise/2020Feb/6186.py | UTF-8 | 944 | 2.78125 | 3 | [] | no_license | # Best Grass
# https://www.acmicpc.net/problem/6186
# https://github.com/yhs3434/Algorithms
from collections import deque
nrcs = [[-1, 0], [0, 1], [1, 0], [0, -1]]
R, C = map(int, input().split(' '))
cnt = 0
board = []
for i in range(R):
board.append(input())
visited = [[False]*C for _ in range(R)]
q = deque()
fo... | true |
1ba78c75240ffae4156efa58a9d1350d216f0af9 | willie-lin/natlas | /natlas-server/app/models/tag.py | UTF-8 | 674 | 2.671875 | 3 | [
"Apache-2.0"
] | permissive | from app import db
from app.models.dict_serializable import DictSerializable
# Simple tags that can be added to scope items for automatic tagging
class Tag(db.Model, DictSerializable):
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(128), index=True, unique=True, nullable=False)
@... | true |
3f3407d3773c27b348848e34aa27d8adc03fa136 | mayanksha/CS251 | /a3/160392_a3/1.py | UTF-8 | 1,891 | 3.109375 | 3 | [] | no_license | #!/usr/bin/env python3
import re
import sys
import string
minus_flag = 0
values = (string.digits + string.ascii_lowercase)
valid_reg = re.compile('^\-{0,1}[0-9a-zA-Z]+(\.{0,1}[0-9a-zA-Z]+)?$')
def base_n(x, base):
if base == "10" :
base = 10
temp = 0
x = x[::-1]
for i in range(len(... | true |
5098c9d47391a39e94379cce2371e56dbc8b97f5 | nickolastheodoulou/simulations | /gravity_solar.py | UTF-8 | 2,562 | 3.0625 | 3 | [
"MIT"
] | permissive | import vpython
e_graph = vpython.gcurve(color=vpython.color.blue)
def gforce(p1, p2):
# Calculate the gravitational force exerted on p1 by p2.
G = 1 # Change to 6.67e-11 to use real-world values.
# Calculate distance vector between p1 and p2.
r_vec = p1.pos - p2.pos
# Calculate magnitude of dist... | true |
4551d7f048c6dad4a1659e5d93f0f512512ab11c | irzaip/iqro_tools | /recording.py | UTF-8 | 7,619 | 2.78125 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
"""Class Suara"""
import argparse
import logging
import numpy as np
import time
import soundfile as sf
import itertools
import sounddevice as sd
class Suara:
"""Class untuk merekam suara, dan manipulasi sewaktu capture.
PARAMETERS:
block_length : panjang block yang... | true |
6c390b12f6b24c3c60272011e73071885387c1c9 | Mirakklian/Research-Paper1 | /Polarity.py | UTF-8 | 1,954 | 2.90625 | 3 | [] | no_license | import pandas as pd
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
from textblob import TextBlob
import nltk
import csv
with open('C:\\Users\\Pratik Dutta\\Desktop\\SET-IMPLEMENTATION\\test.csv', 'r') as csvFile:
reader = csv.reader(csvFile)
for row in reader:
... | true |
524c23c2984219db1d5773fe2b69a97d13cad758 | mtejedorg/JdeRobot-TeachingRobotics | /src/global_navigation/A_Pathfinding.py | UTF-8 | 2,925 | 3.453125 | 3 | [
"CC-BY-4.0"
] | permissive | # Author: Christian Careaga (christian.careaga7@gmail.com)
# http://code.activestate.com/recipes/578919-python-a-pathfinding-with-binary-heap/
# A* Pathfinding in Python (2.7)
# Please give credit if used
#
# Code modified by Marco Tejedor (https://github.com/mtejedorg)
import numpy
from heapq import *
#Manhattan
def... | true |
c73dd298671e957857fdc7f5be78449e36763d97 | famasoon/kyopro | /atcoder/abc059/a/main.py | UTF-8 | 90 | 2.9375 | 3 | [] | no_license | s1, s2, s3 = map(lambda word: word.upper(), input().split())
print(s1[0] + s2[0] + s3[0])
| true |
8e0cddff97231ef370cc54d5464f9a494c75f9cc | Sathvikroy/development-testing | /calculator.py | UTF-8 | 4,311 | 2.96875 | 3 | [
"Apache-2.0"
] | permissive | from tkinter import *
def btn(numbers):
global operator
operator = operator + str(numbers)
txt_input.set(operator)
def Clear():
global operator
operator=''
txt_input.set('')
Display.insert(0,'Start Calculating...')
#def Equal():
# global operator
# sumu = float(eval(o... | true |
83a7c53984fbd18b7e4ce5c50dcf8b921f57dcc6 | jessekearns/advent-of-code-2017 | /10/10a.py | UTF-8 | 642 | 3.09375 | 3 | [] | no_license | inputfile = "C:\\Users\\jkearns\\Documents\\GitHub\\advent-of-code-2017\\10\\input10.txt"
with open(inputfile) as f:
lines = f.readlines()
inputs = lines[0].split(',')
list = list(range(0, 256))
pos = 0
skip = 0
for input in inputs:
length = int(input)
for i in range(0, int((length)/2)):
index = (i... | true |
0cca19a509dd97443735add67ee49624b1345587 | pomfy113/mal-char-data-get | /season-get.py | UTF-8 | 2,038 | 3.515625 | 4 | [] | no_license | import urllib.request
import json
import os
import re
from html import unescape
def CSV_write(data, year, season):
target = open('./output-season/{}-{}.csv'.format(year, season), 'w')
for anime in data['season']:
title = unescape(anime['title'])
broadcast = anime['airing_start']
eps =... | true |
e429cbe6562cb3382a0065d6186b71bdb25ec6bc | rishavsharma47/ENC2020P1 | /Session5C.py | UTF-8 | 632 | 3.25 | 3 | [] | no_license | totalFloors = 10
myFloor = 5
liftPosition = 1
for floor in range(liftPosition, totalFloors+1):
print(">> Floor #", floor)
if floor == myFloor:
print(">> Your Floor Arrived")
break
# products = (1541, 2451, 1353, 4673, 5245, 2356, 6777, 8234, 9231, 1331)
products = [1541, 2451, 1353, 4673, 524... | true |
3b0761a6d612bc898fd451258885973dbdba8234 | leonshting/data_mining_in_action_2017 | /industry/hw3/checkers/svm_impl_shtanko.py | UTF-8 | 3,678 | 3.03125 | 3 | [] | no_license | import numpy as np
from sklearn.base import BaseEstimator
SVM_PARAMS_DICT = {
'C': 100,
'random_state': 42,
'iters': 1000,
'batch_size': 10,
}
import numpy as np
from random import randint
import random
np.random.seed(42)
random.seed(42)
class MySVM(object):
def __init__(self, C=10000, batch... | true |
c30f6aea6a132abdad71d18a08059dc8aaa27746 | AntonioEstela/output-like-a-hacker.exe | /main.py | UTF-8 | 2,227 | 3.453125 | 3 | [] | no_license | #!/usr/bin/python3
from datetime import datetime
import os
from shutil import rmtree
from sys import stdout
import time
def printWithDelay(string):
"""Prints a string with a small amounnt of delay between each character"""
for let in string:
""""""
stdout.write(let)
stdout.flush()
... | true |
422e5256ebf3fc368d8317617ac2df40bc8a63ca | PacktPublishing/Python-Data-Analytics-and-Visualization | /Module 3/Chapter2/mortality1.py | UTF-8 | 722 | 3.109375 | 3 | [] | no_license | import csv
import matplotlib.pyplot as plt
fig = plt.figure(figsize=(15,13))
plt.ylim(740,1128)
plt.xlim(1965,2011)
with open('/Users/MacBook/Downloads/Book_Code/Chapter2/mortality1.csv') as csvfile:
mortdata = [row for row in csv.DictReader(csvfile)]
x=[]
males_y=[]
females_y=[]
every_y=[]
yrval=1968
for row in... | true |
a5790d4f5aa9836fef51b6113b430033afca3455 | qorjiwon/LevelUp-Algorithm | /InflearnLecture/15_소수의갯수.py | UTF-8 | 481 | 3.34375 | 3 | [] | no_license | '''
@ 15. 소수의 갯수(1초)
@ Idea. 소수 이론
1 * 36 = 36
2 * 18
3 * 12
4 * 9
6 * 6
@ TestCase:
input 20
output 8
@ Start day: 19. 10. 07
@ End day: 19. 10. 07
'''
N = int(input(""))
cnt = 0
for i in range(2, N+1): # 2 ~ N
flag = 1
j = 2
... | true |
06147ca9d2d0bfcd8c1f177c86c36fc798fdef60 | flamearrow/229Project | /train/dataGeneration/fakeDataGenerator.py | UTF-8 | 150 | 2.609375 | 3 | [] | no_license | for i in range(22, 24):
for f in "PMF":
for index in range(1, 101):
open(f + "_S0_M" + str(i) + "_" + str(index) + ".jpg", 'w').close()
| true |
945f4cbc1af17624f8035d9b1cf945e6f9745a74 | JoannaWojtukiewicz/area-and-volume-calculations | /area_and_volume_calculations.py | UTF-8 | 3,561 | 4.4375 | 4 | [] | no_license |
# Program for calculating surface areas and volumes of selected figures
from area_and_volume_formulas import Triangle, Square, Rectangle, Cube, RegularPyramid, Oval
def float_type(value):
''' Function created to ensure the right type of variable'''
while type(value) is not float:
try:
re... | true |
cf0ca67e67f137b1dd1e7fa383b8d4a5a739f0eb | alvin-the-programmer/foobar-2 | /the-grandest-staircase-of-them-all/solution.py | UTF-8 | 901 | 3.5 | 4 | [] | no_license | def solution(n):
memo = {}
def unique_staircases(num_bricks, stairs, previous_height = None):
key = (num_bricks, previous_height)
if key in memo:
return memo[key]
if num_bricks < 0:
return 0
if num_bricks == 0 and len(stairs) >= 2:
return 1... | true |
e267acf80fd3eb0d02692554261802c50d9eea08 | SemmiDev/Python-Basic | /OOP/AbstractClass.py | UTF-8 | 525 | 3.828125 | 4 | [] | no_license | from abc import ABCMeta, abstractmethod
class BangunDatar(metaclass=ABCMeta):
@abstractmethod
def luas(self):
"return luas bangun datar"
# concrete method
def __str__(self):
return "luas => " + str(self.luas())
class Segitiga(BangunDatar):
def __init__(self, alas, tinggi):
... | true |
4d629b50a9d20a2f2a34e7c2095926e209ede4cf | kai1996/Simple-Implementation-of-Connect4-and-Hangman | /Play Hangman.py | UTF-8 | 8,600 | 4.125 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
@author: kpandey
"""
import random
#s=read_words('cs_words.txt')
ALPHABET='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
def read_words(filename):
result = []
with open(filename, 'r') as f:
for line in f:
splitLine = line.split('%')
print(s... | true |
a0f84ba7ce811a2b937f6179845a1fb0ed61ac40 | carlosjtacon/maketx_batch_tool_win | /maketx_tool.py | UTF-8 | 1,828 | 2.609375 | 3 | [] | no_license | import os, sys, json, re
FILE_TYPES = [".tif", ".exr", ".png"]
IGNORE_FILE_TYPES = [".tx", ".json"]
MAKETX_PATH = "PATH TO maketx.exe"
CMD_FLAGS = "-v -u --oiio --checknan --filter lanczos3"
# @@ https://stackoverflow.com/questions/287871/print-in-terminal-with-colors
class bcolors:
HEADER = '\033[95m'
... | true |
3b89f6ed65e56c31d06f69c252e35aab7ad14333 | mdolab/pygeo | /examples/cst/CSTTutorial.py | UTF-8 | 2,666 | 2.625 | 3 | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | # Standard Python modules
import os
# External modules
import matplotlib.pyplot as plt
import numpy as np
# First party modules
from pygeo import DVGeometryCST
# rst Plot func (beg)
def plot_points(points, filename=None):
fig, ax = plt.subplots(figsize=[10, 3])
ax.plot(points[:, 0], points[:, 1], "-o")
... | true |
b2c4b3ac8096f07608b01af1cade80e22e3f00df | DanielNugent/LCA | /python/LCA_test.py | UTF-8 | 508 | 3.109375 | 3 | [] | no_license | import pytest
import LowestCommonAncestor
Node = LowestCommonAncestor.Node
LCA = LowestCommonAncestor.LCA
root = Node(1)
r2 = Node(2)
r3 = Node(3)
r4 = Node(4)
r5 = Node(5)
root.successor = [r2,r3]
r2.successor = [r4]
r2.predecessor = [root]
r3.successor = [r4]
r3.predecessor = [root]
r4.successor = [r5]
r4.predecess... | true |
342a00464e3127e881fdd3e181fbee3fd898a808 | PentiumLuls/Python-university-labs | /not sorted/6.2.py | UTF-8 | 411 | 3.171875 | 3 | [] | no_license | import math
import random
def generateArray(x, y):
return [[random.Randomrange(-10, 11) for i in range(y)] for j in range(x)]
def print_matrix(items):
for line in items:
print(*line)
def check_symmetric(a, tol=1e-8):
return('Matrix is not Symmetric ~~desu')
#return not False in (np.abs(a-a.T... | true |
d1e36e8039863f9d1f2b7de32f8f6b587cddc7a0 | villejacob/flashcards | /PlaySound.py | UTF-8 | 856 | 2.890625 | 3 | [] | no_license | import sys
from PyQt5.QtCore import *
from PyQt5.QtWidgets import *
from PyQt5.QtMultimedia import *
from pathlib import Path #for checking file exist
class PlaySound(QWidget):
# wav is the file path
def __init__(self, wav):
super().__init__()
#check if file exist
my_fi... | true |
bdcf67969879474c9c58e0b126f59e04cd1b60f5 | ipwnosx/hatebin | /thirdparty/pygments/external/moin-parser.py | UTF-8 | 3,600 | 2.6875 | 3 | [
"MIT",
"BSD-2-Clause"
] | permissive | # -*- coding: utf-8 -*-
"""
The Pygments MoinMoin Parser
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This is a MoinMoin parser plugin that renders source code to HTML via
Pygments; you need Pygments 0.7 or newer for this parser to work.
To use it, set the options below to match your setup and put this file in
... | true |