language stringclasses 2
values | func_code_string stringlengths 63 466k |
|---|---|
python | def get_setup_version(cls, setup_path, reponame, describe=False,
dirty='report', pkgname=None, archive_commit=None):
"""
Helper for use in setup.py to get the version from the .version file (if available)
or more up-to-date information from git describe (if available).
... |
python | def widget_attrs(self, widget):
"""
Given a Widget instance (*not* a Widget class), returns a dictionary of
any HTML attributes that should be added to the Widget, based on this
Field.
"""
attrs = {}
if getattr(self, "min_value", None) is not None:
att... |
python | def rescale_image(
data, maxsizeb=4000000, dimen=None,
png2jpg=False, graying=True, reduceto=(600, 800)):
'''
若 ``png2jpg`` 为 ``True`` 则将图片转换为 ``JPEG`` 格式,所有透明像素被设置为
*白色* 。确保结果图片尺寸小于 ``maxsizeb`` 的约束限制。
如果 ``dimen`` 不为空,则生成一个相应约束的缩略图。依据 ``dimen`` 的类型,设置约束为
``width=dimen, height=dime... |
java | public static String normalizePath(String path)
{
StringBuilder sb = new StringBuilder(path);
int lastToken = -1;
for (int i = 0; i < sb.length(); i++)
{
if ((sb.charAt(i) == File.separatorChar)
|| (sb.charAt(i) == '/'))
{
if (l... |
python | def substitute_values(self, vect):
"""
Internal method to substitute integers into the vector, and construct
metadata to convert back to the original vector.
np.nan is always given -1, all other objects are given integers in
order of apperence.
Parameters
------... |
python | def set(self, indexes, values=None):
"""
Given indexes will set a sub-set of the Series to the values provided. This method will direct to the below
methods based on what types are passed in for the indexes. If the indexes contains values not in the Series
then new rows or columns will... |
python | def get_all_connections(self, id, connection_name, **args):
"""Get all pages from a get_connections call
This will iterate over all pages returned by a get_connections call
and yield the individual items.
"""
while True:
page = self.get_connections(id, connection_nam... |
java | @Nonnull
@ReturnsMutableCopy
public static HCNodeList nl2divNodeList (@Nullable final String sText)
{
final HCNodeList ret = new HCNodeList ();
nl2divList (sText, ret::addChild);
return ret;
} |
java | public PagedList<JobExecutionInner> listByJob(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName, final DateTime createTimeMin, final DateTime createTimeMax, final DateTime endTimeMin, final DateTime endTimeMax, final Boolean isActive, final Integer skip, final Inte... |
java | public void and(CClassNode other, ScanEnvironment env) {
boolean not1 = isNot();
BitSet bsr1 = bs;
CodeRangeBuffer buf1 = mbuf;
boolean not2 = other.isNot();
BitSet bsr2 = other.bs;
CodeRangeBuffer buf2 = other.mbuf;
if (not1) {
BitSet bs1 = new BitSe... |
java | public Object beginContext(ComponentMetaData cmd) { // modified to return object d131914
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
if (cmd != null)
Tr.debug(tc, "begin context " + cmd.getJ2EEName());
else
Tr.debug(tc, "NULL was pas... |
java | public void marshall(CSVInput cSVInput, ProtocolMarshaller protocolMarshaller) {
if (cSVInput == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(cSVInput.getFileHeaderInfo(), FILEHEADERINFO_BINDING);
... |
python | def byFileType( fileType ):
"""
Looks up the language plugin by the inputed file type.
:param fileType | <str>
:return <XLanguage> || None
"""
XLanguage.load()
for lang in XLanguage._plugins.values():
if ( fileType i... |
python | def all_input(self):
"""
Returns all input files as a dict of {filename: feffio object}
"""
d = {"HEADER": self.header(), "PARAMETERS": self.tags}
if "RECIPROCAL" not in self.tags:
d.update({"POTENTIALS": self.potential, "ATOMS": self.atoms})
return d |
java | @Override
public DeleteFileSystemResult deleteFileSystem(DeleteFileSystemRequest request) {
request = beforeClientExecution(request);
return executeDeleteFileSystem(request);
} |
java | public Set<ComponentDto> selectComponentsByQualifiers(DbSession dbSession, Set<String> qualifiers) {
checkArgument(!qualifiers.isEmpty(), "Qualifiers cannot be empty");
return new HashSet<>(mapper(dbSession).selectComponentsByQualifiers(qualifiers));
} |
python | def show_docs(cls, keys=None, indent=0, *args, **kwargs):
"""
Classmethod to print the full documentations of the formatoptions
Parameters
----------
%(Plotter.show_keys.parameters)s
Other Parameters
----------------
%(Plotter.show_keys.other_parameters)... |
python | def add_layout(self, obj, place='center'):
''' Adds an object to the plot in a specified place.
Args:
obj (Renderer) : the object to add to the Plot
place (str, optional) : where to add the object (default: 'center')
Valid places are: 'left', 'right', 'above', 'b... |
python | def on_recv(self, cf):
"""Function that must be called every time a CAN frame is received, to
advance the state machine."""
data = bytes(cf.data)
if len(data) < 2:
return
ae = 0
if self.extended_rx_addr is not None:
ae = 1
if len(dat... |
java | private static <T extends Storable> OrderingList
mostOrdering(StorableProperty<T> primeTarget, OrderingList<T> targetOrdering)
{
OrderingList handledOrdering = OrderingList.emptyList();
for (OrderedProperty<T> targetProp : targetOrdering) {
ChainedProperty<T> chainedProp = t... |
java | public static String getServiceName(MuleEventContext event) {
// Mule 2.2 implementation
// Service service = (event == null)? null : event.getService();
FlowConstruct service = (event == null)? null : event.getFlowConstruct();
String name = (service == null)? "" : service.getNam... |
java | public Reader getCharacterStream(int arg0) throws SQLException {
try {
Reader reader = rsetImpl.getCharacterStream(arg0);
if (reader != null && freeResourcesOnClose)
resources.add(reader);
return reader;
} catch (SQLException ex) {
FFDCF... |
java | @SuppressWarnings("unchecked")
private boolean shouldAddEnclosingValidator(
EditableValueHolder component,
String validatorId)
{
// check if the validatorId is on the exclusion list on the component
List<String> exclusionList = (List<String>) ((UIComponent) component)
... |
python | def stop(ctx, description, f):
"""
Use it when you stop working on the current task. You can add a description
to what you've done.
"""
description = ' '.join(description)
try:
timesheet_collection = get_timesheet_collection_for_context(ctx, f)
current_timesheet = timesheet_colle... |
python | def decstr2int(dec_str, decimals):
'''
Returns an integer that has the value of the decimal string:
dec_str*10^decimals
Arguments:
dec_str (string) that represents a decimal number
decimals (int): number of decimals for creating the integer output
Returns:
(int)
Rais... |
python | def stats(txt, color=False):
"Print stats"
if color:
txt = config.Col.OKBLUE + txt + config.Col.ENDC
print(txt) |
java | private List<ResourceField> getAllResourceExtendedAttributes()
{
ArrayList<ResourceField> result = new ArrayList<ResourceField>();
result.addAll(Arrays.asList(ResourceFieldLists.CUSTOM_TEXT));
result.addAll(Arrays.asList(ResourceFieldLists.CUSTOM_START));
result.addAll(Arrays.asList(ResourceF... |
python | def getPayloadStruct(self, attributes, objType=None):
""" Function getPayloadStruct
Get the payload structure to do a creation or a modification
@param key: The key to modify
@param attribute: The data
@param objType: NOT USED in this class
@return RETURN: The API result... |
java | @Nullable
final TypeToken<? super T> getGenericSuperclass() {
if (runtimeType instanceof TypeVariable) {
// First bound is always the super class, if one exists.
return boundAsSuperclass(((TypeVariable<?>) runtimeType).getBounds()[0]);
}
if (runtimeType instanceof WildcardType) {
// wild... |
java | int fillBackwardFrom0(int itemIndex, double upTo) {
double min = orientation.minY(positioner.getVisibleCell(itemIndex));
int i = itemIndex;
while(min > upTo && i > 0) {
--i;
C c = positioner.placeEndFromStart(i, min);
min = orientation.minY(c);
}
... |
java | public List<Integer> getRevisionIdsContainingTemplateFragments(List<String> templateFragments) throws WikiApiException{
return getFragmentFilteredRevisionIds(templateFragments,true);
} |
java | @NotNull
public Optional<T> findSingle() {
if (iterator.hasNext()) {
T singleCandidate = iterator.next();
if (iterator.hasNext()) {
throw new IllegalStateException("Stream contains more than one element");
} else {
return Optional.of(single... |
java | private boolean isProcessXMLNeeded(InjectionProcessorProvider<?, ?> provider)
{
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isEntryEnabled())
Tr.entry(tc, "isProcessXMLNeeded: " + provider);
List<Class<? extends JNDIEnvironmentRef>> refCla... |
python | def h(gbm, array_or_frame, indices_or_columns = 'all'):
"""
PURPOSE
Compute Friedman and Popescu's H statistic, in order to look for an interaction in the passed gradient-boosting
model among the variables represented by the elements of the passed array or frame and specified by the passed
indices ... |
java | public EClass getIfcDimensionCalloutRelationship() {
if (ifcDimensionCalloutRelationshipEClass == null) {
ifcDimensionCalloutRelationshipEClass = (EClass) EPackage.Registry.INSTANCE
.getEPackage(Ifc2x3tc1Package.eNS_URI).getEClassifiers().get(148);
}
return ifcDimensionCalloutRelationshipEClass;
} |
python | def decode_jwt(encoded_token):
"""
Returns the decoded token from an encoded one. This does all the checks
to insure that the decoded token is valid before returning it.
"""
secret = config.decode_key
algorithm = config.algorithm
audience = config.audience
return jwt.decode(encoded_token... |
python | def main(argv=sys.argv):
# type: (List[str]) -> int
"""Parse and check the command line arguments."""
parser = optparse.OptionParser(
usage="""\
usage: %prog [options] -o <output_path> <module_path> [exclude_pattern, ...]
Look recursively in <module_path> for Python modules and packages and create
... |
python | def delete(self, url_path, data=None):
"""Delete an object from the JSS.
In general, it is better to use a higher level interface for
deleting objects, namely, using a JSSObject's delete method.
Args:
url_path: String API endpoint path to DEL, with ID (e.g.
... |
java | protected final void shutdown()
throws ObjectManagerException
{
final String methodName = "shutdown";
if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
trace.entry(this, cclass, methodName);
Exception exceptionCaughtDuringShutdown = null;
... |
python | def _instantiate_target(self, target_adaptor):
"""Given a TargetAdaptor struct previously parsed from a BUILD file, instantiate a Target."""
target_cls = self._target_types[target_adaptor.type_alias]
try:
# Pop dependencies, which were already consumed during construction.
kwargs = target_adapto... |
python | def separate_walks_turns(data, window=[1, 1, 1]):
""" Will separate peaks into the clusters by following the trend in the clusters array.
This is usedful because scipy's k-mean clustering will give us a continous clusters
array.
:param clusters array: A continous array representing ... |
java | public final void tryMakeWhereEnum(final StringBuffer pSbWhere,
final IRequestData pRequestData, final Class<?> pEntityClass,
final String pFldNm,
final Map<String, Object> pFilterMap,
final Set<String> pFilterAppearance) throws Exception {
String nmRnd = pRequestData.getParameter("nmRnd... |
python | def saveAs(self, path):
"""
save to file under given name
"""
if not path:
path = self._dialogs.getSaveFileName(filter='*.csv')
if path:
self._setPath(path)
with open(str(self._path), 'wb') as stream:
writer = csv.writer(stream)... |
java | @Override
public Request<ModifyVolumeRequest> getDryRunRequest() {
Request<ModifyVolumeRequest> request = new ModifyVolumeRequestMarshaller().marshall(this);
request.addParameter("DryRun", Boolean.toString(true));
return request;
} |
python | def existing_dhcp_networks(cls, conf):
"""Return a list of existing networks ids that we have configs for."""
global _networks
sup = super(SimpleCpnrDriver, cls)
superkeys = sup.existing_dhcp_networks(conf)
return set(_networks.keys()) & set(superkeys) |
python | def maximum(self, node):
"""
find the max node when node regard as a root node
:param node:
:return: max node
"""
temp_node = node
while temp_node.right is not None:
temp_node = temp_node.right
return temp_node |
java | @Override
public P readPage(int pageID) {
try {
countRead();
return byteBufferToPage(this.file.getRecordBuffer(pageID));
} catch (IOException e) {
throw new RuntimeException("IOException occurred during reading of page " + pageID, e);
}
} |
python | def create_new(self, **kwargs):
"""
Creates a new License
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 response.
>>> def callback_function(respo... |
python | def _init_map(self):
"""stub"""
super(EdXDragAndDropQuestionFormRecord, self)._init_map()
QuestionTextFormRecord._init_map(self)
QuestionFilesFormRecord._init_map(self)
self.my_osid_object_form._my_map['text']['text'] = '' |
java | public static BigInteger bigFactorial(int n)
{
if (n < 0)
{
throw new IllegalArgumentException("Argument must greater than or equal to zero.");
}
BigInteger factorial = null;
if (n < CACHE_SIZE) // Check for a cached value.
{
factorial = BIG_F... |
java | protected static List<Vertex> combineByCustomDictionary(List<Vertex> vertexList, DoubleArrayTrie<CoreDictionary.Attribute> dat, final WordNet wordNetAll)
{
List<Vertex> outputList = combineByCustomDictionary(vertexList, dat);
int line = 0;
for (final Vertex vertex : outputList)
{
... |
python | def list_device_subscriptions(self, device_id, **kwargs):
"""Lists all subscribed resources from a single device
:param device_id: ID of the device (Required)
:returns: a list of subscribed resources
:rtype: list of str
"""
api = self._get_api(mds.SubscriptionsApi)
... |
python | def tpl_send(self, param, must=[APIKEY, MOBILE, TPL_ID, TPL_VALUE]):
'''指定模板发送 only v1 deprecated
参数名 类型 是否必须 描述 示例
apikey String 是 用户唯一标识 9b11127a9701975c734b8aee81ee3526
mobile String 是 接收的手机号 15205201314
tpl_id Long 是 模板id 1
tpl_value String 是 变量名和变量值对。请先对您的变量... |
python | def is_color(color):
"""
Checks if supplied object is a valid color spec.
"""
if not isinstance(color, basestring):
return False
elif RGB_HEX_REGEX.match(color):
return True
elif color in COLOR_ALIASES:
return True
elif color in cnames:
return True
return ... |
python | def activate(self):
"""Activate the Router."""
if lib.EnvActivateRouter(self._env, self._name.encode()) == 0:
raise RuntimeError("Unable to activate router %s" % self._name) |
java | private Deployment findMatchingDeployment(DeploymentTargetDescription target) {
List<Deployment> matching = findMatchingDeployments(target);
if (matching.size() == 0) {
return null;
}
if (matching.size() == 1) {
return matching.get(0);
}
// if mul... |
python | def _plot_future(time, data, legend=None, title=None, y_axis_label=None, hor_lines=None,
hor_lines_leg=None, vert_lines=None, vert_lines_leg=None,
apply_opensignals_style=True, show_plot=True, warn_print=False, **kwargs):
"""
Plotting function intended for an easy representation ... |
python | def generate_bq_schema(df, default_type="STRING"):
"""DEPRECATED: Given a passed df, generate the associated Google BigQuery
schema.
Parameters
----------
df : DataFrame
default_type : string
The default big query type in case the type of the column
does not exist in the schema.... |
java | public Cookie getCookie( String cookieName )
{
List cookies = getHeaders(SET_COOKIE);
if(cookies != null){
// start looking from the back (ie. the last cookie set)
for(int i = cookies.size(); --i > -1;) {
Cookie cookie = (Cookie)cookies.get(i);
... |
java | private String getRequestPath(HttpServletRequest request) {
String finalUrl = null;
String servletPath = request.getServletPath();
if ("".equals(jawrConfig.getServletMapping())) {
finalUrl = PathNormalizer.asPath(servletPath);
} else {
finalUrl = PathNormalizer.asPath(servletPath + request.getPathInfo())... |
python | def alignXY(self):
"""aligns XY pairs (or XYYY etc) by X value."""
# figure out what data we have and will align to
xVals=[]
xCols=[x for x in range(self.nCols) if self.colTypes[x]==3]
yCols=[x for x in range(self.nCols) if self.colTypes[x]==0]
xCols,yCols=np.array(xCols... |
java | public static void rename(FileSystem fs, String oldName, String newName)
throws IOException {
Path oldDir = new Path(oldName);
Path newDir = new Path(newName);
if (!fs.rename(oldDir, newDir)) {
throw new IOException("Could not rename " + oldDir + " to " + newDir);
}
} |
python | def bulk_upsert(
queryset, model_objs, unique_fields, update_fields=None, return_upserts=False, return_upserts_distinct=False,
sync=False, native=False
):
"""
Performs a bulk update or insert on a list of model objects. Matches all objects in the queryset
with the objs provided using the field value... |
python | def reset_poller(poll=None):
"""replace the scheduler's poller, throwing away any pre-existing state
this is only really a good idea in the new child process after a fork(2).
"""
state.poller = poll or poller.best()
log.info("resetting fd poller, using %s" % type(state.poller).__name__) |
python | def yaml_block(self):
"""Lazy load a yaml_block.
If yaml support is not available,
there is an error in parsing the yaml block,
or no yaml is associated with this result,
``None`` will be returned.
:rtype: dict
"""
if LOAD_YAML and self._yaml_block is no... |
python | def _getParLabelAndUnit(self, param):
""" checks param to see if it contains a parent link (ie star.) then returns the correct unit and label for the
job from the parDicts
:return:
"""
firstObject = self.objectList[0]
if isinstance(firstObject, ac.Planet):
... |
java | public void fileNotFound(File f) {
if (!recentFiles.contains(f)) {
throw new IllegalStateException("Well no wonder it wasn't found, its not in the list.");
} else {
recentFiles.remove(f);
}
} |
python | def _get_info(self, fullmodname):
"""
Internal helper for find_module() and load_module().
Args:
fullmodname: The dot-separated full module name, e.g. 'django.core.mail'.
Returns:
A tuple (submodname, is_package, relpath, fileobj) where:
submodname: The ... |
python | def apply(self, collection, ops, **kwargs):
"""Apply the filter to collection."""
validator = lambda obj: all(op(obj, val) for (op, val) in ops) # noqa
return [o for o in collection if validator(o)] |
java | private void unregisterTargets( Set<String> newTargetIds ) {
for( String targetId : newTargetIds ) {
try {
this.targetsMngr.deleteTarget( targetId );
} catch( Exception e ) {
this.logger.severe( "A target ID that has just been registered could not be created. That's weird." );
Utils.logException( ... |
python | def parse_to_instance(self, title_of_name_and_default):
"""{title: [Option(), ...]}"""
result = {}
for title, name_and_default in title_of_name_and_default.items():
logger.debug((title, name_and_default))
result[title] = opts = []
for opt_str, default in... |
python | def command(self, function=None, prefix=None, unobserved=False):
"""
Decorator to define a new command for this Ingredient or Experiment.
The name of the command will be the name of the function. It can be
called from the command-line or by using the run_command function.
Comma... |
python | def _format_zinc_arguments(settings, distribution):
"""Extracts and formats the zinc arguments given in the jvm platform settings.
This is responsible for the symbol substitution which replaces $JAVA_HOME with the path to an
appropriate jvm distribution.
:param settings: The jvm platform settings from... |
python | def add_columns(self, data, column_names=None, inplace=False):
"""
Returns an SFrame with multiple columns added. The number of
elements in all columns must match the length of every other column of
the SFrame.
If inplace == False (default) this operation does not modify the
... |
python | def check(self, *args):
"""
Callback to check validity of instrument parameters.
Performs the following tasks:
- spots and flags overlapping windows or null window parameters
- flags windows with invalid dimensions given the binning parameter
- sets the corre... |
java | public void setParent(Model parent) {
if (parent == null || parent.getId() == null) {
throw new IllegalArgumentException("parent cannot ne null and parent ID cannot be null");
}
List<Association> associations = metaModelLocal.getAssociations();
for (Association association : ... |
python | def diff_packages(pkg1, pkg2=None):
"""Invoke a diff editor to show the difference between the source of two
packages.
Args:
pkg1 (`Package`): Package to diff.
pkg2 (`Package`): Package to diff against. If None, the next most recent
package version is used.
"""
if pkg2 i... |
python | def get_all_names(chebi_ids):
'''Returns all names'''
all_names = [get_names(chebi_id) for chebi_id in chebi_ids]
return [x for sublist in all_names for x in sublist] |
java | private ResultAction getFailedResultAction(Throwable cause) {
if (currentStage == Stage.MODEL || cancelled || isRollbackOnRuntimeFailure() || isRollbackOnly()
|| (cause != null && !(cause instanceof OperationFailedException))) {
return ResultAction.ROLLBACK;
}
return ... |
java | public ServiceFuture<List<SyncGroupLogPropertiesInner>> listLogsAsync(final String resourceGroupName, final String serverName, final String databaseName, final String syncGroupName, final String startTime, final String endTime, final String type, final ListOperationCallback<SyncGroupLogPropertiesInner> serviceCallback)... |
python | def getAceTypeText(self, t):
'''
returns the textual representation of a acetype bit
'''
try:
return self.validAceTypes[t]['TEXT']
except KeyError:
raise CommandExecutionError((
'No ACE type "{0}". It should be one of the following: {1}'
... |
java | private void checkJnlpFileConfiguration( JnlpFile jnlpFile )
throws MojoExecutionException
{
if ( StringUtils.isBlank( jnlpFile.getOutputFilename() ) )
{
throw new MojoExecutionException(
"Configuration error: An outputFilename must be specified for each ... |
java | public void setIndexAttachments(java.util.Collection<IndexAttachment> indexAttachments) {
if (indexAttachments == null) {
this.indexAttachments = null;
return;
}
this.indexAttachments = new java.util.ArrayList<IndexAttachment>(indexAttachments);
} |
java | public static Interval evensFromTo(int from, int to)
{
if (from % 2 != 0)
{
if (from < to)
{
from++;
}
else
{
from--;
}
}
if (to % 2 != 0)
{
if (to > from)
... |
java | public void perform(TaskRequest req, TaskResponse res) {
HttpServletResponse sres = (HttpServletResponse) response.evaluate(req, res);
String headerName = (String) header_name.evaluate(req, res);
String headerValue = (String) header_value.evaluate(req, res);
// Send the header
sres.addHeader(headerName, h... |
python | def assert_inbounds(num, low, high, msg='', eq=False, verbose=not util_arg.QUIET):
r"""
Args:
num (scalar):
low (scalar):
high (scalar):
msg (str):
"""
from utool import util_str
if util_arg.NO_ASSERTS:
return
passed = util_alg.inbounds(num, low, high, eq=... |
java | public void setVertexArray(VertexArray vertexArray) {
if (vertexArray == null) {
throw new IllegalArgumentException("Vertex array cannot be null");
}
vertexArray.checkCreated();
this.vertexArray = vertexArray;
} |
java | private static String format(@Nullable final Class<?> expectedType, @Nullable final Class<?> actualType) {
final String expected = expectedType != null ? expectedType.getName() : NO_TYPE_PLACEHOLDER;
final String actual = actualType != null ? actualType.getName() : NO_TYPE_PLACEHOLDER;
return String.format(MESSAG... |
java | public Color get(TextColor.ANSI color, boolean isForeground, boolean useBrightTones) {
if(useBrightTones) {
switch(color) {
case BLACK:
return brightBlack;
case BLUE:
return brightBlue;
case CYAN:
... |
java | @Nonnull
public String stripJvmRoute( @Nonnull final String sessionId ) {
final int idxDot = sessionId.indexOf( '.' );
return idxDot < 0 ? sessionId : sessionId.substring( 0, idxDot );
} |
python | def validate_key(self, key):
""" Called if the key_name class attribute is not None. """
if not key:
name = self.__class__.__name__
msg = "%s response missing %s" % (name, self.key_name)
raise ValidationException(msg, self)
elif not isinstance(key, str):
... |
python | def parse_lheading(self, m):
"""Parse setext heading."""
level = 1 if m.group(2) == '=' else 2
self.renderer.heading(m.group(1), level=level) |
java | public Rule HtmlBlock() {
return NodeSequence(
FirstOf(HtmlBlockInTags(), HtmlComment(), HtmlBlockSelfClosing()),
push(new HtmlBlockNode(ext(SUPPRESS_HTML_BLOCKS) ? "" : match())),
BlankLine()
);
} |
java | public static String longestCommonSequence(String s1, String s2) {
int start = 0;
int max = 0;
for (int i = 0; i < s1.length(); i++) {
for (int j = 0; j < s2.length(); j++) {
int x = 0;
while (s1.charAt(i + x) == s2.charAt(j + x)) {
... |
python | def getVC(self):
"""
Variance componenrs
"""
_Cr = decompose_GxE(self.full['Cr'])
RV = {}
for key in list(_Cr.keys()):
RV['var_%s' % key] = sp.array([var_CoXX(_Cr[key], self.Xr)])
RV['var_c'] = self.full['var_c']
RV['var_n'] = self.full['var_n... |
python | def dumps(graphs, triples=False, cls=PENMANCodec, **kwargs):
"""
Serialize each graph in *graphs* to the PENMAN format.
Args:
graphs: an iterable of Graph objects
triples: if True, write graphs as triples instead of as PENMAN
Returns:
the string of serialized graphs
"""
... |
java | @SuppressWarnings("unchecked")
@Override
public EList<IfcRelNests> getNests() {
return (EList<IfcRelNests>) eGet(Ifc4Package.Literals.IFC_OBJECT_DEFINITION__NESTS, true);
} |
java | public IGeoPoint fromPixels(final int pPixelX, final int pPixelY, final GeoPoint pReuse, boolean forceWrap) {
//reverting https://github.com/osmdroid/osmdroid/issues/459
//due to relapse of https://github.com/osmdroid/osmdroid/issues/507
//reverted functionality is now on the method fromPixelsRotationSensitive
... |
python | def calc_qm_v1(self):
"""Calculate the discharge of the main channel after Manning-Strickler.
Required control parameters:
|EKM|
|SKM|
|Gef|
Required flux sequence:
|AM|
|UM|
Calculated flux sequence:
|lstream_fluxes.QM|
Examples:
For appropriate stri... |
python | def iter(self):
"""
Extract DIAMOND records and yield C{ReadAlignments} instances.
@return: A generator that yields C{ReadAlignments} instances.
"""
# Note that self._reader is already initialized (in __init__) for
# the first input file. This is less clean than it could... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.