dynamake package¶
Subpackages¶
Submodules¶
dynamake.application module¶
Utilities for configurable applications.
-
class
dynamake.application.
Env
(default_value: Any)¶ Bases:
object
Marker for default for environment parameters.
-
__init__
(default_value: Any) → None¶ Optionally provide a default value for the parameter.
-
value
= None¶ The default value for the parameter.
-
-
class
dynamake.application.
Func
(wrapped: Callable, *, is_top: bool, is_random: bool, is_parallel: bool)¶ Bases:
object
Data collected for a configurable function.
-
__init__
(wrapped: Callable, *, is_top: bool, is_random: bool, is_parallel: bool) → None¶ Register a configurable function.
-
by_name
= {}¶ The current known functions.
-
static
collect
(wrapped: Callable, *, is_top: bool, is_random: bool, is_parallel: bool) → dynamake.application.Func¶ Collect a configurable function.
-
collect_indirect_invocations
= True¶ Whether to collect indirect invocations and parameters.
This is useful in normal applications, allowing to generate a proper help message for each command (top level function).
This does not make sense when we run a make-like program, where there is no easy way to tell which function invokes which other function (as this depends on the file name patterns).
-
direct_parameter_names
= None¶ The list of parameter names the function (directly) configures.
-
static
finalize
() → None¶ Finalize the per-function data once all functions have been collected.
This conservatively assumes that every mention of a configurable function name inside another configurable function means an invocation. It tries to do better by ignoring names that are assigned to (that is, are probably just local variable names). This isn’t 100% safe but seems to work well for simple code.
-
has_required_arguments
= None¶ Whether the function has non-configurable arguments.
-
indirect_parameter_names
= None¶ The set of parameter names the function (indirectly) depends on. This starts identical to the direct parameter names and is later expanded to include the names of indirectly invoked functions.
-
invocation_kwargs
(*args, **kwargs) → Dict[str, Any]¶ Return the complete named arguments for an invocation based on the configuration parameter values.
-
invoked_function_names
= None¶ The set of other configurable functions it invokes. This starts by collecting all potential invoked names, and is later filtered to only include configurable function names.
-
invoker_function_names
= None¶ The set of other configurable functions that invoke it. This starts empty and is later filled.
-
is_disabled
= False¶ If true, do not really collect functions (e.g., when importing all of a package modules for generating documentation).
By default is
True
unless the environment variableDYNAMAKE_DISABLE
exists.
-
is_parallel
= None¶ Whether this function uses multiple processors.
-
is_random
= None¶ Whether this function uses random numbers.
-
is_top
= None¶ Whether this is a top-level function.
-
name
= None¶ The name used to locate the function.
-
names_by_parameter
= {}¶ The name the functions that use each configurable parameter.
-
parameter_defaults
= None¶ The override for the parameter defaults.
-
parameter_names
= None¶ The ordered parameter names.
-
static
reset
() → None¶ Reset all the current state, for tests.
-
static
top_functions
() → List[str]¶ Return the list of top-level configurable functions.
-
wrapped
= None¶ The wrapped real function that will do the work.
-
wrapper
= None¶ The wrapper we place around the real function.
-
-
class
dynamake.application.
NamesCollector
¶ Bases:
ast.NodeVisitor
Collect all the names of potential invocations from an AST.
-
__init__
() → None¶ Create an empty collector.
-
names
() → Set[str]¶ Return the collected potential invocation names.
-
visit_Name
(node: _ast.Name) → None¶ Collect any identifier which might potentially be an invoked function name.
-
-
class
dynamake.application.
Parallel
¶ Bases:
object
Invoke a function in parallel, efficiently.
Pool.map
insists on pickling and sending all the invocation arguments. This is bad for two reasons:- It is inefficient. The forked process(es) already have these objects, since the fork happened after the list of arguments was created.
- It is restrictive. You can’t simply work around it by giving
Pool.map
alambda
that just takes an index and uses it to access whatever-you-want, because pickling thislambda
fails (mercifully; otherwise it would need to pickle all the data captured by the lambda, which would defeat the purpose).
This class is a workaround. It stashes all the arguments in a global array (yikes), which is created before the processes are forked, and then just lets each parallel invocation access this array to obtain its arguments.
Sigh.
-
static
reset
() → None¶ Reset all the current state, for tests.
-
class
dynamake.application.
Param
(*, name: str, default: Any, parser: Callable[str, Any], description: str, short: Optional[str] = None, group: Optional[str] = None, order: Optional[int] = None, metavar: Optional[str] = None)¶ Bases:
object
Describe a configurable parameter used by one or more computation function.
-
BUILTIN
= ['log_level', 'log_context', 'jobs', 'random_seed']¶ The name of the predefines parameters.
-
__init__
(*, name: str, default: Any, parser: Callable[str, Any], description: str, short: Optional[str] = None, group: Optional[str] = None, order: Optional[int] = None, metavar: Optional[str] = None) → None¶ Create and register a parameter description.
-
default
= None¶ The value to use if the parameter is not explicitly configured.
-
description
= None¶ A description of the parameter for help messages.
-
group
= None¶ Optional group of parameters (for generating a help message).
If the group is global options, the parameter will be listed in this group instead of being associated with specific function(s).
-
metavar
= None¶ Optional name of the command line parameter value (
metavar
inargparse
).
-
name
= None¶ The unique name of the parameter.
-
order
= None¶ Optional order of parameter (in help message)
-
parser
= None¶ How to parse the parameter value from a string (command line argument).
-
short
= None¶ The unique short name of the parameter.
-
-
class
dynamake.application.
Prog
¶ Bases:
object
Hold all the configurable parameters for a program execution.
-
DEFAULT_CONFIG
= None¶ The default configuration to load, if any.
-
DEFAULT_MODULE
= 'DynaMods'¶ The default module to load.
-
TRACE
= 15¶ The log level for tracing calls.
-
static
add_commands_to_parser
(parser: argparse.ArgumentParser, functions: Optional[List[str]] = None) → None¶ Add a command argument each top-level function.
If a list of functions is provided, it is used instead of the automatic list of top-level functions (annotated with
@config(top=True)
). For each such command argument, add a sub-parser with the parameters relevant for the specific function.
-
static
add_global_parameters
(parser: argparse.ArgumentParser) → argparse._ArgumentGroup¶ Add the parameters that are not tied to specific functions.
-
static
add_parameter
(parameter: dynamake.application.Param) → None¶ Add a parameter to the program.
This is invoked automatically when a
dynamake.application.Param
object is created.
-
static
add_parameters_to_parser
(parser: argparse.ArgumentParser, functions: Optional[List[str]] = None) → None¶ Add a command line flag for each parameter to the parser to allow overriding parameter values directly from the command line.
If a list of functions is provided, it is used instead of the automatic list of top-level functions (annotated with
@config(top=True)
).
-
static
add_sorted_parameters
(parser: argparse.ArgumentParser, *, predicate: Optional[Callable[str, bool]] = None, extra_help: Optional[Callable[str, str]] = None) → None¶ Add the parameters of the functions that satify the predicate (if any), allowing for additional help string for each one.
-
static
call_with_args
(args: argparse.Namespace) → Any¶ If a command function was specified on the command line, invoke it with the current parameters.
-
explicit_parameters
= set()¶ The names of the explicitly set parameters.
-
static
get_parameter
(name: str) → Any¶ Access the value of some parameter.
-
static
load_config
(path: str) → None¶ Load a configuration file.
-
static
load_modules
() → None¶ Load all the modules specified by command line options.
This needs to be done before we set up the command line options parser, because the options depend on the loaded modules. Catch-22. This therefore employs a brutish option detection which may not be 100% correct.
-
logger
= <Logger prog (WARNING)>¶ A configured logger for the program.
-
on_parallel_calls
= []¶ Function(s) to invoke before any parallel function call, to setup global state (e.g., random number generation).
-
parameter_values
= {'log_context': None, 'log_level': 'WARN'}¶ The value for each parameter.
-
parameters
= {'log_context': <dynamake.application.Param object at 0x7f9e0d0afc18>, 'log_level': <dynamake.application.Param object at 0x7f9e0d0afbe0>}¶ The known parameters.
-
static
parse_args
(args: argparse.Namespace) → None¶ Update the values based on loaded configuration files and/or explicit command line flags.
-
static
reset
() → None¶ Reset all the current state, for tests.
-
static
verify
() → None¶ Verify the collection of parameters.
-
-
dynamake.application.
config
(*, random: bool = False, parallel: bool = False, top: bool = False) → Callable[Callable, Callable]¶ Decorator for configurable functions.
If
top
isTrue
, this is a top-level function that can be directly invoked from the main function.If
random
isTrue
, the code uses random numbers. This activates the implicitrandom_seed
parameter.If
parallel
isTrue
, the codes invokes thedynamake.application.parallel()
function to use multiple processors. This activates the implicitjobs
parameter.
-
dynamake.application.
env
(default_value: Any) → Any¶ Used as a default value for environment parameters.
When a step uses this as a default value for a parameter, and an invocation does not specify an explicit or a configuration value for the parameter, then the value will be taken from the nearest parent which has a parameter with the same name.
If a default value is provided, then it is used if no value is available from either the command line or the invocation.
-
dynamake.application.
main
(parser: argparse.ArgumentParser, functions: Optional[List[str]] = None, *, adapter: Optional[Callable[argparse.Namespace, None]] = None) → None¶ A generic
main
function for configurable functions.The optional
adapter
may perform additional adaptation of the execution environment based on the parsed command-line arguments before the actual function(s) are invoked.
-
dynamake.application.
override
(**values) → Iterator[None]¶ Override configuration parameters for some nested calls.
Writing:
with override(foo=value): x = some_wrapped_function(...)
Will execute all the configurable computations in
some_wrapped_function
as if the parameterfoo
was configured to have the specifiedvalue
.
-
dynamake.application.
parallel
(invocations: int, function: Callable, *fixed_args, kwargs: Optional[Callable[int, Dict[str, Any]]] = None, overrides: Optional[Callable[int, Dict[str, Any]]] = None, **fixed_kwargs) → List[Any]¶ Invoke a function in parallel.
Parameters: - invocations – The number of function invocations needed.
- fixed_args – Positional arguments for the function, that do not depend on the invocation index.
- kwargs – An optional
lambda
taking the invocation index and returning a dictionary of keyword arguments which do depend on the index. - overrides – An optional
lambda
taking the invocation index and returning a dictionary of parameter values. Each invocation will be executed under andynamake.application.override()
using these values. - fixed_kwargs – Other named arguments for the function, that do not depend on the invocation index.
Returns: The list of results from all the function invocations, in order.
Return type: List[Any]
-
dynamake.application.
processes_for
(tasks: int) → int¶ Return the number of parallel processes for the tasks in the current context.
This is restricted by the
--jobs
command line option, and is further reduced to one when nested inside a parallel call. A proper work-stealing scheduler would do much better (ideally, across multiple application invocations on the same machine).If
tasks
is zero, returns the maximal number of processes (zero for unlimited).
-
dynamake.application.
reset_application
() → None¶ Reset all the current state, for tests.
-
dynamake.application.
serial
(*args, **kwargs) → List[Any]¶ Identical to
dynamake.application.parallal()
except that runs the invocations in serial.This is useful when one wants to temporarily convert a parallel call to a serial call, for debugging.
dynamake.config module¶
Manage per-step configurations.
-
class
dynamake.config.
Config
¶ Bases:
object
Global configuration class.
-
static
load
(path: str) → None¶ Load a YAML configuration file into
dynamake.config.Config.rules
.The rules from the loaded files will override any values specified by previously loaded rules. In general, the last matching rule wins.
The configuration YAML file should be empty, or contain a top-level sequence. Each entry must be a mapping with two keys:
when
andthen
. Thethen
value should be a mapping from parameter names to their values. Thewhen
value should be a mapping of conditions.The condition key can be either a parameter name, or
lambda parameter_name, ...
. If the key starts withlambda
, the value should be a string containing a python boolean expression, which will be evaluated using the specified parameters.Otherwise, the condition value should be one of:
- The exact value of the parameter.
- A
!r regexp-pattern
or a!g glob-pattern
to match the (string) parameter value against. While general regular expressions are more powerful, glob patterns are simpler and more familiar to most people, as they are used by the shell. - A list of alternative values or patterns to match the parameter value against.
A rule is applicable to a step invocation if all the conditions in its
when
mapping match the parameters used in the invocation.Two additional parameters are also added for the purpose of the matching:
step
contains the step function name, and the callstack
contains the path of step names/top/.../step
. This uses/
to separate the step names to allow matching it against a glob pattern, as if it was a file path. Conditions on these parameters are evaluated first, and if they reject the invocation, no other condition is evaluated.It is normally an error for the rest of the conditions to specify a parameter which is not one of the arguments of the invoked step function. However, if the condition key ends with
?
, then the condition will silently reject the step instead. This allows specifying rules that provide defaults without worrying about applying the rule to the exact list of steps that use it.Default rules are very useful when used responsibly. However, they have two important downsides:
- Modifying the values in such default rules will trigger the re-computation of all the action steps that match them, even if they do not actually depend on the provided values.
- Default rules silently ignore typos in parameter names.
It is pretty annoying to modify the configuration file, to adjust some parameter, re-execute the full computation, wait a few hours, and then discover this was wasted effort because you wrote
foo: 1
instead offoos: 1
in the default rule.It is therefore recommended to minimize the use of default rules, and when they are used, to restrict them to match as few steps as possible, typically by matching against the steps call
stack
.
-
static
reset
() → None¶ Reset all the current state, for tests.
-
rules
= []¶ All the known configuration rules (including for per-rule parameters).
-
static
values_for_context
(context: Dict[str, Any]) → Dict[str, Any]¶ Return the configuration values for a specific step invocation.
-
static
-
class
dynamake.config.
Rule
(path: str, index: int, when: Dict[str, Any], then: Dict[str, Any])¶ Bases:
object
A single configuration rule.
-
__init__
(path: str, index: int, when: Dict[str, Any], then: Dict[str, Any]) → None¶ Create a configuration rule.
-
index
= None¶ The index of this rule in the file.
-
is_match
(context: Dict[str, Any]) → bool¶ Whether the rule is a match for a step invocation.
-
static
load
(path: str) → List[dynamake.config.Rule]¶ Load configuration rules from a YAML file.
-
path
= None¶ The path of the file this was loaded from.
-
then
= None¶ The parameter values provided by the rule.
-
when
= None¶ The conditions for when to apply the rule.
-
dynamake.make module¶
Utilities for dynamic make.
-
class
dynamake.make.
Invocation
(step: Optional[dynamake.make.Step], **kwargs)¶ Bases:
object
An active invocation of a build step.
-
__init__
(step: Optional[dynamake.make.Step], **kwargs) → None¶ Track the invocation of an async step.
-
abandoned_output
= None¶ A path for some missing old built output file, if any.
-
abort
(reason: str) → None¶ Abort the invocation for some reason.
-
actions_count
= 0¶ A running counter of the executed actions.
-
active
= {}¶ The active invocations.
-
async_actions
= None¶ The queued async actions for creating the input files.
-
built_outputs
= None¶ The built outputs, if any.
-
collect_final_outputs
() → None¶ Ensure that all the (required) outputs were actually created and are newer than all input files specified so far.
If successful, this marks all the outputs as up-to-date so that steps that depend on them will immediately proceed.
-
collect_initial_outputs
() → None¶ Check which of the outputs already exist and what their modification times are, to be able to decide whether actions need to be run to create or update them.
-
computed_configuration
= None¶ Whether we computed the configuration.
-
condition
= None¶ A condition variable to wait on for this invocation.
-
config_context
= None¶ Context for local control over configuration parameters.
-
config_file
() → Optional[str]¶ Use the step-specific configuration file in the following step action(s).
-
config_param
(name: str, default: Any = None, *, keep_in_file: bool = False, is_required: bool = False) → Any¶ Access the value of a parameter from the step-specific configuration.
If
keep_in_file
isFalse
, then the parameter will be removed from the generated persistent configuration file (if any). This ensures that when changing parameters that only affect the internals of the build step, the resulting actions will not be triggered unless they actually changed as well.
-
config_path
= None¶ The path to the persistent configuration file, if it is used.
-
current
= <dynamake.make.Invocation object>¶ The current invocation.
-
did_run_actions
= None¶ Whether we actually run any actions.
-
did_skip_actions
= None¶ Whether we actually skipped all actions so far.
-
different_actions
(old_action: dynamake.make.PersistentAction, new_action: dynamake.make.PersistentAction) → bool¶ Check whether the new action is different from the last build action.
-
different_required
(old_required: Dict[str, dynamake.make.UpToDate], new_required: Dict[str, dynamake.make.UpToDate]) → bool¶ Check whether the required inputs of the new action are different from the required inputs of the last build action.
-
done
(awaitable: Awaitable) → Any¶ Await some non-DynaMake function.
-
exception
= None¶ The reason to abort this invocation, if any.
-
file_config_values
= None¶ The persistent configuration for the step.
-
full_config_values
= None¶ The full configuration for the step.
-
initial_outputs
= None¶ The output files that existed prior to the invocation.
-
kwargs
= None¶ The arguments to the invocation.
-
log_and_abort
(reason: str) → None¶ Abort the invocation for some reason.
-
missing_output
= None¶ A pattern for some missing output file(s), if any.
-
must_run_action
= None¶ Whether we already decided to run actions.
-
name
= None¶ The full name (including parameters) of the invocation.
-
new_persistent_actions
= None¶ The new persistent actions (from the code) for ensuring rebuild when actions change.
-
newest_input_mtime_ns
= None¶ The modification time of the newest input file, if any.
-
newest_input_path
= None¶ The newest input file, if any.
-
old_persistent_actions
= None¶ The old persistent actions (from the disk) for ensuring rebuild when actions change.
-
old_persistent_outputs
= None¶ The old list of outputs (from the disk) for ensuring complete dynamic outputs.
-
oldest_output_mtime_ns
= None¶ The modification time of the oldest existing output path.
-
oldest_output_path
= None¶ The oldest existing output file path, or None if some output files are missing.
-
parent
= None¶ The parent invocation, if any.
-
phony
= set()¶ The paths for phony targets.
-
phony_outputs
= None¶ The phony outputs, if any.
-
poison_all_outputs
() → None¶ Mark all outputs as poisoned for a failed step.
Typically also removes them.
-
poisoned
= set()¶ The files that failed to build and must not be used by other steps.
-
producer_of
(path: str) → Tuple[Optional[dynamake.make.Step], Optional[Dict[str, Any]]]¶ Find the unique step, if any, that produces the file.
Also returns the keyword arguments needed to invoke the step function (deduced from the path).
-
read_old_persistent_actions
() → None¶ Read the old persistent data from the disk file.
These describe the last successful build of the outputs.
-
remove_old_persistent_data
() → None¶ Remove the persistent data from the disk in case the build failed.
-
remove_output
(path: str) → None¶ Remove an output file, and possibly the directories that became empty as a result.
-
remove_stale_outputs
() → None¶ Delete stale outputs before running a action.
This is only done before running the first action of a step.
-
require
(path: str) → None¶ Require a file to be up-to-date before executing any actions or completing the current invocation.
-
require_context
= None¶ Context for nested control over configuration parameters.
-
required
= None¶ The required input targets (phony or files) the invocations depends on.
-
static
reset
() → None¶ Reset all the current state, for tests.
-
run
() → Optional[BaseException]¶ Actually run the invocation.
-
run_action
(kind: str, runner: Callable, *command, **resources) → None¶ Spawn a action to actually create some files.
-
should_remove_stale_outputs
= None¶ Whether we should remove stale outputs before running the next action.
-
should_run_action
() → bool¶ Test whether all (required) outputs already exist, and are newer than all input files specified so far.
-
skipped_count
= 0¶ A running counter of the skipped actions.
-
stack
= None¶ A short unique stack to identify invocations in the log.
-
step
= None¶ The step being invoked.
-
sub_count
= None¶ How many sub-invocations were created so far.
-
sync
() → Optional[BaseException]¶ Wait until all the async actions queued so far are complete.
This is implicitly called before running a action.
-
top
= <dynamake.make.Invocation object>¶ The top-level invocation.
-
up_to_date
= {}¶ The origin and time of targets that were built or otherwise proved to be up-to-date so far.
-
used_config_params
= None¶ The configuration value(s) that were used by the step (so far).
-
wait_for
(active: dynamake.make.Invocation) → Optional[BaseException]¶ Wait until the invocation is done.
This is used by other invocations that use this invocation’s output(s) as their input(s).
-
write_new_persistent_actions
() → None¶ Write the new persistent data into the disk file.
This is only done on a successful build.
-
-
class
dynamake.make.
Make
¶ Bases:
object
Global build configuration and state.
-
DEFAULT_STEP_CONFIG
= 'DynaMake.yaml'¶ The default steps configuration to load.
-
PERSISTENT_DIRECTORY
= '.dynamake'¶ The directory to keep persistent state in.
-
WHY
= 17¶ The log level for logging the reasons for action execution.
-
failure_aborts_build
= True¶ Whether to stop the script if any action fails (by default,
True
).If this is
False
, then the build will continue to execute unrelated actions. In all cases, actions that have already been submitted will be allowed to end normally.
-
log_skipped_actions
= False¶ Whether to log (level INFO) skipped actions (by default,
False
).
-
nfs_outputs_timeout
= 60¶ The amount of time to wait for slow NFS outputs (by default, 60 seconds, which is the default timeout of the NFS client cache).
-
rebuild_changed_actions
= True¶ Whether to rebuild outputs if the actions have changed (by default,
True
).
-
remove_empty_directories
= False¶ Whether to (try to) remove empty directories when deleting the last file in them (by default,
False
).
-
remove_failed_outputs
= True¶ Whether to remove output files on a failing action (by default,
True
).It is possible to override this on a per-action basis.
-
remove_stale_outputs
= True¶ Whether to remove old output files before executing an action (by default,
True
).It is possible to override this on a per-action basis.
-
static
reset
() → None¶ Reset all the current state, for tests.
-
touch_success_outputs
= True¶ Whether to touch output files on a successful action to ensure they are newer than the input file(s) (by default,
False
).In these modern times, this is mostly unneeded as we use the nanosecond modification time, which pretty much guarantees that output files will be newer than input files. In the “bad old days”, files created within a second of each other had the same modification time.
This might still be needed if an output is a directory (not a file) and
dynamake.make.Make.remove_stale_outputs
isFalse
, since otherwise themtime
of an existing directory will not necessarily be updated to reflect the fact the action was executed. In general it is not advised to depend on themtime
of directories; it is better to specify a glob matching the expected files inside them, or use an explicit timestamp file.
-
wait_nfs_outputs
= False¶ Whether to wait before assuming an output file does not exist (by default,
False
).This may be required if the output file(s) are on an NFS-mounted partition, and the NFS client is caching stat results (the default behavior, since otherwise performance would be horrible).
Setting the NFS mount flags to include lookupcache=positive will force the client to avoid caching a “file not found” stat result, thereby ensuring that if we detect a missing output file, it really is missing. This has minimal impact on performance (since, most of the time, stat calls are for existing files).
If you can’t tweak the NFS mount flags, set wait_nfs_outputs; this will cause us to wait up to 60 seconds (the default NFS stat cache time) before pronouncing that the output file really is missing.
-
-
class
dynamake.make.
PersistentAction
(previous: Optional[PersistentAction] = None)¶ Bases:
object
An action taken during step execution.
We can persist this to ensure the actions taken in a future invocation is identical, to trigger rebuild if the list of actions changes.
-
__init__
(previous: Optional[PersistentAction] = None) → None¶ Initialize self. See help(type(self)) for accurate signature.
-
command
= None¶ The executed command.
-
done_action
() → None¶ Record the end time of the command.
-
end
= None¶ The time the command ended execution.
-
static
from_data
(data: List[Dict[str, Any]]) → List[dynamake.make.PersistentAction]¶ Construct the data from loaded YAML.
-
into_data
() → List[Dict[str, Any]]¶ Serialize for dumping to YAML.
-
is_empty
() → bool¶ Whether this action has any additional information over its predecessor.
-
previous
= None¶ The previous action of the step, if any.
-
require
(path: str, up_to_date: dynamake.make.UpToDate) → None¶ Add a required input to the action.
-
required
= None¶ The up-to-date data for each input.
-
run_action
(command: List[str]) → None¶ Set the executed command of the action.
-
start
= None¶ The time the command started execution.
-
-
class
dynamake.make.
Resources
¶ Bases:
object
Restrict parallelism using some resources.
-
available
= {'jobs': 56}¶ The unused amount of each resource.
-
condition
= <asyncio.locks.Condition object at 0x7f9e0cd6ae48 [unlocked]>¶ A condition for synchronizing between the asynchronous actions.
-
default
= {'jobs': 1}¶ The default amount used by each action.
-
static
effective
(requested: Dict[str, int]) → Dict[str, int]¶ Return the effective resource amounts given the explicitly requested amounts.
-
static
free
(amounts: Dict[str, int]) → None¶ Release ownership of some resource amounts.
-
static
grab
(amounts: Dict[str, int]) → None¶ Take ownership of some resource amounts.
-
static
have
(amounts: Dict[str, int]) → bool¶ Return whether there are available resource to cover the requested amounts.
-
static
reset
() → None¶ Reset all the current state, for tests.
-
total
= {'jobs': 56}¶ The total amount of each resource.
-
static
use
(**amounts) → Dict[str, int]¶ Wait for and grab some resource amounts.
Returns the actual used resource amounts. If a resource is not explicitly given an amount, the default used amount from the
dynamake.make.resource_parameters()
declaration is used.The caller is responsible for invoking
dynamake.make.Resources.free()
to release the actual used resources.
-
-
exception
dynamake.make.
RestartException
¶ Bases:
Exception
Indicates a step needs to be re-run, this time executing all actions.
-
class
dynamake.make.
Step
(func: dynamake.application.Func, output: Union[None, str, Sequence[str], Sequence[Sequence[str]], Sequence[Sequence[Sequence[str]]], Sequence[Sequence[Sequence[Sequence[str]]]]])¶ Bases:
object
A build step.
-
__init__
(func: dynamake.application.Func, output: Union[None, str, Sequence[str], Sequence[Sequence[str]], Sequence[Sequence[Sequence[str]]], Sequence[Sequence[Sequence[Sequence[str]]]]]) → None¶ Register a build step function.
-
by_name
= {}¶ The current known steps.
-
by_regexp
= []¶ The step for building any output capture pattern.
-
static
collect
(wrapped: Callable, output: Union[None, str, Sequence[str], Sequence[Sequence[str]], Sequence[Sequence[Sequence[str]]], Sequence[Sequence[Sequence[Sequence[str]]]]]) → dynamake.make.Step¶ Collect a build step function.
-
func
= None¶ The configured function that implements the step.
-
name
() → str¶ The name of the function implementing the step.
-
output
= None¶ The outputs generated by the step.
-
static
reset
() → None¶ Reset all the current state, for tests.
-
-
exception
dynamake.make.
StepException
¶ Bases:
Exception
Indicates a step has aborted and its output must not be used by other steps.
-
class
dynamake.make.
UpToDate
(producer: str, mtime_ns: int = 0)¶ Bases:
object
Data for each up-to-date target.
-
__init__
(producer: str, mtime_ns: int = 0) → None¶ Record a new up-to-date target.
-
static
from_data
(data: Dict[str, str]) → dynamake.make.UpToDate¶ Load from YAML data.
-
into_data
() → Dict[str, Any]¶ Serialize for dumping to YAML.
-
mtime_ns
= None¶ The modified time of the target (in nanoseconds).
This is negative until we know the correct time.
-
producer
= None¶ The step (with parameters) that updated the target.
-
-
dynamake.make.
config_context
(**values) → Iterator[None]¶ Provide additional context information for computing configuration parameters.
Writing:
with config_context(foo=value): bar = config_param('baz') call(...)
Will (re)compute the configuration parameters, taking into account the specified context parameters. The configuration parameters can be queried as usual:
- when: { foo: value } then: { ... }
However, this will fail when trying to match steps when
foo
does not appear in the context. Avoid this by further restricting thewhen
clause, either by adding astep
constraint, or by testing thatfoo
does appear in the context:- when: { context_contains: foo, foo: value } then: { ... }
Note
The path of the
dynamake.make.config_file()
is not affected by the context, even though the content of the file is affected. Therefore, do not invokeconfig_file
both inside and outside aconfig_context
block in the same step.Similarly, the contexts of steps invoked to build required input file(s) are not affected by the
config_context
. It only affects the current step.
-
dynamake.make.
config_file
() → Optional[str]¶ Use the step-specific configuration file in the following step action(s).
-
dynamake.make.
config_param
(name: str, default: Any = None, *, keep_in_file: bool = False, is_required: bool = False) → Any¶ Access the value of a parameter from the step-specific configuration.
-
dynamake.make.
done
(awaitable: Awaitable) → Any¶ Await some non-DynaMake function.
-
dynamake.make.
e
(*strings) → Any¶ Similar to
dynamake.patterns.fmt()
but automatically uses the named arguments of the current step.That is,
dm.e(...)
is the same asdm.fmt(dm.step_kwargs(), ...)
.
-
dynamake.make.
eglob_capture
(*patterns) → dynamake.patterns.Captured¶ Similar to
dynamake.patterns.glob_capture()
but automatically uses the named arguments of the current step.That is,
dm.eglob_capture(...)
is the same asdm.glob_capture(*fmt_capture(dm.step_kwargs(), ...))
.
-
dynamake.make.
eglob_extract
(*patterns) → List[Dict[str, Any]]¶ Similar to
dynamake.patterns.glob_extract()
but automatically uses the named arguments of the current step.That is,
dm.eglob_extract(...)
is the same asdm.glob_extract(fmt_capture(dm.step_kwargs(), ...))
.
-
dynamake.make.
eglob_fmt
(pattern: str, *patterns) → List[str]¶ Similar to
dynamake.patterns.glob_fmt()
but automatically uses the named arguments of the current step.That is,
dm.eglob_fmt(...)
is the same asdm.glob_fmt(fmt_capture(dm.step_kwargs(), ...))
.
-
dynamake.make.
eglob_paths
(*patterns) → List[str]¶ Similar to
dynamake.patterns.glob_paths()
but automatically uses the named arguments of the current step.That is,
dm.eglob_paths(...)
is the same asdm.glob_paths*fmt_capture(dm.step_kwargs(), ...))
.
-
dynamake.make.
erequire
(*templates) → None¶ Similar to
dynamake.make.require()
, but firstdynamake.make.e()
-xpands each parameter.That is,
erequire(...)
is the same asrequire(e(...))
.
-
dynamake.make.
eshell
(*templates, **resources) → None¶ Similar to
dynamake.make.shell()
, but firstdynamake.make.e()
-xpands each parameter.That is,
eshell(...)
is the same asshell(e(...))
.
-
dynamake.make.
espawn
(*templates, **resources) → None¶ Similar to
dynamake.make.spawn()
, but firstdynamake.make.e()
-xpands each parameter.That is,
espawn(...)
is the same asspawn(e(...))
.
-
dynamake.make.
esubmit
(*templates, **resources) → None¶ Similar to
dynamake.make.submit()
, but firstdynamake.make.e()
-xpands each parameter.That is,
esubmit(...)
is the same assubmit(e(...))
.
-
dynamake.make.
log_prefix
() → str¶ The prefix for log messages.
-
dynamake.make.
make
(parser: argparse.ArgumentParser, *, default_targets: Union[None, str, Sequence[str], Sequence[Sequence[str]], Sequence[Sequence[Sequence[str]]], Sequence[Sequence[Sequence[Sequence[str]]]]] = 'all', logger_name: Optional[str] = None, adapter: Optional[Callable[argparse.Namespace, None]] = None) → None¶ A generic
main
function forDynaMake
.The optional
adapter
may perform additional adaptation of the execution environment based on the parsed command-line arguments before the actual function(s) are invoked.
-
dynamake.make.
require
(*paths) → None¶ Require an input file for the step.
This queues an async build of the input file using the appropriate step, and immediately returns.
-
dynamake.make.
require_context
() → Dict[str, Any]¶ Access the context used by steps for building required input files.
Modifications to this context will be visible in the configuration context of steps invoked to create required input files.
Note
Once a required file was already built to be used as an input for some step, then the contexts specified by other steps (requiring the same file) will be silently ignored.
-
dynamake.make.
reset_make
() → None¶ Reset all the current state, for tests.
-
dynamake.make.
resource_parameters
(**default_amounts) → None¶ Declare additional resources for controlling parallel action execution.
Each resource should have been declared as a
dynamake.application.Param
. The value given here is the default amount of the resource used by each action that does not specify an explicit value.
-
dynamake.make.
run
(awaitable: Awaitable) → Any¶ A Python3.6 way to implement the asyncio.run function from Python 3.7.
-
dynamake.make.
shell
(*command, **resources) → None¶ Execute a shell command.
The caller is responsible for all quotations. If the first character of the command is
@
then it is “silent”, that is, it is logged in the DEBUG level and not the INFO level.This first waits until all input files requested so far are ready.
-
dynamake.make.
spawn
(*command, **resources) → None¶ Execute an external program with arguments.
If the first character of the command is
@
then it is “silent”, that is, it is logged in the DEBUG level and not the INFO level.This first waits until all input files requested so far are ready.
-
dynamake.make.
step
(output: Union[None, str, Sequence[str], Sequence[Sequence[str]], Sequence[Sequence[Sequence[str]]], Sequence[Sequence[Sequence[Sequence[str]]]]]) → Callable[Callable, Callable]¶ Decorate a build step functions.
If
top
isTrue
, this is a top-level step that can be directly invoked from the main function.
-
dynamake.make.
step_kwargs
() → Dict[str, Any]¶ Return the named arguments of the current step.
These are the captured names extracted from the output file(s) that the current step was invoked to build.
-
dynamake.make.
submit
(*command, **resources) → None¶ Execute an external command using a submit prefix.
This allows the action configuration file to specify a
run_prefix
and/orrun_suffix
injected before and/or after the spawned command. The result is treated as a shell command. This allows setting up environment variables, submitting the command to execute on a compute cluster, etc.
-
dynamake.make.
sync
() → Optional[BaseException]¶ Wait until all the input files specified so far are built.
This is invoked automatically before running actions.
dynamake.patterns module¶
Utility functions for dealing with strings.
This is somewhat of a mixed bag and should arguably be split into several modules. The Stat
functionality really doesn’t belong here, but has cyclical dependencies with clean_path
and
glob
.
-
class
dynamake.patterns.
AnnotatedStr
¶ Bases:
str
A wrapper containing optional annotations.
-
emphasized
= False¶ Whether this was annotated by
dynamake.patterns.emphasized()
.
-
exists
= False¶ Whether this was annotated by
dynamake.patterns.exists()
.
-
optional
= False¶ Whether this was annotated by
dynamake.patterns.optional()
.
-
phony
= False¶ Whether this was annotated by
dynamake.patterns.phony()
.
-
precious
= False¶ Whether this was annotated by
dynamake.patterns.precious()
.
-
-
class
dynamake.patterns.
Captured
¶ Bases:
object
The results of operations using a capture pattern.
A capture pattern is similar to a glob pattern. However, all wildcard matches must be specified inside
{...}
as follows:{*name}
has the same effect as*
. The matching substring will be captured using the keyname
./{**name}/
has the same effect as/**/
. The matching substring will be captured using the keyname
.
If
name
starts with_
then the matching substring will be discarded instead of being captured.If
name
is followed by:
, it must be followed by the actual glob pattern. That is,{*name}
is a shorthand for{*name:*}
and{**name}
is shorthand for{*name:**}
. This allows using arbitrary match patterns (for example{*digit:[0-9]}
will capture a single decimal digit).-
__init__
() → None¶ Create an empty capture results.
-
paths
= None¶ The list of existing paths that matched the capture pattern.
-
wildcards
= None¶ The list of wildcard values captured from the matched paths.
-
class
dynamake.patterns.
LoggingFormatter
(fmt=None, datefmt=None, style='%')¶ Bases:
logging.Formatter
A formatter that uses a decimal point for milliseconds.
-
formatTime
(record: Any, datefmt: Optional[str] = None) → str¶ Format the time.
-
-
exception
dynamake.patterns.
NonOptionalException
(glob: str, capture: str)¶ Bases:
Exception
Exception when an non-optional pattern did not match any disk files.
-
__init__
(glob: str, capture: str) → None¶ Create a new exception when no disk files matched the pattern.
-
glob
= None¶ The glob pattern that failed to match.
-
-
dynamake.patterns.
NotString
= typing.Union[NoneType, typing.Sequence[str], typing.Sequence[typing.Sequence[str]], typing.Sequence[typing.Sequence[typing.Sequence[str]]], typing.Sequence[typing.Sequence[typing.Sequence[typing.Sequence[str]]]]]¶ Same as
Strings
but without the actualstr
type, foroverload
specifications.
-
class
dynamake.patterns.
RangeParam
(min: Optional[float] = None, max: Optional[float] = None, step: Optional[int] = None, include_min: bool = True, include_max: bool = True)¶ Bases:
object
A range for a numeric argument.
-
__init__
(min: Optional[float] = None, max: Optional[float] = None, step: Optional[int] = None, include_min: bool = True, include_max: bool = True) → None¶ Create a range for numeric arguments.
-
include_max
= None¶ Whether the maximal value is allowd.
-
include_min
= None¶ Whether the minimal value is allowed.
-
is_valid
(value: Union[float, int]) → bool¶ Test whether a value is valid.
-
max
= None¶ The optional maximal allowed value.
-
min
= None¶ The optional minimal allowed value.
-
step
= None¶ The optional step between values.
-
text
() → str¶ Return text for an error message.
-
-
class
dynamake.patterns.
Stat
¶ Bases:
object
Cache stat calls for better performance.
-
static
exists
(path: str) → bool¶ Test whether a file exists on disk.
-
static
forget
(path: str) → None¶ Forget the cached
stat
data about a file. If it is a directory, also forget all the data about any files it contains.
-
static
glob
(pattern: str) → List[str]¶ Fast glob through the cache.
If the pattern is a file name we know about, we can just return the result without touching the file system.
-
static
isdir
(path: str) → bool¶ Whether a file exists and is a directory.
-
static
isfile
(path: str) → bool¶ Whether a file exists and is not a directory.
-
static
mkdir_create
(path: str) → None¶ Create a new directory.
-
static
mkdir_exists
(path: str) → None¶ Ensure a directory exists.
-
static
remove
(path: str) → None¶ Force remove of a file or a directory.
-
static
reset
() → None¶ Clear the cached data.
-
static
rmdir
(path: str) → None¶ Remove an empty directory.
-
static
stat
(path: str) → os.stat_result¶ Return the
stat
data for a file.
-
static
touch
(path: str) → None¶ Set the last modified time of a file (or a directory) to now.
-
static
try_stat
(path: str) → Optional[os.stat_result]¶ Return the
stat
data for a file.
-
static
-
dynamake.patterns.
Strings
= typing.Union[NoneType, str, typing.Sequence[str], typing.Sequence[typing.Sequence[str]], typing.Sequence[typing.Sequence[typing.Sequence[str]]], typing.Sequence[typing.Sequence[typing.Sequence[typing.Sequence[str]]]]]¶ An arbitrarily nested list of strings.
This should really have been
Strings = Union[None, str, List[Strings]]
butmypy
can’t handle nested types. Therefore, do not use this as a return type; as much as possible, return a concrete type (str
,List[str]
, etc.). Instead useStrings
as an argument type, for functions thatdynamake.patterns.flatten()
their arguments. This will allow the callers to easily nest lists without worrying about flattening themselves.
-
dynamake.patterns.
capture2glob
(capture: str) → str¶ Translate a capture pattern to the equivalent
glob
pattern.
-
dynamake.patterns.
capture2re
(capture: str) → str¶ Translate a capture pattern to the equivalent
re.Pattern
.
-
dynamake.patterns.
clean_path
(path: str) → str¶ Return a clean and hopefully “canonical” path.
We do not use absolute paths everywhere (as that would mess up the match patterns). Instead we just convert each // to a single /. Perhaps more is needed.
-
dynamake.patterns.
color
(*strings) → Any¶ Return the strings, replacing any that were
dynamake.patterns.emphasized()
by a colored version.
-
dynamake.patterns.
copy_annotations
(source: str, target: str) → str¶ Copy the annotations from one string to another.
Returns the annotated target string.
-
dynamake.patterns.
each_string
(*args) → Iterator[str]¶ Iterate on all strings in an arbitrarily nested list of strings.
-
dynamake.patterns.
emphasized
(*patterns) → Any¶ Annotate patterns as emphasized (impacts logging command lines).
Emphasized text in a command line is printed in color when logged. Strategic use of this makes it easier to figure out the actual actions in the text soup of all the command line flags.
-
dynamake.patterns.
exists
(*patterns) → Any¶ Annotate patterns as exist-only (for use in action
input
and/oroutput
).An exist-only input is only required to exist, but its modification date is ignored. Directories are always treated this way because modification date on directories is unreliable.
An exist-only output is not touched following the execution, that is, the action ensures the file will exist, but may choose to leave it unmodified.
-
dynamake.patterns.
first_sentence
(text: Optional[str]) → Optional[str]¶ Return the first sentence in documentation text.
Very loosely based on https://stackoverflow.com/a/31505798/63376.
-
dynamake.patterns.
flatten
(*args) → List[str]¶ Flatten an arbitrarily nested list of strings into a simple list for processing.
-
dynamake.patterns.
fmt
(wildcards: Any, *templates) → Any¶ Similar to
str.format
, but will format any number of templates in one call.In addition, this will preserve the annotations of the templates, if any.
-
dynamake.patterns.
fmt_capture
(kwargs: Any, *patterns) → Any¶ Format one or more capture patterns using the specified values.
This is different from invoking
pattern.format(**kwargs)
on each pattern becauseformat
would be confused by the{*name}
captures in the pattern(s). In contrast,fmt_capture
will expand such directives, as long as thename
does not start with_
.
-
dynamake.patterns.
fmts
(wildcards_list: List[Dict[str, Any]], *templates) → List[str]¶ Similar to
dynamake.patterns.fmt()
, except expands thetemplates
for each of the providedwildcards
.
-
dynamake.patterns.
glob2re
(glob: str) → str¶ Translate a
glob
pattern to the equivalentre.Pattern
(as a string).This is subtly different from
fnmatch.translate
since we use it to match the result of a successfulglob
rather than to actually perform theglob
.
-
dynamake.patterns.
glob_capture
(*patterns) → dynamake.patterns.Captured¶ Given capture pattern, return the
dynamake.pattern.Captured
information (paths and captured values).Parameters: capture – The pattern may contain
...{*captured_name}...
, as well as normalglob
patterns (*
,**
). The...{name}..
is expanded using the providedwildcards
. The*
and**
areglob
-ed. A capture expression will cause the matching substring to be collected in a list of dictionaries (one per matching existing path name). Valid capture patterns are:...{*captured_name}...
is treated as if it was a*
glob pattern, and the matching zero or more characters are entered into the dictionary under thecaptured_name
key....{*captured_name:pattern}...
is similar but allows you to explicitly specify the glob pattern capture it under the keyfoo
....{**captured_name}...
is a shorthand for...{*captured_name:**}...
. That is, it acts similarly to...{*captured_name}...
except that the glob pattern is**
.Note
Do not use the
{*foo:**}
form. There’s some special treatment for the{**foo}
form as it can expand to the empty string. In particular, it is expected to always be used between/
characters, as in.../{**foo}/...
, and may expand to either no directory name, a single directory name, or a sequence of directory names.
If a pattern is not annotated with
dynamake.patterns.optional()
and it matches no existing files, an error is raised.Returns: The list of existing file paths that match the patterns, and the list of dictionaries with the captured values for each such path. The annotations ( dynamake.patterns.AnnotatedStr
) of the pattern are copied to the paths expanded from the pattern.Return type: Captured
-
dynamake.patterns.
glob_extract
(*patterns) → List[Dict[str, Any]]¶ Similar to
dynamake.patterns.glob_capture()
, but just return the list of extracted wildcards dictionaries, ignoring the matching paths.
-
dynamake.patterns.
glob_fmt
(pattern: str, *templates) → List[str]¶ For each file that matches the capture
pattern
, extract its wildcards, then use them to format each of thetemplates
.
-
dynamake.patterns.
glob_paths
(*patterns) → List[str]¶ Similar to
dynamake.patterns.glob_capture()
, but just return the list of matching paths, ignoring any extracted values.
-
dynamake.patterns.
is_emphasized
(string: str) → bool¶ Whether a string has been annotated as
dynamake.patterns.emphasized()
.
-
dynamake.patterns.
is_exists
(string: str) → bool¶ Whether a string has been annotated as
dynamake.patterns.exists()
-only.
-
dynamake.patterns.
is_optional
(string: str) → bool¶ Whether a string has been annotated as
dynamake.patterns.optional()
.
-
dynamake.patterns.
is_phony
(string: str) → bool¶ Whether a string has been annotated as
dynamake.patterns.phony()
.
-
dynamake.patterns.
is_precious
(string: str) → bool¶ Whether a string has been annotated as
dynamake.patterns.precious()
.
-
dynamake.patterns.
match_extract
(pattern: str, *strings) → List[Dict[str, Any]]¶ Similar to
dynamake.patterns.glob_extract()
, except that it uses just one capture pattern and apply it to some string(s).
-
dynamake.patterns.
match_fmt
(pattern: Any, template: Any, *strings) → Any¶ for each of the
strings
, capture it using thepattern
and use the extracted values to format thetemplate
.
-
dynamake.patterns.
optional
(*patterns) → Any¶ Annotate patterns as optional (for use in action
input
and/oroutput
).An optional input is allowed not to exist before the action is executed. This is useful if the action responds to the files but can execute without them.
An optional output is allowed not to exist after the action is executed. This is useful to ensure such outputs are removed following a failed execution, or before a new execution.
-
dynamake.patterns.
phony
(*patterns) → Any¶ Annotate patterns as phony (for use in action
input
and/oroutput
).A phony target does not exist as a disk file. When required as an input, its producer step is always executed, and the dependent step always executes its sub-processes.
-
dynamake.patterns.
precious
(*patterns) → Any¶ Annotate patterns as precious (for use in action
output
).A precious output is never deleted. This covers both deletion of “stale” outputs before an action is run and deletion of “failed” outputs after an action has failed.
-
dynamake.patterns.
str2bool
(string: str) → bool¶ Parse a boolean command line argument.
-
dynamake.patterns.
str2choice
(options: List[str]) → Callable[str, str]¶ Return a parser that accepts a string argument which is one of the options.
-
dynamake.patterns.
str2enum
(enum: type) → Callable[str, Any]¶ Return a parser for an enum command line argument.
-
dynamake.patterns.
str2float
(min: Optional[float] = None, max: Optional[float] = None, step: Optional[int] = None, include_min: bool = True, include_max: bool = True) → Callable[str, float]¶ Return a parser that accepts a float argument in the specified
dynamake.pattern.RangeParam()
.
-
dynamake.patterns.
str2int
(min: Optional[int] = None, max: Optional[int] = None, step: Optional[int] = None, include_min: bool = True, include_max: bool = True) → Callable[str, int]¶ Return a parser that accepts an int argument in the specified
dynamake.pattern.RangeParam()
.
-
dynamake.patterns.
str2list
(parser: Callable[str, Any]) → Callable[str, List[Any]]¶ Parse an argument which is a list of strings, where each must be parsed on its own.
-
dynamake.patterns.
str2optional
(parser: Callable[str, Any]) → Callable[str, Optional[Any]]¶ Parse an argument which also takes the special value
None
.
dynamake.version module¶
Version is generated by setup.py.
Module contents¶
Main DynaMake module.


{% load staticfiles %} {% include 'scan/basefiles/base_head.html' %}
{{ request.user.username }} | Sign out


Nyzo version 565 (commit on GitHub) adds the HistoricalBlockManager to allow the client to efficiently access blocks behind the BlockManager's retention edge.
This version affects the client primarily. Some small changes affect code used by other run modes.
In BlockFileConsolidator, a condition was added to allow consolidation to occur even if the retention edge is not set. This condition ensures that files are eventually consolidated even when a Nyzo instance has frequent discontinuities in its tracking. This change affects all run modes that use the BlockFileConsolidator.
Later in BlockFileConsolidator, a consolidated file's corresponding offset file is deleted just before the consolidated file is written. If the consolidated file is new, this has no effect. If the consolidated file is replacing another consolidated file, this will remove the offset file that contains offsets for the previous consolidated file. As the comment explains, the HistoricalBlockManager will create a new offset file if one is needed.
HistoricalBlockManager calculates offsets to allow efficient reading of blocks directly from consolidated block files. The startManagerKey is used in the preferences file to indicate that the HistoricalBlockManager should be started. The alive field is used as a mutex for the thread.
The HistoricalBlockManager.start() method starts a thread for generating offset files. The comment explains time considerations.
The default setting is not starting HistoricalBlockManager. If you want to use the HistoricalBlockManager on your client installation, add the following line to /var/lib/nyzo/production/preferences.
start_historical_block_manager=1
HistoricalBlockManager.buildOffsetFile() creates an offset file for no more than one consolidated file. The first part of the method looks for a consolidated file for which an offset file does not exist. If a file is found, the second part of the method generates the offsets and writes the file.
HistoricalBlockManager.blockOffsetsForConsolidatedFile() determines the start and end byte offsets for each block contained in a consolidated file. The result always contains 1000 offset pairs. If a block is not present in the file, its offsets are negative.
HistoricalBlockManager.blockForHeight() provides a block on demand from the file system. It first looks to individual files, and then it looks to consolidated files for which an offset is available. No blocks are cached in memory, and no blocks are read other than the block requested.
HistoricalBlockManager.offsetFileForHeight() provides a File object representing the location of the offset file for a specified height. This is derived from the path of the consolidated file, appending "_offsets" to the file extension.
In Verifier, checking of the WebListener.startWebListenerKey preference was eliminated. This has been moved inside the WebListener class to follow the pattern established by BlockFileConsolidator and followed by HistoricalBlockManager.
In Client.main(), checking of the WebListener.startWebListenerKey preference was eliminated. Also, the BlockFileConsolidator and HistoricalBlockManager are now started. Termination was moved outside the startedDataManager if/else block to allow the client to terminate properly when the command loop exits normally.
At the end of Client.runCommandLoop(), an incorrect comment was corrected.
In CommandEndpointWeb, the value of actionValueRun was simplified from "run command" to "run" to improve readability when used in a query string.
To allow commands to be executed easily with pre-determined parameter values (e.g., http://client.nyzo.co/transactionSearch?timestamp=1564666847588&action=run), the CommandEndpointWeb.getResponse() method now checks if command parameter values are provided in the query string. If such values are provided, the form is processed.
In CommandEndpointWeb.processForm(), query parameters are now used in the appropriate context.
In TransactionSearchCommand, HistoricalBlockManager is now used as a supplemental block source. Note that HistoricalBlockManager is not wired into BlockManager, nor should it be. Over time, BlockManager should be expected to become more efficient and more focused on providing streamlined, lightweight handling of the blocks necessary for blockchain processing, and HistoricalBlockManager should be expected to provide a more comprehensive view of the full blockchain history.
In Sentinel, the WebListener preference is no longer checked. As noted above, this preference is now checked inside the WebListener class.
In WebListener, an unused contentType constant was removed. As noted multiple times above, this class now checks the start_web_listener preference internally. The WebListener is active by default for the Micropay and documentation-server run modes, and it is inactive by default for all other run modes.


- gapBetweenBars - Static variable in class com.example.cmput301f17t27.nume.R.attr
-
May be a dimension value, which is a floating point number appended with a
unit such as "14.5sp
".
- getComment() - Method in class com.example.cmput301f17t27.nume.habitEvent.HabitEvent
-
Gets the comment attached to the event
- getDateCompleted() - Method in class com.example.cmput301f17t27.nume.habitEvent.HabitEvent
-
Gets the date that the habit was created
- getDateToStart() - Method in class com.example.cmput301f17t27.nume.habit.Habit
-
Get the date when the habit should start
- getEvent(int) - Method in class com.example.cmput301f17t27.nume.habit.Habit
-
Gets an event at a specific index in the event list
- getEvents() - Method in class com.example.cmput301f17t27.nume.habit.Habit
-
Get all the events for the habit
- getFollower(int) - Method in class com.example.cmput301f17t27.nume.account.Profile
-
Get a specific follower at an index
- getFollowerList() - Method in class com.example.cmput301f17t27.nume.account.Profile
-
Get the entire list of followers for this profile
- getFollowing() - Method in class com.example.cmput301f17t27.nume.account.Profile
-
Get the entire list of who this user is following
- getFollowing(int) - Method in class com.example.cmput301f17t27.nume.account.Profile
-
Get a single following profile at an index
- getFollowingProfiles() - Method in class com.example.cmput301f17t27.nume.account.Profile
-
Gets all the profile objects from ElasticSearch that match the
usernames in the followingList and sorts them based on username.
- getFrequency() - Method in class com.example.cmput301f17t27.nume.habit.Habit
-
Get the days of the week this habit should occur
- getHabit(int) - Method in class com.example.cmput301f17t27.nume.account.Profile
-
Get a habit at a specific index in the habit list
- getHabitList() - Method in class com.example.cmput301f17t27.nume.account.Profile
-
Get the list of habits this user has
- getId() - Method in class com.example.cmput301f17t27.nume.account.Profile
-
Gets the ID of the profile on ElasticSearch
- getImage() - Method in class com.example.cmput301f17t27.nume.habitEvent.HabitEvent
-
Get the image that the user attached to the event.
- getLocation() - Method in class com.example.cmput301f17t27.nume.habitEvent.HabitEvent
-
Gets the location attached to the habit event
- getName() - Method in class com.example.cmput301f17t27.nume.account.Profile
-
Get the real name of the user
- getProfile(String) - Static method in class com.example.cmput301f17t27.nume.various.SaveLoadController
-
Get a profile from ElasticSearch only.
- getReason() - Method in class com.example.cmput301f17t27.nume.habit.Habit
-
Get the reason for the habit
- getRequest(int) - Method in class com.example.cmput301f17t27.nume.account.Profile
-
Get a single follow request at an index
- getRequestList() - Method in class com.example.cmput301f17t27.nume.account.Profile
-
Get the entire list of follow requests that other users
have sent to this profile
- getTitle() - Method in class com.example.cmput301f17t27.nume.habit.Habit
-
Gets the title of the habit
- getTodaysHabitList() - Method in class com.example.cmput301f17t27.nume.account.Profile
-
Gets habits out of the habit list that have today as
one of their days in their frequency list
- getUserName() - Method in class com.example.cmput301f17t27.nume.account.Profile
-
Gets the username of the profile
- getView(int, View, ViewGroup) - Method in class com.example.cmput301f17t27.nume.follows.FollowerAdapter
-
Overrides the standard getView to get our custom layout
for each entry in the list of followers
- getView(int, View, ViewGroup) - Method in class com.example.cmput301f17t27.nume.follows.FollowingAdapter
-
Overrides the standard getView to get our custom layout
for each entry in the list of following habits
- getView(int, View, ViewGroup) - Method in class com.example.cmput301f17t27.nume.habit.HabitAdapter
-
Overrides the standard getView to get our custom layout
for each entry in the list of habits
- getView(int, View, ViewGroup) - Method in class com.example.cmput301f17t27.nume.habitEvent.EventAdapter
-
Overrides the standard getView to get our custom layout
for each entry in the list of events
- getView(int, View, ViewGroup) - Method in class com.example.cmput301f17t27.nume.habitEvent.EventSearchAdapter
-
Overrides the standard getView to get our custom layout
for each entry in the list of search events
- getView(int, View, ViewGroup) - Method in class com.example.cmput301f17t27.nume.various.NotificationAdapter
-
Overrides the standard getView to get our custom layout
for each entry in the list of notifications
- ghost_view - Static variable in class com.example.cmput301f17t27.nume.R.id
-
- goIcon - Static variable in class com.example.cmput301f17t27.nume.R.attr
-
May be a reference to another resource, in the form
"@[+][package:]type/name
" or a theme
attribute in the form
"?[package:]type/name
".
- google_maps_key - Static variable in class com.example.cmput301f17t27.nume.R.string
-
- google_play_services_version - Static variable in class com.example.cmput301f17t27.nume.R.integer
-
- googleg_disabled_color_18 - Static variable in class com.example.cmput301f17t27.nume.R.drawable
-
- googleg_standard_color_18 - Static variable in class com.example.cmput301f17t27.nume.R.drawable
-
- graph - Static variable in class com.example.cmput301f17t27.nume.R.id
-
- GraphViewXML - Static variable in class com.example.cmput301f17t27.nume.R.styleable
-
Attributes that can be used with a GraphViewXML.
- GraphViewXML_android_title - Static variable in class com.example.cmput301f17t27.nume.R.styleable
-
- GraphViewXML_seriesColor - Static variable in class com.example.cmput301f17t27.nume.R.styleable
-
- GraphViewXML_seriesData - Static variable in class com.example.cmput301f17t27.nume.R.styleable
-
- GraphViewXML_seriesTitle - Static variable in class com.example.cmput301f17t27.nume.R.styleable
-
- GraphViewXML_seriesType - Static variable in class com.example.cmput301f17t27.nume.R.styleable
-


(Deprecated API)
(Deprecated API)
(Deprecated API)
Includes enterprise licensing and support
Note: The Google Directions
API does not requires a Maps API key!
Google Maps
API Premier customers must, however, sign their URLs
using a new cryptographic key. See the
Premier documentation for more information.
The Google Directions API is a service that calculates directions between locations using an HTTP request. Directions may specify origins, destinations and waypoints either as text strings (e.g. "Chicago, IL" or "Darwin, NT, Australia") or as latitude/longitude coordinates. The Directions API can return multi-part directions using a series of waypoints.
This service is generally designed for calculating directions for static (known in advance) addresses for placement of application content on a map; this service is not designed to respond in real time to user input, for example. For dynamic directions calculations (for example, within a user interface element), consult the documentation for the JavaScript API V3 Directions Service.
Calculating directions is a time and resource intensive task. Whenever possible, calculate known addresses ahead of time (using the service described here) and store your results in a temporary cache of your own design.
This document is intended for website and mobile developers who want to use compute direction data within maps provided by one of the Google Maps APIs. It provides an introduction to using the API and reference material on the available parameters.
Use of the Google Directions API is subject to a query limit of 2,500 directions requests per day. Individual directions requests may contain up to 8 intermediate waypoints in the request. Google Maps Premier customers may query up to 100,000 directions requests per day, with up to 23 waypoints allowed in each request.
Additionally, note that Directions API URLs are restricted to 2048 characters, before URL Encoding. As some Directions service URLs may involve many locations along a path, be aware of this limit when constructing your URLs.
Note: the Directions API may only be used in conjunction with displaying results on a Google map; using Directions data without displaying a map for which directions data was requested is prohibited. Additionally, calculation of directions generates copyrights and warnings which must be displayed to the user in some fashion. For complete details on allowed usage, consult the Maps API Terms of Service License Restrictions.
A Directions API request is an HTTP URL of the following form:
http://maps.googleapis.com/maps/api/directions/output?parameters
where output
may be either of the following values:
json
(recommended) indicates output in JavaScript
Object Notation (JSON)xml
indicates output as XMLCertain parameters are required while others are optional. As is
standard in URLs, all parameters are separated using the ampersand
(&
) character. The list of parameters and their possible
values are enumerated below.
The Directions API defines a directions request using the following URL parameters:
origin
(required) — The address or textual
latitude/longitude value from which you wish to calculate directions.
*destination
(required) — The address or
textual latitude/longitude value from which you wish to calculate
directions.*mode
(optional, defaults to driving
)
— specifies what
mode of transport to use when calculating directions. Valid
values are specified in Travel Modes.waypoints
(optional) specifies
an array of waypoints. Waypoints alter a route by routing it
through the specified location(s). A waypoint is specified
as either a latitude/longitude coordinate or as an address
which will be geocoded. (For more information on waypoints,
see Using Waypoints in Routes below.)
alternatives
(optional), if set to
true
, specifies that the Directions service may
provide more than one route alternative in the response. Note that
providing route alternatives may increase the response time from
the server.avoid
(optional) indicates that the
calculated route(s) should avoid the indicated features. Currently,
this parameter supports the following two arguments:
tolls
indicates that the calculated route should
avoid toll roads/bridges.highways
indicates that the calculated route
should avoid highways.(For more information see Route Restrictions below.)
units
(optional) — specifies what
unit system to use when displaying results. Valid values are
specified in Unit Systems below.
region
(optional) — The region code,
specified as a ccTLD ("top-level domain") two-character value. (For more
information see Region Biasing below.)language
(optional) — The language in
which to return results. See the
supported list of domain
languages. Note that we often update supported languages so this
list may not be exhaustive. If language
is not supplied,
the Directions service will attempt to use the native language of
the browser wherever possible. See Region
Biasing for more information.sensor
(required) — Indicates whether
or not the directions request comes from a device with a location
sensor. This value must be either true
or
false
.* Note: You may pass either an address or a latitude/longitude coordinate in several parameters. If you pass an address as a string, the Directions service will geocode the string and convert it to a latitude-longitude coordinate to calculate directions. If you pass coordinates, ensure that no space exists between the latitude and longitude values.
When you calculate directions, you may specify
which transportation mode
to use. By default,
directions are calculated as driving
directions. The following
travel modes are currently supported:
driving
(default) indicates standard driving directions
using the road network.walking
requests walking directions via
pedestrian paths & sidewalks (where available).bicycling
requests bicycling directions via
bicycle paths & preferred streets (currently only available
in the US).Note: Both walking and
bicycling directions may sometimes not include clear pedestrian or
bicycling paths, so these directions will return warnings
in the returned result which you must display to the user.
When calculating routes using the Directions API, you may also specify waypoints. Waypoints allow you to calculate routes through additional locations, in which case the returned route passes through the given waypoints.
Waypoints are specified within the waypoints
parameter and consist of one or more addresses or locations
separated by the pipe (|
) character.
For example, the following URL initiates a Directions request for a route between Boston, MA and Concord, MA via Charlestown and Lexington, in that order:
http://maps.googleapis.com/maps/api/directions/json?origin=Boston,MA&destination=Concord,MA&waypoints=Charlestown,MA|Lexington,MA&sensor=false
By default, the Directions service calculates a route through
the provided waypoints in their given order. Optionally, you
may pass optimize:true
as the first argument
within the waypoints
parameter to allow the Directions
service to optimize the provided route by rearranging the waypoints in
a more efficient order. (This optimization is an application of the
Travelling Salesman Problem.)
If you instruct the Directions service to optimize the order of
its waypoints, their order will be returned in the
waypoint_order
field within the
routes
object. The waypoint_order
field
returns values which are zero-based.
The following example calculates a road trip route from Adelaide, South Australia to each of South Australia's main wine regions using route optimization.
http://maps.googleapis.com/maps/api/directions/json?origin=Adelaide,SA&destination=Adelaide,SA&waypoints=optimize:true|Barossa+Valley,SA|Clare,SA|Connawarra,SA|McLaren+Vale,SA&sensor=false
Inspection of the calculated route will indicate that the route is calculated using the following waypoint order:
"waypoint_order": [ 1, 0, 2, 3 ]
Directions may be calculated that adhere to certain restrictions. Restrictions
are indicated by use of the avoid
parameter, and an argument to that
parameter indicating the restriction to avoid. Currently two restrictions are
supported:
avoid=tolls
avoid=highways
Note: the addition of restrictions does not preclude routes that include the restricted feature; it simply biases the result to more favorable routes.
Directions results contain text
within distance
fields that may be displayed to the user to indicate the distance of a
particular "step" of the route. By default, this text uses the unit system
of the origin's country or region. (Note:
origins expressed using coordinates rather than addresses always default
to metric units.)
For example, a route from
"Chicago, IL" to "Toronto, ONT" will display results in miles, while
the reverse route will display results in kilometers. You
may override this unit system by setting one explicitly within the
request's units
parameter, passing one of the following
values:
metric
specifies usage of the metric system.
Textual distances are returned using kilometers and meters.imperial
specifies usage of the Imperial
(English) system. Textual distances are returned using miles and feet.Note: this unit system setting only
affects the text
displayed within distance
fields. The distance
fields also contain values
which are always expressed in meters.
You can also set the Directions service to return results biased to a
particular region by use of the region
parameter. This parameter
takes a ccTLD (country code
top-level domain) argument specifying the region bias. Most ccTLD codes are
identical to ISO 3166-1 codes, with some notable exceptions. For example,
the United Kingdom's ccTLD is "uk" (.co.uk
) while its ISO 3166-1
code is "gb" (technically for the entity of "The United Kingdom of Great
Britain and Northern Ireland").
You may utilize any domain in which the main Google Maps application has launched driving directions.
For example, a directions request from "Toldeo" to "Madrid"
returns a result when region
is set to es
as "Toledo" is interpreted as the Spanish city:
http://maps.googleapis.com/maps/api/directions/json?origin=Toledo&destination=Madrid®ion=es&sensor=false { "status": "OK", "routes": [ { "summary": "AP-41", "legs": [ { ... } ], "copyrights": "Map data ©2010 Europa Technologies, Tele Atlas", "warnings": [ ], "waypoint_order": [ ] } ] }
A directions for "Toledo" to "Madrid" sent to with no region
parameter will not return any results, since "Toledo" is interpreted as the
city in Ohio:
http://maps.googleapis.com/maps/api/directions/json?origin=Toledo&destination=Madrid&sensor=false { "status": "ZERO_RESULTS", "routes": [ ] }
Directions responses are returned in the format indicated by the
output
flag within the URL request's path.
A sample HTTP request is shown below, calculating the route from Chicago, IL to Los Angeles, CA via two waypoints in Joplin, MO and Oklahoma City, OK:
http://maps.googleapis.com/maps/api/directions/json?origin=Chicago,IL&destination=Los+Angeles,CA&waypoints=Joplin,MO|Oklahoma+City,OK&sensor=false
The JSON result is shown below. Because directions results can be quite verbose, repeated elements within the response have been omitted for clarity.
{ "status": "OK", "routes": [ { "summary": "I-40 W", "legs": [ { "steps": [ { "travel_mode": "DRIVING", "start_location": { "lat": 41.8507300, "lng": -87.6512600 }, "end_location": { "lat": 41.8525800, "lng": -87.6514100 }, "polyline": { "points": "a~l~Fjk~uOwHJy@P", "levels": "B?B" }, "duration": { "value": 19, "text": "1 min" }, "html_instructions": "Head \u003cb\u003enorth\u003c/b\u003e on \u003cb\u003eS Morgan St\u003c/b\u003e toward \u003cb\u003eW Cermak Rd\u003c/b\u003e", "distance": { "value": 207, "text": "0.1 mi" } }, ... ... additional steps of this leg ... ... additional legs of this route "duration": { "value": 74384, "text": "20 hours 40 mins" }, "distance": { "value": 2137146, "text": "1,328 mi" }, "start_location": { "lat": 35.4675602, "lng": -97.5164276 }, "end_location": { "lat": 34.0522342, "lng": -118.2436849 }, "start_address": "Oklahoma City, OK, USA", "end_address": "Los Angeles, CA, USA" } ], "copyrights": "Map data ©2010 Google, Sanborn", "overview_polyline": { "points": "a~l~Fjk~uOnzh@vlbBtc~@tsE`vnApw{A`dw@~w\\|tNtqf@l{Yd_Fblh@rxo@b}@xxSfytAblk@xxaBeJxlcBb~t@zbh@jc|Bx}C`rv@rw|@rlhA~dVzeo@vrSnc}Axf]fjz@xfFbw~@dz{A~d{A|zOxbrBbdUvpo@`cFp~xBc`Hk@nurDznmFfwMbwz@bbl@lq~@loPpxq@bw_@v|{CbtY~jGqeMb{iF|n\\~mbDzeVh_Wr|Efc\\x`Ij{kE}mAb~uF{cNd}xBjp]fulBiwJpgg@|kHntyArpb@bijCk_Kv~eGyqTj_|@`uV`k|DcsNdwxAott@r}q@_gc@nu`CnvHx`k@dse@j|p@zpiAp|gEicy@`omFvaErfo@igQxnlApqGze~AsyRzrjAb__@ftyB}pIlo_BflmA~yQftNboWzoAlzp@mz`@|}_@fda@jakEitAn{fB_a]lexClshBtmqAdmY_hLxiZd~XtaBndgC", "levels": "BBBAAAAABAABAAAAAABBAAABBAAAABBAAABABAAABABBAABAABAAAABABABABBABAABB" }, "warnings": [ ], "waypoint_order": [ 0, 1 ] } ] }
Generally, only one entry in the "routes"
array is returned
for directions lookups, though the Directions service may return several routes
if you pass alternatives=true
.
Note that these results generally need to be parsed if you wish to extract values from the results. Parsing JSON is relatively easy. See Parsing JSON for some recommended design patterns.
In this example, the Directions API requests an xml
response for the
identical query shown above for :
http://maps.googleapis.com/maps/api/directions/xml?origin=Chicago,IL&destination=Los+Angeles,CA&waypoints=Joplin,MO|Oklahoma+City,OK&sensor=false
The XML returned by this request is shown below.
<DirectionsResponse> <status>OK</status> <route> I-40 W <leg> <step> <travel_mode>DRIVING</travel_mode> <start_location> <lat>41.8507300</lat> <lng>-87.6512600</lng> </start_location> <end_location> <lat>41.8525800</lat> <lng>-87.6514100</lng> </end_location> <polyline> <points>a~l~Fjk~uOwHJy@P</points> <levels>B?B</levels> </polyline> <duration> <value>19</value> <text>1 min</text> </duration> <html_instructions>Head north on S Morgan St toward W Cermak Rd</html_instructions> <distance> <value>207</value> <text>0.1 mi</text> </distance> </step> ... ... additional steps of this leg ... ... additional legs of this route <duration> <value>74384</value> <text>20 hours 40 mins</text> </duration> <distance> <value>2137146</value> <text>1,328 mi</text> </distance> <start_location> <lat>35.4675602</lat> <lng>-97.5164276</lng> </start_location> <end_location> <lat>34.0522342</lat> <lng>-118.2436849</lng> </end_location> <start_address>Oklahoma City, OK, USA</start_address> <end_address>Los Angeles, CA, USA</end_address> <copyrights>Map data ©2010 Google, Sanborn</copyrights> <overview_polyline> <points>a~l~Fjk~uOnzh@vlbBtc~@tsE`vnApw{A`dw@~w\|tNtqf@l{Yd_Fblh@rxo@b}@xxSfytAblk@xxaBeJxlcBb~t@zbh@jc|Bx}C`rv@rw|@rlhA~dVzeo@vrSnc}Axf]fjz@xfFbw~@dz{A~d{A|zOxbrBbdUvpo@`cFp~xBc`Hk@nurDznmFfwMbwz@bbl@lq~@loPpxq@bw_@v|{CbtY~jGqeMb{iF|n\~mbDzeVh_Wr|Efc\x`Ij{kE}mAb~uF{cNd}xBjp]fulBiwJpgg@|kHntyArpb@bijCk_Kv~eGyqTj_|@`uV`k|DcsNdwxAott@r}q@_gc@nu`CnvHx`k@dse@j|p@zpiAp|gEicy@`omFvaErfo@igQxnlApqGze~AsyRzrjAb__@ftyB}pIlo_BflmA~yQftNboWzoAlzp@mz`@|}_@fda@jakEitAn{fB_a]lexClshBtmqAdmY_hLxiZd~XtaBndgC</points> <levels>BBBAAAAABAABAAAAAABBAAABBAAAABBAAABABAAABABBAABAABAAAABABABABBABAABB</levels> </overview_polyline> <optimized_waypoint_index>0</optimized_waypoint_index> <optimized_waypoint_index>1</optimized_waypoint_index> </route> </DirectionsResponse>
Note that the XML response consists of a single <DirectionsResponse>
and two top-level elements:
<status>
contains metadata on the request. See
Status Codes below.<route>
elements, each containing a single set of
routing information between the origin and destination.We recommend that you use json
as the preferred output flag
unless your service requires xml
for some reason. Processing XML trees
requires some care, so that you reference proper nodes and elements. See
Parsing XML
with XPath for some recommended design patterns for output processing.
The remainder of this documentation will use JSON syntax. In most cases, the output format does not matter for purposes of illustrating concepts or field names in the documentation. However, note the following subtle differences:
<DirectionsResponse>
element.steps
),
while XML denotes these using multiple singular elements (<step>
).routes
array in JSON, but no <route>
elements in XML,
for example.Directions responses contain two root elements:
"status"
contains metadata on the request. See
Status Codes below."routes"
contains an array of routes from the origin to
the destination. See Routes below.Routes consist of nested Legs and Steps.
The "status"
field within the Directions response object contains the status
of the request, and may contain debugging information to help you track down why the
Directions service failed. The "status"
field may contain the following
values:
OK
indicates the response contains a
valid result
.NOT_FOUND
indicates at least one of the
locations specified in the requests's origin, destination, or
waypoints could not be geocoded.ZERO_RESULTS
indicates no route could be found
between the origin and destination.MAX_WAYPOINTS_EXCEEDED
indicates that too
many waypoints
s were provided
in the request The maximum allowed
waypoints
is 8, plus the origin, and destination. (
Google Maps Premier
customers may contain requests with up to 23
waypoints.)INVALID_REQUEST
indicates that the
provided request was invalid.OVER_QUERY_LIMIT
indicates the service has
received too many requests from your application within the allowed
time period.REQUEST_DENIED
indicates that the service denied
use of the directions service by your application.UNKNOWN_ERROR
indicates a directions request
could not be processed due to a server error. The request may
succeed if you try again.When the Directions API returns results, it places them
within a (JSON) routes
array. Even if the service returns
no results (such as if the origin and/or destination doesn't exist) it
still returns an empty routes
array. (XML responses consist
of zero or more <route>
elements.)
Each element of the routes
array contains a single result
from the specified origin and destination. This route may consist of
one or more legs
depending on whether any waypoints
were specified. As well, the route also contains copyright and warning
information which must be displayed to the user in addition to the
routing information.
Each route within the routes
field may contain
the following fields:
summary
contains a short textual description
for the route, suitable for naming and disambiguating the route
from alternatives.legs[]
contains an array which contains
information about a leg of the route, between two locations
within the given route. A separate leg will be present for each
waypoint or destination specified. (A route with no waypoints will contain
exactly one leg within the legs
array.) Each leg consists
of a series of steps
. (See
Directions Legs below.)waypoint_order
contains an array
indicating the order of any waypoints in the calculated
route. This waypoints may be reordered if the
request was passed optimize:true
within its
waypoints
parameter.overview_polyline
contains an object holding an
array of encoded points
and levels
that
represent an approximate (smoothed)
path of the resulting directions.copyrights
contains the copyrights text to be
displayed for this route. You must handle and
display this information yourself.warnings[]
contains an array of warnings
to be displayed when showing these directions. You must
handle and display these warnings yourself.Each element in the legs
array specifies a single leg
of the journey from the origin to the destination in the calculated
route. For routes that contain no waypoints, the route will consist
of a single "leg," but for routes that define one or more
waypoints, the route will consist of one or more legs, corresponding
to the specific legs of the journey.
Each leg within the legs
field(s) may contain
the following fields:
steps[]
contains an array of
steps denoting information about each separate step of
the leg of the journey. (See
Directions Steps below.)distance
indicates the total distance covered
by this leg, as a field with the following elements:
value
indicates the distance in meterstext
contains a human-readable representation
of the distance, displayed in units as
used at the origin (or as overridden within the units
parameter in the request), in the language specified in the request.
(For example, miles and feet will be used for
any origin within the United States.) Note that regardless
of what unit system is displayed as text, the
distance.value
field always contains a value
expressed in meters.These fields may be absent if the distance is unknown.
duration
indicates the total duration of
this leg, as a field with the following elements:
value
indicates the duration in
seconds.text
contains a human-readable representation
of the duration.These fields may be absent if the duration is unknown.
start_location
contains the latitude/longitude
coordinates of the origin of this leg. Because the Directions
API calculates directions between locations by using
the nearest transportation option (usually a road) at the start
and end points, start_location
may be different
than the provided origin of this leg if, for example, a road
is not near the origin.end_location
contains the latitude/longitude
coordinates of the given destination of this leg. Because the
Directions API calculates directions between locations
by using the nearest transportation option (usually a road) at
the start and end points, end_location
may be
different than the provided destination of this leg if, for
example, a road is not near the destination.start_address
contains the human-readable
address (typically a street address) reflecting the
start_location
of this leg.end_addresss
contains the human-readable
address (typically a street address) reflecting the
end_location
of this leg.Each element in the steps
array defines a single step
of the calculated directions. A step is the most atomic unit of a
direction's route, containing a single step describing a specific, single
instruction on the journey. E.g. "Turn left at W. 4th St." The step not
only describes the instruction but also contains distance and duration
information relating to how this step relates to the following step.
For example, a step denoted as "Merge onto I-80 West" may contain a
duration of "37 miles" and "40 minutes," indicating that the next step
is 37 miles/40 minutes from this step.
Each step within the steps
field(s) may contain
the following fields:
html_instructions
contains formatted instructions
for this step, presented as an HTML text string.distance
contains the distance covered by this
step until the next step. (See the discussion of this field
in Directions Legs above.) This field
may be undefined if the distance is unknown.duration
contains the typical time required to
perform the step, until the next step (See the description in
Directions Legs above.) This field
may be undefined if the duration is unknown.start_location
contains the location of
the starting point of this step, as a single set of
lat
and lng
fields.end_location
contains the location of
the starting point of this step, as a single set of
lat
and lng
fields.


I’m pretty confident once "tested that it will come back negative but this whole thing is still scary af! |
0 |
14 |
原文 |
|
|
| 28360 |
3/17/2020 21:17 |
I’m a physician who is exposed to "positive "covid 19 patient and they put my name on the list to be "tested in 1 to 2 days probably another 2 days for result .this is a disaster . If this is the beginning so how many of health care workers sick /die before u have things ready. |
0 |
1 |
原文 |
|
|
| 28362 |
3/17/2020 21:16 |
# NowWatching This is a local man who made a video about his experience trying to get a proper "test! #Craycray #"Coronavirus #"COVID -19 I HAVE "TESTED "POSITIVE FOR "COVID-19("Coronavirus) https:// youtu.be/2UUjpy6vH1E via @YouTube |
0 |
1 |
原文 |
|
|
| 28366 |
3/17/2020 21:15 |
I'm in Texas with my mother. On my way back home in the morning. In the meantime, some Australians that were in my neck of the woods "tested "positive for "coronavirus. They came into the coffee shop where my daughter was working last week. I HATE this. |
0 |
5 |
原文 |
|
|
| 28369 |
3/17/2020 21:14 |
If I hear of a "news" item with insert (celebrity actor / sportsperson's name) in which they are #"COVID19 "positive I will ask: 1. how come they were "tested & not the 300M+ in this country? 2. who gives a damn. 3. I will forego henceforth reading that newspaper / website. Simple. |
0 |
3 |
原文 |
|
|
| 28376 |
3/17/2020 21:12 |
Guys how fucking funny would it be if I posted a photo saying I "tested negative for "Coronavirus but then at the bottom it said I "tested "positive for HIV and I captioned it “Guys I don’t have "coronavirus” haha wouldn’t that be funny and never seen before |
0 |
4 |
原文 |
|
|
| 28377 |
3/17/2020 21:12 |
I’m so sad. Just learned my favorite Spanish teacher Sister Natalia at @NotreDameSJ has "tested "positive for "COVID-19 and is hospitalized. I ask that you please keep her in your thoughts and prayers and please abide by guidance from health officials. #ktvu #NDHS #SanJose pic.twitter.com/n1tYYyWgsd |
3 |
25 |
原文 |
|
|
| 28382 |
3/17/2020 21:10 |
@ greetchendiaz @npares @AnaToledoDavila An NYPD OFFICER assigned to lower Manhattan has "tested "positive for the "Corona Virus, and 17 of his colleagues from the same command have flu like symptoms.  FAMILY FIRST. https:// twitter.com/ortiz_ford/sta tus/1239581885950562306 … |
0 |
1 |
原文 |
|
|
| 28386 |
3/17/2020 21:10 |
Yes! I had the flu on Feb. 24-25. I think. Asked about "COVID "testing; it wasn't possible then. (All "tests were CDC, I had no risks.)
I care about our elders who have no financial safety net. |
0 |
2 |
原文 |
|
|
| 28391 |
3/17/2020 21:09 |
I thought I was dying when I "tested "positive for the flu. Can you imagine the way elderly people felt? People my age with "COVID feel perfectly fine. I was laying on a bed crying bc I felt so bad.  I pray & hope that both father and son make full recovery.
@adgpi @NorthernComd_IA
#"CoronaInIndia #"COVID2019 https:// twitter.com/ANI/status/123<PHONE_NUMBER>438464 … |
2 |
3 |
原文 |
|
|
| 28399 |
3/17/2020 21:07 |
can someone explain to me why rich people keep getting "tested "positive for "coronavirus w/o displaying symptoms but avg Americans can’t? explain it to me like I’m stupid bc I just don’t get it |
1 |
9 |
原文 |
|
|
| 28403 |
3/17/2020 21:06 |
I’m sorry that you were "tested "positive with "coronavirus prayers for you and I am hoping we will al get through this crisis. |
0 |
0 |
原文 |
|
|
| 28406 |
3/17/2020 21:05 |
As of Monday morning 149 patients "tested "positive for "coronavirus i’ve over 6000 patients nationwide https:// twitter.com/shawnm304/stat us/1240092629293031424 … |
0 |
0 |
原文 |
|
|
| 28407 |
3/17/2020 21:05 |
Hi, I thought you were supposed to be quarantined if "positive for "Covid 19 but your wife who has not been "tested is beside you ? Explain |
0 |
0 |
原文 |
|
|
| 28411 |
3/17/2020 21:04 |
Friends - Today I received confirmation that I "tested "positive for "COVID19. We are quarantined at home. WE MUST DO OUR PART. If you are not social distancing and STAYING HOME, DO SO NOW! #flattenthecurve God has given us faith, but he’s also given us wisdom. Be well and wise! |
538 |
4789 |
原文 |
|
|
| 28418 |
3/17/2020 21:02 |
Nobody will see this but I have to vent somewhere because I’m SCARED. Today work informed me that I needed to self isolate until next Friday because I came into contact with someone who has "tested "positive for "covid-19. I have a history of pneumonia and lung issues 1/2 |
0 |
0 |
原文 |
|
|
| 28422 |
3/17/2020 21:01 |
The wife and I are officially on 14-day quarantine after she came in contact with a fellow staffer who "tested "positive for "COVID-19 at University Hospital who was made to return to work even though she just returned from Las Vegas. |
0 |
7 |
原文 |
|
|
| 28423 |
3/17/2020 21:01 |
Mr. President, thank you for serving and saving our @USA . I understand both Tom Hanks & wife "tested "positive for "Coronavirus recently; both have recovered within 14 days & are out of the hospital. So, why control & punish society - national emergency ? The flu kills 4x as many https:// twitter.com/realDonaldTrum p/status/1240008233781248002 … |
0 |
0 |
原文 |
|
|
| 28427 |
3/17/2020 21:00 |
So someone told me that a handful of bartenders at the gay bars here "tested "positive for "COVID-19, which means I will be celibate for the next hot minute. |
0 |
6 |
原文 |
|
|
| 28430 |
3/17/2020 21:00 |
Fuck "coronavirus, I just "tested "positive for hpv |
0 |
3 |
原文 |
|
|
| 28434 |
3/17/2020 20:59 |
My friend who "tested "positive for "COVID-19 was able to eat today, and laughed at a joke her daughter told her. I'll not rest until she is released from the hospital and home. |
0 |
1 |
原文 |
|
|
| 28438 |
3/17/2020 20:58 |
My girlfriend’s said “ I "tested "positive for the "corona virus” and even had a little virus emoji. |
0 |
0 |
原文 |
|
|
| 28439 |
3/17/2020 20:58 |
I know several people who have "tested "positive for "COVID-19
This is highly contagious and a very real thing so please take this seriously
We must #flattenthecurve |
6 |
43 |
原文 |
|
|
| 28446 |
3/17/2020 20:57 |
.@lakers players are ALL getting "tested for #"Coronavirus ONLY because they came in contact with @KDTrey5 (Kevin Durant)??
This doesn’t meet the @CDCgov criteria!
If I "tested "positive , my daughter STILL wouldn’t be approved to get a "test.
#RichPrivilege |
0 |
0 |
原文 |
|
|
| 28447 |
3/17/2020 20:56 |
@ SingaporeAir Hi, I read in the Sri Lanka eNews that a Sri Lanka first officer who "tested "COVID-19 "positive has had his last lay-over flight to Singapore on 28th Feb. https://www. newsfirst.lk/2020/03/16/sri lankan-airlines-sent-some-on-self-quarantine-after-one-first-officer-"tested-"covid-19-"positive/ … |
0 |
0 |
原文 |
|
|
| 28451 |
3/17/2020 20:55 |
I was exposed to someone with the "coronavirus. I work part in a grocery store, a customer who has "tested "positive , came into the store, shopped, paid at my register with cash, and then got asked to leave because we know she has "tested "positive . |
0 |
0 |
原文 |
|
|
| 28455 |
3/17/2020 20:53 |
Today I learned that one of my co-workers, with whom I had contact last week, has symptoms of "COVID-19. His wife "tested "positive yesterday so he is presumed "positive . I 'm in voluntary quarantine until W 3/25 (14 days since my last contact with him). #QuarantineLife #DoingMyPartCO |
0 |
1 |
原文 |
|
|
| 28459 |
3/17/2020 20:53 |
If I were "tested I would be "positive for the #"coronavirus . I was treated with lots of IV meds and sent home with instructions on how to safely #selfquarantine . 4 of the 5 people I live with have the same #Symptoms and should also be #presumed #"positive . 4 cases in Tarrant County |
1 |
5 |
原文 |
|
|
| 28461 |
3/17/2020 20:52 |
My 12 year old son has just been "tested "positive for #"Coronavirus
This means I can not be in the same room as him for a while..
On the 24th March he turns 13
He is going to miss the birthday that will see him transition from a boy, in to a young man....
I love you Son #Fuck"Corona |
1 |
3 |
原文 |
|
|


{% load static %}
{% load common_filters %}
Statistics
| Total added: |
{{ total_added }} |
| Total removed: |
{{ total_removed }} |
|
+
{% else %}
color: red;">
{% endif %}
{{ total_diff }}
|
| Total editors: |
{{ total_editors }} |
| Total projects: |
{{ total_projects }} |
Totals
| Organisation |
Added |
Removed |
{% for organisation in top_organisations %}
|
{{ organisation|truncatechars:20 }}
|
{{ organisation.links_added }}
|
{{ organisation.links_removed }}
|
{% endfor %}
| Project |
Added |
Removed |
{% for project in top_projects %}
|
{{ project.domain }}
|
{{ project.links_added }}
|
{{ project.links_removed }}
|
{% endfor %}


forge($config = array())
The forge method allows you to manually instantiate a crypt instance.
| Static | Yes | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Parameters |
|
|||||||||
| Returns | object - The instantiated crypt object. | |||||||||
| Example |
|
The Crypt class allows encrypt or decrypt a string. The Crypt class is also used internally by for example the Fuel Sessions class.
It uses the encryption and hashing methods provided by PHPSecLib, so it's not dependent on external modules being available, such as mcrypt.
The Crypt class supports the use of multiple instances. This might prove useful if you require multiple encryption key sets.
You can use the same methods on an crypt instance as you would when you the static methods. For the method definition see the class usage page.
The forge method allows you to manually instantiate a crypt instance.
| Static | Yes | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Parameters |
|
|||||||||
| Returns | object - The instantiated crypt object. | |||||||||
| Example |
|
The instance method allows you load a named instance of the crypt class.
| Static | Yes | ||||||
|---|---|---|---|---|---|---|---|
| Parameters |
|
||||||
| Returns | mixed - The named crypt instance or false if the instance does not exist. | ||||||
| Example |
|
The static methods of the Crypt class will also use the default instance. Remember this if you alter the configuration of the default instance!


China Unicom 4G growth takes a big hit
by Joseph WaringChina Unicom continued to struggle after falling to third place in Q3, with 4G subscriber additions slowing to just 600,000 in October, down from an average of 3.5 million per month for the first nine months of the year.
The operator also lost 2.6 million overall subscribers in October to end the month with a total of 322.1 million. From April to September it added fewer than 400,000 subs.
Second ranked China Telecom picked up 2.7 million 4G users in October, while the market leader China Mobile added 1.5 million.
China had 1.28 billion LTE subscribers at end-October, taking 4G penetration to 80 per cent. China Telecom led with an 84 per cent rate, followed by China Mobile (79.4 per cent) and China Unicom (78.2 per cent).
During October, China Telecom added 2.1 million subs to take its total to 333 million, while China Mobile signed up 1.5 million to end October with 943 million.
In the third quarter, China Telecom moved ahead of China Unicom in overall customer numbers.