first commit
commit
4d9979354c
|
@ -0,0 +1,199 @@
|
|||
|
||||
# Hype
|
||||
|
||||
|
||||
## About
|
||||
|
||||
A simple interface in flask and python3, to mange and get a status of my vm and lxc containers.
|
||||
|
||||
Using the python3-lxc and libvirt to communcate with lxc/kvm api.
|
||||
|
||||
Creation need also the lxc-templates.
|
||||
|
||||
|
||||
|
||||
![ScreenShot](./tools/images/screenshot.png)
|
||||
![ScreenShot2](./tools/images/Login.png)
|
||||
|
||||
|
||||
[![MIT License](https://img.shields.io/badge/License-MIT-green.svg)](https://choosealicense.com/licenses/mit/) [![GPLv3 License](https://img.shields.io/badge/License-GPL%20v3-yellow.svg)](https://opensource.org/licenses/) [![AGPL License](https://img.shields.io/badge/license-AGPL-blue.svg)](http://www.gnu.org/licenses/agpl-3.0)
|
||||
|
||||
|
||||
## Login
|
||||
|
||||
|
||||
Be carefull !!
|
||||
By default, the authentification is PAM.
|
||||
This PAM auth is based on the library [simplepam](https://github.com/leonnnn/python3-simplepam).
|
||||
This means that by default, the allowed users, are the user in the server.
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
Some requirements are needed :
|
||||
```sh
|
||||
|
||||
Ubuntu/Debian:
|
||||
|
||||
Using basic package in apt debian repositories.
|
||||
The script will install software dependencies, create a virtual environnement "hype_env" and download all Python dependancies in ths virtual env.
|
||||
|
||||
python3 -m venv hype_env --system-site-packages
|
||||
|
||||
Just launch the Debian install script :
|
||||
|
||||
In root or sudo user :
|
||||
root$ chmod +x Debian_install.sh
|
||||
root$ sh ./Debian_install.sh
|
||||
|
||||
```
|
||||
## Network
|
||||
|
||||
By default, Libvirt use a default network setting, creating a private LAN:
|
||||
|
||||
```ss
|
||||
<network>
|
||||
<name>default</name>
|
||||
<bridge name='virbr0'/>
|
||||
<forward/>
|
||||
<ip address='192.168.122.1' netmask='255.255.255.0'>
|
||||
<dhcp>
|
||||
<range start='192.168.122.2' end='192.168.122.254'/>
|
||||
</dhcp>
|
||||
</ip>
|
||||
</network>
|
||||
|
||||
```
|
||||
If you want the server to be linked to you LAN, create a Bridge interface.
|
||||
For example in Debian (here eth0 is the main interface)
|
||||
|
||||
In /etc/network/interface :
|
||||
|
||||
```sh
|
||||
|
||||
allow-hotplug eth0
|
||||
|
||||
auto br0
|
||||
iface br0 inet static
|
||||
bridge_ports eth0
|
||||
bridge_fd 0
|
||||
bridge_maxwait 0
|
||||
address 192.168.XX.XX
|
||||
netmask 255.255.255.0
|
||||
gateway 192.168.XX.XX
|
||||
|
||||
|
||||
```
|
||||
|
||||
Restart the network manager and check if you can see your interface called br0.
|
||||
|
||||
You have then, to create a bridge interface in Libvirt:
|
||||
|
||||
```sh
|
||||
|
||||
<network>
|
||||
<name>bridged</name>
|
||||
<forward mode="bridge" />
|
||||
<bridge name="br0" />
|
||||
</network>
|
||||
|
||||
|
||||
```
|
||||
Then enable anc activate this interface :
|
||||
|
||||
```sh
|
||||
virsh net-define bridge.xml
|
||||
virsh net-start bridged
|
||||
virsh net-autostart bridged
|
||||
```
|
||||
|
||||
Don't forget to map this network on Virtual Server Creation.
|
||||
|
||||
## Start
|
||||
|
||||
Debian install script, will create a virtual environement.
|
||||
To start in this venv :
|
||||
|
||||
```sh
|
||||
|
||||
#. hype_env/bin/activate
|
||||
(hype_env)#python3 hype.py
|
||||
|
||||
|
||||
Ensure that you are in the Virtal env, else you will not be able to user required python libs.
|
||||
```
|
||||
|
||||
Then go on your browser :
|
||||
|
||||
```sh
|
||||
http://{{IP}}:5005
|
||||
|
||||
```
|
||||
|
||||
## WebTerminal
|
||||
|
||||
The Containers are accessible thought a Web Terminal.
|
||||
|
||||
It use the librairy [PyXtermJS](https://github.com/cs01/pyxtermjs)
|
||||
|
||||
The install script will change :
|
||||
- host listening from 127.0.0.1 to 0.0.0.0
|
||||
|
||||
The install script will keep the previous files *.save.
|
||||
just move the .save to original name to rollback.
|
||||
|
||||
|
||||
## Port configuration
|
||||
|
||||
- By default, the script run :
|
||||
- 5005 for the website
|
||||
- 5000 for the Terminal interface
|
||||
- Please check your own configuration (firewall, proxy, reverse-proxy)
|
||||
|
||||
## Roadmap
|
||||
|
||||
- [x] Update Changelog
|
||||
- [x] Add Console
|
||||
- [x] Add VM
|
||||
- [x] Add Storage View
|
||||
- [x] Add ISO (upload/use)
|
||||
- [x] Add VM creation
|
||||
- [x] Add forced stop on VM (when shutdown is not enought)
|
||||
- [x] Add Snapshot Management:
|
||||
- [x] Creation
|
||||
- [x] Restore
|
||||
- [x] Delete
|
||||
- [x] Add Info:
|
||||
- [x] lxc/vm
|
||||
- [x] system ressources (?)
|
||||
- [x] Storage :
|
||||
- [x] improve Pool location
|
||||
- [x] Correct Pool issue in case of manual deletion
|
||||
- [x] Monitoring :
|
||||
- [x] improve CPU and RAM
|
||||
- [x] Network :
|
||||
- [x] Correct IPv4 issue for VM
|
||||
- [x] Interface :
|
||||
- [x] Adding Dashboard
|
||||
- [x] Drivers :
|
||||
- [x] Check CD Driver and manage it (add/remove/change)
|
||||
|
||||
To do :
|
||||
|
||||
- [ ] Console:
|
||||
- [ ] Improve Xterm integration to avoid many ports
|
||||
- [ ] Network :
|
||||
- [ ] Add IPv6 address
|
||||
- [ ] Add Interfaces
|
||||
|
||||
## Sources / Resources
|
||||
|
||||
LIBVIRT (KVM/QEMU)
|
||||
https://libvirt.org/
|
||||
|
||||
PYXTERMJS : virtual Terminal
|
||||
https://github.com/cs01/pyxtermjs
|
||||
|
||||
LXC
|
||||
https://linuxcontainers.org/lxc/
|
||||
https://github.com/lxc/python3-lxc
|
|
@ -0,0 +1,881 @@
|
|||
#!/usr/bin/python3
|
||||
import os
|
||||
import sys
|
||||
import lxc
|
||||
import time
|
||||
import datetime
|
||||
import math
|
||||
import pygal
|
||||
import psutil
|
||||
import logging
|
||||
import libvirt
|
||||
import collections
|
||||
collections.MutableSequence = collections.abc.MutableSequence
|
||||
collections.Iterable = collections.abc.Iterable
|
||||
from pygal.style import LightenStyle, LightColorizedStyle
|
||||
from flask import Flask, render_template, Response, request, redirect, url_for, session, escape
|
||||
from flask_fontawesome import FontAwesome
|
||||
from simplepam import authenticate
|
||||
from flask_navigation import Navigation
|
||||
from flask_dropzone import Dropzone
|
||||
from xml.dom import minidom
|
||||
|
||||
|
||||
|
||||
#Flask config
|
||||
flask_port=5005
|
||||
flask_host='0.0.0.0'
|
||||
flask_thread=True
|
||||
flask_debug=False
|
||||
#Other
|
||||
__version__ = "2.7"
|
||||
|
||||
#path base for service lauch
|
||||
path = os.path.dirname(__file__)
|
||||
|
||||
#iso path
|
||||
iso_path= path+'/storage/iso/'
|
||||
|
||||
#Language
|
||||
lang_created='had been created !'
|
||||
lang_stopped='had been stopped !'
|
||||
lang_forced_stop='Error on Stop, stop had been forced !'
|
||||
lang_started='had been started !'
|
||||
lang_destroyed='had been destroyed !'
|
||||
lang_console='is stopped, please start it first !'
|
||||
lang_console2='is started, please stop it first !'
|
||||
lang_uploaded='had been uploaded !'
|
||||
lang_openconsole='console can be opened in a new tab'
|
||||
lang_already_started='is already started !'
|
||||
lang_deleted='had been deleted !'
|
||||
lang_snapvm='have a new snapshot !'
|
||||
lang_snapvm_failed='had met an error. Snapshot failed !'
|
||||
|
||||
#Init logs
|
||||
logging.basicConfig(filename=path+'/log/Main-lxc.log', level=logging.DEBUG, format=f'%(asctime)s %(levelname)s %(name)s %(threadName)s : %(message)s')
|
||||
logging.info('PROGRAM START')
|
||||
#Init Libvirt
|
||||
try:
|
||||
conn = libvirt.open("qemu:///system")
|
||||
except:
|
||||
exit(1)
|
||||
#Init Flask
|
||||
app = Flask(__name__,static_url_path='',static_folder='web/static',template_folder='web/templates')
|
||||
#Init FontAwsome
|
||||
fa = FontAwesome(app)
|
||||
#Init Nav
|
||||
nav = Navigation(app)
|
||||
#DropZone
|
||||
app.config.update(
|
||||
UPLOADED_PATH= iso_path,
|
||||
DROPZONE_MAX_FILE_SIZE = 10240,
|
||||
DROPZONE_TIMEOUT = 5*60*1000,
|
||||
DROPZONE_ALLOWED_FILE_CUSTOM = True,
|
||||
DROPZONE_ALLOWED_FILE_TYPE = '.iso')
|
||||
dropzone = Dropzone(app)
|
||||
#Menu
|
||||
nav.Bar('top', [
|
||||
nav.Item('Dash', 'index'),
|
||||
nav.Item('State', 'state'),
|
||||
nav.Item('Build', 'build'),
|
||||
nav.Item('Storage','pool'),
|
||||
nav.Item('Monitoring','monit'),
|
||||
nav.Item('Backup','backup'),
|
||||
nav.Item('Host','host'),
|
||||
nav.Item('Logs','logs'),
|
||||
])
|
||||
|
||||
#Graf Pantone
|
||||
dark_lighten_style = LightenStyle('#336676', base_style=LightColorizedStyle, step=2,value_font_size=25)
|
||||
dark_lighten_style.background = 'transparent'
|
||||
|
||||
#Global fonctions
|
||||
def get_xml(VM):
|
||||
dom=conn.lookupByName(VM)
|
||||
raw_xml = dom.XMLDesc()
|
||||
xml = minidom.parseString(raw_xml)
|
||||
return xml
|
||||
|
||||
##
|
||||
@app.route('/del_snap_lxc', methods = ['POST'])
|
||||
def del_snap_lxc():
|
||||
cont=request.form['cont']
|
||||
conn=lxc.Container(cont)
|
||||
item=request.form['delete']
|
||||
item=item.split('_')[2]
|
||||
out=conn.snapshot_destroy(item)
|
||||
if out:
|
||||
resultats='<p id="alert" style="color:green"><b>'+item+'</b> had been deleted !</p>'
|
||||
else:
|
||||
resultats='<p id="alert" style="color:red"><b>'+item+'</b> could not been deleted !</p>'
|
||||
return render_template('backup.html',listlxc=get_lxc_list(),listvm=list_full_vm(),loguser=session['username'],alertmessage=resultats)
|
||||
|
||||
@app.route('/rest_snap_lxc', methods = ['POST'])
|
||||
def rest_snap_lxc():
|
||||
cont=request.form['cont']
|
||||
ct=lxc.Container(cont)
|
||||
if ct.state=='RUNNING':
|
||||
resultats='<p id="alert" style="color:red"><b>'+cont+'</b>'+lang_console2+'</p>'
|
||||
else:
|
||||
item=request.form['restore']
|
||||
item=item.split('_')[2]
|
||||
out=ct.snapshot_restore(item)
|
||||
if out:
|
||||
resultats='<p id="alert" style="color:green"><b>'+item+'</b> had been restored !</p>'
|
||||
else:
|
||||
resultats='<p id="alert" style="color:red"><b>'+item+'</b> could not been restored !</p>'
|
||||
return render_template('backup.html',listlxc=get_lxc_list(),listvm=list_full_vm(),loguser=session['username'],alertmessage=resultats)
|
||||
|
||||
@app.route('/del_snap_vm', methods = ['POST'])
|
||||
def del_snap_vm():
|
||||
item=request.form['delete']
|
||||
cont=request.form['cont']
|
||||
dom=conn.lookupByName(cont)
|
||||
snap_2del=dom.snapshotLookupByName(item)
|
||||
out=snap_2del.delete()
|
||||
if out:
|
||||
resultats='<p id="alert" style="color:green"><b>'+item+'</b> had been deleted !</p>'
|
||||
else:
|
||||
resultats='<p id="alert" style="color:red"><b>'+item+'</b> could not been deleted !</>'
|
||||
return render_template('backup.html',listlxc=get_lxc_list(),listvm=list_full_vm(),loguser=session['username'],alertmessage=resultats)
|
||||
|
||||
@app.route('/logs')
|
||||
def logs():
|
||||
if 'username' in session:
|
||||
resultats=''
|
||||
return render_template('logs.html',loguser=session['username'],alertmessage=resultats,state_all=get_lxc_state(),listlxc=get_lxc_list(),listdistrib=list_distrib())
|
||||
return render_template('login.html',title="Logs")
|
||||
|
||||
@app.route('/stream')
|
||||
def stream():
|
||||
def generate():
|
||||
with open(path+'/log/Main-lxc.log') as f:
|
||||
while True:
|
||||
yield f.read()
|
||||
time.sleep(1)
|
||||
return app.response_class(generate(), mimetype='text/plain')
|
||||
|
||||
@app.route('/host')
|
||||
def host():
|
||||
split_dec=conn.getSysinfo()
|
||||
split_dec=split_dec.replace('\n', '<br>')
|
||||
return render_template('host.html',loguser=session['username'],hostname=conn.getHostname(),hostlist=split_dec,title="Host")
|
||||
|
||||
def host_disk():
|
||||
KB = 1024
|
||||
MB = 1024 * KB
|
||||
GB = 1024 * MB
|
||||
host_disk_total = round(psutil.disk_usage('/').total / GB)
|
||||
host_disk_used = round(psutil.disk_usage('/').used / GB)
|
||||
host_disk_percent = psutil.disk_usage('/').percent
|
||||
host_disk_free = host_disk_total - host_disk_used
|
||||
host_disk_free_percent = round(100 - host_disk_percent,1)
|
||||
return host_disk_total, host_disk_used, host_disk_percent, host_disk_free, host_disk_free_percent
|
||||
|
||||
|
||||
|
||||
def convert_size(bytes_size):
|
||||
if bytes_size == 0:
|
||||
return "0B"
|
||||
size_name = ("B", "KB", "MB", "GB", "TB", "PB")
|
||||
i = int(math.floor(math.log(bytes_size, 1024)))
|
||||
p = math.pow(1024, i)
|
||||
s = round(bytes_size / p, 2)
|
||||
return"%s %s" % (s,size_name[i])
|
||||
|
||||
def get_cdrom_attribut(VM):
|
||||
xml = get_xml(VM)
|
||||
diskTypes = xml.getElementsByTagName('disk')
|
||||
for disk_xml in diskTypes:
|
||||
if disk_xml.getAttribute('device') == 'cdrom':
|
||||
target_tag = disk_xml.getElementsByTagName('target')
|
||||
address_tag = disk_xml.getElementsByTagName('address')
|
||||
target_dev = target_tag[0].getAttribute('dev')
|
||||
target_bus = target_tag[0].getAttribute('bus')
|
||||
address_type = address_tag[0].getAttribute('type')
|
||||
address_controller = address_tag[0].getAttribute('controller')
|
||||
address_bus = address_tag[0].getAttribute('bus')
|
||||
address_target = address_tag[0].getAttribute('target')
|
||||
address_unit = address_tag[0].getAttribute('unit')
|
||||
return target_dev, target_bus, address_type, address_controller, address_bus, address_target, address_unit
|
||||
|
||||
def mount_iso(VM,ISO):
|
||||
dom = conn.lookupByName(VM)
|
||||
target_dev, target_bus, address_type, address_controller, address_bus, address_target, address_unit = get_cdrom_attribut(VM)
|
||||
diskFile = ISO
|
||||
diskXML = """ <disk type='file' device='cdrom'>
|
||||
<driver name='qemu' type='raw'/>
|
||||
<source file='""" + diskFile + """'/>
|
||||
<target dev='""" + target_dev + """' bus='""" + target_bus + """'/>
|
||||
<address type='""" + address_type + """' controller='""" + address_controller + """' bus='""" + address_bus + """' target='""" + address_target + """' unit='""" + address_unit + """'/>
|
||||
</disk>"""
|
||||
dom.updateDeviceFlags(diskXML, 0)
|
||||
|
||||
def check_iso_is_mounted(VM):
|
||||
dom = conn.lookupByName(VM)
|
||||
raw_xml = dom.XMLDesc()
|
||||
xml = minidom.parseString(raw_xml)
|
||||
diskTypes = xml.getElementsByTagName('disk')
|
||||
for disk_xml in diskTypes:
|
||||
disk = None
|
||||
source = disk_xml.getElementsByTagName('source')
|
||||
if disk_xml.getAttribute('device') == 'cdrom':
|
||||
try:
|
||||
gotdata= source[0].getAttribute('file')
|
||||
if source[0].getAttribute('file'):
|
||||
state = 1
|
||||
else:
|
||||
state = 0
|
||||
except IndexError:
|
||||
state = 0
|
||||
#Return 1 if mounted or 0 if not mounted
|
||||
return state
|
||||
|
||||
@app.route("/mountiso", methods=['POST'])
|
||||
def mountiso():
|
||||
VM=request.form['vm']
|
||||
ISO=iso_path+request.form['iso']
|
||||
mount_iso(VM,ISO)
|
||||
resultats='<p id="alert" style="color:green">ISO mounted !</p>'
|
||||
return render_template('build.html',listvm=list_activ_vm(),list_net=conn.listNetworks(),listvm_iso=get_iso_list(),list_profiles=get_os_profile_list(),list_iso=get_iso_list(),list_iso_mount=get_iso_list(),loguser=session['username'],alertmessage=resultats,state_all=get_vm_state(),title="Build",listlxc=get_lxc_list(),listdistrib=list_distrib())
|
||||
|
||||
@app.route('/ejectiso', methods = ['POST'])
|
||||
def eject_iso():
|
||||
VM=request.form['ejectisovm']
|
||||
state = check_iso_is_mounted(VM)
|
||||
while state != 0:
|
||||
ISO='';
|
||||
mount_iso(VM,ISO)
|
||||
state = check_iso_is_mounted(VM)
|
||||
resultats='<p id="alert" style="color:green">ISO had been ejected !</p>'
|
||||
return render_template('state.html',loguser=session['username'],alertmessage=resultats,state_all='<div class="card"><div class="card-header">Containers</div><div class="card-body">'+get_lxc_state()+'</div></div><div class="card"><div class="card-header">Virtual Servers</div><div class="card-body">'+get_vm_state()+"</div></div>",title="State",listlxc=get_lxc_list(),listdistrib=list_distrib())
|
||||
|
||||
def get_vm_devices(VM):
|
||||
xml = get_xml(VM)
|
||||
diskTypes = xml.getElementsByTagName("disk")
|
||||
full_list=[]
|
||||
for diskType in diskTypes:
|
||||
list_vm=[]
|
||||
list_vm.append(diskType.getAttribute("device"))
|
||||
diskNodes = diskType.childNodes
|
||||
for diskNode in diskNodes:
|
||||
if diskNode.nodeName[0:1] != "#":
|
||||
if diskNode.nodeName=='source':
|
||||
for attr in diskNode.attributes.keys():
|
||||
list_vm.append(diskNode.attributes[attr].value)
|
||||
full_list.append(list_vm)
|
||||
full_list.reverse()
|
||||
return full_list
|
||||
|
||||
@app.route('/devicelist', methods = ['POST'])
|
||||
def get_devices():
|
||||
list_devices=[]
|
||||
full_vm_list=list_activ_vm()+list_inactiv_vm()
|
||||
for vm_name in full_vm_list:
|
||||
list_vm=get_vm_devices(vm_name)
|
||||
list_vm.insert(0, vm_name)
|
||||
list_devices.append(list_vm)
|
||||
return list_devices
|
||||
|
||||
|
||||
def storage_get_pool():
|
||||
pool_html='<table class="table table-responsive table-condensed align-middle mb-0"><tr>'
|
||||
##Cleaning Pool cache to avoid error due to deleted entries
|
||||
for refresh_pool in conn.listAllStoragePools():
|
||||
refresh_pool.refresh(0)
|
||||
for pools in conn.listStoragePools():
|
||||
pool = conn.storagePoolLookupByName(pools)
|
||||
info = pool.info()
|
||||
if info[1]==0:
|
||||
pool_used=0
|
||||
else:
|
||||
pool_used=round((info[2]*100)/info[1],2)
|
||||
pool_free=100-pool_used
|
||||
graf_pool=pygal.Pie(value_font_size=25,half_pie = True,fill=True, interpolate='cubic', style=dark_lighten_style, legend_at_bottom=True,show_legend=False)
|
||||
graf_pool.add("Used",pool_used)
|
||||
graf_pool.add("Free",pool_free)
|
||||
graf_pool=graf_pool.render_data_uri()
|
||||
pool_html=pool_html+"<td><img src='"+graf_pool+"' style='width:200px'><br>Pool: <b>"+pool.name()+"</b><br>UUID: "+pool.UUIDString()+"<br>Autostart: "+str(pool.autostart())+"<br>Is active: "+str(pool.isActive())+"<br>Is persistent: "+str(pool.isPersistent())+"<br>Num volumes: "+str(pool.numOfVolumes())+"<br>Pool state: "+str(info[0])+"<br>Capacity: "+str(convert_size(info[1]))+"<br>Allocation: "+str(convert_size(info[2]))+"<br>Available: "+str(convert_size(info[3]))+'</td>'
|
||||
pool_html=pool_html+'</tr></table>'
|
||||
return pool_html
|
||||
|
||||
@app.route('/delvol', methods = ['POST'])
|
||||
def dellvol():
|
||||
pool_item=request.form['pool']
|
||||
volume_item=request.form['volume']
|
||||
pools=conn.storagePoolLookupByName(pool_item)
|
||||
vlm=pools.storageVolLookupByName(volume_item)
|
||||
vlm.delete()
|
||||
return redirect(url_for('pool'))
|
||||
|
||||
def storage_get_volumes():
|
||||
volume_html='<table class="table table-responsive table-hover table-condensed align-middle mb-0 bg-white"><tr><th>Pool</th><th>Volume Name</th><th>Capacity</th><th>Allocation</th><th>Delete</th><th>Chart</th></tr>'
|
||||
##Cleaning Pool cache to avoid error due to deleted entries
|
||||
for refresh_pool in conn.listAllStoragePools():
|
||||
refresh_pool.refresh(0)
|
||||
|
||||
for pools in conn.listStoragePools():
|
||||
pool=conn.storagePoolLookupByName(pools)
|
||||
for volume in pool.listVolumes():
|
||||
vol = pool.storageVolLookupByName(volume)
|
||||
info = vol.info()
|
||||
if info[1]==0:
|
||||
vol_used=0
|
||||
else:
|
||||
vol_used=round((info[2]*100)/info[1],2)
|
||||
vol_free=100-vol_used
|
||||
vol_graf=pygal.Pie(value_font_size=25,half_pie = True,fill=True, interpolate='cubic', style=dark_lighten_style, show_legend=False)
|
||||
vol_graf.add("Used",vol_used)
|
||||
vol_graf.add("Free",vol_free)
|
||||
vol_graf=vol_graf.render_data_uri()
|
||||
volume_html=volume_html+"<tr><td>"+pools+"</td><td>"+volume+"</td><td>"+str(convert_size(info[1]))+"</td><td>"+ str(convert_size(info[2]))+"</td><td>"
|
||||
volume_html=volume_html+"<form action=\"/delvol\" method=\"post\"><input type=\"hidden\" name=\"pool\" value=\""+pools+"\"><button type=\"submit\" name=\"volume\" value=\""+volume+"\"><span class=\"fas fa-trash\"></span></button></form></td><td><img src='"+vol_graf+"' style='width:40px'></tr>"
|
||||
volume_html=volume_html+"</table>"
|
||||
return volume_html
|
||||
|
||||
def global_cpu_monit():
|
||||
cpu_percent_used=psutil.cpu_percent()
|
||||
cpu_percent_free=100-cpu_percent_used
|
||||
cpu_usage=psutil.cpu_times_percent()
|
||||
cpu_usage_html="Kernel: "+str(cpu_usage.system)+"%<br>User: "+str(cpu_usage.user)+"%<br>Idle: "+str(cpu_usage.idle)+"%<br>IO wait: "+str(cpu_usage.iowait)+"%<br>"
|
||||
return cpu_usage_html, cpu_percent_used, cpu_percent_free
|
||||
|
||||
def global_mem_monit():
|
||||
mem_percent_used=psutil.virtual_memory().percent
|
||||
mem_percent_free=100-mem_percent_used
|
||||
memory_usage= conn.getMemoryStats(libvirt.VIR_NODE_MEMORY_STATS_ALL_CELLS)
|
||||
memory_usage_html="Total: "+str(convert_size(memory_usage['total']*1024))+"<br>Free: "+str(convert_size(memory_usage['free']*1024))+"<br>Buffers: "+str(convert_size(memory_usage['buffers']*1024))+"<br>Cached: "+str(convert_size(memory_usage['cached']*1024))+"<br>".format(**memory_usage)
|
||||
return memory_usage_html, mem_percent_used, mem_percent_free
|
||||
|
||||
def vm_monit():
|
||||
vm_monit_html='<table class="table table-responsive table-hover table-condensed align-middle mb-0"><tr><th>Nom</th><th>State</th></tr>'
|
||||
full_vm_list=list_activ_vm()+list_inactiv_vm()
|
||||
for vm_name in full_vm_list:
|
||||
dom=conn.lookupByName(vm_name)
|
||||
state, maxmem, mem, cpus, cput = dom.info()
|
||||
if state==1:
|
||||
state="RUNNING"
|
||||
else:
|
||||
state="STOPPED"
|
||||
vm_monit_html=vm_monit_html+"<tr><td>"+dom.name()+"<td>"+str(state)+"<br>Max memory : "+ str(convert_size(maxmem*1024))+"<br>Memory : "+ str(convert_size(mem*1024))
|
||||
vm_monit_html=vm_monit_html+"<br>CPU number : "+str(cpus)+"<br>CPU time : "+str(cput)+"</td></tr>"
|
||||
vm_monit_html=vm_monit_html+"</table>"
|
||||
return vm_monit_html
|
||||
|
||||
def lxc_monit():
|
||||
ct_monit_html='<table class="table table-responsive table-hover table-condensed align-middle mb-0"><tr><th>Nom</th><th>State</th></tr>'
|
||||
for lxc_name in get_lxc_list():
|
||||
ct=lxc.Container(lxc_name)
|
||||
if ct.state=='RUNNING':
|
||||
p=psutil.Process(ct.init_pid)
|
||||
ct_cpu=str(round(p.cpu_percent(), 2))
|
||||
ct_meme=str(round(p.memory_percent(), 2))
|
||||
else:
|
||||
ct_meme='0'
|
||||
ct_cpu='0'
|
||||
ct_monit_html=ct_monit_html+"<tr><td>"+lxc_name+"<td>"+ct.state+"<br>Memory : "+ct_meme+"%"
|
||||
ct_monit_html=ct_monit_html+"<br>CPU : "+ct_cpu+"%</td></tr>"
|
||||
ct_monit_html=ct_monit_html+"</table>"
|
||||
return ct_monit_html
|
||||
|
||||
def list_activ_vm():
|
||||
list_run_id=conn.listDomainsID()
|
||||
list_run=[]
|
||||
for id in list_run_id:
|
||||
dom=conn.lookupByID(id)
|
||||
list_run.append(dom.name())
|
||||
return list_run
|
||||
|
||||
def list_inactiv_vm():
|
||||
list_vm=conn.listDefinedDomains()
|
||||
return list_vm
|
||||
|
||||
def list_full_vm():
|
||||
full_vm_list=list_activ_vm()+list_inactiv_vm()
|
||||
return full_vm_list
|
||||
|
||||
def list_distrib():
|
||||
link_list = ['debian','ubuntu','centos','busybox','ubuntu-cloud','cirros','sabayon']
|
||||
name_list = ['Debian','Ubuntu','Centos','Busybox','Ubuntu-cloud','Cirros','Sabayon']
|
||||
listd = zip(name_list, link_list)
|
||||
return listd
|
||||
|
||||
def get_iso_list():
|
||||
list_iso_path= []
|
||||
list_iso_size= []
|
||||
for x in os.listdir(iso_path):
|
||||
if x.endswith(".iso"):
|
||||
size=os.path.getsize(iso_path+x)
|
||||
size=convert_size(size)
|
||||
list_iso_size.append(str(size))
|
||||
list_iso_path.append(str(x))
|
||||
list_iso=zip(list_iso_path, list_iso_size)
|
||||
return list_iso
|
||||
|
||||
def get_os_profile_list():
|
||||
list_profile=[]
|
||||
for profile in os.popen("osinfo-query os | awk '{ print $1 }' | awk 'NR > 2 { print }'"):
|
||||
list_profile.append(str(profile))
|
||||
return list_profile
|
||||
|
||||
def get_lxc_list():
|
||||
liste_ct=lxc.list_containers()
|
||||
return liste_ct
|
||||
|
||||
def get_lxc_activ():
|
||||
activ_ct = 0
|
||||
inactiv_ct = 0
|
||||
for ct_name in get_lxc_list():
|
||||
ct_state=lxc.Container(ct_name)
|
||||
if ( ct_state.state == "RUNNING"):
|
||||
activ_ct +=1
|
||||
else:
|
||||
inactiv_ct +=1
|
||||
return activ_ct,inactiv_ct
|
||||
|
||||
def get_lxc_state():
|
||||
out=''
|
||||
for ct_name in get_lxc_list():
|
||||
ct_state=lxc.Container(ct_name)
|
||||
if ( ct_state.state == "RUNNING"):
|
||||
color_ct_state='<p style="background-color:PaleGreen">'+ct_state.state+'</p>'
|
||||
else:
|
||||
color_ct_state='<p style="background-color:lightcoral">'+ct_state.state+'</p>'
|
||||
out=out+'<tr><td>'+ct_name+'</td><td>'
|
||||
out=out+color_ct_state+'</td><td><div id="action"><center><table class="tacs"><tr><td><form action="/startct" method="post"><button type="submit" value="'+ct_name+'" name="start" onclick="loading();">'
|
||||
out=out+'<span class="fas fa-play"></span></button></form></td><td><form class="flotte" action="/stopct" method="post"><button type="submit" value="'+ct_name+'" name="stop" onclick="loading();">'
|
||||
out=out+'<span class="fas fa-stop"></span></button></form></td><td><form class="flotte" action="/destroyct" method="post"><button type="submit" value="'+ct_name+'" name="destroy" onclick="loading();">'
|
||||
out=out+'<span class="fas fa-trash"></span></button></form></td><td><form class="flotte" action="/console" method="post"><button type="submit" value="'+ct_name+'" name="console" onclick="loading();">'
|
||||
out=out+'<span class="fas fa-terminal"></span></button></form></td></tr></table></center></div></td><td>'
|
||||
out=out+str(ct_state.get_ips()).replace('(', '').replace(')', '').replace(',', '').replace('\'', '')+'</td></tr>'
|
||||
out='<table class="table table-responsive table-hover table-condensed align-middle mb-0 bg-white"><tr><th>Name</th><th>State</th><th>Actions</th><th>IP</th></tr>'+out+'</table>'
|
||||
return out
|
||||
|
||||
def get_snap_list_lxc(cont):
|
||||
dom=lxc.Container(cont)
|
||||
list_snap_lxc = dom.snapshot_list()
|
||||
out=[]
|
||||
for snap in list_snap_lxc:
|
||||
nom_snap=snap[0]
|
||||
date_snap=datetime.datetime.strptime(snap[2], '%Y:%m:%d %H:%M:%S')
|
||||
date_snap=date_snap.strftime("%d%m%Y%H%M")
|
||||
concat_name=dom.name+"_"+date_snap+"_"+nom_snap
|
||||
out.append(concat_name)
|
||||
return out
|
||||
|
||||
def get_snap_list_vm(cont):
|
||||
dom=conn.lookupByName(cont)
|
||||
list_snap_vm=dom.snapshotListNames()
|
||||
list_snap_vm.reverse()
|
||||
out=[]
|
||||
for snap in list_snap_vm:
|
||||
out.append(snap)
|
||||
return out
|
||||
|
||||
def get_vm_ips(vm):
|
||||
dom=conn.lookupByName(vm)
|
||||
if not dom:
|
||||
raise SystemExit("Failed to connect to Dom")
|
||||
try:
|
||||
ifaces = dom.interfaceAddresses(libvirt.VIR_DOMAIN_INTERFACE_ADDRESSES_SRC_AGENT)
|
||||
except:
|
||||
ifaces = None
|
||||
result="--.--.--.--"
|
||||
if ifaces is None:
|
||||
result="--.--.--.--"
|
||||
else:
|
||||
for (name, val) in ifaces.items():
|
||||
if val['addrs']:
|
||||
for addr in val['addrs']:
|
||||
if addr['addr']:
|
||||
result=str(addr['addr'])+"/"+str(addr['prefix'])
|
||||
break
|
||||
else:
|
||||
result="-"
|
||||
return result
|
||||
|
||||
def get_vm_state():
|
||||
out=''
|
||||
for activ_vm in list_activ_vm():
|
||||
disk_state=check_iso_is_mounted(activ_vm)
|
||||
if disk_state == 1:
|
||||
disk_color='<p style="color:black"><form class="flotte" action="/ejectiso" method="post"><span class="fas fa-compact-disc"></span></p></td><td><form class="flotte" action="/ejectiso" method="post"><button style="border:0" type="submit" value="'+activ_vm+'" name="ejectisovm" onclick="loading();"><span class="fas fa-eject"></span></button></form>'
|
||||
else:
|
||||
disk_color='<p style="color:LightGray"><span class="fas fa-compact-disc"></span></p></td><td>'
|
||||
color_vm_state='<p style="background-color:PaleGreen">RUNNING</p>'
|
||||
out=out+'<tr><td>'+activ_vm+'</td><td>'
|
||||
out=out+color_vm_state+'</td><td><div id="action"><center><table class="tacs"><tr><td><form action="/startvm" method="post"><button type="submit" value="'+activ_vm+'" name="startvm" onclick="loading();">'
|
||||
out=out+'<span class="fas fa-play"></span></button></form></td><td><form class="flotte" action="/stopvm" method="post"><button type="submit" value="'+activ_vm+'" name="stopvm" onclick="loading();">'
|
||||
out=out+'<span class="fas fa-stop"></span></button></form></td><td><form class="flotte" action="/destroyvm" method="post"><button type="submit" value="'+activ_vm+'" name="destroyvm" onclick="loading();">'
|
||||
out=out+'<span class="fas fa-trash"></span></button></form></td><td><form class="flotte" action="/consolevm" method="post"><button type="submit" value="'+activ_vm+'" name="consolevm" onclick="loading();">'
|
||||
out=out+'<span class="fas fa-terminal"></span></button></form></td></tr></table></center></div></td><td>'
|
||||
out=out+get_vm_ips(activ_vm)+'</td><td>'+disk_color+'</td></tr>'
|
||||
for inactiv_vm in list_inactiv_vm():
|
||||
color_vm_state='<p style="background-color:lightcoral">STOPPED</p>'
|
||||
out=out+'<tr><td>'+inactiv_vm+'</td><td>'
|
||||
out=out+color_vm_state+'</td><td><div id="action"><center><table class="tacs"><tr><td><form action="/startvm" method="post"><button type="submit" value="'+inactiv_vm+'" name="startvm" onclick="loading();">'
|
||||
out=out+'<span class="fas fa-play"></span></button></form></td><td><form class="flotte" action="/stopvm" method="post"><button type="submit" value="'+inactiv_vm+'" name="stopvm" onclick="loading();">'
|
||||
out=out+'<span class="fas fa-stop"></span></button></form></td><td><form class="flotte" action="/destroyvm" method="post"><button type="submit" value="'+inactiv_vm+'" name="destroyvm" onclick="loading();">'
|
||||
out=out+'<span class="fas fa-trash"></span></button></form></td><td><form class="flotte" action="/consolevm" method="post"><button type="submit" value="'+inactiv_vm+'" name="consolevm" onclick="loading();">'
|
||||
out=out+'<span class="fas fa-terminal"></span></button></form></td></tr></table></center></div></td><td>'
|
||||
out=out+'IP</td><td></td></tr>'
|
||||
out='<table class="table table-responsive table-hover table-condensed align-middle mb-0 bg-white"><tr><th>Name</th><th>State</th><th>Actions</th><th>IP</th><th>Disk</th></tr>'+out+'</table>'
|
||||
return out
|
||||
|
||||
def mount_pts():
|
||||
os.system('mount -o remount,rw /dev/pts')
|
||||
|
||||
@app.route('/state')
|
||||
def state():
|
||||
resultats=''
|
||||
return render_template('state.html',loguser=session['username'],alertmessage=resultats,state_all='<div class="card"><div class="card-header">Containers</div><div class="card-body">'+get_lxc_state()+'</div></div><div class="card"><div class="card-header">Virtual Servers</div><div class="card-body">'+get_vm_state()+"</div></div>",title="State",listlxc=get_lxc_list(),listdistrib=list_distrib())
|
||||
|
||||
@app.route('/snap_vm', methods = ['POST'])
|
||||
def create_snap():
|
||||
nom = request.form['nom']
|
||||
dom=conn.lookupByName(nom)
|
||||
actual_date=datetime.datetime.now()
|
||||
actual_date=actual_date.strftime("%d%m%Y%H%M")
|
||||
snapshot_name= dom.name()+"_"+actual_date+"_snap"
|
||||
SNAPSHOT_XML_TEMPLATE = """<domainsnapshot>
|
||||
<name>{snapshot_name}</name>
|
||||
</domainsnapshot>"""
|
||||
dom.snapshotCreateXML(SNAPSHOT_XML_TEMPLATE.format(snapshot_name=snapshot_name),libvirt.VIR_DOMAIN_SNAPSHOT_CREATE_ATOMIC)
|
||||
if dom.snapshotCurrent().getName()==snapshot_name:
|
||||
resultats='<p id="alert" style="color:green"><b>'+nom+'</b> '+lang_snapvm+'</p>'
|
||||
else:
|
||||
resultats='<p id="alert" style="color:red"><b>'+nom+'</b> '+lang_snapvm_failed+'</p>'
|
||||
return render_template('backup.html',listlxc=list_snap_lxc,listvm=list_snap_vm,loguser=session['username'],alertmessage=resultats)
|
||||
|
||||
@app.route('/snap_lxc', methods = ['POST'])
|
||||
def create_snap_lxc():
|
||||
nom = request.form['nom']
|
||||
cont=lxc.Container(nom)
|
||||
if ( cont.state == "STOPPED"):
|
||||
try:
|
||||
snap=cont.snapshot()
|
||||
resultats='<p id="alert" style="color:green"><b>'+nom+'</b> '+lang_snapvm+'</p>'
|
||||
except:
|
||||
resultats='<p id="alert" style="color:red"><b>'+nom+'</b> Snapshot Failed !</p>'
|
||||
else:
|
||||
resultats='<p id="alert" style="color:red"><b>'+nom+'</b> Should be stopped first !</p>'
|
||||
full_snap_lxc=[]
|
||||
full_snap_vm=[]
|
||||
for int in get_lxc_list():
|
||||
if get_snap_list_lxc(int):
|
||||
full_snap_lxc.append(get_snap_list_lxc(int))
|
||||
else:
|
||||
full_snap_lxc.append('')
|
||||
for ant in list_full_vm():
|
||||
if get_snap_list_vm(ant):
|
||||
full_snap_vm.append(get_snap_list_vm(ant))
|
||||
else:
|
||||
full_snap_vm.append('')
|
||||
list_snap_lxc = zip(get_lxc_list(), full_snap_lxc)
|
||||
list_snap_vm = zip(list_full_vm(), full_snap_vm)
|
||||
return render_template('backup.html',listlxc=list_snap_lxc,listvm=list_snap_vm,loguser=session['username'],alertmessage=resultats)
|
||||
|
||||
@app.route('/backup')
|
||||
def backup():
|
||||
resultats=''
|
||||
full_snap_lxc=[]
|
||||
full_snap_vm=[]
|
||||
for int in get_lxc_list():
|
||||
if get_snap_list_lxc(int):
|
||||
full_snap_lxc.append(get_snap_list_lxc(int))
|
||||
else:
|
||||
full_snap_lxc.append('')
|
||||
for ant in list_full_vm():
|
||||
if get_snap_list_vm(ant):
|
||||
full_snap_vm.append(get_snap_list_vm(ant))
|
||||
else:
|
||||
full_snap_vm.append('')
|
||||
list_snap_lxc = zip(get_lxc_list(), full_snap_lxc)
|
||||
list_snap_vm = zip(list_full_vm(), full_snap_vm)
|
||||
return render_template('backup.html',listlxc=list_snap_lxc,listvm=list_snap_vm,loguser=session['username'],alertmessage=resultats,title="Backups")
|
||||
|
||||
@app.route('/',methods = ['GET', 'POST'])
|
||||
def index():
|
||||
app.logger.info('Info level log')
|
||||
app.logger.warning('Warning level log')
|
||||
if 'username' in session:
|
||||
resultats=''
|
||||
global_cpu, cpu_percent_used, cpu_percent_free=global_cpu_monit()
|
||||
global_ram, mem_percent_used, mem_percent_free=global_mem_monit()
|
||||
activ_ct, inactiv_ct = get_lxc_activ()
|
||||
host_disk_total, host_disk_used, host_disk_percent, host_disk_free, host_disk_free_percent = host_disk()
|
||||
memory_usage= conn.getMemoryStats(libvirt.VIR_NODE_MEMORY_STATS_ALL_CELLS)
|
||||
memory_total=convert_size(memory_usage['total']*1024)
|
||||
memory_free=convert_size(memory_usage['free']*1024)
|
||||
memory_buffers=convert_size(memory_usage['buffers']*1024)
|
||||
memory_cached=convert_size(memory_usage['cached']*1024)
|
||||
|
||||
return render_template('index.html',host_disk_total=host_disk_total, host_disk_used=host_disk_used, host_disk_percent=host_disk_percent, host_disk_free=host_disk_free, host_disk_free_percent=host_disk_free_percent,hostname=conn.getHostname(),activ_vm=len(list_activ_vm()),inactiv_vm=len(list_inactiv_vm()),activ_ct=activ_ct,inactiv_ct=inactiv_ct,cpu_percent_used=cpu_percent_used,cpu_percent_free=cpu_percent_free,mem_percent_used=mem_percent_used,mem_percent_free=mem_percent_free,memory_total=memory_total,memory_free=memory_free,memory_buffers=memory_buffers,memory_cached=memory_cached,loguser=session['username'],title="Dashboard")
|
||||
return render_template('login.html',title="Welcome")
|
||||
|
||||
@app.route('/upload', methods = ['GET', 'POST'])
|
||||
def upload():
|
||||
resultats=''
|
||||
if request.method == 'POST':
|
||||
f = request.files.get('file')
|
||||
f.save(os.path.join(app.config['UPLOADED_PATH'],f.filename))
|
||||
resultats='<p id="alert" style="color:green"><b>'+f.filename+'</b> '+lang_uploaded+'</p>'
|
||||
return render_template('build.html',listvm=list_activ_vm(),list_net=conn.listNetworks(),listvm_iso=get_iso_list(),list_profiles=get_os_profile_list(),list_iso=get_iso_list(),list_iso_mount=get_iso_list(),loguser=session['username'],alertmessage=resultats,state_all=get_vm_state(),title="Build",listlxc=get_lxc_list(),listdistrib=list_distrib())
|
||||
|
||||
@app.route('/deliso', methods = ['POST'])
|
||||
def delete_iso():
|
||||
file=request.form['fichier']
|
||||
location = app.config['UPLOADED_PATH']
|
||||
path=os.path.join(location, file)
|
||||
os.remove(path)
|
||||
resultats='<p id="alert" style="color:green"><b>'+file+'</b> '+lang_deleted+'</p>'
|
||||
return render_template('build.html',listvm=list_activ_vm(),list_net=conn.listNetworks(),listvm_iso=get_iso_list(),list_profiles=get_os_profile_list(),list_iso=get_iso_list(),list_iso_mount=get_iso_list(),loguser=session['username'],alertmessage=resultats,state_all=get_vm_state(),title="Build",listlxc=get_lxc_list(),listdistrib=list_distrib())
|
||||
|
||||
@app.route('/build')
|
||||
def build():
|
||||
if 'username' in session:
|
||||
resultats=''
|
||||
return render_template('build.html',listvm=list_activ_vm(),list_net=conn.listNetworks(),listvm_iso=get_iso_list(),list_profiles=get_os_profile_list(),list_iso=get_iso_list(),list_iso_mount=get_iso_list(),loguser=session['username'],alertmessage=resultats,state_all=get_vm_state(),title="Build",listlxc=get_lxc_list(),listdistrib=list_distrib())
|
||||
return render_template('login.html')
|
||||
|
||||
@app.route('/monit')
|
||||
def monit():
|
||||
resultats=''
|
||||
global_cpu, cpu_percent_used, cpu_percent_free=global_cpu_monit()
|
||||
global_ram, mem_percent_used, mem_percent_free=global_mem_monit()
|
||||
return render_template('monit.html',lxc_monit=lxc_monit(),vm_monit=vm_monit(),global_cpu=global_cpu,global_memory=global_ram,cpu_percent_used=cpu_percent_used,cpu_percent_free=cpu_percent_free, mem_percent_used=mem_percent_used,mem_percent_free=mem_percent_free,loguser=session['username'],alertmessage=resultats,title="Monitoring")
|
||||
|
||||
@app.route('/pool')
|
||||
def pool():
|
||||
resultats=''
|
||||
return render_template('pool.html',volumes_det=storage_get_volumes(),pool_det=storage_get_pool(),loguser=session['username'],alertmessage=resultats,title="Pools")
|
||||
|
||||
@app.route("/creation", methods=['POST'])
|
||||
def create_CT():
|
||||
mount_pts()
|
||||
nom = request.form['nom']
|
||||
os = request.form['os']
|
||||
ip = request.form['ip']
|
||||
container=lxc.Container(nom)
|
||||
resultats=container.create(os)
|
||||
if request.form['ip']:
|
||||
file_object = open('/var/lib/lxc/'+nom+'/config', 'a')
|
||||
file_object.write('lxc.net.0.ipv4.address = '+ip+'\n')
|
||||
file_object.write('lxc.net.0.ipv4.gateway = auto')
|
||||
file_object.close()
|
||||
if ( resultats == True ):
|
||||
logging.info('CREATION - New contanier : '+nom+' - '+os+' ! ')
|
||||
resultats='<p id="alert" style="color:green"><b>'+nom+'</b> '+lang_created+'</p>'
|
||||
else:
|
||||
if len(nom.split()) > 1:
|
||||
logging.warning('CREATION FAILED - Too many word in <b>'+nom+'</b>, please use one word !')
|
||||
resultats='<p id="alert" style="color:red">Too many word in <b>'+nom+'</b>, please use only one word !</p>'
|
||||
else:
|
||||
logging.warning('CREATION FAILED - Error on <b>'+nom+'</b> creation : '+os+' !')
|
||||
resultats='<p id="alert" style="color:red">An Error append for <b>'+nom+'</b> !</p>'
|
||||
return render_template('build.html',listvm=list_activ_vm(),list_net=conn.listNetworks(),listvm_iso=get_iso_list(),list_profiles=get_os_profile_list(),list_iso=get_iso_list(),list_iso_mount=get_iso_list(),loguser=session['username'],alertmessage=resultats,state_all=get_vm_state(),title="Build",listlxc=get_lxc_list(),listdistrib=list_distrib())
|
||||
|
||||
@app.route("/creationvm", methods=['POST'])
|
||||
def create_VM():
|
||||
nom = request.form['nom']
|
||||
ram = request.form['ram']
|
||||
cpu = request.form['cpu']
|
||||
ose = request.form['os']
|
||||
iso = request.form['iso']
|
||||
iso = iso_path+iso
|
||||
net = request.form['net']
|
||||
disk = request.form['disk']
|
||||
os.system('kill -9 $(ps -edf | grep pyxter | grep -v grep | awk \'{ print $2 }\')')
|
||||
## VOIR TODO
|
||||
##VERSION SERIE
|
||||
# creationcmd='--name '+str(nom)+' --ram '+str(ram)+' --disk pool=default,size='+str(disk)+',bus=virtio,format=qcow2 --vcpus '+str(cpu)+' --os-type linux --os-variant '+str(ose)+' --network network:bridged --graphics none --console pty,target_type=serial --cdrom '+str(iso)+' --extra-args \'console=ttyS0,115200n8 serial\' --force --debug '
|
||||
# os.system('/usr/bin/python3 -m pyxtermjs --command "virt-install" --host 0.0.0.0 --cmd-args "'+creationcmd+'" &')
|
||||
##VERSION VNC
|
||||
creationcmd='--name '+str(nom)+' --ram '+str(ram)+' --disk pool=default,size='+str(disk)+',bus=virtio,format=qcow2 --vcpus '+str(cpu)+' --os-type linux --os-variant '+str(ose)+' --network network:bridged --graphics vnc,listen=0.0.0.0 --noautoconsole --console pty,target_type=serial --cdrom '+str(iso)+' --force --debug '
|
||||
os.system('virt-install'+creationcmd+'" &')
|
||||
##
|
||||
resultats='<p id="consolemessage" style="color:blue"><b>'+nom+'</b> '+lang_openconsole+'<button id="ModalBtn"><span class="fas fa-terminal"></span></button></p>'
|
||||
return render_template('build.html',listvm=list_activ_vm(),list_net=conn.listNetworks(),listvm_iso=get_iso_list(),list_profiles=get_os_profile_list(),list_iso=get_iso_list(),list_iso_mount=get_iso_list(),loguser=session['username'],alertmessage=resultats,state_all=get_vm_state(),title="Build",listlxc=get_lxc_list(),listdistrib=list_distrib())
|
||||
|
||||
@app.route("/console",methods=['POST'])
|
||||
def console():
|
||||
mount_pts()
|
||||
plx_console = request.form['console']
|
||||
plx_console_state=lxc.Container(plx_console)
|
||||
if ( plx_console_state.state == "STOPPED"):
|
||||
resultats='<p id="alert" style="color:red"><b>'+plx_console+'</b> '+lang_console+' </p>'
|
||||
return render_template('state.html',loguser=session['username'],alertmessage=resultats,state_all='<div class="card"><div class="card-header">Container</div><div class="card-body">'+get_lxc_state()+'</div></div><div class="card"><div class="card-header">Virtual Server</div><div class="card-body">'+get_vm_state()+"</div></div>",title="State",listlxc=get_lxc_list(),listdistrib=list_distrib())
|
||||
os.system('kill -9 $(ps -edf | grep pyxter | grep -v grep | awk \'{ print $2 }\')')
|
||||
os.system('/usr/bin/python3 -m pyxtermjs --command "lxc-attach" --cmd-args '+plx_console+' &')
|
||||
time.sleep(2)
|
||||
self_url=request.url_root
|
||||
self_url=self_url.split(":")[1]
|
||||
resultats='<p id="consolemessage" style="color:blue"><b>'+plx_console+'</b> '+lang_openconsole+'<button id="ModalBtn"><span class="fas fa-terminal"></span></button></p>'
|
||||
return render_template('state.html',loguser=session['username'],alertmessage=resultats,state_all='<div class="card"><div class="card-header">Container</div><div class="card-body">'+get_lxc_state()+'</div></div><div class="card"><div class="card-header">Virtual Server</div><div class="card-body">'+get_vm_state()+"</div></div>",title="State",listlxc=get_lxc_list(),listdistrib=list_distrib())
|
||||
|
||||
@app.route("/consolevm",methods=['POST'])
|
||||
def consolevm():
|
||||
vm_console = request.form['consolevm']
|
||||
dom=conn.lookupByName(vm_console)
|
||||
if not conn:
|
||||
raise SystemExit("Failed to open connection to Dom")
|
||||
if dom.isActive():
|
||||
os.system('kill -9 $(ps -edf | grep pyxter | grep -v grep | awk \'{ print $2 }\')')
|
||||
os.system('/usr/bin/python3 -m pyxtermjs --command "virsh" --cmd-args "console '+vm_console+'" &')
|
||||
time.sleep(2)
|
||||
resultats='<p id="consolemessage" style="color:blue"><b>'+vm_console+'</b> '+lang_openconsole+'<button id="ModalBtn"><span class="fas fa-terminal"></span></button></p>'
|
||||
|
||||
else:
|
||||
resultats='<p id="alert" style="color:red"><b>'+vm_console+'</b> '+lang_console+'</p>'
|
||||
return render_template('state.html',loguser=session['username'],alertmessage=resultats,state_all='<div class="card"><div class="card-header">Containers</div><div class="card-body">'+get_lxc_state()+'</div></div><div class="card"><div class="card-header">Virtual Servers</div><div class="card-body">'+get_vm_state()+"</div></div>",title="State",listlxc=get_lxc_list(),listdistrib=list_distrib())
|
||||
|
||||
@app.route("/startct", methods=['POST'])
|
||||
def start_ct():
|
||||
mount_pts()
|
||||
nom = request.form['start']
|
||||
container=lxc.Container(nom)
|
||||
if container.state=='RUNNING':
|
||||
resultats='<p id="alert" style="color:blue"><b>'+nom+'</b> '+lang_already_started+'</p>';
|
||||
else:
|
||||
container.start()
|
||||
container.wait("RUNNING", 3)
|
||||
logging.info('START - Started '+nom+' !')
|
||||
resultats='<p id="alert" style="color:blue"><b>'+nom+'</b> '+lang_started+'</p>';
|
||||
return render_template('state.html',loguser=session['username'],alertmessage=resultats,state_all='<div class="card"><div class="card-header">Containers</div><div class="card-body">'+get_lxc_state()+'</div></div><div class="card"><div class="card-header">Virtual Servers</div><div class="card-body">'+get_vm_state()+"</div></div>",title="State",listlxc=get_lxc_list(),listdistrib=list_distrib())
|
||||
|
||||
@app.route("/stopct", methods=['POST'])
|
||||
def stop_ct():
|
||||
nom = request.form['stop']
|
||||
container=lxc.Container(nom)
|
||||
container.stop()
|
||||
container.wait("STOPPED", 3)
|
||||
logging.info('STOP - Stopped '+nom+' !')
|
||||
resultats='<p id="alert" style="color:blue"><b>'+nom+'</b> '+lang_stopped+'</p>';
|
||||
return render_template('state.html',loguser=session['username'],alertmessage=resultats,state_all='<div class="card"><div class="card-header">Containers</div><div class="card-body">'+get_lxc_state()+'</div></div><div class="card"><div class="card-header">Virtual Servers</div><div class="card-body">'+get_vm_state()+"</div></div>",title="State",listlxc=get_lxc_list(),listdistrib=list_distrib())
|
||||
|
||||
|
||||
@app.route("/startvm", methods=['POST'])
|
||||
def start_vm():
|
||||
nom=request.form['startvm']
|
||||
dom=conn.lookupByName(nom)
|
||||
if dom.isActive():
|
||||
resultats='<p id="alert" style="color:blue"><b>'+nom+'</b> '+lang_already_started+'</p>';
|
||||
logging.info('START VM - Already tarted '+nom+' !')
|
||||
else:
|
||||
dom.create()
|
||||
time.sleep(3)
|
||||
alive=0
|
||||
while alive < 3:
|
||||
if dom.isActive():
|
||||
alive=4
|
||||
else:
|
||||
logging.info('WAIT START VM - (TEST'+str(alive)+'/3)'+nom+' !')
|
||||
time.sleep(3)
|
||||
alive+=1
|
||||
logging.info('START VM - Started '+nom+' !')
|
||||
resultats='<p id="alert" style="color:blue"><b>'+nom+'</b> '+lang_started+'</p>';
|
||||
return render_template('state.html',loguser=session['username'],alertmessage=resultats,state_all='<div class="card"><div class="card-header">Containers</div><div class="card-body">'+get_lxc_state()+'</div></div><div class="card"><div class="card-header">Virtual Servers</div><div class="card-body">'+get_vm_state()+"</div></div>",title="State",listlxc=get_lxc_list(),listdistrib=list_distrib())
|
||||
|
||||
@app.route("/stopvm", methods=['POST'])
|
||||
def stop_vm():
|
||||
nom=request.form['stopvm']
|
||||
dom=conn.lookupByName(nom)
|
||||
dom.shutdown()
|
||||
time.sleep(3)
|
||||
alive=0
|
||||
while alive < 5:
|
||||
if dom.isActive():
|
||||
logging.info('WAIT STOP VM - (TEST'+str(alive)+'/5)'+nom+' !')
|
||||
time.sleep(3)
|
||||
alive+=1
|
||||
else:
|
||||
alive=6
|
||||
resultats='<p id="alert" style="color:blue"><b>'+nom+'</b> '+lang_stopped+'</p>';
|
||||
logging.info('STOP VM - Stopped'+nom+' !')
|
||||
if dom.isActive():
|
||||
#If not shutdown after 5 attempt, force stop (freeze VM, or OS not installed for example)
|
||||
dom.destroy()
|
||||
logging.info('ERROR STOP VM - Forced stopped'+nom+' !')
|
||||
resultats='<p id="alert" style="color:red"><b>'+nom+'</b> '+lang_forced_stop+' </p>';
|
||||
return render_template('state.html',loguser=session['username'],alertmessage=resultats,state_all=get_lxc_state()+"<br>"+get_vm_state(),title="State",listlxc=get_lxc_list(),listdistrib=list_distrib())
|
||||
|
||||
|
||||
@app.route("/destroyct", methods=['POST'])
|
||||
def destroy_ct():
|
||||
nom = request.form['destroy']
|
||||
container=lxc.Container(nom)
|
||||
if ( container.state == "RUNNING"):
|
||||
resultats='<p id="alert" style="color:red"><b>'+nom+'</b> is running, stop it first !</p>';
|
||||
else:
|
||||
container.stop()
|
||||
container.wait("STOPPED", 3)
|
||||
container.destroy()
|
||||
alive=0
|
||||
while alive < 3:
|
||||
if (nom in get_lxc_list()):
|
||||
logging.info('WAIT DESTROY CT - (TEST'+str(alive)+'/3)'+nom+' !')
|
||||
time.sleep(3)
|
||||
alive+=1
|
||||
logging.info('ERROR DESTROY CT - '+nom+' !')
|
||||
resultats='<p id="alert" style="color:red"><b>'+nom+'</b> Error on Destroy </p>';
|
||||
else:
|
||||
alive=4
|
||||
logging.info('DESTROY - Destroyed '+nom+' !')
|
||||
resultats='<p id="alert" style="color:blue"><b>'+nom+'</b> '+lang_destroyed+'</p>';
|
||||
return render_template('state.html',loguser=session['username'],alertmessage=resultats,state_all=get_lxc_state()+"<br>"+get_vm_state(),title="State",listlxc=get_lxc_list(),listdistrib=list_distrib())
|
||||
|
||||
@app.route("/destroyvm", methods=['POST'])
|
||||
def destroy_vm():
|
||||
nom=request.form['destroyvm']
|
||||
dom=conn.lookupByName(nom)
|
||||
if dom.isActive()==True:
|
||||
resultats='<p id="alert" style="color:red"><b>'+nom+'</b> '+lang_console2+'</p>';
|
||||
else:
|
||||
dom.undefine()
|
||||
time.sleep(3)
|
||||
resultats='<p id="alert" style="color:blue"><b>'+nom+'</b> '+lang_destroyed+'</p>';
|
||||
logging.info('DESTROY VM - Destoryed'+nom+' !')
|
||||
return render_template('state.html',loguser=session['username'],alertmessage=resultats,state_all='<div class="card"><div class="card-header">Containers</div><div class="card-body">'+get_lxc_state()+'</div></div><div class="card"><div class="card-header">Virtual Servers</div><div class="card-body">'+get_vm_state()+"</div></div>",title="State",listlxc=get_lxc_list(),listdistrib=list_distrib())
|
||||
|
||||
@app.route("/renamect", methods=['POST'])
|
||||
def rename_ct():
|
||||
mount_pts()
|
||||
nom=request.form['nom']
|
||||
newname=request.form['newname']
|
||||
if len(newname.split()) > 1:
|
||||
logging.warning('RENAME FAILED - Too many word in '+nom+', please use one word !')
|
||||
resultats='<p id="alert" style="color:red">Too many word in <b>'+newname+'</b>, please use only one word !</p>'
|
||||
else:
|
||||
container=lxc.Container(nom)
|
||||
container.stop()
|
||||
container.wait("STOPPED", 3)
|
||||
container.rename(newname)
|
||||
logging.info('RENAME - '+nom+' is now known as '+newname+' !')
|
||||
resultats='<p id="alert" style="color:blue"><b>'+nom+'</b> is known as <b>'+newname+'</b> ! </p>'
|
||||
return render_template('state.html',loguser=session['username'],alertmessage=resultats,state_all=get_lxc_state()+"<br>"+get_vm_state(),title="State",listlxc=get_lxc_list(),listdistrib=list_distrib())
|
||||
|
||||
@app.route('/login', methods=['GET', 'POST'])
|
||||
def login():
|
||||
if request.method == 'POST':
|
||||
username = request.form['username']
|
||||
password = request.form['password']
|
||||
if authenticate(str(username), str(password)):
|
||||
session['username'] = request.form['username']
|
||||
logging.info('AUTH LOG - New auth from '+username+' !')
|
||||
return redirect(url_for('index'))
|
||||
else:
|
||||
resultats='<p id="alert" style="color:red">Invalid Username/Password ! </p>'
|
||||
return render_template('login.html', alertmessage=resultats)
|
||||
|
||||
@app.route('/logout')
|
||||
def logout():
|
||||
session.pop('username', None)
|
||||
return redirect(url_for('index'))
|
||||
|
||||
# set the secret key. keep this really secret:
|
||||
app.secret_key = 'A0Zr98j/3yX R~XHH!jmN]LWX/,?RT'
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
app.run(host=flask_host, port=flask_port, threaded=flask_thread, debug=flask_debug)
|
||||
|
|
@ -0,0 +1,247 @@
|
|||
<#
|
||||
.Synopsis
|
||||
Activate a Python virtual environment for the current PowerShell session.
|
||||
|
||||
.Description
|
||||
Pushes the python executable for a virtual environment to the front of the
|
||||
$Env:PATH environment variable and sets the prompt to signify that you are
|
||||
in a Python virtual environment. Makes use of the command line switches as
|
||||
well as the `pyvenv.cfg` file values present in the virtual environment.
|
||||
|
||||
.Parameter VenvDir
|
||||
Path to the directory that contains the virtual environment to activate. The
|
||||
default value for this is the parent of the directory that the Activate.ps1
|
||||
script is located within.
|
||||
|
||||
.Parameter Prompt
|
||||
The prompt prefix to display when this virtual environment is activated. By
|
||||
default, this prompt is the name of the virtual environment folder (VenvDir)
|
||||
surrounded by parentheses and followed by a single space (ie. '(.venv) ').
|
||||
|
||||
.Example
|
||||
Activate.ps1
|
||||
Activates the Python virtual environment that contains the Activate.ps1 script.
|
||||
|
||||
.Example
|
||||
Activate.ps1 -Verbose
|
||||
Activates the Python virtual environment that contains the Activate.ps1 script,
|
||||
and shows extra information about the activation as it executes.
|
||||
|
||||
.Example
|
||||
Activate.ps1 -VenvDir C:\Users\MyUser\Common\.venv
|
||||
Activates the Python virtual environment located in the specified location.
|
||||
|
||||
.Example
|
||||
Activate.ps1 -Prompt "MyPython"
|
||||
Activates the Python virtual environment that contains the Activate.ps1 script,
|
||||
and prefixes the current prompt with the specified string (surrounded in
|
||||
parentheses) while the virtual environment is active.
|
||||
|
||||
.Notes
|
||||
On Windows, it may be required to enable this Activate.ps1 script by setting the
|
||||
execution policy for the user. You can do this by issuing the following PowerShell
|
||||
command:
|
||||
|
||||
PS C:\> Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
|
||||
|
||||
For more information on Execution Policies:
|
||||
https://go.microsoft.com/fwlink/?LinkID=135170
|
||||
|
||||
#>
|
||||
Param(
|
||||
[Parameter(Mandatory = $false)]
|
||||
[String]
|
||||
$VenvDir,
|
||||
[Parameter(Mandatory = $false)]
|
||||
[String]
|
||||
$Prompt
|
||||
)
|
||||
|
||||
<# Function declarations --------------------------------------------------- #>
|
||||
|
||||
<#
|
||||
.Synopsis
|
||||
Remove all shell session elements added by the Activate script, including the
|
||||
addition of the virtual environment's Python executable from the beginning of
|
||||
the PATH variable.
|
||||
|
||||
.Parameter NonDestructive
|
||||
If present, do not remove this function from the global namespace for the
|
||||
session.
|
||||
|
||||
#>
|
||||
function global:deactivate ([switch]$NonDestructive) {
|
||||
# Revert to original values
|
||||
|
||||
# The prior prompt:
|
||||
if (Test-Path -Path Function:_OLD_VIRTUAL_PROMPT) {
|
||||
Copy-Item -Path Function:_OLD_VIRTUAL_PROMPT -Destination Function:prompt
|
||||
Remove-Item -Path Function:_OLD_VIRTUAL_PROMPT
|
||||
}
|
||||
|
||||
# The prior PYTHONHOME:
|
||||
if (Test-Path -Path Env:_OLD_VIRTUAL_PYTHONHOME) {
|
||||
Copy-Item -Path Env:_OLD_VIRTUAL_PYTHONHOME -Destination Env:PYTHONHOME
|
||||
Remove-Item -Path Env:_OLD_VIRTUAL_PYTHONHOME
|
||||
}
|
||||
|
||||
# The prior PATH:
|
||||
if (Test-Path -Path Env:_OLD_VIRTUAL_PATH) {
|
||||
Copy-Item -Path Env:_OLD_VIRTUAL_PATH -Destination Env:PATH
|
||||
Remove-Item -Path Env:_OLD_VIRTUAL_PATH
|
||||
}
|
||||
|
||||
# Just remove the VIRTUAL_ENV altogether:
|
||||
if (Test-Path -Path Env:VIRTUAL_ENV) {
|
||||
Remove-Item -Path env:VIRTUAL_ENV
|
||||
}
|
||||
|
||||
# Just remove VIRTUAL_ENV_PROMPT altogether.
|
||||
if (Test-Path -Path Env:VIRTUAL_ENV_PROMPT) {
|
||||
Remove-Item -Path env:VIRTUAL_ENV_PROMPT
|
||||
}
|
||||
|
||||
# Just remove the _PYTHON_VENV_PROMPT_PREFIX altogether:
|
||||
if (Get-Variable -Name "_PYTHON_VENV_PROMPT_PREFIX" -ErrorAction SilentlyContinue) {
|
||||
Remove-Variable -Name _PYTHON_VENV_PROMPT_PREFIX -Scope Global -Force
|
||||
}
|
||||
|
||||
# Leave deactivate function in the global namespace if requested:
|
||||
if (-not $NonDestructive) {
|
||||
Remove-Item -Path function:deactivate
|
||||
}
|
||||
}
|
||||
|
||||
<#
|
||||
.Description
|
||||
Get-PyVenvConfig parses the values from the pyvenv.cfg file located in the
|
||||
given folder, and returns them in a map.
|
||||
|
||||
For each line in the pyvenv.cfg file, if that line can be parsed into exactly
|
||||
two strings separated by `=` (with any amount of whitespace surrounding the =)
|
||||
then it is considered a `key = value` line. The left hand string is the key,
|
||||
the right hand is the value.
|
||||
|
||||
If the value starts with a `'` or a `"` then the first and last character is
|
||||
stripped from the value before being captured.
|
||||
|
||||
.Parameter ConfigDir
|
||||
Path to the directory that contains the `pyvenv.cfg` file.
|
||||
#>
|
||||
function Get-PyVenvConfig(
|
||||
[String]
|
||||
$ConfigDir
|
||||
) {
|
||||
Write-Verbose "Given ConfigDir=$ConfigDir, obtain values in pyvenv.cfg"
|
||||
|
||||
# Ensure the file exists, and issue a warning if it doesn't (but still allow the function to continue).
|
||||
$pyvenvConfigPath = Join-Path -Resolve -Path $ConfigDir -ChildPath 'pyvenv.cfg' -ErrorAction Continue
|
||||
|
||||
# An empty map will be returned if no config file is found.
|
||||
$pyvenvConfig = @{ }
|
||||
|
||||
if ($pyvenvConfigPath) {
|
||||
|
||||
Write-Verbose "File exists, parse `key = value` lines"
|
||||
$pyvenvConfigContent = Get-Content -Path $pyvenvConfigPath
|
||||
|
||||
$pyvenvConfigContent | ForEach-Object {
|
||||
$keyval = $PSItem -split "\s*=\s*", 2
|
||||
if ($keyval[0] -and $keyval[1]) {
|
||||
$val = $keyval[1]
|
||||
|
||||
# Remove extraneous quotations around a string value.
|
||||
if ("'""".Contains($val.Substring(0, 1))) {
|
||||
$val = $val.Substring(1, $val.Length - 2)
|
||||
}
|
||||
|
||||
$pyvenvConfig[$keyval[0]] = $val
|
||||
Write-Verbose "Adding Key: '$($keyval[0])'='$val'"
|
||||
}
|
||||
}
|
||||
}
|
||||
return $pyvenvConfig
|
||||
}
|
||||
|
||||
|
||||
<# Begin Activate script --------------------------------------------------- #>
|
||||
|
||||
# Determine the containing directory of this script
|
||||
$VenvExecPath = Split-Path -Parent $MyInvocation.MyCommand.Definition
|
||||
$VenvExecDir = Get-Item -Path $VenvExecPath
|
||||
|
||||
Write-Verbose "Activation script is located in path: '$VenvExecPath'"
|
||||
Write-Verbose "VenvExecDir Fullname: '$($VenvExecDir.FullName)"
|
||||
Write-Verbose "VenvExecDir Name: '$($VenvExecDir.Name)"
|
||||
|
||||
# Set values required in priority: CmdLine, ConfigFile, Default
|
||||
# First, get the location of the virtual environment, it might not be
|
||||
# VenvExecDir if specified on the command line.
|
||||
if ($VenvDir) {
|
||||
Write-Verbose "VenvDir given as parameter, using '$VenvDir' to determine values"
|
||||
}
|
||||
else {
|
||||
Write-Verbose "VenvDir not given as a parameter, using parent directory name as VenvDir."
|
||||
$VenvDir = $VenvExecDir.Parent.FullName.TrimEnd("\\/")
|
||||
Write-Verbose "VenvDir=$VenvDir"
|
||||
}
|
||||
|
||||
# Next, read the `pyvenv.cfg` file to determine any required value such
|
||||
# as `prompt`.
|
||||
$pyvenvCfg = Get-PyVenvConfig -ConfigDir $VenvDir
|
||||
|
||||
# Next, set the prompt from the command line, or the config file, or
|
||||
# just use the name of the virtual environment folder.
|
||||
if ($Prompt) {
|
||||
Write-Verbose "Prompt specified as argument, using '$Prompt'"
|
||||
}
|
||||
else {
|
||||
Write-Verbose "Prompt not specified as argument to script, checking pyvenv.cfg value"
|
||||
if ($pyvenvCfg -and $pyvenvCfg['prompt']) {
|
||||
Write-Verbose " Setting based on value in pyvenv.cfg='$($pyvenvCfg['prompt'])'"
|
||||
$Prompt = $pyvenvCfg['prompt'];
|
||||
}
|
||||
else {
|
||||
Write-Verbose " Setting prompt based on parent's directory's name. (Is the directory name passed to venv module when creating the virtual environment)"
|
||||
Write-Verbose " Got leaf-name of $VenvDir='$(Split-Path -Path $venvDir -Leaf)'"
|
||||
$Prompt = Split-Path -Path $venvDir -Leaf
|
||||
}
|
||||
}
|
||||
|
||||
Write-Verbose "Prompt = '$Prompt'"
|
||||
Write-Verbose "VenvDir='$VenvDir'"
|
||||
|
||||
# Deactivate any currently active virtual environment, but leave the
|
||||
# deactivate function in place.
|
||||
deactivate -nondestructive
|
||||
|
||||
# Now set the environment variable VIRTUAL_ENV, used by many tools to determine
|
||||
# that there is an activated venv.
|
||||
$env:VIRTUAL_ENV = $VenvDir
|
||||
|
||||
if (-not $Env:VIRTUAL_ENV_DISABLE_PROMPT) {
|
||||
|
||||
Write-Verbose "Setting prompt to '$Prompt'"
|
||||
|
||||
# Set the prompt to include the env name
|
||||
# Make sure _OLD_VIRTUAL_PROMPT is global
|
||||
function global:_OLD_VIRTUAL_PROMPT { "" }
|
||||
Copy-Item -Path function:prompt -Destination function:_OLD_VIRTUAL_PROMPT
|
||||
New-Variable -Name _PYTHON_VENV_PROMPT_PREFIX -Description "Python virtual environment prompt prefix" -Scope Global -Option ReadOnly -Visibility Public -Value $Prompt
|
||||
|
||||
function global:prompt {
|
||||
Write-Host -NoNewline -ForegroundColor Green "($_PYTHON_VENV_PROMPT_PREFIX) "
|
||||
_OLD_VIRTUAL_PROMPT
|
||||
}
|
||||
$env:VIRTUAL_ENV_PROMPT = $Prompt
|
||||
}
|
||||
|
||||
# Clear PYTHONHOME
|
||||
if (Test-Path -Path Env:PYTHONHOME) {
|
||||
Copy-Item -Path Env:PYTHONHOME -Destination Env:_OLD_VIRTUAL_PYTHONHOME
|
||||
Remove-Item -Path Env:PYTHONHOME
|
||||
}
|
||||
|
||||
# Add the venv to the PATH
|
||||
Copy-Item -Path Env:PATH -Destination Env:_OLD_VIRTUAL_PATH
|
||||
$Env:PATH = "$VenvExecDir$([System.IO.Path]::PathSeparator)$Env:PATH"
|
|
@ -0,0 +1,69 @@
|
|||
# This file must be used with "source bin/activate" *from bash*
|
||||
# you cannot run it directly
|
||||
|
||||
deactivate () {
|
||||
# reset old environment variables
|
||||
if [ -n "${_OLD_VIRTUAL_PATH:-}" ] ; then
|
||||
PATH="${_OLD_VIRTUAL_PATH:-}"
|
||||
export PATH
|
||||
unset _OLD_VIRTUAL_PATH
|
||||
fi
|
||||
if [ -n "${_OLD_VIRTUAL_PYTHONHOME:-}" ] ; then
|
||||
PYTHONHOME="${_OLD_VIRTUAL_PYTHONHOME:-}"
|
||||
export PYTHONHOME
|
||||
unset _OLD_VIRTUAL_PYTHONHOME
|
||||
fi
|
||||
|
||||
# This should detect bash and zsh, which have a hash command that must
|
||||
# be called to get it to forget past commands. Without forgetting
|
||||
# past commands the $PATH changes we made may not be respected
|
||||
if [ -n "${BASH:-}" -o -n "${ZSH_VERSION:-}" ] ; then
|
||||
hash -r 2> /dev/null
|
||||
fi
|
||||
|
||||
if [ -n "${_OLD_VIRTUAL_PS1:-}" ] ; then
|
||||
PS1="${_OLD_VIRTUAL_PS1:-}"
|
||||
export PS1
|
||||
unset _OLD_VIRTUAL_PS1
|
||||
fi
|
||||
|
||||
unset VIRTUAL_ENV
|
||||
unset VIRTUAL_ENV_PROMPT
|
||||
if [ ! "${1:-}" = "nondestructive" ] ; then
|
||||
# Self destruct!
|
||||
unset -f deactivate
|
||||
fi
|
||||
}
|
||||
|
||||
# unset irrelevant variables
|
||||
deactivate nondestructive
|
||||
|
||||
VIRTUAL_ENV="/var/www/html/lxc/hypenv"
|
||||
export VIRTUAL_ENV
|
||||
|
||||
_OLD_VIRTUAL_PATH="$PATH"
|
||||
PATH="$VIRTUAL_ENV/bin:$PATH"
|
||||
export PATH
|
||||
|
||||
# unset PYTHONHOME if set
|
||||
# this will fail if PYTHONHOME is set to the empty string (which is bad anyway)
|
||||
# could use `if (set -u; : $PYTHONHOME) ;` in bash
|
||||
if [ -n "${PYTHONHOME:-}" ] ; then
|
||||
_OLD_VIRTUAL_PYTHONHOME="${PYTHONHOME:-}"
|
||||
unset PYTHONHOME
|
||||
fi
|
||||
|
||||
if [ -z "${VIRTUAL_ENV_DISABLE_PROMPT:-}" ] ; then
|
||||
_OLD_VIRTUAL_PS1="${PS1:-}"
|
||||
PS1="(hypenv) ${PS1:-}"
|
||||
export PS1
|
||||
VIRTUAL_ENV_PROMPT="(hypenv) "
|
||||
export VIRTUAL_ENV_PROMPT
|
||||
fi
|
||||
|
||||
# This should detect bash and zsh, which have a hash command that must
|
||||
# be called to get it to forget past commands. Without forgetting
|
||||
# past commands the $PATH changes we made may not be respected
|
||||
if [ -n "${BASH:-}" -o -n "${ZSH_VERSION:-}" ] ; then
|
||||
hash -r 2> /dev/null
|
||||
fi
|
|
@ -0,0 +1,26 @@
|
|||
# This file must be used with "source bin/activate.csh" *from csh*.
|
||||
# You cannot run it directly.
|
||||
# Created by Davide Di Blasi <davidedb@gmail.com>.
|
||||
# Ported to Python 3.3 venv by Andrew Svetlov <andrew.svetlov@gmail.com>
|
||||
|
||||
alias deactivate 'test $?_OLD_VIRTUAL_PATH != 0 && setenv PATH "$_OLD_VIRTUAL_PATH" && unset _OLD_VIRTUAL_PATH; rehash; test $?_OLD_VIRTUAL_PROMPT != 0 && set prompt="$_OLD_VIRTUAL_PROMPT" && unset _OLD_VIRTUAL_PROMPT; unsetenv VIRTUAL_ENV; unsetenv VIRTUAL_ENV_PROMPT; test "\!:*" != "nondestructive" && unalias deactivate'
|
||||
|
||||
# Unset irrelevant variables.
|
||||
deactivate nondestructive
|
||||
|
||||
setenv VIRTUAL_ENV "/var/www/html/lxc/hypenv"
|
||||
|
||||
set _OLD_VIRTUAL_PATH="$PATH"
|
||||
setenv PATH "$VIRTUAL_ENV/bin:$PATH"
|
||||
|
||||
|
||||
set _OLD_VIRTUAL_PROMPT="$prompt"
|
||||
|
||||
if (! "$?VIRTUAL_ENV_DISABLE_PROMPT") then
|
||||
set prompt = "(hypenv) $prompt"
|
||||
setenv VIRTUAL_ENV_PROMPT "(hypenv) "
|
||||
endif
|
||||
|
||||
alias pydoc python -m pydoc
|
||||
|
||||
rehash
|
|
@ -0,0 +1,69 @@
|
|||
# This file must be used with "source <venv>/bin/activate.fish" *from fish*
|
||||
# (https://fishshell.com/); you cannot run it directly.
|
||||
|
||||
function deactivate -d "Exit virtual environment and return to normal shell environment"
|
||||
# reset old environment variables
|
||||
if test -n "$_OLD_VIRTUAL_PATH"
|
||||
set -gx PATH $_OLD_VIRTUAL_PATH
|
||||
set -e _OLD_VIRTUAL_PATH
|
||||
end
|
||||
if test -n "$_OLD_VIRTUAL_PYTHONHOME"
|
||||
set -gx PYTHONHOME $_OLD_VIRTUAL_PYTHONHOME
|
||||
set -e _OLD_VIRTUAL_PYTHONHOME
|
||||
end
|
||||
|
||||
if test -n "$_OLD_FISH_PROMPT_OVERRIDE"
|
||||
set -e _OLD_FISH_PROMPT_OVERRIDE
|
||||
# prevents error when using nested fish instances (Issue #93858)
|
||||
if functions -q _old_fish_prompt
|
||||
functions -e fish_prompt
|
||||
functions -c _old_fish_prompt fish_prompt
|
||||
functions -e _old_fish_prompt
|
||||
end
|
||||
end
|
||||
|
||||
set -e VIRTUAL_ENV
|
||||
set -e VIRTUAL_ENV_PROMPT
|
||||
if test "$argv[1]" != "nondestructive"
|
||||
# Self-destruct!
|
||||
functions -e deactivate
|
||||
end
|
||||
end
|
||||
|
||||
# Unset irrelevant variables.
|
||||
deactivate nondestructive
|
||||
|
||||
set -gx VIRTUAL_ENV "/var/www/html/lxc/hypenv"
|
||||
|
||||
set -gx _OLD_VIRTUAL_PATH $PATH
|
||||
set -gx PATH "$VIRTUAL_ENV/bin" $PATH
|
||||
|
||||
# Unset PYTHONHOME if set.
|
||||
if set -q PYTHONHOME
|
||||
set -gx _OLD_VIRTUAL_PYTHONHOME $PYTHONHOME
|
||||
set -e PYTHONHOME
|
||||
end
|
||||
|
||||
if test -z "$VIRTUAL_ENV_DISABLE_PROMPT"
|
||||
# fish uses a function instead of an env var to generate the prompt.
|
||||
|
||||
# Save the current fish_prompt function as the function _old_fish_prompt.
|
||||
functions -c fish_prompt _old_fish_prompt
|
||||
|
||||
# With the original prompt function renamed, we can override with our own.
|
||||
function fish_prompt
|
||||
# Save the return status of the last command.
|
||||
set -l old_status $status
|
||||
|
||||
# Output the venv prompt; color taken from the blue of the Python logo.
|
||||
printf "%s%s%s" (set_color 4B8BBE) "(hypenv) " (set_color normal)
|
||||
|
||||
# Restore the return status of the previous command.
|
||||
echo "exit $old_status" | .
|
||||
# Output the original/"old" prompt.
|
||||
_old_fish_prompt
|
||||
end
|
||||
|
||||
set -gx _OLD_FISH_PROMPT_OVERRIDE "$VIRTUAL_ENV"
|
||||
set -gx VIRTUAL_ENV_PROMPT "(hypenv) "
|
||||
end
|
|
@ -0,0 +1,8 @@
|
|||
#!/var/www/html/lxc/hypenv/bin/python3
|
||||
# -*- coding: utf-8 -*-
|
||||
import re
|
||||
import sys
|
||||
from flask.cli import main
|
||||
if __name__ == '__main__':
|
||||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
||||
sys.exit(main())
|
|
@ -0,0 +1,8 @@
|
|||
#!/var/www/html/lxc/hypenv/bin/python3
|
||||
# -*- coding: utf-8 -*-
|
||||
import re
|
||||
import sys
|
||||
from pip._internal.cli.main import main
|
||||
if __name__ == '__main__':
|
||||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
||||
sys.exit(main())
|
|
@ -0,0 +1,8 @@
|
|||
#!/var/www/html/lxc/hypenv/bin/python3
|
||||
# -*- coding: utf-8 -*-
|
||||
import re
|
||||
import sys
|
||||
from pip._internal.cli.main import main
|
||||
if __name__ == '__main__':
|
||||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
||||
sys.exit(main())
|
|
@ -0,0 +1,8 @@
|
|||
#!/var/www/html/lxc/hypenv/bin/python3
|
||||
# -*- coding: utf-8 -*-
|
||||
import re
|
||||
import sys
|
||||
from pip._internal.cli.main import main
|
||||
if __name__ == '__main__':
|
||||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
||||
sys.exit(main())
|
|
@ -0,0 +1 @@
|
|||
python3
|
|
@ -0,0 +1 @@
|
|||
/usr/bin/python3
|
|
@ -0,0 +1 @@
|
|||
python3
|
|
@ -0,0 +1,8 @@
|
|||
#!/var/www/html/lxc/hypenv/bin/python3
|
||||
# -*- coding: utf-8 -*-
|
||||
import re
|
||||
import sys
|
||||
from pyxtermjs.app import main
|
||||
if __name__ == '__main__':
|
||||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
||||
sys.exit(main())
|
|
@ -0,0 +1 @@
|
|||
pip
|
|
@ -0,0 +1,28 @@
|
|||
Copyright 2010 Pallets
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of the copyright holder nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
|
||||
TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
@ -0,0 +1,124 @@
|
|||
Metadata-Version: 2.1
|
||||
Name: Flask
|
||||
Version: 2.0.1
|
||||
Summary: A simple framework for building complex web applications.
|
||||
Home-page: https://palletsprojects.com/p/flask
|
||||
Author: Armin Ronacher
|
||||
Author-email: armin.ronacher@active-4.com
|
||||
Maintainer: Pallets
|
||||
Maintainer-email: contact@palletsprojects.com
|
||||
License: BSD-3-Clause
|
||||
Project-URL: Donate, https://palletsprojects.com/donate
|
||||
Project-URL: Documentation, https://flask.palletsprojects.com/
|
||||
Project-URL: Changes, https://flask.palletsprojects.com/changes/
|
||||
Project-URL: Source Code, https://github.com/pallets/flask/
|
||||
Project-URL: Issue Tracker, https://github.com/pallets/flask/issues/
|
||||
Project-URL: Twitter, https://twitter.com/PalletsTeam
|
||||
Project-URL: Chat, https://discord.gg/pallets
|
||||
Platform: UNKNOWN
|
||||
Classifier: Development Status :: 5 - Production/Stable
|
||||
Classifier: Environment :: Web Environment
|
||||
Classifier: Framework :: Flask
|
||||
Classifier: Intended Audience :: Developers
|
||||
Classifier: License :: OSI Approved :: BSD License
|
||||
Classifier: Operating System :: OS Independent
|
||||
Classifier: Programming Language :: Python
|
||||
Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
|
||||
Classifier: Topic :: Internet :: WWW/HTTP :: WSGI
|
||||
Classifier: Topic :: Internet :: WWW/HTTP :: WSGI :: Application
|
||||
Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
|
||||
Requires-Python: >=3.6
|
||||
Description-Content-Type: text/x-rst
|
||||
Requires-Dist: Werkzeug (>=2.0)
|
||||
Requires-Dist: Jinja2 (>=3.0)
|
||||
Requires-Dist: itsdangerous (>=2.0)
|
||||
Requires-Dist: click (>=7.1.2)
|
||||
Provides-Extra: async
|
||||
Requires-Dist: asgiref (>=3.2) ; extra == 'async'
|
||||
Provides-Extra: dotenv
|
||||
Requires-Dist: python-dotenv ; extra == 'dotenv'
|
||||
|
||||
Flask
|
||||
=====
|
||||
|
||||
Flask is a lightweight `WSGI`_ web application framework. It is designed
|
||||
to make getting started quick and easy, with the ability to scale up to
|
||||
complex applications. It began as a simple wrapper around `Werkzeug`_
|
||||
and `Jinja`_ and has become one of the most popular Python web
|
||||
application frameworks.
|
||||
|
||||
Flask offers suggestions, but doesn't enforce any dependencies or
|
||||
project layout. It is up to the developer to choose the tools and
|
||||
libraries they want to use. There are many extensions provided by the
|
||||
community that make adding new functionality easy.
|
||||
|
||||
.. _WSGI: https://wsgi.readthedocs.io/
|
||||
.. _Werkzeug: https://werkzeug.palletsprojects.com/
|
||||
.. _Jinja: https://jinja.palletsprojects.com/
|
||||
|
||||
|
||||
Installing
|
||||
----------
|
||||
|
||||
Install and update using `pip`_:
|
||||
|
||||
.. code-block:: text
|
||||
|
||||
$ pip install -U Flask
|
||||
|
||||
.. _pip: https://pip.pypa.io/en/stable/quickstart/
|
||||
|
||||
|
||||
A Simple Example
|
||||
----------------
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
# save this as app.py
|
||||
from flask import Flask
|
||||
|
||||
app = Flask(__name__)
|
||||
|
||||
@app.route("/")
|
||||
def hello():
|
||||
return "Hello, World!"
|
||||
|
||||
.. code-block:: text
|
||||
|
||||
$ flask run
|
||||
* Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
|
||||
|
||||
|
||||
Contributing
|
||||
------------
|
||||
|
||||
For guidance on setting up a development environment and how to make a
|
||||
contribution to Flask, see the `contributing guidelines`_.
|
||||
|
||||
.. _contributing guidelines: https://github.com/pallets/flask/blob/main/CONTRIBUTING.rst
|
||||
|
||||
|
||||
Donate
|
||||
------
|
||||
|
||||
The Pallets organization develops and supports Flask and the libraries
|
||||
it uses. In order to grow the community of contributors and users, and
|
||||
allow the maintainers to devote more time to the projects, `please
|
||||
donate today`_.
|
||||
|
||||
.. _please donate today: https://palletsprojects.com/donate
|
||||
|
||||
|
||||
Links
|
||||
-----
|
||||
|
||||
- Documentation: https://flask.palletsprojects.com/
|
||||
- Changes: https://flask.palletsprojects.com/changes/
|
||||
- PyPI Releases: https://pypi.org/project/Flask/
|
||||
- Source Code: https://github.com/pallets/flask/
|
||||
- Issue Tracker: https://github.com/pallets/flask/issues/
|
||||
- Website: https://palletsprojects.com/p/flask/
|
||||
- Twitter: https://twitter.com/PalletsTeam
|
||||
- Chat: https://discord.gg/pallets
|
||||
|
||||
|
|
@ -0,0 +1,52 @@
|
|||
../../../bin/flask,sha256=EvIM3XMnKgEAdW90lNiHV97MK-JWLp1Oo91zT3dhDCY,228
|
||||
Flask-2.0.1.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
|
||||
Flask-2.0.1.dist-info/LICENSE.rst,sha256=SJqOEQhQntmKN7uYPhHg9-HTHwvY-Zp5yESOf_N9B-o,1475
|
||||
Flask-2.0.1.dist-info/METADATA,sha256=50Jm1647RKw98p4RF64bCqRh0wajk-n3hQ7av2-pniA,3808
|
||||
Flask-2.0.1.dist-info/RECORD,,
|
||||
Flask-2.0.1.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
||||
Flask-2.0.1.dist-info/WHEEL,sha256=OqRkF0eY5GHssMorFjlbTIq072vpHpF60fIQA6lS9xA,92
|
||||
Flask-2.0.1.dist-info/entry_points.txt,sha256=gBLA1aKg0OYR8AhbAfg8lnburHtKcgJLDU52BBctN0k,42
|
||||
Flask-2.0.1.dist-info/top_level.txt,sha256=dvi65F6AeGWVU0TBpYiC04yM60-FX1gJFkK31IKQr5c,6
|
||||
flask/__init__.py,sha256=w5v6GCNm8eLDMNWqs2ue7HLHo75aslAwz1h3k3YO9HY,2251
|
||||
flask/__main__.py,sha256=bYt9eEaoRQWdejEHFD8REx9jxVEdZptECFsV7F49Ink,30
|
||||
flask/__pycache__/__init__.cpython-311.pyc,,
|
||||
flask/__pycache__/__main__.cpython-311.pyc,,
|
||||
flask/__pycache__/app.cpython-311.pyc,,
|
||||
flask/__pycache__/blueprints.cpython-311.pyc,,
|
||||
flask/__pycache__/cli.cpython-311.pyc,,
|
||||
flask/__pycache__/config.cpython-311.pyc,,
|
||||
flask/__pycache__/ctx.cpython-311.pyc,,
|
||||
flask/__pycache__/debughelpers.cpython-311.pyc,,
|
||||
flask/__pycache__/globals.cpython-311.pyc,,
|
||||
flask/__pycache__/helpers.cpython-311.pyc,,
|
||||
flask/__pycache__/logging.cpython-311.pyc,,
|
||||
flask/__pycache__/scaffold.cpython-311.pyc,,
|
||||
flask/__pycache__/sessions.cpython-311.pyc,,
|
||||
flask/__pycache__/signals.cpython-311.pyc,,
|
||||
flask/__pycache__/templating.cpython-311.pyc,,
|
||||
flask/__pycache__/testing.cpython-311.pyc,,
|
||||
flask/__pycache__/typing.cpython-311.pyc,,
|
||||
flask/__pycache__/views.cpython-311.pyc,,
|
||||
flask/__pycache__/wrappers.cpython-311.pyc,,
|
||||
flask/app.py,sha256=q6lpiiWVxjljQRwjjneUBpfllXYPEq0CFAUpTQ5gIeA,82376
|
||||
flask/blueprints.py,sha256=OjI-dkwx96ZNMUGDDFMKzgcpUJf240WRuMlHkmgI1Lc,23541
|
||||
flask/cli.py,sha256=iN1pL2SevE5Nmvey-0WwnxG3nipZXIiE__Ed4lx3IuM,32036
|
||||
flask/config.py,sha256=jj_7JGen_kYuTlKrx8ZPBsZddb8mihC0ODg4gcjXBX8,11068
|
||||
flask/ctx.py,sha256=EM3W0v1ctuFQAGk_HWtQdoJEg_r2f5Le4xcmElxFwwk,17428
|
||||
flask/debughelpers.py,sha256=wk5HtLwENsQ4e8tkxfBn6ykUeVRDuMbQCKgtEVe6jxk,6171
|
||||
flask/globals.py,sha256=cWd-R2hUH3VqPhnmQNww892tQS6Yjqg_wg8UvW1M7NM,1723
|
||||
flask/helpers.py,sha256=00WqA3wYeyjMrnAOPZTUyrnUf7H8ik3CVT0kqGl_qjk,30589
|
||||
flask/json/__init__.py,sha256=d-db2DJMASq0G7CI-JvobehRE1asNRGX1rIDQ1GF9WM,11580
|
||||
flask/json/__pycache__/__init__.cpython-311.pyc,,
|
||||
flask/json/__pycache__/tag.cpython-311.pyc,,
|
||||
flask/json/tag.py,sha256=fys3HBLssWHuMAIJuTcf2K0bCtosePBKXIWASZEEjnU,8857
|
||||
flask/logging.py,sha256=1o_hirVGqdj7SBdETnhX7IAjklG89RXlrwz_2CjzQQE,2273
|
||||
flask/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
||||
flask/scaffold.py,sha256=EhQuiFrdcmJHxqPGQkEpqLsEUZ7ULZD0rtED2NrduvM,32400
|
||||
flask/sessions.py,sha256=Kb7zY4qBIOU2cw1xM5mQ_KmgYUBDFbUYWjlkq0EFYis,15189
|
||||
flask/signals.py,sha256=HQWgBEXlrLbHwLBoWqAStJKcN-rsB1_AMO8-VZ7LDOo,2126
|
||||
flask/templating.py,sha256=l96VD39JQ0nue4Bcj7wZ4-FWWs-ppLxvgBCpwDQ4KAk,5626
|
||||
flask/testing.py,sha256=OsHT-2B70abWH3ulY9IbhLchXIeyj3L-cfcDa88wv5E,10281
|
||||
flask/typing.py,sha256=zVqhz53KklncAv-WxbpxGZfaRGOqeWAsLdP1tTMaCuE,1684
|
||||
flask/views.py,sha256=F2PpWPloe4x0906IUjnPcsOqg5YvmQIfk07_lFeAD4s,5865
|
||||
flask/wrappers.py,sha256=VndbHPRBSUUOejmd2Y3ydkoCVUtsS2OJIdJEVIkBVD8,5604
|
|
@ -0,0 +1,5 @@
|
|||
Wheel-Version: 1.0
|
||||
Generator: bdist_wheel (0.36.2)
|
||||
Root-Is-Purelib: true
|
||||
Tag: py3-none-any
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
[console_scripts]
|
||||
flask = flask.cli:main
|
||||
|
|
@ -0,0 +1 @@
|
|||
flask
|
|
@ -0,0 +1 @@
|
|||
pip
|
|
@ -0,0 +1,21 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) 2017 Grey Li
|
||||
|
||||
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, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
|
@ -0,0 +1,81 @@
|
|||
Metadata-Version: 2.1
|
||||
Name: Flask-Dropzone
|
||||
Version: 1.6.0
|
||||
Summary: Upload files in Flask with Dropzone.js.
|
||||
Home-page: https://github.com/greyli/flask-dropzone
|
||||
Author: Grey Li
|
||||
Author-email: withlihui@gmail.com
|
||||
License: MIT
|
||||
Keywords: flask extension development upload
|
||||
Platform: any
|
||||
Classifier: Development Status :: 5 - Production/Stable
|
||||
Classifier: Environment :: Web Environment
|
||||
Classifier: Intended Audience :: Developers
|
||||
Classifier: License :: OSI Approved :: MIT License
|
||||
Classifier: Programming Language :: Python
|
||||
Classifier: Programming Language :: Python :: 2
|
||||
Classifier: Programming Language :: Python :: 2.7
|
||||
Classifier: Programming Language :: Python :: 3
|
||||
Classifier: Programming Language :: Python :: 3.4
|
||||
Classifier: Programming Language :: Python :: 3.5
|
||||
Classifier: Programming Language :: Python :: 3.6
|
||||
Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
|
||||
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
||||
Requires-Dist: Flask
|
||||
|
||||
===============
|
||||
Flask-Dropzone
|
||||
===============
|
||||
|
||||
Flask-Dropzone packages `Dropzone.js
|
||||
<http://dropzonejs.com>`_ into an extension to add file upload support for Flask.
|
||||
It can create links to serve Dropzone from a CDN and works with no JavaScript code in your application.
|
||||
|
||||
NOTICE: This extension is built for simple usage, if you need more flexibility, please use Dropzone.js directly.
|
||||
|
||||
Basic Usage
|
||||
-----------
|
||||
|
||||
Step 1: Initialize the extension:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
from flask_dropzone import Dropzone
|
||||
|
||||
dropzone = Dropzone(app)
|
||||
|
||||
|
||||
Step 2: In your `<head>` section of your base template add the following code::
|
||||
|
||||
<head>
|
||||
{{ dropzone.load_css() }}
|
||||
</head>
|
||||
<body>
|
||||
...
|
||||
{{ dropzone.load_js() }}
|
||||
</body>
|
||||
|
||||
You can assign the version of Dropzone.js through `version` argument, the default value is `5.2.0`.
|
||||
Step 3: Creating a Drop Zone with `create()`, and configure it with `config()`::
|
||||
|
||||
{{ dropzone.create(action='the_url_which_handle_uploads') }}
|
||||
...
|
||||
{{ dropzone.config() }}
|
||||
|
||||
Also to edit the action view to yours.
|
||||
|
||||
Beautify Dropzone
|
||||
-----------------
|
||||
|
||||
Style it according to your preferences through `style()` method::
|
||||
|
||||
{{ dropzone.style('border: 2px dashed #0087F7; margin: 10%; min-height: 400px;') }}
|
||||
|
||||
More Detail
|
||||
-----------
|
||||
|
||||
Go to `Documentation
|
||||
<https://flask-dropzone.readthedocs.io/en/latest/>`_ , which you can check for more
|
||||
details.
|
||||
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
Flask_Dropzone-1.6.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
|
||||
Flask_Dropzone-1.6.0.dist-info/LICENSE.txt,sha256=urWe6H0ZCLXr2ZalRweug84-k_8wYWjAXq28Xc9aWsg,1085
|
||||
Flask_Dropzone-1.6.0.dist-info/METADATA,sha256=0OUcmvmRPA74UU4P14a3eM4NColYn5GI5JXwMRq_Ni4,2365
|
||||
Flask_Dropzone-1.6.0.dist-info/RECORD,,
|
||||
Flask_Dropzone-1.6.0.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
||||
Flask_Dropzone-1.6.0.dist-info/WHEEL,sha256=Z-nyYpwrcSqxfdux5Mbn_DQ525iP7J2DG3JgGvOYyTQ,110
|
||||
Flask_Dropzone-1.6.0.dist-info/top_level.txt,sha256=tnmF1XttbqOTalmDk8Ple8B9lemHMKPzXFl96tCdVKE,15
|
||||
flask_dropzone/__init__.py,sha256=nC4V2_-dfU-VweN2kDMQri99Rjo4s8GMN6jTGAyppvo,20991
|
||||
flask_dropzone/__pycache__/__init__.cpython-311.pyc,,
|
||||
flask_dropzone/__pycache__/utils.cpython-311.pyc,,
|
||||
flask_dropzone/static/dropzone.min.css,sha256=C1uHyYDGrQDAk1IbmtnkXnXT_u3PkM9wh0hkpLMhy8U,9718
|
||||
flask_dropzone/static/dropzone.min.js,sha256=k394u1_NWzM2OVjwVumG22a0prnevsijOBBv3JrDlx4,42791
|
||||
flask_dropzone/utils.py,sha256=3DloM9U_-YL5ty0S12UXG2GhdYVF1QlL38MtbtOAqpg,728
|
|
@ -0,0 +1,6 @@
|
|||
Wheel-Version: 1.0
|
||||
Generator: bdist_wheel (0.36.2)
|
||||
Root-Is-Purelib: true
|
||||
Tag: py2-none-any
|
||||
Tag: py3-none-any
|
||||
|
|
@ -0,0 +1 @@
|
|||
flask_dropzone
|
|
@ -0,0 +1 @@
|
|||
pip
|
|
@ -0,0 +1,203 @@
|
|||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
Copyright (c) 2018 heartsucker
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2018 heartsucker
|
||||
|
||||
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, distribute, sublicense, and/or sell copies of the Software, and to permit
|
||||
persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
|
||||
Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
|
||||
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@ -0,0 +1,70 @@
|
|||
Metadata-Version: 2.1
|
||||
Name: Flask-FontAwesome
|
||||
Version: 0.1.5
|
||||
Summary: FontAwesome for Flask
|
||||
Home-page: https://github.com/heartsucker/flask-fontawesome
|
||||
Author: heartsucker
|
||||
Author-email: heartsucker@autistici.org
|
||||
License: UNKNOWN
|
||||
Platform: any
|
||||
Classifier: Development Status :: 5 - Production/Stable
|
||||
Classifier: Environment :: Web Environment
|
||||
Classifier: Framework :: Flask
|
||||
Classifier: Intended Audience :: Developers
|
||||
Classifier: License :: OSI Approved :: Apache Software License
|
||||
Classifier: License :: OSI Approved :: MIT License
|
||||
Classifier: Operating System :: OS Independent
|
||||
Classifier: Programming Language :: Python :: 3 :: Only
|
||||
Classifier: Programming Language :: Python :: 3.5
|
||||
Classifier: Programming Language :: Python :: 3.6
|
||||
Classifier: Programming Language :: Python :: 3.7
|
||||
Classifier: Programming Language :: Python :: 3.8
|
||||
Requires-Python: >=3.5
|
||||
Description-Content-Type: text/markdown
|
||||
Requires-Dist: Flask
|
||||
|
||||
# Flask-FontAwesome
|
||||
[![PyPI Version](https://badge.fury.io/py/Flask-FontAwesome.svg)](https://pypi.python.org/pypi/Flask-FontAwesome) [![CI](https://api.travis-ci.org/heartsucker/flask-fontawesome.svg?branch=develop)](https://api.travis-ci.org/heartsucker/flask-fontawesome.svg?branch=develop) [![Documentation Status](https://readthedocs.org/projects/flask-fontawesome/badge/?version=latest)](https://flask-fontawesome.readthedocs.io/en/latest/?badge=latest)
|
||||
|
||||
Flask extension for [FontAwesome](https://fontawesome.com/).
|
||||
|
||||
## Example
|
||||
|
||||
```python
|
||||
from flask import Flask, render_template
|
||||
from flask_fontawesome import FontAwesome
|
||||
|
||||
app = Flask(__name__)
|
||||
fa = FontAwesome(app)
|
||||
|
||||
@app.route('/')
|
||||
def index():
|
||||
return render_template('index.html')
|
||||
|
||||
app.run(host='127.0.0.1', port=8080)
|
||||
```
|
||||
|
||||
```html
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
{{ fontawesome_html() }}
|
||||
<title>FontAwesome Example</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>FontAwesome Example</h1>
|
||||
<p>This is an example of a <span class="fas fa-link"></span> link.</p>
|
||||
</body>
|
||||
</html>
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
This work is dual licensed under the MIT and Apache-2.0 licenses. See [LICENSE-MIT](./LICENSE-MIT)
|
||||
and [LICENSE-APACHE](./LICENSE-APACHE) for details.
|
||||
|
||||
### Attribution
|
||||
|
||||
The resources contained under [`flask_fontawesome/static`](./flask_fontawesome/static) are licensed to FontAwesome.
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,5 @@
|
|||
Wheel-Version: 1.0
|
||||
Generator: bdist_wheel (0.32.3)
|
||||
Root-Is-Purelib: true
|
||||
Tag: py3-none-any
|
||||
|
|
@ -0,0 +1 @@
|
|||
flask_fontawesome
|
|
@ -0,0 +1,59 @@
|
|||
|Build Status| |Coverage Status| |PyPI Version| |PyPI Downloads| |Wheel Status|
|
||||
|
||||
Flask-Navigation
|
||||
================
|
||||
|
||||
Build navigation bars in your Flask application. ::
|
||||
|
||||
nav.Bar('top', [
|
||||
nav.Item('Home', 'index'),
|
||||
nav.Item('Latest News', 'news', {'page': 1}),
|
||||
])
|
||||
|
||||
|
||||
Installation
|
||||
------------
|
||||
|
||||
::
|
||||
|
||||
$ pip install Flask-Navigation
|
||||
|
||||
|
||||
Links
|
||||
-----
|
||||
|
||||
- `Document <https://flask-navigation.readthedocs.org>`_
|
||||
- `Issue Track <https://github.com/tonyseek/flask-navigation/issues>`_
|
||||
|
||||
|
||||
Issues
|
||||
------
|
||||
|
||||
If you want to report bugs or request features, please create issues on
|
||||
`GitHub Issues <https://github.com/tonyseek/flask-navigation/issues>`_.
|
||||
|
||||
|
||||
Contributes
|
||||
-----------
|
||||
|
||||
You can send a pull reueqst on
|
||||
`GitHub <https://github.com/tonyseek/flask-navigation/pulls>`_.
|
||||
|
||||
|
||||
.. |Build Status| image:: https://travis-ci.org/tonyseek/flask-navigation.svg?branch=master,develop
|
||||
:target: https://travis-ci.org/tonyseek/flask-navigation
|
||||
:alt: Build Status
|
||||
.. |Coverage Status| image:: https://img.shields.io/coveralls/tonyseek/flask-navigation/develop.svg
|
||||
:target: https://coveralls.io/r/tonyseek/flask-navigation
|
||||
:alt: Coverage Status
|
||||
.. |Wheel Status| image:: https://pypip.in/wheel/Flask-Navigation/badge.svg
|
||||
:target: https://pypi.python.org/pypi/Flask-Navigation
|
||||
:alt: Wheel Status
|
||||
.. |PyPI Version| image:: https://img.shields.io/pypi/v/Flask-Navigation.svg
|
||||
:target: https://pypi.python.org/pypi/Flask-Navigation
|
||||
:alt: PyPI Version
|
||||
.. |PyPI Downloads| image:: https://img.shields.io/pypi/dm/Flask-Navigation.svg
|
||||
:target: https://pypi.python.org/pypi/Flask-Navigation
|
||||
:alt: Downloads
|
||||
|
||||
|
|
@ -0,0 +1 @@
|
|||
pip
|
|
@ -0,0 +1,84 @@
|
|||
Metadata-Version: 2.0
|
||||
Name: Flask-Navigation
|
||||
Version: 0.2.0
|
||||
Summary: The navigation of Flask application.
|
||||
Home-page: https://github.com/tonyseek/flask-navigation
|
||||
Author: Jiangge Zhang
|
||||
Author-email: tonyseek@gmail.com
|
||||
License: MIT
|
||||
Keywords: navigation,flask,navbar,nav
|
||||
Platform: UNKNOWN
|
||||
Classifier: Programming Language :: Python
|
||||
Classifier: Programming Language :: Python :: 2.7
|
||||
Classifier: Programming Language :: Python :: 3.3
|
||||
Classifier: Programming Language :: Python :: 3.4
|
||||
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
||||
Classifier: Development Status :: 3 - Alpha
|
||||
Classifier: License :: OSI Approved :: MIT License
|
||||
Classifier: Intended Audience :: Developers
|
||||
Classifier: Operating System :: OS Independent
|
||||
Classifier: Environment :: Web Environment
|
||||
Classifier: Framework :: Flask
|
||||
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
||||
Requires-Dist: Flask
|
||||
Requires-Dist: blinker
|
||||
|
||||
|Build Status| |Coverage Status| |PyPI Version| |PyPI Downloads| |Wheel Status|
|
||||
|
||||
Flask-Navigation
|
||||
================
|
||||
|
||||
Build navigation bars in your Flask application. ::
|
||||
|
||||
nav.Bar('top', [
|
||||
nav.Item('Home', 'index'),
|
||||
nav.Item('Latest News', 'news', {'page': 1}),
|
||||
])
|
||||
|
||||
|
||||
Installation
|
||||
------------
|
||||
|
||||
::
|
||||
|
||||
$ pip install Flask-Navigation
|
||||
|
||||
|
||||
Links
|
||||
-----
|
||||
|
||||
- `Document <https://flask-navigation.readthedocs.org>`_
|
||||
- `Issue Track <https://github.com/tonyseek/flask-navigation/issues>`_
|
||||
|
||||
|
||||
Issues
|
||||
------
|
||||
|
||||
If you want to report bugs or request features, please create issues on
|
||||
`GitHub Issues <https://github.com/tonyseek/flask-navigation/issues>`_.
|
||||
|
||||
|
||||
Contributes
|
||||
-----------
|
||||
|
||||
You can send a pull reueqst on
|
||||
`GitHub <https://github.com/tonyseek/flask-navigation/pulls>`_.
|
||||
|
||||
|
||||
.. |Build Status| image:: https://travis-ci.org/tonyseek/flask-navigation.svg?branch=master,develop
|
||||
:target: https://travis-ci.org/tonyseek/flask-navigation
|
||||
:alt: Build Status
|
||||
.. |Coverage Status| image:: https://img.shields.io/coveralls/tonyseek/flask-navigation/develop.svg
|
||||
:target: https://coveralls.io/r/tonyseek/flask-navigation
|
||||
:alt: Coverage Status
|
||||
.. |Wheel Status| image:: https://pypip.in/wheel/Flask-Navigation/badge.svg
|
||||
:target: https://pypi.python.org/pypi/Flask-Navigation
|
||||
:alt: Wheel Status
|
||||
.. |PyPI Version| image:: https://img.shields.io/pypi/v/Flask-Navigation.svg
|
||||
:target: https://pypi.python.org/pypi/Flask-Navigation
|
||||
:alt: PyPI Version
|
||||
.. |PyPI Downloads| image:: https://img.shields.io/pypi/dm/Flask-Navigation.svg
|
||||
:target: https://pypi.python.org/pypi/Flask-Navigation
|
||||
:alt: Downloads
|
||||
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
Flask_Navigation-0.2.0.dist-info/DESCRIPTION.rst,sha256=gr-3wNADqpwmzOwJtlpikBw5y-ytgSKFuHr0IEpDfRw,1622
|
||||
Flask_Navigation-0.2.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
|
||||
Flask_Navigation-0.2.0.dist-info/METADATA,sha256=m6TFfXHlgd6zGKWVtWLF4NY9JQPs1xFDKX2k0dNvZE0,2548
|
||||
Flask_Navigation-0.2.0.dist-info/RECORD,,
|
||||
Flask_Navigation-0.2.0.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
||||
Flask_Navigation-0.2.0.dist-info/WHEEL,sha256=6lxp_S3wZGmTBtGMVmNNLyvKFcp7HqQw2Wn4YYk-Suo,110
|
||||
Flask_Navigation-0.2.0.dist-info/metadata.json,sha256=FlrQF9vFyjQF_LfdvlhV4tjR1rtcYyD3p4fElb-Y0gc,1014
|
||||
Flask_Navigation-0.2.0.dist-info/top_level.txt,sha256=yPiZ-n1i5T4KiiwzsFUqKiDHSm2FSFyi1vZseMQQjvk,23
|
||||
flask_navigation/__init__.py,sha256=I8PKMi6uUY0rbBhoYcQMgPYcMXZLSQDEcPJY2wcSpok,77
|
||||
flask_navigation/__pycache__/__init__.cpython-311.pyc,,
|
||||
flask_navigation/__pycache__/api.cpython-311.pyc,,
|
||||
flask_navigation/__pycache__/item.cpython-311.pyc,,
|
||||
flask_navigation/__pycache__/navbar.cpython-311.pyc,,
|
||||
flask_navigation/__pycache__/signals.cpython-311.pyc,,
|
||||
flask_navigation/__pycache__/utils.cpython-311.pyc,,
|
||||
flask_navigation/api.py,sha256=ORh-RV8f_RuooTcoeqXpoG2h19hDFpJp3jih6GQdRMI,1980
|
||||
flask_navigation/item.py,sha256=1bHlBxD8ffnYlPk5lsfUgitqBPdyhdmYY1dJ7-tgZs0,6971
|
||||
flask_navigation/navbar.py,sha256=rCavK3yqivp2vgBJIhcth4DdGvkcGBkKNRgJsbaULd8,1478
|
||||
flask_navigation/signals.py,sha256=pwwfBB0BRiq2xnJMDIKKYjPacESeYbXrEBb3JoIy6ys,112
|
||||
flask_navigation/utils.py,sha256=iUaK1fpKfDQIkT7V2ve5Ez8Fsf8ocoOkgPFpRAQmUNY,2188
|
||||
tests/integration/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
||||
tests/integration/__pycache__/__init__.cpython-311.pyc,,
|
||||
tests/integration/__pycache__/app.cpython-311.pyc,,
|
||||
tests/integration/__pycache__/ext.cpython-311.pyc,,
|
||||
tests/integration/__pycache__/test_app.cpython-311.pyc,,
|
||||
tests/integration/__pycache__/views.cpython-311.pyc,,
|
||||
tests/integration/app.py,sha256=enKCtXGhyTuZb1HwW-K1oD0ngKSNdxd4oXPutLWa5xA,285
|
||||
tests/integration/ext.py,sha256=KNbqvFYK6f_ciQ-dGBqlD_2CRzwfrm2dsisTHO9TgnI,65
|
||||
tests/integration/test_app.py,sha256=OarYJFaHQZBMKxs8CfFJ2rGbZhDJxuZBLC1SalcfZvw,1301
|
||||
tests/integration/views.py,sha256=JX7Fwnz9301MToprFJFPyiEf0rLfVTKEOqOoRPN08nE,724
|
|
@ -0,0 +1,6 @@
|
|||
Wheel-Version: 1.0
|
||||
Generator: bdist_wheel (0.23.0)
|
||||
Root-Is-Purelib: true
|
||||
Tag: py2-none-any
|
||||
Tag: py3-none-any
|
||||
|
|
@ -0,0 +1 @@
|
|||
{"name": "Flask-Navigation", "metadata_version": "2.0", "keywords": "navigation,flask,navbar,nav", "extras": [], "generator": "bdist_wheel (0.23.0)", "version": "0.2.0", "document_names": {"description": "DESCRIPTION.rst"}, "license": "MIT", "summary": "The navigation of Flask application.", "project_urls": {"Home": "https://github.com/tonyseek/flask-navigation"}, "contacts": [{"role": "author", "email": "tonyseek@gmail.com", "name": "Jiangge Zhang"}], "classifiers": ["Programming Language :: Python", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: Implementation :: PyPy", "Development Status :: 3 - Alpha", "License :: OSI Approved :: MIT License", "Intended Audience :: Developers", "Operating System :: OS Independent", "Environment :: Web Environment", "Framework :: Flask", "Topic :: Software Development :: Libraries :: Python Modules"], "run_requires": [{"requires": ["Flask", "blinker"]}]}
|
|
@ -0,0 +1,2 @@
|
|||
flask_navigation
|
||||
tests
|
|
@ -0,0 +1 @@
|
|||
pip
|
|
@ -0,0 +1,20 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2014 Miguel Grinberg
|
||||
|
||||
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, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@ -0,0 +1,79 @@
|
|||
Metadata-Version: 2.1
|
||||
Name: Flask-SocketIO
|
||||
Version: 5.1.1
|
||||
Summary: Socket.IO integration for Flask applications
|
||||
Home-page: https://github.com/miguelgrinberg/flask-socketio
|
||||
Author: Miguel Grinberg
|
||||
Author-email: miguel.grinberg@gmail.com
|
||||
License: UNKNOWN
|
||||
Project-URL: Bug Tracker, https://github.com/miguelgrinberg/flask-socketio/issues
|
||||
Platform: UNKNOWN
|
||||
Classifier: Environment :: Web Environment
|
||||
Classifier: Intended Audience :: Developers
|
||||
Classifier: Programming Language :: Python :: 3
|
||||
Classifier: License :: OSI Approved :: MIT License
|
||||
Classifier: Operating System :: OS Independent
|
||||
Requires-Python: >=3.6
|
||||
Description-Content-Type: text/markdown
|
||||
License-File: LICENSE
|
||||
Requires-Dist: Flask (>=0.9)
|
||||
Requires-Dist: python-socketio (>=5.0.2)
|
||||
|
||||
Flask-SocketIO
|
||||
==============
|
||||
|
||||
[![Build status](https://github.com/miguelgrinberg/flask-socketio/workflows/build/badge.svg)](https://github.com/miguelgrinberg/Flask-SocketIO/actions) [![codecov](https://codecov.io/gh/miguelgrinberg/flask-socketio/branch/main/graph/badge.svg)](https://codecov.io/gh/miguelgrinberg/flask-socketio)
|
||||
|
||||
Socket.IO integration for Flask applications.
|
||||
|
||||
Sponsors
|
||||
--------
|
||||
|
||||
The following organizations are funding this project:
|
||||
|
||||
![Socket.IO](https://images.opencollective.com/socketio/050e5eb/logo/64.png)<br>[Socket.IO](https://socket.io) | [Add your company here!](https://github.com/sponsors/miguelgrinberg)|
|
||||
-|-
|
||||
|
||||
Many individual sponsors also support this project through small ongoing contributions. Why not [join them](https://github.com/sponsors/miguelgrinberg)?
|
||||
|
||||
Installation
|
||||
------------
|
||||
|
||||
You can install this package as usual with pip:
|
||||
|
||||
pip install flask-socketio
|
||||
|
||||
Example
|
||||
-------
|
||||
|
||||
```py
|
||||
from flask import Flask, render_template
|
||||
from flask_socketio import SocketIO, emit
|
||||
|
||||
app = Flask(__name__)
|
||||
app.config['SECRET_KEY'] = 'secret!'
|
||||
socketio = SocketIO(app)
|
||||
|
||||
@app.route('/')
|
||||
def index():
|
||||
return render_template('index.html')
|
||||
|
||||
@socketio.event
|
||||
def my_event(message):
|
||||
emit('my response', {'data': 'got it!'})
|
||||
|
||||
if __name__ == '__main__':
|
||||
socketio.run(app)
|
||||
```
|
||||
|
||||
Resources
|
||||
---------
|
||||
|
||||
- [Tutorial](http://blog.miguelgrinberg.com/post/easy-websockets-with-flask-and-gevent)
|
||||
- [Documentation](http://flask-socketio.readthedocs.io/en/latest/)
|
||||
- [PyPI](https://pypi.python.org/pypi/Flask-SocketIO)
|
||||
- [Change Log](https://github.com/miguelgrinberg/Flask-SocketIO/blob/main/CHANGES.md)
|
||||
- Questions? See the [questions](https://stackoverflow.com/questions/tagged/flask-socketio) others have asked on Stack Overflow, or [ask](https://stackoverflow.com/questions/ask?tags=python+flask-socketio+python-socketio) your own question.
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
Flask_SocketIO-5.1.1.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
|
||||
Flask_SocketIO-5.1.1.dist-info/LICENSE,sha256=aNCWbkgKjS_T1cJtACyZbvCM36KxWnfQ0LWTuavuYKQ,1082
|
||||
Flask_SocketIO-5.1.1.dist-info/METADATA,sha256=YfMRfjfaG2KLc9B9HklyU6EKEa6Mwi5GIfAGpTEWFdA,2611
|
||||
Flask_SocketIO-5.1.1.dist-info/RECORD,,
|
||||
Flask_SocketIO-5.1.1.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
||||
Flask_SocketIO-5.1.1.dist-info/WHEEL,sha256=OqRkF0eY5GHssMorFjlbTIq072vpHpF60fIQA6lS9xA,92
|
||||
Flask_SocketIO-5.1.1.dist-info/top_level.txt,sha256=C1ugzQBJ3HHUJsWGzyt70XRVOX-y4CUAR8MWKjwJOQ8,15
|
||||
flask_socketio/__init__.py,sha256=2qJGh4OhAkj90wj0Go5IBk34GefHASkjx3QcXwJHdDw,48440
|
||||
flask_socketio/__pycache__/__init__.cpython-311.pyc,,
|
||||
flask_socketio/__pycache__/namespace.cpython-311.pyc,,
|
||||
flask_socketio/__pycache__/test_client.cpython-311.pyc,,
|
||||
flask_socketio/namespace.py,sha256=b3oyXEemu2po-wpoy4ILTHQMVuVQqicogCDxfymfz_w,2020
|
||||
flask_socketio/test_client.py,sha256=97iQtnjxNPWdm255vI1d_WB4y1QuHhZ0-qK-QTE25L0,10468
|
|
@ -0,0 +1,5 @@
|
|||
Wheel-Version: 1.0
|
||||
Generator: bdist_wheel (0.36.2)
|
||||
Root-Is-Purelib: true
|
||||
Tag: py3-none-any
|
||||
|
|
@ -0,0 +1 @@
|
|||
flask_socketio
|
|
@ -0,0 +1 @@
|
|||
pip
|
|
@ -0,0 +1,28 @@
|
|||
Copyright 2007 Pallets
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of the copyright holder nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
|
||||
TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
@ -0,0 +1,112 @@
|
|||
Metadata-Version: 2.1
|
||||
Name: Jinja2
|
||||
Version: 3.0.1
|
||||
Summary: A very fast and expressive template engine.
|
||||
Home-page: https://palletsprojects.com/p/jinja/
|
||||
Author: Armin Ronacher
|
||||
Author-email: armin.ronacher@active-4.com
|
||||
Maintainer: Pallets
|
||||
Maintainer-email: contact@palletsprojects.com
|
||||
License: BSD-3-Clause
|
||||
Project-URL: Donate, https://palletsprojects.com/donate
|
||||
Project-URL: Documentation, https://jinja.palletsprojects.com/
|
||||
Project-URL: Changes, https://jinja.palletsprojects.com/changes/
|
||||
Project-URL: Source Code, https://github.com/pallets/jinja/
|
||||
Project-URL: Issue Tracker, https://github.com/pallets/jinja/issues/
|
||||
Project-URL: Twitter, https://twitter.com/PalletsTeam
|
||||
Project-URL: Chat, https://discord.gg/pallets
|
||||
Platform: UNKNOWN
|
||||
Classifier: Development Status :: 5 - Production/Stable
|
||||
Classifier: Environment :: Web Environment
|
||||
Classifier: Intended Audience :: Developers
|
||||
Classifier: License :: OSI Approved :: BSD License
|
||||
Classifier: Operating System :: OS Independent
|
||||
Classifier: Programming Language :: Python
|
||||
Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
|
||||
Classifier: Topic :: Text Processing :: Markup :: HTML
|
||||
Requires-Python: >=3.6
|
||||
Description-Content-Type: text/x-rst
|
||||
Requires-Dist: MarkupSafe (>=2.0)
|
||||
Provides-Extra: i18n
|
||||
Requires-Dist: Babel (>=2.7) ; extra == 'i18n'
|
||||
|
||||
Jinja
|
||||
=====
|
||||
|
||||
Jinja is a fast, expressive, extensible templating engine. Special
|
||||
placeholders in the template allow writing code similar to Python
|
||||
syntax. Then the template is passed data to render the final document.
|
||||
|
||||
It includes:
|
||||
|
||||
- Template inheritance and inclusion.
|
||||
- Define and import macros within templates.
|
||||
- HTML templates can use autoescaping to prevent XSS from untrusted
|
||||
user input.
|
||||
- A sandboxed environment can safely render untrusted templates.
|
||||
- AsyncIO support for generating templates and calling async
|
||||
functions.
|
||||
- I18N support with Babel.
|
||||
- Templates are compiled to optimized Python code just-in-time and
|
||||
cached, or can be compiled ahead-of-time.
|
||||
- Exceptions point to the correct line in templates to make debugging
|
||||
easier.
|
||||
- Extensible filters, tests, functions, and even syntax.
|
||||
|
||||
Jinja's philosophy is that while application logic belongs in Python if
|
||||
possible, it shouldn't make the template designer's job difficult by
|
||||
restricting functionality too much.
|
||||
|
||||
|
||||
Installing
|
||||
----------
|
||||
|
||||
Install and update using `pip`_:
|
||||
|
||||
.. code-block:: text
|
||||
|
||||
$ pip install -U Jinja2
|
||||
|
||||
.. _pip: https://pip.pypa.io/en/stable/quickstart/
|
||||
|
||||
|
||||
In A Nutshell
|
||||
-------------
|
||||
|
||||
.. code-block:: jinja
|
||||
|
||||
{% extends "base.html" %}
|
||||
{% block title %}Members{% endblock %}
|
||||
{% block content %}
|
||||
<ul>
|
||||
{% for user in users %}
|
||||
<li><a href="{{ user.url }}">{{ user.username }}</a></li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endblock %}
|
||||
|
||||
|
||||
Donate
|
||||
------
|
||||
|
||||
The Pallets organization develops and supports Jinja and other popular
|
||||
packages. In order to grow the community of contributors and users, and
|
||||
allow the maintainers to devote more time to the projects, `please
|
||||
donate today`_.
|
||||
|
||||
.. _please donate today: https://palletsprojects.com/donate
|
||||
|
||||
|
||||
Links
|
||||
-----
|
||||
|
||||
- Documentation: https://jinja.palletsprojects.com/
|
||||
- Changes: https://jinja.palletsprojects.com/changes/
|
||||
- PyPI Releases: https://pypi.org/project/Jinja2/
|
||||
- Source Code: https://github.com/pallets/jinja/
|
||||
- Issue Tracker: https://github.com/pallets/jinja/issues/
|
||||
- Website: https://palletsprojects.com/p/jinja/
|
||||
- Twitter: https://twitter.com/PalletsTeam
|
||||
- Chat: https://discord.gg/pallets
|
||||
|
||||
|
|
@ -0,0 +1,59 @@
|
|||
Jinja2-3.0.1.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
|
||||
Jinja2-3.0.1.dist-info/LICENSE.rst,sha256=O0nc7kEF6ze6wQ-vG-JgQI_oXSUrjp3y4JefweCUQ3s,1475
|
||||
Jinja2-3.0.1.dist-info/METADATA,sha256=k6STiOONbGESP2rEKmjhznuG10vm9sNCHCUQL9AQFM4,3508
|
||||
Jinja2-3.0.1.dist-info/RECORD,,
|
||||
Jinja2-3.0.1.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
||||
Jinja2-3.0.1.dist-info/WHEEL,sha256=OqRkF0eY5GHssMorFjlbTIq072vpHpF60fIQA6lS9xA,92
|
||||
Jinja2-3.0.1.dist-info/entry_points.txt,sha256=Qy_DkVo6Xj_zzOtmErrATe8lHZhOqdjpt3e4JJAGyi8,61
|
||||
Jinja2-3.0.1.dist-info/top_level.txt,sha256=PkeVWtLb3-CqjWi1fO29OCbj55EhX_chhKrCdrVe_zs,7
|
||||
jinja2/__init__.py,sha256=fd8jaCRsCATgC7ahuUTD8CyfQoc4aRfALEIny4mwfog,2205
|
||||
jinja2/__pycache__/__init__.cpython-311.pyc,,
|
||||
jinja2/__pycache__/_identifier.cpython-311.pyc,,
|
||||
jinja2/__pycache__/async_utils.cpython-311.pyc,,
|
||||
jinja2/__pycache__/bccache.cpython-311.pyc,,
|
||||
jinja2/__pycache__/compiler.cpython-311.pyc,,
|
||||
jinja2/__pycache__/constants.cpython-311.pyc,,
|
||||
jinja2/__pycache__/debug.cpython-311.pyc,,
|
||||
jinja2/__pycache__/defaults.cpython-311.pyc,,
|
||||
jinja2/__pycache__/environment.cpython-311.pyc,,
|
||||
jinja2/__pycache__/exceptions.cpython-311.pyc,,
|
||||
jinja2/__pycache__/ext.cpython-311.pyc,,
|
||||
jinja2/__pycache__/filters.cpython-311.pyc,,
|
||||
jinja2/__pycache__/idtracking.cpython-311.pyc,,
|
||||
jinja2/__pycache__/lexer.cpython-311.pyc,,
|
||||
jinja2/__pycache__/loaders.cpython-311.pyc,,
|
||||
jinja2/__pycache__/meta.cpython-311.pyc,,
|
||||
jinja2/__pycache__/nativetypes.cpython-311.pyc,,
|
||||
jinja2/__pycache__/nodes.cpython-311.pyc,,
|
||||
jinja2/__pycache__/optimizer.cpython-311.pyc,,
|
||||
jinja2/__pycache__/parser.cpython-311.pyc,,
|
||||
jinja2/__pycache__/runtime.cpython-311.pyc,,
|
||||
jinja2/__pycache__/sandbox.cpython-311.pyc,,
|
||||
jinja2/__pycache__/tests.cpython-311.pyc,,
|
||||
jinja2/__pycache__/utils.cpython-311.pyc,,
|
||||
jinja2/__pycache__/visitor.cpython-311.pyc,,
|
||||
jinja2/_identifier.py,sha256=EdgGJKi7O1yvr4yFlvqPNEqV6M1qHyQr8Gt8GmVTKVM,1775
|
||||
jinja2/async_utils.py,sha256=bY2nCUfBA_4FSnNUsIsJgljBq3hACr6fzLi7LiyMTn8,1751
|
||||
jinja2/bccache.py,sha256=smAvSDgDSvXdvJzCN_9s0XfkVpQEu8be-QwgeMlrwiM,12677
|
||||
jinja2/compiler.py,sha256=qq0Fo9EpDAEwHPLAs3sAP7dindUvDrFrbx4AcB8xV5M,72046
|
||||
jinja2/constants.py,sha256=GMoFydBF_kdpaRKPoM5cl5MviquVRLVyZtfp5-16jg0,1433
|
||||
jinja2/debug.py,sha256=uBmrsiwjYH5l14R9STn5mydOOyriBYol5lDGvEqAb3A,9238
|
||||
jinja2/defaults.py,sha256=boBcSw78h-lp20YbaXSJsqkAI2uN_mD_TtCydpeq5wU,1267
|
||||
jinja2/environment.py,sha256=T6U4be9mY1CUXXin_EQFwpvpFqCiryweGqzXGRYIoSA,61573
|
||||
jinja2/exceptions.py,sha256=ioHeHrWwCWNaXX1inHmHVblvc4haO7AXsjCp3GfWvx0,5071
|
||||
jinja2/ext.py,sha256=44SjDjeYkkxQTpmC2BetOTxEFMgQ42p2dfSwXmPFcSo,32122
|
||||
jinja2/filters.py,sha256=LslRsJd0JVFBHtdfU_WraM1eQitotciwawiW-seR42U,52577
|
||||
jinja2/idtracking.py,sha256=KdFVohVNK-baOwt_INPMco19D7AfLDEN8i3_JoiYnGQ,10713
|
||||
jinja2/lexer.py,sha256=D5qOKB3KnRqK9gPAZFQvRguomYsQok5-14TKiWTN8Jw,29923
|
||||
jinja2/loaders.py,sha256=ePpWB0xDrILgLVqNFcxqqSbPizsI0T-JlkNEUFqq9fo,22350
|
||||
jinja2/meta.py,sha256=GNPEvifmSaU3CMxlbheBOZjeZ277HThOPUTf1RkppKQ,4396
|
||||
jinja2/nativetypes.py,sha256=62hvvsAxAj0YaxylOHoREYVogJ5JqOlJISgGY3OKd_o,3675
|
||||
jinja2/nodes.py,sha256=LHF97fu6GW4r2Z9UaOX92MOT1wZpdS9Nx4N-5Fp5ti8,34509
|
||||
jinja2/optimizer.py,sha256=tHkMwXxfZkbfA1KmLcqmBMSaz7RLIvvItrJcPoXTyD8,1650
|
||||
jinja2/parser.py,sha256=kHnU8v92GwMYkfr0MVakWv8UlSf_kJPx8LUsgQMof70,39767
|
||||
jinja2/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
||||
jinja2/runtime.py,sha256=bSWdawLjReKpKHhF3-96OIuWYpUy1yxFJCN3jBYyoXc,35013
|
||||
jinja2/sandbox.py,sha256=-8zxR6TO9kUkciAVFsIKu8Oq-C7PTeYEdZ5TtA55-gw,14600
|
||||
jinja2/tests.py,sha256=Am5Z6Lmfr2XaH_npIfJJ8MdXtWsbLjMULZJulTAj30E,5905
|
||||
jinja2/utils.py,sha256=0wGkxDbxlW10y0ac4-kEiy1Bn0AsWXqz8uomK9Ugy1Q,26961
|
||||
jinja2/visitor.py,sha256=ZmeLuTj66ic35-uFH-1m0EKXiw4ObDDb_WuE6h5vPFg,3572
|
|
@ -0,0 +1,5 @@
|
|||
Wheel-Version: 1.0
|
||||
Generator: bdist_wheel (0.36.2)
|
||||
Root-Is-Purelib: true
|
||||
Tag: py3-none-any
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
[babel.extractors]
|
||||
jinja2 = jinja2.ext:babel_extract [i18n]
|
||||
|
|
@ -0,0 +1 @@
|
|||
jinja2
|
|
@ -0,0 +1 @@
|
|||
pip
|
|
@ -0,0 +1,28 @@
|
|||
Copyright 2010 Pallets
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of the copyright holder nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
|
||||
TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
@ -0,0 +1,98 @@
|
|||
Metadata-Version: 2.1
|
||||
Name: MarkupSafe
|
||||
Version: 2.0.1
|
||||
Summary: Safely add untrusted strings to HTML/XML markup.
|
||||
Home-page: https://palletsprojects.com/p/markupsafe/
|
||||
Author: Armin Ronacher
|
||||
Author-email: armin.ronacher@active-4.com
|
||||
Maintainer: Pallets
|
||||
Maintainer-email: contact@palletsprojects.com
|
||||
License: BSD-3-Clause
|
||||
Project-URL: Donate, https://palletsprojects.com/donate
|
||||
Project-URL: Documentation, https://markupsafe.palletsprojects.com/
|
||||
Project-URL: Changes, https://markupsafe.palletsprojects.com/changes/
|
||||
Project-URL: Source Code, https://github.com/pallets/markupsafe/
|
||||
Project-URL: Issue Tracker, https://github.com/pallets/markupsafe/issues/
|
||||
Project-URL: Twitter, https://twitter.com/PalletsTeam
|
||||
Project-URL: Chat, https://discord.gg/pallets
|
||||
Classifier: Development Status :: 5 - Production/Stable
|
||||
Classifier: Environment :: Web Environment
|
||||
Classifier: Intended Audience :: Developers
|
||||
Classifier: License :: OSI Approved :: BSD License
|
||||
Classifier: Operating System :: OS Independent
|
||||
Classifier: Programming Language :: Python
|
||||
Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
|
||||
Classifier: Topic :: Text Processing :: Markup :: HTML
|
||||
Requires-Python: >=3.6
|
||||
Description-Content-Type: text/x-rst
|
||||
License-File: LICENSE.rst
|
||||
|
||||
MarkupSafe
|
||||
==========
|
||||
|
||||
MarkupSafe implements a text object that escapes characters so it is
|
||||
safe to use in HTML and XML. Characters that have special meanings are
|
||||
replaced so that they display as the actual characters. This mitigates
|
||||
injection attacks, meaning untrusted user input can safely be displayed
|
||||
on a page.
|
||||
|
||||
|
||||
Installing
|
||||
----------
|
||||
|
||||
Install and update using `pip`_:
|
||||
|
||||
.. code-block:: text
|
||||
|
||||
pip install -U MarkupSafe
|
||||
|
||||
.. _pip: https://pip.pypa.io/en/stable/quickstart/
|
||||
|
||||
|
||||
Examples
|
||||
--------
|
||||
|
||||
.. code-block:: pycon
|
||||
|
||||
>>> from markupsafe import Markup, escape
|
||||
|
||||
>>> # escape replaces special characters and wraps in Markup
|
||||
>>> escape("<script>alert(document.cookie);</script>")
|
||||
Markup('<script>alert(document.cookie);</script>')
|
||||
|
||||
>>> # wrap in Markup to mark text "safe" and prevent escaping
|
||||
>>> Markup("<strong>Hello</strong>")
|
||||
Markup('<strong>hello</strong>')
|
||||
|
||||
>>> escape(Markup("<strong>Hello</strong>"))
|
||||
Markup('<strong>hello</strong>')
|
||||
|
||||
>>> # Markup is a str subclass
|
||||
>>> # methods and operators escape their arguments
|
||||
>>> template = Markup("Hello <em>{name}</em>")
|
||||
>>> template.format(name='"World"')
|
||||
Markup('Hello <em>"World"</em>')
|
||||
|
||||
|
||||
Donate
|
||||
------
|
||||
|
||||
The Pallets organization develops and supports MarkupSafe and other
|
||||
popular packages. In order to grow the community of contributors and
|
||||
users, and allow the maintainers to devote more time to the projects,
|
||||
`please donate today`_.
|
||||
|
||||
.. _please donate today: https://palletsprojects.com/donate
|
||||
|
||||
|
||||
Links
|
||||
-----
|
||||
|
||||
- Documentation: https://markupsafe.palletsprojects.com/
|
||||
- Changes: https://markupsafe.palletsprojects.com/changes/
|
||||
- PyPI Releases: https://pypi.org/project/MarkupSafe/
|
||||
- Source Code: https://github.com/pallets/markupsafe/
|
||||
- Issue Tracker: https://github.com/pallets/markupsafe/issues/
|
||||
- Website: https://palletsprojects.com/p/markupsafe/
|
||||
- Twitter: https://twitter.com/PalletsTeam
|
||||
- Chat: https://discord.gg/pallets
|
|
@ -0,0 +1,15 @@
|
|||
MarkupSafe-2.0.1.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
|
||||
MarkupSafe-2.0.1.dist-info/LICENSE.rst,sha256=SJqOEQhQntmKN7uYPhHg9-HTHwvY-Zp5yESOf_N9B-o,1475
|
||||
MarkupSafe-2.0.1.dist-info/METADATA,sha256=kHBnecBZmK_95Z7-6QYaHD5qJqzuV83lJ2_Cnzhba2Y,3217
|
||||
MarkupSafe-2.0.1.dist-info/RECORD,,
|
||||
MarkupSafe-2.0.1.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
||||
MarkupSafe-2.0.1.dist-info/WHEEL,sha256=wCpHU5PrLGNdpo-ZaCOtE6te0ycAK2oYvJmTJCUKnUQ,105
|
||||
MarkupSafe-2.0.1.dist-info/top_level.txt,sha256=qy0Plje5IJuvsCBjejJyhDCjEAdcDLK_2agVcex8Z6U,11
|
||||
markupsafe/__init__.py,sha256=9Tez4UIlI7J6_sQcUFK1dKniT_b_8YefpGIyYJ3Sr2Q,8923
|
||||
markupsafe/__pycache__/__init__.cpython-311.pyc,,
|
||||
markupsafe/__pycache__/_native.cpython-311.pyc,,
|
||||
markupsafe/_native.py,sha256=GTKEV-bWgZuSjklhMHOYRHU9k0DMewTf5mVEZfkbuns,1986
|
||||
markupsafe/_speedups.c,sha256=CDDtwaV21D2nYtypnMQzxvvpZpcTvIs8OZ6KDa1g4t0,7400
|
||||
markupsafe/_speedups.cpython-311-x86_64-linux-gnu.so,sha256=RtdXWrnxj3Ugi82YrszU99ICt_jGTKLMgUhZ-aVbIy0,42360
|
||||
markupsafe/_speedups.pyi,sha256=vfMCsOgbAXRNLUXkyuyonG8uEWKYU4PDqNuMaDELAYw,229
|
||||
markupsafe/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@ -0,0 +1,5 @@
|
|||
Wheel-Version: 1.0
|
||||
Generator: bdist_wheel (0.38.4)
|
||||
Root-Is-Purelib: false
|
||||
Tag: cp311-cp311-linux_x86_64
|
||||
|
|
@ -0,0 +1 @@
|
|||
markupsafe
|
|
@ -0,0 +1 @@
|
|||
pip
|
|
@ -0,0 +1,28 @@
|
|||
Copyright 2007 Pallets
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of the copyright holder nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
|
||||
TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
@ -0,0 +1,128 @@
|
|||
Metadata-Version: 2.1
|
||||
Name: Werkzeug
|
||||
Version: 2.0.1
|
||||
Summary: The comprehensive WSGI web application library.
|
||||
Home-page: https://palletsprojects.com/p/werkzeug/
|
||||
Author: Armin Ronacher
|
||||
Author-email: armin.ronacher@active-4.com
|
||||
Maintainer: Pallets
|
||||
Maintainer-email: contact@palletsprojects.com
|
||||
License: BSD-3-Clause
|
||||
Project-URL: Donate, https://palletsprojects.com/donate
|
||||
Project-URL: Documentation, https://werkzeug.palletsprojects.com/
|
||||
Project-URL: Changes, https://werkzeug.palletsprojects.com/changes/
|
||||
Project-URL: Source Code, https://github.com/pallets/werkzeug/
|
||||
Project-URL: Issue Tracker, https://github.com/pallets/werkzeug/issues/
|
||||
Project-URL: Twitter, https://twitter.com/PalletsTeam
|
||||
Project-URL: Chat, https://discord.gg/pallets
|
||||
Platform: UNKNOWN
|
||||
Classifier: Development Status :: 5 - Production/Stable
|
||||
Classifier: Environment :: Web Environment
|
||||
Classifier: Intended Audience :: Developers
|
||||
Classifier: License :: OSI Approved :: BSD License
|
||||
Classifier: Operating System :: OS Independent
|
||||
Classifier: Programming Language :: Python
|
||||
Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
|
||||
Classifier: Topic :: Internet :: WWW/HTTP :: WSGI
|
||||
Classifier: Topic :: Internet :: WWW/HTTP :: WSGI :: Application
|
||||
Classifier: Topic :: Internet :: WWW/HTTP :: WSGI :: Middleware
|
||||
Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
|
||||
Requires-Python: >=3.6
|
||||
Description-Content-Type: text/x-rst
|
||||
Requires-Dist: dataclasses ; python_version < "3.7"
|
||||
Provides-Extra: watchdog
|
||||
Requires-Dist: watchdog ; extra == 'watchdog'
|
||||
|
||||
Werkzeug
|
||||
========
|
||||
|
||||
*werkzeug* German noun: "tool". Etymology: *werk* ("work"), *zeug* ("stuff")
|
||||
|
||||
Werkzeug is a comprehensive `WSGI`_ web application library. It began as
|
||||
a simple collection of various utilities for WSGI applications and has
|
||||
become one of the most advanced WSGI utility libraries.
|
||||
|
||||
It includes:
|
||||
|
||||
- An interactive debugger that allows inspecting stack traces and
|
||||
source code in the browser with an interactive interpreter for any
|
||||
frame in the stack.
|
||||
- A full-featured request object with objects to interact with
|
||||
headers, query args, form data, files, and cookies.
|
||||
- A response object that can wrap other WSGI applications and handle
|
||||
streaming data.
|
||||
- A routing system for matching URLs to endpoints and generating URLs
|
||||
for endpoints, with an extensible system for capturing variables
|
||||
from URLs.
|
||||
- HTTP utilities to handle entity tags, cache control, dates, user
|
||||
agents, cookies, files, and more.
|
||||
- A threaded WSGI server for use while developing applications
|
||||
locally.
|
||||
- A test client for simulating HTTP requests during testing without
|
||||
requiring running a server.
|
||||
|
||||
Werkzeug doesn't enforce any dependencies. It is up to the developer to
|
||||
choose a template engine, database adapter, and even how to handle
|
||||
requests. It can be used to build all sorts of end user applications
|
||||
such as blogs, wikis, or bulletin boards.
|
||||
|
||||
`Flask`_ wraps Werkzeug, using it to handle the details of WSGI while
|
||||
providing more structure and patterns for defining powerful
|
||||
applications.
|
||||
|
||||
.. _WSGI: https://wsgi.readthedocs.io/en/latest/
|
||||
.. _Flask: https://www.palletsprojects.com/p/flask/
|
||||
|
||||
|
||||
Installing
|
||||
----------
|
||||
|
||||
Install and update using `pip`_:
|
||||
|
||||
.. code-block:: text
|
||||
|
||||
pip install -U Werkzeug
|
||||
|
||||
.. _pip: https://pip.pypa.io/en/stable/quickstart/
|
||||
|
||||
|
||||
A Simple Example
|
||||
----------------
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
from werkzeug.wrappers import Request, Response
|
||||
|
||||
@Request.application
|
||||
def application(request):
|
||||
return Response('Hello, World!')
|
||||
|
||||
if __name__ == '__main__':
|
||||
from werkzeug.serving import run_simple
|
||||
run_simple('localhost', 4000, application)
|
||||
|
||||
|
||||
Donate
|
||||
------
|
||||
|
||||
The Pallets organization develops and supports Werkzeug and other
|
||||
popular packages. In order to grow the community of contributors and
|
||||
users, and allow the maintainers to devote more time to the projects,
|
||||
`please donate today`_.
|
||||
|
||||
.. _please donate today: https://palletsprojects.com/donate
|
||||
|
||||
|
||||
Links
|
||||
-----
|
||||
|
||||
- Documentation: https://werkzeug.palletsprojects.com/
|
||||
- Changes: https://werkzeug.palletsprojects.com/changes/
|
||||
- PyPI Releases: https://pypi.org/project/Werkzeug/
|
||||
- Source Code: https://github.com/pallets/werkzeug/
|
||||
- Issue Tracker: https://github.com/pallets/werkzeug/issues/
|
||||
- Website: https://palletsprojects.com/p/werkzeug/
|
||||
- Twitter: https://twitter.com/PalletsTeam
|
||||
- Chat: https://discord.gg/pallets
|
||||
|
||||
|
|
@ -0,0 +1,112 @@
|
|||
Werkzeug-2.0.1.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
|
||||
Werkzeug-2.0.1.dist-info/LICENSE.rst,sha256=O0nc7kEF6ze6wQ-vG-JgQI_oXSUrjp3y4JefweCUQ3s,1475
|
||||
Werkzeug-2.0.1.dist-info/METADATA,sha256=8-W33EMnGqnCCi-d8Dv63IQQuyELRIsXhwOJNXbNgL0,4421
|
||||
Werkzeug-2.0.1.dist-info/RECORD,,
|
||||
Werkzeug-2.0.1.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
||||
Werkzeug-2.0.1.dist-info/WHEEL,sha256=OqRkF0eY5GHssMorFjlbTIq072vpHpF60fIQA6lS9xA,92
|
||||
Werkzeug-2.0.1.dist-info/top_level.txt,sha256=QRyj2VjwJoQkrwjwFIOlB8Xg3r9un0NtqVHQF-15xaw,9
|
||||
werkzeug/__init__.py,sha256=_CCsfdeqNllFNRJx8cvqYrwBsQQQXJaMmnk2sAZnDng,188
|
||||
werkzeug/__pycache__/__init__.cpython-311.pyc,,
|
||||
werkzeug/__pycache__/_internal.cpython-311.pyc,,
|
||||
werkzeug/__pycache__/_reloader.cpython-311.pyc,,
|
||||
werkzeug/__pycache__/datastructures.cpython-311.pyc,,
|
||||
werkzeug/__pycache__/exceptions.cpython-311.pyc,,
|
||||
werkzeug/__pycache__/filesystem.cpython-311.pyc,,
|
||||
werkzeug/__pycache__/formparser.cpython-311.pyc,,
|
||||
werkzeug/__pycache__/http.cpython-311.pyc,,
|
||||
werkzeug/__pycache__/local.cpython-311.pyc,,
|
||||
werkzeug/__pycache__/routing.cpython-311.pyc,,
|
||||
werkzeug/__pycache__/security.cpython-311.pyc,,
|
||||
werkzeug/__pycache__/serving.cpython-311.pyc,,
|
||||
werkzeug/__pycache__/test.cpython-311.pyc,,
|
||||
werkzeug/__pycache__/testapp.cpython-311.pyc,,
|
||||
werkzeug/__pycache__/urls.cpython-311.pyc,,
|
||||
werkzeug/__pycache__/user_agent.cpython-311.pyc,,
|
||||
werkzeug/__pycache__/useragents.cpython-311.pyc,,
|
||||
werkzeug/__pycache__/utils.cpython-311.pyc,,
|
||||
werkzeug/__pycache__/wsgi.cpython-311.pyc,,
|
||||
werkzeug/_internal.py,sha256=_QKkvdaG4pDFwK68c0EpPzYJGe9Y7toRAT1cBbC-CxU,18572
|
||||
werkzeug/_reloader.py,sha256=B1hEfgsUOz2IginBQM5Zak_eaIF7gr3GS5-0x2OHvAE,13950
|
||||
werkzeug/datastructures.py,sha256=KahVPSLOapbNbKh1ppr9K8_DgWJv1EGgA9DhTEGMHcg,97886
|
||||
werkzeug/datastructures.pyi,sha256=5DTPF8P8Zvi458eK27Qcj7eNUlLM_AC0jBNkj6uQpds,33774
|
||||
werkzeug/debug/__init__.py,sha256=CUFrPEYAaotHRkmjOieqd3EasXDii2JVC1HdmEzMwqM,17924
|
||||
werkzeug/debug/__pycache__/__init__.cpython-311.pyc,,
|
||||
werkzeug/debug/__pycache__/console.cpython-311.pyc,,
|
||||
werkzeug/debug/__pycache__/repr.cpython-311.pyc,,
|
||||
werkzeug/debug/__pycache__/tbtools.cpython-311.pyc,,
|
||||
werkzeug/debug/console.py,sha256=E1nBMEvFkX673ShQjPtVY-byYatfX9MN-dBMjRI8a8E,5897
|
||||
werkzeug/debug/repr.py,sha256=QCSHENKsChEZDCIApkVi_UNjhJ77v8BMXK1OfxO189M,9483
|
||||
werkzeug/debug/shared/FONT_LICENSE,sha256=LwAVEI1oYnvXiNMT9SnCH_TaLCxCpeHziDrMg0gPkAI,4673
|
||||
werkzeug/debug/shared/ICON_LICENSE.md,sha256=DhA6Y1gUl5Jwfg0NFN9Rj4VWITt8tUx0IvdGf0ux9-s,222
|
||||
werkzeug/debug/shared/console.png,sha256=bxax6RXXlvOij_KeqvSNX0ojJf83YbnZ7my-3Gx9w2A,507
|
||||
werkzeug/debug/shared/debugger.js,sha256=dYbUmFmb3YZb5YpWpYPOQArdrN7NPeY0ODawL7ihzDI,10524
|
||||
werkzeug/debug/shared/less.png,sha256=-4-kNRaXJSONVLahrQKUxMwXGm9R4OnZ9SxDGpHlIR4,191
|
||||
werkzeug/debug/shared/more.png,sha256=GngN7CioHQoV58rH6ojnkYi8c_qED2Aka5FO5UXrReY,200
|
||||
werkzeug/debug/shared/source.png,sha256=RoGcBTE4CyCB85GBuDGTFlAnUqxwTBiIfDqW15EpnUQ,818
|
||||
werkzeug/debug/shared/style.css,sha256=vyp1RnB227Fuw8LIyM5C-bBCBQN5hvZSCApY2oeJ9ik,6705
|
||||
werkzeug/debug/shared/ubuntu.ttf,sha256=1eaHFyepmy4FyDvjLVzpITrGEBu_CZYY94jE0nED1c0,70220
|
||||
werkzeug/debug/tbtools.py,sha256=TfReusPbM3yjm3xvOFkH45V7-5JnNqB9x1EQPnVC6Xo,19189
|
||||
werkzeug/exceptions.py,sha256=CUwx0pBiNbk4f9cON17ekgKnmLi6HIVFjUmYZc2x0wM,28681
|
||||
werkzeug/filesystem.py,sha256=JS2Dv2QF98WILxY4_thHl-WMcUcwluF_4igkDPaP1l4,1956
|
||||
werkzeug/formparser.py,sha256=GIKfzuQ_khuBXnf3N7_LzOEruYwNc3m4bI02BgtT5jg,17385
|
||||
werkzeug/http.py,sha256=oUCXFFMnkOQ-cHbUY_aiqitshcrSzNDq3fEMf1VI_yk,45141
|
||||
werkzeug/local.py,sha256=WsR6H-2XOtPigpimjORbLsS3h9WI0lCdZjGI2LHDDxA,22733
|
||||
werkzeug/middleware/__init__.py,sha256=qfqgdT5npwG9ses3-FXQJf3aB95JYP1zchetH_T3PUw,500
|
||||
werkzeug/middleware/__pycache__/__init__.cpython-311.pyc,,
|
||||
werkzeug/middleware/__pycache__/dispatcher.cpython-311.pyc,,
|
||||
werkzeug/middleware/__pycache__/http_proxy.cpython-311.pyc,,
|
||||
werkzeug/middleware/__pycache__/lint.cpython-311.pyc,,
|
||||
werkzeug/middleware/__pycache__/profiler.cpython-311.pyc,,
|
||||
werkzeug/middleware/__pycache__/proxy_fix.cpython-311.pyc,,
|
||||
werkzeug/middleware/__pycache__/shared_data.cpython-311.pyc,,
|
||||
werkzeug/middleware/dispatcher.py,sha256=Fh_w-KyWnTSYF-Lfv5dimQ7THSS7afPAZMmvc4zF1gg,2580
|
||||
werkzeug/middleware/http_proxy.py,sha256=HE8VyhS7CR-E1O6_9b68huv8FLgGGR1DLYqkS3Xcp3Q,7558
|
||||
werkzeug/middleware/lint.py,sha256=yMzMdm4xI2_N-Wv2j1yoaVI3ltHOYS6yZyA-wUv1sKw,13962
|
||||
werkzeug/middleware/profiler.py,sha256=G2JieUMv4QPamtCY6ibIK7P-piPRdPybav7bm2MSFvs,4898
|
||||
werkzeug/middleware/proxy_fix.py,sha256=uRgQ3dEvFV8JxUqajHYYYOPEeA_BFqaa51Yp8VW0uzA,6849
|
||||
werkzeug/middleware/shared_data.py,sha256=eOCGr-i6BCexDfL7xdPRWMwPJPgp0NE2B416Gl67Q78,10959
|
||||
werkzeug/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
||||
werkzeug/routing.py,sha256=FDRtvCfaZSmXnQ0cUYxowb3P0y0dxlUlMSUmerY5sb0,84147
|
||||
werkzeug/sansio/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
||||
werkzeug/sansio/__pycache__/__init__.cpython-311.pyc,,
|
||||
werkzeug/sansio/__pycache__/multipart.cpython-311.pyc,,
|
||||
werkzeug/sansio/__pycache__/request.cpython-311.pyc,,
|
||||
werkzeug/sansio/__pycache__/response.cpython-311.pyc,,
|
||||
werkzeug/sansio/__pycache__/utils.cpython-311.pyc,,
|
||||
werkzeug/sansio/multipart.py,sha256=bJMCNC2f5xyAaylahNViJ0JqmV4ThLRbDVGVzKwcqrQ,8751
|
||||
werkzeug/sansio/request.py,sha256=aA9rABkWiG4MhYMByanst2NXkEclsq8SIxhb0LQf0e0,20228
|
||||
werkzeug/sansio/response.py,sha256=HSG6t-tyPZd3awzWqr7qL9IV4HYAvDgON1c0YPU2RXw,24117
|
||||
werkzeug/sansio/utils.py,sha256=V5v-UUnX8pm4RehP9Tt_NiUSOJGJGUvKjlW0eOIQldM,4164
|
||||
werkzeug/security.py,sha256=gPDRuCjkjWrcqj99tBMq8_nHFZLFQjgoW5Ga5XIw9jo,8158
|
||||
werkzeug/serving.py,sha256=_RG2dCclOQcdjJ2NE8tzCRybGePlwcs8kTypiWRP2gY,38030
|
||||
werkzeug/test.py,sha256=EJXJy-b_JriHrlfs5VNCkwbki8Kn_xUDkOYOCx_6Q7Q,48096
|
||||
werkzeug/testapp.py,sha256=f48prWSGJhbSrvYb8e1fnAah4BkrLb0enHSdChgsjBY,9471
|
||||
werkzeug/urls.py,sha256=3o_aUcr5Ou13XihSU6VvX6RHMhoWkKpXuCCia9SSAb8,41021
|
||||
werkzeug/user_agent.py,sha256=WclZhpvgLurMF45hsioSbS75H1Zb4iMQGKN3_yZ2oKo,1420
|
||||
werkzeug/useragents.py,sha256=G8tmv_6vxJaPrLQH3eODNgIYe0_V6KETROQlJI-WxDE,7264
|
||||
werkzeug/utils.py,sha256=WrU-LbwemyGd8zBHBgQyLaIxing4QLEChiP0qnzr2sc,36771
|
||||
werkzeug/wrappers/__init__.py,sha256=-s75nPbyXHzU_rwmLPDhoMuGbEUk0jZT_n0ZQAOFGf8,654
|
||||
werkzeug/wrappers/__pycache__/__init__.cpython-311.pyc,,
|
||||
werkzeug/wrappers/__pycache__/accept.cpython-311.pyc,,
|
||||
werkzeug/wrappers/__pycache__/auth.cpython-311.pyc,,
|
||||
werkzeug/wrappers/__pycache__/base_request.cpython-311.pyc,,
|
||||
werkzeug/wrappers/__pycache__/base_response.cpython-311.pyc,,
|
||||
werkzeug/wrappers/__pycache__/common_descriptors.cpython-311.pyc,,
|
||||
werkzeug/wrappers/__pycache__/cors.cpython-311.pyc,,
|
||||
werkzeug/wrappers/__pycache__/etag.cpython-311.pyc,,
|
||||
werkzeug/wrappers/__pycache__/json.cpython-311.pyc,,
|
||||
werkzeug/wrappers/__pycache__/request.cpython-311.pyc,,
|
||||
werkzeug/wrappers/__pycache__/response.cpython-311.pyc,,
|
||||
werkzeug/wrappers/__pycache__/user_agent.cpython-311.pyc,,
|
||||
werkzeug/wrappers/accept.py,sha256=_oZtAQkahvsrPRkNj2fieg7_St9P0NFC3SgZbJKS6xU,429
|
||||
werkzeug/wrappers/auth.py,sha256=rZPCzGxHk9R55PRkmS90kRywUVjjuMWzCGtH68qCq8U,856
|
||||
werkzeug/wrappers/base_request.py,sha256=saz9RyNQkvI_XLPYVm29KijNHmD1YzgxDqa0qHTbgss,1174
|
||||
werkzeug/wrappers/base_response.py,sha256=q_-TaYywT5G4zA-DWDRDJhJSat2_4O7gOPob6ye4_9A,1186
|
||||
werkzeug/wrappers/common_descriptors.py,sha256=v_kWLH3mvCiSRVJ1FNw7nO3w2UJfzY57UKKB5J4zCvE,898
|
||||
werkzeug/wrappers/cors.py,sha256=c5UndlZsZvYkbPrp6Gj5iSXxw_VOJDJHskO6-jRmNyQ,846
|
||||
werkzeug/wrappers/etag.py,sha256=XHWQQs7Mdd1oWezgBIsl-bYe8ydKkRZVil2Qd01D0Mo,846
|
||||
werkzeug/wrappers/json.py,sha256=HM1btPseGeXca0vnwQN_MvZl6h-qNsFY5YBKXKXFwus,410
|
||||
werkzeug/wrappers/request.py,sha256=0zAkCUwJbUBzioGy2UKxE6XpuXPAZbEhhML4WErzeBo,24818
|
||||
werkzeug/wrappers/response.py,sha256=95hXIysZTeNC0bqhvGB2fLBRKxedR_cgI5szZZWfyzw,35177
|
||||
werkzeug/wrappers/user_agent.py,sha256=Wl1-A0-1r8o7cHIZQTB55O4Ged6LpCKENaQDlOY5pXA,435
|
||||
werkzeug/wsgi.py,sha256=7psV3SHLtCzk1KSuGmIK5uP2QTDXyfCCDclyqCmIUO4,33715
|
|
@ -0,0 +1,5 @@
|
|||
Wheel-Version: 1.0
|
||||
Generator: bdist_wheel (0.36.2)
|
||||
Root-Is-Purelib: true
|
||||
Tag: py3-none-any
|
||||
|
|
@ -0,0 +1 @@
|
|||
werkzeug
|
Binary file not shown.
|
@ -0,0 +1,222 @@
|
|||
# don't import any costly modules
|
||||
import sys
|
||||
import os
|
||||
|
||||
|
||||
is_pypy = '__pypy__' in sys.builtin_module_names
|
||||
|
||||
|
||||
def warn_distutils_present():
|
||||
if 'distutils' not in sys.modules:
|
||||
return
|
||||
if is_pypy and sys.version_info < (3, 7):
|
||||
# PyPy for 3.6 unconditionally imports distutils, so bypass the warning
|
||||
# https://foss.heptapod.net/pypy/pypy/-/blob/be829135bc0d758997b3566062999ee8b23872b4/lib-python/3/site.py#L250
|
||||
return
|
||||
import warnings
|
||||
|
||||
warnings.warn(
|
||||
"Distutils was imported before Setuptools, but importing Setuptools "
|
||||
"also replaces the `distutils` module in `sys.modules`. This may lead "
|
||||
"to undesirable behaviors or errors. To avoid these issues, avoid "
|
||||
"using distutils directly, ensure that setuptools is installed in the "
|
||||
"traditional way (e.g. not an editable install), and/or make sure "
|
||||
"that setuptools is always imported before distutils."
|
||||
)
|
||||
|
||||
|
||||
def clear_distutils():
|
||||
if 'distutils' not in sys.modules:
|
||||
return
|
||||
import warnings
|
||||
|
||||
warnings.warn("Setuptools is replacing distutils.")
|
||||
mods = [
|
||||
name
|
||||
for name in sys.modules
|
||||
if name == "distutils" or name.startswith("distutils.")
|
||||
]
|
||||
for name in mods:
|
||||
del sys.modules[name]
|
||||
|
||||
|
||||
def enabled():
|
||||
"""
|
||||
Allow selection of distutils by environment variable.
|
||||
"""
|
||||
which = os.environ.get('SETUPTOOLS_USE_DISTUTILS', 'local')
|
||||
return which == 'local'
|
||||
|
||||
|
||||
def ensure_local_distutils():
|
||||
import importlib
|
||||
|
||||
clear_distutils()
|
||||
|
||||
# With the DistutilsMetaFinder in place,
|
||||
# perform an import to cause distutils to be
|
||||
# loaded from setuptools._distutils. Ref #2906.
|
||||
with shim():
|
||||
importlib.import_module('distutils')
|
||||
|
||||
# check that submodules load as expected
|
||||
core = importlib.import_module('distutils.core')
|
||||
assert '_distutils' in core.__file__, core.__file__
|
||||
assert 'setuptools._distutils.log' not in sys.modules
|
||||
|
||||
|
||||
def do_override():
|
||||
"""
|
||||
Ensure that the local copy of distutils is preferred over stdlib.
|
||||
|
||||
See https://github.com/pypa/setuptools/issues/417#issuecomment-392298401
|
||||
for more motivation.
|
||||
"""
|
||||
if enabled():
|
||||
warn_distutils_present()
|
||||
ensure_local_distutils()
|
||||
|
||||
|
||||
class _TrivialRe:
|
||||
def __init__(self, *patterns):
|
||||
self._patterns = patterns
|
||||
|
||||
def match(self, string):
|
||||
return all(pat in string for pat in self._patterns)
|
||||
|
||||
|
||||
class DistutilsMetaFinder:
|
||||
def find_spec(self, fullname, path, target=None):
|
||||
# optimization: only consider top level modules and those
|
||||
# found in the CPython test suite.
|
||||
if path is not None and not fullname.startswith('test.'):
|
||||
return
|
||||
|
||||
method_name = 'spec_for_{fullname}'.format(**locals())
|
||||
method = getattr(self, method_name, lambda: None)
|
||||
return method()
|
||||
|
||||
def spec_for_distutils(self):
|
||||
if self.is_cpython():
|
||||
return
|
||||
|
||||
import importlib
|
||||
import importlib.abc
|
||||
import importlib.util
|
||||
|
||||
try:
|
||||
mod = importlib.import_module('setuptools._distutils')
|
||||
except Exception:
|
||||
# There are a couple of cases where setuptools._distutils
|
||||
# may not be present:
|
||||
# - An older Setuptools without a local distutils is
|
||||
# taking precedence. Ref #2957.
|
||||
# - Path manipulation during sitecustomize removes
|
||||
# setuptools from the path but only after the hook
|
||||
# has been loaded. Ref #2980.
|
||||
# In either case, fall back to stdlib behavior.
|
||||
return
|
||||
|
||||
class DistutilsLoader(importlib.abc.Loader):
|
||||
def create_module(self, spec):
|
||||
mod.__name__ = 'distutils'
|
||||
return mod
|
||||
|
||||
def exec_module(self, module):
|
||||
pass
|
||||
|
||||
return importlib.util.spec_from_loader(
|
||||
'distutils', DistutilsLoader(), origin=mod.__file__
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
def is_cpython():
|
||||
"""
|
||||
Suppress supplying distutils for CPython (build and tests).
|
||||
Ref #2965 and #3007.
|
||||
"""
|
||||
return os.path.isfile('pybuilddir.txt')
|
||||
|
||||
def spec_for_pip(self):
|
||||
"""
|
||||
Ensure stdlib distutils when running under pip.
|
||||
See pypa/pip#8761 for rationale.
|
||||
"""
|
||||
if self.pip_imported_during_build():
|
||||
return
|
||||
clear_distutils()
|
||||
self.spec_for_distutils = lambda: None
|
||||
|
||||
@classmethod
|
||||
def pip_imported_during_build(cls):
|
||||
"""
|
||||
Detect if pip is being imported in a build script. Ref #2355.
|
||||
"""
|
||||
import traceback
|
||||
|
||||
return any(
|
||||
cls.frame_file_is_setup(frame) for frame, line in traceback.walk_stack(None)
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
def frame_file_is_setup(frame):
|
||||
"""
|
||||
Return True if the indicated frame suggests a setup.py file.
|
||||
"""
|
||||
# some frames may not have __file__ (#2940)
|
||||
return frame.f_globals.get('__file__', '').endswith('setup.py')
|
||||
|
||||
def spec_for_sensitive_tests(self):
|
||||
"""
|
||||
Ensure stdlib distutils when running select tests under CPython.
|
||||
|
||||
python/cpython#91169
|
||||
"""
|
||||
clear_distutils()
|
||||
self.spec_for_distutils = lambda: None
|
||||
|
||||
sensitive_tests = (
|
||||
[
|
||||
'test.test_distutils',
|
||||
'test.test_peg_generator',
|
||||
'test.test_importlib',
|
||||
]
|
||||
if sys.version_info < (3, 10)
|
||||
else [
|
||||
'test.test_distutils',
|
||||
]
|
||||
)
|
||||
|
||||
|
||||
for name in DistutilsMetaFinder.sensitive_tests:
|
||||
setattr(
|
||||
DistutilsMetaFinder,
|
||||
f'spec_for_{name}',
|
||||
DistutilsMetaFinder.spec_for_sensitive_tests,
|
||||
)
|
||||
|
||||
|
||||
DISTUTILS_FINDER = DistutilsMetaFinder()
|
||||
|
||||
|
||||
def add_shim():
|
||||
DISTUTILS_FINDER in sys.meta_path or insert_shim()
|
||||
|
||||
|
||||
class shim:
|
||||
def __enter__(self):
|
||||
insert_shim()
|
||||
|
||||
def __exit__(self, exc, value, tb):
|
||||
remove_shim()
|
||||
|
||||
|
||||
def insert_shim():
|
||||
sys.meta_path.insert(0, DISTUTILS_FINDER)
|
||||
|
||||
|
||||
def remove_shim():
|
||||
try:
|
||||
sys.meta_path.remove(DISTUTILS_FINDER)
|
||||
except ValueError:
|
||||
pass
|
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1 @@
|
|||
__import__('_distutils_hack').do_override()
|
|
@ -0,0 +1 @@
|
|||
pip
|
|
@ -0,0 +1,373 @@
|
|||
Mozilla Public License Version 2.0
|
||||
==================================
|
||||
|
||||
1. Definitions
|
||||
--------------
|
||||
|
||||
1.1. "Contributor"
|
||||
means each individual or legal entity that creates, contributes to
|
||||
the creation of, or owns Covered Software.
|
||||
|
||||
1.2. "Contributor Version"
|
||||
means the combination of the Contributions of others (if any) used
|
||||
by a Contributor and that particular Contributor's Contribution.
|
||||
|
||||
1.3. "Contribution"
|
||||
means Covered Software of a particular Contributor.
|
||||
|
||||
1.4. "Covered Software"
|
||||
means Source Code Form to which the initial Contributor has attached
|
||||
the notice in Exhibit A, the Executable Form of such Source Code
|
||||
Form, and Modifications of such Source Code Form, in each case
|
||||
including portions thereof.
|
||||
|
||||
1.5. "Incompatible With Secondary Licenses"
|
||||
means
|
||||
|
||||
(a) that the initial Contributor has attached the notice described
|
||||
in Exhibit B to the Covered Software; or
|
||||
|
||||
(b) that the Covered Software was made available under the terms of
|
||||
version 1.1 or earlier of the License, but not also under the
|
||||
terms of a Secondary License.
|
||||
|
||||
1.6. "Executable Form"
|
||||
means any form of the work other than Source Code Form.
|
||||
|
||||
1.7. "Larger Work"
|
||||
means a work that combines Covered Software with other material, in
|
||||
a separate file or files, that is not Covered Software.
|
||||
|
||||
1.8. "License"
|
||||
means this document.
|
||||
|
||||
1.9. "Licensable"
|
||||
means having the right to grant, to the maximum extent possible,
|
||||
whether at the time of the initial grant or subsequently, any and
|
||||
all of the rights conveyed by this License.
|
||||
|
||||
1.10. "Modifications"
|
||||
means any of the following:
|
||||
|
||||
(a) any file in Source Code Form that results from an addition to,
|
||||
deletion from, or modification of the contents of Covered
|
||||
Software; or
|
||||
|
||||
(b) any new file in Source Code Form that contains any Covered
|
||||
Software.
|
||||
|
||||
1.11. "Patent Claims" of a Contributor
|
||||
means any patent claim(s), including without limitation, method,
|
||||
process, and apparatus claims, in any patent Licensable by such
|
||||
Contributor that would be infringed, but for the grant of the
|
||||
License, by the making, using, selling, offering for sale, having
|
||||
made, import, or transfer of either its Contributions or its
|
||||
Contributor Version.
|
||||
|
||||
1.12. "Secondary License"
|
||||
means either the GNU General Public License, Version 2.0, the GNU
|
||||
Lesser General Public License, Version 2.1, the GNU Affero General
|
||||
Public License, Version 3.0, or any later versions of those
|
||||
licenses.
|
||||
|
||||
1.13. "Source Code Form"
|
||||
means the form of the work preferred for making modifications.
|
||||
|
||||
1.14. "You" (or "Your")
|
||||
means an individual or a legal entity exercising rights under this
|
||||
License. For legal entities, "You" includes any entity that
|
||||
controls, is controlled by, or is under common control with You. For
|
||||
purposes of this definition, "control" means (a) the power, direct
|
||||
or indirect, to cause the direction or management of such entity,
|
||||
whether by contract or otherwise, or (b) ownership of more than
|
||||
fifty percent (50%) of the outstanding shares or beneficial
|
||||
ownership of such entity.
|
||||
|
||||
2. License Grants and Conditions
|
||||
--------------------------------
|
||||
|
||||
2.1. Grants
|
||||
|
||||
Each Contributor hereby grants You a world-wide, royalty-free,
|
||||
non-exclusive license:
|
||||
|
||||
(a) under intellectual property rights (other than patent or trademark)
|
||||
Licensable by such Contributor to use, reproduce, make available,
|
||||
modify, display, perform, distribute, and otherwise exploit its
|
||||
Contributions, either on an unmodified basis, with Modifications, or
|
||||
as part of a Larger Work; and
|
||||
|
||||
(b) under Patent Claims of such Contributor to make, use, sell, offer
|
||||
for sale, have made, import, and otherwise transfer either its
|
||||
Contributions or its Contributor Version.
|
||||
|
||||
2.2. Effective Date
|
||||
|
||||
The licenses granted in Section 2.1 with respect to any Contribution
|
||||
become effective for each Contribution on the date the Contributor first
|
||||
distributes such Contribution.
|
||||
|
||||
2.3. Limitations on Grant Scope
|
||||
|
||||
The licenses granted in this Section 2 are the only rights granted under
|
||||
this License. No additional rights or licenses will be implied from the
|
||||
distribution or licensing of Covered Software under this License.
|
||||
Notwithstanding Section 2.1(b) above, no patent license is granted by a
|
||||
Contributor:
|
||||
|
||||
(a) for any code that a Contributor has removed from Covered Software;
|
||||
or
|
||||
|
||||
(b) for infringements caused by: (i) Your and any other third party's
|
||||
modifications of Covered Software, or (ii) the combination of its
|
||||
Contributions with other software (except as part of its Contributor
|
||||
Version); or
|
||||
|
||||
(c) under Patent Claims infringed by Covered Software in the absence of
|
||||
its Contributions.
|
||||
|
||||
This License does not grant any rights in the trademarks, service marks,
|
||||
or logos of any Contributor (except as may be necessary to comply with
|
||||
the notice requirements in Section 3.4).
|
||||
|
||||
2.4. Subsequent Licenses
|
||||
|
||||
No Contributor makes additional grants as a result of Your choice to
|
||||
distribute the Covered Software under a subsequent version of this
|
||||
License (see Section 10.2) or under the terms of a Secondary License (if
|
||||
permitted under the terms of Section 3.3).
|
||||
|
||||
2.5. Representation
|
||||
|
||||
Each Contributor represents that the Contributor believes its
|
||||
Contributions are its original creation(s) or it has sufficient rights
|
||||
to grant the rights to its Contributions conveyed by this License.
|
||||
|
||||
2.6. Fair Use
|
||||
|
||||
This License is not intended to limit any rights You have under
|
||||
applicable copyright doctrines of fair use, fair dealing, or other
|
||||
equivalents.
|
||||
|
||||
2.7. Conditions
|
||||
|
||||
Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted
|
||||
in Section 2.1.
|
||||
|
||||
3. Responsibilities
|
||||
-------------------
|
||||
|
||||
3.1. Distribution of Source Form
|
||||
|
||||
All distribution of Covered Software in Source Code Form, including any
|
||||
Modifications that You create or to which You contribute, must be under
|
||||
the terms of this License. You must inform recipients that the Source
|
||||
Code Form of the Covered Software is governed by the terms of this
|
||||
License, and how they can obtain a copy of this License. You may not
|
||||
attempt to alter or restrict the recipients' rights in the Source Code
|
||||
Form.
|
||||
|
||||
3.2. Distribution of Executable Form
|
||||
|
||||
If You distribute Covered Software in Executable Form then:
|
||||
|
||||
(a) such Covered Software must also be made available in Source Code
|
||||
Form, as described in Section 3.1, and You must inform recipients of
|
||||
the Executable Form how they can obtain a copy of such Source Code
|
||||
Form by reasonable means in a timely manner, at a charge no more
|
||||
than the cost of distribution to the recipient; and
|
||||
|
||||
(b) You may distribute such Executable Form under the terms of this
|
||||
License, or sublicense it under different terms, provided that the
|
||||
license for the Executable Form does not attempt to limit or alter
|
||||
the recipients' rights in the Source Code Form under this License.
|
||||
|
||||
3.3. Distribution of a Larger Work
|
||||
|
||||
You may create and distribute a Larger Work under terms of Your choice,
|
||||
provided that You also comply with the requirements of this License for
|
||||
the Covered Software. If the Larger Work is a combination of Covered
|
||||
Software with a work governed by one or more Secondary Licenses, and the
|
||||
Covered Software is not Incompatible With Secondary Licenses, this
|
||||
License permits You to additionally distribute such Covered Software
|
||||
under the terms of such Secondary License(s), so that the recipient of
|
||||
the Larger Work may, at their option, further distribute the Covered
|
||||
Software under the terms of either this License or such Secondary
|
||||
License(s).
|
||||
|
||||
3.4. Notices
|
||||
|
||||
You may not remove or alter the substance of any license notices
|
||||
(including copyright notices, patent notices, disclaimers of warranty,
|
||||
or limitations of liability) contained within the Source Code Form of
|
||||
the Covered Software, except that You may alter any license notices to
|
||||
the extent required to remedy known factual inaccuracies.
|
||||
|
||||
3.5. Application of Additional Terms
|
||||
|
||||
You may choose to offer, and to charge a fee for, warranty, support,
|
||||
indemnity or liability obligations to one or more recipients of Covered
|
||||
Software. However, You may do so only on Your own behalf, and not on
|
||||
behalf of any Contributor. You must make it absolutely clear that any
|
||||
such warranty, support, indemnity, or liability obligation is offered by
|
||||
You alone, and You hereby agree to indemnify every Contributor for any
|
||||
liability incurred by such Contributor as a result of warranty, support,
|
||||
indemnity or liability terms You offer. You may include additional
|
||||
disclaimers of warranty and limitations of liability specific to any
|
||||
jurisdiction.
|
||||
|
||||
4. Inability to Comply Due to Statute or Regulation
|
||||
---------------------------------------------------
|
||||
|
||||
If it is impossible for You to comply with any of the terms of this
|
||||
License with respect to some or all of the Covered Software due to
|
||||
statute, judicial order, or regulation then You must: (a) comply with
|
||||
the terms of this License to the maximum extent possible; and (b)
|
||||
describe the limitations and the code they affect. Such description must
|
||||
be placed in a text file included with all distributions of the Covered
|
||||
Software under this License. Except to the extent prohibited by statute
|
||||
or regulation, such description must be sufficiently detailed for a
|
||||
recipient of ordinary skill to be able to understand it.
|
||||
|
||||
5. Termination
|
||||
--------------
|
||||
|
||||
5.1. The rights granted under this License will terminate automatically
|
||||
if You fail to comply with any of its terms. However, if You become
|
||||
compliant, then the rights granted under this License from a particular
|
||||
Contributor are reinstated (a) provisionally, unless and until such
|
||||
Contributor explicitly and finally terminates Your grants, and (b) on an
|
||||
ongoing basis, if such Contributor fails to notify You of the
|
||||
non-compliance by some reasonable means prior to 60 days after You have
|
||||
come back into compliance. Moreover, Your grants from a particular
|
||||
Contributor are reinstated on an ongoing basis if such Contributor
|
||||
notifies You of the non-compliance by some reasonable means, this is the
|
||||
first time You have received notice of non-compliance with this License
|
||||
from such Contributor, and You become compliant prior to 30 days after
|
||||
Your receipt of the notice.
|
||||
|
||||
5.2. If You initiate litigation against any entity by asserting a patent
|
||||
infringement claim (excluding declaratory judgment actions,
|
||||
counter-claims, and cross-claims) alleging that a Contributor Version
|
||||
directly or indirectly infringes any patent, then the rights granted to
|
||||
You by any and all Contributors for the Covered Software under Section
|
||||
2.1 of this License shall terminate.
|
||||
|
||||
5.3. In the event of termination under Sections 5.1 or 5.2 above, all
|
||||
end user license agreements (excluding distributors and resellers) which
|
||||
have been validly granted by You or Your distributors under this License
|
||||
prior to termination shall survive termination.
|
||||
|
||||
************************************************************************
|
||||
* *
|
||||
* 6. Disclaimer of Warranty *
|
||||
* ------------------------- *
|
||||
* *
|
||||
* Covered Software is provided under this License on an "as is" *
|
||||
* basis, without warranty of any kind, either expressed, implied, or *
|
||||
* statutory, including, without limitation, warranties that the *
|
||||
* Covered Software is free of defects, merchantable, fit for a *
|
||||
* particular purpose or non-infringing. The entire risk as to the *
|
||||
* quality and performance of the Covered Software is with You. *
|
||||
* Should any Covered Software prove defective in any respect, You *
|
||||
* (not any Contributor) assume the cost of any necessary servicing, *
|
||||
* repair, or correction. This disclaimer of warranty constitutes an *
|
||||
* essential part of this License. No use of any Covered Software is *
|
||||
* authorized under this License except under this disclaimer. *
|
||||
* *
|
||||
************************************************************************
|
||||
|
||||
************************************************************************
|
||||
* *
|
||||
* 7. Limitation of Liability *
|
||||
* -------------------------- *
|
||||
* *
|
||||
* Under no circumstances and under no legal theory, whether tort *
|
||||
* (including negligence), contract, or otherwise, shall any *
|
||||
* Contributor, or anyone who distributes Covered Software as *
|
||||
* permitted above, be liable to You for any direct, indirect, *
|
||||
* special, incidental, or consequential damages of any character *
|
||||
* including, without limitation, damages for lost profits, loss of *
|
||||
* goodwill, work stoppage, computer failure or malfunction, or any *
|
||||
* and all other commercial damages or losses, even if such party *
|
||||
* shall have been informed of the possibility of such damages. This *
|
||||
* limitation of liability shall not apply to liability for death or *
|
||||
* personal injury resulting from such party's negligence to the *
|
||||
* extent applicable law prohibits such limitation. Some *
|
||||
* jurisdictions do not allow the exclusion or limitation of *
|
||||
* incidental or consequential damages, so this exclusion and *
|
||||
* limitation may not apply to You. *
|
||||
* *
|
||||
************************************************************************
|
||||
|
||||
8. Litigation
|
||||
-------------
|
||||
|
||||
Any litigation relating to this License may be brought only in the
|
||||
courts of a jurisdiction where the defendant maintains its principal
|
||||
place of business and such litigation shall be governed by laws of that
|
||||
jurisdiction, without reference to its conflict-of-law provisions.
|
||||
Nothing in this Section shall prevent a party's ability to bring
|
||||
cross-claims or counter-claims.
|
||||
|
||||
9. Miscellaneous
|
||||
----------------
|
||||
|
||||
This License represents the complete agreement concerning the subject
|
||||
matter hereof. If any provision of this License is held to be
|
||||
unenforceable, such provision shall be reformed only to the extent
|
||||
necessary to make it enforceable. Any law or regulation which provides
|
||||
that the language of a contract shall be construed against the drafter
|
||||
shall not be used to construe this License against a Contributor.
|
||||
|
||||
10. Versions of the License
|
||||
---------------------------
|
||||
|
||||
10.1. New Versions
|
||||
|
||||
Mozilla Foundation is the license steward. Except as provided in Section
|
||||
10.3, no one other than the license steward has the right to modify or
|
||||
publish new versions of this License. Each version will be given a
|
||||
distinguishing version number.
|
||||
|
||||
10.2. Effect of New Versions
|
||||
|
||||
You may distribute the Covered Software under the terms of the version
|
||||
of the License under which You originally received the Covered Software,
|
||||
or under the terms of any subsequent version published by the license
|
||||
steward.
|
||||
|
||||
10.3. Modified Versions
|
||||
|
||||
If you create software not governed by this License, and you want to
|
||||
create a new license for such software, you may create and use a
|
||||
modified version of this License if you rename the license and remove
|
||||
any references to the name of the license steward (except to note that
|
||||
such modified license differs from this License).
|
||||
|
||||
10.4. Distributing Source Code Form that is Incompatible With Secondary
|
||||
Licenses
|
||||
|
||||
If You choose to distribute Source Code Form that is Incompatible With
|
||||
Secondary Licenses under the terms of this version of the License, the
|
||||
notice described in Exhibit B of this License must be attached.
|
||||
|
||||
Exhibit A - Source Code Form License Notice
|
||||
-------------------------------------------
|
||||
|
||||
This Source Code Form is subject to the terms of the Mozilla Public
|
||||
License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
If it is not possible or desirable to put the notice in a particular
|
||||
file, then You may include the notice in a location (such as a LICENSE
|
||||
file in a relevant directory) where a recipient would be likely to look
|
||||
for such a notice.
|
||||
|
||||
You may add additional accurate notices of copyright ownership.
|
||||
|
||||
Exhibit B - "Incompatible With Secondary Licenses" Notice
|
||||
---------------------------------------------------------
|
||||
|
||||
This Source Code Form is "Incompatible With Secondary Licenses", as
|
||||
defined by the Mozilla Public License, v. 2.0.
|
|
@ -0,0 +1,334 @@
|
|||
Metadata-Version: 2.1
|
||||
Name: bidict
|
||||
Version: 0.21.2
|
||||
Summary: The bidirectional mapping library for Python.
|
||||
Home-page: https://bidict.readthedocs.io
|
||||
Author: Joshua Bronson
|
||||
Author-email: jabronson@gmail.com
|
||||
License: MPL 2.0
|
||||
Keywords: dict dictionary mapping datastructure bimap bijection bijective injective inverse reverse bidirectional two-way 2-way
|
||||
Platform: UNKNOWN
|
||||
Classifier: Development Status :: 4 - Beta
|
||||
Classifier: Intended Audience :: Developers
|
||||
Classifier: License :: OSI Approved :: Mozilla Public License 2.0 (MPL 2.0)
|
||||
Classifier: Operating System :: OS Independent
|
||||
Classifier: Programming Language :: Python :: 3 :: Only
|
||||
Classifier: Programming Language :: Python :: 3.6
|
||||
Classifier: Programming Language :: Python :: 3.7
|
||||
Classifier: Programming Language :: Python :: 3.8
|
||||
Classifier: Programming Language :: Python :: Implementation :: CPython
|
||||
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
||||
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
||||
Requires-Python: >=3.6
|
||||
Description-Content-Type: text/x-rst
|
||||
Provides-Extra: coverage
|
||||
Requires-Dist: coverage (<6) ; extra == 'coverage'
|
||||
Requires-Dist: pytest-cov (<3) ; extra == 'coverage'
|
||||
Provides-Extra: dev
|
||||
Requires-Dist: setuptools-scm ; extra == 'dev'
|
||||
Requires-Dist: hypothesis (<6) ; extra == 'dev'
|
||||
Requires-Dist: py (<2) ; extra == 'dev'
|
||||
Requires-Dist: pytest (<7) ; extra == 'dev'
|
||||
Requires-Dist: pytest-benchmark (<4,>=3.2.0) ; extra == 'dev'
|
||||
Requires-Dist: sortedcollections (<2) ; extra == 'dev'
|
||||
Requires-Dist: sortedcontainers (<3) ; extra == 'dev'
|
||||
Requires-Dist: Sphinx (<4) ; extra == 'dev'
|
||||
Requires-Dist: sphinx-autodoc-typehints (<2) ; extra == 'dev'
|
||||
Requires-Dist: coverage (<6) ; extra == 'dev'
|
||||
Requires-Dist: pytest-cov (<3) ; extra == 'dev'
|
||||
Requires-Dist: pre-commit (<3) ; extra == 'dev'
|
||||
Requires-Dist: tox (<4) ; extra == 'dev'
|
||||
Provides-Extra: docs
|
||||
Requires-Dist: Sphinx (<4) ; extra == 'docs'
|
||||
Requires-Dist: sphinx-autodoc-typehints (<2) ; extra == 'docs'
|
||||
Provides-Extra: precommit
|
||||
Requires-Dist: pre-commit (<3) ; extra == 'precommit'
|
||||
Provides-Extra: test
|
||||
Requires-Dist: hypothesis (<6) ; extra == 'test'
|
||||
Requires-Dist: py (<2) ; extra == 'test'
|
||||
Requires-Dist: pytest (<7) ; extra == 'test'
|
||||
Requires-Dist: pytest-benchmark (<4,>=3.2.0) ; extra == 'test'
|
||||
Requires-Dist: sortedcollections (<2) ; extra == 'test'
|
||||
Requires-Dist: sortedcontainers (<3) ; extra == 'test'
|
||||
Requires-Dist: Sphinx (<4) ; extra == 'test'
|
||||
Requires-Dist: sphinx-autodoc-typehints (<2) ; extra == 'test'
|
||||
|
||||
.. Forward declarations for all the custom interpreted text roles that
|
||||
Sphinx defines and that are used below. This helps Sphinx-unaware tools
|
||||
(e.g. rst2html, PyPI's and GitHub's renderers, etc.).
|
||||
.. role:: doc
|
||||
|
||||
.. Use :doc: rather than :ref: references below for better interop as well.
|
||||
|
||||
|
||||
``bidict``
|
||||
==========
|
||||
|
||||
The bidirectional mapping library for Python.
|
||||
|
||||
.. image:: https://raw.githubusercontent.com/jab/bidict/master/assets/logo-sm.png
|
||||
:target: https://bidict.readthedocs.io/
|
||||
:alt: bidict logo
|
||||
|
||||
|
||||
Status
|
||||
------
|
||||
|
||||
.. image:: https://img.shields.io/pypi/v/bidict.svg
|
||||
:target: https://pypi.org/project/bidict
|
||||
:alt: Latest release
|
||||
|
||||
.. image:: https://img.shields.io/readthedocs/bidict/master.svg
|
||||
:target: https://bidict.readthedocs.io/en/master/
|
||||
:alt: Documentation
|
||||
|
||||
.. image:: https://api.travis-ci.org/jab/bidict.svg?branch=master
|
||||
:target: https://travis-ci.org/jab/bidict
|
||||
:alt: Travis-CI build status
|
||||
|
||||
.. image:: https://codecov.io/gh/jab/bidict/branch/master/graph/badge.svg
|
||||
:target: https://codecov.io/gh/jab/bidict
|
||||
:alt: Test coverage
|
||||
|
||||
.. Hide to reduce clutter
|
||||
.. image:: https://img.shields.io/lgtm/alerts/github/jab/bidict.svg
|
||||
:target: https://lgtm.com/projects/g/jab/bidict/
|
||||
:alt: LGTM alerts
|
||||
.. image:: https://bestpractices.coreinfrastructure.org/projects/2354/badge
|
||||
:target: https://bestpractices.coreinfrastructure.org/en/projects/2354
|
||||
:alt: CII best practices badge
|
||||
.. image:: https://img.shields.io/badge/tidelift-pro%20support-orange.svg
|
||||
:target: https://tidelift.com/subscription/pkg/pypi-bidict?utm_source=pypi-bidict&utm_medium=referral&utm_campaign=docs
|
||||
:alt: Paid support available via Tidelift
|
||||
.. image:: https://ci.appveyor.com/api/projects/status/gk133415udncwto3/branch/master?svg=true
|
||||
:target: https://ci.appveyor.com/project/jab/bidict
|
||||
:alt: AppVeyor (Windows) build status
|
||||
.. image:: https://img.shields.io/pypi/pyversions/bidict.svg
|
||||
:target: https://pypi.org/project/bidict
|
||||
:alt: Supported Python versions
|
||||
.. image:: https://img.shields.io/pypi/implementation/bidict.svg
|
||||
:target: https://pypi.org/project/bidict
|
||||
:alt: Supported Python implementations
|
||||
|
||||
.. image:: https://img.shields.io/pypi/l/bidict.svg
|
||||
:target: https://raw.githubusercontent.com/jab/bidict/master/LICENSE
|
||||
:alt: License
|
||||
|
||||
.. image:: https://static.pepy.tech/badge/bidict
|
||||
:target: https://pepy.tech/project/bidict
|
||||
:alt: PyPI Downloads
|
||||
|
||||
|
||||
``bidict``:
|
||||
^^^^^^^^^^^
|
||||
|
||||
- has been used for many years by several teams at
|
||||
**Google, Venmo, CERN, Bank of America Merrill Lynch, Bloomberg, Two Sigma,** and many others
|
||||
- has carefully designed APIs for
|
||||
**safety, simplicity, flexibility, and ergonomics**
|
||||
- is **fast, lightweight, and has no runtime dependencies** other than Python's standard library
|
||||
- **integrates natively** with Python’s ``collections.abc`` interfaces
|
||||
- provides **type hints** for all public APIs
|
||||
- is implemented in **concise, well-factored, pure (PyPy-compatible) Python code**
|
||||
that is **optimized for running efficiently**
|
||||
as well as for **reading and learning** [#fn-learning]_
|
||||
- has **extensive docs and test coverage**
|
||||
(including property-based tests and benchmarks)
|
||||
run continuously on all supported Python versions
|
||||
|
||||
|
||||
Note: Python 3 Required
|
||||
~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
As promised in the 0.18.2 release (see :doc:`changelog` [#fn-changelog]_),
|
||||
**Python 2 is no longer supported**.
|
||||
Version 0.18.3
|
||||
is the last release of ``bidict`` that supports Python 2.
|
||||
This makes ``bidict`` more efficient on Python 3
|
||||
and enables further improvement to bidict in the future.
|
||||
See `python3statement.org <https://python3statement.org>`__
|
||||
for more info.
|
||||
|
||||
|
||||
Installation
|
||||
------------
|
||||
|
||||
``pip install bidict``
|
||||
|
||||
|
||||
Quick Start
|
||||
-----------
|
||||
|
||||
.. code:: python
|
||||
|
||||
>>> from bidict import bidict
|
||||
>>> element_by_symbol = bidict({'H': 'hydrogen'})
|
||||
>>> element_by_symbol['H']
|
||||
'hydrogen'
|
||||
>>> element_by_symbol.inverse['hydrogen']
|
||||
'H'
|
||||
|
||||
|
||||
For more usage documentation,
|
||||
head to the :doc:`intro` [#fn-intro]_
|
||||
and proceed from there.
|
||||
|
||||
|
||||
Community Support
|
||||
-----------------
|
||||
|
||||
.. image:: https://img.shields.io/badge/chat-on%20gitter-5AB999.svg?logo=gitter-white
|
||||
:target: https://gitter.im/jab/bidict
|
||||
:alt: Chat
|
||||
|
||||
If you are thinking of using ``bidict`` in your work,
|
||||
or if you have any questions, comments, or suggestions,
|
||||
I'd love to know about your use case
|
||||
and provide as much voluntary support for it as possible.
|
||||
|
||||
Please feel free to leave a message in the
|
||||
`chatroom <https://gitter.im/jab/bidict>`__
|
||||
or open a new issue on GitHub.
|
||||
You can search through
|
||||
`existing issues <https://github.com/jab/bidict/issues>`__
|
||||
before creating a new one
|
||||
in case your questions or concerns have been adressed there already.
|
||||
|
||||
|
||||
Enterprise-Grade Support via Tidelift
|
||||
-------------------------------------
|
||||
|
||||
.. image:: https://img.shields.io/badge/tidelift-pro%20support-orange.svg
|
||||
:target: https://tidelift.com/subscription/pkg/pypi-bidict?utm_source=pypi-bidict&utm_medium=referral&utm_campaign=readme
|
||||
:alt: Paid support available via Tidelift
|
||||
|
||||
If your use case requires a greater level of support,
|
||||
enterprise-grade support for ``bidict`` can be obtained via the
|
||||
`Tidelift subscription <https://tidelift.com/subscription/pkg/pypi-bidict?utm_source=pypi-bidict&utm_medium=referral&utm_campaign=readme>`__.
|
||||
|
||||
|
||||
Notice of Usage
|
||||
---------------
|
||||
|
||||
If you use ``bidict``,
|
||||
and especially if your usage or your organization is significant in some way,
|
||||
please let me know.
|
||||
|
||||
You can:
|
||||
|
||||
- `star bidict on GitHub <https://github.com/jab/bidict>`__
|
||||
- `create an issue <https://github.com/jab/bidict/issues/new?title=Notice+of+Usage&body=I+am+using+bidict+for...>`__
|
||||
- leave a message in the `chat room <https://gitter.im/jab/bidict>`__
|
||||
- `email me <mailto:jabronson@gmail.com?subject=bidict&body=I%20am%20using%20bidict%20for...>`__
|
||||
|
||||
|
||||
Changelog
|
||||
---------
|
||||
|
||||
See the :doc:`changelog` [#fn-changelog]_
|
||||
for a history of notable changes to ``bidict``.
|
||||
|
||||
|
||||
Release Notifications
|
||||
---------------------
|
||||
|
||||
.. duplicated in CHANGELOG.rst:
|
||||
(would use `.. include::` but GitHub doesn't understand it)
|
||||
|
||||
.. image:: https://img.shields.io/badge/libraries.io-subscribe-5BC0DF.svg
|
||||
:target: https://libraries.io/pypi/bidict
|
||||
:alt: Follow on libraries.io
|
||||
|
||||
Subscribe to releases
|
||||
`on GitHub <https://github.blog/changelog/2018-11-27-watch-releases/>`__ or
|
||||
`libraries.io <https://libraries.io/pypi/bidict>`__
|
||||
to be notified when new versions of ``bidict`` are released.
|
||||
|
||||
|
||||
Learning from ``bidict``
|
||||
------------------------
|
||||
|
||||
One of the best things about ``bidict``
|
||||
is that it touches a surprising number of
|
||||
interesting Python corners,
|
||||
especially given its small size and scope.
|
||||
|
||||
Check out :doc:`learning-from-bidict` [#fn-learning]_
|
||||
if you're interested in learning more.
|
||||
|
||||
|
||||
Contributing
|
||||
------------
|
||||
|
||||
``bidict`` is currently a one-person operation
|
||||
maintained on a voluntary basis.
|
||||
|
||||
Your help would be most welcome!
|
||||
|
||||
|
||||
Reviewers Wanted!
|
||||
^^^^^^^^^^^^^^^^^
|
||||
|
||||
One of the most valuable ways to contribute to ``bidict`` –
|
||||
and to explore some interesting Python corners [#fn-learning]_
|
||||
while you're at it –
|
||||
is to review the relatively small codebase.
|
||||
|
||||
Please create an issue or pull request with any improvements you'd propose
|
||||
or any other results you found.
|
||||
Submitting a `draft PR <https://github.blog/2019-02-14-introducing-draft-pull-requests/>`__
|
||||
with feedback in inline code comments, or a
|
||||
`"Review results" issue <https://github.com/jab/bidict/issues/new?title=Review+results>`__,
|
||||
would each work well.
|
||||
|
||||
You can also
|
||||
+1 `this issue <https://github.com/jab/bidict/issues/63>`__
|
||||
to sign up to give feedback on future proposed changes
|
||||
that are in need of a reviewer.
|
||||
|
||||
|
||||
Giving Back
|
||||
^^^^^^^^^^^
|
||||
|
||||
.. duplicated in CONTRIBUTING.rst
|
||||
(would use `.. include::` but GitHub doesn't understand it)
|
||||
|
||||
``bidict`` is the product of hundreds of hours of unpaid, voluntary work.
|
||||
|
||||
If ``bidict`` has helped you accomplish your work,
|
||||
especially work you've been paid for,
|
||||
please consider chipping in toward the costs
|
||||
of its maintenance and development
|
||||
and/or ask your organization to do the same.
|
||||
|
||||
.. image:: https://raw.githubusercontent.com/jab/bidict/master/assets/support-on-gumroad.png
|
||||
:target: https://gumroad.com/l/bidict
|
||||
:alt: Support bidict
|
||||
|
||||
|
||||
Finding Documentation
|
||||
---------------------
|
||||
|
||||
If you're viewing this on `<https://bidict.readthedocs.io>`__,
|
||||
note that multiple versions of the documentation are available,
|
||||
and you can choose a different version using the popup menu at the bottom-right.
|
||||
Please make sure you're viewing the version of the documentation
|
||||
that corresponds to the version of ``bidict`` you'd like to use.
|
||||
|
||||
If you're viewing this on GitHub, PyPI, or some other place
|
||||
that can't render and link this documentation properly
|
||||
and are seeing broken links,
|
||||
try these alternate links instead:
|
||||
|
||||
.. [#fn-learning] `<docs/learning-from-bidict.rst>`__ | `<https://bidict.readthedocs.io/learning-from-bidict.html>`__
|
||||
|
||||
.. [#fn-changelog] `<CHANGELOG.rst>`__ | `<https://bidict.readthedocs.io/changelog.html>`__
|
||||
|
||||
.. [#fn-intro] `<docs/intro.rst>`__ | `<https://bidict.readthedocs.io/intro.html>`__
|
||||
|
||||
|
||||
----
|
||||
|
||||
Next: :doc:`intro` [#fn-intro]_
|
||||
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
bidict-0.21.2.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
|
||||
bidict-0.21.2.dist-info/LICENSE,sha256=HyVuytGSiAUQ6ErWBHTqt1iSGHhLmlC8fO7jTCuR8dU,16725
|
||||
bidict-0.21.2.dist-info/METADATA,sha256=6p33oEnK6iIEBM4o7wQLGPUyeYHtc-yEW6_s05N3d5c,11630
|
||||
bidict-0.21.2.dist-info/RECORD,,
|
||||
bidict-0.21.2.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
||||
bidict-0.21.2.dist-info/WHEEL,sha256=ADKeyaGyKF5DwBNE0sRE5pvW-bSkFMJfBuhzZ3rceP4,110
|
||||
bidict-0.21.2.dist-info/top_level.txt,sha256=WuQO02jp0ODioS7sJoaHg3JJ5_3h6Sxo9RITvNGPYmc,7
|
||||
bidict/__init__.py,sha256=A2ZUK4jTHNN6T3QUaSh7xuIwc-Ytgw6gVLHNx07D7Fo,3910
|
||||
bidict/__pycache__/__init__.cpython-311.pyc,,
|
||||
bidict/__pycache__/_abc.cpython-311.pyc,,
|
||||
bidict/__pycache__/_base.cpython-311.pyc,,
|
||||
bidict/__pycache__/_bidict.cpython-311.pyc,,
|
||||
bidict/__pycache__/_delegating.cpython-311.pyc,,
|
||||
bidict/__pycache__/_dup.cpython-311.pyc,,
|
||||
bidict/__pycache__/_exc.cpython-311.pyc,,
|
||||
bidict/__pycache__/_frozenbidict.cpython-311.pyc,,
|
||||
bidict/__pycache__/_frozenordered.cpython-311.pyc,,
|
||||
bidict/__pycache__/_iter.cpython-311.pyc,,
|
||||
bidict/__pycache__/_mut.cpython-311.pyc,,
|
||||
bidict/__pycache__/_named.cpython-311.pyc,,
|
||||
bidict/__pycache__/_orderedbase.cpython-311.pyc,,
|
||||
bidict/__pycache__/_orderedbidict.cpython-311.pyc,,
|
||||
bidict/__pycache__/_typing.cpython-311.pyc,,
|
||||
bidict/__pycache__/_version.cpython-311.pyc,,
|
||||
bidict/__pycache__/metadata.cpython-311.pyc,,
|
||||
bidict/_abc.py,sha256=irEWsolFCp8ps77OKmWwB0gTrpXc5be0RBdHaQoPybk,4626
|
||||
bidict/_base.py,sha256=k7oLFwb_6ZMHMhfI217hnM-WfJ4oxVMTol1BG14E3cA,16180
|
||||
bidict/_bidict.py,sha256=85G1TyWeMZLE70HK-qwCVug-bCdaI3bIeoBxJzwSkkQ,2005
|
||||
bidict/_delegating.py,sha256=UibZewwgmN8iBECZtjELwKl5zhcuxYnyy2gsiAXBe3c,1313
|
||||
bidict/_dup.py,sha256=j0DSseguIdCgAhqxm0Zn2887110zx70F19Lvw7hiayg,1819
|
||||
bidict/_exc.py,sha256=nKOGqxqOvyjheh-Pgo-dZZWRRvPEWYyD8Ukm5XR8WNk,1053
|
||||
bidict/_frozenbidict.py,sha256=IYMIzsm9pAXTS819Tw7z_VTLIEZir4oLJbrcRc5yFP8,2494
|
||||
bidict/_frozenordered.py,sha256=E4kzBIoriZLuth9I1ll57KelvUN_xDAvZjQH7GNdn30,3224
|
||||
bidict/_iter.py,sha256=F9zoHs-IrkucujbRGnMJslH_Gc_Qrla4Mk1sOvn7ELg,2333
|
||||
bidict/_mut.py,sha256=MBXzglmeNJniRbdZ1C0Tx14pcsaBdi1NPaaFGIzZEpg,7352
|
||||
bidict/_named.py,sha256=_WQjoz9pE1d_HwVQX05vn5TthOREOw49yDdFSs5lvU4,3784
|
||||
bidict/_orderedbase.py,sha256=yMIRfDtY5DQJoAeI5YvIW49O42MuKqK8qxDrczr1NQY,12196
|
||||
bidict/_orderedbidict.py,sha256=tkfAMxehLetMqTrGoQq9KfdOpgRdhzWqp2lmk6_4vL0,3409
|
||||
bidict/_typing.py,sha256=3lq-wZhWGyn3q7euw6YK7LwFnxOVB1qdqX1x1HcW4Ng,862
|
||||
bidict/_version.py,sha256=e4Wu3F4t-gj1TaiLYadYEQ_3R8pNGz4Xi1K4eN1WFIw,117
|
||||
bidict/metadata.py,sha256=htEXequ7kpMnWeRKrl4cUJZBQIbBegxgu_bxFZ0pIkY,1812
|
||||
bidict/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@ -0,0 +1,6 @@
|
|||
Wheel-Version: 1.0
|
||||
Generator: bdist_wheel (0.35.1)
|
||||
Root-Is-Purelib: true
|
||||
Tag: py2-none-any
|
||||
Tag: py3-none-any
|
||||
|
|
@ -0,0 +1 @@
|
|||
bidict
|
|
@ -0,0 +1,94 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Copyright 2009-2020 Joshua Bronson. All Rights Reserved.
|
||||
#
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
|
||||
#==============================================================================
|
||||
# * Welcome to the bidict source code *
|
||||
#==============================================================================
|
||||
|
||||
# Doing a code review? You'll find a "Code review nav" comment like the one
|
||||
# below at the top and bottom of the most important source files. This provides
|
||||
# a suggested initial path through the source when reviewing.
|
||||
#
|
||||
# Note: If you aren't reading this on https://github.com/jab/bidict, you may be
|
||||
# viewing an outdated version of the code. Please head to GitHub to review the
|
||||
# latest version, which contains important improvements over older versions.
|
||||
#
|
||||
# Thank you for reading and for any feedback you provide.
|
||||
|
||||
# * Code review nav *
|
||||
#==============================================================================
|
||||
# Current: __init__.py Next: _abc.py →
|
||||
#==============================================================================
|
||||
|
||||
|
||||
"""The bidirectional mapping library for Python.
|
||||
|
||||
bidict by example:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
>>> from bidict import bidict
|
||||
>>> element_by_symbol = bidict({'H': 'hydrogen'})
|
||||
>>> element_by_symbol['H']
|
||||
'hydrogen'
|
||||
>>> element_by_symbol.inverse['hydrogen']
|
||||
'H'
|
||||
|
||||
|
||||
Please see https://github.com/jab/bidict for the most up-to-date code and
|
||||
https://bidict.readthedocs.io for the most up-to-date documentation
|
||||
if you are reading this elsewhere.
|
||||
|
||||
|
||||
.. :copyright: (c) 2009-2020 Joshua Bronson.
|
||||
.. :license: MPLv2. See LICENSE for details.
|
||||
"""
|
||||
|
||||
# Use private aliases to not re-export these publicly (for Sphinx automodule with imported-members).
|
||||
from sys import version_info as _version_info
|
||||
|
||||
|
||||
if _version_info < (3, 6): # pragma: no cover
|
||||
raise ImportError('Python 3.6+ is required.')
|
||||
|
||||
# The rest of this file only collects functionality implemented in the rest of the
|
||||
# source for the purposes of exporting it under the `bidict` module namespace.
|
||||
# flake8: noqa: F401 (imported but unused)
|
||||
from ._abc import BidirectionalMapping, MutableBidirectionalMapping
|
||||
from ._base import BidictBase
|
||||
from ._mut import MutableBidict
|
||||
from ._bidict import bidict
|
||||
from ._frozenbidict import frozenbidict
|
||||
from ._frozenordered import FrozenOrderedBidict
|
||||
from ._named import namedbidict
|
||||
from ._orderedbase import OrderedBidictBase
|
||||
from ._orderedbidict import OrderedBidict
|
||||
from ._dup import ON_DUP_DEFAULT, ON_DUP_RAISE, ON_DUP_DROP_OLD, RAISE, DROP_OLD, DROP_NEW, OnDup, OnDupAction
|
||||
from ._exc import BidictException, DuplicationError, KeyDuplicationError, ValueDuplicationError, KeyAndValueDuplicationError
|
||||
from ._iter import inverted
|
||||
from .metadata import (
|
||||
__author__, __maintainer__, __copyright__, __email__, __credits__, __url__,
|
||||
__license__, __status__, __description__, __keywords__, __version__, __version_info__,
|
||||
)
|
||||
|
||||
# Set __module__ of re-exported classes to the 'bidict' top-level module name
|
||||
# so that private/internal submodules are not exposed to users e.g. in repr strings.
|
||||
_locals = tuple(locals().items())
|
||||
for _name, _obj in _locals: # pragma: no cover
|
||||
if not getattr(_obj, '__module__', '').startswith('bidict.'):
|
||||
continue
|
||||
try:
|
||||
_obj.__module__ = 'bidict'
|
||||
except AttributeError as exc: # raised when __module__ is read-only (as in OnDup)
|
||||
pass
|
||||
|
||||
|
||||
# * Code review nav *
|
||||
#==============================================================================
|
||||
# Current: __init__.py Next: _abc.py →
|
||||
#==============================================================================
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue