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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
f1ee6ef12f42b782491fb0fa4528b216f68bb361 | Python | hab-spc/LIVIS | /data_preprocess/spc.py | UTF-8 | 7,471 | 2.515625 | 3 | [] | no_license | """
Filename: spc.py
Authors: Taruj
Description: Takes an image directory and processes a SPC images
"""
from __future__ import print_function, division
# Standard dist imports
import cv2
import os
import glob
import time
import datetime
import math
import multiprocessing
import numpy as np
import pandas
import sqlite... | true |
c2e56a211ebaa2e343265ea1ea01c6a7faee526e | Python | c-yan/yukicoder | /yc58/77.py | UTF-8 | 564 | 2.78125 | 3 | [
"MIT"
] | permissive | N, *A = map(int, open(0).read().split())
def f(l):
x = list(range(1, l // 2 + 1)) + [(l + 1) // 2] + list(range(l // 2, 1 - 1, -1))
under = 0
over = 0
for i in range(min(l, N)):
if x[i] >= A[i]:
under += x[i] - A[i]
else:
over += A[i] - x[i]
if l > N:
... | true |
e888012335cefb74643cddb3facbeb7c898c705a | Python | anklav24/Python-Education | /A-Byte-of-Python/9_4_break.py | UTF-8 | 133 | 3.703125 | 4 | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | while True:
s = input('Enter anything: ')
if s == 'Exit':
break
print('Length string: ', len(s))
print('Ending')
| true |
5b46520cb4a279f0310a833d3d48992174541003 | Python | pshickey/BubblePlot | /csv2sfd.py | UTF-8 | 920 | 3.15625 | 3 | [] | no_license | #
# Authors: Adrianna Salazar, Patrick Hickey
#
# Prompts the user for the name of the csv file to be converted
# Reads the data and creates a format string to be used in Processing
# Writes the format string followed by all input lines to the output file
# Caveat: The first line of the file is assumed to be labels and... | true |
6ecfd8916e22a5fec27a040b7bf1de4996f03b80 | Python | schleising/python-dna | /dna.py | UTF-8 | 679 | 3.28125 | 3 | [] | no_license | from pathlib import Path
def main():
# Set the data folder
data_folder = 'data'
p = Path(data_folder)
# List all files in the data folder
file_list = list(p.glob('*.fa'))
for file in file_list:
histogram = {}
with open(file, 'r') as input_file:
for line in in... | true |
d63cfe6f3d17f7d35a3ab4fc621565d1459dda1a | Python | Cleomir/learning-python | /dictionaries.py | UTF-8 | 1,312 | 3.765625 | 4 | [] | no_license | basicDictionary = {
"brand": "Ford",
"model": "Mustang",
"year": 1964
}
print(basicDictionary)
# length
print(len(basicDictionary))
# type
print(type(basicDictionary))
# accessing property
print(basicDictionary["brand"])
print(basicDictionary.get("brand"))
# keys
dictionaryKeys = basicDictionary.keys()
print(... | true |
3b81abc7db0a003d88f3ca6bbe96bb03fa32a512 | Python | saratonite/python-workshop | /basics/03-lists.py | UTF-8 | 852 | 4.3125 | 4 | [] | no_license | #! /usr/bin/pyhton3
##### > https://docs.python.org/3.4/tutorial/datastructures.html
#Lists
#### Python knows a number of compound data types, used to group together other values. The most versatile is the list, which can be written as a list of comma-separated values (items) between square brackets. Lists might c... | true |
ea2a924f562b45af751b812f8244457e1b17c14f | Python | aminebalta/Artificial-intelligence | /ExamRobot.py | UTF-8 | 7,442 | 2.734375 | 3 | [] | no_license | #!/usr/bin/env python3
"""
Example demonstrating how to communicate with Microsoft Robotic Developer
Studio 4 via the Lokarria http interface.
Author: Erik Billing (billing@cs.umu.se)
Updated by Ola Ringdahl 2014-09-11
Updated by Lennart Jern 2016-09-06 (converted to Python 3)
Updated by Filip Allberg and D... | true |
c0989592f0763e2b7cb6f5b92c91f2ef38b35e82 | Python | DanielePerse/projetos-trybe-full-stack | /sd-06-tech-news/tech_news/scraper.py | UTF-8 | 3,063 | 2.65625 | 3 | [] | no_license | import requests
import time
from parsel import Selector
from tech_news.database import create_news
# Requisito 1
def fetch(url):
time.sleep(1)
try:
response = requests.get(url, timeout=3)
except requests.ReadTimeout:
return None
return response.text if response.status_code == 200 else... | true |
79c0b69b690085aa3adb19fc4b636cca11b179ca | Python | mike-ess/rpi-cgate-monitor | /utilities/logger_ini.py | UTF-8 | 3,307 | 3.03125 | 3 | [
"Unlicense",
"Apache-2.0"
] | permissive | import logging
import sys
from config_ini import ConfigIni
LOGGING_INI_FILENAME="logging.ini"
class LoggerIni:
@staticmethod
def get_log_level_from_str(stringLevel):
try:
number_level = getattr(logging, stringLevel.upper(), None)
if isinstance(number_level, int):
... | true |
fa97d7542b2f41d5e91efa1e2eb8007f7958b592 | Python | soujanyakonka/LambdaWorkshop2020 | /workshop-code-1/lambda_handler.py | UTF-8 | 1,426 | 2.921875 | 3 | [] | no_license | #!/usr/bin/env python3
import os
import boto3
import numpy as np
from zipfile import ZipFile
def sigmoid(z):
s = 1/(1 + np.exp(-z))
return s
def propagate(w, b, X, Y):
m = X.shape[1]
A = sigmoid(np.dot(w.T,X) + b)
cost = (-1)*np.sum(np.multiply(Y,np.log(A)) + np.multiply((1 - Y),np.log(1 - A)))/m... | true |
f21948d3ebd9629ddd8f6b2735651750c26b374e | Python | Gustaft86/trybe-exercises | /modulo4_ciencia/bloco_33/dia_3/exercicios_dia/exercicio4.py | UTF-8 | 1,358 | 3.40625 | 3 | [] | no_license | def validate_email(email):
index = 0
if not email[index].isalpha():
raise ValueError("Username should starts with a letter")
# validate username
while email[index] != "@" and index < len(email):
letter = email[index]
if (
not letter.isalpha()
and not lett... | true |
89f254a272b8e6a13bfb5570c5c2a542de5b2b27 | Python | UltraShieldRog/LeetCode | /contests/weekly_128/1013_pairs_of_songs_with_total_durations_divisible_by_60.py | UTF-8 | 833 | 3 | 3 | [] | no_license | from math import factorial as f
class Solution:
def numPairsDivisibleBy60(self, time: List[int]) -> int:
time_simp = list(map(lambda x: x % 60, time))
time_simp.sort()
dic = {}
for i in time_simp:
if i not in dic.keys():
dic[i] = 1
else:
... | true |
218d2ddedfea58d0363d68aeab8779aef4dbce91 | Python | MaxxQwert/EduProject | /API_BD/table_models.py | UTF-8 | 990 | 2.53125 | 3 | [] | no_license | from sqlalchemy import create_engine, Column, Integer, String, ForeignKey, Boolean, DateTime
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker, scoped_session, relationship
engine = create_engine("postgresql://postgres:0000@localhost/Placeholder")
Base = declarative_base(b... | true |
6d8c62c26d3692b08c7b866004c0c2598a2d242d | Python | steersbob/dbo6 | /zipcodes/zippy/parser.py | UTF-8 | 1,135 | 3.4375 | 3 | [] | no_license | """
Parses input file or DB, and inserts created values
"""
import sys
import re
# Looks for matches starting with a '"', and ending with either '",' or '"\n'
_quote_regex = re.compile(r'"(.*?)(?:",|"$)')
def parse_headers(fpath, encoding=None):
"""Interprets the first line of a document as its headers.
Sp... | true |
4f067f7ad6f1407791bea1a5d45ccf8880a7221a | Python | careyjou/python | /investing_SouthKorea_Export_growth_rate.py | UTF-8 | 923 | 2.671875 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Aug 10 12:08:51 2017
@author: Dan
"""
import pandas as pd
import requests
import json
import datetime as dt
url = 'https://sbcharts.investing.com/events_charts/us/1316.json'
headers = {
'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10... | true |
6644770d212c3d4df2e286aa95860f92452ad0b6 | Python | SokarCodes/ProjectEuler | /atkins.py | UTF-8 | 1,409 | 3.921875 | 4 | [] | no_license | #!/usr/bin/python
# Filename: atkins.py
# Sieve of atkins returns primeList containing all primes under given limit
def atkins(primeLimit):
primeList = [2,3]
limit = primeLimit
primeSieve = [False] * (limit+1)
sqrt = int(limit**0.5)+1
primeappend = primeList.append
for x in xrange(1,sqrt):
... | true |
c096dc68ed4cce581b276aab205f1cf53a06f218 | Python | marconaguib/NAACL2019-literary-entities | /scripts/postACE.py | UTF-8 | 808 | 2.53125 | 3 | [] | no_license | import argparse, os
def proc(filename, output):
out=open(output, "w", encoding="utf-8")
with open(filename) as file:
for line in file:
cols=line.rstrip().split("\t")
if len(cols) < 2:
out.write("\n")
else:
if len(cols) < 6:
cols.extend(["O", "O", "O", "O", "O", "O"])
out.write("%s\n" % '... | true |
90b5d2d16fdb09d8b89aff825a0c89da29b936b4 | Python | MohammadAmmar21/Python | /replacing_the_last_3_ing.py | UTF-8 | 372 | 4.34375 | 4 | [] | no_license | ### Write a Python program to add 'ing' at the end of a given string (length should be at least 3). If the given string already ends with 'ing' then add 'ly' instead. If the string length of the given string is less than 3, leave it unchanged.
n=input()
print(n)
print(len(n))
b="ing"
j=len(n)-1
print(j)
if(n.endswith(... | true |
e26561dcf36c7167be1fc44b93888228f3463524 | Python | Daniel-Pivonka/iot | /spr2020/class2/examples/endlessbutton.py | UTF-8 | 285 | 3.046875 | 3 | [] | no_license | import RPi.GPIO as GPIO
#setup board
GPIO.setmode(GPIO.BCM)
#setup pin as inpout
GPIO.setup(21, GPIO.IN, pull_up_down=GPIO.PUD_UP)
#loop endlessly
while True:
#get button state
switchstate = GPIO.input(21)
#if button is pressed
if switchstate == 1:
print ("button pressed")
| true |
b9574074d570aae41c71586e737cd75129bf594e | Python | koaning/scikit-lego | /sklego/model_selection.py | UTF-8 | 25,004 | 3.015625 | 3 | [
"MIT"
] | permissive | import numbers
from datetime import timedelta
from itertools import combinations
from warnings import warn
import numpy as np
import pandas as pd
from sklearn.exceptions import NotFittedError
from sklearn.model_selection._split import _BaseKFold, check_array
from sklearn.utils.validation import indexable
from sklego.... | true |
6006dce2ba692532f614d2cffe014919017e75ff | Python | Rijipuh/pythonCIT | /Class/Python/gradingWithIf.py | UTF-8 | 284 | 3.46875 | 3 | [] | no_license | grade = 95
if grade > 90 :
print("You got A")
elif grade > 80 :
print("you got B")
elif grade > 70 :
print("C")
else :
print("You are a total failure")
if grade > 90 :
print("Your grade is A")
if not(grade > 90) and (grade > 80) :
print("Your grade is B")
| true |
c5164e95358e5fdaf6f65e8c4e1372ae712c5494 | Python | llimllib/personal_code | /python/cardlib/cardlib.py | UTF-8 | 2,963 | 3.703125 | 4 | [] | no_license | #!/usr/bin/python
"""very basic card library. Cards are represented by a string of rank,suit
such as "10h", "0s", "12C", "8d". 0 = Two, 1 = Three, ... , 11 = King,
12 = Ace
to create one or more cards, simply create an instance of the stack class
with the desired number of cards.
things to add: card highlighting, dra... | true |
4499d875ae6466011e51441fcde629b5966c8f1f | Python | keelimeguy/RecipeManager | /recipe_manager/structure/drag_drop_listbox.py | UTF-8 | 1,395 | 3.21875 | 3 | [] | no_license | try:
from Tkinter import *
except ImportError:
from tkinter import *
class DragDropListbox(Listbox):
""" A Tkinter listbox with drag'n'drop reordering of entries. """
def __init__(self, master, fix_first=False, **kw):
kw['selectmode'] = SINGLE
Listbox.__init__(self, master, kw)
... | true |
3b34a0d3bc2c0b0df779112b0403afc86a5ccf15 | Python | jadetang/leetcode-in-python3 | /1625.py | UTF-8 | 958 | 3.40625 | 3 | [] | no_license | import unittest
def findLexSmallestString(self, s: str, a: int, b: int) -> str:
queue = [s]
ans = s
seen = set()
while queue:
size = len(queue)
for i in range(size):
current = queue.pop()
ans = min(current, ans)
rotate = current[b:] + current[:b]
... | true |
d8619180576af2d2e755dd178584f429cb6a4987 | Python | parksjsj9368/TIL | /ALGORITHM/PROGRAMMERS/ALGORITHM_TEST/6. 문자열 압축.py | UTF-8 | 630 | 2.625 | 3 | [] | no_license | def solution(s):
def compression(size):
before = s[:size]
ret = 0
count = 1
for i in range(size, len(s), size):
word = s[i : i+size]
if word == before:
count += 1
else:
if count > 1:
ret += len(st... | true |
9b250a78982f137c6ce52429322641bc777d5d38 | Python | Sage-Bionetworks/amp-workflows | /amp-rnaseq_reprocessing/amp-rnaseq_reprocess-workflow/utils/unlinkresources.py | UTF-8 | 664 | 3.359375 | 3 | [] | no_license | #! /usr/bin/env python3
"""Unlink Resources
Remove symlinks to resource files.
"""
import argparse
import os
def unlink_resources(links):
"""Unlink the links, an array of filepaths."""
if links:
for link in links:
os.unlink(link)
else:
print('No symlinks supplied to unlink')... | true |
83e8757944bd70ddfd306cd3ac391d2e7aa55088 | Python | unaiz123/luminarpython | /RegularExpression/validatemobno.py | UTF-8 | 235 | 2.90625 | 3 | [] | no_license | from re import *
# rule='[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]'
rule='\d{10}'
mobno=input("enter mob no : ")
matcher=fullmatch(rule,mobno)
if matcher !=None :
print("Valid "+mobno)
else:
print("Invalid "+mobno) | true |
29251cf0eb10e5c28e828e1a8f1c8510eb37c941 | Python | ali4006/spot | /spot/diff_file_size.py | UTF-8 | 614 | 3.109375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
import os
import argparse
def check_file(parser, x):
if x is None:
parser.error('File is None')
if os.path.exists(x):
return x
parser.error("File does not exist: {}".format(x))
def main(args=None):
parser = argparse.ArgumentParser()
parser.add_argument("file... | true |
08f27995c3602a92f64893c3c7b6e7706214e692 | Python | riyajain98/MachineLearning_SVMandNaiveBayes | /Q2.py | UTF-8 | 1,659 | 3.28125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Thu Mar 21 00:59:15 2019
@author: RIYA JAIN
"""
import pandas as pd
import numpy as np
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import LabelEncoder
from sklearn.naive_bayes import GaussianNB
from sklearn.metrics import accuracy_sc... | true |
611514d735c3b9dcfcec4bed1dddc2068b78f03a | Python | mani-barathi/Python_MiniProjects | /Password_Manager_2.0/app.py | UTF-8 | 1,335 | 3.171875 | 3 | [] | no_license | from os import environ
from getpass import getpass
# importing Manager class from password_manager.py here !
from password_manager import Manager
def main():
manager = Manager()
master_pass = getpass('Enter Your Master Password: ')
if master_pass == environ.get('MY_PASS'):
print('1. add 2.get 3.update ... | true |
9a6a5d63e6e71fd337bcf623b5de6a15e0b7761f | Python | ChangxingJiang/LeetCode | /1501-1600/1553/1553_Python_2.py | UTF-8 | 511 | 3.640625 | 4 | [] | no_license | import functools
# O(log^2N
class Solution:
@functools.lru_cache(None)
def minDays(self, n: int) -> int:
if n <= 1:
return 1
return min(n % 2 + 1 + self.minDays(n // 2), n % 3 + 1 + self.minDays(n // 3))
if __name__ == "__main__":
print(Solution().minDays(10)) # 4
prin... | true |
fcc8ae46657c8c5778233f5a07b59c17cb5d7c9e | Python | SJeliazkova/SoftUni | /Programming-Basic-Python/Exams/Exam _20_21_April_2019/06. Easter Decoration.py | UTF-8 | 812 | 3.90625 | 4 | [] | no_license | customers = int(input())
total_price = 0
for i in range(1, customers + 1):
product = input()
products_price = 0
product_sum = 0
while product != "Finish":
if product == "basket":
products_price += 1.50
product_sum += 1
elif product == "wreath":
pro... | true |
a78a2f6b4639607c0f27eda0aadabdfe4ec6a1d4 | Python | mihanglaoban/test | /manage.py | UTF-8 | 1,089 | 2.625 | 3 | [
"MIT"
] | permissive | from flask_script import Manager
from flask_migrate import Migrate, MigrateCommand
# 11. create manager to enable command line control
from info import create_app, db, models
# 19. create specified name by specified name
from info.models import User
app = create_app("development")
manager = Manager(app)
# 13. use mi... | true |
443f8e2c2dab62de2dc67b31d4919b99774aa6a3 | Python | SergioElez/ValorantBot | /scripts/helpers/keyboard.py | UTF-8 | 432 | 2.53125 | 3 | [] | no_license | import time
import pyautogui
def press_button(key, time_in_seconds=None):
if time_in_seconds is not None:
pyautogui.keyDown(key)
time.sleep(time_in_seconds)
pyautogui.keyUp(key)
else:
pyautogui.keyDown(key)
pyautogui.keyUp(key)
def send_to_chat(msg):
press_button(... | true |
8818804b0dd61a14bd10ac4d7890a00a25a0e6e6 | Python | wulinlw/leetcode_cn | /中级算法/linkedList_3.py | UTF-8 | 4,550 | 3.90625 | 4 | [] | no_license | #!/usr/bin/python
#coding:utf-8
# https://leetcode-cn.com/explore/interview/card/top-interview-questions-medium/31/linked-list/84/
# 相交链表
# 编写一个程序,找到两个单链表相交的起始节点。
# 如下面的两个链表:
# 在节点 c1 开始相交。
# 示例 1:
# 输入:intersectVal = 8, listA = [4,1,8,4,5], listB = [5,0,1,8,4,5], skipA = 2, skipB = 3
# 输出:Reference of the node with... | true |
a6d42e586b35f859339a96ddb25e50dab3325bff | Python | serhii-kovalchuk/deep_learning_from_scratch | /test.py | UTF-8 | 1,216 | 2.8125 | 3 | [] | no_license | from sklearn.datasets import load_digits
from classifiers import Network
from sklearn.ensemble import BaggingClassifier
def split_data_sets(data):
return (
data['data'][:1400],
data['target'][:1400],
data['data'][1400:1600],
data['target'][1400:1600],
data['data'][1600:],
... | true |
08aa2a6caad6be7d6fc89b0abeaf781661d0b4ae | Python | medical-images-process/EECS598-Deep-Learning | /RNN&LSTM/check_predictions.py | UTF-8 | 381 | 2.6875 | 3 | [
"MIT"
] | permissive | import sys
#fname = sys.argv[1]
fname = 'predictions_q5.txt'
with open(fname, 'r') as f:
lines = f.readlines()
lines = [line.strip() for line in lines]
if len(lines) < 10000:
raise ValueError('Invalid number of predictions')
lines_unique = set(lines)
if lines_unique != set(['0', '1']):
raise ValueE... | true |
73c066fd9ddda635b6b838b02eff6a1c417290a9 | Python | nating/any-craic | /main.py | UTF-8 | 1,541 | 2.765625 | 3 | [
"MIT"
] | permissive | import RPi.GPIO as GPIO
import time
from datetime import datetime
import json
from firebase import firebase
GPIO.setmode(GPIO.BOARD)
GPIO.setup(11, GPIO.OUT)
GPIO.setup(12, GPIO.OUT)
GPIO.setup(15, GPIO.IN, pull_up_down=GPIO.PUD_UP)
LDR_PIN = 7
GREEN_LED_PIN = 11
RED_LED_PIN = 12
BTN_PIN = 15
firebase = firebase.Fire... | true |
a054246d3d51e35648b296bf1c56dfb0cfe224b5 | Python | biggorilla-gh/frameit | /tests/rule_model_test.py | UTF-8 | 2,042 | 2.765625 | 3 | [
"Apache-2.0"
] | permissive | import unittest
from frameit.models.rule_model import RuleModel
class RuleModelTest(unittest.TestCase):
def test_extract(self):
model = RuleModel('test')
model.add_rule('around * today')
model.add_pattern('\d{1,2}')
doc = model.nlp('I will be arriving around 3 today')
ext... | true |
787658a0c2b4e825cdbca5d233737fed6f2c973e | Python | KELLY0LI/Project_1 | /test_case/test_youdao.py | UTF-8 | 1,142 | 2.9375 | 3 | [] | no_license | # -*- coding:utf-8 -*-
'''
Kelly 20170901/20170903
《Selenium2 自动化测试实战 基于Python语言》
P201 P209 test_youdao.py
'''
from selenium import webdriver
from models import sdriver
import unittest
import time
class Youdao(unittest.TestCase):
"""有道字典测试"""
def setUp(self):
self.driver = sdriver.browser('firefox')... | true |
5364028b86ff5969540771c92960f4578cdf58e9 | Python | shensds/shends | /python/ssh/ssh.py | UTF-8 | 778 | 2.84375 | 3 | [] | no_license |
#!/usr/bin/env python3
# _*_ coding:utf-8 _*_
import paramiko
ip,port = '192.168.99.102','22'
username,password = 'root','123'
# 创建ssh对象
ssh = paramiko.SSHClient()
# 解决ssh第一次连接,认证问题
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
# 连接服务器
ssh.connect(ip,port,username,password)
# 执行命令
stdin,stdout,stderr = s... | true |
10d8a49af96c0409fe26fc71dd5e553a307759cd | Python | rahdirs11/Geekster | /30Jan/printBoardPaths.py | UTF-8 | 802 | 3.296875 | 3 | [] | no_license | def paths(row: int, col: int, cr: int=0, cc: int=0):
if row == cr and col == cc:
return ['']
if row < cr or col < cc:
return []
# horizontal movement
result = []
recResH = paths(row, col, cr, cc + 1)
for r in recResH:
result.append(f'H{r}')
# vertical movement
recResV = paths(row, col, cr + 1, cc)
for ... | true |
8cd59dcf6affebf91be3374c3576b330c80fe72e | Python | mlavoie-sm360/getschema | /tests/test_fix_type.py | UTF-8 | 2,461 | 2.6875 | 3 | [
"Apache-2.0"
] | permissive | import logging
import getschema
import json
LOGGER = logging.getLogger(__name__)
records = [
{
"index": 0,
"array": [
0.0,
],
"nested_field": {
"some_prop": 0,
},
"boolean_field": True,
"another_boolean_field": True,
},
{
... | true |
06b766dbfe7493c5a481410a219d5132e17310f6 | Python | RuanYixiao/Pythonlearning | /8list.py | UTF-8 | 1,547 | 3.828125 | 4 | [] | no_license | # -*- coding: utf-8 -*-
'''
#8-1
def display():
print('This chapter teaches hhhh')
display()
#8-2
def favorite_books(title):
print('Your favorite book is \"' + title + '\"')
favorite_books('Walking on the cloud')
#8-3
def make_shirt(number, words):
print('Your shirt is ' + '\"' + number + '\"' + " ")
print(word... | true |
d8ba0d6a85118f4e5c62b018d054efa0570021bc | Python | yuto-moriizumi/AtCoder | /ABC121/ABC121d1.py | UTF-8 | 331 | 3.15625 | 3 | [
"Unlicense"
] | permissive | import sys
input = sys.stdin.readline
a, b = map(int, input().split())
if(a % 2 == 0):
if(b % 2 == 0):
print((b-a)//2 % 2 ^ b)
else:
b += 1
print((b-a)//2 % 2)
else:
a += 1
if(b % 2 == 0):
print((b-a)//2 % 2 ^ b ^ (a-1))
else:
b += 1
print((b-a)//2 % ... | true |
72c6c534d379378bbc2629df94ae442a26929413 | Python | laharrell20XX/gladiator-game | /core.py | UTF-8 | 5,329 | 3.1875 | 3 | [] | no_license | from random import randrange, randint
def new_gladiator(gladiator_name, health, rage, damage_low, damage_high,
defending, defense, stunned_turns, stunned_status,
miss_chance, weapon):
return dict(
gladiator_name=gladiator_name,
health=health,
rage=rage,
... | true |
0a3642dfce8bd13f0c2a007c33442acb0a54e554 | Python | nachogoro/euler_project | /Problem021.py | UTF-8 | 1,455 | 4.1875 | 4 | [] | no_license | #!/usr/bin/python3
#coding:utf8
# http://projecteuler.net/problem=21
#
# PROBLEM CONTENT:
# Let d(n) be defined as the sum of proper divisors of n.
#
# If d(a) = b and d(b) = a, where a != b, then a and b are an amicable pair and
# each of a and b are called amicable numbers.
#
# For example, the proper divisors of 22... | true |
7aaa3b088bc7f2c5862d58ed97bd09d68b55c98c | Python | luochuyao/TimeSeriesProject | /analyse/tools/InfluxDB.py | UTF-8 | 3,756 | 2.96875 | 3 | [] | no_license | # handle the data format
class Source(object):
json_body1 = [ # 'list' type
{
"measurement": "students",
# "hostname": "server0",
"tags": {
"a1": "s123",
},
"fields": {
"time_stamp": 0
}
}
... | true |
81014ff0c04e498d06c305da113a6fe3ce101d2d | Python | akalya23/gd | /26.py | UTF-8 | 107 | 2.796875 | 3 | [] | no_license | r1=input()
r1=list(r1)
if r1==r1[::-1]:
while r1==r1[::-1]:
r1[-1]=""
h=""
for i in r1:
h=h+i
print(h)
| true |
e56ed8269a813be3a5ac6df52b6df453206978ad | Python | AndrewWasHere/video-morse-decoder | /morse_video_decoder/morse_video_threshold_decoder.py | UTF-8 | 7,608 | 3.203125 | 3 | [
"BSD-3-Clause",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | #
# Copyright 2018 Andrew Lin. All rights reserved.
#
# This software is released under the BSD 3-clause license. See LICENSE.txt or
# https://opensource.org/licenses/BSD-3-Clause for more information.
#
import typing
import numpy as np
import cv2
class MorseVideoThresholdDecoder:
"""Object to decode Morse Code ... | true |
bae5174598bcef478aedfeb3b98f6cd3628a4b6e | Python | bueler/stokes-implicit | /py/src/experimental/constantine/Halfar-SIA-MMS.py | UTF-8 | 8,207 | 3.390625 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
# coding: utf-8
# In[19]:
#from bokeh.plotting import output_notebook, figure, show
#output_notebook()
# In[2]:
import numpy as np
# In[3]:
import sympy as sp
# Next, import some shortcuts:
# - `S` turns the argument into a SymPy object. For example, `S("1/3")` evaluates to `1/3` *exa... | true |
e05917fa1e6be35bf65e454e96f25e60e82e4656 | Python | buzz1274/tasks | /tests/test_projects.py | UTF-8 | 4,734 | 2.59375 | 3 | [] | no_license | from unittest.mock import patch
from task_warrior.task_warrior import TaskWarrior, Projects
from .helper import Helper
class TestProjects(object):
def test_projects_are_hydrated_into_a_projects_object(self):
with patch.object(TaskWarrior, 'search',
return_value=Helper.load_fixtu... | true |
e02fe2ae30330dd83b638311bcc8d4144493ad43 | Python | pgmpy/pgmpy | /pgmpy/factors/distributions/base.py | UTF-8 | 841 | 2.6875 | 3 | [
"MIT"
] | permissive | from abc import ABCMeta, abstractmethod, abstractproperty
class BaseDistribution(object):
"""
@abstractproperty
def pdf(self):
pass
@abstractproperty
def variables(self):
pass
@abstractmethod
def assignment(self, *args, **kwargs):
pass
@abstractmethod
def... | true |
a8a95741f815ccd9753852a581d909cf8cc0b92a | Python | pmacosta/pmisc | /pmisc/file.py | UTF-8 | 2,171 | 3.171875 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | # file.py
# Copyright (c) 2013-2020 Pablo Acosta-Serafini
# See LICENSE for details
# pylint: disable=C0111
# Standard library imports
import os
import platform
###
# Functions
###
def make_dir(fname):
"""
Create the directory of a fully qualified file name if it does not exist.
:param fname: File name
... | true |
6fc7355089eafc2828334761d923e4745375d3b7 | Python | kjohns19/fpl2 | /src/fpl/stack.py | UTF-8 | 1,226 | 2.953125 | 3 | [] | no_license | import fpl.storage
import fpl.variable
import fpl.value
import fpl.error
import os
import os.path
import sys
class Stack:
def __init__(self, path):
self.storage = fpl.storage.Storage(path)
def pop(self, do_load=True):
size = self.storage.counter()
if size.value.value == 0:
... | true |
16f73eb4d490f75090241c7c071a652b559ac37f | Python | charlie67/mmp-code | /clustering/dbscan_eps_finder.py | UTF-8 | 1,824 | 2.625 | 3 | [] | no_license | import logging
import multiprocessing
import numpy as np
from matplotlib import pyplot as plt
from sklearn.neighbors import NearestNeighbors
from options.options_holder import Options
def plot(data, title, file_name, display_plots):
plt.plot(data)
plt.title(title)
plt.savefig(file_name)
if display_p... | true |
30d70c0a6b1afc0479e548301bc2d6529c876ad8 | Python | smart1004/learn_src | /YPEA127 Particle Swarm Optimization/PSO/app.py | UTF-8 | 1,040 | 3.046875 | 3 | [
"BSD-2-Clause"
] | permissive | """
Copyright (c) 2017, Yarpiz (www.yarpiz.com)
All rights reserved. Please read the "license.txt" for usage terms.
__________________________________________________________________________
Project Code: YPEA127
Project Title: Implementation of Particle Swarm Optimization in Python
Publisher: Yarpiz (www.yarpiz.com)... | true |
a976d5cb04c8a108a2e031a3934fa1b81013333a | Python | chang-shuai/aika | /seriesid_json.py | UTF-8 | 1,433 | 2.859375 | 3 | [] | no_license | import requests
from bs4 import BeautifulSoup
import json
def get_source_code():
"""获取车系页面的源代码"""
r = requests.get("http://newcar.xcar.com.cn/price/")
return BeautifulSoup(r.text, "lxml")
def get_series_by_brand(source, brand_id):
"""根据品牌的id属性,获取此品牌下的所有车系的id"""
brand = source.find(id=brand_id)
series_info = bra... | true |
134f3acdca6bcd16a66d72bef54279938545cfde | Python | msb1/triple-join | /python-sql-pandas/main.py | UTF-8 | 8,032 | 3.25 | 3 | [] | no_license | import string
import random
import time
import sqlite3
import pandas as pd
from sqlite3 import Error
NUM_CARDS = 5000
NUM_USERS = 100
NUM_VERIFICATIONS = 20000
VERIFICATIONS_NEEDED = 200
'''
This Python Script is an exercise to demonstrate a three way table join and discrimination based on verification frequency
(1... | true |
161872cf844b2818abaf7d699ecd6ff02280acc5 | Python | azevedo14/aula-Gisele-ads41 | /exercicio23.py | UTF-8 | 626 | 3.8125 | 4 | [] | no_license | from random import *
lista_numeros = []
while len(lista_numeros) < 20:
numero = randint(0,50)
lista_numeros.append(numero)
numero1 = lista_numeros[0]
contador = 0
for b in lista_numeros:
if b == numero1:
contador +=1
else:
pass
print("total de numeros na lista ", len(lista_numeros))
... | true |
09ddb4bff25af164c592e2cdcbcb0a4a59845c40 | Python | victoriakovalyova/Python_Programming | /Course/Part_one/1_12_1.py | UTF-8 | 1,513 | 3.640625 | 4 | [] | no_license | #В то далёкое время, когда Паша ходил в школу, ему очень не нравилась формула Герона для вычисления площади треугольника, так как казалась слишком сложной.
#В один прекрасный момент Павел решил избавить всех школьников от страданий и написать и распространить по школам программу, вычисляющую площадь треугольника по трё... | true |
ca63ef163e14566a9d319c21c67021b87b75c710 | Python | Ruth1993/blockchain | /master5.py | UTF-8 | 2,091 | 2.875 | 3 | [] | no_license | #master
import socket
import select
import sys
import commands
import proofofwork
server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
#checks if enough input arguments have been given
if len(sys.argv) != 3:
print("Correct usage: master.py, <ip address>, <port number>")
exit()
ip = str(sys.argv[1])... | true |
26f87ff34f6117ecf46a692637193849a9a82d3b | Python | NavaneethMv/Encrypt | /encrypt.py | UTF-8 | 1,538 | 3.078125 | 3 | [] | no_license | import argparse
import pyAesCrypt
from os import stat, remove
# import sys
import pyfiglet
class Main:
buffersize = 64 * 1024
parser = argparse.ArgumentParser(description = '''Encrypt files using python''')
parser.add_argument("-ef", "--input_normal", help = "file path to encrypt")
parser.add_argument... | true |
b3b2b1f81822f4490380da8c70c013f8bc482e0b | Python | Yakobo-UG/Python-by-example-challenges | /challenge 112/challenge 112.py | UTF-8 | 469 | 3.875 | 4 | [] | no_license | #Using the Books.csv file from program 111, ask the user to enter another record and add it to the end of the file. Display each row of the .csv file on a separate line.
import csv
from os import write
file = open("Books.csv", "a")
BookName = str(input("Enter Name of the book: "))
Auther = str(input("Enter name of the ... | true |
339a35d9b6772cbbd806972e76a99517c3fe7818 | Python | marmikcfc/WirelessNetworks | /Problem Set 2/Part 4/src/generateRandom.py | UTF-8 | 5,678 | 3.21875 | 3 | [] | no_license | from random import randint
import threading
import time
import sys
##################################################################################
# Part 1 #
##################################################################################
#S... | true |
c3b09ec1f7090caf28a8fa9327c777aaebbfe924 | Python | lavandalia/work | /CodeChef/OCT13/SEATRSF/main.py | UTF-8 | 554 | 3.015625 | 3 | [] | no_license | MODULO = 10**9 + 7
def powfast(X, Y):
if Y == 0:
return 1
if Y % 2:
return (powfast(X, Y - 1) * X) % MODULO
V = powfast(X, Y // 2)
return (V * V) % MODULO
T = int(input())
for _ in range(T):
N, M, K, _ = [int(x) for x in input().split()]
if N == 1:
print(0)
con... | true |
d87978125be40e063abcb1da31204d83e21a8c57 | Python | grajekf/wae-2018 | /geneticalgorithm/mutation.py | UTF-8 | 902 | 2.65625 | 3 | [
"MIT"
] | permissive | from geneticalgorithm.layer import Layer
import numpy as np
class MutationLayer(Layer):
def __init__(self, inputs, mutation_function, name = None, save_inputs=False):
super(MutationLayer, self).__init__(inputs, name, save_inputs)
self.mutation_function = mutation_function
def _dowork(self, po... | true |
d716bd5907a14e494477222e6cf137a8d98fdb3e | Python | yukioichida/py-sniffer | /sniffer.py | UTF-8 | 4,095 | 2.703125 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import socket, sys, struct, binascii
from metrics import Metrics
from threading import Thread, Event
# Ethernet types
ARP_CODE = "0806"
IPV4_CODE = "0800"
IPV6_CODE = "86dd"
#IP Protocol Types
IP_ICMP_CODE = "01"
IP_TCP_CODE = "06"
IP_UDP_CODE = "11" #código 17
# Montag... | true |
13b234ca83b9fe0a18e64d202fd29f92544edf47 | Python | evennia/evennia | /evennia/server/initial_setup.py | UTF-8 | 7,622 | 2.578125 | 3 | [
"BSD-3-Clause"
] | permissive | """
This module handles initial database propagation, which is only run the first time the game starts.
It will create some default objects (notably give #1 its evennia-specific properties, and create the
Limbo room). It will also hooks, and then perform an initial restart.
Everything starts at handle_setup()
"""
im... | true |
08c07bca926811dbf798579609f91b8eef9d896d | Python | shenjie1983/Study-Python | /Day01-15/code/Day02/rolldice1.py | UTF-8 | 448 | 2.90625 | 3 | [] | no_license | '''
@Descripttion:掷骰子决定做什么事情
@version: 0.1
@Author: 沈洁
@Date: 2019-08-16 11:24:02
@LastEditors: 沈洁
@LastEditTime: 2019-10-12 10:38:00
'''
from random import randint
face = randint(1, 6)
if face == 1:
result = '帅帅调皮'
elif face == 2:
result = '帅帅跳舞'
elif face == 3:
result = "帅帅吵闹"
elif face == 4:
result... | true |
e305f11aafc8936f64007d0aa0c00c8aa293c343 | Python | MarkHofstetter/python-20180423 | /yield.py | UTF-8 | 394 | 3.8125 | 4 | [] | no_license | def my_range(low, high):
current = low
while current <= high:
yield current
current += 1
def my_range_a(low, high):
current = low
return range(low, high+1)
for i in my_range_a(1,10):
print(i)
a = [1,2,3,4]
def my_list_iter(field):
for e in field:
... | true |
23517a259d64fba23bb989dd0dd74ec7d1922946 | Python | yoon-su/DP_indexing | /script/autokeyinput_for_singlecrystal_20.py | UTF-8 | 813 | 2.59375 | 3 | [] | no_license | from pynput.keyboard import Key, Controller
import time
time.sleep(2)
keyboard = Controller()
#for i in range(20):
i=3
for j in range(10):
keyboard.press(Key.alt)
keyboard.release(Key.alt)
time.sleep(0.5)
keyboard.press("f")
keyboard.release("f")
time.sleep(0.5)
... | true |
c721631032d3d148c07a7235b0476f2033794e4b | Python | ilankham/advent_of_code_2020 | /day10_adapter_array.py | UTF-8 | 3,599 | 3.53125 | 4 | [
"MIT"
] | permissive | """ Solutions for https://adventofcode.com/2020/day/10 """
# import modules used below.
from collections import Counter, UserList
from itertools import chain, combinations
from math import prod
# Part 1: What is the number of 1-jolt differences multiplied by the number of
# 3-jolt differences in the provided data fi... | true |
2307d73ddf38cebd32785226410ab4eb110822ad | Python | maberf/python | /src/Aula13ex52.py | UTF-8 | 311 | 4.15625 | 4 | [
"MIT"
] | permissive | #NÚMERO PRIMO
num = int(input('Número? '))
t = 0
for i in range(1, num + 1):
if num % i == 0:
t += 1
print('\033[31m{} '.format(i), end='')
else:
print('\033[33m{} '.format(i), end='')
print('\n\033[mDivisível {} vezes.'.format(t))
print('Primo' if t <= 2 else 'Não Primo')
| true |
ef06b56f4ab7370ff1a5af006fab53fd2a02f42a | Python | leandroph/Python-CursoEmVideo | /ExerciciosPython/Exercicio_020.py | UTF-8 | 504 | 3.953125 | 4 | [] | no_license | '''O mesmo professor do desafio 019 quer sortear a ordem de apresentação
de trabalhos dos alunos. Faça um programa que leia o nome dos quatro alunos e mostre a
ordem sorteada.'''
import random
nome1 = str(input("Primeiro aluno: "))
nome2 = str(input("Segundo aluno: "))
nome3 = str(input("Terceiro aluno: "))
nome4 = s... | true |
61f9936824a4107f360536a8d27cbf2fcf3cf182 | Python | mcampo2/python-exercises | /chapter_03/exercise_03.py | UTF-8 | 1,817 | 4.25 | 4 | [] | no_license | #!/usr/bin/env python3
# (Geography: estimate areas) Find the GPS locations for Atlanta, Georgia;
# Orlando, Florida; Savannah, Georgia; and Charlotte, North Carolina from
# www.gps-data-team.com/map/ and compute the estimated area enclosed by these
# four cities. (Hint: Use the formula in Programming Exercise 3.2 to ... | true |
a94e31c14c22ed3d9eb1fa51ea37f976263b6ab7 | Python | AdmireKhulumo/Final-Exam-Mark-ML-Prediction | /flaskAPI/app.py | UTF-8 | 1,132 | 2.859375 | 3 | [] | no_license | from flask import Flask, jsonify, request
import pickle
import numpy as np
from flask_cors import CORS
#load model from file
pickle_in = open("marksmodel.pickle", "rb")
model = pickle.load(pickle_in)
app = Flask(__name__)
CORS(app)
@app.route('/', methods=['GET'])
def test():
return "Service Working!"
@app.rou... | true |
5db49209b11a9df12c3b5a383cd6f2b4b5c3908e | Python | Faydeen/advent_of_code_2019 | /day7.py | UTF-8 | 1,159 | 3.15625 | 3 | [] | no_license | from intcodeComputer_v_2 import Computer
from itertools import permutations
from aoc import read_file
def parse(lines):
return list(map(int, lines[0].split(",")))
def solve(input):
finalResult = 0
for order in permutations(range(0, 5)):
last_amp = 0
for i in order:
computer =... | true |
f9c925b860f286f5314f589fbd29c63989ce119f | Python | laviktor/Programming-with-Software-Libraries-on-Python | /project 4/Project 4/New folder/1234.py | UTF-8 | 3,100 | 3.71875 | 4 | [] | no_license | ##Junjie Lin 25792830
import check
def get_board():
board = []
for i in range(8):
board.append([])
for j in range(8):
board[i].append(' ')
board[3][3], board[4][4], board[3][4], board[4][3] = 'X','X','O','O'
return board
def make_move_for_board(board,symbol,x,y):
Trueo... | true |
c835228ccdb00049188c2ec76dcb3f4066f88aba | Python | cfoskin/devops | /logger.py | UTF-8 | 563 | 2.546875 | 3 | [] | no_license | #colum foskin
#!/usr/bin/python3
#a python program to create a file to log errors to.
import logging
import time
#log the error message to file. used in ssh helper.py.
def log_to_file(output, status):
current_time = time.strftime("%m.%d.%y %H:%M", time.localtime())
logging.info('Date and Time: '+ current_time + " ... | true |
4c6ee9a4a465b51aeaaa9caad1af7506cfba576d | Python | acramos86/LearnPython | /Taller1/4Ejercicio.py | UTF-8 | 446 | 4.03125 | 4 | [] | no_license | print("Ingrese los numeros que va a operar")
print("Numero 1")
num1 = float(input())
print("Numero 2")
num2 = float(input())
suma = num1 + num2
resta = num1 - num2
multiplicacion = num1 * num2
divicion = num1 / num2
print("el resulatdo de la suma es: " + str(suma))
print("El resultado de la resta es: " + str(resta))
pr... | true |
6d6abd7677ed6a6f4e0000a53eb7a64abe331425 | Python | devforfu/djangodemo | /welcome/insights.py | UTF-8 | 5,626 | 2.703125 | 3 | [] | no_license | from operator import itemgetter
from datetime import timedelta
from collections import defaultdict
import pandas as pd
from pandas.stats.moments import rolling_mean
from welcome.models import Ticket, Account, Message
__all__ = ['open_tickets_count', 'avg_reply_time', 'avg_ticket_close_time',
'open_tickets... | true |
375e85f7d8488d60f4c200c343d4297245dacfa3 | Python | ruirodriguessjr/Python | /CursoemVídeo/Conversor de Moedas.py | UTF-8 | 171 | 3.875 | 4 | [] | no_license | real = float(input('Quanto de dinheiro você quer trocar por dóllar? R$'))
dollar = real / 3.27
print('Com R${:.2f} você pode adquirir US${:.2f}'.format(real, dollar))
| true |
d3c558042ec18109667a3ece9673090e04db16dc | Python | Social777/Exercicios | /Exercicio_6.py | UTF-8 | 222 | 4.28125 | 4 | [] | no_license | # Leia uma temperatura em graus celsius e apresente-a convertida em graus Fahrenheit.
cel = float(input('\nQual a temperatura em graus celsius? '))
fah = cel*(9.0/5.0)+32
print(f'\nA temperatura em Fahrenheit é: {fah}') | true |
7a42016287f66fc18f2ffcd2578f2e6e44d697dd | Python | vincentiusmartin/chip2probe | /chip2probe/sitespredict/sequence_old.py | UTF-8 | 22,403 | 3.0625 | 3 | [] | permissive | """
This file contains BindingSite class and Sequence class.
Created on Jul 25, 2019
Authors: Vincentius Martin, Farica ZHuang
"""
import collections
import copy
class BindingSite(object):
"""Class for BindingSite object."""
def __init__(self, site_pos, site_start, site_end, core_start, core_end, core_mid,... | true |
a0f65c516fd17fde948e35f83754bf8560ce5771 | Python | compact-disc/PyMessenger | /server.py | UTF-8 | 3,731 | 2.984375 | 3 | [] | no_license | #####################################
# Christopher DeRoche - compact-disc
# Date Created: 10/7/2020
#
# Python messenger server
#####################################
#!/usr/bin/env python3
# import the sockets
import socket
# importing multithreading
from _thread import *
import threading
lock = threading.Lock()
#... | true |
1dadeb06c50cc5e4f50e2616975ddcdcb1a48ed2 | Python | Yramezani/GDD-Analysis | /MinMaxplot.py | UTF-8 | 1,923 | 2.9375 | 3 | [
"MIT"
] | permissive |
# coding: utf-8
# In[ ]:
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib.dates as mdates
import numpy as np
import glob
import os
import sys
import datetime
import urllib.request
import sys
import csv
import pylab
def MinMaxPlot(cityname,year):
'''py will plot Annual cycle of Min and Max ... | true |
8d50b59358ae1aa2a98881bb9e2a1fc5f17cffa6 | Python | Dill-Dall/discord-botten | /dotcoordinate.py | UTF-8 | 779 | 2.796875 | 3 | [] | no_license | from PIL import Image, ImageDraw
def circle_in(longi, lat):
im = Image.open('resources/mapwithgrid.png')
#im = Image.open('draw.jpg')
draw = ImageDraw.Draw(im)
width, height = im.size
w_factor = width/360
h_factor = height/180
print(width)
print(height)
print(f'w_factor {w_facto... | true |
b926d0c5dfc7bfdb6780f440ef9c808cfbae2192 | Python | menganha/snake | /game_screen.py | UTF-8 | 5,767 | 3.125 | 3 | [] | no_license | import pygame
from text import Text
from food import Food
from menu import Menu
from snake import Snake
from controls import Controls
from random import randint
import config
# TODO:
# * Improve game over screen. Possibly reuse the pause menu screen
# Bug fixes:
# * Using escape to exit the pause menu is not possible g... | true |
82e13f086d1371d11fd637b6ee638a5242e1cc4d | Python | andreitsev/stuff | /binary_metrics.py | UTF-8 | 9,879 | 2.640625 | 3 | [] | no_license | from typing import Callable, List, Dict, Tuple
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from sklearn.metrics import (
accuracy_score, precision_recall_curve, roc_auc_score, auc, precision_score,
recall_score, f1_score, roc_curve, ndcg_score
)
def compute_binary_metrics(
mode... | true |
e4eb8f28d165cd54882bfec297c38671175c39a5 | Python | hyunukjeong/2016_Election_Twitter_Analysis | /pickling.py | UTF-8 | 5,232 | 2.828125 | 3 | [] | no_license | import nltk
import random
import pickle
from nltk.tokenize import word_tokenize
from nltk.probability import FreqDist
##### STEP 1 #####
# # open reviews
# short_pos = open("short_reviews/positive.txt", "r", encoding='UTF-8').read()
# short_neg = open("short_reviews/negative.txt", "r", encoding='UTF-8').read()
# ... | true |
db159f7f091785c28ef922078da0e4ff02df8563 | Python | ipid/TelegramToyBots | /bot_api_objects/generate/tg_obj_generator.py | UTF-8 | 3,082 | 2.953125 | 3 | [] | no_license | from typing import Dict, List, Tuple
import json, keyword
def text_parse() -> Dict[str, Dict[str, str]]:
with open('telegram-api-types.txt', 'r') as f:
lines = f.read().split('\n')
res: Dict[str, Dict[str, str]] = dict()
target: Dict[str, str] = None
target_name: str = ''
for line_row in ... | true |
38a4c9dc863a9ba12e375d2810a45ad590d88d5a | Python | suhasbhairav/Pandas | /practise22.py | UTF-8 | 201 | 2.921875 | 3 | [] | no_license | import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
df = pd.DataFrame(np.random.randn(10,5), columns=list('ABCDE'))
print(df)
print(df.plot.barh(stacked=True))
plt.show(block=True) | true |
c23d9c4cacdecfc1742fe92d32e559c9914055b3 | Python | Kovath/league-announcer | /prototype/eyes.py | UTF-8 | 673 | 2.671875 | 3 | [
"MIT"
] | permissive | from announcer import AnnouncerEyes
import os
import cv2, numpy as np
class ClosedEyes(AnnouncerEyes):
def open(self):
pass
def see(self):
pass
class TestEyes(AnnouncerEyes):
def __init__(self, frame_folder):
self.frame_folder = frame_folder
self.files = []
self.stream_index = 0
def open(self):
... | true |
f1f500ecc4bdbb151c68b69b63d41a624cd5492c | Python | charzharr/Deep-Medical-Toolkit | /build/lib/dmt/data/image_base.py | UTF-8 | 19,168 | 2.734375 | 3 | [
"Apache-2.0"
] | permissive | """ Module dmt/data/samples/image_base.py
Contains the base class for all images (2D/3D Scalar/Vector).
Design Notes
- WARNING: treat dot notation as getting items only (primary implementation
of kwargs is in a dict); setting items with dot will not update dict entries!
- Two input categories
1. file (str_pa... | true |
4a1c6e5f2ab7b1c672309fc57ad833efdaf688d3 | Python | sanggwon/Algorithm | /month_1/190109_problem_1_def.py | UTF-8 | 1,871 | 4.15625 | 4 | [] | no_license | # [Problem1]
# print를 한줄에 2개 이상 써서 사용해주세요.
# 예제)
# print("안녕, ") print("Jupyter")
print("안녕, ") ; print("상권")
# [Problem2]
# print를 하나로 아래 문장을 써주세요.
# 예제)
# 안녕하세요
# 저는 파이썬을
# 배우고 있는
# 사람입니다.
print('''
안녕하세요
저는 파이썬을
배우고 있는
사람입니다.
''')
# [Problem3]
# 복... | true |
793af5bdcfaed9f895098077fc410774150340ed | Python | iqura/python | /p2a.py | UTF-8 | 386 | 3.5 | 4 | [] | no_license | def search(lis,a):
print(lis)
if a in lis:
return True
else:
return False
lis=[]
n=int(raw_input("enter the value:"))
while len(lis)!=n:
a=int(raw_input("enter the numbers:"))
if a!=-1:
lis.append(a)
else:
break
b=raw_input(... | true |
c146d73908b67fdf5c15d51ec3a0c799b5613f6b | Python | Manthanc007/APS-2o2o | /DMS assignment.py | UTF-8 | 791 | 3.625 | 4 | [
"MIT"
] | permissive | from collections import defaultdict
class Graph:
def __init__(self,vertices):
self.V= vertices
self.graph= defaultdict(list)
self.tc = [[0 for j in range(self.V)] for i in range(self.V)]
def addEdge(self,u,v):
self.graph[u].append(v)
def DFSUtil(self,s... | true |
a50db8f46acc57ea78f0b8f58f65dd4d45c721a4 | Python | haoye0925/python | /homework003.py | UTF-8 | 485 | 2.828125 | 3 | [
"Apache-2.0"
] | permissive | import requests
url='http://www.baidu.com/s?'
def baidu(wds):
count = 1
for wd in wds:
res = requests.get(url,params={'wd':wd})
path = 'res%d.txt'%count
with open(path,'w',encoding='utf8') as f:
f.write(res.text)
count += 1
if __name__ == "__main__":
... | true |