language stringclasses 2
values | func_code_string stringlengths 63 466k |
|---|---|
java | public static Endpoint determineEndpointForRequest(final RequestAbstractType authnRequest,
final SamlRegisteredServiceServiceProviderMetadataFacade adaptor,
final String binding) {
var endpoint = (Endpo... |
python | def makeLabel(self, value):
"""Create a label for the specified value.
Create a label string containing the value and its units (if any),
based on the values of self.step, self.span, and self.unitSystem.
"""
value, prefix = format_units(value, self.step,
... |
java | public T addParams(Iterable<? extends TemplateParam> newParams) {
Set<String> seenParamKeys = new HashSet<>();
if (this.params == null) {
this.params = ImmutableList.copyOf(newParams);
} else {
for (TemplateParam oldParam : this.params) {
seenParamKeys.add(oldParam.name());
}
... |
java | @Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case AfplibPackage.TEXT_ORIENTATION__IAXIS:
return IAXIS_EDEFAULT == null ? iAxis != null : !IAXIS_EDEFAULT.equals(iAxis);
case AfplibPackage.TEXT_ORIENTATION__BAXIS:
return BAXIS_EDEFAULT == null ? bAxis != null : !BAXIS_EDEFAULT.eq... |
java | public DERObject toASN1Object()
{
ASN1EncodableVector v = new ASN1EncodableVector();
v.add(algId);
v.add(keyData);
return new DERSequence(v);
} |
python | def set_gid(self):
"""Change the group of the running process"""
if self.group:
gid = getgrnam(self.group).gr_gid
try:
os.setgid(gid)
except Exception:
message = ("Unable to switch ownership to {0}:{1}. " +
"D... |
python | def child(self, fragment):
"""
Returns a path of a child item represented by `fragment`.
"""
return os.path.join(self.path, FS(fragment).path) |
python | def put(text, cbname):
""" Put the given string into the given clipboard. """
global _lastSel
_checkTkInit()
if cbname == 'CLIPBOARD':
_theRoot.clipboard_clear()
if text:
# for clipboard_append, kwds can be -displayof, -format, or -type
_theRoot.clipboard_append(t... |
java | public void print(int i) throws IOException {
if (writer != null) {
writer.write(String.valueOf(i));
} else {
write(String.valueOf(i));
}
} |
java | private void recycleHeaderIfExists(WrapperView wv) {
View header = wv.mHeader;
if (header != null) {
// reset the headers visibility when adding it to the cache
header.setVisibility(View.VISIBLE);
mHeaderCache.add(header);
}
} |
java | @Override
public <T> int insertBatch(String entityName, List<T> entities) {
return insertBatch(entityName, entities.toArray());
} |
java | public void setReplacementTags(java.util.Collection<MessageTag> replacementTags) {
if (replacementTags == null) {
this.replacementTags = null;
return;
}
this.replacementTags = new com.amazonaws.internal.SdkInternalList<MessageTag>(replacementTags);
} |
python | def ranges_intersect(rset):
"""
Recursively calls the range_intersect() - pairwise version.
>>> ranges_intersect([(48, 65), (45, 55), (50, 56)])
[50, 55]
"""
if not rset:
return None
a = rset[0]
for b in rset[1:]:
if not a:
return None
a = range_inte... |
python | def login(self, user_id, password, svctype = "Android NDrive App ver", auth = 0):
"""Log in Naver and get cookie
Agrs:
user_id: Naver account's login id
password: Naver account's login password
Returns:
True: Login success
False: Login failed
... |
java | public void updateTreeContent(List<CmsGalleryTreeEntry> galleryTreeEntries, List<String> selectedGalleries) {
clearList();
m_selectedGalleries = selectedGalleries;
if (!galleryTreeEntries.isEmpty()) {
m_itemIterator = new TreeItemGenerator(galleryTreeEntries);
loadMoreIt... |
python | def json_2_application(json_obj):
"""
transform JSON obj coming from Ariane to ariane_clip3 object
:param json_obj: the JSON obj coming from Ariane
:return: ariane_clip3 Application object
"""
LOGGER.debug("Application.json_2_application")
return Application(appid... |
python | def upsampling_feature_passthrough(early_feat, late_feat, filters, name, kernel_size=(1, 1)):
"""
An upsampling feature passthrough layer inspired by yolo9000 and the tiling layer.
It can be proven, that this layer does the same as conv(concat(early_feat, tile_2d(late_feat))).
This layer has no activat... |
python | def _copy(src, dst):
"""Copy src to dst, copying recursively if src is a directory."""
try:
shutil.copy(src, dst)
except IsADirectoryError:
if os.path.isdir(dst):
dst = os.path.join(dst, os.path.basename(src))
shutil.copytree(src, dst) |
python | def mkstemp(suffix=None, prefix=None, dir=None, text=False):
"""
Args:
suffix (`pathlike` or `None`): suffix or `None` to use the default
prefix (`pathlike` or `None`): prefix or `None` to use the default
dir (`pathlike` or `None`): temp dir or `None` to use the default
text (boo... |
python | def any_embedded_linux(self):
"""Check whether the current board is any embedded Linux device."""
return self.any_raspberry_pi or self.any_beaglebone or \
self.any_orange_pi or self.any_giant_board or self.any_jetson_board |
python | def preloop(self):
''' Keep persistent command history. '''
if not self.already_prelooped:
self.already_prelooped = True
open('.psiturk_history', 'a').close() # create file if it doesn't exist
readline.read_history_file('.psiturk_history')
for i in range(... |
java | public static HttpResponseStatus parseLine(AsciiString line) {
try {
int space = line.forEachByte(FIND_ASCII_SPACE);
return space == -1 ? valueOf(line.parseInt()) : valueOf(line.parseInt(0, space), line.toString(space + 1));
} catch (Exception e) {
throw new IllegalAr... |
java | @Override protected void render() {
TvShowViewModel tvShow = getContent();
Picasso.with(context)
.load(tvShow.getPoster())
.placeholder(R.drawable.tv_show_placeholder)
.into(thumbnailImageView);
titleTextView.setText(tvShow.getTitle().toUpperCase());
seasonsCounterTextView.setT... |
python | def normalize_dictionary(data_dict):
"""
Converts all the keys in "data_dict" to strings. The keys must be
convertible using str().
"""
for key, value in data_dict.items():
if not isinstance(key, str):
del data_dict[key]
data_dict[str(key)] = value
return data_dic... |
java | private static void reorderLine(Bidi bidi, byte minLevel, byte maxLevel) {
/* nothing to do? */
if (maxLevel<=(minLevel|1)) {
return;
}
BidiRun[] runs;
BidiRun tempRun;
byte[] levels;
int firstRun, endRun, limitRun, runCount;
/*
* R... |
java | @Override
public void eUnset(int featureID)
{
switch (featureID)
{
case TypesPackage.JVM_OPERATION__STATIC:
setStatic(STATIC_EDEFAULT);
return;
case TypesPackage.JVM_OPERATION__FINAL:
setFinal(FINAL_EDEFAULT);
return;
case TypesPackage.JVM_OPERATION__ABSTRACT:
setAbstract(ABSTRACT_EDE... |
python | def rm_watch(self, wd, rec=False, quiet=True):
"""
Removes watch(s).
@param wd: Watch Descriptor of the file or directory to unwatch.
Also accepts a list of WDs.
@type wd: int or list of int.
@param rec: Recursively removes watches on every already watched
... |
java | public static void main(final String[] args) throws ServletException, IOException, JspException {
final Map<String, String> config = toMap(args);
System.setProperty("lucee.cli.call", "true");
final boolean useRMI = "true".equalsIgnoreCase(config.get("rmi"));
File root;
final String param = config.get("webroot"... |
python | def execute(self, i, o):
"""
Executes the command.
:type i: cleo.inputs.input.Input
:type o: cleo.outputs.output.Output
"""
super(InstallCommand, self).execute(i, o)
database = i.get_option('database')
repository = DatabaseMigrationRepository(self._resol... |
java | public static boolean hasNamedAnnotation(AnnotatedConstruct ac, Pattern pattern) {
for (AnnotationMirror annotation : ac.getAnnotationMirrors()) {
if (pattern.matcher(getName(annotation.getAnnotationType().asElement())).matches()) {
return true;
}
}
return false;
} |
python | def perform_smooth(x_values, y_values, span=None, smoother_cls=None):
"""
Convenience function to run the basic smoother.
Parameters
----------
x_values : iterable
List of x value observations
y_ values : iterable
list of y value observations
span : float, optional
F... |
java | @Override
public void validate(final List<Diagnostic> diags) {
// Validate each row.
List beanList = this.getBeanList();
WComponent row = getRepeatedComponent();
for (int i = 0; i < beanList.size(); i++) {
Object rowData = beanList.get(i);
UIContext rowContext = getRowContext(rowData, i);
UIContextH... |
python | def point_window_unitxy(x, y, affine):
""" Given an x, y and a geotransform
Returns
- rasterio window representing 2x2 window whose center points encompass point
- the cartesian x, y coordinates of the point on the unit square
defined by the array center points.
((row1, row2), (co... |
java | @Override
public ListOfferingPromotionsResult listOfferingPromotions(ListOfferingPromotionsRequest request) {
request = beforeClientExecution(request);
return executeListOfferingPromotions(request);
} |
python | def after_request(self, func: Callable) -> Callable:
"""Add an after request function to the Blueprint.
This is designed to be used as a decorator, and has the same arguments
as :meth:`~quart.Quart.after_request`. It applies only to requests that
are routed to an endpoint in this bluepr... |
java | @NonNull
public SourceParams setMetaData(@NonNull Map<String, String> metaData) {
mMetaData = metaData;
return this;
} |
java | final void setBodyType(JmsBodyType value) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "setBodyType", value);
setSubtype(value.toByte());
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "set... |
python | def unsubscribe_list(self, list_id):
"""
Unsubscribe to a list
:param list_id: list ID number
:return: :class:`~responsebot.models.List` object
"""
return List(tweepy_list_to_json(self._client.unsubscribe_list(list_id=list_id))) |
python | def edit(env, securitygroup_id, rule_id, remote_ip, remote_group,
direction, ethertype, port_max, port_min, protocol):
"""Edit a security group rule in a security group."""
mgr = SoftLayer.NetworkManager(env.client)
data = {}
if remote_ip:
data['remote_ip'] = remote_ip
if remote_gr... |
python | def copy_group(from_file, to_file, key):
"""Recursively copy all groups/datasets/attributes from from_file[key] to
to_file. Datasets are not overwritten, attributes are.
"""
if not key in to_file:
from_file.copy(key, to_file, key)
else:
# also make sure any additional attributes are ... |
java | public Subject replaceCallerSubject(Subject callerSubject) {
SubjectThreadContext subjectThreadContext = getSubjectThreadContext();
Subject replacedCallerSubject = subjectThreadContext.getCallerSubject();
subjectThreadContext.setCallerSubject(callerSubject);
return replacedCallerSubject;... |
python | def _dismantle_callsign(self, callsign, timestamp=timestamp_now):
""" try to identify the callsign's identity by analyzing it in the following order:
Args:
callsign (str): Amateur Radio callsign
timestamp (datetime, optional): datetime in UTC (tzinfo=pytz.UTC)
Raises:
... |
java | protected void doPaint(Graphics2D g, JComponent c, int width, int height, Object[] extendedCacheKeys) {
int x = focusInsets.left;
int y = focusInsets.top;
width -= focusInsets.left + focusInsets.right;
height -= focusInsets.top + focusInsets.bottom;
switch (state) {
c... |
java | private Map<String, String> getAttributeTokens(LDAPConnection ldapConnection,
String username) throws GuacamoleException {
// Get attributes from configuration information
List<String> attrList = confService.getAttributes();
// If there are no attributes there is no reason to searc... |
python | def delete_service(self, stack, service):
"""删除服务
删除指定名称服务,并自动销毁服务已部署的所有容器和存储卷。
Args:
- stack: 服务所属的服务组名称
- service: 服务名
Returns:
返回一个tuple对象,其格式为(<result>, <ResponseInfo>)
- result 成功返回空dict{},失败返回{"error": "<errMsg string>... |
python | def serialize_number(x, fmt=SER_BINARY, outlen=None):
""" Serializes `x' to a string of length `outlen' in format `fmt' """
ret = b''
if fmt == SER_BINARY:
while x:
x, r = divmod(x, 256)
ret = six.int2byte(int(r)) + ret
if outlen is not None:
assert len(re... |
java | public TapStream tapCustom(final String id, final RequestMessage message)
throws ConfigurationException, IOException {
final TapConnectionProvider conn = new TapConnectionProvider(addrs);
final TapStream ts = new TapStream();
conn.broadcastOp(new BroadcastOpFactory() {
public Operation newOp(final... |
python | def kick(self, channel, nick, reason=''):
"""
Kick someone from a channel.
Required arguments:
* channel - Channel to kick them from.
* nick - Nick to kick.
Optional arguments:
* reason - Reason for the kick.
"""
with self.lock:
self.is... |
python | def send(self, data, room=None, skip_sid=None, namespace=None,
callback=None):
"""Send a message to one or more connected clients.
The only difference with the :func:`socketio.Server.send` method is
that when the ``namespace`` argument is not given the namespace
associated ... |
python | def _learner_interpret(learn:Learner, ds_type:DatasetType=DatasetType.Valid):
"Create a `ClassificationInterpretation` object from `learner` on `ds_type` with `tta`."
return ClassificationInterpretation.from_learner(learn, ds_type=ds_type) |
java | public BufferedImage getImageResource (String rset, String path)
throws IOException
{
// grab the resource bundles in the specified resource set
ResourceBundle[] bundles = getResourceSet(rset);
if (bundles == null) {
throw new FileNotFoundException(
"Unabl... |
java | public void fatal( Object messagePattern, Object arg )
{
if( m_delegate.isFatalEnabled() )
{
String msgStr = (String) messagePattern;
msgStr = MessageFormatter.format( msgStr, arg );
m_delegate.fatal( msgStr, null );
}
} |
java | @Override
public void run() {
long now = System.currentTimeMillis();
final long stamp = lock.readLock();
try {
for (MemoryPartition partition : partitions.values()) {
partition.removeOldEntries(now);
}
} finally {
lock.unlockRead(stamp);
}
} |
java | public static Annotation getAnnotation(Properties attributes) {
float llx = 0, lly = 0, urx = 0, ury = 0;
String value;
value = attributes.getProperty(ElementTags.LLX);
if (value != null) {
llx = Float.parseFloat(value + "f");
}
value = attributes.getProperty(ElementTags.LLY);
if (value != null) {
... |
python | def select_host(self, metric):
"""
Returns the carbon host that has data for the given metric.
"""
key = self.keyfunc(metric)
nodes = []
servers = set()
for node in self.hash_ring.get_nodes(key):
server, instance = node
if server in servers... |
python | def find_program_variables(code):
"""
Return a dict describing program variables::
{'var_name': ('uniform|attribute|varying', type), ...}
"""
vars = {}
lines = code.split('\n')
for line in lines:
m = re.match(r"\s*" + re_prog_var_declaration + r"\s*(=|;)", line)
if m is... |
python | def log_variable(variable, gradient=None):
r'''
We introduce a function for logging a tensor variable's current state.
It logs scalar values for the mean, standard deviation, minimum and maximum.
Furthermore it logs a histogram of its state and (if given) of an optimization gradient.
'''
name = ... |
python | def decode_array(values):
"""
Decode the values which are bytestrings.
"""
out = []
for val in values:
try:
out.append(val.decode('utf8'))
except AttributeError:
out.append(val)
return out |
java | public static PipeDataElement newInstance(String name, Object data) {
if (!data.getClass().isArray()) throw new IllegalArgumentException("data is expected to be an array!");
if (Array.getLength(data) == 0) throw new IllegalArgumentException("data can not be empty!");
Class<?> componentType = da... |
python | def search_items(query,
fields=None,
sorts=None,
params=None,
archive_session=None,
config=None,
config_file=None,
http_adapter_kwargs=None,
request_kwargs=None,
max_r... |
java | public ButtonTemplateBuilder addUrlButton(String title, String url,
WebViewHeightRatioType ratioType) {
Button button = ButtonFactory.createUrlButton(title, url, ratioType);
this.payload.addButton(button);
return this;
} |
java | public SDVariable logSumExp(String name, SDVariable input, int... dimensions) {
validateNumerical("logSumExp reduction", input);
SDVariable ret = f().logSumExp(input, dimensions);
return updateVariableNameAndReference(ret, name);
} |
java | @Nullable
private Status validateInitialMetadata(Metadata headers) {
Integer httpStatus = headers.get(HTTP2_STATUS);
if (httpStatus == null) {
return Status.INTERNAL.withDescription("Missing HTTP status code");
}
String contentType = headers.get(GrpcUtil.CONTENT_TYPE_KEY);
if (!GrpcUtil.isGr... |
python | def conversion_transfer(conversion, version=3):
""" convert between mdf4 and mdf3 channel conversions
Parameters
----------
conversion : block
channel conversion
version : int
target mdf version
Returns
-------
conversion : block
channel conversion for specified... |
python | def populate_ast_nsarg_orthologs(ast, species):
"""Recursively collect NSArg orthologs for BEL AST
This requires bo.collect_nsarg_norms() to be run first so NSArg.canonical is available
Args:
ast: AST at recursive point in belobj
species: dictionary of species ids vs labels for or
"""
... |
java | public boolean insert(String key, int value, boolean overwrite)
{
if ((null == key) || key.length() == 0 || (key.indexOf(UNUSED_CHAR) != -1))
{
return false;
}
if ((value < 0) || ((value & LEAF_BIT) != 0))
{
return false;
}
value = set... |
java | public static boolean isUntouchedEmpty(String name, Map<String, String> data, Options options) {
return isEmptyInput(name, data, options._inputMode())
&& options.skipUntouched().orElse(false)
&& (options.touchedChecker() == null || ! options.touchedChecker().apply(name, data));
... |
python | def _create_state_data(self, context, resp_args, relay_state):
"""
Adds the frontend idp entity id to state
See super class satosa.frontends.saml2.SAMLFrontend#save_state
:type context: satosa.context.Context
:type resp_args: dict[str, str | saml2.samlp.NameIDPolicy]
:ty... |
java | public void saveField(BaseField field)
{
String strFieldName = field.getFieldName(); // Fieldname only
String strData = field.getString();
this.setProperty(strFieldName, strData);
} |
python | def flatten_all_paths(self, group_filter=lambda x: True,
path_filter=lambda x: True,
path_conversions=CONVERSIONS):
"""Forward the tree of this document into the more general
flatten_all_paths function and return the result."""
return flatten_a... |
java | public static long getPreviousIntervalStart(long time, int intervalInMinutes, int offsetInMinutes) {
long interval = MINUTE_IN_MS * intervalInMinutes;
long offset = calculateOffsetInMs(intervalInMinutes, offsetInMinutes);
return (interval * ((time + LOCAL_UTC_OFFSET - offset) / (interval))) + offset - LOCAL_UT... |
java | public static CPDefinitionSpecificationOptionValue fetchByCPSpecificationOptionId_Last(
long CPSpecificationOptionId,
OrderByComparator<CPDefinitionSpecificationOptionValue> orderByComparator) {
return getPersistence()
.fetchByCPSpecificationOptionId_Last(CPSpecificationOptionId,
orderByComparator);
} |
java | Map<String, CmsSSLMode> getWebserverList() {
Map<String, CmsSSLMode> ret = new LinkedHashMap<String, CmsSSLMode>();
for (I_CmsEditableGroupRow row : m_workplaceServerGroup.getRows()) {
CmsWorkplaceServerWidget widget = (CmsWorkplaceServerWidget)row.getComponent();
ret.put(widget... |
python | def _move_consonant(self, letters: list, positions: List[int]) -> List[str]:
"""
Given a list of consonant positions, move the consonants according to certain
consonant syllable behavioral rules for gathering and grouping.
:param letters:
:param positions:
:return:
... |
java | private static boolean isPrimitive(Class<? extends Object> c) {
return (null == c) || (Class.class == c) || (String.class == c) || c.isPrimitive() || (Integer.class == c) || (Long.class == c)
|| (Short.class == c) || (Byte.class == c) || (Character.class == c) || (Float.class == c) || (Double.class == c)
|| (... |
java | private ImmutableMultimap<Integer, TermType> collectProposedCastTypes(
Collection<CQIE> samePredicateRules, ImmutableMap<CQIE, ImmutableList<Optional<TermType>>> termTypeMap,
Map<Predicate, ImmutableList<TermType>> alreadyKnownCastTypes) {
ImmutableMultimap.Builder<Integer, TermType> in... |
java | public synchronized void stop() {
if (!running) {
return;
}
LOGGER.info("stopping raft agent");
raftAlgorithm.stop();
raftNetworkClient.stop();
serverBossPool.shutdown();
clientBossPool.shutdown();
workerPool.shutdown();
sharedWorker... |
java | protected ClassLoader getClassLoader(Set<Artifact> artifacts) throws Exception {
Set<URL> classpathURLs = new LinkedHashSet<URL>();
addCustomClasspaths(classpathURLs, true);
// add ourselves to top of classpath
URL mainClasses = new File(project.getBuild().getOutputDirectory()).toURI()... |
python | def get_scripts():
"""Get custom npm scripts."""
proc = Popen(['npm', 'run-script'], stdout=PIPE)
should_yeild = False
for line in proc.stdout.readlines():
line = line.decode()
if 'available via `npm run-script`:' in line:
should_yeild = True
continue
if ... |
python | def usearch61_denovo_cluster(seq_path,
percent_id=0.97,
rev=False,
save_intermediate_files=True,
minlen=64,
output_dir='.',
remove_usearch_logs=Fa... |
java | void updateRack(UpdateRackHeartbeat updateRack)
{
ClusterHeartbeat cluster = findCluster(updateRack.getClusterId());
if (cluster == null) {
return;
}
RackHeartbeat rack;
if (cluster != _serverSelf.getCluster()) {
rack = cluster.createRack("external");
ClusterTarget tar... |
python | def advance(self, myDateTime):
"""
Advances to the next value and returns an appropriate value for the given
time.
:param myDateTime: (datetime) when to fetch the value for
:return: (float|int) value for given time
"""
if self.getTime() == myDateTime:
out = self.next()
# Someti... |
java | public UriBuilder setPath(final String str) {
final String[] parts;
if (str.startsWith("/")) {
parts = new String[]{str};
} else {
final String base = getPath().toString();
parts = new String[]{base, base.endsWith("/") ? "" : "/", str};
}
retu... |
python | def update_item(TableName=None, Key=None, AttributeUpdates=None, Expected=None, ConditionalOperator=None, ReturnValues=None, ReturnConsumedCapacity=None, ReturnItemCollectionMetrics=None, UpdateExpression=None, ConditionExpression=None, ExpressionAttributeNames=None, ExpressionAttributeValues=None):
"""
Edits a... |
python | def get_placeholder_data_view(self, request, object_id):
"""
Return the placeholder data as dictionary.
This is used in the client for the "copy" functionality.
"""
language = 'en' #request.POST['language']
with translation.override(language): # Use generic solution her... |
python | def calc_pvalue(self, study_count, study_n, pop_count, pop_n):
"""pvalues are calculated in derived classes."""
fnc_call = "calc_pvalue({SCNT}, {STOT}, {PCNT} {PTOT})".format(
SCNT=study_count, STOT=study_n, PCNT=pop_count, PTOT=pop_n)
raise Exception("NOT IMPLEMENTED: {FNC_CALL} usi... |
java | private void updateUnknownStatus(Map<String, Map<String, String>> statusMap,
List<String> unreportedNn) {
if (unreportedNn == null || unreportedNn.isEmpty()) {
// no unreported namenodes
return;
}
for (Map.Entry<String, Map<String,String>> entry : statusMap.entrySet()) {
String ... |
java | public void setActualExpiryTime(com.google.api.ads.admanager.axis.v201902.DateTime actualExpiryTime) {
this.actualExpiryTime = actualExpiryTime;
} |
java | private int prepareConnectionForBatch(Connection conn) throws SQLException {
conn.setAutoCommit(false);
int initialIsolation = Connection.TRANSACTION_REPEATABLE_READ;
if (_isDB2)
{
try
{
initialIsolation = conn.getTransactionIsolation();
... |
java | private <X> X executeLockingMethod(Supplier<X> method) {
try {
return method.get();
} catch (JanusGraphException e) {
if (e.isCausedBy(TemporaryLockingException.class) || e.isCausedBy(PermanentLockingException.class)) {
throw TemporaryWriteException.temporaryLock(... |
java | public JSONObject accumulate( String key, double value ) {
return _accumulate( key, Double.valueOf( value ), new JsonConfig() );
} |
python | def doppler_width(transition, Temperature):
r"""Return the Doppler width of a transition at a given temperature
(in angular frequency).
The usual Doppler FWHM of the rubidium D2 line (in MHz).
>>> g = State("Rb", 87, 5, 0, 1/Integer(2), 2)
>>> e = State("Rb", 87, 5, 1, 3/Integer(2))
>>> t = Tr... |
java | public float getWidthCorrected(float charSpacing, float wordSpacing)
{
if (image != null) {
return image.getScaledWidth() + charSpacing;
}
int numberOfSpaces = 0;
int idx = -1;
while ((idx = value.indexOf(' ', idx + 1)) >= 0)
++numberOfSpaces;
... |
java | static int getAnimationResource(int gravity, boolean isInAnimation) {
if ((gravity & Gravity.TOP) == Gravity.TOP) {
return isInAnimation ? R.anim.slide_in_top : R.anim.slide_out_top;
}
if ((gravity & Gravity.BOTTOM) == Gravity.BOTTOM) {
return isInAnimation ? R.anim.slide_in_bottom : R.anim.slid... |
python | def update_alarm(deployment_id, metric_name, data, api_key=None, profile="telemetry"):
'''
update an telemetry alarms. data is a dict of alert configuration data.
Returns (bool success, str message) tuple.
CLI Example:
salt myminion telemetry.update_alarm rs-ds033197 {} profile=telemetry
... |
python | def delete_events(environment, start_response, headers):
"""
Delete events
POST body should contain a JSON encoded version of:
{ namespace: namespace_name (optional),
stream : stream_name,
start_time : starting_time_as_kronos_time,
end_time : ending_time_as_kronos_time,
start_id : only... |
python | def changed(self):
"""Returns dict of fields that changed since save (with old values)"""
if not self.instance.pk:
return {}
saved = self.saved_data.items()
current = self.current()
return dict((k, v) for k, v in saved if v != current[k]) |
java | public static void __gmpz_export(Pointer rop, Pointer countp, int order, int size, int endian,
int nails, mpz_t op) {
if (SIZE_T_CLASS == SizeT4.class) {
SizeT4.__gmpz_export(rop, countp, order, size, endian, nails, op);
} else {
SizeT8.__gmpz_export(rop, countp, order, size, endian, nails, op... |
python | def close(self, force=True):
'''This closes the connection with the child application. Note that
calling close() more than once is valid. This emulates standard Python
behavior with files. Set force to True if you want to make sure that
the child is terminated (SIGKILL is sent if the chi... |
python | def as_dict(self) -> Dict[str, str]:
"""
Export color register as dict.
"""
items: Dict[str, str] = {}
for k, v in self.items():
if type(v) is str:
items.update({k: v})
return items |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.