language stringclasses 2
values | func_code_string stringlengths 63 466k |
|---|---|
python | def path_to_url(path):
# type: (Union[str, Text]) -> str
"""
Convert a path to a file: URL. The path will be made absolute and have
quoted path parts.
"""
path = os.path.normpath(os.path.abspath(path))
url = urllib_parse.urljoin('file:', urllib_request.pathname2url(path))
return url |
python | def listcall(self, *arg, **kw):
"""Call each plugin sequentially.
Return the first result that is not None.
"""
final_result = None
for _, meth in self.plugins:
result = meth(*arg, **kw)
if final_result is None and result is not None:
fina... |
python | def get(self, name_or_klass):
"""
Gets a mode by name (or class)
:param name_or_klass: The name or the class of the mode to get
:type name_or_klass: str or type
:rtype: pyqode.core.api.Mode
"""
if not isinstance(name_or_klass, str):
name_or_klass = na... |
java | public void start() {
if (state == State.RUNNING) return;
final Lock lock = this.lock.writeLock();
try {
lock.lock();
this.state = State.STARTING;
// Create an executor service that we'll use to start the repositories ...
ThreadFactory threadFacto... |
java | public static Location getLocation(Object obj, String description) {
if (obj instanceof Location) {
return (Location) obj;
}
if (obj instanceof Locatable) {
return ((Locatable) obj).getLocation();
}
if (obj instanceof SAXParseException) {
SAXParseException spe = (SAXParseException) obj;
i... |
java | public XmlAssert isNotValidAgainst(Object... schemaSources) {
isNotNull();
ValidationAssert.create(actual, schemaSources).isInvalid();
return this;
} |
python | def pop_ctx():
"""Removes the test context(s) from the current stack(s)
"""
if getattr(_request_ctx_stack.top, 'fixtures_request_context', False):
_request_ctx_stack.pop()
if _app_ctx_stack is not None and getattr(_app_ctx_stack.top, 'fixtures_app_context', False):
_app_ctx_stack.pop() |
java | private void reportError(ErrorReporter errorReporter, SoyAutoescapeException e) {
// First, get to the root cause of the exception, and assemble an error message indicating
// the full call stack that led to the failure.
String message = "- " + e.getOriginalMessage();
while (e.getCause() instanceof SoyA... |
python | def transform_absolute_coords(self, width, height):
"""Return the current absolute coordinates of the pointer event,
transformed to screen coordinates.
For pointer events that are not of type
:attr:`~libinput.constant.EventType.POINTER_MOTION_ABSOLUTE`,
this method raises :exc:`AttributeError`.
Args:
w... |
python | def delete(self, id, id_name='id', **kwargs):
"""
Deletes the item corresponding to ``id``.
"""
response = self._new_response()
if self._check_supported_op('delete', response):
params = {'Key': {id_name: id}}
self._call_ddb_method(self.table.delete_item, p... |
python | def _parse_config_file(self, cfg_files):
"""Parse config file (ini) and set properties
:return:
"""
cfg_handler = configparser.ConfigParser(interpolation=None)
if not cfg_handler.read(map(str, cfg_files)):
return
self._parse_global_section(cfg_handler)
... |
python | def strictly_increasing(values):
"""True if values are stricly increasing."""
return all(x < y for x, y in zip(values, values[1:])) |
java | public void setDataHandler(DataHandler dataHandler) {
this._dataHandler = dataHandler;
if(dataHandler == null) {
_properties.remove(PARAM_DATA_HANDLER_CLASS);
} else {
if (dataHandler.getClass() != DefaultDataSetHandler.class &&
dataHandler.getClass() != D... |
python | def equals(df1, df2, ignore_order=set(), ignore_indices=set(), all_close=False, _return_reason=False):
'''
Get whether 2 data frames are equal.
``NaN`` is considered equal to ``NaN`` and `None`.
Parameters
----------
df1 : ~pandas.DataFrame
Data frame to compare.
df2 : ~pandas.Data... |
java | static Source updateSource(SourceName sourceName) {
try (SecurityCenterClient client = SecurityCenterClient.create()) {
// Start setting up a request to update a source.
// SourceName sourceName = SourceName.of(/*organization=*/"123234324",/*source=*/
// "423432321");
Source source =
... |
python | def _maybe_cast_indexer(self, key):
"""
If we have a float key and are not a floating index, then try to cast
to an int if equivalent.
"""
if is_float(key) and not self.is_floating():
try:
ckey = int(key)
if ckey == key:
... |
java | @Override
protected void doTransform(ITransformable.Translate transformable, float comp)
{
float fromX = reversed ? this.toX : this.fromX;
float toX = reversed ? this.fromX : this.toX;
float fromY = reversed ? this.toY : this.fromY;
float toY = reversed ? this.fromY : this.toY;
float fromZ = reversed ? this... |
python | def choice_info(self):
"""View .info file
"""
info = ReadSBo(self.sbo_url).info(self.name, ".info")
fill = self.fill_pager(info)
self.pager(info + fill) |
java | public static Sprite addBorder(Sprite original, int color, int size) {
int[] newPix = Arrays.copyOf(original.getPixels(), original.getPixels().length);
for (int x = 0; x < original.getWidth(); x++) {
for (int y = 0; y < original.getHeight(); y++) {
if (x < size || x >= original.getWidth() - size || y < size ... |
java | public static Map<String, String> mapStringToMap(String map) {
String[] m = map.split("[,;]");
Map<String, String> res = new HashMap<String, String>();
for (String str : m) {
int index = str.lastIndexOf('=');
String key = str.substring(0, index);
String val = str.substring(index + 1)... |
java | private ViterbiNode findGlueNodeCandidate(int index, ViterbiNode[] latticeNodes, int startIndex) {
List<ViterbiNode> candidates = new ArrayList<>();
for (ViterbiNode viterbiNode : latticeNodes) {
if (viterbiNode != null) {
candidates.add(viterbiNode);
}
}... |
python | def _make_token_async(scopes, service_account_id):
"""Get a fresh authentication token.
Args:
scopes: A list of scopes.
service_account_id: Internal-use only.
Raises:
An ndb.Return with a tuple (token, expiration_time) where expiration_time is
seconds since the epoch.
"""
rpc = app_identity.... |
java | public int compareTo(ReadablePartial partial) {
if (partial == null) {
throw new IllegalArgumentException("The partial must not be null");
}
int thisValue = get();
int otherValue = partial.get(getFieldType());
if (thisValue < otherValue) {
return -1;
... |
java | public void marshall(EnableAWSServiceAccessRequest enableAWSServiceAccessRequest, ProtocolMarshaller protocolMarshaller) {
if (enableAWSServiceAccessRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.m... |
java | private AnnotationNode getAnnotation(String desc, List<AnnotationNode> annotations) {
if (annotations == null) {
return null;
}
for (AnnotationNode an : annotations) {
if (desc.equals(an.desc)) {
return an;
}
}
return null;
... |
java | public static String urlEncode(String str) throws UnsupportedEncodingException {
// Preserve original behavior that passing null for an object id will lead
// to us actually making a request to /v1/foo/null
if (str == null) {
return null;
} else {
// Don't use strict form encoding by changin... |
java | public Object opt( String key ) {
verifyIsNull();
return key == null ? null : this.properties.get( key );
} |
java | @Override
public GetConfigurationSetEventDestinationsResult getConfigurationSetEventDestinations(GetConfigurationSetEventDestinationsRequest request) {
request = beforeClientExecution(request);
return executeGetConfigurationSetEventDestinations(request);
} |
python | def hclust_ordering(X, metric="sqeuclidean"):
""" A leaf ordering is under-defined, this picks the ordering that keeps nearby samples similar.
"""
# compute a hierarchical clustering
D = sp.spatial.distance.pdist(X, metric)
cluster_matrix = sp.cluster.hierarchy.complete(D)
# merge clus... |
python | def update(self, *others):
"""Update the set, adding elements from all others."""
self.db.sunionstore(self.key, [self.key] + [o.key for o in others]) |
java | public java.util.List<java.util.Map<String, String>> getTags() {
return tags;
} |
python | def prt_report_grp0(self, prt=sys.stdout):
"""Print full GO/gene report without grouping."""
summaryline = self.str_summaryline()
kws_grp = {'use_sections':False,
'hdrgo_prt':False,
'sortby':lambda nt: [-1*nt.dcnt, nt.depth]}
# Print grouped GO IDs
... |
java | @Override
public DescribeDomainResult describeDomain(DescribeDomainRequest request) {
request = beforeClientExecution(request);
return executeDescribeDomain(request);
} |
python | def add_row(self, data: list):
"""
Add a row of buttons each with their own callbacks to the
current widget. Each element in `data` will consist of a
label and a command.
:param data: a list of tuples of the form ('label', <callback>)
:return: None
"""
#... |
python | def get_connected_sites(self, n):
"""
Returns a named tuple of neighbors of site n:
periodic_site, jimage, index, weight.
Index is the index of the corresponding site
in the original structure, weight can be
None if not defined.
:param n: index of Site in Molecule... |
java | private void finish() throws IOException
{
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
logger.logp(Level.FINE, CLASS_NAME,"finish", "finish");
}
if (length == -1 && total != 0)
length = total;
//PK89810 Start
if (WCCustomProperties.FINI... |
python | def item_enclosure_url(self, item):
"""
Return an image for enclosure.
"""
try:
url = item.image.url
except (AttributeError, ValueError):
img = BeautifulSoup(item.html_content, 'html.parser').find('img')
url = img.get('src') if img else None
... |
python | def leaking(self, z, module, name, node, context, *data):
'''
an expression leaking ...
assignment nodes into the nearest block list of nodes
c++ guys, stay calm
'''
# input(node.y)
args = [node.receiver] + node.args if node.type == 'standard_method_call' else n... |
java | private String colorType(SchemaConcept schemaConcept) {
if(colorize) {
return ANSI.color(label(schemaConcept.label()), ANSI.PURPLE);
} else {
return label(schemaConcept.label());
}
} |
python | def _get_kwsdag(self, goids, go2obj, **kws_all):
"""Get keyword args for a GoSubDag."""
kws_dag = {}
# Term Counts for GO Term information score
tcntobj = self._get_tcntobj(goids, go2obj, **kws_all) # TermCounts or None
if tcntobj is not None:
kws_dag['tcntobj'] = tc... |
java | public void unbind() throws Exception {
InstanceInfo myInfo = applicationInfoManager.getInfo();
String myInstanceId = ((AmazonInfo) myInfo.getDataCenterInfo()).get(AmazonInfo.MetaDataKey.instanceId);
AmazonEC2 ec2 = getEC2Service();
List<InstanceNetworkInterface> result = instanceData(... |
python | def _check_for_bom(self, first_row):
"""
Checks whether the file begins with the BOM character.
If it does, remove it. In addition, if there is quoting
in the field subsequent to the BOM, remove it as well
because it technically takes place at the beginning of
the name, n... |
java | @Override
public Serializable invokeCommand(String key, String commandName, Serializable commandData)
throws SIConnectionDroppedException, SIConnectionUnavailableException,
SINotAuthorizedException, SIResourceException, SIIncorrectCallException,
SICommandI... |
java | public static ConfigProperties ofFlatMap(String key, Map<String, String> map) {
SimpleConfigProperties root = new SimpleConfigProperties(key);
root.fromFlatMap(map);
return root;
} |
python | def forwardMessage(self, chat_id, from_chat_id, message_id,
disable_notification=None):
""" See: https://core.telegram.org/bots/api#forwardmessage """
p = _strip(locals())
return self._api_request('forwardMessage', _rectify(p)) |
java | public void setNu(double nu)
{
if(Double.isNaN(nu) || nu <= 0 || nu >= 1)
throw new IllegalArgumentException("nu must be in the range (0, 1)");
this.nu = nu;
} |
java | public static String buildString(Consumer<StringPrinter> printer) {
StringBuilder builder = new StringBuilder();
printer.accept(new StringPrinter(builder::append));
return builder.toString();
} |
python | def add_nio(self, nio):
"""
Adds a NIO as new port on this bridge.
:param nio: NIO instance to add
"""
yield from self._hypervisor.send('nio_bridge add_nio "{name}" {nio}'.format(name=self._name, nio=nio))
self._nios.append(nio) |
java | @SuppressWarnings("unchecked")
public List<Failure> validate(Validate vo, ResourceBundle rb)
{
if (vo != null &&
Key.CONNECTION_FACTORY == vo.getKey() &&
vo.getClazz() != null &&
ConnectionFactory.class.isAssignableFrom(vo.getClazz()))
{
try
{
... |
python | def edit(self, body):
"""Edit this comment.
:param str body: (required), new body of the comment, Markdown
formatted
:returns: bool
"""
if body:
json = self._json(self._patch(self._api,
data=dumps({'body': body})), 200)
... |
python | def visitNodeConstraintDatatype(self, ctx: ShExDocParser.NodeConstraintDatatypeContext):
""" nodeConstraint: datatype xsFacet* # nodeConstraintDatatype """
self.nodeconstraint.datatype = self.context.iri_to_iriref(ctx.datatype().iri())
self.visitChildren(ctx) |
python | def list_ports(self, retrieve_all=True, **_params):
"""Fetches a list of all ports for a project."""
# Pass filters in "params" argument to do_request
return self.list('ports', self.ports_path, retrieve_all,
**_params) |
java | @Override public Integer getOffset(Integer id, Integer type)
{
Integer result = null;
Map<Integer, Integer> map = m_table.get(id);
if (map != null && type != null)
{
result = map.get(type);
}
return (result);
} |
python | def list_pkgs(versions_as_list=False, **kwargs):
'''
List the packages currently installed in a dict::
{'<package_name>': '<version>'}
CLI Example:
.. code-block:: bash
salt '*' pkg.list_pkgs
'''
versions_as_list = salt.utils.data.is_true(versions_as_list)
# not yet imple... |
java | @Override
public String getFromName(String languageId, boolean useDefault) {
return _commerceNotificationTemplate.getFromName(languageId, useDefault);
} |
java | @Override
public synchronized boolean setSafeMode(boolean safeMode) {
/**
* If we are switching off the safe mode, so we need to reset the last
* heartbeat timestamp for each of the sessions and nodes.
*/
if (safeMode == false) {
LOG.info("Resetting the heartbeat times for all sessions");... |
python | def install(modal):
"""Perform first time install"""
if _state.get("installed"):
sys.stdout.write("Already installed, uninstalling..\n")
uninstall()
use_threaded_wrapper = not modal
install_callbacks()
install_host(use_threaded_wrapper)
_state["installed"] = True |
java | private static Class<?> loadClass(final String className) throws ClassNotFoundException {
ClassLoader ctxCL = Thread.currentThread().getContextClassLoader();
if (ctxCL == null) {
return Class.forName(className);
}
return ctxCL.loadClass(className);
} |
java | @Activate
protected void activate(ComponentContext cc) {
executorServiceRef.activate(cc);
scheduledExecutorServiceRef.activate(cc);
classLoadingServiceSR.activate(cc);
WSExecutorService executorService = executorServiceRef.getService();
ScheduledExecutorService scheduledExecu... |
java | private Source sanitizeXml(@Nullable String xml) {
if (xml != null && !sensitiveXPathStrings.isEmpty()) {
try {
DocumentBuilder documentBuilder = documentBuilderSupplier.get();
XPath xpath = xpathSupplier.get();
if (documentBuilder != null && xpath != null) {
Document doc = d... |
java | public static FormValidation validateArtifactoryCombinationFilter(String value)
throws IOException, InterruptedException {
String url = Util.fixEmptyAndTrim(value);
if (url == null)
return FormValidation.error("Mandatory field - You don`t have any deploy matches");
retur... |
java | public void marshall(FlinkApplicationConfigurationDescription flinkApplicationConfigurationDescription, ProtocolMarshaller protocolMarshaller) {
if (flinkApplicationConfigurationDescription == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {... |
python | def draw(self):
'''Draw the tree of UI elements once directly to the terminal. The root
element of the UI is referenced by this instance's :attr:`element`
attribute. Layout is automatically calculated by the UI elements in the
tree in reponse ultimately to the :attr:`width` and :attr:`he... |
java | @Override
public JsMessage getSent(boolean copy) throws MessageCopyFailedException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "getSent", copy);
// We don't want to fluff up an MQMD PropertyMap unnecessarily, so we try to
// figure ou... |
java | public static <T> Gather<T> from(Enumeration<T> enumeration) {
return null == enumeration
? Gather.<T>empty() : from(Iterators.forEnumeration(enumeration));
} |
java | static String javaPropertyToJSProperty(final String getterSetterMethod) {
if (!isJavaPropertyMethod(getterSetterMethod)) {
throw new JsiiException("Invalid getter/setter method. Must start with get/set");
}
String camelCase = getterSetterMethod.substring(
PROPERTY_ME... |
python | def get_data(start, end, username=None, password=None,
data_path=os.path.abspath(".")+'/tmp_data'):
"""**Download data (badly) from Blitzorg**
Using a specified time stamp for start and end, data is downloaded at a
default frequency (10 minute intervals). If a directory called data is not
... |
java | public void addJobListener (@Nonnull final IJobListener aJobListener)
{
ValueEnforcer.notNull (aJobListener, "JobListener");
try
{
m_aScheduler.getListenerManager ().addJobListener (aJobListener, EverythingMatcher.allJobs ());
}
catch (final SchedulerException ex)
{
throw new Ille... |
java | @ManyToOne(targetEntity = org.openprovenance.prov.sql.QualifiedName.class, cascade = {
CascadeType.ALL
})
@JoinColumn(name = "TRIGGER_")
public org.openprovenance.prov.model.QualifiedName getTrigger() {
return trigger;
} |
python | def set_examples(self, examples):
"""Sets the examples to be displayed in WIT.
Args:
examples: List of example protos.
Returns:
self, in order to enabled method chaining.
"""
self.store('examples', examples)
if len(examples) > 0:
self.store('are_sequence_examples',
... |
java | public void beforeConvert(SO outputSchema, DI inputRecord, WorkUnitState workUnit) {
Instrumented.markMeter(this.recordsInMeter);
} |
python | def resolve_font(name):
"""Turns font names into absolute filenames
This is case sensitive. The extension should be omitted.
For example::
>>> path = resolve_font('NotoSans-Bold')
>>> fontdir = os.path.join(os.path.dirname(__file__), 'fonts')
>>> noto_path = os.path.join(fontdir,... |
python | def _pick_best_quality_score(vrn_file):
"""Flexible quality score selection, picking the best available.
Implementation based on discussion:
https://github.com/bcbio/bcbio-nextgen/commit/a538cecd86c0000d17d3f9d4f8ac9d2da04f9884#commitcomment-14539249
(RTG=AVR/GATK=VQSLOD/MuTect=t_lod_fstar, otherwise... |
java | protected ResourceBundle getResourceBundle(String basename, Locale locale) {
if (this.cacheMillis >= 0) {
// Fresh ResourceBundle.getBundle call in order to let ResourceBundle
// do its native caching, at the expense of more extensive lookup steps.
return doGetBundle(basename... |
python | def update_value(self, offset, value):
"""Update the binary value currently stored for this config value.
Returns:
int: An opaque error code that can be returned from a set_config rpc
"""
if offset + len(value) > self.total_size:
return Error.INPUT_BUFFER_TOO_LO... |
java | public void removePort(TCPPort endPoint) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.entry(tc, "removePort: " + endPoint.getServerSocket());
}
synchronized (this) {
NBAcceptChannelSelector accept = endPointToAccept.get(endPoint);
... |
java | private File calculateLogFile(long timestamp) {
if (ivSubDirectory == null)
getControllingProcessDirectory(timestamp, svPid) ;
return getLogFile(ivSubDirectory, timestamp);
} |
python | def axisfn(reverse=False, principal_node_type=xml.dom.Node.ELEMENT_NODE):
"""Axis function decorator.
An axis function will take a node as an argument and return a sequence
over the nodes along an XPath axis. Axis functions have two extra
attributes indicating the axis direction and principal node typ... |
python | def priority_compare(self, other):
"""
Compares the MIME::Type based on how reliable it is before doing a
normal <=> comparison. Used by MIME::Types#[] to sort types. The
comparisons involved are:
1. self.simplified <=> other.simplified (ensures that we
don't try to co... |
python | def get_queryset(self):
'''
If MultiTenantMiddleware is used, filter queryset by request.site_id
'''
queryset = super(PageList, self).get_queryset()
if hasattr(self.request, 'site_id'):
queryset = queryset.filter(site_id=self.request.site_id)
return queryset |
python | def uv_at_xy(self, x, y, x0, y0, s0):
"""Returns two arrays of u, v"""
dx, dy = self.distance(x0, y0, x, y)
#print 'dx, dy:', dx, dy
rr2 = (dx**2 + dy**2)**-1
u = - s0 * dy * r_twopi * rr2
v = s0 * dx * r_twopi * rr2
#print 'u, v', u, v
return u, v |
python | def norm_locale (loc):
"""Normalize a locale."""
loc = locale.normalize(loc)
# split up the locale into its base components
pos = loc.find('@')
if pos >= 0:
loc = loc[:pos]
pos = loc.find('.')
if pos >= 0:
loc = loc[:pos]
pos = loc.find('_')
if pos >= 0:
loc =... |
java | private static int cqlDateToDaysSinceEpoch(long raw) {
if (raw < 0 || raw > MAX_CQL_LONG_VALUE)
throw new IllegalArgumentException(
String.format(
"Numeric literals for DATE must be between 0 and %d (got %d)",
MAX_CQL_LONG_VALUE, raw));
return (int) (raw - EPOCH_AS_CQ... |
python | def sample(self, count, return_index=False):
"""
Return random samples distributed normally across the
surface of the mesh
Parameters
---------
count : int
Number of points to sample
return_index : bool
If True will also return the index of wh... |
java | public int deleteCascade(
Collection<DataColumnConstraints> constraintsCollection)
throws SQLException {
int count = 0;
if (constraintsCollection != null) {
for (DataColumnConstraints constraints : constraintsCollection) {
count += deleteCascade(constraints);
}
}
return count;
} |
java | public DescribeReservedInstancesOfferingsResult withReservedInstancesOfferings(ReservedInstancesOffering... reservedInstancesOfferings) {
if (this.reservedInstancesOfferings == null) {
setReservedInstancesOfferings(new com.amazonaws.internal.SdkInternalList<ReservedInstancesOffering>(reservedInstanc... |
java | public TransportApiResult<List<Stop>> getStopsByBoundingBox(StopQueryOptions options, String boundingBox)
{
if (options == null)
{
options = StopQueryOptions.defaultQueryOptions();
}
if (boundingBox == null)
{
throw new IllegalArgumentException("BoundingBox is req... |
python | def __apply_func(self, other, func_name):
""" delegate operations to the *samples* attribute, but in a time
correct manner by considering the *timestamps*
"""
if isinstance(other, Signal):
if len(self) and len(other):
start = max(self.timestamps[0], other.ti... |
java | public Iterator<Entry<K, V>> iterator(int fetchSize, int partitionId, boolean prefetchValues) {
return new MapPartitionIterator<>(this, fetchSize, partitionId, prefetchValues);
} |
java | @Override
public void start(Screen screen)
{
Check.notNull(screen);
this.screen = screen;
screen.addListener(this);
renderer.setScreen(screen);
renderer.initResolution(resolution);
currentFrameRate = config.getOutput().getRate();
screen.requestFocus();
... |
java | public TableWriteItems addHashOnlyPrimaryKeyToDelete(
String hashKeyName, Object hashKeyValue) {
this.addPrimaryKeyToDelete(new PrimaryKey(hashKeyName, hashKeyValue));
return this;
} |
java | public final EObject ruleAction() throws RecognitionException {
EObject current = null;
Token otherlv_0=null;
Token otherlv_2=null;
Token lv_operator_4_1=null;
Token lv_operator_4_2=null;
Token otherlv_5=null;
Token otherlv_6=null;
EObject lv_type_1_0 = n... |
java | @Override
public void remove(Object handle) throws IOException {
if (!(handle instanceof File)) {
throw new IllegalArgumentException("Expected File, but was " + handle.getClass());
}
File eventFile = (File) handle;
if (eventFile.exists() && eventFile.isFile()) {
... |
java | public StrPosition getAfterOfWithDetails(String srcStr, String token) {
return getAfterOfWithDetails(srcStr, token, true);
} |
python | def determine_2(self, container_name, container_alias, meta, val):
""""Default the alias to the name of the container"""
if container_alias is not NotSpecified:
return container_alias
return container_name[container_name.rfind(":")+1:].replace('/', '-') |
python | def updated_current_fields(
self,
update_fields):
"""updated_current_fields
:param update_fields: dict with values for
updating fields_to_add
"""
self.fields_to_add = {}
for k in self.org_fields:
self.fields_to_ad... |
python | def retrieve_dcnm_net_info(self, tenant_id, direc):
"""Retrieves the DCNM network info for a tenant. """
serv_obj = self.get_service_obj(tenant_id)
net_dict = serv_obj.get_dcnm_net_dict(direc)
return net_dict |
python | def get(self):
"""
Get a JSON-ready representation of this CustomArg.
:returns: This CustomArg, ready for use in a request body.
:rtype: dict
"""
custom_arg = {}
if self.key is not None and self.value is not None:
custom_arg[self.key] = self.value
... |
python | def meanApprox(self, timeout, confidence=0.95):
"""
.. note:: Experimental
Approximate operation to return the mean within a timeout
or meet the confidence.
>>> rdd = sc.parallelize(range(1000), 10)
>>> r = sum(range(1000)) / 1000.0
>>> abs(rdd.meanApprox(1000) ... |
java | protected void sendData(HttpServletRequest request, HttpServletResponse response, String pathInContext, Resource resource) throws IOException
{
long resLength = resource.length();
boolean include = request.getAttribute(Dispatcher.__INCLUDE_REQUEST_URI) != null;
// Get the output stream (or... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.