language stringclasses 2
values | func_code_string stringlengths 63 466k |
|---|---|
python | def get_single_instance(sql, class_type, *args, **kwargs):
"""Returns an instance of class_type populated with attributes from the DB record; throws an error if no
records are found
@param sql: Sql statement to execute
@param class_type: The type of class to instantiate and populate wit... |
python | def bootstrap_statistics(series, statistic, n_samples=1000,
confidence_interval=0.95, random_state=None):
"""
Default parameters taken from
R's Hmisc smean.cl.boot
"""
if random_state is None:
random_state = np.random
alpha = 1 - confidence_interval
size = (... |
python | def _collapse_postconditions(base_postconditions: List[Contract], postconditions: List[Contract]) -> List[Contract]:
"""
Collapse function postconditions with the postconditions collected from the base classes.
:param base_postconditions: postconditions collected from the base classes
:param postcondit... |
python | def no_operation(self, onerror = None):
"""Do nothing but send a request to the server."""
request.NoOperation(display = self.display,
onerror = onerror) |
java | private static OptionalEntity<StopwordsItem> getEntity(final CreateForm form) {
switch (form.crudMode) {
case CrudMode.CREATE:
final StopwordsItem entity = new StopwordsItem(0, StringUtil.EMPTY);
return OptionalEntity.of(entity);
case CrudMode.EDIT:
if (form i... |
python | def start(self):
"""
All the work going on here. To the Authority the right day and time
format and finding the correct path of the file. The Application
requires Mplayer to play the alarm sound. Please read which sounds
are supported in page:
http://web.njit.edu/all_topi... |
python | def access_token(self, code):
'''Exchange a temporary OAuth2 code for an access token.
Param: code -> temporary OAuth2 code from a Pushed callback
Returns access token as string
'''
parameters = {"code": code}
access_uri = "/".join([BASE_URL, API_VERSION, ACCESS_TOKEN])
... |
python | def list_formats(format_type, backend=None):
"""
Returns list of supported formats for a particular
backend.
"""
if backend is None:
backend = Store.current_backend
mode = Store.renderers[backend].mode if backend in Store.renderers else None
else:
split = backend.split(':... |
python | def _handle_init_list(self, node, scope, ctxt, stream):
"""Handle InitList nodes (e.g. when initializing a struct)
:node: TODO
:scope: TODO
:ctxt: TODO
:stream: TODO
:returns: TODO
"""
self._dlog("handling init list")
res = []
for _,init_... |
java | private Object doOp(Op op) throws TimeoutException {
try {
if (op.txn != null)
op.txn.add(op);
Object result = runOp(op);
if (result == PENDING)
return op.getResult(timeout, TimeUnit.MILLISECONDS);
else if (result == null && op.isCa... |
java | public void save (FileSystemDataset dataset, State state) {
state.setProp(SERIALIZE_COMPACTION_FILE_PATH_NAME, dataset.datasetURN());
} |
java | public static String render(List<Node> nodes) {
StringBuilder buf = new StringBuilder();
for (Node node : nodes) {
if (node instanceof Text) {
String text = ((Text) node).text;
boolean inquote = false;
for (int i = 0; i < text.length(); i++) {
char ch = text.charAt(i);
... |
java | public void authenticate() {
if (mAccount == null) {
// Create account also performs authentication.
createAccount();
} else {
mAccess = mAccount.authenticate();
if (mRegion != null) {
mAccess.setPreferredRegion(mRegion);
}
}
} |
java | private boolean shouldValidate(Partition partition) {
for (String pathToken : this.ignoreDataPathIdentifierList) {
if (partition.getDataLocation().toString().toLowerCase().contains(pathToken.toLowerCase())) {
log.info("Skipping partition " + partition.getCompleteName() + " containing invalid token " +... |
java | public void marshall(SamplingRule samplingRule, ProtocolMarshaller protocolMarshaller) {
if (samplingRule == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(samplingRule.getRuleName(), RULENAME_BINDIN... |
python | def format_doc_text(text):
"""
A very thin wrapper around textwrap.fill to consistently wrap documentation text
for display in a command line environment. The text is wrapped to 99 characters with an
indentation depth of 4 spaces. Each line is wrapped independently in order to preserve
manually adde... |
java | public CoinbaseBaseResponse resendCoinbaseRequest(String transactionId) throws IOException {
final CoinbaseBaseResponse response =
coinbase.resendRequest(
transactionId,
exchange.getExchangeSpecification().getApiKey(),
signatureCreator,
exchange.getNonceFacto... |
python | def _get_audit_defaults(option=None):
'''
Loads audit.csv defaults into a dict in __context__ called
'lgpo.audit_defaults'. The dictionary includes fieldnames and all
configurable policies as keys. The values are used to create/modify the
``audit.csv`` file. The first entry is `fieldnames` used to c... |
java | @Override
public void deserializeInstance(SerializationStreamReader streamReader, OWLDataPropertyDomainAxiomImpl instance) throws SerializationException {
deserialize(streamReader, instance);
} |
python | def choice(*es):
"""
Create a PEG function to match an ordered choice.
"""
msg = 'Expected one of: {}'.format(', '.join(map(repr, es)))
def match_choice(s, grm=None, pos=0):
errs = []
for e in es:
try:
return e(s, grm, pos)
except PegreError as... |
python | def _create_figure(kwargs: Mapping[str, Any]) -> dict:
"""Create basic dictionary object with figure properties."""
return {
"$schema": "https://vega.github.io/schema/vega/v3.json",
"width": kwargs.pop("width", DEFAULT_WIDTH),
"height": kwargs.pop("height", DEFAULT_HEIGHT),
"padd... |
java | public static String toFirstUpper(String name) {
if ( isEmpty( name )) {
return name;
}
return "" + name.toUpperCase( Locale.ROOT ).charAt(0) + name.substring(1);
} |
python | def vmnet_unix(args, vmnet_range_start, vmnet_range_end):
"""
Implementation on Linux and Mac OS X.
"""
if not os.path.exists(VMWARE_NETWORKING_FILE):
raise SystemExit("VMware Player, Workstation or Fusion is not installed")
if not os.access(VMWARE_NETWORKING_FILE, os.W_OK):
raise S... |
java | public static LongLongIndex.LongLongUIndex loadUniqueIndex(PAGE_TYPE type,
IOResourceProvider storage, int pageId, int keySize, int valSize) {
return LOAD_UNIQUE_INDEX_SIZED.load(type, storage, pageId, keySize, valSize);
} |
java | @JsonIgnore
public MetricFilter getFilter() {
final StringMatchingStrategy stringMatchingStrategy = getUseRegexFilters() ?
REGEX_STRING_MATCHING_STRATEGY : (getUseSubstringMatching() ? SUBSTRING_MATCHING_STRATEGY : DEFAULT_STRING_MATCHING_STRATEGY);
return (name, metric) -> {
... |
java | private Map<String, String> getAttributePropertiesFromDBSingle(final String attributeName) throws DevFailed {
xlogger.entry(attributeName);
final Map<String, String> result = new CaseInsensitiveMap<String>();
final Map<String, String[]> prop = DatabaseFactory.getDatabase().getAttributeProperties... |
java | protected boolean isEqualPrimitiveArray(Object value1, Object value2) {
if (value1 instanceof int[]) {
if (value2 instanceof int[]) {
int[] array1 = (int[]) value1;
int[] array2 = (int[]) value2;
if (array1.length != array2.length) {
return false;
}
for (int ... |
python | def name(self, name: str):
""" Name Setter
Set name with passed in variable.
@param name: New name string.
@type name: String
"""
self.pathName = os.path.join(self.path, name) |
java | @Override
public V put(K key, V value)
{
if (key == null) {
V item = _nullValue;
_nullValue = value;
return item;
}
// forced resizing if 1/2 full
if (_values.length <= 2 * _size) {
K []oldKeys = _keys;
V []oldValues = _values;
_keys = (K []) new Object[2 * ol... |
python | def _GetFileSystemCacheIdentifier(self, path_spec):
"""Determines the file system cache identifier for the path specification.
Args:
path_spec (PathSpec): path specification.
Returns:
str: identifier of the VFS object.
"""
string_parts = []
string_parts.append(getattr(path_spec.pa... |
java | public void saveFavorites() {
m_clipboard.saveFavorites();
if (m_listPanel.getWidgetCount() < 1) {
m_editButton.disable(Messages.get().key(Messages.GUI_TAB_FAVORITES_NO_ELEMENTS_0));
}
m_buttonEditingPanel.setVisible(false);
m_buttonUsePanel.setVisible(true);
} |
python | def load(filename):
""""Load yaml file with specific include loader."""
if os.path.isfile(filename):
with open(filename) as handle:
return yaml_load(handle, Loader=Loader) # nosec
raise RuntimeError("File %s doesn't exist!" % filename) |
python | def create(model_config, model, vec_env, algo, env_roller, parallel_envs, number_of_steps,
batch_size=256, experience_replay=1, stochastic_experience_replay=False, shuffle_transitions=True):
""" Vel factory function """
settings = OnPolicyIterationReinforcerSettings(
number_of_steps=number_of... |
python | def minimize(self, theta_init, max_iter=50, callback=None, disp=0, tau=(10., 2., 2.), tol=1e-3):
"""
Minimize a list of objectives using a proximal consensus algorithm
Parameters
----------
theta_init : ndarray
Initial parameter vector (numpy array)
max_iter... |
python | def mk_package(contents):
"""Instantiates a package specification from a parsed "AST" of a
package.
Parameters
----------
contents : dict
Returns
----------
PackageSpecification
"""
package = contents.get('package', None)
description = contents.get('description', None)
include = contents.get(... |
java | private boolean validateFuture(Object validationObject, Annotation annotate)
{
if (checkNullObject(validationObject))
{
return true;
}
int res = 0;
if (validationObject.getClass().isAssignableFrom(java.util.Date.class))
{
Date today = new Dat... |
python | def _does_not_contain_replica_sections(sysmeta_pyxb):
"""Assert that ``sysmeta_pyxb`` does not contain any replica information."""
if len(getattr(sysmeta_pyxb, 'replica', [])):
raise d1_common.types.exceptions.InvalidSystemMetadata(
0,
'A replica section was included. A new objec... |
python | def get_url(self, **kwargs):
"""
Return an url, relative to the request associated with this
table. Any keywords arguments provided added to the query
string, replacing existing values.
"""
return build(
self._request.path,
self._request.GET,
... |
python | def sync_accounts(self, accounts_data, clear = False, password=None, cb = None):
"""
Load all of the accounts from the account section of the config
into the database.
:param accounts_data:
:param password:
:return:
"""
# Map common values into the accou... |
python | def _SkipLengthDelimited(buffer, pos, end):
"""Skip a length-delimited value. Returns the new position."""
(size, pos) = _DecodeVarint(buffer, pos)
pos += size
if pos > end:
raise _DecodeError('Truncated message.')
return pos |
python | def delete_asset(self, asset_id):
"""Deletes an ``Asset``.
arg: asset_id (osid.id.Id): the ``Id`` of the ``Asset`` to
remove
raise: NotFound - ``asset_id`` not found
raise: NullArgument - ``asset_id`` is ``null``
raise: OperationFailed - unable to complete ... |
java | public static String encodeHash(LatLong p) {
return encodeHash(p.getLat(), p.getLon(), MAX_HASH_LENGTH);
} |
java | private static String commandRun(Command command) {
// Wait bind
if (I_COMMAND == null) {
synchronized (I_LOCK) {
if (I_COMMAND == null) {
try {
I_LOCK.wait();
} catch (InterruptedException e) {
... |
python | def create_action(parent, text, shortcut=None, icon=None, tip=None,
toggled=None, triggered=None, data=None, menurole=None,
context=Qt.WindowShortcut):
"""Create a QAction"""
action = SpyderAction(text, parent)
if triggered is not None:
action.triggered.conn... |
python | def getServiceEndpoints(self, yadis_url, service_element):
"""Returns an iterator of endpoint objects produced by the
filter functions."""
endpoints = []
# Do an expansion of the service element by xrd:Type and xrd:URI
for type_uris, uri, _ in expandService(service_element):
... |
python | def block_matrix(A, B, C, D):
r"""Generate the operator matrix with quadrants
.. math::
\begin{pmatrix} A B \\ C D \end{pmatrix}
Args:
A (Matrix): Matrix of shape ``(n, m)``
B (Matrix): Matrix of shape ``(n, k)``
C (Matrix): Matrix of shape ``(l, m)``
D (Matrix): Ma... |
python | def get_ceph_expected_pools(self, radosgw=False):
"""Return a list of expected ceph pools in a ceph + cinder + glance
test scenario, based on OpenStack release and whether ceph radosgw
is flagged as present or not."""
if self._get_openstack_release() == self.trusty_icehouse:
... |
python | def sudo(cls, line, *args, **kwds):
"""
duplicated
"""
sudo_user = Env.get(Env.JUMON_SUDO)
if sudo_user:
line = 'sudo -u {} {}'.format(sudo_user, line)
return cls.call(line, *args, **kwds) |
java | public static void copyInternalResources(AbstractWisdomMojo mojo, MavenResourcesFiltering filtering) throws
IOException {
File in = new File(mojo.basedir, Constants.MAIN_RESOURCES_DIR);
if (!in.exists()) {
return;
}
File out = new File(mojo.buildDirectory, "classe... |
java | private void processNeighbors(DoubleDBIDListIter neighbor, ModifiableDBIDs currentCluster, ArrayModifiableDBIDs seeds) {
final boolean ismetric = getDistanceFunction().isMetric();
for(; neighbor.valid(); neighbor.advance()) {
if(processedIDs.add(neighbor)) {
if(!ismetric || neighbor.doubleValue() ... |
java | @Override
public int compareTo(BinaryString other) {
if (javaObject != null && other.javaObject != null) {
return javaObject.compareTo(other.javaObject);
}
ensureMaterialized();
other.ensureMaterialized();
if (segments.length == 1 && other.segments.length == 1) {
int len = Math.min(sizeInBytes, othe... |
java | Map<SnapshotIdentifier, CdoSnapshot> calculate(List<CdoSnapshot> snapshots) {
Map<SnapshotIdentifier, CdoSnapshot> previousSnapshots = new HashMap<>();
populatePreviousSnapshotsWithSnapshots(previousSnapshots, snapshots);
List<CdoSnapshot> missingPreviousSnapshots = getMissingPreviousSnapshots(s... |
java | public void marshall(DescribeApplicationStateRequest describeApplicationStateRequest, ProtocolMarshaller protocolMarshaller) {
if (describeApplicationStateRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarsha... |
java | @Override
protected void checkDeviceConnection(DeviceProxy device,
String attribute, DeviceData deviceData, String event_name) throws DevFailed {
String deviceName = device.name();
if (!device_channel_map.containsKey(deviceName)) {
connect(device, attribute, eve... |
java | public Properties readProperties() throws IOException {
Properties p;
try (Reader src = newReader()) {
p = new Properties();
p.load(src);
}
return p;
} |
python | def capture_dash_in_url_name(self, node):
"""
Capture dash in URL name
"""
for keyword in node.keywords:
if keyword.arg == 'name' and '-' in keyword.value.s:
return DJ04(
lineno=node.lineno,
col=node.col_offset,
... |
python | def filetime_to_dt(ft):
"""Converts a Microsoft filetime number to a Python datetime. The new
datetime object is time zone-naive but is equivalent to tzinfo=utc.
>>> filetime_to_dt(116444736000000000)
datetime.datetime(1970, 1, 1, 0, 0)
>>> filetime_to_dt(128930364000000000)
datetime.datetime(... |
java | public static <T extends MethodDescription> ElementMatcher.Junction<T> hasParameters(
ElementMatcher<? super Iterable<? extends ParameterDescription>> matcher) {
return new MethodParametersMatcher<T>(matcher);
} |
python | def html_listify(tree, root_xl_element, extensions, list_type='ol'):
"""Convert a node tree into an xhtml nested list-of-lists.
This will create 'li' elements under the root_xl_element,
additional sublists of the type passed as list_type. The contents
of each li depends on the extensions dicto... |
java | void processDep(String name, ModuleDeps deps, ModuleDepInfo callerInfo, Set<String> recursionCheck, String dependee) {
final String methodName = "processDep"; //$NON-NLS-1$
final boolean traceLogging = log.isLoggable(Level.FINEST);
final boolean entryExitLogging = log.isLoggable(Level.FINER);
if (entryExitL... |
java | static long transform(
int relgregyear,
int dayOfYear
) {
if (relgregyear >= 1873) {
return PlainDate.of(relgregyear, dayOfYear).getDaysSinceEpochUTC();
} else {
return START_OF_YEAR[relgregyear - 701] + dayOfYear - 1;
}
} |
java | public int compareTo (@Nonnull final Version rhs)
{
ValueEnforcer.notNull (rhs, "Rhs");
// compare major version
int ret = m_nMajor - rhs.m_nMajor;
if (ret == 0)
{
// compare minor version
ret = m_nMinor - rhs.m_nMinor;
if (ret == 0)
{
// compare micro version
... |
python | def navigate(self):
"""Return the longitudes and latitudes of the scene.
"""
tic = datetime.now()
lons40km = self._data["pos"][:, :, 1] * 1e-4
lats40km = self._data["pos"][:, :, 0] * 1e-4
try:
from geotiepoints import SatelliteInterpolator
except Impo... |
java | public static int determineKerasMajorVersion(Map<String, Object> modelConfig, KerasModelConfiguration config)
throws InvalidKerasConfigurationException {
int kerasMajorVersion;
if (!modelConfig.containsKey(config.getFieldKerasVersion())) {
log.warn("Could not read keras version u... |
java | public void validate() throws ValidationException {
super.validate();
if (getDate() != null && !(getDate() instanceof DateTime)) {
throw new ValidationException(
"Property must have a DATE-TIME value");
}
final DateTime dateTime = (DateTime) getDate();
... |
python | def thanks(year=None):
"""
4rd Thursday in Nov
:param year: int
:return: Thanksgiving Day
"""
nov_first = datetime.date(_year, 11, 1) if not year else datetime.date(int(year), 11, 1)
weekday_seq = nov_first.weekday()
if weekday_seq > 3:
current_day = 32 - weekday_seq
else:
... |
java | void encodeProperty(ByteArrayOutputStream baos, Object value) throws JMSException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "encodeProperty", new Object[]{baos, value});
// The value should be a non-null String
if (value instanceof String) {
super.encode... |
java | public Observable<ServerInner> beginCreateOrUpdateAsync(String resourceGroupName, String serverName, ServerInner parameters) {
return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, parameters).map(new Func1<ServiceResponse<ServerInner>, ServerInner>() {
@Override
... |
python | def _convert_num(self, sign):
"""
Converts number registered in get_number_from_sign.
input = ["a2", "☉", "be3"]
output = ["a₂", "☉", "be₃"]
:param sign: string
:return sign: string
"""
# Check if there's a number at the end
new_sign, num = self.... |
python | def from_floats(red, green, blue):
"""Return a new Color object from red/green/blue values from 0.0 to 1.0."""
return Color(int(red * Color.MAX_VALUE),
int(green * Color.MAX_VALUE),
int(blue * Color.MAX_VALUE)) |
java | public EEnum getPFCPFCFlgs() {
if (pfcpfcFlgsEEnum == null) {
pfcpfcFlgsEEnum = (EEnum)EPackage.Registry.INSTANCE.getEPackage(AfplibPackage.eNS_URI).getEClassifiers().get(59);
}
return pfcpfcFlgsEEnum;
} |
java | @SuppressWarnings("unchecked")
@Override
public T decode(final byte[] buf) {
try (final ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(buf))) {
return (T) in.readObject();
} catch (final ClassNotFoundException | IOException ex) {
throw new RemoteRuntimeException(ex);
}... |
java | protected void displaySystem (String bundle, String message, byte attLevel, String localtype)
{
// nothing should be untranslated, so pass the default bundle if need be.
if (bundle == null) {
bundle = _bundle;
}
SystemMessage msg = new SystemMessage(message, bundle, attLe... |
java | public EClass getSamplingRatios() {
if (samplingRatiosEClass == null) {
samplingRatiosEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(AfplibPackage.eNS_URI).getEClassifiers().get(403);
}
return samplingRatiosEClass;
} |
python | def bind_texture(texture):
"""Draw a single texture"""
if not getattr(texture, 'image', None):
texture.image = load_image(texture.path)
glEnable(texture.image.target)
glBindTexture(texture.image.target, texture.image.id)
gl.glTexParameterf(texture.image.target,
gl.GL_... |
java | void triggerBasicEvent(Event.EventType type,
String message,
boolean flushBuffer)
{
Event triggeredEvent = new BasicEvent(type, message);
pushEvent(triggeredEvent, flushBuffer);
} |
python | def get_execution_engine(name):
"""Get the execution engine by name."""
manager = driver.DriverManager(
namespace='cosmic_ray.execution_engines',
name=name,
invoke_on_load=True,
on_load_failure_callback=_log_extension_loading_failure,
)
return manager.driver |
python | def get_proficiencies_for_resource_on_date(self, resource_id, from_, to):
"""Gets a ``ProficiencyList`` relating to the given resource effective during the entire given date range inclusive but not confined to the date range.
arg: resource_id (osid.id.Id): a resource ``Id``
arg: from (osi... |
python | def on_delete(self, forced):
"""Session expiration callback
`forced`
If session item explicitly deleted, forced will be set to True. If
item expired, will be set to False.
"""
# Do not remove connection if it was not forced and there's running connection
... |
python | def update_guest_additions(self, source, arguments, flags):
"""Automatically updates already installed Guest Additions in a VM.
At the moment only Windows guests are supported.
Because the VirtualBox Guest Additions drivers are not WHQL-certified
yet there might be warn... |
java | private Set findSimilarTokens(String s,int i)
{
Set likeTokI = new HashSet();
for (int j=Math.max(0,i-windowSize); j<Math.min(i+windowSize,numTokens); j++) {
if (i!=j) {
Token tokj = allTokens[j];
double d = jaroWinklerDistance.score( s, tokj.getValu... |
python | def wrap(self, LayoutClass, *args, **kwargs):
"""
Wraps every layout object pointed in `self.slice` under a `LayoutClass` instance with
`args` and `kwargs` passed.
"""
def wrap_object(layout_object, j):
layout_object.fields[j] = self.wrapped_object(
La... |
java | public static <E> RubyHash<E, E> Hash(
Collection<? extends Collection<? extends E>> cols) {
RubyHash<E, E> rubyHash = newRubyHash();
for (Collection<? extends E> col : cols) {
if (col.size() < 1 || col.size() > 2) throw new IllegalArgumentException(
"ArgumentError: invalid number of eleme... |
java | public static String escapeXml10Attribute(final String text, final XmlEscapeType type, final XmlEscapeLevel level) {
return escapeXml(text, XmlEscapeSymbols.XML10_ATTRIBUTE_SYMBOLS, type, level);
} |
java | public static String nameClass(String tableName)
{
StringBuffer sb = new StringBuffer();
char[] chars = new char[tableName.length()];
chars = tableName.toCharArray();
char c;
boolean nextup = false;
for (int i = 0; i < chars.length; i++) {
if (i==0) c = Character.toUpperCase(chars[i]);
e... |
java | public static void tputs(Writer out, String str, Object... params) throws IOException {
int index = 0;
int length = str.length();
int ifte = IFTE_NONE;
boolean exec = true;
Stack<Object> stack = new Stack<Object>();
while (index < length) {
char ch = str.charA... |
python | def _query_by_distro(self, table_name):
"""
Query for download data broken down by OS distribution, for one day.
:param table_name: table name to query against
:type table_name: str
:return: dict of download information by distro; keys are project name,
values are a di... |
java | @Override
public void execute(DelegateExecution execution) {
ActionDefinition actionDefinition = findRelatedActionDefinition(execution);
Connector connector = getConnector(getImplementation(execution));
IntegrationContext integrationContext = connector.apply(integrationContextBuilder.from(e... |
python | def get_plugin_from_string(plugin_name):
"""
Returns plugin or plugin point class from given ``plugin_name`` string.
Example of ``plugin_name``::
'my_app.MyPlugin'
"""
modulename, classname = plugin_name.rsplit('.', 1)
module = import_module(modulename)
return getattr(module, clas... |
java | private static SyntaxType register(String id, String name)
{
SyntaxType syntaxType = new SyntaxType(id, name);
KNOWN_SYNTAX_TYPES.put(id, syntaxType);
return syntaxType;
} |
java | public static Object callMethod(Object obj, Collection.Key methodName, Object[] args, Object defaultValue) {
if (obj == null) {
return defaultValue;
}
// checkAccesibility(obj,methodName);
MethodInstance mi = getMethodInstanceEL(obj, obj.getClass(), methodName, args);
if (mi == null) return defaultValue;
tr... |
java | public static ActionImport getAndCheckActionImport(EntityDataModel entityDataModel, String actionImportName) {
ActionImport actionImport = entityDataModel.getEntityContainer().getActionImport(actionImportName);
if (actionImport == null) {
throw new ODataSystemException("Action import not fou... |
java | protected FilePath findPullUpDirectory(FilePath root) throws IOException, InterruptedException {
// if the directory just contains one directory and that alone, assume that's the pull up subject
// otherwise leave it as is.
List<FilePath> children = root.list();
if(children.size()!=1) ... |
python | def cli_create(argument_list):
"""
command-line call to create a manifest from a JAR file or a
directory
"""
parser = argparse.ArgumentParser()
parser.add_argument("content", help="file or directory")
# TODO: shouldn't we always process directories recursively?
parser.add_argument("-r",... |
python | def get_group(self,callb=None):
"""Convenience method to request the group from the device
This method will check whether the value has already been retrieved from the device,
if so, it will simply return it. If no, it will request the information from the device
and request that callb ... |
java | public CDACallback<Transformed> one(String id, CDACallback<Transformed> callback) {
return Callbacks.subscribeAsync(
baseQuery()
.one(id)
.filter(new Predicate<CDAEntry>() {
@Override
public boolean test(CDAEntry entry) {
return entry.conte... |
java | public OvhOrder freefax_new_GET(OvhQuantityEnum quantity) throws IOException {
String qPath = "/order/freefax/new";
StringBuilder sb = path(qPath);
query(sb, "quantity", quantity);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhOrder.class);
} |
java | @Override
public CPOptionCategory remove(Serializable primaryKey)
throws NoSuchCPOptionCategoryException {
Session session = null;
try {
session = openSession();
CPOptionCategory cpOptionCategory = (CPOptionCategory)session.get(CPOptionCategoryImpl.class,
primaryKey);
if (cpOptionCategory == nul... |
python | def find_library_windows(cls):
"""Loads the SEGGER DLL from the windows installation directory.
On Windows, these are found either under:
- ``C:\\Program Files\\SEGGER\\JLink``
- ``C:\\Program Files (x86)\\SEGGER\\JLink``.
Args:
cls (Library): the ``Library`` clas... |
python | def create_connection(self):
"""See: https://github.com/python/cpython/blob/40ee9a3640d702bce127e9877c82a99ce817f0d1/Lib/socket.py#L691"""
err = None
try:
for res in socket.getaddrinfo(self._server, self._port, 0, self._sock_type):
af, socktype, proto, canonname, sa =... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.