language stringclasses 2
values | func_code_string stringlengths 63 466k |
|---|---|
python | def getShocks(self):
'''
Determine which agents switch from employment to unemployment. All unemployed agents remain
unemployed until death.
Parameters
----------
None
Returns
-------
None
'''
employed = self.eStateNow == 1.0
... |
python | def clear_level(self):
"""Clears the level.
raise: NoAccess - ``Metadata.isRequired()`` or
``Metadata.isReadOnly()`` is ``true``
*compliance: mandatory -- This method must be implemented.*
"""
if (self.get_level_metadata().is_read_only() or
self... |
java | @Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_full_screen_image_gallery);
bindViews();
setSupportActionBar(toolbar);
ActionBar actionBar = getSupportActionBar();
if (actionBar != ... |
java | @Override
public DeleteDirectoryConfigResult deleteDirectoryConfig(DeleteDirectoryConfigRequest request) {
request = beforeClientExecution(request);
return executeDeleteDirectoryConfig(request);
} |
python | def get_name_for(self, dynamic_part):
"""
Return the name for the current dynamic field, accepting a limpyd
instance for the dynamic part
"""
dynamic_part = self.from_python(dynamic_part)
return super(DynamicRelatedFieldMixin, self).get_name_for(dynamic_part) |
java | public static String getReverseRouteFast(Class<? extends Controller> clazz) {
String simpleName = clazz.getSimpleName();
if (! simpleName.endsWith("Controller")) {
throw new ControllerException("controller name must end with 'Controller' suffix");
}
String className = clazz.get... |
python | def _init_metadata(self, **kwargs):
"""Initialize form metadata"""
osid_objects.OsidSourceableForm._init_metadata(self)
osid_objects.OsidObjectForm._init_metadata(self, **kwargs)
self._copyright_registration_default = self._mdata['copyright_registration']['default_string_values'][0]
... |
java | public static CPRuleUserSegmentRel fetchByCPRuleId_First(long CPRuleId,
OrderByComparator<CPRuleUserSegmentRel> orderByComparator) {
return getPersistence()
.fetchByCPRuleId_First(CPRuleId, orderByComparator);
} |
java | public Observable<ServiceResponse<Void>> renameWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, String id) {
if (resourceGroupName == null) {
throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
}
... |
java | public String getTagValue(String tagName) {
String value = null;
if (mReadMethod != null) {
value = mReadMethod.getTagValue(tagName);
}
if (value == null && mWriteMethod != null) {
value = mWriteMethod.getTagValue(tagName);
}
return value;
} |
java | public Instances trainCV(int numFolds, int numFold, Random random) {
Instances train = trainCV(numFolds, numFold);
train.randomize(random);
return train;
} |
java | @Override
public int getSize(String scope) throws InvalidScopeException, InternalCacheEngineException {
try {
return cacheStoreAdapter.getSize(scope);
} catch (InvalidScopeException ex) {
throw ex;
} catch (Exception ex) {
throw new InternalCacheEngineExce... |
java | public String getQualifiedName(Node n) {
if (n.getBooleanProp(Node.IS_MODULE_NAME)) {
return n.getString();
} else if (n.isGetProp()) {
String left = getQualifiedName(n.getFirstChild());
if (left == null) {
return null;
}
return left + "." + n.getLastChild().getString();
... |
java | private static double polyCosine(double x) {
double x2 = x*x;
double p = 2.479773539153719E-5;
p = p * x2 + -0.0013888888689039883;
p = p * x2 + 0.041666666666621166;
p = p * x2 + -0.49999999999999994;
p *= x2;
return p;
} |
python | def subjects_list(self, api_url=None, offset=0, limit=-1, properties=None):
"""Get list of subject resources from a SCO-API.
Parameters
----------
api_url : string, optional
Base Url of the SCO-API. Uses default API if argument not present.
offset : int, optional
... |
java | @Override
public EEnum getIfcJunctionBoxTypeEnum() {
if (ifcJunctionBoxTypeEnumEEnum == null) {
ifcJunctionBoxTypeEnumEEnum = (EEnum) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI)
.getEClassifiers().get(1006);
}
return ifcJunctionBoxTypeEnumEEnum;
} |
python | def parse_content_range_header(value, on_update=None):
"""Parses a range header into a
:class:`~werkzeug.datastructures.ContentRange` object or `None` if
parsing is not possible.
.. versionadded:: 0.7
:param value: a content range header to be parsed.
:param on_update: an optional callable tha... |
python | def control(self, on=[], off=[]):
"""
This method serves as the primary interaction point
to the controls interface.
- The 'on' and 'off' arguments can either be a list or a single string.
This allows for both individual device control and batch controls.
Note:
... |
python | def prepare(cls, value, length=0, position=0, is_last_data=True):
"""Prepare Lob header.
Note that the actual lob data is NOT written here but appended after the parameter block for each row!
"""
hstruct = WriteLobHeader.header_struct
lob_option_dataincluded = WriteLobHeader.LOB_... |
java | public boolean followsForAllOffsetTypesInBoth(final OffsetGroup other) {
return charOffset().follows(other.charOffset())
&& edtOffset().follows(other.edtOffset())
&& (!byteOffset().isPresent() || !other.byteOffset().isPresent()
|| byteOffset().get().follows(other.byteOffset().get()))... |
java | private LocalDate zGetParentSelectedDate() {
if (!hasParent()) {
return null;
}
boolean useDatePicker = (parentDatePicker != null);
return (useDatePicker) ? parentDatePicker.getDate() : parentCalendarPanel.getSelectedDate();
} |
java | private FileStatus[] findAllRaw(String segmentName) throws IOException {
assert segmentName != null && segmentName.length() > 0 : "segmentName must be non-null and non-empty";
String pattern = String.format(NAME_FORMAT, getPathPrefix(segmentName), SUFFIX_GLOB_REGEX);
FileStatus[] files = this.fi... |
java | public void sendClose() throws IOException {
closeReason = "";
closeCode = CloseMessage.NORMAL_CLOSURE;
StreamSinkFrameChannel closeChannel = send(WebSocketFrameType.CLOSE);
closeChannel.shutdownWrites();
if (!closeChannel.flush()) {
closeChannel.getWriteSetter().set(... |
java | public void marshall(SkillSummary skillSummary, ProtocolMarshaller protocolMarshaller) {
if (skillSummary == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(skillSummary.getSkillId(), SKILLID_BINDING)... |
java | public DescribeReservedNodeOfferingsResult withReservedNodeOfferings(ReservedNodeOffering... reservedNodeOfferings) {
if (this.reservedNodeOfferings == null) {
setReservedNodeOfferings(new com.amazonaws.internal.SdkInternalList<ReservedNodeOffering>(reservedNodeOfferings.length));
}
... |
java | public static BigDecimal log(BigDecimal x, MathContext mathContext) {
checkMathContext(mathContext);
if (x.signum() <= 0) {
throw new ArithmeticException("Illegal log(x) for x <= 0: x = " + x);
}
if (x.compareTo(ONE) == 0) {
return ZERO;
}
BigDecimal result;
switch (x.compareTo(TEN)) {
case 0:
... |
java | public void sendMessage(Message message) throws RemoteException
{
BaseTransport transport = this.createProxyTransport(SEND_MESSAGE);
transport.addParam(MESSAGE, message); // Don't use COMMAND
transport.sendMessageAndGetReply();
} |
java | protected HttpUriRequest setupRequest(final String path, final String method, final Map<String, Object> params) {
final HttpUriRequest request = buildMethod(method, path, params);
request.addHeader(new BasicHeader("Accept", "application/json"));
request.addHeader(new BasicHeader("Accept-Charset"... |
java | public static StringTemplateGroup readStringTemplateGroup(InputStream stream) {
try {
return new StringTemplateGroup(
new InputStreamReader(stream, "UTF-8"),
DefaultTemplateLexer.class,
new StringTemplateErrorListener() {
@Suppres... |
java | public static NumberFormat getNumberFormat(final Element element) {
if (XMLTags.FORMAT.equals(element.getName())) {
return createNumberFormat(element);
}
Element child = element.getChild(XMLTags.FORMAT);
if (child != null) {
return createNumberFormat(child);
}
return getNumberFormat(element.ge... |
python | def create_output(self, key, value, variable_type=None):
"""Wrapper for Create method of CRUD operation for working with KeyValue DB.
This method will automatically check to see if provided variable was requested by
a downstream app and if so create the data in the KeyValue DB.
Args:
... |
python | def fetch(self):
"""
Fetch a ExecutionStepInstance
:returns: Fetched ExecutionStepInstance
:rtype: twilio.rest.studio.v1.flow.execution.execution_step.ExecutionStepInstance
"""
params = values.of({})
payload = self._version.fetch(
'GET',
... |
python | def dump_next(self):
"""Dump the next reading from the stream.
Returns:
IOTileReading: The next reading or None if there isn't one
"""
if self.dump_walker is None:
return pack_error(ControllerSubsystem.SENSOR_LOG, SensorLogError.STREAM_WALKER_NOT_INITIALIZED)
... |
java | public boolean checkResources(Map<String, OrientPermission[]> resources, Action action)
{
for (Map.Entry<String, OrientPermission[]> entry : resources.entrySet()) {
if(!checkResource(entry.getKey(), action, entry.getValue())) return false;
}
return true;
} |
python | def unpack_attribute(att):
"""Unpack an embedded attribute into a python or numpy object."""
if att.unsigned:
log.warning('Unsupported unsigned attribute!')
# TDS 5.0 now has a dataType attribute that takes precedence
if att.len == 0: # Empty
val = None
elif att.dataType == stream.... |
java | protected Select addElement(final AbstractElement<?> _element)
{
this.noSquashRequired = this.noSquashRequired && !(_element instanceof ISquash);
if (!this.elements.isEmpty()) {
final AbstractElement<?> prev = this.elements.get(this.elements.size() - 1);
_element.setPrevious(... |
java | public static HttpHost getHost(HttpRequest request) {
HttpHost httpHost = UriUtils.extractHost(request.getRequestLine().getUri());
String scheme = httpHost.getSchemeName();
String host = httpHost.getHostName();
int port = httpHost.getPort();
Header[] headers = request.getHeaders(... |
java | public boolean unbindFromApplication( String externalExportPrefix, String applicationName ) {
boolean result = false;
Set<String> bounds = this.applicationBindings.get( externalExportPrefix );
if( bounds != null ) {
result = bounds.remove( applicationName );
if( bounds.isEmpty())
this.applicationBindin... |
java | private Object registeredObjectRead(int handle) throws InvalidObjectException {
Object res = objectsRead.get(handle - ObjectStreamConstants.baseWireHandle);
if (res == UNSHARED_OBJ) {
throw new InvalidObjectException("Cannot read back reference to unshared object");
}
return ... |
java | public void getInterestingObjects (ArrayList<ObjectInfo> list)
{
for (Iterator<Section> iter = getSections(); iter.hasNext(); ) {
Section sect = iter.next();
for (ObjectInfo element : sect.objectInfo) {
list.add(element);
}
}
} |
python | def set_chain_info(self, chain_id, chain_name, num_groups):
"""Set the chain information.
:param chain_id: the asym chain id from mmCIF
:param chain_name: the auth chain id from mmCIF
:param num_groups: the number of groups this chain has
"""
self.chain_id_list.append(cha... |
java | protected void installLooseConfigEar(MavenProject proj, LooseConfigData config) throws Exception {
LooseEarApplication looseEar = new LooseEarApplication(proj, config);
looseEar.addSourceDir();
looseEar.addApplicationXmlFile();
Set<Artifact> artifacts = proj.getArtifacts();
log.... |
java | public Stream<Note> getMergeRequestNotesStream(Object projectIdOrPath, Integer mergeRequestIid) throws GitLabApiException {
return (getMergeRequestNotes(projectIdOrPath, mergeRequestIid, null, null, getDefaultPerPage()).stream());
} |
python | def _reserve(self, key):
"""
Reserve a component's binding temporarily.
Protects against cycles.
"""
self.assign(key, RESERVED)
try:
yield
finally:
del self._cache[key] |
java | @Override
public void handle(@Nonnull final Object message, @Nullable final Map<String, Object> headers) throws InvocationTargetException, IllegalAccessException {
checkNotNull(message, "Message to handle must not be null.");
handle(message, headers, null);
} |
python | def flushall(host=None, port=None, db=None, password=None):
'''
Remove all keys from all databases
CLI Example:
.. code-block:: bash
salt '*' redis.flushall
'''
server = _connect(host, port, db, password)
return server.flushall() |
java | private void tfJavaFieldNameActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_tfJavaFieldNameActionPerformed
{//GEN-HEADEREND:event_tfJavaFieldNameActionPerformed
// Commit value if ENTER is typed
aRelation.setFieldName(tfJavaFieldName.getText());
} |
python | def get_edge_string(self, i):
"""Return a string based on the bond order"""
order = self.orders[i]
if order == 0:
return Graph.get_edge_string(self, i)
else:
# pad with zeros to make sure that string sort is identical to number sort
return "%03i" % ord... |
java | static String rewriteRule(String vcalText) {
Matcher m = VCAL_RRULE.matcher(vcalText.trim());
if (!m.matches()) {
return vcalText;
}
StringBuilder sb = new StringBuilder();
String nameAndParams = m.group(1),
freq = m.group(2).toUpperCase(),
... |
python | def _effectupdate_raise_line_padding_on_focus(self, time_passed):
"""Gradually enlarge the padding of the focused line."""
data = self._effects['raise-line-padding-on-focus']
pps = data['padding_pps']
for i, option in enumerate(self.options):
if i == self.option:
... |
java | public static boolean isNodeAfter(Node node1, Node node2)
{
// Assume first that the nodes are DTM nodes, since discovering node
// order is massivly faster for the DTM.
if(node1 instanceof DOMOrder && node2 instanceof DOMOrder)
{
int index1 = ((DOMOrder) node1).getUid();
int index2 = ((... |
python | def dest_ports(self):
"""
Destination ports for this blacklist entry. If no ports are specified,
'ANY' is returned.
:rtype: str
"""
start_port = self.blacklist.get('BlacklistEntryDestinationPort')
if start_port is not None:
return '{}-{}'.form... |
java | private static boolean isPersistedInOtherTable(Attribute attr) {
boolean bidirectionalOneToMany = attr.getDataType() == ONE_TO_MANY && attr.isMappedBy();
return isMultipleReferenceType(attr) || bidirectionalOneToMany;
} |
java | @Override
public Object eval(Reader reader, ScriptContext context) throws ScriptException {
try {
return eval(IOUtil.toString(reader), context);
}
catch (IOException ioe) {
throw toScriptException(ioe);
}
} |
python | def name_for(obj):
"""
Get a name for something.
Allows overriding of default names using the `__alias__` attribute.
"""
if isinstance(obj, str):
return obj
cls = obj if isclass(obj) else obj.__class__
if hasattr(cls, "__alias__"):
return underscore(cls.__alias__)
els... |
python | def new_chain(table='filter', chain=None, family='ipv4'):
'''
.. versionadded:: 2014.1.0
Create new custom chain to the specified table.
CLI Example:
.. code-block:: bash
salt '*' iptables.new_chain filter CUSTOM_CHAIN
IPv6:
salt '*' iptables.new_chain filter CUSTOM_CHAI... |
python | def _to_DOM(self):
"""
Dumps object data to a fully traversable DOM representation of the
object.
:returns: a ``xml.etree.Element`` object
"""
last_weather = None
if (self._last_weather
and isinstance(self._last_weather, weather.Weather)):
... |
java | @Override
public void activate(RuleBlock ruleBlock) {
if (FuzzyLite.isDebugging()) {
FuzzyLite.logger().log(Level.FINE, "Activation: {0} {1}",
new String[]{getClass().getName(), parameters()});
}
TNorm conjunction = ruleBlock.getConjunction();
SNorm di... |
python | def groupmember_get(self, manager_id, session):
'''taobao.wangwang.eservice.groupmember.get 获取组成员列表
用某个组管理员账号查询,返回该组组名、和该组所有组成员ID(E客服的分流设置)。 用旺旺主帐号查询,返回所有组的组名和该组所有组成员ID。 返回的组成员ID可以是多个,用 "," 隔开。 被查者ID只能传入一个。 组成员中排名最靠前的ID是组管理员ID'''
request = TOPRequest('taobao.wangwang.eservice.groupmembe... |
python | def _get_stream_metadata(self, use_cached):
"""Retrieve metadata about this stream from Device Cloud"""
if self._cached_data is None or not use_cached:
try:
self._cached_data = self._conn.get_json("/ws/DataStream/%s" % self._stream_id)["items"][0]
except DeviceClo... |
python | def stats(self, **kwargs):
"""
Stream statistics for this container. Similar to the
``docker stats`` command.
Args:
decode (bool): If set to true, stream will be decoded into dicts
on the fly. Only applicable if ``stream`` is True.
False by de... |
java | public <T> boolean isDependentScopedStrict(final Class<T> type) {
Bean<T> bean = resolveStrict(manager, type);
if (bean != null) {
return Dependent.class.equals(bean.getScope());
}
return false;
} |
python | def write(self, message, flush=True):
"""
Function: write
Summary: write method on the default stream
Examples: >>> stream.write('message')
'message'
Attributes:
@param (message): str-like content to send on stream
@param (flush) default=... |
java | public JMethod getMethod(String name, JClass []types)
{
JClassLoader jClassLoader = getClassLoader();
return getMethod(_class, name, types, jClassLoader);
} |
python | def pycbc_compile_function(code,arg_names,local_dict,global_dict,
module_dir,
compiler='',
verbose=1,
support_code=None,
headers=None,
customize=None,
type_converters=None,
... |
python | def get_missing(self, verify_file):
"""
Use a verification configuration which has a list of required options
and their respective types. This information is used to identify missing
and incompatible options in the loaded configuration.
:param str verify_file: The file to load for verification data.
:retur... |
java | private String addIndexInputToList(String name, IndexInput in,
String postingsFormatName) throws IOException {
if (indexInputList.get(name) != null) {
indexInputList.get(name).close();
}
if (in != null) {
String localPostingsFormatName = postingsFormatName;
if (localPostingsFormatNam... |
python | def cli(env, access_id, password):
"""Changes a password for a volume's access.
access id is the allowed_host_id from slcli block access-list
"""
block_manager = SoftLayer.BlockStorageManager(env.client)
result = block_manager.set_credential_password(access_id=access_id, password=password)
i... |
java | public static Servlet wrap(Servlet servlet) {
Require.nonNull(servlet, "servlet");
if (servlet instanceof TinyPlugzContextServlet) {
return servlet;
}
return new TinyPlugzContextServlet(servlet);
} |
python | def is_total_slice(item, shape):
"""Determine whether `item` specifies a complete slice of array with the
given `shape`. Used to optimize __setitem__ operations on the Chunk
class."""
# N.B., assume shape is normalized
if item == Ellipsis:
return True
if item == slice(None):
re... |
java | @SuppressWarnings({"unused", "WeakerAccess"})
public void pushEvent(String eventName) {
if (eventName == null || eventName.trim().equals(""))
return;
pushEvent(eventName, null);
} |
python | def resolve_import(name, is_from, is_star):
"""Use python to resolve an import.
Args:
name: The fully qualified module name.
Returns:
The path to the module source file or None.
"""
# Don't try to resolve relative imports or builtins here; they will be
# handled by resolve.Resolver... |
python | def handle(self, request, buffer_size):
"""
Handle a message
:param request: the request socket.
:param buffer_size: the buffer size.
:return: True if success, False otherwise
"""
if self.component_type == StreamComponent.SOURCE:
msg = self.handler_fu... |
java | public void marshall(UpdateGlobalTableRequest updateGlobalTableRequest, ProtocolMarshaller protocolMarshaller) {
if (updateGlobalTableRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(updateG... |
java | public static void assertLogNormalized(double[] logProps, double delta) {
double logPropSum = DoubleArrays.logSum(logProps);
assert(Primitives.equals(0.0, logPropSum, delta));
} |
python | def cigarWrite(fileHandle, pairwiseAlignment, withProbs=True):
"""Writes out the pairwiseAlignment to the file stream.
Query and target are reversed from normal order.
"""
if len(pairwiseAlignment.operationList) == 0:
logger.info("Writing zero length pairwiseAlignment to file!")
strand1 = ... |
python | def containerIsRunning(container_name):
"""
Checks whether the container is running or not.
:param container_name: Name of the container being checked.
:returns: True if status is 'running', False if status is anything else,
and None if the container does not exist.
"""
client = docker.from_... |
python | def create_placeholder_access_object(self, instance):
"""
Created objects with placeholder slots as properties.
Each placeholder created for an object will be added to a
`PlaceHolderAccess` object as a set property.
"""
related_model = self.related_model
def get... |
java | public static String generateMatchStrictSubclassesPattern(URI origin,
String matchVariable,
String flagVar,
boolean includeUrisBound) ... |
java | @Override
public long dynamicQueryCount(DynamicQuery dynamicQuery,
Projection projection) {
return commerceNotificationQueueEntryPersistence.countWithDynamicQuery(dynamicQuery,
projection);
} |
java | public String bannerText() {
if (null != bannerText) return bannerText;
String bannerPath = environment.get(ENV_KEY_BANNER_PATH, null);
if (StringKit.isEmpty(bannerPath) || Files.notExists(Paths.get(bannerPath))) {
return null;
}
try {
BufferedReader buf... |
python | def _parse_params(self, params=None):
"""
Parse parameters.
Combine default and user-defined parameters.
"""
prm = self.default_params.copy()
if params is not None:
prm.update(params)
if prm["background"]:
# Absolute path, just to be su... |
java | public Collection<Set<E>> allNonTrivialEquivalenceClasses() {
Relation<E,E> relRepr2Elems = new MapSetRelation<E,E>();
for (E elem : elmap.keySet()) {
E repr = find(elem);
relRepr2Elems.add(repr, elem);
}
List<Set<E>> result = new LinkedList<Set<E>>();
for(E repr : relRepr2Elems.keys()) {
Set<E> equ... |
python | def template_links(request, app, template_name, context=None, group=None, force=True):
'''
Returns the HTML for the given provider group, using an app and template name.
This method should not normally be used (use links() instead). The use of
this method is when provider need to be called from regular... |
python | def insert(self, i, record):
"""Insert a record at the given position. The first argument
*i* is the index of the record before which to insert, so
message.insert(0, record) inserts at the front of the message,
and message.insert(len(message), record) is equivalent to
message.app... |
python | def set_process_sort(self, event_type):
"""Define the process auto sort key from the alert type."""
if glances_processes.auto_sort:
glances_processes.sort_key = self.get_event_sort_key(event_type) |
python | def _call_pyfftw(self, x, out, **kwargs):
"""Implement ``self(x[, out, **kwargs])`` using pyfftw.
Parameters
----------
x : `domain` element
Input element to be transformed.
out : `range` element
Output element storing the result.
flags : sequence... |
python | def cli(obj, resource, event, environment, severity, correlate, service, group, value, text, tags, attributes, origin, type, timeout, raw_data, customer):
"""Send an alert."""
client = obj['client']
def send_alert(resource, event, **kwargs):
try:
id, alert, message = client.send_alert(
... |
java | protected Component newButtonBar(String s) {
buttonBar = new AjaxWizardButtonBar(s, this) {
public void onCancel(AjaxRequestTarget target) {
EntityBrowserPanel panel = findParent(EntityBrowserPanel.class);
panel.backwardWorkspace(target);
}
... |
java | @Override
public void stop()
{
super.stop();
if (connectorServer != null)
{
try
{
connectorServer.stop();
}
catch (Exception e)
{
log.error("Could not stop JMX connector server",e);
}
... |
python | def evaluate(expr, **variables):
"""
>>> evaluate('2**6')
64
>>> evaluate('1 + 2*3**(2 + 2) / (6 + -7)')
-161.0
>>> evaluate('5 < 4')
False
>>> evaluate('5 < a < 10', a=6)
True
"""
module = ast.parse(expr) # Module(body=[Expr(value=...)])
if len(module.body) != 1:
... |
python | def _render_with_context(self, parsed_node, config):
"""Given the parsed node and a SourceConfig to use during parsing,
render the node's sql wtih macro capture enabled.
Note: this mutates the config object when config() calls are rendered.
"""
context = dbt.context.parser.gener... |
python | def save(self, other: merkle_tree.MerkleTree):
"""Save this tree into a dumb data object for serialisation.
The object must have attributes tree_size:int and hashes:list.
"""
other.__tree_size = self.__tree_size
other.__hashes = self.__hashes |
java | public java.util.List<ComplianceByConfigRule> getComplianceByConfigRules() {
if (complianceByConfigRules == null) {
complianceByConfigRules = new com.amazonaws.internal.SdkInternalList<ComplianceByConfigRule>();
}
return complianceByConfigRules;
} |
python | def make_table(headers, lines, prefix=None):
"""
Generates an ASCII table according to the given headers and lines
:param headers: List of table headers (N-tuple)
:param lines: List of table lines (N-tuples)
:param prefix: Optional prefix for each line
:return: The ASCII... |
java | public static <U, V, T> StreamEx<T> zip(U[] first, V[] second, BiFunction<? super U, ? super V, ? extends T> mapper) {
return zip(Arrays.asList(first), Arrays.asList(second), mapper);
} |
java | protected OmemoRatchet<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey, T_Sess, T_Addr, T_ECPub, T_Bundle, T_Ciph>
getOmemoRatchet(OmemoManager manager) {
OmemoRatchet<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey, T_Sess, T_Addr, T_ECPub, T_Bundle, T_Ciph>
omemoRatchet = omemoRatchets.get(manager... |
java | public final EObject ruleOptionValue() throws RecognitionException {
EObject current = null;
Token lv_key_0_0=null;
Token otherlv_1=null;
Token otherlv_3=null;
AntlrDatatypeRuleToken lv_value_2_0 = null;
enterRule();
try {
// Internal... |
python | def _combined_items(self):
"""Returns a dictionary with this object's properties merged with all its parent's
properties.
The returned dictionary is all the available properties for this object (and their
associated values).
"""
result = dict(self._items)
par = s... |
python | def chunks(self,local,cutter_callback=None,*cutter_callback_args,**cutter_callback_kwargs):
""" Takes a time range and returns sub timeranges based upon
the cuts that cutter callback provides
:param local: if False [default] use UTC datetime. If True use localtz
:param cutte... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.