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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
a4777882b2aed0064a783b9f3c023af9a53a61af | Python | tuta98it/ProjectEncryption | /encryption_caesar.py | UTF-8 | 2,474 | 4.53125 | 5 | [] | no_license |
arrAlphabet = ['А', 'Б', 'В', 'Г', 'Д', 'Е', 'Ж', 'З', 'И', 'Й', 'К', 'Л', 'М', 'Н', 'О', 'П', 'Р', 'С', 'Т', 'У', 'Ф',
'Х', 'Ц', 'Ч', 'Ш', 'Щ', 'Ъ', 'Ы', 'Ь', 'Э', 'Ю', 'Я']
# Số phần tử trong chuỗi arrAlphabet - (Количество элементов в массиве)
lengAlphabet = len(arrAlphabet)
# Xuất các ký tự trong... | true |
8be725179e43900b3d84ca057377118b0bfecf2d | Python | s3mh4ck/write-ups | /CRYPTO/Łukasz Dzwoniarek/xor/prog.py | UTF-8 | 1,615 | 2.71875 | 3 | [] | no_license | #!/usr/bin/python
import struct
import string
print "Hello World!"
fileName="xor_4904470ca4a0fb1b43e43dc67dbaf8dd"
with open(fileName, mode='rb') as file: # b is important -> binary
fileContent = file.read()
print len(fileContent)
# data = struct.unpack("I" * (len(fileContent) // 4), fileContent[0:-3])
... | true |
42bb5ced0c19c3e0e22590fc5b921d9ec96ef75d | Python | skylerknecht/beagle | /beagle/color.py | UTF-8 | 743 | 2.78125 | 3 | [] | no_license | from beagle import stomach
COLORS={
'cyan':'\001\033[0;36m\002',
'green':'\001\033[0;32m\002',
'red':'\001\033[0;31m\002',
'reset':'\001\033[0;0m\002',
'yellow':'\001\033[0;33m\002',
'purple':'\001\033[0;35m\002'
}
def success(message):
message_color = COLORS['green']
reset = COLORS['r... | true |
c1deaf1dfc106000319e26c3aacfc473e9863fa4 | Python | liviode/my_python | /cards-tests.py | UTF-8 | 673 | 3.421875 | 3 | [] | no_license | # Shuffle Cards for player Spieler A and B
import cards
# Array
a = [[1, 2, 3], [4, 5, 6]]
# print(a[0])
# print(a[1])
# print(cards.random_card_set())
#
# new_game = cards.Two_Player_Stich_Jass(100, 666)
# new_game.dump()
print('expected: 1, got:', cards.winner_card(0, 3, 1))
tests = [
[0, 3, 1, 1],
[3,... | true |
6bd9976fec1893e4183c14f25de50d41d090a0a7 | Python | Imtinmin/CTF_Challenge | /pcb2018/crypto/decrypt.py | UTF-8 | 2,058 | 2.96875 | 3 | [] | no_license | #!usr/bin/python
#_*_ coding=UTF-8 _*_
from Crypto.Cipher import AES
from binascii import b2a_hex, a2b_hex
from Crypto import Random
import sys
class aesdemo:
#aes = AES.new(key,mode)
def __init__(self,key):
self.key = key
#self.BS=BS
def pad(self,msg):
#BS = AES.block_size
... | true |
b1d2125f44726a6bf13a7711e9b8e27ba9c88c92 | Python | pjok1122/baekjoon-online-judge-practice | /DP/add 1,2,3(9095).py | UTF-8 | 629 | 3.578125 | 4 | [] | no_license | '''
dp[n] := n을 1,2,3의 합으로 표현하는 방법의 수
n을 1,2,3의 합으로 표현하는 방법은
1) n-1을 표현하고 + 1을 붙여주는 경우
2) n-2를 표현하고 + 2을 붙여주는 경우
3) n-3을 표현하고 + 3을 붙여주는 경우
이렇게 세가지로 나뉜다
따라서
dp[n] = dp[n-1] + dp[n-2] + dp[n-3] (dp[1]=1, dp[2] =2, dp[3]=4) 로 나타낸다.
'''
dp = [0]*12
dp[1] = 1
dp[2] = 2
dp[3] = 4
def func(n):
if dp[n]:
return ... | true |
d943d457a3b74ff54940a9f43f6bd3d7f6bda032 | Python | shikixyx/AtCoder | /CodeChef/April Challenge/5_1.py | UTF-8 | 702 | 2.609375 | 3 | [] | no_license | import operator
from functools import reduce
import math
import sys
sys.setrecursionlimit(10 ** 7)
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
T = int(readline())
def prod(iterable):
return reduce(operator.mul, iterable, 1)
def solve():
DEBUG = ... | true |
a322f17c3ca69c2be2174f099b44862936105cb3 | Python | padfoot231/ML-nanodregree-capstone | /data_analysis.py | UTF-8 | 1,907 | 3 | 3 | [] | no_license | from scipy import ndimage, misc
def process_data(folder):
print folder
count_line = 0
digit_count = {}
total_image_width = 0
total_image_height = 0
totl_digit_width = 0
total_digit_height = 0
class_count = [0]*11
with open("%s/%s.txt"%(folder, folder), 'r') as f:
for line in f:
count_lin... | true |
79f164cdfddd759b9acf310c8ec7d0b70deefbf9 | Python | JMSEhsan/Python_Exercises | /PracticePython/P4_FltStrg.py | UTF-8 | 432 | 4.1875 | 4 | [] | no_license | # Multiplication using integer and string
input = input('Enter a number or characters to multiply by 6: ')
mltpl = input * 6
try:
float(input)
mltplNo = float(input) * 6
except ValueError:
print(input+' is not a number')
mltplNo = False
print('The answer in the form of string is:', mltpl)
if (bool(ml... | true |
202590b08d398196e1ee614e49b017f9943dc08c | Python | carltonbanks811/Coding-Challenge | /controller.py | UTF-8 | 10,167 | 3.390625 | 3 | [] | no_license | from random import randint
from player import Player
"""
This is where the meat of the gameplay takes place. Returns, spins, and games played.
"""
class Controller(object):
def __init__(self,game):
self.game = game
self.total_game_num = self.total_games_calc(game)
def add_up_total(self,curre... | true |
16c771cdd62c603e6f9a74cd6af0b1bc53b0ebfe | Python | kevinhu98/advent2020 | /day22/day22.py | UTF-8 | 1,266 | 3.65625 | 4 | [] | no_license | player1Hand = []
player2Hand = []
p1Hand = True # while P1 hand true, add cards to p1 hand else add to p2 hand
with open("day22.txt") as file:
next(file)
for line in file:
if line != "\n":
if p1Hand:
player1Hand.append(int(line))
else:
player2Han... | true |
e26542f0ee24e27500f1c1cce3eb79c2e9f2f0c2 | Python | PayamDiba/CycleGAN | /ResidualBlock.py | UTF-8 | 1,145 | 2.875 | 3 | [] | no_license | """
@author: Payam Dibaeinia
"""
import torch
import torch.nn as nn
from collections import OrderedDict
class ResNetBlock(nn.Module):
"""
According to the cycleGAN paper, reflection padding and instance normalization was used
Arbitrary selections of hyper_parameters:
- Use bias in both convolutional... | true |
dcb159a19417374617843aad618f5f694d4f4791 | Python | hveram3/Clases | /Ejer6.py | UTF-8 | 401 | 3.21875 | 3 | [] | no_license | #Numericos
edad,_peso = 50, 70.5
#String
nombres ='Heidy vera'
dirDomiciliaria= 'Sur de guayaquil'
Tipo_Sexo = 'M'
#Boolean
civil = True
#Colecciones
usuario = ('dchicki','chiki@gmail.com')
materias = ['Programacion Web','PHP','POO']
docente ={'nombre':'Heidy','edad':50,'fac':'faci'}
#Imprimir
prin... | true |
3ae03868d8964fd3c3f71eb824bb8902f87ef6ae | Python | dhimanmonika/PythonCode | /Generators/Square.py | UTF-8 | 444 | 4.21875 | 4 | [] | no_license | """generator to generate square of nmbers in list"""
#==============================generator as function======================================
"""def square(nums):
for i in nums:
yield (i*i)
for x in square([1,2,3,4,5,6]):
print(x)
"""
#====================================... | true |
1397ce91398ce536a24b7c1b320947007ce20bcb | Python | mendezona/HarvardX-CS50-2020-Introduction-to-Computer-Science | /Week 6/dna/dna.py | UTF-8 | 3,949 | 3.796875 | 4 | [] | no_license | import csv
import sys
# check that usage is correct
if (len(sys.argv) != 3):
print('Usage: python dna.py data.csv sequence.txt')
else:
# open database file
databaseFile = open(sys.argv[1], 'r')
# put csv file into reader and record header row as array
reader = csv.reader(databaseFile)
header... | true |
364021085826d2c6acc1f03c2fd3275180add1e0 | Python | giameier/DMS_ABC | /mate_generator.py | UTF-8 | 931 | 2.640625 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Feb 19 07:26:41 2019
@author: gmeier
mate generator
"""
from collections import defaultdict
import pysam
def read_pair_generator(bam, start, end):
"""
Find reads, store them in dict and return them once a pair is found.
"""
read_dic... | true |
20830efea98fddad0e248d384aa28d917b7d5da0 | Python | dgnssena/Python-Project | /main.py | UTF-8 | 1,136 | 3.859375 | 4 | [] | no_license |
n = int(input("please enter n number "))
m = int(input("please enter n number "))
n1, n2 = 0, 1
counter = 0
factorial = 1
#nterms=0
# ackermann
def A(m, n, s="% s"):
print(s % ("A(% d, % d)" % (m, n)))
if m == 0:
return n + 1
if n == 0:
return A(m - 1, 1, s)
n3 = A(m, n - 1, s % ("A(... | true |
c74e281e5b0e5fb021cd5c27818b3d4042db2c91 | Python | mgxd/nitransforms | /nitransforms/nonlinear.py | UTF-8 | 9,380 | 2.625 | 3 | [
"MIT"
] | permissive | # emacs: -*- mode: python-mode; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ##
#
# See COPYING file distributed along with the NiBabel package for the
# copyright and license terms.
#
### ### ### #... | true |
785433c4549822b59649ba0a4123a36d07448e29 | Python | leviettung01/CongNgheWeb | /backend/actions/user_action.py | UTF-8 | 1,218 | 2.671875 | 3 | [] | no_license | import sqlite3
from hashlib import md5
from ..models import user_model
class UserAction:
def __init__(self,db_connection):
self.db_connection = db_connection
def login(self,user: user_model.User):
conn = sqlite3.connect(self.db_connection)
cursor = conn.cursor()
sql = """
... | true |
2d77dc07c02a951d0668f42a26cbbf3fe2a65bdf | Python | RooTender/PythonExercises | /Tutorials/4.1 Lists advanced.py | UTF-8 | 361 | 4.1875 | 4 | [] | no_license | myArray = [1, 2, 3, 4, 5]
# searching using index
print(myArray.index(3))
# adding to array
myArray.append(6)
print(myArray)
myArray.insert(2, 3)
print(myArray)
myArray.remove(3) # removes once!
print(myArray)
myArray.sort(reverse=True)
print(myArray)
lettersArray = ['a', 'z', 'A', 'Z']
# advanced
lettersArray... | true |
609b84cec3aecbd002bcb6b3ae51613f1c7e6fff | Python | hodurie/Algorithm | /programmers/level1/문자열 다루기 기본.py | UTF-8 | 191 | 2.75 | 3 | [] | no_license | import re
def solution(s):
if len(s) == 4 or len(s) == 6:
if len(re.findall(re.compile('[0-9]'), s)) != len(s):
return False
return True
return False | true |
1f3c5efc804a02217ab6650bc7e476b99c5e603b | Python | cloudoudodo/python-da | /insert-sort.py | UTF-8 | 916 | 4.03125 | 4 | [] | no_license | def insert_sort(alist):
n = len(alist)
for j in range(1, n):
i = j
while i > 0:
if alist[i] < alist[i - 1]: # 交换两个数的位置
alist[i], alist[i - 1] = alist[i - 1], alist[i]
else:
break
i -= 1
return alist
alist = [3, 6, 8,... | true |
180686c20b5660c639820e6f07ab24c1f73e6da5 | Python | vincent-octo/sutils | /sutils/tests/test_bench.py | UTF-8 | 490 | 3.46875 | 3 | [
"MIT"
] | permissive | from sutils import bench
import pytest
class TestBenchDecorator(object):
def test_return_type(self):
@bench
def func_return_int():
return 123
res = func_return_int()
assert isinstance(res, tuple) # @bench should return a tuple of 2 elements
assert len(res) ==... | true |
9a8b76894a850151e263209bdfcd2427ae872dfa | Python | ozkrbr/BAR-digitization | /renameMETS.py | UTF-8 | 435 | 2.578125 | 3 | [] | no_license | import os
source_path = 'G:\\Dropbox (GLBTHS)\\Archive\\BAR'
def rename_mets():
mets_list = []
for root, dirs, files in os.walk(source_path):
for file in files:
if '.xml' in file and len(file) == 16:
filepath = os.path.join(root,file)
new_name = filepath.replace('.xml','_mets.xml')
try:
os.... | true |
b7004e247b30ed3462b18802de8d2e3e0414a679 | Python | Lanayaghi/pythonstack | /flask/flask_fundemantels/routing/Routing.py | UTF-8 | 322 | 3.21875 | 3 | [] | no_license | from flask import Flask
app = Flask(__name__)
@app.route('/')
def hello():
return 'Dojo'
@app.route('/say/<name>')
def say(name):
print(name)
return f"Hi {name}!"
@app.route('/repeat/<num>/<name>')
def repeat(num,name):
return f"{name} " * int(num)
if __name__ =='__main__':
app.run(debug=Tru... | true |
43f19704cf07a16e04a954c4ff2524ae099679e8 | Python | SudhanshuBhatt/Peer_To_Peer_Network | /Server/MainServer.py | UTF-8 | 3,112 | 3.015625 | 3 | [] | no_license | __author__ = 'Sudhanshu'
import thread
import socket
from Database import Peers_List
from Database import Peer_Node
from Database import RFC_List
from Database import RFC_Node
from Database import Peer_RFC_Dictionary
class MainServer:
serverPortNumber = 0
peersList = Peers_List.Peers_List()
rfcList = RFC_... | true |
c02c040436ab687a81b93fd5aca6a39d17c0095d | Python | JaakTepandi/TDDexample | /cpc.py | UTF-8 | 1,156 | 3.4375 | 3 | [] | no_license | class dc:
def __init__(self, name):
self.name = name
def get_filename(self):
return self.name+".csv"
def raw_file(self):
import pandas as pd
return pd.read_csv(self.get_filename())
def file_w_headers(self):
f=self.raw_file()
f.columns = ['... | true |
6ffa62a42cf82dd5432fa8cda5e7270bcdad0372 | Python | BluOyster29/lt2003-natural-language-processing | /lt2003-nlp-a3/Lab_3RobertThomas.py | UTF-8 | 5,524 | 2.921875 | 3 | [] | no_license | #! /usr/bin/env python3
import time
def ConllUReader(treebankfile):
sentence = {}
for line in treebankfile:
if line.startswith("#"):
continue
# parse sentence end
elif line.isspace():
if sentence != {}:
yield sentence
sentence = {}
else:
data = line.split("\t")
if '-' in... | true |
22aa3dff463d1b3085c5a3714b3654581b0f7b81 | Python | projeto-de-algoritmos/DC_Academia-de-Hanoi | /src/utils.py | UTF-8 | 2,082 | 3 | 3 | [] | no_license | import pyxel
SCREEN_WIDTH = 256
SCREEN_HEIGHT = 256
DISC_HEIGHT = 7
TOWER_HEIGHT = 70
SOLVE_SPEED = 35
COLOR_LIST = [2, 5, 12, 3, 10, 9, 8,]
class Vec:
# Classe para posição
def __init__(self, x, y):
self.x = x
self.y = y
def pick_color(id):
return COLOR_LIST[id%len(COLOR_LIST)]
def al... | true |
43a822ff02de2f0cd8f7a31354882e4dc339fbb6 | Python | Zleet/rich_pick_kings_new_resulting_pipeline_in_python3 | /03 - parse entries from admin webpage - FINISHED/parse_entries_from_admin_webpage.py | UTF-8 | 6,110 | 3.25 | 3 | [] | no_license | # ==============================================================================
# Parse entries from admin webpage.
# 1. Read all the entries for Rich Pick Kings that have been copied from the
# admin webpage and pasted into local file 'entries_from_admin_webpage.txt'
# 2. Build a csv file named 'all_entries.cs... | true |
f357417574707d8e1936e05f4cc786f3af0d7ebe | Python | sunidhi2001/algorithms-python-hacktoberfest-accepted | /dp/kadaneAlgorithm.py | UTF-8 | 561 | 3.75 | 4 | [
"MIT"
] | permissive | import sys
def maxSubArraySum(a,size):
max_so_far = -sys.maxsize - 1
max_ending_here = 0
for i in range(0, size):
max_ending_here = max_ending_here + a[i]
if (max_so_far < max_ending_here):
max_so_far = max_ending_here
if max_ending_here < 0:
max_ending_here ... | true |
0506a5a49b226bd56842b00a8357578e09129f66 | Python | smallbaby/python-check-challenge | /binary_search.py | UTF-8 | 890 | 3.703125 | 4 | [] | no_license | # -*- coding:utf8 -*-
def binary_search(li, key, low, high):
if low == high or key < li[0] or key > li[-1]:
return None
# 1 2 3 mid = 1
mid = (low + high) / 2
if li[mid] > key:
high = mid
return binary_search(li, key, low, high)
elif li[mid] < key:
low = mid
... | true |
3fea5d24faf0f6ca4fcfd0873e26e1f6a87f5f29 | Python | huynhtritaiml2/Python_Basic_Summary | /numpy/num5_multip_dim_array.py | UTF-8 | 3,950 | 3.734375 | 4 | [] | no_license | # Multi-Dimentsional Arrays
# Image: READ IT
# https://www.google.com/search?q=visualizing+multidimensional+array&client=ubuntu&hs=Sqg&sxsrf=ALeKk02toeLHpZCojxdrR2Nhw_IMdK9vjQ:1614823068568&source=lnms&tbm=isch&sa=X&ved=2ahUKEwjByoHbxJXvAhVF7WEKHbf1D0AQ_AUoAXoECAMQAw&biw=1097&bih=530#imgrc=IeU5JN9Yz9QJTM
import numpy a... | true |
aa58d9a90d0372855e114087477b88523df8d71b | Python | victorrodrigues20/PDI_2sem2017 | /Python/005-Operações_com_Imagens/02_Exercicio_Operacoes_Aritmeticas.py | UTF-8 | 559 | 3.40625 | 3 | [] | no_license | # Exercício: Combinar duas imagens diferentes existentes na pasta de imagens
import cv2
import numpy as np
imageA = cv2.imread('../../imagens/gato.jpg')
imageB = cv2.imread('../../imagens/tigre.jpg')
# Deixar o tamanho da imagem B igual ao da A
height, width, _ = imageA.shape
imageB_resize = cv2.resize(imageB, (widt... | true |
e3ab52c941aed3cdcd4e2420747a22f46a0ce7dc | Python | cvoter/python-usgs-training | /theis.py | UTF-8 | 1,685 | 3.515625 | 4 | [
"LicenseRef-scancode-warranty-disclaimer"
] | no_license | import numpy as np
import matplotlib.pyplot as plt
from scipy.special import exp1 as W
def set_time(t):
if isinstance(t, (int, float, np.int, np.float)):
t = np.array([t], dtype=np.float)
elif isinstance(t, (list, tuple)):
t = np.array(t, dtype=np.float)
elif isinstance(t, (str)):
... | true |
176222972eb2baa97309b6401d95e774a77e270a | Python | BrookeKelly-coder/she_codes_python_ | /Python/dictionaries_playground.py | UTF-8 | 1,628 | 4.09375 | 4 | [] | no_license | groceries = {
"Baby Spinach": 2.78,
"Hot Chocolate": 3.70,
"Crackers": 2.10,
"Bacon": 9.00,
"Carrots": 0.56,
"Oranges": 3.08
}
# print(groceries)
#look at a specific value
# print(groceries["Baby Spinach"])
#Add an item
groceries["Avacado"] = 1.00
# print(groceries)
#Remove an item
del groce... | true |
0f08bd485e236344bf62bc782f1c9d993c0f65e4 | Python | Titan-Spy/Input-checker | /popup2.py | UTF-8 | 1,131 | 3.765625 | 4 | [] | no_license | #Program to check whether the input of user is correct or not, if not then give error message with pop-up menu(GUI)
#Program written by Shubham Rachha aka Titan Spy
def error(): #fuction to show error message
import tkinter
from tkinter import messagebox
root=tkinter.Tk()
root.wi... | true |
e29553ce410ed8e6ec787d775bf07f837d76e903 | Python | maha98/python | /fact12.py | UTF-8 | 64 | 3.375 | 3 | [] | no_license | n=int(input())
f1=1
while(n>0):
f1=f1*n
n=n-1
print(f1)
| true |
2aabe44afa6603856bc3233fef252be8299bc720 | Python | NemoIII/DataScienceProjectTutorial | /DataProcessing/DataWrangling.py | UTF-8 | 1,367 | 3 | 3 | [] | no_license | # import TODO as TODO
import pandas as pd
'''Merging Data'''
left = pd.DataFrame({
'id': [1, 2, 3, 4, 5],
'Name': ['Alex', 'Amy', 'Allen', 'Alice', 'Ayoung'],
'sebject_id': ['sub1','sub2','sub4','sub6','sub5']
})
right = pd.DataFrame(
{'id':[1,2,3,4,5],
'Name': ['Billy', 'Brian', 'Bran', ... | true |
37450192e97990a911d72bd6f9f8ab43c23a9e0b | Python | minrk/ipython-svn-archive | /ipython1/branches/ipython1-data-r3016/sandbox/snakeoil/snakeoil/oilparam.py | UTF-8 | 10,705 | 3.359375 | 3 | [] | no_license | """Support for parametric tests in unittest.
Purpose
=======
Briefly, the main class in this module allows you to easily and cleanly
(without the gross name-mangling hacks that are normally needed) to write
unittest TestCase classes that have parametrized tests. That is, tests which
consist of multiple sub-tests th... | true |
6262702cb72bca406eadf6c5fe53b157f823b85a | Python | irhete/predictive-monitoring-thesis | /bucketers/StateBasedBucketer.py | UTF-8 | 1,063 | 2.8125 | 3 | [
"Apache-2.0"
] | permissive | import pandas as pd
import numpy as np
from time import time
import sys
class StateBasedBucketer(object):
def __init__(self, encoder):
self.encoder = encoder
self.dt_states = None
self.n_states = 0
def fit(self, X, preencoded=False):
if not p... | true |
ba7dfb637164d69e5d4fb81b1b25a7c5197b65c3 | Python | DaHuO/Supergraph | /codes/CodeJamCrawler/16_2_2_neat/16_2_2_Hidasy_jam2-2.py | UTF-8 | 1,727 | 2.703125 | 3 | [] | no_license | import sys
data = sys.stdin.read().split('\n')
test_cases = data[0]
for index, test_case in enumerate(data[1:]):
min_diff = 100000000000000
resp = (100000000, 1000000000)
coders = test_case.split(" ")[0]
nc = len([x for x in coders if x == '?'])
try:
jammers = test_case.split(" ")[1]
ex... | true |
926f306350624d6b9014a28c8c2a382446e123fb | Python | zlldt/LintCode | /373 partition-array-by-odd-and-even.py | UTF-8 | 730 | 3.140625 | 3 | [] | no_license | class Solution:
"""
@param: nums: an array of integers
@return: nothing
"""
def swap(self, A, a, b):
A[a] ^= A[b]
A[b] ^= A[a]
A[a] ^= A[b]
def partitionArray(self, nums):
# write your code here
first = 0
last = 1
length = len(nums)
... | true |
cd938e39de11a472afeb0c3235902f599ce83e65 | Python | Soumyaditya30/Python | /2Exercise1Harry.py | UTF-8 | 187 | 3.546875 | 4 | [] | no_license | dict = {"a": "1st letter", "b": "2nd letter", "c": "3rd letter", "d": " 4th letter"}
#x = input("Ask something from dict:")
#print(dict[x])
print(dict[input("Ask something from dict:")])
| true |
9cf454ed81b5845558b1331bd31e93da18f5d80f | Python | calllivecn/testing | /numba-t/perm_生成排列.py | UTF-8 | 636 | 2.71875 | 3 | [] | no_license | #!/usr/bin/env python3
#coding=utf-8
import sys
#import numba
#@numba.jit(nopython=True)
def perm(m):
global p
if m == 0:
print(p)
#print(p,flush=True)
else:
for j in range(n):
if p[j] == 0:
p[j]=m
perm(m-1)
p[j]=0
#@nu... | true |
0a5583c65c98a7d6286748ef732e38661ed5f098 | Python | unsik-kim/python_study | /class/13_7.py | UTF-8 | 180 | 3.078125 | 3 | [] | no_license | cash = int(input())
couponName = input()
result = 0;
if couponName == 'Cash3000' :
result = cash - 3000
elif couponName == 'Cash5000' :
result = cash - 5000
print(result) | true |
51edb72302a5c6cf41192c7dc0bb0d1828e22a35 | Python | Aasthaengg/IBMdataset | /Python_codes/p03777/s857588895.py | UTF-8 | 143 | 3.375 | 3 | [] | no_license | def another(s):
if s == 'D':
return 'H'
else:
return 'D'
a, b = input().split()
if a == 'H':
print(b)
else:
print(another(b))
| true |
a69d7c44ac363ac0d440f1edaf8c3e28c2971de8 | Python | Taris9047/taris-personal-docs | /Research Documents/tauc/src/trunk/tauc_fit_GUI.py | UTF-8 | 5,107 | 2.859375 | 3 | [] | no_license | #!/usr/bin/env python
'''
Created on Jun 14, 2009
@author: taris
Curve fitting feature for tauc plot project
'''
from tauc_lib_GUI import *
import numpy as np
from scipy.optimize import leastsq
# defining exponential type residual function for leastsq fitting process.
# exponential residual for Transmittance fitti... | true |
a2dd08151f3bb224fb0016c8a06b194051e7e2e8 | Python | AlabasterAxe/deprender | /test_renderManager.py | UTF-8 | 1,392 | 2.953125 | 3 | [] | no_license | import unittest
from unittest import TestCase
import render_manager
class TestRenderManager(TestCase):
def test_split_tasks(self):
task = {
'start_frame': 1,
'end_frame': 3,
}
sub_tasks = render_manager.split_task(task, 3)
assert len(sub_tasks) == 3
... | true |
f0f9f6df34b0acd72057fbf6ce9003c1e22c0987 | Python | KemalAltwlkany/articulation | /src/Tests/weigthing_method_benchmarks.py | UTF-8 | 9,165 | 2.5625 | 3 | [] | no_license | import numpy as np
import sys as sys
import random as random
sys.path.insert(0, "/home/kemal/Programming/Python/Articulation")
from src.PreferenceArticulation.Solution import Solution
from src.PreferenceArticulation.BenchmarkObjectives import *
from src.TabuSearch.weighting_method import AposterioriWeightingMethod
d... | true |
6ca6ccbeee8e7990f3f61bf253db2f883000301e | Python | OldJohn86/Langtangen | /chapter3/kinematics1.py | UTF-8 | 691 | 3.71875 | 4 | [] | no_license | def kinematics(x, t, dt = 1E-4):
'''
Using the function x, kinematics() returns the position,
velocity, and acceleration at time t using the appoximation
v = (x(t+dt)-x(t-dt))/(2*dt)
a = (x(t+dt)-2x(t)+x(t-dt))/(dt**2)
'''
v = (x(t+dt)-x(t-dt))/(2.0*dt)
a = (x(t+dt)-2*x(t)+x(t-dt))/... | true |
0f582bc419714401fe6ed6007d9bed0e5830f28b | Python | bcso/CS_234_Assignments | /Assignment 2/Answers/StockA2.py | UTF-8 | 3,726 | 3.90625 | 4 | [
"Apache-2.0"
] | permissive | from types import StringType, FloatType, IntType
class Stock:
"""
A data type collecting the attributes of a single stock
Fields: name - str: the company name as a string
symbol - str: a string uniquely identifying the stock
price - non-negative float: last/current price
lo... | true |
2d86279679311ceff93e9ae679c5a94eb34b0e78 | Python | cherrux/Data_Science_Desafio_Latam | /test/test4.py | UTF-8 | 36 | 2.65625 | 3 | [] | no_license | txt = "Hello my friends"
print(txt.upper())
| true |
33054ed2b55e21b45eaaddba42c9689de93f10c7 | Python | linuxlewis/python-nextbus | /nextbus/model.py | UTF-8 | 5,341 | 2.953125 | 3 | [
"Apache-2.0"
] | permissive | from lxml import etree
def parse_command(command, xml):
"""parses the xml document based on the command used. returns the object structure
associated with that xml"""
result = None
if command == 'agencyList':
result = __parse_agencyList(xml)
elif command == 'routeList':
result = __p... | true |
71d463ef5505c98177e52e4d2d57197254198272 | Python | marcosmcz/COMP-551 | /IMDB Sentiment Analysis/imdb_551-master/model/viet_lreg.py | UTF-8 | 1,401 | 2.6875 | 3 | [] | no_license | """
@author: Viet
A pretty standard logistic regression model with saga solver, l2 regularization, and 10fold xval.
"""
from model.pre2 import retrieve_and_pre, dump_to_csv
from sklearn.model_selection import train_test_split
from sklearn.linear_model import LogisticRegression
import numpy as np
from sklearn.model_sele... | true |
bd5ec093b9350652f3e250ac1fc69ceaedb6028e | Python | AARON42695/sentiment_analysis_on_financial_news | /sentiment_analyzer/src/generate_senti_df.py | UTF-8 | 6,100 | 3.625 | 4 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
This script is used to generate one sentiment score for each article
And combine annotated articles and predicted articles into one big dataframe for visualization
"""
import pandas as pd
import os
def generate_raw_sentiment_score(row):
"""
Calculate sentimen... | true |
bafa23dde88a5cad6de1d573d83f9f3e24d72c03 | Python | Lana-Pa/codewars | /tests/test_valid_parentheses.py | UTF-8 | 332 | 3.46875 | 3 | [] | no_license | import unittest
import valid_parentheses as f
class ValidParentheses(unittest.TestCase):
def test_true_parentheses(self):
str = '(())'
self.assertTrue(f.valid_parentheses(str) == True)
def test_false_parentheses(self):
str = '((())'
self.assertTrue(f.valid_parentheses(str) =... | true |
eb5d35e77e35d6bf4a21dd0380e317433f4e70a9 | Python | kiranpdas/python-utilities | /crypter/crypter.py | UTF-8 | 1,881 | 3.34375 | 3 | [] | no_license | from cryptography.fernet import Fernet
class Crypter:
def __init__(self):
__key = None
__data = None
# helpers
def __load_data_from_file(self, filename):
"""Returns the data from the given filename
"""
with open(filename, "rb") as file:
data = file.rea... | true |
52156f21f617cc7e1713e4e646cc24e2b3e4b5ce | Python | chrisjdavie/interview_practice | /leetcode/search_insert_position/using_python_inbuilts.py | UTF-8 | 732 | 4.09375 | 4 | [] | no_license | """
https://leetcode.com/problems/search-insert-position/
Given a sorted array of distinct integers and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order.
You must write an algorithm with O(log n) runtime complexity.
"""
import bisect
imp... | true |
f52e912fa9265f3f1ad0a9bf83fe2d1380ecc06b | Python | madanaman/DataStructuresUsingPython | /QueueImplementation.py | UTF-8 | 137 | 2.78125 | 3 | [] | no_license | from Queue import Queue
q = Queue()
print(q.isEmpty())
q.enqueue('Aman')
q.enqueue('Madan')
q.enqueue('xyz')
q.dequeue()
print(q.size()) | true |
454d3a1ec94e09e00da384f51910d8dab0e0ea23 | Python | yorkcs/python | /York_Proj2.py | UTF-8 | 1,457 | 3.9375 | 4 | [] | no_license | # INF 120-004
# Project 2
# Casey York
# September 27, 2016
from random import *
def main():
# making a random color
showInformation("I will now create a randomly colored window.")
redRandom = randrange(0, 256)
greenRandom = randrange(0, 256)
blueRandom = randrange(0, 256)
randomColor = makeColor(redRan... | true |
eba5918bb7d1af9bb08cb30e20207e76d7587fb4 | Python | liang12k/leetcodeoj | /questions/q74_search_2d_matrix.py | UTF-8 | 1,554 | 4.03125 | 4 | [] | no_license | '''
Write an efficient algorithm that searches for a
value in an m x n matrix.
This matrix has the following properties:
Integers in each row are sorted from left to right.
The first integer of each row is greater than the
last integer of the previous row.
For example,
Consider the following matrix:
[
[1, 3, 5,... | true |
051dfd467e15ceea9e338e1d25b738d8675c7a90 | Python | AdamZhouSE/pythonHomework | /Code/CodeRecords/2897/60637/291255.py | UTF-8 | 320 | 2.890625 | 3 | [] | no_license | arr=eval(input())
record=0
for i in range(len(arr)):
for j in range(i+1,len(arr)):
judge=True
for k in arr[j]:
if k in arr[i]:
judge=False
break
if(judge and len(arr[i])*len(arr[j])>record):
record=len(arr[i])*len(arr[j])
print(record)
| true |
223b314d6b0c580d6de63c14fb70eaa0db084c56 | Python | neicullyn/leetcode | /Python/SortColors.py | UTF-8 | 483 | 3.140625 | 3 | [] | no_license | class Solution:
# @param A a list of integers
# @return nothing, sort in place
def sortColors(self, A):
cnt = [0, 0, 0]
for i in range(len(A)):
cnt[A[i]] += 1
for i in range(cnt[0]):
A[i] = 0
base = cnt[0]
for i in range(cnt[1]):
A[... | true |
7b2b4faf2f2ed72ebb779a95f85c23a5b8ab394c | Python | vchi90/SoftDevSpring | /17_listcomp/app.py | UTF-8 | 2,209 | 3.3125 | 3 | [] | no_license | '''
DiscoAtThePanic - Robin Han, Vincent Chi
SoftDev2 pd7
K #17: PPFTLCW
2019-04-14
'''
import math
a = [0,1,2,3,4]
b = [0,1,2]
not_primes = []
def q1_loop():
temp = []
for i in range(5):
temp.append(i*22)
print(temp)
def q1_list():
print ([x*22 for x in a])
def q2_loop():
temp = []
... | true |
887bdbd66ed5c588262cc709b41bdab562d2535d | Python | sanjianke87/coseis | /scripts/basindepth/mesh.py | UTF-8 | 1,449 | 2.515625 | 3 | [] | no_license | #!/usr/bin/env python
"""
Simple SoCal mesh generation and CVM extraction.
"""
import os
import numpy as np
import cst
# parameters
delta = 0.25 / 60.0, 0.25 / 60.0, 20.0; nproc = 512
delta = 1.0 / 60.0, 1.0 / 60.0, 1000.0; nproc = 1
extent = (-120.5, -112.5), (31.0, 36.0), (0.0, 11000.0)
# node locations
x, y, z... | true |
7958b0b3704bd4a6e8577fc523ee3911a7319994 | Python | perfecto25/googsearch | /search.py | UTF-8 | 984 | 2.734375 | 3 | [] | no_license | import os
from googlesearch import search
import jinja2
# number of iterations to search thru
num_of_cases = 1200
def render_template(template, **kwargs):
''' renders a Jinja template into HTML '''
# check if template exists
if not os.path.exists(template):
print('No template file present: %s' % ... | true |
75ad280471fc8bc3ed735db6c647d84d10dd8135 | Python | anthony20102101/Python_practice | /Practice/LeetCode/EverydayPrac/30.py | UTF-8 | 1,565 | 3.640625 | 4 | [] | no_license | # 给定一个字符串 s,将 s 分割成一些子串,使每个子串都是回文串。
#
# 返回 s 所有可能的分割方案。
#
# 示例:
#
# 输入: "aab"
# 输出:
# [
# ["aa","b"],
# ["a","a","b"]
# ]
# 动规
# class Solution:
# def partition(self, s: str) -> List[List[str]]:
# n = len(s)
# f = [[True] * n for _ in range(n)]
#
# for i in range(n - 1, -1, -1):
# ... | true |
fe459061898837d12711ff7c51f68564b837be47 | Python | Scille/umongo | /umongo/i18n.py | UTF-8 | 725 | 3.03125 | 3 | [
"MIT"
] | permissive | _gettext = None
def gettext(message):
"""
Return the localized translation of message.
.. note:: If :func:`set_gettext` is not called prior, this function
retuns the message unchanged
"""
return message if not _gettext else _gettext(message)
def set_gettext(gettext):
"""
D... | true |
71aeb84551177b49d1039552f2513ecfc6bd79c2 | Python | menkotoglou/CodeSignal | /makeArrayConsecutive2.py | UTF-8 | 246 | 3.25 | 3 | [] | no_license | def makeArrayConsecutive2(statues):
statues.sort()
additions = 0
for i in range(len(statues) - 1):
if (statues[i + 1] - statues[i]) > 1:
additions = additions + (statues[i+1] - statues[i] - 1)
return additions
| true |
f041f366de5d5607d84c742f4748ac24ceeaa392 | Python | slyons/rust-module-of-the-week | /plugins/interlinks/interlinks.py | UTF-8 | 2,447 | 2.75 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
"""
Interlinks
=========================
This plugin allows you to include "interwiki" or shortcuts links into the blog,
as keyword>rest_of_url
"""
import re
from pelican import signals
from bs4 import BeautifulSoup
from bs4 import SoupStrainer
interlinks = {}
def getSettings(generator):
... | true |
93c16a9c8beea93105ec14999662f79a94ae47de | Python | shantanusood/DeepFiValue | /src/engine/types/BalanceSheetChanges.py | UTF-8 | 7,321 | 2.53125 | 3 | [] | no_license | import os
import pandas as pd
from src.engine.types import Helpers
class BalanceSheetChanges:
parent = ""
subsector = ""
data = []
def __init__(self, parent, subsector, data):
self.parent = parent
self.subsector = subsector
self.data = data
def lines(self):
lines_d... | true |
07ba3e3d6d93a9e6fb18454785ea2db8778e80b1 | Python | Abdallah-herri/Tweetos | /src/includes/enc_print.py | UTF-8 | 115 | 3.0625 | 3 | [] | no_license | import sys
def enc_print(string='', encoding='utf8'):
sys.stdout.buffer.write(string.encode(encoding) + b'\n') | true |
4751df7b87f761861c6e01656388120353824d9e | Python | Aasthaengg/IBMdataset | /Python_codes/p02791/s211518776.py | UTF-8 | 149 | 2.921875 | 3 | [] | no_license | N = int(input())
P = list(map(int,input().split()))
Pm = P[0]
ans = 0
for i in range(N):
if P[i] <= Pm:
ans += 1
Pm = P[i]
print(ans) | true |
e8559b0b117c16aab61f4a57b61de1ad5fcb892e | Python | yusokk/algorithm | /extra/pro-상호평가.py | UTF-8 | 845 | 3.359375 | 3 | [] | no_license | from collections import Counter
def getGrade(score):
score //= 10
print(score)
if score == 10 or score == 9:
return 'A'
elif score == 8:
return 'B'
elif score == 7:
return 'C'
elif score == 6 or score == 5:
return 'D'
else:
return 'F'
def solution(... | true |
e7a44063d9a10d196ca0df6ab0f12a92df665856 | Python | tkat0/wasmtime-py | /tests/test_trap.py | UTF-8 | 3,141 | 2.6875 | 3 | [
"LLVM-exception",
"Apache-2.0"
] | permissive | import unittest
from wasmtime import *
class TestTrap(unittest.TestCase):
def test_new(self):
store = Store()
trap = Trap(store, 'x')
self.assertEqual(trap.message, u'x')
def test_errors(self):
store = Store()
with self.assertRaises(TypeError):
Trap(1, '')... | true |
8030e33b8bd56dbf6514f8fc4051f2e1a711fbca | Python | TREND50/GRANDproto_python | /plotRate.py | UTF-8 | 1,199 | 2.65625 | 3 | [] | no_license | import os
import time
import sys
import math
import numpy as np
import pylab as pl
font = {'family' : 'normal',
'weight' : 'bold',
'size' : 18}
pl.rc('font', **font)
consigne = np.array([100, 1000, 5000, 6000, 8000, 10000, 12000, 14000, 16000, 18000, 20000]) #Hz
trate = 2*consigne*1e-3
dur = np.a... | true |
4b3c0ef7f6793bc6ba3b21ea10c723503e3c80cb | Python | filozyu/leetcode-journey | /src/object-oriented-design/insert_delete_random.py | UTF-8 | 1,837 | 4.09375 | 4 | [] | no_license | from random import choice
class RandomizedSet:
def __init__(self):
"""
Initialize your data structure here.
"""
self.indx = {}
self.data = []
def insert(self, val: int) -> bool:
"""
Inserts a value to the set. Returns true if the set did not already con... | true |
9094d770b67520567ca645fc83da027d29f36e3e | Python | ca4ti/dsremap | /src/dsrlib/domain/listmodel.py | UTF-8 | 2,991 | 2.609375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
from PyQt5 import QtCore
class ListObjectProxy:
def __init__(self, obj, model):
self._obj = obj
self._model = model
obj.changed.connect(self._notify)
def object(self):
return self._obj
def _notify(self):
self._model.notifyChange(self)
... | true |
7b743610003aa5776496ac49e722aeb2063f009e | Python | lmagellanic-cloud/phishers-monitor | /TFG/manageMonitoredUsersDB.py | UTF-8 | 2,979 | 2.921875 | 3 | [
"Apache-2.0"
] | permissive | import sqlite3
pathToMonitoredUsers = './databases/monitoredUsers/monitoredUsers.db'
def add_monitoredUser(username, jsonFile):
try:
with sqlite3.connect(pathToMonitoredUsers) as connection:
cursor = connection.cursor()
cursor.execute("""
INSERT INTO monitoredUsers ... | true |
96f297417fe4fa3577942b195fee1cf248b9ab2c | Python | ChristopherLindberg/Buzzer | /GUI.py | UTF-8 | 7,002 | 2.921875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sun Sep 9 21:29:11 2018
@author: Lindberg
"""
import tkinter as tk
from random import uniform, randint, shuffle
from time import sleep
import os
from CreateQuestions import get_cards
from Card import Card
from Player import Player
import re
from pygame import mixer # Load the ... | true |
a6c3eb5ee9e19cb8774661eaea95e8b181578ffb | Python | shareholders-meeting-of-chicken-farm/ChickenCode | /week03/1249_plb.py | UTF-8 | 661 | 3.28125 | 3 | [
"Apache-2.0"
] | permissive | class Solution:
def minRemoveToMakeValid(self, s):
char_stack = []
index_stack = []
chars = [c for c in s]
for i in range(len(chars)):
if chars[i] == "(":
char_stack.append(chars[i])
index_stack.append(i)
elif chars[i] == ")":... | true |
084a4a0ba8db0b3d05e3f8f49e1074417b0f055c | Python | estoicodev/holbertonschool-higher_level_programming-1 | /0x0A-python-inheritance/8-rectangle.py | UTF-8 | 521 | 3.25 | 3 | [] | no_license | #!/usr/bin/python3
"""This module creates a Rectangle class"""
BaseGeometry = __import__('7-base_geometry').BaseGeometry
class Rectangle(BaseGeometry):
"""A class named BaseGeometry
Attributes:
attr1(width): width of rectangle
attr2(height): height of rectangle
"""
def __init__(self, width,... | true |
ec09572d3310187098df063e0a627741f0b0efc2 | Python | Masqard/python_algor | /hm1_1.py | UTF-8 | 546 | 4.3125 | 4 | [] | no_license | #1.Найти сумму и произведение цифр трехзначного числа, которое вводит пользователь.
# https://drive.google.com/file/d/1giTLScEcInxk-iT6GzDsM8W7prU8ZISk/view?usp=sharing
n = int(input('Введите трехзначное число: '))
a = n // 100
b = (n // 10) % 10
c = n % 10
sum = a + b + c
prod = a * b * c
print (f'Ваше число - {... | true |
0008605f339370aedc8630a9927ac23d10924eeb | Python | Aluriak/weldon | /problem01.py | UTF-8 | 6,541 | 2.9375 | 3 | [] | no_license | """Exemple of problem case for weldon.
This contains:
- description of the problem
- public unit tests
- hidden unit tests
"""
import random
from pprint import pprint
import pytest
import server as weldon
from commons import ServerError
def test_story_problem01():
print('#' * 80)
print('# ROOTER PART')
... | true |
eed7b84c2bb6512d10cbcdb27aace31d0ddf225d | Python | zanezhub/automata_theory | /turing.py | UTF-8 | 3,184 | 3.203125 | 3 | [] | no_license | #!/usr/bin/env python3.7
from functools import reduce
from typing import Dict, Set, Tuple
def or_function(v1: bool, v2: bool) -> bool:
return v1 or v2
def turing_machine(sigma: Set[chr],
gamma: Set[chr],
b: chr,
delta: Dict[Tuple[str, chr], Tuple[str, chr... | true |
dd65a64c268c334509f2155694371c8f918df8a2 | Python | Aasthaengg/IBMdataset | /Python_codes/p03548/s598147556.py | UTF-8 | 57 | 2.84375 | 3 | [] | no_license | a,b,c=map(int, input().split())
print((a-b-2*c)//(b+c)+1) | true |
6faceac1b71d511f2bffc621e87e4de12e37ce32 | Python | nlkek/CodewarsProgs | /ValidBraces.py | UTF-8 | 1,150 | 4.34375 | 4 | [] | no_license | def validBraces(string):
stack = []
open_braces, close_braces = '([{', ')]}'
for s in string:
if s in open_braces:
stack.append(s)
elif s in close_braces:
if not len(stack):
return False
else:
c = stack.pop()
... | true |
e52758ac3fcc156e72a421762984a22bffbee55a | Python | JiaoMX-keeping/rsp3-armv8-baremetal | /subprojects/python3_gen_engine/src/GenEngine.py | UTF-8 | 8,712 | 2.578125 | 3 | [
"MIT"
] | permissive | # -*-encoding:utf8 -*-
'''
Created on Mar 28, 2018
@author: 13774
'''
import re
from support import *
from collections import deque
import os
import sys
class GenEngine(object):
'''可以根据cppy文件生成合法的python源代码片段,这些源代码片段可以被插入到其他代码之中。
'''
COMMON_HEAD = 'import Output\nout = Output.Output()\n'
... | true |
3c89604cf242f11ad6bc0b8f828df861520c44bc | Python | pdmpro/gae-site-scaffold | /sitedata/data.py | UTF-8 | 439 | 3.171875 | 3 | [
"MIT"
] | permissive | # A proof of concept of how raw data (in this case, Python tuples) can be used to generate
# a section of a dynamic page. I use this structure for block quotations.
injections = [
("Erykah Badu", "Man, I don't want to have nothing to do with computers. I don't want the government in my business."),
("William Sa... | true |
cdf34dcf95b603c7b93cd573148c1ddb776e696c | Python | deniskrumko/advent-of-code | /2021/day_06/main.py | UTF-8 | 850 | 3.703125 | 4 | [] | no_license | from collections import (
Counter,
defaultdict,
)
def lanternfish_cycle(data: list, days: int) -> int:
"""Imitate lanternfish life cycle."""
fishes = Counter(data)
for _ in range(days):
new_fishes = defaultdict(int)
for fish_age, fish_number in fishes.items():
if fish_... | true |
f90a90dcb719f369f72702e4f4825a3814f908dc | Python | 93Boy/project_digital_vaccine_certificate | /main.py | UTF-8 | 2,911 | 2.859375 | 3 | [] | no_license | import hashlib
import json
import json
import os
from datetime import datetime
import credentials
from Vaccine import VacInfo
from Vaccuser import Admin
from Vaccuser import Vacuser
def is_admin(user: str) -> bool:
if not os.path.isfile("admin.json"):
raise FileNotFoundError("Settings file not found.")
... | true |
1785199c480d912764ece5589176ccbe8ae5eaa9 | Python | crystaloscillator/venetonight | /puntideboli/scripts/instasnarf.py | UTF-8 | 805 | 2.65625 | 3 | [] | no_license | """
This script reflects all content passing through the proxy.
"""
import re
import sqlite3
from mitmproxy import http
DB_PATH = '/tmp/instapwd.db'
def response(flow: http.HTTPFlow) -> None:
if flow.request.pretty_host == 'www.instagram.com':
match_pwd = re.search(b'password=([^&]*)', flow.request.conte... | true |
cc3a9aa2b7d4e56053e54aae7ecffdb78677e52f | Python | daniel-reich/ubiquitous-fiesta | /iHfq7KA8MBuZqBGgo_15.py | UTF-8 | 156 | 2.71875 | 3 | [] | no_license |
def is_legitimate(mtrx):
inv_mtrx = [list(row) for row in zip(*mtrx)]
return 1 not in mtrx[0]+mtrx[len(mtrx)-1]+inv_mtrx[0]+inv_mtrx[len(inv_mtrx)-1]
| true |
7c4fbba09f3f3e3c29e598d1feb8cb24a175db69 | Python | 12wb/python-0JC | /第五章 字典/5.5 实验.py | UTF-8 | 2,087 | 3.53125 | 4 | [] | no_license | """
# 按要求修改5.3.2节内容
d_date1 = {'鲫鱼':[18,10.5],'鲤鱼':[8,6.2],'鲢鱼':[7,4.7]}
d_date2 = {'草鱼':[2,7.2],'鲫鱼':[3,12],'黑鱼':[6,15]}
d_date3 = {'乌龟':[1,71],'鲫鱼':[1,9.8],'草鱼':[5,7.2],'黄鱼':[2,40]}
fish_records = {'1月1日':d_date1,'1月2日':d_date2,'1月3日':d_date3}
d_date1['鲫鱼'] = [17,10.5] # 修改键'鲫鱼'对应的值
del(d_date3['黄鱼']) # 删除键'... | true |
ce6dda8da1ed9aa383820b87bbd88e1276c725b2 | Python | dayanne-castro/inferelator_ng | /inferelator_ng/tests/test_time_series.py | UTF-8 | 3,460 | 2.625 | 3 | [
"BSD-2-Clause"
] | permissive | import unittest
from .. import condition
from .. import time_series
import pandas as pd
class TestTimeSeries(unittest.TestCase):
def test_1_condition(self):
first = condition.Condition("first", {"gene1": 9, "gene2": 0.12})
ts = time_series.TimeSeries(first)
name_order = ts.get_condition_na... | true |
93fd56092ba85d66b9c9ab473fe212b79291a1af | Python | rayasasa/Algorithms-and-Data-Structures | /bubbleSort.py | UTF-8 | 362 | 3.90625 | 4 | [] | no_license | def bubbleSort(array):
swaps = 0
for x in range(len(array)-1,0,-1):
for i in range(x):
if(array[i] > array[i+1]):
swaps = swaps + 1
temp = array[i]
array[i] = array[i+1]
array[i+1] = temp
return array
unsortedArray = [4,7,2... | true |
2f50d068ea6c43e2379014e4ccc54b5004c78413 | Python | Nobodylesszb/python_module | /data_structures/collections/deque/collections_deque_maxlen.py | UTF-8 | 708 | 3.796875 | 4 | [
"MIT"
] | permissive | import collections
import random
# Set the random seed so we see the same output each time
# the script is run.
random.seed(1)
d1 = collections.deque(maxlen=3)
d2 = collections.deque(maxlen=3)
for i in range(5):
n = random.randint(0, 100)
print('n =', n)
d1.append(n)
d2.appendleft(n)
print('D1:',... | true |
e3cd23561904e08b0b271032afcd36bdd0cef146 | Python | clhiker/WPython | /Python/Python可以这样学/第三章程序控制结构函数设计/今天是今年的第几天.py | UTF-8 | 309 | 3.15625 | 3 | [] | no_license | import time
def main():
data = time.localtime()
year,month,day = data[:3]
day_month=[31,28,31,30,31,30,31,31,30,31,30,31]
if year%400 == 0 or (year%4==0 and year%100!=0):
day_month[1] = 29
if month==1:
print(day)
else:
print(sum(day_month[:month-1])+day)
main() | true |
fa40fb9e8aa58ae447a94aa8559d2675fe6a2388 | Python | 2014244/sbc011-pj1-redis | /sqlite_json.py | UTF-8 | 3,797 | 2.546875 | 3 | [] | no_license | import sqlite3
import json
from pathlib import Path
def init_db():
file_name = r"database.db"
file_obj = Path(file_name)
if file_obj.is_file():
return False
else:
connection = sqlite3.connect('database.db')
with open('schema.sql') as f:
connection.executescript(f.re... | true |