language stringclasses 2
values | func_code_string stringlengths 63 466k |
|---|---|
python | def create(self, file_or_path=None, data=None, obj_name=None,
content_type=None, etag=None, content_encoding=None,
content_length=None, ttl=None, chunked=False, metadata=None,
chunk_size=None, headers=None, return_none=False):
"""
Creates or replaces a storage object ... |
java | @Override
public void setRollbackOnly() throws IllegalStateException, SystemException {
if (trace) {
log.tracef("Transaction.setRollbackOnly() invoked in transaction with Xid=%s", xid);
}
if (isDone()) {
throw new IllegalStateException("Transaction is done. Cannot change status");... |
python | def get(self, client_id=None, email_address=None):
"""Gets a person by client ID and email address."""
params = {"email": email_address or self.email_address}
response = self._get("/clients/%s/people.json" %
(client_id or self.client_id), params=params)
retur... |
python | async def startlisten(self, vhost = None):
'''
Start listen on current servers
:param vhost: return only servers of vhost if specified. '' to return only default servers.
None for all servers.
'''
servers = self.getservers(vhost)
for s in se... |
java | public static int getLastIndexOfIgnoreCase (@Nullable final String sText,
@Nullable final String sSearch,
@Nonnull final Locale aSortLocale)
{
return sText != null &&
sSearch != null &&
sText.length (... |
java | public CpuAcctMetric snapshot()
{
final File cpuacct;
try {
cpuacct = new File(
cgroupDiscoverer.discover(CGROUP).toFile(),
CGROUP_ACCT_FILE
);
}
catch (RuntimeException re) {
LOG.error(re, "Unable to fetch snapshot");
return new CpuAcctMetric(new long[0], n... |
java | public ServiceMethod createAndGatherImports (Method method, ImportSet imports)
{
ServiceMethod sm = new ServiceMethod(method);
sm.gatherImports(imports);
return sm;
} |
python | def get_vads_trans_id(vads_site_id, vads_trans_date):
"""
Returns a default value for vads_trans_id field.
vads_trans_id field is mandatory. It is composed by 6 numeric
characters that identifies the transaction. There is a unicity contraint
between vads_site_id and vads_trans_date (the first 8 cha... |
python | def longest_increasing_subsequence(xs):
'''Return a longest increasing subsequence of xs.
(Note that there may be more than one such subsequence.)
>>> longest_increasing_subsequence(range(3))
[0, 1, 2]
>>> longest_increasing_subsequence([3, 1, 2, 0])
[1, 2]
'''
# Patience sort xs, stack... |
java | public Histogram toHistogram(final float bucketSize, final float offset)
{
final float minFloor = (float) Math.floor((min() - offset) / bucketSize) * bucketSize + offset;
final float lowerLimitFloor = (float) Math.floor((lowerLimit - offset) / bucketSize) * bucketSize + offset;
final float firstBreak = Ma... |
python | def code_to_text(self):
"""Return the text representation of a code cell"""
active = is_active(self.ext, self.metadata)
if self.language != self.default_language and 'active' not in self.metadata:
active = False
source = copy(self.source)
escape_code_start(source, se... |
java | public CmsADEConfigData lookupConfiguration(String rootPath) {
CmsADEConfigDataInternal internalSiteConfig = getSiteConfigData(rootPath);
CmsADEConfigData result;
if (internalSiteConfig == null) {
result = wrap(m_moduleConfiguration);
} else {
result = wrap(inter... |
python | def prompt(msg, default=None):
"Prompt for input"
if default is not None:
msg = '{} ({})'.format(msg, repr(default))
msg = '{}: '.format(msg)
try:
s = input(msg)
except KeyboardInterrupt:
exit(1)
except EOFError:
s = ''
if not s:
s = default
return... |
python | def page(self, language=values.unset, model_build=values.unset,
status=values.unset, page_token=values.unset, page_number=values.unset,
page_size=values.unset):
"""
Retrieve a single page of QueryInstance records from the API.
Request is executed immediately
:p... |
java | public Optional<String> getString(String key) {
Objects.requireNonNull(key, Required.KEY.toString());
String value = this.values.get(key);
if (StringUtils.isNotBlank(value)) {
return Optional.of(value);
}
return Optional.empty();
} |
python | def update(self, users=None, groups=None):
"""Add the specified users or groups to this project role. One of ``users`` or ``groups`` must be specified.
:param users: a user or users to add to the role
:type users: string, list or tuple
:param groups: a group or groups to add to the role... |
java | @Override
public PollResult startPoll(PollController conn)
{
if (! _lifecycle.isActive()) {
log.warning(this + " select disabled");
return PollResult.CLOSED;
}
SocketBar socket = conn.getSocket();
if (socket == null) {
log.warning(this + " socket empty for " + conn);
retu... |
java | @Override
public void exitUnion_range(VersionParser.Union_rangeContext ctx)
{
Object o1 = stack.pop();
Object o2 = stack.pop();
IVersionRange r1 = null;
IVersionRange r2 = null;
if (o1 instanceof IVersion) {
r1 = new VersionSet((IVersion) o1);
}
else {
r1 = (IVersionRange) o... |
java | public static <T> void insertListNotBatched(Connection connection, Iterable<T> iterable) throws SQLException
{
OrmWriter.insertListNotBatched(connection, iterable);
} |
java | public static boolean hasBody(Response response) {
// HEAD requests never yield a body regardless of the response headers.
if (response.request().method().equals("HEAD")) {
return false;
}
int responseCode = response.code();
if ((responseCode < HTTP_CONTINUE || responseCode >= 200)
&&... |
python | def AstroDrizzle(input=None, mdriztab=False, editpars=False, configobj=None,
wcsmap=None, **input_dict):
""" AstroDrizzle command-line interface """
# Support input of filenames from command-line without a parameter name
# then copy this into input_dict for merging with TEAL ConfigObj
#... |
java | public static sms_server update(nitro_service client, sms_server resource) throws Exception
{
resource.validate("modify");
return ((sms_server[]) resource.update_resource(client))[0];
} |
java | private void validateIfd(IFD ifd, int n) {
boolean hasSubIfd = ifd.hasSubIFD();
boolean thumbnail = hasSubIfd && ifd.getsubIFD().getImageSize() > ifd.getImageSize();
boolean structureOk = false;
IfdTags metadata;
if (!hasSubIfd) {
validation.addErrorLoc("Missing Sub IFD", "IFD" + n);
me... |
java | public int mapStatus(Status status) {
String code = getUniformValue(status.getCode());
if (code != null) {
return this.statusMapping.entrySet().stream()
.filter((entry) -> code.equals(getUniformValue(entry.getKey())))
.map(Map.Entry::getValue).findFirst()
.orElse(WebEndpointResponse.STATUS_OK);
... |
python | def stop(self):
""" Stops listening for events. """
if not self._is_running:
return
pushcenter_logger.debug("[NURESTPushCenter] Stopping...")
self._thread.stop()
self._thread.join()
self._is_running = False
self._current_connection = None
s... |
python | def make_action_list(self, item_list, **kwargs):
''' Generates a list of actions for sending to Elasticsearch '''
action_list = []
es_index = get2(kwargs, "es_index", self.es_index)
action_type = kwargs.get("action_type","index")
action_settings = {'_op_type': action_type,... |
java | public ValidatorType<WebJsptaglibraryDescriptor> getOrCreateValidator()
{
Node node = model.getOrCreate("validator");
ValidatorType<WebJsptaglibraryDescriptor> validator = new ValidatorTypeImpl<WebJsptaglibraryDescriptor>(this, "validator", model, node);
return validator;
} |
python | def default(fields=None, count=5):
"""Provides a simple default sampling strategy which limits the result set by a count.
Args:
fields: an optional list of field names to retrieve.
count: optional number of rows to limit the sampled results to.
Returns:
A sampling function that can be app... |
python | def transcribe_to_modern(self, text) :
'''
A very first attempt at trancribing from IPA to some modern orthography.
The method is intended to provide the student with clues to the pronounciation of old orthographies.
'''
# first transcribe letter by letter
phoneme_words = self.transcribe(text, as_phon... |
java | public static PreparedCallableQuery prepareCallableQuery(final Connection conn, final Try.Function<Connection, CallableStatement, SQLException> stmtCreator)
throws SQLException {
return new PreparedCallableQuery(stmtCreator.apply(conn));
} |
java | public static GraphicsDevice getGraphicsDeviceIsShowingOn(final Component component)
{
final GraphicsDevice graphicsDevice = component.getGraphicsConfiguration().getDevice();
return graphicsDevice;
} |
java | @Override
public EEnum getIfcStructuralSurfaceMemberTypeEnum() {
if (ifcStructuralSurfaceMemberTypeEnumEEnum == null) {
ifcStructuralSurfaceMemberTypeEnumEEnum = (EEnum) EPackage.Registry.INSTANCE
.getEPackage(Ifc4Package.eNS_URI).getEClassifiers().get(1076);
}
return ifcStructuralSurfaceMemberType... |
python | def check_anchor(self, url_data):
"""If URL is valid, parseable and has an anchor, check it.
A warning is logged and True is returned if the anchor is not found.
"""
log.debug(LOG_PLUGIN, "checking anchor %r in %s", url_data.anchor, self.anchors)
enc = lambda anchor: urlutil.url_... |
java | public void addUserProfileEventListener(UserProfileEventListener listener)
{
SecurityHelper.validateSecurityPermission(PermissionConstants.MANAGE_LISTENERS);
listeners.add(listener);
} |
java | public EnvironmentLanguage withImages(EnvironmentImage... images) {
if (this.images == null) {
setImages(new java.util.ArrayList<EnvironmentImage>(images.length));
}
for (EnvironmentImage ele : images) {
this.images.add(ele);
}
return this;
} |
python | def _find_packages_iter(cls, where, exclude, include):
"""
All the packages found in 'where' that pass the 'include' filter, but
not the 'exclude' filter.
"""
for root, dirs, files in os.walk(where, followlinks=True):
# Copy dirs to iterate over it, then empty dirs.
... |
python | def cached_class(klass):
"""
Decorator to cache class instances by constructor arguments.
This results in a class that behaves like a singleton for each
set of constructor arguments, ensuring efficiency.
Note that this should be used for *immutable classes only*. Having
a cached mutable class ... |
python | def _hash(self, iv, value):
"""
Generate and hmac signature for this encrypted data
:param key:
:param iv:
:param value:
:return string:
"""
return hmac.new(self.key, msg=iv+value, digestmod=hashlib.sha256).hexdigest() |
java | private boolean startsWithIgnoreCase(final String dateString,
final String startString) {
final String prefix = dateString.substring(0, startString.length());
return prefix.equalsIgnoreCase(startString);
} |
python | def get_activating_subs(self):
"""Extract INDRA ActiveForm Statements based on a mutation from BEL.
The SPARQL pattern used to extract ActiveForms due to mutations look
for a ProteinAbundance as a subject which has a child encoding the
amino acid substitution. The object of the statemen... |
python | def changed(self, symbol, checked = None):
"""Returns true if the specified symbol has it's value changed
by this executable or *any* of its dependencies."""
#Initialize the dictionary if we are the first executable to call this.
myname = "{}.{}".format(self.module.name, self.name).lower... |
java | public ApiResponse<ApiSuccessResponse> setCommentWithHttpInfo(String mediatype, String id, AddCommentData addCommentData) throws ApiException {
com.squareup.okhttp.Call call = setCommentValidateBeforeCall(mediatype, id, addCommentData, null, null);
Type localVarReturnType = new TypeToken<ApiSuccessRespo... |
python | def buildParser():
''' Builds the parser for reading the command line arguments'''
parser = argparse.ArgumentParser(
description='Script to parse bagfile to csv file')
parser.add_argument('bag', help='Bag file to read',
type=str)
parser.add_argument('-i', '--include',
... |
java | private State checkDefaultConstructor(Class<?> cls, State state) throws NoClassDefFoundError {
try {
cls.getConstructor();
return State.DEFAULT_INSTANTIABLE;
}
catch(Exception e) {
// do nothing.
}
return state;
} |
java | @Override
public <T> Provider<T> scope(final Key<T> key, final Provider<T> creator) {
/** Locking strategy: */
return new Provider<T>() {
/**
* The lazily initialized singleton instance. Once set, this will either have type T or will
* be equal to NULL. Would never be reset to null.
... |
python | def check_cli_verbose(default=3):
"""Check for presence of `--verbose`/`--quiet` or `-v`/`-q` without using argparse."""
args = sys.argv[1:]
verbose = default + args.count("--verbose") - args.count("--quiet")
for arg in args:
if arg.startswith("-") and not arg.startswith("--"):
verb... |
python | def send_error_message(sender, error_message):
"""Send an error message to the listeners.
Error messages represents and error. It usually replace the previous
message since an error has been happened.
.. versionadded:: 3.3
:param sender: The sender.
:type sender: object
:param error_mess... |
python | def process_delayed_asserts(self, print_only=False):
""" To be used with any test that uses delayed_asserts, which are
non-terminating verifications that only raise exceptions
after this method is called.
This is useful for pages with multiple elements to be checked when
... |
java | public static String uiModeTypeToString(@ConfigurationUiModeType int mode) {
return buildNamedValueString(mode)
.value(UI_MODE_TYPE_NORMAL, "normal")
.value(UI_MODE_TYPE_APPLIANCE, "appliance")
.value(UI_MODE_TYPE_CAR, "car")
.value(UI_MODE_TYPE_DESK, "desk")
.value(UI_MODE_T... |
java | public Map<String, String> getUriVariablesForResumeTextParse(ResumeTextParseParams params) {
if (params == null) {
params = ParamFactory.resumeTextParseParams();
}
Map<String, String> uriVariables = params.getParameterMap();
String bhRestToken = bullhornApiRest.getBhRestToken();
uriVariables.put(BH_REST... |
python | def get_all_names_page(offset, count, include_expired=False, hostport=None, proxy=None):
"""
get a page of all the names
Returns the list of names on success
Returns {'error': ...} on error
"""
assert proxy or hostport, 'Need proxy or hostport'
if proxy is None:
proxy = connect_hostp... |
python | def containing_bins(start, stop=None):
"""
Given an interval `start:stop`, return bins for intervals completely
*containing* `start:stop`. The order is according to the bin level
(starting with the smallest bins), and within a level according to the bin
number (ascending).
:arg int start, stop:... |
python | def get_regex(regex):
"""
Ensure we have a compiled regular expression object.
>>> import re
>>> get_regex('string') # doctest: +ELLIPSIS
<_sre.SRE_Pattern object at 0x...>
>>> pattern = re.compile(r'string')
>>> get_regex(pattern) is pattern
True
>>> get... |
java | public static boolean verifyPurchase(String productId, String base64PublicKey, String signedData, String signature) {
if (TextUtils.isEmpty(signedData) || TextUtils.isEmpty(base64PublicKey) ||
TextUtils.isEmpty(signature)) {
if(BuildConfig.DEBUG){
//handle test purch... |
python | def update_parameter_group(name, parameters, apply_method="pending-reboot",
tags=None, region=None, key=None, keyid=None,
profile=None):
'''
Update an RDS parameter group.
CLI example::
salt myminion boto_rds.update_parameter_group my-param-gro... |
java | private static void collectPrefixes(FieldInfos fieldInfos, String field,
ComponentField fieldInfo, Status status) throws IOException {
if (fieldInfo.prefix != null) {
FieldInfo fi = fieldInfos.fieldInfo(field);
if (fi != null) {
String singlePositionPrefixes = fi.getAttribute(
... |
python | def zoom_fit(self, no_reset=False):
"""Zoom to fit display window.
Also see :meth:`zoom_to`.
Parameters
----------
no_reset : bool
Do not reset ``autozoom`` setting.
"""
# calculate actual width of the limits/image, considering rotation
try:
... |
java | public static boolean fixedTimeEqual(String lhs, String rhs) {
boolean equal = (lhs.length() == rhs.length() ? true : false);
// If not equal, work on a single operand to have same length.
if(!equal) {
rhs = lhs;
}
int len = lhs.length();
for(int i=0;i<len;i++) {
if(lhs.charAt(i) == rhs.charAt(i... |
python | def plot_networkx(self, mode="network", with_edge_labels=False, ax=None, arrows=False,
node_size="num_cores", node_label="name_class", layout_type="spring", **kwargs):
"""
Use networkx to draw the flow with the connections among the nodes and
the status of the tasks.
... |
java | public void setTarget(char[] text, int start, int len, boolean shared) {
cache = null;
data = text;
offset = start;
end = start + len;
this.shared = shared;
init();
} |
java | private void restoreJsMessageFromMsgstore(boolean throwExceptionIfNotAvailable)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
{
SibTr.entry(this, tc, "restoreJsMessageFromMsgstore", Boolean.valueOf(throwExceptionIfNotAvailable));
}
restoringJsMessageO... |
java | public void addAttribute(
String uri,
String localName,
String rawName,
String type,
String value,
boolean XSLAttribute)
throws SAXException
{
if (m_elemContext.m_startTagOpen)
{
ensurePrefixIsDeclared(uri, rawName);
... |
java | public static void checkColumns(final Sheet sheet, final Class<?> recordClass,
final List<RecordHeader> headers, final AnnotationReader reader, final Configuration config)
throws CellNotFoundException {
List<FieldAccessor> properties = FieldAccessorUtils.getPropertie... |
python | def newTextChild(self, ns, name, content):
"""Creation of a new child element, added at the end of
@parent children list. @ns and @content parameters are
optional (None). If @ns is None, the newly created element
inherits the namespace of @parent. If @content is non None,
... |
java | protected String xlate (String bundle, String message)
{
if (bundle != null && _ctx.getMessageManager() != null) {
MessageBundle msgb = _ctx.getMessageManager().getBundle(bundle);
if (msgb == null) {
log.warning("No message bundle available to translate message", "bun... |
java | protected SuballocatedIntVector findNamespaceContext(int elementNodeIndex)
{
if (null!=m_namespaceDeclSetElements)
{
// %OPT% Is binary-search really saving us a lot versus linear?
// (... It may be, in large docs with many NS decls.)
int wouldBeAt=findInSortedSuballocatedIntVector(m... |
python | def _read_etc(etc_file):
"""Return information about table of content for each erd.
"""
etc_type = dtype([('offset', '<i'),
('samplestamp', '<i'),
('sample_num', '<i'),
('sample_span', '<h'),
('unknown', '<h')])
wit... |
python | def drop(self, relation):
"""Drop the named relation and cascade it appropriately to all
dependent relations.
Because dbt proactively does many `drop relation if exist ... cascade`
that are noops, nonexistent relation drops cause a debug log and no
other actions.
:param... |
python | def _find_node_by_indices(self, point):
""""Find the GSNode that is refered to by the given indices.
See GSNode::_indices()
"""
path_index, node_index = point
path = self.paths[int(path_index)]
node = path.nodes[int(node_index)]
return node |
java | public static <T extends Collection<Entity>> T handleRs(ResultSet rs, T collection) throws SQLException {
final ResultSetMetaData meta = rs.getMetaData();
final int columnCount = meta.getColumnCount();
while (rs.next()) {
collection.add(HandleHelper.handleRow(columnCount, meta, rs));
}
return col... |
java | public static Enumeration<URL> getResources(String resource) {
Enumeration<URL> urls = null;
try {
urls = ClassUtils.getContextClassLoader().getResources(resource);
} catch (IOException e) {
//noop
}
if (urls == null) {
try {
ur... |
java | public ServiceFuture<List<DetectorDefinitionInner>> listSiteDetectorsSlotAsync(final String resourceGroupName, final String siteName, final String diagnosticCategory, final String slot, final ListOperationCallback<DetectorDefinitionInner> serviceCallback) {
return AzureServiceFuture.fromPageResponse(
... |
java | public static <E> Iterator<E> filter(E[] array, Predicate<E> predicate) {
return filter(new ArrayIterator<E>(array), predicate);
} |
python | def add_not_filter(self, *value):
"""
Add a filter using "NOT" logic. Typically this filter is used in
conjunction with and AND or OR filters, but can be used by itself
as well. This might be more useful as a standalone filter when
displaying logs in real time and filtering out ... |
java | @XmlElementDecl(namespace = "http://docs.oasis-open.org/ns/cmis/messaging/200908/", name = "extension", scope = GetTypeDescendants.class)
public JAXBElement<CmisExtensionType> createGetTypeDescendantsExtension(
CmisExtensionType value) {
return new JAXBElement<CmisExtensionType>(
_GetPropertiesExtension_Q... |
java | public com.google.api.ads.admanager.axis.v201811.AlternativeUnitTypeForecast[] getAlternativeUnitTypeForecasts() {
return alternativeUnitTypeForecasts;
} |
python | def get_uint32(self):
"""Read the next token and interpret it as a 32-bit unsigned
integer.
@raises dns.exception.SyntaxError:
@rtype: int
"""
token = self.get().unescape()
if not token.is_identifier():
raise dns.exception.SyntaxError('expecting an i... |
java | private void checkExistingMapping(StreamSegmentMapOperation operation) throws MetadataUpdateException {
long existingSegmentId = getStreamSegmentId(operation.getStreamSegmentName(), false);
if (existingSegmentId != ContainerMetadata.NO_STREAM_SEGMENT_ID
&& existingSegmentId != operation.... |
python | def create_raw(self, key, value):
"""Create method of CRUD operation for raw data.
Args:
key (string): The variable to write to the DB.
value (any): The data to write to the DB.
Returns:
(string): Result of DB write.
"""
data = None
i... |
java | private double[] expandRawData(double[] data, int size) {
double[] expanded = new double[size];
int pos = 0;
for (int i = 0; i < data.length; i++) {
if (m._domains[i] == null) {
expanded[pos] = data[i];
pos++;
} else {
int idx = Double.isNaN(data[i]) ? m._domains[i].lengt... |
java | public String getValueString() {
try {
String s = value.getAsString();
if (s == null) {
throw new RuntimeException("AVA string is null");
}
return s;
} catch (IOException e) {
// should not occur
throw new RuntimeExc... |
java | public Observable<Page<SyncFullSchemaPropertiesInner>> listMemberSchemasAsync(final String resourceGroupName, final String serverName, final String databaseName, final String syncGroupName, final String syncMemberName) {
return listMemberSchemasWithServiceResponseAsync(resourceGroupName, serverName, databaseNam... |
java | @Override
public SqlInfo buildSqlInfo(BuildSource source) {
/* 获取拼接的参数 */
String suffix = source.getSuffix();
SqlInfo sqlInfo = source.getSqlInfo();
Node node = source.getNode();
/* 判断必填的参数是否为空 */
String fieldText = XmlNodeHelper.getAndCheckNodeText(node, ZealotConst... |
python | def lifter(cepstra, L=22):
"""Apply a cepstral lifter the the matrix of cepstra. This has the effect of increasing the
magnitude of the high frequency DCT coeffs.
:param cepstra: the matrix of mel-cepstra, will be numframes * numcep in size.
:param L: the liftering coefficient to use. Default is 22. L ... |
python | def status_reblogged_by(self, id):
"""
Fetch a list of users that have reblogged a status.
Does not require authentication for publicly visible statuses.
Returns a list of `user dicts`_.
"""
id = self.__unpack_id(id)
url = '/api/v1/statuses/{0}/reblogged_by'.for... |
java | private void traverseAndRemoveUnusedReferences(Node root) {
// Create scope from parent of root node, which also has externs as a child, so we'll
// have extern definitions in scope.
Scope scope = scopeCreator.createScope(root.getParent(), null);
if (!scope.hasSlot(NodeUtil.JSC_PROPERTY_NAME_FN)) {
... |
python | def whichEncoding(self):
"""How should I be encoded?
@returns: one of ENCODE_URL, ENCODE_KVFORM, or None. If None,
I cannot be encoded as a protocol message and should be
displayed to the user.
"""
if self.hasReturnTo():
if self.openid_message.isOpen... |
java | public void clean()
{
ChronoFullRevision cfr = firstCFR;
totalSize = size;
while (cfr != null) {
totalSize += cfr.size();
cfr = cfr.getNext();
}
if (totalSize < MAX_STORAGE_SIZE) {
return;
}
cfr = firstCFR;
while (cfr != null) {
totalSize += cfr.clean(revisionIndex, 0);
cfr = cfr.getN... |
java | private int getReplicaTypeForPartition(int partitionId) {
List<Integer> routingPartitionList = routingStrategy.getReplicatingPartitionList(partitionId);
// Determine if we should host this partition, and if so, whether we are a primary,
// secondary or n-ary replica for it
int correctRe... |
python | def extract_header(self):
"""Create a dictionary with the EVT header information"""
self.log.info("Extracting the header")
raw_header = self.raw_header = defaultdict(list)
first_line = self.blob_file.readline()
first_line = try_decode_string(first_line)
self.blob_file.see... |
python | def create_virtual_aggregation(geometry, crs):
"""Function to create aggregation layer based on extent.
:param geometry: The geometry to use as an extent.
:type geometry: QgsGeometry
:param crs: The Coordinate Reference System to use for the layer.
:type crs: QgsCoordinateReferenceSystem
:ret... |
python | def get_valid_parent_pages(self, user):
"""
Identifies possible parent pages for the current user by first looking
at allowed_parent_page_models() on self.model to limit options to the
correct type of page, then checking permissions on those individual
pages to make sure we have ... |
java | public Iterator
generators() {
if (generators != null)
return Collections.unmodifiableList(generators).iterator();
else
return Collections.EMPTY_LIST.iterator();
} |
python | def plot_f(self, plot_limits=None, fixed_inputs=None,
resolution=None,
apply_link=False,
which_data_ycols='all', which_data_rows='all',
visible_dims=None,
levels=20, samples=0, lower=2.5, upper=97.5,
plot_density=False,
pl... |
java | public List<String> findList(String str, String regex) {
ArrayList<String> ret = new ArrayList<String>();
if (str == null || regex == null)
return ret;
Matcher m = Pattern.compile(regex).matcher(str);
while (m.find()) {
ret.add(m.group());
}
return ret;
} |
python | def validate(self, value, model=None, context=None):
"""
Validate
Perform value validation and return result
:param value: value to check
:param model: parent model being validated
:param context: object or None, validation context
:re... |
java | public int getIntValue(String name, int defaultValue)
throws NumberFormatException {
String value = getValue(name);
if (value == null) {
return defaultValue;
} else {
return Integer.parseInt(value);
}
} |
python | def find_all(self, tagtype):
''' Find all token-level tags with the specified tagtype '''
return [t for t in self.__tags if t.tagtype == tagtype] |
python | def Harms(x, rhol, rhog, mul, mug, m, D):
r'''Calculates void fraction in two-phase flow according to the model of
[1]_ also given in [2]_ and [3]_.
.. math::
\alpha = \left[1 - 10.06Re_l^{-0.875}(1.74 + 0.104Re_l^{0.5})^2
\left(1.376 + \frac{7.242}{X_{tt}^{1.655}}\right)^{-0.5}\right]^2
... |
python | def getCancelURL(self):
"""Get the URL to cancel this request.
Useful for creating a "Cancel" button on a web form so that operation
can be carried out directly without another trip through the server.
(Except you probably want to make another trip through the server so
that it... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.