id stringlengths 23 25 | content stringlengths 1.16k 88k | max_stars_repo_path stringlengths 12 48 |
|---|---|---|
codereval_python_data_1 | Hydrator for `Time` and `LocalTime` values.
:param nanoseconds:
:param tz:
:return: Time
def hydrate_time(nanoseconds, tz=None):
""" Hydrator for `Time` and `LocalTime` values.
:param nanoseconds:
:param tz:
:return: Time
"""
from pytz import FixedOffset
seconds, nanoseconds = map(int, di... | neo4j/_codec/hydration/v1/temporal.py |
codereval_python_data_2 | Dehydrator for `timedelta` values.
:param value:
:type value: timedelta
:return:
def dehydrate_timedelta(value):
""" Dehydrator for `timedelta` values.
:param value:
:type value: timedelta
:return:
"""
months = 0
days = value.days
seconds = value.seconds
nanoseconds = 1000 * value... | neo4j/_codec/hydration/v1/temporal.py |
codereval_python_data_3 | Dehydrator for `time` values.
:param value:
:type value: Time
:return:
def dehydrate_time(value):
""" Dehydrator for `time` values.
:param value:
:type value: Time
:return:
"""
if isinstance(value, Time):
nanoseconds = value.ticks
elif isinstance(value, time):
nanoseconds ... | neo4j/_codec/hydration/v1/temporal.py |
codereval_python_data_4 | Dehydrator for Point data.
:param value:
:type value: Point
:return:
def dehydrate_point(value):
""" Dehydrator for Point data.
:param value:
:type value: Point
:return:
"""
dim = len(value)
if dim == 2:
return Structure(b"X", value.srid, *value)
elif dim == 3:
return ... | neo4j/_codec/hydration/v1/spatial.py |
codereval_python_data_5 | Return the keys of the record.
:return: list of key names
def keys(self):
""" Return the keys of the record.
:return: list of key names
"""
return list(self.__keys)
# Copyright (c) "Neo4j"
# Neo4j Sweden AB [https://neo4j.com]
#
# This file is part of Neo4j.
#
# Licensed under t... | neo4j/_data.py |
codereval_python_data_6 | Return a dictionary of available Bolt protocol handlers,
keyed by version tuple. If an explicit protocol version is
provided, the dictionary will contain either zero or one items,
depending on whether that version is supported. If no protocol
version is provided, all available versions will be returned.
:param protoco... | neo4j/_sync/io/_bolt.py |
codereval_python_data_7 | This function is a decorator for transaction functions that allows extra control over how the transaction is carried out.
For example, a timeout may be applied::
from neo4j import unit_of_work
@unit_of_work(timeout=100)
def count_people_tx(tx):
result = tx.run("MATCH (a:Person) RETURN count(a) AS... | neo4j/work/query.py |
codereval_python_data_8 | Return the index of the given item.
:param key: a key
:return: index
:rtype: int
def index(self, key):
""" Return the index of the given item.
:param key: a key
:return: index
:rtype: int
"""
if isinstance(key, int):
if 0 <= key < len(self.__keys):
... | neo4j/_data.py |
codereval_python_data_9 | Return the values of the record, optionally filtering to
include only certain values by index or key.
:param keys: indexes or keys of the items to include; if none
are provided, all values will be included
:return: list of values
:rtype: list
def values(self, *keys):
""" Return the values of ... | neo4j/_data.py |
codereval_python_data_10 | Return the keys and values of this record as a dictionary,
optionally including only certain values by index or key. Keys
provided in the items that are not in the record will be
inserted with a value of :const:`None`; indexes provided
that are out of bounds will trigger an :exc:`IndexError`.
:param keys: indexes or k... | neo4j/_data.py |
codereval_python_data_11 | Remove the last two bytes of data, returning them as a big-endian
16-bit unsigned integer.
def pop_u16(self):
""" Remove the last two bytes of data, returning them as a big-endian
16-bit unsigned integer.
"""
if self.used >= 2:
value = 0x100 * self.data[self.used - 2] + ... | neo4j/_codec/packstream/v1/__init__.py |
codereval_python_data_12 | Appends a DISCARD message to the output queue.
:param n: number of records to discard, default = -1 (ALL)
:param qid: query ID to discard for, default = -1 (last query)
:param dehydration_hooks:
Hooks to dehydrate types (dict from type (class) to dehydration
function). Dehydration functions receive the value a... | neo4j/_async/io/_bolt3.py |
codereval_python_data_13 | Appends a BEGIN message to the output queue.
:param mode: access mode for routing - "READ" or "WRITE" (default)
:param bookmarks: iterable of bookmark values after which this transaction should begin
:param metadata: custom metadata dictionary to attach to the transaction
:param timeout: timeout for transaction execut... | neo4j/_async/io/_bolt3.py |
codereval_python_data_14 | >>> round_half_to_even(3)
3
>>> round_half_to_even(3.2)
3
>>> round_half_to_even(3.5)
4
>>> round_half_to_even(3.7)
4
>>> round_half_to_even(4)
4
>>> round_half_to_even(4.2)
4
>>> round_half_to_even(4.5)
4
>>> round_half_to_even(4.7)
5
:param n:
:return:
def... | neo4j/time/_arithmetic.py |
codereval_python_data_15 | Dynamically create a Point subclass.
def point_type(name, fields, srid_map):
""" Dynamically create a Point subclass.
"""
def srid(self):
try:
return srid_map[len(self)]
except KeyError:
return None
attributes = {"srid": property(srid)}
for index, subclass... | neo4j/_spatial/__init__.py |
codereval_python_data_16 | Decorator for deprecating functions and methods.
::
@deprecated("'foo' has been deprecated in favour of 'bar'")
def foo(x):
pass
def deprecated(message):
""" Decorator for deprecating functions and methods.
::
@deprecated("'foo' has been deprecated in favour of 'bar'")
def f... | neo4j/_meta.py |
codereval_python_data_17 | Some behaviour of R cannot be configured via env variables, but can
only be configured via R options once R has started. These are set here.
def _inline_r_setup(code: str) -> str:
"""
Some behaviour of R cannot be configured via env variables, but can
only be configured via R options once R has started. Th... | pre_commit/languages/r.py |
codereval_python_data_18 | A simplified implementation of xargs.
color: Make a pty if on a platform that supports it
target_concurrency: Target number of partitions to run concurrently
def xargs(
cmd: tuple[str, ...],
varargs: Sequence[str],
*,
color: bool = False,
target_concurrency: int = 1,
_m... | pre_commit/xargs.py |
codereval_python_data_19 | Deterministically shuffle
def _shuffled(seq: Sequence[str]) -> list[str]:
"""Deterministically shuffle"""
fixed_random = random.Random()
fixed_random.seed(FIXED_RANDOM_SEED, version=1)
seq = list(seq)
fixed_random.shuffle(seq)
return seq
from __future__ import annotations
import multiproces... | pre_commit/languages/helpers.py |
End of preview. Expand in Data Studio
README.md exists but content is empty.
- Downloads last month
- 22