language stringclasses 2
values | func_code_string stringlengths 63 466k |
|---|---|
python | def register_property(self, name, dtype, default, **kwargs):
"""
Registers a property with this Solver object
.. code-block:: python
cube.register_property("reference_frequency", np.float64, 1.4e9)
Parameters
----------
name : str
The name of th... |
python | def Incr(self, x, term=1):
"""Increments the freq/prob associated with the value x.
Args:
x: number value
term: how much to increment by
"""
self.d[x] = self.d.get(x, 0) + term |
python | def get_id2children(objs):
"""Get all parent item IDs for each item in dict keys."""
id2children = {}
for obj in objs:
_get_id2children(id2children, obj.item_id, obj)
return id2children |
python | def wipe_task(self, courseid, taskid):
""" Wipe the data associated to the taskid from DB"""
submissions = self.database.submissions.find({"courseid": courseid, "taskid": taskid})
for submission in submissions:
for key in ["input", "archive"]:
if key in submission and... |
python | def _concat_sparse(to_concat, axis=0, typs=None):
"""
provide concatenation of an sparse/dense array of arrays each of which is a
single dtype
Parameters
----------
to_concat : array of arrays
axis : axis to provide concatenation
typs : set of to_concat dtypes
Returns
-------
... |
java | public static BaseResult deviceDelete(String accessToken, DeviceDelete deviceDelete) {
return deviceDelete(accessToken, JsonUtil.toJSONString(deviceDelete));
} |
python | def with_port(self, port):
"""Return a new URL with port replaced.
Clear port to default if None is passed.
"""
# N.B. doesn't cleanup query/fragment
if port is not None and not isinstance(port, int):
raise TypeError("port should be int or None, got {}".format(type(... |
python | def output_file(self, filename, title="Bokeh Plot", mode="cdn", root_dir=None):
''' Configure output to a standalone HTML file.
Calling ``output_file`` not clear the effects of any other calls to
``output_notebook``, etc. It adds an additional output destination
(publishing to HTML file... |
java | @Override
protected void updateFaxJobWithFileInfo(FaxJob faxJob,FileInfo fileInfo)
{
//get file
File file=fileInfo.getFile();
if(file==null)
{
//get file name
String fileName=fileInfo.getName();
//get file content
byte... |
java | public static String getRequestEncoding(ServletRequest request) {
String requestEncoding = request.getCharacterEncoding();
return requestEncoding != null ? requestEncoding : DEFAULT_REQUEST_ENCODING;
} |
python | def select(self, ids, do_emit=True, **kwargs):
"""Select some rows in the table.
By default, the `select` event is raised, unless `do_emit=False`.
"""
# Select the rows without emiting the event.
self.eval_js('table.select({}, false);'.format(dumps(ids)))
if do_emit:
... |
python | def _match_datetime_pattern(self, tokens):
"""
Match the datetime pattern at the beginning of the token list.
There are several formats that this method needs to understand
and distinguish between (see MongoDB's SERVER-7965):
ctime-pre2.4 Wed Dec 31 19:00:00
ctime ... |
java | private void initStorage() {
if (this.storage != null) {
return;
}
if (storageOptions == null) {
this.storage = StorageOptions.getDefaultInstance().getService();
} else {
this.storage = storageOptions.getService();
}
} |
java | public Alias getAlias(String aliasName) {
Alias result = null;
for (Alias item : getAliasesList()) {
if (item.getName().equals(aliasName)) {
result = item;
}
}
return result;
} |
python | def endure_multi(self, keys, persist_to=-1, replicate_to=-1,
timeout=5.0, interval=0.010, check_removed=False):
"""Check durability requirements for multiple keys
:param keys: The keys to check
The type of keys may be one of the following:
* Sequence of keys
... |
python | def serve(port, no_livereload, open_url):
"""Serve the site """
engine = Yass(CWD)
if not port:
port = engine.config.get("local_server.port", 8000)
if no_livereload is None:
no_livereload = True if engine.config.get("local_server.livereload") is False else False
if open_url is None:... |
java | public Map<String, CmsCategory> getReadCategory() {
if (null == m_categories) {
m_categories = CmsCollectionsGenericWrapper.createLazyMap(new Transformer() {
public Object transform(Object categoryPath) {
try {
CmsCategoryService catServ... |
java | @FFDCIgnore(IllegalStateException.class)
private void removeShutdownHook() {
if (shutdownHook != null) {
try {
Runtime.getRuntime().removeShutdownHook(shutdownHook);
} catch (IllegalStateException e) {
// do nothing.
}
}
} |
java | protected void renderColumnFooterCell(FacesContext facesContext, ResponseWriter writer, UIComponent uiComponent,
UIComponent facet, String footerStyleClass, int colspan) throws IOException
{
writer.startElement(HTML.TD_ELEM, null); // uiComponent);
if (colspan > 1)
{
writ... |
java | protected final void clearAuthenticationAttributes() {
HttpSession session = http.getCurrentRequest().getSession(false);
if (session == null) {
return;
}
session.removeAttribute(WebAttributes.AUTHENTICATION_EXCEPTION);
} |
python | def _set_ipv6_address(self, v, load=False):
"""
Setter method for ipv6_address, mapped from YANG variable /interface/management/ipv6/ipv6_address (string)
If this variable is read-only (config: false) in the
source YANG file, then _set_ipv6_address is considered as a private
method. Backends looking... |
java | public IAsmListElementsUml<IAsmElementUmlInteractive<ShapeFullVarious<InstanceUml>, DRI, SD, PRI>, DRI, SD, IMG, PRI, ShapeFullVarious<InstanceUml>> getAsmListAsmInstancesFull() {
return asmListAsmInstancesFull;
} |
java | public <T> void cleanNullReferences(Class<T> clazz) {
Map<Object, Reference<Object>> objectMap = getMapForClass(clazz);
if (objectMap != null) {
cleanMap(objectMap);
}
} |
python | def _get_auth_from_netrc(self, hostname):
"""Try to find login auth in ``~/.netrc``."""
try:
hostauth = netrc(self.NETRC_FILE)
except IOError as cause:
if cause.errno != errno.ENOENT:
raise
return None
except NetrcParseError as cause:
... |
java | public java.util.List<ReservedInstances> getReservedInstances() {
if (reservedInstances == null) {
reservedInstances = new com.amazonaws.internal.SdkInternalList<ReservedInstances>();
}
return reservedInstances;
} |
python | def set_vm_status(self, device='FLOPPY',
boot_option='BOOT_ONCE', write_protect='YES'):
"""Sets the Virtual Media drive status
It sets the boot option for virtual media device.
Note: boot option can be set only for CD device.
:param device: virual media device
... |
python | def add_data(self, t, msg, vars, flightmode):
'''add some data'''
mtype = msg.get_type()
if self.flightmode is not None and (len(self.modes) == 0 or self.modes[-1][1] != flightmode):
self.modes.append((t, flightmode))
for i in range(0, len(self.fields)):
if mtype ... |
java | public Coordinate[] getCoordinates() {
if (isEmpty()) {
return null;
}
Coordinate[] coordinates = new Coordinate[points.length];
for (int i = 0; i < points.length; i++) {
coordinates[i] = points[i].getCoordinate();
}
return coordinates;
} |
python | def _base_body(self):
"""Return the base XML body, which has the following form:
.. code :: xml
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Header>
<credentials xmlns="http://www.sonos.com/Services/1.1">
<sessionId>self._session_i... |
python | def _set_collection(self, v, load=False):
"""
Setter method for collection, mapped from YANG variable /interface/fortygigabitethernet/rmon/collection (container)
If this variable is read-only (config: false) in the
source YANG file, then _set_collection is considered as a private
method. Backends lo... |
java | private boolean htmlSentenceTerminatorFound(String str, int index) {
for (int i = 0; i < sentenceTerminators.length; i++) {
String terminator = sentenceTerminators[i];
if (str.regionMatches(true, index, terminator,
0, terminator.length())) {
... |
python | def com_google_fonts_check_family_panose_familytype(ttFonts):
"""Fonts have consistent PANOSE family type?"""
failed = False
familytype = None
for ttfont in ttFonts:
if familytype is None:
familytype = ttfont['OS/2'].panose.bFamilyType
if familytype != ttfont['OS/2'].panose.bFamilyType:
fail... |
python | def parse_external_id(output, type=EXTERNAL_ID_TYPE_ANY):
"""
Attempt to parse the output of job submission commands for an external id.__doc__
>>> parse_external_id("12345.pbsmanager")
'12345.pbsmanager'
>>> parse_external_id('Submitted batch job 185')
'185'
>>> parse_external_id('Submitte... |
python | def _set_cspf_group_ip(self, v, load=False):
"""
Setter method for cspf_group_ip, mapped from YANG variable /mpls_config/router/mpls/mpls_cmds_holder/cspf_group/cspf_group_ip (list)
If this variable is read-only (config: false) in the
source YANG file, then _set_cspf_group_ip is considered as a private
... |
python | def file_flags(self):
"""Return the file flags attribute of the BFD file being processed."""
if not self._ptr:
raise BfdException("BFD not initialized")
return _bfd.get_bfd_attribute(self._ptr, BfdAttributes.FILE_FLAGS) |
python | def _get_split_tasks(args, split_fn, file_key, outfile_i=-1):
"""Split up input files and arguments, returning arguments for parallel processing.
outfile_i specifies the location of the output file in the arguments to
the processing function. Defaults to the last item in the list.
"""
split_args = ... |
python | def filter(self, record):
"""Is the specified record to be logged? Returns zero for no,
nonzero for yes. If deemed appropriate, the record may be modified
in-place by this method.
:param logging.LogRecord record: The log record to process
:rtype: int
"""
if self... |
java | private void readTrailer(final GZIPArchive.ReadEntry entry) throws IOException {
// CRC32
entry.crc32 = readLEInt(input);
if (LOGGER.isTraceEnabled()) LOGGER.trace("CRC read from stream {}", Integer.valueOf(entry.crc32));
// ISIZE
final int iSize = readLEInt(input);
if (entry.uncompressedSkipLength != i... |
java | public com.google.appengine.v1.ManualScaling getManualScaling() {
if (scalingCase_ == 5) {
return (com.google.appengine.v1.ManualScaling) scaling_;
}
return com.google.appengine.v1.ManualScaling.getDefaultInstance();
} |
python | def overwrites_for(self, obj):
"""Returns the channel-specific overwrites for a member or a role.
Parameters
-----------
obj
The :class:`Role` or :class:`abc.User` denoting
whose overwrite to get.
Returns
---------
:class:`PermissionOverw... |
python | def get_sunset_time(self, timeformat='unix'):
"""Returns the GMT time of sunset
:param timeformat: the format for the time value. May be:
'*unix*' (default) for UNIX time or '*iso*' for ISO8601-formatted
string in the format ``YYYY-MM-DD HH:MM:SS+00``
:type timeformat: s... |
python | def layout_padding(plots, renderer):
"""
Pads Nones in a list of lists of plots with empty plots.
"""
widths, heights = defaultdict(int), defaultdict(int)
for r, row in enumerate(plots):
for c, p in enumerate(row):
if p is not None:
width, height = renderer.get_si... |
java | private AbsAxis parseReverceAxis() {
AbsAxis axis;
if (is("parent", true)) {
axis = new ParentAxis(getTransaction());
} else if (is("ancestor", true)) {
axis = new AncestorAxis(getTransaction());
} else if (is("ancestor-or-self", true)) {
axis = ... |
python | def setProfile(self, profile):
"""
Sets the profile linked with this action.
:param profile | <projexui.widgets.xviewwidget.XViewProfile>
"""
self._profile = profile
# update the interface
self.setIcon(profile.icon())
self.... |
java | public boolean eq(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (this._getUsefulClass() != obj.getClass())
return false;
Model<?> other = (Model<?>) obj;
Table tableinfo = this.table();
Set<Entry... |
python | def list_tickets(self, open_status=True, closed_status=True):
"""List all tickets.
:param boolean open_status: include open tickets
:param boolean closed_status: include closed tickets
"""
mask = """mask[id, title, assignedUser[firstName, lastName], priority,
c... |
python | def _combine_out_files(chr_files, work_dir, data):
"""Concatenate all CNV calls into a single file.
"""
out_file = "%s.bed" % sshared.outname_from_inputs(chr_files)
if not utils.file_exists(out_file):
with file_transaction(data, out_file) as tx_out_file:
with open(tx_out_file, "w") a... |
java | public User generateSession(String requestToken, String apiSecret) throws KiteException, JSONException, IOException {
// Create the checksum needed for authentication.
String hashableText = this.apiKey + requestToken + apiSecret;
String sha256hex = sha256Hex(hashableText);
// Create JS... |
java | private static String extractName(final Field fieldReference) {
com.couchbase.client.java.repository.annotation.Field annotation =
fieldReference.getAnnotation(com.couchbase.client.java.repository.annotation.Field.class);
if (annotation == null || annotation.value() == null || annotation.val... |
java | public static <T> Workbook writeWorkBook(Workbook workbook, List<T> beans, String dateFormat) {
if (beans == null || beans.isEmpty()) {
return workbook;
}
Map<String, Object> map = null;
if (beans.get(0) instanceof Map) {
map = (Map<String, Object>) beans.get(0);
... |
java | public List<RestorePointInner> listByDatabase(String resourceGroupName, String serverName, String databaseName) {
return listByDatabaseWithServiceResponseAsync(resourceGroupName, serverName, databaseName).toBlocking().single().body();
} |
python | def _create_xml_node(tag, prefix=None, ns=None):
"""Create a XML node."""
if prefix and ns:
ET.register_namespace(prefix, ns)
if ns:
return ET.Element("{"+ns+"}"+tag)
else:
return ET.Element(tag) |
python | def autoencoder_ordered_text_small():
"""Ordered discrete autoencoder model for text, small version."""
hparams = autoencoder_ordered_text()
hparams.bottleneck_bits = 32
hparams.num_hidden_layers = 3
hparams.hidden_size = 64
hparams.max_hidden_size = 512
hparams.bottleneck_noise = 0.0
hparams.autoregres... |
java | public EClass getGPARC() {
if (gparcEClass == null) {
gparcEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(AfplibPackage.eNS_URI).getEClassifiers().get(459);
}
return gparcEClass;
} |
python | def _check_for_pi_nodes(self, list, inheader):
'''Raise an exception if any of the list descendants are PI nodes.
'''
list = list[:]
while list:
elt = list.pop()
t = elt.nodeType
if t == _Node.PROCESSING_INSTRUCTION_NODE:
raise ParseExc... |
java | void setState(final WidgetState.State state) {
Log.d(TAG, "setState(%s): state is %s, setting to %s", mWidget.getName(), mState, state);
if (state != mState) {
final WidgetState.State nextState = getNextState(state);
Log.d(TAG, "setState(%s): next state '%s'", mWidget.getName(), ... |
python | def setup_dummy_social_apps(sender, **kwargs):
"""
`allauth` needs tokens for OAuth based providers. So let's
setup some dummy tokens
"""
from allauth.socialaccount.providers import registry
from allauth.socialaccount.models import SocialApp
from allauth.socialaccount.providers.oauth.provide... |
python | def encode(self):
"""
Return binary string representation of object.
:rtype: str
"""
buf = bytearray()
for typ in sorted(self.format.keys()):
encoded = None
if typ != 0xFFFF: # end of block
(name, marshall) = self.format[ty... |
java | public Observable<ServiceResponse<UUID>> createEntityRoleWithServiceResponseAsync(UUID appId, String versionId, UUID entityId, CreateEntityRoleOptionalParameter createEntityRoleOptionalParameter) {
if (this.client.endpoint() == null) {
throw new IllegalArgumentException("Parameter this.client.endpoi... |
python | def quadraticSolver(a, b, c):
"""return solution(s) for x, to the quadratic equation a*x^2 + b*x + c
when it equals zero using the quadratic formula"""
if a == 0:
if b == 0: return [] # attempting to solve an equation with infinite (0=0) or impossible (0=3) solutions for x
else: retur... |
java | @Override
public EClass getIfcBeam() {
if (ifcBeamEClass == null) {
ifcBeamEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI).getEClassifiers()
.get(38);
}
return ifcBeamEClass;
} |
python | def read_tabular(table_file, sheetname='Sheet1'):
"""
Reads a vensim syntax model which has been formatted as a table.
This is useful in contexts where model building is performed
without the aid of Vensim.
Parameters
----------
table_file: .csv, .tab or .xls(x) file
Table should have... |
java | public void shutdownBlocking() throws InterruptedException
{
executor.shutdown();
executor.awaitTermination();
allocator.shutdown();
allocator.awaitTermination();
} |
python | def check_columns(column, line, columns):
"""
Make sure the column is the minimum between the largest column asked
for and the max column available in the line.
"""
return column <= min(len(line), max(columns)) |
python | def dedup_bam(in_bam, data):
"""Perform non-stream based deduplication of BAM input files using biobambam.
"""
if _check_dedup(data):
out_file = os.path.join(utils.safe_makedir(os.path.join(os.getcwd(), "align", dd.get_sample_name(data))),
"%s-dedup%s" % utils.splitex... |
java | public Path[] getFilePaths() {
if (supportsMultiPaths()) {
if (this.filePaths == null) {
return new Path[0];
}
return this.filePaths;
} else {
if (this.filePath == null) {
return new Path[0];
}
return new Path[] {filePath};
}
} |
python | def get_size(item):
"""Return size of an item of arbitrary type"""
if isinstance(item, (list, set, tuple, dict)):
return len(item)
elif isinstance(item, (ndarray, MaskedArray)):
return item.shape
elif isinstance(item, Image):
return item.size
if isinstance(item, (DataFrame, I... |
java | public List<String> getNonHubRoots() throws IOException {
List<String> nonHubRootsTemp = nonHubRoots;
if (nonHubRootsTemp == null) {
synchronized(ContextPaths.class) {
nonHubRootsTemp = nonHubRoots;
if (nonHubRootsTemp == null) {
nonHubRoot... |
python | def import_from_sqlite(
filename_or_connection,
table_name="table1",
query=None,
query_args=None,
*args,
**kwargs
):
"""Return a rows.Table with data from SQLite database."""
source = get_source(filename_or_connection)
connection = source.fobj
cursor = connection.cursor()
if... |
python | def update_default_iou_values(self):
"""
Finds the default RAM and NVRAM values for the IOU image.
"""
try:
output = yield from gns3server.utils.asyncio.subprocess_check_output(self._path, "-h", cwd=self.working_dir, stderr=True)
match = re.search("-n <n>\s+Size ... |
java | @Override
public void beforeFirst() {
currentScan = null;
s1.beforeFirst();
hasMore1 = s1.next();
if (s2 != null) {
s2.beforeFirst();
hasMore2 = s2.next();
}
} |
java | public int compareTo(final CharArrayList l) {
final int s1 = size(), s2 = l.size();
final char a1[] = a, a2[] = l.a;
char e1, e2;
int r, i;
for (i = 0; i < s1 && i < s2; i++) {
e1 = a1[i];
e2 = a2[i];
if ((r = (e1 - e2)) != 0) return r;
... |
java | public static long getTimestampMinusParameters(long targetTimestamp,
int numOfWeeks, int numOfDays, int numOfHours, int numOfMinutes,
int numOfSeconds) {
long sumOfParameters =
numOfWeeks * aWeek + numOfDays * aDay + numOfHours * anHour
+ numOfMinutes * aMinute + numOfSeconds * aSecond;
return targe... |
java | private void sendInitialConnectionWindow() throws Http2Exception {
if (ctx.channel().isActive() && initialConnectionWindow > 0) {
Http2Stream connectionStream = connection().connectionStream();
int currentSize = connection().local().flowController().windowSize(connectionStream);
int delta = initia... |
python | def split(self, pattern=None):
r"""
Break molecule up into constituent fragments.
By default (i.e., if `pattern` is `None`), each disconnected fragment
is returned as a separate new `Atoms` object. This uses OpenBabel
(through `OBMol.Separate`) and might not preserve atom order,... |
java | public ComputeNodeUploadBatchServiceLogsOptions withOcpDate(DateTime ocpDate) {
if (ocpDate == null) {
this.ocpDate = null;
} else {
this.ocpDate = new DateTimeRfc1123(ocpDate);
}
return this;
} |
python | def run(self):
""" Append version number to vegas/__init__.py """
with open('src/vegas/__init__.py', 'a') as vfile:
vfile.write("\n__version__ = '%s'\n" % VEGAS_VERSION)
_build_py.run(self) |
java | @Override
public R visitAssignment(AssignmentTree node, P p) {
R r = scan(node.getVariable(), p);
r = scanAndReduce(node.getExpression(), p, r);
return r;
} |
python | def chooseStep(self, divisors=None, binary=False):
"""Choose a nice, pretty size for the steps between axis labels.
Our main constraint is that the number of divisions must be taken
from the divisors list. We pick a number of divisions and a step
size that minimizes the amount of whites... |
java | public VersionDetails getVersionDetails(String versionURL, String authorizationToken) {
LOG.info("getVersionDetails with token: " + authorizationToken);
VersionDetailsResponse versionDetailsResponse = (VersionDetailsResponse) doRequest(new HttpGet(versionURL),
authorizationToken, VersionDetailsResponse.class)... |
python | def _parse_game_data(self, uri):
"""
Parses a value for every attribute.
This function looks through every attribute and retrieves the value
according to the parsing scheme and index of the attribute from the
passed HTML data. Once the value is retrieved, the attribute's value i... |
python | def add_item_metadata(self, handle, key, value):
"""Store the given key:value pair for the item associated with handle.
:param handle: handle for accessing an item before the dataset is
frozen
:param key: metadata key
:param value: metadata value
"""
... |
java | private void updateStyleForElement(RendererState state, SvgElementBase obj)
{
boolean isRootSVG = (obj.parent == null);
state.style.resetNonInheritingProperties(isRootSVG);
// Apply the styles defined by style attributes on the element
if (obj.baseStyle != null)
updateStyle(... |
python | def _setup_transport(self):
'''
Setup the transport.
'''
if 'RAW' in self.error_whitelist:
log.info('%s %d will publish partially parsed messages', self._transport_type, self.pub_id)
if 'UNKNOWN' in self.error_whitelist:
log.info('%s %d will publish unknow... |
java | public static IVdmMethodEntryBreakpoint createMethodEntryBreakpoint(
IResource resource, IPath path, int lineNumber, int charStart,
int charEnd, boolean register, Map<String, Object> attributes,
String methodName) throws CoreException
{
return new VdmMethodEntryBreakpoint(getDebugModelId(resource), resourc... |
java | public final void setLineDash(float[] array, float phase) {
content.append("[");
for (int i = 0; i < array.length; i++) {
content.append(array[i]);
if (i < array.length - 1) content.append(' ');
}
content.append("] ").append(phase).append(" d").append_i(separator)... |
python | def build_image_list(config, image, imagefile, all_local, include_allanchore, dockerfile=None, exclude_file=None):
"""Given option inputs from the cli, construct a list of image ids. Includes all found with no exclusion logic"""
if not image and not (imagefile or all_local):
raise click.BadOptionUsage(... |
python | def walk(value, walker, path=None, seen=None):
"""Walks the _evaluated_ tree of the given GCL tuple.
The appropriate methods of walker will be invoked for every element in the
tree.
"""
seen = seen or set()
path = path or []
# Recursion
if id(value) in seen:
walker.visitRecursion(path)
return
... |
python | def is_public(self):
"""Returns True if the public-read ACL is set for the Key."""
for grant in self._boto_object.Acl().grants:
if 'AllUsers' in grant['Grantee'].get('URI', ''):
if grant['Permission'] == 'READ':
return True
return False |
python | def copyto_file_object(self, query, file_object):
"""
Gets data from a table into a writable file object
:param query: The "COPY { table_name [(column_name[, ...])] | (query) }
TO STDOUT [WITH(option[,...])]" query to execute
:type query: str
:param f... |
java | private static Map mapifySerializations(List sers) {
Map rtn = new HashMap();
if (sers != null) {
int size = sers.size();
for (int i = 0; i < size; i++) {
if (sers.get(i) instanceof Map) {
rtn.putAll((Map) sers.get(i));
} else {... |
java | private String getWrappedResourceName(Resource resource)
{
String resourceName = resource.getResourceName();
if (resourceName != null)
{
return resourceName;
}
if (resource instanceof ResourceWrapper)
{
return getWrappedResourceName(((Resource... |
python | def token(self, id, **kwargs):
"""
Retrieve a service request ID from a token.
>>> Three('api.city.gov').token('12345')
{'service_request_id': {'for': {'token': '12345'}}}
"""
data = self.get('tokens', id, **kwargs)
return data |
java | public static boolean hasAbstractMember(XtendTypeDeclaration declaration) {
if (declaration != null) {
for (final XtendMember member : declaration.getMembers()) {
if (member instanceof XtendFunction) {
if (((XtendFunction) member).isAbstract()) {
return true;
}
}
}
}
return false;
} |
java | protected void sendTransacted(Destination destination, Serializable message) {
send(destination, message, null, null, true);
} |
python | def get_option(self, key):
"""Return the current value of the option `key` (string).
Instance method, only refers to current instance."""
return self._options.get(key, self._default_options[key]) |
python | def rewrite_url(self, url, is_image_src=False):
"""
This method is called to rewrite URLs.
It uses either ``self.link_rewrite`` or ``self.img_src_rewrite``
depending on the value of ``is_image_src``. The URL is returned
unchanged if the corresponding attribute is :obj:`None`.
... |
python | def containerize(coll):
"""Walk attribute fields passed from an SBP message and convert to
Containers where appropriate. Needed for Construct proper
serialization.
Parameters
----------
coll : dict
"""
if isinstance(coll, Container):
[setattr(coll, k, containerize(v)) for (k, v) in coll.items()]
... |
java | private List<String> checkRequestHeaders(HttpServletRequest request, JCorsConfig config) {
@SuppressWarnings("unchecked")
Enumeration<String> requestHeadersHeaders = request.getHeaders(CorsHeaders.ACCESS_CONTROL_REQUEST_HEADERS_HEADER);
List<String> requestHeaders = new ArrayList<String>();
while (requestHea... |
python | def add_comes_from(self, basic_block):
""" This simulates a set. Adds the basic_block to the comes_from
list if not done already.
"""
if basic_block is None:
return
if self.lock:
return
# Return if already added
if basic_block in self.com... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.