language stringclasses 2
values | func_code_string stringlengths 63 466k |
|---|---|
python | def create(self, name):
"""
Create a WSDL type by name.
@param name: The name of a type defined in the WSDL.
@type name: str
@return: The requested object.
@rtype: L{Object}
"""
timer = metrics.Timer()
timer.start()
type = self.resolver.f... |
java | private void generateCopyingPart(WrappingHint.Builder builder) {
ImmutableCollection<CopyMethod> copyMethods = ImmutableMultimap.<String, CopyMethod>builder()
.putAll(configuration.FIELD_TYPE_TO_COPY_METHODS)
.putAll(userDefinedCopyMethods)
.build()
... |
java | public ScreenComponent setupTableLookup(ScreenLoc itsLocation, ComponentParent targetScreen, int iDisplayFieldDesc, Rec record, String iQueryKeySeq, String iDisplayFieldSeq, boolean bIncludeFormButton)
{
return this.setupTableLookup(itsLocation, targetScreen, this, iDisplayFieldDesc, record, iQueryKeySeq, i... |
java | protected Map<String, Double> getInterfaceTotalTime(List<MethodDto> performanceVOList) {
Map<String, Double> map = new HashMap<String, Double>();
for (MethodDto performanceVO : performanceVOList) {
String simpleClassName = performanceVO.getSimpleClassName();
if (simpleClassName.endsWith("CacheImpl")) {
... |
java | @Override
public MtasSpanQuery rewrite(IndexReader reader) throws IOException {
MtasSpanQuery newBigQuery = bigQuery.rewrite(reader);
MtasSpanQuery newSmallQuery = smallQuery.rewrite(reader);
if (newBigQuery == null || newBigQuery instanceof MtasSpanMatchNoneQuery
|| newSmallQuery == null
... |
java | public float getFloatPixelValue(GriddedTile griddedTile, Double value) {
double pixel = 0;
if (value == null) {
if (griddedCoverage != null) {
pixel = griddedCoverage.getDataNull();
}
} else {
pixel = valueToPixelValue(griddedTile, value);
}
float pixelValue = (float) pixel;
return pixelValu... |
java | public void deleteSpaceSync(String spaceId) {
log.debug("deleteSpaceSync(" + spaceId + ")");
throwIfSpaceNotExist(spaceId);
Map<String, String> allProps = getAllSpaceProperties(spaceId);
allProps.put("is-delete", "true");
doSetSpaceProperties(spaceId, allProps);
SpaceDe... |
python | def read(self, read_list, verbose=False, log=False):
"""Read the content, returning a list of ReadingData objects."""
ret = []
mem_tot = _get_mem_total()
if mem_tot is not None and mem_tot <= self.REACH_MEM + self.MEM_BUFFER:
logger.error(
"Too little memory t... |
java | public Period withYears(int years) {
int[] values = getValues(); // cloned
getPeriodType().setIndexedField(this, PeriodType.YEAR_INDEX, values, years);
return new Period(values, getPeriodType());
} |
python | def is_superuser(self):
"""Evaluates whether this user has admin privileges.
:returns: ``True`` or ``False``.
"""
admin_roles = utils.get_admin_roles()
user_roles = {role['name'].lower() for role in self.roles}
return not admin_roles.isdisjoint(user_roles) |
python | def _send_chunk(self, chunk, chunk_num):
"""
Send a single chunk to the remote service.
:param chunk: bytes data we are uploading
:param chunk_num: int number associated with this chunk
"""
url_info = self.upload_operations.create_file_chunk_url(self.upload_id, chunk_num,... |
java | @Contract(pure = true)
@NotNull
public static <T> Promise<T[]> toArray(@NotNull Class<T> type, @NotNull List<? extends Promise<? extends T>> promises) {
int size = promises.size();
if (size == 0) return toArray(type);
if (size == 1) return toArray(type, promises.get(0));
if (size == 2) return toArray(type, pr... |
python | def get_vnetwork_vms_output_vnetwork_vms_ip(self, **kwargs):
"""Auto Generated Code
"""
config = ET.Element("config")
get_vnetwork_vms = ET.Element("get_vnetwork_vms")
config = get_vnetwork_vms
output = ET.SubElement(get_vnetwork_vms, "output")
vnetwork_vms = ET.S... |
java | @Override
public void doRender(final WComponent component, final WebXmlRenderContext renderContext) {
WEditableImage editableImage = (WEditableImage) component;
XmlStringBuilder xml = renderContext.getWriter();
// No image set
if (editableImage.getImage() == null && editableImage.getImageUrl() == null) {
r... |
java | @Override public void lcompute() {
_ok = new int[_files.length][H2O.CLOUD.size()];
for (int i = 0; i < _files.length; ++i) {
File f = new File(_files[i]);
if (f.exists() && (f.length()==_sizes[i]))
_ok[i][H2O.SELF.index()] = 1;
}
tryComplete();
} |
python | def build(self, X, Y, w=None, edges=None):
""" Assigns data to this object and builds the Merge Tree
@ In, X, an m-by-n array of values specifying m
n-dimensional samples
@ In, Y, a m vector of values specifying the output
responses corresponding to the m samples ... |
python | def to_data_rows(self, brains):
"""Returns a list of dictionaries representing the values of each brain
"""
fields = self.get_field_names()
return map(lambda brain: self.get_data_record(brain, fields), brains) |
java | private File saveCommandLine(String outputDir, double c, double[] weight) throws IOException
{
logger.info("save the command line");
//
DecimalFormat format = new DecimalFormat("0.000");
File tmp = new File(outputDir + "command-line");
PrintWriter pw = new PrintWriter(new FileWriter(tmp));
pw.print("sv... |
java | static public void listContentStreamForPage(PdfReader reader, int pageNum, PrintWriter out) throws IOException {
out.println("==============Page " + pageNum + "====================");
out.println("- - - - - Dictionary - - - - - -");
PdfDictionary pageDictionary = reader.getPageN(pageNum);
... |
java | private String getCommitBody(List<BoxFileUploadSessionPart> parts, Map<String, String> attributes) {
JsonObject jsonObject = new JsonObject();
JsonArray array = new JsonArray();
for (BoxFileUploadSessionPart part: parts) {
JsonObject partObj = new JsonObject();
partObj.a... |
python | def relabel(self, i):
'''
API: relabel(self, i)
Description:
Used by max_flow_preflowpush() method for relabelling node i.
Input:
i: Node that is being relabelled.
Post:
'distance' attribute of node i is updated.
'''
min_distance = ... |
java | public B addParameter(final String paramName, final String paramValue) {
httpParams.addParameter(paramName, paramValue);
return self();
} |
python | def set_interface(self, vrf_name, interface, default=False, disable=False):
""" Adds a VRF to an interface
Notes:
Requires interface to be in routed mode. Must apply ip address
after VRF has been applied. This feature can also be accessed
through the interfaces api.
... |
python | def compute_G_from_H( H, mdimG = None, mode_inv = "svd" ):
"""
Parameters
----------
H : the inverse R. Metric
if mode_inv == 'svd':
also returns Hvv, Hsvals, Gsvals the (transposed) eigenvectors of
H and the singular values of H and G
if mdimG < H.shape[2]:
G.shape = [ n_sa... |
python | def is_filter_selected(self, selection_id, value):
"""
Compares whether the 'selection_id' parameter value saved in the
cookie is the same value as the "value" parameter.
:param selection_id: a string as a dashboard_cookie key.
:param value: The value to compare against the valu... |
java | @Override
public final void persistRedeliveredCount(int redeliveredCount) throws SevereMessageStoreException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "persistRedeliveredCount");
PersistentTransaction msTran = (PersistentTransaction) ge... |
java | public void marshall(InviteMembersRequest inviteMembersRequest, ProtocolMarshaller protocolMarshaller) {
if (inviteMembersRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(inviteMembersReques... |
python | def _do_update_packet(self, packet, ip, port):
"""
React to update packet - people/person on a device have changed
:param packet: Packet from client with changes
:type packet: paps.si.app.message.APPUpdateMessage
:param ip: Client ip address
:type ip: unicode
:pa... |
java | protected static void checkSource(Configuration conf, List<Path> srcs
) throws InvalidInputException {
List<IOException> ioes = new ArrayList<IOException>();
for(Path p : srcs) {
try {
if (!p.getFileSystem(conf).exists(p)) {
ioes.add(new FileNotFoundException("Source "+p+" does not... |
python | def _normalized_mutual_info_score(reference_indices, estimated_indices):
"""Compute the mutual information between two sequence labelings, adjusted for
chance.
Parameters
----------
reference_indices : np.ndarray
Array of reference indices
estimated_indices : np.ndarray
Array o... |
python | def sku_update(self, product_id, properties, session, **kwargs):
'''taobao.fenxiao.product.sku.update 产品sku编辑接口
产品SKU信息更新'''
request = TOPRequest('taobao.fenxiao.product.sku.update')
request['product_id'] = product_id
request['properties'] = properties
for k, v i... |
java | public Collection<AlertViolation> list(long startDate, long endDate, boolean onlyOpen)
{
return list(filters().startDate(startDate).endDate(endDate).onlyOpen(onlyOpen).build());
} |
python | def _convert_json_response_to_entity(response, property_resolver, require_encryption,
key_encryption_key, key_resolver):
'''
:param bool require_encryption:
If set, will enforce that the retrieved entity is encrypted and decrypt it.
:param object key_encryption_k... |
python | def targetwords(self, index, targetwords, alignment):
"""Return the aligned targetwords for a specified index in the source words"""
return [ targetwords[x] for x in alignment[index] ] |
java | public void setBidiGlobalDir(int bidiGlobalDir) {
Preconditions.checkArgument(
bidiGlobalDir >= -1 && bidiGlobalDir <= 1,
"bidiGlobalDir must be 1 for LTR, or -1 for RTL (or 0 to leave unspecified).");
Preconditions.checkState(
!useGoogIsRtlForBidiGlobalDir || bidiGlobalDir == 0,
... |
python | def acceptAlias(decoratedFunction):
"""This function should be used as a decorator. Each class method that is decorated will be able
to accept alias or original names as a first function positional parameter."""
def wrapper(self, *args, **kwargs):
SubAssert(isinstance(self, AliasBase))
if l... |
java | public JavaMailBuilder port(String... port) {
for (String p : port) {
if (p != null) {
ports.add(p);
}
}
return this;
} |
java | public static String notEmptyIfNotNull(String value, String name) {
return notEmptyIfNotNull(value, name, null);
} |
python | def remove_entries(self, user_scope, key):
"""RemoveEntries.
[Preview API] Remove the entry or entries under the specified path
:param str user_scope: User-Scope at which to remove the value. Should be "me" for the current user or "host" for all users.
:param str key: Root key of the ent... |
java | @Benchmark
@BenchmarkMode(Mode.SampleTime)
@OutputTimeUnit(TimeUnit.NANOSECONDS)
public byte[][] marshalOld() {
Metadata m = new Metadata();
m.put(
GrpcUtil.MESSAGE_ACCEPT_ENCODING_KEY,
InternalDecompressorRegistry.getRawAdvertisedMessageEncodings(reg));
return TransportFrameUtil.toHtt... |
python | def merge_partial_elements(element_list):
"""
merges model elements which collectively all define the model component,
mostly for multidimensional subscripts
Parameters
----------
element_list
Returns
-------
"""
outs = dict() # output data structure
for element in element... |
java | public Seb useEnclosingMethodLabel() {
final StackTraceElement e = Thread.currentThread().getStackTrace()[2];
final String s = e.getClassName();
setLabel(s.substring(s.lastIndexOf('.') + 1, s.length()), e.getMethodName());
return this;
} |
python | def proximal(self):
"""Return the proximal factory of the functional.
See Also
--------
odl.solvers.nonsmooth.proximal_operators.proximal_l1 :
proximal factory for the L1-norm.
odl.solvers.nonsmooth.proximal_operators.proximal_l2 :
proximal factory for th... |
java | public static int cuLaunchCooperativeKernelMultiDevice(CUDA_LAUNCH_PARAMS launchParamsList[], int numDevices, int flags)
{
return checkResult(cuLaunchCooperativeKernelMultiDeviceNative(launchParamsList, numDevices, flags));
} |
python | def __init_chunked_upload(self):
"""Initialization for a multi-chunk upload."""
# note: string conversion required here due to open encoding bug in requests-oauthlib.
headers = {
'x-ton-content-type': self.content_type,
'x-ton-content-length': str(self._file_size),
... |
python | def polynomial_sign(poly_surface, degree):
r"""Determine the "sign" of a polynomial on the reference triangle.
.. note::
This is used **only** by :meth:`Surface._compute_valid` (which is
in turn used to compute / cache the :attr:`Surface.is_valid`
property).
Checks if a polynomial :m... |
python | def observe(self, path, callback, timeout=None, **kwargs): # pragma: no cover
"""
Perform a GET with observe on a certain path.
:param path: the path
:param callback: the callback function to invoke upon notifications
:param timeout: the timeout of the request
:return: ... |
java | public static void e(String s, Throwable t) {
log(Level.SEVERE, s, t);
} |
python | def update_log_entry(self, log_entry_form):
"""Updates an existing log entry.
arg: log_entry_form (osid.logging.LogEntryForm): the form
containing the elements to be updated
raise: IllegalState - ``log_entry_form`` already used in an
update transaction
... |
java | public static boolean isSqlStateConnectionException(SQLException se) {
String sqlState = se.getSQLState();
return sqlState != null && sqlState.startsWith("08");
} |
java | public Packet putString(String s) {
return putString(s, StandardCharsets.UTF_8, ByteOrder.BIG_ENDIAN);
} |
java | public OvhOfficeTask serviceName_changeAdministratorPassword_POST(String serviceName, String newPassword) throws IOException {
String qPath = "/saas/csp2/{serviceName}/changeAdministratorPassword";
StringBuilder sb = path(qPath, serviceName);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, ... |
java | public String convertIfcMedicalDeviceTypeEnumToString(EDataType eDataType, Object instanceValue) {
return instanceValue == null ? null : instanceValue.toString();
} |
python | def connection(self, collectionname, dbname=None):
"""Get a cursor to a collection by name.
raises `DataError` on names with unallowable characters.
:Parameters:
- `collectionname`: the name of the collection
- `dbname`: (optional) overide the default db for a connection
... |
python | def correspondence(self):
"""namedtuple representing the author to whom correspondence should
be addressed, in the form
(surname, initials, organization, country, city_group).
"""
fields = 'surname initials organization country city_group'
auth = namedtuple('Correspondenc... |
java | private void printUserData(String dataId, UserData userData) {
StringBuilder sb = new StringBuilder();
int count = 0;
if (userData != null && userData.getZoneData() != null) {
Map<String, List<String>> oneUserData = userData.getZoneData();
for (Map.Entry<String, List<Stri... |
java | public List<ServerMonitoringStatistics> getMonitoringStats(List<Group> groups, ServerMonitoringFilter config) {
List<ServerMonitoringStatistics> rawStats = groups.stream()
.map(group -> getMonitoringStats(group, config))
.flatMap(List::stream)
.collect(toList());
Map... |
python | def reply(self, text, in_thread=None):
"""
Send a reply to the sender using RTM API
(This function doesn't supports formatted message
when using a bot integration)
If the message was send in a thread, answer in a thread per default.
"""
if in_thr... |
python | def Floor(input_vertex: vertex_constructor_param_types, label: Optional[str]=None) -> Vertex:
"""
Applies the Floor operator to a vertex.
This maps a vertex to the biggest integer less than or equal to its value
:param input_vertex: the vertex to be floor'd
"""
return Double(context.jvm_vie... |
python | def create_store(url, **kw):
'''Create a new :class:`Store` for a valid ``url``.
:param url: a valid ``url`` takes the following forms:
:ref:`Pulsar datastore <store_pulsar>`::
pulsar://user:password@127.0.0.1:6410
:ref:`Redis <store_redis>`::
redis://user:password@1... |
python | def is_typing_handler(stream):
"""
Show message to opponent if user is typing message
"""
while True:
packet = yield from stream.get()
session_id = packet.get('session_key')
user_opponent = packet.get('username')
typing = packet.get('typing')
if session_i... |
python | def setup(self, app):
'''
Make sure that other installed plugins don't affect the same keyword argument.
'''
for other in app.plugins:
if not isinstance(other, MySQLPlugin):
continue
if other.keyword == self.keyword:
raise PluginErr... |
python | def fixed_legend_filter_field(self, fixed_legend_filter_field):
"""Sets the fixed_legend_filter_field of this ChartSettings.
Statistic to use for determining whether a series is displayed on the fixed legend # noqa: E501
:param fixed_legend_filter_field: The fixed_legend_filter_field of this ... |
java | public ModelNode resolveValue(final OperationContext context, final ModelNode value) throws OperationFailedException {
return resolveValue(new ExpressionResolver() {
@Override
public ModelNode resolveExpressions(ModelNode node) throws OperationFailedException {
return con... |
java | public void merge(Hints hints) {
this.allow.addAll(hints.getAllow());
this.formats.putAll(hints.getFormats());
this.acceptPath.addAll(hints.getAcceptPath());
this.acceptPost.addAll(hints.getAcceptPost());
this.acceptRanges.addAll(hints.getAcceptRanges());
this.acceptPrefe... |
java | @GET
@Timed
public Response getPartitions(@Context final UriInfo uriInfo, @Context final HttpHeaders headers) {
final IRI identifier = rdf.createIRI(
properties.getProperty("baseUrl", uriInfo.getBaseUri().toString()));
LOGGER.debug("Request for root resource at: {}", identifier... |
java | public static Type<FormSubmitHandler<?>> getType() {
if (type == null) { // NOPMD it's thread save!
synchronized (FormSubmitHandler.class) {
if (type == null) {
type = new Type<>();
}
}
}
return type;
} |
java | public String markAfter(@Nullable Dir dir, String str, boolean isHtml) {
if (dir == null) {
dir = estimateDirection(str, isHtml);
}
// BidiUtils.getExitDir() is called only if needed (short-circuit).
if (contextDir == Dir.LTR && (dir == Dir.RTL || BidiUtils.getExitDir(str, isHtml) == Dir.RTL)) {
... |
java | protected String resolveSpanName(HttpRequest<?> request) {
Optional<String> route = request.getAttribute(HttpAttributes.URI_TEMPLATE, String.class);
return route.map(s -> request.getMethod() + " " + s).orElse(request.getMethod() + " " + request.getPath());
} |
python | def Channels(module):
'''
Returns the channels contained in the given K2 module.
'''
nums = {2: 1, 3: 5, 4: 9, 6: 13, 7: 17, 8: 21, 9: 25,
10: 29, 11: 33, 12: 37, 13: 41, 14: 45, 15: 49,
16: 53, 17: 57, 18: 61, 19: 65, 20: 69, 22: 73,
23: 77, 24: 81}
if module ... |
java | @Override
protected void valueCreate(String[] strings, Value value) {
for (int i = 0; i < strings.length; i++) {
value.addPrimitiveValue(labels[i], strings[i]);
}
for (Entry<List<Pattern>, String[]> entry : simpleJoinMap.entrySet()) {
List<Pattern> p = entry.getKey()... |
python | def main(event_loop=None):
"""Scriptworker entry point: get everything set up, then enter the main loop.
Args:
event_loop (asyncio.BaseEventLoop, optional): the event loop to use.
If None, use ``asyncio.get_event_loop()``. Defaults to None.
"""
context, credentials = get_context_fr... |
java | Item set(final int type,
final String strVal1,
final String strVal2,
final String strVal3) {
this.type = type;
this.strVal1 = strVal1;
this.strVal2 = strVal2;
this.strVal3 = strVal3;
switch (type) {
case ClassWriter.UTF8:
... |
python | def delete(self, primary_key):
'''
a method to delete a record in the table
:param primary_key: string with primary key of record
:return: string with status message
'''
title = '%s.delete' % self.__class__.__name__
# delete obje... |
java | public Response post(String service, Request request, File file) throws IOException {
if (file != null) {
this.contentType = MULTIPART + BOUNDARY;
}
return call(Method.POST, service, request, file);
} |
java | public CmsPublishList getPublishList(
CmsObject cms,
CmsResource directPublishResource,
boolean directPublishSiblings) throws CmsException {
return m_securityManager.fillPublishList(
cms.getRequestContext(),
new CmsPublishList(directPublishResource, directPublish... |
java | Collection<Method> getRelevantGetters(Class<?> clazz) {
synchronized (getterCache) {
if ( !getterCache.containsKey(clazz) ) {
List<Method> relevantGetters = new LinkedList<Method>();
for ( Method m : clazz.getMethods() ) {
if ( isRelevantGetter(m) ... |
java | E unlinkLast() {
final E l = last;
final E prev = l.getPrevious();
l.setPrevious(null);
last = prev;
if (prev == null) {
first = null;
} else {
prev.setNext(null);
}
return l;
} |
python | def delete(self, ignore=None):
"""Yield tuple with deleted index name and responses from a client."""
ignore = ignore or []
def _delete(tree_or_filename, alias=None):
"""Delete indexes and aliases by walking DFS."""
if alias:
yield alias, self.client.indi... |
java | public static <T1, T2, T3> TriConsumer<T1, T2, T3> pipeline(TriConsumer<T1, T2, T3> first, TriConsumer<T1, T2, T3> second, TriConsumer<T1, T2, T3> third) {
return new PipelinedTernaryConsumer<T1, T2, T3>(Iterations.iterable(first, second, third));
} |
python | def map(self, fn, *seq):
"Perform a map operation distributed among the workers. Will "
"block until done."
results = Queue()
args = zip(*seq)
for seq in args:
j = SimpleJob(results, fn, seq)
self.put(j)
# Aggregate results
r = []
... |
python | def _MakeCacheInvariant(self, urn, age):
"""Returns an invariant key for an AFF4 object.
The object will be cached based on this key. This function is specifically
extracted to ensure that we encapsulate all security critical aspects of the
AFF4 object so that objects do not leak across security bounda... |
java | public static void horizontal(Kernel1D_S32 kernel,
InterleavedS32 input, InterleavedS32 output , ImageBorder_IL_S32<InterleavedS32> border ) {
InputSanityCheck.checkSameShapeB(input, output);
boolean processed = BOverrideConvolveImage.invokeNativeHorizontal(kernel,input,output,border);
if( !processed ... |
python | def has_no_flat_neurites(neuron, tol=0.1, method='ratio'):
'''Check that a neuron has no flat neurites
Arguments:
neuron(Neuron): The neuron object to test
tol(float): tolerance
method(string): way of determining flatness, 'tolerance', 'ratio' \
as described in :meth:`neurom.che... |
java | private void expungeExpiredEntries() {
emptyQueue();
if (lifetime == 0) {
return;
}
int cnt = 0;
long time = System.currentTimeMillis();
for (Iterator<CacheEntry<K,V>> t = cacheMap.values().iterator();
t.hasNext(); ) {
CacheEntry<K,... |
java | protected void addLinkedResources(String path, GeneratorContext context, List<FilePathMapping> fMappings) {
linkedResourceMap.put(getResourceCacheKey(path, context), new CopyOnWriteArrayList<>(fMappings));
JoinableResourceBundle bundle = context.getBundle();
if (bundle != null) {
List<FilePathMapping> bundleF... |
python | def underToMixed(name):
"""
>>> underToMixed('some_large_model_name_perhaps')
'someLargeModelNamePerhaps'
>>> underToMixed('exception_for_id')
'exceptionForID'
"""
if name.endswith('_id'):
return underToMixed(name[:-3] + "ID")
return _underToMixedRE.sub(lambda m: m.group(0)[1].u... |
java | public void marshall(Secret secret, ProtocolMarshaller protocolMarshaller) {
if (secret == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(secret.getName(), NAME_BINDING);
protocolMarshall... |
python | def _assert_valid_key(self, name):
"""Raises if name is not a valid measurement."""
if name not in self._measurements:
raise NotAMeasurementError('Not a measurement', name, self._measurements) |
python | def to_half(b:Collection[Tensor])->Collection[Tensor]:
"Recursively map lists of tensors in `b ` to FP16."
if is_listy(b): return [to_half(o) for o in b]
return b.half() if b.dtype not in [torch.int64, torch.int32, torch.int16] else b |
java | public static boolean isClass(LightweightTypeReference typeRef) {
final JvmType t = typeRef.getType();
if (t instanceof JvmGenericType) {
return !((JvmGenericType) t).isInterface();
}
return false;
} |
python | def open_grindstone(self):
"""
Opens a grindstone file and populates the grindstone with it's
contents.
Returns an empty grindstone json object if a file does not exist.
"""
try:
with open(self.grindstone_path, 'r') as f:
# Try opening the file... |
java | public static <T> Typed<T> wrap(final Class<T> type) {
return TypeUtils.wrap((Type) type);
} |
java | public static Prefer valueOf(final String value) {
if (nonNull(value)) {
final Map<String, String> data = new HashMap<>();
final Set<String> params = new HashSet<>();
stream(value.split(";")).map(String::trim).map(pref -> pref.split("=", 2)).forEach(x -> {
if ... |
java | private static int specialChar(char ch) {
if ((ch > '\u0621' && ch < '\u0626') ||
(ch == '\u0627') ||
(ch > '\u062E' && ch < '\u0633') ||
(ch > '\u0647' && ch < '\u064A') ||
(ch == '\u0629')) {
return 1;
} else if (ch >= '\u064B' && ch<= '\u065... |
java | public static <L, K> void removeListener (Map<K, ListenerList<L>> map, K key, L listener)
{
ListenerList<L> list = map.get(key);
if (list != null) {
list.remove(listener);
}
} |
java | @Override
public EClass getIfcCoordinateReferenceSystem() {
if (ifcCoordinateReferenceSystemEClass == null) {
ifcCoordinateReferenceSystemEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI)
.getEClassifiers().get(148);
}
return ifcCoordinateReferenceSystemEClass;
} |
java | public UrlMappingOption filterRequestPath(Function<String, String> filter) {
if (filter == null) {
throw new IllegalArgumentException("The argument 'filter' should not be null.");
}
requestPathFilter = filter;
return this;
} |
python | def set_pos_info_recurse(self, node, start, finish, parent=None):
"""Set positions under node"""
self.set_pos_info(node, start, finish)
if parent is None:
parent = node
for n in node:
n.parent = parent
if hasattr(n, 'offset'):
self.set_... |
java | public SICoreConnection getConnection()
throws SISessionUnavailableException, SISessionDroppedException,
SIConnectionUnavailableException, SIConnectionDroppedException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "getConnection");
c... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.