ulauncher.utils package


ulauncher.utils.AppCacheDb module

ulauncher.utils.AutostartPreference module

ulauncher.utils.Path module

ulauncher.utils.Router module

ulauncher.utils.Settings module

ulauncher.utils.SimpleWebSocketServer module

The MIT License (MIT) Copyright (c) 2013 Dave P.

class ulauncher.utils.SimpleWebSocketServer.WebSocket(server, sock, address)
close(status=1000, reason='')

Send Close frame to the client. The underlying socket is only closed when the client acknowledges the Close frame.

status is the closing identifier. reason is the reason for the close.


Called when a websocket server gets a Close frame from a client.


Called when a websocket client connects to the server.


Called when websocket frame is received. To access the frame data call self.data.

If the frame is Text then self.data is a unicode object. If the frame is Binary then self.data is a bytearray object.


see sendFragmentStart()

If data is a unicode object then the frame is sent as Text. If the data is a bytearray object then the frame is sent as Binary.


see sendFragmentEnd()

If data is a unicode object then the frame is sent as Text. If the data is a bytearray object then the frame is sent as Binary.


Send the start of a data fragment stream to a websocket client. Subsequent data should be sent using sendFragment(). A fragment stream is completed when sendFragmentEnd() is called.

If data is a unicode object then the frame is sent as Text. If the data is a bytearray object then the frame is sent as Binary.


Send websocket data frame to the client.

If data is a unicode object then the frame is sent as Text. If the data is a bytearray object then the frame is sent as Binary.

class ulauncher.utils.SimpleWebSocketServer.SimpleWebSocketServer(host, port, websocketclass, selectInterval=0.1)
class ulauncher.utils.SimpleWebSocketServer.SimpleSSLWebSocketServer(host, port, websocketclass, certfile, keyfile, version=3, selectInterval=0.1)

Bases: ulauncher.utils.SimpleWebSocketServer.SimpleWebSocketServer

ulauncher.utils.SortedCollection module

class ulauncher.utils.SortedCollection.SortedCollection(iterable=(), key=None)

Sequence sorted by a key function.

SortedCollection() is much easier to work with than using bisect() directly. It supports key functions like those use in sorted(), min(), and max(). The result of the key function call is saved so that keys can be searched efficiently.

Instead of returning an insertion-point which can be hard to interpret, the five find-methods return a specific item in the sequence. They can scan for exact matches, the last item less-than-or-equal to a key, or the first item greater-than-or-equal to a key.

Once found, an item’s ordinal position can be located with the index() method. New items can be added with the insert() and insert_right() methods. Old items can be deleted with the remove() method.

The usual sequence methods are provided to support indexing, slicing, length lookup, clearing, copying, forward and reverse iteration, contains checking, item counts, item removal, and a nice looking repr.

Finding and indexing are O(log n) operations while iteration and insertion are O(n). The initial sort is O(n log n).

The key function is stored in the ‘key’ attibute for easy introspection or so that you can assign a new key function (triggering an automatic re-sort).

In short, the class was designed to handle all of the common use cases for bisect but with a simpler API and support for key functions.

>>> from pprint import pprint
>>> from operator import itemgetter
>>> s = SortedCollection(key=itemgetter(2))
>>> for record in [
...         ('roger', 'young', 30),
...         ('angela', 'jones', 28),
...         ('bill', 'smith', 22),
...         ('david', 'thomas', 32)]:
...     s.insert(record)
>>> pprint(list(s))         # show records sorted by age
[('bill', 'smith', 22),
 ('angela', 'jones', 28),
 ('roger', 'young', 30),
 ('david', 'thomas', 32)]
>>> s.find_le(29)           # find oldest person aged 29 or younger
('angela', 'jones', 28)
>>> s.find_lt(28)           # find oldest person under 28
('bill', 'smith', 22)
>>> s.find_gt(28)           # find youngest person over 28
('roger', 'young', 30)
>>> r = s.find_ge(32)       # find youngest person aged 32 or older
>>> s.index(r)              # get the index of their record
>>> s[3]                    # fetch the record at that index
('david', 'thomas', 32)
>>> s.key = itemgetter(0)   # now sort by first name
>>> pprint(list(s))
[('angela', 'jones', 28),
 ('bill', 'smith', 22),
 ('david', 'thomas', 32),
 ('roger', 'young', 30)]

Return number of occurrences of item


Return first item with a key == k. Raise ValueError if not found.


Return first item with a key >= equal to k. Raise ValueError if not found


Return first item with a key > k. Raise ValueError if not found


Return last item with a key <= k. Raise ValueError if not found.


Return last item with a key < k. Raise ValueError if not found.


Find the position of an item. Raise ValueError if not found.


Insert a new item. If equal keys are found, add to the left


Insert a new item. If equal keys are found, add to the right


key function


Remove first occurence of item. Raise ValueError if not found

ulauncher.utils.Theme module

ulauncher.utils.date module

ulauncher.utils.display module

ulauncher.utils.file_finder module

ulauncher.utils.fuzzy_search module

ulauncher.utils.image_loader module

ulauncher.utils.mypy_extensions module

mypy_extensions cannot be installed via apt or dnf so we need to make sure TypedDict exists at runtime

ulauncher.utils.mypy_extensions.TypedDict(*args, **kw)

ulauncher.utils.named_tuple_from_dict module


ulauncher.utils.semver module


class ulauncher.utils.semver.Comparator(comp, loose)
semver = None
class ulauncher.utils.semver.Extendlist

Bases: list

exception ulauncher.utils.semver.InvalidTypeIncluded

Bases: exceptions.ValueError

class ulauncher.utils.semver.Range(range_, loose, _split_rx=<_sre.SRE_Pattern object>)
test(version, include_prerelease=False)
class ulauncher.utils.semver.SemVer(version, loose)
inc(release, identifier=None)
ulauncher.utils.semver.clean(version, loose)
ulauncher.utils.semver.cmp(a, op, b, loose)
ulauncher.utils.semver.comparator(comp, loose)
ulauncher.utils.semver.compare(a, b, loose)
ulauncher.utils.semver.compare_identifiers(a, b)
ulauncher.utils.semver.compare_loose(a, b)
ulauncher.utils.semver.eq(a, b, loose)
ulauncher.utils.semver.gt(a, b, loose)
ulauncher.utils.semver.gte(a, b, loose)
ulauncher.utils.semver.inc(version, release, loose, identifier=None)
ulauncher.utils.semver.list_get(xs, i)
ulauncher.utils.semver.lt(a, b, loose)
ulauncher.utils.semver.lte(a, b, loose)
ulauncher.utils.semver.ltr(version, range_, loose)
ulauncher.utils.semver.make_comparator(comp, loose)
ulauncher.utils.semver.make_range(range_, loose)
ulauncher.utils.semver.make_semver(version, loose)
ulauncher.utils.semver.max_satisfying(versions, range_, loose=False, include_prerelease=False)
ulauncher.utils.semver.neq(a, b, loose)
ulauncher.utils.semver.outside(version, range_, hilo, loose)
ulauncher.utils.semver.parse(version, loose)
ulauncher.utils.semver.parse_comparator(comp, loose)
ulauncher.utils.semver.rcompare(a, b, loose)
ulauncher.utils.semver.rcompare_identifiers(a, b)
ulauncher.utils.semver.replace_caret(comp, loose)
ulauncher.utils.semver.replace_carets(comp, loose)
ulauncher.utils.semver.replace_stars(comp, loose)
ulauncher.utils.semver.replace_tilde(comp, loose)
ulauncher.utils.semver.replace_tildes(comp, loose)
ulauncher.utils.semver.replace_xrange(comp, loose)
ulauncher.utils.semver.replace_xranges(comp, loose)
ulauncher.utils.semver.rsort(list, loose)
ulauncher.utils.semver.rtr(version, range_, loose)
ulauncher.utils.semver.satisfies(version, range_, loose=False, include_prerelease=False)
ulauncher.utils.semver.semver(version, loose)
ulauncher.utils.semver.sort(list, loose)
ulauncher.utils.semver.test_set(set_, version, include_prerelease=False)
ulauncher.utils.semver.to_comparators(range_, loose)
ulauncher.utils.semver.valid(version, loose)
ulauncher.utils.semver.valid_range(range_, loose)

ulauncher.utils.setup_logging module

ulauncher.utils.string module

ulauncher.utils.text_highlighter module

ulauncher.utils.version_cmp module

Module contents