language stringclasses 2
values | func_code_string stringlengths 63 466k |
|---|---|
python | def get_pull_request_files(project, num, auth=False):
"""get list of files in a pull request"""
url = "https://api.github.com/repos/{project}/pulls/{num}/files".format(project=project, num=num)
if auth:
header = make_auth_header()
else:
header = None
return get_paged_request(url, hea... |
java | protected Instance createInstance()
throws InstallationException
{
final Insert insert;
try {
insert = new Insert(getCiType());
insert.add("Name", this.programName);
if (getEFapsUUID() != null) {
insert.add("UUID", getEFapsUUID().toString()... |
java | private File createFolder(ITestResult tr) throws IOException{
String path = ListenerGateway.getParameter(SCREENSHOT_FOLDER);
if (path == null || path.isEmpty()) {
path = "." + File.separatorChar + "screenshots";
}
if(tr != null) {
path += File.separatorChar + tr.getMethod().getTestClass().getName();
... |
java | public DataSetBuilder random(String column, Date min, Date max) {
ensureValidRange(min, max);
long a = min.getTime() / MILLIS_PER_DAY;
long b = max.getTime() / MILLIS_PER_DAY ;
return set(column, () -> new Date(nextRandomLong(a, b) * MILLIS_PER_DAY));
} |
java | private static void pushAnnotations(
Deque<GraphAnnotationState> stack,
Collection<? extends Annotatable> haveAnnotations) {
stack.push(new GraphAnnotationState(haveAnnotations.size()));
for (Annotatable h : haveAnnotations) {
stack.peek().add(new AnnotationState(h, h.getAnnotation()));
... |
python | def on_window_losefocus(self, window, event):
"""Hides terminal main window when it loses the focus and if
the window_losefocus gconf variable is True.
"""
if not HidePrevention(self.window).may_hide():
return
value = self.settings.general.get_boolean('window-losefoc... |
python | def use_federated_book_view(self):
"""Pass through to provider CommentLookupSession.use_federated_book_view"""
self._book_view = FEDERATED
# self._get_provider_session('comment_lookup_session') # To make sure the session is tracked
for session in self._get_provider_sessions():
... |
python | def resubmit_workflow(self, stage_name=None, description=None):
'''Resubmits the workflow.
Parameters
----------
stage_name: str, optional
name of the stage at which workflow should be resubmitted
(when omitted workflow will be restarted from the beginning)
... |
java | public static CommerceOrder fetchByU_LtC_O_Last(long userId,
Date createDate, int orderStatus,
OrderByComparator<CommerceOrder> orderByComparator) {
return getPersistence()
.fetchByU_LtC_O_Last(userId, createDate, orderStatus,
orderByComparator);
} |
java | private List<AdvancedModelWrapper> recursiveUpdateEnhancement(List<AdvancedModelWrapper> updates,
Map<Object, AdvancedModelWrapper> updated, EKBCommit commit) {
List<AdvancedModelWrapper> additionalUpdates = enhanceUpdates(updates, updated, commit);
for (AdvancedModelWrapper model : updates)... |
python | def run(self, command, name_addition=None, cmd_kwargs=None,
_cmd="sbatch", tries=1, depends_on=None):
"""
command: a bash command that you want to run
name_addition: if not specified, the sha1 of the command to run
appended to job name. if it is "date", the yyy... |
python | def map(self, method: str, *args, _threaded: bool = True, **kwargs
) -> "AttrIndexedDict":
"For all stored items, run a method they possess."
work = lambda item: getattr(item, method)(*args, **kwargs)
if _threaded:
pool = ThreadPool(int(config.CFG["GENERAL"]["parallel_re... |
java | public JdbcMapperBuilder<T> addMapping(final String column, final int index, final int sqlType) {
addMapping(column, index, sqlType, FieldMapperColumnDefinition.<JdbcColumnKey>identity());
return this;
} |
java | public void setOnTimeCompletionListener(final OnTimeCompletionListener onTimeCompletionListener) {
if (currentAudioState.get()!=PREPARED_STATE && currentAudioState.get()!=INITIALIZED_STATE ){
throw new IllegalStateException("Cannot modify onTimeCompletionListener during a non-prepared and non-initia... |
java | @Override
public boolean isInAddressBook(String phoneNumber) {
AndroidContact c = AndroidContact.lookupByNumber(phoneNumber);
return c != null;
} |
java | protected void addHostRequestHeader(HttpState state, HttpConnection conn)
throws IOException, HttpException {
LOG.trace("enter HttpMethodBase.addHostRequestHeader(HttpState, "
+ "HttpConnection)");
// Per 19.6.1.1 of RFC 2616, it is legal for HTTP/1.0 based
// applications... |
java | public List<GitlabCommitDiff> getCommitDiffs(Serializable projectId, String commitHash) throws IOException {
return getCommitDiffs(projectId, commitHash, new Pagination());
} |
java | public final EObject entryRuleXExpression() throws RecognitionException {
EObject current = null;
EObject iv_ruleXExpression = null;
try {
// InternalSARL.g:12011:52: (iv_ruleXExpression= ruleXExpression EOF )
// InternalSARL.g:12012:2: iv_ruleXExpression= ruleXExpress... |
java | public void setTargetedPositions(com.google.api.ads.admanager.axis.v201811.VideoPositionTarget[] targetedPositions) {
this.targetedPositions = targetedPositions;
} |
python | def sort_js_files(js_files):
"""Sorts JavaScript files in `js_files`.
It sorts JavaScript files in a given `js_files`
into source files, mock files and spec files based on file extension.
Output:
* sources: source files for production. The order of source files
is significant and should be... |
java | public void marshall(DetachStaticIpRequest detachStaticIpRequest, ProtocolMarshaller protocolMarshaller) {
if (detachStaticIpRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(detachStaticIpRe... |
python | def dither_symbol(value, dither):
"""
Returns the appropriate block drawing symbol for the given intensity.
:param value: intensity of the color, in the range [0.0, 1.0]
:return: dithered symbol representing that intensity
"""
dither = DITHER_TYPES[dither][1]
return dither[int(round(value * ... |
java | public static String getVaadinWorkplaceLink(CmsObject cms, String resourceRootFolder) {
CmsSite site = OpenCms.getSiteManager().getSiteForRootPath(resourceRootFolder);
String siteRoot = site != null
? site.getSiteRoot()
: OpenCms.getSiteManager().startsWithShared(resourceRootFolder)
... |
java | public void reset(SecurityRealm securityRealm) throws ServletException {
if (securityRealm != null) {
SecurityRealm.SecurityComponents sc = securityRealm.getSecurityComponents();
AUTHENTICATION_MANAGER.setDelegate(sc.manager);
USER_DETAILS_SERVICE_PROXY.setDelegate(sc.userDet... |
python | def on_state_execution_status_changed_after(self, model, prop_name, info):
""" Show current execution status in the widget
This function specifies what happens if the state machine execution status of a state changes
:param model: the model of the state that has changed (most likely it... |
python | def get_throttled_by_consumed_read_percent(
table_name, lookback_window_start=15, lookback_period=5):
""" Returns the number of throttled read events in percent of consumption
:type table_name: str
:param table_name: Name of the DynamoDB table
:type lookback_window_start: int
:param lookbac... |
python | def matches_video_filename(self, video):
"""
Detect whether the filename of videofile matches with this SubtitleFile.
:param video: VideoFile instance
:return: True if match
"""
vid_fn = video.get_filename()
vid_base, _ = os.path.splitext(vid_fn)
vid_base... |
python | def on(self, evnt, func, base=None):
'''
Add an base function callback for a specific event with optional filtering. If the function returns a
coroutine, it will be awaited.
Args:
evnt (str): An event name
func (function): A callback function to recei... |
java | public static long lowerHexToUnsignedLong(String lowerHex) {
int length = lowerHex.length();
if (length < 1 || length > 32) throw isntLowerHexLong(lowerHex);
// trim off any high bits
int beginIndex = length > 16 ? length - 16 : 0;
return lowerHexToUnsignedLong(lowerHex, beginIndex);
} |
java | public boolean isNumberTypeParameter(int index) { // contains optional generic type
if (pathParamTypeList.size() <= index) { // avoid out of bounds
return false;
}
final Class<?> parameterType = pathParamTypeList.get(index);
if (Number.class.isAssignableFrom(parameterType)) {... |
python | def get_ops_hashes(cls, impl, working_dir, start_block_height=None, end_block_height=None):
"""
Read all consensus hashes into memory. They're write-once read-many,
so no need to worry about cache-coherency.
"""
if (start_block_height is None and end_block_height is not None) or... |
python | def canvas_changed_cb(self, canvas, whence):
"""Handle callback for when canvas has changed."""
self.logger.debug("root canvas changed, whence=%d" % (whence))
# special check for whether image changed out from under us in
# a shared canvas scenario
try:
# See if ther... |
python | def _psi_n(x, n, b):
"""
Compute the n-th term in the infinite sum of
the Jacobi density.
"""
return 2**(b-1) / gamma(b) * (-1)**n * \
np.exp(gammaln(n+b) -
gammaln(n+1) +
np.log(2*n+b) -
0.5 * np.log(2*np.pi*x**3) -
(2*n+b)**2 / (8.*x)) |
java | public List<User> find(Connection conn, String str, Criteria criteria) throws SQLException {
ResultSetHandler<List<User>> h = new BeanListHandler<User>(User.class);
String sql = "\n";
if (str !=null && !str.trim().isEmpty()) {
sql = "WHERE username||fullname ~ '"+str+"' \n";
... |
java | public void redirectCall(String connId, String destination) throws WorkspaceApiException {
this.redirectCall(connId, destination, null, null);
} |
python | def guest_create_nic(self, userid, vdev=None, nic_id=None,
mac_addr=None, active=False):
""" Create the nic for the vm, add NICDEF record into the user direct.
:param str userid: the user id of the vm
:param str vdev: nic device number, 1- to 4- hexadecimal digits
... |
python | def timeline(self, request, drip_id, into_past, into_future):
"""
Return a list of people who should get emails.
"""
from django.shortcuts import render, get_object_or_404
drip = get_object_or_404(Drip, id=drip_id)
shifted_drips = []
seen_users = set()
f... |
java | public void setFinal(Path path) {
// Step through the nodes creating any nodes which don't exist.
Node currentNode = root;
for (Term t : path.getTerms()) {
Node nextNode = currentNode.getChild(t);
if (nextNode == null) {
nextNode = currentNode.newChild(t);
}
currentNode = nextNode;
}
// The ... |
python | def idle_task(self):
'''called in idle time'''
try:
data = self.port.recv(1024) # Attempt to read up to 1024 bytes.
except socket.error as e:
if e.errno in [ errno.EAGAIN, errno.EWOULDBLOCK ]:
return
raise
try:
self.send_rtc... |
python | def get_project(self, name):
"""
For a given project, get a dictionary mapping available versions to Distribution
instances.
This calls _get_project to do all the work, and just implements a caching layer on top.
"""
if self._cache is None: # pragma: no cover
... |
java | public static <T> T fromXml(String xml, Class<T> type) {
if (xml == null || xml.trim().equals("")) {
return null;
}
JAXBContext jc = null;
Unmarshaller u = null;
T object = null;
try {
jc = JAXBContext.newInstance(type);
u = jc.createUn... |
java | public String buildImageInformation() {
// count all image resources of the gallery folder
int count = 0;
try {
int imageId = OpenCms.getResourceManager().getResourceType(
CmsResourceTypeImage.getStaticTypeName()).getTypeId();
CmsResourceFilter filter = C... |
python | def wait_for_lime(self, listen_port, listen_address="0.0.0.0",
max_tries=20, wait=1):
"""
Wait for lime to load unless max_retries is exceeded
:type listen_port: int
:param listen_port: port LiME is listening for connections on
:type listen_address: str
... |
java | public PendingIntent buildPendingIntent(int requestCode, int flags, IntentFactoryStrategy parameters){
return PendingIntent.getActivity(context, requestCode, buildIntent(parameters), flags);
} |
java | public void write(String s, int offset, int length)
throws IOException
{
while (length > 0) {
if (_tail == null)
addBuffer(TempCharBuffer.allocate());
else if (_tail._buf.length <= _tail._length) {
addBuffer(TempCharBuffer.allocate());
// XXX: see TempStream for backing fi... |
java | public static MutableDoubleTuple createRandomGaussian(
int size, Random random)
{
MutableDoubleTuple t = create(size);
randomizeGaussian(t, random);
return t;
} |
python | def delete_build_configuration(id=None, name=None):
"""
Delete an existing BuildConfiguration
:param id:
:param name:
:return:
"""
data = delete_build_configuration_raw(id, name)
if data:
return utils.format_json(data) |
python | def parseinput(inputlist,outputname=None, atfile=None):
"""
Recursively parse user input based upon the irafglob
program and construct a list of files that need to be processed.
This program addresses the following deficiencies of the irafglob program::
parseinput can extract filenames from asso... |
python | def docs(session):
"""Build the docs."""
session.install('sphinx', 'sphinx_rtd_theme')
session.install('.')
# Build the docs!
session.run('rm', '-rf', 'docs/_build/')
session.run('sphinx-build', '-W', '-b', 'html', '-d',
'docs/_build/doctrees', 'docs/', 'docs/_build/html/') |
python | def fill_default(self):
"""
Define the object properties with a default value when the property is not yet defined
:return: None
"""
for prop, entry in self.__class__.properties.items():
if hasattr(self, prop):
continue
if not hasattr(entr... |
java | public static int checkPreconditionI(
final int value,
final boolean condition,
final IntFunction<String> describer)
{
return innerCheckI(value, condition, describer);
} |
python | def make_unique_script_attr(attributes):
"""
Filter out duplicate `Script` TransactionAttributeUsage types.
Args:
attributes: a list of TransactionAttribute's
Returns:
list:
"""
filtered_attr = []
script_list = []
for attr in attributes:
if attr.Usage != Transact... |
java | public TypeUsage.Builder mergeFrom(TypeUsage.Builder template) {
// Upcast to access private fields; otherwise, oddly, we get an access violation.
TypeUsage_Builder base = template;
TypeUsage_Builder defaults = new TypeUsage.Builder();
if (!base._unsetProperties.contains(Property.START)
&& (defa... |
python | def yml_fnc(fname, *args, **options):
"""An wrapper of yaml.safe_load, yaml.load, yaml.safe_dump and yaml.dump.
:param fname:
"load" or "dump", not checked but it should be OK.
see also :func:`yml_load` and :func:`yml_dump`
:param args: [stream] for load or [cnf, stream] for dump
:param... |
java | public ArrayList<Long> serviceName_monitoringNotifications_GET(String serviceName) throws IOException {
String qPath = "/xdsl/{serviceName}/monitoringNotifications";
StringBuilder sb = path(qPath, serviceName);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t15);
} |
python | def fromJSON(value):
"""loads the GP object from a JSON string """
j = json.loads(value)
v = GPRecordSet()
if "defaultValue" in j:
v.value = j['defaultValue']
else:
v.value = j['value']
if 'paramName' in j:
v.paramName = j['paramName']
... |
java | public static <T extends ItemInfo> Predicate<T> enabled() {
return input -> !(input instanceof DisableSupport) || ((DisableSupport) input).isEnabled();
} |
python | def compareSNPs(before, after, outFileName):
"""Compares two set of SNPs.
:param before: the names of the markers in the ``before`` file.
:param after: the names of the markers in the ``after`` file.
:param outFileName: the name of the output file.
:type before: set
:type after: set
:type ... |
python | def do_batch_status(args):
"""Runs the batch-status command, printing output to the console
Args:
args: The parsed arguments sent to the command at runtime
"""
rest_client = RestClient(args.url, args.user)
batch_ids = args.batch_ids.split(',')
if args.wait and args.wait > 0:
... |
java | private void initRestTemplate() {
boolean isContainsConverter = false;
for (HttpMessageConverter<?> httpMessageConverter : this.restTemplate.getMessageConverters()) {
if (MappingJacksonRPC2HttpMessageConverter.class.isAssignableFrom(httpMessageConverter.getClass())) {
isContainsConverter = true;
break;
... |
java | public Configuration setFirstMemory(@NonNull AllocationStatus initialMemory) {
if (initialMemory != AllocationStatus.DEVICE && initialMemory != AllocationStatus.HOST
&& initialMemory != AllocationStatus.DELAYED)
throw new IllegalStateException("First memory should be either [... |
java | public static ConfigurableEmitter loadEmitter(String ref,
ConfigurableEmitterFactory factory) throws IOException {
return loadEmitter(ResourceLoader.getResourceAsStream(ref), factory);
} |
python | def format_image(path, options):
'''Formats an image.
Args:
path (str): Path to the image file.
options (dict): Options to apply to the image.
Returns:
(list) A list of PIL images. The list will always be of length
1 unless resolutions for resizing are provided in the optio... |
python | def quota(self):
"""Get the uploaded track count and allowance.
Returns:
tuple: Number of uploaded tracks, number of tracks allowed.
"""
response = self._call(
mm_calls.ClientState,
self.uploader_id
)
client_state = response.body.clientstate_response
return (client_state.total_track_count, cli... |
java | public static CommerceDiscountUserSegmentRel fetchByCommerceUserSegmentEntryId_Last(
long commerceUserSegmentEntryId,
OrderByComparator<CommerceDiscountUserSegmentRel> orderByComparator) {
return getPersistence()
.fetchByCommerceUserSegmentEntryId_Last(commerceUserSegmentEntryId,
orderByComparator);
} |
java | double findMax() {
double max = exploded.stream().reduce(Double.MIN_VALUE, (x, y) -> x > y ? x : y);
return max;
} |
java | public void shutdown(ShutdownModeAmp mode)
{
Thread thread = Thread.currentThread();
ClassLoader oldLoader = thread.getContextClassLoader();
try {
thread.setContextClassLoader(classLoader());
if (! _lifecycle.toStopping()) {
return;
}
//_httpCache.close();
t... |
python | def rp_module_level_in_stack():
"""
Returns true if we're during a rootpy import
"""
from traceback import extract_stack
from rootpy import _ROOTPY_SOURCE_PATH
modlevel_files = [filename for filename, _, func, _ in extract_stack()
if func == "<module>"]
return any(path... |
python | def set_charge_and_spin(self, charge, spin_multiplicity=None):
"""
Set the charge and spin multiplicity.
Args:
charge (int): Charge for the molecule. Defaults to 0.
spin_multiplicity (int): Spin multiplicity for molecule.
Defaults to None, which means tha... |
java | @GwtIncompatible("Writer")
static CharOutput asCharOutput(final Writer writer) {
checkNotNull(writer);
return new CharOutput() {
@Override
public void write(char c) throws IOException {
writer.append(c);
}
@Override
public void flush() throws IOException {
writer... |
java | private static int readRawVarint32(ByteBuf buffer) {
if (!buffer.isReadable()) {
return 0;
}
buffer.markReaderIndex();
byte tmp = buffer.readByte();
if (tmp >= 0) {
return tmp;
} else {
int result = tmp & 127;
if (!buffer.is... |
python | def get_special_carbon(self, elements=None):
"""
Identify Carbon atoms in the MoleculeGraph that fit the characteristics
defined Ertl (2017), returning a list of their node indices.
The conditions for marking carbon atoms are (quoted from Ertl):
"- atoms connected by non-aro... |
java | private void updateAromaticTypesInFiveMemberRing(int[] cycle, String[] symbs) {
final String hetro = symbs[cycle[0]];
// simple conditions tell is the 'IM' and 'AN' flags
final boolean imidazolium = NCN_PLUS.equals(hetro) || NGD_PLUS.equals(hetro);
final boolean anion = "NM".equals(het... |
java | public void setAlertChannels(Collection<AlertChannel> channels)
{
for(AlertChannel channel : channels)
{
// Add the channel to any policies it is associated with
List<Long> policyIds = channel.getLinks().getPolicyIds();
for(long policyId : policyIds)
{... |
python | def coherence_spectrogram(self, other, stride, fftlength=None,
overlap=None, window='hann', nproc=1):
"""Calculate the coherence spectrogram between this `TimeSeries`
and other.
Parameters
----------
other : `TimeSeries`
the second `Time... |
python | def render(self):
'''Render a matplotlib figure from the analyzer result
Return the figure, use fig.show() to display if neeeded
'''
fig, ax = plt.subplots()
self.data_object._render_plot(ax)
return fig |
python | def attr(key, value=None):
'''
Access/write a SysFS attribute.
If the attribute is a symlink, it's destination is returned
:return: value or bool
CLI example:
.. code-block:: bash
salt '*' sysfs.attr block/sda/queue/logical_block_size
'''
key = target(key)
if key is Fals... |
java | public static String genNaiveBaseNameForExpr(ExprNode exprNode, String fallbackBaseName) {
if (exprNode instanceof VarRefNode) {
return BaseUtils.convertToUpperUnderscore(((VarRefNode) exprNode).getName());
} else if (exprNode instanceof FieldAccessNode) {
return BaseUtils.convertToUpperUnderscore((... |
python | def start_kex(self):
"""
Start the GSS-API / SSPI Authenticated Diffie-Hellman Group Exchange
"""
if self.transport.server_mode:
self.transport._expect_packet(MSG_KEXGSS_GROUPREQ)
return
# request a bit range: we accept (min_bits) to (max_bits), but prefer... |
python | def restore_row(self, row, schema):
"""Restore row from BigQuery
"""
for index, field in enumerate(schema.fields):
if field.type == 'datetime':
row[index] = parse(row[index])
if field.type == 'date':
row[index] = parse(row[index]).date()
... |
java | public java.util.Map<String, java.util.List<String>> getDetails() {
return details;
} |
java | @Override
public Request<CreateVpcPeeringConnectionRequest> getDryRunRequest() {
Request<CreateVpcPeeringConnectionRequest> request = new CreateVpcPeeringConnectionRequestMarshaller().marshall(this);
request.addParameter("DryRun", Boolean.toString(true));
return request;
} |
python | def to_json(self):
"""Convert the Sky Condition to a dictionary."""
return {
'solar_model': self.solar_model,
'month': self.month,
'day_of_month': self.day_of_month,
'daylight_savings_indicator': self.daylight_savings_indicator,
'beam_shced': s... |
java | public void marshall(DetectFacesRequest detectFacesRequest, ProtocolMarshaller protocolMarshaller) {
if (detectFacesRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(detectFacesRequest.getIma... |
python | def LogAccessWrapper(func):
"""Decorator that ensures that HTTP access is logged."""
def Wrapper(request, *args, **kwargs):
"""Wrapping function."""
try:
response = func(request, *args, **kwargs)
server_logging.LOGGER.LogHttpAdminUIAccess(request, response)
except Exception: # pylint: disa... |
java | public static Blob createBlob(final Connection conn) {
try {
return conn.createBlob();
} catch (SQLException e) {
throw new UroborosqlRuntimeException(e);
}
} |
java | public String getRootCauseMessage() {
String rcmessage = null;
if (getRootCause() != null) {
if (getRootCause().getCause() != null) {
rcmessage = getRootCause().getCause().getMessage();
}
rcmessage = rcmessage == null ? getRootCause().getMessage() : rc... |
python | def _find_combo_match(path):
"""
Calculate the key to check the MEDIASYNC['JOINED'] dict for, perform the
lookup, and return the matching key string if a match is found. If no
match is found, return None instead.
"""
key_str = _form_key_str(path)
if not key_str:
# _form_key_str() say... |
python | def _get_settings(self):
"""
Return any settings defined by the user, as well as any pre-defined
settings files that exist for the image modalities to be registered.
"""
# If user-defined settings exist...
if isdefined(self.inputs.settings):
# Note this in the... |
java | public void setDependencies( Collection<org.sonatype.aether.graph.Dependency> dependencies ) {
for ( org.sonatype.aether.graph.Dependency dep : dependencies ) {
addDependency( dep );
}
} |
python | def clean_all(self, args):
"""Delete all build components; the package cache, package builds,
bootstrap builds and distributions."""
self.clean_dists(args)
self.clean_builds(args)
self.clean_download_cache(args) |
python | def send_text(self, user_id, content, account=None):
"""
发送文本消息
详情请参考
http://mp.weixin.qq.com/wiki/7/12a5a320ae96fecdf0e15cb06123de9f.html
:param user_id: 用户 ID 。 就是你收到的 `Message` 的 source
:param content: 消息正文
:param account: 可选,客服账号
:return: 返回的 JSON 数据... |
python | def get(tree, name):
""" Return a float value attribute NAME from TREE.
"""
if name in tree:
value = tree[name]
else:
return float("nan")
try:
a = float(value)
except ValueError:
a = float("nan")
return a |
java | public static Point2D_F64 renderPixel(CameraPinhole intrinsic , Point3D_F64 X ) {
Point2D_F64 norm = new Point2D_F64(X.x/X.z,X.y/X.z);
return convertNormToPixel(intrinsic, norm, norm);
} |
python | def get_accounts(cls, soco=None):
"""Get all accounts known to the Sonos system.
Args:
soco (`SoCo`, optional): a `SoCo` instance to query. If `None`, a
random instance is used. Defaults to `None`.
Returns:
dict: A dict containing account instances. Each... |
java | public void connect(final String applicationKey,
final String authenticationToken) {
/*
* Sanity checks
*/
if (isConnected) {
raiseOrtcEvent(EventEnum.OnException, this,
new OrtcAlreadyConnectedException());
} else if (Strings.isNullOrEmpty(clusterUrl)
&& Strings.isNullOrEmpty(url)) {
rais... |
python | def connected_emulators(self, host=enums.JLinkHost.USB):
"""Returns a list of all the connected emulators.
Args:
self (JLink): the ``JLink`` instance
host (int): host type to search (default: ``JLinkHost.USB``)
Returns:
List of ``JLinkConnectInfo`` specifying the ... |
python | def generate_view(ase):
# type: (blobxfer.models.azure.StorageEntity) ->
# Tuple[LocalPathView, int]
"""Generate local path view and total size required
:param blobxfer.models.azure.StorageEntity ase: Storage Entity
:rtype: tuple
:return: (local path view, allocatio... |
java | public void marshall(Column column, ProtocolMarshaller protocolMarshaller) {
if (column == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(column.getName(), NAME_BINDING);
protocolMarshall... |
python | def url(self, text, **kwargs):
"""Add URL Address data to Batch object.
Args:
text (str): The value for this Indicator.
confidence (str, kwargs): The threat confidence for this Indicator.
date_added (str, kwargs): The date timestamp the Indicator was created.
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.