language stringclasses 2
values | func_code_string stringlengths 63 466k |
|---|---|
java | public static Method[] getAllMethod(Object obj) {
if (obj == null) {
return null;
}
Class<?> clazz = obj.getClass();
try {
return clazz.getDeclaredMethods();
} catch (SecurityException e) {
e.printStackTrace();
}
return null;
... |
java | public static AtomContactSet getRepresentativeAtomsInContact(Chain chain,
double cutoff) {
Grid grid = new Grid(cutoff);
Atom[] atoms = getRepresentativeAtomArray(chain);
grid.addAtoms(atoms);
return grid.getAtomContacts();
} |
python | def add_appt(self, complex: str, house: str, price: str, square: str, **kwargs):
"""
Add a new appartment to the rumetr db
"""
self.check_house(complex, house)
kwargs['price'] = self._format_decimal(price)
kwargs['square'] = self._format_decimal(square)
self.pos... |
java | public synchronized DirectoryScanner addExcludes(String[] excludes) {
if (excludes != null && excludes.length > 0) {
if (this.excludes != null && this.excludes.length > 0) {
String[] tmp = new String[excludes.length
+ this.excludes.length];
... |
python | def fastrcnn_losses(labels, label_logits, fg_boxes, fg_box_logits):
"""
Args:
labels: n,
label_logits: nxC
fg_boxes: nfgx4, encoded
fg_box_logits: nfgxCx4 or nfgx1x4 if class agnostic
Returns:
label_loss, box_loss
"""
label_loss = tf.nn.sparse_softmax_cross_e... |
java | public String nextId() {
String id = "-1";
do {
// when we reach max int, reset to zero
if (nextId.get() == Integer.MAX_VALUE) {
nextId.set(0);
}
id = String.format("%d", nextId.getAndIncrement());
} while (hasClient(id));
... |
python | def _multi_permission_mask(mode):
"""
Support multiple, comma-separated Unix chmod symbolic modes.
>>> _multi_permission_mask('a=r,u+w')(0) == 0o644
True
"""
def compose(f, g):
return lambda *args, **kwargs: g(f(*args, **kwargs))
return functools.reduce(compose, map(_permission_mask... |
python | def run(self):
"""
Run a Quil program on the QVM multiple times and return the values stored in the
classical registers designated by the classical_addresses parameter.
:return: An array of bitstrings of shape ``(trials, len(classical_addresses))``
"""
super().run()
... |
python | def suggest(self, w):
""" Return a list of (word, confidence) spelling corrections for the given word,
based on the probability of known words with edit distance 1-2 from the given word.
"""
if len(self) == 0:
self.load()
if len(w) == 1:
return [(w, 1.... |
java | public MultipartFormDataParser createMultipartFormDataParser() {
MultipartFormDataParser parser = new MemoryMultipartFormDataParser();
if (maxRequestSize > -1L) {
parser.setMaxRequestSize(maxRequestSize);
}
if (maxFileSize > -1L) {
parser.setMaxFileSize(maxFileSiz... |
java | void connect(JsMessagingEngine[] MEList, String targetType, String targetSignificance, String target,
boolean isPreferred) throws ResourceException
{
final String methodName = "connect";
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled())
{
SibTr.... |
java | private static List<String> readAllLines(File f) throws IOException {
BufferedReader r = new BufferedReader(new FileReader(f));
try {
List<String> result = new ArrayList<String>();
String line;
while ((line = r.readLine()) != null) {
result.add(line);
... |
python | def _is_sub_intrinsic(data):
"""
Is this input data a Fn::Sub intrinsic function
Parameters
----------
data
Data to check
Returns
-------
bool
True if the data Fn::Sub intrinsic function
"""
return isinstance(data,... |
python | def p_FuncDef(p):
'''
FuncDef : DEF RefModifier INDENTIFIER LPARENT ParamList RPARENT COLON ReturnTypeModifier Terminator Block
'''
p[0] = FuncDef(p[2], p[3], p[5], p[8], p[9], p[10]) |
java | protected static base_responses delete_bulk_request(nitro_service service,base_resource resources[]) throws Exception
{
if (!service.isLogin())
service.login();
options option = new options();
option.set_action("rm");
String type = resources[0].get_object_type();
if (type.indexOf("_binding") > 0)
{
... |
python | def wheelEvent(self, event):
"""
Emits the mouse_wheel_activated signal.
:param event: QMouseEvent
"""
initial_state = event.isAccepted()
event.ignore()
self.mouse_wheel_activated.emit(event)
if not event.isAccepted():
event.setAccepted(initia... |
python | def msg(self, message, *args, **kwargs):
"""Shortcut to send a message through the connection.
This function sends the input message through the connection. A target
can be defined, else it will send it to the channel or user from the
input Line, effectively responding on whatever trigg... |
python | def redact_secrets(line):
"""
Returns a sanitized string for any ``line`` that looks like it contains a
secret (i.e. matches SECRET_PATTERN).
"""
def redact(match):
if match.group(2) in SECRET_WHITELIST:
return match.group(0)
return match.group(1) + 'TOO_TOO_SEXY'
ret... |
python | def create_insight(self, project_owner, project_id, **kwargs):
"""
Create an insight
Create a new insight.
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please define a `callback` function
to be invoked when receiving the r... |
python | def processmetadata(metadata, items=None, comments=None, delimiter_regex=None,
ncols=None, verbosity=DEFAULT_VERBOSITY):
"""
Process Metadata from stored (or "packed") state to functional state.
Metadata can come be read from a file "packed" in various ways,
e.g. with a string repr... |
java | @Override public void onStatusChange(JobExecutionState state, RunningState previousStatus, RunningState newStatus) {
if (this.filter.apply(state.getJobSpec())) {
this.delegate.onStatusChange(state, previousStatus, newStatus);
}
} |
python | def _get_host(self):
"""
Returns the host address for an instance of Blob Store service from
environment inspection.
"""
if 'VCAP_SERVICES' in os.environ:
services = json.loads(os.getenv('VCAP_SERVICES'))
host = services['predix-blobstore'][0]['credentials... |
python | def absent(name, auth=None):
'''
Ensure domain does not exist
name
Name of the domain
'''
ret = {'name': name,
'changes': {},
'result': True,
'comment': ''}
__salt__['keystoneng.setup_clouds'](auth)
domain = __salt__['keystoneng.domain_get'](name=n... |
java | public NullnessStore uprootAccessPaths(
Map<LocalVariableNode, LocalVariableNode> localVarTranslations) {
NullnessStore.Builder nullnessBuilder = NullnessStore.empty().toBuilder();
for (AccessPath ap : contents.keySet()) {
if (ap.getRoot().isReceiver()) {
continue;
}
Element varE... |
python | def _findRedundantProteins(protToPeps, pepToProts, proteins=None):
"""Returns a set of proteins with redundant peptide evidence.
After removing the redundant proteins from the "protToPeps" and "pepToProts"
mapping, all remaining proteins have at least one unique peptide. The
remaining proteins are a "m... |
java | public static String getRootPathFromNewLink(String newLink) {
String result = null;
if (newLink.startsWith(NEW_LINK_IDENTIFIER) && newLink.contains("|")) {
result = newLink.substring(newLink.indexOf("|") + 1, newLink.lastIndexOf("|"));
}
return result;
} |
java | public static <T1, T2, T3, T4> TypeFactory<Tuple4<T1, T2, T3, T4>> typeFactory( TypeFactory<T1> type1,
TypeFactory<T2> type2,
TypeFactory<T3> type3,
... |
java | public String convertIfcObjectTypeEnumToString(EDataType eDataType, Object instanceValue) {
return instanceValue == null ? null : instanceValue.toString();
} |
python | def read_FITS_cols(infile, cols=None): # noqa: N802
""" Read columns from FITS table """
with fits.open(infile, memmap=False) as ftab:
extnum = 0
extfound = False
for extn in ftab:
if 'tfields' in extn.header:
extfound = True
break
... |
java | public static void main(String[] args) throws InterruptedException, PlatformAlreadyAssignedException {
// ####################################################################
//
// since we are not using the default Raspberry Pi platform, we should
// explicitly assign the platform as t... |
java | private boolean isForkMode(Plugin plugin) throws MojoExecutionException {
String reuseForksValue = extractParamValue(plugin, REUSE_FORKS_PARAM_NAME);
return reuseForksValue != null && reuseForksValue.equals("false");
} |
java | public static Pipe newPipe(byte[] data, int offset, int len)
{
final ByteArrayInput byteArrayInput = new ByteArrayInput(data, offset, len, false);
return new Pipe()
{
protected Input begin(Pipe.Schema<?> pipeSchema) throws IOException
{
return b... |
java | public Map<String, Reflector> fields() {
Map<String, Reflector> result;
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.KITKAT) {
result = new ArrayMap<>();
} else {
result = new HashMap<>();
}
Class<?> type = type();
do {
... |
python | def feature_union_concat(Xs, nsamples, weights):
"""Apply weights and concatenate outputs from a FeatureUnion"""
if any(x is FIT_FAILURE for x in Xs):
return FIT_FAILURE
Xs = [X if w is None else X * w for X, w in zip(Xs, weights) if X is not None]
if not Xs:
return np.zeros((nsamples, 0... |
java | public void setFloat(String fieldName, Float value) {
if (value == null) {
throw new IllegalArgumentException("参数值[" + fieldName + "]不能为NULL.");
}
fieldList.add(fieldName);
statementParameter.setFloat(value);
} |
python | def read_hotkey(suppress=True):
"""
Similar to `read_key()`, but blocks until the user presses and releases a
hotkey (or single key), then returns a string representing the hotkey
pressed.
Example:
read_hotkey()
# "ctrl+shift+p"
"""
queue = _queue.Queue()
fn = lambda e:... |
python | def from_string(cls, s, name=None, modules=None, active=None):
"""
Instantiate a REPP from a string.
Args:
name (str, optional): the name of the REPP module
modules (dict, optional): a mapping from identifiers to
REPP modules
active (iterable,... |
java | @SuppressWarnings("resource")
public static void main(String[] args) {
try {
System.out.println("Select (k=generate key; c=crypt; d=decrypt):");
System.out.println();
Scanner scan = new Scanner(System.in, "UTF-8");
if (!scan.hasNextLine()) {
return;
}
switch (scan.nextLine()) {
case "k":
... |
java | public static long getTimestamp(Configuration conf, URI cache)
throws IOException {
FileSystem fileSystem = FileSystem.get(cache, conf);
Path filePath = new Path(cache.getPath());
return fileSystem.getFileStatus(filePath).getModificationTime();
} |
python | def checkout(lancet, force, issue):
"""
Checkout the branch for the given issue.
It is an error if the branch does no exist yet.
"""
issue = get_issue(lancet, issue)
# Get the working branch
branch = get_branch(lancet, issue, create=force)
with taskstatus("Checking out working branch"... |
java | @Override
public DoubleMatrix1D[] getMatrixScalingFactors(DoubleMatrix2D A) {
int m = A.rows();
int n = A.columns();
final double log10_b = Math.log10(base);
//Setup for Gauss-Seidel Iterations
final int[] R = new int[m];
final int[] C = new int[n];
final double[] t = new double[1];
final do... |
python | def _temp_dew_dirint(temp_dew, times):
"""
Calculate precipitable water from surface dew point temp (Perez eqn 4),
or return a default value for use with :py:func:`_dirint_bins`.
"""
if temp_dew is not None:
# Perez eqn 4
w = pd.Series(np.exp(0.07 * temp_dew - 0.075), index=times)
... |
python | def get_user(self, idvalue, options=None):
"""
get user by a given id
http://getstarted.sailthru.com/api/user
"""
options = options or {}
data = options.copy()
data['id'] = idvalue
return self.api_get('user', data) |
java | public ReadWritePair openReadWrite(boolean isAutoFlush) throws IOException
{
clearStatusCache();
StreamImpl impl = openReadWriteImpl();
//impl.setPath(this);
WriteStreamOld writeStream = new WriteStreamOld(impl);
ReadStreamOld readStream;
if (isAutoFlush)
readStream = new ReadStreamOl... |
java | public void marshall(StopContactRequest stopContactRequest, ProtocolMarshaller protocolMarshaller) {
if (stopContactRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(stopContactRequest.getCon... |
python | def _read_stc(stc_file):
"""Read Segment Table of Contents file.
Returns
-------
hdr : dict
- next_segment : Sample frequency in Hertz
- final : Number of channels stored
- padding : Padding
stamps : ndarray of dtype
- segment_name : Name of ERD / ETC file segment
... |
python | def _eager_tasklet(tasklet):
"""Decorator to turn tasklet to run eagerly."""
@utils.wrapping(tasklet)
def eager_wrapper(*args, **kwds):
fut = tasklet(*args, **kwds)
_run_until_rpc()
return fut
return eager_wrapper |
python | def request(self, app_id=None, body=None, stamp=None, url=None, sig=None):
"""Validate application ID and request is from Alexa."""
if self.app_id:
if not self.application_id(app_id):
return False
if (url or sig):
if not (body and stamp and url and sig):
... |
java | private void writeFields(String objectName, FieldContainer container, FieldType[] fields) throws IOException
{
m_writer.writeStartObject(objectName);
for (FieldType field : fields)
{
Object value = container.getCurrentValue(field);
if (value != null)
{
writeFi... |
python | def _score_chain(self, lexical_chain, adj_submat, concept_weights):
"""
Computes the score for a lexical chain.
"""
scores = []
# Compute scores for concepts in the chain
for i, c in enumerate(lexical_chain):
score = concept_weights[c] * self.relation_weights... |
java | public static Object callConstructor(Class clazz, Object[] args) throws PageException {
args = cleanArgs(args);
try {
return getConstructorInstance(clazz, args).invoke();
}
catch (InvocationTargetException e) {
Throwable target = e.getTargetException();
if (target instanceof PageException) throw (Pag... |
python | def get_compression_extension(self):
"""
Find the filename extension for the 'docker save' output, which
may or may not be compressed.
Raises OsbsValidationException if the extension cannot be
determined due to a configuration error.
:returns: str including leading dot,... |
python | def CreateSubsetFile(in_drainage_line,
river_id,
out_riv_bas_id_file,
file_geodatabase=None):
"""
Creates River Basin ID subset input CSV file for RAPID
based on the Drainage Line shapefile with river ID and
next downstream ID fields
Pa... |
java | public void changeRenderState(int renderState) {
switch(_renderState) {
case RENDER_STATE_UNINIT:
_renderState = RENDER_STATE_START;
break;
case RENDER_STATE_START:
_renderState = RENDER_STATE_CAPTION;
break;
cas... |
python | def resize(self, size):
"""Return a new Image instance with the given size."""
return Image(self.pil_image.resize(size, PIL.Image.ANTIALIAS)) |
java | public static Phrase from(Context c, @StringRes int patternResourceId) {
return from(c.getResources(), patternResourceId);
} |
java | @Override
public Boolean exists(final byte[] key) {
checkIsInMultiOrPipeline();
client.exists(key);
return client.getIntegerReply() == 1;
} |
python | def update_data(self, forzar_update=False):
"""Check/Lectura de base de datos hdf en disco (local)."""
try:
if forzar_update:
self.printif('Se procede a actualizar TODOS los datos (force update ON)', 'info')
assert()
self.load_data()
tm... |
python | def _check_subresource(self, subresource: str):
"""Check if specific_resources parameter is valid.
:param str resource: subresource to check.
"""
warnings.warn(
"subresource in URL is deprecated." " Use _include mecanism instead.",
DeprecationWarning,
)
... |
python | def list_hardware(self, tags=None, cpus=None, memory=None, hostname=None,
domain=None, datacenter=None, nic_speed=None,
public_ip=None, private_ip=None, **kwargs):
"""List all hardware (servers and bare metal computing instances).
:param list tags: filter bas... |
python | def display_matrix(self, matrix, interval=2.0, brightness=1.0, fading=False, ignore_duplicates=False):
"""
Displays an LED matrix on Nuimo's LED matrix display.
:param matrix: the matrix to display
:param interval: interval in seconds until the matrix disappears again
:param bri... |
java | private static boolean polylineContainsMultiPoint_(Polyline polyline_a,
MultiPoint multipoint_b, double tolerance,
ProgressTracker progress_tracker) {
Envelope2D env_a = new Envelope2D(), env_b = new Envelope2D();
polyline_a.queryEnvelope2D(env_a);
multipoint_b.queryEnvelope2D(env_b);
if (!envelopeInfCon... |
java | public final EObject entryRuleTerminalRule() throws RecognitionException {
EObject current = null;
EObject iv_ruleTerminalRule = null;
try {
// InternalXtext.g:2846:53: (iv_ruleTerminalRule= ruleTerminalRule EOF )
// InternalXtext.g:2847:2: iv_ruleTerminalRule= ruleTer... |
python | def _checkparams(digest_size, key, salt, person):
"""Check hash paramters"""
ensure(isinstance(key, bytes),
'Key must be a bytes sequence',
raising=exc.TypeError)
ensure(isinstance(salt, bytes),
'Salt must be a bytes sequence',
raising=exc.TypeError)
ensure(... |
java | @Nullable
public static String getRequestQueryString (@Nullable final HttpServletRequest aRequest)
{
String ret = null;
if (aRequest != null)
try
{
if (aRequest.isAsyncSupported () && aRequest.isAsyncStarted ())
ret = (String) aRequest.getAttribute (AsyncContext.ASYNC_QUERY_STR... |
java | public final Object getValue(Bindings bindings, ELContext context, Class<?> type) {
Object value = eval(bindings, context);
if (type != null) {
value = bindings.convert(value, type);
}
return value;
} |
python | def enrich_backend(url, clean, backend_name, backend_params, cfg_section_name,
ocean_index=None,
ocean_index_enrich=None,
db_projects_map=None, json_projects_map=None,
db_sortinghat=None,
no_incremental=False, only_identities... |
python | def get_privkey(self, address: AddressHex, password: str) -> PrivateKey:
"""Find the keystore file for an account, unlock it and get the private key
Args:
address: The Ethereum address for which to find the keyfile in the system
password: Mostly for testing purposes. A password ... |
java | public static String extractToString(final DeviceAttribute deviceAttributeRead)
throws DevFailed {
final Object value = AttributeHelper.extract(deviceAttributeRead);
String argout = null;
if (value instanceof Short) {
argout = ((Short) value).toString();
} else if (value instanceof String) {
argout =... |
python | def spkobj(spk, outCell=None):
"""
Find the set of ID codes of all objects in a specified SPK file.
http://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/spkobj_c.html
:param spk: Name of SPK file.
:type spk: str
:param outCell: Optional Spice Int Cell.
:type outCell: spiceypy.utils.supp... |
python | def __add_parameter(self, param, path_parameters, params):
"""Adds all parameters in a field to a method parameters descriptor.
Simple fields will only have one parameter, but a message field 'x' that
corresponds to a message class with fields 'y' and 'z' will result in
parameters 'x.y' and 'x.z', for ... |
python | def profile(fn=None, condition=None, profile_class=cProfile.Profile, print_freq=0, sort_keys=None, print_restrictions=None):
'''Decorating a function that is profiled with a Python profiler
such as :class:`cProfile.Profile`.
**Note**: ``function`` doesn't refer to :obj:`~nnabla.function.Function`.
A Py... |
java | protected void enforceMemoryLimit() {
double memoryLimit = this.maxByteSizeOption.getValue() / (double) (this.ensemble.length + 1);
for (int i = 0; i < this.ensemble.length; i++) {
((HoeffdingTree) this.ensemble[(int) this.weights[i][1]].classifier).maxByteSizeOption.setValue((int) Math
.round(memoryL... |
python | def Lockhart_Martinelli_Xtt(x, rhol, rhog, mul, mug, pow_x=0.9, pow_rho=0.5,
pow_mu=0.1, n=None):
r'''Calculates the Lockhart-Martinelli Xtt two-phase flow parameter in a
general way according to [2]_. [1]_ is said to describe this. However,
very different definitions of this par... |
python | def add(self, name, command_path=None, **params):
"""
Add a command to the list of commands being watched. "name"
should be a unique value that can be used as a dictionary
index. It is typically, but not necessarily, the command
name. The value is returned when the command or ... |
java | @Override
public IPortletEntity getPortletEntity(IPortletEntityId portletEntityId) {
final IPortletEntity portletEntity =
this.delegatePortletEntityDao.getPortletEntity(portletEntityId);
return this.wrapEntity(portletEntity);
} |
java | @Override
public void applyConfig(final ConfigSettings config)
{
Object o = config
.getConfigParameter(ConfigurationKeys.LOGGING_PATH_DIFFTOOL);
if (o != null) {
this.diffToolField.setText((String) o);
}
else {
this.diffToolField.setText("");
}
o = config
.getConfigParameter(ConfigurationK... |
python | def accepts_moderator_roles(func):
"""
Decorator that accepts only moderator roles
:param func:
:return:
"""
if inspect.isclass(func):
apply_function_to_members(func, accepts_moderator_roles)
return func
else:
@functools.wraps(func)
def decorator(*args, **kwar... |
python | def _merge_points(self, function_address):
"""
Return the ordered merge points for a specific function.
:param int function_address: Address of the querying function.
:return: A list of sorted merge points (addresses).
:rtype: list
"""
# we are entering a new fu... |
java | protected int indexOf(String text, String... values) {
int answer = -1;
for (String value : values) {
int idx = text.indexOf(value);
if (idx >= 0) {
if (answer < 0 || idx < answer) {
answer = idx;
}
}
}
... |
java | public StatusCode postEpisodeRating(int tvID, int seasonNumber, int episodeNumber, int rating, String sessionID, String guestSessionID) throws MovieDbException {
if (rating < 0 || rating > RATING_MAX) {
throw new MovieDbException(ApiExceptionType.UNKNOWN_CAUSE, "Rating out of range");
}
... |
java | private void putInCache(MembershipType mt)
{
cache.put(mt.getName(), mt, CacheType.MEMBERSHIPTYPE);
} |
python | def ListAttrs(cls):
"""A compatibility wrapper for listing class attributes.
This method solves similar Python 2 compatibility issues for `dir` function as
`GetName` does for `__name__` invocations. See documentation for `GetName` for
more details.
Once support for Python 2 is dropped all invocations of thi... |
java | public static WriteOptions writeOptions(Boolean overwrite, Boolean forceSync){
WriteOptions wo = new WriteOptions();
if (overwrite != null)
wo.setOverwrite(overwrite);
if (forceSync != null)
wo.setForcesync(forceSync);
return wo;
} |
java | public EClass getExtendedResourceLocalIdentifier() {
if (extendedResourceLocalIdentifierEClass == null) {
extendedResourceLocalIdentifierEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(AfplibPackage.eNS_URI).getEClassifiers().get(520);
}
return extendedResourceLocalIdentifierEClass;
} |
python | def create(self, name, index=None):
"""
Creates a new sheet with the given name.
If an optional index argument is not provided then the created
sheet is appended at the end. Returns the new sheet.
"""
if index is None:
index = len(self)
self._create(n... |
java | public static final void setValue(Object obj, String fieldName,
Object value) {
try {
getField(obj.getClass(), fieldName).set(obj, value);
} catch (IllegalArgumentException e) {
throw new RuntimeException(e);
} catch (IllegalAccessException e) {
t... |
java | private List scrollAndPopulate(Object key, EntityMetadata entityMetadata, MetamodelImpl metaModel,
Table schemaTable, Iterator<Row> rowsIter, Map<String, Object> relationMap, List<String> columnsToSelect)
throws InstantiationException, IllegalAccessException
{
List results = ... |
python | def add_name(self, name, lang=None):
"""
Adds a new name variant to an author.
:param name: the name to be added
:param lang: the language of the name variant
:return: `True` if the name is added, `False` otherwise (the name is a duplicate)
"""
try:
a... |
python | def _construct_params(params, required_keys, opt_keys=None):
"""
Construct params list in order of given keys.
"""
try:
params_list = [params.pop(key) for key in required_keys]
except KeyError as e:
raise MissingParameter(
'Missing expected... |
python | def add_edges_from(self, ebunch, **kwargs):
"""
Add all the edges in ebunch.
If nodes referred in the ebunch are not already present, they
will be automatically added. Node names can be any hashable python object.
Parameters
----------
ebunch : list, array-like
... |
java | private void performPermissionCheck(CmsObject cms) throws CmsPermissionViolationException {
if (cms.getRequestContext().getCurrentUser().isGuestUser()) {
throw new CmsPermissionViolationException(null);
}
} |
java | public static byte[] toByteArray(final int i)
{
final byte[] b = new byte[4];
b[0] = (byte) ((i & 0xff000000) >>> 24);
b[1] = (byte) ((i & 0x00ff0000) >>> 16);
b[2] = (byte) ((i & 0x0000ff00) >>> 8);
b[3] = (byte) ((i & 0x000000ff));
return b;
} |
java | public DescribeAffectedEntitiesResult withEntities(AffectedEntity... entities) {
if (this.entities == null) {
setEntities(new java.util.ArrayList<AffectedEntity>(entities.length));
}
for (AffectedEntity ele : entities) {
this.entities.add(ele);
}
return th... |
python | def get_all_conversion_chains(self, from_type: Type[Any] = JOKER, to_type: Type[Any] = JOKER) \
-> Tuple[List[Converter], List[Converter], List[Converter]]:
"""
Utility method to find matching converters or conversion chains.
:param from_type: a required type of input object, or JOK... |
java | public void destroyCleanupTerminatedInstanceTimer() {
cleanupTerminatedInstancesScheduledFuture.cancel(true);
cleanupTerminatedInstancesScheduledFuture = null;
cleanupTerminatedInstancesTimer.shutdown();
cleanupTerminatedInstancesTimer = null;
} |
python | def from_size(value):
'''
Convert zfs size (human readble) to python int (bytes)
'''
match_size = re_zfs_size.match(str(value))
if match_size:
v_unit = match_size.group(2).upper()[0]
v_size = float(match_size.group(1))
v_multiplier = math.pow(1024, zfs_size.index(v_unit) + 1)... |
python | def toggle_all(self, checked):
"""Toggle all files mode"""
self.parent_widget.sig_option_changed.emit('show_all', checked)
self.show_all = checked
self.set_show_all(checked) |
python | def list_key_pairs(profile, **libcloud_kwargs):
'''
List all the available key pair objects.
:param profile: The profile key
:type profile: ``str``
:param libcloud_kwargs: Extra arguments for the driver's list_key_pairs method
:type libcloud_kwargs: ``dict``
CLI Example:
.. code-bl... |
java | public static float angularDistance (float a1, float a2) {
float ma1 = mirrorAngle(a1), ma2 = mirrorAngle(a2);
return Math.min(Math.abs(a1 - a2), Math.abs(ma1 - ma2));
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.