blob_id large_string | language 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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
24d0d7c81e53034eaf712af1ad116f35dfd05f36 | Python | goldworm/python-test | /asyncio-test/client.py | UTF-8 | 1,008 | 3 | 3 | [] | no_license | import asyncio
import sys
async def on_recv(reader, writer, name, loop):
i = 0
while True:
data = await reader.read(100)
if data == b'stop':
break
data = data.decode()
print(f'{name}-{i}: {data}')
await asyncio.sleep(1.0)
resp = f'{name}-{i}-{dat... | true |
b92d6b52150af63d5a6fa19213d98817535cb683 | Python | swati2728/function_questions | /more_eexercise.py | UTF-8 | 2,722 | 3.65625 | 4 | [] | no_license | # Question 1
# i=1
# while i<=1000:
# if i%2==0:
# print("nav")
# if i%7==0:
# print("gurukul")
# if i%21==0:
# print("navgurukul")
# i=i+1
# Question 2
# Number_of_students=input("enter a name:")
# Ek_student_ka_kharcha=int(input("enter a spending amount:"))
# if Ek_student_ka_kharcha<=50000:
# print("H... | true |
41e45c7d8296f6a35c327b3d3bc69bdebc43036c | Python | jiuzhibuguniao/Test | /Test/time_test.py | UTF-8 | 464 | 3.125 | 3 | [] | no_license | ##################
#time_test
#Author:@Rooobins
#Date:2019-01-03
##################
import time
a = "Sat Mar 28 22:24:24 2016"
print(time.time())
print(time.localtime(time.time()))
print(time.asctime(time.localtime(time.time())))
print(time.strftime("%Y-%m-%d %H:%M:%S",time.localtime()))
print(time.strftime("%a... | true |
9d4ff64326613d3eadcb17a2c2f5a5deebd295fb | Python | dianluyuanli-wp/xiaohuli-leetCode-python-newcoder-js | /sort/balance tree or not and tree ergodic.py | UTF-8 | 979 | 3.0625 | 3 | [] | no_license | class TreeNode(object):
def __init__(self, x):
self.val = x
self.left = None
self.right = None
def com_bv(node):
#print node.val
if node.left is None and node.right is None:
node.bv=0
elif node.left is None and node.right is not None:
node.bv=com_bv(node.right)+1
elif node.left is not None and node.rig... | true |
3902cbf7da24b71cb39d37454d23c33fb5d59af0 | Python | AngrySaltyFish24/PollutionBikeMonitor | /server.py | UTF-8 | 4,749 | 2.609375 | 3 | [] | no_license | from http.server import *
import socketserver
import ssl
import json
import sqlite3
class Handler(BaseHTTPRequestHandler):
def do_GET(self):
try:
if self.path == "/datafromDB":
self.wfile.write(database.getValues())
elif len(self.path) > 1:
with op... | true |
3cc5e86d6016f7e162ef98bd91139c0d11ea1aa1 | Python | kevinyuQ/SideProjs | /old/gnolac/gnolac.py | UTF-8 | 2,805 | 2.65625 | 3 | [] | no_license | import code
import functools
import inspect
import re
import signal
import sys
def main(fn):
"""Call fn with command line arguments. Used as a decorator.
The main decorator marks the function that starts a program. For example,
@main
def my_run_function():
# function body
Use this inste... | true |
183880eb25bf8f5e44685f53820c5776a20d4946 | Python | yurifarias/CursoEmVideoPython | /ex034.py | UTF-8 | 204 | 4.15625 | 4 | [] | no_license | salário = float(input('Digite o valor do salário: R$'))
if salário <= 1250:
salário *= 1.15
else:
salário *= 1.10
print('O salário inicial será aumentado para R${:.2f}'.format(salário))
| true |
f284c4d3b0a02f9b6c25aeaa2fc81141d545d17e | Python | fg0x0/Python-Lesson | /Auto-File-Move-And-Rename.py | UTF-8 | 1,138 | 2.65625 | 3 | [] | no_license | #!/usr/bin/env python3
from watchdog.observers import Observer
from watchdog.events import FileSystemEventHandler
import os
import json
import time
class MyHandler(FileSystemEventHandler):
i = 1
def on_modif(self,event):
new_name = "new_file_" + str(self.i) + ".txt"
for filename in os.listdir... | true |
4bb46a59e4c5df5cd1771765ff852e474d926e61 | Python | huaxiawudi/yz1806 | /7/day07/app/views.py | UTF-8 | 308 | 2.578125 | 3 | [] | no_license | from random import randint
from django.shortcuts import render
# Create your views here.
def add_student(request):
stu = Student()
stu.sname = '小明' + str(randint(1,1000))
stu.ssex = randint(0,1)
stu.sage = randint(15,30)
stu.save()
return HttpResponse("添加学生%d" % stu.id) | true |
3511054dbca5c31cf98f294da32fc333dcd094ea | Python | rheehot/Algorithm_problem | /leetcode_3Sum.py | UTF-8 | 1,165 | 3.125 | 3 | [] | no_license | class Solution(object):
def threeSum(self, nums):
result = []
nums.sort() #중복제거 간소화 하기 위해 정렬
for i in range(len(nums)-2):
#중복 일 경우 건너 뜀
if i > 0 and nums[i] == nums[i - 1]:
continue
left, right = i + 1, len(nums) - 1
... | true |
7c72f37ccb94d4b9250e63bfd8170362e98e0b6a | Python | RunningIkkyu/ProxyPool | /proxypool/getter.py | UTF-8 | 1,284 | 2.53125 | 3 | [] | no_license | from proxypool.tester import Tester
from proxypool.db import RedisClient
from proxypool.crawler import Crawler
from proxypool.setting import POOL_UPPER_THRESHOLD, PRIVATE_PROXY_ENABLE
from proxypool.private_proxy import PrivateProxy
import sys
class Getter():
def __init__(self):
self.redis = RedisClient()
... | true |
486ef6398fb532fb5c73aaa6d74c09b77dcba1cd | Python | nithish1199/Color-detection | /main.py | UTF-8 | 868 | 2.59375 | 3 | [] | no_license | import cv2
import numpy as np
import pyautogui
cap = cv2.VideoCapture(0)
lower_red = np.array([0, 50, 50]) # example value
upper_red = np.array([10, 255, 255])
prev_y=0
while True:
ret, frame = cap.read()
hsv = cv2.cvtColor(frame, cv2.COLOR_BGR2HSV)
mask = cv2.inRange(hsv, lower_red, upper_red)
... | true |
50fe8efb534d572eb3082448ad7a39aa4f089091 | Python | ankurgupta7/fast-rcnn-attributes | /data/attributes/Images/people_labels_parser_fcnn.py | UTF-8 | 977 | 2.59375 | 3 | [
"MIT"
] | permissive | f = open('labels.txt')
ft = open('../ImageSets/train.txt', 'w')
j = 0
while True:
l = f.readline()
if len(l) == 0:
break
words = l.split()
labels = ['is_male', 'has_long_hair', 'has_glasses', 'has_hat', 'has_t-shirt', 'has_long_sleeves', 'has_shorts', 'has_jeans', 'has_long_pants']
... | true |
da52ab252aafc16cb83748639bb0268f3503b03f | Python | shivekkhurana/learning | /python/generator_paradigm/bytes_transfered.py | UTF-8 | 315 | 2.71875 | 3 | [
"MIT"
] | permissive | import re
byte_regex = re.compile("""^.*]\s".*"\s[0-9]{3}\s([0-9]*)\s.*$""")
log = (line for line in open('access.log'))
byte_groups = (byte_regex.search(line) for line in log)
bytes = (int(byte_group.group(1)) for byte_group in byte_groups if byte_group != None)
print("Total bytes transfered : %d" % sum(bytes))
| true |
bc01c1bcbb4994926df81453b617c69e7df9931e | Python | hendrikvgl/RoboCup-Spielererkennung | /code-master/lib/bitbots/modules/behaviour/body/actions/throw.py | UTF-8 | 2,002 | 2.890625 | 3 | [] | no_license | # -*- coding:utf-8 -*-
"""
Throw
^^^^^
Handling throwing of the goalie.
History:
''''''''
* ??.??.??: Created (Unknown)
"""
from bitbots.modules.abstract.abstract_action_module import AbstractActionModule
import time
from bitbots.util import get_config
LEFT = "LEFT"
MIDDLE = "MIDDLE"
RIGHT = "RIGHT"
BOTH_ARMS_HIG... | true |
46a80ff46b4690a5802b464aec76434bf74a916d | Python | Kalen-Ssl/shilu | /7.1.py | UTF-8 | 392 | 2.546875 | 3 | [] | no_license | f = open('./Py7-1.txt', "w")
f.writelines("秦时明月汉时关,\n")
f.writelines("秦时明月汉时关。\n")
f.writelines("但使龙城飞将在,\n")
f.writelines("不教胡马度阴山。\n")
f = open('./Py7-1.txt', "r+")
flist = f.readlines()
flist[1]='万里长征人未还。\n'
f=open("./Py7-1.txt",'r+')
f.writelines(flist)
f=open("D:\Py7-1.txt",'r+')
print(f.read())
f.close() | true |
636cddf9f90621cd3f9340fb63f32dae743d95b0 | Python | alancucki/recursive-convolutional-autoencoder | /logger.py | UTF-8 | 10,645 | 2.65625 | 3 | [
"MIT"
] | permissive | # Code referenced from https://gist.github.com/gyglim/1f8dfb1b5c82627ae3efcfbbadb9f514
# and https://github.com/yunjey/pytorch-tutorial/blob/master/tutorials/04-utils/tensorboard/logger.py
import datetime
import glob
import os
import shutil
import sys
import time
from collections import defaultdict
import torch
import... | true |
6da5f9280ffd802899f2a5f99ce6a64ee2a6a359 | Python | sabrikrdnz/LYK-17-Python-Examples | /machine_learning/1_intro.py | UTF-8 | 645 | 3.375 | 3 | [] | no_license | from sklearn import datasets, neighbors
import numpy as np
# Load iris data from 'datasets module'
iris = datasets.load_iris()
# Get data-records and record-labels in arrays X and Y
X = iris.data
y = iris.target
# Create an instance of KNeighborsClassifier and then fit training data
clf = neighbors.KNeighborsClassif... | true |
bb8e08fd8648cfaf17aefe37a1acb710fcd95f42 | Python | theemadnes/rPi_camera_indexer | /lambda_functions/rPi_index_photo/lambda_function.py | UTF-8 | 1,394 | 2.609375 | 3 | [] | no_license | # import necessary modules
from __future__ import print_function
import json
import boto3
import urllib
dynamodb_table = 'mattsona-rpi-camera_metadata' # replace with your DDB table
# connect to dynamodb & s3
dynamodb = boto3.resource('dynamodb')
s3 = boto3.client('s3')
region_name = s3.meta.region_name # need the re... | true |
d6d0f9fee6bce8e6caf9c7184b8b017dee9fbe8d | Python | bballamudi/DataGristle | /scripts/gristle_slicer | UTF-8 | 13,920 | 2.765625 | 3 | [
"BSD-3-Clause"
] | permissive | #!/usr/bin/env python
"""
Extracts subsets of input files based on user-specified columns and rows.
The input csv file can be piped into the program through stdin or identified
via a command line option. The output will default to stdout, or redirected
to a filename via a command line option.
The ... | true |
ecfe1755b7f3f4f22762ba1b720e2e9e9a8cd885 | Python | tm-hsgw/AtCoderRepos | /atcoder.jp/past201912-open/past201912_f/Main.py | UTF-8 | 413 | 3.359375 | 3 | [] | no_license | s = input()
dic = []
i0 = 0
st = False
for i in range(len(s)):
if s[i].islower():
continue
if st:
dic.append(s[i0 : i + 1])
st = False
else:
i0 = i
st = True
dic = [w.lower() for w in dic]
dic.sort()
for w in dic:
w_ls = list(w)
w_ls[0] = w_ls[0].upper()
... | true |
055444edb77a8cf4e79c6e1a57f7c9d4d00ba699 | Python | Javacream/org.javacream.training.python | /org.javacream.training.python/src/3-Einfache Anwendungen/types_control_loop.py | UTF-8 | 351 | 3.890625 | 4 | [] | no_license | even_message = "an even number: "
odd_message = "an odd number: "
numbers = range(1, 10)
finished = False
for i in numbers:
print ("processing number " , i, ", finished: ", finished)
if i % 2 == 0:
print (even_message, i)
else:
print (odd_message, i)
finished = True
print ("all numbers pro... | true |
ab3b91e9cbde7ffc08a4f2f086ca43ffbe991617 | Python | Nadi0998/RIP | /Lab3/ex_2.py | UTF-8 | 647 | 3.078125 | 3 | [] | no_license | #!/usr/bin/env python3
from librip.gens import gen_random
from librip.iterators import Unique
data1 = [1, 1, 1, 1, 1, 2, 2, 2, 2, 2]
data2 = gen_random(1, 3, 10)
data3 = gen_random(1,9,15)
data = ['a', 'A', 'b', 'B']
# Реализация задания 2
for i in Unique(data1):
print(i, end=', ')
print()
#for i in d... | true |
1c7675bb81bceeab5f4befdb3b08b259de7c7931 | Python | freirezinho/lp2-python-ac04 | /physician.py | UTF-8 | 1,463 | 3.03125 | 3 | [] | no_license | from person import Pessoa
class Medico(Pessoa):
__crm: str = ''
__salario: int = 0
__especialidades: [str] = []
def __init__(
self,
nome: str,
rg: str,
cpf: str,
crm: str,
telefone: str,
salario: int,
especialidades: [str]
):
... | true |
ce9fab8bcb99e6e477b50f7b95a36780f59b1505 | Python | bajjurisupraja/phytonprogram | /85.py | UTF-8 | 143 | 3.078125 | 3 | [] | no_license | v= raw_input().rstrip()
evenB = oddB = ''
for l, m in enumerate(v):
if l & 1 == 0:
evenB += m
else:
oddB += m
print(evenB + " " + oddB)
| true |
c06e66fb1e1684feb960ef71b3d55bde6e1b645c | Python | BinhMinhs10/learning_pyspark | /graphanalytics.py | UTF-8 | 2,101 | 2.8125 | 3 | [] | no_license | # $SPARK_HOME/bin/spark-submit --packages graphframes:graphframes:0.7.0-spark2.4-s_2.11 graphanalytics.py
from pyspark.sql import SparkSession
import pyspark
from graphframes import GraphFrame
from pyspark.sql.functions import desc
spark = SparkSession.builder.appName("Python Spark SQL basic example").getOrCreate()... | true |
22ab301a72223254e9fe581d608a5a2dd7cd1d84 | Python | Sushmita00/class-5 | /hw5.py | UTF-8 | 1,903 | 4.46875 | 4 | [] | no_license |
# write a programm to print the multiplication table of the number entered by the user.
number=int(input("enter the number"))
i=1
while i<=10:
print(i*number)
i=i+1
# ask the user to enter 10 number using only one input statement and add them to the list
list=[]
for name in range(10):
number=input("enter ... | true |
ec80618ad626a8e70ae574509b4c81a0bc4f3cfd | Python | uladkasach/Academic | /CSCI/gamedev/camera.py | UTF-8 | 1,233 | 2.90625 | 3 | [] | no_license | import mathutils;
import math;
import bge;
print(dir(bge.logic.getCurrentScene().objects));
player = bge.logic.getCurrentScene().objects['Snek']; # get a reference to player object
playerRotationZ = player.localOrientation.to_euler()[2]; # get player direction as X,Y,Z (in radians not degrees)
inverseRotationZ = pla... | true |
c660b66bf9a50960a02d7e38c5a1f9f69800ba90 | Python | sdpython/botadi | /_unittests/ut_mokadi/test_grammar_mokadi.py | UTF-8 | 3,146 | 2.609375 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
"""
@brief test log(time=5s)
"""
import unittest
from pyquickhelper.loghelper import fLOG
class TestGrammarMokadi(unittest.TestCase):
def test_mokadi_grammar(self):
fLOG(
__file__,
self._testMethodName,
OutputPrint=__name__ == "__main__")
... | true |
9eacc24bd9010cf4d28417feb8a792ef7dc82e66 | Python | wai030/Python-project | /sudoku_general.py | UTF-8 | 3,229 | 3.75 | 4 | [] | no_license | ###################
## Variable Domains
###################
domain = (1,2,3,4)
######################################################
## Definition of a state (i.e., what the variables are
######################################################
start_state = [ None,1 ,None,3 ,
4 ,None... | true |
e99e24102d582fe1f39c9295734e6651f391f8c7 | Python | DJoseph11/pyjects | /coinflip.py | UTF-8 | 1,229 | 4.65625 | 5 | [] | no_license | import random
print(" I will flip a coin 1000 times. Guess how many times it will comp up heads. (Press Enter to begin")
input()
flips = 0 # a counter variable to keep track of how many flips has been made
heads = 0 # another counter variable to keep track of how many heads pop from the while loop in the if statement.... | true |
303501c4de4c8b61f4770376be368a8e8e6d717d | Python | dszokolics/reinforcement-learning | /Navigation.py | UTF-8 | 5,106 | 3.71875 | 4 | [] | no_license | # ---
# jupyter:
# jupytext:
# text_representation:
# extension: .py
# format_name: light
# format_version: '1.5'
# jupytext_version: 1.11.0
# kernelspec:
# display_name: drlnd
# language: python
# name: drlnd
# ---
# # Navigation
#
# ---
#
# In this notebook, you will learn... | true |
04a32402e7a7ea238076844b5c0fc31a304ac092 | Python | mohamedalani/Other | /Challenge Sounds/python_code.py | UTF-8 | 1,249 | 3.4375 | 3 | [] | no_license | import sys
#Recursive function that returns a generator with all combinations
def get_all_splits(array):
if len(array) > 1:
for sub in get_all_splits(array[1:]):
yield [' '.join([array[0],sub[0]])] + sub[1:]
yield [array[0]] + sub
else:
yield array
def ... | true |
24eb0b9e106d0da9c07f92a852a0d78e119be5f7 | Python | AwuorMarvin/Day-Three-Bootcamp | /WordCount/words_count.py | UTF-8 | 578 | 3.34375 | 3 | [] | no_license | def words(sentence):
lib = {}
count = 0
sentence_list = sentence.split()
length = len(sentence_list)
for word in sentence_list:
for i in range(length):
if sentence_list[i].isdigit() == True:
if sentence_list[i] == word:
count+=1
... | true |
a757eb4617b82b72da2672f043c78d17e643c9cd | Python | pavelsimo/ProgrammingContest | /spoj/328_BISHOPS/P328.py | UTF-8 | 264 | 3.046875 | 3 | [] | no_license | #!/usr/bin/python
# @BEGIN_OF_SOURCE_CODE
# @SPOJ BISHOPS C++ "Simple Math"
from sys import stdin
while True:
line = stdin.readline()
if line == '':
break;
n = int(line)
if n == 1:
print 1
else:
print 2*n-2
# @END_OF_SOURCE_CODE
| true |
0480e74d00b77b7e62beebbcc016372a65214b9c | Python | JordanMcK5/Week_2_Classes_weekend_hw | /tests/guest_test.py | UTF-8 | 564 | 3.046875 | 3 | [] | no_license | import unittest
from src.guest import Guest
from src.room import Room
from src.song import Song
class TestGuest(unittest.TestCase):
def setUp(self):
self.guest = Guest("Katy", 20)
def test_guest_has_name(self):
self.assertEqual("Katy", self.guest.guest_name)
def test_guest_has_cash(sel... | true |
aa8d379e321e6b62ba7991ec98408b87b41e5e21 | Python | pombredanne/wespe | /wespe/batch_uploaders/facebook/facebook_batch.py | UTF-8 | 7,420 | 2.671875 | 3 | [
"Apache-2.0"
] | permissive | import logging
from functools import partial
from typing import List, Union
from facebook_business.api import FacebookAdsApi, FacebookRequest, FacebookResponse
from tenacity import retry, retry_if_result, stop_after_attempt, wait_exponential
from wespe.exceptions import (
NoFacebookRequestProvidedError,
TooMa... | true |
41c2d0575b769b055c5fb64ca6609d06f0ea0294 | Python | Zhaoty96/lisatools | /MLDCpipelines2/bin/playXML.py | UTF-8 | 2,936 | 2.671875 | 3 | [] | no_license | #!/usr/bin/env python
__version__='$Id: $'
import lisaxml
import numpy
import math
import sys
import re
import wave
from optparse import OptionParser
def triang(windowsize,symmetric = 1):
halfkernel = numpy.arange(windowsize) / (1.0 * windowsize)
kernel = numpy.zeros(2 * windowsize + 1)
kernel[0:windows... | true |
9198ab706ae4d21e52c1e292da4dba2e8e0b210f | Python | windniw/just-for-fun | /leetcode/373.py | UTF-8 | 1,276 | 3.703125 | 4 | [
"Apache-2.0"
] | permissive | """
link: https://leetcode.com/problems/find-k-pairs-with-smallest-sums
problem: 用 nums1, nums2 中元素组成元素对 (u,v), 其中 u ∈ nums1,v ∈ nums2,求所有元素对中和最小的前 k 对
solution: 小根堆。因为 (nums[i], nums[j]) < (nums[i], nums[j+1]),可以肯定前者未出堆时后者入堆也没有意义,在前者出堆再将后者入堆
保持堆大小为 n,而不需要 mn,时间复杂度(klogn)
"""
class Solution:
def kSmal... | true |
6f9cab72c2f2b80fa79604062f14489f4c16ae43 | Python | xiangzhi/hw-fall2015 | /Math/projects/code/knnTest.py | UTF-8 | 372 | 2.859375 | 3 | [] | no_license | #!/usr/bin/env python
from sklearn.neighbors import NearestNeighbors
import numpy as np
X = np.array([[-1, -1],[0.2,0.5],[-2, -1], [-3, -2],[0.5,0.5],[1, 1], [2, 1], [3, 2]])
nbrs = NearestNeighbors(n_neighbors=2, algorithm='ball_tree').fit(X)
test = np.array([0,0])
test = test.reshape(1,-1)
distances, indices = nbrs.... | true |
0fdedf346c424199f989cedebcfc20b697f1efb6 | Python | fagan2888/arviz | /arviz/plots/mcseplot.py | UTF-8 | 8,683 | 2.625 | 3 | [
"Apache-2.0"
] | permissive | """Plot quantile MC standard error."""
import numpy as np
import xarray as xr
from scipy.stats import rankdata
from ..data import convert_to_dataset
from ..stats import mcse
from ..stats.stats_utils import quantile as _quantile
from .plot_utils import (
xarray_var_iter,
_scale_fig_size,
make_label,
def... | true |
2cfc1fa6b15e261a4804441fafe1c40b109b8488 | Python | Redwoods/Py | /py2020/Code/ch2/ch2_01_numeric.py | UTF-8 | 421 | 3.703125 | 4 | [] | no_license | # ch2_01_numeric.py
#
print("숫자형: 정수")
a = 123
a = -178
a = 0
print("숫자형: 실수")
a = 1.2
a = -3.48
a = 4.24e10
a = 4.24e-10
print("숫자형: 8진수와 16진수")
a = 0o177
a
a = 0x8FF
a
a = 0xABC
a
print("숫자형: 연산자와 연산")
a = 3
b = 4
a + b
a * b
a / b
a ** b
a % b
a // b
14 // 3
14 % 3
"""
Author: redwo... | true |
c72e411a4bdee2ce6c8fa77434c24b8c732c22f9 | Python | filyovaaleksandravl/geek-python | /lesson01_DZ/04_max_var.py | UTF-8 | 239 | 3.234375 | 3 | [] | no_license | lists1 = []
n = 0
var_1 = int(input("Введите число: "))
var_lenth = int(len(str(var_1)))
while n < var_lenth:
var_01 = var_1 % 10
lists1.insert(n, var_01)
var_1 = var_1 // 10
n += 1
print(max(lists1))
| true |
153dc578231109388ab7ebbbdea11db6f184f65d | Python | Pedro-H-Castoldi/descobrindo_Python | /pphppe/sessao17/heranca_multipla.py | UTF-8 | 2,653 | 4.5 | 4 | [] | no_license | """
POO - Herança Múltipla
É a possibilidade de uma classe herdar de múltiplas classes. Desse modo,
a classe filha herda todos os atributos e métodos das super classes.
OBS: A Herança Múltipla pode ser feita de duas maneiras:
- Multiderivação Direta;
- Multiderivação Indireta.
# Exemplo de Multiderivação Di... | true |
5cde147d2956a83e241f066bb0e76f03c6042e21 | Python | 314H/competitive-programming | /marathon-codes/Algoritmos Complexos/aho-corasick.py | UTF-8 | 2,194 | 3.546875 | 4 | [] | no_license | class AhoNode:
def __init__(self):
self.goto = {}
self.out = []
self.fail = None
def aho_create_forest(patterns):
root = AhoNode()
for path in patterns:
node = root
for symbol in path:
node = node.goto.setdefault(symbol, AhoNode())
node.out.app... | true |
be93690c12ca7443cd6fe6381f2cd2bb14a1864e | Python | chuta2323/Pythonista | /Mr Fujiwara.py | UTF-8 | 1,320 | 3.421875 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
import appex
import unicodedata
import clipboard
def erase_dakuten(char: chr) -> chr:
myDict = {
'が': 'か', 'ぎ': 'き', 'ぐ': 'く', 'げ': 'け', 'ご': 'こ',
'ざ': 'さ', 'じ': 'し', 'ず': 'す', 'ぜ': 'せ', 'ぞ': 'そ',
'だ': 'た', 'ぢ': 'ち', 'づ': 'つ', 'で': 'て', 'ど': 'と',
'ば': 'は', '... | true |
469f502ba2b4798ff1e5417f628d72ac0f9d9a91 | Python | sharky564/Codeforces | /CodeForces Problems 0101-0200/CodeForces Problem 0116A.py | UTF-8 | 210 | 3.078125 | 3 | [] | no_license | # Tram
a = int(input())
inputs = [input() for i in range(a)]
min_cap = 0
num = 0
for i in inputs:
c = i.split()
num += int(c[1]) - int(c[0])
if num > min_cap:
min_cap = num
print(min_cap)
| true |
ef51f3e2131b3511165395e0bc816ade50685965 | Python | Richardilemon/ORGANISE-FILES | /ORGANIZE FILES.py | UTF-8 | 1,472 | 3.4375 | 3 | [] | no_license | #This python script automatically arranges the files in your folder
#The files will be grouped according to their file type
#The file type that can be grouped are audios, videos, images, and documents
import os
from pathlib import Path
FILETYPE = {
"AUDIO":['.m4a','.m4b','.mp3','.wav','.flac','.cda'],
"D... | true |
b0d93b6e3278ad49433b177ce5d3f61b132b7eac | Python | cessorg/Hacktoberfest-Data-Structure-and-Algorithms | /Python/Stack/stack.py | UTF-8 | 420 | 3.796875 | 4 | [] | no_license | class Stack():
def __init__(self,items=[]):
self.items = []
def push(self,data):
i = self.items.append(data)
return i
def pop(self):
i = self.items.pop()
return i
def is_empty(self):
return len(self.items)==0
def peek(self):
if not sel... | true |
aa537e1b9d06847d4593564f87b36fa8bc8a27a9 | Python | fobbytommy/Python-Assignments | /01_Basic/03_averageList/averageList.py | UTF-8 | 192 | 3.796875 | 4 | [] | no_license | # Create a program that prints the average of the values in the list:
# a = [1, 2, 5, 10, 255, 3]
a = [1, 2, 5, 10, 255, 3]
sum = 0
for count in a:
sum += count
avg = sum / len(a)
print avg
| true |
92bc2756dfab7d11ef9b9be8f8a2d5909a01a4b6 | Python | bongtrop/DIPhomwork | /cal.py | UTF-8 | 1,749 | 3.125 | 3 | [] | no_license | import numpy as np
import math
# Gaussian Elimination Partial Pivoting
# Input GEPP(Ax = b)
def GEPP(A, b):
n = len(A)
if b.size != n:
raise ValueError("Invalid argument: incompatible sizes between A & b.", b.size, n)
for k in xrange(n-1):
maxindex = abs(A[k:,k]).argmax() + k
if A[... | true |
94732ba40ad5b1cf6989c29be2410fb084908dd4 | Python | CloudKing-GrowLearning/Int-Python-Resources | /Resources/T7 - DataFrame in Pandas/guided_activity/world_bank_df_part2_SOLUTION.py | UTF-8 | 559 | 2.640625 | 3 | [] | no_license | import pandas as pd
import os
import Lib as cm
file_dir = os.getcwd()
file_name = file_dir + '/world_data_bank.csv'
data = pd.read_csv(file_name, sep=';')
df = pd.DataFrame()
df = df.append(data.iloc[9:11])
employment_data = data.iloc[[9, 10]]
del employment_data['Country Name']
del employment_data['Country Code']
... | true |
ea9699d5f3d6c616dde028372822a56b6227f598 | Python | conejo1995/pythonLabs | /room_nav/room_nav.py | UTF-8 | 1,951 | 3.90625 | 4 | [] | no_license | from room import Room
from character import Character
def battle(player, npc):
fighting = True
print("You are now battling " + npc.name)
while fighting:
user_input = input("What would you like to do?")
if user_input == 'fight':
npc.take_damage(player.attack)
print(... | true |
9c076a465b966c53e72c7b9e1d5030d02bf91e8a | Python | Ukelili/testxiaoshu | /testCode.py | GB18030 | 4,223 | 2.875 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: gb2312 -*-
import os
import urllib
from PIL import Image
from pytesser import *
from pytesseract import *
# ͼƬ
for i in range(1):
url = 'http://test.xiaoshushidai.com/verify.php' # ֤ĵַ
print "download", i
file("./pic/%04d.gif" % i, "wb").write(urllib.urlopen(url).read()... | true |
d276deaadca11085de13ec883bca57fbb5b6cbfa | Python | A-ZGJ/Hilbert | /hilbert/tests/test_wavelet.py | UTF-8 | 1,516 | 3.375 | 3 | [
"LicenseRef-scancode-public-domain"
] | permissive | """
Testing for Hilbert transform methods that use wavelets at their core
Using the math relation a^2 / (a^2 + x^2) (Lorentz/Cauchy) has an
analytical Hilbert transform: x^2 / (a^2 + x^2)
"""
import numpy as np
from numpy.testing import assert_array_almost_equal
from hilbert.wavelet import hilbert_haar, _haar_matri... | true |
f52f5ed35bc4d7f7763cb69127ae3339df27c939 | Python | dimelik/army | /weapon/gunshot_weapon/pistol.py | UTF-8 | 287 | 2.90625 | 3 | [] | no_license | from gunshot_weapon import GunshotWeapon
class Pistol(GunshotWeapon):
__armorPiercing = None
@property
def armor_piercing(self):
return self.__armorPiercing
@armor_piercing.setter
def armor_piercing(self, value: int):
self.__armorPiercing = value
| true |
48b163e22353c5503f0d77044502f4cacb37d4b9 | Python | HugoHF/dark_matter | /paper_graphs.py | UTF-8 | 2,037 | 2.796875 | 3 | [] | no_license | import numpy as np
from hff import get_hff
from get_freqs import get_freqs
from create_data import create_data
from chisquared_stuff import get_significance
from autocorrelation import autocorrelation
import matplotlib.pyplot as plt
from scipy.fft import fftfreq
test_stds = [0.001, 0.03, 0.1]
test_freqs = np.ar... | true |
b2416baa2737a4367fac2a334b5b29da773a8e25 | Python | sakella1/Traffic-Sign-Recognition-Deep-Learning-on-Edge | /car_class.py | UTF-8 | 3,131 | 3.046875 | 3 | [] | no_license | import paho.mqtt.client as mqtt
import sys
import json
local_broker = "broker" # broker is host name
local_port = 1883 # standard mqtt port
local_topic = "signs" # topic is image
with open("keys.json") as json_file:
keys = json.load(json_file)
# dictionary of signs
signs = {
"30": {
"label": "30_k... | true |
8efe234477e2cd1452b6d065f2446c3fb6280730 | Python | zhaolixiang/my-all | /网络爬虫实战/35、 Ajax数据爬取.py | UTF-8 | 1,425 | 2.609375 | 3 | [] | no_license | # 爬取女朋友的微博
import json
import requests
from urllib.parse import urlencode
from pyquery import PyQuery
base_url = 'https://m.weibo.cn/api/container/getIndex?'
uid='3098454065'
headers = {
'Host': 'm.weibo.cn',
'Referer': 'https://m.weibo.cn/u/'+uid,
'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_... | true |
afe050ee8f9fe342d3f413e9453aec9a720f08e5 | Python | wbing520/COVID-away | /COVID-away_dataset_visualization/visualize_data_patterns_in_COVID-away.py | UTF-8 | 2,347 | 2.65625 | 3 | [] | no_license |
import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
plt.rcParams.update({'xtick.bottom' : False, 'axes.titlepad':5})
from scipy import signal
import matplotlib.pyplot as plt
fig, axes = plt.subplots(4,1, figsize=(4, 10), sharex=True, dpi=120)
b, a = signal.butter(3, 0.05)... | true |
9140e54a047d8b1f6f1c2de01377f0d972b21ceb | Python | pytutorial/py2103 | /Day23/vd3.py | UTF-8 | 959 | 3.09375 | 3 | [] | no_license | from flask import Flask
from flask.globals import request
app = Flask(__name__)
productList = [
{'id': 1, 'name': 'IPhone X', 'price': 10500000},
{'id': 2, 'name': 'IPhone 11', 'price': 11500000},
{'id': 3, 'name': 'IPhone 12', 'price': 12500000},
]
@app.route('/')
def index():
html = '<ul>'
for ... | true |
ff76481145c0c6d00c6c8a1f35f5a7d9b2d71a27 | Python | rainmayecho/applemunchers | /47.py | UTF-8 | 945 | 3.171875 | 3 | [] | no_license | def get_primes(n):
numbers = set(range(n, 1, -1))
primes = []
while numbers:
p = numbers.pop()
primes.append(p)
numbers.difference_update(set(range(p*2, n+1, p)))
return primes
def pfactorize(a,primes,b,pfactors = []):
if a==1:
return pfactors
if a==2:
pf... | true |
dd7347215cef3d966585e2ad8b278eae86b09375 | Python | jorgegarba/CodiGo9 | /BackEnd/Semana4/Dia3/12-codigos-extra-impresion-escape-codes.py | UTF-8 | 270 | 4.3125 | 4 | [] | no_license | # \r sirve para eliminar lo anterior escrito
print("Hola \r mundo")
# \n sirve para generar un salto de linea
print("Hola \n mundo")
# \t sirve para una tabulacion
print("\tHola mundo")
# \\ si queremos usar el caracter \ o algun caracter especial
print("Hola \\ mundo") | true |
6513ab2907da9fc02158a9e2de33fe2b4b1307e4 | Python | beluga13/ChoreBoard | /participants_list_module.py | UTF-8 | 6,889 | 3.71875 | 4 | [] | no_license | class Participants():
## Constants used for validation
MINIMUM_NAME_LENGTH = 3 # Used to validate team member's name
MAXIMUM_NAME_LENGTH = 10
MINIMUM_HOUSEHOLD_SIZE = 2
MAXIMUM_HOUSEHOLD_SIZE = 5
## Constructor for the set containing participant's names.
# @param the_participants... | true |
6c406bd72947bbdcb6001c46f0f5a106d1ba3a48 | Python | KaloObr/Python-Fundamentals | /p5_list_advanced/lab_1_trains.py | UTF-8 | 609 | 3.640625 | 4 | [] | no_license | wagons_n = int(input())
train = [0] * wagons_n
while True:
command = input()
if command == 'End':
break
tokens = command.split(" ")
instructions = tokens[0]
if instructions == 'add':
count = int(tokens[1])
train[-1] += count
elif instructions == 'insert':
index... | true |
131b9c4eb96f84ab818923afdfff562d89edb283 | Python | Tornike-Skhulukhia/IBSU_Masters_Files | /code_files/__PYTHON__/lecture_1/basic data structures/stack.py | UTF-8 | 844 | 4.375 | 4 | [] | no_license | '''
We do not need it in Python, but...
'''
class Stack:
def __init__(self):
self._data = []
self._top = 0
def __len__(self):
return self._top
def __repr__(self):
return f"<Stack: [{', '.join([str(i) for i in self._data[:self._top]])}]>"
def push(self, item):
... | true |
9e5bd945cfc8adf1358a22f53e16e1a7c4f99934 | Python | akieight5/python-experiments | /3.7projects/images.py | UTF-8 | 1,682 | 3.34375 | 3 | [] | no_license | '''
Created on 25 Nov 2020
@author: aki
'''
"""
import tkinter as tk
root = tk.Tk()
root.title("image demonstration")
#iconbitmap only works with black and white images
# root.iconbitmap("/home/aki/Downloads/icons/antenna.xbm")
img = tk.PhotoImage(file='/home/aki/Downloads/icons/antenna.png')
root.tk.call('wm', 'ic... | true |
93a2551b2a5a0bd79bbac0a5e011c65ce04dd686 | Python | wilsonwong2014/MyDL | /Tensorflow/demo/opencv/demo_image_segmentation.py | UTF-8 | 1,342 | 2.890625 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
''' 图像分割
------------------------------------------------
'''
#K-means方法进行分割
# 以灰色导入图像
img = cv2.imread('messi5.jpg',0)#image read be 'gray'
plt.subplot(221),plt.imshow(img,'gray'),plt.title('original')
plt.xticks([]),plt.yticks([])
# 改变图像的维度
img1 = img.reshape((i... | true |
ce657f14292763873c441e37b3589f8acd9d38c4 | Python | snip-animesh/Dynamic-Programming | /freecodecamp.org/fibTabulation.py | UTF-8 | 305 | 3.40625 | 3 | [] | no_license | def fibTab(n):
table=[0]*(n+1)
table[1]=1
i,j,k=0,1,2
while (k<=n+1):
if k==n+1:
table[j]+=table[i]
break
table[j]+=table[i]
table[k]+=table[i]
i+=1;j+=1;k+=1
return table[n]
print(fibTab(50))
# Time and space Complexity O(n)
| true |
8bb3365b7ef14775682b5bc92d6b78fd7a7fbe04 | Python | AYWG/RedditBots | /askreddit_tracker/askreddit_tracker.py | UTF-8 | 1,184 | 2.640625 | 3 | [] | no_license | # reddit bot that messages me every time there is a post on r/askreddit/hot that has 10000+ comments
import praw
import OAuth2Util
import time
user_agent = "AskReddit tracker 1.0 by /u/TheMaou"
r = praw.Reddit(user_agent)
o = OAuth2Util.OAuth2Util(r) # connect via OAuth2
o.refresh(force=True) #... | true |
1de328d0c8a0529c1f1388fcbe1256433030f215 | Python | mmore500/dishtiny | /postprocessing/tabulate_and_stitch_stint_thread_profiles.py | UTF-8 | 5,221 | 2.609375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
"""Combines all available collated data on s3 for a single stint.
Collated data is tabulated (reformatted and processed) and stitched into a single dataframe.
Uploads output to a programatically-generated s3 url.
Usage:
./tabulate_and_stitch_stint_thread_profiles.py [bucket] [endeavor] [sti... | true |
22be274d4b540791097785dd857ddb68f65ce998 | Python | cmput401-fall2018/web-app-ci-cd-with-travis-ci-forgeno | /Selenium_test.py | UTF-8 | 762 | 2.8125 | 3 | [
"MIT"
] | permissive | from selenium import webdriver
from selenium.webdriver.common.keys import Keys
def test_home():
selenium = webdriver.Chrome()
selenium.get('http://162.246.157.221:8000')
name = selenium.find_element_by_id('name')
about = selenium.find_element_by_id('about')
education = selenium.find_element_by_id(... | true |
d53447be0a558a362459b283d53cc1e7938fe6e9 | Python | Modulus/AmmoFinder | /ammo_finder/core/category.py | UTF-8 | 700 | 2.890625 | 3 | [] | no_license | # Python standard library imports
from enum import Enum
class Category(Enum):
RIFLE = 1
HANDGUN = 2
RIMFIRE = 3
SHOTGUN = 4
AIR = 5
@staticmethod
def extract(url):
if "rifle" in url:
return Category.RIFLE
elif "hagle" in url:
return Category.SHOTGUN... | true |
6a935e64bf9e98ec2a449856cb78418b11ca551b | Python | bluestone029/dxf-ruler-generator | /dxf_ruler_generator.py | UTF-8 | 2,397 | 3.25 | 3 | [
"MIT"
] | permissive | """DXF Ruler Generator.
This module generates DXF files for laser cutting and engraving custom sized
rulers, which can be easily manufactured at the nearest FabLab.
Example
-------
Generate a 7cm ruler:
$ python -m dxf_ruler_generator 7
This will create a 'ruler_7cm.dxf' on the current working directory.
"""
i... | true |
0a591936785a9d2ebbda5fa77d60361d42917258 | Python | fsevero/python-oo | /003 - Inheritance/inheritance.py | UTF-8 | 717 | 3.625 | 4 | [] | no_license | class MyClass (object): # class MyClass and, by default, inherits from object
pass
class Person:
def __init__(self, name, age):
self.name = name
self.age = age
def __repr__(self):
return 'Person: {} - Age: {}'.format(self.name, self.age)
class PF(Person):
def __init__(self, ... | true |
d40b8d853d04c530c388dbda40d984b74ffb61ee | Python | Stomach-ache/Codeforces | /round_236/A.py | UTF-8 | 192 | 2.96875 | 3 | [] | no_license | k, a, b, v = map(int, raw_input().split())
cnt = 0
while a > 0:
section = 1
if b >= k-1:
section = k
b -= (k - 1)
else:
section = b + 1
b = 0
a -= (v * section)
cnt += 1
print cnt | true |
8010703a48c8a63d85f23daba8772419add576e6 | Python | davparra/Kinases | /old/kinase-hc.py | UTF-8 | 702 | 2.890625 | 3 | [] | no_license | #%% [markdown]
# ## Libraries
import pandas as pd
import scipy.spatial.distance as ssd
from scipy.cluster.hierarchy import linkage, dendrogram
from matplotlib import pyplot as plt
import plotly.plotly as py
import plotly.offline
#%% [markdown]
# ## preparing data to be processed
data_path = 'data/human_protein_distanc... | true |
2fbe905e555b43c6cacbc64ed47e135e5c3c2caf | Python | cash2one/xai | /xai/brain/wordbase/adjectives/_accountable.py | UTF-8 | 493 | 2.609375 | 3 | [
"MIT"
] | permissive |
#calss header
class _ACCOUNTABLE():
def __init__(self,):
self.name = "ACCOUNTABLE"
self.definitions = [u'Someone who is accountable is completely responsible for what they do and must be able to give a satisfactory reason for it: ']
self.parents = []
self.childen = []
self.properties = []
self.jsondata... | true |
2ce85cbca86621f2ca308d7b9f33285b7679b953 | Python | jaciyu/MouseTrackGAN | /dataprocsess.py | UTF-8 | 1,990 | 2.53125 | 3 | [] | no_license | import numpy as np
with open('E:\Workspace\GANproject\data_origin.txt', 'r') as f:
data = f.readlines()
fdata0 = np.zeros([3000, 300, 3], dtype=float)
fdata1 = np.zeros([3000, 4], dtype=float)
fdata_mark = np.zeros([3000, ], dtype=float)
# 提取特征
for i in range(len(data)):
data[i] = data[i].split()
... | true |
2cfea324cf9d82ab554fa9ea27f74001ba18a6c1 | Python | robertbsnook/booking_quote | /src/booking/Package_booking.py | UTF-8 | 8,727 | 3.375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
import datetime
import pandas as pd
from tabulate import tabulate
class TravelRoute:
def __init__(self, destination, dangerous, urgency, dimension, weight):
self.destination = destination
self.dangerous = dangerous
self.urgency = urgency
self.dimension = float... | true |
a523dfb92df7c9364165cecc81c4a48e4f58e944 | Python | MiracleOfFate/WebUITest | /action_chains/drag_and_drop_by_offset_demo.py | UTF-8 | 1,351 | 2.875 | 3 | [] | no_license | from time import sleep
from selenium import webdriver
# 打开浏览器,并加载项目地址
driver = webdriver.Chrome()
driver.get("https://passport.ctrip.com/user/reg/home")
sleep(2)
# 点击同意并继续
element_agree = driver.find_element_by_css_selector("div.pop_footer>a.reg_btn.reg_agree")
element_agree.click()
sleep(3) # important!!!
from ... | true |
bcfc119db38fd6c471f0c248dd04dd23b01e5c70 | Python | loganmeetsworld/advent-of-code | /2021/5/solution.py | UTF-8 | 1,847 | 3.109375 | 3 | [] | no_license | import re
from collections import Counter
from aoc_utils import aoc_utils
from tests import cases
def find_all_coordinates(x1, y1, x2, y2, part_one=False):
points = []
dx = x1 - x2
dy = y1 - y2
# Like 2,2 -> 2,1
if dx == 0:
for y in range(min([y2, y1]), max([y2, y1]) + 1):
... | true |
e68d7d561bd15a5cff8065ce63e25d4e8dcf5ebe | Python | akki8087/HackerRank | /Binary Numbers.py | UTF-8 | 528 | 2.640625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Tue Jun 26 17:53:03 2018
@author: NP
"""
#!/bin/python3
import math
import os
import random
import re
import sys
if __name__ == '__main__':
import sys
n = int(input().strip())
tst = str(bin(n))
tst = tst[2:]
ones = 0
maxOnes =... | true |
22824cec8886ddd756c96fc252fc65541d80de6b | Python | sinx-wang/dealCourtDocs | /deal.py | UTF-8 | 2,301 | 3.203125 | 3 | [] | no_license | """Convert downloaded documents format to .docx and select
"""
#-*-coding:utf-8-*-
import os
from docx import Document
import win32com.client as wc
class DealDocuments:
"""
把下载下来的文书转为docx格式,方便后面根据关键字检索
"""
def __init__(self, text, docx_text):
self.text = text
self.docx_text = docx_te... | true |
feb4b8b6128ed7aa44f774516380dc3a8803f2d1 | Python | kanta-ishii/math_in_python | /線形代数/コサイン類似度.py | UTF-8 | 383 | 3.671875 | 4 | [] | no_license | '''ベクトル同士の向きの近さを表す'''
import numpy as np
def cos_sim(vec_1, vec_2):
return np.dot(vec_1, vec_2) / (np.linalg.norm(vec_1) * np.linalg.norm(vec_2))
a = np.array([2,2,2,2])
b = np.array([1,1,1,1])
c = np.array([-1,-1,-1,-1])
print(cos_sim(a, b))
print(cos_sim(a, c))
'''↑ベクトルの向きがどれだけ揃っているかの指標になる''' | true |
c670004e5215c5e2fa4e539393d9c8c21b32cbb7 | Python | anuvarsh/CMSI282 | /hw2/9-lcm.py | UTF-8 | 179 | 3.375 | 3 | [] | no_license | def lcm(x, y):
if (x > y):
greater = x
else:
greater = y
while(True):
if((greater % x == 0) and (greater % y == 0)):
lcm = greater
break
greater += 1
return lcm | true |
82b68b6f0cf0e349650e61423730cac74b6db352 | Python | CySpiegel/CS5402-Data-Mining | /Part 1/DictCounter.py | UTF-8 | 704 | 3.046875 | 3 | [] | no_license | import os
import glob
from collections import OrderedDict
import csv
ValuesDictionary = {}
fields = []
rows = []
csvLocation = ("originalDataset.csv")
with open(csvLocation, mode='r') as csvfile:
csvreader = csv.reader(csvfile)
fields = next(csvreader)
for row in csvreader:
rows.append(row)
Correct = True
for i... | true |
7e925d1317f8ffaaefe237993e8cec2511626126 | Python | Top1Miami/ITMO_FS | /ITMO_FS/utils/information_theory.py | UTF-8 | 1,449 | 2.9375 | 3 | [
"MIT",
"BSD-3-Clause"
] | permissive | from math import log
import numpy as np
def conditional_entropy(x_j, y):
countX = {x: 0 for x in x_j}
dictYByX = {x: {} for x in x_j}
for i in range(len(y)):
x_val = x_j[i]
y_val = y[i]
countX[x_val] += 1
dictYByX[x_val].update({y_val: dictYByX[x_val].get(y_val, 0) + 1})
... | true |
a1901b55c34bccf27ff675f32d8149cf64370862 | Python | Arnukk/TDS | /main_assignment1.py | UTF-8 | 8,251 | 2.828125 | 3 | [
"MIT"
] | permissive | __author__ = 'akarapetyan'
import matplotlib.pyplot as plt
from wnaffect import WNAffect
from emotion import Emotion
from nltk.corpus import wordnet as wn
from cursor_spinning import SpinCursor
import time
import sys
import numpy as np
import PorterStemmer as ps
from scipy.interpolate import interp1d
#CONSTANTS
#arra... | true |
1b18ad35deb475d40a14519becc1a7287439db7e | Python | 15831944/skiaming | /SkiaCode/tools/test_pictures.py | UTF-8 | 6,084 | 2.546875 | 3 | [
"BSD-3-Clause"
] | permissive | '''
Compares the rendererings of serialized SkPictures to expected images.
Launch with --help to see more information.
Copyright 2012 Google Inc.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
'''
# common Python modules
import os
import optparse
import sys
import ... | true |
8daae6df89ec054ae3b94a39f2e7eac9d791f15c | Python | zhangmingcheng28/pomdp-py | /pomdp_py/utils/templates.py | UTF-8 | 4,150 | 3.109375 | 3 | [
"MIT"
] | permissive | """
Some particular implementations of the interface for convenience
"""
import pomdp_py
import random
class SimpleState(pomdp_py.State):
"""A SimpleState is a state that stores
one piece of hashable data and the equality
of two states of this kind depends just on
this data"""
def __init__(self, da... | true |
4caa42ead0b819cf666a5ecd8a8af28e0360963a | Python | vijoin/AtosPythonCourseExamples | /ex09-Dictionary.py | UTF-8 | 1,861 | 4.03125 | 4 | [] | no_license | def print_dictionaries():
#Add a country
countries = {'Uruguay':
{'official_name': 'República Oriental del Uruguay',
'capital': 'Montevideo',
'population': 3_457_000,
}
}
print(countries)
#Add a sec... | true |
eda2ba7b3d8592a8ab1569f8766f320003a5c9ee | Python | DXV-HUST-SoICT/data_mining_mini_projects | /neural network/emnist-tensorflow/recognize.py | UTF-8 | 2,915 | 2.546875 | 3 | [] | no_license | from __future__ import absolute_import
from tensorflow.keras.models import load_model
from tensorflow.keras.models import model_from_json
from matplotlib import pyplot as plt
import cv2
import numpy as np
import sys, os
WORKING_DIR = './'
characters = ['0','1','2','3','4','5','6','7','8','9',
'A','B','C','D','E'... | true |
b2752ac06aab4e0f283d0c9c6cf23dc2f77df68d | Python | mir-sam-ali/SEProject2021 | /PyStackBot/AnswerSearch/preprocessor/preprocessor.py | UTF-8 | 10,026 | 2.609375 | 3 | [] | no_license | import os
import re
from textblob import TextBlob
import software_tokenizer as tokenizer
import nltk
from nltk.stem import WordNetLemmatizer # used for stemming
from remove_stopwords import remove_stopwords
nltk.download('punkt',quiet=True)
nltk.download('wordnet',quiet=True)
class PreprocessPostContent(o... | true |
f68ab18c169f189297a72ee16fcd6971b922075c | Python | rafaelperazzo/programacao-web | /moodledata/vpl_data/3/usersdata/2/797/submittedfiles/ex1.py | UTF-8 | 237 | 3.703125 | 4 | [] | no_license | # -*- coding: utf-8 -*-
from __future__ import division
a = input('Digite a: ')
b = input('Digite b: ')
c = input('Digite c: ')
if a>=b and a>=c:
print('%.2f' % a)
elif b>=a and b>=c:
print('%.2f' %b)
else:
print('%.2f' % c)
| true |
76b2f0b221c3bac3e1e9848d7972b1e0a0282193 | Python | kosta324/algo_and_structures_python | /Lesson_2/6.py | UTF-8 | 1,499 | 4.1875 | 4 | [] | no_license | """
6. В программе генерируется случайное целое число от 0 до 100.
Пользователь должен его отгадать не более чем за 10 попыток. После каждой
неудачной попытки должно сообщаться больше или меньше введенное пользователем
число, чем то, что загадано. Если за 10 попыток число не отгадано,
то вывести загаданное число.
"""
f... | true |
a4fdec93922ec50a48a7bc99c4cbe7c2647dbecd | Python | cristinasewell/mongo_db | /about_pymongo.py | UTF-8 | 1,386 | 2.90625 | 3 | [] | no_license | import pymongo
import datetime
# create a connection
conn = "mongodb://localhost:27017"
client = pymongo.MongoClient(conn)
# define the travel_db database in Mongo
db = client.travel_db
# quering all destinations
dest = db.destinations.find()
for d in dest:
print(d)
# inserting a document into the destinatio... | true |
42b91b8ab0d88bf62259f495d0ded3ae32f2931e | Python | JoaoGabrielDamasceno/Estudo_Python | /Lambdas/lambdas.py | UTF-8 | 445 | 4.15625 | 4 | [] | no_license | """
Funções Lambdas são funções sem nome, ou seja, funções anônimas
FORMATO
lambda entrada: retorno
"""
exemplo = lambda x: x*3
y = input()
print(y)
print(exemplo(y))
nome_completo = lambda nome, sobrenome: nome.strip().title() + ' ' + sobrenome.strip().title()
print(nome_completo('Joao ', ' GABRIEL '))
autores... | true |
68a075c81d629a6cc46a162ce2182bbbf059a39e | Python | YasirHabib/data_science_deep_learning_in_python | /Section5/ann_train_6.py | UTF-8 | 2,175 | 3.09375 | 3 | [] | no_license | # Section 5, Lecture 37
# This is extension of logistic_softmax_train_5.py
import numpy as np
import matplotlib.pyplot as plt
from sklearn.utils import shuffle
from process_2 import get_data
def target2indicator(Target, K):
N = len(Target)
T = np.zeros((N,K))
for x in range(N):
T[x, Target[x]] = 1
return T
X,... | true |
4ee3e4047e91f030f039d91123fb135764fd5f5a | Python | mobeets/FOMOBot | /bin/next_location.py | UTF-8 | 967 | 2.921875 | 3 | [] | no_license | from collections import namedtuple
from random import choice
import csv
INFILE = 'locs.csv'
BIG_CITIES_FILE = 'loc_pops.csv'
RNG = 0.025
HEADER = 'locId,country,region,city,postalCode,latitude,longitude,metroCode,areaCode'
Location = namedtuple('Location', HEADER)
def location(infile=INFILE, bigfile=BIG_CITIES_FILE)... | true |