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
6268070d05e209e68a12bd47a6eba6dfa6fc8ca5
Python
PabloSzx/Torneo-Programacion
/Stacks of Flapjacks/flip.py
UTF-8
798
3.234375
3
[]
no_license
pila = input() lista_pila = pila.split(); lista_pila = transformar_lista(lista_pila) lista_pila_duplicada = duplicar_lista(lista_pila) ordenado = True while (ordenado): indice = lista_pila.index(max(lista_pila)) if (indice != (len(lista_pila) - 1) or indice != 0): lista_pila = flip(lista_pila, indice...
true
49ca82fdea7d5f7e275535371bef4ee5b783fcef
Python
chickenThug/chess
/game.py
UTF-8
383
2.953125
3
[]
no_license
from board import Board from piece import Piece import move_generator import re import copy turn = True b = Board() b.print_board() while True: requested_move = input('move: ') for move in move_generator.generate_moves(b, turn): if requested_move == move[1]: b.make_move(move) tu...
true
1aa9d98e0cb161241a199e414ea90502264ff792
Python
lzhang1/HelloWorldII
/listing_23-2.py
UTF-8
1,207
3.546875
4
[]
no_license
# Listing_23-2.py # Copyright Warren & Csrter Sande, 2013 # Released under MIT license http://www.opensource.org/licenses/mit-license.php # Version $version ---------------------------- # Rolling two 6-sided dice 1,000 times import random # totals = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] # for i in range(1000): ...
true
7056a61e07c1ae8f1285d16da9f86c43d073e82d
Python
Team-Hydra-Hacking/Python3-NoXss
/model.py
UTF-8
3,132
2.671875
3
[ "MIT" ]
permissive
#!/usr/bin/python2.7 # -*- encoding: utf-8 -*- """ @Description: Models used. ~~~~~~ @Author : longwenzhang @Time : 19-8-19 3:13 """ import json class HttpRequest(): def __init__(self,method,url,headers,body=''): self.method=method self.url=url self.headers=headers ...
true
430cd82ac26c274505d3bb49ef78d495698a2699
Python
dk-yoon/Algorithm
/Software Expert Academy/Difficulty (4)/SWEA4613 - 러시아 국기 같은 깃발.py
UTF-8
865
3.03125
3
[]
no_license
''' SWEA4613 - 러시아 국기 같은 깃발 (D4) ''' T = int(input()) for t in range(1, T + 1): N, M = map(int, input().split()) flag = [input() for _ in range(N)] W = [0] * N B = [0] * N R = [0] * N for i in range(N): for j in range(M): if flag[i][j] != 'W': W[i] += 1 ...
true
776d184daf3114e1190766bc7addaf369501f02b
Python
koushik23/oop
/oop_submissions/oop_assignment_009/pokemen.py
UTF-8
5,840
3.234375
3
[]
no_license
class pokemen: sound = "s" running = "r" swimming = "ju" flying = 10 def __init__(self,name,level=1): if len(name)<=0: raise ValueError ("name cannot be empty") else: self._name = name if level<=0: raise ValueError ("level should be > ...
true
b6b0f679fc916efcdaa371ba604d5fff717b653d
Python
amoliu/Multi-Agent-Reinforcement-Learning-in-Stochastic-Games
/pybrainSG/rl/experiments/episodicSG.py
UTF-8
1,478
2.6875
3
[]
no_license
''' Created on 2016/02/19 @author: takuya-hv2 ''' __author__ = 'Takuya Hiraoka, takuya-h@is.naist.jp' from pybrain.rl.experiments.experiment import Experiment from pybrainSG.rl.agents.multiAgent import MultiAgent from pybrainSG.rl.environments.episodicSG import EpisodicTaskSG class EpisodicExperimentSG(Experiment): ...
true
97d5bf56a2a359b75fd25bf2155ebd8a61455299
Python
bangalcat/Algorithms
/algorithm-python/boj/boj-11005.py
UTF-8
361
3.15625
3
[]
no_license
n, b = map(int, input().split(' ')) t = [] while n: t.append(n % b) n //= b t.reverse() l = ''.join([chr(i - 10 + ord('A')) if i >= 10 else str(i) for i in t]) print(l) def conv(number, base): T = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ" i, j = divmod(number, base) if i==0: return T[j] e...
true
a2eb1f5554ffe78708f5b7adace1aec4d987f76d
Python
shambhand/pythontraining
/material/code/advanced_oop_and_python_topics/1_IteratorAndGenerator/IteratorProtocolDemo3.py
UTF-8
352
3.34375
3
[]
no_license
#! /usr/local/bin/python3 import sys def main (): # What happens when # for key in D: # print ("key:", key, "D[key]:", D[key]) D = {"a":1, "b":2, "c":3} d_it = dict.__iter__(D) while True: try: k = d_it.__next__() except StopIteration: break print ("key:", k, "value:", dict.__getitem__(D, k...
true
e755d9ad53bdc408afa2ddc2a4547fffe6832b59
Python
francisrc/anpylar
/anpylar/observable_operators.py
UTF-8
11,518
2.671875
3
[ "MIT" ]
permissive
############################################################################### # Copyright 2018 The AnPyLar Team. All Rights Reserved. # Use of this source code is governed by an MIT-style license that # can be found in the LICENSE file at http://anpylar.com/mit-license ################################################...
true
1469742f2861845a151ec5f9aa7793ce949cc908
Python
NiuNiu-jupiter/Leetcode
/Premuim/261. Graph Valid Tree.py
UTF-8
1,600
3.78125
4
[]
no_license
""" Given n nodes labeled from 0 to n-1 and a list of undirected edges (each edge is a pair of nodes), write a function to check whether these edges make up a valid tree. Example 1: Input: n = 5, and edges = [[0,1], [0,2], [0,3], [1,4]] Output: true Example 2: Input: n = 5, and edges = [[0,1], [1,2], [2,3], [1...
true
958c5d3dd3d605912e4bf0542629dd47d63b3cf2
Python
alaiacano/alaiacano.github.io
/code_examples/linked_list/tasks.py
UTF-8
2,241
3.703125
4
[]
no_license
import logging from abc import ABC, abstractmethod from copy import copy from ll import LinkedList, Node from typing import List, Optional logging.basicConfig(level="INFO") def task_factory(action: str, name: str, lst: LinkedList): """ For the given `action`, produces the appropriate subclass of `Task`. ...
true
c1b80ccf767a8f3821b5d916b7f712bfe238e069
Python
laserson/numba
/oldnumba/minivect/tests/test_operators.py
UTF-8
1,462
2.59375
3
[ "BSD-2-Clause" ]
permissive
# -*- coding: utf-8 -*- from __future__ import print_function, division, absolute_import from .llvm_testutils import * def build_expr(type, op): out, v1, v2 = vars = build_vars(type, type, type) expr = b.assign(out, b.binop(type, op, v1, v2)) return vars, expr def build_kernel(specialization_name, ndim, ...
true
435e75706e075b6e6bf6857d3a164602952d2dce
Python
ABCmoxun/AA
/AB/linux2/day19/student_project/student.py
UTF-8
549
3.34375
3
[]
no_license
# student.py # 此模块用来描述学生对象 class Student: def __init__(self, n, a, s): self.__name = n self.__age = a self.__score = s def get_infos(self): return (self.__name, self.__age, self.__score) def get_age(self): return self.__age def get_score(self): return...
true
a90bed9243922aff7df5e765378c58cac0abd284
Python
mohamed-elghayesh/LearningPython
/Python/ExamScore.py
UTF-8
224
3.375
3
[]
no_license
print ("Exam1 score:") ex1_score=float(input())*0.3 print ("Exam2 score:") ex2_score=float(input())*0.3 print ("Exam3 score:") ex3_score=float(input())*0.4 final=ex1_score+ex2_score+ex3_score print ("Final Score= ",final)
true
6c48c625b9ba1b11e5c3552aeea62090a1384849
Python
christiejibaraki/design-patterns
/src/main/python/decorator/starbuzz/decorator_pattern.py
UTF-8
1,593
3.671875
4
[]
no_license
import abc class Beverage(metaclass=abc.ABCMeta): """ 'Component' Object Define the interface for objects that can have responsibilities added to them dynamically """ def __init__(self): self.description = "Unknown Beverage"; def get_description(self): return self.descrip...
true
5f320d2d4f8d148f7e5cff32ca3154b233ffb131
Python
huboa/xuexi
/cmdb_v1/app01/tests.py
UTF-8
1,085
2.953125
3
[]
no_license
import re #简单的匹配给定的字符串是否是ip地址,下面的例子它不是IPv4的地址,但是它满足正则表达式 if re.match(r"^(?:[0-9]{1,3}\.){3}[0-9]{1,3}$", "272.168,1,1"): print("IP vaild") else: print("IP invaild") #精确的匹配给定的字符串是否是IP地址 if re.match(r"^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$", "223.168.1.1"): ...
true
f3d69a069282ab33084cd6f0c8934a166f9f2c0f
Python
tranthanhtrung/research
/big-o/Final/Freckles.py
UTF-8
1,053
3.109375
3
[]
no_license
import queue import math INF = 1e9 class Node: def __init__(self, id, dist): self.dist = dist self.id = id del __lt__(self, other): return self.dist <= other.dist def prims(src): pq = queue.PriorityQuere() pq.put(Node(src, 0)) dist[src] = 0 while not pq.empty(): top = pq.get() u = top.id visited[u] ...
true
9ebf6c58900126777736b2d5fadc0967aa469c92
Python
emiliobort/python
/Practica3/Programas/Ejercicio6.py
UTF-8
726
3.453125
3
[]
no_license
##entero = -1 ##entero3 = "" ##lista = [] ## ##while entero < 0: ## entero = int(input("Dame un numero entero > 0: ")) ## ##entero2 = str(entero) ## ##for i in entero2: ## lista.append(int(i)) ## ##print(lista) ## ##for i in lista: ## entero3 = entero3 + str(i) ## ##int(entero3) ## ##print(entero3) entero = -...
true
d274de1b03fe6ca9897b90a857f4cb1a390f335a
Python
CycleRank/cyclerank-dev
/utils/wilcoxon_test.py
UTF-8
1,478
2.984375
3
[ "MIT" ]
permissive
#!/usr/bin/env python3 import argparse import pathlib import scipy from scipy.stats import wilcoxon, normaltest, ttest_1samp import numpy as np if __name__ == '__main__': parser = argparse.ArgumentParser( description="Wilcoxon test for See Also" ) parser.add_argument("input", ...
true
8002ba3806d84cb2e58d371b79a31ed6b5dabb66
Python
Jozelle97/ML-Tutorial-Edureka
/MLTutorial_Sample1.py
UTF-8
2,262
2.796875
3
[]
no_license
import sys import scipy import numpy import matplotlib import pandas import sklearn from pandas.plotting import scatter_matrix import matplotlib.pyplot as plt from sklearn import model_selection from sklearn.metrics import classification_report from sklearn.metrics import confusion_matrix from sklearn.metrics import ac...
true
8b914245965bd601a8163eef5e810da1b9fdc49c
Python
IoanaMMT/dungeon
/dungeon_game.py
UTF-8
2,116
4
4
[]
no_license
import os import random # draw grid # pic random location for player # pic random location for the door # pic random location for the monster # draw the player in the grid # take input for movement # move player, unless invalid move (pass edges of grid) # check for win/loss # clear the screen and redraw the grid CEL...
true
2d19ffb1d4554a3a764235af7f14912f9e636716
Python
haibinj/lecture_notes
/lecture_python/test3.py
UTF-8
1,637
4.09375
4
[]
no_license
def fib(n): result = [] a,b = 0,1 while a < n : result.append(a) a, b = b, a+b return result print(fib(2000)) ## while is a loop. ## append() adds a object to the existing object array. print("\n") a = 1.3 b = 2 - 0.7 if (a == b): print("haha") a = 10/3 b = 3.333333 if (a == b...
true
f52e306698959accbf1fb0929f7e13a887bb4bf7
Python
ksvyatov/chart-recognizer
/arearecognizer/.ipynb_checkpoints/area-checkpoint.py
UTF-8
8,012
2.546875
3
[]
no_license
import numpy as np import tensorflow as tf from tensorflow.python.keras.preprocessing.image import load_img from tensorflow.python.keras.models import load_model from matplotlib import pyplot as plt import cv2 import math import recognizer.plots as pt print(cv2.__version__) n_channels = 3 CLASS_NAMES = ["Title", "xda...
true
c578e22b1aee2275b88072ee4b480de3648f71e3
Python
nyuxz/CodePractice
/225_Implement_Stack_using_Queues.py
UTF-8
1,632
4.34375
4
[]
no_license
# 225. Implement Stack using Queues # https://leetcode.com/problems/implement-stack-using-queues/description/ ''' operations of queue following: push(x) – Push element x to the back of queue. pop() – Removes the element from in front of queue. peek() – Get the front element. empty() – Return whether the queue is empty...
true
6fd277b14f93e526e001734c6db582937d61a0b7
Python
Navbryce/the-recommender
/recommender/api/utils/http_exception.py
UTF-8
1,463
2.65625
3
[]
no_license
from dataclasses import dataclass from enum import Enum from typing import Dict, Optional from recommender.data.serializable import serializable_persistence_object class ErrorCode(Enum): INVALID_ELECTION_STATUS = "INVALID_ELECTION_STATUS", 409 NO_BUSINESSES_FOUND = "NO_BUSINESSES_FOUND", 404 NO_ELECTION_...
true
9d358ae00b5715b4926a09a2caac0798b8dde95c
Python
ymzk/AiContest2012
/AiContest2012/mythreading/synchronized_queue.py
UTF-8
1,608
3.203125
3
[]
no_license
from threading import Lock class SynchronizedQueue: def __init__(self, maxSize = -1): self._lock = Lock() self._data = [] self._maxSize = maxSize def push(self, obj): if self.full(): return False self._lock.acquire() try: self....
true
31b992b6d34ed518ccc86747144e9807ca9d3ecb
Python
coredamage/malspider
/malspider/analysis/parse/DomParser.py
UTF-8
4,794
2.546875
3
[ "BSD-2-Clause" ]
permissive
# # Copyright (c) 2016-present, Cisco Systems, Inc. All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. # import re from scrapy.selector import Selector from scrapy.contrib.loader import XPathItemLoader class Dom...
true
9fc32b550fb9b515cd5628e80c4fdd2ee1762c4e
Python
gschen/sctu-ds-2020
/1906101096-李燃/第二次课/Day0227/作业3.py
UTF-8
348
4.03125
4
[]
no_license
#(使用def函数完成)找出传入函数的列表或元组的奇数位对应的元素,并返回一个新的列表 # 样例输入 # 1,2,3,4,5,6,7 # 样例输出 # 1, 3, 5, 7 def h(li): list1=[] for index in range(len(li)): if index % 2 != 1: list1.append(li[index]) return list1 print(h([1,2,3,4,5,6,7]))
true
673761da8f93f26c0d5f780591d768214b96c2e3
Python
oscar7692/ai_course
/TensorFlow/linear_regresion.py
UTF-8
1,046
2.96875
3
[]
no_license
import tensorflow.compat.v1 as tf tf.disable_v2_behavior() import matplotlib.pyplot as plt import numpy as np import os # Just disables AVX/FMA warning os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' # creating array datos_x = np.linspace(0,10,10) + np.random.uniform(-1,1,10) datos_y = np.linspace(0,10,10) + np.random.unifo...
true
3b8472420fb7db2d14e2b515821349684e1040fa
Python
LiuyangJLU/Dementia
/1117MIC.py
UTF-8
5,870
2.53125
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Fri Nov 17 09:08:05 2017 @author: ly """ import numpy as np import pandas as pd import os import seaborn as sns # data visualization library import matplotlib.pyplot as plt import xgboost as xgb from sklearn.model_selection import KFold from sklearn.svm import SVC from sklearn...
true
04e7422b06b71fef119bd7ff073d33ab064edf73
Python
albul-k/python_checkio
/sort-array-by-element-frequency.py
UTF-8
2,897
4.21875
4
[]
no_license
""" Sort the given iterable so that its elements end up in the decreasing frequency order, that is, the number of times they appear in elements. If two elements have the same frequency, they should end up in the same order as the first appearance in the iterable. Input: Iterable Output: Iterable Precondition: elemen...
true
95ad6cdfa1bab632510fd6d31ec9ddbd3fed63f3
Python
eglrp/optispline
/tests/test_to_string.py
UTF-8
6,907
3
3
[]
no_license
#!/usr/bin/env python import os import random from helpers import * class Test_to_string(BasisTestCase): def test_MonomialMasis(self): b = MonomialBasis(3) b_type = b.type() b_string = b.to_string() print b_string self.assertEqual(b_type, 'MonomialBasis') self.a...
true
db55ab0ddf32b8ddc854453b1cfce4fed6a9e42c
Python
Leusd/LAB-EXP-3
/FinderRepo.py
UTF-8
948
2.765625
3
[]
no_license
import csv import xml.etree.ElementTree as ET root = ET.parse('PostFiltrado.xml').getroot() fileBase = open("base.csv", 'r', encoding="utf8") base = csv.reader(fileBase) fileFinal = open("final.csv", 'w', newline='', encoding="utf8") final = csv.writer(fileFinal) final.writerow(('owner/login', 'name', 'stargazers/to...
true
6afecf92a129e467e2143df707d867e1c0f1fc39
Python
SageCloud/kazoo
/kazoo/handlers/gevent_pqueue.py
UTF-8
6,147
2.953125
3
[ "Apache-2.0" ]
permissive
"""Implement a peekable queue for gevent 0.13""" from __future__ import absolute_import import sys from gevent.timeout import Timeout from gevent.hub import get_hub, Waiter, getcurrent, _NONE from gevent.queue import ( Empty, Full, ItemWaiter, Queue ) # No peek method on queue in 0.13, so add one fr...
true
916a4c17756d1fbf74cd9df8dff62b60a9f21650
Python
longg99/CLI-Personal-Calendar
/Calendar project/Calendar.py
UTF-8
20,678
4.09375
4
[]
no_license
import os ''' IMPORTANT NOTE: Do NOT change any of the function names or their signatures (the parameters they take). Your functions must behave exactly as described. Please check correctness by running DocTests included in function headers. You may not use any print or input statements in your code. Manage a calend...
true
6791ab87eb43cc68761d17f962c9caca045027e3
Python
saumiko/Car-Recognition
/prepare_meta.py
UTF-8
4,867
2.65625
3
[]
no_license
import os import shutil import csv from random import shuffle from bs4 import BeautifulSoup # Set % ratio training = 60 validation = 20 test = 20 # input path input_dir = 'newannos/' output_dir = os.path.join(input_dir, 'output') if os.path.exists(output_dir): shutil.rmtree(output_dir) os.makedirs(output_dir) c...
true
41ec5acc2d9d560bf88e510d7b838a033e173436
Python
AmithRV/Steganography
/img_stego_V6.py
UTF-8
3,635
2.96875
3
[]
no_license
import time import cv2 import PIL from PIL import Image def binary(n): k=7 i=0 t=[] bi = [0,0,0,0,0,0,0,0] while i<8: bi[k]=n%2 n=int(n/2) i=i+1 k=k-1 for j in bi: t.append(j) return t def dimension(fname): filepath = fname...
true
cf8fc2312acacf7fc30c24a35db04f7da556c9e9
Python
9boogie/pygame_shoot
/8_frame.py
UTF-8
1,399
3.3125
3
[]
no_license
import pygame #################################################################### #기본 초기화 (반드시 해야함) pygame.init() #초기화 (반드시 필요) #화면크기 설정 screen_width = 480 #가로 screen_height = 640 #세로 screen = pygame.display.set_mode((screen_width,screen_height)) # 화면 타이틀 설정 pygame.display.set_caption("Jae Game")...
true
1fb2d9a18acdc7819d7daaa8738a429a5dd353ef
Python
lkampoli/PRIME
/src/prime_utils.py
UTF-8
6,268
2.609375
3
[ "BSD-2-Clause" ]
permissive
import sys import numpy as np import csv from scipy.stats import gamma,lognorm,norm import matplotlib.pyplot as plt def normal_logpdf(x,loc,scale): return norm._logpdf((x-loc)/scale)-np.log(scale) def lognorm_pdf(x,s,loc=0,scale=1): return lognorm._pdf((x - loc)/scale,s)/scale def lognorm_cdf(x,s,loc=0,sc...
true
3082bf59a1035a6816c72d29acb7649919c12d60
Python
epyatyshev41/acti-training
/task-4/js-load-update.py
UTF-8
3,962
2.875
3
[]
no_license
class SecurityCheck(object): def __init__(self, pause_duration, rampup_duration, steady_duration): self._pause_duration = pause_duration self._rampup_duration = rampup_duration self._steady_duration = steady_duration class BandwidthTest(object): def __init__(self, st...
true
293649eb4a7f60121c18cce0220118ffc57aabbb
Python
AnabellJimenez/ALEX_Courses
/Scrapers/worcester/worcester-scraper.py
UTF-8
1,993
3.25
3
[]
no_license
import csv from bs4 import BeautifulSoup def outputToCsv(filename, courses): keys = courses[0].keys() with open(filename, 'w') as output_file: dict_writer = csv.DictWriter(output_file, keys) dict_writer.writeheader() dict_writer.writerows(courses) if __name__ == "__main__": try: ...
true
2028b8d3652fc084456603f4a7f9c89be6956b22
Python
andrewpeng02/deeprl-pytorch
/models/DQN/dqn_agent.py
UTF-8
6,570
2.546875
3
[]
no_license
import numpy as np import numpy.random as random import torch import torch.optim as optim import torch.nn as nn import gym as gym from gym.wrappers.monitor import Monitor from models.DQN.model import DQNModel class DQNAgent: def __init__(self, lr, momentum, alpha, gamma, target_update_frequency, local_update_f...
true
3b71b18bce9cfea4af0af7b13aeba3ed6a62c2f6
Python
petiatodorova/PythonFundamentals
/conditional-statements/scholarship.py
UTF-8
861
3.546875
4
[]
no_license
import math income = float(input()) average_success = float(input()) min_salary = float(input()) social_scholarship = math.floor(min_salary * 0.35) excellent_scholarship = math.floor((average_success * 25)) if average_success < 4.5: print('You cannot get a scholarship!') elif average_success < 5.5: if income ...
true
dea0cc60f5214bc8d1b943a2ad7d92789b8f598f
Python
diegogcc/py-design_patterns
/part_one/6-builder_pattern/assignment/abs_builder.py
UTF-8
508
2.703125
3
[]
no_license
from abc import ABCMeta, abstractmethod from pizza import Pizza class AbsBuilder(metaclass=ABCMeta): def get_pizza(self): return self._pizza def new_pizza(self): self._pizza = Pizza() @abstractmethod def make_crust(self): pass @abstractmethod def add_sauce(self): ...
true
9ac1ec32d98fcdbd25eae0061ca46e7db12ac979
Python
DrRoad/grid-garage
/hermes/paperwork.py
UTF-8
19,999
2.578125
3
[]
no_license
""" This module contains the working class that does the filing, and managing of the metadata. Much like Hermes Conrad, it loves to parse, change and file metadata back and forth between dictionaries and xml. The results is an easy to use tool where users can script metadata changes without having to parse the XML in...
true
a9af7e495396dc2021140b24ca519426ba63e070
Python
equations-project/pyeq3
/pyeq3/UnitTests/Test_SolverService.py
UTF-8
12,149
2.578125
3
[ "BSD-2-Clause" ]
permissive
import sys import os import unittest # the pyeq3 directory is located up one level from here if os.path.join(sys.path[0][: sys.path[0].rfind(os.sep)], "..") not in sys.path: sys.path.append(os.path.join(sys.path[0][: sys.path[0].rfind(os.sep)], "..")) import pyeq3 import DataForUnitTests import numpy import scip...
true
b5e13f157c8e02241609687d0b10cac79ab3372d
Python
dnuffer/dpcode
/compress_string_using_counts_of_repeated_chars/python/start.py
UTF-8
659
3.015625
3
[]
no_license
""" >>> compress("aabcccccaaa") 'a2b1c5a3' >>> compress("abc") 'abc' >>> compress("aaaaaa") 'a6' >>> compress("aaaaaaaaa") 'a9' >>> compress("aaaaaaaaaa") 'a9a1' >>> compress("aa") 'a2' >>> compress("") '' """ # TODO: Implement compress() to perform basic string compression using the # counts of repeated characters. T...
true
158cb6247023be183fa518e9794eab19746928fc
Python
ibisek/vfrManual-python
/src/xml2json.py
UTF-8
2,790
2.59375
3
[]
no_license
''' Created on Mar 17, 2018 Data extraction from DATABAZE LETIST file, which is available at http://www.aerobaze.cz/gps/ @author: ibisek ''' import re import sys import json from bs4 import BeautifulSoup PATTERN_CMT1 = '<cmt>(.*?)[\[](.+?)\s([0-9.,]+)[\]]<[\/]cmt>' PATTERN_CMT2 = '<cmt>(.+?)\s([0-9.,]+)<\/cmt>' c...
true
5ad9bd3b2cff10cfb661afcc9b940f66d345bada
Python
subash143-zz/leetcode_exercises
/easy/e_1342.py
UTF-8
453
3.203125
3
[]
no_license
# https://leetcode.com/problems/number-of-steps-to-reduce-a-number-to-zero/ # 1342. Number of Steps to Reduce a Number to Zero class Solution(object): def numberOfSteps (self, num): """ :type num: int :rtype: int """ steps = 0 while num != 0: if num%2 == ...
true
f857e33bb74c70d40fdf1439d25f0e5098e410ec
Python
juanmatg/practica
/6-kyu/Buying a car.py
UTF-8
518
3.015625
3
[]
no_license
def nbMonths(startPriceOld, startPriceNew, savingperMonth, percentLossByMonth): pricediff = startPriceNew - startPriceOld i = savings = 0 if pricediff <= 0: return [0, -pricediff] while pricediff > savings: i += 1 savings += savingperMonth lost_rate = percentLossByMonth /...
true
8da78d87316a512be6fb4d8a98ae45a52930edb7
Python
Shawnpcw/PythonDjangoNinjaGold
/apps/ninja_gold/views.py
UTF-8
2,326
2.640625
3
[]
no_license
from django.shortcuts import render, HttpResponse, redirect import random, datetime # the index function is called when root is visited def index(request): if 'totalGold' not in request.session: request.session['totalGold'] = 0 return render(request, 'ninja_gold/index.html') def process(request): ...
true
0635decdf24345298330cccc3d97a9fdbb7a93fc
Python
vickyjkwan/statistical_learning
/boosting/src/boosting_regressor.py
UTF-8
8,778
3.359375
3
[]
no_license
from sklearn.tree import DecisionTreeRegressor from sklearn.ensemble import RandomForestRegressor from sklearn.ensemble import GradientBoostingRegressor from sklearn.ensemble import AdaBoostRegressor from sklearn.datasets import load_boston from sklearn.model_selection import train_test_split, cross_val_score, KFold fr...
true
b289b2cb247097c7b76cd2cb5be61f0d329d4f33
Python
hujunhan/SSL-Python
/SSL_Lib/P2P.py
UTF-8
1,375
2.625
3
[]
no_license
import numpy as np from SSL_Lib.Robot import * import time def P2P(robot,camera,dest_x,dest_y,vx,vy): x, y, ori = camera.getRobotPos() #vx,vy,w=vx*0.5,vy*0.5,0 distance0=((x[0]-dest_x)**2+(y[0]-dest_y)**2)**0.5 if distance0 is 0: return dest_x,dest_y,1,vx,vy ay=(dest_x-x[0])/distance0/50 ...
true
6c56e33b1a6cec8051a9b5b40ef6923ba4d485b7
Python
TristanGomez44/ProtoTree
/prototree/node.py
UTF-8
1,000
2.734375
3
[ "MIT" ]
permissive
import torch import torch.nn as nn class Node(nn.Module): def __init__(self, index: int): super().__init__() self._index = index def forward(self, *args, **kwargs): raise NotImplementedError @property def index(self) -> int: return self._index ...
true
f3af8afea5c3333eabe2f4d8ee03d1b183d70321
Python
sourabh48/python
/python/prac7x8/prog.py
UTF-8
90
3.390625
3
[ "Unlicense" ]
permissive
import method str = input("Enter a string to be reversed! : ") print(method.reverse(str))
true
1052ae14206c287919fcab4636c0e5e5d29ac1fc
Python
gllary/digital-image-processing-
/colorful/zip.py
UTF-8
515
2.703125
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Thu Dec 19 12:36:17 2019 @author: 官宇霞 """ # coding=utf-8 import time time1 = time.time() import cv2 import os.path image=cv2.imread("E:/QQ/test1/after/lady.jpg") res = cv2.resize(image, (394,1024), interpolation=cv2.INTER_AREA) # cv2.imshow('image', image) # cv2.i...
true
91344e6c6708c93341f8a4b55c03dba832c05563
Python
dongkw/py
/src/test/sort.py
UTF-8
1,338
3.59375
4
[]
no_license
# -*- coding: utf-8 -*- # !/usr/bin/python def bubble_sort(list): for i in range(0, len(list)): for j in range(i, len(list) - 1): if list[i] > list[j + 1]: k = list[i] list[i] = list[j + 1] list[j + 1] = k print('bubble', list) def direct_sort(list): for i in range(0, len(lis...
true
da843f5432a40653f37bb35b2080143f3cab792e
Python
julioc98/lmsimpacta
/core/executorSQL.py
UTF-8
1,133
2.71875
3
[]
no_license
from django.db import connection class ExecutorSQL(): def __init__(self): pass def selectAll(self, query): cursor = connection.cursor() try: # atribuir a query cursor.execute(query) # retornar todos rows = cursor.fetchall...
true
a2dc6e09a3f1596f0871a40817c8a6d39d95f26a
Python
Jakob340/FacesDiscern
/face_recognition.py
UTF-8
2,639
2.515625
3
[]
no_license
# coding:utf-8 import cv2 from keras.models import load_model from autokeras.utils import pickle_from_file # Import numpy for matrices calculations import numpy as np import os os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' def assure_path_exists(path): dir = os.path.dirname(path) if not os.path.exists(dir): ...
true
f80f8740ab7bc894f14e7f1d92cdbce8280460f7
Python
avidLearnerInProgress/cf-octo-journey
/old_attempts/550a.py
UTF-8
369
3.28125
3
[]
no_license
def nonoverlapping(mystr): if mystr is None: return "NO" x1, x2 = 0, 0 x1 = mystr.find("AB") x2 = mystr.find("BA", x1 + 2) y1 = mystr.find("BA") y2 = mystr.find("AB", y1 + 2) if (x1!=-1 and x2!=-1) or (y1!=-1 and y2!=-1): return "YES" else: return "NO" my ...
true
9f3b67e450017deeec9c999e89e3f7da022bc70c
Python
andyacs/DAT7-project
/code.py
UTF-8
1,160
2.71875
3
[]
no_license
import pandas as pd from sklearn.neighbors import KNeighborsClassifier from sklearn import metrics from sklearn.cross_validation import train_test_split data = pd.read_csv('dataset.csv') feature_cols = ['uuid_count','threads_created','comments_created','total_searches','total_SFVs','total_leads','saved_vendors','book...
true
be069da84b34d411c904e548803d7f2e7b95feb0
Python
MaximRobota/Python-Data-Structures
/tree.py
UTF-8
2,045
3.65625
4
[]
no_license
from typing import Optional class Node: def __init__(self, value: int, left: Optional['Node'] = None, right: Optional['Node'] = None): self.value = value self.left = left self.right = right class Tree: def __init__(self): self.root: Optional[Node] = None def insert(self...
true
d4c554196b893930b5fd468cd9ec593c8bc2d739
Python
shamanaaaa/BreakoutTKINTER_GAME
/main.py
UTF-8
6,221
3.25
3
[]
no_license
import random import tkinter as tk from tkinter import messagebox import time # single rectangle class class MainRectangle: def __init__(self, x, y): self.color = random.choice(["blue", "red", "green", "orange", "yellow"]) self.height = 40 self.width = 80 self.x = x self.y ...
true
8d96f6f6081efa817b94c01818d8c9b4d39824ff
Python
risikesh/RTOS
/Assignment-1/test/testing.py
UTF-8
1,058
2.65625
3
[]
no_license
import os import csv os.system("mkdir -p log_temp") os.system("rm log/*") print "|parallel_users|number_of_users|average_time|minimum_time|maximum_time|" print "|---|---|---|---|---|" for parallel_users in range(1,6): for number_of_users in range(10,110,10): command = "./build/test " + str(number_of_users...
true
2388c3917a1db2a04dc3b50adbdc8c7fca7a16a9
Python
abisnar/bioinformatics
/assignment2/q2/q2.py
UTF-8
1,952
3.203125
3
[]
no_license
from scripts import * def find_words(sequence): word_list = [] for i in xrange(0,len(sequence)): word = sequence[i:i+3] if len(word) == 3: word_list.append(word) i +=1 return word_list seq = 'MAAALIRRLLRG' s = 'SRLHMMVRRMGRVPGIKFSKEKTTWVDVVNRRLVVEKCGSTPSDTSSEDGVRRIVHLY...
true
8bc192f44e486909ed71a6631302fa746776cf16
Python
SupriyaMadupathi/CSSP-1
/cspp1-assignments/cspp1 exam/CSPP2 Remedial Exam/hgf.py
UTF-8
1,321
2.9375
3
[]
no_license
def main(): rangeofinputs = int(input()) j = 0 dic = {} maxcapacity = 6 while j < rangeofinputs: temp = input().split(" ") if temp[0] == "reserve": if dic == {}: dic[1] = temp[1] print(temp[1],1) else: for i in range(1,maxcapacity): i...
true
1ddc35548e4dc25956f5452be0b7965f18d8f2ef
Python
wy471x/learningNote
/python/excise/basic/chapter8/8-12.py
UTF-8
213
3.328125
3
[]
no_license
#!/usr/bin/env python # coding=utf-8 def make_pizza(*toppings): print(toppings) make_pizza('mushroom','green peppers','extra cheese') make_pizza('pepperoni','beef','steak') make_pizza('bacon','pork','salad')
true
580faf953f4f0348f17e7556e58d99da6aeb81d1
Python
jielingl11/PythonLearning
/L2_datatype.py
UTF-8
401
4.15625
4
[]
no_license
# 資料:程式的基本單位 # 數字 3456 3.5 # 字串 "測試中文" " Hello World" # 布林值 True False # List [3,4,5] ["hello","world"] #Tuple (3,4,5) ("hello","world") # 集合 (set) {3,4,5} {"hello","world"} # 字典 {"apple":"蘋果","data":"資料"} # 變數:用來儲存資料的自訂名稱 # 變數名稱=資料 x=3 # print (資料) print (x) x=True #取代舊的資料 print (True)
true
b7572db778cc309275465a4663e3e89c2265e326
Python
tomp/AOC-2018
/day7/day7.py
UTF-8
4,475
3.078125
3
[ "MIT" ]
permissive
#!/usr/bin/env python3 # # Advent of Code 2018 - Day 7 # from collections import namedtuple, defaultdict import logging logging.basicConfig(format="%(asctime)s %(message)s", level=logging.INFO) logger = logging.getLogger() INPUTFILE = 'input.txt' # Utility functions def strip(line): return line.strip() def ...
true
3e86bc5ecd28f9f0aab535356905cd588b994195
Python
sergey-judi/python3
/Coursera/Основы программирования на Python/Week3/task_12.py
UTF-8
188
3.484375
3
[]
no_license
Str = input() index = Str.find('f') secondIndex = Str.find('f', index + 1) if secondIndex == -1 and index != -1: print(-1) elif index == -1: print(-2) else: print(secondIndex)
true
c9726377f7f432040de3ffdad2a46e103b1a31ad
Python
dajoni/AIND-Sudoku
/naked_twins_test.py
UTF-8
1,914
3.25
3
[]
no_license
import solution import solution_test import unittest class TestNakedTwins(unittest.TestCase): def get_simple_grid(self): values = {} for box in solution.boxes: values[box] = '' return values def assert_grid_empty_except(self, values, except_boxes): iter_boxes = [bo...
true
477a5a54411d3d71a4f38063464fd32d95eab841
Python
minyouminyou/memory_1980348902
/집 그리는 프로그램.py
UTF-8
1,135
3.640625
4
[]
no_license
# 집 그리는 프로그램 from graphics import * win = GraphWin("집 그리는 프로그램", 1280,720) win.setBackground("white") P1 = win.getMouse() P1.draw(win) P2 = win.getMouse() Rec = Rectangle(P1,P2) Rec.draw(win) # 폭 if P1.getX() > P2.getX() : R1_W = P1.getX() - P2.getX() else : R1_W = P2.getX() - P1.getX() ...
true
f55b97adab56f2b080bcb64f737ce84513cf9fed
Python
rorymcstay/car
/summarizer/src/main/tools.py
UTF-8
1,789
3.671875
4
[]
no_license
""" This module is a collection of useful mapping tools.""" def index_of_list_where_key_equals(attribute, json, list_name, parent): """ This function is used when we have a list of dictionaries and wish to find the index of an dictionaries where attribute_key = attribute. For example, find the index o...
true
5632b08f0d017c2db3d38ea194ca3982db4d4d7e
Python
zyh1994/gurobipy
/gurobipy/SOS.py
UTF-8
1,203
3.203125
3
[]
no_license
# Help on class SOS in module gurobipy: class SOS(): """ SOS(cmodel, sosno) Gurobi SOS object. SOS objects have a single attribute: IISSOS. When an IIS is available, this attribute indicates whether the SOS object participates in the IIS. Methods defined here: __dir__(self) __getat...
true
cdc7cf6e3b6ff771e439e36bef5ca6b7bef15673
Python
chiwhalee/merapy
/diagrams/diagram.py
UTF-8
36,475
2.75
3
[]
no_license
#!/usr/bin/env python #coding=utf8 """ """ import sys import os import math import pprint import networkx as nx import pygraphviz as pgz import matplotlib.pyplot as plt import numpy as np from pprint import pprint as pp def cmp(k1,k2): k,e1 = k1.split("_",1) e1 = int(e1) k,e2 = k2.split("_",1) e2 ...
true
9d7b9f4bec672cdc6a771a4d7ca70d3d3d0c6430
Python
shalombear/python_projects
/matrices.py
UTF-8
4,882
3.734375
4
[]
no_license
#To Do: # add Vector methods # update docstrings # time methods # create Matrix class # create class and functionality for underlying field """ module covering the basic operations of linear algebra classes: Vector -- vectors in Euclidean space attributes: size (int) ...
true
4241120637b41c910cdc26c1b07e2733ccdcb18a
Python
d0972058277/PyToys
/HouseSales/app.py
UTF-8
8,028
3.03125
3
[]
no_license
import os import numpy as np import pandas as pd import tensorflow as tf import matplotlib.pyplot as plt from tensorflow import keras from tensorflow.keras import layers data = pd.read_csv("kc_house_data.csv") # 顯示dataset的形狀,共21613比資料,每一比資料有21種不同資訊。 data.shape # 將顯示列數設定為25,不然會有部份資料無法顯示 pd.options.display.max_columns ...
true
3ed7fbf77a9c483c66f3a7a322fced65a2579504
Python
oscar457/my-notes
/Python/Scraping using Python/BeautifulSoup2.py
UTF-8
632
2.796875
3
[]
no_license
import urllib.request, urllib.parse, urllib.error from bs4 import BeautifulSoup import ssl # Ignore SSL certificate errors ctx = ssl.create_default_context() ctx.check_hostname = False ctx.verify_mode = ssl.CERT_NONE url = input('Enter - ') print(type(url)) html = urllib.request.urlopen(url, context=ctx).read() soup ...
true
3b4d27d82c0d9f4e8ba2c612dcdc35d7651595d0
Python
Isabel-Mtz/EjercicioClasificador
/stream.py
UTF-8
1,090
2.796875
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Wed Oct 21 14:24:49 2020 @author: Martinez Garcia Isabel y Luna Ganzáles Rocio """ import json Probabilidades = False with open("estadis.json","r") as read_file: data = json.load(read_file) Probabilidades = data['probabilidades'] archivo = open('tweet.txt','r') mensaje = ar...
true
3d34a344c8073859c0e49fb813e1ff3b74e1cb3d
Python
Geophysics-OpenSource/gimli
/python/pygimli/testing/test_IterBug.py
UTF-8
931
3.0625
3
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
permissive
#!/usr/bin/env python # -*- coding: utf-8 -*- # write a correct test! import unittest import pygimli as pg class TestIterBug(unittest.TestCase): def test_MissingRefCounter(self): """ """ a = pg.RVector(10, 1) # das geht schief wegen fehlendem referenzcounter. der Iter nutzt ...
true
98507e0b551f07c94c2772ae9ded2de6d44f0c5b
Python
dada00321/NTUST_Lib_Simple_Crawler
/module/NTUST_lib_crawler.py
UTF-8
5,494
2.796875
3
[]
no_license
""" 台科圖書館館藏借閱_自動爬蟲程式 """ from selenium import webdriver as wd from selenium.webdriver.chrome.options import Options import time from module.NTUST_lib_cfg_reader import read_cfg from module.file_helper import FileHelper class Webdriver(): def get_webdriver(self, headless): chrome_options = Options(...
true
22791fd0435e7a3dd48722443227592ae3bf7f7d
Python
berkleywerkley/Youngs_Modulus_of_Brass
/Grad_Descent.py
UTF-8
1,894
3.765625
4
[]
no_license
import numpy as np #Fit a line of the form y = mx + c using grad descent def compute_error_for_line_given_points(c, m, points): total = 0 for i in range(len(points)): x = points[i, 0] y = points[i, 1] total += (y -(m*x + c)) ** 2 #y is true value, mx + c is value predicted by mo...
true
81fc3c3255673535922a6e5d0802db6a50e7d16b
Python
jkafrouni/iterative_set_expansion
/iterative_set_expansion/preprocess.py
UTF-8
381
3.3125
3
[]
no_license
import nltk nltk.download('punkt') def split_sentences(text): """ Given a paragraph in one single string, splits each sentence and returns a list of strings, one string for each sentence. """ sentences = nltk.tokenize.sent_tokenize(text) while '' in sentences: # quick fix, nltk might add empt...
true
de35d3b1aa5aff740ad6fe1d8c8d367a4ae00493
Python
tonyhqanguyen/2DMarioKart
/Species.py
UTF-8
5,972
3.296875
3
[]
no_license
""" Species class """ from typing import List, Union from random import uniform from Genome import Genome from ConnectionHistory import ConnectionHistory from Player import Player class Species: """ A species with distinct properties. """ players: List[Player] best_fitness: float champion: Pla...
true
a3f54dc7305186f990285073ffb949ef9553ae0e
Python
canburaks/MyRecSys
/methods/pca.py
UTF-8
1,809
2.59375
3
[]
no_license
from sklearn.decomposition import PCA from sklearn.preprocessing import StandardScaler import pandas as pd import numpy as np import _pickle as pickle from array import array import pickson from tqdm import tqdm import random pd.set_option('display.max_columns', 800) pd.set_option('display.max_rows', 800) #MOVIE-TAG ...
true
4f6975b30b33acf9fdd6db7ff4ada2ab79f715aa
Python
sybitetechnologies/c-bot
/bot/navigation/side.py
UTF-8
1,782
2.875
3
[ "BSD-2-Clause" ]
permissive
from pid import PID import bot.lib.lib as lib class Side(object): """ Side of the robot with 2 IR sensors """ def __init__(self, sensor1, sensor2, ir_device_func, diff_k_values=(0,0,0), dist_k_values=(0,0,0)): self.sensor1 = sensor1 self.sensor2 = sensor2 self.get_values = ir_...
true
6c009e218c2b24db3b0da2d6ef776ccd450399e4
Python
infiniteoverflow/contribute_ur_code
/Python/Calculator.py
UTF-8
3,112
3.5
4
[]
no_license
import tkinter root=tkinter.Tk() root.geometry("500x550") root.title("Simple Calculator") root.resizable(0,0) ############### def show(numbers): global value value=value+str(numbers) name.set(value) ############## def clear(): global value value="" name.set("") #################### def equal...
true
f36680bb7fd5fc6444c859794d7c7517c2ff92d5
Python
angelsenra/hpcodewars-madrid-2018
/problemas/problema01.py
UTF-8
281
3.859375
4
[ "MIT" ]
permissive
#! python3 """[1] ¡Bienvenidos a CodeWars! (Expert mode) - 2 Puntos: Se recibirá el nombre del equipo y se debe devolver 'Welcome to CodeWars *NOMBRE DEL EQUIPO*'""" nombreDelEquipo = input("Introduce el nombre de tu equipo: ") print("Welcome to Codewars", nombreDelEquipo)
true
4d87d4feff8502ba8a1469281e864439b4c90a58
Python
wanax/Leetcode
/array/33. Search in Rotated Sorted Array.py
UTF-8
829
3.5
4
[]
no_license
''' Xiaochi Ma 2018-10-25 ''' class Solution: def search(self, nums, target): l = 0 r = len(nums) - 1 while l<=r: mid = int(l + (r - l) / 2) if nums[mid] == target: return True if nums[mid] > nums[r]: ...
true
5862ca69ca789851767e97f6b89ec5ae5c3ff85d
Python
Konoszaf1/Card-Detector
/Scripts/generate_scene.py
UTF-8
13,696
2.53125
3
[]
no_license
import os from tqdm import tqdm import data import imgaug as ia from imgaug import augmenters as iaa from shapely.geometry import Polygon import numpy as np import matplotlib.pyplot as plt import matplotlib.patches as patches import create_data as cd import backgrounds as b cardW=64 cardH=89 cornerXmin=1...
true
5986ad0233e2a7732464834111dd7e2ed480f63e
Python
bopopescu/Py_projects
/Test_Slen/PythonSelFramework/tests/e2e_order1.py
UTF-8
3,414
2.734375
3
[]
no_license
from selenium import webdriver from selenium.webdriver.support.select import Select from selenium.webdriver.common.by import By from selenium.webdriver.support.wait import WebDriverWait from selenium.webdriver.support import expected_conditions as EC import time # 1. explicit wait is not global, it is only for certa...
true
f01d01f68606208afa1a0a4547cca2f08b1260ae
Python
tylors1/Leetcode
/Problems/judgeCircle.py
UTF-8
249
3.46875
3
[]
no_license
def judge_circle(moves): x = 0 y = 0 for move in moves: if move == 'U': y += 1 elif move == 'D': y -= 1 elif move == 'L': x -= 1 else: x += 1 if x == 0 and y == 0: return True else: return False print judge_circle("UD")
true
c89308cbfb843d8e4f3775453aebf8ec424a7d16
Python
helunxing/algs
/leetcode/32.py
UTF-8
5,535
3.265625
3
[]
no_license
import bisect # s = Solution() # s.longestValidParentheses('(()()') # s.longestValidParentheses(')()(())') # s.longestValidParentheses('()()(()((((()))') class dp_Solution: def longestValidParentheses(self, s: 'str') -> 'int': dp = [0]*len(s) max = 0 for i in range(1, len(s)): ...
true
912aca4298296c46bf982073a405705b002cde36
Python
mrunalhirve12/Python_CTCI-practise
/LeetCode/Strings/Minimum Window Substring.py
UTF-8
2,551
3.921875
4
[]
no_license
""" Given a string S and a string T, find the minimum window in S which will contain all the characters in T in complexity O(n). Example: Input: S = "ADOBECODEBANC", T = "ABC" Output: "BANC" Note: If there is no such window in S that covers all characters in T, return the empty string "". If there is such window, yo...
true
6d45213b699cdf888bbecde395dac61ccac42888
Python
Cherishzyh/image-segmentation
/DataProcess/Data.py
UTF-8
1,457
2.703125
3
[]
no_license
import h5py import numpy as np import os def GetData(data_folder): file_list = os.listdir(data_folder) image_list = [] label_list = [] for file in file_list: file_path = os.path.join(data_folder, file) # data read with h5py.File(file_path, 'r') as h5_file: image =...
true
d9e157add67c65c6b4ee8e893e0084cbf03a94ff
Python
hoik92/Algorithm
/algorithm/work_5/merge_sort.py
UTF-8
686
3.703125
4
[]
no_license
def merge_sort(A): N = len(A) if N <= 1: return A left = merge_sort(A[:N // 2]) right = merge_sort(A[N // 2:]) return merge(left, right) def merge(left, right): i, j, k = 0, 0, 0 result = [0] * (len(left) + len(right)) while len(left) > i and len(right) > j: if left[i]...
true
7941b5b4d4c148c1608245602d4562318e3b91b5
Python
hmk88/Aria-Embedded-system-Python-
/examp.py
UTF-8
743
3.125
3
[]
no_license
import MySQLdb db=MySQLdb.connect(host="127.0.0.1",port=3306,db="mydb",user="root",passwd="ariag25") cur = db.cursor() # Execute a command: this creates a new table >>> cur.execute("CREATE TABLE test (id serial PRIMARY KEY, num integer, 'data' varchar);") # Pass data to fill a query placeholders and let Psycopg per...
true
8630ab6a2f9ebcbcd23f9a45ff7a91195baf6b29
Python
AlexandreSantAnaLangunno/fnf-python
/scr/player.py
UTF-8
619
3.046875
3
[]
no_license
import pygame class Player(pygame.sprite.Sprite): def __init__(self, pos): pygame.sprite.Sprite.__init__(self) self.image=pygame.image.load("assets/boyfriend.png") self.rect=self.image.get_rect(topleft=pos) self.keys=None def update(self): pass def key(self, key): ...
true
188b28a6604da7c4c1c60bbeb1d786bdcdbc76b8
Python
LiquidityC/aoc
/2021/day_11/main.py
UTF-8
1,526
3.34375
3
[]
no_license
def get(matrix, x, y): try: r = matrix[y] except IndexError: return None def increase_all(matrix): for i in range(10): for j in range(10): matrix[i][j] += 1 def get_overloaded(matrix): overloaded = [] for i in range(10): for j in range(10): ...
true