answer
stringlengths
15
1.25M
/*! @file asfvideo.hpp @brief An Image subclass to support ASF video files @version $Rev$ @author Abhinav Badola for GSoC 2012 <a href="mailto:mail.abu.to@gmail.com">mail.abu.to@gmail.com</a> @date 08-Aug-12, AB: created */ #ifndef ASFVIDEO_HPP #define ASFVIDEO_HPP // included header files #include "exif.hpp" #include "image.hpp" #include "tags_int.hpp" // namespace extensions using namespace Exiv2::Internal; namespace Exiv2 { // class definitions // Add ASF to the supported image formats namespace ImageType { const int asf = 24; //!< Treating asf as an image type> } /*! @brief Class to access ASF video files. */ class EXIV2API AsfVideo:public Image { public: //! @name Creators /*! @brief Constructor for a ASF video. Since the constructor can not return a result, callers should check the good() method after object construction to determine success or failure. @param io An auto-pointer that owns a BasicIo instance used for reading and writing image metadata. \b Important: The constructor takes ownership of the passed in BasicIo instance through the auto-pointer. Callers should not continue to use the BasicIo instance after it is passed to this method. Use the Image::io() method to get a temporary reference. */ AsfVideo(BasicIo::AutoPtr io); //! @name Manipulators void readMetadata(); void writeMetadata(); //! @name Accessors std::string mimeType() const; protected: /*! @brief Check for a valid tag and decode the block at the current IO position. Calls tagDecoder() or skips to next tag, if required. */ void decodeBlock(); /*! @brief Interpret tag information, and call the respective function to save it in the respective XMP container. Decodes a Tag Information and saves it in the respective XMP container, if the block size is small. @param tv Pointer to current tag, @param size Size of the data block used to store Tag Information. */ void tagDecoder(const TagVocabulary* tv, uint64_t size); /*! @brief Interpret File_Properties tag information, and save it in the respective XMP container. */ void fileProperties(); /*! @brief Interpret Stream_Properties tag information, and save it in the respective XMP container. */ void streamProperties(); /*! @brief Interpret Codec_List tag information, and save it in the respective XMP container. */ void codecList(); /*! @brief Interpret Content_Description tag information, and save it in the respective XMP container. @param size Size of the data block used to store Tag Data. */ void contentDescription(uint64_t size); /*! @brief Interpret <API key> tag information, and save it in the respective XMP container. @param size Size of the data block used to store Tag Data. */ void <API key>(uint64_t size); /*! @brief Interpret Header_Extension tag information, and save it in the respective XMP container. @param size Size of the data block used to store Tag Data. */ void headerExtension(uint64_t size); /*! @brief Interpret Metadata, <API key>, Metadata_Library tag information, and save it in the respective XMP container. @param meta A default integer which helps to overload the function for various Tags that have a similar method of decoding. */ void metadataHandler(int meta = 1); /*! @brief Calculates Aspect Ratio of a video, and stores it in the respective XMP container. */ void aspectRatio(); private: //! @name NOT Implemented //! Copy constructor AsfVideo(const AsfVideo& rhs); //! Assignment operator AsfVideo& operator=(const AsfVideo& rhs); private: //! Variable to check the end of metadata traversing. bool continueTraversing_; //! Variable which stores current position of the read pointer. uint64_t localPosition_; //! Variable which stores current stream being processsed. int streamNumber_; //! Variable to store height and width of a video frame. uint64_t height_, width_; }; //Class AsfVideo // template, inline and free functions // These could be static private functions on Image subclasses but then // ImageFactory needs to be made a friend. /*! @brief Create a new AsfVideo instance and return an auto-pointer to it. Caller owns the returned object and the auto-pointer ensures that it will be deleted. */ EXIV2API Image::AutoPtr newAsfInstance(BasicIo::AutoPtr io, bool create); //! Check if the file iIo is a Windows Asf Video. EXIV2API bool isAsfType(BasicIo& iIo, bool advance); } // namespace Exiv2 #endif // #ifndef ASFVIDEO_HPP_
""" Tools and data structures for working with genomic intervals (or sets of regions on a line in general) efficiently. """ # For compatiblity with existing stuff from bx.intervals.intersection import *
# -*- coding: utf-8 -*- from ..internal.DeadCrypter import DeadCrypter class Movie2KTo(DeadCrypter): __name__ = "Movie2KTo" __type__ = "crypter" __version__ = "0.56" __status__ = "stable" __pattern__ = r'http://(?:www\.)?movie2k\.to/(.+)\.html' __config__ = [("activated", "bool", "Activated", True)] __description__ = """Movie2k.to decrypter plugin""" __license__ = "GPLv3" __authors__ = [("4Christopher", "4Christopher@gmx.de")]
<?php namespace Mautic\EmailBundle\EventListener; use Mautic\ConfigBundle\ConfigEvents; use Mautic\ConfigBundle\Event\ConfigEvent; use Mautic\ConfigBundle\Event\ConfigBuilderEvent; use Mautic\CoreBundle\EventListener\CommonSubscriber; /** * Class ConfigSubscriber * * @package Mautic\CoreBundle\EventListener */ class ConfigSubscriber extends CommonSubscriber { /** * @return array */ static public function getSubscribedEvents() { return array( ConfigEvents::CONFIG_ON_GENERATE => array('onConfigGenerate', 0), ConfigEvents::CONFIG_PRE_SAVE => array('onConfigBeforeSave', 0) ); } public function onConfigGenerate(ConfigBuilderEvent $event) { $event->addForm(array( 'bundle' => 'EmailBundle', 'formAlias' => 'emailconfig', 'formTheme' => 'MauticEmailBundle:FormTheme\Config', 'parameters' => $event-><API key>('MauticEmailBundle') )); } public function onConfigBeforeSave(ConfigEvent $event) { $event->unsetIfEmpty( array( 'mailer_password' ) ); $data = $event->getConfig('emailconfig'); // Get the original data so that passwords aren't lost $monitoredEmail = $this->factory->getParameter('monitored_email'); if (isset($data['monitored_email'])) { foreach ($data['monitored_email'] as $key => $monitor) { if (empty($monitor['password']) && !empty($monitoredEmail[$key]['password'])) { $data['monitored_email'][$key]['password'] = $monitoredEmail[$key]['password']; } if ($key != 'general') { if (empty($monitor['host']) || empty($monitor['address']) || empty($monitor['folder'])) { $data['monitored_email'][$key]['override_settings'] = ''; $data['monitored_email'][$key]['address'] = ''; $data['monitored_email'][$key]['host'] = ''; $data['monitored_email'][$key]['user'] = ''; $data['monitored_email'][$key]['password'] = ''; $data['monitored_email'][$key]['ssl'] = '1'; $data['monitored_email'][$key]['port'] = '993'; } } } } // Ensure that percent signs are decoded in the unsubscribe/webview settings $decode = array( 'unsubscribe_text', 'webview_text', 'unsubscribe_message', 'resubscribe_message' ); foreach ($decode as $key) { if (strpos($data[$key], '%') !== false) { $data[$key] = urldecode($data[$key]); if (preg_match_all('/([^%]|^)(%{1}[^%]\S+[^%]%{1})([^%]|$)/i', $data[$key], $matches)) { // Encode any left over to prevent Symfony from crashing foreach ($matches[0] as $matchKey => $match) { $replaceWith = $matches[1][$matchKey].'%'.$matches[2][$matchKey].'%'.$matches[3][$matchKey]; $data[$key] = str_replace($match, $replaceWith, $data[$key]); } } } } $event->setConfig($data, 'emailconfig'); } }
#ifndef GNUPG_KEYDB_H #define GNUPG_KEYDB_H #include <ksba.h> #include "../kbx/keybox-search-desc.h" typedef struct keydb_handle *KEYDB_HANDLE; /* Flag value used with <API key>. */ #define VALIDITY_REVOKED (1<<5) /*-- keydb.c --*/ int keydb_add_resource (const char *url, int force, int secret, int *auto_created); KEYDB_HANDLE keydb_new (int secret); void keydb_release (KEYDB_HANDLE hd); int keydb_set_ephemeral (KEYDB_HANDLE hd, int yes); const char *<API key> (KEYDB_HANDLE hd); gpg_error_t keydb_lock (KEYDB_HANDLE hd); #if 0 /* pgp stuff */ int keydb_get_keyblock (KEYDB_HANDLE hd, KBNODE *ret_kb); int <API key> (KEYDB_HANDLE hd, KBNODE kb); int <API key> (KEYDB_HANDLE hd, KBNODE kb); #endif gpg_error_t keydb_get_flags (KEYDB_HANDLE hd, int which, int idx, unsigned int *value); gpg_error_t keydb_set_flags (KEYDB_HANDLE hd, int which, int idx, unsigned int value); int keydb_get_cert (KEYDB_HANDLE hd, ksba_cert_t *r_cert); int keydb_insert_cert (KEYDB_HANDLE hd, ksba_cert_t cert); int keydb_update_cert (KEYDB_HANDLE hd, ksba_cert_t cert); int keydb_delete (KEYDB_HANDLE hd, int unlock); int <API key> (KEYDB_HANDLE hd, const char *reserved); void <API key> (void); int keydb_search_reset (KEYDB_HANDLE hd); int keydb_search (KEYDB_HANDLE hd, KEYDB_SEARCH_DESC *desc, size_t ndesc); int keydb_search_first (KEYDB_HANDLE hd); int keydb_search_next (KEYDB_HANDLE hd); int keydb_search_kid (KEYDB_HANDLE hd, u32 *kid); int keydb_search_fpr (KEYDB_HANDLE hd, const byte *fpr); int keydb_search_issuer (KEYDB_HANDLE hd, const char *issuer); int <API key> (KEYDB_HANDLE hd, const char *issuer, const unsigned char *serial); int <API key> (KEYDB_HANDLE hd, const char *issuer); int keydb_classify_name (const char *name, KEYDB_SEARCH_DESC *desc); int keydb_store_cert (ksba_cert_t cert, int ephemeral, int *existed); gpg_error_t <API key> (ksba_cert_t cert, int ephemeral, int which, int idx, unsigned int mask, unsigned int value); void <API key> (ctrl_t ctrl, strlist_t names); #endif /*GNUPG_KEYDB_H*/
/* refchg.f -- translated by f2c (version 19980913). You must link the resulting object file with the libraries: -lf2c -lm (in that order) */ #include "f2c.h" /* Table of constant values */ static integer c__2 = 2; /* $Procedure REFCHG (Reference frame Change) */ /* Subroutine */ int refchg_(integer *frame1, integer *frame2, doublereal *et, doublereal *rotate) { /* System generated locals */ integer i__1, i__2, i__3, i__4, i__5, i__6, i__7; /* Builtin functions */ integer s_rnge(char *, integer, char *, integer); /* Local variables */ integer node; logical done; integer cent, this__; extern /* Subroutine */ int zznofcon_(doublereal *, integer *, integer *, integer *, integer *, char *, ftnlen); integer i__, j, frame[10]; extern /* Subroutine */ int chkin_(char *, ftnlen), ident_(doublereal *); integer class__; logical found; integer relto; extern /* Subroutine */ int xpose_(doublereal *, doublereal *), zzrxr_( doublereal *, integer *, doublereal *); extern logical failed_(void); integer cmnode; extern integer isrchi_(integer *, integer *, integer *); integer clssid; extern /* Subroutine */ int frinfo_(integer *, integer *, integer *, integer *, logical *); logical gotone; char errmsg[1840]; extern /* Subroutine */ int chkout_(char *, ftnlen), setmsg_(char *, ftnlen), errint_(char *, integer *, ftnlen), sigerr_(char *, ftnlen), rotget_(integer *, doublereal *, doublereal *, integer *, logical *); extern logical return_(void); doublereal tmprot[9] /* was [3][3] */; integer inc, get; doublereal rot[126] /* was [3][3][14] */; integer put; doublereal rot2[18] /* was [3][3][2] */; /* $ Abstract */ /* Return the transformation matrix from one */ /* frame to another. */ /* CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. */ /* GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE */ /* ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE */ /* PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" */ /* WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A */ /* PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC */ /* SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE */ /* SOFTWARE AND RELATED MATERIALS, HOWEVER USED. */ /* IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA */ /* BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT */ /* LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, */ /* INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, */ /* REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE */ /* REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. */ /* RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF */ /* THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY */ /* CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE */ /* ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. */ /* $ Required_Reading */ /* None. */ /* $ Keywords */ /* FRAMES */ /* $ Declarations */ /* CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. */ /* GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE */ /* ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE */ /* PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" */ /* WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A */ /* PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC */ /* SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE */ /* SOFTWARE AND RELATED MATERIALS, HOWEVER USED. */ /* IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA */ /* BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT */ /* LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, */ /* INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, */ /* REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE */ /* REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. */ /* RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF */ /* THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY */ /* CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE */ /* ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. */ /* Include File: SPICELIB Error Handling Parameters */ /* errhnd.inc Version 2 18-JUN-1997 (WLT) */ /* The size of the long error message was */ /* reduced from 25*80 to 23*80 so that it */ /* will be accepted by the Microsoft Power Station */ /* FORTRAN compiler which has an upper bound */ /* of 1900 for the length of a character string. */ /* errhnd.inc Version 1 29-JUL-1997 (NJB) */ /* Maximum length of the long error message: */ /* Maximum length of the short error message: */ /* End Include File: SPICELIB Error Handling Parameters */ /* $ Abstract */ /* The parameters below form an enumerated list of the recognized */ /* frame types. They are: INERTL, PCK, CK, TK, DYN. The meanings */ /* are outlined below. */ /* CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. */ /* GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE */ /* ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE */ /* PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" */ /* WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A */ /* PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC */ /* SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE */ /* SOFTWARE AND RELATED MATERIALS, HOWEVER USED. */ /* IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA */ /* BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT */ /* LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, */ /* INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, */ /* REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE */ /* REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. */ /* RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF */ /* THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY */ /* CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE */ /* ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. */ /* $ Parameters */ /* INERTL an inertial frame that is listed in the routine */ /* CHGIRF and that requires no external file to */ /* compute the transformation from or to any other */ /* inertial frame. */ /* PCK is a frame that is specified relative to some */ /* INERTL frame and that has an IAU model that */ /* may be retrieved from the PCK system via a call */ /* to the routine TISBOD. */ /* CK is a frame defined by a C-kernel. */ /* TK is a "text kernel" frame. These frames are offset */ /* from their associated "relative" frames by a */ /* constant rotation. */ /* DYN is a "dynamic" frame. These currently are */ /* parameterized, built-in frames where the full frame */ /* definition depends on parameters supplied via a */ /* frame kernel. */ /* ALL indicates any of the above classes. This parameter */ /* is used in APIs that fetch information about frames */ /* of a specified class. */ /* $ <API key> */ /* N.J. Bachman (JPL) */ /* W.L. Taber (JPL) */ /* $ <API key> */ /* None. */ /* $ Version */ /* - SPICELIB Version 4.0.0, 08-MAY-2012 (NJB) */ /* The parameter ALL was added to support frame fetch APIs. */ /* - SPICELIB Version 3.0.0, 28-MAY-2004 (NJB) */ /* The parameter DYN was added to support the dynamic frame class. */ /* - SPICELIB Version 2.0.0, 12-DEC-1996 (WLT) */ /* Various unused frames types were removed and the */ /* frame time TK was added. */ /* - SPICELIB Version 1.0.0, 10-DEC-1995 (WLT) */ /* End of INCLUDE file frmtyp.inc */ /* $ Brief_I/O */ /* VARIABLE I/O DESCRIPTION */ /* FRAME1 I the frame id-code for some reference frame */ /* FRAME2 I the frame id-code for some reference frame */ /* ET I an epoch in TDB seconds past J2000. */ /* ROTATE O a rotation matrix */ /* $ Detailed_Input */ /* FRAME1 is the frame id-code in which some positions */ /* are known. */ /* FRAME2 is the frame id-code for some frame in which you */ /* would like to represent positions. */ /* ET is the epoch at which to compute the transformation */ /* matrix. This epoch should be in TDB seconds past */ /* the ephemeris epoch of J2000. */ /* $ Detailed_Output */ /* ROTATE is a 3 x 3 rotaion matrix that can be used to */ /* transform positions relative to the frame */ /* correspsonding to frame FRAME2 to positions relative */ /* to the frame FRAME2. More explicitely, if POS is */ /* the position of some object relative to the */ /* reference frame of FRAME1 then POS2 is the position */ /* of the same object relative to FRAME2 where POS2 is */ /* computed via the subroutine call below */ /* CALL MXV ( ROTATE, POS, POS2 ) */ /* $ Parameters */ /* None. */ /* $ Exceptions */ /* 1) If either of the reference frames is unrecognized, the error */ /* SPICE(UNKNOWNFRAME) will be signalled. */ /* 2) If the auxillary information needed to compute a non-inertial */ /* frame is not available an error will be diagnosed and signalled */ /* by a routine in the call tree of this routine. */ /* $ Files */ /* None. */ /* $ Particulars */ /* This routine allows you to compute the rotation matrix */ /* between two reference frames. */ /* $ Examples */ /* Suppose that you have a position POS1 at epoch ET */ /* relative to FRAME1 and wish to determine its representation */ /* POS2 relative to FRAME2. The following subroutine calls */ /* would suffice to make this rotation. */ /* CALL REFCHG ( FRAME1, FRAME2, ET, ROTATE ) */ /* CALL MXV ( ROTATE, POS1, POS2 ) */ /* $ Restrictions */ /* None. */ /* $ <API key> */ /* None. */ /* $ <API key> */ /* W.L. Taber (JPL) */ /* $ Version */ /* - SPICELIB Version 2.0.0, 14-DEC-2008 (NJB) */ /* Upgraded long error message associated with frame */ /* connection failure. */ /* - SPICELIB Version 1.2.0, 26-APR-2004 (NJB) */ /* Another typo was corrected in the long error message, and */ /* in a comment. */ /* - SPICELIB Version 1.1.0, 23-MAY-2000 (WLT) */ /* A typo was corrected in the long error message. */ /* - SPICELIB Version 1.0.0, 9-JUL-1998 (WLT) */ /* $ Index_Entries */ /* Rotate positions from one frame to another */ /* SPICE functions */ /* Local Paramters */ /* The root of all reference frames is J2000 (Frame ID = 1). */ /* Local Variables */ /* ROT contains the rotations from FRAME1 to FRAME2 */ /* ROT(1...3,1...3,I) has the rotation from FRAME(I) */ /* to FRAME(I+1). We make extra room in ROT because we */ /* plan to add rotations beyond the obvious chain from */ /* FRAME1 to a root node. */ /* ROT2 is used to store intermediate rotation from */ /* FRAME2 to some node in the chain from FRAME1 to PCK or */ /* INERTL frames. */ /* FRAME contains the frames we transform from in going from */ /* FRAME1 to FRAME2. FRAME(1) = FRAME1 by construction. */ /* NODE counts the number of rotations needed to go */ /* from FRAME1 to FRAME2. */ /* Standard SPICE error handling. */ if (return_()) { return 0; } chkin_("REFCHG", (ftnlen)6); /* Do the obvious thing first. If FRAME1 and FRAME2 are the */ /* same then we simply return the identity matrix. */ if (*frame1 == *frame2) { ident_(rotate); chkout_("REFCHG", (ftnlen)6); return 0; } /* Now perform the obvious check to make sure that both */ /* frames are recognized. */ frinfo_(frame1, &cent, &class__, &clssid, &found); if (! found) { setmsg_("The number # is not a recognized id-code for a reference fr" "ame. ", (ftnlen)64); errint_("#", frame1, (ftnlen)1); sigerr_("SPICE(UNKNOWNFRAME)", (ftnlen)19); chkout_("REFCHG", (ftnlen)6); return 0; } frinfo_(frame2, &cent, &class__, &clssid, &found); if (! found) { setmsg_("The number # is not a recognized id-code for a reference fr" "ame. ", (ftnlen)64); errint_("#", frame2, (ftnlen)1); sigerr_("SPICE(UNKNOWNFRAME)", (ftnlen)19); chkout_("REFCHG", (ftnlen)6); return 0; } node = 1; frame[(i__1 = node - 1) < 10 && 0 <= i__1 ? i__1 : s_rnge("frame", i__1, "refchg_", (ftnlen)287)] = *frame1; found = TRUE_; /* Follow the chain of rotations until we run into */ /* one that rotates to J2000 (frame id = 1) or we hit FRAME2. */ while(frame[(i__1 = node - 1) < 10 && 0 <= i__1 ? i__1 : s_rnge("frame", i__1, "refchg_", (ftnlen)293)] != 1 && node < 10 && frame[(i__2 = node - 1) < 10 && 0 <= i__2 ? i__2 : s_rnge("frame", i__2, "refc" "hg_", (ftnlen)293)] != *frame2 && found) { /* Find out what rotation is available for this */ /* frame. */ rotget_(&frame[(i__1 = node - 1) < 10 && 0 <= i__1 ? i__1 : s_rnge( "frame", i__1, "refchg_", (ftnlen)301)], et, &rot[(i__2 = ( node * 3 + 1) * 3 - 12) < 126 && 0 <= i__2 ? i__2 : s_rnge( "rot", i__2, "refchg_", (ftnlen)301)], &frame[(i__3 = node) < 10 && 0 <= i__3 ? i__3 : s_rnge("frame", i__3, "refchg_", ( ftnlen)301)], &found); if (found) { /* We found a rotation matrix. ROT(1,1,NODE) */ /* now contains the rotation from FRAME(NODE) */ /* to FRAME(NODE+1). We need to look up the information */ /* for the next NODE. */ ++node; } } done = frame[(i__1 = node - 1) < 10 && 0 <= i__1 ? i__1 : s_rnge("frame", i__1, "refchg_", (ftnlen)317)] == 1 || frame[(i__2 = node - 1) < 10 && 0 <= i__2 ? i__2 : s_rnge("frame", i__2, "refchg_", (ftnlen) 317)] == *frame2 || ! found; while(! done) { /* The only way to get to this point is to have run out of */ /* room in the array of reference frame rotation */ /* buffers. We will now build the rotation from */ /* the previous NODE to whatever the next node in the */ /* chain is. We'll do this until we get to one of the */ /* root classes or we run into FRAME2. */ rotget_(&frame[(i__1 = node - 1) < 10 && 0 <= i__1 ? i__1 : s_rnge( "frame", i__1, "refchg_", (ftnlen)331)], et, &rot[(i__2 = ( node * 3 + 1) * 3 - 12) < 126 && 0 <= i__2 ? i__2 : s_rnge( "rot", i__2, "refchg_", (ftnlen)331)], &relto, &found); if (found) { /* Recall that ROT(1,1,NODE-1) contains the rotation */ /* from FRAME(NODE-1) to FRAME(NODE). We are going to replace */ /* FRAME(NODE) with the frame indicated by RELTO. This means */ /* that ROT(1,1,NODE-1) should be replaced with the */ /* rotation from FRAME(NODE) to RELTO. */ frame[(i__1 = node - 1) < 10 && 0 <= i__1 ? i__1 : s_rnge("frame", i__1, "refchg_", (ftnlen)342)] = relto; zzrxr_(&rot[(i__1 = ((node - 1) * 3 + 1) * 3 - 12) < 126 && 0 <= i__1 ? i__1 : s_rnge("rot", i__1, "refchg_", (ftnlen)343)] , &c__2, tmprot); for (i__ = 1; i__ <= 3; ++i__) { for (j = 1; j <= 3; ++j) { rot[(i__1 = i__ + (j + (node - 1) * 3) * 3 - 13) < 126 && 0 <= i__1 ? i__1 : s_rnge("rot", i__1, "refchg_", (ftnlen)347)] = tmprot[(i__2 = i__ + j * 3 - 4) < 9 && 0 <= i__2 ? i__2 : s_rnge("tmprot", i__2, "refchg_", (ftnlen)347)]; } } } /* We are done if the class of the last frame is J2000 */ /* or if the last frame is FRAME2 or if we simply couldn't get */ /* another rotation. */ done = frame[(i__1 = node - 1) < 10 && 0 <= i__1 ? i__1 : s_rnge( "frame", i__1, "refchg_", (ftnlen)357)] == 1 || frame[(i__2 = node - 1) < 10 && 0 <= i__2 ? i__2 : s_rnge("frame", i__2, "refchg_", (ftnlen)357)] == *frame2 || ! found; } /* Right now we have the following situation. We have in hand */ /* a collection of rotations between frames. (Assuming */ /* that is that NODE .GT. 1. If NODE .EQ. 1 then we have */ /* no rotations computed yet. */ /* ROT(1...3, 1...3, 1 ) rotates FRAME1 to FRAME(2) */ /* ROT(1...3, 1...3, 2 ) rotates FRAME(2) to FRAME(3) */ /* ROT(1...3, 1...3, 3 ) rotates FRAME(3) to FRAME(4) */ /* ROT(1...3, 1...3, NODE-1 ) rotates FRAME(NODE-1) */ /* to FRAME(NODE) */ /* One of the following situations is true. */ /* 1) FRAME(NODE) is the root of all frames, J2000. */ /* 2) FRAME(NODE) is the same as FRAME2 */ /* 3) There is no rotation from FRAME(NODE) to another */ /* more fundamental frame. The chain of rotations */ /* from FRAME1 stops at FRAME(NODE). This means that the */ /* "frame atlas" is incomplete because we can't get to the */ /* root frame. */ /* We now have to do essentially the same thing for FRAME2. */ if (frame[(i__1 = node - 1) < 10 && 0 <= i__1 ? i__1 : s_rnge("frame", i__1, "refchg_", (ftnlen)395)] == *frame2) { /* We can handle this one immediately with the private routine */ /* ZZRXR which multiplies a series of matrices. */ i__1 = node - 1; zzrxr_(rot, &i__1, rotate); chkout_("REFCHG", (ftnlen)6); return 0; } /* We didn't luck out above. So we follow the chain of */ /* rotation for FRAME2. Note that at the moment the */ /* chain of rotations from FRAME2 to other frames */ /* does not share a node in the chain for FRAME1. */ /* ( GOTONE = .FALSE. ) . */ this__ = *frame2; gotone = FALSE_; /* First see if there is any chain to follow. */ done = this__ == 1; /* Set up the matrices ROT2(,,1) and ROT(,,2) and set up */ /* PUT and GET pointers so that we know where to GET the partial */ /* rotation from and where to PUT partial results. */ if (! done) { put = 1; get = 1; inc = 1; } /* Follow the chain of rotations until we run into */ /* one that rotates to the root frame or we land in the */ /* chain of nodes for FRAME1. */ /* Note that this time we will simply keep track of the full */ /* rotation from FRAME2 to the last node. */ while(! done) { /* Find out what rotation is available for this */ /* frame. */ if (this__ == *frame2) { /* This is the first pass, just put the rotation */ /* directly into ROT2(,,PUT). */ rotget_(&this__, et, &rot2[(i__1 = (put * 3 + 1) * 3 - 12) < 18 && 0 <= i__1 ? i__1 : s_rnge("rot2", i__1, "refchg_", ( ftnlen)452)], &relto, &found); if (found) { this__ = relto; get = put; put += inc; inc = -inc; cmnode = isrchi_(&this__, &node, frame); gotone = cmnode > 0; } } else { /* Fetch the rotation into a temporary spot TMPROT */ rotget_(&this__, et, tmprot, &relto, &found); if (found) { /* Next multiply TMPROT on the right by the last partial */ /* product (in ROT2(,,GET) ). We do this in line. */ for (i__ = 1; i__ <= 3; ++i__) { for (j = 1; j <= 3; ++j) { rot2[(i__1 = i__ + (j + put * 3) * 3 - 13) < 18 && 0 <= i__1 ? i__1 : s_rnge("rot2", i__1, "refch" "g_", (ftnlen)478)] = tmprot[(i__2 = i__ - 1) < 9 && 0 <= i__2 ? i__2 : s_rnge("tmprot", i__2, "refchg_", (ftnlen)478)] * rot2[(i__3 = (j + get * 3) * 3 - 12) < 18 && 0 <= i__3 ? i__3 : s_rnge("rot2", i__3, "refchg_", ( ftnlen)478)] + tmprot[(i__4 = i__ + 2) < 9 && 0 <= i__4 ? i__4 : s_rnge("tmprot", i__4, "refchg_", (ftnlen)478)] * rot2[(i__5 = (j + get * 3) * 3 - 11) < 18 && 0 <= i__5 ? i__5 : s_rnge("rot2", i__5, "refchg_", (ftnlen)478)] + tmprot[(i__6 = i__ + 5) < 9 && 0 <= i__6 ? i__6 : s_rnge("tmprot", i__6, "refchg_", ( ftnlen)478)] * rot2[(i__7 = (j + get * 3) * 3 - 10) < 18 && 0 <= i__7 ? i__7 : s_rnge("rot2" , i__7, "refchg_", (ftnlen)478)]; } } /* Adjust GET and PUT so that GET points to the slots */ /* where we just stored the result of our multiply and */ /* so that PUT points to the next available storage */ /* locations. */ get = put; put += inc; inc = -inc; this__ = relto; cmnode = isrchi_(&this__, &node, frame); gotone = cmnode > 0; } } /* See if we have a common node and determine whether or not */ /* we are done with this loop. */ done = this__ == 1 || gotone || ! found; } /* There are two possible scenarios. Either the chain of */ /* rotations from FRAME2 ran into a node in the chain for */ /* FRAME1 or it didn't. (The common node might very well be */ /* the root node.) If we didn't run into a common one, then */ /* the two chains don't intersect and there is no way to */ /* get from FRAME1 to FRAME2. */ if (! gotone) { zznofcon_(et, frame1, &frame[(i__1 = node - 1) < 10 && 0 <= i__1 ? i__1 : s_rnge("frame", i__1, "refchg_", (ftnlen)525)], frame2, &this__, errmsg, (ftnlen)1840); if (failed_()) { /* We were unable to create the error message. This */ /* unfortunate situation could arise if a frame kernel */ /* is corrupted. */ chkout_("REFCHG", (ftnlen)6); return 0; } /* The normal case: signal an error with a descriptive long */ /* error message. */ setmsg_(errmsg, (ftnlen)1840); sigerr_("SPICE(NOFRAMECONNECT)", (ftnlen)21); chkout_("REFCHG", (ftnlen)6); return 0; } /* Recall that we have the following. */ /* ROT(1...3, 1...3, 1 ) rotates FRAME(1) to FRAME(2) */ /* ROT(1...3, 1...3, 2 ) rotates FRAME(2) to FRAME(3) */ /* ROT(1...3, 1...3, 3 ) rotates FRAME(3) to FRAME(4) */ /* ROT(1...3, 1...3, CMNODE-1) rotates FRAME(CMNODE-1) */ /* to FRAME(CMNODE) */ /* and that ROT2(1,1,GET) rotates from FRAME2 to CMNODE. */ /* Hence the inverse of ROT2(1,1,GET) rotates from CMNODE */ /* to FRAME2. */ /* If we compute the inverse of ROT2 and store it in */ /* the next available slot of ROT (.i.e. ROT(1,1,CMNODE) */ /* we can simply apply our custom routine that multiplies a */ /* sequence of rotation matrices together to get the */ /* result from FRAME1 to FRAME2. */ xpose_(&rot2[(i__1 = (get * 3 + 1) * 3 - 12) < 18 && 0 <= i__1 ? i__1 : s_rnge("rot2", i__1, "refchg_", (ftnlen)568)], &rot[(i__2 = ( cmnode * 3 + 1) * 3 - 12) < 126 && 0 <= i__2 ? i__2 : s_rnge( "rot", i__2, "refchg_", (ftnlen)568)]); zzrxr_(rot, &cmnode, rotate); chkout_("REFCHG", (ftnlen)6); return 0; } /* refchg_ */
define( [], function() { var model = Backbone.Model.extend( { defaults: { objectType: 'template', id: 'none', title: 'unknown' }, initialize: function() { this.set( 'desc', this.get( 'template-desc' ) ); } } ); return model; } );
package org.thoughtcrime.securesms.video; import android.media.MediaDataSource; import androidx.annotation.NonNull; import androidx.annotation.RequiresApi; import org.thoughtcrime.securesms.crypto.AttachmentSecret; import org.thoughtcrime.securesms.crypto.<API key>; import org.thoughtcrime.securesms.util.Util; import java.io.File; import java.io.IOException; import java.io.InputStream; @RequiresApi(23) final class <API key> extends MediaDataSource { private final Attachment<API key>; private final File mediaFile; private final long length; <API key>(@NonNull Attachment<API key>, @NonNull File mediaFile, long length) { this.attachment<API key>; this.mediaFile = mediaFile; this.length = length; } @Override public int readAt(long position, byte[] bytes, int offset, int length) throws IOException { try (InputStream inputStream = <API key>.createFor(attachmentSecret, mediaFile)) { byte[] buffer = new byte[4096]; long headerRemaining = position; while (headerRemaining > 0) { int read = inputStream.read(buffer, 0, Util.toIntExact(Math.min((long)buffer.length, headerRemaining))); if (read == -1) return -1; headerRemaining -= read; } return inputStream.read(bytes, offset, length); } } @Override public long getSize() { return length; } @Override public void close() {} }
#!/usr/bin/python # -*- coding: utf-8 -*- from __future__ import absolute_import, division, print_function __metaclass__ = type ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported_by': 'certified'} EXAMPLES = r''' - name: Create a ... bigip_ike_peer: name: foo provider: password: secret server: lb.mydomain.com user: admin delegate_to: localhost ''' from ansible.module_utils.basic import AnsibleModule from ansible.module_utils.basic import env_fallback try: from library.module_utils.network.f5.bigip import F5RestClient from library.module_utils.network.f5.common import F5ModuleError from library.module_utils.network.f5.common import AnsibleF5Parameters from library.module_utils.network.f5.common import cleanup_tokens from library.module_utils.network.f5.common import fq_name from library.module_utils.network.f5.common import f5_argument_spec from library.module_utils.network.f5.common import exit_json from library.module_utils.network.f5.common import fail_json from library.module_utils.network.f5.common import transform_name from library.module_utils.network.f5.common import flatten_boolean from library.module_utils.network.f5.compare import cmp_str_with_none except ImportError: from ansible.module_utils.network.f5.bigip import F5RestClient from ansible.module_utils.network.f5.common import F5ModuleError from ansible.module_utils.network.f5.common import AnsibleF5Parameters from ansible.module_utils.network.f5.common import cleanup_tokens from ansible.module_utils.network.f5.common import fq_name from ansible.module_utils.network.f5.common import f5_argument_spec from ansible.module_utils.network.f5.common import exit_json from ansible.module_utils.network.f5.common import fail_json from ansible.module_utils.network.f5.common import transform_name from ansible.module_utils.network.f5.common import flatten_boolean from ansible.module_utils.network.f5.compare import cmp_str_with_none class Parameters(AnsibleF5Parameters): api_map = { 'myIdType': 'presented_id_type', 'peersIdType': 'verified_id_type', 'phase1AuthMethod': 'phase1_auth_method', '<API key>': 'preshared_key', 'remoteAddress': 'remote_address', 'version': 'version', '<API key>': '<API key>', 'phase1HashAlgorithm': '<API key>', '<API key>': '<API key>', 'myCertFile': 'phase1_cert', 'myCertKeyFile': 'phase1_key', 'verifyCert': '<API key>', 'peersIdValue': 'verified_id_value', 'myIdValue': 'presented_id_value', } api_attributes = [ 'myIdType', 'peersIdType', 'phase1AuthMethod', '<API key>', 'remoteAddress', 'version', '<API key>', 'phase1HashAlgorithm', '<API key>', 'myCertFile', 'myCertKeyFile', 'verifyCert', 'peersIdValue', 'myIdValue', 'description', ] returnables = [ 'presented_id_type', 'verified_id_type', 'phase1_auth_method', 'preshared_key', 'remote_address', 'version', '<API key>', '<API key>', '<API key>', 'phase1_cert', 'phase1_key', '<API key>', 'verified_id_value', 'presented_id_value', 'description', ] updatables = [ 'presented_id_type', 'verified_id_type', 'phase1_auth_method', 'preshared_key', 'remote_address', 'version', '<API key>', '<API key>', '<API key>', 'phase1_cert', 'phase1_key', '<API key>', 'verified_id_value', 'presented_id_value', 'description', ] @property def <API key>(self): return flatten_boolean(self._values['<API key>']) class ApiParameters(Parameters): @property def description(self): if self._values['description'] in [None, 'none']: return None return self._values['description'] class ModuleParameters(Parameters): @property def phase1_cert(self): if self._values['phase1_cert'] is None: return None if self._values['phase1_cert'] in ['', 'none']: return '' return fq_name(self.partition, self._values['phase1_cert']) @property def phase1_key(self): if self._values['phase1_key'] is None: return None if self._values['phase1_key'] in ['', 'none']: return '' return fq_name(self.partition, self._values['phase1_key']) @property def description(self): if self._values['description'] is None: return None elif self._values['description'] in ['none', '']: return '' return self._values['description'] class Changes(Parameters): def to_return(self): result = {} try: for returnable in self.returnables: result[returnable] = getattr(self, returnable) result = self._filter_params(result) except Exception: pass return result class UsableChanges(Changes): @property def <API key>(self): if self._values['<API key>'] is None: return None elif self._values['<API key>'] == 'yes': return 'true' else: return 'false' class ReportableChanges(Changes): @property def <API key>(self): return flatten_boolean(self._values['<API key>']) @property def preshared_key(self): return None class Difference(object): def __init__(self, want, have=None): self.want = want self.have = have def compare(self, param): try: result = getattr(self, param) return result except AttributeError: return self.__default(param) def __default(self, param): attr1 = getattr(self.want, param) try: attr2 = getattr(self.have, param) if attr1 != attr2: return attr1 except AttributeError: return attr1 @property def description(self): return cmp_str_with_none(self.want.description, self.have.description) class ModuleManager(object): def __init__(self, *args, **kwargs): self.module = kwargs.get('module', None) self.client = kwargs.get('client', None) self.want = ModuleParameters(params=self.module.params) self.have = ApiParameters() self.changes = UsableChanges() def <API key>(self): changed = {} for key in Parameters.returnables: if getattr(self.want, key) is not None: changed[key] = getattr(self.want, key) if changed: self.changes = UsableChanges(params=changed) def <API key>(self): diff = Difference(self.want, self.have) updatables = Parameters.updatables changed = dict() for k in updatables: change = diff.compare(k) if change is None: continue else: if isinstance(change, dict): changed.update(change) else: changed[k] = change if changed: self.changes = UsableChanges(params=changed) return True return False def should_update(self): result = self.<API key>() if result: return True return False def exec_module(self): changed = False result = dict() state = self.want.state if state == "present": changed = self.present() elif state == "absent": changed = self.absent() reportable = ReportableChanges(params=self.changes.to_return()) changes = reportable.to_return() result.update(**changes) result.update(dict(changed=changed)) self.<API key>(result) return result def <API key>(self, result): warnings = result.pop('__warnings', []) for warning in warnings: self.client.module.deprecate( msg=warning['msg'], version=warning['version'] ) def present(self): if self.exists(): return self.update() else: return self.create() def exists(self): uri = "https://{0}:{1}/mgmt/tm/net/ipsec/ike-peer/{2}".format( self.client.provider['server'], self.client.provider['server_port'], transform_name(self.want.partition, self.want.name) ) resp = self.client.api.get(uri) try: response = resp.json() except ValueError: return False if resp.status == 404 or 'code' in response and response['code'] == 404: return False return True def update(self): self.have = self.<API key>() if self.changes.version is not None and len(self.changes.version) == 0: raise F5ModuleError( "At least one version value must be specified." ) if self.changes.phase1_auth_method == 'pre-shared-key': if self.changes.preshared_key is None and self.have.preshared_key is None: raise F5ModuleError( "A 'preshared_key' must be specified when changing 'phase1_auth_method' " "to 'pre-shared-key'." ) if self.want.update_password == 'always': self.want.update({'preshared_key': self.want.preshared_key}) else: if self.want.preshared_key: del self.want._values['preshared_key'] if not self.should_update(): return False if self.module.check_mode: return True self.update_on_device() return True def remove(self): if self.module.check_mode: return True self.remove_from_device() if self.exists(): raise F5ModuleError("Failed to delete the resource.") return True def create(self): self.<API key>() if self.changes.version is None: raise F5ModuleError( "The 'version' parameter is required when creating a new IKE peer." ) if self.changes.phase1_auth_method is None: self.changes.update({'phase1_auth_method': 'rsa-signature'}) if self.changes.phase1_cert is None: self.changes.update({'phase1_cert': 'default.crt'}) if self.changes.phase1_key is None: self.changes.update({'phase1_key': 'default.key'}) if self.module.check_mode: return True self.create_on_device() return True def create_on_device(self): params = self.changes.api_params() params['name'] = self.want.name params['partition'] = self.want.partition uri = "https://{0}:{1}/mgmt/tm/net/ipsec/ike-peer/".format( self.client.provider['server'], self.client.provider['server_port'] ) resp = self.client.api.post(uri, json=params) try: response = resp.json() except ValueError as ex: raise F5ModuleError(str(ex)) if 'code' in response and response['code'] in [400, 403]: if 'message' in response: raise F5ModuleError(response['message']) else: raise F5ModuleError(resp.content) def update_on_device(self): params = self.changes.api_params() uri = "https://{0}:{1}/mgmt/tm/net/ipsec/ike-peer/{2}".format( self.client.provider['server'], self.client.provider['server_port'], transform_name(self.want.partition, self.want.name) ) resp = self.client.api.patch(uri, json=params) try: response = resp.json() except ValueError as ex: raise F5ModuleError(str(ex)) if 'code' in response and response['code'] == 400: if 'message' in response: raise F5ModuleError(response['message']) else: raise F5ModuleError(resp.content) def absent(self): if self.exists(): return self.remove() return False def remove_from_device(self): uri = "https://{0}:{1}/mgmt/tm/net/ipsec/ike-peer/{2}".format( self.client.provider['server'], self.client.provider['server_port'], transform_name(self.want.partition, self.want.name) ) resp = self.client.api.delete(uri) if resp.status == 200: return True def <API key>(self): uri = "https://{0}:{1}/mgmt/tm/net/ipsec/ike-peer/{2}".format( self.client.provider['server'], self.client.provider['server_port'], transform_name(self.want.partition, self.want.name) ) resp = self.client.api.get(uri) try: response = resp.json() except ValueError as ex: raise F5ModuleError(str(ex)) if 'code' in response and response['code'] == 400: if 'message' in response: raise F5ModuleError(response['message']) else: raise F5ModuleError(resp.content) return ApiParameters(params=response) class ArgumentSpec(object): def __init__(self): self.supports_check_mode = True argument_spec = dict( name=dict(required=True), presented_id_type=dict( choices=['address', 'asn1dn', 'fqdn', 'keyid-tag', 'user-fqdn', 'override'] ), presented_id_value=dict(), verified_id_type=dict( choices=['address', 'asn1dn', 'fqdn', 'keyid-tag', 'user-fqdn', 'override'] ), verified_id_value=dict(), phase1_auth_method=dict( choices=[ 'pre-shared-key', 'rsa-signature' ] ), preshared_key=dict(no_log=True), remote_address=dict(), version=dict( type='list', choices=['v1', 'v2'] ), <API key>=dict( choices=[ '3des', 'des', 'blowfish', 'cast128', 'aes128', 'aes192', 'aes256', 'camellia' ] ), <API key>=dict( choices=[ 'sha1', 'md5', 'sha256', 'sha384', 'sha512' ] ), <API key>=dict( choices=[ 'ecp256', 'ecp384', 'ecp521', 'modp768', 'modp1024', 'modp1536', 'modp2048', 'modp3072', 'modp4096', 'modp6144', 'modp8192' ] ), phase1_cert=dict(), phase1_key=dict(), <API key>=dict(type='bool'), update_password=dict( default='always', choices=['always', 'on_create'] ), description=dict(), state=dict(default='present', choices=['absent', 'present']), partition=dict( default='Common', fallback=(env_fallback, ['F5_PARTITION']) ) ) self.argument_spec = {} self.argument_spec.update(f5_argument_spec) self.argument_spec.update(argument_spec) self.required_if = [ ['presented_id_type', 'fqdn', ['presented_id_value']], ['presented_id_type', 'keyid-tag', ['presented_id_value']], ['presented_id_type', 'user-fqdn', ['presented_id_value']], ['presented_id_type', 'override', ['presented_id_value']], ['verified_id_type', 'fqdn', ['verified_id_value']], ['verified_id_type', 'keyid-tag', ['verified_id_value']], ['verified_id_type', 'user-fqdn', ['verified_id_value']], ['verified_id_type', 'override', ['verified_id_value']], ] self.required_together = [ ['phase1_cert', 'phase1_key'] ] def main(): spec = ArgumentSpec() module = AnsibleModule( argument_spec=spec.argument_spec, supports_check_mode=spec.supports_check_mode, required_if=spec.required_if, required_together=spec.required_together, ) client = F5RestClient(**module.params) try: mm = ModuleManager(module=module, client=client) results = mm.exec_module() cleanup_tokens(client) exit_json(module, results, client) except F5ModuleError as ex: cleanup_tokens(client) fail_json(module, ex, client) if __name__ == '__main__': main()
package com.vividsolutions.jts.index.chain; import java.util.*; import com.vividsolutions.jts.geom.Coordinate; import com.vividsolutions.jts.geomgraph.Quadrant; /** * Constructs {@link MonotoneChain}s * for sequences of {@link Coordinate}s. * * @version 1.7 */ public class <API key> { public static int[] toIntArray(List list) { int[] array = new int[list.size()]; for (int i = 0; i < array.length; i++) { array[i] = ((Integer) list.get(i)).intValue(); } return array; } public static List getChains(Coordinate[] pts) { return getChains(pts, null); } /** * Return a list of the {@link MonotoneChain}s * for the given list of coordinates. */ public static List getChains(Coordinate[] pts, Object context) { List mcList = new ArrayList(); int[] startIndex = <API key>(pts); for (int i = 0; i < startIndex.length - 1; i++) { MonotoneChain mc = new MonotoneChain(pts, startIndex[i], startIndex[i + 1], context); mcList.add(mc); } return mcList; } /** * Return an array containing lists of start/end indexes of the monotone chains * for the given list of coordinates. * The last entry in the array points to the end point of the point array, * for use as a sentinel. */ public static int[] <API key>(Coordinate[] pts) { // find the startpoint (and endpoints) of all monotone chains in this edge int start = 0; List startIndexList = new ArrayList(); startIndexList.add(new Integer(start)); do { int last = findChainEnd(pts, start); startIndexList.add(new Integer(last)); start = last; } while (start < pts.length - 1); // copy list to an array of ints, for efficiency int[] startIndex = toIntArray(startIndexList); return startIndex; } /** * Finds the index of the last point in a monotone chain * starting at a given point. * Any repeated points (0-length segments) will be included * in the monotone chain returned. * * @return the index of the last point in the monotone chain * starting at <code>start</code>. */ private static int findChainEnd(Coordinate[] pts, int start) { int safeStart = start; // skip any zero-length segments at the start of the sequence // (since they cannot be used to establish a quadrant) while (safeStart < pts.length - 1 && pts[safeStart].equals2D(pts[safeStart + 1])) { safeStart++; } // check if there are NO non-zero-length segments if (safeStart >= pts.length - 1) { return pts.length - 1; } // determine overall quadrant for chain (which is the starting quadrant) int chainQuad = Quadrant.quadrant(pts[safeStart], pts[safeStart + 1]); int last = start + 1; while (last < pts.length) { // skip zero-length segments, but include them in the chain if (! pts[last - 1].equals2D(pts[last])) { // compute quadrant for next possible segment in chain int quad = Quadrant.quadrant(pts[last - 1], pts[last]); if (quad != chainQuad) break; } last++; } return last - 1; } public <API key>() { } }
#pragma once #include <QtGlobal> namespace QmlDesigner { inline double round(double value, int digits) { double factor = digits * 10.; return double(qRound64(value * factor)) / factor; } }
#include "writeFuns.H" #include "<API key>.H" // Store List in dest template<class Type> void Foam::writeFuns::insert ( const List<Type>& source, DynamicList<floatScalar>& dest ) { forAll(source, i) { insert(source[i], dest); } } / Store List (indexed through map) in dest //template<class Type> //void Foam::writeFuns::insert // const labelList& map, // const List<Type>& source, // DynamicList<floatScalar>& dest // forAll(map, i) // insert(source[map[i]], dest); template<class Type> void Foam::writeFuns::write ( std::ostream& os, const bool binary, const GeometricField<Type, fvPatchField, volMesh>& vvf, const vtkMesh& vMesh ) { const fvMesh& mesh = vMesh.mesh(); const labelList& superCells = vMesh.topo().superCells(); label nValues = mesh.nCells() + superCells.size(); os << vvf.name() << ' ' << pTraits<Type>::nComponents << ' ' << nValues << " float" << std::endl; DynamicList<floatScalar> fField(pTraits<Type>::nComponents*nValues); insert(vvf.internalField(), fField); forAll(superCells, superCellI) { label origCellI = superCells[superCellI]; insert(vvf[origCellI], fField); } write(os, binary, fField); } template<class Type> void Foam::writeFuns::write ( std::ostream& os, const bool binary, const GeometricField<Type, pointPatchField, pointMesh>& pvf, const vtkMesh& vMesh ) { const fvMesh& mesh = vMesh.mesh(); const vtkTopo& topo = vMesh.topo(); const labelList& addPointCellLabels = topo.addPointCellLabels(); const label nTotPoints = mesh.nPoints() + addPointCellLabels.size(); os << pvf.name() << ' ' << pTraits<Type>::nComponents << ' ' << nTotPoints << " float" << std::endl; DynamicList<floatScalar> fField(pTraits<Type>::nComponents*nTotPoints); insert(pvf, fField); forAll(addPointCellLabels, api) { label origCellI = addPointCellLabels[api]; insert(<API key>(pvf, origCellI), fField); } write(os, binary, fField); } template<class Type> void Foam::writeFuns::write ( std::ostream& os, const bool binary, const GeometricField<Type, fvPatchField, volMesh>& vvf, const GeometricField<Type, pointPatchField, pointMesh>& pvf, const vtkMesh& vMesh ) { const fvMesh& mesh = vMesh.mesh(); const vtkTopo& topo = vMesh.topo(); const labelList& addPointCellLabels = topo.addPointCellLabels(); const label nTotPoints = mesh.nPoints() + addPointCellLabels.size(); os << vvf.name() << ' ' << pTraits<Type>::nComponents << ' ' << nTotPoints << " float" << std::endl; DynamicList<floatScalar> fField(pTraits<Type>::nComponents*nTotPoints); insert(pvf, fField); forAll(addPointCellLabels, api) { label origCellI = addPointCellLabels[api]; insert(vvf[origCellI], fField); } write(os, binary, fField); } template<class Type, template<class> class PatchField, class GeoMesh> void Foam::writeFuns::write ( std::ostream& os, const bool binary, const PtrList<GeometricField<Type, PatchField, GeoMesh> >& flds, const vtkMesh& vMesh ) { forAll(flds, i) { write(os, binary, flds[i], vMesh); } } template<class Type> void Foam::writeFuns::write ( std::ostream& os, const bool binary, const <API key>& pInterp, const PtrList<GeometricField<Type, fvPatchField, volMesh> >& flds, const vtkMesh& vMesh ) { forAll(flds, i) { write(os, binary, flds[i], pInterp.interpolate(flds[i])(), vMesh); } }
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models from django.conf import settings class Migration(migrations.Migration): dependencies = [ ('contenttypes', '<API key>'), migrations.<API key>(settings.AUTH_USER_MODEL), ('sites', '0001_initial'), ] operations = [ migrations.CreateModel( name='Comment', fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), ('object_pk', models.TextField(verbose_name='object ID')), ('user_name', models.CharField(max_length=50, verbose_name="user's name", blank=True)), ('user_email', models.EmailField(max_length=254, verbose_name="user's email address", blank=True)), ('user_url', models.URLField(verbose_name="user's URL", blank=True)), ('comment', models.TextField(max_length=3000, verbose_name='comment')), ('submit_date', models.DateTimeField(default=None, verbose_name='date/time submitted', db_index=True)), ('ip_address', models.<API key>(unpack_ipv4=True, null=True, verbose_name='IP address', blank=True)), ('is_public', models.BooleanField(default=True, help_text='Uncheck this box to make the comment effectively disappear from the site.', verbose_name='is public')), ('is_removed', models.BooleanField(default=False, help_text='Check this box if the comment is inappropriate. A "This comment has been removed" message will be displayed instead.', verbose_name='is removed')), ('content_type', models.ForeignKey(related_name='<API key>', verbose_name='content type', to='contenttypes.ContentType', on_delete=models.CASCADE)), ('site', models.ForeignKey(to='sites.Site', on_delete=models.CASCADE)), ('user', models.ForeignKey(related_name='comment_comments', verbose_name='user', blank=True, to=settings.AUTH_USER_MODEL, null=True, on_delete=models.CASCADE)), ], options={ 'ordering': ('submit_date',), 'abstract': False, 'verbose_name': 'comment', 'verbose_name_plural': 'comments', 'permissions': [('can_moderate', 'Can moderate comments')], }, ), ]
class <API key> < ActiveRecord::Migration def change add_column :userfiles, :immutable, :boolean, :default => false end end
# $HeadURL$ # File: ReqProxyHandler.py __RCSID__ = "$Id$" # @file RequestProxyHandler.py # @author Krzysztof.Ciba@NOSPAMgmail.com # @date 2012/07/20 13:18:58 # @brief Definition of RequestProxyHandler class. # # imports import os from types import DictType try: from hashlib import md5 except ImportError: from md5 import md5 # # from DIRAC from DIRAC import S_OK, S_ERROR, gLogger from DIRAC.Core.DISET.RequestHandler import RequestHandler from DIRAC.Core.DISET.RPCClient import RPCClient from DIRAC.<API key>.Client.Request import Request from DIRAC.Core.Utilities.ThreadScheduler import gThreadScheduler def <API key>( serviceInfo ): """ init RequestProxy handler :param serviceInfo: whatever """ gLogger.info( "Initalizing ReqProxyHandler" ) gThreadScheduler.addPeriodicTask( 120, ReqProxyHandler.sweeper ) return S_OK() class ReqProxyHandler( RequestHandler ): """ .. class:: ReqProxyHandler :param RPCCLient requestManager: a RPCClient to RequestManager :param str cacheDir: os.path.join( workDir, "requestCache" ) """ __requestManager = None __cacheDir = None def initialize( self ): """ service initialization :param self: self reference """ gLogger.notice( "CacheDirectory: %s" % self.cacheDir() ) return S_OK() @classmethod def requestManager( cls ): """ get request manager """ if not cls.__requestManager: cls.__requestManager = RPCClient( "RequestManagement/ReqManager" ) return cls.__requestManager @classmethod def cacheDir( cls ): """ get cache dir """ if not cls.__cacheDir: cls.__cacheDir = os.path.abspath( "requestCache" ) if not os.path.exists( cls.__cacheDir ): os.mkdir( cls.__cacheDir ) return cls.__cacheDir @classmethod def sweeper( cls ): """ move cached request to the central request manager :param self: self reference """ cacheDir = cls.cacheDir() # # cache dir empty? if not os.listdir( cacheDir ): gLogger.always( "sweeper: CacheDir %s is empty, nothing to do" % cacheDir ) return S_OK() else: # # read 10 cache dir files, the oldest first cachedRequests = [ os.path.abspath( requestFile ) for requestFile in sorted( filter( os.path.isfile, [ os.path.join( cacheDir, requestName ) for requestName in os.listdir( cacheDir ) ] ), key = os.path.getctime ) ][:10] # # set cached requests to the central RequestManager for cachedFile in cachedRequests: # # break if something went wrong last time try: requestString = "".join( open( cachedFile, "r" ).readlines() ) cachedRequest = eval( requestString ) cachedName = cachedRequest.get( "RequestName", "***UNKNOWN***" ) setRequest = cls.requestManager().putRequest( cachedRequest ) if not setRequest["OK"]: gLogger.error( "sweeper: unable to set request %s @ ReqManager: %s" % ( cachedName, setRequest["Message"] ) ) continue gLogger.info( "sweeper: successfully set request '%s' @ ReqManager" % cachedName ) os.unlink( cachedFile ) except Exception, error: gLogger.exception( "sweeper: hit by exception %s" % str( error ) ) return S_ERROR( "sweeper: hit by exception: %s" % str( error ) ) return S_OK() def __saveRequest( self, requestName, requestJSON ): """ save request string to the working dir cache :param self: self reference :param str requestName: request name :param str requestJSON: request serialized to JSON format """ try: requestFile = os.path.join( self.cacheDir(), md5( str( requestJSON ) ).hexdigest() ) request = open( requestFile, "w+" ) request.write( str( requestJSON ) ) request.close() return S_OK( requestFile ) except OSError, error: err = "unable to dump %s to cache file: %s" % ( requestName, str( error ) ) gLogger.exception( err ) return S_ERROR( err ) types_getStatus = [] def export_getStatus( self ): """ get number of requests in cache """ try: cachedRequests = len( os.listdir( self.cacheDir() ) ) except OSError, error: err = "getStatus: unable to list cache dir contents: %s" % str( error ) gLogger.exception( err ) return S_ERROR( err ) return S_OK( cachedRequests ) types_putRequest = [ DictType ] def export_putRequest( self, requestJSON ): """ forward request from local RequestDB to central RequestManager :param self: self reference :param str requestType: request type """ requestName = requestJSON.get( "RequestName", "***UNKNOWN***" ) gLogger.info( "setRequest: got request '%s'" % requestName ) forwardable = self.__forwardable( requestJSON ) if not forwardable["OK"]: gLogger.warn( "setRequest: %s" % forwardable["Message"] ) setRequest = self.requestManager().putRequest( requestJSON ) if not setRequest["OK"]: gLogger.error( "setReqeuest: unable to set request '%s' @ RequestManager: %s" % ( requestName, setRequest["Message"] ) ) # # put request to the request file cache save = self.__saveRequest( requestName, requestJSON ) if not save["OK"]: gLogger.error( "setRequest: unable to save request to the cache: %s" % save["Message"] ) return save gLogger.info( "setRequest: %s is saved to %s file" % ( requestName, save["Value"] ) ) return S_OK( { "set" : False, "saved" : True } ) gLogger.info( "setRequest: request '%s' has been set to the ReqManager" % ( requestName ) ) return S_OK( { "set" : True, "saved" : False } ) @staticmethod def __forwardable( requestJSON ): """ check if request if forwardable The sub-request of type transfer:putAndRegister, removal:physicalRemoval and removal:reTransfer are definitely not, they should be executed locally, as they are using local fs. :param str requestJSON: serialized request """ operations = requestJSON.get( "Operations", [] ) for operationDict in operations: if operationDict.get( "Type", "" ) in ( "PutAndRegister", "PhysicalRemoval", "ReTransfer" ): return S_ERROR( "found operation '%s' that cannot be forwarded" % operationDict.get( "Type", "" ) ) return S_OK()
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations from django.conf import settings class Migration(migrations.Migration): dependencies = [ migrations.<API key>(settings.AUTH_USER_MODEL), ('trans', '<API key>'), ] operations = [ migrations.CreateModel( name='Billing', fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), ], ), migrations.CreateModel( name='Plan', fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), ('name', models.CharField(unique=True, max_length=100)), ('price', models.IntegerField()), ('limit_strings', models.IntegerField()), ('limit_languages', models.IntegerField()), ('limit_repositories', models.IntegerField()), ('limit_projects', models.IntegerField()), ], options={ 'ordering': ['name'], }, ), migrations.AddField( model_name='billing', name='plan', field=models.ForeignKey(to='billing.Plan'), ), migrations.AddField( model_name='billing', name='projects', field=models.ManyToManyField(to='trans.Project', blank=True), ), migrations.AddField( model_name='billing', name='user', field=models.OneToOneField(to=settings.AUTH_USER_MODEL), ), ]
package com.aptana.ide.ui.io.navigator; import java.util.ArrayList; import java.util.List; import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.<API key>; import org.eclipse.core.resources.<API key>; import org.eclipse.core.resources.IResourceDelta; import org.eclipse.core.resources.IWorkspaceRoot; import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.jface.viewers.Viewer; import com.aptana.core.util.ArrayUtil; import com.aptana.ide.core.io.CoreIOPlugin; import com.aptana.ui.util.UIUtils; public class <API key> extends <API key> { private static final String LOCAL_SHORTCUTS_ID = "com.aptana.ide.core.io.localShortcuts"; //$NON-NLS-1$ private Viewer treeViewer; private <API key> resourceListener = new <API key>() { public void resourceChanged(<API key> event) { // project is closed or opened if (shouldUpdateActions(event.getDelta())) { UIUtils.getDisplay().asyncExec(new Runnable() { public void run() { treeViewer.setSelection(treeViewer.getSelection()); } }); } } }; public <API key>() { ResourcesPlugin.getWorkspace().<API key>(resourceListener, <API key>.POST_CHANGE); } @Override public void dispose() { ResourcesPlugin.getWorkspace().<API key>(resourceListener); super.dispose(); } @Override public Object[] getChildren(Object parentElement) { if (parentElement instanceof IResource) { return ArrayUtil.NO_OBJECTS; } return super.getChildren(parentElement); } @Override public Object[] getElements(Object inputElement) { if (inputElement instanceof IWorkspaceRoot) { List<Object> children = new ArrayList<Object>(); children.add(LocalFileSystems.getInstance()); children.add(CoreIOPlugin.<API key>().<API key>(LOCAL_SHORTCUTS_ID)); return children.toArray(new Object[children.size()]); } return super.getElements(inputElement); } @Override public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { treeViewer = viewer; super.inputChanged(viewer, oldInput, newInput); } private boolean shouldUpdateActions(IResourceDelta delta) { if (delta.getFlags() == IResourceDelta.OPEN) { return true; } IResourceDelta[] children = delta.getAffectedChildren(); for (IResourceDelta child : children) { if (shouldUpdateActions(child)) { return true; } } return false; } }
<pre class="<API key>"><code>util.uuid()</code></pre><p>Return a pseudo-<a href="http://en.wikipedia.org/wiki/<API key>">UUID</a>.</p>
require_relative "../client" require_relative "../request" require_relative "../response" module Vault class Client # A proxy to the {Sys} methods. # @return [Sys] def sys @sys ||= Sys.new(self) end end class Sys < Request; end end require_relative "sys/audit" require_relative "sys/<API key> "sys/init" require_relative "sys/leader" require_relative "sys/lease" require_relative "sys/mount" require_relative "sys/policy" require_relative "sys/seal"
<?php # Generated by the protocol buffer compiler. DO NOT EDIT! # source: google/cloud/language/v1beta2/language_service.proto namespace Google\Cloud\Language\V1beta2; use Google\Protobuf\Internal\GPBType; use Google\Protobuf\Internal\RepeatedField; use Google\Protobuf\Internal\GPBUtil; /** * The entity analysis request message. * * Generated from protobuf message <code>google.cloud.language.v1beta2.<API key></code> */ class <API key> extends \Google\Protobuf\Internal\Message { /** * Input document. * * Generated from protobuf field <code>.google.cloud.language.v1beta2.Document document = 1;</code> */ private $document = null; /** * The encoding type used by the API to calculate offsets. * * Generated from protobuf field <code>.google.cloud.language.v1beta2.EncodingType encoding_type = 2;</code> */ private $encoding_type = 0; public function __construct() { \GPBMetadata\Google\Cloud\Language\V1Beta2\LanguageService::initOnce(); parent::__construct(); } /** * Input document. * * Generated from protobuf field <code>.google.cloud.language.v1beta2.Document document = 1;</code> * @return \Google\Cloud\Language\V1beta2\Document */ public function getDocument() { return $this->document; } /** * Input document. * * Generated from protobuf field <code>.google.cloud.language.v1beta2.Document document = 1;</code> * @param \Google\Cloud\Language\V1beta2\Document $var * @return $this */ public function setDocument($var) { GPBUtil::checkMessage($var, \Google\Cloud\Language\V1beta2\Document::class); $this->document = $var; return $this; } /** * The encoding type used by the API to calculate offsets. * * Generated from protobuf field <code>.google.cloud.language.v1beta2.EncodingType encoding_type = 2;</code> * @return int */ public function getEncodingType() { return $this->encoding_type; } /** * The encoding type used by the API to calculate offsets. * * Generated from protobuf field <code>.google.cloud.language.v1beta2.EncodingType encoding_type = 2;</code> * @param int $var * @return $this */ public function setEncodingType($var) { GPBUtil::checkEnum($var, \Google\Cloud\Language\V1beta2\EncodingType::class); $this->encoding_type = $var; return $this; } }
package org.voltdb.groovy; import static java.lang.Character.toLowerCase; import static java.lang.Character.toUpperCase; import groovy.lang.Closure; import groovy.lang.GString; import groovy.lang.GroovyObjectSupport; import java.util.NavigableMap; import org.voltdb.VoltTable; import org.voltdb.VoltType; import com.google_voltpatches.common.collect.ImmutableSortedMap; /** * Groovy table access expediter. It allows you to easily navigate a VoltTable, * and access its column values. * <p> * Example usage on a query that returns results for the : * <code><pre> * cr = client.callProcedure('@AdHoc','select INTEGER_COL, STRING_COL from FOO') * tuplerator(cr.results[0]).eachRow { * * <API key> = it[0] * <API key> = it[1] * * <API key> = it['integerCol'] * <API key> = it['stringCol'] * * <API key> = it.integerCol * <API key> = it.stringCol * } * * </code></pre> * */ public class Tuplerator extends GroovyObjectSupport { private final VoltTable table; private final VoltType [] byIndex; private final NavigableMap<String, Integer> byName; public static Tuplerator newInstance(VoltTable table) { return new Tuplerator(table); } public Tuplerator(final VoltTable table) { this.table = table; this.byIndex = new VoltType[table.getColumnCount()]; ImmutableSortedMap.Builder<String, Integer> byNameBuilder = ImmutableSortedMap.naturalOrder(); for (int c = 0; c < byIndex.length; ++c) { VoltType cType = table.getColumnType(c); StringBuilder cName = new StringBuilder(table.getColumnName(c)); byIndex[c] = cType; boolean upperCaseIt = false; for (int i = 0; i < cName.length();) { char chr = cName.charAt(i); if (chr == '_' || chr == '.' || chr == '$') { cName.deleteCharAt(i); upperCaseIt = true; } else { chr = upperCaseIt ? toUpperCase(chr) : toLowerCase(chr); cName.setCharAt(i, chr); upperCaseIt = false; ++i; } } byNameBuilder.put(cName.toString(),c); } byName = byNameBuilder.build(); } /** * It calls the given closure on each row of the underlying table by passing itself * as the only closure parameter * * @param c the self instance of Tuplerator */ public void eachRow(Closure<Void> c) { while (table.advanceRow()) { c.call(this); } table.resetRowPosition(); } /** * It calls the given closure on each row of the underlying table for up to the specified limit, * by passing itself as the only closure parameter * * @param maxRows maximum rows to call the closure on * @param c closure */ public void eachRow(int maxRows, Closure<Void> c) { while (--maxRows >= 0 && table.advanceRow()) { c.call(this); } } public Object getAt(int cidx) { Object cval = table.get(cidx, byIndex[cidx]); if (table.wasNull()) cval = null; return cval; } public Object getAt(String cname) { Integer cidx = byName.get(cname); if (cidx == null) { throw new <API key>("No Column named '" + cname + "'"); } return getAt(cidx); } public Object getAt(GString cname) { return getAt(cname.toString()); } @Override public Object getProperty(String name) { return getAt(name); } /** * Sets the table row cursor to the given position * @param num row number to set the row cursor to * @return an instance of self */ public Tuplerator atRow(int num) { table.advanceToRow(num); return this; } /** * Resets the table row cursor * @return an instance of self */ public Tuplerator reset() { table.resetRowPosition(); return this; } /** * Returns the underlying table * @return the underlying table */ public VoltTable getTable() { return table; } }
<?php if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); function <API key>($fields) { static $mod_strings; if(empty($mod_strings)) { global $current_language; $mod_strings = <API key>($current_language, 'Campaigns'); } $overlib_string = ''; if(!empty($fields['START_DATE'])) $overlib_string .= '<b>'. $mod_strings['<API key>'] . '</b> ' . $fields['START_DATE'] . '<br>'; if(!empty($fields['TRACKER_TEXT'])) $overlib_string .= '<b>'. $mod_strings['LBL_TRACKER_TEXT'] . '</b> ' . $fields['TRACKER_TEXT'] . '<br>'; if(!empty($fields['REFER_URL'])) $overlib_string .= '<a target=_blank href='. $fields['REFER_URL'] . '>' . $fields['REFER_URL'] . '</a><br>'; if(!empty($fields['OBJECTIVE'])) { $overlib_string .= '<b>'. $mod_strings['<API key>'] . '</b> ' . substr($fields['OBJECTIVE'], 0, 300); if(strlen($fields['OBJECTIVE']) > 300) $overlib_string .= '...'; $overlib_string .= '<br>'; } if(!empty($fields['CONTENT'])) { $overlib_string .= '<b>'. $mod_strings['<API key>'] . '</b> ' . substr($fields['CONTENT'], 0, 300); if(strlen($fields['CONTENT']) > 300) $overlib_string .= '...'; } return array('fieldToAddTo' => 'NAME', 'string' => $overlib_string, 'editLink' => "index.php?action=EditView&module=Campaigns&return_module=Campaigns&record={$fields['ID']}", 'viewLink' => "index.php?action=DetailView&module=Campaigns&return_module=Campaigns&record={$fields['ID']}"); } ?>
/** * abstract class SlimeyAction - Actions on the editor * name: name of the action */ var SlimeyAction = function(name, slimey) { this.name = name; this.slimey = slimey; } /** * returns the action's name. */ SlimeyAction.prototype.getName = function() { return this.name; } /** * base perform() implementation */ SlimeyAction.prototype.perform = function() { } /** * base undo() implementation */ SlimeyAction.prototype.undo = function() { } /** * class SlimeyInsertAction - Handles insertion of new elements * tagname: HTML tagname of the element to be inserted */ var SlimeyInsertAction = function(slimey, tagname) { SlimeyAction.call(this, 'insert', slimey); var elem = this.slimey.editor.getContainer().ownerDocument.createElement(tagname); /* set element attributes */ elem.slimey = this.slimey; elem.className = 'slimeyElement'; elem.style.position = 'absolute'; elem.style.left = '40%'; elem.style.top = '30%'; elem.style.lineHeight = '1.'; elem.style.cursor = 'move'; elem.style.fontFamily = 'sans-serif'; elem.style.fontSize = '160%'; elem.style.margin = '0px'; elem.style.padding = '0px'; elem.style.border = '0px'; elem.style.zIndex = 10000; if (elem.tagName == 'DIV') { elem.style.left = '5%'; elem.style.top = '15%'; elem.style.width = '90%'; elem.style.height = '10%'; elem.innerHTML = lang("some text"); elem.style.textAlign = 'center'; elem.resizable = true; elem.editable = true; } else if (elem.tagName == 'IMG') { elem.style.width = '20%'; elem.style.height = '20%'; elem.resizable = true; elem.title = lang("drag the bottom right corner to resize"); } else { if (elem.tagName == 'UL') { elem.innerHTML = '<li>' + lang("some text") + '</li>'; } else if (elem.tagName == 'OL') { elem.innerHTML = '<li>' + lang("some text") + '</li>'; } else { elem.innerHTML = lang("some text"); } elem.editable = true; elem.title = lang("double click to edit content"); } /* event handlers */ setEventHandler(elem, "mousedown", slimeyDrag); setEventHandler(elem, "click", slimeyClick); setEventHandler(elem, "dblclick", slimeyEdit); setEventHandler(elem, "mouseover", slimeyHighlight); setEventHandler(elem, "mouseout", slimeyLowshadow); this.element = elem; } /** * SlimeyInsertAction extends SlimeyAction */ SlimeyInsertAction.prototype = new SlimeyAction(); SlimeyInsertAction.prototype.getElement = function() { return this.element; } /** * adds the created element to the editor */ SlimeyInsertAction.prototype.perform = function() { this.slimey.editor.getContainer().appendChild(this.element); } /** * removes the created element from the editor */ SlimeyInsertAction.prototype.undo = function() { this.slimey.editor.getContainer().removeChild(this.element); var selected = this.slimey.editor.getSelected(); if (selected == this.element) { this.slimey.editor.deselect(); } } /** * class <API key> - edits the contents of the selected element in the editor * content: HTML content to set to the element */ var <API key> = function(slimey, content, element) { SlimeyAction.call(this, 'editContent', slimey); if (element) { this.element = element; } else { this.element = this.slimey.editor.getSelected(); } this.content = content; } /** * SlimeyInsertAction extends SlimeyAction */ <API key>.prototype = new SlimeyAction(); /** * edits the contents of the selected item in the editor */ <API key>.prototype.perform = function() { this.previousContent = this.element.innerHTML; this.element.innerHTML = this.content; } /** * restores the elements original content */ <API key>.prototype.undo = function() { this.element.innerHTML = this.previousContent; } /** * class <API key> - edits a style property of the selected element in the editor * property: CSS property to be modified (i.e. fontFamily) * value: Value to set to the property (i.e. sans-serif) */ var <API key> = function(slimey, property, value) { SlimeyAction.call(this, 'editStyle', slimey); this.element = this.slimey.editor.getSelected(); this.property = property; this.value = value; } /** * SlimeyInsertAction extends SlimeyAction */ <API key>.prototype = new SlimeyAction(); /** * edits the contents of the selected item in the editor */ <API key>.prototype.perform = function() { this.previousValue = this.element.style[this.property]; this.element.style[this.property] = this.value; } /** * restores the elements original content */ <API key>.prototype.undo = function() { this.element.style[this.property] = this.previousValue; } /** * class SlimeyDeleteAction - Deletes the selected element */ var SlimeyDeleteAction = function(slimey) { SlimeyAction.call(this, 'delete', slimey); var selected = this.slimey.editor.getSelected(); this.element = selected; } /** * SlimeyDeleteAction extends SlimeyAction */ SlimeyDeleteAction.prototype = new SlimeyAction(); /** * removes the selected element from the editor */ SlimeyDeleteAction.prototype.perform = function() { this.slimey.editor.getContainer().removeChild(this.element); this.slimey.editor.deselect(); } /** * adds the previously deleted element to the editor */ SlimeyDeleteAction.prototype.undo = function() { this.slimey.editor.getContainer().appendChild(this.element); } /** * class SlimeyMoveAction - Moves the selected element * newx: new horizontal position * newy: new vertical position * oldx: (optional) previous horizontal position if different than current * oldy: (optional) previous vertical position if different than current */ var SlimeyMoveAction = function(slimey, newx, newy, oldx, oldy) { SlimeyAction.call(this, 'move', slimey); var selected = this.slimey.editor.getSelected(); this.newx = newx; this.newy = newy; if (oldx) { this.oldx = oldx; } else { this.oldx = selected.style.left; } if (oldy) { this.oldy = oldy; } else { this.oldy = selected.style.top; } this.element = selected; } /** * SlimeyMoveAction extends SlimeyAction */ SlimeyMoveAction.prototype = new SlimeyAction(); /** * moves the selected element to the new position */ SlimeyMoveAction.prototype.perform = function() { this.element.style.left = this.newx; this.element.style.top = this.newy; } /** * returns the moved element to its original position */ SlimeyMoveAction.prototype.undo = function() { this.element.style.left = this.oldx; this.element.style.top = this.oldy; } /** * class SlimeyResizeAction - Resizes the selected element * neww: new width * newh: new height * oldw: (optional) previous width if different than current * oldh: (optional) previous height if different than current */ var SlimeyResizeAction = function(slimey, neww, newh, oldw, oldh) { SlimeyAction.call(this, 'resize', slimey); var selected = this.slimey.editor.getSelected(); this.neww = neww; this.newh = newh; if (oldw) { this.oldw = oldw; } else { this.oldw = selected.style.width; } if (oldh) { this.oldh = oldh; } else { this.oldh = selected.style.height; } this.element = selected; } /** * SlimeyResizeAction extends SlimeyAction */ SlimeyResizeAction.prototype = new SlimeyAction(); /** * resizes the selected element */ SlimeyResizeAction.prototype.perform = function() { this.element.style.width = this.neww; this.element.style.height = this.newh; } /** * returns the element to its original size */ SlimeyResizeAction.prototype.undo = function() { this.element.style.width = this.oldw; this.element.style.height = this.oldh; } /** * class <API key> - Sends the selected element to the back */ var <API key> = function(slimey) { SlimeyAction.call(this, 'sendToBack', slimey); var selected = this.slimey.editor.getSelected(); this.element = selected; } /** * <API key> extends SlimeyAction */ <API key>.prototype = new SlimeyAction(); /** * sends the selected element to the back */ <API key>.prototype.perform = function() { var minZ = 100000000; for (var elem = this.slimey.editor.getContainer().firstChild; elem; elem = elem.nextSibling) { if (elem.nodeType == 1) { thisZ = parseInt(elem.style.zIndex); if (thisZ < minZ) { minZ = thisZ; } } } this.oldZ = this.element.style.zIndex; this.element.style.zIndex = minZ - 1; } /** * sends the selected element back ot the previous z-index */ <API key>.prototype.undo = function() { this.element.style.zIndex = this.oldZ; } /** * class <API key> - Brings the selected element to the front */ var <API key> = function(slimey) { SlimeyAction.call(this, 'bringToFront', slimey); var selected = this.slimey.editor.getSelected(); this.element = selected; } /** * <API key> extends SlimeyAction */ <API key>.prototype = new SlimeyAction(); /** * brings the selected element to the front */ <API key>.prototype.perform = function() { var maxZ = 0; for (var elem = this.slimey.editor.getContainer().firstChild; elem; elem = elem.nextSibling) { if (elem.nodeType == 1) { thisZ = parseInt(elem.style.zIndex); if (thisZ > maxZ) { maxZ = thisZ; } } } this.oldZ = this.element.style.zIndex; this.element.style.zIndex = maxZ + 1; } /** * returns the element to its original z-index */ <API key>.prototype.undo = function() { this.element.style.zIndex = this.oldZ; } /** * class <API key> - Changes the current slide * num: Slide number to change to */ var <API key> = function(slimey, num) { SlimeyAction.call(this, 'changeSlide', slimey); this.num = num; } /** * <API key> extends SlimeyAction */ <API key>.prototype = new SlimeyAction(); /** * changes the current slide */ <API key>.prototype.perform = function() { this.previousSlide = this.slimey.navigation.currentSlide; this.slimey.navigation.getSlide(this.num); } /** * returns to the previous slide */ <API key>.prototype.undo = function() { this.slimey.navigation.getSlide(this.previousSlide); } /** * class <API key> - Inserts a new slide * num: Position where to insert the new slide */ var <API key> = function(slimey, num) { SlimeyAction.call(this, 'insertSlide', slimey); this.num = num; } /** * <API key> extends SlimeyAction */ <API key>.prototype = new SlimeyAction(); /** * insert the new slide */ <API key>.prototype.perform = function() { this.slimey.navigation.insertNewSlide(this.num); } /** * remove the inserted slide */ <API key>.prototype.undo = function() { this.slimey.navigation.deleteSlide(this.num); } /** * class <API key> - Deletes the current slide * num: Number of the slide to be deleted */ var <API key> = function(slimey, num) { SlimeyAction.call(this, 'deleteSlide', slimey); this.num = num; } /** * <API key> extends SlimeyAction */ <API key>.prototype = new SlimeyAction(); /** * delete the current slide */ <API key>.prototype.perform = function() { this.html = this.slimey.editor.getHTML(); this.dom = document.createElement('div'); this.slimey.editor.getDOM(this.dom); this.slimey.navigation.deleteSlide(this.num); } /** * reinsert the deleted slide */ <API key>.prototype.undo = function() { this.slimey.navigation.insertNewSlide(this.num, this.html, this.dom); } /** * class <API key> - Moves the current slide to a new position * from: Number of the slide to be moved * to: The new position of the slide */ var <API key> = function(slimey, from, to) { SlimeyAction.call(this, 'moveSlide', slimey); this.from = from; this.to = to; } /** * <API key> extends SlimeyAction */ <API key>.prototype = new SlimeyAction(); /** * move the slide to the new position */ <API key>.prototype.perform = function() { this.slimey.navigation.moveSlide(this.from, this.to); } /** * move the slide back to its original position */ <API key>.prototype.undo = function() { this.slimey.navigation.moveSlide(this.to, this.from); }
# This file is part of Canvas. # Canvas is free software: you can redistribute it and/or modify it under # Canvas is distributed in the hope that it will be useful, but WITHOUT ANY # details. require File.expand_path(File.dirname(__FILE__) + '/api_spec_helper') require 'nokogiri' describe UserContent, type: :request do before :once do course_with_teacher(:active_all => true) attachment_model end it "should translate course file download links to <API key> urls" do @assignment = @course.assignments.create!(:title => "first assignment", :description => <<-HTML) <p> Hello, students.<br> This will explain everything: <img src="/courses/#{@course.id}/files/#{@attachment.id}/download" alt="important"> </p> HTML json = api_call(:get, "/api/v1/courses/#{@course.id}/assignments/#{@assignment.id}", { :controller => 'assignments_api', :action => 'show', :format => 'json', :course_id => @course.id.to_s, :id => @assignment.id.to_s }) doc = Nokogiri::HTML::DocumentFragment.parse(json['description']) expect(doc.at_css('img')['src']).to eq "http://www.example.com/courses/#{@course.id}/files/#{@attachment.id}/download?verifier=#{@attachment.uuid}" end it "should translate group file download links to <API key> urls" do @group = @course.groups.create!(:name => "course group") attachment_model(:context => @group) @group.add_user(@teacher) @group_topic = @group.discussion_topics.create!(:title => "group topic", :user => @teacher, :message => <<-HTML) <p> Hello, students.<br> This will explain everything: <img src="/groups/#{@group.id}/files/#{@attachment.id}/download" alt="important"> </p> HTML json = api_call(:get, "/api/v1/groups/#{@group.id}/discussion_topics/#{@group_topic.id}", { :controller => '<API key>', :action => 'show', :format => 'json', :group_id => @group.id.to_s, :topic_id => @group_topic.id.to_s }) doc = Nokogiri::HTML::DocumentFragment.parse(json['message']) expect(doc.at_css('img')['src']).to eq "http://www.example.com/groups/#{@group.id}/files/#{@attachment.id}/download?verifier=#{@attachment.uuid}" end it "should translate file download links to <API key> urls for deleted and replaced files" do @attachment.destroy attachment2 = Attachment.create!(:folder => @attachment.folder, :context => @attachment.context, :filename => @attachment.filename, :uploaded_data => StringIO.new("first")) expect(@context.attachments.find(@attachment.id).id).to eq attachment2.id @assignment = @course.assignments.create!(:title => "first assignment", :description => <<-HTML) <p> Hello, students.<br> This will explain everything: <img src="/courses/#{@course.id}/files/#{@attachment.id}/download" alt="important"> </p> HTML json = api_call(:get, "/api/v1/courses/#{@course.id}/assignments/#{@assignment.id}", { :controller => 'assignments_api', :action => 'show', :format => 'json', :course_id => @course.id.to_s, :id => @assignment.id.to_s }) doc = Nokogiri::HTML::DocumentFragment.parse(json['description']) expect(doc.at_css('img')['src']).to eq "http://www.example.com/courses/#{@course.id}/files/#{attachment2.id}/download?verifier=#{attachment2.uuid}" end it "should not corrupt absolute links" do attachment_model(:context => @course) @topic = @course.discussion_topics.create!(:title => "course topic", :user => @teacher, :message => <<-HTML) <p> Hello, students.<br> This will explain everything: <img src="http://www.example.com/courses/#{@course.id}/files/#{@attachment.id}/download" alt="important"> </p> HTML json = api_call(:get, "/api/v1/courses/#{@course.id}/discussion_topics/#{@topic.id}", { :controller => '<API key>', :action => 'show', :format => 'json', :course_id => @course.id.to_s, :topic_id => @topic.id.to_s }) doc = Nokogiri::HTML::DocumentFragment.parse(json['message']) expect(doc.at_css('img')['src']).to eq "http://www.example.com/courses/#{@course.id}/files/#{@attachment.id}/download?verifier=#{@attachment.uuid}" end it "should not remove wrap parameter on file download links" do attachment_model(:context => @course) @topic = @course.discussion_topics.create!(:title => "course topic", :user => @teacher, :message => <<-HTML) <p> Hello, students.<br> This will explain everything: <img src="/courses/#{@course.id}/files/#{@attachment.id}/download?wrap=1" alt="important"> </p> HTML json = api_call(:get, "/api/v1/courses/#{@course.id}/discussion_topics/#{@topic.id}", { :controller => '<API key>', :action => 'show', :format => 'json', :course_id => @course.id.to_s, :topic_id => @topic.id.to_s }) doc = Nokogiri::HTML::DocumentFragment.parse(json['message']) expect(doc.at_css('img')['src']).to eq "http://www.example.com/courses/#{@course.id}/files/#{@attachment.id}/download?verifier=#{@attachment.uuid}&wrap=1" end it "should translate file preview links to <API key> preview urls" do @assignment = @course.assignments.create!(:title => "first assignment", :description => <<-HTML) <p> Hello, students.<br> This will explain everything: <img src="/courses/#{@course.id}/files/#{@attachment.id}/preview" alt="important"> </p> HTML json = api_call(:get, "/api/v1/courses/#{@course.id}/assignments/#{@assignment.id}", { :controller => 'assignments_api', :action => 'show', :format => 'json', :course_id => @course.id.to_s, :id => @assignment.id.to_s }) doc = Nokogiri::HTML::DocumentFragment.parse(json['description']) expect(doc.at_css('img')['src']).to eq "http://www.example.com/courses/#{@course.id}/files/#{@attachment.id}/preview?verifier=#{@attachment.uuid}" end it "should translate media comment links to embedded video tags" do @assignment = @course.assignments.create!(:title => "first assignment", :description => <<-HTML) <p> Hello, students.<br> Watch this awesome video: <a href="/media_objects/qwerty" class="<API key> video_comment" id="<API key>"><img></a> </p> HTML json = api_call(:get, "/api/v1/courses/#{@course.id}/assignments/#{@assignment.id}", { :controller => 'assignments_api', :action => 'show', :format => 'json', :course_id => @course.id.to_s, :id => @assignment.id.to_s }) doc = Nokogiri::HTML::DocumentFragment.parse(json['description']) video = doc.at_css('video') expect(video).to be_present expect(video['class']).to match(/\<API key>\b/) expect(video['<API key>']).to eq 'video' expect(video['<API key>']).to eq 'qwerty' expect(video['poster']).to match(%r{http: expect(video['src']).to match(%r{http://www.example.com/courses/#{@course.id}/media_download}) expect(video['src']).to match(%r{entryId=qwerty}) # we leave width/height out of it, since browsers tend to have good # defaults and it makes it easier to set via client css rules expect(video['width']).to be_nil expect(video['height']).to be_nil end it "should translate media comment audio tags" do @assignment = @course.assignments.create!(:title => "first assignment", :description => <<-HTML) <p> Hello, students.<br> Listen up: <a href="/media_objects/abcde" class="<API key> audio_comment" id="media_comment_abcde"><img></a> </p> HTML json = api_call(:get, "/api/v1/courses/#{@course.id}/assignments/#{@assignment.id}", { :controller => 'assignments_api', :action => 'show', :format => 'json', :course_id => @course.id.to_s, :id => @assignment.id.to_s }) doc = Nokogiri::HTML::DocumentFragment.parse(json['description']) audio = doc.at_css('audio') expect(audio).to be_present expect(audio['class']).to match(/\<API key>\b/) expect(audio['<API key>']).to eq 'audio' expect(audio['<API key>']).to eq 'abcde' expect(audio['poster']).to be_blank expect(audio['src']).to match(%r{http://www.example.com/courses/#{@course.id}/media_download}) expect(audio['src']).to match(%r{entryId=abcde}) end it "should not translate links in content not viewable by user" do @assignment = @course.assignments.create!(:title => "first assignment", :description => <<-HTML) <p> Hello, students.<br> This will explain everything: <img src="/courses/#{@course.id}/files/#{@attachment.id}/preview" alt="important"> </p> HTML # put a student in the course. this will be the active user during the API # call (necessary since the teacher has manage content rights and will thus # ignore the lock). lock the attachment so the student can't view it. student_in_course(:course => @course, :active_all => true) @attachment.locked = true @attachment.save json = api_call(:get, "/api/v1/courses/#{@course.id}/assignments/#{@assignment.id}", { :controller => 'assignments_api', :action => 'show', :format => 'json', :course_id => @course.id.to_s, :id => @assignment.id.to_s }) doc = Nokogiri::HTML::DocumentFragment.parse(json['description']) expect(doc.at_css('img')['src']).to eq "http://www.example.com/courses/#{@course.id}/files/#{@attachment.id}/preview" end it "should prepend the hostname to all absolute-path links" do @assignment = @course.assignments.create!(:title => "first assignment", :description => <<-HTML) <p> Hello, students.<br> <img src='/equation_images/1234'> <a href='/help'>click for teh help</a> <a href='//example.com/quiz'>a quiz</a> <a href='http://example.com/test1'>moar</a> <a href='invalid url'>broke</a> </p> HTML json = api_call(:get, "/api/v1/courses/#{@course.id}/assignments/#{@assignment.id}", { :controller => 'assignments_api', :action => 'show', :format => 'json', :course_id => @course.id.to_s, :id => @assignment.id.to_s }) doc = Nokogiri::HTML::DocumentFragment.parse(json['description']) expect(doc.at_css('img')['src']).to eq "http: expect(doc.css('a').map { |e| e['href'] }).to eq [ "http: "//example.com/quiz", "http://example.com/test1", "invalid%20url", ] end it "should not choke on funny email addresses" do @wiki_page = @course.wiki.wiki_pages.build(:title => "title") @wiki_page.body = "<a href='mailto:djmankiewicz@homestarrunner,com'>e-nail</a>" @wiki_page.workflow_state = 'active' @wiki_page.save! api_call(:get, "/api/v1/courses/#{@course.id}/pages/#{@wiki_page.url}", { :controller => 'wiki_pages_api', :action => 'show', :format => 'json', :course_id => @course.id.to_s, :url => @wiki_page.url }) end context "data api endpoints" do context "course context" do it "should process links to each type of object" do @wiki_page = @course.wiki.wiki_pages.build(:title => "title") @wiki_page.body = <<-HTML <p> <a href='/courses/#{@course.id}/assignments'>assignments index</a> <a href='/courses/#{@course.id}/assignments/9~123'>assignment</a> <a href='/courses/#{@course.id}/wiki'>wiki index</a> <a href='/courses/#{@course.id}/wiki/test-wiki-page'>wiki page</a> <a href='/courses/#{@course.id}/wiki/test-wiki-page-2?titleize=0'>wiki page</a> <a href='/courses/#{@course.id}/pages'>wiki index</a> <a href='/courses/#{@course.id}/pages/test-wiki-page'>wiki page</a> <a href='/courses/#{@course.id}/pages/test-wiki-page-2?titleize=0'>wiki page</a> <a href='/courses/#{@course.id}/discussion_topics'>discussion index</a> <a href='/courses/#{@course.id}/discussion_topics/456'>discussion topic</a> <a href='/courses/#{@course.id}/files'>files index</a> <a href='/courses/#{@course.id}/files/789/download?verifier=lolcats'>files index</a> <a href='/files/789/download?verifier=lolcats'>file</a> <a href='/courses/#{@course.id}/quizzes'>quiz index</a> <a href='/courses/#{@course.id}/quizzes/999'>quiz</a> <a href='/courses/#{@course.id}/modules'>modules index</a> <a href='/courses/#{@course.id}/modules/1024'>module</a> <a href='/courses/ </p> HTML @wiki_page.workflow_state = 'active' @wiki_page.save! json = api_call(:get, "/api/v1/courses/#{@course.id}/pages/#{@wiki_page.url}", { :controller => 'wiki_pages_api', :action => 'show', :format => 'json', :course_id => @course.id.to_s, :url => @wiki_page.url }) doc = Nokogiri::HTML::DocumentFragment.parse(json['body']) expect(doc.css('a').collect { |att| att['data-api-endpoint'] }).to eq [ "http://www.example.com/api/v1/courses/#{@course.id}/assignments", "http://www.example.com/api/v1/courses/#{@course.id}/assignments/9~123", "http://www.example.com/api/v1/courses/#{@course.id}/pages", "http://www.example.com/api/v1/courses/#{@course.id}/pages/test-wiki-page", "http://www.example.com/api/v1/courses/#{@course.id}/pages/test-wiki-page-2", "http://www.example.com/api/v1/courses/#{@course.id}/pages", "http://www.example.com/api/v1/courses/#{@course.id}/pages/test-wiki-page", "http://www.example.com/api/v1/courses/#{@course.id}/pages/test-wiki-page-2", "http://www.example.com/api/v1/courses/#{@course.id}/discussion_topics", "http://www.example.com/api/v1/courses/#{@course.id}/discussion_topics/456", "http://www.example.com/api/v1/courses/#{@course.id}/folders/root", "http://www.example.com/api/v1/courses/#{@course.id}/files/789", "http: "http://www.example.com/api/v1/courses/#{@course.id}/quizzes", "http://www.example.com/api/v1/courses/#{@course.id}/quizzes/999", "http://www.example.com/api/v1/courses/#{@course.id}/modules", "http://www.example.com/api/v1/courses/#{@course.id}/modules/1024", "http://www.example.com/api/v1/courses/#{@course.id}/external_tools/sessionless_launch?url=http%3A%2F%2Flti-tool-provider.example.com%2Flti_tool" ] expect(doc.css('a').collect { |att| att['data-api-returntype'] }).to eq( %w([Assignment] Assignment [Page] Page Page [Page] Page Page [Discussion] Discussion Folder File File [Quiz] Quiz [Module] Module <API key>) ) end end context "group context" do it "should process links to each type of object" do group_with_user(:active_all => true) @wiki_page = @group.wiki.wiki_pages.build(:title => "title") @wiki_page.body = <<-HTML <p> <a href='/groups/#{@group.id}/wiki'>wiki index</a> <a href='/groups/#{@group.id}/wiki/some-page'>wiki page</a> <a href='/groups/#{@group.id}/pages'>wiki index</a> <a href='/groups/#{@group.id}/pages/some-page'>wiki page</a> <a href='/groups/#{@group.id}/discussion_topics'>discussion index</a> <a href='/groups/#{@group.id}/discussion_topics/1~123'>discussion topic</a> <a href='/groups/#{@group.id}/files'>files index</a> <a href='/groups/#{@group.id}/files/789/preview'>file</a> </p> HTML @wiki_page.workflow_state = 'active' @wiki_page.save! json = api_call(:get, "/api/v1/groups/#{@group.id}/pages/#{@wiki_page.url}", { :controller => 'wiki_pages_api', :action => 'show', :format => 'json', :group_id => @group.id.to_s, :url => @wiki_page.url }) doc = Nokogiri::HTML::DocumentFragment.parse(json['body']) expect(doc.css('a').collect { |att| att['data-api-endpoint'] }).to eq [ "http://www.example.com/api/v1/groups/#{@group.id}/pages", "http://www.example.com/api/v1/groups/#{@group.id}/pages/some-page", "http://www.example.com/api/v1/groups/#{@group.id}/pages", "http://www.example.com/api/v1/groups/#{@group.id}/pages/some-page", "http://www.example.com/api/v1/groups/#{@group.id}/discussion_topics", "http://www.example.com/api/v1/groups/#{@group.id}/discussion_topics/1~123", "http://www.example.com/api/v1/groups/#{@group.id}/folders/root", "http://www.example.com/api/v1/groups/#{@group.id}/files/789" ] expect(doc.css('a').collect{ |att| att['data-api-returntype'] }).to eq( %w([Page] Page [Page] Page [Discussion] Discussion Folder File) ) end end context "user context" do it "should process links to each type of object" do @topic = @course.discussion_topics.create!(:message => <<-HTML) <a href='/users/#{@teacher.id}/files'>file index</a> <a href='/users/#{@teacher.id}/files/789/preview'>file</a> HTML json = api_call(:get, "/api/v1/courses/#{@course.id}/discussion_topics/#{@topic.id}", :controller => '<API key>', :action => 'show', :format => 'json', :course_id => @course.id.to_s, :topic_id => @topic.id.to_s) doc = Nokogiri::HTML::DocumentFragment.parse(json['message']) expect(doc.css('a').collect { |att| att['data-api-endpoint'] }).to eq [ "http://www.example.com/api/v1/users/#{@teacher.id}/folders/root", "http://www.example.com/api/v1/users/#{@teacher.id}/files/789" ] expect(doc.css('a').collect { |att| att['data-api-returntype'] }).to eq( %w(Folder File) ) end end end context "<API key>" do class Tester include Api end let(:tester) { Tester.new } it "should add the expected href to <API key> anchors" do <API key>(MediaObject, media_id: 'test2', media_type: 'audio') html = tester.<API key>(<<-HTML) <a id='something-else' href='/blah'>no touchy</a> <a class='<API key> audio_comment'>no id</a> <a id='media_comment_test1' class='<API key> audio_comment'>with id</a> <a id='media_comment_test2' class='<API key>'>id, no type</a> <a id='media_comment_test3' class='<API key>'>id, no type, missing object</a> HTML doc = Nokogiri::HTML::DocumentFragment.parse(html) anchors = doc.css('a') expect(anchors[0]['id']).to eq 'something-else' expect(anchors[0]['href']).to eq '/blah' expect(anchors[1]['href']).to be_nil expect(anchors[2]['href']).to eq '/media_objects/test1' expect(anchors[2]['class']).to eq '<API key> audio_comment' expect(anchors[3]['class']).to eq '<API key> audio_comment' # media_type added by code expect(anchors[3]['href']).to eq '/media_objects/test2' expect(anchors[4]['class']).to eq '<API key>' # media object not found, no type added expect(anchors[4]['href']).to eq '/media_objects/test3' end it "should translate video and audio <API key> tags" do html = tester.<API key>(<<-HTML) <video src='/other'></video> <video class='<API key>' src='/some/redirect/url'>no media id</video> <video class='<API key>' src='/some/redirect/url' <API key>='test1'>with media id</video> <audio class='<API key>' src='/some/redirect/url' <API key>='test2'>with media id</video> HTML doc = Nokogiri::HTML::DocumentFragment.parse(html) tags = doc.css('audio,video,a') expect(tags[0].name).to eq 'video' expect(tags[0]['src']).to eq '/other' expect(tags[0]['class']).to be_nil expect(tags[1].name).to eq 'video' expect(tags[2].name).to eq 'a' expect(tags[2]['class']).to eq '<API key> video_comment' expect(tags[2]['href']).to eq '/media_objects/test1' expect(tags[2]['id']).to eq 'media_comment_test1' expect(tags[3].name).to eq 'a' expect(tags[3]['class']).to eq '<API key> audio_comment' expect(tags[3]['href']).to eq '/media_objects/test2' expect(tags[3]['id']).to eq 'media_comment_test2' end context "with verified user-context file links" do before do user attachment_model :context => @user end def <API key>(url) link = %Q{<a href="#{url}">what</a>} html = tester.<API key>(link) doc = Nokogiri::HTML::DocumentFragment.parse(html) expect(doc.at_css('a')['href']).to eq url end it "ignores them when scoped to the file" do url = "/files/#{@attachment.id}/download?verifier=#{@attachment.uuid}" <API key>(url) end it "ignores them when scoped to the user" do url = "/users/#{@user.id}/files/#{@attachment.id}/download?verifier=#{@attachment.uuid}" <API key>(url) end end context "with verified user-context file links" do before do user attachment_model :context => @user end def <API key>(url) link = %Q{<a href="#{url}">what</a>a>} html = tester.<API key>(link) doc = Nokogiri::HTML::DocumentFragment.parse(html) expect(doc.at_css('a')['href']).to eq url end it "ignores them when scoped to the file" do url = "/files/#{@attachment.id}/download?verifier=#{@attachment.uuid}" <API key>(url) end it "ignores them when scoped to the user" do url = "/users/#{@user.id}/files/#{@attachment.id}/download?verifier=#{@attachment.uuid}" <API key>(url) end it "ignores them when they include the host" do url = "http://somedomain.instructure.com/files/#{@attachment.id}/download?verifier=#{@attachment.uuid}" <API key>(url) end end end describe ".<API key>" do it "returns a hash of assignment_id => assignment" do a1, a2, a3 = attachment_model, attachment_model, attachment_model html1, html2 = <<-HTML1, <<-HTML2 <a href="/courses/#{@course.id}/files/#{a1.id}/download">uh...</a> <img src="/courses/#{@course.id}/files/#{a2.id}/download"> HTML1 <a href="/courses/#{@course.id}/files/#{a3.id}/download">Hi</a> HTML2 class ApiClass include Api end expect(ApiClass.new.<API key>( [html1, html2], @course )).to eq({a1.id => a1, a2.id => a2, a3.id => a3}) end end describe "latex_to_mathml" do it "returns mathml on success" do valid_latex = '\frac{a}{b}' expect(UserContent.latex_to_mathml(valid_latex)).to eql(%{<math xmlns="http: end it "returns empty string on parse error" do invalid_latex = '\frac{a}{' expect(UserContent.latex_to_mathml(invalid_latex)).to eql('') end end describe "escape" do describe "with equation images" do context "valid latex" do before do @latex = '\frac{a}{b}' @html = "<img class='equation_image' alt='#{@latex}' />" end it "retains the alt attribute" do escaped = UserContent.escape(@html) node = Nokogiri::HTML::DocumentFragment.parse(escaped).css("img").first expect(node['alt']).to eql(@latex) end it "adds mathml in a span" do escaped = UserContent.escape(@html) node = Nokogiri::HTML::DocumentFragment.parse(escaped).css("img").first.next_sibling expect(node.node_name).to eql("span") expect(node.inner_html).to eql(Ritex::Parser.new.parse(@latex)) end end context "invalid latex" do before do @latex = '\frac{a}{' # incomplete @html = "<img class='equation_image' alt='#{@latex}' />" end it "handles error gracefully" do expect{ UserContent.escape(@html) }.not_to raise_error end it "retains the alt attribute" do escaped = UserContent.escape(@html) node = Nokogiri::HTML::DocumentFragment.parse(escaped).css("img").first expect(node['alt']).to eql(@latex) end it "doesn't add mathml span" do escaped = UserContent.escape(@html) node = Nokogiri::HTML::DocumentFragment.parse(escaped).css("span").first expect(node).to be_nil end end end end end
#include "bench_framework.hpp" #include <mapnik/image_util.hpp> class test : public benchmark::test_case { mapnik::image_rgba8 im_; public: test(mapnik::parameters const& params) : test_case(params), im_(256,256) {} bool validate() const { return true; } bool operator()() const { std::string out; for (std::size_t i=0;i<iterations_;++i) { out.clear(); out = mapnik::save_to_string(im_,"png8:m=h:z=1"); } return true; } }; BENCHMARK(test,"encoding blank png")
#ifndef FMULTIMAP_H #define FMULTIMAP_H #ifdef MULTIMAP_H #undef MULTIMAP_H #undef TREE_H #define <API key> #endif #define Allocator far_allocator #define multimap far_multimap #define rb_tree far_rb_tree #include <faralloc.h> #include <multimap.h> #undef MULTIMAP_H #undef TREE_H #ifdef <API key> #define MULTIMAP_H #define TREE_H #undef <API key> #endif #undef Allocator #undef multimap #undef rb_tree #endif
package dr.app.beauti.types; /** * @author Marc A. Suchard */ public enum <API key> { NORMAL_HPM, LOGNORMAL_HPM; public String toString() { switch (this) { case NORMAL_HPM: return "Normal"; case LOGNORMAL_HPM: return "Lognormal"; default: return ""; } } }
#ifndef CS_HTTPCONNECT_H #define CS_HTTPCONNECT_H #include "bytestream.h" // CS_NAMESPACE_BEGIN class HttpConnect : public ByteStream { Q_OBJECT public: enum Error { <API key> = ErrCustom, ErrHostNotFound, ErrProxyConnect, ErrProxyNeg, ErrProxyAuth }; HttpConnect(QObject *parent=0); ~HttpConnect(); void setAuth(const QString &user, const QString &pass=""); void connectToHost(const QString &proxyHost, int proxyPort, const QString &host, int port); // from ByteStream void close(); qint64 bytesToWrite() const; protected: qint64 writeData(const char *data, qint64 maxSize); signals: void connected(); private slots: void sock_connected(); void <API key>(); void <API key>(); void sock_readyRead(); void sock_bytesWritten(qint64); void sock_error(int); private: class Private; Private *d; void resetConnection(bool clear=false); }; // CS_NAMESPACE_END #endif
using System; namespace AutoTest.VM { class LaunchArguments { public Guid CorrelationId { get; private set; } public int Port { get; private set; } public string WatchPath { get; private set; } public bool Debug { get; private set; } public int OwnerPort { get; private set; } public bool IsGlobal { get; private set; } public int MasterProcessId { get; private set; } public string ConfigPath { get; private set; } public LaunchArguments(Guid correlationId, int port, string watchPath, string debug, int ownerPort, string runProfile, int masterProcessId, string configPath) { CorrelationId = correlationId; Port = port; WatchPath = watchPath; Debug = (debug == "debug"); OwnerPort = ownerPort; IsGlobal = (runProfile == "global"); MasterProcessId = masterProcessId; ConfigPath = configPath; } } }
html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,font,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td{ margin:0;padding:0;border:0;outline:0;font-size:100%;vertical-align:baseline;background:transparent} .menu{ width:238px;position:fixed!important;_position:absolute;overflow:visible;display:block;z-index:10000;border-bottom:1px solid #ccc;font-family: 'Microsoft YaHei,';_position:absolute;_left:expression(eval(document.documentElement.scrollLeft));_top:expression(eval(document.documentElement.scrollTop));zoom:1; -left:243px; top:93px; box-shadow:4px 2px 5px rgba(0, 0, 0, 0.2);} .menu .title{ position:relative;font-weight:bold;font-family:Microsoft YaHei;font-size:13px;color:#fff;background-color:#a21c1d;height:30px;line-height:30px;padding-left:15px;padding-right:8px} body,html{ background:#000; } .top{ width:100%; height:93px; background:#B20000;} .main{ width:930px; background:#FFF; height:2600px;margin:0 0 0 238px; padding-left:10px; } .menu .items{ width:238px;overflow:hidden; position:relative; z-index:6;} .top .middle{ width:1168px; height:100%; margin:0 auto;} .top .middle .logo{ padding-top:50px;} .wrap{ width:1178px; margin:0 auto; position:relative;} .menu .items ul{ list-style:none} a img{ border:none;} .menu .items ul li{ display:block;position:relative;padding-left:10px;background:#fff;line-height:30px;cursor:pointer; float:left; width:100%;} .menu .items h3{ padding-left:30px;font-weight:bold;font-family:Microsoft YaHei;font-size:12px} .menu .items ul li.alt{ background:#f1f1f1} .menu .items ul li.curr{ background:#6c5143;color:#fff;cursor:pointer;border-top:1px solid #6c5143;border-bottom:1px solid #6c5143} .menu .items ul li p{ line-height:20px;font-size:12px;display:block} .menu .items ul li p a{ color:#888;text-decoration:none;padding:0 2px;line-height:25px;height:25px;font-family: 'Microsoft YaHei,';} .menu .items ul li:hover { background:#88766E; color:#FFF} .menu .items ul li:hover a {color:#FFF} .menu .items ul li p a:hover{ text-decoration:underline;font-family: 'Microsoft YaHei,';} .menu .items ul li.curr p a{ color:#fff} .menu .box{ background:repeat-y url('../images/bg_line_t.jpg') #fff;position:absolute;overflow:visible;min-width:500px;min-height:500px;_width:755px;_height:500px;border-left:1px solid #dfdfdf;border-top:1px solid #ccc;border-right:1px solid #ccc;border-bottom:1px solid #ccc; display:none; left:241px; top:0px; z-index:4;} .menu .menuIcon{ position:absolute;display:block;width:5px;height:9px;top:40%;right:10px;background-position:-7px -480px;overflow:hidden} .menu.btn_group{ position:absolute;display:block;width:45px;height:21px;top:4px;right:10px;background-position:-0px -492px;overflow:hidden} .menu .btn_group.bleft{ background-position:-0px -492px} .menu .btn_group.bright{ background-position:-0px -518px;} .menu .btn_group .bleft{ margin:1px 0 1px 1px;float:left;display:block;height:19px;width:21px;cursor:pointer} .menu .btn_group .bright{ margin:1px 1px 1px 0;float:right;display:block;height:19px;width:21px;cursor:pointer} .menu .btn_group.bleft .bright{ cursor:default} .menu .btn_group.bright .bleft{ cursor:default} .menu .btn_group { background-position: 0 -492px;display: block;height: 21px;overflow: hidden;position: absolute;right: 10px;top: 4px;width: 45px;} .menu .box .hide{ width:755px; height:500px;box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.2), 1px -3px 5px rgba(0, 0, 0, 0.2);display:none;} .menu .items h3,.menu .menuIcon,.menu .btn_group{ background:url(../images/icon.png) no-repeat;} .menu .list-item0 h3{ background-position:0 0} .menu .list-item1 h3{ background-position:0 -30px} .menu .list-item2 h3{ background-position:0 -60px} .menu .list-item3 h3{ background-position:0 -90px} .menu .list-item4 h3{ background-position:0 -120px} .menu .list-item5 h3{ background-position:0 -150px} .menu .list-item6 h3{ background-position:0 -180px} .menu .list-item7 h3{ background-position:0 -210px} .menu .list-item8 h3{ background-position:0 -240px} .menu .list-item9 h3{ background-position:0 -270px} .menu .list-item10 h3{ background-position:0 -300px} .menu .list-item11 h3{ background-position:0 -330px} .menu .list-item12 h3{ background-position:0 -360px} .menu .list-item13 h3{ background-position:0 -390px} .menu .list-item14 h3{ background-position:0 -420px} .menu .list-item15 h3{ background-position:0 -450px}
#include "config.h" #include "KURL.h" #include <wtf/RetainPtr.h> #include <CoreFoundation/CFURL.h> using namespace std; namespace WebCore { typedef Vector<char, 512> CharBuffer; CFURLRef <API key>(const CharBuffer&); KURL::KURL(CFURLRef url) { if (!url) { invalidate(); return; } CFIndex bytesLength = CFURLGetBytes(url, 0, 0); Vector<char, 512> buffer(bytesLength + 1); char* bytes = &buffer[0]; CFURLGetBytes(url, reinterpret_cast<UInt8*>(bytes), bytesLength); bytes[bytesLength] = '\0'; #if !USE(WTFURL) parse(bytes); #else // FIXME: Add WTFURL Implementation. UNUSED_PARAM(url); invalidate(); #endif // USE(WTFURL) } CFURLRef <API key>(const CharBuffer& buffer) { // NOTE: We use UTF-8 here since this encoding is used when computing strings when returning URL components // could either be a malformed string or bytes in a different encoding, like Shift-JIS, so we fall back // onto using ISO Latin-1 in those cases. CFURLRef result = <API key>(0, reinterpret_cast<const UInt8*>(buffer.data()), buffer.size(), <API key>, 0, true); if (!result) result = <API key>(0, reinterpret_cast<const UInt8*>(buffer.data()), buffer.size(), <API key>, 0, true); return result; } #if !PLATFORM(MAC) && !(PLATFORM(QT) && USE(QTKIT)) CFURLRef KURL::createCFURL() const { #if !USE(WTFURL) // FIXME: What should this return for invalid URLs? // Currently it throws away the high bytes of the characters in the string in that case, // which is clearly wrong. CharBuffer buffer; copyToBuffer(buffer); return <API key>(buffer); #else // USE(WTFURL) // FIXME: Add WTFURL Implementation. return 0; #endif } #endif #if !USE(WTFURL) && !(PLATFORM(QT) && USE(QTKIT)) String KURL::fileSystemPath() const { RetainPtr<CFURLRef> cfURL(AdoptCF, createCFURL()); if (!cfURL) return String(); #if PLATFORM(WIN) CFURLPathStyle pathStyle = <API key>; #else CFURLPathStyle pathStyle = <API key>; #endif return RetainPtr<CFStringRef>(AdoptCF, <API key>(cfURL.get(), pathStyle)).get(); } #endif }
from __future__ import unicode_literals import re from .common import InfoExtractor from ..utils import ( HEADRequest, sanitized_Request, urlencode_postdata, ) class GDCVaultIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?gdcvault\.com/play/(?P<id>\d+)/(?P<name>(\w|-)+)?' _NETRC_MACHINE = 'gdcvault' _TESTS = [ { 'url': 'http: 'md5': '<API key>', 'info_dict': { 'id': '1019721', 'display_id': '<API key>', 'ext': 'mp4', 'title': 'Doki-Doki Universe: Sweet, Simple and Genuine (GDC Next 10)' } }, { 'url': 'http: 'info_dict': { 'id': '1015683', 'display_id': '<API key>', 'ext': 'flv', 'title': 'Embracing the Dark Art of Mathematical Modeling in AI' }, 'params': { 'skip_download': True, # Requires rtmpdump } }, { 'url': 'http: 'md5': '<API key>', 'info_dict': { 'id': '1015301', 'display_id': '<API key>', 'ext': 'flv', 'title': 'Thexder Meets Windows 95, or Writing Great Games in the Windows 95 Environment', }, 'skip': 'Requires login', }, { 'url': 'http://gdcvault.com/play/1020791/', 'only_matching': True, }, { # Hard-coded hostname 'url': 'http://gdcvault.com/play/1023460/<API key>', 'md5': '<API key>', 'info_dict': { 'id': '1023460', 'ext': 'mp4', 'display_id': '<API key>', 'title': 'Tenacious Design and The Interface of \'Destiny\'', }, }, { # Multiple audios 'url': 'http: 'info_dict': { 'id': '1014631', 'ext': 'flv', 'title': 'How to Create a Good Game - From My Experience of Designing Pac-Man', }, 'params': { 'skip_download': True, # Requires rtmpdump 'format': 'jp', # The japanese audio } }, { # gdc-player.html 'url': 'http: 'info_dict': { 'id': '1435', 'display_id': '<API key>', 'ext': 'flv', 'title': 'An American Engine in Tokyo:/nThe collaboration of Epic Games and Square Enix/nFor THE LAST REMINANT', }, 'params': { 'skip_download': True, # Requires rtmpdump }, }, ] def _login(self, webpage_url, display_id): username, password = self._get_login_info() if username is None or password is None: self.report_warning('It looks like ' + webpage_url + ' requires a login. Try specifying a username and password and try again.') return None mobj = re.match(r'(?P<root_url>https?://.*?/).*', webpage_url) login_url = mobj.group('root_url') + 'api/login.php' logout_url = mobj.group('root_url') + 'logout' login_form = { 'email': username, 'password': password, } request = sanitized_Request(login_url, urlencode_postdata(login_form)) request.add_header('Content-Type', 'application/<API key>') self._download_webpage(request, display_id, 'Logging in') start_page = self._download_webpage(webpage_url, display_id, 'Getting authenticated video page') self._download_webpage(logout_url, display_id, 'Logging out') return start_page def _real_extract(self, url): mobj = re.match(self._VALID_URL, url) video_id = mobj.group('id') display_id = mobj.group('name') or video_id webpage_url = 'http: start_page = self._download_webpage(webpage_url, display_id) direct_url = self._search_regex( r's1\.addVariable\("file",\s*encodeURIComponent\("(/[^"]+)"\)\);', start_page, 'url', default=None) if direct_url: title = self._html_search_regex( r'<td><strong>Session Name</strong></td>\s*<td>(.*?)</td>', start_page, 'title') video_url = 'http: # resolve the url so that we can detect the correct extension head = self._request_webpage(HEADRequest(video_url), video_id) video_url = head.geturl() return { 'id': video_id, 'display_id': display_id, 'url': video_url, 'title': title, } PLAYER_REGEX = r'<iframe src="(?P<xml_root>.+?)/(?:gdc-)?player.*?\.html.*?".*?</iframe>' xml_root = self._html_search_regex( PLAYER_REGEX, start_page, 'xml root', default=None) if xml_root is None: # Probably need to authenticate login_res = self._login(webpage_url, display_id) if login_res is None: self.report_warning('Could not login.') else: start_page = login_res # Grab the url from the authenticated page xml_root = self._html_search_regex( PLAYER_REGEX, start_page, 'xml root') xml_name = self._html_search_regex( r'<iframe src=".*?\?xml=(.+?\.xml).*?".*?</iframe>', start_page, 'xml filename', default=None) if xml_name is None: # Fallback to the older format xml_name = self._html_search_regex( r'<iframe src=".*?\?xmlURL=xml/(?P<xml_file>.+?\.xml).*?".*?</iframe>', start_page, 'xml filename') return { '_type': 'url_transparent', 'id': video_id, 'display_id': display_id, 'url': '%s/xml/%s' % (xml_root, xml_name), 'ie_key': 'DigitallySpeaking', }
// Code generated by protoc-gen-gogo. // source: uuid.proto // DO NOT EDIT! package events import proto "github.com/gogo/protobuf/proto" import math "math" // discarding unused import gogoproto "github.com/gogo/protobuf/gogoproto/gogo.pb" import io "io" import fmt "fmt" import <API key> "github.com/gogo/protobuf/proto" // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal var _ = math.Inf // / Type representing a 128-bit UUID. // The bytes of the UUID should be packed in little-endian **byte** (not bit) order. For example, the UUID `<API key>` should be encoded as `UUID{ low: 0x7243cc580bc17af4, high: 0x79d4c3b2020e67a5 }` type UUID struct { Low *uint64 `protobuf:"varint,1,req,name=low" json:"low,omitempty"` High *uint64 `protobuf:"varint,2,req,name=high" json:"high,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *UUID) Reset() { *m = UUID{} } func (m *UUID) String() string { return proto.CompactTextString(m) } func (*UUID) ProtoMessage() {} func (m *UUID) GetLow() uint64 { if m != nil && m.Low != nil { return *m.Low } return 0 } func (m *UUID) GetHigh() uint64 { if m != nil && m.High != nil { return *m.High } return 0 } func init() { } func (m *UUID) Unmarshal(data []byte) error { var hasFields [1]uint64 l := len(data) iNdEx := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ wire |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) switch fieldNum { case 1: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Low", wireType) } var v uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ v |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } m.Low = &v hasFields[0] |= uint64(0x00000001) case 2: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field High", wireType) } var v uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ v |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } m.High = &v hasFields[0] |= uint64(0x00000002) default: var sizeOfWire int for { sizeOfWire++ wire >>= 7 if wire == 0 { break } } iNdEx -= sizeOfWire skippy, err := skipUuid(data[iNdEx:]) if err != nil { return err } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } m.XXX_unrecognized = append(m.XXX_unrecognized, data[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } if hasFields[0]&uint64(0x00000001) == 0 { return <API key>.<API key>("low") } if hasFields[0]&uint64(0x00000002) == 0 { return <API key>.<API key>("high") } return nil } func skipUuid(data []byte) (n int, err error) { l := len(data) iNdEx := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return 0, io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ wire |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } wireType := int(wire & 0x7) switch wireType { case 0: for { if iNdEx >= l { return 0, io.ErrUnexpectedEOF } iNdEx++ if data[iNdEx-1] < 0x80 { break } } return iNdEx, nil case 1: iNdEx += 8 return iNdEx, nil case 2: var length int for shift := uint(0); ; shift += 7 { if iNdEx >= l { return 0, io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ length |= (int(b) & 0x7F) << shift if b < 0x80 { break } } iNdEx += length return iNdEx, nil case 3: for { var wire uint64 var start int = iNdEx for shift := uint(0); ; shift += 7 { if iNdEx >= l { return 0, io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ wire |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } wireType := int(wire & 0x7) if wireType == 4 { break } next, err := skipUuid(data[start:]) if err != nil { return 0, err } iNdEx = start + next } return iNdEx, nil case 4: return iNdEx, nil case 5: iNdEx += 4 return iNdEx, nil default: return 0, fmt.Errorf("proto: illegal wireType %d", wireType) } } panic("unreachable") } func (m *UUID) Size() (n int) { var l int _ = l if m.Low != nil { n += 1 + sovUuid(uint64(*m.Low)) } if m.High != nil { n += 1 + sovUuid(uint64(*m.High)) } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } return n } func sovUuid(x uint64) (n int) { for { n++ x >>= 7 if x == 0 { break } } return n } func sozUuid(x uint64) (n int) { return sovUuid(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } func (m *UUID) Marshal() (data []byte, err error) { size := m.Size() data = make([]byte, size) n, err := m.MarshalTo(data) if err != nil { return nil, err } return data[:n], nil } func (m *UUID) MarshalTo(data []byte) (n int, err error) { var i int _ = i var l int _ = l if m.Low == nil { return 0, <API key>.<API key>("low") } else { data[i] = 0x8 i++ i = encodeVarintUuid(data, i, uint64(*m.Low)) } if m.High == nil { return 0, <API key>.<API key>("high") } else { data[i] = 0x10 i++ i = encodeVarintUuid(data, i, uint64(*m.High)) } if m.XXX_unrecognized != nil { i += copy(data[i:], m.XXX_unrecognized) } return i, nil } func encodeFixed64Uuid(data []byte, offset int, v uint64) int { data[offset] = uint8(v) data[offset+1] = uint8(v >> 8) data[offset+2] = uint8(v >> 16) data[offset+3] = uint8(v >> 24) data[offset+4] = uint8(v >> 32) data[offset+5] = uint8(v >> 40) data[offset+6] = uint8(v >> 48) data[offset+7] = uint8(v >> 56) return offset + 8 } func encodeFixed32Uuid(data []byte, offset int, v uint32) int { data[offset] = uint8(v) data[offset+1] = uint8(v >> 8) data[offset+2] = uint8(v >> 16) data[offset+3] = uint8(v >> 24) return offset + 4 } func encodeVarintUuid(data []byte, offset int, v uint64) int { for v >= 1<<7 { data[offset] = uint8(v&0x7f | 0x80) v >>= 7 offset++ } data[offset] = uint8(v) return offset + 1 }
(function(modules) { // webpackBootstrap // The module cache var installedModules = {}; // The require function function __webpack_require__(moduleId) { // Check if module is in cache if(installedModules[moduleId]) return installedModules[moduleId].exports; // Create a new module (and put it into the cache) var module = installedModules[moduleId] = { exports: {}, id: moduleId, loaded: false }; // Execute the module function modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); // Flag the module as loaded module.loaded = true; // Return the exports of the module return module.exports; } // expose the modules object (__webpack_modules__) __webpack_require__.m = modules; // expose the module cache __webpack_require__.c = installedModules; // <API key> __webpack_require__.p = ""; // Load entry module and return exports return __webpack_require__(0); }) ({ 0: function(module, exports, __webpack_require__) { __webpack_require__(249) var __weex_template__ = __webpack_require__(250) var __weex_style__ = __webpack_require__(251) var __weex_script__ = __webpack_require__(252) __weex_define__('@weex-component/<API key>', [], function(__weex_require__, __weex_exports__, __weex_module__) { __weex_script__(__weex_module__, __weex_exports__, __weex_require__) if (__weex_exports__.__esModule && __weex_exports__.default) { __weex_module__.exports = __weex_exports__.default } __weex_module__.exports.template = __weex_template__ __weex_module__.exports.style = __weex_style__ }) __weex_bootstrap__('@weex-component/<API key>',undefined,undefined) }, 244: function(module, exports) { module.exports = { "type": "image", "style": { "width": function () {return this.width}, "height": function () {return this.height} }, "attr": { "src": function () {return this.src}, "imageQuality": function () {return this.quality} }, "events": { "click": "_clickHandler" } } }, 245: function(module, exports) { module.exports = function(module, exports, __weex_require__){'use strict'; module.exports = { data: function () {return { quality: 'normal', width: 0, height: 0, src: '', href: '', spmc: 0, spmd: 0 }}, methods: { ready: function ready() {}, _clickHandler: function _clickHandler() { this.$call('modal', 'toast', { message: 'click', duration: 1 }); } } };} /* generated by weex-loader */ }, 246: function(module, exports, __webpack_require__) { var __weex_template__ = __webpack_require__(244) var __weex_script__ = __webpack_require__(245) __weex_define__('@weex-component/banner', [], function(__weex_require__, __weex_exports__, __weex_module__) { __weex_script__(__weex_module__, __weex_exports__, __weex_require__) if (__weex_exports__.__esModule && __weex_exports__.default) { __weex_module__.exports = __weex_exports__.default } __weex_module__.exports.template = __weex_template__ }) }, 247: function(module, exports) { module.exports = { "type": "container", "children": [ { "type": "container", "shown": function () {return this.direction==='row'}, "style": { "flexDirection": "row" }, "children": [ { "type": "container", "repeat": function () {return this.ds}, "style": { "width": function () {return this.width}, "height": function () {return this.height}, "marginLeft": function () {return this.space} }, "children": [ { "type": "banner", "attr": { "width": function () {return this.width}, "height": function () {return this.height}, "src": function () {return this.img}, "href": function () {return this.url} } } ] } ] }, { "type": "container", "shown": function () {return this.direction==='column'}, "children": [ { "type": "container", "repeat": function () {return this.ds}, "style": { "width": function () {return this.width}, "height": function () {return this.height}, "marginTop": function () {return this.space} }, "children": [ { "type": "banner", "attr": { "width": function () {return this.width}, "height": function () {return this.height}, "src": function () {return this.img}, "href": function () {return this.url} } } ] } ] } ] } }, 248: function(module, exports) { module.exports = function(module, exports, __weex_require__){'use strict'; module.exports = { data: function () {return { space: 0, width: 0, height: 0, spmc: 0, spmdprefix: '', ds: [] }}, methods: { ready: function ready() { var self = this; var ds = self.ds; var length = ds.length; for (var i = 0; i < length; i++) { var item = ds[i]; item.index = i; item.space = i % length === 0 ? 0 : self.space; } } } };} /* generated by weex-loader */ }, 249: function(module, exports, __webpack_require__) { __webpack_require__(246) var __weex_template__ = __webpack_require__(247) var __weex_script__ = __webpack_require__(248) __weex_define__('@weex-component/banners', [], function(__weex_require__, __weex_exports__, __weex_module__) { __weex_script__(__weex_module__, __weex_exports__, __weex_require__) if (__weex_exports__.__esModule && __weex_exports__.default) { __weex_module__.exports = __weex_exports__.default } __weex_module__.exports.template = __weex_template__ }) }, 250: function(module, exports) { module.exports = { "type": "container", "classList": [ "container" ], "children": [ { "type": "image", "shown": function () {return this.ds.floorTitle}, "classList": [ "title" ], "attr": { "src": function () {return this.ds.floorTitle} } }, { "type": "container", "style": { "marginLeft": 4, "marginRight": 4 }, "children": [ { "type": "banners", "attr": { "ds": function () {return this.bannerItems}, "direction": "column", "width": function () {return this.NUMBER_742}, "height": function () {return this.NUMBER_230}, "space": function () {return this.NUMBER_4} } } ] } ] } }, 251: function(module, exports) { module.exports = { "title": { "width": 750, "height": 100 }, "container": { "marginBottom": 4, "backgroundColor": "#C0BABC" } } }, 252: function(module, exports) { module.exports = function(module, exports, __weex_require__){"use strict"; module.exports = { data: function () {return { NUMBER_742: 742, NUMBER_230: 230, NUMBER_4: 4 }}, methods: { ready: function ready() { var self = this; self._randomBrand(); }, _randomBrand: function _randomBrand() { var self = this; var bannerItems = self.ds.bannerItems; bannerItems = bannerItems.sort(function () { return Math.random() - 0.5; }); self.bannerItems = bannerItems.slice(0, 8); for (var i = 0; i < bannerItems.length; i++) { var item = bannerItems[i]; if (i % 2 === 0) { item.img = item.leftImg; item.url = item.rightUrl; } else { item.img = item.rightImg; item.url = item.rightUrl; } } } } };} /* generated by weex-loader */ } });
<HTML><style type="text/css"> ul.inheritance { margin:0; padding:0; } ul.inheritance li { display:inline; list-style-type:none; } ul.inheritance li ul.inheritance { margin-left:15px; padding-left:15px; padding-top:1px; } </style> <section class="detail" id="toLowerCase()"> <h3>toLowerCase</h3> <div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type"><a href="String.html" title="class in java.lang">String</a></span>&nbsp;<span class="element-name">toLowerCase</span>() </div> <div class="block">Converts all of the characters in this <code>String</code> to lower case using the rules of the default locale. This is equivalent to calling <code>toLowerCase(Locale.getDefault())</code>. <p> <b>Note:</b> This method is locale sensitive, and may produce unexpected results if used for strings that are intended to be interpreted locale independently. Examples are programming language identifiers, protocol keys, and HTML tags. For instance, <code>"TITLE".toLowerCase()</code> in a Turkish locale returns <code>"t\u0131tle"</code>, where '\u0131' is the LATIN SMALL LETTER DOTLESS I character. To obtain correct results for locale insensitive strings, use <code>toLowerCase(Locale.ROOT)</code>.</p></div> <dl class="notes"> <dt>Returns:</dt> <dd>the <code>String</code>, converted to lowercase.</dd> <dt>See Also:</dt> <dd><a href="#toLowerCase(java.util.Locale)"><code>toLowerCase(Locale)</code></a></dd> </dl> </section> </li> <li> </HTML>
#!/usr/bin/python2 # tree. An additional intellectual property rights grant can be found # in the file PATENTS. All contributing project authors may # be found in the AUTHORS file in the root of the source tree. # To run this script please copy "out/<build_name>//pyproto/webrtc/modules/ # audio_coding/<API key>/debug_dump_pb2.py" to this folder. # The you can run this script with: # "python parse_ana_dump.py -m <API key> -f dump_file.dat" # You can add as may metrics or decisions to the plot as you like. # form more information call: # "python parse_ana_dump.py --help" import struct from optparse import OptionParser import matplotlib.pyplot as plt import debug_dump_pb2 def GetNextMessageSize(file_to_parse): data = file_to_parse.read(4) if data == '': return 0 return struct.unpack('<I', data)[0] def <API key>(file_to_parse): message_size = GetNextMessageSize(file_to_parse) if message_size == 0: return None try: event = debug_dump_pb2.Event() event.ParseFromString(file_to_parse.read(message_size)) except IOError: print 'Invalid message in file' return None return event def InitMetrics(): metrics = {} event = debug_dump_pb2.Event() for metric in event.network_metrics.DESCRIPTOR.fields: metrics[metric.name] = {'time': [], 'value': []} return metrics def InitDecisions(): decisions = {} event = debug_dump_pb2.Event() for decision in event.<API key>.DESCRIPTOR.fields: decisions[decision.name] = {'time': [], 'value': []} return decisions def ParseAnaDump(dump_file_to_parse): with open(dump_file_to_parse, 'rb') as file_to_parse: metrics = InitMetrics() decisions = InitDecisions() first_time_stamp = None while True: event = <API key>(file_to_parse) if event == None: break if first_time_stamp == None: first_time_stamp = event.timestamp if event.type == debug_dump_pb2.Event.<API key>: for decision in event.<API key>.DESCRIPTOR.fields: if event.<API key>.HasField(decision.name): decisions[decision.name]['time'].append(event.timestamp - first_time_stamp) decisions[decision.name]['value'].append( getattr(event.<API key>, decision.name)) if event.type == debug_dump_pb2.Event.NETWORK_METRICS: for metric in event.network_metrics.DESCRIPTOR.fields: if event.network_metrics.HasField(metric.name): metrics[metric.name]['time'].append(event.timestamp - first_time_stamp) metrics[metric.name]['value'].append( getattr(event.network_metrics, metric.name)) return (metrics, decisions) def main(): parser = OptionParser() parser.add_option( "-f", "--dump_file", dest="dump_file_to_parse", help="dump file to parse") parser.add_option( '-m', '--metric_plot', default=[], type=str, help='metric key (name of the metric) to plot', dest='metric_keys', action='append') parser.add_option( '-d', '--decision_plot', default=[], type=str, help='decision key (name of the decision) to plot', dest='decision_keys', action='append') options = parser.parse_args()[0] if options.dump_file_to_parse == None: print "No dump file to parse is set.\n" parser.print_help() exit() (metrics, decisions) = ParseAnaDump(options.dump_file_to_parse) metric_keys = options.metric_keys decision_keys = options.decision_keys plot_count = len(metric_keys) + len(decision_keys) if plot_count == 0: print "You have to set at least one metric or decision to plot.\n" parser.print_help() exit() plots = [] if plot_count == 1: f, mp_plot = plt.subplots() plots.append(mp_plot) else: f, mp_plots = plt.subplots(plot_count, sharex=True) plots.extend(mp_plots.tolist()) for key in metric_keys: plot = plots.pop() plot.grid(True) plot.set_title(key + " (metric)") plot.plot(metrics[key]['time'], metrics[key]['value']) for key in decision_keys: plot = plots.pop() plot.grid(True) plot.set_title(key + " (decision)") plot.plot(decisions[key]['time'], decisions[key]['value']) f.subplots_adjust(hspace=0.3) plt.show() if __name__ == "__main__": main()
"""Support for Verisure Smartplugs.""" import logging from time import monotonic from homeassistant.components.switch import SwitchEntity from . import CONF_SMARTPLUGS, HUB as hub _LOGGER = logging.getLogger(__name__) def setup_platform(hass, config, add_entities, discovery_info=None): """Set up the Verisure switch platform.""" if not int(hub.config.get(CONF_SMARTPLUGS, 1)): return False hub.update_overview() switches = [] switches.extend( [ VerisureSmartplug(device_label) for device_label in hub.get("$.smartPlugs[*].deviceLabel") ] ) add_entities(switches) class VerisureSmartplug(SwitchEntity): """Representation of a Verisure smartplug.""" def __init__(self, device_id): """Initialize the Verisure device.""" self._device_label = device_id self._change_timestamp = 0 self._state = False @property def name(self): """Return the name or location of the smartplug.""" return hub.get_first( "$.smartPlugs[?(@.deviceLabel == '%s')].area", self._device_label ) @property def is_on(self): """Return true if on.""" if monotonic() - self._change_timestamp < 10: return self._state self._state = ( hub.get_first( "$.smartPlugs[?(@.deviceLabel == '%s')].currentState", self._device_label, ) == "ON" ) return self._state @property def available(self): """Return True if entity is available.""" return ( hub.get_first("$.smartPlugs[?(@.deviceLabel == '%s')]", self._device_label) is not None ) def turn_on(self, **kwargs): """Set smartplug status on.""" hub.session.set_smartplug_state(self._device_label, True) self._state = True self._change_timestamp = monotonic() def turn_off(self, **kwargs): """Set smartplug status off.""" hub.session.set_smartplug_state(self._device_label, False) self._state = False self._change_timestamp = monotonic() # pylint: disable=no-self-use def update(self): """Get the latest date of the smartplug.""" hub.update_overview()
package com.intellij.codeInsight.template.impl; import com.intellij.codeInsight.CodeInsightBundle; import com.intellij.codeInsight.lookup.Lookup; import com.intellij.codeInsight.lookup.<API key>; import com.intellij.codeInsight.lookup.LookupElement; import com.intellij.codeInsight.lookup.LookupElementAction; import com.intellij.icons.AllIcons; import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.options.ShowSettingsUtil; import com.intellij.openapi.project.Project; import com.intellij.util.Consumer; import com.intellij.util.PlatformIcons; /** * @author peter */ public class <API key> implements <API key> { @Override public void fillActions(LookupElement element, final Lookup lookup, Consumer<LookupElementAction> consumer) { if (element instanceof <API key>) { final TemplateImpl template = ((<API key>)element).getTemplate(); final TemplateImpl <API key> = TemplateSettings.getInstance().getTemplate(template.getKey(), template.getGroupName()); if (<API key> != null) { consumer.consume(new LookupElementAction(PlatformIcons.EDIT, CodeInsightBundle.message("action.text.edit.live.template.settings")) { @Override public Result performLookupAction() { final Project project = lookup.getProject(); ApplicationManager.getApplication().invokeLater(() -> { if (project.isDisposed()) return; final <API key> configurable = new <API key>(); ShowSettingsUtil.getInstance().editConfigurable(project, configurable, () -> configurable.<API key>().editTemplate(template)); }); return Result.HIDE_LOOKUP; } }); consumer.consume(new LookupElementAction(AllIcons.Actions.Cancel, CodeInsightBundle.message("action.text.disable.live.template", template.getKey())) { @Override public Result performLookupAction() { ApplicationManager.getApplication().invokeLater(() -> <API key>.setDeactivated(true)); return Result.HIDE_LOOKUP; } }); } } } }
using System; using Android.App; using Android.Content; using Android.Content.PM; using Android.Runtime; using Android.Views; using Android.Widget; using Android.OS; using Robotics.Mobile.Core.Bluetooth.LE; using Xamarin.Forms.Platform.Android; namespace HeadLights.Android { [Activity (Label = "HeadLights.Android.Android", MainLauncher = true, <API key> = ConfigChanges.ScreenSize | ConfigChanges.Orientation)] public class MainActivity : AndroidActivity { protected override void OnCreate (Bundle bundle) { base.OnCreate (bundle); Xamarin.Forms.Forms.Init (this, bundle); //TODO: need adapter //SetPage (App.GetMainPage ()); } } }
// +build linux freebsd package daemon import ( "context" "fmt" "io/ioutil" "os" "path/filepath" "strconv" "time" "github.com/docker/docker/container" "github.com/docker/docker/daemon/links" "github.com/docker/docker/pkg/idtools" "github.com/docker/docker/pkg/mount" "github.com/docker/docker/pkg/stringid" "github.com/docker/docker/runconfig" "github.com/docker/libnetwork" "github.com/opencontainers/selinux/go-selinux/label" "github.com/pkg/errors" "github.com/sirupsen/logrus" "golang.org/x/sys/unix" ) func (daemon *Daemon) <API key>(container *container.Container) ([]string, error) { var env []string children := daemon.children(container) bridgeSettings := container.NetworkSettings.Networks[runconfig.<API key>().NetworkName()] if bridgeSettings == nil || bridgeSettings.EndpointSettings == nil { return nil, nil } for linkAlias, child := range children { if !child.IsRunning() { return nil, fmt.Errorf("Cannot link to a non running container: %s AS %s", child.Name, linkAlias) } childBridgeSettings := child.NetworkSettings.Networks[runconfig.<API key>().NetworkName()] if childBridgeSettings == nil || childBridgeSettings.EndpointSettings == nil { return nil, fmt.Errorf("container %s not attached to default bridge network", child.ID) } link := links.NewLink( bridgeSettings.IPAddress, childBridgeSettings.IPAddress, linkAlias, child.Config.Env, child.Config.ExposedPorts, ) env = append(env, link.ToEnv()...) } return env, nil } func (daemon *Daemon) getIpcContainer(id string) (*container.Container, error) { errMsg := "can't join IPC of container " + id // Check the container exists container, err := daemon.GetContainer(id) if err != nil { return nil, errors.Wrap(err, errMsg) } // Check the container is running and not restarting if err := daemon.checkContainer(container, containerIsRunning, <API key>); err != nil { return nil, errors.Wrap(err, errMsg) } // Check the container ipc is shareable if st, err := os.Stat(container.ShmPath); err != nil || !st.IsDir() { if err == nil || os.IsNotExist(err) { return nil, errors.New(errMsg + ": non-shareable IPC") } // stat() failed? return nil, errors.Wrap(err, errMsg+": unexpected error from stat "+container.ShmPath) } return container, nil } func (daemon *Daemon) getPidContainer(container *container.Container) (*container.Container, error) { containerID := container.HostConfig.PidMode.Container() container, err := daemon.GetContainer(containerID) if err != nil { return nil, errors.Wrapf(err, "cannot join PID of a non running container: %s", container.ID) } return container, daemon.checkContainer(container, containerIsRunning, <API key>) } func containerIsRunning(c *container.Container) error { if !c.IsRunning() { return stateConflictError{errors.Errorf("container %s is not running", c.ID)} } return nil } func <API key>(c *container.Container) error { if c.IsRestarting() { return <API key>(c.ID) } return nil } func (daemon *Daemon) setupIpcDirs(c *container.Container) error { ipcMode := c.HostConfig.IpcMode switch { case ipcMode.IsContainer(): ic, err := daemon.getIpcContainer(ipcMode.Container()) if err != nil { return err } c.ShmPath = ic.ShmPath case ipcMode.IsHost(): if _, err := os.Stat("/dev/shm"); err != nil { return fmt.Errorf("/dev/shm is not mounted, but must be for --ipc=host") } c.ShmPath = "/dev/shm" case ipcMode.IsPrivate(), ipcMode.IsNone(): // c.ShmPath will/should not be used, so make it empty. // Container's /dev/shm mount comes from OCI spec. c.ShmPath = "" case ipcMode.IsEmpty(): // The default behavior used to be what is now called "shareable". fallthrough case ipcMode.IsShareable(): rootIDs := daemon.idMappings.RootPair() if !c.HasMountFor("/dev/shm") { shmPath, err := c.ShmResourcePath() if err != nil { return err } if err := idtools.MkdirAllAndChown(shmPath, 0700, rootIDs); err != nil { return err } shmproperty := "mode=1777,size=" + strconv.FormatInt(c.HostConfig.ShmSize, 10) if err := unix.Mount("shm", shmPath, "tmpfs", uintptr(unix.MS_NOEXEC|unix.MS_NOSUID|unix.MS_NODEV), label.FormatMountLabel(shmproperty, c.GetMountLabel())); err != nil { return fmt.Errorf("mounting shm tmpfs: %s", err) } if err := os.Chown(shmPath, rootIDs.UID, rootIDs.GID); err != nil { return err } c.ShmPath = shmPath } default: return fmt.Errorf("invalid IPC mode: %v", ipcMode) } return nil } func (daemon *Daemon) setupSecretDir(c *container.Container) (setupErr error) { if len(c.SecretReferences) == 0 { return nil } localMountPath := c.SecretMountPath() logrus.Debugf("secrets: setting up secret dir: %s", localMountPath) // retrieve possible remapped range start for root UID, GID rootIDs := daemon.idMappings.RootPair() // create tmpfs if err := idtools.MkdirAllAndChown(localMountPath, 0700, rootIDs); err != nil { return errors.Wrap(err, "error creating secret local mount path") } defer func() { if setupErr != nil { // cleanup _ = detachMounted(localMountPath) if err := os.RemoveAll(localMountPath); err != nil { logrus.Errorf("error cleaning up secret mount: %s", err) } } }() tmpfsOwnership := fmt.Sprintf("uid=%d,gid=%d", rootIDs.UID, rootIDs.GID) if err := mount.Mount("tmpfs", localMountPath, "tmpfs", "nodev,nosuid,noexec,"+tmpfsOwnership); err != nil { return errors.Wrap(err, "unable to setup secret mount") } if c.DependencyStore == nil { return fmt.Errorf("secret store is not initialized") } for _, s := range c.SecretReferences { // TODO (ehazlett): use type switch when more are supported if s.File == nil { logrus.Error("secret target type is not a file target") continue } // secrets are created in the SecretMountPath on the host, at a // single level fPath := c.SecretFilePath(*s) if err := idtools.MkdirAllAndChown(filepath.Dir(fPath), 0700, rootIDs); err != nil { return errors.Wrap(err, "error creating secret mount path") } logrus.WithFields(logrus.Fields{ "name": s.File.Name, "path": fPath, }).Debug("injecting secret") secret, err := c.DependencyStore.Secrets().Get(s.SecretID) if err != nil { return errors.Wrap(err, "unable to get secret from secret store") } if err := ioutil.WriteFile(fPath, secret.Spec.Data, s.File.Mode); err != nil { return errors.Wrap(err, "error injecting secret") } uid, err := strconv.Atoi(s.File.UID) if err != nil { return err } gid, err := strconv.Atoi(s.File.GID) if err != nil { return err } if err := os.Chown(fPath, rootIDs.UID+uid, rootIDs.GID+gid); err != nil { return errors.Wrap(err, "error setting ownership for secret") } } label.Relabel(localMountPath, c.MountLabel, false) // remount secrets ro if err := mount.Mount("tmpfs", localMountPath, "tmpfs", "remount,ro,"+tmpfsOwnership); err != nil { return errors.Wrap(err, "unable to remount secret dir as readonly") } return nil } func (daemon *Daemon) setupConfigDir(c *container.Container) (setupErr error) { if len(c.ConfigReferences) == 0 { return nil } localPath := c.ConfigsDirPath() logrus.Debugf("configs: setting up config dir: %s", localPath) // retrieve possible remapped range start for root UID, GID rootIDs := daemon.idMappings.RootPair() // create tmpfs if err := idtools.MkdirAllAndChown(localPath, 0700, rootIDs); err != nil { return errors.Wrap(err, "error creating config dir") } defer func() { if setupErr != nil { if err := os.RemoveAll(localPath); err != nil { logrus.Errorf("error cleaning up config dir: %s", err) } } }() if c.DependencyStore == nil { return fmt.Errorf("config store is not initialized") } for _, configRef := range c.ConfigReferences { // TODO (ehazlett): use type switch when more are supported if configRef.File == nil { logrus.Error("config target type is not a file target") continue } fPath := c.ConfigFilePath(*configRef) log := logrus.WithFields(logrus.Fields{"name": configRef.File.Name, "path": fPath}) if err := idtools.MkdirAllAndChown(filepath.Dir(fPath), 0700, rootIDs); err != nil { return errors.Wrap(err, "error creating config path") } log.Debug("injecting config") config, err := c.DependencyStore.Configs().Get(configRef.ConfigID) if err != nil { return errors.Wrap(err, "unable to get config from config store") } if err := ioutil.WriteFile(fPath, config.Spec.Data, configRef.File.Mode); err != nil { return errors.Wrap(err, "error injecting config") } uid, err := strconv.Atoi(configRef.File.UID) if err != nil { return err } gid, err := strconv.Atoi(configRef.File.GID) if err != nil { return err } if err := os.Chown(fPath, rootIDs.UID+uid, rootIDs.GID+gid); err != nil { return errors.Wrap(err, "error setting ownership for config") } label.Relabel(fPath, c.MountLabel, false) } return nil } func killProcessDirectly(cntr *container.Container) error { ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) defer cancel() // Block until the container to stops or timeout. status := <-cntr.Wait(ctx, container.<API key>) if status.Err() != nil { // Ensure that we don't kill ourselves if pid := cntr.GetPID(); pid != 0 { logrus.Infof("Container %s failed to exit within 10 seconds of kill - trying direct SIGKILL", stringid.TruncateID(cntr.ID)) if err := unix.Kill(pid, 9); err != nil { if err != unix.ESRCH { return err } e := errNoSuchProcess{pid, 9} logrus.Debug(e) return e } } } return nil } func detachMounted(path string) error { return unix.Unmount(path, unix.MNT_DETACH) } func isLinkable(child *container.Container) bool { // A container is linkable only if it belongs to the default network _, ok := child.NetworkSettings.Networks[runconfig.<API key>().NetworkName()] return ok } func <API key>() bool { return false } func (daemon *Daemon) <API key>() bool { return true } func <API key>(container *container.Container, sboxOptions *[]libnetwork.SandboxOption) error { var err error container.HostsPath, err = container.GetRootResourcePath("hosts") if err != nil { return err } *sboxOptions = append(*sboxOptions, libnetwork.OptionHostsPath(container.HostsPath)) container.ResolvConfPath, err = container.GetRootResourcePath("resolv.conf") if err != nil { return err } *sboxOptions = append(*sboxOptions, libnetwork.<API key>(container.ResolvConfPath)) return nil } func (daemon *Daemon) <API key>(container *container.Container, nc *container.Container) error { container.HostnamePath = nc.HostnamePath container.HostsPath = nc.HostsPath container.ResolvConfPath = nc.ResolvConfPath return nil }
// This file was automatically generated. Do not modify. 'use strict'; goog.provide('Blockly.Msg.az'); goog.require('Blockly.Msg'); Blockly.Msg.ADD_COMMENT = "Şərh əlavə et"; Blockly.Msg.CHANGE_VALUE_TITLE = "Qiyməti dəyiş:"; Blockly.Msg.CHAT = "Chat with your collaborator by typing in this box!"; // untranslated Blockly.Msg.COLLAPSE_ALL = "Blokları yığ"; Blockly.Msg.COLLAPSE_BLOCK = "Bloku yığ"; Blockly.Msg.<API key> = "rəng 1"; Blockly.Msg.<API key> = "rəng 2"; Blockly.Msg.<API key> = "http://meyerweb.com/eric/tools/color-blend/"; Blockly.Msg.COLOUR_BLEND_RATIO = "nisbət"; Blockly.Msg.COLOUR_BLEND_TITLE = "qarışdır"; Blockly.Msg.<API key> = "İki rəngi verilmiş nisbətdə (0,0 - 1,0) qarışdırır."; Blockly.Msg.<API key> = "https://en.wikipedia.org/wiki/Color"; // untranslated Blockly.Msg.<API key> = "Palitradan bir rəng seçin."; Blockly.Msg.<API key> = "http://randomcolour.com"; // untranslated Blockly.Msg.COLOUR_RANDOM_TITLE = "təsadüfi rəng"; Blockly.Msg.<API key> = "Təsadüfi bir rəng seçin."; Blockly.Msg.COLOUR_RGB_BLUE = "mavi"; Blockly.Msg.COLOUR_RGB_GREEN = "yaşıl"; Blockly.Msg.COLOUR_RGB_HELPURL = "http: Blockly.Msg.COLOUR_RGB_RED = "qırmızı"; Blockly.Msg.COLOUR_RGB_TITLE = "rəngin komponentləri:"; Blockly.Msg.COLOUR_RGB_TOOLTIP = "Qırmızı, yaşıl və mavinin göstərilən miqdarı ilə bir rəng düzəlt. Bütün qiymətlər 0 ilə 100 arasında olmalıdır."; Blockly.Msg.<API key> = "https://code.google.com/p/blockly/wiki/Loops#<API key>"; Blockly.Msg.<API key> = "dövrdən çıx"; Blockly.Msg.<API key> = "dövrün növbəti addımından davam et"; Blockly.Msg.<API key> = "Cari dövrdən çıx."; Blockly.Msg.<API key> = "Bu dövrün qalanını ötür və növbəti addımla davam et."; Blockly.Msg.<API key> = "Xəbərdarlıq: Bu blok ancaq dövr daxilində istifadə oluna bilər."; Blockly.Msg.<API key> = "https://code.google.com/p/blockly/wiki/Loops#for_each"; Blockly.Msg.<API key> = "siyahıda"; Blockly.Msg.<API key> = ""; // untranslated Blockly.Msg.<API key> = "hər element üçün"; Blockly.Msg.<API key> = "Siyahıdakı hər element üçün \"%1\" dəyişənini elementə mənimsət və bundan sonra bəzi əmrləri yerinə yetir."; Blockly.Msg.<API key> = "https://code.google.com/p/blockly/wiki/Loops#count_with"; Blockly.Msg.<API key> = "%1 ilə başlayıb, %2 qiymətinə kimi %3 qədər dəyiş"; Blockly.Msg.<API key> = "say:"; Blockly.Msg.<API key> = "%1 dəyişəni başlanğıc ədəddən son ədədə qədər göstərilən aralıqla qiymətlər aldıqca göstərilən blokları yerinə yetir."; Blockly.Msg.<API key> = "\"Əgər\" blokuna bir şərt əlavə et."; Blockly.Msg.<API key> = "\"Əgər\" blokuna qalan bütün halları əhatə edəb son bir şərt əlavə et."; Blockly.Msg.CONTROLS_IF_HELPURL = "http://code.google.com/p/blockly/wiki/If_Then"; Blockly.Msg.<API key> = "Bu \"əgər\" blokunu dəyişdirmək üçün bölümlərin yenisini əlavə et, sil və ya yerini dəyiş."; Blockly.Msg.<API key> = "əks halda"; Blockly.Msg.<API key> = "əks halda əgər"; Blockly.Msg.CONTROLS_IF_MSG_IF = "əgər"; Blockly.Msg.<API key> = "Əgər qiymət doğrudursa, onda bəzi əmrləri yerinə yetir."; Blockly.Msg.<API key> = "Əgər qiymət doğrudursa, onda birinci əmrlər blokunu yerinə yetir. Əks halda isə ikinci əmrlər blokunu yerinə yetir."; Blockly.Msg.<API key> = "Əgər birinci qiymət doğrudursa, onda birinci əmrlər blokunu yerinə yetir. Əks halda əgər ikinci qiymət doğrudursa, onda ikinci əmrlər blokunu yerinə yetir."; Blockly.Msg.<API key> = "Əgər birinci qiymət doğrudursa, onda birinci əmrlər blokunu yerinə yetir. Əks halda əgər ikinci qiymət doğrudursa, onda ikinci əmrlər blokunu yerinə yetir. Əgər qiymətlərdən heç biri doğru deyilsə, onda axırıncı əmrlər blokunu yerinə yetir."; Blockly.Msg.<API key> = "https://en.wikipedia.org/wiki/For_loop"; // untranslated Blockly.Msg.<API key> = "icra et"; Blockly.Msg.<API key> = "%1 dəfə təkrar et"; Blockly.Msg.<API key> = "təkrar et"; Blockly.Msg.<API key> = "dəfə"; Blockly.Msg.<API key> = "Bəzi əmrləri bir neçə dəfə yerinə yetir."; Blockly.Msg.<API key> = "http://code.google.com/p/blockly/wiki/Repeat"; Blockly.Msg.<API key> = "təkrar et, ta ki"; Blockly.Msg.<API key> = "təkrar et, hələ ki"; Blockly.Msg.<API key> = "Hələ ki, qiymət \"yalan\"dır, bəzi əmrləri yerinə yetir."; Blockly.Msg.<API key> = "Hələ ki, qiymət \"doğru\"dur, bəzi əmrləri yerinə yetir."; Blockly.Msg.DELETE_BLOCK = "Bloku sil"; Blockly.Msg.DELETE_X_BLOCKS = "%1 bloku sil"; Blockly.Msg.DISABLE_BLOCK = "Bloku söndür"; Blockly.Msg.DUPLICATE_BLOCK = "Dublikat"; Blockly.Msg.ENABLE_BLOCK = "Bloku aktivləşdir"; Blockly.Msg.EXPAND_ALL = "Blokları aç"; Blockly.Msg.EXPAND_BLOCK = "Bloku aç"; Blockly.Msg.EXTERNAL_INPUTS = "Xarici girişlər"; Blockly.Msg.HELP = "Kömək"; Blockly.Msg.INLINE_INPUTS = "Sətiriçi girişlər"; Blockly.Msg.<API key> = "https://en.wikipedia.org/wiki/Linked_list#Empty_lists"; // untranslated Blockly.Msg.<API key> = "boş siyahı düzəlt"; Blockly.Msg.<API key> = "Heç bir verilən qeyd olunmamış, uzunluğu 0 olan bir siyahı verir"; Blockly.Msg.<API key> = "siyahı"; Blockly.Msg.<API key> = "Bu siyahı blokunu yenidən konfigurasiya etmək üçün bölmələri əlavə edin, silin və ya yerlərini dəyişin."; Blockly.Msg.<API key> = "bunlardan siyahı düzəlt"; Blockly.Msg.<API key> = "Siyahıya element əlavə edin."; Blockly.Msg.<API key> = "İstənilən ölçülü siyahı yaradın."; Blockly.Msg.<API key> = "birinci"; Blockly.Msg.<API key> = "axırdan Blockly.Msg.<API key> = " Blockly.Msg.LISTS_GET_INDEX_GET = "götür"; Blockly.Msg.<API key> = "götür və sil"; Blockly.Msg.<API key> = "axırıncı"; Blockly.Msg.<API key> = "təsadüfi"; Blockly.Msg.<API key> = "yığışdır"; Blockly.Msg.<API key> = ""; // untranslated Blockly.Msg.<API key> = "Siyahının ilk elementini qaytarır."; Blockly.Msg.<API key> = "Siyahıdan təyin olunmuş indeksli elementi qaytarır. #1 son elementdir."; Blockly.Msg.<API key> = "Siyahıdan təyin olunmuş indeksli elementi qaytarır. #1 ilk elementdir."; Blockly.Msg.<API key> = "Siyahının son elementini qaytarır."; Blockly.Msg.<API key> = "Siyahıdan hər hansı təsadüfi elementi qaytarır."; Blockly.Msg.<API key> = "Siyahıdan ilk elementi silir və qaytarır."; Blockly.Msg.<API key> = "Siyahıdan təyin olunmuş indeksli elementi silir və qaytarır. #1 son elementdir."; Blockly.Msg.<API key> = "Siyahıdan təyin olunmuş indeksli elementi silir və qaytarır. #1 ilk elementdir."; Blockly.Msg.<API key> = "Siyahıdan son elementi silir və qaytarır."; Blockly.Msg.<API key> = "Siyahıdan təsadufi elementi silir və qaytarır."; Blockly.Msg.<API key> = "Siyahıdan ilk elementi silir."; Blockly.Msg.<API key> = "Siyahıdan təyin olunmuş indeksli elementi silir. #1 son elementdir."; Blockly.Msg.<API key> = "Siyahıdan təyin olunmuş indeksli elementi silir. #1 ilk elementdir."; Blockly.Msg.<API key> = "Siyahıdan son elementi silir."; Blockly.Msg.<API key> = "Siyahıdan təsadüfi bir elementi silir."; Blockly.Msg.<API key> = "sondan Blockly.Msg.<API key> = " Blockly.Msg.<API key> = "Sonuncuya"; Blockly.Msg.<API key> = "https://code.google.com/p/blockly/wiki/Lists#Getting_a_sublist"; Blockly.Msg.<API key> = "Birincidən alt-siyahını alın"; Blockly.Msg.<API key> = " Blockly.Msg.<API key> = " Blockly.Msg.<API key> = ""; // untranslated Blockly.Msg.<API key> = "Siyahının təyin olunmuş hissəsinin surətini yaradın."; Blockly.Msg.<API key> = "Element ilə ilk rastlaşma indeksini müəyyən edin"; Blockly.Msg.<API key> = "https://code.google.com/p/blockly/wiki/Lists#<API key>"; Blockly.Msg.LISTS_INDEX_OF_LAST = "Element ilə son rastlaşma indeksini müəyyən edin"; Blockly.Msg.<API key> = "Siyahıda element ilə ilk/son rastlaşma indeksini qaytarır. Əgər tekst siyahıda tapılmazsa, 0 qaytarılır."; Blockly.Msg.LISTS_INLIST = "siyahıda"; Blockly.Msg.<API key> = "https://code.google.com/p/blockly/wiki/Lists#is_empty"; Blockly.Msg.<API key> = "%1 boşdur"; Blockly.Msg.<API key> = "https://code.google.com/p/blockly/wiki/Lists#length_of"; Blockly.Msg.LISTS_LENGTH_TITLE = "%1 siyahısının uzunluğu"; Blockly.Msg.<API key> = "Siyahının uzunluğunu verir."; Blockly.Msg.<API key> = "https://code.google.com/p/blockly/wiki/Lists#create_list_with"; Blockly.Msg.LISTS_REPEAT_TITLE = "%1 elementinin %2 dəfə təkrarlandığı siyahı düzəlt"; Blockly.Msg.<API key> = "Təyin olunmuş elementin/qiymətin təyin olunmuş sayda təkrarlandığı siyahını yaradır."; Blockly.Msg.<API key> = "https://code.google.com/p/blockly/wiki/Lists#in_list_..._set"; Blockly.Msg.<API key> = "Kimi"; Blockly.Msg.<API key> = "daxil et"; Blockly.Msg.LISTS_SET_INDEX_SET = "təyin et"; Blockly.Msg.<API key> = "Elementi siyahının əvvəlinə daxil edir."; Blockly.Msg.<API key> = "Elementi siyahıda göstərilən yerə daxil edir. Blockly.Msg.<API key> = "Elementi siyahıda göstərilən yerə daxil edir. #1 birinci elementdir."; Blockly.Msg.<API key> = "Elementi siyahının sonuna artırır."; Blockly.Msg.<API key> = "Elementi siyahıda təsadüfi seçilmiş bir yerə atır."; Blockly.Msg.<API key> = "Siyahıda birinci elementi təyin edir."; Blockly.Msg.<API key> = "Siyahının göstərilən yerdəki elementini təyin edir. Blockly.Msg.<API key> = "Siyahının göstərilən yerdəki elementini təyin edir. #1 birinci elementdir."; Blockly.Msg.<API key> = "Siyahının sonuncu elementini təyin edir."; Blockly.Msg.<API key> = "Siyahının təsadüfi seçilmiş bir elementini təyin edir."; Blockly.Msg.LISTS_TOOLTIP = "Siyahı boşdursa \"doğru\" cavabını qaytarır."; Blockly.Msg.LOGIC_BOOLEAN_FALSE = "yalan"; Blockly.Msg.<API key> = "http://code.google.com/p/blockly/wiki/True_False"; Blockly.Msg.<API key> = "\"doğru\" və ya \"yalan\" cavanını qaytarır."; Blockly.Msg.LOGIC_BOOLEAN_TRUE = "doğru"; Blockly.Msg.<API key> = "https://en.wikipedia.org/wiki/Inequality_(mathematics)"; // untranslated Blockly.Msg.<API key> = "Girişlər bir birinə bərabərdirsə \"doğru\" cavabını qaytarır."; Blockly.Msg.<API key> = "Birinci giriş ikincidən böyükdürsə \"doğru\" cavabını qaytarır."; Blockly.Msg.<API key> = "Birinci giriş ikincidən böyük və ya bərarbərdirsə \"doğru\" cavabını qaytarır."; Blockly.Msg.<API key> = "Birinci giriş ikincidən kiçikdirsə \"doğru\" cavabını qaytarır."; Blockly.Msg.<API key> = "Birinci giriş ikincidən kiçik və ya bərarbərdirsə \"doğru\" cavabını qaytarır."; Blockly.Msg.<API key> = "Girişlər bərabər deyillərsə \"doğru\" cavabını qaytarır."; Blockly.Msg.<API key> = "http://code.google.com/p/blockly/wiki/Not"; Blockly.Msg.LOGIC_NEGATE_TITLE = "%1 deyil"; Blockly.Msg.<API key> = "Giriş \"yalan\"-dursa \"doğru\" cavabını qaytarır. Giriş \"doğru\"-dursa \"yalan\" cavabını qaytarır."; Blockly.Msg.LOGIC_NULL = "boş"; Blockly.Msg.LOGIC_NULL_HELPURL = "https://en.wikipedia.org/wiki/Nullable_type"; // untranslated Blockly.Msg.LOGIC_NULL_TOOLTIP = "Boş cavab qaytarır."; Blockly.Msg.LOGIC_OPERATION_AND = "və"; Blockly.Msg.<API key> = "http://code.google.com/p/blockly/wiki/And_Or"; Blockly.Msg.LOGIC_OPERATION_OR = "və ya"; Blockly.Msg.<API key> = "Hər iki giriş \"doğru\"-dursa \"doğru\" cavabını qaytarır."; Blockly.Msg.<API key> = "Girişlərdən heç olmasa biri \"doğru\"-dursa \"doğru\" cavabını qaytarır."; Blockly.Msg.<API key> = "test"; Blockly.Msg.<API key> = "https://en.wikipedia.org/wiki/%3F:"; // untranslated Blockly.Msg.<API key> = "əgər yalandırsa"; Blockly.Msg.<API key> = "əgər doğrudursa"; Blockly.Msg.<API key> = "'Yoxla' əmrindəki şərtə nəzər yetirin. Əgər şərt \"doğru\"-dursa \"əgər doğru\", əks halda isə \"əgər yalan\" cavabını qaytarır."; Blockly.Msg.<API key> = "+"; Blockly.Msg.<API key> = "https://az.wikipedia.org/wiki/Hesab"; Blockly.Msg.<API key> = "İki ədədin cəmini qaytarır."; Blockly.Msg.<API key> = "İki ədədin nisbətini qaytarır."; Blockly.Msg.<API key> = "İki ədədin fərqini qaytarır."; Blockly.Msg.<API key> = "İki ədədin hasilini verir."; Blockly.Msg.<API key> = "Birinci ədədin ikinci ədəd dərəcəsindən qüvvətini qaytarır."; Blockly.Msg.MATH_CHANGE_HELPURL = "https://en.wikipedia.org/wiki/Programming_idiom#<API key>"; // untranslated Blockly.Msg.<API key> = "buna:"; Blockly.Msg.<API key> = "dəyiş:"; Blockly.Msg.MATH_CHANGE_TOOLTIP = "'%1' dəyişəninin üzərinə bir ədəd artır."; Blockly.Msg.<API key> = "https://en.wikipedia.org/wiki/<API key>"; // untranslated Blockly.Msg.<API key> = "Ümumi sabitlərdən birini qaytarır π (3.141…), e (2.718…), φ (1.618…), sqrt(2) (1.414…), sqrt(½) (0.707…), və ya ∞ (sonsuzluq)."; Blockly.Msg.<API key> = "https://en.wikipedia.org/wiki/Clamping_%28graphics%29"; // untranslated Blockly.Msg.<API key> = "%1 üçün ən aşağı %2, ən yuxarı %3 olmağı tələb et"; Blockly.Msg.<API key> = "Bir ədədin verilmiş iki ədəd arasında olmasını tələb edir (sərhədlər də daxil olmaqla)."; Blockly.Msg.<API key> = "÷"; Blockly.Msg.<API key> = "bölünür"; Blockly.Msg.MATH_IS_EVEN = "cütdür"; Blockly.Msg.MATH_IS_NEGATIVE = "mənfidir"; Blockly.Msg.MATH_IS_ODD = "təkdir"; Blockly.Msg.MATH_IS_POSITIVE = "müsətdir"; Blockly.Msg.MATH_IS_PRIME = "sadədir"; Blockly.Msg.MATH_IS_TOOLTIP = "Bir ədədin cüt, tək, sadə, tam, müsbət, mənfi olmasını və ya müəyyən bir ədədə bölünməsini yoxlayır. \"Doğru\" və ya \"yalan\" qiymətini qaytarır."; Blockly.Msg.MATH_IS_WHOLE = "tamdır"; Blockly.Msg.MATH_MODULO_HELPURL = "https://en.wikipedia.org/wiki/Modulo_operation"; // untranslated Blockly.Msg.MATH_MODULO_TITLE = "%1 ÷ %2 bölməsinin qalığı"; Blockly.Msg.MATH_MODULO_TOOLTIP = "İki ədədin nisbətindən alınan qalığı qaytarır."; Blockly.Msg.<API key> = "×"; Blockly.Msg.MATH_NUMBER_HELPURL = "https://en.wikipedia.org/wiki/Number"; // untranslated Blockly.Msg.MATH_NUMBER_TOOLTIP = "Ədəd."; Blockly.Msg.MATH_ONLIST_HELPURL = ""; // untranslated Blockly.Msg.<API key> = "siyahının ədədi ortası"; Blockly.Msg.<API key> = "siyahının maksimumu"; Blockly.Msg.<API key> = "siyahının medianı"; Blockly.Msg.<API key> = "siyahının minimumu"; Blockly.Msg.<API key> = "Siyahı modları( Ən çox rastlaşılan elementləri)"; Blockly.Msg.<API key> = "siyahıdan təsadüfi seçilmiş bir element"; Blockly.Msg.<API key> = "Siyahının standart deviasiyası"; Blockly.Msg.<API key> = "Siyahının cəmi"; Blockly.Msg.<API key> = "Siyahıdaki ədədlərin ədədi ortasını qaytarır."; Blockly.Msg.<API key> = "Siyahıdaki ən böyük elementi qaytarır."; Blockly.Msg.<API key> = "Siyahının median elementini qaytarır."; Blockly.Msg.<API key> = "Siyahıdaki ən kiçik ədədi qaytarır."; Blockly.Msg.<API key> = "Siyahıdaki ən çox rastlanan element(lər)dən ibarət siyahı qaytarır."; Blockly.Msg.<API key> = "Siyahıdan təsadüfi bir element qaytarır."; Blockly.Msg.<API key> = "Siyahının standart deviasiyasını qaytarır."; Blockly.Msg.<API key> = "Siyahıdakı bütün ədədlərin cəmini qaytarır."; Blockly.Msg.MATH_POWER_SYMBOL = "^"; Blockly.Msg.<API key> = "https://en.wikipedia.org/wiki/<API key>"; // untranslated Blockly.Msg.<API key> = "təsadüfi kəsr"; Blockly.Msg.<API key> = "0.0 (daxil olmaqla) və 1.0 (daxil olmamaqla) ədədlərinin arasından təsadüfi bir kəsr ədəd qaytarır."; Blockly.Msg.<API key> = "https://en.wikipedia.org/wiki/<API key>"; // untranslated Blockly.Msg.<API key> = "%1 ilə %2 arasından təsadüfi tam ədəd"; Blockly.Msg.<API key> = "Verilmiş iki ədəd arasından (ədədrlər də daxil olmaqla) təsadüfi bir tam ədəd qaytarır."; Blockly.Msg.MATH_ROUND_HELPURL = "https://en.wikipedia.org/wiki/Rounding"; // untranslated Blockly.Msg.<API key> = "yuvarlaqlaşdır"; Blockly.Msg.<API key> = "aşağı yuvarlaqlaşdır"; Blockly.Msg.<API key> = "yuxarı yuvarlaqlaşdır"; Blockly.Msg.MATH_ROUND_TOOLTIP = "Ədədi aşağı və ya yuxari yuvarlaqşdır."; Blockly.Msg.MATH_SINGLE_HELPURL = "https://en.wikipedia.org/wiki/Square_root"; // untranslated Blockly.Msg.<API key> = "modul"; Blockly.Msg.MATH_SINGLE_OP_ROOT = "kvadrat kök"; Blockly.Msg.<API key> = "Ədədin modulunu qaytarır."; Blockly.Msg.<API key> = "e sabitinin verilmiş ədədə qüvvətini qaytarır."; Blockly.Msg.<API key> = "Ədədin natural loqarifmini tapır."; Blockly.Msg.<API key> = "Ədədin 10-cu dərəcədən loqarifmini tapır."; Blockly.Msg.<API key> = "Ədədin əksini qaytarır."; Blockly.Msg.<API key> = "10-un verilmiş ədədə qüvvətini qaytarır."; Blockly.Msg.<API key> = "Ədədin kvadrat kökünü qaytarır."; Blockly.Msg.<API key> = "-"; Blockly.Msg.MATH_TRIG_ACOS = "arccos"; Blockly.Msg.MATH_TRIG_ASIN = "arcsin"; Blockly.Msg.MATH_TRIG_ATAN = "arctan"; Blockly.Msg.MATH_TRIG_COS = "cos"; Blockly.Msg.MATH_TRIG_HELPURL = "https://en.wikipedia.org/wiki/<API key>"; // untranslated Blockly.Msg.MATH_TRIG_SIN = "sin"; Blockly.Msg.MATH_TRIG_TAN = "tg"; Blockly.Msg.<API key> = "Ədədin arccosinusunu qaytarır."; Blockly.Msg.<API key> = "Ədədin arcsinusunu qaytarır."; Blockly.Msg.<API key> = "Ədədin arctanqensini qaytarır."; Blockly.Msg.<API key> = "Dərəcənin kosinusunu qaytarır (radianın yox)."; Blockly.Msg.<API key> = "Dərəcənin sinusunu qaytar (radianın yox)."; Blockly.Msg.<API key> = "Dərəcənin tangensini qaytar (radianın yox)."; Blockly.Msg.NEW_VARIABLE = "Yeni dəyişən..."; Blockly.Msg.NEW_VARIABLE_TITLE = "Yeni dəyişənin adı:"; Blockly.Msg.<API key> = ""; // untranslated Blockly.Msg.<API key> = "ilə:"; Blockly.Msg.<API key> = ""; // untranslated Blockly.Msg.<API key> = "https://en.wikipedia.org/wiki/Procedure_%28computer_science%29"; // untranslated Blockly.Msg.<API key> = "Yaradılmış '%1' funksiyasını çalışdır."; Blockly.Msg.<API key> = "https://en.wikipedia.org/wiki/Procedure_%28computer_science%29"; // untranslated Blockly.Msg.<API key> = "Yaradılmış '%1' funksiyasını çalışdır və nəticəni istifadə et."; Blockly.Msg.<API key> = "'%1' yarat"; Blockly.Msg.<API key> = ""; // untranslated Blockly.Msg.<API key> = "https://en.wikipedia.org/wiki/Procedure_%28computer_science%29"; // untranslated Blockly.Msg.<API key> = "hansısa əməliyyat"; Blockly.Msg.<API key> = "icra et:"; Blockly.Msg.<API key> = "Nəticəsi olmayan funksiya yaradır."; Blockly.Msg.<API key> = "https://en.wikipedia.org/wiki/Procedure_%28computer_science%29"; // untranslated Blockly.Msg.<API key> = "qaytar"; Blockly.Msg.<API key> = "Nəticəsi olan funksiya yaradır."; Blockly.Msg.<API key> = "Xəbərdarlıq: Bu funksiyanın təkrar olunmuş parametrləri var."; Blockly.Msg.<API key> = "Funksiyanın təyinatını vurğula"; Blockly.Msg.<API key> = "Əgər bir dəyər \"doğru\"-dursa onda ikinci dəyəri qaytar."; Blockly.Msg.<API key> = "Xəbərdarlıq: Bu blok ancaq bir funksiyanın təyinatı daxilində işlədilə bilər."; Blockly.Msg.<API key> = "Giriş adı:"; Blockly.Msg.<API key> = "girişlər"; Blockly.Msg.REMOVE_COMMENT = "Şərhi sil"; Blockly.Msg.RENAME_VARIABLE = "Dəyişənin adını dəyiş..."; Blockly.Msg.<API key> = "Bütün '%1' dəyişənlərinin adını buna dəyiş:"; Blockly.Msg.<API key> = "bu mətni əlavə et:"; Blockly.Msg.TEXT_APPEND_HELPURL = "https://code.google.com/p/blockly/wiki/Text#Text_modification"; Blockly.Msg.TEXT_APPEND_TO = "bu mətnin sonuna:"; Blockly.Msg.TEXT_APPEND_TOOLTIP = "'%1' dəyişəninin sonuna nəsə əlavə et."; Blockly.Msg.<API key> = "https://code.google.com/p/blockly/wiki/Text#Adjusting_text_case"; Blockly.Msg.<API key> = "kiçik hərflərlə"; Blockly.Msg.<API key> = "Baş Hərflərlə"; Blockly.Msg.<API key> = "BÖYÜK HƏRFLƏRLƏ"; Blockly.Msg.<API key> = "Mətndə hərflərin böyük-kiçikliyini dəyiş."; Blockly.Msg.TEXT_CHARAT_FIRST = "birinci hərfi götür"; Blockly.Msg.<API key> = "axırdan bu nömrəli hərfi götür"; Blockly.Msg.<API key> = "bu nömrəli hərfi götür"; Blockly.Msg.TEXT_CHARAT_HELPURL = "https://code.google.com/p/blockly/wiki/Text#Extracting_text"; Blockly.Msg.<API key> = "növbəti mətndə"; Blockly.Msg.TEXT_CHARAT_LAST = "axırıncı hərfi götür"; Blockly.Msg.TEXT_CHARAT_RANDOM = "təsadüfi hərf götür"; Blockly.Msg.TEXT_CHARAT_TAIL = ""; // untranslated Blockly.Msg.TEXT_CHARAT_TOOLTIP = "Göstərilən mövqedəki hərfi qaytarır."; Blockly.Msg.<API key> = "Mətnə bir element əlavə et."; Blockly.Msg.<API key> = "birləşdir"; Blockly.Msg.<API key> = "Bu mətn blokunu yenidən konfigurasiya etmək üçün bölmələri əlavə edin, silin və ya yerlərini dəyişin."; Blockly.Msg.<API key> = "axırdan bu nömrəli hərfə qədər"; Blockly.Msg.<API key> = "bu nömrəli hərfə qədər"; Blockly.Msg.<API key> = "son hərfə qədər"; Blockly.Msg.<API key> = "http://code.google.com/p/blockly/wiki/Text#<API key>"; Blockly.Msg.<API key> = "mətndə"; Blockly.Msg.<API key> = "Mətnin surətini ilk hərfdən"; Blockly.Msg.<API key> = "Mətnin surətini sondan bu nömrəli Blockly.Msg.<API key> = "Mətnin surətini bu nömrəli hərfdən"; Blockly.Msg.<API key> = ""; // untranslated Blockly.Msg.<API key> = "Mətnin təyin olunmuş hissəsini qaytarır."; Blockly.Msg.<API key> = "https://code.google.com/p/blockly/wiki/Text#Finding_text"; Blockly.Msg.<API key> = "mətndə"; Blockly.Msg.<API key> = "Bu mətn ilə ilk rastlaşmanı tap:"; Blockly.Msg.<API key> = "Bu mətn ilə son rastlaşmanı tap:"; Blockly.Msg.TEXT_INDEXOF_TAIL = ""; // untranslated Blockly.Msg.<API key> = "Birinci mətnin ikinci mətndə ilk/son rastlaşma indeksini qaytarır. Əgər rastlaşma baş verməzsə, 0 qaytarır."; Blockly.Msg.<API key> = "https://code.google.com/p/blockly/wiki/Text#<API key>"; Blockly.Msg.TEXT_ISEMPTY_TITLE = "%1 boşdur"; Blockly.Msg.<API key> = "Verilmiş mətn boşdursa, doğru qiymətini qaytarır."; Blockly.Msg.TEXT_JOIN_HELPURL = "https://code.google.com/p/blockly/wiki/Text#Text_creation"; Blockly.Msg.<API key> = "Verilmişlərlə mətn yarat"; Blockly.Msg.TEXT_JOIN_TOOLTIP = "İxtiyari sayda elementlərinin birləşməsi ilə mətn parçası yarat."; Blockly.Msg.TEXT_LENGTH_HELPURL = "https://code.google.com/p/blockly/wiki/Text#Text_modification"; Blockly.Msg.TEXT_LENGTH_TITLE = "%1 - ın uzunluğu"; Blockly.Msg.TEXT_LENGTH_TOOLTIP = "Verilmiş mətndəki hərflərin(sözlər arası boşluqlar sayılmaqla) sayını qaytarır."; Blockly.Msg.TEXT_PRINT_HELPURL = "https://code.google.com/p/blockly/wiki/Text#Printing_text"; Blockly.Msg.TEXT_PRINT_TITLE = "%1 - i çap elə"; Blockly.Msg.TEXT_PRINT_TOOLTIP = "Təyin olunmuş mətn, ədəd və ya hər hansı bir başqa elementi çap elə."; Blockly.Msg.TEXT_PROMPT_HELPURL = "https://code.google.com/p/blockly/wiki/Text#<API key>"; Blockly.Msg.<API key> = "İstifadəçiyə ədəd daxil etməsi üçün sorğu/tələb göndərin."; Blockly.Msg.<API key> = "İstifadəçiyə mətn daxil etməsi üçün sorğu/tələb göndərin."; Blockly.Msg.<API key> = "İstifadəçiyə ədəd daxil etməsi üçün sorğunu/tələbi ismarıc kimi göndərin"; Blockly.Msg.<API key> = "İstifadəçiyə mətn daxil etməsi üçün sorğunu/tələbi ismarıc ilə göndərin"; Blockly.Msg.TEXT_TEXT_HELPURL = "https://en.wikipedia.org/wiki/String_(computer_science)"; // untranslated Blockly.Msg.TEXT_TEXT_TOOLTIP = "Mətndəki hərf, söz və ya sətir."; Blockly.Msg.TEXT_TRIM_HELPURL = "https://code.google.com/p/blockly/wiki/Text#Trimming_%28removing%29_spaces"; Blockly.Msg.<API key> = "Boşluqları hər iki tərəfdən pozun"; Blockly.Msg.<API key> = "Boşluqlari yalnız sol tərəfdən pozun"; Blockly.Msg.<API key> = "Boşluqları yalnız sağ tərəfdən pozun"; Blockly.Msg.TEXT_TRIM_TOOLTIP = "Mətnin hər iki və ya yalnız bir tərəfdən olan boşluqları pozulmuş surətini qaytarın."; Blockly.Msg.<API key> = "element"; Blockly.Msg.<API key> = "'%1 - i təyin et' - i yarat"; Blockly.Msg.<API key> = "http://code.google.com/p/blockly/wiki/Variables#Get"; Blockly.Msg.VARIABLES_GET_TAIL = ""; // untranslated Blockly.Msg.VARIABLES_GET_TITLE = ""; // untranslated Blockly.Msg.<API key> = "Bu dəyişənin qiymətini qaytarır."; Blockly.Msg.<API key> = "'%1 - i götür' - ü yarat"; Blockly.Msg.<API key> = "http://code.google.com/p/blockly/wiki/Variables#Set"; Blockly.Msg.VARIABLES_SET_TAIL = "- i bu qiymət ilə təyin et:"; Blockly.Msg.VARIABLES_SET_TITLE = "set"; // untranslated Blockly.Msg.<API key> = "Bu dəyişəni daxil edilmiş qiymətə bərabər edir."; Blockly.Msg.<API key> = Blockly.Msg.<API key>; Blockly.Msg.<API key> = Blockly.Msg.LISTS_INLIST; Blockly.Msg.<API key> = Blockly.Msg.LISTS_INLIST; Blockly.Msg.<API key> = Blockly.Msg.<API key>; Blockly.Msg.VARIABLES_SET_ITEM = Blockly.Msg.<API key>; Blockly.Msg.<API key> = Blockly.Msg.<API key>; Blockly.Msg.<API key> = Blockly.Msg.<API key>; Blockly.Msg.VARIABLES_GET_ITEM = Blockly.Msg.<API key>; Blockly.Msg.<API key> = Blockly.Msg.<API key>; Blockly.Msg.<API key> = Blockly.Msg.<API key>; Blockly.Msg.<API key> = Blockly.Msg.<API key>; Blockly.Msg.<API key> = Blockly.Msg.<API key>; Blockly.Msg.<API key> = Blockly.Msg.LISTS_INLIST; Blockly.Msg.<API key> = Blockly.Msg.<API key>; Blockly.Msg.<API key> = Blockly.Msg.LISTS_INLIST; Blockly.Msg.<API key> = Blockly.Msg.<API key>; Blockly.Msg.<API key> = Blockly.Msg.<API key>; Blockly.Msg.<API key> = Blockly.Msg.CONTROLS_IF_MSG_IF; Blockly.Msg.<API key> = Blockly.Msg.<API key>; Blockly.Msg.<API key> = Blockly.Msg.<API key>; Blockly.Msg.<API key> = Blockly.Msg.<API key>; Blockly.Msg.<API key> = Blockly.Msg.<API key>;
// +build dfssh package dockerfile2llb import ( "github.com/moby/buildkit/client/llb" "github.com/moby/buildkit/frontend/dockerfile/instructions" "github.com/pkg/errors" ) func dispatchSSH(m *instructions.Mount) (llb.RunOption, error) { if m.Source != "" { return nil, errors.Errorf("ssh does not support source") } opts := []llb.SSHOption{llb.SSHID(m.CacheID)} if m.Target != "" { opts = append(opts, llb.SSHSocketTarget(m.Target)) } if !m.Required { opts = append(opts, llb.SSHOptional) } return llb.AddSSHSocket(opts...), nil }
package org.python.util.install.driver; import java.io.<API key>; import java.io.File; import java.io.IOException; import java.io.PrintStream; import java.nio.file.Paths; import java.util.Arrays; import java.util.List; import java.util.StringTokenizer; import org.python.util.install.ChildProcess; import org.python.util.install.FileHelper; public class NormalVerifier implements Verifier { protected static final String AUTOTEST_PY = "autotest.py"; private static final String BIN = "bin"; private static final String JYTHON_UP = "jython up and running!"; private static final String JYTHON = "jython"; private static final String VERIFYING = "verifying"; private File _targetDir; public void setTargetDir(File targetDir) { _targetDir = targetDir; } public File getTargetDir() { return _targetDir; } public void verify() throws DriverException { <API key>(); // create the test .py script // verify the most simple start of jython works verifyStart(getSimpleCommand()); } /** * Will be overridden in subclass StandaloneVerifier * * @return the command array to start jython with * @throws DriverException * if there was a problem getting the target directory path */ protected String[] getSimpleCommand() throws DriverException { return new String[] { Paths.get(BIN).resolve(JYTHON).toString(), _targetDir.toPath().resolve(AUTOTEST_PY).toString() }; } /** * @return The directory where to create the shell script test command in. * * @throws DriverException */ protected final File <API key>() throws DriverException { return _targetDir.toPath().resolve(BIN).toFile(); } /** * Internal method verifying a jython-starting command by capturing the output * * @param command * * @throws DriverException */ private void verifyStart(String[] command) throws DriverException { ChildProcess p = new ChildProcess(command); p.setDebug(true); p.setCWD(_targetDir.toPath()); System.err.println("Verify start: command=" + Arrays.toString(command) + ", cwd=" + p.getCWD()); int exitValue = p.run(); // if (exitValue != 0) { // throw new DriverException("start of jython failed\n" // + "command: " + Arrays.toString(command) // + "\ncwd: " + p.getCWD() // + "\nexit value: " + exitValue // + "\nstdout: " + p.getStdout() // + "\nstderr: " + p.getStderr()); verifyError(p.getStderr()); verifyOutput(p.getStdout()); } /** * Will be overridden in subclass StandaloneVerifier * * @return <code>true</code> if the jython start shell script should be verified (using * different options) */ protected boolean doShellScriptTests() { return true; } private void verifyError(List<String> stderr) throws DriverException { for (String line : stderr) { if (isExpectedError(line)) { feedback(line); } else { throw new DriverException(stderr.toString()); } } } private boolean isExpectedError(String line) { boolean expected = false; if (line.startsWith("*sys-package-mgr*")) { expected = true; } return expected; } private void verifyOutput(List<String> stdout) throws DriverException { boolean started = false; for (String line : stdout) { if (isExpectedOutput(line)) { feedback(line); if (line.startsWith(JYTHON_UP)) { started = true; } } else { throw new DriverException(stdout.toString()); } } if (!started) { throw new DriverException("start of jython failed:\n" + stdout.toString()); } } private boolean isExpectedOutput(String line) { boolean expected = false; if (line.startsWith("[ChildProcess]") || line.startsWith(VERIFYING)) { expected = true; } else if (line.startsWith(JYTHON_UP)) { expected = true; } return expected; } private String getTestScript() { StringBuilder b = new StringBuilder(80); b.append("import sys\n"); b.append("import os\n"); b.append("print '"); b.append(JYTHON_UP); b.append("'\n"); return b.toString(); } private void <API key>() throws DriverException { File file = new File(getTargetDir(), AUTOTEST_PY); try { FileHelper.write(file, getTestScript()); } catch (IOException ioe) { throw new DriverException(ioe); } } private void feedback(String line) { System.out.println("feedback " + line); } }
package org.wso2.carbon.apimgt.rest.integration.tests.model; import java.util.Objects; import com.google.gson.annotations.SerializedName; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.util.ArrayList; import java.util.List; /** * CORS configuration for the API */ @ApiModel(description = "CORS configuration for the API ") @javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaClientCodegen", date = "2017-05-09T06:36:48.873Z") public class <API key> { @SerializedName("<API key>") private Boolean <API key> = false; @SerializedName("<API key>") private List<String> <API key> = new ArrayList<String>(); @SerializedName("<API key>") private Boolean <API key> = false; @SerializedName("<API key>") private List<String> <API key> = new ArrayList<String>(); @SerializedName("<API key>") private List<String> <API key> = new ArrayList<String>(); public <API key> <API key>(Boolean <API key>) { this.<API key> = <API key>; return this; } /** * Get <API key> * @return <API key> **/ @ApiModelProperty(example = "null", value = "") public Boolean <API key>() { return <API key>; } public void <API key>(Boolean <API key>) { this.<API key> = <API key>; } public <API key> <API key>(List<String> <API key>) { this.<API key> = <API key>; return this; } public <API key> <API key>(String <API key>) { this.<API key>.add(<API key>); return this; } /** * Get <API key> * @return <API key> **/ @ApiModelProperty(example = "null", value = "") public List<String> <API key>() { return <API key>; } public void <API key>(List<String> <API key>) { this.<API key> = <API key>; } public <API key> <API key>(Boolean <API key>) { this.<API key> = <API key>; return this; } /** * Get <API key> * @return <API key> **/ @ApiModelProperty(example = "null", value = "") public Boolean <API key>() { return <API key>; } public void <API key>(Boolean <API key>) { this.<API key> = <API key>; } public <API key> <API key>(List<String> <API key>) { this.<API key> = <API key>; return this; } public <API key> <API key>(String <API key>) { this.<API key>.add(<API key>); return this; } /** * Get <API key> * @return <API key> **/ @ApiModelProperty(example = "null", value = "") public List<String> <API key>() { return <API key>; } public void <API key>(List<String> <API key>) { this.<API key> = <API key>; } public <API key> <API key>(List<String> <API key>) { this.<API key> = <API key>; return this; } public <API key> <API key>(String <API key>) { this.<API key>.add(<API key>); return this; } /** * Get <API key> * @return <API key> **/ @ApiModelProperty(example = "null", value = "") public List<String> <API key>() { return <API key>; } public void <API key>(List<String> <API key>) { this.<API key> = <API key>; } @Override public boolean equals(java.lang.Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } <API key> <API key> = (<API key>) o; return Objects.equals(this.<API key>, <API key>.<API key>) && Objects.equals(this.<API key>, <API key>.<API key>) && Objects.equals(this.<API key>, <API key>.<API key>) && Objects.equals(this.<API key>, <API key>.<API key>) && Objects.equals(this.<API key>, <API key>.<API key>); } @Override public int hashCode() { return Objects.hash(<API key>, <API key>, <API key>, <API key>, <API key>); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class <API key> {\n"); sb.append(" <API key>: ").append(toIndentedString(<API key>)).append("\n"); sb.append(" <API key>: ").append(toIndentedString(<API key>)).append("\n"); sb.append(" <API key>: ").append(toIndentedString(<API key>)).append("\n"); sb.append(" <API key>: ").append(toIndentedString(<API key>)).append("\n"); sb.append(" <API key>: ").append(toIndentedString(<API key>)).append("\n"); sb.append("}"); return sb.toString(); } /** * Convert the given object to string with each line indented by 4 spaces * (except the first line). */ private String toIndentedString(java.lang.Object o) { if (o == null) { return "null"; } return o.toString().replace("\n", "\n "); } }
#if !defined(<API key>) #define <API key> #if defined(_WIN32) #if defined(ALIZE_EXPORTS) #define ALIZE_API __declspec(dllexport) #else #define ALIZE_API __declspec(dllimport) #endif #else #define ALIZE_API #endif #include "FileWriter.h" namespace alize { class Mixture; class MixtureGD; class Config; class MixtureGF; Convenient class used to save 1 mixture in a raw or xml file @author Frederic Wils frederic.wils@lia.univ-avignon.fr @version 1.0 @date 2003 class ALIZE_API MixtureFileWriter : public FileWriter { public : Create a new MixtureFileWriter object to save a mixture in a file @param f the name of the file @param c the configuration to use explicit MixtureFileWriter(const FileName& f, const Config& c); virtual ~MixtureFileWriter(); Write a mixture to the file @param mixture the mixture to save @exception IOException if an I/O error occurs virtual void writeMixture(const Mixture& mixture); virtual String getClassName() const; private : const Config& _config; String getFullFileName(const Config&, const FileName&) const; void writeMixtureGD_XML(const MixtureGD&); void writeMixtureGD_RAW(const MixtureGD&); void writeMixtureGD_ETAT(const MixtureGD&); void writeMixtureGF_XML(const MixtureGF&); void writeMixtureGF_RAW(const MixtureGF&); MixtureFileWriter(const MixtureFileWriter&); /*!Not implemented*/ const MixtureFileWriter& operator=( const MixtureFileWriter&); /*!Not implemented*/ bool operator==(const MixtureFileWriter&) const; /*!Not implemented*/ bool operator!=(const MixtureFileWriter&) const; /*!Not implemented*/ }; } // end namespace alize #endif // !defined(<API key>)
<!--[metadata]> +++ title = "service tasks" description = "The service tasks command description and usage" keywords = ["service, tasks"] advisory = "rc" [menu.main] parent = "smn_cli" +++ <![end-metadata] # service tasks Markdown Usage: docker service tasks [OPTIONS] SERVICE List the tasks of a service Options: -a, --all Display all tasks -f, --filter value Filter output based on conditions provided --help Print usage -n, --no-resolve Do not map IDs to Names Lists the tasks that are running as part of the specified service. This command has to be run targeting a manager node. ## Examples Listing the tasks that are part of a service The following command shows all the tasks that are part of the `redis` service: bash $ docker service tasks redis ID NAME SERVICE IMAGE LAST STATE DESIRED STATE NODE <API key> redis.1 redis redis:3.0.6 Running 8 seconds Running manager1 <API key> redis.2 redis redis:3.0.6 Running 9 seconds Running worker2 <API key> redis.3 redis redis:3.0.6 Running 9 seconds Running worker1 <API key> redis.4 redis redis:3.0.6 Running 9 seconds Running worker1 <API key> redis.5 redis redis:3.0.6 Running 8 seconds Running manager1 <API key> redis.6 redis redis:3.0.6 Running 9 seconds Running worker2 <API key> redis.7 redis redis:3.0.6 Running 9 seconds Running worker2 <API key> redis.8 redis redis:3.0.6 Running 9 seconds Running worker1 <API key> redis.9 redis redis:3.0.6 Running 8 seconds Running manager1 <API key> redis.10 redis redis:3.0.6 Running 8 seconds Running manager1 ## Filtering The filtering flag (`-f` or `--filter`) format is a `key=value` pair. If there is more than one filter, then pass multiple flags (e.g. `--filter "foo=bar" --filter "bif=baz"`). Multiple filter flags are combined as an `OR` filter. For example, `-f type=custom -f type=builtin` returns both `custom` and `builtin` networks. The currently supported filters are: * [id]( * [name](#name) The `id` filter matches on all or a prefix of a task's ID. bash $ docker service tasks -f "id=8" redis ID NAME SERVICE IMAGE LAST STATE DESIRED STATE NODE <API key> redis.4 redis redis:3.0.6 Running 4 minutes Running worker1 <API key> redis.10 redis redis:3.0.6 Running 4 minutes Running manager1 # Name The `name` filter matches on task names. bash $ docker service tasks -f "name=redis.1" redis ID NAME SERVICE IMAGE DESIRED STATE LAST STATE NODE <API key> redis.1 redis redis:3.0.6 Running Running 8 seconds manager1 ## Related information * [service create](service_create.md) * [service inspect](service_inspect.md) * [service ls](service_ls.md) * [service rm](service_rm.md) * [service scale](service_scale.md) * [service update](service_update.md)
#pragma once #include <string> #include <vector> #include "rocksdb/rocksdb_namespace.h" #include "rocksdb/slice.h" #include "rocksdb/status.h" #include "rocksdb/trace_record.h" namespace ROCKSDB_NAMESPACE { class <API key>; class <API key>; class <API key>; class <API key>; // Base class for the results of all types of trace records. // Theses classes can be used to report the execution result of // TraceRecord::Handler::Handle() or TraceRecord::Accept(). class TraceRecordResult { public: explicit TraceRecordResult(TraceType trace_type); virtual ~TraceRecordResult() = default; // Trace type of the corresponding TraceRecord. virtual TraceType GetTraceType() const; class Handler { public: virtual ~Handler() = default; virtual Status Handle(const <API key>& result) = 0; virtual Status Handle(const <API key>& result) = 0; virtual Status Handle(const <API key>& result) = 0; virtual Status Handle(const <API key>& result) = 0; }; // Accept the handler. virtual Status Accept(Handler* handler) = 0; private: TraceType trace_type_; }; // Base class for the results from the trace record execution handler (created // by TraceRecord::NewExecutionHandler()). // The actual execution status or returned values may be hidden from // TraceRecord::Handler::Handle and TraceRecord::Accept. For example, a // GetQueryTraceRecord's execution calls DB::Get() internally. DB::Get() may // return Status::NotFound() but TraceRecord::Handler::Handle() or // TraceRecord::Accept() will still return Status::OK(). The actual status from // DB::Get() and the returned value string may be saved in a // <API key>. class <API key> : public TraceRecordResult { public: <API key>(uint64_t start_timestamp, uint64_t end_timestamp, TraceType trace_type); // Execution start/end timestamps and request latency in microseconds. virtual uint64_t GetStartTimestamp() const; virtual uint64_t GetEndTimestamp() const; inline uint64_t GetLatency() const { return GetEndTimestamp() - GetStartTimestamp(); } private: uint64_t ts_start_; uint64_t ts_end_; }; // Result for operations that only return a single Status. // Example operation: DB::Write() class <API key> : public <API key> { public: <API key>(Status status, uint64_t start_timestamp, uint64_t end_timestamp, TraceType trace_type); virtual ~<API key>() override = default; // Return value of DB::Write(), etc. virtual const Status& GetStatus() const; virtual Status Accept(Handler* handler) override; private: Status status_; }; // Result for operations that return a Status and a value. // Example operation: DB::Get() class <API key> : public <API key> { public: <API key>(Status status, const std::string& value, uint64_t start_timestamp, uint64_t end_timestamp, TraceType trace_type); <API key>(Status status, std::string&& value, uint64_t start_timestamp, uint64_t end_timestamp, TraceType trace_type); virtual ~<API key>() override; // Return status of DB::Get(). virtual const Status& GetStatus() const; // Value for the searched key. virtual const std::string& GetValue() const; virtual Status Accept(Handler* handler) override; private: Status status_; std::string value_; }; // Result for operations that return multiple Status(es) and values as vectors. // Example operation: DB::MultiGet() class <API key> : public <API key> { public: <API key>(std::vector<Status> multi_status, std::vector<std::string> values, uint64_t start_timestamp, uint64_t end_timestamp, TraceType trace_type); virtual ~<API key>() override; // Returned Status(es) of DB::MultiGet(). virtual const std::vector<Status>& GetMultiStatus() const; // Returned values for the searched keys. virtual const std::vector<std::string>& GetValues() const; virtual Status Accept(Handler* handler) override; private: std::vector<Status> multi_status_; std::vector<std::string> values_; }; // Result for Iterator operations. // Example operations: Iterator::Seek(), Iterator::SeekForPrev() class <API key> : public <API key> { public: <API key>(bool valid, Status status, PinnableSlice&& key, PinnableSlice&& value, uint64_t start_timestamp, uint64_t end_timestamp, TraceType trace_type); <API key>(bool valid, Status status, const std::string& key, const std::string& value, uint64_t start_timestamp, uint64_t end_timestamp, TraceType trace_type); virtual ~<API key>() override; // Return if the Iterator is valid. virtual bool GetValid() const; // Return the status of the Iterator. virtual const Status& GetStatus() const; // Key of the current iterating entry, empty if GetValid() is false. virtual Slice GetKey() const; // Value of the current iterating entry, empty if GetValid() is false. virtual Slice GetValue() const; virtual Status Accept(Handler* handler) override; private: bool valid_; Status status_; PinnableSlice key_; PinnableSlice value_; }; } // namespace ROCKSDB_NAMESPACE
#!/usr/bin/env bash set -e cd "$(dirname "$BASH_SOURCE")/.." rm -rf vendor/ source 'hack/.vendor-helpers.sh' # the following lines are in sorted order, FYI clone git github.com/Azure/go-ansiterm <SHA1-like> clone git github.com/Sirupsen/logrus v0.8.2 # logrus is a common dependency among multiple deps clone git github.com/docker/libtrust <SHA1-like> clone git github.com/go-check/check <SHA1-like> clone git github.com/gorilla/context 14f550f51a clone git github.com/gorilla/mux e444e69cbd clone git github.com/kr/pty 5cf931ef8f clone git github.com/mattn/go-shellwords v1.0.0 clone git github.com/mattn/go-sqlite3 v1.1.0 clone git github.com/microsoft/hcsshim <SHA1-like> clone git github.com/mistifyio/go-zfs v2.1.1 clone git github.com/tchap/go-patricia v2.1.0 clone git github.com/vdemeester/shakers <SHA1-like> clone git golang.org/x/net <SHA1-like> https://github.com/golang/net.git #get libnetwork packages clone git github.com/docker/libnetwork <SHA1-like> clone git github.com/armon/go-metrics <SHA1-like> clone git github.com/hashicorp/go-msgpack <SHA1-like> clone git github.com/hashicorp/memberlist <SHA1-like> clone git github.com/hashicorp/serf <SHA1-like> clone git github.com/docker/libkv <SHA1-like> clone git github.com/vishvananda/netns <SHA1-like> clone git github.com/vishvananda/netlink <SHA1-like> clone git github.com/BurntSushi/toml <SHA1-like> clone git github.com/samuel/go-zookeeper <SHA1-like> clone git github.com/deckarep/golang-set <SHA1-like> clone git github.com/coreos/etcd v2.2.0 <API key> github.com/coreos/etcd clone git github.com/ugorji/go <SHA1-like> clone git github.com/hashicorp/consul v0.5.2 clone git github.com/boltdb/bolt v1.1.0 # get graph and distribution packages clone git github.com/docker/distribution <SHA1-like> clone git github.com/vbatts/tar-split v0.9.11 clone git github.com/docker/notary <SHA1-like> clone git google.golang.org/grpc <SHA1-like> https://github.com/grpc/grpc-go.git clone git github.com/miekg/pkcs11 <SHA1-like> clone git github.com/jfrazelle/go v1.5.1-1 clone git github.com/agl/ed25519 <SHA1-like> clone git github.com/opencontainers/runc v0.0.5 # libcontainer clone git github.com/opencontainers/specs <SHA1-like> # specs clone git github.com/seccomp/libseccomp-golang <SHA1-like> # libcontainer deps (see src/github.com/opencontainers/runc/Godeps/Godeps.json) clone git github.com/coreos/go-systemd v4 clone git github.com/godbus/dbus v3 clone git github.com/syndtr/gocapability <SHA1-like> clone git github.com/golang/protobuf <SHA1-like> # gelf logging driver deps clone git github.com/Graylog2/go-gelf <SHA1-like> clone git github.com/fluent/<API key> v1.0.0 # <API key> deps clone git github.com/philhofer/fwd <SHA1-like> clone git github.com/tinylib/msgp <SHA1-like> # fsnotify clone git gopkg.in/fsnotify.v1 v1.2.0 # awslogs deps clone git github.com/aws/aws-sdk-go v0.9.9 clone git github.com/vaughan0/go-ini <SHA1-like> clean
"""Abstract Base Classes (ABCs) for collections, according to PEP 3119. DON'T USE THIS MODULE DIRECTLY! The classes here should be imported via collections; they are defined here only to alleviate certain bootstrapping issues. Unit tests are in test_collections. """ from abc import ABCMeta, abstractmethod import sys __all__ = ["Hashable", "Iterable", "Iterator", "Sized", "Container", "Callable", "Set", "MutableSet", "Mapping", "MutableMapping", "MappingView", "KeysView", "ItemsView", "ValuesView", "Sequence", "MutableSequence", ] ONE-TRICK PONIES class Hashable: __metaclass__ = ABCMeta @abstractmethod def __hash__(self): return 0 @classmethod def __subclasshook__(cls, C): if cls is Hashable: for B in C.__mro__: if "__hash__" in B.__dict__: if B.__dict__["__hash__"]: return True break return NotImplemented class Iterable: __metaclass__ = ABCMeta @abstractmethod def __iter__(self): while False: yield None @classmethod def __subclasshook__(cls, C): if cls is Iterable: if any("__iter__" in B.__dict__ for B in C.__mro__): return True return NotImplemented Iterable.register(str) class Iterator(Iterable): @abstractmethod def __next__(self): raise StopIteration def __iter__(self): return self @classmethod def __subclasshook__(cls, C): if cls is Iterator: if any("next" in B.__dict__ for B in C.__mro__): return True return NotImplemented class Sized: __metaclass__ = ABCMeta @abstractmethod def __len__(self): return 0 @classmethod def __subclasshook__(cls, C): if cls is Sized: if any("__len__" in B.__dict__ for B in C.__mro__): return True return NotImplemented class Container: __metaclass__ = ABCMeta @abstractmethod def __contains__(self, x): return False @classmethod def __subclasshook__(cls, C): if cls is Container: if any("__contains__" in B.__dict__ for B in C.__mro__): return True return NotImplemented class Callable: __metaclass__ = ABCMeta @abstractmethod def __call__(self, *args, **kwds): return False @classmethod def __subclasshook__(cls, C): if cls is Callable: if any("__call__" in B.__dict__ for B in C.__mro__): return True return NotImplemented SETS class Set(Sized, Iterable, Container): """A set is a finite, iterable container. This class provides concrete generic implementations of all methods except for __contains__, __iter__ and __len__. To override the comparisons (presumably for speed, as the semantics are fixed), all you have to do is redefine __le__ and then the other operations will automatically follow suit. """ def __le__(self, other): if not isinstance(other, Set): return NotImplemented if len(self) > len(other): return False for elem in self: if elem not in other: return False return True def __lt__(self, other): if not isinstance(other, Set): return NotImplemented return len(self) < len(other) and self.__le__(other) def __gt__(self, other): if not isinstance(other, Set): return NotImplemented return other < self def __ge__(self, other): if not isinstance(other, Set): return NotImplemented return other <= self def __eq__(self, other): if not isinstance(other, Set): return NotImplemented return len(self) == len(other) and self.__le__(other) def __ne__(self, other): return not (self == other) @classmethod def _from_iterable(cls, it): '''Construct an instance of the class from any iterable input. Must override this method if the class constructor signature does not accept an iterable for an input. ''' return cls(it) def __and__(self, other): if not isinstance(other, Iterable): return NotImplemented return self._from_iterable(value for value in other if value in self) def isdisjoint(self, other): for value in other: if value in self: return False return True def __or__(self, other): if not isinstance(other, Iterable): return NotImplemented chain = (e for s in (self, other) for e in s) return self._from_iterable(chain) def __sub__(self, other): if not isinstance(other, Set): if not isinstance(other, Iterable): return NotImplemented other = self._from_iterable(other) return self._from_iterable(value for value in self if value not in other) def __xor__(self, other): if not isinstance(other, Set): if not isinstance(other, Iterable): return NotImplemented other = self._from_iterable(other) return (self - other) | (other - self) # Sets are not hashable by default, but subclasses can change this __hash__ = None def _hash(self): """Compute the hash value of a set. Note that we don't define __hash__: not all sets are hashable. But if you define a hashable set type, its __hash__ should call this function. This must be compatible __eq__. All sets ought to compare equal if they contain the same elements, regardless of how they are implemented, and regardless of the order of the elements; so there's not much freedom for __eq__ or __hash__. We match the algorithm used by the built-in frozenset type. """ MAX = sys.maxint MASK = 2 * MAX + 1 n = len(self) h = 1927868237 * (n + 1) h &= MASK for x in self: hx = hash(x) h ^= (hx ^ (hx << 16) ^ 89869747) * 3644798167 h &= MASK h = h * 69069 + 907133923 h &= MASK if h > MAX: h -= MASK + 1 if h == -1: h = 590923713 return h Set.register(frozenset) class MutableSet(Set): @abstractmethod def add(self, value): """Return True if it was added, False if already there.""" raise NotImplementedError @abstractmethod def discard(self, value): """Return True if it was deleted, False if not there.""" raise NotImplementedError def remove(self, value): """Remove an element. If not a member, raise a KeyError.""" if value not in self: raise KeyError(value) self.discard(value) def pop(self): """Return the popped value. Raise KeyError if empty.""" it = iter(self) try: value = it.__next__() except StopIteration: raise KeyError self.discard(value) return value def clear(self): """This is slow (creates N new iterators!) but effective.""" try: while True: self.pop() except KeyError: pass def __ior__(self, it): for value in it: self.add(value) return self def __iand__(self, c): for value in self: if value not in c: self.discard(value) return self def __ixor__(self, it): if not isinstance(it, Set): it = self._from_iterable(it) for value in it: if value in self: self.discard(value) else: self.add(value) return self def __isub__(self, it): for value in it: self.discard(value) return self MutableSet.register(set) MAPPINGS class Mapping(Sized, Iterable, Container): @abstractmethod def __getitem__(self, key): raise KeyError def get(self, key, default=None): try: return self[key] except KeyError: return default def __contains__(self, key): try: self[key] except KeyError: return False else: return True def iterkeys(self): return iter(self) def itervalues(self): for key in self: yield self[key] def iteritems(self): for key in self: yield (key, self[key]) def keys(self): return list(self) def items(self): return [(key, self[key]) for key in self] def values(self): return [self[key] for key in self] # Mappings are not hashable by default, but subclasses can change this __hash__ = None def __eq__(self, other): return isinstance(other, Mapping) and \ dict(self.items()) == dict(other.items()) def __ne__(self, other): return not (self == other) class MappingView(Sized): def __init__(self, mapping): self._mapping = mapping def __len__(self): return len(self._mapping) class KeysView(MappingView, Set): def __contains__(self, key): return key in self._mapping def __iter__(self): for key in self._mapping: yield key class ItemsView(MappingView, Set): def __contains__(self, item): key, value = item try: v = self._mapping[key] except KeyError: return False else: return v == value def __iter__(self): for key in self._mapping: yield (key, self._mapping[key]) class ValuesView(MappingView): def __contains__(self, value): for key in self._mapping: if value == self._mapping[key]: return True return False def __iter__(self): for key in self._mapping: yield self._mapping[key] class MutableMapping(Mapping): @abstractmethod def __setitem__(self, key, value): raise KeyError @abstractmethod def __delitem__(self, key): raise KeyError __marker = object() def pop(self, key, default=__marker): try: value = self[key] except KeyError: if default is self.__marker: raise return default else: del self[key] return value def popitem(self): try: key = next(iter(self)) except StopIteration: raise KeyError value = self[key] del self[key] return key, value def clear(self): try: while True: self.popitem() except KeyError: pass def update(self, other=(), **kwds): if isinstance(other, Mapping): for key in other: self[key] = other[key] elif hasattr(other, "keys"): for key in other.keys(): self[key] = other[key] else: for key, value in other: self[key] = value for key, value in kwds.items(): self[key] = value def setdefault(self, key, default=None): try: return self[key] except KeyError: self[key] = default return default MutableMapping.register(dict) SEQUENCES class Sequence(Sized, Iterable, Container): """All the operations on a read-only sequence. Concrete subclasses must override __new__ or __init__, __getitem__, and __len__. """ @abstractmethod def __getitem__(self, index): raise IndexError def __iter__(self): i = 0 try: while True: v = self[i] yield v i += 1 except IndexError: return def __contains__(self, value): for v in self: if v == value: return True return False def __reversed__(self): for i in reversed(range(len(self))): yield self[i] def index(self, value): for i, v in enumerate(self): if v == value: return i raise ValueError def count(self, value): return sum(1 for v in self if v == value) Sequence.register(tuple) Sequence.register(basestring) Sequence.register(buffer) class MutableSequence(Sequence): @abstractmethod def __setitem__(self, index, value): raise IndexError @abstractmethod def __delitem__(self, index): raise IndexError @abstractmethod def insert(self, index, value): raise IndexError def append(self, value): self.insert(len(self), value) def reverse(self): n = len(self) for i in range(n self[i], self[n-i-1] = self[n-i-1], self[i] def extend(self, values): for v in values: self.append(v) def pop(self, index=-1): v = self[index] del self[index] return v def remove(self, value): del self[self.index(value)] def __iadd__(self, values): self.extend(values) MutableSequence.register(list)
#ifndef <API key> #define <API key> #ifdef _WIN32 #pragma once #endif #include <vgui_controls/Frame.h> class CampaignPanel; // frame used to hold the campaign screen panels class CampaignFrame : public vgui::Frame { <API key>( CampaignFrame, vgui::Frame ); CampaignFrame(Panel *parent, const char *panelName, bool showTaskbarIcon = true); virtual ~CampaignFrame(); virtual void PerformLayout(); virtual void ApplySchemeSettings( vgui::IScheme *scheme ); CampaignPanel* m_pCampaignPanel; }; #endif // <API key>
#import "MWMButton.h" #import "MWMCircularProgress.h" @interface <API key> : UIView @property(nonatomic, readonly) BOOL animating; @property(nonatomic) <API key> state; @property(nonatomic) BOOL isInvertColor; - (nonnull instancetype)initWithFrame:(CGRect)frame __attribute__((unavailable("initWithFrame is not available"))); - (nonnull instancetype)init __attribute__((unavailable("init is not available"))); - (void)setSpinnerColoring:(MWMImageColoring)coloring; - (void)<API key>:(nonnull UIColor *)backgroundColor; - (void)setImageName:(nonnull NSString *)imageName forState:(<API key>)state; - (void)setColor:(nonnull UIColor *)color forState:(<API key>)state; - (void)setColoring:(MWMButtonColoring)coloring forState:(<API key>)state; - (void)animateFromValue:(CGFloat)fromValue toValue:(CGFloat)toValue; - (void)updatePath:(CGFloat)progress; @end
class AddSolutionToLevels < ActiveRecord::Migration def change add_column :levels, :<API key>, :integer end end
/* ftvalid.h */ /* FreeType validation support (specification). */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* This file is part of the FreeType project, and may only be used, */ /* modified, and distributed under the terms of the FreeType project */ /* understand and accept it fully. */ #ifndef __FTVALID_H__ #define __FTVALID_H__ #include <ft2build.h> #include <API key> /* for ft_setjmp and ft_longjmp */ FT_BEGIN_HEADER /* handle to a validation object */ typedef struct FT_ValidatorRec_ volatile* FT_Validator; /* There are three distinct validation levels defined here: */ /* FT_VALIDATE_DEFAULT :: */ /* A table that passes this validation level can be used reliably by */ /* FreeType. It generally means that all offsets have been checked to */ /* prevent out-of-bound reads, that array counts are correct, etc. */ /* FT_VALIDATE_TIGHT :: */ /* A table that passes this validation level can be used reliably and */ /* doesn't contain invalid data. For example, a charmap table that */ /* returns invalid glyph indices will not pass, even though it can */ /* be used with FreeType in default mode (the library will simply */ /* return an error later when trying to load the glyph). */ /* It also checks that fields which must be a multiple of 2, 4, or 8, */ /* don't have incorrect values, etc. */ /* <API key> :: */ /* Only for font debugging. Checks that a table follows the */ /* specification by 100%. Very few fonts will be able to pass this */ /* level anyway but it can be useful for certain tools like font */ /* editors/converters. */ typedef enum FT_ValidationLevel_ { FT_VALIDATE_DEFAULT = 0, FT_VALIDATE_TIGHT, <API key> } FT_ValidationLevel; /* validator structure */ typedef struct FT_ValidatorRec_ { const FT_Byte* base; /* address of table in memory */ const FT_Byte* limit; /* `base' + sizeof(table) in memory */ FT_ValidationLevel level; /* validation level */ FT_Error error; /* error returned. 0 means success */ ft_jmp_buf jump_buffer; /* used for exception handling */ } FT_ValidatorRec; #define FT_VALIDATOR(x) ((FT_Validator)(x)) FT_BASE(void) ft_validator_init(FT_Validator valid, const FT_Byte* base, const FT_Byte* limit, FT_ValidationLevel level); /* Do not use this. It's broken and will cause your validator to crash */ /* if you run it on an invalid font. */ FT_BASE(FT_Int) ft_validator_run(FT_Validator valid); /* Sets the error field in a validator, then calls `longjmp' to return */ /* to high-level caller. Using `setjmp/longjmp' avoids many stupid */ /* error checks within the validation routines. */ FT_BASE(void) ft_validator_error(FT_Validator valid, FT_Error error); /* Calls ft_validate_error. Assumes that the `valid' local variable */ /* holds a pointer to the current validator object. */ /* Use preprocessor prescan to pass FT_ERR_PREFIX. */ #define FT_INVALID(_prefix, _error) FT_INVALID_(_prefix, _error) #define FT_INVALID_(_prefix, _error) ft_validator_error(valid, _prefix##_error) /* called when a broken table is detected */ #define <API key> FT_INVALID(FT_ERR_PREFIX, Invalid_Table) /* called when an invalid offset is detected */ #define FT_INVALID_OFFSET FT_INVALID(FT_ERR_PREFIX, Invalid_Offset) /* called when an invalid format/value is detected */ #define FT_INVALID_FORMAT FT_INVALID(FT_ERR_PREFIX, Invalid_Table) /* called when an invalid glyph index is detected */ #define FT_INVALID_GLYPH_ID FT_INVALID(FT_ERR_PREFIX, Invalid_Glyph_Index) /* called when an invalid field value is detected */ #define FT_INVALID_DATA FT_INVALID(FT_ERR_PREFIX, Invalid_Table) FT_END_HEADER #endif /* __FTVALID_H__ */ /* END */
#!/usr/bin/env python # example setselection.py import pygtk pygtk.require('2.0') import gtk import time class SetSelectionExample: # Callback when the user toggles the selection def selection_toggled(self, widget, window): if widget.get_active(): self.have_selection = window.selection_owner_set("PRIMARY") # if claiming the selection failed, we return the button to # the out state if not self.have_selection: widget.set_active(False) else: if self.have_selection: # Not possible to release the selection in PyGTK # just mark that we don't have it self.have_selection = False return # Called when another application claims the selection def selection_clear(self, widget, event): self.have_selection = False widget.set_active(False) return True # Supplies the current time as the selection. def selection_handle(self, widget, selection_data, info, time_stamp): current_time = time.time() timestr = time.asctime(time.localtime(current_time)) # When we return a single string, it should not be null terminated. # That will be done for us selection_data.set_text(timestr, len(timestr)) return def __init__(self): self.have_selection = False # Create the toplevel window window = gtk.Window(gtk.WINDOW_TOPLEVEL) window.set_title("Set Selection") window.set_border_width(10) window.connect("destroy", lambda w: gtk.main_quit()) self.window = window # Create an eventbox to hold the button since it no longer has # a GdkWindow eventbox = gtk.EventBox() eventbox.show() window.add(eventbox) # Create a toggle button to act as the selection selection_button = gtk.ToggleButton("Claim Selection") eventbox.add(selection_button) selection_button.connect("toggled", self.selection_toggled, eventbox) eventbox.connect_object("<API key>", self.selection_clear, selection_button) eventbox.<API key>("PRIMARY", "STRING", 1) eventbox.<API key>("PRIMARY", "COMPOUND_TEXT", 1) eventbox.connect("selection_get", self.selection_handle) selection_button.show() window.show() def main(): gtk.main() return 0 if __name__ == "__main__": SetSelectionExample() main()
@charset "UTF-8"; /** * 1. Set default font family to sans-serif. * 2. Prevent iOS and IE text size adjust after device orientation change, * without disabling user zoom. */ html { font-family: sans-serif; -ms-text-size-adjust: 100%; -<API key>: 100%; } /** * Remove default margin. */ body { margin: 0; } /** * Correct `block` display not defined for any HTML5 element in IE 8/9. * Correct `block` display not defined for `details` or `summary` in IE 10/11 * and Firefox. * Correct `block` display not defined for `main` in IE 11. */ article, aside, details, figcaption, figure, footer, header, hgroup, main, menu, nav, section, summary { display: block; } /** * 1. Correct `inline-block` display not defined in IE 8/9. * 2. Normalize vertical alignment of `progress` in Chrome, Firefox, and Opera. */ audio, canvas, progress, video { display: inline-block; vertical-align: baseline; } /** * Prevent modern browsers from displaying `audio` without controls. * Remove excess height in iOS 5 devices. */ audio:not([controls]) { display: none; height: 0; } /** * Address `[hidden]` styling not present in IE 8/9/10. * Hide the `template` element in IE 8/9/10/11, Safari, and Firefox < 22. */ [hidden], template { display: none; } /** * Remove the gray background color from active links in IE 10. */ a { background-color: transparent; } /** * Improve readability of focused elements when they are also in an * active/hover state. */ a:active, a:hover { outline: 0; } /** * Address styling not present in IE 8/9/10/11, Safari, and Chrome. */ abbr[title] { border-bottom: 1px dotted; } /** * Address style set to `bolder` in Firefox 4+, Safari, and Chrome. */ b, strong { font-weight: bold; } /** * Address styling not present in Safari and Chrome. */ dfn { font-style: italic; } /** * Address variable `h1` font-size and margin within `section` and `article` * contexts in Firefox 4+, Safari, and Chrome. */ h1 { font-size: 2em; margin: 0.67em 0; } /** * Address styling not present in IE 8/9. */ mark { background: #ff0; color: #000; } /** * Address inconsistent and variable font size in all browsers. */ small { font-size: 80%; } /** * Prevent `sub` and `sup` affecting `line-height` in all browsers. */ sub, sup { font-size: 75%; line-height: 0; position: relative; vertical-align: baseline; } sup { top: -0.5em; } sub { bottom: -0.25em; } /** * Remove border when inside `a` element in IE 8/9/10. */ img { border: 0; } /** * Correct overflow not hidden in IE 9/10/11. */ svg:not(:root) { overflow: hidden; } /** * Address margin not present in IE 8/9 and Safari. */ figure { margin: 1em 40px; } /** * Address differences between Firefox and other browsers. */ hr { box-sizing: content-box; height: 0; } /** * Contain overflow in all browsers. */ pre { overflow: auto; } /** * Address odd `em`-unit font size rendering in all browsers. */ code, kbd, pre, samp { font-family: monospace, monospace; font-size: 1em; } /** * Known limitation: by default, Chrome and Safari on OS X allow very limited * styling of `select`, unless a `border` property is set. */ /** * 1. Correct color not being inherited. * Known issue: affects color of disabled elements. * 2. Correct font properties not being inherited. * 3. Address margins set differently in Firefox 4+, Safari, and Chrome. */ button, input, optgroup, select, textarea { color: inherit; font: inherit; margin: 0; } /** * Address `overflow` set to `hidden` in IE 8/9/10/11. */ button { overflow: visible; } /** * Address inconsistent `text-transform` inheritance for `button` and `select`. * All other form control elements do not inherit `text-transform` values. * Correct `button` style inheritance in Firefox, IE 8/9/10/11, and Opera. * Correct `select` style inheritance in Firefox. */ button, select { text-transform: none; } /** * 1. Avoid the WebKit bug in Android 4.0.* where (2) destroys native `audio` * and `video` controls. * 2. Correct inability to style clickable `input` types in iOS. * 3. Improve usability and consistency of cursor style between image-type * `input` and others. */ button, html input[type="button"], input[type="reset"], input[type="submit"] { -webkit-appearance: button; cursor: pointer; } /** * Re-set default cursor for disabled elements. */ button[disabled], html input[disabled] { cursor: not-allowed; } /** * Remove inner padding and border in Firefox 4+. */ button::-moz-focus-inner, input::-moz-focus-inner { border: 0; padding: 0; } /** * Address Firefox 4+ setting `line-height` on `input` using `!important` in * the UA stylesheet. */ input { line-height: normal; } /** * It's recommended that you don't attempt to style these elements. * Firefox's implementation doesn't respect box-sizing, padding, or width. * * 1. Address box sizing set to `content-box` in IE 8/9/10. * 2. Remove excess padding in IE 8/9/10. */ input[type="checkbox"], input[type="radio"] { box-sizing: border-box; padding: 0; } /** * Fix the cursor style for Chrome's increment/decrement buttons. For certain * `font-size` values of the `input`, it causes the cursor style of the * decrement button to change from `default` to `text`. */ input[type="number"]::-<API key>, input[type="number"]::-<API key> { height: auto; } /** * 1. Address `appearance` set to `searchfield` in Safari and Chrome. * 2. Address `box-sizing` set to `border-box` in Safari and Chrome. */ input[type="search"] { -webkit-appearance: textfield; box-sizing: content-box; } /** * Remove inner padding and search cancel button in Safari and Chrome on OS X. * Safari (but not Chrome) clips the cancel button when the search input has * padding (and `textfield` appearance). */ input[type="search"]::-<API key>, input[type="search"]::-<API key> { -webkit-appearance: none; } /** * Define consistent border, margin, and padding. * [NOTE] We don't enable this ruleset in Foundation, because we want the <fieldset> element to have plain styling. */ /* fieldset { border: 1px solid #c0c0c0; margin: 0 2px; padding: 0.35em 0.625em 0.75em; } */ /** * 1. Correct `color` not being inherited in IE 8/9/10/11. * 2. Remove padding so people aren't caught out if they zero out fieldsets. */ legend { border: 0; padding: 0; } /** * Remove default vertical scrollbar in IE 8/9/10/11. */ textarea { overflow: auto; } /** * Don't inherit the `font-weight` (applied by a rule above). * NOTE: the default cannot safely be changed in Chrome and Safari on OS X. */ optgroup { font-weight: bold; } /** * Remove most spacing between table cells. */ table { border-collapse: collapse; border-spacing: 0; } td, th { padding: 0; } .foundation-mq { font-family: "small=0em&medium=40em&large=64em&xlarge=75em&xxlarge=90em"; } html { font-size: 100%; box-sizing: border-box; } *, *::before, *::after { box-sizing: inherit; } body { padding: 0; margin: 0; font-family: "Helvetica Neue", Helvetica, Roboto, Arial, sans-serif; font-weight: normal; line-height: 1.5; color: #0a0a0a; background: #fefefe; -<API key>: antialiased; -<API key>: grayscale; } img { max-width: 100%; height: auto; -<API key>: bicubic; display: inline-block; vertical-align: middle; } textarea { height: auto; min-height: 50px; border-radius: 3px; } select { width: 100%; border-radius: 3px; } #map_canvas img, #map_canvas embed, #map_canvas object, .map_canvas img, .map_canvas embed, .map_canvas object, .mqa-display img, .mqa-display embed, .mqa-display object { max-width: none !important; } button { -webkit-appearance: none; -moz-appearance: none; background: transparent; padding: 0; border: 0; border-radius: 3px; line-height: 1; } [data-whatinput='mouse'] button { outline: 0; } .is-visible { display: block !important; } .is-hidden { display: none !important; } div, dl, dt, dd, ul, ol, li, h1, h2, h3, h4, h5, h6, pre, form, p, blockquote, th, td { margin: 0; padding: 0; } p { font-size: inherit; line-height: 1.6; margin-bottom: 1rem; text-rendering: optimizeLegibility; } em, i { font-style: italic; line-height: inherit; } strong, b { font-weight: bold; line-height: inherit; } small { font-size: 80%; line-height: inherit; } h1, h2, h3, h4, h5, h6 { font-family: "Helvetica Neue", Helvetica, Roboto, Arial, sans-serif; font-weight: normal; font-style: normal; color: inherit; text-rendering: optimizeLegibility; margin-top: 0; margin-bottom: 0.5rem; line-height: 1.4; } h1 small, h2 small, h3 small, h4 small, h5 small, h6 small { color: #cacaca; line-height: 0; } h1 { font-size: 1.5rem; } h2 { font-size: 1.25rem; } h3 { font-size: 1.1875rem; } h4 { font-size: 1.125rem; } h5 { font-size: 1.0625rem; } h6 { font-size: 1rem; } @media screen and (min-width: 40em) { h1 { font-size: 3rem; } h2 { font-size: 2.5rem; } h3 { font-size: 1.9375rem; } h4 { font-size: 1.5625rem; } h5 { font-size: 1.25rem; } h6 { font-size: 1rem; } } a { color: #2ba6cb; text-decoration: none; line-height: inherit; cursor: pointer; } a:hover, a:focus { color: #258faf; } a img { border: 0; } hr { max-width: 62.5rem; height: 0; border-right: 0; border-top: 0; border-bottom: 1px solid #cacaca; border-left: 0; margin: 1.25rem auto; clear: both; } ul, ol, dl { line-height: 1.6; margin-bottom: 1rem; list-style-position: outside; } li { font-size: inherit; } ul { list-style-type: disc; margin-left: 1.25rem; } ol { margin-left: 1.25rem; } ul ul, ol ul, ul ol, ol ol { margin-left: 1.25rem; margin-bottom: 0; } dl { margin-bottom: 1rem; } dl dt { margin-bottom: 0.3rem; font-weight: bold; } blockquote { margin: 0 0 1rem; padding: 0.5625rem 1.25rem 0 1.1875rem; border-left: 1px solid #cacaca; } blockquote, blockquote p { line-height: 1.6; color: #8a8a8a; } cite { display: block; font-size: 0.8125rem; color: #8a8a8a; } cite:before { content: '\2014 \0020'; } abbr { color: #0a0a0a; cursor: help; border-bottom: 1px dotted #0a0a0a; } code { font-family: Consolas, "Liberation Mono", Courier, monospace; font-weight: normal; color: #0a0a0a; background-color: #e6e6e6; border: 1px solid #cacaca; padding: 0.125rem 0.3125rem 0.0625rem; } kbd { padding: 0.125rem 0.25rem 0; margin: 0; background-color: #e6e6e6; color: #0a0a0a; font-family: Consolas, "Liberation Mono", Courier, monospace; border-radius: 3px; } .subheader { margin-top: 0.2rem; margin-bottom: 0.5rem; font-weight: normal; line-height: 1.4; color: #8a8a8a; } .lead { font-size: 125%; line-height: 1.6; } .stat { font-size: 2.5rem; line-height: 1; } p + .stat { margin-top: -1rem; } .no-bullet { margin-left: 0; list-style: none; } .text-left { text-align: left; } .text-right { text-align: right; } .text-center { text-align: center; } .text-justify { text-align: justify; } @media screen and (min-width: 40em) { .medium-text-left { text-align: left; } .medium-text-right { text-align: right; } .medium-text-center { text-align: center; } .medium-text-justify { text-align: justify; } } @media screen and (min-width: 64em) { .large-text-left { text-align: left; } .large-text-right { text-align: right; } .large-text-center { text-align: center; } .large-text-justify { text-align: justify; } } .show-for-print { display: none !important; } @media print { * { background: transparent !important; color: black !important; box-shadow: none !important; text-shadow: none !important; } .show-for-print { display: block !important; } .hide-for-print { display: none !important; } table.show-for-print { display: table !important; } thead.show-for-print { display: table-header-group !important; } tbody.show-for-print { display: table-row-group !important; } tr.show-for-print { display: table-row !important; } td.show-for-print { display: table-cell !important; } th.show-for-print { display: table-cell !important; } a, a:visited { text-decoration: underline; } a[href]:after { content: " (" attr(href) ")"; } .ir a:after, a[href^='javascript:']:after, a[href^='#']:after { content: ''; } abbr[title]:after { content: " (" attr(title) ")"; } pre, blockquote { border: 1px solid #8a8a8a; page-break-inside: avoid; } thead { display: table-header-group; } tr, img { page-break-inside: avoid; } img { max-width: 100% !important; } @page { margin: 0.5cm; } p, h2, h3 { orphans: 3; widows: 3; } h2, h3 { page-break-after: avoid; } } [type='text'], [type='password'], [type='date'], [type='datetime'], [type='datetime-local'], [type='month'], [type='week'], [type='email'], [type='number'], [type='search'], [type='tel'], [type='time'], [type='url'], [type='color'], textarea { display: block; box-sizing: border-box; width: 100%; height: 2.4375rem; padding: 0.5rem; border: 1px solid #cacaca; margin: 0 0 1rem; font-family: inherit; font-size: 1rem; color: #0a0a0a; background-color: #fefefe; box-shadow: inset 0 1px 2px rgba(10, 10, 10, 0.1); border-radius: 3px; transition: box-shadow 0.5s, border-color 0.25s ease-in-out; -webkit-appearance: none; -moz-appearance: none; } [type='text']:focus, [type='password']:focus, [type='date']:focus, [type='datetime']:focus, [type='datetime-local']:focus, [type='month']:focus, [type='week']:focus, [type='email']:focus, [type='number']:focus, [type='search']:focus, [type='tel']:focus, [type='time']:focus, [type='url']:focus, [type='color']:focus, textarea:focus { border: 1px solid #8a8a8a; background-color: #fefefe; outline: none; box-shadow: 0 0 5px #cacaca; transition: box-shadow 0.5s, border-color 0.25s ease-in-out; } textarea { max-width: 100%; } textarea[rows] { height: auto; } input::-<API key>, textarea::-<API key> { color: #cacaca; } input::-moz-placeholder, textarea::-moz-placeholder { color: #cacaca; } input:-<API key>, textarea:-<API key> { color: #cacaca; } input::placeholder, textarea::placeholder { color: #cacaca; } input:disabled, input[readonly], textarea:disabled, textarea[readonly] { background-color: #e6e6e6; cursor: not-allowed; } [type='submit'], [type='button'] { border-radius: 3px; -webkit-appearance: none; -moz-appearance: none; } input[type='search'] { box-sizing: border-box; } [type='file'], [type='checkbox'], [type='radio'] { margin: 0 0 1rem; } [type='checkbox'] + label, [type='radio'] + label { display: inline-block; margin-left: 0.5rem; margin-right: 1rem; margin-bottom: 0; vertical-align: baseline; } [type='checkbox'] + label[for], [type='radio'] + label[for] { cursor: pointer; } label > [type='checkbox'], label > [type='radio'] { margin-right: 0.5rem; } [type='file'] { width: 100%; } label { display: block; margin: 0; font-size: 0.875rem; font-weight: normal; line-height: 1.8; color: #0a0a0a; } label.middle { margin: 0 0 1rem; padding: 0.5625rem 0; } .help-text { margin-top: -0.5rem; font-size: 0.8125rem; font-style: italic; color: #0a0a0a; } .input-group { display: table; width: 100%; margin-bottom: 1rem; } .input-group > :first-child { border-radius: 3px 0 0 3px; } .input-group > :last-child > * { border-radius: 0 3px 3px 0; } .input-group-label, .input-group-field, .input-group-button { margin: 0; white-space: nowrap; display: table-cell; vertical-align: middle; } .input-group-label { text-align: center; padding: 0 1rem; background: #e6e6e6; color: #0a0a0a; border: 1px solid #cacaca; white-space: nowrap; width: 1%; height: 100%; } .input-group-label:first-child { border-right: 0; } .input-group-label:last-child { border-left: 0; } .input-group-field { border-radius: 0; height: 2.5rem; } .input-group-button { padding-top: 0; padding-bottom: 0; text-align: center; height: 100%; width: 1%; } .input-group-button a, .input-group-button input, .input-group-button button { margin: 0; } .input-group .input-group-button { display: table-cell; } fieldset { border: 0; padding: 0; margin: 0; } legend { margin-bottom: 0.5rem; max-width: 100%; } .fieldset { border: 1px solid #cacaca; padding: 1.25rem; margin: 1.125rem 0; } .fieldset legend { background: #fefefe; padding: 0 0.1875rem; margin: 0; margin-left: -0.1875rem; } select { height: 2.4375rem; padding: 0.5rem; border: 1px solid #cacaca; margin: 0 0 1rem; font-size: 1rem; font-family: inherit; line-height: normal; color: #0a0a0a; background-color: #fefefe; border-radius: 3px; -webkit-appearance: none; -moz-appearance: none; background-image: url("data:image/svg+xml;utf8,<svg xmlns='http: background-size: 9px 6px; background-position: right -1rem center; background-origin: content-box; background-repeat: no-repeat; padding-right: 1.5rem; } @media screen and (min-width: 0\0) { select { background-image: url("data:image/png;base64,<API key>/80AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAIpJREFUeNrEkckNgDAMBBfRkEt0ObRBBdsGXUDgmQfK4XhH2m8czQAAy27R3tsw4Qfe2x8uOO6oYLb6GlOor3GF+swURAOmUJ+<API key>+<API key>/V+<API key>=="); } } select:disabled { background-color: #e6e6e6; cursor: not-allowed; } select::-ms-expand { display: none; } select[multiple] { height: auto; background-image: none; } .is-invalid-input:not(:focus) { background-color: rgba(198, 15, 19, 0.1); border-color: #c60f13; } .is-invalid-label { color: #c60f13; } .form-error { display: none; margin-top: -0.5rem; margin-bottom: 1rem; font-size: 0.75rem; font-weight: bold; color: #c60f13; } .form-error.is-visible { display: block; } .float-left { float: left !important; } .float-right { float: right !important; } .float-center { display: block; margin-left: auto; margin-right: auto; } .clearfix::before, .clearfix::after { content: ' '; display: table; } .clearfix::after { clear: both; } .hide { display: none !important; } .invisible { visibility: hidden; } @media screen and (max-width: 39.9375em) { .hide-for-small-only { display: none !important; } } @media screen and (max-width: 0em), screen and (min-width: 40em) { .show-for-small-only { display: none !important; } } @media screen and (min-width: 40em) { .hide-for-medium { display: none !important; } } @media screen and (max-width: 39.9375em) { .show-for-medium { display: none !important; } } @media screen and (min-width: 40em) and (max-width: 63.9375em) { .<API key> { display: none !important; } } @media screen and (max-width: 39.9375em), screen and (min-width: 64em) { .<API key> { display: none !important; } } @media screen and (min-width: 64em) { .hide-for-large { display: none !important; } } @media screen and (max-width: 63.9375em) { .show-for-large { display: none !important; } } @media screen and (min-width: 64em) and (max-width: 74.9375em) { .hide-for-large-only { display: none !important; } } @media screen and (max-width: 63.9375em), screen and (min-width: 75em) { .show-for-large-only { display: none !important; } } .show-for-sr, .show-on-focus { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); } .show-on-focus:active, .show-on-focus:focus { position: static !important; height: auto; width: auto; overflow: visible; clip: auto; } .show-for-landscape, .hide-for-portrait { display: block !important; } @media screen and (orientation: landscape) { .show-for-landscape, .hide-for-portrait { display: block !important; } } @media screen and (orientation: portrait) { .show-for-landscape, .hide-for-portrait { display: none !important; } } .hide-for-landscape, .show-for-portrait { display: none !important; } @media screen and (orientation: landscape) { .hide-for-landscape, .show-for-portrait { display: none !important; } } @media screen and (orientation: portrait) { .hide-for-landscape, .show-for-portrait { display: block !important; } } .button { display: inline-block; text-align: center; line-height: 1; cursor: pointer; -webkit-appearance: none; transition: background-color 0.25s ease-out, color 0.25s ease-out; vertical-align: middle; border: 1px solid transparent; border-radius: 3px; padding: 0.85em 1em; margin: 0 0 1rem 0; font-size: 0.9rem; background-color: #2ba6cb; color: #fefefe; } [data-whatinput='mouse'] .button { outline: 0; } .button:hover, .button:focus { background-color: #258dad; color: #fefefe; } .button.tiny { font-size: 0.6rem; } .button.small { font-size: 0.75rem; } .button.large { font-size: 1.25rem; } .button.expanded { display: block; width: 100%; margin-left: 0; margin-right: 0; } .button.primary { background-color: #2ba6cb; color: #fefefe; } .button.primary:hover, .button.primary:focus { background-color: #2285a2; color: #fefefe; } .button.secondary { background-color: #e9e9e9; color: #0a0a0a; } .button.secondary:hover, .button.secondary:focus { background-color: #bababa; color: #0a0a0a; } .button.alert { background-color: #c60f13; color: #fefefe; } .button.alert:hover, .button.alert:focus { background-color: #9e0c0f; color: #fefefe; } .button.success { background-color: #5da423; color: #fefefe; } .button.success:hover, .button.success:focus { background-color: #4a831c; color: #fefefe; } .button.warning { background-color: #ffae00; color: #fefefe; } .button.warning:hover, .button.warning:focus { background-color: #cc8b00; color: #fefefe; } .button.body-font { background-color: #222222; color: #fefefe; } .button.body-font:hover, .button.body-font:focus { background-color: #1b1b1b; color: #fefefe; } .button.header { background-color: #222222; color: #fefefe; } .button.header:hover, .button.header:focus { background-color: #1b1b1b; color: #fefefe; } .button.hollow { border: 1px solid #2ba6cb; color: #2ba6cb; } .button.hollow, .button.hollow:hover, .button.hollow:focus { background-color: transparent; } .button.hollow:hover, .button.hollow:focus { border-color: #165366; color: #165366; } .button.hollow.primary { border: 1px solid #2ba6cb; color: #2ba6cb; } .button.hollow.primary:hover, .button.hollow.primary:focus { border-color: #165366; color: #165366; } .button.hollow.secondary { border: 1px solid #e9e9e9; color: #e9e9e9; } .button.hollow.secondary:hover, .button.hollow.secondary:focus { border-color: #757575; color: #757575; } .button.hollow.alert { border: 1px solid #c60f13; color: #c60f13; } .button.hollow.alert:hover, .button.hollow.alert:focus { border-color: #63080a; color: #63080a; } .button.hollow.success { border: 1px solid #5da423; color: #5da423; } .button.hollow.success:hover, .button.hollow.success:focus { border-color: #2f5212; color: #2f5212; } .button.hollow.warning { border: 1px solid #ffae00; color: #ffae00; } .button.hollow.warning:hover, .button.hollow.warning:focus { border-color: #805700; color: #805700; } .button.hollow.body-font { border: 1px solid #222222; color: #222222; } .button.hollow.body-font:hover, .button.hollow.body-font:focus { border-color: #111111; color: #111111; } .button.hollow.header { border: 1px solid #222222; color: #222222; } .button.hollow.header:hover, .button.hollow.header:focus { border-color: #111111; color: #111111; } .button.disabled, .button[disabled] { opacity: 0.25; cursor: not-allowed; } .button.disabled:hover, .button.disabled:focus, .button[disabled]:hover, .button[disabled]:focus { background-color: #2ba6cb; color: #fefefe; } .button.dropdown::after { content: ''; display: block; width: 0; height: 0; border: inset 0.4em; border-color: #fefefe transparent transparent; border-top-style: solid; border-bottom-width: 0; position: relative; top: 0.4em; float: right; margin-left: 1em; display: inline-block; } .button.arrow-only::after { margin-left: 0; float: none; top: -0.1em; } .close-button { position: absolute; color: #8a8a8a; right: 1rem; top: 0.5rem; font-size: 2em; line-height: 1; cursor: pointer; } [data-whatinput='mouse'] .close-button { outline: 0; } .close-button:hover, .close-button:focus { color: #0a0a0a; } .button-group { margin-bottom: 1rem; font-size: 0; } .button-group::before, .button-group::after { content: ' '; display: table; } .button-group::after { clear: both; } .button-group .button { margin: 0; margin-right: 1px; margin-bottom: 1px; font-size: 0.9rem; } .button-group .button:last-child { margin-right: 0; } .button-group.tiny .button { font-size: 0.6rem; } .button-group.small .button { font-size: 0.75rem; } .button-group.large .button { font-size: 1.25rem; } .button-group.expanded { margin-right: -1px; } .button-group.expanded::before, .button-group.expanded::after { display: none; } .button-group.expanded .button:first-child:nth-last-child(2), .button-group.expanded .button:first-child:nth-last-child(2):first-child:nth-last-child(2) ~ .button { display: inline-block; width: calc(50% - 1px); margin-right: 1px; } .button-group.expanded .button:first-child:nth-last-child(2):last-child, .button-group.expanded .button:first-child:nth-last-child(2):first-child:nth-last-child(2) ~ .button:last-child { margin-right: -6px; } .button-group.expanded .button:first-child:nth-last-child(3), .button-group.expanded .button:first-child:nth-last-child(3):first-child:nth-last-child(3) ~ .button { display: inline-block; width: calc(33.33333% - 1px); margin-right: 1px; } .button-group.expanded .button:first-child:nth-last-child(3):last-child, .button-group.expanded .button:first-child:nth-last-child(3):first-child:nth-last-child(3) ~ .button:last-child { margin-right: -6px; } .button-group.expanded .button:first-child:nth-last-child(4), .button-group.expanded .button:first-child:nth-last-child(4):first-child:nth-last-child(4) ~ .button { display: inline-block; width: calc(25% - 1px); margin-right: 1px; } .button-group.expanded .button:first-child:nth-last-child(4):last-child, .button-group.expanded .button:first-child:nth-last-child(4):first-child:nth-last-child(4) ~ .button:last-child { margin-right: -6px; } .button-group.expanded .button:first-child:nth-last-child(5), .button-group.expanded .button:first-child:nth-last-child(5):first-child:nth-last-child(5) ~ .button { display: inline-block; width: calc(20% - 1px); margin-right: 1px; } .button-group.expanded .button:first-child:nth-last-child(5):last-child, .button-group.expanded .button:first-child:nth-last-child(5):first-child:nth-last-child(5) ~ .button:last-child { margin-right: -6px; } .button-group.expanded .button:first-child:nth-last-child(6), .button-group.expanded .button:first-child:nth-last-child(6):first-child:nth-last-child(6) ~ .button { display: inline-block; width: calc(16.66667% - 1px); margin-right: 1px; } .button-group.expanded .button:first-child:nth-last-child(6):last-child, .button-group.expanded .button:first-child:nth-last-child(6):first-child:nth-last-child(6) ~ .button:last-child { margin-right: -6px; } .button-group.primary .button { background-color: #2ba6cb; color: #fefefe; } .button-group.primary .button:hover, .button-group.primary .button:focus { background-color: #2285a2; color: #fefefe; } .button-group.secondary .button { background-color: #e9e9e9; color: #0a0a0a; } .button-group.secondary .button:hover, .button-group.secondary .button:focus { background-color: #bababa; color: #0a0a0a; } .button-group.alert .button { background-color: #c60f13; color: #fefefe; } .button-group.alert .button:hover, .button-group.alert .button:focus { background-color: #9e0c0f; color: #fefefe; } .button-group.success .button { background-color: #5da423; color: #fefefe; } .button-group.success .button:hover, .button-group.success .button:focus { background-color: #4a831c; color: #fefefe; } .button-group.warning .button { background-color: #ffae00; color: #fefefe; } .button-group.warning .button:hover, .button-group.warning .button:focus { background-color: #cc8b00; color: #fefefe; } .button-group.body-font .button { background-color: #222222; color: #fefefe; } .button-group.body-font .button:hover, .button-group.body-font .button:focus { background-color: #1b1b1b; color: #fefefe; } .button-group.header .button { background-color: #222222; color: #fefefe; } .button-group.header .button:hover, .button-group.header .button:focus { background-color: #1b1b1b; color: #fefefe; } .button-group.stacked .button, .button-group.stacked-for-small .button, .button-group.stacked-for-medium .button { width: 100%; } .button-group.stacked .button:last-child, .button-group.stacked-for-small .button:last-child, .button-group.stacked-for-medium .button:last-child { margin-bottom: 0; } @media screen and (min-width: 40em) { .button-group.stacked-for-small .button { width: auto; margin-bottom: 0; } } @media screen and (min-width: 64em) { .button-group.stacked-for-medium .button { width: auto; margin-bottom: 0; } } @media screen and (max-width: 39.9375em) { .button-group.stacked-for-small.expanded { display: block; } .button-group.stacked-for-small.expanded .button { display: block; margin-right: 0; } } .slider { position: relative; height: 0.5rem; margin-top: 1.25rem; margin-bottom: 2.25rem; background-color: #e6e6e6; cursor: pointer; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; -ms-touch-action: none; touch-action: none; } .slider-fill { position: absolute; top: 0; left: 0; display: inline-block; max-width: 100%; height: 0.5rem; background-color: #cacaca; transition: all 0.2s ease-in-out; } .slider-fill.is-dragging { transition: all 0s linear; } .slider-handle { position: absolute; top: 50%; -webkit-transform: translateY(-50%); -ms-transform: translateY(-50%); transform: translateY(-50%); position: absolute; left: 0; z-index: 1; display: inline-block; width: 1.4rem; height: 1.4rem; background-color: #2ba6cb; transition: all 0.2s ease-in-out; -ms-touch-action: manipulation; touch-action: manipulation; border-radius: 3px; } [data-whatinput='mouse'] .slider-handle { outline: 0; } .slider-handle:hover { background-color: #258dad; } .slider-handle.is-dragging { transition: all 0s linear; } .slider.disabled, .slider[disabled] { opacity: 0.25; cursor: not-allowed; } .slider.vertical { display: inline-block; width: 0.5rem; height: 12.5rem; margin: 0 1.25rem; -webkit-transform: scale(1, -1); -ms-transform: scale(1, -1); transform: scale(1, -1); } .slider.vertical .slider-fill { top: 0; width: 0.5rem; max-height: 100%; } .slider.vertical .slider-handle { position: absolute; top: 0; left: 50%; width: 1.4rem; height: 1.4rem; -webkit-transform: translateX(-50%); -ms-transform: translateX(-50%); transform: translateX(-50%); } .switch { margin-bottom: 1rem; outline: 0; position: relative; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; color: #fefefe; font-weight: bold; font-size: 0.875rem; } .switch-input { opacity: 0; position: absolute; } .switch-paddle { background: #cacaca; cursor: pointer; display: block; position: relative; width: 4rem; height: 2rem; transition: all 0.25s ease-out; border-radius: 3px; color: inherit; font-weight: inherit; } input + .switch-paddle { margin: 0; } .switch-paddle::after { background: #fefefe; content: ''; display: block; position: absolute; height: 1.5rem; left: 0.25rem; top: 0.25rem; width: 1.5rem; transition: all 0.25s ease-out; -webkit-transform: translate3d(0, 0, 0); transform: translate3d(0, 0, 0); border-radius: 3px; } input:checked ~ .switch-paddle { background: #2ba6cb; } input:checked ~ .switch-paddle::after { left: 2.25rem; } [data-whatinput='mouse'] input:focus ~ .switch-paddle { outline: 0; } .switch-active, .switch-inactive { position: absolute; top: 50%; -webkit-transform: translateY(-50%); -ms-transform: translateY(-50%); transform: translateY(-50%); } .switch-active { left: 8%; display: none; } input:checked + label > .switch-active { display: block; } .switch-inactive { right: 15%; } input:checked + label > .switch-inactive { display: none; } .switch.tiny .switch-paddle { width: 3rem; height: 1.5rem; font-size: 0.625rem; } .switch.tiny .switch-paddle::after { width: 1rem; height: 1rem; } .switch.tiny input:checked ~ .switch-paddle::after { left: 1.75rem; } .switch.small .switch-paddle { width: 3.5rem; height: 1.75rem; font-size: 0.75rem; } .switch.small .switch-paddle::after { width: 1.25rem; height: 1.25rem; } .switch.small input:checked ~ .switch-paddle::after { left: 2rem; } .switch.large .switch-paddle { width: 5rem; height: 2.5rem; font-size: 1rem; } .switch.large .switch-paddle::after { width: 2rem; height: 2rem; } .switch.large input:checked ~ .switch-paddle::after { left: 2.75rem; } .menu { margin: 0; list-style-type: none; } .menu > li { display: table-cell; vertical-align: middle; } [data-whatinput='mouse'] .menu > li { outline: 0; } .menu > li > a { display: block; padding: 0.7rem 1rem; line-height: 1; } .menu input, .menu a, .menu button { margin-bottom: 0; } .menu > li > a img, .menu > li > a i, .menu > li > a svg { vertical-align: middle; } .menu > li > a img + span, .menu > li > a i + span, .menu > li > a svg + span { vertical-align: middle; } .menu > li > a img, .menu > li > a i, .menu > li > a svg { margin-right: 0.25rem; display: inline-block; } .menu > li { display: table-cell; } .menu.vertical > li { display: block; } @media screen and (min-width: 40em) { .menu.medium-horizontal > li { display: table-cell; } .menu.medium-vertical > li { display: block; } } @media screen and (min-width: 64em) { .menu.large-horizontal > li { display: table-cell; } .menu.large-vertical > li { display: block; } } .menu.simple li { line-height: 1; display: inline-block; margin-right: 1rem; } .menu.simple a { padding: 0; } .menu.align-right::before, .menu.align-right::after { content: ' '; display: table; } .menu.align-right::after { clear: both; } .menu.align-right > li { float: right; } .menu.expanded { width: 100%; display: table; table-layout: fixed; } .menu.expanded > li:first-child:last-child { width: 100%; } .menu.icon-top > li > a { text-align: center; } .menu.icon-top > li > a img, .menu.icon-top > li > a i, .menu.icon-top > li > a svg { display: block; margin: 0 auto 0.25rem; } .menu.nested { margin-left: 1rem; } .menu .active > a { color: #fefefe; background: #2ba6cb; } .menu-text { font-weight: bold; color: inherit; line-height: 1; padding-top: 0; padding-bottom: 0; padding: 0.7rem 1rem; } .menu-centered { text-align: center; } .menu-centered > .menu { display: inline-block; } .no-js [<API key>] ul { display: none; } .is-drilldown { position: relative; overflow: hidden; } .is-drilldown li { display: block !important; } .<API key> { position: absolute; top: 0; left: 100%; z-index: -1; height: 100%; width: 100%; background: #fefefe; transition: -webkit-transform 0.15s linear; transition: transform 0.15s linear; } .<API key>.is-active { z-index: 1; display: block; -webkit-transform: translateX(-100%); -ms-transform: translateX(-100%); transform: translateX(-100%); } .<API key>.is-closing { -webkit-transform: translateX(100%); -ms-transform: translateX(100%); transform: translateX(100%); } .<API key> > a { position: relative; } .<API key> > a::after { content: ''; display: block; width: 0; height: 0; border: inset 6px; border-color: transparent transparent transparent #2ba6cb; border-left-style: solid; border-right-width: 0; position: absolute; top: 50%; margin-top: -6px; right: 1rem; } .js-drilldown-back > a::before { content: ''; display: block; width: 0; height: 0; border: inset 6px; border-color: transparent #2ba6cb transparent transparent; border-right-style: solid; border-left-width: 0; border-left-width: 0; display: inline-block; vertical-align: middle; margin-right: 0.75rem; } .<API key> > a { position: relative; } .<API key> > a::after { content: ''; display: block; width: 0; height: 0; border: inset 6px; border-color: #2ba6cb transparent transparent; border-top-style: solid; border-bottom-width: 0; position: absolute; top: 50%; margin-top: -4px; right: 1rem; } .<API key>[aria-expanded='true'] > a::after { -<API key>: 50% 50%; -ms-transform-origin: 50% 50%; transform-origin: 50% 50%; -webkit-transform: scaleY(-1); -ms-transform: scaleY(-1); transform: scaleY(-1); } .dropdown.menu > li.opens-left > .is-dropdown-submenu { left: auto; right: 0; top: 100%; } .dropdown.menu > li.opens-right > .is-dropdown-submenu { right: auto; left: 0; top: 100%; } .dropdown.menu > li.<API key> > a { padding-right: 1.5rem; position: relative; } .dropdown.menu > li.<API key> > a::after { content: ''; display: block; width: 0; height: 0; border: inset 5px; border-color: #2ba6cb transparent transparent; border-top-style: solid; border-bottom-width: 0; right: 5px; margin-top: -2px; } [data-whatinput='mouse'] .dropdown.menu a { outline: 0; } .no-js .dropdown.menu ul { display: none; } .dropdown.menu.vertical > li .is-dropdown-submenu { top: 0; } .dropdown.menu.vertical > li.opens-left > .is-dropdown-submenu { left: auto; right: 100%; } .dropdown.menu.vertical > li.opens-right > .is-dropdown-submenu { right: auto; left: 100%; } .dropdown.menu.vertical > li > a::after { right: 14px; margin-top: -3px; } .dropdown.menu.vertical > li.opens-left > a::after { content: ''; display: block; width: 0; height: 0; border: inset 5px; border-color: transparent #2ba6cb transparent transparent; border-right-style: solid; border-left-width: 0; } .dropdown.menu.vertical > li.opens-right > a::after { content: ''; display: block; width: 0; height: 0; border: inset 5px; border-color: transparent transparent transparent #2ba6cb; border-left-style: solid; border-right-width: 0; } @media screen and (min-width: 40em) { .dropdown.menu.medium-horizontal > li.opens-left > .is-dropdown-submenu { left: auto; right: 0; top: 100%; } .dropdown.menu.medium-horizontal > li.opens-right > .is-dropdown-submenu { right: auto; left: 0; top: 100%; } .dropdown.menu.medium-horizontal > li.<API key> > a { padding-right: 1.5rem; position: relative; } .dropdown.menu.medium-horizontal > li.<API key> > a::after { content: ''; display: block; width: 0; height: 0; border: inset 5px; border-color: #2ba6cb transparent transparent; border-top-style: solid; border-bottom-width: 0; right: 5px; margin-top: -2px; } .dropdown.menu.medium-vertical > li .is-dropdown-submenu { top: 0; } .dropdown.menu.medium-vertical > li.opens-left > .is-dropdown-submenu { left: auto; right: 100%; } .dropdown.menu.medium-vertical > li.opens-right > .is-dropdown-submenu { right: auto; left: 100%; } .dropdown.menu.medium-vertical > li > a::after { right: 14px; margin-top: -3px; } .dropdown.menu.medium-vertical > li.opens-left > a::after { content: ''; display: block; width: 0; height: 0; border: inset 5px; border-color: transparent #2ba6cb transparent transparent; border-right-style: solid; border-left-width: 0; } .dropdown.menu.medium-vertical > li.opens-right > a::after { content: ''; display: block; width: 0; height: 0; border: inset 5px; border-color: transparent transparent transparent #2ba6cb; border-left-style: solid; border-right-width: 0; } } @media screen and (min-width: 64em) { .dropdown.menu.large-horizontal > li.opens-left > .is-dropdown-submenu { left: auto; right: 0; top: 100%; } .dropdown.menu.large-horizontal > li.opens-right > .is-dropdown-submenu { right: auto; left: 0; top: 100%; } .dropdown.menu.large-horizontal > li.<API key> > a { padding-right: 1.5rem; position: relative; } .dropdown.menu.large-horizontal > li.<API key> > a::after { content: ''; display: block; width: 0; height: 0; border: inset 5px; border-color: #2ba6cb transparent transparent; border-top-style: solid; border-bottom-width: 0; right: 5px; margin-top: -2px; } .dropdown.menu.large-vertical > li .is-dropdown-submenu { top: 0; } .dropdown.menu.large-vertical > li.opens-left > .is-dropdown-submenu { left: auto; right: 100%; } .dropdown.menu.large-vertical > li.opens-right > .is-dropdown-submenu { right: auto; left: 100%; } .dropdown.menu.large-vertical > li > a::after { right: 14px; margin-top: -3px; } .dropdown.menu.large-vertical > li.opens-left > a::after { content: ''; display: block; width: 0; height: 0; border: inset 5px; border-color: transparent #2ba6cb transparent transparent; border-right-style: solid; border-left-width: 0; } .dropdown.menu.large-vertical > li.opens-right > a::after { content: ''; display: block; width: 0; height: 0; border: inset 5px; border-color: transparent transparent transparent #2ba6cb; border-left-style: solid; border-right-width: 0; } } .dropdown.menu.align-right .is-dropdown-submenu.first-sub { top: 100%; left: auto; right: 0; } .is-dropdown-menu.vertical { width: 100px; } .is-dropdown-menu.vertical.align-right { float: right; } .<API key> { position: relative; } .<API key> a::after { position: absolute; top: 50%; right: 5px; margin-top: -2px; } .<API key>.opens-inner > .is-dropdown-submenu { top: 100%; left: auto; } .<API key>.opens-left > .is-dropdown-submenu { left: auto; right: 100%; } .<API key>.opens-right > .is-dropdown-submenu { right: auto; left: 100%; } .is-dropdown-submenu { display: none; position: absolute; top: 0; left: 100%; min-width: 200px; z-index: 1; background: #fefefe; border: 1px solid #cacaca; } .is-dropdown-submenu .<API key> > a::after { right: 14px; margin-top: -3px; } .is-dropdown-submenu .<API key>.opens-left > a::after { content: ''; display: block; width: 0; height: 0; border: inset 5px; border-color: transparent #2ba6cb transparent transparent; border-right-style: solid; border-left-width: 0; } .is-dropdown-submenu .<API key>.opens-right > a::after { content: ''; display: block; width: 0; height: 0; border: inset 5px; border-color: transparent transparent transparent #2ba6cb; border-left-style: solid; border-right-width: 0; } .is-dropdown-submenu .is-dropdown-submenu { margin-top: -1px; } .is-dropdown-submenu > li { width: 100%; } .is-dropdown-submenu.js-dropdown-active { display: block; } .title-bar { background: #0a0a0a; color: #fefefe; padding: 0.5rem; } .title-bar::before, .title-bar::after { content: ' '; display: table; } .title-bar::after { clear: both; } .title-bar .menu-icon { margin-left: 0.25rem; margin-right: 0.25rem; } .title-bar-left { float: left; } .title-bar-right { float: right; text-align: right; } .title-bar-title { font-weight: bold; vertical-align: middle; display: inline-block; } .menu-icon.dark { position: relative; display: inline-block; vertical-align: middle; cursor: pointer; width: 20px; height: 16px; } .menu-icon.dark::after { content: ''; position: absolute; display: block; width: 100%; height: 2px; background: #0a0a0a; top: 0; left: 0; box-shadow: 0 7px 0 #0a0a0a, 0 14px 0 #0a0a0a; } .menu-icon.dark:hover::after { background: #8a8a8a; box-shadow: 0 7px 0 #8a8a8a, 0 14px 0 #8a8a8a; } .top-bar { padding: 0.5rem; } .top-bar::before, .top-bar::after { content: ' '; display: table; } .top-bar::after { clear: both; } .top-bar, .top-bar ul { background-color: #e6e6e6; } .top-bar input { max-width: 200px; margin-right: 1rem; } .top-bar .input-group-field { width: 100%; margin-right: 0; } .top-bar input.button { width: auto; } .top-bar .top-bar-left, .top-bar .top-bar-right { width: 100%; } @media screen and (min-width: 40em) { .top-bar .top-bar-left, .top-bar .top-bar-right { width: auto; } } @media screen and (max-width: 63.9375em) { .top-bar.stacked-for-medium .top-bar-left, .top-bar.stacked-for-medium .top-bar-right { width: 100%; } } @media screen and (max-width: 74.9375em) { .top-bar.stacked-for-large .top-bar-left, .top-bar.stacked-for-large .top-bar-right { width: 100%; } } .top-bar-title { float: left; margin-right: 1rem; } .top-bar-left { float: left; } .top-bar-right { float: right; } .breadcrumbs { list-style: none; margin: 0 0 1rem 0; } .breadcrumbs::before, .breadcrumbs::after { content: ' '; display: table; } .breadcrumbs::after { clear: both; } .breadcrumbs li { float: left; color: #0a0a0a; font-size: 0.6875rem; cursor: default; text-transform: uppercase; } .breadcrumbs li:not(:last-child)::after { color: #cacaca; content: "/"; margin: 0 0.75rem; position: relative; top: 1px; opacity: 1; } .breadcrumbs a { color: #2ba6cb; } .breadcrumbs a:hover { text-decoration: underline; } .breadcrumbs .disabled { color: #cacaca; cursor: not-allowed; } .pagination { margin-left: 0; margin-bottom: 1rem; } .pagination::before, .pagination::after { content: ' '; display: table; } .pagination::after { clear: both; } .pagination li { font-size: 0.875rem; margin-right: 0.0625rem; border-radius: 3px; display: none; } .pagination li:last-child, .pagination li:first-child { display: inline-block; } @media screen and (min-width: 40em) { .pagination li { display: inline-block; } } .pagination a, .pagination button { color: #0a0a0a; display: block; padding: 0.1875rem 0.625rem; border-radius: 3px; } .pagination a:hover, .pagination button:hover { background: #e6e6e6; } .pagination .current { padding: 0.1875rem 0.625rem; background: #2ba6cb; color: #fefefe; cursor: default; } .pagination .disabled { padding: 0.1875rem 0.625rem; color: #cacaca; cursor: not-allowed; } .pagination .disabled:hover { background: transparent; } .pagination .ellipsis::after { content: '\2026'; padding: 0.1875rem 0.625rem; color: #0a0a0a; } .pagination-previous a::before, .pagination-previous.disabled::before { content: '\00ab'; display: inline-block; margin-right: 0.5rem; } .pagination-next a::after, .pagination-next.disabled::after { content: '\00bb'; display: inline-block; margin-left: 0.5rem; } .accordion { list-style-type: none; background: #fefefe; margin-left: 0; } .accordion-item:first-child > :first-child { border-radius: 3px 3px 0 0; } .accordion-item:last-child > :last-child { border-radius: 0 0 3px 3px; } .accordion-title { display: block; padding: 1.25rem 1rem; line-height: 1; font-size: 0.75rem; color: #2ba6cb; position: relative; border: 1px solid #e6e6e6; border-bottom: 0; } :last-child:not(.is-active) > .accordion-title { border-radius: 0 0 3px 3px; border-bottom: 1px solid #e6e6e6; } .accordion-title:hover, .accordion-title:focus { background-color: #e6e6e6; } .accordion-title::before { content: '+'; position: absolute; right: 1rem; top: 50%; margin-top: -0.5rem; } .is-active > .accordion-title::before { content: '–'; } .accordion-content { padding: 1rem; display: none; border: 1px solid #e6e6e6; border-bottom: 0; background-color: #fefefe; color: #0a0a0a; } :last-child > .accordion-content:last-child { border-bottom: 1px solid #e6e6e6; } .dropdown-pane { background-color: #fefefe; border: 1px solid #cacaca; border-radius: 3px; display: block; font-size: 1rem; padding: 1rem; position: absolute; visibility: hidden; width: 300px; z-index: 10; } .dropdown-pane.is-open { visibility: visible; } .dropdown-pane.tiny { width: 100px; } .dropdown-pane.small { width: 200px; } .dropdown-pane.large { width: 400px; } html, body { height: 100%; } .off-canvas-wrapper { width: 100%; overflow-x: hidden; position: relative; -<API key>: hidden; backface-visibility: hidden; -<API key>: auto; } .<API key> { position: relative; width: 100%; transition: -webkit-transform 0.5s ease; transition: transform 0.5s ease; } .<API key>::before, .<API key>::after { content: ' '; display: table; } .<API key>::after { clear: both; } .off-canvas-content, .off-canvas-content { min-height: 100%; background: #fefefe; transition: -webkit-transform 0.5s ease; transition: transform 0.5s ease; -<API key>: hidden; backface-visibility: hidden; z-index: 1; padding-bottom: 0.1px; box-shadow: 0 0 10px rgba(10, 10, 10, 0.5); } .js-off-canvas-exit { display: none; position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: rgba(254, 254, 254, 0.25); cursor: pointer; transition: background 0.5s ease; } .off-canvas { position: absolute; background: #e6e6e6; z-index: -1; max-height: 100%; overflow-y: auto; -webkit-transform: translateX(0); -ms-transform: translateX(0); transform: translateX(0); } [data-whatinput='mouse'] .off-canvas { outline: 0; } .off-canvas.position-left { left: -250px; top: 0; width: 250px; } .is-open-left { -webkit-transform: translateX(250px); -ms-transform: translateX(250px); transform: translateX(250px); } .off-canvas.position-right { right: -250px; top: 0; width: 250px; } .is-open-right { -webkit-transform: translateX(-250px); -ms-transform: translateX(-250px); transform: translateX(-250px); } @media screen and (min-width: 40em) { .position-left.reveal-for-medium { left: 0; z-index: auto; position: fixed; } .position-left.reveal-for-medium ~ .off-canvas-content { margin-left: 250px; } .position-right.reveal-for-medium { right: 0; z-index: auto; position: fixed; } .position-right.reveal-for-medium ~ .off-canvas-content { margin-right: 250px; } } @media screen and (min-width: 64em) { .position-left.reveal-for-large { left: 0; z-index: auto; position: fixed; } .position-left.reveal-for-large ~ .off-canvas-content { margin-left: 250px; } .position-right.reveal-for-large { right: 0; z-index: auto; position: fixed; } .position-right.reveal-for-large ~ .off-canvas-content { margin-right: 250px; } } .tabs { margin: 0; list-style-type: none; background: #fefefe; border: 1px solid #e6e6e6; } .tabs::before, .tabs::after { content: ' '; display: table; } .tabs::after { clear: both; } .tabs.vertical > li { width: auto; float: none; display: block; } .tabs.simple > li > a { padding: 0; } .tabs.simple > li > a:hover { background: transparent; } .tabs.primary { background: #2ba6cb; } .tabs.primary > li > a { color: #fefefe; } .tabs.primary > li > a:hover, .tabs.primary > li > a:focus { background: #299ec1; } .tabs-title { float: left; } .tabs-title > a { display: block; padding: 1.25rem 1.5rem; line-height: 1; font-size: 0.75rem; } .tabs-title > a:hover { background: #fefefe; } .tabs-title > a:focus, .tabs-title > a[aria-selected='true'] { background: #e6e6e6; } .tabs-content { background: #fefefe; transition: all 0.5s ease; border: 1px solid #e6e6e6; border-top: 0; } .tabs-content.vertical { border: 1px solid #e6e6e6; border-left: 0; } .tabs-panel { display: none; padding: 1rem; } .tabs-panel.is-active { display: block; } .callout { margin: 0 0 1rem 0; padding: 1rem; border: 1px solid rgba(10, 10, 10, 0.25); border-radius: 3px; position: relative; color: #0a0a0a; background-color: white; } .callout > :first-child { margin-top: 0; } .callout > :last-child { margin-bottom: 0; } .callout.primary { background-color: #def2f8; } .callout.secondary { background-color: #fcfcfc; } .callout.alert { background-color: #fcd6d6; } .callout.success { background-color: #e6f7d9; } .callout.warning { background-color: #fff3d9; } .callout.body-font { background-color: #dedede; } .callout.header { background-color: #dedede; } .callout.small { padding-top: 0.5rem; padding-right: 0.5rem; padding-bottom: 0.5rem; padding-left: 0.5rem; } .callout.large { padding-top: 3rem; padding-right: 3rem; padding-bottom: 3rem; padding-left: 3rem; } .media-object { margin-bottom: 1rem; display: block; } .media-object img { max-width: none; } @media screen and (max-width: 39.9375em) { .media-object.stack-for-small .<API key> { padding: 0; padding-bottom: 1rem; display: block; } .media-object.stack-for-small .<API key> img { width: 100%; } } .<API key> { display: table-cell; vertical-align: top; } .<API key>:first-child { padding-right: 1rem; } .<API key>:last-child:not(:nth-child(2)) { padding-left: 1rem; } .<API key> > :last-child { margin-bottom: 0; } .<API key>.middle { vertical-align: middle; } .<API key>.bottom { vertical-align: bottom; } body.is-reveal-open { overflow: hidden; } html.is-reveal-open, html.is-reveal-open body { height: 100%; overflow: hidden; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; } .reveal-overlay { display: none; position: fixed; top: 0; bottom: 0; left: 0; right: 0; z-index: 1005; background-color: rgba(10, 10, 10, 0.45); overflow-y: scroll; } .reveal { display: none; z-index: 1006; padding: 1rem; border: 1px solid #cacaca; background-color: #fefefe; border-radius: 3px; position: relative; top: 100px; margin-left: auto; margin-right: auto; overflow-y: auto; } [data-whatinput='mouse'] .reveal { outline: 0; } @media screen and (min-width: 40em) { .reveal { min-height: 0; } } .reveal .column, .reveal .columns, .reveal .columns { min-width: 0; } .reveal > :last-child { margin-bottom: 0; } @media screen and (min-width: 40em) { .reveal { width: 600px; max-width: 62.5rem; } } @media screen and (min-width: 40em) { .reveal .reveal { left: auto; right: auto; margin: 0 auto; } } .reveal.collapse { padding: 0; } @media screen and (min-width: 40em) { .reveal.tiny { width: 30%; max-width: 62.5rem; } } @media screen and (min-width: 40em) { .reveal.small { width: 50%; max-width: 62.5rem; } } @media screen and (min-width: 40em) { .reveal.large { width: 90%; max-width: 62.5rem; } } .reveal.full { top: 0; left: 0; width: 100%; height: 100%; height: 100vh; min-height: 100vh; max-width: none; margin-left: 0; border: 0; border-radius: 0; } @media screen and (max-width: 39.9375em) { .reveal { top: 0; left: 0; width: 100%; height: 100%; height: 100vh; min-height: 100vh; max-width: none; margin-left: 0; border: 0; border-radius: 0; } } .reveal.without-overlay { position: fixed; } table { width: 100%; margin-bottom: 1rem; border-radius: 3px; } table thead, table tbody, table tfoot { border: 1px solid #f1f1f1; background-color: #fefefe; } table caption { font-weight: bold; padding: 0.5rem 0.625rem 0.625rem; } table thead, table tfoot { background: #f8f8f8; color: #0a0a0a; } table thead tr, table tfoot tr { background: transparent; } table thead th, table thead td, table tfoot th, table tfoot td { padding: 0.5rem 0.625rem 0.625rem; font-weight: bold; text-align: left; } table tbody tr:nth-child(even) { background-color: #f1f1f1; } table tbody th, table tbody td { padding: 0.5rem 0.625rem 0.625rem; } @media screen and (max-width: 63.9375em) { table.stack thead { display: none; } table.stack tfoot { display: none; } table.stack tr, table.stack th, table.stack td { display: block; } table.stack td { border-top: 0; } } table.scroll { display: block; width: 100%; overflow-x: auto; } table.hover tr:hover { background-color: #f9f9f9; } table.hover tr:nth-of-type(even):hover { background-color: #ececec; } .table-scroll { overflow-x: auto; } .table-scroll table { width: auto; } .badge { display: inline-block; padding: 0.3em; min-width: 2.1em; font-size: 0.6rem; text-align: center; border-radius: 50%; background: #2ba6cb; color: #fefefe; } .badge.secondary { background: #e9e9e9; color: #0a0a0a; } .badge.alert { background: #c60f13; color: #fefefe; } .badge.success { background: #5da423; color: #fefefe; } .badge.warning { background: #ffae00; color: #fefefe; } .badge.body-font { background: #222222; color: #fefefe; } .badge.header { background: #222222; color: #fefefe; } .label { display: inline-block; padding: 0.33333rem 0.5rem; font-size: 0.8rem; line-height: 1; white-space: nowrap; cursor: default; border-radius: 3px; background: #2ba6cb; color: #fefefe; } .label.secondary { background: #e9e9e9; color: #0a0a0a; } .label.alert { background: #c60f13; color: #fefefe; } .label.success { background: #5da423; color: #fefefe; } .label.warning { background: #ffae00; color: #fefefe; } .label.body-font { background: #222222; color: #fefefe; } .label.header { background: #222222; color: #fefefe; } .progress { background-color: #cacaca; height: 1rem; margin-bottom: 1rem; border-radius: 3px; } .progress.primary .progress-meter { background-color: #2ba6cb; } .progress.secondary .progress-meter { background-color: #e9e9e9; } .progress.alert .progress-meter { background-color: #c60f13; } .progress.success .progress-meter { background-color: #5da423; } .progress.warning .progress-meter { background-color: #ffae00; } .progress.body-font .progress-meter { background-color: #222222; } .progress.header .progress-meter { background-color: #222222; } .progress-meter { position: relative; display: block; width: 0%; height: 100%; background-color: #2ba6cb; border-radius: 3px; } .progress-meter-text { position: absolute; top: 50%; left: 50%; -webkit-transform: translate(-50%, -50%); -ms-transform: translate(-50%, -50%); transform: translate(-50%, -50%); position: absolute; margin: 0; font-size: 0.75rem; font-weight: bold; color: #fefefe; white-space: nowrap; border-radius: 3px; } .has-tip { border-bottom: dotted 1px #8a8a8a; font-weight: bold; position: relative; display: inline-block; cursor: help; } .tooltip { background-color: #0a0a0a; color: #fefefe; font-size: 80%; padding: 0.75rem; position: absolute; z-index: 10; top: calc(100% + 0.6495rem); max-width: 10rem !important; border-radius: 3px; } .tooltip::before { content: ''; display: block; width: 0; height: 0; border: inset 0.75rem; border-color: transparent transparent #0a0a0a; border-bottom-style: solid; border-top-width: 0; bottom: 100%; position: absolute; left: 50%; -webkit-transform: translateX(-50%); -ms-transform: translateX(-50%); transform: translateX(-50%); } .tooltip.top::before { content: ''; display: block; width: 0; height: 0; border: inset 0.75rem; border-color: #0a0a0a transparent transparent; border-top-style: solid; border-bottom-width: 0; top: 100%; bottom: auto; } .tooltip.left::before { content: ''; display: block; width: 0; height: 0; border: inset 0.75rem; border-color: transparent transparent transparent #0a0a0a; border-left-style: solid; border-right-width: 0; bottom: auto; left: 100%; top: 50%; -webkit-transform: translateY(-50%); -ms-transform: translateY(-50%); transform: translateY(-50%); } .tooltip.right::before { content: ''; display: block; width: 0; height: 0; border: inset 0.75rem; border-color: transparent #0a0a0a transparent transparent; border-right-style: solid; border-left-width: 0; bottom: auto; left: auto; right: 100%; top: 50%; -webkit-transform: translateY(-50%); -ms-transform: translateY(-50%); transform: translateY(-50%); } .flex-video { position: relative; height: 0; padding-bottom: 75%; margin-bottom: 1rem; overflow: hidden; } .flex-video iframe, .flex-video object, .flex-video embed, .flex-video video { position: absolute; top: 0; left: 0; width: 100%; height: 100%; } .flex-video.widescreen { padding-bottom: 56.25%; } .flex-video.vimeo { padding-top: 0; } .orbit { position: relative; } .orbit-container { position: relative; margin: 0; overflow: hidden; list-style: none; } .orbit-slide { width: 100%; max-height: 100%; } .orbit-slide.no-motionui.is-active { top: 0; left: 0; } .orbit-figure { margin: 0; } .orbit-image { margin: 0; width: 100%; max-width: 100%; } .orbit-caption { position: absolute; bottom: 0; width: 100%; padding: 1rem; margin-bottom: 0; color: #fefefe; background-color: rgba(10, 10, 10, 0.5); } .orbit-previous, .orbit-next { position: absolute; top: 50%; -webkit-transform: translateY(-50%); -ms-transform: translateY(-50%); transform: translateY(-50%); z-index: 10; padding: 1rem; color: #fefefe; } [data-whatinput='mouse'] .orbit-previous, [data-whatinput='mouse'] .orbit-next { outline: 0; } .orbit-previous:hover, .orbit-next:hover, .orbit-previous:active, .orbit-next:active, .orbit-previous:focus, .orbit-next:focus { background-color: rgba(10, 10, 10, 0.5); } .orbit-previous { left: 0; } .orbit-next { left: auto; right: 0; } .orbit-bullets { position: relative; margin-top: 0.8rem; margin-bottom: 0.8rem; text-align: center; } [data-whatinput='mouse'] .orbit-bullets { outline: 0; } .orbit-bullets button { width: 1.2rem; height: 1.2rem; margin: 0.1rem; background-color: #cacaca; border-radius: 50%; } .orbit-bullets button:hover { background-color: #8a8a8a; } .orbit-bullets button.is-active { background-color: #8a8a8a; } .thumbnail { border: solid 4px #fefefe; box-shadow: 0 0 0 1px rgba(10, 10, 10, 0.2); display: inline-block; line-height: 0; max-width: 100%; transition: box-shadow 200ms ease-out; border-radius: 3px; margin-bottom: 1rem; } .thumbnail:hover, .thumbnail:focus { box-shadow: 0 0 6px 1px rgba(43, 166, 203, 0.5); } .sticky-container { position: relative; } .sticky { position: absolute; z-index: 0; -webkit-transform: translate3d(0, 0, 0); transform: translate3d(0, 0, 0); } .sticky.is-stuck { position: fixed; z-index: 5; } .sticky.is-stuck.is-at-top { top: 0; } .sticky.is-stuck.is-at-bottom { bottom: 0; } .sticky.is-anchored { position: absolute; left: auto; right: auto; } .sticky.is-anchored.is-at-bottom { bottom: 0; } .row { max-width: 62.5rem; margin-left: auto; margin-right: auto; } .row::before, .row::after { content: ' '; display: table; } .row::after { clear: both; } .row.collapse > .column, .row.collapse > .columns { padding-left: 0; padding-right: 0; } .row .row { max-width: none; margin-left: -0.9375rem; margin-right: -0.9375rem; } .row .row.collapse { margin-left: 0; margin-right: 0; } .row.expanded { max-width: none; } .row.expanded .row { margin-left: auto; margin-right: auto; } .column, .columns { width: 100%; float: left; padding-left: 0.9375rem; padding-right: 0.9375rem; } .column:last-child:not(:first-child), .columns:last-child:not(:first-child) { float: right; } .column.end:last-child:last-child, .end.columns:last-child:last-child { float: left; } .column.row.row, .row.row.columns { float: none; } .row .column.row.row, .row .row.row.columns { padding-left: 0; padding-right: 0; margin-left: 0; margin-right: 0; } .small-1 { width: 8.33333%; } .small-push-1 { position: relative; left: 8.33333%; } .small-pull-1 { position: relative; left: -8.33333%; } .small-offset-0 { margin-left: 0%; } .small-2 { width: 16.66667%; } .small-push-2 { position: relative; left: 16.66667%; } .small-pull-2 { position: relative; left: -16.66667%; } .small-offset-1 { margin-left: 8.33333%; } .small-3 { width: 25%; } .small-push-3 { position: relative; left: 25%; } .small-pull-3 { position: relative; left: -25%; } .small-offset-2 { margin-left: 16.66667%; } .small-4 { width: 33.33333%; } .small-push-4 { position: relative; left: 33.33333%; } .small-pull-4 { position: relative; left: -33.33333%; } .small-offset-3 { margin-left: 25%; } .small-5 { width: 41.66667%; } .small-push-5 { position: relative; left: 41.66667%; } .small-pull-5 { position: relative; left: -41.66667%; } .small-offset-4 { margin-left: 33.33333%; } .small-6 { width: 50%; } .small-push-6 { position: relative; left: 50%; } .small-pull-6 { position: relative; left: -50%; } .small-offset-5 { margin-left: 41.66667%; } .small-7 { width: 58.33333%; } .small-push-7 { position: relative; left: 58.33333%; } .small-pull-7 { position: relative; left: -58.33333%; } .small-offset-6 { margin-left: 50%; } .small-8 { width: 66.66667%; } .small-push-8 { position: relative; left: 66.66667%; } .small-pull-8 { position: relative; left: -66.66667%; } .small-offset-7 { margin-left: 58.33333%; } .small-9 { width: 75%; } .small-push-9 { position: relative; left: 75%; } .small-pull-9 { position: relative; left: -75%; } .small-offset-8 { margin-left: 66.66667%; } .small-10 { width: 83.33333%; } .small-push-10 { position: relative; left: 83.33333%; } .small-pull-10 { position: relative; left: -83.33333%; } .small-offset-9 { margin-left: 75%; } .small-11 { width: 91.66667%; } .small-push-11 { position: relative; left: 91.66667%; } .small-pull-11 { position: relative; left: -91.66667%; } .small-offset-10 { margin-left: 83.33333%; } .small-12 { width: 100%; } .small-offset-11 { margin-left: 91.66667%; } .small-up-1 > .column, .small-up-1 > .columns { width: 100%; float: left; } .small-up-1 > .column:nth-of-type(1n), .small-up-1 > .columns:nth-of-type(1n) { clear: none; } .small-up-1 > .column:nth-of-type(1n+1), .small-up-1 > .columns:nth-of-type(1n+1) { clear: both; } .small-up-1 > .column:last-child, .small-up-1 > .columns:last-child { float: left; } .small-up-2 > .column, .small-up-2 > .columns { width: 50%; float: left; } .small-up-2 > .column:nth-of-type(1n), .small-up-2 > .columns:nth-of-type(1n) { clear: none; } .small-up-2 > .column:nth-of-type(2n+1), .small-up-2 > .columns:nth-of-type(2n+1) { clear: both; } .small-up-2 > .column:last-child, .small-up-2 > .columns:last-child { float: left; } .small-up-3 > .column, .small-up-3 > .columns { width: 33.33333%; float: left; } .small-up-3 > .column:nth-of-type(1n), .small-up-3 > .columns:nth-of-type(1n) { clear: none; } .small-up-3 > .column:nth-of-type(3n+1), .small-up-3 > .columns:nth-of-type(3n+1) { clear: both; } .small-up-3 > .column:last-child, .small-up-3 > .columns:last-child { float: left; } .small-up-4 > .column, .small-up-4 > .columns { width: 25%; float: left; } .small-up-4 > .column:nth-of-type(1n), .small-up-4 > .columns:nth-of-type(1n) { clear: none; } .small-up-4 > .column:nth-of-type(4n+1), .small-up-4 > .columns:nth-of-type(4n+1) { clear: both; } .small-up-4 > .column:last-child, .small-up-4 > .columns:last-child { float: left; } .small-up-5 > .column, .small-up-5 > .columns { width: 20%; float: left; } .small-up-5 > .column:nth-of-type(1n), .small-up-5 > .columns:nth-of-type(1n) { clear: none; } .small-up-5 > .column:nth-of-type(5n+1), .small-up-5 > .columns:nth-of-type(5n+1) { clear: both; } .small-up-5 > .column:last-child, .small-up-5 > .columns:last-child { float: left; } .small-up-6 > .column, .small-up-6 > .columns { width: 16.66667%; float: left; } .small-up-6 > .column:nth-of-type(1n), .small-up-6 > .columns:nth-of-type(1n) { clear: none; } .small-up-6 > .column:nth-of-type(6n+1), .small-up-6 > .columns:nth-of-type(6n+1) { clear: both; } .small-up-6 > .column:last-child, .small-up-6 > .columns:last-child { float: left; } .small-up-7 > .column, .small-up-7 > .columns { width: 14.28571%; float: left; } .small-up-7 > .column:nth-of-type(1n), .small-up-7 > .columns:nth-of-type(1n) { clear: none; } .small-up-7 > .column:nth-of-type(7n+1), .small-up-7 > .columns:nth-of-type(7n+1) { clear: both; } .small-up-7 > .column:last-child, .small-up-7 > .columns:last-child { float: left; } .small-up-8 > .column, .small-up-8 > .columns { width: 12.5%; float: left; } .small-up-8 > .column:nth-of-type(1n), .small-up-8 > .columns:nth-of-type(1n) { clear: none; } .small-up-8 > .column:nth-of-type(8n+1), .small-up-8 > .columns:nth-of-type(8n+1) { clear: both; } .small-up-8 > .column:last-child, .small-up-8 > .columns:last-child { float: left; } .small-collapse > .column, .small-collapse > .columns { padding-left: 0; padding-right: 0; } .small-collapse .row, .expanded.row .small-collapse.row { margin-left: 0; margin-right: 0; } .small-uncollapse > .column, .small-uncollapse > .columns { padding-left: 0.9375rem; padding-right: 0.9375rem; } .small-centered { float: none; margin-left: auto; margin-right: auto; } .small-uncentered, .small-push-0, .small-pull-0 { position: static; margin-left: 0; margin-right: 0; float: left; } @media screen and (min-width: 40em) { .medium-1 { width: 8.33333%; } .medium-push-1 { position: relative; left: 8.33333%; } .medium-pull-1 { position: relative; left: -8.33333%; } .medium-offset-0 { margin-left: 0%; } .medium-2 { width: 16.66667%; } .medium-push-2 { position: relative; left: 16.66667%; } .medium-pull-2 { position: relative; left: -16.66667%; } .medium-offset-1 { margin-left: 8.33333%; } .medium-3 { width: 25%; } .medium-push-3 { position: relative; left: 25%; } .medium-pull-3 { position: relative; left: -25%; } .medium-offset-2 { margin-left: 16.66667%; } .medium-4 { width: 33.33333%; } .medium-push-4 { position: relative; left: 33.33333%; } .medium-pull-4 { position: relative; left: -33.33333%; } .medium-offset-3 { margin-left: 25%; } .medium-5 { width: 41.66667%; } .medium-push-5 { position: relative; left: 41.66667%; } .medium-pull-5 { position: relative; left: -41.66667%; } .medium-offset-4 { margin-left: 33.33333%; } .medium-6 { width: 50%; } .medium-push-6 { position: relative; left: 50%; } .medium-pull-6 { position: relative; left: -50%; } .medium-offset-5 { margin-left: 41.66667%; } .medium-7 { width: 58.33333%; } .medium-push-7 { position: relative; left: 58.33333%; } .medium-pull-7 { position: relative; left: -58.33333%; } .medium-offset-6 { margin-left: 50%; } .medium-8 { width: 66.66667%; } .medium-push-8 { position: relative; left: 66.66667%; } .medium-pull-8 { position: relative; left: -66.66667%; } .medium-offset-7 { margin-left: 58.33333%; } .medium-9 { width: 75%; } .medium-push-9 { position: relative; left: 75%; } .medium-pull-9 { position: relative; left: -75%; } .medium-offset-8 { margin-left: 66.66667%; } .medium-10 { width: 83.33333%; } .medium-push-10 { position: relative; left: 83.33333%; } .medium-pull-10 { position: relative; left: -83.33333%; } .medium-offset-9 { margin-left: 75%; } .medium-11 { width: 91.66667%; } .medium-push-11 { position: relative; left: 91.66667%; } .medium-pull-11 { position: relative; left: -91.66667%; } .medium-offset-10 { margin-left: 83.33333%; } .medium-12 { width: 100%; } .medium-offset-11 { margin-left: 91.66667%; } .medium-up-1 > .column, .medium-up-1 > .columns { width: 100%; float: left; } .medium-up-1 > .column:nth-of-type(1n), .medium-up-1 > .columns:nth-of-type(1n) { clear: none; } .medium-up-1 > .column:nth-of-type(1n+1), .medium-up-1 > .columns:nth-of-type(1n+1) { clear: both; } .medium-up-1 > .column:last-child, .medium-up-1 > .columns:last-child { float: left; } .medium-up-2 > .column, .medium-up-2 > .columns { width: 50%; float: left; } .medium-up-2 > .column:nth-of-type(1n), .medium-up-2 > .columns:nth-of-type(1n) { clear: none; } .medium-up-2 > .column:nth-of-type(2n+1), .medium-up-2 > .columns:nth-of-type(2n+1) { clear: both; } .medium-up-2 > .column:last-child, .medium-up-2 > .columns:last-child { float: left; } .medium-up-3 > .column, .medium-up-3 > .columns { width: 33.33333%; float: left; } .medium-up-3 > .column:nth-of-type(1n), .medium-up-3 > .columns:nth-of-type(1n) { clear: none; } .medium-up-3 > .column:nth-of-type(3n+1), .medium-up-3 > .columns:nth-of-type(3n+1) { clear: both; } .medium-up-3 > .column:last-child, .medium-up-3 > .columns:last-child { float: left; } .medium-up-4 > .column, .medium-up-4 > .columns { width: 25%; float: left; } .medium-up-4 > .column:nth-of-type(1n), .medium-up-4 > .columns:nth-of-type(1n) { clear: none; } .medium-up-4 > .column:nth-of-type(4n+1), .medium-up-4 > .columns:nth-of-type(4n+1) { clear: both; } .medium-up-4 > .column:last-child, .medium-up-4 > .columns:last-child { float: left; } .medium-up-5 > .column, .medium-up-5 > .columns { width: 20%; float: left; } .medium-up-5 > .column:nth-of-type(1n), .medium-up-5 > .columns:nth-of-type(1n) { clear: none; } .medium-up-5 > .column:nth-of-type(5n+1), .medium-up-5 > .columns:nth-of-type(5n+1) { clear: both; } .medium-up-5 > .column:last-child, .medium-up-5 > .columns:last-child { float: left; } .medium-up-6 > .column, .medium-up-6 > .columns { width: 16.66667%; float: left; } .medium-up-6 > .column:nth-of-type(1n), .medium-up-6 > .columns:nth-of-type(1n) { clear: none; } .medium-up-6 > .column:nth-of-type(6n+1), .medium-up-6 > .columns:nth-of-type(6n+1) { clear: both; } .medium-up-6 > .column:last-child, .medium-up-6 > .columns:last-child { float: left; } .medium-up-7 > .column, .medium-up-7 > .columns { width: 14.28571%; float: left; } .medium-up-7 > .column:nth-of-type(1n), .medium-up-7 > .columns:nth-of-type(1n) { clear: none; } .medium-up-7 > .column:nth-of-type(7n+1), .medium-up-7 > .columns:nth-of-type(7n+1) { clear: both; } .medium-up-7 > .column:last-child, .medium-up-7 > .columns:last-child { float: left; } .medium-up-8 > .column, .medium-up-8 > .columns { width: 12.5%; float: left; } .medium-up-8 > .column:nth-of-type(1n), .medium-up-8 > .columns:nth-of-type(1n) { clear: none; } .medium-up-8 > .column:nth-of-type(8n+1), .medium-up-8 > .columns:nth-of-type(8n+1) { clear: both; } .medium-up-8 > .column:last-child, .medium-up-8 > .columns:last-child { float: left; } .medium-collapse > .column, .medium-collapse > .columns { padding-left: 0; padding-right: 0; } .medium-collapse .row, .expanded.row .medium-collapse.row { margin-left: 0; margin-right: 0; } .medium-uncollapse > .column, .medium-uncollapse > .columns { padding-left: 0.9375rem; padding-right: 0.9375rem; } .medium-centered { float: none; margin-left: auto; margin-right: auto; } .medium-uncentered, .medium-push-0, .medium-pull-0 { position: static; margin-left: 0; margin-right: 0; float: left; } } @media screen and (min-width: 64em) { .large-1 { width: 8.33333%; } .large-push-1 { position: relative; left: 8.33333%; } .large-pull-1 { position: relative; left: -8.33333%; } .large-offset-0 { margin-left: 0%; } .large-2 { width: 16.66667%; } .large-push-2 { position: relative; left: 16.66667%; } .large-pull-2 { position: relative; left: -16.66667%; } .large-offset-1 { margin-left: 8.33333%; } .large-3 { width: 25%; } .large-push-3 { position: relative; left: 25%; } .large-pull-3 { position: relative; left: -25%; } .large-offset-2 { margin-left: 16.66667%; } .large-4 { width: 33.33333%; } .large-push-4 { position: relative; left: 33.33333%; } .large-pull-4 { position: relative; left: -33.33333%; } .large-offset-3 { margin-left: 25%; } .large-5 { width: 41.66667%; } .large-push-5 { position: relative; left: 41.66667%; } .large-pull-5 { position: relative; left: -41.66667%; } .large-offset-4 { margin-left: 33.33333%; } .large-6 { width: 50%; } .large-push-6 { position: relative; left: 50%; } .large-pull-6 { position: relative; left: -50%; } .large-offset-5 { margin-left: 41.66667%; } .large-7 { width: 58.33333%; } .large-push-7 { position: relative; left: 58.33333%; } .large-pull-7 { position: relative; left: -58.33333%; } .large-offset-6 { margin-left: 50%; } .large-8 { width: 66.66667%; } .large-push-8 { position: relative; left: 66.66667%; } .large-pull-8 { position: relative; left: -66.66667%; } .large-offset-7 { margin-left: 58.33333%; } .large-9 { width: 75%; } .large-push-9 { position: relative; left: 75%; } .large-pull-9 { position: relative; left: -75%; } .large-offset-8 { margin-left: 66.66667%; } .large-10 { width: 83.33333%; } .large-push-10 { position: relative; left: 83.33333%; } .large-pull-10 { position: relative; left: -83.33333%; } .large-offset-9 { margin-left: 75%; } .large-11 { width: 91.66667%; } .large-push-11 { position: relative; left: 91.66667%; } .large-pull-11 { position: relative; left: -91.66667%; } .large-offset-10 { margin-left: 83.33333%; } .large-12 { width: 100%; } .large-offset-11 { margin-left: 91.66667%; } .large-up-1 > .column, .large-up-1 > .columns { width: 100%; float: left; } .large-up-1 > .column:nth-of-type(1n), .large-up-1 > .columns:nth-of-type(1n) { clear: none; } .large-up-1 > .column:nth-of-type(1n+1), .large-up-1 > .columns:nth-of-type(1n+1) { clear: both; } .large-up-1 > .column:last-child, .large-up-1 > .columns:last-child { float: left; } .large-up-2 > .column, .large-up-2 > .columns { width: 50%; float: left; } .large-up-2 > .column:nth-of-type(1n), .large-up-2 > .columns:nth-of-type(1n) { clear: none; } .large-up-2 > .column:nth-of-type(2n+1), .large-up-2 > .columns:nth-of-type(2n+1) { clear: both; } .large-up-2 > .column:last-child, .large-up-2 > .columns:last-child { float: left; } .large-up-3 > .column, .large-up-3 > .columns { width: 33.33333%; float: left; } .large-up-3 > .column:nth-of-type(1n), .large-up-3 > .columns:nth-of-type(1n) { clear: none; } .large-up-3 > .column:nth-of-type(3n+1), .large-up-3 > .columns:nth-of-type(3n+1) { clear: both; } .large-up-3 > .column:last-child, .large-up-3 > .columns:last-child { float: left; } .large-up-4 > .column, .large-up-4 > .columns { width: 25%; float: left; } .large-up-4 > .column:nth-of-type(1n), .large-up-4 > .columns:nth-of-type(1n) { clear: none; } .large-up-4 > .column:nth-of-type(4n+1), .large-up-4 > .columns:nth-of-type(4n+1) { clear: both; } .large-up-4 > .column:last-child, .large-up-4 > .columns:last-child { float: left; } .large-up-5 > .column, .large-up-5 > .columns { width: 20%; float: left; } .large-up-5 > .column:nth-of-type(1n), .large-up-5 > .columns:nth-of-type(1n) { clear: none; } .large-up-5 > .column:nth-of-type(5n+1), .large-up-5 > .columns:nth-of-type(5n+1) { clear: both; } .large-up-5 > .column:last-child, .large-up-5 > .columns:last-child { float: left; } .large-up-6 > .column, .large-up-6 > .columns { width: 16.66667%; float: left; } .large-up-6 > .column:nth-of-type(1n), .large-up-6 > .columns:nth-of-type(1n) { clear: none; } .large-up-6 > .column:nth-of-type(6n+1), .large-up-6 > .columns:nth-of-type(6n+1) { clear: both; } .large-up-6 > .column:last-child, .large-up-6 > .columns:last-child { float: left; } .large-up-7 > .column, .large-up-7 > .columns { width: 14.28571%; float: left; } .large-up-7 > .column:nth-of-type(1n), .large-up-7 > .columns:nth-of-type(1n) { clear: none; } .large-up-7 > .column:nth-of-type(7n+1), .large-up-7 > .columns:nth-of-type(7n+1) { clear: both; } .large-up-7 > .column:last-child, .large-up-7 > .columns:last-child { float: left; } .large-up-8 > .column, .large-up-8 > .columns { width: 12.5%; float: left; } .large-up-8 > .column:nth-of-type(1n), .large-up-8 > .columns:nth-of-type(1n) { clear: none; } .large-up-8 > .column:nth-of-type(8n+1), .large-up-8 > .columns:nth-of-type(8n+1) { clear: both; } .large-up-8 > .column:last-child, .large-up-8 > .columns:last-child { float: left; } .large-collapse > .column, .large-collapse > .columns { padding-left: 0; padding-right: 0; } .large-collapse .row, .expanded.row .large-collapse.row { margin-left: 0; margin-right: 0; } .large-uncollapse > .column, .large-uncollapse > .columns { padding-left: 0.9375rem; padding-right: 0.9375rem; } .large-centered { float: none; margin-left: auto; margin-right: auto; } .large-uncentered, .large-push-0, .large-pull-0 { position: static; margin-left: 0; margin-right: 0; float: left; } } .menu-icon { position: relative; display: inline-block; vertical-align: middle; cursor: pointer; width: 20px; height: 16px; } .menu-icon::after { content: ''; position: absolute; display: block; width: 100%; height: 2px; background: #fefefe; top: 0; left: 0; box-shadow: 0 7px 0 #fefefe, 0 14px 0 #fefefe; } .menu-icon:hover::after { background: #cacaca; box-shadow: 0 7px 0 #cacaca, 0 14px 0 #cacaca; } .menu-icon.dark { position: relative; display: inline-block; vertical-align: middle; cursor: pointer; width: 20px; height: 16px; } .menu-icon.dark::after { content: ''; position: absolute; display: block; width: 100%; height: 2px; background: #0a0a0a; top: 0; left: 0; box-shadow: 0 7px 0 #0a0a0a, 0 14px 0 #0a0a0a; } .menu-icon.dark:hover::after { background: #8a8a8a; box-shadow: 0 7px 0 #8a8a8a, 0 14px 0 #8a8a8a; } .slide-in-down.mui-enter { transition-duration: 500ms; <API key>: linear; -webkit-transform: translateY(-100%); -ms-transform: translateY(-100%); transform: translateY(-100%); transition-property: -webkit-transform, opacity; transition-property: transform, opacity; -<API key>: hidden; backface-visibility: hidden; } .slide-in-down.mui-enter.mui-enter-active { -webkit-transform: translateY(0); -ms-transform: translateY(0); transform: translateY(0); } .slide-in-left.mui-enter { transition-duration: 500ms; <API key>: linear; -webkit-transform: translateX(-100%); -ms-transform: translateX(-100%); transform: translateX(-100%); transition-property: -webkit-transform, opacity; transition-property: transform, opacity; -<API key>: hidden; backface-visibility: hidden; } .slide-in-left.mui-enter.mui-enter-active { -webkit-transform: translateX(0); -ms-transform: translateX(0); transform: translateX(0); } .slide-in-up.mui-enter { transition-duration: 500ms; <API key>: linear; -webkit-transform: translateY(100%); -ms-transform: translateY(100%); transform: translateY(100%); transition-property: -webkit-transform, opacity; transition-property: transform, opacity; -<API key>: hidden; backface-visibility: hidden; } .slide-in-up.mui-enter.mui-enter-active { -webkit-transform: translateY(0); -ms-transform: translateY(0); transform: translateY(0); } .slide-in-right.mui-enter { transition-duration: 500ms; <API key>: linear; -webkit-transform: translateX(100%); -ms-transform: translateX(100%); transform: translateX(100%); transition-property: -webkit-transform, opacity; transition-property: transform, opacity; -<API key>: hidden; backface-visibility: hidden; } .slide-in-right.mui-enter.mui-enter-active { -webkit-transform: translateX(0); -ms-transform: translateX(0); transform: translateX(0); } .slide-out-down.mui-leave { transition-duration: 500ms; <API key>: linear; -webkit-transform: translateY(0); -ms-transform: translateY(0); transform: translateY(0); transition-property: -webkit-transform, opacity; transition-property: transform, opacity; -<API key>: hidden; backface-visibility: hidden; } .slide-out-down.mui-leave.mui-leave-active { -webkit-transform: translateY(100%); -ms-transform: translateY(100%); transform: translateY(100%); } .slide-out-right.mui-leave { transition-duration: 500ms; <API key>: linear; -webkit-transform: translateX(0); -ms-transform: translateX(0); transform: translateX(0); transition-property: -webkit-transform, opacity; transition-property: transform, opacity; -<API key>: hidden; backface-visibility: hidden; } .slide-out-right.mui-leave.mui-leave-active { -webkit-transform: translateX(100%); -ms-transform: translateX(100%); transform: translateX(100%); } .slide-out-up.mui-leave { transition-duration: 500ms; <API key>: linear; -webkit-transform: translateY(0); -ms-transform: translateY(0); transform: translateY(0); transition-property: -webkit-transform, opacity; transition-property: transform, opacity; -<API key>: hidden; backface-visibility: hidden; } .slide-out-up.mui-leave.mui-leave-active { -webkit-transform: translateY(-100%); -ms-transform: translateY(-100%); transform: translateY(-100%); } .slide-out-left.mui-leave { transition-duration: 500ms; <API key>: linear; -webkit-transform: translateX(0); -ms-transform: translateX(0); transform: translateX(0); transition-property: -webkit-transform, opacity; transition-property: transform, opacity; -<API key>: hidden; backface-visibility: hidden; } .slide-out-left.mui-leave.mui-leave-active { -webkit-transform: translateX(-100%); -ms-transform: translateX(-100%); transform: translateX(-100%); } .fade-in.mui-enter { transition-duration: 500ms; <API key>: linear; opacity: 0; transition-property: opacity; } .fade-in.mui-enter.mui-enter-active { opacity: 1; } .fade-out.mui-leave { transition-duration: 500ms; <API key>: linear; opacity: 1; transition-property: opacity; } .fade-out.mui-leave.mui-leave-active { opacity: 0; } .hinge-in-from-top.mui-enter { transition-duration: 500ms; <API key>: linear; -webkit-transform: perspective(2000px) rotateX(-90deg); transform: perspective(2000px) rotateX(-90deg); -<API key>: top; -ms-transform-origin: top; transform-origin: top; transition-property: -webkit-transform, opacity; transition-property: transform, opacity; opacity: 0; } .hinge-in-from-top.mui-enter.mui-enter-active { -webkit-transform: perspective(2000px) rotate(0deg); transform: perspective(2000px) rotate(0deg); opacity: 1; } .hinge-in-from-right.mui-enter { transition-duration: 500ms; <API key>: linear; -webkit-transform: perspective(2000px) rotateY(-90deg); transform: perspective(2000px) rotateY(-90deg); -<API key>: right; -ms-transform-origin: right; transform-origin: right; transition-property: -webkit-transform, opacity; transition-property: transform, opacity; opacity: 0; } .hinge-in-from-right.mui-enter.mui-enter-active { -webkit-transform: perspective(2000px) rotate(0deg); transform: perspective(2000px) rotate(0deg); opacity: 1; } .<API key>.mui-enter { transition-duration: 500ms; <API key>: linear; -webkit-transform: perspective(2000px) rotateX(90deg); transform: perspective(2000px) rotateX(90deg); -<API key>: bottom; -ms-transform-origin: bottom; transform-origin: bottom; transition-property: -webkit-transform, opacity; transition-property: transform, opacity; opacity: 0; } .<API key>.mui-enter.mui-enter-active { -webkit-transform: perspective(2000px) rotate(0deg); transform: perspective(2000px) rotate(0deg); opacity: 1; } .hinge-in-from-left.mui-enter { transition-duration: 500ms; <API key>: linear; -webkit-transform: perspective(2000px) rotateY(90deg); transform: perspective(2000px) rotateY(90deg); -<API key>: left; -ms-transform-origin: left; transform-origin: left; transition-property: -webkit-transform, opacity; transition-property: transform, opacity; opacity: 0; } .hinge-in-from-left.mui-enter.mui-enter-active { -webkit-transform: perspective(2000px) rotate(0deg); transform: perspective(2000px) rotate(0deg); opacity: 1; } .<API key>.mui-enter { transition-duration: 500ms; <API key>: linear; -webkit-transform: perspective(2000px) rotateX(-90deg); transform: perspective(2000px) rotateX(-90deg); -<API key>: center; -ms-transform-origin: center; transform-origin: center; transition-property: -webkit-transform, opacity; transition-property: transform, opacity; opacity: 0; } .<API key>.mui-enter.mui-enter-active { -webkit-transform: perspective(2000px) rotate(0deg); transform: perspective(2000px) rotate(0deg); opacity: 1; } .<API key>.mui-enter { transition-duration: 500ms; <API key>: linear; -webkit-transform: perspective(2000px) rotateY(-90deg); transform: perspective(2000px) rotateY(-90deg); -<API key>: center; -ms-transform-origin: center; transform-origin: center; transition-property: -webkit-transform, opacity; transition-property: transform, opacity; opacity: 0; } .<API key>.mui-enter.mui-enter-active { -webkit-transform: perspective(2000px) rotate(0deg); transform: perspective(2000px) rotate(0deg); opacity: 1; } .hinge-out-from-top.mui-leave { transition-duration: 500ms; <API key>: linear; -webkit-transform: perspective(2000px) rotate(0deg); transform: perspective(2000px) rotate(0deg); -<API key>: top; -ms-transform-origin: top; transform-origin: top; transition-property: -webkit-transform, opacity; transition-property: transform, opacity; opacity: 1; } .hinge-out-from-top.mui-leave.mui-leave-active { -webkit-transform: perspective(2000px) rotateX(-90deg); transform: perspective(2000px) rotateX(-90deg); opacity: 0; } .<API key>.mui-leave { transition-duration: 500ms; <API key>: linear; -webkit-transform: perspective(2000px) rotate(0deg); transform: perspective(2000px) rotate(0deg); -<API key>: right; -ms-transform-origin: right; transform-origin: right; transition-property: -webkit-transform, opacity; transition-property: transform, opacity; opacity: 1; } .<API key>.mui-leave.mui-leave-active { -webkit-transform: perspective(2000px) rotateY(-90deg); transform: perspective(2000px) rotateY(-90deg); opacity: 0; } .<API key>.mui-leave { transition-duration: 500ms; <API key>: linear; -webkit-transform: perspective(2000px) rotate(0deg); transform: perspective(2000px) rotate(0deg); -<API key>: bottom; -ms-transform-origin: bottom; transform-origin: bottom; transition-property: -webkit-transform, opacity; transition-property: transform, opacity; opacity: 1; } .<API key>.mui-leave.mui-leave-active { -webkit-transform: perspective(2000px) rotateX(90deg); transform: perspective(2000px) rotateX(90deg); opacity: 0; } .hinge-out-from-left.mui-leave { transition-duration: 500ms; <API key>: linear; -webkit-transform: perspective(2000px) rotate(0deg); transform: perspective(2000px) rotate(0deg); -<API key>: left; -ms-transform-origin: left; transform-origin: left; transition-property: -webkit-transform, opacity; transition-property: transform, opacity; opacity: 1; } .hinge-out-from-left.mui-leave.mui-leave-active { -webkit-transform: perspective(2000px) rotateY(90deg); transform: perspective(2000px) rotateY(90deg); opacity: 0; } .<API key>.mui-leave { transition-duration: 500ms; <API key>: linear; -webkit-transform: perspective(2000px) rotate(0deg); transform: perspective(2000px) rotate(0deg); -<API key>: center; -ms-transform-origin: center; transform-origin: center; transition-property: -webkit-transform, opacity; transition-property: transform, opacity; opacity: 1; } .<API key>.mui-leave.mui-leave-active { -webkit-transform: perspective(2000px) rotateX(-90deg); transform: perspective(2000px) rotateX(-90deg); opacity: 0; } .<API key>.mui-leave { transition-duration: 500ms; <API key>: linear; -webkit-transform: perspective(2000px) rotate(0deg); transform: perspective(2000px) rotate(0deg); -<API key>: center; -ms-transform-origin: center; transform-origin: center; transition-property: -webkit-transform, opacity; transition-property: transform, opacity; opacity: 1; } .<API key>.mui-leave.mui-leave-active { -webkit-transform: perspective(2000px) rotateY(-90deg); transform: perspective(2000px) rotateY(-90deg); opacity: 0; } .scale-in-up.mui-enter { transition-duration: 500ms; <API key>: linear; -webkit-transform: scale(0.5); -ms-transform: scale(0.5); transform: scale(0.5); transition-property: -webkit-transform, opacity; transition-property: transform, opacity; opacity: 0; } .scale-in-up.mui-enter.mui-enter-active { -webkit-transform: scale(1); -ms-transform: scale(1); transform: scale(1); opacity: 1; } .scale-in-down.mui-enter { transition-duration: 500ms; <API key>: linear; -webkit-transform: scale(1.5); -ms-transform: scale(1.5); transform: scale(1.5); transition-property: -webkit-transform, opacity; transition-property: transform, opacity; opacity: 0; } .scale-in-down.mui-enter.mui-enter-active { -webkit-transform: scale(1); -ms-transform: scale(1); transform: scale(1); opacity: 1; } .scale-out-up.mui-leave { transition-duration: 500ms; <API key>: linear; -webkit-transform: scale(1); -ms-transform: scale(1); transform: scale(1); transition-property: -webkit-transform, opacity; transition-property: transform, opacity; opacity: 1; } .scale-out-up.mui-leave.mui-leave-active { -webkit-transform: scale(1.5); -ms-transform: scale(1.5); transform: scale(1.5); opacity: 0; } .scale-out-down.mui-leave { transition-duration: 500ms; <API key>: linear; -webkit-transform: scale(1); -ms-transform: scale(1); transform: scale(1); transition-property: -webkit-transform, opacity; transition-property: transform, opacity; opacity: 1; } .scale-out-down.mui-leave.mui-leave-active { -webkit-transform: scale(0.5); -ms-transform: scale(0.5); transform: scale(0.5); opacity: 0; } .spin-in.mui-enter { transition-duration: 500ms; <API key>: linear; -webkit-transform: rotate(-0.75turn); -ms-transform: rotate(-0.75turn); transform: rotate(-0.75turn); transition-property: -webkit-transform, opacity; transition-property: transform, opacity; opacity: 0; } .spin-in.mui-enter.mui-enter-active { -webkit-transform: rotate(0); -ms-transform: rotate(0); transform: rotate(0); opacity: 1; } .spin-out.mui-leave { transition-duration: 500ms; <API key>: linear; -webkit-transform: rotate(0); -ms-transform: rotate(0); transform: rotate(0); transition-property: -webkit-transform, opacity; transition-property: transform, opacity; opacity: 1; } .spin-out.mui-leave.mui-leave-active { -webkit-transform: rotate(0.75turn); -ms-transform: rotate(0.75turn); transform: rotate(0.75turn); opacity: 0; } .spin-in-ccw.mui-enter { transition-duration: 500ms; <API key>: linear; -webkit-transform: rotate(0.75turn); -ms-transform: rotate(0.75turn); transform: rotate(0.75turn); transition-property: -webkit-transform, opacity; transition-property: transform, opacity; opacity: 0; } .spin-in-ccw.mui-enter.mui-enter-active { -webkit-transform: rotate(0); -ms-transform: rotate(0); transform: rotate(0); opacity: 1; } .spin-out-ccw.mui-leave { transition-duration: 500ms; <API key>: linear; -webkit-transform: rotate(0); -ms-transform: rotate(0); transform: rotate(0); transition-property: -webkit-transform, opacity; transition-property: transform, opacity; opacity: 1; } .spin-out-ccw.mui-leave.mui-leave-active { -webkit-transform: rotate(-0.75turn); -ms-transform: rotate(-0.75turn); transform: rotate(-0.75turn); opacity: 0; } .slow { transition-duration: 750ms !important; } .fast { transition-duration: 250ms !important; } .linear { <API key>: linear !important; } .ease { <API key>: ease !important; } .ease-in { <API key>: ease-in !important; } .ease-out { <API key>: ease-out !important; } .ease-in-out { <API key>: ease-in-out !important; } .bounce-in { <API key>: cubic-bezier(0.485, 0.155, 0.24, 1.245) !important; } .bounce-out { <API key>: cubic-bezier(0.485, 0.155, 0.515, 0.845) !important; } .bounce-in-out { <API key>: cubic-bezier(0.76, -0.245, 0.24, 1.245) !important; } .short-delay { transition-delay: 300ms !important; } .long-delay { transition-delay: 700ms !important; } .shake { -<API key>: shake-7; animation-name: shake-7; } @-webkit-keyframes shake-7 { 0%, 10%, 20%, 30%, 40%, 50%, 60%, 70%, 80%, 90% { -webkit-transform: translateX(7%); transform: translateX(7%); } 5%, 15%, 25%, 35%, 45%, 55%, 65%, 75%, 85%, 95% { -webkit-transform: translateX(-7%); transform: translateX(-7%); } } @keyframes shake-7 { 0%, 10%, 20%, 30%, 40%, 50%, 60%, 70%, 80%, 90% { -webkit-transform: translateX(7%); transform: translateX(7%); } 5%, 15%, 25%, 35%, 45%, 55%, 65%, 75%, 85%, 95% { -webkit-transform: translateX(-7%); transform: translateX(-7%); } } .spin-cw { -<API key>: spin-cw-1turn; animation-name: spin-cw-1turn; } @-webkit-keyframes spin-cw-1turn { 0% { -webkit-transform: rotate(-1turn); transform: rotate(-1turn); } 100% { -webkit-transform: rotate(0); transform: rotate(0); } } @keyframes spin-cw-1turn { 0% { -webkit-transform: rotate(-1turn); transform: rotate(-1turn); } 100% { -webkit-transform: rotate(0); transform: rotate(0); } } .spin-ccw { -<API key>: spin-cw-1turn; animation-name: spin-cw-1turn; } @keyframes spin-cw-1turn { 0% { -webkit-transform: rotate(0); transform: rotate(0); } 100% { -webkit-transform: rotate(1turn); transform: rotate(1turn); } } .wiggle { -<API key>: wiggle-7deg; animation-name: wiggle-7deg; } @-webkit-keyframes wiggle-7deg { 40%, 50%, 60% { -webkit-transform: rotate(7deg); transform: rotate(7deg); } 35%, 45%, 55%, 65% { -webkit-transform: rotate(-7deg); transform: rotate(-7deg); } 0%, 30%, 70%, 100% { -webkit-transform: rotate(0); transform: rotate(0); } } @keyframes wiggle-7deg { 40%, 50%, 60% { -webkit-transform: rotate(7deg); transform: rotate(7deg); } 35%, 45%, 55%, 65% { -webkit-transform: rotate(-7deg); transform: rotate(-7deg); } 0%, 30%, 70%, 100% { -webkit-transform: rotate(0); transform: rotate(0); } } .shake, .spin-cw, .spin-ccw, .wiggle { -<API key>: 500ms; animation-duration: 500ms; } .infinite { -<API key>: infinite; <API key>: infinite; } .slow { -<API key>: 750ms !important; animation-duration: 750ms !important; } .fast { -<API key>: 250ms !important; animation-duration: 250ms !important; } .linear { -<API key>: linear !important; <API key>: linear !important; } .ease { -<API key>: ease !important; <API key>: ease !important; } .ease-in { -<API key>: ease-in !important; <API key>: ease-in !important; } .ease-out { -<API key>: ease-out !important; <API key>: ease-out !important; } .ease-in-out { -<API key>: ease-in-out !important; <API key>: ease-in-out !important; } .bounce-in { -<API key>: cubic-bezier(0.485, 0.155, 0.24, 1.245) !important; <API key>: cubic-bezier(0.485, 0.155, 0.24, 1.245) !important; } .bounce-out { -<API key>: cubic-bezier(0.485, 0.155, 0.515, 0.845) !important; <API key>: cubic-bezier(0.485, 0.155, 0.515, 0.845) !important; } .bounce-in-out { -<API key>: cubic-bezier(0.76, -0.245, 0.24, 1.245) !important; <API key>: cubic-bezier(0.76, -0.245, 0.24, 1.245) !important; } .short-delay { -<API key>: 300ms !important; animation-delay: 300ms !important; } .long-delay { -<API key>: 700ms !important; animation-delay: 700ms !important; }
using System.Collections.Generic; using System.Net.Http; using InstaSharp.Extensions; using InstaSharp.Models.Responses; using System.Threading.Tasks; namespace InstaSharp.Endpoints { <summary> Comments Endpoint </summary> public class Comments : InstagramApi { <summary> Comments Endpoints </summary> <param name="config">An instance of the InstagramConfig class.</param> public Comments(InstagramConfig config) : this(config, null) { } <summary> Comments Endpoints </summary> <param name="config">An instance of the InstagramConfig class.</param> <param name="auth">An instance of the OAuthResponse class.</param> public Comments(InstagramConfig config, OAuthResponse auth) : base("media/", config, auth) { } <summary> Get a full list of comments on a media. <para>Requires Authentication: False </para> <param> <c>Required Scope: </c>comments </param> </summary> <param name="mediaId">The id of the media on which to retrieve comments.</param> <returns>CommentsResponse</returns> public Task<CommentsResponse> Get(string mediaId) { var request = Request("{id}/comments"); request.AddUrlSegment("id", mediaId); return Client.ExecuteAsync<CommentsResponse>(request); } <summary> Create a comment on a media. Please email apidevelopers[at]instagram.com for access. <para> <c>Requires Authentication: </c>True </para> <param> <c>Required Scope: </c>comments </param> </summary> <param name="mediaId">The id of the media on which to post a comment.</param> <param name="comment">Text to post as a comment on the media as specified in media-id.</param> <returns>CommentsResponse</returns> public Task<CommentResponse> Post(string mediaId, string comment) { <API key>(); var request = Request("{id}/comments", HttpMethod.Post); request.AddUrlSegment("id", mediaId); request.Content = new <API key>(new List<KeyValuePair<string, string>> { new KeyValuePair<string, string>("text", comment) }); return Client.ExecuteAsync<CommentResponse>(request); } <summary> Remove a comment either on the authenticated user's media or authored by the authenticated user. <para> <c>Requires Authentication: </c>True </para> <param> <c>Required Scope: </c>comments </param> </summary> <param name="mediaId">The id of the media from which to delete the comment.</param> <param name="commentId">The id of the comment to delete.</param> <returns>CommentResponse</returns> public Task<CommentResponse> Delete(string mediaId, string commentId) { <API key>(); var request = Request("{media-id}/comments/{comment-id}", HttpMethod.Delete); request.AddUrlSegment("media-id", mediaId); request.AddUrlSegment("comment-id", commentId); return Client.ExecuteAsync<CommentResponse>(request); } } }
"use strict"; var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property"); _Object$defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; var noteRole = { abstract: false, <API key>: false, baseConcepts: [], <API key>: false, nameFrom: ['author'], prohibitedProps: [], props: {}, relatedConcepts: [], requireContextRole: [], requiredContextRole: [], <API key>: [], requiredProps: {}, superClass: [['roletype', 'structure', 'section']] }; var _default = noteRole; exports.default = _default;
#define SIZEOF_CHAR 1 #define SIZEOF_SHORT 2 #define SIZEOF_INT 4 #ifndef _MSC_EXTENSIONS #define SIZEOF_LONG_LONG 8 #endif /* * Avoids a compiler warning in case this was already defined * (someone defined _WINSOCKAPI_ when including 'windows.h', in order * to prevent it from including 'winsock.h') */ #ifdef _WINSOCKAPI_ #undef _WINSOCKAPI_ #endif #include <winsock2.h> #include <fcntl.h> #include "bittypes.h" #include <time.h> #include <io.h> #ifndef __MINGW32__ #include "IP6_misc.h" #endif #define caddr_t char* #if _MSC_VER < 1500 #define snprintf _snprintf #define vsnprintf _vsnprintf #define strdup _strdup #endif #define inline __inline #ifdef __MINGW32__ #include <stdint.h> #else /*__MINGW32__*/ /* MSVC compiler */ #ifndef _UINTPTR_T_DEFINED #ifdef _WIN64 typedef unsigned __int64 uintptr_t; #else typedef _W64 unsigned int uintptr_t; #endif #define _UINTPTR_T_DEFINED #endif #ifndef _INTPTR_T_DEFINED #ifdef _WIN64 typedef __int64 intptr_t; #else typedef _W64 int intptr_t; #endif #define _INTPTR_T_DEFINED #endif #endif /*__MINGW32__*/
<<API key> class-icon="icon-cog">{{"<API key>" | translate}}</<API key>>
' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. Namespace Microsoft.CodeAnalysis.PasteTracking <UseExportProvider> Public Class <API key> Private Const Project1Name = "Proj1" Private Const Project2Name = "Proj2" Private Const Class1Name = "Class1.cs" Private Const Class2Name = "Class2.cs" Private Const PastedCode As String = " public void Main(string[] args) { }" Private Const <API key> As String = " public void Main(string[] args) { }" Private ReadOnly Property SingleFileCode As XElement = <Workspace> <Project Language="C#" CommonReferences="True" AssemblyName="Proj1"> <Document FilePath="Class1.cs"> public class Class1 { $$ } </Document> </Project> </Workspace> Private ReadOnly Property MultiFileCode As XElement = <Workspace> <Project Language="C#" CommonReferences="True" AssemblyName=<%= Project1Name %>> <Document FilePath=<%= Class1Name %>> public class Class1 { $$ } </Document> <Document FilePath=<%= Class2Name %>> public class Class2 { public const string Greeting = "Hello"; $$ } </Document> </Project> <Project Language="C#" CommonReferences="True" AssemblyName=<%= Project2Name %>> <Document IsLinkFile="True" LinkAssemblyName="Proj1" LinkFilePath=<%= Class1Name %>/> </Project> </Workspace> <WpfFact> <Trait(Traits.Feature, Traits.Features.PasteTracking)> Public Async Function <API key>() As Task Using testState = New <API key>(SingleFileCode) Dim class1Document = testState.OpenDocument(Project1Name, Class1Name) Await testState.<API key>(class1Document) End Using End Function <WpfFact> <Trait(Traits.Feature, Traits.Features.PasteTracking)> Public Async Function <API key>() As Task Using testState = New <API key>(SingleFileCode) Dim class1Document = testState.OpenDocument(Project1Name, Class1Name) Dim expectedTextSpan = testState.SendPaste(class1Document, PastedCode) Await testState.<API key>(class1Document, expectedTextSpan) End Using End Function <WpfFact> <Trait(Traits.Feature, Traits.Features.PasteTracking)> Public Async Function <API key>() As Task Using testState = New <API key>(SingleFileCode) Dim class1Document = testState.OpenDocument(Project1Name, Class1Name) Dim expectedTextSpan = testState.SendPaste(class1Document, <API key>) Await testState.<API key>(class1Document, expectedTextSpan) End Using End Function <WpfFact> <Trait(Traits.Feature, Traits.Features.PasteTracking)> Public Async Function <API key>() As Task Using testState = New <API key>(SingleFileCode) Dim class1Document = testState.OpenDocument(Project1Name, Class1Name) Dim firstTextSpan = testState.SendPaste(class1Document, PastedCode) Dim expectedTextSpan = testState.SendPaste(class1Document, PastedCode) Assert.NotEqual(firstTextSpan, expectedTextSpan) Await testState.<API key>(class1Document, expectedTextSpan) End Using End Function <WpfFact> <Trait(Traits.Feature, Traits.Features.PasteTracking)> Public Async Function <API key>() As Task Using testState = New <API key>(SingleFileCode) Dim class1Document = testState.OpenDocument(Project1Name, Class1Name) testState.SendPaste(class1Document, PastedCode) testState.InsertText(class1Document, "Foo") Await testState.<API key>(class1Document) End Using End Function <WpfFact> <Trait(Traits.Feature, Traits.Features.PasteTracking)> Public Async Function <API key>() As Task Using testState = New <API key>(SingleFileCode) Dim class1Document = testState.OpenDocument(Project1Name, Class1Name) testState.SendPaste(class1Document, PastedCode) testState.CloseDocument(class1Document) Await testState.<API key>(class1Document) End Using End Function <WpfFact> <Trait(Traits.Feature, Traits.Features.PasteTracking)> Public Async Function <API key>() As Task Using testState = New <API key>(SingleFileCode) Dim class1Document = testState.OpenDocument(Project1Name, Class1Name) testState.SendPaste(class1Document, PastedCode) testState.CloseDocument(class1Document) testState.OpenDocument(class1Document) Await testState.<API key>(class1Document) End Using End Function <WpfFact> <Trait(Traits.Feature, Traits.Features.PasteTracking)> Public Async Function <API key>() As Task Using testState = New <API key>(SingleFileCode) Dim class1Document = testState.OpenDocument(Project1Name, Class1Name) testState.SendPaste(class1Document, PastedCode) testState.CloseDocument(class1Document) testState.OpenDocument(class1Document) Dim expectedTextSpan = testState.SendPaste(class1Document, PastedCode) Await testState.<API key>(class1Document, expectedTextSpan) End Using End Function <WpfFact> <Trait(Traits.Feature, Traits.Features.PasteTracking)> Public Async Function <API key>() As Task Using testState = New <API key>(MultiFileCode) Dim class1Document = testState.OpenDocument(Project1Name, Class1Name) Dim class2Document = testState.OpenDocument(Project1Name, Class2Name) Dim <API key> = testState.SendPaste(class1Document, PastedCode) Dim <API key> = testState.SendPaste(class2Document, PastedCode) Assert.NotEqual(<API key>, <API key>) Await testState.<API key>(class1Document, <API key>) Await testState.<API key>(class2Document, <API key>) End Using End Function <WpfFact> <Trait(Traits.Feature, Traits.Features.PasteTracking)> Public Async Function <API key>() As Task Using testState = New <API key>(MultiFileCode) Dim class1Document = testState.OpenDocument(Project1Name, Class1Name) Dim class2Document = testState.OpenDocument(Project1Name, Class2Name) testState.SendPaste(class1Document, PastedCode) Dim <API key> = testState.SendPaste(class2Document, PastedCode) testState.CloseDocument(class1Document) Await testState.<API key>(class1Document) Await testState.<API key>(class2Document, <API key>) End Using End Function <WpfFact> <Trait(Traits.Feature, Traits.Features.PasteTracking)> Public Async Function <API key>() As Task Using testState = New <API key>(MultiFileCode) Dim class1Document = testState.OpenDocument(Project1Name, Class1Name) Dim class2Document = testState.OpenDocument(Project1Name, Class2Name) testState.SendPaste(class1Document, PastedCode) testState.SendPaste(class2Document, PastedCode) testState.CloseDocument(class1Document) testState.CloseDocument(class2Document) Await testState.<API key>(class1Document) Await testState.<API key>(class2Document) End Using End Function <WpfFact> <Trait(Traits.Feature, Traits.Features.PasteTracking)> Public Async Function <API key>() As Task Using testState = New <API key>(MultiFileCode) Dim class1Document = testState.OpenDocument(Project1Name, Class1Name) Dim <API key> = testState.OpenDocument(Project2Name, Class1Name) Dim <API key> = testState.SendPaste(class1Document, PastedCode) Await testState.<API key>(<API key>, <API key>) End Using End Function <WpfFact> <Trait(Traits.Feature, Traits.Features.PasteTracking)> Public Async Function <API key>() As Task Using testState = New <API key>(MultiFileCode) Dim class1Document = testState.OpenDocument(Project1Name, Class1Name) Dim <API key> = testState.OpenDocument(Project2Name, Class1Name) Dim <API key> = testState.SendPaste(class1Document, PastedCode) testState.CloseDocument(class1Document) Await testState.<API key>(<API key>, <API key>) End Using End Function <WpfFact> <Trait(Traits.Feature, Traits.Features.PasteTracking)> Public Async Function <API key>() As Task Using testState = New <API key>(MultiFileCode) Dim class1Document = testState.OpenDocument(Project1Name, Class1Name) Dim <API key> = testState.OpenDocument(Project2Name, Class1Name) testState.SendPaste(class1Document, PastedCode) testState.CloseDocument(class1Document) testState.CloseDocument(<API key>) Await testState.<API key>(<API key>) End Using End Function <WpfFact> <Trait(Traits.Feature, Traits.Features.PasteTracking)> Public Async Function <API key>() As Task Using testState = New <API key>(MultiFileCode) Dim class1Document = testState.OpenDocument(Project1Name, Class1Name) Dim <API key> = testState.OpenDocument(Project2Name, Class1Name) testState.SendPaste(class1Document, PastedCode) testState.InsertText(<API key>, "Foo") Await testState.<API key>(class1Document) Await testState.<API key>(<API key>) End Using End Function <WpfFact> <Trait(Traits.Feature, Traits.Features.PasteTracking)> Public Async Function <API key>() As Task Using testState = New <API key>(MultiFileCode) Dim class1Document = testState.OpenDocument(Project1Name, Class1Name) Dim <API key> = testState.OpenDocument(Project2Name, Class1Name) testState.SendPaste(class1Document, PastedCode) testState.CloseDocument(class1Document) testState.CloseDocument(<API key>) Await testState.<API key>(<API key>) testState.OpenDocument(<API key>) Dim expectedTextSpan = testState.SendPaste(<API key>, PastedCode) Await testState.<API key>(<API key>, expectedTextSpan) End Using End Function End Class End Namespace
#include "RPC/OpaqueServerRPC.h" #include "RPC/Server.h" #include "RPC/ServerRPC.h" #include "RPC/<API key>.h" namespace LogCabin { namespace RPC { /////// Server::RPCHandler ////////// Server::RPCHandler::RPCHandler(Server& server) : server(server) { } Server::RPCHandler::~RPCHandler() { } void Server::RPCHandler::handleRPC(OpaqueServerRPC opaqueRPC) { ServerRPC rpc(std::move(opaqueRPC)); if (!rpc.needsReply()) { // The RPC may have had an invalid header, in which case it needs no // further action. return; } std::shared_ptr<Service> service; { std::lock_guard<std::mutex> lockGuard(server.mutex); auto it = server.services.find(rpc.getService()); if (it != server.services.end()) service = it->second; } if (service) service->handleRPC(std::move(rpc)); else rpc.<API key>(); } /////// Server ////////// Server::Server(Event::Loop& eventLoop, uint32_t maxMessageLength) : mutex() , services() , rpcHandler(*this) , opaqueServer(rpcHandler, eventLoop, maxMessageLength) { } Server::~Server() { } std::string Server::bind(const Address& listenAddress) { return opaqueServer.bind(listenAddress); } void Server::registerService(uint16_t serviceId, std::shared_ptr<Service> service, uint32_t maxThreads) { std::lock_guard<std::mutex> lockGuard(mutex); services[serviceId] = std::make_shared<<API key>>(service, 0, maxThreads); } } // namespace LogCabin::RPC } // namespace LogCabin
package Mojo::URL; use Mojo::Base -base; use overload bool => sub {1}, '""' => sub { shift->to_string }, fallback => 1; use Mojo::Parameters; use Mojo::Path; use Mojo::Util qw(decode encode punycode_decode punycode_encode url_escape url_unescape); has base => sub { Mojo::URL->new }; has [qw(fragment host port scheme userinfo)]; sub clone { my $self = shift; my $clone = $self->new; @$clone{keys %$self} = values %$self; $clone->{$_} && ($clone->{$_} = $clone->{$_}->clone) for qw(base path query); return $clone; } sub host_port { my ($self, $host_port) = @_; if (defined $host_port) { $self->port($1) if $host_port =~ s/:(\d+)$ my $host = url_unescape $host_port; return $host =~ /[^\x00-\x7f]/ ? $self->ihost($host) : $self->host($host); } return undef unless defined(my $host = $self->ihost); return $host unless defined(my $port = $self->port); return "$host:$port"; } sub ihost { my $self = shift; # Decode return $self->host(join '.', map { /^xn--(.+)$/ ? punycode_decode $1 : $_ } split(/\./, shift, -1)) if @_; # Check if host needs to be encoded return undef unless defined(my $host = $self->host); return $host unless $host =~ /[^\x00-\x7f]/; # Encode return join '.', map { /[^\x00-\x7f]/ ? ('xn--' . punycode_encode $_) : $_ } split(/\./, $host, -1); } sub is_abs { !!shift->scheme } sub new { @_ > 1 ? shift->SUPER::new->parse(@_) : shift->SUPER::new } sub parse { my ($self, $url) = @_; # Official regex from RFC 3986 $url =~ m!^(([^:/? $self->scheme($2) if defined $2; $self->path($5) if defined $5; $self->query($7) if defined $7; $self->fragment(_decode(url_unescape $9)) if defined $9; if (defined(my $auth = $4)) { $self->userinfo(_decode(url_unescape $1)) if $auth =~ s/^([^\@]+)\@ $self->host_port($auth); } return $self; } sub password { (shift->userinfo // '') =~ /:(.*)$/ ? $1 : undef } sub path { my $self = shift; # Old path $self->{path} ||= Mojo::Path->new; return $self->{path} unless @_; # New path $self->{path} = ref $_[0] ? $_[0] : $self->{path}->merge($_[0]); return $self; } sub path_query { my ($self, $pq) = @_; if (defined $pq) { return $self unless $pq =~ /^([^? return defined $2 ? $self->path($1)->query($2) : $self->path($1); } my $query = $self->query->to_string; return $self->path->to_string . (length $query ? "?$query" : ''); } sub protocol { lc(shift->scheme sub query { my $self = shift; # Old parameters my $q = $self->{query} ||= Mojo::Parameters->new; return $q unless @_; # Replace with list if (@_ > 1) { $q->pairs([])->parse(@_) } # Merge with hash elsif (ref $_[0] eq 'HASH') { $q->merge(%{$_[0]}) } # Append array elsif (ref $_[0] eq 'ARRAY') { $q->append(@{$_[0]}) } # New parameters else { $self->{query} = ref $_[0] ? $_[0] : $q->parse($_[0]) } return $self; } sub to_abs { my $self = shift; my $abs = $self->clone; return $abs if $abs->is_abs; # Scheme my $base = shift || $abs->base; $abs->base($base)->scheme($base->scheme); # Authority return $abs if $abs->host; $abs->userinfo($base->userinfo)->host($base->host)->port($base->port); # Absolute path my $path = $abs->path; return $abs if $path->leading_slash; # Inherit path if (!@{$path->parts}) { $abs->path($base->path->clone->canonicalize); # Query $abs->query($base->query->clone) unless length $abs->query->to_string; } # Merge paths else { $abs->path($base->path->clone->merge($path)->canonicalize) } return $abs; } sub to_string { shift->_string(0) } sub to_unsafe_string { shift->_string(1) } sub username { (shift->userinfo // '') =~ /^([^:]+)/ ? $1 : undef } sub _decode { decode('UTF-8', $_[0]) sub _encode { url_escape encode('UTF-8', $_[0]), $_[1] } sub _string { my ($self, $unsafe) = @_; # Scheme my $url = ''; if (my $proto = $self->protocol) { $url .= "$proto:" } # Authority my $auth = $self->host_port; $auth = _encode($auth, '^A-Za-z0-9\-._~!$&\'()*+,;=:\[\]') if defined $auth; if ($unsafe && defined(my $info = $self->userinfo)) { $auth = _encode($info, '^A-Za-z0-9\-._~!$&\'()*+,;=:') . '@' . $auth; } $url .= "//$auth" if defined $auth; # Path and query my $path = $self->path_query; $url .= !$auth || !length $path || $path =~ m!^[/?]! ? $path : "/$path"; # Fragment return $url unless defined(my $fragment = $self->fragment); return $url . '#' . _encode($fragment, '^A-Za-z0-9\-._~!$&\'()*+,;=:@/?'); } 1; =encoding utf8 =head1 NAME Mojo::URL - Uniform Resource Locator =head1 SYNOPSIS use Mojo::URL; # Parse my $url = Mojo::URL->new('http://sri:foo@example.com:3000/foo?foo=bar say $url->scheme; say $url->userinfo; say $url->host; say $url->port; say $url->path; say $url->query; say $url->fragment; # Build my $url = Mojo::URL->new; $url->scheme('http'); $url->host('example.com'); $url->port(3000); $url->path('/foo/bar'); $url->query(foo => 'bar'); $url->fragment(23); say "$url"; =head1 DESCRIPTION L<Mojo::URL> implements a subset of L<RFC 3986|http://tools.ietf.org/html/rfc3986>, L<RFC 3987|http://tools.ietf.org/html/rfc3987> and the L<URL Living Standard|https://url.spec.whatwg.org> for Uniform Resource Locators with support for IDNA and IRIs. =head1 ATTRIBUTES L<Mojo::URL> implements the following attributes. =head2 base my $base = $url->base; $url = $url->base(Mojo::URL->new); Base of this URL, defaults to a L<Mojo::URL> object. "http://example.com/a/b?c" Mojo::URL->new("/a/b?c")->base(Mojo::URL->new("http://example.com"))->to_abs; =head2 fragment my $fragment = $url->fragment; $url = $url->fragment('mojolicious'); Fragment part of this URL. # "yada" Mojo::URL->new('http://example.com/foo?bar=baz#yada')->fragment; =head2 host my $host = $url->host; $url = $url->host('127.0.0.1'); Host part of this URL. # "example.com" Mojo::URL->new('http://sri:t3st@example.com:8080/foo')->host; =head2 port my $port = $url->port; $url = $url->port(8080); Port part of this URL. # "8080" Mojo::URL->new('http://sri:t3st@example.com:8080/foo')->port; =head2 scheme my $scheme = $url->scheme; $url = $url->scheme('http'); Scheme part of this URL. # "http" Mojo::URL->new('http://example.com/foo')->scheme; =head2 userinfo my $info = $url->userinfo; $url = $url->userinfo('root:'); Userinfo part of this URL. # "sri:t3st" Mojo::URL->new('https://sri:t3st@example.com/foo')->userinfo; =head1 METHODS L<Mojo::URL> inherits all methods from L<Mojo::Base> and implements the following new ones. =head2 clone my $url2 = $url->clone; Return a new L<Mojo::URL> object cloned from this URL. =head2 host_port my $host_port = $url->host_port; $url = $url->host_port('example.com:8080'); Normalized version of L</"host"> and L</"port">. # "xn--n3h.net:8080" Mojo::URL->new('http://.net:8080/test')->host_port; # "example.com" Mojo::URL->new('http://example.com/test')->host_port; =head2 ihost my $ihost = $url->ihost; $url = $url->ihost('xn--bcher-kva.ch'); Host part of this URL in punycode format. # "xn--n3h.net" Mojo::URL->new('http://.net')->ihost; # "example.com" Mojo::URL->new('http://example.com')->ihost; =head2 is_abs my $bool = $url->is_abs; Check if URL is absolute. # True Mojo::URL->new('http://example.com')->is_abs; Mojo::URL->new('http://example.com/test/index.html')->is_abs; # False Mojo::URL->new('test/index.html')->is_abs; Mojo::URL->new('/test/index.html')->is_abs; Mojo::URL->new('//example.com/test/index.html')->is_abs; =head2 new my $url = Mojo::URL->new; my $url = Mojo::URL->new('http://127.0.0.1:3000/foo?f=b&baz=2#foo'); Construct a new L<Mojo::URL> object and L</"parse"> URL if necessary. =head2 parse $url = $url->parse('http://127.0.0.1:3000/foo/bar?fo=o&baz=23#foo'); Parse relative or absolute URL. # "/test/123" $url->parse('/test/123?foo=bar')->path; # "example.com" $url->parse('http://example.com/test/123?foo=bar')->host; # "sri@example.com" $url->parse('mailto:sri@example.com')->path; =head2 password my $password = $url->password; Password part of L</"userinfo">. # "s3cret" Mojo::URL->new('http://isabel:s3cret@mojolicious.org')->password; # "s:3:c:r:e:t" Mojo::URL->new('http://isabel:s:3:c:r:e:t@mojolicious.org')->password; =head2 path my $path = $url->path; $url = $url->path('foo/bar'); $url = $url->path('/foo/bar'); $url = $url->path(Mojo::Path->new); Path part of this URL, relative paths will be merged with L<Mojo::Path/"merge">, defaults to a L<Mojo::Path> object. # "perldoc" Mojo::URL->new('http://example.com/perldoc/Mojo')->path->parts->[0]; # "/perldoc/DOM/HTML" Mojo::URL->new('http://example.com/perldoc/Mojo')->path->merge('DOM/HTML'); Mojo::URL->new('http://example.com/perldoc/Mojo')->path('/DOM/HTML'); Mojo::URL->new('http://example.com/perldoc/Mojo')->path('DOM/HTML'); Mojo::URL->new('http://example.com/perldoc/Mojo/')->path('DOM/HTML'); =head2 path_query my $path_query = $url->path_query; $url = $url->path_query('/foo/bar?a=1&b=2'); Normalized version of L</"path"> and L</"query">. # "/test?a=1&b=2" Mojo::URL->new('http://example.com/test?a=1&b=2')->path_query; Mojo::URL->new('http://example.com/')->path_query; =head2 protocol my $proto = $url->protocol; Normalized version of L</"scheme">. # "http" Mojo::URL->new('HtTp://example.com')->protocol; =head2 query my $query = $url->query; $url = $url->query({merge => 'to'}); $url = $url->query([append => 'with']); $url = $url->query(replace => 'with'); $url = $url->query('a=1&b=2'); $url = $url->query(Mojo::Parameters->new); Query part of this URL, key/value pairs in an array reference will be appended with L<Mojo::Parameters/"append">, and key/value pairs in a hash reference merged with L<Mojo::Parameters/"merge">, defaults to a L<Mojo::Parameters> object. Mojo::URL->new('http://example.com?a=1&b=2')->query->param('b'); # "a=2&b=2&c=3" Mojo::URL->new('http://example.com?a=1&b=2')->query->merge(a => 2, c => 3); Mojo::URL->new('http://example.com?a=1&b=2')->query(a => 2, c => 3); Mojo::URL->new('http://example.com?a=1&b=2')->query(a => [2, 3]); Mojo::URL->new('http://example.com?a=1&b=2')->query({a => 2, c => 3}); Mojo::URL->new('http://example.com?a=1&b=2')->query({a => undef}); Mojo::URL->new('http://example.com?a=1&b=2')->query([a => 2, c => 3]); =head2 to_abs my $abs = $url->to_abs; my $abs = $url->to_abs(Mojo::URL->new('http://example.com/foo')); Return a new L<Mojo::URL> object cloned from this relative URL and turn it into an absolute one using L</"base"> or provided base URL. Mojo::URL->new('baz.xml?test=123') ->to_abs(Mojo::URL->new('http://example.com/foo/bar.html')); Mojo::URL->new('/baz.xml?test=123') ->to_abs(Mojo::URL->new('http://example.com/foo/bar.html')); Mojo::URL->new('//example.com/foo/baz.xml?test=123') ->to_abs(Mojo::URL->new('http://example.com/foo/bar.html')); =head2 to_string my $str = $url->to_string; Turn URL into a string. Note that L</"userinfo"> will not be included for security reasons. Mojo::URL->new->scheme('http')->host('mojolicious.org')->to_string; Mojo::URL->new('http://daniel:s3cret@mojolicious.org')->to_string; =head2 to_unsafe_string my $str = $url->to_unsafe_string; Same as L</"to_string">, but includes L</"userinfo">. Mojo::URL->new('http://daniel:s3cret@mojolicious.org')->to_unsafe_string; =head2 username my $username = $url->username; Username part of L</"userinfo">. # "isabel" Mojo::URL->new('http://isabel:s3cret@mojolicious.org')->username; =head1 OPERATORS L<Mojo::URL> overloads the following operators. =head2 bool my $bool = !!$url; Always true. =head2 stringify my $str = "$url"; Alias for L</"to_string">. =head1 SEE ALSO L<Mojolicious>, L<Mojolicious::Guides>, L<https://mojolicious.org>. =cut
# typed: false # <API key>: true require "rubocops/bottle" describe RuboCop::Cop::FormulaAudit::<API key> do subject(:cop) { described_class.new } it "reports no offenses for `bottle :uneeded`" do expect_no_offenses(<<~RUBY) class Foo < Formula url "https://brew.sh/foo-1.0.tgz" bottle :unneeded end RUBY end it "reports no offenses for `bottle` blocks without cellars" do expect_no_offenses(<<~RUBY) class Foo < Formula url "https://brew.sh/foo-1.0.tgz" bottle do rebuild 4 sha256 arm64_big_sur: "aaaaaaaa" sha256 big_sur: "faceb00c" sha256 catalina: "deadbeef" end end RUBY expect_no_offenses(<<~RUBY) class Foo < Formula url "https://brew.sh/foo-1.0.tgz" bottle do sha256 big_sur: "faceb00c" end end RUBY end it "reports no offenses for properly aligned tags in `bottle` blocks with cellars" do expect_no_offenses(<<~RUBY) class Foo < Formula url "https://brew.sh/foo-1.0.tgz" bottle do rebuild 4 sha256 cellar: :any, arm64_big_sur: "aaaaaaaa" sha256 cellar: "/usr/local/Cellar", big_sur: "faceb00c" sha256 catalina: "deadbeef" end end RUBY expect_no_offenses(<<~RUBY) class Foo < Formula url "https://brew.sh/foo-1.0.tgz" bottle do sha256 cellar: :any, arm64_big_sur: "aaaaaaaa" end end RUBY end it "reports and corrects misaligned tags in `bottle` block with cellars" do expect_offense(<<~RUBY) class Foo < Formula url "https://brew.sh/foo-1.0.tgz" bottle do rebuild 4 sha256 cellar: :any, arm64_big_sur: "aaaaaaaa" ^^^^^^^^^^^^^^^^^^^^^^^^^ Align bottle tags sha256 cellar: "/usr/local/Cellar", big_sur: "faceb00c" sha256 catalina: "deadbeef" ^^^^^^^^^^^^^^^^^^^^ Align bottle tags end end RUBY expect_correction(<<~RUBY) class Foo < Formula url "https://brew.sh/foo-1.0.tgz" bottle do rebuild 4 sha256 cellar: :any, arm64_big_sur: "aaaaaaaa" sha256 cellar: "/usr/local/Cellar", big_sur: "faceb00c" sha256 catalina: "deadbeef" end end RUBY end end
<?php class <API key> extends Kwc_Abstract { public static function getSettings() { $ret = parent::getSettings(); $ret['viewCache'] = false; return $ret; } public function getTemplateVars() { $ret = parent::getTemplateVars(); $ret['order'] = $this->_getOrder(); $ret['items'] = $ret['order']->getProductsData(); $items = $ret['order']->getChildRows('Products'); $ret['items'] = array(); $ret['<API key>'] = array(); foreach ($items as $i) { $addComponent = <API key>::getInstance() ->getComponentByDbId($i->add_component_id); $additionalOrderData = $addComponent->getComponent()-><API key>($i); foreach ($additionalOrderData as $d) { if (!isset($ret['<API key>'][$d['name']])) { $ret['<API key>'][$d['name']] = array( 'class' => $d['class'], 'text' => $d['name'] ); } } $ret['items'][] = (object)array( 'product' => $addComponent->parent, 'row' => $i, 'additionalOrderData' => $additionalOrderData, 'price' => $i->getProductPrice(), 'text' => $i->getProductText(), ); } $ret['sumRows'] = $this->_getSumRows($this->_getOrder()); $ret['tableFooterText'] = ''; $ret['footerText'] = ''; return $ret; } protected function _getOrder() { return Kwf_Model_Abstract::getInstance(Kwc_Abstract::getSetting($this->getData()->getParentByClass('<API key>')->componentClass, 'childModel')) ->getReferencedModel('Order')->getCartOrder(); } protected function _getSumRows($order) { return $this->getData()->parent->parent->getComponent()->getSumRows($order); } }
<?php class <API key> extends <API key> { protected function _getConfig() { $ret = parent::_getConfig(); $ret['list']['listWidth'] = 120; return $ret; } }
#ifndef <API key> #define <API key> #include "base/containers/flat_map.h" #include "components/exo/surface_observer.h" #include "ui/events/event_handler.h" #include "ui/gfx/geometry/point_f.h" namespace ui { class LocatedEvent; class TouchEvent; } namespace exo { class Seat; class TouchDelegate; class TouchStylusDelegate; // This class implements a client touch device that represents one or more // touch devices. class Touch : public ui::EventHandler, public SurfaceObserver { public: Touch(TouchDelegate* delegate, Seat* seat); Touch(const Touch&) = delete; Touch& operator=(const Touch&) = delete; ~Touch() override; TouchDelegate* delegate() const { return delegate_; } // Set delegate for stylus events. void SetStylusDelegate(TouchStylusDelegate* delegate); bool HasStylusDelegate() const; // Overridden from ui::EventHandler: void OnTouchEvent(ui::TouchEvent* event) override; // Overridden from SurfaceObserver: void OnSurfaceDestroying(Surface* surface) override; private: // Returns the effective target for |event|. Surface* <API key>(ui::LocatedEvent* event) const; // Cancels touches on all the surfaces. void CancelAllTouches(); // The delegate instance that all events are dispatched to. TouchDelegate* const delegate_; Seat* const seat_; // The delegate instance that all stylus related events are dispatched to. TouchStylusDelegate* stylus_delegate_ = nullptr; // Map of touch points to its focus surface. base::flat_map<int, Surface*> <API key>; // Map of a touched surface to the count of touch pointers on that surface. base::flat_map<Surface*, int> <API key>; }; } // namespace exo #endif // <API key>
#include <time.h> #include <stdarg.h> #include "avformat.h" #include "internal.h" #include "libavcodec/dv_profile.h" #include "libavcodec/dvdata.h" #include "dv.h" #include "libavutil/fifo.h" #include "libavutil/mathematics.h" #include "libavutil/intreadwrite.h" #include "libavutil/opt.h" #include "libavutil/timecode.h" #define <API key> 192000 // 1 second of 48khz 32bit audio struct DVMuxContext { AVClass *av_class; const DVprofile* sys; /* current DV profile, e.g.: 525/60, 625/50 */ int n_ast; /* number of stereo audio streams (up to 2) */ AVStream *ast[2]; /* stereo audio streams */ AVFifoBuffer *audio_data[2]; /* FIFO for storing excessive amounts of PCM */ int frames; /* current frame number */ int64_t start_time; /* recording start time */ int has_audio; /* frame under contruction has audio */ int has_video; /* frame under contruction has video */ uint8_t frame_buf[DV_MAX_FRAME_SIZE]; /* frame under contruction */ AVTimecode tc; /* timecode context */ }; static const int dv_aaux_packs_dist[12][9] = { { 0xff, 0xff, 0xff, 0x50, 0x51, 0x52, 0x53, 0xff, 0xff }, { 0x50, 0x51, 0x52, 0x53, 0xff, 0xff, 0xff, 0xff, 0xff }, { 0xff, 0xff, 0xff, 0x50, 0x51, 0x52, 0x53, 0xff, 0xff }, { 0x50, 0x51, 0x52, 0x53, 0xff, 0xff, 0xff, 0xff, 0xff }, { 0xff, 0xff, 0xff, 0x50, 0x51, 0x52, 0x53, 0xff, 0xff }, { 0x50, 0x51, 0x52, 0x53, 0xff, 0xff, 0xff, 0xff, 0xff }, { 0xff, 0xff, 0xff, 0x50, 0x51, 0x52, 0x53, 0xff, 0xff }, { 0x50, 0x51, 0x52, 0x53, 0xff, 0xff, 0xff, 0xff, 0xff }, { 0xff, 0xff, 0xff, 0x50, 0x51, 0x52, 0x53, 0xff, 0xff }, { 0x50, 0x51, 0x52, 0x53, 0xff, 0xff, 0xff, 0xff, 0xff }, { 0xff, 0xff, 0xff, 0x50, 0x51, 0x52, 0x53, 0xff, 0xff }, { 0x50, 0x51, 0x52, 0x53, 0xff, 0xff, 0xff, 0xff, 0xff }, }; static int dv_audio_frame_size(const DVprofile* sys, int frame) { return sys->audio_samples_dist[frame % (sizeof(sys->audio_samples_dist) / sizeof(sys->audio_samples_dist[0]))]; } static int dv_write_pack(enum dv_pack_type pack_id, DVMuxContext *c, uint8_t* buf, ...) { struct tm tc; time_t ct; uint32_t timecode; va_list ap; buf[0] = (uint8_t)pack_id; switch (pack_id) { case dv_timecode: timecode = <API key>(&c->tc, c->frames); timecode |= 1<<23 | 1<<15 | 1<<7 | 1<<6; // biphase and binary group flags AV_WB32(buf + 1, timecode); break; case dv_audio_source: /* AAUX source pack */ va_start(ap, buf); buf[1] = (1 << 7) | /* locked mode -- SMPTE only supports locked mode */ (1 << 6) | /* reserved -- always 1 */ (dv_audio_frame_size(c->sys, c->frames) - c->sys->audio_min_samples[0]); /* # of samples */ buf[2] = (0 << 7) | /* multi-stereo */ (0 << 5) | /* #of audio channels per block: 0 -- 1 channel */ (0 << 4) | /* pair bit: 0 -- one pair of channels */ !!va_arg(ap, int); /* audio mode */ buf[3] = (1 << 7) | /* res */ (1 << 6) | /* multi-language flag */ (c->sys->dsf << 5) | /* system: 60fields/50fields */ (c->sys->n_difchan & 2); /* definition: 0 -- 25Mbps, 2 -- 50Mbps */ buf[4] = (1 << 7) | /* emphasis: 1 -- off */ (0 << 6) | /* emphasis time constant: 0 -- reserved */ (0 << 3) | /* frequency: 0 -- 48kHz, 1 -- 44,1kHz, 2 -- 32kHz */ 0; /* quantization: 0 -- 16bit linear, 1 -- 12bit nonlinear */ va_end(ap); break; case dv_audio_control: buf[1] = (0 << 6) | /* copy protection: 0 -- unrestricted */ (1 << 4) | /* input source: 1 -- digital input */ (3 << 2) | /* compression: 3 -- no information */ 0; /* misc. info/SMPTE emphasis off */ buf[2] = (1 << 7) | /* recording start point: 1 -- no */ (1 << 6) | /* recording end point: 1 -- no */ (1 << 3) | /* recording mode: 1 -- original */ 7; buf[3] = (1 << 7) | /* direction: 1 -- forward */ (c->sys->pix_fmt == PIX_FMT_YUV420P ? 0x20 : /* speed */ c->sys->ltc_divisor * 4); buf[4] = (1 << 7) | /* reserved -- always 1 */ 0x7f; /* genre category */ break; case dv_audio_recdate: case dv_video_recdate: /* VAUX recording date */ ct = c->start_time + av_rescale_rnd(c->frames, c->sys->time_base.num, c->sys->time_base.den, AV_ROUND_DOWN); ff_brktimegm(ct, &tc); buf[1] = 0xff; /* ds, tm, tens of time zone, units of time zone */ /* 0xff is very likely to be "unknown" */ buf[2] = (3 << 6) | /* reserved -- always 1 */ ((tc.tm_mday / 10) << 4) | /* Tens of day */ (tc.tm_mday % 10); /* Units of day */ buf[3] = /* we set high 4 bits to 0, shouldn't we set them to week? */ ((tc.tm_mon / 10) << 4) | /* Tens of month */ (tc.tm_mon % 10); /* Units of month */ buf[4] = (((tc.tm_year % 100) / 10) << 4) | /* Tens of year */ (tc.tm_year % 10); /* Units of year */ break; case dv_audio_rectime: /* AAUX recording time */ case dv_video_rectime: /* VAUX recording time */ ct = c->start_time + av_rescale_rnd(c->frames, c->sys->time_base.num, c->sys->time_base.den, AV_ROUND_DOWN); ff_brktimegm(ct, &tc); buf[1] = (3 << 6) | /* reserved -- always 1 */ 0x3f; /* tens of frame, units of frame: 0x3f - "unknown" ? */ buf[2] = (1 << 7) | /* reserved -- always 1 */ ((tc.tm_sec / 10) << 4) | /* Tens of seconds */ (tc.tm_sec % 10); /* Units of seconds */ buf[3] = (1 << 7) | /* reserved -- always 1 */ ((tc.tm_min / 10) << 4) | /* Tens of minutes */ (tc.tm_min % 10); /* Units of minutes */ buf[4] = (3 << 6) | /* reserved -- always 1 */ ((tc.tm_hour / 10) << 4) | /* Tens of hours */ (tc.tm_hour % 10); /* Units of hours */ break; default: buf[1] = buf[2] = buf[3] = buf[4] = 0xff; } return 5; } static void dv_inject_audio(DVMuxContext *c, int channel, uint8_t* frame_ptr) { int i, j, d, of, size; size = 4 * dv_audio_frame_size(c->sys, c->frames); frame_ptr += channel * c->sys->difseg_size * 150 * 80; for (i = 0; i < c->sys->difseg_size; i++) { frame_ptr += 6 * 80; /* skip DIF segment header */ for (j = 0; j < 9; j++) { dv_write_pack(dv_aaux_packs_dist[i][j], c, &frame_ptr[3], i >= c->sys->difseg_size/2); for (d = 8; d < 80; d+=2) { of = c->sys->audio_shuffle[i][j] + (d - 8)/2 * c->sys->audio_stride; if (of*2 >= size) continue; frame_ptr[d] = *av_fifo_peek2(c->audio_data[channel], of*2+1); // FIXME: maybe we have to admit frame_ptr[d+1] = *av_fifo_peek2(c->audio_data[channel], of*2); // that DV is a big-endian PCM } frame_ptr += 16 * 80; /* 15 Video DIFs + 1 Audio DIF */ } } } static void dv_inject_metadata(DVMuxContext *c, uint8_t* frame) { int j, k; uint8_t* buf; for (buf = frame; buf < frame + c->sys->frame_size; buf += 150 * 80) { /* DV subcode: 2nd and 3d DIFs */ for (j = 80; j < 80 * 3; j += 80) { for (k = 6; k < 6 * 8; k += 8) dv_write_pack(dv_timecode, c, &buf[j+k]); if (((long)(buf-frame)/(c->sys->frame_size/(c->sys->difseg_size*c->sys->n_difchan))%c->sys->difseg_size) > 5) { /* FIXME: is this really needed ? */ dv_write_pack(dv_video_recdate, c, &buf[j+14]); dv_write_pack(dv_video_rectime, c, &buf[j+22]); dv_write_pack(dv_video_recdate, c, &buf[j+38]); dv_write_pack(dv_video_rectime, c, &buf[j+46]); } } /* DV VAUX: 4th, 5th and 6th 3DIFs */ for (j = 80*3 + 3; j < 80*6; j += 80) { dv_write_pack(dv_video_recdate, c, &buf[j+5*2]); dv_write_pack(dv_video_rectime, c, &buf[j+5*3]); dv_write_pack(dv_video_recdate, c, &buf[j+5*11]); dv_write_pack(dv_video_rectime, c, &buf[j+5*12]); } } } /* * The following 3 functions constitute our interface to the world */ static int dv_assemble_frame(DVMuxContext *c, AVStream* st, uint8_t* data, int data_size, uint8_t** frame) { int i, reqasize; *frame = &c->frame_buf[0]; reqasize = 4 * dv_audio_frame_size(c->sys, c->frames); switch (st->codec->codec_type) { case AVMEDIA_TYPE_VIDEO: /* FIXME: we have to have more sensible approach than this one */ if (c->has_video) av_log(st->codec, AV_LOG_ERROR, "Can't process DV frame #%d. Insufficient audio data or severe sync problem.\n", c->frames); memcpy(*frame, data, c->sys->frame_size); c->has_video = 1; break; case AVMEDIA_TYPE_AUDIO: for (i = 0; i < c->n_ast && st != c->ast[i]; i++); /* FIXME: we have to have more sensible approach than this one */ if (av_fifo_size(c->audio_data[i]) + data_size >= 100*<API key>) av_log(st->codec, AV_LOG_ERROR, "Can't process DV frame #%d. Insufficient video data or severe sync problem.\n", c->frames); <API key>(c->audio_data[i], data, data_size, NULL); /* Let us see if we've got enough audio for one DV frame. */ c->has_audio |= ((reqasize <= av_fifo_size(c->audio_data[i])) << i); break; default: break; } /* Let us see if we have enough data to construct one DV frame. */ if (c->has_video == 1 && c->has_audio + 1 == 1 << c->n_ast) { dv_inject_metadata(c, *frame); c->has_audio = 0; for (i=0; i < c->n_ast; i++) { dv_inject_audio(c, i, *frame); av_fifo_drain(c->audio_data[i], reqasize); c->has_audio |= ((reqasize <= av_fifo_size(c->audio_data[i])) << i); } c->has_video = 0; c->frames++; return c->sys->frame_size; } return 0; } static DVMuxContext* dv_init_mux(AVFormatContext* s) { DVMuxContext *c = s->priv_data; AVStream *vst = NULL; AVDictionaryEntry *t; int i; /* we support at most 1 video and 2 audio streams */ if (s->nb_streams > 3) return NULL; c->n_ast = 0; c->ast[0] = c->ast[1] = NULL; /* We have to sort out where audio and where video stream is */ for (i=0; i<s->nb_streams; i++) { switch (s->streams[i]->codec->codec_type) { case AVMEDIA_TYPE_VIDEO: if (vst) return NULL; vst = s->streams[i]; break; case AVMEDIA_TYPE_AUDIO: if (c->n_ast > 1) return NULL; c->ast[c->n_ast++] = s->streams[i]; break; default: goto bail_out; } } /* Some checks -- DV format is very picky about its incoming streams */ if (!vst || vst->codec->codec_id != AV_CODEC_ID_DVVIDEO) goto bail_out; for (i=0; i<c->n_ast; i++) { if (c->ast[i] && (c->ast[i]->codec->codec_id != <API key> || c->ast[i]->codec->sample_rate != 48000 || c->ast[i]->codec->channels != 2)) goto bail_out; } c->sys = <API key>(vst->codec); if (!c->sys) goto bail_out; if ((c->n_ast > 1) && (c->sys->n_difchan < 2)) { /* only 1 stereo pair is allowed in 25Mbps mode */ goto bail_out; } /* Ok, everything seems to be in working order */ c->frames = 0; c->has_audio = 0; c->has_video = 0; if (t = av_dict_get(s->metadata, "creation_time", NULL, 0)) c->start_time = <API key>(t->value); for (i=0; i < c->n_ast; i++) { if (c->ast[i] && !(c->audio_data[i]=av_fifo_alloc(100*<API key>))) { while (i > 0) { i av_fifo_free(c->audio_data[i]); } goto bail_out; } } return c; bail_out: return NULL; } static void dv_delete_mux(DVMuxContext *c) { int i; for (i=0; i < c->n_ast; i++) av_fifo_free(c->audio_data[i]); } static int dv_write_header(AVFormatContext *s) { AVRational rate; DVMuxContext *dvc = s->priv_data; AVDictionaryEntry *tcr = av_dict_get(s->metadata, "timecode", NULL, 0); if (!dv_init_mux(s)) { av_log(s, AV_LOG_ERROR, "Can't initialize DV format!\n" "Make sure that you supply exactly two streams:\n" " video: 25fps or 29.97fps, audio: 2ch/48kHz/PCM\n" " (50Mbps allows an optional second audio stream)\n"); return -1; } rate.num = dvc->sys->ltc_divisor; rate.den = 1; if (!tcr) { // no global timecode, look into the streams int i; for (i = 0; i < s->nb_streams; i++) { tcr = av_dict_get(s->streams[i]->metadata, "timecode", NULL, 0); if (tcr) break; } } if (tcr) return <API key>(&dvc->tc, rate, tcr->value, s); return av_timecode_init(&dvc->tc, rate, 0, 0, s); } static int dv_write_packet(struct AVFormatContext *s, AVPacket *pkt) { uint8_t* frame; int fsize; fsize = dv_assemble_frame(s->priv_data, s->streams[pkt->stream_index], pkt->data, pkt->size, &frame); if (fsize > 0) { avio_write(s->pb, frame, fsize); avio_flush(s->pb); } return 0; } /* * We might end up with some extra A/V data without matching counterpart. * E.g. video data without enough audio to write the complete frame. * Currently we simply drop the last frame. I don't know whether this * is the best strategy of all */ static int dv_write_trailer(struct AVFormatContext *s) { dv_delete_mux(s->priv_data); return 0; } AVOutputFormat ff_dv_muxer = { .name = "dv", .long_name = <API key>("DV (Digital Video)"), .extensions = "dv", .priv_data_size = sizeof(DVMuxContext), .audio_codec = <API key>, .video_codec = AV_CODEC_ID_DVVIDEO, .write_header = dv_write_header, .write_packet = dv_write_packet, .write_trailer = dv_write_trailer, };
package org.motechproject.mds.builder.impl; import javassist.<API key>; import javassist.ClassPool; import javassist.CtClass; import javassist.CtField; import javassist.NotFoundException; import org.apache.commons.lang.reflect.FieldUtils; import org.joda.time.DateTime; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; import org.mockito.invocation.InvocationOnMock; import org.mockito.stubbing.Answer; import org.motechproject.mds.annotations.internal.samples.AnotherSample; import org.motechproject.mds.builder.<API key>; import org.motechproject.mds.builder.Sample; import org.motechproject.mds.builder.<API key>; import org.motechproject.mds.domain.ClassData; import org.motechproject.mds.domain.EntityType; import org.motechproject.mds.domain.<API key>; import org.motechproject.mds.domain.<API key>; import org.motechproject.mds.dto.EntityDto; import org.motechproject.mds.dto.FieldBasicDto; import org.motechproject.mds.dto.FieldDto; import org.motechproject.mds.dto.LookupDto; import org.motechproject.mds.dto.LookupFieldDto; import org.motechproject.mds.dto.LookupFieldType; import org.motechproject.mds.dto.MetadataDto; import org.motechproject.mds.dto.SchemaHolder; import org.motechproject.mds.dto.TypeDto; import org.motechproject.mds.javassist.MotechClassPool; import org.powermock.api.mockito.PowerMockito; import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; import javax.jdo.annotations.IdGeneratorStrategy; import javax.jdo.annotations.IdentityType; import javax.jdo.annotations.PersistenceModifier; import javax.jdo.metadata.ClassMetadata; import javax.jdo.metadata.<API key>; import javax.jdo.metadata.CollectionMetadata; import javax.jdo.metadata.FieldMetadata; import javax.jdo.metadata.ForeignKeyMetadata; import javax.jdo.metadata.IndexMetadata; import javax.jdo.metadata.InheritanceMetadata; import javax.jdo.metadata.JDOMetadata; import javax.jdo.metadata.PackageMetadata; import javax.jdo.metadata.UniqueMetadata; import java.util.ArrayList; import java.util.List; import static java.util.Arrays.asList; import static java.util.Collections.singletonList; import static org.mockito.Matchers.anyBoolean; import static org.mockito.Matchers.anyString; import static org.mockito.Matchers.eq; import static org.mockito.Mockito.doAnswer; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.never; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.<API key>; import static org.mockito.Mockito.when; import static org.mockito.MockitoAnnotations.initMocks; import static org.motechproject.mds.testutil.FieldTestHelper.fieldDto; import static org.motechproject.mds.util.Constants.MetadataKeys.RELATED_CLASS; import static org.motechproject.mds.util.Constants.MetadataKeys.RELATED_FIELD; import static org.motechproject.mds.util.Constants.Util.<API key>; import static org.motechproject.mds.util.Constants.Util.<API key>; import static org.motechproject.mds.util.Constants.Util.<API key>; import static org.motechproject.mds.util.Constants.Util.CREATOR_FIELD_NAME; import static org.motechproject.mds.util.Constants.Util.DATANUCLEUS; import static org.motechproject.mds.util.Constants.Util.<API key>; import static org.motechproject.mds.util.Constants.Util.<API key>; import static org.motechproject.mds.util.Constants.Util.<API key>; import static org.motechproject.mds.util.Constants.Util.<API key>; import static org.motechproject.mds.util.Constants.Util.<API key>; import static org.motechproject.mds.util.Constants.Util.OWNER_FIELD_NAME; import static org.motechproject.mds.util.Constants.Util.VALUE_GENERATOR; @RunWith(PowerMockRunner.class) @PrepareForTest({MotechClassPool.class, FieldUtils.class}) public class <API key> { private static final String PACKAGE = "org.motechproject.mds.entity"; private static final String ENTITY_NAME = "Sample"; private static final String MODULE = "MrS"; private static final String NAMESPACE = "arrio"; private static final String TABLE_NAME = ""; private static final String CLASS_NAME = String.format("%s.%s", PACKAGE, ENTITY_NAME); private static final String TABLE_NAME_1 = String.format("MDS_%s", ENTITY_NAME).toUpperCase(); private static final String TABLE_NAME_2 = String.format("%s_%s", MODULE, ENTITY_NAME).toUpperCase(); private static final String TABLE_NAME_3 = String.format("%s_%s_%s", MODULE, NAMESPACE, ENTITY_NAME).toUpperCase(); private <API key> <API key> = new <API key>(); @Mock private EntityDto entity; @Mock private FieldDto idField; @Mock private JDOMetadata jdoMetadata; @Mock private PackageMetadata packageMetadata; @Mock private ClassMetadata classMetadata; @Mock private FieldMetadata idMetadata; @Mock private InheritanceMetadata inheritanceMetadata; @Mock private IndexMetadata indexMetadata; @Mock private SchemaHolder schemaHolder; @Before public void setUp() { initMocks(this); when(entity.getClassName()).thenReturn(CLASS_NAME); when(classMetadata.newFieldMetadata("id")).thenReturn(idMetadata); when(idMetadata.getName()).thenReturn("id"); when(classMetadata.<API key>()).thenReturn(inheritanceMetadata); when(schemaHolder.getFieldByName(entity, "id")).thenReturn(idField); when(entity.isBaseEntity()).thenReturn(true); } @Test public void <API key>() throws Exception { when(entity.getName()).thenReturn(ENTITY_NAME); when(entity.getModule()).thenReturn(MODULE); when(entity.getNamespace()).thenReturn(NAMESPACE); when(entity.getTableName()).thenReturn(TABLE_NAME); when(jdoMetadata.newPackageMetadata(PACKAGE)).thenReturn(packageMetadata); when(packageMetadata.newClassMetadata(ENTITY_NAME)).thenReturn(classMetadata); <API key>.addEntityMetadata(jdoMetadata, entity, Sample.class, schemaHolder); verify(jdoMetadata).newPackageMetadata(PACKAGE); verify(packageMetadata).newClassMetadata(ENTITY_NAME); verify(classMetadata).setTable(TABLE_NAME_3); <API key>(); } @Test public void <API key>() { when(entity.getName()).thenReturn(ENTITY_NAME); when(entity.getTableName()).thenReturn(TABLE_NAME); when(jdoMetadata.getPackages()).thenReturn(new PackageMetadata[]{packageMetadata}); when(packageMetadata.getName()).thenReturn(PACKAGE); when(packageMetadata.newClassMetadata(ENTITY_NAME)).thenReturn(classMetadata); <API key>.addEntityMetadata(jdoMetadata, entity, Sample.class, schemaHolder); verify(jdoMetadata, never()).newPackageMetadata(PACKAGE); verify(jdoMetadata).getPackages(); verify(packageMetadata).newClassMetadata(ENTITY_NAME); verify(classMetadata).setTable(TABLE_NAME_1); <API key>(); } @Test public void <API key>() throws Exception { when(entity.getName()).thenReturn(ENTITY_NAME); when(entity.getTableName()).thenReturn(TABLE_NAME); when(jdoMetadata.newPackageMetadata(anyString())).thenReturn(packageMetadata); when(packageMetadata.newClassMetadata(anyString())).thenReturn(classMetadata); <API key>.addEntityMetadata(jdoMetadata, entity, Sample.class, schemaHolder); verify(classMetadata).setTable(TABLE_NAME_1); when(entity.getModule()).thenReturn(MODULE); <API key>.addEntityMetadata(jdoMetadata, entity, Sample.class, schemaHolder); verify(classMetadata).setTable(TABLE_NAME_2); when(entity.getNamespace()).thenReturn(NAMESPACE); <API key>.addEntityMetadata(jdoMetadata, entity, Sample.class, schemaHolder); verify(classMetadata).setTable(TABLE_NAME_3); } @Test public void <API key>() throws Exception { CtField ctField = mock(CtField.class); CtClass ctClass = mock(CtClass.class); CtClass superClass = mock(CtClass.class); ClassData classData = mock(ClassData.class); ClassPool pool = mock(ClassPool.class); PowerMockito.mockStatic(MotechClassPool.class); PowerMockito.when(MotechClassPool.getDefault()).thenReturn(pool); when(classData.getClassName()).thenReturn(CLASS_NAME); when(classData.getModule()).thenReturn(MODULE); when(classData.getNamespace()).thenReturn(NAMESPACE); when(entity.getTableName()).thenReturn(TABLE_NAME); when(pool.getOrNull(CLASS_NAME)).thenReturn(ctClass); when(ctClass.getField("id")).thenReturn(ctField); when(ctClass.getSuperclass()).thenReturn(superClass); when(superClass.getName()).thenReturn(Object.class.getName()); when(jdoMetadata.newPackageMetadata(PACKAGE)).thenReturn(packageMetadata); when(packageMetadata.newClassMetadata(ENTITY_NAME)).thenReturn(classMetadata); <API key>.addBaseMetadata(jdoMetadata, classData, EntityType.STANDARD, Sample.class); verify(jdoMetadata).newPackageMetadata(PACKAGE); verify(packageMetadata).newClassMetadata(ENTITY_NAME); verify(classMetadata).setTable(TABLE_NAME_3); <API key>(); } @Test public void <API key>() { FieldDto oneToManyField = fieldDto("oneToManyName", <API key>.class); oneToManyField.addMetadata(new MetadataDto(RELATED_CLASS, "org.motechproject.test.MyClass")); FieldMetadata fmd = mock(FieldMetadata.class); CollectionMetadata collMd = mock(CollectionMetadata.class); when(entity.getName()).thenReturn(ENTITY_NAME); when(entity.getId()).thenReturn(2L); when(schemaHolder.getFields(entity)).thenReturn(singletonList(oneToManyField)); when(entity.getTableName()).thenReturn(TABLE_NAME); when(jdoMetadata.newPackageMetadata(PACKAGE)).thenReturn(packageMetadata); when(packageMetadata.newClassMetadata(ENTITY_NAME)).thenReturn(classMetadata); when(classMetadata.newFieldMetadata("oneToManyName")).thenReturn(fmd); when(fmd.<API key>()).thenReturn(collMd); when(fmd.getName()).thenReturn("oneToManyName"); <API key>.addEntityMetadata(jdoMetadata, entity, Sample.class, schemaHolder); <API key>(); verify(fmd).<API key>(true); verify(collMd).setEmbeddedElement(false); verify(collMd).<API key>(false); verify(collMd).setElementType("org.motechproject.test.MyClass"); } @Test public void <API key>() throws NotFoundException, <API key> { final String relClassName = "org.motechproject.test.MyClass"; final String relFieldName = "myField"; FieldDto oneToOneField = fieldDto("oneToOneName", <API key>.class); oneToOneField.addMetadata(new MetadataDto(RELATED_CLASS, relClassName)); oneToOneField.addMetadata(new MetadataDto(RELATED_FIELD, relFieldName)); FieldMetadata fmd = mock(FieldMetadata.class); when(fmd.getName()).thenReturn("oneToOneName"); ForeignKeyMetadata fkmd = mock(ForeignKeyMetadata.class); when(entity.getName()).thenReturn(ENTITY_NAME); when(entity.getId()).thenReturn(3L); when(schemaHolder.getFields(entity)).thenReturn(singletonList(oneToOneField)); when(entity.getTableName()).thenReturn(TABLE_NAME); when(jdoMetadata.newPackageMetadata(PACKAGE)).thenReturn(packageMetadata); when(packageMetadata.newClassMetadata(ENTITY_NAME)).thenReturn(classMetadata); when(classMetadata.newFieldMetadata("oneToOneName")).thenReturn(fmd); when(fmd.<API key>()).thenReturn(fkmd); /* We simulate configuration for the bi-directional relationship (the related class has got a field that links back to the main class) */ CtClass myClass = mock(CtClass.class); CtClass relatedClass = mock(CtClass.class); CtField myField = mock(CtField.class); CtField relatedField = mock(CtField.class); when(myClass.getName()).thenReturn(relClassName); when(myClass.getDeclaredFields()).thenReturn(new CtField[]{myField}); when(myField.getType()).thenReturn(relatedClass); when(myField.getName()).thenReturn(relFieldName); when(relatedClass.getDeclaredFields()).thenReturn(new CtField[]{relatedField}); when(relatedClass.getName()).thenReturn(CLASS_NAME); <API key>.addEntityMetadata(jdoMetadata, entity, Sample.class, schemaHolder); <API key>(); verify(fmd).<API key>(true); verify(fmd).<API key>(PersistenceModifier.PERSISTENT); verify(fkmd).setName("<API key>"); } @Test public void <API key>() throws Exception { FieldDto lookupField = fieldDto("lookupField", String.class); LookupDto lookup = new LookupDto(); lookup.setLookupName("A lookup"); lookup.setLookupFields(singletonList(new LookupFieldDto("lookupField", LookupFieldType.VALUE))); lookup.setIndexRequired(true); lookupField.setLookups(singletonList(lookup)); FieldMetadata fmd = mock(FieldMetadata.class); when(entity.getName()).thenReturn(ENTITY_NAME); when(entity.getId()).thenReturn(14L); when(schemaHolder.getFields(entity)).thenReturn(singletonList(lookupField)); when(entity.getTableName()).thenReturn(TABLE_NAME); when(jdoMetadata.newPackageMetadata(PACKAGE)).thenReturn(packageMetadata); when(packageMetadata.newClassMetadata(ENTITY_NAME)).thenReturn(classMetadata); when(classMetadata.newFieldMetadata("lookupField")).thenReturn(fmd); when(fmd.newIndexMetadata()).thenReturn(indexMetadata); PowerMockito.mockStatic(FieldUtils.class); when(FieldUtils.getDeclaredField(eq(Sample.class), anyString(), eq(true))).thenReturn(Sample.class.getDeclaredField("notInDefFg")); <API key>.addEntityMetadata(jdoMetadata, entity, Sample.class, schemaHolder); <API key>(); verify(fmd).newIndexMetadata(); verify(indexMetadata).setName("lkp_idx_" + ENTITY_NAME + "_lookupField_14"); } @Test public void <API key>() throws Exception { when(entity.getName()).thenReturn(ENTITY_NAME); when(entity.getTableName()).thenReturn(TABLE_NAME); when(jdoMetadata.newPackageMetadata(anyString())).thenReturn(packageMetadata); when(packageMetadata.newClassMetadata(anyString())).thenReturn(classMetadata); List<FieldDto> fields = new ArrayList<>(); // for these fields the appropriate generator should be added fields.add(fieldDto(1L, CREATOR_FIELD_NAME, String.class.getName(), <API key>, null)); fields.add(fieldDto(2L, OWNER_FIELD_NAME, String.class.getName(), <API key>, null)); fields.add(fieldDto(3L, <API key>, DateTime.class.getName(), <API key>, null)); fields.add(fieldDto(4L, <API key>, String.class.getName(), <API key>, null)); fields.add(fieldDto(5L, <API key>, DateTime.class.getName(), <API key>, null)); doReturn(fields).when(schemaHolder).getFields(CLASS_NAME); final List<FieldMetadata> list = new ArrayList<>(); doAnswer(new Answer() { @Override public Object answer(InvocationOnMock invocation) throws Throwable { // we create a mock ... FieldMetadata metadata = mock(FieldMetadata.class); // ... and it should return correct name doReturn(invocation.getArguments()[0]).when(metadata).getName(); // Because we want to check that appropriate methods was executed // we added metadata to list and later we will verify conditions list.add(metadata); // in the end we have to return the mock return metadata; } }).when(classMetadata).newFieldMetadata(anyString()); PowerMockito.mockStatic(FieldUtils.class); when(FieldUtils.getDeclaredField(eq(Sample.class), anyString(), eq(true))).thenReturn(Sample.class.getDeclaredField("notInDefFg")); <API key>.addEntityMetadata(jdoMetadata, entity, Sample.class, schemaHolder); for (FieldMetadata metadata : list) { String name = metadata.getName(); // the id field should not have set object value generator metadata int invocations = "id".equalsIgnoreCase(name) ? 0 : 1; verify(classMetadata).newFieldMetadata(name); verify(metadata, times(invocations)).<API key>(PersistenceModifier.PERSISTENT); verify(metadata, times(invocations)).<API key>(true); verify(metadata, times(invocations)).<API key>(DATANUCLEUS, VALUE_GENERATOR, "ovg." + name); } } @Test public void <API key>() { when(entity.getName()).thenReturn(ENTITY_NAME); when(entity.getTableName()).thenReturn(TABLE_NAME); when(jdoMetadata.newPackageMetadata(anyString())).thenReturn(packageMetadata); when(packageMetadata.newClassMetadata(anyString())).thenReturn(classMetadata); <API key>.addEntityMetadata(jdoMetadata, entity, AnotherSample.class, schemaHolder); <API key>(inheritanceMetadata); } @Test public void <API key>() { when(entity.getName()).thenReturn(ENTITY_NAME); when(entity.getTableName()).thenReturn(TABLE_NAME); when(jdoMetadata.newPackageMetadata(anyString())).thenReturn(packageMetadata); when(packageMetadata.newClassMetadata(anyString())).thenReturn(classMetadata); FieldDto field = fieldDto("notInDefFg", <API key>.class); when(schemaHolder.getFields(CLASS_NAME)).thenReturn(singletonList(field)); FieldMetadata fmd = mock(FieldMetadata.class); when(fmd.getName()).thenReturn("notInDefFg"); when(classMetadata.newFieldMetadata("notInDefFg")).thenReturn(fmd); <API key>.addEntityMetadata(jdoMetadata, entity, Sample.class, schemaHolder); verify(fmd, never()).<API key>(anyBoolean()); } @Test public void <API key>() { when(entity.getName()).thenReturn(ENTITY_NAME); when(jdoMetadata.newPackageMetadata(anyString())).thenReturn(packageMetadata); when(packageMetadata.newClassMetadata(anyString())).thenReturn(classMetadata); FieldDto eudeField = mock(FieldDto.class); FieldBasicDto eudeBasic = mock(FieldBasicDto.class); when(eudeField.getBasic()).thenReturn(eudeBasic); when(eudeBasic.getName()).thenReturn("uniqueField"); when(eudeField.isReadOnly()).thenReturn(false); when(eudeBasic.isUnique()).thenReturn(true); when(eudeField.getType()).thenReturn(TypeDto.STRING); FieldDto ddeField = mock(FieldDto.class); FieldBasicDto ddeBasic = mock(FieldBasicDto.class); when(ddeField.getBasic()).thenReturn(ddeBasic); when(ddeBasic.getName()).thenReturn("uniqueField2"); when(ddeField.isReadOnly()).thenReturn(true); when(ddeBasic.isUnique()).thenReturn(true); when(ddeField.getType()).thenReturn(TypeDto.STRING); when(schemaHolder.getFields(entity)).thenReturn(asList(ddeField, eudeField)); FieldMetadata fmdEude = mock(FieldMetadata.class); when(fmdEude.getName()).thenReturn("uniqueField"); when(classMetadata.newFieldMetadata("uniqueField")).thenReturn(fmdEude); FieldMetadata fmdDde = mock(FieldMetadata.class); when(fmdDde.getName()).thenReturn("uniqueField2"); when(classMetadata.newFieldMetadata("uniqueField2")).thenReturn(fmdDde); UniqueMetadata umd = mock(UniqueMetadata.class); when(fmdEude.newUniqueMetadata()).thenReturn(umd); <API key>.addEntityMetadata(jdoMetadata, entity, Sample.class, schemaHolder); verify(fmdDde, never()).newUniqueMetadata(); verify(fmdDde, never()).setUnique(anyBoolean()); verify(fmdEude).newUniqueMetadata(); verify(umd).setName("<API key>"); } @Test public void <API key>() { when(entity.getName()).thenReturn(ENTITY_NAME); when(entity.getModule()).thenReturn(MODULE); when(entity.getNamespace()).thenReturn(NAMESPACE); when(entity.getTableName()).thenReturn(TABLE_NAME); when(jdoMetadata.newPackageMetadata(PACKAGE)).thenReturn(packageMetadata); when(packageMetadata.newClassMetadata(ENTITY_NAME)).thenReturn(classMetadata); <API key>.addEntityMetadata(jdoMetadata, entity, <API key>.class, schemaHolder); verify(jdoMetadata).newPackageMetadata(PACKAGE); verify(packageMetadata).newClassMetadata(ENTITY_NAME); verify(classMetadata).setTable(TABLE_NAME_3); <API key>(IdGeneratorStrategy.INCREMENT); } private void <API key>() { <API key>(IdGeneratorStrategy.NATIVE); } private void <API key>(IdGeneratorStrategy expextedStrategy) { verify(classMetadata).setDetachable(true); verify(classMetadata).setIdentityType(IdentityType.APPLICATION); verify(classMetadata).<API key>(<API key>.PERSISTENCE_CAPABLE); verify(idMetadata).setPrimaryKey(true); verify(idMetadata).setValueStrategy(expextedStrategy); verify(inheritanceMetadata).setCustomStrategy("complete-table"); } }
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Variable = void 0; const VariableBase_1 = require("./VariableBase"); /** * A Variable represents a locally scoped identifier. These include arguments to functions. */ class Variable extends VariableBase_1.VariableBase { /** * `true` if the variable is valid in a type context, false otherwise * @public */ get isTypeVariable() { if (this.defs.length === 0) { // we don't statically know whether this is a type or a value return true; } return this.defs.some(def => def.isTypeDefinition); } /** * `true` if the variable is valid in a value context, false otherwise * @public */ get isValueVariable() { if (this.defs.length === 0) { // we don't statically know whether this is a type or a value return true; } return this.defs.some(def => def.<API key>); } } exports.Variable = Variable; //# sourceMappingURL=Variable.js.map
#ifndef CanvasGradient_h #define CanvasGradient_h #include "bindings/core/v8/ScriptWrappable.h" #include "platform/graphics/Gradient.h" #include "platform/heap/Handle.h" #include "wtf/Forward.h" #include "wtf/PassRefPtr.h" #include "wtf/RefCounted.h" namespace blink { class ExceptionState; class CanvasGradient final : public <API key><CanvasGradient>, public ScriptWrappable { <API key>(); public: static <API key><CanvasGradient> create(const FloatPoint& p0, const FloatPoint& p1) { return adoptRefWillBeNoop(new CanvasGradient(p0, p1)); } static <API key><CanvasGradient> create(const FloatPoint& p0, float r0, const FloatPoint& p1, float r1) { return adoptRefWillBeNoop(new CanvasGradient(p0, r0, p1, r1)); } Gradient* gradient() const { return m_gradient.get(); } void addColorStop(float value, const String& color, ExceptionState&); void trace(Visitor*) { } private: CanvasGradient(const FloatPoint& p0, const FloatPoint& p1); CanvasGradient(const FloatPoint& p0, float r0, const FloatPoint& p1, float r1); RefPtr<Gradient> m_gradient; }; } // namespace blink #endif // CanvasGradient_h
#include "test_utils/ANGLETest.h" using namespace angle; class MaxTextureSizeTest : public ANGLETest { protected: MaxTextureSizeTest() { setWindowWidth(512); setWindowHeight(512); setConfigRedBits(8); setConfigGreenBits(8); setConfigBlueBits(8); setConfigAlphaBits(8); } virtual void SetUp() { ANGLETest::SetUp(); const std::string vsSource = SHADER_SOURCE ( precision highp float; attribute vec4 position; varying vec2 texcoord; void main() { gl_Position = position; texcoord = (position.xy * 0.5) + 0.5; } ); const std::string textureFSSource = SHADER_SOURCE ( precision highp float; uniform sampler2D tex; varying vec2 texcoord; void main() { gl_FragColor = texture2D(tex, texcoord); } ); const std::string blueFSSource = SHADER_SOURCE ( precision highp float; void main() { gl_FragColor = vec4(0.0, 0.0, 1.0, 1.0); } ); mTextureProgram = CompileProgram(vsSource, textureFSSource); mBlueProgram = CompileProgram(vsSource, blueFSSource); if (mTextureProgram == 0 || mBlueProgram == 0) { FAIL() << "shader compilation failed."; } <API key> = <API key>(mTextureProgram, "tex"); glGetIntegerv(GL_MAX_TEXTURE_SIZE, &mMaxTexture2DSize); glGetIntegerv(<API key>, &mMaxTextureCubeSize); glGetIntegerv(<API key>, &<API key>); ASSERT_GL_NO_ERROR(); } virtual void TearDown() { glDeleteProgram(mTextureProgram); glDeleteProgram(mBlueProgram); ANGLETest::TearDown(); } GLuint mTextureProgram; GLint <API key>; GLuint mBlueProgram; GLint mMaxTexture2DSize; GLint mMaxTextureCubeSize; GLint <API key>; }; TEST_P(MaxTextureSizeTest, <API key>) { GLuint tex; glGenTextures(1, &tex); glBindTexture(GL_TEXTURE_2D, tex); glTexParameteri(GL_TEXTURE_2D, <API key>, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, <API key>, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); GLsizei textureWidth = mMaxTexture2DSize; GLsizei textureHeight = 64; std::vector<GLubyte> data(textureWidth * textureHeight * 4); for (int y = 0; y < textureHeight; y++) { for (int x = 0; x < textureWidth; x++) { GLubyte* pixel = &data[0] + ((y * textureWidth + x) * 4); // Draw a gradient, red in direction, green in y direction pixel[0] = static_cast<GLubyte>((float(x) / textureWidth) * 255); pixel[1] = static_cast<GLubyte>((float(y) / textureHeight) * 255); pixel[2] = 0; pixel[3] = 255; } } glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, textureWidth, textureHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, &data[0]); EXPECT_GL_NO_ERROR(); glUseProgram(mTextureProgram); glUniform1i(<API key>, 0); drawQuad(mTextureProgram, "position", 0.5f); std::vector<GLubyte> pixels(getWindowWidth() * getWindowHeight() * 4); glReadPixels(0, 0, getWindowWidth(), getWindowHeight(), GL_RGBA, GL_UNSIGNED_BYTE, &pixels[0]); for (int y = 1; y < getWindowHeight(); y++) { for (int x = 1; x < getWindowWidth(); x++) { const GLubyte* prevPixel = &pixels[0] + (((y - 1) * getWindowWidth() + (x - 1)) * 4); const GLubyte* curPixel = &pixels[0] + ((y * getWindowWidth() + x) * 4); EXPECT_GE(curPixel[0], prevPixel[0]); EXPECT_GE(curPixel[1], prevPixel[1]); EXPECT_EQ(curPixel[2], prevPixel[2]); EXPECT_EQ(curPixel[3], prevPixel[3]); } } } TEST_P(MaxTextureSizeTest, <API key>) { if (getClientVersion() < 3 && (!extensionEnabled("<API key>") || !extensionEnabled("GL_OES_rgb8_rgba8"))) { return; } GLuint tex; glGenTextures(1, &tex); glBindTexture(GL_TEXTURE_2D, tex); glTexParameteri(GL_TEXTURE_2D, <API key>, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, <API key>, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); GLsizei textureWidth = 64; GLsizei textureHeight = mMaxTexture2DSize; std::vector<GLubyte> data(textureWidth * textureHeight * 4); for (int y = 0; y < textureHeight; y++) { for (int x = 0; x < textureWidth; x++) { GLubyte* pixel = &data[0] + ((y * textureWidth + x) * 4); // Draw a gradient, red in direction, green in y direction pixel[0] = static_cast<GLubyte>((float(x) / textureWidth) * 255); pixel[1] = static_cast<GLubyte>((float(y) / textureHeight) * 255); pixel[2] = 0; pixel[3] = 255; } } if (getClientVersion() < 3) { glTexStorage2DEXT(GL_TEXTURE_2D, 1, GL_RGBA8_OES, textureWidth, textureHeight); } else { glTexStorage2D(GL_TEXTURE_2D, 1, GL_RGBA8_OES, textureWidth, textureHeight); } EXPECT_GL_NO_ERROR(); glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, textureWidth, textureHeight, GL_RGBA, GL_UNSIGNED_BYTE, &data[0]); EXPECT_GL_NO_ERROR(); glUseProgram(mTextureProgram); glUniform1i(<API key>, 0); drawQuad(mTextureProgram, "position", 0.5f); std::vector<GLubyte> pixels(getWindowWidth() * getWindowHeight() * 4); glReadPixels(0, 0, getWindowWidth(), getWindowHeight(), GL_RGBA, GL_UNSIGNED_BYTE, &pixels[0]); for (int y = 1; y < getWindowHeight(); y++) { for (int x = 1; x < getWindowWidth(); x++) { const GLubyte* prevPixel = &pixels[0] + (((y - 1) * getWindowWidth() + (x - 1)) * 4); const GLubyte* curPixel = &pixels[0] + ((y * getWindowWidth() + x) * 4); EXPECT_GE(curPixel[0], prevPixel[0]); EXPECT_GE(curPixel[1], prevPixel[1]); EXPECT_EQ(curPixel[2], prevPixel[2]); EXPECT_EQ(curPixel[3], prevPixel[3]); } } } TEST_P(MaxTextureSizeTest, RenderToTexture) { if (getClientVersion() < 3 && (!extensionEnabled("<API key>"))) { std::cout << "Test skipped due to missing glBlitFramebuffer[ANGLE] support." << std::endl; return; } GLuint fbo = 0; GLuint textureId = 0; // create a 1-level texture at maximum size glGenTextures(1, &textureId); glBindTexture(GL_TEXTURE_2D, textureId); GLsizei textureWidth = 64; GLsizei textureHeight = mMaxTexture2DSize; // texture setup code glTexParameteri(GL_TEXTURE_2D, <API key>, <API key>); glTexParameteri(GL_TEXTURE_2D, <API key>, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); glTexImage2D(GL_TEXTURE_2D, 0, GL_BGRA_EXT, textureWidth, textureHeight, 0, GL_BGRA_EXT, GL_UNSIGNED_BYTE, NULL); EXPECT_GL_NO_ERROR(); // create an FBO and attach the texture glGenFramebuffers(1, &fbo); glBindFramebuffer(GL_FRAMEBUFFER, fbo); <API key>(GL_FRAMEBUFFER, <API key>, GL_TEXTURE_2D, textureId, 0); EXPECT_GL_NO_ERROR(); EXPECT_GLENUM_EQ(<API key>, <API key>(GL_FRAMEBUFFER)); const int frameCount = 64; for (int i = 0; i < frameCount; i++) { // clear the screen glBindFramebuffer(GL_FRAMEBUFFER, 0); GLubyte clearRed = static_cast<GLubyte>((float(i) / frameCount) * 255); GLubyte clearGreen = 255 - clearRed; GLubyte clearBlue = 0; glClearColor(clearRed / 255.0f, clearGreen / 255.0f, clearBlue / 255.0f, 1.0f); glClear(GL_COLOR_BUFFER_BIT); // render blue into the texture glBindFramebuffer(GL_FRAMEBUFFER, fbo); drawQuad(mBlueProgram, "position", 0.5f); // copy corner of texture to LL corner of window glBindFramebuffer(<API key>, 0); glBindFramebuffer(<API key>, fbo); <API key>(0, 0, textureWidth - 1, getWindowHeight() - 1, 0, 0, textureWidth - 1, getWindowHeight() - 1, GL_COLOR_BUFFER_BIT, GL_NEAREST); glBindFramebuffer(<API key>, 0); EXPECT_GL_NO_ERROR(); EXPECT_PIXEL_EQ(textureWidth / 2, getWindowHeight() / 2, 0, 0, 255, 255); EXPECT_PIXEL_EQ(textureWidth + 10, getWindowHeight() / 2, clearRed, clearGreen, clearBlue, 255); swapBuffers(); } glBindFramebuffer(GL_FRAMEBUFFER, 0); glBindTexture(GL_TEXTURE_2D, 0); <API key>(1, &fbo); glDeleteTextures(1, &textureId); } // Use this to select which configurations (e.g. which renderer, which GLES major version) these tests should be run against. <API key>(MaxTextureSizeTest, ES2_D3D9(), ES2_D3D11(), ES2_D3D11_FL9_3());
#pragma once namespace stm32plus { namespace usb { /** * Template base class for USB CDC devices. The usual control endpoint 0 is inherited * as is the mandatory IN interrupt endpoint for notifications to the host at address 1. * Subclasses should provide the endpoints they require in the features list. e.g. bulk * IN/OUT endpoints. * * @tparam TPhy the PHY implementation * @tparam <API key> A structure that holds the complete config descriptor * @tparam Features... The device feature classes */ template<class TPhy> using <API key>=<API key><2,Device<TPhy>>; template<class TPhy,class <API key>,template <class> class... Features> class CdcDevice : public Device<TPhy>, public <API key><Device<TPhy>>, public <API key><TPhy>, public Features<Device<TPhy>>... { public: /* * Parameters for the CDC device */ struct Parameters : Device<TPhy>::Parameters, <API key><Device<TPhy>>::Parameters, <API key><TPhy>::Parameters, Features<Device<TPhy>>::Parameters... { uint8_t <API key>; // default is 16ms uint8_t cdc_cmd_buffer_size; // default is 16 bytes uint8_t <API key>; // default is 16 bytes Parameters() { <API key>=16; cdc_cmd_buffer_size=16; <API key>=16; } }; protected: enum { COMMAND_EP_ADDRESS = EndpointDescriptor::IN | 2 // command endpoint address }; <API key> <API key>; CdcControlCommand _opCode; uint8_t _commandSize; scoped_array<uint8_t> _commandBuffer; protected: void onEvent(UsbEventDescriptor& event); void onCdcSetup(<API key>& event); public: CdcDevice(); ~CdcDevice(); bool initialise(Parameters& params); }; /** * Constructor */ template<class TPhy,class <API key>,template <class> class... Features> inline CdcDevice<TPhy,<API key>,Features...>::CdcDevice() : <API key><Device<TPhy>>(static_cast<Device<TPhy>&>(*this)), <API key><TPhy>(static_cast<Device<TPhy>&>(*this)), Features<Device<TPhy>>(static_cast<Device<TPhy>&>(*this))... { // subscribe to USB events this->UsbEventSender.insertSubscriber( UsbEventSourceSlot::bind(this,&CdcDevice<TPhy,<API key>,Features...>::onEvent) ); } /** * Destructor */ template<class TPhy,class <API key>,template <class> class... Features> inline CdcDevice<TPhy,<API key>,Features...>::~CdcDevice() { // unsubscribe from USB events this->UsbEventSender.removeSubscriber( UsbEventSourceSlot::bind(this,&CdcDevice<TPhy,<API key>,Features...>::onEvent) ); } /** * Initialise the class * @param params The parameters class * @return true if it worked */ template<class TPhy,class <API key>,template <class> class... Features> inline bool CdcDevice<TPhy,<API key>,Features...>::initialise(Parameters& params) { // initialise upwards if(!Device<TPhy>::initialise(params) || !<API key><Device<TPhy>>::initialise(params) || !<API key><TPhy>::initialise(params) || !<API key><CdcDevice,Features<Device<TPhy>>...>::tinit(this,params)) return false; // create the command buffer _commandBuffer.reset(new uint8_t[params.cdc_cmd_buffer_size]); // set up the command endpoint descriptor <API key>.commandEndpoint.bEndpointAddress=COMMAND_EP_ADDRESS; <API key>.commandEndpoint.bmAttributes=EndpointDescriptor::INTERRUPT; <API key>.commandEndpoint.wMaxPacketSize=params.<API key>; <API key>.commandEndpoint.bInterval=params.<API key>; // default is 16ms // link UsbEventSource class into the SDK structure USBD_RegisterClass(&this->_deviceHandle,static_cast<UsbEventSource *>(this)); return true; } /** * Event handler for device events * @param event The event descriptor */ template<class TPhy,class <API key>,template <class> class... Features> __attribute__((noinline)) inline void CdcDevice<TPhy,<API key>,Features...>::onEvent(UsbEventDescriptor& event) { // check for handled events switch(event.eventType) { case UsbEventDescriptor::EventType::CLASS_INIT: USBD_LL_OpenEP(&this->_deviceHandle,COMMAND_EP_ADDRESS,EndpointDescriptor::INTERRUPT,<API key>.commandEndpoint.wMaxPacketSize); break; case UsbEventDescriptor::EventType::CLASS_DEINIT: USBD_LL_CloseEP(&this->_deviceHandle,COMMAND_EP_ADDRESS); break; case UsbEventDescriptor::EventType::CLASS_SETUP: onCdcSetup(static_cast<<API key>&>(event)); break; default: break; } } /** * Handle the CDC setup requests * @param event the event containg value being requested */ template<class TPhy,class <API key>,template <class> class... Features> inline void CdcDevice<TPhy,<API key>,Features...>::onCdcSetup(<API key>& event) { // interested in class requests if((event.request.bmRequest & USB_REQ_TYPE_MASK)!=USB_REQ_TYPE_CLASS) return; if(event.request.wLength) { if((event.request.bmRequest & 0x80)!=0) { // raise the control event - this one requires a response this->UsbEventSender.raiseEvent( CdcControlEvent(static_cast<CdcControlCommand>(event.request.bRequest), _commandBuffer.get(), event.request.wLength) ); // send the response message on the control endpoint USBD_CtlSendData(&this->_deviceHandle,_commandBuffer.get(),event.request.wLength); } else { // there is incoming data associated with this _opCode=static_cast<CdcControlCommand>(event.request.bRequest); _commandSize=event.request.wLength; USBD_CtlPrepareRx(&this->_deviceHandle,_commandBuffer.get(),_commandSize); } } else { // raise the control event - no response is expected this->UsbEventSender.raiseEvent( CdcControlEvent( static_cast<CdcControlCommand>(event.request.bRequest), nullptr, 0)); } } } }
#ifndef TextCodec_h #define TextCodec_h #include "wtf/Forward.h" #include "wtf/Noncopyable.h" #include "wtf/PassOwnPtr.h" #include "wtf/text/WTFString.h" #include "wtf/unicode/Unicode.h" namespace WTF { class TextEncoding; // Specifies what will happen when a character is encountered that is // not encodable in the character set. enum UnencodableHandling { // Substitutes the replacement character "?". <API key>, // Encodes the character as an XML entity. For example, U+06DE // would be "&#1758;" (0x6DE = 1758 in octal). <API key>, // Encodes the character as en entity as above, but escaped // non-alphanumeric characters. This is used in URLs. // For example, U+6DE would be "%26%231758%3B". <API key> }; typedef char <API key>[32]; enum FlushBehavior { // More bytes are coming, don't flush the codec. DoNotFlush = 0, // A fetch has hit EOF. Some codecs handle fetches differently, for compat reasons. FetchEOF, // Do a full flush of the codec. DataEOF }; static_assert(!DoNotFlush, "DoNotFlush should be falsy"); static_assert(FetchEOF, "FetchEOF should be truthy"); static_assert(DataEOF, "DataEOF should be truthy"); class TextCodec { <API key>(TextCodec); <API key>; public: TextCodec() { } virtual ~TextCodec(); String decode(const char* str, size_t length, FlushBehavior flush = DoNotFlush) { bool ignored; return decode(str, length, flush, false, ignored); } virtual String decode(const char*, size_t length, FlushBehavior, bool stopOnError, bool& sawError) = 0; virtual CString encode(const UChar*, size_t length, UnencodableHandling) = 0; virtual CString encode(const LChar*, size_t length, UnencodableHandling) = 0; // Fills a null-terminated string representation of the given // unencodable character into the given replacement buffer. // The length of the string (not including the null) will be returned. static int <API key>(unsigned codePoint, UnencodableHandling, <API key>); }; typedef void (*<API key>)(const char* alias, const char* name); typedef PassOwnPtr<TextCodec> (*<API key>)(const TextEncoding&, const void* additionalData); typedef void (*TextCodecRegistrar)(const char* name, <API key>, const void* additionalData); } // namespace WTF using WTF::TextCodec; #endif // TextCodec_h
module StrategoAST2(module AST) where import StrategoPattern as AST import StrategoTerm as AST import StrategoType as AST import StrategoProp as AST import StrategoDecl as AST
# class generated by DeVIDE::<API key> from module_kits.vtk_kit.mixins import <API key> import vtk class <API key>(<API key>): def __init__(self, module_manager): <API key>.__init__( self, module_manager, vtk.<API key>(), 'Processing.', ('vtkPolyData',), ('vtkPolyData',), replaceDoc=True, inputFunctions=None, outputFunctions=None)
from telemetry.internal.app import possible_app class PossibleBrowser(possible_app.PossibleApp): """A browser that can be controlled. Call Create() to launch the browser and begin manipulating it.. """ def __init__(self, browser_type, target_os, <API key>): super(PossibleBrowser, self).__init__(app_type=browser_type, target_os=target_os) self.<API key> = <API key> self._credentials_path = None def __repr__(self): return 'PossibleBrowser(app_type=%s)' % self.app_type @property def browser_type(self): return self.app_type @property def <API key>(self): return self.<API key> def <API key>(self): raise NotImplementedError() def Create(self, finder_options): raise NotImplementedError() def SupportsOptions(self, browser_options): """Tests for extension support.""" raise NotImplementedError() def IsRemote(self): return False def RunRemote(self): pass def <API key>(self): pass def <API key>(self): return -1 def SetCredentialsPath(self, credentials_path): self._credentials_path = credentials_path
#ifndef <API key> #define <API key> #include <string> #include <vector> #include "base/macros.h" #include "base/memory/linked_ptr.h" namespace gfx { class Display; class Screen; } namespace extensions { namespace api { namespace system_display { struct DisplayProperties; struct DisplayUnitInfo; } } typedef std::vector<linked_ptr<api::system_display::DisplayUnitInfo>> DisplayInfo; class DisplayInfoProvider { public: virtual ~DisplayInfoProvider(); // Returns a pointer to DisplayInfoProvider or NULL if Create() // or <API key>() or not called yet. static DisplayInfoProvider* Get(); // This is for tests that run in its own process (e.g. browser_tests). // Using this in other tests (e.g. unit_tests) will result in DCHECK failure. static void <API key>(DisplayInfoProvider* <API key>); // Updates the display with |display_id| according to |info|. Returns whether // the display was successfully updated. On failure, no display parameters // should be changed, and |error| should be set to the error string. virtual bool SetInfo(const std::string& display_id, const api::system_display::DisplayProperties& info, std::string* error) = 0; // Get the screen that is always active, which will be used for monitoring // display changes events. virtual gfx::Screen* GetActiveScreen() = 0; // Enable the unified desktop feature. virtual void <API key>(bool enable); DisplayInfo GetAllDisplaysInfo(); protected: DisplayInfoProvider(); private: static DisplayInfoProvider* Create(); // Update the content of the |unit| obtained for |display| using // platform specific method. virtual void <API key>( const gfx::Display& display, api::system_display::DisplayUnitInfo* unit) = 0; <API key>(DisplayInfoProvider); }; } // namespace extensions #endif // <API key>
#!/usr/bin/env python """Implements a standard mechanism for Chrome Infra Python environment setup. This library provides a central location to define Chrome Infra environment setup. It also provides several faculties to install this environment. Within a cooperating script, the environment can be setup by importing this module and running its 'Install' method: # Install Chrome-Infra environment (replaces 'sys.path'). sys.path.insert(0, os.path.join(os.path.dirname(__file__), os.pardir, ...)) # (/path/to/build/scripts) import common.env common.env.Install() When attempting to export the Chrome Infra path to external scripts, this script can be invoked as an executable with various subcommands to emit a valid PYTHONPATH clause. In addition, this module has several functions to construct the path. The goal is to deploy this module universally among Chrome-Infra scripts, BuildBot configurations, tool invocations, and tests to ensure that they all execute with the same centrally-defined environment. """ import argparse import collections import contextlib import imp import itertools import os import sys import traceback # Export for bootstrapping. __all__ = [ 'Install', 'PythonPath', ] # Name of enviornment extension file to seek. ENV_EXTENSION_NAME = 'environment.cfg.py' # Standard directories (based on this file's location in the <build> tree). def path_if(*args): if not all(args): return None path = os.path.abspath(os.path.join(*args)) return (path) if os.path.exists(path) else (None) # The path to the <build> directory in which this script resides. Build = path_if(os.path.dirname(__file__), os.pardir, os.pardir) # The path to the <build_internal> directory. BuildInternal = path_if(Build, os.pardir, 'build_internal') def SetPythonPathEnv(value): """Sets the system's PYTHONPATH environemnt variable. Args: value (str): The value to use. If this is empty/None, the system's PYTHONPATH will be cleared. """ # Since we can't assign None to the environment "dictionary", we have to # either set or delete the key depending on the original value. if value is not None: os.environ['PYTHONPATH'] = str(value) else: os.environ.pop('PYTHONPATH', None) def Install(**kwargs): """Replaces the current 'sys.path' with a hermetic Chrome-Infra path. Args: kwargs (dict): See GetInfraPythonPath arguments. Returns (PythonPath): The PythonPath object that was installed. """ infra_python_path = GetInfraPythonPath(**kwargs) infra_python_path.Install() return infra_python_path def SplitPath(path): """Returns (list): A list of path elements. Splits a path into path elements. For example (assuming '/' is the local system path separator): print SplitPath('/a/b/c/d') ['/', 'a', 'b', 'c', 'd'] print SplitPath('a/b/c') ['a', 'b,' 'c'] """ parts = [] while True: path, component = os.path.split(path) if not component: if path: parts.append(path) break parts.append(component) parts.reverse() return parts def ExtendPath(base, root_dir): """Returns (PythonPath): The extended python path. This method looks for the ENV_EXTENSION_NAME file within "root_dir". If present, it will be loaded as a Python module and have its "Extend" method called. If no extension is found, the base PythonPath will be returned. Args: base (PythonPath): The base python path. root_dir (str): The path to check for an extension. """ extension_path = os.path.join(root_dir, ENV_EXTENSION_NAME) if not os.path.isfile(extension_path): return base with open(extension_path, 'r') as fd: extension = fd.read() extension_module = imp.new_module('env-extension') # Execute the enviornment extension. try: exec extension in extension_module.__dict__ extend_func = getattr(extension_module, 'Extend', None) assert extend_func, ( "The environment extension module is missing the 'Extend()' method.") base = extend_func(base, root_dir) if not isinstance(base, PythonPath): raise TypeError("Extension module returned non-PythonPath object (%s)" % ( type(base).__name__,)) except Exception: # Re-raise the exception, but include the configuration file name. tb = traceback.format_exc() raise RuntimeError("Environment extension [%s] raised exception: %s" % ( extension_path, tb)) return base def IsSystemPythonPath(path): """Returns (bool): If a python path is user-installed. Paths that are known to be user-installed paths can be ignored when setting up a hermetic Python path environment to avoid user libraries that would not be present in other environments falsely affecting code. This function can be updated as-needed to exclude other non-system paths encountered on bots and in the wild. """ components = SplitPath(path) for component in components: if component in ('dist-packages', 'site-packages'): return False return True class PythonPath(collections.Sequence): """An immutable set of Python path elements. All paths represented in this structure are absolute. If a relative path is passed into this structure, it will be converted to absolute based on the current working directory (via os.path.abspath). """ def __init__(self, components=None): """Initializes a new PythonPath instance. Args: components (list): A list of path component strings. """ seen = set() self._components = [] for component in (components or ()): component = os.path.abspath(component) assert isinstance(component, basestring), ( "Path component '%s' is not a string (%s)" % ( component, type(component).__name__)) if component in seen: continue seen.add(component) self._components.append(component) def __getitem__(self, value): return self._components[value] def __len__(self): return len(self._components) def __iadd__(self, other): return self.Append(other) def __repr__(self): return self.pathstr def __eq__(self, other): assert isinstance(other, type(self)) return self._components == other._components @classmethod def Flatten(cls, *paths): """Returns (list): A single-level list containing flattened path elements. print PythonPath.Flatten('a', ['b', ['c', 'd']]) ['a', 'b', 'c', 'd'] """ result = [] for path in paths: if not isinstance(path, basestring): # Assume it's an iterable of paths. result += cls.Flatten(*path) else: result.append(path) return result @classmethod def FromPaths(cls, *paths): """Returns (PythonPath): A PythonPath instantiated from path elements. Args: paths (tuple): A tuple of path elements or iterables containing path elements (e.g., PythonPath instances). """ return cls(cls.Flatten(*paths)) @classmethod def FromPathStr(cls, pathstr): """Returns (PythonPath): A PythonPath instantiated from the path string. Args: pathstr (str): An os.pathsep()-delimited path string. """ return cls(pathstr.split(os.pathsep)) @property def pathstr(self): """Returns (str): A path string for the instance's path elements.""" return os.pathsep.join(self) def IsHermetic(self): """Returns (bool): True if this instance contains only system paths.""" return all(IsSystemPythonPath(p) for p in self) def GetHermetic(self): """Returns (PythonPath): derivative PythonPath containing only system paths. """ return type(self).FromPaths(*(p for p in self if IsSystemPythonPath(p))) def Append(self, *paths): """Returns (PythonPath): derivative PythonPath with paths added to the end. Args: paths (tuple): A tuple of path elements to append to the current instance. """ return type(self)(itertools.chain(self, self.FromPaths(*paths))) def Override(self, *paths): """Returns (PythonPath): derivative PythonPath with paths prepended. Args: paths (tuple): A tuple of path elements to prepend to the current instance. """ return self.FromPaths(*paths).Append(self) def Install(self): """Overwrites Python runtime variables based on the current instance. Performs the following operations: - Replaces sys.path with the current instance's path. - Replaces os.environ['PYTHONPATH'] with the current instance's path string. """ sys.path = list(self) SetPythonPathEnv(self.pathstr) @contextlib.contextmanager def Enter(self): """Context manager wrapper for Install. On exit, the context manager will restore the original environment. """ orig_sys_path = sys.path[:] orig_pythonpath = os.environ.get('PYTHONPATH') try: self.Install() yield finally: sys.path = orig_sys_path SetPythonPathEnv(orig_pythonpath) def GetSysPythonPath(hermetic=True): """Returns (PythonPath): A path based on 'sys.path'. Args: hermetic (bool): If True, prune any non-system path. """ path = PythonPath.FromPaths(*sys.path) if hermetic: path = path.GetHermetic() return path def GetEnvPythonPath(): """Returns (PythonPath): A path based on the PYTHONPATH environment variable. """ pythonpath = os.environ.get('PYTHONPATH') if not pythonpath: return PythonPath.FromPaths() return PythonPath.FromPathStr(pythonpath) def GetMasterPythonPath(master_dir): """Returns (PythonPath): A path including a BuildBot master's directory. Args: master_dir (str): The BuildBot master root directory. """ return PythonPath.FromPaths(master_dir) def GetBuildPythonPath(): """Returns (PythonPath): The Chrome Infra build path.""" build_path = PythonPath.FromPaths() for extension_dir in ( Build, BuildInternal, ): if extension_dir: build_path = ExtendPath(build_path, extension_dir) return build_path def GetInfraPythonPath(hermetic=True, master_dir=None): """Returns (PythonPath): The full working Chrome Infra utility path. This path is consistent for master, slave, and tool usage. It includes (in this order): - Any environment PYTHONPATH overrides. - If 'master_dir' is supplied, the master's python path component. - The Chrome Infra build path. - The system python path. Args: hermetic (bool): True, prune any non-system path from the system path. master_dir (str): If not None, include a master path component. """ path = GetEnvPythonPath() if master_dir: path += GetMasterPythonPath(master_dir) path += GetBuildPythonPath() path += GetSysPythonPath(hermetic=hermetic) return path def _InfraPathFromArgs(args): """Returns (PythonPath): A PythonPath populated from command-line arguments. Args: args (argparse.Namespace): The command-line arguments constructed by 'main'. """ return GetInfraPythonPath( master_dir=args.master_dir, ) def _Command_Echo(args, path): """Returns (int): Return code. Command function for the 'echo' subcommand. Outputs the path string for 'path'. Args: args (argparse.Namespace): The command-line arguments constructed by 'main'. path (PythonPath): The python path to use. """ args.output.write(path.pathstr) return 0 def _Command_Print(args, path): """Returns (int): Return code. Command function for the 'print' subcommand. Outputs each path component in path on a separate line. Args: args (argparse.Namespace): The command-line arguments constructed by 'main'. path (PythonPath): The python path to use. """ for component in path: print >>args.output, component return 0 def main(): """Main execution function.""" parser = argparse.ArgumentParser() parser.add_argument('-M', '--master_dir', help="Augment the path with the master's directory.") parser.add_argument('-o', '--output', metavar='PATH', type=argparse.FileType('w'), default='-', help="File to output to (use '-' for STDOUT).") subparsers = parser.add_subparsers() # 'echo' subparser = subparsers.add_parser('echo') subparser.set_defaults(func=_Command_Echo) # 'print' subparser = subparsers.add_parser('print') subparser.set_defaults(func=_Command_Print) # Parse args = parser.parse_args() # Execute our subcommand function, which will return the exit code. path = _InfraPathFromArgs(args) return args.func(args, path) if __name__ == '__main__': sys.exit(main())
#!/usr/bin/env python from translate.convert import xliff2po from translate.misc import wStringIO from translate.storage.test_base import headerless_len, first_translatable class TestXLIFF2PO: xliffskeleton = '''<?xml version="1.0" ?> <xliff version="1.1" xmlns="urn:oasis:names:tc:xliff:document:1.1"> <file original="filename.po" source-language="en-US" datatype="po"> <body> %s </body> </file> </xliff>''' def xliff2po(self, xliffsource): """helper that converts xliff source to po source without requiring files""" inputfile = wStringIO.StringIO(xliffsource) convertor = xliff2po.xliff2po() outputpo = convertor.convertstore(inputfile) print "The generated po:" print type(outputpo) print str(outputpo) return outputpo def test_minimal(self): minixlf = self.xliffskeleton % '''<trans-unit> <source>red</source> <target>rooi</target> </trans-unit>''' pofile = self.xliff2po(minixlf) assert headerless_len(pofile.units) == 1 assert pofile.translate("red") == "rooi" assert pofile.translate("bla") is None def test_basic(self): minixlf = (self.xliffskeleton % '''<trans-unit id="1" restype="<API key>" approved="no" xml:space="preserve"> <source>%s</source> <target>%s</target> <note from="po-translator">Zulu translation of program ABC</note> </trans-unit> <trans-unit> <source>gras</source> <target>utshani</target> </trans-unit>''') % (headertext, headertext) print minixlf pofile = self.xliff2po(minixlf) assert pofile.translate("gras") == "utshani" assert pofile.translate("bla") is None potext = str(pofile) assert potext.index('# Zulu translation of program ABC') == 0 assert potext.index('msgid "gras"\n') assert potext.index('msgstr "utshani"\n') assert potext.index('MIME-Version: 1.0\\n') def <API key>(self): """Tests translator comments""" minixlf = self.xliffskeleton % '''<trans-unit> <source>nonsense</source> <target>matlhapolosa</target> <context-group name="po-entry" purpose="information"> <context context-type="x-po-trancomment">Couldn't do it</context> </context-group> <note from="po-translator">Couldn't do it</note> </trans-unit>''' pofile = self.xliff2po(minixlf) assert pofile.translate("nonsense") == "matlhapolosa" assert pofile.translate("bla") is None unit = first_translatable(pofile) assert unit.getnotes("translator") == "Couldn't do it" potext = str(pofile) assert potext.index("# Couldn't do it\n") >= 0 minixlf = self.xliffskeleton % '''<trans-unit xml:space="preserve"> <source>nonsense</source> <target>matlhapolosa</target> <context-group name="po-entry" purpose="information"> <context context-type="x-po-trancomment">Couldn't do it</context> </context-group> <note from="po-translator">Couldn't do it</note> </trans-unit>''' pofile = self.xliff2po(minixlf) assert pofile.translate("nonsense") == "matlhapolosa" assert pofile.translate("bla") is None unit = first_translatable(pofile) assert unit.getnotes("translator") == "Couldn't do\nit" potext = str(pofile) assert potext.index("# Couldn't do\n# it\n") >= 0 def test_autocomment(self): """Tests automatic comments""" minixlf = self.xliffskeleton % '''<trans-unit> <source>nonsense</source> <target>matlhapolosa</target> <context-group name="po-entry" purpose="information"> <context context-type="x-po-autocomment">Note that this is garbage</context> </context-group> <note from="developer">Note that this is garbage</note> </trans-unit>''' pofile = self.xliff2po(minixlf) assert pofile.translate("nonsense") == "matlhapolosa" assert pofile.translate("bla") is None unit = first_translatable(pofile) assert unit.getnotes("developer") == "Note that this is garbage" potext = str(pofile) assert potext.index("#. Note that this is garbage\n") >= 0 minixlf = self.xliffskeleton % '''<trans-unit xml:space="preserve"> <source>nonsense</source> <target>matlhapolosa</target> <context-group name="po-entry" purpose="information"> <context context-type="x-po-autocomment">Note that this is garbage</context> </context-group> <note from="developer">Note that this is garbage</note> </trans-unit>''' pofile = self.xliff2po(minixlf) assert pofile.translate("nonsense") == "matlhapolosa" assert pofile.translate("bla") is None unit = first_translatable(pofile) assert unit.getnotes("developer") == "Note that this is\ngarbage" potext = str(pofile) assert potext.index("#. Note that this is\n#. garbage\n") >= 0 def test_locations(self): """Tests location comments (#:)""" minixlf = self.xliffskeleton % '''<trans-unit id="1"> <source>nonsense</source> <target>matlhapolosa</target> <context-group name="po-reference" purpose="location"> <context context-type="sourcefile">example.c</context> <context context-type="linenumber">123</context> </context-group> <context-group name="po-reference" purpose="location"> <context context-type="sourcefile">place.py</context> </context-group> </trans-unit>''' pofile = self.xliff2po(minixlf) assert pofile.translate("nonsense") == "matlhapolosa" assert pofile.translate("bla") is None unit = first_translatable(pofile) locations = unit.getlocations() assert len(locations) == 2 assert "example.c:123" in locations assert "place.py" in locations def test_fuzzy(self): """Tests fuzzyness""" minixlf = self.xliffskeleton % '''<trans-unit approved="no"> <source>book</source> </trans-unit> <trans-unit id="2" approved="yes"> <source>nonsense</source> <target>matlhapolosa</target> </trans-unit> <trans-unit id="2" approved="no"> <source>verb</source> <target state="<API key>">lediri</target> </trans-unit>''' pofile = self.xliff2po(minixlf) assert pofile.translate("nonsense") == "matlhapolosa" assert pofile.translate("verb") == "lediri" assert pofile.translate("book") is None assert pofile.translate("bla") is None assert headerless_len(pofile.units) == 3 #TODO: decide if this one should be fuzzy: #assert pofile.units[0].isfuzzy() assert not pofile.units[2].isfuzzy() assert pofile.units[3].isfuzzy() def test_plurals(self): """Tests fuzzyness""" minixlf = self.xliffskeleton % '''<group id="1" restype="x-gettext-plurals"> <trans-unit id="1[0]" xml:space="preserve"> <source>cow</source> <target>inkomo</target> </trans-unit> <trans-unit id="1[1]" xml:space="preserve"> <source>cows</source> <target>iinkomo</target> </trans-unit> </group>''' pofile = self.xliff2po(minixlf) print str(pofile) potext = str(pofile) assert headerless_len(pofile.units) == 1 assert potext.index('msgid_plural "cows"') assert potext.index('msgstr[0] "inkomo"') assert potext.index('msgstr[1] "iinkomo"') class TestBasicXLIFF2PO(TestXLIFF2PO): """This tests a basic XLIFF file without xmlns attribute""" xliffskeleton = '''<?xml version="1.0" ?> <xliff version="1.1"> <file original="filename.po" source-language="en-US" datatype="po"> <body> %s </body> </file> </xliff>'''
// GENERATED CODE: DO NOT EDIT. See scala.Function0 for timestamp. package scala object Product17 { def unapply[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17](x: Product17[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17]): Option[Product17[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17]] = Some(x) } /** Product17 is a Cartesian product of 17 components. * @since 2.3 */ trait Product17[+T1, +T2, +T3, +T4, +T5, +T6, +T7, +T8, +T9, +T10, +T11, +T12, +T13, +T14, +T15, +T16, +T17] extends Any with Product { /** The arity of this product. * @return 17 */ override def productArity = 17 /** Returns the n-th projection of this product if 0 <= n < productArity, * otherwise throws an `<API key>`. * * @param n number of the projection to be returned * @return same as `._(n+1)`, for example `productElement(0)` is the same as `._1`. * @throws <API key> */ @throws(classOf[<API key>]) override def productElement(n: Int) = n match { case 0 => _1 case 1 => _2 case 2 => _3 case 3 => _4 case 4 => _5 case 5 => _6 case 6 => _7 case 7 => _8 case 8 => _9 case 9 => _10 case 10 => _11 case 11 => _12 case 12 => _13 case 13 => _14 case 14 => _15 case 15 => _16 case 16 => _17 case _ => throw new <API key>(n.toString()) } /** A projection of element 1 of this Product. * @return A projection of element 1. */ def _1: T1 /** A projection of element 2 of this Product. * @return A projection of element 2. */ def _2: T2 /** A projection of element 3 of this Product. * @return A projection of element 3. */ def _3: T3 /** A projection of element 4 of this Product. * @return A projection of element 4. */ def _4: T4 /** A projection of element 5 of this Product. * @return A projection of element 5. */ def _5: T5 /** A projection of element 6 of this Product. * @return A projection of element 6. */ def _6: T6 /** A projection of element 7 of this Product. * @return A projection of element 7. */ def _7: T7 /** A projection of element 8 of this Product. * @return A projection of element 8. */ def _8: T8 /** A projection of element 9 of this Product. * @return A projection of element 9. */ def _9: T9 /** A projection of element 10 of this Product. * @return A projection of element 10. */ def _10: T10 /** A projection of element 11 of this Product. * @return A projection of element 11. */ def _11: T11 /** A projection of element 12 of this Product. * @return A projection of element 12. */ def _12: T12 /** A projection of element 13 of this Product. * @return A projection of element 13. */ def _13: T13 /** A projection of element 14 of this Product. * @return A projection of element 14. */ def _14: T14 /** A projection of element 15 of this Product. * @return A projection of element 15. */ def _15: T15 /** A projection of element 16 of this Product. * @return A projection of element 16. */ def _16: T16 /** A projection of element 17 of this Product. * @return A projection of element 17. */ def _17: T17 }
<!DOCTYPE html> <! - http://creativecommons.org/publicdomain/zero/1.0/ --> <html> <meta charset="utf-8"> <title>CSS Shape Test: sideways-lr, float left, circle(50% at right 40px bottom 40px)</title> <link rel="author" title="Ting-Yu Lin" href="mailto:tlin@mozilla.com"> <link rel="author" title="Mozilla" href="http: <link rel="help" href="https://drafts.csswg.org/css-shapes-1/#<API key>"> <link rel="match" href="reference/<API key>.html"> <meta name="flags" content=""> <meta name="assert" content="Test the boxes are wrapping around the left float shape defined by circle(50% at right 40px bottom 40px) value under sideways-lr writing-mode."> <style> .container { writing-mode: sideways-lr; inline-size: 200px; line-height: 0; } .shape { float: left; shape-outside: circle(50% at right 40px bottom 40px) border-box; clip-path: circle(50% at right 40px bottom 40px) border-box; box-sizing: content-box; block-size: 40px; inline-size: 40px; padding: 20px; border: 20px solid lightgreen; margin-inline-start: 20px; margin-inline-end: 20px; background-color: orange; } .box { display: inline-block; inline-size: 60px; background-color: blue; } .long { inline-size: 200px; } </style> <main class="container"> <div class="shape"></div> <div class="long box" style="block-size: 20px;"></div> <!-- Fill the border area due to the circle shifted --> <div class="box" style="block-size: 12px;"></div> <!-- Box at corner --> <div class="box" style="block-size: 12px;"></div> <!-- Box at corner --> <div class="box" style="block-size: 36px;"></div> <div class="box" style="block-size: 36px;"></div> <div class="box" style="block-size: 12px;"></div> <!-- Box at corner --> <div class="long box" style="block-size: 20px;"></div> </main> </html>
<! Copyright (c) 2015 The Khronos Group Inc. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and/or associated documentation files (the "Materials"), to deal in the Materials without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Materials, and to permit persons to whom the Materials are furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Materials. THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. <! This file is auto-generated from py/<API key>.py DO NOT EDIT! <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <link rel="stylesheet" href="../../../resources/js-test-style.css"/> <script src="../../../js/js-test-pre.js"></script> <script src="../../../js/webgl-test-utils.js"></script> <script src="../../../js/tests/<API key>.js"></script> <script src="../../../js/tests/<API key>.js"></script> </head> <body> <canvas id="example" width="32" height="32"></canvas> <div id="description"></div> <div id="console"></div> <script> "use strict"; function testPrologue(gl) { return true; } generateTest("R16F", "RED", "HALF_FLOAT", testPrologue, "../../../resources/", 2)(); </script> </body> </html>
<!DOCTYPE html PUBLIC "- <html xmlns="http: <head> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <meta http-equiv="X-UA-Compatible" content="IE=9"/> <meta name="generator" content="Doxygen 1.8.5"/> <title>Core Plot (iOS): Source/<API key>+TypeConversion.h Source File</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript" src="dynsections.js"></script> <link href="navtree.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="resize.js"></script> <script type="text/javascript" src="navtree.js"></script> <script type="text/javascript"> $(document).ready(initResizable); $(window).load(resizeHeight); </script> <link href="doxygen.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="top"><!-- do not remove this div, it is closed by doxygen! --> <div id="titlearea"> <table cellspacing="0" cellpadding="0"> <tbody> <tr style="height: 56px;"> <td id="projectlogo"><img alt="Logo" src="core-plot-logo.png"/></td> <td style="padding-left: 0.5em;"> <div id="projectname">Core Plot (iOS) </div> <div id="projectbrief">Cocoa plotting framework for Mac OS X and iOS</div> </td> </tr> </tbody> </table> </div> <!-- end header part --> <!-- Generated by Doxygen 1.8.5 --> <div id="navrow1" class="tabs"> <ul class="tablist"> <li><a href="index.html"><span>Main&#160;Page</span></a></li> <li><a href="pages.html"><span>Related&#160;Pages</span></a></li> <li><a href="modules.html"><span>Animation&#160;&&#160;Constants</span></a></li> <li><a href="annotated.html"><span>Classes</span></a></li> <li class="current"><a href="files.html"><span>Files</span></a></li> </ul> </div> <div id="navrow2" class="tabs2"> <ul class="tablist"> <li><a href="files.html"><span>File&#160;List</span></a></li> <li><a href="globals.html"><span>File&#160;Members</span></a></li> </ul> </div> </div><!-- top --> <div id="side-nav" class="ui-resizable side-nav-resizable"> <div id="nav-tree"> <div id="nav-tree-contents"> <div id="nav-sync" class="sync"></div> </div> </div> <div id="splitbar" style="-moz-user-select:none;" class="ui-resizable-handle"> </div> </div> <script type="text/javascript"> $(document).ready(function(){initNavTree('<API key>.html','');}); </script> <div id="doc-content"> <div class="header"> <div class="headertitle"> <div class="title"><API key>+TypeConversion.h</div> </div> </div><!--header <div class="contents"> <a href="<API key>.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span>&#160;<span class="preprocessor">#import &quot;<a class="code" href="<API key>.html"><API key>.h</a>&quot;</span></div> <div class="line"><a name="l00002"></a><span class="lineno"> 2</span>&#160;<span class="preprocessor">#import &quot;<a class="code" href="<API key>.html">CPTNumericDataType.h</a>&quot;</span></div> <div class="line"><a name="l00003"></a><span class="lineno"> 3</span>&#160;</div> <div class="line"><a name="l00007"></a><span class="lineno"><a class="line" href="<API key>.html"> 7</a></span>&#160;<span class="keyword">@interface </span><a class="code" href="<API key>.html"><API key>(TypeConversion)</a></div> <div class="line"><a name="l00008"></a><span class="lineno"> 8</span>&#160;</div> <div class="line"><a name="l00011"></a><span class="lineno"><a class="line" href="<API key>.html#<API key>"> 11</a></span>&#160;<span class="keyword">@property</span> (readwrite, assign) <a class="code" href="<API key>.html">CPTNumericDataType</a> dataType;</div> <div class="line"><a name="l00012"></a><span class="lineno"><a class="line" href="<API key>.html#<API key>"> 12</a></span>&#160;<span class="keyword">@property</span> (readwrite, assign) <a class="code" href="<API key>.html#<API key>">CPTDataTypeFormat</a> dataTypeFormat;</div> <div class="line"><a name="l00013"></a><span class="lineno"><a class="line" href="<API key>.html#<API key>"> 13</a></span>&#160;<span class="keyword">@property</span> (readwrite, assign) <span class="keywordtype">size_t</span> sampleBytes;</div> <div class="line"><a name="l00014"></a><span class="lineno"><a class="line" href="<API key>.html <div class="line"><a name="l00016"></a><span class="lineno"> 16</span>&#160;</div> <div class="line"><a name="l00019"></a><span class="lineno"> 19</span>& <div class="line"><a name="l00021"></a><span class="lineno"> 21</span>&#160;</div> <div class="line"><a name="l00022"></a><span class="lineno"> 22</span>&#160;<span class="keyword">@end</span></div> <div class="ttc" id="<API key>"><div class="ttname"><a href="<API key>.html">CPTNumericDataType.h</a></div></div> <div class="ttc" id="<API key>"><div class="ttname"><a href="<API key>.html"><API key>(TypeConversion)</a></div><div class="ttdoc">Type conversion methods for <API key>. </div><div class="ttdef"><b>Definition:</b> <API key>+TypeConversion.h:7</div></div> <div class="ttc" id="<API key>"><div class="ttname"><a href="<API key>.html"><API key>.h</a></div></div> <div class="ttc" id="reference_html"><div class="ttname"><a href="https://developer.apple.com/library/ios/#documentation/corefoundation/Reference/CFByteOrderUtils/Reference/reference.html">CFByteOrder</a></div></div> <div class="ttc" id="<API key>"><div class="ttname"><a href="<API key>.html">CPTNumericDataType</a></div><div class="ttdoc">Structure that describes the encoding of numeric data samples. </div><div class="ttdef"><b>Definition:</b> CPTNumericDataType.h:29</div></div> <div class="ttc" id="<API key>"><div class="ttname"><a href="<API key>.html#<API key>">CPTDataTypeFormat</a></div><div class="ttdeci">CPTDataTypeFormat</div><div class="ttdoc">Enumeration of data formats for numeric data. </div><div class="ttdef"><b>Definition:</b> CPTNumericDataType.h:6</div></div> </div><!-- fragment --></div><!-- contents --> </div><!-- doc-content --> <!-- start footer part --> <div id="nav-path" class="navpath"><!-- id is needed for treeview function! --> <ul> <li class="navelem"><a class="el" href="<API key>.html">Source</a></li><li class="navelem"><a class="el" href="<API key>.html"><API key>+TypeConversion.h</a></li> <li class="footer">Generated by <a href="http: <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.5 </li> </ul> </div> </body> </html>
#include "third_party/blink/renderer/modules/presentation/<API key>.h" #include "third_party/blink/renderer/modules/presentation/<API key>.h" #include "third_party/blink/renderer/platform/scheduler/public/thread.h" namespace blink { <API key>::<API key>( mojom::blink::PresentationService* <API key>) : <API key>(<API key>) {} <API key>::~<API key>() = default; void <API key>::RequestAvailability( const Vector<KURL>& urls, <API key>* callback) { auto screen_availability = <API key>(urls); // Reject Promise if screen availability is unsupported for all URLs. if (screen_availability == mojom::blink::ScreenAvailability::DISABLED) { Thread::Current()->GetTaskRunner()->PostTask( FROM_HERE, WTF::Bind( &<API key>::<API key>, WrapPersistent(callback))); // Do not listen to urls if we reject the promise. return; } auto* listener = <API key>(urls); if (!listener) { listener = <API key><<API key>>(urls); <API key>.emplace_back(listener); } if (screen_availability != mojom::blink::ScreenAvailability::UNKNOWN) { Thread::Current()->GetTaskRunner()->PostTask( FROM_HERE, WTF::Bind(&<API key>::Resolve, WrapPersistent(callback), screen_availability == mojom::blink::ScreenAvailability::AVAILABLE)); } else { listener-><API key>.push_back(callback); } for (const auto& availability_url : urls) StartListeningToURL(availability_url); } void <API key>::AddObserver( <API key>* observer) { const auto& urls = observer->Urls(); auto* listener = <API key>(urls); if (!listener) { listener = <API key><<API key>>(urls); <API key>.emplace_back(listener); } if (listener-><API key>.Contains(observer)) return; listener-><API key>.push_back(observer); for (const auto& availability_url : urls) StartListeningToURL(availability_url); } void <API key>::RemoveObserver( <API key>* observer) { const auto& urls = observer->Urls(); auto* listener = <API key>(urls); if (!listener) { DLOG(WARNING) << "Stop listening for availability for unknown URLs."; return; } wtf_size_t slot = listener-><API key>.Find(observer); if (slot != kNotFound) { listener-><API key>.EraseAt(slot); } for (const auto& availability_url : urls) <API key>(availability_url); <API key>(listener); } void <API key>::UpdateAvailability( const KURL& url, mojom::blink::ScreenAvailability availability) { auto* listening_status = GetListeningStatus(url); if (!listening_status) return; if (listening_status->listening_state == ListeningState::kWaiting) listening_status->listening_state = ListeningState::kActive; if (listening_status-><API key> == availability) return; listening_status-><API key> = availability; HeapVector<Member<<API key>>> listeners = <API key>; for (auto& listener : listeners) { if (!listener->urls.Contains<KURL>(url)) continue; auto screen_availability = <API key>(listener->urls); DCHECK(screen_availability != mojom::blink::ScreenAvailability::UNKNOWN); HeapVector<Member<<API key>>> observers = listener-><API key>; for (auto& observer : observers) { observer->AvailabilityChanged(screen_availability); } if (screen_availability == mojom::blink::ScreenAvailability::DISABLED) { for (auto& callback_ptr : listener-><API key>) { callback_ptr-><API key>(); } } else { for (auto& callback_ptr : listener-><API key>) { callback_ptr->Resolve(screen_availability == mojom::blink::ScreenAvailability::AVAILABLE); } } listener-><API key>.clear(); for (const auto& availability_url : listener->urls) <API key>(availability_url); <API key>(listener); } } void <API key>::Trace(Visitor* visitor) const { visitor->Trace(<API key>); } void <API key>::StartListeningToURL(const KURL& url) { auto* listening_status = GetListeningStatus(url); if (!listening_status) { listening_status = new ListeningStatus(url); <API key>.emplace_back(listening_status); } // Already listening. if (listening_status->listening_state != ListeningState::kInactive) return; listening_status->listening_state = ListeningState::kWaiting; <API key>-><API key>(url); } void <API key>::<API key>(const KURL& url) { for (const auto& listener : <API key>) { if (!listener->urls.Contains(url)) continue; // URL is still observed by some availability object. if (!listener-><API key>.IsEmpty() || !listener-><API key>.IsEmpty()) { return; } } auto* listening_status = GetListeningStatus(url); if (!listening_status) { LOG(WARNING) << "Stop listening to unknown url: " << url.GetString(); return; } if (listening_status->listening_state == ListeningState::kInactive) return; listening_status->listening_state = ListeningState::kInactive; <API key>-><API key>(url); } mojom::blink::ScreenAvailability <API key>::<API key>( const Vector<KURL>& urls) const { bool has_disabled = false; bool <API key> = false; bool has_unavailable = false; for (const auto& url : urls) { auto* status = GetListeningStatus(url); auto screen_availability = status ? status-><API key> : mojom::blink::ScreenAvailability::UNKNOWN; switch (screen_availability) { case mojom::blink::ScreenAvailability::AVAILABLE: return mojom::blink::ScreenAvailability::AVAILABLE; case mojom::blink::ScreenAvailability::DISABLED: has_disabled = true; break; case mojom::blink::ScreenAvailability::<API key>: <API key> = true; break; case mojom::blink::ScreenAvailability::UNAVAILABLE: has_unavailable = true; break; case mojom::blink::ScreenAvailability::UNKNOWN: break; } } if (has_disabled) return mojom::blink::ScreenAvailability::DISABLED; if (<API key>) return mojom::blink::ScreenAvailability::<API key>; if (has_unavailable) return mojom::blink::ScreenAvailability::UNAVAILABLE; return mojom::blink::ScreenAvailability::UNKNOWN; } <API key>::<API key>* <API key>::<API key>( const Vector<KURL>& urls) { auto* listener_it = std::find_if( <API key>.begin(), <API key>.end(), [&urls](const auto& listener) { return listener->urls == urls; }); return listener_it == <API key>.end() ? nullptr : *listener_it; } void <API key>::<API key>( <API key>* listener) { // URL is still observed by some availability object. if (!listener-><API key>.IsEmpty() || !listener-><API key>.IsEmpty()) { return; } wtf_size_t slot = <API key>.Find(listener); if (slot != kNotFound) { <API key>.EraseAt(slot); } } <API key>::ListeningStatus* <API key>::GetListeningStatus(const KURL& url) const { auto* status_it = std::find_if(<API key>.begin(), <API key>.end(), [&url](const std::unique_ptr<ListeningStatus>& status) { return status->url == url; }); return status_it == <API key>.end() ? nullptr : status_it->get(); } <API key>::<API key>::<API key>( const Vector<KURL>& availability_urls) : urls(availability_urls) {} <API key>::<API key>::~<API key>() = default; void <API key>::<API key>::Trace( blink::Visitor* visitor) const { visitor->Trace(<API key>); visitor->Trace(<API key>); } <API key>::ListeningStatus::ListeningStatus( const KURL& availability_url) : url(availability_url), <API key>(mojom::blink::ScreenAvailability::UNKNOWN), listening_state(ListeningState::kInactive) {} <API key>::ListeningStatus::~ListeningStatus() = default; } // namespace blink
#include "chrome_frame/http_negotiate.h" #include <atlbase.h> #include <atlcom.h> #include <htiframe.h> #include "base/logging.h" #include "base/memory/scoped_ptr.h" #include "base/string_util.h" #include "base/stringprintf.h" #include "base/<API key>.h" #include "chrome_frame/bho.h" #include "chrome_frame/exception_barrier.h" #include "chrome_frame/html_utils.h" #include "chrome_frame/urlmon_moniker.h" #include "chrome_frame/urlmon_url_request.h" #include "chrome_frame/utils.h" #include "chrome_frame/<API key>.h" #include "net/http/<API key>.h" #include "net/http/http_util.h" bool HttpNegotiatePatch::modify_user_agent_ = true; const char <API key>[] = "x-ua-compatible"; const char kLowerCaseUserAgent[] = "user-agent"; // From the latest urlmon.h. Symbol name prepended with LOCAL_ to // avoid conflict (and therefore build errors) for those building with // a newer Windows SDK. // TODO(robertshield): Remove this once we update our SDK version. const int <API key> = 54; static const int <API key> = 3; <API key>(IHttpNegotiate) VTABLE_PATCH_ENTRY(<API key>, HttpNegotiatePatch::<API key>) END_VTABLE_PATCHES() namespace { class <API key> : public CComObjectRootEx<<API key>>, public IBindStatusCallback { public: BEGIN_COM_MAP(<API key>) COM_INTERFACE_ENTRY(IBindStatusCallback) END_COM_MAP() // IBindStatusCallback implementation STDMETHOD(OnStartBinding)(DWORD reserved, IBinding* binding) { return E_NOTIMPL; } STDMETHOD(GetPriority)(LONG* priority) { return E_NOTIMPL; } STDMETHOD(OnLowResource)(DWORD reserved) { return E_NOTIMPL; } STDMETHOD(OnProgress)(ULONG progress, ULONG max_progress, ULONG status_code, LPCWSTR status_text) { return E_NOTIMPL; } STDMETHOD(OnStopBinding)(HRESULT result, LPCWSTR error) { return E_NOTIMPL; } STDMETHOD(GetBindInfo)(DWORD* bind_flags, BINDINFO* bind_info) { return E_NOTIMPL; } STDMETHOD(OnDataAvailable)(DWORD flags, DWORD size, FORMATETC* formatetc, STGMEDIUM* storage) { return E_NOTIMPL; } STDMETHOD(OnObjectAvailable)(REFIID iid, IUnknown* object) { return E_NOTIMPL; } }; } // end namespace std::string <API key>(LPCWSTR headers, LPCWSTR additional_headers) { using net::HttpUtil; std::string ascii_headers; if (additional_headers) { ascii_headers = WideToASCII(additional_headers); } // Extract "User-Agent" from |additional_headers| or |headers|. HttpUtil::HeadersIterator headers_iterator(ascii_headers.begin(), ascii_headers.end(), "\r\n"); std::string user_agent_value; if (headers_iterator.AdvanceTo(kLowerCaseUserAgent)) { user_agent_value = headers_iterator.values(); } else if (headers != NULL) { // See if there's a user-agent header specified in the original headers. std::string original_headers(WideToASCII(headers)); HttpUtil::HeadersIterator original_it(original_headers.begin(), original_headers.end(), "\r\n"); if (original_it.AdvanceTo(kLowerCaseUserAgent)) user_agent_value = original_it.values(); } // Use the default "User-Agent" if none was provided. if (user_agent_value.empty()) user_agent_value = http_utils::GetDefaultUserAgent(); // Now add chromeframe to it. user_agent_value = http_utils::<API key>( user_agent_value); // Build new headers, skip the existing user agent value from // existing headers. std::string new_headers; headers_iterator.Reset(); while (headers_iterator.GetNext()) { std::string name(headers_iterator.name()); if (!<API key>(name, kLowerCaseUserAgent)) { new_headers += name + ": " + headers_iterator.values() + "\r\n"; } } new_headers += "User-Agent: " + user_agent_value; new_headers += "\r\n"; return new_headers; } std::string <API key>(LPCWSTR headers, const std::string& user_agent_value) { using net::HttpUtil; std::string new_headers; if (headers) { std::string ascii_headers(WideToASCII(headers)); // Extract "User-Agent" from the headers. HttpUtil::HeadersIterator headers_iterator(ascii_headers.begin(), ascii_headers.end(), "\r\n"); // Build new headers, skip the existing user agent value from // existing headers. while (headers_iterator.GetNext()) { std::string name(headers_iterator.name()); if (!<API key>(name, kLowerCaseUserAgent)) { new_headers += name + ": " + headers_iterator.values() + "\r\n"; } } } new_headers += "User-Agent: " + user_agent_value; new_headers += "\r\n"; return new_headers; } HttpNegotiatePatch::HttpNegotiatePatch() { } HttpNegotiatePatch::~HttpNegotiatePatch() { } // static bool HttpNegotiatePatch::Initialize() { if (IS_PATCHED(IHttpNegotiate)) { DLOG(WARNING) << __FUNCTION__ << " called more than once."; return true; } // Use our <API key> class as we need a temporary object that // implements IBindStatusCallback. CComObjectStackEx<<API key>> request; base::win::ScopedComPtr<IBindCtx> bind_ctx; HRESULT hr = CreateAsyncBindCtx(0, &request, NULL, bind_ctx.Receive()); DCHECK(SUCCEEDED(hr)) << "CreateAsyncBindCtx"; if (bind_ctx) { base::win::ScopedComPtr<IUnknown> bscb_holder; bind_ctx->GetObjectParam(L"_BSCB_Holder_", bscb_holder.Receive()); if (bscb_holder) { hr = PatchHttpNegotiate(bscb_holder); } else { NOTREACHED() << "Failed to get _BSCB_Holder_"; hr = E_UNEXPECTED; } bind_ctx.Release(); } return SUCCEEDED(hr); } // static void HttpNegotiatePatch::Uninitialize() { vtable_patch::<API key>(<API key>); } // static HRESULT HttpNegotiatePatch::PatchHttpNegotiate(IUnknown* to_patch) { DCHECK(to_patch); <API key>(IHttpNegotiate); base::win::ScopedComPtr<IHttpNegotiate> http; HRESULT hr = http.QueryFrom(to_patch); if (FAILED(hr)) { hr = DoQueryService(IID_IHttpNegotiate, to_patch, http.Receive()); } if (http) { hr = vtable_patch::<API key>(http, <API key>); DLOG_IF(ERROR, FAILED(hr)) << base::StringPrintf("HttpNegotiate patch failed 0x%08X", hr); } else { DLOG(WARNING) << base::StringPrintf("IHttpNegotiate not supported 0x%08X", hr); } return hr; } // static HRESULT HttpNegotiatePatch::<API key>( <API key> original, IHttpNegotiate* me, LPCWSTR url, LPCWSTR headers, DWORD reserved, LPWSTR* additional_headers) { DVLOG(1) << __FUNCTION__ << " " << url << " headers:\n" << headers; HRESULT hr = original(me, url, headers, reserved, additional_headers); if (FAILED(hr)) { DLOG(WARNING) << __FUNCTION__ << " Delegate returned an error"; return hr; } if (modify_user_agent_) { std::string updated_headers; if (<API key>() && RendererTypeForUrl(url) == <API key>) { // Replace the user-agent header with Chrome's. updated_headers = <API key>(*additional_headers, http_utils::GetChromeUserAgent()); } else { updated_headers = <API key>(headers, *additional_headers); } *additional_headers = reinterpret_cast<wchar_t*>(::CoTaskMemRealloc( *additional_headers, (updated_headers.length() + 1) * sizeof(wchar_t))); lstrcpyW(*additional_headers, ASCIIToWide(updated_headers).c_str()); } else { // TODO(erikwright): Remove the user agent if it is present (i.e., because // of PostPlatform setting in the registry). } return S_OK; }
#include "flutter/sky/engine/wtf/PartitionAlloc.h" #include <string.h> #ifndef NDEBUG #include <stdio.h> #endif // Two partition pages are used as guard / metadata page so make sure the super // page size is bigger. COMPILE_ASSERT(WTF::kPartitionPageSize * 4 <= WTF::kSuperPageSize, ok_super_page_size); COMPILE_ASSERT(!(WTF::kSuperPageSize % WTF::kPartitionPageSize), <API key>); // Four system pages gives us room to hack out a still-guard-paged piece // of metadata in the middle of a guard partition page. COMPILE_ASSERT(WTF::kSystemPageSize * 4 <= WTF::kPartitionPageSize, <API key>); COMPILE_ASSERT(!(WTF::kPartitionPageSize % WTF::kSystemPageSize), <API key>); COMPILE_ASSERT(sizeof(WTF::PartitionPage) <= WTF::kPageMetadataSize, <API key>); COMPILE_ASSERT(sizeof(WTF::PartitionBucket) <= WTF::kPageMetadataSize, <API key>); COMPILE_ASSERT(sizeof(WTF::<API key>) <= WTF::kPageMetadataSize, <API key>); COMPILE_ASSERT(WTF::kPageMetadataSize * WTF::<API key> <= WTF::kSystemPageSize, <API key>); // Check that some of our zanier calculations worked out as expected. COMPILE_ASSERT(WTF::<API key> == 8, <API key>); COMPILE_ASSERT(WTF::kGenericMaxBucketed == 983040, <API key>); namespace WTF { int PartitionRootBase::gInitializedLock = 0; bool PartitionRootBase::gInitialized = false; PartitionPage PartitionRootBase::gSeedPage; PartitionBucket PartitionRootBase::gPagedBucket; static size_t <API key>(size_t size) { // This works out reasonably for the current bucket sizes of the generic // allocator, and the current values of partition page size and constants. // Specifically, we have enough room to always pack the slots perfectly into // some number of system pages. The only waste is the waste associated with // unfaulted pages (i.e. wasted address space). // TODO: we end up using a lot of system pages for very small sizes. For // example, we'll use 12 system pages for slot size 24. The slot size is // so small that the waste would be tiny with just 4, or 1, system pages. // Later, we can investigate whether there are anti-fragmentation benefits // to using fewer system pages. double bestWasteRatio = 1.0f; size_t bestPages = 0; if (size > <API key> * kSystemPageSize) { ASSERT(!(size % kSystemPageSize)); return size / kSystemPageSize; } ASSERT(size <= <API key> * kSystemPageSize); for (size_t i = <API key> - 1; i <= <API key>; ++i) { size_t pageSize = kSystemPageSize * i; size_t numSlots = pageSize / size; size_t waste = pageSize - (numSlots * size); // Leaving a page unfaulted is not free; the page will occupy an empty page table entry. // Make a simple attempt to account for that. size_t numRemainderPages = i & (<API key> - 1); size_t numUnfaultedPages = numRemainderPages ? (<API key> - numRemainderPages) : 0; waste += sizeof(void*) * numUnfaultedPages; double wasteRatio = (double) waste / (double) pageSize; if (wasteRatio < bestWasteRatio) { bestWasteRatio = wasteRatio; bestPages = i; } } ASSERT(bestPages > 0); return bestPages; } static void <API key>(PartitionRootBase* root) { ASSERT(!root->initialized); spinLockLock(&PartitionRootBase::gInitializedLock); if (!PartitionRootBase::gInitialized) { PartitionRootBase::gInitialized = true; // We mark the seed page as free to make sure it is skipped by our // logic to find a new active page. PartitionRootBase::gPagedBucket.activePagesHead = &<API key>::gSeedPage; } spinLockUnlock(&PartitionRootBase::gInitializedLock); root->initialized = true; root-><API key> = 0; root-><API key> = 0; root->nextSuperPage = 0; root->nextPartitionPage = 0; root-><API key> = 0; root->firstExtent = 0; root->currentExtent = 0; memset(&root->globalEmptyPageRing, '\0', sizeof(root->globalEmptyPageRing)); root-><API key> = 0; // This is a "magic" value so we can test if a root pointer is valid. root->invertedSelf = ~reinterpret_cast<uintptr_t>(root); } static void <API key>(PartitionBucket* bucket, PartitionRootBase* root) { bucket->activePagesHead = &<API key>::gSeedPage; bucket->freePagesHead = 0; bucket->numFullPages = 0; bucket-><API key> = <API key>(bucket->slotSize); } void partitionAllocInit(PartitionRoot* root, size_t numBuckets, size_t maxAllocation) { <API key>(root); root->numBuckets = numBuckets; root->maxAllocation = maxAllocation; size_t i; for (i = 0; i < root->numBuckets; ++i) { PartitionBucket* bucket = &root->buckets()[i]; if (!i) bucket->slotSize = <API key>; else bucket->slotSize = i << kBucketShift; <API key>(bucket, root); } } void <API key>(<API key>* root) { <API key>(root); root->lock = 0; // Precalculate some shift and mask constants used in the hot path. // Example: malloc(41) == 101001 binary. // Order is 6 (1 << 6-1)==32 is highest bit set. // orderIndex is the next three MSB == 010 == 2. // subOrderIndexMask is a mask for the remaining bits == 11 (masking to 01 for the subOrderIndex). size_t order; for (order = 0; order <= kBitsPerSizet; ++order) { size_t orderIndexShift; if (order < <API key> + 1) orderIndexShift = 0; else orderIndexShift = order - (<API key> + 1); root->orderIndexShifts[order] = orderIndexShift; size_t subOrderIndexMask; if (order == kBitsPerSizet) { // This avoids invoking undefined behavior for an excessive shift. subOrderIndexMask = static_cast<size_t>(-1) >> (<API key> + 1); } else { subOrderIndexMask = ((1 << order) - 1) >> (<API key> + 1); } root->orderSubIndexMasks[order] = subOrderIndexMask; } // Set up the actual usable buckets first. // Note that typical values (i.e. min allocation size of 8) will result in // invalid buckets (size==9 etc. or more generally, size is not a multiple // of the smallest allocation granularity). // We avoid them in the bucket lookup map, but we tolerate them to keep the // code simpler and the structures more generic. size_t i, j; size_t currentSize = <API key>; size_t currentIncrement = <API key> >> <API key>; PartitionBucket* bucket = &root->buckets[0]; for (i = 0; i < <API key>; ++i) { for (j = 0; j < <API key>; ++j) { bucket->slotSize = currentSize; <API key>(bucket, root); // Disable invalid buckets so that touching them faults. if (currentSize % <API key>) bucket->activePagesHead = 0; currentSize += currentIncrement; ++bucket; } currentIncrement <<= 1; } ASSERT(currentSize == 1 << <API key>); ASSERT(bucket == &root->buckets[0] + (<API key> * <API key>)); // Then set up the fast size -> bucket lookup table. bucket = &root->buckets[0]; PartitionBucket** bucketPtr = &root->bucketLookups[0]; for (order = 0; order <= kBitsPerSizet; ++order) { for (j = 0; j < <API key>; ++j) { if (order < <API key>) { // Use the bucket of finest granularity for malloc(0) etc. *bucketPtr++ = &root->buckets[0]; } else if (order > <API key>) { *bucketPtr++ = &<API key>::gPagedBucket; } else { PartitionBucket* validBucket = bucket; // Skip over invalid buckets. while (validBucket->slotSize % <API key>) validBucket++; *bucketPtr++ = validBucket; bucket++; } } } ASSERT(bucket == &root->buckets[0] + (<API key> * <API key>)); ASSERT(bucketPtr == &root->bucketLookups[0] + ((kBitsPerSizet + 1) * <API key>)); // And there's one last bucket lookup that will be hit for e.g. malloc(-1), // which tries to overflow to a non-existant order. *bucketPtr = &<API key>::gPagedBucket; } static bool <API key>(PartitionBucket* bucket) { // Failure here indicates a memory leak. bool noLeaks = !bucket->numFullPages; PartitionPage* page = bucket->activePagesHead; while (page) { if (page->numAllocatedSlots) noLeaks = false; page = page->nextPage; } return noLeaks; } static void <API key>(PartitionRootBase* root) { ASSERT(root->initialized); root->initialized = false; // Now that we've examined all partition pages in all buckets, it's safe // to free all our super pages. We first collect the super page pointers // on the stack because some of them are themselves store in super pages. char* superPages[kMaxPartitionSize / kSuperPageSize]; size_t numSuperPages = 0; <API key>* entry = root->firstExtent; while (entry) { char* superPage = entry->superPageBase; while (superPage != entry->superPagesEnd) { superPages[numSuperPages] = superPage; numSuperPages++; superPage += kSuperPageSize; } entry = entry->next; } ASSERT(numSuperPages == root-><API key> / kSuperPageSize); for (size_t i = 0; i < numSuperPages; ++i) freePages(superPages[i], kSuperPageSize); } bool <API key>(PartitionRoot* root) { bool noLeaks = true; size_t i; for (i = 0; i < root->numBuckets; ++i) { PartitionBucket* bucket = &root->buckets()[i]; if (!<API key>(bucket)) noLeaks = false; } <API key>(root); return noLeaks; } bool <API key>(<API key>* root) { bool noLeaks = true; size_t i; for (i = 0; i < <API key> * <API key>; ++i) { PartitionBucket* bucket = &root->buckets[i]; if (!<API key>(bucket)) noLeaks = false; } <API key>(root); return noLeaks; } static NEVER_INLINE void <API key>() { IMMEDIATE_CRASH(); } static NEVER_INLINE void partitionFull() { IMMEDIATE_CRASH(); } static ALWAYS_INLINE void <API key>(PartitionRootBase* root, void* addr, size_t len) { decommitSystemPages(addr, len); ASSERT(root-><API key> > len); root-><API key> -= len; } static ALWAYS_INLINE void <API key>(PartitionRootBase* root, void* addr, size_t len) { recommitSystemPages(addr, len); root-><API key> += len; } static ALWAYS_INLINE void* <API key>(PartitionRootBase* root, int flags, size_t numPartitionPages) { ASSERT(!(reinterpret_cast<uintptr_t>(root->nextPartitionPage) % kPartitionPageSize)); ASSERT(!(reinterpret_cast<uintptr_t>(root-><API key>) % kPartitionPageSize)); RELEASE_ASSERT(numPartitionPages <= <API key>); size_t totalSize = kPartitionPageSize * numPartitionPages; root-><API key> += totalSize; size_t <API key> = (root-><API key> - root->nextPartitionPage) >> kPartitionPageShift; if (LIKELY(<API key> >= numPartitionPages)) { // In this case, we can still hand out pages from the current super page // allocation. char* ret = root->nextPartitionPage; root->nextPartitionPage += totalSize; return ret; } // Need a new super page. root-><API key> += kSuperPageSize; if (root-><API key> > kMaxPartitionSize) partitionFull(); char* requestedAddress = root->nextSuperPage; char* superPage = reinterpret_cast<char*>(allocPages(requestedAddress, kSuperPageSize, kSuperPageSize)); if (UNLIKELY(!superPage)) { if (flags & <API key>) return 0; <API key>(); } root->nextSuperPage = superPage + kSuperPageSize; char* ret = superPage + kPartitionPageSize; root->nextPartitionPage = ret + totalSize; root-><API key> = root->nextSuperPage - kPartitionPageSize; // Make the first partition page in the super page a guard page, but leave a // hole in the middle. // This is where we put page metadata and also a tiny amount of extent // metadata. <API key>(superPage, kSystemPageSize); <API key>(superPage + (kSystemPageSize * 2), kPartitionPageSize - (kSystemPageSize * 2)); // Also make the last partition page a guard page. <API key>(superPage + (kSuperPageSize - kPartitionPageSize), kPartitionPageSize); // If we were after a specific address, but didn't get it, assume that // the system chose a lousy address and re-randomize the next // allocation. if (requestedAddress && requestedAddress != superPage) root->nextSuperPage = 0; // We allocated a new super page so update super page metadata. // First check if this is a new extent or not. <API key>* latestExtent = reinterpret_cast<<API key>*>(<API key>(superPage)); <API key>* currentExtent = root->currentExtent; bool isNewExtent = (superPage != requestedAddress); if (UNLIKELY(isNewExtent)) { latestExtent->next = 0; if (UNLIKELY(!currentExtent)) { root->firstExtent = latestExtent; } else { ASSERT(currentExtent->superPageBase); currentExtent->next = latestExtent; } root->currentExtent = latestExtent; currentExtent = latestExtent; currentExtent->superPageBase = superPage; currentExtent->superPagesEnd = superPage + kSuperPageSize; } else { // We allocated next to an existing extent so just nudge the size up a little. currentExtent->superPagesEnd += kSuperPageSize; ASSERT(ret >= currentExtent->superPageBase && ret < currentExtent->superPagesEnd); } // By storing the root in every extent metadata object, we have a fast way // to go from a pointer within the partition to the root object. latestExtent->root = root; return ret; } static ALWAYS_INLINE void partitionUnusePage(PartitionRootBase* root, PartitionPage* page) { ASSERT(page->bucket-><API key>); void* addr = <API key>(page); <API key>(root, addr, page->bucket-><API key> * kSystemPageSize); } static ALWAYS_INLINE size_t <API key>(const PartitionBucket* bucket) { return (bucket-><API key> * kSystemPageSize) / bucket->slotSize; } static ALWAYS_INLINE size_t <API key>(const PartitionBucket* bucket) { return (bucket-><API key> + (<API key> - 1)) / <API key>; } static ALWAYS_INLINE void partitionPageReset(PartitionPage* page, PartitionBucket* bucket) { ASSERT(page != &<API key>::gSeedPage); page->numAllocatedSlots = 0; page-><API key> = <API key>(bucket); ASSERT(page-><API key>); page->bucket = bucket; page->nextPage = 0; // NULLing the freelist is not strictly necessary but it makes an ASSERT in <API key> simpler. page->freelistHead = 0; page->pageOffset = 0; page->freeCacheIndex = -1; size_t numPartitionPages = <API key>(bucket); size_t i; char* pageCharPtr = reinterpret_cast<char*>(page); for (i = 1; i < numPartitionPages; ++i) { pageCharPtr += kPageMetadataSize; PartitionPage* secondaryPage = reinterpret_cast<PartitionPage*>(pageCharPtr); secondaryPage->pageOffset = i; } } static ALWAYS_INLINE char* <API key>(PartitionPage* page) { ASSERT(page != &<API key>::gSeedPage); size_t numSlots = page-><API key>; ASSERT(numSlots); PartitionBucket* bucket = page->bucket; // We should only get here when _every_ slot is either used or unprovisioned. // (The third state is "on the freelist". If we have a non-empty freelist, we should not get here.) ASSERT(numSlots + page->numAllocatedSlots == <API key>(bucket)); // Similarly, make explicitly sure that the freelist is empty. ASSERT(!page->freelistHead); ASSERT(page->numAllocatedSlots >= 0); size_t size = bucket->slotSize; char* base = reinterpret_cast<char*>(<API key>(page)); char* returnObject = base + (size * page->numAllocatedSlots); char* <API key> = returnObject + size; char* <API key> = <API key> + sizeof(<API key>*); // Our goal is to fault as few system pages as possible. We calculate the // page containing the "end" of the returned slot, and then allow freelist // pointers to be written up to the end of that page. char* subPageLimit = reinterpret_cast<char*>((reinterpret_cast<uintptr_t>(<API key>) + <API key>) & kSystemPageBaseMask); char* slotsLimit = returnObject + (size * page-><API key>); char* freelistLimit = subPageLimit; if (UNLIKELY(slotsLimit < freelistLimit)) freelistLimit = slotsLimit; size_t <API key> = 0; if (LIKELY(<API key> <= freelistLimit)) { // Only consider used space in the slot span. If we consider wasted // space, we may get an off-by-one when a freelist pointer fits in the // wasted space, but a slot does not. // We know we can fit at least one freelist pointer. <API key> = 1; // Any further entries require space for the whole slot span. <API key> += (freelistLimit - <API key>) / size; } // We always return an object slot -- that's the +1 below. // We do not neccessarily create any new freelist entries, because we cross sub page boundaries frequently for large bucket sizes. ASSERT(<API key> + 1 <= numSlots); numSlots -= (<API key> + 1); page-><API key> = numSlots; page->numAllocatedSlots++; if (LIKELY(<API key>)) { char* freelistPointer = <API key>; <API key>* entry = reinterpret_cast<<API key>*>(freelistPointer); page->freelistHead = entry; while (--<API key>) { freelistPointer += size; <API key>* nextEntry = reinterpret_cast<<API key>*>(freelistPointer); entry->next = <API key>(nextEntry); entry = nextEntry; } entry->next = <API key>(0); } else { page->freelistHead = 0; } return returnObject; } // This helper function scans the active page list for a suitable new active // page, starting at the passed in page. // When it finds a suitable new active page (one that has free slots), it is // set as the new active page and true is returned. If there is no suitable new // active page, false is returned and the current active page is set to null. // As potential pages are scanned, they are tidied up according to their state. // Freed pages are swept on to the free page list and full pages are unlinked // from any list. static ALWAYS_INLINE bool <API key>(PartitionPage* page) { if (page == &PartitionRootBase::gSeedPage) { ASSERT(!page->nextPage); return false; } PartitionPage* nextPage = 0; PartitionBucket* bucket = page->bucket; for (; page; page = nextPage) { nextPage = page->nextPage; ASSERT(page->bucket == bucket); ASSERT(page != bucket->freePagesHead); ASSERT(!bucket->freePagesHead || page != bucket->freePagesHead->nextPage); // Page is usable if it has something on the freelist, or unprovisioned // slots that can be turned into a freelist. if (LIKELY(page->freelistHead != 0) || LIKELY(page-><API key>)) { bucket->activePagesHead = page; return true; } ASSERT(page->numAllocatedSlots >= 0); if (LIKELY(page->numAllocatedSlots == 0)) { ASSERT(page->freeCacheIndex == -1); // We hit a free page, so shepherd it on to the free page list. page->nextPage = bucket->freePagesHead; bucket->freePagesHead = page; } else { // If we get here, we found a full page. Skip over it too, and also // tag it as full (via a negative value). We need it tagged so that // free'ing can tell, and move it back into the active page list. ASSERT(page->numAllocatedSlots == static_cast<int>(<API key>(bucket))); page->numAllocatedSlots = -page->numAllocatedSlots; ++bucket->numFullPages; // numFullPages is a uint16_t for efficient packing so guard against // overflow to be safe. RELEASE_ASSERT(bucket->numFullPages); // Not necessary but might help stop accidents. page->nextPage = 0; } } bucket->activePagesHead = 0; return false; } struct <API key> { size_t mapSize; // Mapped size, not including guard pages and meta-data. }; static ALWAYS_INLINE <API key>* <API key>(PartitionPage* page) { ASSERT(<API key>(page->bucket)); return reinterpret_cast<<API key>*>(reinterpret_cast<char*>(page) + 2 * kPageMetadataSize); } static ALWAYS_INLINE void* partitionDirectMap(PartitionRootBase* root, int flags, size_t size) { size = <API key>(size); // Because we need to fake looking like a super page, We need to allocate // a bunch of system pages more than "size": // - The first few system pages are the partition page in which the super // page metadata is stored. We fault just one system page out of a partition // page sized clump. // - We add a trailing guard page. size_t mapSize = size + kPartitionPageSize + kSystemPageSize; // Round up to the allocation granularity. mapSize += <API key>; mapSize &= <API key>; // TODO: we may want to let the operating system place these allocations // where it pleases. On 32-bit, this might limit address space // fragmentation and on 64-bit, this might have useful savings for TLB // and page table overhead. // TODO: if upsizing realloc()s are common on large sizes, we could // consider over-allocating address space on 64-bit, "just in case". // TODO: consider pre-populating page tables (e.g. MAP_POPULATE on Linux, // MADV_WILLNEED on POSIX). // TODO: these pages will be zero-filled. Consider internalizing an // allocZeroed() API so we can avoid a memset() entirely in this case. char* ptr = reinterpret_cast<char*>(allocPages(0, mapSize, kSuperPageSize)); if (!ptr) { if (flags & <API key>) return 0; <API key>(); } char* ret = ptr + kPartitionPageSize; // TODO: due to all the guard paging, this arrangement creates 4 mappings. // We could get it down to three by using read-only for the metadata page, // or perhaps two by leaving out the trailing guard page on 64-bit. <API key>(ptr, kSystemPageSize); <API key>(ptr + (kSystemPageSize * 2), kPartitionPageSize - (kSystemPageSize * 2)); <API key>(ret + size, kSystemPageSize); <API key>* extent = reinterpret_cast<<API key>*>(<API key>(ptr)); extent->root = root; PartitionPage* page = <API key>(ret); PartitionBucket* bucket = reinterpret_cast<PartitionBucket*>(reinterpret_cast<char*>(page) + kPageMetadataSize); page->freelistHead = 0; page->nextPage = 0; page->bucket = bucket; page->numAllocatedSlots = 1; page-><API key> = 0; page->pageOffset = 0; page->freeCacheIndex = 0; bucket->activePagesHead = 0; bucket->freePagesHead = 0; bucket->slotSize = size; bucket-><API key> = 0; bucket->numFullPages = 0; <API key>* mapExtent = <API key>(page); mapExtent->mapSize = mapSize - kPartitionPageSize - kSystemPageSize; return ret; } static ALWAYS_INLINE void <API key>(PartitionPage* page) { size_t unmapSize = <API key>(page)->mapSize; // Add on the size of the trailing guard page and preceeding partition // page. unmapSize += kPartitionPageSize + kSystemPageSize; ASSERT(!(unmapSize & <API key>)); char* ptr = reinterpret_cast<char*>(<API key>(page)); // Account for the mapping starting a partition page before the actual // allocation address. ptr -= kPartitionPageSize; freePages(ptr, unmapSize); } void* <API key>(PartitionRootBase* root, int flags, size_t size, PartitionBucket* bucket) { // The slow path is called when the freelist is empty. ASSERT(!bucket->activePagesHead->freelistHead); // For the <API key> API, we have a bunch of buckets marked // as special cases. We bounce them through to the slow path so that we // can still have a blazing fast hot path due to lack of corner-case // branches. bool returnNull = flags & <API key>; if (UNLIKELY(<API key>(bucket))) { ASSERT(size > kGenericMaxBucketed); ASSERT(bucket == &PartitionRootBase::gPagedBucket); if (size > <API key>) { if (returnNull) return 0; RELEASE_ASSERT(false); } return partitionDirectMap(root, flags, size); } // First, look for a usable page in the existing active pages list. // Change active page, accepting the current page as a candidate. if (LIKELY(<API key>(bucket->activePagesHead))) { PartitionPage* newPage = bucket->activePagesHead; if (LIKELY(newPage->freelistHead != 0)) { <API key>* ret = newPage->freelistHead; newPage->freelistHead = <API key>(ret->next); newPage->numAllocatedSlots++; return ret; } ASSERT(newPage-><API key>); return <API key>(newPage); } // Second, look in our list of freed but reserved pages. PartitionPage* newPage = bucket->freePagesHead; if (LIKELY(newPage != 0)) { ASSERT(newPage != &<API key>::gSeedPage); ASSERT(!newPage->freelistHead); ASSERT(!newPage->numAllocatedSlots); ASSERT(!newPage-><API key>); ASSERT(newPage->freeCacheIndex == -1); bucket->freePagesHead = newPage->nextPage; void* addr = <API key>(newPage); <API key>(root, addr, newPage->bucket-><API key> * kSystemPageSize); } else { // Third. If we get here, we need a brand new page. size_t numPartitionPages = <API key>(bucket); void* rawNewPage = <API key>(root, flags, numPartitionPages); if (UNLIKELY(!rawNewPage)) { ASSERT(returnNull); return 0; } // Skip the alignment check because it depends on page->bucket, which is not yet set. newPage = <API key>(rawNewPage); } partitionPageReset(newPage, bucket); bucket->activePagesHead = newPage; return <API key>(newPage); } static ALWAYS_INLINE void partitionFreePage(PartitionRootBase* root, PartitionPage* page) { ASSERT(page->freelistHead); ASSERT(!page->numAllocatedSlots); partitionUnusePage(root, page); // We actually leave the freed page in the active list. We'll sweep it on // to the free page list when we next walk the active page list. Pulling // this trick enables us to use a singly-linked page list for all cases, // which is critical in keeping the page metadata structure down to 32 // bytes in size. page->freelistHead = 0; page-><API key> = 0; } static ALWAYS_INLINE void <API key>(PartitionPage* page) { PartitionRootBase* root = partitionPageToRoot(page); // If the page is already registered as empty, give it another life. if (page->freeCacheIndex != -1) { ASSERT(page->freeCacheIndex >= 0); ASSERT(static_cast<unsigned>(page->freeCacheIndex) < kMaxFreeableSpans); ASSERT(root->globalEmptyPageRing[page->freeCacheIndex] == page); root->globalEmptyPageRing[page->freeCacheIndex] = 0; } size_t currentIndex = root-><API key>; PartitionPage* pageToFree = root->globalEmptyPageRing[currentIndex]; // The page might well have been re-activated, filled up, etc. before we get // around to looking at it here. if (pageToFree) { ASSERT(pageToFree != &PartitionRootBase::gSeedPage); ASSERT(pageToFree->freeCacheIndex >= 0); ASSERT(static_cast<unsigned>(pageToFree->freeCacheIndex) < kMaxFreeableSpans); ASSERT(pageToFree == root->globalEmptyPageRing[pageToFree->freeCacheIndex]); if (!pageToFree->numAllocatedSlots && pageToFree->freelistHead) { // The page is still empty, and not freed, so _really_ free it. partitionFreePage(root, pageToFree); } pageToFree->freeCacheIndex = -1; } // We put the empty slot span on our global list of "pages that were once // empty". thus providing it a bit of breathing room to get re-used before // we really free it. This improves performance, particularly on Mac OS X // which has subpar memory management performance. root->globalEmptyPageRing[currentIndex] = page; page->freeCacheIndex = currentIndex; ++currentIndex; if (currentIndex == kMaxFreeableSpans) currentIndex = 0; root-><API key> = currentIndex; } void <API key>(PartitionPage* page) { PartitionBucket* bucket = page->bucket; ASSERT(page != &<API key>::gSeedPage); ASSERT(bucket->activePagesHead != &<API key>::gSeedPage); if (LIKELY(page->numAllocatedSlots == 0)) { // Page became fully unused. if (UNLIKELY(<API key>(bucket))) { <API key>(page); return; } // If it's the current active page, attempt to change it. We'd prefer to leave // the page empty as a gentle force towards defragmentation. if (LIKELY(page == bucket->activePagesHead) && page->nextPage) { if (<API key>(page->nextPage)) { ASSERT(bucket->activePagesHead != page); // Link the empty page back in after the new current page, to // avoid losing a reference to it. // TODO: consider walking the list to link the empty page after // all non-empty pages? PartitionPage* currentPage = bucket->activePagesHead; page->nextPage = currentPage->nextPage; currentPage->nextPage = page; } else { bucket->activePagesHead = page; page->nextPage = 0; } } <API key>(page); } else { // Ensure that the page is full. That's the only valid case if we // arrive here. ASSERT(page->numAllocatedSlots < 0); // likely indicates a double-free. RELEASE_ASSERT(page->numAllocatedSlots != -1); page->numAllocatedSlots = -page->numAllocatedSlots - 2; ASSERT(page->numAllocatedSlots == static_cast<int>(<API key>(bucket) - 1)); // Fully used page became partially used. It must be put back on the // non-full page list. Also make it the current page to increase the // chances of it being filled up again. The old current page will be // the next page. page->nextPage = bucket->activePagesHead; bucket->activePagesHead = page; --bucket->numFullPages; // Special case: for a partition page with just a single slot, it may // now be empty and we want to run it through the empty logic. if (UNLIKELY(page->numAllocatedSlots == 0)) <API key>(page); } } bool <API key>(<API key>* root, PartitionPage* page, size_t newSize) { ASSERT(<API key>(page->bucket)); newSize = <API key>(newSize); // Note that the new size might be a bucketed size; this function is called // whenever we're reallocating a direct mapped allocation. newSize = <API key>(newSize); if (newSize < <API key>) return false; // bucket->slotSize is the current size of the allocation. size_t currentSize = page->bucket->slotSize; if (newSize == currentSize) return true; char* charPtr = static_cast<char*>(<API key>(page)); if (newSize < currentSize) { size_t mapSize = <API key>(page)->mapSize; // Don't reallocate in-place if new size is less than 80 % of the full // map size, to avoid holding on to too much unused address space. if ((newSize / kSystemPageSize) * 5 < (mapSize / kSystemPageSize) * 4) return false; // Shrink by decommitting unneeded pages and making them inaccessible. size_t decommitSize = currentSize - newSize; <API key>(root, charPtr + newSize, decommitSize); <API key>(charPtr + newSize, decommitSize); } else if (newSize <= <API key>(page)->mapSize) { // Grow within the actually allocated memory. Just need to make the // pages accessible again. size_t recommitSize = newSize - currentSize; <API key>(charPtr + currentSize, recommitSize); <API key>(root, charPtr + currentSize, recommitSize); #if ENABLE(ASSERT) memset(charPtr + currentSize, kUninitializedByte, recommitSize); #endif } else { // We can't perform the realloc in-place. // TODO: support this too when possible. return false; } #if ENABLE(ASSERT) // Write a new trailing cookie. <API key>(charPtr + newSize - kCookieSize); #endif page->bucket->slotSize = newSize; return true; } void* <API key>(<API key>* root, void* ptr, size_t newSize) { #if defined(<API key>) return realloc(ptr, newSize); #else if (UNLIKELY(!ptr)) return <API key>(root, newSize); if (UNLIKELY(!newSize)) { <API key>(root, ptr); return 0; } RELEASE_ASSERT(newSize <= <API key>); ASSERT(<API key>(<API key>(ptr))); PartitionPage* page = <API key>(<API key>(ptr)); if (UNLIKELY(<API key>(page->bucket))) { // We may be able to perform the realloc in place by changing the // accessibility of memory pages and, if reducing the size, decommitting // them. if (<API key>(root, page, newSize)) return ptr; } size_t actualNewSize = <API key>(root, newSize); size_t actualOldSize = <API key>(ptr); // TODO: note that tcmalloc will "ignore" a downsizing realloc() unless the // new size is a significant percentage smaller. We could do the same if we // determine it is a win. if (actualNewSize == actualOldSize) { // Trying to allocate a block of size newSize would give us a block of // the same size as the one we've already got, so no point in doing // anything here. return ptr; } // This realloc cannot be resized in-place. Sadness. void* ret = <API key>(root, newSize); size_t copySize = actualOldSize; if (newSize < copySize) copySize = newSize; memcpy(ret, ptr, copySize); <API key>(root, ptr); return ret; #endif } #ifndef NDEBUG void partitionDumpStats(const PartitionRoot& root) { size_t i; size_t totalLive = 0; size_t totalResident = 0; size_t totalFreeable = 0; for (i = 0; i < root.numBuckets; ++i) { const PartitionBucket& bucket = root.buckets()[i]; if (bucket.activePagesHead == &<API key>::gSeedPage && !bucket.freePagesHead && !bucket.numFullPages) { // Empty bucket with no freelist or full pages. Skip reporting it. continue; } size_t numFreePages = 0; PartitionPage* freePages = bucket.freePagesHead; while (freePages) { ++numFreePages; freePages = freePages->nextPage; } size_t bucketSlotSize = bucket.slotSize; size_t bucketNumSlots = <API key>(&bucket); size_t bucketUsefulStorage = bucketSlotSize * bucketNumSlots; size_t bucketPageSize = bucket.<API key> * kSystemPageSize; size_t bucketWaste = bucketPageSize - bucketUsefulStorage; size_t numActiveBytes = bucket.numFullPages * bucketUsefulStorage; size_t numResidentBytes = bucket.numFullPages * bucketPageSize; size_t numFreeableBytes = 0; size_t numActivePages = 0; const PartitionPage* page = bucket.activePagesHead; while (page) { ASSERT(page != &<API key>::gSeedPage); // A page may be on the active list but freed and not yet swept. if (!page->freelistHead && !page-><API key> && !page->numAllocatedSlots) { ++numFreePages; } else { ++numActivePages; numActiveBytes += (page->numAllocatedSlots * bucketSlotSize); size_t pageBytesResident = (bucketNumSlots - page-><API key>) * bucketSlotSize; // Round up to system page size. pageBytesResident = (pageBytesResident + <API key>) & kSystemPageBaseMask; numResidentBytes += pageBytesResident; if (!page->numAllocatedSlots) numFreeableBytes += pageBytesResident; } page = page->nextPage; } totalLive += numActiveBytes; totalResident += numResidentBytes; totalFreeable += numFreeableBytes; printf("bucket size %zu (pageSize %zu waste %zu): %zu alloc/%zu commit/%zu freeable bytes, %zu/%zu/%zu full/active/free pages\n", bucketSlotSize, bucketPageSize, bucketWaste, numActiveBytes, numResidentBytes, numFreeableBytes, static_cast<size_t>(bucket.numFullPages), numActivePages, numFreePages); } printf("total live: %zu bytes\n", totalLive); printf("total resident: %zu bytes\n", totalResident); printf("total freeable: %zu bytes\n", totalFreeable); fflush(stdout); } #endif // !NDEBUG } // namespace WTF
(async function() { TestRunner.addResult(`Tests scripts panel file selectors.\n`); await TestRunner.loadLegacyModule('sources'); await TestRunner.loadTestModule('sources_test_runner'); await TestRunner.loadTestModule('sdk_test_runner'); await TestRunner.showPanel('sources'); await TestRunner.addIframe( 'resources/<API key>.html', {name: 'childframe'}); Bindings.<API key>.resetForTest(TestRunner.mainTarget); Bindings.resourceMapping.resetForTest(TestRunner.mainTarget); var subframe = TestRunner.mainFrame().childFrames[0]; var <API key> = new Sources.<API key>(); <API key>.show(UI.inspectorView.element); var <API key> = new Sources.<API key>(); <API key>.show(UI.inspectorView.element); var uiSourceCodes = []; async function addUISourceCode(url, isContentScript, frame) { if (isContentScript) { var uiSourceCode = await SourcesTestRunner.<API key>(url, '', true, 42); uiSourceCodes.push(uiSourceCode); return; } TestRunner.addScriptForFrame(url, '', frame || TestRunner.mainFrame()); var uiSourceCode = await <API key>(url); uiSourceCodes.push(uiSourceCode); } async function addUISourceCode2(url) { TestRunner.<API key>(` window.workers = window.workers || []; window.workers.push(new Worker('${url}')); `); var uiSourceCode = await <API key>(url); uiSourceCodes.push(uiSourceCode); } function <API key>(url) { var fulfill; var promise = new Promise(x => fulfill = x); Workspace.workspace.addEventListener( Workspace.Workspace.Events.UISourceCodeAdded, uiSourceCodeAdded); return promise; function uiSourceCodeAdded(event) { if (event.data.url() !== url) return; Workspace.workspace.removeEventListener( Workspace.Workspace.Events.UISourceCodeAdded, uiSourceCodeAdded); fulfill(event.data); } } function revealUISourceCode(uiSourceCode) { <API key>.revealUISourceCode(uiSourceCode); <API key>.revealUISourceCode(uiSourceCode); } var rootURL = 'http://localhost:8080/LayoutTests/inspector/debugger/'; TestRunner.addResult('\n\n================================================'); TestRunner.addResult('Adding first resource:'); await addUISourceCode(rootURL + 'foo/bar/script.js', false); SourcesTestRunner.<API key>(<API key>); TestRunner.addResult('\n\n================================================'); TestRunner.addResult('Adding second resource:'); await addUISourceCode(rootURL + 'foo/bar/script.js?a=2', false); SourcesTestRunner.<API key>(<API key>); TestRunner.addResult('\n\n================================================'); TestRunner.addResult('Adding resources into another frame:'); await addUISourceCode(rootURL + 'foo/bar/script.js?a=1', false, subframe); await addUISourceCode(rootURL + 'foo/baz/script.js', false, subframe); SourcesTestRunner.<API key>(<API key>); TestRunner.addResult('\n\n================================================'); TestRunner.addResult('Adding resources into another target:'); await addUISourceCode2(TestRunner.url('resources/script1.js?a=3')); await addUISourceCode2(TestRunner.url('resources/script2.js')); SourcesTestRunner.<API key>(<API key>); TestRunner.addResult('\n\n================================================'); TestRunner.addResult('Adding content scripts and some random resources:'); await addUISourceCode(rootURL + 'foo/bar/contentScript2.js?a=1', true); await addUISourceCode(rootURL + 'foo/bar/contentScript.js?a=2', true); await addUISourceCode(rootURL + 'foo/bar/contentScript.js?a=1', true); await addUISourceCode('http://example.com/', false); await addUISourceCode('http://example.com/?a=b', false); await addUISourceCode( 'http://example.com/the%2fdir/foo?bar=100&baz=a%20%2fb', false); // Verify that adding invalid URL does not throw exception. await addUISourceCode( 'http://example.com/the%2fdir/foo?bar=100%&baz=a%20%2fb', false); await addUISourceCode( 'http://example.com/path%20with%20spaces/white%20space.html', false); await addUISourceCode('?a=b', false); await addUISourceCode( 'very_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_url', false); SourcesTestRunner.<API key>(<API key>); SourcesTestRunner.<API key>(<API key>); TestRunner.addResult('\n\n================================================'); TestRunner.addResult('Revealing first resource:'); revealUISourceCode(uiSourceCodes[0]); SourcesTestRunner.<API key>(<API key>); // collapsed while adding resources into it. TestRunner.addResult('\n\n================================================'); TestRunner.addResult( 'Adding some resources to change the way debugger folder looks like, first:'); var rootURL2 = 'http://localhost:8080/LayoutTests/inspector/debugger2/'; await addUISourceCode(rootURL2 + 'foo/bar/script.js', false); SourcesTestRunner.<API key>(<API key>); TestRunner.addResult('\n\n================================================'); TestRunner.addResult('Second:'); await addUISourceCode(rootURL2 + 'foo/bar/script.js?a=2', false); SourcesTestRunner.<API key>(<API key>); TestRunner.addResult('\n\n================================================'); TestRunner.addResult('Others:'); await addUISourceCode(rootURL2 + 'foo/bar/script.js?a=1', false); await addUISourceCode(rootURL2 + 'foo/baz/script.js', false); SourcesTestRunner.<API key>(<API key>); TestRunner.addResult('\n\n================================================'); var rootURL3 = 'http://localhost:8080/LayoutTests/inspector/debugger3/'; await addUISourceCode( rootURL3 + 'hasOwnProperty/__proto__/constructor/foo.js', false); await addUISourceCode(rootURL3 + 'hasOwnProperty/__proto__/foo.js', false); await addUISourceCode(rootURL3 + 'hasOwnProperty/foo.js', false); SourcesTestRunner.<API key>(<API key>); TestRunner.addResult('\n\n================================================'); TestRunner.addResult('Revealing all resources:'); for (var i = 0; i < uiSourceCodes.length; ++i) revealUISourceCode(uiSourceCodes[i]); SourcesTestRunner.<API key>(<API key>); SourcesTestRunner.<API key>(<API key>); TestRunner.addResult('\n\n================================================'); TestRunner.addResult('Removing all resources:'); for (const target of SDK.targetManager.targets()) { if (target !== TestRunner.mainTarget) Bindings.<API key>.resetForTest(target); } SourcesTestRunner.<API key>(<API key>); SourcesTestRunner.<API key>(<API key>); TestRunner.completeTest(); })();
function waitUntilIdle() { return new Promise(resolve=>{ window.requestIdleCallback(()=>resolve()); }); } (async function() { TestRunner.addResult(`Tests V8 code cache for javascript resources\n`); await TestRunner.loadLegacyModule('timeline'); await TestRunner.loadTestModule('<API key>'); await TestRunner.showPanel('timeline'); // Clear browser cache to avoid any existing entries for the fetched // scripts in the cache. SDK.<API key>.clearBrowserCache(); // There are two scripts: // An iframe that loads [A]. // The script is executed as a parser-inserted script, // to keep the ScriptResource on the MemoryCache. // ScriptResources for <API key> <script>s can be // garbage-collected and thus removed from MemoryCache after its execution. const scope = 'resources/same-origin-script.html'; // An iframe that loads [B]. const scopeCrossOrigin = 'resources/cross-origin-script.html'; TestRunner.addResult(' await <API key>.startTimeline(); async function <API key>() { await <API key>.stopTimeline(); await <API key>.<API key>( TimelineModel.TimelineModel.RecordType.CompileScript, TimelineModel.TimelineModel.RecordType.CacheScript); } async function expectationComment(msg) { await <API key>(); TestRunner.addResult(msg); await <API key>.startTimeline(); } // Load [A] thrice. With the current V8 heuristics (defined in // third_party/blink/renderer/bindings/core/v8/v8_code_cache.cc) we produce // cache on second fetch and consume it in the third fetch. This tests these // heuristics. // Note that addIframe() waits for iframe's load event, which waits for the // <script> loading. await expectationComment('Load [A] 1st time. Produce timestamp. await TestRunner.addIframe(scope); await expectationComment('Load [A] 2nd time. Produce code cache. await TestRunner.addIframe(scope); await waitUntilIdle(); await expectationComment('Load [A] 3rd time. Consume code cache. await TestRunner.addIframe(scope); await expectationComment('Load [B]. Should not use the cached code. await TestRunner.addIframe(scopeCrossOrigin); await expectationComment('Load [A] again from MemoryCache. ' + 'Should use the cached code. await TestRunner.addIframe(scope); await expectationComment('Clear [A] from MemoryCache. // Blink evicts previous Resource when a new request to the same URL but with // different resource type is started. We fetch() to the URL of [A], and thus // evicts the previous ScriptResource of [A]. await TestRunner.evaluateInPageAsync( `fetch('/devtools/resources/v8-cache-script.cgi')`); await expectationComment('Load [A] from Disk Cache. // As we cleared [A] from MemoryCache, this doesn't hit MemoryCache, but still // hits Disk Cache. await TestRunner.addIframe(scope); await <API key>(); TestRunner.addResult(' TestRunner.completeTest(); })();
// are permitted provided that the following conditions are met: // and/or other materials provided with the distribution. // - Neither the name of the Outercurve Foundation nor the names of its // contributors may be used to endorse or promote products derived from this // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE // ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON // ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. using System; namespace WebsitePanel.Providers.HostedSolution { public class BaseStatistics { public string TopResellerName { get; set; } public string ResellerName { get; set; } public string CustomerName { get; set; } public DateTime CustomerCreated { get; set; } public string HostingSpace { get; set; } public string OrganizationName { get; set; } public DateTime OrganizationCreated { get; set; } public string OrganizationID { get; set; } public DateTime HostingSpaceCreated { get; set; } } }
<?php /** * base class */ require_once 'PEAR/Command/Channels.php'; class PEAR_Command_Auth extends <API key> { var $commands = array( 'login' => array( 'summary' => 'Connects and authenticates to remote server [Deprecated in favor of channel-login]', 'shortcut' => 'li', 'function' => 'doLogin', 'options' => array(), 'doc' => '<channel name> WARNING: This function is deprecated in favor of using channel-login Log in to a remote channel server. If <channel name> is not supplied, the default channel is used. To use remote functions in the installer that require any kind of privileges, you need to log in first. The username and password you enter here will be stored in your per-user PEAR configuration (~/.pearrc on Unix-like systems). After logging in, your username and password will be sent along in subsequent operations on the remote server.', ), 'logout' => array( 'summary' => 'Logs out from the remote server [Deprecated in favor of channel-logout]', 'shortcut' => 'lo', 'function' => 'doLogout', 'options' => array(), 'doc' => ' WARNING: This function is deprecated in favor of using channel-logout Logs out from the remote server. This command does not actually connect to the remote server, it only deletes the stored username and password from your user configuration.', ) ); /** * PEAR_Command_Auth constructor. * * @access public */ function PEAR_Command_Auth(&$ui, &$config) { parent::<API key>($ui, $config); } }
<?php // Call <API key>::main() if this source file is executed directly. if (!defined("PHPUnit_MAIN_METHOD")) { define("PHPUnit_MAIN_METHOD", "<API key>::main"); } require_once 'Zend/Json/Server/Response.php'; require_once 'Zend/Json/Server/Error.php'; require_once 'Zend/Json.php'; class <API key> extends <API key> { /** * Runs the test methods of this class. * * @return void */ public static function main() { $suite = new <API key>("<API key>"); $result = <API key>::run($suite); } /** * Sets up the fixture, for example, open a network connection. * This method is called before a test is executed. * * @return void */ public function setUp() { $this->response = new <API key>(); } /** * Tears down the fixture, for example, close a network connection. * This method is called after a test is executed. * * @return void */ public function tearDown() { } public function <API key>() { $this->assertNull($this->response->getResult()); } public function <API key>() { foreach (array(true, 'foo', 2, 2.0, array(), array('foo' => 'bar')) as $result) { $this->response->setResult($result); $this->assertEquals($result, $this->response->getResult()); } } public function <API key>() { $this->assertFalse($this->response->isError()); } public function <API key>() { $error = new <API key>(); $this->response->setError($error); $this->assertTrue($this->response->isError()); } public function <API key>() { $error = new <API key>(); $this->response->setError($error); $this->assertSame($error, $this->response->getError()); } public function <API key>() { $this->assertNull($this->response->getId()); } public function <API key>() { $this->response->setId('foo'); $this->assertEquals('foo', $this->response->getId()); } public function <API key>() { $this->assertNull($this->response->getVersion()); } public function <API key>() { $this->response->setVersion('2.0'); $this->assertEquals('2.0', $this->response->getVersion()); foreach (array('a', 1, '1.0', array(), true) as $version) { $this->response->setVersion($version); $this->assertNull($this->response->getVersion()); } } public function <API key>() { $this->response->setResult(true) ->setId('foo') ->setVersion('2.0'); $json = $this->response->toJson(); $test = Zend_Json::decode($json); $this->assertTrue(is_array($test)); $this->assertTrue(array_key_exists('result', $test)); // assertion changed to false, because 'error' may not coexist with 'result' $this->assertFalse(array_key_exists('error', $test), "'error' may not coexist with 'result'"); $this->assertTrue(array_key_exists('id', $test)); $this->assertTrue(array_key_exists('jsonrpc', $test)); $this->assertTrue($test['result']); $this->assertEquals($this->response->getId(), $test['id']); $this->assertEquals($this->response->getVersion(), $test['jsonrpc']); } public function <API key>() { $error = new <API key>(); $error->setCode(<API key>::ERROR_INTERNAL) ->setMessage('error occurred'); $this->response->setId('foo') ->setResult(true) ->setError($error); $json = $this->response->toJson(); $test = Zend_Json::decode($json); $this->assertTrue(is_array($test)); $this->assertFalse(array_key_exists('result', $test), "'result' may not coexist with 'error'"); $this->assertTrue(array_key_exists('id', $test)); $this->assertFalse(array_key_exists('jsonrpc', $test)); $this->assertEquals($this->response->getId(), $test['id']); $this->assertEquals($error->getCode(), $test['error']['code']); $this->assertEquals($error->getMessage(), $test['error']['message']); } public function <API key>() { $this->response->setResult(true) ->setId('foo'); $json = $this->response->__toString(); $test = Zend_Json::decode($json); $this->assertTrue(is_array($test)); $this->assertTrue(array_key_exists('result', $test)); $this->assertFalse(array_key_exists('error', $test), "'error' may not coexist with 'result'"); $this->assertTrue(array_key_exists('id', $test)); $this->assertFalse(array_key_exists('jsonrpc', $test)); $this->assertTrue($test['result']); $this->assertEquals($this->response->getId(), $test['id']); } } // Call <API key>::main() if this source file is executed directly. if (PHPUnit_MAIN_METHOD == "<API key>::main") { <API key>::main(); }
namespace Microsoft.Azure.ServiceBus.Amqp { using System; using System.Collections.Generic; using System.Threading.Tasks; using Azure.Amqp; using Azure.Amqp.Encoding; using Core; using Framing; using Primitives; internal sealed class <API key> : <API key> { int prefetchCount; readonly object syncLock; MessageReceiver innerReceiver; static <API key>() { AmqpCodec.RegisterKnownTypes(AmqpTrueFilterCodec.Name, AmqpTrueFilterCodec.Code, () => new AmqpTrueFilterCodec()); AmqpCodec.RegisterKnownTypes(<API key>.Name, <API key>.Code, () => new <API key>()); AmqpCodec.RegisterKnownTypes(<API key>.Name, <API key>.Code, () => new <API key>()); AmqpCodec.RegisterKnownTypes(AmqpSqlFilterCodec.Name, AmqpSqlFilterCodec.Code, () => new AmqpSqlFilterCodec()); AmqpCodec.RegisterKnownTypes(<API key>.Name, <API key>.Code, () => new <API key>()); AmqpCodec.RegisterKnownTypes(<API key>.Name, <API key>.Code, () => new <API key>()); AmqpCodec.RegisterKnownTypes(<API key>.Name, <API key>.Code, () => new <API key>()); } public <API key>( string path, <API key> <API key>, RetryPolicy retryPolicy, ICbsTokenProvider cbsTokenProvider, int prefetchCount = 0, ReceiveMode mode = ReceiveMode.ReceiveAndDelete) { this.syncLock = new object(); this.Path = path; this.<API key> = <API key>; this.RetryPolicy = retryPolicy; this.CbsTokenProvider = cbsTokenProvider; this.PrefetchCount = prefetchCount; this.ReceiveMode = mode; } public MessageReceiver InnerReceiver { get { if (this.innerReceiver == null) { lock (this.syncLock) { if (this.innerReceiver == null) { this.innerReceiver = new MessageReceiver( this.Path, MessagingEntityType.Subscriber, this.ReceiveMode, this.<API key>, this.CbsTokenProvider, this.RetryPolicy, this.PrefetchCount); } } } return this.innerReceiver; } } <summary> Gets or sets the number of messages that the subscription client can simultaneously request. </summary> <value>The number of messages that the subscription client can simultaneously request.</value> public int PrefetchCount { get => this.prefetchCount; set { if (value < 0) { throw Fx.Exception.ArgumentOutOfRange(nameof(this.PrefetchCount), value, "Value cannot be less than 0."); } this.prefetchCount = value; if (this.innerReceiver != null) { this.innerReceiver.PrefetchCount = value; } } } <API key> <API key> { get; } RetryPolicy RetryPolicy { get; } ICbsTokenProvider CbsTokenProvider { get; } ReceiveMode ReceiveMode { get; } string Path { get; } public Task CloseAsync() { return this.innerReceiver?.CloseAsync(); } public async Task OnAddRuleAsync(RuleDescription description) { try { var amqpRequestMessage = AmqpRequestMessage.CreateRequest( ManagementConstants.Operations.AddRuleOperation, this.<API key>.OperationTimeout, null); amqpRequestMessage.Map[ManagementConstants.Properties.RuleName] = description.Name; amqpRequestMessage.Map[ManagementConstants.Properties.RuleDescription] = <API key>.<API key>(description); var response = await this.InnerReceiver.<API key>(amqpRequestMessage).ConfigureAwait(false); if (response.StatusCode != <API key>.OK) { throw response.<API key>(); } } catch (Exception exception) { throw AmqpExceptionHelper.GetClientException(exception); } } public async Task OnRemoveRuleAsync(string ruleName) { try { var amqpRequestMessage = AmqpRequestMessage.CreateRequest( ManagementConstants.Operations.RemoveRuleOperation, this.<API key>.OperationTimeout, null); amqpRequestMessage.Map[ManagementConstants.Properties.RuleName] = ruleName; var response = await this.InnerReceiver.<API key>(amqpRequestMessage).ConfigureAwait(false); if (response.StatusCode != <API key>.OK) { throw response.<API key>(); } } catch (Exception exception) { throw AmqpExceptionHelper.GetClientException(exception); } } public async Task<IList<RuleDescription>> OnGetRulesAsync(int top, int skip) { try { var amqpRequestMessage = AmqpRequestMessage.CreateRequest( ManagementConstants.Operations.<API key>, this.<API key>.OperationTimeout, null); amqpRequestMessage.Map[ManagementConstants.Properties.Top] = top; amqpRequestMessage.Map[ManagementConstants.Properties.Skip] = skip; var response = await this.InnerReceiver.<API key>(amqpRequestMessage).ConfigureAwait(false); var ruleDescriptions = new List<RuleDescription>(); if (response.StatusCode == <API key>.OK) { var ruleList = response.GetListValue<AmqpMap>(ManagementConstants.Properties.Rules); foreach (var entry in ruleList) { var amqpRule = (<API key>)entry[ManagementConstants.Properties.RuleDescription]; var ruleDescription = <API key>.GetRuleDescription(amqpRule); ruleDescriptions.Add(ruleDescription); } } else if (response.StatusCode == <API key>.NoContent) { // Do nothing. Return empty list; } else { throw response.<API key>(); } return ruleDescriptions; } catch (Exception exception) { throw AmqpExceptionHelper.GetClientException(exception); } } } }
-- Function to test: Receive -- Test against: Sending network card rate. local luaunit = require "luaunit" local dpdk = require "dpdk" local memory = require "memory" local device = require "device" local timer = require "timer" local stats = require "stats" local log = require "testlog" local testlib = require "testlib" local tconfig = require "tconfig" local PKT_SIZE = 124 function master() log:info( "Function to test: Receive" ) testlib:setRuntime( 10 ) testlib:masterPairMulti() end function slave1( txDev, rxDev ) -- Init queue local txQueue = txDev:getTxQueue( 0 ) -- Init memory & bufs local mem = memory.createMemPool( function( buf ) buf:getEthernetPacket():fill{ pktLength = PKT_SIZE, ethSrc = txQueue, ethDst = "10:11:12:13:14:15" } end) local bufs = mem:bufArray() -- Init counter & timer local ctr = stats:newDevTxCounter( txDev , "plain" ) local runtime = timer:new( testlib.getRuntime() ) -- Send packets while dpdk.running() and runtime:running() do bufs:alloc( PKT_SIZE ) txQueue:send( bufs ) ctr:update() end -- Finalize counter and get stats ctr:finalize() local x , mbit = ctr:getStats() -- Return measured rate return mbit.avg end function slave2( txDev , rxDev ) -- Init queue local queue = rxDev:getRxQueue( 0 ) -- Init bufs local bufs = memory.bufArray() -- Init counter & timer local ctr = stats:newManualRxCounter(queue.dev, "plain") local runtime = timer:new(10) -- Receive packets while runtime:running() and dpdk.running() do local rx = queue:tryRecv(bufs, 10) bufs:freeAll() ctr:updateWithSize(rx, PKT_SIZE) end -- Finalize counter and get stats ctr:finalize() local x , mbit = ctr:getStats() -- Return measured rate return mbit.avg end -- Compare measured rates function compare( sRate , rRate ) -- Round receive rate down return2 = math.floor( rRate ) -- Round max rate down | substract 10 MBit/s (max. 1% of rate). srate = math.floor( math.min( sRate - 10 , sRate * 99 / 100 ) ) -- Compare rates log:info( "Expected receive rate: " .. math.floor( sRate ) .. " MBit/s" ) if ( sRate > rRate ) then log:warn( "Measured receive rate: " .. rRate .. " MBit/s | Missing: " .. sRate - rRate .. " MBit/s") else log:info( "Measured receive rate: " .. math.floor( sRate ) .. " MBit/s") end -- Return result return sRate <= rRate end
require 'support/doubled_classes' module RSpec module Mocks RSpec.describe 'An instance double with the doubled class loaded' do include_context "with isolated configuration" before do RSpec::Mocks.configuration.<API key> = true end it 'only allows instance methods that exist to be stubbed' do o = instance_double('LoadedClass', :<API key> => 1) expect(o.<API key>).to eq(1) prevents(/does not implement the instance method/) { allow(o).to receive(:<API key>) } prevents(/does not implement the instance method/) { allow(o).to receive(:<API key>) } end it 'only allows instance methods that exist to be expected' do o = instance_double('LoadedClass') expect(o).to receive(:<API key>) o.<API key> prevents { expect(o).to receive(:<API key>) } prevents { expect(o).to receive(:<API key>) } prevents { expect(o).to receive(:<API key>) } prevents { expect(o).to receive(:<API key>) } end <API key> = "Perhaps you meant to use `class_double`" it "suggests using `class_double` when a class method is stubbed" do o = instance_double("LoadedClass") prevents(a_string_including(<API key>)) { allow(o).to receive(:<API key>) } end it "doesn't suggest `class_double` when a non-class method is stubbed" do o = instance_double("LoadedClass") prevents(a_string_excluding(<API key>)) { allow(o).to receive(:<API key>) } end it 'allows `send` to be stubbed if it is defined on the class' do o = instance_double('LoadedClass') allow(o).to receive(:send).and_return("received") expect(o.send(:msg)).to eq("received") end it 'gives a descriptive error message for NoMethodError' do o = instance_double("LoadedClass") expect { o.<API key> }.to raise_error(NoMethodError, a_string_including("InstanceDouble(LoadedClass)")) end it 'does not allow dynamic methods to be expected' do # This isn't possible at the moment since an instance of the class # would be required for the verification, and we only have the # class itself. # This spec exists as "negative" documentation of the absence of a # feature, to highlight the asymmetry from class doubles (that do # support this behaviour). prevents { instance_double('LoadedClass', :<API key> => 1) } end it 'checks the arity of stubbed methods' do o = instance_double('LoadedClass') prevents { expect(o).to receive(:<API key>).with(:a) } reset o end it 'checks that stubbed methods are invoked with the correct arity' do o = instance_double('LoadedClass', :<API key> => 25) expect { o.<API key>(:a) }.to raise_error(ArgumentError, "Wrong number of arguments. Expected 0, got 1.") end if <API key>? it 'allows keyword arguments' do o = instance_double('LoadedClass', :kw_args_method => true) expect(o.kw_args_method(1, :required_arg => 'something')).to eq(true) end context 'for a method that only accepts keyword args' do it 'allows hash matchers like `hash_including` to be used in place of the keywords arg hash' do o = instance_double('LoadedClass') expect(o).to receive(:kw_args_method). with(1, hash_including(:required_arg => 1)) o.kw_args_method(1, :required_arg => 1) end it 'allows anything matcher to be used in place of the keywords arg hash' do o = instance_double('LoadedClass') expect(o).to receive(:kw_args_method).with(1, anything) o.kw_args_method(1, :required_arg => 1) end it 'still checks positional arguments when matchers used for keyword args' do o = instance_double('LoadedClass') prevents(/Expected 1, got 3/) { expect(o).to receive(:kw_args_method). with(1, 2, 3, hash_including(:required_arg => 1)) } reset o end it 'does not allow matchers to be used in an actual method call' do o = instance_double('LoadedClass') matcher = hash_including(:required_arg => 1) allow(o).to receive(:kw_args_method).with(1, matcher) expect { o.kw_args_method(1, matcher) }.to raise_error(ArgumentError) end end context 'for a method that accepts a mix of optional keyword and positional args' do it 'allows hash matchers like `hash_including` to be used in place of the keywords arg hash' do o = instance_double('LoadedClass') expect(o).to receive(:mixed_args_method).with(1, 2, hash_including(:optional_arg_1 => 1)) o.mixed_args_method(1, 2, :optional_arg_1 => 1) end end it 'checks that stubbed methods with required keyword args are ' + 'invoked with the required arguments' do o = instance_double('LoadedClass', :kw_args_method => true) expect { o.kw_args_method(:optional_arg => 'something') }.to raise_error(ArgumentError) end end it 'validates `with` args against the method signature when stubbing a method' do dbl = instance_double(LoadedClass) prevents(/Wrong number of arguments. Expected 2, got 3./) { allow(dbl).to receive(:<API key>).with(3, :foo, :args) } end it 'allows class to be specified by constant' do o = instance_double(LoadedClass, :<API key> => 1) expect(o.<API key>).to eq(1) end context "when the class const has been previously stubbed" do before { class_double(LoadedClass).as_stubbed_const } it "uses the original class to verify against for `instance_double('LoadedClass')`" do o = instance_double("LoadedClass") allow(o).to receive(:<API key>) prevents { allow(o).to receive(:undefined_method) } end it "uses the original class to verify against for `instance_double(LoadedClass)`" do o = instance_double(LoadedClass) allow(o).to receive(:<API key>) prevents { allow(o).to receive(:undefined_method) } end end context "when given a class that has an overriden `#name` method" do it "properly verifies" do o = instance_double(<API key>) allow(o).to receive(:<API key>) prevents { allow(o).to receive(:undefined_method) } end end context 'for null objects' do let(:obj) { instance_double('LoadedClass').as_null_object } it 'only allows defined methods' do expect(obj.<API key>).to eq(obj) prevents { obj.undefined_method } prevents { obj.send(:undefined_method) } prevents { obj.__send__(:undefined_method) } end it 'verifies arguments' do expect { obj.<API key>(:too, :many, :args) }.to raise_error(ArgumentError, "Wrong number of arguments. Expected 0, got 3.") end it "includes the double's name in a private method error" do expect { obj.rand }.to raise_error(NoMethodError, a_string_including("private", "InstanceDouble(LoadedClass)")) end it 'reports what public messages it responds to accurately' do expect(obj.respond_to?(:<API key>)).to be true expect(obj.respond_to?(:<API key>, true)).to be true expect(obj.respond_to?(:<API key>, false)).to be true expect(obj.respond_to?(:undefined_method)).to be false expect(obj.respond_to?(:undefined_method, true)).to be false expect(obj.respond_to?(:undefined_method, false)).to be false end it 'reports that it responds to defined private methods when the appropriate arg is passed' do expect(obj.respond_to?(:<API key>)).to be false expect(obj.respond_to?(:<API key>, true)).to be true expect(obj.respond_to?(:<API key>, false)).to be false end if RUBY_VERSION.to_f < 2.0 # respond_to?(:protected_method) changed behavior in Ruby 2.0. it 'reports that it responds to protected methods' do expect(obj.respond_to?(:<API key>)).to be true expect(obj.respond_to?(:<API key>, true)).to be true expect(obj.respond_to?(:<API key>, false)).to be true end else it 'reports that it responds to protected methods when the appropriate arg is passed' do expect(obj.respond_to?(:<API key>)).to be false expect(obj.respond_to?(:<API key>, true)).to be true expect(obj.respond_to?(:<API key>, false)).to be false end end end end end end
#!/bin/bash wget -N https://berlintemplates.blob.core.windows.net/arm-templates/<API key>/scripts/configure-geth.sh wget -N https://berlintemplates.blob.core.windows.net/arm-templates/<API key>/scripts/<API key>.sh wget -N https://berlintemplates.blob.core.windows.net/arm-templates/<API key>/scripts/helpers/attach-geth.sh wget -N https://berlintemplates.blob.core.windows.net/arm-templates/<API key>/scripts/helpers/start.sh wget -N https://berlintemplates.blob.core.windows.net/arm-templates/<API key>/scripts/helpers/stop.sh wget -N https://berlintemplates.blob.core.windows.net/arm-templates/<API key>/scripts/helpers/getenodeurl.sh chmod 744 configure-geth.sh <API key>.sh attach-geth.sh start.sh stop.sh getenodeurl.sh
# encoding: utf-8 require 'test_helper' class Filters include Liquid::StandardFilters end class TestThing attr_reader :foo def initialize @foo = 0 end def to_s "woot: #{@foo}" end def [](whatever) to_s end def to_liquid @foo += 1 self end end class TestDrop < Liquid::Drop def test "testfoo" end end class TestEnumerable < Liquid::Drop include Enumerable def each(&block) [ { "foo" => 1, "bar" => 2 }, { "foo" => 2, "bar" => 1 }, { "foo" => 3, "bar" => 3 } ].each(&block) end end class NumberLikeThing < Liquid::Drop def initialize(amount) @amount = amount end def to_number @amount end end class StandardFiltersTest < Minitest::Test include Liquid def setup @filters = Filters.new end def test_size assert_equal 3, @filters.size([1, 2, 3]) assert_equal 0, @filters.size([]) assert_equal 0, @filters.size(nil) end def test_downcase assert_equal 'testing', @filters.downcase("Testing") assert_equal '', @filters.downcase(nil) end def test_upcase assert_equal 'TESTING', @filters.upcase("Testing") assert_equal '', @filters.upcase(nil) end def test_slice assert_equal 'oob', @filters.slice('foobar', 1, 3) assert_equal 'oobar', @filters.slice('foobar', 1, 1000) assert_equal '', @filters.slice('foobar', 1, 0) assert_equal 'o', @filters.slice('foobar', 1, 1) assert_equal 'bar', @filters.slice('foobar', 3, 3) assert_equal 'ar', @filters.slice('foobar', -2, 2) assert_equal 'ar', @filters.slice('foobar', -2, 1000) assert_equal 'r', @filters.slice('foobar', -1) assert_equal '', @filters.slice(nil, 0) assert_equal '', @filters.slice('foobar', 100, 10) assert_equal '', @filters.slice('foobar', -100, 10) assert_equal 'oob', @filters.slice('foobar', '1', '3') assert_raises(Liquid::ArgumentError) do @filters.slice('foobar', nil) end assert_raises(Liquid::ArgumentError) do @filters.slice('foobar', 0, "") end end def <API key> input = 'foobar'.split( assert_equal %w(o o b), @filters.slice(input, 1, 3) assert_equal %w(o o b a r), @filters.slice(input, 1, 1000) assert_equal %w(), @filters.slice(input, 1, 0) assert_equal %w(o), @filters.slice(input, 1, 1) assert_equal %w(b a r), @filters.slice(input, 3, 3) assert_equal %w(a r), @filters.slice(input, -2, 2) assert_equal %w(a r), @filters.slice(input, -2, 1000) assert_equal %w(r), @filters.slice(input, -1) assert_equal %w(), @filters.slice(input, 100, 10) assert_equal %w(), @filters.slice(input, -100, 10) end def test_truncate assert_equal '1234...', @filters.truncate('1234567890', 7) assert_equal '1234567890', @filters.truncate('1234567890', 20) assert_equal '...', @filters.truncate('1234567890', 0) assert_equal '1234567890', @filters.truncate('1234567890') assert_equal "...", @filters.truncate("", 5) assert_equal '12341', @filters.truncate("1234567890", 5, 1) end def test_split assert_equal ['12', '34'], @filters.split('12~34', '~') assert_equal ['A? ', ' ,Z'], @filters.split('A? ~ ~ ~ ,Z', '~ ~ ~') assert_equal ['A?Z'], @filters.split('A?Z', '~') assert_equal [], @filters.split(nil, ' ') assert_equal ['A', 'Z'], @filters.split('A1Z', 1) end def test_escape assert_equal '&lt;strong&gt;', @filters.escape('<strong>') assert_equal '1', @filters.escape(1) assert_equal '2001-02-03', @filters.escape(Date.new(2001, 2, 3)) assert_nil @filters.escape(nil) end def test_h assert_equal '&lt;strong&gt;', @filters.h('<strong>') assert_equal '1', @filters.h(1) assert_equal '2001-02-03', @filters.h(Date.new(2001, 2, 3)) assert_nil @filters.h(nil) end def test_escape_once assert_equal '&lt;strong&gt;Hulk&lt;/strong&gt;', @filters.escape_once('&lt;strong&gt;Hulk</strong>') end def test_url_encode assert_equal 'foo%2B1%40example.com', @filters.url_encode('foo+1@example.com') assert_equal '1', @filters.url_encode(1) assert_equal '2001-02-03', @filters.url_encode(Date.new(2001, 2, 3)) assert_nil @filters.url_encode(nil) end def test_url_decode assert_equal 'foo bar', @filters.url_decode('foo+bar') assert_equal 'foo bar', @filters.url_decode('foo%20bar') assert_equal 'foo+1@example.com', @filters.url_decode('foo%2B1%40example.com') assert_equal '1', @filters.url_decode(1) assert_equal '2001-02-03', @filters.url_decode(Date.new(2001, 2, 3)) assert_nil @filters.url_decode(nil) end def test_truncatewords assert_equal 'one two three', @filters.truncatewords('one two three', 4) assert_equal 'one two...', @filters.truncatewords('one two three', 2) assert_equal 'one two three', @filters.truncatewords('one two three') assert_equal 'Two small (13&#8221; x 5.5&#8221; x 10&#8221; high) baskets fit inside one large basket (13&#8221;...', @filters.truncatewords('Two small (13&#8221; x 5.5&#8221; x 10&#8221; high) baskets fit inside one large basket (13&#8221; x 16&#8221; x 10.5&#8221; high) with cover.', 15) assert_equal "", @filters.truncatewords('', 5) assert_equal 'one two1', @filters.truncatewords("one two three", 2, 1) end def test_strip_html assert_equal 'test', @filters.strip_html("<div>test</div>") assert_equal 'test', @filters.strip_html("<div id='test'>test</div>") assert_equal '', @filters.strip_html("<script type='text/javascript'>document.write('some stuff');</script>") assert_equal '', @filters.strip_html("<style type='text/css'>foo bar</style>") assert_equal 'test', @filters.strip_html("<div\nclass='multiline'>test</div>") assert_equal 'test', @filters.strip_html("<!-- foo bar \n test -->test") assert_equal '', @filters.strip_html(nil) end def test_join assert_equal '1 2 3 4', @filters.join([1, 2, 3, 4]) assert_equal '1 - 2 - 3 - 4', @filters.join([1, 2, 3, 4], ' - ') assert_equal '1121314', @filters.join([1, 2, 3, 4], 1) end def test_sort assert_equal [1, 2, 3, 4], @filters.sort([4, 3, 2, 1]) assert_equal [{ "a" => 1 }, { "a" => 2 }, { "a" => 3 }, { "a" => 4 }], @filters.sort([{ "a" => 4 }, { "a" => 3 }, { "a" => 1 }, { "a" => 2 }], "a") end def test_sort_with_nils assert_equal [1, 2, 3, 4, nil], @filters.sort([nil, 4, 3, 2, 1]) assert_equal [{ "a" => 1 }, { "a" => 2 }, { "a" => 3 }, { "a" => 4 }, {}], @filters.sort([{ "a" => 4 }, { "a" => 3 }, {}, { "a" => 1 }, { "a" => 2 }], "a") end def <API key> input = [ { "price" => 4, "handle" => "alpha" }, { "handle" => "beta" }, { "price" => 1, "handle" => "gamma" }, { "handle" => "delta" }, { "price" => 2, "handle" => "epsilon" } ] expectation = [ { "price" => 1, "handle" => "gamma" }, { "price" => 2, "handle" => "epsilon" }, { "price" => 4, "handle" => "alpha" }, { "handle" => "delta" }, { "handle" => "beta" } ] assert_equal expectation, @filters.sort(input, "price") end def test_sort_natural assert_equal ["a", "B", "c", "D"], @filters.sort_natural(["c", "D", "a", "B"]) assert_equal [{ "a" => "a" }, { "a" => "B" }, { "a" => "c" }, { "a" => "D" }], @filters.sort_natural([{ "a" => "D" }, { "a" => "c" }, { "a" => "a" }, { "a" => "B" }], "a") end def <API key> assert_equal ["a", "B", "c", "D", nil], @filters.sort_natural([nil, "c", "D", "a", "B"]) assert_equal [{ "a" => "a" }, { "a" => "B" }, { "a" => "c" }, { "a" => "D" }, {}], @filters.sort_natural([{ "a" => "D" }, { "a" => "c" }, {}, { "a" => "a" }, { "a" => "B" }], "a") end def <API key> input = [ { "price" => "4", "handle" => "alpha" }, { "handle" => "beta" }, { "price" => "1", "handle" => "gamma" }, { "handle" => "delta" }, { "price" => 2, "handle" => "epsilon" } ] expectation = [ { "price" => "1", "handle" => "gamma" }, { "price" => 2, "handle" => "epsilon" }, { "price" => "4", "handle" => "alpha" }, { "handle" => "delta" }, { "handle" => "beta" } ] assert_equal expectation, @filters.sort_natural(input, "price") end def <API key> input = [ { "key" => "X" }, { "key" => "Y" }, { "key" => "Z" }, { "fake" => "t" }, { "key" => "a" }, { "key" => "b" }, { "key" => "c" } ] expectation = [ { "key" => "a" }, { "key" => "b" }, { "key" => "c" }, { "key" => "X" }, { "key" => "Y" }, { "key" => "Z" }, { "fake" => "t" } ] assert_equal expectation, @filters.sort_natural(input, "key") assert_equal ["a", "b", "c", "X", "Y", "Z"], @filters.sort_natural(["X", "Y", "Z", "a", "b", "c"]) end def <API key> assert_equal [], @filters.sort([], "a") end def <API key> assert_equal [], @filters.sort_natural([], "a") end def <API key> assert_equal [{ a: 1, b: 2 }], @filters.sort({ a: 1, b: 2 }) end def <API key> assert_equal [2, 10], @filters.sort([10, 2]) assert_equal [{ "a" => 2 }, { "a" => 10 }], @filters.sort([{ "a" => 10 }, { "a" => 2 }], "a") assert_equal ["10", "2"], @filters.sort(["10", "2"]) assert_equal [{ "a" => "10" }, { "a" => "2" }], @filters.sort([{ "a" => "10" }, { "a" => "2" }], "a") end def test_uniq assert_equal ["foo"], @filters.uniq("foo") assert_equal [1, 3, 2, 4], @filters.uniq([1, 1, 3, 2, 3, 1, 4, 3, 2, 1]) assert_equal [{ "a" => 1 }, { "a" => 3 }, { "a" => 2 }], @filters.uniq([{ "a" => 1 }, { "a" => 3 }, { "a" => 1 }, { "a" => 2 }], "a") testdrop = TestDrop.new assert_equal [testdrop], @filters.uniq([testdrop, TestDrop.new], 'test') end def <API key> assert_equal [], @filters.uniq([], "a") end def <API key> assert_equal [], @filters.compact([], "a") end def test_reverse assert_equal [4, 3, 2, 1], @filters.reverse([1, 2, 3, 4]) end def <API key> assert_equal [{ a: 1, b: 2 }], @filters.reverse(a: 1, b: 2) end def test_map assert_equal [1, 2, 3, 4], @filters.map([{ "a" => 1 }, { "a" => 2 }, { "a" => 3 }, { "a" => 4 }], 'a') <API key> 'abc', "{{ ary | map:'foo' | map:'bar' }}", 'ary' => [{ 'foo' => { 'bar' => 'a' } }, { 'foo' => { 'bar' => 'b' } }, { 'foo' => { 'bar' => 'c' } }] end def <API key> <API key> "", '{{ "foo" | map: "__id__" }}' <API key> "", '{{ "foo" | map: "inspect" }}' end def <API key> t = TestThing.new <API key> "woot: 1", '{{ foo | map: "whatever" }}', "foo" => [t] end def test_map_on_hashes <API key> "4217", '{{ thing | map: "foo" | map: "bar" }}', "thing" => { "foo" => [ { "bar" => 42 }, { "bar" => 17 } ] } end def <API key> template = "{% assign key = 'foo' %}{{ thing | map: key | map: 'bar' }}" hash = { "foo" => { "bar" => 42 } } <API key> "42", template, "thing" => hash end def <API key> t = TestThing.new Liquid::Template.parse('{{ foo | sort: "whatever" }}').render("foo" => [t]) assert t.foo > 0 end def test_map_over_proc drop = TestDrop.new p = proc{ drop } templ = '{{ procs | map: "test" }}' <API key> "testfoo", templ, "procs" => [p] end def <API key> drops = [ { "proc" => ->{ "foo" }, }, { "proc" => ->{ "bar" }, }, ] templ = '{{ drops | map: "proc" }}' <API key> "foobar", templ, "drops" => drops end def <API key> <API key> "123", '{{ foo | map: "foo" }}', "foo" => TestEnumerable.new end def <API key> <API key> "213", '{{ foo | sort: "bar" | map: "foo" }}', "foo" => TestEnumerable.new end def <API key> <API key> 'foobar', '{{ foo | first }}', 'foo' => [ThingWithToLiquid.new] <API key> 'foobar', '{{ foo | last }}', 'foo' => [ThingWithToLiquid.new] end def <API key> <API key> "wo...", '{{ foo | truncate: 5 }}', "foo" => TestThing.new end def test_date assert_equal 'May', @filters.date(Time.parse("2006-05-05 10:00:00"), "%B") assert_equal 'June', @filters.date(Time.parse("2006-06-05 10:00:00"), "%B") assert_equal 'July', @filters.date(Time.parse("2006-07-05 10:00:00"), "%B") assert_equal 'May', @filters.date("2006-05-05 10:00:00", "%B") assert_equal 'June', @filters.date("2006-06-05 10:00:00", "%B") assert_equal 'July', @filters.date("2006-07-05 10:00:00", "%B") assert_equal '2006-07-05 10:00:00', @filters.date("2006-07-05 10:00:00", "") assert_equal '2006-07-05 10:00:00', @filters.date("2006-07-05 10:00:00", "") assert_equal '2006-07-05 10:00:00', @filters.date("2006-07-05 10:00:00", "") assert_equal '2006-07-05 10:00:00', @filters.date("2006-07-05 10:00:00", nil) assert_equal '07/05/2006', @filters.date("2006-07-05 10:00:00", "%m/%d/%Y") assert_equal "07/16/2004", @filters.date("Fri Jul 16 01:00:00 2004", "%m/%d/%Y") assert_equal "#{Date.today.year}", @filters.date('now', '%Y') assert_equal "#{Date.today.year}", @filters.date('today', '%Y') assert_equal "#{Date.today.year}", @filters.date('Today', '%Y') assert_nil @filters.date(nil, "%B") assert_equal '', @filters.date('', "%B") with_timezone("UTC") do assert_equal "07/05/2006", @filters.date(1152098955, "%m/%d/%Y") assert_equal "07/05/2006", @filters.date("1152098955", "%m/%d/%Y") end end def test_first_last assert_equal 1, @filters.first([1, 2, 3]) assert_equal 3, @filters.last([1, 2, 3]) assert_nil @filters.first([]) assert_nil @filters.last([]) end def test_replace assert_equal '2 2 2 2', @filters.replace('1 1 1 1', '1', 2) assert_equal '2 2 2 2', @filters.replace('1 1 1 1', 1, 2) assert_equal '2 1 1 1', @filters.replace_first('1 1 1 1', '1', 2) assert_equal '2 1 1 1', @filters.replace_first('1 1 1 1', 1, 2) <API key> '2 1 1 1', "{{ '1 1 1 1' | replace_first: '1', 2 }}" end def test_remove assert_equal ' ', @filters.remove("a a a a", 'a') assert_equal ' ', @filters.remove("1 1 1 1", 1) assert_equal 'a a a', @filters.remove_first("a a a a", 'a ') assert_equal ' 1 1 1', @filters.remove_first("1 1 1 1", 1) <API key> 'a a a', "{{ 'a a a a' | remove_first: 'a ' }}" end def <API key> <API key> 'foobar', "{{ 'foo|bar' | remove: '|' }}" end def test_strip <API key> 'ab c', "{{ source | strip }}", 'source' => " ab c " <API key> 'ab c', "{{ source | strip }}", 'source' => " \tab c \n \t" end def test_lstrip <API key> 'ab c ', "{{ source | lstrip }}", 'source' => " ab c " <API key> "ab c \n \t", "{{ source | lstrip }}", 'source' => " \tab c \n \t" end def test_rstrip <API key> " ab c", "{{ source | rstrip }}", 'source' => " ab c " <API key> " \tab c", "{{ source | rstrip }}", 'source' => " \tab c \n \t" end def test_strip_newlines <API key> 'abc', "{{ source | strip_newlines }}", 'source' => "a\nb\nc" <API key> 'abc', "{{ source | strip_newlines }}", 'source' => "a\r\nb\nc" end def test_newlines_to_br <API key> "a<br />\nb<br />\nc", "{{ source | newline_to_br }}", 'source' => "a\nb\nc" end def test_plus <API key> "2", "{{ 1 | plus:1 }}" <API key> "2.0", "{{ '1' | plus:'1.0' }}" <API key> "5", "{{ price | plus:'2' }}", 'price' => NumberLikeThing.new(3) end def test_minus <API key> "4", "{{ input | minus:operand }}", 'input' => 5, 'operand' => 1 <API key> "2.3", "{{ '4.3' | minus:'2' }}" <API key> "5", "{{ price | minus:'2' }}", 'price' => NumberLikeThing.new(7) end def test_abs <API key> "17", "{{ 17 | abs }}" <API key> "17", "{{ -17 | abs }}" <API key> "17", "{{ '17' | abs }}" <API key> "17", "{{ '-17' | abs }}" <API key> "0", "{{ 0 | abs }}" <API key> "0", "{{ '0' | abs }}" <API key> "17.42", "{{ 17.42 | abs }}" <API key> "17.42", "{{ -17.42 | abs }}" <API key> "17.42", "{{ '17.42' | abs }}" <API key> "17.42", "{{ '-17.42' | abs }}" end def test_times <API key> "12", "{{ 3 | times:4 }}" <API key> "0", "{{ 'foo' | times:4 }}" <API key> "6", "{{ '2.1' | times:3 | replace: '.','-' | plus:0}}" <API key> "7.25", "{{ 0.0725 | times:100 }}" <API key> "-7.25", '{{ "-0.0725" | times:100 }}' <API key> "7.25", '{{ "-0.0725" | times: -100 }}' <API key> "4", "{{ price | times:2 }}", 'price' => NumberLikeThing.new(2) end def test_divided_by <API key> "4", "{{ 12 | divided_by:3 }}" <API key> "4", "{{ 14 | divided_by:3 }}" <API key> "5", "{{ 15 | divided_by:3 }}" assert_equal "Liquid error: divided by 0", Template.parse("{{ 5 | divided_by:0 }}").render <API key> "0.5", "{{ 2.0 | divided_by:4 }}" assert_raises(Liquid::ZeroDivisionError) do <API key> "4", "{{ 1 | modulo: 0 }}" end <API key> "5", "{{ price | divided_by:2 }}", 'price' => NumberLikeThing.new(10) end def test_modulo <API key> "1", "{{ 3 | modulo:2 }}" assert_raises(Liquid::ZeroDivisionError) do <API key> "4", "{{ 1 | modulo: 0 }}" end <API key> "1", "{{ price | modulo:2 }}", 'price' => NumberLikeThing.new(3) end def test_round <API key> "5", "{{ input | round }}", 'input' => 4.6 <API key> "4", "{{ '4.3' | round }}" <API key> "4.56", "{{ input | round: 2 }}", 'input' => 4.5612 assert_raises(Liquid::FloatDomainError) do <API key> "4", "{{ 1.0 | divided_by: 0.0 | round }}" end <API key> "5", "{{ price | round }}", 'price' => NumberLikeThing.new(4.6) <API key> "4", "{{ price | round }}", 'price' => NumberLikeThing.new(4.3) end def test_ceil <API key> "5", "{{ input | ceil }}", 'input' => 4.6 <API key> "5", "{{ '4.3' | ceil }}" assert_raises(Liquid::FloatDomainError) do <API key> "4", "{{ 1.0 | divided_by: 0.0 | ceil }}" end <API key> "5", "{{ price | ceil }}", 'price' => NumberLikeThing.new(4.6) end def test_floor <API key> "4", "{{ input | floor }}", 'input' => 4.6 <API key> "4", "{{ '4.3' | floor }}" assert_raises(Liquid::FloatDomainError) do <API key> "4", "{{ 1.0 | divided_by: 0.0 | floor }}" end <API key> "5", "{{ price | floor }}", 'price' => NumberLikeThing.new(5.4) end def test_at_most <API key> "4", "{{ 5 | at_most:4 }}" <API key> "5", "{{ 5 | at_most:5 }}" <API key> "5", "{{ 5 | at_most:6 }}" <API key> "4.5", "{{ 4.5 | at_most:5 }}" <API key> "5", "{{ width | at_most:5 }}", 'width' => NumberLikeThing.new(6) <API key> "4", "{{ width | at_most:5 }}", 'width' => NumberLikeThing.new(4) <API key> "4", "{{ 5 | at_most: width }}", 'width' => NumberLikeThing.new(4) end def test_at_least <API key> "5", "{{ 5 | at_least:4 }}" <API key> "5", "{{ 5 | at_least:5 }}" <API key> "6", "{{ 5 | at_least:6 }}" <API key> "5", "{{ 4.5 | at_least:5 }}" <API key> "6", "{{ width | at_least:5 }}", 'width' => NumberLikeThing.new(6) <API key> "5", "{{ width | at_least:5 }}", 'width' => NumberLikeThing.new(4) <API key> "6", "{{ 5 | at_least: width }}", 'width' => NumberLikeThing.new(6) end def test_append assigns = { 'a' => 'bc', 'b' => 'd' } <API key>('bcd', "{{ a | append: 'd'}}", assigns) <API key>('bcd', "{{ a | append: b}}", assigns) end def test_concat assert_equal [1, 2, 3, 4], @filters.concat([1, 2], [3, 4]) assert_equal [1, 2, 'a'], @filters.concat([1, 2], ['a']) assert_equal [1, 2, 10], @filters.concat([1, 2], [10]) assert_raises(Liquid::ArgumentError, "concat filter requires an array argument") do @filters.concat([1, 2], 10) end end def test_prepend assigns = { 'a' => 'bc', 'b' => 'a' } <API key>('abc', "{{ a | prepend: 'a'}}", assigns) <API key>('abc', "{{ a | prepend: b}}", assigns) end def test_default assert_equal "foo", @filters.default("foo", "bar") assert_equal "bar", @filters.default(nil, "bar") assert_equal "bar", @filters.default("", "bar") assert_equal "bar", @filters.default(false, "bar") assert_equal "bar", @filters.default([], "bar") assert_equal "bar", @filters.default({}, "bar") end def <API key> <API key>('a', "{{ 'a' | to_number }}") end def <API key> <API key>('', "{{ '' | date: '%D' }}") <API key>('abc', "{{ 'abc' | date: '%D' }}") end private def with_timezone(tz) old_tz = ENV['TZ'] ENV['TZ'] = tz yield ensure ENV['TZ'] = old_tz end end # StandardFiltersTest
# The Original Code is mozilla.org code. # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Contributor(s): # Mark Pilgrim - port to Python # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # This library is distributed in the hope that it will be useful, # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # You should have received a copy of the GNU Lesser General Public # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA # 02110-1301 USA from .mbcharsetprober import <API key> from .codingstatemachine import CodingStateMachine from .chardistribution import <API key> from .mbcssm import EUCTW_SM_MODEL class EUCTWProber(<API key>): def __init__(self): super(EUCTWProber, self).__init__() self.coding_sm = CodingStateMachine(EUCTW_SM_MODEL) self.<API key> = <API key>() self.reset() @property def charset_name(self): return "EUC-TW" @property def language(self): return "Taiwan"
// This is not the set of all possible signals. // It IS, however, the set of all signals that trigger // an exit on either Linux or BSD systems. Linux is a // superset of the signal names supported on BSD, and // the unknown signals just fail to register, so we can // catch that easily enough. // Don't bother with SIGKILL. It's uncatchable, which // means that we can't fire any callbacks anyway. // If a user does happen to register a handler on a non- // fatal signal like SIGWINCH or something, and then // exit, it'll end up firing `process.emit('exit')`, so // the handler will be fired anyway. // SIGBUS, SIGFPE, SIGSEGV and SIGILL, when not raised // artificially, inherently leave the process in a // state from which it is not safe to try and enter JS // listeners. module.exports = [ 'SIGABRT', 'SIGALRM', 'SIGHUP', 'SIGINT', 'SIGTERM' ] if (process.platform !== 'win32') { module.exports.push( 'SIGVTALRM', 'SIGXCPU', 'SIGXFSZ', 'SIGUSR2', 'SIGTRAP', 'SIGSYS', 'SIGQUIT', 'SIGIOT' // should detect profiler and enable/disable accordingly. // see // 'SIGPROF' ) } if (process.platform === 'linux') { module.exports.push( 'SIGIO', 'SIGPOLL', 'SIGPWR', 'SIGSTKFLT', 'SIGUNUSED' ) }
using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Runtime.InteropServices.WindowsRuntime; using Windows.Foundation; using Windows.Foundation.Collections; using Windows.UI.Xaml; using Windows.UI.Xaml.Controls; using Windows.UI.Xaml.Controls.Primitives; using Windows.UI.Xaml.Data; using Windows.UI.Xaml.Input; using Windows.UI.Xaml.Media; using Windows.UI.Xaml.Navigation; namespace BlueYonderDemo { <summary> An empty page that can be used on its own or navigated to within a Frame. </summary> public sealed partial class MainPage : Page { public MainPage() { this.InitializeComponent(); PanelToggle.Click += PanelToggle_Click; } private void PanelToggle_Click(object sender, RoutedEventArgs e) { if (MenuSplitView.IsPaneOpen) { MenuSplitView.IsPaneOpen = false; if (MenuSplitView.DisplayMode == <API key>.Inline) { MenuSplitView.DisplayMode = <API key>.CompactInline; } } else { MenuSplitView.IsPaneOpen = true; } } } }
import { css, StyleSheet } from 'aphrodite/no-important'; import React, { PropTypes } from 'react'; import octicons from './octicons'; import colors from './colors'; import sizes from './sizes'; import styles from './styles'; const classes = StyleSheet.create(styles); // FIXME static octicon classes leaning on Elemental to avoid duplicate // font and CSS; inflating the project size function Glyph ({ aphroditeStyles, className, color, component: Component, name, size, style, props }) { const colorIsValidType = Object.keys(colors).includes(color); props.className = css( classes.glyph, colorIsValidType && classes['color__' + color], classes['size__' + size], aphroditeStyles ) + ` ${octicons[name]}`; if (className) { props.className += (' ' + className); } // support random color strings props.style = { color: !colorIsValidType ? color : null, style, }; return <Component {...props} />; }; Glyph.propTypes = { aphroditeStyles: PropTypes.shape({ _definition: PropTypes.object, _name: PropTypes.string, }), color: PropTypes.oneOfType([ PropTypes.oneOf(Object.keys(colors)), PropTypes.string, // support random color strings ]), name: PropTypes.oneOf(Object.keys(octicons)).isRequired, size: PropTypes.oneOf(Object.keys(sizes)), }; Glyph.defaultProps = { component: 'i', color: 'inherit', size: 'small', }; module.exports = Glyph;