language stringclasses 2
values | func_code_string stringlengths 63 466k |
|---|---|
python | def eclipse_depth(mafn,Rp,Rs,b,u1=0.394,u2=0.261,max_only=False,npts=100,force_1d=False):
""" Calculates average (or max) eclipse depth
***why does b>1 take so freaking long?...
"""
k = Rp*REARTH/(Rs*RSUN)
if max_only:
return 1 - mafn(k,b,u1,u2)
if np.size(b) == 1:
x = np.... |
python | def furnish(app: web.Application):
"""
Configures Application routes, readying it for running.
This function modifies routes and resources that were added by calling code,
and must be called immediately prior to `run(app)`.
Args:
app (web.Application):
The Aiohttp Application a... |
python | def add_member(self, user):
"""
Add member to team
:param user: User object or user's username
:return: Added user.
"""
user = Transform.to_user(user)
data = {
'id': user
}
extra = {
'resource': self.__class__.__name__,
... |
java | @Override
public void run() {
if (m_restoreAgent != null) {
// start restore process
m_restoreAgent.restore();
}
else {
onSnapshotRestoreCompletion();
onReplayCompletion(Long.MIN_VALUE, m_iv2InitiatorStartingTxnIds);
}
// Start... |
java | public int getMessageLength() {
// Message type, number of transients
int length = 1 + 4;
if (this.transientRequests != null) {
for (OnDemandRequest request : this.transientRequests) {
length += request.getLength();
}
}
return length;
} |
python | def get_template_vars(self, slides):
""" Computes template vars from slides html source code.
"""
try:
head_title = slides[0]['title']
except (IndexError, TypeError):
head_title = "Untitled Presentation"
for slide_index, slide_vars in enumerate(slides):
... |
python | def _append_seed_handle_nodes(self, seed_type: str, nodes: MaybeNodeList) -> 'Seeding':
"""Add a seeding method and returns self.
:param seed_type: The seed type
:param nodes: A node or list of nodes
:returns: self for fluid API
"""
return self._append_seed(seed_type, _h... |
python | def metadataContributer(self):
"""gets the metadata featurelayer object"""
if self._metaFL is None:
fl = FeatureService(url=self._metadataURL,
proxy_url=self._proxy_url,
proxy_port=self._proxy_port)
self._metaFS = fl
... |
java | static public void addKnownString(String mimeType, String knownString) {
Map<String,String> map = getKnownStrings();
if( null != mimeType && null != knownString ) {
map.put(knownString.trim(), mimeType.trim());
}
} |
java | public void start(boolean wait) throws MessagingException {
Thread connector = new JMSBrokerConnector();
connector.start();
if(wait) {
int maxWait = RETRY_INTERVAL * MAX_RETRIES;
int waitTime = 0;
while(!isConnected()) {
if(waitTime < maxWait)... |
python | def overlap(r1: 'Rectangle', r2: 'Rectangle'):
"""
Overlapping rectangles overlap both horizontally & vertically
"""
h_overlaps = (r1.left <= r2.right) and (r1.right >= r2.left)
v_overlaps = (r1.bottom >= r2.top) and (r1.top <= r2.bottom)
return h_overlaps and v_overlaps |
java | public void addData(final BenchmarkMethod meth, final AbstractMeter meter, final double data) {
final Class<?> clazz = meth.getMethodToBench().getDeclaringClass();
if (!elements.containsKey(clazz)) {
elements.put(clazz, new ClassResult(clazz));
}
final ClassResult clazzResu... |
python | def get_active_state_machine(self):
"""Return a reference to the active state-machine
"""
if self._active_state_machine_id in self._state_machines:
return self._state_machines[self._active_state_machine_id]
else:
return None |
java | @Override
InterfaceHttpData getData(HttpRequest request, HttpDataFactory factory) {
MediaType mediaType = contentType;
String contentType = mediaType.toString();
String encoding = mediaType.isTextBased() ? null : "binary";
Charset charset = mediaType.getCharset().orElse(null);
... |
java | public EClass getIfcSpaceProgram() {
if (ifcSpaceProgramEClass == null) {
ifcSpaceProgramEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI)
.getEClassifiers().get(524);
}
return ifcSpaceProgramEClass;
} |
java | public void setDir(String dir)
{
AbstractHtmlState tsh = getState();
tsh.registerAttribute(AbstractHtmlState.ATTR_GENERAL, DIR, dir);
} |
python | async def open(self) -> 'NodePool':
"""
Explicit entry. Opens pool as configured, for later closure via close().
For use when keeping pool open across multiple calls.
Raise any IndyError causing failure to create ledger configuration.
:return: current object
"""
... |
java | public DeleteMessageBatchRequest withEntries(DeleteMessageBatchRequestEntry... entries) {
if (this.entries == null) {
setEntries(new com.amazonaws.internal.SdkInternalList<DeleteMessageBatchRequestEntry>(entries.length));
}
for (DeleteMessageBatchRequestEntry ele : entries) {
... |
python | def batchoverlap(args):
"""
%prog batchoverlap pairs.txt outdir
Check overlaps between pairs of sequences.
"""
p = OptionParser(batchoverlap.__doc__)
p.set_cpus()
opts, args = p.parse_args(args)
if len(args) != 2:
sys.exit(not p.print_help())
pairsfile, outdir = args
f... |
python | def discard(self, element):
"""
Return a new PSet with element removed. Returns itself if element is not present.
"""
if element in self._map:
return self.evolver().remove(element).persistent()
return self |
python | def lchown(path, user, group):
'''
Chown a file, pass the file the desired user and group without following
symlinks.
path
path to the file or directory
user
user owner
group
group owner
CLI Example:
.. code-block:: bash
salt '*' file.chown /etc/pass... |
python | def post(self, path=None, url_kwargs=None, **kwargs):
"""
Sends a POST request.
:param path:
The HTTP path (either absolute or relative).
:param url_kwargs:
Parameters to override in the generated URL. See `~hyperlink.URL`.
:param **kwargs:
Op... |
java | private static boolean hasMoxyReflector() {
if (hasMoxyReflector != null) {
return hasMoxyReflector;
}
try {
new MoxyReflector();
hasMoxyReflector = true;
} catch (NoClassDefFoundError error) {
hasMoxyReflector = false;
}
return hasMoxyReflector;
} |
java | public static Statement throwExpression(final Expression expression) {
expression.checkAssignableTo(THROWABLE_TYPE);
return new Statement() {
@Override
protected void doGen(CodeBuilder adapter) {
expression.gen(adapter);
adapter.throwException();
}
};
} |
java | @Override protected double[] score0(double[] data, double[] preds) {
double[] nums = new double[_output._levels.length]; // log(p(x,y)) for all levels of y
assert preds.length >= (_output._levels.length + 1); // Note: First column of preds is predicted response class
// Compute joint probability of pr... |
java | @Override
public void doFilter(ResourceRequest request, ResourceResponse response, FilterChain chain) throws IOException,
PortletException {
doCommonFilter(request, response, chain);
} |
java | @Override
public List<CPDefinitionInventory> getCPDefinitionInventories(int start,
int end) {
return cpDefinitionInventoryPersistence.findAll(start, end);
} |
python | def blur(self, image, geometry, options):
"""
Wrapper for ``_blur``
"""
if options.get('blur'):
return self._blur(image, int(options.get('blur')))
return image |
java | public static void displayHelp() {
System.out.println("Usage:");
System.out.println("\tCase 1: WordSegmenting -modeldir <model directory> -inputfile <input data file>");
System.out.println("\tCase 2: WordSegmenting -modeldir <model directory> -inputdir <input data directory>");
Syste... |
python | def on_configparser_loads(self, configparser, config, content, **kwargs):
""" The :mod:`configparser` loads method.
:param module configparser: The ``configparser`` module
:param class config: The loading config class
:param str content: The content to deserialize
:return: The d... |
java | public JsonObject byteBufToJsonObject(ByteBuf input) throws Exception {
return TranscoderUtils.byteBufToClass(input, JsonObject.class, JacksonTransformers.MAPPER);
} |
java | public boolean removeByName(String name) {
boolean found = false;
Iterator<CompilerInput> iter = inputs.iterator();
while (iter.hasNext()) {
CompilerInput file = iter.next();
if (name.equals(file.getName())) {
iter.remove();
file.setModule(null);
found = true;
}
... |
python | def lambert_yticks(ax, ticks):
"""Draw ricks on the left y-axis of a Lamber Conformal projection."""
te = lambda xy: xy[1]
lc = lambda t, n, b: np.vstack((np.linspace(b[0], b[1], n), np.zeros(n) + t)).T
yticks, yticklabels = _lambert_ticks(ax, ticks, 'left', lc, te)
ax.yaxis.tick_left()
ax.set_y... |
python | def get_profile_user_fieldname(profile_model=None, user_model=None):
"""
Returns the name of the first field on the profile model that
points to the ``auth.User`` model.
"""
Profile = profile_model or get_profile_model()
User = user_model or get_user_model()
for field in Profile._meta.fields... |
java | public final void setLogLevel(@NonNull final LogLevel logLevel) {
Condition.INSTANCE.ensureNotNull(logLevel, "The log level may not be null");
this.logLevel = logLevel;
} |
python | def from_keyed_iterable(iterable, key, filter_func=None):
"""Construct a dictionary out of an iterable, using an attribute name as
the key. Optionally provide a filter function, to determine what should be
kept in the dictionary."""
generated = {}
for element in iterable:
try:
... |
java | public PagedList<ResourceMetricInner> listMultiRoleMetricsNext(final String nextPageLink) {
ServiceResponse<Page<ResourceMetricInner>> response = listMultiRoleMetricsNextSinglePageAsync(nextPageLink).toBlocking().single();
return new PagedList<ResourceMetricInner>(response.body()) {
@Overrid... |
java | void toggleLabelHover(boolean hovered) {
boolean hover = hovered && (m_hasError || CmsStringUtil.isNotEmptyOrWhitespaceOnly(m_help));
if (hover) {
addStyleName(formCss().labelHover());
if (shouldDisplayTooltipAbove()) {
addStyleName(formCss().displayAbove()... |
java | public static boolean svdcmp(double[][] a, int m, int n, double[] w, double[][] v) {
boolean flag = false;
int i, its, j, jj, k, l = 0, nm = 0;
double anorm = 0.0, c, f, g = 0.0, h, s, scale = 0.0, x, y, z;
double[] rv1 = new double[n];
//Householder reduction to bidiagonal ... |
python | def total_level(source_levels):
"""
Calculates the total sound pressure level based on multiple source levels
"""
sums = 0.0
for l in source_levels:
if l is None:
continue
if l == 0:
continue
sums += pow(10.0, float(l) / 10.0)
level = 10.0 * math.l... |
python | def __update_existing(self, msg, req):
"""Propagate changes based on type of message. MUST be called within self.__requests lock. Performs additional
actions when solicited messages arrive."""
req._messages.append(msg)
payload = msg[M_PAYLOAD]
if msg[M_TYPE] in _RSP_TYPE_CREA... |
python | def normalizeSequence(sequence, considerDimensions=None):
"""
normalize sequence by subtracting the mean and
:param sequence: a list of data samples
:param considerDimensions: a list of dimensions to consider
:return: normalized sequence
"""
seq = np.array(sequence).astype('float64')
nSampleDim = seq.sh... |
python | def name(self):
"""
Application name. It's used as a process name.
"""
try:
return self.config_parser.get('application', 'name')
except CONFIGPARSER_EXC:
return super(IniConfig, self).name |
python | def clean_empty(self, d=DEFAULT):
"""Returns a copy of d without empty leaves.
https://stackoverflow.com/questions/27973988/python-how-to-remove-all-empty-fields-in-a-nested-dict/35263074
"""
if d is DEFAULT:
d = self
if isinstance(d, list):
return [v for... |
python | def _build_regular_workflow(json_spec):
"""
Precondition: json_spec must be validated
"""
workflow_id = dxpy.api.workflow_new(json_spec)["id"]
dxpy.api.workflow_close(workflow_id)
return workflow_id |
java | public SearchFeed trendSticker() throws GiphyException {
SearchFeed feed = null;
HashMap<String, String> params = new HashMap<String, String>();
params.put("api_key", apiKey);
Request request = new Request(UrlUtil.buildUrlQuery(TrendingStickerEndpoint, params));
try {
Response response = sender.sendReques... |
python | async def on_command_error(self, context, exception):
"""|coro|
The default command error handler provided by the bot.
By default this prints to ``sys.stderr`` however it could be
overridden to have a different implementation.
This only fires if you do not specify any listener... |
java | public void write_ref(final String node, final int[] ids, final int creation) {
int arity = ids.length;
if (arity > 3) {
arity = 3; // max 3 words in ref
}
write1(OtpExternal.newRefTag);
// how many id values
write2BE(arity);
write_atom(node);
write1(creation & 0x3); // 2 bi... |
java | public AlgorithmValidationSpecification withValidationProfiles(AlgorithmValidationProfile... validationProfiles) {
if (this.validationProfiles == null) {
setValidationProfiles(new java.util.ArrayList<AlgorithmValidationProfile>(validationProfiles.length));
}
for (AlgorithmValidationP... |
python | def _httpResponseToMessage(response, server_url):
"""Adapt a POST response to a Message.
@type response: L{openid.fetchers.HTTPResponse}
@param response: Result of a POST to an OpenID endpoint.
@rtype: L{openid.message.Message}
@raises openid.fetchers.HTTPFetchingError: if the server returned a
... |
python | def load_commands(self, parser):
""" Load commands of this profile.
:param parser: argparse parser on which to add commands
"""
entrypoints = self._get_entrypoints()
already_loaded = set()
for entrypoint in entrypoints:
if entrypoint.name not in already_loa... |
java | public boolean hasNamedPolicy(String ptype, List<String> params) {
return model.hasPolicy("p", ptype, params);
} |
java | private <NODE extends Node, CONTROLLER extends FxmlController>
FxmlLoadResult<NODE, CONTROLLER>
loadNodeImpl(
final FxmlLoader fxmlLoader,
final FxmlNode fxmlNode,
final Class<? extends NODE> nodeClass,
final Class<? extends CONTROLLER> controllerClass
) {
final Strin... |
python | def find_sources_in_image(self, filename, hdu_index=0, outfile=None, rms=None, bkg=None, max_summits=None, innerclip=5,
outerclip=4, cores=None, rmsin=None, bkgin=None, beam=None, doislandflux=False,
nopositive=False, nonegative=False, mask=None, lat=None, img... |
java | public Frame asFrame(INDArray array, int dataType) {
return converter.convert(asMat(array, OpenCVFrameConverter.getMatDepth(dataType)));
} |
java | @Override
public HandlerRegistration addGeometryEditStartHandler(GeometryEditStartHandler handler) {
return eventBus.addHandler(GeometryEditStartHandler.TYPE, handler);
} |
python | def _build(self, inputs):
"""Connects the Linear module into the graph, with input Tensor `inputs`.
If this is not the first time the module has been connected to the graph,
the Tensor provided here must have the same final dimension, in order for
the existing variables to be the correct size for the m... |
python | def grid_search(fn, grid, comm=None, mpidtype=None, fmin=True):
"""Perform a grid search for optimal parameters of a specified
function. In the simplest case the function returns a float value,
and a single optimum value and corresponding parameter values are
identified. If the function returns a tuple ... |
python | def validate_settings(settings):
"""
`settings` is either a dictionary or an object containing Kronos settings
(e.g., the contents of conf/settings.py). This function checks that all
required settings are present and valid.
"""
# Validate `storage`
storage = _validate_and_get_value(settings, 'settings', ... |
java | public void marshall(AvailabilityZoneDetail availabilityZoneDetail, ProtocolMarshaller protocolMarshaller) {
if (availabilityZoneDetail == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(availabilityZ... |
python | def delete_session_entity_type(
self,
name,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None):
"""
Deletes the specified session entity type.
Example:
>>> import ... |
python | def add_single(self, hostname, ports, nickname=None, **kws):
'''
Explicitly add a single entry.
Hostname is a FQDN and ports is either a single int (assumed to be TCP port)
or Electrum protocol/port number specification with spaces in between.
'''
nickname = n... |
python | def from_json(cls, data):
""" Create EPW from json dictionary.
Args:
data: {
"location": {} , // ladybug location schema
"data_collections": [], // list of hourly annual hourly data collection
schemas for each of the 35 fields with... |
python | def trim_tree_before(element, include_element=True, keep_head=True):
"""
Removes the document tree preceding the given element. If include_element
is True, the given element is kept in the tree, otherwise it is removed.
"""
el = element
for parent_el in element.iterancestors():
parent_el... |
java | public int decode(final InputStream stream, final ByteBuffer buffer) throws IOException {
while (buffer.remaining() >= 64) {
int val = stream.read();
if (val < 0) {
break; // EOF
}
if ((val & COMPRESSED_RUN_MASK) == COMPRESSED_RUN_MASK) {
... |
python | def _load(self, ):
"""Loads the plugin
:raises: errors.PluginInitError
"""
super(JB_MayaPlugin, self)._load()
try:
if not jukeboxmaya.STANDALONE_INITIALIZED:
self.init_ui()
except Exception:
log.exception("Load Ui failed!") |
python | def security_labels(self, resource_id=None):
"""Security Label endpoint for this resource with optional label name.
This method will set the resource endpoint for working with Security
Labels. The HTTP GET method will return all security labels applied
to this resource or if a resource... |
java | public Observable<OpenShiftManagedClusterInner> createOrUpdateAsync(String resourceGroupName, String resourceName, OpenShiftManagedClusterInner parameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, resourceName, parameters).map(new Func1<ServiceResponse<OpenShiftManagedClusterInner>, Op... |
java | @Override
public Map<String, String> loadDocStrings(Set<ServiceConfig> serviceConfigs) {
return serviceConfigs.stream()
.flatMap(c -> c.service().as(THttpService.class).get().entries().values().stream())
.flatMap(entry -> entry.interfaces().stream().... |
java | public static String getSessionTypeName(ResourceAddress address) {
String externalURI = address.getExternalURI();
return URIUtils.getScheme(externalURI);
} |
python | def setDescription(self, desc='No description'):
"""sets repository description"""
try:
self._put_named_file('description', desc)
except Exception, e:
raise RepoError(e) |
python | def configure(self, options, conf):
"""Configure the plugin and system, based on selected options.
The base plugin class sets the plugin to enabled if the enable option
for the plugin (self.enable_opt) is true.
"""
self.conf = conf
if hasattr(options, self.enable_opt):
... |
java | @SuppressWarnings({ "PMD.NcssCount",
"PMD.UseStringBufferForStringAppends" })
public static boolean sendStaticContent(
HttpRequest request, IOSubchannel channel,
Function<String, URL> resolver, MaxAgeCalculator maxAgeCalculator) {
String path = request.requestUri().getPath();... |
java | public static <T1, T2, T3> TriConsumer<T1, T2, T3> spy1st(TriConsumer<T1, T2, T3> consumer, Box<T1> param1) {
return spy(consumer, param1, Box.<T2>empty(), Box.<T3>empty());
} |
java | public static void takeImage(@NonNull Activity activity, int requestCode, File outPath) {
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
Uri uri = getUri(activity, outPath);
intent.putExtra(MediaStore.EXTRA_OUTPUT, uri);
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION... |
java | public static dnszone[] get_filtered(nitro_service service, filtervalue[] filter) throws Exception{
dnszone obj = new dnszone();
options option = new options();
option.set_filter(filter);
dnszone[] response = (dnszone[]) obj.getfiltered(service, option);
return response;
} |
python | def _safe_str_cmp(a, b):
"""
Internal function to efficiently iterate over the hashes
Regular string compare will bail at the earliest opportunity
which allows timing attacks
"""
if len(a) != len(b):
return False
rv = 0
for x, y in zip(a, b):
rv |= ord(x) ^ ord(y)
... |
python | def query( self ):
"""
Returns the query for this item by joining together its children,
or building its data.
:return <Query> || <QueryCompound>
"""
# create the query compound
if ( self.childCount() ):
q = Q()
oper... |
java | public static ExpectedCondition<List<WebElement>> visibilityOfAllElements(
final List<WebElement> elements) {
return new ExpectedCondition<List<WebElement>>() {
@Override
public List<WebElement> apply(WebDriver driver) {
for (WebElement element : elements) {
if (!element.isDisplaye... |
python | def default_node(self, value):
"""
Setter for **self.__default_node** attribute.
:param value: Attribute value.
:type value: AbstractCompositeNode or GraphModelNode
"""
if value is not None:
assert issubclass(value, AbstractCompositeNode), \
... |
java | private void sortArrayList(List<InvPair> v) {
Collections.sort(v, new Comparator<InvPair>() {
@Override
public int compare(InvPair o1, InvPair o2) {
if (o1.getCurr() > o2.getCurr()) return +1;
if (o1.getCurr() < o2.getCurr()) return -1;
re... |
python | def add_node(self, node_id, task, inputs):
"""
Adds a node to the workflow.
:param node_id: A unique identifier for the new node.
:param task: The task to run.
:param inputs: A mapping of inputs from workflow inputs, or outputs from other nodes. The format should be
... |
java | public OvhOrder hosting_web_new_duration_POST(String duration, OvhDnsZoneEnum dnsZone, String domain, OvhOrderableNameEnum module, net.minidev.ovh.api.hosting.web.OvhOfferEnum offer, Boolean waiveRetractationPeriod) throws IOException {
String qPath = "/order/hosting/web/new/{duration}";
StringBuilder sb = path(qPa... |
python | def export_stl_ascii(mesh):
"""
Convert a Trimesh object into an ASCII STL file.
Parameters
---------
mesh : trimesh.Trimesh
Returns
---------
export : str
Mesh represented as an ASCII STL file
"""
# move all the data that's going into the STL file into one array
b... |
python | def duplicate_nodes(self):
"""
Return a sequence of node keys of identical meshes.
Will combine meshes duplicated by copying in space with different keys in
self.geometry, as well as meshes repeated by self.nodes.
Returns
-----------
duplicates: (m) sequence of ... |
python | def export_mesh(vertices, triangles, filename, mesh_name="mcubes_mesh"):
"""
Exports a mesh in the COLLADA (.dae) format.
Needs PyCollada (https://github.com/pycollada/pycollada).
"""
import collada
mesh = collada.Collada()
vert_src = collada.source.FloatSource("verts-arr... |
java | SecurityUtilityReturnCodes runProgram(String[] args) {
if (stdin == null) {
stderr.println(CommandUtils.getMessage("error.missingIO", "stdin"));
return SecurityUtilityReturnCodes.ERR_GENERIC;
}
if (stdout == null) {
stderr.println(CommandUtils.getMessage("err... |
python | def parse(self, argv=None, keyring_namespace=None, strict=False):
"""Find settings from all sources.
:keyword strict: fail if unknown args are passed in.
:returns: dict of parsed option name and values
:raises: SystemExit if invalid arguments supplied along with stdout
messa... |
java | public void validateTrue(boolean value, String name, String message) {
if (!value) {
addError(name, Optional.ofNullable(message).orElse(messages.get(Validation.TRUE_KEY.name(), name)));
}
} |
python | def virtual_memory():
'''
.. versionadded:: 2014.7.0
Return a dict that describes statistics about system memory usage.
.. note::
This function is only available in psutil version 0.6.0 and above.
CLI Example:
.. code-block:: bash
salt '*' ps.virtual_memory
'''
if p... |
java | protected static final int floorDivide(int numerator, int denominator, int[] remainder) {
if (numerator >= 0) {
remainder[0] = numerator % denominator;
return numerator / denominator;
}
int quotient = ((numerator + 1) / denominator) - 1;
remainder[0] = numerator -... |
java | @Override
public final Map<String, OperationEntry> getOperationDescriptions(final PathAddress address, boolean inherited) {
if (parent != null) {
RootInvocation ri = getRootInvocation();
return ri.root.getOperationDescriptions(ri.pathAddress.append(address), inherited);
}
... |
python | def disconnect_all(self, context, ports):
"""
Disconnect All Command, will the assign all the vnics on the vm to the default network,
which is sign to be disconnected
:param models.QualiDriverModels.ResourceRemoteCommandContext context: the context the command runs on
:param lis... |
java | public PagedList<SiteInner> changeVnetNext(final String nextPageLink) {
ServiceResponse<Page<SiteInner>> response = changeVnetNextSinglePageAsync(nextPageLink).toBlocking().single();
return new PagedList<SiteInner>(response.body()) {
@Override
public Page<SiteInner> nextPage(Stri... |
java | private void createLEdges(List<Arc> arcs)
{
for(Arc arc: arcs )
{
LEdge lEdge = layout.newEdge(null);
lEdge.type = arc.getClazz();
lEdge.label = arc.getId();
LNode sourceLNode = viewToLayout.get(glyphToVNode.get(arc.getSource()));
LNode tar... |
java | @SuppressWarnings("unchecked")
@Override
public Class<Model> getModel(String modelPackagesCsv) throws TechnicalException {
if (modelPackagesCsv != null && !"".equals(modelPackagesCsv)) {
final String[] packages = modelPackagesCsv.split(";");
try {
if (packages.len... |
python | def _extract_features(self):
"""
Extracts and sets the feature data from the log file necessary for a reduction
"""
for parsed_line in self.parsed_lines:
# If it's ssh, we can handle it
if parsed_line.get('program') == 'sshd':
result = self._parse... |
python | def upload(self, force=False):
"""
Uploads a notebook
:param force: True/False
:returns {}
"""
self.package and self.release
try:
return self.aserver_api.upload(self.username, self.project, self.version,
basename(... |
java | public static <A extends Appendable> A join(Iterable<?> objects, String delimiter, A out) throws IOException {
boolean didOne = false;
for(Object obj : objects) {
if(didOne) out.append(delimiter);
else didOne = true;
out.append(String.valueOf(obj));
}
return out;
} |
python | def subscriptions_read(self, rid, **kwargs):
"""Mark room as read"""
return self.__call_api_post('subscriptions.read', rid=rid, kwargs=kwargs) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.