[{"data":1,"prerenderedAt":6464},["ShallowReactive",2],{"tutorials-python-how-to":3,"category-items-python-how-to":600,"content-/python-how-to/implement-retry-logic":601},[4,22,31,40,49,58,67,76,86,94,103,112,121,130,139,148,158,167,176,185,194,203,212,222,231,240,249,258,267,276,285,297,306,315,324,333,342,351,362,371,380,389,398,407,418,427,436,445,454,463,472,483,492,501,510,519,528,539,548,557,566,575,584,593],{"_path":5,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":9,"description":10,"slug":11,"order":12,"isParent":13,"icon":14,"_type":15,"_id":16,"_source":17,"_file":18,"_stem":19,"_extension":20,"children":21,"expanded":13},"/python-how-to/string-manipulation","python-how-to",false,"","String Manipulation","Learn essential string manipulation techniques in Python","string-manipulation",1,true,"pi pi-folder","markdown","content:python-how-to:1.string-manipulation.md","content","python-how-to/1.string-manipulation.md","python-how-to/1.string-manipulation","md",[22,31,40,49,58,67],{"_path":23,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":24,"description":25,"slug":26,"parentId":5,"order":27,"_type":15,"_id":28,"_source":17,"_file":29,"_stem":30,"_extension":20},"/python-how-to/split-join-strings","Split and Join Strings","Learn how to split strings into lists and join lists back into strings in Python","split-join-strings",2,"content:python-how-to:2.split-join-strings.md","python-how-to/2.split-join-strings.md","python-how-to/2.split-join-strings",{"_path":32,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":33,"description":34,"slug":35,"parentId":5,"order":36,"_type":15,"_id":37,"_source":17,"_file":38,"_stem":39,"_extension":20},"/python-how-to/remove-whitespace","Remove Whitespace","Learn how to clean up and remove unwanted whitespace from strings in Python","remove-whitespace",3,"content:python-how-to:3.remove-whitespace.md","python-how-to/3.remove-whitespace.md","python-how-to/3.remove-whitespace",{"_path":41,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":42,"description":43,"slug":44,"parentId":5,"order":45,"_type":15,"_id":46,"_source":17,"_file":47,"_stem":48,"_extension":20},"/python-how-to/find-replace-text","Find and Replace Text","Learn how to search for and replace text within strings in Python","find-replace-text",4,"content:python-how-to:4.find-replace-text.md","python-how-to/4.find-replace-text.md","python-how-to/4.find-replace-text",{"_path":50,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":51,"description":52,"slug":53,"parentId":5,"order":54,"_type":15,"_id":55,"_source":17,"_file":56,"_stem":57,"_extension":20},"/python-how-to/check-string-content","Check String Content","Learn how to validate and check the content of strings in Python","check-string-content",5,"content:python-how-to:5.check-string-content.md","python-how-to/5.check-string-content.md","python-how-to/5.check-string-content",{"_path":59,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":60,"description":61,"slug":62,"parentId":5,"order":63,"_type":15,"_id":64,"_source":17,"_file":65,"_stem":66,"_extension":20},"/python-how-to/format-strings","Format Strings","Learn how to format strings in Python using f-strings and format() method","format-strings",6,"content:python-how-to:6.format-strings.md","python-how-to/6.format-strings.md","python-how-to/6.format-strings",{"_path":68,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":69,"description":70,"slug":71,"parentId":5,"order":72,"_type":15,"_id":73,"_source":17,"_file":74,"_stem":75,"_extension":20},"/python-how-to/unicode-special-chars","Handle Unicode and Special Characters","Learn how to work with Unicode and special characters in Python strings","unicode-special-chars",7,"content:python-how-to:7.unicode-special-chars.md","python-how-to/7.unicode-special-chars.md","python-how-to/7.unicode-special-chars",{"_path":77,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":78,"description":79,"slug":80,"order":81,"isParent":13,"icon":14,"_type":15,"_id":82,"_source":17,"_file":83,"_stem":84,"_extension":20,"children":85,"expanded":13},"/python-how-to/list-operations","List Operations","Learn essential operations for working with lists in Python","list-operations",8,"content:python-how-to:8.list-operations.md","python-how-to/8.list-operations.md","python-how-to/8.list-operations",[86,94,103,112,121,130,139],{"_path":87,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":88,"description":89,"slug":90,"parentId":77,"order":81,"_type":15,"_id":91,"_source":17,"_file":92,"_stem":93,"_extension":20},"/python-how-to/sort-lists","Sort Lists","Learn how to sort lists in Python using different methods and custom sorting","sort-lists","content:python-how-to:9.sort-lists.md","python-how-to/9.sort-lists.md","python-how-to/9.sort-lists",{"_path":95,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":96,"description":97,"slug":98,"parentId":77,"order":99,"_type":15,"_id":100,"_source":17,"_file":101,"_stem":102,"_extension":20},"/python-how-to/remove-duplicates","Remove Duplicates","Learn how to remove duplicate elements from lists in Python","remove-duplicates",10,"content:python-how-to:10.remove-duplicates.md","python-how-to/10.remove-duplicates.md","python-how-to/10.remove-duplicates",{"_path":104,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":105,"description":106,"slug":107,"parentId":77,"order":108,"_type":15,"_id":109,"_source":17,"_file":110,"_stem":111,"_extension":20},"/python-how-to/filter-lists","Filter Lists","Learn how to filter lists in Python using different methods","filter-lists",11,"content:python-how-to:11.filter-lists.md","python-how-to/11.filter-lists.md","python-how-to/11.filter-lists",{"_path":113,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":114,"description":115,"slug":116,"parentId":77,"order":117,"_type":15,"_id":118,"_source":17,"_file":119,"_stem":120,"_extension":20},"/python-how-to/combine-lists","Combine Lists","Learn different methods to combine lists in Python","combine-lists",12,"content:python-how-to:12.combine-lists.md","python-how-to/12.combine-lists.md","python-how-to/12.combine-lists",{"_path":122,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":123,"description":124,"slug":125,"parentId":77,"order":126,"_type":15,"_id":127,"_source":17,"_file":128,"_stem":129,"_extension":20},"/python-how-to/list-comprehensions","Use List Comprehensions","Learn how to create and transform lists efficiently using Python's list comprehension syntax","list-comprehensions",13,"content:python-how-to:13.list-comprehensions.md","python-how-to/13.list-comprehensions.md","python-how-to/13.list-comprehensions",{"_path":131,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":132,"description":133,"slug":134,"parentId":77,"order":135,"_type":15,"_id":136,"_source":17,"_file":137,"_stem":138,"_extension":20},"/python-how-to/nested-lists","Work with Nested Lists","Learn how to work with nested lists (2D arrays) in Python","nested-lists",14,"content:python-how-to:14.nested-lists.md","python-how-to/14.nested-lists.md","python-how-to/14.nested-lists",{"_path":140,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":141,"description":142,"slug":143,"parentId":77,"order":144,"_type":15,"_id":145,"_source":17,"_file":146,"_stem":147,"_extension":20},"/python-how-to/enumerate-zip","Use enumerate() and zip()","Learn how to use enumerate() and zip() for efficient iteration in Python","enumerate-zip",15,"content:python-how-to:15.enumerate-zip.md","python-how-to/15.enumerate-zip.md","python-how-to/15.enumerate-zip",{"_path":149,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":150,"description":151,"slug":152,"order":153,"isParent":13,"icon":14,"_type":15,"_id":154,"_source":17,"_file":155,"_stem":156,"_extension":20,"children":157,"expanded":13},"/python-how-to/dictionary-operations","Dictionary Operations","Learn essential operations for working with dictionaries in Python","dictionary-operations",16,"content:python-how-to:16.dictionary-operations.md","python-how-to/16.dictionary-operations.md","python-how-to/16.dictionary-operations",[158,167,176,185,194,203],{"_path":159,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":160,"description":161,"slug":162,"parentId":149,"order":163,"_type":15,"_id":164,"_source":17,"_file":165,"_stem":166,"_extension":20},"/python-how-to/merge-dictionaries","Merge Dictionaries","Learn different methods to merge dictionaries in Python","merge-dictionaries",17,"content:python-how-to:17.merge-dictionaries.md","python-how-to/17.merge-dictionaries.md","python-how-to/17.merge-dictionaries",{"_path":168,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":169,"description":170,"slug":171,"parentId":149,"order":172,"_type":15,"_id":173,"_source":17,"_file":174,"_stem":175,"_extension":20},"/python-how-to/sort-dictionaries","Sort Dictionaries","Learn how to sort dictionaries by keys or values in Python","sort-dictionaries",18,"content:python-how-to:18.sort-dictionaries.md","python-how-to/18.sort-dictionaries.md","python-how-to/18.sort-dictionaries",{"_path":177,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":178,"description":179,"slug":180,"parentId":149,"order":181,"_type":15,"_id":182,"_source":17,"_file":183,"_stem":184,"_extension":20},"/python-how-to/filter-dictionaries","Filter Dictionaries","Learn how to filter dictionaries based on keys or values in Python","filter-dictionaries",19,"content:python-how-to:19.filter-dictionaries.md","python-how-to/19.filter-dictionaries.md","python-how-to/19.filter-dictionaries",{"_path":186,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":187,"description":188,"slug":189,"parentId":149,"order":190,"_type":15,"_id":191,"_source":17,"_file":192,"_stem":193,"_extension":20},"/python-how-to/handle-missing-keys","Handle Missing Keys","Learn safe ways to access dictionary keys and handle missing values","handle-missing-keys",20,"content:python-how-to:20.handle-missing-keys.md","python-how-to/20.handle-missing-keys.md","python-how-to/20.handle-missing-keys",{"_path":195,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":196,"description":197,"slug":198,"parentId":149,"order":199,"_type":15,"_id":200,"_source":17,"_file":201,"_stem":202,"_extension":20},"/python-how-to/dictionary-comprehensions","Use Dictionary Comprehensions","Learn how to create dictionaries efficiently using comprehensions","dictionary-comprehensions",21,"content:python-how-to:21.dictionary-comprehensions.md","python-how-to/21.dictionary-comprehensions.md","python-how-to/21.dictionary-comprehensions",{"_path":204,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":205,"description":206,"slug":207,"parentId":149,"order":208,"_type":15,"_id":209,"_source":17,"_file":210,"_stem":211,"_extension":20},"/python-how-to/convert-lists-dictionaries","Convert Between Lists and Dictionaries","Learn how to transform data between lists and dictionaries in Python","convert-lists-dictionaries",22,"content:python-how-to:22.convert-lists-dictionaries.md","python-how-to/22.convert-lists-dictionaries.md","python-how-to/22.convert-lists-dictionaries",{"_path":213,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":214,"description":215,"slug":216,"order":217,"isParent":13,"icon":14,"_type":15,"_id":218,"_source":17,"_file":219,"_stem":220,"_extension":20,"children":221,"expanded":13},"/python-how-to/file-operations","File Operations","Learn essential file operations in Python for reading, writing, and managing files","file-operations",23,"content:python-how-to:23.file-operations.md","python-how-to/23.file-operations.md","python-how-to/23.file-operations",[222,231,240,249,258,267,276],{"_path":223,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":224,"description":225,"slug":226,"parentId":213,"order":227,"_type":15,"_id":228,"_source":17,"_file":229,"_stem":230,"_extension":20},"/python-how-to/read-text-files","Read Text Files","Learn how to read text files in Python using different methods","read-text-files",24,"content:python-how-to:24.read-text-files.md","python-how-to/24.read-text-files.md","python-how-to/24.read-text-files",{"_path":232,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":233,"description":234,"slug":235,"parentId":213,"order":236,"_type":15,"_id":237,"_source":17,"_file":238,"_stem":239,"_extension":20},"/python-how-to/write-to-files","Write to Files","Learn how to write and create files in Python using different methods","write-to-files",25,"content:python-how-to:25.write-to-files.md","python-how-to/25.write-to-files.md","python-how-to/25.write-to-files",{"_path":241,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":242,"description":243,"slug":244,"parentId":213,"order":245,"_type":15,"_id":246,"_source":17,"_file":247,"_stem":248,"_extension":20},"/python-how-to/work-csv-files","Work with CSV Files","Learn how to read and write CSV files in Python using the csv module","work-csv-files",26,"content:python-how-to:26.work-csv-files.md","python-how-to/26.work-csv-files.md","python-how-to/26.work-csv-files",{"_path":250,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":251,"description":252,"slug":253,"parentId":213,"order":254,"_type":15,"_id":255,"_source":17,"_file":256,"_stem":257,"_extension":20},"/python-how-to/handle-file-paths","Handle File Paths","Learn how to work with file and directory paths in Python using pathlib and os modules","handle-file-paths",27,"content:python-how-to:27.handle-file-paths.md","python-how-to/27.handle-file-paths.md","python-how-to/27.handle-file-paths",{"_path":259,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":260,"description":261,"slug":262,"parentId":213,"order":263,"_type":15,"_id":264,"_source":17,"_file":265,"_stem":266,"_extension":20},"/python-how-to/work-json-files","Work with JSON Files","Learn how to read and write JSON files in Python using the json module","work-json-files",28,"content:python-how-to:28.work-json-files.md","python-how-to/28.work-json-files.md","python-how-to/28.work-json-files",{"_path":268,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":269,"description":270,"slug":271,"parentId":213,"order":272,"_type":15,"_id":273,"_source":17,"_file":274,"_stem":275,"_extension":20},"/python-how-to/handle-binary-files","Handle Binary Files","Learn how to work with binary files in Python for images, data, and other non-text content","handle-binary-files",29,"content:python-how-to:29.handle-binary-files.md","python-how-to/29.handle-binary-files.md","python-how-to/29.handle-binary-files",{"_path":277,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":278,"description":279,"slug":280,"parentId":213,"order":281,"_type":15,"_id":282,"_source":17,"_file":283,"_stem":284,"_extension":20},"/python-how-to/use-context-managers","Use Context Managers","Learn how to use context managers for safe resource handling in Python","use-context-managers",30,"content:python-how-to:30.use-context-managers.md","python-how-to/30.use-context-managers.md","python-how-to/30.use-context-managers",{"_path":286,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":287,"description":288,"slug":289,"parentId":290,"order":291,"isParent":13,"icon":292,"_type":15,"_id":293,"_source":17,"_file":294,"_stem":295,"_extension":20,"children":296,"expanded":13},"/python-how-to/date-and-time","Date and Time","Master Python's date and time handling with datetime, time zones, formatting, and calculations","date-and-time","/python-how-to",31,"pi pi-calendar","content:python-how-to:31.date-and-time.md","python-how-to/31.date-and-time.md","python-how-to/31.date-and-time",[297,306,315,324,333,342],{"_path":298,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":299,"description":300,"slug":301,"parentId":286,"order":302,"_type":15,"_id":303,"_source":17,"_file":304,"_stem":305,"_extension":20},"/python-how-to/get-current-datetime","Get Current Date/Time","Learn how to get current date, time, and timestamps using Python's datetime module","get-current-datetime",32,"content:python-how-to:32.get-current-datetime.md","python-how-to/32.get-current-datetime.md","python-how-to/32.get-current-datetime",{"_path":307,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":308,"description":309,"slug":310,"parentId":286,"order":311,"_type":15,"_id":312,"_source":17,"_file":313,"_stem":314,"_extension":20},"/python-how-to/format-dates","Format Dates","Master date formatting with strftime, custom formats, and locale-aware formatting for user-friendly displays","format-dates",33,"content:python-how-to:33.format-dates.md","python-how-to/33.format-dates.md","python-how-to/33.format-dates",{"_path":316,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":317,"description":318,"slug":319,"parentId":286,"order":320,"_type":15,"_id":321,"_source":17,"_file":322,"_stem":323,"_extension":20},"/python-how-to/calculate-date-differences","Calculate Date Differences","Learn to calculate time differences, durations, and intervals using Python's timedelta for scheduling and analytics","calculate-date-differences",34,"content:python-how-to:34.calculate-date-differences.md","python-how-to/34.calculate-date-differences.md","python-how-to/34.calculate-date-differences",{"_path":325,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":326,"description":327,"slug":328,"parentId":286,"order":329,"_type":15,"_id":330,"_source":17,"_file":331,"_stem":332,"_extension":20},"/python-how-to/parse-date-strings","Parse Date Strings","Convert text dates into Python datetime objects using strptime, handle multiple formats, and validate date input","parse-date-strings",35,"content:python-how-to:35.parse-date-strings.md","python-how-to/35.parse-date-strings.md","python-how-to/35.parse-date-strings",{"_path":334,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":335,"description":336,"slug":337,"parentId":286,"order":338,"_type":15,"_id":339,"_source":17,"_file":340,"_stem":341,"_extension":20},"/python-how-to/handle-timezones","Handle Timezones","Master timezone handling with zoneinfo, UTC conversions, and timezone-aware datetime objects for global applications","handle-timezones",36,"content:python-how-to:36.handle-timezones.md","python-how-to/36.handle-timezones.md","python-how-to/36.handle-timezones",{"_path":343,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":344,"description":345,"slug":346,"parentId":286,"order":347,"_type":15,"_id":348,"_source":17,"_file":349,"_stem":350,"_extension":20},"/python-how-to/work-with-timestamps","Work with Timestamps","Master Unix timestamps in Python - convert between datetime objects and timestamps for APIs, databases, and system integration","work-with-timestamps",37,"content:python-how-to:37.work-with-timestamps.md","python-how-to/37.work-with-timestamps.md","python-how-to/37.work-with-timestamps",{"_path":352,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":353,"description":354,"slug":355,"parentId":290,"order":356,"isParent":13,"icon":357,"_type":15,"_id":358,"_source":17,"_file":359,"_stem":360,"_extension":20,"children":361,"expanded":13},"/python-how-to/error-handling","Error Handling","Learn Python's error handling with try/except, custom exceptions, debugging, logging, and retry logic for robust applications","error-handling",38,"pi pi-exclamation-triangle","content:python-how-to:38.error-handling.md","python-how-to/38.error-handling.md","python-how-to/38.error-handling",[362,371,380,389,398],{"_path":363,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":364,"description":365,"slug":366,"parentId":352,"order":367,"_type":15,"_id":368,"_source":17,"_file":369,"_stem":370,"_extension":20},"/python-how-to/handle-exceptions","Handle Exceptions","Master try/except blocks, multiple exception handling, and finally clauses for robust error handling in Python","handle-exceptions",39,"content:python-how-to:39.handle-exceptions.md","python-how-to/39.handle-exceptions.md","python-how-to/39.handle-exceptions",{"_path":372,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":373,"description":374,"slug":375,"parentId":352,"order":376,"_type":15,"_id":377,"_source":17,"_file":378,"_stem":379,"_extension":20},"/python-how-to/create-custom-exceptions","Create Custom Exceptions","Learn to create custom exception classes in Python for specific error handling and better code organization","create-custom-exceptions",40,"content:python-how-to:40.create-custom-exceptions.md","python-how-to/40.create-custom-exceptions.md","python-how-to/40.create-custom-exceptions",{"_path":381,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":382,"description":383,"slug":384,"parentId":352,"order":385,"_type":15,"_id":386,"_source":17,"_file":387,"_stem":388,"_extension":20},"/python-how-to/debug-code","Debug Code","Learn Python debugging techniques using print statements, the debugger, and tools to find and fix code issues","debug-code",41,"content:python-how-to:41.debug-code.md","python-how-to/41.debug-code.md","python-how-to/41.debug-code",{"_path":390,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":391,"description":392,"slug":393,"parentId":352,"order":394,"_type":15,"_id":395,"_source":17,"_file":396,"_stem":397,"_extension":20},"/python-how-to/use-logging","Use Logging","Learn Python's logging module for tracking application behavior, errors, and debugging information","use-logging",42,"content:python-how-to:42.use-logging.md","python-how-to/42.use-logging.md","python-how-to/42.use-logging",{"_path":399,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":400,"description":401,"slug":402,"parentId":352,"order":403,"_type":15,"_id":404,"_source":17,"_file":405,"_stem":406,"_extension":20},"/python-how-to/implement-retry-logic","Implement Retry Logic","Learn to implement retry mechanisms in Python for handling temporary failures and building resilient applications","implement-retry-logic",43,"content:python-how-to:43.implement-retry-logic.md","python-how-to/43.implement-retry-logic.md","python-how-to/43.implement-retry-logic",{"_path":408,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":409,"description":410,"slug":411,"parentId":290,"order":412,"isParent":13,"icon":413,"_type":15,"_id":414,"_source":17,"_file":415,"_stem":416,"_extension":20,"children":417},"/python-how-to/functions-and-modules","Functions and Modules","Learn Python functions, modules, and code organization for building reusable, maintainable applications","functions-and-modules",44,"pi pi-box","content:python-how-to:44.functions-and-modules.md","python-how-to/44.functions-and-modules.md","python-how-to/44.functions-and-modules",[418,427,436,445,454,463],{"_path":419,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":420,"description":421,"slug":422,"parentId":408,"order":423,"_type":15,"_id":424,"_source":17,"_file":425,"_stem":426,"_extension":20},"/python-how-to/write-functions","Write Functions","Learn to create Python functions with parameters, return values, and documentation for reusable code","write-functions",45,"content:python-how-to:45.write-functions.md","python-how-to/45.write-functions.md","python-how-to/45.write-functions",{"_path":428,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":429,"description":430,"slug":431,"parentId":408,"order":432,"_type":15,"_id":433,"_source":17,"_file":434,"_stem":435,"_extension":20},"/python-how-to/use-args-kwargs","Use *args and **kwargs","Learn to use *args and **kwargs for flexible function arguments in Python","use-args-kwargs",46,"content:python-how-to:46.use-args-kwargs.md","python-how-to/46.use-args-kwargs.md","python-how-to/46.use-args-kwargs",{"_path":437,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":438,"description":439,"slug":440,"parentId":408,"order":441,"_type":15,"_id":442,"_source":17,"_file":443,"_stem":444,"_extension":20},"/python-how-to/create-decorators","Create Decorators","Learn to create and use Python decorators to enhance function behavior and add functionality","create-decorators",47,"content:python-how-to:47.create-decorators.md","python-how-to/47.create-decorators.md","python-how-to/47.create-decorators",{"_path":446,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":447,"description":448,"slug":449,"parentId":408,"order":450,"_type":15,"_id":451,"_source":17,"_file":452,"_stem":453,"_extension":20},"/python-how-to/use-generators","Use Generators","Learn to create memory-efficient generators with yield for processing large datasets and sequences","use-generators",48,"content:python-how-to:48.use-generators.md","python-how-to/48.use-generators.md","python-how-to/48.use-generators",{"_path":455,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":456,"description":457,"slug":458,"parentId":408,"order":459,"_type":15,"_id":460,"_source":17,"_file":461,"_stem":462,"_extension":20},"/python-how-to/work-modules-packages","Work with Modules and Packages","Learn to organize Python code with modules and packages, and use imports effectively","work-modules-packages",49,"content:python-how-to:49.work-modules-packages.md","python-how-to/49.work-modules-packages.md","python-how-to/49.work-modules-packages",{"_path":464,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":465,"description":466,"slug":467,"parentId":408,"order":468,"_type":15,"_id":469,"_source":17,"_file":470,"_stem":471,"_extension":20},"/python-how-to/create-virtual-environments","Create Virtual Environments","Learn to create and manage Python virtual environments for project dependency isolation","create-virtual-environments",50,"content:python-how-to:50.create-virtual-environments.md","python-how-to/50.create-virtual-environments.md","python-how-to/50.create-virtual-environments",{"_path":473,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":474,"description":475,"slug":476,"parentId":290,"order":477,"isParent":13,"icon":478,"_type":15,"_id":479,"_source":17,"_file":480,"_stem":481,"_extension":20,"children":482},"/python-how-to/data-processing","Data Processing","Learn Python data processing techniques including regex, APIs, databases, and large file handling","data-processing",51,"pi pi-database","content:python-how-to:51.data-processing.md","python-how-to/51.data-processing.md","python-how-to/51.data-processing",[483,492,501,510,519],{"_path":484,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":485,"description":486,"slug":487,"parentId":473,"order":488,"_type":15,"_id":489,"_source":17,"_file":490,"_stem":491,"_extension":20},"/python-how-to/work-regular-expressions","Work with Regular Expressions","Learn to use Python's re module for pattern matching, text extraction, and data validation","work-regular-expressions",52,"content:python-how-to:52.work-regular-expressions.md","python-how-to/52.work-regular-expressions.md","python-how-to/52.work-regular-expressions",{"_path":493,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":494,"description":495,"slug":496,"parentId":473,"order":497,"_type":15,"_id":498,"_source":17,"_file":499,"_stem":500,"_extension":20},"/python-how-to/parse-xml-html","Parse XML and HTML","Learn to extract data from XML and HTML documents using Python's built-in parsing tools","parse-xml-html",53,"content:python-how-to:53.parse-xml-html.md","python-how-to/53.parse-xml-html.md","python-how-to/53.parse-xml-html",{"_path":502,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":503,"description":504,"slug":505,"parentId":473,"order":506,"_type":15,"_id":507,"_source":17,"_file":508,"_stem":509,"_extension":20},"/python-how-to/handle-api-requests","Handle API Requests","Learn to fetch and process data from web APIs using Python's urllib and external requests library","handle-api-requests",54,"content:python-how-to:54.handle-api-requests.md","python-how-to/54.handle-api-requests.md","python-how-to/54.handle-api-requests",{"_path":511,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":512,"description":513,"slug":514,"parentId":473,"order":515,"_type":15,"_id":516,"_source":17,"_file":517,"_stem":518,"_extension":20},"/python-how-to/work-databases","Work with Databases","Learn to connect to and query SQL databases using Python's sqlite3 and database techniques","work-databases",55,"content:python-how-to:55.work-databases.md","python-how-to/55.work-databases.md","python-how-to/55.work-databases",{"_path":520,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":521,"description":522,"slug":523,"parentId":473,"order":524,"_type":15,"_id":525,"_source":17,"_file":526,"_stem":527,"_extension":20},"/python-how-to/process-large-files","Process Large Files","Learn memory-efficient techniques for handling large files and datasets in Python","process-large-files",56,"content:python-how-to:56.process-large-files.md","python-how-to/56.process-large-files.md","python-how-to/56.process-large-files",{"_path":529,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":530,"description":531,"slug":532,"parentId":290,"order":533,"isParent":13,"icon":534,"_type":15,"_id":535,"_source":17,"_file":536,"_stem":537,"_extension":20,"children":538},"/python-how-to/best-practices","Best Practices","Learn Python best practices for writing clean, maintainable, and efficient code","best-practices",57,"pi pi-star","content:python-how-to:57.best-practices.md","python-how-to/57.best-practices.md","python-how-to/57.best-practices",[539,548,557,566,575,584],{"_path":540,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":541,"description":542,"slug":543,"parentId":529,"order":544,"_type":15,"_id":545,"_source":17,"_file":546,"_stem":547,"_extension":20},"/python-how-to/structure-code","Structure Your Code","Learn to organize Python code with proper module structure, functions, and classes","structure-code",58,"content:python-how-to:58.structure-code.md","python-how-to/58.structure-code.md","python-how-to/58.structure-code",{"_path":549,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":550,"description":551,"slug":552,"parentId":529,"order":553,"_type":15,"_id":554,"_source":17,"_file":555,"_stem":556,"_extension":20},"/python-how-to/write-clean-code","Write Clean Code","Learn to write readable, maintainable Python code with proper naming, comments, and clear logic","write-clean-code",59,"content:python-how-to:59.write-clean-code.md","python-how-to/59.write-clean-code.md","python-how-to/59.write-clean-code",{"_path":558,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":559,"description":560,"slug":561,"parentId":529,"order":562,"_type":15,"_id":563,"_source":17,"_file":564,"_stem":565,"_extension":20},"/python-how-to/optimize-performance","Optimize Performance","Learn to identify and fix performance bottlenecks in Python code for faster execution","optimize-performance",60,"content:python-how-to:60.optimize-performance.md","python-how-to/60.optimize-performance.md","python-how-to/60.optimize-performance",{"_path":567,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":568,"description":569,"slug":570,"parentId":529,"order":571,"_type":15,"_id":572,"_source":17,"_file":573,"_stem":574,"_extension":20},"/python-how-to/write-unit-tests","Write Unit Tests","Learn to create reliable unit tests to verify your Python code works correctly and catch bugs early","write-unit-tests",61,"content:python-how-to:61.write-unit-tests.md","python-how-to/61.write-unit-tests.md","python-how-to/61.write-unit-tests",{"_path":576,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":577,"description":578,"slug":579,"parentId":529,"order":580,"_type":15,"_id":581,"_source":17,"_file":582,"_stem":583,"_extension":20},"/python-how-to/document-code","Document Your Code","Learn to write clear documentation and helpful comments for your Python code","document-code",62,"content:python-how-to:62.document-code.md","python-how-to/62.document-code.md","python-how-to/62.document-code",{"_path":585,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":586,"description":587,"slug":588,"parentId":529,"order":589,"_type":15,"_id":590,"_source":17,"_file":591,"_stem":592,"_extension":20},"/python-how-to/use-type-hints","Use Type Hints","Learn to add type annotations to Python code for better clarity, tooling support, and error detection","use-type-hints",63,"content:python-how-to:63.use-type-hints.md","python-how-to/63.use-type-hints.md","python-how-to/63.use-type-hints",{"_path":290,"_dir":8,"_draft":7,"_partial":7,"_locale":8,"title":594,"description":595,"slug":6,"order":596,"icon":14,"_type":15,"_id":597,"_source":17,"_file":598,"_stem":599,"_extension":20,"expanded":13},"Python How-To Guide","Practical Python tutorials for common programming tasks. Learn step-by-step solutions for string manipulation, file operations, data processing, and more with real-world examples.",0,"content:python-how-to:index.md","python-how-to/index.md","python-how-to/index",[398],{"_path":399,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":400,"description":401,"slug":402,"parentId":352,"order":403,"body":602,"_type":15,"_id":404,"_source":17,"_file":405,"_stem":406,"_extension":20},{"type":603,"children":604,"toc":6445},"root",[605,614,620,1217,1224,1229,1321,1328,1932,1937,2582,2588,3312,3318,3420,3426,3432,4172,4178,4929,4935,6009,6015,6021,6133,6139,6266,6272,6412,6418,6423,6439],{"type":606,"tag":607,"props":608,"children":610},"element","h1",{"id":609},"implementing-retry-logic",[611],{"type":612,"value":613},"text","🔄 Implementing Retry Logic",{"type":606,"tag":615,"props":616,"children":617},"p",{},[618],{"type":612,"value":619},"Retry logic helps your applications handle temporary failures gracefully by automatically retrying failed operations. This is essential for network requests, database connections, and other operations that might fail temporarily.",{"type":606,"tag":621,"props":622,"children":623},"code-try",{},[624],{"type":606,"tag":625,"props":626,"children":630},"pre",{"className":627,"code":628,"language":629,"meta":8,"style":8},"language-python shiki shiki-themes github-light github-dark","import time\nimport random\n\ndef unreliable_operation():\n    # Simulate operation that fails sometimes\n    if random.random() \u003C 0.7:  # 70% chance of failure\n        raise ConnectionError(\"Network timeout\")\n    return \"Operation successful\"\n\ndef simple_retry(max_attempts=3):\n    for attempt in range(max_attempts):\n        try:\n            result = unreliable_operation()\n            print(f\"Success on attempt {attempt + 1}\")\n            return result\n        except ConnectionError as e:\n            print(f\"Attempt {attempt + 1} failed: {e}\")\n            if attempt == max_attempts - 1:\n                raise  # Re-raise on final attempt\n            time.sleep(1)  # Wait before retry\n\n# Test retry logic\ntry:\n    result = simple_retry()\n    print(f\"Final result: {result}\")\nexcept ConnectionError:\n    print(\"All retry attempts failed\")\n","python",[631],{"type":606,"tag":632,"props":633,"children":634},"code",{"__ignoreMap":8},[635,652,664,672,691,700,734,763,776,784,816,844,857,874,925,938,960,1023,1059,1072,1095,1102,1110,1122,1139,1181,1197],{"type":606,"tag":636,"props":637,"children":639},"span",{"class":638,"line":12},"line",[640,646],{"type":606,"tag":636,"props":641,"children":643},{"style":642},"--shiki-default:#D73A49;--shiki-app-dark-mode:#F97583",[644],{"type":612,"value":645},"import",{"type":606,"tag":636,"props":647,"children":649},{"style":648},"--shiki-default:#24292E;--shiki-app-dark-mode:#E1E4E8",[650],{"type":612,"value":651}," time\n",{"type":606,"tag":636,"props":653,"children":654},{"class":638,"line":27},[655,659],{"type":606,"tag":636,"props":656,"children":657},{"style":642},[658],{"type":612,"value":645},{"type":606,"tag":636,"props":660,"children":661},{"style":648},[662],{"type":612,"value":663}," random\n",{"type":606,"tag":636,"props":665,"children":666},{"class":638,"line":36},[667],{"type":606,"tag":636,"props":668,"children":669},{"emptyLinePlaceholder":13},[670],{"type":612,"value":671},"\n",{"type":606,"tag":636,"props":673,"children":674},{"class":638,"line":45},[675,680,686],{"type":606,"tag":636,"props":676,"children":677},{"style":642},[678],{"type":612,"value":679},"def",{"type":606,"tag":636,"props":681,"children":683},{"style":682},"--shiki-default:#6F42C1;--shiki-app-dark-mode:#B392F0",[684],{"type":612,"value":685}," unreliable_operation",{"type":606,"tag":636,"props":687,"children":688},{"style":648},[689],{"type":612,"value":690},"():\n",{"type":606,"tag":636,"props":692,"children":693},{"class":638,"line":54},[694],{"type":606,"tag":636,"props":695,"children":697},{"style":696},"--shiki-default:#6A737D;--shiki-app-dark-mode:#6A737D",[698],{"type":612,"value":699},"    # Simulate operation that fails sometimes\n",{"type":606,"tag":636,"props":701,"children":702},{"class":638,"line":63},[703,708,713,718,724,729],{"type":606,"tag":636,"props":704,"children":705},{"style":642},[706],{"type":612,"value":707},"    if",{"type":606,"tag":636,"props":709,"children":710},{"style":648},[711],{"type":612,"value":712}," random.random() ",{"type":606,"tag":636,"props":714,"children":715},{"style":642},[716],{"type":612,"value":717},"\u003C",{"type":606,"tag":636,"props":719,"children":721},{"style":720},"--shiki-default:#005CC5;--shiki-app-dark-mode:#79B8FF",[722],{"type":612,"value":723}," 0.7",{"type":606,"tag":636,"props":725,"children":726},{"style":648},[727],{"type":612,"value":728},":  ",{"type":606,"tag":636,"props":730,"children":731},{"style":696},[732],{"type":612,"value":733},"# 70% chance of failure\n",{"type":606,"tag":636,"props":735,"children":736},{"class":638,"line":72},[737,742,747,752,758],{"type":606,"tag":636,"props":738,"children":739},{"style":642},[740],{"type":612,"value":741},"        raise",{"type":606,"tag":636,"props":743,"children":744},{"style":720},[745],{"type":612,"value":746}," ConnectionError",{"type":606,"tag":636,"props":748,"children":749},{"style":648},[750],{"type":612,"value":751},"(",{"type":606,"tag":636,"props":753,"children":755},{"style":754},"--shiki-default:#032F62;--shiki-app-dark-mode:#9ECBFF",[756],{"type":612,"value":757},"\"Network timeout\"",{"type":606,"tag":636,"props":759,"children":760},{"style":648},[761],{"type":612,"value":762},")\n",{"type":606,"tag":636,"props":764,"children":765},{"class":638,"line":81},[766,771],{"type":606,"tag":636,"props":767,"children":768},{"style":642},[769],{"type":612,"value":770},"    return",{"type":606,"tag":636,"props":772,"children":773},{"style":754},[774],{"type":612,"value":775}," \"Operation successful\"\n",{"type":606,"tag":636,"props":777,"children":779},{"class":638,"line":778},9,[780],{"type":606,"tag":636,"props":781,"children":782},{"emptyLinePlaceholder":13},[783],{"type":612,"value":671},{"type":606,"tag":636,"props":785,"children":786},{"class":638,"line":99},[787,791,796,801,806,811],{"type":606,"tag":636,"props":788,"children":789},{"style":642},[790],{"type":612,"value":679},{"type":606,"tag":636,"props":792,"children":793},{"style":682},[794],{"type":612,"value":795}," simple_retry",{"type":606,"tag":636,"props":797,"children":798},{"style":648},[799],{"type":612,"value":800},"(max_attempts",{"type":606,"tag":636,"props":802,"children":803},{"style":642},[804],{"type":612,"value":805},"=",{"type":606,"tag":636,"props":807,"children":808},{"style":720},[809],{"type":612,"value":810},"3",{"type":606,"tag":636,"props":812,"children":813},{"style":648},[814],{"type":612,"value":815},"):\n",{"type":606,"tag":636,"props":817,"children":818},{"class":638,"line":108},[819,824,829,834,839],{"type":606,"tag":636,"props":820,"children":821},{"style":642},[822],{"type":612,"value":823},"    for",{"type":606,"tag":636,"props":825,"children":826},{"style":648},[827],{"type":612,"value":828}," attempt ",{"type":606,"tag":636,"props":830,"children":831},{"style":642},[832],{"type":612,"value":833},"in",{"type":606,"tag":636,"props":835,"children":836},{"style":720},[837],{"type":612,"value":838}," range",{"type":606,"tag":636,"props":840,"children":841},{"style":648},[842],{"type":612,"value":843},"(max_attempts):\n",{"type":606,"tag":636,"props":845,"children":846},{"class":638,"line":117},[847,852],{"type":606,"tag":636,"props":848,"children":849},{"style":642},[850],{"type":612,"value":851},"        try",{"type":606,"tag":636,"props":853,"children":854},{"style":648},[855],{"type":612,"value":856},":\n",{"type":606,"tag":636,"props":858,"children":859},{"class":638,"line":126},[860,865,869],{"type":606,"tag":636,"props":861,"children":862},{"style":648},[863],{"type":612,"value":864},"            result ",{"type":606,"tag":636,"props":866,"children":867},{"style":642},[868],{"type":612,"value":805},{"type":606,"tag":636,"props":870,"children":871},{"style":648},[872],{"type":612,"value":873}," unreliable_operation()\n",{"type":606,"tag":636,"props":875,"children":876},{"class":638,"line":135},[877,882,886,891,896,901,906,911,916,921],{"type":606,"tag":636,"props":878,"children":879},{"style":720},[880],{"type":612,"value":881},"            print",{"type":606,"tag":636,"props":883,"children":884},{"style":648},[885],{"type":612,"value":751},{"type":606,"tag":636,"props":887,"children":888},{"style":642},[889],{"type":612,"value":890},"f",{"type":606,"tag":636,"props":892,"children":893},{"style":754},[894],{"type":612,"value":895},"\"Success on attempt ",{"type":606,"tag":636,"props":897,"children":898},{"style":720},[899],{"type":612,"value":900},"{",{"type":606,"tag":636,"props":902,"children":903},{"style":648},[904],{"type":612,"value":905},"attempt ",{"type":606,"tag":636,"props":907,"children":908},{"style":642},[909],{"type":612,"value":910},"+",{"type":606,"tag":636,"props":912,"children":913},{"style":720},[914],{"type":612,"value":915}," 1}",{"type":606,"tag":636,"props":917,"children":918},{"style":754},[919],{"type":612,"value":920},"\"",{"type":606,"tag":636,"props":922,"children":923},{"style":648},[924],{"type":612,"value":762},{"type":606,"tag":636,"props":926,"children":927},{"class":638,"line":144},[928,933],{"type":606,"tag":636,"props":929,"children":930},{"style":642},[931],{"type":612,"value":932},"            return",{"type":606,"tag":636,"props":934,"children":935},{"style":648},[936],{"type":612,"value":937}," result\n",{"type":606,"tag":636,"props":939,"children":940},{"class":638,"line":153},[941,946,950,955],{"type":606,"tag":636,"props":942,"children":943},{"style":642},[944],{"type":612,"value":945},"        except",{"type":606,"tag":636,"props":947,"children":948},{"style":720},[949],{"type":612,"value":746},{"type":606,"tag":636,"props":951,"children":952},{"style":642},[953],{"type":612,"value":954}," as",{"type":606,"tag":636,"props":956,"children":957},{"style":648},[958],{"type":612,"value":959}," e:\n",{"type":606,"tag":636,"props":961,"children":962},{"class":638,"line":163},[963,967,971,975,980,984,988,992,996,1001,1005,1010,1015,1019],{"type":606,"tag":636,"props":964,"children":965},{"style":720},[966],{"type":612,"value":881},{"type":606,"tag":636,"props":968,"children":969},{"style":648},[970],{"type":612,"value":751},{"type":606,"tag":636,"props":972,"children":973},{"style":642},[974],{"type":612,"value":890},{"type":606,"tag":636,"props":976,"children":977},{"style":754},[978],{"type":612,"value":979},"\"Attempt ",{"type":606,"tag":636,"props":981,"children":982},{"style":720},[983],{"type":612,"value":900},{"type":606,"tag":636,"props":985,"children":986},{"style":648},[987],{"type":612,"value":905},{"type":606,"tag":636,"props":989,"children":990},{"style":642},[991],{"type":612,"value":910},{"type":606,"tag":636,"props":993,"children":994},{"style":720},[995],{"type":612,"value":915},{"type":606,"tag":636,"props":997,"children":998},{"style":754},[999],{"type":612,"value":1000}," failed: ",{"type":606,"tag":636,"props":1002,"children":1003},{"style":720},[1004],{"type":612,"value":900},{"type":606,"tag":636,"props":1006,"children":1007},{"style":648},[1008],{"type":612,"value":1009},"e",{"type":606,"tag":636,"props":1011,"children":1012},{"style":720},[1013],{"type":612,"value":1014},"}",{"type":606,"tag":636,"props":1016,"children":1017},{"style":754},[1018],{"type":612,"value":920},{"type":606,"tag":636,"props":1020,"children":1021},{"style":648},[1022],{"type":612,"value":762},{"type":606,"tag":636,"props":1024,"children":1025},{"class":638,"line":172},[1026,1031,1035,1040,1045,1050,1055],{"type":606,"tag":636,"props":1027,"children":1028},{"style":642},[1029],{"type":612,"value":1030},"            if",{"type":606,"tag":636,"props":1032,"children":1033},{"style":648},[1034],{"type":612,"value":828},{"type":606,"tag":636,"props":1036,"children":1037},{"style":642},[1038],{"type":612,"value":1039},"==",{"type":606,"tag":636,"props":1041,"children":1042},{"style":648},[1043],{"type":612,"value":1044}," max_attempts ",{"type":606,"tag":636,"props":1046,"children":1047},{"style":642},[1048],{"type":612,"value":1049},"-",{"type":606,"tag":636,"props":1051,"children":1052},{"style":720},[1053],{"type":612,"value":1054}," 1",{"type":606,"tag":636,"props":1056,"children":1057},{"style":648},[1058],{"type":612,"value":856},{"type":606,"tag":636,"props":1060,"children":1061},{"class":638,"line":181},[1062,1067],{"type":606,"tag":636,"props":1063,"children":1064},{"style":642},[1065],{"type":612,"value":1066},"                raise",{"type":606,"tag":636,"props":1068,"children":1069},{"style":696},[1070],{"type":612,"value":1071},"  # Re-raise on final attempt\n",{"type":606,"tag":636,"props":1073,"children":1074},{"class":638,"line":190},[1075,1080,1085,1090],{"type":606,"tag":636,"props":1076,"children":1077},{"style":648},[1078],{"type":612,"value":1079},"            time.sleep(",{"type":606,"tag":636,"props":1081,"children":1082},{"style":720},[1083],{"type":612,"value":1084},"1",{"type":606,"tag":636,"props":1086,"children":1087},{"style":648},[1088],{"type":612,"value":1089},")  ",{"type":606,"tag":636,"props":1091,"children":1092},{"style":696},[1093],{"type":612,"value":1094},"# Wait before retry\n",{"type":606,"tag":636,"props":1096,"children":1097},{"class":638,"line":199},[1098],{"type":606,"tag":636,"props":1099,"children":1100},{"emptyLinePlaceholder":13},[1101],{"type":612,"value":671},{"type":606,"tag":636,"props":1103,"children":1104},{"class":638,"line":208},[1105],{"type":606,"tag":636,"props":1106,"children":1107},{"style":696},[1108],{"type":612,"value":1109},"# Test retry logic\n",{"type":606,"tag":636,"props":1111,"children":1112},{"class":638,"line":217},[1113,1118],{"type":606,"tag":636,"props":1114,"children":1115},{"style":642},[1116],{"type":612,"value":1117},"try",{"type":606,"tag":636,"props":1119,"children":1120},{"style":648},[1121],{"type":612,"value":856},{"type":606,"tag":636,"props":1123,"children":1124},{"class":638,"line":227},[1125,1130,1134],{"type":606,"tag":636,"props":1126,"children":1127},{"style":648},[1128],{"type":612,"value":1129},"    result ",{"type":606,"tag":636,"props":1131,"children":1132},{"style":642},[1133],{"type":612,"value":805},{"type":606,"tag":636,"props":1135,"children":1136},{"style":648},[1137],{"type":612,"value":1138}," simple_retry()\n",{"type":606,"tag":636,"props":1140,"children":1141},{"class":638,"line":236},[1142,1147,1151,1155,1160,1164,1169,1173,1177],{"type":606,"tag":636,"props":1143,"children":1144},{"style":720},[1145],{"type":612,"value":1146},"    print",{"type":606,"tag":636,"props":1148,"children":1149},{"style":648},[1150],{"type":612,"value":751},{"type":606,"tag":636,"props":1152,"children":1153},{"style":642},[1154],{"type":612,"value":890},{"type":606,"tag":636,"props":1156,"children":1157},{"style":754},[1158],{"type":612,"value":1159},"\"Final result: ",{"type":606,"tag":636,"props":1161,"children":1162},{"style":720},[1163],{"type":612,"value":900},{"type":606,"tag":636,"props":1165,"children":1166},{"style":648},[1167],{"type":612,"value":1168},"result",{"type":606,"tag":636,"props":1170,"children":1171},{"style":720},[1172],{"type":612,"value":1014},{"type":606,"tag":636,"props":1174,"children":1175},{"style":754},[1176],{"type":612,"value":920},{"type":606,"tag":636,"props":1178,"children":1179},{"style":648},[1180],{"type":612,"value":762},{"type":606,"tag":636,"props":1182,"children":1183},{"class":638,"line":245},[1184,1189,1193],{"type":606,"tag":636,"props":1185,"children":1186},{"style":642},[1187],{"type":612,"value":1188},"except",{"type":606,"tag":636,"props":1190,"children":1191},{"style":720},[1192],{"type":612,"value":746},{"type":606,"tag":636,"props":1194,"children":1195},{"style":648},[1196],{"type":612,"value":856},{"type":606,"tag":636,"props":1198,"children":1199},{"class":638,"line":254},[1200,1204,1208,1213],{"type":606,"tag":636,"props":1201,"children":1202},{"style":720},[1203],{"type":612,"value":1146},{"type":606,"tag":636,"props":1205,"children":1206},{"style":648},[1207],{"type":612,"value":751},{"type":606,"tag":636,"props":1209,"children":1210},{"style":754},[1211],{"type":612,"value":1212},"\"All retry attempts failed\"",{"type":606,"tag":636,"props":1214,"children":1215},{"style":648},[1216],{"type":612,"value":762},{"type":606,"tag":1218,"props":1219,"children":1221},"h2",{"id":1220},"basic-retry-patterns",[1222],{"type":612,"value":1223},"🎯 Basic Retry Patterns",{"type":606,"tag":615,"props":1225,"children":1226},{},[1227],{"type":612,"value":1228},"Different retry strategies for different situations.",{"type":606,"tag":1230,"props":1231,"children":1235},"info-box",{"emoji":1232,"title":1233,"type":1234},"🔄","Retry Strategies","info",[1236,1245,1290,1298],{"type":606,"tag":615,"props":1237,"children":1238},{},[1239],{"type":606,"tag":1240,"props":1241,"children":1242},"strong",{},[1243],{"type":612,"value":1244},"Common Patterns:",{"type":606,"tag":1246,"props":1247,"children":1248},"ul",{},[1249,1260,1270,1280],{"type":606,"tag":1250,"props":1251,"children":1252},"li",{},[1253,1258],{"type":606,"tag":1240,"props":1254,"children":1255},{},[1256],{"type":612,"value":1257},"Fixed Delay",{"type":612,"value":1259},": Same wait time between retries",{"type":606,"tag":1250,"props":1261,"children":1262},{},[1263,1268],{"type":606,"tag":1240,"props":1264,"children":1265},{},[1266],{"type":612,"value":1267},"Exponential Backoff",{"type":612,"value":1269},": Increasing wait times",{"type":606,"tag":1250,"props":1271,"children":1272},{},[1273,1278],{"type":606,"tag":1240,"props":1274,"children":1275},{},[1276],{"type":612,"value":1277},"Random Jitter",{"type":612,"value":1279},": Add randomness to prevent thundering herd",{"type":606,"tag":1250,"props":1281,"children":1282},{},[1283,1288],{"type":606,"tag":1240,"props":1284,"children":1285},{},[1286],{"type":612,"value":1287},"Circuit Breaker",{"type":612,"value":1289},": Stop retrying after many failures",{"type":606,"tag":615,"props":1291,"children":1292},{},[1293],{"type":606,"tag":1240,"props":1294,"children":1295},{},[1296],{"type":612,"value":1297},"When to Use:",{"type":606,"tag":1246,"props":1299,"children":1300},{},[1301,1306,1311,1316],{"type":606,"tag":1250,"props":1302,"children":1303},{},[1304],{"type":612,"value":1305},"Network operations",{"type":606,"tag":1250,"props":1307,"children":1308},{},[1309],{"type":612,"value":1310},"Database connections",{"type":606,"tag":1250,"props":1312,"children":1313},{},[1314],{"type":612,"value":1315},"API calls",{"type":606,"tag":1250,"props":1317,"children":1318},{},[1319],{"type":612,"value":1320},"File operations",{"type":606,"tag":1322,"props":1323,"children":1325},"h3",{"id":1324},"fixed-delay-retry",[1326],{"type":612,"value":1327},"Fixed Delay Retry",{"type":606,"tag":621,"props":1329,"children":1330},{},[1331],{"type":606,"tag":625,"props":1332,"children":1334},{"className":627,"code":1333,"language":629,"meta":8,"style":8},"import time\n\ndef fixed_delay_retry(operation, max_attempts=3, delay=1):\n    \"\"\"Retry with fixed delay between attempts\"\"\"\n    for attempt in range(max_attempts):\n        try:\n            return operation()\n        except Exception as e:\n            print(f\"Attempt {attempt + 1} failed: {e}\")\n            \n            if attempt == max_attempts - 1:\n                print(\"All attempts exhausted\")\n                raise\n            \n            print(f\"Waiting {delay} seconds before retry...\")\n            time.sleep(delay)\n\ndef flaky_database_call():\n    # Simulate database call that sometimes fails\n    import random\n    if random.random() \u003C 0.6:\n        raise ConnectionError(\"Database connection lost\")\n    return {\"data\": \"User profile\"}\n\n# Test fixed delay retry\ntry:\n    result = fixed_delay_retry(flaky_database_call, max_attempts=3, delay=2)\n    print(f\"Database result: {result}\")\nexcept ConnectionError:\n    print(\"Database operation failed permanently\")\n",[1335],{"type":606,"tag":632,"props":1336,"children":1337},{"__ignoreMap":8},[1338,1349,1356,1398,1406,1429,1440,1452,1472,1531,1539,1570,1591,1599,1606,1648,1656,1663,1679,1687,1699,1723,1747,1779,1786,1794,1805,1857,1897,1912],{"type":606,"tag":636,"props":1339,"children":1340},{"class":638,"line":12},[1341,1345],{"type":606,"tag":636,"props":1342,"children":1343},{"style":642},[1344],{"type":612,"value":645},{"type":606,"tag":636,"props":1346,"children":1347},{"style":648},[1348],{"type":612,"value":651},{"type":606,"tag":636,"props":1350,"children":1351},{"class":638,"line":27},[1352],{"type":606,"tag":636,"props":1353,"children":1354},{"emptyLinePlaceholder":13},[1355],{"type":612,"value":671},{"type":606,"tag":636,"props":1357,"children":1358},{"class":638,"line":36},[1359,1363,1368,1373,1377,1381,1386,1390,1394],{"type":606,"tag":636,"props":1360,"children":1361},{"style":642},[1362],{"type":612,"value":679},{"type":606,"tag":636,"props":1364,"children":1365},{"style":682},[1366],{"type":612,"value":1367}," fixed_delay_retry",{"type":606,"tag":636,"props":1369,"children":1370},{"style":648},[1371],{"type":612,"value":1372},"(operation, max_attempts",{"type":606,"tag":636,"props":1374,"children":1375},{"style":642},[1376],{"type":612,"value":805},{"type":606,"tag":636,"props":1378,"children":1379},{"style":720},[1380],{"type":612,"value":810},{"type":606,"tag":636,"props":1382,"children":1383},{"style":648},[1384],{"type":612,"value":1385},", delay",{"type":606,"tag":636,"props":1387,"children":1388},{"style":642},[1389],{"type":612,"value":805},{"type":606,"tag":636,"props":1391,"children":1392},{"style":720},[1393],{"type":612,"value":1084},{"type":606,"tag":636,"props":1395,"children":1396},{"style":648},[1397],{"type":612,"value":815},{"type":606,"tag":636,"props":1399,"children":1400},{"class":638,"line":45},[1401],{"type":606,"tag":636,"props":1402,"children":1403},{"style":754},[1404],{"type":612,"value":1405},"    \"\"\"Retry with fixed delay between attempts\"\"\"\n",{"type":606,"tag":636,"props":1407,"children":1408},{"class":638,"line":54},[1409,1413,1417,1421,1425],{"type":606,"tag":636,"props":1410,"children":1411},{"style":642},[1412],{"type":612,"value":823},{"type":606,"tag":636,"props":1414,"children":1415},{"style":648},[1416],{"type":612,"value":828},{"type":606,"tag":636,"props":1418,"children":1419},{"style":642},[1420],{"type":612,"value":833},{"type":606,"tag":636,"props":1422,"children":1423},{"style":720},[1424],{"type":612,"value":838},{"type":606,"tag":636,"props":1426,"children":1427},{"style":648},[1428],{"type":612,"value":843},{"type":606,"tag":636,"props":1430,"children":1431},{"class":638,"line":63},[1432,1436],{"type":606,"tag":636,"props":1433,"children":1434},{"style":642},[1435],{"type":612,"value":851},{"type":606,"tag":636,"props":1437,"children":1438},{"style":648},[1439],{"type":612,"value":856},{"type":606,"tag":636,"props":1441,"children":1442},{"class":638,"line":72},[1443,1447],{"type":606,"tag":636,"props":1444,"children":1445},{"style":642},[1446],{"type":612,"value":932},{"type":606,"tag":636,"props":1448,"children":1449},{"style":648},[1450],{"type":612,"value":1451}," operation()\n",{"type":606,"tag":636,"props":1453,"children":1454},{"class":638,"line":81},[1455,1459,1464,1468],{"type":606,"tag":636,"props":1456,"children":1457},{"style":642},[1458],{"type":612,"value":945},{"type":606,"tag":636,"props":1460,"children":1461},{"style":720},[1462],{"type":612,"value":1463}," Exception",{"type":606,"tag":636,"props":1465,"children":1466},{"style":642},[1467],{"type":612,"value":954},{"type":606,"tag":636,"props":1469,"children":1470},{"style":648},[1471],{"type":612,"value":959},{"type":606,"tag":636,"props":1473,"children":1474},{"class":638,"line":778},[1475,1479,1483,1487,1491,1495,1499,1503,1507,1511,1515,1519,1523,1527],{"type":606,"tag":636,"props":1476,"children":1477},{"style":720},[1478],{"type":612,"value":881},{"type":606,"tag":636,"props":1480,"children":1481},{"style":648},[1482],{"type":612,"value":751},{"type":606,"tag":636,"props":1484,"children":1485},{"style":642},[1486],{"type":612,"value":890},{"type":606,"tag":636,"props":1488,"children":1489},{"style":754},[1490],{"type":612,"value":979},{"type":606,"tag":636,"props":1492,"children":1493},{"style":720},[1494],{"type":612,"value":900},{"type":606,"tag":636,"props":1496,"children":1497},{"style":648},[1498],{"type":612,"value":905},{"type":606,"tag":636,"props":1500,"children":1501},{"style":642},[1502],{"type":612,"value":910},{"type":606,"tag":636,"props":1504,"children":1505},{"style":720},[1506],{"type":612,"value":915},{"type":606,"tag":636,"props":1508,"children":1509},{"style":754},[1510],{"type":612,"value":1000},{"type":606,"tag":636,"props":1512,"children":1513},{"style":720},[1514],{"type":612,"value":900},{"type":606,"tag":636,"props":1516,"children":1517},{"style":648},[1518],{"type":612,"value":1009},{"type":606,"tag":636,"props":1520,"children":1521},{"style":720},[1522],{"type":612,"value":1014},{"type":606,"tag":636,"props":1524,"children":1525},{"style":754},[1526],{"type":612,"value":920},{"type":606,"tag":636,"props":1528,"children":1529},{"style":648},[1530],{"type":612,"value":762},{"type":606,"tag":636,"props":1532,"children":1533},{"class":638,"line":99},[1534],{"type":606,"tag":636,"props":1535,"children":1536},{"style":648},[1537],{"type":612,"value":1538},"            \n",{"type":606,"tag":636,"props":1540,"children":1541},{"class":638,"line":108},[1542,1546,1550,1554,1558,1562,1566],{"type":606,"tag":636,"props":1543,"children":1544},{"style":642},[1545],{"type":612,"value":1030},{"type":606,"tag":636,"props":1547,"children":1548},{"style":648},[1549],{"type":612,"value":828},{"type":606,"tag":636,"props":1551,"children":1552},{"style":642},[1553],{"type":612,"value":1039},{"type":606,"tag":636,"props":1555,"children":1556},{"style":648},[1557],{"type":612,"value":1044},{"type":606,"tag":636,"props":1559,"children":1560},{"style":642},[1561],{"type":612,"value":1049},{"type":606,"tag":636,"props":1563,"children":1564},{"style":720},[1565],{"type":612,"value":1054},{"type":606,"tag":636,"props":1567,"children":1568},{"style":648},[1569],{"type":612,"value":856},{"type":606,"tag":636,"props":1571,"children":1572},{"class":638,"line":117},[1573,1578,1582,1587],{"type":606,"tag":636,"props":1574,"children":1575},{"style":720},[1576],{"type":612,"value":1577},"                print",{"type":606,"tag":636,"props":1579,"children":1580},{"style":648},[1581],{"type":612,"value":751},{"type":606,"tag":636,"props":1583,"children":1584},{"style":754},[1585],{"type":612,"value":1586},"\"All attempts exhausted\"",{"type":606,"tag":636,"props":1588,"children":1589},{"style":648},[1590],{"type":612,"value":762},{"type":606,"tag":636,"props":1592,"children":1593},{"class":638,"line":126},[1594],{"type":606,"tag":636,"props":1595,"children":1596},{"style":642},[1597],{"type":612,"value":1598},"                raise\n",{"type":606,"tag":636,"props":1600,"children":1601},{"class":638,"line":135},[1602],{"type":606,"tag":636,"props":1603,"children":1604},{"style":648},[1605],{"type":612,"value":1538},{"type":606,"tag":636,"props":1607,"children":1608},{"class":638,"line":144},[1609,1613,1617,1621,1626,1630,1635,1639,1644],{"type":606,"tag":636,"props":1610,"children":1611},{"style":720},[1612],{"type":612,"value":881},{"type":606,"tag":636,"props":1614,"children":1615},{"style":648},[1616],{"type":612,"value":751},{"type":606,"tag":636,"props":1618,"children":1619},{"style":642},[1620],{"type":612,"value":890},{"type":606,"tag":636,"props":1622,"children":1623},{"style":754},[1624],{"type":612,"value":1625},"\"Waiting ",{"type":606,"tag":636,"props":1627,"children":1628},{"style":720},[1629],{"type":612,"value":900},{"type":606,"tag":636,"props":1631,"children":1632},{"style":648},[1633],{"type":612,"value":1634},"delay",{"type":606,"tag":636,"props":1636,"children":1637},{"style":720},[1638],{"type":612,"value":1014},{"type":606,"tag":636,"props":1640,"children":1641},{"style":754},[1642],{"type":612,"value":1643}," seconds before retry...\"",{"type":606,"tag":636,"props":1645,"children":1646},{"style":648},[1647],{"type":612,"value":762},{"type":606,"tag":636,"props":1649,"children":1650},{"class":638,"line":153},[1651],{"type":606,"tag":636,"props":1652,"children":1653},{"style":648},[1654],{"type":612,"value":1655},"            time.sleep(delay)\n",{"type":606,"tag":636,"props":1657,"children":1658},{"class":638,"line":163},[1659],{"type":606,"tag":636,"props":1660,"children":1661},{"emptyLinePlaceholder":13},[1662],{"type":612,"value":671},{"type":606,"tag":636,"props":1664,"children":1665},{"class":638,"line":172},[1666,1670,1675],{"type":606,"tag":636,"props":1667,"children":1668},{"style":642},[1669],{"type":612,"value":679},{"type":606,"tag":636,"props":1671,"children":1672},{"style":682},[1673],{"type":612,"value":1674}," flaky_database_call",{"type":606,"tag":636,"props":1676,"children":1677},{"style":648},[1678],{"type":612,"value":690},{"type":606,"tag":636,"props":1680,"children":1681},{"class":638,"line":181},[1682],{"type":606,"tag":636,"props":1683,"children":1684},{"style":696},[1685],{"type":612,"value":1686},"    # Simulate database call that sometimes fails\n",{"type":606,"tag":636,"props":1688,"children":1689},{"class":638,"line":190},[1690,1695],{"type":606,"tag":636,"props":1691,"children":1692},{"style":642},[1693],{"type":612,"value":1694},"    import",{"type":606,"tag":636,"props":1696,"children":1697},{"style":648},[1698],{"type":612,"value":663},{"type":606,"tag":636,"props":1700,"children":1701},{"class":638,"line":199},[1702,1706,1710,1714,1719],{"type":606,"tag":636,"props":1703,"children":1704},{"style":642},[1705],{"type":612,"value":707},{"type":606,"tag":636,"props":1707,"children":1708},{"style":648},[1709],{"type":612,"value":712},{"type":606,"tag":636,"props":1711,"children":1712},{"style":642},[1713],{"type":612,"value":717},{"type":606,"tag":636,"props":1715,"children":1716},{"style":720},[1717],{"type":612,"value":1718}," 0.6",{"type":606,"tag":636,"props":1720,"children":1721},{"style":648},[1722],{"type":612,"value":856},{"type":606,"tag":636,"props":1724,"children":1725},{"class":638,"line":208},[1726,1730,1734,1738,1743],{"type":606,"tag":636,"props":1727,"children":1728},{"style":642},[1729],{"type":612,"value":741},{"type":606,"tag":636,"props":1731,"children":1732},{"style":720},[1733],{"type":612,"value":746},{"type":606,"tag":636,"props":1735,"children":1736},{"style":648},[1737],{"type":612,"value":751},{"type":606,"tag":636,"props":1739,"children":1740},{"style":754},[1741],{"type":612,"value":1742},"\"Database connection lost\"",{"type":606,"tag":636,"props":1744,"children":1745},{"style":648},[1746],{"type":612,"value":762},{"type":606,"tag":636,"props":1748,"children":1749},{"class":638,"line":217},[1750,1754,1759,1764,1769,1774],{"type":606,"tag":636,"props":1751,"children":1752},{"style":642},[1753],{"type":612,"value":770},{"type":606,"tag":636,"props":1755,"children":1756},{"style":648},[1757],{"type":612,"value":1758}," {",{"type":606,"tag":636,"props":1760,"children":1761},{"style":754},[1762],{"type":612,"value":1763},"\"data\"",{"type":606,"tag":636,"props":1765,"children":1766},{"style":648},[1767],{"type":612,"value":1768},": ",{"type":606,"tag":636,"props":1770,"children":1771},{"style":754},[1772],{"type":612,"value":1773},"\"User profile\"",{"type":606,"tag":636,"props":1775,"children":1776},{"style":648},[1777],{"type":612,"value":1778},"}\n",{"type":606,"tag":636,"props":1780,"children":1781},{"class":638,"line":227},[1782],{"type":606,"tag":636,"props":1783,"children":1784},{"emptyLinePlaceholder":13},[1785],{"type":612,"value":671},{"type":606,"tag":636,"props":1787,"children":1788},{"class":638,"line":236},[1789],{"type":606,"tag":636,"props":1790,"children":1791},{"style":696},[1792],{"type":612,"value":1793},"# Test fixed delay retry\n",{"type":606,"tag":636,"props":1795,"children":1796},{"class":638,"line":245},[1797,1801],{"type":606,"tag":636,"props":1798,"children":1799},{"style":642},[1800],{"type":612,"value":1117},{"type":606,"tag":636,"props":1802,"children":1803},{"style":648},[1804],{"type":612,"value":856},{"type":606,"tag":636,"props":1806,"children":1807},{"class":638,"line":254},[1808,1812,1816,1821,1827,1831,1835,1840,1844,1848,1853],{"type":606,"tag":636,"props":1809,"children":1810},{"style":648},[1811],{"type":612,"value":1129},{"type":606,"tag":636,"props":1813,"children":1814},{"style":642},[1815],{"type":612,"value":805},{"type":606,"tag":636,"props":1817,"children":1818},{"style":648},[1819],{"type":612,"value":1820}," fixed_delay_retry(flaky_database_call, ",{"type":606,"tag":636,"props":1822,"children":1824},{"style":1823},"--shiki-default:#E36209;--shiki-app-dark-mode:#FFAB70",[1825],{"type":612,"value":1826},"max_attempts",{"type":606,"tag":636,"props":1828,"children":1829},{"style":642},[1830],{"type":612,"value":805},{"type":606,"tag":636,"props":1832,"children":1833},{"style":720},[1834],{"type":612,"value":810},{"type":606,"tag":636,"props":1836,"children":1837},{"style":648},[1838],{"type":612,"value":1839},", ",{"type":606,"tag":636,"props":1841,"children":1842},{"style":1823},[1843],{"type":612,"value":1634},{"type":606,"tag":636,"props":1845,"children":1846},{"style":642},[1847],{"type":612,"value":805},{"type":606,"tag":636,"props":1849,"children":1850},{"style":720},[1851],{"type":612,"value":1852},"2",{"type":606,"tag":636,"props":1854,"children":1855},{"style":648},[1856],{"type":612,"value":762},{"type":606,"tag":636,"props":1858,"children":1859},{"class":638,"line":263},[1860,1864,1868,1872,1877,1881,1885,1889,1893],{"type":606,"tag":636,"props":1861,"children":1862},{"style":720},[1863],{"type":612,"value":1146},{"type":606,"tag":636,"props":1865,"children":1866},{"style":648},[1867],{"type":612,"value":751},{"type":606,"tag":636,"props":1869,"children":1870},{"style":642},[1871],{"type":612,"value":890},{"type":606,"tag":636,"props":1873,"children":1874},{"style":754},[1875],{"type":612,"value":1876},"\"Database result: ",{"type":606,"tag":636,"props":1878,"children":1879},{"style":720},[1880],{"type":612,"value":900},{"type":606,"tag":636,"props":1882,"children":1883},{"style":648},[1884],{"type":612,"value":1168},{"type":606,"tag":636,"props":1886,"children":1887},{"style":720},[1888],{"type":612,"value":1014},{"type":606,"tag":636,"props":1890,"children":1891},{"style":754},[1892],{"type":612,"value":920},{"type":606,"tag":636,"props":1894,"children":1895},{"style":648},[1896],{"type":612,"value":762},{"type":606,"tag":636,"props":1898,"children":1899},{"class":638,"line":272},[1900,1904,1908],{"type":606,"tag":636,"props":1901,"children":1902},{"style":642},[1903],{"type":612,"value":1188},{"type":606,"tag":636,"props":1905,"children":1906},{"style":720},[1907],{"type":612,"value":746},{"type":606,"tag":636,"props":1909,"children":1910},{"style":648},[1911],{"type":612,"value":856},{"type":606,"tag":636,"props":1913,"children":1914},{"class":638,"line":281},[1915,1919,1923,1928],{"type":606,"tag":636,"props":1916,"children":1917},{"style":720},[1918],{"type":612,"value":1146},{"type":606,"tag":636,"props":1920,"children":1921},{"style":648},[1922],{"type":612,"value":751},{"type":606,"tag":636,"props":1924,"children":1925},{"style":754},[1926],{"type":612,"value":1927},"\"Database operation failed permanently\"",{"type":606,"tag":636,"props":1929,"children":1930},{"style":648},[1931],{"type":612,"value":762},{"type":606,"tag":1322,"props":1933,"children":1935},{"id":1934},"exponential-backoff",[1936],{"type":612,"value":1267},{"type":606,"tag":621,"props":1938,"children":1939},{},[1940],{"type":606,"tag":625,"props":1941,"children":1943},{"className":627,"code":1942,"language":629,"meta":8,"style":8},"import time\n\ndef exponential_backoff_retry(operation, max_attempts=3, base_delay=1):\n    \"\"\"Retry with exponentially increasing delays\"\"\"\n    for attempt in range(max_attempts):\n        try:\n            return operation()\n        except Exception as e:\n            print(f\"Attempt {attempt + 1} failed: {e}\")\n            \n            if attempt == max_attempts - 1:\n                raise\n            \n            # Calculate exponential delay: base_delay * 2^attempt\n            delay = base_delay * (2 ** attempt)\n            print(f\"Waiting {delay} seconds before retry...\")\n            time.sleep(delay)\n\ndef api_call():\n    import random\n    if random.random() \u003C 0.8:\n        raise TimeoutError(\"API request timeout\")\n    return {\"status\": \"success\", \"data\": [1, 2, 3]}\n\n# Test exponential backoff\ntry:\n    result = exponential_backoff_retry(api_call, max_attempts=4, base_delay=0.5)\n    print(f\"API result: {result}\")\nexcept TimeoutError:\n    print(\"API call failed after all retries\")\n",[1944],{"type":606,"tag":632,"props":1945,"children":1946},{"__ignoreMap":8},[1947,1958,1965,2006,2014,2037,2048,2059,2078,2137,2144,2175,2182,2189,2197,2238,2277,2284,2291,2307,2318,2342,2367,2430,2437,2445,2456,2507,2547,2562],{"type":606,"tag":636,"props":1948,"children":1949},{"class":638,"line":12},[1950,1954],{"type":606,"tag":636,"props":1951,"children":1952},{"style":642},[1953],{"type":612,"value":645},{"type":606,"tag":636,"props":1955,"children":1956},{"style":648},[1957],{"type":612,"value":651},{"type":606,"tag":636,"props":1959,"children":1960},{"class":638,"line":27},[1961],{"type":606,"tag":636,"props":1962,"children":1963},{"emptyLinePlaceholder":13},[1964],{"type":612,"value":671},{"type":606,"tag":636,"props":1966,"children":1967},{"class":638,"line":36},[1968,1972,1977,1981,1985,1989,1994,1998,2002],{"type":606,"tag":636,"props":1969,"children":1970},{"style":642},[1971],{"type":612,"value":679},{"type":606,"tag":636,"props":1973,"children":1974},{"style":682},[1975],{"type":612,"value":1976}," exponential_backoff_retry",{"type":606,"tag":636,"props":1978,"children":1979},{"style":648},[1980],{"type":612,"value":1372},{"type":606,"tag":636,"props":1982,"children":1983},{"style":642},[1984],{"type":612,"value":805},{"type":606,"tag":636,"props":1986,"children":1987},{"style":720},[1988],{"type":612,"value":810},{"type":606,"tag":636,"props":1990,"children":1991},{"style":648},[1992],{"type":612,"value":1993},", base_delay",{"type":606,"tag":636,"props":1995,"children":1996},{"style":642},[1997],{"type":612,"value":805},{"type":606,"tag":636,"props":1999,"children":2000},{"style":720},[2001],{"type":612,"value":1084},{"type":606,"tag":636,"props":2003,"children":2004},{"style":648},[2005],{"type":612,"value":815},{"type":606,"tag":636,"props":2007,"children":2008},{"class":638,"line":45},[2009],{"type":606,"tag":636,"props":2010,"children":2011},{"style":754},[2012],{"type":612,"value":2013},"    \"\"\"Retry with exponentially increasing delays\"\"\"\n",{"type":606,"tag":636,"props":2015,"children":2016},{"class":638,"line":54},[2017,2021,2025,2029,2033],{"type":606,"tag":636,"props":2018,"children":2019},{"style":642},[2020],{"type":612,"value":823},{"type":606,"tag":636,"props":2022,"children":2023},{"style":648},[2024],{"type":612,"value":828},{"type":606,"tag":636,"props":2026,"children":2027},{"style":642},[2028],{"type":612,"value":833},{"type":606,"tag":636,"props":2030,"children":2031},{"style":720},[2032],{"type":612,"value":838},{"type":606,"tag":636,"props":2034,"children":2035},{"style":648},[2036],{"type":612,"value":843},{"type":606,"tag":636,"props":2038,"children":2039},{"class":638,"line":63},[2040,2044],{"type":606,"tag":636,"props":2041,"children":2042},{"style":642},[2043],{"type":612,"value":851},{"type":606,"tag":636,"props":2045,"children":2046},{"style":648},[2047],{"type":612,"value":856},{"type":606,"tag":636,"props":2049,"children":2050},{"class":638,"line":72},[2051,2055],{"type":606,"tag":636,"props":2052,"children":2053},{"style":642},[2054],{"type":612,"value":932},{"type":606,"tag":636,"props":2056,"children":2057},{"style":648},[2058],{"type":612,"value":1451},{"type":606,"tag":636,"props":2060,"children":2061},{"class":638,"line":81},[2062,2066,2070,2074],{"type":606,"tag":636,"props":2063,"children":2064},{"style":642},[2065],{"type":612,"value":945},{"type":606,"tag":636,"props":2067,"children":2068},{"style":720},[2069],{"type":612,"value":1463},{"type":606,"tag":636,"props":2071,"children":2072},{"style":642},[2073],{"type":612,"value":954},{"type":606,"tag":636,"props":2075,"children":2076},{"style":648},[2077],{"type":612,"value":959},{"type":606,"tag":636,"props":2079,"children":2080},{"class":638,"line":778},[2081,2085,2089,2093,2097,2101,2105,2109,2113,2117,2121,2125,2129,2133],{"type":606,"tag":636,"props":2082,"children":2083},{"style":720},[2084],{"type":612,"value":881},{"type":606,"tag":636,"props":2086,"children":2087},{"style":648},[2088],{"type":612,"value":751},{"type":606,"tag":636,"props":2090,"children":2091},{"style":642},[2092],{"type":612,"value":890},{"type":606,"tag":636,"props":2094,"children":2095},{"style":754},[2096],{"type":612,"value":979},{"type":606,"tag":636,"props":2098,"children":2099},{"style":720},[2100],{"type":612,"value":900},{"type":606,"tag":636,"props":2102,"children":2103},{"style":648},[2104],{"type":612,"value":905},{"type":606,"tag":636,"props":2106,"children":2107},{"style":642},[2108],{"type":612,"value":910},{"type":606,"tag":636,"props":2110,"children":2111},{"style":720},[2112],{"type":612,"value":915},{"type":606,"tag":636,"props":2114,"children":2115},{"style":754},[2116],{"type":612,"value":1000},{"type":606,"tag":636,"props":2118,"children":2119},{"style":720},[2120],{"type":612,"value":900},{"type":606,"tag":636,"props":2122,"children":2123},{"style":648},[2124],{"type":612,"value":1009},{"type":606,"tag":636,"props":2126,"children":2127},{"style":720},[2128],{"type":612,"value":1014},{"type":606,"tag":636,"props":2130,"children":2131},{"style":754},[2132],{"type":612,"value":920},{"type":606,"tag":636,"props":2134,"children":2135},{"style":648},[2136],{"type":612,"value":762},{"type":606,"tag":636,"props":2138,"children":2139},{"class":638,"line":99},[2140],{"type":606,"tag":636,"props":2141,"children":2142},{"style":648},[2143],{"type":612,"value":1538},{"type":606,"tag":636,"props":2145,"children":2146},{"class":638,"line":108},[2147,2151,2155,2159,2163,2167,2171],{"type":606,"tag":636,"props":2148,"children":2149},{"style":642},[2150],{"type":612,"value":1030},{"type":606,"tag":636,"props":2152,"children":2153},{"style":648},[2154],{"type":612,"value":828},{"type":606,"tag":636,"props":2156,"children":2157},{"style":642},[2158],{"type":612,"value":1039},{"type":606,"tag":636,"props":2160,"children":2161},{"style":648},[2162],{"type":612,"value":1044},{"type":606,"tag":636,"props":2164,"children":2165},{"style":642},[2166],{"type":612,"value":1049},{"type":606,"tag":636,"props":2168,"children":2169},{"style":720},[2170],{"type":612,"value":1054},{"type":606,"tag":636,"props":2172,"children":2173},{"style":648},[2174],{"type":612,"value":856},{"type":606,"tag":636,"props":2176,"children":2177},{"class":638,"line":117},[2178],{"type":606,"tag":636,"props":2179,"children":2180},{"style":642},[2181],{"type":612,"value":1598},{"type":606,"tag":636,"props":2183,"children":2184},{"class":638,"line":126},[2185],{"type":606,"tag":636,"props":2186,"children":2187},{"style":648},[2188],{"type":612,"value":1538},{"type":606,"tag":636,"props":2190,"children":2191},{"class":638,"line":135},[2192],{"type":606,"tag":636,"props":2193,"children":2194},{"style":696},[2195],{"type":612,"value":2196},"            # Calculate exponential delay: base_delay * 2^attempt\n",{"type":606,"tag":636,"props":2198,"children":2199},{"class":638,"line":144},[2200,2205,2209,2214,2219,2224,2228,2233],{"type":606,"tag":636,"props":2201,"children":2202},{"style":648},[2203],{"type":612,"value":2204},"            delay ",{"type":606,"tag":636,"props":2206,"children":2207},{"style":642},[2208],{"type":612,"value":805},{"type":606,"tag":636,"props":2210,"children":2211},{"style":648},[2212],{"type":612,"value":2213}," base_delay ",{"type":606,"tag":636,"props":2215,"children":2216},{"style":642},[2217],{"type":612,"value":2218},"*",{"type":606,"tag":636,"props":2220,"children":2221},{"style":648},[2222],{"type":612,"value":2223}," (",{"type":606,"tag":636,"props":2225,"children":2226},{"style":720},[2227],{"type":612,"value":1852},{"type":606,"tag":636,"props":2229,"children":2230},{"style":642},[2231],{"type":612,"value":2232}," **",{"type":606,"tag":636,"props":2234,"children":2235},{"style":648},[2236],{"type":612,"value":2237}," attempt)\n",{"type":606,"tag":636,"props":2239,"children":2240},{"class":638,"line":153},[2241,2245,2249,2253,2257,2261,2265,2269,2273],{"type":606,"tag":636,"props":2242,"children":2243},{"style":720},[2244],{"type":612,"value":881},{"type":606,"tag":636,"props":2246,"children":2247},{"style":648},[2248],{"type":612,"value":751},{"type":606,"tag":636,"props":2250,"children":2251},{"style":642},[2252],{"type":612,"value":890},{"type":606,"tag":636,"props":2254,"children":2255},{"style":754},[2256],{"type":612,"value":1625},{"type":606,"tag":636,"props":2258,"children":2259},{"style":720},[2260],{"type":612,"value":900},{"type":606,"tag":636,"props":2262,"children":2263},{"style":648},[2264],{"type":612,"value":1634},{"type":606,"tag":636,"props":2266,"children":2267},{"style":720},[2268],{"type":612,"value":1014},{"type":606,"tag":636,"props":2270,"children":2271},{"style":754},[2272],{"type":612,"value":1643},{"type":606,"tag":636,"props":2274,"children":2275},{"style":648},[2276],{"type":612,"value":762},{"type":606,"tag":636,"props":2278,"children":2279},{"class":638,"line":163},[2280],{"type":606,"tag":636,"props":2281,"children":2282},{"style":648},[2283],{"type":612,"value":1655},{"type":606,"tag":636,"props":2285,"children":2286},{"class":638,"line":172},[2287],{"type":606,"tag":636,"props":2288,"children":2289},{"emptyLinePlaceholder":13},[2290],{"type":612,"value":671},{"type":606,"tag":636,"props":2292,"children":2293},{"class":638,"line":181},[2294,2298,2303],{"type":606,"tag":636,"props":2295,"children":2296},{"style":642},[2297],{"type":612,"value":679},{"type":606,"tag":636,"props":2299,"children":2300},{"style":682},[2301],{"type":612,"value":2302}," api_call",{"type":606,"tag":636,"props":2304,"children":2305},{"style":648},[2306],{"type":612,"value":690},{"type":606,"tag":636,"props":2308,"children":2309},{"class":638,"line":190},[2310,2314],{"type":606,"tag":636,"props":2311,"children":2312},{"style":642},[2313],{"type":612,"value":1694},{"type":606,"tag":636,"props":2315,"children":2316},{"style":648},[2317],{"type":612,"value":663},{"type":606,"tag":636,"props":2319,"children":2320},{"class":638,"line":199},[2321,2325,2329,2333,2338],{"type":606,"tag":636,"props":2322,"children":2323},{"style":642},[2324],{"type":612,"value":707},{"type":606,"tag":636,"props":2326,"children":2327},{"style":648},[2328],{"type":612,"value":712},{"type":606,"tag":636,"props":2330,"children":2331},{"style":642},[2332],{"type":612,"value":717},{"type":606,"tag":636,"props":2334,"children":2335},{"style":720},[2336],{"type":612,"value":2337}," 0.8",{"type":606,"tag":636,"props":2339,"children":2340},{"style":648},[2341],{"type":612,"value":856},{"type":606,"tag":636,"props":2343,"children":2344},{"class":638,"line":208},[2345,2349,2354,2358,2363],{"type":606,"tag":636,"props":2346,"children":2347},{"style":642},[2348],{"type":612,"value":741},{"type":606,"tag":636,"props":2350,"children":2351},{"style":720},[2352],{"type":612,"value":2353}," TimeoutError",{"type":606,"tag":636,"props":2355,"children":2356},{"style":648},[2357],{"type":612,"value":751},{"type":606,"tag":636,"props":2359,"children":2360},{"style":754},[2361],{"type":612,"value":2362},"\"API request timeout\"",{"type":606,"tag":636,"props":2364,"children":2365},{"style":648},[2366],{"type":612,"value":762},{"type":606,"tag":636,"props":2368,"children":2369},{"class":638,"line":217},[2370,2374,2378,2383,2387,2392,2396,2400,2405,2409,2413,2417,2421,2425],{"type":606,"tag":636,"props":2371,"children":2372},{"style":642},[2373],{"type":612,"value":770},{"type":606,"tag":636,"props":2375,"children":2376},{"style":648},[2377],{"type":612,"value":1758},{"type":606,"tag":636,"props":2379,"children":2380},{"style":754},[2381],{"type":612,"value":2382},"\"status\"",{"type":606,"tag":636,"props":2384,"children":2385},{"style":648},[2386],{"type":612,"value":1768},{"type":606,"tag":636,"props":2388,"children":2389},{"style":754},[2390],{"type":612,"value":2391},"\"success\"",{"type":606,"tag":636,"props":2393,"children":2394},{"style":648},[2395],{"type":612,"value":1839},{"type":606,"tag":636,"props":2397,"children":2398},{"style":754},[2399],{"type":612,"value":1763},{"type":606,"tag":636,"props":2401,"children":2402},{"style":648},[2403],{"type":612,"value":2404},": [",{"type":606,"tag":636,"props":2406,"children":2407},{"style":720},[2408],{"type":612,"value":1084},{"type":606,"tag":636,"props":2410,"children":2411},{"style":648},[2412],{"type":612,"value":1839},{"type":606,"tag":636,"props":2414,"children":2415},{"style":720},[2416],{"type":612,"value":1852},{"type":606,"tag":636,"props":2418,"children":2419},{"style":648},[2420],{"type":612,"value":1839},{"type":606,"tag":636,"props":2422,"children":2423},{"style":720},[2424],{"type":612,"value":810},{"type":606,"tag":636,"props":2426,"children":2427},{"style":648},[2428],{"type":612,"value":2429},"]}\n",{"type":606,"tag":636,"props":2431,"children":2432},{"class":638,"line":227},[2433],{"type":606,"tag":636,"props":2434,"children":2435},{"emptyLinePlaceholder":13},[2436],{"type":612,"value":671},{"type":606,"tag":636,"props":2438,"children":2439},{"class":638,"line":236},[2440],{"type":606,"tag":636,"props":2441,"children":2442},{"style":696},[2443],{"type":612,"value":2444},"# Test exponential backoff\n",{"type":606,"tag":636,"props":2446,"children":2447},{"class":638,"line":245},[2448,2452],{"type":606,"tag":636,"props":2449,"children":2450},{"style":642},[2451],{"type":612,"value":1117},{"type":606,"tag":636,"props":2453,"children":2454},{"style":648},[2455],{"type":612,"value":856},{"type":606,"tag":636,"props":2457,"children":2458},{"class":638,"line":254},[2459,2463,2467,2472,2476,2480,2485,2489,2494,2498,2503],{"type":606,"tag":636,"props":2460,"children":2461},{"style":648},[2462],{"type":612,"value":1129},{"type":606,"tag":636,"props":2464,"children":2465},{"style":642},[2466],{"type":612,"value":805},{"type":606,"tag":636,"props":2468,"children":2469},{"style":648},[2470],{"type":612,"value":2471}," exponential_backoff_retry(api_call, ",{"type":606,"tag":636,"props":2473,"children":2474},{"style":1823},[2475],{"type":612,"value":1826},{"type":606,"tag":636,"props":2477,"children":2478},{"style":642},[2479],{"type":612,"value":805},{"type":606,"tag":636,"props":2481,"children":2482},{"style":720},[2483],{"type":612,"value":2484},"4",{"type":606,"tag":636,"props":2486,"children":2487},{"style":648},[2488],{"type":612,"value":1839},{"type":606,"tag":636,"props":2490,"children":2491},{"style":1823},[2492],{"type":612,"value":2493},"base_delay",{"type":606,"tag":636,"props":2495,"children":2496},{"style":642},[2497],{"type":612,"value":805},{"type":606,"tag":636,"props":2499,"children":2500},{"style":720},[2501],{"type":612,"value":2502},"0.5",{"type":606,"tag":636,"props":2504,"children":2505},{"style":648},[2506],{"type":612,"value":762},{"type":606,"tag":636,"props":2508,"children":2509},{"class":638,"line":263},[2510,2514,2518,2522,2527,2531,2535,2539,2543],{"type":606,"tag":636,"props":2511,"children":2512},{"style":720},[2513],{"type":612,"value":1146},{"type":606,"tag":636,"props":2515,"children":2516},{"style":648},[2517],{"type":612,"value":751},{"type":606,"tag":636,"props":2519,"children":2520},{"style":642},[2521],{"type":612,"value":890},{"type":606,"tag":636,"props":2523,"children":2524},{"style":754},[2525],{"type":612,"value":2526},"\"API result: ",{"type":606,"tag":636,"props":2528,"children":2529},{"style":720},[2530],{"type":612,"value":900},{"type":606,"tag":636,"props":2532,"children":2533},{"style":648},[2534],{"type":612,"value":1168},{"type":606,"tag":636,"props":2536,"children":2537},{"style":720},[2538],{"type":612,"value":1014},{"type":606,"tag":636,"props":2540,"children":2541},{"style":754},[2542],{"type":612,"value":920},{"type":606,"tag":636,"props":2544,"children":2545},{"style":648},[2546],{"type":612,"value":762},{"type":606,"tag":636,"props":2548,"children":2549},{"class":638,"line":272},[2550,2554,2558],{"type":606,"tag":636,"props":2551,"children":2552},{"style":642},[2553],{"type":612,"value":1188},{"type":606,"tag":636,"props":2555,"children":2556},{"style":720},[2557],{"type":612,"value":2353},{"type":606,"tag":636,"props":2559,"children":2560},{"style":648},[2561],{"type":612,"value":856},{"type":606,"tag":636,"props":2563,"children":2564},{"class":638,"line":281},[2565,2569,2573,2578],{"type":606,"tag":636,"props":2566,"children":2567},{"style":720},[2568],{"type":612,"value":1146},{"type":606,"tag":636,"props":2570,"children":2571},{"style":648},[2572],{"type":612,"value":751},{"type":606,"tag":636,"props":2574,"children":2575},{"style":754},[2576],{"type":612,"value":2577},"\"API call failed after all retries\"",{"type":606,"tag":636,"props":2579,"children":2580},{"style":648},[2581],{"type":612,"value":762},{"type":606,"tag":1322,"props":2583,"children":2585},{"id":2584},"retry-with-custom-conditions",[2586],{"type":612,"value":2587},"Retry with Custom Conditions",{"type":606,"tag":621,"props":2589,"children":2590},{},[2591],{"type":606,"tag":625,"props":2592,"children":2594},{"className":627,"code":2593,"language":629,"meta":8,"style":8},"def conditional_retry(operation, max_attempts=3, retryable_exceptions=None):\n    \"\"\"Retry only for specific exception types\"\"\"\n    if retryable_exceptions is None:\n        retryable_exceptions = (ConnectionError, TimeoutError)\n    \n    for attempt in range(max_attempts):\n        try:\n            return operation()\n        except retryable_exceptions as e:\n            print(f\"Retryable error on attempt {attempt + 1}: {e}\")\n            \n            if attempt == max_attempts - 1:\n                raise\n            \n            time.sleep(1)\n        except Exception as e:\n            print(f\"Non-retryable error: {e}\")\n            raise  # Don't retry for other exceptions\n\ndef mixed_failure_operation():\n    import random\n    failure_type = random.random()\n    \n    if failure_type \u003C 0.4:\n        raise ConnectionError(\"Network issue\")  # Retryable\n    elif failure_type \u003C 0.6:\n        raise ValueError(\"Invalid input data\")  # Not retryable\n    else:\n        return \"Success\"\n\n# Test conditional retry\ntry:\n    result = conditional_retry(mixed_failure_operation)\n    print(f\"Result: {result}\")\nexcept Exception as e:\n    print(f\"Operation failed: {e}\")\n",[2595],{"type":606,"tag":632,"props":2596,"children":2597},{"__ignoreMap":8},[2598,2640,2648,2674,2708,2716,2739,2750,2761,2781,2841,2848,2879,2886,2893,2908,2927,2967,2980,2987,3003,3014,3031,3038,3063,3092,3116,3146,3158,3171,3178,3186,3197,3213,3253,3272],{"type":606,"tag":636,"props":2599,"children":2600},{"class":638,"line":12},[2601,2605,2610,2614,2618,2622,2627,2631,2636],{"type":606,"tag":636,"props":2602,"children":2603},{"style":642},[2604],{"type":612,"value":679},{"type":606,"tag":636,"props":2606,"children":2607},{"style":682},[2608],{"type":612,"value":2609}," conditional_retry",{"type":606,"tag":636,"props":2611,"children":2612},{"style":648},[2613],{"type":612,"value":1372},{"type":606,"tag":636,"props":2615,"children":2616},{"style":642},[2617],{"type":612,"value":805},{"type":606,"tag":636,"props":2619,"children":2620},{"style":720},[2621],{"type":612,"value":810},{"type":606,"tag":636,"props":2623,"children":2624},{"style":648},[2625],{"type":612,"value":2626},", retryable_exceptions",{"type":606,"tag":636,"props":2628,"children":2629},{"style":642},[2630],{"type":612,"value":805},{"type":606,"tag":636,"props":2632,"children":2633},{"style":720},[2634],{"type":612,"value":2635},"None",{"type":606,"tag":636,"props":2637,"children":2638},{"style":648},[2639],{"type":612,"value":815},{"type":606,"tag":636,"props":2641,"children":2642},{"class":638,"line":27},[2643],{"type":606,"tag":636,"props":2644,"children":2645},{"style":754},[2646],{"type":612,"value":2647},"    \"\"\"Retry only for specific exception types\"\"\"\n",{"type":606,"tag":636,"props":2649,"children":2650},{"class":638,"line":36},[2651,2655,2660,2665,2670],{"type":606,"tag":636,"props":2652,"children":2653},{"style":642},[2654],{"type":612,"value":707},{"type":606,"tag":636,"props":2656,"children":2657},{"style":648},[2658],{"type":612,"value":2659}," retryable_exceptions ",{"type":606,"tag":636,"props":2661,"children":2662},{"style":642},[2663],{"type":612,"value":2664},"is",{"type":606,"tag":636,"props":2666,"children":2667},{"style":720},[2668],{"type":612,"value":2669}," None",{"type":606,"tag":636,"props":2671,"children":2672},{"style":648},[2673],{"type":612,"value":856},{"type":606,"tag":636,"props":2675,"children":2676},{"class":638,"line":45},[2677,2682,2686,2690,2695,2699,2704],{"type":606,"tag":636,"props":2678,"children":2679},{"style":648},[2680],{"type":612,"value":2681},"        retryable_exceptions ",{"type":606,"tag":636,"props":2683,"children":2684},{"style":642},[2685],{"type":612,"value":805},{"type":606,"tag":636,"props":2687,"children":2688},{"style":648},[2689],{"type":612,"value":2223},{"type":606,"tag":636,"props":2691,"children":2692},{"style":720},[2693],{"type":612,"value":2694},"ConnectionError",{"type":606,"tag":636,"props":2696,"children":2697},{"style":648},[2698],{"type":612,"value":1839},{"type":606,"tag":636,"props":2700,"children":2701},{"style":720},[2702],{"type":612,"value":2703},"TimeoutError",{"type":606,"tag":636,"props":2705,"children":2706},{"style":648},[2707],{"type":612,"value":762},{"type":606,"tag":636,"props":2709,"children":2710},{"class":638,"line":54},[2711],{"type":606,"tag":636,"props":2712,"children":2713},{"style":648},[2714],{"type":612,"value":2715},"    \n",{"type":606,"tag":636,"props":2717,"children":2718},{"class":638,"line":63},[2719,2723,2727,2731,2735],{"type":606,"tag":636,"props":2720,"children":2721},{"style":642},[2722],{"type":612,"value":823},{"type":606,"tag":636,"props":2724,"children":2725},{"style":648},[2726],{"type":612,"value":828},{"type":606,"tag":636,"props":2728,"children":2729},{"style":642},[2730],{"type":612,"value":833},{"type":606,"tag":636,"props":2732,"children":2733},{"style":720},[2734],{"type":612,"value":838},{"type":606,"tag":636,"props":2736,"children":2737},{"style":648},[2738],{"type":612,"value":843},{"type":606,"tag":636,"props":2740,"children":2741},{"class":638,"line":72},[2742,2746],{"type":606,"tag":636,"props":2743,"children":2744},{"style":642},[2745],{"type":612,"value":851},{"type":606,"tag":636,"props":2747,"children":2748},{"style":648},[2749],{"type":612,"value":856},{"type":606,"tag":636,"props":2751,"children":2752},{"class":638,"line":81},[2753,2757],{"type":606,"tag":636,"props":2754,"children":2755},{"style":642},[2756],{"type":612,"value":932},{"type":606,"tag":636,"props":2758,"children":2759},{"style":648},[2760],{"type":612,"value":1451},{"type":606,"tag":636,"props":2762,"children":2763},{"class":638,"line":778},[2764,2768,2772,2777],{"type":606,"tag":636,"props":2765,"children":2766},{"style":642},[2767],{"type":612,"value":945},{"type":606,"tag":636,"props":2769,"children":2770},{"style":648},[2771],{"type":612,"value":2659},{"type":606,"tag":636,"props":2773,"children":2774},{"style":642},[2775],{"type":612,"value":2776},"as",{"type":606,"tag":636,"props":2778,"children":2779},{"style":648},[2780],{"type":612,"value":959},{"type":606,"tag":636,"props":2782,"children":2783},{"class":638,"line":99},[2784,2788,2792,2796,2801,2805,2809,2813,2817,2821,2825,2829,2833,2837],{"type":606,"tag":636,"props":2785,"children":2786},{"style":720},[2787],{"type":612,"value":881},{"type":606,"tag":636,"props":2789,"children":2790},{"style":648},[2791],{"type":612,"value":751},{"type":606,"tag":636,"props":2793,"children":2794},{"style":642},[2795],{"type":612,"value":890},{"type":606,"tag":636,"props":2797,"children":2798},{"style":754},[2799],{"type":612,"value":2800},"\"Retryable error on attempt ",{"type":606,"tag":636,"props":2802,"children":2803},{"style":720},[2804],{"type":612,"value":900},{"type":606,"tag":636,"props":2806,"children":2807},{"style":648},[2808],{"type":612,"value":905},{"type":606,"tag":636,"props":2810,"children":2811},{"style":642},[2812],{"type":612,"value":910},{"type":606,"tag":636,"props":2814,"children":2815},{"style":720},[2816],{"type":612,"value":915},{"type":606,"tag":636,"props":2818,"children":2819},{"style":754},[2820],{"type":612,"value":1768},{"type":606,"tag":636,"props":2822,"children":2823},{"style":720},[2824],{"type":612,"value":900},{"type":606,"tag":636,"props":2826,"children":2827},{"style":648},[2828],{"type":612,"value":1009},{"type":606,"tag":636,"props":2830,"children":2831},{"style":720},[2832],{"type":612,"value":1014},{"type":606,"tag":636,"props":2834,"children":2835},{"style":754},[2836],{"type":612,"value":920},{"type":606,"tag":636,"props":2838,"children":2839},{"style":648},[2840],{"type":612,"value":762},{"type":606,"tag":636,"props":2842,"children":2843},{"class":638,"line":108},[2844],{"type":606,"tag":636,"props":2845,"children":2846},{"style":648},[2847],{"type":612,"value":1538},{"type":606,"tag":636,"props":2849,"children":2850},{"class":638,"line":117},[2851,2855,2859,2863,2867,2871,2875],{"type":606,"tag":636,"props":2852,"children":2853},{"style":642},[2854],{"type":612,"value":1030},{"type":606,"tag":636,"props":2856,"children":2857},{"style":648},[2858],{"type":612,"value":828},{"type":606,"tag":636,"props":2860,"children":2861},{"style":642},[2862],{"type":612,"value":1039},{"type":606,"tag":636,"props":2864,"children":2865},{"style":648},[2866],{"type":612,"value":1044},{"type":606,"tag":636,"props":2868,"children":2869},{"style":642},[2870],{"type":612,"value":1049},{"type":606,"tag":636,"props":2872,"children":2873},{"style":720},[2874],{"type":612,"value":1054},{"type":606,"tag":636,"props":2876,"children":2877},{"style":648},[2878],{"type":612,"value":856},{"type":606,"tag":636,"props":2880,"children":2881},{"class":638,"line":126},[2882],{"type":606,"tag":636,"props":2883,"children":2884},{"style":642},[2885],{"type":612,"value":1598},{"type":606,"tag":636,"props":2887,"children":2888},{"class":638,"line":135},[2889],{"type":606,"tag":636,"props":2890,"children":2891},{"style":648},[2892],{"type":612,"value":1538},{"type":606,"tag":636,"props":2894,"children":2895},{"class":638,"line":144},[2896,2900,2904],{"type":606,"tag":636,"props":2897,"children":2898},{"style":648},[2899],{"type":612,"value":1079},{"type":606,"tag":636,"props":2901,"children":2902},{"style":720},[2903],{"type":612,"value":1084},{"type":606,"tag":636,"props":2905,"children":2906},{"style":648},[2907],{"type":612,"value":762},{"type":606,"tag":636,"props":2909,"children":2910},{"class":638,"line":153},[2911,2915,2919,2923],{"type":606,"tag":636,"props":2912,"children":2913},{"style":642},[2914],{"type":612,"value":945},{"type":606,"tag":636,"props":2916,"children":2917},{"style":720},[2918],{"type":612,"value":1463},{"type":606,"tag":636,"props":2920,"children":2921},{"style":642},[2922],{"type":612,"value":954},{"type":606,"tag":636,"props":2924,"children":2925},{"style":648},[2926],{"type":612,"value":959},{"type":606,"tag":636,"props":2928,"children":2929},{"class":638,"line":163},[2930,2934,2938,2942,2947,2951,2955,2959,2963],{"type":606,"tag":636,"props":2931,"children":2932},{"style":720},[2933],{"type":612,"value":881},{"type":606,"tag":636,"props":2935,"children":2936},{"style":648},[2937],{"type":612,"value":751},{"type":606,"tag":636,"props":2939,"children":2940},{"style":642},[2941],{"type":612,"value":890},{"type":606,"tag":636,"props":2943,"children":2944},{"style":754},[2945],{"type":612,"value":2946},"\"Non-retryable error: ",{"type":606,"tag":636,"props":2948,"children":2949},{"style":720},[2950],{"type":612,"value":900},{"type":606,"tag":636,"props":2952,"children":2953},{"style":648},[2954],{"type":612,"value":1009},{"type":606,"tag":636,"props":2956,"children":2957},{"style":720},[2958],{"type":612,"value":1014},{"type":606,"tag":636,"props":2960,"children":2961},{"style":754},[2962],{"type":612,"value":920},{"type":606,"tag":636,"props":2964,"children":2965},{"style":648},[2966],{"type":612,"value":762},{"type":606,"tag":636,"props":2968,"children":2969},{"class":638,"line":172},[2970,2975],{"type":606,"tag":636,"props":2971,"children":2972},{"style":642},[2973],{"type":612,"value":2974},"            raise",{"type":606,"tag":636,"props":2976,"children":2977},{"style":696},[2978],{"type":612,"value":2979},"  # Don't retry for other exceptions\n",{"type":606,"tag":636,"props":2981,"children":2982},{"class":638,"line":181},[2983],{"type":606,"tag":636,"props":2984,"children":2985},{"emptyLinePlaceholder":13},[2986],{"type":612,"value":671},{"type":606,"tag":636,"props":2988,"children":2989},{"class":638,"line":190},[2990,2994,2999],{"type":606,"tag":636,"props":2991,"children":2992},{"style":642},[2993],{"type":612,"value":679},{"type":606,"tag":636,"props":2995,"children":2996},{"style":682},[2997],{"type":612,"value":2998}," mixed_failure_operation",{"type":606,"tag":636,"props":3000,"children":3001},{"style":648},[3002],{"type":612,"value":690},{"type":606,"tag":636,"props":3004,"children":3005},{"class":638,"line":199},[3006,3010],{"type":606,"tag":636,"props":3007,"children":3008},{"style":642},[3009],{"type":612,"value":1694},{"type":606,"tag":636,"props":3011,"children":3012},{"style":648},[3013],{"type":612,"value":663},{"type":606,"tag":636,"props":3015,"children":3016},{"class":638,"line":208},[3017,3022,3026],{"type":606,"tag":636,"props":3018,"children":3019},{"style":648},[3020],{"type":612,"value":3021},"    failure_type ",{"type":606,"tag":636,"props":3023,"children":3024},{"style":642},[3025],{"type":612,"value":805},{"type":606,"tag":636,"props":3027,"children":3028},{"style":648},[3029],{"type":612,"value":3030}," random.random()\n",{"type":606,"tag":636,"props":3032,"children":3033},{"class":638,"line":217},[3034],{"type":606,"tag":636,"props":3035,"children":3036},{"style":648},[3037],{"type":612,"value":2715},{"type":606,"tag":636,"props":3039,"children":3040},{"class":638,"line":227},[3041,3045,3050,3054,3059],{"type":606,"tag":636,"props":3042,"children":3043},{"style":642},[3044],{"type":612,"value":707},{"type":606,"tag":636,"props":3046,"children":3047},{"style":648},[3048],{"type":612,"value":3049}," failure_type ",{"type":606,"tag":636,"props":3051,"children":3052},{"style":642},[3053],{"type":612,"value":717},{"type":606,"tag":636,"props":3055,"children":3056},{"style":720},[3057],{"type":612,"value":3058}," 0.4",{"type":606,"tag":636,"props":3060,"children":3061},{"style":648},[3062],{"type":612,"value":856},{"type":606,"tag":636,"props":3064,"children":3065},{"class":638,"line":236},[3066,3070,3074,3078,3083,3087],{"type":606,"tag":636,"props":3067,"children":3068},{"style":642},[3069],{"type":612,"value":741},{"type":606,"tag":636,"props":3071,"children":3072},{"style":720},[3073],{"type":612,"value":746},{"type":606,"tag":636,"props":3075,"children":3076},{"style":648},[3077],{"type":612,"value":751},{"type":606,"tag":636,"props":3079,"children":3080},{"style":754},[3081],{"type":612,"value":3082},"\"Network issue\"",{"type":606,"tag":636,"props":3084,"children":3085},{"style":648},[3086],{"type":612,"value":1089},{"type":606,"tag":636,"props":3088,"children":3089},{"style":696},[3090],{"type":612,"value":3091},"# Retryable\n",{"type":606,"tag":636,"props":3093,"children":3094},{"class":638,"line":245},[3095,3100,3104,3108,3112],{"type":606,"tag":636,"props":3096,"children":3097},{"style":642},[3098],{"type":612,"value":3099},"    elif",{"type":606,"tag":636,"props":3101,"children":3102},{"style":648},[3103],{"type":612,"value":3049},{"type":606,"tag":636,"props":3105,"children":3106},{"style":642},[3107],{"type":612,"value":717},{"type":606,"tag":636,"props":3109,"children":3110},{"style":720},[3111],{"type":612,"value":1718},{"type":606,"tag":636,"props":3113,"children":3114},{"style":648},[3115],{"type":612,"value":856},{"type":606,"tag":636,"props":3117,"children":3118},{"class":638,"line":254},[3119,3123,3128,3132,3137,3141],{"type":606,"tag":636,"props":3120,"children":3121},{"style":642},[3122],{"type":612,"value":741},{"type":606,"tag":636,"props":3124,"children":3125},{"style":720},[3126],{"type":612,"value":3127}," ValueError",{"type":606,"tag":636,"props":3129,"children":3130},{"style":648},[3131],{"type":612,"value":751},{"type":606,"tag":636,"props":3133,"children":3134},{"style":754},[3135],{"type":612,"value":3136},"\"Invalid input data\"",{"type":606,"tag":636,"props":3138,"children":3139},{"style":648},[3140],{"type":612,"value":1089},{"type":606,"tag":636,"props":3142,"children":3143},{"style":696},[3144],{"type":612,"value":3145},"# Not retryable\n",{"type":606,"tag":636,"props":3147,"children":3148},{"class":638,"line":263},[3149,3154],{"type":606,"tag":636,"props":3150,"children":3151},{"style":642},[3152],{"type":612,"value":3153},"    else",{"type":606,"tag":636,"props":3155,"children":3156},{"style":648},[3157],{"type":612,"value":856},{"type":606,"tag":636,"props":3159,"children":3160},{"class":638,"line":272},[3161,3166],{"type":606,"tag":636,"props":3162,"children":3163},{"style":642},[3164],{"type":612,"value":3165},"        return",{"type":606,"tag":636,"props":3167,"children":3168},{"style":754},[3169],{"type":612,"value":3170}," \"Success\"\n",{"type":606,"tag":636,"props":3172,"children":3173},{"class":638,"line":281},[3174],{"type":606,"tag":636,"props":3175,"children":3176},{"emptyLinePlaceholder":13},[3177],{"type":612,"value":671},{"type":606,"tag":636,"props":3179,"children":3180},{"class":638,"line":291},[3181],{"type":606,"tag":636,"props":3182,"children":3183},{"style":696},[3184],{"type":612,"value":3185},"# Test conditional retry\n",{"type":606,"tag":636,"props":3187,"children":3188},{"class":638,"line":302},[3189,3193],{"type":606,"tag":636,"props":3190,"children":3191},{"style":642},[3192],{"type":612,"value":1117},{"type":606,"tag":636,"props":3194,"children":3195},{"style":648},[3196],{"type":612,"value":856},{"type":606,"tag":636,"props":3198,"children":3199},{"class":638,"line":311},[3200,3204,3208],{"type":606,"tag":636,"props":3201,"children":3202},{"style":648},[3203],{"type":612,"value":1129},{"type":606,"tag":636,"props":3205,"children":3206},{"style":642},[3207],{"type":612,"value":805},{"type":606,"tag":636,"props":3209,"children":3210},{"style":648},[3211],{"type":612,"value":3212}," conditional_retry(mixed_failure_operation)\n",{"type":606,"tag":636,"props":3214,"children":3215},{"class":638,"line":320},[3216,3220,3224,3228,3233,3237,3241,3245,3249],{"type":606,"tag":636,"props":3217,"children":3218},{"style":720},[3219],{"type":612,"value":1146},{"type":606,"tag":636,"props":3221,"children":3222},{"style":648},[3223],{"type":612,"value":751},{"type":606,"tag":636,"props":3225,"children":3226},{"style":642},[3227],{"type":612,"value":890},{"type":606,"tag":636,"props":3229,"children":3230},{"style":754},[3231],{"type":612,"value":3232},"\"Result: ",{"type":606,"tag":636,"props":3234,"children":3235},{"style":720},[3236],{"type":612,"value":900},{"type":606,"tag":636,"props":3238,"children":3239},{"style":648},[3240],{"type":612,"value":1168},{"type":606,"tag":636,"props":3242,"children":3243},{"style":720},[3244],{"type":612,"value":1014},{"type":606,"tag":636,"props":3246,"children":3247},{"style":754},[3248],{"type":612,"value":920},{"type":606,"tag":636,"props":3250,"children":3251},{"style":648},[3252],{"type":612,"value":762},{"type":606,"tag":636,"props":3254,"children":3255},{"class":638,"line":329},[3256,3260,3264,3268],{"type":606,"tag":636,"props":3257,"children":3258},{"style":642},[3259],{"type":612,"value":1188},{"type":606,"tag":636,"props":3261,"children":3262},{"style":720},[3263],{"type":612,"value":1463},{"type":606,"tag":636,"props":3265,"children":3266},{"style":642},[3267],{"type":612,"value":954},{"type":606,"tag":636,"props":3269,"children":3270},{"style":648},[3271],{"type":612,"value":959},{"type":606,"tag":636,"props":3273,"children":3274},{"class":638,"line":338},[3275,3279,3283,3287,3292,3296,3300,3304,3308],{"type":606,"tag":636,"props":3276,"children":3277},{"style":720},[3278],{"type":612,"value":1146},{"type":606,"tag":636,"props":3280,"children":3281},{"style":648},[3282],{"type":612,"value":751},{"type":606,"tag":636,"props":3284,"children":3285},{"style":642},[3286],{"type":612,"value":890},{"type":606,"tag":636,"props":3288,"children":3289},{"style":754},[3290],{"type":612,"value":3291},"\"Operation failed: ",{"type":606,"tag":636,"props":3293,"children":3294},{"style":720},[3295],{"type":612,"value":900},{"type":606,"tag":636,"props":3297,"children":3298},{"style":648},[3299],{"type":612,"value":1009},{"type":606,"tag":636,"props":3301,"children":3302},{"style":720},[3303],{"type":612,"value":1014},{"type":606,"tag":636,"props":3305,"children":3306},{"style":754},[3307],{"type":612,"value":920},{"type":606,"tag":636,"props":3309,"children":3310},{"style":648},[3311],{"type":612,"value":762},{"type":606,"tag":1218,"props":3313,"children":3315},{"id":3314},"retry-strategy-reference",[3316],{"type":612,"value":3317},"📋 Retry Strategy Reference",{"type":606,"tag":3319,"props":3320,"children":3321},"table",{},[3322,3346],{"type":606,"tag":3323,"props":3324,"children":3325},"thead",{},[3326],{"type":606,"tag":3327,"props":3328,"children":3329},"tr",{},[3330,3336,3341],{"type":606,"tag":3331,"props":3332,"children":3333},"th",{},[3334],{"type":612,"value":3335},"Strategy",{"type":606,"tag":3331,"props":3337,"children":3338},{},[3339],{"type":612,"value":3340},"Use Case",{"type":606,"tag":3331,"props":3342,"children":3343},{},[3344],{"type":612,"value":3345},"Delay Pattern",{"type":606,"tag":3347,"props":3348,"children":3349},"tbody",{},[3350,3368,3385,3403],{"type":606,"tag":3327,"props":3351,"children":3352},{},[3353,3358,3363],{"type":606,"tag":3354,"props":3355,"children":3356},"td",{},[3357],{"type":612,"value":1257},{"type":606,"tag":3354,"props":3359,"children":3360},{},[3361],{"type":612,"value":3362},"Simple operations",{"type":606,"tag":3354,"props":3364,"children":3365},{},[3366],{"type":612,"value":3367},"1s, 1s, 1s",{"type":606,"tag":3327,"props":3369,"children":3370},{},[3371,3375,3380],{"type":606,"tag":3354,"props":3372,"children":3373},{},[3374],{"type":612,"value":1267},{"type":606,"tag":3354,"props":3376,"children":3377},{},[3378],{"type":612,"value":3379},"Network/API calls",{"type":606,"tag":3354,"props":3381,"children":3382},{},[3383],{"type":612,"value":3384},"1s, 2s, 4s, 8s",{"type":606,"tag":3327,"props":3386,"children":3387},{},[3388,3393,3398],{"type":606,"tag":3354,"props":3389,"children":3390},{},[3391],{"type":612,"value":3392},"Linear Backoff",{"type":606,"tag":3354,"props":3394,"children":3395},{},[3396],{"type":612,"value":3397},"Database operations",{"type":606,"tag":3354,"props":3399,"children":3400},{},[3401],{"type":612,"value":3402},"1s, 2s, 3s, 4s",{"type":606,"tag":3327,"props":3404,"children":3405},{},[3406,3410,3415],{"type":606,"tag":3354,"props":3407,"children":3408},{},[3409],{"type":612,"value":1277},{"type":606,"tag":3354,"props":3411,"children":3412},{},[3413],{"type":612,"value":3414},"High-traffic systems",{"type":606,"tag":3354,"props":3416,"children":3417},{},[3418],{"type":612,"value":3419},"Random variation",{"type":606,"tag":1218,"props":3421,"children":3423},{"id":3422},"advanced-retry-patterns",[3424],{"type":612,"value":3425},"🔧 Advanced Retry Patterns",{"type":606,"tag":1322,"props":3427,"children":3429},{"id":3428},"retry-decorator",[3430],{"type":612,"value":3431},"Retry Decorator",{"type":606,"tag":621,"props":3433,"children":3434},{},[3435],{"type":606,"tag":625,"props":3436,"children":3438},{"className":627,"code":3437,"language":629,"meta":8,"style":8},"import time\nimport functools\n\ndef retry(max_attempts=3, delay=1, exceptions=(Exception,)):\n    \"\"\"Decorator for automatic retry\"\"\"\n    def decorator(func):\n        @functools.wraps(func)\n        def wrapper(*args, **kwargs):\n            for attempt in range(max_attempts):\n                try:\n                    return func(*args, **kwargs)\n                except exceptions as e:\n                    if attempt == max_attempts - 1:\n                        raise\n                    print(f\"Retry {attempt + 1}/{max_attempts} for {func.__name__}: {e}\")\n                    time.sleep(delay)\n        return wrapper\n    return decorator\n\n# Use retry decorator\n@retry(max_attempts=3, delay=0.5, exceptions=(ConnectionError,))\ndef download_file(url):\n    import random\n    if random.random() \u003C 0.7:\n        raise ConnectionError(f\"Failed to connect to {url}\")\n    return f\"Downloaded content from {url}\"\n\n# Test decorated function\ntry:\n    content = download_file(\"https://api.example.com/data\")\n    print(content)\nexcept ConnectionError:\n    print(\"Download failed after all retries\")\n",[3439],{"type":606,"tag":632,"props":3440,"children":3441},{"__ignoreMap":8},[3442,3453,3465,3472,3531,3539,3557,3570,3606,3630,3642,3672,3693,3725,3733,3830,3838,3850,3862,3869,3877,3943,3960,3971,3994,4039,4073,4080,4088,4099,4125,4137,4152],{"type":606,"tag":636,"props":3443,"children":3444},{"class":638,"line":12},[3445,3449],{"type":606,"tag":636,"props":3446,"children":3447},{"style":642},[3448],{"type":612,"value":645},{"type":606,"tag":636,"props":3450,"children":3451},{"style":648},[3452],{"type":612,"value":651},{"type":606,"tag":636,"props":3454,"children":3455},{"class":638,"line":27},[3456,3460],{"type":606,"tag":636,"props":3457,"children":3458},{"style":642},[3459],{"type":612,"value":645},{"type":606,"tag":636,"props":3461,"children":3462},{"style":648},[3463],{"type":612,"value":3464}," functools\n",{"type":606,"tag":636,"props":3466,"children":3467},{"class":638,"line":36},[3468],{"type":606,"tag":636,"props":3469,"children":3470},{"emptyLinePlaceholder":13},[3471],{"type":612,"value":671},{"type":606,"tag":636,"props":3473,"children":3474},{"class":638,"line":45},[3475,3479,3484,3488,3492,3496,3500,3504,3508,3513,3517,3521,3526],{"type":606,"tag":636,"props":3476,"children":3477},{"style":642},[3478],{"type":612,"value":679},{"type":606,"tag":636,"props":3480,"children":3481},{"style":682},[3482],{"type":612,"value":3483}," retry",{"type":606,"tag":636,"props":3485,"children":3486},{"style":648},[3487],{"type":612,"value":800},{"type":606,"tag":636,"props":3489,"children":3490},{"style":642},[3491],{"type":612,"value":805},{"type":606,"tag":636,"props":3493,"children":3494},{"style":720},[3495],{"type":612,"value":810},{"type":606,"tag":636,"props":3497,"children":3498},{"style":648},[3499],{"type":612,"value":1385},{"type":606,"tag":636,"props":3501,"children":3502},{"style":642},[3503],{"type":612,"value":805},{"type":606,"tag":636,"props":3505,"children":3506},{"style":720},[3507],{"type":612,"value":1084},{"type":606,"tag":636,"props":3509,"children":3510},{"style":648},[3511],{"type":612,"value":3512},", exceptions",{"type":606,"tag":636,"props":3514,"children":3515},{"style":642},[3516],{"type":612,"value":805},{"type":606,"tag":636,"props":3518,"children":3519},{"style":648},[3520],{"type":612,"value":751},{"type":606,"tag":636,"props":3522,"children":3523},{"style":720},[3524],{"type":612,"value":3525},"Exception",{"type":606,"tag":636,"props":3527,"children":3528},{"style":648},[3529],{"type":612,"value":3530},",)):\n",{"type":606,"tag":636,"props":3532,"children":3533},{"class":638,"line":54},[3534],{"type":606,"tag":636,"props":3535,"children":3536},{"style":754},[3537],{"type":612,"value":3538},"    \"\"\"Decorator for automatic retry\"\"\"\n",{"type":606,"tag":636,"props":3540,"children":3541},{"class":638,"line":63},[3542,3547,3552],{"type":606,"tag":636,"props":3543,"children":3544},{"style":642},[3545],{"type":612,"value":3546},"    def",{"type":606,"tag":636,"props":3548,"children":3549},{"style":682},[3550],{"type":612,"value":3551}," decorator",{"type":606,"tag":636,"props":3553,"children":3554},{"style":648},[3555],{"type":612,"value":3556},"(func):\n",{"type":606,"tag":636,"props":3558,"children":3559},{"class":638,"line":72},[3560,3565],{"type":606,"tag":636,"props":3561,"children":3562},{"style":682},[3563],{"type":612,"value":3564},"        @functools.wraps",{"type":606,"tag":636,"props":3566,"children":3567},{"style":648},[3568],{"type":612,"value":3569},"(func)\n",{"type":606,"tag":636,"props":3571,"children":3572},{"class":638,"line":81},[3573,3578,3583,3587,3591,3596,3601],{"type":606,"tag":636,"props":3574,"children":3575},{"style":642},[3576],{"type":612,"value":3577},"        def",{"type":606,"tag":636,"props":3579,"children":3580},{"style":682},[3581],{"type":612,"value":3582}," wrapper",{"type":606,"tag":636,"props":3584,"children":3585},{"style":648},[3586],{"type":612,"value":751},{"type":606,"tag":636,"props":3588,"children":3589},{"style":642},[3590],{"type":612,"value":2218},{"type":606,"tag":636,"props":3592,"children":3593},{"style":648},[3594],{"type":612,"value":3595},"args, ",{"type":606,"tag":636,"props":3597,"children":3598},{"style":642},[3599],{"type":612,"value":3600},"**",{"type":606,"tag":636,"props":3602,"children":3603},{"style":648},[3604],{"type":612,"value":3605},"kwargs):\n",{"type":606,"tag":636,"props":3607,"children":3608},{"class":638,"line":778},[3609,3614,3618,3622,3626],{"type":606,"tag":636,"props":3610,"children":3611},{"style":642},[3612],{"type":612,"value":3613},"            for",{"type":606,"tag":636,"props":3615,"children":3616},{"style":648},[3617],{"type":612,"value":828},{"type":606,"tag":636,"props":3619,"children":3620},{"style":642},[3621],{"type":612,"value":833},{"type":606,"tag":636,"props":3623,"children":3624},{"style":720},[3625],{"type":612,"value":838},{"type":606,"tag":636,"props":3627,"children":3628},{"style":648},[3629],{"type":612,"value":843},{"type":606,"tag":636,"props":3631,"children":3632},{"class":638,"line":99},[3633,3638],{"type":606,"tag":636,"props":3634,"children":3635},{"style":642},[3636],{"type":612,"value":3637},"                try",{"type":606,"tag":636,"props":3639,"children":3640},{"style":648},[3641],{"type":612,"value":856},{"type":606,"tag":636,"props":3643,"children":3644},{"class":638,"line":108},[3645,3650,3655,3659,3663,3667],{"type":606,"tag":636,"props":3646,"children":3647},{"style":642},[3648],{"type":612,"value":3649},"                    return",{"type":606,"tag":636,"props":3651,"children":3652},{"style":648},[3653],{"type":612,"value":3654}," func(",{"type":606,"tag":636,"props":3656,"children":3657},{"style":642},[3658],{"type":612,"value":2218},{"type":606,"tag":636,"props":3660,"children":3661},{"style":648},[3662],{"type":612,"value":3595},{"type":606,"tag":636,"props":3664,"children":3665},{"style":642},[3666],{"type":612,"value":3600},{"type":606,"tag":636,"props":3668,"children":3669},{"style":648},[3670],{"type":612,"value":3671},"kwargs)\n",{"type":606,"tag":636,"props":3673,"children":3674},{"class":638,"line":117},[3675,3680,3685,3689],{"type":606,"tag":636,"props":3676,"children":3677},{"style":642},[3678],{"type":612,"value":3679},"                except",{"type":606,"tag":636,"props":3681,"children":3682},{"style":648},[3683],{"type":612,"value":3684}," exceptions ",{"type":606,"tag":636,"props":3686,"children":3687},{"style":642},[3688],{"type":612,"value":2776},{"type":606,"tag":636,"props":3690,"children":3691},{"style":648},[3692],{"type":612,"value":959},{"type":606,"tag":636,"props":3694,"children":3695},{"class":638,"line":126},[3696,3701,3705,3709,3713,3717,3721],{"type":606,"tag":636,"props":3697,"children":3698},{"style":642},[3699],{"type":612,"value":3700},"                    if",{"type":606,"tag":636,"props":3702,"children":3703},{"style":648},[3704],{"type":612,"value":828},{"type":606,"tag":636,"props":3706,"children":3707},{"style":642},[3708],{"type":612,"value":1039},{"type":606,"tag":636,"props":3710,"children":3711},{"style":648},[3712],{"type":612,"value":1044},{"type":606,"tag":636,"props":3714,"children":3715},{"style":642},[3716],{"type":612,"value":1049},{"type":606,"tag":636,"props":3718,"children":3719},{"style":720},[3720],{"type":612,"value":1054},{"type":606,"tag":636,"props":3722,"children":3723},{"style":648},[3724],{"type":612,"value":856},{"type":606,"tag":636,"props":3726,"children":3727},{"class":638,"line":135},[3728],{"type":606,"tag":636,"props":3729,"children":3730},{"style":642},[3731],{"type":612,"value":3732},"                        raise\n",{"type":606,"tag":636,"props":3734,"children":3735},{"class":638,"line":144},[3736,3741,3745,3749,3754,3758,3762,3766,3770,3775,3779,3783,3787,3792,3796,3801,3806,3810,3814,3818,3822,3826],{"type":606,"tag":636,"props":3737,"children":3738},{"style":720},[3739],{"type":612,"value":3740},"                    print",{"type":606,"tag":636,"props":3742,"children":3743},{"style":648},[3744],{"type":612,"value":751},{"type":606,"tag":636,"props":3746,"children":3747},{"style":642},[3748],{"type":612,"value":890},{"type":606,"tag":636,"props":3750,"children":3751},{"style":754},[3752],{"type":612,"value":3753},"\"Retry ",{"type":606,"tag":636,"props":3755,"children":3756},{"style":720},[3757],{"type":612,"value":900},{"type":606,"tag":636,"props":3759,"children":3760},{"style":648},[3761],{"type":612,"value":905},{"type":606,"tag":636,"props":3763,"children":3764},{"style":642},[3765],{"type":612,"value":910},{"type":606,"tag":636,"props":3767,"children":3768},{"style":720},[3769],{"type":612,"value":915},{"type":606,"tag":636,"props":3771,"children":3772},{"style":754},[3773],{"type":612,"value":3774},"/",{"type":606,"tag":636,"props":3776,"children":3777},{"style":720},[3778],{"type":612,"value":900},{"type":606,"tag":636,"props":3780,"children":3781},{"style":648},[3782],{"type":612,"value":1826},{"type":606,"tag":636,"props":3784,"children":3785},{"style":720},[3786],{"type":612,"value":1014},{"type":606,"tag":636,"props":3788,"children":3789},{"style":754},[3790],{"type":612,"value":3791}," for ",{"type":606,"tag":636,"props":3793,"children":3794},{"style":720},[3795],{"type":612,"value":900},{"type":606,"tag":636,"props":3797,"children":3798},{"style":648},[3799],{"type":612,"value":3800},"func.",{"type":606,"tag":636,"props":3802,"children":3803},{"style":720},[3804],{"type":612,"value":3805},"__name__}",{"type":606,"tag":636,"props":3807,"children":3808},{"style":754},[3809],{"type":612,"value":1768},{"type":606,"tag":636,"props":3811,"children":3812},{"style":720},[3813],{"type":612,"value":900},{"type":606,"tag":636,"props":3815,"children":3816},{"style":648},[3817],{"type":612,"value":1009},{"type":606,"tag":636,"props":3819,"children":3820},{"style":720},[3821],{"type":612,"value":1014},{"type":606,"tag":636,"props":3823,"children":3824},{"style":754},[3825],{"type":612,"value":920},{"type":606,"tag":636,"props":3827,"children":3828},{"style":648},[3829],{"type":612,"value":762},{"type":606,"tag":636,"props":3831,"children":3832},{"class":638,"line":153},[3833],{"type":606,"tag":636,"props":3834,"children":3835},{"style":648},[3836],{"type":612,"value":3837},"                    time.sleep(delay)\n",{"type":606,"tag":636,"props":3839,"children":3840},{"class":638,"line":163},[3841,3845],{"type":606,"tag":636,"props":3842,"children":3843},{"style":642},[3844],{"type":612,"value":3165},{"type":606,"tag":636,"props":3846,"children":3847},{"style":648},[3848],{"type":612,"value":3849}," wrapper\n",{"type":606,"tag":636,"props":3851,"children":3852},{"class":638,"line":172},[3853,3857],{"type":606,"tag":636,"props":3854,"children":3855},{"style":642},[3856],{"type":612,"value":770},{"type":606,"tag":636,"props":3858,"children":3859},{"style":648},[3860],{"type":612,"value":3861}," decorator\n",{"type":606,"tag":636,"props":3863,"children":3864},{"class":638,"line":181},[3865],{"type":606,"tag":636,"props":3866,"children":3867},{"emptyLinePlaceholder":13},[3868],{"type":612,"value":671},{"type":606,"tag":636,"props":3870,"children":3871},{"class":638,"line":190},[3872],{"type":606,"tag":636,"props":3873,"children":3874},{"style":696},[3875],{"type":612,"value":3876},"# Use retry decorator\n",{"type":606,"tag":636,"props":3878,"children":3879},{"class":638,"line":199},[3880,3885,3889,3893,3897,3901,3905,3909,3913,3917,3921,3926,3930,3934,3938],{"type":606,"tag":636,"props":3881,"children":3882},{"style":682},[3883],{"type":612,"value":3884},"@retry",{"type":606,"tag":636,"props":3886,"children":3887},{"style":648},[3888],{"type":612,"value":751},{"type":606,"tag":636,"props":3890,"children":3891},{"style":1823},[3892],{"type":612,"value":1826},{"type":606,"tag":636,"props":3894,"children":3895},{"style":642},[3896],{"type":612,"value":805},{"type":606,"tag":636,"props":3898,"children":3899},{"style":720},[3900],{"type":612,"value":810},{"type":606,"tag":636,"props":3902,"children":3903},{"style":648},[3904],{"type":612,"value":1839},{"type":606,"tag":636,"props":3906,"children":3907},{"style":1823},[3908],{"type":612,"value":1634},{"type":606,"tag":636,"props":3910,"children":3911},{"style":642},[3912],{"type":612,"value":805},{"type":606,"tag":636,"props":3914,"children":3915},{"style":720},[3916],{"type":612,"value":2502},{"type":606,"tag":636,"props":3918,"children":3919},{"style":648},[3920],{"type":612,"value":1839},{"type":606,"tag":636,"props":3922,"children":3923},{"style":1823},[3924],{"type":612,"value":3925},"exceptions",{"type":606,"tag":636,"props":3927,"children":3928},{"style":642},[3929],{"type":612,"value":805},{"type":606,"tag":636,"props":3931,"children":3932},{"style":648},[3933],{"type":612,"value":751},{"type":606,"tag":636,"props":3935,"children":3936},{"style":720},[3937],{"type":612,"value":2694},{"type":606,"tag":636,"props":3939,"children":3940},{"style":648},[3941],{"type":612,"value":3942},",))\n",{"type":606,"tag":636,"props":3944,"children":3945},{"class":638,"line":208},[3946,3950,3955],{"type":606,"tag":636,"props":3947,"children":3948},{"style":642},[3949],{"type":612,"value":679},{"type":606,"tag":636,"props":3951,"children":3952},{"style":682},[3953],{"type":612,"value":3954}," download_file",{"type":606,"tag":636,"props":3956,"children":3957},{"style":648},[3958],{"type":612,"value":3959},"(url):\n",{"type":606,"tag":636,"props":3961,"children":3962},{"class":638,"line":217},[3963,3967],{"type":606,"tag":636,"props":3964,"children":3965},{"style":642},[3966],{"type":612,"value":1694},{"type":606,"tag":636,"props":3968,"children":3969},{"style":648},[3970],{"type":612,"value":663},{"type":606,"tag":636,"props":3972,"children":3973},{"class":638,"line":227},[3974,3978,3982,3986,3990],{"type":606,"tag":636,"props":3975,"children":3976},{"style":642},[3977],{"type":612,"value":707},{"type":606,"tag":636,"props":3979,"children":3980},{"style":648},[3981],{"type":612,"value":712},{"type":606,"tag":636,"props":3983,"children":3984},{"style":642},[3985],{"type":612,"value":717},{"type":606,"tag":636,"props":3987,"children":3988},{"style":720},[3989],{"type":612,"value":723},{"type":606,"tag":636,"props":3991,"children":3992},{"style":648},[3993],{"type":612,"value":856},{"type":606,"tag":636,"props":3995,"children":3996},{"class":638,"line":236},[3997,4001,4005,4009,4013,4018,4022,4027,4031,4035],{"type":606,"tag":636,"props":3998,"children":3999},{"style":642},[4000],{"type":612,"value":741},{"type":606,"tag":636,"props":4002,"children":4003},{"style":720},[4004],{"type":612,"value":746},{"type":606,"tag":636,"props":4006,"children":4007},{"style":648},[4008],{"type":612,"value":751},{"type":606,"tag":636,"props":4010,"children":4011},{"style":642},[4012],{"type":612,"value":890},{"type":606,"tag":636,"props":4014,"children":4015},{"style":754},[4016],{"type":612,"value":4017},"\"Failed to connect to ",{"type":606,"tag":636,"props":4019,"children":4020},{"style":720},[4021],{"type":612,"value":900},{"type":606,"tag":636,"props":4023,"children":4024},{"style":648},[4025],{"type":612,"value":4026},"url",{"type":606,"tag":636,"props":4028,"children":4029},{"style":720},[4030],{"type":612,"value":1014},{"type":606,"tag":636,"props":4032,"children":4033},{"style":754},[4034],{"type":612,"value":920},{"type":606,"tag":636,"props":4036,"children":4037},{"style":648},[4038],{"type":612,"value":762},{"type":606,"tag":636,"props":4040,"children":4041},{"class":638,"line":245},[4042,4046,4051,4056,4060,4064,4068],{"type":606,"tag":636,"props":4043,"children":4044},{"style":642},[4045],{"type":612,"value":770},{"type":606,"tag":636,"props":4047,"children":4048},{"style":642},[4049],{"type":612,"value":4050}," f",{"type":606,"tag":636,"props":4052,"children":4053},{"style":754},[4054],{"type":612,"value":4055},"\"Downloaded content from ",{"type":606,"tag":636,"props":4057,"children":4058},{"style":720},[4059],{"type":612,"value":900},{"type":606,"tag":636,"props":4061,"children":4062},{"style":648},[4063],{"type":612,"value":4026},{"type":606,"tag":636,"props":4065,"children":4066},{"style":720},[4067],{"type":612,"value":1014},{"type":606,"tag":636,"props":4069,"children":4070},{"style":754},[4071],{"type":612,"value":4072},"\"\n",{"type":606,"tag":636,"props":4074,"children":4075},{"class":638,"line":254},[4076],{"type":606,"tag":636,"props":4077,"children":4078},{"emptyLinePlaceholder":13},[4079],{"type":612,"value":671},{"type":606,"tag":636,"props":4081,"children":4082},{"class":638,"line":263},[4083],{"type":606,"tag":636,"props":4084,"children":4085},{"style":696},[4086],{"type":612,"value":4087},"# Test decorated function\n",{"type":606,"tag":636,"props":4089,"children":4090},{"class":638,"line":272},[4091,4095],{"type":606,"tag":636,"props":4092,"children":4093},{"style":642},[4094],{"type":612,"value":1117},{"type":606,"tag":636,"props":4096,"children":4097},{"style":648},[4098],{"type":612,"value":856},{"type":606,"tag":636,"props":4100,"children":4101},{"class":638,"line":281},[4102,4107,4111,4116,4121],{"type":606,"tag":636,"props":4103,"children":4104},{"style":648},[4105],{"type":612,"value":4106},"    content ",{"type":606,"tag":636,"props":4108,"children":4109},{"style":642},[4110],{"type":612,"value":805},{"type":606,"tag":636,"props":4112,"children":4113},{"style":648},[4114],{"type":612,"value":4115}," download_file(",{"type":606,"tag":636,"props":4117,"children":4118},{"style":754},[4119],{"type":612,"value":4120},"\"https://api.example.com/data\"",{"type":606,"tag":636,"props":4122,"children":4123},{"style":648},[4124],{"type":612,"value":762},{"type":606,"tag":636,"props":4126,"children":4127},{"class":638,"line":291},[4128,4132],{"type":606,"tag":636,"props":4129,"children":4130},{"style":720},[4131],{"type":612,"value":1146},{"type":606,"tag":636,"props":4133,"children":4134},{"style":648},[4135],{"type":612,"value":4136},"(content)\n",{"type":606,"tag":636,"props":4138,"children":4139},{"class":638,"line":302},[4140,4144,4148],{"type":606,"tag":636,"props":4141,"children":4142},{"style":642},[4143],{"type":612,"value":1188},{"type":606,"tag":636,"props":4145,"children":4146},{"style":720},[4147],{"type":612,"value":746},{"type":606,"tag":636,"props":4149,"children":4150},{"style":648},[4151],{"type":612,"value":856},{"type":606,"tag":636,"props":4153,"children":4154},{"class":638,"line":311},[4155,4159,4163,4168],{"type":606,"tag":636,"props":4156,"children":4157},{"style":720},[4158],{"type":612,"value":1146},{"type":606,"tag":636,"props":4160,"children":4161},{"style":648},[4162],{"type":612,"value":751},{"type":606,"tag":636,"props":4164,"children":4165},{"style":754},[4166],{"type":612,"value":4167},"\"Download failed after all retries\"",{"type":606,"tag":636,"props":4169,"children":4170},{"style":648},[4171],{"type":612,"value":762},{"type":606,"tag":1322,"props":4173,"children":4175},{"id":4174},"retry-with-timeout",[4176],{"type":612,"value":4177},"Retry with Timeout",{"type":606,"tag":621,"props":4179,"children":4180},{},[4181],{"type":606,"tag":625,"props":4182,"children":4184},{"className":627,"code":4183,"language":629,"meta":8,"style":8},"import time\n\ndef retry_with_timeout(operation, max_attempts=3, timeout=10):\n    \"\"\"Retry with overall timeout limit\"\"\"\n    start_time = time.time()\n    \n    for attempt in range(max_attempts):\n        # Check if we've exceeded the timeout\n        if time.time() - start_time > timeout:\n            raise TimeoutError(f\"Operation timed out after {timeout} seconds\")\n        \n        try:\n            return operation()\n        except Exception as e:\n            print(f\"Attempt {attempt + 1} failed: {e}\")\n            \n            if attempt == max_attempts - 1:\n                raise\n            \n            # Don't sleep if it would exceed timeout\n            remaining_time = timeout - (time.time() - start_time)\n            if remaining_time > 1:\n                time.sleep(1)\n\ndef slow_operation():\n    import random\n    time.sleep(random.uniform(0.5, 2))  # Simulate slow operation\n    if random.random() \u003C 0.8:\n        raise RuntimeError(\"Operation failed\")\n    return \"Operation completed\"\n\n# Test retry with timeout\ntry:\n    result = retry_with_timeout(slow_operation, max_attempts=5, timeout=8)\n    print(f\"Result: {result}\")\nexcept Exception as e:\n    print(f\"Operation failed: {e}\")\n",[4185],{"type":606,"tag":632,"props":4186,"children":4187},{"__ignoreMap":8},[4188,4199,4206,4248,4256,4273,4280,4303,4311,4343,4389,4397,4408,4419,4438,4497,4504,4535,4542,4549,4557,4592,4616,4632,4639,4655,4666,4696,4719,4744,4756,4763,4771,4782,4832,4871,4890],{"type":606,"tag":636,"props":4189,"children":4190},{"class":638,"line":12},[4191,4195],{"type":606,"tag":636,"props":4192,"children":4193},{"style":642},[4194],{"type":612,"value":645},{"type":606,"tag":636,"props":4196,"children":4197},{"style":648},[4198],{"type":612,"value":651},{"type":606,"tag":636,"props":4200,"children":4201},{"class":638,"line":27},[4202],{"type":606,"tag":636,"props":4203,"children":4204},{"emptyLinePlaceholder":13},[4205],{"type":612,"value":671},{"type":606,"tag":636,"props":4207,"children":4208},{"class":638,"line":36},[4209,4213,4218,4222,4226,4230,4235,4239,4244],{"type":606,"tag":636,"props":4210,"children":4211},{"style":642},[4212],{"type":612,"value":679},{"type":606,"tag":636,"props":4214,"children":4215},{"style":682},[4216],{"type":612,"value":4217}," retry_with_timeout",{"type":606,"tag":636,"props":4219,"children":4220},{"style":648},[4221],{"type":612,"value":1372},{"type":606,"tag":636,"props":4223,"children":4224},{"style":642},[4225],{"type":612,"value":805},{"type":606,"tag":636,"props":4227,"children":4228},{"style":720},[4229],{"type":612,"value":810},{"type":606,"tag":636,"props":4231,"children":4232},{"style":648},[4233],{"type":612,"value":4234},", timeout",{"type":606,"tag":636,"props":4236,"children":4237},{"style":642},[4238],{"type":612,"value":805},{"type":606,"tag":636,"props":4240,"children":4241},{"style":720},[4242],{"type":612,"value":4243},"10",{"type":606,"tag":636,"props":4245,"children":4246},{"style":648},[4247],{"type":612,"value":815},{"type":606,"tag":636,"props":4249,"children":4250},{"class":638,"line":45},[4251],{"type":606,"tag":636,"props":4252,"children":4253},{"style":754},[4254],{"type":612,"value":4255},"    \"\"\"Retry with overall timeout limit\"\"\"\n",{"type":606,"tag":636,"props":4257,"children":4258},{"class":638,"line":54},[4259,4264,4268],{"type":606,"tag":636,"props":4260,"children":4261},{"style":648},[4262],{"type":612,"value":4263},"    start_time ",{"type":606,"tag":636,"props":4265,"children":4266},{"style":642},[4267],{"type":612,"value":805},{"type":606,"tag":636,"props":4269,"children":4270},{"style":648},[4271],{"type":612,"value":4272}," time.time()\n",{"type":606,"tag":636,"props":4274,"children":4275},{"class":638,"line":63},[4276],{"type":606,"tag":636,"props":4277,"children":4278},{"style":648},[4279],{"type":612,"value":2715},{"type":606,"tag":636,"props":4281,"children":4282},{"class":638,"line":72},[4283,4287,4291,4295,4299],{"type":606,"tag":636,"props":4284,"children":4285},{"style":642},[4286],{"type":612,"value":823},{"type":606,"tag":636,"props":4288,"children":4289},{"style":648},[4290],{"type":612,"value":828},{"type":606,"tag":636,"props":4292,"children":4293},{"style":642},[4294],{"type":612,"value":833},{"type":606,"tag":636,"props":4296,"children":4297},{"style":720},[4298],{"type":612,"value":838},{"type":606,"tag":636,"props":4300,"children":4301},{"style":648},[4302],{"type":612,"value":843},{"type":606,"tag":636,"props":4304,"children":4305},{"class":638,"line":81},[4306],{"type":606,"tag":636,"props":4307,"children":4308},{"style":696},[4309],{"type":612,"value":4310},"        # Check if we've exceeded the timeout\n",{"type":606,"tag":636,"props":4312,"children":4313},{"class":638,"line":778},[4314,4319,4324,4328,4333,4338],{"type":606,"tag":636,"props":4315,"children":4316},{"style":642},[4317],{"type":612,"value":4318},"        if",{"type":606,"tag":636,"props":4320,"children":4321},{"style":648},[4322],{"type":612,"value":4323}," time.time() ",{"type":606,"tag":636,"props":4325,"children":4326},{"style":642},[4327],{"type":612,"value":1049},{"type":606,"tag":636,"props":4329,"children":4330},{"style":648},[4331],{"type":612,"value":4332}," start_time ",{"type":606,"tag":636,"props":4334,"children":4335},{"style":642},[4336],{"type":612,"value":4337},">",{"type":606,"tag":636,"props":4339,"children":4340},{"style":648},[4341],{"type":612,"value":4342}," timeout:\n",{"type":606,"tag":636,"props":4344,"children":4345},{"class":638,"line":99},[4346,4350,4354,4358,4362,4367,4371,4376,4380,4385],{"type":606,"tag":636,"props":4347,"children":4348},{"style":642},[4349],{"type":612,"value":2974},{"type":606,"tag":636,"props":4351,"children":4352},{"style":720},[4353],{"type":612,"value":2353},{"type":606,"tag":636,"props":4355,"children":4356},{"style":648},[4357],{"type":612,"value":751},{"type":606,"tag":636,"props":4359,"children":4360},{"style":642},[4361],{"type":612,"value":890},{"type":606,"tag":636,"props":4363,"children":4364},{"style":754},[4365],{"type":612,"value":4366},"\"Operation timed out after ",{"type":606,"tag":636,"props":4368,"children":4369},{"style":720},[4370],{"type":612,"value":900},{"type":606,"tag":636,"props":4372,"children":4373},{"style":648},[4374],{"type":612,"value":4375},"timeout",{"type":606,"tag":636,"props":4377,"children":4378},{"style":720},[4379],{"type":612,"value":1014},{"type":606,"tag":636,"props":4381,"children":4382},{"style":754},[4383],{"type":612,"value":4384}," seconds\"",{"type":606,"tag":636,"props":4386,"children":4387},{"style":648},[4388],{"type":612,"value":762},{"type":606,"tag":636,"props":4390,"children":4391},{"class":638,"line":108},[4392],{"type":606,"tag":636,"props":4393,"children":4394},{"style":648},[4395],{"type":612,"value":4396},"        \n",{"type":606,"tag":636,"props":4398,"children":4399},{"class":638,"line":117},[4400,4404],{"type":606,"tag":636,"props":4401,"children":4402},{"style":642},[4403],{"type":612,"value":851},{"type":606,"tag":636,"props":4405,"children":4406},{"style":648},[4407],{"type":612,"value":856},{"type":606,"tag":636,"props":4409,"children":4410},{"class":638,"line":126},[4411,4415],{"type":606,"tag":636,"props":4412,"children":4413},{"style":642},[4414],{"type":612,"value":932},{"type":606,"tag":636,"props":4416,"children":4417},{"style":648},[4418],{"type":612,"value":1451},{"type":606,"tag":636,"props":4420,"children":4421},{"class":638,"line":135},[4422,4426,4430,4434],{"type":606,"tag":636,"props":4423,"children":4424},{"style":642},[4425],{"type":612,"value":945},{"type":606,"tag":636,"props":4427,"children":4428},{"style":720},[4429],{"type":612,"value":1463},{"type":606,"tag":636,"props":4431,"children":4432},{"style":642},[4433],{"type":612,"value":954},{"type":606,"tag":636,"props":4435,"children":4436},{"style":648},[4437],{"type":612,"value":959},{"type":606,"tag":636,"props":4439,"children":4440},{"class":638,"line":144},[4441,4445,4449,4453,4457,4461,4465,4469,4473,4477,4481,4485,4489,4493],{"type":606,"tag":636,"props":4442,"children":4443},{"style":720},[4444],{"type":612,"value":881},{"type":606,"tag":636,"props":4446,"children":4447},{"style":648},[4448],{"type":612,"value":751},{"type":606,"tag":636,"props":4450,"children":4451},{"style":642},[4452],{"type":612,"value":890},{"type":606,"tag":636,"props":4454,"children":4455},{"style":754},[4456],{"type":612,"value":979},{"type":606,"tag":636,"props":4458,"children":4459},{"style":720},[4460],{"type":612,"value":900},{"type":606,"tag":636,"props":4462,"children":4463},{"style":648},[4464],{"type":612,"value":905},{"type":606,"tag":636,"props":4466,"children":4467},{"style":642},[4468],{"type":612,"value":910},{"type":606,"tag":636,"props":4470,"children":4471},{"style":720},[4472],{"type":612,"value":915},{"type":606,"tag":636,"props":4474,"children":4475},{"style":754},[4476],{"type":612,"value":1000},{"type":606,"tag":636,"props":4478,"children":4479},{"style":720},[4480],{"type":612,"value":900},{"type":606,"tag":636,"props":4482,"children":4483},{"style":648},[4484],{"type":612,"value":1009},{"type":606,"tag":636,"props":4486,"children":4487},{"style":720},[4488],{"type":612,"value":1014},{"type":606,"tag":636,"props":4490,"children":4491},{"style":754},[4492],{"type":612,"value":920},{"type":606,"tag":636,"props":4494,"children":4495},{"style":648},[4496],{"type":612,"value":762},{"type":606,"tag":636,"props":4498,"children":4499},{"class":638,"line":153},[4500],{"type":606,"tag":636,"props":4501,"children":4502},{"style":648},[4503],{"type":612,"value":1538},{"type":606,"tag":636,"props":4505,"children":4506},{"class":638,"line":163},[4507,4511,4515,4519,4523,4527,4531],{"type":606,"tag":636,"props":4508,"children":4509},{"style":642},[4510],{"type":612,"value":1030},{"type":606,"tag":636,"props":4512,"children":4513},{"style":648},[4514],{"type":612,"value":828},{"type":606,"tag":636,"props":4516,"children":4517},{"style":642},[4518],{"type":612,"value":1039},{"type":606,"tag":636,"props":4520,"children":4521},{"style":648},[4522],{"type":612,"value":1044},{"type":606,"tag":636,"props":4524,"children":4525},{"style":642},[4526],{"type":612,"value":1049},{"type":606,"tag":636,"props":4528,"children":4529},{"style":720},[4530],{"type":612,"value":1054},{"type":606,"tag":636,"props":4532,"children":4533},{"style":648},[4534],{"type":612,"value":856},{"type":606,"tag":636,"props":4536,"children":4537},{"class":638,"line":172},[4538],{"type":606,"tag":636,"props":4539,"children":4540},{"style":642},[4541],{"type":612,"value":1598},{"type":606,"tag":636,"props":4543,"children":4544},{"class":638,"line":181},[4545],{"type":606,"tag":636,"props":4546,"children":4547},{"style":648},[4548],{"type":612,"value":1538},{"type":606,"tag":636,"props":4550,"children":4551},{"class":638,"line":190},[4552],{"type":606,"tag":636,"props":4553,"children":4554},{"style":696},[4555],{"type":612,"value":4556},"            # Don't sleep if it would exceed timeout\n",{"type":606,"tag":636,"props":4558,"children":4559},{"class":638,"line":199},[4560,4565,4569,4574,4578,4583,4587],{"type":606,"tag":636,"props":4561,"children":4562},{"style":648},[4563],{"type":612,"value":4564},"            remaining_time ",{"type":606,"tag":636,"props":4566,"children":4567},{"style":642},[4568],{"type":612,"value":805},{"type":606,"tag":636,"props":4570,"children":4571},{"style":648},[4572],{"type":612,"value":4573}," timeout ",{"type":606,"tag":636,"props":4575,"children":4576},{"style":642},[4577],{"type":612,"value":1049},{"type":606,"tag":636,"props":4579,"children":4580},{"style":648},[4581],{"type":612,"value":4582}," (time.time() ",{"type":606,"tag":636,"props":4584,"children":4585},{"style":642},[4586],{"type":612,"value":1049},{"type":606,"tag":636,"props":4588,"children":4589},{"style":648},[4590],{"type":612,"value":4591}," start_time)\n",{"type":606,"tag":636,"props":4593,"children":4594},{"class":638,"line":208},[4595,4599,4604,4608,4612],{"type":606,"tag":636,"props":4596,"children":4597},{"style":642},[4598],{"type":612,"value":1030},{"type":606,"tag":636,"props":4600,"children":4601},{"style":648},[4602],{"type":612,"value":4603}," remaining_time ",{"type":606,"tag":636,"props":4605,"children":4606},{"style":642},[4607],{"type":612,"value":4337},{"type":606,"tag":636,"props":4609,"children":4610},{"style":720},[4611],{"type":612,"value":1054},{"type":606,"tag":636,"props":4613,"children":4614},{"style":648},[4615],{"type":612,"value":856},{"type":606,"tag":636,"props":4617,"children":4618},{"class":638,"line":217},[4619,4624,4628],{"type":606,"tag":636,"props":4620,"children":4621},{"style":648},[4622],{"type":612,"value":4623},"                time.sleep(",{"type":606,"tag":636,"props":4625,"children":4626},{"style":720},[4627],{"type":612,"value":1084},{"type":606,"tag":636,"props":4629,"children":4630},{"style":648},[4631],{"type":612,"value":762},{"type":606,"tag":636,"props":4633,"children":4634},{"class":638,"line":227},[4635],{"type":606,"tag":636,"props":4636,"children":4637},{"emptyLinePlaceholder":13},[4638],{"type":612,"value":671},{"type":606,"tag":636,"props":4640,"children":4641},{"class":638,"line":236},[4642,4646,4651],{"type":606,"tag":636,"props":4643,"children":4644},{"style":642},[4645],{"type":612,"value":679},{"type":606,"tag":636,"props":4647,"children":4648},{"style":682},[4649],{"type":612,"value":4650}," slow_operation",{"type":606,"tag":636,"props":4652,"children":4653},{"style":648},[4654],{"type":612,"value":690},{"type":606,"tag":636,"props":4656,"children":4657},{"class":638,"line":245},[4658,4662],{"type":606,"tag":636,"props":4659,"children":4660},{"style":642},[4661],{"type":612,"value":1694},{"type":606,"tag":636,"props":4663,"children":4664},{"style":648},[4665],{"type":612,"value":663},{"type":606,"tag":636,"props":4667,"children":4668},{"class":638,"line":254},[4669,4674,4678,4682,4686,4691],{"type":606,"tag":636,"props":4670,"children":4671},{"style":648},[4672],{"type":612,"value":4673},"    time.sleep(random.uniform(",{"type":606,"tag":636,"props":4675,"children":4676},{"style":720},[4677],{"type":612,"value":2502},{"type":606,"tag":636,"props":4679,"children":4680},{"style":648},[4681],{"type":612,"value":1839},{"type":606,"tag":636,"props":4683,"children":4684},{"style":720},[4685],{"type":612,"value":1852},{"type":606,"tag":636,"props":4687,"children":4688},{"style":648},[4689],{"type":612,"value":4690},"))  ",{"type":606,"tag":636,"props":4692,"children":4693},{"style":696},[4694],{"type":612,"value":4695},"# Simulate slow operation\n",{"type":606,"tag":636,"props":4697,"children":4698},{"class":638,"line":263},[4699,4703,4707,4711,4715],{"type":606,"tag":636,"props":4700,"children":4701},{"style":642},[4702],{"type":612,"value":707},{"type":606,"tag":636,"props":4704,"children":4705},{"style":648},[4706],{"type":612,"value":712},{"type":606,"tag":636,"props":4708,"children":4709},{"style":642},[4710],{"type":612,"value":717},{"type":606,"tag":636,"props":4712,"children":4713},{"style":720},[4714],{"type":612,"value":2337},{"type":606,"tag":636,"props":4716,"children":4717},{"style":648},[4718],{"type":612,"value":856},{"type":606,"tag":636,"props":4720,"children":4721},{"class":638,"line":272},[4722,4726,4731,4735,4740],{"type":606,"tag":636,"props":4723,"children":4724},{"style":642},[4725],{"type":612,"value":741},{"type":606,"tag":636,"props":4727,"children":4728},{"style":720},[4729],{"type":612,"value":4730}," RuntimeError",{"type":606,"tag":636,"props":4732,"children":4733},{"style":648},[4734],{"type":612,"value":751},{"type":606,"tag":636,"props":4736,"children":4737},{"style":754},[4738],{"type":612,"value":4739},"\"Operation failed\"",{"type":606,"tag":636,"props":4741,"children":4742},{"style":648},[4743],{"type":612,"value":762},{"type":606,"tag":636,"props":4745,"children":4746},{"class":638,"line":281},[4747,4751],{"type":606,"tag":636,"props":4748,"children":4749},{"style":642},[4750],{"type":612,"value":770},{"type":606,"tag":636,"props":4752,"children":4753},{"style":754},[4754],{"type":612,"value":4755}," \"Operation completed\"\n",{"type":606,"tag":636,"props":4757,"children":4758},{"class":638,"line":291},[4759],{"type":606,"tag":636,"props":4760,"children":4761},{"emptyLinePlaceholder":13},[4762],{"type":612,"value":671},{"type":606,"tag":636,"props":4764,"children":4765},{"class":638,"line":302},[4766],{"type":606,"tag":636,"props":4767,"children":4768},{"style":696},[4769],{"type":612,"value":4770},"# Test retry with timeout\n",{"type":606,"tag":636,"props":4772,"children":4773},{"class":638,"line":311},[4774,4778],{"type":606,"tag":636,"props":4775,"children":4776},{"style":642},[4777],{"type":612,"value":1117},{"type":606,"tag":636,"props":4779,"children":4780},{"style":648},[4781],{"type":612,"value":856},{"type":606,"tag":636,"props":4783,"children":4784},{"class":638,"line":320},[4785,4789,4793,4798,4802,4806,4811,4815,4819,4823,4828],{"type":606,"tag":636,"props":4786,"children":4787},{"style":648},[4788],{"type":612,"value":1129},{"type":606,"tag":636,"props":4790,"children":4791},{"style":642},[4792],{"type":612,"value":805},{"type":606,"tag":636,"props":4794,"children":4795},{"style":648},[4796],{"type":612,"value":4797}," retry_with_timeout(slow_operation, ",{"type":606,"tag":636,"props":4799,"children":4800},{"style":1823},[4801],{"type":612,"value":1826},{"type":606,"tag":636,"props":4803,"children":4804},{"style":642},[4805],{"type":612,"value":805},{"type":606,"tag":636,"props":4807,"children":4808},{"style":720},[4809],{"type":612,"value":4810},"5",{"type":606,"tag":636,"props":4812,"children":4813},{"style":648},[4814],{"type":612,"value":1839},{"type":606,"tag":636,"props":4816,"children":4817},{"style":1823},[4818],{"type":612,"value":4375},{"type":606,"tag":636,"props":4820,"children":4821},{"style":642},[4822],{"type":612,"value":805},{"type":606,"tag":636,"props":4824,"children":4825},{"style":720},[4826],{"type":612,"value":4827},"8",{"type":606,"tag":636,"props":4829,"children":4830},{"style":648},[4831],{"type":612,"value":762},{"type":606,"tag":636,"props":4833,"children":4834},{"class":638,"line":329},[4835,4839,4843,4847,4851,4855,4859,4863,4867],{"type":606,"tag":636,"props":4836,"children":4837},{"style":720},[4838],{"type":612,"value":1146},{"type":606,"tag":636,"props":4840,"children":4841},{"style":648},[4842],{"type":612,"value":751},{"type":606,"tag":636,"props":4844,"children":4845},{"style":642},[4846],{"type":612,"value":890},{"type":606,"tag":636,"props":4848,"children":4849},{"style":754},[4850],{"type":612,"value":3232},{"type":606,"tag":636,"props":4852,"children":4853},{"style":720},[4854],{"type":612,"value":900},{"type":606,"tag":636,"props":4856,"children":4857},{"style":648},[4858],{"type":612,"value":1168},{"type":606,"tag":636,"props":4860,"children":4861},{"style":720},[4862],{"type":612,"value":1014},{"type":606,"tag":636,"props":4864,"children":4865},{"style":754},[4866],{"type":612,"value":920},{"type":606,"tag":636,"props":4868,"children":4869},{"style":648},[4870],{"type":612,"value":762},{"type":606,"tag":636,"props":4872,"children":4873},{"class":638,"line":338},[4874,4878,4882,4886],{"type":606,"tag":636,"props":4875,"children":4876},{"style":642},[4877],{"type":612,"value":1188},{"type":606,"tag":636,"props":4879,"children":4880},{"style":720},[4881],{"type":612,"value":1463},{"type":606,"tag":636,"props":4883,"children":4884},{"style":642},[4885],{"type":612,"value":954},{"type":606,"tag":636,"props":4887,"children":4888},{"style":648},[4889],{"type":612,"value":959},{"type":606,"tag":636,"props":4891,"children":4892},{"class":638,"line":347},[4893,4897,4901,4905,4909,4913,4917,4921,4925],{"type":606,"tag":636,"props":4894,"children":4895},{"style":720},[4896],{"type":612,"value":1146},{"type":606,"tag":636,"props":4898,"children":4899},{"style":648},[4900],{"type":612,"value":751},{"type":606,"tag":636,"props":4902,"children":4903},{"style":642},[4904],{"type":612,"value":890},{"type":606,"tag":636,"props":4906,"children":4907},{"style":754},[4908],{"type":612,"value":3291},{"type":606,"tag":636,"props":4910,"children":4911},{"style":720},[4912],{"type":612,"value":900},{"type":606,"tag":636,"props":4914,"children":4915},{"style":648},[4916],{"type":612,"value":1009},{"type":606,"tag":636,"props":4918,"children":4919},{"style":720},[4920],{"type":612,"value":1014},{"type":606,"tag":636,"props":4922,"children":4923},{"style":754},[4924],{"type":612,"value":920},{"type":606,"tag":636,"props":4926,"children":4927},{"style":648},[4928],{"type":612,"value":762},{"type":606,"tag":1322,"props":4930,"children":4932},{"id":4931},"circuit-breaker-pattern",[4933],{"type":612,"value":4934},"Circuit Breaker Pattern",{"type":606,"tag":621,"props":4936,"children":4937},{},[4938],{"type":606,"tag":625,"props":4939,"children":4941},{"className":627,"code":4940,"language":629,"meta":8,"style":8},"import time\n\nclass CircuitBreaker:\n    def __init__(self, failure_threshold=3, timeout=10):\n        self.failure_threshold = failure_threshold\n        self.timeout = timeout\n        self.failure_count = 0\n        self.last_failure_time = None\n        self.state = \"CLOSED\"  # CLOSED, OPEN, HALF_OPEN\n    \n    def call(self, operation):\n        if self.state == \"OPEN\":\n            if time.time() - self.last_failure_time > self.timeout:\n                self.state = \"HALF_OPEN\"\n                print(\"Circuit breaker: Attempting half-open\")\n            else:\n                raise RuntimeError(\"Circuit breaker is OPEN\")\n        \n        try:\n            result = operation()\n            if self.state == \"HALF_OPEN\":\n                self.state = \"CLOSED\"\n                self.failure_count = 0\n                print(\"Circuit breaker: Reset to CLOSED\")\n            return result\n        \n        except Exception as e:\n            self.failure_count += 1\n            self.last_failure_time = time.time()\n            \n            if self.failure_count >= self.failure_threshold:\n                self.state = \"OPEN\"\n                print(f\"Circuit breaker: OPENED after {self.failure_count} failures\")\n            \n            raise\n\ndef unreliable_service():\n    import random\n    if random.random() \u003C 0.9:  # 90% failure rate\n        raise ConnectionError(\"Service unavailable\")\n    return \"Service response\"\n\n# Test circuit breaker\ncircuit_breaker = CircuitBreaker(failure_threshold=2, timeout=5)\n\nfor i in range(6):\n    try:\n        result = circuit_breaker.call(unreliable_service)\n        print(f\"Call {i+1}: {result}\")\n    except Exception as e:\n        print(f\"Call {i+1} failed: {e}\")\n    \n    time.sleep(1)\n",[4942],{"type":606,"tag":632,"props":4943,"children":4944},{"__ignoreMap":8},[4945,4956,4963,4980,5021,5043,5064,5085,5106,5132,5139,5156,5185,5221,5242,5262,5274,5298,5305,5316,5331,5359,5379,5398,5418,5429,5436,5455,5477,5496,5503,5532,5552,5595,5602,5610,5617,5633,5644,5673,5697,5709,5716,5724,5774,5781,5815,5827,5844,5907,5927,5986,5993],{"type":606,"tag":636,"props":4946,"children":4947},{"class":638,"line":12},[4948,4952],{"type":606,"tag":636,"props":4949,"children":4950},{"style":642},[4951],{"type":612,"value":645},{"type":606,"tag":636,"props":4953,"children":4954},{"style":648},[4955],{"type":612,"value":651},{"type":606,"tag":636,"props":4957,"children":4958},{"class":638,"line":27},[4959],{"type":606,"tag":636,"props":4960,"children":4961},{"emptyLinePlaceholder":13},[4962],{"type":612,"value":671},{"type":606,"tag":636,"props":4964,"children":4965},{"class":638,"line":36},[4966,4971,4976],{"type":606,"tag":636,"props":4967,"children":4968},{"style":642},[4969],{"type":612,"value":4970},"class",{"type":606,"tag":636,"props":4972,"children":4973},{"style":682},[4974],{"type":612,"value":4975}," CircuitBreaker",{"type":606,"tag":636,"props":4977,"children":4978},{"style":648},[4979],{"type":612,"value":856},{"type":606,"tag":636,"props":4981,"children":4982},{"class":638,"line":45},[4983,4987,4992,4997,5001,5005,5009,5013,5017],{"type":606,"tag":636,"props":4984,"children":4985},{"style":642},[4986],{"type":612,"value":3546},{"type":606,"tag":636,"props":4988,"children":4989},{"style":720},[4990],{"type":612,"value":4991}," __init__",{"type":606,"tag":636,"props":4993,"children":4994},{"style":648},[4995],{"type":612,"value":4996},"(self, failure_threshold",{"type":606,"tag":636,"props":4998,"children":4999},{"style":642},[5000],{"type":612,"value":805},{"type":606,"tag":636,"props":5002,"children":5003},{"style":720},[5004],{"type":612,"value":810},{"type":606,"tag":636,"props":5006,"children":5007},{"style":648},[5008],{"type":612,"value":4234},{"type":606,"tag":636,"props":5010,"children":5011},{"style":642},[5012],{"type":612,"value":805},{"type":606,"tag":636,"props":5014,"children":5015},{"style":720},[5016],{"type":612,"value":4243},{"type":606,"tag":636,"props":5018,"children":5019},{"style":648},[5020],{"type":612,"value":815},{"type":606,"tag":636,"props":5022,"children":5023},{"class":638,"line":54},[5024,5029,5034,5038],{"type":606,"tag":636,"props":5025,"children":5026},{"style":720},[5027],{"type":612,"value":5028},"        self",{"type":606,"tag":636,"props":5030,"children":5031},{"style":648},[5032],{"type":612,"value":5033},".failure_threshold ",{"type":606,"tag":636,"props":5035,"children":5036},{"style":642},[5037],{"type":612,"value":805},{"type":606,"tag":636,"props":5039,"children":5040},{"style":648},[5041],{"type":612,"value":5042}," failure_threshold\n",{"type":606,"tag":636,"props":5044,"children":5045},{"class":638,"line":63},[5046,5050,5055,5059],{"type":606,"tag":636,"props":5047,"children":5048},{"style":720},[5049],{"type":612,"value":5028},{"type":606,"tag":636,"props":5051,"children":5052},{"style":648},[5053],{"type":612,"value":5054},".timeout ",{"type":606,"tag":636,"props":5056,"children":5057},{"style":642},[5058],{"type":612,"value":805},{"type":606,"tag":636,"props":5060,"children":5061},{"style":648},[5062],{"type":612,"value":5063}," timeout\n",{"type":606,"tag":636,"props":5065,"children":5066},{"class":638,"line":72},[5067,5071,5076,5080],{"type":606,"tag":636,"props":5068,"children":5069},{"style":720},[5070],{"type":612,"value":5028},{"type":606,"tag":636,"props":5072,"children":5073},{"style":648},[5074],{"type":612,"value":5075},".failure_count ",{"type":606,"tag":636,"props":5077,"children":5078},{"style":642},[5079],{"type":612,"value":805},{"type":606,"tag":636,"props":5081,"children":5082},{"style":720},[5083],{"type":612,"value":5084}," 0\n",{"type":606,"tag":636,"props":5086,"children":5087},{"class":638,"line":81},[5088,5092,5097,5101],{"type":606,"tag":636,"props":5089,"children":5090},{"style":720},[5091],{"type":612,"value":5028},{"type":606,"tag":636,"props":5093,"children":5094},{"style":648},[5095],{"type":612,"value":5096},".last_failure_time ",{"type":606,"tag":636,"props":5098,"children":5099},{"style":642},[5100],{"type":612,"value":805},{"type":606,"tag":636,"props":5102,"children":5103},{"style":720},[5104],{"type":612,"value":5105}," None\n",{"type":606,"tag":636,"props":5107,"children":5108},{"class":638,"line":778},[5109,5113,5118,5122,5127],{"type":606,"tag":636,"props":5110,"children":5111},{"style":720},[5112],{"type":612,"value":5028},{"type":606,"tag":636,"props":5114,"children":5115},{"style":648},[5116],{"type":612,"value":5117},".state ",{"type":606,"tag":636,"props":5119,"children":5120},{"style":642},[5121],{"type":612,"value":805},{"type":606,"tag":636,"props":5123,"children":5124},{"style":754},[5125],{"type":612,"value":5126}," \"CLOSED\"",{"type":606,"tag":636,"props":5128,"children":5129},{"style":696},[5130],{"type":612,"value":5131},"  # CLOSED, OPEN, HALF_OPEN\n",{"type":606,"tag":636,"props":5133,"children":5134},{"class":638,"line":99},[5135],{"type":606,"tag":636,"props":5136,"children":5137},{"style":648},[5138],{"type":612,"value":2715},{"type":606,"tag":636,"props":5140,"children":5141},{"class":638,"line":108},[5142,5146,5151],{"type":606,"tag":636,"props":5143,"children":5144},{"style":642},[5145],{"type":612,"value":3546},{"type":606,"tag":636,"props":5147,"children":5148},{"style":682},[5149],{"type":612,"value":5150}," call",{"type":606,"tag":636,"props":5152,"children":5153},{"style":648},[5154],{"type":612,"value":5155},"(self, operation):\n",{"type":606,"tag":636,"props":5157,"children":5158},{"class":638,"line":117},[5159,5163,5168,5172,5176,5181],{"type":606,"tag":636,"props":5160,"children":5161},{"style":642},[5162],{"type":612,"value":4318},{"type":606,"tag":636,"props":5164,"children":5165},{"style":720},[5166],{"type":612,"value":5167}," self",{"type":606,"tag":636,"props":5169,"children":5170},{"style":648},[5171],{"type":612,"value":5117},{"type":606,"tag":636,"props":5173,"children":5174},{"style":642},[5175],{"type":612,"value":1039},{"type":606,"tag":636,"props":5177,"children":5178},{"style":754},[5179],{"type":612,"value":5180}," \"OPEN\"",{"type":606,"tag":636,"props":5182,"children":5183},{"style":648},[5184],{"type":612,"value":856},{"type":606,"tag":636,"props":5186,"children":5187},{"class":638,"line":126},[5188,5192,5196,5200,5204,5208,5212,5216],{"type":606,"tag":636,"props":5189,"children":5190},{"style":642},[5191],{"type":612,"value":1030},{"type":606,"tag":636,"props":5193,"children":5194},{"style":648},[5195],{"type":612,"value":4323},{"type":606,"tag":636,"props":5197,"children":5198},{"style":642},[5199],{"type":612,"value":1049},{"type":606,"tag":636,"props":5201,"children":5202},{"style":720},[5203],{"type":612,"value":5167},{"type":606,"tag":636,"props":5205,"children":5206},{"style":648},[5207],{"type":612,"value":5096},{"type":606,"tag":636,"props":5209,"children":5210},{"style":642},[5211],{"type":612,"value":4337},{"type":606,"tag":636,"props":5213,"children":5214},{"style":720},[5215],{"type":612,"value":5167},{"type":606,"tag":636,"props":5217,"children":5218},{"style":648},[5219],{"type":612,"value":5220},".timeout:\n",{"type":606,"tag":636,"props":5222,"children":5223},{"class":638,"line":135},[5224,5229,5233,5237],{"type":606,"tag":636,"props":5225,"children":5226},{"style":720},[5227],{"type":612,"value":5228},"                self",{"type":606,"tag":636,"props":5230,"children":5231},{"style":648},[5232],{"type":612,"value":5117},{"type":606,"tag":636,"props":5234,"children":5235},{"style":642},[5236],{"type":612,"value":805},{"type":606,"tag":636,"props":5238,"children":5239},{"style":754},[5240],{"type":612,"value":5241}," \"HALF_OPEN\"\n",{"type":606,"tag":636,"props":5243,"children":5244},{"class":638,"line":144},[5245,5249,5253,5258],{"type":606,"tag":636,"props":5246,"children":5247},{"style":720},[5248],{"type":612,"value":1577},{"type":606,"tag":636,"props":5250,"children":5251},{"style":648},[5252],{"type":612,"value":751},{"type":606,"tag":636,"props":5254,"children":5255},{"style":754},[5256],{"type":612,"value":5257},"\"Circuit breaker: Attempting half-open\"",{"type":606,"tag":636,"props":5259,"children":5260},{"style":648},[5261],{"type":612,"value":762},{"type":606,"tag":636,"props":5263,"children":5264},{"class":638,"line":153},[5265,5270],{"type":606,"tag":636,"props":5266,"children":5267},{"style":642},[5268],{"type":612,"value":5269},"            else",{"type":606,"tag":636,"props":5271,"children":5272},{"style":648},[5273],{"type":612,"value":856},{"type":606,"tag":636,"props":5275,"children":5276},{"class":638,"line":163},[5277,5281,5285,5289,5294],{"type":606,"tag":636,"props":5278,"children":5279},{"style":642},[5280],{"type":612,"value":1066},{"type":606,"tag":636,"props":5282,"children":5283},{"style":720},[5284],{"type":612,"value":4730},{"type":606,"tag":636,"props":5286,"children":5287},{"style":648},[5288],{"type":612,"value":751},{"type":606,"tag":636,"props":5290,"children":5291},{"style":754},[5292],{"type":612,"value":5293},"\"Circuit breaker is OPEN\"",{"type":606,"tag":636,"props":5295,"children":5296},{"style":648},[5297],{"type":612,"value":762},{"type":606,"tag":636,"props":5299,"children":5300},{"class":638,"line":172},[5301],{"type":606,"tag":636,"props":5302,"children":5303},{"style":648},[5304],{"type":612,"value":4396},{"type":606,"tag":636,"props":5306,"children":5307},{"class":638,"line":181},[5308,5312],{"type":606,"tag":636,"props":5309,"children":5310},{"style":642},[5311],{"type":612,"value":851},{"type":606,"tag":636,"props":5313,"children":5314},{"style":648},[5315],{"type":612,"value":856},{"type":606,"tag":636,"props":5317,"children":5318},{"class":638,"line":190},[5319,5323,5327],{"type":606,"tag":636,"props":5320,"children":5321},{"style":648},[5322],{"type":612,"value":864},{"type":606,"tag":636,"props":5324,"children":5325},{"style":642},[5326],{"type":612,"value":805},{"type":606,"tag":636,"props":5328,"children":5329},{"style":648},[5330],{"type":612,"value":1451},{"type":606,"tag":636,"props":5332,"children":5333},{"class":638,"line":199},[5334,5338,5342,5346,5350,5355],{"type":606,"tag":636,"props":5335,"children":5336},{"style":642},[5337],{"type":612,"value":1030},{"type":606,"tag":636,"props":5339,"children":5340},{"style":720},[5341],{"type":612,"value":5167},{"type":606,"tag":636,"props":5343,"children":5344},{"style":648},[5345],{"type":612,"value":5117},{"type":606,"tag":636,"props":5347,"children":5348},{"style":642},[5349],{"type":612,"value":1039},{"type":606,"tag":636,"props":5351,"children":5352},{"style":754},[5353],{"type":612,"value":5354}," \"HALF_OPEN\"",{"type":606,"tag":636,"props":5356,"children":5357},{"style":648},[5358],{"type":612,"value":856},{"type":606,"tag":636,"props":5360,"children":5361},{"class":638,"line":208},[5362,5366,5370,5374],{"type":606,"tag":636,"props":5363,"children":5364},{"style":720},[5365],{"type":612,"value":5228},{"type":606,"tag":636,"props":5367,"children":5368},{"style":648},[5369],{"type":612,"value":5117},{"type":606,"tag":636,"props":5371,"children":5372},{"style":642},[5373],{"type":612,"value":805},{"type":606,"tag":636,"props":5375,"children":5376},{"style":754},[5377],{"type":612,"value":5378}," \"CLOSED\"\n",{"type":606,"tag":636,"props":5380,"children":5381},{"class":638,"line":217},[5382,5386,5390,5394],{"type":606,"tag":636,"props":5383,"children":5384},{"style":720},[5385],{"type":612,"value":5228},{"type":606,"tag":636,"props":5387,"children":5388},{"style":648},[5389],{"type":612,"value":5075},{"type":606,"tag":636,"props":5391,"children":5392},{"style":642},[5393],{"type":612,"value":805},{"type":606,"tag":636,"props":5395,"children":5396},{"style":720},[5397],{"type":612,"value":5084},{"type":606,"tag":636,"props":5399,"children":5400},{"class":638,"line":227},[5401,5405,5409,5414],{"type":606,"tag":636,"props":5402,"children":5403},{"style":720},[5404],{"type":612,"value":1577},{"type":606,"tag":636,"props":5406,"children":5407},{"style":648},[5408],{"type":612,"value":751},{"type":606,"tag":636,"props":5410,"children":5411},{"style":754},[5412],{"type":612,"value":5413},"\"Circuit breaker: Reset to CLOSED\"",{"type":606,"tag":636,"props":5415,"children":5416},{"style":648},[5417],{"type":612,"value":762},{"type":606,"tag":636,"props":5419,"children":5420},{"class":638,"line":236},[5421,5425],{"type":606,"tag":636,"props":5422,"children":5423},{"style":642},[5424],{"type":612,"value":932},{"type":606,"tag":636,"props":5426,"children":5427},{"style":648},[5428],{"type":612,"value":937},{"type":606,"tag":636,"props":5430,"children":5431},{"class":638,"line":245},[5432],{"type":606,"tag":636,"props":5433,"children":5434},{"style":648},[5435],{"type":612,"value":4396},{"type":606,"tag":636,"props":5437,"children":5438},{"class":638,"line":254},[5439,5443,5447,5451],{"type":606,"tag":636,"props":5440,"children":5441},{"style":642},[5442],{"type":612,"value":945},{"type":606,"tag":636,"props":5444,"children":5445},{"style":720},[5446],{"type":612,"value":1463},{"type":606,"tag":636,"props":5448,"children":5449},{"style":642},[5450],{"type":612,"value":954},{"type":606,"tag":636,"props":5452,"children":5453},{"style":648},[5454],{"type":612,"value":959},{"type":606,"tag":636,"props":5456,"children":5457},{"class":638,"line":263},[5458,5463,5467,5472],{"type":606,"tag":636,"props":5459,"children":5460},{"style":720},[5461],{"type":612,"value":5462},"            self",{"type":606,"tag":636,"props":5464,"children":5465},{"style":648},[5466],{"type":612,"value":5075},{"type":606,"tag":636,"props":5468,"children":5469},{"style":642},[5470],{"type":612,"value":5471},"+=",{"type":606,"tag":636,"props":5473,"children":5474},{"style":720},[5475],{"type":612,"value":5476}," 1\n",{"type":606,"tag":636,"props":5478,"children":5479},{"class":638,"line":272},[5480,5484,5488,5492],{"type":606,"tag":636,"props":5481,"children":5482},{"style":720},[5483],{"type":612,"value":5462},{"type":606,"tag":636,"props":5485,"children":5486},{"style":648},[5487],{"type":612,"value":5096},{"type":606,"tag":636,"props":5489,"children":5490},{"style":642},[5491],{"type":612,"value":805},{"type":606,"tag":636,"props":5493,"children":5494},{"style":648},[5495],{"type":612,"value":4272},{"type":606,"tag":636,"props":5497,"children":5498},{"class":638,"line":281},[5499],{"type":606,"tag":636,"props":5500,"children":5501},{"style":648},[5502],{"type":612,"value":1538},{"type":606,"tag":636,"props":5504,"children":5505},{"class":638,"line":291},[5506,5510,5514,5518,5523,5527],{"type":606,"tag":636,"props":5507,"children":5508},{"style":642},[5509],{"type":612,"value":1030},{"type":606,"tag":636,"props":5511,"children":5512},{"style":720},[5513],{"type":612,"value":5167},{"type":606,"tag":636,"props":5515,"children":5516},{"style":648},[5517],{"type":612,"value":5075},{"type":606,"tag":636,"props":5519,"children":5520},{"style":642},[5521],{"type":612,"value":5522},">=",{"type":606,"tag":636,"props":5524,"children":5525},{"style":720},[5526],{"type":612,"value":5167},{"type":606,"tag":636,"props":5528,"children":5529},{"style":648},[5530],{"type":612,"value":5531},".failure_threshold:\n",{"type":606,"tag":636,"props":5533,"children":5534},{"class":638,"line":302},[5535,5539,5543,5547],{"type":606,"tag":636,"props":5536,"children":5537},{"style":720},[5538],{"type":612,"value":5228},{"type":606,"tag":636,"props":5540,"children":5541},{"style":648},[5542],{"type":612,"value":5117},{"type":606,"tag":636,"props":5544,"children":5545},{"style":642},[5546],{"type":612,"value":805},{"type":606,"tag":636,"props":5548,"children":5549},{"style":754},[5550],{"type":612,"value":5551}," \"OPEN\"\n",{"type":606,"tag":636,"props":5553,"children":5554},{"class":638,"line":311},[5555,5559,5563,5567,5572,5577,5582,5586,5591],{"type":606,"tag":636,"props":5556,"children":5557},{"style":720},[5558],{"type":612,"value":1577},{"type":606,"tag":636,"props":5560,"children":5561},{"style":648},[5562],{"type":612,"value":751},{"type":606,"tag":636,"props":5564,"children":5565},{"style":642},[5566],{"type":612,"value":890},{"type":606,"tag":636,"props":5568,"children":5569},{"style":754},[5570],{"type":612,"value":5571},"\"Circuit breaker: OPENED after ",{"type":606,"tag":636,"props":5573,"children":5574},{"style":720},[5575],{"type":612,"value":5576},"{self",{"type":606,"tag":636,"props":5578,"children":5579},{"style":648},[5580],{"type":612,"value":5581},".failure_count",{"type":606,"tag":636,"props":5583,"children":5584},{"style":720},[5585],{"type":612,"value":1014},{"type":606,"tag":636,"props":5587,"children":5588},{"style":754},[5589],{"type":612,"value":5590}," failures\"",{"type":606,"tag":636,"props":5592,"children":5593},{"style":648},[5594],{"type":612,"value":762},{"type":606,"tag":636,"props":5596,"children":5597},{"class":638,"line":320},[5598],{"type":606,"tag":636,"props":5599,"children":5600},{"style":648},[5601],{"type":612,"value":1538},{"type":606,"tag":636,"props":5603,"children":5604},{"class":638,"line":329},[5605],{"type":606,"tag":636,"props":5606,"children":5607},{"style":642},[5608],{"type":612,"value":5609},"            raise\n",{"type":606,"tag":636,"props":5611,"children":5612},{"class":638,"line":338},[5613],{"type":606,"tag":636,"props":5614,"children":5615},{"emptyLinePlaceholder":13},[5616],{"type":612,"value":671},{"type":606,"tag":636,"props":5618,"children":5619},{"class":638,"line":347},[5620,5624,5629],{"type":606,"tag":636,"props":5621,"children":5622},{"style":642},[5623],{"type":612,"value":679},{"type":606,"tag":636,"props":5625,"children":5626},{"style":682},[5627],{"type":612,"value":5628}," unreliable_service",{"type":606,"tag":636,"props":5630,"children":5631},{"style":648},[5632],{"type":612,"value":690},{"type":606,"tag":636,"props":5634,"children":5635},{"class":638,"line":356},[5636,5640],{"type":606,"tag":636,"props":5637,"children":5638},{"style":642},[5639],{"type":612,"value":1694},{"type":606,"tag":636,"props":5641,"children":5642},{"style":648},[5643],{"type":612,"value":663},{"type":606,"tag":636,"props":5645,"children":5646},{"class":638,"line":367},[5647,5651,5655,5659,5664,5668],{"type":606,"tag":636,"props":5648,"children":5649},{"style":642},[5650],{"type":612,"value":707},{"type":606,"tag":636,"props":5652,"children":5653},{"style":648},[5654],{"type":612,"value":712},{"type":606,"tag":636,"props":5656,"children":5657},{"style":642},[5658],{"type":612,"value":717},{"type":606,"tag":636,"props":5660,"children":5661},{"style":720},[5662],{"type":612,"value":5663}," 0.9",{"type":606,"tag":636,"props":5665,"children":5666},{"style":648},[5667],{"type":612,"value":728},{"type":606,"tag":636,"props":5669,"children":5670},{"style":696},[5671],{"type":612,"value":5672},"# 90% failure rate\n",{"type":606,"tag":636,"props":5674,"children":5675},{"class":638,"line":376},[5676,5680,5684,5688,5693],{"type":606,"tag":636,"props":5677,"children":5678},{"style":642},[5679],{"type":612,"value":741},{"type":606,"tag":636,"props":5681,"children":5682},{"style":720},[5683],{"type":612,"value":746},{"type":606,"tag":636,"props":5685,"children":5686},{"style":648},[5687],{"type":612,"value":751},{"type":606,"tag":636,"props":5689,"children":5690},{"style":754},[5691],{"type":612,"value":5692},"\"Service unavailable\"",{"type":606,"tag":636,"props":5694,"children":5695},{"style":648},[5696],{"type":612,"value":762},{"type":606,"tag":636,"props":5698,"children":5699},{"class":638,"line":385},[5700,5704],{"type":606,"tag":636,"props":5701,"children":5702},{"style":642},[5703],{"type":612,"value":770},{"type":606,"tag":636,"props":5705,"children":5706},{"style":754},[5707],{"type":612,"value":5708}," \"Service response\"\n",{"type":606,"tag":636,"props":5710,"children":5711},{"class":638,"line":394},[5712],{"type":606,"tag":636,"props":5713,"children":5714},{"emptyLinePlaceholder":13},[5715],{"type":612,"value":671},{"type":606,"tag":636,"props":5717,"children":5718},{"class":638,"line":403},[5719],{"type":606,"tag":636,"props":5720,"children":5721},{"style":696},[5722],{"type":612,"value":5723},"# Test circuit breaker\n",{"type":606,"tag":636,"props":5725,"children":5726},{"class":638,"line":412},[5727,5732,5736,5741,5746,5750,5754,5758,5762,5766,5770],{"type":606,"tag":636,"props":5728,"children":5729},{"style":648},[5730],{"type":612,"value":5731},"circuit_breaker ",{"type":606,"tag":636,"props":5733,"children":5734},{"style":642},[5735],{"type":612,"value":805},{"type":606,"tag":636,"props":5737,"children":5738},{"style":648},[5739],{"type":612,"value":5740}," CircuitBreaker(",{"type":606,"tag":636,"props":5742,"children":5743},{"style":1823},[5744],{"type":612,"value":5745},"failure_threshold",{"type":606,"tag":636,"props":5747,"children":5748},{"style":642},[5749],{"type":612,"value":805},{"type":606,"tag":636,"props":5751,"children":5752},{"style":720},[5753],{"type":612,"value":1852},{"type":606,"tag":636,"props":5755,"children":5756},{"style":648},[5757],{"type":612,"value":1839},{"type":606,"tag":636,"props":5759,"children":5760},{"style":1823},[5761],{"type":612,"value":4375},{"type":606,"tag":636,"props":5763,"children":5764},{"style":642},[5765],{"type":612,"value":805},{"type":606,"tag":636,"props":5767,"children":5768},{"style":720},[5769],{"type":612,"value":4810},{"type":606,"tag":636,"props":5771,"children":5772},{"style":648},[5773],{"type":612,"value":762},{"type":606,"tag":636,"props":5775,"children":5776},{"class":638,"line":423},[5777],{"type":606,"tag":636,"props":5778,"children":5779},{"emptyLinePlaceholder":13},[5780],{"type":612,"value":671},{"type":606,"tag":636,"props":5782,"children":5783},{"class":638,"line":432},[5784,5789,5794,5798,5802,5806,5811],{"type":606,"tag":636,"props":5785,"children":5786},{"style":642},[5787],{"type":612,"value":5788},"for",{"type":606,"tag":636,"props":5790,"children":5791},{"style":648},[5792],{"type":612,"value":5793}," i ",{"type":606,"tag":636,"props":5795,"children":5796},{"style":642},[5797],{"type":612,"value":833},{"type":606,"tag":636,"props":5799,"children":5800},{"style":720},[5801],{"type":612,"value":838},{"type":606,"tag":636,"props":5803,"children":5804},{"style":648},[5805],{"type":612,"value":751},{"type":606,"tag":636,"props":5807,"children":5808},{"style":720},[5809],{"type":612,"value":5810},"6",{"type":606,"tag":636,"props":5812,"children":5813},{"style":648},[5814],{"type":612,"value":815},{"type":606,"tag":636,"props":5816,"children":5817},{"class":638,"line":441},[5818,5823],{"type":606,"tag":636,"props":5819,"children":5820},{"style":642},[5821],{"type":612,"value":5822},"    try",{"type":606,"tag":636,"props":5824,"children":5825},{"style":648},[5826],{"type":612,"value":856},{"type":606,"tag":636,"props":5828,"children":5829},{"class":638,"line":450},[5830,5835,5839],{"type":606,"tag":636,"props":5831,"children":5832},{"style":648},[5833],{"type":612,"value":5834},"        result ",{"type":606,"tag":636,"props":5836,"children":5837},{"style":642},[5838],{"type":612,"value":805},{"type":606,"tag":636,"props":5840,"children":5841},{"style":648},[5842],{"type":612,"value":5843}," circuit_breaker.call(unreliable_service)\n",{"type":606,"tag":636,"props":5845,"children":5846},{"class":638,"line":459},[5847,5852,5856,5860,5865,5869,5874,5878,5883,5887,5891,5895,5899,5903],{"type":606,"tag":636,"props":5848,"children":5849},{"style":720},[5850],{"type":612,"value":5851},"        print",{"type":606,"tag":636,"props":5853,"children":5854},{"style":648},[5855],{"type":612,"value":751},{"type":606,"tag":636,"props":5857,"children":5858},{"style":642},[5859],{"type":612,"value":890},{"type":606,"tag":636,"props":5861,"children":5862},{"style":754},[5863],{"type":612,"value":5864},"\"Call ",{"type":606,"tag":636,"props":5866,"children":5867},{"style":720},[5868],{"type":612,"value":900},{"type":606,"tag":636,"props":5870,"children":5871},{"style":648},[5872],{"type":612,"value":5873},"i",{"type":606,"tag":636,"props":5875,"children":5876},{"style":642},[5877],{"type":612,"value":910},{"type":606,"tag":636,"props":5879,"children":5880},{"style":720},[5881],{"type":612,"value":5882},"1}",{"type":606,"tag":636,"props":5884,"children":5885},{"style":754},[5886],{"type":612,"value":1768},{"type":606,"tag":636,"props":5888,"children":5889},{"style":720},[5890],{"type":612,"value":900},{"type":606,"tag":636,"props":5892,"children":5893},{"style":648},[5894],{"type":612,"value":1168},{"type":606,"tag":636,"props":5896,"children":5897},{"style":720},[5898],{"type":612,"value":1014},{"type":606,"tag":636,"props":5900,"children":5901},{"style":754},[5902],{"type":612,"value":920},{"type":606,"tag":636,"props":5904,"children":5905},{"style":648},[5906],{"type":612,"value":762},{"type":606,"tag":636,"props":5908,"children":5909},{"class":638,"line":468},[5910,5915,5919,5923],{"type":606,"tag":636,"props":5911,"children":5912},{"style":642},[5913],{"type":612,"value":5914},"    except",{"type":606,"tag":636,"props":5916,"children":5917},{"style":720},[5918],{"type":612,"value":1463},{"type":606,"tag":636,"props":5920,"children":5921},{"style":642},[5922],{"type":612,"value":954},{"type":606,"tag":636,"props":5924,"children":5925},{"style":648},[5926],{"type":612,"value":959},{"type":606,"tag":636,"props":5928,"children":5929},{"class":638,"line":477},[5930,5934,5938,5942,5946,5950,5954,5958,5962,5966,5970,5974,5978,5982],{"type":606,"tag":636,"props":5931,"children":5932},{"style":720},[5933],{"type":612,"value":5851},{"type":606,"tag":636,"props":5935,"children":5936},{"style":648},[5937],{"type":612,"value":751},{"type":606,"tag":636,"props":5939,"children":5940},{"style":642},[5941],{"type":612,"value":890},{"type":606,"tag":636,"props":5943,"children":5944},{"style":754},[5945],{"type":612,"value":5864},{"type":606,"tag":636,"props":5947,"children":5948},{"style":720},[5949],{"type":612,"value":900},{"type":606,"tag":636,"props":5951,"children":5952},{"style":648},[5953],{"type":612,"value":5873},{"type":606,"tag":636,"props":5955,"children":5956},{"style":642},[5957],{"type":612,"value":910},{"type":606,"tag":636,"props":5959,"children":5960},{"style":720},[5961],{"type":612,"value":5882},{"type":606,"tag":636,"props":5963,"children":5964},{"style":754},[5965],{"type":612,"value":1000},{"type":606,"tag":636,"props":5967,"children":5968},{"style":720},[5969],{"type":612,"value":900},{"type":606,"tag":636,"props":5971,"children":5972},{"style":648},[5973],{"type":612,"value":1009},{"type":606,"tag":636,"props":5975,"children":5976},{"style":720},[5977],{"type":612,"value":1014},{"type":606,"tag":636,"props":5979,"children":5980},{"style":754},[5981],{"type":612,"value":920},{"type":606,"tag":636,"props":5983,"children":5984},{"style":648},[5985],{"type":612,"value":762},{"type":606,"tag":636,"props":5987,"children":5988},{"class":638,"line":488},[5989],{"type":606,"tag":636,"props":5990,"children":5991},{"style":648},[5992],{"type":612,"value":2715},{"type":606,"tag":636,"props":5994,"children":5995},{"class":638,"line":497},[5996,6001,6005],{"type":606,"tag":636,"props":5997,"children":5998},{"style":648},[5999],{"type":612,"value":6000},"    time.sleep(",{"type":606,"tag":636,"props":6002,"children":6003},{"style":720},[6004],{"type":612,"value":1084},{"type":606,"tag":636,"props":6006,"children":6007},{"style":648},[6008],{"type":612,"value":762},{"type":606,"tag":1218,"props":6010,"children":6012},{"id":6011},"retry-configuration-guide",[6013],{"type":612,"value":6014},"📊 Retry Configuration Guide",{"type":606,"tag":1322,"props":6016,"children":6018},{"id":6017},"retry-parameters",[6019],{"type":612,"value":6020},"Retry Parameters",{"type":606,"tag":3319,"props":6022,"children":6023},{},[6024,6045],{"type":606,"tag":3323,"props":6025,"children":6026},{},[6027],{"type":606,"tag":3327,"props":6028,"children":6029},{},[6030,6035,6040],{"type":606,"tag":3331,"props":6031,"children":6032},{},[6033],{"type":612,"value":6034},"Parameter",{"type":606,"tag":3331,"props":6036,"children":6037},{},[6038],{"type":612,"value":6039},"Purpose",{"type":606,"tag":3331,"props":6041,"children":6042},{},[6043],{"type":612,"value":6044},"Typical Values",{"type":606,"tag":3347,"props":6046,"children":6047},{},[6048,6069,6090,6112],{"type":606,"tag":3327,"props":6049,"children":6050},{},[6051,6059,6064],{"type":606,"tag":3354,"props":6052,"children":6053},{},[6054],{"type":606,"tag":632,"props":6055,"children":6057},{"className":6056},[],[6058],{"type":612,"value":1826},{"type":606,"tag":3354,"props":6060,"children":6061},{},[6062],{"type":612,"value":6063},"Maximum retry count",{"type":606,"tag":3354,"props":6065,"children":6066},{},[6067],{"type":612,"value":6068},"3-5 for most operations",{"type":606,"tag":3327,"props":6070,"children":6071},{},[6072,6080,6085],{"type":606,"tag":3354,"props":6073,"children":6074},{},[6075],{"type":606,"tag":632,"props":6076,"children":6078},{"className":6077},[],[6079],{"type":612,"value":2493},{"type":606,"tag":3354,"props":6081,"children":6082},{},[6083],{"type":612,"value":6084},"Initial delay",{"type":606,"tag":3354,"props":6086,"children":6087},{},[6088],{"type":612,"value":6089},"0.5-2 seconds",{"type":606,"tag":3327,"props":6091,"children":6092},{},[6093,6102,6107],{"type":606,"tag":3354,"props":6094,"children":6095},{},[6096],{"type":606,"tag":632,"props":6097,"children":6099},{"className":6098},[],[6100],{"type":612,"value":6101},"max_delay",{"type":606,"tag":3354,"props":6103,"children":6104},{},[6105],{"type":612,"value":6106},"Maximum delay",{"type":606,"tag":3354,"props":6108,"children":6109},{},[6110],{"type":612,"value":6111},"30-60 seconds",{"type":606,"tag":3327,"props":6113,"children":6114},{},[6115,6123,6128],{"type":606,"tag":3354,"props":6116,"children":6117},{},[6118],{"type":606,"tag":632,"props":6119,"children":6121},{"className":6120},[],[6122],{"type":612,"value":4375},{"type":606,"tag":3354,"props":6124,"children":6125},{},[6126],{"type":612,"value":6127},"Overall timeout",{"type":606,"tag":3354,"props":6129,"children":6130},{},[6131],{"type":612,"value":6132},"30-300 seconds",{"type":606,"tag":1322,"props":6134,"children":6136},{"id":6135},"exception-categories",[6137],{"type":612,"value":6138},"Exception Categories",{"type":606,"tag":3319,"props":6140,"children":6141},{},[6142,6163],{"type":606,"tag":3323,"props":6143,"children":6144},{},[6145],{"type":606,"tag":3327,"props":6146,"children":6147},{},[6148,6153,6158],{"type":606,"tag":3331,"props":6149,"children":6150},{},[6151],{"type":612,"value":6152},"Category",{"type":606,"tag":3331,"props":6154,"children":6155},{},[6156],{"type":612,"value":6157},"Examples",{"type":606,"tag":3331,"props":6159,"children":6160},{},[6161],{"type":612,"value":6162},"Retry Strategy",{"type":606,"tag":3347,"props":6164,"children":6165},{},[6166,6193,6215,6237],{"type":606,"tag":3327,"props":6167,"children":6168},{},[6169,6174,6188],{"type":606,"tag":3354,"props":6170,"children":6171},{},[6172],{"type":612,"value":6173},"Transient",{"type":606,"tag":3354,"props":6175,"children":6176},{},[6177,6182,6183],{"type":606,"tag":632,"props":6178,"children":6180},{"className":6179},[],[6181],{"type":612,"value":2694},{"type":612,"value":1839},{"type":606,"tag":632,"props":6184,"children":6186},{"className":6185},[],[6187],{"type":612,"value":2703},{"type":606,"tag":3354,"props":6189,"children":6190},{},[6191],{"type":612,"value":6192},"Retry with backoff",{"type":606,"tag":3327,"props":6194,"children":6195},{},[6196,6201,6210],{"type":606,"tag":3354,"props":6197,"children":6198},{},[6199],{"type":612,"value":6200},"Rate Limiting",{"type":606,"tag":3354,"props":6202,"children":6203},{},[6204],{"type":606,"tag":632,"props":6205,"children":6207},{"className":6206},[],[6208],{"type":612,"value":6209},"HTTP 429",{"type":606,"tag":3354,"props":6211,"children":6212},{},[6213],{"type":612,"value":6214},"Exponential backoff",{"type":606,"tag":3327,"props":6216,"children":6217},{},[6218,6223,6232],{"type":606,"tag":3354,"props":6219,"children":6220},{},[6221],{"type":612,"value":6222},"Server Errors",{"type":606,"tag":3354,"props":6224,"children":6225},{},[6226],{"type":606,"tag":632,"props":6227,"children":6229},{"className":6228},[],[6230],{"type":612,"value":6231},"HTTP 5xx",{"type":606,"tag":3354,"props":6233,"children":6234},{},[6235],{"type":612,"value":6236},"Limited retries",{"type":606,"tag":3327,"props":6238,"children":6239},{},[6240,6245,6261],{"type":606,"tag":3354,"props":6241,"children":6242},{},[6243],{"type":612,"value":6244},"Client Errors",{"type":606,"tag":3354,"props":6246,"children":6247},{},[6248,6254,6255],{"type":606,"tag":632,"props":6249,"children":6251},{"className":6250},[],[6252],{"type":612,"value":6253},"HTTP 4xx",{"type":612,"value":1839},{"type":606,"tag":632,"props":6256,"children":6258},{"className":6257},[],[6259],{"type":612,"value":6260},"ValueError",{"type":606,"tag":3354,"props":6262,"children":6263},{},[6264],{"type":612,"value":6265},"Don't retry",{"type":606,"tag":1218,"props":6267,"children":6269},{"id":6268},"key-takeaways",[6270],{"type":612,"value":6271},"🎯 Key Takeaways",{"type":606,"tag":1230,"props":6273,"children":6277},{"emoji":6274,"title":6275,"type":6276},"📚","Retry Logic Essentials","success",[6278,6286,6309,6317,6340,6348,6371,6379,6402],{"type":606,"tag":615,"props":6279,"children":6280},{},[6281],{"type":606,"tag":1240,"props":6282,"children":6283},{},[6284],{"type":612,"value":6285},"Basic Concepts:",{"type":606,"tag":1246,"props":6287,"children":6288},{},[6289,6294,6299,6304],{"type":606,"tag":1250,"props":6290,"children":6291},{},[6292],{"type":612,"value":6293},"Retry temporary failures automatically",{"type":606,"tag":1250,"props":6295,"children":6296},{},[6297],{"type":612,"value":6298},"Use appropriate delays between attempts",{"type":606,"tag":1250,"props":6300,"children":6301},{},[6302],{"type":612,"value":6303},"Limit maximum retry attempts",{"type":606,"tag":1250,"props":6305,"children":6306},{},[6307],{"type":612,"value":6308},"Handle different exception types differently",{"type":606,"tag":615,"props":6310,"children":6311},{},[6312],{"type":606,"tag":1240,"props":6313,"children":6314},{},[6315],{"type":612,"value":6316},"Retry Strategies:",{"type":606,"tag":1246,"props":6318,"children":6319},{},[6320,6325,6330,6335],{"type":606,"tag":1250,"props":6321,"children":6322},{},[6323],{"type":612,"value":6324},"Fixed delay: Simple, predictable",{"type":606,"tag":1250,"props":6326,"children":6327},{},[6328],{"type":612,"value":6329},"Exponential backoff: Reduces load on failing systems",{"type":606,"tag":1250,"props":6331,"children":6332},{},[6333],{"type":612,"value":6334},"Circuit breaker: Prevents cascade failures",{"type":606,"tag":1250,"props":6336,"children":6337},{},[6338],{"type":612,"value":6339},"Conditional retry: Only retry appropriate errors",{"type":606,"tag":615,"props":6341,"children":6342},{},[6343],{"type":606,"tag":1240,"props":6344,"children":6345},{},[6346],{"type":612,"value":6347},"Best Practices:",{"type":606,"tag":1246,"props":6349,"children":6350},{},[6351,6356,6361,6366],{"type":606,"tag":1250,"props":6352,"children":6353},{},[6354],{"type":612,"value":6355},"Set reasonable timeout limits",{"type":606,"tag":1250,"props":6357,"children":6358},{},[6359],{"type":612,"value":6360},"Log retry attempts for debugging",{"type":606,"tag":1250,"props":6362,"children":6363},{},[6364],{"type":612,"value":6365},"Don't retry non-transient errors",{"type":606,"tag":1250,"props":6367,"children":6368},{},[6369],{"type":612,"value":6370},"Consider impact on system load",{"type":606,"tag":615,"props":6372,"children":6373},{},[6374],{"type":606,"tag":1240,"props":6375,"children":6376},{},[6377],{"type":612,"value":6378},"Common Use Cases:",{"type":606,"tag":1246,"props":6380,"children":6381},{},[6382,6387,6392,6397],{"type":606,"tag":1250,"props":6383,"children":6384},{},[6385],{"type":612,"value":6386},"Network requests and API calls",{"type":606,"tag":1250,"props":6388,"children":6389},{},[6390],{"type":612,"value":6391},"Database connection attempts",{"type":606,"tag":1250,"props":6393,"children":6394},{},[6395],{"type":612,"value":6396},"File system operations",{"type":606,"tag":1250,"props":6398,"children":6399},{},[6400],{"type":612,"value":6401},"External service integration",{"type":606,"tag":615,"props":6403,"children":6404},{},[6405,6410],{"type":606,"tag":1240,"props":6406,"children":6407},{},[6408],{"type":612,"value":6409},"Remember:",{"type":612,"value":6411}," Retry logic improves resilience but should be used thoughtfully!",{"type":606,"tag":1218,"props":6413,"children":6415},{"id":6414},"whats-next",[6416],{"type":612,"value":6417},"🚀 What's Next?",{"type":606,"tag":615,"props":6419,"children":6420},{},[6421],{"type":612,"value":6422},"Congratulations! You've mastered Python's error handling techniques. You're now ready to explore functions and modules for better code organization.",{"type":606,"tag":615,"props":6424,"children":6425},{},[6426,6431,6432,6437],{"type":606,"tag":1240,"props":6427,"children":6428},{},[6429],{"type":612,"value":6430},"Continue to",{"type":612,"value":1768},{"type":606,"tag":6433,"props":6434,"children":6435},"a",{"href":408},[6436],{"type":612,"value":409},{"type":612,"value":6438}," to learn about code organization and reusability.",{"type":606,"tag":6440,"props":6441,"children":6442},"style",{},[6443],{"type":612,"value":6444},"html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .app-dark-mode .shiki span {color: var(--shiki-app-dark-mode);background: var(--shiki-app-dark-mode-bg);font-style: var(--shiki-app-dark-mode-font-style);font-weight: var(--shiki-app-dark-mode-font-weight);text-decoration: var(--shiki-app-dark-mode-text-decoration);}html.app-dark-mode .shiki span {color: var(--shiki-app-dark-mode);background: var(--shiki-app-dark-mode-bg);font-style: var(--shiki-app-dark-mode-font-style);font-weight: var(--shiki-app-dark-mode-font-weight);text-decoration: var(--shiki-app-dark-mode-text-decoration);}",{"title":8,"searchDepth":36,"depth":36,"links":6446},[6447,6452,6453,6458,6462,6463],{"id":1220,"depth":27,"text":1223,"children":6448},[6449,6450,6451],{"id":1324,"depth":36,"text":1327},{"id":1934,"depth":36,"text":1267},{"id":2584,"depth":36,"text":2587},{"id":3314,"depth":27,"text":3317},{"id":3422,"depth":27,"text":3425,"children":6454},[6455,6456,6457],{"id":3428,"depth":36,"text":3431},{"id":4174,"depth":36,"text":4177},{"id":4931,"depth":36,"text":4934},{"id":6011,"depth":27,"text":6014,"children":6459},[6460,6461],{"id":6017,"depth":36,"text":6020},{"id":6135,"depth":36,"text":6138},{"id":6268,"depth":27,"text":6271},{"id":6414,"depth":27,"text":6417},1782373760306]