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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
87f13cf54aa5b470fa1bf2690478b5ca70659e13 | Python | SecretMG/GrabCut | /source/graph.py | UTF-8 | 7,974 | 2.96875 | 3 | [
"MIT"
] | permissive | import numpy as np
from tqdm import tqdm
from time import time
from GMM import GMM
from Dinic import Dinic
from utils.args import args
class GCGraph:
def __init__(self, input, left_top, right_bottom, fore, back):
self.input = input.astype(int) # 破除像素值限制
self.ord2id = {}
self.id2ord = []
... | true |
e97a84c3ec2e16099a1ef26e83f9c227903dfeb9 | Python | Kylmakalle/assistant-bot | /core/packages.py | UTF-8 | 1,568 | 2.8125 | 3 | [
"MIT"
] | permissive | import importlib
import logging
import pkgutil
log = logging.getLogger(__name__)
REQUIREMENT_SEPARATOR = "::"
class PackagesLoader:
def __init__(self, *, debug=False):
self._debug = debug
self.modules = {}
def load_package(self, package, recursive=True):
"""
Import all subm... | true |
5ccde741e558ab9835f9bd824043e7a6309bf5ce | Python | dorokhin/pyleo | /tests/unit/utils.py | UTF-8 | 434 | 3.03125 | 3 | [
"MIT"
] | permissive | def capture(f):
"""
Decorator to capture standard output
"""
def captured(*args, **kwargs):
import sys
from io import StringIO
backup = sys.stdout
try:
sys.stdout = StringIO()
f(*args, **kwargs)
output = sys.stdout.getvalue()
f... | true |
d2001a168ab00497ea03bc954f5e46180322a010 | Python | lzy1732008/Algorithm | /leetcode/code.py | UTF-8 | 32,638 | 3.703125 | 4 | [] | no_license | from jzoffer.ListNode import ListNode, TreeLinkNode
from itertools import product
class Solution:
# 1.two sum
def twoSum(self, nums, target):
keyindex = {}
for i in range(len(nums)):
if keyindex.get(nums[i]) is None:
keyindex[nums[i]] = [i]
else:
... | true |
d3ee8cd4a616c499640d8935d1a6872b2c693735 | Python | mikaelbk/fys-mena4111 | /lab2/results.py | UTF-8 | 2,213 | 2.75 | 3 | [] | no_license | from numpy import *
from matplotlib.pyplot import *
#importing results
file = open("results.txt", "r")
lines = file.readlines()
file.close()
for i in range(len(lines)):
lines[i] = lines[i].split()
lines = array(lines)
#declaring variable arrays
MxForce = lines[1:,0].astype(float)
Drift = lines[1:,1].astype(float)... | true |
50a22fe47bca686c60418b1d616d9c3fc60b4bbb | Python | ustudio/factory_boy | /factory/declarations.py | UTF-8 | 2,868 | 3.125 | 3 | [
"MIT"
] | permissive | # Copyright (c) 2010 Mark Sandstrom
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, dis... | true |
6de6f7768537e8ef14600cc06bfd287548928fce | Python | UNDP-Serbia/SerbianAutoRIA | /src/ria.py | UTF-8 | 22,275 | 2.640625 | 3 | [] | no_license | import os
from load_data import DataLoader
from custom_par_vec import CustomParVec
from difflib import SequenceMatcher
import matplotlib.pyplot as plt
import seaborn as sns
import numpy as np
import pandas as pd
import xlsxwriter
class RIA:
"""
Contains the methods used in performing the automated RIA alg... | true |
4c81299ef7972bbf9574da4852440a10dbc65b62 | Python | Yasir323/Docker-Tutorial | /flask_demo/train_model.py | UTF-8 | 764 | 2.890625 | 3 | [
"MIT"
] | permissive | from sklearn.ensemble import RandomForestClassifier
from sklearn.datasets import load_iris
from sklearn.model_selection import train_test_split
from sklearn.metrics import accuracy_score
import pandas as pd
import numpy as np
import pickle
np.random.seed(42)
# Load the dataset
iris = load_iris()
X = iris.data
y = iri... | true |
f0af4829958301c5bec46a49768ac8347ef6c75a | Python | darlasunitha/python1-1 | /paragraph.py | UTF-8 | 58 | 2.765625 | 3 | [] | no_license | string = raw_input()
line = string.count(' ')
print(line)
| true |
6fa1ae3fc0145bc2c60e373dd7b4a7b824e2f519 | Python | psederberg/reggie | /reggie/models/gp/fourier.py | UTF-8 | 1,946 | 2.90625 | 3 | [
"BSD-2-Clause"
] | permissive | """
Approximate finite-dimensional samples from a GP.
"""
from __future__ import division
from __future__ import absolute_import
from __future__ import print_function
import numpy as np
from ...utils import linalg as la
from ...utils.misc import rstate
class FourierSample(object):
"""
Encapsulation of a co... | true |
69b47ea5eca8ec1b83e6fb88116ea5f2595c02c2 | Python | south-coast-science/scs_core | /tests/aqcsv/specification/unit_test.py | UTF-8 | 749 | 2.765625 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
"""
Created on 4 Mar 2019
@author: Bruno Beloff (bruno.beloff@southcoastscience.com)
"""
from scs_core.aqcsv.specification.unit import Unit
from scs_core.data.json import JSONify
# ---------------------------------------------------------------------------------------------------------------... | true |
a3384008e21bec2432cd7c1e6a54f7796592762b | Python | AlexandruSte/100Challenge | /Stefan Alexandru/Day7/problem.py | UTF-8 | 864 | 3.609375 | 4 | [] | no_license | # https://www.codewars.com/kata/human-readable-duration-format/train/python
def format_duration(seconds):
periods = {'year': 0, 'day': 0, 'hour': 0, 'minute': 0, 'second': 0}
values = 0
days = int(seconds / 86400)
seconds -= days * 86400
periods['year'] = int(days / 365)
periods['day'] = days % ... | true |
b2eb533c99d76dd973f1ea31565692e6c0e8a5b3 | Python | charlottea98/ai-lab | /HMM/HMM2.py | UTF-8 | 2,096 | 3.171875 | 3 | [] | no_license | def alfa_t(A, prev_alfa, b_t):
alfa_t = []
for i in range(len(b_t)):
obs = []
for j in range(len(A)):
obs.append([prev_alfa[j][0] * A[j][i] * b_t[i][0], [i, j]])
alfa_t.append(max(obs)) # den här är vektorn längst till höger
# för varje uträ... | true |
266690971035689bb8f5ed295d38188490bd88b9 | Python | purice93/Algorithm | /day0428/test.py | UTF-8 | 828 | 3.03125 | 3 | [] | no_license | """
@author: zoutai
@file: test.py
@time: 2018/05/01
@description:
"""
import numpy as np
# p1=[0.1,0.5]
# p2=[0.2,1.1]
p1 = [0.2, 0.5]
p2 = [0.2, 1.1]
ONE = 0.1
steps = int(max([abs(p2[0] - p1[0]), abs(p2[1] - p1[1])]) / ONE)
step1 = (max(p1[0], p2[0]) - min(p1[0], p2[0])) / steps
step1 = -step1 if p1[0] >= p2[0]... | true |
c2f636a139a79113e93562d9c848650a4c60c264 | Python | davidjohnoliver/IncomeForecast | /natural_rules.py | UTF-8 | 1,832 | 2.875 | 3 | [
"MIT"
] | permissive | """
Covers 'natural' update rules, rules that are set by law, economics and/or mathematics, as opposed to rules that articulate the assumptions of the forecasting model.
"""
import model
import tax
def apply_tax(deltas: model.deltas_state, previous_funds: model.funds_state, previous_deltas: model.deltas_state):
"... | true |
dd7b162e0c276677de0fb462b0bcf4bc10f1f08b | Python | 1411279054/Python-Learning | /Data-Structures&Althorithms/有意思的算法题/两数相加.py | UTF-8 | 1,386 | 4.25 | 4 | [] | no_license | # -*- coding: utf-8 -*-
# @Time : 2020/2/3 22:30
# @Author : LiChao
# @File : 两数相加.py
#题目:
# 给出两个 非空 的链表用来表示两个非负的整数。其中,它们各自的位数是按照 逆序 的方式存储的,并且它们的每个节点只能存储 一位 数字。
#
# 如果,我们将这两个数相加起来,则会返回一个新的链表来表示它们的和。
#
# 您可以假设除了数字 0 之外,这两个数都不会以 0 开头。
# 示例:
#
# 输入:(2 -> 4 -> 3) + (5 -> 6 -> 4)
# 输出:7 -> 0 -> 8
# 原因:342 + 465 = 807
clas... | true |
08b15e52a3edd2a785d962139b6fe6b2a3642748 | Python | Kitter/Attention_Based_LSTM_AspectBased_SA | /load_vector.py | UTF-8 | 765 | 2.84375 | 3 | [] | no_license | import pickle
import h5py
import pandas as pd
# a = pd.read_pickle('text_vector.pkl')
# b = pd.read_pickle('aspect_vector.pkl')
# print len(a), len(b)
# print b['food']
def get_word_vector_hdf5(hdf5_file, word):
if word in hdf5_file:
return hdf5_file[word]
else:
return hdf5_file['__UNK__']
... | true |
d0c53b1c25352b2141feccbcf2d89bb439592aeb | Python | ilyasnoskov/codereview | /noskovik/first/task1.py | UTF-8 | 155 | 3.609375 | 4 | [] | no_license | """
"""
my_list = str(input())
my_list = my_list.split()
print(my_list)
for element in my_list:
if type(element)==type(float):
print(element) | true |
612e47d612ab65d81956bc586a7c85ee594eb9c4 | Python | caa06d9c/Examples | /Python/services/cronjob/run.py | UTF-8 | 1,192 | 2.828125 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
from argparse import ArgumentParser
from asyncio import ensure_future, gather, run
from datetime import datetime, timedelta
from hashlib import sha512
from random import randint
from uuid import uuid4
async def calc(ct, et, sp):
et = datetime.utcnow() + timedelta(se... | true |
32ab8b5f81d6ca6d8e05d8b3e9da26134918f5e2 | Python | hn1201/regularization-code-along | /code.py | UTF-8 | 3,775 | 2.875 | 3 | [
"MIT"
] | permissive | # --------------
## Load the data
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from sklearn.linear_model import LinearRegression
from sklearn.model_selection import train_test_split, cross_val_score
from sklearn.metrics import r2_score
from sklearn.metrics import mean_squared_error, make_score... | true |
ae65551dd15f1683861bfc32afc035b2e4803f71 | Python | kmisimn76/TVM-study | /src/core/Relay/FunctorExamples.py | UTF-8 | 1,891 | 2.75 | 3 | [] | no_license | from core.Relay.RelayExpr import *
def print_indent(message, indent):
for i in range(indent):
print(" ", end='')
print(message)
class PrintFunctor(FunctorRelayExprNode):
def visit(self, node, extra):
indent = extra
if isinstance(node, IfRelayExprNode):
print_indent("IfNode", indent)
print_indent("-C... | true |
43aa2b379443025f9832a29f244d12d6b79a7d30 | Python | MrHuman22/SessionTracking | /TimeTable.py | UTF-8 | 1,932 | 2.9375 | 3 | [] | no_license | import PySimpleGUI as sg
from datetime import datetime, timedelta
from time import sleep
from playsound import playsound
import csv
"""
TODO: Set up progress bar
TODO: Work out how to have the program NOT sit there and wait. Threading?
TODO: Write the date timestamp and time timestamps in different columns
TODO: Have ... | true |
5f4676605af5c58f453abc9033112b58cb63614a | Python | standardgalactic/Ising-10 | /scripts/histograms.py | UTF-8 | 820 | 2.796875 | 3 | [] | no_license | import csv
import numpy as np
import matplotlib.mlab as mlab
import matplotlib.pyplot as plt
import sys
if __name__ == '__main__':
x = []
fn = sys.argv[1]
a = fn.split('=')[1]
c = fn.split('L')[1]
L = c.split('/')[0]
T = a.split('.dat')[0]
with open(fn) as csv_file:
line_count =... | true |
28c0a5dd8ce0a0aeeca95399cb0787185833ad0e | Python | lopegeor1/project-4-palindromes-lopegeor1 | /tests/test_palindrome.py | UTF-8 | 1,367 | 3.703125 | 4 | [] | no_license | # pylint: disable=missing-docstring
"""
The test module for Palindromes
"""
import pytest
from palindrome import is_palindrome
def test_invalid_input():
"""
Given incorrect type input , a ValueError should be raised.
"""
with pytest.raises(ValueError):
is_palindrome(12345)
def test_null_value... | true |
8be318ff992f98822f0689e2d89f2282dec0341d | Python | Aasthaengg/IBMdataset | /Python_codes/p02948/s499930954.py | UTF-8 | 367 | 3.046875 | 3 | [] | no_license | #137-d
import heapq as hp
n,m=[int(i) for i in input().split()]
lists=[[] for _ in range(m)]
for i in range(n):
a,b = [int(i) for i in input().split()]
if a<=m:
lists[a-1].append(b)
h = []
hp.heapify(h)
ans= 0
for i in range(m):
for v in lists[i]:
hp.heappush(h,-v)
if len(h)>... | true |
529f74cfe478ab5a6c31df37149fe6787a215f46 | Python | daftstar/learn_python | /01_MIT_Learning/week_2/lectures_and_examples/iterations_recursions_exercise.py | UTF-8 | 771 | 4.15625 | 4 | [] | no_license | # Iteration Example
def iterPower(base, exp):
'''
base: int or float.
exp: int >= 0
returns: int or float, base^exp
'''
# use successive multiplication instead of powers
# 3 ^ 4 = 3 * 3 * 3 * 3 = 81
value = 1
for i in range(1, exp + 1):
value *= base
return (value)
#... | true |
1dcbe76b876c53002203e41c078a007ac5982b86 | Python | rtfreedman/CardParse | /makecards.py | UTF-8 | 3,166 | 2.96875 | 3 | [] | no_license | import json
import os
from PIL import Image
from PIL import ImageFont
from PIL import ImageDraw
from multiprocessing import Pool
RED = '\033[0;31m'
GREEN = '\033[0;32m'
NC = '\033[0m'
with open('wizbolt.json', 'r') as f:
items = json.loads(f.read())['items']
have_name = all(['Name' in i for i in items])
have_cost... | true |
2e0b27d750c64da67e6cfce603f8dcbcf282a1d7 | Python | yj7082126/MachineLearningPractice | /ex3/python/ex3-1.py | UTF-8 | 2,721 | 2.921875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Mon Mar 19 18:35:32 2018
@author: yj7082126
"""
import os
import os.path as path
import numpy as np
import matplotlib.pyplot as plt
from scipy.io import loadmat
from math import sqrt
from scipy.optimize import minimize
os.chdir(path.dirname(path.dirname(path.abspath(__file__)))... | true |
e45a08f1a250597c6c3ccd543420baeeea83122a | Python | starlightme/toolbox | /list2query.py | UTF-8 | 299 | 2.515625 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
# -*- coding:utf-8 -*-
# mainly for sql query
filename = 'test.txt'
with open(filename,'r') as fp:
l = fp.readlines()
l = map( lambda s:s.strip(), l )
result = str(l).replace('[','(').replace(']',')')
print result
with open(filename,'a') as fp:
fp.write(result) | true |
d7d4add23a32fd6975c76fea4c71335c64d1dac8 | Python | padmanabh007/PYTHON | /Gpython/map.py | UTF-8 | 843 | 4.15625 | 4 | [] | no_license | #map is a handy funcion
def even_odd(n):
if n%2==0:
print('The number {} is even'.format(n))#return inside the funcion does not print any value
else:
print('The number {} is odd'.format(n))
#def main():
#n=int(input('Enter the number '))
#p=even_odd(n)
#print(p)
#if __name__=='__main_... | true |
9b105e9b1d37cbfe04cc00137bc59964bc97207f | Python | PatilRutuja2009/DBMS-ass-no-7 | /Ass 7.py | UTF-8 | 3,779 | 3.359375 | 3 | [] | no_license | ASSIGNMENT NO: 7
Problem statement: Write a PL/SQL Stored Procedure and Stored Function for different applications.
create table student(roll_no number,name varchar(20),class varchar(20),marks number);
Table created.
SQL> insert into student values(101,'jadhav saurabh','SE comp',1600);
1 row created.
SQL> ed
Wrote fil... | true |
4473b2e94e18567283dc0571a16d7fc1c4163f61 | Python | walkccc/LeetCode | /solutions/2469. Convert the Temperature/2469.py | UTF-8 | 129 | 2.75 | 3 | [
"MIT"
] | permissive | class Solution:
def convertTemperature(self, celsius: float) -> List[float]:
return [celsius + 273.15, celsius * 1.8 + 32]
| true |
8b4d3ea51f5dfc2bbabb2f391f3270ae5fb7b302 | Python | venuX1995/forSnaProject | /.idea/libraries/community_evolution.py | UTF-8 | 11,315 | 2.71875 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @File : community_evolution.py
# @Author: xuan
# @Date : 2019-03-08
# @Desc : All about evolution of community
import csv
import pandas as pd
from pandas import DataFrame,Series
import numpy as np
import matplotlib
import networkx as nx
import community
import communit... | true |
3501a2406ac9d1e304f494dce1ec353c6ddead2c | Python | CryptoCrane2601/CSCX | /exercise_8.py | UTF-8 | 223 | 3.53125 | 4 | [] | no_license | def plusOne(number):
return number + 1
userNum = int(input())
newNumber = plusOne(userNum)
if newNumber <= 0 and newNumber >= 100000:
print('Please use number between 0 and 100000')
else:
print(newNumber)
| true |
475d3966b1d2988a72b5a314dabb68d6f01796a5 | Python | LeeInHaeng/algorithm | /프로그래머스(Python3)/level2/탑.py | UTF-8 | 462 | 2.6875 | 3 | [] | no_license | def solution(heights):
answer = []
tmp = []
rlist = heights[::-1]
for x in range(0,len(rlist)):
for y in range(x+1,len(rlist)):
if rlist[x]<rlist[y]:
tmp.append(y)
break
if y==len(rlist)-1:
tmp.append(0)
tmp.append(0)
... | true |
2574700680469692cf8f193d3f8a1473d3aa2806 | Python | lwannaknow/TestPython | /python/testBool.py | UTF-8 | 171 | 2.6875 | 3 | [] | no_license | __author__ = 'jim'
import time
a = {'status': 'haha'}
if a != True:
print 1
a = 0
while a != 11:
time.sleep(1)
a += 1
print 1
else:
print "hahaha"
| true |
bfa9323ae80904504eed51bb2b79af3252a72466 | Python | BishopJustice/MultiPage | /app/models.py | UTF-8 | 2,096 | 2.546875 | 3 | [] | no_license | from app import db
from werkzeug import generate_password_hash, check_password_hash
class User(db.Model):
__tablename__ = 'users'
uid = db.Column(db.Integer, primary_key = True)
firstname = db.Column(db.String(100))
lastname = db.Column(db.String(100))
email = db.Column(db.String(120), unique=True... | true |
015cb182a00acebc3efce9eb97591d23818efad6 | Python | benmechen/CodeSet | /private_server/guard/CELL-28/Q-9/28-9.py | UTF-8 | 72 | 3.46875 | 3 | [] | no_license | #Set pigeon equal to 1 using modulo on line 3
pigeon = 1
print(pigeon) | true |
d0a22e423cde0cab69d5e18d3ad2eb8530c64df8 | Python | 0xRitesh/LHD-Learn | /Mail-Sorter/main.py | UTF-8 | 3,300 | 2.625 | 3 | [] | no_license | import socket
import argparse
import signal
import sys
import datetime
# Local imports
from logger import *
from config import Config
from server import Server
from sorter import Sorter
class Main():
def __init__(self):
signal.signal(signal.SIGINT, self.quit)
parser = argparse.ArgumentParser(d... | true |
efa792674be493bdbf30020bb42b15b09fc78185 | Python | kcough/foundations_2017 | /intro_basics/list_dictionaries/homework-1-cough.py | UTF-8 | 5,419 | 4.75 | 5 | [] | no_license | #kate cough
#may 22, 2017
#homework 1
#here we've created a new variable, "year_of_birth"
year_of_birth = input("What year were you born in? ")
#create a new variable, age. Remember you have to tell it that year_of_birth is an integer
if year_of_birth > "2017":
print("Oops! That looks like it's in the future. Let's... | true |
7c6a38b35c5554ecd7ef399e8fc8d588919ec853 | Python | jnbjarni/VLN | /VLN/main.py | UTF-8 | 1,040 | 2.859375 | 3 | [] | no_license | from ui.SalesmanUI import SalesmanUI
import time
def pixelArt():
art = open('pixelart.txt', 'r')
for line in art:
line = line[0:-1]
print(line)
time.sleep(0.050)
def assemblePassword():
H1 = chr(97)
H2 = chr(100)
H3 = chr(109)
H4 = chr(105)
H5 = chr(110)
thep... | true |
f4170700d247231aaaee19a562e4ab395c578492 | Python | q598998825/test | /src/othello/othello.py | UTF-8 | 1,702 | 3.921875 | 4 | [] | no_license | from board import Board
from player import HumanPlayer, AIPlayer
'''
作者:hhh5460
时间:2017年7月1日
'''
# 游戏
class Game(object):
def __init__(self):
self.board = Board()
self.current_player = None
# 生成两个玩家
def make_two_players(self):
player1 = AIPlayer('X', 2)
player2 = AIPlayer... | true |
e35934cbd4c3f809d0c661500afc3293c2448161 | Python | opensanctions/opensanctions | /zavod/zavod/tests/test_dataset.py | UTF-8 | 2,970 | 2.609375 | 3 | [
"MIT",
"CC-BY-NC-4.0"
] | permissive | import pytest
from zavod.meta import get_catalog, Dataset
from nomenklatura.exceptions import MetadataException
TEST_DATASET = {
"name": "test",
"title": "Test Dataset",
"hidden": True,
"prefix": "xx",
"data": {
"url": "https://example.com/data.csv",
"format": "csv",
},
}
TEST... | true |
c73e07a36f387cdfaf622f1d89e92faa6d2c285a | Python | applepieiris/Coursera-Deep-Learning-deeplearning.ai | /04-Convolutional Neural Networks/week2/KerasTutorial/keras_happy_house.py | UTF-8 | 2,506 | 2.6875 | 3 | [
"MIT"
] | permissive | import numpy as np
from keras import layers
from keras.layers import Input, Dense, Activation, ZeroPadding2D, BatchNormalization, Flatten, Conv2D
from keras.layers import AveragePooling2D, MaxPooling2D, Dropout, GlobalMaxPooling2D, GlobalAveragePooling2D
from keras.models import Model
from keras.preprocessing import im... | true |
af598cc798c2c28bc9ed851619bc1a0e15a2d87a | Python | Bishopbhaumik/python_test | /list_8.py | UTF-8 | 457 | 4.0625 | 4 | [] | no_license |
lst = []
# number of elemetns as input
n = int(input("Enter number of elements : "))
# iterating till the range
for i in range(0, n):
ele = int(input())
lst.append(ele) # adding the element
print(lst)
print("After sorting=====>\n")
lst.sort()
print(lst)
def ati(l):
... | true |
23f22e824941e97dd2b7c14c42e2d2fe57971941 | Python | WMDA/data_collection_for_reddit_project | /sentiment/nlp/nlp_preprocessing.py | UTF-8 | 5,951 | 3 | 3 | [
"MIT"
] | permissive | import spacy
from collections import Counter
from gensim.models.phrases import Phrases, Phraser
from sklearn.feature_extraction.text import TfidfVectorizer, CountVectorizer, TfidfTransformer
nlp = spacy.load("en_core_web_sm")
def tokenise(text_list):
"""
Remove symbols and tokenise strings
Parameters
... | true |
b8005fc78fda3afcbaeead7b091784c9ff39f0e1 | Python | artart222/aparat-dl | /main.py | UTF-8 | 2,823 | 3.078125 | 3 | [
"MIT"
] | permissive | # For web scrapping and downloading files
import requests
from bs4 import BeautifulSoup
import html5lib
import urllib.request
# For command line arguments
from sys import argv
# For user interface
from tqdm import tqdm
import inquirer
if argv[1] == "-p":
playlist = True
url = argv[2]
else:
playlist = Fa... | true |
fa58bf84913e43fc0ccdeb2dfeb6a2533946fae7 | Python | ybdesire/pylearn | /logging/show_error_only.py | UTF-8 | 478 | 2.671875 | 3 | [] | no_license | import logging
logging.basicConfig(level=logging.ERROR) # only show error
logger = logging.getLogger(__name__)
def main():
logger.info('Start reading database')
# read database here
records = {'john': 55, 'tom': 66}
logger.debug('Records: %s', records)
logger.info('Updating records ..... | true |
28aeed452f7118ef727d492c468404c98bc48b74 | Python | archaeastra/TeegardenTidal | /THeSP/THeSPv3.py | UTF-8 | 6,710 | 2.75 | 3 | [] | no_license | #The Tidal Heating Substraction Plot shows the net tidal heating due to a Cassini State.
#Thanks to Dr. David Fleming, whose code I based this script
#on for VPlanet compatibility.
import matplotlib as mpl
mpl.use('Agg')
import matplotlib.pyplot as plt
import numpy as np
import sys
import os
import re
import math
#I... | true |
508f9bac41892431c93d79f52b6d12ca3dcbff11 | Python | zerynth/core-zerynth-toolchain | /zdevicemanager/client/api/devices.py | UTF-8 | 5,285 | 2.75 | 3 | [] | no_license | class DeviceApiMixin(object):
def devices(self):
"""
Get all the devices
Returns:
(list of dicts): a list of dictionaries
Raises:
:py:class:`adm.errors.APIError`
If the server returns an error.
"""
u = self._url("/device/")
... | true |
10bc568db81f366360f81c7552f9749d1bac4c0e | Python | endremborza/teach-rajk-prog1-2019f | /members/anna/HW6.py | UTF-8 | 2,776 | 3.671875 | 4 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# Advent of code 2016/Day3
# Import the data
# In[87]:
with open('input2.txt') as fp:
file_contents = fp.read()
#print(file_contents) #A vegso fajlban ez a print inkabb zavaro, mint hasznos.
# From one "sentence" generate a list
# Ertekelem a kommenteket!
# In[88]:
#Eze... | true |
ec09cc204caf3b2064d5f5d5c21cd4fae8ac6503 | Python | Denimbeard/PycharmProjects | /Programs/Pile of Things/Algorithms/Insert Sort.py | UTF-8 | 1,479 | 3.265625 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# =============================================================================
#
# =============================================================================
__author__ = 'Chet Coenen'
__copyright__ = 'Copyright 2020'
__credits__ = ['Chet Coenen']
__license__ = '/LICE... | true |
ba16940d210d4b92c7ee71d0a3c4735079a0a9cb | Python | Shukla1101/Web-Page-Classification | /meta_features.py | UTF-8 | 2,459 | 2.796875 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Sep 30 20:32:59 2019
@author: rahulshukla
"""
import nltk
import pandas as pd
import numpy as np
import csv
from numpy import linalg as LA
# FEATURES OF META DESCRIPTION
meta_feature_list=[]
row_count_train=0
def token(rows):
tokenized=nltk.word... | true |
9bf81016413627939e6973c5dd1ec7f3f7025d47 | Python | erickmiller/AutomatousSourceCode | /AutonomousSourceCode/data/raw/squareroot/17336315-a152-4ffc-9fb1-88de0de43115__GUI.py | UTF-8 | 3,287 | 2.59375 | 3 | [] | no_license | from Tkinter import *
from Game import Game
from SettingsGUI import SettingsGUI
class GUI(object):
def __init__ (self, settings, game):
self.settings = settings
self.game = game
self.game.addListener(self)
self.root = Tk()
self.root.withdraw()
self.window = Toplevel(self.root)
self.cause ... | true |
31aae8e4722cb590a7a5081fa6a84ce3c6f8ae76 | Python | sibimathews3010/S1-python-programs | /51n.py | UTF-8 | 864 | 3.59375 | 4 | [] | no_license |
rang=int(input("enter the number of books to be added"))
dict={}
for i in range(0,rang):
name=input("enter the name of book :")
auth=input("enter the name of author :")
dict[(name,auth)]=int(input("enter the no. of copies :"))
print(dict)
con=input("Do you want to add more of the present book? (y/n)")
if con=="y":... | true |
dababac7263cbf60ebbc3dca31b0a328f2febed8 | Python | kazuma104/AtCoder | /10sen/Q5.py | UTF-8 | 338 | 3.34375 | 3 | [] | no_license | N, A, B = map(int, input().split())
sum = 0
for i in range(1,N+1):
n = i
dsum = 0 #digit sum (桁の和)
while True:
dsum += (n % 10)
if n // 10 == 0: break
else:
n //= 10
continue
if (A <= dsum) and (dsum <= B):
sum += i
pr... | true |
e859caea013c6df8d16e3498095a0e310650e3f5 | Python | xodud001/coding-test-study | /peacecheejecake/two_pointer/11728_배열합치기.py | UTF-8 | 490 | 3.234375 | 3 | [] | no_license | # https://www.acmicpc.net/problem/11728
# 배열 합치기
# 185644 KB / 2788 ms
def readline():
return tuple(map(int, input().split()))
n, m = readline()
a = readline()
b = readline()
i, j = 0, 0
while i + j < n + m:
if i == n:
print(' '.join(map(str, b[j:])))
break
if j == m:
print(' '.j... | true |
4fa8dc78b532890c1944c46142f7421e6e8acf12 | Python | whiteice-c/Python | /BaseLearning/进程/封装进程对象/封装进程对象.py | UTF-8 | 341 | 2.515625 | 3 | [] | no_license | #!/usr/bin/env python
# encoding: utf-8
'''
@author: baibing
@contact: 243061887(qq)
@software: pycharm
@file: 封装进程对象.py
@time: 7/3/19 7:48 PM
@desc:
'''
from myProcessObj import myProcess
if __name__=="__main__":
print("父进程启动")
p = myProcess("test")
p.start()
p.join()
print("父进程结束") | true |
d4ea4fb10ba21d8ea2610f8e9a973b4fbe5c3b27 | Python | wielandbrendel/foolbox-native | /foolbox/ext/native/models/pytorch.py | UTF-8 | 3,000 | 2.625 | 3 | [] | no_license | import torch
import warnings
from .base import Model
from ..devutils import unwrap
class PyTorchModel(Model):
def __init__(self, model, bounds, device=None, preprocessing=None):
self._bounds = bounds
if device is None:
self.device = torch.device("cuda:0" if torch.cuda.is_available() e... | true |
68828340760c7f4a3965ec48585cc811ca866593 | Python | TanninOne/modorganizer-umbrella | /unibuild/manager.py | UTF-8 | 2,343 | 2.578125 | 3 | [] | no_license | # Copyright (C) 2015 Sebastian Herbord. All rights reserved.
#
# This file is part of Mod Organizer.
#
# Mod Organizer is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at ... | true |
78ad01575bf81871ce9d01bde1a8431e49fb09d0 | Python | bopopescu/pinalpha_mvp | /ThemeAnalysis/newsToKeyWords.py | UTF-8 | 3,491 | 3.015625 | 3 | [] | no_license | import DBConn.mysqlCon as mysqlcon
import DBConn.mongoCon as mc
import NLPAnalysis.simpleParsing as sp
import datetime
def get_keyWords():
wordList = ["trade war","trade tension","china","singapore","malaysia","indonesia","thailand","taiwan","india",
"philippines","vietnam","dubai","uae","south eas... | true |
301a721555f9249afd43649576c2ae347bb5314d | Python | liuzhipeng17/python-common | /python基础/协程/产生协程方式/实现协程方式_greenlet.py | UTF-8 | 463 | 3.203125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
from greenlet import greenlet
import time
def A():
while 1:
print('-------A-------')
time.sleep(0.5)
g2.switch()# 跳转协程g2
def B():
for _ in range(3):
print('-------B-------')
time.sleep(0.5)
g1.switch()# 跳转协程g1
g1 = greenlet(A) #创建协程g1
g... | true |
12997844c679e4f112b25751d7aff37abd821e96 | Python | AlberchtCa/LowRoller | /Classes.py | UTF-8 | 736 | 2.65625 | 3 | [] | no_license | class Player:
def __init__(self):
self.cards = []
self.button = False
self.blinds = 0
self.hasAction = False
self.AI = False
@property
def isAI(self):
if self.AI:
return True
else:
return False
@property
def isButton(s... | true |
520df3fa9cac873e3f157a076212a3c74b729cee | Python | mwsmith2/dissertation | /scripts/make_historical_plot.py | UTF-8 | 2,321 | 2.90625 | 3 | [] | no_license | #!/bin/python
import sys
import json
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
import seaborn as sns
def main():
mpl.rcParams['figure.figsize'] = (9, 4)
mpl.rcParams['figure.dpi'] = 220
mpl.rcParams['lines.linewidth'] = 1.0
mpl.rcParams['lines.markersize'] = 2.0
... | true |
ea3ad9b96ae1e20d9f71866905d435aa27addb49 | Python | ingoglia/python_work | /part1/4.2.py | UTF-8 | 165 | 4.03125 | 4 | [] | no_license | animals = ['cat', 'dog', 'bird']
for animal in animals:
print("A " +animal + " is a domesticated animal.")
print("They are all great... but cats are the best.")
| true |
4709d1fb480f0aa7132dc3153e9ac7ab7aebf2a3 | Python | ibrahimYldzz/Home-Credit-Prediction | /home_credit_with_lgbm.py | UTF-8 | 27,962 | 2.984375 | 3 | [] | no_license | # HOME CREDIT DEFAULT RISK COMPETITION
# Most features are created by applying min, max, mean, sum and var functions to grouped tables.
# Little feature selection is done and overfitting might be a problem since many features are related.
# The following key ideas were used:
# - Divide or subtract important features t... | true |
004d4b3c6f4988cdb11a9b4764881df36dea58de | Python | xarchived/hackerrank | /problem_solving/warmup/01-solve-me-first.py | UTF-8 | 214 | 3.03125 | 3 | [
"Apache-2.0"
] | permissive | #!/bin/python3
def solve_me_first(a, b):
return a + b
def main():
num1 = int(input())
num2 = int(input())
res = solve_me_first(num1, num2)
print(res)
if __name__ == '__main__':
main()
| true |
181da2e4844e9e2841bf5c8ff4784c436fe1a50a | Python | darshan72247/100-Days-Of-Python | /Day-2/Exerecise/challenge/day-2-1-exercise/main.py | UTF-8 | 450 | 4.1875 | 4 | [] | no_license | # 🚨 Don't change the code below 👇
two_digit_number = input("Type a two digit number: ")
# 🚨 Don't change the code above 👆
####################################
#Write your code below this line 👇
# The below code will output str as we are taking an input from the user using input() method
type(two_digit_number)
fi... | true |
3f50035445da21e34f89f40789b69f94bb380d5b | Python | Jinook-Kim/python-cyntax | /module_center.py | UTF-8 | 526 | 3.1875 | 3 | [] | no_license | '''import theater_module
theater_module.price(3) # 3명이서 영화 보러 갔을 때 가격
theater_module.price_morning(4)
theater_module.price_soldier(5)'''
'''import theater_module as mv
mv.price(3)
mv.price_morning(4)
mv.price_soldier(5)'''
'''from theater_module import *
price(3)
price_morning(4)
price_soldier(5)'''
'''from theater_... | true |
c9c20021492a8530de6ea66f9291292e64539643 | Python | lee-won-suk/algo | /탐색/2606 바이러스.py | UTF-8 | 526 | 3.09375 | 3 | [] | no_license | #컴퓨터 수 :C
C=int(input())
#연결된 쌍
N=int(input())
com=[ [] for _ in range(C+1) ]
for i in range(N):
key,value=map(int,input().split())
com[key].append(value)
com[value].append(key)
def bfs(start):
need_visit=[start]
visited=[]
while need_visit:
node=need_visit.pop(0)
... | true |
b64aef63714f423bfad10b2896598f79d4db4492 | Python | pppk520/miscellaneous | /ib/solve.py | UTF-8 | 471 | 3.5625 | 4 | [] | no_license | class Solution:
# @param A : list of integers
# @return an integer
def solve(self, A):
A = sorted(A)[::-1]
n = len(A)
for i in range(n):
if i > 0 and A[i] == A[i - 1]:
continue
if A[i] == i:
return 1
return -1
pr... | true |
2ea6d6b19994c27b01eab63eade7c1ed22c8df19 | Python | peanutyumyum/Python-study | /Python/1._자료형/3._여러가지_내장함수.py | UTF-8 | 4,944 | 4.5 | 4 | [] | no_license | # Python에 있는 여러가지 내장함수가 있다.
# 자료를 출력해주는 함수 print
print("지원") # "지원"을 출력한다
# 추가적으로 print에 end= 를 사용함으로서 출력되는 것들 사이에 추가적으로 출력되는 것을 지정할 수 있다
print("지원","안녕", end=" ")
# 데이터를 입력해주는 함수 input
a = input("데이터를 입력하세요")
print(a) # input함수를 통해 입력받은 자료는 항상 string이다.
# 문자열의 길이를 세어주는 함수 len
a = "apple"
print(len(a)) # "apple"의 문자... | true |
e031e5745edb3ea0a8293a96ddc40688e3cd5575 | Python | tmiltonj/qyrto | /board.py | UTF-8 | 4,217 | 3.875 | 4 | [] | no_license | from collections import namedtuple
from enum import Enum
Point = namedtuple('Point', ['x', 'y'])
Result = namedtuple('Result', ['win', 'dir', 'n'])
class Board:
"""
Represents the game board, contains helper methods to add/remove pieces
and check if the board is in a winning state
"""
class DIR(E... | true |
018dd208ad49e8fb0452a991ec31202dd02a7749 | Python | peircej/gphotos-sync | /gphotos/DatabaseMedia.py | UTF-8 | 5,787 | 2.890625 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python2
# coding: utf8
import os.path
from datetime import datetime
from GoogleMedia import GoogleMedia, MediaType, MediaFolder
from LocalData import LocalData
class DatabaseMedia(GoogleMedia):
"""A Class for instantiating a GoogleMedia object from the database
The standard GoogleMedia attrib... | true |
89b683dbd3e4d3f773b5ed15bcdb89ac3153c1af | Python | antimike/citation-scraper | /scraper/apis/wikitextparser.py | UTF-8 | 412 | 2.671875 | 3 | [
"MIT"
] | permissive | import wikitextparser as wikiparse
import sys, os
sys.path.append("{}/regex-dict".format(os.environ["REGEX_DICT_ROOT"]))
import RegexDict
def get_wiki_sections(page):
"""get_wiki_sections.
Parses a WikiText page into sections.
:param page: Page object to parse
"""
return RegexDict(
{t.lowe... | true |
00c29370644ee4c79a004af590732814ecf9acad | Python | thisalmadu/Python-Training-HR- | /Dictionaly_items.py | UTF-8 | 440 | 3.1875 | 3 | [] | no_license | # with user input
n = int(input())
student_marks = {}
if (n >= 2) and (n<=10) is True:
for i in range(n):
line = raw_input().split()
name, scores = line[0], line[1:]
scores = map(float,scores)
student_marks[name] = scores
query_name = raw_input()
#print(list(student_marks[que... | true |
67fee6b93e470289f611cce8b4e4f16fe5946a37 | Python | Rico-HBChen/pythn-web-design-learning | /1.2.9集合作业.py | UTF-8 | 1,066 | 3.78125 | 4 | [] | no_license | #coding:utf-8
'''
判断自己技术是否在技术栈范围内。
技术栈:skills = {'Python','R','SQL','Git',
'Tableau','SAS'}
自己技术:mySkills = {'Python','R'}
实现思路:最简单的是直接用集合关系运算,但是考虑
到实际项目中可能存在大小写问题,所以先将其转化为列表
然后转化为字符串,然后将其统一小写,转化为列表、列表
再转化为集合,使用集合的isuperset方法判断。
'''
skills = {'Python','R','SQL','Git','Tableau','SAS'}
mySkills = {'python','R'}
#如下部分为避免因... | true |
707969308a9c3fefd05793c12e009ebdd6e7ac8e | Python | qvv5013/entanglement_analysis | /ent_calculation.py | UTF-8 | 7,276 | 2.921875 | 3 | [] | no_license | """
Notes on code:
well, when I wrote this function, only God and I know what it does (April 2021).
Now- Aug 2021- only God knows. God dammit ...
The length of loop and open segment >=10 (i1-i2 and j1-j2>=10)
I don't know why authors used this criteria but just use this.
"""
import MDAnalysis as mda
import argparse
im... | true |
0d97ee714bdd70612c876eb6625724aa650e5cf2 | Python | my-favorite-repositories/djanban | /src/djanban/apps/base/auth.py | UTF-8 | 2,814 | 2.546875 | 3 | [
"MIT"
] | permissive |
from django.conf import settings
from django.http import Http404
from djanban.apps.boards.models import Board
def member_is_administrator(member):
"""
Check if the member is an administrator of this platform.
Parameters
----------
member: member.Member to be checked.
Returns
-------
... | true |
00a8470e7b1fea91f4da4520b2f4145cbe251424 | Python | VarshaRadder/APS-2020 | /Code library/98.Split Array With Same Average.py | UTF-8 | 656 | 2.84375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Tue Apr 28 12:04:17 2020
@author: Varsha
"""
def splitArraySameAverage(A):
A.sort()
DP=[set() for _ in range(len(A)//2+1)]
for item in A:
for count in range(len(DP)-2,-1,-1):
if len(DP[c... | true |
3c52ec153a7d5b006d4ea9c3a64f664089222f81 | Python | m1c0l/restless | /backend/sample_post_test.py | UTF-8 | 696 | 2.546875 | 3 | [] | no_license | import urllib,urllib2, requests
def test1():
url='http://159.203.243.194/api/update/user/1'
values = {'first_name' : 'Roll'}
data = urllib.urlencode(values)
req = urllib2.Request(url,data)
print urllib2.urlopen(req).read()
def test2():
url='http://159.203.243.194/api/new_user/'
values = {
... | true |
d75674fb98b96cd97c1f944cbe8bcc2ff69f4da9 | Python | SmartEmbeddedElectronics/Labo_Git | /catkin_ws/src/controller/scripts/controller.py | UTF-8 | 3,357 | 2.625 | 3 | [] | no_license | #!/usr/bin/env python
# license removed for brevity
import rospy
from std_msgs.msg import String
move_pub = rospy.Publisher('movement', String, queue_size=10)
sound_pub = rospy.Publisher('sound', String, queue_size=10)
stop_pub = rospy.Publisher('stop', String, queue_size=10)
var_move = 0 #Debug var
#List to rememb... | true |
96e2374af6a2466c521554d76d7e4ea1ce3b4b5d | Python | emilyboynton/WebScrapingTasks | /ex61.py | UTF-8 | 555 | 3.1875 | 3 | [] | no_license | """Find and print the number of miles traveled by the current U.S. Secretary of State"""
from urllib import urlopen
from bs4 import BeautifulSoup
import re
html = urlopen("http://www.state.gov/secretary/travel/index.htm")
bsObj = BeautifulSoup(html, "html.parser")
section = bsObj.find("div", {"class": "bottom"})
sect... | true |
1db4672bd9ae924bda8b7d5556b9fff7e56992e5 | Python | DK-06/SHSN | /admindatabase.py | UTF-8 | 533 | 2.609375 | 3 | [] | no_license | import sqlite3
class admin():
con = sqlite3.connect('database.db')
#con.execute("create table admindatabase(username text,password text)")
print("table created")
con.execute("insert into admindatabase values('deepak','ji')")
print('insert successfully')
cursor = con.execute('select * ... | true |
53865142f290d540db6769d75cec85982b6c52b1 | Python | hrrf/poolhostPicks | /poolhost.py | UTF-8 | 1,607 | 2.671875 | 3 | [] | no_license | import sys, getopt, requests
POOLHOST_LOGIN_URI = 'https://poolhost.com/login'
POOLHOST_HAM_SELECT = 'https://poolhost.com/home/poolselect/41149/0'
POOLHOST_ALLPICKS_URI = 'https://poolhost.com/profootball/exportallpicks/5'
def get_args(argv):
usage = 'poolhost.py -u username -p password'
username, password ... | true |
e1fe0e9c9134cfeb25a4c6c24dd8de07a932c527 | Python | darkbarker/pybarker | /pybarker/utils/time.py | UTF-8 | 1,237 | 3.34375 | 3 | [
"MIT"
] | permissive | import calendar
from datetime import date
# сколько прошло времени в секундах от first до second, может отрицательно, т.е. second-first
def datetime_delta(first, second):
if not first or not second:
return 9223372036854775807
return int((second - first).total_seconds())
# прибавление к указанной да... | true |
14a065dbbcbb1c2335ef2a31847940d5b74d2ec4 | Python | eiofmv/data_structures_and_algorithms | /1. Algorithmic toolbox/week4_divide_and_conquer/2_majority_element/majority_element.py | UTF-8 | 729 | 3.59375 | 4 | [] | no_license | # Uses python3
def get_majority_element(a, left, right):
if left == right:
return a[left]
mid = (left + right) // 2
m1 = get_majority_element(a, left, mid)
m2 = get_majority_element(a, mid + 1, right)
count1 = 0
count2 = 0
for i in range(left, right + 1):
if a[i] == m1:
... | true |
c39c07bec1077c8b25ff45394fc021cb33f0ebce | Python | rddesmit/expeditie3_weekopdracht1 | /test_markov.py | UTF-8 | 3,005 | 2.8125 | 3 | [] | no_license | from markov import Markov
from orientation import Orientation
from colors import Colors
import time
import unittest
class TestMarkov(unittest.TestCase):
def test_normalize(self):
map = [[1, 2, 3]]
markov = Markov(map, Orientation.EAST, "test_normalize", 1, 0, 0)
markov.normalize()
... | true |
a973a56390273122f2eeb9f15d67759d5c1dd884 | Python | RobinKongNingLo/LeetCode | /#22GenerateParenthness.py | UTF-8 | 682 | 3.671875 | 4 | [] | no_license | class Solution:
def generateParenthesis(self, n: int) -> List[str]:
res = []
self.helper(res, n, n)
return res
def helper(self, res, left, right, current = ''):
#Goal
if left == 0 and right == 0:
res.append(current)
#When number of rest left brack... | true |
17c4683a5b75866f4852813762745881b2e1c3b7 | Python | eunsu621/JungOl | /array/python/Array557.py | UTF-8 | 327 | 3.53125 | 4 | [] | no_license | ```
557
10개의 문자를 입력받아서 첫 번째 네 번째 일곱 번째 입력받은 문자를 차례로 출력하는 프로그램을 작성하시오.
```
strList = list(map(str, input().split()))
count = 1
for i in strList:
if count == 1 or count == 4 or count == 7:
print(i)
count += 1
| true |
4159fe3733133c6030a53cdea25d37f5d529dc00 | Python | AsuPaul19/virtualMemoryManager | /ecchecker.py | UTF-8 | 489 | 3.34375 | 3 | [
"MIT"
] | permissive | import sys
if len(sys.argv) != 2:
print('Invalid Arguments')
o = []
correct = []
with open('o','r') as fn:
for l in fn:
item = l.strip().split()
o.append((item[2],item[7]))
with open('correct.txt','r') as fnco:
for l in fnco:
item = l.strip().split()
correct.... | true |
ab2ff7b0947286ac04c2476f7a8812a413284919 | Python | he44/Practice | /leetcode/2020_08_challenge/0819_goat_latin.py | UTF-8 | 738 | 3.859375 | 4 | [] | no_license | from typing import *
class Solution:
def toGoatLatin(self, S: str) -> str:
vowels = set(['a','e','i','o','u'])
words = S.split()
ans = []
for wi in range(len(words)):
word = words[wi]
start = word[0]
# consonant remove and append
if st... | true |
2c89c741b3060c4a2ed0b03bda673059f2fa301b | Python | reksHu/chatterbotDemo | /defaultResponse.py | UTF-8 | 776 | 2.5625 | 3 | [] | no_license | from chatterbot import ChatBot
chatbot = ChatBot(
'myBot',
storage_adapter = "chatterbot.storage.SQLStorageAdapter",
trainer= 'chatterbot.trainers.ChatterBotCorpusTrainer',
database="./greeting.db",
read_only=True,
logic_adapters=[
{
"import_path": "chatterbot.logic.BestMatc... | true |
5830c6a7ba0ef634c0a84e6307f5fbae2b524fd3 | Python | sn1ch/databases | /databases/work_with_database/phones/views.py | UTF-8 | 1,546 | 2.53125 | 3 | [] | no_license | from django.shortcuts import render
from .models import Phone
def show_catalog(request):
template = 'catalog.html'
land = request.GET.get('sort')
items = []
print(land)
if land == 'min_price':
for phone in Phone.objects.order_by('price'):
item = {
'name': phone.... | true |
c5cc18bc9a62c826a3bb8ebed96574131a01055a | Python | silnrsi/palaso-python | /scripts/kmn/kmn2klc.py | UTF-8 | 5,185 | 2.609375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
'''
Generate a Microsoft Keyboard Layout Creator file from a keyman keyboard.
This program will also handle deadkeys in the KMN file.
'''
__version__ = '0.9'
__date__ = '15 October 2009'
__author__ = 'Martin Hosken <martin_hosken@sil.org>'
import optparse, os.path, re, sys
from palaso.kmfl i... | true |
f5ac8aaee7d391d73a928ae0756849473e8dbf53 | Python | heexid/Bandung-Weather-News_PublisherSubscriber | /sub_2.py | UTF-8 | 636 | 2.609375 | 3 | [] | no_license | from paho.mqtt import client as mqtt
from time import sleep
TOPIK = 'Bandung_Weather_News'
received_messages= []
def on_message(client, user_data, msg):
#simpan message dan convert dalam variable int
received_messages.append(int(msg.payload.decode('utf-8')))
#tampilkan suhu rata-rata yang didapat
pri... | true |
e99f96aeecefe6f46aee4b8f4f901eec68d7aaeb | Python | neylsoncrepalde/selenium_projects | /raspa_siconv.py | UTF-8 | 2,887 | 2.65625 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Raspando o SICONV
@author: Neylson
"""
import requests
import time
from selenium import webdriver
url = 'https://transfere.convenios.gov.br/habilitacao/api/entidade?uf=MG&categoria=o&aa=04.2&total&_=1502809681676'
headers = {"Host":"transfere.convenios.gov.br",
... | true |
167620c5486a7b87670638b4ace9aa7cbc8d92e1 | Python | Sovellusohjelmointi-projekti/Sovellusohjelmointi_ryhma1 | /models/app.py | UTF-8 | 2,296 | 2.6875 | 3 | [] | no_license | from flask import Flask, jsonify, request
from http import HTTPStatus
app = Flask(__name__)
rooms = [
{
"id": "1",
"name": "Alpha",
"description": "Auditorium",
"date": "",
"month": "",
"start_time": "",
"duration": ""
},
{
... | true |
450741c5148d764b854b7f9326481d5f849fd3bd | Python | kimmincheol-kor/Quiz_Algorithm | /[This_is_Coding_Test]-Quiz/2.Implementation/9.py | UTF-8 | 1,691 | 3.265625 | 3 | [] | no_license | def solution(s):
# Get Input
inp = s
length = len(inp) # length of Origin
max_compress = 0 # answer
# < Operation Loop >
# => All Unit
for unit in range(1, length//2+1): # 5 => 1,2 | 10 => 1,2,3,4,5
point = 0 # Start Point of Base SubString
total_compress = 0 # Cou... | true |
70afc42b8fbf1becf7fb6a84b16c83df64e7d62e | Python | MWTA/Natural-Language-Processing-Python | /examples/corpus-childes/example-1.py | UTF-8 | 1,962 | 2.625 | 3 | [
"MIT"
] | permissive | import os
import nltk
import numpy as np
import pandas as pd
## comment if you don't have the pretty package
#from pretty import pprint
from nltk.corpus.reader import CHILDESCorpusReader
def main():
nltk_download_dir = '/home/rodriguesfas/nltk_data'
brown_corpus_root = os.path.join(nltk_download_dir, 'corpo... | true |