language stringclasses 2
values | func_code_string stringlengths 63 466k |
|---|---|
java | @SuppressWarnings({ "unchecked", "rawtypes" })
public List<HazeltaskTask<G>> shutdownNow() {
return (List<HazeltaskTask<G>>) (List) localExecutorPool.shutdownNow();
} |
python | def unicode_stdio ():
"""Make sure that the standard I/O streams accept Unicode.
In Python 2, the standard I/O streams accept bytes, not Unicode
characters. This means that in principle every Unicode string that we want
to output should be encoded to utf-8 before print()ing. But Python 2.X has
a ha... |
python | def calc_hmin_qmin_hmax_qmax_v1(self):
"""Determine an starting interval for iteration methods as the one
implemented in method |calc_h_v1|.
The resulting interval is determined in a manner, that on the
one hand :math:`Qmin \\leq QRef \\leq Qmax` is fulfilled and on the
other hand the results of me... |
java | public String key(String keyName, String defaultKeyName) {
String value = getMessages().key(keyName, getLocalizeParameters());
if (value.startsWith(CmsMessages.UNKNOWN_KEY_EXTENSION) && CmsStringUtil.isNotEmpty(defaultKeyName)) {
value = getMessages().key(defaultKeyName, getLocalizeParamete... |
java | public static BigFloat min(BigFloat value1, BigFloat... values) {
BigFloat result = value1;
for (BigFloat other : values) {
result = min(result, other);
}
return result;
} |
python | def _info(self):
"""
Module internal status representation
"""
name = self.__class__.__module__ + '.' + self.__class__.__name__
info, created = ModuleInfo.objects.get_or_create(name=name)
if created:
# Do not set as changed
info.commit()
re... |
python | def raw_encode(data):
"""Special case serializer."""
content_type = 'application/data'
payload = data
if isinstance(payload, unicode):
content_encoding = 'utf-8'
payload = payload.encode(content_encoding)
else:
content_encoding = 'binary'
return content_type, content_enco... |
python | def get_qutip_module(required_version='3.2'):
"""
Attempts to return the qutip module, but
silently returns ``None`` if it can't be
imported, or doesn't have version at
least ``required_version``.
:param str required_version: Valid input to
``distutils.version.LooseVersion``.
:retur... |
python | def create_lr_scheduler_with_warmup(lr_scheduler, warmup_start_value, warmup_end_value, warmup_duration,
save_history=False,
output_simulated_values=None):
"""
Helper method to create a LR scheduler with a linear warm-up.
Args:
... |
java | public String rawQuery() {
int start = pathEndIdx() + 1;
return start < uri.length() ? uri.substring(start) : EMPTY_STRING;
} |
java | @SuppressWarnings("unchecked")
public final Command optimiezeGet(final Queue writeQueue, final Queue<Command> executingCmds,
Command optimiezeCommand) {
if (optimiezeCommand.getCommandType() == CommandType.GET_ONE
|| optimiezeCommand.getCommandType() == CommandType.GETS_ONE) {
if (this.optimie... |
python | def format_language(language):
"""
Attempt to format language parameter as 'ww-WW'.
:param string language: language parameter
"""
if not language:
return language
if not re.match('^[a-zA-Z]{2}[_-][a-zA-Z]{2}$', language):
raise TwiMLException('Invalid value for language parame... |
java | private Statement generateFunctionBodyForSoyElement(TemplateNode node) {
String soyElementClassName = this.getSoyElementClassName();
Expression firstElementKey =
// Since Soy element roots cannot have manual keys (see go/soy-element-keyed-roots),
// this will always be the first element key.
... |
java | private boolean recreateMismatching() {
List<Configuration> mismatching = inventory.removeMismatching();
mismatching.forEach(entry->{
try {
inventory.add(InventoryEntry.create(entry.copyWithIdentifier(inventory.nextIdentifier()), newConfigurationFile()));
} catch (IOException e1) {
logger.log(Level.WA... |
python | def app_profile(
self,
app_profile_id,
routing_policy_type=None,
description=None,
cluster_id=None,
allow_transactional_writes=None,
):
"""Factory to create AppProfile associated with this instance.
For example:
.. literalinclude:: snippets.p... |
java | private OnPreferenceChangeListener createHideNavigationChangeListener() {
return new OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(final Preference preference, final Object newValue) {
if (newValue != null) {
boolean hideN... |
java | public FNCPatAlign createFNCPatAlignFromString(EDataType eDataType, String initialValue) {
FNCPatAlign result = FNCPatAlign.get(initialValue);
if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'");
return result;
} |
java | public HistoryReference getHistoryReferenceFromNode(Object value) {
SiteNode node = null;
if (value instanceof SiteNode) {
node = (SiteNode) value;
if (node.getHistoryReference() != null) {
try {
return node.getHistoryReference();
} catch (Exception e) {
log.warn(e.getMessage(), e);
}
... |
java | private State checkl(State state) throws DatatypeException, IOException {
if (state.context.length() == 0) {
state = appendToContext(state);
}
state.current = state.reader.read();
state = appendToContext(state);
state = skipSpaces(state);
_checkl('l', true, st... |
java | @Override
public CreateContactResult createContact(CreateContactRequest request) {
request = beforeClientExecution(request);
return executeCreateContact(request);
} |
java | @Override
public void eUnset(int featureID) {
switch (featureID) {
case AfplibPackage.TEXT_FIDELITY__STP_TXT_EX:
setStpTxtEx(STP_TXT_EX_EDEFAULT);
return;
case AfplibPackage.TEXT_FIDELITY__REP_TXT_EX:
setRepTxtEx(REP_TXT_EX_EDEFAULT);
return;
}
super.eUnset(featureID);
} |
java | public Cell<C,T> minSize (float width, float height) {
minWidth = new FixedValue<C, T>(layout.toolkit, width);
minHeight = new FixedValue<C, T>(layout.toolkit, height);
return this;
} |
python | def sync_badges(**kwargs):
"""
Iterates over registered recipes and creates missing badges.
"""
update = kwargs.get('update', False)
created_badges = []
instances = registry.get_recipe_instances()
for instance in instances:
reset_queries()
badge, created = instance.create_ba... |
java | @Override
public boolean postBuild(MavenBuildProxy build, MavenProject pom, BuildListener listener)
throws InterruptedException, IOException {
build.executeAsync(new BuildCallable<Void, IOException>() {
// record is transient, so needs to make a copy first
private final S... |
java | public static base_responses update(nitro_service client, gslbvserver resources[]) throws Exception {
base_responses result = null;
if (resources != null && resources.length > 0) {
gslbvserver updateresources[] = new gslbvserver[resources.length];
for (int i=0;i<resources.length;i++){
updateresources[i] =... |
python | def gen_ordered(self):
"""Generate batches of operations, batched by type of
operation, in the order **provided**.
"""
run = None
for idx, (op_type, operation) in enumerate(self.ops):
if run is None:
run = _Run(op_type)
elif run.op_type != ... |
python | def create_backed_vol(self, name, backer, _format='qcow2'):
"""
TODO(rdelinger) think about changing _format
This is a pretty specialized function.
It takes an existing volume, and creates a new volume
that is backed by the existing volume
Sadly there is no easy way to do... |
python | def update_sentry_logging(logging_dict: DictStrAny,
sentry_dsn: Optional[str],
*loggers: str,
level: Union[str, int] = None,
**kwargs: Any) -> None:
r"""Enable Sentry logging if Sentry DSN passed.
.. note::
... |
python | def return_handler(module_logger, first_is_session=True):
"""Decorator for VISA library classes.
"""
def _outer(visa_library_method):
def _inner(self, session, *args, **kwargs):
ret_value = visa_library_method(*args, **kwargs)
module_logger.debug('%s%s -> %r',
... |
python | def _section_execution_order(self, section, iterargs
, reverse=False
, custom_order=None
, explicit_checks: Iterable = None
, exclude_checks: Iterable = None):
"""
order must:
a) contain... |
python | def _exec_vector(self, a, bd, xy, xy_orig, mask,
n_withdrifts, spec_drift_grids):
"""Solves the kriging system as a vectorized operation. This method
can take a lot of memory for large grids and/or large datasets."""
npt = bd.shape[0]
n = self.X_ADJUSTED.shape... |
python | def _FromSpecs(self, specs):
"""
Populates _params using specification
Arguments:
specs -- either:
(a) list as [(name, {...}), ...] (see Parameter.FromSpec() for further information)
(b) dictionary as {"name": value, ...}
"""
if isins... |
java | public List<String> getOutPorts() {
List<String> ports = new ArrayList<>();
JsonObject jsonPorts = config.getObject("ports");
if (jsonPorts == null) {
return ports;
}
JsonArray jsonOutPorts = jsonPorts.getArray("out");
if (jsonOutPorts == null) {
return ports;
}
for(Object js... |
java | static <K extends Comparable<K>> void checkNode(Node<K> node) {
node.checkNode(null, null);
} |
java | @Override
public void exitQuery(GDLParser.QueryContext ctx) {
for(Vertex v : vertices) {
addPredicates(Predicate.fromGraphElement(v, getDefaultVertexLabel()));
}
for(Edge e : edges) {
addPredicates(Predicate.fromGraphElement(e, getDefaultEdgeLabel()));
}
} |
python | def _callRestartAgent(self, ev_data: RestartLogData, failTimeout) -> None:
"""
Callback which is called when restart time come.
Writes restart record to restart log and asks
node control service to perform restart
:param ev_data: restart event data
:param version: versio... |
python | def insertion(args):
"""
%prog insertion mic.mac.bed
Find IES based on mapping MIC reads to MAC genome. Output a bedfile with
'lesions' (stack of broken reads) in the MAC genome.
"""
p = OptionParser(insertion.__doc__)
p.add_option("--mindepth", default=6, type="int",
help=... |
python | def getApplicationSupportedMimeTypes(self, pchAppKey, pchMimeTypesBuffer, unMimeTypesBuffer):
"""Get the list of supported mime types for this application, comma-delimited"""
fn = self.function_table.getApplicationSupportedMimeTypes
result = fn(pchAppKey, pchMimeTypesBuffer, unMimeTypesBuffer)
... |
python | def evil(expr, lookup, operators, cast, reducer, tokenizer):
"""evil evaluates an expression according to the eval description given.
:param expr: An expression to evaluate.
:param lookup: A callable which takes a single pattern argument and returns
a set of results. The pattern can be a... |
python | def xpath(node, query, namespaces={}):
"""A safe xpath that only uses namespaces if available."""
if namespaces and 'None' not in namespaces:
return node.xpath(query, namespaces=namespaces)
return node.xpath(query) |
python | def find_cc(arch, args, sp_delta):
"""
Pinpoint the best-fit calling convention and return the corresponding SimCC instance, or None if no fit is
found.
:param Arch arch: An ArchX instance. Can be obtained from archinfo.
:param list args: A list of arguments.
... |
python | def line_pos_from_number(self, line_number):
"""
Computes line position on Y-Axis (at the center of the line) from line
number.
:param line_number: The line number for which we want to know the
position in pixels.
:return: The center position of the l... |
python | def remove_object(collision_object):
"""Remove the collision object from the Manager"""
global collidable_objects
if isinstance(collision_object, CollidableObj):
# print "Collision object of type ", type(collision_object), " removed from the collision manager."
try:
... |
java | @Deprecated
public Decoder<S> getDecoder(int generation) throws FetchNoneException, FetchException {
try {
synchronized (mLayout) {
IntHashMap decoders = mDecoders;
if (decoders == null) {
mDecoders = decoders = new IntHashMap();
... |
python | def runcoro(async_function):
"""
Runs an asynchronous function without needing to use await - useful for lambda
Args:
async_function (Coroutine): The asynchronous function to run
"""
future = _asyncio.run_coroutine_threadsafe(async_function, client.loop)
result = future.result()
re... |
java | public void reimageComputeNode(String poolId, String nodeId, ComputeNodeReimageOption nodeReimageOption, Iterable<BatchClientBehavior> additionalBehaviors) throws BatchErrorException, IOException {
ComputeNodeReimageOptions options = new ComputeNodeReimageOptions();
BehaviorManager bhMgr = new BehaviorM... |
java | public FormLoginConfigType<LoginConfigType<T>> getOrCreateFormLoginConfig()
{
Node node = childNode.getOrCreate("form-login-config");
FormLoginConfigType<LoginConfigType<T>> formLoginConfig = new FormLoginConfigTypeImpl<LoginConfigType<T>>(this, "form-login-config", childNode, node);
return formLog... |
java | public String format(final Duration duration)
{
if (duration == null)
return format(now());
TimeFormat format = getFormat(duration.getUnit());
String time = format.format(duration);
return format.decorate(duration, time);
} |
python | def ensure_string_list(self, option):
r"""Ensure that 'option' is a list of strings. If 'option' is
currently a string, we split it either on /,\s*/ or /\s+/, so
"foo bar baz", "foo,bar,baz", and "foo, bar baz" all become
["foo", "bar", "baz"].
"""
val = getattr(self, ... |
java | public void addImportedPackages(Set<String> importedPackages) {
addImportedPackages(importedPackages.toArray(new String[importedPackages.size()]));
} |
python | def deaccent(text):
"""
Remove accentuation from the given string.
"""
norm = unicodedata.normalize("NFD", text)
result = "".join(ch for ch in norm if unicodedata.category(ch) != 'Mn')
return unicodedata.normalize("NFC", result) |
java | static protected Map<String, String> extractTemplateParameters(String viewName){
int i1 = -1;
int i2 = -1;
int i3 = -1;
int i4 = -1;
i1 = viewName.indexOf(LEFT_BRACKET);
if (i1 != -1){
i2 = viewName.indexOf(LEFT_BRACKET, i1+1);
}
i4 = viewName.lastIndexOf(RIGHT_BRACKET);
if (i4 != -1){
i3 = view... |
python | def memoized(func):
"""Decorate a function to memoize results.
Functions wraped by this decorator won't compute twice for each input.
Any results will be stored. This decorator might increase used memory
in order to shorten computational time.
"""
cache = {}
@wraps(func)
def memoized_fu... |
java | private static DateTime parseDate(String dateStr, DateTime defaultDate, boolean floor) {
if ("now".equals(dateStr)) { //$NON-NLS-1$
return new DateTime();
}
if (dateStr.length() == 10) {
DateTime parsed = ISODateTimeFormat.date().withZone(DateTimeZone.UTC).parseDateTime(d... |
java | public static String extractMultiAndDelPre(String regex, Holder<CharSequence> contentHolder, String template) {
if (null == contentHolder || null == regex || null == template) {
return null;
}
// Pattern pattern = Pattern.compile(regex, Pattern.DOTALL);
final Pattern pattern = PatternPool.get(regex, P... |
java | public void setGrants(java.util.Collection<GrantListEntry> grants) {
if (grants == null) {
this.grants = null;
return;
}
this.grants = new com.amazonaws.internal.SdkInternalList<GrantListEntry>(grants);
} |
python | def _compute_mean(self, imt, mag, rhypo):
"""
Compute mean value from lookup table.
Lookup table defines log10(IMT) (in g) for combinations of Mw and
log10(rhypo) values. ``mag`` is therefore converted from Mblg to Mw
using Atkinson and Boore 1987 conversion equation. Mean value... |
java | public int doRecordChange(FieldInfo field, int iChangeType, boolean bDisplayOption)
{
int iErrorCode = super.doRecordChange(field, iChangeType, bDisplayOption);
if (iChangeType == DBConstants.AFTER_UPDATE_TYPE)
{
MessageManager messageManager = ((Application)this.getOwner().getTa... |
python | def expand_row(table_fields,fields,values):
"helper for insert. turn (field_names, values) into the full-width, properly-ordered row"
table_fieldnames=[f.name for f in table_fields]
reverse_indexes={table_fieldnames.index(f):i for i,f in enumerate(fields)}
indexes=[reverse_indexes.get(i) for i in range(len(tabl... |
python | def check_credentials(self):
''' Check credentials '''
req = requests.get(self.api_server + '/api/ad',
auth=(self.access_key, self.secret_key))
# Not sure 500 server error should be included here
if req.status_code in [401, 403, 500]:
return False
... |
java | public CmsUUID publishProject(CmsObject cms, I_CmsReport report) throws CmsException {
return publishProject(cms, report, getPublishList(cms));
} |
python | def Send(self, url, opname, obj, nsdict={}, soapaction=None, wsaction=None,
endPointReference=None, soapheaders=(), **kw):
'''Send a message. If url is None, use the value from the
constructor (else error). obj is the object (data) to send.
Data may be described with a requesttype... |
java | public void each(ObjectName pObjectName, MBeanEachCallback pCallback) throws IOException, ReflectionException, MBeanException {
try {
Set<ObjectName> visited = new HashSet<ObjectName>();
for (MBeanServerConnection server : getMBeanServers()) {
// Query for a full name is ... |
python | def retryNextHost(self, connector=None):
"""
Have this connector connect again, to the next host in the
configured list of hosts.
"""
if not self.continueTrying:
msg = "TxMongo: Abandoning {0} on explicit request.".format(connector)
log.msg(msg... |
python | def get_chat_from_id(self, chat_id):
"""
Fetches a chat given its ID
:param chat_id: Chat ID
:type chat_id: str
:return: Chat or Error
:rtype: Chat
"""
chat = self.wapi_functions.getChatById(chat_id)
if chat:
return factory_chat(chat, ... |
java | public static Object invokeMethod(Object object, String methodName, Class<?>[] parameterTypes,
Object[] parameters) throws NoSuchMethodException, InvocationTargetException,
IllegalAccessException {
if (Checker.isEmpty(parameters)) {
return object.get... |
java | public synchronized void restoreTaskUpdates(List<TaskInfo> tasks) {
for (TaskInfo task : tasks) {
Pair<Long, Integer> id = new Pair<>(task.getJobId(), task.getTaskId());
if (!mTaskUpdates.containsKey(id)) {
mTaskUpdates.put(id, task);
}
}
} |
java | public ServiceFuture<ExpressRouteCircuitsRoutesTableListResultInner> listRoutesTableAsync(String resourceGroupName, String crossConnectionName, String peeringName, String devicePath, final ServiceCallback<ExpressRouteCircuitsRoutesTableListResultInner> serviceCallback) {
return ServiceFuture.fromResponse(listRo... |
python | async def remove_participant(self, p: Participant):
""" remove a participant from the tournament
|methcoro|
Args:
p: the participant to remove
Raises:
APIException
"""
await self.connection('DELETE', 'tournaments/{}/participants/{}'.format(self... |
python | def clear(self):
"""delete and re-initialize all private components to zero"""
for field in self.__privfields__:
delattr(self, field)
setattr(self, field, MPI(0)) |
java | @Override
public Object run(Object... args) {
assertLength(args, 2, 3);
return process(assertAssignable(assertNotNull(args[0]), InvocationContext.class),
assertAssignable(assertNotNull(args[1]), HttpResponse.class),
(args.length > 2)? args[2] :null);
} |
java | protected String getDeviceViewName(String viewName) {
// Check for special "redirect:" prefix.
if (viewName.startsWith(REDIRECT_URL_PREFIX)) {
return viewName;
}
// Check for special "forward:" prefix.
if (viewName.startsWith(FORWARD_URL_PREFIX)) {
return viewName;
}
return getDeviceViewNameInternal... |
python | def create(
self, policy_id,
type,
condition_scope,
name,
entities,
metric,
terms,
runbook_url=None,
user_defined=None,
enabled=True):
"""
Creates an alert condition
:type pol... |
python | def next_power_of_2(x):
"""Finds the next power of 2 value
Args:
x: Input value
Returns:
power_of_2: Next power of 2 value
"""
power_of_2 = 1 if x == 0 else 2 ** np.ceil(np.log2(x))
return power_of_2 |
python | def insert(self):
"""Insert this document"""
from mongoframes.queries import to_refs
# Send insert signal
signal('insert').send(self.__class__, frames=[self])
# Prepare the document to be inserted
document = to_refs(self._document)
# Insert the document and upd... |
python | def delete(name, runas=None):
'''
Delete a VM
.. versionadded:: 2016.11.0
:param str name:
Name/ID of VM to clone
:param str runas:
The user that the prlctl command will be run as
Example:
.. code-block:: bash
salt '*' parallels.exec macvm 'find /etc/paths.d' ru... |
java | @CliObjectOption(description = "Specifies files should be updated if they're different in the source.")
public EmbeddedGobblinDistcp update() {
this.setConfiguration(RecursiveCopyableDataset.UPDATE_KEY, Boolean.toString(true));
return this;
} |
java | @Override
public boolean set(HttpCookie cookie, byte[] data) {
if (null != data && 0 < data.length) {
cookie.setAttribute(getName(), HttpChannelUtils.getEnglishString(data));
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Cookie Comme... |
java | @Override
public synchronized void read (byte[] bytes, long storageIndex) throws IOException {
final int bucketIndex = (int) (storageIndex / SIZE_PER_BUCKET);
final int bucketOffset = (int) (storageIndex % SIZE_PER_BUCKET);
try {
storeBucket(-1, null);
// // DEBUG C... |
python | def parse_doc_tree(self, doctree, pypackages):
"""Parse the given documentation tree.
:param str doctree: The absolute path to the documentation tree which is to be parsed.
:param set pypackages: A set of all Python packages found in the pytree.
:rtype: dict
:returns: A dict whe... |
python | def loggray(x, a, b):
"""Auxiliary function that specifies the logarithmic gray scale.
a and b are the cutoffs."""
linval = 10.0 + 990.0 * (x-float(a))/(b-a)
return (np.log10(linval)-1.0)*0.5 * 255.0 |
java | public static Part<String> text(String name, String value) {
// the text part do not set content type
return new Part<>(name, null, value, null, null, (body, out, charset) -> {
OutputStreamWriter writer = new OutputStreamWriter(out, Objects2.elvis(charset, ISO_8859_1));
writer.wr... |
java | public static final void plus(Structure s, Matrix matrix){
AtomIterator iter = new AtomIterator(s) ;
Atom oldAtom = null;
Atom rotOldAtom = null;
while (iter.hasNext()) {
Atom atom = null ;
atom = iter.next() ;
try {
if ( oldAtom != null){
logger.debug("before {}", getDistance(oldAtom,atom));... |
java | public static void divideRowBy(Matrix matrix, long aRow, long fromCol, double value) {
long cols = matrix.getColumnCount();
for (long col = fromCol; col < cols; col++) {
matrix.setAsDouble(matrix.getAsDouble(aRow, col) / value, aRow, col);
}
} |
java | @Override
@Trivial
public InputStream getInputStream(ZipFile useZipFile, ZipEntry zipEntry) throws IOException {
String methodName = "getInputStream";
String entryName = zipEntry.getName();
if ( zipEntry.isDirectory() ) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebu... |
java | public static boolean hasProperty(Properties props, String key) {
String value = props.getProperty(key);
if (value == null) {
return false;
}
value = value.toLowerCase();
return ! (value.equals("false") || value.equals("no") || value.equals("off"));
} |
java | protected StyledString signatureWithoutReturnType(StyledString simpleName, JvmExecutable element) {
return simpleName.append(this.uiStrings.styledParameters(element));
} |
python | def header(self):
"""
Return the BAM/SAM header
Returns
-------
generator
Each line of the header
"""
cmd = [self.__samtools, 'view', '-H', self.__bam]
stdout = subprocess.Popen(cmd, stdout=subprocess.PIPE).stdout
fo... |
python | def getFaxResult(self, CorpNum, ReceiptNum, UserID=None):
""" ํฉ์ค ์ ์ก๊ฒฐ๊ณผ ์กฐํ
args
CorpNum : ํ๋นํ์ ์ฌ์
์๋ฒํธ
ReceiptNum : ์ ์ก์์ฒญ์ ๋ฐ๊ธ๋ฐ์ ์ ์๋ฒํธ
UserID : ํ๋นํ์ ์์ด๋
return
ํฉ์ค์ ์ก์ ๋ณด as list
raise
PopbillException
... |
java | protected <T extends Serializable> void postDeserializer(T serializableObject) {
Method method = null;
for(Field field : ReflectionMethods.getAllFields(new LinkedList<>(), serializableObject.getClass())) {
if (field.isAnnotationPresent(BigMap.class)) { //look only for BigMaps
... |
java | @SuppressWarnings("PMD.CompareObjectsWithEquals")
private void processArithmetic() {
if (stack.getStackDepth() > 1) {
OpcodeStack.Item arg1 = stack.getStackItem(0);
OpcodeStack.Item arg2 = stack.getStackItem(1);
Units u1 = (Units) arg1.getUserValue();
Units u... |
java | @Override
public EClass getVersion() {
if (versionEClass == null) {
versionEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(StorePackage.eNS_URI).getEClassifiers().get(46);
}
return versionEClass;
} |
java | @CheckForNull
public static OffsetDateTime parseOffsetDateTimeQuietly(@Nullable String s) {
OffsetDateTime datetime = null;
if (s != null) {
try {
datetime = parseOffsetDateTime(s);
} catch (RuntimeException e) {
// ignore
}
}
return datetime;
} |
python | def init(self, id):
"""
This method does nothing and will simply tell if the next ID
will be larger than the given ID.
You don't need to call this method on cluster restart - uniqueness is preserved thanks to the
timestamp component of the ID.
This method exists to make :... |
python | def _deprefix(line, prefix, callback=None):
"""Remove the prefix string from the beginning of line, if it exists.
:param string line: A line, such as one output by GnuPG's status-fd.
:param string prefix: A substring to remove from the beginning of
``line``. Case insensitive.
:type callback: ca... |
python | def ping():
'''
Returns true if the device is reachable, else false.
'''
try:
session, cookies, csrf_token = logon()
logout(session, cookies, csrf_token)
except salt.exceptions.CommandExecutionError:
return False
except Exception as err:
log.debug(err)
ret... |
java | public void marshall(AdminUpdateDeviceStatusRequest adminUpdateDeviceStatusRequest, ProtocolMarshaller protocolMarshaller) {
if (adminUpdateDeviceStatusRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshalle... |
java | public static Expression arrayRemove(String expression, Expression value) {
return arrayRemove(x(expression), value);
} |
java | public void writeNestedLibrary(String destination, Library library)
throws IOException {
File file = library.getFile();
JarArchiveEntry entry = new JarArchiveEntry(destination + library.getName());
entry.setTime(getNestedLibraryTime(file));
new CrcAndSize(file).setupStoredEntry(entry);
writeEntry(entry, ne... |
python | def GetForwardedIps(self, interface, interface_ip=None):
"""Retrieve the list of configured forwarded IP addresses.
Args:
interface: string, the output device to query.
interface_ip: string, current interface ip address.
Returns:
list, the IP address strings.
"""
try:
ips =... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.