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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
739f1318cfd04dd60b3caf6bed0bc5d2ba1165ca | Python | ameidar/bittrex | /Mywallet.py | UTF-8 | 2,783 | 3.078125 | 3 | [] | no_license | #!/usr/bin/env python
# This program buys some Dogecoins and sells them for a bigger price
#from bittrex import bittrex
import smtplib
from bittrex.bittrex import *
from email.mime.text import MIMEText
#server = smtplib.SMTP('internal-mail-router.oraclecorp.com',25) #port 465 or 587
def getbalanceo... | true |
c9117404dabe22aba518c2b81eeb8c0119e1f65d | Python | SGenheden/advent_of_code | /aoc_2017/solutions2017/day24/part2.py | UTF-8 | 679 | 2.828125 | 3 | [] | no_license | from solutions2017.day24.utils import find_bridges, make_components
def solve(components_spec):
components = make_components(components_spec)
bridges = []
find_bridges([(-1, 0)], components, bridges)
max_length = 0
max_strength = 0
for bridge in bridges:
max_length = max(max_length, le... | true |
4ad90374047a5bc6d375bdc6b338e0275e0dcd3d | Python | hamologist/Code-Eval | /moderate/mth_to_last_element/mth_to_last_element.py | UTF-8 | 219 | 3.125 | 3 | [] | no_license | import sys
f = open(sys.argv[1])
lines = f.read().rstrip().splitlines()
f.close()
for line in lines:
vals = line.split(' ')
index = int(vals.pop())
if (len(vals) >= index):
print(vals[-1 * index])
| true |
56dd5bd7e6335013426fc970408198acc1badc47 | Python | luomeng007/LintCode | /末尾几个0判断.py | UTF-8 | 2,198 | 4.03125 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sun Aug 2 09:02:57 2020
@author: 15025
虽然可以得到结果,但是当阶乘数字较大时,可能会溢出,时间复杂度太复杂,
可以进一步优化算法,尝试
"""
class Solution:
"""
@param: n: An integer
@return: An integer, denote the number of trailing zeros in n!
"""
def trailingZeros(self, n):
# writ... | true |
2bf4825fd81f559250c4155a83daeb8bff520f16 | Python | frdizon/CSC611M_Project | /SentimentAnalysis_Parallel1.py | UTF-8 | 3,430 | 3.3125 | 3 | [] | no_license | from textblob import TextBlob
import pandas as pd
import numpy as np
import re
import time
from multiprocessing import Process, Lock, Value
# HELPERS: -------------------------------------------------------------
# Create a function to get the polarity
def getPolarity(text):
return TextBlob(text).sentiment.polar... | true |
7ff822a471c413d34c03a7494fd5dbe0c90b7812 | Python | MyChoYS/K_TIL | /python/PYTHONexam/day11_class/classTest5.py | UTF-8 | 882 | 3.359375 | 3 | [] | no_license | def deposit(name, money):
if name == "둘리" :
global balancedooly
balancedooly += money
elif name == "또치" :
global balanceddochi
balanceddochi += money
elif name == "도우너" :
global balancedouner
balancedouner += money
def inquire(name):
if name == "둘리":
... | true |
175bd4ddd4a406c0fe892842b577dd5cb2bc2e20 | Python | momesmo/LeetCode | /atoi.py | UTF-8 | 979 | 3.359375 | 3 | [] | no_license | class Solution(object):
def myAtoi(self, str):
"""
:type str: str
:rtype: int
"""
INT_MIN = -2**31
INT_MAX = 2**31 - 1
L = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']
result = 0
sign = 1
str = self.removeLeadingWhitespace(str)
... | true |
2b0eea7c1cdb8352216f6947e2e7287575368185 | Python | M-Riku/.leetcode | /45.jump-game-ii.py | UTF-8 | 472 | 2.859375 | 3 | [] | no_license | #
# @lc app=leetcode id=45 lang=python3
#
# [45] Jump Game II
#
# @lc code=start
class Solution:
def jump(self, nums: List[int]) -> int:
if len(nums) == 1:
return 0
step = 0
cur_cover = 0
next_cover = 0
for i in range(len(nums)-1):
next_cover = max(ne... | true |
f1e197cd81546dd39a088367527c922b473a5daa | Python | larhauga/diskstats | /diskstats.py | UTF-8 | 3,572 | 2.625 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from datetime import datetime
import os, re, csv
import argparse
from time import sleep
# Tool for getting /proc/diskstats
DISKSTATS_PATH = '/proc/diskstats'
HEADERS = ['datetime', 'major_number', 'minor_number', 'device_name', 'read_completed_successfully',
'reads... | true |
6b4fce34358ce73b8cdd1b1f29feca7218b06ce1 | Python | chriscassidy561/coinScript | /CoinDaemon.py | UTF-8 | 1,230 | 2.59375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/python
from Constants import Constants as cnt
class CoinDaemon:
coinName = ""
coinPort = 00000
COMMAND = ""
coinDaemon = None
coinDaemonStop = None
def __init__(self, a_str, b_int, c_str):
self.coinName = a_str
self.coinPort = b_int
self.COMMAND = cnt.SCR... | true |
18e7e68a987e25915e0bdb4c6f7d62c8329af10a | Python | kompics/kompicsbenches | /visualisation/custom_plotters/bench/atomic_broadcast/plot_ts_latency.py | UTF-8 | 4,955 | 2.578125 | 3 | [] | no_license | import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import numpy as np
import sys
import argparse
import os
import plotly.graph_objects as go
parser = argparse.ArgumentParser()
parser.add_argument('-s', nargs='+', help='timestamp and latency directory')
parser.add_argument('-n', nargs='?', defau... | true |
addf9ba63702633f94b37d4b5149e4fe3bfc48c3 | Python | tactycHQ/knowledge-graph | /components/facts_extractor.py | UTF-8 | 3,219 | 2.6875 | 3 | [] | no_license |
from spacy.tokens import Token, Span
from spacy.matcher import Matcher
from components import fact_matcher_rules
class FactsExtractor(object):
name = 'facts'
# make sure the token matches all requirements set by identifier object
# search up if there's a dynamic way to do this.
# pos_, _.is_graph_entity, dep... | true |
7fd8ce83a626b7050a2170724b933026c9602946 | Python | ericbgarnick/AOC | /y2018/day05/day05.py | UTF-8 | 1,386 | 3.515625 | 4 | [] | no_license | import re
from sys import argv
def polymer_length(polymer: str, part_num: int):
if part_num == 1:
print("Part 1")
print("Reduced length:", reduce_polymer(polymer))
elif part_num == 2:
print("Part 2")
print("Shortest polymer length:", shortest_polymer(polymer))
def reduce_poly... | true |
ff36cbfb5dbb93aee61daa9a6efd7e79916d1e79 | Python | mrcdb/dare-sec-topo | /cybertop/plugins/FilterQueryDigits.py | UTF-8 | 1,869 | 2.75 | 3 | [
"Apache-2.0"
] | permissive | # Copyright 2017 Politecnico di Torino
#
# 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 applicable law or agreed to... | true |
5c1087137434191f82f64796c3259a847de94967 | Python | ShehrozeEhsan086/ICT | /Exercise/Largest Number/utils.py | UTF-8 | 142 | 3.28125 | 3 | [] | no_license | def find_largest(x):
largest = x[0]
for number in x:
if number > largest:
largest = number
return largest | true |
48a856e790519eecb81abe37c42f0e503d860d30 | Python | nurruden/training | /NonTraining/mock/test.py | UTF-8 | 555 | 3.140625 | 3 | [] | no_license | #-*-coding:utf-8-*-
#/usr/bin/env python
__author__ = "Allan"
import unittest
from function import add_and_multiply
import mock
class MyTestCase(unittest.TestCase):
@mock.patch('function.multiply')
def test_add_and_multiply(self,mock_multiply):
x = 3
y = 5
mock_multiply.return_value =... | true |
91210e7682fb954eedf1876bb326be2d20ac3749 | Python | neelkapadia/WolfPal | /keyword-mapping/sklearn2.py | UTF-8 | 4,284 | 3.109375 | 3 | [
"MIT"
] | permissive | from sklearn.decomposition import NMF, LatentDirichletAllocation, TruncatedSVD
from sklearn.feature_extraction.text import CountVectorizer
doc1 = "Fundamental issues related to the design of operating systems. Process scheduling and coordination, deadlock, memory management and elements of distributed systems."
doc2 ... | true |
7fd9780bf8a1186822c20c0556fc29616e0153a3 | Python | shadrul/dsa-levelup | /array&vectors/mindiff.py | UTF-8 | 609 | 3.359375 | 3 | [] | no_license | #min Difference
import sys
def minDiff(a,b):
al = len(a)
bl = len(b)
a.sort()
b.sort()
m= sys.maxsize
i =j =0
while(i<al and j<bl):
if(abs(a[i]-b[j])<m):
m = abs(a[i]-b[j])
x = a[i]
y = b[j]
if(a[i]<b[j]):
i+=1
elif(a[i]... | true |
f81dfa9f5677c582ccec889bc75c8c5e90308613 | Python | ccxt/ccxt | /python/ccxt/async_support/base/ws/order_book_side.py | UTF-8 | 6,072 | 2.765625 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
import sys
import bisect
"""Author: Carlo Revelli"""
"""Fast bisect bindings"""
"""https://github.com/python/cpython/blob/master/Modules/_bisectmodule.c"""
"""Performs a binary search when inserting keys in sorted order"""
class OrderBookSide(list):
side = None # set to True for bids an... | true |
8de117f8192ba535049227cff7663b0942652141 | Python | oscarburgo/AgendaNadela | /sections/delete_contact.py | UTF-8 | 317 | 2.640625 | 3 | [] | no_license | import db.core as db
from sections.view_contacts import run as view_contacts
def run():
contactos = db.read()
view_contacts()
index_contacto = int(input("[+] Selecciona un contacto: ")) - 1
contactos.remove(contactos[index_contacto])
db.save(contactos)
print("Contacto eliminado!")
| true |
f897662d2fea5b955c761d8c005ae8690a90c79b | Python | Silviu777/Blockchain | /main.py | UTF-8 | 2,023 | 3.0625 | 3 | [] | no_license | import os
from hashlib import sha256
from random import randint
from datetime import datetime
import json
class BlockChainGenerator():
def __init__(self, fileName, newChain=True, difficultyLevel=2):
self.fileName = fileName
self.newChain = newChain
self.difficultyLevel = difficultyLevel
... | true |
46dd5858b63cd6c563f382d06ed275234d6e80be | Python | pythonTedo/Pygame | /knightGame/main.py | UTF-8 | 12,912 | 2.84375 | 3 | [] | no_license | import pygame
import random
import button
pygame.init()
pygame.font.init()
bottom_panel = 150
WIDTH, HEIGHT = 800, 400 + bottom_panel
screen = pygame.display.set_mode((WIDTH, HEIGHT))
pygame.display.set_caption("Battle")
#define fonts
font = pygame.font.SysFont("Times New Roman", 26)
red = (255, 0, 0)
green = (0, 25... | true |
6500d85ca8fce5bf0996a7479f3ec9e7d64c14d5 | Python | JonPython/LearningCommunicate | /LearningCommunicate/question.py | UTF-8 | 13,262 | 2.8125 | 3 | [] | no_license | # coding="utf-8"
'''问题数据库>>>:
1,使用库名Ifquestion
2.1,建立问题总表userask,字段包含:
1,uid(int主键,自增长),
2,用户名user(非空),
3,问题类型type(enum,包含:"Python","数据库","网络编程","WEB",
"GUI","模块相关","项目相关","其他","心情墙")
4,问题标题title(限制40个字)
5,问题详情question(varchar(5000))
6,图片字段img1 mediumblob... | true |
f3ec95729520fd62d6756f3bb58ce980696d89ef | Python | HannahYH/My-Projects | /CV_Segmentation/SVM.py | UTF-8 | 11,325 | 2.53125 | 3 | [] | no_license | # Writted by Hanxin Chen, Xueyan Lu and Han Yang
# This is the code for TwoStep (SVM + Post-processing) Method
# https://github.com/dgriffiths3/ml_segmentation
# above link is the reference of our code
import os
import cv2
import time
import math
import random
import numpy as np
import pickle as pkl
import mahotas as... | true |
d9856d1782e484b89593d854eb1fe8a0a7a12041 | Python | lilunjiaax/JvlunlTest | /python实现排序算法.py | UTF-8 | 7,452 | 3.90625 | 4 | [] | no_license | """
简单选择排序:依次遍历未排序的列表,选出其中的最小值,插在对应的位置
第一次遍历[0:n]得到最小值,排在第一个位置,
第二次遍历[1:n]得到最小值,排在第二个位置,
。。。。
"""
def selectionSort(a_list):
"""
选择排序
:param a_list:
:return:
"""
a_len = len(a_list)
for i in range(a_len):
a_min = a_list[i]
ind = i
for j in range(i+1, a_len):
... | true |
848c6986d6c57f55b6d4f3ffcc3345ea4ccbd55a | Python | Wenzurk-Ma/Python-Crash-Course | /Chapter 05/ages.py | UTF-8 | 359 | 3.671875 | 4 | [
"Apache-2.0"
] | permissive | # Title : TODO
# Objective : TODO
# Created by: Wenzurk
# Created on: 2018/2/6
age = 21
if age < 2:
print("She is a baby.")
elif age < 4:
print("She is a child.")
elif age < 13:
print("She is a little girl.")
elif age < 20:
print("She is a beautiful girl.")
elif age < 65:
print("She is a woman... | true |
77e02731f4b1b36bfd023f432c30208d64b8eb74 | Python | grecoe/pythonthreading | /pageparser/persist.py | UTF-8 | 1,311 | 3.171875 | 3 | [
"MIT"
] | permissive | from datetime import datetime
import os
import json
def normalizeBase(base):
if not base:
base = '.\\'
elif not os.path.isdir(base):
os.mkdir(base)
if not base.endswith('\\'):
base += '\\'
return base
def createPath(base, name, time_stamp = datetime.now()):
'''
Bu... | true |
708889792ce6ed99bdc1635bc28c1407ec7a4245 | Python | xiang-daode/Python3_codes | /compile.py | UTF-8 | 234 | 3.046875 | 3 | [] | no_license | # 在这里写上你的代码 :-)
# 单一名句用exel:
x = compile('print(12345679*18)', 'test', 'eval')
exec(x)
# 多行语句用exec:
x = compile('''
v=3*3+4*4
u=5*5
w=65536**(1/16)
print(v,u,w)
''',
'myCode', 'exec')
exec(x)
| true |
f9bf53d436d0e188489c960253b1dc4a1c7340cc | Python | luczakmarta/mod8ex2 | /main.py | UTF-8 | 681 | 2.515625 | 3 | [] | no_license | from flask import request, redirect
from flask import render_template
from flask import Flask
app = Flask(__name__)
@app.route('/mypage/me', methods=['GET'])
def mypage():
print("We received GET")
return render_template("main.html")
# http://127.0.0.1:5000/mypage/me
@app.route ('/mypage/contact', methods=['... | true |
19861d470de1341c4aa278d8260cb4e0c6d6c393 | Python | Renl1001/DeepLearning | /demo/Text/data/prepare.py | UTF-8 | 2,328 | 3 | 3 | [] | no_license | import os
from shutil import copyfile
def copy_file(max_num):
"""复制部分数据到新的文件夹中,降低数据量
Arguments:
max_num {int} -- 每个类别的最大数量
"""
MAX_NUM = max_num
path = 'THUCNews'
dst_path = 'mini_News'
if not os.path.isdir(dst_path):
os.mkdir(dst_path)
for item in os.listdir(path):
... | true |
bd7ea4423cabfec9edf4d3a0088e5cf7bedfc9e2 | Python | rchughye/tripping-octo-wight | /PEuler009.py | UTF-8 | 609 | 3.734375 | 4 | [] | no_license | # Euler Problem #9: Special Pythagorean triplet
# http://projecteuler.net/problem=9
# Q: There exists exactly one Pythagorean triplet for which a + b + c = 1000.
# Find the product abc.
# A: 31875000
# Iterate through all pairs of c and (a+b) which sum to 1000. Print answer when a^2 + b^2 = c^2
# Initialize
answer = 0... | true |
36e22ee6b37fc7f689080ceb620a73c7cd28bf58 | Python | crisp-k/python_crash_course | /chapter4/exercise13.py | UTF-8 | 269 | 3.640625 | 4 | [] | no_license | buffet_food = ("chicken", "steak", "oranges", "watermelon", "noods")
for food in buffet_food:
print(food)
# throws error
#buffet_food[0] = pork
print("\n")
buffet_food = ("pork", "steak", "apples", "watermelon", "noods")
for food in buffet_food:
print(food) | true |
1ed2cbc36aa1bd5a86097cf275140efd2bf19615 | Python | politecnicomodelopoo2018/farappa_guia1-2.0 | /Prueba_1_Persona.py | UTF-8 | 1,158 | 2.5625 | 3 | [] | no_license | from Prueba_1_Medidas import Medisonga
import datetime
class Persona(object):
nombre=None
apellido=None
fecha_nac=None
def __init__(self,nombre,apellido,fecha):
self.lista_medidas = []
self.nombre=nombre
self.apellido=apellido
self.fecha_nac=fecha
def agregarMedida... | true |
ac17c35017eb57d5d610f3ffb77d5bd2ff7880ef | Python | jun1116/aib_section3_project | /func/company_answer.py | UTF-8 | 486 | 2.65625 | 3 | [] | no_license | #회사의 답변에 대한 기능을 하는 func
from func.func_gangnamBike import gangnamBike
from kokoa.models.user_model import Company
#회사들의 답변을 처음 여기서 나눠서 진행합니다.
def company_answer(company_id, text=None):
if company_id==1:
return gangnamBike(text)
else:
cname = Company.query.get(company_id)
return f"죄송합니다... | true |
4328560ba17c07ea392bf6bb4e5b06ed14be38f4 | Python | sknutsen/INFO132v2019 | /Oblig8/skn003_Oblig8.py | UTF-8 | 2,289 | 3.78125 | 4 | [] | no_license | import re
# Temainnlevering 8
# Sondre Knutsen (skn003)
# Oppgave 1
Bøker = {('Blackburn', 'Modal logic'): ('logikk', '2002'),
('Brook', 'Knowledge and Mind'): ('filosofi', '2000'),
('Dowek', 'Computation, proof, machine'): ('matematikk', '2015'),
('Dowek', 'Proofs and algorithms'): ('logi... | true |
124f1fd010909c5cdd1fcb2ca3e1033fbbb800ea | Python | evanreyes/DojoAssignments | /python/week1/5_friday/01-multiplication_table.py | UTF-8 | 170 | 2.984375 | 3 | [] | no_license | print "x",
for a in range(1,13):
print a,
print ""
for i in range(0,13):
if i > 0:
print i, i*1, i*2, i*3, i*4, i*5, i*6, i*7, i*8, i*9, i*10, i*11, i*12
| true |
a1c6b6de5669b15a29bb839c8d71077cc6713f92 | Python | dr-dos-ok/Code_Jam_Webscraper | /solutions_python/Problem_118/1504.py | UTF-8 | 1,103 | 3.25 | 3 | [] | no_license | #!/usr/bin/python
import readline
root = [1, 2, 3, 11, 22, 101, 111, 121, 202, 212, 1001, 1111, 2002, 10001, 10101, 10201, 11011, 11111, 11211, 20002, 20102, 100001, 101101, 110011, 111111, 200002, 1000001, 1001001, 1002001, 1010101, 1011101, 1012101, 1100011, 1101011, 1102011, 1110111, 1111111, 2000002, 2001002]
squar... | true |
84f8c18f13763489d3ee7268caeb7acade32e44d | Python | Johnson-Lab-BYU/End-Bias | /CoverageRetriever.py | UTF-8 | 6,250 | 3.015625 | 3 | [] | no_license | import sys
import threading
#This program is designed to output average coverage ratio data at a single bp resolution at a
#user-defined distance from known fragment ends. The input for this program is output from binMassager.py.
#The output of this program is a single value, necessitating multiple program calls... | true |
119d101020b01570ceef54fb98465dd0b10418ba | Python | qzq2514/DNNCode | /Classification/DenseNet/nets/DenseNetForDigit.py | UTF-8 | 7,157 | 2.578125 | 3 | [] | no_license | import collections
import tensorflow as tf
import tensorflow.contrib.slim as slim
class DenseNetForDigit(object):
def __init__(self, is_training, num_classes,growth_rate,net_depth):
self.num_classes = num_classes
self._is_training = is_training
self.growth_rate=growth_rate #在DenseNe... | true |
6a1af4d58a47ae8d21c0dad7638805202bfdae7e | Python | aaronbolyard-school/kvlc | /main.py | UTF-8 | 1,567 | 3.640625 | 4 | [] | no_license | import kvlc.model.calculator as calculator
def get_integer(prompt):
while True:
print(prompt + " ", end="")
value = input()
try:
return int(value)
except:
print("Please enter an integer.")
OPERATION_ACTION_REPEAT = 1
OPERATION_ACTION_MAIN_MENU = 2
def should_repeat():
while True:
print("1. Repe... | true |
d85827df53d6c382f45a9628b06d5a314a744963 | Python | cffppa/appium_autotest | /mooc_project/pages/classify_page.py | UTF-8 | 959 | 2.703125 | 3 | [] | no_license | from pages.base_page import BasePage
import os
class ClassifyPage(BasePage):
def __init__(self,driver):
super(ClassifyPage,self).__init__(driver)
def lists(self):
classify_list=self.by_id('cn.com.open.mooc:id/rgClassify')
lists=classify_list.find_elements_by_class_name('android.widget.RadioButton')
print... | true |
60b223816690bf27b9eed3493b49e09886ef1698 | Python | hritesh-sonawane/pY1h0n | /Linear_DS/Linked_List/two_ptr_linked_list.py | UTF-8 | 1,825 | 4 | 4 | [] | no_license | from linked_list import LinkedList
def nth_last_node(linked_list, n):
current = None
tail_seeker = linked_list.head_node
count = 1
while tail_seeker:
tail_seeker = tail_seeker.get_next_node()
count += 1
if count >= n + 2:
if current is None:
current... | true |
71d2db478e2976678a2bc9497a28bd37583cc9e8 | Python | dada00321/NTUST_SIS_LineBot | /module/epidemic_info/ntu_system_epidemic_info_assistant.py | UTF-8 | 17,667 | 2.828125 | 3 | [
"MIT"
] | permissive | """
ntu_system_epidemic_info_assistant
臺灣大學系統-三校防疫資訊小助手
"""
from selenium import webdriver
#from config_reader import get_config
#from modules.basic_scraping_module import get_response
from module.epidemic_info.config_reader import get_config
from module.epidemic_info.modules.basic_scraping_module import get_respons... | true |
b0e136cb1e03067a57db2d3f317bf2251d829720 | Python | khaledfouda/Porto-Seguro-Kaggle-competetion- | /py/log.py | UTF-8 | 1,122 | 2.5625 | 3 | [] | no_license | #! /usr/bin/env python
import logging
log = None
handler = None
LOG_PATH = '../data/log/'
#---------------------------------------
def init(filename):
global log, handler
if log and handler : return "Error: log is already initialized. Try log.close() first."
if type(filename) != str or filename == '' : return "Error... | true |
fff4ebb2e009ac24db2d1a7f65fa74ecf300b31b | Python | andrewtarzia/stk | /src/stk/_internal/ea/fitness_normalizers/multiply.py | UTF-8 | 5,375 | 3.453125 | 3 | [
"MIT"
] | permissive | import typing
from collections.abc import Callable, Iterable
from typing import Any
import numpy as np
from .fitness_normalizer import FitnessNormalizer
T = typing.TypeVar("T")
class Multiply(FitnessNormalizer[T]):
"""
Multiplies the fitness values by some coefficient.
Examples:
*Multiplying ... | true |
203de36c568bb08e8db78d92ff016baaa6391aa9 | Python | kbhat1234/Python-Project | /python/time1.py | UTF-8 | 822 | 3.140625 | 3 | [] | no_license | import time
def time_func():
localtime = time.localtime(time.time())
print time.time()
print localtime
print time.clock()
print time.ctime()
print time.altzone
localtime = time.asctime( time.localtime(time.time()) )
print localti... | true |
eda806ccaa93cee3197932909311a5c40559d3b7 | Python | josedom24/plataforma_pledin | /cursos/_python3/python3/curso/u39/ejemplo6.py | UTF-8 | 154 | 3.734375 | 4 | [] | no_license |
def nivel(numero):
if numero<0:
raise ValueError("El número debe ser positivo:"+str(numero))
else:
return numero
print(nivel(5))
print(nivel(-1)) | true |
fba9c1eaa2a5dd6e8c9f5654bc9585004aa6c6d3 | Python | kevhahn97/Twitch-chat-insight | /chat_nlp.py | UTF-8 | 943 | 2.921875 | 3 | [] | no_license | import json
import re
from konlpy.tag import Okt
from collections import Counter
def main():
filename = input("Input: ")
with open(filename+'.json', 'r', encoding='utf-8-sig') as data_file:
data = json.load(data_file)
nouns_file = filename+"_nouns.txt"
nouns = []
nlpy =... | true |
addbd44ab5cf686380b4f1ce7697d757506995cc | Python | IAmTomaton/KGG | /task4.py | UTF-8 | 2,010 | 3.390625 | 3 | [] | no_license | import math
from App import App
def coord_x(x, y, z):
return (y - x) * math.sqrt(3.0) / 2
def coord_y(x, y, z):
return (x + y) / 2 - z
def get_pixels(width, height, n, m, f):
x1 = -3
x2 = 3
y1 = -3
y2 = 3
top = [height for _ in range(0, width + 1)]
bottom = [0 for _ in range(0, wid... | true |
51e158da252294fd4a75b193fb86c26839f7d540 | Python | datemitumasa/Robocup | /body_module_wrist_wrench_manager/src/wrist_wrench_manager.py~ | UTF-8 | 3,042 | 2.53125 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
import rospy
from geometry_msgs.msg import WrenchStamped
from body_module_wrist_wrench_manager.msg import WristWrenchForceAction, WristWrenchForceResult, WristWrenchForceFeedback
import numpy as np
import time
import actionlib
class WristWrench(object):
def __init__(self):
... | true |
96f6db1596e78e5f51548079fca922ad671c3c4c | Python | sHongJung/Data_Analytics | /06-API/3/Activities/01-Stu_Wrapper_Recap/Solved/WeatherForecast-Bonus.py | UTF-8 | 1,009 | 3.390625 | 3 | [] | no_license | # Dependencies
import requests
import json
import datetime
import matplotlib.pyplot as plt
from matplotlib.dates import DateFormatter
# Weather
api_key = "c7f9f57b4779391ea1f5ae067591c971"
# Endpoint URL for five day forecast Phoenix, AZ
target_url = "http://api.openweathermap.org/data/2.5/forecast" \
"?q=Phoenix... | true |
f2a806f38153d91c9506af966ccd10ef958ba4be | Python | antonmeskildsen/Thesis-Code | /thesis/optim/status.py | UTF-8 | 684 | 2.71875 | 3 | [] | no_license | from abc import ABC, abstractmethod
from tqdm import tqdm
from streamlit import progress
class ProgressBar(ABC):
@abstractmethod
def __init__(self, total):
...
@abstractmethod
def update(self, i):
...
@abstractmethod
def close(self):
...
class TQDMBar(ProgressBar):... | true |
73c1835cd6bb071d9cb0093098cb08d8b2b30071 | Python | itsolutionscorp/AutoStyle-Clustering | /all_data/exercism_data/python/word-count/87b7de218dc14cdbaf023efd572de56b.py | UTF-8 | 292 | 3.203125 | 3 | [] | no_license | from collections import defaultdict
from string import punctuation
def word_count(sentence):
counts = defaultdict(int)
sentence = filter(lambda c: c not in punctuation, sentence).lower()
words = sentence.split()
for word in words:
counts[word] += 1
return counts
| true |
1b7e2ebd3ab87011697598a9fb7a0a6b3d9efcec | Python | chongminggao/pseudo_dyna_q | /utils/zlog.py | UTF-8 | 929 | 2.9375 | 3 | [] | no_license | #!/usr/bin/python
# encoding: utf-8
from datetime import datetime
def get_now_time():
return datetime.now().strftime("%Y-%m-%d_%H:%M:%S")
def generating_log(*info):
temp = get_now_time() + " " + info[0]
for item in info[1:]:
temp += "\t" + str(item)
temp += '\n'
with open(log.log_path, 'a... | true |
f489fcf26e7266f13d3b1ebdfdb7f34aa5e0921d | Python | inkyu0103/BOJ | /Daliy/8.23/2346.py | UTF-8 | 414 | 3.21875 | 3 | [] | no_license | # 2346 풍선터뜨리기
import sys
from collections import deque
input = sys.stdin.readline
answer = []
stack = []
arr = deque([])
N = int(input())
for idx,ele in enumerate(map(int,input().split())):
arr.append([idx+1,ele])
# 첫 번째 풍선
while arr:
idx,ele = arr.popleft()
answer.append(idx)
if ele > 0:
a... | true |
3b162963bed7bbbc4c00cee3f6ca9d73e8a25fe7 | Python | CleberSilva93/Study-Exercicios-Python | /06 - Two_Operation_on_format.py | UTF-8 | 126 | 3.875 | 4 | [] | no_license | r = int(input('Digite valor do raio de um círculo:\n'))
print('A área do circulo com raio {}, é {}'.format(r,(r**2)*3.14))
| true |
8f1d14e041e7f5305abc6b7528729d20e7cc1e1d | Python | bse524/test1 | /py005.py | UTF-8 | 237 | 3.40625 | 3 | [] | no_license | n1 = 21
if n1 % 3 ==0 and n1 % 7 ==0:
print('3과 7의 배수입니다.')
elif n1 % 3 ==0:
print('3의 배수입니다.')
elif n1 % 7 ==0:
print('7의 배수입니다.')
else:
print('3과 7의 배수가 아닙니다.')
| true |
5d841b1dbba5c38d7d97827eefcfd7a1f163c8ae | Python | ljyspark/AES-ECB-of-Python | /GUI.py | UTF-8 | 3,749 | 2.875 | 3 | [] | no_license | #-*- coding: utf-8 -*-
import wx
import sys, os
import AES
APP_TITLE = u'AES进制转换器'
APP_ICON = 'Key.ico' # 请更换成你的icon
class mainFrame(wx.Frame):
'''程序主窗口类,继承自wx.Frame'''
def __init__(self):
'''构造函数'''
wx.Frame.__init__(self, None, -1, APP_TITLE, style=wx.DEFAULT_FR... | true |
59b98448c571ed851ae118e9a7ae38e6cab6039d | Python | KangSuzy/algorithms | /baekjoon/1152.py | UTF-8 | 1,021 | 3.75 | 4 | [] | no_license | """
단어의 개수 성공
시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
2 초 128 MB 74931 17055 12247 23.053%
문제
영어 대소문자와 띄어쓰기만으로 이루어진 문자열이 주어진다. 이 문자열에는 몇 개의 단어가 있을까? 이를 구하는 프로그램을 작성하시오. 단, 한 단어가 여러 번 등장하면 등장한 횟수만큼 모두 세어야 한다.
입력
첫 줄에 영어 대소문자와 띄어쓰기로 이루어진 문자열이 주어진다. 이 문자열의 길이는 1,000,000을 넘지 않는다. 단어는 띄어쓰기 한 개로 구분되며, 공백이 연속해서 나오는 경우는 없다. 또한 문자열의 앞과... | true |
1c017dc1a8c3e9eb2d6b586166ced9f8a8b6204b | Python | whaleygeek/sa_piwars | /microbit_code/tilt_test.py | UTF-8 | 165 | 2.953125 | 3 | [
"MIT"
] | permissive | from microbit import *
while True:
sleep(100)
x = accelerometer.get_x()
if x < -200:
print("L")
if x > 200:
print("R")
| true |
7bf11122c85eb1125e085c665acdd51b47d4768c | Python | Aasthaengg/IBMdataset | /Python_codes/p03970/s893308714.py | UTF-8 | 255 | 3.265625 | 3 | [] | no_license | # Problem A - Signboard
# input process
S = input()
# initialization
teacher_data = "CODEFESTIVAL2016"
swap_count = 0
# count process
for i in range(len(S)):
if not S[i]==teacher_data[i]:
swap_count += 1
# output process
print(swap_count)
| true |
da426abe7ceee0ab38d34620ec38fb16d38c88db | Python | NTUT-109AB8011/crawler | /exercise/learn_python_dm2039/ch30/ch30_16.py | UTF-8 | 400 | 3.5 | 4 | [] | no_license | # ch30_16.py
import threading
import time
def worker():
print(threading.currentThread().getName(), 'Starting')
time.sleep(3)
print(threading.currentThread().getName(), 'Exiting')
w = threading.Thread(name='worker',target=worker)
w.start()
print('start join')
w.join(1.5) # 等待worker執... | true |
a37cefc168f1db345d7966bfbef3f88cdd037410 | Python | chanyadeshani/student-api | /model.py | UTF-8 | 303 | 3.671875 | 4 | [] | no_license | import datetime
class Student:
birthday = datetime.datetime(1988, 1, 1)
def __init__(self, id, name):
self.id = id
self.name = name
def print_student(self):
print("Id : " + self.id + ", Name : " + self.name + ", Birthday : " + self.birthday.strftime('%Y-%m-%d'))
| true |
3b1f2f114f13a0c6a89a0ad715c0cbfab63ab6ae | Python | xsarinix/mission-to-mars | /app.py | UTF-8 | 854 | 2.625 | 3 | [] | no_license | # import libraries
from flask import Flask, render_template, redirect
import pymongo
conn = 'mongodb://localhost:27017'
client = pymongo.MongoClient(conn)
db = client.mars_db
col = db.scrapes
# create instance of Flask app
app = Flask(__name__)
# create route that renders index.html template
@app.route("/scrape")
de... | true |
62eb4249aea7d2a997901789d0b433ec519ba7fd | Python | daniel-reich/ubiquitous-fiesta | /sZkMrkgnRN3z4CxxB_3.py | UTF-8 | 348 | 3.4375 | 3 | [] | no_license |
class Rectangle:
def __init__(self, x, y, w, h):
self.x = x
self.y = y
self.w = w
self.h = h
def intersecting(r1, r2):
return ((r1.x <= r2.x <= r1.x + r1.w and r1.y <= r2.y <= r1.y + r1.h) or
(r1.x <= r2.x + r2.w <= r1.x + r1.w and r1.y <= r2.y + r2.w <=
... | true |
faa7b67c61d13271ff8d7dfa3f8347780b66bb67 | Python | YukunQu/pyfiber | /test/vis_surfer_conjuction_map.py | UTF-8 | 2,623 | 2.65625 | 3 | [] | no_license | import os.path as op
import numpy as np
import nibabel as nib
from surfer import Brain
print(__doc__)
"""
Initialize the visualization.
"""
brain = Brain("fsaverage_sym", "lh", "inflated", background="white")
"""
Read both of the activation maps in using
surfer's io functions.
"""
sig_v1v = nib.load("/nfs/s2/userhom... | true |
79914e68529581182faf31bee61a90693a2ea8c1 | Python | 3ri4nG0ld/Arch-Installer | /TEST.py | UTF-8 | 41 | 3.140625 | 3 | [] | no_license | text="HOLA"
text=text.lower()
print(text) | true |
5c98a0198dd94a34c1f2e8b485fce19df4a6110b | Python | eselyavka/python | /leetcode/solution_314.py | UTF-8 | 1,303 | 3.46875 | 3 | [] | no_license | #!/usr/bin/env python
import unittest
from collections import defaultdict, deque
class TreeNode:
def __init__(self, val=0, left=None, right=None):
self.val = val
self.left = left
self.right = right
class Solution:
def verticalOrder(self, root):
"""
:type root: TreeNo... | true |
1e89df26f5cc7a021693449424ac9d5263117560 | Python | mbharanya/Advent-of-code-2020 | /day8/day8_1.py | UTF-8 | 977 | 3.203125 | 3 | [] | no_license |
filename = "/home/xmbomb/dev/aoc2020/day8/input.txt"
example_instructions = """nop +0
acc +1
jmp +4
acc +3
jmp -3
acc -99
acc +1
jmp -4
acc +6
"""
def part1(lines):
def run(i, acc, already_ran):
line = lines[i]
if i in already_ran:
print(f'Infinite loop, acc is {acc}')
e... | true |
97e253cabe4c33d993855128a5da9d78ff334b7e | Python | ChangxingJiang/Python-DM-Homework-W1-W3 | /Day-06/Exercise-05-彭高杲.py | UTF-8 | 656 | 4.21875 | 4 | [] | no_license | #1. 将Day02中计算有效互动比的方法写为函数
def interactive_rate():
number_fans = float(input('Please write the number of fans there: '))
number_interaction = float(input('The number of interaction: '))
rate = str(round(number_interaction/number_fans,3))
print('Efficient interactive rate is '+rate)
interactive_rate()
... | true |
4c3ba5cefe462df1fe28644084fb5330d97b283c | Python | n0thing233/n0thing233.github.io | /noodlewhale/Facebook/面试前过的题/65. Valid Number.py | UTF-8 | 1,528 | 3.109375 | 3 | [] | no_license | #edge cases 有限状态机太恶心了
# 注意区分None 和 len(x) == 0 是不一样的
from collections import Counter
class Solution:
def isNumber(self, s: str) -> bool:
def is_only_digit(s):
for i in s:
if not ord('0') <= ord(i) <= ord('9'):
return False
return True
def i... | true |
d174218a840987215e58c3be548455c2bfdab948 | Python | chenzheng1996/monitoring-ecosystem-resilience | /pyveg/src/image_utils.py | UTF-8 | 18,817 | 3.015625 | 3 | [
"MIT"
] | permissive | """
Modify, and slice up tif and png images using Python Image Library
Needs a relatively recent version of pillow (fork of PIL):
```
pip install --upgrade pillow
```
"""
import os
import sys
import json
import pandas as pd
import numpy as np
import cv2 as cv
from PIL import Image
import imageio
import matplotlib
... | true |
8110bde386ce20b444556a5d0cd1932c4e54eb23 | Python | abinj/distributed_ml_pyspark | /ml_pipeline.py | UTF-8 | 1,644 | 2.90625 | 3 | [] | no_license | from pyspark.sql import SparkSession
import matplotlib.pyplot as plt
# Instantiate a spark session
spark = SparkSession.builder\
.master("local[*]")\
.appName("flights_delay")\
.config("spark.driver.memory", "8g")\
.getOrCreate()
# Load raw data
df = spark.read.csv("/home/abin/my_works/datasets/flig... | true |
bec64435614e5fad3c2ea6178d3d7aac7babbd2f | Python | sharmaabhijith/Soft_Adversarial_Training | /model/network/LeNet.py | UTF-8 | 2,337 | 2.703125 | 3 | [] | no_license | import torch
import torch.nn as nn
import torch.nn.functional as F
import matplotlib.pyplot as plt
import copy
from torchvision.utils import make_grid
from matplotlib.pyplot import MultipleLocator
class LeNet(nn.Module):
def __init__(self):
super(LeNet, self).__init__()
self.conv1 = nn.Conv2d(1, 6,... | true |
edad2201b152df03ac370c826d1135ea54f87ff1 | Python | PonderLY/ACTOR | /code/crossorder.py | UTF-8 | 12,606 | 2.609375 | 3 | [] | no_license | """
Add User
20180923
Author: Liu Yang
"""
import numpy as np
import time
import ast
from copy import deepcopy
from collections import defaultdict
import itertools
import pickle
import random
import math
import os, sys
import pdb
from paras import load_params
from sklearn.preprocessing import normalize
from crossdata... | true |
cc699c7e6a3c9fc1329f767190c2f54e439c3287 | Python | qiankl/spark-learning | /train_with_generator.py | UTF-8 | 7,522 | 2.703125 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# # Food Classification with Deep Learning in Keras / Tensorflow
# ## *Computer, what am I eating anyway?*
# ## Experiment
# ### Loading and Preprocessing Dataset
# Let's import all of the packages needed for the rest of the notebook:
# In[1]:
import matplotlib.pyplot as plt... | true |
cd920ec6e5d475f6e1fb56e09f6d5d748291c23f | Python | akimi-yano/algorithm-practice | /lc/review_129.SumRootToLeafNumbers.py | UTF-8 | 3,429 | 4.03125 | 4 | [] | no_license | # 129. Sum Root to Leaf Numbers
# Medium
# 3194
# 67
# Add to List
# Share
# You are given the root of a binary tree containing digits from 0 to 9 only.
# Each root-to-leaf path in the tree represents a number.
# For example, the root-to-leaf path 1 -> 2 -> 3 represents the number 123.
# Return the total sum of a... | true |
389b2422a6b4b9273d39b77abbcd8fad6de2fd63 | Python | laura-yuan/KaggleSpeechRecognition | /system_config.py | UTF-8 | 301 | 2.875 | 3 | [] | no_license | def get_system_config():
import csv
# first, get into the folder of system config....
system_config = {}
with open('systemConfig.csv') as f:
content = csv.reader(f, delimiter = ';')
for row in content:
system_config[row[0]] = row[1]
return system_config | true |
e162776f770b5bf38bbb5285eb5cfcf7ddb69bfa | Python | hareton0807/CMPUT_206 | /lab3/part1.py | UTF-8 | 2,390 | 2.765625 | 3 | [] | no_license | import cv2
import numpy as np
import scipy
from scipy import ndimage, misc
import matplotlib.pyplot as plt
import math
def main():
# Read an grayscale image
img = cv2.imread("frame180.jpg",0)
## cv2.imshow("Gradient magnitude image",mag)
## cv2.waitKey(0)
## cv2.destroyAllWindows()
... | true |
7b4e51aff59383b23b7eff91c0836d2229ec2c63 | Python | mmmaaaggg/RefUtils | /src/fh_tools/language_test/Test/forfor.py | UTF-8 | 489 | 3.078125 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
"""
Created on 2017/7/29
@author: MG
"""
import pandas as pd
file_path = r'd:\Downloads\Account600030.xls'
data_df = pd.read_excel(file_path)
import xlrd
# 获取一个Book对象
book = xlrd.open_workbook(file_path)
# 获取一个sheet对象的列表
sheets = book.sheets()
# 遍历每一个sheet,输出这个sheet的名字(如果是新建... | true |
5028753dadc2153ddf79d7b1018629d4b7e615de | Python | verbal-noun/tf-digit-recogniser- | /model.py | UTF-8 | 6,985 | 2.5625 | 3 | [] | no_license | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import argparse
import sys
import numpy as np
from numpy import array
import pandas as pd
import tensorflow as tf
from sklearn.model_selection import ShuffleSplit
from sklearn.preprocessing import OneHotEncode... | true |
66db3ea02ceb7437f2941a166fd1be5ac8f6b3e3 | Python | alainlou/leetcode | /p1685.py | UTF-8 | 521 | 3.015625 | 3 | [] | no_license | from typing import List
class Solution:
def getSumAbsoluteDifferences(self, nums: List[int]) -> List[int]:
n = len(nums)
left = [0]*n
for i in range(1,n):
left[i] += (nums[i]-nums[i-1])*(i)
left[i] += left[i-1]
right = [0]*n
for i in range(n-2, -1, ... | true |
0b8c597ec73877fe6c1aef739ecc672cbb3e0aaa | Python | thanhpham3598/PhamHongThanh-Fundamental-C4E-14 | /session4/hw4/se2_a.py | UTF-8 | 136 | 3.890625 | 4 | [] | no_license | nums = [1, 6, 8, 1, 2, 1, 5, 6]
x = int(input('Enter a number:'))
print('{0} appears {1} times in my list'.format(x, nums.count(x)))
| true |
0e878016fadab1f137f3dd61c37197ecafa4511e | Python | viniciuskurt/LetsCode-PracticalProjects | /2-AdvancedStructures/Listas_com_While.py | UTF-8 | 438 | 4.25 | 4 | [] | no_license | # Uma forma inteligente de trabalhar é combinar Listas com Whiles
numeros = [1, 2, 3, 4, 5] #Criando e atribuindo valores a lista
indice = 0 #definindo contador no índice 0
while indice < 5: #Definindo repetição do laço enquanto menor que 5
print(numeros[indice]) #Exibe p... | true |
cdcd072002e891a68f107f5dcb218c2a50940df6 | Python | jesieOldenburg/python_book_1 | /exercises/jakes_flowers/arrangements/mothers_day_arrangement.py | UTF-8 | 1,429 | 3.4375 | 3 | [] | no_license | from . import Arrangement
from interfaces.not_refrigerated import INotRefrigerated
class Mothers_day_arrangement(Arrangement, INotRefrigerated):
"""
A class used to represent a arrangement of flowers
...
Attributes
----------
name : str
the name of the arrangemen... | true |
2c2e3550ee62acc9e775343ba99393673dfd1457 | Python | pkulwj1994/Contrastive_Divergence | /data.py | UTF-8 | 511 | 2.78125 | 3 | [] | no_license | import math
import torch
def sample_data(n_samples):
'''taken from https://github.com/kamenbliznashki/normalizing_flows/blob/master/bnaf.py'''
z = torch.randn(n_samples, 2)
scale = 4
sq2 = 1 / math.sqrt(2)
centers = [(1, 0), (-1, 0), (0, 1), (0, -1), (sq2, sq2),
(-sq2, sq2), (sq2,... | true |
5abc00493eaacd58685cd870c7a13e1430f14af0 | Python | samford100/nba-sentiment | /analysis.py | UTF-8 | 7,447 | 2.765625 | 3 | [] | no_license | import numpy as np
# import sklearn
import pandas as pd
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import OneHotEncoder, LabelEncoder
import tensorflow as tf
'''
select the autoregression j = 5 (go back 5 games)
win(0) = regress([
sen_com(-5), win(-5),
sen_com(-4), win(-4),... | true |
90fc2780c54f91d5f5141c68fd0c4f718e080192 | Python | chamarthyl/Learn-Python | /GlobalVariable.py | UTF-8 | 116 | 3.796875 | 4 | [] | no_license | x = "I want to learn "
y = "Python!"
print(x + y )
a = str(3)
b = int(3)
c = float(3)
print(a)
print(b)
print(c)
| true |
428c917deeda6ddf27c08dd76c335b626790fb94 | Python | 6igsm0ke/Introduction-to-Programming-Using-Python-Liang-1st-edtion | /CH05/EX5.24.py | UTF-8 | 1,385 | 4.09375 | 4 | [] | no_license | # 5.24 (Financial application: loan amortization schedule) The monthly payment for a
# given loan pays the principal and the interest. The monthly interest is computed by
# multiplying the monthly interest rate and the balance (the remaining principal).
# The principal paid for the month is therefore the monthly paymen... | true |
694ea72f384b9f3428408d9386de7e02cdad0a20 | Python | Divisekara/Python-Codes-First-sem | /PA2/PA2 2013/PA2-11/Asitha/pa2-11-2013.py | UTF-8 | 780 | 3.171875 | 3 | [] | no_license | n=0
words=[]
def getText():
try:
FileOpen=open("FileIn.txt","r")
L=map(list,FileOpen.read().split())
FileOpen.close()
except IOError:
print "File Not Found"
pass
else:
global n
global words
n=map(int,L[0])[0]
print n
words=L[1:]... | true |
9ef387ac61d017d46c46dbd2bcb267bd10d72e10 | Python | BEEmod/BEE2.4 | /src/config/last_sel.py | UTF-8 | 2,400 | 2.578125 | 3 | [] | no_license | from typing import Dict, Union
import attrs
from srctools import Property
from srctools.dmx import Element
import config
@config.APP.register
@attrs.frozen(slots=False)
class LastSelected(config.Data, conf_name='LastSelected', uses_id=True):
"""Used for several general items, specifies the last selected one for... | true |
b62ca8914863320d2742d639eda357fe00ec329e | Python | priyanshik18/codechef | /march_cookoff/Box_of_chocolates.py | UTF-8 | 460 | 2.609375 | 3 | [] | no_license | #TLE error
try:
t=int(input())
for i in range(t):
n=int(input())
w=list(map(int,input().split()))
h=int(n/2)
m=max(w)
count=0
if m not in w[:h]:
count+=1
for i in range(h):
w.insert(0,0)
w[0]=w[-1]
... | true |
bd9d989e4673479c7c52b507a55335789ae12469 | Python | zhujiang73/pytorch_mingw | /torch/_lowrank.py | UTF-8 | 10,419 | 3.234375 | 3 | [
"BSD-2-Clause"
] | permissive | """Implement various linear algebra algorithms for low rank matrices.
"""
__all__ = ['svd_lowrank', 'pca_lowrank']
from typing import Tuple, Optional
import torch
from torch import Tensor
from . import _linalg_utils as _utils
from ._overrides import has_torch_function, handle_torch_function
def get_approximate_bas... | true |
7e46e0107bc7c83ae0ec4a231f4aaca3da5e8c7c | Python | itepifanio/maps-graphs | /map.py | UTF-8 | 1,102 | 2.625 | 3 | [
"MIT"
] | permissive | import folium; f_map = folium.Map; f_circle = folium.CircleMarker
import osmapi; osm_nodesget = osmapi.OsmApi().NodesGet; osm_nodeways = osmapi.OsmApi().NodeWays
import pickle # deserialize list from file
import json
import tqdm; tqdm = tqdm.tqdm # progress bar
tileset = r'https://api.mapbox.com/styles/v1/mapbox/stree... | true |
3d48dc1b7d646912a395ad819048fed09f4c046c | Python | aloctavodia/density_estimation | /simulation/simulation.py | UTF-8 | 3,790 | 2.703125 | 3 | [] | no_license | import numpy as np
import pandas as pd
from sim_utils import print_status, simulate
pdf_kwargs = {
"gaussian_1": {"params": {"mean" : [0], "sd": [1]}, "func_key": "gaussian"},
"gaussian_2": {"params": {"mean" : [0], "sd": [2]}, "func_key": "gaussian"},
"gmixture_1": {"params": {"mean" : [-12, 12], "sd": [... | true |
2ba79fa3ca9526e142bd515ef7f32389d517fa4d | Python | tanzimzaki/Python_EH | /Port_Scanner.py | UTF-8 | 755 | 3.71875 | 4 | [] | no_license | #!/usr/bin/python
#Tanzim_Zaki_Saklayen
#Student_ID:10520140
import socket #retrieve socket library to perform the port scanning activity
ip_address = input("Enter IP address: ") #user is prompt to insert the IP address to inititate the scan
first = int(input("Enter first port: ")) #user is prompt to ... | true |
5855720cdb195d034e310d57be14d3abc423b98b | Python | Biewer/Doping-Tests-for-Cyber-Physical-Systems-Tool | /examples/nissan/DynamometerTrace.py | UTF-8 | 942 | 2.796875 | 3 | [
"MIT"
] | permissive | import os, sys
sys.path.insert(0, os.path.abspath("../"))
from tool.doping_monitor import RecordedTrace
from tool.doping_test import Input, Output
class DynamometerTrace(RecordedTrace):
"""A recorded trace on dynamometer and PEMS"""
def __init__(self, file_name):
super(DynamometerTrace, self).__init__(file_name)
... | true |
71fe5c9ab2a489e24fef0e8f4ea73c3e1774c2f0 | Python | hpp3/wec2016 | /parse.py | UTF-8 | 4,043 | 2.53125 | 3 | [] | no_license | import json
from astar import astar
roads_file = open('roads.json', 'r')
all_data = json.load(roads_file)
graph = {}
dist = {}
coord_to_seg = {}
seg_to_coord = {}
black_list = set([26896, 1517, 7608, 1526, 7947, 7494, 7469, 9064, 9062, 7572, 7514, 259, 1621, 29101, 30205, 7289, 274, 348, 80267])
# Update coord-seg ... | true |
170c670a9d2410d89eed45771b0ce97dee9fa39a | Python | xiuqingyao/azkaban_assistant | /schedule/util/alarm.py | UTF-8 | 384 | 2.546875 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/python
# coding=utf-8
import os
def send_html(mailto,title,content):
print '假装在发送邮件,请自行接入(schedule/util/alarm)'
print mailto
print title
def send_msg(msgto,content):
print '假装在发送短信,请自行接入(schedule/util/alarm)'
print msgto
print content
if __name__=='__main__':
send_msg(11111,'a... | true |
05785f2f56f4aa108e8012241f0679de7fe4aa46 | Python | andrewyoung1991/supriya | /supriya/tools/pendingugentools/SyncSaw.py | UTF-8 | 3,285 | 2.8125 | 3 | [
"MIT"
] | permissive | # -*- encoding: utf-8 -*-
from supriya.tools.ugentools.PureUGen import PureUGen
class SyncSaw(PureUGen):
r'''
::
>>> sync_saw = ugentools.SyncSaw.ar(
... saw_frequency=440,
... sync_frequency=440,
... )
>>> sync_saw
SyncSaw.ar()
'''
### C... | true |