text stringlengths 81 112k |
|---|
Builds a stat entry object from a given path.
Args:
path: A path (string value) to stat.
pathspec: A `PathSpec` corresponding to the `path`.
ext_attrs: Whether to include extended file attributes in the result.
Returns:
`StatEntry` object.
def StatEntryFromPath(path, pathspec, ext_attrs=True):
... |
Build a stat entry object from a given stat object.
Args:
stat: A `Stat` object.
pathspec: A `PathSpec` from which `stat` was obtained.
ext_attrs: Whether to include extended file attributes in the result.
Returns:
`StatEntry` object.
def StatEntryFromStat(stat,
pathspec,
... |
Returns a `os.stat_result` with most information from `StatEntry`.
This is a lossy conversion, only the 10 first stat_result fields are
populated, because the os.stat_result constructor is inflexible.
Args:
stat_entry: An instance of rdf_client_fs.StatEntry.
Returns:
An instance of `os.stat_result` w... |
Initializes Api(Client|Hunt|CronJob)Approval from an AFF4 object.
def _InitApiApprovalFromAff4Object(api_approval, approval_obj):
"""Initializes Api(Client|Hunt|CronJob)Approval from an AFF4 object."""
api_approval.id = approval_obj.urn.Basename()
api_approval.reason = approval_obj.Get(approval_obj.Schema.REASO... |
Initializes Api(Client|Hunt|CronJob)Approval from the database object.
def _InitApiApprovalFromDatabaseObject(api_approval, db_obj):
"""Initializes Api(Client|Hunt|CronJob)Approval from the database object."""
api_approval.id = db_obj.approval_id
api_approval.requestor = db_obj.requestor_username
api_approval... |
Initializes this object from an existing notification.
Args:
notification: A rdfvalues.flows.Notification object.
is_pending: Indicates whether the user has already seen this notification
or not.
Returns:
The current instance.
def InitFromNotification(self, notification, is_pending=... |
Gets all approvals for a given user and approval type.
Args:
approval_type: The type of approvals to get.
offset: The starting index within the collection.
count: The number of items to return.
filter_func: A predicate function, returning True if a specific approval
should be includ... |
Fetches and renders current user's settings.
def Handle(self, unused_args, token=None):
"""Fetches and renders current user's settings."""
result = ApiGrrUser(username=token.username)
if data_store.RelationalDBEnabled():
user_record = data_store.REL_DB.ReadGRRUser(token.username)
result.InitF... |
Deletes the notification from the pending notifications.
def Handle(self, args, token=None):
"""Deletes the notification from the pending notifications."""
if data_store.RelationalDBEnabled():
self.HandleRelationalDB(args, token=token)
else:
self.HandleLegacy(args, token=token) |
Schedules all system cron jobs.
def ScheduleSystemCronJobs(names=None):
"""Schedules all system cron jobs."""
errors = []
disabled_classes = config.CONFIG["Cron.disabled_cron_jobs"]
for name in disabled_classes:
try:
cls = registry.SystemCronJobRegistry.CronJobClassByName(name)
except ValueError... |
Starts a new run for the given cron job.
def StartRun(self, wait_for_start_event, signal_event, wait_for_write_event):
"""Starts a new run for the given cron job."""
# Signal that the cron thread has started. This way the cron scheduler
# will know that the task is not sitting in a threadpool queue, but is... |
Terminates a cronjob-run if it has exceeded its maximum runtime.
This is a no-op for cronjobs that allow overruns.
Raises:
LifetimeExceededError: If the cronjob has exceeded its maximum runtime.
def HeartBeat(self):
"""Terminates a cronjob-run if it has exceeded its maximum runtime.
This is a ... |
Creates a cron job that runs given flow with a given frequency.
Args:
cron_args: A protobuf of type rdf_cronjobs.CreateCronJobArgs.
job_id: Use this job_id instead of an autogenerated unique name (used for
system cron jobs - we want them to have well-defined persistent name).
enabled: If ... |
Returns a list of ids of all currently running cron jobs.
def ListJobs(self, token=None):
"""Returns a list of ids of all currently running cron jobs."""
del token
return [job.cron_job_id for job in data_store.REL_DB.ReadCronJobs()] |
Tries to lock and run cron jobs.
Args:
names: List of cron jobs to run. If unset, run them all.
token: security token.
Raises:
OneOrMoreCronJobsFailedError: if one or more individual cron jobs fail.
Note: a failure of a single cron job doesn't preclude other cron jobs
from runni... |
Cleans up job state if the last run is stuck.
def TerminateStuckRunIfNeeded(self, job):
"""Cleans up job state if the last run is stuck."""
if job.current_run_id and job.last_run_time and job.lifetime:
now = rdfvalue.RDFDatetime.Now()
# We add additional 10 minutes to give the job run a chance to k... |
Does the actual work of the Cron, if the job is due to run.
Args:
job: The cronjob rdfvalue that should be run. Must be leased.
Returns:
A boolean indicating if this cron job was started or not. False may
be returned when the threadpool is already full.
Raises:
LockError: if the o... |
Determines if the given job is due for another run.
Args:
job: The cron job rdfvalue object.
Returns:
True if it is time to run based on the specified frequency.
def JobDueToRun(self, job):
"""Determines if the given job is due for another run.
Args:
job: The cron job rdfvalue obje... |
Deletes runs that were started before the timestamp given.
def DeleteOldRuns(self, cutoff_timestamp=None):
"""Deletes runs that were started before the timestamp given."""
if cutoff_timestamp is None:
raise ValueError("cutoff_timestamp can't be None")
return data_store.REL_DB.DeleteOldCronJobRuns(
... |
Writes a list of message handler requests to the database.
def WriteMessageHandlerRequests(self, requests, cursor=None):
"""Writes a list of message handler requests to the database."""
query = ("INSERT IGNORE INTO message_handler_requests "
"(handlername, request_id, request) VALUES ")
value... |
Reads all message handler requests from the database.
def ReadMessageHandlerRequests(self, cursor=None):
"""Reads all message handler requests from the database."""
query = ("SELECT UNIX_TIMESTAMP(timestamp), request,"
" UNIX_TIMESTAMP(leased_until), leased_by "
"FROM message_h... |
Deletes a list of message handler requests from the database.
def DeleteMessageHandlerRequests(self, requests, cursor=None):
"""Deletes a list of message handler requests from the database."""
query = "DELETE FROM message_handler_requests WHERE request_id IN ({})"
request_ids = set([r.request_id for r in ... |
Leases a number of message handler requests up to the indicated limit.
def _LeaseMessageHandlerRequests(self, lease_time, limit, cursor=None):
"""Leases a number of message handler requests up to the indicated limit."""
now = rdfvalue.RDFDatetime.Now()
now_str = mysql_utils.RDFDatetimeToTimestamp(now)
... |
Reads all client messages available for a given client_id.
def ReadAllClientActionRequests(self, client_id, cursor=None):
"""Reads all client messages available for a given client_id."""
query = ("SELECT request, UNIX_TIMESTAMP(leased_until), leased_by, "
"leased_count "
"FROM client... |
Deletes a list of client messages from the db.
def DeleteClientActionRequests(self, requests):
"""Deletes a list of client messages from the db."""
if not requests:
return
to_delete = []
for r in requests:
to_delete.append((r.client_id, r.flow_id, r.request_id))
if len(set(to_delete))... |
Leases available client messages for the client with the given id.
def LeaseClientActionRequests(self,
client_id,
lease_time=None,
limit=None,
cursor=None):
"""Leases available client mes... |
Writes messages that should go to the client to the db.
def WriteClientActionRequests(self, requests, cursor=None):
"""Writes messages that should go to the client to the db."""
query = ("INSERT IGNORE INTO client_action_requests "
"(client_id, flow_id, request_id, timestamp, request) "
... |
Writes a flow object to the database.
def WriteFlowObject(self, flow_obj, cursor=None):
"""Writes a flow object to the database."""
query = """
INSERT INTO flows (client_id, flow_id, long_flow_id, parent_flow_id,
parent_hunt_id, flow, flow_state,
next_request_... |
Generates a flow object from a database row.
def _FlowObjectFromRow(self, row):
"""Generates a flow object from a database row."""
flow, fs, cci, pt, nr, pd, po, ps, uct, sct, nbs, nrs, ts, lut = row
flow_obj = rdf_flow_objects.Flow.FromSerializedString(flow)
if fs not in [None, rdf_flow_objects.Flow... |
Reads a flow object from the database.
def ReadFlowObject(self, client_id, flow_id, cursor=None):
"""Reads a flow object from the database."""
query = ("SELECT " + self.FLOW_DB_FIELDS +
"FROM flows WHERE client_id=%s AND flow_id=%s")
cursor.execute(
query,
[db_utils.ClientIDToI... |
Returns all flow objects.
def ReadAllFlowObjects(self,
client_id = None,
min_create_time = None,
max_create_time = None,
include_child_flows = True,
cursor=None):
"""Returns all flow objects... |
Reads flows that were started by a given flow from the database.
def ReadChildFlowObjects(self, client_id, flow_id, cursor=None):
"""Reads flows that were started by a given flow from the database."""
query = ("SELECT " + self.FLOW_DB_FIELDS +
"FROM flows WHERE client_id=%s AND parent_flow_id=%s")... |
Marks a flow as being processed on this worker and returns it.
def LeaseFlowForProcessing(self,
client_id,
flow_id,
processing_time,
cursor=None):
"""Marks a flow as being processed on this worker an... |
Updates flow objects in the database.
def UpdateFlow(self,
client_id,
flow_id,
flow_obj=db.Database.unchanged,
flow_state=db.Database.unchanged,
client_crash_info=db.Database.unchanged,
pending_termination=db.Database... |
Updates flow objects in the database.
def UpdateFlows(self,
client_id_flow_id_pairs,
pending_termination=db.Database.unchanged,
cursor=None):
"""Updates flow objects in the database."""
if pending_termination == db.Database.unchanged:
return
ser... |
Returns a (query, args) tuple that inserts the given requests.
def _WriteFlowProcessingRequests(self, requests, cursor):
"""Returns a (query, args) tuple that inserts the given requests."""
templates = []
args = []
for req in requests:
templates.append("(%s, %s, %s, FROM_UNIXTIME(%s))")
arg... |
Writes a list of flow requests to the database.
def WriteFlowRequests(self, requests, cursor=None):
"""Writes a list of flow requests to the database."""
args = []
templates = []
flow_keys = []
needs_processing = {}
for r in requests:
if r.needs_processing:
needs_processing.setde... |
Builds the writes to store the given responses in the db.
def _WriteResponses(self, responses, cursor):
"""Builds the writes to store the given responses in the db."""
query = ("INSERT IGNORE INTO flow_responses "
"(client_id, flow_id, request_id, response_id, "
"response, status, it... |
Builds deletes for client messages.
def _DeleteClientActionRequest(self, to_delete, cursor=None):
"""Builds deletes for client messages."""
query = "DELETE FROM client_action_requests WHERE "
conditions = []
args = []
for client_id, flow_id, request_id in to_delete:
conditions.append("(clien... |
Writes a flow responses and updates flow requests expected counts.
def _WriteFlowResponsesAndExpectedUpdates(self, responses, cursor=None):
"""Writes a flow responses and updates flow requests expected counts."""
self._WriteResponses(responses, cursor)
query = """
UPDATE flow_requests
SET res... |
Reads counts of responses for the given requests.
def _ReadFlowResponseCounts(self, request_keys, cursor=None):
"""Reads counts of responses for the given requests."""
query = """
SELECT
flow_requests.client_id, flow_requests.flow_id,
flow_requests.request_id, COUNT(*)
FROM flow_re... |
Reads and locks the next_request_to_process for a number of flows.
def _ReadAndLockNextRequestsToProcess(self, flow_keys, cursor):
"""Reads and locks the next_request_to_process for a number of flows."""
query = """
SELECT client_id, flow_id, next_request_to_process
FROM flows
WHERE {conditi... |
Reads, locks, and updates completed requests.
def _ReadLockAndUpdateCompletedRequests(self, request_keys, response_counts,
cursor):
"""Reads, locks, and updates completed requests."""
condition_template = """
(flow_requests.client_id = %s AND
flow_request... |
Updates requests and writes FlowProcessingRequests if needed.
def _UpdateRequestsAndScheduleFPRs(self, responses, cursor=None):
"""Updates requests and writes FlowProcessingRequests if needed."""
request_keys = set(
(r.client_id, r.flow_id, r.request_id) for r in responses)
flow_keys = set((r.clie... |
Writes FlowMessages and updates corresponding requests.
def WriteFlowResponses(self, responses):
"""Writes FlowMessages and updates corresponding requests."""
if not responses:
return
for batch in collection.Batch(responses, self._WRITE_ROWS_BATCH_SIZE):
self._WriteFlowResponsesAndExpectedUp... |
Deletes a list of flow requests from the database.
def DeleteFlowRequests(self, requests, cursor=None):
"""Deletes a list of flow requests from the database."""
if not requests:
return
conditions = []
args = []
for r in requests:
conditions.append("(client_id=%s AND flow_id=%s AND requ... |
Deletes all requests and responses for a given flow from the database.
def DeleteAllFlowRequestsAndResponses(self, client_id, flow_id, cursor=None):
"""Deletes all requests and responses for a given flow from the database."""
args = [db_utils.ClientIDToInt(client_id), db_utils.FlowIDToInt(flow_id)]
res_que... |
Reads all requests for a flow that can be processed by the worker.
def ReadFlowRequestsReadyForProcessing(self,
client_id,
flow_id,
next_needed_request,
cu... |
Releases a flow that the worker was processing to the database.
def ReleaseProcessedFlow(self, flow_obj, cursor=None):
"""Releases a flow that the worker was processing to the database."""
update_query = """
UPDATE flows
LEFT OUTER JOIN (
SELECT client_id, flow_id, needs_processing
FROM fl... |
Reads all flow processing requests from the database.
def ReadFlowProcessingRequests(self, cursor=None):
"""Reads all flow processing requests from the database."""
query = ("SELECT request, UNIX_TIMESTAMP(timestamp) "
"FROM flow_processing_requests")
cursor.execute(query)
res = []
fo... |
Deletes a list of flow processing requests from the database.
def AckFlowProcessingRequests(self, requests, cursor=None):
"""Deletes a list of flow processing requests from the database."""
if not requests:
return
query = "DELETE FROM flow_processing_requests WHERE "
conditions = []
args = ... |
Leases a number of flow processing requests.
def _LeaseFlowProcessingReqests(self, cursor=None):
"""Leases a number of flow processing requests."""
now = rdfvalue.RDFDatetime.Now()
expiry = now + rdfvalue.Duration("10m")
query = """
UPDATE flow_processing_requests
SET leased_until=FROM_UNI... |
The main loop for the flow processing request queue.
def _FlowProcessingRequestHandlerLoop(self, handler):
"""The main loop for the flow processing request queue."""
while not self.flow_processing_request_handler_stop:
try:
msgs = self._LeaseFlowProcessingReqests()
if msgs:
for ... |
Registers a handler to receive flow processing messages.
def RegisterFlowProcessingHandler(self, handler):
"""Registers a handler to receive flow processing messages."""
self.UnregisterFlowProcessingHandler()
if handler:
self.flow_processing_request_handler_stop = False
self.flow_processing_re... |
Unregisters any registered flow processing handler.
def UnregisterFlowProcessingHandler(self, timeout=None):
"""Unregisters any registered flow processing handler."""
if self.flow_processing_request_handler_thread:
self.flow_processing_request_handler_stop = True
self.flow_processing_request_handle... |
Writes flow results for a given flow.
def WriteFlowResults(self, results, cursor=None):
"""Writes flow results for a given flow."""
query = ("INSERT INTO flow_results "
"(client_id, flow_id, hunt_id, timestamp, payload, type, tag) "
"VALUES ")
templates = []
args = []
for... |
Reads flow results of a given flow using given query options.
def ReadFlowResults(self,
client_id,
flow_id,
offset,
count,
with_tag=None,
with_type=None,
with_substr... |
Counts flow results of a given flow using given query options.
def CountFlowResults(self,
client_id,
flow_id,
with_tag=None,
with_type=None,
cursor=None):
"""Counts flow results of a given flow using ... |
Returns counts of flow results grouped by result type.
def CountFlowResultsByType(self, client_id, flow_id, cursor=None):
"""Returns counts of flow results grouped by result type."""
query = ("SELECT type, COUNT(*) FROM flow_results "
"FORCE INDEX (flow_results_by_client_id_flow_id_timestamp) "
... |
Reads flow log entries of a given flow using given query options.
def ReadFlowLogEntries(self,
client_id,
flow_id,
offset,
count,
with_substring=None,
cursor=None):
... |
Returns number of flow log entries of a given flow.
def CountFlowLogEntries(self, client_id, flow_id, cursor=None):
"""Returns number of flow log entries of a given flow."""
query = ("SELECT COUNT(*) "
"FROM flow_log_entries "
"FORCE INDEX (flow_log_entries_by_flow) "
"W... |
Writes flow output plugin log entries for a given flow.
def WriteFlowOutputPluginLogEntries(self, entries, cursor=None):
"""Writes flow output plugin log entries for a given flow."""
query = ("INSERT INTO flow_output_plugin_log_entries "
"(client_id, flow_id, hunt_id, output_plugin_id, "
... |
Reads flow output plugin log entries.
def ReadFlowOutputPluginLogEntries(self,
client_id,
flow_id,
output_plugin_id,
offset,
count,
... |
Returns number of flow output plugin log entries of a given flow.
def CountFlowOutputPluginLogEntries(self,
client_id,
flow_id,
output_plugin_id,
with_type=None,
... |
Evaluates rules held in the rule set.
Args:
client_obj: Either an aff4 client object or a client_info dict as returned
by ReadFullInfoClient if the relational db is used for reading.
Returns:
A bool value of the evaluation.
Raises:
ValueError: The match mode is of unknown value.... |
Writes user object for a user with a given name.
def WriteGRRUser(self,
username,
password=None,
ui_mode=None,
canary_mode=None,
user_type=None):
"""Writes user object for a user with a given name."""
u = self.users.... |
Reads a user object corresponding to a given name.
def ReadGRRUser(self, username):
"""Reads a user object corresponding to a given name."""
try:
return self.users[username].Copy()
except KeyError:
raise db.UnknownGRRUserError(username) |
Reads GRR users with optional pagination, sorted by username.
def ReadGRRUsers(self, offset=0, count=None):
"""Reads GRR users with optional pagination, sorted by username."""
if count is None:
count = len(self.users)
users = sorted(self.users.values(), key=lambda user: user.username)
return [us... |
Deletes the user and all related metadata with the given username.
def DeleteGRRUser(self, username):
"""Deletes the user and all related metadata with the given username."""
try:
del self.approvals_by_username[username]
except KeyError:
pass # No approvals to delete for this user.
for ap... |
Writes an approval request object.
def WriteApprovalRequest(self, approval_request):
"""Writes an approval request object."""
approvals = self.approvals_by_username.setdefault(
approval_request.requestor_username, {})
approval_id = str(os.urandom(16).encode("hex"))
cloned_request = approval_re... |
Reads an approval request object with a given id.
def ReadApprovalRequest(self, requestor_username, approval_id):
"""Reads an approval request object with a given id."""
try:
return self.approvals_by_username[requestor_username][approval_id]
except KeyError:
raise db.UnknownApprovalRequestError... |
Reads approval requests of a given type for a given user.
def ReadApprovalRequests(self,
requestor_username,
approval_type,
subject_id=None,
include_expired=False):
"""Reads approval requests of a given type... |
Grants approval for a given request using given username.
def GrantApproval(self, requestor_username, approval_id, grantor_username):
"""Grants approval for a given request using given username."""
try:
approval = self.approvals_by_username[requestor_username][approval_id]
approval.grants.append(
... |
Writes a notification for a given user.
def WriteUserNotification(self, notification):
"""Writes a notification for a given user."""
if notification.username not in self.users:
raise db.UnknownGRRUserError(notification.username)
cloned_notification = notification.Copy()
if not cloned_notificatio... |
Reads notifications scheduled for a user within a given timerange.
def ReadUserNotifications(self, username, state=None, timerange=None):
"""Reads notifications scheduled for a user within a given timerange."""
from_time, to_time = self._ParseTimeRange(timerange)
result = []
for n in self.notification... |
Updates existing user notification objects.
def UpdateUserNotifications(self, username, timestamps, state=None):
"""Updates existing user notification objects."""
if not timestamps:
return
for n in self.notifications_by_username.get(username, []):
if n.timestamp in timestamps:
n.state ... |
Converts FileFinderSizeConditions to RegistryFinderConditions.
def _ConditionsToFileFinderConditions(conditions):
"""Converts FileFinderSizeConditions to RegistryFinderConditions."""
ff_condition_type_cls = rdf_file_finder.FileFinderCondition.Type
result = []
for c in conditions:
if c.condition_type == Reg... |
Strips type information from rendered data. Useful for debugging.
def StripTypeInfo(rendered_data):
"""Strips type information from rendered data. Useful for debugging."""
if isinstance(rendered_data, (list, tuple)):
return [StripTypeInfo(d) for d in rendered_data]
elif isinstance(rendered_data, dict):
... |
Render given RDFValue as plain old python objects.
def RenderValue(value, limit_lists=-1):
"""Render given RDFValue as plain old python objects."""
if value is None:
return None
renderer = ApiValueRenderer.GetRendererForValueOrClass(
value, limit_lists=limit_lists)
return renderer.RenderValue(value... |
Returns renderer corresponding to a given value and rendering args.
def GetRendererForValueOrClass(cls, value, limit_lists=-1):
"""Returns renderer corresponding to a given value and rendering args."""
if inspect.isclass(value):
value_cls = value
else:
value_cls = value.__class__
cache_ke... |
Renders default value of a given class.
Args:
value_cls: Default value of this class will be rendered. This class has to
be (or to be a subclass of) a self.value_class (i.e. a class that this
renderer is capable of rendering).
Returns:
An initialized default value.
Raises:
... |
Renders metadata of a given value class.
Args:
value_cls: Metadata of this class will be rendered. This class has to be
(or to be a subclass of) a self.value_class (i.e. a class that this
renderer is capable of rendering).
Returns:
Dictionary with class metadata.
def BuildTypeDesc... |
Renders GrrMessage payload and renames args_rdf_name field.
def RenderPayload(self, result, value):
"""Renders GrrMessage payload and renames args_rdf_name field."""
if "args_rdf_name" in result:
result["payload_type"] = result["args_rdf_name"]
del result["args_rdf_name"]
if "args" in result:
... |
Payload-aware metadata processor.
def AdjustDescriptor(self, fields):
"""Payload-aware metadata processor."""
for f in fields:
if f.name == "args_rdf_name":
f.name = "payload_type"
if f.name == "args":
f.name = "payload"
return fields |
Takes the plist contents generated by binplist and returns a plain dict.
binplist uses rich types to express some of the plist types. We need to
convert them to types that RDFValueArray will be able to transport.
Args:
plist: A plist to convert.
Returns:
A simple python type.
def PlistValueToPlainVa... |
StringFinish doesn't act on ATTRIBUTEs here.
def StringFinish(self, **_):
"""StringFinish doesn't act on ATTRIBUTEs here."""
if self.state == "ARG":
return self.InsertArg(string=self.string) |
Adds a path component to the current attribute.
def AddAttributePath(self, **_):
"""Adds a path component to the current attribute."""
attribute_path = self.current_expression.attribute
if not attribute_path:
attribute_path = []
attribute_path.append(self.string)
self.current_expression.SetA... |
Makes dictionaries expandable when dealing with plists.
def _AtNonLeaf(self, attr_value, path):
"""Makes dictionaries expandable when dealing with plists."""
if isinstance(attr_value, dict):
for value in self.Expand(attr_value, path[1:]):
yield value
else:
for v in objectfilter.ValueExp... |
Returns a list of MetricMetadata for GRR server components.
def GetMetadata():
"""Returns a list of MetricMetadata for GRR server components."""
return [
# GRR user-management metrics.
stats_utils.CreateEventMetadata(
"acl_check_time", fields=[("check_type", str)]),
stats_utils.CreateCo... |
Parses a YAML source into a Python object.
Args:
text: A YAML source to parse.
Returns:
A Python data structure corresponding to the YAML source.
def Parse(text):
"""Parses a YAML source into a Python object.
Args:
text: A YAML source to parse.
Returns:
A Python data structure correspondi... |
Parses many YAML documents into a list of Python objects.
Args:
text: A YAML source with multiple documents embedded.
Returns:
A list of Python data structures corresponding to the YAML documents.
def ParseMany(text):
"""Parses many YAML documents into a list of Python objects.
Args:
text: A YAM... |
Reads a Python object stored in a specified YAML file.
Args:
filepath: A filepath to the YAML file.
Returns:
A Python data structure corresponding to the YAML in the given file.
def ReadFromPath(filepath):
"""Reads a Python object stored in a specified YAML file.
Args:
filepath: A filepath to th... |
Reads a Python object stored in a specified YAML file.
Args:
filepath: A filepath to the YAML file.
Returns:
A Python data structure corresponding to the YAML in the given file.
def ReadManyFromPath(filepath):
"""Reads a Python object stored in a specified YAML file.
Args:
filepath: A filepath t... |
Stringifies a Python object into its YAML representation.
Args:
obj: A Python object to convert to YAML.
Returns:
A YAML representation of the given object.
def Dump(obj):
"""Stringifies a Python object into its YAML representation.
Args:
obj: A Python object to convert to YAML.
Returns:
... |
Stringifies a sequence of Python objects to a multi-document YAML.
Args:
objs: An iterable of Python objects to convert to YAML.
Returns:
A multi-document YAML representation of the given objects.
def DumpMany(objs):
"""Stringifies a sequence of Python objects to a multi-document YAML.
Args:
obj... |
Serializes and writes given Python object to the specified YAML file.
Args:
obj: A Python object to serialize.
filepath: A path to the file into which the object is to be written.
def WriteToPath(obj, filepath):
"""Serializes and writes given Python object to the specified YAML file.
Args:
obj: A P... |
Serializes and writes given Python objects to a multi-document YAML file.
Args:
objs: An iterable of Python objects to serialize.
filepath: A path to the file into which the object is to be written.
def WriteManyToPath(objs, filepath):
"""Serializes and writes given Python objects to a multi-document YAML... |
Creates Windows paths detector.
Commandline strings can be space separated and contain options.
e.g. C:\\Program Files\\ACME Corporation\\wiz.exe /quiet /blah
See here for microsoft doco on commandline parsing:
http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx
Args:
vars_ma... |
Detects paths in a list of Windows Registry strings.
Args:
source_values: A list of strings to detect paths in.
vars_map: Dictionary of "string" -> "string|list", i.e. a mapping of
environment variables names to their suggested values or to lists
of their suggested values.
Yields:
... |
Extracts interesting paths from a given path.
Args:
components: Source string represented as a list of components.
Returns:
A list of extracted paths (as strings).
def Extract(self, components):
"""Extracts interesting paths from a given path.
Args:
components: Source string repres... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.