language stringclasses 2
values | func_code_string stringlengths 63 466k |
|---|---|
python | def search_album(self, album_name, quiet=False, limit=9):
"""Search album by album name.
:params album_name: album name.
:params quiet: automatically select the best one.
:params limit: album count returned by weapi.
:return: a Album object.
"""
result = self.se... |
python | def xpath_evaluator(self, namespaces=None, regexp=False, smart_strings=True):
u"""Creates an XPathEvaluator instance for an ElementTree or an Element.
:returns: ``XPathEvaluator`` instance
"""
return etree.XPathEvaluator(
self._xml,
namespaces=namespaces,
... |
python | def eval_stats(values, mode):
'''Extract a summary statistic from an array of list of values
Parameters:
values: numpy array of values
mode: summary stat to extract. One of ['min', 'max', 'median', 'mean', 'std', 'raw']
Note: fails silently if values is empty, and None is returned
'''
... |
python | def conv2d(self, filter_size, output_channels, stride=1, padding='SAME', bn=True, activation_fn=tf.nn.relu,
b_value=0.0, s_value=1.0, trainable=True):
"""
2D Convolutional Layer.
:param filter_size: int. assumes square filter
:param output_channels: int
:param stri... |
java | public void unitize1() {
for (Datum<SparseArray> row : this) {
double sum = 0.0;
for (SparseArray.Entry e : row.x) {
sum += Math.abs(e.x);
}
for (SparseArray.Entry e : row.x) {
e.x /= sum;
}
}
} |
java | public static void iconComponent(Component component, IconEnum iconEnum)
{
component.add(AttributeModifier.append("class", "ui-icon " + iconEnum.getCssClass()));
} |
python | def devname(self, pcap_name):
"""Return Windows device name for given pcap device name."""
for devname, iface in self.items():
if iface.pcap_name == pcap_name:
return iface.name
raise ValueError("Unknown pypcap network interface %r" % pcap_name) |
java | @Pure
protected static <VALUET> VALUET unmaskNull(VALUET value) {
return (value == NULL_VALUE) ? null : value;
} |
java | public static MozuUrl updateCategoryUrl(Boolean cascadeVisibility, Integer categoryId, String responseFields)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/catalog/admin/categories/{categoryId}?cascadeVisibility={cascadeVisibility}&responseFields={responseFields}");
formatter.formatUrl("cascadeVisi... |
python | def intersectingIntervalIterator(self, start, end):
"""
Get an iterator which will iterate over those objects in the tree which
intersect the given interval - sorted in order of start index
:param start: find intervals in the tree that intersect an interval with
with this start index ... |
python | def v_res(self, nodes=None, level=None):
"""
Get resulting voltage level at node.
Parameters
----------
nodes : :obj:`list`
List of string representatives of grid topology components, e.g.
:class:`~.grid.components.Generator`. If not provided defaults to
... |
java | public void setRecordPatches(java.util.Collection<RecordPatch> recordPatches) {
if (recordPatches == null) {
this.recordPatches = null;
return;
}
this.recordPatches = new com.amazonaws.internal.SdkInternalList<RecordPatch>(recordPatches);
} |
java | public AbstractPolicy parse(InputStream policyStream,
boolean schemaValidate)
throws ValidationException {
// Parse; die if not well-formed
Document doc = null;
DocumentBuilder domParser = null;
try {
domParser = XmlTransformUtilit... |
java | public final void mT__34() throws RecognitionException {
try {
int _type = T__34;
int _channel = DEFAULT_TOKEN_CHANNEL;
// src/riemann/Query.g:26:7: ( 'description' )
// src/riemann/Query.g:26:9: 'description'
{
match("description");
... |
java | private String createForwardCurve(ScheduleInterface swapTenorDefinition, String forwardCurveName) {
/*
* Temporary "hack" - we try to infer index maturity codes from curve name.
*/
String indexMaturityCode = null;
if(forwardCurveName.contains("_12M") || forwardCurveName.contains("-12M") || forwardCurveName... |
python | def cycle_dist(x, y, perimeter):
"""Find Distance between x, y by means of a n-length cycle.
:param x:
:param y:
:param perimeter:
Example:
>>> cycle_dist(1, 23, 24) = 2
>>> cycle_dist(5, 13, 24) = 8
>>> cycle_dist(0.0, 2.4, 1.0) = 0.4
>>> cycle_dist(0.0, 2.6, 1.0)... |
python | def get_source_id(self):
"""Gets the ``Resource Id`` of the source of this asset.
The source is the original owner of the copyright of this asset
and may differ from the creator of this asset. The source for a
published book written by Margaret Mitchell would be Macmillan.
The s... |
python | def to_dict(self, **kwargs):
"""
Serialize the search into the dictionary that will be sent over as the
request'ubq body.
All additional keyword arguments will be included into the dictionary.
"""
d = {}
if self.query:
d["query"] = self.query.to_dict(... |
java | @Override
public void run() {
try {
LOGGER.debug("Attempting to resolve [{}]", this.ipAddress);
val address = InetAddress.getByName(this.ipAddress);
set(address.getCanonicalHostName());
} catch (final UnknownHostException e) {
/* N/A -- Default to IP a... |
java | public static Properties filteredSystemProperties(final Properties existing, final boolean withMaven) {
final Properties properties = new Properties();
System.getProperties().stringPropertyNames().forEach(key -> {
if (key.startsWith("jboss.") ||
key.startsWith("swarm.") ... |
python | def _piecewise_learning_rate(step, boundaries, values):
"""Scale learning rate according to the given schedule.
Multipliers are not cumulative.
Args:
step: global step
boundaries: List of steps to transition on.
values: Multiplier to apply at each boundary transition.
Returns:
Scaled value fo... |
java | private static String createRowSeperator(List<Integer> maxColumnSizes) {
StringBuilder rowSeparator = new StringBuilder("+");
for (int maxColumnSize : maxColumnSizes) {
rowSeparator.append(Strings.repeat("-", maxColumnSize + 2)).append("+");
}
return rowSeparator.append("\n").toString();
} |
python | def _publish(self, obj):
'''
Publish the OC object.
'''
bin_obj = umsgpack.packb(obj)
self.pub.send(bin_obj) |
python | def routeAnswer(self, originalSender, originalTarget, value, messageID):
"""
Route an incoming answer to a message originally sent by this queue.
"""
def txn():
qm = self._messageFromSender(originalSender, messageID)
if qm is None:
return
... |
python | def get_lightcurve_from_file(file, *args, use_cols=None, skiprows=0,
verbosity=None,
**kwargs):
"""get_lightcurve_from_file(file, *args, use_cols=None, skiprows=0, **kwargs)
Fits a light curve to the data contained in *file* using
:func:`get_lightcu... |
python | def SSL_CTX_set_info_callback(ctx, app_info_cb):
"""
Set the info callback
:param callback: The Python callback to use
:return: None
"""
def py_info_callback(ssl, where, ret):
try:
app_info_cb(SSL(ssl), where, ret)
except:
pass
return
global ... |
python | def register_standard (id, source_types, target_types, requirements = []):
""" Creates new instance of the 'generator' class and registers it.
Returns the creates instance.
Rationale: the instance is returned so that it's possible to first register
a generator and then call 'run' method on t... |
java | String getResourceName() {
if (!resourceNameKnown) {
// The resource name of a classfile can only be determined by
// reading
// the file and parsing the constant pool.
// If we can't do this for some reason, then we just
// make the resource name equa... |
java | @Nullable
public IMicroContainer unescapeXHTMLFragment (@Nullable final String sXHTML)
{
// Ensure that the content is surrounded by a single tag
final IMicroDocument aDoc = parseXHTMLFragment (sXHTML);
if (aDoc != null && aDoc.getDocumentElement () != null)
{
// Find "body" case insensitive
... |
java | private MessageProcessorSearchResults matchMessage(MessageItem msg)
throws SIDiscriminatorSyntaxException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(
tc,
"matchMessage",
... |
java | public Observable<ServiceResponse<Page<AnalysisDefinitionInner>>> listSiteAnalysesSlotSinglePageAsync(final String resourceGroupName, final String siteName, final String diagnosticCategory, final String slot) {
if (resourceGroupName == null) {
throw new IllegalArgumentException("Parameter resourceGr... |
java | @Override
public StartWorkspacesResult startWorkspaces(StartWorkspacesRequest request) {
request = beforeClientExecution(request);
return executeStartWorkspaces(request);
} |
python | def _resolve_to_field_class(self, names, scope):
"""Resolve the names to a class in fields.py, resolving past
typedefs, etc
:names: TODO
:scope: TODO
:ctxt: TODO
:returns: TODO
"""
switch = {
"char" : "Char",
"int" : "Int",... |
python | def z2h(text, ignore='', kana=True, ascii=False, digit=False):
"""Convert Full-width (Zenkaku) Katakana to Half-width (Hankaku) Katakana
Parameters
----------
text : str
Full-width Katakana string.
ignore : str
Characters to be ignored in converting.
kana : bool
Either c... |
python | def get_monitor(host=PINBA_SERVER, port=PINBA_PORT, *args, **kwargs):
"""
todo: memory + cpu
"""
kwargs['servername'] = PINBA_SERVER_NAME
kwargs['scriptname'] = __file__
for item in inspect.stack():
if item and __file__ not in item:
kwargs['scriptname'] = item[3]
... |
python | def get(self, request, **kwargs):
""" Handles GET requests. """
forum = self.get_forum()
if forum.is_link:
response = HttpResponseRedirect(forum.link)
else:
response = super(ForumView, self).get(request, **kwargs)
self.send_signal(request, response, forum)... |
java | public void marshall(ListBackupPlansRequest listBackupPlansRequest, ProtocolMarshaller protocolMarshaller) {
if (listBackupPlansRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(listBackupPla... |
java | @Override
protected File[] getReportList() {
File file = new File(reportDirectory);
if (!file.exists())
file = new File(FileReportsProvider.class.getResource(reportDirectory).getFile());
if (!file.exists()) {
errors.add("Couldn't open report directory, doesn't exist.")... |
java | private void addPoint(Point point, Collidable collidable)
{
final Integer group = collidable.getGroup();
if (!collidables.containsKey(group))
{
collidables.put(group, new HashMap<Point, Set<Collidable>>());
}
final Map<Point, Set<Collidable>> elements = collidable... |
python | def _generate_presence_token(self, channel_name):
"""Generate a presence token.
:param str channel_name: Name of the channel to generate a signature for.
:rtype: str
"""
subject = "{}:{}:{}".format(self.connection.socket_id, channel_name, json.dumps(self.user_data))
h = ... |
python | def assert_order_met(self, finalize=False):
"""assert that calls have been made in the right order."""
error = None
actual_call_len = len(self._actual_calls)
expected_call_len = len(self._call_order)
if actual_call_len == 0:
error = "Not enough calls were made"
... |
python | def _replace_bm(self):
"""Replace ``_block_matcher`` with current values."""
self._block_matcher = cv2.StereoBM(preset=self._bm_preset,
ndisparities=self._search_range,
SADWindowSize=self._window_size) |
java | public static String getChannelByChannelId(Long channelId) {
// 根据channelId 构造path
return MessageFormat.format(ArbitrateConstants.NODE_CHANNEL_FORMAT, String.valueOf(channelId));
} |
java | public void marshall(ListTagsOfResourceRequest listTagsOfResourceRequest, ProtocolMarshaller protocolMarshaller) {
if (listTagsOfResourceRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(list... |
java | private BeanDeploymentArchive findCandidateBDAtoAddThisClass(Class<?> beanClass) throws CDIException {
for (WebSphereBeanDeploymentArchive wbda : getWebSphereBeanDeploymentArchives()) {
if (wbda.getClassLoader() == beanClass.getClassLoader()) {
wbda.addToBeanClazzes(beanClass);
... |
java | @Override
public void dumpJPAEntityManagerFactoryState(final Object emf, final PrintWriter out) {
dumpECLJPAEntityManagerFactoryState(emf, out);
try {
// Dump Collected Info About Session Objects
out.println();
out.println("Session Objects (" + sessionDiagMap.siz... |
python | def create_record_mx(self, zone_id, record, data, ttl=60, priority=10):
"""Create a mx resource record on a domain.
:param integer id: the zone's ID
:param record: the name of the record to add
:param data: the record's value
:param integer ttl: the TTL or time-to-live value (de... |
python | def terminate(self):
'''Stop the server process and change our state to TERMINATING. Only valid if state=READY.'''
logger.debug('client.terminate() called (state=%s)', self.strstate)
if self.state == ClientState.WAITING_FOR_RESULT:
raise ClientStateError('terimate() called while stat... |
java | public void marshall(User user, ProtocolMarshaller protocolMarshaller) {
if (user == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(user.getId(), ID_BINDING);
protocolMarshaller.marshall(... |
python | def _start_server(bindaddr, port, hostname, folder):
"""Starts an asyncio server"""
import asyncio
from .httpserver import HttpProtocol
loop = asyncio.get_event_loop()
coroutine = loop.create_server(lambda: HttpProtocol(hostname, folder),
bindaddr,
... |
java | @Override
public <U extends Throwable> Try<U, A> biMapL(Function<? super T, ? extends U> fn) {
return (Try<U, A>) BoundedBifunctor.super.<U>biMapL(fn);
} |
java | public org.tensorflow.distruntime.ClusterDef getCluster() {
return cluster_ == null ? org.tensorflow.distruntime.ClusterDef.getDefaultInstance() : cluster_;
} |
java | public static CellConstraints rchw(int row, int col, int rowSpan, int colSpan,
String encodedAlignments) {
return new CellConstraints().rchw(row, col, rowSpan, colSpan, encodedAlignments);
} |
java | private JBossConvergedSipMetaData mergeSipMetaDataAndSipAnnMetaData(final DeploymentUnit deploymentUnit) {
final WarMetaData warMetaData = deploymentUnit.getAttachment(WarMetaData.ATTACHMENT_KEY);
SipMetaData sipMetaData = deploymentUnit.getAttachment(SipMetaData.ATTACHMENT_KEY);
SipAnnotationMetaD... |
python | def save_matches(self, matches):
"""Save matches of a failed execution to the log.
:param matches: a list of matches in JSON format
"""
if not os.path.exists(os.path.dirname(self.location())):
os.makedirs(os.path.dirname(self.location()))
with open(self.location(), ... |
python | def list():
"""
List available format.
"""
choice_len = max(map(len, _input_choices.keys()))
tmpl = " {:<%d}: {}\n" % choice_len
text = ''.join(map(
lambda k_v: tmpl.format(k_v[0], k_v[1][0]), six.iteritems(_input_choices)))
click.echo(text) |
java | protected void endNode(int node) throws org.xml.sax.SAXException
{
super.endNode(node);
if(DTM.ELEMENT_NODE == m_dtm.getNodeType(node))
{
m_transformer.getXPathContext().popCurrentNode();
}
} |
python | def compute_affinity_matrix(self, copy=False, **kwargs):
"""
This function will compute the affinity matrix. In order to
acquire the existing affinity matrix use self.affinity_matrix as
comptute_affinity_matrix() will re-compute the affinity matrix.
Parameters
----------... |
python | def save_cursor(self):
"""Push the current cursor position onto the stack."""
self.savepoints.append(Savepoint(copy.copy(self.cursor),
self.g0_charset,
self.g1_charset,
self.charset... |
python | def get_iuse(cp):
'''
.. versionadded:: 2015.8.0
Gets the current IUSE flags from the tree.
@type: cpv: string
@param cpv: cat/pkg
@rtype list
@returns [] or the list of IUSE flags
'''
cpv = _get_cpv(cp)
try:
# aux_get might return dupes, so run them through set() to re... |
python | def register(self, settings_class=NoSwitcher, *simple_checks,
**conditions):
"""
Register a settings class with the switcher. Can be passed the settings
class to register or be used as a decorator.
:param settings_class: The class to register with the provided
... |
python | def window_to_offset(self, win_x, win_y):
"""Reverse of :meth:`offset_to_window`."""
arr_pts = np.asarray((win_x, win_y)).T
return self.tform['cartesian_to_native'].from_(arr_pts).T[:2] |
python | def get_data_by_slug(model, slug, kind='', **kwargs):
"""Get instance data by slug and kind. Raise 404 Not Found if there is no data.
This function requires model has a `slug` column.
:param model: a string, model name in rio.models
:param slug: a string used to query by `slug`. This requires there is... |
python | def loads(s, encode_nominal=False, return_type=DENSE):
'''Convert a string instance containing the ARFF document into a Python
object.
:param s: a string object.
:param encode_nominal: boolean, if True perform a label encoding
while reading the .arff file.
:param return_type: determines the... |
java | public final static Object deidentifyObject(Object object, DeIdentify deidentify) {
if (object == null || deidentify == null) {
return object;
}
return DeIdentifyUtil.deidentify(String.valueOf(object),
deidentify.left(), deidentify.right(),
deidentify.... |
java | private boolean setState(State newState) {
switch (newState) {
case DEPLOYED:
return changeState(State.DEPLOYING, State.DEPLOYED);
case DEPLOYING:
//can move from either UNDEPLOYED or FAILED into DEPLOYING state
return (changeState(State.UN... |
java | public String HLSPlayURL(String domain, String hub, String streamKey) {
return String.format("http://%s/%s/%s.m3u8", domain, hub, streamKey);
} |
python | def fetch_mga_scores(mga_vec,
codon_pos,
default_mga=None):
"""Get MGAEntropy scores from pre-computed scores in array.
Parameters
----------
mga_vec : np.array
numpy vector containing MGA Entropy conservation scores for residues
codon_pos: list of ... |
python | def morph_cost(self) -> Optional["Cost"]:
""" This returns 150 minerals for OrbitalCommand instead of 550 """
# Fix for BARRACKSREACTOR which has tech alias [REACTOR] which has (0, 0) cost
if self.tech_alias is None or self.tech_alias[0] in {UnitTypeId.TECHLAB, UnitTypeId.REACTOR}:
r... |
java | private void waitForChannelResubscription(final Map<Integer, ChannelCallbackHandler> oldChannelIdSymbolMap)
throws BitfinexClientException, InterruptedException {
final Stopwatch stopwatch = Stopwatch.createStarted();
final long MAX_WAIT_TIME_IN_MS = TimeUnit.MINUTES.toMillis(3);
logger.info("Waiting for st... |
java | private double[][] solveInplace(double[][] B) {
int mx = B.length;
if(mx != m) {
throw new IllegalArgumentException(ERR_MATRIX_DIMENSIONS);
}
if(!this.isNonsingular()) {
throw new ArithmeticException(ERR_SINGULAR);
}
// Solve L*Y = B(piv,:)
for(int k = 0; k < n; k++) {
fina... |
java | @Override
public void checkRepositoryStatus() throws IOException {
if (!exists(null)) {
throw new FileNotFoundException("Could not find " + _root);
}
if (!hasChildren(null)) {
throw new IOException("The root (" + _root + " is not a directory ");
}
} |
python | def _merge_search_result(self, search_results, _or=False):
"""Merge of filter search results
Params:
<str> | <Sequential> query
<bool> _or
Return:
<list> computed_dids
"""
all_docids = reduce(add, [list(x.keys()) for x in search_results])
... |
java | public static <T> T getInstance(Class<T> beanClass) {
return (T) getInstanceProvider().getInstance(beanClass);
} |
java | public static CollisionFormula createCollision(Xml node)
{
Check.notNull(node);
final String name = node.readString(ATT_NAME);
final CollisionRange range = CollisionRangeConfig.imports(node.getChild(CollisionRangeConfig.NODE_RANGE));
final CollisionFunction function = Collisio... |
python | def getFlags (self, ifname):
"""Get the flags for an interface"""
try:
result = self._ioctl(self.SIOCGIFFLAGS, self._getifreq(ifname))
except IOError as msg:
log.warn(LOG_CHECK,
"error getting flags for interface %r: %s", ifname, msg)
return 0... |
java | public static <G, A, ERR, I extends Iterable<? extends G>> Or<I, Every<ERR>>
combined(Iterable<? extends Or<? extends G, ? extends Every<? extends ERR>>> input,
Collector<? super G, A, I> collector) {
A goods = collector.supplier().get();
Vector<ERR> errs = Vector.empty();
for (Or<? extends G, ... |
python | def _init_kata_dasar(self, dasar):
"""Memproses kata dasar yang ada dalam nama entri.
:param dasar: ResultSet untuk label HTML dengan class="rootword"
:type dasar: ResultSet
"""
for tiap in dasar:
kata = tiap.find('a')
dasar_no = kata.find('sup')
... |
python | def is_parseable (self):
"""Check if content is parseable for recursion.
@return: True if content is parseable
@rtype: bool
"""
if self.is_directory():
return True
if firefox.has_sqlite and firefox.extension.search(self.url):
return True
i... |
java | static String generatedClassName(TypeElement type, String prefix) {
String name = type.getSimpleName().toString();
while (type.getEnclosingElement() instanceof TypeElement) {
type = (TypeElement) type.getEnclosingElement();
name = type.getSimpleName() + "_" + name;
}
String pkg = TypeSimplif... |
python | def asJSON(self):
""" returns a geometry as JSON """
value = self._json
if value is None:
value = json.dumps(self.asDictionary,
default=_date_handler)
self._json = value
return self._json |
java | private void obtainStyledAttributes(@Nullable final AttributeSet attributeSet) {
TypedArray typedArray =
getContext().obtainStyledAttributes(attributeSet, R.styleable.Spinner);
try {
obtainHint(typedArray);
obtainHintColor(typedArray);
obtainSpinnerSty... |
java | public void replaceChild(Node current, Node with) {
double currentSplit = nodeSplits.get(current);
int index = children.indexOf(current);
children.remove(current);
addChild(with, index, currentSplit);
notifyStateChange();
} |
java | protected void diagnoseMultistepList(
int matchCount,
int lengthToTest,
boolean isGlobal)
{
if (matchCount > 0)
{
System.err.print(
"Found multistep matches: " + matchCount + ", " + lengthToTest + " length");
if (isGlobal)
System.err.println(" (g... |
python | def scheduleNextHeartbeat(self, nextRun):
"""
Schedules the next ping.
:param nextRun: when we should run next.
:param serverURL: the URL to ping.
:return:
"""
import threading
from datetime import datetime
tilNextTime = max(nextRun - datetime.utcn... |
python | def _encrypt_assertion(self, encrypt_cert, sp_entity_id, response,
node_xpath=None):
""" Encryption of assertions.
:param encrypt_cert: Certificate to be used for encryption.
:param sp_entity_id: Entity ID for the calling service provider.
:param response: A s... |
java | public static boolean contains(Iterator<?> iterator, @Nullable Object element) {
return any(iterator, equalTo(element));
} |
python | def read_pid_file(pidfile_path):
"""
Read the PID from the PID file
"""
try:
fin = open(pidfile_path, "r")
except Exception, e:
return None
else:
pid_data = fin.read().strip()
fin.close()
try:
pid = int(pid_data)
return pid
... |
python | def add_bundle(name, scripts=[], files=[], scriptsdir=SCRIPTSDIR, filesdir=FILESDIR):
"""High level, simplified interface for creating a bundle which
takes the bundle name, a list of script file names in a common
scripts directory, and a list of absolute target file paths, of
which the basename is also... |
python | def create_secgroups(self):
"""Create security groups as defined in the configs."""
utils.banner("Creating Security Group")
sgobj = securitygroup.SpinnakerSecurityGroup(
app=self.app, env=self.env, region=self.region, prop_path=self.json_path)
sgobj.create_security_group() |
python | def start(self, segment):
"""Begin transfer for an indicated wal segment."""
if self.closed:
raise UserCritical(msg='attempt to transfer wal after closing',
hint='report a bug')
g = gevent.Greenlet(self.transferer, segment)
g.link(self._comple... |
python | def load(stream, Loader=None):
"""
Parse the first YAML document in a stream
and produce the corresponding Python object.
"""
if Loader is None:
load_warning('load')
Loader = FullLoader
loader = Loader(stream)
try:
return loader.get_single_data()
finally:
... |
java | public static UsageRecord createOnSubscriptionItem(
String subscriptionItem, Map<String, Object> params, RequestOptions options)
throws StripeException {
String url =
String.format(
"%s%s",
Stripe.getApiBase(),
String.format(
"/v1/subscription_... |
java | @SuppressWarnings("unchecked")
public SebListener disable(Class<? extends SebEvent>... events) {
if (events != null) {
enabledEvents = null;
if (disabledEvents == null)
disabledEvents = new HashSet<>();
for (Class<? extends SebEvent> event : events) {
disabledEvents.add(event);
}
}
return thi... |
java | @MemberOrder(sequence = "2")
public NonTenantedEntity create(
@Parameter(maxLength = NonTenantedEntity.MAX_LENGTH_NAME)
@ParameterLayout(named="Name")
final String name) {
final NonTenantedEntity obj = container.newTransientInstance(NonTenantedEntity.class);
obj.s... |
java | @Override
public BufferedImage addBackground(BufferedImage image) {
return getBackground(image.getWidth(), image.getHeight());
} |
java | @SuppressWarnings("unchecked")
public <T extends XPathBuilder> T setCls(final String cls) {
this.cls = cls;
return (T) this;
} |
python | def newest_file(file_iterable):
"""
Returns the name of the newest file given an iterable of file names.
"""
return max(file_iterable, key=lambda fname: os.path.getmtime(fname)) |
java | public void init()
{
JPanel view = new JPanel();
view.setLayout(new BorderLayout());
label = new JLabel(INITIAL_TEXT);
Font font = new Font(Font.SANS_SERIF, Font.BOLD, 32);
label.setFont(font);
view.add(BorderLayout.CENTER, label);
this.getContentPane... |
java | public static void saveEmitter(OutputStream out, ConfigurableEmitter emitter)
throws IOException {
try {
DocumentBuilder builder = DocumentBuilderFactory.newInstance()
.newDocumentBuilder();
Document document = builder.newDocument();
document.appendChild(emitterToElement(document, emitter));
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.