Difficulty understanding the Python data model and how the integrated functions are assigned to special methods

I have experience in Java and I am studying the Python data model. Specifically, I am curious about how and when special methods (e.g. __add__) called.

It seems that the Python interpreter can execute these special methods when it finds certain built-in functions. To take an example of the book "Fluent Python", if you have a class like the following FrenchDeck

import collections

Card = collections.namedtuple('Card', ('rank', 'suit'))

class FrenchDeck:
    ranks = (str(n) for n in range(2, 11)) + list('JQKA')
    suits = 'spades diamonds clubs hearts'.split()

    def __init__(self):
        self._cards = (Card(rank, suit) for suit in self.suits
                                        for rank in self.ranks)

    def __len__(self):
        return len(self._cards)

    def __getitem__(self, position):
        return self._cards(position)

then __getitem__ will be called when the Python interpreter finds things like for card in FrenchDeck() or FrenchDeck()(11).

To me, this seems expressive but also extremely vague. How do I determine what built-in functions will call my special methods? There seems to be some implicit mention of assignments between integrated methods and special methods in statements in the Python Data Model section as

It is recommended that both assignments and sequences implement __contains__() method to allow efficient use of the in operator.

But I can't find a clear reference document with statements like "for user-defined classes, in will use __contains__ if it exists, otherwise it will use __getitem__".

How to fix this DFA error? "Div div-gpt-ad-XXXXXX is not assigned to a known ad unit."

My DFA ads are not showing on the website. I received this error message "div-gpt-ad-XXXXXX is not assigned to a known ad unit". How to fix this?

Not all kafka consumers are being assigned to partitions

I have 10 consumers and 10 partitions.
I take the number of partitions

    int partitionCount = getPartitionCount(kafkaUrl);

and I create the same number of consumers with the same Group ID.

Stream.iterate(0, i -> i + 1)
.limit(partitionCount)
.forEach(index -> executorService.execute(() -> createCosnumer(consumerConfig(index), topicName)

config looks like this

Properties properties = new Properties();
properties.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, kafkaUrl);
properties.put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class.getName());
properties.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class.getName());
properties.put(ConsumerConfig.GROUP_ID_CONFIG, CONSUMER_CLIENT_ID);
properties.put(ConsumerConfig.CLIENT_ID_CONFIG, CONSUMER_CLIENT_ID + index);
properties.put(ConsumerConfig.ENABLE_AUTO_COMMIT_CONFIG, "false");
properties.put(ConsumerConfig.SESSION_TIMEOUT_MS_CONFIG, "300000");
properties.put(ConsumerConfig.HEARTBEAT_INTERVAL_MS_CONFIG, "10000");
properties.put(ConsumerConfig.MAX_POLL_INTERVAL_MS_CONFIG, String.valueOf(Integer.MAX_VALUE));
properties.put(ConsumerConfig.PARTITION_ASSIGNMENT_STRATEGY_CONFIG, "org.apache.kafka.clients.consumer.RoundRobinAssignor");

each consumer assigns a topic and begins to consume

consumer.subscribe(topicName);
while (true) {
ConsumerRecords consumerRecords = consumer.poll(Duration.ofSeconds(4));
if (consumerRecords.count() > 0) {
consumeRecords(consumerRecords);
consumer.commitSync();
}
}

what I see after assigning consumers to the partition

TOPIC      PARTITION  CURRENT-OFFSET  LOG-END-OFFSET  LAG             CLIENT-ID                                                        
topicName  1          89391           89391           0               consumer0
topicName  3          88777           88777           0               consumer1
topicName  5          89280           89280           0               consumer2
topicName  4          88776           88776           0               consumer2
topicName  0          4670991         4670991         0               consumer0
topicName  9          23307           89343           66036           consumer4
topicName  7          89610           89610           0               consumer3
topicName  8          88167           88167           0               consumer4
topicName  2          89138           89138           0               consumer1
topicName  6          88967           88967           0               consumer3

only half of consumers have been assigned to partitions
Why did this happened? There must be one consumer per partition according to the documentation. I am doing something wrong? kafka version 2.1.1.

paypal: the destination fields are not assigned. Document: paypal_settlement_report_row. Fields: store_id

I tried to migrate from Magento 1.9.3.8 to Magento 2.3.4, when I ran the Magento data migration tool I always received this error:

Destination fields are not mapped. Document: paypal_settlement_report_row. Fields: store_id

I tried to fix it by modifying the map_file in etc/opensource-to-opensource/1.9.3.8/map.xml.distbut without luck


     ....
     
         ....
         
            paypal_settlement_report_row.store_id
        
    

W / ziparchive Zip: X bites cannot be assigned at offset 0: there is no space left on the device while the factory image is displayed on the fisherman (Nexus 6P)

I was trying to make a factory flash image on the fisherman on my Nexus 6P. There are some No space left on device error:

./flash-all.sh # added set -x to script
+ fastboot flash bootloader bootloader-angler-angler-03.68.img
target reported max download size of 494927872 bytes
sending 'bootloader' (3544 KB)...
OKAY (  0.127s)
writing 'bootloader'...
OKAY (  0.208s)
finished. total time: 0.335s
+ fastboot reboot-bootloader
rebooting into bootloader...
OKAY (  0.022s)
finished. total time: 0.073s
+ sleep 5
+ fastboot flash radio radio-angler-angler-03.81.img
< waiting for any device >
target reported max download size of 494927872 bytes
sending 'radio' (48728 KB)...
OKAY (  1.283s)
writing 'radio'...
OKAY (  2.174s)
finished. total time: 3.457s
+ fastboot reboot-bootloader
rebooting into bootloader...
OKAY (  0.022s)
finished. total time: 0.072s
+ sleep 5
+ fastboot -w update image-angler-n2g48c.zip
extracting android-info.txt (0 MB)...
extracting boot.img (12 MB)...
target reported max download size of 494927872 bytes
archive does not contain 'boot.sig'
archive does not contain 'dtbo.img'
archive does not contain 'dt.img'
extracting recovery.img (17 MB)...
archive does not contain 'recovery.sig'
extracting system.img (2727 MB)...
W/ziparchive(66399): Zip: unable to allocate  2860210996 bytes at offset 0 : 
   No space left on device
failed to extract 'system.img': I/O error

(space inserted by myself for better readability)

I guess this lacks space on the phone.

shell@angler: $ df -h                                                  
Filesystem                Size      Used Available Use% Mounted on
tmpfs                     1.4G    484.0K      1.4G   0% /dev
tmpfs                     1.4G         0      1.4G   0% /mnt
/dev/block/dm-0           3.0G      1.8G      1.1G  62% /system
/dev/block/dm-1         196.6M    184.7M      8.0M  96% /vendor
/dev/block/platform/soc.0/f9824900.sdhci/by-name/cache
                         92.9M      1.8M     88.0M   2% /cache
/dev/block/platform/soc.0/f9824900.sdhci/by-name/persist
                          3.9M    740.0K      3.0M  20% /persist
/dev/block/platform/soc.0/f9824900.sdhci/by-name/modem
                         80.0M     47.5M     32.4M  59% /firmware
tmpfs                     1.4G         0      1.4G   0% /storage
/dev/block/dm-2          53.5G    132.9M     52.9G   0% /data
df: /mnt/runtime/default/emulated: Permission denied
/data/media              53.5G    132.9M     52.9G   0% /storage/emulated

Using fastboot version 1:8.1.0+r23-5 from Debian, Android is angler:8.1.0.

Any idea what the problem could be?

Searching the sources, it fails in static void* unzip_file(ZipArchiveHandle zip, const char* entry_name, int64_t* sz)

int error = ExtractToMemory(zip, &zip_entry, data, zip_entry.uncompressed_length);
if (error != 0) {
    fprintf(stderr, "failed to extract '%s': %sn", entry_name, ErrorCodeString(error));
    free(data);
    return 0;
}

https://android.googlesource.com/platform/system/core/+/android-8.1.0_r73/fastboot/fastboot.cpp#505

or in static int unzip_to_file(ZipArchiveHandle zip, const char* entry_name)

int error = ExtractEntryToFile(zip, &zip_entry, fd);
if (error != 0) {
    fprintf(stderr, "failed to extract '%s': %sn", entry_name, ErrorCodeString(error));
    return -1;
}

https://android.googlesource.com/platform/system/core/+/android-8.1.0_r73/fastboot/fastboot.cpp#628

TO UPDATE: It seems that it is really lack of space on the laptop. He previously had about 8 GB, which he considered sufficient. After having 17 GB and trying to update different images image-angler-nmf26f.zip, I received a different error (probably related /tmp being tmpfs):

strace -o strace.log fastboot -w update image-angler-nmf26f.zip
extracting android-info.txt (0 MB)...
extracting boot.img (12 MB)...
target reported max download size of 494927872 bytes
archive does not contain 'boot.sig'
archive does not contain 'dtbo.img'
archive does not contain 'dt.img'
extracting recovery.img (17 MB)...
archive does not contain 'recovery.sig'
extracting system.img (2691 MB)...
archive does not contain 'system.sig'
archive does not contain 'vbmeta.img'
extracting vendor.img (194 MB)...
W/ziparchive(109113): Zip: unable to allocate  204079852 bytes at offset 0 : No space left on device
failed to extract 'vendor.img': I/O error
wiping userdata...
Couldn't parse erase-block-size '0x'.
Couldn't parse logical-block-size '0x'.
mke2fs 1.45.5 (07-Jan-2020)
/tmp/TemporaryFile-xaoMGH: Unimplemented ext2 library function while setting up superblock
/usr/lib/android-sdk/platform-tools/mke2fs failed with status 1
mke2fs failed: 1
error: Cannot generate image for userdata

Getting an error after the user role of the backend assigned to the sales order in Magento 2.3.2

I face an error on the sales order display screen after assigning a backend user role -> sales

I have only refused to send sales for the user role.

Something went wrong while processing the default view and we have restored the filter to its original state.

screenshot 1

screenshot 2

How can I return a string assigned in C to Ada and release it in Ada?

This is the reverse of this question.

I have a string assigned in a C function (specifically by the cJSON library) that I want to return to an Ada caller as an output parameter, and release the Ada string.

The C interface looks like this:

typedef struct
{
    int f1;
    int f2;
    // ...
} A;

int Dump_Record(const A& rec, char** outstr);

the Dump_Record the function sets outtr to the value returned by cJSON_Print, which assigns a string through malloc.

How should the Ada link be specified and how can I retrieve the output string and deallocate it correctly in Ada?

key combinations: how can Karabiner assign the function of a key that has already been assigned from its original function?

I have reassigned the mostly useless lock key to escape using Karabiner. But it's only mainly useless, so I'd like to assign Shift-CapsLock to the true behavior of Caps Lock.

I tried the following advanced JSON mapping, but it only makes Shift-CapsLock behave like Escape, perhaps because caps_lock has already been mapped to its original function.

How can I achieve this?

{
     "description": "shift-caps_lock to Capslock",
     "manipulators": [
         {
             "from": {
                 "key_code": "caps_lock",
                   "modifiers": [
                       "shift"
                   ]
             },
             "to": {
                 "key_code": "caps_lock",

             },
             "type": "basic"
         }
     ]
},

Security – Is a police escort (SPU) in Somaliland automatically assigned abroad or should the foreigner request it?

I have read that a police escort from the Elite Special Police Unit (SPU) in Somaliland is required when traveling outside Hargeisa. E.g. https://www.onceinalifetimejourney.com/reviews/everything-else/safety-in-somaliland-is-somaliland-safe-to-visit/#Police_escort_in_Somaliland:

One of the most unique parts of traveling in Somaliland is the mandatory police escort that all visitors outside Hargeisa receive.

Is a police escort assigned in Somaliland automatically abroad or should the foreigner request it? If it is automatic, how does the police realize that the foreigner needs a police escort? If it is not automatic, how does the foreigner request the police escort?