Questions tagged [patch]
A patch is a piece of software designed to fix problems with, or update a computer program or its supporting data. This includes fixing security vulnerabilities and other bugs, and improving the usability or performance.
2,779
questions
0
votes
0
answers
16
views
Monkey patching a class in another module in Python with other imports
I am trying to monkey patch a python module to override a method within the class. This is a proxy module for simplification and not the actual code or module I am overwriting but follows the same ...
0
votes
0
answers
10
views
Animated patches in ArtistAnimation
Due to the code structure I cannot use FuncAnimation where I can make paches moving.
Is there a way to include animated patches into ArtistAnimation? In the following two samples I took the tutorial ...
0
votes
0
answers
10
views
Mock dns resolver answer object in python
I have a method called _resolve, where all the ip address passed as a list. then i have a function _query_ptr inside this i have a resolve_address function which i want to mock this in my test case.
...
1
vote
1
answer
15
views
How to create a patch which counts empty directories?
I have the following directories:
$ tree
.
├── new
│ └── dir1
└── old
I want to create a patch using diff and apply it to the old.
This one doesn't change the old:
$ diff -ruN old new | patch -s -...
0
votes
0
answers
23
views
Kustomize: merge values (CIDR lists) for the same key from different patches instead replacing them
Let's say I have two yml file with patches:
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: ingress-whitelist-1
annotations:
nginx.ingress.kubernetes.io/whitelist-source-range: ...
1
vote
1
answer
40
views
How to stop turtles when all patches have been colored?
How to stop turtles when all patches have been colored in Netlogo?
When the turtles have covered the world in patches, I would like the turtles to stop on the last one so that I can record the amount ...
-2
votes
0
answers
35
views
how to create anti ban or system bypass for ios game when patching offsets with frida?
I am learning to patch offsets through frida and I ran into a problem that the game system detects it, is it possible to somehow hide for it that the memory is changing dramatically or write a ready-...
0
votes
0
answers
48
views
Debug console doesn't show messages after upgrading Android Studio to Android Studio Flamingo | 2022.2.1 Patch 1
I just upgraded the version of Android Studio to Android Studio Flamingo | 2022.2.1 Patch 1 and gradle to version 7.5 and I lost one of the most usefull features, the logs inside the Debug Console. ...
1
vote
1
answer
38
views
patch method that uses external library method calls
The foo class links the external library to an atribute so I can use self.external_class.externalClassMethod. But to do testing, I need to patch out this method call so I can continue testing the ...
0
votes
0
answers
46
views
patch a go function inside of a binary
I want to modify my go binary so that the function time.Sleep does wait for one second only.
By inspecting closely said binary, i managed to find its address and disassembled the function using gdb. ...
0
votes
1
answer
47
views
Kubectl patch json format on windows: syntax error
kubectl patch sts web -p '{"spec":{"replicas":3}}'
Error from server (BadRequest): json: cannot unmarshal
string into Go value of type map[string]interface {}
Tried to exchange &...
0
votes
1
answer
39
views
How to mock an object in a unit test?
I am working on a unit test where I want to mock a class within a new class I am testing.
Below there is my simplified code:
from pptx import Presentation
class MyClass:
def __init__(self, path:...
-1
votes
0
answers
25
views
How can I install matplotlib?
I use latest version of qpython 3l available in playstore. I am getting installation error while installing matplotlib. But installation and importing numpy working fine. The screen short for the ...
0
votes
0
answers
58
views
Adobe Acrobat DC uninstall fails with error "No valid sequence could be found for the set of patches"
Trying to remove Adobe Acrobat DC from Windows 10. The uninstall fails with error "No valid sequence could be found for the set of patches".
The corrresponding MS Error Code is 1648.
My ...
0
votes
0
answers
11
views
How to update field:data that comes by user through form ,that is not defined in schema
I have made REST API ,I want when user wants to update (that exist my database) and some other field:data that is not defined my schema.but I also don't know what the user want to update i.e
may be ...
0
votes
0
answers
24
views
Providing schema for Django Rest Framework patch request in Swagger
I'm very new to DRF, Swagger and API in general and I am trying to figure out the patch request.
I have this model:
class Object(models.Model):
id = models.UUIDField(
primary_key=True,
...
0
votes
0
answers
14
views
Can't display patches of a grayscale image
I am trying to do multiclass classification of a grayscale image dataset using ViT. But while trying to display the patches it gives error. I am pasting the code alongwith the error encountered. The ...
0
votes
1
answer
52
views
laravel api put and patch method not accepting request from postman form-data
I'm creating an update api by using apiresource in laravel 8. im seing request from the postman using put and patch method but it returning empty array. is there any method by using that i can create ...
1
vote
1
answer
25
views
Patching cached js bundles in the browser: How to or can we deploy delta / patches in big websites?
I was reading an article on git ".patch" files so was wondering if we can do something similar for big websites as well. This is particularly useful for the scenario when about 95% of the js ...
0
votes
0
answers
49
views
Patching a file with x64dbg after finding ram addresses
I've been tinkering with an exe game. After finding a memory address I wanted to change using Cheat Engine (I want to change a je to a jne op), I successfully managed to change the game's code.
I want ...
1
vote
0
answers
95
views
Patching and running a python library as a build tool in bazel
I'm new to bazel and am currently writing a build for a C++ library with some python build tool dependencies. It currently uses WORKSPACE rather than Bzlmod.
How would I go about implementing the ...
0
votes
1
answer
43
views
ModelState remains valid during Json Patch
I am builing an Api using the JsonPatch Document described here:
JsonPatch in ASP.NET Core web API
I have the following method in my controller:
[HttpPatch("{id:int}")]
[ProducesResponseType(...
0
votes
1
answer
16
views
Is there a way to use a fixture within Patch decorator in Python?
conftest.py
@pytest.fixture
def data():
return "some data"
test_fn1.py - The below doesn't work as 'data' fixture can't be resolved when used within patch decorator.
@patch("a.b.c....
0
votes
0
answers
45
views
Keycloak - PATCH user attributes through REST API
I am using Keycloak docker image 21.0.2 (the latest one).
I make a PUT request to this URL :
http://localhost:8080/admin/realms/custom-realm/users/14905db1-5229-4110-bfbb-df13845a4f52
and with this ...
0
votes
0
answers
16
views
How to construct a patch if I already know the diff?
I'm looking to build this project with patches against a current build on my machine using NixOS: https://github.com/spcmd/w3m
As the project notes, it contains diff files if anyone outside of the ...
1
vote
0
answers
115
views
Patching a JMP in Ghidra
I'm pretty new to assembly, I'm trying to understand things better.
My goal is to change the default text colour of controls in a win32 x86 application, these are stored as RGB values for different ...
0
votes
1
answer
29
views
How to copy and apply a patch/diff to a svelte file on build?
I'm building a svelte npm module with sveltekit. It supplies components that are identical except for a couple lines. I'd like to generate one of the components based on the original. How can I copy a ...
1
vote
3
answers
104
views
How to properly patch sys.argv using mock patch in python unit test
I have a file seed_dynamodb.py whose code is below. I want to write a unit test for it using mock patch. I am successfully able to patch boto3. Now I need to patch sys.argv as well. I have tried with ...
0
votes
0
answers
32
views
How to Visualize each patches and combine back to an image in Vision transformer features maps
Running vision transformer keras code but Trying to visualize variable "features" encoded patch image is stored? How to visualize each patches?
def create_vit_classifier():
inputs = ...
0
votes
1
answer
22
views
Patching child TestCase class affects parent TestCase class
I need to test a function which uses feature toggles to turn some functionality on and off.
Say, a function like this:
def func_to_test(hello_value: str):
if toggle_is_active('only_hello_and_hi'):
...
0
votes
1
answer
19
views
Can you have patch.multiple where new_callable is set for each patch?
I have this fixture to get all tests in this file to use a pytest temporary directory for the files and directories used by the code:
import src.recurrent_admin.restic_backup_task as restic_task
...
...
0
votes
1
answer
456
views
Kustomize delete fields during patch
i'm trying to path deployment by using kustomize
i need to change only env in the spec.template.spec.containers.
but during kustomisation other fields are deleting too
tree:
k8s
|_base
|_ deployment....
0
votes
0
answers
16
views
Smoothening Border problem of Satellite Image Super Resolution
I am trying to do super resolution with satellite images. I have created a model inspired by SRGAN for 4x SR. Although after training the results are quite good, it is generating some artefacts at the ...
0
votes
1
answer
34
views
How to face a patch in Netlogo
I have:
ask Anas-discors[ let targ one-of patches with[pcolor = 88 ] if targ != nobody [set heading towards targ fd 1] ]
This bird should fly to blue patches (pcolor 88) and only those patches, ...
0
votes
1
answer
22
views
How to patch imports in a parent class?
I have something like this:
import load_json
class Parent:
def func_1(self):
file = load_json("file/path.json")
file["additional data"] = "some new data&...
0
votes
2
answers
41
views
Make use of a patch set up by an autouse fixture?
Follows on from this answer about disabling autouse fixtures.
If I have this fixture
@pytest.fixture(autouse=True)
def mock_logger_error(request):
with mock.patch('logging.Logger.error') as ...
1
vote
2
answers
106
views
Patching in unit tests does not work, actual method is being called
I have a python file : update_baseline_manifest.py. Now, I am writing unit tests and want to patch read_file and write_file and I have done it like
def update_baseline_manifest(baseline_manifest_path, ...
0
votes
2
answers
35
views
Patching class attribute to return different values?
Given following production code, where file_path is of pathlib.Path type
previous_time = file_path.stat().st_mtime
# recreate the file
.....
if file_path.stat().st_mtime != previous_time:
# do ...
0
votes
0
answers
38
views
How can I patch a class in a dependency library using Gradle (or some other tool)
I have an Android app that depends on @mapbox/react-native-mapbox-gl and somewhere down the dependency chain the class com.mapbox.services.android.telemetry.utils.TelemetryUtils is imported, but it ...
1
vote
1
answer
31
views
how to patch stockdata into firebase using vanilla javascript
I have done a simple webstore with localStore and Firebase. I want that the stock (lager) updates in firebase after checkout. When I push the button checkout it should patch the new stock(lager) data. ...
0
votes
0
answers
18
views
Should PATCH request body contain only resource fields?
F.e
GET - /user/123
{
"id": 123,
"user": {
"first_name": "John",
"last_name": "Wick"
},
"products":...
0
votes
0
answers
22
views
Should PUT be used instead of PATCH when the API targets a specific field instead of an entity?
I don't know what HTTP method to use, when an API endpoint specifically targets one field or one "action", which is part of a larger entity.
I've read into other similar questions about ...
1
vote
1
answer
84
views
Why is the pytest mocker patching module methods globally (depending on the modules import)?
Problem:
For testing, I want to patch time.sleep in my main module (and assert its call), without patching it in submodules.
However, importing time in my modules and patching time.sleep in my main ...
0
votes
1
answer
108
views
Cent OS update to postgresql13-contrib-13.9 causes error postgres_fdw.so undefined symbol: get_rel_all_updated_cols
I am running CentOS 7.9 and the latest OS updates caused and issue when updating the library postgresql13-contrib-13.9-1.
After that update when attempting to create postgres_fdw or use an existing ...
0
votes
0
answers
24
views
how to patch values in nested map
I have 2 nested maps, i want to compare those 2 maps using the keys and replace the values
first map:
{
"atBaseType": "abc",
"atType": "abc",
"...
0
votes
0
answers
35
views
Patch request to a node.js code from vue button on-click gives error
I have a very simple vue project that gets and displays info from a json file. I also separately coded, using the google calendar api node.js authentication, a javascript code that authenticates, gets ...
0
votes
1
answer
41
views
fetch different values in each function for the same sqlclient object in python unittest
I am trying to perform an integration test on the project. We have a mysqlclient object which is mocked and able to assign dummy values on the first fetchall call. Can anyone help me in how to fetch ...
0
votes
1
answer
29
views
How to change the forward speed when near the objetctive netlogo
i have bird that can fly really long distances, so it has a foward of 5. However its not reaching its destination as flying in intervals of 5 makes it jump the mark. To solve it i tried this.
ask ...
0
votes
1
answer
35
views
Python patch/mock under __name__ == "__main___"
I have the following file named w.py, and under __name__ == "__main__", I want to patch MyAPI, running python w.py shows the patching is not working at all. Is patch('common.apis.MyAPI', ...
9
votes
1
answer
269
views
Algorithm to combine two patches into a single patch?
I'm trying to do something which I think should be pretty simple but has turned into quite a rabbit hole and I think there must be a better way.
Imagine you have two consecutive patch files (which ...