nexushoratio / ingress Goto Github PK
View Code? Open in Web Editor NEWAn old Ingress command line tool I used to work on
License: GNU General Public License v3.0
An old Ingress command line tool I used to work on
License: GNU General Public License v3.0
Played with this a bit with nexushoratio/py-mundane#4. Might as well give it a try for this project as well.
I have at least one example where the reverse geocoding picks a really bad result.
https://developers.google.com/maps/documentation/geocoding/requests-reverse-geocoding
Right now we only allow a result_type
of street_address, but with my example, premise is MUCH better. In particular, the good has a location_type
of ROOFTOP while the other had RANGE_INTERPOLATED.
But, from a set of one, it is not yet possible to determine that premise is always better than street_address. More testing is needed.
Also, currently, scores are a simple summation of weights. A tuple-like solution would probably be better. Also, switch from a dictionary of weights to proper enums.
The platformdirs
library is a fork of ActiveState's appdirs
library. On Unix like platforms (e.g., Linux), it will use the XDG recommendations for directories, and appropriate recommendations on other platforms. Making it easier to decide where to put things like config files, data files, logs, etc.
Running just the basic command crashes.
AttributeError: 'Namespace' object has no attribute 'func'
While experimenting with GeoAlchemy, there are times when it also makes sense to use newer features of SQLAlchemy.
Should probably do this 1.4/2.x stuff first.
https://docs.sqlalchemy.org/en/14/changelog/migration_20.html
SQLALCHEMY_WARN_20=1 PYTHONWARNINGS=always::DeprecationWarning ingress
After configuring pylint, there is a list of disabled settings in the config file that need to be addressed.
usage: ingress [-h] [-L {debug,info,warning,error}]
{import,unimport,export,flatten,find-missing-labels,merge-bookmarks,codes-set,codes-get,codes-delete,codes-prune,update,bounds,trim,cluster,make-donuts,clean-json,show-portals,routes}
...
Perform a number of Ingress related functions.
options:
-h, --help show this help message and exit
-L {debug,info,warning,error}, --loglevel {debug,info,warning,error}
Log level
commands:
{import,unimport,export,flatten,find-missing-labels,merge-bookmarks,codes-set,codes-get,codes-delete,codes-prune,update,bounds,trim,cluster,make-donuts,clean-json,show-portals,routes}
subparser help
import Update the database with portals listed in a bookmarks
file.
unimport Remove portals listed in a bookmarks file from the
database.
export Export all portals as a bookmarks file.
flatten Load portals from BOOKMARKS and write out as lists
using PATTERN.
find-missing-labels
Look through globs of bookmarks for missing labels. It
will remove portals with missing labels from the
bookmarks and add them to a newly created bookmarks
file instead. The contents of the destination
bookmarks file will be destroyed.
merge-bookmarks Merge multiple bookmarks files into one. Inputs will
be the files specified by the glob arguments. The
contents of the destination bookmarks file will be
destroyed.
codes-set Sets a location code, creating it if necessary.
codes-get Display one or more location codes.
codes-delete Delete a location code.
codes-prune Prune portals based upon keep status of location
codes.
update Update the locations and directions for portals in a
bookmarks file.
bounds Create a drawtools file outlining portals in multiple
bookmarks files.
trim Trim a bookmarks file to only include portals inside a
bounds.
cluster Find clusters of portals together and save the
results. The clustering results are saved into
FILENAME.
make-donuts Automatically group portals into COUNT sized bookmarks
files. The idea is to provide a series of bookmarks
that would be suitably sized groups for efficient
capturing. Given a starting marker specified in the
drawtools file, a circle (donut hole) that includes
COUNT portals will be created. The size of this hole
will inform the size of concentric rings (donuts). The
donut will be broken down into bites that contain
roughly COUNT portals. The command will try to balance
between between the number of portals in a bite and
how big (in area) a bite would be. For example, it
will try to avoid having a bite be the entire donut
because it reaches out to a sparsely populated area.
clean-json Clean and format a json file.
show-portals Show portals sorted by date. They will be exported to
a bookmarks file.
routes Calculate an optimal route between portals listed in a
bookmarks file.
I spent a lot of time looking into alternatives to argparse
, but I did no find any I like. Too many are so heavily based on decorators (e.g., click
) as to be unusable, IMO. The amount of work that would be needed to make them do things like we already do here (defining shared flags in modules, then using them else where), might as well stick with what is already written.
Unsurprisingly, Google's absl
stuff would probably do what I want, particularly since it probably also comes with the logging stuff I like, but I am still kind of pissed at being laid off.
I suspect there will be a series of small changes here as things get tweaked.
Will replace with expanded support for codes, where each portal can have multiple:
etc.
Will allow user to import any boundary set they wish. But, for now, just remove codes.
Previously, my approach was to put all of my code into a single git repo. Binaries (shell script, python main, etc), lived in ~/bin
, Python modules lived under ~/py
with, I think, some sort of symlink from .local. And so on (everything I was doing was Bash or Python). That's why modules like app
and humanize
, which are shared across projects, live where they are. This is pretty much the way Google's monorepo works. And it allowed me to just always run at HEAD. Which, for personal stuff, like ~/bin
and dotfiles, is fine.
When I uploaded this project, I took that old repo I'd rediscovered, and cut it it into pieces using the git-filter-repo
. Probably a better way of developing this stuff.
But, it means I need to figure out how folks do this in the rest of the world.
There are many options to choose from.
Like I mentioned over in my work over in the userscript repo, I am really not keen on things like pip
, npm
, cpan
, or melpa
. They are fine for finding things, but NOT for just randomly pulling in crap off the Internet and running it. Did we learning nothing from the telnet random.host | sh
days?!?! But anyway, if it is not installable via apt install
on my Debian system, I am unlikely to use it. I may vendor something into this repo. Or make my own .deb, but unlikely to use pip
.
So I do not have a lot of incentive to learn something like setuptools and friends.
I pretty fond of Google's PAR
file stuff, which I think eventually lead to the existence of the zipapp
and pex
stuff (not sure on the history there). So I will likely go with something like.
I am pretty confident I will make mistakes and undo things. But that is why I am doing this: to break things and see if I can fix them!
This will actually be Ingress related first.
Rereading this code, I was surprised to see I had followed PEP8's 4 space indentation recommendation.
Inventory all of the current modern failings and decide how to progress.
Much of this is now done in https://github.com/nexushoratio/py-mundane/blob/164a5fd01c33356f464d0fdd964ca256a9f71e42/pyproject.toml, so likely a good place to start.
Linting will take a while.
pytype is not available as a native debian package. So investigate mypy.
Should be complete now, so time to migrate.
Likely will find some short comings.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.