init
This commit is contained in:
commit
38355d2442
9083 changed files with 1225834 additions and 0 deletions
241
.venv/bin/Activate.ps1
Normal file
241
.venv/bin/Activate.ps1
Normal file
|
|
@ -0,0 +1,241 @@
|
|||
<#
|
||||
.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 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 virutal 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
|
||||
}
|
||||
}
|
||||
|
||||
# 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"
|
||||
76
.venv/bin/activate
Normal file
76
.venv/bin/activate
Normal file
|
|
@ -0,0 +1,76 @@
|
|||
# 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
|
||||
fi
|
||||
|
||||
if [ -n "${_OLD_VIRTUAL_PS1:-}" ] ; then
|
||||
PS1="${_OLD_VIRTUAL_PS1:-}"
|
||||
export PS1
|
||||
unset _OLD_VIRTUAL_PS1
|
||||
fi
|
||||
|
||||
unset VIRTUAL_ENV
|
||||
if [ ! "${1:-}" = "nondestructive" ] ; then
|
||||
# Self destruct!
|
||||
unset -f deactivate
|
||||
fi
|
||||
}
|
||||
|
||||
# unset irrelevant variables
|
||||
deactivate nondestructive
|
||||
|
||||
VIRTUAL_ENV="/home/walkers/git/creeper-adventure/.venv"
|
||||
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:-}"
|
||||
if [ "x(creeper-adventure) " != x ] ; then
|
||||
PS1="(creeper-adventure) ${PS1:-}"
|
||||
else
|
||||
if [ "`basename \"$VIRTUAL_ENV\"`" = "__" ] ; then
|
||||
# special case for Aspen magic directories
|
||||
# see https://aspen.io/
|
||||
PS1="[`basename \`dirname \"$VIRTUAL_ENV\"\``] $PS1"
|
||||
else
|
||||
PS1="(`basename \"$VIRTUAL_ENV\"`)$PS1"
|
||||
fi
|
||||
fi
|
||||
export PS1
|
||||
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
|
||||
fi
|
||||
37
.venv/bin/activate.csh
Normal file
37
.venv/bin/activate.csh
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
# 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; test "\!:*" != "nondestructive" && unalias deactivate'
|
||||
|
||||
# Unset irrelevant variables.
|
||||
deactivate nondestructive
|
||||
|
||||
setenv VIRTUAL_ENV "/home/walkers/git/creeper-adventure/.venv"
|
||||
|
||||
set _OLD_VIRTUAL_PATH="$PATH"
|
||||
setenv PATH "$VIRTUAL_ENV/bin:$PATH"
|
||||
|
||||
|
||||
set _OLD_VIRTUAL_PROMPT="$prompt"
|
||||
|
||||
if (! "$?VIRTUAL_ENV_DISABLE_PROMPT") then
|
||||
if (".venv" != "") then
|
||||
set env_name = ".venv"
|
||||
else
|
||||
if (`basename "VIRTUAL_ENV"` == "__") then
|
||||
# special case for Aspen magic directories
|
||||
# see https://aspen.io/
|
||||
set env_name = `basename \`dirname "$VIRTUAL_ENV"\``
|
||||
else
|
||||
set env_name = `basename "$VIRTUAL_ENV"`
|
||||
endif
|
||||
endif
|
||||
set prompt = "[$env_name] $prompt"
|
||||
unset env_name
|
||||
endif
|
||||
|
||||
alias pydoc python -m pydoc
|
||||
|
||||
rehash
|
||||
75
.venv/bin/activate.fish
Normal file
75
.venv/bin/activate.fish
Normal file
|
|
@ -0,0 +1,75 @@
|
|||
# This file must be used with ". bin/activate.fish" *from fish* (http://fishshell.org)
|
||||
# you cannot run it directly
|
||||
|
||||
function deactivate -d "Exit virtualenv 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"
|
||||
functions -e fish_prompt
|
||||
set -e _OLD_FISH_PROMPT_OVERRIDE
|
||||
functions -c _old_fish_prompt fish_prompt
|
||||
functions -e _old_fish_prompt
|
||||
end
|
||||
|
||||
set -e VIRTUAL_ENV
|
||||
if test "$argv[1]" != "nondestructive"
|
||||
# Self destruct!
|
||||
functions -e deactivate
|
||||
end
|
||||
end
|
||||
|
||||
# unset irrelevant variables
|
||||
deactivate nondestructive
|
||||
|
||||
set -gx VIRTUAL_ENV "/home/walkers/git/creeper-adventure/.venv"
|
||||
|
||||
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
|
||||
|
||||
# Prompt override?
|
||||
if test -n "(creeper-adventure) "
|
||||
printf "%s%s" "(creeper-adventure) " (set_color normal)
|
||||
else
|
||||
# ...Otherwise, prepend env
|
||||
set -l _checkbase (basename "$VIRTUAL_ENV")
|
||||
if test $_checkbase = "__"
|
||||
# special case for Aspen magic directories
|
||||
# see https://aspen.io/
|
||||
printf "%s[%s]%s " (set_color -b blue white) (basename (dirname "$VIRTUAL_ENV")) (set_color normal)
|
||||
else
|
||||
printf "%s(%s)%s" (set_color -b blue white) (basename "$VIRTUAL_ENV") (set_color normal)
|
||||
end
|
||||
end
|
||||
|
||||
# Restore the return status of the previous command.
|
||||
echo "exit $old_status" | .
|
||||
_old_fish_prompt
|
||||
end
|
||||
|
||||
set -gx _OLD_FISH_PROMPT_OVERRIDE "$VIRTUAL_ENV"
|
||||
end
|
||||
8
.venv/bin/black
Executable file
8
.venv/bin/black
Executable file
|
|
@ -0,0 +1,8 @@
|
|||
#!/home/walkers/git/creeper-adventure/.venv/bin/python3
|
||||
# -*- coding: utf-8 -*-
|
||||
import re
|
||||
import sys
|
||||
from black import patched_main
|
||||
if __name__ == '__main__':
|
||||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
||||
sys.exit(patched_main())
|
||||
8
.venv/bin/blackd
Executable file
8
.venv/bin/blackd
Executable file
|
|
@ -0,0 +1,8 @@
|
|||
#!/home/walkers/git/creeper-adventure/.venv/bin/python3
|
||||
# -*- coding: utf-8 -*-
|
||||
import re
|
||||
import sys
|
||||
from blackd import patched_main
|
||||
if __name__ == '__main__':
|
||||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
||||
sys.exit(patched_main())
|
||||
8
.venv/bin/cmark
Executable file
8
.venv/bin/cmark
Executable file
|
|
@ -0,0 +1,8 @@
|
|||
#!/home/walkers/git/creeper-adventure/.venv/bin/python3
|
||||
# -*- coding: utf-8 -*-
|
||||
import re
|
||||
import sys
|
||||
from commonmark.cmark import main
|
||||
if __name__ == '__main__':
|
||||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
||||
sys.exit(main())
|
||||
78
.venv/bin/collect-exports
Executable file
78
.venv/bin/collect-exports
Executable file
|
|
@ -0,0 +1,78 @@
|
|||
#!/home/walkers/git/creeper-adventure/.venv/bin/python3
|
||||
"""
|
||||
collect-exports module1 module2...
|
||||
|
||||
Collect all exports in the specified modules and generate "from foo import
|
||||
..." lines for public members defined in those modules.
|
||||
|
||||
Print the result to stdout.
|
||||
|
||||
"""
|
||||
|
||||
# pyflyby/collect-exports
|
||||
# Copyright (C) 2011, 2012, 2013, 2014 Karl Chen.
|
||||
# License: MIT http://opensource.org/licenses/MIT
|
||||
|
||||
|
||||
from __future__ import absolute_import, division, with_statement
|
||||
from __future__ import print_function
|
||||
|
||||
import sys
|
||||
|
||||
from pyflyby._cmdline import hfmt, parse_args
|
||||
from pyflyby._importdb import ImportDB
|
||||
from pyflyby._log import logger
|
||||
from pyflyby._modules import ModuleHandle
|
||||
|
||||
|
||||
def main():
|
||||
def addopts(parser):
|
||||
parser.add_option("--ignore-known", default=False, action='store_true',
|
||||
help=hfmt('''
|
||||
Don't list imports already in the
|
||||
known-imports database.'''))
|
||||
parser.add_option("--no-ignore-known", dest="ignore_known",
|
||||
action='store_false',
|
||||
help=hfmt('''
|
||||
(Default) List all imports, including those
|
||||
already in the known-imports database.'''))
|
||||
parser.add_option("--expand-known", default=False, action='store_true',
|
||||
help=hfmt('''
|
||||
Scan all modules mentioned in known-imports
|
||||
database.'''))
|
||||
parser.add_option("--no-expand-known", dest="expand_known",
|
||||
action='store_false',
|
||||
help=hfmt('''
|
||||
(Default) Scan only modules listed explicitly
|
||||
on the command line.'''))
|
||||
options, args = parse_args(addopts, import_format_params=True)
|
||||
if options.expand_known:
|
||||
db = ImportDB.get_default(".")
|
||||
known = db.known_imports.imports
|
||||
args += sorted(set(
|
||||
[_f for _f in [i.split.module_name for i in known] if _f]))
|
||||
bad_module_names = []
|
||||
for module_name in args:
|
||||
module = ModuleHandle(module_name)
|
||||
try:
|
||||
imports = module.exports
|
||||
except Exception as e:
|
||||
logger.warning("couldn't get exports for %s; ignoring: %s: %s",
|
||||
module, type(e).__name__, e)
|
||||
bad_module_names.append(module_name)
|
||||
continue
|
||||
if not imports:
|
||||
continue
|
||||
if options.ignore_known:
|
||||
db = ImportDB.get_default(module.__file__)
|
||||
imports = imports.without_imports(db)
|
||||
sys.stdout.write(imports.pretty_print(
|
||||
allow_conflicts=True, params=options.params))
|
||||
if bad_module_names:
|
||||
print("collect-exports: there were problems with: %s" % (
|
||||
' '.join(bad_module_names)), file=sys.stderr)
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
59
.venv/bin/collect-imports
Executable file
59
.venv/bin/collect-imports
Executable file
|
|
@ -0,0 +1,59 @@
|
|||
#!/home/walkers/git/creeper-adventure/.venv/bin/python3
|
||||
"""
|
||||
collect-imports *.py
|
||||
collect-imports < foo.py
|
||||
|
||||
Collect all imports from named files or stdin, and combine them into a single
|
||||
block of import statements. Print the result to stdout.
|
||||
|
||||
"""
|
||||
# pyflyby/collect-imports
|
||||
# Copyright (C) 2011, 2014 Karl Chen.
|
||||
# License: MIT http://opensource.org/licenses/MIT
|
||||
|
||||
from __future__ import absolute_import, division, with_statement
|
||||
|
||||
import re
|
||||
import sys
|
||||
|
||||
from pyflyby._cmdline import filename_args, hfmt, parse_args
|
||||
from pyflyby._importclns import ImportSet
|
||||
from pyflyby._importdb import ImportDB
|
||||
|
||||
|
||||
def main():
|
||||
def addopts(parser):
|
||||
parser.add_option("--ignore-known", default=False, action='store_true',
|
||||
help=hfmt('''
|
||||
Don't list imports already in the
|
||||
known-imports database.'''))
|
||||
parser.add_option("--no-ignore-known", dest="ignore_known",
|
||||
action='store_false',
|
||||
help=hfmt('''
|
||||
(Default) List all imports, including those
|
||||
already in the known-imports database.'''))
|
||||
parser.add_option("--include",
|
||||
default=[], action="append",
|
||||
help=hfmt('''
|
||||
Include only imports under the given package.'''))
|
||||
options, args = parse_args(addopts, import_format_params=True)
|
||||
filenames = filename_args(args)
|
||||
importset = ImportSet(filenames, ignore_nonimports=True)
|
||||
if options.include:
|
||||
regexps = [
|
||||
re.escape(prefix) if prefix.endswith(".") else
|
||||
re.escape(prefix) + "([.]|$)"
|
||||
for prefix in options.include
|
||||
]
|
||||
regexp = re.compile("|".join(regexps))
|
||||
match = lambda imp: regexp.match(imp.fullname)
|
||||
importset = ImportSet([imp for imp in importset if match(imp)])
|
||||
if options.ignore_known:
|
||||
db = ImportDB.get_default(".")
|
||||
importset = importset.without_imports(db.known_imports)
|
||||
sys.stdout.write(importset.pretty_print(
|
||||
allow_conflicts=True, params=options.params))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
8
.venv/bin/dmypy
Executable file
8
.venv/bin/dmypy
Executable file
|
|
@ -0,0 +1,8 @@
|
|||
#!/home/walkers/git/creeper-adventure/.venv/bin/python3
|
||||
# -*- coding: utf-8 -*-
|
||||
import re
|
||||
import sys
|
||||
from mypy.dmypy.client import console_entry
|
||||
if __name__ == '__main__':
|
||||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
||||
sys.exit(console_entry())
|
||||
40
.venv/bin/find-import
Executable file
40
.venv/bin/find-import
Executable file
|
|
@ -0,0 +1,40 @@
|
|||
#!/home/walkers/git/creeper-adventure/.venv/bin/python3
|
||||
"""
|
||||
Usage: find-import names...
|
||||
|
||||
Prints how to import given name(s).
|
||||
"""
|
||||
# pyflyby/find-import
|
||||
# Copyright (C) 2011, 2014 Karl Chen.
|
||||
# License: MIT http://opensource.org/licenses/MIT
|
||||
|
||||
from __future__ import absolute_import, division, with_statement
|
||||
from __future__ import print_function
|
||||
|
||||
from pyflyby._cmdline import parse_args, syntax
|
||||
from pyflyby._importdb import ImportDB
|
||||
from pyflyby._log import logger
|
||||
|
||||
|
||||
def main():
|
||||
options, args = parse_args(import_format_params=True)
|
||||
if not args:
|
||||
syntax()
|
||||
db = ImportDB.get_default(".")
|
||||
known = db.known_imports.by_import_as
|
||||
errors = 0
|
||||
for arg in args:
|
||||
try:
|
||||
imports = known[arg]
|
||||
except KeyError:
|
||||
errors += 1
|
||||
logger.error("Can't find import for %r", arg)
|
||||
else:
|
||||
for imp in imports:
|
||||
print(imp.pretty_print(params=options.params), end=' ')
|
||||
if errors:
|
||||
raise SystemExit(1)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
8
.venv/bin/flake8
Executable file
8
.venv/bin/flake8
Executable file
|
|
@ -0,0 +1,8 @@
|
|||
#!/home/walkers/git/creeper-adventure/.venv/bin/python3
|
||||
# -*- coding: utf-8 -*-
|
||||
import re
|
||||
import sys
|
||||
from flake8.main.cli import main
|
||||
if __name__ == '__main__':
|
||||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
||||
sys.exit(main())
|
||||
8
.venv/bin/identify-cli
Executable file
8
.venv/bin/identify-cli
Executable file
|
|
@ -0,0 +1,8 @@
|
|||
#!/home/walkers/git/creeper-adventure/.venv/bin/python3
|
||||
# -*- coding: utf-8 -*-
|
||||
import re
|
||||
import sys
|
||||
from identify.cli import main
|
||||
if __name__ == '__main__':
|
||||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
||||
sys.exit(main())
|
||||
8
.venv/bin/ipython
Executable file
8
.venv/bin/ipython
Executable file
|
|
@ -0,0 +1,8 @@
|
|||
#!/home/walkers/git/creeper-adventure/.venv/bin/python3
|
||||
# -*- coding: utf-8 -*-
|
||||
import re
|
||||
import sys
|
||||
from IPython import start_ipython
|
||||
if __name__ == '__main__':
|
||||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
||||
sys.exit(start_ipython())
|
||||
8
.venv/bin/ipython3
Executable file
8
.venv/bin/ipython3
Executable file
|
|
@ -0,0 +1,8 @@
|
|||
#!/home/walkers/git/creeper-adventure/.venv/bin/python3
|
||||
# -*- coding: utf-8 -*-
|
||||
import re
|
||||
import sys
|
||||
from IPython import start_ipython
|
||||
if __name__ == '__main__':
|
||||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
||||
sys.exit(start_ipython())
|
||||
8
.venv/bin/isort
Executable file
8
.venv/bin/isort
Executable file
|
|
@ -0,0 +1,8 @@
|
|||
#!/home/walkers/git/creeper-adventure/.venv/bin/python3
|
||||
# -*- coding: utf-8 -*-
|
||||
import re
|
||||
import sys
|
||||
from isort.main import main
|
||||
if __name__ == '__main__':
|
||||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
||||
sys.exit(main())
|
||||
8
.venv/bin/isort-identify-imports
Executable file
8
.venv/bin/isort-identify-imports
Executable file
|
|
@ -0,0 +1,8 @@
|
|||
#!/home/walkers/git/creeper-adventure/.venv/bin/python3
|
||||
# -*- coding: utf-8 -*-
|
||||
import re
|
||||
import sys
|
||||
from isort.main import identify_imports_main
|
||||
if __name__ == '__main__':
|
||||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
||||
sys.exit(identify_imports_main())
|
||||
36
.venv/bin/list-bad-xrefs
Executable file
36
.venv/bin/list-bad-xrefs
Executable file
|
|
@ -0,0 +1,36 @@
|
|||
#!/home/walkers/git/creeper-adventure/.venv/bin/python3
|
||||
"""
|
||||
Usage: list-bad-xrefs modules... filenames...
|
||||
|
||||
Prints the bad docstring cross-references in the given modules.
|
||||
|
||||
Similar to running C{epydoc -v}, but:
|
||||
- The output is organized so that it is easy to identify the code needing
|
||||
fixing.
|
||||
- If a cross-reference is to an external module, its references are included
|
||||
automatically.
|
||||
"""
|
||||
# pyflyby/list-bad-xrefs
|
||||
# Copyright (C) 2011, 2014 Karl Chen.
|
||||
# License: MIT http://opensource.org/licenses/MIT
|
||||
|
||||
from __future__ import absolute_import, division, with_statement
|
||||
from __future__ import print_function
|
||||
|
||||
from pyflyby._cmdline import parse_args, syntax
|
||||
from pyflyby._docxref import find_bad_doc_cross_references
|
||||
|
||||
|
||||
def main():
|
||||
options, args = parse_args()
|
||||
if not args:
|
||||
syntax()
|
||||
for rec in find_bad_doc_cross_references(args):
|
||||
module, linenos, container_name, identifier = rec
|
||||
for lineno in linenos or ["?"]:
|
||||
print("%s:%s: undefined docstring cross-reference in %s: %s" % (
|
||||
module.filename, lineno, container_name, identifier))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
242
.venv/bin/lolcat
Executable file
242
.venv/bin/lolcat
Executable file
|
|
@ -0,0 +1,242 @@
|
|||
#!/home/walkers/git/creeper-adventure/.venv/bin/python3
|
||||
#
|
||||
# "THE BEER-WARE LICENSE" (Revision 43~maze)
|
||||
#
|
||||
# <maze@pyth0n.org> wrote these files. As long as you retain this notice you
|
||||
# can do whatever you want with this stuff. If we meet some day, and you think
|
||||
# this stuff is worth it, you can buy me a beer in return.
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
import atexit
|
||||
import math
|
||||
import os
|
||||
import random
|
||||
import re
|
||||
import sys
|
||||
import time
|
||||
from signal import signal, SIGPIPE, SIG_DFL
|
||||
|
||||
PY3 = sys.version_info >= (3,)
|
||||
|
||||
# override default handler so no exceptions on SIGPIPE
|
||||
signal(SIGPIPE, SIG_DFL)
|
||||
|
||||
# Reset terminal colors at exit
|
||||
def reset():
|
||||
sys.stdout.write('\x1b[0m')
|
||||
sys.stdout.flush()
|
||||
|
||||
atexit.register(reset)
|
||||
|
||||
|
||||
STRIP_ANSI = re.compile(r'\x1b\[(\d+)(;\d+)?(;\d+)?[m|K]')
|
||||
COLOR_ANSI = (
|
||||
(0x00, 0x00, 0x00), (0xcd, 0x00, 0x00),
|
||||
(0x00, 0xcd, 0x00), (0xcd, 0xcd, 0x00),
|
||||
(0x00, 0x00, 0xee), (0xcd, 0x00, 0xcd),
|
||||
(0x00, 0xcd, 0xcd), (0xe5, 0xe5, 0xe5),
|
||||
(0x7f, 0x7f, 0x7f), (0xff, 0x00, 0x00),
|
||||
(0x00, 0xff, 0x00), (0xff, 0xff, 0x00),
|
||||
(0x5c, 0x5c, 0xff), (0xff, 0x00, 0xff),
|
||||
(0x00, 0xff, 0xff), (0xff, 0xff, 0xff),
|
||||
)
|
||||
|
||||
|
||||
class stdoutWin():
|
||||
def __init__(self):
|
||||
self.output = sys.stdout
|
||||
self.string = ''
|
||||
self.i = 0
|
||||
|
||||
def isatty(self):
|
||||
return self.output.isatty()
|
||||
|
||||
def write(self,s):
|
||||
self.string = self.string + s
|
||||
|
||||
def flush(self):
|
||||
return self.output.flush()
|
||||
|
||||
def prints(self):
|
||||
string = 'echo|set /p="%s"' %(self.string)
|
||||
os.system(string)
|
||||
self.i += 1
|
||||
self.string = ''
|
||||
|
||||
def println(self):
|
||||
print()
|
||||
self.prints()
|
||||
|
||||
|
||||
class LolCat(object):
|
||||
def __init__(self, mode=256, output=sys.stdout):
|
||||
self.mode =mode
|
||||
self.output = output
|
||||
|
||||
def _distance(self, rgb1, rgb2):
|
||||
return sum(map(lambda c: (c[0] - c[1]) ** 2,
|
||||
zip(rgb1, rgb2)))
|
||||
|
||||
def ansi(self, rgb):
|
||||
r, g, b = rgb
|
||||
|
||||
if self.mode in (8, 16):
|
||||
colors = COLOR_ANSI[:self.mode]
|
||||
matches = [(self._distance(c, map(int, rgb)), i) for i, c in enumerate(colors)]
|
||||
matches.sort()
|
||||
color = matches[0][1]
|
||||
|
||||
return '3%d' % (color,)
|
||||
else:
|
||||
gray_possible = True
|
||||
sep = 2.5
|
||||
|
||||
while gray_possible:
|
||||
if r < sep or g < sep or b < sep:
|
||||
gray = r < sep and g < sep and b < sep
|
||||
gray_possible = False
|
||||
|
||||
sep += 42.5
|
||||
|
||||
if gray:
|
||||
color = 232 + int(float(sum(rgb) / 33.0))
|
||||
else:
|
||||
color = sum([16]+[int(6 * float(val)/256) * mod
|
||||
for val, mod in zip(rgb, [36, 6, 1])])
|
||||
|
||||
return '38;5;%d' % (color,)
|
||||
|
||||
def wrap(self, *codes):
|
||||
return '\x1b[%sm' % (''.join(codes),)
|
||||
|
||||
def rainbow(self, freq, i):
|
||||
r = math.sin(freq * i) * 127 + 128
|
||||
g = math.sin(freq * i + 2 * math.pi / 3) * 127 + 128
|
||||
b = math.sin(freq * i + 4 * math.pi / 3) * 127 + 128
|
||||
return [r, g, b]
|
||||
|
||||
def cat(self, fd, options):
|
||||
if options.animate:
|
||||
self.output.write('\x1b[?25l')
|
||||
|
||||
for line in fd:
|
||||
options.os += 1
|
||||
self.println(line, options)
|
||||
|
||||
if options.animate:
|
||||
self.output.write('\x1b[?25h')
|
||||
|
||||
def println(self, s, options):
|
||||
s = s.rstrip()
|
||||
if options.force or self.output.isatty():
|
||||
s = STRIP_ANSI.sub('', s)
|
||||
|
||||
if options.animate:
|
||||
self.println_ani(s, options)
|
||||
else:
|
||||
self.println_plain(s, options)
|
||||
|
||||
self.output.write('\n')
|
||||
self.output.flush()
|
||||
if os.name == 'nt':
|
||||
self.output.println()
|
||||
|
||||
def println_ani(self, s, options):
|
||||
if not s:
|
||||
return
|
||||
|
||||
for i in range(1, options.duration):
|
||||
self.output.write('\x1b[%dD' % (len(s),))
|
||||
self.output.flush()
|
||||
options.os += options.spread
|
||||
self.println_plain(s, options)
|
||||
time.sleep(1.0 / options.speed)
|
||||
|
||||
def println_plain(self, s, options):
|
||||
for i, c in enumerate(s if PY3 else s.decode(options.charset_py2, 'replace')):
|
||||
rgb = self.rainbow(options.freq, options.os + i / options.spread)
|
||||
self.output.write(''.join([
|
||||
self.wrap(self.ansi(rgb)),
|
||||
c if PY3 else c.encode(options.charset_py2, 'replace'),
|
||||
]))
|
||||
if os.name == 'nt':
|
||||
self.output.print()
|
||||
|
||||
|
||||
def detect_mode(term_hint='xterm-256color'):
|
||||
'''
|
||||
Poor-mans color mode detection.
|
||||
'''
|
||||
if 'ANSICON' in os.environ:
|
||||
return 16
|
||||
elif os.environ.get('ConEmuANSI', 'OFF') == 'ON':
|
||||
return 256
|
||||
else:
|
||||
term = os.environ.get('TERM', term_hint)
|
||||
if term.endswith('-256color') or term in ('xterm', 'screen'):
|
||||
return 256
|
||||
elif term.endswith('-color') or term in ('rxvt',):
|
||||
return 16
|
||||
else:
|
||||
return 256 # optimistic default
|
||||
|
||||
|
||||
def run():
|
||||
"""Main entry point."""
|
||||
import optparse
|
||||
|
||||
parser = optparse.OptionParser(usage=r'%prog [<options>] [file ...]')
|
||||
parser.add_option('-p', '--spread', type='float', default=3.0,
|
||||
help='Rainbow spread')
|
||||
parser.add_option('-F', '--freq', type='float', default=0.1,
|
||||
help='Rainbow frequency')
|
||||
parser.add_option('-S', '--seed', type='int', default=0,
|
||||
help='Rainbow seed')
|
||||
parser.add_option('-a', '--animate', action='store_true', default=False,
|
||||
help='Enable psychedelics')
|
||||
parser.add_option('-d', '--duration', type='int', default=12,
|
||||
help='Animation duration')
|
||||
parser.add_option('-s', '--speed', type='float', default=20.0,
|
||||
help='Animation speed')
|
||||
parser.add_option('-f', '--force', action='store_true', default=False,
|
||||
help='Force colour even when stdout is not a tty')
|
||||
|
||||
parser.add_option('-3', action='store_const', dest='mode', const=8,
|
||||
help='Force 3 bit colour mode')
|
||||
parser.add_option('-4', action='store_const', dest='mode', const=16,
|
||||
help='Force 4 bit colour mode')
|
||||
parser.add_option('-8', action='store_const', dest='mode', const=256,
|
||||
help='Force 8 bit colour mode')
|
||||
|
||||
parser.add_option('-c', '--charset-py2', default='utf-8',
|
||||
help='Manually set a charset to convert from, for python 2.7')
|
||||
|
||||
options, args = parser.parse_args()
|
||||
options.os = random.randint(0, 256) if options.seed == 0 else options.seed
|
||||
options.mode = options.mode or detect_mode()
|
||||
|
||||
if os.name == 'nt':
|
||||
lolcat = LolCat(mode=options.mode,output=stdoutWin())
|
||||
else:
|
||||
lolcat = LolCat(mode=options.mode)
|
||||
|
||||
if not args:
|
||||
args = ['-']
|
||||
|
||||
for filename in args:
|
||||
try:
|
||||
if filename == '-':
|
||||
lolcat.cat(sys.stdin, options)
|
||||
else:
|
||||
with open(filename, 'r', errors='backslashreplace') as handle:
|
||||
lolcat.cat(handle, options)
|
||||
except IOError as error:
|
||||
sys.stderr.write(str(error) + '\n')
|
||||
except KeyboardInterrupt:
|
||||
sys.stderr.write('\n')
|
||||
# exit 130 for terminated-by-ctrl-c, from http://tldp.org/LDP/abs/html/exitcodes.html
|
||||
return 130
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.exit(run())
|
||||
8
.venv/bin/mypy
Executable file
8
.venv/bin/mypy
Executable file
|
|
@ -0,0 +1,8 @@
|
|||
#!/home/walkers/git/creeper-adventure/.venv/bin/python3
|
||||
# -*- coding: utf-8 -*-
|
||||
import re
|
||||
import sys
|
||||
from mypy.__main__ import console_entry
|
||||
if __name__ == '__main__':
|
||||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
||||
sys.exit(console_entry())
|
||||
8
.venv/bin/mypyc
Executable file
8
.venv/bin/mypyc
Executable file
|
|
@ -0,0 +1,8 @@
|
|||
#!/home/walkers/git/creeper-adventure/.venv/bin/python3
|
||||
# -*- coding: utf-8 -*-
|
||||
import re
|
||||
import sys
|
||||
from mypyc.__main__ import main
|
||||
if __name__ == '__main__':
|
||||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
||||
sys.exit(main())
|
||||
8
.venv/bin/nodeenv
Executable file
8
.venv/bin/nodeenv
Executable file
|
|
@ -0,0 +1,8 @@
|
|||
#!/home/walkers/git/creeper-adventure/.venv/bin/python3
|
||||
# -*- coding: utf-8 -*-
|
||||
import re
|
||||
import sys
|
||||
from nodeenv import main
|
||||
if __name__ == '__main__':
|
||||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
||||
sys.exit(main())
|
||||
8
.venv/bin/pip
Executable file
8
.venv/bin/pip
Executable file
|
|
@ -0,0 +1,8 @@
|
|||
#!/home/walkers/git/creeper-adventure/.venv/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())
|
||||
8
.venv/bin/pip3
Executable file
8
.venv/bin/pip3
Executable file
|
|
@ -0,0 +1,8 @@
|
|||
#!/home/walkers/git/creeper-adventure/.venv/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())
|
||||
8
.venv/bin/pip3.8
Executable file
8
.venv/bin/pip3.8
Executable file
|
|
@ -0,0 +1,8 @@
|
|||
#!/home/walkers/git/creeper-adventure/.venv/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())
|
||||
8
.venv/bin/pre-commit
Executable file
8
.venv/bin/pre-commit
Executable file
|
|
@ -0,0 +1,8 @@
|
|||
#!/home/walkers/git/creeper-adventure/.venv/bin/python3
|
||||
# -*- coding: utf-8 -*-
|
||||
import re
|
||||
import sys
|
||||
from pre_commit.main import main
|
||||
if __name__ == '__main__':
|
||||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
||||
sys.exit(main())
|
||||
8
.venv/bin/pre-commit-validate-config
Executable file
8
.venv/bin/pre-commit-validate-config
Executable file
|
|
@ -0,0 +1,8 @@
|
|||
#!/home/walkers/git/creeper-adventure/.venv/bin/python3
|
||||
# -*- coding: utf-8 -*-
|
||||
import re
|
||||
import sys
|
||||
from pre_commit.clientlib import validate_config_main
|
||||
if __name__ == '__main__':
|
||||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
||||
sys.exit(validate_config_main())
|
||||
8
.venv/bin/pre-commit-validate-manifest
Executable file
8
.venv/bin/pre-commit-validate-manifest
Executable file
|
|
@ -0,0 +1,8 @@
|
|||
#!/home/walkers/git/creeper-adventure/.venv/bin/python3
|
||||
# -*- coding: utf-8 -*-
|
||||
import re
|
||||
import sys
|
||||
from pre_commit.clientlib import validate_manifest_main
|
||||
if __name__ == '__main__':
|
||||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
||||
sys.exit(validate_manifest_main())
|
||||
35
.venv/bin/prune-broken-imports
Executable file
35
.venv/bin/prune-broken-imports
Executable file
|
|
@ -0,0 +1,35 @@
|
|||
#!/home/walkers/git/creeper-adventure/.venv/bin/python3
|
||||
"""
|
||||
prune-broken-imports *.py
|
||||
prune-broken-imports < foo.py
|
||||
|
||||
Removes broken imports.
|
||||
|
||||
Note: This actually executes imports.
|
||||
|
||||
If filenames are given on the command line, rewrites them. Otherwise, if
|
||||
stdin is not a tty, read from stdin and write to stdout.
|
||||
|
||||
Only top-level import statements are touched.
|
||||
|
||||
"""
|
||||
# pyflyby/prune-broken-imports
|
||||
# Copyright (C) 2012, 2014 Karl Chen.
|
||||
# License: MIT http://opensource.org/licenses/MIT
|
||||
|
||||
from __future__ import absolute_import, division, with_statement
|
||||
|
||||
from pyflyby._cmdline import parse_args, process_actions
|
||||
from pyflyby._imports2s import remove_broken_imports
|
||||
|
||||
|
||||
def main():
|
||||
options, args = parse_args(
|
||||
import_format_params=True, modify_action_params=True)
|
||||
def modify(x):
|
||||
return remove_broken_imports(x, params=options.params)
|
||||
process_actions(args, options.actions, modify)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
8
.venv/bin/py
Executable file
8
.venv/bin/py
Executable file
|
|
@ -0,0 +1,8 @@
|
|||
#!/home/walkers/git/creeper-adventure/.venv/bin/python3
|
||||
# -*- coding: utf-8 -*-
|
||||
import re
|
||||
import sys
|
||||
from pyflyby._py import py_main
|
||||
if __name__ == '__main__':
|
||||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
||||
sys.exit(py_main())
|
||||
8
.venv/bin/py3
Executable file
8
.venv/bin/py3
Executable file
|
|
@ -0,0 +1,8 @@
|
|||
#!/home/walkers/git/creeper-adventure/.venv/bin/python3
|
||||
# -*- coding: utf-8 -*-
|
||||
import re
|
||||
import sys
|
||||
from pyflyby._py import py_main
|
||||
if __name__ == '__main__':
|
||||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
||||
sys.exit(py_main())
|
||||
8
.venv/bin/pycodestyle
Executable file
8
.venv/bin/pycodestyle
Executable file
|
|
@ -0,0 +1,8 @@
|
|||
#!/home/walkers/git/creeper-adventure/.venv/bin/python3
|
||||
# -*- coding: utf-8 -*-
|
||||
import re
|
||||
import sys
|
||||
from pycodestyle import _main
|
||||
if __name__ == '__main__':
|
||||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
||||
sys.exit(_main())
|
||||
8
.venv/bin/pyflakes
Executable file
8
.venv/bin/pyflakes
Executable file
|
|
@ -0,0 +1,8 @@
|
|||
#!/home/walkers/git/creeper-adventure/.venv/bin/python3
|
||||
# -*- coding: utf-8 -*-
|
||||
import re
|
||||
import sys
|
||||
from pyflakes.api import main
|
||||
if __name__ == '__main__':
|
||||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
||||
sys.exit(main())
|
||||
32
.venv/bin/pyflyby-diff
Executable file
32
.venv/bin/pyflyby-diff
Executable file
|
|
@ -0,0 +1,32 @@
|
|||
#!/bin/bash -e
|
||||
|
||||
# License for THIS FILE ONLY: CC0 Public Domain Dedication
|
||||
# http://creativecommons.org/publicdomain/zero/1.0/
|
||||
|
||||
# Get the directory containing to the symlink target of the script.
|
||||
if script=$(readlink -e "$0" 2>/dev/null) && [[ "$script" -ef "$0" ]]; then
|
||||
scriptdir=$(dirname "$script")
|
||||
elif script=$(realpath "$0" 2>/dev/null) && [[ "$script" -ef "$0" ]]; then
|
||||
scriptdir=$(dirname "$script")
|
||||
elif script=$(greadlink -e "$0" 2>/dev/null) && [[ "$script" -ef "$0" ]]; then
|
||||
scriptdir=$(dirname "$script")
|
||||
else
|
||||
scriptdir=$(
|
||||
d=$(dirname "$0")
|
||||
b=$(basename "$0")
|
||||
cd "$d"
|
||||
if l=$(readlink "$b"); then
|
||||
ld=$(dirname "$l")
|
||||
cd "$ld"
|
||||
fi
|
||||
pwd
|
||||
)
|
||||
fi
|
||||
|
||||
PATH="$scriptdir:$PATH"
|
||||
|
||||
if [[ -t 1 ]] && type -p diff-colorize >/dev/null; then
|
||||
diff -u "$@" | diff-colorize
|
||||
else
|
||||
diff -u "$@"
|
||||
fi
|
||||
8
.venv/bin/pygmentize
Executable file
8
.venv/bin/pygmentize
Executable file
|
|
@ -0,0 +1,8 @@
|
|||
#!/home/walkers/git/creeper-adventure/.venv/bin/python3
|
||||
# -*- coding: utf-8 -*-
|
||||
import re
|
||||
import sys
|
||||
from pygments.cmdline import main
|
||||
if __name__ == '__main__':
|
||||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
||||
sys.exit(main())
|
||||
1
.venv/bin/python
Symbolic link
1
.venv/bin/python
Symbolic link
|
|
@ -0,0 +1 @@
|
|||
python3
|
||||
1
.venv/bin/python3
Symbolic link
1
.venv/bin/python3
Symbolic link
|
|
@ -0,0 +1 @@
|
|||
/home/walkers/.pyenv/versions/3.8.12/bin/python3
|
||||
28
.venv/bin/reformat-imports
Executable file
28
.venv/bin/reformat-imports
Executable file
|
|
@ -0,0 +1,28 @@
|
|||
#!/home/walkers/git/creeper-adventure/.venv/bin/python3
|
||||
"""
|
||||
reformat-imports *.py
|
||||
reformat-imports < foo.py
|
||||
|
||||
Reformats the top-level 'import' blocks within the python module/script.
|
||||
|
||||
"""
|
||||
# pyflyby/reformat-imports
|
||||
# Copyright (C) 2011, 2014 Karl Chen.
|
||||
# License: MIT http://opensource.org/licenses/MIT
|
||||
|
||||
from __future__ import absolute_import, division, with_statement
|
||||
|
||||
from pyflyby._cmdline import parse_args, process_actions
|
||||
from pyflyby._imports2s import reformat_import_statements
|
||||
|
||||
|
||||
def main():
|
||||
options, args = parse_args(
|
||||
import_format_params=True, modify_action_params=True)
|
||||
def modify(x):
|
||||
return reformat_import_statements(x, params=options.params)
|
||||
process_actions(args, options.actions, modify)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
38
.venv/bin/replace-star-imports
Executable file
38
.venv/bin/replace-star-imports
Executable file
|
|
@ -0,0 +1,38 @@
|
|||
#!/home/walkers/git/creeper-adventure/.venv/bin/python3
|
||||
"""
|
||||
replace-star-imports *.py
|
||||
replace-star-imports < foo.py
|
||||
|
||||
Replaces::
|
||||
from foo.bar import *
|
||||
with::
|
||||
from foo.bar import (f1, f2, ...)
|
||||
|
||||
Note: This actually executes imports.
|
||||
|
||||
If filenames are given on the command line, rewrites them. Otherwise, if
|
||||
stdin is not a tty, read from stdin and write to stdout.
|
||||
|
||||
Only top-level import statements are touched.
|
||||
|
||||
"""
|
||||
# pyflyby/replace-star-imports
|
||||
# Copyright (C) 2012, 2014 Karl Chen.
|
||||
# License: MIT http://opensource.org/licenses/MIT
|
||||
|
||||
from __future__ import absolute_import, division, with_statement
|
||||
|
||||
from pyflyby._cmdline import parse_args, process_actions
|
||||
from pyflyby._imports2s import replace_star_imports
|
||||
|
||||
|
||||
def main():
|
||||
options, args = parse_args(
|
||||
import_format_params=True, modify_action_params=True)
|
||||
def modify(x):
|
||||
return replace_star_imports(x, params=options.params)
|
||||
process_actions(args, options.actions, modify)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
8
.venv/bin/stubgen
Executable file
8
.venv/bin/stubgen
Executable file
|
|
@ -0,0 +1,8 @@
|
|||
#!/home/walkers/git/creeper-adventure/.venv/bin/python3
|
||||
# -*- coding: utf-8 -*-
|
||||
import re
|
||||
import sys
|
||||
from mypy.stubgen import main
|
||||
if __name__ == '__main__':
|
||||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
||||
sys.exit(main())
|
||||
8
.venv/bin/stubtest
Executable file
8
.venv/bin/stubtest
Executable file
|
|
@ -0,0 +1,8 @@
|
|||
#!/home/walkers/git/creeper-adventure/.venv/bin/python3
|
||||
# -*- coding: utf-8 -*-
|
||||
import re
|
||||
import sys
|
||||
from mypy.stubtest import main
|
||||
if __name__ == '__main__':
|
||||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
||||
sys.exit(main())
|
||||
156
.venv/bin/tidy-imports
Executable file
156
.venv/bin/tidy-imports
Executable file
|
|
@ -0,0 +1,156 @@
|
|||
#!/home/walkers/git/creeper-adventure/.venv/bin/python3
|
||||
"""
|
||||
tidy-imports *.py
|
||||
tidy-imports < foo.py
|
||||
|
||||
Automatically improves python import statements.
|
||||
|
||||
- Adds missing imports and mandatory imports.
|
||||
- Removes unused imports.
|
||||
- Nicely formats imports (sorts, aligns, wraps).
|
||||
|
||||
If filenames are given on the command line, rewrites them. Otherwise, if
|
||||
stdin is not a tty, read from stdin and write to stdout.
|
||||
|
||||
Only top-level import statements are touched.
|
||||
|
||||
"""
|
||||
|
||||
# pyflyby/tidy-imports
|
||||
# Copyright (C) 2011, 2012, 2014 Karl Chen.
|
||||
# License: MIT http://opensource.org/licenses/MIT
|
||||
|
||||
from __future__ import print_function, absolute_import, division, with_statement
|
||||
|
||||
from distutils.spawn import find_executable
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
from pyflyby._cmdline import hfmt, parse_args, process_actions
|
||||
from pyflyby._imports2s import (canonicalize_imports,
|
||||
fix_unused_and_missing_imports,
|
||||
replace_star_imports,
|
||||
transform_imports)
|
||||
from pyflyby._log import logger
|
||||
|
||||
|
||||
def main():
|
||||
def addopts(parser):
|
||||
parser.add_option('--add-missing',
|
||||
default=True, action='store_true',
|
||||
help=hfmt('''
|
||||
(Default) Add missing imports.'''))
|
||||
parser.add_option('--no-add-missing', dest='add_missing',
|
||||
default=True, action='store_false',
|
||||
help=hfmt('''
|
||||
Don't add missing imports.'''))
|
||||
parser.add_option('--remove-unused',
|
||||
default="AUTOMATIC", action='store_true',
|
||||
help=hfmt('''
|
||||
Remove unused imports
|
||||
(default unless filename == __init__.py).'''))
|
||||
parser.add_option('--no-remove-unused', dest='remove_unused',
|
||||
action='store_false',
|
||||
help=hfmt('''
|
||||
Don't remove unused imports
|
||||
(default if filename == __init__.py).'''))
|
||||
parser.add_option('--add-mandatory',
|
||||
default=True, action='store_true',
|
||||
help=hfmt('''
|
||||
(Default) Add mandatory imports.'''))
|
||||
parser.add_option('--no-add-mandatory', dest='add_mandatory',
|
||||
default=True, action='store_false',
|
||||
help=hfmt('''
|
||||
Don't add mandatory imports.'''))
|
||||
parser.add_option('--replace-star-imports',
|
||||
default=False, action='store_true',
|
||||
help=hfmt('''
|
||||
Replace 'from foo.bar import *' with full list
|
||||
of imports before removing unused imports.'''))
|
||||
parser.add_option('--no-replace-star-imports',
|
||||
dest='replace_star_imports',
|
||||
action='store_false',
|
||||
help=hfmt('''
|
||||
(Default) Don't replace 'from foo.bar import
|
||||
*'.'''))
|
||||
parser.add_option('--canonicalize',
|
||||
default=True, action='store_true',
|
||||
help=hfmt('''
|
||||
(Default) Replace imports with canonical
|
||||
equivalent imports, according to database.'''))
|
||||
parser.add_option('--no-canonicalize', dest='canonicalize',
|
||||
default=True, action='store_false',
|
||||
help=hfmt('''
|
||||
Don't canonicalize imports.'''))
|
||||
parser.add_option('--py23-fallback', dest='py23_fallback',
|
||||
default=True, action='store_true',
|
||||
help=hfmt('''
|
||||
(Default) Automatically fallback to
|
||||
python2/python3 if the source file has a syntax
|
||||
error.'''))
|
||||
parser.add_option('--no-py23-fallback', dest='py23_fallback',
|
||||
default=True, action='store_false',
|
||||
help=hfmt('''
|
||||
Do not automatically fallback to
|
||||
python2/python3 if the source file has a syntax
|
||||
error.'''))
|
||||
|
||||
|
||||
def transform_callback(option, opt_str, value, group):
|
||||
k, v = value.split("=", 1)
|
||||
group.values.transformations[k] = v
|
||||
parser.add_option("--transform", action='callback',
|
||||
type="string", callback=transform_callback,
|
||||
metavar="OLD=NEW",
|
||||
dest="transformations", default={},
|
||||
help=hfmt('''
|
||||
Replace OLD with NEW in imports.
|
||||
May be specified multiple times.'''))
|
||||
def no_add_callback(option, opt_str, value, group):
|
||||
group.values.add_missing = False
|
||||
group.values.add_mandatory = False
|
||||
parser.add_option('--no-add', action='callback',
|
||||
callback=no_add_callback,
|
||||
help=hfmt('''
|
||||
Equivalent to --no-add-missing
|
||||
--no-add-mandatory.'''))
|
||||
options, args = parse_args(
|
||||
addopts, import_format_params=True, modify_action_params=True)
|
||||
def modify(x):
|
||||
if options.canonicalize:
|
||||
x = canonicalize_imports(x, params=options.params)
|
||||
if options.transformations:
|
||||
x = transform_imports(x, options.transformations,
|
||||
params=options.params)
|
||||
if options.replace_star_imports:
|
||||
x = replace_star_imports(x, params=options.params)
|
||||
return fix_unused_and_missing_imports(
|
||||
x, params=options.params,
|
||||
add_missing=options.add_missing,
|
||||
remove_unused=options.remove_unused,
|
||||
add_mandatory=options.add_mandatory,
|
||||
)
|
||||
|
||||
if options.py23_fallback:
|
||||
try:
|
||||
process_actions(args, options.actions, modify,
|
||||
reraise_exceptions=SyntaxError)
|
||||
except SyntaxError as e:
|
||||
python = 'python2' if sys.version_info[0] == 3 else 'python3'
|
||||
python_full = find_executable(python)
|
||||
if not python_full:
|
||||
logger.error("Fallback failed: could not find %s", python)
|
||||
raise
|
||||
logger.info("SyntaxError detected ({}), falling back to {}".format(
|
||||
e, python))
|
||||
args = [python_full] + sys.argv + ['--no-py23-fallback']
|
||||
try:
|
||||
raise SystemExit(subprocess.call(args))
|
||||
except KeyboardInterrupt:
|
||||
sys.exit(1)
|
||||
else:
|
||||
process_actions(args, options.actions, modify)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
48
.venv/bin/transform-imports
Executable file
48
.venv/bin/transform-imports
Executable file
|
|
@ -0,0 +1,48 @@
|
|||
#!/home/walkers/git/creeper-adventure/.venv/bin/python3
|
||||
"""
|
||||
transform-imports --transform aa.bb=xx.yy *.py
|
||||
transform-imports --transform aa.bb=xx.yy < foo.py
|
||||
|
||||
Transforms::
|
||||
from aa.bb.cc import dd, ee
|
||||
from aa import bb
|
||||
to::
|
||||
from xx.yy.cc import dd, ee
|
||||
from xx import yy as bb
|
||||
|
||||
If filenames are given on the command line, rewrites them. Otherwise, if
|
||||
stdin is not a tty, read from stdin and write to stdout.
|
||||
|
||||
"""
|
||||
|
||||
# pyflyby/transform-imports
|
||||
# Copyright (C) 2014 Karl Chen.
|
||||
# License: MIT http://opensource.org/licenses/MIT
|
||||
|
||||
from __future__ import absolute_import, division, with_statement
|
||||
|
||||
from pyflyby._cmdline import hfmt, parse_args, process_actions
|
||||
from pyflyby._imports2s import transform_imports
|
||||
|
||||
|
||||
def main():
|
||||
transformations = {}
|
||||
def addopts(parser):
|
||||
def callback(option, opt_str, value, group):
|
||||
k, v = value.split("=", 1)
|
||||
transformations[k] = v
|
||||
parser.add_option("--transform", action='callback',
|
||||
type="string", callback=callback,
|
||||
metavar="OLD=NEW",
|
||||
help=hfmt('''
|
||||
Replace OLD with NEW in imports.
|
||||
May be specified multiple times.'''))
|
||||
options, args = parse_args(
|
||||
addopts, import_format_params=True, modify_action_params=True)
|
||||
def modify(x):
|
||||
return transform_imports(x, transformations, params=options.params)
|
||||
process_actions(args, options.actions, modify)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
8
.venv/bin/virtualenv
Executable file
8
.venv/bin/virtualenv
Executable file
|
|
@ -0,0 +1,8 @@
|
|||
#!/home/walkers/git/creeper-adventure/.venv/bin/python3
|
||||
# -*- coding: utf-8 -*-
|
||||
import re
|
||||
import sys
|
||||
from virtualenv.__main__ import run_with_catch
|
||||
if __name__ == '__main__':
|
||||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
||||
sys.exit(run_with_catch())
|
||||
Loading…
Add table
Add a link
Reference in a new issue