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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
bc270e1050e204dc886320076de32ba8bd107d6d | Python | hansbjerkevoll/bots-and-gender-profiling | /read_xml.py | UTF-8 | 2,354 | 3.046875 | 3 | [] | no_license | from xml.dom import minidom
import string
import re
from nltk.corpus import stopwords
from nltk.tokenize import TweetTokenizer
import json
stopwords_english = stopwords.words("english")
def clean_tweet(tweet):
tweet = tweet.lower()
# remove stock market tickers like $GE
tweet = re.sub(r'\$\w*', '', tweet)
# ... | true |
866e211ca4acd68bcd6d884d4f8e71bd4e68d7b6 | Python | evarobot/eva | /tests/data/projects/sys/entity/date.py | UTF-8 | 87 | 2.734375 | 3 | [] | no_license | def detect(text: str):
if "今天" in text:
return "今天"
return None | true |
d61666242c7618de973b3f7e220ec7c053c9a3f5 | Python | pranavpatil004/sentiment_analisys | /PycharmProjects/untitled/p.10_wordnet.py | UTF-8 | 846 | 2.796875 | 3 | [] | no_license | from nltk.corpus import wordnet
syns = wordnet.synsets("program")
print(syns)
print(syns[0].lemmas())
print(syns[0].definition())
print(syns[0].examples())
synonims = []
antonyms = []
for syn in wordnet.synsets("good"):
print("syn: ", syn)
for l in syn.lemmas():
print("l:",l)
synonims.ap... | true |
bcc1df1e469c484c99b0fe9e8e6144a9c19b1af6 | Python | suzoosuagr/cis735_final_project | /Tools/utils.py | UTF-8 | 4,234 | 2.796875 | 3 | [] | no_license | import os
import time
from PIL import Image
def pil_loader(path):
with open(path, 'rb') as f:
img = Image.open(f)
return img.convert('RGB')
def get_files(folder, name_filter=None, extension_filter=None):
if not os.path.isdir(folder):
raise RuntimeError("\"{0}\" is not a folder.".format... | true |
6def4d92c46e5abc5a48d2c651f67cd60f88fbea | Python | girish8050517990/RIDDLE | /tests/riddle/models/test_model_utils.py | UTF-8 | 1,173 | 2.75 | 3 | [
"Apache-2.0"
] | permissive | """
test_model_utils.py
Unit test(s) for the `model_utils.py` module.
Requires: pytest, NumPy, RIDDLE (and their dependencies)
Author: Ji-Sung Kim, Rzhetsky Lab
Copyright: 2016, all rights reserved
"""
import pytest
import sys; sys.dont_write_bytecode = True
import os
from math import fabs
from itertools im... | true |
2496e3ffd199ff3ad27cd3d01cc6db671bfe5d16 | Python | GovinV/Projet-IHM | /reseau/player.py | UTF-8 | 562 | 2.640625 | 3 | [] | no_license | #!/usr/bin/python3
# -*-coding:Utf-8 -*
import socket, pdb
import uuid
class Player:
def __init__(self, socket, name = "new", status = "inlobby"):
socket.setblocking(0)
self.socket = socket # socket associate to the player
self.name = name # name player
self.id = str(uuid.uuid4()) ... | true |
a802fc607315c9bd8cff5734d3de038ea6fd0c49 | Python | Eric2Hamel/Neuraxle | /neuraxle/hyperparams/space.py | UTF-8 | 9,590 | 3.1875 | 3 | [
"Apache-2.0",
"GPL-1.0-or-later"
] | permissive | """
Hyperparameter Dictionary Conversions
=====================================
Ways to convert from a nested dictionary of hyperparameters to a flat dictionary, and vice versa.
Here is a nested dictionary:
.. code-block:: python
{
"b": {
"a": {
"learning_rate": 7
... | true |
2f7fb020d2a47f6ba144cedcb017d357d1db2609 | Python | OmkarMokashi/BE_Project | /License_Validation/crypto.py | UTF-8 | 1,253 | 2.921875 | 3 | [
"MIT"
] | permissive | import ast
from Crypto.PublicKey import RSA
'''
random_generator = Random.new().read
private_key = RSA.generate(1024, random_generator) # generate pub and priv key
public_key = private_key.publickey() # pub key export for exchange
privkey = private_key.exportKey(format='DER')
pubkey = public_key.exportKey(format... | true |
33482cce69d9b423a376e58eeb03cb2c97487c5d | Python | dharm-harley/ML | /ML for Algo trading/09_Adding_more_stocks.py | UTF-8 | 1,234 | 3.421875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Wed Apr 10 19:08:13 2019
@author: M0078529
"""
import pandas as pd
def test_run():
start_date='2010-01-22'
end_date='2010-01-26'
dates=pd.date_range(start_date,end_date)
print(dates) #printing entire range of elements
print(dates[0]) #print... | true |
cc25e15896c5020a289d698c675a0bcc7d12ede5 | Python | JohanSmet/lsim | /src/bench/bench_utils.py | UTF-8 | 1,244 | 3.15625 | 3 | [
"BSD-3-Clause",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | #!/usr/bin/env python3
count_check = 0
count_failure = 0
def CHECK(was, expected, op_str):
global count_check, count_failure
count_check = count_check + 1
if was != expected:
count_failure = count_failure + 1
print("FAILURE: {} = {} (expected {})".format(op_str, was, expected))
def print_... | true |
f2b9afb5781c810624a52d6c126813c9a3337de4 | Python | eljose/HB-Exercise-2 | /testing.py | UTF-8 | 2,086 | 4.03125 | 4 | [] | no_license | #import all functions from arithmetic file
from arithmetic import *
operators = ["+", "-", "/", "*", "pow", "square", "cube", "mod"]
opDictionary = {
"+" : add ,
"-" : subtract,
"/" : divide,
"*" : multiply,
"pow": power,
"square": square,
"cube": cube,
"mod": mod
}
while T... | true |
22f09d5531f32c93be25d1a377cc4685e55f1d2c | Python | mayahight/project-1 | /app/tutorial3.py | UTF-8 | 1,230 | 2.609375 | 3 | [] | no_license |
import tweepy
import pronouncing
from authorization_tokens import *
import random
auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_token, access_token_secret)
api = tweepy.API(auth)
message = ""
# #Option5: basic search
#
# search_results = api.search(q="Abbott", lang="en",... | true |
dc60c71633ec84bf75bf067e87f4d35af1c65f68 | Python | olinyavod/pyftp | /pyftp.py | UTF-8 | 4,665 | 3.15625 | 3 | [] | no_license | #!/usr/bin/python
import sys
import os
from enum import Enum
from ftplib import FTP
from getpass import getpass
host = str()
class ArgumentKeys(Enum):
HOST = 0
PORT = 1
USER = 2
PASSWORD = 3
TRANSFER_FILE = 4,
CWD = 5
def print_usage() -> None:
print('Usage ftp [options] host.')
pri... | true |
90a221e6f2f878da363535e6d3d5552fd166606d | Python | ghaoziang/demo_for_proposal | /panoptes_schedulerDEMO/unit.py | UTF-8 | 1,235 | 2.796875 | 3 | [] | no_license | import yaml
class Unit:
def __init__(self, unit_id, field_file, field_list=None, last_field=None):
self._unit_id = unit_id
self._field_file = field_file
self._field_list = field_list
self._last_field = last_field
self._current_field = dict()
self.read_field_file()
... | true |
f4da9a4f5afdd6f797430ebdc53c4aad17a472d5 | Python | astwyg/vc_tools | /src/invoice_helper.py | UTF-8 | 7,077 | 2.84375 | 3 | [] | no_license | import datetime
from docxtpl import DocxTemplate
def digital_to_chinese(digital):
str_digital = str(digital)
if str_digital.endswith(".0") or str_digital.endswith(".00"):
str_digital = str_digital.split(".")[0]
chinese = {'1': '壹', '2': '贰', '3': '叁', '4': '肆', '5': '伍', '6': '陆', '7': '柒', '8': '... | true |
25423b91b29655d183835528f115a366c7924d46 | Python | eladsegal/allennlp | /allennlp/modules/span_extractors/self_attentive_span_extractor.py | UTF-8 | 3,293 | 2.859375 | 3 | [
"Apache-2.0"
] | permissive | import torch
from overrides import overrides
from allennlp.modules.span_extractors.span_extractor import SpanExtractor
from allennlp.modules.time_distributed import TimeDistributed
from allennlp.nn import util
@SpanExtractor.register("self_attentive")
class SelfAttentiveSpanExtractor(SpanExtractor):
"""
Comp... | true |
b14cd8692ebf51c8578c72e881730dd89697d291 | Python | ChrisKuang1/python_study | /algorithm/hw_stack.py | UTF-8 | 1,490 | 4.15625 | 4 | [] | no_license | #单身狗配对
""" 1. 所有参加活动的人都只排成一列,来参加活动的女生只会和排在队伍最后的男生配对。
2. 如果女生来到现场没有可以配对的男生则活动失败。
3. 如果最后有没有被领走的男生则活动也失败。 """
""" queue = input()
stack = []
result = True
for p in queue:
if p == 'm':
stack.append(p)
else:
if len(stack) == 0:
result = False
break
else:
s... | true |
074e6538b00d5397b14cd32f0bf1cb518a9d1fe6 | Python | dudung/soal | /src/0/26/plot-ml-linreg.py | UTF-8 | 2,868 | 3 | 3 | [
"MIT"
] | permissive | #
# plot-data-2.py
# Plot data using Mathplotlib to PNG as simple as possible
#
# Sparisoma Viridi | https://github.com/dudung
#
# 20210421
# 0319 Modify plot-data-2.py code for ML linear regression.
# 0335 Copy something from plot-two-mass-system-0.py code.
# 0340 Can work as previous one.
# 0503 Can show step, a, ... | true |
3b51b06a0eb67b571ffcba11b24eb996a77f3b5b | Python | Madhumidha14/python-task-1 | /pattern.py | UTF-8 | 423 | 3.84375 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sun Aug 22 17:11:37 2021
@author: DELL
"""
def triangle(n):
k = n-1 #number of spaces
for i in range(0, n):# handles no of rows
for j in range(0, k):
print(end=" ")
k = k - 1
for j in range(0, i+1):
print("*",... | true |
59ad9628c1d4e4b565aa363455a46b24cd5e5984 | Python | b2-2020-2021-python/01-mediatheque | /actions/help.py | UTF-8 | 494 | 2.609375 | 3 | [] | no_license | from action import Action,ActionManager
class HelpAction(Action):
def __init__(self,actions):
self.actions = actions
def execute(self, param):
action = self.actions[param]
print(action.help())
def info(self):
return "Affiche l'aide d'une commande"
def help(self):
... | true |
c17402ebad222cb2bcb29534b0a8c61014590dd7 | Python | glebpro/MultiClassClassifier | /test.py | UTF-8 | 1,131 | 3.09375 | 3 | [
"MIT"
] | permissive |
from classifiers.MultiClassClassifier import MultiClassClassifier
def read_corpus(fname):
result = []
with open(fname) as f:
for line in f:
line = line.strip().split("\t")
result.append({
"id": line[0].replace(' ', ''),
"sentence": line[1].repla... | true |
526bf78318cd1ef7c20fdb8f4fc9e327159950cf | Python | alylne/POO-Trabalhos | /Atividade 3/__main__.py | UTF-8 | 231 | 2.78125 | 3 | [] | no_license | from Ponto import Ponto
from Quadrilatero import Quadrilatero
if __name__ == '__main__':
p1 = Ponto(2, 4)
p2 = Ponto(4, 2)
quadri = Quadrilatero(p1, p2)
print(quadri.contidoEmQ(p1))
print(quadri.contidoEmQ(p2)) | true |
6c21bed1ca279f5383ac0f62c2994b735fb01436 | Python | Fadlann/DataStructure | /Priority Queue/MaxHeap.py | UTF-8 | 2,536 | 3.6875 | 4 | [] | no_license | class MaxHeap:
def __init__(self):
self.heap = []
def getParent(self, index):
return int((index-1)/2)
def getLeftChild(self, index):
return 2*index + 1
def getRightChild(self, index):
return 2*index + 2
def hasParent(self, index):
return self.g... | true |
41da477c557b0a36bd134fb74b640f60b908b76d | Python | gschen/where2go-python-test | /1906101031王卓越/14周/1.py | UTF-8 | 89 | 2.6875 | 3 | [] | no_license | li = list(map(int,input('请输入列表').split()))
s = set(li)
print(len(s),list(s))
| true |
d95b969469a7732e87046ac6c3983f27f35ffd01 | Python | Sleeither1234/t08_huatay.chunga | /chunga/comparacion.py | UTF-8 | 532 | 3.046875 | 3 | [] | no_license | #EJERCICIO1
print("adrian"=="Adrian")
#EJERCICIO2
print("12" == "5")
#EJERCICIO3
print("3"!="5")
#EJERCICIO4
print("hola"=="hoola")
#EJERCICIO5
print("adios"=="good bye")
#EJERCICIO6
print("dinero"=="felicidad")
#EJERCICIO7
print("712421"=="7712421")
#EJERCICIO8
print("Karla"=="Geraldine")
#EJERCICIO9
print("B"... | true |
44a6c9cf1aa26ed8e878452c256bfe0572f6912a | Python | lawaloy/Practice | /findPairs.py | UTF-8 | 434 | 3.734375 | 4 | [] | no_license | def find_pairs(arr1, arr2):
if not arr1 or not arr2:
return []
stack = []
i=j=0
while i < len(arr1) and j < len(arr2):
if arr1[i] == arr2[j]:
stack.append([i,j])
i+=1
j+=1
elif arr1[i] < arr2[j]:
i+=1
else:
... | true |
6c8f5ec727379fde700ef5347df4df86bed4d67a | Python | mrhallonline/practice-python-exercises | /practicePythonExercises/18cowsAndBulls.py | UTF-8 | 1,392 | 5.21875 | 5 | [] | no_license | # Create a program that will play the “cows and bulls” game with the user. The game works like this:
# Randomly generate a 4-digit number. Ask the user to guess a 4-digit number. For every digit that the user guessed correctly in the correct place, they have a “cow”. For every digit the user guessed correctly in the w... | true |
c4e0202be9bb6d91e277b0f3ba5f5283466a96ed | Python | kryInit/procon31 | /utility/makeFieldInfo.py | UTF-8 | 2,236 | 2.75 | 3 | [] | no_license | # python makeFieldInfo.py [token] [URL(最初の部分)] [teamID] [matchID]
import os
import sys
import time
import requests
if (len(sys.argv) < 5):
print("[makeFieldInfo] 引数が足りません", file=sys.stderr)
sys.exit()
usleep = lambda x: time.sleep(x/1000.0)
token = sys.argv[1]
teamID = sys.argv[3]
matchID = sys.argv[4]
URL ... | true |
20a7d698d41662b08767a75fa422c26825c8b48c | Python | haru-256/bandit | /policy/_stochastic_bandits.py | UTF-8 | 5,692 | 3.046875 | 3 | [] | no_license | """define some policy"""
from abc import ABC, abstractmethod
from typing import Union
import numpy as np
from ._check_input import _check_stochastic_input, _check_update_input
class PolicyInterface(ABC):
"""Abstract Base class for all policies"""
@abstractmethod
def select_arm(self) -> int:
"""... | true |
47ad0b2c38e21458cd0371f7d4c328bea086b516 | Python | bluedian/python_test | /unit_redis/redis_request_r.py | UTF-8 | 714 | 2.59375 | 3 | [
"Apache-2.0"
] | permissive | # -*- coding: utf-8 -*-
import redis
import json
import requests
def redis_list_read(data_name):
r = redis.Redis(host='127.0.0.1', port=6379)
abc = r.lpop(data_name)
if abc is None:
print('无数据了')
exit()
print(abc)
print(type(abc))
abc_dic = abc.decode('utf-8')
print('abc... | true |
42b5f85543b56c6c0ca9a1015896936ee03b0d34 | Python | jinurajan/Datastructures | /LeetCode/binary_search/find_peak_element.py | UTF-8 | 1,741 | 4.28125 | 4 | [] | no_license | """
Find Peak Element
A peak element is an element that is greater than its neighbors.
Given an input array nums, where nums[i] ≠ nums[i+1], find a peak element and return its index.
The array may contain multiple peaks, in that case return the index to any one of the peaks is fine.
You may imagine that nums[-1] = ... | true |
4f067832e7b0caa37f47e16cee5531e6f4d3b3d6 | Python | mselbrede/Discord-Bot | /BasicBot.py | UTF-8 | 5,240 | 2.65625 | 3 | [] | no_license | import discord
import asyncio
from discord.ext.commands import Bot
from discord.ext import commands
import platform
import time as timemod
# Here you can modify the bot's prefix and description and wether it sends help in direct messages or not.
client = Bot(description="UMUC Cyber Padawan Bot", command_prefix="!", pm... | true |
20a14fd6bc070cdeff44fa8c7a87ac0269907bf2 | Python | hyperlolo/MorseCode | /main.py | UTF-8 | 1,754 | 3.84375 | 4 | [] | no_license | #######Morse Code Translator by Karanjit Gill######
"""A Dictionary the various text, number, and symbol translations in Morse Code"""
Morse_code_trans = {'A': '.-', 'B': '-...',
'C': '-.-.', 'D': '-..', 'E': '.',
'F': '..-.', 'G': '--.', 'H': '....',
'I': '.... | true |
c6eee1d021a9dd5127cd7fd01a9de26436d96e2c | Python | jovanikimble/Udacity-Nanodegree | /1project_movietrailer/practice/mindstorms.py | UTF-8 | 713 | 3.953125 | 4 | [] | no_license | import turtle
def draw_square(some_turtle):
for x in range(0, 4):
some_turtle.forward(100)
some_turtle.right(90)
def draw_triangle(some_turtle):
some_turtle.backward(100)
some_turtle.left(60)
some_turtle.forward(100)
some_turtle.right(120)
some_turtle.forward(100)
def draw_circle(some_turtle):
... | true |
d35b0512a2531adf8cd289558f554cf83c6ced35 | Python | nigel-lirio/coe-135 | /lab4/queue.py | UTF-8 | 687 | 3.640625 | 4 | [] | no_license | class Item:
def __init__(self, x):
self.data = x
self.next = None
class LList:
def __init__(self):
self.start = None
def ins(self, data):
new_item = Item(data)
if self.start is None:
self.start = new_item
return
hold = self.start
... | true |
8c255140bb79f982dcafe07480ef23851c4dcb51 | Python | cebeery/warmup_project_2017 | /scripts/drive_square.py | UTF-8 | 2,033 | 3.5 | 4 | [] | no_license | #!/usr/bin/env python
"""This script cmds Neato to move in a square via timed turns"""
import rospy
from geometry_msgs.msg import Twist
class DriveSquareNode(object):
""" Controls square driving behavior of neato"""
def __init__(self):
"""inializes twist cmd and decision flags; sets time constants"... | true |
c6db15718d5e1bfe6e06f4d9c9e305828ac11cac | Python | Summer-Friend/data_analyze | /numpy/1.py | UTF-8 | 2,382 | 3.734375 | 4 | [] | no_license | '''
@Author: your name
@Date: 2020-02-12 10:58:20
@LastEditTime: 2020-02-17 15:00:46
@LastEditors: Please set LastEditors
@Description: In User Settings Edit
@FilePath: \vscode_code\其他\数据分析第二版\numpy\1.py
'''
import numpy as np
my_arr = np.arange(10)
#print((my_arr)[1])
my_list = list(range(10))
#print(my_list[1])
arr... | true |
1deaec2f243d701f142ad6761f4d1c3b9e95bf79 | Python | cboopen/algorithm004-04 | /Week 02/id_384/LeetCode_242_384.py | UTF-8 | 288 | 3.125 | 3 | [] | no_license | class Solution:
def isAnagram(self, s: str, t: str) -> bool:
sm = {}
tm = {}
for i in s:
if i not in sm:
sm[i] = s.count(i)
for j in t:
if j not in tm:
tm[j] = t.count(j)
return sm == tm
| true |
3e871f5fb571090d1ad7ea84a2ecd6cbbcd4c80d | Python | amano7/LearningPython | /chapter6-10.py | UTF-8 | 161 | 3.375 | 3 | [] | no_license | sentence = "四月の晴れた寒い日で、時計がどれも13時を打っていた。"
point = sentence.find("、")
slce = sentence[0:point]
print(slce)
| true |
90107eae3938368426c438f353be14b04686d860 | Python | renan-am/MontadorIAS | /script.py | UTF-8 | 6,083 | 3.09375 | 3 | [] | no_license | #posição da memoria (em decimal) onde inicia a alocação de memoria, se deixada em 0, o programa escolhe um valor adequado
memVarStart = 0
#variaveis globais para usar nas funções
pos = False #False -> esquerda, inicio da linha // True: direita, final da linha
codePos = 0
auxVar = []
code = []
memCount = 0
points = [["p... | true |
886397aadf8f2356a914cddbe0a5032ea5db6032 | Python | spatialaudio/sweep | /ir_imitation.py | UTF-8 | 1,167 | 2.734375 | 3 | [
"MIT"
] | permissive | """ Imitate a impulse response."""
import numpy as np
import measurement_chain
import calculation
def exponential_decay(duration_seconds,
db_decay,
noise_level_db,
fs,
seed=1):
""" Imitate real IR.
duration_seconds : IR du... | true |
31bf45fe6c98360325648cf76f35348d5dd6b6a9 | Python | Elizhann/Code-Projects | /parse_string.py | UTF-8 | 330 | 3.578125 | 4 | [] | no_license | #string to parse
str = 'X-DSPAM-Confidence:0.8475'
#find the location of the : character
x = str.find(':')
print(x)
#find the location following the : character
a = str.find(' ',x)
print(a)
#slice the string at the identified points
number = str[x+1:a]
#turn into a float
number = float(number)
print... | true |
ff4919c1ce875fa21f0baf688e5d6816fec757a8 | Python | jjiezheng/panity | /parserinterface.py | UTF-8 | 594 | 2.9375 | 3 | [
"BSD-3-Clause"
] | permissive | from abc import ABCMeta, abstractmethod
class ParserInterface(object):
"""This interface shows what API a parser for scenes and prefabs should
support at least.
"""
__metaclass__ = ABCMeta
#@staticmethod
@abstractmethod
def read(source):
"""Read a scene/prefab from source (file... | true |
f83e81770ff1c872d0e11a424c88f27305377be8 | Python | PauliusVaitkevicius/Exp001 | /Ex18_Phish_NaiveBayes_UCIdataset/NaiveBayes_LC.py | UTF-8 | 977 | 2.921875 | 3 | [] | no_license | import time
import warnings
import arff
import numpy as np
from sklearn.naive_bayes import BernoulliNB
from sklearn.model_selection import ShuffleSplit
from utilities.plot_learning_curve import plot_learning_curve
warnings.filterwarnings("ignore")
start_time = time.perf_counter()
print("Importing dataset: UCI 2015 ... | true |
6618d28d55039e86e2b6bed85ac8b730ddf220f7 | Python | szilu7/gym-highway | /gym_highway/modell/environment_vehicle.py | UTF-8 | 12,859 | 2.546875 | 3 | [
"MIT"
] | permissive | from gym_highway.modell.vehicle_base import BaseVehicle
import numpy as np
#LOGFILE_PATH
log_cnt = 0
logs_in_file = 40
log_list = []
class Envvehicle(BaseVehicle):
def __init__(self, dict):
super().__init__(dict)
self.desired_speed = 0.0
self.maxacc = 2.0 # Max acceleration m/s^2
... | true |
9e7d8d9390dcc2d34d694665679c1ac86b66c2b7 | Python | sathishvinayk/Python-Advanced | /Exceptions/Use_raise_builtin.py | UTF-8 | 446 | 3.4375 | 3 | [] | no_license | #Running an indexing error with exception
def indexerror(value,index):
return value[index]
#Call the indexerrr with list under indexing range and out of indexing range
x="stuff"
#Calling this will return the value
indexerror(x,3)
#Try raise stament in exception
try:
raise IndexError
except IndexEr... | true |
c18b6d7fb767ca0e73828a0670e0e7cda79abd86 | Python | simeonpanayotov/Tetris | /panels.py | UTF-8 | 6,543 | 3.71875 | 4 | [] | no_license | """Define panels used in the game to display information.
LabelPanel - displays static text
ValuePanel - displays variable text
NextShapePanel - displays the next shape
LevelPanel - displays the current game level
ScorePanel - dispalys the current palyer score
ControlPanel - holds all game panels
"""
import pygame
fr... | true |
11ecec2bc2d11ff40d2f80414b249189facc54aa | Python | mouday/SomeCodeForPython | /python_psy_pc/python基础/pandasTest.py | UTF-8 | 381 | 3.078125 | 3 | [] | no_license | import pandas as pd
#基于numpy
csv=pd.read_csv("bricks.csv",index_col=0)
print(csv)
print(csv.nation)#获取列
print(csv["nation"])
csv["note"]=[1,2,3,4,5,6,7,8,9]#新加列
print(csv)
csv["densty"]=csv["area"]/csv['peple']
print(csv)
print(csv.loc["ch"])#获取行数据
print(csv["nation"].loc["ch"])#获取元素
print(csv.loc["ch"]["nation"])
prin... | true |
07f558baad43bf32c95c7a0f94fd5634108de76f | Python | jansona/MyPingGUI | /src/main/python/main.py | UTF-8 | 3,694 | 2.53125 | 3 | [] | no_license | #!/usr/bin/python3
# -*- coding: utf-8 -*-
"""
MyPing GUI Version
author: ybg
github: https://github.com/jansona/MyPing
last edited: May 2020
"""
import sys
import threading
from fbs_runtime.application_context.PyQt5 import ApplicationContext
from PyQt5.QtWidgets import (QWidget, QLabel, QLineEdit,
QTextEdit, ... | true |
95f29e7b3f1e5df1f4618c8ae9f5edd57def27b3 | Python | BrentLittle/100DaysOfPython | /Day017 - Quiz Project/Quiz Game/main.py | UTF-8 | 461 | 3.078125 | 3 | [] | no_license | from question_model import Question
from data import question_data
from quiz_brain import QuizBrain
questionBank = []
for question in question_data:
questionObject = Question(text = question["text"], answer = question["answer"])
questionBank.append(questionObject)
quiz = QuizBrain(questionBank)
while quiz.st... | true |
5cd304385d54d1d4831d818621f65e310a6a8126 | Python | rksgalaxy/basicpython | /32_Loops.py | UTF-8 | 418 | 3.734375 | 4 | [] | no_license | words = ["hello","world","spams","eggs"]
counter = 0 #counter is vaariable here
max_index= len (words)
while counter < max_index:
word = words[counter]
print(word +"!" )
counter= counter +1
#by for loop
#words = ["hello","world","spams","eggs"]
for p in words:
print(p)
for p in words:
print(p + '?')... | true |
eb57885cebcb7b64cd2102cd561e7216c5f2142f | Python | piger/pinolo | /coil/test/test_tokenizer.py | UTF-8 | 4,746 | 3.0625 | 3 | [
"MIT",
"BSD-3-Clause",
"BSD-2-Clause",
"LicenseRef-scancode-warranty-disclaimer"
] | permissive | """Tests for coil.tokenizer."""
import unittest
from coil import tokenizer
class TokenizerTestCase(unittest.TestCase):
def testEmpty(self):
tok = tokenizer.Tokenizer([""])
self.assertEquals(tok.next().type, 'EOF')
def testPath(self):
tok = tokenizer.Tokenizer(["somekey"])
fir... | true |
61a31222d1890992966c2a556d7d4924fa17d390 | Python | Songtuan/Captioning-ImageNet | /modules/captioner/UpDownCaptioner.py | UTF-8 | 6,354 | 2.546875 | 3 | [] | no_license | import torch
import torch.nn as nn
import allennlp.nn.beam_search as allen_beam_search
from modules.updown_cell import UpDownCell
from functools import partial
device = torch.device('cuda') if torch.cuda.is_available() else torch.device('cpu')
class UpDownCaptioner(nn.Module):
def __init__(self, vocab, image_f... | true |
168b99987e56a67a394c88ce57c8f6590ef01817 | Python | zmunk/Project-Euler | /Euler42.py | UTF-8 | 878 | 2.75 | 3 | [] | no_license | def vals():
m = tri(192)
inp = open('words2.txt',"r")
r = inp.read().lower().replace('"', "").replace(",", " ")
r = r + " "
print r
sum = 0
l = []
count = 0
temp = ""
max = 0
for c in r:
temp = temp + c
if c == ' ':
# print temp
... | true |
f26a42941864a6aabcb2d4c6b8fcbe3e3af93981 | Python | gilsoneng/desafio_ds_conexoes | /desafio.py | UTF-8 | 12,561 | 2.546875 | 3 | [
"Apache-2.0"
] | permissive | # -*- coding: utf-8 -*-
"""
Created on Sat Sep 4 11:48:03 2021
@author: altran
"""
import pandas as pd
import numpy as np
import sys
import tensorflow as tf
import math
from keras.models import Sequential
from keras.layers import Dense
from matplotlib import pyplot as plt
from sklearn.model_selection import train_t... | true |
158e35f1a283dfcf6744d160446c199ded2b2113 | Python | ndegwaofficial/IBM-Innovation-Club-CybersecurityCodelabs | /network_scanner/net_scan_step3.2.py | UTF-8 | 663 | 2.921875 | 3 | [] | no_license | import scapy.all as scapy
def scan(ip):
arp_request = scapy.ARP(pdst=ip)
broadcast= scapy.Ether(dst="ff:ff:ff:ff:ff:ff")
arp_request_broadcast = broadcast/arp_request
#save only the first element [0] to answered_list
answered_list = scapy.srp(arp_request_broadcast, timeout=5)[0]
#for each pa... | true |
74828b1711c93557d14dc90a07de74aadb1fac9c | Python | tjlee/poptimizer | /poptimizer/data/adapters/gateways/tests/test_cbr.py | UTF-8 | 1,217 | 2.515625 | 3 | [
"Unlicense"
] | permissive | """Тесты загрузки данных о максимальных ставках депозитов с сайта ЦБР."""
from datetime import datetime
import pandas as pd
import pytest
from poptimizer.data.adapters.gateways import cbr
from poptimizer.data.adapters.html import parser
from poptimizer.shared import col
def test_date_parser():
"""Проверка обраб... | true |
e5ef0327a431f373b3574c5572011202acc38ffd | Python | willcrichton/generative-grading | /src/rubricsampling/grammars/drawCircles/value.py | UTF-8 | 595 | 2.640625 | 3 | [] | no_license | import sys
sys.path.insert(0, '../..')
import generatorUtils as gu
import random
from base import ReusableDecision
# anytime a user uses a magic number, there is a change
# for an off by one.
# params: key, target
class Value(ReusableDecision):
def registerChoices(self):
# are they off by one?
self.addChoice(se... | true |
872fb0a877b62b3f1e79352e726e740a07f9ea56 | Python | tsaomao/PythonConfig | /findconfig.py | UTF-8 | 794 | 3.125 | 3 | [] | no_license | # Look at arguments.
# If file location overridden, look for the specified file.
# If not, look for default file (./parseargs.json).
# Read out specific values from file.
# If missing, provide the default.
import argparse
import os.path
parser = argparse.ArgumentParser(description="Load configuration parameters from J... | true |
8ddcd9fd0908f5091d8381eb61877d2ad7b50c3c | Python | gmth7788/python3_test | /python3_test/src/format_test.py | UTF-8 | 6,066 | 3.40625 | 3 | [] | no_license | #!/usr/bin/evn python3
import locale
import decimal
import math
import sys
#########################
# 位置参数(position argument)替换
#########################
print("The novel '{0}' was published in {1}".format("Hard Times", 1854))
print("{{{0}}} {1} ;-}}".format("I'm in braces", "I'm not")) #位置参数中包含{}
#################... | true |
353ddf19bcd35faa19dbad64ae61a153feea703b | Python | ai-times/infinitybook_python | /chap07_p126_code2.py | UTF-8 | 455 | 3.4375 | 3 | [] | no_license | import turtle as t
t.penup()
t.goto(0,0); t.write(" (0,0)")
t.goto(0,200); t.write("(0,200)")
t.pendown()
t.goto(0,-200); t.write(" (0,-200)")
t.penup()
t.goto(-200,0); t.write("(-200,0)")
t.pendown()
t.goto(200,0); t.write(" (200,0)")
t.penup()
t.goto(-150,-150)
t.pendown()
t.color("blue")
t.goto(150,150); ... | true |
7fbb02ddf70717c46f10d208b8d802ed0f039cd0 | Python | c625v12/411ChrisValko | /testMongo.py | UTF-8 | 559 | 2.71875 | 3 | [] | no_license | import sys, datetime
from pymongo import MongoClient
try:
client = MongoClient('localhost', 27017)
print("Connected to MongoDB")
db = client.test_database
print("Got the Database test_database")
collection = db.test_collection
print("Got the Collection")
post = {"author": "Mike","text": "My ... | true |
6ab7f9f29103faefd0d730f1f04d6a49c5e587b9 | Python | theislab/LODE | /DeepRT/ssl_kaggle/dev/utils.py | UTF-8 | 11,481 | 3.0625 | 3 | [
"MIT"
] | permissive | """General utility functions"""
import json
import matplotlib.pyplot as plt
from PIL import Image
import glob as glob
import pandas as pd
import numpy as np
import os
import shutil
class Params():
"""Class that loads hyperparameters from a json file.
Example:
```
params = Params(json_path)
print(p... | true |
dd102818a8323e1055160b0c7581f76fd33f3e5e | Python | mclt0568/pyserverman | /manlib/logging.py | UTF-8 | 3,124 | 3.015625 | 3 | [] | no_license | from typing import Any, IO, List, Tuple
from ColorStr import parse as colorparse
from enum import Enum
from datetime import datetime
import os
import threading
class LogLevel:
tag: str
color: str
def __init__(self, tag: str, color: str) -> None:
self.tag = tag
self.color = color
class L... | true |
48b669cce065aaad4da05136de3320325f0413dc | Python | zhanghao-ic/Binance-Orderbook | /OrderBook.py | UTF-8 | 3,728 | 2.984375 | 3 | [
"MIT"
] | permissive | import asyncio
import websockets
import json
import requests
import time
import sys
from collections import OrderedDict
class OrderBook():
def __init__(self, uri, depth_api, symbol, volume):
self.uri = uri
self.depth_api = depth_api
self.symbol = symbol
self.volume = volume
... | true |
617614135862f8f4237b43ee80f3a8169119b463 | Python | stixaw/PythonScripts | /ListPrint.py | UTF-8 | 257 | 3.046875 | 3 | [] | no_license | #!/usr/bin/env python
# encoding: utf-8
"""
untitled.py
"""
import sys
import os
WORD_LIST=[
'Mark',
'Angel',
'Steve',
'Steve 2',
'Milt',
'Bryant',
'Cory'
]
def Print(list):
for F in list:
print F
if __name__ == '__main__':
Print(WORD_LIST)
| true |
39f28fab1f67137901331ea3dc566d36a54d8844 | Python | gracechin/DE3-ROB1-FEEDING | /fred/src/calibration.py | UTF-8 | 5,662 | 3.265625 | 3 | [] | no_license | # Grace Chin 2018
#
''' Helps calibrate a point from the camera's frame of reference to the robot's frame of reference
Finds the conversion from finding a list of m values and c values for the different dimensions using y = mx + c
'''
import rospy
import rospkg
import numpy as np
from math import sqrt
from numpy import... | true |
799f1a0b5f299a9ec84e07d292def8c5d5140367 | Python | GhostEric/FGO-py | /FGO-py/fgoControl.py | UTF-8 | 1,681 | 2.8125 | 3 | [
"MIT",
"LicenseRef-scancode-warranty-disclaimer"
] | permissive | import time
ScriptTerminate=type('ScriptTerminate',(Exception,),{'__init__':lambda self,msg='Unknown Reason':Exception.__init__(self,f'Script Stopped: {msg}')})
class Control:
speed=1
def __init__(self):
self.reset()
self.__stopOnDefeatedFlag=False
self.__stopOnSpecialDropFlag=False
... | true |
93351598dd1bedcb957efb58aa149c48d39635d6 | Python | fadilfauzani/Tubes-DasPro | /source/save.py | UTF-8 | 1,794 | 2.734375 | 3 | [] | no_license | import os
def datatostring(data):
s = ""
for i in range (len(data)):
s += str(data[i])
if (i != len(data) - 1):
s += ";"
return s+ '\n'
users = [(3,"fadil","fadill","kotabumi","asdasd","admin"),[4,"fudil","fadill","kotabumi","asdasd","user"]]
gadgets = []
consums = []
riw_consu... | true |
43a7d9f9fb01ae868a08f2604a31be87307389f1 | Python | strnisaj/LVR-sat | /DPLL/DPLL.py | UTF-8 | 18,674 | 2.859375 | 3 | [
"BSD-3-Clause"
] | permissive | from Izjave import *
from Sudoku import *
from Hadamard import *
from CNF import *
import time
newPureValFound = True
solutionVals = {}
lockSolutionVals = False
def DPLL(izjava):
# Metoda dobi izjavo, ki jo obdela s pomocjo funkcije prepareStatement(izjava)
# Ce izjava ni na zacetku False (zaradi praznega... | true |
f5d2fc135e2aa3a3d528990db1532c5f9814adb6 | Python | Danisdnk/PythonExerciseGuide | /TP2/2.1.py | UTF-8 | 584 | 3.953125 | 4 | [] | no_license | import random
# a Cargar una lista con números al azar de cuatro dígitos.
# La cantidad de elementos también será un número al azar de dos dígitos.
def tamañolista(elementos):
lista=[]
for i in range(elementos):
lista.append(random.randint(0, 99))
print(lista)
return lista
def eliminarvalor... | true |
622fe7d5f0550dbe4e875d4426425bdde7ad0134 | Python | CrispenGari/speech-to-text-python-ibm_watson | /main.py | UTF-8 | 1,238 | 2.796875 | 3 | [] | no_license |
# importing packages
from ibm_watson import SpeechToTextV1, ApiException
from ibm_cloud_sdk_core.authenticators import IAMAuthenticator
import json
# service credentials
url = "API_KEY"
api_key = "URL"
# Setting the authentication
try:
auth = IAMAuthenticator(api_key)
stt = SpeechToTextV1(authenticator=auth)... | true |
8a2f3532ee14d902b14b5165e694034958ab0de4 | Python | GAIPS/ILU-RL | /tests/unit/utils.py | UTF-8 | 1,594 | 3.03125 | 3 | [
"MIT"
] | permissive | """This module provides common functionality among unit-tests"""
from ilurl.utils.aux import flatten
def process_pressure(kernel_data, incoming, outgoing, fctin=1, fctout=1, is_average=False):
timesteps = list(range(1,60)) + [0]
ret = 0
for t, data in zip(timesteps, kernel_data):
dat = get_veh_loc... | true |
77b34cdea78cb917781978b56e852713920aca2e | Python | ellenmliu/Data-Structures-and-Algorithms | /Data Structures/problem_3_Huffman_Coding.py | UTF-8 | 4,201 | 3.609375 | 4 | [] | no_license | import sys
class Node:
def __init__(self, char=None, frequency=None, left=None, right=None):
self.char = char
self.frequency = frequency
self.left = left
self.right = right
self.binary = ''
def get_right(self):
return self.right
def get_left(self):
r... | true |
e97a6de07ddd8f65bd32458cac3290a3233ebbe5 | Python | jonpemby/jobbr | /src/utilities.py | UTF-8 | 550 | 2.734375 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"MIT"
] | permissive | from termcolor import colored
def print_help():
print_header()
print_opt('queries-per-day', 'number of queries to perform each day')
exit(0)
def print_header():
print("{} ({} {})".format(
colored("jobbr", 'green'),
colored("Jonathon Pemberton", 'white'),
colored('<jonpemby@ic... | true |
0cdf2a0ff9382e9be3523d8e799caf5680473c9f | Python | elsid/CodeCraft | /scripts/helpers.py | UTF-8 | 329 | 2.96875 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/env python3
import json
def read_json(path):
with open(path) as stream:
return json.load(stream)
def write_json(data, path):
with open(path, 'w') as stream:
json.dump(data, stream, indent=4)
def read_lines(path):
with open(path) as stream:
return [v.strip() for v in... | true |
120c71da747fb9ac66bdaa762bc062617c98514c | Python | rurinaL/coursera_python | /week2/7.py | UTF-8 | 410 | 3.390625 | 3 | [
"Unlicense"
] | permissive | cell11 = int(input())
cell12 = int(input())
cell21 = int(input())
cell22 = int(input())
step1 = cell11 - cell21
step2 = cell12 - cell22
if (abs(step1) % 2 == 0 and step2 == 0):
print('YES')
elif (abs(step2) % 2 == 0 and step1 == 0):
print('YES')
elif (step1 % 2 == 0 and step2 % 2 == 0):
print('YE... | true |
4232c05bfd71256f1b7656ee7ce2410511c5b34f | Python | imran-iiit/LiveSessions | /Safari_Live/AaronMaxwell/31Jul18_NextLevel_pt2/labs/py3/decorators/my_decorator.py | UTF-8 | 228 | 3.375 | 3 | [] | no_license |
def add(increment):
def decorator(func):
def wrapper(*args, **kwargs):
return increment + func(*args, **kwargs)
return wrapper
return decorator
@add(3)
def f(n):
return n+2
print(f(4))
| true |
568830a50f868abdea71bd38e1c3807ccb45a8a7 | Python | Emmandez/MachineLearning_A-Z | /Part 2 - Regression/Section 6 - Polynomial Regression/Polynomial_Regression/polynomial_Regression_Template.py | UTF-8 | 997 | 3.421875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Wed Jun 6 22:08:40 2018
@author: eherd
"""
#Polynomial regression
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
dataset = pd.read_csv('Position_Salaries.csv')
#X has to be a matrix 10,1 matrix in this case
X = dataset.iloc[:,1:2].values
#Y has to be a... | true |
47d5fb213a68201aec14e8c052c86762002241a9 | Python | Gavinxin/TrajectoryToKafka | /KafkaProducer2.py | UTF-8 | 3,905 | 2.609375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
'''
@author: 真梦行路
@file: kafka.py
@time: 2018/9/3 10:20
'''
import pandas as pd
from kafka import KafkaProducer
from kafka.errors import KafkaError
import time
KAFAKA_HOST = "127.0.0.1" # 服务器端口地址
KAFAKA_PORT = 9092 # 端口号
KAFAKA_TOPIC = "track2" # topic
data = pd.read_table(r"C:\Users\Gavin\... | true |
5c21ec2ebd5cd3c8b43c82bfafad04b0d9928495 | Python | pepijn809/menno_rest_api | /menno.py | UTF-8 | 4,027 | 2.828125 | 3 | [] | no_license | # Requirements
# - Flask, JSONify, Requests, DNSPython, Flask_PyMongo, Flask_HTTPAuth, Werkzeug.Security
from flask import Flask, jsonify, request, make_response
from flask_pymongo import PyMongo
from flask_httpauth import HTTPBasicAuth
from werkzeug.security import generate_password_hash, check_password_hash
# Flask ... | true |
7c8069ac6199568d8f73a353fcd4be15e796ca28 | Python | ahadcove/temperature-fan | /temp.py | UTF-8 | 1,087 | 2.8125 | 3 | [] | no_license | import os
import glob
import time
from config import *
base_dir = '/sys/bus/w1/devices/'
device_folder = glob.glob(base_dir + '28*')[0]
device_file = device_folder + '/w1_slave'
last_state = False
def read_temp_raw():
f = open(device_file, 'r')
lines = f.readlines()
f.close()
return lines
def read_t... | true |
3d741f5ce7af2757abe440a86b89ecaa7304c6c6 | Python | jayanthsarma8/py4e-assignments | /9 th chapter assignment.py | UTF-8 | 337 | 2.859375 | 3 | [] | no_license | na=input("")
ha=open(na)
d=dict()
for i in ha :
i=i.rstrip()
if not i.startswith("From "):
continue
wrd=i.split()
if len(wrd) < 3 :
continue
w=str(wrd[1])
d[w]=d.get(w,0)+1
ma=0
key=None
for l,m in d.items() :
if m > ma:
ma = m
key=w
print... | true |
8764615feaaf3e4145c16489db398d970262ee5a | Python | kenluuu/LeetCode | /combination-sum-III.py | UTF-8 | 653 | 2.828125 | 3 | [] | no_license | class Solution(object):
def combinationSum3(self, k, n):
"""
:type k: int
:type n: int
:rtype: List[List[int]]
"""
res = []
def combinationSum3Util(i, sum, nums):
if len(nums) > k: return
if sum == n and len(nums) == k:
... | true |
a16f9b36c82f8bcf137b0686a2a2031ea76c1a82 | Python | bryn-sorli/Intro_to_Robotics | /Labs/lab6/lab6.py | UTF-8 | 14,511 | 2.734375 | 3 | [] | no_license | import time
import json
import rospy
import copy
import math
import random
import argparse
from PIL import Image, ImageDraw
import numpy as np
from pprint import pprint
from geometry_msgs.msg import Pose2D
from std_msgs.msg import Float32MultiArray, Empty, String, Int16
g_CYCLE_TIME = 0.1 # seconds
# Parameters you m... | true |
fe3c67f89b15da7e94c1f2830941f7be33a46460 | Python | maze508/Misc.-Finance-Scripts | /DCC/dcc_combined.py | UTF-8 | 9,117 | 3.109375 | 3 | [] | no_license | import datetime as dt
import pandas_datareader as pdr
from datetime import datetime
import plotly.graph_objects as go
#####################################
'''API and Setting of Parameters'''
#####################################
# Date Settings
now = datetime.now()
end_date = dt.datetime.now()
pair = 'EURUSD=X'
sta... | true |
3b3a28cafee8e305875314d1fa679a5170a507a5 | Python | aswmtjdsj/CSE537-S15 | /proj-1/solution.py | UTF-8 | 3,916 | 2.890625 | 3 | [] | no_license | #!/usr/bin/python
import sys, os
import copy
from solution_ids import IDS
from solution_astar import *
from guppy import hpy
BOARD_ROW = 7
BOARD_COL = 7
board = [] # supposed to be 7 * 7 array
if __name__ == '__main__':
# print sys.argv
if len(sys.argv) < 2:
raise Exception('''command should be "p... | true |
b18b7b53d3fd033a7d0f274334c99cca544cf938 | Python | RomanDubinin/CVRP | /src/inside_customers_heuristics.py | UTF-8 | 3,583 | 3.09375 | 3 | [] | no_license | from src.common import disstance, get_tour_len
from src.Node import Node
def incertion_price_recount(incert_infos, last_added_node, left_node, right_node):
for point in incert_infos:
possible_new_price = disstance(left_node.value, point) + \
disstance(point, last_added_node.val... | true |
e902e5d4e91f02363cd668ccbd5dc36462c98955 | Python | code4plot/sghomebrew | /kegland/utils/pricelist_functions.py | UTF-8 | 3,522 | 2.625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sat Oct 24 15:16:59 2020
@author: mbijlkh
"""
from utils import helper
from sqlalchemy.types import VARCHAR
import pandas as pd
from collections import defaultdict
def pricetable(x, date, **kwargs):
"""takes in processed pricelist, x, a pandas df
and upload to SQL DB
... | true |
27f3b74bb208d04976719ae19b5e3269623e555b | Python | Barankin85/SeaFight | /app/routes.py | UTF-8 | 728 | 2.625 | 3 | [] | no_license | from app import app
from bottle import template, request, static_file
from models import game
@app.route('/static/<filepath:path>')
def server_static(filepath):
return static_file(filepath, root='./app/static')
@app.get('/')
@app.get('/index')
def index():
return template('game_board', game = game)
@app.pos... | true |
ccbc3eea4f9c841ea6bde02ef82116b679ddaf90 | Python | v-cardona/CompeticionProgramacion | /Vitos/vito.py | UTF-8 | 346 | 3.21875 | 3 | [] | no_license | import sys
num_cases = int(sys.stdin.readline())
for _ in range(num_cases):
#Vito vive en la mediana de las casas
#despues solo queda sumar el valor absoluto
casas = [int(i) for i in sys.stdin.readline().split()[1:]]
mediana = sorted(casas)[int(len(casas)/2)]
cont = sum([abs(elem-mediana) for elem ... | true |
1632ceafe01248583858eccb8ddc1f2b7536a7ad | Python | Aasthaengg/IBMdataset | /Python_codes/p02991/s367089639.py | UTF-8 | 981 | 2.828125 | 3 | [] | no_license | # coding: utf-8
import sys
from heapq import heapify, heappop, heappush
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
# vertexごとに3つの状態数を持つ
N, M = lr()
graph = [[] for _ in range((N+1)*3)] # 1-indexed
for _ in range(M):
a, b = lr()
a *= 3; b *= 3
... | true |
6f64ae44ba0f6d6d0c72a267ac6fb8373f02656b | Python | PatrickDeng0/DeepLearning-PJ | /rnn_model.py | UTF-8 | 3,500 | 2.78125 | 3 | [] | no_license | import os
import tensorflow as tf
from tensorflow.keras.callbacks import EarlyStopping
class RNNModel:
def __init__(self, input_shape, learning_rate=0.001, num_hidden=64,
log_files_path=os.path.join(os.getcwd(), 'logs'),
method='LSTM', output_size=3):
self._input_shape ... | true |
10ded71b8fd31d839371e1896a324c2e3329f86c | Python | myamamoto555/atcoder | /others/dp/LCS.py | UTF-8 | 601 | 3.578125 | 4 | [] | no_license | # coding:utf-8
# 最長共通部分列
# LCS(Longest Common Subsequence problem)
def lcs(X, Y):
X = ' ' + X
Y = ' ' + Y
c = [[0 for i in range(len(Y))] for j in range(len(X))]
maxl = 0
for i in range(1, len(X)):
for j in range(1,len(Y)):
if X[i] == Y[j]:
c[i][j] = c[i-1][j-1]... | true |
4d74abb47181f625c8bad73a367ad01579bdbe18 | Python | cathy27/some-little-tests | /0010.py | UTF-8 | 1,301 | 3.359375 | 3 | [] | no_license | # coding=utf8=
# 第0010题: 使用 Python 生成类似于下图中的字母验证码图片
from PIL import Image, ImageDraw, ImageFont, ImageFilter
import random as rd
# 随机字母
def randchar():
return chr(rd.randint(65, 90))
# 随机颜色1
def rand_color():
return rd.randint(64, 255), rd.randint(64, 255), rd.randint(64, 255)
# 随机颜色2
def rand_color2():
... | true |
6bac3d074aaa8487f54f7b183fb52dbe39b8e325 | Python | citizenken/quest-discord-bot | /src/cogs/character.py | UTF-8 | 5,360 | 2.609375 | 3 | [] | no_license | import yaml
from discord.ext import commands
from ..models.character import Character as CharacterModel
from ..models.user import User
from ..prompts.character import CharacterPrompts
from ._base_cog import _BaseCog
from ..bot import quest_bot
class Character(_BaseCog):
def __init__(self, quest_bot):
supe... | true |
3fcc95de010e15841f9f6b55bcb2914c301d7693 | Python | madhu-mini/data_structures | /Arrays.py | UTF-8 | 113 | 2.765625 | 3 | [] | no_license | import array
initializer_list = [2, 5, 43, 5, 10, 52, 29, 5]
arr = array.array('I',initializer_list)
print(arr)
| true |
1a3e5bd6afe16d2e12492d8e3527c46c47234387 | Python | massa423/tamagawa | /tests/conftest.py | UTF-8 | 570 | 2.65625 | 3 | [] | no_license | from telnetlib import Telnet
import pytest
class TamagawaClient:
def __init__(self):
self.host = "localhost"
self.port = 3333
self.timeout = 10
def open(self):
self.client = Telnet(self.host, self.port, self.timeout)
def send(self, data: bytes):
self.client.write... | true |
129a85782867786c1fb24a5b49809e699fa11b12 | Python | S1829/test | /wakachi1.py | UTF-8 | 724 | 3.125 | 3 | [] | no_license | import MeCab
#MeCab を import
#i_am_cat.txt を読み込んで分かち書きする
with open('/media/takuma/NORITAMA/工学実験Ⅳ/Part3/i_am_a_cat.txt','r',encoding='utf-8')as f:
text = f.read()
m = MeCab.Tagger("-Ochasen") #オブジェクトを作成
node = m.parseToNode(text) #形態素情報を取得
count = 0
while node: #繰り返し
word = node.feature.split... | true |
15225c7a1ef5aaceffccce80ce988edb4a92a848 | Python | Jenderal92/Mass-Delete-Http | /delh.py | UTF-8 | 469 | 2.546875 | 3 | [] | no_license | #JametKNTLS - h0d3_g4n - Moslem - Kiddenta - Naskleng45
#Created By : Jenderal92@Shin403
banner = """
Mass Delete HTTP | Jamet Crew
"""
print banner
def http(url):
try:
htt = (url)
x = htt.replace('http://', '').replace('https://', '')
open('delhttp.txt','a').write(x+'\n'); print('Deleted http' + ' '+url)
exc... | true |