language stringclasses 2
values | func_code_string stringlengths 63 466k |
|---|---|
java | public static AnnotationMemberDeclaration mergeAnnotationMember(
AnnotationMemberDeclaration one, AnnotationMemberDeclaration two) {
if (isAllNull(one, two)) return null;
AnnotationMemberDeclaration amd = null;
if (isAllNotNull(one, two)) {
amd = new AnnotationMemberD... |
python | def find_encrypt_data(self, resp):
""" Verifies if a saml response contains encrypted assertions with
encrypted data.
:param resp: A saml response.
:return: True encrypted data exists otherwise false.
"""
if resp.encrypted_assertion:
res = self.find_encrypt_d... |
java | public java.lang.String getNodeName() {
java.lang.Object ref = nodeName_;
if (ref instanceof java.lang.String) {
return (java.lang.String) ref;
} else {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
nodeNa... |
python | def plot_learning_curve(classifiers, train, test=None, increments=100, metric="percent_correct",
title="Learning curve", label_template="[#] @ $", key_loc="lower right",
outfile=None, wait=True):
"""
Plots a learning curve.
:param classifiers: list of Classif... |
python | def _ensure_field(self, key):
"""Ensure a non-array field"""
if self._has_field:
self._size += 2 # comma, space
self._has_field = True
self._size += len(key) + 4 |
python | def CRRAutility_inv(u, gam):
'''
Evaluates the inverse of the CRRA utility function (with risk aversion para-
meter gam) at a given utility level u.
Parameters
----------
u : float
Utility value
gam : float
Risk aversion
Returns
-------
(unnamed) : float
... |
python | def vcs_virtual_ipv6_address_ipv6address(self, **kwargs):
"""Auto Generated Code
"""
config = ET.Element("config")
vcs = ET.SubElement(config, "vcs", xmlns="urn:brocade.com:mgmt:brocade-vcs")
virtual = ET.SubElement(vcs, "virtual")
ipv6 = ET.SubElement(virtual, "ipv6")
... |
python | def create_box(self, orientation=Gtk.Orientation.HORIZONTAL, spacing=0):
"""
Function creates box. Based on orientation
it can be either HORIZONTAL or VERTICAL
"""
h_box = Gtk.Box(orientation=orientation, spacing=spacing)
h_box.set_homogeneous(False)
retur... |
python | def _division(divisor, dividend, remainder, base):
"""
Get the quotient and remainder
:param int divisor: the divisor
:param dividend: the divident
:type dividend: sequence of int
:param int remainder: initial remainder
:param int base: the base
:returns... |
java | protected Binder findBinderByPropertyName(Class parentObjectType, String propertyName) {
PropertyNameKey key = new PropertyNameKey(parentObjectType, propertyName);
Binder binder = (Binder)propertyNameBinders.get(key);
if (binder == null) {
// if no direct match was found try to find ... |
java | @Override
public void frameworkEvent(FrameworkEvent event) {
switch (event.getType()) {
case FrameworkEvent.ERROR:
status.addStartException(event.getBundle(), event.getThrowable());
break;
// Wake up the listener if a startlevel changed event occurs, ... |
java | public ServiceFuture<OperationStatus> deleteRegexEntityRoleAsync(UUID appId, String versionId, UUID entityId, UUID roleId, final ServiceCallback<OperationStatus> serviceCallback) {
return ServiceFuture.fromResponse(deleteRegexEntityRoleWithServiceResponseAsync(appId, versionId, entityId, roleId), serviceCallbac... |
python | def _upload_folder_in_background(self, folder_path, container, ignore,
upload_key, ttl=None):
"""Runs the folder upload in the background."""
uploader = FolderUploader(folder_path, container, ignore, upload_key,
self, ttl=ttl)
uploader.start() |
python | def SetHasherNames(self, hasher_names_string):
"""Sets the hashers that should be enabled.
Args:
hasher_names_string (str): comma separated names of hashers to enable.
"""
hasher_names = hashers_manager.HashersManager.GetHasherNamesFromString(
hasher_names_string)
debug_hasher_names ... |
java | @Override
public UnblockingAckMessage createUBA(int cic) {
UnblockingAckMessage msg = createUBA();
CircuitIdentificationCode code = this.parameterFactory.createCircuitIdentificationCode();
code.setCIC(cic);
msg.setCircuitIdentificationCode(code);
return msg;
} |
java | public static GeoShape fromJson(String json) {
try {
return JsonSerializer.fromString(json, GeoShape.class);
} catch (IOException e) {
throw new IllegalArgumentException("Unparseable shape");
}
} |
python | def randomString(size: int = 20) -> str:
"""
Generate a random string in hex of the specified size
DO NOT use python provided random class its a Pseudo Random Number Generator
and not secure enough for our needs
:param size: size of the random string to generate
:return: the hexadecimal random... |
python | def get_language_tabs(self):
"""
Determine the language tabs to show.
"""
current_language = self.get_current_language()
if self.object:
available_languages = list(self.object.get_available_languages())
else:
available_languages = []
retur... |
python | def _parse_player(self, index, attributes, postgame, game_type):
"""Parse a player."""
try:
voobly_user = voobly.user(self._voobly_session, attributes.player_name,
ladder_ids=VOOBLY_LADDERS.values())
voobly_ladder = '{} {}'.format(game_type, ... |
python | def pca(Y, input_dim):
"""
Principal component analysis: maximum likelihood solution by SVD
:param Y: NxD np.array of data
:param input_dim: int, dimension of projection
:rval X: - Nxinput_dim np.array of dimensionality reduced data
:rval W: - input_dimxD mapping from X to Y
"""
if n... |
java | public <T> T getSessionAttr(String key) {
HttpSession session = request.getSession(false);
return session != null ? (T)session.getAttribute(key) : null;
} |
java | public static int getYear(Date date) {
Calendar c = Calendar.getInstance();
c.setTime(date);
return c.get(Calendar.YEAR);
} |
python | def get_max_return(self, weights, returns):
"""
Maximizes the returns of a portfolio.
"""
def func(weights):
"""The objective function that maximizes returns."""
return np.dot(weights, returns.values) * -1
constraints = ({'type': 'eq', 'fun': lambda weig... |
python | def position_before(self, instr):
"""
Position immediately before the given instruction. The current block
is also changed to the instruction's basic block.
"""
self._block = instr.parent
self._anchor = self._block.instructions.index(instr) |
java | static String[] getUsable(final List<String> available, final String[] supported)
{
final List<String> filtered = new ArrayList<String>(available.size());
final List<String> supportedList = Arrays.asList(supported);
for (final String s : available)
{
if (supportedList.co... |
java | public void setThemes_event(int i, Event v) {
if (Event_Type.featOkTst && ((Event_Type)jcasType).casFeat_themes_event == null)
jcasType.jcas.throwFeatMissing("themes_event", "ch.epfl.bbp.uima.genia.Event");
jcasType.jcas.checkArrayBounds(jcasType.ll_cas.ll_getRefValue(addr, ((Event_Type)jcasType).casFeat... |
java | public OutlierResult run(Database database, Relation<O> relation) {
// Get a nearest neighbor query on the relation.
KNNQuery<O> knnq = QueryUtil.getKNNQuery(relation, getDistanceFunction(), k);
// Output data storage
WritableDoubleDataStore scores = DataStoreUtil.makeDoubleStorage(relation.getDBIDs(), ... |
java | public void overrideCacheConfig(Properties properties) {
if (properties != null) {
FieldInitializer.initFromSystemProperties(this, properties);
}
processOffloadDirectory();
if (!this.enableServletSupport) {
this.disableTemplatesSupport = true;
}
} |
python | def _populate_user(self):
"""
Populates our User object with information from the LDAP directory.
"""
self._populate_user_from_attributes()
self._populate_user_from_group_memberships()
self._populate_user_from_dn_regex()
self._populate_user_from_dn_regex_negation(... |
python | def make_initial_state(project, stack_length):
"""
:return: an initial state with a symbolic stack and good options for rop
"""
initial_state = project.factory.blank_state(
add_options={options.AVOID_MULTIVALUED_READS, options.AVOID_MULTIVALUED_WRITES,
... |
python | def patch():
"""
Patch startService and stopService so that they check the previous state
first.
(used for debugging only)
"""
from twisted.application.service import Service
old_startService = Service.startService
old_stopService = Service.stopService
def startService(self):
... |
java | public static CoreDictionary.Attribute guessAttribute(Term term)
{
CoreDictionary.Attribute attribute = CoreDictionary.get(term.word);
if (attribute == null)
{
attribute = CustomDictionary.get(term.word);
}
if (attribute == null)
{
if (term.nat... |
python | def reverse(viewname, urlconf=None, args=None, kwargs=None, current_app=None):
"""monkey patched reverse
path supports easy patching 3rd party urls
if 3rd party app has namespace for example ``catalogue`` and
you create FeinCMS plugin with same name as this namespace reverse
returns url from Applic... |
python | def Corr(poly, dist=None, **kws):
"""
Correlation matrix of a distribution or polynomial.
Args:
poly (Poly, Dist):
Input to take correlation on. Must have ``len(poly)>=2``.
dist (Dist):
Defines the space the correlation is taken on. It is ignored if
``po... |
python | def get_signature_request_list(self, page=1, ux_version=None):
''' Get a list of SignatureRequest that you can access
This includes SignatureRequests you have sent as well as received, but
not ones that you have been CCed on.
Args:
page (int, optional): Which page number... |
python | def yesterday(self, date_from=None, date_format=None):
"""
Retourne la date d'hier depuis maintenant ou depuis une date fournie
:param: :date_from date de référence
:return datetime
"""
# date d'hier
return self.delta(date_from=date_from, date_format=date_format, days=-1) |
java | private void reallocateBuffer(int newCapacity) {
byte[] newBuffer = new byte[newCapacity];
System.arraycopy(m_buffer, 0, newBuffer, 0, Math.min(m_size, newCapacity));
m_buffer = newBuffer;
} |
java | public void unregisterPrototype( String key, Class c )
{
prototypes.remove(new PrototypeKey(key, c));
} |
java | public void put(ContextPair... pairs) {
if (pairs != null) {
for (int i = 0; i < pairs.length; i++) {
ContextPair pair = pairs[i];
this.put(pair.getKey(), pair.getValue());
}
}
} |
python | def uint(self, length, name, value=None, align=None):
"""Add an unsigned integer to template.
`length` is given in bytes and `value` is optional. `align` can be used
to align the field to longer byte length.
Examples:
| uint | 2 | foo |
| uint | 2 | foo | 42 |
|... |
python | def create_keyvault(access_token, subscription_id, rgname, vault_name, location,
template_deployment=True, tenant_id=None, object_id=None):
'''Create a new key vault in the named resource group.
Args:
access_token (str): A valid Azure authentication token.
subscription_id (s... |
python | def readline(self, size=None):
"""Reads one line from the stream."""
if self._pos >= self.limit:
return self.on_exhausted()
if size is None:
size = self.limit - self._pos
else:
size = min(size, self.limit - self._pos)
try:
line = se... |
java | public void start()
throws Exception
{
_class=_httpHandler.getHttpContext().loadClass(_className);
if(log.isDebugEnabled())log.debug("Started holder of "+_class);
} |
java | private void writeChar(final char chr) throws IOException {
switch (chr) {
case '\t':
this.Tab();
break;
case '\n': {
this.out.write(this.lineSeparator);
this.lineNumber++;
this.prevMode = this.mode;
this.mode = MODE_START_LINE;
this.linePosition =... |
java | private int doPublish(boolean isControl, String deviceId, String topic, KuraPayload kuraPayload, int qos, boolean retain, int priority) throws KuraException {
String target = target(applicationId + ":" + topic);
int kuraMessageId = Math.abs(new Random().nextInt());
Map<String, Object> headers =... |
python | def _print_unique_links_with_status_codes(page_url, soup):
""" Finds all unique links in the html of the page source
and then prints out those links with their status codes.
Format: ["link" -> "status_code"] (per line)
Page links include those obtained from:
"a"->"href", "img"->"... |
python | def to_jsondict(self, encode_string=base64.b64encode):
"""
This method returns a JSON style dict to describe this object.
The returned dict is compatible with json.dumps() and json.loads().
Suppose ClassName object inherits StringifyMixin.
For an object like the following::
... |
java | public static String getMapGetterName(Field field) {
if (field.isMap()) {
return GETTER_PREFIX + Formatter.toPascalCase(field.getName()) + MAP_SUFFIX;
}
throw new IllegalArgumentException(field.toString());
} |
java | private synchronized void refreshTree() {
if (!isTreeRefreshRequired()) {
// The groupsTree was already re-built while
// we were waiting to enter this method.
return;
}
log.info("Refreshing groups tree for SmartLdap");
// We must join the builder t... |
python | def content(self, content):
"""
Overwrite Dockerfile with specified content
:param content: string to be written to Dockerfile
"""
if self.cache_content:
self.cached_content = b2u(content)
try:
with self._open_dockerfile('wb') as dockerfile:
... |
java | private void reportAvailableService(HttpServletRequest request, HttpServletResponse response) throws IOException {
PrintWriter writer = response.getWriter();
response.setContentType(HTML_CONTENT_TYPE);
writer.println("<h2>" + request.getServletPath() + "</h2>");
writer.println("<h3>Hello... |
java | public Matrix3x2d scaleAroundLocal(double sx, double sy, double sz, double ox, double oy, double oz) {
return scaleAroundLocal(sx, sy, ox, oy, this);
} |
java | public void setVisible(boolean visible)
{
if (isVisible() == visible)
return;
if (!fireEvent(new VisibleStateChange<>(this, visible)))
return;
this.visible = visible;
if (!visible)
{
this.setHovered(false);
this.setFocused(false);
}
return;
} |
java | public static int hash(MemorySegment[] segments, int offset, int numBytes) {
if (inFirstSegment(segments, offset, numBytes)) {
return MurmurHashUtil.hashBytes(segments[0], offset, numBytes);
} else {
return hashMultiSeg(segments, offset, numBytes);
}
} |
python | def str_func(name):
""" Apply functions like upper(), lower() and strip(). """
def func(mapping, bind, values):
for v in values:
if isinstance(v, six.string_types):
v = getattr(v, name)()
yield v
return func |
java | public List<CmsJspNavElement> getNavigationTreeForFolder(String folder, int startlevel, int endlevel) {
folder = CmsResource.getFolderPath(folder);
// Make sure start and end level make sense
if (endlevel < startlevel) {
return Collections.<CmsJspNavElement> emptyList();
}
... |
java | public Short getHeaderKey(String value) {
if (StringUtils.isNotEmpty(value) && headerCache != null) {
return headerCache.getKey(value);
}
return null;
} |
python | def _set_receive(self, v, load=False):
"""
Setter method for receive, mapped from YANG variable /routing_system/ipv6/receive (container)
If this variable is read-only (config: false) in the
source YANG file, then _set_receive is considered as a private
method. Backends looking to populate this varia... |
java | public final LangPreferences revealLangPreferences(
final IRequestData pRequestData, final List<Languages> pLangs,
final List<DecimalSeparator> pDecSeps,
final List<DecimalGroupSeparator> pDecGrSeps,
final List<LangPreferences> pLangPrefs,
final boolean pIsFirstReq) throws Except... |
java | public EClass getIfcFillAreaStyleHatching() {
if (ifcFillAreaStyleHatchingEClass == null) {
ifcFillAreaStyleHatchingEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI)
.getEClassifiers().get(235);
}
return ifcFillAreaStyleHatchingEClass;
} |
java | public <T extends View> boolean searchFor(Set<T> uniqueViews, Class<T> viewClass, final int index) {
ArrayList<T> allViews = RobotiumUtils.removeInvisibleViews(viewFetcher.getCurrentViews(viewClass, true));
int uniqueViewsFound = (getNumberOfUniqueViews(uniqueViews, allViews));
if(uniqueViewsFound > 0 && index ... |
java | @Override
public void toFile(File file, Engine engine) throws IOException {
if (engine.getInputVariables().isEmpty()) {
throw new RuntimeException("[exporter error] engine has no input variables to export the surface");
}
if (engine.getOutputVariables().isEmpty()) {
t... |
python | def random_point_triangle(triangle, use_int_coords=True):
"""
Selects a random point in interior of a triangle
"""
xs, ys = triangle.exterior.coords.xy
A, B, C = zip(xs[:-1], ys[:-1])
r1, r2 = np.random.rand(), np.random.rand()
rx, ry = (1 - sqrt(r1)) * np.asarray... |
java | public ConcurrentMap<String, L> getLoggersInContext(final LoggerContext context) {
ConcurrentMap<String, L> loggers;
lock.readLock ().lock ();
try {
loggers = registry.get (context);
} finally {
lock.readLock ().unlock ();
}
if (loggers != null) {... |
python | def list_cands(candsfile, threshold=0.):
""" Prints candidate info in time order above some threshold """
loc, prop, d0 = pc.read_candidates(candsfile, snrmin=threshold, returnstate=True)
if 'snr2' in d0['features']:
snrcol = d0['features'].index('snr2')
elif 'snr1' in d0['features']:
... |
python | def emit(self, action, event):
"""
Send a notification to clients scoped by projects
:param action: Action name
:param event: Event to send
"""
# If use in tests for documentation we save a sample
if os.environ.get("PYTEST_BUILD_DOCUMENTATION") == "1":
... |
python | def connect_to_rackspace(region,
access_key_id,
secret_access_key):
""" returns a connection object to Rackspace """
pyrax.set_setting('identity_type', 'rackspace')
pyrax.set_default_region(region)
pyrax.set_credentials(access_key_id, secret_access_key)... |
python | def _activate_inbound(self):
"""switch on newly negotiated encryption parameters for inbound traffic"""
block_size = self._cipher_info[self.remote_cipher]['block-size']
if self.server_mode:
IV_in = self._compute_key('A', block_size)
key_in = self._compute_key('C', self._c... |
python | def unzip(input_layer, split_dim=0, num_splits=2):
"""Unzips this Tensor along the split_dim into num_splits Equal chunks.
Examples:
* `[1, 2, 3, 4] -> [1, 3], [2, 4]`
* `[[1, 1], [2, 2], [3, 3], [4, 4]] -> [[1, 1], [3, 3]], [[2, 2], [4, 4]]`
Args:
input_layer: The chainable object, supplied.
split... |
java | public static CommercePriceList fetchByLtD_S_First(Date displayDate,
int status, OrderByComparator<CommercePriceList> orderByComparator) {
return getPersistence()
.fetchByLtD_S_First(displayDate, status, orderByComparator);
} |
java | @Deprecated
@SuppressWarnings("unchecked")
public void addInput(List<Operator<IN>> inputs) {
this.input = Operator.createUnionCascade(this.input, inputs.toArray(new Operator[inputs.size()]));
} |
python | def get_default_config(self):
"""
Returns the default collector settings
"""
config = super(PassengerCollector, self).get_default_config()
config.update({
"path": "passenger_stats",
"bin": "/usr/lib/ruby-flo/bin/passenger-memory-stats",
... |
python | def handle_lock_expired(
payment_state: InitiatorPaymentState,
state_change: ReceiveLockExpired,
channelidentifiers_to_channels: ChannelMap,
block_number: BlockNumber,
) -> TransitionResult[InitiatorPaymentState]:
"""Initiator also needs to handle LockExpired messages when refund tra... |
python | def junos_install_os(path=None, **kwargs):
'''
.. versionadded:: 2019.2.0
Installs the given image on the device.
path
The image file source. This argument supports the following URIs:
- Absolute path on the Minion.
- ``salt://`` to fetch from the Salt fileserver.
- ``... |
java | private void handle(SelectionKey key) {
// 有客户端接入此服务端
if (key.isAcceptable()) {
// 获取通道 转化为要处理的类型
final ServerSocketChannel server = (ServerSocketChannel) key.channel();
SocketChannel socketChannel;
try {
// 获取连接到此服务器的客户端通道
socketChannel = server.accept();
} catch (IOException e) {
... |
python | def hello(environ, start_response):
'''The WSGI_ application handler which returns an iterable
over the "Hello World!" message.'''
if environ['REQUEST_METHOD'] == 'GET':
data = b'Hello World!\n'
status = '200 OK'
response_headers = [
('Content-type', 'text/plain'),
... |
python | def get_kmgraph_meta(mapper_summary):
""" Extract info from mapper summary to be displayed below the graph plot
"""
d = mapper_summary["custom_meta"]
meta = (
"<b>N_cubes:</b> "
+ str(d["n_cubes"])
+ " <b>Perc_overlap:</b> "
+ str(d["perc_overlap"])
)
me... |
java | @Override
public Future fire(Object data) throws IOException {
reset();
socket.internalSocket().write(socket.request(), data);
return this;
} |
java | public SimpleOrderedMap<Object> createListOutput(boolean shardRequests, int maxNumber) {
garbageCollect();
SimpleOrderedMap<Object> output = new SimpleOrderedMap<>();
output.add(NAME_ENABLED, enabled());
output.add(NAME_ENABLED, true);
int numberTotal = data.size();
ListData listData = new ListD... |
java | public void decrementTargetIncomingTransitionCounts()
{
for(Entry<Character, MDAGNode> transitionKeyValuePair: outgoingTransitionTreeMap.entrySet())
transitionKeyValuePair.getValue().incomingTransitionCount--;
} |
java | static boolean isIllegalHoppingSpecified(List<NodeInfo> order) {
for (int i = 0; i < order.size(); i++) {
NodeInfo ni = (NodeInfo) order.get(i);
// look for move restricted nodes
if (!ni.getNode().getAttribute(Constants.ATT_MOVE_ALLOWED).equals("false")) continue;
... |
java | private CreateVpcResponseType createVpc(final String cidrBlock, final String instanceTenancy) {
CreateVpcResponseType ret = new CreateVpcResponseType();
ret.setRequestId(UUID.randomUUID().toString());
MockVpc mockVpc = mockVpcController.createVpc(cidrBlock, instanceTenancy);
VpcType vpc... |
java | public Footer getFooter() {
List<Footer> list = this.getDescendants(Footer.class);
if (list.size() > 0) {
return list.get(0);
} else {
return null;
}
} |
python | def load(path, variable='Datamat'):
"""
Load datamat at path.
Parameters:
path : string
Absolute path of the file to load from.
"""
f = h5py.File(path,'r')
try:
dm = fromhdf5(f[variable])
finally:
f.close()
return dm |
java | @Override
public GetKeyRotationStatusResult getKeyRotationStatus(GetKeyRotationStatusRequest request) {
request = beforeClientExecution(request);
return executeGetKeyRotationStatus(request);
} |
python | async def start(self):
"""Enter the transaction or savepoint block."""
self.__check_state_base('start')
if self._state is TransactionState.STARTED:
raise apg_errors.InterfaceError(
'cannot start; the transaction is already started')
con = self._connection
... |
python | def update_telemetry_configurations(self, configuration, timeout=-1):
"""
Updates the telemetry configuration of a logical interconnect. Changes to the telemetry configuration are
asynchronously applied to all managed interconnects.
Args:
configuration:
The t... |
java | public String replacePlaceholders(String value, final Properties properties) {
Assert.notNull(properties, "'properties' must not be null");
return replacePlaceholders(value, new PlaceholderResolver() {
@Override
public String resolvePlaceholder(String placeholderName) {
return properties.getProperty(place... |
java | @SuppressWarnings("Unchecked")
public static Object checkImmutable(String className, String fieldName, Object field) {
if (field == null || field instanceof Enum || inImmutableList(field.getClass().getName())) return field;
if (field instanceof Collection) return DefaultGroovyMethods.asImmutable((Co... |
python | def _start_reader_thread(self, stream, chunks):
"""Starts a thread for reading output from FFMPEG.
The thread reads consecutive chunks from the stream and saves them in
the given list.
Args:
stream: output stream of the FFMPEG process.
chunks: list to save output chunks to.
Returns:
... |
python | def create(
self,
name,
description="",
private=False,
runs_executable_tasks=True,
runs_docker_container_tasks=True,
runs_singularity_container_tasks=True,
active=True,
whitelists=None,
):
"""Create a task queue.
Args:
... |
java | public void setPos(Object p) {
Object[] a = (Object[]) p;
buf = (char[]) a[0];
int[] v = (int[]) a[1];
pos.setIndex(v[0]);
bufPos = v[1];
} |
java | public void setTopicSpaceUuid(SIBUuid12 topicSpace)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "setTopicSpaceUuid", topicSpace);
this.topicSpaceUuid = topicSpace;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
... |
python | def maybe_get_ax(*args, **kwargs):
"""
It used to be that the first argument of prettyplotlib had to be the 'ax'
object, but that's not the case anymore.
@param args:
@type args:
@param kwargs:
@type kwargs:
@return:
@rtype:
"""
if 'ax' in kwargs:
ax = kwargs.pop('a... |
python | def press(button=LEFT):
""" Sends a down event for the specified button, using the provided constants """
location = get_position()
button_code, button_down, _, _ = _button_mapping[button]
e = Quartz.CGEventCreateMouseEvent(
None,
button_down,
location,
button_code)
... |
python | def get_backend_choices(currency=None):
"""
Get active backends modules. Backend list can be filtered by
supporting given currency.
"""
choices = []
backends_names = getattr(settings, 'GETPAID_BACKENDS', [])
for backend_name in backends_names:
backend = import_module(backend_name)
... |
java | public OvhFirewallNetworkRule ip_firewall_ipOnFirewall_rule_sequence_GET(String ip, String ipOnFirewall, Long sequence) throws IOException {
String qPath = "/ip/{ip}/firewall/{ipOnFirewall}/rule/{sequence}";
StringBuilder sb = path(qPath, ip, ipOnFirewall, sequence);
String resp = exec(qPath, "GET", sb.toString()... |
python | def get_recipe_env(self, arch, with_flags_in_cc=True):
""" Add libgeos headers to path """
env = super(ShapelyRecipe, self).get_recipe_env(arch, with_flags_in_cc)
libgeos_dir = Recipe.get_recipe('libgeos', self.ctx).get_build_dir(arch.arch)
env['CFLAGS'] += " -I{}/dist/include".format(li... |
java | public boolean publish(String topicName, DefaultMessage message,boolean asynSend){
if(routeEnv != null)topicName = routeEnv + "." + topicName;
return producer.publish(topicName, message,asynSend);
} |
python | def isChar(ev):
""" Check if an event may be a typed character
"""
text = ev.text()
if len(text) != 1:
return False
if ev.modifiers() not in (Qt.ShiftModifier, Qt.KeypadModifier, Qt.NoModifier):
return False
asciiCode = ord(text)
if asciiCode <= 31 or asciiCode == 0x7f: # ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.