diff --git a/.github/actions/get-artifact-for-stage-tests/action.yml b/.github/actions/get-artifact-for-stage-tests/action.yml index 94ebf80c04..093612ae66 100644 --- a/.github/actions/get-artifact-for-stage-tests/action.yml +++ b/.github/actions/get-artifact-for-stage-tests/action.yml @@ -70,7 +70,7 @@ runs: # End codepath that downloads artifacts from Github # Begin codepath that downloads from JFrog - - uses: jfrog/setup-jfrog-cli@5b06f730cc5a6f55d78b30753f8583454b08c0aa # v4.8.1 + - uses: step-security/setup-jfrog-cli@a6b41f8338bea0983ddff6bd4ede7d2dcd81e1fa # v4.8.1 if: ${{ inputs.get_from_jfrog == 'true' }} env: JF_URL: ${{ inputs.JFROG_PLATFORM_URL }} diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 45334cd5da..5c410f0e69 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -9,9 +9,33 @@ updates: # Check for updates to GitHub Actions every weekday interval: "daily" target-branch: "dev" - - package-ecosystem: "pip" - directories: - - "**/*" + + - package-ecosystem: pip + directory: /.github/workflows schedule: - interval: "daily" + interval: daily + target-branch: "dev" + + - package-ecosystem: pip + directory: /doc + schedule: + interval: daily + target-branch: "dev" + + - package-ecosystem: pip + directory: / + schedule: + interval: daily + target-branch: "dev" + + - package-ecosystem: pip + directory: /test + schedule: + interval: daily + target-branch: "dev" + + - package-ecosystem: pip + directory: /test/standalone + schedule: + interval: daily target-branch: "dev" diff --git a/.github/workflows/smoke-tests.yml b/.github/workflows/smoke-tests.yml index a5e950df1b..244bf4a8f3 100644 --- a/.github/workflows/smoke-tests.yml +++ b/.github/workflows/smoke-tests.yml @@ -304,7 +304,7 @@ jobs: working-directory: test - name: Run tests - # We need to disable capturing output or else we cannot see memory errors reported by + # We need to disable capturing output or else we cannot see memory errors reported by # libasan during the test run run: python -m pytest ./new_tests -vvs working-directory: test diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 52c5696248..b94b543ee6 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -16,6 +16,7 @@ repos: - repo: https://github.com/pre-commit/pre-commit-hooks rev: v4.4.0 hooks: + - id: trailing-whitespace - id: check-yaml - id: check-added-large-files - id: check-case-conflict @@ -40,3 +41,7 @@ repos: # Running on all files causes this issue: # scripts/manylinux2014build.sh: scripts/manylinux2014build.sh: openBinaryFile: does not exist (No such file or directory) files: ".github/workflows/docker-setup/" +- repo: https://github.com/gitleaks/gitleaks + rev: v8.16.3 + hooks: + - id: gitleaks diff --git a/BUILD.md b/BUILD.md index 0fce1324a6..d49dc26efc 100644 --- a/BUILD.md +++ b/BUILD.md @@ -124,7 +124,7 @@ python3 -m build If you are building on a non-tagged commit, or there are uncommitted changes to the repository, a local version identifier will be added to the version. The formatting of the local version identifier can be found [here](https://github.com/jwodder/versioningit/tree/v3.1.0?tab=readme-ov-file#example-configurations) under the versioneer -section. +section. The local version identifier will appear in: - The package version in the wheel name diff --git a/doc/_static/theme_overrides.css b/doc/_static/theme_overrides.css index 70f787255e..ccf4339ff9 100644 --- a/doc/_static/theme_overrides.css +++ b/doc/_static/theme_overrides.css @@ -6,7 +6,7 @@ this as on RTD they are loaded after this stylesheet */ white-space: normal !important; } - + .wy-table-responsive { overflow: visible !important; } diff --git a/doc/examples/batch_write.py b/doc/examples/batch_write.py index 53ae0bdfa0..12c1522d2d 100644 --- a/doc/examples/batch_write.py +++ b/doc/examples/batch_write.py @@ -19,7 +19,7 @@ br.Remove( key = keyTuples[0], ), - # Modify Daniel's ID and balance + # Modify Daniel's ID and balance br.Write( key = keyTuples[1], ops = [ diff --git a/doc/examples/keyordereddict.py b/doc/examples/keyordereddict.py index 2a063e3e89..7c8cb65d89 100644 --- a/doc/examples/keyordereddict.py +++ b/doc/examples/keyordereddict.py @@ -19,7 +19,7 @@ my_dict2 = {'d': 4, 'e': 5, 'f': 6} my_dict3 = {'g': 7, 'h': 8, 'i': 9} -ops = [ +ops = [ lop.list_append_items('map_list', [my_dict1, my_dict2, my_dict3]), mop.map_set_policy('map_list', map_policy, [map_ctx1]), mop.map_set_policy('map_list', map_policy, [map_ctx2]), @@ -32,7 +32,7 @@ element = KeyOrderedDict({'f': 6, 'e': 5, 'd': 4}) # this will match my_dict2 because it will be converted to key ordered. -ops = [ +ops = [ lop.list_get_by_value('map_list', element, aerospike.LIST_RETURN_COUNT) ] _, _, res = client.operate(key, ops) diff --git a/examples/admin/change_password.py b/examples/admin/change_password.py index e93655a655..d5cc6a33a7 100644 --- a/examples/admin/change_password.py +++ b/examples/admin/change_password.py @@ -88,13 +88,13 @@ # ---------------------------------------------------------------------------- # Perform Operation # ---------------------------------------------------------------------------- - + try: policy = {} user = "foo-example" password = "foobar" - try: + try: client_new = aerospike.client(config).connect(user, "bar") except ClientError: print("User might not be created or node may be down. In case of non-existent user run create_user.py first") @@ -102,14 +102,14 @@ sys.exit() status = client_new.admin_change_password(user, password) client_new.close() - + print("Status of changing password is: %d" % status) print("OK, password changed for 1 user") except Exception as e: print("error: {0}".format(e), file=sys.stderr) exitCode = 2 - + # ---------------------------------------------------------------------------- # Close Connection to Cluster # ---------------------------------------------------------------------------- diff --git a/examples/admin/create_role.py b/examples/admin/create_role.py index 2b429428e1..26c0ac3c78 100644 --- a/examples/admin/create_role.py +++ b/examples/admin/create_role.py @@ -87,21 +87,21 @@ # ---------------------------------------------------------------------------- # Perform Operation # ---------------------------------------------------------------------------- - + try: policy = {} role = "example_foo" privileges = [{"code": aerospike.PRIV_READ}, {"code": aerospike.PRIV_USER_ADMIN}] - + client.admin_create_role(role, privileges, policy) - + print("OK, 1 new role created") except Exception as e: print("error: {0}".format(e), file=sys.stderr) exitCode = 2 - + # ---------------------------------------------------------------------------- # Close Connection to Cluster # ---------------------------------------------------------------------------- diff --git a/examples/admin/create_user.py b/examples/admin/create_user.py index e6b74f06ae..00006500f3 100644 --- a/examples/admin/create_user.py +++ b/examples/admin/create_user.py @@ -87,7 +87,7 @@ # ---------------------------------------------------------------------------- # Perform Operation # ---------------------------------------------------------------------------- - + try: policy = {} @@ -95,15 +95,15 @@ password = "bar" roles = ["read-write", "read"] roles_size = len(roles) - + client.admin_create_user(user, password, roles, policy) - + print("OK, 1 new user created") except Exception as e: print("error: {0}".format(e), file=sys.stderr) exitCode = 2 - + # ---------------------------------------------------------------------------- # Close Connection to Cluster # ---------------------------------------------------------------------------- diff --git a/examples/admin/drop_role.py b/examples/admin/drop_role.py index 88bc7d3a77..60a1bf95a1 100644 --- a/examples/admin/drop_role.py +++ b/examples/admin/drop_role.py @@ -87,20 +87,20 @@ # ---------------------------------------------------------------------------- # Perform Operation # ---------------------------------------------------------------------------- - + try: policy = {} role = "example_foo" - + client.admin_drop_role(role, policy) - + print("OK, 1 role dropped") except Exception as e: print("error: {0}".format(e), file=sys.stderr) exitCode = 2 - + # ---------------------------------------------------------------------------- # Close Connection to Cluster # ---------------------------------------------------------------------------- diff --git a/examples/admin/drop_user.py b/examples/admin/drop_user.py index 3dd39ffe99..cba66d61e2 100644 --- a/examples/admin/drop_user.py +++ b/examples/admin/drop_user.py @@ -87,20 +87,20 @@ # ---------------------------------------------------------------------------- # Perform Operation # ---------------------------------------------------------------------------- - + try: policy = {} user = "foo-example" - + client.admin_drop_user(user, policy) - + print("OK, 1 user dropped") except Exception as e: print("error: {0}".format(e), file=sys.stderr) exitCode = 2 - + # ---------------------------------------------------------------------------- # Close Connection to Cluster # ---------------------------------------------------------------------------- diff --git a/examples/admin/grant_privileges.py b/examples/admin/grant_privileges.py index 89ee5596e0..fbde412653 100644 --- a/examples/admin/grant_privileges.py +++ b/examples/admin/grant_privileges.py @@ -87,22 +87,22 @@ # ---------------------------------------------------------------------------- # Perform Operation # ---------------------------------------------------------------------------- - + try: policy = {} role = "example_foo" privileges = [{"code": aerospike.PRIV_SYS_ADMIN}] - + client.admin_grant_privileges(role, privileges) - + print("OK, new privileges granted to 1 role") except Exception as e: print("error: {0}".format(e), file=sys.stderr) print("In case of invalid role first create role by running create_role.py") exitCode = 2 - + # ---------------------------------------------------------------------------- # Close Connection to Cluster # ---------------------------------------------------------------------------- diff --git a/examples/admin/grant_roles.py b/examples/admin/grant_roles.py index e53fcdb8ea..2eee99558f 100644 --- a/examples/admin/grant_roles.py +++ b/examples/admin/grant_roles.py @@ -87,7 +87,7 @@ # ---------------------------------------------------------------------------- # Perform Operation # ---------------------------------------------------------------------------- - + try: policy = {} @@ -103,7 +103,7 @@ print("error: {0}".format(e), file=sys.stderr) print("In case of invalid user first create user by running create_user.py") exitCode = 2 - + # ---------------------------------------------------------------------------- # Close Connection to Cluster # ---------------------------------------------------------------------------- diff --git a/examples/admin/query_role.py b/examples/admin/query_role.py index ac8ab88049..7f0de7185f 100644 --- a/examples/admin/query_role.py +++ b/examples/admin/query_role.py @@ -87,14 +87,14 @@ # ---------------------------------------------------------------------------- # Perform Operation # ---------------------------------------------------------------------------- - + try: policy = {} role = "example_foo" - + privileges = client.admin_query_role(role, policy) - + print(privileges) print("---") print("OK, Privileges retrieved for one role") @@ -103,7 +103,7 @@ print("error: {0}".format(e), file=sys.stderr) print("In case of invalid role, first create role using create_role.py") exitCode = 2 - + # ---------------------------------------------------------------------------- # Close Connection to Cluster # ---------------------------------------------------------------------------- diff --git a/examples/admin/query_roles.py b/examples/admin/query_roles.py index 1505b47d36..e524be6f71 100644 --- a/examples/admin/query_roles.py +++ b/examples/admin/query_roles.py @@ -87,20 +87,20 @@ # ---------------------------------------------------------------------------- # Perform Operation # ---------------------------------------------------------------------------- - + try: policy = {} - + roles = client.admin_query_roles(policy) print(roles) - print("---") + print("---") print("OK, All roles retrieved") except Exception as e: print("error: {0}".format(e), file=sys.stderr) exitCode = 2 - + # ---------------------------------------------------------------------------- # Close Connection to Cluster # ---------------------------------------------------------------------------- diff --git a/examples/admin/query_user_info.py b/examples/admin/query_user_info.py index 2abcfc57b6..331772e07b 100644 --- a/examples/admin/query_user_info.py +++ b/examples/admin/query_user_info.py @@ -92,7 +92,7 @@ try: policy = {} - + roles = client.admin_query_user_info(options.username, policy) print(roles) diff --git a/examples/admin/revoke_privileges.py b/examples/admin/revoke_privileges.py index a6caa72065..2434af064e 100644 --- a/examples/admin/revoke_privileges.py +++ b/examples/admin/revoke_privileges.py @@ -87,22 +87,22 @@ # ---------------------------------------------------------------------------- # Perform Operation # ---------------------------------------------------------------------------- - + try: policy = {} role = "example_foo" privileges = [{"code": aerospike.PRIV_SYS_ADMIN}] - + client.admin_revoke_privileges(role, privileges, policy) - + print("OK, privileges revoked from 1 role") except Exception as e: print("error: {0}".format(e), file=sys.stderr) print("In case of invalid role first create roles using create_role.py") exitCode = 2 - + # ---------------------------------------------------------------------------- # Close Connection to Cluster # ---------------------------------------------------------------------------- diff --git a/examples/admin/revoke_roles.py b/examples/admin/revoke_roles.py index 7280be68f5..f43b4300ce 100644 --- a/examples/admin/revoke_roles.py +++ b/examples/admin/revoke_roles.py @@ -87,23 +87,23 @@ # ---------------------------------------------------------------------------- # Perform Operation # ---------------------------------------------------------------------------- - + try: policy = {} user = "foo-example" roles = ["user-admin", "read"] roles_size = len(roles) - + client.admin_revoke_roles(user, roles, policy) - + print("OK, roles revoked from 1 user") except Exception as e: print("error: {0}".format(e), file=sys.stderr) print("In case of invalid user first create user using create_user.py") exitCode = 2 - + # ---------------------------------------------------------------------------- # Close Connection to Cluster # ---------------------------------------------------------------------------- diff --git a/examples/admin/set_password.py b/examples/admin/set_password.py index 944ee02af1..4003ec1106 100644 --- a/examples/admin/set_password.py +++ b/examples/admin/set_password.py @@ -87,22 +87,22 @@ # ---------------------------------------------------------------------------- # Perform Operation # ---------------------------------------------------------------------------- - + try: policy = {} user = "foo-example" password = "bar" - + client.admin_set_password(user, password, policy) - + print("OK, password set for 1 user") except Exception as e: print("error: {0}".format(e), file=sys.stderr) print("In case of invalid user first create user using create_user.py") exitCode = 2 - + # ---------------------------------------------------------------------------- # Close Connection to Cluster # ---------------------------------------------------------------------------- diff --git a/examples/client/delete.py b/examples/client/delete.py index f7e811cac6..3bb9677a4d 100644 --- a/examples/client/delete.py +++ b/examples/client/delete.py @@ -118,9 +118,9 @@ def delete(namespace, set, test_count): 'set':set, \ 'key': str(i), \ 'digest': aerospike.calc_digest(namespace, set, str(i))} - + policy = None - + client.remove(key) diff --git a/examples/client/get_async.py b/examples/client/get_async.py index 2079e481a3..693496a98f 100644 --- a/examples/client/get_async.py +++ b/examples/client/get_async.py @@ -115,7 +115,7 @@ meta = None print(f"IO async test count:{test_count}") - + async def async_io(namespace, set, i): key = (namespace, \ set, \ diff --git a/examples/client/put_async.py b/examples/client/put_async.py index 566d6db435..907ba80598 100644 --- a/examples/client/put_async.py +++ b/examples/client/put_async.py @@ -115,9 +115,9 @@ meta = None print(f"IO async test count:{test_count}") - + async def async_io(namespace, set, i): - futures = [] + futures = [] key = (namespace, \ set, \ str(i), \ diff --git a/examples/client/scan_partition.py b/examples/client/scan_partition.py index be53c6edea..00870b9509 100644 --- a/examples/client/scan_partition.py +++ b/examples/client/scan_partition.py @@ -109,7 +109,7 @@ # project specified bins partition_policy = {'partition_filter': {'begin': options.partition, 'count': 1}} print(f'partition_id: {options.partition}') - + records = [] # callback to be called for each record read @@ -117,7 +117,7 @@ def callback(input_tuple): (_, _, record) = input_tuple records.append(record) print(record) - + client.truncate('test', "demo", 0) # invoke the operations, and for each record invoke the callback @@ -131,7 +131,7 @@ def callback(input_tuple): rec_partition = client.get_key_partition_id('test', 'demo', str(i)) if rec_partition == options.partition: # and not client.exists(('test', 'demo', str(i))): - + count = count + 1 rec = { 'i': i, @@ -140,7 +140,7 @@ def callback(input_tuple): 'm': {'partition': rec_partition, 'b': 4, 'c': 8, 'd': 16} } client.put(('test', 'demo', str(i)), rec) - + records.clear() # invoke the operations, and for each record invoke the callback s.foreach(callback, partition_policy) @@ -148,7 +148,7 @@ def callback(input_tuple): print("---") print(f"{count} records are put into partition:{options.partition}.") print(f"{len(records)} records are found in partition:{options.partition}.") - + except Exception as e: print("error: {0}".format(e), file=sys.stderr) rc = 1 diff --git a/examples/deprecated/put.py b/examples/deprecated/put.py index c98c979e9a..65cbc43736 100644 --- a/examples/deprecated/put.py +++ b/examples/deprecated/put.py @@ -104,7 +104,7 @@ # policy = { 'gen': 0 } policy = None client.key(options.namespace, options.set, key).put(record, meta) - + print(record) print("---") print("OK, 1 record written.") diff --git a/src/include/query.h b/src/include/query.h index a2a6c65cb8..bc451668c7 100644 --- a/src/include/query.h +++ b/src/include/query.h @@ -138,7 +138,7 @@ PyObject *AerospikeQuery_Is_Done(AerospikeQuery *self); PyObject *AerospikeQuery_Get_Partitions_status(AerospikeQuery *self); /** - * Store the Unicode -> UTF8 string converted PyObject into + * Store the Unicode -> UTF8 string converted PyObject into * a pool of PyObjects. So that, they will be decref'ed at later stages * without leaving memory trails behind. * StoreUnicodePyObject(self, PyUnicode_AsUTF8String(py_bin)); diff --git a/src/main/convert_expressions.c b/src/main/convert_expressions.c index 8bf1caf07f..a98526375b 100644 --- a/src/main/convert_expressions.c +++ b/src/main/convert_expressions.c @@ -195,7 +195,7 @@ static bool free_temp_expr(intermediate_expr *temp_expr, as_error *err, #define NIL as_exp_nil() /* -* get_expr_size +* get_expr_size * Sets `size_to_alloc` to the byte count required to fit the array of as_exp_entry that will be allocated * when `intermediate_exprs` is converted. * Note that intermediate_exprs has an entry for every child of every expression but the child values' sizes do not need to be counted @@ -608,7 +608,7 @@ get_exp_val_from_pyval(AerospikeClient *self, as_static_pool *static_pool, * add_expr_macros * Converts each intermediate_expr struct in intermediate_expr_vector to as_exp_entries and copies them to expressions. * Note that a count of as_exp_entries to leave out of the copy is passed to the `APPEND_ARRAY` macro. -* Since this function uses the C expressions macros directly, we don't want to copy the useless junk generated by the +* Since this function uses the C expressions macros directly, we don't want to copy the useless junk generated by the * empty arguments used. Each expression child/value has a intermediate_expr struct in intermediate_expr_vector so the missing values will be copied later. * These counts need to be updated if the C client macro changes. */ diff --git a/src/main/serializer.c b/src/main/serializer.c index 8ef32ac61e..ec74fe04aa 100644 --- a/src/main/serializer.c +++ b/src/main/serializer.c @@ -317,7 +317,7 @@ extern as_status serialize_based_on_serializer_policy(AerospikeClient *self, case SERIALIZER_PYTHON: { /* * Serialize bytearray as is and store them into database with - * type AS_BYTES_BLOB, unlike other values in case of + * type AS_BYTES_BLOB, unlike other values in case of * SERIALIZER_PYTHON. * This is a special case. * Refer: AER-3589 for more details.