-
Notifications
You must be signed in to change notification settings - Fork 11
Linter: enable attribute-defined-outside-init rule #528
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
bitterpanda63
wants to merge
20
commits into
main
Choose a base branch
from
enable-attribute-defined-outside-init-lint
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+141
β278
Open
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
d6fe487
Re-enable attribute-defined-outside-init
bitterpanda63 ff068d9
Create a static new() function on the service config class
bitterpanda63 0e9e975
thread cache: define all attribtues in init
bitterpanda63 bae79cb
service_config.py cleanup
bitterpanda63 bd9a33f
Update thread_cache & it's tests to use new ServiceCOnfig init
bitterpanda63 141e479
Update request_handler test cases
bitterpanda63 9913bc8
update rate-limiting test cases with new service config
bitterpanda63 48b2bfd
Update service config test cases themselves
bitterpanda63 0c2e7fb
cloud connection manager, fix service config update
bitterpanda63 7020ed2
lint
bitterpanda63 9b94bb6
Fix the set_body_internal mess
bitterpanda63 38e3945
Merge branch 'main' into enable-attribute-defined-outside-init-lint
bitterpanda63 95a11ee
thread cache reset - also reset middleware_installed
bitterpanda63 3167477
Merge branch 'main' into enable-attribute-defined-outside-init-lint
bitterpanda63 64fc8bc
Fix linting conflict with merge
bitterpanda63 47e26bd
Fix test cases in service_config_test.py after merge conflict
bitterpanda63 87365b7
Fix socket_test.py test cases for ServiceConfig init after merge confβ¦
bitterpanda63 e297833
Fix issues with update_service_config and its test cases after merge
bitterpanda63 33539b7
Update aikido_zen/background_process/service_config.py
bitterpanda63 9930ecc
Update aikido_zen/context/__init__.py
bitterpanda63 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,42 +6,18 @@ | |
| from aikido_zen.helpers.match_endpoints import match_endpoints | ||
|
|
||
|
|
||
| # noinspection PyAttributeOutsideInit | ||
| class ServiceConfig: | ||
| """Class holding the config of the connection_manager""" | ||
|
|
||
| def __init__( | ||
| self, | ||
| endpoints, | ||
| last_updated_at: int, | ||
| blocked_uids, | ||
| bypassed_ips, | ||
| received_any_stats: bool, | ||
| ): | ||
| # Init the class using update function : | ||
| self.update( | ||
| endpoints, last_updated_at, blocked_uids, bypassed_ips, received_any_stats | ||
| ) | ||
|
|
||
| def __init__(self): | ||
| self.endpoints = [] | ||
| self.bypassed_ips = IPMatcher() | ||
| self.blocked_uids = set() | ||
| self.last_updated_at = -1 | ||
| self.received_any_stats = False | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This was previously true fyi |
||
| self.block_new_outgoing_requests = False | ||
| self.outbound_domains = {} | ||
|
|
||
| def update( | ||
| self, | ||
| endpoints, | ||
| last_updated_at: int, | ||
| blocked_uids, | ||
| bypassed_ips, | ||
| received_any_stats: bool, | ||
| ): | ||
| self.last_updated_at = last_updated_at | ||
| self.received_any_stats = bool(received_any_stats) | ||
| self.blocked_uids = set(blocked_uids) | ||
| self.set_endpoints(endpoints) | ||
| self.set_bypassed_ips(bypassed_ips) | ||
|
|
||
| def set_endpoints(self, endpoints): | ||
| """Sets non-graphql endpoints""" | ||
|
|
||
| self.endpoints = [ | ||
| endpoint for endpoint in endpoints if not endpoint.get("graphql") | ||
| ] | ||
|
|
@@ -68,7 +44,6 @@ def get_endpoints(self, route_metadata): | |
| return match_endpoints(route_metadata, self.endpoints) | ||
|
|
||
| def set_bypassed_ips(self, bypassed_ips): | ||
| """Creates an IPMatcher from the given bypassed ip set""" | ||
| self.bypassed_ips = IPMatcher() | ||
| for ip in bypassed_ips: | ||
| self.bypassed_ips.add(ip) | ||
|
|
@@ -77,6 +52,15 @@ def is_bypassed_ip(self, ip): | |
| """Checks if the IP is on the bypass list""" | ||
| return self.bypassed_ips.has(ip) | ||
|
|
||
| def set_blocked_user_ids(self, blocked_user_ids): | ||
| self.blocked_uids = set(blocked_user_ids) | ||
|
|
||
| def enable_received_any_stats(self): | ||
| self.received_any_stats = True | ||
|
|
||
| def set_last_updated_at(self, last_updated_at: int): | ||
| self.last_updated_at = last_updated_at | ||
|
|
||
| def update_outbound_domains(self, domains): | ||
| self.outbound_domains = { | ||
| domain["hostname"]: domain["mode"] for domain in domains | ||
|
|
||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Flag doesn't update like other settings but seems fine, will only be false for the first heartbeat (and this flag is deprecated anyway). Needs to start sending heartbeat after 30s, then 2 minutes, then every 10 minutes