language
stringclasses
2 values
func_code_string
stringlengths
63
466k
java
public <L, R> SingleOutputStreamOperator<R> flatSelect( final OutputTag<L> timedOutPartialMatchesTag, final PatternFlatTimeoutFunction<T, L> patternFlatTimeoutFunction, final TypeInformation<R> outTypeInfo, final PatternFlatSelectFunction<T, R> patternFlatSelectFunction) { final PatternProcessFunction<T,...
java
public int getInt(String key) { if (containsKey(key)) { return Integer.parseInt(get(key)); } else { throw new IllegalArgumentException("Missing key " + key + "."); } }
java
public ExternalWikiService updateExternalWikiService(Object projectIdOrPath, ExternalWikiService externalWiki) throws GitLabApiException { GitLabApiForm formData = new GitLabApiForm() .withParam("external_wiki_url", externalWiki.getExternalWikiUrl()); Response response = put(Response.St...
java
public static boolean isBase64(byte octet) { return octet == PAD || (octet >= 0 && octet < DECODE_TABLE.length && DECODE_TABLE[octet] != -1); }
python
def cancel_withdraw(self, address_id): """ η”³θ―·ε–ζΆˆζηŽ°θ™šζ‹ŸεΈ :param address_id: :return: { "status": "ok", "data": 700 } """ params = {} path = f'/v1/dw/withdraw-virtual/{address_id}/cancel' def _wrapper(_func):...
java
private void printSliceList(CfDef columnFamilyDef, List<KeySlice> slices) throws NotFoundException, TException, IllegalAccessException, InstantiationException, NoSuchFieldException, CharacterCodingException { AbstractType<?> validator; String columnFamilyName = columnFamilyDef.getName();...
java
@Override public int getSqlType(String paramName) { if (!hasValue(paramName)) { return TYPE_UNKNOWN; } Object value = getValue(paramName); return StatementCreatorUtils.javaTypeToSqlParameterType(value.getClass()); }
java
protected String prepareStyles() { StringBuffer styles = new StringBuffer(); prepareAttribute(styles, "id", getAttribute("styleId")); prepareAttribute(styles, "style", getAttribute("style")); prepareAttribute(styles, "class", getAttribute("styleClass")); prepareAttribute(styles, "title", getAttribute("title"...
java
public void setBlastProgram(BlastProgramEnum program) { if (BlastProgramEnum.megablast != program) { setAlignmentOption(PROGRAM, program.name()); removeAlignmentOption(MEGABLAST); } else { setAlignmentOption(PROGRAM, BlastProgramEnum.blastn.name()); setAlignmentOption(MEGABLAST, "on"); } }
python
def __remote_path_rewrite(self, dataset_path, dataset_path_type, name=None): """ Return remote path of this file (if staging is required) else None. """ path = str(dataset_path) # Use false_path if needed. action = self.action_mapper.action(path, dataset_path_type) if action.sta...
python
def filetree(self): """ :attr:`files` as a dictionary tree Each node is a ``dict`` that maps directory/file names to child nodes. Each child node is a ``dict`` for directories and ``None`` for files. If :attr:`path` is ``None``, this is an empty ``dict``. """ tr...
java
public static <T> Collection<T> unique(Collection<T> self, boolean mutate, Comparator<T> comparator) { List<T> answer = uniqueItems(self, comparator); if (mutate) { self.clear(); self.addAll(answer); } return mutate ? self : answer; }
python
def load(cls, folder): """ Loads PopulationSet from folder ``popset.h5`` and ``trsig.pkl`` must exist in folder. :param folder: Folder from which to load. """ popset = PopulationSet.load_hdf(os.path.join(folder,'popset.h5')) sigfile = os.path.join(fo...
java
protected Content codeTagOutput(Element element, DocTree tag) { CommentHelper ch = utils.getCommentHelper(element); StringContent content = new StringContent(utils.normalizeNewlines(ch.getText(tag))); Content result = HtmlTree.CODE(content); return result; }
java
private StyleableStringProperty imageUrlProperty() { if (imageUrl == null) { imageUrl = CssHelper.createStyleableStringProperty(this, PROP_NAME_IMAGE_URL, GRAPHIC, () -> { final String url = imageUrlProperty().get(); if (url != null) { final Imag...
java
@Override public void executeListMultiActions() throws CmsRuntimeException { if (getParamListAction().equals(LIST_MACTION_DELETE)) { // execute the delete multiaction Map<String, String[]> params = new HashMap<String, String[]>(); params.put(A_CmsEditGroupDialog.PARAM_GR...
java
private static Map<Direction, Map<Parity, String>> createBorders() { Map<Direction, Map<Parity, String>> m = createDirectionParityMap(); m.get(Direction.RIGHT).put(Parity.EVEN, "bcfguvyz"); m.get(Direction.LEFT).put(Parity.EVEN, "0145hjnp"); m.get(Direction.TOP).put(Parity.EVEN, "prxz")...
python
def usernameFromRequest(request): """ Take an HTTP request and return a username of the form <user>@<domain>. @type request: L{inevow.IRequest} @param request: A HTTP request @return: A C{str} """ username = request.args.get('username', [''])[0] if '@' not in username: username...
java
@Override public boolean eIsSet(int featureID) { switch (featureID) { case AfplibPackage.DESCRIPTOR_POSITION__DES_POS_ID: return DES_POS_ID_EDEFAULT == null ? desPosID != null : !DES_POS_ID_EDEFAULT.equals(desPosID); } return super.eIsSet(featureID); }
java
@Override public void write(@Sensitive byte[] b) throws IOException { // note: an NPE is appropriate here if input was null this.output.write(b, 0, b.length); }
java
private void tryRegisterThreeTenBackport() { try { tryRegister("org.threeten.bp.Instant", "parse"); tryRegister("org.threeten.bp.Duration", "parse"); tryRegister("org.threeten.bp.LocalDate", "parse"); tryRegister("org.threeten.bp.LocalTime", "parse"); ...
java
@Override public int read(final byte[] b, final int offset, final int len) throws IOException { if (b == null) { throw new NullPointerException(); } else if (offset < 0 || len < 0) { throw new IndexOutOfBoundsException(); } else if (offset > b.length || offset + len >...
java
public void getTraceSummaryLine(StringBuilder buff) { // Get the common fields for control messages super.getTraceSummaryLine(buff); buff.append(",ackPrefix="); buff.append(getAckPrefix()); }
python
def insert(self, index, child, **kwargs): '''add a new script to the container. :param child: a ``string`` representing an absolute path to the script or relative path (does not start with ``http`` or ``/``), in which case the :attr:`Media.media_path` attribute is prepended. ...
java
@Deprecated public static List<String> trim(List<String> values) { List<String> trimmed = new ArrayList<>(); for (String value : values) { trimmed.add(value.trim()); } return trimmed; }
java
public static base_responses update(nitro_service client, transformprofile resources[]) throws Exception { base_responses result = null; if (resources != null && resources.length > 0) { transformprofile updateresources[] = new transformprofile[resources.length]; for (int i=0;i<resources.length;i++){ updat...
java
public static NlsRuntimeException getOrCreateUserException(Throwable exception) { if (exception instanceof NlsThrowable) { NlsThrowable nlsThrowable = (NlsThrowable) exception; if (nlsThrowable.isForUser()) { if (exception instanceof NlsRuntimeException) { return (NlsRuntimeException)...
java
private void populateResourceAssignmentWorkgroupFields(Record record, ResourceAssignmentWorkgroupFields workgroup) throws MPXJException { workgroup.setMessageUniqueID(record.getString(0)); workgroup.setConfirmed(NumberHelper.getInt(record.getInteger(1)) == 1); workgroup.setResponsePending(NumberHel...
python
def build_hypergraph_adjacency(cluster_runs): """Return the adjacency matrix to a hypergraph, in sparse matrix representation. Parameters ---------- cluster_runs : array of shape (n_partitions, n_samples) Returns ------- hypergraph_adjacency : compressed sparse row matrix R...
python
def get_list_privileges(self, username): """Get the list of all privileges granted to given user. :param username: the username to get privileges of :type username: str :returns: all privileges granted to given user :rtype: list of dictionaries :Example: :: ...
python
def has_chosen(state, correct, msgs): """Verify exercises of the type MultipleChoiceExercise Args: state: State instance describing student and solution code. Can be omitted if used with Ex(). correct: index of correct option, where 1 is the first option. msgs : list of feedback...
java
public void doNewRecord(boolean bDisplayOption) { super.doNewRecord(bDisplayOption); if (m_bMoveOnNew) { boolean bOldModified = false; if (m_fldDest != null) bOldModified = m_fldDest.isModified(); int iMoveType = DBConstants.INIT_MOVE; // Typica...
java
public Sheet[] findForLoading(final Workbook workbook, final XlsSheet sheetAnno, final AnnotationReader annoReader, final Class<?> beanClass) throws SheetNotFoundException, AnnotationInvalidException, AnnotationReadException { if(sheetAnno.name().length() > 0) { ...
java
public static CleaneLing full(final FormulaFactory f, final CleaneLingConfig config) { return new CleaneLing(f, SolverStyle.FULL, config); }
java
public void readFully(byte[] b) throws IOException { int l = in.read(b); if (l < 0) throw new EOFException(); if (l < b.length && l > 0) throw new StreamCorruptedException("Unexpected EOF in middle of data block."); }
java
public OrderBy buildOrderBy(IAssetType assetType, IAttributeDefinition defaultOrderBy) { OrderBy order = new OrderBy(); if (orderBy.size() > 0) { for (String s : orderBy) { order.minorSort(assetType .getAttributeDefini...
python
def _get_tls_object(self, ssl_params): """ Return a TLS object to establish a secure connection to a server """ if ssl_params is None: return None if not ssl_params["verify"] and ssl_params["ca_certs"]: self.warning( "Incorrect configurati...
python
def fRD( a, M): """Calculate the ring-down frequency for the final Kerr BH. Using Eq. 5.5 of Main paper""" f = (lal.C_SI**3.0 / (2.0*lal.PI*lal.G_SI*M*lal.MSUN_SI)) * (1.5251 - 1.1568*(1.0-a)**0.1292) return f
python
def _title_uptodate(self,fullfile,pid,_title): """Check fb photo title against provided title, returns true if they match""" i=self.fb.get_object(pid) if i.has_key('name'): if _title == i['name']: return True return False
python
def convert(self, convert_to=None, runscript="/bin/bash", force=False): '''This is a convenience function for the user to easily call to get the most likely desired result, conversion to the opposite format. We choose the selection based on th...
java
public void stop() { if (filtersEnabled.get()) { cache.removeListener(this); } isStopped.set(true); resumeLocally(); unregisterRemoteCommands(); }
python
def calc_efficiency(self): """ Solar cell efficiency The efficiency is calculated according to Shockley & Queisser's :cite:`10.1063/1.1736034` Eq. 2.8. This method returns a :class:`float`. """ cell_power = self.calc_power_density() solar_power = self.calc_blackbody_radi...
java
public static String getBucketName(URI uri) { if (uri.getHost() != null) { return uri.getHost(); } if (uri.getUserInfo() == null) { return uri.getAuthority(); } throw new IllegalArgumentException("Unable to determine S3 bucket from URI."); }
java
private void bind() { distanceRemainingText = findViewById(R.id.distanceRemainingText); timeRemainingText = findViewById(R.id.timeRemainingText); arrivalTimeText = findViewById(R.id.arrivalTimeText); rerouteProgressBar = findViewById(R.id.rerouteProgressBar); updateRouteOverviewImage(); }
java
private void removeDataNode(DiffEntry change) { if (checkFilePath(change.getOldPath(), NODE_FILE_DEPTH)) { Path nodeFilePath = new Path(this.repositoryDir, change.getOldPath()); Config config = getNodeConfigWithOverrides(ConfigFactory.empty(), nodeFilePath); String nodeId = config.getString(FlowGr...
python
def msearch_template(self, body, index=None, params=None): """ The /_search/template endpoint allows to use the mustache language to pre render search requests, before they are executed and fill existing templates with template parameters. `<http://www.elastic.co/guide/en/elastic...
python
def _netcdf2pandas(self, netcdf_data, query_variables, start, end): """ Transforms data from netcdf to pandas DataFrame. Parameters ---------- data: netcdf Data returned from UNIDATA NCSS query. query_variables: list The variables requested. ...
java
public void marshall(AddTagsToResourceRequest addTagsToResourceRequest, ProtocolMarshaller protocolMarshaller) { if (addTagsToResourceRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(addTags...
java
public Observable<ServiceResponse<RunGetLogResultInner>> getLogSasUrlWithServiceResponseAsync(String resourceGroupName, String registryName, String runId) { if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot b...
python
def _parse_trunk_allowed_vlans(self, config): """Scans the specified config and parse the trunk allowed vlans value Args: config (str): The interface configuration block to scan Returns: dict: A Python dict object with the value of switchport trunk allow...
java
public UTerminal on(JcNode node) { UsingExpression ux = (UsingExpression)this.astNode; ux.setValueRef(node); UTerminal ret = new UTerminal(ux); return ret; }
java
protected List createParentBoundables( List childBoundables, int newLevel ) { Assert.isTrue(!childBoundables.isEmpty()); int minLeafCount = (int) Math.ceil((childBoundables.size() / (double) getNodeCapacity())); ArrayList sortedChildBoundables = new ArrayList(childBoundables); Collection...
java
private SICoreConnection createConnection(Certificate[] certificate) throws SIAuthenticationException, SIResourceException, SINotAuthorizedException { if (TraceComponent.isAnyTracingEnabled() && CoreSPIConnFactory.tc.isEntryEnabled()) { SibTr.entry(CoreSPIConnFactory.tc, "createConnectio...
java
@VisibleForTesting public static Tagger getTagger(String implementation) { if (implementation.equals("impl")) { // We can return the global tracer here because if impl is linked the global tracer will be // the impl one. // TODO(bdrutu): Make everything not be a singleton (disruptor, etc.) and u...
java
public static Map<String, String> mfAttrStd(final Project pProject) { Map<String, String> result = new HashMap<>(); result.put("Manifest-Version", "1.0"); result.put("Website", new BuildUtil(pProject).getExtraPropertyValue(ExtProp.Website)); result.put("Created-By", GradleVersion.cur...
python
def convert_pmod(pmod): """Update BEL1 pmod() protein modification term""" if pmod.args[0].value in spec["bel1_migration"]["protein_modifications"]: pmod.args[0].value = spec["bel1_migration"]["protein_modifications"][ pmod.args[0].value ] return pmod
java
public ServiceFuture<ManagedDatabaseInner> beginUpdateAsync(String resourceGroupName, String managedInstanceName, String databaseName, ManagedDatabaseUpdate parameters, final ServiceCallback<ManagedDatabaseInner> serviceCallback) { return ServiceFuture.fromResponse(beginUpdateWithServiceResponseAsync(resourceGr...
python
def multipart_parse_json(api_url, data): """ Send a post request and parse the JSON response (potentially containing non-ascii characters). @param api_url: the url endpoint to post to. @param data: a dictionary that will be passed to requests.post """ headers = {'Content-Type': 'application/...
python
def _create_keywords_wizard_action(self): """Create action for keywords creation wizard.""" icon = resources_path('img', 'icons', 'show-keyword-wizard.svg') self.action_keywords_wizard = QAction( QIcon(icon), self.tr('Keywords Creation Wizard'), self.iface.mai...
python
def ProgramScanner(**kw): """Return a prototype Scanner instance for scanning executable files for static-lib dependencies""" kw['path_function'] = SCons.Scanner.FindPathDirs('LIBPATH') ps = SCons.Scanner.Base(scan, "ProgramScanner", **kw) return ps
java
@Override public EmailSendConfig[] listEmailConfig(String CorpNum) throws PopbillException { return httpget("/Taxinvoice/EmailSendConfig", CorpNum, null, EmailSendConfig[].class); }
java
static Positions newPositions(Matches matches) { if (matches == null) throw new IllegalArgumentException("null matches"); return new BitStorePositions(matches, false, 0); }
python
def lint(self, dataset=None, col=None, no_header=False, ignore_nfd=False, ignore_ws=False, linewise=False, no_lines=False): """ Returns a string containing all the issues found in the dataset defined by the given file path. """ reader = Reader(dataset, has_header=not no_header, ipa_col=col) recog = Rec...
python
def namer(cls, imageUrl, pageUrl): """Use page URL sequence which is apparently increasing.""" num = pageUrl.split('/')[-1] ext = imageUrl.rsplit('.', 1)[1] return "thethinhline-%s.%s" % (num, ext)
java
public static int word_count(EvaluationContext ctx, Object text, @BooleanDefault(false) Object bySpaces) { String _text = Conversions.toString(text, ctx); boolean _bySpaces = Conversions.toBoolean(bySpaces, ctx); return getWords(_text, _bySpaces).size(); }
java
@Override public void onEvent(final WorkerEvent event, final Worker worker, final String queue, final net.greghaines.jesque.Job job, final Object runner, final Object result, final Throwable t) { if (t == null) { LOG.debug("{} {} {} {} {} {} {}", new Object[]{ event, worker, queue, j...
java
private void captureH264MetaData(ByteBuffer encodedData, MediaCodec.BufferInfo bufferInfo) { mH264MetaSize = bufferInfo.size; mH264Keyframe = ByteBuffer.allocateDirect(encodedData.capacity()); byte[] videoConfig = new byte[bufferInfo.size]; encodedData.get(videoConfig, bufferInfo.offset,...
python
def __request_start(self, queue_item): """Execute the request in given queue item. Args: queue_item (:class:`nyawc.QueueItem`): The request/response pair to scrape. """ try: action = self.__options.callbacks.request_before_start(self.queue, queue_item) ...
java
private void fillDetailIndexSource(CmsListItem item, String detailId) { StringBuffer html = new StringBuffer(); // search for the corresponding A_CmsSearchIndex: I_CmsSearchIndex idx = OpenCms.getSearchManager().getIndex((String)item.get(LIST_COLUMN_NAME)); html.append("<ul>\n"); ...
python
def get_desired_factors(ini): """Get the list of desired envs per declared factor. Look at all the accepted configuration locations, and give a list of envlists, one for each Travis factor found. Look in the ``[travis]`` section for the known Travis factors, which are backed by environment variabl...
java
@JSONField(serialize = false) public boolean isSequential() { if (getList() != null) { for (Input.Obj obj : getList()) { if (obj.isSequential()) { return true; } } } return false; }
python
def make_const_handler(data): """ Create a handler for a data opcode that returns a constant. """ data = bytes_as_hex(data) def constant_data_opcode_handler(script, pc, verify_minimal_data=False): return pc+1, data return constant_data_opcode_handler
python
def concatenate(*fsms): ''' Concatenate arbitrarily many finite state machines together. ''' alphabet = set().union(*[fsm.alphabet for fsm in fsms]) def connect_all(i, substate): ''' Take a state in the numbered FSM and return a set containing it, plus (if it's final) the first state from the nex...
python
def ls(ctx, name, list_formatted): """List EC2 instances""" session = create_session(ctx.obj['AWS_PROFILE_NAME']) ec2 = session.resource('ec2') if name == '*': instances = ec2.instances.filter() else: condition = {'Name': 'tag:Name', 'Values': [name]} instances = ec2.instance...
java
private void writeSequenceBegin(int size) throws TException { getCurrentContext().write(); if (getCurrentContext().isMapKey()) { throw new TException(SEQUENCE_AS_KEY_ILLEGAL); } pushContext(new SequenceContext(null)); try { getCurrentWriter().writeStartAr...
python
def init_vagrant(self, vagrant_file): """ Creates a Vagrantfile in the target dir, with only the base image pulled. Copies the runner script to the directory so it's accessible from the VM. """ if self.inherit_image: image_name, image_tag = str(self.inherit_image).split("...
python
def text_fd_to_metric_families(fd): """Parse Prometheus text format from a file descriptor. This is a laxer parser than the main Go parser, so successful parsing does not imply that the parsed text meets the specification. Yields Metric's. """ name = '' documentation = '' typ = 'un...
java
private static MethodHandle findMethod(Class<?> clazz, String methodName, boolean staticMethod, Class<?> expectedReturnType, Class<?>... expectedParameterTypes) { MethodHandle methodHandle = null; try { Method method = clazz.getMethod(methodName, expectedParameterTypes); int modifiers = method...
java
Name typeSig(Type type) { Assert.check(signatureGen.isEmpty()); //- System.out.println(" ? " + type); signatureGen.assembleSig(type); Name n = signatureGen.toName(); signatureGen.reset(); //- System.out.println(" " + n); return n; }
python
def load(cls, filename, gzipped, byteorder='big'): """Read, parse and return the file at the specified location. The `gzipped` argument is used to indicate if the specified file is gzipped. The `byteorder` argument lets you specify whether the file is big-endian or little-endian. ...
java
@Override public Endpoint buildObject() { return new EndpointImpl(Endpoint.DEFAULT_ELEMENT_NAME.getNamespaceURI(), Endpoint.DEFAULT_ELEMENT_LOCAL_NAME, Endpoint.DEFAULT_ELEMENT_NAME.getPrefix()); }
java
@Override public EClass getIfcTransportElementType() { if (ifcTransportElementTypeEClass == null) { ifcTransportElementTypeEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI) .getEClassifiers().get(731); } return ifcTransportElementTypeEClass; }
python
def _dimensions_to_values(dimensions): """ Replace dimensions specs with their `dimension` values, and ignore those without """ values = [] for dimension in dimensions: if isinstance(dimension, dict): if 'extractionFn' in dimension: ...
java
@Override public boolean observesDaylightTime() { long time = System.currentTimeMillis(); // Check if daylight saving time is observed now. int[] offsets = new int[2]; getOffset(time, false, offsets); if (offsets[1] != 0) { return true; } // If D...
java
protected final Charset getCharset() { return mediaType == null || mediaType.getCharsetParameter() == null ? Charsets.ISO_8859_1 : mediaType.getCharsetParameter(); }
java
protected void generateClassUseFile() throws IOException { Content body = getClassUseHeader(); HtmlTree div = new HtmlTree(HtmlTag.DIV); div.addStyle(HtmlStyle.classUseContainer); if (pkgSet.size() > 0) { addClassUse(div); } else { div.addContent(getResour...
python
def check_heading(self, m): '''check heading discrepancy''' if 'GPS_RAW_INT' in self.status.msgs: gps = self.status.msgs['GPS_RAW_INT'] if gps.vel < 300: return diff = math.fabs(angle_diff(m.heading, gps.cog / 100.0)) else: return ...
java
@Override public DigestCalculator get(final AlgorithmIdentifier algorithmIdentifier) throws OperatorCreationException { final Digest digest = getFactory(algorithmIdentifier.getAlgorithm()).getInstance(); if (digest instanceof DigestCalculator) { return (DigestCalculator) digest; ...
java
public static Collection map(Mapper mapper, Collection c) { return map(mapper, c, false); }
python
def getContextsForTerm(self, term, getFingerprint=None, startIndex=0, maxResults=5): """Get the contexts for a given term Args: term, str: A term in the retina (required) getFingerprint, bool: Configure if the fingerprint should be returned as part of the results (optional) ...
python
def link(self, title, path): ''' Add a static file on the file system. :param title: :param path: :return: ''' # The filehandler needs to be explicitly passed here, so PyLint needs to accept that. # pylint: disable=W8470 if not isinstance(path, fi...
java
public static long betweenMs(Date beginDate, Date endDate) { return new DateBetween(beginDate, endDate).between(DateUnit.MS); }
java
public boolean link(D declaration, ServiceReference<S> declarationBinderRef) { S declarationBinder = bindersManager.getDeclarationBinder(declarationBinderRef); LOG.debug(declaration + " match the filter of " + declarationBinder + " : bind them together"); declaration.bind(declarationBinderRef); ...
python
def join(expr1, expr2, d1_keys, d2_keys, keys_type, d1_vals, df1_vals_ty, d2_vals, df2_vals_ty): """ Computes a join on two tables """ weld_obj = WeldObject(encoder_, decoder_) df1_var = weld_obj.update(expr1) if isinstance(expr1, WeldObject): df1_var = expr1.obj_id weld_obj....
python
def p_term_div(self, tree): ''' V ::= term ( V / V )''' tree.value = convertstr(tree[0].value) / tree[2].value
python
def gt(self, other, axis="columns", level=None): """Checks element-wise that this is greater than other. Args: other: A DataFrame or Series or scalar to compare to. axis: The axis to perform the gt over. level: The Multilevel index level to apply gt over. ...
python
def ascolumn(x, dtype = None): '''Convert ``x`` into a ``column``-type ``numpy.ndarray``.''' x = asarray(x, dtype) return x if len(x.shape) >= 2 else x.reshape(len(x),1)
java
@Override public SSLContext getSSLContext() throws KeyManagementException, UnrecoverableKeyException, NoSuchAlgorithmException, KeyStoreException { final SSLContext context = SSLContext.getInstance("TLS"); String httpProtocols = System.getProperty("https.protocols"); System.set...
java
private int getErrorCode(Object error) { if (error instanceof Number) { return ((Number) error).intValue(); } else if (error instanceof YokeException) { return ((YokeException) error).getErrorCode().intValue(); } else if (error instanceof JsonObject) { return ...
python
def replacePassword(self, currentPassword, newPassword): """ Set this account's password if the current password matches. @param currentPassword: The password to match against the current one. @param newPassword: The new password. @return: A deferred firing when the password ha...