language stringclasses 2
values | func_code_string stringlengths 63 466k |
|---|---|
python | def _interpret_oserror(exc, cwd, cmd):
"""Interpret an OSError exc and raise the appropriate dbt exception.
"""
if len(cmd) == 0:
raise dbt.exceptions.CommandError(cwd, cmd)
# all of these functions raise unconditionally
if os.name == 'nt':
_handle_windows_error(exc, cwd, cmd)
... |
python | def is_cell_big(self, cell_detection):
"""
Check if the cell is considered big.
@param CellFeature cell_detection:
@return:
"""
return cell_detection.area > self.parameters_tracking["big_size"] * self.scale * self.scale |
python | def send(self, message):
"""Make a Twilio SendGrid v3 API request with the request body generated by
the Mail object
:param message: The Twilio SendGrid v3 API request body generated by the Mail
object
:type message: Mail
"""
if isinsta... |
java | @Override
public void clear() {
super.clear();
if (this.nicosep != null) {
final N child = this.nicosep;
setIcosepChild(null);
child.clear();
}
} |
python | def _queue_job(redis, queue_name, delegate, *args):
"""
creates a new job on the queue
:param redis: redis
:param delegate: method to be executed by the queue. Use fully qualified method name as String.
:param args: arguments of the method
:return: jo... |
java | public static ScientificNumberFormatter getMarkupInstance(
DecimalFormat df,
String beginMarkup,
String endMarkup) {
return getInstance(
df, new MarkupStyle(beginMarkup, endMarkup));
} |
java | @Override
public void relocate()
{
int w = 360, h = 245;
int x = (this.getWidth() - w) / 2;
int y = (this.getHeight() - h) / 2;
outputLabel.setLocation(x, y);
outputPathField.setLocation(x + 160, y);
enableZipEncodingCompression.setLocation(x + 110, y + 40);
outputCompression.setLocation(x + 110, y ... |
python | def file_or_stderr(filename, *, mode="a", encoding="utf-8"):
"""Returns a context object wrapping either the given file or
stderr (if filename is None). This makes dealing with log files
more convenient.
"""
if filename is not None:
return open(filename, mode, encoding=encoding)
@conte... |
java | private Multimap<String, TokenRange> describeCassandraTopology(final Keyspace keyspace) {
try {
@SuppressWarnings ("unchecked")
ConnectionPool<Cassandra.Client> connectionPool = (ConnectionPool<Cassandra.Client>) keyspace.getConnectionPool();
return connectionPool.executeWit... |
java | public <T> T resolveFuture(final Future<T> future, final boolean autocancel) throws RuntimeException
{
while (isValid() && !future.isCancelled())
{
try
{
return future.get(getTimeLeft(), TimeUnit.MILLISECONDS);
}
catch (InterruptedException e)
{
// ignore and start waiting again
}
catc... |
java | public void clear() {
try {
events.cleanup();
events = new XFastEventList(this.attributeMapSerializer);
} catch (IOException e) {
e.printStackTrace();
}
} |
python | def get_firewall_rules(self, server):
"""
Return all FirewallRule objects based on a server instance or uuid.
"""
server_uuid, server_instance = uuid_and_instance(server)
url = '/server/{0}/firewall_rule'.format(server_uuid)
res = self.get_request(url)
return [
... |
java | public static <T> T construct(String classname, String readable) throws ConfigurationException
{
Class<T> cls = FBUtilities.classForName(classname, readable);
try
{
return cls.newInstance();
}
catch (IllegalAccessException e)
{
throw new Config... |
java | public List<GeneratorOutput> getCheckOutput(Filer filer) throws IOException
{
HashMap<String,Object> map = new HashMap<String,Object>();
map.put("impl", this); // control implementation
map.put("init", _init); // control impl ... |
python | def space_clone(args):
""" Replicate a workspace """
# FIXME: add --deep copy option (shallow by default)
# add aliasing capability, then make space_copy alias
if not args.to_workspace:
args.to_workspace = args.workspace
if not args.to_project:
args.to_project = args.project
... |
java | @RequestMapping(value = "/qrpay")
public void qrPay(
@RequestParam("orderNumber") String orderNumber,
HttpServletResponse response){
try {
String qrUrl = wepaySupport.qrPay(orderNumber);
response.sendRedirect(qrUrl);
} catch (IOException e) {
... |
python | def set_shape(self, shape):
"""Update the shape."""
channels = shape[-1]
acceptable_channels = ACCEPTABLE_CHANNELS[self._encoding_format]
if channels not in acceptable_channels:
raise ValueError('Acceptable `channels` for %s: %s (was %s)' % (
self._encoding_format, acceptable_channels, c... |
java | public static void notNullOrEmpty(String parameter, String name) throws IllegalArgumentException {
if (parameter == null || parameter.isEmpty()) {
throw new IllegalArgumentException(name + " is null or empty.");
}
} |
java | @SuppressWarnings("unchecked")
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case AfplibPackage.PGD__XPG_BASE:
setXpgBase((Integer)newValue);
return;
case AfplibPackage.PGD__YPG_BASE:
setYpgBase((Integer)newValue);
return;
case AfplibPackage.PGD__XPG_UNIT... |
java | public SessionInfo getLockSessionInfo(Task objSession, String strUserName)
{
if (objSession == null)
{
Utility.getLogger().warning("null session");
return new SessionInfo(0, strUserName); //
}
SessionInfo intSession = (SessionInfo)m_hmLockSessions.get(obj... |
java | protected BufferedImage create_FOREGROUND_Image(final int WIDTH, final boolean WITH_CENTER_KNOB, final ForegroundType TYPE, final BufferedImage IMAGE) {
switch (getFrameType()) {
case ROUND:
return FOREGROUND_FACTORY.createRadialForeground(WIDTH, WITH_CENTER_KNOB, TYPE, IMAGE);
... |
java | public Observable<ImagePrediction> predictImageUrlWithNoStoreAsync(UUID projectId, PredictImageUrlWithNoStoreOptionalParameter predictImageUrlWithNoStoreOptionalParameter) {
return predictImageUrlWithNoStoreWithServiceResponseAsync(projectId, predictImageUrlWithNoStoreOptionalParameter).map(new Func1<ServiceRes... |
python | def status(output=True, tgt='*', tgt_type='glob', timeout=None, gather_job_timeout=None):
'''
.. versionchanged:: 2017.7.0
The ``expr_form`` argument has been renamed to ``tgt_type``, earlier
releases must use ``expr_form``.
Print the status of all known salt minions
CLI Example:
... |
python | def set_log_level(self, level):
"""Set the logging level.
Parameters
----------
level : logging level constant
The value to set the logging level to.
"""
self._log_level = level
if self._python_logger:
try:
level = self.PY... |
java | private void initialize() {
// calculate the distinct groups of this role
Set<String> distinctGroups = new HashSet<String>(getAllGroupNames());
// by using a set first we eliminate duplicate names
m_distictGroupNames = Collections.unmodifiableList(new ArrayList<String>(distinctGroups));... |
java | public static Action getAndCheckAction(EntityDataModel entityDataModel, String actionName) {
int namespaceLastIndex = actionName.lastIndexOf('.');
String namespace = actionName.substring(0, namespaceLastIndex);
String simpleActionName = actionName.substring(namespaceLastIndex + 1);
Schem... |
java | @NonNull
@Deprecated
public static LocationEngine getBestLocationEngine(@NonNull Context context, boolean background) {
return getBestLocationEngine(context);
} |
python | def main():
""" Get arguments and call the execution function"""
if len(sys.argv) < 6:
print("Usage: %s server_url username password namespace' \
' classname" % sys.argv[0])
print('Using internal defaults')
server_url = SERVER_URL
namespace = TEST_NAMESPACE
... |
python | def update_translations(self, project_id, file_path=None,
language_code=None, overwrite=False, fuzzy_trigger=None):
"""
Updates translations
overwrite: set it to True if you want to overwrite definitions
fuzzy_trigger: set it to True to mark corresponding tra... |
java | public void marshall(ConfigStreamDeliveryInfo configStreamDeliveryInfo, ProtocolMarshaller protocolMarshaller) {
if (configStreamDeliveryInfo == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(configS... |
python | def remove(path, **kwargs):
r'''
Remove the directory from the SYSTEM path
Returns:
boolean True if successful, False if unsuccessful
rehash : True
If the registry was updated, and this value is set to ``True``, sends a
WM_SETTINGCHANGE broadcast to refresh the environment vari... |
java | public Canvas getViewPanel() {
VLayout layout = new VLayout(5);
layout.setPadding(5);
MapWidget mapWidget = new MapWidget("mapGuwOsm", "appGuw");
final RibbonBarLayout ribbonBar = new RibbonBarLayout(mapWidget, "appGuw", "guwRibbonBar1");
ribbonBar.setSize("100%", "94px");
ToolStrip toolStrip = new ToolSt... |
java | @Override
public void updateBinaryStream( String columnLabel,
InputStream x,
int length ) throws SQLException {
notClosed();
noUpdates();
} |
java | public EnvelopesInformation listStatus(String accountId, EnvelopeIdsRequest envelopeIdsRequest) throws ApiException {
return listStatus(accountId, envelopeIdsRequest, null);
} |
python | def map_sections(fun, neurites, neurite_type=NeuriteType.all, iterator_type=Tree.ipreorder):
'''Map `fun` to all the sections in a collection of neurites'''
return map(fun, iter_sections(neurites,
iterator_type=iterator_type,
neurite_filter=is_... |
python | def normalize(X):
"""
MinMax normalization to fit a matrix in the space [0,1] by column.
"""
a = X.min(axis=0)
b = X.max(axis=0)
return (X - a[np.newaxis, :]) / ((b - a)[np.newaxis, :]) |
python | def from_resource_deeper(
self, resource_id=None, limit_depth=1000000, db_session=None, *args, **kwargs
):
"""
This returns you subtree of ordered objects relative
to the start resource_id (currently only implemented in postgresql)
:param resource_id:
:param limit_de... |
python | def var_str(name, shape):
"""Return a sequence of strings naming the element of the tallyable object.
:Example:
>>> var_str('theta', (4,))
['theta[1]', 'theta[2]', 'theta[3]', 'theta[4]']
"""
size = prod(shape)
ind = (indices(shape) + 1).reshape(-1, size)
names = ['[' + ','.join(list(... |
java | @NonNull
private static ObservableTransformer<byte[], PresenterEvent> transformToPresenterEvent(Type type) {
return observable -> observable.map(writtenBytes -> ((PresenterEvent) new ResultEvent(writtenBytes, type)))
.onErrorReturn(throwable -> new ErrorEvent(throwable, type));
} |
java | @Override
public View getDropDownView(int position, View convertView, ViewGroup parent) {
// depending on the position, use super method or create our own
// we don't need to inflate a footer view if it uses the default resource, the superclass will do it:
if(footer == null || footerResource... |
python | def seqToKV(seq, strict=False):
"""Represent a sequence of pairs of strings as newline-terminated
key:value pairs. The pairs are generated in the order given.
@param seq: The pairs
@type seq: [(str, (unicode|str))]
@return: A string representation of the sequence
@rtype: bytes
"""
def... |
python | def render_property(property):
"""Render a property for bosh manifest, according to its type."""
# This ain't the prettiest thing, but it should get the job done.
# I don't think we have anything more elegant available at bosh-manifest-generation time.
# See https://docs.pivotal.io/partners/product-template-referen... |
java | public static void deleteRecursively(ZooKeeperIface zk, String path)
throws IOException {
try {
List<String> children = zk.getChildren(path, false);
for (String child : children) {
deleteRecursively(zk, joinPath(path, child));
}
zk.delete(path, -1);
} catch (KeeperException... |
java | private Condition parseFileCondition(Element element) {
FileCondition condition = new FileCondition();
condition.setFilePath(element.getAttribute("path"));
return condition;
} |
java | public Observable<ServiceResponse<KeyPhraseBatchResult>> keyPhrasesWithServiceResponseAsync(KeyPhrasesOptionalParameter keyPhrasesOptionalParameter) {
if (this.client.azureRegion() == null) {
throw new IllegalArgumentException("Parameter this.client.azureRegion() is required and cannot be null.");
... |
java | @Generated(value = "com.ibm.jtc.jax.tools.xjc.Driver", date = "2014-06-11T05:49:00-04:00", comments = "JAXB RI v2.2.3-11/28/2011 06:21 AM(foreman)-")
public List<JSLProperties> getProperties() {
if (properties == null) {
properties = new ArrayList<JSLProperties>();
}
return this.... |
java | public String getDocumentTypeDeclarationPublicIdentifier()
{
Document doc;
if (m_root.getNodeType() == Node.DOCUMENT_NODE)
doc = (Document) m_root;
else
doc = m_root.getOwnerDocument();
if (null != doc)
{
DocumentType dtd = doc.getDoctype();
if (null != dtd)
{
... |
python | def to_json(self):
"""
Returns the options as JSON.
:return: the object as string
:rtype: str
"""
return json.dumps(self.to_dict(), sort_keys=True, indent=2, separators=(',', ': ')) |
java | public static String escapeJS(String str, char quotesUsed) {
return escapeJS(str, quotesUsed, (CharsetEncoder) null);
} |
python | def create(parser: Parser, obj: PersistedObject = None):
"""
Helper method provided because we actually can't put that in the constructor, it creates a bug in Nose tests
https://github.com/nose-devs/nose/issues/725
:param parser:
:param obj:
:return:
"""
... |
java | public final void bsr(Register dst, Mem src)
{
assert(!dst.isRegType(REG_GPB));
emitX86(INST_BSR, dst, src);
} |
python | def solveConsKinkyPref(solution_next,IncomeDstn,PrefShkDstn,
LivPrb,DiscFac,CRRA,Rboro,Rsave,PermGroFac,BoroCnstArt,
aXtraGrid,vFuncBool,CubicBool):
'''
Solves a single period of a consumption-saving model with preference shocks
to marginal utility and a differe... |
python | def check_option(self, key, subkey, value):
"""Evaluate if a given value fits the option.
If an option has a limited set of available values, check if the
provided value is amongst them.
:param str key: First identifier of the option.
:param str subkey: Second identifier of the... |
python | def _set_containable_view(self, session):
"""Sets the underlying containable views to match current view"""
for obj_name in self._containable_views:
if self._containable_views[obj_name] == SEQUESTERED:
try:
getattr(session, 'use_sequestered_' + obj_name + ... |
python | def createPaypalPayment(request):
'''
This view handles the creation of Paypal Express Checkout Payment objects.
All Express Checkout payments must either be associated with a pre-existing Invoice
or a registration, or they must have an amount and type passed in the post data
(such as gift certific... |
python | def reverse_format(format_string, resolved_string):
"""
Reverse the string method format.
Given format_string and resolved_string, find arguments that would
give ``format_string.format(**arguments) == resolved_string``
Parameters
----------
format_string : str
Format template strin... |
java | private CmsObject initCmsObject(
HttpServletRequest req,
HttpServletResponse res,
String user,
String password,
String ouFqn)
throws CmsException {
String siteroot = null;
// gather information from request if provided
if (req != null) {
s... |
java | public List<Polygon> polygons() {
List<List<List<Point>>> coordinates = coordinates();
List<Polygon> polygons = new ArrayList<>(coordinates.size());
for (List<List<Point>> points : coordinates) {
polygons.add(Polygon.fromLngLats(points));
}
return polygons;
} |
java | public ListPullRequestsResult withPullRequestIds(String... pullRequestIds) {
if (this.pullRequestIds == null) {
setPullRequestIds(new java.util.ArrayList<String>(pullRequestIds.length));
}
for (String ele : pullRequestIds) {
this.pullRequestIds.add(ele);
}
... |
java | public @Nullable Page getPage(@Nullable Predicate<Page> filter, @Nullable Page basePage) {
List<Page> suffixPages = getPages(filter, basePage);
if (suffixPages.isEmpty()) {
return null;
}
else {
return suffixPages.get(0);
}
} |
python | def subp(cmd):
"""
Run a command as a subprocess.
Return a triple of return code, standard out, standard err.
"""
proc = subprocess.Popen(cmd, stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
out, err = proc.communicate()
return ReturnTuple(proc.returncode, stdout=... |
java | @Override
protected ResultSet findChildNodesByParentIdentifier(String parentCid) throws SQLException
{
if (findNodesByParentId == null)
{
findNodesByParentId = dbConnection.prepareStatement(FIND_NODES_BY_PARENTID);
}
else
{
findNodesByParentId.clearParameters();
... |
java | public static DZcs cs_permute(DZcs A, int[] pinv, int[] q, boolean values)
{
int t, j, k, nz = 0, m, n, Ap[], Ai[], Cp[], Ci[] ;
DZcsa Cx = new DZcsa(), Ax = new DZcsa() ;
DZcs C ;
if (!CS_CSC(A)) return (null); /* check inputs */
m = A.m ; n = A.n ; Ap = A.p ; Ai = A.i ; Ax.x = A.x ;
C = cs_spallo... |
python | def do_files_exist(filenames):
"""Whether any of the filenames exist."""
preexisting = [tf.io.gfile.exists(f) for f in filenames]
return any(preexisting) |
java | public static Iterator<String> iterateClassnames(final File parentDirectory,
final File ... classFiles) {
return iterateClassnames(parentDirectory, Arrays.asList(classFiles).iterator());
} |
python | def sort(self, key, reverse=False):
"""Stable sort of the table *IN-PLACE* with respect to a column.
Parameters
----------
key: int, str
index or header of the column. Normal list rules apply.
reverse : bool
If `True` then table is sorted as if each compa... |
java | @SuppressWarnings("unchecked")
private <T extends WorkContext> Class<T> getSupportedWorkContextClass(Class<T> adaptorWorkContext)
{
for (Class<? extends WorkContext> supportedWorkContext : SUPPORTED_WORK_CONTEXT_CLASSES)
{
// Assignable or not
if (supportedWorkContext.isAssignableFro... |
java | public URIBuilder setQuery(final String query) {
this.queryParams = parseQuery(query, Consts.UTF_8);
this.encodedQuery = null;
this.encodedSchemeSpecificPart = null;
return this;
} |
java | @Generated(value={"com.threerings.presents.tools.GenDObjectTask"})
public void setCode (String value)
{
String ovalue = this.code;
requestAttributeChange(
CODE, value, ovalue);
this.code = value;
} |
java | public
int appendLoopOnAppenders(LoggingEvent event) {
int nb = 0;
for (Appender appender : appenderList) {
appender.doAppend(event);
nb++;
}
return nb;
} |
java | public <T> DiffNode compare(final T working, final T base)
{
dispatcher.resetInstanceMemory();
try
{
return dispatcher.dispatch(DiffNode.ROOT, Instances.of(working, base), RootAccessor.getInstance());
}
finally
{
dispatcher.clearInstanceMemory();
}
} |
java | protected String delBase(final AbstractDelRequest request) throws AbstractCosException {
request.check_param();
String url = buildUrl(request);
String sign = Sign.getOneEffectiveSign(request.getBucketName(), request.getCosPath(), this.cred);
HttpRequest httpRequest = new HttpRequest();
httpRequest.setUrl(ur... |
java | public boolean skipSpaces ()
{
while (m_nPos < m_sValue.length () && m_sValue.charAt (m_nPos) == ' ')
m_nPos++;
return m_nPos < m_sValue.length ();
} |
java | public List<TextPair> getInlineTextPairs(boolean markTemplates) {
List<TextPair> pairList = new ArrayList<TextPair>();
try {
//extract sections
List<ExtractedSection> beforeSections=null;
List<ExtractedSection> afterSections=null;
if(markTemplates){
//add inline marker for the template
... |
python | def children(self):
"""get children node referenced as `children` in the
report.
:rtype: dict with name (str) -> node (ReportNode)
"""
for child in self.data.get('children', []):
if osp.exists(osp.join(self.path, child, YAML_REPORT_FILE)):
yield child,... |
java | public <U extends T, A, B> InitialMatching2<T, U, A, B> when(
DecomposableMatchBuilder2<U, A, B> decomposableMatchBuilder) {
return new InitialMatching2<>(decomposableMatchBuilder.build(), value);
} |
java | public boolean isPrintableControl(ScreenField sField, int iPrintOptions)
{
if ((sField == null) || (sField == this))
return this.getScreenFieldView().isPrintableControl(iPrintOptions);
return sField.isPrintableControl(null, iPrintOptions);
} |
java | public void count(String propertyName, String alias) {
final CountProjection proj = Projections.count(calculatePropertyName(propertyName));
addProjectionToList(proj, alias);
} |
java | @Override
public <T> T getParameterValue(Parameter<T> paramParameter)
{
Object value = kunderaQuery.getClauseValue(paramParameter);
if (value == null)
{
throw new IllegalStateException("parameter has not been bound" + paramParameter);
}
return (T) value;
} |
java | public Map<BenchmarkMethod, Integer> getNumberOfMethodsAndRuns()
throws PerfidixMethodCheckException {
final Map<BenchmarkMethod, Integer> returnVal = new HashMap<BenchmarkMethod, Integer>();
// instantiate objects, just for getting runs
final List<BenchmarkMethod> meths = getBenchmarkMethods();
for (final B... |
python | def _big_endian_int(bits: np.ndarray) -> int:
"""Returns the big-endian integer specified by the given bits.
For example, [True, False, False, True, False] becomes binary 10010 which
is 18 in decimal.
Args:
bits: Descending bits of the integer, with the 1s bit at the end.
Returns:
... |
java | public BatchDetectSyntaxResult withResultList(BatchDetectSyntaxItemResult... resultList) {
if (this.resultList == null) {
setResultList(new java.util.ArrayList<BatchDetectSyntaxItemResult>(resultList.length));
}
for (BatchDetectSyntaxItemResult ele : resultList) {
this.re... |
python | def find_range(self, interval):
"""wrapper for find"""
return self.find(self.tree, interval, self.start, self.end) |
java | protected final void pagedExecuteWorkFlow(String queryId, LogicalWorkflow workflow, IResultHandler resultHandler,
int pageSize) throws ConnectorException {
checkIsSupported(workflow);
ClusterName clusterName = ((Project) workflow.getInitialSteps().get(0)).g... |
python | def _words_by_distinctiveness_score(vocab, topic_word_distrib, doc_topic_distrib, doc_lengths, n=None,
least_to_most=False):
"""Return words in `vocab` ordered by distinctiveness score."""
p_t = get_marginal_topic_distrib(doc_topic_distrib, doc_lengths)
distinct = get_wor... |
python | def cipher(rkey, pt, Nk=4):
"""AES encryption cipher."""
assert Nk in {4, 6, 8}
Nr = Nk + 6
rkey = rkey.reshape(4*(Nr+1), 32)
pt = pt.reshape(128)
# first round
state = add_round_key(pt, rkey[0:4])
for i in range(1, Nr):
state = sub_bytes(state)
state = shift_rows(stat... |
java | public static String getRedactedJsonString(final String jsonString, final String... jsonPathsToRedact) {
String rtn = "";
if (jsonString != null && jsonString != "") {
rtn = jsonString;
try {
ObjectMapper mapper = new ObjectMapper();
JsonNode rootJsonNode = mapper.readTree(jsonString... |
python | def dim_dc(self, pars):
r"""
:math:`\frac{\partial \hat{\rho''}(\omega)}{\partial c} = \rho_0
\frac{-m sin(\frac{c \pi}{2}) ln(\omega \tau)(\omega \tau)^c - m
(\omega \tau)^c \frac{\pi}{2} cos(\frac{\pi}{2}}{1 + 2 (\omega \tau)^c
cos(\frac{c \pi}{2}) + (\omega \tau)^{2 c}} + \rho... |
python | def estimate_row_scales(
self,
X_centered,
column_scales):
"""
row_scale[i]**2 =
mean{j in observed[i, :]}{
(X[i, j] - row_center[i] - column_center[j]) ** 2
--------------------------------------------------
col... |
java | public void setupKeyBuffer(BaseBuffer destBuffer, int iAreaDesc, boolean bMoveToField)
{
boolean bForceUniqueKey = true;
int iKeyFieldCount = this.getKeyFields(bForceUniqueKey, false);
for (int iKeyFieldSeq = DBConstants.MAIN_KEY_FIELD; iKeyFieldSeq < iKeyFieldCount; iKeyFieldSeq++)
... |
java | public static boolean isMultipart(HttpServletRequest request) {
if (!"post".equals(request.getMethod().toLowerCase())) {
return false;
}
String contentType = request.getContentType();
return contentType != null && contentType.toLowerCase().startsWith("multipart/");
} |
python | def _add_span_node_ids_to_token_nodes(self):
"""
Adds to every token node the list of spans (span node IDs) that it
belongs to.
TokenNode.spans - a list of `int` ids of `SpanNode`s
"""
span_dict = defaultdict(list)
for span_edge in self._spanning_relation_ids:
... |
python | def search(reader, key, prev_size=0, compare_func=cmp, block_size=8192):
"""
Perform a binary search for a specified key to within a 'block_size'
(default 8192) sized block followed by linear search
within the block to find first matching line.
When performin_g linear search, keep track of up to N ... |
java | public Response deleteMultiple(@NotNull @PathParam("ids") URI_ID id,
@NotNull @PathParam("ids") final PathSegment ids,
@QueryParam("permanent") final boolean permanent) throws Exception {
Set<String> idSet = ids.getMatrixParameters().keySet()... |
java | void update() {
final BundleContext context = componentContext.getBundleContext();
// determine the service filter to use for discovering the Library service this bell is for
String libraryRef = library.id();
// it is unclear if only looking at the id would work here.
// other ex... |
python | def _match_error_to_data_set(x, ex):
"""
Inflates ex to match the dimensionality of x, "intelligently".
x is assumed to be a 2D array.
"""
# Simplest case, ex is None or a number
if not _fun.is_iterable(ex):
# Just make a matched list of Nones
if ex is None: ex = [ex]*l... |
python | def _cleave_interface(self, bulk_silica, tile_x, tile_y, thickness):
"""Carve interface from bulk silica.
Also includes a buffer of O's above and below the surface to ensure the
interface is coated.
"""
O_buffer = self._O_buffer
tile_z = int(math.ceil((thickness + 2*O_bu... |
java | public static <K, V> ImmutableMap<K, V> copyParallelListsToMap(Iterable<K> keys,
Iterable<V> values) {
final ImmutableMap.Builder<K, V> ret = ImmutableMap.builder();
final Iterator<K> keyIt = keys.iterator();
final Iterator<V> valueIt = values.iterator();
while (keyIt.hasNext() && valueIt.hasNex... |
python | def OR(self):
"""
Switches default query joiner from " AND " to " OR "
Returns:
Self. Queryset object.
"""
clone = copy.deepcopy(self)
clone.adapter._QUERY_GLUE = ' OR '
return clone |
java | public static String cloneContent(String source, GitService service, String comment) throws Exception {
String rev = GitService.moveContentToBranch(source, service, service.getBranchName(), comment);
service.push(false);
return rev;
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.