blob_id large_string | repo_name large_string | path large_string | src_encoding large_string | length_bytes int64 | score float64 | int_score int64 | detected_licenses large list | license_type large_string | text string | download_success bool |
|---|---|---|---|---|---|---|---|---|---|---|
08cccbcb37ba8d1b037d9fab8211fb7104742115 | TorHou/merge_pcr_duplicates | /merge_pcr_duplicates.py | UTF-8 | 4,379 | 2.75 | 3 | [
"MIT"
] | permissive | import pysam
from collections import Counter
import argparse
from Bio import SeqIO
bam_data = []
score = Counter()
endResult = []
fastq_data = {}
bam_filter = []
merge_data = []
def get_bam_filter(line, chrom_bam):
if line.is_reverse:
strand = '-'
else:
strand = '+'
if 'N' not in fastq_dat... | true |
e4cf41840726b239fd624f0d67991c64a51c1475 | zcking/oink | /oink/db.py | UTF-8 | 939 | 2.875 | 3 | [
"MIT"
] | permissive | '''
File: db.py
'''
from __future__ import print_function
import os
import sqlite3
conn = None
def connect(path):
'''
Connect to the sqlite database provided at the specified path.
'''
global conn
conn = sqlite3.connect(os.path.join(path, 'oink.db'))
if os.environ.get('DEBUG', ''):
... | true |
3da22db0a85178c2cb29b489b74aea4ceb7ebafd | divergent96/IEEECTF | /crypto/ses_1/xor.py | UTF-8 | 500 | 3.59375 | 4 | [] | no_license | str1 = raw_input('Input string here : ')
str2 = raw_input('Input key here : ')
ans = []
#n=strlen(str1);
n=len(str1)
i = 0
print "Encrypted string : "
while i<n:
# temp=unichr(ord(str1[i])^ord(str2[i]))#ord to change unit string to integer(unicode) and unichar for the reverse
temp=str(ord(str1[i])^ord(... | true |
61c5bb4d86d8fb394cd292aae28f13196882defc | SibghatUllah13/Dimensionality_Reduction | /1772576.py | UTF-8 | 1,851 | 2.984375 | 3 | [] | no_license | import numpy as np
import pandas as pd
import os
import matplotlib.pyplot as plt
import random
import sys
lib=__import__("lib1772576")
#Extracting Data Into Pandas
args = sys.argv[1:]
values = args[1:]
for i in range(len(values)):
values[i] = int(values[i])
file_name = args[0]
cwd=os.getcwd()
path=cwd+"/"+file_n... | true |
f1a9a0748a2a73a5a710d28afd9175bdfb7f7ccb | charloe2000/vesselPath | /route.py | UTF-8 | 7,616 | 3.1875 | 3 | [] | no_license | """
route class
计算路线
"""
from cv2 import cv2
import config as cfg
import numpy as np
import json
class Route:
def __init__(self, img_origin_path, img_route_path, img_route_json):
"""
img_orgin_path: 黑白图的文件路径
img_route_path: 标有路线的黑白图的文件路径
"""
img_origin = cv2.imread(img_origi... | true |
c950c1a25094aec1b436c86bf49c5eebc96a76bb | Catsuko/ConnectFour | /strategies/cross_strategy.py | UTF-8 | 458 | 3.03125 | 3 | [] | no_license | from core.strategy import Strategy
class CrossStrategy(Strategy):
blocked = [0] * 1
def board_length(self):
self.board_width = len(self.board[0])
def place_token(self, token, board):
row_to_check = board[3]
for x in row_to_check:
if row_to_check[x] != 0 and self.blocked[... | true |
575f48da2a1bcc657e577e25f813533f6f336554 | niuduoduo2019/CBIC | /test/batch_rename.py | UTF-8 | 1,263 | 2.796875 | 3 | [] | no_license | import os
a = [3, 0, 4, 6, 1, 7, 2, 8, 5]
def images_from_folder(image_folder):
for f in os.listdir(image_folder):
num = int(f.split('.')[0])
bit = 0
if num/100 == 0:
if num % 100 / 10 == 0:
bit = 2
else:
bit = 1
newname = "0... | true |
9a2ae86fad9bc974032c330c291ba558e1033bc7 | FleeaniCh/python | /first_step/functional_programming/demo01_functional_programming.py | UTF-8 | 453 | 4.1875 | 4 | [] | no_license | """
函数式编程
"""
def fun01():
print("fun01执行喽")
# 调用方法,执行方法体
re1 = fun01()
print(re1)
# 将函数赋值个变量
re2 = fun01
# 通过变量调用函数
re2()
def fun02():
print("fun02执行喽")
# 将函数作为函数的参数进行传递
# 将一个函数的代码(fun02/fun01),注入到另外一个函数中(fun03)
def fun03(func):
print("fun03执行喽")
func()
fun03(fun01)
fun03(fun02)
| true |
e513de5370e35d061c4a1cd98b78216ec7e23824 | beerent/photosimple | /src/DatabaseManager.py | UTF-8 | 2,272 | 2.78125 | 3 | [] | no_license | from PropertiesManager import PropertiesManager
from warnings import filterwarnings
from Logger import Logger
import pymysql
pymysql.install_as_MySQLdb()
class DatabaseManager():
db = None
def __init__(self, host, username, password, database):
#warnings are for the weak, so ignore them!
... | true |
f4c84b3a22341183d9e6b682077282c6f1143af9 | dhimanray/WEM | /NAMD/template_milestone/trial_dynamics/old/DistanceReporter.py | UTF-8 | 5,259 | 2.671875 | 3 | [] | no_license | """
DistanceReporter.py:
Authors: Dhiman Ray
Modified from
----------------------------------------------------------------------
DistanceReporter.py:
Authors: Yuan-Yu
Contributors: Justin
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files ... | true |
f63037331cfd1539bf2ecc30265d2d0e34f48738 | videlec/pypolymake | /polymake/functions.py | UTF-8 | 7,708 | 3.265625 | 3 | [] | no_license | ###############################################################################
# Copyright (C) 2011-2012 Burcin Erocal <burcin@erocal.org>
# 2016 Vincent Delecroix <vincent.delecroix@labri.fr>
# Distributed under the terms of the GNU General Public License (GPL),
# version 3 or any lat... | true |
e806e743b17b9ae84ed5be67daec256fc5969725 | DanaMercury/dragonsoul | /runes/models.py | UTF-8 | 600 | 2.53125 | 3 | [] | no_license | from django.db import models
class Collection(models.Model):
"""Collection type, rec by DS"""
name = models.CharField(max_length = 50, unique = True, null = True)
def __str__(self):
return self.name
class Equipper(models.Model):
"""Heroes who use this type of collection"""
from heroes.models import Hero
... | true |
5adddb63ca8ef0129a2aad5dbdc20e0f8992733b | norcimo5/sandbox | /python_examples/CustomWidgets.py | UTF-8 | 3,371 | 2.734375 | 3 | [] | no_license | #!/usr/bin/env python
from Tkinter import *
from sets import Set
class SelectionControlListbox( Listbox ):
def __init__( self, parent=None, eventhandler=None, **kwargs ):
Listbox.__init__( self, parent, selectmode=SINGLE, **kwargs )
self.bind( '<Button-1>', self.onButton1Click )
self.bindt... | true |
0b2b8043f722b06f66b816624cf6a0932078a94a | 759796385/pythonDemo | /main/pandas/DataFrameDemo.py | UTF-8 | 1,790 | 3.1875 | 3 | [] | no_license | import pandas as pd
import numpy as np
# DataFrame(x轴,y轴)
left = pd.DataFrame({'logistics_code': ['1011'], 'sku_code': ['30010001'], 'inventory': [4]})
right = pd.DataFrame({'warehouse_code': ['1011', '1011', '1011'], 'area': ['华北', '华北', '华北'],
'sku_code': ['30010001', '30010010', '30010100'], '... | true |
29ffd63ff96e34ea53f556a7036c7de515f205e3 | thgbarros/cursos | /treinaweb/python-basico/src/tipo_string.py | UTF-8 | 874 | 4.375 | 4 | [] | no_license | string_1 = 'Isso é uma string'
print("String 1:")
print(string_1)
string_2 = "Isso é outra string"
print("String 2")
print(string_2)
string_1 = 'Redefini a \'minha string 2'
string_2 = "Redefini a ' outra string"
print("Primeira string modificada")
print(string_1)
print("Segunda string modificada")
print(string_2)
... | true |
30063d302a3de9b6ec685a19e455c4de50a8010b | PauloAraujoNobre/LIA | /Chating/Tests/Test1/Server.py | UTF-8 | 1,004 | 2.984375 | 3 | [] | no_license | import time, socket, sys
print('Sendo Server...')
soc = socket.socket()
host_name = socket.gethostname()
ip = socket.gethostbyname(host_name)
port = 1234
soc.bind((host_name, port))
print(host_name, '({})'.format(ip))
name = input('Nome: ')
soc.listen(1)
print('Esperando corno se conetar...')
connection, addr = soc.ac... | true |
4ebeb64482bedbdc5d87115eafb0fec5428e8f6b | architkuk/nlp | /VQA/vqa.py | UTF-8 | 2,197 | 2.703125 | 3 | [] | no_license | import torch
import torch.nn as nn
import torch.nn.functional as F
class VQA(nn.Module):
def __init__(self, glove_path, input_size, hidden_size, num_classes=3129):
self.qemb = QuestionEmbedding(input_size, glove_path)
self.att = ImageAttention(hidden_size, 2048)
self.classifier = Classifie... | true |
10aa0bd36224e8e1e0c57d22d2a3415b64c8bfa1 | bruce-Wayn/Python-Projects | /twitterAPIdbms.py | UTF-8 | 3,219 | 2.84375 | 3 | [] | no_license | import urllib.request, urllib.parse, urllib.error
import twurl
import json
import sqlite3
import ssl
tWITTER_URL = 'https://api.twitter.com/1.1/friends/list.json'
conn = sqlite3.connect('friends.sqlite')
cur = conn.cursor()
cur.execute('''CREATE TABLE IF NOT EXISTS People(id INTEGER PRIMARY KEY, name TEXT UNIQUE, re... | true |
652a670cc0b2a4f7c2b8e0f9d691732fe5c88c0f | yleseverino/Coral | /vo_re.py | UTF-8 | 1,053 | 2.890625 | 3 | [] | no_license |
import speech_recognition as sr
with open("credenciais/GCloudKey.json") as crendenciais_google: ####Congigurações
crendenciais_google = crendenciais_google.read()
def audio_recognize(): # Ler audio do microfone
rec = sr.Recognizer()
with sr.Microphone() as source:
audio = rec.listen(source)
print("Aguardan... | true |
679e788dae659b8fcf30080106b477ee60993845 | wangzhensuo/SmartHome | /wxBot/tuling.py | UTF-8 | 1,913 | 2.65625 | 3 | [] | no_license | #coding=utf8
import requests
import itchat
'''
生活百科,图片搜索,数字计算,问答百科,知识库,中英互译,聊天对话,
笑话大全,故事大全,成语接龙,新闻资讯,星座运势,脑筋急转弯,歇后语,绕口令,顺口溜,
天气查询,菜谱大全,快递查询,列车查询,日期查询,附近餐厅,附近酒店,实时路况,果蔬报价,汽油报价,股票查询,城市邮编
'''
KEY = '7b60f1286b404e2d92e47f3e309d060c'#'71f28bf79c820df10d39b4074345ef8c'
def get_response(msg):
print("=======1======")... | true |
985bf984f0df1f39b3b66653b67b5daeb3888db1 | KID-Services/flask-charts-examples | /app.py | UTF-8 | 3,595 | 2.515625 | 3 | [] | no_license | import json
import datetime, calendar
from io import BytesIO
from flask import Flask, g, make_response, render_template
from matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCanvas
from matplotlib.figure import Figure
from matplotlib.dates import DateFormatter
import numpy as np
from bokeh.embed i... | true |
083e6bb47a337a376ab379fefb84c9abfa90f5a9 | TalhaJadoon/KOREN-Project | /15-PathRawData.py | UTF-8 | 3,348 | 2.71875 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Dec 7 00:13:01 2020
@author: user
"""
import pandas as pd
import os
# import csv
# =============================================================================
# read all files in the folder
# =========================================================... | true |
b00fbf75e5b15ef2e95b0eb40f7b7f3e59af4d2c | tamprimary/speedTest | /python/primes.py | UTF-8 | 237 | 3.78125 | 4 | [] | no_license | def isPrime(number):
for i in range(2, number):
if number % i == 0:
return False
return True
counter = 0
for x in range(2, 100000):
if isPrime(x):
counter = counter + 1
print("primes:",counter)
| true |
004e80f269df5af2c00fee5a459be9725266e7f4 | ihxc/Labs | /language/python/get_uid_pid.py | UTF-8 | 128 | 2.59375 | 3 | [] | no_license | def getUidbyPid(pid, role):
return pid & ~( 0xFFFF << 48 ) | ( role << 48 )
s = int(raw_input())
print(getUidbyPid(s,3))
| true |
8b257a1a5d2a21ed7fa89358cb4165a4303562ed | robertariente/Python-Exercicios | /1929.py | UTF-8 | 513 | 3.859375 | 4 | [
"MIT"
] | permissive |
def formaTriangulo(x,y,z,w):
if x<y+z and y<x+z and z<x+y:
print("S")
elif x<y+w and y<x+w and w<y+x:
print("S")
elif x < z + w and z < x + w and w < z + x:
print("S")
elif y < w + z and w < y + z and z < y + w:
print("S")
else:
print("N")
return None
... | true |
03f3f93ffd8f85f67e92b08e931ea3e83aee6d64 | Nojusle/Team24 | /uploads.py | UTF-8 | 1,897 | 3.140625 | 3 | [] | no_license | '''
pip install xlrd
student number: c1668782
'''
import xlrd
def excel_to_list(file):
tutors_list = []
file = xlrd.open_workbook(file)
xl_sheet = file.sheet_by_index(0)
num_cols = xl_sheet.ncols
for i in range(0, xl_sheet.nrows):
for col_idx in range(0, num_cols):
cell_obj = ... | true |
dac8ff5803f7cd3ed78c7f5128b1d9ac37a91f2c | mateuszkowalke/sudoku_game | /logic.py | UTF-8 | 2,853 | 3.46875 | 3 | [
"MIT"
] | permissive | import copy
empty_board = [
[0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0,... | true |
75944b71edba708be6d2331208e4cfbe9d0fdd72 | Sminth/codeur.me | /doc/sequentielle.py | UTF-8 | 460 | 4.0625 | 4 | [] | no_license | """ -*- coding: utf-8 -*-
Auteur: Emmanuel Malan
date : 11-12-20 ; langage : python
objet : recherche sequentielle """
def recherche_sequentielle(liste, element):
a=0;
b =len (liste)
trouve = False
i=a
while ( trouve == False and i<b):
if liste[i] == element :
trouve = True
... | true |
cbf7dcc9476e9e72f2fb48bd854382e3e10aef86 | ieure/Replay | /replay/__init__.py | UTF-8 | 1,530 | 2.875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
#
# © 2009, 2010 Digg, Inc. All rights reserved.
# Author: Ian Eure <ian@digg.com>
#
"""Log replay tool."""
from datetime import datetime, timedelta
from time import sleep
import logging
import logging.handlers
LOG = logging.getLogger(__name__)
def mapc_time(func, seq, scale=1.0, repeat=1):... | true |
67efeecc82098de77e7bb5f42187a63937cf7018 | Minarose15/MagnusBaseball | /ReportWeek2.py | UTF-8 | 1,771 | 3.328125 | 3 | [] | no_license | from numpy import pi, sin, cos, exp, sqrt, cross
from matplotlib import pyplot as plt
#Initialize variables with typical values for a baseball
g = 9.80
S0_over_m = 4.1e-4
omega = [0, 0, 2000 * 2 * pi / 60]
theta = 45 * pi/180
v0 = 110 * 0.44704 #mph to m/s
vx = v0*cos(theta)
vy = v0*sin(theta)
vz = 0
v = [... | true |
4685f137854449420fcc66916d7d725f0b2719b5 | xiaolongjia/techTrees | /Python/98_授课/Algorithm development/01_String/03_How do you print duplicate characters from a string/sdp.py | UTF-8 | 726 | 4 | 4 | [] | no_license | #!C:\Python\Python
from collections import Counter
def duplicateChars(str):
myDict = {}
for c in str:
if c in myDict.keys():
myDict[c] += 1
else:
myDict[c] = 1
i = 0
for dvalue in myDict.values():
if dvalue > 1:
print(list(myDict.keys())[i],... | true |
02506800adb05a9a5ef7a58baaaac1181025ee40 | BalazsHoranyi/multimodal | /text_processing/utils.py | UTF-8 | 1,496 | 2.734375 | 3 | [] | no_license | import torch
from transformers import BertTokenizer, BertModel, BertForMaskedLM
from transformers import BertModel, BertConfig
# Initializing a BERT bert-base-uncased style configuration
config = BertConfig()
config.output_hidden_states = True
tokenizer = BertTokenizer.from_pretrained('bert-base-uncased')
model = Ber... | true |
0fb6527c486579d606e5c095933e578f5407ec25 | nanigasi-san/nanigasi | /AtCoder/ABC/017-B.py | UTF-8 | 40 | 2.703125 | 3 | [] | no_license | S = input()
S.replace("ch","")
print(S)
| true |
22e0de3be413ddfc9658661da1c06676f1208af7 | tingjue/stats170 | /map.py | UTF-8 | 734 | 2.84375 | 3 | [] | no_license |
import gmplot
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
"""
df= pd.read_csv("/Users/tingjue/170 project/map.csv",index_col=0)
gmap = gmplot.GoogleMapPlotter(35, -102, 5)
gmap.heatmap(df['lat'], df['long'],threshold = 1, radius=18, opacity=1)
gmap.draw('gmplot.html')
"""
cars= pd.re... | true |
e17641a63df5842c15ae36868bc41efe6d1efe0c | atishjain9/Python_Practice | /ch2/07_add2.py | UTF-8 | 81 | 2.796875 | 3 | [] | no_license |
print("Resut is:",int(input("Enter First no:"))+int(input("Enter Second no:"))) | true |
be4f09eb8ab0dbd4b4da5fe5b755403ef9b99cf6 | sankalp1999/Competitive-Programming | /CP/Codeforces/Main_Before_July_2020/266A.py | UTF-8 | 116 | 3.421875 | 3 | [] | no_license | n = int(input())
s = input()
count = 0
for i in range(0,len(s)-1):
if (s[i] == s[i+1]):
count += 1
print(count) | true |
7f66e05a6e2913ef12ccd5406f7a1d7ffc8b1df5 | Potatology/algo_design_manual | /algorist/backtrack/tsp.py | UTF-8 | 3,291 | 3.484375 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"BSD-2-Clause"
] | permissive | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Heuristics for solving TSP.
Translate from tsp.h, tsp.c.
"""
__author__ = "csong2022"
import random
from math import sqrt
NMAX = 1000 # maximum number of points
class Point:
def __init__(self, x: int, y: int):
self.x = x # x and y coordinates of poin... | true |
02f9c09ccdaab01594f92ab3307e7441446f6b05 | UWPCE-PythonCert-ClassRepos/Self_Paced-Online | /students/MikeShand/lesson02/print_grid3.py | UTF-8 | 491 | 3.9375 | 4 | [] | no_license | def plus(n):
print('+',n*'-', end=' ')
def minus(n):
print('|',n*' ', end=' ')
def horizontal(n,m):
for i in range(m):
plus(n)
print('+')
def vertical(n,m):
for i in range(m):
minus(n)
print('|')
# This is the fuction for the third grid exercise
def super_g... | true |
471d04409e9d57dcaee307fa14513e1ae070b1cc | andrewlee1807/Scratch-Data-from-the-Internet | /scratch_data.py | UTF-8 | 5,967 | 3.234375 | 3 | [] | no_license | """
Author: Andrew
Copyright (C) : 2021
"""
import requests
from bs4 import BeautifulSoup
import re
import pandas as pd
class ScratchData:
# Constant
KOREAN = "ko"
SPECIAL_CHARACTERS = "~!@#$%^&*()-+?_=<>”\n"
EXTENSION = ".txt"
def __init__(self, class_name, tag_name, file_nam... | true |
d8e49c633335fab51b14d639001ebef0a79dd4db | ssak32/Tutotrials | /Python/Pluralsightcourse/LoopsExtended.py | UTF-8 | 1,018 | 3.984375 | 4 | [] | no_license | student_names = ["James", "Katarina", "Jessica", "Mark", "Bort", "Frank Grimes", "Max Power"]
"""Simple for loop to find specified name within the list"""
print("\nSimple for loop to find specified name within the list")
for name in student_names:
if name == "Mark":
print("Found him! " + name)
print("C... | true |
46b419448f713ea30571a81a20565c9277d1870c | 15Galan/asignatura-303 | /Tema 2 - Técnicas Criptográficas básicas/Prácticas/Práctica 3/Entrega/Ejercicio 2/ecc.py | UTF-8 | 2,049 | 2.71875 | 3 | [] | no_license | from Crypto.PublicKey import ECC
from Crypto.Signature import DSS
from Crypto.Hash import SHA256
# Ver https://pycryptodome.readthedocs.io/en/latest/src/public_key/ecc.html
# Ver https://pycryptodome.readthedocs.io/en/latest/src/signature/dsa.html
def crear_ECCKey():
# Usa 'NIST P-256'
return ECC.generate(c... | true |
fc56f5c7134ae5cae567ffbb20336c1335e3f81f | apuya/python_crash_course | /Part_1_Basics/Chapter_8_Functions/messages.py | UTF-8 | 582 | 4.5625 | 5 | [] | no_license | # Python Crash Course: A Hands-On, Project-Based Introduction To Programming
#
# Name: Mark Lester Apuya
# Date: 05/30/2021
#
# Chapter 8: Functions
#
# Exercise 8.9 Messages:
# Make a list containing a series of short text messages. Pass the list to a
# function called show_messages(), which prints each text messag... | true |
5d536fb936c3938cd7f995f07f40890ec1ff83ac | ejhusom/IN3200 | /image_denoising_project/large_timing.py | UTF-8 | 1,435 | 2.921875 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Plot time usage in IN3200 Project Image Denoising - by Erik Johannes Husom on 09.05.2019
import matplotlib.pyplot as plt
import numpy as np
# SET PLOT STYLE
plt.style.use('ggplot')
plt.rcParams.update({'font.size': 8})
plt.rc("text", usetex=True)
plt.rc('font', family='... | true |
fb89fa649ae20cacf8e68d5bcac1d3d33ca88c7a | Mohdtalibakhtar/Python-codes | /setter.py | UTF-8 | 863 | 3.296875 | 3 | [] | no_license | class A():
def __init__(self, fname, lname):
self.fname = fname
self.lname= lname
# self.email= f"Email is {self.fname}{self.lname}@gmail.com"
def details(self):
return f"Name is {self.fname} {self.lname}"
@property
def email(self):
if self.fname == None or sel... | true |
98c534f4ba4d2fa01fed76a7a12ca54379c50be5 | ranok92/deepirl | /utils.py | UTF-8 | 5,298 | 3.078125 | 3 | [
"MIT"
] | permissive | """ general utilities that might find use in many seperate cases """
import numpy as np
import pandas as pd
import random
import torch
import sys
import os
import collections
class HistoryBuffer:
"""A buffer that keeps track of state visitation history."""
def __init__(self, bufferSize=10):
self.buf... | true |
4f4cc0f84713e6ab4159703fb900dff0aa9b3b32 | szymoniks/COMP3001 | /COMP3001-master/tfl_xml_parser.py | UTF-8 | 317 | 2.796875 | 3 | [] | no_license | #!/usr/bin/python
import xml.etree.ElementTree as ET
## Parse XML content
#
# Parse feed data obtained from TFL saved on disk
#
def parseXML(filename):
tree = ET.parse(filename)
root = tree.getroot()
for r in root:
for elem in r:
# Tag in element station and value
print (elem.tag, elem.text)
| true |
ba199bfa2ab1f7c6e176704271d26e256c30b9f0 | RaafaRodrigues/python | /OT/LacosDeRepeticao/LacoFor.py | UTF-8 | 217 | 4.21875 | 4 | [] | no_license | tabuada:int =int(input("Digite um numero para exibir a tabuada: \n"))
print("Tabuada do numero " ,tabuada)
for valor in range(0,10,1):
print(str(tabuada) + " x " + str(valor+1) + " = "+ str((tabuada*(valor+1))))
| true |
746ca1510f1066365485e967bfc9c3cb75ad2d1b | Samir529/Billboard-Advertisement-System | /Billboard-Advertisement-System/Billboard_Advertisement/Billboard_Advertisement/grettings.py | UTF-8 | 351 | 2.90625 | 3 | [] | no_license | import datetime
def give_grettings(request):
currentTime = datetime.datetime.now()
if 5 <= currentTime.hour < 12:
time = 'morning'
elif 12 <= currentTime.hour < 17:
time = 'afternoon'
elif 17 <= currentTime.hour < 21:
time = 'evening'
else:
time = 'night'
return... | true |
ae138825162c78e8fbf160902c03dfcf92ff24ed | juechen-zzz/LeetCode | /python/0137.Single Number II.py | UTF-8 | 613 | 3.546875 | 4 | [] | no_license | '''
Given a non-empty array of integers, every element appears three times except for one, which appears exactly once. Find that single one.
Note:
Your algorithm should have a linear runtime complexity. Could you implement it without using extra memory?
Example 1:
Input: [2,2,3,2]
Output: 3
Example 2:
Input: [0,1,... | true |
345469f3ebee3ecc657c8a484f08e24d1760f48a | SaiSriNarne/BigDataAnalytics | /ICP5/ClassificationCNN/ClassificationMain.py | UTF-8 | 3,854 | 2.5625 | 3 | [] | no_license | import numpy as np #supporting multi-dimensional arrays and matrices
import os #read or write a file
import cv2
import pandas as pd #data manipulation and analysis
from tqdm import tqdm # for well-established ProgressBar
from random import shuffle #only shuffles the array along the first axis of a multi-dimensional ar... | true |
f67e0b99ba8f4ebd0d0ba6c26703638024d3a79d | AlvisZhao/TrainingSpider | /TextSpider/pipelines.py | UTF-8 | 721 | 2.546875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
# Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: https://docs.scrapy.org/en/latest/topics/item-pipeline.html
import os
class TextspiderPipeline(object):
def process_item(self, item, spider):
myPath = "E:\LearnLife\Python\S... | true |
2666015b3d4f7640e6fd3f8ff277e91c1df2586a | rlcjj/Packages | /FactorLib/data_source/ncdb.py | UTF-8 | 11,584 | 2.765625 | 3 | [] | no_license | # coding: utf-8
"""基于hdf5的netcdf数据库
保留h5db的框架,使用xarry保存原始数据提升读写性能
支持单文件多因子存储
"""
import pandas as pd
import numpy as np
import xarray as xr
import os
from os import path
from .converter import parse_nc_encoding
from .helpers import handle_ids
class NCDB(object):
def __init__(self, data_path):
self.data_... | true |
155188b93ded6eb1b2de36541066d1e51b678c84 | daniel-reich/ubiquitous-fiesta | /dKeLAqAxpddbkvNhh_10.py | UTF-8 | 269 | 2.75 | 3 | [] | no_license |
import re
def group_seats(lst, n):
A=[''.join([str(x[i]) for i in range(len(x))]) for x in lst]
s=' '.join(A)
p='0'+'{'+'{},'.format(n)+'}'
B=re.findall(p, s)
c1=B.count('0'*n)
C=[x for x in B if len(x)>n]
c2=sum([len(x)-n+1 for x in C])
return c1+c2
| true |
94ca6d030e76e46a1aba83eee4931d14f25cead7 | AlexGirardDev/AdventOfPython | /src/2018/Day2.py | UTF-8 | 799 | 3.421875 | 3 | [] | no_license | f = list(open("input/2018/day2.txt", "r"))
def day2_1(arg):
two_count = 0
three_count = 0
for x in arg:
letter_dict = {}
for y in x:
letter_dict[y] = letter_dict[y] + 1 if letter_dict.get(y) else 1
if any(kvp[1] == 2 for kvp in letter_dict.items()):
two_cou... | true |
db713cfdbc27f4b915b50d5452e09af2964221a1 | Stratouklos/BloomKata | /bloom_kata/spellcheck.py | UTF-8 | 294 | 3.046875 | 3 | [] | no_license | __author__ = 'exak'
import sys
def main(word):
print('Number of arguments:', len(sys.argv), 'arguments.')
print('Argument List:', str(sys.argv))
if __name__ == "__main__":
if len(sys.argv) != 2:
print('Please provide an argument')
exit(1)
main(sys.argv[1])
| true |
ff4d3c6760876c899980f5cba261c51cf1a5edee | formika92/PyQtApp | /venv/lib/python3.6/site-packages/fixture/test/test_io.py | UTF-8 | 6,164 | 2.84375 | 3 | [] | no_license | # -*- coding: latin_1 -*-
import os
from nose.tools import eq_
from os.path import join, exists, isdir, basename
from os import path
from copy import copy
from nose.tools import eq_, raises
from fixture import TempIO
from fixture.io import mkdirall, putfile
from fixture.test import attr
french = "tu pense qu'on peut ... | true |
676d0360630de0e4ef05a46d725e58636476b219 | MacHu-GWU/Angora | /angora/ARRAYMATH/interpolate.py | UTF-8 | 12,550 | 3.265625 | 3 | [] | no_license | ##encoding=utf-8
"""
Copyright (c) 2015 by Sanhe Hu
------------------------------
Author: Sanhe Hu
Email: husanhe@gmail.com
Lisence: LGPL
Compatibility
-------------
IronPython2.7: Yes
Prerequisites
-------------
None
Import Command
--------------
from angora.DATASCI.interpolate import ... | true |
aaf2d4a8abf2a9ea2bf3ff62dbb8f2853fd9b473 | MysteryVaibhav/AdHocVideoSearch | /tfIdf.py | UTF-8 | 2,067 | 2.953125 | 3 | [] | no_license | import numpy as np
import math
import json
from nltk.corpus import reuters
from nltk.corpus import stopwords
from nltk import word_tokenize
from string import punctuation
from PreProcess import data_dir
stop_words = stopwords.words('english') + list(punctuation)
def tokenize(text):
words = word_tokenize(text)
... | true |
e8a0982c8cb8e402775ed6a86d13ed5fd612202b | 14171136/Reinforcement-Learning-Demo | /Cliff_Walk.py | UTF-8 | 3,280 | 2.703125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
# @Time : 2020/8/16 15:10
# @Author : Syao
# @FileName: Cliff_Walk_QL.py
# @Software: PyCharm
import numpy as np
import matplotlib.pyplot as plt
import time
np.random.seed(2020)
WORLD_WIDTH,WORLD_HEIGHT = 12,6
CLIFF = [[5,i] for i in range(1,10)]
ALPHA = 0.5
GAMMA = 0.5
EPSILON = 0.1
MA... | true |
ae27bf74b584c3e3bd03e0c6a050c5f926e4baad | efrensg96/test_scripts | /I2S_pitch_example02.py | UTF-8 | 3,500 | 2.53125 | 3 | [] | no_license | import serial
import time
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.animation as animation
from matplotlib import style
import threading
import Queue
import struct
import madmom as mm
import pyaudio
import vamp
import wave
def audio_stream_thread():
dataSerial_01 = []
arduinoPort = ... | true |
1e7bdf68897cc13570867d57470bf4b2d5418754 | Pratyayee/CovoBot | /actions/actions.py | UTF-8 | 32,785 | 2.515625 | 3 | [
"MIT"
] | permissive | # This files contains your custom actions which can be used to run
# custom Python code.
#
# See this guide on how to implement these action:
# https://rasa.com/docs/rasa/custom-actions
# This is a simple example for a custom action which utters "Hello World!"
from typing import Any, Text, Dict, List
from rasa_sdk im... | true |
73c62e2805cb4d33aadb0873a7f661078c23966f | jjjkkkjjj/scikit-marketing | /skmarket/models/product.py | UTF-8 | 5,240 | 2.75 | 3 | [] | no_license | from ._base import NonLinearRegression
ここから
class BassModel(NonLinearRegression):
def __init__(self, p=None, q=None, M=None, mode='F_SMf'):
super().__init__()
self._p = _check_ins('p', p, (int, float), allow_none=True)
self._q = _check_ins('q', q, (int, float), allow_none=True)
self.... | true |
0a74bb53e0d6a4b955a3ad75bef851e48bd967a1 | JGilba/Python_Exercices | /Seção 13 - Leitura e Escrita em Arquivos/05/main.py | UTF-8 | 255 | 3.703125 | 4 | [] | no_license | nome_arquivo = input('Informe o nome do arquivo: ')
caractere = input('Informe o caractere que deseja pesquisar: ')
with open(nome_arquivo) as arq:
print(f'O caractere {caractere} aparece {arq.read().count(caractere)} vezes no arquivo {nome_arquivo}') | true |
8c601737c8a5073b957d43f717f5d8da0d1b33de | burakkuru5534/pythonprojects | /Break-Continue.py | UTF-8 | 474 | 3.78125 | 4 | [] | no_license | # Continue ve Break #
a=0
while(True):
if(a<2):
print("a<2")
a=a+1
continue # kodun akışını while döngüsüne tekrar geri döndürüyor
if(a<4):
print("a<4")
a=a+1
continue # kodun akışını while döngüsüne tekrar geri döndürüyor
print(... | true |
78394a5d15dd419f0eecaf386352a65ddb21221e | stianhoward/ResearchTools | /turbulence/plot.py | UTF-8 | 9,114 | 2.8125 | 3 | [] | no_license | '''
Script for plotting data for particle movements.
This script inports the data, exported by turb.py in
.csv format, and displays the data in a usable format.
USE:
- Call the plot.main(base_path) function from another script
- Simply run this script itself
base_path is the path to the folder containing mu... | true |
5e7c93e6cc5fcad90a2a094ee5d43b8e6db3ca04 | Larissa-D-Gomes/CursoPython | /introducao/exercicio101.py | UTF-8 | 367 | 4.4375 | 4 | [] | no_license | """
Implemente uma funcao que recebe uma string como parâmetro e retorna true
se essa é um palíndromo.
"""
def verificadorPalindromo(leitura):
aux = leitura[::-1]
return aux.lower() == leitura.lower()
def main():
leitura = input('Digite a string: ')
print('Eh palindromo?',verificadorPalindromo(leitur... | true |
fdcf53d7dff2329d2a68e3218a7e622043297d50 | tuhiniris/Python-ShortCodes-Applications | /patterns2/Row increment number pattern.py | UTF-8 | 436 | 4.21875 | 4 | [] | no_license | '''
Pattern
Row increment number pattern:
Enter number of rows: 5
Enter number of columns: 5
11111
22222
33333
44444
55555
'''
print('Row increment number pattern: ')
number_rows=int(input('Enter number of rows: '))
number_columns=int(input('Enter number of columns:'))
for row in range(1,number_rows+1):
... | true |
2ce8dae3c8547afc28518f82cb7fb21ea9429cf2 | maelstrom9/GraphTheory | /dfs_cycle_safe_states.py | UTF-8 | 1,834 | 3.125 | 3 | [] | no_license | ## leetcode problem : dfs color algo
https://leetcode.com/problems/find-eventual-safe-states/
from collections import deque
class Solution(object):
def eventualSafeNodes(self, graph):
"""
:type graph: List[List[int]]
:rtype: List[int]
"""
# ## other apporach
# n = l... | true |
ac095a7f6344c0d60c4b8093d9b6a472ca2b3584 | rmartinshort/GeneticAlgorithm | /tests/test_geneticalgorithm.py | UTF-8 | 1,414 | 2.6875 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
"""Tests for `geneticalgorithm` package."""
import os
import pandas as pd
import numpy as np
import pytest
from sklearn.ensemble import RandomForestClassifier
from geneticalgorithm import GeneticAlgorithm
def test_integration():
"""
:return:
"""
feature_df = pd.read_csv(os... | true |
7aca8e598ef561969cc4e4a7a38a4958c29b407b | cctry/ControlCentre | /EventEngine/utils/Light.py | UTF-8 | 353 | 2.71875 | 3 | [] | no_license | def getOperate(intent, place):
if intent == 'on':
def func():
on(place)
else:
def func():
off(place)
return func
def getPlace(place):
places = {'livingroom':0,'bedroom':1}# for demo
return places.get(place)
def on(place):
f = open('test.txt','w+')
f.... | true |
222923ad643d46c7b698d9b26cc5b73797b630f2 | RayanBenmammar/HashCode2020 | /Parser.py | UTF-8 | 1,246 | 3.21875 | 3 | [] | no_license | def parser(filename):
dataset = {}
f = open(filename, "r")
firstline = f.readline().split(" ")
dataset['nbrebooks'] = int(firstline[0])
dataset['nbrelibraries'] = int(firstline[1])
dataset['scandays'] = int(firstline[2].split("\n")[0])
secondline = f.readline().split(" ")
dataset['books'... | true |
503d61812e8ad4e753f56a5305909ef5fe96aac6 | cosmologist10/Algorithms | /simple problems/flatten_list_r1.py | UTF-8 | 754 | 3.765625 | 4 | [] | no_license | # Globals are bad! Try to avoid them as much as possible.
# t = []
def flattenList(x):
""" Flatten a list using recursion """
flattened = []
for i in x:
# Sorry this will work only for ints, so not generic
# I am making it generic for all types - anything other than
# set or l... | true |
8a7b1393e9e9d2667d4937696718f9dfc6ee3f4a | lastingyeh/Python-Note | /Science-Calculate/numpy_merge.py | UTF-8 | 629 | 3.453125 | 3 | [] | no_license | import numpy as np
a = np.array([1, 1, 1])
b = np.array([2, 2, 2])
c = np.vstack((a, b))
print('vertical-stack = ', c)
print('a of shape = ', a.shape)
print('c of shape = ', c.shape)
d = np.hstack((a, b))
print('horizontal-stack = ', d)
print('d of shape = ', d.shape)
# it has 3 rows
print('a[:, np.newaxis] = ', a... | true |
f51d15d2eedf88241163e16cf7dad6a12ff11142 | JNetForce/ECON136 | /bsm_student/callidvstu.py | UTF-8 | 2,650 | 3.109375 | 3 | [
"MIT"
] | permissive | # callidvstu.py (modified from callidv) in PyGo\PyFiTeach, Python 3
# This is the BSM (old) IDV model for calls only.
# This version does not calculate days to maturity using current date and expiry.
# In this version the user feeds in days.
# Use callidvexstu.py for auto-calculation of days to expiry.
# This is t... | true |
aca5386432ef3c6b5f2163d1ca008ca1a7fc4cf6 | p-lots/codewars | /8-kyu/function-1---hello-world/python/solution.py | UTF-8 | 124 | 3.28125 | 3 | [] | no_license | def greet():
phrase = [ 72, 69, 76, 76, 79, 0, 87, 79, 82, 76, 68, 1 ]
return ''.join(chr(n + 32) for n in phrase) | true |
da3a78ec9139c6b9a6b282708a3cbbb8e6c967a0 | efpyc/4anonlinker | /bot.py | UTF-8 | 5,189 | 2.859375 | 3 | [] | no_license | import requests, wget, sys, platform, os
from bs4 import BeautifulSoup
class Automation:
def __init__(self, anonfile_link, download=False):
self.link = anonfile_link
self.download_status = download
def getLink(self):
if not str(self.link).startswith("http"):
link = str("http... | true |
278dd1fe941488c9c2bcc2a3340a18250a2f24e1 | smokeinside/game | /play.py | UTF-8 | 509 | 2.90625 | 3 | [] | no_license | import moves
from games import Game
from players import Player
if __name__ == "__main__":
defalut_moves = [
moves.Attack(18, 25, name="Simple attack"),
moves.Attack(10, 35, name="Wide range attack"),
moves.Heal(18, 25, name="Simple self heal", is_self_action=True),
]
computer = Play... | true |
47e3fa68dd96861547cff26770d260546f5763be | Qingyan1218/Lane_Segmentation | /model/data_loaders.py | UTF-8 | 4,693 | 2.796875 | 3 | [] | no_license | import torch
from torch.utils.data import Dataset, DataLoader
from PIL import Image
import numpy as np
import matplotlib.pyplot as plt
from torchvision import transforms
class LaneDataSet(Dataset):
def __init__(self, dataset_file, transform=None):
self._gt_img_list = []
self._gt_label_binary_list ... | true |
26089549b275e0b6077f9c32d6ace772fb9168c6 | ChenOuyang/hangman | /consume_statistics.py | UTF-8 | 591 | 3.03125 | 3 | [
"MIT"
] | permissive | import random as r
def consume():
data_store = 0
data_sum = 0
while 1:
data = yield
data_store += sum(data)
data_sum += len(data)
print('The running average is %f' % (data_store/float(data_sum)))
def produce(consumer):
while 1:
data = r.sample(range(6),3)
... | true |
48ae47437fca957894a82ece5c99e62ff852a7d5 | emiliobasualdo/InstagramStalker | /src/python/faceRecognition.py | UTF-8 | 1,507 | 2.796875 | 3 | [] | no_license | import face_recognition
import sys
import os
import pickle
import concurrent.futures
def load_known_faces(encodingsFolder):
known_faces = []
for subdir, dirs, files in os.walk(encodingsFolder):
for file in files:
if not (file.startswith(".")):
encodingPath = encodingsFolder ... | true |
f4d0fb0ecfa55aa54cd83a3cb31cfe4efc75c26c | LccAckerman/rock-paper-scissors | /rock-paper-scissors.py | UTF-8 | 2,900 | 3.890625 | 4 | [] | no_license | import random
import os
moves = ['rock', 'paper', 'scissors']
SCORE1 = 0
SCORE2 = 0
class Player:
def move(self):
return 'rock'
def learn(self, my_move, their_move):
pass
class ReflectPlayer(Player): # 记住上一轮对手的招数,并在这一轮出此招数
def __init__(self):
self.my_move = ""
self.th... | true |
bf9e0b8eb82fa6157b67c9921eddb98cb3e01c54 | sai-pher/NLP_2018_sai-pher | /Final_Project/group_project/Idea 3/LSA_topic_modelling.py | UTF-8 | 5,484 | 2.921875 | 3 | [] | no_license | # %%
import re
from random import random
from gensim import models, corpora
from gensim import similarities
from nltk import word_tokenize
from nltk.corpus import stopwords
train_percent = 0.80
questions_file = 'Questions.txt'
answers_file = 'Answers.txt'
topics_file = 'Topics.txt'
NUM_TOPICS = 200
... | true |
142273c5f0256a7c6fd890f10bb249baca88eeb7 | lizhou828/python_hello_world | /helloWorld/selenium_firefox/resume_website/51job.com.py | UTF-8 | 2,390 | 2.609375 | 3 | [] | no_license | import random
import time
from selenium import webdriver
from bs4 import BeautifulSoup
# 版权归作者所有,任何形式转载请联系作者。
# 作者:卒离(来自豆瓣)
# 来源:https://www.douban.com/note/707920971/
#
# 作为老牌的招聘网站,51JOB非常好用,也是我认为最好用的一家。大公司、小公司中型公司的各种职位都有,而且虚假招聘信息非常少。
#
# 51JOB的PC端的搜索功能非常好用。只要确定好行业、薪资、工作年限、企业类型等条件,只要替换搜索关键词就可以搜索其他意向工作,非常方便。不像某些招聘平台... | true |
8b565f459a9f7b93928ca5d2013a0f9fd2967db2 | intact-solutions/pysparse | /examples/tendigit.py | UTF-8 | 1,063 | 3.109375 | 3 | [
"BSD-2-Clause"
] | permissive | """
Solves problem 7 of the One Hundred Dollars, One Hundred Digits Challenge.
"""
import numpy as np
from pysparse.sparse import spmatrix
from pysparse.itsolvers.krylov import minres
from pysparse.precon import precon
def get_primes(nofPrimes):
primes = np.zeros(nofPrimes, 'i')
primes[0] = 2
nof = 1
... | true |
6a8c0435139769a221973ef0161ac2056186e38e | NCIOCPL/cdr-lib | /Python/cdrapi/publishing.py | UTF-8 | 46,418 | 2.65625 | 3 | [] | no_license | """
Manage CDR publishing jobs and provide acceess to the Drupal CMS
"""
import datetime
import json
import time
import dateutil.parser
import requests
from urllib3.exceptions import InsecureRequestWarning
from cdrapi.db import Query
from cdrapi.docs import Doc
# TODO: Get Acquia to fix their broken certificates.
# p... | true |
82fd3cb8bd86d8653bd23886073e0353ceaa2252 | prograsshopper/five-questions-for-a-week | /term10th/week_11/best_time_to_buy_and_sell_stock.py | UTF-8 | 579 | 3.59375 | 4 | [] | no_license | # worst : O(N^2) 5.01%
# class Solution:
# def maxProfit(self, prices: List[int]) -> int:
# output_arr = []
# for i in range(0, len(prices)-1):
# max_num = max(prices[i:])
# output_arr.append(max_num - prices[i])
# return max(output_arr) if output_arr else 0
class So... | true |
9c7361b62caf20e7e1d4e7aac694dd252c4dc073 | Adit-COCO-Garg/rit-cscI141-recitation | /TAReviewCS1Exam1.py | UTF-8 | 1,787 | 3.578125 | 4 | [] | no_license | from turtle import *
def drawSquare(s):
forward(s)
left(90)
forward(s)
left(90)
forward(s)
left(90)
forward(s)
left(90)
def drawSquares(depth, length):
if depth < 0:
pass
else:
forward(length)
left(90)
drawSquares(depth-1, length/3)
forward(length)
left(90)
forward(length)
left(90)
drawSq... | true |
e326a4150234e3551ec834fa1d3738c7dce5613d | Lispython/oredis | /tests.py | UTF-8 | 9,666 | 2.515625 | 3 | [
"BSD-3-Clause"
] | permissive | # -*- coding: utf-8 -*-
from pprint import pprint
import unittest
from random import random
from redis import Redis
from oredis.exceptions import ValidationError
from oredis.models import (Model, BaseModel)
from oredis.fields import (Field, String, PrimaryKey, Integer, StringPK, FK, Composite, List, Set, Lin... | true |
8a82fc3e666298157040bca59276885a1d3dd6db | Faviobrntn/soporte | /practico01/ejercicio08.py | UTF-8 | 260 | 3.0625 | 3 | [] | no_license | def superposicion(a,b):
for letter1 in a:
for letter2 in b:
if letter1==letter2:
return True
return False
assert ( superposicion("uiooo i", "cadena 2") == True)
assert ( superposicion("uioooi", "cadena2") == False)
| true |
0396b9774657a4db620ab418549c64a8af837892 | aservet1/jRAPL | /tests/jmh/msr-update-rate/scripts/visualize_compound.py | UTF-8 | 1,421 | 2.6875 | 3 | [] | no_license | #!/usr/bin/env python3
import os
import json
from sys import argv
import matplotlib.pyplot as plt
'''-----------------------------------------------------------------------'''
def plot_subfig_row(subfig, datafile):
with open(datafile) as fh:
data = json.loads(fh.read())
# we're just picking it out of socket1 fo... | true |
ea2b8776161ef26dc94c1563a8ee833e248e8b0d | ornellaramosv/Python_Dataquest | /python-programming-intermediate/Challenge_ Modules, Classes, Error Handling, and List Comprehensions-113.py | UTF-8 | 1,349 | 4.125 | 4 | [] | no_license | ## 2. Introduction to the Data ##
import csv
class Dataset:
def __init__(self, data):
self.header = data[0]
self.data = data[1:]
nfl_suspensions = list(csv.reader(open("nfl_suspensions_data.csv",'r')))
nfl_suspensions = Dataset(nfl_suspensions).data
years = {}
for item in nfl_suspension... | true |
139087ebd96d303352536768a57670239385f8d1 | KalebeGouvea/exercicios-python | /lista01/exer10.py | UTF-8 | 534 | 4.125 | 4 | [] | no_license | #Escreva um programa para calcular a redução do tempo de vida de um fumante.
#Pergunte a quantidade de cigarros fumados por dia e quantos anos ele já fumou.
#Considere que um fumante perde 10 minutos de vida a cada cigarro, calcule
#quantos dias de vida um fumante perderá. Exiba o total de dias.
qtd_dia = int(input(... | true |
7135a2cb71462a859b8e486797dc5bca397b668c | muzavan/py-interviewbit | /bit_manipulation/different_bits_sum_pairwise.py | UTF-8 | 441 | 2.765625 | 3 | [] | no_license | class Solution:
# @param A : list of integers
# @return an integer
def cntBits(self, A):
n = len(A)
ans = 0
for i in range(32):
j = 1<<i
count = 0
for a in A:
if a & j:
count+=1
... | true |
29a0721f1709699db4950dcdceed5a9f403583c2 | ParsonsZeng/ThirstyScholar.github.io | /Utils/plot_gam_distro.py | UTF-8 | 534 | 2.96875 | 3 | [] | no_license | import matplotlib.pyplot as plt
from scipy.stats import gamma
import numpy as np
plt.style.use('seaborn-paper')
fig, ax = plt.subplots(1, 1)
# Param. for Gamma distribution
alpha, beta = 6, 6
# Separate x-axis to conver cum. prob.1% ~ 99%
x = np.linspace(gamma.ppf(.01, alpha, beta),
gamma.ppf(.99, alp... | true |
9fa7dc4915a2cc471951afd11adb164470c47111 | fuzeman/trakt.py | /trakt/interfaces/oauth/device.py | UTF-8 | 5,170 | 2.671875 | 3 | [
"MIT"
] | permissive |
from trakt.core.emitter import Emitter
from trakt.interfaces.base import Interface
from datetime import datetime, timedelta
from threading import Thread
import calendar
import logging
import requests
import time
log = logging.getLogger(__name__)
class DeviceOAuthInterface(Interface):
path = 'oauth/device'
... | true |
4e1380f36efd39677b65b7aba50899130164f1e1 | viet98lx/new_u5_seqrec | /behavior_seq_rec/POP/POP.py | UTF-8 | 418 | 2.765625 | 3 | [] | no_license | import numpy as np
import json
import os
class POP:
def __init__(self, item_dict, reversed_item_dict, item_probs):
self.list_pop = item_probs
self.item_dict = item_dict
self.reversed_item_dict = reversed_item_dict
def top_popular_item(self, topk):
topk_idx = np.argpartition(self.list_pop, -topk)[-... | true |
65af180182ebbd73b40d960fc73848ed061cedca | Aasthaengg/IBMdataset | /Python_codes/p02571/s984502889.py | UTF-8 | 337 | 3.265625 | 3 | [] | no_license | S = input() # 本体
T = input() # 部分文字列
min_hamming = len(T)
for i in range(len(S) - len(T) + 1) :
# print(S[i:i+len(T)], T, end = " ")
hamming = 0
for ch1, ch2 in zip(S[i:i+len(T)], T):
hamming += 1 if ch1 != ch2 else 0
# print(hamming)
min_hamming = min(min_hamming, hamming)
print(min_hammi... | true |
e94a90b945d2c9002678313b33dc95fba4004f53 | wattaihei/ProgrammingContest | /AtCoder/ABC-D/094probD.py | UTF-8 | 723 | 2.796875 | 3 | [] | no_license | from bisect import bisect_left, bisect_right
import sys
input = sys.stdin.readline
from operator import mul
from functools import reduce
def cmb(n,r):
r = min(n-r,r)
if r < 0: return 0
if r == 0: return 1
over = reduce(mul, range(n, n - r, -1))
under = reduce(mul, range(1,r + 1))
return over /... | true |
3896f6ad604fbc53841f1ae246fc71b491fd58a6 | ananthabhishek11/Mini-Project- | /ServerPc.py | UTF-8 | 2,162 | 2.890625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Thu Mar 11 08:18:42 2021
Sockect
@author: HP
"""
import socket
import threading
from math import radians, sin, cos, acos
# SERVER = socket.gethostbyname(socket.gethostname())
SERVER = "127.0.0.1"
PORT = 8888
ADDR =(SERVER,PORT)
FORMAT = 'utf-8'
JunctionName = "... | true |
dbf4190a8aa95eb253bfc5620229ea542f735b1f | nagaskishore/ml-models | /linear-ridge-regression.py | UTF-8 | 852 | 3.578125 | 4 | [] | no_license | '''
Linear ridge regression
Example Usage:
w = mylinridgereg(X_train, y_train, l)
y_train_pred = mylinridgeregeval(X_train, w)
y_pred = mylinridgeregeval(X_test, w)
mse_train = meansquarederr(y_train, y_train_pred)
mse_test = meansquarederr(y_test, y_pred)
'''
import numpy as np
# Calculates the li... | true |