language stringclasses 2
values | func_code_string stringlengths 63 466k |
|---|---|
python | def update_metadata_filters(metadata, jupyter_md, cell_metadata):
"""Update or set the notebook and cell metadata filters"""
cell_metadata = [m for m in cell_metadata if m not in ['language', 'magic_args']]
if 'cell_metadata_filter' in metadata.get('jupytext', {}):
metadata_filter = metadata_filte... |
python | def parse(self, xml_file, view_name=None) -> XmlNode:
"""Parses xml file with xml_path and returns XmlNode"""
self._setup_parser()
try:
self._view_name = view_name
self._parser.ParseFile(xml_file)
except ExpatError as error:
# pylint: disable=E1101
... |
java | protected PListAccessor getInfoPListAccessor(XCodeContext.SourceCodeLocation location, String configuration,
String sdk)
throws MojoExecutionException, XCodeException
{
File plistFile = getPListFile(location, configuration, sdk);
if (!plistFile.isFile()) {
throw new MojoExecutionExceptio... |
python | def send_notification(self, user, sender=None, **kwargs):
"""
An intermediary function for sending an notification email informing
a pre-existing, active user that they have been added to a new
organization.
"""
if not user.is_active:
return False
self... |
java | public static void main(String args[]) {
// Here's an example of how to use JSONEmitter. This produces the following JSON:
// {"doc": {
// "fields": [
// {"Title": "Zen and the Art of Motorcycle Maintenance"},
// {"Amazon-Link": "http://ww... |
python | def base_ws_uri():
"""Base websocket URL that is advertised to external clients.
Useful when the websocket URL advertised to the clients needs to be
customized (typically when running behind NAT, firewall, etc.)
"""
scheme = config['wsserver']['advertised_scheme']
host = config['wsserver']['ad... |
python | def logout(request, next_page=None):
"""
Redirects to CAS logout page
:param: request RequestObj
:param: next_page Page to redirect to
"""
auth.logout(request)
if not next_page:
next_page = _redirect_url(request)
if settings.CAS_LOGOUT_COMPLETELY:
return HttpResponse... |
java | public static <T> T findValue(ServiceRegistry registry, ServiceName name) {
ServiceController<T> service = findService(registry, name);
return ((service != null) && (service.getState() == State.UP)) ? service.getValue() : null;
} |
python | def hash_edge(source, target, edge_data: EdgeData) -> str:
"""Convert an edge tuple to a SHA-512 hash.
:param BaseEntity source: The source BEL node
:param BaseEntity target: The target BEL node
:param edge_data: The edge's data dictionary
:return: A hashed version of the edge tuple using md5 hash ... |
python | def _extract_attrs(x, n):
"""Extracts attributes for an image. n is the index where the
attributes begin. Extracted elements are deleted from the element
list x. Attrs are returned in pandoc format.
"""
try:
return extract_attrs(x, n)
except (ValueError, IndexError):
if PAND... |
python | async def requirements(client: Client, search: str) -> dict:
"""
GET list of requirements for a given UID/Public key
:param client: Client to connect to the api
:param search: UID or public key
:return:
"""
return await client.get(MODULE + '/requirements/%s' % search, schema=REQUIREMENTS_SC... |
python | def normal_var(data, mean):
""" Creates a segment cost function for a time series with a
Normal distribution with changing variance
Args:
data (:obj:`list` of float): 1D time series data
variance (float): variance
Returns:
function: Function with signature
(int, ... |
python | def view_history(name, gitref):
"""Serve a page name from git repo (an old version of a page).
.. note:: this is a bottle view
* this is a GET only method : you can not change a committed page
Keyword Arguments:
:name: (str) -- name of the rest file (without the .rst extension)
:gitre... |
java | protected void validate(String operationType) throws Exception
{
super.validate(operationType);
MPSInt ns_vlan_id_validator = new MPSInt();
ns_vlan_id_validator.setConstraintMinValue(MPSConstants.GENERIC_CONSTRAINT, 0);
ns_vlan_id_validator.setConstraintMaxValue(MPSConstants.GENERIC_CONSTRAINT, 4095);
... |
python | def stop(self):
"""Stops logging and closes the file."""
self._flush()
filesize = self.file.tell()
super(BLFWriter, self).stop()
# Write header in the beginning of the file
header = [b"LOGG", FILE_HEADER_SIZE,
APPLICATION_ID, 0, 0, 0, 2, 6, 8, 1]
... |
java | public List<String> getLoggerNames() {
return Collections.list(java.util.logging.LogManager.getLogManager().getLoggerNames());
} |
java | public com.google.api.ads.admanager.axis.v201811.DateTime getStartTime() {
return startTime;
} |
java | public static Integer valueOf(String s, int radix) throws NumberFormatException {
return Integer.valueOf(parseInt(s,radix));
} |
java | public static AccountRegisterResult accountRegister(String accessToken,
AccountRegister accountRegister) {
return accountRegister(accessToken,
JsonUtil.toJSONString(accountRegister));
} |
python | def create_intent(project_id, display_name, training_phrases_parts,
message_texts):
"""Create an intent of the given intent type."""
import dialogflow_v2 as dialogflow
intents_client = dialogflow.IntentsClient()
parent = intents_client.project_agent_path(project_id)
training_phras... |
java | public static void main(String[] args) throws Exception {
int mb = 1024*1024;
//Getting the runtime reference from system
Runtime runtime = Runtime.getRuntime();
System.out.println("##### Heap utilization statistics [MB] #####");
//Print used memory
System.out.println("Used Memory:"
+ (runtime.total... |
java | public void xdsl_setting_POST(Boolean resellerFastModemShipping, Boolean resellerModemBasicConfig) throws IOException {
String qPath = "/me/xdsl/setting";
StringBuilder sb = path(qPath);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "resellerFastModemShipping", resellerFastModemShipping);... |
java | private TaskDef getTaskDefFromDB(String name) {
final String READ_ONE_TASKDEF_QUERY = "SELECT json_data FROM meta_task_def WHERE name = ?";
return queryWithTransaction(READ_ONE_TASKDEF_QUERY,
q -> q.addParameter(name).executeAndFetchFirst(TaskDef.class));
} |
java | public com.google.privacy.dlp.v2.AnalyzeDataSourceRiskDetails.KMapEstimationResult
getKMapEstimationResult() {
if (resultCase_ == 7) {
return (com.google.privacy.dlp.v2.AnalyzeDataSourceRiskDetails.KMapEstimationResult) result_;
}
return com.google.privacy.dlp.v2.AnalyzeDataSourceRiskDetails.KMa... |
python | def export(self, location):
"""Export the Bazaar repository at the url to the destination location"""
temp_dir = tempfile.mkdtemp('-export', 'pip-')
self.unpack(temp_dir)
if os.path.exists(location):
# Remove the location to make sure Bazaar can export it correctly
... |
python | def __is_function_action(self, action_function):
"""
Detect if given function is really an action function.
Args:
action_function: Function to test.
Note:
We don't care if the variable refer to a function but rather if it is callable or not.
"""
... |
python | def get_output_stream(encoding=anytemplate.compat.ENCODING,
ostream=sys.stdout):
"""
Get output stream take care of characters encoding correctly.
:param ostream: Output stream (file-like object); sys.stdout by default
:param encoding: Characters set encoding, e.g. UTF-8
:retu... |
java | @Nullable
public Capabilities getCapabilities() {
MutableCapabilities capabilities = (MutableCapabilities) super.getCapabilities();
if (capabilities != null) {
capabilities.setCapability(PLATFORM_NAME, IOS_PLATFORM);
}
return capabilities;
} |
python | def shared_prefix(args):
"""
Find the shared prefix between the strings.
For instance:
sharedPrefix(['blahblah', 'blahwhat'])
returns 'blah'.
"""
i = 0
while i < min(map(len, args)):
if len(set(map(operator.itemgetter(i), args))) != 1:
break
i += 1
... |
java | public static Bitmap loadBitmapOptimized(Uri uri, Context context, int limit) throws ImageLoadException {
return loadBitmapOptimized(new UriSource(uri, context) {
}, limit);
} |
java | @Override
public SIBusMessage receiveWithWait(SITransaction siTran,
long timeout)
throws SISessionUnavailableException, SISessionDroppedException,
SIResourceException, SIConnectionLostException, SILimitExceededException,
... |
java | private final void checkCompatibility(VariableNumMap other) {
int i = 0, j = 0;
int[] otherNums = other.nums;
String[] otherNames = other.names;
Variable[] otherVars = other.vars;
while (i < nums.length && j < otherNums.length) {
if (nums[i] < otherNums[j]) {
i++;
} else if (nums... |
java | @Override
public void clearCache(
CPDefinitionVirtualSetting cpDefinitionVirtualSetting) {
entityCache.removeResult(CPDefinitionVirtualSettingModelImpl.ENTITY_CACHE_ENABLED,
CPDefinitionVirtualSettingImpl.class,
cpDefinitionVirtualSetting.getPrimaryKey());
finderCache.clearCache(FINDER_CLASS_NAME_LIST_WIT... |
python | def generic_visit(self, node, *args, **kwargs):
"""Called if no explicit visitor function exists for a node."""
for node in node.iter_child_nodes():
self.visit(node, *args, **kwargs) |
python | def lineReceived(self, line):
"""
Called when a line is received.
We expect a length in bytes or an empty line for keep-alive. If
we got a length, switch to raw mode to receive that amount of bytes.
"""
if line and line.isdigit():
self._expectedLength = int(l... |
java | public void printStackTrace() {
if (detail == null) {
super.printStackTrace();
} else {
synchronized(System.err) {
System.err.println(super.getMessage() + "; nested exception is:");
detail.printStackTrace();
}
}
} |
java | public void constrainViewport(float left, float top, float right, float bottom) {
if (right - left < minViewportWidth) {
// Minimum width - constrain horizontal zoom!
right = left + minViewportWidth;
if (left < maxViewport.left) {
left = maxViewport.left;
... |
python | def orbit_on_path(self, path=None, focus=None, step=0.5, viewup=None, bkg=True):
"""Orbit on the given path focusing on the focus point
Parameters
----------
path : vtki.PolyData
Path of orbital points. The order in the points is the order of
travel
focu... |
java | private UnicodeSet applyFilter(Filter filter, int src) {
// Logically, walk through all Unicode characters, noting the start
// and end of each range for which filter.contain(c) is
// true. Add each range to a set.
//
// To improve performance, use an inclusions set which
... |
python | def fix_bam_header(job, bamfile, sample_type, univ_options, samtools_options, retained_chroms=None):
"""
Fix the bam header to remove the command line call. Failing to do this causes Picard to reject
the bam.
:param dict bamfile: The input bam file
:param str sample_type: Description of the sample... |
python | def flatten(value):
"""value can be any nesting of tuples, arrays, dicts.
returns 1D numpy array and an unflatten function."""
if isinstance(value, np.ndarray):
def unflatten(vector):
return np.reshape(vector, value.shape)
return np.ravel(value), unflatten
elif isinstance... |
java | private JMenu getSuperMenu (String name, int index) {
JMenu superMenu = superMenus.get(name);
if (superMenu == null) {
// Use an ExtensionPopupMenu so child menus are dismissed
superMenu = new ExtensionPopupMenu(name) {
private static final long serialVersionUID = 6825880451078204378L;
@Over... |
java | public static void addProvidersToPathHandler(PathResourceProvider[] pathResourceProviders, PathHandler pathHandler) {
if (pathResourceProviders != null && pathResourceProviders.length > 0) {
for (PathResourceProvider pathResourceProvider : pathResourceProviders) {
if (pathResourcePro... |
python | def get_analysis_intervals(data, vrn_file, base_dir):
"""Retrieve analysis regions for the current variant calling pipeline.
"""
from bcbio.bam import callable
if vrn_file and vcfutils.is_gvcf_file(vrn_file):
callable_bed = _callable_from_gvcf(data, vrn_file, base_dir)
if callable_bed:
... |
java | public static PauseStatus determinePauseStatus(TransferState transferState,
boolean forceCancel) {
if (forceCancel) {
if (transferState == TransferState.Waiting) {
return PauseStatus.CANCELLED_BEFORE_START;
} else if (transferState == TransferState.InProgress... |
python | def run_command(nova_creds, nova_args, supernova_args):
"""
Sets the environment variables for the executable, runs the executable,
and handles the output.
"""
nova_env = supernova_args['nova_env']
# (gtmanfred) make a copy of this object. If we don't copy it, the insert
# to 0 happens mult... |
python | def iau2000a(jd_tt):
"""Compute Earth nutation based on the IAU 2000A nutation model.
`jd_tt` - Terrestrial Time: Julian date float, or NumPy array of floats
Returns a tuple ``(delta_psi, delta_epsilon)`` measured in tenths of
a micro-arcsecond. Each value is either a float, or a NumPy array
with... |
python | def do_some_work(self, can_start_more):
'''Run one cycle of the main loop.
If the log child has died, restart it. If any of the worker
children have died, collect their status codes and remove them
from the child set. If there is a worker slot available, start
exactly one chil... |
java | public static double toGrowthRateFromAnnualReturn(double annualReturn, CalendarDateUnit growthRateUnit) {
double tmpAnnualGrowthRate = PrimitiveMath.LOG1P.invoke(annualReturn);
double tmpYearsPerGrowthRateUnit = CalendarDateUnit.YEAR.convert(growthRateUnit);
return tmpAnnualGrowthRate * tmpYears... |
java | public ConfigurationUpdate removePath(String path) {
if (path == null || !path.startsWith("/")) {
throw new IllegalArgumentException("Path must start with \"/\".");
}
paths.put(path, null);
return this;
} |
python | def compose(layers, bbox=None, layer_filter=None, color=None, **kwargs):
"""
Compose layers to a single :py:class:`PIL.Image`.
If the layers do not have visible pixels, the function returns `None`.
Example::
image = compose([layer1, layer2])
In order to skip some layers, pass `layer_filte... |
java | List<ResourceSet> computeResourceSetList() {
List<ResourceSet> sourceFolderSets = resSetSupplier.get();
int size = sourceFolderSets.size() + 4;
if (libraries != null) {
size += libraries.getArtifacts().size();
}
List<ResourceSet> resourceSetList = Lists.newArrayListW... |
java | void completeMerge(SegmentMetadata sourceMetadata) {
long traceId = LoggerHelpers.traceEnterWithContext(log, this.traceObjectId, "completeMerge", sourceMetadata.getId());
Exceptions.checkNotClosed(this.closed, this);
Exceptions.checkArgument(sourceMetadata.isDeleted(), "sourceSegmentStreamId",
... |
java | private void path(Attributes attributes) throws SVGParseException
{
debug("<path>");
if (currentElement == null)
throw new SVGParseException("Invalid document. Root element must be <svg>");
SVG.Path obj = new SVG.Path();
obj.document = svgDocument;
obj.parent = curre... |
java | public static nspbr[] get(nitro_service service, nspbr_args args) throws Exception{
nspbr obj = new nspbr();
options option = new options();
option.set_args(nitro_util.object_to_string_withoutquotes(args));
nspbr[] response = (nspbr[])obj.get_resources(service, option);
return response;
} |
python | def create(self, friendly_name=values.unset, apn_credential_sid=values.unset,
gcm_credential_sid=values.unset, messaging_service_sid=values.unset,
facebook_messenger_page_id=values.unset,
default_apn_notification_protocol_version=values.unset,
default_gcm_noti... |
python | def rename_with_prefix(self, prefix="", new_path=None, in_place=True, remove_desc=True):
"""Rename every sequence based on a prefix."""
# Temporary path #
if new_path is None: prefixed = self.__class__(new_temp_path())
else: prefixed = self.__class__(new_path)
# Ge... |
java | private boolean setupPipelineForAppend(LocatedBlock lastBlock) throws IOException {
if (nodes == null || nodes.length == 0) {
String msg = "Could not get block locations. " +
"Source file \"" + src
+ "\" - Aborting...";
DFSClient.LOG.warn(msg);
setLastException(new IOException(... |
python | def attach_volume(self, volume_id, instance_id, device):
"""
Attach an EBS volume to an EC2 instance.
:type volume_id: str
:param volume_id: The ID of the EBS volume to be attached.
:type instance_id: str
:param instance_id: The ID of the EC2 instance to which it will
... |
python | def set_restart_delay(seconds):
'''
Set the number of seconds after which the computer will start up after a
power failure.
.. warning::
This command fails with the following error:
``Error, IOServiceOpen returned 0x10000003``
The setting is not updated. This is an apple bug.... |
python | def index_table(self, axis=None, baseline=None, prune=False):
"""Return index percentages for a given axis and baseline.
The index values represent the difference of the percentages to the
corresponding baseline values. The baseline values are the univariate
percentages of the correspon... |
python | def addPath(rel_path, prepend=False):
""" Adds a directory to the system python path, either by append (doesn't
override default or globally installed package names) or by prepend
(overrides default/global package names).
"""
path = lambda *paths: os.path.abspath(
os.path.join(os.path.dirnam... |
python | def Get_RpRs(d, **kwargs):
'''
Returns the value of the planet radius over the stellar radius
for a given depth :py:obj:`d`, given
the :py:class:`everest.pysyzygy` transit :py:obj:`kwargs`.
'''
if ps is None:
raise Exception("Unable to import `pysyzygy`.")
def Depth(RpRs, **kwa... |
java | public Server create(int maxThreads, int minThreads, int threadTimeoutMillis) {
Server server;
if (maxThreads > 0) {
int max = maxThreads;
int min = (minThreads > 0) ? minThreads : 8;
int idleTimeout = (threadTimeoutMillis > 0) ? threadTimeoutMillis : 60000;
... |
python | def com_google_fonts_check_family_equal_glyph_names(ttFonts):
"""Fonts have equal glyph names?"""
fonts = list(ttFonts)
all_glyphnames = set()
for ttFont in fonts:
all_glyphnames |= set(ttFont["glyf"].glyphs.keys())
missing = {}
available = {}
for glyphname in all_glyphnames:
missing[glyphname] ... |
java | private static void setOptional(Request req) {
GregorianCalendar gc = new GregorianCalendar();
req.setStart(Chrono.timeStamp(gc));
gc.add(GregorianCalendar.MONTH, 6);
req.setEnd(Chrono.timeStamp(gc));
// req.setForce("false");
} |
python | def notify_block_new(self, block):
"""A new block was received and passed initial consensus validation"""
payload = block.SerializeToString()
self._notify(
"consensus_notifier_notify_block_new", payload, len(payload)) |
java | public static int search(String str, String keyw) {
int strLen = str.length();
int keywLen = keyw.length();
int pos = 0;
int cnt = 0;
if (keywLen == 0) {
return 0;
}
while ((pos = str.indexOf(keyw, pos)) != -1) {
pos += keywLen;
... |
java | @Override
public boolean onKeyUp (int keyCode, KeyEvent event){
Fragment frag = getSupportFragmentManager().findFragmentByTag(SAMPLES_FRAGMENT_TAG);
if (frag==null) {
return super.onKeyUp(keyCode, event);
}
if (!(frag instanceof BaseSampleFragment)) {
return s... |
python | def plotPixel(self, x, y, color="black"):
"""
Doesn't use coordinant system.
"""
p = Point(x, y)
p.fill(color)
p.draw(self)
p.t = lambda v: v
p.tx = lambda v: v
p.ty = lambda v: v |
python | def get_list(self, input_string):
"""
Return a list of user input
:param input_string:
:return:
"""
if input_string in ('--ensemble_list', '--fpf'):
# was the flag set?
try:
index_low = self.args.index(input_string) + 1
... |
java | public PropertySourcePropertyResolver addPropertySource(@Nullable PropertySource propertySource) {
if (propertySource != null) {
propertySources.put(propertySource.getName(), propertySource);
processPropertySource(propertySource, propertySource.getConvention());
}
return ... |
java | private synchronized void pushRequestContext(ServletContext context,
ServletRequest req,
ServletResponse resp)
{
getRequestStack().push(new RequestContext(context, req, resp));
} |
java | public static <K, V> ListMultimap<K, V> constrainedListMultimap(
ListMultimap<K, V> multimap, MapConstraint<? super K, ? super V> constraint) {
return new ConstrainedListMultimap<K, V>(multimap, constraint);
} |
python | def crc16(cmd, use_byte=False):
"""
CRC16 检验
- 启用``use_byte`` 则返回 bytes 类型.
:param cmd: 无crc检验的指令
:type cmd:
:param use_byte: 是否返回byte类型
:type use_byte:
:return: 返回crc值
:rtype:
"""
crc = 0xFFFF
# crc16 计算方法, 需要使用 byte
if hasattr(cmd, 'encode'):
cmd =... |
java | @Nonnull
public <V1 extends T1, V2 extends T2> LBiFunctionBuilder<T1, T2, R> aCase(Class<V1> argC1, Class<V2> argC2, LBiFunction<V1, V2, R> function) {
PartialCaseWithProduct.The pc = partialCaseFactoryMethod((a1, a2) -> (argC1 == null || argC1.isInstance(a1)) && (argC2 == null || argC2.isInstance(a2)));
pc.evalu... |
python | def VFSOpen(pathspec,
progress_callback = None
):
"""Expands pathspec to return an expanded Path.
A pathspec is a specification of how to access the file by recursively opening
each part of the path by different drivers. For example the following
pathspec:
pathtype: OS
path: "/dev/s... |
java | public void forward(final ExpectationForwardCallback expectationForwardCallback) {
expectation.thenForward(new HttpObjectCallback().withClientId(registerWebSocketClient(expectationForwardCallback)));
mockServerClient.sendExpectation(expectation);
} |
java | public void addInstance( String applicationName, String parentInstancePath, Instance instance ) throws ApplicationWsException {
this.logger.finer( "Adding an instance to the application " + applicationName + "..." );
WebResource path = this.resource.path( UrlConstants.APP ).path( applicationName ).path( "instances... |
java | public static File leftShift(File file, InputStream data) throws IOException {
append(file, data);
return file;
} |
python | def read_constraints_from_config(cp, transforms=None,
constraint_section='constraint'):
"""Loads parameter constraints from a configuration file.
Parameters
----------
cp : WorkflowConfigParser
An open config parser to read from.
transforms : list, optional
... |
java | public void registerMockResource(String location, String contents) {
try {
mockResources.put(location, new GrailsByteArrayResource(contents.getBytes("UTF-8"), location));
}
catch (UnsupportedEncodingException e) {
throw new RuntimeException(e);
}
} |
python | def should_series_dispatch(left, right, op):
"""
Identify cases where a DataFrame operation should dispatch to its
Series counterpart.
Parameters
----------
left : DataFrame
right : DataFrame
op : binary operator
Returns
-------
override : bool
"""
if left._is_mixed... |
python | def _save_documentation(version, base_url="https://spark.apache.org/docs"):
"""
Write the spark property documentation to a file
"""
target_dir = join(dirname(__file__), 'spylon', 'spark')
with open(join(target_dir, "spark_properties_{}.json".format(version)), 'w') as fp:
all_props = _fetch_... |
python | def get_term_by_name(self, name):
"""Get the GO term with the given GO term name.
If the given name is not associated with any GO term, the function will
search for it among synonyms.
Parameters
----------
name: str
The name of the GO term.
Returns
... |
java | @Override
public EClass getIfcElectricDistributionBoardType() {
if (ifcElectricDistributionBoardTypeEClass == null) {
ifcElectricDistributionBoardTypeEClass = (EClass) EPackage.Registry.INSTANCE
.getEPackage(Ifc4Package.eNS_URI).getEClassifiers().get(212);
}
return ifcElectricDistributionBoardTypeE... |
python | def no_empty_value(func):
"""Raises an exception if function argument is empty."""
@wraps(func)
def wrapper(value):
if not value:
raise Exception("Empty value not allowed")
return func(value)
return wrapper |
java | @Override
public void addEntry(String logType, LogEntry entry) {
if (!logTypesToInclude.contains(logType)) {
return;
}
if (!localLogs.containsKey(logType)) {
List<LogEntry> entries = new ArrayList<>();
entries.add(entry);
localLogs.put(logType, entries);
} else {
localLo... |
python | def _update_file(self, seek_to_end=True):
"""Open the file for tailing"""
try:
self.close()
self._file = self.open()
except IOError:
pass
else:
if not self._file:
return
self.active = True
try:
... |
java | protected int addConfirmPopupMessage (SmartTable contents, int row)
{
if (_confirmHTML) {
contents.setHTML(row, 0, _confirmMessage, 2, "Message");
} else {
contents.setText(row, 0, _confirmMessage, 2, "Message");
}
return row + 1;
} |
java | public String getRemoteUser()
{
if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
checkRequestObjectInUse();
}
String remoteUser = null;
Principal principal = getUserPrincipal();
if (principal == null) {
//remoteUser = null;
if (_reques... |
python | def check(predicate):
r"""A decorator that adds a check to the :class:`.Command` or its
subclasses. These checks could be accessed via :attr:`.Command.checks`.
These checks should be predicates that take in a single parameter taking
a :class:`.Context`. If the check returns a ``False``\-like value then... |
python | def get_quoted_local_columns(self, platform):
"""
Returns the quoted representation of the referencing table column names
the foreign key constraint is associated with.
But only if they were defined with one or the referencing table column name
is a keyword reserved by the platf... |
java | @Override
public GedObject find(final FinderObject owner, final String str) {
return owner.findInParent(str);
} |
java | public static File copy(String srcPath, String destPath, boolean isOverride) throws IORuntimeException {
return copy(file(srcPath), file(destPath), isOverride);
} |
java | public Class<?> resolveClass(final String classname) throws ClassNotFoundException {
LOGGER.trace("Try to resolve {} from {} resolvers", classname, resolvers.size());
for (IClassResolver resolver : resolvers) {
try {
Class<?> candidate = resolver.resolveClass(classname);
... |
java | public static KieScannerStatus mapScannerStatus(InternalKieScanner.Status status) {
switch (status) {
case STARTING:
return KieScannerStatus.CREATED;
case RUNNING:
return KieScannerStatus.STARTED;
case SCANNING:
case UPDATING:
... |
python | def equal(self, line1, line2):
'''
return true if exactly equal or if equal but modified,
otherwise return false
return type: BooleanPlus
'''
eqLine = line1 == line2
if eqLine:
return BooleanPlus(True, False)
else:
unchanged_count ... |
java | @Override
public R visitModule(ModuleElement e, P p) {
// Use implementation from interface default method
return ElementVisitor.super.visitModule(e, p);
} |
java | public void setResponseCharacterEncoding(String encoding)
{
ExternalContext ctx = _MyFacesExternalContextHelper.firstInstance.get();
if (ctx == null)
{
throw new UnsupportedOperationException();
}
ctx.setResponseCharacterEncoding(encoding);
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.