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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
69cefc12a2831b4680d75d84ffb60974f56f8070 | Python | etdub/speakeasy | /bin/test-process-metric | UTF-8 | 1,555 | 2.546875 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/env python
import random
from speakeasy.speakeasy import Speakeasy
import time
def get_random_free_port():
import socket
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM, 0)
sock.bind(('', 0))
sock.listen(socket.SOMAXCONN)
ipaddr, port = sock.getsockname()
sock.close()
re... | true |
b50cbd9add3b3b657205243bdcd7efe43761ad92 | Python | huangyq23/iTracker | /tracker/models.py | UTF-8 | 2,278 | 2.59375 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from tracker.database import db
from pytz import timezone, utc
eastern = timezone('US/Eastern')
class User(db.Model):
id = db.Column(db.Integer, primary_key=True)
email = db.Column(db.String(100), unique=True, nullable=False)
password = db.Column(db.String(100)... | true |
eb8ea46d927d41a603202160bd5d7f353a74a8c6 | Python | adrienemery/vanpy-2019 | /b_serial_write.py | UTF-8 | 286 | 2.65625 | 3 | [] | no_license | import serial
import time
from utils import get_port_name
if __name__ == '__main__':
port = serial.Serial(port=get_port_name(), baudrate=9600)
while True:
read_data = port.write(b's10')
time.sleep(1)
read_data = port.write(b's90')
time.sleep(1) | true |
e039c23eceb3ce3d6e3515b85675211e57c332e2 | Python | DanMke/Lista4_Daniel_Gabriela | /sort_disciplines.py | UTF-8 | 1,879 | 3.484375 | 3 | [
"MIT"
] | permissive | import urllib.request
import json
import unicodedata
def remove_accents(input_str):
nfkd_form = unicodedata.normalize('NFKD', input_str)
return u"".join([c for c in nfkd_form if not unicodedata.combining(c)])
def filter_disciplines(disciplines):
for i in range(len(disciplines)):
disciplines[i] =... | true |
0d9674da2268dc8bc4f592cde5ff581b1e14197b | Python | petypi/odoo_Automated-scripts | /new_agent_deliveries/src/lib/Deliveries.py | UTF-8 | 5,157 | 2.546875 | 3 | [] | no_license | """
Main library for processing the deliveries intended for new agents
"""
import psycopg2
from datetime import datetime, timedelta
import pytz
from email.mime.multipart import MIMEMultipart
from email.mime.base import MIMEBase
from email.mime.text import MIMEText
from email import encoders as Encoders
import ast
impor... | true |
83ba22f42167d300daa61ce3aae7078506f1ad35 | Python | upendra117/pdpipe | /tests/basic_stages/test_col_drop.py | UTF-8 | 1,728 | 3 | 3 | [
"MIT"
] | permissive | """Testing basic pipeline stages."""
import datetime
import pandas as pd
import pytest
from pdpipe.basic_stages import ColDrop
def _test_df():
return pd.DataFrame(
data=[[1, 2, 'a'], [2, 4, 'b']],
index=[1, 2],
columns=['num1', 'num2', 'char']
)
def test_coldrop_one_col():
"""... | true |
1fe9ef4de8fef8d70d9986a76ad919e75eada3c8 | Python | shivankitk16/gdrive-folder-copier | /copy.py | UTF-8 | 1,937 | 2.59375 | 3 | [] | no_license | from pydrive2.auth import GoogleAuth
from pydrive2.drive import GoogleDrive
source_id = "1Okx1aY4ceaDq27ZXZtNaVGbQYOy5aZQG"
parent_id = "1YKDeCD-nbJNccawtC6Vz7Hsk_BCAoIDO"
prefix = ""
gauth = GoogleAuth()
gauth.LoadCredentialsFile("creds.json")
if gauth.credentials is None:
gauth.CommandLineAuth()
... | true |
696b34529ae48cf36e4826be512ee2a20b9dc00a | Python | Braamling/contextual-search-features-for-large-datasets-in-spark | /utils/LETORIterator.py | UTF-8 | 1,390 | 2.78125 | 3 | [] | no_license | import os.path
def to_letor(df, path):
with open(path, "w") as f:
for row in df.iterrows():
start = "{} qid:{}".format(row[1]["relScore"], row[1]["queryID"])
score_df = row[1].drop(['queryID', 'docID', 'relScore'])
scores = " ".join([str(i) + ":" + '{0:.10f}'.format(x) f... | true |
975197d740bddc4bc520f5f481e554c0f7a1a2be | Python | saksim/jx3bla | /LiveBase.py | UTF-8 | 16,870 | 2.65625 | 3 | [] | no_license | # Created by moeheart at 10/10/2020
# 实时模式的基础方法库。
import threading
import os
import time
import tkinter as tk
from win10toast import ToastNotifier
from ActorReplay import ActorStatGenerator
class ToolTip(object):
def build(self, widget):
self.widget = widget
self.tipwindow = None
self.id ... | true |
2547776c35c44a37cab7f0b82c4535b6f00bc3e4 | Python | jorginazario/newsstocks_analytics | /test4.py | UTF-8 | 3,327 | 3.171875 | 3 | [] | no_license | # This program retrieves the number of mentions of a company in twitter for
#each day over the past week. The tweets are saved in tweets.txt file and the
#number of mentions per day in data.txt file.
import tweepy
from datetime import timedelta, date
import sys
import jsonpickle
import os
maxTweets = 1000000 # Some a... | true |
6aab13dbeaa14d69f877fb7f65f101bb83c87321 | Python | ebachmeier/School | /Python/RockPaperScissors.py | UTF-8 | 3,793 | 4.25 | 4 | [] | no_license | # Eric Bachmeier
# The purpose of this program is to allow you to play rock paper scissors
# against the computer and keep score. Also determine an overall winner.
# Feb. 22, 2013
print "Rock, Paper, Scissors"
print "---------------------"
print # Print opening sequence information
print "This program wil... | true |
89248a25ec926037cadb8dc675c31978a5101f5d | Python | brunocalogero/LowPowerActionRecognition | /lambda_ml_docker/utils/test_post.py | UTF-8 | 2,186 | 3.0625 | 3 | [
"MIT"
] | permissive | # Copyright: (c) 2019, Bruno Calogero <brunocalogero@hotmail.com>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
"""
JSONify numopy array to be sent and send POST request via requests library.
"""
import numpy as np
import json
import requests
class NumpyEncoder(json.JSON... | true |
dd24e284843384ab2640010aa8a33396a442903b | Python | mash9738/PythonBasics | /OS-Modules/Close.py | UTF-8 | 368 | 3.375 | 3 | [] | no_license | # os.close(): Close file descriptor fd. A file opened using open(),
# can be closed by close()only. But file opened through os.popen(),
# can be closed with close() or os.close(). If we try closing a file opened with open(),
# using os.close(), Python would throw TypeError.
import os
fd = "mass.txt"
file = open(fd, 'r... | true |
cc244a8a16e2fb0c4b6634e4aca0b032546c5cda | Python | lyoness1/interview-cake | /31-all-permutations.py | UTF-8 | 1,386 | 3.84375 | 4 | [] | no_license | """
Write a recursive function for generating all permutations of an input string.
Return them as a set.
To start, assume every character in the input string is unique.
"""
def generate_permutations(phrase):
"""Returns all permutations of an input string using recursion
>>> generate_permutations('bath... | true |
cd8932f99be3c58375f3f5be32261e99c16ec0a9 | Python | NinTheNoodle/TGM-original | /tgm/system/resources.py | UTF-8 | 2,400 | 2.546875 | 3 | [] | no_license | import os
import sys
import pkgutil
from importlib import import_module
from tgm.system import GameObject
modules = {}
files = {}
hidden_files = {}
def register(package):
paths = sys.modules[package].__path__
# Load every file in the package
for path in paths:
for fname in os.listdir(path):
... | true |
80e934fb673b81ccc4a1cd63f41145df45f399dd | Python | qeedquan/challenges | /leetcode/decrypt-string-from-alphabet-to-integer-mapping.py | UTF-8 | 1,577 | 4.1875 | 4 | [
"MIT"
] | permissive | #!/usr/bin/env python
"""
You are given a string s formed by digits and '#'. We want to map s to English lowercase characters as follows:
Characters ('a' to 'i') are represented by ('1' to '9') respectively.
Characters ('j' to 'z') are represented by ('10#' to '26#') respectively.
Return the string formed after mapp... | true |
7e0c5422dda07a28e5654b235bc8c0068edf8d35 | Python | plejeail/Python_Music_Recommender | /package/tools/stats.py | UTF-8 | 1,771 | 3.078125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
# Music Recommender
# tools.sampler
""" this module contains tool functions for statistics """
#importation de modules
from os import makedirs, listdir
import shutil as sh
import random as rnd
def sampler(dir_in , dir_out , genres , format_file, size_test_file):
""" sampler choose a given... | true |
70958f788b4d2097c054614349443238c7a7628d | Python | pratishbodhale/cowin-slots | /poll.py | UTF-8 | 2,356 | 2.734375 | 3 | [] | no_license | import http.client
import time
import json
import smtplib
import base64
from datetime import datetime
from datetime import date
import pytz
IST = pytz.timezone('Asia/Kolkata')
## Define the user specific variables here
pincode = ''
sender_email = ''
to_email = ''
sender_password_base64_encoded = ''
poll_duration_in... | true |
8d740ab1189f7117861a28d498d7f29761eac6f3 | Python | doubravap/advent-of-numba | /day07/pysolution.py | UTF-8 | 1,385 | 3.4375 | 3 | [
"BSD-3-Clause"
] | permissive | # SPDX-License-Identifier: BSD-3-Clause
with open('input') as f:
lines = [line.strip('.\n') for line in f.readlines()]
rules = {}
for line in lines:
bag, contains = line.split(' bags contain ')
contents = contains.split(', ')
contents_list = []
for content in contents:
if content == 'no o... | true |
bc0ae398a3c19d30434e89d106bd1eca12594826 | Python | hanchon/binance_watcher | /pair.py | UTF-8 | 1,229 | 2.796875 | 3 | [] | no_license | from constants import ABAJO
from constants import ARRIBA
from ema import Emas
class Pair:
def __init__(self, symbol: str) -> None:
self.symbol = symbol
self.emas = Emas()
self.last_ema = 0
self.last_tendency = None
def init_emas(self, klines):
i = 0
while i <= ... | true |
f9583879afdd90f1fe39ca0ce2315ff416e75538 | Python | sebastiantp/09Tarea | /p1.py | UTF-8 | 1,583 | 3.46875 | 3 | [
"MIT"
] | permissive | from __future__ import division
import numpy as np
import matplotlib.pyplot as plt
from scipy.optimize import curve_fit
'''
Script con que se busca estimar la constante de Hubble con los datos
originales de Hubble, y usando un intervalo de confianza del 95%
'''
def metodo_1(x, H):
return x * H
def metodo_2(v, ... | true |
a2136444f8fe404e11f7bd7f8517e45820457fe1 | Python | palmtoy/Exercise | /Python/Py/esp32-esp8266/acm-car-ctrl/main.py | UTF-8 | 6,440 | 2.578125 | 3 | [] | no_license | try:
import usocket as socket
except:
import socket
import gc
from time import sleep
from machine import Pin, Signal
from dcmotor import DCMotor
from servo import CServo
G_GC_THRESHOLD = 102000 # unit: byte
G_CMD_IDX = 6
G_FORWARD_SPEED = 60
G_BACKWARD_SPEED = 50
def getWebPage():
html = """
<html>
<head>
... | true |
5d1a797fc90657fcf0d13528e59a0dfa45c1a633 | Python | thanpolas/sublime-autoDocBlockr | /modules/eventHandler.py | UTF-8 | 607 | 2.578125 | 3 | [
"MIT"
] | permissive |
import os
def syntax_name(view):
syntax = os.path.basename(view.settings().get('syntax'))
syntax = os.path.splitext(syntax)[0]
return syntax
def checkSyntax(view, ignore_disabled=False):
"""Returns boolean, checks if file in supported file syntax"""
syntax = syntax_name(view)
lc_syntax = syn... | true |
b0c244e601f5ef45b7057cce52e487dd57a9d30f | Python | federicodiazgerstner/sd_excercises_uade | /Ejercicio 3.7.py | UTF-8 | 365 | 3.390625 | 3 | [] | no_license | cant = int(input("Insertar cantidad solicitada:"))
pbase = int(input("Insertar precio base:"))
nodto = cant*pbase
dto10 = (cant-12)*pbase*0.9
dto25 = (cant-100)*pbase*0.25
if cant<=12:
ptotal= nodto
elif cant>12 and cant<=100:
ptotal= (12*pbase)+dto10
else:
ptotal= (12*pbase)+(88*pbase)+dto25
print("E... | true |
78773265034d215051e5f5f7f3877bc80e376dc8 | Python | phz3150/group_github_assignment-blue-s-clues | /acceleration.py | UTF-8 | 309 | 3.71875 | 4 | [] | no_license | def acceleration(u1, u2, t1, t2):
"""Calculates the acceleration of a body using the ratio of the change of a body's
speed (u2-u1) over a time span (t2-t1); a = (u2-u1)/(t2-t1) using the body's different
speeds u2 and u1 at times t1 and t2"""
a = ( u2 - u1 ) / ( t2 - t1 )
return a
| true |
bab18dec613a736c9f4dc82b9eb74d7e38926cff | Python | ricardoveri/faculdade | /Programa Pacote Bebidas.py | UTF-8 | 1,898 | 3.546875 | 4 | [] | no_license | pacoteTropical = 9.00
pacoteSensacao = 12.50
pacoteCaliente = 15.80
pacoteBebida = str.upper(input("Temos: \nPacote Tropical = Coquetéis sem alcóol\nPacote Sensação = Drinks com Rum e Gin\nPacote Caliente = Drinks com vodka\nQual pacote de bebida você quer? "))
quantPessoas = int(input("Quantos convidados irão ... | true |
92fb9fde26ef1cf7c151b4419b8659059b25b6c5 | Python | kshailes/Thesis | /scrapping.py | UTF-8 | 1,230 | 2.546875 | 3 | [] | no_license | import sys
from PyQt4.QtGui import *
from PyQt4.QtCore import *
from PyQt4.QtWebKit import *
from lxml import html
import re
#Take this class for granted.Just use result of rendering.
class Render(QWebPage):
def __init__(self, url):
self.app = QApplication(sys.argv)
QWebPage.__init__(self)
... | true |
5f67021b72ddb0f5b6460e2eebd339370ff2862e | Python | DatPHP/Python_Basic_to_Master | /PythonBasic/bai1_systax.py | UTF-8 | 385 | 3.984375 | 4 | [] | no_license | print("Hello Dat")
item_one = 1
item_two = 2
item_three = 3
total = item_one + \
item_two + \
item_three
print("Total is: "+str(total))
input("\n\nPress the enter key to exit.: ")
if 5 > 2:
print("Five is greater than two!")
print("Five is greater than two!")
if 5 > 2:
print("Five is greater th... | true |
7aa0b94f8ad986b6ba1292e2741fc6bf630f0f55 | Python | BMedinaASC/Bryan_ASC3 | /Obamification.py | UTF-8 | 577 | 2.640625 | 3 | [] | no_license | from Myro import *
picture = makePicture(pickAFile())
#show(picture)
DarkBlue = makeColor(0,51,76)
Red = makeColor(217, 26, 33)
Blue = makeColor(112,150,158)
Yellow = makeColor(252, 227, 166)
for pixel in getPixels(picture):
gray = getGreen(pixel)
if gray > 180:
setColor(pixel, Yellow)
... | true |
fff422da3d6fab7174808b708e402f5cc46b2659 | Python | gistable/gistable | /dockerized-gists/5652824/snippet.py | UTF-8 | 2,223 | 3.234375 | 3 | [
"MIT"
] | permissive | # osm_shortlink.py - MAximillian Dornseif 2013 - Public Domain
# see http://wiki.openstreetmap.org/wiki/Shortlink
# https://github.com/openstreetmap/openstreetmap-website/blob/master/lib/short_link.rb
# and makeShortCode in
# https://github.com/openstreetmap/openstreetmap-website/blob/master/app/assets/javascripts/appl... | true |
afdfee30b1c6d32f432c8e24b94e257c12869239 | Python | samesky2016/monkey_test | /Base/BaseFile.py | UTF-8 | 2,364 | 2.9375 | 3 | [] | no_license |
import os
import stat
import shutil
'''
操作文件
'''
class OperateFile:
#method(r,w,a)
def __init__(self, file, method='w+'):
self.file = file
self.method = method
self.fileHandle = None
def write_txt(self, line):
OperateFile(self.file).check_file()
self.fileHandle = op... | true |
260902bbe935927197e8efae533c1c79eab43c1c | Python | lostsartre/chainer-cf-nade | /src/convert_dataset_10k.py.bak | UTF-8 | 2,088 | 2.828125 | 3 | [] | no_license | import argparse
import cPickle as pickle
import numpy as np
parser = argparse.ArgumentParser(description='Convert train and test data')
parser.add_argument('info_file', type=str, help='information file')
parser.add_argument('train_file', type=str, help='training data ... | true |
72340916b18662353d6098f78861c1ced836ee0f | Python | icevivian/Hello_offer | /172.阶乘后的零.py | UTF-8 | 454 | 3.09375 | 3 | [] | no_license | #
# @lc app=leetcode.cn id=172 lang=python3
#
# [172] 阶乘后的零
#
# @lc code=start
class Solution:
def trailingZeroes(self, n: int) -> int:
# 目标在于n!中能够分解出多少2和5对,因为偶数中都能分解出2,因此主要就是求能够分解出多少个5
divisor = 5
res = 0
while divisor <= n:
res += n//divisor
divisor = divis... | true |
b4f134a5290293aec3890bbb3b0801f3224e51fe | Python | andrei-kozel/100daysOfCode | /python/day012/guess_a_number_v2.py | UTF-8 | 1,380 | 4.21875 | 4 | [] | no_license | from art import logo
from random import randint
HARD_DIFFICULTY = 5
EASY_DIFFICULTY = 10
def check_answer(guess, number, turns):
""" Checks answer against guess. Returns the number of turns remaining."""
if guess > number:
print("Too high.")
return turns - 1
elif guess < number:
p... | true |
b5e40e7e789c14bc72aea8a2861fb4951e467eb2 | Python | Bobenzym/isaac-consensus-protocol | /src/bos_consensus/common/node.py | UTF-8 | 1,106 | 2.640625 | 3 | [
"Apache-2.0"
] | permissive | import hashlib
from ..network import Endpoint
class Node:
name = None
endpoint = None
def __init__(self, name, endpoint):
assert isinstance(name, str)
assert isinstance(endpoint, Endpoint)
self.name = name
self.endpoint = endpoint
self.endpoint.update(name=name)
... | true |
ba69af0d5b934896b7abeed45b0227242c338374 | Python | RodrigoSantosRodrigues/Biology | /src/views/UserView.py | UTF-8 | 10,041 | 2.8125 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
#/src/views/UserView
"""
...Web Flask com autorização JWT (Jason web token authorization)
------------------------------------------------------------------------
API do usuário
------------------------------------------------------------------------
... | true |
7d00faa10b390cd8e6f8652cdcb81764c3b1ba74 | Python | ramo1606/Old-Stuffs | /tesis-ramo-judio/ tesis-ramo-judio --username ramo160689@gmail.com/Fuentes/Parsers/ParserMovistar.py | UTF-8 | 5,983 | 2.765625 | 3 | [] | no_license | # *-* coding: utf-8 *-*
import os
import re
from Diccionario.Diccionario import Diccionario
from Sabana import *
class ParserMovistar:
def __init__(self, sabana = None, nomSabana = ''):
self.nombreSabana = nomSabana
if sabana != None:
self.listaTuplas = sabana.listaTuplas
self.nombreSabana = sabana.nombreA... | true |
a36197c0016e4974a5d79900ed918fcdba3131c7 | Python | Ermek-93/Python | /Laba4/3.py | UTF-8 | 758 | 4.1875 | 4 | [] | no_license | #3. Вам нужно взломать пароль. Вам известно, что длина пароля не больше N. и он может состоять только из цифр(0-9) и заглавных букв английского алфавита(A-Z). Сколько возможных вариантов паролей может быть? Какова вероятность взломать пароль с первой попытки.
numLength = 10
alphabetLength = 26
n = int(input("Длина паро... | true |
d8afc1cdbe10833f4525ffda7fd18212c7250acd | Python | boyshen/leetcode_Algorithm_problem | /46.全排列/permute.py | UTF-8 | 1,944 | 3.9375 | 4 | [] | no_license | # -*- encoding: utf-8 -*-
"""
@file: permute.py
@time: 2020/9/13 下午3:16
@author: shenpinggang
@contact: 1285456152@qq.com
@desc: 46.全排列
给定一个 没有重复 数字的序列,返回其所有可能的全排列。
输入: [1,2,3]
输出:
[
[1,2,3],
[1,3,2],
[2,1,3],
[2,3,1],
[3,1,2],
[3,2,1]
]
来源:力扣(LeetCode)
链接:https://leetcode-cn.com/problems/permutations
"""... | true |
e40e5bcc6d9b60f4d13ef01eca07d8b3228d4d4a | Python | open-sci/2021-2022-don-t-lock-up-code | /src/OC/csv_manager.py | UTF-8 | 9,031 | 3.046875 | 3 | [
"MIT"
] | permissive | import json
import pandas as pd
'''
|--------------------------------------------------------------------------
| MAKE NUMERICAL OPERATION
|--------------------------------------------------------------------------
'''
def pcent_division(a, b):
if b > 0:
return round((a / b) * 100, 2)
return 0
def... | true |
ec2814de1dd2e3d19dd44c475e094c09f0b9d700 | Python | joneivind/algDat | /oving_2/kortstokker.py | UTF-8 | 1,087 | 3.453125 | 3 | [] | no_license | #!/usr/bin/python3
from sys import stdin
from itertools import repeat
def mergeSort(decks):
if len(decks) < 2:
return decks
mid = int(len(decks) / 2)
L = mergeSort(decks[:mid])
R = mergeSort(decks[mid:])
return merge(L, R)
def merge(left, right):
result = []
while len(left... | true |
85dbd2385177cbd77acc88221f37e1822978fb99 | Python | uclnlp/ctp | /ctp/regularizers/base.py | UTF-8 | 1,391 | 2.78125 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
from abc import ABC, abstractmethod
import torch
from torch import nn, Tensor
from typing import List
import logging
logger = logging.getLogger(__name__)
class Regularizer(nn.Module, ABC):
def __init__(self) -> None:
super().__init__()
@abstractmethod
def __call__(sel... | true |
e1d878cb46557d5ba412f1c6631130af855ad123 | Python | snashraf/phandango | /scripts/minimiseROARY.py | UTF-8 | 766 | 2.59375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
import sys
import pdb
def returnCollapsedLine(line):
fields = splitLine(line)
for idx in range(11, len(fields)):
if fields[idx] == '':
fields[idx] = ''
else:
fields[idx] = '1'
return ','.join(fields)
def splitLine(line):
fields = line.stri... | true |
f8e1c409bf536fb2373210d18046d261f2f3997f | Python | final-project-sta663/Indian-Buffet-Process | /Competing_Algorithm/utils/scaledimage.py | UTF-8 | 1,444 | 3.453125 | 3 | [
"MIT"
] | permissive | """Simple matrix intensity plot, similar to MATLAB imagesc()."""
# Source by David Andrzejewski (david.andrzej@gmail.com)
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.ticker as mt
import matplotlib.cm as cm
def scaledimage(W, pixwidth=1, ax=None, grayscale=True):
"""Do intensity plot, sim... | true |
37bc92beef6e1c3c5dfb99ff66c32c7b1fa26f96 | Python | 44maru/SitePasteRandom | /collect-name.py | UTF-8 | 1,355 | 2.796875 | 3 | [] | no_license | from selenium import webdriver
import dataset
import random
DB = dataset.connect("sqlite:///./mydb.db")
NAME_TABLE = DB["JAPANESE_NAME"]
NAME_NUM_IN_1PAGE = 100
TARGET_SITE_URL = "http://www.gaoshukai.com/lab/0003/"
CHROME_DRIVER_PATH = "./chromedriver.exe"
def insert_1page(driver):
for i in range(1,... | true |
b5dbc9e5c491edfab1ceec3ffb808fb35825cd0f | Python | aliu139/CAH-Trainer | /merge.py | UTF-8 | 643 | 2.890625 | 3 | [] | no_license | #!/usr/bin/env python
"""
Merging JSON for CS3110 - OCaml
By: Austin Liu
"""
import json
trainer_json_final = {}
with open('trainer_template.json') as file1:
json1 = json.load(file1)
with open('trainer_template_2.json') as file2:
json2 = json.load(file2)
for key in json1.keys():
white = json1[key]
whit... | true |
6b7accf871695f3d2b566049ace2ea8657db2380 | Python | hsuanhauliu/leetcode-solutions | /hard/sudoku-solver/SudokuSolver.py | UTF-8 | 3,884 | 3.984375 | 4 | [] | no_license | class Solution(object):
def solveSudoku(self, board):
"""
:type board: List[List[str]]
:rtype: void Do not return anything, modify board in-place instead.
"""
blank_cells = [] # a list of blank cells
for r in xrange(9):
for c in xrange(9):
... | true |
f3ae22bce32ca9a7c45773d3e3495265f96d0386 | Python | m-star18/NLP100 | /chapter01/knock08.py | UTF-8 | 330 | 3.890625 | 4 | [
"MIT"
] | permissive | def cipher(text):
# アルファベット小文字 → (97, 123)
text = [chr(219 - ord(t)) if 97 <= ord(t) <= 123 else t for t in text]
return ''.join(text)
text = 'this is a message.'
encryption_text = cipher(text)
decryption_text = cipher(encryption_text)
print('{}\n{}'.format(encryption_text, decryption_text))
| true |
19357e9b1f371f66ed313798c686e4c75898d6dd | Python | theredferny/CodeCademy_Learn_Python_3 | /Unit_01-Hello_World/01_01_11-Modulo.py | UTF-8 | 119 | 3.171875 | 3 | [] | no_license | my_team = 27 % 4
print(my_team)
team_26 = 26 % 4
print(team_26)
print(28 % 4)
for i in range(1, 30):
print(i % 4)
| true |
03dd700f797b4fd93aadc03a4bdd6aeb4c25b37b | Python | hemanginic/Intro2Graphics | /Assignment-4_0.7.py | UTF-8 | 7,321 | 3.625 | 4 | [] | no_license | """
File Name: Assignment-4_0.7.py
Author's Name: Hemangini Chauhan
Last modified by: Hemangini Chauhan
Date Last Modified: July 14, 2013
Program Description: Drive a Car without while avoiding crash with rocks. Fill the fuel to keep going.
You will get fuel tank while driving, fill the fuel to ke... | true |
e18fb815a1621c7e476e425d60e2650a0c10bc90 | Python | 111Seven/SEPIA | /examples/Optimization/SepiaOptim.py | UTF-8 | 21,126 | 2.890625 | 3 | [
"BSD-3-Clause"
] | permissive | import numpy as np
from copy import deepcopy
from scipy.optimize import minimize
import pandas as pd
import sys
class SepiaOptim():
"""
Optimization routines for optimizing the model posterior with respect to the model parameters.
Implements two graident-free optimizers: Nelder-Mead simplex and particle sw... | true |
f6251e2cbd24bc49a2b0f5e5eb2d4949fb98680d | Python | Veraph/Algorithm_DataStructure | /recursive/DP/max_array.py | UTF-8 | 574 | 3.765625 | 4 | [] | no_license | # find the longest common array in two arrays
# 时间复杂度O(s1s2)
def max_array(s1, s2):
'''解决最长公共子序列问题'''
len_s1, len_s2 = len(s1), len(s2)
cell = [[0 for i in range(len_s2 + 1)] for j in range(len_s1 + 1)] # 开一个二维数组, 注意x轴和y轴
for i in range(len_s1):
for j in range(len_s2):
if s1[i] ==... | true |
5acca431f6478de720729820408b8bae9e05adfb | Python | spencerhcheng/holbertonschool-higher_level_programming | /0x04-python-more_data_structures/10-best_score.py | UTF-8 | 224 | 2.953125 | 3 | [] | no_license | #!/usr/bin/python3
def best_score(my_dict):
if my_dict is None:
return None
dict_list = list(my_dict.values())
for key, val in my_dict.items():
if val == max(dict_list):
return key
| true |
f4679768f63522a39665e7dde7d785c4596ca9af | Python | ianbstewart/immigrant_assimilation | /src/data_processing/get_top_k_interest_query.py | UTF-8 | 1,761 | 2.515625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Build FB ad query based on top-k interests.
@author: stewart
"""
import json
from argparse import ArgumentParser
import pandas as pd
def main():
parser = ArgumentParser()
# parser.add_argument('--interest_count_file', default='data/all_FB_interests_2016/all_FB_interests_2016.csv')
... | true |
840fb9facff6eb64487a637c83f3c65923010bfe | Python | okada1220/100knock | /100knock_chapter9_ver2/utils.py | UTF-8 | 1,837 | 3.40625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import nltk
import collections
import torch
# 対象ファイルから word -> id に変換する辞書を得ます
def make_word_id_dict(filepath):
words_frequency = collections.defaultdict(int)
with open(filepath, 'r', encoding='utf-8') as file:
for line in file:
category, title = line.split('\t')
... | true |
4df08cac90449c2836b0591ae9da6ccdfe388abe | Python | obendidi/pygraphql-async | /pygraphql/query.py | UTF-8 | 3,741 | 2.765625 | 3 | [
"MIT"
] | permissive | from typing import Any, Dict
from pygraphql.client.base import BaseClientAsync
from pygraphql.client.utils import ExecutionResult
class Query:
"""Class object of instanciating a query to be used in multiple instances"""
def __init__(self, query: str, **kwargs: Any):
"""initialise the Query object, t... | true |
7a64bc33f44f18bcbd2e3abed34a700927827ada | Python | srobo/tools | /sr/tools/cli/inv_set_attr.py | UTF-8 | 1,589 | 2.9375 | 3 | [] | no_license | def replace_line(path, key, value):
import re
print("Replacing:", key, "->", value, "in", path)
pattern = fr"{key}( *):( *)(?:[^#\s]*)(.*)"
with open(path) as fd:
lines = list(fd)
for i, line in enumerate(lines):
match = re.match(pattern, line)
if match is not None:
... | true |
74975dbcbd8b6d4b9a575a7f1dc51ed50e3bf0eb | Python | SeanLeCornu/Coding-Notes | /1. Python - Python Programming Textbook - Notes/Chapter 7/7.4 Exceptions.py | UTF-8 | 589 | 3.78125 | 4 | [] | no_license | # when python fucks up you get an error message known as an exception
# these can be useful as we can use them to work out what exactly went wrong
# the most basic way to handle exceptions is with a try statement with an except clause
# you can specify it to do certain things for certain errors
import time
try:
... | true |
ca9fe728a46883f52513603ab6b45d3b5eb99829 | Python | noik2139/hatamig | /game.py | UTF-8 | 206 | 3.75 | 4 | [] | no_license | x = 0
y = 0
f = ''
while x != 3 and y!= 3:
f = input("You can travel: ")
for i in range(3,0,-1):
for j in range(1,4):
print(j,i, end = ' ')
print('')
print('')
| true |
4b0c980de6145a6bc1eda89c1b95c7348270c253 | Python | Mamath78/Eyetracking-NHP | /Program/Script/Programme_tobii/tobiiresearch/implementation/EyeImageData.py | UTF-8 | 1,956 | 2.84375 | 3 | [] | no_license | ##
# Indicates that the eye tracker could not identify the eyes, and the image is the full image.
#
# Value for EyeImageData.image_type
EYE_IMAGE_TYPE_FULL = "eye_image_type_full"
##
# Indicates that the image is cropped and shows the eyes.
#
# Value for EyeImageData.image_type
EYE_IMAGE_TYPE_CROPPED = "eye_image_type... | true |
2af3058a6a023ab9de830530f1977a2479a4f465 | Python | inicovani/pyCover | /coverDownload.py | UTF-8 | 2,928 | 2.71875 | 3 | [] | no_license | import urllib2
import urllib
from BeautifulSoup import BeautifulSoup
import re
from PyQt4 import QtCore
from subCoverDownload import SubCoverDownload
class CoverDownload(QtCore.QThread):
def __init__(self,artist,album):
QtCore.QThread.__init__(self)
self.artist = artist
self.album = album
... | true |
cae2c6d0126f7e7ca297d99ab98dfc9848ed922c | Python | msgpo/all_the_chatbots | /wip_or_broken/neuralconvo.py | UTF-8 | 293 | 2.609375 | 3 | [
"Apache-2.0"
] | permissive | import requests
def ask_neuralconvo(text):
url = "http://neuralconvo-ec2.huggingface.co/hey"
data = {"q": text, "uuid": "3666b7f8-b80c-f5a9-476a-05d42b2ec024"}
r = requests.get(url, data)
return r.text
if __name__ == "__main__":
print(ask_neuralconvo("are you alive?")) | true |
5732bbb08f04ba47e2c9223a846acc8fd5b14158 | Python | Aasthaengg/IBMdataset | /Python_codes/p02646/s003191402.py | UTF-8 | 240 | 2.921875 | 3 | [] | no_license | import sys
a = list(map(int,input().split()))
b = list(map(int,input().split()))
t = int(input())
if a[1] <= b[1]:
print('NO')
sys.exit()
elif abs(a[0]-b[0])/abs(a[1]-b[1]) <= t:
print('YES')
sys.exit()
else:
print('NO') | true |
879fd7bd6f66725b5a0e0816691422408cf569e7 | Python | yongseongCho/python_201911 | /day_20/LinearRegression_03.py | UTF-8 | 1,467 | 3.59375 | 4 | [] | no_license | # -*- coding: utf-8 -*-
import numpy as np
X=np.array([6, 8, 10, 14, 18]).reshape(-1, 1)
y=np.array([7, 9, 13, 17.5, 18.7])
from sklearn.linear_model import LinearRegression
model = LinearRegression()
model.fit(X,y)
print('학습 데이터에 대한 평가 : ', model.score(X, y))
# LinearRegression 클래스의 비용(손실)함수
# (... | true |
eba291877039786fb76e5d346350ec9254624e46 | Python | vsdhanya/guvi | /codekata/factorial of a num.py | UTF-8 | 123 | 3.34375 | 3 | [] | no_license | numb=int(input())
fact=1
if numb==0 or numb==1:
print(1)
else:
for i in range(1,numb+1):
fact=fact*i
print(fact)
| true |
c78661362a3ba7d227e258961f70e732ce9b1099 | Python | Adminixtrator/HNG-5.0 | /Calculator.py | UTF-8 | 1,266 | 3.703125 | 4 | [] | no_license | import math
while True:
a = float(input("Please enter the first number \n"))
c = str(input("Enter the operation to be carried out \n"))
b = float(input("Please enter the second number \n"))
if (c == "+" or c == "sum" or c == "add" or c == "plus" or c == "Plus" or c == "PLUS" or c == "addition" or c =... | true |
80b48fd7fb9343673f0794693c3a6868871b85d8 | Python | osirisinferi/pyEcg | /HeartRate.py | UTF-8 | 1,145 | 3.203125 | 3 | [
"MIT"
] | permissive | from DataPoint import DataPoint
class HeartRate:
def __init__(self, data_source, number_of_peaks=10):
self.data = []
self.data_source = data_source
self.number_of_peaks = number_of_peaks
@staticmethod
def calculate_heart_rate(data):
if(len(data) < 2):
return 60... | true |
20bf1cc16009f1011d48b6964d9f3f71d66a9f0e | Python | RANJEET16520/face-recognisation | /lib/files.py | UTF-8 | 479 | 3.3125 | 3 | [] | no_license | import os
def verify_folder(folder):
if not os.path.exists(folder):
print('creating folder '+ folder)
os.makedirs(folder)
elif os.path.isfile(folder):
print('there exists file of same name')
def verify_file(file_path):
if not os.path.exists(file_path):
print('creating file ... | true |
d5b5e98452ea811e8891f0afb5fc7c7edf896cf7 | Python | Vourhey/sds011_sensor_agent | /src/sds011/luftdaten_feeder.py | UTF-8 | 1,181 | 2.890625 | 3 | [
"BSD-3-Clause"
] | permissive | import requests
import rospy
from sds011.station import StationData
class LufdatenFeeder:
def __init__(self):
self.apiServerUrl = "https://api.luftdaten.info/v1/push-sensor-data/"
def feed(self, data: StationData):
sensor_id = f"raspi-{data.mac}"
sensor_data = data.to_json()
... | true |
fc1a4c92662d79c799f4820202aa795ef508d84e | Python | dchege711/cos333_tiger_leagues | /tiger_leagues/models/db_model.py | UTF-8 | 7,202 | 2.96875 | 3 | [] | no_license | """
db.py
A wrapper around the database used by the 'Tiger Leagues' app
"""
from sys import stderr
from warnings import warn
import atexit
from psycopg2 import connect, extras, sql
from . import config
class Database:
"""
A wrapper around the database used by the 'Tiger Leagues' app.
:kwarg connection_... | true |
2dcd71c94e74eb36bb6656502e53eeab9ca0c218 | Python | He-Ro/ical-unclutter | /ical-unclutter.py | UTF-8 | 3,640 | 2.8125 | 3 | [] | no_license | #! /usr/bin/python
# For information on the calendar format,
# see the iCal specification:
# http://tools.ietf.org/html/rfc2445
# and the icalendar implementation:
# https://github.com/collective/icalendar/tree/master/src/icalendar
from icalendar import Calendar, Event, vPeriod, vDatetime, Parameters, vRecur, vFr... | true |
d1f422383580b60c80029a3292f89cbe1428530c | Python | JasmineRain/Algorithm | /Python/Dynamic Programming/413_Medium_等差数列划分.py | UTF-8 | 482 | 3.046875 | 3 | [] | no_license | from typing import List
class Solution:
def numberOfArithmeticSlices(self, A: List[int]) -> int:
# 定义dp[i]为以第i个数字结尾的等差子数组个数
dp = [0] * len(A)
for i in range(2, len(A)):
if A[i] - A[i - 1] == A[i - 1] - A[i - 2]:
dp[i] = dp[i - 1] + 1
# print(dp)
... | true |
2c87d0452ac55c4e8f3d45e27ff94f4384b71a93 | Python | caramelfish/aber-ports | /check_record_count.py | UTF-8 | 2,045 | 3.15625 | 3 | [] | no_license | ### PYTHON SCRIPT TO CONVERT CSV (Excel) FILES INTO JSON
# Import necessary modules (including get_records script which retrieves the data from the xlxs files and converts to JSON)
import os
import sys
from openpyxl import load_workbook
import json
# ship_excel_schema contains facts about about how the ship data is ... | true |
1ad5f2595226634eb74b59dcbba07852d2d76e8f | Python | cvlab-stonybrook/Emotion-Prediction | /main/PyUtils/draws.py | UTF-8 | 959 | 2.875 | 3 | [
"MIT"
] | permissive | import os
import psutil
from PIL import Image
from PIL import ImageFont
from PIL import ImageDraw
def drawTextonPIL(image_path, text, font_file=None, font_size=25, rect_x_rate=1.0, rect_y_rate=1.0):
if font_file is None:
font_file = '/usr/share/fonts/truetype/Sarai/Sarai.ttf'
font = ImageFont.truetype... | true |
34a10612c4dc6148ac3553608ac48fa8c94417f6 | Python | GHeeJeon/algorithm-collection | /pythonProject/matlab.py | UTF-8 | 1,336 | 3.671875 | 4 | [] | no_license | from utility import *
def dump_function_xy(function, x_range, x_name="", y_name=""):
"""
:param function: (Int) -> Int
:param x_range: Int range
:param x_name:
:param y_name:
:return:
"""
x = list(x_range)
y = list(map(function, x_range))
if x_name != "":
print(x_name... | true |
b336237f9ee9cd67fc4875b71ad0755b9a90f16f | Python | crazymerlyn/code | /euler/130.py | UTF-8 | 270 | 2.828125 | 3 | [] | no_license | from utils import primes
ps = list(primes(10**6))
res = 0
count = 0
for n in range(4, 10**6):
if n in ps: continue
if n % 2 == 0 or n % 5 == 0: continue
if count == 25: break
if pow(10, n-1, 9*n) == 1:
count += 1
res += n
print res
| true |
0991072188e4f290d5b069134178b953707ba3bb | Python | j4curley/2d_tank_game | /Temp.py | UTF-8 | 17,712 | 3.265625 | 3 | [] | no_license | ########################
# TANK GAME #
# BY TREVOR AND JAMES #
########################
###############
# HOW TO PLAY #
# #############
################################################################
# Use 'w', 'a', 's', 'd' to move tank in different directions #
# Use arrow keys to rotate top of tank ... | true |
16c97c51bf2e38f93cad22e7d175a0bab0ee2b4f | Python | con-schneider/16_titeseq | /panels.py | UTF-8 | 4,144 | 2.84375 | 3 | [] | no_license | from __future__ import division
import pdb
import pylab
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
# Various matplotlib parameters
mpl.rcParams['legend.scatterpoints'] = 1
mpl.rcParams['text.usetex'] = True
mpl.rcParams['text.latex.unicode'] = True
mpl.rcParams['mathtext.fontset'] = 'c... | true |
bed85f35f8f16c55fc3fd79f303a67eab10cd3e9 | Python | ShiqiMa/hk_airbnb_data_analysis | /codes/reviews.py | UTF-8 | 1,235 | 2.8125 | 3 | [] | no_license | import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
from pathlib import Path
import os
from .loader import load_reviews
def format_reviews_date():
reviews = load_reviews()
reviews['date'] = pd.to_datetime(reviews['date'])
reviews['year'] = reviews['date'].dt.year
... | true |
c852b6e830acd8cf736574d52c516beecede9e76 | Python | Zomba4okk/RecommendationSystem | /prediction_system/k_fract_mean_predict.py | UTF-8 | 2,030 | 2.71875 | 3 | [
"MIT"
] | permissive | import numpy as np
def k_fract_mean_predict_user(users_count, products_count, distance_matrix, train_data_matrix, top=10):
top_similar = np.zeros((users_count, top))
for i in range(users_count):
user_sim = distance_matrix[i]
top_sim_users = user_sim.argsort()[1:top + 1]
for j in rang... | true |
fc3ace9852f11053782ceffd41184a77620c9b4f | Python | ermidebebe/Python | /payment.py | UTF-8 | 863 | 3.703125 | 4 | [] | no_license | def get_sales():
print("plaese enter the amount you sold")
return int(input("sales=$"))
def get_advance():
print("plaese enter the amount of advance")
advance=int(input("advance=$"))
while advance>2000:
print("the andvance must be less than $2000")
advance=int(input("advance=$"))
... | true |
8bc3179de97e6876d4e4642e042bd03890651803 | Python | XECOH/TIL | /Self_study/SW_D3/Python/3431.py | UTF-8 | 466 | 3.53125 | 4 | [] | no_license | for tc in range(1, int(input())+1):
l, u, x = map(int, input().split()) # l분 이상 u분 이하 운동해야 하는데, x분 만큼 운동
if x < l: # 최소보다 작으면 최소만큼 더 운동해야 하고
print('#{} {}'.format(tc, l-x))
elif l <= x <= u: # 그 사이에 있으면 운동 안해도 되고
print('#{} {}'.format(tc, 0))
else: # 그렇지 않은 경우는 이미 더 한거
print('#{}... | true |
5cf51e225fb4c1f0c6a657dec7871272b40120bf | Python | smairs/SDSSData | /SDSSData/spectrum.py | UTF-8 | 8,459 | 2.9375 | 3 | [] | no_license | from astropy.io import fits
import numpy as np
import matplotlib.pyplot as plt
from scipy.optimize import curve_fit
class Spectrum():
def __init__(self,datafile):
# Keep the init method light,
# could define a deparate "open"
# method - but if we are loading in
# a spectrum... | true |
80de7783e0645f2d00592873a74a7a11ca95a514 | Python | adam-singer/puzzles | /facebull/doc/facebull.ynamara.variant | UTF-8 | 3,931 | 2.8125 | 3 | [] | no_license | #!/usr/bin/env python
# slight variation on ynamara's solution
# --------------------------------------------------------------------------------- #
import time
import cProfile
import sys
import os
import re
class Machine(object):
def __init__(self,label,src,dst,cost):
self.label = label
self.src ... | true |
8bae743a896f7f0cd52bf173beba9fb0981014cc | Python | faris-mohamed10/tinkerhub-image-clasifier | /predict.py | UTF-8 | 811 | 2.90625 | 3 | [] | no_license | from tensorflow.keras.preprocessing.image import img_to_array
from tensorflow.keras.models import load_model
import cv2
import numpy as np
names = '''airplane automobile bird cat deer dog frog horse ship truck'''.split()
model = load_model("models/cifar-10.h5")
# Process image and predict label
def processImg(IMG_... | true |
1e1ff81afab0ea133f1aede29882059f5ff5d51e | Python | rkuchimpos/teslabot | /teslabot/plugins/trivia/questions.py | UTF-8 | 2,704 | 3.140625 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
"""
Read and parse question data files.
"""
import os
import re
import codecs
import logging
class Question:
def __init__(self, category, question, answer, regex):
""" All args are strings. """
self.logger = logging.getLogger('teslabot.plugin.trivia.questions')
se... | true |
29f4f301a403962c74001d4b9762d3ad25e55b99 | Python | IcedTea0000/demo_scrape_web | /wiki_crawler/entities/objects.py | UTF-8 | 205 | 3.21875 | 3 | [] | no_license | class Link:
"""object Link from wiki"""
def __init__(self, title, url):
self.title = title
self.url = url
def print(self):
print('{} : {}'.format(self.title, self.url)) | true |
cafddc561b232587d046f7388208cb20d9d4639c | Python | khanhnguyenle/DopplerProject | /PitchTest.py | UTF-8 | 1,135 | 2.71875 | 3 | [] | no_license | import wave
import numpy as np
def pitch_test():
#Credit to Patrick Maupin url:https://stackoverflow.com/questions/43162121/python-convert-mono-wave-file-to-stereo
wavin = wave.open('cat.wav', 'r')
para = list(wavin.getparams())
para[3] = 0
para = tuple(para)
wavout = wave.open('output.wav', 'w... | true |
cf0fee580153bb0319fd30ee8ec118b068225127 | Python | druglogics/influential-nodes | /taskNodeAssessment/results/randomForest/get_input_data_for_RF.py | UTF-8 | 2,442 | 3 | 3 | [] | no_license | #!/usr/bin/env python3
import pandas as pd
def read_file(filename):
df = pd.read_csv(filename, sep = '\t', header = 0)
return df
'''Binary pathway = Reactome + KEGG + ACSN'''
def write_binary_pathway(reactome, kegg, acsn, file_out):
concat = reactome
concat = concat.merge(kegg, on = 'Node')
conca... | true |
f115dd5bbd034f4734ab321ec3e217073e50de5e | Python | jihazard/python | /workspace/day03/read&insert.py | UTF-8 | 927 | 2.8125 | 3 | [] | no_license | import sqlite3 as s
conn = s.connect('kosmoDBaddress.db')
cursor = conn.cursor()
cursor.execute("drop table if exists student")
cursor.execute("create table student(name char(20), kor int, eng int, math int, total int, avg int)")
query = 'insert into student (name, kor, eng, math ,total,avg) values(?, ?, ?, ?, ?, ?... | true |
bfff0610b256942a8bf9a3e7e789ef678de29a33 | Python | adesurya16/NLP-Text-StatFootballMatch | /test.py | UTF-8 | 5,179 | 2.78125 | 3 | [] | no_license | import nltk, spacy
def dump(obj, nested_level=0):
spacing = ' '
if type(obj) == dict:
print('%s{' % ((nested_level) * spacing))
for k, v in obj.items():
if (hasattr(v, '__iter__') and not(isinstance(v, str))):
print('%s%s:' % ((nested_level + 1) * spacing, k))
dump(v, nested_level + 1)
else:
... | true |
782531626915022e98de2758dc75f1e066868fab | Python | lscott1994/PythonPracticum | /FinalSubmissions/RLE.py | UTF-8 | 2,081 | 3.234375 | 3 | [] | no_license | import numpy as np
from itertools import *
def toRLE(getPixels):
count = 0
getList = []
lastIndex = len(getPixels) - 1
#Gets value from index and compares to next index
#If they have the same value, count goes up by 1
# When the index doesn't have the same value as the next index
# The... | true |
e6257052de3a82ea1ec6a275cc1928eee4c09fd7 | Python | gouskova/compsegcode | /code/CVcounter.py | UTF-8 | 1,447 | 2.9375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import regex as re
'''
a module for counting various CV patterns in a .txt file. The file should have one word per line, with segments separated by spaces. Needs a list of vowels, "vs", to function.
'''
def countCVC(**kwargs):
'''
path is a path to a LearningDat... | true |
76be0bf225c4d89ab5c676fd85c9d229c0e7c25f | Python | liza0525/algorithm-study | /0_before/0814-0816/findword.py | UTF-8 | 267 | 3.046875 | 3 | [] | no_license | for test in range(int(input())):
base = input()
word = input()
for i in range(len(word)-len(base)+1):
if word[i:i+len(base)] == base:
print('#{} {}'.format(test+1, 1))
break
else:
print('#{} {}'.format(test+1, 0))
| true |
103f8334ff8da7f74138e881d25c1883240833a3 | Python | WilliamSampaio/ExerciciosPython | /exerc20/20.py | UTF-8 | 348 | 3.9375 | 4 | [
"MIT"
] | permissive | import os
letra = input('Digite uma letra: ')
while letra.isnumeric():
print('Digite apenas uma letra!')
letra = input('Digite uma letra: ')
if letra[0] == 'm' or letra[0] == 'M':
print('Masculino')
elif letra[0] == 'f' or letra[0] == 'F':
print('Feminino')
else:
print('Sexo Inválido... | true |
c7edf88686a29a6d5e9ca0fdf46d71b57c1f2731 | Python | cbenson979/ProjectEuler | /20/sol.py | UTF-8 | 147 | 3.3125 | 3 | [] | no_license | tempFile = open('./num.txt').read()
tempSum = 0
for aChar in tempFile:
try:
tempSum += int(aChar)
except:
pass
print 'Answer: '+str(tempSum)
| true |
0c1c3cf41497f2e43b8ecd2deac34e969383a781 | Python | LitRidl/checker-content | /cont11lab/26/solution.py | UTF-8 | 733 | 3.1875 | 3 | [] | no_license | #!/usr/bin/python
# -*- coding: utf-8 -*-
u'''
построчно выделить предпоследнее десятичное число и вычислить сумму его цифр
928357av -careful 1234\nnothing\naim do 5 150 man -1234
'''
from __future__ import print_function
from sys import stdin, stdout
from string import *
def word_ok(w):
if w[0] in '+-':
... | true |
30a99438db1105b685bd6ff6a33606184fb97b93 | Python | koumik/Python_Practice | /shufflelist.py | UTF-8 | 104 | 3.625 | 4 | [] | no_license | # To Shuffle Items in list.
from random import shuffle
x = [2,5,'A',10,'bc']
shuffle(x)
print(x)
| true |
ac32bc310e43bcd275a823d0772763c6fea812b7 | Python | peterdobbs77/daily-coding | /py/n_queens/n_queens.py | UTF-8 | 288 | 3.53125 | 4 | [] | no_license | # Adapted from http://openbookproject.net/thinkcs/python/english3e/list_algorithms.html#eight-queens-puzzle-part-1
def queens_share_diagonal(x0, y0, x1, y1):
""" Does (x0,y0) share a diagonal with (x1,y1)? """
ydist = abs(y1-y0)
xdist = abs(x1-x0)
return ydist == xdist
| true |
dfaed80c0c9736b52627e53363f83a72369cb265 | Python | Taewan-P/python_study | /exercise_2017/13th_week/test.py | UTF-8 | 4,101 | 3.0625 | 3 | [
"MIT"
] | permissive | from tkinter import *
class App(Frame):
def __init__(self, master):
super().__init__(master)
self.pack(padx=30, pady=20)
self.create_widgets()
def create_widgets(self):
Label(self, text="섭씨").grid(row=0, column=0)
Label(self, text="화씨").grid(row=0, column=1)
... | true |