_id
stringlengths
2
7
title
stringlengths
1
88
partition
stringclasses
3 values
text
stringlengths
31
13.1k
language
stringclasses
1 value
meta_information
dict
q26500
_arithmetic_helper
train
def _arithmetic_helper( a: "BitVecFunc", b: Union[BitVec, int], operation: Callable ) -> "BitVecFunc": """ Helper function for arithmetic operations on BitVecFuncs. :param a: The BitVecFunc to perform the operation on. :param b: A BitVec or int to perform the operation on. :param operation: The...
python
{ "resource": "" }
q26501
_comparison_helper
train
def _comparison_helper( a: "BitVecFunc", b: Union[BitVec, int], operation: Callable, default_value: bool, inputs_equal: bool, ) -> Bool: """ Helper function for comparison operations with BitVecFuncs. :param a: The BitVecFunc to compare. :param b: A BitVec or int to compare to. ...
python
{ "resource": "" }
q26502
Expression.annotate
train
def annotate(self, annotation: Any) -> None: """Annotates this expression with the given annotation. :param annotation:
python
{ "resource": "" }
q26503
Expression.simplify
train
def simplify(self) -> None: """Simplify this expression."""
python
{ "resource": "" }
q26504
execute_message_call
train
def execute_message_call( laser_evm, callee_address, caller_address, origin_address, code, data, gas_limit, gas_price, value, track_gas=False, ) -> Union[None, List[GlobalState]]: """Execute a message call transaction from all open states. :param laser_evm: :param ca...
python
{ "resource": "" }
q26505
detect_mode
train
def detect_mode(term_hint="xterm-256color"): """Poor-mans color mode detection.""" if "ANSICON" in os.environ: return 16 elif os.environ.get("ConEmuANSI", "OFF") == "ON": return 256 else: term = os.environ.get("TERM", term_hint) if term.endswith("-256color")
python
{ "resource": "" }
q26506
Account.blank_account
train
def blank_account(cls, db, addr, initial_nonce=0): """creates a blank account. :param db: :param addr: :param initial_nonce: :return: """ db.put(BLANK_HASH, b"")
python
{ "resource": "" }
q26507
State.get_and_cache_account
train
def get_and_cache_account(self, addr): """Gets and caches an account for an addres, creates blank if not found. :param addr: :return: """ if addr in self.cache: return self.cache[addr] rlpdata = self.secure_trie.get(addr) if ( rlp...
python
{ "resource": "" }
q26508
State.get_all_accounts
train
def get_all_accounts(self): """iterates through trie to and yields non-blank leafs as accounts.""" for address_hash, rlpdata in self.secure_trie.trie.iter_branch(): if rlpdata !=
python
{ "resource": "" }
q26509
BaseCalldata.get_word_at
train
def get_word_at(self, offset: int) -> Expression: """Gets word at offset.
python
{ "resource": "" }
q26510
MutationPruner.initialize
train
def initialize(self, symbolic_vm: LaserEVM): """Initializes the mutation pruner Introduces hooks for SSTORE operations :param symbolic_vm: :return: """ @symbolic_vm.pre_hook("SSTORE") def mutator_hook(global_state: GlobalState): global_state.annotate...
python
{ "resource": "" }
q26511
CoverageStrategy._is_covered
train
def _is_covered(self, global_state: GlobalState) -> bool: """ Checks if the instruction for the given global state is already covered""" bytecode = global_state.environment.code.bytecode
python
{ "resource": "" }
q26512
_SmtSymbolFactory.BitVecFuncVal
train
def BitVecFuncVal( value: int, func_name: str, size: int, annotations: Annotations = None, input_: Union[int, "BitVec"] = None, ) -> BitVecFunc:
python
{ "resource": "" }
q26513
MachineState.mem_extend
train
def mem_extend(self, start: int, size: int) -> None: """Extends the memory of this machine state. :param start: Start of memory extension :param size: Size of memory extension """ m_extend = self.calculate_extension_size(start, size) if m_extend:
python
{ "resource": "" }
q26514
MachineState.memory_write
train
def memory_write(self, offset: int, data: List[Union[int, BitVec]]) -> None: """Writes data to memory starting at offset. :param offset: :param data: """
python
{ "resource": "" }
q26515
MachineState.pop
train
def pop(self, amount=1) -> Union[BitVec, List[BitVec]]: """Pops amount elements from the stack. :param amount: :return: """ if amount > len(self.stack): raise StackUnderflowException
python
{ "resource": "" }
q26516
If
train
def If(a: Union[Bool, bool], b: Union[BitVec, int], c: Union[BitVec, int]) -> BitVec: """Create an if-then-else expression. :param a: :param b: :param c: :return: """ # TODO: Handle BitVecFunc if not isinstance(a, Bool): a = Bool(z3.BoolVal(a)) if not isinstance(b, BitVec):...
python
{ "resource": "" }
q26517
UGT
train
def UGT(a: BitVec, b: BitVec) -> Bool: """Create an unsigned greater than expression. :param a: :param b: :return:
python
{ "resource": "" }
q26518
UGE
train
def UGE(a: BitVec, b: BitVec) -> Bool: """Create an unsigned greater or
python
{ "resource": "" }
q26519
ULE
train
def ULE(a: BitVec, b: BitVec) -> Bool: """Create an unsigned less than expression. :param a: :param b:
python
{ "resource": "" }
q26520
Concat
train
def Concat(*args: Union[BitVec, List[BitVec]]) -> BitVec: """Create a concatenation expression. :param args: :return: """ # The following statement is used if a list is provided as an argument to concat if len(args) == 1 and isinstance(args[0], list): bvs = args[0] # type: List[BitVec]...
python
{ "resource": "" }
q26521
Extract
train
def Extract(high: int, low: int, bv: BitVec) -> BitVec: """Create an extract expression. :param high: :param low: :param bv: :return: """ raw = z3.Extract(high, low, bv.raw) if isinstance(bv, BitVecFunc): # Is there a better value to set func_name and input to in this case?
python
{ "resource": "" }
q26522
URem
train
def URem(a: BitVec, b: BitVec) -> BitVec: """Create an unsigned remainder expression. :param a: :param b:
python
{ "resource": "" }
q26523
SRem
train
def SRem(a: BitVec, b: BitVec) -> BitVec: """Create a signed remainder expression. :param a: :param b:
python
{ "resource": "" }
q26524
UDiv
train
def UDiv(a: BitVec, b: BitVec) -> BitVec: """Create an unsigned division expression. :param a: :param b:
python
{ "resource": "" }
q26525
Sum
train
def Sum(*args: BitVec) -> BitVec: """Create sum expression. :return: """ raw = z3.Sum([a.raw for a in args]) annotations = [] # type: Annotations bitvecfuncs = [] for bv in args: annotations += bv.annotations if isinstance(bv, BitVecFunc): bitvecfuncs.append(bv...
python
{ "resource": "" }
q26526
BVAddNoOverflow
train
def BVAddNoOverflow(a: Union[BitVec, int], b: Union[BitVec, int], signed: bool) -> Bool: """Creates predicate that verifies that the addition doesn't overflow. :param a: :param b: :param signed: :return: """ if not isinstance(a, BitVec):
python
{ "resource": "" }
q26527
BitVec.symbolic
train
def symbolic(self) -> bool: """Returns whether this symbol doesn't have a concrete value. :return:
python
{ "resource": "" }
q26528
BitVec.value
train
def value(self) -> Optional[int]: """Returns the value of this symbol if concrete, otherwise None. :return: """ if self.symbolic:
python
{ "resource": "" }
q26529
MessageCallTransaction.initial_global_state
train
def initial_global_state(self) -> GlobalState: """Initialize the execution environment.""" environment = Environment( self.callee_account, self.caller, self.call_data, self.gas_price, self.call_value,
python
{ "resource": "" }
q26530
Issue._set_internal_compiler_error
train
def _set_internal_compiler_error(self): """ Adds the false positive to description and changes severity to low """ self.severity = "Low"
python
{ "resource": "" }
q26531
Report.as_swc_standard_format
train
def as_swc_standard_format(self): """Format defined for integration and correlation. :return: """ _issues = [] source_list = [] for key, issue in self.issues.items(): idx = self.source.get_source_index(issue.bytecode_hash) try: t...
python
{ "resource": "" }
q26532
Instruction.evaluate
train
def evaluate(self, global_state: GlobalState, post=False) -> List[GlobalState]: """Performs the mutation for this instruction. :param global_state: :param post: :return: """ # Generalize some ops log.debug("Evaluating {}".format(self.op_code)) op = self.o...
python
{ "resource": "" }
q26533
Optimize.minimize
train
def minimize(self, element: Expression[z3.ExprRef]) -> None: """In solving this solver
python
{ "resource": "" }
q26534
Optimize.maximize
train
def maximize(self, element: Expression[z3.ExprRef]) -> None: """In solving this solver
python
{ "resource": "" }
q26535
Model.decls
train
def decls(self) -> List[z3.ExprRef]: """Get the declarations for this model""" result =
python
{ "resource": "" }
q26536
Model.eval
train
def eval( self, expression: z3.ExprRef, model_completion: bool = False ) -> Union[None, z3.ExprRef]: """ Evaluate the expression using this model :param expression: The expression to evaluate :param model_completion: Use the default value if the model has no interpretation of the gi...
python
{ "resource": "" }
q26537
LaserEVM._execute_transactions
train
def _execute_transactions(self, address): """This function executes multiple transactions on the address :param address: Address of the contract :return: """ for i in range(self.transaction_count): self.time = datetime.now() log.info( "Sta...
python
{ "resource": "" }
q26538
LaserEVM._add_world_state
train
def _add_world_state(self, global_state: GlobalState): """ Stores the world_state of the passed global state in the open states""" for hook in self._add_world_state_hooks: try: hook(global_state)
python
{ "resource": "" }
q26539
LaserEVM.register_laser_hooks
train
def register_laser_hooks(self, hook_type: str, hook: Callable): """registers the hook with this Laser VM""" if hook_type == "add_world_state": self._add_world_state_hooks.append(hook) elif hook_type == "execute_state": self._execute_state_hooks.append(hook) elif h...
python
{ "resource": "" }
q26540
LaserEVM.laser_hook
train
def laser_hook(self, hook_type: str) -> Callable: """Registers the annotated function with register_laser_hooks :param hook_type: :return: hook decorator """ def hook_decorator(func: Callable): """ Hook decorator generated by laser_hook
python
{ "resource": "" }
q26541
GlobalState.get_current_instruction
train
def get_current_instruction(self) -> Dict: """Gets the current instruction for this GlobalState. :return:
python
{ "resource": "" }
q26542
OAuthHandler.get_oauth_request
train
def get_oauth_request(self): """Return an OAuth Request object for the current request.""" try: method = os.environ['REQUEST_METHOD'] except: method = 'GET' postdata = None if
python
{ "resource": "" }
q26543
OAuthHandler.get_client
train
def get_client(self, request=None): """Return the client from the OAuth parameters.""" if not isinstance(request, oauth.Request): request = self.get_oauth_request() client_key = request.get_parameter('oauth_consumer_key') if not client_key: raise Exception('Missi...
python
{ "resource": "" }
q26544
OAuthHandler.is_valid
train
def is_valid(self): """Returns a Client object if this is a valid OAuth request.""" try: request = self.get_oauth_request() client = self.get_client(request)
python
{ "resource": "" }
q26545
to_unicode_optional_iterator
train
def to_unicode_optional_iterator(x): """ Raise TypeError if x is a str containing non-utf8 bytes or if x is an iterable which contains such a str. """ if isinstance(x, STRING_TYPES): return to_unicode(x) try: l =
python
{ "resource": "" }
q26546
to_utf8_optional_iterator
train
def to_utf8_optional_iterator(x): """ Raise TypeError if x is a str or if x is an iterable which contains a str. """ if isinstance(x, STRING_TYPES): return to_utf8(x) try: l = list(x) except TypeError as e:
python
{ "resource": "" }
q26547
generate_nonce
train
def generate_nonce(length=8): """Generate pseudorandom number."""
python
{ "resource": "" }
q26548
Token.to_string
train
def to_string(self): """Returns this token as a plain string, suitable for storage. The resulting string includes the token's secret, so you should never send or store this string where a third party can
python
{ "resource": "" }
q26549
Request.get_nonoauth_parameters
train
def get_nonoauth_parameters(self): """Get any non-OAuth parameters."""
python
{ "resource": "" }
q26550
Request.to_header
train
def to_header(self, realm=''): """Serialize as a header for an HTTPAuth request.""" oauth_params = ((k, v) for k, v in self.items() if k.startswith('oauth_')) stringy_params = ((k, escape(v)) for k, v in oauth_params) header_params = ('%s="%s"' % (k, v) for k...
python
{ "resource": "" }
q26551
Request.get_normalized_parameters
train
def get_normalized_parameters(self): """Return a string that contains the parameters that must be signed.""" items = [] for key, value in self.items(): if key == 'oauth_signature': continue # 1.0a/9.1.1 states that kvp must be sorted by key, then by value,...
python
{ "resource": "" }
q26552
Request.sign_request
train
def sign_request(self, signature_method, consumer, token): """Set the signature parameter to the result of sign.""" if not self.is_form_encoded: # according to # http://oauth.googlecode.com/svn/spec/ext/body_hash/1.0/oauth-bodyhash.html # section 4.1.1 "OAuth Consume...
python
{ "resource": "" }
q26553
Request.from_request
train
def from_request(cls, http_method, http_url, headers=None, parameters=None, query_string=None): """Combines multiple parameter sources.""" if parameters is None: parameters = {} # Headers if headers: auth_header = None for k, v in headers...
python
{ "resource": "" }
q26554
Request._split_url_string
train
def _split_url_string(param_str): """Turn URL string into parameters.""" if not PY3: # If passed unicode with quoted UTF8, Python2's parse_qs leaves # mojibake'd uniocde after unquoting, so encode first. param_str = b(param_str, 'utf-8') parameters = parse_qs(...
python
{ "resource": "" }
q26555
Server.verify_request
train
def verify_request(self, request, consumer, token): """Verifies an api call and checks all the parameters.""" self._check_version(request)
python
{ "resource": "" }
q26556
Server._check_version
train
def _check_version(self, request): """Verify the correct version of the request for this server.""" version = self._get_version(request) if
python
{ "resource": "" }
q26557
Server._get_signature_method
train
def _get_signature_method(self, request): """Figure out the signature with some defaults.""" signature_method = request.get('oauth_signature_method') if signature_method is None: signature_method = SIGNATURE_METHOD try: # Get the signature method object. ...
python
{ "resource": "" }
q26558
Server._check_timestamp
train
def _check_timestamp(self, timestamp): """Verify that timestamp is recentish.""" timestamp = int(timestamp) now = int(time.time()) lapsed = now -
python
{ "resource": "" }
q26559
SignatureMethod_HMAC_SHA1.sign
train
def sign(self, request, consumer, token): """Builds the base signature string.""" key, raw = self.signing_base(request, consumer, token) hashed = hmac.new(key, raw, sha1)
python
{ "resource": "" }
q26560
SignatureMethod_PLAINTEXT.signing_base
train
def signing_base(self, request, consumer, token): """Concatenates the consumer key and secret with the token's secret."""
python
{ "resource": "" }
q26561
_safe_timezone
train
def _safe_timezone(obj): # type: (Union[str, int, float, _datetime.tzinfo]) -> _Timezone """ Creates a timezone instance from a string, Timezone, TimezoneInfo or integer offset. """ if isinstance(obj, _Timezone): return obj if obj is None or obj == "local": return local_time...
python
{ "resource": "" }
q26562
datetime
train
def datetime( year, # type: int month, # type: int day, # type: int hour=0, # type: int minute=0, # type: int second=0, # type: int microsecond=0, # type: int tz=UTC, # type: Union[str, _Timezone] dst_rule=POST_TRANSITION, # type: str ): # type: (...) -> DateTime """ ...
python
{ "resource": "" }
q26563
local
train
def local( year, month, day, hour=0, minute=0, second=0, microsecond=0 ): # type: (int, int, int, int, int, int, int) -> DateTime """ Return a DateTime in the local timezone.
python
{ "resource": "" }
q26564
naive
train
def naive( year, month, day, hour=0, minute=0, second=0, microsecond=0 ): # type: (int, int, int, int, int, int, int) -> DateTime """ Return a naive
python
{ "resource": "" }
q26565
time
train
def time(hour, minute=0, second=0, microsecond=0): # type: (int, int, int, int) -> Time """ Create a new Time instance.
python
{ "resource": "" }
q26566
instance
train
def instance( dt, tz=UTC # type: _datetime.datetime # type: Union[str, _Timezone, None] ): # type: (...) -> DateTime """ Create a DateTime instance from a datetime one. """ if not isinstance(dt, _datetime.datetime): raise ValueError("instance() only accepts datetime objects.") if isi...
python
{ "resource": "" }
q26567
now
train
def now(tz=None): # type: (Union[str, _Timezone, None]) -> DateTime """ Get a DateTime instance for the current date and time. """ if has_test_now(): test_instance = get_test_now() _tz = _safe_timezone(tz) if tz is not None and _tz != test_instance.timezone: test_in...
python
{ "resource": "" }
q26568
from_format
train
def from_format( string, # type: str fmt, # type: str tz=UTC, # type: Union[str, _Timezone] locale=None, # type: Union[str, None] ): # type: (...) ->
python
{ "resource": "" }
q26569
from_timestamp
train
def from_timestamp( timestamp, tz=UTC # type: Union[int, float] # type: Union[str, _Timezone] ): # type: (...) -> DateTime """ Create a DateTime instance from a timestamp.
python
{ "resource": "" }
q26570
duration
train
def duration( days=0, # type: float seconds=0, # type: float microseconds=0, # type: float milliseconds=0, # type: float minutes=0, # type: float hours=0, # type: float weeks=0, # type: float years=0, # type: float months=0, # type: float ): # type: (...) -> Duration ""...
python
{ "resource": "" }
q26571
period
train
def period( start, end, absolute=False # type: DateTime # type: DateTime # type: bool ): # type: (...) -> Period """ Create
python
{ "resource": "" }
q26572
_divide_and_round
train
def _divide_and_round(a, b): """divide a by b and round result to the nearest integer When the ratio is exactly half-way between two integers, the even integer is returned. """ # Based on the reference implementation for divmod_near # in Objects/longobject.c. q, r = divmod(a, b) # round...
python
{ "resource": "" }
q26573
Duration.in_words
train
def in_words(self, locale=None, separator=" "): """ Get the current interval in words in the current locale. Ex: 6 jours 23 heures 58 minutes :param locale: The locale to use. Defaults to current locale. :type locale: str :param separator: The separator to use between ...
python
{ "resource": "" }
q26574
DifferenceFormatter.format
train
def format(self, diff, is_now=True, absolute=False, locale=None): """ Formats a difference. :param diff: The difference to format :type diff: pendulum.period.Period :param is_now: Whether the difference includes now :type is_now: bool :param absolute: Whether i...
python
{ "resource": "" }
q26575
Time.closest
train
def closest(self, dt1, dt2): """ Get the closest time from the instance. :type dt1: Time or time :type dt2: Time or time :rtype: Time """ dt1 = self.__class__(dt1.hour, dt1.minute, dt1.second, dt1.microsecond)
python
{ "resource": "" }
q26576
Time.diff
train
def diff(self, dt=None, abs=True): """ Returns the difference between two Time objects as an Duration. :type dt: Time or None :param abs: Whether to return an absolute interval or not :type abs: bool :rtype: Duration """ if dt is None: dt = ...
python
{ "resource": "" }
q26577
Reader.read_for
train
def read_for(self, timezone): # type: (str) -> Timezone """ Read the zoneinfo structure for a given timezone name. :param timezone: The timezone. """ try: file_path = pytzdata.tz_path(timezone)
python
{ "resource": "" }
q26578
Reader.read
train
def read(self, file_path): # type: (str) -> Timezone """ Read a zoneinfo structure from the given path. :param file_path: The path of a zoneinfo file. """ if not os.path.exists(file_path):
python
{ "resource": "" }
q26579
Reader._check_read
train
def _check_read(self, fd, nbytes): # type: (...) -> bytes """ Reads the given number of bytes from the given file and checks that the correct number of bytes could be read. """ result = fd.read(nbytes) if (not result and nbytes > 0) or len(result) != nbytes: ...
python
{ "resource": "" }
q26580
Reader._parse
train
def _parse(self, fd): # type: (...) -> Timezone """ Parse a zoneinfo file. """ hdr = self._parse_header(fd) if hdr.version in (2, 3): # We're skipping the entire v1 file since # at least the same data will be found in TZFile 2. fd.seek( ...
python
{ "resource": "" }
q26581
timezone
train
def timezone(name, extended=True): # type: (Union[str, int]) -> _Timezone """ Return a Timezone instance given its name. """ if isinstance(name, int): return fixed_timezone(name) if name.lower() == "utc": return UTC if
python
{ "resource": "" }
q26582
fixed_timezone
train
def fixed_timezone(offset): # type: (int) -> _FixedTimezone """ Return a Timezone instance given its offset in seconds. """ if offset in _tz_cache:
python
{ "resource": "" }
q26583
Timezone.convert
train
def convert( self, dt, dst_rule=None # type: datetime # type: Union[str, None] ): # type: (...) -> datetime """ Converts a datetime in the current timezone. If the datetime is naive, it will be normalized. >>> from datetime import datetime >>> from pendulum impor...
python
{ "resource": "" }
q26584
Timezone.datetime
train
def datetime( self, year, month, day, hour=0, minute=0, second=0, microsecond=0 ): # type: (int, int, int, int, int, int, int) -> datetime """ Return a normalized datetime for the current timezone. """ if _HAS_FOLD: return self.convert(
python
{ "resource": "" }
q26585
DateTime.naive
train
def naive(self): # type: () -> DateTime """ Return the DateTime without timezone information. """ return self.__class__( self.year, self.month,
python
{ "resource": "" }
q26586
DateTime.on
train
def on(self, year, month, day): """ Returns a new instance with the current date set to a different date. :param year: The year :type year: int :param month: The month :type month: int
python
{ "resource": "" }
q26587
DateTime.at
train
def at(self, hour, minute=0, second=0, microsecond=0): """ Returns a new instance with the current time to a different time. :param hour: The hour :type hour: int :param minute: The minute :type minute: int :param second: The second :type second:
python
{ "resource": "" }
q26588
DateTime.in_timezone
train
def in_timezone(self, tz): # type: (Union[str, Timezone]) -> DateTime """ Set the instance's timezone from a string or object. """
python
{ "resource": "" }
q26589
DateTime.to_iso8601_string
train
def to_iso8601_string(self): """ Format the instance as ISO 8601. :rtype: str """ string = self._to_string("iso8601")
python
{ "resource": "" }
q26590
DateTime._to_string
train
def _to_string(self, fmt, locale=None): """ Format the instance to a common string format. :param fmt: The name of the string format :type fmt: string :param locale: The locale to use
python
{ "resource": "" }
q26591
DateTime.is_long_year
train
def is_long_year(self): """ Determines if the instance is a long year See link `https://en.wikipedia.org/wiki/ISO_8601#Week_dates`_ :rtype: bool """ return (
python
{ "resource": "" }
q26592
DateTime.is_same_day
train
def is_same_day(self, dt): """ Checks if the passed in date is the same day as the instance current day. :type dt: DateTime or datetime or str or int :rtype: bool
python
{ "resource": "" }
q26593
DateTime.add
train
def add( self, years=0, months=0, weeks=0, days=0, hours=0, minutes=0, seconds=0, microseconds=0, ): # type: (int, int, int, int, int, int, int) -> DateTime """ Add a duration to the instance. If we're adding units of ...
python
{ "resource": "" }
q26594
DateTime.diff
train
def diff(self, dt=None, abs=True): """ Returns the difference between two DateTime objects represented as a Duration. :type dt: DateTime or None :param abs: Whether to return an absolute interval or not :type abs: bool
python
{ "resource": "" }
q26595
DateTime.next
train
def next(self, day_of_week=None, keep_time=False): """ Modify to the next occurrence of a given day of the week. If no day_of_week is provided, modify to the next occurrence of the current day of the week. Use the supplied consts to indicate the desired day_of_week, ex. DateTime...
python
{ "resource": "" }
q26596
DateTime.previous
train
def previous(self, day_of_week=None, keep_time=False): """ Modify to the previous occurrence of a given day of the week. If no day_of_week is provided, modify to the previous occurrence of the current day of the week. Use the supplied consts to indicate the desired day_of_week, ...
python
{ "resource": "" }
q26597
DateTime.first_of
train
def first_of(self, unit, day_of_week=None): """ Returns an instance set to the first occurrence of a given day of the week in the current unit. If no day_of_week is provided, modify to the first day of the unit. Use the supplied consts to indicate the desired day_of_week, ex. Dat...
python
{ "resource": "" }
q26598
DateTime.last_of
train
def last_of(self, unit, day_of_week=None): """ Returns an instance set to the last occurrence of a given day of the week in the current unit. If no day_of_week is provided, modify to the last day of the unit. Use the supplied consts to indicate the desired day_of_week, ex. DateTi...
python
{ "resource": "" }
q26599
DateTime.nth_of
train
def nth_of(self, unit, nth, day_of_week): """ Returns a new instance set to the given occurrence of a given day of the week in the current unit. If the calculated occurrence is outside the scope of the current unit, then raise an error. Use the supplied consts to indicate...
python
{ "resource": "" }