language stringclasses 2
values | func_code_string stringlengths 63 466k |
|---|---|
python | def create_widgets(MAIN):
"""Create all the widgets and dockwidgets. It also creates actions to
toggle views of dockwidgets in dockwidgets.
"""
""" ------ CREATE WIDGETS ------ """
MAIN.labels = Labels(MAIN)
MAIN.channels = Channels(MAIN)
MAIN.notes = Notes(MAIN)
MAIN.merge_dialog = Mer... |
java | public static void fillAlignedAtomArrays(AFPChain afpChain, Atom[] ca1,
Atom[] ca2, Atom[] ca1aligned, Atom[] ca2aligned) {
int pos=0;
int[] blockLens = afpChain.getOptLen();
int[][][] optAln = afpChain.getOptAln();
assert(afpChain.getBlockNum() <= optAln.length);
for (int block=0; block < afpChain.getBl... |
python | def build_parser(self, context):
"""
Create the final argument parser.
This method creates the non-early (full) argparse argument parser.
Unlike the early counterpart it is expected to have knowledge of
the full command tree.
This method relies on ``context.cmd_tree`` a... |
java | public Map<String, String> getAvailableVariantMap(Map<String, VariantSet> variants,
Map<String, String> curVariants) {
Map<String, String> availableVariantMap = new HashMap<>();
for (Entry<String, VariantSet> entry : variants.entrySet()) {
String variantType = entry.getKey();
VariantSet variantSet = entry... |
python | def process_pgturl(self, params):
"""
Handle PGT request
:param dict params: A template context dict
:raises ValidateError: if pgtUrl is invalid or if TLS validation of the pgtUrl fails
:return: The rendering of ``cas_server/serviceValidate.xml``, using ``params`... |
python | def from_frame(klass, frame, connection):
"""
Create a new BuildStateChange event from a Stompest Frame.
"""
event = frame.headers['new']
data = json.loads(frame.body)
info = data['info']
build = Build.fromDict(info)
build.connection = connection
r... |
java | private String getActualComponentType(String componentType) {
if (componentType == null) {
throw new IllegalArgumentException("参数不能为null.");
}
int lastIndex = componentType.lastIndexOf(ARRAY_PREFIX);
if (lastIndex != -1) {
StringBuilder sb = new StringBuilder();... |
java | public Observable<CertificateDescriptionInner> createOrUpdateAsync(String resourceGroupName, String resourceName, String certificateName) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, resourceName, certificateName).map(new Func1<ServiceResponse<CertificateDescriptionInner>, CertificateDescr... |
python | def _create_bigquery_parser():
""" Create the parser for the %bigquery magics.
Note that because we use the func default handler dispatch mechanism of argparse,
our handlers can take only one argument which is the parsed args. So we must create closures
for the handlers that bind the cell contents and thus mus... |
python | def _readse(self, pos):
"""Return interpretation of next bits as a signed exponential-Golomb code.
Advances position to after the read code.
Raises ReadError if the end of the bitstring is encountered while
reading the code.
"""
codenum, pos = self._readue(pos)
... |
java | public final void clearExtraTag(final String name) {
if (extratags == null) {
throw new IllegalStateException("no extra tags added");
}
if (extratags.get(name) == null) {
throw new IllegalArgumentException("tag '" + name
+ "' not in" + extratags);
}
extratags.remove(name);
} |
python | def invoke_function(self, ctx, name, arguments):
"""
Invokes the given function
:param ctx: the evaluation context
:param name: the function name (case insensitive)
:param arguments: the arguments to be passed to the function
:return: the function return value
"""... |
java | public Map<String, String> getParameters() {
if (m_format != null) {
return m_format.getParameters();
}
return Collections.emptyMap();
} |
python | def verifyChainFromCAFile(self, cafile, untrusted_file=None):
"""
Does the same job as .verifyChain() but using the list of anchors
from the cafile. As for .verifyChain(), a list of untrusted
certificates can be passed (as a file, this time).
"""
try:
f = open... |
java | @Override
public void dumpRequest(Map<String, Object> result) {
Map<String, Cookie> cookiesMap = exchange.getRequestCookies();
dumpCookies(cookiesMap, "requestCookies");
this.putDumpInfoTo(result);
} |
python | def read(self, file_or_path):
"""Read template from cache or file."""
if file_or_path in self._cached_templates:
return self._cached_templates[file_or_path]
if is_filelike(file_or_path):
template = file_or_path.read()
dirname = None
else:
... |
python | def delete_table_rate_shipping_by_id(cls, table_rate_shipping_id, **kwargs):
"""Delete TableRateShipping
Delete an instance of TableRateShipping by its ID.
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async=True
>>> t... |
python | def _get_magnitude_term(self, C, mag):
"""
Returns the magnitude scaling term - equation 3
"""
if mag >= self.CONSTS["Mh"]:
return C["e1"] + C["b3"] * (mag - self.CONSTS["Mh"])
else:
return C["e1"] + (C["b1"] * (mag - self.CONSTS["Mh"])) +\
... |
java | private static Graph buildGraph() {
Graph g = new TinkerGraph();
//add vertices
Vertex v1 = g.addVertex("v1");
Vertex v2 = g.addVertex("v2");
Vertex v3 = g.addVertex("v3");
Vertex v4 = g.addVertex("v4");
Vertex v5 = g.addVertex("v5");
Vertex v6 = g.addVert... |
python | def copy_dataset_files(self, ds, incver=False, cb=None, **kwargs):
"""
Copy only files and configs into the database.
:param ds: The source dataset to copy
:param cb: A progress callback, taking two parameters: cb(message, num_records)
:return:
"""
from ambry.orm ... |
python | def temp_repo(url, branch, commit=''):
""" Clone a git repository inside a temporary folder, yield the folder then delete the folder.
:param string url: url of the repo to clone.
:param string branch: name of the branch to checkout to.
:param string commit: Optional commit rev to checkout to. If mentio... |
python | def handle_get(self):
"""Handle a single HTTP GET request.
Default implementation indicates an error because
XML-RPC uses the POST method.
"""
code = 400
message, explain = BaseHTTPRequestHandler.responses[code]
response = http_server.DEFAULT_ERROR_MESSAGE % \
... |
python | def symmetric_difference_update(self, that):
"""
Update the set, keeping only elements found in either *self* or *that*,
but not in both.
"""
_set = self._set
_list = self._list
_set.symmetric_difference_update(that)
_list.clear()
_list.update(_set... |
python | def add_ip_scope(name, description, auth, url, startip=None, endip=None, network_address=None):
"""
Function takes input of four strings Start Ip, endIp, name, and description to add new Ip Scope
to terminal access in the HPE IMC base platform
:param name: str Name of the owner of this IP scope ex. 'a... |
java | public LiveOutputInner get(String resourceGroupName, String accountName, String liveEventName, String liveOutputName) {
return getWithServiceResponseAsync(resourceGroupName, accountName, liveEventName, liveOutputName).toBlocking().single().body();
} |
java | protected static void jsiiStaticSet(final Class<?> nativeClass, final String property, @Nullable final Object value) {
String fqn = engine.loadModuleForClass(nativeClass);
engine.getClient().setStaticPropertyValue(fqn, property, JsiiObjectMapper.valueToTree(value));
} |
python | def _add_model(self, model_list_or_dict, core_element, model_class, model_key=None, load_meta_data=True):
"""Adds one model for a given core element.
The method will add a model for a given core object and checks if there is a corresponding model object in the
future expected model list. The me... |
java | public Assignments cluster(Matrix matrix) {
ClusterResult r = fullCluster(scaleMatrix(matrix), 0);
verbose("Created " + r.numClusters + " clusters");
Assignment[] assignments = new HardAssignment[r.assignments.length];
for (int i = 0; i < r.assignments.length; ++i)
assignmen... |
java | public String convertPrimitiveEnumToString(EDataType eDataType, Object instanceValue) {
return instanceValue == null ? null : instanceValue.toString();
} |
java | public void addConfigurationListener(NodeConfigListener listener) {
StanzaListener conListener = new NodeConfigTranslator(listener);
configEventToListenerMap.put(listener, conListener);
pubSubManager.getConnection().addSyncStanzaListener(conListener, new EventContentFilter(EventElementType.confi... |
java | public static boolean isConstantOrConstantLiteral(Expression expression) {
return expression instanceof ConstantExpression ||
isPredefinedConstant(expression) ||
isMapLiteralWithOnlyConstantValues(expression) ||
isListLiteralWithOnlyConstantValues(expression);
} |
python | def set_plot_CC_T_rho(self,linestyle=[],burn_limit=0.997,color=['r'],marker=['o'],nolabelZ=False,markevery=500):
'''
Plots HRDs
end_model - array, control how far in models a run is plottet, if -1 till end
symbs_1 - set symbols of runs
'''
if len(linestyle)==0:
linestyle=200*['-']
plt.figure('CC e... |
python | def count(self):
"""
Returns the total number of objects, across all pages.
"""
try:
return self.object_list.count()
except (AttributeError, TypeError):
# AttributeError if object_list has no count() method.
# TypeError if object_list.count() ... |
python | def segment(text: str, custom_dict: Trie = None) -> List[str]:
"""ตัดคำภาษาไทยด้วยวิธี longest matching"""
if not text or not isinstance(text, str):
return []
if not custom_dict:
custom_dict = DEFAULT_DICT_TRIE
return LongestMatchTokenizer(custom_dict).tokenize(text) |
java | public List<String> findWorkersWorkingOnPlan(Plan plan) throws WorkerDaoException{
try {
Stat exists = framework.getCuratorFramework().checkExists().forPath(PLAN_WORKERS_ZK + "/" + plan.getName());
if (exists == null ){
return new ArrayList<String>();
}
return framework.getCuratorFra... |
python | def _handle_sighup(myrpcserver, signum, unused):
"""Closes (terminates) all of its clients. Though keeps server running."""
print("SIGHUP: stopping all clients",sys.stderr)
if myrpcserver._closed:
return
for c in set(myrpcserver.clients):
try:
c.shutdown(socket.SHUT_RDWR)
... |
python | def emit(self, span_datas):
"""
:type span_datas: list of :class:
`~opencensus.trace.span_data.SpanData`
:param list of opencensus.trace.span_data.SpanData span_datas:
SpanData tuples to emit
"""
project = 'projects/{}'.format(self.project_id)
# M... |
java | public int indexOf(char... candidates){
int i = index;
while(i<string.length()){
char ch = string.charAt(i);
if(ch=='"')
i = matchingQuote(i);
else{
for(char candidate: candidates){
if(ch==candidate)
... |
python | def bresenham_circle_octant(radius):
"""
Uses Bresenham's algorithm to draw a single octant of a circle with thickness 1,
centered on the origin and with the given radius.
:param radius: The radius of the circle to draw
:return: A list of integer coordinates representing pixels.
Starts at (radiu... |
java | public boolean revisionContainsTemplateFragmentWithoutIndex(int revId, String templateFragment) throws WikiApiException{
if(revApi==null){
revApi = new RevisionApi(wiki.getDatabaseConfiguration());
}
if(parser==null){
//TODO switch to SWEBLE
MediaWikiParserFactory pf = new MediaWikiPars... |
python | def add_mismatch(self, entity, *traits):
"""
Add a mismatching entity to the index.
We do this by simply adding the mismatch to the index.
:param collections.Hashable entity: an object to be mismatching the values of `traits_indexed_by`
:param list traits: a list of hashable tr... |
java | public String generateCertificateSigningRequest(boolean useIpAddressAsCommonName) throws HostConfigFault, RuntimeFault, RemoteException {
return getVimService().generateCertificateSigningRequest(getMOR(), useIpAddressAsCommonName);
} |
python | def ensure_databases_alive(max_retries: int = 100,
retry_timeout: int = 5,
exit_on_failure: bool = True) -> bool:
"""
Checks every database alias in ``settings.DATABASES`` until it becomes available. After ``max_retries``
attempts to reach any backend ar... |
python | def simulate_experiment(self, modelparams, expparams, repeat=1):
"""
Simulates experimental data according to the original (unpoisoned)
model. Note that this explicitly causes the simulated data and the
likelihood function to disagree. This is, strictly speaking, a violation
of t... |
java | static int oversize(int minTargetSize, int bytesPerElement) {
if (minTargetSize < 0) {
// catch usage that accidentally overflows int
throw new IllegalArgumentException("invalid array size " + minTargetSize);
}
if (minTargetSize == 0) {
// wait until at least one element is reque... |
python | def requires_auth(f):
"""A decorator for flask api methods that validates auth0 tokens, hence ensuring
that the user is authenticated. Code coped from:
https://github.com/auth0/auth0-python/tree/master/examples/flask-api
"""
@wraps(f)
def requires_auth_decorator(*args, **kwargs):
try:
... |
java | public static Nengo ofRelatedGregorianYear(
int year,
Selector selector
) {
Nengo nengo = null;
if (year >= 701) {
switch (selector) {
case OFFICIAL:
if (year >= 1873) {
return Nengo.ofRelatedGregorianYear(year... |
python | def save(self, commit=True):
'''
If a staff member is reporting substitute teaching for a second time, then we should update
the list of occurrences for which they are a substitute on their existing EventStaffMember
record, rather than creating a new record and creating database issues.
... |
java | public void setFragment(String p_fragment) throws MalformedURIException
{
if (p_fragment == null)
{
m_fragment = null;
}
else if (!isGenericURI())
{
throw new MalformedURIException(
Utils.messages.createMessage(MsgKey.ER_FRAG_FOR_GENERIC_URI, null)); //"Fragment can only be se... |
java | public <T> T getBean(Class<T> beanType) throws BeansException {
return beanType.cast(BeanFactoryUtils.beanOfTypeIncludingAncestors(this, beanType));
} |
java | public EEnum getLocalDateAndTimeStampStampType() {
if (localDateAndTimeStampStampTypeEEnum == null) {
localDateAndTimeStampStampTypeEEnum = (EEnum)EPackage.Registry.INSTANCE.getEPackage(AfplibPackage.eNS_URI).getEClassifiers().get(90);
}
return localDateAndTimeStampStampTypeEEnum;
} |
java | public String getRemoteClassName()
{
String strClassName = this.getClass().getName().toString();
int iThinPos = strClassName.indexOf(Constants.THIN_SUBPACKAGE);
return strClassName.substring(0, iThinPos) + strClassName.substring(iThinPos + Constants.THIN_SUBPACKAGE.length());
} |
java | static void dumpConfiguration(Writer writer) throws IOException {
Configuration conf = new Configuration(false);
conf.addResource(QUEUE_ACLS_FILE_NAME);
Configuration.dumpConfiguration(conf, writer);
} |
java | private boolean tryOpenAsync() {
Connection<CL> connection = null;
// Try to open a new connection, as long as we haven't reached the max
if (activeCount.get() < config.getMaxConnsPerHost()) {
try {
if (activeCount.incrementAndGet() <= config.getMaxConnsPerHost()) {
... |
java | private static boolean polylineTouchesPolyline_(Polyline polyline_a,
Polyline polyline_b, double tolerance,
ProgressTracker progress_tracker) {
// Quick rasterize test to see whether the the geometries are disjoint.
if (tryRasterizedContainsOrDisjoint_(polyline_a, polyline_b, tolerance,
false) == Relation... |
python | def pm(self):
"""Get QPixmap from wrapper"""
if self._pm is None:
self._pm = QPixmap(self._xpmstr)
return self._pm |
java | private static ChunkOutput writeOutput(Compiler compiler, Flags flags) {
ArrayList<File> outputFiles = new ArrayList<>();
ChunkOutput output = new ChunkOutput();
File file = new File();
file.path = flags.jsOutputFile;
String code = compiler.toSource();
String prefix = "";
String postfix = ... |
java | static boolean checkForPossibleIndexChange(
int v1,
int v2,
Throwable exc,
String msg)
{
... |
java | public static void show(FragmentManager fragmentManager, Class<? extends MvcDialog> dialogClass) {
FragmentTransaction ft = fragmentManager.beginTransaction();
MvcDialog dialogFragment = (MvcDialog) fragmentManager.findFragmentByTag(dialogClass.getName());
if (dialogFragment == null) {
... |
python | def _Aff4Size(aff4_obj):
"""Retrieves the total size in bytes of an AFF4 object.
Args:
aff4_obj: An AFF4 stream instance to retrieve size for.
Returns:
An integer representing number of bytes.
Raises:
TypeError: If `aff4_obj` is not an instance of AFF4 stream.
"""
if not isinstance(aff4_obj, ... |
python | def scale(self, scale, center=None):
"""
Scale the matrix about a given origin.
The scaling is applied *after* the transformations already present
in the matrix.
Parameters
----------
scale : array-like
Scale factors along x, y and z axes.
ce... |
java | private void addRemoveToolTipTextUpdaterOnSelectionStateChangeAsNeeded() {
if (selectedToolTipText == null && disabledSelectedToolTipText == null) {
if (toolTipTextUpdaterOnSelectionStateChange != null) {
removeItemListener(toolTipTextUpdaterOnSelectionStateChange);
t... |
python | def execute(self, lf_raw: str) -> int:
"""
Very basic model for executing friction logical forms. For now returns answer index (or
-1 if no answer can be concluded)
"""
# Remove "a:" prefixes from attributes (hack)
logical_form = re.sub(r"\(a:", r"(", lf_raw)
pars... |
java | public ByteBuffer payload() {
ByteBuffer payload = buffer.duplicate();
payload.position(headerSize(magic()));
payload = payload.slice();
payload.limit(payloadSize());
payload.rewind();
return payload;
} |
python | def startfile(fpath, detatch=True, quote=False, verbose=False, quiet=True):
""" Uses default program defined by the system to open a file.
References:
http://stackoverflow.com/questions/2692873/quote-posix-shell-special-characters-in-python-output
"""
print('[cplat] startfile(%r)' % fpath)
... |
java | private Map<String, ChatConversationBase> makeMapFromSavedConversations(List<ChatConversationBase> list) {
Map<String, ChatConversationBase> map = new HashMap<>();
if (list != null && !list.isEmpty()) {
for (ChatConversationBase details : list) {
map.put(details.getConversa... |
python | def options(self):
"""
Obtains the currently set options as list.
:return: the list of options
:rtype: list
"""
if self.is_optionhandler:
return typeconv.string_array_to_list(javabridge.call(self.jobject, "getOptions", "()[Ljava/lang/String;"))
else:
... |
python | def transform(self, X, y=None, sample_weight=None):
'''
Transforms the time series data into fixed length segments using padding and or truncation
If y is a time series and passed, it will be transformed as well
Parameters
----------
X : array-like, shape [n_series, ...]... |
python | def make_html_tag(tag, text=None, **params):
"""Create an HTML tag string.
tag
The HTML tag to use (e.g. 'a', 'span' or 'div')
text
The text to enclose between opening and closing tag. If no text is specified then only
the opening tag is returned.
Example::
make_html_t... |
java | @FFDCIgnore(IllegalStateException.class)
public synchronized void removeShutdownHook() {
if (shutdownInvoked)
return;
try {
if (hookSet.compareAndSet(true, false)) {
Runtime.getRuntime().removeShutdownHook(this);
}
} catch (IllegalStateExc... |
java | public int estimateSize(Codec codec) {
int size = key.length + 1; //key + control
if (!ControlByte.NON_EXISTING.hasFlag(control) && !ControlByte.NOT_READ.hasFlag(control)) {
size += 8; //long
}
if (!ControlByte.REMOVE_OP.hasFlag(control)) {
size += value.length;
size +... |
python | def get_vnetwork_dvpgs_input_last_rcvd_instance(self, **kwargs):
"""Auto Generated Code
"""
config = ET.Element("config")
get_vnetwork_dvpgs = ET.Element("get_vnetwork_dvpgs")
config = get_vnetwork_dvpgs
input = ET.SubElement(get_vnetwork_dvpgs, "input")
last_rcvd... |
python | def buildpack(self, url):
"""Add a buildpack by URL."""
cmd = ["heroku", "buildpacks:add", url, "--app", self.name]
self._run(cmd) |
java | public void search(CmsSimpleSearchConfigurationParser configParser, CmsResource resource) {
m_currentResource = resource;
m_currentConfigParser = configParser;
resetContentLocale(configParser.getSearchLocale());
m_resetting = true;
m_resultSorter.setValue(m_currentConfig.getPara... |
python | def status(self, additional=[]):
""" Returns status information for device.
This returns only a subset of possible properties.
"""
self.manager.refresh_client()
fields = ['batteryLevel', 'deviceDisplayName', 'deviceStatus', 'name']
fields += additional
properties... |
python | def get_authversion(job_args):
"""Get or infer the auth version.
Based on the information found in the *AUTH_VERSION_MAP* the authentication
version will be set to a correct value as determined by the
**os_auth_version** parameter as found in the `job_args`.
:param job_args: ``dict``
:returns:... |
java | @Override
public void render(Graphic g)
{
if (model.isSelecting())
{
final Area selectionArea = model.getSelectionArea();
final int x = (int) viewer.getViewpointX(selectionArea.getX());
final int w = selectionArea.getWidth();
int y = (int) viewer.g... |
python | def register(event=None):
"""
Decorator method to *register* event handlers. This is the client-less
`add_event_handler
<telethon.client.updates.UpdateMethods.add_event_handler>` variant.
Note that this method only registers callbacks as handlers,
and does not attach them to any client. This is... |
python | def build_visualization(ontouri, g, viz_index, path=None, title="", theme=""):
"""
2017-01-20: new verion, less clever but also simpler
:param g:
:param viz_index:
:param main_entity:
:return:
"""
this_viz = VISUALIZATIONS_LIST[viz_index]
if this_viz['ID'] == "html-simple":
... |
java | public List<Column> addColumns(long sheetId, List<Column> columns) throws SmartsheetException {
return this.postAndReceiveList("sheets/" + sheetId + "/columns", columns, Column.class);
} |
python | def _create_cell(args, cell_body):
"""Implements the pipeline cell create magic used to create Pipeline objects.
The supported syntax is:
%%pipeline create <args>
[<inline YAML>]
Args:
args: the arguments following '%%pipeline create'.
cell_body: the contents of the cell
"""
name = args.ge... |
java | @Override
public boolean add(RedisClusterNode redisClusterNode) {
synchronized (partitions) {
LettuceAssert.notNull(redisClusterNode, "RedisClusterNode must not be null");
boolean add = getPartitions().add(redisClusterNode);
updateCache();
return add;
... |
python | def ssn(self, min_age=18, max_age=90):
"""
Returns a 10 digit Swedish SSN, "Personnummer".
It consists of 10 digits in the form YYMMDD-SSGQ, where
YYMMDD is the date of birth, SSS is a serial number
and Q is a control character (Luhn checksum).
http://en.wikipedia.org/w... |
python | def report_many(self, event_list, metadata=None, block=None):
"""
Reports all the given events to Alooma by formatting them properly and
placing them in the buffer to be sent by the Sender instance
:param event_list: A list of dicts / strings representing events
:param metadata: ... |
python | def copy_image_from_url(url, cache_dir=None, use_cache=True):
""" Copy image from given URL and return upload metadata.
"""
return cache_image_data(cache_dir, hashlib.sha1(url).hexdigest(), ImgurUploader().upload, url, use_cache=use_cache) |
java | public static void bufferDepthToU16( ByteBuffer input , GrayU16 output ) {
int indexIn = 0;
for( int y = 0; y < output.height; y++ ) {
int indexOut = output.startIndex + y*output.stride;
for( int x = 0; x < output.width; x++ , indexOut++ ) {
output.data[indexOut] = (short)((input.get(indexIn++) & 0xFF) | ... |
java | @Override
public Algorithm readAlgorithm(String id) throws AlgorithmSourceReadException {
Algorithm result = null;
if (id != null) {
if (algorithms != null) {
result = algorithms.getAlgorithm(id);
}
if (result == null) {
initializeI... |
java | private void defineJavadocHeaderForContentOperation(MethodSpec.Builder builder, String value) {
builder.addJavadoc("\n<h2>Supported $L operations</h2>\n", value);
builder.addJavadoc("<table>\n");
builder.addJavadoc("<tr><th>URI</th><th>DAO.METHOD</th></tr>\n");
classBuilder.addJavadoc("<h2>Supported $L operati... |
java | protected final PrcBankStatementLineSave<RS> lazyGetPrcBankStatementLineSave(
final Map<String, Object> pAddParam) throws Exception {
@SuppressWarnings("unchecked")
PrcBankStatementLineSave<RS> proc = (PrcBankStatementLineSave<RS>)
this.processorsMap.get(PrcBankStatementLineSave.class.getSimpleName())... |
python | def Run(self, args):
"""Lists a directory."""
try:
directory = vfs.VFSOpen(args.pathspec, progress_callback=self.Progress)
except (IOError, OSError) as e:
self.SetStatus(rdf_flows.GrrStatus.ReturnedStatus.IOERROR, e)
return
files = list(directory.ListFiles())
files.sort(key=lambda... |
java | public void writeExternal(PofWriter writer)
throws IOException {
writer.writeString(0, name);
writer.writeLong(1, last);
} |
python | def missingDataValue(self):
""" Returns the value to indicate missing data. None if no missing-data value is specified.
"""
value = variableMissingValue(self._ncVar)
fieldNames = self._ncVar.dtype.names
# If the missing value attibute is a list with the same length as the number... |
python | def add_project(self, task, params={}, **options):
"""Adds the task to the specified project, in the optional location
specified. If no location arguments are given, the task will be added to
the end of the project.
`addProject` can also be used to reorder a task within a proje... |
python | def on_cache_changed(self, direct, which=None):
"""
A callback funtion, which sets local flags when the elements of some cached inputs change
this function gets 'hooked up' to the inputs when we cache them, and upon their elements being changed we update here.
"""
for what in [d... |
java | public static EnvironmentType toEnvironmentType(Vector<Object> xmlRpcParameters)
{
EnvironmentType type = null;
if(!xmlRpcParameters.isEmpty())
type = EnvironmentType.newInstance((String)xmlRpcParameters.get(ENVTYPE_NAME_IDX));
return type;
} |
java | public void setSecondaryButtonTextHoverColor(String color) throws HelloSignException {
if (white_labeling_options == null) {
white_labeling_options = new WhiteLabelingOptions();
}
white_labeling_options.setSecondaryButtonTextHoverColor(color);
} |
java | public void marshall(Address address, ProtocolMarshaller protocolMarshaller) {
if (address == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(address.getAddressId(), ADDRESSID_BINDING);
pr... |
python | def update(self, retry=2) -> None:
"""Synchronize state with switch."""
try:
_LOGGER.debug("Updating device state.")
key = ON_KEY if not self._flip_on_off else OFF_KEY
self.state = self._device.readCharacteristic(HANDLE) == key
except (bluepy.btle.BTLEExceptio... |
java | private List<String> copyDependencies(File javaDirectory) throws MojoExecutionException {
ArtifactRepositoryLayout layout = new DefaultRepositoryLayout();
List<String> list = new ArrayList<String>();
// First, copy the project's own artifact
File artifactFile = project.getArtifact().ge... |
java | public LocalDateTime adjustTime(LocalDateTime time, boolean roundUp,
DayOfWeek firstDayOfWeek) {
requireNonNull(time);
if (roundUp) {
time = time.plus(getAmount(), getUnit());
}
return Util.truncate(time, getUnit(), getAmount(), firstDayO... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.