language stringclasses 2
values | func_code_string stringlengths 63 466k |
|---|---|
java | @Pure
public double distanceToBusStop() {
final Point2d p1 = getPosition2D();
if (p1 != null) {
final BusStop stop = getBusStop();
if (stop != null) {
final Point2d p2 = stop.getPosition2D();
if (p2 != null) {
return p1.getDistance(p2);
}
}
}
return Double.NaN;
} |
java | public static EquivalentFragmentSet label(VarProperty varProperty, Variable type, ImmutableSet<Label> labels) {
return new AutoValue_LabelFragmentSet(varProperty, type, labels);
} |
python | def search_genotype_phenotype(
self, phenotype_association_set_id=None, feature_ids=None,
phenotype_ids=None, evidence=None):
"""
Returns an iterator over the GeneotypePhenotype associations from
the server
"""
request = protocol.SearchGenotypePhenotypeReq... |
java | @Override
public Object eGet(int featureID, boolean resolve, boolean coreType)
{
switch (featureID)
{
case TypesPackage.JVM_WILDCARD_TYPE_REFERENCE__CONSTRAINTS:
return getConstraints();
}
return super.eGet(featureID, resolve, coreType);
} |
python | def flairlist(self, r, limit=1000, after=None, before=None):
"""Login required. Gets flairlist for subreddit `r`. See https://github.com/reddit/reddit/wiki/API%3A-flairlist.
However, the wiki docs are wrong (as of 2012/5/4). Returns :class:`things.ListBlob` of :class:`things.Blob` objects, e... |
java | @Override
public Object resolveMostSpecificModelWithName(Resource resource, String name) {
if (resource == null) {
throw new IllegalArgumentException("Method argument resource must not be null.");
}
if (name == null) {
throw new IllegalArgumentException("Method argume... |
java | public Set<String> keys(String pattern) {
Jedis jedis = getJedis();
try {
return jedis.keys(pattern);
}
finally {close(jedis);}
} |
java | protected long[] getSampleSizes(long startSample, long endSample, Track track, int sequenceNumber) {
List<Sample> samples = getSamples(startSample, endSample, track);
long[] sampleSizes = new long[samples.size()];
for (int i = 0; i < sampleSizes.length; i++) {
sampleSizes[i] = sampl... |
java | public long getJsCacheResultDeadline(JsCacheResult jcr) {
Calendar deadline = getNowCalendar();
if ((jcr.year() + jcr.month() + jcr.day() + jcr.hour() + jcr.minute() + jcr.second() + jcr.millisecond()) == 0) {
deadline.add(Calendar.YEAR, 1);
} else {
deadline.add(Calendar.YEAR, jcr.year());
deadlin... |
java | public static SettingsCommandUser build(String[] params)
{
GroupedOptions options = GroupedOptions.select(params,
new Options(new Uncertainty()),
new Options(new Duration()),
new Options(new Count()));
if (options == null)
{
printHe... |
java | @Override
public int getIndexOfChild(Object parentObj, Object childObj) {
if (debugger == null) {
return -1;
}
VariableNode parent = (VariableNode) parentObj;
VariableNode child = (VariableNode) childObj;
VariableNode[] children = children(parent);
for (in... |
python | def describe(self, **kwargs):
"""
:returns: A hash containing attributes of the project or container.
:rtype: dict
Returns a hash with key-value pairs as specified by the API
specification for the `/project-xxxx/describe
<https://wiki.dnanexus.com/API-Specification-v1.0.... |
java | @Override
public boolean validate(final Problems problems, final String compName, final String model) {
final char[] chars = model.toCharArray();
for (final char c : chars) {
if (Character.isWhitespace(c)) {
problems.add(ValidationBundle.getMessage(MayNotContainSpacesValidator.class, "MAY_NOT_CONTAIN_WHITES... |
python | def dragEnterEvent( self, event ):
"""
Processes the drag drop event using the filter set by the \
setDragDropFilter
:param event | <QDragEvent>
"""
filt = self.dragDropFilter()
if ( not filt ):
super(XCalendarWidget, self).dragE... |
python | def close(self, force=False):
"""This closes the connection with the child application. Note that
calling close() more than once is valid. This emulates standard Python
behavior with files. Set force to True if you want to make sure that
the child is terminated (SIGKILL is sent if the ch... |
java | public static inat_stats[] get(nitro_service service) throws Exception{
inat_stats obj = new inat_stats();
inat_stats[] response = (inat_stats[])obj.stat_resources(service);
return response;
} |
python | def put(self, item, block=True, timeout=None):
'''Put an item into the queue.
If optional args 'block' is true and 'timeout' is None (the default),
block if necessary until a free slot is available. If 'timeout' is
a non-negative number, it blocks at most 'timeout' seconds and raises
... |
python | def indices_outside_times(times, start, end):
"""
Return an index array into times that like outside the durations defined by start end arrays
Parameters
----------
times: numpy.ndarray
Array of times
start: numpy.ndarray
Array of duration start times
end: numpy.ndarray
... |
java | private Project.Tasks.Task.PredecessorLink writePredecessor(Integer taskID, RelationType type, Duration lag)
{
Project.Tasks.Task.PredecessorLink link = m_factory.createProjectTasksTaskPredecessorLink();
link.setPredecessorUID(NumberHelper.getBigInteger(taskID));
link.setType(BigInteger.valueOf(ty... |
python | def _storage_list_buckets(project, pattern):
""" List all storage buckets that match a pattern. """
data = [{'Bucket': 'gs://' + bucket.name, 'Created': bucket.metadata.created_on}
for bucket in datalab.storage.Buckets(project_id=project)
if fnmatch.fnmatch(bucket.name, pattern)]
return datala... |
python | def _show_loading_page(self):
"""Show animation while the kernel is loading."""
self.shellwidget.hide()
self.infowidget.show()
self.info_page = self.loading_page
self.set_info_page() |
python | def mouseDoubleClickEvent(self, event):
"""Launches an editor for the component, if the mouse cursor is over an item"""
if self.mode == BuildMode:
if event.button() == QtCore.Qt.LeftButton:
index = self.indexAt(event.pos())
self.edit(index) |
python | def fit(self, X):
"""Fit Kernel density estimation to an list of values.
Args:
X: 1-d `np.ndarray` or `pd.Series` or `list` datapoints to be estimated from.
This function will fit a gaussian_kde model to a list of datapoints
and store it as a class attribute.
"""
... |
java | public static Request configure(Config config, Request request) {
String apiVersion = config.apiVersion();
Endpoint endpoint = Endpoint.byHost.get(request.url().host());
if (endpoint == null) {
throw new UnsupportedOperationException("unknown endpoint: " + request.url().host());
... |
java | public HyphenationEvent getHyphenation() {
if (attributes == null) return null;
return (HyphenationEvent) attributes.get(Chunk.HYPHENATION);
} |
java | public String convertIfcPerformanceHistoryTypeEnumToString(EDataType eDataType, Object instanceValue) {
return instanceValue == null ? null : instanceValue.toString();
} |
python | def upgrade(dbname, connect_str, alembic_conf):
"""
Get the database's upgrade lock and run alembic.
:param dbname: Name of the database to upgrade/create
:param connect_str: Connection string to the database (usually Flask's SQLALCHEMY_DATABASE_URI)
:param alembic_conf: location of alembic.ini
... |
java | private List<Dependency> getProvisionableDependencies()
{
List<Dependency> dependencies = new ArrayList<Dependency>();
getLog().info( "Adding dependencies in scope " + dependencyScope );
for( Dependency d : getDependencies() )
{
if( d.getScope() != null && d.getScope().eq... |
java | private void instanceAlreadyLoaded(
final Tuple resultset,
final int i,
//TODO create an interface for this usage
final OgmEntityPersister persister,
final org.hibernate.engine.spi.EntityKey key,
final Object object,
final LockMode lockMode,
final SharedSessionContractImplementor session)
throws Hiber... |
python | def fit_caltrack_usage_per_day_model(
data,
fit_cdd=True,
use_billing_presets=False,
minimum_non_zero_cdd=10,
minimum_non_zero_hdd=10,
minimum_total_cdd=20,
minimum_total_hdd=20,
beta_cdd_maximum_p_value=1,
beta_hdd_maximum_p_value=1,
weights_col=None,
fit_intercept_only=True... |
java | private TypeArgSignature parseTypeArg() {
int ch = peekChar();
switch (ch) {
case '*':
return new TypeArgSignature(
(char) nextChar(TypeArgSignature.UNBOUNDED_WILDCARD), null);
case '+':
return new TypeArgSignature(
(char) nextChar(TypeArgSignature.UPPERBOUND_WILDCARD),
parseFieldT... |
java | @Override
public void onAdd(Attack attack) {
notifyWebSocket("attack", attack);
logger.info("Reporter observed attack by user [" + attack.getUser().getUsername() + "]");
} |
java | public MethodInfo getInitializer() {
int size = mMethods.size();
for (int i=0; i<size; i++) {
MethodInfo method = mMethods.get(i);
if ("<clinit>".equals(method.getName())) {
return method;
}
}
return null;
} |
java | public <T> Message body(T body, Charset charset) {
messageWriter.writeBody(body, charset);
return this;
} |
python | def nf_input_to_cl(inp):
"""Convert an input description into command line argument.
"""
sep = " " if inp.get("separate") else ""
val = "'%s'" % inp.get("default") if inp.get("default") else "$%s" % inp["name"]
return "%s%s%s" % (inp["prefix"], sep, val) |
python | def _get_regional_term(self, C, imt, vs30, rrup):
"""
Compute regional term for Japan. See page 1043
"""
f3 = interpolate.interp1d(
[150, 250, 350, 450, 600, 850, 1150, 2000],
[C['a36'], C['a37'], C['a38'], C['a39'], C['a40'], C['a41'],
C['a42'], C['a... |
python | def _get_relation_value(self, dictionary, key, type):
"""
Get the value of the relationship by one or many type.
:type dictionary: dict
:type key: str
:type type: str
"""
value = dictionary[key]
if type == 'one':
return value[0]
retu... |
java | public Object[] readStatement(Statement statement, QueryParameters params) throws SQLException {
return new Object[params.orderSize()];
} |
python | def spawn(self, channels, ax):
""" Spawns a graphical gate that can be used to update the coordinates of the current gate. """
if _check_spawnable(self.source_channels, channels):
sgate = self.gate_type(self.verts, ax, channels)
self.spawn_list.append(sgate)
return sg... |
java | public static <T> Mono<T> illegalArgument(String format, Object... args) {
String message = String.format(format, args);
return Mono.error(new IllegalArgumentException(message));
} |
python | def parameter(self, parser):
"""
Return a parser the parses parameters.
"""
return (Suppress(self.syntax.params_start).leaveWhitespace() +
Group(parser) + Suppress(self.syntax.params_stop)) |
python | def install_package(context):
"""Attempts to install the sdist and wheel."""
if not context.dry_run and build_distributions(context):
with util.mktmpdir() as tmp_dir:
venv.create_venv(tmp_dir=tmp_dir)
for distribution in Path('dist').files():
try:
... |
java | public DirRecord newRecord(String entryDn) throws NamingException {
DirRecord rec = new BasicDirRecord();
rec.setDn(entryDn);
return rec;
} |
java | @Override
public R visitIntersection(IntersectionType t, P p) {
return visitUnknown(t, p);
} |
java | private void addClasses(Class<?>[] classes, HashSet<Class<?>> result){
if(isNull(classes) || classes.length==0)
Error.globalClassesAbsent(configuredClass);
for (Class<?> classe : classes) result.add(classe);
} |
java | public static Years yearsBetween(ReadablePartial start, ReadablePartial end) {
if (start instanceof LocalDate && end instanceof LocalDate) {
Chronology chrono = DateTimeUtils.getChronology(start.getChronology());
int years = chrono.years().getDifference(
((LocalDate... |
python | def semid(broker):
"""Command: semids"""
source = broker[DefaultSpecs.ipcs_s].content
results = set()
for s in source:
s_splits = s.split()
# key semid owner perms nsems
# 0x00000000 65536 apache 600 1
... |
python | def setCurrentPlugin( self, plugin ):
"""
Sets the current plugin item to the inputed plugin.
:param plugin | <XWizardPlugin> || None
"""
item = self.uiWizardTABLE.currentItem()
if ( not item ):
return None
return item.plugin... |
python | def WmiQueryFromClient(args):
"""Run the WMI query and return the data."""
query = args.query
base_object = args.base_object or r"winmgmts:\root\cimv2"
if not query.upper().startswith("SELECT "):
raise RuntimeError("Only SELECT WMI queries allowed.")
for response_dict in RunWMIQuery(query, baseobj=base_... |
java | public final boolean isValid(Class < T > javaClass,
CobolContext cobolContext, byte[] hostData, int start) {
int hostBytesLen = getBytesLen();
// Is buffer large enough to contain this type?
if (hostData.length < start + hostBytesLen) {
return false;
}
... |
python | def _ParameterDecorator(naming_type, testcases):
"""Implementation of the parameterization decorators.
Args:
naming_type: The naming type.
testcases: Testcase parameters.
Returns:
A function for modifying the decorated object.
"""
def _Apply(obj):
if isinstance(obj, type):
_ModifyClass... |
java | int handleNumbers(String line, BitSet numberBitSet, int startingPoint) {
int end = startingPoint + 1;
while (end < line.length() && Character.isDigit(line.charAt(end))) {
end++;
}
if (end == line.length()) {
if (Character.isDigit(line.charAt(line.length() - 1))) {
numberBitSet.set(st... |
python | def install_frontend(instance='default', forcereload=False, forcerebuild=False,
forcecopy=True, install=True, development=False, build_type='dist'):
"""Builds and installs the frontend"""
hfoslog("Updating frontend components", emitter='BUILDER')
components = {}
loadable_components... |
python | def close_process_handles(self):
"""
Closes all open handles to processes in this snapshot.
"""
for pid in self.get_process_ids():
aProcess = self.get_process(pid)
try:
aProcess.close_handle()
except Exception:
e = sys.e... |
python | def connectRelay(self):
"""Builds the target protocol and connects it to the relay transport.
"""
self.protocol = self.connector.buildProtocol(None)
self.connected = True
self.protocol.makeConnection(self) |
python | def message_handler(stream, type_, from_, cb):
"""
Context manager to temporarily register a callback to handle messages on a
:class:`StanzaStream`.
:param stream: Stanza stream to register the coroutine at
:type stream: :class:`StanzaStream`
:param type_: Message type to listen for, or :data:`... |
java | @Override
public void eUnset(int featureID) {
switch (featureID) {
case AfplibPackage.BFN__RS_NAME:
setRSName(RS_NAME_EDEFAULT);
return;
case AfplibPackage.BFN__TRIPLETS:
getTriplets().clear();
return;
}
super.eUnset(featureID);
} |
java | public OperationStatusResponseInner beginReimageAll(String resourceGroupName, String vmScaleSetName) {
return beginReimageAllWithServiceResponseAsync(resourceGroupName, vmScaleSetName).toBlocking().single().body();
} |
java | private static void addOrder(Criteria c, String sort, String order, boolean ignoreCase) {
if (ORDER_DESC.equals(order)) {
c.addOrder(ignoreCase ? Order.desc(sort).ignoreCase() : Order.desc(sort));
}
else {
c.addOrder(ignoreCase ? Order.asc(sort).ignoreCase() : Order.asc(s... |
java | public static <T> MemcachedClientBuilder<T> newMessagePackClient(final Class<T> valueType) {
return newMessagePackClient(DefaultMessagePackHolder.INSTANCE, valueType);
} |
python | def lookup_task(self, task):
"""
Looks up a task by name or by callable
"""
if isinstance(task, str):
try:
return self[task]
except KeyError:
pass
raise TaskError('Unknown task %s' % task) |
java | public void chooseChoiceIndex(int choiceIdx) throws Exception {
List<Choice> choices = getCurrentChoices();
Assert(choiceIdx >= 0 && choiceIdx < choices.size(), "choice out of range");
// Replace callstack with the one from the thread at the choosing point,
// so that we can jump into the right place in the fl... |
python | def _validate_partition_boundary(boundary):
'''
Ensure valid partition boundaries are supplied.
'''
boundary = six.text_type(boundary)
match = re.search(r'^([\d.]+)(\D*)$', boundary)
if match:
unit = match.group(2)
if not unit or unit in VALID_UNITS:
return
raise ... |
python | def run_qaml(self):
"""
Create and run the GenomeQAML system call
"""
logging.info('Running GenomeQAML quality assessment')
qaml_call = 'classify.py -t {tf} -r {rf}'\
.format(tf=self.qaml_path,
rf=self.qaml_report)
make_path(self.reportpath... |
python | def get_column_listing(self, table):
"""
Get the column listing for a given table.
:param table: The table
:type table: str
:rtype: list
"""
sql = self._grammar.compile_column_exists()
database = self._connection.get_database_name()
table = self.... |
java | public void setTitle(final String TITLE) {
if (null == title) {
_title = TITLE;
fireUpdateEvent(REDRAW_EVENT);
} else {
title.set(TITLE);
}
} |
python | def read(self):
"""
Read the IDF file and the IDD file. If the IDD file had already been
read, it will not be read again.
Read populates the following data structures:
- idfobjects : list
- model : list
- idd_info : list
- idd_index : dict
"""
... |
java | public static String getFieldType(Field field) {
FieldType type = field.getType();
if (type instanceof ScalarFieldType) {
ScalarFieldType scalarFieldType = (ScalarFieldType) type;
return ScalarFieldTypeUtil.getPrimitiveType(scalarFieldType);
}
if (type instanceof ... |
python | def bytes_from_string(value):
"""Interpret human readable string value as bytes.
Returns int
"""
BYTE_POWER = {
'K': 1,
'KB': 1,
'M': 2,
'MB': 2,
'G': 3,
'GB': 3,
'T': 4,
'TB': 4,
'P': 5,
'PB': 5,
}
if isinstance(va... |
java | @Override
public SIBusMessage[] processMsgSet(SIMessageHandle[] msgHandles,
TransactionCommon transaction,
BifurcatedConsumerSessionImpl owner,
boolean unlock,
... |
python | def generate_sample(self, start_state=None, size=1):
"""
Generator version of self.sample
Return Type:
------------
List of State namedtuples, representing the assignment to all variables of the model.
Examples:
---------
>>> from pgmpy.factors.discrete ... |
python | def lmpool(cvals):
"""
Load the variables contained in an internal buffer into the
kernel pool.
http://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/lmpool_c.html
:param cvals: list of strings.
:type cvals: list of str
"""
lenvals = ctypes.c_int(len(max(cvals, key=len)) + 1)
n =... |
java | @Override
protected SoyValue visitListLiteralNode(ListLiteralNode node) {
List<SoyValue> values = this.visitChildren(node);
return ListImpl.forProviderList(values);
} |
python | def account_setup(remote, token, resp):
"""Perform additional setup after user have been logged in.
:param remote: The remote application.
:param token: The token value.
:param resp: The response.
"""
gh = github3.login(token=resp['access_token'])
with db.session.begin_nested():
me ... |
java | static private StringBuilder serializeChannel(StringBuilder buffer, OutboundChannelDefinition ocd, int order) throws NotSerializableException {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Serializing channel: " + order + " " + ocd.getOutboundFactory().getName());... |
python | def get_account_from_name(self, name):
"""
Returns the account with the given name.
:type name: string
:param name: The name of the account.
"""
for account in self.accounts:
if account.get_name() == name:
return account
return None |
python | def extract_ref(scihdu, refhdu):
"""Extract section of the reference image that
corresponds to the given science image.
This only returns a view, not a copy of the
reference image's array.
Parameters
----------
scihdu, refhdu : obj
Extension HDU's of the science and reference image... |
python | def validate_implementation_for_auto_decode_and_soupify(func):
"""
Validate that :func:`auto_decode_and_soupify` is applicable to this
function. If not applicable, a ``NotImplmentedError`` will be raised.
"""
arg_spec = inspect.getargspec(func)
for arg in ["response", "html", "soup"]:
if... |
java | public Observable<Page<LocalNetworkGatewayInner>> listByResourceGroupAsync(final String resourceGroupName) {
return listByResourceGroupWithServiceResponseAsync(resourceGroupName)
.map(new Func1<ServiceResponse<Page<LocalNetworkGatewayInner>>, Page<LocalNetworkGatewayInner>>() {
@Over... |
java | public DescribeInstancePatchStatesForPatchGroupResult withInstancePatchStates(InstancePatchState... instancePatchStates) {
if (this.instancePatchStates == null) {
setInstancePatchStates(new com.amazonaws.internal.SdkInternalList<InstancePatchState>(instancePatchStates.length));
}
for... |
java | public Iterator<?> xpathIterator(Collection<?> collection, String query) {
JXPathContext pathContext = JXPathContext.newContext(collection);
Iterator<?> result = null;
try {
result = pathContext.iteratePointers(query);
} catch (JXPathNotFoundException e) {
logger.log(Level.WARNING, "JXPath ... |
java | protected Formatter<VersionIdentifier> parseSubFormatter(CharSequenceScanner scanner, String formatPattern, StringBuilder infixBuffer,
FormatPatternStatus status) {
char c = scanner.next();
if (c == 'V') {
char segment = scanner.forceNext();
if (segment == '\0') {
throw new IllegalSta... |
java | public <S, R> AnimaQuery<T> in(TypeFunction<T, R> function, List<S> values) {
String columnName = AnimaUtils.getLambdaColumnName(function);
return this.in(columnName, values);
} |
java | private void updateLocaleVariants(ResourceBrowser rsBrowser, String path, Set<String> localeVariants) {
Set<String> skinPaths = rsBrowser.getResourceNames(path);
for (Iterator<String> itSkinPath = skinPaths.iterator(); itSkinPath.hasNext();) {
String skinPath = path + itSkinPath.next();
if (rsBrowser.isDirec... |
java | private String getServiceIdFromMavenBundlePlugin() {
Plugin bundlePlugin = project.getBuildPlugins().stream()
.filter(plugin -> StringUtils.equals(plugin.getKey(), MAVEN_BUNDLE_PLUGIN_ID))
.findFirst().orElse(null);
if (bundlePlugin != null) {
Xpp3Dom configuration = (Xpp3Dom)bundlePlugin.... |
python | def init_distributed(cuda):
"""
Initializes distributed backend.
:param cuda: (bool) if True initializes nccl backend, if False initializes
gloo backend
"""
world_size = int(os.environ.get('WORLD_SIZE', 1))
distributed = (world_size > 1)
if distributed:
backend = 'nccl' if c... |
python | def vectors2angle(v1, v2):
""" Returns the angle in radians between vectors 'v1' and 'v2'.
:param v1:
vector, a numpy array
:param v2:
vector, a numpy array
:returns:
the angle in radians between the two vetors
"""
cosang = np.dot(v1, v2)
sinang = np.linalg.norm(np.c... |
java | @XmlElementDecl(namespace = "urn:oasis:names:tc:xacml:3.0:core:schema:wd-17", name = "AssociatedAdvice")
public JAXBElement<AssociatedAdviceType> createAssociatedAdvice(AssociatedAdviceType value) {
return new JAXBElement<AssociatedAdviceType>(_AssociatedAdvice_QNAME, AssociatedAdviceType.class, null, value... |
java | public static long[] getArrowStrides(INDArray arr) {
long[] ret = new long[arr.rank()];
for(int i = 0; i < arr.rank(); i++) {
ret[i] = arr.stride(i) * arr.data().getElementSize();
}
return ret;
} |
python | def _scons_syntax_error(e):
"""Handle syntax errors. Print out a message and show where the error
occurred.
"""
etype, value, tb = sys.exc_info()
lines = traceback.format_exception_only(etype, value)
for line in lines:
sys.stderr.write(line+'\n')
sys.exit(2) |
python | def create_instance(
self,
parent,
instance_id,
instance,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
"""
Creates a Redis instance based on the specified tier and memory size... |
java | public Class<?> getArrayOrCollectionComponentType() {
if (!isCollection() && !isArray()) {
throw new IllegalStateException();
}
if (isCollection()) {
Type type = field.getGenericType();
if (type instanceof ParameterizedType) {
return toClass((... |
java | public static void upsertJndiObjectResource(DbConn cnx, JndiObjectResourceDto dto)
{
if (dto.getId() != null)
{
QueryResult qr = cnx.runUpdate("jndi_update_changed_by_id", dto.getAuth(), dto.getDescription(), dto.getFactory(),
dto.getName(), dto.getSingleton(), dto.ge... |
python | def verify(zone):
'''
Check to make sure the configuration of the specified
zone can safely be installed on the machine.
zone : string
name of the zone
CLI Example:
.. code-block:: bash
salt '*' zoneadm.verify dolores
'''
ret = {'status': True}
## verify zone
... |
python | def djd_to_datetime(djd, tz='UTC'):
"""
Converts a Dublin Julian Day float to a datetime.datetime object
Parameters
----------
djd : float
fractional days since 12/31/1899+0000
tz : str, default 'UTC'
timezone to localize the result to
Returns
-------
datetime.datet... |
python | def sendJobsQuery(self, jobExecTopicType, jobId=None):
"""
**Description**
Publishes an MQTT jobs related request for a potentially specific jobId (or wildcard)
**Syntax**
.. code:: python
#send a request to describe the next job
myAWSIoTMQTTJobsClient.sen... |
python | def language_name(self, text: str) -> str:
"""Predict the programming language name of the given source code.
:param text: source code.
:return: language name
"""
values = extract(text)
input_fn = _to_func(([values], []))
pos: int = next(self._classifier.predict_... |
python | def set_y(self, y):
"Set y position and reset x"
self.x=self.l_margin
if(y>=0):
self.y=y
else:
self.y=self.h+y |
python | def _parse_format_pages_isbn(html_chunk):
"""
Parse format, number of pages and ISBN.
Args:
html_chunk (obj): HTMLElement containing slice of the page with details.
Returns:
tuple: (format, pages, isbn), all as string.
"""
ppi = get_first_content(
html_chunk.find("div",... |
python | def filter_enum(pred, enum):
"""
Create a new enumeration containing only items filtered from another
enumeration.
Hidden enum items in the original enumeration are excluded.
:type pred: ``Callable[[`EnumItem`], bool]``
:param pred: Predicate that will keep items for which the result is true.
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.