_id stringlengths 2 7 | title stringlengths 1 88 | partition stringclasses 3
values | text stringlengths 31 13.1k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q29600 | StepContextPage.get_instance | train | def get_instance(self, payload):
"""
Build an instance of StepContextInstance
:param dict payload: Payload response from the API
:returns: twilio.rest.studio.v1.flow.engagement.step.step_context.StepContextInstance
:rtype: twilio.rest.studio.v1.flow.engagement.step.step_context... | python | {
"resource": ""
} |
q29601 | StepContextContext.fetch | train | def fetch(self):
"""
Fetch a StepContextInstance
:returns: Fetched StepContextInstance
:rtype: twilio.rest.studio.v1.flow.engagement.step.step_context.StepContextInstance
"""
params = values.of({})
payload = self._version.fetch(
'GET',
se... | python | {
"resource": ""
} |
q29602 | format_language | train | def format_language(language):
"""
Attempt to format language parameter as 'ww-WW'.
:param string language: language parameter
"""
if not language:
return language
if not | python | {
"resource": ""
} |
q29603 | TwiML.to_xml | train | def to_xml(self, xml_declaration=True):
"""
Return the contents of this verb as an XML string
:param bool xml_declaration: Include the XML declaration. Defaults to True
"""
| python | {
"resource": ""
} |
q29604 | TodayPage.get_instance | train | def get_instance(self, payload):
"""
Build an instance of TodayInstance
:param dict payload: Payload response from the API
:returns: twilio.rest.api.v2010.account.usage.record.today.TodayInstance
:rtype: | python | {
"resource": ""
} |
q29605 | AssistantFallbackActionsPage.get_instance | train | def get_instance(self, payload):
"""
Build an instance of AssistantFallbackActionsInstance
:param dict payload: Payload response from the API
:returns: twilio.rest.preview.understand.assistant.assistant_fallback_actions.AssistantFallbackActionsInstance
:rtype: | python | {
"resource": ""
} |
q29606 | NewSigningKeyPage.get_instance | train | def get_instance(self, payload):
"""
Build an instance of NewSigningKeyInstance
:param dict payload: Payload response from the API
:returns: twilio.rest.api.v2010.account.new_signing_key.NewSigningKeyInstance
:rtype: | python | {
"resource": ""
} |
q29607 | ConnectAppList.get | train | def get(self, sid):
"""
Constructs a ConnectAppContext
:param sid: The unique string that identifies the resource
:returns: twilio.rest.api.v2010.account.connect_app.ConnectAppContext
:rtype: | python | {
"resource": ""
} |
q29608 | ConnectAppPage.get_instance | train | def get_instance(self, payload):
"""
Build an instance of ConnectAppInstance
:param dict payload: Payload response from the API
:returns: twilio.rest.api.v2010.account.connect_app.ConnectAppInstance
| python | {
"resource": ""
} |
q29609 | FieldValueList.create | train | def create(self, language, value, synonym_of=values.unset):
"""
Create a new FieldValueInstance
:param unicode language: The ISO language-country tag that identifies the language of the value
:param unicode value: The Field Value data
:param unicode synonym_of: The string value ... | python | {
"resource": ""
} |
q29610 | FieldValueList.get | train | def get(self, sid):
"""
Constructs a FieldValueContext
:param sid: The unique string that identifies the resource
:returns: twilio.rest.autopilot.v1.assistant.field_type.field_value.FieldValueContext
:rtype: twilio.rest.autopilot.v1.assistant.field_type.field_value.FieldValueCo... | python | {
"resource": ""
} |
q29611 | FieldValuePage.get_instance | train | def get_instance(self, payload):
"""
Build an instance of FieldValueInstance
:param dict payload: Payload response from the API
:returns: twilio.rest.autopilot.v1.assistant.field_type.field_value.FieldValueInstance
:rtype: twilio.rest.autopilot.v1.assistant.field_type.field_val... | python | {
"resource": ""
} |
q29612 | FieldValueContext.fetch | train | def fetch(self):
"""
Fetch a FieldValueInstance
:returns: Fetched FieldValueInstance
:rtype: twilio.rest.autopilot.v1.assistant.field_type.field_value.FieldValueInstance
"""
params = values.of({})
payload = self._version.fetch(
'GET',
sel... | python | {
"resource": ""
} |
q29613 | RatePlanList.create | train | def create(self, unique_name=values.unset, friendly_name=values.unset,
data_enabled=values.unset, data_limit=values.unset,
data_metering=values.unset, messaging_enabled=values.unset,
voice_enabled=values.unset, national_roaming_enabled=values.unset,
internatio... | python | {
"resource": ""
} |
q29614 | ReservationContext.fetch | train | def fetch(self):
"""
Fetch a ReservationInstance
:returns: Fetched ReservationInstance
:rtype: twilio.rest.taskrouter.v1.workspace.task.reservation.ReservationInstance
"""
params = values.of({})
payload = self._version.fetch(
'GET',
self.... | python | {
"resource": ""
} |
q29615 | AlertList.page | train | def page(self, log_level=values.unset, start_date=values.unset,
end_date=values.unset, page_token=values.unset,
page_number=values.unset, page_size=values.unset):
"""
Retrieve a single page of AlertInstance records from the API.
Request is executed immediately
... | python | {
"resource": ""
} |
q29616 | PublicKeyList.create | train | def create(self, public_key, friendly_name=values.unset,
account_sid=values.unset):
"""
Create a new PublicKeyInstance
:param unicode public_key: A URL encoded representation of the public key
:param unicode friendly_name: A string to describe the resource
:param ... | python | {
"resource": ""
} |
q29617 | TollFreePage.get_instance | train | def get_instance(self, payload):
"""
Build an instance of TollFreeInstance
:param dict payload: Payload response from the API
:returns: twilio.rest.api.v2010.account.available_phone_number.toll_free.TollFreeInstance
| python | {
"resource": ""
} |
q29618 | TaskList.stream | train | def stream(self, priority=values.unset, assignment_status=values.unset,
workflow_sid=values.unset, workflow_name=values.unset,
task_queue_sid=values.unset, task_queue_name=values.unset,
evaluate_task_attributes=values.unset, ordering=values.unset,
has_addons=v... | python | {
"resource": ""
} |
q29619 | TaskList.page | train | def page(self, priority=values.unset, assignment_status=values.unset,
workflow_sid=values.unset, workflow_name=values.unset,
task_queue_sid=values.unset, task_queue_name=values.unset,
evaluate_task_attributes=values.unset, ordering=values.unset,
has_addons=values.unse... | python | {
"resource": ""
} |
q29620 | StreamMessageList.create | train | def create(self, data):
"""
Create a new StreamMessageInstance
:param dict data: Stream Message body.
:returns: Newly created StreamMessageInstance
:rtype: twilio.rest.sync.v1.service.sync_stream.stream_message.StreamMessageInstance
"""
data = values.of({'Data':... | python | {
"resource": ""
} |
q29621 | StreamMessagePage.get_instance | train | def get_instance(self, payload):
"""
Build an instance of StreamMessageInstance
:param dict payload: Payload response from the API
:returns: twilio.rest.sync.v1.service.sync_stream.stream_message.StreamMessageInstance
:rtype: twilio.rest.sync.v1.service.sync_stream.stream_messa... | python | {
"resource": ""
} |
q29622 | EnvironmentList.create | train | def create(self, unique_name, domain_suffix=values.unset):
"""
Create a new EnvironmentInstance
:param unicode unique_name: The unique_name
:param unicode domain_suffix: The domain_suffix
:returns: Newly created EnvironmentInstance
:rtype: twilio.rest.serverless.v1.serv... | python | {
"resource": ""
} |
q29623 | EnvironmentList.get | train | def get(self, sid):
"""
Constructs a EnvironmentContext
:param sid: The sid
:returns: twilio.rest.serverless.v1.service.environment.EnvironmentContext
:rtype: | python | {
"resource": ""
} |
q29624 | EnvironmentPage.get_instance | train | def get_instance(self, payload):
"""
Build an instance of EnvironmentInstance
:param dict payload: Payload response from the API
:returns: twilio.rest.serverless.v1.service.environment.EnvironmentInstance
:rtype: | python | {
"resource": ""
} |
q29625 | EnvironmentContext.variables | train | def variables(self):
"""
Access the variables
:returns: twilio.rest.serverless.v1.service.environment.variable.VariableList
:rtype: twilio.rest.serverless.v1.service.environment.variable.VariableList
"""
if self._variables is None:
self._variables = VariableL... | python | {
"resource": ""
} |
q29626 | ExecutionList.stream | train | def stream(self, date_created_from=values.unset, date_created_to=values.unset,
limit=None, page_size=None):
"""
Streams ExecutionInstance records from the API as a generator stream.
This operation lazily loads records as efficiently as possible until the limit
is reached.
... | python | {
"resource": ""
} |
q29627 | ExecutionList.page | train | def page(self, date_created_from=values.unset, date_created_to=values.unset,
page_token=values.unset, page_number=values.unset,
page_size=values.unset):
"""
Retrieve a single page of ExecutionInstance records from the API.
Request is executed immediately
:param... | python | {
"resource": ""
} |
q29628 | ExecutionList.create | train | def create(self, to, from_, parameters=values.unset):
"""
Create a new ExecutionInstance
:param unicode to: The Contact phone number to start a Studio Flow Execution.
:param unicode from_: The Twilio phone number to send messages or initiate calls from during the Flow Execution.
... | python | {
"resource": ""
} |
q29629 | ExecutionList.get | train | def get(self, sid):
"""
Constructs a ExecutionContext
:param sid: Execution Sid.
:returns: twilio.rest.studio.v1.flow.execution.ExecutionContext
:rtype: | python | {
"resource": ""
} |
q29630 | ExecutionPage.get_instance | train | def get_instance(self, payload):
"""
Build an instance of ExecutionInstance
:param dict payload: Payload response from the API
:returns: twilio.rest.studio.v1.flow.execution.ExecutionInstance
| python | {
"resource": ""
} |
q29631 | ExecutionContext.fetch | train | def fetch(self):
"""
Fetch a ExecutionInstance
:returns: Fetched ExecutionInstance
:rtype: twilio.rest.studio.v1.flow.execution.ExecutionInstance
"""
params = values.of({})
| python | {
"resource": ""
} |
q29632 | ExecutionContext.execution_context | train | def execution_context(self):
"""
Access the execution_context
:returns: twilio.rest.studio.v1.flow.execution.execution_context.ExecutionContextList
:rtype: twilio.rest.studio.v1.flow.execution.execution_context.ExecutionContextList
"""
if self._execution_context is None:... | python | {
"resource": ""
} |
q29633 | ExecutionContextList.get | train | def get(self):
"""
Constructs a ExecutionContextContext
:returns: twilio.rest.studio.v1.flow.execution.execution_context.ExecutionContextContext
:rtype: twilio.rest.studio.v1.flow.execution.execution_context.ExecutionContextContext
"""
| python | {
"resource": ""
} |
q29634 | ExecutionContextPage.get_instance | train | def get_instance(self, payload):
"""
Build an instance of ExecutionContextInstance
:param dict payload: Payload response from the API
:returns: twilio.rest.studio.v1.flow.execution.execution_context.ExecutionContextInstance
:rtype: twilio.rest.studio.v1.flow.execution.execution... | python | {
"resource": ""
} |
q29635 | ExecutionContextContext.fetch | train | def fetch(self):
"""
Fetch a ExecutionContextInstance
:returns: Fetched ExecutionContextInstance
:rtype: twilio.rest.studio.v1.flow.execution.execution_context.ExecutionContextInstance
"""
params = values.of({})
payload = self._version.fetch(
'GET',
... | python | {
"resource": ""
} |
q29636 | WebhookList.create | train | def create(self, target, configuration_url=values.unset,
configuration_method=values.unset,
configuration_filters=values.unset,
configuration_triggers=values.unset,
configuration_flow_sid=values.unset,
configuration_retry_count=values.unset,
... | python | {
"resource": ""
} |
q29637 | SharedCostList.page | train | def page(self, area_code=values.unset, contains=values.unset,
sms_enabled=values.unset, mms_enabled=values.unset,
voice_enabled=values.unset, exclude_all_address_required=values.unset,
exclude_local_address_required=values.unset,
exclude_foreign_address_required=value... | python | {
"resource": ""
} |
q29638 | SharedCostPage.get_instance | train | def get_instance(self, payload):
"""
Build an instance of SharedCostInstance
:param dict payload: Payload response from the API
:returns: twilio.rest.api.v2010.account.available_phone_number.shared_cost.SharedCostInstance
:rtype: twilio.rest.api.v2010.account.available_phone_nu... | python | {
"resource": ""
} |
q29639 | IpAccessControlListContext.ip_addresses | train | def ip_addresses(self):
"""
Access the ip_addresses
:returns: twilio.rest.api.v2010.account.sip.ip_access_control_list.ip_address.IpAddressList
:rtype: twilio.rest.api.v2010.account.sip.ip_access_control_list.ip_address.IpAddressList
"""
if self._ip_addresses is None:
... | python | {
"resource": ""
} |
q29640 | AssistantContext.assistant_fallback_actions | train | def assistant_fallback_actions(self):
"""
Access the assistant_fallback_actions
:returns: twilio.rest.preview.understand.assistant.assistant_fallback_actions.AssistantFallbackActionsList
:rtype: twilio.rest.preview.understand.assistant.assistant_fallback_actions.AssistantFallbackActions... | python | {
"resource": ""
} |
q29641 | AssistantContext.assistant_initiation_actions | train | def assistant_initiation_actions(self):
"""
Access the assistant_initiation_actions
:returns: twilio.rest.preview.understand.assistant.assistant_initiation_actions.AssistantInitiationActionsList
:rtype: twilio.rest.preview.understand.assistant.assistant_initiation_actions.AssistantIniti... | python | {
"resource": ""
} |
q29642 | AllTimePage.get_instance | train | def get_instance(self, payload):
"""
Build an instance of AllTimeInstance
:param dict payload: Payload response from the API
:returns: twilio.rest.api.v2010.account.usage.record.all_time.AllTimeInstance
:rtype: | python | {
"resource": ""
} |
q29643 | NotificationList.create | train | def create(self, body=values.unset, priority=values.unset, ttl=values.unset,
title=values.unset, sound=values.unset, action=values.unset,
data=values.unset, apn=values.unset, gcm=values.unset,
sms=values.unset, facebook_messenger=values.unset, fcm=values.unset,
... | python | {
"resource": ""
} |
q29644 | DataSessionList.stream | train | def stream(self, end=values.unset, start=values.unset, limit=None,
page_size=None):
"""
Streams DataSessionInstance records from the API as a generator stream.
This operation lazily loads records as efficiently as possible until the limit
is reached.
The results ar... | python | {
"resource": ""
} |
q29645 | DataSessionList.page | train | def page(self, end=values.unset, start=values.unset, page_token=values.unset,
page_number=values.unset, page_size=values.unset):
"""
Retrieve a single page of DataSessionInstance records from the API.
Request is executed immediately
:param datetime end: The end
:par... | python | {
"resource": ""
} |
q29646 | DataSessionPage.get_instance | train | def get_instance(self, payload):
"""
Build an instance of DataSessionInstance
:param dict payload: Payload response from the API
:returns: twilio.rest.wireless.v1.sim.data_session.DataSessionInstance
| python | {
"resource": ""
} |
q29647 | AddOnResultList.get | train | def get(self, sid):
"""
Constructs a AddOnResultContext
:param sid: The unique string that identifies the resource to fetch
:returns: twilio.rest.api.v2010.account.recording.add_on_result.AddOnResultContext
:rtype: twilio.rest.api.v2010.account.recording.add_on_result.AddOnResu... | python | {
"resource": ""
} |
q29648 | AddOnResultPage.get_instance | train | def get_instance(self, payload):
"""
Build an instance of AddOnResultInstance
:param dict payload: Payload response from the API
:returns: twilio.rest.api.v2010.account.recording.add_on_result.AddOnResultInstance
| python | {
"resource": ""
} |
q29649 | AddOnResultContext.fetch | train | def fetch(self):
"""
Fetch a AddOnResultInstance
:returns: Fetched AddOnResultInstance
:rtype: twilio.rest.api.v2010.account.recording.add_on_result.AddOnResultInstance
"""
params = values.of({})
payload = self._version.fetch(
'GET',
self... | python | {
"resource": ""
} |
q29650 | AddOnResultContext.payloads | train | def payloads(self):
"""
Access the payloads
:returns: twilio.rest.api.v2010.account.recording.add_on_result.payload.PayloadList
:rtype: twilio.rest.api.v2010.account.recording.add_on_result.payload.PayloadList
| python | {
"resource": ""
} |
q29651 | MonthlyPage.get_instance | train | def get_instance(self, payload):
"""
Build an instance of MonthlyInstance
:param dict payload: Payload response from the API
:returns: twilio.rest.api.v2010.account.usage.record.monthly.MonthlyInstance
:rtype: | python | {
"resource": ""
} |
q29652 | AvailableAddOnExtensionList.get | train | def get(self, sid):
"""
Constructs a AvailableAddOnExtensionContext
:param sid: The unique Extension Sid
:returns: twilio.rest.preview.marketplace.available_add_on.available_add_on_extension.AvailableAddOnExtensionContext
:rtype: twilio.rest.preview.marketplace.available_add_on... | python | {
"resource": ""
} |
q29653 | AvailableAddOnExtensionPage.get_instance | train | def get_instance(self, payload):
"""
Build an instance of AvailableAddOnExtensionInstance
:param dict payload: Payload response from the API
:returns: twilio.rest.preview.marketplace.available_add_on.available_add_on_extension.AvailableAddOnExtensionInstance
:rtype: twilio.rest... | python | {
"resource": ""
} |
q29654 | AvailableAddOnExtensionContext.fetch | train | def fetch(self):
"""
Fetch a AvailableAddOnExtensionInstance
:returns: Fetched AvailableAddOnExtensionInstance
:rtype: twilio.rest.preview.marketplace.available_add_on.available_add_on_extension.AvailableAddOnExtensionInstance
"""
params = values.of({})
payload ... | python | {
"resource": ""
} |
q29655 | EntityList.create | train | def create(self, identity):
"""
Create a new EntityInstance
:param unicode identity: Unique identity of the Entity
:returns: Newly created EntityInstance
:rtype: twilio.rest.authy.v1.service.entity.EntityInstance
"""
data = values.of({'Identity': identity, })
... | python | {
"resource": ""
} |
q29656 | EntityList.get | train | def get(self, identity):
"""
Constructs a EntityContext
:param identity: Unique identity of the Entity
:returns: twilio.rest.authy.v1.service.entity.EntityContext
| python | {
"resource": ""
} |
q29657 | EntityPage.get_instance | train | def get_instance(self, payload):
"""
Build an instance of EntityInstance
:param dict payload: Payload response from the API
:returns: twilio.rest.authy.v1.service.entity.EntityInstance
| python | {
"resource": ""
} |
q29658 | EntityContext.fetch | train | def fetch(self):
"""
Fetch a EntityInstance
:returns: Fetched EntityInstance
:rtype: twilio.rest.authy.v1.service.entity.EntityInstance
"""
params = values.of({})
payload = self._version.fetch(
'GET',
self._uri,
params=params,... | python | {
"resource": ""
} |
q29659 | EntityContext.factors | train | def factors(self):
"""
Access the factors
:returns: twilio.rest.authy.v1.service.entity.factor.FactorList
:rtype: twilio.rest.authy.v1.service.entity.factor.FactorList
| python | {
"resource": ""
} |
q29660 | stanc | train | def stanc(file=None, charset='utf-8', model_code=None, model_name="anon_model",
include_paths=None, verbose=False, obfuscate_model_name=True):
"""Translate Stan model specification into C++ code.
Parameters
----------
file : {string, file}, optional
If filename, the string passed as a... | python | {
"resource": ""
} |
q29661 | stan | train | def stan(file=None, model_name="anon_model", model_code=None, fit=None,
data=None, pars=None, chains=4, iter=2000, warmup=None, thin=1,
init="random", seed=None, algorithm=None, control=None, sample_file=None,
diagnostic_file=None, verbose=False, boost_lib=None, eigen_lib=None,
inclu... | python | {
"resource": ""
} |
q29662 | ess | train | def ess(sim, n):
"""Calculate effective sample size
Parameters
----------
sim : chains
n : int
Parameter index starting from 0
"""
try: | python | {
"resource": ""
} |
q29663 | traceplot | train | def traceplot(fit, pars, dtypes, **kwargs):
"""
Use pymc's traceplot to display parameters.
Additional arguments are passed to pymc.plots.traceplot.
"""
# FIXME: eventually put this in the StanFit object
# FIXME: write a to_pymc(_trace) function
# Deprecation warning added in PyStan 2.18
... | python | {
"resource": ""
} |
q29664 | autocorrplot | train | def autocorrplot(trace, vars=None, fontmap = None, max_lag=100):
"""Bar plot of the autocorrelation function for a trace"""
try:
# MultiTrace
traces = trace.traces
except AttributeError:
# NpTrace
traces = [trace]
if fontmap is None: fontmap = {1:10, 2:8, 3:6, 4:5, 5:... | python | {
"resource": ""
} |
q29665 | check_treedepth | train | def check_treedepth(fit, verbose=True, per_chain=False):
"""Check for transitions that ended prematurely due to maximum tree
depth limit
Parameters
----------
fit : StanFit4Model object
verbose : bool or int, optional
If ``verbose`` is ``False`` or a nonpositive integer, no
diag... | python | {
"resource": ""
} |
q29666 | check_n_eff | train | def check_n_eff(fit, pars=None, verbose=True):
"""Checks the effective sample size per iteration
Parameters
----------
fit : StanFit4Model object
pars : {str, sequence of str}, optional
Parameter (or quantile) name(s). Test only specific parameters.
Raises an exception if parameter ... | python | {
"resource": ""
} |
q29667 | check_hmc_diagnostics | train | def check_hmc_diagnostics(fit, pars=None, verbose=True, per_chain=False, checks=None):
"""Checks all hmc diagnostics
Parameters
----------
fit : StanFit4Model object
verbose : bool or int, optional
If ``verbose`` is ``False`` or a nonpositive integer, no
diagnostic messages are prin... | python | {
"resource": ""
} |
q29668 | stansummary | train | def stansummary(fit, pars=None, probs=(0.025, 0.25, 0.5, 0.75, 0.975), digits_summary=2):
"""
Summary statistic table.
Parameters
----------
fit : StanFit4Model object
pars : str or sequence of str, optional
Parameter names. By default use all parameters
probs : sequence of float, o... | python | {
"resource": ""
} |
q29669 | _array_to_table | train | def _array_to_table(arr, rownames, colnames, n_digits):
"""Print an array with row and column names
Example:
mean se_mean sd 2.5% 25% 50% 75% 97.5% n_eff Rhat
beta[1,1] 0.0 0.0 1.0 -2.0 -0.7 0.0 0.7 2.0 4000 1
beta[1,2] 0.0 0.0 1.0 -2.1 -0.7 0.0 0.7 2... | python | {
"resource": ""
} |
q29670 | _format_number_si | train | def _format_number_si(num, n_signif_figures):
"""Format a number using scientific notation to given significant figures"""
if math.isnan(num) or math.isinf(num):
return str(num)
leading, exp = '{:E}'.format(num).split('E')
| python | {
"resource": ""
} |
q29671 | _format_number | train | def _format_number(num, n_signif_figures, max_width):
"""Format a number as a string while obeying space constraints.
`n_signif_figures` is the minimum number of significant figures expressed
`max_width` is the maximum width in characters allowed
"""
if max_width < 6:
raise NotImplementedEr... | python | {
"resource": ""
} |
q29672 | _combine_msd_quan | train | def _combine_msd_quan(msd, quan):
"""Combine msd and quantiles in chain summary
Parameters
----------
msd : array of shape (num_params, 2, num_chains)
mean and sd for chains
cquan : array of shape (num_params, num_quan, num_chains)
quantiles for chains
Returns
-------
ms... | python | {
"resource": ""
} |
q29673 | _summary_sim | train | def _summary_sim(sim, pars, probs):
"""Summarize chains together and separately
REF: rstan/rstan/R/misc.R
Parameters are unraveled in *column-major order*.
Parameters
----------
sim : dict
dict from from a stanfit fit object, i.e., fit['sim']
pars : Iterable of str
paramet... | python | {
"resource": ""
} |
q29674 | _get_par_summary | train | def _get_par_summary(sim, n, probs):
"""Summarize chains merged and individually
Parameters
----------
sim : dict from stanfit object
n : int
parameter index
probs : iterable of int
quantiles
Returns
-------
summary : dict
Dictionary containing summaries
... | python | {
"resource": ""
} |
q29675 | _organize_inits | train | def _organize_inits(inits, pars, dims):
"""Obtain a list of initial values for each chain.
The parameter 'lp__' will be removed from the chains.
Parameters
----------
inits : list
list of initial values for each chain.
pars : list of str
| python | {
"resource": ""
} |
q29676 | _calc_starts | train | def _calc_starts(dims):
"""Calculate starting indexes
Parameters
----------
dims : list of list of int
from (via cython conversion) vector[vector[uint]] dims
Examples
--------
>>> _calc_starts([[8, 2], [5], [6, 2]])
[0, 16, 21]
"""
# NB: Python uses 0-indexing; R uses ... | python | {
"resource": ""
} |
q29677 | _par_vector2dict | train | def _par_vector2dict(v, pars, dims, starts=None):
"""Turn a vector of samples into an OrderedDict according to param dims.
Parameters
----------
y : list of int or float
pars : list of str
parameter names
dims : list of list of int
list of dimensions of parameters
Returns
... | python | {
"resource": ""
} |
q29678 | _pars_total_indexes | train | def _pars_total_indexes(names, dims, fnames, pars):
"""Obtain all the indexes for parameters `pars` in the sequence of names.
`names` references variables that are in column-major order
Parameters
----------
names : sequence of str
All the parameter names.
dim : sequence of list of int... | python | {
"resource": ""
} |
q29679 | _idx_col2rowm | train | def _idx_col2rowm(d):
"""Generate indexes to change from col-major to row-major ordering"""
if 0 == len(d):
return 1
if 1 == len(d):
return np.arange(d[0]) | python | {
"resource": ""
} |
q29680 | _get_samples | train | def _get_samples(n, sim, inc_warmup=True):
# NOTE: this is in stanfit-class.R in RStan (rather than misc.R)
"""Get chains for `n`th parameter.
Parameters
----------
n : int
sim : dict
A dictionary tied to a StanFit4Model instance.
Returns | python | {
"resource": ""
} |
q29681 | _writable_sample_file | train | def _writable_sample_file(file, warn=True, wfun=None):
"""Check to see if file is writable, if not use temporary file"""
if wfun is None:
wfun = lambda x, y: '"{}" is not writable; use "{}" instead'.format(x, y)
dir = os.path.dirname(file)
dir = os.getcwd() if dir == '' else dir
if os.access... | python | {
"resource": ""
} |
q29682 | stan_rdump | train | def stan_rdump(data, filename):
"""
Dump a dictionary with model data into a file using the R dump format that
Stan supports.
Parameters
----------
data : dict
filename : str
"""
for name in data:
if not is_legal_stan_vname(name):
| python | {
"resource": ""
} |
q29683 | _rdump_value_to_numpy | train | def _rdump_value_to_numpy(s):
"""
Convert a R dump formatted value to Numpy equivalent
For example, "c(1, 2)" becomes ``array([1, 2])``
Only supports a few R data structures. Will not work with European decimal format.
"""
if "structure" in s:
vector_str, shape_str = re.findall(r'c\([^... | python | {
"resource": ""
} |
q29684 | read_rdump | train | def read_rdump(filename):
"""
Read data formatted using the R dump format
Parameters
----------
filename: str
Returns
-------
data : OrderedDict
"""
contents = open(filename).read().strip()
names = [name.strip() for name in re.findall(r'^(\w+) <-', contents, re.MULTILINE)]
... | python | {
"resource": ""
} |
q29685 | load_module | train | def load_module(module_name, module_path):
"""Load the module named `module_name` from `module_path`
independently of the Python version."""
if sys.version_info >= (3,0):
import pyximport
pyximport.install()
sys.path.append(module_path)
return __import__(module_name)
| python | {
"resource": ""
} |
q29686 | _open | train | def _open(file, mode='r', buffering=-1, encoding=None, errors=None, newline=None,
closefd=True, opener=None, *, loop=None, executor=None):
"""Open an asyncio file."""
if loop is None:
loop = asyncio.get_event_loop() | python | {
"resource": ""
} |
q29687 | DeepDiff._get_view_results | train | def _get_view_results(self, view):
"""
Get the results based on the view
"""
if view == TREE_VIEW:
result = self.tree
else:
| python | {
"resource": ""
} |
q29688 | DeepDiff.__diff_dict | train | def __diff_dict(self,
level,
parents_ids=frozenset({}),
print_as_attribute=False,
override=False,
override_t1=None,
override_t2=None):
"""Difference of 2 dictionaries"""
if override:
... | python | {
"resource": ""
} |
q29689 | DeepDiff.__diff_set | train | def __diff_set(self, level):
"""Difference of sets"""
t1_hashtable = self.__create_hashtable(level.t1, level)
t2_hashtable = self.__create_hashtable(level.t2, level)
t1_hashes = set(t1_hashtable.keys())
t2_hashes = set(t2_hashtable.keys())
hashes_added = t2_hashes - t1_... | python | {
"resource": ""
} |
q29690 | DeepDiff.__diff_iterable | train | def __diff_iterable(self, level, parents_ids=frozenset({})):
"""Difference of iterables"""
# We're handling both subscriptable and non-subscriptable iterables. Which one is it?
subscriptable = self.__iterables_subscriptable(level.t1, level.t2)
if subscriptable:
child_relation... | python | {
"resource": ""
} |
q29691 | DeepDiff.__diff_iterable_with_deephash | train | def __diff_iterable_with_deephash(self, level):
"""Diff of unhashable iterables. Only used when ignoring the order."""
t1_hashtable = self.__create_hashtable(level.t1, level)
t2_hashtable = self.__create_hashtable(level.t2, level)
t1_hashes = set(t1_hashtable.keys())
t2_hashes =... | python | {
"resource": ""
} |
q29692 | DeepDiff.to_dict | train | def to_dict(self):
"""
Dump dictionary of the text view. It does not matter which view you are currently in. It will give you the dictionary of the text view.
"""
if self.view == TREE_VIEW:
| python | {
"resource": ""
} |
q29693 | short_repr | train | def short_repr(item, max_length=15):
"""Short representation of item if it is too long"""
item = repr(item)
if len(item) > max_length:
| python | {
"resource": ""
} |
q29694 | number_to_string | train | def number_to_string(number, significant_digits, number_format_notation="f"):
"""
Convert numbers to string considering significant digits.
"""
try:
using = number_formatting[number_format_notation]
except KeyError:
raise ValueError("number_format_notation got invalid value of {}. Th... | python | {
"resource": ""
} |
q29695 | prepare_string_for_hashing | train | def prepare_string_for_hashing(obj, ignore_string_type_changes=False, ignore_string_case=False):
"""
Clean type conversions
"""
original_type = obj.__class__.__name__
if isinstance(obj, bytes):
obj = obj.decode('utf-8') | python | {
"resource": ""
} |
q29696 | DeepSearch.__search_iterable | train | def __search_iterable(self,
obj,
item,
parent="root",
parents_ids=frozenset({})):
"""Search iterables except dictionaries, sets and strings."""
for i, thing in enumerate(obj):
new_parent ... | python | {
"resource": ""
} |
q29697 | DeepSearch.__search | train | def __search(self, obj, item, parent="root", parents_ids=frozenset({})):
"""The main search method"""
if self.__skip_this(item, parent):
return
elif isinstance(obj, strings) and isinstance(item, strings):
self.__search_str(obj, item, parent)
elif isinstance(obj... | python | {
"resource": ""
} |
q29698 | cmd_arp_poison | train | def cmd_arp_poison(victim1, victim2, iface, verbose):
"""Send ARP 'is-at' packets to each victim, poisoning their
ARP tables for send the traffic to your system.
Note: If you want a full working Man In The Middle attack, you need
to enable the packet forwarding on your operating system to act like a
... | python | {
"resource": ""
} |
q29699 | get_headers | train | def get_headers(server):
"""Retrieve all HTTP headers"""
try:
response = requests.head(
server, allow_redirects=False, verify=False, timeout=5) | python | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.