Skip to content

Instantly share code, notes, and snippets.

@zanieb
Created November 1, 2023 18:12
Show Gist options
  • Save zanieb/a982ec8c392939043613267474471a6e to your computer and use it in GitHub Desktop.
Save zanieb/a982ec8c392939043613267474471a6e to your computer and use it in GitHub Desktop.

ℹ️ ecosystem check detected format changes. (+98 -44 lines in 44 files in 41 projects)

RasaHQ/rasa (+4 -2 lines across 2 files)

ruff format

rasa/core/policies/ted_policy.py~L1714

         Returns:
             The converted attribute features
         """
+
         # in order to convert the attribute features with shape
         # (combined batch-size and dialogue length x 1 x units)
         # to a shape of (batch-size x dialogue length x units)

rasa/shared/core/generator.py~L202

         A new tracker will be created and all events
         will be replayed.
         """
+
         # This is an optimization, we could use the original copy, but
         # the states would be lost and we would need to recalculate them
 

bokeh/bokeh (+4 -2 lines across 2 files)

ruff format

src/bokeh/embed/standalone.py~L107

         ValueError
 
     """
+
     # TODO: maybe warn that it's not exactly useful, but technically possible
     # if resources.mode == 'inline':
     #     raise ValueError("autoload_static() requires non-inline resources")

src/bokeh/embed/util.py~L131

         Document
 
     """
+
     # Note: Comms handling relies on the fact that the new_doc returned
     # has models with the same IDs as they were started with
 

demisto/content (+36 -16 lines across 16 files)

ruff format --exclude Packs/ThreatQ/Integrations/ThreatQ/ThreatQ.py

Packs/ApiModules/Scripts/MicrosoftGraphMailApiModule/MicrosoftGraphMailApiModule.py~L897

         :return: Parsed email
         :rtype: ``dict``
         """
+
         # there are situations where the 'body' key won't be returned from the api response, hence taking the uniqueBody
         # in those cases for both html/text formats.
 

Packs/AzureKeyVault/Integrations/AzureKeyVault/AzureKeyVault.py~L155

         Returns:
             Dict[str, Any]: API response from Azure.
         """
+
         # permissions property
 
         permissions = self.config_vault_permission(

Packs/Campaign/Scripts/FindEmailCampaign/FindEmailCampaign_test.py~L217

         - Assert that the user requested fields are stored in the context
 
     """
+
     # prepare
 
     data = prepare_additional_context_fields_test(mocker)

Packs/CrowdStrikeFalcon/Integrations/CrowdStrikeFalcon/CrowdStrikeFalcon.py~L6397

     Returns:
         dict[str, Any]: The body of the request.
     """
+
     # Values need to be in the form {'name': name_of_key, 'value': value_of_key}, as can be seen here
     # https://assets.falcon.crowdstrike.com/support/api/swagger.html#/Alerts/PatchEntitiesAlertsV2
 

Packs/Digital_Defense_FrontlineVM/Integrations/Digital_Defense_FrontlineVM/Digital_Defense_FrontlineVM.py~L298

 
 def get_assets_command():
     """Pulls host information from Frontline.Cloud"""
+
     # Get Arguments:
 
     ip_address = demisto.args().get("ip_address")

Packs/EmailCommunication/Scripts/SendEmailReply/SendEmailReply.py~L872

     Returns:
         String containing result message from send_new_email function
     """
+
     # Use New Thread Incident fields to construct & send email reply
     # This action is used by the "Email Threads" layout
 

Packs/Envoy/Integrations/EnvoyIAM/EnvoyIAM.py~L136

         :return: An IAMUserAppData object that contains the data of the user in the application.
         :rtype: ``IAMUserAppData``
         """
+
         # Note: ENABLE user API endpoints might vary between different APIs.
         # In this example, we use the same endpoint as in update_user() method,
         # But other APIs might have a unique endpoint for this request.

Packs/Envoy/Integrations/EnvoyIAM/EnvoyIAM.py~L152

         :return: An IAMUserAppData object that contains the data of the user in the application.
         :rtype: ``IAMUserAppData``
         """
+
         # Note: DISABLE user API endpoints might vary between different APIs.
         # In this example, we use the same endpoint as in update_user() method,
         # But other APIs might have a unique endpoint for this request.

Packs/GoogleChronicleBackstory/Integrations/GoogleChronicleBackstory/GoogleChronicleBackstory.py~L4192

     :return: command output
     :rtype: (dict, dict, dict)
     """
+
     # retrieve arguments and validate it
 
     start_time, _, page_size, _ = get_default_command_args_value(args=args)

Packs/GoogleKubernetesEngine/Integrations/GoogleKubernetesEngine/GoogleKubernetesEngine.py~L782

         dict: Operation entry context.
         dict: Operation raw response.
     """
+
     # Query operation status
 
     raw_response_msg: Message = client.list_operations(project_id=project, zone=zone, timeout=API_TIMEOUT)

Packs/HelloIAMWorld/Integrations/HelloIAMWorld/HelloIAMWorld.py~L98

         :return: An IAMUserAppData object that contains the data of the user in the application.
         :rtype: ``IAMUserAppData``
         """
+
         # Note: ENABLE user API endpoints might vary between different APIs.
         # In this example, we use the same endpoint as in update_user() method,
         # But other APIs might have a unique endpoint for this request.

Packs/HelloIAMWorld/Integrations/HelloIAMWorld/HelloIAMWorld.py~L114

         :return: An IAMUserAppData object that contains the data of the user in the application.
         :rtype: ``IAMUserAppData``
         """
+
         # Note: DISABLE user API endpoints might vary between different APIs.
         # In this example, we use the same endpoint as in update_user() method,
         # But other APIs might have a unique endpoint for this request.

Packs/HelloWorld/Integrations/FeedHelloWorld/FeedHelloWorld.py~L226

     Returns:
         Outputs.
     """
+
     # INTEGRATION FEED DEVELOPER TIP
     # Client class should raise the exceptions, but if the test fails
     # the exception text is printed to the Cortex XSOAR UI.

Packs/HelloWorld/Integrations/HelloWorld/HelloWorld.py~L261

 
     def specific_api_endpoint_call_example(self, param1, param2):
         """Example of calling a real specific API endpoint"""
+
         # INTEGRATION DEVELOPER TIP
         # 1. The assign_params function (Found in CommonServerPython) can easily create a None-free dictionary.
         #   Use it to send the ``json_data`` argument to ``self._http_request`` method (request body).

Packs/HelloWorld/Integrations/HelloWorld/HelloWorld.py~L580

         dict: Next run dictionary containing the timestamp that will be used in ``last_run`` on the next fetch.
         list: List of alerts that will be created in Cortex XSOAR.
     """
+
     # INTEGRATION DEVELOPER TIP
     # You can use the last_run to save important information between fetches (For example, the last fetched alert's IDs).
     # Note that the last_run can store only small amounts of data, abusing it might cause unexpected behavior.

Packs/PrismaCloudCompute/Integrations/PaloAltoNetworks_PrismaCloudCompute/PaloAltoNetworks_PrismaCloudCompute.py~L1942

     Returns:
         CommandResults: command-results object.
     """
+
     # waas_settings = ["sqli", "xss", "attackTools", "shellshock", "malformedReq", "cmdi", "lfi", "codeInjection"]
 
     policy = args.get("policy", {})

Packs/SEKOIAIntelligenceCenter/Integrations/SEKOIAIntelligenceCenter/SEKOIAIntelligenceCenter.py~L474

     :return: 'ok' if test passed, anything else will fail the test.
     :rtype: ``str``
     """
+
     # Check a JWT token’s validity
     # https://docs.sekoia.io/develop/rest_api/identity_and_authentication/#tag/User-Authentication/operation/get_validate_resource
 

Packs/SentinelOne/Integrations/SentinelOne-V2/SentinelOne-V2.py~L114

         """
         Only supports adding to the Global block list
         """
+
         # We do not use the assign_params function, because if these values are empty or None, we still want them
         # sent to the server
 

Packs/ServiceNow/Integrations/ServiceNowv2/ServiceNowv2_test.py~L258

     Then:
         - Verify that the expected notes are returned in the correct format.
     """
+
     # Note: the 'display_value' time is the local time of the SNOW instance, and the 'value' is in UTC.
     # The results returned for notes are expected to be in UTC time.
 

Packs/ServiceNow/Integrations/ServiceNowv2/ServiceNowv2_test.py~L320

     Then:
         - Verify that the expected notes are returned in the correct format.
     """
+
     # Note: the timezone in the raw_notes should mimic the local time of the SNOW instance,
     # the time in the filter is in UTC (to mimic the behaviour of fetching).
     # timezone_offset is the difference between UTC and local time, e.g. offset = -60, means that local time is UTC+1.

docker/docker-py (+2 -1 lines across 1 file)

ruff format

docker/api/exec_api.py~L156

             :py:class:`docker.errors.APIError`
                 If the server returns an error.
         """
+
         # we want opened socket if socket == True
 
         data = {"Tty": tty, "Detach": detach}

freedomofpress/securedrop (+2 -1 lines across 1 file)

ruff format

securedrop/pretty_bad_protocol/gnupg.py~L346

         >>> seckeys = gpg.list_keys(secret=True)
         >>> assert print1 in seckeys.fingerprints
         """
+
         # xxx need way to validate that key_data is actually a valid GPG key
         #     it might be possible to use --list-packets and parse the output
 

pandas-dev/pandas (+19 -7 lines across 7 files)

ruff format

pandas/core/arrays/datetimelike.py~L1186

         -------
         Same type as self
         """
+
         # overridden by PeriodArray
 
         if len(self) != len(other):

pandas/core/dtypes/cast.py~L750

     -------
     object
     """
+
     # Start with exceptions in which we do _not_ cast to numpy types
 
     if dtype == _dtype_obj:

pandas/core/dtypes/cast.py~L1344

     -------
     np.dtype or ExtensionDtype
     """
+
     # GH#38240
 
     # TODO: more generally, could do `not can_hold_na(dtype)`

pandas/core/generic.py~L5513

 
         See the :ref:`user guide <basics.reindexing>` for more.
         """
+
         # TODO: Decide if we care about having different examples for different
         # kinds
 

pandas/core/generic.py~L6252

         After regular attribute access, try setting the name
         This allows simpler access to columns for interactive use.
         """
+
         # first try regular attribute access via __getattribute__, so that
         # e.g. ``obj.x`` and ``obj.x = 4`` will always reference/modify
         # the same attribute.

pandas/core/groupby/groupby.py~L1575

         -------
         Series or DataFrame
         """
+
         # ATM we do not get here for SeriesGroupBy; when we do, we will
         #  need to require that result.name already match self.obj.name
 

pandas/core/indexes/interval.py~L743

         """
         _get_indexer specialized to the case where both of our sides are unique.
         """
+
         # Caller is responsible for checking
         #  `self.left.is_unique and self.right.is_unique`
 

pandas/core/internals/blocks.py~L312

 
         Only supports slices that preserve dimensionality.
         """
+
         # Note: only called from is from internals.concat, and we can verify
         #  that never happens with 1-column blocks, i.e. never for ExtensionBlock.
 

pandas/core/internals/blocks.py~L2209

 
         This is intended for 'setitem', not 'iget' or '_slice'.
         """
+
         # TODO: ATM this doesn't work for iget/_slice, can we change that?
 
         if isinstance(indexer, tuple) and len(indexer) == 2:

pandas/core/internals/blocks.py~L2270

         -------
         ExtensionArray
         """
+
         # Notes: ndarray[bool] is only reachable when via get_rows_with_mask, which
         #  is only for Series, i.e. self.ndim == 1.
 

pandas/core/internals/blocks.py~L2433

     -------
     values : np.ndarray or ExtensionArray
     """
+
     # Caller is responsible for ensuring NumpyExtensionArray is already extracted.
 
     if isinstance(values, np.ndarray):

pandas/core/internals/concat.py~L255

     With single-Block managers with homogeneous dtypes (that can already hold nan),
     we avoid [...]
     """
+
     # assumes
     #  all(_is_homogeneous_mgr(mgr, first_dtype) for mgr, _ in in mgrs_indexers)
 

prefecthq/prefect (+9 -4 lines across 4 files)

ruff format

src/prefect/engine.py~L320

 
     Creates the flow run in the backend, then enters the main flow run engine.
     """
+
     # TODO: Returns a `State` depending on `return_type` and we can add an overload to
     #       the function signature to clarify this eventually.
 

src/prefect/engine.py~L1250

         >>>    k: await collect_task_run_inputs(v) for k, v in parameters.items()
         >>> }
     """
+
     # TODO: This function needs to be updated to detect parameters and constants
 
     inputs = set()

src/prefect/infrastructure/kubernetes.py~L436

         WARNING: This action is not threadsafe and may override the configuration
                   specified by another `KubernetesJob` instance.
         """
+
         # TODO: Investigate returning a configured client so calls on other threads
         #       will not invalidate the config needed here
 

src/prefect/logging/formatters.py~L87

         message formats.
 
         """
+
         # See https://github.com/python/cpython/blob/c8c6113398ee9a7867fe9b08bc539cceb61e2aaa/Lib/logging/__init__.py#L546
         # for implementation details
 

src/prefect/server/models/block_schemas.py~L687

     Returns:
         db.BlockSchema: the block_schema
     """
+
     # Construction of a recursive query which returns the specified block schema
     # along with and nested block schemas coupled with the ID of their parent schema
     # the key that they reside under.

pypa/cibuildwheel (+2 -1 lines across 1 file)

ruff format

test/utils.py~L153

     """
     Returns a list of expected wheels from a run of cibuildwheel.
     """
+
     # per PEP 425 (https://www.python.org/dev/peps/pep-0425/), wheel files shall have name of the form
     # {distribution}-{version}(-{build tag})?-{python tag}-{abi tag}-{platform tag}.whl
     # {python tag} and {abi tag} are closely related to the python interpreter used to build the wheel

pypa/setuptools (+10 -5 lines across 5 files)

ruff format

pkg_resources/init.py~L1367

         ``atexit`` function if you wish to ensure cleanup of a temporary
         directory used for extractions.
         """
+
         # XXX
 
 

setuptools/_distutils/command/install.py~L331

 
     def finalize_options(self):  # noqa: C901
         """Finalizes options."""
+
         # This method (and its helpers, like 'finalize_unix()',
         # 'finalize_other()', and 'select_scheme()') is where the default
         # installation directories for modules, extension modules, and

setuptools/_distutils/fancy_getopt.py~L295

         """Generate help text (a list of strings, one per suggested line of
         output) from the option table for this FancyGetopt object.
         """
+
         # Blithely assume the option table is good: probably wouldn't call
         # 'generate_help()' unless you've already called 'getopt()'.
 

setuptools/_distutils/file_util.py~L101

     the output file, and 'copied' is true if the file was copied (or would
     have been copied, if 'dry_run' true).
     """
+
     # XXX if the destination file already exists, we clobber it if
     # copying, but blow up if linking.  Hmmm.  And I don't know what
     # macostools.copyfile() does.  Should definitely be consistent, and

setuptools/command/editable_wheel.py~L198

         - Data/header/script files are not part of the "editable" specification
           so they are written directly to the unpacked_wheel directory.
         """
+
         # Non-editable files (data, headers, scripts) are written directly to the
         # unpacked_wheel
 

python/mypy (+4 -2 lines across 2 files)

ruff format

mypy/checker.py~L1544

         self, defn: FuncItem, reverse_type: CallableType, reverse_name: str, context: Context
     ) -> None:
         """Check a reverse operator method such as __radd__."""
+
         # Decides whether it's worth calling check_overlapping_op_methods().
 
         # This used to check for some very obscure scenario.  It now

mypy/main.py~L291

     This function mutates options based on special_opts to infer the correct Python executable
     to use.
     """
+
     # TODO: (ethanhs) Look at folding these checks and the site packages subprocess calls into
     # one subprocess call for speed.
 

rotki/rotki (+4 -2 lines across 2 files)

ruff format

rotkehlchen/chain/bitcoin/hdkey.py~L347

         Returns:
             (HDKey): the child
         """
+
         # TODO: Break up this function
 
         # normalize the index, error if we can't derive the child

rotkehlchen/data_import/importers/binance.py~L225

         Change is amount, Coin is asset
         If amount is negative then this asset is sold, otherwise it's bought
         """
+
         # Because we can get mixed data (e.g. multiple Buys or Sells on a single timestamp) we need
         # to group it somehow. We are doing it by grouping the highest bought with the highest
         # sold value. We query usd equivalent for each amount because different Sells / Buys

zulip/zulip (+2 -1 lines across 1 file)

ruff format

zerver/lib/narrow.py~L305

         particular, if the given query will only find messages that a given
         user can legitimately see, then so will the returned query.
         """
+
         # To maintain the security property, we hold all the `by_*`
         # methods to the same criterion.  See the class's block comment
         # for details.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment