I don't understand how this works.
I understand that you check if the girl has images with has_image.
Data (from
def acts(self):):
tags = (("gay", '2c lickpussy'),
("gay", "bc lickpussy"),
("gay", "2c lickanus"),
("gay", "bc lickanus"),
("gay", "2c vaginalfingering"),
("gay", "bc vagnalhandjob"), # @Inconsistent tagnames!
("gay", "2c analfingering"),
("gay", "bc analhandjob"), # @Inconsistent tagnames!
("gay", "2c caresstits"),
("gay", "bc caresstits"),
("gay", "bc hug", "2c hug"),
("gay", "2c vaginal"),
("gay", "bc vaginal"),
("gay", "2c anal"),
("gay", "bc anal"),
("gay", "2c vaginaltoy"),
("gay", "bc toypussy"), # @Inconsistent tagnames!
("gay", "2c analtoy"),
("gay", "bc toyanal"), # @Inconsistent tagnames!
{"tags": ["gay"], "exclude": ["2c vaginal", "2c vaginaltoy"]}
)
That data is then passed to the method you mentioned and we try to figure out which acts have pictures.
Why do you check for types with isinstance?
Because the data has tuples (just tags) and dictionaries (that can have exclude and dice() as well as tags). Once we know what type of the data we are checking at the moment, we can act accordingly.
What (*t.get("tags", []), exclude=t.get("exclude", [])) and dice(t.get("dice", 100)) means?
*t.get("tags", []),
* here means unpack a tuple or list. I just provided an example of unpacking a dictionary to any func/class a few post back using
**.
for t in some_container:
# ...
Plain for loop like an any other programming language, since we checked to make sure t is a dictionary, we know what we work with here:
dict.get("key", some_default)
is a very cool thing in Python, we request a key from any dictionary, if such a key exist: we plainly get it's value, if there is no key: we use a provided default instead.
So:
Data: {tags: ("profile", "happy"), exclude=["nude"], dice=90}
becomes:
if dice(90):
if self.worker.has_image("profile", "happy", exclude=["nude"]):
# Add tag to the pool to randomly choose from.
Dice will default to 100 if we don't prove one (and will not be checked under my code if there is no image with provided tags found since it is following "and" (meaning that there are no extra delays)), exclude will default to an empty list and tags also default to an empty list (although that is stupid since such request would not be even remotely useful, but juse in case...).