language
stringclasses
2 values
func_code_string
stringlengths
63
466k
python
def get_provisioned_table_read_units(table_name): """ Returns the number of provisioned read units for the table :type table_name: str :param table_name: Name of the DynamoDB table :returns: int -- Number of read units """ try: desc = DYNAMODB_CONNECTION.describe_table(table_name) e...
java
public List<CmsSitemapTreeNodeData> getChildren(CmsSitemapTreeNodeData nodeData) { CmsClientSitemapEntry entry = nodeData.getClientEntry(); List<CmsSitemapTreeNodeData> result = Lists.newArrayList(); try { CmsVfsSitemapService svc = getSitemapService(); CmsClientSitema...
java
public void marshall(BatchReadException batchReadException, ProtocolMarshaller protocolMarshaller) { if (batchReadException == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(batchReadException.getTyp...
java
public void setCommerceNotificationTemplateUserSegmentRelLocalService( com.liferay.commerce.notification.service.CommerceNotificationTemplateUserSegmentRelLocalService commerceNotificationTemplateUserSegmentRelLocalService) { this.commerceNotificationTemplateUserSegmentRelLocalService = commerceNotificationTemplate...
java
@Override public ListBonusPaymentsResult listBonusPayments(ListBonusPaymentsRequest request) { request = beforeClientExecution(request); return executeListBonusPayments(request); }
java
public static void main(String[] pArgs) throws IOException { if (pArgs.length == 1) { System.out.println(encode(pArgs[0].getBytes())); } else if (pArgs.length == 2 && ("-d".equals(pArgs[0]) || "--decode".equals(pArgs[0]))) { System.out.println(new String(d...
java
public static void checkStringNotNullOrEmpty(String parameterName, String value) { if (TextUtils.isEmpty(value)) { throw Exceptions.IllegalArgument("Current input string %s is %s.", parameterName, value == null ? "null" : "empty"); } }
python
def daylight_saving_end_day(self, value=None): """Corresponds to IDD Field `daylight_saving_end_day` Args: value (str): value for IDD Field `daylight_saving_end_day` if `value` is None it will not be checked against the specification and is assumed to be a mi...
python
def update(self, **values): """ Performs an update on the row selected by the queryset. Include values to update in the update like so: .. code-block:: python Model.objects(key=n).update(value='x') Passing in updates for columns which are not part of the model will...
java
@SuppressWarnings("unchecked") public static FieldSpec<XMLAnn>[] getXMLSpecs(Class<? extends Model> cls) { FieldSpec<XMLAnn>[] specs = XML_SPECS.get(cls); if (specs == null) { ArrayList<FieldSpec<XMLAnn>> list = new ArrayList<FieldSpec<XMLAnn>>(); for (Field field : getFieldHierarchy(cls)) { XMLAnn ann =...
python
def add_parser_from_field(self, name, field_cls): """Register a new parser method with name ``name``, given a marshmallow ``Field``.""" self.__parser_map__[name] = _field2method(field_cls, method_name=name)
java
public void getNewOptions(final String clientId, final I_CmsSimpleCallback<CmsDialogOptionsAndInfo> callback) { CmsRpcAction<CmsDialogOptionsAndInfo> action = new CmsRpcAction<CmsDialogOptionsAndInfo>() { @Override public void execute() { getContainerpageService().getN...
java
public final EObject entryRuleAbstractMetamodelDeclaration() throws RecognitionException { EObject current = null; EObject iv_ruleAbstractMetamodelDeclaration = null; try { // InternalXtext.g:343:69: (iv_ruleAbstractMetamodelDeclaration= ruleAbstractMetamodelDeclaration EOF ) ...
java
Stream<TreeNode> getFiltered(Stream<TreeNode> delegateNodes) { return delegateNodes .filter(delegateNode -> filter.acceptNode(this, delegateNode)) .map(delegateNode -> delegateToThis.get(delegateNode)) .filter(filteredNode -> filteredNode != null); }
python
def holtWintersConfidenceArea(requestContext, seriesList, delta=3): """ Performs a Holt-Winters forecast using the series as input data and plots the area between the upper and lower bands of the predicted forecast deviations. """ bands = holtWintersConfidenceBands(requestContext, seriesList, de...
python
def _get_mu_tensor(self): """Get the min mu which minimize the surrogate. Returns: The mu_t. """ root = self._get_cubic_root() dr = self._h_max / self._h_min mu = tf.maximum( root**2, ((tf.sqrt(dr) - 1) / (tf.sqrt(dr) + 1))**2) return mu
python
def group(*blueprints, url_prefix=""): """ Create a list of blueprints, optionally grouping them under a general URL prefix. :param blueprints: blueprints to be registered as a group :param url_prefix: URL route to be prepended to all sub-prefixes """ def chain(...
python
def pop(self, option, default=None): '''Just like `dict.pop`''' val = self[option] del self[option] return (val is None and default) or val
python
def tag_sites(self, scaled_positions, symprec=1e-3): """Returns an integer array of the same length as *scaled_positions*, tagging all equivalent atoms with the same index. Example: >>> from ase.lattice.spacegroup import Spacegroup >>> sg = Spacegroup(225) # fcc >>> s...
python
def _execute_example_group(self): "Handles the execution of Example Group" for example in self.example: runner = self.__class__(example, self.formatter) runner.is_root_runner = False successes, failures, skipped = runner.run(self.context) self.num_successe...
python
def item_names(self): """Item names.""" if "item_names" not in self.attrs.keys(): self.attrs["item_names"] = np.array([], dtype="S") return tuple(n.decode() for n in self.attrs["item_names"])
java
public void setSectionsAlwaysVisible(final boolean VISIBLE) { if (null == sectionsAlwaysVisible) { _sectionsAlwaysVisible = VISIBLE; fireUpdateEvent(REDRAW_EVENT); } else { sectionsAlwaysVisible.set(VISIBLE); } }
python
def lastOfferedMonth(self): ''' Sometimes a Series is associated with a month other than the one in which the first class begins, so this returns a (year,month) tuple that can be used in admin instead. ''' lastOfferedSeries = self.event_set.order_by('-startTime').first() ...
python
def export_certificate(ctx, slot, format, certificate): """ Export a X.509 certificate. Reads a certificate from one of the slots on the YubiKey. \b SLOT PIV slot to read certificate from. CERTIFICATE File to write certificate to. Use '-' to use stdout. """ controller = ctx.obj[...
python
def windows_k_distinct(x, k): """Find all largest windows containing exactly k distinct elements :param x: list or string :param k: positive integer :yields: largest intervals [i, j) with len(set(x[i:j])) == k :complexity: `O(|x|)` """ dist, i, j = 0, 0, 0 # dist = |{x[i], .....
python
def _gotitem(self, key, ndim, subset=None): """ Sub-classes to define. Return a sliced object. Parameters ---------- key : str / list of selections ndim : 1,2 requested ndim of result subset : object, default None subset to act on ...
python
def concatenate_children(node, concatenate_with, strategy): """ Concatenate children of node according to https://ocr-d.github.io/page#consistency-of-text-results-on-different-levels """ _, _, getter, concatenate_with = [x for x in _HIERARCHY if isinstance(node, x[0])][0] tokens = [get_text(x, strat...
python
def lowpass_fir(self, frequency, order, beta=5.0, remove_corrupted=True): """ Lowpass filter the time series using an FIR filtered generated from the ideal response passed through a kaiser window (beta = 5.0) Parameters ---------- Time Series: TimeSeries The time ser...
java
@Override public void visitClassContext(ClassContext classContext) { try { javaClass = classContext.getJavaClass(); if (javaClass.getMajor() >= Const.MAJOR_1_5) { javaClass.accept(this); } } finally { javaClass = null; } }
python
def add(cls, module_name, msg=''): ''' Until the guard is dropped again, disallow imports of the module given by ``module_name``. If the module is imported while the guard is in place an ``ImportGuard`` is raised. An additional message on why the module cannot be importe...
python
def triggerItem(self, item): """ Triggers the item by calling its action's toggled state to display or hide the dock panel. :param item | <QtGui.QTreeWidgetItem> """ if not item: return # emit the trigger action ...
java
private ParseTree parseStatementStandard() { switch (peekType()) { case OPEN_CURLY: return parseBlock(); case CONST: case VAR: return parseVariableStatement(); case SEMI_COLON: return parseEmptyStatement(); case IF: return parseIfStatement(); case DO: return par...
java
@Override public void tick(long now) { if (now - this.lastM3UAMessageTime >= this.aspFactoryImpl.m3UAManagementImpl.getHeartbeatTime()) { this.lastM3UAMessageTime = now; this.heartBeatAckMissed++; this.aspFactoryImpl.write(HEART_BEAT); } if (this.heartBe...
java
private static String getPluralCaseOpenString(SoyMsgPluralCaseSpec pluralCaseSpec) { String icuCaseName = (pluralCaseSpec.getType() == SoyMsgPluralCaseSpec.Type.EXPLICIT) ? "=" + pluralCaseSpec.getExplicitValue() : pluralCaseSpec.getType().name().toLowerCase(); return icuCaseName...
python
def cli(ctx, ids, query, filters, details, interval): """Watch for new alerts.""" if details: display = 'details' else: display = 'compact' from_date = None auto_refresh = True while auto_refresh: try: auto_refresh, from_date = ctx.invoke(query_cmd, ids=ids, ...
java
public boolean markMigrated(VectorClock vectorClock) { stateWriteLock.lock(); try { if (stateVectorClock.equals(vectorClock)) { migrated = true; } return migrated; } finally { stateWriteLock.unlock(); } }
java
public void updateBigDecimal(String columnLabel, BigDecimal value) throws SQLException { updateBigDecimal(findColumn(columnLabel), value); }
python
def num(self, num, h=None, to_x=None, format="%.2f", change_style=None, change_size=None): """print number (int/float) right aligned before defined (to_x) position """ self.txt(format % num, h=h, to_x=to_x, change_style=change_style, change_size=change_size)
java
@Override public String parse(final String threshold, final RangeConfig tc) throws RangeException { if (threshold == null) { throw new RangeException("Range can't be null"); } Stage currentStage = this; String parsedThreshold = threshold; boolean stageParsed; ...
python
def _check_enclosing_characters(string, opener, closer): """ Makes sure that the enclosing characters for a definition set make sense 1) There is only one set 2) They are in the right order (opening, then closing) """ opener_count = string.count(opener) closer_count = string.count(closer) ...
java
public void onDoubleClick(DoubleClickEvent event) { tempLength = 0; mapWidget.unregisterWorldPaintable(distanceLine); mapWidget.unregisterWorldPaintable(lineSegment); distanceLine.setGeometry(null); lineSegment.setGeometry(null); if (panel != null) { panel.destroy(); } dispatchState(State.STOP); }
python
def connect(url=None, schema=None, sql_path=None, multiprocessing=False): """Open a new connection to postgres via psycopg2/sqlalchemy """ if url is None: url = os.environ.get("DATABASE_URL") return Database(url, schema, sql_path=sql_path, multiprocessing=multiprocessing)
python
def q_scan(data, mismatch=DEFAULT_MISMATCH, qrange=DEFAULT_QRANGE, frange=DEFAULT_FRANGE, duration=None, sampling=None, **kwargs): """Transform data by scanning over a `QTiling` This utility is provided mainly to allow direct manipulation of the `QTiling.transform` output. Most users ...
java
@Override public List<GoogleCloudStorageItemInfo> listObjectInfo( String bucketName, String objectNamePrefix, String delimiter, long maxResults) throws IOException { List<GoogleCloudStorageItemInfo> result; if (options.isListCachingEnabled()) { result = cache.getList(bucketName, objectNameP...
java
boolean scanSpecialIdentifier(String identifier) { int length = identifier.length(); if (limit - currentPosition < length) { return false; } for (int i = 0; i < length; i++) { int character = identifier.charAt(i); if (character == sqlString.charAt(...
java
public void start() throws Throwable { Context context = new InitialContext(); context.bind(JNDI_NAME, this); context.close(); }
java
public SslContextBuilder trustManager(InputStream trustCertCollectionInputStream) { try { return trustManager(SslContext.toX509Certificates(trustCertCollectionInputStream)); } catch (Exception e) { throw new IllegalArgumentException("Input stream does not contain valid certificat...
python
def _set_fe_access_check(self, v, load=False): """ Setter method for fe_access_check, mapped from YANG variable /sysmon/fe_access_check (container) If this variable is read-only (config: false) in the source YANG file, then _set_fe_access_check is considered as a private method. Backends looking to ...
python
def _get_default_dependencies(self): ''' Get default dependencies for archive Get default dependencies from requirements file or (if no requirements file) from previous version ''' # Get default dependencies from requirements file default_dependencies = { ...
java
public final ListCryptoKeyVersionsPagedResponse listCryptoKeyVersions(CryptoKeyName parent) { ListCryptoKeyVersionsRequest request = ListCryptoKeyVersionsRequest.newBuilder() .setParent(parent == null ? null : parent.toString()) .build(); return listCryptoKeyVersions(request); ...
python
def construct_datapipeline(env='', generated=None, previous_env=None, region='us-east-1', settings=None, pipeline_data=None): """Create the Pipeline JSON from template. This ha...
java
private void processTasks() throws SQLException { List<Row> bars = getTable("BAR"); List<Row> expandedTasks = getTable("EXPANDED_TASK"); List<Row> tasks = getTable("TASK"); List<Row> milestones = getTable("MILESTONE"); m_reader.processTasks(bars, expandedTasks, tasks, milestones); }
java
private TokenResponse executeLeniently() throws IOException { // must set clientAuthentication as last execute interceptor in case it // needs to sign request HttpRequestFactory requestFactory = getTransport().createRequestFactory(new HttpRequestInitializer() { ...
python
def get_validate_upload_form_kwargs(self): """ Return the keyword arguments for instantiating the form for validating the upload. """ kwargs = { 'storage': self.get_storage(), 'upload_to': self.get_upload_to(), 'content_type_prefix': self.get...
java
@Override public void renderTemplate(final String templateName, final Map<String, Object> context, final Map<String, WComponent> taggedComponents, final Writer writer, final Map<String, Object> options) { LOG.debug("Rendering handlebars template " + templateName); try { // Map the tagged components to be ...
python
def _newer_tags_get(current_highest, versions): """ Returns versions from versions which are greater than than the highest version in each major. If a newer major is present in versions which is not present on current_highest, an exception will be raised. @param current_highest: as returned by Versi...
python
def dcounts(self): """ :return: a data frame with names and distinct counts and fractions for all columns in the database """ print("WARNING: Distinct value count for all tables can take a long time...", file=sys.stderr) sys.stderr.flush() data = [] for t in self...
python
def get_reference_lines(docbody, ref_sect_start_line, ref_sect_end_line, ref_sect_title, ref_line_marker_ptn, title_marker_same_line): """After the reference section of a document has been identif...
python
def CutAtClosestPoint(self, p): """ Let x be the point on the polyline closest to p. Then CutAtClosestPoint returns two new polylines, one representing the polyline from the beginning up to x, and one representing x onwards to the end of the polyline. x is the first point returned in the secon...
python
def show_in_menus_custom(self, request=None, current_site=None, menu_instance=None, original_menu_tag=''): """ Return a boolean indicating whether this page should be included in menus being rendered. """ if not self.show_in_menus: return ...
python
def save(self, path=None, format=None, mode=None, partitionBy=None, **options): """Saves the contents of the :class:`DataFrame` to a data source. The data source is specified by the ``format`` and a set of ``options``. If ``format`` is not specified, the default data source configured by ...
java
@Override public MonitorInstancesResult monitorInstances(MonitorInstancesRequest request) { request = beforeClientExecution(request); return executeMonitorInstances(request); }
java
private void scanEntityMappings() throws PersistenceUnitScannerException { /* * From the JPA 2.1 Specification: * * 8.2.1.6.2 Object/relational Mapping Files * An object/relational mapping XML file contains mapping information for the classes listed in it. * ...
java
public void init(Record record, ScreenLocation itsLocation, BasePanel parentScreen, Converter fieldConverter, int iDisplayFieldDesc, Map<String, Object> properties) { this.setAppending(true); // By default super.init(record, itsLocation, parentScreen, fieldConverter, iDisplayFieldDesc, propertie...
python
def _rapRperiAxiEq(R,E,L,pot): """The vr=0 equation that needs to be solved to find apo- and pericenter""" return E-potentialAxi(R,pot)-L**2./2./R**2.
java
@Override public void init() throws ServletException { super.init(); // GET operations.setOperation(ServletOperationSet.Method.GET, Extension.json, Operation.accessPolicies, new GetAccessPolicies()); operations.setOperation(ServletOperationSet.Method.GET, Extension.j...
java
boolean attachmentsAreStructurallyDifferent( List<AttachmentModel> firstAttachments, List<AttachmentModel> otherAttachments ) { if( firstAttachments.size() != otherAttachments.size() ) { return true; } for( int i = 0; i < firstAttachments.size(); i++ ) { if( attachmentIs...
java
public String getPlainTextContext(int fromPos, int toPos, String contents) { String text = contents.replace('\n', ' ').replace('\r', ' ').replace('\t', ' '); // calculate context region: int startContent = fromPos - contextSize; String prefix = "..."; String postfix = "..."; String markerPrefix ...
python
def createExpenseItemsForVenueRental(request=None, datetimeTuple=None, rule=None, event=None): ''' For each Location or Room-related Repeated Expense Rule, look for Events in the designated time window that do not already have expenses associated with them. For hourly rental expenses, then generate...
python
def get_rectangle(self): """Gets the coordinates of the rectangle, in which the tree can be put. Returns: tupel: (x1, y1, x2, y2) """ rec = [self.pos[0], self.pos[1]]*2 for age in self.nodes: for node in age: # Check max/min for x/y coords...
python
def retrieve(self, id) : """ Retrieve a single reason Returns a single loss reason available to the user by the provided id If a loss reason with the supplied unique identifier does not exist, it returns an error :calls: ``get /loss_reasons/{id}`` :param int id: Unique ...
python
def _get_random_fp_raw(): ''' 生成随机的原始指纹列表 ''' fp_list = [] fp_list.append(get_random_ua()) # ua fp_list.append('zh-CN') # language fp_list.append('24') # color depth fp_list.append(__get_random_screen_resolution()) fp_list.append('-480') # time zone offsite fp_list.append...
python
def _ParseInsserv(self, data): """/etc/insserv.conf* entries define system facilities. Full format details are in man 8 insserv, but the basic structure is: $variable facility1 facility2 $second_variable facility3 $variable Any init script that specifies Required-Start: $second_vari...
python
def get_rfu(): """ Returns a list of al "regular file urls" for all plugins. """ global _rfu if _rfu: return _rfu plugins = plugins_base_get() rfu = [] for plugin in plugins: if isinstance(plugin.regular_file_url, str): rfu.append(plugin.regular_file_url) ...
python
def FetchRequestsAndResponses(self, session_id, timestamp=None): """Fetches all outstanding requests and responses for this flow. We first cache all requests and responses for this flow in memory to prevent round trips. Args: session_id: The session_id to get the requests/responses for. ti...
java
private Buffer consumeUntil(final Buffer name) { try { while (this.params.hasReadableBytes()) { SipParser.consumeSEMI(this.params); final Buffer[] keyValue = SipParser.consumeGenericParam(this.params); ensureParamsMap(); final Buffer va...
java
public static <T> T max(Collection<? extends T> coll, Comparator<? super T> comp) { return Collections.max(coll, comp); }
python
def export(self, path, epoch=0): """Export HybridBlock to json format that can be loaded by `SymbolBlock.imports`, `mxnet.mod.Module` or the C++ interface. .. note:: When there are only one input, it will have name `data`. When there Are more than one inputs, they will be name...
java
public FacesMessage getFacesMessage() { FacesMessage result = this.message; if (null == result && null != this.messages && !this.messages.isEmpty()) { result = messages.iterator().next(); } return result; }
python
def new(self, array): """ Convert an array of compatible length into a DictArray: >>> d = DictArray({'PGA': [0.01, 0.02, 0.04], 'PGV': [0.1, 0.2]}) >>> d.new(numpy.arange(0, 5, 1)) # array of lenght 5 = 3 + 2 <DictArray PGA: [0 1 2] PGV: [3 4]> """ ...
java
private void read(int bit , int row , int col ) { int value = gridReader.readBit(row,col); if( value == -1 ) { // The requested region is outside the image. A partial QR code can be read so let's just // assign it a value of zero and let error correction handle this value = 0; } bits.set(bit,value); }
java
public static void doFile(File f) throws Exception { // If this is a directory, walk each file/dir in that directory if (f.isDirectory()) { String files[] = f.list(); for(int i=0; i < files.length; i++) doFile(new File(f, files[i])); ...
java
public void setXCSizeD(Integer newXCSizeD) { Integer oldXCSizeD = xcSizeD; xcSizeD = newXCSizeD; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, AfplibPackage.IID__XC_SIZE_D, oldXCSizeD, xcSizeD)); }
python
async def _request( self, method: str, endpoint: str, *, headers: dict = None, params: dict = None, json: dict = None, ssl: bool = True) -> dict: """Wrap the generic request method to add access token, etc.""" ...
java
public String convertIfcSanitaryTerminalTypeEnumToString(EDataType eDataType, Object instanceValue) { return instanceValue == null ? null : instanceValue.toString(); }
python
def readStoredSms(self, index, memory=None): """ Reads and returns the SMS message at the specified index :param index: The index of the SMS message in the specified memory :type index: int :param memory: The memory type to read from. If None, use the current default SMS read me...
java
public void setColumnClassName(final String columnClassName) throws ClassNotFoundException { if (columnClassName.equals("byte[]")) { setColumnClass(Object.class); } else { setColumnClass(Class.forName(columnClassName)); } this.columnClassName = columnClassName; }
java
public void handleConnect(HttpServletRequest request, HttpServletResponse response) throws IOException { String uri = request.getRequestURI(); context.log("CONNECT: "+uri); InetAddrPort addrPort=new InetAddrPort(uri); /...
python
def root_and_children_to_graph(self,root): """Take a root node and its children and make them into graphs""" g = Graph() g.add_node(root) edges = [] edges += self.get_node_edges(root,"outgoing") for c in self.get_children(root): g.add_node(c) edges += self.get_node_ed...
python
def summarize(self, geom, stat=None): """Returns a new RasterQuerySet with subsetted/summarized ndarrays. Arguments: geom -- geometry for masking or spatial subsetting Keyword args: stat -- any numpy summary stat method as str (min/max/mean/etc) """ if not hasatt...
java
public static String replaceNorwegianLetters(CharSequence text) { Pattern norwegianLettersPattern = Pattern.compile("\u00F8|\u00D8|\u00E6|\u00C6|\u00E5|\u00C5"); Matcher norwegianLetterMatcher = norwegianLettersPattern.matcher(text); StringBuffer replacedText = new StringBuffer(); while (norwegianLetterMatc...
java
public static <T> QueueFactory<T> boundedNonBlockingQueue(final int queueSize, final WaitStrategy<T> strategy) { return () -> new Queue<T>( new ManyToOneConcurrentArrayQueue<>( queueSize), ...
python
def create_tcp_monitor(self, topics, batch_size=1, batch_duration=0, compression='gzip', format_type='json'): """Creates a TCP Monitor instance in Device Cloud for a given list of topics :param topics: a string list of topics (e.g. ['DeviceCore[U]', 'FileDat...
python
def _build_url(url, _params): """Build the actual URL to use.""" # Support for unicode domain names and paths. scheme, netloc, path, params, query, fragment = urlparse(url) netloc = netloc.encode('idna').decode('utf-8') if not path: path = '/' if six.PY2: if isinstance(scheme, ...
java
protected final Table createBlankTable(HsqlName name) { Table table = new Table(database, name, TableBase.SYSTEM_TABLE); return table; }
java
public static ZoneTransferIn newAXFR(Name zone, String host, int port, TSIG key) throws UnknownHostException { if (port == 0) port = SimpleResolver.DEFAULT_PORT; return newAXFR(zone, new InetSocketAddress(host, port), key); }
java
private void handleStorageException( final StorageException exs, final CloudStorageRetryHandler retryHandler) throws IOException { boolean shouldReopen = retryHandler.handleStorageException(exs); if (shouldReopen) { // these errors aren't marked as retryable since the channel is closed; // but...
java
private RelationType getRelationType(int value) { RelationType result = null; if (value >= 0 || value < RELATION_TYPES.length) { result = RELATION_TYPES[value]; } if (result == null) { result = RelationType.FINISH_START; } return result; }
java
private void updateFederatedManagerService() { if (!activated) { return; } if (profileManager.getReference() != null) { Tr.info(tc, "FEDERATED_MANAGER_SERVICE_READY"); } else { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { ...
python
def get_common_name(self): ''' Get a flower's common name ''' name = random.choice(self.common_first) if random.randint(0, 1) == 1: name += ' ' + random.choice(self.common_first).lower() name += ' ' + random.choice(self.common_second).lower() return name