language stringclasses 2
values | func_code_string stringlengths 63 466k |
|---|---|
java | public static void addPropertiesToSpec(ModuleSpec.Builder moduleSpecBuilder, Map<String, String> properties) {
for (Entry<String, String> entry : properties.entrySet()) {
moduleSpecBuilder.addProperty(entry.getKey(), entry.getValue());
}
} |
python | def feature_info(self):
"""
Returns information about the features available for the CPC of this
partition.
Authorization requirements:
* Object-access permission to this partition.
Returns:
:term:`iterable`:
An iterable where each item represent... |
java | public static PomEquippedResolveStage configureResolverViaPlugin(final ClassLoader cl)
throws InvalidEnvironmentException, IllegalArgumentException {
final ConfigurableMavenResolverSystem resolverSystem = Resolvers.use(ConfigurableMavenResolverSystem.class, cl);
return resolverSystem.configureVi... |
java | public void setDoi(String v) {
if (Header_Type.featOkTst && ((Header_Type)jcasType).casFeat_doi == null)
jcasType.jcas.throwFeatMissing("doi", "de.julielab.jules.types.Header");
jcasType.ll_cas.ll_setStringValue(addr, ((Header_Type)jcasType).casFeatCode_doi, v);} |
python | def get_map(self):
"""
Collects all the points coordinates from this ``pyny.Space``
instance.
In order to keep the reference, it returns an index with the
following key:
* The first column is the Place.
* The second column is the... |
java | public void marshall(DescribeJobsRequest describeJobsRequest, ProtocolMarshaller protocolMarshaller) {
if (describeJobsRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(describeJobsRequest.ge... |
python | def break_down_cookie(cookie):
""" Breaks down vSphere SOAP cookie
:param cookie: vSphere SOAP cookie
:type cookie: str
:return: Dictionary with cookie_name: cookie_value
"""
cookie_a = cookie.split(';')
cookie_name = cookie_a[0].split('=')[0]
cookie_text = ' {0}; ${1}'.format(cookie_a[0... |
java | public static final void rotate(Atom atom, Matrix m){
double x = atom.getX();
double y = atom.getY();
double z = atom.getZ();
double[][] ad = new double[][]{{x,y,z}};
Matrix am = new Matrix(ad);
Matrix na = am.times(m);
atom.setX(na.get(0,0));
atom.setY(na.get(0,1));
atom.setZ(na.get(0,2));
} |
python | def check_fam_for_samples(required_samples, source, gold):
"""Check fam files for required_samples."""
# Checking the source panel
source_samples = set()
with open(source, 'r') as input_file:
for line in input_file:
sample = tuple(line.rstrip("\r\n").split(" ")[:2])
if sa... |
java | public static FloatMatrix pinv(FloatMatrix A) {
return solveLeastSquares(A, FloatMatrix.eye(A.rows));
} |
python | def info(self, request):
"""Return height of the latest committed block."""
self.abort_if_abci_chain_is_not_synced()
# Check if BigchainDB supports the Tendermint version
if not (hasattr(request, 'version') and tendermint_version_is_compatible(request.version)):
logger.erro... |
python | def uninstall_all_passbands(local=True):
"""
Uninstall all passbands, either globally or locally (need to call twice to
delete ALL passbands)
If local=False, you must have permission to access the installation directory
"""
pbdir = _pbdir_local if local else _pbdir_global
for f in os.listdi... |
java | public static <T> Future<T> anyOf(Future<T>... fts) {
CompletableFuture<T>[] array = new CompletableFuture[fts.length];
for(int i=0;i<fts.length;i++){
array[i] = fts[i].getFuture();
}
return (Future<T>) Future.of(CompletableFuture.anyOf(array));
} |
java | public FieldDoc wrap(FieldDoc source) {
if (source == null || source instanceof Proxy<?> || !(source instanceof FieldDocImpl)) {
return source;
}
return new FieldDocWrapper((FieldDocImpl) source);
} |
java | @Nullable
public static Long parseLongObj (@Nullable final String sStr, @Nullable final Long aDefault)
{
return parseLongObj (sStr, DEFAULT_RADIX, aDefault);
} |
java | public void build( OptionBuilder option, String... options )
{
for (String opt : options)
{
Matcher matcher = Pattern.compile( "(--[^\\s]*)(\\s(.+))?" ).matcher( opt );
if (matcher.matches())
{
option.withLongForm( matcher.group( 1 ) );
... |
python | def _read_items(self):
self._items = []
self._items = glob.glob(path.join(self._config_path, '*.csv'))
if len(self._items) == 0:
return 0, -1
else:
self._items.sort()
for i, an_item in enumerate(self._items):
self._items[i] = an_item.replace(se... |
java | @Override
public CreateBackupVaultResult createBackupVault(CreateBackupVaultRequest request) {
request = beforeClientExecution(request);
return executeCreateBackupVault(request);
} |
python | def scaled_imu3_encode(self, time_boot_ms, xacc, yacc, zacc, xgyro, ygyro, zgyro, xmag, ymag, zmag):
'''
The RAW IMU readings for 3rd 9DOF sensor setup. This message should
contain the scaled values to the described units
time_boot_ms : Times... |
java | public static synchronized void sse(String url, BiConsumer<ServerSentEventConnection, String> connectionCallback) {
checkStarted();
instance().endpoints.add(HandlerUtil.sse(url, connectionCallback));
} |
java | public static ImmutableList<ImmutableMap<String, String>> applyAllSuggestedFixChoicesToCode(
Iterable<SuggestedFix> fixChoices, Map<String, String> fileNameToCodeMap) {
if (Iterables.isEmpty(fixChoices)) {
return ImmutableList.of(ImmutableMap.of());
}
int alternativeCount = Iterables.getFirst(fi... |
python | def _add_segmetrics_to_output(out, data):
"""Add metrics for measuring reliability of CNV estimates.
"""
out_file = "%s-segmetrics.txt" % os.path.splitext(out["cns"])[0]
if not utils.file_exists(out_file):
with file_transaction(data, out_file) as tx_out_file:
cmd = [os.path.join(os.p... |
java | public static Last[][] setScoreVector(int x, Subproblem subproblem, int gop, int gep, int[] subs, boolean storing,
int[][][] scores) {
return setScoreVector(x, subproblem.getQueryStartIndex(), subproblem.getTargetStartIndex(), subproblem.getTargetEndIndex(), gop, gep, subs, storing, scores, subproblem.isStartAncho... |
java | @Override
public void visitCode(Code obj) {
try {
stack.resetForMethodEntry(this);
reportedType = ImmutabilityType.UNKNOWN;
super.visitCode(obj);
} catch (StopOpcodeParsingException e) {
// report type is immutable
}
} |
python | def configure_server():
'''
Configure the transfer environment and store
'''
home = os.path.expanduser('~')
if os.path.isfile(os.path.join(home, '.transfer', 'config.yaml')):
with open(os.path.join(home, '.transfer', 'config.yaml'), 'r') as fp:
config = yaml.load(fp.read())
... |
python | def get_start_date(module, x):
""" 曜日による最初の授業の日を返す """
weekdays = ['月', '火', '水', '木', '金', '土', '日']
a, b = parse_module(module)
module = a + b[0]
d = datetime.datetime(*start_dates[module])
days = weekdays.index(x) - d.weekday()
if days < 0:
days += 7
delta = datetime.timedelt... |
python | def verify(self, secret_key):
"""
Verifies the authenticity of a notification message.
TODO: This is doing a form of authentication and
this functionality should really be merged
with the pluggable authentication mechanism
at some point.
"""
... |
java | @Action(invokeOn = InvokeOn.OBJECT_AND_COLLECTION)
@ActionLayout(
describedAs = "Toggle, for testing (direct) bulk actions"
)
public void toggleForBulkActions() {
boolean flag = getFlag() != null? getFlag(): false;
setFlag(!flag);
} |
python | def convex_hull(obj, qhull_options='QbB Pp QJn'):
"""
Get a new Trimesh object representing the convex hull of the
current mesh, with proper normals and watertight.
Requires scipy >.12.
Arguments
--------
obj : Trimesh, or (n,3) float
Mesh or cartesian points
Returns
--------... |
python | def instance_attr(self, name, context=None):
"""Get the list of nodes associated to the given attribute name.
Assignments are looked for in both this class and in parents.
:returns: The list of assignments to the given name.
:rtype: list(NodeNG)
:raises AttributeInferenceError... |
python | def copy(self, request, **kwargs):
# pylint: disable=unused-argument
'''
Copy instance with deps.
'''
instance = self.copy_instance(self.get_object())
serializer = self.get_serializer(instance, data=request.data, partial=True)
serializer.is_valid()
seriali... |
java | public long getChildItemId(View child) {
if (mAdapter == null || !mAdapter.hasStableIds()) {
return NO_ID;
}
final ViewHolder holder = getChildViewHolderInt(child);
return holder != null ? holder.getItemId() : NO_ID;
} |
python | def cross_product(self, p1, p2):
"""Returns the cross product of two XYPoints."""
return (p1.x * p2.y - p1.y * p2.x) |
python | def get_stp_mst_detail_output_msti_msti_root_id(self, **kwargs):
"""Auto Generated Code
"""
config = ET.Element("config")
get_stp_mst_detail = ET.Element("get_stp_mst_detail")
config = get_stp_mst_detail
output = ET.SubElement(get_stp_mst_detail, "output")
msti = ... |
python | def thermal_data(data, figsize=(12, 4), ms_data=50,
v_label='Unit-cell volume $(\mathrm{\AA}^3)$',
pdf_filen=None, title='P-V-T data'):
"""
plot P-V-T data before fitting
:param data: {'p': unumpy array, 'v': unumpy array, 'temp': unumpy array}
:param eoscurves: {'v': ... |
java | public static File getExecutableLocation(final String exeName) {
//
// must add current working directory to the
// from of the path from the "path" environment variable
final File currentDir = new File(System.getProperty("user.dir"));
if (new File(currentDir, exeName).exists()) {
return curre... |
python | def create_password(self, data):
"""Create a password."""
# http://teampasswordmanager.com/docs/api-passwords/#create_password
log.info('Create new password %s' % data)
NewID = self.post('passwords.json', data).get('id')
log.info('Password has been created with ID %s' % NewID)
... |
java | protected AsteriskVersion determineVersionByCoreShowVersion() throws Exception
{
final ManagerResponse coreShowVersionResponse = sendAction(new CommandAction(CMD_SHOW_VERSION));
if (coreShowVersionResponse == null || !(coreShowVersionResponse instanceof CommandResponse))
{
// th... |
java | public final void mT__133() throws RecognitionException {
try {
int _type = T__133;
int _channel = DEFAULT_TOKEN_CHANNEL;
// InternalSARL.g:119:8: ( 'super' )
// InternalSARL.g:119:10: 'super'
{
match("super");
}
... |
java | private CustomVariable getCustomVariable(String parameter, int index){
CustomVariableList cvl = (CustomVariableList)parameters.get(parameter);
if (cvl == null){
return null;
}
return cvl.get(index);
} |
java | public Response approveSuggestion(String suggestionId) throws JinxException {
JinxUtils.validateParams(suggestionId);
Map<String, String> params = new TreeMap<>();
params.put("method", "flickr.photos.suggestions.approveSuggestion");
params.put("suggestion_id", suggestionId);
return jinx.flickrPost(p... |
java | public Packet prepend(Consumer<Packet> consumer) {
prepend = true;
consumer.accept(this);
while (!stack.isEmpty()) {
queue.offerFirst(stack.pop());
}
prepend = false;
return this;
} |
python | def add_fields(self, field_dict):
"""Add a mapping of field names to PayloadField instances.
:API: public
"""
for key, field in field_dict.items():
self.add_field(key, field) |
java | @Override
public ResourceSet<TollFree> read(final TwilioRestClient client) {
return new ResourceSet<>(this, client, firstPage(client));
} |
java | public static void deleteIfExists(File file) throws IOException {
if (file.exists()) {
if (file.isFile()) {
if (!file.delete()) {
throw new IOException("Delete file failure,path:" + file.getAbsolutePath());
}
} else {
File[] files = file.listFiles();
if (files !... |
python | def detect_from_pkgconfig(self):
"""Detects the igraph include directory, library directory and the
list of libraries to link to using ``pkg-config``."""
if not buildcfg.has_pkgconfig:
print("Cannot find the C core of igraph on this system using pkg-config.")
return False... |
python | def sca_xsect(scatterer, h_pol=True):
"""Scattering cross section for the current setup, with polarization.
Args:
scatterer: a Scatterer instance.
h_pol: If True (default), use horizontal polarization.
If False, use vertical polarization.
Returns:
The scattering cross s... |
python | def frame_vars_to_xml(frame_f_locals, hidden_ns=None):
""" dumps frame variables to XML
<var name="var_name" scope="local" type="type" value="value"/>
"""
xml = ""
keys = dict_keys(frame_f_locals)
if hasattr(keys, 'sort'):
keys.sort() # Python 3.0 does not have it
else:
key... |
java | public final void synpred253_Java_fragment() throws RecognitionException {
// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1221:22: ( '.' methodName )
// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1221:22: '.' methodName
{
match(input,47,FOLLOW_47_in_synpred253_Ja... |
java | public CompletionStage<Map<String, Result<SSHResult<R>>>> callSyncSSH(final SaltClient client,
SSHTarget<?> target, SaltSSHConfig cfg, AuthMethod auth) {
Map<String, Object> args = new HashMap<>();
args.putAll(getPayload());
args.putAll(target.getProps());
SaltSSHUtils.mapCo... |
java | private Permission getReadPermission(String table) {
return _readPermissionCache != null ?
_readPermissionCache.getUnchecked(table) :
createReadPermission(table);
} |
java | public int getOrElse (int key, int defval)
{
Record rec = locateRecord(key);
return (rec == null) ? defval : rec.value;
} |
python | def set_settings(self, releases=None, default_release=None):
"""set path to storage"""
super(ReplicaSets, self).set_settings(releases, default_release)
Servers().set_settings(releases, default_release) |
java | @Nonnull
@Override
public ScheduledFuture<?> schedule(@Nonnull Runnable command, long delay, @Nonnull TimeUnit unit) {
scheduledOnce.mark();
return delegate.schedule(new InstrumentedRunnable(command), delay, unit);
} |
python | def extend_unique(seq, more):
"""Return a new sequence containing the items in `seq` plus any items in
`more` that aren't already in `seq`, preserving the order of both.
"""
seen = set(seq)
new = []
for item in more:
if item not in seen:
seen.add(item)
new.append(... |
python | def machine_to_machine(self):
"""
Access the machine_to_machine
:returns: twilio.rest.api.v2010.account.available_phone_number.machine_to_machine.MachineToMachineList
:rtype: twilio.rest.api.v2010.account.available_phone_number.machine_to_machine.MachineToMachineList
"""
... |
python | def _local_to_shape(self, local_x, local_y):
"""Translate local coordinates point to shape coordinates.
Shape coordinates have the same unit as local coordinates, but are
offset such that the origin of the shape coordinate system (0, 0) is
located at the top-left corner of the shape bou... |
python | def keyPressEvent( self, event ):
"""
Handles the Ctrl+C/Ctrl+V events for copy & paste.
:param event | <QKeyEvent>
"""
if ( event.key() == Qt.Key_C and \
event.modifiers() == Qt.ControlModifier ):
self.copy()
event.accept()
... |
java | public static <T extends ImageGray<T>>
InputToBinary<T> blockOtsu(ConfigLength regionWidth, double scale, boolean down, boolean thresholdFromLocalBlocks,
boolean otsu2, double tuning,Class<T> inputType) {
if( BOverrideFactoryThresholdBinary.blockOtsu != null )
return BOverrideFactoryThresholdBinary.bloc... |
python | def _call_marginalizevperp(self,o,integrate_method='dopr54_c',**kwargs):
"""Call the DF, marginalizing over perpendicular velocity"""
#Get d, l, vlos
l= o.ll(obs=[1.,0.,0.],ro=1.)*_DEGTORAD
vlos= o.vlos(ro=1.,vo=1.,obs=[1.,0.,0.,0.,0.,0.])
R= o.R(use_physical=False)
phi= ... |
python | def cmd_output(self, args):
'''handle output commands'''
if len(args) < 1 or args[0] == "list":
self.cmd_output_list()
elif args[0] == "add":
if len(args) != 2:
print("Usage: output add OUTPUT")
return
self.cmd_output_add(args[1... |
java | static public <D extends ImageGray<D>>
void intensityE( D derivX , D derivY , GrayF32 intensity )
{
if( derivX instanceof GrayF32) {
GradientToEdgeFeatures.intensityE((GrayF32)derivX,(GrayF32)derivY,intensity);
} else if( derivX instanceof GrayS16) {
GradientToEdgeFeatures.intensityE((GrayS16)derivX,(GrayS1... |
java | public static ZipEntry getClassZipEntryFromZipInClassPath(String className) throws IOException {
String fileName = StringSupport.replaceAll(className, ".", "/");
fileName += ".class";
Collection<String> jars = StringSupport.split(System.getProperty("java.class.path"), ";:", false);
for(String jarFileName : jar... |
python | def TLV_GET(attrs, attrNum, format):
""" Get a tag-length-value encoded attribute. """
attrView = attrs[attrNum]
if format == 's':
format = str(attrView.len) + format
try:
(result,) = struct.unpack_from(format, attrView.buf, attrView.offset)
except TypeError:
# Working around... |
python | def request(self, url, method='GET', params=None, data=None,
expected_response_code=200, headers=None):
"""Make a HTTP request to the InfluxDB API.
:param url: the path of the HTTP request, e.g. write, query, etc.
:type url: str
:param method: the HTTP method for the req... |
java | @Override
public int remove(PartitionRecord criteria) throws Exception {
StringBuilder delete = new StringBuilder(111)
.append("DELETE FROM Partition p WHERE");
if (criteria != null) {
if (criteria.hasExecutor())
delete.append(" p.EXECUTOR=:x AND")... |
java | public void setPointerList(int i, MMAXPointer v) {
if (MMAXAnnotation_Type.featOkTst && ((MMAXAnnotation_Type)jcasType).casFeat_pointerList == null)
jcasType.jcas.throwFeatMissing("pointerList", "de.julielab.jules.types.mmax.MMAXAnnotation");
jcasType.jcas.checkArrayBounds(jcasType.ll_cas.ll_getRefValue(... |
java | public static String getResourceTypeDescription(Locale locale, String name) {
CmsExplorerTypeSettings settings = OpenCms.getWorkplaceManager().getExplorerTypeSetting(name);
if (settings != null) {
// try to find the localized key
String key = settings.getInfo();
if (... |
java | private List<EntityIdValue> getItemIdValueList(StatementGroup statementGroup) {
List<EntityIdValue> result = new ArrayList<>(statementGroup.size());
for (Statement s : statementGroup) {
Value v = s.getValue();
if (v instanceof EntityIdValue) {
result.add((EntityIdValue) v);
}
}
return result;
} |
python | def _weighted_spearman(y, y_pred, w):
"""Calculate the weighted Spearman correlation coefficient."""
y_pred_ranked = np.apply_along_axis(rankdata, 0, y_pred)
y_ranked = np.apply_along_axis(rankdata, 0, y)
return _weighted_pearson(y_pred_ranked, y_ranked, w) |
python | def pull(self):
"""
Pull selected repo from a remote git repository,
while preserving user changes
"""
if not os.path.exists(self.repo_dir):
yield from self.initialize_repo()
else:
yield from self.update() |
java | public ArrayList<Pair<String, Integer>> dhtNodes() {
string_int_pair_vector v = p.get_dht_nodes();
int size = (int) v.size();
ArrayList<Pair<String, Integer>> l = new ArrayList<>();
for (int i = 0; i < size; i++) {
string_int_pair n = v.get(i);
l.add(new Pair<>(n... |
python | def write_packages(self, reqs_file):
"""
Dump the packages in the catalog in a requirements file
"""
write_file_lines(reqs_file, ('{}\n'.format(package) for package in self.packages)) |
python | def group_create(name, content, **kwargs):
"""
Create routing group.
You can optionally specify content for created routing group. It can be either direct JSON
expression in single quotes, or path to the json file with settings. Settings itself must be
key-value list, where `key` represents applica... |
python | def randomwrap(func):
"""
Decorator for random value generators
Allows passing of sequence of parameters, as well as a size argument.
Convention:
- If size=1 and the parameters are all scalars, return a scalar.
- If size=1, the random variates are 1D.
- If the parameters are scalar... |
python | def add_to_subset(self, id, s):
"""
Adds a node to a subset
"""
n = self.node(id)
if 'meta' not in n:
n['meta'] = {}
meta = n['meta']
if 'subsets' not in meta:
meta['subsets'] = []
meta['subsets'].append(s) |
java | public OkCoinOrderResult getOrder(String symbol, Integer type, String orderIds)
throws IOException {
OkCoinOrderResult orderResult =
okCoin.getOrders(apikey, type, orderIds, symbol, signatureCreator());
return returnOrThrow(orderResult);
} |
java | public static <T1, T2, R> BiFunction<T1, T2, R> spy(BiFunction<T1, T2, R> function, Box<R> result, Box<T1> param1, Box<T2> param2) {
return new BinaryCapturingFunction<>(function, result, param1, param2);
} |
java | public String getNameOfSubstance() {
if (Chemical_Type.featOkTst && ((Chemical_Type)jcasType).casFeat_nameOfSubstance == null)
jcasType.jcas.throwFeatMissing("nameOfSubstance", "de.julielab.jules.types.Chemical");
return jcasType.ll_cas.ll_getStringValue(addr, ((Chemical_Type)jcasType).casFeatCode_nameOfS... |
java | public static JPropertyFile getOrCreatePropertyFile(JPackage thePackage,
String name) {
JPropertyFile propertyFile = null;
for (Iterator<JResourceFile> iterator = thePackage.propertyFiles(); iterator
.hasNext() && (null == propertyFile);) {
final JResourceFile resourceFile = (JResourceFile) iterator.next(... |
java | private boolean extraEntity(String outputString, int charToMap)
{
boolean extra = false;
if (charToMap < ASCII_MAX)
{
switch (charToMap)
{
case '"' : // quot
if (!outputString.equals("""))
extra = true;
... |
python | def download_file(self, src_uri, target):
"""Download file from MediaFire.
src_uri -- MediaFire file URI to download
target -- download path or file-like object in write mode
"""
resource = self.get_resource_by_uri(src_uri)
if not isinstance(resource, File):
... |
java | public static SetAclAction fromProto(File.PSetAclAction pSetAclAction) {
if (pSetAclAction == null) {
throw new IllegalStateException("Null proto set acl action.");
}
switch (pSetAclAction) {
case REPLACE:
return SetAclAction.REPLACE;
case MODIFY:
return SetAclAction.MODIFY... |
java | public static MozuUrl storeCredentialsUrl()
{
UrlFormatter formatter = new UrlFormatter("/api/platform/extensions/credentialStore/");
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} |
java | public static @Nonnull JsonSet set(Iterable<?> c) {
JsonSet jjArray = new JsonSet();
if(c instanceof JsonElement) {
jjArray.add((JsonArray)c);
} else {
for (Object o : c) {
if (o instanceof JsonElement) {
jjArray.add((JsonElement) o);
... |
python | def wait(self, timeout=None):
"""
Waits (blocks) until a running pipeline finishes.
Arguments:
- timeout(``int``) [default: ``None``] Specifies the timeout,
``RuntimeError`` will be raised. The default is to wait indefinetely
for the pipeline ... |
java | @Override
public ORID getIdentity(final Object iPojo) {
checkOpeness();
final ODocument record = getRecordByUserObject(iPojo, false);
if (record != null)
return record.getIdentity();
return OObjectSerializerHelper.getObjectID(this, iPojo);
} |
java | public NameValue getNameValueLeaf(BaseMessageHeader header, boolean bAddIfNotFound)
{
Object[][] mxString = header.getNameValueTree();
NameValue node = this;
if (mxString != null)
{
for (int i = 0; i < mxString.length; i++)
{
node = node.getNam... |
python | def setInputFormatText( self, text ):
"""
Sets the input format text for this widget to the given value.
:param text | <str>
"""
try:
self._inputFormat = XLineEdit.InputFormat[nativestring(text)]
except KeyError:
pass |
java | public Matrix solve(Matrix B)
{
//Solve A x = L L^T x = b, for x
//First solve L y = b
Matrix y = forwardSub(L, B);
//Sole L^T x = y
Matrix x = backSub(L, y);
return x;
} |
python | def get_snapshots(self):
"""
Returns a list of all completed snapshots for this volume ID.
"""
ec2 = self.get_ec2_connection()
rs = ec2.get_all_snapshots()
all_vols = [self.volume_id] + self.past_volume_ids
snaps = []
for snapshot in rs:
if sna... |
python | def marshal(data, fields, envelope=None):
"""Takes raw data (in the form of a dict, list, object) and a dict of
fields to output and filters the data based on those fields.
:param data: the actual object(s) from which the fields are taken from
:param fields: a dict of whose keys will make up the final ... |
python | def refresh(self):
"""
Refresh the access token
"""
data = {
'grant_type': 'refresh_token',
'refresh_token': self._token.refresh_token
}
response = self.http_client.post(self.URL, data=data, auth=(self.client_id, self.client_secret))
respo... |
java | public static boolean cholU( DMatrix6x6 A ) {
A.a11 = Math.sqrt(A.a11);
A.a21 = 0;
A.a31 = 0;
A.a41 = 0;
A.a51 = 0;
A.a61 = 0;
A.a12 = (A.a12)/A.a11;
A.a22 = Math.sqrt(A.a22-A.a12*A.a12);
A.a32 = 0;
A.a42 = 0;
A.a52 = 0;
A.... |
python | def version_info(self):
"""
Returns API version information for the HMC.
This operation does not require authentication.
Returns:
:term:`HMC API version`: The HMC API version supported by the HMC.
Raises:
:exc:`~zhmcclient.HTTPError`
:exc:`~zhmc... |
python | def augment_init_method(cls):
"""
Replace the existing cls.__init__() method with a new one which
also initialises the field generators and similar bookkeeping.
"""
orig_init = cls.__init__
def new_init(self, *args, **kwargs):
super(CustomGenerator, self).__init__() # TODO: does this ... |
python | def _getZODBAnalyses(self, objid):
""" Searches for analyses from ZODB to be filled with results.
objid can be either AR ID or Worksheet's Reference Sample IDs.
Only analyses that matches with getAnallowedAnalysisStates() will
be returned. If not a ReferenceAnalysis, getAllow... |
java | public CmsGroup readGroup(CmsDbContext dbc, CmsProject project) {
try {
return readGroup(dbc, project.getGroupId());
} catch (CmsException exc) {
return new CmsGroup(
CmsUUID.getNullUUID(),
CmsUUID.getNullUUID(),
project.getGroupId... |
java | protected ProblemTreeViewer getViewer() {
try {
return (ProblemTreeViewer) this.reflect.get(this, "fViewer"); //$NON-NLS-1$
} catch (SecurityException | NoSuchFieldException | IllegalArgumentException | IllegalAccessException e) {
throw new Error(e);
}
} |
java | public String getSQLQuery(boolean bUseCurrentValues, Vector<BaseField> vParamList)
{
String strRecordset = this.makeTableNames(false);
String strFields = this.getSQLFields(DBConstants.SQL_SELECT_TYPE, bUseCurrentValues);
boolean bIsQueryRecord = this.isQueryRecord();
String strSortPa... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.