Skip to content

Commit

Permalink
[Django] Use name of variable instead of Python variable repr. (#1568)
Browse files Browse the repository at this point in the history
* [Django] Use name of variable instead of Python variable repr.

* Run `go mod tidy` before testing

* Drop tests for Python 3.6 on Windows

No longer supported by action actions/setup-python#355 (comment)

* Update submodules.
  • Loading branch information
samscott89 authored Apr 28, 2022
1 parent cdbe1e2 commit 7d6a841
Show file tree
Hide file tree
Showing 10 changed files with 13 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -699,7 +699,7 @@ jobs:
runs-on: windows-latest
strategy:
matrix:
python-version: ["3.6", "3.7", "3.8", "3.9", "3.10"]
python-version: ["3.7", "3.8", "3.9", "3.10"]
steps:
- uses: actions/checkout@v2
- name: Set version env
Expand Down
1 change: 1 addition & 0 deletions docs/examples/add-to-your-application/go/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@

test:
make -C ../../../../languages/go copy_lib
go mod tidy
go test
2 changes: 1 addition & 1 deletion docs/examples/quickstart/go
Submodule go updated from 31e678 to 2f2d68
2 changes: 1 addition & 1 deletion docs/examples/quickstart/java
Submodule java updated from 2ed954 to 20404c
2 changes: 1 addition & 1 deletion docs/examples/quickstart/nodejs
2 changes: 1 addition & 1 deletion docs/examples/quickstart/python
2 changes: 1 addition & 1 deletion docs/examples/quickstart/ruby
Submodule ruby updated from 71ab7d to a016aa
2 changes: 1 addition & 1 deletion docs/examples/quickstart/rust
Submodule rust updated from f11ac4 to 0a1e68
4 changes: 2 additions & 2 deletions docs/examples/quickstart/test_quickstarts.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@


quickstarts = {
go: { setup: 'go build', server: './oso-go-quickstart' },
go: { setup: 'go mod tidy && go build', server: './oso-go-quickstart' },
# TODO: add local_setup that tests against local Oso install for java
java: { setup: 'make install', server: 'make run' },
# TODO: add local_setup that tests against local Oso install for nodejs
Expand All @@ -22,7 +22,7 @@
}

if ARGV.include? "local"
quickstarts[:go][:setup] = "make -C ../../../../languages/go copy_lib && go mod edit -replace github.com/osohq/go-oso=../../../../languages/go && go build"
quickstarts[:go][:setup] = "make -C ../../../../languages/go copy_lib && go mod edit -replace github.com/osohq/go-oso=../../../../languages/go && go mod tidy && go build"
quickstarts[:python][:setup] = "pip install -e ../../../../languages/python/oso && pip install --upgrade -r requirements.txt"
quickstarts[:ruby][:setup] = "BUNDLE_GEMFILE=../Gemfile-local bundle"
quickstarts[:ruby][:server] = "BUNDLE_GEMFILE=../Gemfile-local bundle exec ruby server.rb"
Expand Down
4 changes: 3 additions & 1 deletion languages/python/django-oso/django_oso/partial.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,9 @@ def get_model_by_path(

class FilterBuilder:
def __init__(self, model: Model, name="_this", parent=None):
self.name = name
self.name = (
super(Variable, name).__str__() if isinstance(name, Variable) else name
)
self.model = model
self.filter = TRUE_FILTER
# Map variables to subquery
Expand Down

2 comments on commit 7d6a841

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Performance Alert ⚠️

Possible performance regression was detected for benchmark 'Rust Benchmark'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 1.50.

Benchmark suite Current: 7d6a841 Previous: cdbe1e2 Ratio
indexed/10000 32175 ns/iter (± 2754) 17325 ns/iter (± 2021) 1.86

This comment was automatically generated by workflow using github-action-benchmark.

CC: @osohq/eng

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rust Benchmark

Benchmark suite Current: 7d6a841 Previous: cdbe1e2 Ratio
rust_get_attribute 45267 ns/iter (± 2060) 45884 ns/iter (± 1950) 0.99
n_plus_one/100 2209323 ns/iter (± 11245) 2208414 ns/iter (± 57824) 1.00
n_plus_one/500 10681541 ns/iter (± 112514) 10627127 ns/iter (± 291777) 1.01
n_plus_one/1000 21316815 ns/iter (± 65076) 21166823 ns/iter (± 793074) 1.01
unify_once 977 ns/iter (± 69) 965 ns/iter (± 144) 1.01
unify_twice 2538 ns/iter (± 71) 2517 ns/iter (± 58) 1.01
many_rules 62151 ns/iter (± 1721) 61948 ns/iter (± 1392) 1.00
fib/5 531753 ns/iter (± 11754) 534442 ns/iter (± 14009) 0.99
prime/3 15868 ns/iter (± 682) 17846 ns/iter (± 800) 0.89
prime/23 15828 ns/iter (± 697) 17832 ns/iter (± 831) 0.89
prime/43 17895 ns/iter (± 809) 17815 ns/iter (± 783) 1.00
prime/83 15832 ns/iter (± 661) 17781 ns/iter (± 735) 0.89
prime/255 14680 ns/iter (± 564) 16465 ns/iter (± 688) 0.89
indexed/100 5349 ns/iter (± 616) 5872 ns/iter (± 1846) 0.91
indexed/500 6855 ns/iter (± 2237) 7288 ns/iter (± 1667) 0.94
indexed/1000 8550 ns/iter (± 303) 9147 ns/iter (± 211) 0.93
indexed/10000 32175 ns/iter (± 2754) 17325 ns/iter (± 2021) 1.86
not 5225 ns/iter (± 131) 5986 ns/iter (± 110) 0.87
double_not 10852 ns/iter (± 231) 12458 ns/iter (± 254) 0.87
De_Morgan_not 6962 ns/iter (± 215) 8011 ns/iter (± 200) 0.87
load_policy 785588 ns/iter (± 2609) 890559 ns/iter (± 1032) 0.88
partial_and/1 27707 ns/iter (± 1259) 31322 ns/iter (± 1395) 0.88
partial_and/5 97135 ns/iter (± 2907) 111237 ns/iter (± 2977) 0.87
partial_and/10 184976 ns/iter (± 3817) 211250 ns/iter (± 4383) 0.88
partial_and/20 377380 ns/iter (± 6992) 429405 ns/iter (± 5583) 0.88
partial_and/40 800773 ns/iter (± 11589) 909423 ns/iter (± 10789) 0.88
partial_and/80 1806573 ns/iter (± 19326) 2044764 ns/iter (± 4102) 0.88
partial_and/100 2390846 ns/iter (± 23605) 2704026 ns/iter (± 5035) 0.88
partial_rule_depth/1 89766 ns/iter (± 3643) 103478 ns/iter (± 4941) 0.87
partial_rule_depth/5 295088 ns/iter (± 6025) 333932 ns/iter (± 5389) 0.88
partial_rule_depth/10 645580 ns/iter (± 8341) 730148 ns/iter (± 9859) 0.88
partial_rule_depth/20 1812740 ns/iter (± 26229) 2046000 ns/iter (± 79729) 0.89
partial_rule_depth/40 6627079 ns/iter (± 77448) 7443952 ns/iter (± 95564) 0.89
partial_rule_depth/80 41065593 ns/iter (± 383608) 43237720 ns/iter (± 469264) 0.95
partial_rule_depth/100 75102909 ns/iter (± 482473) 81939142 ns/iter (± 802646) 0.92

This comment was automatically generated by workflow using github-action-benchmark.

Please sign in to comment.