language stringclasses 2
values | func_code_string stringlengths 63 466k |
|---|---|
python | def get_dir(self, objtxt):
"""Return dir(object)"""
obj, valid = self._eval(objtxt)
if valid:
return getobjdir(obj) |
java | @Nonnull
public static LCharIntConsumer charIntConsumerFrom(Consumer<LCharIntConsumerBuilder> buildingFunction) {
LCharIntConsumerBuilder builder = new LCharIntConsumerBuilder();
buildingFunction.accept(builder);
return builder.build();
} |
python | def LoadFromXml(self, node):
""" Method updates the object from the xml. """
import os
self.classId = node.localName
metaClassId = UcsUtils.FindClassIdInMoMetaIgnoreCase(self.classId)
if metaClassId:
self.classId = metaClassId
if node.hasAttribute(NamingPropertyId.DN):
self.dn = node.getAttribute(N... |
java | public void run(String name, Config config, Builder builder) {
BuilderImpl bldr = (BuilderImpl) builder;
TopologyBuilder topologyBuilder = bldr.build();
try {
HeronSubmitter.submitTopology(name, config.getHeronConfig(),
topologyBuilder.createTopology());
} catch... |
java | public boolean closeGeoPackage(String name) {
T geoPackage = removeGeoPackage(name);
if (geoPackage != null) {
geoPackage.close();
}
return geoPackage != null;
} |
java | protected static <T> T parse(String in, JsonReaderI<T> mapper) {
try {
JSONParser p = new JSONParser(DEFAULT_PERMISSIVE_MODE);
return p.parse(in, mapper);
} catch (Exception e) {
return null;
}
} |
java | public static VideoHelper newInstance(final SecurityContext securityContext, final VideoFile inputVideo) {
return newInstance(securityContext, inputVideo, null);
} |
java | @CheckForSigned
protected static int findWrapPos (final String sText, final int nWidth, final int nStartPos)
{
// the line ends before the max wrap pos or a new line char found
int pos = sText.indexOf ('\n', nStartPos);
if (pos != -1 && pos <= nWidth)
{
return pos + 1;
}
pos = sText.i... |
java | public QualifiedName getCurrentElementQualifiedName()
{
XmlPullParser parser = mParser;
return QualifiedName.get(parser.getNamespace(), parser.getName());
} |
java | public ViewQuery reduce(final boolean reduce) {
params[PARAM_REDUCE_OFFSET] = "reduce";
params[PARAM_REDUCE_OFFSET+1] = Boolean.toString(reduce);
return this;
} |
java | public Object fromNeo4JObject(Object source, Field field)
{
Class<?> targetClass = field.getType();
if (targetClass.isAssignableFrom(BigDecimal.class) || targetClass.isAssignableFrom(BigInteger.class))
{
return PropertyAccessorHelper.fromSourceToTargetClass(field.getType(), sour... |
python | def find_exe(name, filepath=None):
"""Find an executable.
Args:
name: Name of the program, eg 'python'.
filepath: Path to executable, a search is performed if None.
Returns:
Path to the executable if found, otherwise an error is raised.
"""
if filepath:
if not os.pa... |
python | def register_resource(self, viewset, namespace=None):
"""
Register a viewset that should be considered the canonical
endpoint for a particular resource. In addition to generating
and registering the route, it adds the route in a reverse map
to allow DREST to build the canonical U... |
java | @Override
public RoundedMoney divideToIntegralValue(Number divisor) {
MathContext mc = monetaryContext.get(MathContext.class);
if(mc==null){
mc = MathContext.DECIMAL64;
}
BigDecimal dec = number.divideToIntegralValue(MoneyUtils.getBigDecimal(divisor), mc);
return ... |
java | public static char[] createCharArray(int size, char defaultVal) {
char[] retval = new char[size];
if (size > 0) {
if (size < 500) {
for (int i = 0; i < size; i++) {
retval[i] = defaultVal;
}
}
else {
initializelLargeCharArray(retval, defaultVal);
}
}
return retval;
} |
java | public static boolean matchAny(final String pattern, final String[] candidate, boolean ignoreCase) {
for (int i = 0; i < candidate.length; i++) {
final String string = candidate[i];
if (match(pattern, string, ignoreCase)) {
return true;
}
}
r... |
python | def ArchiveProcessedFile(filePath, archiveDir):
"""
Move file from given file path to archive directory. Note the archive
directory is relative to the file path directory.
Parameters
----------
filePath : string
File path
archiveDir : string
Name of archive directory
"""
targetDir = ... |
python | def write_model_to_file(self, mdl, fn):
"""
Write a YANG model that was extracted from a source identifier
(URL or source .txt file) to a .yang destination file
:param mdl: YANG model, as a list of lines
:param fn: Name of the YANG model file
:return:
"""
... |
python | def highlight(text: str, color_code: int, bold: bool=False) -> str:
"""Wraps the given string with terminal color codes.
Args:
text: The content to highlight.
color_code: The color to highlight with, e.g. 'shelltools.RED'.
bold: Whether to bold the content in addition to coloring.
... |
python | def show(ctx, city, date):
"""Show a particular meetup.
city: The meetup series.
\b
date: The date. May be:
- YYYY-MM-DD or YY-MM-DD (e.g. 2015-08-27)
- YYYY-MM or YY-MM (e.g. 2015-08)
- MM (e.g. 08): the given month in the current year
- pN (e.g. p1): show the N-th las... |
python | def _encoding_wrapper(fileobj, mode, encoding=None, errors=None):
"""Decode bytes into text, if necessary.
If mode specifies binary access, does nothing, unless the encoding is
specified. A non-null encoding implies text mode.
:arg fileobj: must quack like a filehandle object.
:arg str mode: is t... |
python | def _checkIdEquality(self, requestedEffect, effect):
"""
Tests whether a requested effect and an effect
present in an annotation are equal.
"""
return self._idPresent(requestedEffect) and (
effect.term_id == requestedEffect.term_id) |
python | def get_assertion(self, ticket, attributes):
"""
Build a SAML 1.1 Assertion XML block.
"""
assertion = etree.Element('Assertion')
assertion.set('xmlns', 'urn:oasis:names:tc:SAML:1.0:assertion')
assertion.set('AssertionID', self.generate_id())
assertion.set('IssueI... |
java | public void add(Group group, AccessLevel accessLevel) {
getAccessList().add(new Access(group, accessLevel));
} |
java | public void generateStub(Element element) {
try {
getClassBuilder(element)
.buildStubClass()
.build()
.writeTo(filer);
} catch (Exception ex) {
messager.printMessage(Diagnostic.Kind.WARNING, "Error while generatin... |
java | @Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
final ActionBar ab = getSupportActionBar();
// set defaults for logo & home up
ab.setDisplayHomeAsUpEnabled(showHomeUp);
ab.setDisplayUseLog... |
python | def poplistitem(self, last=True):
"""
Pop and return a key:valuelist item comprised of a key and that key's
list of values. If <last> is False, a key:valuelist item comprised of
keys()[0] and its list of values is popped and returned. If <last> is
True, a key:valuelist item compr... |
java | private static Statistics getStatistics(String category, String name)
{
StatisticsContext context = getContext(category);
if (context == null)
{
return null;
}
// Format the name
name = formatName(name);
if (name == null)
{
return null;
}
... |
java | public void read() throws IOException
{
SecurityHelper.doPrivilegedIOExceptionAction(new PrivilegedExceptionAction<Object>()
{
public Object run() throws Exception
{
// Known issue for NFS bases on ext3. Need to refresh directory to read actual data.
dir.listAll(... |
java | @Override
public List<CommerceNotificationQueueEntry> findByLtS(Date sentDate) {
return findByLtS(sentDate, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
} |
java | public void deserialize(ByteBuffer bbf) {
this.clear();
ByteBuffer buffer = bbf.order() == LITTLE_ENDIAN ? bbf : bbf.slice().order(LITTLE_ENDIAN);
final int cookie = buffer.getInt();
if ((cookie & 0xFFFF) != SERIAL_COOKIE && cookie != SERIAL_COOKIE_NO_RUNCONTAINER) {
throw new RuntimeException("I... |
python | def _build_file(self, cif_str):
"""Build :class:`~nmrstarlib.nmrstarlib.CIFFile` object.
:param cif_str: NMR-STAR-formatted string.
:type cif_str: :py:class:`str` or :py:class:`bytes`
:return: instance of :class:`~nmrstarlib.nmrstarlib.CIFFile`.
:rtype: :class:`~nmrstarlib.nmrst... |
java | public static <T, R> Function<T, R> wrap(final Function<T, R> function)
{
final Tracing tracing = Tracing.get();
final String traceId = tracing.newOperationId();
return wrap(traceId, tracing.isVerbose(), function);
} |
python | def _get_criteria_matching_disks(logical_disk, physical_drives):
"""Finds the physical drives matching the criteria of logical disk.
This method finds the physical drives matching the criteria
of the logical disk passed.
:param logical_disk: The logical disk dictionary from raid config
:param phys... |
java | public XssMatchSet withXssMatchTuples(XssMatchTuple... xssMatchTuples) {
if (this.xssMatchTuples == null) {
setXssMatchTuples(new java.util.ArrayList<XssMatchTuple>(xssMatchTuples.length));
}
for (XssMatchTuple ele : xssMatchTuples) {
this.xssMatchTuples.add(ele);
... |
python | def get_individual_object(self, obj_class, data, subset):
"""Return a JSSObject of type obj_class searched for by data.
Args:
obj_class: The JSSObject subclass type to search for.
data: The data parameter performs different operations
depending on the type passed... |
python | def _all_minions(self, expr=None):
'''
Return a list of all minions that have auth'd
'''
mlist = []
for fn_ in salt.utils.data.sorted_ignorecase(os.listdir(os.path.join(self.opts['pki_dir'], self.acc))):
if not fn_.startswith('.') and os.path.isfile(os.path.join(self.... |
java | static boolean matches16CPB(CharSequence s, int start, int limit, final String t, int tlength) {
return matches16(s, start, t, tlength)
&& !(0 < start && Character.isHighSurrogate(s.charAt(start - 1)) &&
Character.isLowSurrogate(s.charAt(start)))
&& !((sta... |
java | @Override
public CommerceRegion remove(Serializable primaryKey)
throws NoSuchRegionException {
Session session = null;
try {
session = openSession();
CommerceRegion commerceRegion = (CommerceRegion)session.get(CommerceRegionImpl.class,
primaryKey);
if (commerceRegion == null) {
if (_log.isDe... |
java | public float getRankingForResourceType(String resourceType) {
String[] resourceTypeParams = getResourceTypes().get(resourceType);
if (resourceTypeParams == null) {
return -1.0f;
} else {
return Float.parseFloat(resourceTypeParams[0]);
}
} |
java | private void certificateFileSanityChecks(File certFile) {
if (!certFile.exists())
throw new VOMSError("Local VOMS trusted certificate does not exist:"
+ certFile.getAbsolutePath());
if (!certFile.canRead())
throw new VOMSError("Local VOMS trusted certificate is not readable:"
+ cer... |
python | def has(self, id, domain):
"""
Checks if a message has a translation.
@rtype: bool
@return: true if the message has a translation, false otherwise
"""
assert isinstance(id, (str, unicode))
assert isinstance(domain, (str, unicode))
if self.defines(id, dom... |
python | def get_task(self, task_id):
"""Retrieve one task, discriminated by id.
:param: task_id: the task id
:returns: a zobjects.Task object ;
if no task is matching, returns None.
"""
task = self.request_single('GetTask', {'id': task_id})
if task:
... |
python | def prepare_allseries(self, ramflag: bool = True) -> None:
"""Call methods |Node.prepare_simseries| and
|Node.prepare_obsseries|."""
self.prepare_simseries(ramflag)
self.prepare_obsseries(ramflag) |
java | @Patch("/metadata/{projectName}/tokens/{appId}")
@Consumes("application/json-patch+json")
public CompletableFuture<Revision> updateTokenRole(@Param("projectName") String projectName,
@Param("appId") String appId,
... |
python | def citeFilter(self, keyString = '', field = 'all', reverse = False, caseSensitive = False):
"""Filters `Records` by some string, _keyString_, in their citations and returns all `Records` with at least one citation possessing _keyString_ in the field given by _field_.
# Parameters
_keyString_ ... |
java | protected void clearItemIdMaps() {
if (getScratchMap() != null) {
getScratchMap().remove(CUSTOM_IDS_TO_NODE_SCRATCH_MAP_KEY);
getScratchMap().remove(ALL_IDS_TO_INDEX_SCRATCH_MAP_KEY);
getScratchMap().remove(EXPANDED_IDS_TO_INDEX_MAPPING_SCRATCH_MAP_KEY);
}
} |
python | def select_device_by_load(wproc=0.5, wmem=0.5):
"""Set the current device for cupy as the device with the lowest
weighted average of processor and memory load.
"""
ids = device_by_load(wproc=wproc, wmem=wmem)
cp.cuda.Device(ids[0]).use()
return ids[0] |
java | public void setMetaDataSlotService(MetaDataSlotService slotService) {
JaxWsMetaDataManager.jaxwsApplicationSlot = slotService.reserveMetaDataSlot(ApplicationMetaData.class);
JaxWsMetaDataManager.jaxwsModuleSlot = slotService.reserveMetaDataSlot(ModuleMetaData.class);
JaxWsMetaDataManager.jaxwsCo... |
java | public static <T> Level0ArrayOperator<Character[],Character> on(final char[] target) {
return onArrayOf(Types.CHARACTER, ArrayUtils.toObject(target));
} |
python | def bytes(self, *args):
""" return a raw value for the given arguments """
if len(args) == 1 and isinstance(args[0], BTree.Cursor):
cur = args[0]
else:
cur = self.btree.find('eq', self.makekey(*args))
if cur:
return cur.getval() |
java | public static boolean isObjectType(Class<?> cls) {
FieldType fieldType = TYPE_MAPPING.get(cls);
if (fieldType != null) {
return false;
}
return true;
} |
python | def take_profit_replace(self, accountID, orderID, **kwargs):
"""
Shortcut to replace a pending Take Profit Order in an Account
Args:
accountID : The ID of the Account
orderID : The ID of the Take Profit Order to replace
kwargs : The arguments to create a Take... |
python | def iter_breadth_first_edges(self, start=None):
"""Iterate over the edges with the breadth first convention.
We need this for the pattern matching algorithms, but a quick look at
Wikipedia did not result in a known and named algorithm.
The edges are yielded one by one, togethe... |
python | def reset(self):
"""
Resets the state of this pipette, removing associated placeables,
setting current volume to zero, and resetting tip tracking
"""
self.tip_attached = False
self.placeables = []
self.previous_placeable = None
self.current_volume = 0
... |
java | public static void save()
throws EFapsException
{
try {
Context.TRANSMANAG.commit();
Context.TRANSMANAG.begin();
final Context context = Context.getThreadContext();
context.connectionResource = null;
context.setTransaction(Context.TRANSMANA... |
java | @SuppressWarnings("unchecked")
public static List<Difference> getDifferences(String controlDom,
String testDom, final List<String> ignoreAttributes) {
try {
Diff d = new Diff(DomUtils.asDocument(controlDom),
DomUtils.asDocumen... |
java | public void marshall(UpdateJobRequest updateJobRequest, ProtocolMarshaller protocolMarshaller) {
if (updateJobRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(updateJobRequest.getJobName(), ... |
python | def gen_lines_from_textfiles(
files: Iterable[TextIO]) -> Generator[str, None, None]:
"""
Generates lines from file-like objects.
Args:
files: iterable of :class:`TextIO` objects
Yields:
each line of all the files
"""
for file in files:
for line in file:
... |
java | public static int searchDescending(char[] charArray, char value) {
int start = 0;
int end = charArray.length - 1;
int middle = 0;
while(start <= end) {
middle = (start + end) >> 1;
if(value == charArray[middle]) {
return middle;
... |
python | def initializeProfile(self):
"""
Initializes the Component Profile.
:return: Method success.
:rtype: bool
"""
LOGGER.debug("> Building '{0}' profile.".format(self.__file))
sections_file_parser = SectionsFileParser(self.__file)
sections_file_parser.parse... |
java | protected void notifyRequestListeners(RequestNotifierAction action, HttpServletRequest req, HttpServletResponse resp) throws IOException {
// notify any listeners that the config has been updated
IServiceReference[] refs = null;
try {
refs = getPlatformServices().getServiceReferences(IRequestListener.class... |
python | def setdict(self, D=None):
"""Set dictionary array."""
if D is not None:
self.D = np.asarray(D, dtype=self.dtype)
self.Df = sl.rfftn(self.D, self.cri.Nv, self.cri.axisN)
self.GDf = self.Gf * (self.Wtv * self.Df)[..., np.newaxis]
# Compute D^H S
self.DSf = n... |
java | private static boolean containsAllParameters(Map<String, List<String>> expectedParameters,
Map<String, List<String>> actualParameters) {
if (expectedParameters.isEmpty()) {
return true;
}
for (Entry<String, List<String>> requiredEntry... |
python | def show_instance(name, call=None):
'''
Displays details about a particular Linode VM. Either a name or a linode_id must
be provided.
.. versionadded:: 2015.8.0
name
The name of the VM for which to display details.
CLI Example:
.. code-block:: bash
salt-cloud -a show_ins... |
java | private static String parseZoneID(String text, ParsePosition pos) {
String resolvedID = null;
if (ZONE_ID_TRIE == null) {
synchronized (TimeZoneFormat.class) {
if (ZONE_ID_TRIE == null) {
// Build zone ID trie
TextTrieMap<String> trie =... |
java | public void getWorldPosition(int boneindex, Vector3f pos)
{
Bone bone = mBones[boneindex];
int boneParent = mSkeleton.getParentBoneIndex(boneindex);
if ((boneParent >= 0) && ((bone.Changed & LOCAL_ROT) == LOCAL_ROT))
{
calcWorld(bone, boneParent);
}
... |
java | public static boolean resourceExists(String ref) {
URL url = null;
for (int i=0;i<locations.size();i++) {
ResourceLocation location = (ResourceLocation) locations.get(i);
url = location.getResource(ref);
if (url != null) {
return true;
}
}
return false;
} |
java | public void finish() throws IOException {
if (printWriter != null) {
printWriter.close();
}
if (outputStream != null) {
outputStream.close();
}
} |
java | @Override
public DeploymentPlanBuilder andRemoveUndeployed() {
DeploymentActionImpl removeMod = DeploymentActionImpl.getRemoveAction(replacementModification.getReplacedDeploymentUnitUniqueName());
return new DeploymentPlanBuilderImpl(this, removeMod);
} |
java | @SequentialOnly
public BiIterator<K, V> iterator() {
final ObjIterator<Entry<K, V>> iter = s.iterator();
final BooleanSupplier hasNext = new BooleanSupplier() {
@Override
public boolean getAsBoolean() {
return iter.hasNext();
}
};... |
java | public void setName(final CompilerEnum name) {
this.compilerDef.setName(name);
final Processor compiler = this.compilerDef.getProcessor();
final Linker linker = compiler.getLinker(this.linkType);
this.linkerDef.setProcessor(linker);
} |
java | @Override
public Predicate and(Expression<Boolean> arg0, Expression<Boolean> arg1)
{
if (arg0 != null && arg1 != null)
{
return new ConjuctionPredicate((Predicate)arg0, (Predicate)arg1);
}
return null;
} |
python | def clean_url(url, replacement='_'):
"""
Cleans the url for protocol prefix and trailing slash and replaces special characters
with the given replacement.
:param url: The url of the request.
:param replacement: A string that is used to replace special characters.
"""
... |
python | def set_harakiri_params(self, timeout=None, verbose=None, disable_for_arh=None):
"""Sets workers harakiri parameters.
:param int timeout: Harakiri timeout in seconds.
Every request that will take longer than the seconds specified
in the harakiri timeout will be dropped and the c... |
python | def rd2xy(input,ra=None,dec=None,coordfile=None,colnames=None,
precision=6,output=None,verbose=True):
""" Primary interface to perform coordinate transformations from
pixel to sky coordinates using STWCS and full distortion models
read from the input image header.
"""
single_coor... |
java | public static void parseCamundaOutputParameters(Element inputOutputElement, IoMapping ioMapping) {
List<Element> outputParameters = inputOutputElement.elementsNS(BpmnParse.CAMUNDA_BPMN_EXTENSIONS_NS, "outputParameter");
for (Element outputParameterElement : outputParameters) {
parseOutputParameterElement(... |
python | def migrate_doc(self, doc):
"""
Migrate the doc from its current version to the target version
and return it.
"""
orig_ver = doc.get(self.version_attribute_name, 0)
funcs = self._get_migrate_funcs(orig_ver, self.target_version)
for func in funcs:
func(self, doc)
doc[self.version_attribute_name] = fu... |
java | public static CPOptionCategory findByUuid_First(String uuid,
OrderByComparator<CPOptionCategory> orderByComparator)
throws com.liferay.commerce.product.exception.NoSuchCPOptionCategoryException {
return getPersistence().findByUuid_First(uuid, orderByComparator);
} |
python | def get_nodes_by_namespace(graph: BELGraph, namespaces: Strings) -> Set[BaseEntity]:
"""Get all nodes identified by the given namespace(s)."""
return get_nodes(graph, namespace_inclusion_builder(namespaces)) |
java | public static <S, T, A, B> Lens<S, T, A, Maybe<B>> liftB(Lens<S, T, A, B> lens, B defaultB) {
return lens.mapB(m -> m.orElse(defaultB));
} |
java | private static int checkResult(int result)
{
if (exceptionsEnabled && result != cudaError.cudaSuccess)
{
throw new CudaException(cudaError.stringFor(result));
}
return result;
} |
java | @Override
public Tensor forward() {
Tensor x = modInX.getOutput();
Tensor w = modInW.getOutput();
y = new Tensor(x); // copy
y.elemMultiply(w);
return y;
} |
python | def remove_network_profile(self, obj, params):
"""Remove the specified AP profile."""
self._logger.debug("delete profile: %s", params.ssid)
str_buf = create_unicode_buffer(params.ssid)
ret = self._wlan_delete_profile(self._handle, obj['guid'], str_buf)
self._logger.debug("delete... |
java | public static <K, V> ConfigurationOptionBuilder<Map<K, V>> mapOption(ValueConverter<K> keyConverter, ValueConverter<V> valueConverter) {
return new ConfigurationOptionBuilder<Map<K, V>>(new MapValueConverter<K, V>(keyConverter, valueConverter), Map.class)
.defaultValue(Collections.<K, V>emptyMap());
} |
python | def SetPercentageView(self, percentageView):
"""Set whether to display percentage or absolute values"""
self.percentageView = percentageView
self.percentageMenuItem.Check(self.percentageView)
self.percentageViewTool.SetValue(self.percentageView)
total = self.adapter.value( self.l... |
java | public OperationFuture<List<Server>> setAutoscalePolicyOnServer(
AutoscalePolicy autoscalePolicy,
Server... servers
) {
return setAutoscalePolicyOnServer(autoscalePolicy, Arrays.asList(servers));
} |
java | public List<Attribute> getAttributes(ObjectName name, String[] attributes) throws Exception {
checkClientConnected();
return mbeanConn.getAttributes(name, attributes).asList();
} |
java | public IndexFacesResult withUnindexedFaces(UnindexedFace... unindexedFaces) {
if (this.unindexedFaces == null) {
setUnindexedFaces(new java.util.ArrayList<UnindexedFace>(unindexedFaces.length));
}
for (UnindexedFace ele : unindexedFaces) {
this.unindexedFaces.add(ele);
... |
python | def frets_to_NoteContainer(self, fingering):
"""Convert a list such as returned by find_fret to a NoteContainer."""
res = []
for (string, fret) in enumerate(fingering):
if fret is not None:
res.append(self.get_Note(string, fret))
return NoteContainer(res) |
java | public byte getValueAsByte(int index) throws IOException {
if (index >= structure.valueSizes.size()) {
throw new IOException("Index " + index + " is out of range.");
}
return value[index];
} |
python | def posthoc_dscf(a, val_col=None, group_col=None, sort=False):
'''Dwass, Steel, Critchlow and Fligner all-pairs comparison test for a
one-factorial layout with non-normally distributed residuals. As opposed to
the all-pairs comparison procedures that depend on Kruskal ranks, the DSCF
test is basically ... |
java | private void parseSoap11Fault(Document soapMessage, PrintWriter logger)
throws Exception {
Element envelope = soapMessage.getDocumentElement();
Element element = DomUtils.getElementByTagName(envelope, "faultcode");
if (element == null) {
element = DomUtils.getElementByTag... |
java | public Mean put(double[] vals, double[] weights) {
assert (vals.length == weights.length);
for(int i = 0, end = vals.length; i < end; i++) {
put(vals[i], weights[i]);
}
return this;
} |
java | public static int intersectSweptSphereTriangle(
float centerX, float centerY, float centerZ, float radius, float velX, float velY, float velZ,
float v0X, float v0Y, float v0Z, float v1X, float v1Y, float v1Z, float v2X, float v2Y, float v2Z,
float epsilon, float maxT, Vector4f pointA... |
python | def _create_sata_controllers(sata_controllers):
'''
Returns a list of vim.vm.device.VirtualDeviceSpec objects representing
SATA controllers
sata_controllers
SATA properties
'''
sata_ctrls = []
keys = range(-15000, -15050, -1)
if sata_controllers:
devs = [sata['adapter'] ... |
java | @Nonnull
public final UnifiedResponse setContentAndCharset (@Nonnull final String sContent, @Nonnull final Charset aCharset)
{
ValueEnforcer.notNull (sContent, "Content");
setCharset (aCharset);
setContent (sContent.getBytes (aCharset));
return this;
} |
python | def connect_channels(self, channels):
"""Connect the provided channels"""
self.log.info(f"Connecting to channels...")
for chan in channels:
chan.connect(self.sock)
self.log.info(f"\t{chan.channel}") |
java | public static int parseInt(String s, int i, int min, int max) {
return minMax(min, parseInt(s, i), max);
} |
java | public static <U, V> Function<U, V> retryable(Function<U, V> base,
Class<? extends Throwable> exceptionClass,
int maxRetries,
int maxDelayBetweenRetries) {
return new Retry... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.