@@ -55,26 +55,26 @@ def insert(
5555 ) -> InsertResult:
5656 if not insert_opts:
5757 insert_opts = InsertOpts()
58- insert_params, unique_opts = self.make_insert_params (args, insert_opts)
58+ insert_params, unique_opts = self.__make_insert_params (args, insert_opts)
5959
6060 def insert():
6161 print(self.driver)
6262 return InsertResult(self.driver.job_insert(insert_params))
6363
64- return self.check_unique_job (insert_params, unique_opts, insert)
64+ return self.__check_unique_job (insert_params, unique_opts, insert)
6565
6666 def insert_many(self, args: List[Args]) -> List[InsertResult]:
6767 all_params = [
68- self.make_insert_params (
68+ self.__make_insert_params (
6969 arg.args, arg.insert_opts or InsertOpts(), is_insert_many=True
7070 )[0]
7171 if isinstance(arg, InsertManyParams)
72- else self.make_insert_params (arg, InsertOpts(), is_insert_many=True)[0]
72+ else self.__make_insert_params (arg, InsertOpts(), is_insert_many=True)[0]
7373 for arg in args
7474 ]
7575 return [InsertResult(x) for x in self.driver.job_insert_many(all_params)]
7676
77- def check_unique_job (
77+ def __check_unique_job (
7878 self,
7979 insert_params: JobInsertParams,
8080 unique_opts: Optional[UniqueOpts],
@@ -95,7 +95,7 @@ def check_unique_job(
9595 lock_str += f"&args={insert_params.args}"
9696
9797 if unique_opts.by_period:
98- lower_period_bound = self.truncate_time (
98+ lower_period_bound = self.__truncate_time (
9999 self.time_now_utc(), unique_opts.by_period
100100 )
101101
@@ -132,7 +132,7 @@ def check_unique_job(
132132 prefix = self.advisory_lock_prefix
133133 lock_key = (prefix << 32) | fnv1_hash(lock_str.encode("utf-8"), 32)
134134
135- lock_key = self.uint64_to_int64 (lock_key)
135+ lock_key = self.__uint64_to_int64 (lock_key)
136136 self.driver.advisory_lock(lock_key)
137137
138138 existing_job = self.driver.job_get_by_kind_and_unique_properties(get_params)
@@ -142,7 +142,7 @@ def check_unique_job(
142142 return insert_func()
143143
144144 @staticmethod
145- def make_insert_params (
145+ def __make_insert_params (
146146 args: Args, insert_opts: InsertOpts, is_insert_many: bool = False
147147 ) -> Tuple[JobInsertParams, Optional[UniqueOpts]]:
148148 if not hasattr(args, "kind"):
@@ -178,12 +178,12 @@ def make_insert_params(
178178 return insert_params, unique_opts
179179
180180 @staticmethod
181- def truncate_time (time, interval_seconds) -> datetime:
181+ def __truncate_time (time, interval_seconds) -> datetime:
182182 return datetime.fromtimestamp(
183183 (time.timestamp() // interval_seconds) * interval_seconds, tz=timezone.utc
184184 )
185185
186186 @staticmethod
187- def uint64_to_int64 (uint64):
187+ def __uint64_to_int64 (uint64):
188188 # Packs a uint64 then unpacks to int64 to fit within Postgres bigint
189189 return (uint64 + (1 << 63)) % (1 << 64) - (1 << 63)
0 commit comments