language stringclasses 2
values | func_code_string stringlengths 63 466k |
|---|---|
java | public java.util.List<String> getAdditionalSlaveSecurityGroups() {
if (additionalSlaveSecurityGroups == null) {
additionalSlaveSecurityGroups = new com.amazonaws.internal.SdkInternalList<String>();
}
return additionalSlaveSecurityGroups;
} |
java | private static Object findValue(final OptionElement subroot,
final String[] pathElements, int pos) {
if (pos >= 0) {
// Not at root.
if (!pathElements[pos].equals(subroot.name)) {
return null;
}
}
if (subroot.isValue) {
// pos must be last e... |
python | def _create_argument_value_pairs(func, *args, **kwargs):
"""
Create dictionary with argument names as keys and their passed values as values.
An empty dictionary is returned if an error is detected, such as more
arguments than in the function definition, argument(s) defined by position
and keyword,... |
python | def check(self, diff):
"""Check that the new file introduced is a python source file"""
path = diff.b_path
assert any(
path.endswith(ext)
for ext in importlib.machinery.SOURCE_SUFFIXES
) |
python | def on_app_shutdown(self, app):
'''Dump profile content to disk'''
if self.filewatcher:
self.filewatcher.stop()
if self.profile:
self.upload_page.on_destroy()
self.download_page.on_destroy() |
java | public void marshall(IpAddressRequest ipAddressRequest, ProtocolMarshaller protocolMarshaller) {
if (ipAddressRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(ipAddressRequest.getSubnetId(),... |
java | @Override
public final JSONObject toJSONObject()
{
final JSONObject object = new JSONObject();
object.put("type", new JSONString(getNodeType().getValue()));
if (hasMetaData())
{
final MetaData meta = getMetaData();
if (false == meta.isEmpty())
... |
python | def get_battery_state(self, prop):
"""
Return the first line from the file located at battery_path/prop as a
string.
"""
with open(os.path.join(self.options['battery_path'], prop), 'r') as f:
return f.readline().strip() |
java | public void setCondition( ICondition condition)
{
super.setCondition( condition);
// Reset ancestry for all descendants.
if( members_ != null)
{
for( IVarDef member : members_)
{
member.setParent( this);
}
}
} |
java | public static com.liferay.commerce.product.model.CPInstance createCPInstance(
long CPInstanceId) {
return getService().createCPInstance(CPInstanceId);
} |
python | def current_branch(self):
"""The name of the branch that's currently checked out in the working tree (a string or :data:`None`)."""
output = self.context.capture('git', 'rev-parse', '--abbrev-ref', 'HEAD', check=False, silent=True)
return output if output != 'HEAD' else None |
java | @SuppressWarnings("unchecked")
protected boolean isValid() {
boolean res = true;
res = res & m_description.isValid();
res = res & m_name.isValid();
if (!res) {
return res;
}
for (I_CmsEditableGroupRow row : m_ouResources.getRows()) {
if (!((A... |
java | static int optimalNumOfHashFunctions(long n, long m) {
// (m / n) * log(2), but avoid truncation due to division!
return Math.max(1, (int) Math.round((double) m / n * Math.log(2)));
} |
java | @Override
public boolean cleanupLocalisations() throws SIResourceException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "cleanupLocalisations");
boolean allCleanedUp = _pubSubRemoteSupport.cleanupLocalisations(_consumerDispatchersDurable);
... |
python | def toProtocolElement(self):
"""
Returns the GA4GH protocol representation of this ReadGroup.
"""
# TODO this is very incomplete, but we don't have the
# implementation to fill out the rest of the fields currently
readGroup = protocol.ReadGroup()
readGroup.id = se... |
java | public static void writeConfigFile(File configFile, Class<?>[] classes, boolean sortClasses)
throws SQLException, IOException {
System.out.println("Writing configurations to " + configFile.getAbsolutePath());
writeConfigFile(new FileOutputStream(configFile), classes, sortClasses);
} |
python | def asgray(im):
"""
Takes an image and returns its grayscale version by averaging the color
channels. if an alpha channel is present, it will simply be ignored. If a
grayscale image is given, the original image is returned.
Parameters
----------
image : ndarray, ndim 2 or 3
RGB or ... |
python | def chunk_fill(iterable, size, fillvalue=None):
"""
chunk_fill('ABCDEFG', 3, 'x') --> ABC DEF Gxx
"""
# TODO: not used
args = [iter(iterable)] * size
return itertools.zip_longest(*args, fillvalue=fillvalue) |
java | public ServiceFuture<Void> enableKeyVaultAsync(String resourceGroupName, String accountName, final ServiceCallback<Void> serviceCallback) {
return ServiceFuture.fromResponse(enableKeyVaultWithServiceResponseAsync(resourceGroupName, accountName), serviceCallback);
} |
java | public static <T> T unmarshal(ProjectionEntity nativeEntity, Class<T> entityClass) {
return unmarshalBaseEntity(nativeEntity, entityClass);
} |
python | def present(profile='pagerduty', subdomain=None, api_key=None, **kwargs):
'''
Ensure that a pagerduty escalation policy exists. Will create or update as needed.
This method accepts as args everything defined in
https://developer.pagerduty.com/documentation/rest/escalation_policies/create.
In addit... |
java | public static void assertUnchanged(String message, DataSource dataSource) throws DBAssertionError {
DataSet emptyDataSet = empty(dataSource);
DBAssert.deltaAssertion(CallInfo.create(message), emptyDataSet, emptyDataSet);
} |
java | public static SegmentType segmentTypeFromType(Class<?> cl) {
if (Tenant.class.equals(cl)) {
return Tenant.SEGMENT_TYPE;
} else if (Environment.class.equals(cl)) {
return Environment.SEGMENT_TYPE;
} else if (Feed.class.equals(cl)) {
return Feed.SEGMENT_TYPE;
... |
python | def decimal_to_dms(value, precision):
'''
Convert decimal position to degrees, minutes, seconds in a fromat supported by EXIF
'''
deg = math.floor(value)
min = math.floor((value - deg) * 60)
sec = math.floor((value - deg - min / 60) * 3600 * precision)
return ((deg, 1), (min, 1), (sec, prec... |
java | @SuppressWarnings("deprecation")
private static int calculateNumberOfNetworkBuffers(Configuration configuration, long maxJvmHeapMemory) {
final int numberOfNetworkBuffers;
if (!hasNewNetworkConfig(configuration)) {
// fallback: number of network buffers
numberOfNetworkBuffers = configuration.getInteger(TaskM... |
java | public static int getDelimiterOffset(final String line, final int start, final char delimiter) {
int idx = line.indexOf(delimiter, start);
if (idx >= 0) {
idx -= start - 1;
}
return idx;
} |
java | private Pair<ResourcePackage, PackageHeader> readPackage(PackageHeader packageHeader) {
Pair<ResourcePackage, PackageHeader> pair = new Pair<>();
//read packageHeader
ResourcePackage resourcePackage = new ResourcePackage(packageHeader);
pair.setLeft(resourcePackage);
long beginP... |
java | public FSArray getPubTypeList() {
if (Header_Type.featOkTst && ((Header_Type)jcasType).casFeat_pubTypeList == null)
jcasType.jcas.throwFeatMissing("pubTypeList", "de.julielab.jules.types.Header");
return (FSArray)(jcasType.ll_cas.ll_getFSForRef(jcasType.ll_cas.ll_getRefValue(addr, ((Header_Type)jcasType).... |
java | private Set<URI> listEntitiesByDataModel(com.hp.hpl.jena.rdf.model.Resource entityType, Property dataPropertyType, URI modelReference) {
if (modelReference == null) {
return ImmutableSet.of();
}
StringBuilder queryBuilder = new StringBuilder()
.append("SELECT DISTIN... |
java | public static boolean isRequestEntityTooLargeException(SdkBaseException exception) {
return isAse(exception) && toAse(exception).getStatusCode() == HttpStatus.SC_REQUEST_TOO_LONG;
} |
python | def add_package(
self, target=None, package_manager=None,
package=None, type_option=None, version_option=None,
node_paths=None, workunit_name=None, workunit_labels=None):
"""Add an additional package using requested package_manager."""
package_manager = package_manager or self.get_package_manager(t... |
python | def _deserialize_list(cls, type_item, list_):
"""
:type type_item: T|type
:type list_: list
:rtype: list[T]
"""
list_deserialized = []
for item in list_:
item_deserialized = cls.deserialize(type_item, item)
list_deserialized.append(item_... |
java | public final AtomEntry<Node> readAtomEntry(final InputStream in) {
final Document doc = parseDocument(createDocumentBuilder(), in);
final XPath xPath = createXPath("atom", "http://www.w3.org/2005/Atom");
final String eventStreamId = findContentText(doc, xPath, "/atom:entry/atom:content/eventSt... |
python | def decrypt_cbc(self, data, init_vector):
"""
Return an iterator that decrypts `data` using the Cipher-Block Chaining
(CBC) mode of operation.
CBC mode can only operate on `data` that is a multiple of the block-size
in length.
Each iteration returns a block-sized :obj:`bytes` object (i... |
java | public JobOutput withWatermarks(JobWatermark... watermarks) {
if (this.watermarks == null) {
setWatermarks(new com.amazonaws.internal.SdkInternalList<JobWatermark>(watermarks.length));
}
for (JobWatermark ele : watermarks) {
this.watermarks.add(ele);
}
ret... |
python | def get_timestats_str(unixtime_list, newlines=1, full=True, isutc=True):
r"""
Args:
unixtime_list (list):
newlines (bool):
Returns:
str: timestat_str
CommandLine:
python -m utool.util_time --test-get_timestats_str
Example:
>>> # ENABLE_DOCTEST
>>> f... |
python | def push(self, filename, data):
"""Push a chunk of a file to the streaming endpoint.
Args:
filename: Name of file that this is a chunk of.
chunk_id: TODO: change to 'offset'
chunk: File data.
"""
self._queue.put(Chunk(filename, data)) |
python | def assignUserCredits(self, usernames, credits):
"""
assigns credit to a user.
Inputs:
usernames - list of users
credits - number of credits to assign to the users
Ouput:
dictionary
"""
userAssignments = []
for name in usernames:
... |
java | private void notifyOfEntityEvent(Collection<ITypedReferenceableInstance> entityDefinitions,
EntityNotification.OperationType operationType) throws AtlasException {
List<EntityNotification> messages = new LinkedList<>();
for (IReferenceableInstance entityDefinition :... |
python | def list_datastore_full(service_instance, datastore):
'''
Returns a dictionary with the basic information for the given datastore:
name, type, url, capacity, free, used, usage, hosts
service_instance
The Service Instance Object from which to obtain datastores.
datastore
Name of... |
java | @Override
public boolean isWsocRequest(ServletRequest request) throws ServletException {
ServletContext context = request.getServletContext();
Object wsocContainer = null;
if (context != null) {
wsocContainer = context.getAttribute(WebSocketContainerManager.SERVER_CONTAINER_ATTRI... |
python | def extrapolate_reciprocal(xs, ys, n, noise):
"""
return the parameters such that a + b / x^n hits the last two data points
"""
if len(xs) > 4 and noise:
y1 = (ys[-3] + ys[-4]) / 2
y2 = (ys[-1] + ys[-2]) / 2
x1 = (xs[-3] + xs[-4]) / 2
x2 = (xs[-1] + xs[-2]) / 2
tr... |
java | public static String normalise(String ensName) {
try {
return IDN.toASCII(ensName, IDN.USE_STD3_ASCII_RULES)
.toLowerCase();
} catch (IllegalArgumentException e) {
throw new EnsResolutionException("Invalid ENS name provided: " + ensName);
}
} |
java | public static boolean appearsToBeValidDDLBatch(String batch) {
BufferedReader reader = new BufferedReader(new StringReader(batch));
String line;
try {
while ((line = reader.readLine()) != null) {
if (isWholeLineComment(line)) {
continue;
... |
python | def get_choice_status(self):
"""
Returns a message field, which indicates whether choices statically
or dynamically defined, and flag indicating whether a dynamic file
selection loading error occurred.
Throws an error if this is not a choice parameter.
"""
if 'ch... |
java | public void setRows(com.google.api.ads.admanager.axis.v201808.Row[] rows) {
this.rows = rows;
} |
python | def envcontext(patch, _env=None):
"""In this context, `os.environ` is modified according to `patch`.
`patch` is an iterable of 2-tuples (key, value):
`key`: string
`value`:
- string: `environ[key] == value` inside the context.
- UNSET: `key not in environ` inside the con... |
python | def stop(self):
"""Stop listening."""
self._running = False
if self._sleep_task:
self._sleep_task.cancel()
self._sleep_task = None |
python | def get(self, key=None, view=None):
"""Register a new model (models)"""
self.set_header("Access-Control-Allow-Origin", "*")
self.set_header("Content-Type", "application/json")
if key is not None:
value = {}
value.update(self.database[key])
if view is n... |
java | public AVIMConversation getConversation(String conversationId, int convType) {
AVIMConversation result = null;
switch (convType) {
case Conversation.CONV_TYPE_SYSTEM:
result = getServiceConversation(conversationId);
break;
case Conversation.CONV_TYPE_TEMPORARY:
result = getTe... |
python | def read_frame_losc(channels, start_time, end_time):
""" Read channels from losc data
Parameters
----------
channels: str or list
The channel name to read or list of channel names.
start_time: int
The gps time in GPS seconds
end_time: int
The end time in GPS seconds
... |
java | protected KdTree.Node computeChild(List<P> points , GrowQueue_I32 indexes )
{
if( points.size() == 0 )
return null;
if( points.size() == 1 ) {
return createLeaf(points,indexes);
} else {
return computeBranch(points,indexes);
}
} |
python | def check_typ(helper, typ):
"""
check if typ parameter is TCP or UDP
"""
if typ != "tcp" and typ != "udp":
helper.exit(summary="Type (-t) must be udp or tcp.", exit_code=unknown, perfdata='') |
java | public SVGPath smoothCubicTo(double c2x, double c2y, double x, double y) {
return append(PATH_SMOOTH_CUBIC_TO).append(c2x).append(c2y).append(x).append(y);
} |
python | def _add_ephemeral_service(config, onion, progress, version, auth=None, await_all_uploads=None):
"""
Internal Helper.
This uses ADD_ONION to add the given service to Tor. The Deferred
this returns will callback when the ADD_ONION call has succeed,
*and* when at least one descriptor has been uploade... |
java | private void handleNoBreadcrumbsIntent(@NonNull final Bundle extras) {
if (extras.containsKey(EXTRA_NO_BREAD_CRUMBS)) {
hideBreadCrumb(extras.getBoolean(EXTRA_NO_BREAD_CRUMBS));
}
} |
python | def validate_frequencies(frequencies, max_freq, min_freq,
allow_negatives=False):
"""Checks that a 1-d frequency ndarray is well-formed, and raises
errors if not.
Parameters
----------
frequencies : np.ndarray, shape=(n,)
Array of frequency values
max_freq : flo... |
java | public static TimeSpan toTimespan(Object o, TimeSpan defaultValue) {
if (o instanceof TimeSpan) return (TimeSpan) o;
else if (o instanceof String) {
String[] arr = o.toString().split(",");
if (arr.length == 4) {
int[] values = new int[4];
try {
for (int i = 0; i < arr.length; i++) {
values[i] =... |
java | private ItemStack handleHotbar(MalisisInventory inventory, MalisisSlot hoveredSlot, int num)
{
MalisisSlot hotbarSlot = getPlayerInventory().getSlot(num);
// slot from player's inventory, swap itemStacks
if (inventory == getPlayerInventory() || hoveredSlot.getItemStack().isEmpty())
{
if (hoveredSlot.isStat... |
python | def p_case_def(self, p):
'''case_def : CASE term COLON expr
| DEFAULT COLON expr'''
if len(p) == 5:
p[0] = ('case', (p[2], p[4]))
elif len(p) == 4:
p[0] = ('default', p[3]) |
python | def lookup(self, name: str):
'''lookup a symbol by fully qualified name.'''
# <module>
if name in self._moduleMap:
return self._moduleMap[name]
# <module>.<Symbol>
(module_name, type_name, fragment_name) = self.split_typename(name)
if not module_name and type_... |
java | @Override
public List<ForeignKey<Record, ?>> getReferences() {
return Arrays.<ForeignKey<Record, ?>>asList(Keys.FK_BOOK_AUTHOR,
Keys.FK_BOOK_LANGUAGE);
} |
python | def from_clause(cls, clause):
""" Factory method """
[_, field, operator, val] = clause
return cls(field, operator, resolve(val)) |
java | public static void rotate(List<?> list, int distance) {
if (list instanceof RandomAccess || list.size() < ROTATE_THRESHOLD)
rotate1(list, distance);
else
rotate2(list, distance);
} |
java | public Observable<ServiceResponse<List<KeyVaultKeyInner>>> listKeyVaultKeysWithServiceResponseAsync(String resourceGroupName, String integrationAccountName, ListKeyVaultKeysDefinition listKeyVaultKeys) {
if (this.client.subscriptionId() == null) {
throw new IllegalArgumentException("Parameter this.c... |
python | def F_calc(TP, FP, FN, beta):
"""
Calculate F-score.
:param TP: true positive
:type TP : int
:param FP: false positive
:type FP : int
:param FN: false negative
:type FN : int
:param beta : beta coefficient
:type beta : float
:return: F score as float
"""
try:
... |
java | public static boolean hasField( Class clazz, String fieldName )
{
try
{
clazz.getDeclaredField( fieldName );
return true;
}
catch( NoSuchFieldException nfe )
{
if( clazz.getSuperclass() != null )
{
return hasField( clazz.getSuperclass(), fieldName );
}
e... |
java | public static MappedMemory allocate(File file, FileChannel.MapMode mode, int size) {
if (size > MAX_SIZE) {
throw new IllegalArgumentException("size cannot be greater than " + MAX_SIZE);
}
return new MappedMemoryAllocator(file, mode).allocate(size);
} |
python | def getserialnum(flist):
"""
This function assumes the serial number of the camera is in a particular place in the filename.
Yes, this is a little lame, but it's how the original 2011 image-writing program worked, and I've
carried over the scheme rather than appending bits to dozens of TB of files.
... |
java | public void beginDeleteById(String resourceId, String apiVersion) {
beginDeleteByIdWithServiceResponseAsync(resourceId, apiVersion).toBlocking().single().body();
} |
java | @Override
public String getString(final FieldCase c) {
boolean success = false;
String numberString;
do {
double number = getDouble(c);
numberString = format.format(number);
if (notZero && ZERO_PATTERN.matcher(numberString).matches()) {
log.info(XMLTags.NOTZERO + " is true and a zero value w... |
python | def update(self, section, val, data):
"""Add a setting to the config, but if same as default or None then no action.
This saves the .save writing the defaults
`section` (mandatory) (string) the section name in the config E.g. `"agent"`
`val` (mandatory) (string) the section name in the... |
java | public void remove(final ObjectSinkNode node) {
if ( (this.firstNode != node) && (this.lastNode != node) ) {
node.getPreviousObjectSinkNode().setNextObjectSinkNode( node.getNextObjectSinkNode() );
node.getNextObjectSinkNode().setPreviousObjectSinkNode( node.getPreviousObjectSinkNode() );... |
python | def get_corrections_dict(self, entry):
"""
Returns the corrections applied to a particular entry.
Args:
entry: A ComputedEntry object.
Returns:
({correction_name: value})
"""
corrections = {}
for c in self.corrections:
val = c... |
java | protected void createServletWrappers() throws Exception {
// NOTE: namespace preinvoke/postinvoke not necessary as the only
// external
// code being run is the servlet's init() and that is handled in the
// ServletWrapper
// check if an extensionFactory is present for *.jsp:
... |
java | @SuppressWarnings("unchecked")
@NotNull
public <TYPE> TYPE create(@NotNull @FileExists @IsFile final File file, @NotNull final JAXBContext jaxbContext)
throws UnmarshalObjectException {
Contract.requireArgNotNull("file", file);
FileExistsValidator.requireArgValid("file", file);
... |
python | def disambiguate(self, symclasses):
"""Use the connection to the atoms around a given vertex
as a multiplication function to disambiguate a vertex"""
offsets = self.offsets
result = symclasses[:]
for index in self.range:
try:
val = 1
for offset, bondtype in offsets[index]:
... |
java | public void setAttribute(final String name, final Attribute attribute) {
if (name.equals(MAP_KEY)) {
this.mapAttribute = (MapAttribute) attribute;
}
} |
python | def describe(self, name=None):
"""
Cleanly show what the four displayed distribution moments are:
- Mean
- Variance
- Standardized Skewness Coefficient
- Standardized Kurtosis Coefficient
For a standard Normal distribution, these are [0, 1... |
java | public QueryBuilder<T, ID> queryBuilder() throws SQLException {
if (statementBuilder instanceof QueryBuilder) {
return (QueryBuilder<T, ID>) statementBuilder;
} else {
throw new SQLException("Cannot cast " + statementBuilder.getType() + " to QueryBuilder");
}
} |
python | def load(fp, **kwargs) -> BioCCollection:
"""
Deserialize fp (a .read()-supporting text file or binary file containing a JSON document) to
a BioCCollection object
Args:
fp: a file containing a JSON document
**kwargs:
Returns:
BioCCollection: a collection
"""
... |
java | public void stop()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "stop");
// Lock exclusively for start operations
mpioLockManager.lockExclusive();
started = false;
mpioLockManager.unlockExclusive();
if (TraceComponent.isAnyTracingEnabled(... |
java | private Node createCompilerDefaultValueOverridesVarNode(
Node sourceInformationNode) {
Node objNode = IR.objectlit().srcref(sourceInformationNode);
for (Entry<String, Node> entry : compilerDefaultValueOverrides.entrySet()) {
Node objKeyNode = IR.stringKey(entry.getKey())
.useSourceInfoIfMi... |
java | protected SemanticSpace getSpace() {
// Ensure that the configured DependencyExtactor is in place prior to
// constructing the SVS
setupDependencyExtractor();
DependencyPathAcceptor acceptor;
if (argOptions.hasOption("pathAcceptor"))
acceptor = ReflectionUtil... |
java | protected MailMessage createMailRequest(Map<String, Object> messageHeaders, BodyPart bodyPart, MailEndpointConfiguration endpointConfiguration) {
return MailMessage.request(messageHeaders)
.marshaller(endpointConfiguration.getMarshaller())
.from(messageHeaders.get... |
java | public String getUuid()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "getUuid");
String uuid = null;
if(_outputHandler!=null)
{
uuid = _outputHandler.getTopicSpaceUuid().toString();
}
else
{
uuid = _anycastInputHandler.getBaseDestinat... |
python | def group_path(cls, project, group):
"""Return a fully-qualified group string."""
return google.api_core.path_template.expand(
"projects/{project}/groups/{group}", project=project, group=group
) |
python | def download_on_demand_class(session, args, class_name):
"""
Download all requested resources from the on-demand class given
in class_name.
@return: Tuple of (bool, bool), where the first bool indicates whether
errors occurred while parsing syllabus, the second bool indicates
whether th... |
python | def key(self, direction, mechanism, purviews=False, _prefix=None):
"""Cache key. This is the call signature of |Subsystem.find_mice()|."""
return (_prefix, direction, mechanism, purviews) |
java | public DescribeClassicLinkInstancesResult withInstances(ClassicLinkInstance... instances) {
if (this.instances == null) {
setInstances(new com.amazonaws.internal.SdkInternalList<ClassicLinkInstance>(instances.length));
}
for (ClassicLinkInstance ele : instances) {
this.in... |
python | def db_temp_from_wb_rh(wet_bulb, rel_humid, b_press=101325):
"""Dry Bulb Temperature (C) and humidity_ratio at at wet_bulb (C),
rel_humid (%) and Pressure b_press (Pa).
Formula is only valid for rel_humid == 0 or rel_humid == 100.
"""
assert rel_humid == 0 or rel_humid == 100, 'formula is only vali... |
python | def validateExtractOptions(options):
''' Check the validity of the option combinations for barcode extraction'''
if not options.pattern and not options.pattern2:
if not options.read2_in:
U.error("Must supply --bc-pattern for single-end")
else:
U.error("Must supply --bc-p... |
java | @SuppressWarnings("unchecked")
public <T> BehaviorTree<T> createBehaviorTree (String treeReference, T blackboard) {
BehaviorTree<T> bt = (BehaviorTree<T>)retrieveArchetypeTree(treeReference).cloneTask();
bt.setObject(blackboard);
return bt;
} |
python | def progressbar(iterable=None, length=None, label=None, show_eta=True,
show_percent=None, show_pos=False,
item_show_func=None, fill_char='#', empty_char='-',
bar_template='%(label)s [%(bar)s] %(info)s',
info_sep=' ', width=36, file=None, color=None):
... |
python | def parse_numpy_doc(doc):
""" Extract the text from the various sections of a numpy-formatted docstring.
Parameters
----------
doc: Union[str, None]
Returns
-------
OrderedDict[str, Union[None,str]]
The extracted numpy-styled docstring sections."""
... |
java | private BeanDefinitionBuilder parseSqlQueryAction(Element element, Element scriptValidationElement,
List<Element> validateElements, List<Element> extractElements) {
BeanDefinitionBuilder beanDefinition = BeanDefinitionBuilder.rootBeanDefinition(ExecuteSQLQueryAction.class);
// check for sc... |
python | def get_activities_by_objective_banks(self, objective_bank_ids):
"""Gets the list of ``Activities`` corresponding to a list of ``ObjectiveBanks``.
arg: objective_bank_ids (osid.id.IdList): list of objective
bank ``Ids``
return: (osid.learning.ActivityList) - list of activitie... |
python | def bbox_vert_aligned_left(box1, box2):
"""
Returns true if the left boundary of both boxes is within 2 pts
"""
if not (box1 and box2):
return False
return abs(box1.left - box2.left) <= 2 |
python | def sample_assignment_probs(qubits, nsamples, cxn):
"""
Sample the assignment probabilities of qubits using nsamples per measurement, and then compute
the estimated assignment probability matrix. See the docstring for estimate_assignment_probs for
more information.
:param list qubits: Qubits to sam... |
python | def sce2c(sc, et):
"""
Convert ephemeris seconds past J2000 (ET) to continuous encoded
spacecraft clock "ticks". Non-integral tick values may be
returned.
http://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/sce2c_c.html
:param sc: NAIF spacecraft ID code.
:type sc: int
:param et: ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.