language stringclasses 2
values | func_code_string stringlengths 63 466k |
|---|---|
java | public Observable<Void> beginScanForUpdatesAsync(String deviceName, String resourceGroupName) {
return beginScanForUpdatesWithServiceResponseAsync(deviceName, resourceGroupName).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
... |
python | def getpad(self):
"""Get pad value of DataBatch."""
if self.last_batch_handle == 'pad' and \
self.cursor + self.batch_size > self.num_data:
return self.cursor + self.batch_size - self.num_data
# check the first batch
elif self.last_batch_handle == 'roll_over' and \... |
python | async def create(self, config: dict = None, access: str = None, replace: bool = False) -> Wallet:
"""
Create wallet on input name with given configuration and access credential value.
Raise ExtantWallet if wallet on input name exists already and replace parameter is False.
Raise BadAcce... |
java | private Stream<Numeric> runComputeMean(GraqlCompute.Statistics.Value query) {
Map<String, Double> meanPair = runComputeStatistics(query);
if (meanPair == null) return Stream.empty();
Double mean = meanPair.get(MeanMapReduce.SUM) / meanPair.get(MeanMapReduce.COUNT);
return Stream.of(new ... |
python | def run_ipython_notebook(notebook_str):
"""
References:
https://github.com/paulgb/runipy
>>> from utool.util_ipynb import * # NOQA
"""
from runipy.notebook_runner import NotebookRunner
import nbformat
import logging
log_format = '%(asctime)s %(levelname)s: %(message)s'
l... |
java | @GetMapping(path = "/instances/{id}", produces = MediaType.APPLICATION_JSON_VALUE)
public Mono<ResponseEntity<Instance>> instance(@PathVariable String id) {
LOGGER.debug("Deliver registered instance with ID '{}'", id);
return registry.getInstance(InstanceId.of(id))
.filter(Ins... |
java | private ControlFlushed createControlFlushed(SIBUuid8 target, SIBUuid12 stream)
throws SIResourceException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "createControlFlushed", stream);
ControlFlushed flushedMsg;
// Create new message
try
{
flu... |
python | def do_forget(self, repo):
'''
Drop definition of a repo.
forget REPO
'''
self.abort_on_nonexisting_repo(repo, 'forget')
self.network.forget(repo) |
java | public static Transform createRotateTransform(float angle) {
return new Transform((float)FastTrig.cos(angle), -(float)FastTrig.sin(angle), 0, (float)FastTrig.sin(angle), (float)FastTrig.cos(angle), 0);
} |
java | @SuppressWarnings("unchecked")
private boolean hasPropertiesConfiguration(Dictionary properties) {
HashMap<Object, Object> mapProperties = new HashMap<Object, Object>(properties.size());
for (Object key : Collections.list(properties.keys())) {
mapProperties.put(key, properties.get(key));
}
mapPr... |
java | public static boolean isSecure(URI uri) {
Objects.requireNonNull(uri, "uri must not be null");
return uri.getScheme().equals("wss") || uri.getScheme().equals("https");
} |
python | def collapse_short_branches(self, threshold):
'''Collapse internal branches (not terminal branches) with length less than or equal to ``threshold``. A branch length of ``None`` is considered 0
Args:
``threshold`` (``float``): The threshold to use when collapsing branches
'''
... |
java | public CORSConfigBuilder withAllowedHeaders(String... headerNames) {
Mutils.notNull("headerNames", headerNames);
return withAllowedHeaders(asList(headerNames));
} |
python | def sleep(duration):
"""Return a `.Future` that resolves after the given number of seconds.
When used with ``yield`` in a coroutine, this is a non-blocking
analogue to `time.sleep` (which should not be used in coroutines
because it is blocking)::
yield gen.sleep(0.5)
Note that calling thi... |
java | public String getContentTypeWithVersion() {
if (!StringUtils.hasText(this.contentTypeTemplate)
|| !StringUtils.hasText(this.version)) {
return "";
}
return this.contentTypeTemplate.replaceAll(VERSION_PLACEHOLDER_REGEX,
this.version);
} |
java | public static GoogleJsonError parse(JsonFactory jsonFactory, HttpResponse response)
throws IOException {
JsonObjectParser jsonObjectParser = new JsonObjectParser.Builder(jsonFactory).setWrapperKeys(
Collections.singleton("error")).build();
return jsonObjectParser.parseAndClose(
response.ge... |
java | public static BeanBox value(Object value) {
return new BeanBox().setTarget(value).setPureValue(true).setRequired(true);
} |
python | def format_message(self, msg, botreply=False):
"""Format a user's message for safe processing.
This runs substitutions on the message and strips out any remaining
symbols (depending on UTF-8 mode).
:param str msg: The user's message.
:param bool botreply: Whether this formattin... |
java | public static Object selectMethod(MutableCallSite callSite, Class sender, String methodName, int callID, Boolean safeNavigation, Boolean thisCall, Boolean spreadCall, Object dummyReceiver, Object[] arguments) throws Throwable {
Selector selector = Selector.getSelector(callSite, sender, methodName, callID, s... |
java | public Observable<JobInner> getAsync(String resourceGroupName, String workspaceName, String experimentName, String jobName) {
return getWithServiceResponseAsync(resourceGroupName, workspaceName, experimentName, jobName).map(new Func1<ServiceResponse<JobInner>, JobInner>() {
@Override
pub... |
java | public void marshall(Environment environment, ProtocolMarshaller protocolMarshaller) {
if (environment == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(environment.getId(), ID_BINDING);
... |
python | def cublasZtpsv(handle, uplo, trans, diag, n, AP, x, incx):
"""
Solve complex triangular-packed system with one right-hand size.
"""
status = _libcublas.cublasZtpsv_v2(handle,
_CUBLAS_FILL_MODE[uplo],
_CUBLAS_OP[trans]... |
python | def delete_boot_script(self):
"""
::
DELETE /:login/machines/:id/metadata/user-script
Deletes any existing boot script on the machine.
"""
j, r = self.datacenter.request('DELETE', self.path +
'/metadata/user-script')
r.raise_... |
python | def from_bundle(cls, b, feature):
"""
Initialize a Spot feature from the bundle.
"""
feature_ps = b.get_feature(feature)
colat = feature_ps.get_value('colat', unit=u.rad)
longitude = feature_ps.get_value('long', unit=u.rad)
if len(b.hierarchy.get_stars())>=2:
... |
python | def render(self, data, accepted_media_type=None, renderer_context=None):
"""
Renders `data` into serialized YAML.
"""
assert yaml, 'YAMLRenderer requires pyyaml to be installed'
if data is None:
return ''
return yaml.dump(
data,
strea... |
java | public RTPFormats negotiateApplication(SessionDescription sdp, RTPFormats formats) {
this.application.clean();
MediaDescriptorField descriptor = sdp.getApplicationDescriptor();
descriptor.getFormats().intersection(formats, this.application);
return this.application;
} |
python | def _install_from_path(path):
'''
Internal function to install a package from the given path
'''
if not os.path.exists(path):
msg = 'File not found: {0}'.format(path)
raise SaltInvocationError(msg)
cmd = 'installer -pkg "{0}" -target /'.format(path)
return salt.utils.mac_utils.e... |
java | public Vector3f getRow(int row, Vector3f dest) throws IndexOutOfBoundsException {
switch (row) {
case 0:
dest.x = m00;
dest.y = m10;
dest.z = m20;
break;
case 1:
dest.x = m01;
dest.y = m11;
dest.z = m21;
... |
python | def create_volume(self, availability_zone, size=None, snapshot_id=None):
"""Create a new volume."""
params = {"AvailabilityZone": availability_zone}
if ((snapshot_id is None and size is None) or
(snapshot_id is not None and size is not None)):
raise ValueError("Please pro... |
python | def do_check(pool,request,models,include_children_for,modelgb):
"request is the output of translate_check. models a dict of {(model_name,pkey_tuple):model}.\
ICF is a {model_name:fields_list} for which we want to add nulls in request for missing children. see AMC for how it's used.\
The caller should have gone th... |
java | private int indexOf(int key) {
int startIndex = hashIndex(key);
int index = startIndex;
for (;;) {
if (values[index] == null) {
// It's available, so no chance that this value exists anywhere in the map.
return -1;
}
if (key == keys[index]) {
return index;
}
// Conflict, keep probing ... |
java | public final EObject ruleAntlrGrammar() throws RecognitionException {
EObject current = null;
Token otherlv_0=null;
Token lv_name_1_0=null;
Token otherlv_2=null;
EObject lv_options_3_0 = null;
EObject lv_rules_4_0 = null;
enterRule();
tr... |
java | public final void pinsrw(MMRegister dst, Register src, Immediate imm8)
{
emitX86(INST_PINSRW, dst, src, imm8);
} |
python | def ciphertext_length(header, plaintext_length):
"""Calculates the complete ciphertext message length, given a complete header.
:param header: Complete message header object
:type header: aws_encryption_sdk.structures.MessageHeader
:param int plaintext_length: Length of plaintext in bytes
:rtype: i... |
java | public void invalidate() {
synchronized (mMeasuredChildren) {
Log.d(Log.SUBSYSTEM.LAYOUT, TAG, "invalidate all [%d]", mMeasuredChildren.size());
mMeasuredChildren.clear();
}
} |
java | public Observable<Page<WorkspaceInner>> listByResourceGroupAsync(final String resourceGroupName) {
return listByResourceGroupWithServiceResponseAsync(resourceGroupName)
.map(new Func1<ServiceResponse<Page<WorkspaceInner>>, Page<WorkspaceInner>>() {
@Override
public Pa... |
java | public JSONObject getLogs(int offset, int length, LogType logType, RequestOptions requestOptions) throws AlgoliaException {
String type = null;
switch (logType) {
case LOG_BUILD:
type = "build";
break;
case LOG_QUERY:
type = "query";
break;
case LOG_ERROR:
... |
python | def ldcoeffs(teff,logg=4.5,feh=0):
"""
Returns limb-darkening coefficients in Kepler band.
"""
teffs = np.atleast_1d(teff)
loggs = np.atleast_1d(logg)
Tmin,Tmax = (LDPOINTS[:,0].min(),LDPOINTS[:,0].max())
gmin,gmax = (LDPOINTS[:,1].min(),LDPOINTS[:,1].max())
teffs[(teffs < Tmin)] = Tmi... |
python | def register_list_auth_roles_command(self, list_auth_roles_func):
"""
Add 'list_auth_roles' command to list project authorization roles that can be used with add_user.
:param list_auth_roles_func: function: run when user choses this option.
"""
description = "List authorization r... |
java | public final void bytes(Object source, Class sourceClass, byte[] data)
{
if (data == null)
bytes(source, sourceClass, data, 0, 0);
else
bytes(source, sourceClass, data, 0, data.length);
} |
python | def get_bulk_modify(self, value):
"""Return value in format for bulk modify"""
if self.multiselect:
value = value or []
return [self.cast_to_bulk_modify(child) for child in value]
return self.cast_to_bulk_modify(value) |
java | @Override
public synchronized void clear() {
if(isOpen()) {
_compactor.clear();
_addressArray.clear();
_segmentManager.clear();
this.init();
}
} |
python | def uncollapse(self):
"""Uncollapse a private message or modmail."""
url = self.reddit_session.config['uncollapse_message']
self.reddit_session.request_json(url, data={'id': self.name}) |
java | public EEnum getMappingOptionMapValue() {
if (mappingOptionMapValueEEnum == null) {
mappingOptionMapValueEEnum = (EEnum)EPackage.Registry.INSTANCE.getEPackage(AfplibPackage.eNS_URI).getEClassifiers().get(91);
}
return mappingOptionMapValueEEnum;
} |
python | def _zforce(self,R,z,phi=0.,t=0.):
"""
NAME:
zforce
PURPOSE:
evaluate vertical force K_z (R,z)
INPUT:
R - Cylindrical Galactocentric radius
z - vertical height
phi - azimuth
t - time
OUTPUT:
K_z (R,z)
... |
java | public static StringBuilder makePage(final String title,
final String subtitle,
final String body) {
return makePage(null, title, subtitle, body);
} |
python | def post_check_request(self, check, subscribers):
"""
Issues a check execution request.
"""
data = {
'check': check,
'subscribers': [subscribers]
}
self._request('POST', '/request', data=json.dumps(data))
return True |
java | public PagedList<LongTermRetentionBackupInner> listByServer(final String locationName, final String longTermRetentionServerName, final Boolean onlyLatestPerDatabase, final LongTermRetentionDatabaseState databaseState) {
ServiceResponse<Page<LongTermRetentionBackupInner>> response = listByServerSinglePageAsync(l... |
java | private static String decodeComponent(final String s, final Charset charset) {
if (s == null) {
return EMPTY_STRING;
}
return decodeComponent(s, 0, s.length(), charset, false);
} |
java | @Override
public void property(String name, String value, int nameValueSeparatorIndex)
throws OperationFormatException {
if(name != null) {
// TODO this is not nice
if(name.length() > 1 && name.charAt(0) == '-' && name.charAt(1) == '-') {
assertValidParam... |
python | def proc_fvals(self, fvals):
"""
Postprocess the outputs of the Session.run(). Move the outputs of
sub-graphs to next ones and return the output of the last sub-graph.
:param fvals: A list of fetched values returned by Session.run()
:return: A dictionary of fetched values returned by the last sub-g... |
java | public Set<String> getConfiguredWorkplaceBundles() {
Set<String> result = new HashSet<String>();
for (CmsResourceTypeConfig config : internalGetResourceTypes(false)) {
String bundlename = config.getConfiguredWorkplaceBundle();
if (null != bundlename) {
result.add... |
python | def delete_all_banks(self):
"""
Delete all banks files.
Util for manual save, because isn't possible know which banks
were removed
"""
for file in glob(str(self.data_path) + "/*.json"):
Persistence.delete(file) |
python | def _check_acl(self, acl_no, network, netmask):
"""Check a ACL config exists in the running config.
:param acl_no: access control list (ACL) number
:param network: network which this ACL permits
:param netmask: netmask of the network
:return:
"""
exp_cfg_lines = ... |
java | private static void build3ArgConstructor(final Class< ? > superClazz,
final String className,
final ClassWriter cw) {
MethodVisitor mv;
{
mv = cw.visitMethod( Opcodes.ACC_PUBLIC,
... |
java | public Matrix3d rotate(double ang, double x, double y, double z) {
return rotate(ang, x, y, z, this);
} |
python | def apply(self, search, field, value):
"""Apply lookup expression to search query."""
if not isinstance(value, list):
value = [x for x in value.strip().split(',') if x]
filters = [Q('match', **{field: item}) for item in value]
return search.query('bool', should=filters) |
python | def random_tournament_graph(n, random_state=None):
"""
Return a random tournament graph [1]_ with n nodes.
Parameters
----------
n : scalar(int)
Number of nodes.
random_state : int or np.random.RandomState, optional
Random seed (integer) or np.random.RandomState instance to set... |
java | public OvhRemoteAccess serviceName_remoteAccesses_POST(String serviceName, String allowedIp, Date expirationDate, Long exposedPort, String publicKey) throws IOException {
String qPath = "/overTheBox/{serviceName}/remoteAccesses";
StringBuilder sb = path(qPath, serviceName);
HashMap<String, Object>o = new HashMap<... |
python | def get_default_env(self):
"""
Vanilla Ansible local commands execute with an environment inherited
from WorkerProcess, we must emulate that.
"""
return dict_diff(
old=ansible_mitogen.process.MuxProcess.original_env,
new=os.environ,
) |
java | public Observable<ServiceResponse<Page<AppServiceCertificateResourceInner>>> listCertificatesNextWithServiceResponseAsync(final String nextPageLink) {
return listCertificatesNextSinglePageAsync(nextPageLink)
.concatMap(new Func1<ServiceResponse<Page<AppServiceCertificateResourceInner>>, Observable<S... |
java | public Writer write(Writer writer) throws JSONException {
try {
if (m_map.isEmpty()) {
writer.write("{}");
return writer;
}
// This prefix value applies to the first key only
String keyprefix = "{\"";
for (Entry<String, ... |
python | def adjust_attributes_on_object(self, collection, name, things, values, how):
"""
adjust labels or annotations on object
labels have to match RE: (([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])? and
have at most 63 chars
:param collection: str, object collection e.g. 'builds'
... |
java | @XmlElementDecl(namespace = "http://www.opengis.net/citygml/transportation/1.0", name = "_GenericApplicationPropertyOfTrack")
public JAXBElement<Object> create_GenericApplicationPropertyOfTrack(Object value) {
return new JAXBElement<Object>(__GenericApplicationPropertyOfTrack_QNAME, Object.class, null, valu... |
java | private static boolean hasNumberMacro(String pattern, String macroStart, String macroEnd) {
String macro = I_CmsFileNameGenerator.MACRO_NUMBER;
String macroPart = macroStart + macro + MACRO_NUMBER_DIGIT_SEPARATOR;
int prefixIndex = pattern.indexOf(macroPart);
if (prefixIndex >= 0) {
... |
java | private void buildSkyBox()
{
_skybox = new Skybox("skybox", 300, 300, 300);
try {
SimpleResourceLocator sr2 = new SimpleResourceLocator(ExampleBase.class.getClassLoader().getResource("org/poly2tri/examples/geotools/textures/"));
ResourceLocatorTool.addResourceLocator(Resour... |
python | def addChildren(self, child_ids):
"""Add children to current workitem
:param child_ids: a :class:`list` contains the children
workitem id/number (integer or equivalent string)
"""
if not hasattr(child_ids, "__iter__"):
error_msg = "Input parameter 'child_ids' is... |
java | protected void addResourceAttributesRules(Digester digester, String xpath) {
digester.addCallMethod(xpath + N_SOURCE, "setSource", 0);
digester.addCallMethod(xpath + N_DESTINATION, "setDestination", 0);
digester.addCallMethod(xpath + N_TYPE, "setType", 0);
digester.addCallMethod(xpath +... |
python | def end_parallel(self):
"""
Ends a parallel region by merging the channels into a single stream.
Returns:
Stream: Stream for which subsequent transformations are no longer parallelized.
.. seealso:: :py:meth:`set_parallel`, :py:meth:`parallel`
"""
outport = ... |
python | def createSimpleResourceMap(ore_pid, scimeta_pid, sciobj_pid_list):
"""Create a simple OAI-ORE Resource Map with one Science Metadata document and any
number of Science Data objects.
This creates a document that establishes an association between a Science Metadata
object and any number of Science Data... |
python | def deactivate(self):
"""
Deactivates the logical volume.
*Raises:*
* HandleError
"""
self.open()
d = lvm_lv_deactivate(self.handle)
self.close()
if d != 0:
raise CommitError("Failed to deactivate LV.") |
java | @Override
public int compare(int i, int j) {
final int bufferNumI = i / this.recordsPerSegment;
final int segmentOffsetI = (i % this.recordsPerSegment) * this.recordSize;
final int bufferNumJ = j / this.recordsPerSegment;
final int segmentOffsetJ = (j % this.recordsPerSegment) * this.recordSize;
final ... |
python | def fidelity_based(h1, h2): # 25 us @array, 51 us @list \w 100 bins
r"""
Fidelity based distance.
Also Bhattacharyya distance; see also the extensions `noelle_1` to `noelle_5`.
The metric between two histograms :math:`H` and :math:`H'` of size :math:`m` is defined as:
.. math::
... |
java | public void marshall(Model model, ProtocolMarshaller protocolMarshaller) {
if (model == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(model.getId(), ID_BINDING);
protocolMarshaller.marsh... |
python | def add_zone_condition(self, droppable_id, zone_id, match=True):
"""stub"""
self.my_osid_object_form._my_map['zoneConditions'].append(
{'droppableId': droppable_id, 'zoneId': zone_id, 'match': match})
self.my_osid_object_form._my_map['zoneConditions'].sort(key=lambda k: k['zoneId']) |
java | @Override
public <E, R> AppEngineGetScalar<E, R> get(Aggregation<R> aggregation) {
if (aggregation == null) {
throw new IllegalArgumentException("'aggregation' must not be [" + aggregation + "]");
}
return new AppEngineGetScalar<E, R>(aggregation, this);
} |
java | public Observable<ServiceResponse<Page<SiteInner>>> beginChangeVnetNextWithServiceResponseAsync(final String nextPageLink) {
return beginChangeVnetNextSinglePageAsync(nextPageLink)
.concatMap(new Func1<ServiceResponse<Page<SiteInner>>, Observable<ServiceResponse<Page<SiteInner>>>>() {
... |
java | @SuppressWarnings("unchecked")
@Override
public void itemStateChanged(final ItemEvent e)
{
final ItemSelectable is = e.getItemSelectable();
final Object selected[] = is.getSelectedObjects();
final T sel = (selected.length == 0) ? null : (T)selected[0];
model.setSelectedItem(sel);
} |
python | def wait_for_interrupt(self, check_interval=1.0, max_time=None):
"""Run the event loop until we receive a ctrl-c interrupt or max_time passes.
This method will wake up every 1 second by default to check for any
interrupt signals or if the maximum runtime has expired. This can be
set lo... |
python | def _node_add_with_peer_list(self, child_self, child_other):
'''_node_add_with_peer_list
Low-level api: Apply delta child_other to child_self when child_self is
the peer of child_other. Element child_self and child_other are list
nodes. Element child_self will be modified during the pro... |
java | static MemberMap cloneAdding(MemberMap source, MemberImpl... newMembers) {
Map<Address, MemberImpl> addressMap = new LinkedHashMap<>(source.addressToMemberMap);
Map<String, MemberImpl> uuidMap = new LinkedHashMap<>(source.uuidToMemberMap);
for (MemberImpl member : newMembers) {
putM... |
java | public float getPixelSize() {
if (mVectorState == null && mVectorState.mVPathRenderer == null ||
mVectorState.mVPathRenderer.mBaseWidth == 0 ||
mVectorState.mVPathRenderer.mBaseHeight == 0 ||
mVectorState.mVPathRenderer.mViewportHeight == 0 ||
mVectorState.mVPathRenderer.mViewportWid... |
java | public static boolean nullSafeEquals(String text1, String text2) {
if (text1 == null || text2 == null) {
return false;
} else {
return text1.equals(text2);
}
} |
python | def start_server_background(port):
"""Start the newtab server as a background process."""
if sys.version_info[0] == 2:
lines = ('import pydoc\n'
'pydoc.serve({port})')
cell = lines.format(port=port)
else:
# The location of newtabmagic (normally $IPYTHONDIR/extension... |
python | def save_as_plt(self, fname, pixel_array=None, vmin=None, vmax=None,
cmap=None, format=None, origin=None):
""" This method saves the image from a numpy array using matplotlib
:param fname: Location and name of the image file to be saved.
:param pixel_array: Numpy pixel array, i.e. ``num... |
python | def preserve_channel_dim(func):
"""Preserve dummy channel dim."""
@wraps(func)
def wrapped_function(img, *args, **kwargs):
shape = img.shape
result = func(img, *args, **kwargs)
if len(shape) == 3 and shape[-1] == 1 and len(result.shape) == 2:
result = np.expand_dims(resul... |
python | def remove_all_labels(stdout=None):
"""
Calls functions for dropping constraints and indexes.
:param stdout: output stream
:return: None
"""
if not stdout:
stdout = sys.stdout
stdout.write("Droping constraints...\n")
drop_constraints(quiet=False, stdout=stdout)
stdout.wri... |
python | def releases(release_id=None, **kwargs):
"""Get all releases of economic data."""
if not 'id' in kwargs and release_id is not None:
kwargs['release_id'] = release_id
return Fred().release(**kwargs)
return Fred().releases(**kwargs) |
java | @Override
protected String createDialogHtml(String dialog) {
StringBuffer result = new StringBuffer(1024);
// create table
result.append(createWidgetTableStart());
// show error header once if there were validation errors
result.append(createWidgetErrorHeader());
... |
java | public final static void changeConnection(final int position, final ConnectionNotation notation,
final HELM2Notation helm2notation) {
helm2notation.getListOfConnections().set(position, notation);
} |
java | public ConstantNameAndTypeInfo addConstantNameAndType(String name,
Descriptor type) {
return (ConstantNameAndTypeInfo)addConstant(new ConstantNameAndTypeInfo(this, name, type));
} |
java | public void accept(TokenKind tk) {
if (token.kind == tk) {
nextToken();
} else {
setErrorEndPos(token.pos);
reportSyntaxError(S.prevToken().endPos, "expected", tk);
}
} |
java | private String getCustomReloginErrorPage(HttpServletRequest req) {
String reLogin = CookieHelper.getCookieValue(req.getCookies(), ReferrerURLCookieHandler.CUSTOM_RELOGIN_URL_COOKIENAME);
if (reLogin != null && reLogin.length() > 0) {
if (reLogin.indexOf("?") < 0)
reLogin += "... |
java | public final void setIntent(@NonNull final Activity activity, @NonNull final Intent intent) {
Condition.INSTANCE.ensureNotNull(activity, "The activity may not be null");
Condition.INSTANCE.ensureNotNull(intent, "The intent may not be null");
removeAllItems();
PackageManager packageManage... |
python | def pystr(self, min_chars=None, max_chars=20):
"""
Generates a random string of upper and lowercase letters.
:type min_chars: int
:type max_chars: int
:return: String. Random of random length between min and max characters.
"""
if min_chars is None:
re... |
python | def _parse_template_or_argument(self):
"""Parse a template or argument at the head of the wikicode string."""
self._head += 2
braces = 2
while self._read() == "{":
self._head += 1
braces += 1
has_content = False
self._push()
while braces:
... |
java | private List<Float> interpolatePositions(PositionInfo left, PositionInfo right, int steps) {
if (left.isOutOfBounds()) {
if (right.isNormal()) {
return interpolateDownwards(right.getNavPos(), steps);
} else if (right.isMax() || right.isOutOfBounds()) {
... |
java | public static String digest(CharSequence self, String algorithm) throws NoSuchAlgorithmException {
final String text = self.toString();
return digest(text.getBytes(StandardCharsets.UTF_8), algorithm);
} |
java | public Options setxAxis(final Axis xAxis) {
this.xAxis = new ArrayList<Axis>();
this.xAxis.add(xAxis);
return this;
} |
java | private Object getConnection()
{
/*
* Jedis connection = factory.getConnection();
*
* // If resource is not null means a transaction in progress.
*
* if (settings != null) { for (String key : settings.keySet()) {
* connection.configSet(key, settings.ge... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.