blob_id large_string | language 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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
be0afd7afe904849f9a750dbedf73cbef6632675 | Python | wepstein712/ToyLanguage | /Other/errors.py | UTF-8 | 1,474 | 3 | 3 | [] | no_license | """
Here are our exceptions that can be thrown in expected cases where the program should error.
The last error was something that we included while doing testing for pointer location manipulation, but is not
necessary for the program.
"""
class UndeclaredException(Exception):
def __init__(self, var, s... | true |
853bca71091b9cae9b2a13d652a4d485f95d6683 | Python | eubr-bigsea/compss-library | /python/LogisticRegression/test.py | UTF-8 | 5,333 | 2.875 | 3 | [] | no_license | #!/usr/bin/python
# -*- coding: utf-8 -*-
__author__ = "Lucas Miguel S Ponce"
__email__ = "lucasmsp@gmail.com"
import sys
from logisticRegression import *
import time
import numpy as np
import pandas as pd
def FeatureAssemble(df, cols, name):
"""
Feature Assembler is a transformer that combines a gi... | true |
9bd6d98243403aaf94bf3fcb7c4236d46270ae9a | Python | climjack/CP1404practicals | /prac_04/list_exercises.py | UTF-8 | 634 | 2.9375 | 3 | [] | no_license | numbers = []
for x in range(5):
numbers.append(int(input("Number: ")))
print(f"The first number is {numbers[0]}")
print(f"The last number is {numbers[-1]}")
print(f"The smallest number is {min(numbers)}")
print(f"The largest number is {max(numbers)}")
print(f"The average number is {sum(numbers) / len(numbers)}")
u... | true |
5a35385cc104c0a62919dc30eb5f104d444da2a1 | Python | widderslainte/langmaker | /tests/morphology_tests.py | UTF-8 | 608 | 2.796875 | 3 | [
"MIT"
] | permissive | ''' test morphology generator '''
import unittest
from unittest import TestCase
from unittest.mock import MagicMock
from langmaker.morphology import Morphology, Morpheme
morphemeMock = Morpheme
morphemeMock.get_morpheme = MagicMock(return_value='mor')
instance = Morphology(morphemes=morphemeMock)
class MorphologyTes... | true |
9a33b848353d204522c971d66d63dedd4ef7cffb | Python | kioco/AU_R-CNN | /action_unit_metric/demo_metric.py | UTF-8 | 2,460 | 2.625 | 3 | [] | no_license | import scipy.io as sio
from action_unit_metric.get_ROC import get_ROC
from action_unit_metric.F1_event import get_F1_event
from action_unit_metric.F1_frame import get_F1_frame
import matplotlib.pyplot as plt
import numpy as np
from action_unit_metric.F1_norm import get_F1_norm
import matplotlib
from matplotlib.... | true |
9f8db6541438fadc0e6d868ee9014a847c5f96b5 | Python | ahopkins/asynccli | /tests/test_initial.py | UTF-8 | 178 | 2.59375 | 3 | [
"MIT"
] | permissive | def callable():
print('hello')
return True
def test_init(capsys):
assert callable(), "Something wrong"
out, _ = capsys.readouterr()
assert out == "hello\n"
| true |
76d6a52d21afe301f5d4668dda16b728fd0066d5 | Python | haohouh/leetcode | /BinarySearch.py | UTF-8 | 712 | 3.671875 | 4 | [] | no_license | def BSIndex(nums,lo,hi,target):
if lo > hi: return -1
mid = lo + (hi-lo)//2
if nums[mid] == target:
return mid
elif nums[mid] < target:
return BSIndex(nums,mid+1,hi,target)
else:
return BSIndex(nums,lo,mid-1,target)
def BSIndexNonRecur(nums,lo,hi,target):
if lo > hi: ret... | true |
cfc49839aa1f593a1c262d415d5d8426a2b8512e | Python | useblocks/groundwork | /groundwork/plugins/gw_signals_info.py | UTF-8 | 2,946 | 2.828125 | 3 | [
"MIT"
] | permissive | from groundwork.patterns import GwCommandsPattern, GwDocumentsPattern
signal_content = """
Signal overview
===============
Registered signals: {{app.signals.get()|count}}
List of signals
---------------
{% for name, signal in app.signals.get().items() %}
* {{signal.name-}}
{% endfor %}
{% for name, signal in ap... | true |
6b34411d797be66b1b88839a89017e8f33bf48e2 | Python | EmilioLrp/CIS667_2048_game | /training_data_generator.py | UTF-8 | 2,507 | 2.78125 | 3 | [] | no_license | from src.control.mcts_new import MCTSNew, MCT
from src.game.game import Game, Action
import os
import random
import copy
import numpy as np
import pickle as pk
import time
# def training_data_generator():
# pass
#
#
# def testing_data_generator():
# pass
def data_generator(size, goal):
mcts = MCTSNew()
... | true |
7b0d22b5f6cd72c25234e45614db66c047f36f67 | Python | Eleanoryuyuyu/LeetCode | /python/BFS/1162. 地图分析.py | UTF-8 | 1,059 | 3.140625 | 3 | [] | no_license | from typing import List
class Solution:
def maxDistance(self, grid: List[List[int]]) -> int:
if not grid or len(grid) < 1 or len(grid[0]) < 1:
return -1
n = len(grid)
queue = []
for i in range(n):
for j in range(n):
if grid[i][j] == 1:
... | true |
eb5a7df20bec4bbb06693dc5dc48bd09868fe2d0 | Python | kevinrev26/InterfaceMachine | /start.py | UTF-8 | 462 | 3.28125 | 3 | [] | no_license | #!/usr/bin/env python
# Título:
# Autor: Kevin Rivera
# Descripción: Punto de entrada para la programación de la simulación
# Importando librerias necesarias
from utilidades import Simulacion
if __name__ == '__main__':
try:
iteraciones = int(input("Ingrese el numero de iteraciones: "))
modelo =... | true |
15581dd77d1403026195e015832ebd5b71e6f2fd | Python | Joe676/Hanoi | /hanoi.py | UTF-8 | 767 | 3.984375 | 4 | [] | no_license | def counter():
x = 0
while True:
yield x
x += 1
c = counter()
def move(fr, to):
print('Move a disc from {} to {}'.format(fr, to))
next(c)
def move_through(fr, th, to):
move(fr, th)
move(th, to)
def hanoi(n, fr, he, to):
if n==0:
pass
else:
... | true |
b263136722d97ee04a546b132e9609a554f72262 | Python | linzowo/GAME_PRACTICE | /ship.py | UTF-8 | 1,946 | 3.4375 | 3 | [] | no_license | #_*_ coding: utf_8 _*_
import pygame
from pygame.sprite import Sprite
class Ship(Sprite):
"""关于飞船的类"""
def __init__(self,screen,ai_settings):
"""初始化飞船位置"""
super(Ship,self).__init__()
self.screen = screen
self.ai_settings = ai_settings
#加载飞船图像并获取其外接矩形
self.im... | true |
98b6ba5103732dcd3fbba2976dd3bd00e3d4d186 | Python | tmduddy/advent-of-code-2020 | /day4.py | UTF-8 | 4,732 | 2.671875 | 3 | [] | no_license | import re
from utilities import get_data_as_csv
raw = get_data_as_csv('day4')
data = [str(row[0]) if len(row) > 0 else "" for row in raw]
sample = [
"ecl:gry pid:860033327 eyr:2020 hcl:#fffffd",
"byr:1937 iyr:2017 cid:147 hgt:183cm",
"",
"iyr:2013 ecl:amb cid:350 eyr:2023 pid:028048884",
"hcl:#cfa... | true |
33bee53720c8f91a71d6c7214da322d023db143b | Python | Landriou/ia-uncuyo-2021 | /tp7-ml/code/id3/main.py | UTF-8 | 520 | 2.90625 | 3 | [] | no_license | import time
#\u265E
#\u25A1 black square
#\u25A0 white squeare
import csv
from DecisionTreeLearning import DecisionTreeLearner
file = open('tennis.csv')
csvreader = csv.reader(file)
header = next(csvreader)
print(header)
rows = []
for row in csvreader:
rows.append(row)
file.close()
dtl = DecisionTreeLearner(rows,h... | true |
da92a803bf9928b9c0660a748c900949b0b58c66 | Python | TakahiroSono/atcoder | /practice/python/ABC153/D.py | UTF-8 | 76 | 2.984375 | 3 | [] | no_license | H = int(input())
cnt = 0
while H:
H //= 2
cnt = cnt*2 + 1
print(cnt)
| true |
9d4bcc21a00f1bca64be3df22fab047f6c5bdce6 | Python | pk0912/TweetEmotionsPredictor | /utils/visualisation.py | UTF-8 | 756 | 3.03125 | 3 | [
"MIT"
] | permissive | """
Python file containing different methods for different kind of visualisation.
"""
import matplotlib.pyplot as plt
def line_chart_with_x(val_lbl_list, save_path, x_lbl="", y_lbl=""):
plt.figure(figsize=(10, 7))
for data in val_lbl_list:
plt.plot(data["value"], data["style"], label=data["label"])
... | true |
6ac3d019baf129dd87d8b2a9954534b1d0cbf463 | Python | ucsdyus/cconv | /test_fp.py | UTF-8 | 2,175 | 2.640625 | 3 | [] | no_license | import torch
import fastpatch as fp
# Dynamic Graph
# Graph
# 0: 1, 3
# 1: 0
# 2:
# 3: 0
nn_offset = torch.tensor([0, 2, 3, 3, 4], dtype=torch.int32).cuda()
nn_list = torch.tensor([1, 3, 0, 0], dtype=torch.int32).cuda()
grad_nn_offset = torch.tensor([0, 2, 3, 3, 4], dtype=torch.int32).cuda()
grad_nn_list = torch.tens... | true |
e76ae406f44e5d2d00c1270a4610ddc1cc46ae91 | Python | JakubKazimierski/PythonPortfolio | /AlgoExpert_algorithms/Medium/BST_Traversal/test_BST_Traversal.py | UTF-8 | 935 | 3.46875 | 3 | [] | no_license | '''
Unittests for BST_Traversal.py
January 2021 Jakub Kazimierski
'''
import unittest
from BST_Traversal import BST, inOrderTraverse, postOrderTraverse, preOrderTraverse, setUp
class test_BST_Traversal(unittest.TestCase):
'''
Class with unittests for BST_Traversal.py
'''
# region Uni... | true |
cdf8706b81de55c56ed8327074d2f935a2f5c214 | Python | bc-townsend/aco_example | /aco_example/button.py | UTF-8 | 2,690 | 3.625 | 4 | [] | no_license | import pygame
class Button:
"""Class represents a GUI button and has a pressed down state and a normal state.
"""
def __init__(self, rect, text, normal_color, pressed_color, size):
"""Initialize method for a Button.
Args:
rect: The pygame rectangle that this button should cor... | true |
fbf6187f5bde7889a491ceec36732f35dcf39511 | Python | chaofw/Machine-learning | /ANN/CNN/CNN.py | UTF-8 | 3,105 | 3.078125 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
@author: Chaofeng Wang
Convolutional NN using tensorflow with dropout
"""
import numpy as np
import tensorflow as tf
from tensorflow.examples.tutorials.mnist import input_data
####################################
tf.reset_default_graph() ## reset the default graph
... | true |
e28165348fcb1215c06b34813e267d4ecbd281b5 | Python | Aasthaengg/IBMdataset | /Python_codes/p03618/s317694753.py | UTF-8 | 452 | 2.8125 | 3 | [] | no_license | import sys
import heapq
from operator import itemgetter
from collections import deque, defaultdict, Counter
from bisect import bisect_left, bisect_right
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)
MOD = 10**9 + 7
def sol():
A = input().strip()
cnt = Counter(A)
sameCount = 0
for _, c in ... | true |
04c03c94ba9a4c1f7b478cc0019efec4b7c982a0 | Python | amey-joshi/am | /p4/grad_desc.py | UTF-8 | 546 | 2.984375 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
def gradz_dot_dh(r, dh):
gradz = [2*r[0] + r[1], r[0] + 2*r[1]]
return np.dot(gradz, dh)
def euclidean_dist(r1, r2):
return np.sqrt((r1[0] - r2[0])**2 + (r1[1] - r2[1])**2)
threshold = 0.000001
max_iter = 10000
step = [0.01, 0.01]
prev = [0.1, 0.1]
n =... | true |
556d056781c84f71b3be1b7f99b99555c9449afe | Python | Starkxim/code | /python/hw4/Fibonacci sequence2.py | UTF-8 | 159 | 3.390625 | 3 | [
"WTFPL"
] | permissive | a=1
b=1
n=int(input('enter n='))
if n>=0:
print('1')
for i in range(n-1):
a,b=b,a+b
print(a)
else:
print('enter a nonnegative n')
| true |
898ad9c6b889f6dcf74857c1610d86b3a5d690ec | Python | eyalios/itti-koch | /input.py | UTF-8 | 1,311 | 3.109375 | 3 | [] | no_license | '''
this is the input\output file.
contains the following functions:
*read_image -> receives a path and open a given image file.
'''
import cv2
import numpy as np
from scipy.misc import imread as imread
import layer1
from scipy.ndimage.filters import convolve
###CONSTANTS#####
GRAYCLE = 1
RGB = 2
TWO_D = 2... | true |
215901b012c774ee7b05873cb639950116524d94 | Python | LiuY-ang/leetCode | /searchInsertPosition.py | UTF-8 | 363 | 3.171875 | 3 | [] | no_license | class Solution(object):
def searchInsert(self, nums, target):
"""
:type nums: List[int]
:type target: int
:rtype: int
"""
for index in range(0,len(nums)):
if nums[index] >= target:
return index
return len(nums)
nums=[1,3,5,6]
solu=... | true |
9a75455d865bdeb10fd910a9d60d49f7c896dbad | Python | Flaviommrs/Estudo-Dirigido | /TestScripts/pycudaExample.py | UTF-8 | 564 | 2.546875 | 3 | [] | no_license | #!/home/moita/anaconda3/bin/python3
import pycuda.driver as cuda
import pycuda.autoinit
from pycuda.compiler import SourceModule
import numpy
a = numpy.random.randn(20,20)
a = a.astype(numpy.float32)
a_gpu = cuda.mem_alloc(a.nbytes)
cuda.memcpy_htod(a_gpu, a)
mod = SourceModule("""
__global__ void doublify(floa... | true |
3632715081dc67ba9771ccd3e9a41df5e2cf1735 | Python | spliner/advent-of-code-2018 | /python/day7.py | UTF-8 | 3,536 | 2.90625 | 3 | [] | no_license | import re
import itertools
from operator import itemgetter
INPUT = '../inputs/day7.txt'
TEST_INPUT = '../inputs/day7_test.txt'
WORKER_COUNT = 5
TEST_WORKER_COUNT = 2
TEST_BASE_COMPLETION_TIME = 0
BASE_COMPLETION_TIME = 60
REGEX = r'^Step (?P<requirement>\w+) must be finished before step (?P<step>\w+) can begin.$'
... | true |
f7e6d0e6cfbd1226fd435a7c78955c60d6020890 | Python | lemonzlm/esp32lab | /code/vscode/rt-thread-mpy/Switch.py | UTF-8 | 590 | 3.21875 | 3 | [] | no_license | from machine import PWM
from machine import Pin
class Switch():
"""
创建一个开关类
"""
def __init__(self, pin, freq=1000):
"""
初始化绑定一个引脚,设置默认的PWM频率为1000
"""
self.pwm = PWM(pin,freq=freq)
def change_duty(self, duty):
"""
改变占空比
"""
if 0 <= dut... | true |
9df04d52d4f466774c2aac929cb04af4429de3cf | Python | filipnovotny/algos | /map_reduce_filter/reduce.py | UTF-8 | 101 | 2.90625 | 3 | [] | no_license | import itertools
l = xrange(10)
accumulator_sum = reduce(lambda x,y: x+y,l)
print(accumulator_sum)
| true |
ed9b54697c412eeeca75e7fc13c5c9b109e7c1a7 | Python | jungkoo/wagle | /topicnzin/filter/title_word.py | UTF-8 | 904 | 2.984375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
'''
Created on 2013. 8. 14.
@author: deajang
'''
# from topicnzin.dictionary.submatch_key_finder import SubMatchKeyFinder
# from topicnzin.common.utils import toUnicode
'''
대표단어가 있으면 대치해준다.
단순 replace해주는기능을 담당한다.
오타교정을 하거나 축약어를 보정하기위해 사용한다고 보면된다.
{"기본단... | true |
1e9f1915e11f0b4401adc5bed069284fc7040c01 | Python | syndicate-storage/syndicate | /old/UG/tests/blackbox/syndicatefs/write-test.py | UTF-8 | 118 | 2.6875 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/python
import os
import sys
path = sys.argv[1]
fd = open( path, "r+" )
fd.write(r"goodbye")
fd.close()
| true |
8e778a0966753bba6d64c426e0e94110c602244a | Python | SyafiqTermizi/masak2 | /masak2/users/tests/test_forms.py | UTF-8 | 1,681 | 2.71875 | 3 | [] | no_license | import pytest
from django.contrib.auth import get_user_model
from django.test.client import RequestFactory
from users.forms import LoginForm
pytestmark = pytest.mark.django_db
UserModel = get_user_model()
def test_login_form_username_length():
"""
Username should be longer than 4 character
"""
creds ... | true |
156ded05554e6cc233b88724d649b7c27d8145c3 | Python | AdamZhouSE/pythonHomework | /Code/CodeRecords/2247/60589/260336.py | UTF-8 | 407 | 3.40625 | 3 | [] | no_license | piles=input().split(',')
piles=list(map(int,piles))
sum_a=0
sum_l=0
cnt=0
while len(piles)>0:
if cnt%2==0:
if piles[0]>=piles[len(piles)-1]:
sum_a+=piles.pop(0)
else:
sum_a+=piles.pop()
else:
if piles[0]>=piles[len(piles)-1]:
sum_l+=piles.pop(0)
... | true |
264060e2b0de59f0fa8fb39010fb686fa89b835a | Python | aman97kalra/Python-Scripts | /Facebook-Login/fb_login.py | UTF-8 | 515 | 2.8125 | 3 | [] | no_license | from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager
import os
import time
usr=input('Enter Email Id:')
pwd=input('Enter Password:')
browser = webdriver.Chrome( ChromeDriverManager().install() )
browser.get('https://www.facebook.com')
time.sleep(2)
username = browser.find_element... | true |
bd3484d9315deb0b313d890d2ab1e45bde6cec92 | Python | JESUS-2120/Python_class | /src/contenido_ATCG.py | UTF-8 | 1,441 | 4.1875 | 4 | [] | no_license | '''
NAME
Calculo del contenido de AGCT
VERSION
1.0
AUTHOR
Victor Jesus Enriquez Castro <victorec@lcg.unam.mx>
GitHub
https://github.com/JESUS-2120/Python_class/blob/master/src/contenido_ATCG.py
DESCRIPTION
Dada una secuencia de DNA (AGCT) este programa calcula el contenido de... | true |
030b51546bef40744acee20f33d9b9cf93ac0c80 | Python | SimonWoodburyForget/asteroids | /game/shield.py | UTF-8 | 1,191 | 2.78125 | 3 | [] | no_license | import pyglet
from pyglet.sprite import Sprite
from . import resources
class Shield:
"""Sprite controller for shield up animation"""
def __init__(self, batch):
_frames = resources.shield_images
self._frames = [Sprite(img=frame, batch=batch) for frame in _frames]
for frame in self._fr... | true |
09fe992d9926c772da78a018a3e2459c880bf5a2 | Python | swagsocks/analysis | /kaggle/challenges/titanic.py | UTF-8 | 6,669 | 3.34375 | 3 | [] | no_license | ###From Ashwins Kernel###
###
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
import warnings
warnings.filterwarnings('ignore')
data=pd.read_csv('~/titanic/train.csv')
data.groupby(['Sex','Survived'])['Survived'].count()
f,ax=plt.subplots(1,2,figsize=(18,8))
data[['Sex',... | true |
d8a1ed1e41bfec7043b8619f4be8e6262b73cf77 | Python | ohsekang/sekang | /9주차/Problem9-2.py | UTF-8 | 204 | 3.078125 | 3 | [] | no_license | from collections import deque
n = int(input())
q = deque([i for i in range(1,n+1)])
while len(q) >1:
q.popleft()
q.rotate(-1)
print(q[0])
# https://leonkong.cc/posts/python-deque.html | true |
8e7cfa06da22142cfc0e206ed3eb31759e0e9057 | Python | liqiming-whu/SRG_wordcloud | /pubmed.py | UTF-8 | 6,979 | 2.59375 | 3 | [] | no_license | #!/usr/bin/env python3
import os
import csv
import pandas as pd
from Bio import Entrez, Medline
Entrez.email = "liqiming1914658215@gmail.com"
Entrez.api_key = "c80ce212c7179f0bbfbd88495a91dd356708"
class Search_Pubmed:
def __init__(self, keywords, retmax=10000):
self.keywords = keywords
self.ret... | true |
6a39f0e0c43ea1d5bd18221294f38d867de3a4bd | Python | joshjpark/leetcode | /wordPattern.py | UTF-8 | 223 | 2.796875 | 3 | [] | no_license | class Solution:
def wordPattern(self, pattern, st):
s = pattern
t = st.split()
for ss, pp in s,t:
sn = Solution()
print(sn.wordPattern("abbbaa", "dog cat dog dog dog cat")) | true |
38282d72c94b684bff27f4304284bb1611169e37 | Python | eriksays/advent_of_code_2020 | /day2/main.py | UTF-8 | 2,875 | 3.828125 | 4 | [] | no_license | import pandas as pd
from pprint import pprint
def main(ruleset=1):
#open expenses file and convert to list
password_file = pd.read_csv('password_file.csv', header=None, names=["passwords"])
passwords = password_file["passwords"].to_list()
pprint(passwords)
good = []
bad = []
for pwd_li... | true |
c9a4e13247c967f4f564dbe5cec95d27c14ea78c | Python | weparkerjr/cs-sprint-challenge-hash-tables | /hashtables/ex3/ex3.py | UTF-8 | 858 | 3.765625 | 4 | [] | no_license | def intersection(arrays):
"""
YOUR CODE HERE
"""
# Your code here
# empty list
result = []
# empty dict
cache = {}
# subarray is single list containing the integers within list
for subarray in arrays:
for num in subarray:
if num not in cache:
... | true |
68d0743522348b8badd1d27f8ea9bda72164edc0 | Python | esddse/leetcode | /medium/808_soup_servings.py | UTF-8 | 858 | 2.828125 | 3 | [] | no_license | class Solution:
def soupServings(self, N: int) -> float:
if N > 4800:
return 1
prob_map = {}
def prob_a_empty_first(a, b):
if (a, b) in prob_map:
return prob_map[(a, b)]
if a <= 0 and b > 0:
prob = 1
... | true |
56cd29aa93e19b3e26bfb55d7ebb7fc53164faf5 | Python | hoangth/conversation-analyzer | /src/util/statsUtil.py | UTF-8 | 4,292 | 2.515625 | 3 | [
"Apache-2.0"
] | permissive | # -*- coding: utf-8 -*-
import collections
import pandas as pd
import math
from datetime import datetime
import re
import statistics
import nltk
import numpy as np
def getCentralTendencyValuesFor(measures):
mean = measures.mean()
median = measures.median()
mode = statistics.mode(measures)
return mean,... | true |
dc902228054bcdd0e79c40b433b6581b4be900fa | Python | devthat/zipencrypt | /tests/python3/test_encryption.py | UTF-8 | 3,891 | 2.640625 | 3 | [
"MIT"
] | permissive | import io
import tempfile
import unittest
from test.support import TESTFN
from zipencrypt import ZipFile, ZipInfo, ZIP_DEFLATED
from zipencrypt.zipencrypt3 import _ZipEncrypter, _ZipDecrypter
class TestEncryption(unittest.TestCase):
def setUp(self):
self.plain = b"plaintext" * 3
self.pwd = b"pass... | true |
319c124ac52191cf46556d461188e7597d74567f | Python | z03h/ext-reactions | /discord/ext/reactioncommands/reactioncore.py | UTF-8 | 17,915 | 2.625 | 3 | [
"MIT"
] | permissive | import discord
from discord.ext import commands
from discord.ext.commands.converter import get_converter
from .utils import scrub_emojis
from .reactionerrors import ReactionOnlyCommand
__all__ = ('ReactionCommand',
'ReactionGroup',
'reaction_command',
'reaction_group',
'Rea... | true |
cfde41111c6132535989412c6e60e7a6fbc75969 | Python | sguberman/advent-of-code-2015 | /day01.py | UTF-8 | 1,151 | 3.8125 | 4 | [] | no_license | import unittest
class TestFinalFloor(unittest.TestCase):
known_pairs = {'(())': 0,
'()()': 0,
'(((': 3,
'(()(()(': 3,
'))(((((': 3,
'())': -1,
'))(': -1,
')))': -3,
... | true |
2a190a483fa29667b9978efe697f3bbb70573145 | Python | mitchr/euler | /26.py | UTF-8 | 908 | 3.546875 | 4 | [] | no_license | # github.com/mitchr/fraction
import math
def factorize(n):
primes = []
while n % 2 == 0:
primes.append(2)
n = n / 2
for i in range(3, int(math.sqrt(n))+1, 2):
while n % i== 0:
primes.append(int(i))
n = n / i
if n > 2:
primes.append(int(n))
return primes
def countElementInA... | true |
3adf7f1063c74b0fbd48c897fbe820f49eaa3da8 | Python | ShayK3113/build-craft | /main.py | UTF-8 | 6,368 | 2.875 | 3 | [
"MIT-feh"
] | permissive | import mcrcon
import config
import sys
import math
from PIL import Image
command_fill = "fill {x1} {y1} {z1} {x2} {y2} {z2} {block_name} replace"
command_setblock = "setblock {x} {y} {z} {block_name} replace"
rcon = mcrcon.MCRcon()
def piramyd(args):
if len(args) < 5:
print("usage: piramyd smallest x, sm... | true |
bcf97b93fb08477bdd410200fb270231941913d4 | Python | kgleijm/uPersistentData | /uPersistentDataHandler.py | UTF-8 | 6,038 | 3.15625 | 3 | [] | no_license | import json
print("test started ")
# "abstract" class to encapsulate variables and manage persistence by keeping a record on file
class Pdp:
# static dict keeping track of all Pdp values's
persistentData = dict()
def __init__(self, publicName, value):
# Read values from record on file
s... | true |
a475949db3ef49ae43cd8f0112afe72d1206c88e | Python | ITLTVPo/SimplePython | /SimplePython/Test.py | UTF-8 | 493 | 2.875 | 3 | [] | no_license | i1=2
i2=5
i3=-3
d1=2.0
d2=5.0
d3=-0.5
print(i1+(i2*i3))
print(i1*(i2+i3))
print(i1/(i2+i3))
print(i1//(i2+i3))
print(i1/i2+i3)
print(i1//i2+i3)
print("-13 4 1 1 -2.6 -3 ")
print("-"*20)
print(3+4+5/3)
print(3+4+5//3)
print((3+4+5)/3)
print((3+4+5)//3)
print("8.667 8 4 4")
print("-"*20)
print(d1+(d2*d3))
print(d1+d2*d3)... | true |
7e463c3012f6875731646ef569675d935a216f2a | Python | j-f1/unicodr | /dev/load.py | UTF-8 | 8,305 | 3.03125 | 3 | [] | no_license | import unicodedata, sys, threading
# from http://www.interclasse.com/scripts/spin.php, by Branimir Petrovic.
class ProgressBase(threading.Thread):
"""Base class - not to be instantiated."""
def __init__(self):
self.rlock = threading.RLock()
self.cv = threading.Condition()
threading.Thr... | true |
c42081047ba03a385658731250d986fb9a4a904f | Python | FreeManNumOne/PythonCode | /Passwd2.py | UTF-8 | 548 | 3.09375 | 3 | [] | no_license | #coding: utf8
import sys
from Crypto.Cipher import AES
from binascii import b2a_hex, a2b_hex
class prpcrypt():
def __init__(self, key):
self.key = key
self.mode = AES.MODE_CBC
#解密后,去掉补足的空格用strip() 去掉
def decrypt(self, text):
cryptor = AES.new(self.key, self.mode, self.key)
... | true |
9fe976db95cf5cf0a20e87585a557861d86cbc3d | Python | liuhz0926/algorithm_practicing_progress | /Data Structure/Hash Map/138/138_prefix_sum.py | UTF-8 | 951 | 3.625 | 4 | [] | no_license | class Solution:
"""
@param nums: A list of integers
@return: A list of integers includes the index of the first number and the index of the last number
"""
def subarraySum(self, nums):
# Prefix Sum 的方式:这里要记录初始0,
# hashset记录prefix sum:index的方式
# 这里只要是出现了一个prefixsum是前面出现过的(不一定... | true |
ebdc66877fc34ad847178d126993c6fd072aef58 | Python | OkabeRintarou/syl | /Python/Collections/BinarySearchTree.py | UTF-8 | 3,926 | 3.484375 | 3 | [] | no_license | class _Node(object):
def __init__(self, key=None, value=None):
self.key = key
self.value = value
self.left_child = None
self.right_child = None
self.parent = None
def set_left_child(self, left_child):
self.left_child = left_child
if left_child is not None... | true |
698bc79abfaf1c2bb0ad8a9b80b46742da93a8e0 | Python | chdinesh1089/zulip-archive | /lib/url.py | UTF-8 | 1,767 | 3.265625 | 3 | [
"MIT"
] | permissive | '''
Sometimes it feels like 80% of the battle with creating a
static website is getting all the URLs correct.
These are some helpers.
Here are some naming conventions for URL pieces:
zulip_url: https://example.zulip.com
site_url: https://example.zulip-archive.com
html_root: archive
And then URLs use Zul... | true |
5307b50192663094de415a3684bd0dd54c21059b | Python | Rajatbais1310/Python- | /Learning/Python Keywords.py | UTF-8 | 183 | 3.515625 | 4 | [] | no_license | a=10
b=20
# if a==10 and b==10:
# print("Both Are Equal")
# elif a>10 and b>10:
# print("A & B both are greater than 10")
# else:
# print("Illogical Value")
| true |
d203e87ac22d26c63214336c4aef5e51e9d7e200 | Python | PolinaDurdeva/ComputerVision | /t2.py | UTF-8 | 1,403 | 3.109375 | 3 | [] | no_license | import numpy as np
import cv2
import matplotlib.pyplot as plt
def equalization(img):
print "Equalization"
b = np.zeros(255)
r = np.zeros(img.shape)
p_count = 0
get_hist(img)
for i in range(img.shape[0]):
for j in range(img.shape[1]):
b[img[i][j]] += 1
p_count += ... | true |
8412accf8081b13d4b4b3319464f0feac4af4beb | Python | JingkaiTang/github-play | /own_problem_or_point/next_part_and_person/week/same_hand.py | UTF-8 | 211 | 2.828125 | 3 | [] | no_license |
#! /usr/bin/env python
def young_thing(str_arg):
small_company(str_arg)
print('few_company')
def small_company(str_arg):
print(str_arg)
if __name__ == '__main__':
young_thing('little_child')
| true |
019b6e07a7d9a72e51bdab5ce6c03aa77e02f82d | Python | EmersonBraun/python-excercices | /cod3r/banco_dados/delete_contacts.py | UTF-8 | 478 | 3 | 3 | [] | no_license | from mysql.connector.errors import ProgrammingError
from db import new_connection
sql = "DELETE FROM contacts WHERE name = %s"
with new_connection() as connection:
try:
name = input('Contacts to delete: ')
args = (f'{name}',)
cursor = connection.cursor()
cursor.execute(sql, args)
... | true |
1cc1b5b8c563f8cd6546d5a7cda93861fd7a1633 | Python | princeroshanantony/hacktoberfest | /Helloworld.py | UTF-8 | 82 | 2.640625 | 3 | [] | no_license | #add text to be printed in double quotes as it is string.
print("Hello World!")
| true |
6a94d27ebd8a2b5a41f54fbc7f7c3c8e1420d1e4 | Python | ozaenzenzen/clustering-implementasi-fcm-fsc | /FCM Version1_FauzanAM_1810511063.py | UTF-8 | 3,510 | 2.921875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Thu Nov 19 13:36:09 2020
@author: DELL
"""
#Fauzan Akmal Mahdi
#1810511063
from __future__ import division, print_function
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import skfuzzy as fuzz
#Jumlah cluster = c=2;
#Pangkat = w=2;
... | true |
5c711d491560deab40d083e407882b167da2ec4f | Python | MartinPSE/E.T.C | /Algorithm/Greedy/Greedy#4.py | UTF-8 | 1,588 | 3.859375 | 4 | [] | no_license | # <문제> 모험가 길드: 문제 설명
# 한 마을에 모험가 N 명이 있다. 모험가 길드에서는 N명의 모험가를 대상으로 '공포도' 를 측정했는데
# '공포도' 가 높은 모험가는 쉽게 공포를 느껴 위험 상황에서 제대로 대처할 능력이 떨어진다.
# 모험가 길드장인 형석이는 모험가 그룹을 안전하게 구성하고자 공포도가 X인 모험가는 X명 이상으로 구성한 모험가 그룹에 참여
# 형석이는 최대 몇개의 모험가 그룹을 만들 수 있는지 궁금하다. N 명의 모험가에 대한 정보가 주어졌을 때,
# 여행을 떠날 수 있는 그릅 수의 최댓값을 구하자.
# 예를 들어 N = 5 X(공... | true |
5169205a0a9bea14c5f51f0fb17337810fddbfd7 | Python | becodev/python-utn-frcu | /parciales/puntoUno.py | UTF-8 | 1,757 | 3.875 | 4 | [] | no_license |
import json
import requests
from consumo_api import get_charter_by_id, get_all_sw_characters
from random import randint
def puntoUno():
numero1 = randint(1, 83)
numero2 = randint(1, 83)
personaje1 = get_charter_by_id(numero1)
personaje2 = get_charter_by_id(numero2)
# cual es el personaje más alt... | true |
6aee2558d795ab6e79b90aab28236bfe4b0d453d | Python | judebattista/enigma | /enigma/PlugBoard.py | UTF-8 | 604 | 3.5 | 4 | [] | no_license | from collections import OrderedDict
class PlugBoard:
letters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'.lower()
def __init__(self, plugBoardPairs):
# the plug board is originally set up as a mapping from each letter to itself.
self.plugBoardMapping = OrderedDict({ char.lower(): char... | true |
1bbec7de402fbd4103c7cdca979256d57c121dd7 | Python | ClearAerospace/faa-aircraft-registry | /faa_aircraft_registry/engines.py | UTF-8 | 922 | 2.859375 | 3 | [
"MIT"
] | permissive | import csv
from faa_aircraft_registry.types import EngineDictType
from faa_aircraft_registry.utils import transform
fieldnames = ['code', 'manufacturer',
'model', 'type', 'power_hp', 'thrust_lbf']
def read(csvfile):
"""
This function will read the ENGINE.txt csv file passed as a handle and ret... | true |
bf52fd349bbede0e6f0f55837ddff9e26f3a6c35 | Python | gzuidhof/text-mining | /project/src/dataset.py | UTF-8 | 2,916 | 2.671875 | 3 | [] | no_license | import numpy as np
import pickle
from sklearn.cross_validation import train_test_split
DATA_FOLDER = '../data/'
PROCESSED_FOLDER = '../data/processed/'
def create_dictionary():
pass
def split_dataset(force_manual_evaluation_into_test=True):
with open(DATA_FOLDER+'labels_int.p', 'r') as f:
y_dict = pi... | true |
5ad706faf27f34d40718f4ce552f2c2777f56776 | Python | DAVILA31/django-webinscripcion | /webinscripcion/inscripcion/models.py | UTF-8 | 26,809 | 2.5625 | 3 | [] | no_license | from django.db import models
from django.contrib.auth.models import User
# Create your models here.
class UpperCaseCharField(models.CharField):
def __init__(self, *args, **kwargs):
super(UpperCaseCharField, self).__init__(*args, **kwargs)
def pre_save(self, model_instance, add):
value = geta... | true |
112d3a302d19c73830d3ee2cf4e80b3df82cb342 | Python | lockhartey/leetcode | /387.first-unique-character-in-a-string.py | UTF-8 | 317 | 3.03125 | 3 | [] | no_license | #
# @lc app=leetcode id=387 lang=python3
#
# [387] First Unique Character in a String
#
from collections import Counter
class Solution:
def firstUniqChar(self, s: str) -> int:
d = Counter(s)
for c,count in d.items():
if count==1:
return s.index(c)
return -1
| true |
99d460830afb76dc044e5aa3144636bb0bb0e62e | Python | pranaypushkar/TryingPython | /Day 2/Fun.py | UTF-8 | 159 | 3.34375 | 3 | [] | no_license | def total (a = 0, b = 0, c = 0, d = 0):
return (a + b + c + d)
print(total())
print(total(10))
print(total(10, 20, 30))
print(total(10, 20, 30, 40))
| true |
061ebd6838b377c4f9323b00ca9870bf4801e9a0 | Python | anymavpochka/dbisworkshops | /Майстренко Ганна/Workshop5/telegabot.py | UTF-8 | 15,931 | 2.90625 | 3 | [] | no_license | import telebot
import database_connection
import db_classes
import check_function
bot = telebot.TeleBot('1240952041:AAGgpZ6C_-Ttga9fFgFKgdFImeV6GLcjd1s')
from telebot import types
@bot.message_handler(commands=['start'])
def handle_text(message):
keyboard1 = telebot.types.ReplyKeyboardMarkup()
... | true |
c3ef58f9e2b218913638391d35870caa4e5a0244 | Python | ImScientist/challenge-03 | /ta/calibration/calibration_curve.py | UTF-8 | 1,682 | 2.828125 | 3 | [] | no_license | import matplotlib.pyplot as plt
from sklearn.calibration import calibration_curve
from sklearn.metrics import brier_score_loss
def get_calibration_figure(model_calibrated, model, x, y, name):
prob_pos = model_calibrated.predict_proba(x)[:, 1]
prob_pos_orig = model.predict(x)
clf_score = brier_score_loss(... | true |
6acc09354d0e66e2401132ab5ee3c3351ca3dec4 | Python | RajeshwariCh/BigDataProgramming | /Module2/SP7/M2ICP7/kmeans.py | UTF-8 | 1,200 | 2.703125 | 3 | [] | no_license | from pyspark.sql import SparkSession
from pyspark.sql.functions import col
from pyspark.ml.clustering import KMeans
from pyspark.ml.feature import VectorAssembler
import sys
import os
os.environ["SPARK_HOME"] = "C:\\spark-2.3.1-bin-hadoop2.7"
os.environ["HADOOP_HOME"]="C:\\winutils"
# Create spark session
spark = Sp... | true |
fb83a066a6eec0a63cb3d72d2615ff122eb295be | Python | hanpengwang/ProjectEuler | /30 (Digit fifth powers).py | UTF-8 | 438 | 3.53125 | 4 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Nov 15 22:02:03 2019
@author: hanpeng
"""
def fifthPower(n):
return sum([int(i)**5 for i in str(n)])
def digitFifthPower():
upperBound = 9**5*6
total = 0
while upperBound > 2:
if upperBound == fifthPower(upperBound):
... | true |
9234e632501a76dda36916f76914515d357b14e4 | Python | reconstruir/bes | /tests/lib/bes/common/test_type_checked_list.py | UTF-8 | 3,101 | 2.890625 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/env python
#-*- coding:utf-8; mode:python; indent-tabs-mode: nil; c-basic-offset: 2; tab-width: 2 -*-
from bes.testing.unit_test import unit_test
from bes.common.type_checked_list import type_checked_list
from bes.system.compat import compat
from bes.compat.cmp import cmp
from collections import namedtuple
... | true |
2fbf593e18641eee074e85cd6e2c8789598f1fac | Python | andpuc23/Kursach_v3 | /Server/NeuralNetwork/CMAC_new.py | UTF-8 | 4,436 | 2.875 | 3 | [] | no_license | import matplotlib
from oct2py import octave
from oct2py import Oct2Py
import numpy as np
oc = Oct2Py()
string = """
classdef CMAC
% класс для нейронной сети CMAC
%
% net=CMAC(r,mu);
%
% ЌейроннаЯ сеть обладает свойствами:
% r параметр "ро"
% памЯть нейронной сети предс... | true |
3a027142eb4ec5571095659f4e93c04146b92c6c | Python | Metalscreame/Python-Exercise | /Guessing_Game_1.py | UTF-8 | 2,148 | 4.40625 | 4 | [] | no_license | #Generate a random number between 1 and 9 (including 1 and 9). Ask the user to guess the number, then tell them whether they guessed too low, too high, or exactly right.
# (Hint: remember to use the user input lessons from the very first exercise)
#Extras:
#Keep the game going until the user types �exit�
#Keep tr... | true |
f85876f982615df06035650c80f6c872062544f0 | Python | HatsuneMiku3939/bandit-algorithm | /lib/arms/bernoulli.py | UTF-8 | 230 | 3.203125 | 3 | [] | no_license | import random
class BernoulliArm(object):
def __init__(self, probability):
self.probability = probability
def draw(self):
if random.random() > self.probability:
return 0.0
return 1.0
| true |
a3e1da9261094b9bd2ed4712cf54ba6207a45eeb | Python | zhyordanova/Python-Basics | /Exam-Preparation/movie_profit.py | UTF-8 | 340 | 3.953125 | 4 | [] | no_license | name = input()
days = int(input())
tickets = int(input())
ticket_price = float(input())
percent_cinema = float(input())
price_day = tickets * ticket_price
total_price = days * price_day
percent_profit = total_price * percent_cinema / 100
profit = total_price - percent_profit
print(f'The profit from the movie {name} i... | true |
4ff8e080976ccbb3b27ac0d66acf9032e7c910bb | Python | will9901/Prediction-framework | /popularity_embedding.py | UTF-8 | 717 | 3.234375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
# 作者 :HuangJianyi
'''
These codes work for embedding popularity information.
Given a hashtag, the output embedding contains the cumulative popularity
of a given time step.
'''
# returns a list containing one element
def make_embedding(hashtag, time_step):
output = [-1]
for line in o... | true |
b9f70c2c6477307b37f3be13adb885495aeb15dc | Python | daunjeong824/Practice_Algorithm | /Greedy/muji_mukbang_live.py | UTF-8 | 1,349 | 3.484375 | 3 | [] | no_license | import heapq
k = int(input())
food_times = list(map(int,input().split()))
def solution(food_times, k):
# 전체 음식 먹는 time <= k -> -1
if sum(food_times) <= k:
return -1
# 시간이 작은 음식부터 Greedy하게 뺀다. -> 우선순위 큐
q = []
for i in range(len(food_times)):
# (food_time, food_num) queue insert ... | true |
475a61d3805261ca78af6c1a9213adc73a360221 | Python | imran273/SeleniumPycharmProjects | /PythonBasics/Types.py | UTF-8 | 1,484 | 4.46875 | 4 | [] | no_license | #Given Variables
a = 1
b = 1.2
c = 5j
d = "a"
e = "Python"
f = True
#************************************************************************
print(type(a)) # int
print(type(b)) # float
print(type(c)) # complex
print(type(d)) # String
print(type(e)) # String
print(type(f)) # boolean
#***************************... | true |
eccffc635ba12ae1b984c33296e89a2d3759f777 | Python | PeyWn/tdda69 | /Lab5/Lab5/src/GC/mark_sweep.py | UTF-8 | 977 | 2.984375 | 3 | [] | no_license | from .header import *
from .pointers_array import *
class mark_sweep(object):
def __init__(self, heap):
self.heap = heap
# This function should collect the memory in the heap
def collect(self):
self.mark(0)
header_ptr = 0
while(header_ptr != -1):
if not header_get_garbage_flag(self.heap.d... | true |
1fb1d39551c9742b3b168b40ff84fd216a45317d | Python | maya98kg/unit2 | /hex.py | UTF-8 | 867 | 3.65625 | 4 | [] | no_license | def to_hex(n):
if(n<10):
return n
elif(n<16):
return digit(n)
else:
result=digit(n//16)+digit(n%16)
return result
def digit(x):
if(x<10):
return str(x)
elif x==10:
return 'a'
elif x==11:
return 'b'
elif x==12:
return 'c'
el... | true |
8fd1f9f911f18574308d0e1302db9d3a1862d33b | Python | Peccer/gilfoyle | /gilfoyle/report.py | UTF-8 | 12,612 | 2.84375 | 3 | [
"MIT"
] | permissive | import os
import re
import numpy as np
import pandas as pd
from weasyprint import HTML
from jinja2 import Environment
from jinja2 import FileSystemLoader
class Report:
def __init__(self,
output,
template='assets/template.html',
base_url='.'
):
... | true |
1cff7cd5508f0061ae756d30dec273aa0bdad913 | Python | HawaiiGuitar/nadbg | /nadbg.py | UTF-8 | 9,797 | 2.546875 | 3 | [] | no_license | import os
from time import sleep
from time import ctime
from welprompt import CLUI
from proc import Proc
from proc import getpids
DEFAULT_INTERVAL = 1
# these codes for debug
from IPython import embed
import traceback as tb
import sys
def excepthook(type, value, traceback):
tb.print_last()
embed()
sys.excep... | true |
c4d33e5946a02739d7ca0b9b842ee4941266b3b0 | Python | aredoubles/data_dive_adl | /ScrapersAndMergerTools/NYTHate.py | UTF-8 | 753 | 2.890625 | 3 | [
"MIT"
] | permissive | import newspaper
import pandas as pd
urls = open('nyt-hate-urls.txt')
urls = [x.rstrip() for x in urls]
def full_text(url):
a = newspaper.Article(url)
a.download()
a.parse()
return a.text
def main():
columns=['url', 'text', 'source', 'label']
source = 'nytimes.com'
label = True
res =... | true |
a0b58fb53e4d06ffd03b134fdaf904f8b7379cfc | Python | cs-fullstack-2019-fall/python-basics1-cw-Dekevion | /index.py | UTF-8 | 1,375 | 4.875 | 5 | [
"Apache-2.0"
] | permissive | # exercise 1
#Create two variables. One should equal “My name is: “
# and the other should equal your actual name.
# Print the two variables in one print mess
name = ('My name is: ')
first = ('Dekevion')
sentence = print(name + first)
# exercise 2
# Ask the user to enter the extra credit they earned.
# If they ... | true |
3fd7753154f4679754992bc882c2a018aaf4ef19 | Python | claudiordgz/GoodrichTamassiaGoldwasser | /ch01/r11.py | UTF-8 | 846 | 4.125 | 4 | [
"MIT"
] | permissive | """Write a short Python function, is_multiple(n, m), that takes two integer
values and returns True if n is a multiple of m, that is, n = mi for some
integer i, and False otherwise.
>>> is_multiple(50,3)
False
"""
def is_multiple(n, m):
"""Return True if n is multiple of m such that n = mi
Else returns False
... | true |
587cc4f37e9a79767cf0491c6e3e65772480d84c | Python | mantisa1980/nk2016 | /doc/question/parse_question.py | UTF-8 | 3,095 | 3.09375 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import io
import random
from random import shuffle
import json
'''
clean procedure:
1. open with numbers app
2. delete column 5 if all empty
3. save as csv and encoding with utf-8
'''
input_file = "1000.numbers.csv"
clean_file = "{}_clean.csv".format(input_file)
shuffle_fi... | true |
2ace9d4ad0f524943f4bbab239585eedbf81d416 | Python | SouthCoded/Cyber-Security | /EasyCTF/soupstitution.py | UTF-8 | 920 | 3.1875 | 3 | [] | no_license | #!/usr/bin/env python3
from binascii import unhexlify
from operator import attrgetter
ME_FLAGE = '<censored>'
def first(var):
soup = 0
while var != 0:
soup = (soup * 10) + (var % 10)
var //= 10
return soup
def second(var):
soup = 0
for soUp in var:
soup *= 10
so... | true |
b16821bdfd3d8b675e60ca2435ea6429bae5e241 | Python | juno7803/Algorithm_Python | /코테 스터디/class2/10814 나이순 정렬/10814.py | UTF-8 | 233 | 3.1875 | 3 | [] | no_license | from sys import stdin
input = stdin.readline
n = int(input())
arr = []
for i in range(n):
arr.append(input().split())
arr[i].append(i)
arr.sort(key=lambda x: (int(x[0]), x[2]))
for ele in arr:
print(' '.join(ele[:2]))
| true |
4052a5588f68ecbd17b4d7ff8bfe87985059e372 | Python | ic-mmxai/mmxai | /tests/mmxai/interpretability/classification/torchray/extremal_perturbation/custom_mmbt_test.py | UTF-8 | 2,157 | 2.53125 | 3 | [
"MIT"
] | permissive | # TODO: could use mock objects to improve test efficiency
from mmxai.interpretability.classification.torchray.extremal_perturbation.custom_mmbt import MMBTGridHMInterfaceOnlyImage
from mmf.models.mmbt import MMBT
import torch
from PIL import Image
import requests
def testObjectInitiation():
try:
model ... | true |
80abb412030276e2e16b1a120a6257ff7a3b7b40 | Python | ShouldChan/Flickr_take_PIC | /process_findLost.py | UTF-8 | 360 | 2.625 | 3 | [] | no_license | # coding: utf-8
# 剔除无效图片
import os
CITY_NAME = 'Edin'
MAX_NUM = 33866
pic_dir = './pic_' + CITY_NAME + '/'
fwrite = open('./' + CITY_NAME + '_LOST.txt', 'a+')
for x in range(1, MAX_NUM):
filePath = pic_dir + '%s.jpg' % x
if os.path.isfile(filePath):
print 'yep!'
else:
fwrite.write(str(x)... | true |
7f8af7c482d443ddb9d5fe35af6ac8357867fad3 | Python | Djet78/hillel_homework_repository | /homework_18.py | UTF-8 | 318 | 3.84375 | 4 | [] | no_license | # ---------------------- homework_17 ------------------------
def sum_symbol_codes(first, last):
"""
:return: Int. Total sum of symbols unicodes
"""
total_sum = 0
for unicode in range(ord(first), ord(last)+1):
total_sum += unicode
return total_sum
print(sum_symbol_codes("x", "x"))
| true |
de7f52ac52b55d1bcf59b858a881447dfb91662e | Python | kamil-nowowiejski/ObjectsDetection | /ImageProcessing/CommonOperator.py | UTF-8 | 5,147 | 3.21875 | 3 | [] | no_license | import cv2
import numpy as np
from DataModel.enums import Color
class CommonOperator:
def __init__(self):
self.min_color_bound_hsv = None
self.max_color_bound_hsv = None
self.red_bound = None
self.yellow_bound = None
self.green_bound = None
self.blue_bound = None
... | true |
bef8f6944d3f93ad615ccba4cca06ca7bf0cf367 | Python | budsonjelmont/miscellaneousPython | /examine autofill logs.py | UTF-8 | 593 | 2.75 | 3 | [] | no_license | from os import listdir
from os.path import isfile, join
import csv
logfolderpath = 'C:/Users/superuser/Documents/AutoFillLogs'
logfiles = [f for f in listdir(logfolderpath) if isfile(join(logfolderpath, f))]
for log in logfiles:
with open(join(logfolderpath, log), 'r') as f:
reader = csv.reader(f, delim... | true |
93797fc5beab1b53984211679a7aa43d89e4bbb4 | Python | reviakin/pi | /test_divisible.py | UTF-8 | 256 | 2.53125 | 3 | [] | no_license | import unittest
from divisible import divisible
class TestDivisible(unittest.TestCase):
def test_divisible(self):
self.assertTrue(divisible(20, 10))
self.assertFalse(divisible(2, 3))
if __name__ == '__main__':
unittest.main()
| true |
6a0a4cb789711ff99b405ad962d5e51f10aea522 | Python | linwiker/learpython | /python3/class_demo/decorator_demo.py | UTF-8 | 446 | 2.734375 | 3 | [] | no_license | #/usr/bin/env python
# -*- coding: utf-8 -*-
def inject_user(default_user):
def inject(fn):
def wrap(*args,**kwargs):
if 'user' not in kwargs.keys():
kwargs['user'] =default_user
return fn(*args,**kwargs)
return wrap.__closure__
return wrap
ret... | true |