partition
stringclasses
3 values
func_name
stringlengths
1
134
docstring
stringlengths
1
46.9k
path
stringlengths
4
223
original_string
stringlengths
75
104k
code
stringlengths
75
104k
docstring_tokens
listlengths
1
1.97k
repo
stringlengths
7
55
language
stringclasses
1 value
url
stringlengths
87
315
code_tokens
listlengths
19
28.4k
sha
stringlengths
40
40
train
area_field
Provides a select box for country selection
hfos/schemata/defaultform.py
def area_field(key='area'): """Provides a select box for country selection""" area_list = list(subdivisions) title_map = [] for item in area_list: title_map.append({'value': item.code, 'name': item.name}) widget = { 'key': key, 'type': 'uiselect', 'titleMap': title_...
def area_field(key='area'): """Provides a select box for country selection""" area_list = list(subdivisions) title_map = [] for item in area_list: title_map.append({'value': item.code, 'name': item.name}) widget = { 'key': key, 'type': 'uiselect', 'titleMap': title_...
[ "Provides", "a", "select", "box", "for", "country", "selection" ]
Hackerfleet/hfos
python
https://github.com/Hackerfleet/hfos/blob/b6df14eacaffb6be5c844108873ff8763ec7f0c9/hfos/schemata/defaultform.py#L255-L269
[ "def", "area_field", "(", "key", "=", "'area'", ")", ":", "area_list", "=", "list", "(", "subdivisions", ")", "title_map", "=", "[", "]", "for", "item", "in", "area_list", ":", "title_map", ".", "append", "(", "{", "'value'", ":", "item", ".", "code", ...
b6df14eacaffb6be5c844108873ff8763ec7f0c9
train
ConnectivityMonitor.timed_connectivity_check
Tests internet connectivity in regular intervals and updates the nodestate accordingly
modules/comms/hfos/comms/connectivity.py
def timed_connectivity_check(self, event): """Tests internet connectivity in regular intervals and updates the nodestate accordingly""" self.status = self._can_connect() self.log('Timed connectivity check:', self.status, lvl=verbose) if self.status: if not self.old_status: ...
def timed_connectivity_check(self, event): """Tests internet connectivity in regular intervals and updates the nodestate accordingly""" self.status = self._can_connect() self.log('Timed connectivity check:', self.status, lvl=verbose) if self.status: if not self.old_status: ...
[ "Tests", "internet", "connectivity", "in", "regular", "intervals", "and", "updates", "the", "nodestate", "accordingly" ]
Hackerfleet/hfos
python
https://github.com/Hackerfleet/hfos/blob/b6df14eacaffb6be5c844108873ff8763ec7f0c9/modules/comms/hfos/comms/connectivity.py#L106-L121
[ "def", "timed_connectivity_check", "(", "self", ",", "event", ")", ":", "self", ".", "status", "=", "self", ".", "_can_connect", "(", ")", "self", ".", "log", "(", "'Timed connectivity check:'", ",", "self", ".", "status", ",", "lvl", "=", "verbose", ")", ...
b6df14eacaffb6be5c844108873ff8763ec7f0c9
train
ConnectivityMonitor._can_connect
Tries to connect to the configured host:port and returns True if the connection was established
modules/comms/hfos/comms/connectivity.py
def _can_connect(self): """Tries to connect to the configured host:port and returns True if the connection was established""" self.log('Trying to reach configured connectivity check endpoint', lvl=verbose) try: socket.setdefaulttimeout(self.config.timeout) socket.socket(...
def _can_connect(self): """Tries to connect to the configured host:port and returns True if the connection was established""" self.log('Trying to reach configured connectivity check endpoint', lvl=verbose) try: socket.setdefaulttimeout(self.config.timeout) socket.socket(...
[ "Tries", "to", "connect", "to", "the", "configured", "host", ":", "port", "and", "returns", "True", "if", "the", "connection", "was", "established" ]
Hackerfleet/hfos
python
https://github.com/Hackerfleet/hfos/blob/b6df14eacaffb6be5c844108873ff8763ec7f0c9/modules/comms/hfos/comms/connectivity.py#L123-L133
[ "def", "_can_connect", "(", "self", ")", ":", "self", ".", "log", "(", "'Trying to reach configured connectivity check endpoint'", ",", "lvl", "=", "verbose", ")", "try", ":", "socket", ".", "setdefaulttimeout", "(", "self", ".", "config", ".", "timeout", ")", ...
b6df14eacaffb6be5c844108873ff8763ec7f0c9
train
ActivityMonitor.referenceframe
Handles navigational reference frame updates. These are necessary to assign geo coordinates to alerts and other misc things. :param event with incoming referenceframe message
hfos/ui/activitymonitor.py
def referenceframe(self, event): """Handles navigational reference frame updates. These are necessary to assign geo coordinates to alerts and other misc things. :param event with incoming referenceframe message """ self.log("Got a reference frame update! ", event, lvl=v...
def referenceframe(self, event): """Handles navigational reference frame updates. These are necessary to assign geo coordinates to alerts and other misc things. :param event with incoming referenceframe message """ self.log("Got a reference frame update! ", event, lvl=v...
[ "Handles", "navigational", "reference", "frame", "updates", ".", "These", "are", "necessary", "to", "assign", "geo", "coordinates", "to", "alerts", "and", "other", "misc", "things", "." ]
Hackerfleet/hfos
python
https://github.com/Hackerfleet/hfos/blob/b6df14eacaffb6be5c844108873ff8763ec7f0c9/hfos/ui/activitymonitor.py#L69-L79
[ "def", "referenceframe", "(", "self", ",", "event", ")", ":", "self", ".", "log", "(", "\"Got a reference frame update! \"", ",", "event", ",", "lvl", "=", "verbose", ")", "self", ".", "referenceframe", "=", "event", ".", "data" ]
b6df14eacaffb6be5c844108873ff8763ec7f0c9
train
ActivityMonitor.activityrequest
ActivityMonitor event handler for incoming events :param event with incoming ActivityMonitor message
hfos/ui/activitymonitor.py
def activityrequest(self, event): """ActivityMonitor event handler for incoming events :param event with incoming ActivityMonitor message """ # self.log("Event: '%s'" % event.__dict__) try: action = event.action data = event.data self.log("A...
def activityrequest(self, event): """ActivityMonitor event handler for incoming events :param event with incoming ActivityMonitor message """ # self.log("Event: '%s'" % event.__dict__) try: action = event.action data = event.data self.log("A...
[ "ActivityMonitor", "event", "handler", "for", "incoming", "events" ]
Hackerfleet/hfos
python
https://github.com/Hackerfleet/hfos/blob/b6df14eacaffb6be5c844108873ff8763ec7f0c9/hfos/ui/activitymonitor.py#L87-L101
[ "def", "activityrequest", "(", "self", ",", "event", ")", ":", "# self.log(\"Event: '%s'\" % event.__dict__)", "try", ":", "action", "=", "event", ".", "action", "data", "=", "event", ".", "data", "self", ".", "log", "(", "\"Activityrequest: \"", ",", "action", ...
b6df14eacaffb6be5c844108873ff8763ec7f0c9
train
modify
Modify field values of objects
hfos/tool/objects.py
def modify(ctx, schema, uuid, object_filter, field, value): """Modify field values of objects""" database = ctx.obj['db'] model = database.objectmodels[schema] obj = None if uuid: obj = model.find_one({'uuid': uuid}) elif object_filter: obj = model.find_one(literal_eval(object_...
def modify(ctx, schema, uuid, object_filter, field, value): """Modify field values of objects""" database = ctx.obj['db'] model = database.objectmodels[schema] obj = None if uuid: obj = model.find_one({'uuid': uuid}) elif object_filter: obj = model.find_one(literal_eval(object_...
[ "Modify", "field", "values", "of", "objects" ]
Hackerfleet/hfos
python
https://github.com/Hackerfleet/hfos/blob/b6df14eacaffb6be5c844108873ff8763ec7f0c9/hfos/tool/objects.py#L51-L82
[ "def", "modify", "(", "ctx", ",", "schema", ",", "uuid", ",", "object_filter", ",", "field", ",", "value", ")", ":", "database", "=", "ctx", ".", "obj", "[", "'db'", "]", "model", "=", "database", ".", "objectmodels", "[", "schema", "]", "obj", "=", ...
b6df14eacaffb6be5c844108873ff8763ec7f0c9
train
view
Show stored objects
hfos/tool/objects.py
def view(ctx, schema, uuid, object_filter): """Show stored objects""" database = ctx.obj['db'] if schema is None: log('No schema given. Read the help', lvl=warn) return model = database.objectmodels[schema] if uuid: obj = model.find({'uuid': uuid}) elif object_filter:...
def view(ctx, schema, uuid, object_filter): """Show stored objects""" database = ctx.obj['db'] if schema is None: log('No schema given. Read the help', lvl=warn) return model = database.objectmodels[schema] if uuid: obj = model.find({'uuid': uuid}) elif object_filter:...
[ "Show", "stored", "objects" ]
Hackerfleet/hfos
python
https://github.com/Hackerfleet/hfos/blob/b6df14eacaffb6be5c844108873ff8763ec7f0c9/hfos/tool/objects.py#L90-L109
[ "def", "view", "(", "ctx", ",", "schema", ",", "uuid", ",", "object_filter", ")", ":", "database", "=", "ctx", ".", "obj", "[", "'db'", "]", "if", "schema", "is", "None", ":", "log", "(", "'No schema given. Read the help'", ",", "lvl", "=", "warn", ")"...
b6df14eacaffb6be5c844108873ff8763ec7f0c9
train
delete
Delete stored objects (CAUTION!)
hfos/tool/objects.py
def delete(ctx, schema, uuid, object_filter, yes): """Delete stored objects (CAUTION!)""" database = ctx.obj['db'] if schema is None: log('No schema given. Read the help', lvl=warn) return model = database.objectmodels[schema] if uuid: count = model.count({'uuid': uuid}) ...
def delete(ctx, schema, uuid, object_filter, yes): """Delete stored objects (CAUTION!)""" database = ctx.obj['db'] if schema is None: log('No schema given. Read the help', lvl=warn) return model = database.objectmodels[schema] if uuid: count = model.count({'uuid': uuid}) ...
[ "Delete", "stored", "objects", "(", "CAUTION!", ")" ]
Hackerfleet/hfos
python
https://github.com/Hackerfleet/hfos/blob/b6df14eacaffb6be5c844108873ff8763ec7f0c9/hfos/tool/objects.py#L118-L150
[ "def", "delete", "(", "ctx", ",", "schema", ",", "uuid", ",", "object_filter", ",", "yes", ")", ":", "database", "=", "ctx", ".", "obj", "[", "'db'", "]", "if", "schema", "is", "None", ":", "log", "(", "'No schema given. Read the help'", ",", "lvl", "=...
b6df14eacaffb6be5c844108873ff8763ec7f0c9
train
validate
Validates all objects or all objects of a given schema.
hfos/tool/objects.py
def validate(ctx, schema, all_schemata): """Validates all objects or all objects of a given schema.""" database = ctx.obj['db'] if schema is None: if all_schemata is False: log('No schema given. Read the help', lvl=warn) return else: schemata = database....
def validate(ctx, schema, all_schemata): """Validates all objects or all objects of a given schema.""" database = ctx.obj['db'] if schema is None: if all_schemata is False: log('No schema given. Read the help', lvl=warn) return else: schemata = database....
[ "Validates", "all", "objects", "or", "all", "objects", "of", "a", "given", "schema", "." ]
Hackerfleet/hfos
python
https://github.com/Hackerfleet/hfos/blob/b6df14eacaffb6be5c844108873ff8763ec7f0c9/hfos/tool/objects.py#L158-L186
[ "def", "validate", "(", "ctx", ",", "schema", ",", "all_schemata", ")", ":", "database", "=", "ctx", ".", "obj", "[", "'db'", "]", "if", "schema", "is", "None", ":", "if", "all_schemata", "is", "False", ":", "log", "(", "'No schema given. Read the help'", ...
b6df14eacaffb6be5c844108873ff8763ec7f0c9
train
find_field
Find fields in registered data models.
hfos/tool/objects.py
def find_field(ctx, search, by_type, obj): """Find fields in registered data models.""" # TODO: Fix this to work recursively on all possible subschemes if search is not None: search = search else: search = _ask("Enter search term") database = ctx.obj['db'] def find(search_sche...
def find_field(ctx, search, by_type, obj): """Find fields in registered data models.""" # TODO: Fix this to work recursively on all possible subschemes if search is not None: search = search else: search = _ask("Enter search term") database = ctx.obj['db'] def find(search_sche...
[ "Find", "fields", "in", "registered", "data", "models", "." ]
Hackerfleet/hfos
python
https://github.com/Hackerfleet/hfos/blob/b6df14eacaffb6be5c844108873ff8763ec7f0c9/hfos/tool/objects.py#L198-L263
[ "def", "find_field", "(", "ctx", ",", "search", ",", "by_type", ",", "obj", ")", ":", "# TODO: Fix this to work recursively on all possible subschemes", "if", "search", "is", "not", "None", ":", "search", "=", "search", "else", ":", "search", "=", "_ask", "(", ...
b6df14eacaffb6be5c844108873ff8763ec7f0c9
train
Distance
Get distance between pairs of lat-lon points
modules/dev/hfos/misc/vesselsim.py
def Distance(lat1, lon1, lat2, lon2): """Get distance between pairs of lat-lon points""" az12, az21, dist = wgs84_geod.inv(lon1, lat1, lon2, lat2) return az21, dist
def Distance(lat1, lon1, lat2, lon2): """Get distance between pairs of lat-lon points""" az12, az21, dist = wgs84_geod.inv(lon1, lat1, lon2, lat2) return az21, dist
[ "Get", "distance", "between", "pairs", "of", "lat", "-", "lon", "points" ]
Hackerfleet/hfos
python
https://github.com/Hackerfleet/hfos/blob/b6df14eacaffb6be5c844108873ff8763ec7f0c9/modules/dev/hfos/misc/vesselsim.py#L54-L58
[ "def", "Distance", "(", "lat1", ",", "lon1", ",", "lat2", ",", "lon2", ")", ":", "az12", ",", "az21", ",", "dist", "=", "wgs84_geod", ".", "inv", "(", "lon1", ",", "lat1", ",", "lon2", ",", "lat2", ")", "return", "az21", ",", "dist" ]
b6df14eacaffb6be5c844108873ff8763ec7f0c9
train
ClientManager.client_details
Display known details about a given client
hfos/ui/clientmanager.py
def client_details(self, *args): """Display known details about a given client""" self.log(_('Client details:', lang='de')) client = self._clients[args[0]] self.log('UUID:', client.uuid, 'IP:', client.ip, 'Name:', client.name, 'User:', self._users[client.useruuid], pre...
def client_details(self, *args): """Display known details about a given client""" self.log(_('Client details:', lang='de')) client = self._clients[args[0]] self.log('UUID:', client.uuid, 'IP:', client.ip, 'Name:', client.name, 'User:', self._users[client.useruuid], pre...
[ "Display", "known", "details", "about", "a", "given", "client" ]
Hackerfleet/hfos
python
https://github.com/Hackerfleet/hfos/blob/b6df14eacaffb6be5c844108873ff8763ec7f0c9/hfos/ui/clientmanager.py#L155-L162
[ "def", "client_details", "(", "self", ",", "*", "args", ")", ":", "self", ".", "log", "(", "_", "(", "'Client details:'", ",", "lang", "=", "'de'", ")", ")", "client", "=", "self", ".", "_clients", "[", "args", "[", "0", "]", "]", "self", ".", "l...
b6df14eacaffb6be5c844108873ff8763ec7f0c9
train
ClientManager.client_list
Display a list of connected clients
hfos/ui/clientmanager.py
def client_list(self, *args): """Display a list of connected clients""" if len(self._clients) == 0: self.log('No clients connected') else: self.log(self._clients, pretty=True)
def client_list(self, *args): """Display a list of connected clients""" if len(self._clients) == 0: self.log('No clients connected') else: self.log(self._clients, pretty=True)
[ "Display", "a", "list", "of", "connected", "clients" ]
Hackerfleet/hfos
python
https://github.com/Hackerfleet/hfos/blob/b6df14eacaffb6be5c844108873ff8763ec7f0c9/hfos/ui/clientmanager.py#L165-L170
[ "def", "client_list", "(", "self", ",", "*", "args", ")", ":", "if", "len", "(", "self", ".", "_clients", ")", "==", "0", ":", "self", ".", "log", "(", "'No clients connected'", ")", "else", ":", "self", ".", "log", "(", "self", ".", "_clients", ",...
b6df14eacaffb6be5c844108873ff8763ec7f0c9
train
ClientManager.users_list
Display a list of connected users
hfos/ui/clientmanager.py
def users_list(self, *args): """Display a list of connected users""" if len(self._users) == 0: self.log('No users connected') else: self.log(self._users, pretty=True)
def users_list(self, *args): """Display a list of connected users""" if len(self._users) == 0: self.log('No users connected') else: self.log(self._users, pretty=True)
[ "Display", "a", "list", "of", "connected", "users" ]
Hackerfleet/hfos
python
https://github.com/Hackerfleet/hfos/blob/b6df14eacaffb6be5c844108873ff8763ec7f0c9/hfos/ui/clientmanager.py#L173-L178
[ "def", "users_list", "(", "self", ",", "*", "args", ")", ":", "if", "len", "(", "self", ".", "_users", ")", "==", "0", ":", "self", ".", "log", "(", "'No users connected'", ")", "else", ":", "self", ".", "log", "(", "self", ".", "_users", ",", "p...
b6df14eacaffb6be5c844108873ff8763ec7f0c9
train
ClientManager.sourcess_list
Display a list of all registered events
hfos/ui/clientmanager.py
def sourcess_list(self, *args): """Display a list of all registered events""" from pprint import pprint sources = {} sources.update(self.authorized_events) sources.update(self.anonymous_events) for source in sources: pprint(source)
def sourcess_list(self, *args): """Display a list of all registered events""" from pprint import pprint sources = {} sources.update(self.authorized_events) sources.update(self.anonymous_events) for source in sources: pprint(source)
[ "Display", "a", "list", "of", "all", "registered", "events" ]
Hackerfleet/hfos
python
https://github.com/Hackerfleet/hfos/blob/b6df14eacaffb6be5c844108873ff8763ec7f0c9/hfos/ui/clientmanager.py#L181-L191
[ "def", "sourcess_list", "(", "self", ",", "*", "args", ")", ":", "from", "pprint", "import", "pprint", "sources", "=", "{", "}", "sources", ".", "update", "(", "self", ".", "authorized_events", ")", "sources", ".", "update", "(", "self", ".", "anonymous_...
b6df14eacaffb6be5c844108873ff8763ec7f0c9
train
ClientManager.events_list
Display a list of all registered events
hfos/ui/clientmanager.py
def events_list(self, *args): """Display a list of all registered events""" def merge(a, b, path=None): "merges b into a" if path is None: path = [] for key in b: if key in a: if isinstance(a[key], dict) and isinstance(b[key], dict...
def events_list(self, *args): """Display a list of all registered events""" def merge(a, b, path=None): "merges b into a" if path is None: path = [] for key in b: if key in a: if isinstance(a[key], dict) and isinstance(b[key], dict...
[ "Display", "a", "list", "of", "all", "registered", "events" ]
Hackerfleet/hfos
python
https://github.com/Hackerfleet/hfos/blob/b6df14eacaffb6be5c844108873ff8763ec7f0c9/hfos/ui/clientmanager.py#L194-L220
[ "def", "events_list", "(", "self", ",", "*", "args", ")", ":", "def", "merge", "(", "a", ",", "b", ",", "path", "=", "None", ")", ":", "\"merges b into a\"", "if", "path", "is", "None", ":", "path", "=", "[", "]", "for", "key", "in", "b", ":", ...
b6df14eacaffb6be5c844108873ff8763ec7f0c9
train
ClientManager.who
Display a table of connected users and clients
hfos/ui/clientmanager.py
def who(self, *args): """Display a table of connected users and clients""" if len(self._users) == 0: self.log('No users connected') if len(self._clients) == 0: self.log('No clients connected') return Row = namedtuple("Row", ['User', 'Clien...
def who(self, *args): """Display a table of connected users and clients""" if len(self._users) == 0: self.log('No users connected') if len(self._clients) == 0: self.log('No clients connected') return Row = namedtuple("Row", ['User', 'Clien...
[ "Display", "a", "table", "of", "connected", "users", "and", "clients" ]
Hackerfleet/hfos
python
https://github.com/Hackerfleet/hfos/blob/b6df14eacaffb6be5c844108873ff8763ec7f0c9/hfos/ui/clientmanager.py#L223-L245
[ "def", "who", "(", "self", ",", "*", "args", ")", ":", "if", "len", "(", "self", ".", "_users", ")", "==", "0", ":", "self", ".", "log", "(", "'No users connected'", ")", "if", "len", "(", "self", ".", "_clients", ")", "==", "0", ":", "self", "...
b6df14eacaffb6be5c844108873ff8763ec7f0c9
train
ClientManager.disconnect
Handles socket disconnections
hfos/ui/clientmanager.py
def disconnect(self, sock): """Handles socket disconnections""" self.log("Disconnect ", sock, lvl=debug) try: if sock in self._sockets: self.log("Getting socket", lvl=debug) sockobj = self._sockets[sock] self.log("Getting clientuuid",...
def disconnect(self, sock): """Handles socket disconnections""" self.log("Disconnect ", sock, lvl=debug) try: if sock in self._sockets: self.log("Getting socket", lvl=debug) sockobj = self._sockets[sock] self.log("Getting clientuuid",...
[ "Handles", "socket", "disconnections" ]
Hackerfleet/hfos
python
https://github.com/Hackerfleet/hfos/blob/b6df14eacaffb6be5c844108873ff8763ec7f0c9/hfos/ui/clientmanager.py#L255-L290
[ "def", "disconnect", "(", "self", ",", "sock", ")", ":", "self", ".", "log", "(", "\"Disconnect \"", ",", "sock", ",", "lvl", "=", "debug", ")", "try", ":", "if", "sock", "in", "self", ".", "_sockets", ":", "self", ".", "log", "(", "\"Getting socket\...
b6df14eacaffb6be5c844108873ff8763ec7f0c9
train
ClientManager._logoutclient
Log out a client and possibly associated user
hfos/ui/clientmanager.py
def _logoutclient(self, useruuid, clientuuid): """Log out a client and possibly associated user""" self.log("Cleaning up client of logged in user.", lvl=debug) try: self._users[useruuid].clients.remove(clientuuid) if len(self._users[useruuid].clients) == 0: ...
def _logoutclient(self, useruuid, clientuuid): """Log out a client and possibly associated user""" self.log("Cleaning up client of logged in user.", lvl=debug) try: self._users[useruuid].clients.remove(clientuuid) if len(self._users[useruuid].clients) == 0: ...
[ "Log", "out", "a", "client", "and", "possibly", "associated", "user" ]
Hackerfleet/hfos
python
https://github.com/Hackerfleet/hfos/blob/b6df14eacaffb6be5c844108873ff8763ec7f0c9/hfos/ui/clientmanager.py#L292-L308
[ "def", "_logoutclient", "(", "self", ",", "useruuid", ",", "clientuuid", ")", ":", "self", ".", "log", "(", "\"Cleaning up client of logged in user.\"", ",", "lvl", "=", "debug", ")", "try", ":", "self", ".", "_users", "[", "useruuid", "]", ".", "clients", ...
b6df14eacaffb6be5c844108873ff8763ec7f0c9
train
ClientManager.connect
Registers new sockets and their clients and allocates uuids
hfos/ui/clientmanager.py
def connect(self, *args): """Registers new sockets and their clients and allocates uuids""" self.log("Connect ", args, lvl=verbose) try: sock = args[0] ip = args[1] if sock not in self._sockets: self.log("New client connected:", ip, lvl=debu...
def connect(self, *args): """Registers new sockets and their clients and allocates uuids""" self.log("Connect ", args, lvl=verbose) try: sock = args[0] ip = args[1] if sock not in self._sockets: self.log("New client connected:", ip, lvl=debu...
[ "Registers", "new", "sockets", "and", "their", "clients", "and", "allocates", "uuids" ]
Hackerfleet/hfos
python
https://github.com/Hackerfleet/hfos/blob/b6df14eacaffb6be5c844108873ff8763ec7f0c9/hfos/ui/clientmanager.py#L311-L340
[ "def", "connect", "(", "self", ",", "*", "args", ")", ":", "self", ".", "log", "(", "\"Connect \"", ",", "args", ",", "lvl", "=", "verbose", ")", "try", ":", "sock", "=", "args", "[", "0", "]", "ip", "=", "args", "[", "1", "]", "if", "sock", ...
b6df14eacaffb6be5c844108873ff8763ec7f0c9
train
ClientManager.send
Sends a packet to an already known user or one of his clients by UUID
hfos/ui/clientmanager.py
def send(self, event): """Sends a packet to an already known user or one of his clients by UUID""" try: jsonpacket = json.dumps(event.packet, cls=ComplexEncoder) if event.sendtype == "user": # TODO: I think, caching a user name <-> uuid table would ...
def send(self, event): """Sends a packet to an already known user or one of his clients by UUID""" try: jsonpacket = json.dumps(event.packet, cls=ComplexEncoder) if event.sendtype == "user": # TODO: I think, caching a user name <-> uuid table would ...
[ "Sends", "a", "packet", "to", "an", "already", "known", "user", "or", "one", "of", "his", "clients", "by", "UUID" ]
Hackerfleet/hfos
python
https://github.com/Hackerfleet/hfos/blob/b6df14eacaffb6be5c844108873ff8763ec7f0c9/hfos/ui/clientmanager.py#L342-L403
[ "def", "send", "(", "self", ",", "event", ")", ":", "try", ":", "jsonpacket", "=", "json", ".", "dumps", "(", "event", ".", "packet", ",", "cls", "=", "ComplexEncoder", ")", "if", "event", ".", "sendtype", "==", "\"user\"", ":", "# TODO: I think, caching...
b6df14eacaffb6be5c844108873ff8763ec7f0c9
train
ClientManager.broadcast
Broadcasts an event either to all users or clients, depending on event flag
hfos/ui/clientmanager.py
def broadcast(self, event): """Broadcasts an event either to all users or clients, depending on event flag""" try: if event.broadcasttype == "users": if len(self._users) > 0: self.log("Broadcasting to all users:", event...
def broadcast(self, event): """Broadcasts an event either to all users or clients, depending on event flag""" try: if event.broadcasttype == "users": if len(self._users) > 0: self.log("Broadcasting to all users:", event...
[ "Broadcasts", "an", "event", "either", "to", "all", "users", "or", "clients", "depending", "on", "event", "flag" ]
Hackerfleet/hfos
python
https://github.com/Hackerfleet/hfos/blob/b6df14eacaffb6be5c844108873ff8763ec7f0c9/hfos/ui/clientmanager.py#L405-L443
[ "def", "broadcast", "(", "self", ",", "event", ")", ":", "try", ":", "if", "event", ".", "broadcasttype", "==", "\"users\"", ":", "if", "len", "(", "self", ".", "_users", ")", ">", "0", ":", "self", ".", "log", "(", "\"Broadcasting to all users:\"", ",...
b6df14eacaffb6be5c844108873ff8763ec7f0c9
train
ClientManager._checkPermissions
Checks if the user has in any role that allows to fire the event.
hfos/ui/clientmanager.py
def _checkPermissions(self, user, event): """Checks if the user has in any role that allows to fire the event.""" for role in user.account.roles: if role in event.roles: self.log('Access granted', lvl=verbose) return True self.log('Access denied', lv...
def _checkPermissions(self, user, event): """Checks if the user has in any role that allows to fire the event.""" for role in user.account.roles: if role in event.roles: self.log('Access granted', lvl=verbose) return True self.log('Access denied', lv...
[ "Checks", "if", "the", "user", "has", "in", "any", "role", "that", "allows", "to", "fire", "the", "event", "." ]
Hackerfleet/hfos
python
https://github.com/Hackerfleet/hfos/blob/b6df14eacaffb6be5c844108873ff8763ec7f0c9/hfos/ui/clientmanager.py#L445-L454
[ "def", "_checkPermissions", "(", "self", ",", "user", ",", "event", ")", ":", "for", "role", "in", "user", ".", "account", ".", "roles", ":", "if", "role", "in", "event", ".", "roles", ":", "self", ".", "log", "(", "'Access granted'", ",", "lvl", "="...
b6df14eacaffb6be5c844108873ff8763ec7f0c9
train
ClientManager._handleAuthorizedEvents
Isolated communication link for authorized events.
hfos/ui/clientmanager.py
def _handleAuthorizedEvents(self, component, action, data, user, client): """Isolated communication link for authorized events.""" try: if component == "debugger": self.log(component, action, data, user, client, lvl=info) if not user and component in self.author...
def _handleAuthorizedEvents(self, component, action, data, user, client): """Isolated communication link for authorized events.""" try: if component == "debugger": self.log(component, action, data, user, client, lvl=info) if not user and component in self.author...
[ "Isolated", "communication", "link", "for", "authorized", "events", "." ]
Hackerfleet/hfos
python
https://github.com/Hackerfleet/hfos/blob/b6df14eacaffb6be5c844108873ff8763ec7f0c9/hfos/ui/clientmanager.py#L456-L488
[ "def", "_handleAuthorizedEvents", "(", "self", ",", "component", ",", "action", ",", "data", ",", "user", ",", "client", ")", ":", "try", ":", "if", "component", "==", "\"debugger\"", ":", "self", ".", "log", "(", "component", ",", "action", ",", "data",...
b6df14eacaffb6be5c844108873ff8763ec7f0c9
train
ClientManager._handleAnonymousEvents
Handler for anonymous (public) events
hfos/ui/clientmanager.py
def _handleAnonymousEvents(self, component, action, data, client): """Handler for anonymous (public) events""" try: event = self.anonymous_events[component][action]['event'] self.log("Firing anonymous event: ", component, action, str(data)[:20], lvl=network)...
def _handleAnonymousEvents(self, component, action, data, client): """Handler for anonymous (public) events""" try: event = self.anonymous_events[component][action]['event'] self.log("Firing anonymous event: ", component, action, str(data)[:20], lvl=network)...
[ "Handler", "for", "anonymous", "(", "public", ")", "events" ]
Hackerfleet/hfos
python
https://github.com/Hackerfleet/hfos/blob/b6df14eacaffb6be5c844108873ff8763ec7f0c9/hfos/ui/clientmanager.py#L490-L502
[ "def", "_handleAnonymousEvents", "(", "self", ",", "component", ",", "action", ",", "data", ",", "client", ")", ":", "try", ":", "event", "=", "self", ".", "anonymous_events", "[", "component", "]", "[", "action", "]", "[", "'event'", "]", "self", ".", ...
b6df14eacaffb6be5c844108873ff8763ec7f0c9
train
ClientManager._handleAuthenticationEvents
Handler for authentication events
hfos/ui/clientmanager.py
def _handleAuthenticationEvents(self, requestdata, requestaction, clientuuid, sock): """Handler for authentication events""" # TODO: Move this stuff over to ./auth.py if requestaction in ("login", "autologin"): try: self.log("Login...
def _handleAuthenticationEvents(self, requestdata, requestaction, clientuuid, sock): """Handler for authentication events""" # TODO: Move this stuff over to ./auth.py if requestaction in ("login", "autologin"): try: self.log("Login...
[ "Handler", "for", "authentication", "events" ]
Hackerfleet/hfos
python
https://github.com/Hackerfleet/hfos/blob/b6df14eacaffb6be5c844108873ff8763ec7f0c9/hfos/ui/clientmanager.py#L504-L559
[ "def", "_handleAuthenticationEvents", "(", "self", ",", "requestdata", ",", "requestaction", ",", "clientuuid", ",", "sock", ")", ":", "# TODO: Move this stuff over to ./auth.py", "if", "requestaction", "in", "(", "\"login\"", ",", "\"autologin\"", ")", ":", "try", ...
b6df14eacaffb6be5c844108873ff8763ec7f0c9
train
ClientManager._reset_flood_offenders
Resets the list of flood offenders on event trigger
hfos/ui/clientmanager.py
def _reset_flood_offenders(self, *args): """Resets the list of flood offenders on event trigger""" offenders = [] # self.log('Resetting flood offenders') for offender, offence_time in self._flooding.items(): if time() - offence_time < 10: self.log('Removed o...
def _reset_flood_offenders(self, *args): """Resets the list of flood offenders on event trigger""" offenders = [] # self.log('Resetting flood offenders') for offender, offence_time in self._flooding.items(): if time() - offence_time < 10: self.log('Removed o...
[ "Resets", "the", "list", "of", "flood", "offenders", "on", "event", "trigger" ]
Hackerfleet/hfos
python
https://github.com/Hackerfleet/hfos/blob/b6df14eacaffb6be5c844108873ff8763ec7f0c9/hfos/ui/clientmanager.py#L569-L581
[ "def", "_reset_flood_offenders", "(", "self", ",", "*", "args", ")", ":", "offenders", "=", "[", "]", "# self.log('Resetting flood offenders')", "for", "offender", ",", "offence_time", "in", "self", ".", "_flooding", ".", "items", "(", ")", ":", "if", "time", ...
b6df14eacaffb6be5c844108873ff8763ec7f0c9
train
ClientManager._check_flood_protection
Checks if any clients have been flooding the node
hfos/ui/clientmanager.py
def _check_flood_protection(self, component, action, clientuuid): """Checks if any clients have been flooding the node""" if clientuuid not in self._flood_counter: self._flood_counter[clientuuid] = 0 self._flood_counter[clientuuid] += 1 if self._flood_counter[clientuuid] >...
def _check_flood_protection(self, component, action, clientuuid): """Checks if any clients have been flooding the node""" if clientuuid not in self._flood_counter: self._flood_counter[clientuuid] = 0 self._flood_counter[clientuuid] += 1 if self._flood_counter[clientuuid] >...
[ "Checks", "if", "any", "clients", "have", "been", "flooding", "the", "node" ]
Hackerfleet/hfos
python
https://github.com/Hackerfleet/hfos/blob/b6df14eacaffb6be5c844108873ff8763ec7f0c9/hfos/ui/clientmanager.py#L583-L599
[ "def", "_check_flood_protection", "(", "self", ",", "component", ",", "action", ",", "clientuuid", ")", ":", "if", "clientuuid", "not", "in", "self", ".", "_flood_counter", ":", "self", ".", "_flood_counter", "[", "clientuuid", "]", "=", "0", "self", ".", ...
b6df14eacaffb6be5c844108873ff8763ec7f0c9
train
ClientManager.read
Handles raw client requests and distributes them to the appropriate components
hfos/ui/clientmanager.py
def read(self, *args): """Handles raw client requests and distributes them to the appropriate components""" self.log("Beginning new transaction: ", args, lvl=network) try: sock, msg = args[0], args[1] user = password = client = clientuuid = useruuid = requestdata...
def read(self, *args): """Handles raw client requests and distributes them to the appropriate components""" self.log("Beginning new transaction: ", args, lvl=network) try: sock, msg = args[0], args[1] user = password = client = clientuuid = useruuid = requestdata...
[ "Handles", "raw", "client", "requests", "and", "distributes", "them", "to", "the", "appropriate", "components" ]
Hackerfleet/hfos
python
https://github.com/Hackerfleet/hfos/blob/b6df14eacaffb6be5c844108873ff8763ec7f0c9/hfos/ui/clientmanager.py#L602-L700
[ "def", "read", "(", "self", ",", "*", "args", ")", ":", "self", ".", "log", "(", "\"Beginning new transaction: \"", ",", "args", ",", "lvl", "=", "network", ")", "try", ":", "sock", ",", "msg", "=", "args", "[", "0", "]", ",", "args", "[", "1", "...
b6df14eacaffb6be5c844108873ff8763ec7f0c9
train
ClientManager.authentication
Links the client to the granted account and profile, then notifies the client
hfos/ui/clientmanager.py
def authentication(self, event): """Links the client to the granted account and profile, then notifies the client""" try: self.log("Authorization has been granted by DB check:", event.username, lvl=debug) account, profile, clientconfig = event.userd...
def authentication(self, event): """Links the client to the granted account and profile, then notifies the client""" try: self.log("Authorization has been granted by DB check:", event.username, lvl=debug) account, profile, clientconfig = event.userd...
[ "Links", "the", "client", "to", "the", "granted", "account", "and", "profile", "then", "notifies", "the", "client" ]
Hackerfleet/hfos
python
https://github.com/Hackerfleet/hfos/blob/b6df14eacaffb6be5c844108873ff8763ec7f0c9/hfos/ui/clientmanager.py#L703-L801
[ "def", "authentication", "(", "self", ",", "event", ")", ":", "try", ":", "self", ".", "log", "(", "\"Authorization has been granted by DB check:\"", ",", "event", ".", "username", ",", "lvl", "=", "debug", ")", "account", ",", "profile", ",", "clientconfig", ...
b6df14eacaffb6be5c844108873ff8763ec7f0c9
train
ClientManager.selectlanguage
Store client's selection of a new translation
hfos/ui/clientmanager.py
def selectlanguage(self, event): """Store client's selection of a new translation""" self.log('Language selection event:', event.client, pretty=True) if event.data not in all_languages(): self.log('Unavailable language selected:', event.data, lvl=warn) language = None ...
def selectlanguage(self, event): """Store client's selection of a new translation""" self.log('Language selection event:', event.client, pretty=True) if event.data not in all_languages(): self.log('Unavailable language selected:', event.data, lvl=warn) language = None ...
[ "Store", "client", "s", "selection", "of", "a", "new", "translation" ]
Hackerfleet/hfos
python
https://github.com/Hackerfleet/hfos/blob/b6df14eacaffb6be5c844108873ff8763ec7f0c9/hfos/ui/clientmanager.py#L804-L822
[ "def", "selectlanguage", "(", "self", ",", "event", ")", ":", "self", ".", "log", "(", "'Language selection event:'", ",", "event", ".", "client", ",", "pretty", "=", "True", ")", "if", "event", ".", "data", "not", "in", "all_languages", "(", ")", ":", ...
b6df14eacaffb6be5c844108873ff8763ec7f0c9
train
ClientManager.getlanguages
Compile and return a human readable list of registered translations
hfos/ui/clientmanager.py
def getlanguages(self, event): """Compile and return a human readable list of registered translations""" self.log('Client requests all languages.', lvl=verbose) result = { 'component': 'hfos.ui.clientmanager', 'action': 'getlanguages', 'data': language_token_...
def getlanguages(self, event): """Compile and return a human readable list of registered translations""" self.log('Client requests all languages.', lvl=verbose) result = { 'component': 'hfos.ui.clientmanager', 'action': 'getlanguages', 'data': language_token_...
[ "Compile", "and", "return", "a", "human", "readable", "list", "of", "registered", "translations" ]
Hackerfleet/hfos
python
https://github.com/Hackerfleet/hfos/blob/b6df14eacaffb6be5c844108873ff8763ec7f0c9/hfos/ui/clientmanager.py#L825-L834
[ "def", "getlanguages", "(", "self", ",", "event", ")", ":", "self", ".", "log", "(", "'Client requests all languages.'", ",", "lvl", "=", "verbose", ")", "result", "=", "{", "'component'", ":", "'hfos.ui.clientmanager'", ",", "'action'", ":", "'getlanguages'", ...
b6df14eacaffb6be5c844108873ff8763ec7f0c9
train
ClientManager.ping
Perform a ping to measure client <-> node latency
hfos/ui/clientmanager.py
def ping(self, event): """Perform a ping to measure client <-> node latency""" self.log('Client ping received:', event.data, lvl=verbose) response = { 'component': 'hfos.ui.clientmanager', 'action': 'pong', 'data': [event.data, time() * 1000] } ...
def ping(self, event): """Perform a ping to measure client <-> node latency""" self.log('Client ping received:', event.data, lvl=verbose) response = { 'component': 'hfos.ui.clientmanager', 'action': 'pong', 'data': [event.data, time() * 1000] } ...
[ "Perform", "a", "ping", "to", "measure", "client", "<", "-", ">", "node", "latency" ]
Hackerfleet/hfos
python
https://github.com/Hackerfleet/hfos/blob/b6df14eacaffb6be5c844108873ff8763ec7f0c9/hfos/ui/clientmanager.py#L837-L847
[ "def", "ping", "(", "self", ",", "event", ")", ":", "self", ".", "log", "(", "'Client ping received:'", ",", "event", ".", "data", ",", "lvl", "=", "verbose", ")", "response", "=", "{", "'component'", ":", "'hfos.ui.clientmanager'", ",", "'action'", ":", ...
b6df14eacaffb6be5c844108873ff8763ec7f0c9
train
Apex.convert
Converts between geodetic, modified apex, quasi-dipole and MLT. Parameters ========== lat : array_like Latitude lon : array_like Longitude/MLT source : {'geo', 'apex', 'qd', 'mlt'} Input coordinate system dest : {'geo', 'apex', 'qd', '...
src/apexpy/apex.py
def convert(self, lat, lon, source, dest, height=0, datetime=None, precision=1e-10, ssheight=50*6371): """Converts between geodetic, modified apex, quasi-dipole and MLT. Parameters ========== lat : array_like Latitude lon : array_like Long...
def convert(self, lat, lon, source, dest, height=0, datetime=None, precision=1e-10, ssheight=50*6371): """Converts between geodetic, modified apex, quasi-dipole and MLT. Parameters ========== lat : array_like Latitude lon : array_like Long...
[ "Converts", "between", "geodetic", "modified", "apex", "quasi", "-", "dipole", "and", "MLT", "." ]
aburrell/apexpy
python
https://github.com/aburrell/apexpy/blob/a2e919fd9ea9a65d49c4c22c9eb030c8ccf48386/src/apexpy/apex.py#L115-L203
[ "def", "convert", "(", "self", ",", "lat", ",", "lon", ",", "source", ",", "dest", ",", "height", "=", "0", ",", "datetime", "=", "None", ",", "precision", "=", "1e-10", ",", "ssheight", "=", "50", "*", "6371", ")", ":", "if", "datetime", "is", "...
a2e919fd9ea9a65d49c4c22c9eb030c8ccf48386
train
Apex.geo2apex
Converts geodetic to modified apex coordinates. Parameters ========== glat : array_like Geodetic latitude glon : array_like Geodetic longitude height : array_like Altitude in km Returns ======= alat : ndarray or float ...
src/apexpy/apex.py
def geo2apex(self, glat, glon, height): """Converts geodetic to modified apex coordinates. Parameters ========== glat : array_like Geodetic latitude glon : array_like Geodetic longitude height : array_like Altitude in km Retur...
def geo2apex(self, glat, glon, height): """Converts geodetic to modified apex coordinates. Parameters ========== glat : array_like Geodetic latitude glon : array_like Geodetic longitude height : array_like Altitude in km Retur...
[ "Converts", "geodetic", "to", "modified", "apex", "coordinates", "." ]
aburrell/apexpy
python
https://github.com/aburrell/apexpy/blob/a2e919fd9ea9a65d49c4c22c9eb030c8ccf48386/src/apexpy/apex.py#L205-L235
[ "def", "geo2apex", "(", "self", ",", "glat", ",", "glon", ",", "height", ")", ":", "glat", "=", "helpers", ".", "checklat", "(", "glat", ",", "name", "=", "'glat'", ")", "alat", ",", "alon", "=", "self", ".", "_geo2apex", "(", "glat", ",", "glon", ...
a2e919fd9ea9a65d49c4c22c9eb030c8ccf48386
train
Apex.apex2geo
Converts modified apex to geodetic coordinates. Parameters ========== alat : array_like Modified apex latitude alon : array_like Modified apex longitude height : array_like Altitude in km precision : float, optional Precisi...
src/apexpy/apex.py
def apex2geo(self, alat, alon, height, precision=1e-10): """Converts modified apex to geodetic coordinates. Parameters ========== alat : array_like Modified apex latitude alon : array_like Modified apex longitude height : array_like Al...
def apex2geo(self, alat, alon, height, precision=1e-10): """Converts modified apex to geodetic coordinates. Parameters ========== alat : array_like Modified apex latitude alon : array_like Modified apex longitude height : array_like Al...
[ "Converts", "modified", "apex", "to", "geodetic", "coordinates", "." ]
aburrell/apexpy
python
https://github.com/aburrell/apexpy/blob/a2e919fd9ea9a65d49c4c22c9eb030c8ccf48386/src/apexpy/apex.py#L237-L274
[ "def", "apex2geo", "(", "self", ",", "alat", ",", "alon", ",", "height", ",", "precision", "=", "1e-10", ")", ":", "alat", "=", "helpers", ".", "checklat", "(", "alat", ",", "name", "=", "'alat'", ")", "qlat", ",", "qlon", "=", "self", ".", "apex2q...
a2e919fd9ea9a65d49c4c22c9eb030c8ccf48386
train
Apex.geo2qd
Converts geodetic to quasi-dipole coordinates. Parameters ========== glat : array_like Geodetic latitude glon : array_like Geodetic longitude height : array_like Altitude in km Returns ======= qlat : ndarray or float ...
src/apexpy/apex.py
def geo2qd(self, glat, glon, height): """Converts geodetic to quasi-dipole coordinates. Parameters ========== glat : array_like Geodetic latitude glon : array_like Geodetic longitude height : array_like Altitude in km Returns ...
def geo2qd(self, glat, glon, height): """Converts geodetic to quasi-dipole coordinates. Parameters ========== glat : array_like Geodetic latitude glon : array_like Geodetic longitude height : array_like Altitude in km Returns ...
[ "Converts", "geodetic", "to", "quasi", "-", "dipole", "coordinates", "." ]
aburrell/apexpy
python
https://github.com/aburrell/apexpy/blob/a2e919fd9ea9a65d49c4c22c9eb030c8ccf48386/src/apexpy/apex.py#L276-L302
[ "def", "geo2qd", "(", "self", ",", "glat", ",", "glon", ",", "height", ")", ":", "glat", "=", "helpers", ".", "checklat", "(", "glat", ",", "name", "=", "'glat'", ")", "qlat", ",", "qlon", "=", "self", ".", "_geo2qd", "(", "glat", ",", "glon", ",...
a2e919fd9ea9a65d49c4c22c9eb030c8ccf48386
train
Apex.qd2geo
Converts quasi-dipole to geodetic coordinates. Parameters ========== qlat : array_like Quasi-dipole latitude qlon : array_like Quasi-dipole longitude height : array_like Altitude in km precision : float, optional Precision ...
src/apexpy/apex.py
def qd2geo(self, qlat, qlon, height, precision=1e-10): """Converts quasi-dipole to geodetic coordinates. Parameters ========== qlat : array_like Quasi-dipole latitude qlon : array_like Quasi-dipole longitude height : array_like Altitud...
def qd2geo(self, qlat, qlon, height, precision=1e-10): """Converts quasi-dipole to geodetic coordinates. Parameters ========== qlat : array_like Quasi-dipole latitude qlon : array_like Quasi-dipole longitude height : array_like Altitud...
[ "Converts", "quasi", "-", "dipole", "to", "geodetic", "coordinates", "." ]
aburrell/apexpy
python
https://github.com/aburrell/apexpy/blob/a2e919fd9ea9a65d49c4c22c9eb030c8ccf48386/src/apexpy/apex.py#L304-L341
[ "def", "qd2geo", "(", "self", ",", "qlat", ",", "qlon", ",", "height", ",", "precision", "=", "1e-10", ")", ":", "qlat", "=", "helpers", ".", "checklat", "(", "qlat", ",", "name", "=", "'qlat'", ")", "glat", ",", "glon", ",", "error", "=", "self", ...
a2e919fd9ea9a65d49c4c22c9eb030c8ccf48386
train
Apex._apex2qd_nonvectorized
Convert from apex to quasi-dipole (not-vectorised) Parameters ----------- alat : (float) Apex latitude in degrees alon : (float) Apex longitude in degrees height : (float) Height in km Returns --------- qlat : (float) ...
src/apexpy/apex.py
def _apex2qd_nonvectorized(self, alat, alon, height): """Convert from apex to quasi-dipole (not-vectorised) Parameters ----------- alat : (float) Apex latitude in degrees alon : (float) Apex longitude in degrees height : (float) Height...
def _apex2qd_nonvectorized(self, alat, alon, height): """Convert from apex to quasi-dipole (not-vectorised) Parameters ----------- alat : (float) Apex latitude in degrees alon : (float) Apex longitude in degrees height : (float) Height...
[ "Convert", "from", "apex", "to", "quasi", "-", "dipole", "(", "not", "-", "vectorised", ")" ]
aburrell/apexpy
python
https://github.com/aburrell/apexpy/blob/a2e919fd9ea9a65d49c4c22c9eb030c8ccf48386/src/apexpy/apex.py#L343-L383
[ "def", "_apex2qd_nonvectorized", "(", "self", ",", "alat", ",", "alon", ",", "height", ")", ":", "alat", "=", "helpers", ".", "checklat", "(", "alat", ",", "name", "=", "'alat'", ")", "# convert modified apex to quasi-dipole:", "qlon", "=", "alon", "# apex hei...
a2e919fd9ea9a65d49c4c22c9eb030c8ccf48386
train
Apex.apex2qd
Converts modified apex to quasi-dipole coordinates. Parameters ========== alat : array_like Modified apex latitude alon : array_like Modified apex longitude height : array_like Altitude in km Returns ======= qlat : nda...
src/apexpy/apex.py
def apex2qd(self, alat, alon, height): """Converts modified apex to quasi-dipole coordinates. Parameters ========== alat : array_like Modified apex latitude alon : array_like Modified apex longitude height : array_like Altitude in km ...
def apex2qd(self, alat, alon, height): """Converts modified apex to quasi-dipole coordinates. Parameters ========== alat : array_like Modified apex latitude alon : array_like Modified apex longitude height : array_like Altitude in km ...
[ "Converts", "modified", "apex", "to", "quasi", "-", "dipole", "coordinates", "." ]
aburrell/apexpy
python
https://github.com/aburrell/apexpy/blob/a2e919fd9ea9a65d49c4c22c9eb030c8ccf48386/src/apexpy/apex.py#L385-L414
[ "def", "apex2qd", "(", "self", ",", "alat", ",", "alon", ",", "height", ")", ":", "qlat", ",", "qlon", "=", "self", ".", "_apex2qd", "(", "alat", ",", "alon", ",", "height", ")", "# if array is returned, the dtype is object, so convert to float", "return", "np...
a2e919fd9ea9a65d49c4c22c9eb030c8ccf48386
train
Apex.qd2apex
Converts quasi-dipole to modified apex coordinates. Parameters ========== qlat : array_like Quasi-dipole latitude qlon : array_like Quasi-dipole longitude height : array_like Altitude in km Returns ======= alat : ndarr...
src/apexpy/apex.py
def qd2apex(self, qlat, qlon, height): """Converts quasi-dipole to modified apex coordinates. Parameters ========== qlat : array_like Quasi-dipole latitude qlon : array_like Quasi-dipole longitude height : array_like Altitude in km ...
def qd2apex(self, qlat, qlon, height): """Converts quasi-dipole to modified apex coordinates. Parameters ========== qlat : array_like Quasi-dipole latitude qlon : array_like Quasi-dipole longitude height : array_like Altitude in km ...
[ "Converts", "quasi", "-", "dipole", "to", "modified", "apex", "coordinates", "." ]
aburrell/apexpy
python
https://github.com/aburrell/apexpy/blob/a2e919fd9ea9a65d49c4c22c9eb030c8ccf48386/src/apexpy/apex.py#L438-L467
[ "def", "qd2apex", "(", "self", ",", "qlat", ",", "qlon", ",", "height", ")", ":", "alat", ",", "alon", "=", "self", ".", "_qd2apex", "(", "qlat", ",", "qlon", ",", "height", ")", "# if array is returned, the dtype is object, so convert to float", "return", "np...
a2e919fd9ea9a65d49c4c22c9eb030c8ccf48386
train
Apex.mlon2mlt
Computes the magnetic local time at the specified magnetic longitude and UT. Parameters ========== mlon : array_like Magnetic longitude (apex and quasi-dipole longitude are always equal) datetime : :class:`datetime.datetime` Date and time ...
src/apexpy/apex.py
def mlon2mlt(self, mlon, datetime, ssheight=50*6371): """Computes the magnetic local time at the specified magnetic longitude and UT. Parameters ========== mlon : array_like Magnetic longitude (apex and quasi-dipole longitude are always equal) da...
def mlon2mlt(self, mlon, datetime, ssheight=50*6371): """Computes the magnetic local time at the specified magnetic longitude and UT. Parameters ========== mlon : array_like Magnetic longitude (apex and quasi-dipole longitude are always equal) da...
[ "Computes", "the", "magnetic", "local", "time", "at", "the", "specified", "magnetic", "longitude", "and", "UT", "." ]
aburrell/apexpy
python
https://github.com/aburrell/apexpy/blob/a2e919fd9ea9a65d49c4c22c9eb030c8ccf48386/src/apexpy/apex.py#L469-L503
[ "def", "mlon2mlt", "(", "self", ",", "mlon", ",", "datetime", ",", "ssheight", "=", "50", "*", "6371", ")", ":", "ssglat", ",", "ssglon", "=", "helpers", ".", "subsol", "(", "datetime", ")", "ssalat", ",", "ssalon", "=", "self", ".", "geo2apex", "(",...
a2e919fd9ea9a65d49c4c22c9eb030c8ccf48386
train
Apex.mlt2mlon
Computes the magnetic longitude at the specified magnetic local time and UT. Parameters ========== mlt : array_like Magnetic local time datetime : :class:`datetime.datetime` Date and time ssheight : float, optional Altitude in km to us...
src/apexpy/apex.py
def mlt2mlon(self, mlt, datetime, ssheight=50*6371): """Computes the magnetic longitude at the specified magnetic local time and UT. Parameters ========== mlt : array_like Magnetic local time datetime : :class:`datetime.datetime` Date and time ...
def mlt2mlon(self, mlt, datetime, ssheight=50*6371): """Computes the magnetic longitude at the specified magnetic local time and UT. Parameters ========== mlt : array_like Magnetic local time datetime : :class:`datetime.datetime` Date and time ...
[ "Computes", "the", "magnetic", "longitude", "at", "the", "specified", "magnetic", "local", "time", "and", "UT", "." ]
aburrell/apexpy
python
https://github.com/aburrell/apexpy/blob/a2e919fd9ea9a65d49c4c22c9eb030c8ccf48386/src/apexpy/apex.py#L505-L539
[ "def", "mlt2mlon", "(", "self", ",", "mlt", ",", "datetime", ",", "ssheight", "=", "50", "*", "6371", ")", ":", "ssglat", ",", "ssglon", "=", "helpers", ".", "subsol", "(", "datetime", ")", "ssalat", ",", "ssalon", "=", "self", ".", "geo2apex", "(", ...
a2e919fd9ea9a65d49c4c22c9eb030c8ccf48386
train
Apex.map_to_height
Performs mapping of points along the magnetic field to the closest or conjugate hemisphere. Parameters ========== glat : array_like Geodetic latitude glon : array_like Geodetic longitude height : array_like Source altitude in km ...
src/apexpy/apex.py
def map_to_height(self, glat, glon, height, newheight, conjugate=False, precision=1e-10): """Performs mapping of points along the magnetic field to the closest or conjugate hemisphere. Parameters ========== glat : array_like Geodetic latitude ...
def map_to_height(self, glat, glon, height, newheight, conjugate=False, precision=1e-10): """Performs mapping of points along the magnetic field to the closest or conjugate hemisphere. Parameters ========== glat : array_like Geodetic latitude ...
[ "Performs", "mapping", "of", "points", "along", "the", "magnetic", "field", "to", "the", "closest", "or", "conjugate", "hemisphere", "." ]
aburrell/apexpy
python
https://github.com/aburrell/apexpy/blob/a2e919fd9ea9a65d49c4c22c9eb030c8ccf48386/src/apexpy/apex.py#L541-L595
[ "def", "map_to_height", "(", "self", ",", "glat", ",", "glon", ",", "height", ",", "newheight", ",", "conjugate", "=", "False", ",", "precision", "=", "1e-10", ")", ":", "alat", ",", "alon", "=", "self", ".", "geo2apex", "(", "glat", ",", "glon", ","...
a2e919fd9ea9a65d49c4c22c9eb030c8ccf48386
train
Apex.map_E_to_height
Performs mapping of electric field along the magnetic field. It is assumed that the electric field is perpendicular to B. Parameters ========== alat : (N,) array_like or float Modified apex latitude alon : (N,) array_like or float Modified apex longitude...
src/apexpy/apex.py
def map_E_to_height(self, alat, alon, height, newheight, E): """Performs mapping of electric field along the magnetic field. It is assumed that the electric field is perpendicular to B. Parameters ========== alat : (N,) array_like or float Modified apex latitude ...
def map_E_to_height(self, alat, alon, height, newheight, E): """Performs mapping of electric field along the magnetic field. It is assumed that the electric field is perpendicular to B. Parameters ========== alat : (N,) array_like or float Modified apex latitude ...
[ "Performs", "mapping", "of", "electric", "field", "along", "the", "magnetic", "field", "." ]
aburrell/apexpy
python
https://github.com/aburrell/apexpy/blob/a2e919fd9ea9a65d49c4c22c9eb030c8ccf48386/src/apexpy/apex.py#L642-L669
[ "def", "map_E_to_height", "(", "self", ",", "alat", ",", "alon", ",", "height", ",", "newheight", ",", "E", ")", ":", "return", "self", ".", "_map_EV_to_height", "(", "alat", ",", "alon", ",", "height", ",", "newheight", ",", "E", ",", "'E'", ")" ]
a2e919fd9ea9a65d49c4c22c9eb030c8ccf48386
train
Apex.map_V_to_height
Performs mapping of electric drift velocity along the magnetic field. It is assumed that the electric field is perpendicular to B. Parameters ========== alat : (N,) array_like or float Modified apex latitude alon : (N,) array_like or float Modified apex ...
src/apexpy/apex.py
def map_V_to_height(self, alat, alon, height, newheight, V): """Performs mapping of electric drift velocity along the magnetic field. It is assumed that the electric field is perpendicular to B. Parameters ========== alat : (N,) array_like or float Modified apex lat...
def map_V_to_height(self, alat, alon, height, newheight, V): """Performs mapping of electric drift velocity along the magnetic field. It is assumed that the electric field is perpendicular to B. Parameters ========== alat : (N,) array_like or float Modified apex lat...
[ "Performs", "mapping", "of", "electric", "drift", "velocity", "along", "the", "magnetic", "field", "." ]
aburrell/apexpy
python
https://github.com/aburrell/apexpy/blob/a2e919fd9ea9a65d49c4c22c9eb030c8ccf48386/src/apexpy/apex.py#L671-L698
[ "def", "map_V_to_height", "(", "self", ",", "alat", ",", "alon", ",", "height", ",", "newheight", ",", "V", ")", ":", "return", "self", ".", "_map_EV_to_height", "(", "alat", ",", "alon", ",", "height", ",", "newheight", ",", "V", ",", "'V'", ")" ]
a2e919fd9ea9a65d49c4c22c9eb030c8ccf48386
train
Apex.basevectors_qd
Returns quasi-dipole base vectors f1 and f2 at the specified coordinates. The vectors are described by Richmond [1995] [2]_ and Emmert et al. [2010] [3]_. The vector components are geodetic east and north. Parameters ========== lat : (N,) array_like or float ...
src/apexpy/apex.py
def basevectors_qd(self, lat, lon, height, coords='geo', precision=1e-10): """Returns quasi-dipole base vectors f1 and f2 at the specified coordinates. The vectors are described by Richmond [1995] [2]_ and Emmert et al. [2010] [3]_. The vector components are geodetic east and n...
def basevectors_qd(self, lat, lon, height, coords='geo', precision=1e-10): """Returns quasi-dipole base vectors f1 and f2 at the specified coordinates. The vectors are described by Richmond [1995] [2]_ and Emmert et al. [2010] [3]_. The vector components are geodetic east and n...
[ "Returns", "quasi", "-", "dipole", "base", "vectors", "f1", "and", "f2", "at", "the", "specified", "coordinates", "." ]
aburrell/apexpy
python
https://github.com/aburrell/apexpy/blob/a2e919fd9ea9a65d49c4c22c9eb030c8ccf48386/src/apexpy/apex.py#L700-L758
[ "def", "basevectors_qd", "(", "self", ",", "lat", ",", "lon", ",", "height", ",", "coords", "=", "'geo'", ",", "precision", "=", "1e-10", ")", ":", "glat", ",", "glon", "=", "self", ".", "convert", "(", "lat", ",", "lon", ",", "coords", ",", "'geo'...
a2e919fd9ea9a65d49c4c22c9eb030c8ccf48386
train
Apex.basevectors_apex
Returns base vectors in quasi-dipole and apex coordinates. The vectors are described by Richmond [1995] [4]_ and Emmert et al. [2010] [5]_. The vector components are geodetic east, north, and up (only east and north for `f1` and `f2`). Parameters ========== lat, lon : ...
src/apexpy/apex.py
def basevectors_apex(self, lat, lon, height, coords='geo', precision=1e-10): """Returns base vectors in quasi-dipole and apex coordinates. The vectors are described by Richmond [1995] [4]_ and Emmert et al. [2010] [5]_. The vector components are geodetic east, north, and up (only east ...
def basevectors_apex(self, lat, lon, height, coords='geo', precision=1e-10): """Returns base vectors in quasi-dipole and apex coordinates. The vectors are described by Richmond [1995] [4]_ and Emmert et al. [2010] [5]_. The vector components are geodetic east, north, and up (only east ...
[ "Returns", "base", "vectors", "in", "quasi", "-", "dipole", "and", "apex", "coordinates", "." ]
aburrell/apexpy
python
https://github.com/aburrell/apexpy/blob/a2e919fd9ea9a65d49c4c22c9eb030c8ccf48386/src/apexpy/apex.py#L760-L886
[ "def", "basevectors_apex", "(", "self", ",", "lat", ",", "lon", ",", "height", ",", "coords", "=", "'geo'", ",", "precision", "=", "1e-10", ")", ":", "glat", ",", "glon", "=", "self", ".", "convert", "(", "lat", ",", "lon", ",", "coords", ",", "'ge...
a2e919fd9ea9a65d49c4c22c9eb030c8ccf48386
train
Apex.get_apex
Calculate apex height Parameters ----------- lat : (float) Latitude in degrees height : (float or NoneType) Height above the surface of the earth in km or NoneType to use reference height (default=None) Returns ---------- apex...
src/apexpy/apex.py
def get_apex(self, lat, height=None): """ Calculate apex height Parameters ----------- lat : (float) Latitude in degrees height : (float or NoneType) Height above the surface of the earth in km or NoneType to use reference height (default=None...
def get_apex(self, lat, height=None): """ Calculate apex height Parameters ----------- lat : (float) Latitude in degrees height : (float or NoneType) Height above the surface of the earth in km or NoneType to use reference height (default=None...
[ "Calculate", "apex", "height" ]
aburrell/apexpy
python
https://github.com/aburrell/apexpy/blob/a2e919fd9ea9a65d49c4c22c9eb030c8ccf48386/src/apexpy/apex.py#L888-L911
[ "def", "get_apex", "(", "self", ",", "lat", ",", "height", "=", "None", ")", ":", "lat", "=", "helpers", ".", "checklat", "(", "lat", ",", "name", "=", "'alat'", ")", "if", "height", "is", "None", ":", "height", "=", "self", ".", "refh", "cos_lat_s...
a2e919fd9ea9a65d49c4c22c9eb030c8ccf48386
train
Apex.set_epoch
Updates the epoch for all subsequent conversions. Parameters ========== year : float Decimal year
src/apexpy/apex.py
def set_epoch(self, year): """Updates the epoch for all subsequent conversions. Parameters ========== year : float Decimal year """ fa.loadapxsh(self.datafile, np.float(year)) self.year = year
def set_epoch(self, year): """Updates the epoch for all subsequent conversions. Parameters ========== year : float Decimal year """ fa.loadapxsh(self.datafile, np.float(year)) self.year = year
[ "Updates", "the", "epoch", "for", "all", "subsequent", "conversions", "." ]
aburrell/apexpy
python
https://github.com/aburrell/apexpy/blob/a2e919fd9ea9a65d49c4c22c9eb030c8ccf48386/src/apexpy/apex.py#L913-L924
[ "def", "set_epoch", "(", "self", ",", "year", ")", ":", "fa", ".", "loadapxsh", "(", "self", ".", "datafile", ",", "np", ".", "float", "(", "year", ")", ")", "self", ".", "year", "=", "year" ]
a2e919fd9ea9a65d49c4c22c9eb030c8ccf48386
train
basic_parser
Basic ordered parser.
reparse/parsers.py
def basic_parser(patterns, with_name=None): """ Basic ordered parser. """ def parse(line): output = None highest_order = 0 highest_pattern_name = None for pattern in patterns: results = pattern.findall(line) if results and any(results): ...
def basic_parser(patterns, with_name=None): """ Basic ordered parser. """ def parse(line): output = None highest_order = 0 highest_pattern_name = None for pattern in patterns: results = pattern.findall(line) if results and any(results): ...
[ "Basic", "ordered", "parser", "." ]
andychase/reparse
python
https://github.com/andychase/reparse/blob/5f46cdd0fc4e239c0ddeca4b542e48a5ae95c508/reparse/parsers.py#L5-L24
[ "def", "basic_parser", "(", "patterns", ",", "with_name", "=", "None", ")", ":", "def", "parse", "(", "line", ")", ":", "output", "=", "None", "highest_order", "=", "0", "highest_pattern_name", "=", "None", "for", "pattern", "in", "patterns", ":", "results...
5f46cdd0fc4e239c0ddeca4b542e48a5ae95c508
train
alt_parser
This parser is able to handle multiple different patterns finding stuff in text-- while removing matches that overlap.
reparse/parsers.py
def alt_parser(patterns): """ This parser is able to handle multiple different patterns finding stuff in text-- while removing matches that overlap. """ from reparse.util import remove_lower_overlapping get_first = lambda items: [i[0] for i in items] get_second = lambda items: [i[1] for i in...
def alt_parser(patterns): """ This parser is able to handle multiple different patterns finding stuff in text-- while removing matches that overlap. """ from reparse.util import remove_lower_overlapping get_first = lambda items: [i[0] for i in items] get_second = lambda items: [i[1] for i in...
[ "This", "parser", "is", "able", "to", "handle", "multiple", "different", "patterns", "finding", "stuff", "in", "text", "--", "while", "removing", "matches", "that", "overlap", "." ]
andychase/reparse
python
https://github.com/andychase/reparse/blob/5f46cdd0fc4e239c0ddeca4b542e48a5ae95c508/reparse/parsers.py#L27-L43
[ "def", "alt_parser", "(", "patterns", ")", ":", "from", "reparse", ".", "util", "import", "remove_lower_overlapping", "get_first", "=", "lambda", "items", ":", "[", "i", "[", "0", "]", "for", "i", "in", "items", "]", "get_second", "=", "lambda", "items", ...
5f46cdd0fc4e239c0ddeca4b542e48a5ae95c508
train
build_tree_parser
This parser_type simply outputs an array of [(tree, regex)] for use in another language.
reparse/parsers.py
def build_tree_parser(patterns): """ This parser_type simply outputs an array of [(tree, regex)] for use in another language. """ def output(): for pattern in patterns: yield (pattern.build_full_tree(), pattern.regex) return list(output())
def build_tree_parser(patterns): """ This parser_type simply outputs an array of [(tree, regex)] for use in another language. """ def output(): for pattern in patterns: yield (pattern.build_full_tree(), pattern.regex) return list(output())
[ "This", "parser_type", "simply", "outputs", "an", "array", "of", "[", "(", "tree", "regex", ")", "]", "for", "use", "in", "another", "language", "." ]
andychase/reparse
python
https://github.com/andychase/reparse/blob/5f46cdd0fc4e239c0ddeca4b542e48a5ae95c508/reparse/parsers.py#L53-L60
[ "def", "build_tree_parser", "(", "patterns", ")", ":", "def", "output", "(", ")", ":", "for", "pattern", "in", "patterns", ":", "yield", "(", "pattern", ".", "build_full_tree", "(", ")", ",", "pattern", ".", "regex", ")", "return", "list", "(", "output",...
5f46cdd0fc4e239c0ddeca4b542e48a5ae95c508
train
parser
A Reparse parser description. Simply provide the functions, patterns, & expressions to build. If you are using YAML for expressions + patterns, you can use ``expressions_yaml_path`` & ``patterns_yaml_path`` for convenience. The default parser_type is the basic ordered parser.
reparse/parsers.py
def parser(parser_type=basic_parser, functions=None, patterns=None, expressions=None, patterns_yaml_path=None, expressions_yaml_path=None): """ A Reparse parser description. Simply provide the functions, patterns, & expressions to build. If you are using YAML for expressions + patterns, y...
def parser(parser_type=basic_parser, functions=None, patterns=None, expressions=None, patterns_yaml_path=None, expressions_yaml_path=None): """ A Reparse parser description. Simply provide the functions, patterns, & expressions to build. If you are using YAML for expressions + patterns, y...
[ "A", "Reparse", "parser", "description", ".", "Simply", "provide", "the", "functions", "patterns", "&", "expressions", "to", "build", ".", "If", "you", "are", "using", "YAML", "for", "expressions", "+", "patterns", "you", "can", "use", "expressions_yaml_path", ...
andychase/reparse
python
https://github.com/andychase/reparse/blob/5f46cdd0fc4e239c0ddeca4b542e48a5ae95c508/reparse/parsers.py#L63-L90
[ "def", "parser", "(", "parser_type", "=", "basic_parser", ",", "functions", "=", "None", ",", "patterns", "=", "None", ",", "expressions", "=", "None", ",", "patterns_yaml_path", "=", "None", ",", "expressions_yaml_path", "=", "None", ")", ":", "from", "repa...
5f46cdd0fc4e239c0ddeca4b542e48a5ae95c508
train
GuideManager._translate
Translate KML file to geojson for import
modules/webguides/hfos/guides/guide_manager.py
def _translate(self, input_filename, output_filename): """Translate KML file to geojson for import""" command = [ self.translate_binary, '-f', 'GeoJSON', output_filename, input_filename ] result = self._runcommand(command) self.log...
def _translate(self, input_filename, output_filename): """Translate KML file to geojson for import""" command = [ self.translate_binary, '-f', 'GeoJSON', output_filename, input_filename ] result = self._runcommand(command) self.log...
[ "Translate", "KML", "file", "to", "geojson", "for", "import" ]
Hackerfleet/hfos
python
https://github.com/Hackerfleet/hfos/blob/b6df14eacaffb6be5c844108873ff8763ec7f0c9/modules/webguides/hfos/guides/guide_manager.py#L118-L128
[ "def", "_translate", "(", "self", ",", "input_filename", ",", "output_filename", ")", ":", "command", "=", "[", "self", ".", "translate_binary", ",", "'-f'", ",", "'GeoJSON'", ",", "output_filename", ",", "input_filename", "]", "result", "=", "self", ".", "_...
b6df14eacaffb6be5c844108873ff8763ec7f0c9
train
GuideManager._update_guide
Update a single specified guide
modules/webguides/hfos/guides/guide_manager.py
def _update_guide(self, guide, update=False, clear=True): """Update a single specified guide""" kml_filename = os.path.join(self.cache_path, guide + '.kml') geojson_filename = os.path.join(self.cache_path, guide + '.geojson') if not os.path.exists(geojson_filename) or update: ...
def _update_guide(self, guide, update=False, clear=True): """Update a single specified guide""" kml_filename = os.path.join(self.cache_path, guide + '.kml') geojson_filename = os.path.join(self.cache_path, guide + '.geojson') if not os.path.exists(geojson_filename) or update: ...
[ "Update", "a", "single", "specified", "guide" ]
Hackerfleet/hfos
python
https://github.com/Hackerfleet/hfos/blob/b6df14eacaffb6be5c844108873ff8763ec7f0c9/modules/webguides/hfos/guides/guide_manager.py#L136-L198
[ "def", "_update_guide", "(", "self", ",", "guide", ",", "update", "=", "False", ",", "clear", "=", "True", ")", ":", "kml_filename", "=", "os", ".", "path", ".", "join", "(", "self", ".", "cache_path", ",", "guide", "+", "'.kml'", ")", "geojson_filenam...
b6df14eacaffb6be5c844108873ff8763ec7f0c9
train
send_mail_worker
Worker task to send out an email, which is a blocking process unless it is threaded
modules/mail/hfos/mail/transmitter.py
def send_mail_worker(config, mail, event): """Worker task to send out an email, which is a blocking process unless it is threaded""" log = "" try: if config.get('ssl', True): server = SMTP_SSL(config['server'], port=config['port'], timeout=30) else: server = SMTP(con...
def send_mail_worker(config, mail, event): """Worker task to send out an email, which is a blocking process unless it is threaded""" log = "" try: if config.get('ssl', True): server = SMTP_SSL(config['server'], port=config['port'], timeout=30) else: server = SMTP(con...
[ "Worker", "task", "to", "send", "out", "an", "email", "which", "is", "a", "blocking", "process", "unless", "it", "is", "threaded" ]
Hackerfleet/hfos
python
https://github.com/Hackerfleet/hfos/blob/b6df14eacaffb6be5c844108873ff8763ec7f0c9/modules/mail/hfos/mail/transmitter.py#L47-L76
[ "def", "send_mail_worker", "(", "config", ",", "mail", ",", "event", ")", ":", "log", "=", "\"\"", "try", ":", "if", "config", ".", "get", "(", "'ssl'", ",", "True", ")", ":", "server", "=", "SMTP_SSL", "(", "config", "[", "'server'", "]", ",", "po...
b6df14eacaffb6be5c844108873ff8763ec7f0c9
train
MailTransmitter.send_mail
Connect to mail server and send actual email
modules/mail/hfos/mail/transmitter.py
def send_mail(self, event): """Connect to mail server and send actual email""" mime_mail = MIMEText(event.text) mime_mail['Subject'] = event.subject if event.account == 'default': account_name = self.config.default_account else: account_name = event.acco...
def send_mail(self, event): """Connect to mail server and send actual email""" mime_mail = MIMEText(event.text) mime_mail['Subject'] = event.subject if event.account == 'default': account_name = self.config.default_account else: account_name = event.acco...
[ "Connect", "to", "mail", "server", "and", "send", "actual", "email" ]
Hackerfleet/hfos
python
https://github.com/Hackerfleet/hfos/blob/b6df14eacaffb6be5c844108873ff8763ec7f0c9/modules/mail/hfos/mail/transmitter.py#L189-L211
[ "def", "send_mail", "(", "self", ",", "event", ")", ":", "mime_mail", "=", "MIMEText", "(", "event", ".", "text", ")", "mime_mail", "[", "'Subject'", "]", "=", "event", ".", "subject", "if", "event", ".", "account", "==", "'default'", ":", "account_name"...
b6df14eacaffb6be5c844108873ff8763ec7f0c9
train
provision_system_user
Provision a system user
hfos/provisions/user.py
def provision_system_user(items, database_name, overwrite=False, clear=False, skip_user_check=False): """Provision a system user""" from hfos.provisions.base import provisionList from hfos.database import objectmodels # TODO: Add a root user and make sure owner can access it later. # Setting up de...
def provision_system_user(items, database_name, overwrite=False, clear=False, skip_user_check=False): """Provision a system user""" from hfos.provisions.base import provisionList from hfos.database import objectmodels # TODO: Add a root user and make sure owner can access it later. # Setting up de...
[ "Provision", "a", "system", "user" ]
Hackerfleet/hfos
python
https://github.com/Hackerfleet/hfos/blob/b6df14eacaffb6be5c844108873ff8763ec7f0c9/hfos/provisions/user.py#L48-L68
[ "def", "provision_system_user", "(", "items", ",", "database_name", ",", "overwrite", "=", "False", ",", "clear", "=", "False", ",", "skip_user_check", "=", "False", ")", ":", "from", "hfos", ".", "provisions", ".", "base", "import", "provisionList", "from", ...
b6df14eacaffb6be5c844108873ff8763ec7f0c9
train
AlternatesGroup
Group expressions using the OR character ``|`` >>> from collections import namedtuple >>> expr = namedtuple('expr', 'regex group_lengths run')('(1)', [1], None) >>> grouping = AlternatesGroup([expr, expr], lambda f: None, 'yeah') >>> grouping.regex # doctest: +IGNORE_UNICODE '(?:(1))|(?:(1))' >...
reparse/expression.py
def AlternatesGroup(expressions, final_function, name=""): """ Group expressions using the OR character ``|`` >>> from collections import namedtuple >>> expr = namedtuple('expr', 'regex group_lengths run')('(1)', [1], None) >>> grouping = AlternatesGroup([expr, expr], lambda f: None, 'yeah') >>> gro...
def AlternatesGroup(expressions, final_function, name=""): """ Group expressions using the OR character ``|`` >>> from collections import namedtuple >>> expr = namedtuple('expr', 'regex group_lengths run')('(1)', [1], None) >>> grouping = AlternatesGroup([expr, expr], lambda f: None, 'yeah') >>> gro...
[ "Group", "expressions", "using", "the", "OR", "character", "|", ">>>", "from", "collections", "import", "namedtuple", ">>>", "expr", "=", "namedtuple", "(", "expr", "regex", "group_lengths", "run", ")", "(", "(", "1", ")", "[", "1", "]", "None", ")", ">>...
andychase/reparse
python
https://github.com/andychase/reparse/blob/5f46cdd0fc4e239c0ddeca4b542e48a5ae95c508/reparse/expression.py#L108-L121
[ "def", "AlternatesGroup", "(", "expressions", ",", "final_function", ",", "name", "=", "\"\"", ")", ":", "inbetweens", "=", "[", "\"|\"", "]", "*", "(", "len", "(", "expressions", ")", "+", "1", ")", "inbetweens", "[", "0", "]", "=", "\"\"", "inbetween...
5f46cdd0fc4e239c0ddeca4b542e48a5ae95c508
train
Group
Group expressions together with ``inbetweens`` and with the output of a ``final_functions``.
reparse/expression.py
def Group(expressions, final_function, inbetweens, name=""): """ Group expressions together with ``inbetweens`` and with the output of a ``final_functions``. """ lengths = [] functions = [] regex = "" i = 0 for expression in expressions: regex += inbetweens[i] regex += "(?:" ...
def Group(expressions, final_function, inbetweens, name=""): """ Group expressions together with ``inbetweens`` and with the output of a ``final_functions``. """ lengths = [] functions = [] regex = "" i = 0 for expression in expressions: regex += inbetweens[i] regex += "(?:" ...
[ "Group", "expressions", "together", "with", "inbetweens", "and", "with", "the", "output", "of", "a", "final_functions", "." ]
andychase/reparse
python
https://github.com/andychase/reparse/blob/5f46cdd0fc4e239c0ddeca4b542e48a5ae95c508/reparse/expression.py#L124-L139
[ "def", "Group", "(", "expressions", ",", "final_function", ",", "inbetweens", ",", "name", "=", "\"\"", ")", ":", "lengths", "=", "[", "]", "functions", "=", "[", "]", "regex", "=", "\"\"", "i", "=", "0", "for", "expression", "in", "expressions", ":", ...
5f46cdd0fc4e239c0ddeca4b542e48a5ae95c508
train
Expression.findall
Parse string, returning all outputs as parsed by functions
reparse/expression.py
def findall(self, string): """ Parse string, returning all outputs as parsed by functions """ output = [] for match in self.pattern.findall(string): if hasattr(match, 'strip'): match = [match] self._list_add(output, self.run(match)) return ...
def findall(self, string): """ Parse string, returning all outputs as parsed by functions """ output = [] for match in self.pattern.findall(string): if hasattr(match, 'strip'): match = [match] self._list_add(output, self.run(match)) return ...
[ "Parse", "string", "returning", "all", "outputs", "as", "parsed", "by", "functions" ]
andychase/reparse
python
https://github.com/andychase/reparse/blob/5f46cdd0fc4e239c0ddeca4b542e48a5ae95c508/reparse/expression.py#L47-L55
[ "def", "findall", "(", "self", ",", "string", ")", ":", "output", "=", "[", "]", "for", "match", "in", "self", ".", "pattern", ".", "findall", "(", "string", ")", ":", "if", "hasattr", "(", "match", ",", "'strip'", ")", ":", "match", "=", "[", "m...
5f46cdd0fc4e239c0ddeca4b542e48a5ae95c508
train
Expression.scan
Like findall, but also returning matching start and end string locations
reparse/expression.py
def scan(self, string): """ Like findall, but also returning matching start and end string locations """ return list(self._scanner_to_matches(self.pattern.scanner(string), self.run))
def scan(self, string): """ Like findall, but also returning matching start and end string locations """ return list(self._scanner_to_matches(self.pattern.scanner(string), self.run))
[ "Like", "findall", "but", "also", "returning", "matching", "start", "and", "end", "string", "locations" ]
andychase/reparse
python
https://github.com/andychase/reparse/blob/5f46cdd0fc4e239c0ddeca4b542e48a5ae95c508/reparse/expression.py#L57-L60
[ "def", "scan", "(", "self", ",", "string", ")", ":", "return", "list", "(", "self", ".", "_scanner_to_matches", "(", "self", ".", "pattern", ".", "scanner", "(", "string", ")", ",", "self", ".", "run", ")", ")" ]
5f46cdd0fc4e239c0ddeca4b542e48a5ae95c508
train
Expression.run
Run group functions over matches
reparse/expression.py
def run(self, matches): """ Run group functions over matches """ def _run(matches): group_starting_pos = 0 for current_pos, (group_length, group_function) in enumerate(zip(self.group_lengths, self.group_functions)): start_pos = current_pos + group_starting...
def run(self, matches): """ Run group functions over matches """ def _run(matches): group_starting_pos = 0 for current_pos, (group_length, group_function) in enumerate(zip(self.group_lengths, self.group_functions)): start_pos = current_pos + group_starting...
[ "Run", "group", "functions", "over", "matches" ]
andychase/reparse
python
https://github.com/andychase/reparse/blob/5f46cdd0fc4e239c0ddeca4b542e48a5ae95c508/reparse/expression.py#L62-L72
[ "def", "run", "(", "self", ",", "matches", ")", ":", "def", "_run", "(", "matches", ")", ":", "group_starting_pos", "=", "0", "for", "current_pos", ",", "(", "group_length", ",", "group_function", ")", "in", "enumerate", "(", "zip", "(", "self", ".", "...
5f46cdd0fc4e239c0ddeca4b542e48a5ae95c508
train
set_logfile
Specify logfile path
hfos/logger.py
def set_logfile(path, instance): """Specify logfile path""" global logfile logfile = os.path.normpath(path) + '/hfos.' + instance + '.log'
def set_logfile(path, instance): """Specify logfile path""" global logfile logfile = os.path.normpath(path) + '/hfos.' + instance + '.log'
[ "Specify", "logfile", "path" ]
Hackerfleet/hfos
python
https://github.com/Hackerfleet/hfos/blob/b6df14eacaffb6be5c844108873ff8763ec7f0c9/hfos/logger.py#L113-L117
[ "def", "set_logfile", "(", "path", ",", "instance", ")", ":", "global", "logfile", "logfile", "=", "os", ".", "path", ".", "normpath", "(", "path", ")", "+", "'/hfos.'", "+", "instance", "+", "'.log'" ]
b6df14eacaffb6be5c844108873ff8763ec7f0c9
train
is_muted
Checks if a logged event is to be muted for debugging purposes. Also goes through the solo list - only items in there will be logged! :param what: :return:
hfos/logger.py
def is_muted(what): """ Checks if a logged event is to be muted for debugging purposes. Also goes through the solo list - only items in there will be logged! :param what: :return: """ state = False for item in solo: if item not in what: state = True else: ...
def is_muted(what): """ Checks if a logged event is to be muted for debugging purposes. Also goes through the solo list - only items in there will be logged! :param what: :return: """ state = False for item in solo: if item not in what: state = True else: ...
[ "Checks", "if", "a", "logged", "event", "is", "to", "be", "muted", "for", "debugging", "purposes", "." ]
Hackerfleet/hfos
python
https://github.com/Hackerfleet/hfos/blob/b6df14eacaffb6be5c844108873ff8763ec7f0c9/hfos/logger.py#L120-L144
[ "def", "is_muted", "(", "what", ")", ":", "state", "=", "False", "for", "item", "in", "solo", ":", "if", "item", "not", "in", "what", ":", "state", "=", "True", "else", ":", "state", "=", "False", "break", "for", "item", "in", "mute", ":", "if", ...
b6df14eacaffb6be5c844108873ff8763ec7f0c9
train
hfoslog
Logs all *what arguments. :param *what: Loggable objects (i.e. they have a string representation) :param lvl: Debug message level :param exc: Switch to better handle exceptions, use if logging in an except clause :param emitter: Optional log source, where this can't be determined ...
hfos/logger.py
def hfoslog(*what, **kwargs): """Logs all *what arguments. :param *what: Loggable objects (i.e. they have a string representation) :param lvl: Debug message level :param exc: Switch to better handle exceptions, use if logging in an except clause :param emitter: Optional log source, ...
def hfoslog(*what, **kwargs): """Logs all *what arguments. :param *what: Loggable objects (i.e. they have a string representation) :param lvl: Debug message level :param exc: Switch to better handle exceptions, use if logging in an except clause :param emitter: Optional log source, ...
[ "Logs", "all", "*", "what", "arguments", "." ]
Hackerfleet/hfos
python
https://github.com/Hackerfleet/hfos/blob/b6df14eacaffb6be5c844108873ff8763ec7f0c9/hfos/logger.py#L169-L301
[ "def", "hfoslog", "(", "*", "what", ",", "*", "*", "kwargs", ")", ":", "# Count all messages (missing numbers give a hint at too high log level)", "global", "count", "global", "verbosity", "count", "+=", "1", "lvl", "=", "kwargs", ".", "get", "(", "'lvl'", ",", ...
b6df14eacaffb6be5c844108873ff8763ec7f0c9
train
TagManager.get_tagged
Return a list of tagged objects for a schema
hfos/ui/tagmanager.py
def get_tagged(self, event): """Return a list of tagged objects for a schema""" self.log("Tagged objects request for", event.data, "from", event.user, lvl=debug) if event.data in self.tags: tagged = self._get_tagged(event.data) response = { ...
def get_tagged(self, event): """Return a list of tagged objects for a schema""" self.log("Tagged objects request for", event.data, "from", event.user, lvl=debug) if event.data in self.tags: tagged = self._get_tagged(event.data) response = { ...
[ "Return", "a", "list", "of", "tagged", "objects", "for", "a", "schema" ]
Hackerfleet/hfos
python
https://github.com/Hackerfleet/hfos/blob/b6df14eacaffb6be5c844108873ff8763ec7f0c9/hfos/ui/tagmanager.py#L83-L97
[ "def", "get_tagged", "(", "self", ",", "event", ")", ":", "self", ".", "log", "(", "\"Tagged objects request for\"", ",", "event", ".", "data", ",", "\"from\"", ",", "event", ".", "user", ",", "lvl", "=", "debug", ")", "if", "event", ".", "data", "in",...
b6df14eacaffb6be5c844108873ff8763ec7f0c9
train
provision_system_vessel
Provisions the default system vessel
modules/navdata/hfos/navdata/provisions/vessel.py
def provision_system_vessel(items, database_name, overwrite=False, clear=False, skip_user_check=False): """Provisions the default system vessel""" from hfos.provisions.base import provisionList from hfos.database import objectmodels vessel = objectmodels['vessel'].find_one({'name': 'Default System Ves...
def provision_system_vessel(items, database_name, overwrite=False, clear=False, skip_user_check=False): """Provisions the default system vessel""" from hfos.provisions.base import provisionList from hfos.database import objectmodels vessel = objectmodels['vessel'].find_one({'name': 'Default System Ves...
[ "Provisions", "the", "default", "system", "vessel" ]
Hackerfleet/hfos
python
https://github.com/Hackerfleet/hfos/blob/b6df14eacaffb6be5c844108873ff8763ec7f0c9/modules/navdata/hfos/navdata/provisions/vessel.py#L33-L54
[ "def", "provision_system_vessel", "(", "items", ",", "database_name", ",", "overwrite", "=", "False", ",", "clear", "=", "False", ",", "skip_user_check", "=", "False", ")", ":", "from", "hfos", ".", "provisions", ".", "base", "import", "provisionList", "from",...
b6df14eacaffb6be5c844108873ff8763ec7f0c9
train
get_tile
Threadable function to retrieve map tiles from the internet :param url: URL of tile to get
modules/maps/hfos/map/maptileservice.py
def get_tile(url): """ Threadable function to retrieve map tiles from the internet :param url: URL of tile to get """ log = "" connection = None try: if six.PY3: connection = urlopen(url=url, timeout=2) # NOQA else: connection = urlopen(url=url) ...
def get_tile(url): """ Threadable function to retrieve map tiles from the internet :param url: URL of tile to get """ log = "" connection = None try: if six.PY3: connection = urlopen(url=url, timeout=2) # NOQA else: connection = urlopen(url=url) ...
[ "Threadable", "function", "to", "retrieve", "map", "tiles", "from", "the", "internet", ":", "param", "url", ":", "URL", "of", "tile", "to", "get" ]
Hackerfleet/hfos
python
https://github.com/Hackerfleet/hfos/blob/b6df14eacaffb6be5c844108873ff8763ec7f0c9/modules/maps/hfos/map/maptileservice.py#L63-L92
[ "def", "get_tile", "(", "url", ")", ":", "log", "=", "\"\"", "connection", "=", "None", "try", ":", "if", "six", ".", "PY3", ":", "connection", "=", "urlopen", "(", "url", "=", "url", ",", "timeout", "=", "2", ")", "# NOQA", "else", ":", "connectio...
b6df14eacaffb6be5c844108873ff8763ec7f0c9
train
MaptileService.tilecache
Checks and caches a requested tile to disk, then delivers it to client
modules/maps/hfos/map/maptileservice.py
def tilecache(self, event, *args, **kwargs): """Checks and caches a requested tile to disk, then delivers it to client""" request, response = event.args[:2] self.log(request.path, lvl=verbose) try: filename, url = self._split_cache_url(request.path, 'tilecache') ...
def tilecache(self, event, *args, **kwargs): """Checks and caches a requested tile to disk, then delivers it to client""" request, response = event.args[:2] self.log(request.path, lvl=verbose) try: filename, url = self._split_cache_url(request.path, 'tilecache') ...
[ "Checks", "and", "caches", "a", "requested", "tile", "to", "disk", "then", "delivers", "it", "to", "client" ]
Hackerfleet/hfos
python
https://github.com/Hackerfleet/hfos/blob/b6df14eacaffb6be5c844108873ff8763ec7f0c9/modules/maps/hfos/map/maptileservice.py#L464-L543
[ "def", "tilecache", "(", "self", ",", "event", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "request", ",", "response", "=", "event", ".", "args", "[", ":", "2", "]", "self", ".", "log", "(", "request", ".", "path", ",", "lvl", "=", "ve...
b6df14eacaffb6be5c844108873ff8763ec7f0c9
train
todegdec
Convert from [+/-]DDD°MMM'SSS.SSSS" or [+/-]DDD°MMM.MMMM' to [+/-]DDD.DDDDD
twd97/converter.py
def todegdec(origin): """ Convert from [+/-]DDD°MMM'SSS.SSSS" or [+/-]DDD°MMM.MMMM' to [+/-]DDD.DDDDD """ # if the input is already a float (or can be converted to float) try: return float(origin) except ValueError: pass # DMS format m = dms_re.search(origin) if m: ...
def todegdec(origin): """ Convert from [+/-]DDD°MMM'SSS.SSSS" or [+/-]DDD°MMM.MMMM' to [+/-]DDD.DDDDD """ # if the input is already a float (or can be converted to float) try: return float(origin) except ValueError: pass # DMS format m = dms_re.search(origin) if m: ...
[ "Convert", "from", "[", "+", "/", "-", "]", "DDD°MMM", "SSS", ".", "SSSS", "or", "[", "+", "/", "-", "]", "DDD°MMM", ".", "MMMM", "to", "[", "+", "/", "-", "]", "DDD", ".", "DDDDD" ]
yychen/twd97
python
https://github.com/yychen/twd97/blob/2fe05dbca335be425a1f451e0ef8f210ec864de1/twd97/converter.py#L41-L67
[ "def", "todegdec", "(", "origin", ")", ":", "# if the input is already a float (or can be converted to float)", "try", ":", "return", "float", "(", "origin", ")", "except", "ValueError", ":", "pass", "# DMS format", "m", "=", "dms_re", ".", "search", "(", "origin", ...
2fe05dbca335be425a1f451e0ef8f210ec864de1
train
tomindec
Convert [+/-]DDD.DDDDD to a tuple (degrees, minutes)
twd97/converter.py
def tomindec(origin): """ Convert [+/-]DDD.DDDDD to a tuple (degrees, minutes) """ origin = float(origin) degrees = int(origin) minutes = (origin % 1) * 60 return degrees, minutes
def tomindec(origin): """ Convert [+/-]DDD.DDDDD to a tuple (degrees, minutes) """ origin = float(origin) degrees = int(origin) minutes = (origin % 1) * 60 return degrees, minutes
[ "Convert", "[", "+", "/", "-", "]", "DDD", ".", "DDDDD", "to", "a", "tuple", "(", "degrees", "minutes", ")" ]
yychen/twd97
python
https://github.com/yychen/twd97/blob/2fe05dbca335be425a1f451e0ef8f210ec864de1/twd97/converter.py#L69-L78
[ "def", "tomindec", "(", "origin", ")", ":", "origin", "=", "float", "(", "origin", ")", "degrees", "=", "int", "(", "origin", ")", "minutes", "=", "(", "origin", "%", "1", ")", "*", "60", "return", "degrees", ",", "minutes" ]
2fe05dbca335be425a1f451e0ef8f210ec864de1
train
tomindecstr
Convert [+/-]DDD.DDDDD to [+/-]DDD°MMM.MMMM'
twd97/converter.py
def tomindecstr(origin): """ Convert [+/-]DDD.DDDDD to [+/-]DDD°MMM.MMMM' """ degrees, minutes = tomindec(origin) return u'%d°%f\'' % (degrees, minutes)
def tomindecstr(origin): """ Convert [+/-]DDD.DDDDD to [+/-]DDD°MMM.MMMM' """ degrees, minutes = tomindec(origin) return u'%d°%f\'' % (degrees, minutes)
[ "Convert", "[", "+", "/", "-", "]", "DDD", ".", "DDDDD", "to", "[", "+", "/", "-", "]", "DDD°MMM", ".", "MMMM" ]
yychen/twd97
python
https://github.com/yychen/twd97/blob/2fe05dbca335be425a1f451e0ef8f210ec864de1/twd97/converter.py#L80-L86
[ "def", "tomindecstr", "(", "origin", ")", ":", "degrees", ",", "minutes", "=", "tomindec", "(", "origin", ")", "return", "u'%d°%f\\'' ", " ", "d", "egrees,", " ", "inutes)", "" ]
2fe05dbca335be425a1f451e0ef8f210ec864de1
train
todms
Convert [+/-]DDD.DDDDD to a tuple (degrees, minutes, seconds)
twd97/converter.py
def todms(origin): """ Convert [+/-]DDD.DDDDD to a tuple (degrees, minutes, seconds) """ degrees, minutes = tomindec(origin) seconds = (minutes % 1) * 60 return degrees, int(minutes), seconds
def todms(origin): """ Convert [+/-]DDD.DDDDD to a tuple (degrees, minutes, seconds) """ degrees, minutes = tomindec(origin) seconds = (minutes % 1) * 60 return degrees, int(minutes), seconds
[ "Convert", "[", "+", "/", "-", "]", "DDD", ".", "DDDDD", "to", "a", "tuple", "(", "degrees", "minutes", "seconds", ")" ]
yychen/twd97
python
https://github.com/yychen/twd97/blob/2fe05dbca335be425a1f451e0ef8f210ec864de1/twd97/converter.py#L88-L96
[ "def", "todms", "(", "origin", ")", ":", "degrees", ",", "minutes", "=", "tomindec", "(", "origin", ")", "seconds", "=", "(", "minutes", "%", "1", ")", "*", "60", "return", "degrees", ",", "int", "(", "minutes", ")", ",", "seconds" ]
2fe05dbca335be425a1f451e0ef8f210ec864de1
train
todmsstr
Convert [+/-]DDD.DDDDD to [+/-]DDD°MMM'DDD.DDDDD"
twd97/converter.py
def todmsstr(origin): """ Convert [+/-]DDD.DDDDD to [+/-]DDD°MMM'DDD.DDDDD" """ degrees, minutes, seconds = todms(origin) return u'%d°%d\'%f"' % (degrees, minutes, seconds)
def todmsstr(origin): """ Convert [+/-]DDD.DDDDD to [+/-]DDD°MMM'DDD.DDDDD" """ degrees, minutes, seconds = todms(origin) return u'%d°%d\'%f"' % (degrees, minutes, seconds)
[ "Convert", "[", "+", "/", "-", "]", "DDD", ".", "DDDDD", "to", "[", "+", "/", "-", "]", "DDD°MMM", "DDD", ".", "DDDDD" ]
yychen/twd97
python
https://github.com/yychen/twd97/blob/2fe05dbca335be425a1f451e0ef8f210ec864de1/twd97/converter.py#L98-L104
[ "def", "todmsstr", "(", "origin", ")", ":", "degrees", ",", "minutes", ",", "seconds", "=", "todms", "(", "origin", ")", "return", "u'%d°%d\\'%f\"' ", " ", "d", "egrees,", " ", "inutes,", " ", "econds)", "" ]
2fe05dbca335be425a1f451e0ef8f210ec864de1
train
towgs84
Convert coordintes from TWD97 to WGS84 The east and north coordinates should be in meters and in float pkm true for Penghu, Kinmen and Matsu area You can specify one of the following presentations of the returned values: dms - A tuple with degrees (int), minutes (int) and seconds (float) dm...
twd97/converter.py
def towgs84(E, N, pkm=False, presentation=None): """ Convert coordintes from TWD97 to WGS84 The east and north coordinates should be in meters and in float pkm true for Penghu, Kinmen and Matsu area You can specify one of the following presentations of the returned values: dms - A tuple wit...
def towgs84(E, N, pkm=False, presentation=None): """ Convert coordintes from TWD97 to WGS84 The east and north coordinates should be in meters and in float pkm true for Penghu, Kinmen and Matsu area You can specify one of the following presentations of the returned values: dms - A tuple wit...
[ "Convert", "coordintes", "from", "TWD97", "to", "WGS84" ]
yychen/twd97
python
https://github.com/yychen/twd97/blob/2fe05dbca335be425a1f451e0ef8f210ec864de1/twd97/converter.py#L106-L156
[ "def", "towgs84", "(", "E", ",", "N", ",", "pkm", "=", "False", ",", "presentation", "=", "None", ")", ":", "_lng0", "=", "lng0pkm", "if", "pkm", "else", "lng0", "E", "/=", "1000.0", "N", "/=", "1000.0", "epsilon", "=", "(", "N", "-", "N0", ")", ...
2fe05dbca335be425a1f451e0ef8f210ec864de1
train
fromwgs84
Convert coordintes from WGS84 to TWD97 pkm true for Penghu, Kinmen and Matsu area The latitude and longitude can be in the following formats: [+/-]DDD°MMM'SSS.SSSS" (unicode) [+/-]DDD°MMM.MMMM' (unicode) [+/-]DDD.DDDDD (string, unicode or float) The returned coordinates are in meter...
twd97/converter.py
def fromwgs84(lat, lng, pkm=False): """ Convert coordintes from WGS84 to TWD97 pkm true for Penghu, Kinmen and Matsu area The latitude and longitude can be in the following formats: [+/-]DDD°MMM'SSS.SSSS" (unicode) [+/-]DDD°MMM.MMMM' (unicode) [+/-]DDD.DDDDD (string, unicode or ...
def fromwgs84(lat, lng, pkm=False): """ Convert coordintes from WGS84 to TWD97 pkm true for Penghu, Kinmen and Matsu area The latitude and longitude can be in the following formats: [+/-]DDD°MMM'SSS.SSSS" (unicode) [+/-]DDD°MMM.MMMM' (unicode) [+/-]DDD.DDDDD (string, unicode or ...
[ "Convert", "coordintes", "from", "WGS84", "to", "TWD97" ]
yychen/twd97
python
https://github.com/yychen/twd97/blob/2fe05dbca335be425a1f451e0ef8f210ec864de1/twd97/converter.py#L158-L186
[ "def", "fromwgs84", "(", "lat", ",", "lng", ",", "pkm", "=", "False", ")", ":", "_lng0", "=", "lng0pkm", "if", "pkm", "else", "lng0", "lat", "=", "radians", "(", "todegdec", "(", "lat", ")", ")", "lng", "=", "radians", "(", "todegdec", "(", "lng", ...
2fe05dbca335be425a1f451e0ef8f210ec864de1
train
TileUtils.clipValue
Makes sure that value is within a specific range. If not, then the lower or upper bounds is returned
modules/maps/hfos/map/TileTools.py
def clipValue(self, value, minValue, maxValue): ''' Makes sure that value is within a specific range. If not, then the lower or upper bounds is returned ''' return min(max(value, minValue), maxValue)
def clipValue(self, value, minValue, maxValue): ''' Makes sure that value is within a specific range. If not, then the lower or upper bounds is returned ''' return min(max(value, minValue), maxValue)
[ "Makes", "sure", "that", "value", "is", "within", "a", "specific", "range", ".", "If", "not", "then", "the", "lower", "or", "upper", "bounds", "is", "returned" ]
Hackerfleet/hfos
python
https://github.com/Hackerfleet/hfos/blob/b6df14eacaffb6be5c844108873ff8763ec7f0c9/modules/maps/hfos/map/TileTools.py#L16-L21
[ "def", "clipValue", "(", "self", ",", "value", ",", "minValue", ",", "maxValue", ")", ":", "return", "min", "(", "max", "(", "value", ",", "minValue", ")", ",", "maxValue", ")" ]
b6df14eacaffb6be5c844108873ff8763ec7f0c9
train
TileUtils.getGroundResolution
returns the ground resolution for based on latitude and zoom level.
modules/maps/hfos/map/TileTools.py
def getGroundResolution(self, latitude, level): ''' returns the ground resolution for based on latitude and zoom level. ''' latitude = self.clipValue(latitude, self.min_lat, self.max_lat); mapSize = self.getMapDimensionsByZoomLevel(level) return math.cos( lati...
def getGroundResolution(self, latitude, level): ''' returns the ground resolution for based on latitude and zoom level. ''' latitude = self.clipValue(latitude, self.min_lat, self.max_lat); mapSize = self.getMapDimensionsByZoomLevel(level) return math.cos( lati...
[ "returns", "the", "ground", "resolution", "for", "based", "on", "latitude", "and", "zoom", "level", "." ]
Hackerfleet/hfos
python
https://github.com/Hackerfleet/hfos/blob/b6df14eacaffb6be5c844108873ff8763ec7f0c9/modules/maps/hfos/map/TileTools.py#L30-L38
[ "def", "getGroundResolution", "(", "self", ",", "latitude", ",", "level", ")", ":", "latitude", "=", "self", ".", "clipValue", "(", "latitude", ",", "self", ".", "min_lat", ",", "self", ".", "max_lat", ")", "mapSize", "=", "self", ".", "getMapDimensionsByZ...
b6df14eacaffb6be5c844108873ff8763ec7f0c9
train
TileUtils.getMapScale
returns the map scale on the dpi of the screen
modules/maps/hfos/map/TileTools.py
def getMapScale(self, latitude, level, dpi=96): ''' returns the map scale on the dpi of the screen ''' dpm = dpi / 0.0254 # convert to dots per meter return self.getGroundResolution(latitude, level) * dpm
def getMapScale(self, latitude, level, dpi=96): ''' returns the map scale on the dpi of the screen ''' dpm = dpi / 0.0254 # convert to dots per meter return self.getGroundResolution(latitude, level) * dpm
[ "returns", "the", "map", "scale", "on", "the", "dpi", "of", "the", "screen" ]
Hackerfleet/hfos
python
https://github.com/Hackerfleet/hfos/blob/b6df14eacaffb6be5c844108873ff8763ec7f0c9/modules/maps/hfos/map/TileTools.py#L40-L45
[ "def", "getMapScale", "(", "self", ",", "latitude", ",", "level", ",", "dpi", "=", "96", ")", ":", "dpm", "=", "dpi", "/", "0.0254", "# convert to dots per meter", "return", "self", ".", "getGroundResolution", "(", "latitude", ",", "level", ")", "*", "dpm"...
b6df14eacaffb6be5c844108873ff8763ec7f0c9
train
TileUtils.convertLatLngToPixelXY
returns the x and y values of the pixel corresponding to a latitude and longitude.
modules/maps/hfos/map/TileTools.py
def convertLatLngToPixelXY(self, lat, lng, level): ''' returns the x and y values of the pixel corresponding to a latitude and longitude. ''' mapSize = self.getMapDimensionsByZoomLevel(level) lat = self.clipValue(lat, self.min_lat, self.max_lat) lng = self.clipVa...
def convertLatLngToPixelXY(self, lat, lng, level): ''' returns the x and y values of the pixel corresponding to a latitude and longitude. ''' mapSize = self.getMapDimensionsByZoomLevel(level) lat = self.clipValue(lat, self.min_lat, self.max_lat) lng = self.clipVa...
[ "returns", "the", "x", "and", "y", "values", "of", "the", "pixel", "corresponding", "to", "a", "latitude", "and", "longitude", "." ]
Hackerfleet/hfos
python
https://github.com/Hackerfleet/hfos/blob/b6df14eacaffb6be5c844108873ff8763ec7f0c9/modules/maps/hfos/map/TileTools.py#L47-L63
[ "def", "convertLatLngToPixelXY", "(", "self", ",", "lat", ",", "lng", ",", "level", ")", ":", "mapSize", "=", "self", ".", "getMapDimensionsByZoomLevel", "(", "level", ")", "lat", "=", "self", ".", "clipValue", "(", "lat", ",", "self", ".", "min_lat", ",...
b6df14eacaffb6be5c844108873ff8763ec7f0c9
train
TileUtils.convertPixelXYToLngLat
converts a pixel x, y to a latitude and longitude.
modules/maps/hfos/map/TileTools.py
def convertPixelXYToLngLat(self, pixelX, pixelY, level): ''' converts a pixel x, y to a latitude and longitude. ''' mapSize = self.getMapDimensionsByZoomLevel(level) x = (self.clipValue(pixelX, 0, mapSize - 1) / mapSize) - 0.5 y = 0.5 - (self.clipValue(pixelY, 0, mapSize ...
def convertPixelXYToLngLat(self, pixelX, pixelY, level): ''' converts a pixel x, y to a latitude and longitude. ''' mapSize = self.getMapDimensionsByZoomLevel(level) x = (self.clipValue(pixelX, 0, mapSize - 1) / mapSize) - 0.5 y = 0.5 - (self.clipValue(pixelY, 0, mapSize ...
[ "converts", "a", "pixel", "x", "y", "to", "a", "latitude", "and", "longitude", "." ]
Hackerfleet/hfos
python
https://github.com/Hackerfleet/hfos/blob/b6df14eacaffb6be5c844108873ff8763ec7f0c9/modules/maps/hfos/map/TileTools.py#L65-L76
[ "def", "convertPixelXYToLngLat", "(", "self", ",", "pixelX", ",", "pixelY", ",", "level", ")", ":", "mapSize", "=", "self", ".", "getMapDimensionsByZoomLevel", "(", "level", ")", "x", "=", "(", "self", ".", "clipValue", "(", "pixelX", ",", "0", ",", "map...
b6df14eacaffb6be5c844108873ff8763ec7f0c9
train
TileUtils.tileXYZToQuadKey
Computes quadKey value based on tile x, y and z values.
modules/maps/hfos/map/TileTools.py
def tileXYZToQuadKey(self, x, y, z): ''' Computes quadKey value based on tile x, y and z values. ''' quadKey = '' for i in range(z, 0, -1): digit = 0 mask = 1 << (i - 1) if (x & mask) != 0: digit += 1 if (y & mask) !...
def tileXYZToQuadKey(self, x, y, z): ''' Computes quadKey value based on tile x, y and z values. ''' quadKey = '' for i in range(z, 0, -1): digit = 0 mask = 1 << (i - 1) if (x & mask) != 0: digit += 1 if (y & mask) !...
[ "Computes", "quadKey", "value", "based", "on", "tile", "x", "y", "and", "z", "values", "." ]
Hackerfleet/hfos
python
https://github.com/Hackerfleet/hfos/blob/b6df14eacaffb6be5c844108873ff8763ec7f0c9/modules/maps/hfos/map/TileTools.py#L92-L105
[ "def", "tileXYZToQuadKey", "(", "self", ",", "x", ",", "y", ",", "z", ")", ":", "quadKey", "=", "''", "for", "i", "in", "range", "(", "z", ",", "0", ",", "-", "1", ")", ":", "digit", "=", "0", "mask", "=", "1", "<<", "(", "i", "-", "1", "...
b6df14eacaffb6be5c844108873ff8763ec7f0c9
train
TileUtils.quadKeyToTileXYZ
Computes tile x, y and z values based on quadKey.
modules/maps/hfos/map/TileTools.py
def quadKeyToTileXYZ(self, quadKey): ''' Computes tile x, y and z values based on quadKey. ''' tileX = 0 tileY = 0 tileZ = len(quadKey) for i in range(tileZ, 0, -1): mask = 1 << (i - 1) value = quadKey[tileZ - i] if value == '...
def quadKeyToTileXYZ(self, quadKey): ''' Computes tile x, y and z values based on quadKey. ''' tileX = 0 tileY = 0 tileZ = len(quadKey) for i in range(tileZ, 0, -1): mask = 1 << (i - 1) value = quadKey[tileZ - i] if value == '...
[ "Computes", "tile", "x", "y", "and", "z", "values", "based", "on", "quadKey", "." ]
Hackerfleet/hfos
python
https://github.com/Hackerfleet/hfos/blob/b6df14eacaffb6be5c844108873ff8763ec7f0c9/modules/maps/hfos/map/TileTools.py#L107-L135
[ "def", "quadKeyToTileXYZ", "(", "self", ",", "quadKey", ")", ":", "tileX", "=", "0", "tileY", "=", "0", "tileZ", "=", "len", "(", "quadKey", ")", "for", "i", "in", "range", "(", "tileZ", ",", "0", ",", "-", "1", ")", ":", "mask", "=", "1", "<<"...
b6df14eacaffb6be5c844108873ff8763ec7f0c9
train
TileUtils.getTileOrigin
Returns the upper-left hand corner lat/lng for a tile
modules/maps/hfos/map/TileTools.py
def getTileOrigin(self, tileX, tileY, level): ''' Returns the upper-left hand corner lat/lng for a tile ''' pixelX, pixelY = self.convertTileXYToPixelXY(tileX, tileY) lng, lat = self.convertPixelXYToLngLat(pixelX, pixelY, level) return (lat, lng)
def getTileOrigin(self, tileX, tileY, level): ''' Returns the upper-left hand corner lat/lng for a tile ''' pixelX, pixelY = self.convertTileXYToPixelXY(tileX, tileY) lng, lat = self.convertPixelXYToLngLat(pixelX, pixelY, level) return (lat, lng)
[ "Returns", "the", "upper", "-", "left", "hand", "corner", "lat", "/", "lng", "for", "a", "tile" ]
Hackerfleet/hfos
python
https://github.com/Hackerfleet/hfos/blob/b6df14eacaffb6be5c844108873ff8763ec7f0c9/modules/maps/hfos/map/TileTools.py#L141-L147
[ "def", "getTileOrigin", "(", "self", ",", "tileX", ",", "tileY", ",", "level", ")", ":", "pixelX", ",", "pixelY", "=", "self", ".", "convertTileXYToPixelXY", "(", "tileX", ",", "tileY", ")", "lng", ",", "lat", "=", "self", ".", "convertPixelXYToLngLat", ...
b6df14eacaffb6be5c844108873ff8763ec7f0c9
train
TileFinder.getTileUrlsByLatLngExtent
Returns a list of tile urls by extent
modules/maps/hfos/map/TileTools.py
def getTileUrlsByLatLngExtent(self, xmin, ymin, xmax, ymax, level): ''' Returns a list of tile urls by extent ''' # Upper-Left Tile tileXMin, tileYMin = self.tileUtils.convertLngLatToTileXY(xmin, ymax, level) ...
def getTileUrlsByLatLngExtent(self, xmin, ymin, xmax, ymax, level): ''' Returns a list of tile urls by extent ''' # Upper-Left Tile tileXMin, tileYMin = self.tileUtils.convertLngLatToTileXY(xmin, ymax, level) ...
[ "Returns", "a", "list", "of", "tile", "urls", "by", "extent" ]
Hackerfleet/hfos
python
https://github.com/Hackerfleet/hfos/blob/b6df14eacaffb6be5c844108873ff8763ec7f0c9/modules/maps/hfos/map/TileTools.py#L160-L178
[ "def", "getTileUrlsByLatLngExtent", "(", "self", ",", "xmin", ",", "ymin", ",", "xmax", ",", "ymax", ",", "level", ")", ":", "# Upper-Left Tile", "tileXMin", ",", "tileYMin", "=", "self", ".", "tileUtils", ".", "convertLngLatToTileXY", "(", "xmin", ",", "yma...
b6df14eacaffb6be5c844108873ff8763ec7f0c9
train
TileFinder.createTileUrl
returns new tile url based on template
modules/maps/hfos/map/TileTools.py
def createTileUrl(self, x, y, z): ''' returns new tile url based on template ''' return self.tileTemplate.replace('{{x}}', str(x)).replace('{{y}}', str( y)).replace('{{z}}', str(z))
def createTileUrl(self, x, y, z): ''' returns new tile url based on template ''' return self.tileTemplate.replace('{{x}}', str(x)).replace('{{y}}', str( y)).replace('{{z}}', str(z))
[ "returns", "new", "tile", "url", "based", "on", "template" ]
Hackerfleet/hfos
python
https://github.com/Hackerfleet/hfos/blob/b6df14eacaffb6be5c844108873ff8763ec7f0c9/modules/maps/hfos/map/TileTools.py#L180-L185
[ "def", "createTileUrl", "(", "self", ",", "x", ",", "y", ",", "z", ")", ":", "return", "self", ".", "tileTemplate", ".", "replace", "(", "'{{x}}'", ",", "str", "(", "x", ")", ")", ".", "replace", "(", "'{{y}}'", ",", "str", "(", "y", ")", ")", ...
b6df14eacaffb6be5c844108873ff8763ec7f0c9
train
Manager.referenceframe
Handles navigational reference frame updates. These are necessary to assign geo coordinates to alerts and other misc things. :param event with incoming referenceframe message
modules/alert/hfos/alert/manager.py
def referenceframe(self, event): """Handles navigational reference frame updates. These are necessary to assign geo coordinates to alerts and other misc things. :param event with incoming referenceframe message """ self.log("Got a reference frame update! ", event, lvl=e...
def referenceframe(self, event): """Handles navigational reference frame updates. These are necessary to assign geo coordinates to alerts and other misc things. :param event with incoming referenceframe message """ self.log("Got a reference frame update! ", event, lvl=e...
[ "Handles", "navigational", "reference", "frame", "updates", ".", "These", "are", "necessary", "to", "assign", "geo", "coordinates", "to", "alerts", "and", "other", "misc", "things", "." ]
Hackerfleet/hfos
python
https://github.com/Hackerfleet/hfos/blob/b6df14eacaffb6be5c844108873ff8763ec7f0c9/modules/alert/hfos/alert/manager.py#L112-L122
[ "def", "referenceframe", "(", "self", ",", "event", ")", ":", "self", ".", "log", "(", "\"Got a reference frame update! \"", ",", "event", ",", "lvl", "=", "events", ")", "self", ".", "reference_frame", "=", "event", ".", "data" ]
b6df14eacaffb6be5c844108873ff8763ec7f0c9
train
Manager.userlogin
Checks if an alert is ongoing and alerts the newly connected client, if so.
modules/alert/hfos/alert/manager.py
def userlogin(self, event): """Checks if an alert is ongoing and alerts the newly connected client, if so.""" client_uuid = event.clientuuid self.log(event.user, pretty=True, lvl=verbose) self.log('Adding client') self.clients[event.clientuuid] = event.user fo...
def userlogin(self, event): """Checks if an alert is ongoing and alerts the newly connected client, if so.""" client_uuid = event.clientuuid self.log(event.user, pretty=True, lvl=verbose) self.log('Adding client') self.clients[event.clientuuid] = event.user fo...
[ "Checks", "if", "an", "alert", "is", "ongoing", "and", "alerts", "the", "newly", "connected", "client", "if", "so", "." ]
Hackerfleet/hfos
python
https://github.com/Hackerfleet/hfos/blob/b6df14eacaffb6be5c844108873ff8763ec7f0c9/modules/alert/hfos/alert/manager.py#L153-L165
[ "def", "userlogin", "(", "self", ",", "event", ")", ":", "client_uuid", "=", "event", ".", "clientuuid", "self", ".", "log", "(", "event", ".", "user", ",", "pretty", "=", "True", ",", "lvl", "=", "verbose", ")", "self", ".", "log", "(", "'Adding cli...
b6df14eacaffb6be5c844108873ff8763ec7f0c9
train
Manager.trigger
AlertManager event handler for incoming events :param event with incoming AlertManager message
modules/alert/hfos/alert/manager.py
def trigger(self, event): """AlertManager event handler for incoming events :param event with incoming AlertManager message """ topic = event.data.get('topic', None) if topic is None: self.log('No alert topic to trigger', lvl=warn) return alert ...
def trigger(self, event): """AlertManager event handler for incoming events :param event with incoming AlertManager message """ topic = event.data.get('topic', None) if topic is None: self.log('No alert topic to trigger', lvl=warn) return alert ...
[ "AlertManager", "event", "handler", "for", "incoming", "events" ]
Hackerfleet/hfos
python
https://github.com/Hackerfleet/hfos/blob/b6df14eacaffb6be5c844108873ff8763ec7f0c9/modules/alert/hfos/alert/manager.py#L207-L224
[ "def", "trigger", "(", "self", ",", "event", ")", ":", "topic", "=", "event", ".", "data", ".", "get", "(", "'topic'", ",", "None", ")", "if", "topic", "is", "None", ":", "self", ".", "log", "(", "'No alert topic to trigger'", ",", "lvl", "=", "warn"...
b6df14eacaffb6be5c844108873ff8763ec7f0c9
train
Manager.cancel
AlertManager event handler for incoming events :param event with incoming AlertManager message
modules/alert/hfos/alert/manager.py
def cancel(self, event): """AlertManager event handler for incoming events :param event with incoming AlertManager message """ topic = event.data.get('topic', None) if topic is None: self.log('No alert topic to cancel', lvl=warn) return self._can...
def cancel(self, event): """AlertManager event handler for incoming events :param event with incoming AlertManager message """ topic = event.data.get('topic', None) if topic is None: self.log('No alert topic to cancel', lvl=warn) return self._can...
[ "AlertManager", "event", "handler", "for", "incoming", "events" ]
Hackerfleet/hfos
python
https://github.com/Hackerfleet/hfos/blob/b6df14eacaffb6be5c844108873ff8763ec7f0c9/modules/alert/hfos/alert/manager.py#L237-L247
[ "def", "cancel", "(", "self", ",", "event", ")", ":", "topic", "=", "event", ".", "data", ".", "get", "(", "'topic'", ",", "None", ")", "if", "topic", "is", "None", ":", "self", ".", "log", "(", "'No alert topic to cancel'", ",", "lvl", "=", "warn", ...
b6df14eacaffb6be5c844108873ff8763ec7f0c9
train
cli
Isomer Management Tool This tool supports various operations to manage isomer instances. Most of the commands are grouped. To obtain more information about the groups' available sub commands/groups, try iso [group] To display details of a command or its sub groups, try iso [group] [subgroup...
hfos/tool/cli.py
def cli(ctx, instance, quiet, verbose, log_level, dbhost, dbname): """Isomer Management Tool This tool supports various operations to manage isomer instances. Most of the commands are grouped. To obtain more information about the groups' available sub commands/groups, try iso [group] To disp...
def cli(ctx, instance, quiet, verbose, log_level, dbhost, dbname): """Isomer Management Tool This tool supports various operations to manage isomer instances. Most of the commands are grouped. To obtain more information about the groups' available sub commands/groups, try iso [group] To disp...
[ "Isomer", "Management", "Tool" ]
Hackerfleet/hfos
python
https://github.com/Hackerfleet/hfos/blob/b6df14eacaffb6be5c844108873ff8763ec7f0c9/hfos/tool/cli.py#L48-L78
[ "def", "cli", "(", "ctx", ",", "instance", ",", "quiet", ",", "verbose", ",", "log_level", ",", "dbhost", ",", "dbname", ")", ":", "ctx", ".", "obj", "[", "'instance'", "]", "=", "instance", "if", "dbname", "==", "db_default", "and", "instance", "!=", ...
b6df14eacaffb6be5c844108873ff8763ec7f0c9
train
main
Primary entry point for all AstroCats catalogs. From this entry point, all internal catalogs can be accessed and their public methods executed (for example: import scripts).
astrocats/main.py
def main(): """Primary entry point for all AstroCats catalogs. From this entry point, all internal catalogs can be accessed and their public methods executed (for example: import scripts). """ from datetime import datetime # Initialize Command-Line and User-Config Settings, Log # --------...
def main(): """Primary entry point for all AstroCats catalogs. From this entry point, all internal catalogs can be accessed and their public methods executed (for example: import scripts). """ from datetime import datetime # Initialize Command-Line and User-Config Settings, Log # --------...
[ "Primary", "entry", "point", "for", "all", "AstroCats", "catalogs", "." ]
astrocatalogs/astrocats
python
https://github.com/astrocatalogs/astrocats/blob/11abc3131c6366ecd23964369e55ff264add7805/astrocats/main.py#L13-L73
[ "def", "main", "(", ")", ":", "from", "datetime", "import", "datetime", "# Initialize Command-Line and User-Config Settings, Log", "# -----------------------------------------------------", "beg_time", "=", "datetime", ".", "now", "(", ")", "# Process command-line arguments to de...
11abc3131c6366ecd23964369e55ff264add7805
train
setup_user_config
Setup a configuration file in the user's home directory. Currently this method stores default values to a fixed configuration filename. It should be modified to run an interactive prompt session asking for parameters (or at least confirming the default ones). Arguments --------- log : `loggin...
astrocats/main.py
def setup_user_config(log): """Setup a configuration file in the user's home directory. Currently this method stores default values to a fixed configuration filename. It should be modified to run an interactive prompt session asking for parameters (or at least confirming the default ones). Argume...
def setup_user_config(log): """Setup a configuration file in the user's home directory. Currently this method stores default values to a fixed configuration filename. It should be modified to run an interactive prompt session asking for parameters (or at least confirming the default ones). Argume...
[ "Setup", "a", "configuration", "file", "in", "the", "user", "s", "home", "directory", "." ]
astrocatalogs/astrocats
python
https://github.com/astrocatalogs/astrocats/blob/11abc3131c6366ecd23964369e55ff264add7805/astrocats/main.py#L76-L113
[ "def", "setup_user_config", "(", "log", ")", ":", "log", ".", "warning", "(", "\"AstroCats Setup\"", ")", "log", ".", "warning", "(", "\"Configure filepath: '{}'\"", ".", "format", "(", "_CONFIG_PATH", ")", ")", "# Create path to configuration file as needed", "config...
11abc3131c6366ecd23964369e55ff264add7805
train
load_user_config
Load settings from the user's confiuration file, and add them to `args`. Settings are loaded from the configuration file in the user's home directory. Those parameters are added (as attributes) to the `args` object. Arguments --------- args : `argparse.Namespace` Namespace object to w...
astrocats/main.py
def load_user_config(args, log): """Load settings from the user's confiuration file, and add them to `args`. Settings are loaded from the configuration file in the user's home directory. Those parameters are added (as attributes) to the `args` object. Arguments --------- args : `argparse....
def load_user_config(args, log): """Load settings from the user's confiuration file, and add them to `args`. Settings are loaded from the configuration file in the user's home directory. Those parameters are added (as attributes) to the `args` object. Arguments --------- args : `argparse....
[ "Load", "settings", "from", "the", "user", "s", "confiuration", "file", "and", "add", "them", "to", "args", "." ]
astrocatalogs/astrocats
python
https://github.com/astrocatalogs/astrocats/blob/11abc3131c6366ecd23964369e55ff264add7805/astrocats/main.py#L116-L144
[ "def", "load_user_config", "(", "args", ",", "log", ")", ":", "if", "not", "os", ".", "path", ".", "exists", "(", "_CONFIG_PATH", ")", ":", "err_str", "=", "(", "\"Configuration file does not exists ({}).\\n\"", ".", "format", "(", "_CONFIG_PATH", ")", "+", ...
11abc3131c6366ecd23964369e55ff264add7805
train
load_command_line_args
Load and parse command-line arguments. Arguments --------- args : str or None 'Faked' commandline arguments passed to `argparse`. Returns ------- args : `argparse.Namespace` object Namespace in which settings are stored - default values modified by the given command-lin...
astrocats/main.py
def load_command_line_args(clargs=None): """Load and parse command-line arguments. Arguments --------- args : str or None 'Faked' commandline arguments passed to `argparse`. Returns ------- args : `argparse.Namespace` object Namespace in which settings are stored - default ...
def load_command_line_args(clargs=None): """Load and parse command-line arguments. Arguments --------- args : str or None 'Faked' commandline arguments passed to `argparse`. Returns ------- args : `argparse.Namespace` object Namespace in which settings are stored - default ...
[ "Load", "and", "parse", "command", "-", "line", "arguments", "." ]
astrocatalogs/astrocats
python
https://github.com/astrocatalogs/astrocats/blob/11abc3131c6366ecd23964369e55ff264add7805/astrocats/main.py#L147-L259
[ "def", "load_command_line_args", "(", "clargs", "=", "None", ")", ":", "import", "argparse", "git_vers", "=", "get_git", "(", ")", "parser", "=", "argparse", ".", "ArgumentParser", "(", "prog", "=", "'astrocats'", ",", "description", "=", "'Generate catalogs for...
11abc3131c6366ecd23964369e55ff264add7805
train
load_log
Load a `logging.Logger` object. Arguments --------- args : `argparse.Namespace` object Namespace containing required settings: {`args.debug`, `args.verbose`, and `args.log_filename`}. Returns ------- log : `logging.Logger` object
astrocats/main.py
def load_log(args): """Load a `logging.Logger` object. Arguments --------- args : `argparse.Namespace` object Namespace containing required settings: {`args.debug`, `args.verbose`, and `args.log_filename`}. Returns ------- log : `logging.Logger` object """ from ast...
def load_log(args): """Load a `logging.Logger` object. Arguments --------- args : `argparse.Namespace` object Namespace containing required settings: {`args.debug`, `args.verbose`, and `args.log_filename`}. Returns ------- log : `logging.Logger` object """ from ast...
[ "Load", "a", "logging", ".", "Logger", "object", "." ]
astrocatalogs/astrocats
python
https://github.com/astrocatalogs/astrocats/blob/11abc3131c6366ecd23964369e55ff264add7805/astrocats/main.py#L262-L290
[ "def", "load_log", "(", "args", ")", ":", "from", "astrocats", ".", "catalog", ".", "utils", "import", "logger", "# Determine verbosity ('None' means use default)", "log_stream_level", "=", "None", "if", "args", ".", "debug", ":", "log_stream_level", "=", "logger", ...
11abc3131c6366ecd23964369e55ff264add7805
train
compare_dicts
Function compares dictionaries by key-value recursively. Old and new input data are both dictionaries
compare.py
def compare_dicts(old_full, new_full, old_data, new_data, depth=0): """Function compares dictionaries by key-value recursively. Old and new input data are both dictionaries """ depth = depth + 1 indent = " "*depth # Print with an indentation matching the nested-dictionary depth def my_pri...
def compare_dicts(old_full, new_full, old_data, new_data, depth=0): """Function compares dictionaries by key-value recursively. Old and new input data are both dictionaries """ depth = depth + 1 indent = " "*depth # Print with an indentation matching the nested-dictionary depth def my_pri...
[ "Function", "compares", "dictionaries", "by", "key", "-", "value", "recursively", "." ]
astrocatalogs/astrocats
python
https://github.com/astrocatalogs/astrocats/blob/11abc3131c6366ecd23964369e55ff264add7805/compare.py#L99-L179
[ "def", "compare_dicts", "(", "old_full", ",", "new_full", ",", "old_data", ",", "new_data", ",", "depth", "=", "0", ")", ":", "depth", "=", "depth", "+", "1", "indent", "=", "\" \"", "*", "depth", "# Print with an indentation matching the nested-dictionary depth"...
11abc3131c6366ecd23964369e55ff264add7805
train
cohensutherland
Clips a line to a rectangular area. This implements the Cohen-Sutherland line clipping algorithm. xmin, ymax, xmax and ymin denote the clipping area, into which the line defined by x1, y1 (start point) and x2, y2 (end point) will be clipped. If the line does not intersect with the rectangular cli...
morecvutils/lineClipping.py
def cohensutherland(xmin, ymax, xmax, ymin, x1, y1, x2, y2): """Clips a line to a rectangular area. This implements the Cohen-Sutherland line clipping algorithm. xmin, ymax, xmax and ymin denote the clipping area, into which the line defined by x1, y1 (start point) and x2, y2 (end point) will be c...
def cohensutherland(xmin, ymax, xmax, ymin, x1, y1, x2, y2): """Clips a line to a rectangular area. This implements the Cohen-Sutherland line clipping algorithm. xmin, ymax, xmax and ymin denote the clipping area, into which the line defined by x1, y1 (start point) and x2, y2 (end point) will be c...
[ "Clips", "a", "line", "to", "a", "rectangular", "area", "." ]
scivision/morecvutils
python
https://github.com/scivision/morecvutils/blob/03cd40ec9f4d577a6bc796185c3bec4a576c4d16/morecvutils/lineClipping.py#L16-L87
[ "def", "cohensutherland", "(", "xmin", ",", "ymax", ",", "xmax", ",", "ymin", ",", "x1", ",", "y1", ",", "x2", ",", "y2", ")", ":", "INSIDE", ",", "LEFT", ",", "RIGHT", ",", "LOWER", ",", "UPPER", "=", "0", ",", "1", ",", "2", ",", "4", ",", ...
03cd40ec9f4d577a6bc796185c3bec4a576c4d16