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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
ba41479e5b95d63fd5f72590ed9929bcf26ac00c | Python | 981377660LMT/algorithm-study | /22_专题/前缀与差分/差分数组/离散化/6044. 花期内花的数目-单点查询-差分+离散化.py | UTF-8 | 1,793 | 3.53125 | 4 | [] | no_license | # 10^9值域 差分数组
# 6044. 花期内花的数目-单点查询-差分+离散化
from typing import List
from bisect import bisect_right
from collections import defaultdict
from itertools import accumulate
from 紧离散化模板 import Discretizer
class Solution:
def fullBloomFlowers(self, flowers: List[List[int]], persons: List[int]) -> List[int]:
... | true |
aca02c812f13e074069ae080d845cca0673b65c7 | Python | CdtDelta/YOP | /yop-week17.py | UTF-8 | 1,774 | 2.734375 | 3 | [] | no_license | # This script parses out the hash table in an index.dat file
# It's still a work in progress I have some pieces to finish coding out
#
#
#
# Licensed under the GPL
# http://www.gnu.org/copyleft/gpl.html
#
# By Tom Yarrish
# Version 0.5
#
# Usage yop-week17.py <index.dat>
import sys
import struct
def hash_header(parse... | true |
3ea58467ab0b0eb7a7f5b69af724c87b4f5f5308 | Python | iceycc/daydayup | /python/Geek-00/代码/lesson11/1nlp/p4_wordvector2.py | UTF-8 | 1,459 | 3.203125 | 3 | [] | no_license | import torch
import torchtext
from torchtext import vocab
# 预先训练好的此向量
gv = torchtext.vocab.GloVe(name='6B', dim=50)
# 40万个词,50个维度
len(gv.vectors), gv.vectors.shape
# 获得单词的在Glove词向量中的索引(坐标)
gv.stoi['tokyo']
# 查看tokyo的词向量
gv.vectors[1363]
# 可以把坐标映射回单词
gv.itos[1363]
# 把tokyo转换成词向量
def get_wv(word):
return gv.vectors[... | true |
53bdbedefb710b2a822fc5ee18be75b4a0b9ff5f | Python | jfernand196/Ejercicios-Python | /funcion_num_cercanos.py | UTF-8 | 200 | 3.625 | 4 | [] | no_license | # crear una funcion para determinar si un numero es cercano a 1000 o 2000
def cercania():
#return ((abs(1000 - n) < 100) and (abs(2000 - n) < 100))
return (False and False)
print(cercania()) | true |
33fec514c0da839b563e2dc0beded2af477542de | Python | evwhiz/fish_oil | /ifos_oil.py | UTF-8 | 3,912 | 2.734375 | 3 | [] | no_license | from datetime import date
from lxml import html
import os
import pathlib
import requests
import time
import urllib
IFOS_SRC_URL = "http://consumer.nutrasource.ca/ifos/product-reports/"
def get_etree(url):
"""
Returns report page's html.Element
"""
page = requests.get(url)
etree = html.fromst... | true |
bf25cc8f9b5c5e78e63affefdf356b4f7fafc56c | Python | BlueBrain/NeuroM | /examples/end_to_end_distance.py | UTF-8 | 4,392 | 2.734375 | 3 | [
"BSD-3-Clause",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | #!/usr/bin/env python
# Copyright (c) 2015, Ecole Polytechnique Federale de Lausanne, Blue Brain Project
# All rights reserved.
#
# This file is part of NeuroM <https://github.com/BlueBrain/NeuroM>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the fol... | true |
39786d507085ea44bc3c3c4422c4cbc489209f50 | Python | UWPCE-PythonCert-ClassRepos/SP_Online_Course2_2018 | /students/AndyKwok/lesson06/calculator/calculator/adder.py | UTF-8 | 388 | 2.90625 | 3 | [] | no_license | """
This module provides a addition operator
"""
class Adder:
"""
Class for adding
"""
@staticmethod
def calc(operand_1, operand_2):
"""
Performs addition
"""
return operand_1 + operand_2
@staticmethod
def dummy_calc(operand_1, operand_2):
"""
... | true |
c6a272bb6c789cfc1e7ccfb6bb3cb4733f4d94ce | Python | sartim/django_shop_api | /order/status/models.py | UTF-8 | 467 | 2.515625 | 3 | [] | no_license | from django.db import models
from core.models import AbstractDateModel
class OrderStatus(AbstractDateModel, models.Model):
__tablename__ = 'order_statuses'
name = models.CharField(max_length=255, unique=True)
class Meta:
ordering = ('-created',)
db_table = 'order_status'
def __str_... | true |
d1be59cea0208843cca83d8589a864d2a6aab246 | Python | DomoXian/domo-python | /leetcode/__twoSum__.py | UTF-8 | 484 | 3.765625 | 4 | [] | no_license | """
两数之和
地址:https://leetcode-cn.com/problems/two-sum/
实现思路 左右指针
"""
# !/usr/bin/python
class TwoSum:
def twosum(self, nums, target):
hashMap = {}
for index, num in enumerate(nums):
flag = hashMap.get(target-num)
if flag is not None:
return [index, flag]
... | true |
7cdabba327d7499e06dc22a2521cf3c64641da5d | Python | ryosuke071111/algorithms | /AtCoder/ABC/111_c_2.py | UTF-8 | 574 | 3.171875 | 3 | [] | no_license | #10:26-
# from collections import Counter
# n=int(input())
# V=list(map(int,input().split()))
# v1=Counter(V[::2]).most_common()
# v2=Counter(V[1::2]).most_common()
# if len(v1) ==1:
# v1.append([0,0])
# if len(v2) == 1:
# v2.append([0,0])
# if v1[0][0]==v2[0][0]:
# print(min(n-v1[0][1]-v2[1][1],n-v1[1][1]-v2[0][... | true |
b5f028e7d01e9e0e2ff1444242935f23429cba4c | Python | JohnpFitzgerald/OOP | /HelloPython.py | UTF-8 | 357 | 3.34375 | 3 | [] | no_license | import datetime
print("Hello world!")
now = datetime.datetime.now()
print ("Current date and time is ")
print (now.strftime("%A, %d-%m-%Y : %H:%M"))
firstSet = {1982,1989,1999,2002,2009,2013,2019}
secondSet = {1985,1992,2001,2002,2005,2009,2015}
thirdSet = {}
#firstSet.difference_update(secondSet)
thirdSet = firstS... | true |
5ead7ecdc788a365f24afeb7764de4e31e3d8ca2 | Python | Kawser-nerd/CLCDSA | /Source Codes/CodeJamData/10/11/7.py | UTF-8 | 1,449 | 2.71875 | 3 | [] | no_license | #!/usr/bin/python3
# -*- coding: utf-8 -*-
inp = open('input.txt','r')
outp = open('output.txt','w')
T = int(inp.readline())
for i in range(T):
N,K=map(int,inp.readline().split())
S = [inp.readline().strip().replace('.','').rjust(N,'.') for x in range(N)]
ls=[[0,'0'] for x in range(N)]
rs=[[0,'0'] for... | true |
960c62eaca96db4018d646a9fd34eee3862b21f7 | Python | aseke7182/WebDevelopment | /Week10/python/informatics/operation/e.py | UTF-8 | 107 | 3.46875 | 3 | [] | no_license | import math
a = int(input())
b = int(input())
if a>b:
print("1")
elif a<b:
print("2")
else:
print("0") | true |
661076d1500f991e1f329e8ae9c43daa0a1aaa58 | Python | bertrandlalo/offline_analysis | /offline_analysis/utils/io.py | UTF-8 | 1,138 | 2.53125 | 3 | [] | no_license | from .analysis_config import AnalysisConfig
import pandas as pd
import os
from warnings import warn
class Loader(AnalysisConfig):
def __init__(self, server_path):
AnalysisConfig.__init__(self, server_path )
self._description = {}
def convert_bname_to_fname(self, bname, ext= ".hdf5"):
r... | true |
32f8bd2fc9043782da2916b7a6934e4eef504fb3 | Python | zahimizrahi/FraudDetection | /DataProcessor.py | UTF-8 | 2,703 | 3.171875 | 3 | [] | no_license | import os
import pandas as pd
class DataProcessor:
raw_data_dir_path = 'resources/FraudedRawData/'
raw_data_filename = 'User'
num_of_segments = 150
num_of_users = 40
num_of_benign_segments = 50
sample_size = 100
def __init__(self):
return
"""
load the raw data from resourc... | true |
4326211498dead986201cc8a1b9cebcd934bfaf1 | Python | mihcaelcaplan/silkysnails | /simulation/plant.py | UTF-8 | 1,084 | 3.03125 | 3 | [] | no_license | from mesa import Agent
import re
import numpy as np
import io
class Plant(Agent):
# this will be the main lil organism
def __init__(self, pos, model, text_start, source_name, length):
super().__init__(pos, model)
# print(pos)
self.x, self.y = pos
self.text_start = text_start
... | true |
411ccd5d9c77ac7303080fbb75cb656211118b43 | Python | bright-night-sky/algorithm_study | /CodeUp/Python 기초 100제/6081번 ; 16진수 구구단 출력하기.py | UTF-8 | 783 | 3.65625 | 4 | [] | no_license | # https://codeup.kr/problem.php?id=6081
# readline을 사용하기 위해 import합니다.
from sys import stdin
# 16진수로 한 자리 수를 입력합니다.
# A ~ F 중 하나입니다.
# 입력한 16진수 숫자를 10진수 숫자로 변환합니다.
hex_num = int(stdin.readline(), 16)
# 16진수 구구단을 출력하기 1부터 15까지 반복합니다.
for num in range(1, 16):
# 현재 반복 중인 수에 맞는 16진수 곱셈 결과를 저장하는 변수를 선언합니다.
# 대문자... | true |
675480f3a3b871c7913c7846218d6d131d966b16 | Python | onionhoney/codesprint | /judge/sessions/2018Individual/ma3cheng2@gmail.com/PC_01.py | UTF-8 | 807 | 2.953125 | 3 | [] | no_license | import sys
total = int(sys.stdin.readline())
def get_root(uf, i):
while i != uf[i]:
i = uf[i]
return i
def union(uf, size, i, j):
root_i = get_root(uf, i)
root_j = get_root(uf, j)
uf[root_i] = root_j
size[root_j] = size[root_i] + size[root_j]
size[root_i] = 0
for num in range(total):
p = sys.stdin.readli... | true |
a4ce2f560d69ad61172ef3ccbe32404855d76925 | Python | eMUQI/Python-study | /old/cases/book_case02_列表.py | UTF-8 | 1,084 | 3.96875 | 4 | [] | no_license | bicycles = ['terk','cannondale','redine','specialized'] #与C语言类似
print(bicycles)
print(bicycles[0].title())
print("bicycles[-1]:")
print(bicycles[-1].title()) #当索引为-1时即访问最后一个元素
print()
print("修改元素后:")
bicycles[2] = 'redline' #修改元素
print(bicycles)
print()
print("bicycles.appen... | true |
70869bc5dbb1ae85577a618d2dd7ba9aec7bd802 | Python | klaerik/Advent-of-Code | /y2020/day03.py | UTF-8 | 694 | 3.375 | 3 | [] | no_license | import shared
#from math import prod
# Go right 3, down 1, count trees
def sled(right, down, field):
count = 0
x,y = 0, 0
bottom = len(field)
while y < bottom:
thing = field[y][x]
if thing == '#':
count += 1
y += down
x += right
if x >= len(field[0]):... | true |
dbe757c944a92cbe2b7ef34f114b6a3dee3f49c6 | Python | han-tun/Resources | /Python/Math/is_divisible_by.py | UTF-8 | 601 | 3.53125 | 4 | [] | no_license | """
------------------------------------
Creation date : 22/04/2017 (fr)
Last update : 23/04/2017 (fr)
Author(s) : Nicolas DUPONT
Contributor(s) :
Tested on Python 3.6
------------------------------------
"""
def IsDivisbleBy(nb,x):
if nb % x == 0:
return True
else:
return False
nb =... | true |
7d5fa3d5a45173e410b21ac266b176a8ac58fd79 | Python | ENFORMIO/mediaharvest | /experiments/crawler/crawl_sitemap.py | UTF-8 | 1,019 | 2.609375 | 3 | [] | no_license | import urllib.parse
import urllib.request
import urllib.error
import ssl
import xml.etree.ElementTree as ET
start_url = 'https://www.krone.at/sitemap.xml'
f = urllib.request.urlopen(start_url)
sitemap_xml = f.read()
sitemapindex = ET.fromstring(sitemap_xml)
sitemaps = []
for sitemap in sitemapindex:
for loc in s... | true |
97df8909021ee31ca9e12e6172b3fa65a80dbe84 | Python | redcholove/interview_preparing | /64_minimun_path_sum.py | UTF-8 | 941 | 3.046875 | 3 | [] | no_license | class Solution:
def minPathSum(self, grid):
#dp[i][j] = 到[i][j]的最小path sum
if not grid:
return 0
m = len(grid)
n = len(grid[0])
dp = [[float('inf') for _ in range(n)] for _ in range(m)]
for i in range(m):
for j in range(n):
... | true |
acc0c040d0524d48babb988e56a37cafce4db10b | Python | tranj5371/studious-train | /P3HW2_MealTipTax_Tran.py | UTF-8 | 1,299 | 4.125 | 4 | [] | no_license | # CTI-110
# P3HW2 - MealTipTax
# Johnny Tran
# February 26, 2019
# Ask user to input the charge for food at restaurant
Charge = float(input("How much did the restaurant charge you for the food? "))
# Ask user how much they would like to tip
Tip = float(input("How much would you like to tip? (15%/18%/20%) "))
# Calc... | true |
d2ede3d8c558437c71dfc0ccfe9797594d26a353 | Python | aaskov/non-linear-signal-processing-toolbox | /nn/nn_gradient.py | UTF-8 | 3,993 | 3.5 | 4 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
"""
Neural network - nsp
"""
from __future__ import division
import numpy as np
from nn_forward import nn_forward
def nn_gradient(Wi, Wo, alpha_i, alpha_o, train_input, train_target):
"""Calculate the partial derivatives of the quadratic cost function wrt.
to the weights. De... | true |
0564467595041d7d491c6c86d57a285993636bcd | Python | vancher85/hwork | /hw8/serializer1.py | UTF-8 | 1,496 | 3.890625 | 4 | [] | no_license | # 1. Создать класс для сериализации данных Serializer. Объект класса принимает на вход сложный объект(list, dict, etc), и обладает методами loads и dumps. Эти методы работают так же как и json.loads и json.dumps.
# 2. dumps принимает на вход один параметр - contetnt_type(это может быть json или pickle) и на выходе возв... | true |
a2eae89c82674dd0077f77556fa4538666c1b9e8 | Python | DavidP92/kataChallenges | /summing_NumbersDigits.py | UTF-8 | 531 | 4.625 | 5 | [] | no_license | ##`Write a function named sumDigits which takes a number as input and returns the sum of the absolute value of each of the number's decimal digits. For example:
## sumDigits(10) # Returns 1
## sumDigits(99) # Returns 18
## sumDigits(-32) # Returns 5
## Let's assume that all numbers in the input will be integer ... | true |
7f997b3debd89cba20ad4adaa4038fcd27ba01a7 | Python | WyattBlue/auto-editor | /auto_editor/utils/chunks.py | UTF-8 | 1,209 | 2.875 | 3 | [
"LGPL-3.0-only",
"LicenseRef-scancode-public-domain",
"Unlicense"
] | permissive | from __future__ import annotations
from fractions import Fraction
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from numpy.typing import NDArray
Chunk = tuple[int, int, float]
Chunks = list[Chunk]
# Turn long silent/loud array to formatted chunk list.
# Example: [1, 1, 1, 2, 2], {1: 1.0, 2: 1.5} => [(0, 3... | true |
d3bffcba8246d8e0cbdf6dc45796b7881f0d0857 | Python | cbnsndwch/sagefy | /server/framework/database.py | UTF-8 | 2,478 | 2.6875 | 3 | [
"Apache-2.0"
] | permissive | """
On each request, we create and close a new connection.
Rethink was designed to work this way, no reason to be alarmed.
"""
import rethinkdb as r
config = {
'rdb_host': 'localhost',
'rdb_port': 28015,
'rdb_db': 'sagefy',
}
def make_db_connection():
"""
Create a database connection.
"""
... | true |
add647e472988ca2d598bdd5b590a011830db3d3 | Python | hobart2018/python123 | /linked_list.py | UTF-8 | 2,428 | 4.0625 | 4 | [] | no_license | class Node:
def __init__(self, value):
self.value = value
self.pointer = None
print('定义 Node 完成')
node1 = Node(1)
node2 = Node(2)
node3 = Node(3)
node1.pointer = node2
node2.pointer = node3
def print_linked_list(node):
if node.pointer:
print(node.value, end='->')
else:
pr... | true |
88e0b6d5765b35e338e8cf02247f71169b5d69c6 | Python | ortiz1093/design-space | /dmaps_playground.py | UTF-8 | 3,948 | 2.765625 | 3 | [] | no_license | import plotly.graph_objects as go
import numpy as np
from numpy.random import default_rng
from numpy.linalg import norm, inv
from scipy.linalg import eig, eigh
from tqdm import tqdm
from joblib import Parallel, delayed
import sys
import seaborn as sns
import pandas as pd
import plom.plom_v4_4 as plom
from plom.plom_uti... | true |
48dc3092822c3dc2ac9af3f2ed77ad4c249880f1 | Python | suryaaathhi/guvi-program | /factno.py | UTF-8 | 67 | 3.28125 | 3 | [] | no_license | val1=int(input())
n=1
for i in range(1,val1+1):
n=n*i
print(n)
| true |
711f4eae0d89a2146818423daf951a62a842d26b | Python | Aasthaengg/IBMdataset | /Python_codes/p03161/s612812265.py | UTF-8 | 341 | 2.765625 | 3 | [] | no_license | n,k = map(int,input().split())
arr = list(map(int,input().split()))
dp = [0] * n
dp[0] = 0
dp[1] = abs(arr[1] - arr[0])
for i in range(2,n):
for j in range(1,k+1):
if i - j < 0: break
if j == 1: dp[i] = dp[i-j]+abs(arr[i-j] - arr[i])
else: dp[i] = min(dp[i], dp[i-j]+abs(arr[i-j] - arr[i]))
... | true |
f3eefe168776c1173fe236992812a1736c9464fd | Python | Spekks/python-SEAS-Ejercicios | /Ejercicios/Unidad 4/Caso/UD04_EG1.py | UTF-8 | 2,129 | 4.625 | 5 | [] | no_license | # Ejercicio guiado. Unidad 4.
# a) Vamos a dibujar cuadrados rellenos utilizando el carácter car que se pasará como argumento. Se pasan también el
# desplazamiento de cada línea (valor de a) y el número de caracteres que se escriben (valor de b) que es igual al
# número de líneas que se escriben. Todos ellos son d... | true |
62a37d08cd903def00191005604aabcd6e26cf09 | Python | nayan5565/PythonFirstProject | /FileHandle.py | UTF-8 | 456 | 2.90625 | 3 | [] | no_license | # w=write,r=read, a=append, rb=read binary
fileWrite = open('abc', 'a')
# fileWrite.write('Nurul',)
fileRead = open('abc', 'r')
# print(fileRead.read())
# for i in fileRead:
# print(i, end='')
# fileNewWrite = open('xyz', 'w')
# for data in fileRead:
# fileNewWrite.write(data)
imgFile = open('images/laptop.... | true |
ddd3ba8433b63344af677d72c6c5f9e73519d383 | Python | bcsummers/gh-action-testing | /tests/Custom/app.py | UTF-8 | 1,355 | 2.65625 | 3 | [
"Apache-2.0"
] | permissive | """Falcon app used for testing."""
# standard library
import logging
from typing import Any
# third-party
import falcon
# first-party
from gh_action_testing.middleware import LoggerMiddleware
class LoggerCustomLoggerResource:
"""Logger middleware testing resource."""
log = None
def on_get(self, req: f... | true |
e2290de649a5b94fb348281ad19c3904c96562b8 | Python | MrNothing/General-AI-Modules | /Modules/DepthEstimator/DepthMapOptimizer/DepthEstimator/ImagesLoader.py | UTF-8 | 1,767 | 2.921875 | 3 | [
"MIT"
] | permissive | from os import listdir
from os.path import isfile, join
import random as rand
from PIL import Image
import numpy as np
#description Loader template
#type data source
#icon fa fa-sort-numeric-asc
#param int
image_width = 64
#param int
input_size = 10
#param int
labels_size = 2
#param int
batch_size = 100
#param folder... | true |
7ff135d93da6ffa355bb7cf1e4638ba5856a28bc | Python | dr-dos-ok/Code_Jam_Webscraper | /solutions_python/Problem_54/278.py | UTF-8 | 637 | 2.953125 | 3 | [] | no_license | import sys
sys.setrecursionlimit(100000)
def gcd(a,b):
if a<b:
c=a
a=b
b=c
if b==0:
return a
else:
return gcd(b,a%b)
def gcd_n(input_list,n):
if n==1:
return input_list[0]
return gcd(input_list[n-1],gcd_n(input_list,n-1))
inp=raw_input()
times=int(inp)
for i in range(1,times+1):
eachline=raw_i... | true |
038efe54ebff88b116ce71aebdb701d83e323365 | Python | xiaoyaoyth/AeroSandbox | /tutorial/1 - Optimization and Math/2 - 2D Rosenbrock, constrained.py | UTF-8 | 1,959 | 4.4375 | 4 | [
"MIT"
] | permissive | """
Let's do another example with the Rosenbrock problem that we just solved.
Let's try adding a constraint to the problem that we previously solved. Recall that the unconstrained optimum that we
found occured at (x, y) == (1, 1).
What if we want to know the minimum function value that is still within the unit circle... | true |
0b73e8adfac8219ce4ed111f9ad1ba2f698e0165 | Python | tugceseren/12.03.2021-ve-ncesi-al-malar | /örnek 4.py | UTF-8 | 911 | 3.609375 | 4 | [] | no_license | a=5
b=4
c=3
if a>b:
if a>c:
print("a:", a, "en büyük")
if b>c:
print("c:", c, "en küçük")
print("b:", b)
elif b==c:
print("b:", b, " ve", "c:", c, "en küçük")
elif a==c:
print("a:", a, " ve ", "c:", c, "en büyük, ", "b:", b, "en küçük")
if b>a:
if b>c:
print("b:", b, "en bü... | true |
4e8ab373953f4bd8651d3c605da6aa627a905003 | Python | FAMAF-resources/anfamaf2021 | /codigos/lab2/ej7.py | UTF-8 | 576 | 3.09375 | 3 | [] | no_license | import ej1
import ej3
import ej5
import math
def lab2ej7bisec(x):
# calcula u(x) = y
fun_auxiliar = lambda y : y - math.exp(-(1-x*y)**2)
hy, hu = ej1.rbisec(fun_auxiliar, [0.0,2.0], 1e-6, 100)
y = hy[-1]
return y
def lab2ej7newton(x):
# calcula u(x) = y
fun_auxiliar = lambda y : (y - math.exp(-(1-x*y)**2), \
... | true |
0d597965d02bebe52e908ca2a5788f9ad22423c3 | Python | lalitpa/N-QUEEN-CONSOLE-GAME | /N queen.py | UTF-8 | 1,876 | 3.28125 | 3 | [] | no_license | print("IF U WANT TO DELETE PREVIOUS ONE OF THE INPUT. ENTER 'delete' IN 'row' INPUT")
print('ROW AND COLUMN ENTRIES STARTING FROM 0')
n=int(input('no. of grids'))
print('LEVEL',n,' STARTED')
def GAME(n):
a=n
l=[]
def deleteinput():
l.remove(l[-1])
def deletepriviousentry():
x=i... | true |
479b66298961d2090e7e6319d94892b7ac4c3472 | Python | ahchen0/Tasker | /TaskerGui/TaskerTreeView.py | UTF-8 | 10,466 | 2.53125 | 3 | [] | no_license | # Tasker treeview class
import tkinter as tk
from tkinter import ttk
from tkinter.filedialog import askopenfilename
from tkinter import messagebox
import h5py
import matplotlib.pyplot as plt
from tkinter import PhotoImage
from TreeViewPlus import TreeViewPlus
from PIL import Image, ImageTk, ImageOps
from TaskerPoint im... | true |
22a3cb21d85dc8c092824368e1f1c322a31aa02c | Python | marcomafcorp/synapse | /synapse/tests/test_lib_urlhelp.py | UTF-8 | 2,155 | 2.515625 | 3 | [
"Apache-2.0"
] | permissive | import synapse.exc as s_exc
import synapse.lib.urlhelp as s_urlhelp
import synapse.tests.utils as s_t_utils
class UrlTest(s_t_utils.SynTest):
def test_urlchop(self):
url = 'http://vertex.link:8080/hehe.html'
info = s_urlhelp.chopurl(url)
self.eq({'scheme': 'http',
'port':... | true |
f03a1b9723200c8ced4a481e87459dac3ab02882 | Python | lnybrave/zzbook | /utils/public_fun.py | UTF-8 | 916 | 2.6875 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/python
# -*- coding: utf-8 -*-
import os
import random
import time
# 构造文件名称
from django.core.mail import send_mail
from ebook.settings import EMAIL_FROM
def makename(name):
# 文件扩展名
ext = os.path.splitext(name)[1]
# 定义文件名,年月日时分秒随机数
fn = time.strftime('%Y%m%d%H%M%S')
fn += '_%d' % rand... | true |
a22f2e7e66a2f5b12351160b924ac00a8e84e475 | Python | LuisArmandoPerez/MasterThesis | /Tensorflow/resources/sinusoidal.py | UTF-8 | 3,789 | 3.0625 | 3 | [] | no_license | import numpy as np
from itertools import product
def sinusoid_data_generation_1D(n_Phi, n_T, omega):
"""
Creates n_Phi sinusoidal signals with n_T points per signal each with
angular frequency of omega.
:param n_Phi: number of partitions of phase interval
:param n_T: number of partitions of time in... | true |
8aebf4cb1c911afd6c9552c649f23d3ff673ab18 | Python | nhzaci/KattisSolutions | /ADifferentProblem/adifferentproblem.py | UTF-8 | 194 | 3.015625 | 3 | [] | no_license | import sys
multiline_input = sys.stdin.read().split('\n')
for line in multiline_input:
if line != '':
first, second = map(lambda x: int(x), line.split())
print(abs(first - second)) | true |
05016fa61004d1af275a9f2cfd54435e9062653d | Python | muchemwal/dataops-infra | /samples/ml-ops-on-aws-img-recognition/source/containers/ml-ops-byo-custom/LambdaScripts/result_analysis.py | UTF-8 | 6,342 | 2.9375 | 3 | [
"MIT"
] | permissive | import os
import boto3 # Python library for Amazon API
import botocore
from botocore.exceptions import ClientError
import pandas as pd
# for taking CSVs of the case description and prediction
# this is after there is analysis on thresholds and that the column predicted val in the predictions csv exists
# the filenam... | true |
5037f4ca29ee8e6ccd7adeddf596325bddcc92d8 | Python | YWaller/Sample | /BinpackingHeuristic.py | UTF-8 | 1,819 | 3.421875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
def binpack(articles,bin_cap):
#This is a heuristic to solve the binpacking problem; it found the optimal answer every time in testing while operating many times faster.
bin_contents = [] # use this list document the article ids for the contents of
# each ... | true |
42e6ba558bed3582a2d9df6cb3c7a2c8ac201782 | Python | ComputationalAstrologer/Optics | /ArrivalTimes.py | UTF-8 | 1,882 | 3.40625 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Mar 18 15:57:40 2021
@author: Richard Frazin
This plots some histograms
"""
import numpy as np
import matplotlib.pyplot as plt
#create a histogram corresponding to two exponential decay rates
#the probability of waiting a time t given rate r is r*ex... | true |
fafb4c304c3454d7b360fb6b627a09e323272a72 | Python | BrendenBe1/Business-Analytics | /createDashboard.py | UTF-8 | 2,097 | 3.15625 | 3 | [] | no_license | import requests, json
class createDashboard:
"""
Combines graphs from Plotly API into a single webpage using Dashboardly
"""
def __init__(self, graph_URLs, date_range):
"""
Generate needed data and create dashboard
:param graph_URLs: list of strings
:param ... | true |
2c085436281c06b7b87d419bc8786edc9362333d | Python | VasudhaLalit/Log-Analysis | /loganalysisdb.py | UTF-8 | 242 | 2.578125 | 3 | [] | no_license | import psycopg2
DBName = 'news'
def db_connect(query):
dbconn = psycopg2.connect(database=DBName)
cursor = dbconn.cursor()
cursor.execute(query)
results = cursor.fetchall()
dbconn.close()
return results
| true |
365bb3bf6cbe3479ca40f9e8dcbd34c53c169ed3 | Python | guidumasperes/MC558 | /Prim/prim.py | UTF-8 | 1,995 | 3.28125 | 3 | [] | no_license | from collections import defaultdict
#Classes to contruct and manipulate Graphs
class Graph:
def __init__(self):
self.graph = defaultdict(list)
# function to add an edge to graph and weight dict
def addEdge(self,u,v,w,val):
self.graph[u].append(v)
w[(u,v)] = val
class Vertex:
def __init__(se... | true |
01bc2e8a65b2a059be25d78d63518d859a725bd6 | Python | SHIQIHOU/Training | /ARIMA时间序列预测/log_diff_shift_ARMA.py | UTF-8 | 2,592 | 2.625 | 3 | [] | no_license | import pandas as pd
import numpy as np
from scipy import stats
import matplotlib.pyplot as plt
import tushare as ts
import datetime
from statsmodels.graphics.api import qqplot
from statsmodels.tsa.stattools import adfuller
from statsmodels.graphics.tsaplots import plot_acf, plot_pacf
from statsmodels.tsa.arima... | true |
c3fc5d9c5ffe10635bf369869068022b33311fc4 | Python | PatPat95/Text-RPG-Sprint2 | /progress.py | UTF-8 | 3,530 | 3.0625 | 3 | [] | no_license | """
Helpful file to streamline saving and loading players' progress from the database
"""
import os
import models
from settings import db
from game.player import Player, deconstruct_player
# for this funciton work a list of users with most recent ones at the end must be sent
def save_progress(userlist):
""" ... | true |
99ed95cf5ff91f5aa625fc920ef5e12159bbaf28 | Python | andreserb/python | /ejercicio10.py | UTF-8 | 326 | 3.96875 | 4 | [] | no_license | # -*- coding: utf-8 -*-
#Escribir un programa que pida al usuario un número entero y
#muestre por pantalla un triángulo rectángulo como el de más abajo.
lista=[]
a=int(input("Ingrese la altura del triángulo (entero positivo): "))
for i in range(1,a+1,2):
lista.append(i)
print(' '.join(map(str, lista[::-1])))... | true |
bc3a8dba5a754aeb411195ed0f07ea7163757746 | Python | martinhoeller/wrdlr | /wrdlr.py | UTF-8 | 3,240 | 3.40625 | 3 | [
"MIT"
] | permissive | #!/usr/bin/python
import sys, getopt, os.path
import fnmatch
# SEQUENCE MATCHING
# All words containing 'clo': "clo"
# All words starting with 'clo': "clo*""
# All words ending with 'clo': "*clo"
# All words starting with 'clo' and ending with 'rm': "clo*rm"
# All words starting with 'clo', followed by any character ... | true |
2dae79a0d2cf6d2399924b53861a35b2b0644be9 | Python | ArturtheQA/classRepo | /day5/hw1.py | UTF-8 | 3,810 | 2.703125 | 3 | [] | no_license |
states = {
"California": 39557045,
"Texas": 28701845,
"Florida": 21299325,
"New York": 19542209,
"Pennsylvania": 12807060,
"Illinois": 12741080,
"Ohio": 11689442,
"Georgia": 10519475,
"North Carolina": 10383620,
"Michigan": 9998915,
"New Jersey": 9032873,
"Virginia": 851... | true |
3646585194f198668b6b8bafc014ebe1e5425b52 | Python | HarishKolla533/Example | /Daa_Project-master/Source/pyhton code/practise1.py | UTF-8 | 2,414 | 3.09375 | 3 | [] | no_license | import sys
import heapq
from graph import Graph
from vertex import Vertex
class emergency_vehcile(object):
dict={}
lst=[]
lst1=[]
dict1={}
def __init__(self,type,zipcode,availability):
self.type=type
self.zipcode=zipcode
self.availability=availability
def get_vehcile_... | true |
714d4114b45d451958bc8ef8f8d645499cd5906d | Python | thesprockee/mitmproxy | /mitmproxy/utils.py | UTF-8 | 2,493 | 2.828125 | 3 | [
"MIT"
] | permissive | from __future__ import absolute_import, print_function, division
import datetime
import json
import time
import netlib.utils
def timestamp():
"""
Returns a serializable UTC timestamp.
"""
return time.time()
def format_timestamp(s):
s = time.localtime(s)
d = datetime.datetime.fromtimest... | true |
3f525de556ccb0725a70ddc01cd41fb6832daf88 | Python | LucasSoftware12/EjerciciosPy | /ejercicio2.py | UTF-8 | 194 | 3 | 3 | [] | no_license | # Alumno Lucas Medina
# Contraseña incorrecta
intentos = 0
while intentos < 5:
print("Intento fallido:", intentos, "Contraseña incorrecta")
intentos = intentos+1
print("Cuenta Bloqueada")
| true |
fe74a2d1d555d3727d210d2bfe4521f7da5e9b7a | Python | fisherab/r-gma | /server/src/scripts/libexec/rgma-fetch-vdbs.py | UTF-8 | 4,204 | 2.671875 | 3 | [
"LicenseRef-scancode-warranty-disclaimer",
"Apache-2.0"
] | permissive | #!/usr/bin/env python
# This utility will fetch vdb xml files from given URLs.
# The URLs are extracted from all vdb_url files found in
# "$RGMA_HOME/etc/rgma-server/vdb and the downloaded xml
# "files are placed in the directory $RGMA_HOME/etc/rgma-server/vdb.
# "The prefix of the vdb_url file name must match the pr... | true |
ce1bddddcc385e74a9d8220b99142d1dd663950f | Python | eggplantbren/CVTModes | /spectra.py | UTF-8 | 895 | 2.609375 | 3 | [] | no_license | import matplotlib.pyplot as plt
import numpy as np
spectrum = np.loadtxt("overdrive-eh.txt", skiprows=1)
plt.plot(spectrum[:,0], spectrum[:,1]+100, label="Overdrive EH")
spectrum = np.loadtxt("edge-eh.txt", skiprows=1)
plt.plot(spectrum[:,0], spectrum[:,1], label="Edge EH")
spectrum = np.loadtxt("edge-a.txt", skipro... | true |
3027ad7d4e78e6d7813542312300367dbeffdb7f | Python | renjieliu/leetcode | /1500_1999/1582.py | UTF-8 | 642 | 2.796875 | 3 | [] | no_license | class Solution:
def numSpecial(self, mat: 'List[List[int]]') -> int:
r_1 = {}
c_1 = {}
for r in range(len(mat)):
for c in range(len(mat[0])):
if mat[r][c] == 1:
if r not in r_1:
r_1[r] = 0
r_1[r] += 1... | true |
7fcbae0318d10be6d5e8a8db900b4df393a11b13 | Python | asitP9/50-Plots-To-Practice | /countsPlot.py | UTF-8 | 2,103 | 3.71875 | 4 | [] | no_license | import pandas as pd
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
import seaborn as sns
import warnings; warnings.filterwarnings(action="once")
# PLOT 5: Counts Plot
# Useful for:
# Draw a scatterplot where one variable is categorical.
# In this plot we calculate the size of overlapping p... | true |
78a7cd6a23d638f0b2f0e5e593108570c8c1735f | Python | Python3pkg/Caesar-Cipher | /tests/test_caesarcipher.py | UTF-8 | 11,915 | 2.84375 | 3 | [
"MIT",
"LicenseRef-scancode-warranty-disclaimer"
] | permissive | import unittest
from caesarcipher import CaesarCipher
from caesarcipher import CaesarCipherError
class CaesarCipherEncodeTest(unittest.TestCase):
def test_encode_with_known_offset(self):
message = "Twilio"
test_cipher = CaesarCipher(message, encode=True, offset=1)
self.assertEquals(test_c... | true |
1bccb7d663b5aa6a2db1147089061697a6524bf4 | Python | jumpjumpdog/OpreatingSystemProjects | /TenpLayer.py | UTF-8 | 199 | 2.671875 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*
class TempLayer(object):
def __init__(self,direction = 'wait',cur_layer = 1):
self.direction = direction
self.cur_layer = cur_layer
| true |
c793bca36318b4d1d3a8e80bda24d4c000e76767 | Python | PerFilip/Advent-of-Code | /Day5/solution.py | UTF-8 | 1,393 | 3.765625 | 4 | [] | no_license | import string
def solve_1():
with open('data.txt', 'r') as data:
message = data.read()
return reactions(message)
def reactions(message: str):
while True: #Until all reactions have happened
prev_len = len(message)
for n in range(len(message) - 1):
if mess... | true |
3fe4e88644e6a18811ff9d9f064f558303c81123 | Python | BraedenBurgard/Sunhacks-2020 | /data_tools.py | UTF-8 | 1,328 | 2.890625 | 3 | [] | no_license | import pandas as pd
import requests
def get_api_key() -> str:
try:
with open('api.key') as file:
return file.read().strip()
except FileNotFoundError:
raise FileNotFoundError(f"Missing omdbapi key. Store it in file 'api.key'.")
def parse_float(n: str) -> float:
try:
return float(n)
except ValueError as e:... | true |
94a7b6dcd60fd22551b117579c6d9fd27d996925 | Python | chandeeland/exercism.io | /python/run-length-encoding/run_length.py | UTF-8 | 434 | 2.828125 | 3 | [] | no_license | def encode(msg):
count = 1
curr = msg[0]
code = ''
for i in range(1, len(msg)):
global count, curr
if msg[i] == curr:
count += 1
else:
if count > 1:
code += str(count)
code += curr
curr = msg[i]
count = 1... | true |
5cd96bb4a0b9742bbbe80b7e7caddeaea3958cea | Python | syntheticprotocol/Python | /practice/technique/test_data/test.py | UTF-8 | 1,645 | 3.265625 | 3 | [] | no_license | """
!/usr/bin/env python3.6
-*- coding: utf-8 -*-
--------------------------------
Description :
--------------------------------
@Time : 2019/8/4 17:04
@File : test.py
@Software: PyCharm
--------------------------------
@Author : lixj
@contact : lixj_zj@163.com
"""
# -*- coding:utf-8 -*-
import pan... | true |
0d7b73e490edd28413667ce9854dd4d6b6425d3e | Python | qyk1480/py3 | /12_tcpserver.py | UTF-8 | 505 | 2.828125 | 3 | [] | no_license | from socket import socket, AF_INET, SOCK_STREAM
# tcp服务端2个套接字,一个等待,一个交互
tcpServerSocket = socket(AF_INET, SOCK_STREAM)
tcpServerSocket.bind(('', 9696))
tcpServerSocket.listen(6)
# 新套接字,新套接字的ip和port
# py 运行,等待对方连接
clientSocket, clientInfo = tcpServerSocket.accept()
# 连接后,等待对方发数据
recvData = clientSocket.recv(1024)
pri... | true |
e26f6c021bd3c1234075fff7d8c0ab4d9dd61817 | Python | HG1227/ML | /数据预处理Fearture Scaling/最大最小值归一化 Normalization.py | UTF-8 | 4,247 | 3.453125 | 3 | [] | no_license | #!/usr/bin/python
#coding:utf-8
"""
@software: PyCharm
@file: 最大最小值归一化.py
"""
'''
Xscl=(X-Xmin)/(Xmax-Xmin)
实际处理的过程中针对同一列的数据
最大最小归一化不适合极端数据分布
'''
import numpy as np
x=np.array([1,1,2,2,3,3,100]).reshape(-1,1)
x2=(x-x.min())/(x.max()-x.min())
np.set_printoptions(suppress=True)
x=np.hstack([x,x2])
# x=np.concatenat... | true |
b8899800c7e91d79d3dfe1252c43ce43861fe601 | Python | Temaaaal/informatika | /continenti.py | UTF-8 | 300 | 3.515625 | 4 | [] | no_license | countries = ["USA","China","Japan","Germany","Spanis"]
print(countries)
print(sorted(countries))
print(sorted(countries, reverse=True))
countries.reverse()
print(countries)
countries.reverse()
print(countries)
countries.sort()
print(countries)
countries.sort(reverse=True)
print(countries) | true |
42182d19036c35bd5e4fc5629e134c31d8c38403 | Python | kuroshum/signate_lesson2020 | /tajika/exercise3.py | UTF-8 | 178 | 2.875 | 3 | [] | no_license | import numpy as np
values = np.array([10, 3, 1, 5, 8, 6])
print(values)
convert_values = [-1 if values[ind] < 5 else 1 for ind in np.arange(len(values))]
print(convert_values) | true |
c5a02b81cc7c1c7596de4216b5ab1857695a9b2e | Python | Doug1983/MRI_GUI | /_Archived/DT_GUI/NeuroportDBS-master/NeuroportDBS-master/PlotDBSTrack/utilities.py | UTF-8 | 3,807 | 3.1875 | 3 | [] | no_license | import numpy as np
def rms(x):
"""
The root mean square of a signal.
Parameters
----------
x: array_like
An array of input sequence.
Returns
-------
out: float
A root mean square of the signal.
"""
return np.sqrt(np.mean(x**2))
def rmse(x1, x2):
"""
Th... | true |
4f104f20e3bd00e6e318bb0c2b7b2efceb84ad4e | Python | BCM-HGSC/ngsi-pm | /ngsi_pm/vcf_worklist.py | UTF-8 | 5,883 | 2.609375 | 3 | [] | no_license | #!/usr/bin/env python3
"""Read a master workbook and output an XLSX workbook annotated with
absolute paths read from the filesystem."""
# First come standard libraries, in alphabetical order.
import argparse
import csv
import logging
import os
import pprint
import sys
import warnings
# After a blank line, import thi... | true |
b0bd9507ed47f9c73d7f88ee5b7bec62545a0199 | Python | divanshu79/hackerearth-solution | /Marut and Girls.py | UTF-8 | 356 | 2.984375 | 3 | [] | no_license | n = int(input())
a = list(map(int,input().split()))
count = 0
for j in range(int(input())):
arr = list(map(int,input().split()))
d = {}
flag = 0
for i in range(len(arr)):
d[arr[i]] = 1
for i in range(len(a)):
if(a[i] not in d):
flag = 1
break
else:
flag = 0
if(flag == 0):
coun... | true |
bb33bdaa1206bfd2e1ead1bc0f4c085296f58ec7 | Python | lanlanabcd/atis | /interaction.py | UTF-8 | 5,109 | 2.84375 | 3 | [] | no_license | """ Contains the class for an interaction in ATIS. """
import anonymization as anon
import sql_util
from snippets import expand_snippets
from utterance import Utterance, OUTPUT_KEY, ANON_INPUT_KEY
class Interaction:
""" ATIS interaction class.
Attributes:
utterances (list of Utterance): The utterance... | true |
846a2f6b7c37cf18129594aad786860867c5176b | Python | TKuzola/pgsandbox | /try_sqlalchemy.py | UTF-8 | 1,038 | 3.015625 | 3 | [] | no_license | import psycopg2
import sqlalchemy as db
from sqlalchemy.orm import sessionmaker
def connect():
try:
engine = db.create_engine("postgresql://postgres:777999Pg@localhost:5432/postgres")
# engine.echo = True # We want to see the SQL we're creating
# connection = engine.connect()
... | true |
0bf88e4b779ac1d0e11980f792dafda7a2b2f28b | Python | AndreXi/clock-sync | /main.py | UTF-8 | 4,941 | 3.1875 | 3 | [
"MIT"
] | permissive | #! /usr/bin/python3
# -*- coding utf-8 -*-
# @AndreXi (Author)
""" CLOCK-SYNC
Este programa se encarga de ajustar la hora de un sistema Windows automaticamente
realizado con el objetivo de brindar una solucion rapida a problemas comunes que causan cambios
indeseados en la hora del sistema (Ej: BIOS sin batería, arran... | true |
a36ffe27c0738d16eb926cb07357569436703c41 | Python | PaviVasudev/DistracNot | /Other Files/trial.py | UTF-8 | 2,913 | 3.25 | 3 | [
"MIT"
] | permissive | import speech_recognition as SpeechRecog
import pyaudio
from random_word import RandomWords
import random
import time
import threading
init_rec = SpeechRecog.Recognizer()
score = 0
num_ques = 0
lang = {
1: 'en-US',
2: 'hi-IN',
3: 'ta-IN',
4: 'te-IN',
5: 'kn-IN',
6: 'zh-CN',
7: 'ja-JP',
... | true |
535b2cefb7afe59f53acd31d8c04ed0920296a12 | Python | velzepooz/exercises | /csv.py | UTF-8 | 436 | 3.09375 | 3 | [] | no_license | import csv
rows = []
with open("m5-buckwheat.csv") as fp:
reader = csv.reader(fp)
for row in reader:
rows.append(row)
fields = rows[0]
rows = rows[1:]
print(fields)
print(rows)
# максимальная цена манки
# m = 0
# for r in rows:
# val = float(r[1])
# if val > m:
# m = val
# print(m)
m... | true |
c4bbf8fca947a14906a21dfc4b892d12d8ba55ee | Python | piperpi/python_book_code | /Python编程锦囊/Code(实例源码及使用说明)/10/1~14/flask/12/run.py | UTF-8 | 1,706 | 2.59375 | 3 | [] | no_license | from flask import Flask, request,render_template,redirect
from flask_mail import Mail, Message
from threading import Thread
from forms import RegistrationForm
app = Flask(__name__)
# 配置邮件服务
app.config['MAIL_SERVER'] = 'smtp.qq.com'
app.config['MAIL_PORT'] = 25
app.config['MAIL_USE_TLS'] = True
app.config['MAIL_USERNA... | true |
5a93e5dd250ea97d9f915ebcd6e340989c97abe5 | Python | inkrypto/crypt0pa15 | /five.py | UTF-8 | 1,120 | 4.03125 | 4 | [] | no_license | #!/usr/bin/python
'''
Implement repeating-key XOR
Here is the opening stanza of an important work of the English language:
Burning 'em, if you ain't quick and nimble
I go crazy when I hear a cymbal
Encrypt it, under the key "ICE", using repeating-key XOR.
In repeating-key XOR, you'll sequentially apply each byte of ... | true |
87f485bfa62ee25563789fd41debf8dfe1c7ef13 | Python | Vishal7515/Image-Encryption-Decryption-using-Cyphers | /encryption(final).py | UTF-8 | 904 | 2.6875 | 3 | [] | no_license | from PIL import Image, ImageDraw, ImageFilter, ImageOps #imported the required objects from the Python Image Library
import sys #imported sys so zas to view the entire numpy array
import numpy as np
from random import randint
n... | true |
a0dfba244504b1d0c518dca51d58ef18b24d0577 | Python | Selidex/holbertonschool-higher_level_programming | /0x04-python-more_data_structures/1-search_replace.py | UTF-8 | 221 | 3.453125 | 3 | [] | no_license | #!/usr/bin/python3
def search_replace(my_list, search, replace):
new_list = my_list.copy()
for x in range(0, len(new_list)):
if new_list[x] == search:
new_list[x] = replace
return new_list
| true |
51f5e60f1c48d6fe50a1cf796e28b3f38e9c2f2f | Python | 1va/caravan | /get_data/UTM_GPS.py | UTF-8 | 2,605 | 2.53125 | 3 | [] | no_license | """
Description: Get list of GPS coordinates of caravan parks from other peoples' lists
Author: Iva
Date: 07/12/2015
Python version: 2.7
"""
#from utm import to_latlon, from_latlon
from pyproj import transform, Proj
import numpy as np
# forst define the conversion from the stupid british eastling... | true |
311901216a8f1007e8c1e6ddc4976ede2c7564c5 | Python | SaipraveenB/projection-networks | /environments/project2d.py | UTF-8 | 1,120 | 3.03125 | 3 | [] | no_license | import numpy as np
import math
# Returns a 1D image of the 2D scene as seen from position 'pos' and direction 'dir'
# Uses ray tracing to find the target points.
# Use FOV=90deg for now.
def project( pos, dirs, shapelist, fov=90, resolution=100):
# calculate max deviation as the lateral distance on a filmstrip plac... | true |
b880680518fd25693861d6f93017ddb6b22cabb3 | Python | somsomdah/Algorithm | /Algorithm-python/_section8/MaximumScore.py | UTF-8 | 186 | 2.609375 | 3 | [] | no_license |
n,m=map(int,input().split())
q=[(0,0)]
D=[0]*(m+1)
for i in range(n):
s,t=map(int,input().split())
for j in range(m,t-1,-1):
D[j]=max(D[j],D[j-t]+s)
print(D[m])
| true |
bad2cc013d14a3e9dff034c934250bfa934dfebe | Python | swaathe/py | /min.py | UTF-8 | 121 | 3.6875 | 4 | [] | no_license | n = [int(x) for x in input("enter the array elements:").split()]
print(min(n),("is the min element in the given array"))
| true |
93586a525757831747444f547bd8042dae85c27d | Python | vmms16/MonitoriaIP | /Arquivos/slide_28.py | UTF-8 | 251 | 2.515625 | 3 | [] | no_license | import os
os.chdir('C:\\Users\\Vinicius\\Desktop\\Vinicius\\UFRPE\\Projetos - Eclipse')
arqe=open('exercicios2.txt','r')
dic={}
x=arqe.readlines()
arqe.close()
for i in x:
y=i.strip('\n').split(' ')
dic[y[0]]=y[1]
print(dic) | true |
fee600b1cde72228a8251e98f81120294915a5cf | Python | gitdxb/learning-python | /free-python/guessinggame.py | UTF-8 | 602 | 4.4375 | 4 | [] | no_license | ## Guessing Game
print("Think of a number between 1 and 100")
def guess():
max = 100
min = 0
count = 0
finish = False
while finish == False:
middle = int((max + min)/2)
answer = input("Is your number [H]igher, [L]ower or the [S]ame as {} ".format(middle)).upper()
count += 1
... | true |
701b4430a1ddbc0ea5239af533891fb47edceccc | Python | Homnis/hyx | /former/Method.py | UTF-8 | 5,002 | 3.5625 | 4 | [] | no_license | # # 1.
# def printList(list1=[]):
# print(list1)
#
#
# list1 = [1, 2, 3, 4]
# printList(list1)
# # 2.
# def sumList(list1=[]):
# Sum = 0
# for i in range(len(list1)):
# Sum = Sum + list1[i]
# return Sum
#
#
# list1 = [1, 2, 3, 4]
# print(sumList(list1))
# #3.
# def sumList(list1=[]):
# S... | true |
7dda4f6c093332f6191bd0bb9769983169f6af2d | Python | cuihantao/OpalApiControl | /OpalApiControl/signals/signalcontrol.py | UTF-8 | 10,021 | 2.59375 | 3 | [] | no_license | #***************************************************************************************
#Description
# Access Simulink signal control for changing values in Real-Time
# Model must be compiled and connected before signal control is granted
#*******************************************************************************... | true |
6205837a751fa9b19e2a25abe1648a634c54d708 | Python | NelsonGomesNeto/Competitive-Programming | /Competitions/IEEExtreme/MiniXtremeR9 2020/Number Mind/debugger.py | UTF-8 | 380 | 2.84375 | 3 | [] | no_license | import os
import time
from random import randint
from filecmp import cmp
os.system("g++ code.cpp -o test -std=c++17")
while True:
f = open("big", "w")
a = [randint(0, 9) for i in range(12)]
f.close()
start_time = time.time()
os.system("./test < big")
total_time = time.time() - start_tim... | true |
8cf9e952b9c42f6bd8d456f0dd6b16210b572e12 | Python | cataluna84/hpp-book | /high_performance_python_2e/06_matrix/diffusion_2d/diffusion_scipy.py | UTF-8 | 817 | 2.828125 | 3 | [] | no_license | #!/usr/bin/env python3
import time
from numpy import add, multiply, zeros
from scipy.ndimage.filters import laplace
try:
profile
except NameError:
profile = lambda x: x
grid_shape = (640, 640)
def laplacian(grid, out):
laplace(grid, out, mode="wrap")
@profile
def evolve(grid, dt, out, D=1):
lapl... | true |
a3d27d7004e68c752bfe33e325cb9880ce671406 | Python | salvadorhm/java_sintaxis | /rule_00.py | UTF-8 | 1,031 | 3.640625 | 4 | [] | no_license | import string
class OpenClose:
def n__init__(self):
pass
def validate(self,file):
open=('{','[','(')
close=('}',']',')')
signs=[]
for line in file:
for letter in line:
if letter in open:
signs.append(letter)
... | true |
d6ea5223097016ff4b0f76736e637472c373fb51 | Python | UmutOrman/hackerrank | /python/numpy/mean_var_std.py | UTF-8 | 277 | 2.75 | 3 | [] | no_license | import numpy
numpy.set_printoptions(sign=' ')
n,m = map(int, raw_input().strip().split())
a = []
for i in range(n):
a.append(map(int, raw_input().strip().split()))
arrA = numpy.array(a)
print numpy.mean(arrA, 1)
print numpy.var(arrA, 0)
print numpy.std(arrA, None) | true |
5e7bc880a40b761246dfb4f270c1b9836038b772 | Python | ghomasHudson/graphVisualiser | /MainProgram.py | UTF-8 | 93,268 | 2.671875 | 3 | [] | no_license | # -*- coding: cp1252 -*-
#==============================================================================
# Graph Algorirthm Program
#==============================================================================
#------------------------------------------------------------------------------
# Import required m... | true |