language stringclasses 2
values | func_code_string stringlengths 63 466k |
|---|---|
java | public static boolean createNewFile(String filePath) {
if (!StringUtils.isEmpty(filePath)) {
File file = new File(filePath);
return createNewFile(file);
}
return false;
} |
java | public double evaluateClustering(Database db, Relation<? extends NumberVector> rel, Clustering<?> c) {
List<? extends Cluster<?>> clusters = c.getAllClusters();
NumberVector[] centroids = new NumberVector[clusters.size()];
int ignorednoise = EvaluateSimplifiedSilhouette.centroids(rel, clusters, centroids, n... |
java | public static String getFormat(Object o, int precision) {
if (o instanceof Double || o instanceof Float)
return getFloatFormat(precision);
if (o instanceof Integer || o instanceof Long || o instanceof Short || o instanceof Byte)
return INTEGER_FORMAT;
return STRING_FORMAT;
} |
java | public Iterator<DataPoint> getDataPointIterator()
{
Iterator<DataPoint> iteData = new Iterator<DataPoint>()
{
int cur = 0;
int to = size();
@Override
public boolean hasNext()
{
return cur < to;
}
... |
python | def doc_paragraph(s, indent=0):
'''Takes in a string without wrapping corresponding to a paragraph,
and returns a version of that string wrapped to be at most 80
characters in length on each line.
If indent is given, ensures each line is indented to that number
of spaces.
'''
ret... |
python | def __json_strnum_to_bignum(json_object):
"""
Converts json string numerals to native python bignums.
"""
for key in ('id', 'week', 'in_reply_to_id', 'in_reply_to_account_id', 'logins', 'registrations', 'statuses'):
if (key in json_object and isinstance(json_object[key], six.... |
python | def _validate_boolean(self, input_boolean, path_to_root, object_title=''):
'''
a helper method for validating properties of a boolean
:return: input_boolean
'''
rules_path_to_root = re.sub('\[\d+\]', '[0]', path_to_root)
input_criteria = self.keyMap[rules_path_to_r... |
python | def set_vf0(self, vf):
"""set value for self.vf0 and dae.y[self.vf]"""
self.vf0 = vf
self.system.dae.y[self.vf] = matrix(vf) |
java | @Override
public boolean hasWaveBean(final Class<? extends WaveBean> waveBeanClass) {
if (this.waveBeanMap != null && !this.waveBeanMap.isEmpty()) {
return this.waveBeanMap.containsKey(waveBeanClass);
}
return false;
} |
java | private Container toBitmapIfNeeded() {
int sizeAsRunContainer = RunContainer.serializedSizeInBytes(this.nbrruns);
int sizeAsBitmapContainer = BitmapContainer.serializedSizeInBytes(0);
if (sizeAsBitmapContainer > sizeAsRunContainer) {
return this;
}
return toBitmapContainer();
} |
java | private String getDbInstanceResourceName() {
String userArn = this.identityManagement.getUser().getUser().getArn();
AmazonResourceName userResourceName = AmazonResourceName.fromString(userArn);
AmazonResourceName dbResourceArn = new AmazonResourceName.Builder()
.withService("rds").withRegion(getRegion())
... |
java | public void incrementalRestore(File incrementalBackupFile) throws FileNotFoundException, IOException,
ClassNotFoundException, RepositoryException
{
ObjectInputStream ois = null;
try
{
ois = new ObjectInputStream(PrivilegedFileHelper.fileInputStream(incrementalBackupFile));
... |
java | private boolean await0(long timeoutMillis, boolean interruptable) throws InterruptedException {
long endTime = System.currentTimeMillis() + timeoutMillis;
if (endTime < 0) {
endTime = Long.MAX_VALUE;
}
synchronized (lock) {
if (ready) {
r... |
java | public void writeTo(DataOutput dout) throws IOException {
dout.writeInt(MAGIC);
dout.writeInt(mVersion);
mCp.writeTo(dout);
{
int flags = mModifiers.getBitmask();
if (!mModifiers.isInterface()) {
// Set the ACC_SUPER flag for classes only.
... |
java | @SafeVarargs
public static <E> List<E> of(E... elements) {
Preconditions.checkNotNull(elements, "elements");
return Collections.unmodifiableList(Arrays.asList(elements));
} |
java | protected void checkNotSubPath(String source, String target) {
source = CmsStringUtil.joinPaths("/", source, "/");
target = CmsStringUtil.joinPaths("/", target, "/");
if (target.startsWith(source)) {
throw new CmsIllegalArgumentException(
org.opencms.file.Messages.ge... |
java | @Override
public VirtualConnection write(long numBytes, TCPWriteCompletedCallback userCallback, boolean forceQueue, int timeout) {
return write(numBytes, userCallback, forceQueue, timeout, false);
} |
python | def change_window(self, size_window):
''' Change the region of interest
Args:
size_window (float): Radius of the region of interest (km)
Notes:
Change the attributes ``size_window`` and ``window`` to
correspond to the new region of interest.
'''
... |
python | def compliance_tensor(self):
"""
returns the Voigt-notation compliance tensor,
which is the matrix inverse of the
Voigt-notation elastic tensor
"""
s_voigt = np.linalg.inv(self.voigt)
return ComplianceTensor.from_voigt(s_voigt) |
java | public static Dictionary read(Path location) throws IOException {
final Path metadata = DictionaryMetadata.getExpectedMetadataLocation(location);
try (InputStream fsaStream = Files.newInputStream(location);
InputStream metadataStream = Files.newInputStream(metadata)) {
return read(fsaStream... |
java | public double getFitness(String candidate,
List<? extends String> population)
{
int errors = 0;
for (int i = 0; i < candidate.length(); i++)
{
if (candidate.charAt(i) != targetString.charAt(i))
{
++errors;
}
... |
java | public EList<String> getArrayDimensions()
{
if (arrayDimensions == null)
{
arrayDimensions = new EDataTypeEList<String>(String.class, this, XbasePackage.XTYPE_LITERAL__ARRAY_DIMENSIONS);
}
return arrayDimensions;
} |
python | def add_group(self, group_name, group_client_names):
"""Add a new :class:`ClientGroup` to container groups member.
Add the group named *group_name* with sequence of client names to the
container groups member. From there it will be wrapped appropriately
in the higher-level thread-safe c... |
java | public void setSnapshotCopyGrants(java.util.Collection<SnapshotCopyGrant> snapshotCopyGrants) {
if (snapshotCopyGrants == null) {
this.snapshotCopyGrants = null;
return;
}
this.snapshotCopyGrants = new com.amazonaws.internal.SdkInternalList<SnapshotCopyGrant>(snapshotCop... |
java | public Observable<Page<RegistryInner>> listByResourceGroupAsync(final String resourceGroupName) {
return listByResourceGroupWithServiceResponseAsync(resourceGroupName)
.map(new Func1<ServiceResponse<Page<RegistryInner>>, Page<RegistryInner>>() {
@Override
public Page<... |
java | public static int compare(VersionRegEx v1, VersionRegEx v2) {
// throw NPE to comply with Comparable specification
if (v1 == null) {
throw new NullPointerException("v1 is null");
} else if (v2 == null) {
throw new NullPointerException("v2 is null");
}
retu... |
java | public static void unmap(final MappedByteBuffer buffer)
{
if (null != buffer)
{
try
{
MappingMethods.UNMAP_BUFFER.invoke(null, buffer);
}
catch (final Exception ex)
{
LangUtil.rethrowUnchecked(ex);
... |
java | protected <T extends BasicInclude> T aggregateList(final MessageDigest digest, final Deque<T> elements,
final List<File> skinDirectories, final File outputRoot, final File alternateOutput,
final String extension, final AggregatorCallback<T> callback) throws IOException {
if (null == el... |
java | private void reduceResults(final List<AnalysisResultFuture> results,
final Map<ComponentJob, AnalyzerResult> resultMap,
final List<AnalysisResultReductionException> reductionErrors) {
if (_hasRun.get()) {
// already reduced
return;
}
_has... |
python | def config_read():
"""Read config info from config file."""
config_file = (u"{0}config.ini".format(CONFIG_DIR))
if not os.path.isfile(config_file):
config_make(config_file)
config = configparser.ConfigParser(allow_no_value=True)
try:
config.read(config_file, encoding='utf-8')
exc... |
python | def cancel(self):
"""Unschedule this call
@raise AlreadyCancelled: Raised if this call has already been
unscheduled.
@raise AlreadyCalled: Raised if this call has already been made.
"""
if self.cancelled:
raise error.AlreadyCancelled
elif self.called... |
java | public String toAbsolute(String target) {
if (isNotInitialized()) {
return getMessage(NOT_INITIALIZED);
}
return CmsLinkManager.getAbsoluteUri(target, getController().getCurrentRequest().getElementUri());
} |
java | public final ULocale getLocale(ULocale.Type type) {
return type == ULocale.ACTUAL_LOCALE ?
this.actualLocale : this.validLocale;
} |
java | public static <T> TypeChecker<Queue<? extends T>> tQueue(Class<? extends T> elementType) {
return tQueue(tSimple(elementType));
} |
java | public TrackableJobFuture cancel() {
String jobId = getConfiguration().getJobId();
TrackableJobFuture future = jobTracker.unregisterTrackableJob(jobId);
MapCombineTask mapCombineTask = jobTracker.unregisterMapCombineTask(jobId);
if (mapCombineTask != null) {
mapCombineTask.ca... |
python | def write_image_dataset(group, key, data, h5dtype=None):
"""Write an image to an hdf5 group as a dataset
This convenience function sets all attributes such that the image
can be visualized with HDFView, sets the compression and fletcher32
filters, and sets the chunk size to the image shape.
Parame... |
java | public Observable<ServiceResponse<SkuInfosInner>> listSkusWithServiceResponseAsync() {
if (this.subscriptionId() == null) {
throw new IllegalArgumentException("Parameter this.subscriptionId() is required and cannot be null.");
}
if (this.apiVersion() == null) {
throw new ... |
java | public static int nChooseK(int n, int k) {
k = Math.min(k, n - k);
if (k == 0) {
return 1;
}
int accum = n;
for (int i = 1; i < k; i++) {
accum *= (n - i);
accum /= i;
}
return accum / k;
} |
python | def get_freesurfer_cmap(vis_type):
"""Provides different colormaps for different visualization types."""
if vis_type in ('cortical_volumetric', 'cortical_contour'):
LUT = get_freesurfer_cortical_LUT()
cmap = ListedColormap(LUT)
elif vis_type in ('labels_volumetric', 'labels_contour'... |
python | def StartInterrogationHunt(self):
"""Starts an interrogation hunt on all available clients."""
flow_name = compatibility.GetName(flows_discovery.Interrogate)
flow_args = flows_discovery.InterrogateArgs(lightweight=False)
description = "Interrogate run by cron to keep host info fresh."
if data_store... |
java | @Override
public void parseContent(StructuralNode parent, List<String> lines) {
Ruby runtime = JRubyRuntimeContext.get(parent);
Parser parser = new Parser(runtime, parent, ReaderImpl.createReader(runtime, lines));
StructuralNode nextBlock = parser.nextBlock();
while (nextBlock != nu... |
python | def print_table(table, title='', delim='|', centering='center', col_padding=2,
header=True, headerchar='-'):
"""Print a table from a list of lists representing the rows of a table.
Parameters
----------
table : list
list of lists, e.g. a table with 3 columns and 2 rows could be
... |
python | def distance(self, x, y):
"""
Computes distance measure between vectors x and y. Returns float.
"""
if scipy.sparse.issparse(x):
x = x.toarray().ravel()
y = y.toarray().ravel()
return 1.0 - numpy.dot(x, y) |
java | private static void generateTransaction(Map<String, List<Interaction>> data, FileWriter fw)
throws Exception
{
Map<String, TraceEventStatus> txStatus = new TreeMap<String, TraceEventStatus>();
for (Map.Entry<String, List<Interaction>> entry : data.entrySet())
{
List<TraceEventStatus... |
python | def process_exception(self, request, exception):
"""
Add exception information and fault flag to the
current segment.
"""
if self.in_lambda_ctx:
segment = xray_recorder.current_subsegment()
else:
segment = xray_recorder.current_segment()
se... |
java | public List<Address> getClusterMembers() {
if (currentView != null) {
return Collections.unmodifiableList(currentView);
}
else {
final Address localAddress = getLocalAddress();
if (localAddress == null) {
return Collections.emptyList();
}
else {
final List<Address> list = new ArrayList<Addr... |
java | public static CommerceShippingMethod fetchByG_A_Last(long groupId,
boolean active,
OrderByComparator<CommerceShippingMethod> orderByComparator) {
return getPersistence()
.fetchByG_A_Last(groupId, active, orderByComparator);
} |
python | def __setAddressfilterMode(self, mode):
"""set address filter mode
Returns:
True: successful to set address filter mode.
False: fail to set address filter mode.
"""
print 'call setAddressFilterMode() ' + mode
try:
if re.match('list', mode, re... |
java | @Override
public final String print(final String pNumber, final String pDigSep,
final String pDigGrSep, final Integer pDecPlAfDot) {
return print(pNumber, pDigSep, pDigGrSep, pDecPlAfDot, 3);
} |
python | def open(callback=None, button_callback=None, device=None):
"""
Open a 3D space navigator device. Makes this device the current active device, which enables the module-level read() and close()
calls. For multiple devices, use the read() and close() calls on the returned object instead, and don't use the mod... |
python | def node_pairs(nodes, ways, waynodes, two_way=True):
"""
Create a table of node pairs with the distances between them.
Parameters
----------
nodes : pandas.DataFrame
Must have 'lat' and 'lon' columns.
ways : pandas.DataFrame
Table of way metadata.
waynodes : pandas.DataFrame... |
python | def translate_codons(sequence):
'''Return the translated protein from 'sequence' assuming +1 reading frame
Source - http://adamcoster.com/2011/01/13/python-clean-up-and-translate-nucleotide-sequences/
'''
return ''.join([gencode.get(sequence[3*i:3*i+3],'X') for i in range(len(sequence)//3)]) |
java | public static TraceEvent endDuration(Object... args) {
return new TraceEvent(TraceEventType.DURATION_END, null, null, args);
} |
java | protected boolean writeDatagram (PresentsConnection conn, byte[] data)
{
InetSocketAddress target = conn.getDatagramAddress();
if (target == null) {
log.warning("No address to send datagram", "conn", conn);
return false;
}
_databuf.clear();
_databuf.p... |
python | def make_worksheet_data(headers, worksheet):
"""
Make data from worksheet
"""
data = []
row_idx = 1
while row_idx < worksheet.nrows:
cell_idx = 0
row_dict = {}
while cell_idx < worksheet.ncols:
cell_type = worksheet.cell_type(row_idx, cell_idx)
if ... |
python | def mean(values: Sequence[Union[int, float, None]]) -> Optional[float]:
"""
Returns the mean of a list of numbers.
Args:
values: values to mean, ignoring any values that are ``None``
Returns:
the mean, or ``None`` if :math:`n = 0`
"""
total = 0.0 # starting with "0.0" causes ... |
java | public static boolean isTypeManagedBeanOrDecoratorOrInterceptor(AnnotatedType<?> annotatedType) {
Class<?> javaClass = annotatedType.getJavaClass();
return !javaClass.isEnum() && !Extension.class.isAssignableFrom(javaClass)
&& Reflections.isTopLevelOrStaticNestedClass(javaClass) && !Refl... |
java | private void initNShortPath(Graph inGraph, int nValueKind)
{
graph = inGraph;
N = nValueKind;
// 获取顶点的数目
vertexCount = inGraph.vertexes.length;
fromArray = new CQueue[vertexCount - 1][]; // 不包含起点
weightArray = new double[vertexCount - 1][];
//每个节点的最小堆
... |
python | def update_allowed(self):
"""Determines whether update of given cell is allowed.
Calls allowed action of defined UpdateAction of the Column.
"""
return self.update_action.allowed(self.column.table.request,
self.datum,
... |
python | def getoptS(X, Y, M_E, E):
''' Find Sopt given X, Y
'''
n, r = X.shape
C = np.dot(np.dot(X.T, M_E), Y)
C = C.flatten()
A = np.zeros((r * r, r * r))
for i in range(r):
for j in range(r):
ind = j * r + i
temp = np.dot(
np.dot(X.T, np... |
python | def pairwise(iterable):
"""Pair each element with its neighbors.
Arguments
---------
iterable : iterable
Returns
-------
The generator produces a tuple containing a pairing of each element with
its neighbor.
"""
iterable = iter(iterable)
left = next(iterable)
for right ... |
python | def installUpdate(self):
""" Install the newest version of Plex Media Server. """
# We can add this but dunno how useful this is since it sometimes
# requires user action using a gui.
part = '/updater/apply'
release = self.check_for_update(force=True, download=True)
if re... |
java | public SIMPIterator getLocalSubscriptions() {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "getLocalSubscriptions");
SIMPIterator iterator = null;
try {
iterator = this.getTopicSpace().getLocalSubscriptionIterator();
} catch (SIMPException e) {
FFDCFilter.processExc... |
java | protected T callMethod(IFacebookMethod method, Collection<Pair<String, CharSequence>> paramPairs)
throws FacebookException, IOException {
HashMap<String, CharSequence> params =
new HashMap<String, CharSequence>(2 * method.numTotalParams());
params.put("method", method.methodName());
params.put("a... |
python | def session(self):
"""Provide access to request session with local cache enabled."""
if self._session is None:
self._session = cachecontrol.CacheControl(
requests.Session(),
cache=caches.FileCache('.tvdb_cache'))
return self._session |
java | public static String normalize(String value) {
try {
StringBuilder builder = new StringBuilder();
for (byte b : value.getBytes(DEFAULT_ENCODING)) {
if (URI_UNRESERVED_CHARACTERS.get(b & 0xFF)) {
builder.append((char) b);
} else {
... |
java | public static X509TrustManager chooseTrustManager(TrustManager[] trustManagers) {
for (TrustManager trustManager : trustManagers) {
if (trustManager instanceof X509TrustManager) {
return (X509TrustManager) trustManager;
}
}
return null;
} |
python | def ignore_cec(self):
""" Returns whether the CEC data should be ignored. """
return self.device is not None and \
any([fnmatch.fnmatchcase(self.device.friendly_name, pattern)
for pattern in IGNORE_CEC]) |
java | private Object generateEnumerateObject(final Field field,
final Map<Field, Long> enumerateMap) {
final Long currentEnumerateValue = enumerateMap.get(field);
Object objValue = BasicCastUtils.castToNumber(currentEnumerateValue, field.getType());
// Incre... |
python | def get_opener(self, name):
"""Retrieve an opener for the given protocol
:param name: name of the opener to open
:type name: string
:raises NoOpenerError: if no opener has been registered of that name
"""
if name not in self.registry:
raise NoOpenerError("No... |
python | def _set_doc(self, func):
"""
If no doc was explicitly set, use the function's docstring, trimming
whitespace and replacing newlines with spaces.
"""
if not self.doc and func.__doc__:
self.doc = func.__doc__.strip().replace('\n', ' ') |
java | public void marshall(RebuildWorkspacesRequest rebuildWorkspacesRequest, ProtocolMarshaller protocolMarshaller) {
if (rebuildWorkspacesRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(rebuild... |
python | def _update_fields(self, obj=None, many=False):
"""
Overridden to automatically convert snake-cased field names to
camel-cased (when dumping) and to load camel-cased field names back
to their snake-cased counterparts
"""
fields = super()._update_fields(obj, many)
... |
java | public static base_responses unset(nitro_service client, String acl6name[], String args[]) throws Exception {
base_responses result = null;
if (acl6name != null && acl6name.length > 0) {
nsacl6 unsetresources[] = new nsacl6[acl6name.length];
for (int i=0;i<acl6name.length;i++){
unsetresources[i] = new nsa... |
java | @Property(
domainEvent = MemberNameDomainEvent.class
)
@PropertyLayout(typicalLength=ApplicationFeature.TYPICAL_LENGTH_MEMBER_NAME)
@MemberOrder(name="Id", sequence = "2.4")
public String getMemberName() {
return getFeatureId().getMemberName();
} |
python | def add_key_value(self, key, value):
"""
Converts the value and adds it as a data field.
Args:
key:
value:
"""
if key == 'unique_id':
self._unique_id = str(value)
else:
self._data[key] = value |
python | def execute_pool_txns(self, three_pc_batch) -> List:
"""
Execute a transaction that involves consensus pool management, like
adding a node, client or a steward.
:param ppTime: PrePrepare request time
:param reqs_keys: requests keys to be committed
"""
committed_t... |
python | def set_numeric_score_increment(self, increment):
"""Sets the numeric score increment.
arg: increment (decimal): the numeric score increment
raise: InvalidArgument - ``increment`` is invalid
raise: NoAccess - ``increment`` cannot be modified
*compliance: mandatory -- This m... |
python | def combine_count_files(files, out_file=None, ext=".fpkm"):
"""
combine a set of count files into a single combined file
"""
files = list(files)
if not files:
return None
assert all([file_exists(x) for x in files]), \
"Some count files in %s do not exist." % files
for f in fi... |
python | def delete_lines(self, lines):
"""
Delete all lines with given line numbers.
Args:
lines (list): List of integers corresponding to line numbers to delete
"""
for k, i in enumerate(lines):
del self[i-k] |
java | @Nonnull
private Block _readLines (@Nonnull final Reader aReader) throws IOException
{
final Block aBlock = new Block ();
final StringBuilder aSB = new StringBuilder (80);
int c = aReader.read ();
LinkRef aLastLinkRef = null;
while (c != -1)
{
aSB.setLength (0);
int nPos = 0;
... |
java | public Observable<ServiceResponse<CapabilityInformationInner>> getCapabilityWithServiceResponseAsync(String location) {
if (this.client.subscriptionId() == null) {
throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
}
if (loca... |
java | public OWLSAtomicService buildOWLSServiceFrom(URI serviceURI, List<URI> modelURIs) throws ModelException
{
if (isFile(serviceURI))
{
return buildOWLSServiceFromLocalOrRemoteURI(serviceURI, modelURIs);
} else
{
Service service = OWLSStore.persistentModelAsOWLKB... |
java | public void resetFromXml(String xmlResourcePath) throws JoranException {
LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory();
JoranConfigurator configurator = new JoranConfigurator();
configurator.setContext(context);
context.reset();
configurator.doConfigure(LogbackHelper.clas... |
java | public static <T> SuffixData createWithLCP(T[] input, ISuffixArrayBuilder builder, Comparator<? super T> comparator) {
final GenericArrayAdapter adapter = new GenericArrayAdapter(builder, comparator);
final int[] sa = adapter.buildSuffixArray(input);
final int[] lcp = computeLCP(adapter.input, 0... |
python | def reload(self):
"""
Suspend a node
"""
try:
yield from self.post("/reload", timeout=240)
except asyncio.TimeoutError:
raise aiohttp.web.HTTPRequestTimeout(text="Timeout when reloading {}".format(self._name)) |
python | def get_fields(Model,
parent_field="",
model_stack=None,
stack_limit=2,
excludes=['permissions', 'comment', 'content_type']):
"""
Given a Model, return a list of lists of strings with important stuff:
...
['test_user__user__customuser', 'custo... |
python | def read_certificate(certificate):
'''
Returns a dict containing details of a certificate. Input can be a PEM
string or file path.
certificate:
The certificate to be read. Can be a path to a certificate file, or
a string containing the PEM formatted text of the certificate.
CLI Exa... |
java | @Override
public String visit(final JmesPathSubExpression subExpression, final Void aVoid)
throws InvalidTypeException {
final String prefix = "new JmesPathSubExpression( ";
return subExpression.getExpressions().stream()
.map(a -> a.accept(this, aVoid))
.c... |
java | protected MultiList<FormItem> multipartFormItems(String encoding) {
if (!context.isRequestMultiPart())
throw new MediaTypeException("this is not a multipart request, be sure to add this attribute to the form: ... enctype=\"multipart/form-data\" ...");
MultiList<FormItem> parts = new MultiL... |
java | public CmsCroppingParamBean getRestrictedSizeParam(int maxHeight, int maxWidth) {
CmsCroppingParamBean result = new CmsCroppingParamBean(this);
if ((getTargetHeight() <= maxHeight) && (getTargetWidth() <= maxWidth)) {
if ((getTargetHeight() == I_CmsFormatRestriction.DIMENSION_NOT_SET) && (g... |
java | protected String normalizePath(BeanWrapper wrapper, String path) {
return initializePath(wrapper, new RelaxedDataBinder.BeanPath(path), 0);
} |
java | public List<ConfigPath> findAllByType(final Class<?> type) {
return paths.stream()
// do not allow search for all booleans or integers (completely meaningless)
.filter(it -> it.isCustomType() && type.isAssignableFrom(it.getDeclaredType()))
.collect(Collectors.toLi... |
java | @Generated(value = "com.ibm.jtc.jax.tools.xjc.Driver", date = "2014-06-11T05:49:00-04:00", comments = "JAXB RI v2.2.3-11/28/2011 06:21 AM(foreman)-")
public List<ExceptionClassFilter.Exclude> getExcludeList() {
if (excludeList == null) {
excludeList = new ArrayList<ExceptionClassFilter.Exclude>(... |
python | def rdf_source(self, aformat="turtle"):
"""
Serialize graph using the format required
"""
if aformat and aformat not in self.SUPPORTED_FORMATS:
return "Sorry. Allowed formats are %s" % str(self.SUPPORTED_FORMATS)
if aformat == "dot":
return self.__serializedDot()
else:
# use stardard rdf serializat... |
python | def _validate_fasta_vs_seqres(self):
'''Check that the FASTA and SEQRES sequences agree (they sometimes differ)'''
pdb_id = self.pdb_id
for chain_id, sequence in self.pdb.seqres_sequences.iteritems():
if str(sequence) != self.FASTA[pdb_id][chain_id]:
if self.pdb_id in... |
java | @StompService(destination = "/destination-2")
public String destination2(final String body) throws IOException {
final String now = new SimpleDateFormat("HH:mm:ss").format(new Date());
return String.format("%s - value '%s' returned from method mapped to /destination-2", now, body);
} |
python | def sync(self, recursive=False):
"""
Syncs the information from this item to the tree and view.
"""
self.syncTree(recursive=recursive)
self.syncView(recursive=recursive) |
java | public void changeLock(CmsRequestContext context, CmsResource resource) throws CmsException {
CmsDbContext dbc = m_dbContextFactory.getDbContext(context);
checkOfflineProject(dbc);
try {
m_driverManager.changeLock(dbc, resource, CmsLockType.EXCLUSIVE);
} catch (Exception e) ... |
java | public Environment setUp( AbstractBuild build, Launcher launcher, BuildListener listener ) throws IOException, InterruptedException {
if (build instanceof Build)
return setUp((Build)build,launcher,listener);
else
throw new AssertionError("The plugin '" + this.getClass().getName()... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.