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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
ec3b5b30e2800581a105161d9bce832acee52d9d | Python | Girin7716/PythonCoding | /Programmers/hash/42578.py | UTF-8 | 573 | 3.421875 | 3 | [] | no_license | # 위장
def solution(clothes):
answer = 0
dic = {}
for p in clothes:
try:
dic[p[1]].append(p[0])
except:
dic[p[1]] = dic.get(p[1], [p[0]])
return answer
print(solution([['yellow_hat', 'headgear'], ['blue_sunglasses', 'eyewear'], ['green_turban', 'headgear']]))
p... | true |
66762dccf1de3339e72121b259ebc61f4feff581 | Python | harshmalviya7/LeetCode_Coding_Questions | /String/minimumAddToMakeParenthesesValid.py | UTF-8 | 349 | 2.984375 | 3 | [] | no_license | # 921. Minimum Add to Make Parentheses Valid
# https://leetcode.com/problems/minimum-add-to-make-parentheses-valid/
class Solution:
def minAddToMakeValid(self, s: str) -> int:
ans=bal=0
for i in s:
bal+=1 if i=="(" else -1
if bal==-1:
ans+=1
ba... | true |
ba58dedef1a38c2706d64188663f530cc29178bf | Python | LuciferGodness/Programming | /Lab/lab03/popitka2.py | UTF-8 | 8,918 | 2.546875 | 3 | [] | no_license | from tkinter import *
import random
import copy
from PIL import ImageTk, Image
frame = Tk()
actual_game = [[0 for i in range(9)] for j in range(9)]
class Mark(Label):
def __init__(self, row, col):
Label.__init__(self, master = frame)
self.row = row
self.col = col
self.coltype =... | true |
f0b3b025d8a387f81f504d747b46fdaffe45279c | Python | Rayman96/LeetCode | /100_Same Tree.py | UTF-8 | 1,447 | 3.140625 | 3 | [] | no_license | # Definition for a binary tree node.
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution:
def isSameTree(self, p: TreeNode, q: TreeNode) -> bool:
ans = []
def same(self, node1, node2):
if no... | true |
3f10fdf17ebcbc05fd9a5d674fcc29b4c1f55625 | Python | Hamberfim/CIS289_FinalProject | /blog_app/models.py | UTF-8 | 1,221 | 2.75 | 3 | [] | no_license | from django.db import models
from ckeditor.fields import RichTextField
from django.contrib.auth.models import User
# Create your models here.
# This model tells Django how to work with the data that will be stored in the app
class Topic(models.Model):
"""A topic the admin user enters.
This class inherits from... | true |
48730aaf2dec701f1afc8827fb0f186ce364449c | Python | onikazu/ProgramingCompetitionPractice | /Atcoder/abc130/d.py | UTF-8 | 266 | 2.8125 | 3 | [] | no_license | n, k = map(int, input().split())
a = list(map(int, input().split()))
ans = 0
s = 0
j = 0
for i in range(n):
while s < k:
if j == n:
break
s += a[j]
j += 1
if s >= k:
ans += n - j + 1
s -= a[i]
print(ans)
| true |
92dacafe6d2d51e919aacf241919b6ee4259912c | Python | ACodingFish/Capstone | /OLD/key_encryption/prime.py | UTF-8 | 788 | 2.609375 | 3 | [] | no_license | import time
import random
from math import gcd
from Crypto import Random
from Crypto.PublicKey import RSA
from Crypto.Cipher import PKCS1_OAEP
from Crypto.Util import number
sys_rng = random.SystemRandom()
def get_prime():
return number.getPrime(128, Random.new().read)#random.SystemRandom()
def coprime(a,b):
... | true |
87b353854493fe545dc6a2f6cff56def64f7492a | Python | jirou93/NN_player | /Game.py | UTF-8 | 1,752 | 3.578125 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Tue Nov 13 19:17:12 2018
This class will manage all the table and select wich of the strategies NN
the player must select in each moment
@author: pauca
"""
from Table import Table
from PreflopController import PreflopController
class Game:
# strat1 --> Str... | true |
183ac3df1089a745ebd5d9028c53a2a316518e21 | Python | kundajelab/simdna | /simdna/synthetic/embeddablegen.py | UTF-8 | 4,129 | 3.09375 | 3 | [
"MIT"
] | permissive | from __future__ import absolute_import, division, print_function
from simdna.synthetic.core import DefaultNameMixin
from simdna.synthetic.embeddables import StringEmbeddable
from simdna.synthetic.substringgen import AbstractSubstringGenerator
from simdna.synthetic.embeddables import PairEmbeddable
from collections impo... | true |
3ace76053e47c6667cff0900b29878803bc0e4bc | Python | huangluyao/squid_segmentation | /uilts/evalution.py | UTF-8 | 2,495 | 3 | 3 | [] | no_license | import numpy as np
np.seterr(divide='ignore', invalid='ignore')
def calc_semantic_segmentation_confusion(pred_labels, gt_labels, num_class):
"""建立混淆矩阵,以方便计算PA,MPA,Iou等各个指标"""
confusion = np.zeros((num_class, num_class))
for pred_label, gt_label in zip(pred_labels, gt_labels):
# 判断混淆矩阵是否是2维
... | true |
40bfdb4fab3048614d8f85f841f9d11cf2d9ef6b | Python | alexnguyen65/class6-notebook | /exercise6.py | UTF-8 | 661 | 2.59375 | 3 | [] | no_license | #!/usr/bin/env python3
import os
import pandas as pd
import matplotlib.pyplot as plt
df = pd.read_csv('data/boston/housing.data',
sep='\s+',
header=None)
df.columns = ['CRIM', 'ZN', 'INDUS', 'CHAS', 'NOX', 'RM', 'AGE', 'DIS', 'RAD', 'TAX', 'PTRATIO', 'BLACK', 'LSTAT', 'MEDV']
fig, ... | true |
584b87a1934ec7596863e2c6cd451a23203431c0 | Python | carlshoow/100-exercises-in-Python | /ex097.py | UTF-8 | 259 | 3.484375 | 3 | [] | no_license | def escreva(txt):
tam = len(txt)+4
print('-'*tam)
print(f' {txt}')
print('-'*tam)
escreva('Ola Mundo')
escreva('Curso de Python no Youtube')
escreva('Você vai conseguir ser um programador e vai conseguir trabalho!')
escreva('CeV')
| true |
e915db8ed843953d8907c1d002d303d759b6838d | Python | ashishkush/qiime_web_app | /python_code/metadata_table.py | UTF-8 | 20,307 | 2.6875 | 3 | [] | no_license | #/bin/env python
"""
Classes to represent metadata table information
"""
__author__ = "Doug Wendel"
__copyright__ = "Copyright 2009-2010, Qiime Web Analysis"
__credits__ = ["Doug Wendel"]
__license__ = "GPL"
__version__ = "1.0.0"
__maintainer__ = ["Doug Wendel"]
__email__ = "wendel@colorado.edu"
__status__ = "Develop... | true |
16f889719df18dd863d7dce9ef0a061170b1262d | Python | ajh1143/DataScience_Projects | /Tipping.py | UTF-8 | 2,320 | 3.421875 | 3 | [] | no_license | import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
#Get file, extract dataframe
def getTipFile(fileName):
raw_data = pd.read_csv(fileName)
df = pd.DataFrame(raw_data)
return df
#Explore Data
def EDA(dataframe, outputpath):
head = str(dataframe.head())
desc = str(dataframe.d... | true |
06353e4f47f12355fb18d04fb727b9abd8b0dd35 | Python | swedenfox/100Exercise | /Exercise1.py | UTF-8 | 451 | 4.34375 | 4 | [] | no_license | '''
Question:
Write a program which will find all such numbers which are divisible by 7 but are not a multiple of 5,
between 2000 and 3200 (both included).
The numbers obtained should be printed in a comma-separated sequence on a single line.
Hints:
Consider use range(#begin, #end) method
'''
def finder ():
lst = ... | true |
76c07bc48f180cf70872c10923120e879b03e87b | Python | dhavelock/ecse429-project | /performance/todos.py | UTF-8 | 620 | 2.78125 | 3 | [] | no_license | from test.common.helper import create_todo, delete_todo, update_todo
def init_existing_todos(num=10):
for i in range(num):
title = 'Test Todo ' + str(i+1)
create_todo({'title': title})
def add_some_todos(num=10):
for i in range(num):
title = 'Test Added Todo ' + str(i + 1)
cre... | true |
3d38a82915545420c1892a1e115484c463f3a729 | Python | flaght/nirvana | /td_base/volume.py | UTF-8 | 6,955 | 2.609375 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/env python
# coding=utf-8
import datetime
import time
import sys
from collections import OrderedDict
sys.path.append("..")
from mlog import MLog
from td_base.order import CombOffset, Direction
GLOBAL_VOLUME_ID = 100
class Volume(object):
"""Summary of class here.
成交类
Attributes:
""... | true |
9ad7fc88624f18ee67645803d4dedcbf4f6a85be | Python | BhavikRansubhe/Open-CV | /canny_edge_detector.py | UTF-8 | 767 | 3.328125 | 3 | [] | no_license | #The Canny edge detector is an edge detection operator that uses a multi-stage algorithm to detect a wide range of edges in images. It was developed by John F. Canny in 1986. wikipedia
#The Canny edge detection algorithm is composed of 5 steps:
# 1. Noise reduction
# 2. Gradient calculation
# 3. Non-maximum supp... | true |
b540565d6cae5d14bab05eeb689cba0620c3866c | Python | MadSkittles/leetcode | /42.py | UTF-8 | 653 | 3.25 | 3 | [] | no_license | class Solution:
def trap(self, height):
res, lo = 0, 0
for hi in range(1, len(height)):
if height[hi] >= height[lo]:
x = height[lo]
while lo < hi:
res += x - height[lo]
lo += 1
hi = len(height) - 1
fo... | true |
6d17b6ce0e618c6e22d6138db761636caecd4004 | Python | oemof/oemof-solph | /tests/test_scripts/test_solph/test_multi_period_model/test_multi_period_investment_model.py | UTF-8 | 12,532 | 2.53125 | 3 | [
"MIT"
] | permissive | """
Test for creating an multi-period investment optimization model
Create an energy system consisting of the following fleets
- lignite
- hardcoal
- CCGT
- GT
- Wind
- GenericStorage unit
- SinkDSM unit
for Germany
Add wind source and demand sink for FR and links for exchange.
"""
import pandas as pd
from oemof.so... | true |
cb75a13b9ea6c4c00d050b0075ad7167a111d35c | Python | mariainesaranguren/employeeDirectory | /mysite/employee_directory/management/commands/importEmployee.py | UTF-8 | 4,022 | 2.671875 | 3 | [] | no_license | from django.core.management.base import BaseCommand
import csv
from employee_directory.models import *
import calendar
import datetime
from datetime import date
import math
class Command(BaseCommand):
help = "Test command - will be modified to import employee entries."
def format_date_field(self, date_raw):
... | true |
d3ffc17a2da2b4aebc02a57798e7fbb9cb635e2b | Python | clatterrr/ShadowEditor | /test/assets/update_javascript_assets.py | UTF-8 | 934 | 2.625 | 3 | [
"MIT"
] | permissive | import os
import json
# 自动生成js资源json文件:`\ShadowEditor.Web\assets\js_assets.json`
root_path = os.getcwd()
js_assets_path = '%s\\ShadowEditor.Web\\assets\\js' % root_path
json_path = '%s\\ShadowEditor.Web\\assets\\js_assets.json' % root_path
list = []
name_list = []
def handle(path):
parts = path.split('\\')
... | true |
a3ca7cae734cf30989966addb463cdbbfcc7eead | Python | yongyuan1995/Huawei2019 | /Widget/road.py | UTF-8 | 411 | 2.734375 | 3 | [] | no_license |
class Road:
def __init__(self, id, length, speed, channel, origin, destination, isDuplex):
self.roadId = id
self.roadLength = length
self.roadSpeed = speed
self.roadChannel = channel
self.roadOrigin = origin
self.roadDestination = destination
self.roadisDuple... | true |
6ba30df9404784bebc2504a1d20466fba38d09d1 | Python | mattdricker/lms | /lms/validation/authentication/_helpers/_jwt.py | UTF-8 | 1,814 | 3 | 3 | [
"BSD-2-Clause"
] | permissive | """Helpers for working with JWTs. Encapsulates the ``jwt`` lib."""
import copy
import datetime
import jwt
from lms.validation.authentication._exceptions import ExpiredJWTError, InvalidJWTError
__all__ = ["decode_jwt", "encode_jwt"]
def decode_jwt(jwt_str, secret):
"""
Return the payload decoded from ``jwt_... | true |
e28c526d90ec1c2b810053efa612fb08de8ffa08 | Python | adirasmadins/vehicle-tracking-system | /recognition-server/Main.py | UTF-8 | 1,962 | 2.578125 | 3 | [
"MIT"
] | permissive | # Main.py
import sys
import cv2
import numpy as np
import os
import DetectChars
import DetectPlates
import PossiblePlate
# module level variables ##########################################################################
SCALAR_BLACK = (0.0, 0.0, 0.0)
SCALAR_WHITE = (255.0, 255.0, 255.0)
SCALAR_YELLOW = (0.0, 255.0,... | true |
b70196a17fdaf2cead0f666b9dcb219ea891fb7a | Python | dygduck/day-calculator | /day_calculator.py | UTF-8 | 426 | 2.8125 | 3 | [] | no_license | from datetime import timedelta, datetime
arrival = datetime(2018, 04, 13,23, 0, 0)
print arrival.strftime("%d/%m/%y %H:%M")
departure = datetime(2018, 04, 20, 1, 0, 0)
print departure.strftime("%d/%m/%y %H:%M")
full_day_start = arrival.date() + timedelta(days=1)
full_day_end = departure.date()
print full_day_start.str... | true |
56b9fa7f65e4858d411c95c5aa947f34a145987f | Python | gitgaoqian/Python | /CloudVerify/process.py | UTF-8 | 583 | 2.625 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
'''
created in 2018-4-14
http://www.sijitao.net/2046.html
'''
import psutil as pt
class Process():
def getNamebyPid(self,pid):
pids = pt.Process(pid)
return pids
def getPidByName(self,str):
pids = pt.process_iter()
pidList = []
for ... | true |
f989a5fd865e07c3365ea9dc65a6d8792d063961 | Python | mvargasvega/Learn_Python_Exercise | /ex15_Reading_Files.py | UTF-8 | 617 | 3.859375 | 4 | [] | no_license | # use argv to get a filename
from sys import argv
script, filename = argv
# command to open filename and assign it to txt
txt = open(filename)
# Print out filename that was given & reads/prints what was in that file
print(f"Here's your file {filename}:")
print(txt.read())
# # Ask for user to retype file they would l... | true |
0754f9ac756db392f8f5904fef8f07582f00c36a | Python | justimchung/ProductUpgrade | /test_upgrade_algorithms.py | UTF-8 | 3,071 | 2.78125 | 3 | [] | no_license | # -*-coding: utf-8 -*-
import unittest
from upgrade_algorithms import Upgrade_Algorithm
from upgrade_algorithms import New_Upgrade_Algorithm
from Upgrade_Group import UpgradeGroup
import numpy as np
from util import *
class TestUpgrade_algorithms(unittest.TestCase):
def test_run_upgrade_algorithm_for_full_skyline... | true |
f199463df37335529eef9bcd67782850c5daa2d3 | Python | rdave97/Triangle | /Triangle Max Sum/tri.py | UTF-8 | 335 | 3.484375 | 3 | [] | no_license | values = [list(map(int, string.split()))for string in open('triangle.txt').readlines()]
for line in range(len(values)-1, 0, -1):
for column in range(0, line):
values[line-1][column] += max(values[line][column], values[line][column+1])
print("Maximum total from top to bottom in given triangle is", va... | true |
a647c7f947addc0b2f1072239d19c7b320b2a8e8 | Python | xulzee/LeetCodeProjectPython | /19. Remove Nth Node From End of List.py | UTF-8 | 703 | 3.265625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
# @Time : 2019/3/4 16:20
# @Author : xulzee
# @Email : xulzee@163.com
# @File : 19. Remove Nth Node From End of List.py
# @Software: PyCharm
# Definition for singly-linked list.
class ListNode:
def __init__(self, x):
self.val = x
self.next = None
class Solution:
... | true |
922a7bfb3d8f3d562dfd3a995095a907ee4b4dab | Python | marilynaseer/python_exercises | /reverse.py | UTF-8 | 182 | 2.625 | 3 | [] | no_license | from sys import argv
a = len(argv)
if a > 2:
print "pass only one parameter"
elif a < 2:
print "pass atleast one parameter"
else:
script,s = argv
print argv
s = s[::-1]
print s | true |
47eca5bd0c8f93148cb034c95b0290bf4eb29fb2 | Python | taty2010/Sprint-Challenge--Data-Structures-Python | /ring_buffer/ring_buffer.py | UTF-8 | 1,330 | 3.5625 | 4 | [] | no_license | from collections import deque
class RingBuffer:
def __init__(self, capacity):
self.capacity = capacity
self.storage = []
self.current = 0
def append(self, item):
c = len(self.storage)
if c is self.capacity:
self.storage[self.current]= item
... | true |
f214e57249d6d8147ba44c15bb05841cf0e60a2d | Python | willluer/pickle_challenge | /src/number_to_words.py | UTF-8 | 3,836 | 3.671875 | 4 | [] | no_license | import re
from csp import CspSolver
import argparse
import utils
class NumberToWords:
def __init__(self,language="american_english",min_word_size=3,config="config.json",print_search_progress=False):
self.digit_map = utils.get_digit_map(file=config)
self.char_map = utils.reverse_dict(self.digit_map... | true |
6909e46a42fd6a9f98d08d2576a4090acff9eedb | Python | awesaem/awesaem-python.saem | /st01.Python기초/py08반복문/py08_21_중첩for.py | UTF-8 | 413 | 3.859375 | 4 | [] | no_license | # 중첩 for문
# **********
for y in range(0, 10, 1):
for x in range(0, 10, 1):
print("*", end=" ")
print( )
# **********
for y in range(0, 10, 1):
for x in range(y+1, 10, 1):
print("*", end=" ")
print( )
# **********
for y in range(10, 1, -1):
for x in range(y-1, 1, -1):
print("*", end=" ")
print( )
# **... | true |
830ec2e01d27f61c4f75f7ecd2bb3de26b681737 | Python | shantaladajian/JSON2ndHomeWork | /JSONHomeWork2.py | UTF-8 | 3,661 | 3.140625 | 3 | [] | no_license | import json
import os
def loadSetupData():
with open('gc_setup.json') as file:
course = json.load(file)
user_setup = course["course_setup"]["grade_breakdown"]
return user_setup
def loadUserGradesData():
a = os.listdir()
if "gc_grades.json" in a:
with open('gc_grad... | true |
1e274a571d15ffe1fe5078b8f3b7380e9e4fde7a | Python | sabiqxs/PythonLearn | /Nyoba/sortingList.py | UTF-8 | 1,163 | 3.984375 | 4 | [] | no_license | list = [9, 1, 8, 2, 7, 3, 6, 4, 5]
s_list = sorted(list, reverse=True)
print('Sorted Variable:\t', s_list)
list.sort(reverse=True)
print('original variable:\t', list)
tup = [9, 1, 8, 2, 7, 3, 6, 4, 5]
s_tup = sorted(tup, reverse=True)
print('Tuple\t', s_tup)
# tup.sort()
print('original Tuple:\t', tup)
di = {'name':... | true |
f3be42c254d41d05b7cb8f689f7dc7de0c3f3cb2 | Python | kazuou/pytennis | /opening.py | UTF-8 | 2,074 | 2.953125 | 3 | [] | no_license | """ opening.py """
from pygame.locals import *
import tennischaracter as tc
import draw
import pygame
#変数初期設定(タイトル)
def opening():
a = 0
counter = 0
tc.damage = 0
tc.counter_point = 0
tc.combo = 0
tc.seta = 2
tc.setb = 2
tc.gamea = 10
tc.gameb = 10
tc.... | true |
bc71136c225f5306e22ff57d2cdf63ca0baeb4a9 | Python | dkang417/cdj | /Python/python_stack/intro/practice.py | UTF-8 | 197 | 3.546875 | 4 | [] | no_license | def newchar(arr, char):
newlist = []
for i in range(0,len(arr)):
if arr[i].find(char) != -1:
newlist.append(arr[i])
print newlist
newchar(['hello','world','my','name','is','Anna'], 'o')
| true |
9f44e9a6f7986c7cf81462b22c0be8b23b5001a7 | Python | troylmadsen/LoveLetterML | /love_letter_server.py | UTF-8 | 2,253 | 3.1875 | 3 | [] | no_license | #!/usr/bin/env python
import os
import socket
import threading
# This file contains a multithreaded server for connecting love_letter_clients.
# @author Troy Madsen
# Class difinition of a ClientThread
class ClientThread(threading.Thread):
# Initialize ClientThread
def __init__(self, conn, parent, ip, port)... | true |
d28c9bc7d28ff041abb355a25dff45ec42c4b643 | Python | tensorflow/privacy | /research/dp_newton/src/opt_algs.py | UTF-8 | 14,760 | 2.609375 | 3 | [
"Apache-2.0",
"MIT"
] | permissive | # Copyright 2020 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | true |
13503d827a6196f3326b7a32183ff93e930eefc3 | Python | xiaofeng94/handwriting_transfer | /model/dataset.py | UTF-8 | 6,092 | 2.859375 | 3 | [
"Apache-2.0"
] | permissive | # -*- coding: utf-8 -*-
from __future__ import print_function
from __future__ import absolute_import
import cPickle as pickle
import numpy as np
import random
import os
from .utils import pad_seq, bytes_to_file, \
read_split_image, shift_and_resize_image, normalize_image
class PickledImageProvider(obje... | true |
517dc15538b53f2fdccd428e68cf4a71e5f7dd2c | Python | olliverpersson/gy-grasklippare | /component_testing/ml.py | UTF-8 | 837 | 3.265625 | 3 | [] | no_license | from PIL import Image
import math
file = open('data.txt', 'r')
data = []
for line in file:
txt = line.split(' ')
data.append({
"r" : txt[0],
"g" : txt[1],
"b" : txt[2],
"t" : txt[3][0]
})
# Ta in filsökväg till bild
print("Filväg: ")
imgsrc = input()
# Ladda bild och t... | true |
2cd7bab2de8e9b748a9933a7c20d059b563f503b | Python | avi3tal/knowledgebase | /ds/Tree/is_identical.py | UTF-8 | 1,026 | 4.65625 | 5 | [
"MIT"
] | permissive | """
Check if two binary trees are identical or not | Iterative & Recursive
"""
# Data structure to store a Binary Tree node
class Node:
def __init__(self, key=None, left=None, right=None):
self.key = key
self.left = left
self.right = right
def isIdentical(x, y):
if x is None and y is N... | true |
7b3d59ea0a814926a5b77b18e98d502c0756a311 | Python | stevefoy/Mask_RCNN | /create_db.py | UTF-8 | 1,900 | 2.765625 | 3 | [
"MIT"
] | permissive | import os
import sys
import shutil
from tqdm import tqdm
import time
def split_basename(basename):
base=basename
if basename.endswith(".txt"):
base=basename.rstrip(".txt")
elif basename.endswith(".png"):
base=basename.rstrip(".png")
splits=base.split("_")
vid,cam,id = "".join(splits... | true |
ea26a0d1298a3c2d553247ec952ed2327005380d | Python | jfrank248/final-pie-project | /CSC Final Project Ship Exploration/Simon Game Folder/Real Mansion Game Final.py | UTF-8 | 26,305 | 3.578125 | 4 | [] | no_license |
####################################################################
#Names:Collin Corbett, Tyler Perryman, Tristan Note: I forgot Tristan's last name :(
#Date: 2/10/17
#Description: Code for the Mansion Game. This version is to be fun and a collection/reader
#game. The end result is either death or you get ti... | true |
ced5ce3f44660af787f828f8dd3d6fbc17cf5111 | Python | frank6866/gitbook-docker | /chapters/kubernetes/demo_reflact.py | UTF-8 | 282 | 2.84375 | 3 | [] | no_license | import inspect
def fun(key1, key2):
print key1
print key2
if __name__ == "__main__":
args_dict = {"key1": "value1", "key2": "value2"}
print dir(fun)
print inspect.getargspec(fun)
args = inspect.getargspec(fun)[0]
eval("fun(1, 2)")
print args
| true |
e1da9fd23c6841c693fd4c8004d50e5b74c502f9 | Python | dr-dos-ok/Code_Jam_Webscraper | /solutions_python/Problem_200/2661.py | UTF-8 | 1,062 | 3.015625 | 3 | [] | no_license | def solve(n):
data = map(int, str(n))
i = 0
decremented = False
while True:
try:
a, b = data[i], data[i+1]
if a > b or not b:
data[i] = a - 1 if not decremented else 9
data[i + 1] = 9
decremented = True
... | true |
4f4205bd374a3e18180eb22a09ce2de7b5abb9da | Python | hacktoolkit/code_challenges | /project_euler/python/684.py | UTF-8 | 1,175 | 3.1875 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
"""
Solution by jontsai <hello@jontsai.com>
"""
# Python Standard Library Imports
from functools import lru_cache
# PE Solution Library Imports
from utils import *
class Solution(object):
MODULUS = 1000000007
EXPECTED_ANSWER = 0
def __init__(self):
pass
def solve(self... | true |
8fd0d6bec790d06eca2352ae973f7e5416a38c50 | Python | anujbidkar/Flask-Python-Blog-project | /app.py | UTF-8 | 1,709 | 2.546875 | 3 | [] | no_license | from flask import Flask, render_template, request
from flask_sqlalchemy import SQLAlchemy
import json
# from datetime import datetime
with open('config.json', 'r') as c:
params = json.load(c)["params"]
app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = 'mysql://root:@localhost/anuj'
db = SQLAlche... | true |
919483806cd5b2a4be5d68e6a8f2aff705574205 | Python | roesler-stan/Yelp-Challenge | /edges.py | UTF-8 | 3,023 | 2.828125 | 3 | [] | no_license | """
Read Mugshots or NIBRS dataset and write an adjacency list or a charge-charge edge list
"""
import csv
import pandas as pd
from sklearn.feature_extraction.text import CountVectorizer
import scipy
def main():
out_directory = '../Data/'
infile = out_directory + 'reviews_classified.csv'
edges_file = out_directory... | true |
268e858ddf20702eed8a0234a9b8e72ace4f6873 | Python | wilsjame/misc-algos | /kickstart/rd_B_2020/bike_tour.py | UTF-8 | 229 | 3.5 | 4 | [] | no_license | t = int(input())
for tc in range(t):
n = int(input())
a = list(map(int, input().split()))
ans = 0
for i in range(1, n-1):
ans += (a[i-1] < a[i]) and (a[i] > a[i+1])
print(f"Case #{tc+1}: {ans}") | true |
2333a09ab388c4283e5a13ac5e22a9d91684c6a9 | Python | nullx5/Learning-the-Syntax-python | /libreria_personal_1.py | UTF-8 | 1,393 | 3.984375 | 4 | [] | no_license |
class FichaEmpleado:
def __init__(self, nombre : str):
self.nombre = nombre
self.__cualificacion = None
def setCualificacion(self, cualif:int):
if cualif == 1 or cualif == 2 or cualif == 3\
or cualif == 4 or cualif == 5:
self.__cualificacion = cualif
def getCu... | true |
2d5fac2d11fa566e4a010b081a2c55e7e250c591 | Python | cocobear/LeetCode_in_Python | /solutions/0977.squares-of-a-sorted-array/squares-of-a-sorted-array.py | UTF-8 | 457 | 3.328125 | 3 | [
"MIT"
] | permissive | #
# @lc app=leetcode id=977 lang=python3
#
# [977] Squares of a Sorted Array
#
# @lc code=start
class Solution:
def sortedSquares(self, A: List[int]) -> List[int]:
ret = []
i = 0
j = len(A) - 1
while i <= j:
if A[i]**2 > A[j]**2:
ret.append(A[i]**2)
... | true |
7122d2ecb811ea4a1a201f5e24c0a43fd9b78f00 | Python | muzabu51/pythonpractice | /pythonpratice_org/18_cows_and_bulls_v2.py | UTF-8 | 716 | 3.609375 | 4 | [] | no_license | import random as r
repeat = 'Y'
while repeat == 'Y' :
count = 1
flag = 1
rand_no = str(r.randint(1000,9999))
while flag :
bulls = 0
cows = 0
user_no = input("guess the 4 digit number : ")
if user_no.isdigit() and len(user_no) == 4:
if user_no == rand_no:
flag = 0
print(f"Congratulations.... | true |
44c66019a574631b75d834c0252e84119a4dfe51 | Python | btjanaka/algorithm-problems | /leetcode/380.py | UTF-8 | 1,827 | 4.28125 | 4 | [
"MIT"
] | permissive | # Author: btjanaka (Bryon Tjanaka)
# Problem: (LeetCode) 380
# Title: Insert Delete GetRandom O(1)
# Link: https://leetcode.com/problems/insert-delete-getrandom-o1/
# Idea: Use a dictionary and a list together. The list allows you to perform
# random selection, while the dictionary lets you keep track of what items are... | true |
ed231c9a6639cbc0ee1286efd56c45ef1c251fbd | Python | Aasthaengg/IBMdataset | /Python_codes/p02709/s851278322.py | UTF-8 | 414 | 2.578125 | 3 | [] | no_license | N = int(input())
A = [(a, i) for i, a in enumerate(map(int, input().split()), start=1)]
A.sort(reverse=True)
dp = [[0] * (N + 1) for _ in range(N + 1)]
for s, (a, i) in enumerate(A):
for l in range(s + 1):
r = s - l
dp[l + 1][r] = max(dp[l + 1][r], dp[l][r] + a * (i - (l + 1)))
dp[l][r + 1... | true |
217bb68e27080582eddd5db37a88d7ffd59eb027 | Python | Larisa1992/My_Library | /p_library/models.py | UTF-8 | 2,006 | 2.609375 | 3 | [] | no_license | from django.db import models
class Author(models.Model):
full_name = models.TextField(verbose_name=("Имя автора"))
birth_year = models.SmallIntegerField(null=True, verbose_name=("Год рождения"))
country = models.CharField(max_length=50, null=True, verbose_name=("Страна"))
def __str__(self): ... | true |
7b80ad1f73684e391f2e370418800c2f97b56215 | Python | vigneshsadasivam/player | /104.py | UTF-8 | 119 | 3 | 3 | [] | no_license | n=int(input())
a=list(map(int,input("enter").split(" ")))[:n]
c=0
for i in range(1,len(a)):
c=c+a[i]+a[i-1]
print(c)
| true |
2961f89b47beee05c85d98155d7ceaad179a4434 | Python | Alejo-Rey/holbertonschool-higher_level_programming | /0x05-python-exceptions/0-safe_print_list.py | UTF-8 | 353 | 3.40625 | 3 | [] | no_license | #!/usr/bin/python3
def safe_print_list(my_list=[], x=0):
try:
z = 0
for y in my_list:
if z != x:
z = z + 1
print("{}".format(y), end="")
print()
return (z)
except:
z = 0
print(my_list)
for y in my_list:
... | true |
4a50bf153d42a29e53330b2442d3f57858b1a344 | Python | zhsama/ml_in_action | /Ch07 adaboost & randomForest/adaboost.py | UTF-8 | 10,531 | 2.875 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2018/12/16 8:55
# @Author : zhcf1ess
# @Site :
# @File : adaboost.py
# @Software: PyCharm
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.font_manager import FontProperties
def loadSimpData():
datMat = np.matrix([[1., 2.1],
... | true |
0db2f8a49460dc58ebbc0598ee552716468d4acd | Python | JordyCuan/Introduccion-a-los-Compiladores | /3er proyecto/otros/_lexico_.py | UTF-8 | 8,251 | 3.34375 | 3 | [] | no_license | # -*- encoding: utf-8 -*-
import sys
import utils
class Lexico:
"""
Lexico class, this class implements all lexic analizer methods and variables
(String path) To be used to open the AFD file
"""
def __init__(self, path):
# Check if the user picked a file instead "Cancel"
self.reserv... | true |
d91f41ec133778b53257687c9fb33fe809b1fcb8 | Python | Hunt3rKun/CTF | /CRYPTO/AES/Padding-Oracle/solve.py | UTF-8 | 1,058 | 2.96875 | 3 | [] | no_license | #!/usr/bin/env python3
from pwn import *
def xor(a, b):
return bytes([x ^ y for x, y in zip(a, b)])
r = remote("127.0.0.1", 20000)
block_size = 16
enc = bytes.fromhex(r.recvline().strip().partition(b' = ')[2].decode())
def oracle(c):
r.sendlineafter('cipher = ', c.hex())
if b'CORRECT' in r.recvline():
... | true |
dddc0aa97a67809039c9b7460e7d927a2d0421d1 | Python | Aquaveo/xmsinterp | /_package/xms/interp/api/interpolator.py | UTF-8 | 4,977 | 3.21875 | 3 | [
"BSD-2-Clause"
] | permissive | """Convenience methods for using interpolator classes."""
import numpy as np
from xms.interp.interpolate import Interpolator
try:
import xarray as xr
xr_enabled = True
except ImportError:
xr_enabled = False
try:
import pandas as pd
pandas_enabled = True
except ImportError:
pandas_enabled = Fa... | true |
f8960bc388c2de74a31a4743f78474360a0c3b5a | Python | RylkovKM/BSUIR-PYTHON-2020 | /Solutions/Task2/853503_Кирилл_Рыльков/MyJson/core.py | UTF-8 | 4,561 | 3.3125 | 3 | [] | no_license |
BRACKET=['{','}','[',']']
COLON = ":"
COMMA = ","
LITERALS=["true","false","null"]
CONTROL_CHARACTER = [' ', '\t', '\b', '\n']
QUOTATION_MARK = "\""
DIGITS =['1','2','3','4','5','6','7','8','9','0']
MINUS = '-'
PLUS = '+'
EXP = ['E', 'e']
POINT = '.'
def lex(string):
tokens = []
while len(string):
... | true |
7309a6b85f058c23b413b76689e56afbf274967f | Python | narogm/mownit | /lab2/zadanie2.py | UTF-8 | 1,293 | 3.03125 | 3 | [] | no_license | import numpy as np
import time
import scipy.linalg
def lu(A):
n = len(A)
for k in range(n):
for i in range(k+1, n):
val = +A[i, k] / A[k, k]
for j in range(k, n):
A[i, j] -= val * A[k, j]
A[i][k] = val
return A
def extract_L_and_U(A):
n = l... | true |
b4c1c4697cb1345d298db03cd0a43ffb9aef9089 | Python | yafeile/Simple_Study | /Simple_Python/thirty-part/PIL/code_2.py | UTF-8 | 307 | 3.25 | 3 | [] | no_license | #coding:utf-8
from PIL import Image, ImageDraw, ImageFont
FONT = ImageFont.truetype("simple.ttf",24)
img = Image.new("1",(200,50),"white")
draw = ImageDraw.Draw(img) #调用画笔,开始作画,在img这个画布上画吧
draw.text((0,0),"hello world",font=FONT) #在坐标(0,0)开始画
img.show() | true |
ae1aee35118e0084286e8e4f10b9aa7d63f067e4 | Python | Akanksha1346/MMU_project1_4thyear | /Daily_Assignments/assignment.py | UTF-8 | 1,099 | 3.5625 | 4 | [] | no_license | 1.
list=[]
for x in range(2000,3201):
if x%7==0 and x%5!=0 :
list.append(str(x))
print (','.join(list))
2.
num=int(raw_input("enter a no."))
n=1
while num>0:
n=n*num
num=num-1
print "factorial of a given", n
3.
num=int(raw_input("enter a no."))
d=dict()
for i in range(1,num+1):
d[i]=i*i
prin... | true |
d90bc2a090b7b120d4ddcbd7e9e28013b898371c | Python | capstone-spotify2/SpotifyTeam2 | /GetAlbumInfo/a.py | UTF-8 | 2,840 | 2.84375 | 3 | [] | no_license | import re
import urllib.request
from bs4 import BeautifulSoup
import string
import numpy as np
import pandas as pd
import RequestAgent
import time
from os import listdir
from os.path import isfile, join
def get_lyrics(url):
try:
#content = urllib.request.urlopen(url).read()
r = RequestAgent.request... | true |
badb88330d5f4704432c353f7ca912080bd3b425 | Python | Apacolyptica/Kintsugi-core | /django/kintsugi/result_page.py | UTF-8 | 5,033 | 2.96875 | 3 | [] | no_license | #!/usr/bin/env python3
"""
Generates search result pages.
"""
import result_queries
import BaseXClient
from KintsugiSettings import BASEX_KINTSUGI_PASSWORD
#import sys
def concat_query_make(query_ends):
"""This method concatenates several queries whose node returns a single value
DELIM is used as the delimiter be... | true |
7db6d241171dae8d7830c460ad9105c03fa3cc76 | Python | raphixnet/butler | /lib/butler/util/ccolorizer.py | UTF-8 | 665 | 2.59375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/python3.7.3 -tt
# Copyright 2020 | raphix.net p.p. Auer Raphael | All Rights Reserved
from .ccolor import CColor
class CColorizer():
def __init__(self):
pass
@staticmethod
def print(string: str, backgroundColor: str='', foregroundColor: str=''):
if not backgroundColor and not foregroundColor... | true |
1ec898fb1f71e28c7826c404b7ac7e225815d13e | Python | zzmjohn/scs | /python/scs.py | UTF-8 | 1,700 | 2.5625 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
import _scs_direct
import _scs_indirect
from warnings import warn
from scipy import sparse
def solve(probdata, cone, opts={}, USE_INDIRECT=False):
""" This Python routine "unpacks" scipy sparse matrix A into the
data structures that we need for calling scs routine.
I... | true |
90e31fd8dacd6d42d24606c1a5edee31a95401fa | Python | elaifuku/Python-Final | /my_module/Baking_Bot_Test_Function.py | UTF-8 | 6,212 | 3.203125 | 3 | [] | no_license | """It's a test for Baking_Bot_Functions. It is used to test most of the functions in the program.
"""
from my_module.Baking_Bot_Function.py import *
##test variables
test_string = 'hello, People'
test_list = ['hello,','People']
#test the functions to make sure it runs the way its supposed to run
def string_concaten... | true |
ef081b85149947d6e25785a3f59d53e68ee4ddec | Python | allenai/wiqa-dataset | /src/third_party_utils/allennlp_cached_filepath.py | UTF-8 | 3,681 | 3 | 3 | [
"Apache-2.0"
] | permissive | import json
import os
# Code adapted from Allennlp file_utils.
import shutil
import tempfile
from hashlib import sha256
import requests
from tqdm import tqdm
def url_to_filename(url, etag=None):
"""
Convert `url` into a hashed filename in a repeatable way.
If `etag` is specified, append its hash to the ... | true |
91259a50a1ffb02e8000e65af3fc0cabe9c30d23 | Python | dae4/opencv_using_python | /chapter2/type_scale.py | UTF-8 | 547 | 2.765625 | 3 | [] | no_license | import cv2, numpy as np
image = cv2.imread('./data/lena.png')
print('Shape:',image.shape)
print('Data type',image.dtype)
cv2.imshow('image', image)
cv2.waitKey()
cv2.destroyAllWindows()
image=image.astype(np.float32)/255
print('Shape:',image.shape)
print('Data type:', image.dtype)
cv2.imshow('imshow', n... | true |
ebf751f01c7cd86285d87fb626619a0c5ae86306 | Python | niloofarnth/Internship_Data_analysis | /instant_n.py | UTF-8 | 7,925 | 2.609375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Wed Aug 1 14:55:00 2018
@author: nxtehr
"""
import pandas as pd
import numpy as np
import os
import re
import math
from scipy import stats
from openpyxl import load_workbook
import matplotlib.pyplot as plt
import Savitzky_Golay_Filtering
import basic_functions
... | true |
473d165c8b7ae9523285c924aa167ea0a92f4b84 | Python | zhu-ty/cup_reco_py | /skbp.py | UTF-8 | 6,346 | 2.703125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Tue Nov 29 21:57:16 2016
reference:
http://www.cnblogs.com/Finley/p/5946000.html
@author: ShadowK
"""
import random
import math
import pickle
import numpy as np
random.seed()
def rand(a, b):
return (b - a) * random.random() + a
def make_matrix(m, n, fill=0.0): # 创造一个... | true |
496153dc292b304e40bbd7191fe1d40d71c2b44c | Python | kailash360/InternTracker | /InternTracker/InternTracker/spiders/apple.py | UTF-8 | 3,142 | 2.578125 | 3 | [] | no_license | import scrapy
from scrapy import Spider
from scrapy.selector import Selector
from scrapy.exceptions import CloseSpider
from scrapy.http import TextResponse as response
from InternTracker.items import InternshipPosting
from Logger.logger import career_site_logger
def dateformat(date) :
date = date.replace(",","").... | true |
b4d97c80eb22050139521d57b75920ce0b4c1d50 | Python | XiaoLing941212/Summer-Leet-Code | /7.8 - 93, 516/93. Restore IP Addresses.py | UTF-8 | 851 | 3.3125 | 3 | [] | no_license | '''
Given a string containing only digits, restore it by returning all possible valid IP address combinations.
Example:
Input: "25525511135"
Output: ["255.255.11.135", "255.255.111.35"]
'''
#BackTrack method
class Solution:
def restoreIpAddresses(self, s: str) -> List[str]:
result = []
... | true |
1973874ed50beeedb719f671bef67879b26c38e4 | Python | MMyungji/algorithm2 | /삼성시험대비/3. 백준 삼성기출문제/19237_어른상어.py | UTF-8 | 3,276 | 2.9375 | 3 | [] | no_license | # 시뮬레이션 - 꼭 BFS, DFS 안써도 된다
# 적당한 while, for문으로 구현 가능
direction={
1:[-1,0],
2:[1,0],
3:[0,-1],
4:[0,1]
}
N,M,K = map(int,input().split())
data = [list(map(int,input().split())) for _ in range(N)] # 지도
dir=[[[0]*4 for _ in range(5)] for _ in range(1+M)] #이동방향 우선순위데이터 dir[상어번호][현재 방향] = [0,0,0,0]
sh... | true |
5a2e2747c292ea4e88741331d24832b9ccabb4a3 | Python | ByeongjunCho/Algorithm-TIL | /분할정복백트랙킹/5208_전기버스2.py | UTF-8 | 418 | 2.53125 | 3 | [] | no_license | def bus2(k, start):
global result
if k > result:
return
if start == arr[0]:
result = min(result, k)
return
for i in range(start + arr[start], start, -1):
if i > arr[0]:
continue
bus2(k + 1, i)
T = int(input())
for tc in range(1, T+1):
arr = list(m... | true |
bd39198ae9ed54a6f81a4ad212f412de63c8f755 | Python | AntonioCenteno/Miscelanea_002_Python | /Ejercicios progra.usm.cl/Parte 2/1- Funciones y Módulos/funciones-numeros-primos.py | UTF-8 | 883 | 3.8125 | 4 | [
"MIT"
] | permissive | def es_divisible(n, d):
#Parecida a la funcion del numero par.
if n % d == 0:
return True
else:
return False
def es_primo(n):
#Un numero es primo si es divisible solo por el 1 y el mismo.
#Por lo tanto, si encontramos otro divisor de nuestro numero
#distinto a los dos de mas arriba, el numero no es primo.
e... | true |
21ac173cfa381c8ec77fbc304fc44111914565ef | Python | omkarshelar/simple-url-shortner | /models.py | UTF-8 | 3,518 | 2.65625 | 3 | [
"MIT"
] | permissive | import sqlite3, os
cwd = os.getcwd()
db_path = os.path.join(cwd, 'url-shortner.sqlite3')
def add_link(short_link, long_link, owner):
try:
if not is_short_link_valid(short_link):
raise Exception('Short link conflict')
conn = sqlite3.connect(db_path)
c = conn.cursor()
params = (short_link, long_link, owner)... | true |
847c1f96330fc4a2b55f1200a30d98c4657ee9d0 | Python | fabiopereira96/q-learning | /main.py | UTF-8 | 656 | 2.671875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
from qlearning import Qlearning
import sys
import time
import timeit
import util_file
import util_estados
import numpy as np
def main(sys):
if len(sys.argv) == 5:
print(sys.argv)
dados = util_file.f_read(sys.argv[1])
x = sys.argv[2]
y= sys.argv[3]
n = sys.argv[4]
i = int(dados[0])
... | true |
5ab5fdb6a9ebc993446f2f7d2a9c97744e75f307 | Python | mm909/Generating-Fake-News-for-COVID-19 | /explore.py | UTF-8 | 1,165 | 2.625 | 3 | [] | no_license | import pandas as pd
import numpy as np
df = pd.read_csv("metadata.csv")
# Drop not needed cols
drops = ['cord_uid',
'sha',
'source_x',
'doi',
'pmcid',
'pubmed_id',
'license',
'abstract',
'publish_time',
'authors',
'journal',
... | true |
44cf5606595f55c2d0e36493f9be0d43bddcad50 | Python | JosephRiosHenao/SpaceGravity-Simulation | /PracticeConcepts/2DMoveGravityParabolic.py | UTF-8 | 1,081 | 3.015625 | 3 | [] | no_license | import pyxel
import time
class App():
def __init__(self):
pyxel.init(
width = 192,
height = 128,
caption = "ParabolicShot",
fps = 60,
fullscreen = False,
scal... | true |
f743219613395999d127f3b3ab6c999990027485 | Python | zlw9161/ATReSN-Net | /utils/datasets/SpecAudioDataset.py | UTF-8 | 3,408 | 2.953125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import random
import torch
import torch.utils.data as data
import numpy as np
import gc
class SpecAudioDataset(data.Dataset):
def __init__(self, data_path, val_samples_per_audio, num_segs, transform=None, target_transform=None, mode='train'):
r"""Simple data loader for spectrogram... | true |
bcdecf1f5d6ff124fca38ff4e97d02292cb14186 | Python | s8002sid/ValueResearchParser | /VRParser/VRParser/FilterFund.py | UTF-8 | 2,254 | 2.59375 | 3 | [] | no_license | from FundDetail import *;
class FundFilter(object):
def __init__(self):
self.minManagerExp = 4;
self.minRating = 3;
self.minNetAsset = 1000;
self.maxSTD = 15.5;
self.minFiveYearRet = 19;
self.minAlpha = -1;
def Filter(self, fund):
fund = self.CheckExperie... | true |
72632788d81886480a7adf3604cf9473ac4b2630 | Python | masomel/py-import-analysis | /libs/Mailman/flufl/i18n/tests/test_translator.py | UTF-8 | 4,009 | 3.0625 | 3 | [
"Apache-2.0"
] | permissive | """Tests for the Translator class.
This cannot be a doctest because of the sys._getframe() manipulations. That
does not play well with the way doctest executes Python code. But see
translator.txt for a description of how this should work in real Python code.
"""
import unittest
from flufl.i18n._translator import T... | true |
1713dccf331055012c5c56457cf7b4a5be5f50c6 | Python | mcxiaoke/python-labs | /archives/tk/maker.py | UTF-8 | 4,852 | 2.84375 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Author: mcxiaoke
# @Date: 2015-08-10 22:07:17
from __future__ import print_function
import sys
import os
from Tkinter import *
from tkMessageBox import *
# make menus
class GuiMaker(Frame):
menuBar = []
toolBar = []
helpButton = True
def __init__(s... | true |
af6a4d7875dce4fcc84a7cc85f079766c0a1f9e3 | Python | SKMHv/TEST | /13_dvojrozmerna_tabulka.py | UTF-8 | 25,500 | 3.4375 | 3 | [] | no_license |
# ---------------------------------
# Tabuľka farieb
# ----------------------------------
# Ukážme dve malé aplikácie, v ktorých vytvoríme dvojrozmerný zoznam náhodných farieb,
# potom ho vykreslíme do grafickej plochy ako postupnosť malých farebných štvorčekov
# - vznikne farebná mozaika a na záver to otestujeme kli... | true |
fbedec71744c73f5669be15847db3a7df796c83b | Python | datge/AmazonPriceTracking | /src/main.py | UTF-8 | 2,427 | 2.828125 | 3 | [] | no_license | import os
import pickle
from time import sleep
from email_sender import Email
from extract import Extraction
from oggetto import Item
def main():
oggetto = Extraction("https://www.amazon.it/Demiawaking-Falsamaglia-Connettore-Sgancio-velocit%C3%A0/dp/B07PDKYWVL?pf_rd_p=c11f42df-e88f-4740-b4d0-b23235d9f226... | true |
1841a8214881708603f1e44c1ffd5e3d0ddfc715 | Python | neomatrix369/code-change-miner | /changegraph/gumtree.py | UTF-8 | 9,139 | 2.59375 | 3 | [
"Apache-2.0"
] | permissive | import json
import subprocess
from enum import Enum
import settings
def parse(src_path):
gumtree_bin_path = settings.get('gumtree_bin_path')
args = [gumtree_bin_path, 'parse', src_path]
p = subprocess.Popen(args, stdout=subprocess.PIPE)
result, _ = p.communicate()
return json.loads(result) if res... | true |
af13f658be99e3f06d618e22095c69155a26e4ad | Python | jhyun0919/EnergyData_Analysis_Toolkit | /utils/AbnormalDetection.py | UTF-8 | 4,437 | 2.59375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
from FileIO import Load
from dtw import dtw
import os
from GlobalParameter import *
import cPickle as pickle
import numpy as np
from Matrix import symmetric
from numpy.linalg import norm
class Self:
def __init__(self):
pass
@staticmethod
def set_time_slot(time_slot=Month,... | true |
ae33ad56e0ca3bed65f0725f5b3a486f801b4092 | Python | abeaugustijn/euler | /p7_10001st_prime.py | UTF-8 | 399 | 3.421875 | 3 | [] | no_license | def is_prime(num):
if num == 2:
return (True)
m = 2
while (m * m <= num):
if num % m == 0:
return (False)
m = m + 1
return (True)
def next_prime(num):
num = num + 1
while not is_prime(num):
num = num + 1
return (num)
if __name__ == '__main__':
... | true |
a2d174ee951dba252156d5d56cc52f1093f0c412 | Python | CSExponentials/cs207-FinalProject | /tests/test_AD.py | UTF-8 | 17,097 | 3.140625 | 3 | [
"MIT"
] | permissive | # import os
# import sys
# print(os.getcwd())
# sys.path.append(os.path.join(os.path.dirname(__file__),'../AD/'))
import os
import sys
TEST_DIR = os.path.dirname(os.path.abspath(__file__))
PROJECT_DIR = os.path.abspath(os.path.join(TEST_DIR, os.pardir))
sys.path.insert(0, PROJECT_DIR)
from AD import ElemFunc as EF
f... | true |
85f78ee6b1dca1f1ef301b80b8c6717396389571 | Python | lucasrodrigues10/processamento_imagens | /lab_2/ex_4.py | UTF-8 | 884 | 2.640625 | 3 | [] | no_license | import cv2
import numpy as np
from matplotlib import pyplot as plt
# le imagem quad
img = cv2.imread('quad.bmp', 0)
dft = cv2.dft(np.float32(img), flags=cv2.DFT_COMPLEX_OUTPUT)
dft_shift = np.fft.fftshift(dft)
magnitude_spectrum = 20 * np.log(cv2.magnitude(dft_shift[:, :, 0], dft_shift[:, :, 1]))
rows, cols = img.sha... | true |
66a7fc5ab6ae7b53b8bf1af95245c3caf3b53004 | Python | revygabor/DeepLearningProjectOne | /main_LSTM.py | UTF-8 | 2,143 | 2.75 | 3 | [] | no_license | import numpy as np
import pandas as pd
from keras.models import Sequential, load_model
from keras.layers import Dense, Dropout, LSTM
from keras.callbacks import EarlyStopping, ModelCheckpoint
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import StandardScaler
from sklearn.metrics imp... | true |
9addceec650b47da8583246c3ee9fa7ba3244454 | Python | ZhewenCoding/Python_basic | /调用自制模块.py | UTF-8 | 501 | 3.265625 | 3 | [] | no_license | # import 模块制作 #第一种方法
#
# res1=模块制作.add(2,4)
# res2=模块制作.diff(5,1)
# print(res1,res2)
# print(模块制作.printInfo()) #__all__不影响其调用
# from 模块制作 import add #第二种方法
from 模块制作 import * #第三种方法
print(add(15,2))
print(diff(22,1))
# printInfo() #报错 name 'printInfo' is not defined
... | true |
a70ecff535d0e62aaff998615015c440a9e1dbab | Python | saipreeti1999/python_prog | /sum_betw_15.py | UTF-8 | 136 | 3.375 | 3 | [] | no_license | a=int(input("enter a value:"))
b=int(input("enter a value:"))
sum=a+b
if sum>=15 and sum<=20:
print("20")
else:
print(sum)
| true |