language stringclasses 2
values | func_code_string stringlengths 63 466k |
|---|---|
java | public static Collection<MessagingContext> forImportedVariables(
String domain,
String applicationName,
Instance instance,
ThoseThat thoseThat ) {
Map<String,MessagingContext> result = new HashMap<> ();
for( ImportedVariable var : ComponentHelpers.findAllImportedVariables( instance.getComponent()).valu... |
java | @NonNull
private static <K, T> PagedList<T> create(@NonNull DataSource<K, T> dataSource,
@NonNull Executor notifyExecutor,
@NonNull Executor fetchExecutor,
@Nullable BoundaryCallback<T> boundaryCallback,
@NonNull Config config,
@Nullable K key) {
i... |
python | def check_reaction(reactants, products):
"""Check the stoichiometry and format of chemical reaction used for
folder structure.
list of reactants -> list of products
"""
reactant_list = [reactant.split('@')[0].strip(
'star').strip('gas') for reactant in reactants]
product_list = [product.... |
java | public TafResp validate(LifeForm reading, HttpServletRequest req, HttpServletResponse resp) {
return NullTafResp.singleton();
} |
python | def flags(cmd, data):
"""
Checks if there are flags in the path data
Returns the indices of all values in the path data which are flags
"""
if cmd.lower() == 'a': # a: (rx ry x-axis-rotation large-arc-flag sweep-flag x y)+
indices = range(len(data))
return [index for index in... |
java | private Lifecycle getLifecycleForPhase( String phase )
throws BuildFailureException, LifecycleExecutionException
{
Lifecycle lifecycle = (Lifecycle) getPhaseToLifecycleMap().get( phase );
if ( lifecycle == null )
{
throw new BuildFailureException( "Unable to find lifecyc... |
java | @Override
protected Calendar getDate()
{
Calendar calendar = Calendar.getInstance();
calendar.setTimeInMillis(value);
return calendar;
} |
python | def profile(self):
"""
Buffered result of :meth:`build_profile`
"""
if self._profile is None:
self._profile = self.build_profile()
return self._profile |
java | public static byte[] str2bin(final String values, final JBBPBitOrder bitOrder) {
if (values == null) {
return new byte[0];
}
int buff = 0;
int cnt = 0;
final ByteArrayOutputStream buffer = new ByteArrayOutputStream((values.length() + 7) >> 3);
final boolean msb0 = bitOrder == JBBPBitOrd... |
java | protected T setNiftyName(String niftyName)
{
Preconditions.checkNotNull(niftyName, "niftyName cannot be null");
this.niftyName = niftyName;
return (T) this;
} |
java | public String getNormalisedContentTypeValue() {
String contentType = getHeader(CONTENT_TYPE);
if (contentType != null) {
return contentType.toLowerCase(Locale.ROOT);
}
return null;
} |
java | static void registerDiscoveryClient(UUID injectorId, ReadOnlyDiscoveryClient discoveryClient, DiscoveryJmsConfig config) {
DISCO_CLIENTS.put(injectorId, discoveryClient);
CONFIGS.put(injectorId, config);
LOG.info("Registered discovery client %s as %s", injectorId, discoveryClient);
} |
java | public void printDataEndForm(PrintWriter out, int iPrintOptions)
{
out.println("</tr>\n</table>");
if ((iPrintOptions & HtmlConstants.DETAIL_SCREEN) != 0)
out.println("</td>\n</tr>");
} |
java | protected void storeValidation(Validation v, XMLStreamWriter writer) throws Exception
{
writer.writeStartElement(XML.ELEMENT_VALIDATION);
if (v.getValidConnectionChecker() != null)
{
storeExtension(v.getValidConnectionChecker(), writer, XML.ELEMENT_VALID_CONNECTION_CHECKER);
}
... |
java | public Expression<Long> gte(long value) {
String valueString = "'" + value + "'";
return new Expression<Long>(this, Operation.gte, valueString);
} |
python | def build_stack_changes(stack_name, new_stack, old_stack, new_params,
old_params):
"""Builds a list of strings to represent the the parameters (if changed)
and stack diff"""
from_file = "old_%s" % (stack_name,)
to_file = "new_%s" % (stack_name,)
lines = difflib.context_diff(... |
python | def eigenvectors_nrev(T, right=True):
r"""Compute eigenvectors of transition matrix.
Parameters
----------
T : (d, d) ndarray
Transition matrix (stochastic matrix)
k : int or tuple of ints, optional
Compute the first k eigenvalues of T
right : bool, optional
If right=Tru... |
java | void writeTagNoClear(long bucketIndex, int posInBucket, long tag) {
long tagStartIdx = getTagOffset(bucketIndex, posInBucket);
// BIT BANGIN YEAAAARRHHHGGGHHH
for (int i = 0; i < bitsPerTag; i++) {
// second arg just does bit test in tag
if ((tag & (1L << i)) != 0) {
memBlock.set(tagStartIdx + i);... |
python | def _unary(space,const,name):
"""
Reduce the domain of variable name to be node-consistent with this
constraint, i.e. remove those values for the variable that are not
consistent with the constraint.
returns True if the domain of name was modified
"""
if not name in const.vnames:
re... |
python | def leave(self, _id):
""" Leave a room """
if SockJSRoomHandler._room.has_key(self._gcls() + _id):
SockJSRoomHandler._room[self._gcls() + _id].remove(self)
if len(SockJSRoomHandler._room[self._gcls() + _id]) == 0:
del SockJSRoomHandler._room[self._gcls() + _id] |
java | public Map<String, List<String>> getResponseHeaders() {
if (myResponseHeaders == null) {
myResponseHeaders = new HashMap<>();
}
return myResponseHeaders;
} |
java | private static List<ValueInjector> getValueInjectFields(Environment environment, ClassDefine classDefine) {
List<ValueInjector> valueInjectors = new ArrayList<>(8);
//handle class annotation
if (null != classDefine.getType().getAnnotation(Value.class)) {
String suffix = classDefine.g... |
java | public void handleGet(HttpRequest request,
HttpResponse response,
String pathInContext,
String pathParams,
Resource resource)
throws IOException
{
if(log.isDebugEnabled())log.debug("Looking for "+... |
java | public static String getNodesPathName(Node node) {
final StringBuffer buffer = new StringBuffer();
if (node.getNodeType() == Node.ATTRIBUTE_NODE) {
buildNodeName(((Attr) node).getOwnerElement(), buffer);
buffer.append(".");
buffer.append(node.getLocalName());
... |
java | public void trace(Object message, Throwable t)
{
getLogger().trace(message.toString(), t);
} |
java | protected boolean attemptConnectWork(ConnectInfo ci) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.entry(tc, "attemptConnectWork");
}
boolean returnConnectDone = true;
switch (ci.action) {
case (ConnectInfo.FINISH_CONNECTION): {
... |
python | def _component2dtype(self, component):
"""Determin the appropriate numpy datatype for an OpenJPEG component.
Parameters
----------
component : ctypes pointer to ImageCompType (image_comp_t)
single image component structure.
Returns
-------
builtins.t... |
python | def intervallookupone(table, start='start', stop='stop', value=None,
include_stop=False, strict=True):
"""
Construct an interval lookup for the given table, returning at most one
result for each query. E.g.::
>>> import petl as etl
>>> table = [['start', 'stop', 'value... |
python | def _get_access_info(self, instance, db_key, db_name=None):
''' Convenience method to extract info from instance
'''
dsn = instance.get('dsn')
host = instance.get('host')
username = instance.get('username')
password = instance.get('password')
database = instance.g... |
python | def _must_decode(value):
"""Copied from pkginfo 1.4.1, _compat module."""
if type(value) is bytes:
try:
return value.decode('utf-8')
except UnicodeDecodeError:
return value.decode('latin1')
return value |
java | public static <T> T retrieveService(Class<T> clazz, Registry registry) {
if(registry == null) {
throw new IllegalArgumentException("Registry cannot be null.");
}
Set<T> servicesFromRegistry = registry.findByType(clazz);
if (servicesFromRegistry.size() == 1) {
T s... |
java | private boolean isValidWeakMetaClass(MetaClass metaClass, MetaClassRegistry.MetaClassCreationHandle mccHandle) {
if(metaClass==null) return false;
boolean enableGloballyOn = (mccHandle instanceof ExpandoMetaClassCreationHandle);
boolean cachedAnswerIsEMC = (metaClass instanceof ExpandoMetaClass)... |
python | def remove_unused_links(self, used):
"""Removes all saved links except the ones that are used.
Args:
used (list): list of used links that should not be removed.
"""
unused = []
self._execute("SELECT * FROM {}".format(self.LINK_STATE_TABLE))
for row in self.c... |
python | def lmx_h1k_f64k():
"""HParams for training languagemodel_lm1b32k_packed. 880M Params."""
hparams = lmx_base()
hparams.hidden_size = 1024
hparams.filter_size = 65536
hparams.batch_size = 2048
return hparams |
python | def merge_equal_neighbors(self):
""" Merge neighbors with same speaker. """
IDX_LENGTH = 3
merged = self.segs.copy()
current_start = 0
j = 0
seg = self.segs.iloc[0]
for i in range(1, self.num_segments):
seg = self.segs.iloc[i]
last = self.... |
java | protected void addInstanceToTree(Instance inst, KDTreeNode node)
throws Exception {
if (node.isALeaf()) {
int instList[] = new int[m_Instances.numInstances()];
try {
System.arraycopy(m_InstList, 0, instList, 0, node.m_End + 1); // m_InstList.squeezeIn(m_End,
... |
java | private Map < String, Object > getProps(XmlSchemaSimpleType xsdSimpleType,
final CobolAnnotations cobolAnnotations) {
XmlSchemaSimpleTypeRestriction restriction = (XmlSchemaSimpleTypeRestriction) xsdSimpleType
.getContent();
if (restriction != null && restriction.getBaseTypeN... |
java | public void start() throws Exception {
internalPageFactory =
new InternalPageFactory(bundleContext, pageId, applicationName, pageName, pageClass, overwrites,
injectionSource);
internalPageFactory.register();
} |
python | def group(args):
"""
%prog group tabfile > tabfile.grouped
Given a tab-delimited file, either group all elements within the file or
group the elements in the value column(s) based on the key (groupby) column
For example, convert this | into this
---------------------------------------
a 2 ... |
python | def metatiles_are_equal(tile_data_1, tile_data_2):
"""
Return True if the two tiles are both zipped metatiles and contain the
same set of files with the same contents. This ignores the timestamp of
the individual files in the zip files, as well as their order or any
other metadata.
"""
try:... |
java | private static void createBlockFile(String blockPath) throws IOException {
FileUtils.createBlockPath(blockPath,
ServerConfiguration.get(PropertyKey.WORKER_DATA_FOLDER_PERMISSIONS));
FileUtils.createFile(blockPath);
FileUtils.changeLocalFileToFullPermission(blockPath);
LOG.debug("Created new file... |
python | def get_contacts(self, limit=100, offset=0, params={}):
"""
Get all account contacts
"""
url = self.CONTACTS_URL + "?limit=%s&offset=%s" % (limit, offset)
for key, value in params.items():
if key is 'ids':
value = ",".join(value)
url += '... |
python | def add(self, child):
"""
Adds a typed child object to the component type.
@param child: Child object to be added.
"""
if isinstance(child, Parameter):
self.add_parameter(child)
elif isinstance(child, Property):
self.add_property(child)
e... |
python | def read_tvips_header(fh, byteorder, dtype, count, offsetsize):
"""Read TVIPS EM-MENU headers and return as dict."""
result = {}
header = fh.read_record(TIFF.TVIPS_HEADER_V1, byteorder=byteorder)
for name, typestr in TIFF.TVIPS_HEADER_V1:
result[name] = header[name].tolist()
if header['Versi... |
python | def load_settings(self, settings):
"""Load settings from file"""
with open(settings) as settings_file:
settings_dict = simplejson.load(settings_file)
for key, value in settings_dict.items():
self.__setattr__(key, value) |
java | public static Hop resolveHostByDnsSrvLookup(Hop hop) {
String host = hop.getHost();
String transport = hop.getTransport();
if(transport==null) {
transport = ListeningPoint.UDP;
}
transport = transport.toLowerCase();
Record[] records = null;
try {
records = new Lookup("_sip._" + transport
+ "."... |
java | public void marshall(CelebrityDetail celebrityDetail, ProtocolMarshaller protocolMarshaller) {
if (celebrityDetail == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(celebrityDetail.getUrls(), URLS_BI... |
python | def geodist(self, name, place1, place2, unit=None):
"""
Return the distance between ``place1`` and ``place2`` members of the
``name`` key.
The units must be one of the following : m, km mi, ft. By default
meters are used.
"""
pieces = [name, place1, place2]
... |
python | def export_model(self, export_formats, export_dir=None):
"""Exports model based on export_formats.
Subclasses should override _export_model() to actually
export model to local directory.
Args:
export_formats (list): List of formats that should be exported.
expor... |
java | public void killWorkers(Set<ContainerPlan> containers) {
for (ContainerPlan container : containers) {
LOG.log(Level.INFO, "Find and kill container for worker {0}", container.getId());
Optional<HeronWorker> worker = multiKeyWorkerMap.lookupByWorkerId(container.getId());
if (worker.isPresent()) {
... |
java | public final Cache2kBuilder<K, V> name(Class<?> _class, String _fieldName) {
if (_fieldName == null) {
throw new NullPointerException();
}
config().setName(_class.getName() + "." + _fieldName);
return this;
} |
python | async def _reap_payloads(self):
"""Clean up all finished payloads"""
for task in self._tasks.copy():
if task.done():
self._tasks.remove(task)
if task.exception() is not None:
raise task.exception()
await asyncio.sleep(0) |
python | def suspended_updates():
"""
This allows you to postpone updates to all the search indexes inside of a with:
with suspended_updates():
model1.save()
model2.save()
model3.save()
model4.delete()
"""
if getattr(local_storage, "bulk_queue", None) is N... |
java | public final void dispatchCharactersEvents(int nodeHandle, ContentHandler ch,
boolean normalize)
throws SAXException
{
int identity = makeNodeIdentity(nodeHandle);
if (identity == DTM.NULL)
return;
int type = _type2(identity);
if (type =... |
python | def ones_comp_sum16(num1: int, num2: int) -> int:
"""Calculates the 1's complement sum for 16-bit numbers.
Args:
num1: 16-bit number.
num2: 16-bit number.
Returns:
The calculated result.
"""
carry = 1 << 16
result = num1 + num2
return result if result < carry else ... |
java | public List<Integer> getConnectionRetries() {
List<Integer> items = new ArrayList<Integer>();
for (int i = 0; i < 10; i++) {
items.add(i);
}
return items;
} |
python | def is_complex(arg):
'''
is_complex(x) yields True if x is a complex numeric object and False otherwise. Note that this
includes anything representable as as a complex number such as an integer or a boolean value.
In effect, this makes this function an alias for is_number(arg).
'''
return (i... |
python | def cli(env):
"""List routing types."""
mgr = SoftLayer.LoadBalancerManager(env.client)
routing_methods = mgr.get_routing_methods()
table = formatting.KeyValueTable(['ID', 'Name'])
table.align['ID'] = 'l'
table.align['Name'] = 'l'
table.sortby = 'ID'
for routing_method in routing_method... |
python | def find_good(control_board, actuation_steps, resistor_index, start_index,
end_index):
'''
Use a binary search over the range of provided actuation_steps to find the
maximum actuation voltage that is measured by the board feedback circuit
using the specified feedback resistor.
'''
... |
java | @SuppressWarnings("nls")
public static void writeProjectionFile( String filePath, String extention, CoordinateReferenceSystem crs )
throws IOException {
/*
* fill a prj file
*/
String prjPath = null;
if (extention != null && filePath.toLowerCase().endsWith("." +... |
python | def copy(self):
"""Returns a deep copy of the instance."""
clone = self.__class__()
clone.fields = self.fields.copy()
for k in clone.fields:
clone.fields[k] = self.get_field(k).do_copy(clone.fields[k])
clone.default_fields = self.default_fields.copy()
clone.ov... |
java | @Override
public void writeRowsArray(List<Column> columns, Object[][] rows) throws IOException {
for (Object[] currentRow : rows) {
if (currentRow != null) {
writeRow(columns, currentRow);
} else {
break;
}
}
} |
java | protected void onRemoved() {
List<FilterChangeListener> listeners = getAllListeners();
for (FilterChangeListener listener : listeners) {
listener.onRemove(this);
}
} |
python | def compile_geometry(lat, lon, elev):
"""
Take in lists of lat and lon coordinates, and determine what geometry to create
:param list lat: Latitude values
:param list lon: Longitude values
:param float elev: Elevation value
:return dict:
"""
logger_excel.info("enter compile_geometry")
... |
python | def expand_entry(entry, ignore_xs=0x0):
"""Turn all Xs which are not marked in `ignore_xs` into ``0``\ s and
``1``\ s.
The following will expand any Xs in bits ``1..3``\ ::
>>> entry = RoutingTableEntry(set(), 0b0100, 0xfffffff0 | 0b1100)
>>> list(expand_entry(entry, 0xfffffff1)) == [
... |
python | def sync_state(self):
"""
Syncs the internal Pybullet robot state to the joint positions of the
robot being controlled.
"""
# sync IK robot state to the current robot joint positions
self.sync_ik_robot(self.robot_jpos_getter())
# make sure target pose is up to d... |
java | public void setParseRobotsTxt(boolean parseRobotsTxt) {
this.parseRobotsTxt = parseRobotsTxt;
getConfig().setProperty(SPIDER_PARSE_ROBOTS_TXT, Boolean.toString(parseRobotsTxt));
} |
java | public MethodHandle arrayAccess(VarHandle.AccessMode mode) {
return invoke(MethodHandles.arrayElementVarHandle(type().parameterType(0)).toMethodHandle(mode));
} |
python | def extract_string_pairs_in_directory(directory_path, extract_func, filter_func):
""" Retrieves all string pairs in the directory
Args:
directory_path (str): The path of the directory containing the file to extract string pairs from.
extract_func (function): Function for extracting the localiza... |
python | def libvlc_media_save_meta(p_md):
'''Save the meta previously set.
@param p_md: the media desriptor.
@return: true if the write operation was successful.
'''
f = _Cfunctions.get('libvlc_media_save_meta', None) or \
_Cfunction('libvlc_media_save_meta', ((1,),), None,
ctype... |
java | public NotificationChain basicSetLeft(RuleElement newLeft, NotificationChain msgs)
{
RuleElement oldLeft = left;
left = newLeft;
if (eNotificationRequired())
{
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, SimpleAntlrPackage.UNTIL_ELEMENT__LEFT, oldLeft, newLeft)... |
python | def serialize_payload(self):
"""
Serializes the marker output data into a payload buffer.
:return: The serialized payload.
:rtype: bytes
"""
with io.BytesIO() as stream:
stream.write(self.OPEN_ASSETS_TAG)
bitcoin.core.VarIntSerializer.stream_seri... |
python | def warnify(self, message, duration=3000, notification_clicked_slot=None, **kwargs):
"""
Displays an Application notification warning.
:param message: Notification message.
:type message: unicode
:param duration: Notification display duration.
:type duration: int
... |
python | def basic_cancel(self, consumer_tag, nowait=False):
"""End a queue consumer
This method cancels a consumer. This does not affect already
delivered messages, but it does mean the server will not send
any more messages for that consumer. The client may receive
an abitrary number ... |
python | def get_historical_data(fsym, tsym, freq, info='full', e='all',
try_conversion=True, aggregate=1, limit=1440,
to_ts=False):
"""Get minute-by-minute historical price and volume information for
the requested currency pair. Available data is limited to the last 7 da... |
python | def retrieve(self, request, project, pk=None):
"""
Retrieve a bug-job-map entry. pk is a composite key in the form
bug_id-job_id
"""
job_id, bug_id = map(int, pk.split("-"))
job = Job.objects.get(repository__name=project, id=job_id)
try:
bug_job_map = ... |
python | def normalize(self, mag=1.):
"""Normalize a Channel, set `null` to 0 and the mag to given value.
Parameters
----------
mag : float (optional)
New value of mag. Default is 1.
"""
def f(dataset, s, null, mag):
dataset[s] -= null
dataset... |
java | public boolean cancelAll(boolean mayInterruptIfRunning) {
boolean res = true;
if (N.notNullOrEmpty(upFutures)) {
for (ContinuableFuture<?> preFuture : upFutures) {
res = res & preFuture.cancelAll(mayInterruptIfRunning);
}
}
return cancel... |
python | def copy(self):
"""
Returns a "T" (tee) copy of the given stream, allowing the calling
stream to continue being used.
"""
a, b = it.tee(self._data) # 2 generators, not thread-safe
self._data = a
return Stream(b) |
python | def add_marker_to_qtls(qtlfile, mapfile, outputfile='qtls_with_mk.csv'):
"""This function adds to a list of QTLs, the closest marker to the
QTL peak.
:arg qtlfile: a CSV list of all the QTLs found.
The file should be structured as follow::
Trait, Linkage group, position, other columns
... |
python | def py3round(number):
"""Unified rounding in all python versions."""
if abs(round(number) - number) == 0.5:
return int(2.0 * round(number / 2.0))
return int(round(number)) |
java | private int adjustDstOffsetForInvalidWallClock(
long standardTimeInZone, TimeZone zone, int dstOffset) {
if (dstOffset != 0) {
// If applying the DST offset produces a time that is outside DST then it must be
// an invalid wall clock so clear the DST offset to avoid that hap... |
python | def create_properties(self): # pylint: disable=no-self-use
"""
Format the properties with which to instantiate the connection.
This acts like a user agent over HTTP.
:rtype: dict
"""
properties = {}
properties["product"] = "eventhub.python"
properties["v... |
java | private Object batchInsertAfterReordering(final String statementName,
final Object parameterObject) {
Set<String> keys = new HashSet<String>();
keys.add(getDefaultDataSourceName());
keys.addAll(getCobarDataSourceService().getDataSources().keySet());
... |
java | public int getStartingID()
{
int iStartingID = 1; // (default)
if (this.getProperty(STARTING_ID) != null)
{
try {
iStartingID = Integer.parseInt(this.getProperty(STARTING_ID));
} catch (NumberFormatException e) {
iStartingID = 1;
... |
java | public List<CmsResource> getMatchedResources() {
if (m_replace) {
// re-read the resources to include changes
List<CmsResource> result = new ArrayList<CmsResource>();
for (CmsResource resource : m_matchedResources) {
try {
result.add(getCm... |
java | public com.cloudant.client.api.model.Response save(Object object, int writeQuorum) {
Response couchDbResponse = client.couchDbClient.put(getDBUri(), object, true, writeQuorum);
com.cloudant.client.api.model.Response response = new com.cloudant.client.api.model
.Response(couchDbResponse);... |
python | def windowed(seq, n, fillvalue=None, step=1):
"""Return a sliding window of width *n* over the given iterable.
>>> all_windows = windowed([1, 2, 3, 4, 5], 3)
>>> list(all_windows)
[(1, 2, 3), (2, 3, 4), (3, 4, 5)]
When the window is larger than the iterable, *fillvalue* is used in plac... |
java | @Override
public View focusSearch(View focused, int direction) {
View result = mLayout.onInterceptFocusSearch(focused, direction);
if (result != null) {
return result;
}
final FocusFinder ff = FocusFinder.getInstance();
result = ff.findNextFocus(this, focused, dir... |
java | public static <T, R> Function<T, R> monitor(Function<T, R> function, AtomicLong calls) {
return new MonitoringFunction<>(function, calls);
} |
python | def export_text(self, filename=None):
"""
Export in text format. Optionally provide a filename to
save to.
:param str filename: path including filename (optional)
:return: None
"""
result = self.make_request(
resource='export',
par... |
java | public static final byte[] toAsciiBytes(final String value)
{
byte[] result = new byte[value.length()];
for (int i = 0; i < value.length(); i++)
{
result[i] = (byte) value.charAt(i);
}
return result;
} |
java | public String format( String key, Object[] args )
{
try
{
String pattern = getPatternString( key );
StringBuffer buff = new StringBuffer( key.length() + SPAN );
MessageFormat messFormat = new MessageFormat( pattern, m_locale );
messFormat.format( args,... |
java | public static List<String> getTypeParameters(final String type) {
if (type.charAt(0) != 'L')
return emptyList();
int lastStart = type.indexOf('<') + 1;
final List<String> parameters = new ArrayList<>();
if (lastStart > 0) {
int depth = 0;
for (int i ... |
java | @SuppressWarnings("PMD.AvoidLiteralsInIfCondition")
public static String toStringTypes(final Type[] types,
final String separator,
final Map<String, Type> generics) {
final String res;
if (types.length == 0) {
... |
python | def QA_util_random_with_topic(topic='Acc', lens=8):
"""
生成account随机值
Acc+4数字id+4位大小写随机
"""
_list = [chr(i) for i in range(65,
91)] + [chr(i) for i in range(97,
123)
... |
python | def add_raw_data(self, data, attrs):
""" Add raw data for a read.
:param data: The raw data DAQ values (16 bit integers).
The read must already exist in the file. It must not already
have raw data.
"""
self.assert_writeable()
if "Raw" not in self.handle:
... |
python | def relative_deviation(h1, h2): # 18 us @array, 42 us @list \w 100 bins
r"""
Calculate the deviation between two histograms.
The relative deviation between two histograms :math:`H` and :math:`H'` of size :math:`m` is
defined as:
.. math::
d_{rd}(H, H') =
\frac{
... |
python | def save_all_figures_todir(self, dirname):
"""Save all figure in dirname."""
fignames = []
for thumbnail in self._thumbnails:
fig = thumbnail.canvas.fig
fmt = thumbnail.canvas.fmt
fext = {'image/png': '.png',
'image/jpeg': '.jpg',
... |
java | private void writeCompileOptions(final Writer writer, final boolean isDebug, final String baseDir,
final CommandLineCompilerConfiguration compilerConfig) throws IOException {
final StringBuffer baseOptions = new StringBuffer(50);
baseOptions.append("# ADD BASE CPP");
final StringBuffer options = new S... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.