language stringclasses 2
values | func_code_string stringlengths 63 466k |
|---|---|
java | private String extractDeclarations(Match match) {
final StringBuilder result = new StringBuilder();
List<String> declarations = match.getDeclarationIds();
Map<String, Declaration> declsMap = ( (AgendaItem) match ).getTerminalNode().getSubRule().getOuterDeclarations();
for ( int i = 0; i ... |
java | private static void compressGZip(Resource source, Resource target) throws IOException {
if (source.isDirectory()) {
throw new IOException("you can only create a GZIP File from a single source file, use TGZ (TAR-GZIP) to first TAR multiple files");
}
InputStream is = null;
OutputStream os = null;
try {
is... |
python | def multiple_extend_request_args(self, args, key, parameters, item_types,
orig=False):
"""
Go through a set of items (by their type) and add the attribute-value
that match the list of parameters to the arguments
If the same parameter occurs in 2 diffe... |
python | def check_symmetric(array, tol=1E-10, raise_warning=True,
raise_exception=False):
"""Make sure that array is 2D, square and symmetric.
If the array is not symmetric, then a symmetrized version is returned.
Optionally, a warning or exception is raised if the matrix is not
symmetric.
... |
python | def targets_for_class(self, target, classname):
"""Search which targets from `target`'s transitive dependencies contain `classname`."""
targets_with_class = set()
for target in target.closure():
for one_class in self._target_classes(target):
if classname in one_class:
targets_with_cl... |
python | def add_choice(self, text, inline_region, name='', identifier=None):
"""stub"""
choice_display_text = self._choice_text_metadata['default_string_values'][0]
choice_display_text['text'] = text
if identifier is None:
identifier = str(ObjectId())
choice = {
'... |
python | def getskyimg(self,chip):
"""
Notes
=====
Return an array representing the sky image for the detector. The value
of the sky is what would actually be subtracted from the exposure by
the skysub step.
:units: electrons
"""
sci_chip = self._image[s... |
python | def dict_to_htmlrow(d):
"""
converts a dictionary to a HTML table row
"""
res = "<TR>\n"
for k, v in d.items():
if type(v) == str:
res = res + '<TD><p>' + k + ':</p></TD><TD><p>' + v + '</p></TD>'
else:
res = res + '<TD><p>' + k + ':</p></TD><TD><p>' + str(v) ... |
java | protected void setWsConfigurationHelper(ServiceReference<WSConfigurationHelper> ref) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "setWSConfigurationHelper", ref);
wsConfigurationHelperRef.setReference(ref);
} |
python | def add_ok_action(self, action_arn=None):
"""
Adds an ok action, represented as an SNS topic, to this alarm. What
to do when the ok state is reached.
:type action_arn: str
:param action_arn: SNS topics to which notification should be
sent if the alarm... |
java | public static MethodAnnotation convertMethodAnnotation(ClassNameRewriter classNameRewriter, MethodAnnotation annotation) {
if (classNameRewriter != IdentityClassNameRewriter.instance()) {
annotation = new MethodAnnotation(classNameRewriter.rewriteClassName(annotation.getClassName()),
... |
python | def delete_record(self, record):
"""Remove a DNSRecord
Args:
record (:obj:`DNSRecord`): :obj:`DNSRecord` to remove
Returns:
`None`
"""
self.children.remove(record.resource)
record.delete() |
python | def _set_description(self, schema):
"""Set description from schema.
:type schema: Sequence[google.cloud.bigquery.schema.SchemaField]
:param schema: A description of fields in the schema.
"""
if schema is None:
self.description = None
return
self.... |
python | def setup_list_pars(self):
""" main entry point for setting up list multiplier
parameters
"""
tdf = self.setup_temporal_list_pars()
sdf = self.setup_spatial_list_pars()
if tdf is None and sdf is None:
return
os.chdir(self.m.model_ws)
... |
python | def validate_confirm_form(self):
"""
Third and final step of ExpressCheckout. Request has pressed the confirmation but
and we can send the final confirmation to PayPal using the data from the POST'ed form.
"""
wpp = PayPalWPP(self.request)
pp_data = dict(token=self.reques... |
java | @SuppressWarnings("rawtypes")
protected StatementParameter toStatementParameter(String sql, Object... params) {
StatementParameter param = new StatementParameter();
for (Object p : params) {
if (p instanceof Integer) {
param.setInt((Integer) p);
}
else if (p instanceof Long) {
param.setLon... |
python | def data(self, run_config):
"""Return the map data."""
try:
return run_config.map_data(self.path)
except (IOError, OSError) as e: # Catch both for python 2/3 compatibility.
if self.download and hasattr(e, "filename"):
logging.error("Error reading map '%s' from: %s", self.name, e.filenam... |
java | @SuppressWarnings("unchecked")
private static DataSet<StringTriple> getDataSet(ExecutionEnvironment env, ParameterTool params) {
if (params.has("input")) {
return env.readCsvFile(params.get("input"))
.fieldDelimiter(";")
.pojoType(StringTriple.class);
} else {
System.out.println("Executing EmptyField... |
python | def get_config_node(self):
'''get_config_node
High-level api: get_config_node returns an Element node in the config
tree, which is corresponding to the URL in the Restconf GET reply.
Returns
-------
Element
A config node.
'''
default_ns = '... |
java | public OvhRtmRaidVolume serviceName_statistics_raid_unit_volume_volume_GET(String serviceName, String unit, String volume) throws IOException {
String qPath = "/dedicated/server/{serviceName}/statistics/raid/{unit}/volume/{volume}";
StringBuilder sb = path(qPath, serviceName, unit, volume);
String resp = exec(qPa... |
python | def recursive_repr(func):
"""Decorator to prevent infinite repr recursion."""
repr_running = set()
@wraps(func)
def wrapper(self):
"Return ellipsis on recursive re-entry to function."
key = id(self), get_ident()
if key in repr_running:
return '...'
repr_run... |
python | def update_license_file(data_dir):
"""Update NLPIR license file if it is out-of-date or missing.
:param str data_dir: The NLPIR data directory that houses the license.
:returns bool: Whether or not an update occurred.
"""
license_file = os.path.join(data_dir, LICENSE_FILENAME)
temp_dir = tempf... |
java | private synchronized int read(long timeout, boolean isPeek) throws IOException {
/*
* If the thread hit an IOException, we report it.
*/
if (exception != null) {
assert ch == -2;
IOException toBeThrown = exception;
if (!isPeek)
except... |
java | protected int selectFactoryIndex(Object session) throws ConnectException {
Random rnd;
if (session != null) {
return session.hashCode() & 0x7fffffff;
}
else if ((rnd = mRnd) != null) {
return rnd.nextInt() >>> 1;
}
else {
synchronized (... |
java | public boolean compressAndWriteObj( RandomAccessFile theCreatedFile, RandomAccessFile theCreatedNullFile, Object dataObject )
throws RasterWritingFailureException {
if (dataObject instanceof double[][]) {
compressAndWrite(theCreatedFile, theCreatedNullFile, (double[][]) dataObject);
... |
python | def load_yaml(data=None, path=None, name='NT'):
""" Map namedtuples with yaml data. """
if data and not path:
return mapper(yaml.load(data), _nt_name=name)
if path and not data:
with open(path, 'r') as f:
data = yaml.load(f)
return mapper(data, _nt_name=name)
if data ... |
java | public String readString(String charset) throws IOException {
long len = readInt();
if (len > available())
throw new IOException("Cannot read string of length " + len
+ " bytes when only " + available()
+ " bytes are available");
byte[] raw = new byte[(int) len];
readFully(raw);
if (encode) {
... |
java | @Override
public Color interpolate(Color a, Color b, float mixing) {
float[] compA, compB;
// Get components
// Don't convert colorSpaces unless necessary
if(a.getColorSpace().equals(colorSpace) ) {
compA = a.getComponents(null);
} else {
compA = a.getComponents(colorSpace, null);
}
if(b.getColorSp... |
java | public final EntityType getEntityType(EntityTypeName name, String languageCode) {
GetEntityTypeRequest request =
GetEntityTypeRequest.newBuilder()
.setName(name == null ? null : name.toString())
.setLanguageCode(languageCode)
.build();
return getEntityType(request);
... |
python | def compute_ecc_hash(ecc_manager, hasher, buf, max_block_size, rate, message_size=None, as_string=False):
'''Split a string in blocks given max_block_size and compute the hash and ecc for each block, and then return a nice list with both for easy processing.'''
result = []
# If required parameters were not ... |
python | def lemmatize(self, input_text, return_raw=False, return_string=False):
"""Take incoming string or list of tokens. Lookup done against a
key-value list of lemmata-headword. If a string, tokenize with
``PunktLanguageVars()``. If a final period appears on a token, remove
it, then re-add on... |
python | def create(cls, name, engines, policy=None, comment=None, **kwargs):
"""
Create a new validate policy task.
If a policy is not specified, the engines existing policy will
be validated. Override default validation settings as kwargs.
:param str name: name of task
... |
java | public MultiPolygon createMultiPolygon(List<Polygon> polygonList,
boolean hasZ, boolean hasM) {
MultiPolygon multiPolygon = new MultiPolygon(hasZ, hasM);
for (Polygon polygon : polygonList) {
multiPolygon.addPolygon(polygon);
}
re... |
java | public JPEGFrameGrabber getJPEGFrameGrabber(int w, int h, int input,
int std, int q) throws V4L4JException{
return getJPEGFrameGrabber(w, h, input, std, q, null);
} |
python | def find_saas_endurance_space_price(package, size, tier_level):
"""Find the SaaS endurance storage space price for the size and tier
:param package: The Storage As A Service product package
:param size: The volume size for which a price is desired
:param tier_level: The endurance tier for which a price... |
java | protected static boolean setCustomForDefaultProfile(String pathName, Boolean isResponse, String customData) {
try {
JSONObject profile = getDefaultProfile();
String profileName = profile.getString("name");
Client client = new Client(profileName, false);
return cli... |
java | public void closeSession(PrimaryBackupSession session) {
if (sessions.remove(session.sessionId().id()) != null) {
session.close();
listeners.forEach(l -> l.onClose(session));
}
} |
python | def winddir_text(pts):
"Convert wind direction from 0..15 to compass point text"
global _winddir_text_array
if pts is None:
return None
if not isinstance(pts, int):
pts = int(pts + 0.5) % 16
if not _winddir_text_array:
_ = pywws.localisation.translation.ugettext
_wind... |
python | def loadLayerNoCrsDialog(filename, name=None, provider=None):
'''
Tries to load a layer from the given file
Same as the loadLayer method, but it does not ask for CRS, regardless of current
configuration in QGIS settings
'''
settings = QSettings()
prjSetting = settings.value('/Projections/def... |
python | def handle_stream(self, response):
"""
Handles a stream of events from the Mastodon server. When each event
is received, the corresponding .on_[name]() method is called.
response; a requests response object with the open stream for reading.
"""
event = {}
line_bu... |
python | def _send_command(self, command, raw_text=False):
"""
Wrapper for NX-API show method.
Allows more code sharing between NX-API and SSH.
"""
return self.device.show(command, raw_text=raw_text) |
java | public void setValueExpression(String name, ValueExpression binding) {
if ("selectedValues".equals(name)) {
super.setValueExpression("value", binding);
} else {
super.setValueExpression(name, binding);
}
} |
python | def validate(self, *args, **kwargs): # pylint: disable=arguments-differ
"""
Validate a parameter dict against a parameter schema from an ocrd-tool.json
Args:
obj (dict):
schema (dict):
"""
return super(ParameterValidator, self)._validate(*args, **kwargs) |
python | async def serialize_rctsig_base(self, ar, inputs, outputs):
"""
Custom serialization
:param ar:
:type ar: x.Archive
:return:
"""
await self._msg_field(ar, idx=0)
if self.type == RctType.Null:
return
if self.type != RctType.Full and self... |
java | public static <T> T navigate( final Object source, final Object... paths ) {
Object destination = source;
for ( Object path : paths ) {
if ( path == null || destination == null ) {
return null;
}
if ( destination instanceof Map ) {
d... |
java | protected void fireAfterPersist() {
PersistableListener l = _listener;
if(l != null) {
try {
l.afterPersist();
} catch(Exception e) {
_log.error("failure on calling afterPersist", e);
}
}
} |
python | def sg_rnn_layer_func(func):
r"""Decorates function as sg_rnn_layer functions.
Args:
func: function to decorate
"""
@wraps(func)
def wrapper(tensor, **kwargs):
r"""Manages arguments of `tf.sg_opt`.
Args:
tensor: automatically passed by decorator
kwargs:
... |
java | public Object mapToResultType(ControlBeanContext context, Method m, ResultSet resultSet, Calendar cal) {
return resultSet;
} |
python | def connect(self, *args, **kwargs):
"""
Connect to a server.
This overrides the function in SimpleIRCClient
to provide SSL functionality.
:param args:
:param kwargs:
:return:
"""
if self.use_ssl:
factory = irc.connection.Factory(wrapp... |
python | def kms_key_arn(self, lookup):
"""
Args:
lookup: The key alias, EX: alias/proto0-evs-drm
Returns:
The full key arn
"""
key_arn = ef_utils.kms_key_arn(EFAwsResolver.__CLIENTS["kms"], lookup)
return key_arn |
java | @Override
public void initializeInjectionServices() throws CDIException {
Set<ReferenceContext> cdiReferenceContexts = new HashSet<ReferenceContext>();
//first we need to initialize the injection service and collect the reference contexts and the injection classes
for (WebSphereBeanDeploym... |
java | public static String wrap(final String str, int wrapLength, String newLineStr, final boolean wrapLongWords, String wrapOn) {
if (str == null) {
return null;
}
if (newLineStr == null) {
newLineStr = "\n";
}
if (wrapLength < 1) {
wrapLength = 1;
... |
java | public CmsLink getLink(CmsObject cms) {
Element linkElement = m_element.element(CmsXmlPage.NODE_LINK);
if (linkElement == null) {
String textValue = m_element.getText();
if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(textValue)) {
if (CmsUUID.isValidUUID(textValue)... |
python | def hosts_append(hostsfile='/etc/hosts', ip_addr=None, entries=None):
'''
Append a single line to the /etc/hosts file.
CLI Example:
.. code-block:: bash
salt '*' dnsutil.hosts_append /etc/hosts 127.0.0.1 ad1.yuk.co,ad2.yuk.co
'''
host_list = entries.split(',')
hosts = parse_hosts(... |
java | public void run( String[] args ) throws Exception {
// Check
File baseDirectory = null;
if( args.length != 1
|| ! (baseDirectory = new File( args[ 0 ])).exists())
throw new RuntimeException( "The path of the module's directory was expected as an argument." );
// Update
UpdateSwaggerJson updater = new... |
java | public T convertQuietly(Object value, T defaultValue) {
try {
return convert(value, defaultValue);
} catch (Exception e) {
return defaultValue;
}
} |
python | def _over_resizer(self, x, y):
"Returns True if mouse is over a resizer"
over_resizer = False
c = self.canvas
ids = c.find_overlapping(x, y, x, y)
if ids:
o = ids[0]
tags = c.gettags(o)
if 'resizer' in tags:
over_resizer = True... |
java | public void marshall(CreateFunctionRequest createFunctionRequest, ProtocolMarshaller protocolMarshaller) {
if (createFunctionRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(createFunctionRe... |
python | def url_report(self, scan_url, apikey):
"""
Send URLS for list of past malicous associations
"""
url = self.base_url + "url/report"
params = {"apikey": apikey, 'resource': scan_url}
rate_limit_clear = self.rate_limit()
if rate_limit_clear:
response = r... |
java | @Deprecated
public static String stripFragment(final String path) {
final int i = path.indexOf(SHARP);
if (i != -1) {
return path.substring(0, i);
} else {
return path;
}
} |
python | def input_format(self, content_type):
"""Returns the set input_format handler for the given content_type"""
return getattr(self, '_input_format', {}).get(content_type, hug.defaults.input_format.get(content_type, None)) |
java | public static Resource create(String clusterName, String namespace, String podName) {
Map<String, String> labels = new LinkedHashMap<String, String>();
labels.put(CLUSTER_NAME_KEY, checkNotNull(clusterName, "clusterName"));
labels.put(NAMESPACE_NAME_KEY, checkNotNull(namespace, "namespace"));
labels.put... |
java | public static nsappflowparam get(nitro_service service) throws Exception{
nsappflowparam obj = new nsappflowparam();
nsappflowparam[] response = (nsappflowparam[])obj.get_resources(service);
return response[0];
} |
python | def write_incron_file(user, path):
'''
Writes the contents of a file to a user's incrontab
CLI Example:
.. code-block:: bash
salt '*' incron.write_incron_file root /tmp/new_incron
'''
return __salt__['cmd.retcode'](_get_incron_cmdstr(path), runas=user, python_shell=False) == 0 |
java | private void pldltptBK() throws Exception {
//matrix S will be changed by the factorization, ad we do not want to change the matrix passed in by the client
DoubleMatrix2D S = (rescaler==null)? this.Q.copy() : this.Q;
int n = S.rows();
DoubleMatrix2D A = S.copy();
this.P = DoubleFactory2D.sparse.identity(... |
python | def create_deployment_group(applicationName=None, deploymentGroupName=None, deploymentConfigName=None, ec2TagFilters=None, onPremisesInstanceTagFilters=None, autoScalingGroups=None, serviceRoleArn=None, triggerConfigurations=None, alarmConfiguration=None, autoRollbackConfiguration=None, deploymentStyle=None, blueGreenD... |
java | void setComplete() {
this.complete = true;
try {
// If we haven't gotten any results back, make sure to create an
// empty one
if (this.states.size() == 0) {
this.states.put(new WorldState());
}
// Special WorldState to indicate that the request has completed and
// i... |
python | def _create(self):
"""Executes `virtualenv` to create a new environment."""
if self.readonly:
raise VirtualenvReadonlyException()
args = ['virtualenv']
if self.system_site_packages:
args.append('--system-site-packages')
if self.python is None:
... |
java | @Indexable(type = IndexableType.REINDEX)
@Override
public CPDefinitionVirtualSetting addCPDefinitionVirtualSetting(
CPDefinitionVirtualSetting cpDefinitionVirtualSetting) {
cpDefinitionVirtualSetting.setNew(true);
return cpDefinitionVirtualSettingPersistence.update(cpDefinitionVirtualSetting);
} |
python | def validate(self, path: str, strictness: str = "speconly") -> bool:
"""
Validate a file for conformance to the Loom specification
Args:
path: Full path to the file to be validated
strictness: "speconly" or "conventions"
Remarks:
In "speconly" mode, conformance is assessed relative to the file fo... |
java | public Type inferType(Term term) {
if (term instanceof Constant || term instanceof Linear || term instanceof Function) {
return Type.TakagiSugeno;
}
return Type.Tsukamoto;
} |
java | final KNXFormatException logThrow(LogLevel level, String msg, String excMsg,
String item)
{
final KNXFormatException e =
new KNXFormatException(excMsg != null ? excMsg : msg, item);
if (excMsg != null)
logger.log(level, dpt.getID() + " - " + msg, e);
else
logger.log(level, dpt.getID() + " - " ... |
python | def _to_dict(self):
"""Return a json dictionary representing this model."""
_dict = {}
if hasattr(self, 'id') and self.id is not None:
_dict['id'] = self.id
if hasattr(self, 'metadata') and self.metadata is not None:
_dict['metadata'] = self.metadata
if ha... |
python | def build_sensors_list(self, type):
"""Build the sensors list depending of the type.
type: SENSOR_TEMP_UNIT or SENSOR_FAN_UNIT
output: a list
"""
ret = []
if type == SENSOR_TEMP_UNIT and self.init_temp:
input_list = self.stemps
self.stemps = psut... |
python | def verify_log(opts):
'''
If an insecre logging configuration is found, show a warning
'''
level = LOG_LEVELS.get(str(opts.get('log_level')).lower(), logging.NOTSET)
if level < logging.INFO:
log.warning('Insecure logging configuration detected! Sensitive data may be logged.') |
python | def sys_info(fname=None, overwrite=False):
"""Get relevant system and debugging information
Parameters
----------
fname : str | None
Filename to dump info to. Use None to simply print.
overwrite : bool
If True, overwrite file (if it exists).
Returns
-------
out : str
... |
java | public static final <T> Stream<T> appendStream(final Stream<T> stream1, final Stream<T> append) {
return Stream.concat(stream1, append);
} |
java | private void stopDone() {
synchronized (stopLock) {
final StopContext stopContext = this.stopContext;
this.stopContext = null;
if (stopContext != null) {
stopContext.complete();
}
stopLock.notifyAll();
}
} |
java | public void setPartConverters(List<HttpMessageConverter> partConverters) {
checkNotNull(partConverters, "'partConverters' must not be null");
checkArgument(!partConverters.isEmpty(), "'partConverters' must not be empty");
this.partConverters = partConverters;
} |
java | public static String[] processOptions(String args[])
{
String usageError;
goodUsage: for (int i = 0; ; ++i) {
if (i == args.length) {
return new String[0];
}
String arg = args[i];
if (!arg.startsWith("-")) {
processStdin... |
java | public ServiceFuture<QueryResults> executeAsync(String appId, QueryBody body, final ServiceCallback<QueryResults> serviceCallback) {
return ServiceFuture.fromResponse(executeWithServiceResponseAsync(appId, body), serviceCallback);
} |
python | def adjgraph(args):
"""
%prog adjgraph adjacency.txt subgraph.txt
Construct adjacency graph for graphviz. The file may look like sample below.
The lines with numbers are chromosomes with gene order information.
genome 0
chr 0
-1 -13 -16 3 4 -6126 -5 17 -6 7 18 5357 8 -5358 5359 -9 -10 -11 ... |
java | public static RichDiagnosticFormatter instance(Context context) {
RichDiagnosticFormatter instance = context.get(RichDiagnosticFormatter.class);
if (instance == null)
instance = new RichDiagnosticFormatter(context);
return instance;
} |
python | def ancestor(self, n):
"""
Return the n-th ancestor.
Note that ``elem.ancestor(1) == elem.parent``
:rtype: :class:`Element` | ``None``
"""
if not isinstance(n, int) or n < 1:
raise TypeError('Ancestor needs to be positive, received', n)
if n == 1 or ... |
python | def _connect(dbapi_connection, connection_record):
"""Enables foreign key support."""
# If back end is sqlite
if type(dbapi_connection) is sqlite3.Connection:
# Respect foreign key constraints by default
cursor = dbapi_connection.cursor()
cursor.execute("PRAGMA foreign_keys=ON")
... |
java | public CreateCloudFormationChangeSetRequest withCapabilities(String... capabilities) {
if (this.capabilities == null) {
setCapabilities(new java.util.ArrayList<String>(capabilities.length));
}
for (String ele : capabilities) {
this.capabilities.add(ele);
}
... |
python | def update(self, commit=True, **kwargs):
""" Update model attributes and save to database """
for (attr, value) in kwargs.iteritems():
setattr(self, attr, value)
return commit and self.save() or self |
java | public static Properties getReloadPropertiesInToCache(final String propertiesPath)
throws PropertiesException {
String propertiesFilePath = getPropertiesFilePath(propertiesPath);
Properties properties = getProperties(propertiesFilePath);
propertiesCache.put(propertiesFilePath, prope... |
python | def execute():
"""
Entry point of the install helper tool to ease the download of the right
version of the ANTLR v4 tool jar.
"""
arg_parser = ArgumentParser(description='Install helper tool to download the right version of the ANTLR v4 tool jar.')
arg_parser.add_argument('--version', action='... |
python | def unpack_rsp(cls, rsp_pb):
"""Convert from PLS response to user response"""
if rsp_pb.retType != RET_OK:
return RET_ERROR, rsp_pb.retMsg, None
raw_position_list = rsp_pb.s2c.positionList
position_list = [{
"code": merge_trd_mkt_stock_str(rsp_p... |
java | public static void main2(String args[]) {
String dbDriver = "COM.ibm.db2.jdbc.app.DB2Driver";
String url = "jdbc:db2:sample";
String user = "batra";
String pass = "varunbatra";
String querystring = "Select * from batra.employee";
String fn;
String ln;
Stri... |
python | def ts_describe(self, transport, table):
"""
ts_describe(table)
Retrieve a time series table description from the Riak cluster.
.. note:: This request is automatically retried :attr:`retries`
times if it fails due to network error.
:param table: The timeseries table... |
java | public StepExecution withOutputs(java.util.Map<String, java.util.List<String>> outputs) {
setOutputs(outputs);
return this;
} |
python | def generate(self, output_dir, catalogue, results, label):
"""Generates the report, writing it to `output_dir`."""
data = results.get_raw_data()
labels = catalogue.ordered_labels
ngrams = self._generate_results(output_dir, labels, data)
ngram_table = self._generate_ngram_table(ou... |
python | def load_classes(package_str):
'''Load all classes from modules of a given `package_str`. All class instances are stored in a case-insensitive `dict`
and returned. If a package doesn't contain any class `None` is returned'''
_logger.debug('Loading all modules from %s', package_str)
package = importlib.... |
python | def prose_wc(args):
"""Processes data provided to print a count object, or update a file.
Args:
args: an ArgumentParser object returned by setup()
"""
if args.file is None:
return 1
if args.split_hyphens:
INTERSTITIAL_PUNCTUATION.append(re.compile(r'-'))
content = args.f... |
python | def connect_patch_node_proxy_with_path(self, name, path, **kwargs): # noqa: E501
"""connect_patch_node_proxy_with_path # noqa: E501
connect PATCH requests to proxy of Node # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, plea... |
java | protected static void removeViewer(Page page, boolean close) {
IHelpViewer viewer = (IHelpViewer) page.removeAttribute(VIEWER_ATTRIB);
if (viewer != null && close) {
viewer.close();
}
} |
python | def network_interface_create_or_update(name, ip_configurations, subnet, virtual_network,
resource_group, **kwargs):
'''
.. versionadded:: 2019.2.0
Create or update a network interface within a specified resource group.
:param name: The name of the network interfa... |
python | def on_widget__button_press_event(self, widget, event):
'''
Called when any mouse button is pressed.
.. versionchanged:: 0.11
Do not trigger `route-electrode-added` event if `ALT` key is
pressed.
'''
if self.mode == 'register_video' and event.button == 1... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.