language stringclasses 2
values | func_code_string stringlengths 63 466k |
|---|---|
python | def getElementText(self, node, preserve_ws=None):
"""Return the text value of an xml element node. Leading and trailing
whitespace is stripped from the value unless the preserve_ws flag
is passed with a true value."""
result = []
for child in node.childNodes:
no... |
java | public static void mergeTiff(List<IIOImage> imageList, File outputTiff, String compressionType) throws IOException {
if (imageList == null || imageList.isEmpty()) {
// if no image
return;
}
Iterator<ImageWriter> writers = ImageIO.getImageWritersByFormatName(TIFF_FORMAT);... |
python | def jsonresolver_loader(url_map):
"""Resolve the OpenAIRE grant."""
from flask import current_app
url_map.add(Rule(
'/grants/10.13039/<path:doi_grant_code>',
endpoint=resolve_grant_endpoint,
host=current_app.config['OPENAIRE_JSONRESOLVER_GRANTS_HOST'])) |
python | def getMaxTimeAllowed(self):
"""Returns the maximum turnaround time for this analysis. If no TAT is
set for this particular analysis, it returns the value set at setup
return: a dictionary with the keys "days", "hours" and "minutes"
"""
tat = self.Schema().getField("MaxTimeAllowe... |
java | public Map<String, Long> resetRetryCounter() {
Map<String, Long> result = retryCounter.asMap();
retryCounter.clear();
return result;
} |
java | private void calculateGauklerStrickler( double q, double[] level, List<RiverPoint> sectionsList ) {
double toll, conta_cicli;
double IF, max_tir, tir_dx, tir_sx, tir_med, val_dx, val_sx, val_med;
double[][] idrgeo;
/* create a complete list to proceed with the next elaborations */
... |
java | public ResourceChange withScope(ResourceAttribute... scope) {
java.util.ArrayList<String> scopeCopy = new java.util.ArrayList<String>(scope.length);
for (ResourceAttribute value : scope) {
scopeCopy.add(value.toString());
}
if (getScope() == null) {
setScope(scope... |
java | public OnPremConfig withAgentArns(String... agentArns) {
if (this.agentArns == null) {
setAgentArns(new java.util.ArrayList<String>(agentArns.length));
}
for (String ele : agentArns) {
this.agentArns.add(ele);
}
return this;
} |
java | private String getRelatedIDs(SmallMoleculeReference smr)
{
String ids = smr.getUri();
for (Object o : new PathAccessor(
"SmallMoleculeReference/entityReferenceOf").getValueFromBean(smr))
{
SimplePhysicalEntity spe = (SimplePhysicalEntity) o;
ids += "\n" + spe.getUri();
}
return ids;
} |
java | public static CommerceAccount[] filterFindByU_T_PrevAndNext(
long commerceAccountId, long userId, int type,
OrderByComparator<CommerceAccount> orderByComparator)
throws com.liferay.commerce.account.exception.NoSuchAccountException {
return getPersistence()
.filterFindByU_T_PrevAndNext(commerceAccountId, ... |
python | def maybe_send_signal(self, signum, include_pgrp=True):
"""Send the signal `signum` send if the PID and/or PGRP chunks have been received.
No error is raised if the pid or pgrp are None or point to an already-dead process.
"""
remote_pid = self._maybe_last_pid()
if remote_pid is not None:
saf... |
java | @Override
public Configuration configuration() {
return new MostUsefulConfiguration()
// where to find the stories
.useStoryLoader(new LoadFromClasspath(this.getClass()))
// CONSOLE and TXT reporting
.useStoryReporterBuilder(new StoryReporterBuilder().withDe... |
java | public Object getCachedObject(CmsObject cms, String rootPath) {
String key = getCacheKeyForCurrentProject(cms, rootPath);
return OpenCms.getMemoryMonitor().getCachedVfsObject(key);
} |
python | def getStatus(rh):
"""
Get the power (logon/off) status of a virtual machine.
Input:
Request Handle with the following properties:
function - 'POWERVM'
subfunction - 'STATUS'
userid - userid of the virtual machine
Output:
Request Handle updated with ... |
python | def float(self, rule, **kwargs):
"""
Implementation of :py:func:`pynspect.traversers.RuleTreeTraverser.float` interface.
"""
rule.value = float(rule.value)
return rule |
python | def _complete_options(self):
"""Find available completion options."""
text = to_text_string(self.currentText())
opts = glob.glob(text + "*")
opts = sorted([opt for opt in opts if osp.isdir(opt)])
self.setCompleter(QCompleter(opts, self))
return opts |
java | @UiThread
public List<Fill> create(@NonNull String json) {
return create(FeatureCollection.fromJson(json));
} |
java | public DescribeVpcPeeringConnectionsRequest withVpcPeeringConnectionIds(String... vpcPeeringConnectionIds) {
if (this.vpcPeeringConnectionIds == null) {
setVpcPeeringConnectionIds(new com.amazonaws.internal.SdkInternalList<String>(vpcPeeringConnectionIds.length));
}
for (String ele :... |
java | public void marshall(ClusterStateChangeReason clusterStateChangeReason, ProtocolMarshaller protocolMarshaller) {
if (clusterStateChangeReason == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(cluster... |
java | public CheckUsersSavedTracksRequest.Builder checkUsersSavedTracks(String... ids) {
return new CheckUsersSavedTracksRequest.Builder(accessToken)
.setDefaults(httpManager, scheme, host, port)
.ids(concat(ids, ','));
} |
java | public NumberExpression<Integer> numGeometries() {
if (numGeometries == null) {
numGeometries = Expressions.numberOperation(Integer.class, SpatialOps.NUM_GEOMETRIES, mixin);
}
return numGeometries;
} |
java | public static int encode(Integer value, byte[] dst, int dstOffset) {
if (value == null) {
dst[dstOffset] = NULL_BYTE_HIGH;
return 1;
} else {
dst[dstOffset] = NOT_NULL_BYTE_HIGH;
encode(value.intValue(), dst, dstOffset + 1);
return 5;
... |
java | public static Boolean readBoolean(String value, Boolean defaultValue) {
if (!StringUtils.hasText(value)) return defaultValue;
return Boolean.valueOf(value);
} |
python | def _onerror(self, result):
""" To execute on execution failure
:param kser.result.Result result: Execution result
:return: Execution result
:rtype: kser.result.Result
"""
if KSER_METRICS_ENABLED == "yes":
KSER_TASKS_STATUS.labels(
__hostname_... |
python | def wkid(self, value):
""" sets the wkid """
if isinstance(value, (int,
long)):
self._wkid = value |
python | def convertstr2format(col,form):
"""
Convert input string to input regex (`form`).
:param col: input string.
:param form: eg. for hdf5: `"^[a-zA-Z_][a-zA-Z0-9_]*$"`
"""
if not isstrallowed(col,form):
col=col.replace(" ","_")
if not isstrallowed(col,form):
chars_... |
python | def add_followers(self, project, params={}, **options):
"""Adds the specified list of users as followers to the project. Followers are a subset of members, therefore if
the users are not already members of the project they will also become members as a result of this operation.
Returns the upda... |
python | def get_unit(a):
"""Extract the time unit from array's dtype"""
typestr = a.dtype.str
i = typestr.find('[')
if i == -1:
raise TypeError("Expected a datetime64 array, not %s", a.dtype)
return typestr[i + 1: -1] |
java | private static Scanner setupAllTreeScanner(final TSDB tsdb) {
final byte[] start = new byte[TREE_ID_WIDTH];
final byte[] end = new byte[TREE_ID_WIDTH];
Arrays.fill(end, (byte)0xFF);
final Scanner scanner = tsdb.getClient().newScanner(tsdb.treeTable());
scanner.setStartKey(start);
scanner.se... |
java | public void connectEndToEnd(SGraphSegment segment) {
if (segment.getGraph() != getGraph()) {
throw new IllegalArgumentException();
}
final SGraphPoint point = new SGraphPoint(getGraph());
setEnd(point);
segment.setEnd(point);
final SGraph g = getGraph();
assert g != null;
g.updatePointCount(-1);
} |
java | public static int countByC_C_T(long CPDefinitionId, long CProductId,
String type) {
return getPersistence().countByC_C_T(CPDefinitionId, CProductId, type);
} |
java | public String getXmlEditorInitCalls() throws JspException {
StringBuffer result = new StringBuffer(512);
try {
// iterate over unique widgets from collector
Iterator<I_CmsWidget> i = getWidgetCollector().getUniqueWidgets().iterator();
while (i.hasNext()) {
... |
java | private Marshaller createNewMarshaller() throws JAXBException,
PropertyException {
final Marshaller marshaller = ctxt.createMarshaller();
marshaller.setProperty(JAXB_ENCODING, UTF_8);
marshaller.setProperty(JAXB_FORMATTED_OUTPUT, true);
marshaller.setProperty(JAXB_SCHEMA_LOCA... |
python | def assign_taxonomy(
data, min_confidence=0.80, output_fp=None, training_data_fp=None,
fixrank=True, max_memory=None, tmp_dir=tempfile.gettempdir()):
"""Assign taxonomy to each sequence in data with the RDP classifier
data: open fasta file object or list of fasta lines
confidence: m... |
java | void checkout(File project, String branch) {
try {
String currentBranch = currentBranch(project);
if (currentBranch.equals(branch)) {
log.info("Won't check out the same branch. Skipping");
return;
}
log.info("Checking out branch [" + branch + "]");
checkoutBranch(project, branch);
log.info("... |
python | def _Process(self, request, responses, thread_pool=None, events=None):
"""Hunts process all responses concurrently in a threadpool."""
# This function is called and runs within the main processing thread. We do
# not need to lock the hunt object while running in this method.
if request.next_state == "Ad... |
java | public String fixFilePath(String strSource, char charSeparator)
{
String strDest = "";
for (int i = 0; i < strSource.length(); i++)
{
if (strSource.charAt(i) == '/')
strDest += charSeparator;
else
strDest += strSource.charAt(i);
}
... |
java | private void paintDiscrete(Graphics2D g, JComponent c, int width, int height) {
boolean useToolBarColors = isInToolBar(c);
Shape s;
if (isFocused) {
s = shapeGenerator.createSliderThumbDiscrete(0, 0, width, height, CornerSize.SLIDER_OUTER_FOCUS);
g.setPaint(get... |
java | public void apply(double[] target)
{
//use DoubleList view b/d we are only using set ops, so we wont run into an issue of re-allocating the array
apply(DoubleList.view(target, target.length), new DoubleList(target.length));
} |
java | public String getCacheName(boolean online, String rootPath, String parameters) {
String rfsName = CmsFileUtil.getRepositoryName(m_rfsRepository, rootPath, online);
if (CmsStringUtil.isNotEmpty(parameters)) {
String extension = CmsFileUtil.getExtension(rfsName);
// build the RFS ... |
python | def get_config_file(override_files=False):
"""
Looks for the most specific configuration file available. An override
can be provided as a string if needed.
"""
if override_files:
if isinstance(override_files, six.string_types):
possible_configs = [override_files]
else:
... |
java | public boolean hasProperty (@Nonnull final String sProperty)
{
ValueEnforcer.notNull (sProperty, "Property");
return m_sProperty.equals (_unifyProperty (sProperty));
} |
python | def class_register(cls):
"""Class decorator that allows to map LSP method names to class methods."""
cls.handler_registry = {}
for method_name in dir(cls):
method = getattr(cls, method_name)
if hasattr(method, '_handle'):
cls.handler_registry.update({method._handle: method_name})... |
python | def parse_transdos(path_dir, efermi, dos_spin=1, trim_dos=False):
"""
Parses .transdos (total DOS) and .transdos_x_y (partial DOS) files
Args:
path_dir: (str) dir containing DOS files
efermi: (float) Fermi energy
dos_spin: (int) -1 for spin down, +1 for spin ... |
java | public URL getRedirectURL(FacesContext context) throws MalformedURLException {
ExternalContext extContext = context.getExternalContext();
return new URL(extContext.getRequestScheme(),
extContext.getRequestServerName(),
extContext.getRequestServerPort(),
... |
java | @Override
public double d(double[] x, double[] y) {
if (x.length != y.length)
throw new IllegalArgumentException(String.format("Arrays have different length: x[%d], y[%d]", x.length, y.length));
return 1 - Math.cor(x, y);
} |
python | def template_to_dict_alt(tree, title):
"""
Returns parse tree template as {<title>: <parts>}
This is a more general parse tree infobox template parser.
"""
box = []
part = []
for item in tree.iter():
if item.tag == 'part':
if part:
box.append(part)
... |
python | def create_timer(cb: Callable[[float], None], interval: float,
delay_policy: TimerDelayPolicy = TimerDelayPolicy.DEFAULT,
loop: Optional[asyncio.BaseEventLoop] = None) -> asyncio.Task:
'''
Schedule a timer with the given callable and the interval in seconds.
The interval va... |
java | public void deployArtifact( RemoteRepository repository,
AFReleaseId releaseId,
InternalKieModule kieModule,
File pomfile ) {
File jarFile = bytesToFile( releaseId, kieModule.getBytes(), ".jar" );
deployArtif... |
java | public void busReloaded(JsMEConfig newBus, boolean busChanged,
boolean destChg, boolean medChg) {
if (TraceComponent.isAnyTracingEnabled()
&& tc.isEntryEnabled())
SibTr.exit(tc, "busReloaded");
} |
python | def play_human(env):
"""
Play the environment using keyboard as a human.
Args:
env (gym.Env): the initialized gym environment to play
Returns:
None
"""
# play the game and catch a potential keyboard interrupt
try:
play(env, fps=env.metadata['video.frames_per_second... |
java | private void addStringStatistics(long valueCount, StringStatistics value)
{
requireNonNull(value, "value is null");
checkArgument(valueCount > 0, "valueCount is 0");
checkArgument(value.getMin() != null || value.getMax() != null, "min and max cannot both be null");
if (nonNullValueC... |
python | def get_netid_subscriptions(netid, subscription_codes):
"""
Returns a list of uwnetid.subscription objects
corresponding to the netid and subscription code or list provided
"""
url = _netid_subscription_url(netid, subscription_codes)
response = get_resource(url)
return _json_to_subscriptions... |
java | @SuppressWarnings("unchecked")
@Override
public EList<Long> getRelatingPriorities() {
return (EList<Long>) eGet(Ifc4Package.Literals.IFC_REL_CONNECTS_PATH_ELEMENTS__RELATING_PRIORITIES, true);
} |
java | public void setLineDistanceWidth(int lineDistanceWidth) {
if (divLine.isAttached()) {
divLine.setWidth(lineDistanceWidth + "px");
} else {
divLine.addAttachHandler(event -> divLine.setWidth(lineDistanceWidth + "px"));
}
} |
java | @Override
public void write(byte []buf, int offset, int length, boolean isEnd)
throws IOException
{
if (_os == null) {
if (_s == null) {
return;
}
_os = _s.getOutputStream();
}
try {
_needsFlush = true;
_os.write(buf, offset, length);
_totalWri... |
python | async def get_record(self, *,
chat: typing.Union[str, int, None] = None,
user: typing.Union[str, int, None] = None) -> typing.Dict:
"""
Get record from storage
:param chat:
:param user:
:return:
"""
chat, user = s... |
java | @Nullable
private XTextViewCursor getViewCursor(XComponentContext xContext) {
try {
XComponent xCurrentComponent = OfficeTools.getCurrentComponent(xContext);
if (xCurrentComponent == null) {
return null;
}
XModel xModel = UnoRuntime.queryInterface(XModel.class, xCurrentComponent);
... |
java | protected static int binarySearchGuessUnsafe(@NotNull final BasePage page, @NotNull final ByteIterable key) {
int index = page.binarySearch(key);
if (index < 0) {
index = -index - 2;
}
return index;
} |
java | public static boolean registerFlymePush(Context context, String flymeId, String flymeKey, String profile) {
if (null == context) {
printErrorLog("register error, context is null!");
return false;
}
boolean result = false;
if (!com.meizu.cloud.pushsdk.util.MzSystemUtils.isBrandMeizu(context))... |
java | public static Deferred<Long> incrementAndGetCounter(final TSDB tsdb,
final byte[] tsuid) {
/**
* Callback that will create a new TSMeta if the increment result is 1 or
* will simply return the new value.
*/
final class TSMetaCB implements Callback<Deferred<Long>, Long> {
/**
... |
python | def _set_access_list(self, v, load=False):
"""
Setter method for access_list, mapped from YANG variable /arp/access_list (list)
If this variable is read-only (config: false) in the
source YANG file, then _set_access_list is considered as a private
method. Backends looking to populate this variable s... |
java | public static @CheckForNull
Type getType(String signature) {
try {
// ensure signature only has one type
final Iterator<String> signatureIterator = new GenericSignatureParser("(" + signature + ")V")
.parameterSignatureIterator();
signature = signatureI... |
java | public static MozuUrl addAccountNoteUrl(Integer accountId, String responseFields)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/customer/accounts/{accountId}/notes?responseFields={responseFields}");
formatter.formatUrl("accountId", accountId);
formatter.formatUrl("responseFields", responseFields... |
java | public Note getNoteFirstExtendedLineLow() {
if (m_lowNote == null) {
//A 7th (label=6) for 5 lines,
//A 5th (label=4) for 3 lines,
//A 3rd (label=2) for 1 line
byte label = (byte) (getStaffLines() + 1);
Interval interv = new Interval(label,
label==5?Interval.PERFECT:Interval.MAJOR,
Inte... |
python | def check_node_vectorisable(node):
"""
Check that a node can be casted to a vectorial node, in order to be able to use fancy indexing.
"""
MESSAGE_PART_1 = "Cannot use fancy indexing on parameter node '{}', as"
MESSAGE_PART_3 = "To use fancy indexing on parameter node, its ch... |
java | @Override
public final void configureThresholdEvaluatorBuilder(final ThresholdsEvaluatorBuilder thrb, final ICommandLine cl) throws BadThresholdException {
if (cl.hasOption("th")) {
super.configureThresholdEvaluatorBuilder(thrb, cl);
} else {
thrb.withLegacyThreshold("time", ... |
java | public int getTileSetID (String tileSetName)
throws PersistenceException
{
Integer tsid = _map.get(tileSetName);
if (tsid == null) {
tsid = Integer.valueOf(++_nextTileSetID);
_map.put(tileSetName, tsid);
}
return tsid.intValue();
} |
java | public String getSourceFile() {
if ( sourceFile == null )
if ( parent != null )
return ((SimpleNode)parent).getSourceFile();
else
return "<unknown file>";
else
return sourceFile;
} |
python | def get_goea_nts_prt(self, fldnames=None, **usr_kws):
"""Return list of namedtuples removing fields which are redundant or verbose."""
kws = usr_kws.copy()
if 'not_fldnames' not in kws:
kws['not_fldnames'] = ['goterm', 'parents', 'children', 'id']
if 'rpt_fmt' not in kws:
... |
python | def set_pipeline(self, pipeline):
"""
Specify the pipeline. See get_pipeline_alternatives to see what are avaialble. Input should be a string.
"""
self.add_history(inspect.stack()[0][3], locals(), 1)
if not os.path.exists(self.BIDS_dir + '/derivatives/' + pipeline):
p... |
python | def union(lst1, lst2):
'''
Returns the union of two lists.
.. code-block:: jinja
{% my_list = [1,2,3,4] -%}
{{ set my_list | union([2, 4, 6]) }}
will be rendered as:
.. code-block:: text
[1, 2, 3, 4, 6]
'''
if isinstance(lst1, collections.Hashable) and isinstance... |
java | private void initLocalFSM() {
this.localFSM = new FSM(this.name + "_LOCAL");
// Define states
this.localFSM.createState(AsState.DOWN.toString()).setOnEnter(new SEHLocalAsStateEnterDown(this));
this.localFSM.createState(AsState.ACTIVE.toString()).setOnEnter(new SEHLocalAsStateEnterActive... |
python | def _wait(self, duration, steps, commands):
""" Compute wait time.
:param duration: Total time (in seconds).
:param steps: Number of steps.
:param commands: Number of commands.
:returns: Wait in seconds.
"""
wait = ((duration - self.wait * self.reps * commands) /... |
java | public static SSLHandlerFactory createRestServerSSLEngineFactory(final Configuration config) throws Exception {
SSLContext sslContext = createRestServerSSLContext(config);
if (sslContext == null) {
throw new IllegalConfigurationException("SSL is not enabled for REST endpoints.");
}
return new SSLHandlerFact... |
python | def stream_to_packet(data):
"""
Chop a stream of data into MODBUS packets.
:param data: stream of data
:returns: a tuple of the data that is a packet with the remaining
data, or ``None``
"""
if len(data) < 6:
return None
# unpack the length
pktlen = struct.unpack(">H", ... |
python | def save(self, name, content, max_length=None):
"""
Saves the given content with the given name using the local
storage. If the :attr:`~queued_storage.backends.QueuedStorage.delayed`
attribute is ``True`` this will automatically call the
:meth:`~queued_storage.backends.QueuedStor... |
python | def create(
name,
attributes=None,
region=None,
key=None,
keyid=None,
profile=None,
):
'''
Create an SQS queue.
CLI Example:
.. code-block:: bash
salt myminion boto_sqs.create myqueue region=us-east-1
'''
conn = _get_conn(region=region, key=key, keyid=keyid, pr... |
python | def find_files(self, ID=None, fileGrp=None, pageId=None, mimetype=None, url=None, local_only=False):
"""
Search ``mets:file`` in this METS document.
Args:
ID (string) : ID of the file
fileGrp (string) : USE of the fileGrp to list files of
pageId (string) : ID... |
python | def to_fs_from_unicode(unic):
"""
Return a byte string version of unic encoded using the file
system encoding.
"""
if is_unicode(unic):
try:
string = unic.encode(FS_ENCODING)
except (UnicodeError, TypeError):
pass
else:
return s... |
python | def fromdicts(dicts, header=None, sample=1000, missing=None):
"""
View a sequence of Python :class:`dict` as a table. E.g.::
>>> import petl as etl
>>> dicts = [{"foo": "a", "bar": 1},
... {"foo": "b", "bar": 2},
... {"foo": "c", "bar": 2}]
>>> table1 =... |
python | def search_genius_web(self, search_term, per_page=5):
"""Use the web-version of Genius search"""
endpoint = "search/multi?"
params = {'per_page': per_page, 'q': search_term}
# This endpoint is not part of the API, requires different formatting
url = "https://genius.com/api/" + e... |
python | def viewers(self):
"""Legacy access to viewer role.
DEPRECATED: use ``policy["roles/viewers"]`` instead
"""
result = set()
for role in self._VIEWER_ROLES:
for member in self._bindings.get(role, ()):
result.add(member)
return frozenset(result) |
python | def editMonitor(self, monitorID, monitorStatus=None, monitorFriendlyName=None, monitorURL=None, monitorType=None,
monitorSubType=None, monitorPort=None, monitorKeywordType=None, monitorKeywordValue=None,
monitorHTTPUsername=None, monitorHTTPPassword=None, monitorAlertContacts=Non... |
java | @Override
public Map<ArchivePath, Node> getContent() {
Map<ArchivePath, Node> ret = new LinkedHashMap<ArchivePath, Node>();
for (Map.Entry<ArchivePath, NodeImpl> item : content.entrySet()) {
if (!item.getKey().equals(new BasicPath("/"))) {
ret.put(item.getKey(), item.getV... |
python | def expect_file_to_be_valid_json(self, schema=None, result_format=None,
include_config=False, catch_exceptions=None,
meta=None):
"""
schema : string
optional JSON schema file on which JSON data file is validated again... |
java | public static base_response update(nitro_service client, sslfips resource) throws Exception {
sslfips updateresource = new sslfips();
updateresource.inithsm = resource.inithsm;
updateresource.sopassword = resource.sopassword;
updateresource.oldsopassword = resource.oldsopassword;
updateresource.userpassword =... |
python | def load(self, line):
"""Load this keyword from a file-like object"""
words = line.split()
try:
float(words[0])
self.__name = ""
self.__value = " ".join(words)
except ValueError:
self.__name = words[0].upper()
if len(words) > 2 ... |
java | public void registerAndRunReleaser(Runnable willCallRelease, CompletableFuture<T> toNotify) {
boolean run = false;
boolean complete = false;
T result = null;
Throwable e = null;
synchronized (lock) {
if (released) {
complete = true;
res... |
python | def cm_json_to_graph(im_json):
"""Return pygraphviz Agraph from Kappy's contact map JSON.
Parameters
----------
im_json : dict
A JSON dict which contains a contact map generated by Kappy.
Returns
-------
graph : pygraphviz.Agraph
A graph representing the contact map.
""... |
java | private static String findJarServiceProviderName(String factoryId)
{
SecuritySupport ss = SecuritySupport.getInstance();
String serviceId = SERVICES_PATH + factoryId;
InputStream is = null;
// First try the Context ClassLoader
ClassLoader cl = findClassLoader();
is ... |
python | def addDependency(self, item):
"""
Creates a dependency for this item to the next item. This item will
be treated as the source, the other as the target.
:param item | <QGanttWidgetItem>
"""
if item in self._dependencies:
return
... |
python | def items(self):
"""Return the set of items from the ResultSet.
:return: List of tuples, (key, generator)
"""
items = []
for series in self._get_series():
series_key = (series.get('measurement',
series.get('name', 'results')),
... |
java | public void run( String input, String output )
{
Report report = null;
try
{
report = reportGenerator.openReport( output );
monitor.testRunning( input );
final Timer total = new Timer().start();
documentRepository.setSpecificationDialect(dialect);
... |
java | private static final void readExceptionFromParcel(Parcel reply, String msg, int code) {
switch (code) {
case 2:
throw new IllegalArgumentException(msg);
case 3:
throw new UnsupportedOperationException(msg);
case 4:
throw new SQL... |
python | def on_moved(self, event):
"""
A move event is just proxied to an on_deleted call followed by
an on_created call.
"""
self.on_deleted(events.FileDeletedEvent(event.src_path))
self.on_created(events.FileCreatedEvent(event.dest_path)) |
python | def _BacktraceFromFramePtr(self, frame_ptr):
"""Assembles and returns what looks exactly like python's backtraces."""
# expects frame_ptr to be a gdb.Value
frame_objs = [PyFrameObjectPtr(frame) for frame
in self._IterateChainedList(frame_ptr, 'f_back')]
# We want to output tracebacks ... |
java | private String createNonSequential(String path, byte[] data, List<ACL> acl, CreateMode createMode)
throws KeeperException, InterruptedException {
RetryCounter retryCounter = retryCounterFactory.create();
while (true) {
try {
return zk.create(path, data, acl, createMode);
} catch (Keepe... |
java | private String getAction(String check, double waitFor) {
String action = "";
if (waitFor > 0) {
action = "Waiting up to " + waitFor + " seconds " + check;
}
return action;
} |
python | def get_driver(secret_key=config.DEFAULT_SECRET_KEY, userid=config.DEFAULT_USERID,
provider=config.DEFAULT_PROVIDER):
"""A driver represents successful authentication. They become
stale, so obtain them as late as possible, and don't cache them."""
if hasattr(config, 'get_driver'):
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.