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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
fb913b7811ba1b57fc21c9cd687750b839767ee0 | Python | 1715439636/professional-python3 | /正则表达式/2_基本正则表达式.py | UTF-8 | 5,159 | 3.90625 | 4 | [] | no_license | """
作者:文文
主要介绍一些基本的匹配规则
python版本:python3.5
"""
import re
"""1 字符组
使用方括号并在方括号内列出所有可能的字符从而表示一个字符组,一定要注意,它仅仅匹配一个字符
[Pp]:匹配大写P或者小写p
[A-Z]:匹配大写A到大写Z中任何一个
[^0-9]:在方括号中的^是取反字符(^还可以表示字符串的开始),表示匹配除0-9之外的字符
一些快捷方式
\w: 与任意单词字符匹配,python3中基本上与几乎任何语言的任意单词匹配,python2中至于英语单词字符匹配,但无论哪个版本,都会匹配数字、下划线或者连字符
\W: 匹配\w包含字符之外的所有字符
\d: 匹配数字字... | true |
3cfa95b74169bd26d6a365ea55c8f5d07910dd42 | Python | DAAB97/sales_data_project | /sales_data_project.py | UTF-8 | 4,613 | 3.140625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Thu Dec 24 03:33:03 2020
@author: abderrahman
"""
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
df = pd.read_csv('C:/Users/abdo/Desktop/sales_data.csv')
#cleanning data
## detect unique values in the columns
for cat in df.columns:
... | true |
34d393f6323ad80ecb13bb9085105af16c630e79 | Python | spaceplesiosaur/marauders_map_api | /marauders_map_api/views.py | UTF-8 | 2,836 | 2.546875 | 3 | [] | no_license | from django.shortcuts import get_object_or_404
from django.http import HttpResponse
from django.views.decorators.csrf import csrf_exempt
import json
from .models import Character, Connection
def _find_connection(x):
return Character.objects.get(name=x)
@csrf_exempt
def character_index(request):
# if request.... | true |
af9781f1f4ac126ac78909c2c86caefa1e3b6c45 | Python | embassynetwork/lovinglanguagebot | /loving.py | UTF-8 | 3,797 | 3 | 3 | [] | no_license | #!/usr/bin/env python
import os, sys, time, re, datetime
from slackclient import SlackClient
# get these tokens from slack or ask someone to give them to you.
# then `export LOVING_LANGUAGE_SLACK_TOKEN='xoxb-xxxxxxxxxxxxxxxxxxxxx'`
token = os.environ.get('LOVING_LANGUAGE_SLACK_TOKEN')
bot_id = os.environ.get('LOVING... | true |
bf125b7d9e169395e478f6536c9798df720e1213 | Python | Aravind-Chowdary/Final_Project | /Rnd_wrds_eval.py | UTF-8 | 152 | 2.859375 | 3 | [] | no_license | from random import randrange
f = open("rands.txt", "w+")
num=10000
i=0
while i<num:
m=randrange(0,65536)
f.write('%d \n' %m)
i +=1
f.close() | true |
42dddc6f85a18db5ff650ab0eef495340931cedf | Python | PhanTheMinhChau/baitap | /bai13-3.py | UTF-8 | 793 | 2.765625 | 3 | [] | no_license | import os, random
add = os.getcwd()
a = float(input("nhập dung lượng giới hạn(1-1024MB): "))*1024
while ((a/1024)<1) or ((a/1024)>1024):
a = float(input("yêu cầu nhập lại (1-1024MB)"))*1024
n = int(a//1000) #số file
c = int((a%1000)*1024) #dung lượng file cuối(byte)
os.mkdir("thư mục chứa file")
for i... | true |
2f8afd3728bbf53f23c8d7d96f7444e2fd5b89bb | Python | DannyRH27/RektCode | /Mocks/JAY/mock2.py | UTF-8 | 1,771 | 3.734375 | 4 | [] | no_license | '''/*
* LRU Cache
* LRU = > least recently used
* cache. generally, the more items something can store, the slower it is to retrieve items from it
* caches for memory: L1 and L2 cache(these are managed by your operating systeM)
* memory is much faster than disk
* LRU = > cache policy. this policy determines how w... | true |
5b0b224e6a2735abc334a7b03a7ffd6c5511d0da | Python | calebxcaleb/Rendered-Cube | /rendered_cube.py | UTF-8 | 8,556 | 3.359375 | 3 | [] | no_license | from typing import Tuple, List
import pygame as pygame
from math import sin, cos, tan, pi, inf
class Cube:
"""Class for a cube (self explanatory)
"""
origin: Tuple[float, float, float]
points: List[Tuple[float, float, float]]
segments: list
rects: list
colour: Tuple[int, int, i... | true |
ba26536f1c3c9cb1bb715ed013363f1141d35822 | Python | ghollingworth/garmin-data | /sleep-data.py | UTF-8 | 1,933 | 2.78125 | 3 | [
"BSD-2-Clause"
] | permissive | import json
# This code extracts the sleep data from the list of files and writes out as a CSV file
# To get the data from Garmin's website go to:
# https://www.garmin.com/en-GB/account/datamanagement/exportdata/
# They will send you an email containing a link to a zip file containing all the information
files = ['.... | true |
96f4ff5df40c6d37b6cba08cc463fd1aeb27a0f1 | Python | rajkonkret/python-szkolenie | /pon_3_ex11.py | UTF-8 | 167 | 3.765625 | 4 | [] | no_license | def number_of_divisors(n):
counter = 0
for i in range(1,n+1):
if n%i == 0:
counter+=1
return counter
print(number_of_divisors(9240))
| true |
8b7a970ffaa0f3aa786347def3779be04b20fef0 | Python | bxg167/Automatic-Music-Composition | /Training/Functional Tests/tests_File_Playback.py | UTF-8 | 1,286 | 2.640625 | 3 | [] | no_license | import pickle
import uuid
from unittest import TestCase
import os
from Training.tflstm import NeuralNetwork
CURRENT_DIRECTORY = os.path.dirname(__file__)
EXISTING_RNN_FILE = CURRENT_DIRECTORY + "test.snapshot"
class PlaybackFunctionalTests(TestCase):
nn = NeuralNetwork()
# Will be changed to the correct n... | true |
d2b44b28c5ad4feb5089d5f646fff23e8ba402c6 | Python | DauMinhHoa/Save-code-here | /app.py | UTF-8 | 1,226 | 2.984375 | 3 | [] | no_license | from flask import Flask, render_template
app = Flask(__name__)
class Movie:
def __init__(self, title, img):
self.title = title
self.img = img
movie1 = Movie(' The girl next door',"https://upload.wikimedia.org/wikipedia/en/f/fc/Girl_Next_Door_movie.jpg")
movie2 = Movie(' panda',"http://eva-img.24hs... | true |
f2c8cb041a54fea39a27eadebac2ef7f0d947704 | Python | art-vybor/labs | /optimization/lab5/doit.py | UTF-8 | 1,247 | 3.03125 | 3 | [] | no_license | from math import sin, sqrt
from random import random, uniform, randint
from copy import deepcopy
Np = 100 #population size
F = 1 #100 # weight
CR = random() # prop of sequence
M = 1000 #2000 # max num of population
#a, b, c = 0.5, 0.5, 0.5
#a, b, c = 1.0, 0.8, 1.0
a, b, c = 2.5, 1.0, 2.0
f = lambda (x1,x2): a*x1*si... | true |
b83a27becb305ed3d723af15ec349c2a04b7def2 | Python | MomchilAngelov/Diploma_2015 | /old_stuff/snake.py | UTF-8 | 4,386 | 2.703125 | 3 | [] | no_license | import os
import time
import random
import threading
class catchInputFromKeyboard(threading.Thread):
def __init__(self):
threading.Thread.__init__(self)
def run(this):
import termios, fcntl, sys, os
fd = sys.stdin.fileno()
oldterm = termios.tcgetattr(fd)
newattr = termios.tcgetattr(fd)
... | true |
f73bc313778c9ef253d0475dbc2079ac733511b2 | Python | TwistingTwists/project-ias | /backend/pyq_scrapers/scrape_prelims.py | UTF-8 | 1,281 | 2.703125 | 3 | [] | no_license | import time
import json
from selenium import webdriver
from selenium.webdriver import ActionChains
data = {}
data["prelims"] = []
baseURL = "https://www.insightsonindia.com/2021/06/06/solve-upsc-previous-years-prelims-papers-2018/"
driver = webdriver.Chrome()
driver.get(baseURL)
time.sleep(15)
questions = driver.f... | true |
f592d2e76bb7a3ee8a1035623bd425fe7c0e09ce | Python | anushamokashi/prgm | /rev_num.py | UTF-8 | 172 | 3.84375 | 4 | [] | no_license | '''x=input("enter the num")
reverse=0
while (x):
reverse = reverse * 10
reverse = reverse + x% 10
x=x/10
print(reverse)'''
num=input("enter the num")
print (num[::-1]) | true |
8176cf565af279ec737b7a1f725118da1f3a263e | Python | mechatroner/RBQL | /test/test_mad_max.py | UTF-8 | 3,251 | 2.6875 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from __future__ import print_function
import unittest
import sys
import datetime
import os
PY3 = sys.version_info[0] == 3
#This module must be both python2 and python3 compatible
script_dir = os.path.dirname(os.path.abspath(__file__))
# Use insert inst... | true |
9b29c98b5f11b0078b45b9dfcade0e8dd31efe41 | Python | julpotter/College-Projects-and-code | /Computational_Physics/bifurcationdiagram.py | UTF-8 | 429 | 2.84375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Mon Nov 26 12:15:18 2018
bifurcationdiagram.py
@author: Julian
"""
import matplotlib.pyplot as plt
import numpy as np
r = 0.96
N = 1500
x = 0.5
xlist = []
rlist = []
for r in np.arange(0.75,1,0.0005):
x = 0.25
for i in range(N):
x = 4*r*x*(1-x)
if(i>1000)... | true |
be2d55c5604c64059bf0f300d778455625326fb9 | Python | frankzhuo/PJ_PREDICT_IMG | /api_invoice/dao/log_dao.py | UTF-8 | 1,333 | 2.671875 | 3 | [] | no_license | # -*-encoding:utf-8-*-
import api_invoice.config.db as db_config
table_name = "pe_log"
class PeLog:
def __init__(self, dict_row=None):
if dict_row:
self.id = dict_row.get("id")
self.created = dict_row.get("created")
self.modified = dict_row.get("modified")
s... | true |
9b3ccc49c1eca939cc1d24b56cbecf91c03a4e57 | Python | xavierloos/python3-course | /Intermediate/Namespaces & Scope/global_scope.py | UTF-8 | 967 | 4.25 | 4 | [] | no_license | # 1.Take a look at the two functions defined. One function named print_avaliable() prints the number of gallons we have available for a specific color. The other function named print_all_colors_avaliable() simply prints all available colors!
# Ponder what might happen when we run the script and then run it to find out!... | true |
b331263c6c06e7fc05200217c2c0c7493cfc400f | Python | Shikhar0907/Online-Quiz | /Handy_project/Test/api_test.py | UTF-8 | 993 | 2.609375 | 3 | [] | no_license | import requests
import pprint
import unittest
class test_api(unittest.TestCase):
def GetAPI_test(self):
URL = "http://localhost:8000/admin/search"
self.re = requests.get(URL)
data = self.re.json()
self.assertEqual(self.re.status_code,200)
def PostAPI_test(self):
URL =... | true |
305b269491b37b45e46d1c5a113795e5f0ca9496 | Python | NeoGlanding/python-masterclass | /02-program-flow/augmented-assignment.py | UTF-8 | 93 | 3.03125 | 3 | [] | no_license | number = 5
multiply = 8
answer = 0
for i in range(1, 9):
answer += number
print(answer) | true |
b292252b3143d8671a5a29de669a85861760248a | Python | panda3d/panda3d-docs | /programming/pandai/pathfinding/uneven-terrain.py | UTF-8 | 13,836 | 2.546875 | 3 | [] | no_license | # PandAI Author: Srinavin Nair
# Original Author: Ryan Myers
# Models: Jeff Styers, Reagan Heller
# Last Updated: 6/13/2005
#
# This tutorial provides an example of creating a character and having it walk
# around on uneven terrain, as well as implementing a fully rotatable camera.
# It uses PandAI pathfinding to move... | true |
899f53dcea9befa0dea798fa7a9cb9b207f3832f | Python | jonathan-lai-the-science-guy/tdi-capstone-taxidata-analysis | /Scripts/griddifyNYCStreets.py | UTF-8 | 2,131 | 2.9375 | 3 | [] | no_license | import sys
sys.path.append('../Custom_Libraries')
# Initialize gridding object
import GridLib
gridObj = GridLib.BaseGrid(resolution=33)
# Initialize grid of variables
import numpy as np
X,Y = gridObj.getGridIndex()
minX,maxX = 0,len(X)-1
minY,maxY = 0,len(Y)-1
gridMap = np.zeros((len(X),len(Y))).astype(int)
shapeM... | true |
9c2a39250dd8dd89c2eb66fb9972c0bbdb977f9f | Python | mrostomgharbi/Reinforcement-learning | /Connect4 game/Connect4/games/gamestate.py | UTF-8 | 5,556 | 3.53125 | 4 | [] | no_license | import copy
from games.board import Board
import os
class GameState:
"""
This class is developed to hold the intermediate data of the Game.
"""
def __init__(self, metadata, ai):
self._metadata = metadata
self._ai = ai
self._board = Board()
self.players_turn = self._metad... | true |
0f1cb667defb54400a71f2f5842555c8a31db51b | Python | tf-czu/gyrorad | /serial/reader.py | UTF-8 | 560 | 2.75 | 3 | [
"MIT"
] | permissive | #!/usr/bin/python
"""
Read serial COM port
usage:
./reader.py <com> <speed>
"""
import sys
import serial
import datetime
def reader( com ):
dt = datetime.datetime.now()
filename = "g" + dt.strftime("%y%m%d_%H%M%S.log")
f = open( filename, "wb" )
while True:
f.write( com.read(100) )
... | true |
be645162f372f490b4550f373f0df6372f2ea338 | Python | hyteer/testing | /Python/Test/Web/reqPost.py | UTF-8 | 390 | 2.71875 | 3 | [] | no_license | # encoding: utf-8
str = '\u9a8c\u8bc1\u7801\u53d1\u9001\u6210\u529f\uff0c\u8bf7\u6ce8\u610f\u67e5\u6536'
str1 = bytes(b'\x31\x32\x61\x62').decode('ascii')
str2 = bytes(b'\x31\x32\x61\x62').decode('ascii')
str3 = bytes(b'\u9a8c\u8bc1\u7801\u53d1\u9001\u6210\u529f\uff0c\u8bf7\u6ce8\u610f\u67e5\u6536').decode('utf8')
pri... | true |
c9d2755ac0d235f268ec6f98a4d786cdc5247e91 | Python | thakureie/Python | /re_loop_compile.py | UTF-8 | 396 | 2.8125 | 3 | [] | no_license | #!/usr/bin/python
import re
def run_re():
pattern = "pDq"
re_obj = re.complie(pattern)
infile = open('large_re_file.txt', 'r')
match_count = 0
lines = 0
for line in infile:
match = re_obj
if match:
match_count += 1
lines += 1
retrun(lines, match_count)
if _name_ == "_main_":
lines, match_c... | true |
cd44a28b4aec2f269c158b46b979aa447e2da391 | Python | kskrueger/CS574 | /src/load.py | UTF-8 | 2,658 | 2.90625 | 3 | [] | no_license | import csv
import numpy as np
import datetime
def read_csv(path):
with open(path, 'r') as f:
csv_file = csv.reader(f)
lines = [line for line in csv_file]
return lines[1:] # exclude the headers
def process_orders(dataset):
orders_dict = {}
for order in dataset:
order_num, tim... | true |
fdd49b4319eb4dde8f4306203b654093c8c9b65b | Python | jacksonwb/npuzzle | /src/check_solvable.py | UTF-8 | 1,334 | 2.828125 | 3 | [] | no_license | #! /usr/bin/env python3
# ---------------------------------------------------------------------------- #
# check_solvable.py #
# #
# By - jacksonwb ... | true |
95bc28a3f745665b6498b0b0d330c003cda50c9f | Python | MarcoCompagnoni/python | /prove_iniziali/linear_regression_excel.py | UTF-8 | 1,934 | 2.671875 | 3 | [] | no_license | import pandas as pd
import numpy as np
from scipy import stats
import locale
locale.setlocale(locale.LC_ALL, '')
frames=[]
def main():
monitoraggio_vibrazioni = pd.read_excel('monitoraggio_vibrazioni_2.xlsx')
headers = list(monitoraggio_vibrazioni.columns.values)
for i in range(1, len(headers)):
... | true |
5399b780f04e080d7fc4a65c84029c8ee6683bd9 | Python | microsoft/pgtoolsservice | /tests/integration/integration_tests.py | UTF-8 | 7,327 | 2.6875 | 3 | [
"MIT"
] | permissive | # --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... | true |
3e141b55cd481afa939b917025f36e51cfdd18b3 | Python | michalstefanowski/api_petstore_test | /api_tests/pet_tests.py | UTF-8 | 2,009 | 2.640625 | 3 | [] | no_license | import pytest
from assertpy import assert_that
from ahm_service import PetstoreService
from models.models import PetStatus, PetDto
class TestPet:
# New pet to add
new_pet = PetDto(id=1, photo_urls=["test1", "test22"], status=PetStatus.AVAILABLE.value,
tags=[{"id": 666, "name": "elo"}], c... | true |
c94e4a78abb63632d362cc01ff342104ba1f72fb | Python | ciaranclear/enigma | /enigma/histogram/histogram.py | UTF-8 | 5,410 | 3.0625 | 3 | [] | no_license |
from typing import OrderedDict
class Histogram:
LETTERS = [chr(i) for i in range(65, 91)]
NUMBERS = [str(i) for i in range(10)]
def __init__(self, input_str, output_str):
self._input_str = input_str
self._output_str = output_str
self._alphanum_map = None
self._alpha_map... | true |
ce4814297531077e542bbcc9cb5ec94703dcda98 | Python | svandiek/summa-farsi | /local/create_transcript_file.py | UTF-8 | 942 | 2.6875 | 3 | [] | no_license | #!/usr/bin/env python3
import argparse, sys
# parser = argparse.ArgumentParser(description='''Create file called 'text' with transcripts''')
# parser.add_argument('corpusdir', nargs='+', default=sys.stdin)
# args = parser.parse_args()
# corpus = args.corpusdir[0]
# print(corpus)
for folder in ["all", "train", "test... | true |
74c53267349608f8c1cb8cdac420b31ec85d49c5 | Python | emmeowzing/meta | /plot.py | UTF-8 | 794 | 2.828125 | 3 | [
"MIT"
] | permissive | #! /usr/bin/env python
# -*- coding: utf-8 -*-
""" Plot processed image data """
import matplotlib.pyplot as plt
import numpy as np
from PIL import Image
from argparse import ArgumentParser
def plot(fname: str) -> None:
with Image.open(fname) as data:
data = np.array(data)
plt.figure(figsize=(9,... | true |
6211dbfaffd73563a72556fd82964b34aecaecda | Python | nsauzede/mys | /tests/test_errors.py | UTF-8 | 4,203 | 2.671875 | 3 | [
"MIT"
] | permissive | from .utils import TestCase
from .utils import build_and_test_module
class Test(TestCase):
def test_errors(self):
build_and_test_module('errors')
def test_bare_integer_in_try(self):
self.assert_transpile_raises(
'def foo():\n'
' try:\n'
' a\n'
... | true |
7de3a9235571dfd7fe8c82982b12438b36048ce6 | Python | coldfix/pyval | /val.py | UTF-8 | 3,466 | 3.453125 | 3 | [] | no_license | #! /usr/bin/env python
# encoding: utf-8
"""
Show value of a fully-qualified symbol (in a module or builtins).
Usage:
pyval [-r | -j | -p | -f SPEC] [EXPR]...
Options:
-r, --repr Print `repr(obj)`
-j, --json Print `json.dumps(obj)`
-p, --pprint Print `p... | true |
cd73ec20d97bfff76e17120a49d48ef0d4542375 | Python | Francis009zhao/Quant_Transaction | /myQuant/python_version/extracting_data/excel_test.py | UTF-8 | 3,796 | 2.625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import xlsxwriter
# 生成excel文件
def generate_excel(expenses):
workbook = xlsxwriter.Workbook('./rec_data.xlsx')
worksheet = workbook.add_worksheet()
# 设定格式,等号左边格式名称自定义,字典中格式为指定选项
# bold:加粗,num_format:数字格式
bold_format = workbook.add_format({'bold': True})
# mo... | true |
824aae66ba63a9d8ead00dfc80f3f200174b2736 | Python | GwiYeong/salt-modularize-tgt-diff | /parse_target.py | UTF-8 | 477 | 2.890625 | 3 | [] | no_license | def parse_target(target_expression):
'''Parse `target_expressing` splitting it into `engine`, `delimiter`,
`pattern` - returns a dict'''
match = TARGET_REX.match(target_expression)
if not match:
log.warning('Unable to parse target "{0}"'.format(target_expression))
ret = {
'... | true |
230730bebb537442760310e706ed26dffc9af870 | Python | paulslevin/alloa | /tests/test_graph.py | UTF-8 | 18,606 | 2.765625 | 3 | [
"MIT"
] | permissive | import unittest
from collections import OrderedDict
import networkx as nx
from alloa.agents import Agent, Hierarchy
from alloa.costs import spa_cost
from alloa.graph import AgentNode, AllocationGraph
from alloa.utils.enums import GraphElement, Polarity
POSITIVE = Polarity.POSITIVE
NEGATIVE = Polarity.NEGATIVE
SOURC... | true |
bcc4a448a53a8138db8e30d8f5e5fb5ac5be5f05 | Python | xuanxuan03021/Crawler-Project | /12.qiutu.py | UTF-8 | 1,727 | 2.90625 | 3 | [] | no_license |
import urllib.request
import urllib.parse
import http.cookiejar
import ssl
import re
import os
import time
def download_image(content):
pattern=re.compile(r'<div class="thumb">.*?<img src="(.*?)".*?>.*?</div>',re.S)#正则表达式要一个一个严格的对上,要的用小括号扩起来,re.S在单航模式的时候.可以匹配换行符,再多行格式是不能匹配换行符
ret=pattern.findall(content)
p... | true |
a932bfa11be3a8bdef49581a59ff780eaab4204d | Python | shardulparab97/Page-Rank | /processFile.py | UTF-8 | 8,192 | 2.765625 | 3 | [] | no_license | import os
import shutil
import sys
import numpy
import math
import random
import igraph
from scipy import sparse
from igraph import *
#store text file in a list
global rawTextData, rawTextDataCopy
rawTextData = []
rawTextDataCopy = []
global nodeList
nodeList = []
global deletedNodesList
deletedNodesList = []
global ... | true |
887d0785aaca44a5b55df5a2df6b1a9af68b814b | Python | garciparedes/jinete | /jinete/dispatchers/abc.py | UTF-8 | 1,259 | 2.890625 | 3 | [
"MIT"
] | permissive | """Abstract module which defines the high level scheduling during the process of optimization."""
from __future__ import (
annotations,
)
from abc import (
ABC,
abstractmethod,
)
from typing import (
TYPE_CHECKING,
)
from ..storers import (
NaiveStorer,
)
if TYPE_CHECKING:
from typing import... | true |
a420d02c4b01f9f668d93b2907dce2a36a9e1efe | Python | xiaohongyang/python_project | /xhy_blog/test.py | UTF-8 | 3,300 | 2.65625 | 3 | [] | no_license | import tkinter as tk
from tkinter import *
import tkinter.messagebox
from urllib import *
import urllib.request
import json
from lib import *
import lib.LogTool
class MyCheckButton(tk.Frame) :
def __init__(self, master = None) :
super().__init__( master)
self.pack(expand = True)
self.master.title ("")
self.m... | true |
3aa565e7301861b23f9cdcbd5dadec49db0ef84f | Python | groodt/99bottles-jmeter | /server.py | UTF-8 | 910 | 2.890625 | 3 | [] | no_license | #!/usr/bin/env python
import bottle
import simplejson
bottle.debug(True)
@bottle.post('/bottle')
def store_bottle():
# Extract values from JSON POST body
raw_json = bottle.request.body
json_string = ''.join(raw_json.readlines())
parsed_json = simplejson.loads(json_string)
(num_bottles, drink, dat... | true |
4f1a122339b67a1f997b5d683d1cfed2132b0eef | Python | hfrankst/python-text-rpg | /end_game.py | UTF-8 | 652 | 3.5 | 4 | [] | no_license |
def end_game_option():
'''Gives the player the option to restart the game or quit'''
print("\nGAME OVER\n")
print("Would you like to play again? (Y/N)")
player_input = input("> ")
if player_input == "Y" and player_input == "y":
elif player_input == "N" and player_input == "n":
pass
else:
if player_input ... | true |
644deb588b293f72801ebacb52102318c4844c37 | Python | mmikolajczak/recommendation_system_hetrec2011_movielens | /recommendations_system/data_preparation_scripts/generate_categories_vocabularies.py | UTF-8 | 1,623 | 2.703125 | 3 | [
"MIT"
] | permissive | import os
import os.path as osp
import pandas as pd
from recommendations_system.io_ import load_hetrec_to_df
from recommendations_system.io_._utils import flatten, is_iterable
HETREC_DATA_PATH = '../../data/hetrec2011-movielens-2k-v2'
OUTPUT_VOCABS_PATH = '../../data/generated_categories_vocabs'
def generate_catego... | true |
c1d2a9eddfafdfa0403824b4a932b280e53171cb | Python | sandeepbaldawa/Programming-Concepts-Python | /data_structures/linked_lists/palindrome_check.py | UTF-8 | 577 | 4.3125 | 4 | [] | no_license |
Is Palindrome: Given a Linked List, determine if it is a Palindrome. For example, the following lists are palindromes:
A -> B -> C -> B -> A
A -> B -> B -> A
K -> A -> Y -> A -> K
Note: Can you do it with O(N) time and O(1) space? (Hint: Reverse a part of the list)
Solution 1:- We can create a new list in rever... | true |
1290868c833d5a90c9d64a8fa5fb774929bac912 | Python | sug5806/TIL | /Jupyter_Notebook_for_Python/2019-03-18 opxl/test.py | UTF-8 | 67 | 2.65625 | 3 | [
"MIT"
] | permissive | import sys
for arg in sys.argv:
print(arg, type(arg))
| true |
cba1b7f7b01120b89dc92926920b226fcd3ffa02 | Python | karelinas/adventofcode2019 | /day06/a.py | UTF-8 | 558 | 3.4375 | 3 | [] | no_license | import sys
def ancestor_count(graph, child):
parent = graph.get(child, None)
if not parent:
return 0
return 1 + ancestor_count(graph, parent)
def read_graph(iterator):
graph = {}
for line in iterator:
line = line.strip()
if not len(line):
continue
parent... | true |
63bb0dd3a30d3edf5b752a856cca8ec0df2fd442 | Python | anaswara-97/python_project | /flow_of_control/looping/sum_upto_range.py | UTF-8 | 210 | 3.515625 | 4 | [] | no_license | num=int(input("enter the limit : "))
sum=0
# for i in range(num+1):
# sum=sum+i
# print("sum of first",num,"numbers :",sum)
i=0
while(i<=num):
sum+=i
i+=1
print("sum of first",num,"numbers :",sum)
| true |
27a7cb29c095ad358fff7131ce9e502e1e18fbd2 | Python | ELOHIMSUPREMES/hashtagcluster | /etl.py | UTF-8 | 2,286 | 2.734375 | 3 | [] | no_license | import tweepy
import json
from pprint import pprint as pp
from sklearn.cluster import KMeans
from sklearn.feature_extraction.text import CountVectorizer
import numpy as np
import scipy
from collections import Counter
from tweetutils import clean_tweet
class MyStreamListener(tweepy.StreamListener):
# tweetlist s... | true |
af2f03cfc42837b7331a32d79d339e0d69e34ecb | Python | danielzhang1998/xiaojiayu_lesson_coding | /python/lessons_coding/lesson74_tk_v1.py | UTF-8 | 875 | 2.765625 | 3 | [] | no_license | from tkinter import *
def doNothing():
label1 = Label(root, text="Doing nothing")
label1.pack()
root = Tk()
mainmenu = Menu(root)
root.config(menu=mainmenu)
filemenu = Menu(mainmenu)
mainmenu.add_cascade(label="File", menu=filemenu)
filemenu.add_command(label="New Project", command=doNothing)
filemenu.ad... | true |
144c7ee2e3cda1835d59113c4550af9b4665f5a3 | Python | paty0504/Web-NguyenTThanh-C4E16 | /web1/app.py | UTF-8 | 1,031 | 2.953125 | 3 | [] | no_license | from flask import Flask, render_template
app = Flask(__name__)
@app.route('/') #tại địa chỉ server ==> trang chủ
def index():#function . Khi người dùng vào đường dẫn thì chạy hàm index
# post_title = 'THơ con ếch'
# post_content = '????'
# post_author = 'Thanh'
posts = [
{'title' : 'Tho con ech... | true |
c069a307aaf80196b5dce8468752b3efa9bf0da5 | Python | alizkzm/BioinformaticsPractice | /Bio3.py | UTF-8 | 208 | 3.078125 | 3 | [] | no_license | from suffix_trees import STree
string = "GCGAGC"
suffixTree = STree.STree(string)
nodes = [string[i:] for i in range(len(string))]
out = [suffixTree.find(key) for key in sorted(nodes)]
print(out)
| true |
ea76c7b94c7c69ae628bed507d92375b113b28e4 | Python | lukebrawleysmith/Common-Function | /CommonFunctions.py | UTF-8 | 15,773 | 3.140625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Wed Oct 5 17:37:30 2016
@author: luksmi
"""
import pandas as pd
import numpy as np
import scipy
import math
import time
from functools import partial
def checkInteger(v, vName, isArray = False, lengthOne = True,
nonNegative = False, positive = False):
"""Ch... | true |
4ec64acb41d68b5ef680173602b645996fe0de4a | Python | Hoodythree/LeetCode_By_Tag | /Data_Structure_and_Alogrithm/int_break.py | UTF-8 | 786 | 3.203125 | 3 | [] | no_license |
def integer_breaking(num):
dynamic_programming = [1 for i in range(num + 1)]
for i in range(1, num + 1):
if i % 2 == 1:
dynamic_programming[i] = dynamic_programming[i - 1]
else:
dynamic_programming[i] = dynamic_programming[i - 1] + dynamic_programming[i // 2]
... | true |
0a72507a13f67d6f0a6a8f616eb5da5aec4c6bb4 | Python | ngkavin/echoregions | /echoregions/plot/region_plot.py | UTF-8 | 3,292 | 3.125 | 3 | [
"Apache-2.0"
] | permissive | import numpy as np
import pandas as pd
import os
from ..convert.utils import from_JSON
import matplotlib.pyplot as plt
class Regions2DPlotter():
"""Class for plotting Regions. Should only be used by `Regions2D`"""
def __init__(self, Regions2D):
self.Regions2D = Regions2D
def plot_region(self, reg... | true |
a0aa7003e074d8b660e81fd75f16689caf2a274c | Python | achrinza/np-csf02-answers | /PRG1/Assignment/1/test_adapter_manager.py | UTF-8 | 827 | 2.765625 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | import pytest
from adapter import Adapter
from adapter_manager import AdapterManager
class DummyAdapter(Adapter):
ADAPTER_TITLE = "PytestDummyAdapter"
ADAPTER_TYPE = "DummyAdapter"
def __init__(self):
pass
def call(self, args, kwargs):
if len(args) > 0:
return args[0]
... | true |
b3d152c3d77164cfb4fddc268cfa28526a619b59 | Python | Mattamorphic/Painter | /app/views/components/dialogs.py | UTF-8 | 4,905 | 3.015625 | 3 | [] | no_license | '''
Dialogs
Author:
Matthew Barber <mfmbarber@gmail.com>
'''
from app.lib.constants import Constants
from PyQt5.QtWidgets import QDialog, QDialogButtonBox, QLabel, QVBoxLayout, QSizePolicy
from PyQt5.QtCore import QCoreApplication
from PyQt5.QtGui import QPixmap
class BaseDialog(QDialog):
'''
... | true |
d04baf27bda0ce3fb71c7e372643141575d12949 | Python | pirate777333/My_Small_Projects | /P11.py | UTF-8 | 1,886 | 3.53125 | 4 | [] | no_license | import turtle
import random
wn = turtle.Screen()
wn.title("snake game")
wn.bgcolor("green")
wn.setup(width=600, height=600)
head = turtle.Turtle()
head.ht()
head.speed(1)
head.shape("square")
head.color("black")
head.penup()
head.goto(0, 0)
head.direction = "stop"
head.write("press space to start", fo... | true |
611aae611cae0904fc337345096582252f57d4d2 | Python | fsch2/blockly | /demos/drawbot/drawbot.py | UTF-8 | 1,923 | 2.625 | 3 | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | import sys
import time
import serial
import streamexpect
global ser
global exp
ser = None
exp = None
TIMEOUT = 5.0
DELIM = '\r\n'
def drawbot_init(port):
global ser
global exp
# close, if port was openend before
try:
ser.close()
except:
pass
try:
ser = serial.Serial(po... | true |
b6ec73aeffbaef1db43e981bc47841de8923700e | Python | zstumgoren/betterpython | /elex2/election_results.py | UTF-8 | 5,415 | 3.40625 | 3 | [
"MIT"
] | permissive | """
In this second pass at the election_results.py script,
we chop up the code into functions.
USAGE:
python election_results.py
OUTPUT:
summary_results.csv
"""
import csv
import urllib.request
from operator import itemgetter
from collections import defaultdict
# Primary function that orchestrates all s... | true |
8354ab0f4a8a982fcb2ead6d4b72768ae2f899ff | Python | deng-peng/Machine-Learning-Test | /scikit_learn/tf-idf_test/tf-idf-test2.py | UTF-8 | 2,944 | 2.984375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import codecs
import os
import jieba
import jieba.posseg as pseg
import sys
import string
from sklearn import feature_extraction
from sklearn.feature_extraction.text import TfidfTransformer
from sklearn.feature_extraction.text import CountVectorizer
# 对文档进行分词处理
def seg_words(s, c):
# 保存分词结... | true |
4b6247ce5fe6a6f4daeaf6601f40e41ea7a66ef6 | Python | MaxouSenpai/INFO-F-404-Scheduling_Project | /source/Timeline.py | UTF-8 | 1,745 | 3.390625 | 3 | [] | no_license | from source.Event import Event
class Timeline:
"""
Class that represents a timeline that can contain several events.
"""
def __init__(self, timeLimit):
"""
Construct the timeline.
:param timeLimit: the time limit
"""
self.timeLimit = timeLimit
self.cpuS... | true |
1818edb8fe0b0870a54310f341b3168995b317df | Python | diegovds/PSO2017B | /T6-PSO/t6-dsantos.py | ISO-8859-1 | 4,544 | 3.328125 | 3 | [] | no_license | # Implementado por Diego Viana dos Santos
# Script em Python que retorna consultas JSON utilizando a API de previso do tempo Advisor da Climatempo.
# Aps o retorno das consultas realizada a exibio das informaes retornadas por meio da biblioteca grfica Tkinter.
#!/usr/bin/env python3
import json, requests
from tkinte... | true |
6b825efdb96b6e441bcda56b9447b206e4a2da66 | Python | epaulz/Extra_Practice | /project_euler/p1.py | UTF-8 | 154 | 3.71875 | 4 | [] | no_license | num = 1000
sum = 0
for x in range(1,num):
if x % 3 == 0 or x % 5 == 0:
sum += x
print "The sum of multiples of 3 or 5 below %d is %d" % (num, sum)
| true |
1f7001a0e65e3fe54ae63b68cb9d74eed1fc620b | Python | DenisAzarenko777/Cook_book | /Cook_book(modified).py | UTF-8 | 4,186 | 3.125 | 3 | [] | no_license | from collections import Counter
def list_forming_function():
file = open("recipes.txt")
onlist = file.read().split("\n")
some_list3 = []
# Делаем список списков (разбиваю каждый элемент строки на отдельный сисок)
for line in onlist:
some_list2 = []
if line != '':
some_li... | true |
f0762d10e825ce6f60e22debd8df0d409485266d | Python | mrinisami/problems | /35.py | UTF-8 | 813 | 3.6875 | 4 | [] | no_license | def searchInsert(nums, target) -> int:
high_end = len(nums) - 1
low_end = 0
mid = (high_end + 1 - low_end) // 2
if target < nums[0]:
return 0
elif target > nums[high_end]:
return high_end + 1
while True:
if target == nums[mid]:
return mid
elif high_e... | true |
3df53b92ee65cabd2ae214e11ed737a6b2a2beae | Python | samrithasudhagar/guvi | /108.py | UTF-8 | 135 | 2.78125 | 3 | [] | no_license | n,k=map(int,input().split())
l=list(map(int,input().split()))
s=sorted(l)
c=0
for i in range(0,len(s)):
c=c+1
if c==k:
print(s[i])
| true |
c55ed7cb4f63c482a4b8ef11f6ff2020e672c871 | Python | 24emmory/Python-Crash-Course | /listcomprehensioncube.py | UTF-8 | 171 | 3.46875 | 3 | [] | no_license | cubes = [number**3 for number in range(1,10)]
print(cubes)
#name of list, list brackets, expression to run generated numbers through, and then for loop to generate numbers | true |
86ef13f4af25efc7a25dc65c72389dee29cd946c | Python | shadowlurker/spline | /spline/lib/markdown.py | UTF-8 | 1,994 | 2.921875 | 3 | [
"MIT"
] | permissive | """Handles Markdown translation."""
from __future__ import absolute_import
import lxml.html
import lxml.html.clean
import markdown
markdown_extensions = []
def register_extension(extension):
"""Registers the given markdown extension.
This is global and permanent; use with care!
"""
if not extension ... | true |
c560d026eff9b7b32b75b9bc1269b16cdfee8334 | Python | sushilovinfun/Scrapy | /2012 Second Semester/wikiitem/mfitem/spiders/test.py | UTF-8 | 1,031 | 2.578125 | 3 | [] | no_license | from scrapy.spider import BaseSpider
from scrapy.selector import HtmlXPathSelector
from mfitem.items import MfitemItem
class MySpider(BaseSpider):
name = "wiki"
allowed_domains = ["en.wikipedia.org"]
start_urls = ["http://en.wikipedia.org/wiki/Archive"]
def parse(self, response):
hxs = HtmlXP... | true |
ccc3e18eb525e3c648d1beed75da5b80e2fd941f | Python | mackenziedott/Python | /charCreate.py | UTF-8 | 2,673 | 3.75 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Mon May 01 19:17:55 2017
@author: Mackenzie
"""
def charCreate():
classlist = ["Bard", "Fighter", "Wizard", "Druid", "Barbarian", "Cleric", "Warlock", "Sorceror", "Rogue", "Ranger", "Paladin"]
classIntrostring = '''
What class does your character want to be? Enter th... | true |
1794c6de70ed9dbd4a4f139dfd6763c6d7a39050 | Python | lffranca/creme | /creme/datasets/elec2.py | UTF-8 | 1,674 | 2.65625 | 3 | [
"BSD-3-Clause"
] | permissive | from .. import stream
from . import base
class Elec2(base.FileDataset):
"""Electricity prices in New South Wales.
This data was collected from the Australian New South Wales Electricity Market. In this market,
prices are not fixed and are affected by demand and supply of the market. They are set every
... | true |
e974749d0db97ec572c5b59e7cd86a232c2f1b4a | Python | acoltelli/Algorithms-DataStructures | /Ch1Solutions.py | UTF-8 | 2,680 | 3.53125 | 4 | [] | no_license | import random
import string
length= 12
randomString=''.join(random.choice(string.ascii_letters) for i in range(length))
randomString2=''.join(random.choice(string.ascii_letters) for i in range(length))
# CCI q1.1
def isCharUnique(str):
var=0
for i in str:
var+=1
count = str.count(i)
if count>1:
return Fa... | true |
54dfa2146e313b2911f822700231f432376cdddc | Python | Alex92rus/ErrorDetectionProject | /classifier/class_util.py | UTF-8 | 4,150 | 3.21875 | 3 | [
"Apache-2.0"
] | permissive | from collections import defaultdict
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
# plotting functions
def create_confusion_matrix(data, predictions):
"""
Creates a confusion matrix that counts for each gold label how often it was labelled by what label
in the predictions.
Args... | true |
3561bf14682c342614e571c55faf505369fbad0c | Python | Ujjawal-Indwar/Web-Scrape | /main.py | UTF-8 | 876 | 3.078125 | 3 | [] | no_license | import re
import requests
from bs4 import BeautifulSoup
from collections import Counter
url = "https://venturebeat.com/"
regex_url = url.replace(":","\:").replace("/","\/").replace(".","\.")
response = requests.get(url)
html = response.text
#print(response.text[:1000])
soup = BeautifulSoup(html, "html.parser")
link... | true |
9494a5c16066a6cf1728c9935e0df198a4e7a317 | Python | tenqaz/crazy_arithmetic | /leetcode/剑指offer/剑指 Offer 63. 股票的最大利润.py | UTF-8 | 827 | 3.734375 | 4 | [] | no_license | """
@author: zwf
@contact: zhengwenfeng37@gmail.com
@time: 2023/7/16 10:05
@desc:
"""
from typing import List
from math import inf
class Solution:
def maxProfit(self, prices: List[int]) -> int:
"""
每次循环,将当前值与前面的最小值相减取得到当前最大的利润值,然后和前面的最大利润值去最大值。
再获取当前最小值。
时间复杂度: O(... | true |
d1d36df5495ae78d443409881227bec52a74a06f | Python | FullteaR/naturalLanguageProcessing100Knock | /knock02.py | UTF-8 | 123 | 2.84375 | 3 | [] | no_license | patrol = "パトカー"
taxi = "タクシー"
result = ""
for p, t in zip(patrol, taxi):
result += p + t
print(result)
| true |
112907e3405c8c16a5dfe6bb065b72daf202b273 | Python | foundling/Flashcard | /__init__.py | UTF-8 | 5,712 | 3.09375 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: <encoding name> -*-
# Flashcard
#
# A text-based, quiz-yourself application
# copyright (c) 2015 by Alex Ramsdell
import os, sys
from config import *
from store import Database
from quiz import QuizEngine
from helper_funcs import *
import headers
def main_menu(db):
clear_screen... | true |
882f722f22327bd7da3c8466c2d314b406acafef | Python | Wesleyfsilva/Exercicios-python | /Ex23.py | UTF-8 | 527 | 3.796875 | 4 | [] | no_license | preco1 = float(input("Digite o preço do primeiro produto: "))
preco2 = float(input("Digite o preço do segundo produto: "))
preco3 = float(input("Digite o preço do terceiro produto: "))
if preco1 < preco2 and preco1 < preco3:
print("Voce deve comprar o primeiro produto,no valor de {:.2f}".format(preco1))
elif preco... | true |
cafcbd66446c0edc5f9276c247a6020b38c90aa2 | Python | finzellt/novae | /utils/dates.py | UTF-8 | 799 | 2.8125 | 3 | [] | no_license | import re
__all__ = ['convert_date_UTC']
#works only for 1931-2030
def convert_date_UTC(date):
if re.match(r"\d(\d)?[/:\-]\d[/:\-]", date):
i = re.match(r"\d(\d)?[/:\-]", date).end()
date = date[:i] + "0" + date[i:]
if re.match(r"\d[/:\-]\d(\d)?[/:\-]", date):
date = "0" + date
year, month, day = "","",""
... | true |
0bc010ff695739c1db7f53995572c06108aa4154 | Python | courses-learning/python-crash-course | /5-10_checking_usernames.py | UTF-8 | 478 | 3.84375 | 4 | [] | no_license | # Create a program that simulates how websites ensure all have unique usernames
def get_new():
new = input("Hello new user. Please enter your username: ").upper()
while new in usernames:
new = input("Sorry that username is taken. Please select another: ").upper()
return new
usernames = ["DAVID16... | true |
ff52cae2d6b590f528bb620c6e9d017c455da73b | Python | vjimw/django-reportengine | /reportengine/filtercontrols.py | UTF-8 | 5,582 | 2.921875 | 3 | [
"BSD-2-Clause"
] | permissive | """Based loosely on admin filterspecs, these are more focused on delivering controls appropriate per field type
Different filter controls can be registered per field type. When assembling a set of filter controls, these field types will generate the appropriate set of fields. These controls will be based upon what is ... | true |
5aa43240fea7a7f93823a93f5b5b16cc3f771d17 | Python | assaultpunisher/Leet_Code | /Hard/Python 3/Trapping_Rain_Water(42).py | UTF-8 | 609 | 3.09375 | 3 | [
"MIT"
] | permissive | class Solution:
def trap(self, height: List[int]) -> int:
n = len(height)
if n < 3:
return 0
l = height[0]
r = height[n-1]
i = 0
j = n - 1
res = 0
while i < j:
if r < l:
j -= 1
if height[j] < r:... | true |
6509da4ce5d879991c133ab1a8184c282d3f36b9 | Python | adib1996/Neo4j_Graph_Generator | /read_data_module.py | UTF-8 | 793 | 2.828125 | 3 | [] | no_license | import os
import pandas as pd
def remove_quotes(x):
if x != "":
return x[1:-1]
else:
return x
def read_data(input_data_path, triplets_file_names):
for i in range(len(triplets_file_names)):
if i == 0:
data = pd.read_csv(os.path.join(input_data_path, triplets_file_names... | true |
821543d71a482487e57c58df96093c4ef8be344a | Python | anushavajha/CottonPricePrediction | /cottonpriceprediction/Data Formatting Scripts/Districts_Markets.py | UTF-8 | 1,498 | 3.28125 | 3 | [] | no_license | import pandas as pd
df = pd.read_csv('CottonData.csv')
#Data Cleaning
df = df[df['Price'] > 0]
df = df[df['Price'] < 13000]
#DATE MERGING
df['Day']=df['Day'].apply(lambda x: '{0:0>2}'.format(x))
df['Month']=df['Month'].apply(lambda x: '{0:0>2}'.format(x))
df['Year'] = df['Year'].apply(str)
df['Day']=df['Day'... | true |
073f212117191e2ffb980faf2cc2599c62edf4ac | Python | misohan/Udemy | /Test_udemy.py | UTF-8 | 1,419 | 4.53125 | 5 | [] | no_license | # numbers = 1, 2, 3, data type integer
# strings = "ahoj", data type string
# lists = [], can be changed
# tuples = (), can not be changed
# dictionary = {}, key values
multiplication = 2.005*50
print(multiplication)
divison = 401/4
print(divison)
exponent = 10.01249219725040309**2
print(exponent)
addition = 100+0.... | true |
aeb4cabfe56540e81b30486e919b04b61670874d | Python | usnistgov/xml_utils | /xml_utils/xsd_tree/operations/attribute.py | UTF-8 | 1,683 | 3.421875 | 3 | [
"BSD-3-Clause",
"MIT",
"NIST-Software"
] | permissive | """XSD Tree operations on attributes
"""
from xml_utils.xsd_tree.operations.namespaces import get_namespaces
from xml_utils.xsd_tree.operations.xpath import get_element_by_xpath
from xml_utils.xsd_tree.xsd_tree import XSDTree
def set_attribute(xsd_string, xpath, attribute, value):
"""Sets an attribute of an eleme... | true |
d07f91a3a663fdfec96617503aa41f793d089053 | Python | DiegoVieiras/Python.io | /q14.py | UTF-8 | 837 | 3.875 | 4 | [] | no_license | #João Papo-de-Pescador, homem de bem, comprou um microcomputador para controlar
#o rendimento diário de seu trabalho. Toda vez que ele traz um peso de peixes
#maior que o estabelecido pelo regulamento de pesca do estado de São Paulo
#(50 quilos) deve pagar uma multa de R$ 4,00 por quilo excedente. João precisa
#que vo... | true |
e429f444714da278ce1ee9a41a6cfb9b4d61cd98 | Python | ritobanrc/RSACodebusters2019 | /substitution.py | UTF-8 | 437 | 2.984375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
import random
from string import ascii_uppercase
from quote_file_mod import get_quote
def substitute(message):
new_alphabet = {l1: l2 for l1, l2 in zip(ascii_uppercase,
random.sample(ascii_uppercase, k=26))}
return ''.join(new_alphabet.get(l, ... | true |
71e1b107fe74d920ba9cae9c3ef8b2ee6a059e9a | Python | ZucchiniZe/squadbot | /cogs/misc.py | UTF-8 | 765 | 2.84375 | 3 | [] | no_license | import discord
from discord.ext import commands
class Misc:
"""Misc commands"""
def __init__(self, bot):
self.bot = bot
@commands.command(pass_context=True)
async def msgcount(self, ctx):
"""Calculates the number of messages the caller has sent to the current channel"""
count... | true |
c0b811897a44cab30836aee54b0637f1421e8dc9 | Python | AnimaShadows/advent2020 | /solutions/day_1/day_1_p_2.py | UTF-8 | 858 | 3.78125 | 4 | [] | no_license | #!/usr/bin/python3
from array import *
def populate():
puzzle_input = []
f = open("puzzle_input.txt", "r")
for line in f:
puzzle_input.append(int(line))
f.close()
#print (puzzle_input)
return puzzle_input
def product2020(puzzle_input):
for i in range (0, len(puzzle_input)):
for ... | true |
fa6bf2a723601ba6acdcd43a95c33e1c47ec20ff | Python | tlouvart/Mater | /assets.py | UTF-8 | 731 | 2.859375 | 3 | [
"Apache-2.0"
] | permissive | import os
import pygame
# Assets
game_folder = os.path.dirname(__file__)
img_folder = os.path.join(game_folder, "img")
#config
WIN_NAME = "Mater"
WIN_RES = (1280,960)
WIN_VER = "1.0"
FPS = 20
# Sprite group
sprites_all = pygame.sprite.Group()
cars_all = pygame.sprite.Group()
blocks_all = pygame.... | true |
d459e751e78238363f11efb6b95afbd7f123f759 | Python | DIS-SIN/Asgard | /src/utils/logger/formatters.py | UTF-8 | 496 | 2.6875 | 3 | [
"MIT"
] | permissive |
from logging import Formatter
class SlackFormatter(Formatter):
def __init__(self, fmt = None, datefmt=None, style="%"):
if fmt is None and style == "%":
fmt = (
"LEVEL: %(levelname)s\n" +
"TIME: %(asctime)s\n" +
"FILENAMEL %(filename)s\n" +
... | true |
b740d2d98983ae316311e34927755ea52f03250f | Python | mvakkasoglu/PythonPractice | /identity_operators.py | UTF-8 | 421 | 4.875 | 5 | [] | no_license | # Identity operators are used to compare the objects, not if they are equal, but if they are actually the
# same object, with the same memory location:
x = 1
y = 1
if x is y: # same object
print("same object")
else:
print("not same object")
x = ["apple", "banana", "cherry"]
y = ["apple", "banana", "cherry"]
... | true |
8dc03723990d967043c035dc6cc06eaddcbd60f1 | Python | ahungrynacho/project-in-os | /project3/tables.py | UTF-8 | 878 | 2.921875 | 3 | [] | no_license | class SegmentTableEntry(object):
def __init__(self, seg_index, PT_addr):
self.seg_index = seg_index
self.PT_addr = PT_addr # Page Table address
def __str__(self):
return "({}, {})".format(self.seg_index, self.PT_addr)
class PageTableEntry(object):
def __init__(self, pa... | true |
ab2c1a261e1226eb83e4f8b9570ed07a74606f11 | Python | suraj-singh12/python-revision-track | /01-modules-cmnt-pip/01_04_print_dir_content.py | UTF-8 | 223 | 2.890625 | 3 | [] | no_license | '''
This program lists the contents of the directory mentioned by path variable
It uses os module to accomplish this
'''
import os
path = '/home/suraj/Documents/harry-python/01-modules-cmnt-pip/'
print(os.listdir(path))
| true |