{"id":20041710,"url":"https://github.com/ajithvcoder/session-7-assignment","last_synced_at":"2026-06-30T13:32:10.317Z","repository":{"id":111987516,"uuid":"378677788","full_name":"ajithvcoder/session-7-assignment","owner":"ajithvcoder","description":"EPAi sesion 7 assignment","archived":false,"fork":false,"pushed_at":"2021-06-20T15:33:50.000Z","size":4,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-02T07:14:22.397Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ajithvcoder.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2021-06-20T15:24:31.000Z","updated_at":"2021-06-20T15:33:53.000Z","dependencies_parsed_at":"2023-09-09T21:30:55.153Z","dependency_job_id":null,"html_url":"https://github.com/ajithvcoder/session-7-assignment","commit_stats":null,"previous_names":["ajithvcoder/session-7-assignment"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ajithvcoder/session-7-assignment","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ajithvcoder%2Fsession-7-assignment","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ajithvcoder%2Fsession-7-assignment/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ajithvcoder%2Fsession-7-assignment/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ajithvcoder%2Fsession-7-assignment/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ajithvcoder","download_url":"https://codeload.github.com/ajithvcoder/session-7-assignment/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ajithvcoder%2Fsession-7-assignment/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34969682,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-30T02:00:05.919Z","response_time":92,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-13T10:47:37.249Z","updated_at":"2026-06-30T13:32:10.218Z","avatar_url":"https://github.com/ajithvcoder.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"### Session 8 - Scopes and Closures\n\n**Contents**\n- check_docstring\n- generate_fibanoci\n- function_counter\n- function_counter_mod\n\n### check_docstring\n\n    def check_docstring(max_len) -\u003e 'Function': \n        def docstring_fifty(func) -\u003e 'bool':            \n            result = len(func.__doc__) \u003e max_len\n            return result\n        return docstring_fifty\n\n- Checks if a given function has docstring more than max_len variable\n- max_len is a free variable which can be checked with __code__.co_freevars function. its a test in testfile\n\n### generate_fibanoci\n\n    def generate_fibanoci() -\u003e 'Function': \n        n = 0    \n        def next_Fib() -\u003e 'Integer' :\n            a = 0\n            b = 1\n            c = 0\n            nonlocal n    \n            if (n==0):\n                n = n + 1            \n                return 0\n            elif n==1:\n                n = n + 1            \n                return b \n            else:            \n                for i in range(1,n):\n                    c = a + b\n                    a = b\n                    b = c \n                n = n + 1\n                return b\n        return next_Fib\n\n- Fibnoci algorithm is fed at next_fib() closure function . n is a non local variable used as a counter to remember how many times a function(next_fib()) is called.\n\n\n### function_counter\n\n    def function_counter() -\u003e 'Function':        \n        count = dict()\n        def inner(fn,*args, **kwargs) -\u003e 'Function(*args, **kwargs)':           \n            nonlocal count \n            count[fn.__name__] = count.get(fn.__name__, 0) + 1\n            function_call_counter[fn.__name__] = count[fn.__name__] \n            return fn(*args, **kwargs)\n        return inner\n\n- A global dictionary 'function_call_counter' is used  , count is sued to remmeber number of times each function is called. 'count' is used as a nonlocal variable that can used to reset if 'function_call_counter' is modified by some other function.\n\n### function_counter_mod\n\n    def function_counter_mod(user_dict) -\u003e 'Function':\n        def inner(fn, *args, **kwargs) -\u003e 'Function':\n            user_dict[fn.__name__] = user_dict.get(fn.__name__, 0) + 1\n            return fn(*args, **kwargs)\n        return inner \n\n- A user defined dictionary 'user_dict' is given as input and used  , User provided dictionary\nis directly modified inside the function every time when a particular function is called.\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fajithvcoder%2Fsession-7-assignment","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fajithvcoder%2Fsession-7-assignment","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fajithvcoder%2Fsession-7-assignment/lists"}