language stringclasses 2
values | func_code_string stringlengths 63 466k |
|---|---|
java | public final boolean matchEncoding(final EnhancedMimeType other) {
return match(other) && Objects.equals(getEncoding(), other.getEncoding());
} |
java | @Deprecated
public void kill(Map<String, String> modelEnvVars) throws InterruptedException {
kill(null,modelEnvVars);
} |
java | private void mergeReservoirInto(final ReservoirItemsSketch<T> reservoir) {
final long reservoirN = reservoir.getN();
if (reservoirN == 0) {
return;
}
n_ += reservoirN;
final int reservoirK = reservoir.getK();
if (reservoir.getN() <= reservoirK) {
// exact mode, so just insert and b... |
python | def load_items(self, items):
"""Loads any number of items in chunks, handling continuation tokens.
:param items: Unpacked in chunks into "RequestItems" for :func:`boto3.DynamoDB.Client.batch_get_item`.
"""
loaded_items = {}
requests = collections.deque(create_batch_get_chunks(it... |
java | public JSONStringer value(Object value) throws JSONException {
if (this.stack.isEmpty()) {
throw new JSONException("Nesting problem");
}
if (value instanceof JSONArray) {
((JSONArray) value).writeTo(this);
return this;
}
else if (value instanceof JSONObject) {
((JSONObject) value).writeTo(this);... |
java | private int encode(int x, int y, int r) {
int mask = (1 << r) - 1;
int hodd = 0;
int heven = x ^ y;
int notx = ~x & mask;
int noty = ~y & mask;
int temp = notx ^ y;
int v0 = 0, v1 = 0;
for (int k = 1; k < r; k++) {
v1 = ((v1 & heven) | ((v0 ^... |
java | public String getNewSessionIdIfNodeFromSessionIdUnavailable( @Nonnull final String sessionId ) {
if ( isEncodeNodeIdInSessionId() ) {
final String nodeId = _sessionIdFormat.extractMemcachedId( sessionId );
final String newNodeId = _nodeIdService.getNewNodeIdIfUnavailable( nodeId );
if ( new... |
java | public String print() throws IOException {
final ByteArrayOutputStream baos = new ByteArrayOutputStream();
this.print(baos);
return new Utf8String(baos.toByteArray()).asString();
} |
java | protected void finishAdding()
{
noMoreAdding = true;
workSpace = null;
storageSpace = null;
wordCounts = null;
final int[] frqs = new int[dimensionSize];
for(int i = 0; i < termDocumentFrequencys.length(); i++)
frqs[i] = termDocumentFrequ... |
python | def add_dict_to_cookiejar(cj, cookie_dict):
"""Returns a CookieJar from a key/value dictionary.
:param cj: CookieJar to insert cookies into.
:param cookie_dict: Dict of key/values to insert into CookieJar.
"""
cj2 = cookiejar_from_dict(cookie_dict)
cj.update(cj2)
return cj |
java | private void handleNullRead() throws IOException {
if (curStreamFinished && readNullAfterStreamFinished) {
// If we read a null operation after the NameNode closed
// the stream, then we surely reached the end of the file.
curStreamConsumed = true;
} else {
try {
// This affects ... |
python | def key_func(*keys, **kwargs):
"""Creates a "key function" based on given keys.
Resulting function will perform lookup using specified keys, in order,
on the object passed to it as an argument.
For example, ``key_func('a', 'b')(foo)`` is equivalent to ``foo['a']['b']``.
:param keys: Lookup keys
... |
java | private Object toReference(int type, Object referent, int hash)
{
switch (type)
{
case HARD:
return referent;
case SOFT:
return new SoftRef(hash, referent, queue);
case WEAK:
return new WeakRef(hash, referen... |
java | private static int permParity(final ILigand[] ligands) {
// count the number of swaps made by insertion sort - if duplicates
// are fount the parity is 0
int swaps = 0;
for (int j = 1, hi = ligands.length; j < hi; j++) {
ILigand ligand = ligands[j];
int i = j - ... |
java | private Expression compileUnary(UnaryOperation unary, int opPos)
throws TransformerException
{
int rightPos = getFirstChildPos(opPos);
unary.setRight(compile(rightPos));
return unary;
} |
python | def read(self, b=-1):
"""Keep reading from source stream until either the source stream is done
or the requested number of bytes have been obtained.
:param int b: number of bytes to read
:return: All bytes read from wrapped stream
:rtype: bytes
"""
remaining_byte... |
java | private void addBrokenLinkAdditionalInfo(CmsObject cms, CmsResource resource, CmsBrokenLinkBean result) {
String dateLastModifiedLabel = org.opencms.workplace.commons.Messages.get().getBundle(
OpenCms.getWorkplaceManager().getWorkplaceLocale(cms)).key(
org.opencms.workplace.commons.... |
java | public List<Option> getSelectedItems() {
final List<Option> items = new ArrayList<>(0);
for (Entry<OptionElement, Option> entry : itemMap.entrySet()) {
Option opt = entry.getValue();
if (opt.isSelected())
items.add(opt);
}
return items;
} |
python | def open_(filename, mode=None, compresslevel=9):
"""Switch for both open() and gzip.open().
Determines if the file is normal or gzipped by looking at the file
extension.
The filename argument is required; mode defaults to 'rb' for gzip and 'r'
for normal and compresslevel defaults to 9 for gzip.
... |
python | def find_doi(self, curr_dict):
"""
Recursively search the file for the DOI id. More taxing, but more flexible when dictionary structuring isn't absolute
:param dict curr_dict: Current dictionary being searched
:return dict bool: Recursive - Current dictionary, False flag that DOI was not... |
python | def add_inputs_from_inputstring(self, input_string):
"""
Add inputs using the input string format:
gitroot==~/workspace
username
password?
main_branch==comp_main
"""
raw_params = input_string.split('\n')
param_attributes = (self._parse_param_line(... |
python | def set_default_unit(self, twig=None, unit=None, **kwargs):
"""
TODO: add documentation
"""
if twig is not None and unit is None:
# then try to support value as the first argument if no matches with twigs
if isinstance(unit, u.Unit) or not isinstance(twig, str):
... |
python | def post(self, url, data, charset=CHARSET_UTF8, headers={}):
'''response json text'''
if 'Api-Lang' not in headers:
headers['Api-Lang'] = 'python'
if 'Content-Type' not in headers:
headers['Content-Type'] = "application/x-www-form-urlencoded;charset=" + charset
rs... |
python | def runtime_to_build(runtime_deps):
"""Adds all runtime deps to build deps"""
build_deps = copy.deepcopy(runtime_deps)
for dep in build_deps:
if len(dep) > 0:
dep[0] = 'BuildRequires'
return build_deps |
java | @Override
public void cacheResult(
List<CommerceShippingFixedOptionRel> commerceShippingFixedOptionRels) {
for (CommerceShippingFixedOptionRel commerceShippingFixedOptionRel : commerceShippingFixedOptionRels) {
if (entityCache.getResult(
CommerceShippingFixedOptionRelModelImpl.ENTITY_CACHE_ENABLED,
... |
java | public String getStack()
{
StringBuffer sb =
new StringBuffer("fr.esrf.TangoApi.WrongNameSyntax:\n");
for (int i=0 ; i<errors.length ; i++)
{
sb.append("Severity -> ");
switch (errors[i].severity.value())
{
case ErrSeverity._WARN :
sb.append("WARNING \n");
break;
case ErrSeverity._ERR ... |
python | def drop_all(self, queue_name):
"""
Drops all the task in the queue.
:param queue_name: The name of the queue. Usually handled by the
``Gator`` instance.
:type queue_name: string
"""
task_ids = self.conn.lrange(queue_name, 0, -1)
for task_id in task_... |
python | def gzipped(fn):
"""
Decorator used to pack data returned from the Bottle function to GZIP.
The decorator adds GZIP compression only if the browser accepts GZIP in
it's ``Accept-Encoding`` headers. In that case, also the correct
``Content-Encoding`` is used.
"""
def gzipped_wrapper(*args, *... |
java | public void setRoot(int context, Object environment)
{
m_context = context;
XPathContext xctxt = (XPathContext)environment;
m_execContext = xctxt;
m_cdtm = xctxt.getDTM(context);
m_currentContextNode = context; // only if top level?
// Yech, shouldn't have to do this. -sb
... |
java | @Override
public void deserializeInstance(SerializationStreamReader streamReader, EntityType instance) throws SerializationException {
deserialize(streamReader, instance);
} |
java | @Override
public DescribeConstraintResult describeConstraint(DescribeConstraintRequest request) {
request = beforeClientExecution(request);
return executeDescribeConstraint(request);
} |
java | public static void main(String[] args) {
Object[] a1 = new Object[]{"a", "b"};
Object[] a2 = new Object[]{"a", "b"};
System.out.println(a1.equals(a2));
GeneralizedCounter<String> gc = new GeneralizedCounter<String>(3);
gc.incrementCount(Arrays.asList(new String[]{"a", "j", "x"}), 3.0);
... |
java | public final void mWS() throws RecognitionException {
try {
int _type = WS;
int _channel = DEFAULT_TOKEN_CHANNEL;
// druidG.g:669:2: ( ( ' ' | '\\t' | NEWLINE )+ )
// druidG.g:669:4: ( ' ' | '\\t' | NEWLINE )+
{
// druidG.g:669:4: ( ' ' | '\\t' | NEWLINE )+
int cnt37=0;
loop37:
while (true)... |
python | def assign_order(self):
"""
The goal is to assign scaffold orders. To help order the scaffolds, two
dummy node, START and END, mark the ends of the chromosome. We connect
START to each scaffold (directed), and each scaffold to END.
"""
linkage_groups = self.linkage_groups... |
java | private PatternConstant create(Constant constant) {
if (!constants.containsKey(constant)) {
constants.put(
constant,
new PatternConstant(constant.getValue(), constant.isIgnoreCase(), constant.isGhost())
);
}
return constants.get(con... |
python | def draw_material(material, face=GL_FRONT_AND_BACK):
"""Draw a single material"""
if material.gl_floats is None:
material.gl_floats = (GLfloat * len(material.vertices))(*material.vertices)
material.triangle_count = len(material.vertices) / material.vertex_size
vertex_format = VERTEX_FORMATS... |
python | def cli(ctx, debug, config, path, cache):
"""
\U0001F98A Inspect and search through the complexity of your source code.
To get started, run setup:
$ wily setup
To reindex any changes in your source code:
$ wily build <src>
Then explore basic metrics with:
$ wily report <file>... |
python | def mkdir_chown(paths, user_group=None, permissions='ug=rwX,o=rX', create_parent=True, check_if_exists=False, recursive=False):
"""
Generates a unix command line for creating a directory and assigning permissions to it. Shortcut to a combination of
:func:`~mkdir`, :func:`~chown`, and :func:`~chmod`.
No... |
python | def tags(self, extra_params=None):
""""
All Tags in this Space
"""
return self.api._get_json(
Tag,
space=self,
rel_path=self._build_rel_path('tags'),
extra_params=extra_params,
) |
python | def generate_pagination(total_page_num, current_page_num):
"""
>>> PAGE_SIZE = 10
>>> generate_pagination(total_page_num=9, current_page_num=1)
{'start': 1, 'end': 9, 'current': 1}
>>> generate_pagination(total_page_num=20, current_page_num=12)
{'start': 8, 'end': 17, 'current': 12}
>>> gene... |
python | def by_name(self, name, archived=False, limit=None, page=None):
""" return a project by it's name.
this only works with the exact name of the project.
"""
# this only works with the exact name
return super(Projects, self).by_name(name, archived=archived,
... |
python | def sinus_values_by_hz(framerate, hz, max_value):
"""
Create sinus values with the given framerate and Hz.
Note:
We skip the first zero-crossing, so the values can be used directy in a loop.
>>> values = sinus_values_by_hz(22050, 1200, 255)
>>> len(values) # 22050 / 1200Hz = 18,375
18
>... |
python | def _set_interface_te_ospf_conf(self, v, load=False):
"""
Setter method for interface_te_ospf_conf, mapped from YANG variable /interface/tengigabitethernet/ip/interface_te_ospf_conf (container)
If this variable is read-only (config: false) in the
source YANG file, then _set_interface_te_ospf_conf is con... |
python | def write_service_double_file(target_root, service_name, rendered):
"""Render syntactically valid python service double code."""
target_path = os.path.join(
target_root,
'snapstore_schemas', 'service_doubles', '%s.py' % service_name
)
with open(target_path, 'w') as target_file:
t... |
python | def cut_across_axis(self, dim, minval=None, maxval=None):
'''
Cut the mesh by a plane, discarding vertices that lie behind that
plane. Or cut the mesh by two parallel planes, discarding vertices
that lie outside them.
The region to keep is defined by an axis of perpendicularity,... |
java | public static String fileTypeAsString( int fileType ) {
String result;
switch( fileType ) {
case AGGREGATOR:
result = "aggregator";
break;
case GRAPH:
result = "graph";
break;
case INSTANCE:
result = "intsnace";
break;
case UNDETERMINED:
result = "undetermined";
break;
default... |
java | @Override
public WireFeed parse(final Document document, final boolean validate, final Locale locale) throws IllegalArgumentException, FeedException {
Opml opml;
opml = (Opml) super.parse(document, validate, locale);
final Element head = document.getRootElement().getChild("head");
... |
python | def serializer(self, create=False, many=False):
"""
Decorator to mark a :class:`Serializer` subclass for a specific purpose, ie,
to be used during object creation **or** for serializing lists of objects.
:param create: Whether or not this serializer is for object creation.
:para... |
java | @Override
public Set<URI> listOptionalParts(URI messageContent) {
if (messageContent == null) {
return ImmutableSet.of();
}
return ImmutableSet.copyOf(this.messageOptionalPartsMap.get(messageContent));
} |
python | def put_readme(self, content):
"""Store the readme descriptive metadata."""
logger.debug("Putting readme")
key = self.get_readme_key()
self.put_text(key, content) |
python | def filter_dict(iterable, keys):
"""
filters keys of each element of iterable
$.(a,b) returns all objects from array that have at least one of the keys:
[1,"aa",{"a":2,"c":3},{"c":3},{"a":1,"b":2}].(a,b) -> [{"a":2},{"a":1,"b":2}]
"""
if type(keys) is not list:
keys = [keys]
for i in iterable:
try:
... |
python | def plot2d(self, color='default', alpha=1, ret=True):
"""
Generates a 2D plot for the z=0 Polygon projection.
:param color: Polygon color.
:type color: matplotlib color
:param alpha: Opacity.
:type alpha: float
:param ret: If True, returns the fig... |
java | @SuppressWarnings("unchecked")
public static <S> Problem<S> loadProblem(String problemName) {
Problem<S> problem ;
try {
problem = (Problem<S>)Class.forName(problemName).getConstructor().newInstance() ;
} catch (InstantiationException e) {
throw new JMetalException("newInstance() cannot instan... |
java | protected static String replaceShorthand(char c, Map<String, String> headers,
TimeZone timeZone, boolean needRounding, int unit, int roundDown,
boolean useLocalTimestamp, long ts) {
String timestampHeader = null;
try {
if (!useLocalTimestamp) {
timestampHeader = headers.get("timestamp... |
java | public static RaidInfo getFileRaidInfo(final FileStatus stat,
Configuration conf, boolean skipHarChecking)
throws IOException {
// now look for the parity file
ParityFilePair ppair = null;
for (Codec c : Codec.getCodecs()) {
ppair = ParityFilePair.getParityFile(c, stat, conf, skipHarCheckin... |
python | def get_hash(path, form='sha256', chunk_size=65536):
'''
Get the hash sum of a file
This is better than ``get_sum`` for the following reasons:
- It does not read the entire file into memory.
- It does not return a string on error. The returned value of
``get_sum`` cannot really ... |
python | def send_bcm(bcm_socket, data):
"""
Send raw frame to a BCM socket and handle errors.
"""
try:
return bcm_socket.send(data)
except OSError as e:
base = "Couldn't send CAN BCM frame. OS Error {}: {}\n".format(e.errno, e.strerror)
if e.errno == errno.EINVAL:
raise ... |
java | public com.google.api.ads.admanager.axis.v201805.PricingMethod getPricingMethod() {
return pricingMethod;
} |
python | def cluster_get_keys_in_slots(self, slot, count, *, encoding):
"""Return local key names in the specified hash slot."""
return self.execute(b'CLUSTER', b'GETKEYSINSLOT', slot, count,
encoding=encoding) |
java | public static Pattern createFilePattern(String filePattern) {
filePattern = StringUtils.isNullOrBlank(filePattern) ? "\\*" : filePattern;
filePattern = filePattern.replaceAll("\\.", "\\.");
filePattern = filePattern.replaceAll("\\*", ".*");
return Pattern.compile("^" + filePattern + "$");
} |
java | @Override
public Object call(Context cx, Scriptable scope, Scriptable thisObj,
Object[] args)
{
Object result;
boolean checkMethodResult = false;
int argsLength = args.length;
for (int i = 0; i < argsLength; i++) {
// flatten cons-strings befor... |
python | def read_file(filename):
"""
Reads the lines of a file into a list, and returns the list
:param filename: String - path and name of the file
:return: List - lines within the file
"""
lines = []
with open(filename) as f:
for line in f:
i... |
java | public boolean isExceptionMatched(AnalyzedToken token) {
if (exceptionSet) {
for (PatternToken testException : exceptionList) {
if (!testException.exceptionValidNext) {
if (testException.isMatched(token)) {
return true;
}
}
}
}
return false;
} |
python | def coord_pyramid(coord, zoom_start, zoom_stop):
"""
generate full pyramid for coord
Generate the full pyramid for a single coordinate. Note that zoom_stop is
exclusive.
"""
if zoom_start <= coord.zoom:
yield coord
for child_coord in coord_children_range(coord, zoom_stop):
i... |
java | public static Pair<AbstractTopology, Set<Integer>> mutateRemoveHosts(AbstractTopology currentTopology,
Set<Integer> removalHosts) {
Set<Integer> removalPartitionIds = getPartitionIdsForHosts(currentTopology, removalHosts);
return ... |
python | def substitute(template, mapping=None):
"""
Render the template *template*. *mapping* is a :class:`dict` with
values to add to the template.
"""
if mapping is None:
mapping = {}
templ = Template(template)
return templ.substitute(mapping) |
python | def push(src, dest):
"""
Push object from host to target
:param src: string path to source object on host
:param dest: string destination path on target
:return: result of _exec_command() execution
"""
adb_full_cmd = [v.ADB_COMMAND_PREFIX, v.ADB_COMMAND_PUSH, src, dest]
return _exec_comm... |
java | public void error(final CellField<T> cellField) {
ArgUtils.notNull(cellField, "cellField");
error(cellField, getMessageKey(), getMessageVariables(cellField));
} |
python | def _api_scrape(json_inp, ndx):
"""
Internal method to streamline the getting of data from the json
Args:
json_inp (json): json input from our caller
ndx (int): index where the data is located in the api
Returns:
If pandas is present:
DataFrame (pandas.DataFrame): d... |
java | public SortedSet<TypeElement> implementingClasses(TypeElement typeElement) {
SortedSet<TypeElement> result = get(implementingClasses, typeElement);
SortedSet<TypeElement> intfcs = allSubClasses(typeElement, false);
// If class x implements a subinterface of typeElement, then it follows
... |
python | def block2(self, value):
"""
Set the Block2 option.
:param value: the Block2 value
"""
option = Option()
option.number = defines.OptionRegistry.BLOCK2.number
num, m, size = value
if size > 512:
szx = 6
elif 256 < size <= 512:
... |
java | @Deprecated
public StreamVariantsRequest getStreamVariantsRequest(String variantSetId) {
return StreamVariantsRequest.newBuilder()
.setVariantSetId(variantSetId)
.setReferenceName(referenceName)
.setStart(start)
.setEnd(end)
.build();
} |
java | @Override
public List<MonitorLine> getLastLine(Integer count) throws Exception {
String line;
final List<MonitorLine> result = new ArrayList<MonitorLine>();
BufferedReader in = null;
try {
in = new BufferedReader(new FileReader(getFilename()));
int i = 0;
... |
java | public static double calculateSlope( GridNode node, double flowValue ) {
double value = doubleNovalue;
if (!isNovalue(flowValue)) {
int flowDir = (int) flowValue;
if (flowDir != 10) {
Direction direction = Direction.forFlow(flowDir);
double distanc... |
java | public boolean isExistingIndex(String index) throws IOException {
logger.debug("is existing index [{}]", index);
try {
Response restResponse = lowLevelClient.performRequest("GET", "/" + index);
logger.trace("get index metadata response: {}", asMap(restResponse));
retu... |
java | @Override
public void execute(final Object context, int uiTaskId, final Object... args) {
Activity activity = ContextUtils.asActivity(context);
Set<Method> methods = MethodUtils.getAllMethods(context, UI.class);
for (final Method method : methods) {
final UI uiTask = method.getAnnotation(UI.class... |
java | public void marshall(ListTagsRequest listTagsRequest, ProtocolMarshaller protocolMarshaller) {
if (listTagsRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(listTagsRequest.getResource(), RES... |
java | public void setAssessmentTargetArns(java.util.Collection<String> assessmentTargetArns) {
if (assessmentTargetArns == null) {
this.assessmentTargetArns = null;
return;
}
this.assessmentTargetArns = new java.util.ArrayList<String>(assessmentTargetArns);
} |
java | public static File download(String url, File toDir) throws AlipayApiException {
toDir.mkdirs();
HttpURLConnection conn = null;
OutputStream output = null;
File file = null;
try {
conn = getConnection(new URL(url));
String ctype = conn.getContentType();
if (CTYPE_OCTET.equals(ctype)) {
String file... |
java | @SuppressWarnings({ "rawtypes", "unchecked" })
protected String getCommonSuperClass(final String type1, final String type2)
{
Class c, d;
try {
c = Class.forName(type1.replace('/', '.'));
d = Class.forName(type2.replace('/', '.'));
} catch (Exception e) {
th... |
java | public boolean isToBeDeleted()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
{
SibTr.entry(tc, "isToBeDeleted");
SibTr.exit(tc, "isToBeDeleted", Boolean.valueOf(toBeDeleted));
}
return toBeDeleted;
} |
java | public MutableIntSet asSet(List<T> list, MutableIntSet setToAppend)
{
asSet(list, this, setToAppend);
return setToAppend;
} |
java | protected <T> T getInstanceByType(BeanManager manager, Class<T> type, Annotation... bindings) {
final Bean<?> bean = manager.resolve(manager.getBeans(type, bindings));
if (bean == null) {
throw CommonLogger.LOG.unableToResolveBean(type, Arrays.asList(bindings));
}
CreationalC... |
python | def parse_pseudo_class(self, sel, m, has_selector, iselector, is_html):
"""Parse pseudo class."""
complex_pseudo = False
pseudo = util.lower(css_unescape(m.group('name')))
if m.group('open'):
complex_pseudo = True
if complex_pseudo and pseudo in PSEUDO_COMPLEX:
... |
python | def to_array(self):
"""
Serializes this InlineQueryResultCachedAudio to a dictionary.
:return: dictionary representation of this object.
:rtype: dict
"""
array = super(InlineQueryResultCachedAudio, self).to_array()
array['type'] = u(self.type) # py2: type unicod... |
java | public FDistort input( ImageBase input ) {
if( this.input == null || this.input.width != input.width || this.input.height != input.height ) {
distorter = null;
}
this.input = input;
inputType = input.getImageType();
return this;
} |
python | def _to_dict(self):
"""Return a json dictionary representing this model."""
_dict = {}
if hasattr(self, 'id') and self.id is not None:
_dict['id'] = self.id
if hasattr(self, 'status') and self.status is not None:
_dict['status'] = self.status
if hasattr(se... |
python | def color(self, value):
"""
Setter for **self.__color** attribute.
:param value: Attribute value.
:type value: QColor
"""
if value is not None:
assert type(value) is QColor, "'{0}' attribute: '{1}' type is not 'QColor'!".format("color", value)
self._... |
python | def init_bn_weight(layer):
'''initilize batch norm layer weight.
'''
n_filters = layer.num_features
new_weights = [
add_noise(np.ones(n_filters, dtype=np.float32), np.array([0, 1])),
add_noise(np.zeros(n_filters, dtype=np.float32), np.array([0, 1])),
add_noise(np.zeros(n_filters,... |
java | private void createContextMenu() {
// Create menu manager.
MenuManager menuMgr = new MenuManager();
menuMgr.setRemoveAllWhenShown(true);
menuMgr.addMenuListener(new IMenuListener() {
public void menuAboutToShow(IMenuManager mgr) {
fillContextMenu(mgr);
}
});
// Create menu.
... |
python | def _expected_condition_find_first_element(self, elements):
"""Try to find sequentially the elements of the list and return the first element found
:param elements: list of PageElements or element locators as a tuple (locator_type, locator_value) to be found
sequentially
... |
python | def solve(self):
""" Solves a DC power flow.
"""
case = self.case
logger.info("Starting DC power flow [%s]." % case.name)
t0 = time.time()
# Update bus indexes.
self.case.index_buses()
# Find the index of the refence bus.
ref_idx = self._get_refer... |
java | public Observable<ApplicationGatewaySslPredefinedPolicyInner> getSslPredefinedPolicyAsync(String predefinedPolicyName) {
return getSslPredefinedPolicyWithServiceResponseAsync(predefinedPolicyName).map(new Func1<ServiceResponse<ApplicationGatewaySslPredefinedPolicyInner>, ApplicationGatewaySslPredefinedPolicyInn... |
python | def loads(s, encoding=None, cls=None, object_hook=None, parse_float=None,
parse_int=None, parse_constant=None, object_pairs_hook=None,
use_decimal=False, **kw):
"""Deserialize ``s`` (a ``str`` or ``unicode`` instance containing a JSON
document) to a Python object.
*encoding* determines the ... |
python | def get_root_path():
"""Get the root directory for the application."""
return os.path.realpath(os.path.join(os.path.dirname(__file__), os.pardir)) |
java | public void move(String srcAbsPath, String destAbsPath) throws ItemExistsException, PathNotFoundException,
VersionException, LockException, RepositoryException
{
// In this particular case we rely on the default configuration
move(srcAbsPath, destAbsPath, triggerEventsForDescendantsOnRename, trigge... |
java | public static Location getLocation(Element elem, String description) {
Attr srcAttr = elem.getAttributeNodeNS(URI, SRC_ATTR);
if (srcAttr == null) {
return LocationImpl.UNKNOWN;
}
return new LocationImpl(description == null ? elem.getNodeName() : description, srcAttr.getValue(),
getLine(elem), getC... |
python | def owner(self):
"""
Returns the owner of these capabilities, if any.
:return: the owner, can be None
:rtype: JavaObject
"""
obj = javabridge.call(self.jobject, "getOwner", "()Lweka/core/CapabilitiesHandler;")
if obj is None:
return None
else:... |
python | def seek(self, frames, whence=SEEK_SET):
"""Set the read/write position.
Parameters
----------
frames : int
The frame index or offset to seek.
whence : {SEEK_SET, SEEK_CUR, SEEK_END}, optional
By default (``whence=SEEK_SET``), `frames` are counted from
... |
java | @BetaApi
public final ListRegionInstanceGroupManagersPagedResponse listRegionInstanceGroupManagers(
String region) {
ListRegionInstanceGroupManagersHttpRequest request =
ListRegionInstanceGroupManagersHttpRequest.newBuilder().setRegion(region).build();
return listRegionInstanceGroupManagers(requ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.