_id stringlengths 2 7 | title stringlengths 1 88 | partition stringclasses 3
values | text stringlengths 31 13.1k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q25200 | Event.invoke_webhook_handlers | train | def invoke_webhook_handlers(self):
"""
Invokes any webhook handlers that have been registered for this event
based on event type or event sub-type.
See event handlers registered in the ``djstripe.event_handlers`` module
(or handlers registered in djstripe plugins or contrib packages).
""" | python | {
"resource": ""
} |
q25201 | sync_subscriber | train | def sync_subscriber(subscriber):
"""Sync a Customer with Stripe api data."""
customer, _created = Customer.get_or_create(subscriber=subscriber)
try:
customer.sync_from_stripe_data(customer.api_retrieve()) | python | {
"resource": ""
} |
q25202 | get_callback_function | train | def get_callback_function(setting_name, default=None):
"""
Resolve a callback function based on a setting name.
If the setting value isn't set, default is returned. If the setting value
is already a callable function, that value is used - If the setting value
is a string, an attempt is made to import it. Anythi... | python | {
"resource": ""
} |
q25203 | get_subscriber_model | train | def get_subscriber_model():
"""
Attempt to pull settings.DJSTRIPE_SUBSCRIBER_MODEL.
Users have the option of specifying a custom subscriber model via the
DJSTRIPE_SUBSCRIBER_MODEL setting.
This methods falls back to AUTH_USER_MODEL if DJSTRIPE_SUBSCRIBER_MODEL is not set.
Returns the subscriber model that is a... | python | {
"resource": ""
} |
q25204 | set_stripe_api_version | train | def set_stripe_api_version(version=None, validate=True):
"""
Set the desired API version to use for Stripe requests.
:param version: The version to set for the Stripe API.
:type version: ``str``
:param validate: If True validate the value for the specified version).
:type validate: ``bool``
"""
version = | python | {
"resource": ""
} |
q25205 | Command.handle | train | def handle(self, *args, **options):
"""Call sync_subscriber on Subscribers without customers associated to them."""
qs = get_subscriber_model().objects.filter(djstripe_customers__isnull=True)
count = 0
total = qs.count()
for subscriber in qs:
count += 1
perc = int(round(100 * (float(count) / float(total... | python | {
"resource": ""
} |
q25206 | AnalysisProcess._ProcessEvent | train | def _ProcessEvent(self, mediator, event):
"""Processes an event.
Args:
mediator (AnalysisMediator): mediates interactions between
analysis plugins and other components, such as storage and dfvfs.
event (EventObject): event.
"""
try:
self._analysis_plugin.ExamineEvent(mediato... | python | {
"resource": ""
} |
q25207 | GoogleDriveSyncLogParser._GetISO8601String | train | def _GetISO8601String(self, structure):
"""Retrieves an ISO 8601 date time string from the structure.
The date and time values in Google Drive Sync log files are formatted as:
"2018-01-24 18:25:08,454 -0800".
Args:
structure (pyparsing.ParseResults): structure of tokens derived from a
... | python | {
"resource": ""
} |
q25208 | GoogleDriveSyncLogParser._ParseRecordLogline | train | def _ParseRecordLogline(self, parser_mediator, structure):
"""Parses a logline record structure and produces events.
Args:
parser_mediator (ParserMediator): mediates interactions between parsers
and other components, such as storage and dfvfs.
structure (pyparsing.ParseResults): structure... | python | {
"resource": ""
} |
q25209 | GoogleDriveSyncLogParser.VerifyStructure | train | def VerifyStructure(self, parser_mediator, lines):
"""Verify that this file is a Google Drive Sync log file.
Args:
parser_mediator (ParserMediator): mediates interactions between parsers
and other components, such as storage and dfvfs.
lines (str): one or more lines from the text file.
... | python | {
"resource": ""
} |
q25210 | BaseGoogleChromeHistoryPlugin._GetVisitSource | train | def _GetVisitSource(self, visit_identifier, cache, database):
"""Retrieves a visit source type based on the identifier.
Args:
visit_identifier (str): identifier from the visits table for the
particular record.
cache (SQLiteCache): cache which contains cached results from querying
... | python | {
"resource": ""
} |
q25211 | BaseGoogleChromeHistoryPlugin.ParseLastVisitedRow | train | def ParseLastVisitedRow(
self, parser_mediator, query, row, cache=None, database=None,
**unused_kwargs):
"""Parses a last visited row.
Args:
parser_mediator (ParserMediator): mediates interactions between parsers
and other components, such as storage and dfvfs.
query (str): qu... | python | {
"resource": ""
} |
q25212 | GoogleChrome27HistoryPlugin.ParseFileDownloadedRow | train | def ParseFileDownloadedRow(
self, parser_mediator, query, row, **unused_kwargs):
"""Parses a file downloaded row.
Args:
parser_mediator (ParserMediator): mediates interactions between parsers
and other components, such as storage and dfvfs.
query (str): query that created the row.
... | python | {
"resource": ""
} |
q25213 | CLITool._EnforceProcessMemoryLimit | train | def _EnforceProcessMemoryLimit(self, memory_limit):
"""Enforces a process memory limit.
Args:
memory_limit (int): maximum number of bytes the process is allowed
to allocate, where 0 represents no limit and None a default of
4 GiB.
"""
# Resource is not supported on Windows.
| python | {
"resource": ""
} |
q25214 | CLITool._ParseLogFileOptions | train | def _ParseLogFileOptions(self, options):
"""Parses the log file options.
Args:
options (argparse.Namespace): command line arguments.
"""
self._log_file = self.ParseStringOption(options, 'log_file')
if not self._log_file:
local_date_time = datetime.datetime.now()
self._log_file = (... | python | {
"resource": ""
} |
q25215 | CLITool._ParseTimezoneOption | train | def _ParseTimezoneOption(self, options):
"""Parses the timezone options.
Args:
options (argparse.Namespace): command line arguments.
Raises:
BadConfigOption: if the options are invalid.
"""
time_zone_string = self.ParseStringOption(options, 'timezone')
if isinstance(time_zone_strin... | python | {
"resource": ""
} |
q25216 | CLITool._PromptUserForInput | train | def _PromptUserForInput(self, input_text):
"""Prompts user for an input.
Args:
input_text (str): text used for prompting the | python | {
"resource": ""
} |
q25217 | CLITool.AddBasicOptions | train | def AddBasicOptions(self, argument_group):
"""Adds the basic options to the argument group.
Args:
argument_group (argparse._ArgumentGroup): argparse argument group.
"""
version_string = self.GetVersionInformation()
# We want a custom help message and not the default argparse one.
argumen... | python | {
"resource": ""
} |
q25218 | CLITool.AddInformationalOptions | train | def AddInformationalOptions(self, argument_group):
"""Adds the informational options to the argument group.
Args:
argument_group (argparse._ArgumentGroup): argparse argument group.
"""
| python | {
"resource": ""
} |
q25219 | CLITool.AddLogFileOptions | train | def AddLogFileOptions(self, argument_group):
"""Adds the log file option to the argument group.
Args:
argument_group (argparse._ArgumentGroup): argparse argument group.
"""
argument_group.add_argument(
'--logfile', '--log_file', '--log-file', action='store',
metavar='FILENAME', de... | python | {
"resource": ""
} |
q25220 | CLITool.AddTimeZoneOption | train | def AddTimeZoneOption(self, argument_group):
"""Adds the time zone option to the argument group.
Args:
argument_group (argparse._ArgumentGroup): argparse argument group.
"""
# Note the default here is None so we can determine if the time zone
# option was set.
argument_group.add_argument(... | python | {
"resource": ""
} |
q25221 | CLITool.GetCommandLineArguments | train | def GetCommandLineArguments(self):
"""Retrieves the command line arguments.
Returns:
str: command line arguments.
"""
command_line_arguments = sys.argv
if not command_line_arguments:
return ''
if isinstance(command_line_arguments[0], py2to3.BYTES_TYPE):
encoding = sys.stdin.e... | python | {
"resource": ""
} |
q25222 | CLITool.ListTimeZones | train | def ListTimeZones(self):
"""Lists the timezones."""
max_length = 0
for timezone_name in pytz.all_timezones:
if len(timezone_name) > max_length:
max_length = len(timezone_name)
utc_date_time = datetime.datetime.utcnow()
table_view = views.ViewsFactory.GetTableView(
self._views... | python | {
"resource": ""
} |
q25223 | CLITool.ParseNumericOption | train | def ParseNumericOption(self, options, name, base=10, default_value=None):
"""Parses a numeric option.
If the option is not set the default value is returned.
Args:
options (argparse.Namespace): command line arguments.
name (str): name of the numeric option.
base (Optional[int]): base of ... | python | {
"resource": ""
} |
q25224 | CLITool.PrintSeparatorLine | train | def PrintSeparatorLine(self):
"""Prints a separator line."""
| python | {
"resource": ""
} |
q25225 | _ImportPythonModule | train | def _ImportPythonModule(module_name):
"""Imports a Python module.
Args:
module_name (str): name of the module.
Returns:
module: Python module or None if the module cannot be imported.
"""
try:
module_object = list(map(__import__, | python | {
"resource": ""
} |
q25226 | ChromeCacheIndexFileParser._ParseIndexTable | train | def _ParseIndexTable(self, file_object):
"""Parses the index table.
Args:
file_object (dfvfs.FileIO): a file-like object to parse.
Raises:
ParseError: if the index table cannot be read.
"""
cache_address_map = self._GetDataTypeMap('uint32le')
file_offset = file_object.get_offset()
... | python | {
"resource": ""
} |
q25227 | ChromeCacheIndexFileParser.ParseFileObject | train | def ParseFileObject(self, parser_mediator, file_object):
"""Parses a file-like object.
Args:
parser_mediator (ParserMediator): a parser mediator.
file_object (dfvfs.FileIO): a file-like object to parse.
Raises:
ParseError: when the file cannot be parsed.
"""
try:
self._Pars... | python | {
"resource": ""
} |
q25228 | ChromeCacheDataBlockFileParser._ParseFileHeader | train | def _ParseFileHeader(self, file_object):
"""Parses the file header.
Args:
file_object (dfvfs.FileIO): a file-like object to parse.
Raises:
ParseError: if the file header cannot be read.
"""
file_header_map = self._GetDataTypeMap(
'chrome_cache_data_block_file_header')
try:... | python | {
"resource": ""
} |
q25229 | ChromeCacheParser._ParseCacheEntries | train | def _ParseCacheEntries(self, parser_mediator, index_table, data_block_files):
"""Parses Chrome Cache file entries.
Args:
parser_mediator (ParserMediator): mediates interactions between parsers
and other components, such as storage and dfvfs.
index_table (list[CacheAddress]): the cache add... | python | {
"resource": ""
} |
q25230 | ChromeCacheParser._ParseIndexTable | train | def _ParseIndexTable(
self, parser_mediator, file_system, file_entry, index_table):
"""Parses a Chrome Cache index table.
Args:
parser_mediator (ParserMediator): mediates interactions between parsers
and other components, such as storage and dfvfs.
file_system (dfvfs.FileSystem): fi... | python | {
"resource": ""
} |
q25231 | ChromeCacheParser.ParseFileEntry | train | def ParseFileEntry(self, parser_mediator, file_entry):
"""Parses Chrome Cache files.
Args:
parser_mediator (ParserMediator): mediates interactions between parsers
and other components, such as storage and dfvfs.
file_entry (dfvfs.FileEntry): file entry.
Raises:
UnableToParseFil... | python | {
"resource": ""
} |
q25232 | XLSXOutputModule._FormatDateTime | train | def _FormatDateTime(self, event):
"""Formats the date to a datetime object without timezone information.
Note: timezone information must be removed due to lack of support
by xlsxwriter and Excel.
Args:
event (EventObject): event.
Returns:
datetime.datetime|str: date and time value or ... | python | {
"resource": ""
} |
q25233 | XLSXOutputModule._RemoveIllegalXMLCharacters | train | def _RemoveIllegalXMLCharacters(self, xml_string):
"""Removes illegal characters for XML.
If the input is not a string it will be returned unchanged.
Args:
xml_string (str): XML | python | {
"resource": ""
} |
q25234 | XLSXOutputModule.Open | train | def Open(self):
"""Creates a new workbook.
Raises:
IOError: if the specified output file already exists.
OSError: if the specified output file already exists.
ValueError: if the filename is not set.
"""
if not self._filename:
raise ValueError('Missing filename.')
if os.path... | python | {
"resource": ""
} |
q25235 | XLSXOutputModule.WriteEventBody | train | def WriteEventBody(self, event):
"""Writes the body of an event object to the spreadsheet.
Args:
event (EventObject): event.
"""
for field_name in self._fields:
if field_name == 'datetime':
output_value = self._FormatDateTime(event)
else:
output_value = self._dynamic_f... | python | {
"resource": ""
} |
q25236 | XLSXOutputModule.WriteHeader | train | def WriteHeader(self):
"""Writes the header to the spreadsheet."""
self._column_widths = {}
bold = self._workbook.add_format({'bold': True})
bold.set_align('center')
for index, field_name in enumerate(self._fields):
self._sheet.write(self._current_row, index, field_name, bold)
| python | {
"resource": ""
} |
q25237 | ApacheAccessParser.VerifyStructure | train | def VerifyStructure(self, parser_mediator, line):
"""Verifies that this is an apache access log file.
Args:
parser_mediator (ParserMediator): mediates interactions between parsers
and other components, such as storage and dfvfs.
line (str): line from the text file.
Returns: | python | {
"resource": ""
} |
q25238 | SkypePlugin.ParseAccountInformation | train | def ParseAccountInformation(
self, parser_mediator, query, row, **unused_kwargs):
"""Parses account information.
Args:
parser_mediator (ParserMediator): mediates interactions between parsers
and other components, such as storage and dfvfs.
query (str): query that created the row.
... | python | {
"resource": ""
} |
q25239 | SkypePlugin.ParseChat | train | def ParseChat(self, parser_mediator, query, row, **unused_kwargs):
"""Parses a chat message.
Args:
parser_mediator (ParserMediator): mediates interactions between parsers
and other components, such as storage and dfvfs.
query (str): query that created the row.
row (sqlite3.Row): row... | python | {
"resource": ""
} |
q25240 | SkypePlugin.ParseSMS | train | def ParseSMS(self, parser_mediator, query, row, **unused_kwargs):
"""Parses an SMS.
Args:
parser_mediator (ParserMediator): mediates interactions between parsers
and other components, such as storage and dfvfs.
query (str): query that created the row.
row (sqlite3.Row): row resultin... | python | {
"resource": ""
} |
q25241 | SkypePlugin.ParseCall | train | def ParseCall(self, parser_mediator, query, row, **unused_kwargs):
"""Parses a call.
Args:
parser_mediator (ParserMediator): mediates interactions between parsers
and other components, such as storage and dfvfs.
query (str): query that created the row.
row (sqlite3.Row): row resulti... | python | {
"resource": ""
} |
q25242 | ProcessInfo.GetUsedMemory | train | def GetUsedMemory(self):
"""Retrieves the amount of memory used by the process.
Returns:
int: amount of memory in bytes used by the process or None
if not available.
"""
try:
memory_info = self._process.memory_info()
except psutil.NoSuchProcess:
return None
# Psutil... | python | {
"resource": ""
} |
q25243 | AirportPlugin.GetEntries | train | def GetEntries(self, parser_mediator, match=None, **unused_kwargs):
"""Extracts relevant Airport entries.
Args:
parser_mediator (ParserMediator): mediates interactions between parsers
and other components, such as storage and dfvfs.
match (Optional[dict[str: object]]): keys extracted from... | python | {
"resource": ""
} |
q25244 | MactimeParser._GetIntegerValue | train | def _GetIntegerValue(self, row, value_name):
"""Converts a specific value of the row to an integer.
Args:
row (dict[str, str]): fields of a single row, as specified in COLUMNS.
value_name (str): name of the value within the row.
Returns:
int: value or None if the value cannot be | python | {
"resource": ""
} |
q25245 | ChromeAutofillPlugin.ParseAutofillRow | train | def ParseAutofillRow(
self, parser_mediator, query, row, **unused_kwargs):
"""Parses an autofill entry row.
Args:
parser_mediator (ParserMediator): mediates interactions between parsers
and other components, such as storage and dfvfs.
query (str): query that created the row.
r... | python | {
"resource": ""
} |
q25246 | MultiProcessEngine._AbortJoin | train | def _AbortJoin(self, timeout=None):
"""Aborts all registered processes by joining with the parent process.
Args:
timeout (int): number of seconds to wait for processes to join, where
None represents no timeout.
"""
for pid, process in iter(self._processes_per_pid.items()):
logger.... | python | {
"resource": ""
} |
q25247 | MultiProcessEngine._AbortKill | train | def _AbortKill(self):
"""Aborts all registered processes by sending a SIGKILL or equivalent."""
for pid, process in iter(self._processes_per_pid.items()):
if not process.is_alive():
continue | python | {
"resource": ""
} |
q25248 | MultiProcessEngine._AbortTerminate | train | def _AbortTerminate(self):
"""Aborts all registered processes by sending a SIGTERM or equivalent."""
for pid, process in iter(self._processes_per_pid.items()):
if not process.is_alive():
continue | python | {
"resource": ""
} |
q25249 | MultiProcessEngine._CheckStatusWorkerProcess | train | def _CheckStatusWorkerProcess(self, pid):
"""Checks the status of a worker process.
If a worker process is not responding the process is terminated and
a replacement process is started.
Args:
pid (int): process ID (PID) of a registered worker process.
Raises:
KeyError: if the process ... | python | {
"resource": ""
} |
q25250 | MultiProcessEngine._KillProcess | train | def _KillProcess(self, pid):
"""Issues a SIGKILL or equivalent to the process.
Args:
pid (int): process identifier (PID).
"""
if sys.platform.startswith('win'):
process_terminate = 1
handle = ctypes.windll.kernel32.OpenProcess(
process_terminate, False, pid)
ctypes.win... | python | {
"resource": ""
} |
q25251 | MultiProcessEngine._QueryProcessStatus | train | def _QueryProcessStatus(self, process):
"""Queries a process to determine its status.
Args:
process (MultiProcessBaseProcess): process to query for its status.
Returns:
dict[str, str]: status values | python | {
"resource": ""
} |
q25252 | MultiProcessEngine._RegisterProcess | train | def _RegisterProcess(self, process):
"""Registers a process with the engine.
Args:
process (MultiProcessBaseProcess): process.
Raises:
KeyError: if the process is already registered with the engine.
ValueError: if the process is missing.
"""
if process is None:
raise ValueE... | python | {
"resource": ""
} |
q25253 | MultiProcessEngine._StartMonitoringProcess | train | def _StartMonitoringProcess(self, process):
"""Starts monitoring a process.
Args:
process (MultiProcessBaseProcess): process.
Raises:
IOError: if the RPC client cannot connect to the server.
KeyError: if the process is not registered with the engine or
if the process is already... | python | {
"resource": ""
} |
q25254 | MultiProcessEngine._StartStatusUpdateThread | train | def _StartStatusUpdateThread(self):
"""Starts the status update thread."""
self._status_update_active = True
self._status_update_thread = threading.Thread(
name='Status | python | {
"resource": ""
} |
q25255 | MultiProcessEngine._StopMonitoringProcess | train | def _StopMonitoringProcess(self, process):
"""Stops monitoring a process.
Args:
process (MultiProcessBaseProcess): process.
Raises:
KeyError: if the process is not monitored.
ValueError: if the process is missing.
"""
if process is None:
raise ValueError('Missing process.')... | python | {
"resource": ""
} |
q25256 | MultiProcessEngine._StopMonitoringProcesses | train | def _StopMonitoringProcesses(self):
"""Stops monitoring all processes."""
# We need to make a copy of the list of pids since we are changing
# the dict in the loop.
for pid in list(self._process_information_per_pid.keys()): | python | {
"resource": ""
} |
q25257 | MultiProcessEngine._StopStatusUpdateThread | train | def _StopStatusUpdateThread(self):
"""Stops the status update thread."""
self._status_update_active = False
if self._status_update_thread.isAlive():
| python | {
"resource": ""
} |
q25258 | MultiProcessEngine._TerminateProcessByPid | train | def _TerminateProcessByPid(self, pid):
"""Terminate a process that's monitored by the engine.
Args:
pid (int): process identifier (PID).
Raises:
KeyError: | python | {
"resource": ""
} |
q25259 | MultiProcessEngine._TerminateProcess | train | def _TerminateProcess(self, process):
"""Terminate a process.
Args:
process (MultiProcessBaseProcess): process to terminate.
"""
pid = process.pid
logger.warning('Terminating process: (PID: {0:d}).'.format(pid))
process.terminate()
# Wait for the process | python | {
"resource": ""
} |
q25260 | PyParseRangeCheck | train | def PyParseRangeCheck(lower_bound, upper_bound):
"""Verify that a number is within a defined range.
This is a callback method for pyparsing setParseAction
that verifies that a read number is within a certain range.
To use this method it needs to be defined as a callback method
in setParseAction with the upp... | python | {
"resource": ""
} |
q25261 | PyParseIntCast | train | def PyParseIntCast(string, location, tokens):
"""Return an integer from a string.
This is a pyparsing callback method that converts the matched
string into an integer.
The method modifies the content of the tokens list and converts
them all to an integer value.
Args:
string (str): original string.
... | python | {
"resource": ""
} |
q25262 | PyParseJoinList | train | def PyParseJoinList(string, location, tokens):
"""Return a joined token from a list of tokens.
This is a callback method for pyparsing setParseAction that modifies
the returned token list to join all the elements in the list to a single
token.
Args:
string (str): original string.
location (int): loc... | python | {
"resource": ""
} |
q25263 | PyparsingSingleLineTextParser._IsText | train | def _IsText(self, bytes_in, encoding=None):
"""Examine the bytes in and determine if they are indicative of text.
Parsers need quick and at least semi reliable method of discovering whether
or not a particular byte stream is text or resembles text or not. This can
be used in text parsers to determine i... | python | {
"resource": ""
} |
q25264 | PyparsingSingleLineTextParser._ReadLine | train | def _ReadLine(self, text_file_object, max_len=None, depth=0):
"""Reads a line from a text file.
Args:
text_file_object (dfvfs.TextFile): text file.
max_len (Optional[int]): maximum number of bytes a single line can take,
where None means all remaining bytes should be read.
depth (Op... | python | {
"resource": ""
} |
q25265 | EncodedTextReader._ReadLine | train | def _ReadLine(self, file_object):
"""Reads a line from the file object.
Args:
file_object (dfvfs.FileIO): file-like object.
Returns:
str: line read from the file-like object.
"""
if len(self._buffer) < self._buffer_size:
content = file_object.read(self._buffer_size)
content... | python | {
"resource": ""
} |
q25266 | EncodedTextReader.ReadLine | train | def ReadLine(self, file_object):
"""Reads a line.
Args:
file_object (dfvfs.FileIO): file-like object.
Returns:
str: line read from the lines buffer.
"""
line, _, self.lines = | python | {
"resource": ""
} |
q25267 | EncodedTextReader.ReadLines | train | def ReadLines(self, file_object):
"""Reads lines into the lines buffer.
Args:
file_object (dfvfs.FileIO): file-like object.
"""
lines_size = len(self.lines)
if lines_size | python | {
"resource": ""
} |
q25268 | EncodedTextReader.SkipAhead | train | def SkipAhead(self, file_object, number_of_characters):
"""Skips ahead a number of characters.
Args:
file_object (dfvfs.FileIO): file-like object.
number_of_characters (int): number of characters.
"""
lines_size = len(self.lines)
while number_of_characters >= lines_size:
number_of... | python | {
"resource": ""
} |
q25269 | UTorrentPlugin.GetEntries | train | def GetEntries(self, parser_mediator, data=None, **unused_kwargs):
"""Extracts uTorrent active torrents.
This is the main parsing engine for the plugin. It determines if
the selected file is the proper file to parse and extracts current
running torrents.
interface.Process() checks for the given BE... | python | {
"resource": ""
} |
q25270 | SafariHistoryPlugin.GetEntries | train | def GetEntries(self, parser_mediator, match=None, **unused_kwargs):
"""Extracts Safari history items.
Args:
parser_mediator (ParserMediator): mediates interactions between parsers
and other components, such as storage and dfvfs.
match (Optional[dict[str: object]]): keys extracted from PLI... | python | {
"resource": ""
} |
q25271 | AnalyzersManager.DeregisterAnalyzer | train | def DeregisterAnalyzer(cls, analyzer_class):
"""Deregisters a analyzer class.
The analyzer classes are identified based on their lower case name.
Args:
analyzer_class (type): class object of the analyzer.
Raises:
KeyError: if analyzer class is not set for the corresponding name.
"""
... | python | {
"resource": ""
} |
q25272 | AnalyzersManager.GetAnalyzersInformation | train | def GetAnalyzersInformation(cls):
"""Retrieves the analyzers information.
Returns:
list[tuple]: containing:
str: analyzer name.
str: analyzer description.
"""
analyzer_information = []
for _, | python | {
"resource": ""
} |
q25273 | AnalyzersManager.GetAnalyzerInstance | train | def GetAnalyzerInstance(cls, analyzer_name):
"""Retrieves an instance of a specific analyzer.
Args:
analyzer_name (str): name of the analyzer to retrieve.
Returns:
BaseAnalyzer: analyzer instance.
Raises:
KeyError: if analyzer class is not set for the corresponding name.
"""
... | python | {
"resource": ""
} |
q25274 | AnalyzersManager.GetAnalyzerInstances | train | def GetAnalyzerInstances(cls, analyzer_names):
"""Retrieves instances for all the specified analyzers.
Args:
analyzer_names (list[str]): names of the analyzers to retrieve.
| python | {
"resource": ""
} |
q25275 | AnalyzersManager.GetAnalyzers | train | def GetAnalyzers(cls):
"""Retrieves the registered analyzers.
Yields:
tuple: containing:
str: the uniquely identifying name of the analyzer
type: the analyzer class.
| python | {
"resource": ""
} |
q25276 | FileHashesPlugin.ExamineEvent | train | def ExamineEvent(self, mediator, event):
"""Analyzes an event and creates extracts hashes as required.
Args:
mediator (AnalysisMediator): mediates interactions between
analysis plugins and other components, such as storage and dfvfs.
event (EventObject): event to examine.
"""
path... | python | {
"resource": ""
} |
q25277 | FileHashesPlugin._GeneratePathString | train | def _GeneratePathString(self, mediator, pathspec, hashes):
"""Generates a string containing a pathspec and its hashes.
Args:
mediator (AnalysisMediator): mediates interactions between analysis
plugins and other components, such as storage and dfvfs.
pathspec (dfvfs.Pathspec): the path spe... | python | {
"resource": ""
} |
q25278 | WinJobParser._ParseEventData | train | def _ParseEventData(self, variable_length_section):
"""Parses the event data form a variable-length data section.
Args:
variable_length_section (job_variable_length_data_section): a
Windows Scheduled Task job variable-length data section.
Returns:
WinJobEventData: event data of the j... | python | {
"resource": ""
} |
q25279 | WinJobParser._ParseLastRunTime | train | def _ParseLastRunTime(self, parser_mediator, fixed_length_section):
"""Parses the last run time from a fixed-length data section.
Args:
parser_mediator (ParserMediator): mediates interactions between parsers
and other components, such as storage and dfvfs.
fixed_length_section (job_fixed_... | python | {
"resource": ""
} |
q25280 | WinJobParser._ParseTriggerEndTime | train | def _ParseTriggerEndTime(self, parser_mediator, trigger):
"""Parses the end time from a trigger.
Args:
parser_mediator (ParserMediator): mediates interactions between parsers
and other components, such as storage and dfvfs.
trigger (job_trigger): a trigger.
Returns:
dfdatetime.... | python | {
"resource": ""
} |
q25281 | WinJobParser._ParseTriggerStartTime | train | def _ParseTriggerStartTime(self, parser_mediator, trigger):
"""Parses the start time from a trigger.
Args:
parser_mediator (ParserMediator): mediates interactions between parsers
and other components, such as storage and dfvfs.
trigger (job_trigger): a trigger.
Returns:
dfdatet... | python | {
"resource": ""
} |
q25282 | WinJobParser.ParseFileObject | train | def ParseFileObject(self, parser_mediator, file_object):
"""Parses a Windows job file-like object.
Args:
parser_mediator (ParserMediator): mediates interactions between parsers
and other components, such as storage and dfvfs.
file_object (dfvfs.FileIO): a file-like object.
Raises:
... | python | {
"resource": ""
} |
q25283 | EventTag.AddComment | train | def AddComment(self, comment):
"""Adds a comment to the event tag.
Args:
comment (str): comment.
| python | {
"resource": ""
} |
q25284 | EventTag.AddLabel | train | def AddLabel(self, label):
"""Adds a label to the event tag.
Args:
label (str): label.
Raises:
TypeError: if the label provided is not a string.
ValueError: if a label is malformed.
"""
if not isinstance(label, py2to3.STRING_TYPES):
raise TypeError('label is not a string ty... | python | {
"resource": ""
} |
q25285 | EventTag.AddLabels | train | def AddLabels(self, labels):
"""Adds labels to the event tag.
Args:
labels (list[str]): labels.
Raises:
ValueError: if a label is malformed.
"""
for label in labels:
if not self._VALID_LABEL_REGEX.match(label):
raise ValueError((
'Unsupported label: "{0:s}". A... | python | {
"resource": ""
} |
q25286 | EventTag.CopyToDict | train | def CopyToDict(self):
"""Copies the event tag to a dictionary.
Returns:
dict[str, object]: event tag attributes.
| python | {
"resource": ""
} |
q25287 | EventTag.CopyTextToLabel | train | def CopyTextToLabel(cls, text, prefix=''):
"""Copies a string to a label.
A label only supports a limited set of characters therefore
unsupported characters are replaced with an underscore.
Args:
text (str): label text.
prefix (Optional[str]): label prefix.
Returns: | python | {
"resource": ""
} |
q25288 | SSHSyslogPlugin.ParseMessage | train | def ParseMessage(self, parser_mediator, key, date_time, tokens):
"""Produces an event from a syslog body that matched one of the grammars.
Args:
parser_mediator (ParserMediator): mediates interactions between parsers
and other components, such as storage and dfvfs.
key (str): name of the ... | python | {
"resource": ""
} |
q25289 | ShutdownWindowsRegistryPlugin._ParseFiletime | train | def _ParseFiletime(self, byte_stream):
"""Parses a FILETIME date and time value from a byte stream.
Args:
byte_stream (bytes): byte stream.
Returns:
dfdatetime.Filetime: FILETIME date and time value or None if no
value is set.
Raises:
ParseError: if the FILETIME could not ... | python | {
"resource": ""
} |
q25290 | ShutdownWindowsRegistryPlugin.ExtractEvents | train | def ExtractEvents(self, parser_mediator, registry_key, **kwargs):
"""Extracts events from a ShutdownTime Windows Registry value.
Args:
parser_mediator (ParserMediator): mediates interactions between parsers
and other components, such as storage and dfvfs.
registry_key (dfwinreg.WinRegistr... | python | {
"resource": ""
} |
q25291 | BaseCookiePlugin.Process | train | def Process(self, parser_mediator, cookie_name, cookie_data, url, **kwargs):
"""Determine if this is the right plugin for this cookie.
Args:
parser_mediator (ParserMediator): mediates interactions between parsers
and other components, such as storage and dfvfs.
cookie_name (str): the name... | python | {
"resource": ""
} |
q25292 | Log2TimelineTool._GetPluginData | train | def _GetPluginData(self):
"""Retrieves the version and various plugin information.
Returns:
dict[str, list[str]]: available parsers and plugins.
"""
return_dict = {}
return_dict['Versions'] = [
('plaso engine', plaso.__version__),
('python', sys.version)]
hashers_informa... | python | {
"resource": ""
} |
q25293 | Log2TimelineTool.ExtractEventsFromSources | train | def ExtractEventsFromSources(self):
"""Processes the sources and extracts events.
Raises:
BadConfigOption: if the storage file path is invalid or the storage
format not supported or an invalid filter was specified.
SourceScannerError: if the source scanner could not find a supported
... | python | {
"resource": ""
} |
q25294 | Log2TimelineTool.ShowInfo | train | def ShowInfo(self):
"""Shows information about available hashers, parsers, plugins, etc."""
self._output_writer.Write(
'{0:=^80s}\n'.format(' log2timeline/plaso information '))
plugin_list = self._GetPluginData()
| python | {
"resource": ""
} |
q25295 | AndroidAppUsageParser.ParseFileObject | train | def ParseFileObject(self, parser_mediator, file_object):
"""Parses an Android usage-history file-like object.
Args:
parser_mediator (ParserMediator): mediates interactions between parsers
and other components, such as storage and dfvfs.
file_object (dfvfs.FileIO): file-like object.
R... | python | {
"resource": ""
} |
q25296 | FileObjectWinRegistryFileReader.Open | train | def Open(self, file_object, ascii_codepage='cp1252'):
"""Opens a Windows Registry file-like object.
Args:
file_object (dfvfs.FileIO): Windows Registry file-like object.
ascii_codepage (Optional[str]): ASCII string codepage.
Returns:
WinRegistryFile: Windows Registry file or None.
"""... | python | {
"resource": ""
} |
q25297 | WinRegistryParser._CanProcessKeyWithPlugin | train | def _CanProcessKeyWithPlugin(self, registry_key, plugin):
"""Determines if a plugin can process a Windows Registry key or its values.
Args:
registry_key (dfwinreg.WinRegistryKey): Windows Registry key.
plugin (WindowsRegistryPlugin): Windows Registry plugin.
Returns:
bool: True if the Re... | python | {
"resource": ""
} |
q25298 | WinRegistryParser._NormalizeKeyPath | train | def _NormalizeKeyPath(self, key_path):
"""Normalizes a Windows Registry key path.
Args:
key_path (str): Windows Registry key path.
Returns:
str: normalized Windows Registry key path.
"""
normalized_key_path = key_path.lower()
# The Registry key path should start with:
# HKEY_LO... | python | {
"resource": ""
} |
q25299 | WinRegistryParser._ParseRecurseKeys | train | def _ParseRecurseKeys(self, parser_mediator, root_key):
"""Parses the Registry keys recursively.
Args:
parser_mediator (ParserMediator): parser mediator.
root_key (dfwinreg.WinRegistryKey): root Windows Registry key.
""" | python | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.