query
stringlengths
4
15k
positive
stringlengths
5
373k
negative
stringlengths
5
289k
Start the asyncio event loop and runs the application.
def main(): """Start the asyncio event loop and runs the application.""" # Helper method so that the coroutine exits cleanly if an exception # happens (which would leave resources dangling) async def _run_application(loop): try: return await cli_handler(loop) except Keyboard...
def run(self, loop=None): """Actually run the application :param loop: Custom event loop or None for default """ if loop is None: loop = asyncio.get_event_loop() self.loop = loop loop.run_until_complete(self.startup()) for func in self.tasks: ...
Start the asyncio event loop and runs the application.
def main(): """Start the asyncio event loop and runs the application.""" # Helper method so that the coroutine exits cleanly if an exception # happens (which would leave resources dangling) async def _run_application(loop): try: return await cli_handler(loop) except Keyboard...
def asyncio_main_run(root_runner: BaseRunner): """ Create an ``asyncio`` event loop running in the main thread and watching runners Using ``asyncio`` to handle suprocesses requires a specific loop type to run in the main thread. This function sets up and runs the correct loop in a portable way. In ...
Start the asyncio event loop and runs the application.
def main(): """Start the asyncio event loop and runs the application.""" # Helper method so that the coroutine exits cleanly if an exception # happens (which would leave resources dangling) async def _run_application(loop): try: return await cli_handler(loop) except Keyboard...
def run(self): """Run the event loop.""" self.signal_init() self.listen_init() self.logger.info('starting') self.loop.start()
Start the asyncio event loop and runs the application.
def main(): """Start the asyncio event loop and runs the application.""" # Helper method so that the coroutine exits cleanly if an exception # happens (which would leave resources dangling) async def _run_application(loop): try: return await cli_handler(loop) except Keyboard...
def _open(file, mode='r', buffering=-1, encoding=None, errors=None, newline=None, closefd=True, opener=None, *, loop=None, executor=None): """Open an asyncio file.""" if loop is None: loop = asyncio.get_event_loop() cb = partial(sync_open, file, mode=mode, buffering=buffering, ...
Start the asyncio event loop and runs the application.
def main(): """Start the asyncio event loop and runs the application.""" # Helper method so that the coroutine exits cleanly if an exception # happens (which would leave resources dangling) async def _run_application(loop): try: return await cli_handler(loop) except Keyboard...
async function start() { if (child) { await stop(); } return new Promise((resolve) => { const serverPath = path.resolve(process.cwd(), 'packages/node_modules/@webex/test-helper-server'); child = spawn(process.argv[0], [serverPath], { env: process.env, stdio: ['ignore', 'pipe', process.st...
Initialize the pool manager with the number of pools, the entry sizes for each pool, and the maximum depth of the free pool. @param bufferEntrySizes the memory sizes of each entry in the pools @param bufferEntryDepths the maximum number of entries in the free pool
public void initialize(int[] bufferEntrySizes, int[] bufferEntryDepths) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.entry(tc, "initialize"); } // order both lists from smallest to largest, based only on Entry Sizes int len = bufferEntrySizes.lengt...
private void redistributeBuffers() throws IOException { assert Thread.holdsLock(factoryLock); // All buffers, which are not among the required ones final int numAvailableMemorySegment = totalNumberOfMemorySegments - numTotalRequiredBuffers; if (numAvailableMemorySegment == 0) { // in this case, we need to ...
Initialize the pool manager with the number of pools, the entry sizes for each pool, and the maximum depth of the free pool. @param bufferEntrySizes the memory sizes of each entry in the pools @param bufferEntryDepths the maximum number of entries in the free pool
public void initialize(int[] bufferEntrySizes, int[] bufferEntryDepths) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.entry(tc, "initialize"); } // order both lists from smallest to largest, based only on Entry Sizes int len = bufferEntrySizes.lengt...
public void registerBufferPool(BufferPool bufferPool) { checkArgument(bufferPool.getNumberOfRequiredMemorySegments() >= getNumberOfSubpartitions(), "Bug in result partition setup logic: Buffer pool has not enough guaranteed buffers for this result partition."); checkState(this.bufferPool == null, "Bug in resul...
Initialize the pool manager with the number of pools, the entry sizes for each pool, and the maximum depth of the free pool. @param bufferEntrySizes the memory sizes of each entry in the pools @param bufferEntryDepths the maximum number of entries in the free pool
public void initialize(int[] bufferEntrySizes, int[] bufferEntryDepths) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.entry(tc, "initialize"); } // order both lists from smallest to largest, based only on Entry Sizes int len = bufferEntrySizes.lengt...
public void ensureCapacity(int size) { if (size > elements.length) { reallocate(Math.max(size, 2 * elements.length)); } }
Initialize the pool manager with the number of pools, the entry sizes for each pool, and the maximum depth of the free pool. @param bufferEntrySizes the memory sizes of each entry in the pools @param bufferEntryDepths the maximum number of entries in the free pool
public void initialize(int[] bufferEntrySizes, int[] bufferEntryDepths) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.entry(tc, "initialize"); } // order both lists from smallest to largest, based only on Entry Sizes int len = bufferEntrySizes.lengt...
private void circularByteBufferInitializer(int bufferCapacity, int bufferSize, int readPosition, int writePosition) { if (bufferCapacity < 2) { throw new IllegalArgumentException("Buffer capacity must be greater than 2 !"); } if ((bufferSize < 0) || (bufferSize > bufferCapacity)) { ...
Initialize the pool manager with the number of pools, the entry sizes for each pool, and the maximum depth of the free pool. @param bufferEntrySizes the memory sizes of each entry in the pools @param bufferEntryDepths the maximum number of entries in the free pool
public void initialize(int[] bufferEntrySizes, int[] bufferEntryDepths) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.entry(tc, "initialize"); } // order both lists from smallest to largest, based only on Entry Sizes int len = bufferEntrySizes.lengt...
public static ByteBuffer allocate(int capacity) { ByteBuffer buf = ByteBuffer.allocate(capacity); buf.limit(0); return buf; }
// List lists all of the documents in an index. The documents are returned in // increasing ID order.
func (x *Index) List(c context.Context, opts *ListOptions) *Iterator { t := &Iterator{ c: c, index: x, count: -1, listInclusive: true, more: moreList, limit: -1, } if opts != nil { t.listStartID = opts.StartID if opts.Limit > 0 { t.limit = opts.Limit ...
func (tx *Tx) Indexes() ([]string, error) { if tx.db == nil { return nil, ErrTxClosed } names := make([]string, 0, len(tx.db.idxs)) for name := range tx.db.idxs { names = append(names, name) } sort.Strings(names) return names, nil }
// List lists all of the documents in an index. The documents are returned in // increasing ID order.
func (x *Index) List(c context.Context, opts *ListOptions) *Iterator { t := &Iterator{ c: c, index: x, count: -1, listInclusive: true, more: moreList, limit: -1, } if opts != nil { t.listStartID = opts.StartID if opts.Limit > 0 { t.limit = opts.Limit ...
func (o *SortOption) Indexes() []int { var ret []int for _, x := range o.orderByList { ret = append(ret, x.Index) } return ret }
// List lists all of the documents in an index. The documents are returned in // increasing ID order.
func (x *Index) List(c context.Context, opts *ListOptions) *Iterator { t := &Iterator{ c: c, index: x, count: -1, listInclusive: true, more: moreList, limit: -1, } if opts != nil { t.listStartID = opts.StartID if opts.Limit > 0 { t.limit = opts.Limit ...
func (list *TargetList) List() []TargetID { list.RLock() defer list.RUnlock() keys := []TargetID{} for k := range list.targets { keys = append(keys, k) } return keys }
// List lists all of the documents in an index. The documents are returned in // increasing ID order.
func (x *Index) List(c context.Context, opts *ListOptions) *Iterator { t := &Iterator{ c: c, index: x, count: -1, listInclusive: true, more: moreList, limit: -1, } if opts != nil { t.listStartID = opts.StartID if opts.Limit > 0 { t.limit = opts.Limit ...
func (mongo *MongoDB) List(start int, limit int) (*data.Messages, error) { messages := &data.Messages{} err := mongo.Collection.Find(bson.M{}).Skip(start).Limit(limit).Sort("-created").Select(bson.M{ "id": 1, "_id": 1, "from": 1, "to": 1, "content.headers": 1...
// List lists all of the documents in an index. The documents are returned in // increasing ID order.
func (x *Index) List(c context.Context, opts *ListOptions) *Iterator { t := &Iterator{ c: c, index: x, count: -1, listInclusive: true, more: moreList, limit: -1, } if opts != nil { t.listStartID = opts.StartID if opts.Limit > 0 { t.limit = opts.Limit ...
func (db *NodeSet) NodeList() NodeList { db.lock.RLock() defer db.lock.RUnlock() var values NodeList for _, key := range db.order { values = append(values, db.nodes[key]) } return values }
Loads the entity that holds the item type data when an Item is loaded. @param Item $item @param LifecycleEventArgs $event
public function postLoad(Item $item, LifecycleEventArgs $event) { $type = $this->itemDefinitions->getConvertedType($item->getMimeType()); $definition = $this->itemDefinitions->get($type); $repository = $event ->getEntityManager() ->getRepository($definition->getEntity...
public function prePersist(Item $item, LifecycleEventArgs $event) { $interaction = $item->getInteraction(); if (null !== $interaction) { $event->getEntityManager()->persist($interaction); } }
Loads the entity that holds the item type data when an Item is loaded. @param Item $item @param LifecycleEventArgs $event
public function postLoad(Item $item, LifecycleEventArgs $event) { $type = $this->itemDefinitions->getConvertedType($item->getMimeType()); $definition = $this->itemDefinitions->get($type); $repository = $event ->getEntityManager() ->getRepository($definition->getEntity...
protected function dispatchClassMetadataLoadedEvent(ClassMetadataInterface $classMetadata): void { if (null === $this->eventDispatcher) { return; } $this->eventDispatcher->dispatch( ClassMetadataLoadedEvent::LOADED_EVENT, new ClassMetadataLoadedEvent($cla...
Loads the entity that holds the item type data when an Item is loaded. @param Item $item @param LifecycleEventArgs $event
public function postLoad(Item $item, LifecycleEventArgs $event) { $type = $this->itemDefinitions->getConvertedType($item->getMimeType()); $definition = $this->itemDefinitions->get($type); $repository = $event ->getEntityManager() ->getRepository($definition->getEntity...
public function onLoaded(ResourceInterface $resource) { if (!$this->isDebugging() || $this->current === $resource) { return; } $this->ensureCollector($this->current); $this->meta[$this->current]->addResource($resource); }
Loads the entity that holds the item type data when an Item is loaded. @param Item $item @param LifecycleEventArgs $event
public function postLoad(Item $item, LifecycleEventArgs $event) { $type = $this->itemDefinitions->getConvertedType($item->getMimeType()); $definition = $this->itemDefinitions->get($type); $repository = $event ->getEntityManager() ->getRepository($definition->getEntity...
protected function _prepareEvent($eventName, array $data = []) { if (is_array($eventName)) { list($eventName, $subject) = $eventName; } else { $subject = new EventDispatcher(); } return new Event($eventName, $subject, $data); }
Loads the entity that holds the item type data when an Item is loaded. @param Item $item @param LifecycleEventArgs $event
public function postLoad(Item $item, LifecycleEventArgs $event) { $type = $this->itemDefinitions->getConvertedType($item->getMimeType()); $definition = $this->itemDefinitions->get($type); $repository = $event ->getEntityManager() ->getRepository($definition->getEntity...
public Resource getStoreResource(final Instance _instance, final Resource.StoreEvent _event) throws EFapsException { Resource storeRsrc = null; final Store store = Store.get(_instance.getType().getStoreId()); storeRsrc = store.getResource(_instanc...
Extract the normalized text from within an element @param fromElement @return extracted Text node (could be null)
protected Text extractText(Element fromElement) { fromElement.normalize(); NodeList fromNodeList = fromElement.getChildNodes(); Node currentNode; for (int i=0; i < fromNodeList.getLength(); ++i) { currentNode = fromNodeList.item(i); if (currentNode.getNodeType() ...
private static String getText(Element element) { if (element.getFirstChild() == null) { return ""; } return ((Text) element.getFirstChild()).getData().trim(); }
Extract the normalized text from within an element @param fromElement @return extracted Text node (could be null)
protected Text extractText(Element fromElement) { fromElement.normalize(); NodeList fromNodeList = fromElement.getChildNodes(); Node currentNode; for (int i=0; i < fromNodeList.getLength(); ++i) { currentNode = fromNodeList.item(i); if (currentNode.getNodeType() ...
private String parseXmlElement(Element element) { if(element.getFirstChild() instanceof Text) { Text text = (Text) element.getFirstChild(); return text.getData(); } return toXml(element); }
Extract the normalized text from within an element @param fromElement @return extracted Text node (could be null)
protected Text extractText(Element fromElement) { fromElement.normalize(); NodeList fromNodeList = fromElement.getChildNodes(); Node currentNode; for (int i=0; i < fromNodeList.getLength(); ++i) { currentNode = fromNodeList.item(i); if (currentNode.getNodeType() ...
public @Nonnull String text() { return new NodeListSpliterator(node.getChildNodes()).stream() .filter(it -> it instanceof Text) .map(it -> ((Text) it).getNodeValue()) .collect(joining()); }
Extract the normalized text from within an element @param fromElement @return extracted Text node (could be null)
protected Text extractText(Element fromElement) { fromElement.normalize(); NodeList fromNodeList = fromElement.getChildNodes(); Node currentNode; for (int i=0; i < fromNodeList.getLength(); ++i) { currentNode = fromNodeList.item(i); if (currentNode.getNodeType() ...
public String getContent() { String content = ""; NodeList list = dom.getChildNodes(); for (int i=0;i<list.getLength();i++) { if (list.item(i) instanceof Text) { content += (list.item(i).getNodeValue()); } } return content; }
Extract the normalized text from within an element @param fromElement @return extracted Text node (could be null)
protected Text extractText(Element fromElement) { fromElement.normalize(); NodeList fromNodeList = fromElement.getChildNodes(); Node currentNode; for (int i=0; i < fromNodeList.getLength(); ++i) { currentNode = fromNodeList.item(i); if (currentNode.getNodeType() ...
@Override public XMLObject unmarshall(Element domElement) throws UnmarshallingException { Document newDocument = null; Node childNode = domElement.getFirstChild(); while (childNode != null) { if (childNode.getNodeType() != Node.TEXT_NODE) { // We skip everything except for a text node. ...
// handle processes a request from a Multiwatcher to the storeManager.
func (sm *storeManager) handle(req *request) { if req.w.stopped { // The watcher has previously been stopped. if req.reply != nil { select { case req.reply <- false: case <-sm.tomb.Dying(): } } return } if req.reply == nil { // This is a request to stop the watcher. for req := sm.waiting[req....
func NewAckingResourceMutatorWrapper(mutator ResourceMutator, nodeToID NodeToIDFunc) *AckingResourceMutatorWrapper { return &AckingResourceMutatorWrapper{ mutator: mutator, nodeToID: nodeToID, pendingCompletions: make(map[*completion.Completion]*pendingCompletion), } }
// handle processes a request from a Multiwatcher to the storeManager.
func (sm *storeManager) handle(req *request) { if req.w.stopped { // The watcher has previously been stopped. if req.reply != nil { select { case req.reply <- false: case <-sm.tomb.Dying(): } } return } if req.reply == nil { // This is a request to stop the watcher. for req := sm.waiting[req....
func newStore() *multiwatcherStore { return &multiwatcherStore{ entities: make(map[interface{}]*list.Element), list: list.New(), } }
// handle processes a request from a Multiwatcher to the storeManager.
func (sm *storeManager) handle(req *request) { if req.w.stopped { // The watcher has previously been stopped. if req.reply != nil { select { case req.reply <- false: case <-sm.tomb.Dying(): } } return } if req.reply == nil { // This is a request to stop the watcher. for req := sm.waiting[req....
func New(s store.Store, ctx context.Context) (watcher.Watcher, error) { return watcher.New(s, ctx, KEY, convert, invertKey) }
// handle processes a request from a Multiwatcher to the storeManager.
func (sm *storeManager) handle(req *request) { if req.w.stopped { // The watcher has previously been stopped. if req.reply != nil { select { case req.reply <- false: case <-sm.tomb.Dying(): } } return } if req.reply == nil { // This is a request to stop the watcher. for req := sm.waiting[req....
func (c *Cacher) Watch(ctx context.Context, key string, resourceVersion string, pred storage.SelectionPredicate) (watch.Interface, error) { watchRV, err := c.versioner.ParseResourceVersion(resourceVersion) if err != nil { return nil, err } c.ready.wait() triggerValue, triggerSupported := "", false // TODO: Cu...
// handle processes a request from a Multiwatcher to the storeManager.
func (sm *storeManager) handle(req *request) { if req.w.stopped { // The watcher has previously been stopped. if req.reply != nil { select { case req.reply <- false: case <-sm.tomb.Dying(): } } return } if req.reply == nil { // This is a request to stop the watcher. for req := sm.waiting[req....
func (mux *ServeMux) Handler(r *Request) Handler { var matcher Matcher var entry *muxEntry // Acquire a read lock to ensure that list would not // be modified during the search of registered handler. mux.mu.RLock() var matched bool // Try to match the processing request to any of the registered // filters. f...
// Limit returns true if rate was exceeded
func (rl *RateLimiter) Limit() bool { // Calculate the number of ns that have passed since our last call now := unixNano() passed := now - atomic.SwapUint64(&rl.lastCheck, now) // Add them to our allowance rate := atomic.LoadUint64(&rl.rate) current := atomic.AddUint64(&rl.allowance, passed*rate) // Ensure our...
func LimitFuncHandler(lmt *limiter.Limiter, nextFunc func(http.ResponseWriter, *http.Request)) http.Handler { return LimitHandler(lmt, http.HandlerFunc(nextFunc)) }
// Limit returns true if rate was exceeded
func (rl *RateLimiter) Limit() bool { // Calculate the number of ns that have passed since our last call now := unixNano() passed := now - atomic.SwapUint64(&rl.lastCheck, now) // Add them to our allowance rate := atomic.LoadUint64(&rl.rate) current := atomic.AddUint64(&rl.allowance, passed*rate) // Ensure our...
func (r *RateLimiter) Limit(dataSize int) time.Duration { r.lock.Lock() defer r.lock.Unlock() // update time var duration time.Duration = time.Duration(0) if r.bandwidth == 0 { return duration } current := time.Now() elapsedTime := current.Sub(r.lastUpdate) r.lastUpdate = current allowance := r.allowance ...
// Limit returns true if rate was exceeded
func (rl *RateLimiter) Limit() bool { // Calculate the number of ns that have passed since our last call now := unixNano() passed := now - atomic.SwapUint64(&rl.lastCheck, now) // Add them to our allowance rate := atomic.LoadUint64(&rl.rate) current := atomic.AddUint64(&rl.allowance, passed*rate) // Ensure our...
func UsingRateLimit(rps float64) Option { return func(api *API) error { // because ratelimiter doesnt do any windowing // setting burst makes it difficult to enforce a fixed rate // so setting it equal to 1 this effectively disables bursting // this doesn't check for sensible values, ultimately the api will en...
// Limit returns true if rate was exceeded
func (rl *RateLimiter) Limit() bool { // Calculate the number of ns that have passed since our last call now := unixNano() passed := now - atomic.SwapUint64(&rl.lastCheck, now) // Add them to our allowance rate := atomic.LoadUint64(&rl.rate) current := atomic.AddUint64(&rl.allowance, passed*rate) // Ensure our...
func isResourceGuaranteed(container *api.Container, resource api.ResourceName) bool { // A container resource is guaranteed if its request == limit. // If request == limit, the user is very confident of resource consumption. req, hasReq := container.Resources.Requests[resource] limit, hasLimit := container.Resource...
// Limit returns true if rate was exceeded
func (rl *RateLimiter) Limit() bool { // Calculate the number of ns that have passed since our last call now := unixNano() passed := now - atomic.SwapUint64(&rl.lastCheck, now) // Add them to our allowance rate := atomic.LoadUint64(&rl.rate) current := atomic.AddUint64(&rl.allowance, passed*rate) // Ensure our...
func admitImage(size int64, limit corev1.LimitRangeItem) error { if limit.Type != imagev1.LimitTypeImage { return nil } limitQuantity, ok := limit.Max[corev1.ResourceStorage] if !ok { return nil } imageQuantity := resource.NewQuantity(size, resource.BinarySI) if limitQuantity.Cmp(*imageQuantity) < 0 { //...
Modify to the last occurrence of a given day of the week in the current quarter. If no day_of_week is provided, modify to the last day of the quarter. Use the supplied consts to indicate the desired day_of_week, ex. DateTime.MONDAY. :type day_of_week: int or None :rtype: DateTi...
def _last_of_quarter(self, day_of_week=None): """ Modify to the last occurrence of a given day of the week in the current quarter. If no day_of_week is provided, modify to the last day of the quarter. Use the supplied consts to indicate the desired day_of_week, ex. DateTime.MONDA...
def previous(self, day_of_week=None): """ Modify to the previous occurrence of a given day of the week. If no day_of_week is provided, modify to the previous occurrence of the current day of the week. Use the supplied consts to indicate the desired day_of_week, ex. pendulum.MOND...
Modify to the last occurrence of a given day of the week in the current quarter. If no day_of_week is provided, modify to the last day of the quarter. Use the supplied consts to indicate the desired day_of_week, ex. DateTime.MONDAY. :type day_of_week: int or None :rtype: DateTi...
def _last_of_quarter(self, day_of_week=None): """ Modify to the last occurrence of a given day of the week in the current quarter. If no day_of_week is provided, modify to the last day of the quarter. Use the supplied consts to indicate the desired day_of_week, ex. DateTime.MONDA...
def next(self, day_of_week=None, keep_time=False): """ Modify to the next occurrence of a given day of the week. If no day_of_week is provided, modify to the next occurrence of the current day of the week. Use the supplied consts to indicate the desired day_of_week, ex. DateTime...
Modify to the last occurrence of a given day of the week in the current quarter. If no day_of_week is provided, modify to the last day of the quarter. Use the supplied consts to indicate the desired day_of_week, ex. DateTime.MONDAY. :type day_of_week: int or None :rtype: DateTi...
def _last_of_quarter(self, day_of_week=None): """ Modify to the last occurrence of a given day of the week in the current quarter. If no day_of_week is provided, modify to the last day of the quarter. Use the supplied consts to indicate the desired day_of_week, ex. DateTime.MONDA...
def day(self, num): """Return the given day of week as a date object. Day 0 is the Monday.""" d = date(self.year, 1, 4) # The Jan 4th must be in week 1 according to ISO return d + timedelta(weeks=self.week-1, days=-d.weekday() + num)
Modify to the last occurrence of a given day of the week in the current quarter. If no day_of_week is provided, modify to the last day of the quarter. Use the supplied consts to indicate the desired day_of_week, ex. DateTime.MONDAY. :type day_of_week: int or None :rtype: DateTi...
def _last_of_quarter(self, day_of_week=None): """ Modify to the last occurrence of a given day of the week in the current quarter. If no day_of_week is provided, modify to the last day of the quarter. Use the supplied consts to indicate the desired day_of_week, ex. DateTime.MONDA...
def get_period_last_3_months() -> str: """ Returns the last week as a period string """ today = Datum() today.today() # start_date = today - timedelta(weeks=13) start_date = today.clone() start_date.subtract_months(3) period = get_period(start_date.date, today.date) return period
Modify to the last occurrence of a given day of the week in the current quarter. If no day_of_week is provided, modify to the last day of the quarter. Use the supplied consts to indicate the desired day_of_week, ex. DateTime.MONDAY. :type day_of_week: int or None :rtype: DateTi...
def _last_of_quarter(self, day_of_week=None): """ Modify to the last occurrence of a given day of the week in the current quarter. If no day_of_week is provided, modify to the last day of the quarter. Use the supplied consts to indicate the desired day_of_week, ex. DateTime.MONDA...
def get_last_weekday_in_month(year, month, weekday): """Get the last weekday in a given month. e.g: >>> # the last monday in Jan 2013 >>> Calendar.get_last_weekday_in_month(2013, 1, MON) datetime.date(2013, 1, 28) """ day = date(year, month, monthrange(year, month)[1]) ...
Compile Sass content using Leafo's ScssPhp compiler. @link https://github.com/leafo/scssphp @param string $content Content to compile. @param array $directories The import directories to make available when compiling. @return string Compiled Sass content.
private static function compileSassContentWithLeafoScss(string $content, array $directories) { if (empty($content)) { return ''; } if (self::$sassCompilerInstance == null) { self::$sassCompilerInstance = self::getLeafoScssInstance(); } self::u...
def compile_sass(self, sass_filename, sass_fileurl): """ Compile the given SASS file into CSS """ compile_kwargs = { 'filename': sass_filename, 'include_paths': SassProcessor.include_paths + APPS_INCLUDE_DIRS, 'custom_functions': get_custom_functions()...
Compile Sass content using Leafo's ScssPhp compiler. @link https://github.com/leafo/scssphp @param string $content Content to compile. @param array $directories The import directories to make available when compiling. @return string Compiled Sass content.
private static function compileSassContentWithLeafoScss(string $content, array $directories) { if (empty($content)) { return ''; } if (self::$sassCompilerInstance == null) { self::$sassCompilerInstance = self::getLeafoScssInstance(); } self::u...
def compile_scss_normal Dir["#{@path}.scss"].select { |f| File.file? f }.each do |file| next if File.basename(file).chr == '_' scss_file = File.open(file, 'rb') { |f| f.read } output_file = File.open( file.split('.').reverse.drop(1).reverse.join('.'), "w" ) output_file <...
Compile Sass content using Leafo's ScssPhp compiler. @link https://github.com/leafo/scssphp @param string $content Content to compile. @param array $directories The import directories to make available when compiling. @return string Compiled Sass content.
private static function compileSassContentWithLeafoScss(string $content, array $directories) { if (empty($content)) { return ''; } if (self::$sassCompilerInstance == null) { self::$sassCompilerInstance = self::getLeafoScssInstance(); } self::u...
public static function css_files(array $files) { if (empty($files)) { return ''; } $compressed = array(); foreach ($files as $file) { $content = file_get_contents($file); if ($content === false) { $compressed[] = "\n\n/* Cannot read CS...
Compile Sass content using Leafo's ScssPhp compiler. @link https://github.com/leafo/scssphp @param string $content Content to compile. @param array $directories The import directories to make available when compiling. @return string Compiled Sass content.
private static function compileSassContentWithLeafoScss(string $content, array $directories) { if (empty($content)) { return ''; } if (self::$sassCompilerInstance == null) { self::$sassCompilerInstance = self::getLeafoScssInstance(); } self::u...
public function process($source, $force = true) { list ($webRoot, $source) = $this->_findWebRoot($source); $lessFile = FS::clean($webRoot . Configure::read('App.lessBaseUrl') . $source, '/'); $this->_setForce($force); $less = new Less($this->_config); if (!FS::isFile($lessF...
Compile Sass content using Leafo's ScssPhp compiler. @link https://github.com/leafo/scssphp @param string $content Content to compile. @param array $directories The import directories to make available when compiling. @return string Compiled Sass content.
private static function compileSassContentWithLeafoScss(string $content, array $directories) { if (empty($content)) { return ''; } if (self::$sassCompilerInstance == null) { self::$sassCompilerInstance = self::getLeafoScssInstance(); } self::u...
def render_css(self, fn=None, text=None, margin='', indent='\t'): """output css using the Sass processor""" fn = fn or os.path.splitext(self.fn)[0]+'.css' if not os.path.exists(os.path.dirname(fn)): os.makedirs(os.path.dirname(fn)) curdir = os.path.abspath(os.curdir) ...
Reset the date to the last day of the decade. :rtype: Date
def _end_of_decade(self): """ Reset the date to the last day of the decade. :rtype: Date """ year = self.year - self.year % YEARS_PER_DECADE + YEARS_PER_DECADE - 1 return self.set(year, 12, 31)
private Date[] getBeforeDays(int year, int month) { Calendar cal = Calendar.getInstance(); cal.set(year, month, 1); int dayNum = getDayIndex(year, month, 1) - 1; Date[] date = new Date[dayNum]; if (dayNum > 0) for (int i = 0; i < dayNum; i++) { cal.add...
Reset the date to the last day of the decade. :rtype: Date
def _end_of_decade(self): """ Reset the date to the last day of the decade. :rtype: Date """ year = self.year - self.year % YEARS_PER_DECADE + YEARS_PER_DECADE - 1 return self.set(year, 12, 31)
def yesterday(date=None): """yesterday once more""" if not date: return _date - datetime.timedelta(days=1) else: current_date = parse(date) return current_date - datetime.timedelta(days=1)
Reset the date to the last day of the decade. :rtype: Date
def _end_of_decade(self): """ Reset the date to the last day of the decade. :rtype: Date """ year = self.year - self.year % YEARS_PER_DECADE + YEARS_PER_DECADE - 1 return self.set(year, 12, 31)
def rollforward(self, date): """Roll date forward to nearest start of year""" if self.onOffset(date): return date else: return date + YearBegin(month=self.month)
Reset the date to the last day of the decade. :rtype: Date
def _end_of_decade(self): """ Reset the date to the last day of the decade. :rtype: Date """ year = self.year - self.year % YEARS_PER_DECADE + YEARS_PER_DECADE - 1 return self.set(year, 12, 31)
def today(year=None): """this day, last year""" return datetime.date(int(year), _date.month, _date.day) if year else _date
Reset the date to the last day of the decade. :rtype: Date
def _end_of_decade(self): """ Reset the date to the last day of the decade. :rtype: Date """ year = self.year - self.year % YEARS_PER_DECADE + YEARS_PER_DECADE - 1 return self.set(year, 12, 31)
def gday_of_year(self): """Return the number of days since January 1 of the given year.""" return (self.date - dt.date(self.date.year, 1, 1)).days
Puts an archive data row in an index.
private function putRowInIndex(&$index, $metadataNamesToIndexBy, $row, $idSite, $period) { $currentLevel = & $index; foreach ($metadataNamesToIndexBy as $metadataName) { if ($metadataName == DataTableFactory::TABLE_METADATA_SITE_INDEX) { $key = $idSite; } els...
def _insert_row(self, i, index): """ Insert a new row in the Series. :param i: index location to insert :param index: index value to insert into the index list :return: nothing """ if i == len(self._index): self._add_row(index) else: ...
Puts an archive data row in an index.
private function putRowInIndex(&$index, $metadataNamesToIndexBy, $row, $idSite, $period) { $currentLevel = & $index; foreach ($metadataNamesToIndexBy as $metadataName) { if ($metadataName == DataTableFactory::TABLE_METADATA_SITE_INDEX) { $key = $idSite; } els...
def _index(self, row): """Add a row to the internal list of rows without writing it to disk. This function should keep the data structure consistent so it's usable for both adding new rows, and loading pre-existing histories. """ self.rows.append(row) self._keys.update(r...
Puts an archive data row in an index.
private function putRowInIndex(&$index, $metadataNamesToIndexBy, $row, $idSite, $period) { $currentLevel = & $index; foreach ($metadataNamesToIndexBy as $metadataName) { if ($metadataName == DataTableFactory::TABLE_METADATA_SITE_INDEX) { $key = $idSite; } els...
func (dt *DbfTable) InsertRecord() int { if row := dt.findSpot(); row > -1 { // undelete selected row dt.dataStore[dt.getRowOffset(row)] = 0x20 return row } return dt.AddRecord() }
Puts an archive data row in an index.
private function putRowInIndex(&$index, $metadataNamesToIndexBy, $row, $idSite, $period) { $currentLevel = & $index; foreach ($metadataNamesToIndexBy as $metadataName) { if ($metadataName == DataTableFactory::TABLE_METADATA_SITE_INDEX) { $key = $idSite; } els...
private static void writeLineToMasterIndex(FSDataOutputStream stream, long startHash, long endHash, long indexStartPos, long indexEndPos) throws IOException { String toWrite = startHash + " " + endHash + " " + indexStartPos + " " + indexEndPos + "\n"; stream.write(toWrite.getBytes()); }
Puts an archive data row in an index.
private function putRowInIndex(&$index, $metadataNamesToIndexBy, $row, $idSite, $period) { $currentLevel = & $index; foreach ($metadataNamesToIndexBy as $metadataName) { if ($metadataName == DataTableFactory::TABLE_METADATA_SITE_INDEX) { $key = $idSite; } els...
public void writeIndexes(JobKey jobKey) throws IOException { // Defensive coding if (jobKey != null) { Table historyByJobIdTable = null; try { historyByJobIdTable = hbaseConnection .getTable(TableName.valueOf(Constants.HISTORY_BY_JOBID_TABLE)); byte[] jobKeyBytes = jobKe...
Is the point near any points in the multi lat lng @param point point @param multiLatLng multi lat lng @param tolerance distance tolerance @return true if near
public static boolean isPointNearMultiLatLng(LatLng point, MultiLatLng multiLatLng, double tolerance) { boolean near = false; for (LatLng multiPoint : multiLatLng.getLatLngs()) { near = isPointNearPoint(point, multiPoint, tolerance); if (near) { break; ...
public boolean isCloseTo(GeoPoint point, double tolerance, MapView mapView) { return getCloseTo(point, tolerance, mapView) != null; }
Is the point near any points in the multi lat lng @param point point @param multiLatLng multi lat lng @param tolerance distance tolerance @return true if near
public static boolean isPointNearMultiLatLng(LatLng point, MultiLatLng multiLatLng, double tolerance) { boolean near = false; for (LatLng multiPoint : multiLatLng.getLatLngs()) { near = isPointNearPoint(point, multiPoint, tolerance); if (near) { break; ...
private function _isInTolerance($basePointIndex, $subjectPointIndex) { $radius = $this->distanceBetweenPoints( $this->points[$basePointIndex], $this->points[$subjectPointIndex] ); return $radius < $this->_tolerance; }
Is the point near any points in the multi lat lng @param point point @param multiLatLng multi lat lng @param tolerance distance tolerance @return true if near
public static boolean isPointNearMultiLatLng(LatLng point, MultiLatLng multiLatLng, double tolerance) { boolean near = false; for (LatLng multiPoint : multiLatLng.getLatLngs()) { near = isPointNearPoint(point, multiPoint, tolerance); if (near) { break; ...
public static boolean isPointOnPolyline(LatLng point, PolylineOptions polyline, boolean geodesic, double tolerance) { return PolyUtil.isLocationOnPath(point, polyline.getPoints(), geodesic, tolerance); }
Is the point near any points in the multi lat lng @param point point @param multiLatLng multi lat lng @param tolerance distance tolerance @return true if near
public static boolean isPointNearMultiLatLng(LatLng point, MultiLatLng multiLatLng, double tolerance) { boolean near = false; for (LatLng multiPoint : multiLatLng.getLatLngs()) { near = isPointNearPoint(point, multiPoint, tolerance); if (near) { break; ...
int subSimplify(PointList points, int fromIndex, int lastIndex) { if (lastIndex - fromIndex < 2) { return 0; } int indexWithMaxDist = -1; double maxDist = -1; double firstLat = points.getLatitude(fromIndex); double firstLon = points.getLongitude(fromIndex); ...
Is the point near any points in the multi lat lng @param point point @param multiLatLng multi lat lng @param tolerance distance tolerance @return true if near
public static boolean isPointNearMultiLatLng(LatLng point, MultiLatLng multiLatLng, double tolerance) { boolean near = false; for (LatLng multiPoint : multiLatLng.getLatLngs()) { near = isPointNearPoint(point, multiPoint, tolerance); if (near) { break; ...
public static double getLatitudeDistance(double minLatitude, double maxLatitude) { LatLng lowerMiddle = new LatLng(minLatitude, 0); LatLng upperMiddle = new LatLng(maxLatitude, 0); double latDistance = SphericalUtil.computeDistanceBetween(lowerMiddle,...
Gives support for Rails date_select, datetime_select, time_select helpers.
def process_attributes(attributes = nil) return attributes if attributes.blank? multi_parameter_attributes = {} new_attributes = {} attributes.each_pair do |key, value| if key.match(DATE_KEY_REGEX) match = key.to_s.match(DATE_KEY_REGEX) found_key = match[1] ...
def select_date(element, value) suffixes = { :year => '1i', :month => '2i', :day => '3i', :hour => '4i', :minute => '5i' } date = value.respond_to?(:year) ? value : Date.parse(value) browser.select "jquery=#{element}_#{suffixes[:year]}", date.year ...
Gives support for Rails date_select, datetime_select, time_select helpers.
def process_attributes(attributes = nil) return attributes if attributes.blank? multi_parameter_attributes = {} new_attributes = {} attributes.each_pair do |key, value| if key.match(DATE_KEY_REGEX) match = key.to_s.match(DATE_KEY_REGEX) found_key = match[1] ...
def select_simple_date(date_input, value, format = nil) value = value.strftime format unless format.nil? date_input.set "#{value}\e" end
Gives support for Rails date_select, datetime_select, time_select helpers.
def process_attributes(attributes = nil) return attributes if attributes.blank? multi_parameter_attributes = {} new_attributes = {} attributes.each_pair do |key, value| if key.match(DATE_KEY_REGEX) match = key.to_s.match(DATE_KEY_REGEX) found_key = match[1] ...
def draw_datetime(f, col_or_sym, options={}) col_name = get_column_name(col_or_sym) f.text_field(col_name, value: datetime_fmt(f.object.send(col_name))) end
Gives support for Rails date_select, datetime_select, time_select helpers.
def process_attributes(attributes = nil) return attributes if attributes.blank? multi_parameter_attributes = {} new_attributes = {} attributes.each_pair do |key, value| if key.match(DATE_KEY_REGEX) match = key.to_s.match(DATE_KEY_REGEX) found_key = match[1] ...
def parse_timestamps super @next_capture_at = Time.at(next_capture_at) if next_capture_at @canceled_at = Time.at(canceled_at) if canceled_at @trial_start = Time.at(trial_start) if trial_start @trial_end = Time.at(trial_end) if trial_end end
Gives support for Rails date_select, datetime_select, time_select helpers.
def process_attributes(attributes = nil) return attributes if attributes.blank? multi_parameter_attributes = {} new_attributes = {} attributes.each_pair do |key, value| if key.match(DATE_KEY_REGEX) match = key.to_s.match(DATE_KEY_REGEX) found_key = match[1] ...
public static function date_field_types() { static $field_types = null; if ( null === $field_types ) { $field_types = array( 'date', 'datetime', 'time' ); $field_types = apply_filters( 'pods_tableless_field_types', $field_types ); } return $field_types; }
read-only @language=en Set text CSS font style. @param {String} font Text CSS font style to set. @returns {Text} the Text object, chained call supported.
function(font){ var me = this; if(me.font !== font){ me.font = font; me._fontHeight = Text.measureFontHeight(font); } return me; }
function setFontFamily(fontFamily) { var editor = EditorManager.getCurrentFullEditor(); if (currFontFamily === fontFamily) { return; } _removeDynamicFontFamily(); if (fontFamily) { _addDynamicFontFamily(fontFamily); } exports.trigger("fo...
read-only @language=en Set text CSS font style. @param {String} font Text CSS font style to set. @returns {Text} the Text object, chained call supported.
function(font){ var me = this; if(me.font !== font){ me.font = font; me._fontHeight = Text.measureFontHeight(font); } return me; }
function fontSet(alias, className) { config.fontSets.push({ alias: alias, fontSet: className || alias }); return this; }
read-only @language=en Set text CSS font style. @param {String} font Text CSS font style to set. @returns {Text} the Text object, chained call supported.
function(font){ var me = this; if(me.font !== font){ me.font = font; me._fontHeight = Text.measureFontHeight(font); } return me; }
function font() { return src([`${svgDir}/*.svg`]) .pipe( iconfontCss({ fontName: config.name, path: template, targetPath: '../src/index.less', normalize: true, firstGlyph: 0xf000, cssClass: fontName // this is a trick to pass fontName to template }) ...
read-only @language=en Set text CSS font style. @param {String} font Text CSS font style to set. @returns {Text} the Text object, chained call supported.
function(font){ var me = this; if(me.font !== font){ me.font = font; me._fontHeight = Text.measureFontHeight(font); } return me; }
def _update_fontcolor(self, fontcolor): """Updates text font color button Parameters ---------- fontcolor: Integer \tText color in integer RGB format """ textcolor = wx.SystemSettings_GetColour(wx.SYS_COLOUR_WINDOWTEXT) textcolor.SetRGB(fontcolor) ...
read-only @language=en Set text CSS font style. @param {String} font Text CSS font style to set. @returns {Text} the Text object, chained call supported.
function(font){ var me = this; if(me.font !== font){ me.font = font; me._fontHeight = Text.measureFontHeight(font); } return me; }
def OnTextFont(self, event): """Text font choice event handler""" fontchoice_combobox = event.GetEventObject() idx = event.GetInt() try: font_string = fontchoice_combobox.GetString(idx) except AttributeError: font_string = event.GetString() post...
Generate a new Key in the NFVO. @param name the name of the new Key @return the private Key @throws SDKException if the request fails
@Help(help = "Generate a new Key in the NFVO") public String generateKey(String name) throws SDKException { return (String) requestPost("generate", name); }
@Help(help = "Import a Key into the NFVO by providing name and public key") public Key importKey(String name, String publicKey) throws SDKException { Key key = new Key(); key.setName(name); key.setPublicKey(publicKey); return (Key) requestPost(key); }
Generate a new Key in the NFVO. @param name the name of the new Key @return the private Key @throws SDKException if the request fails
@Help(help = "Generate a new Key in the NFVO") public String generateKey(String name) throws SDKException { return (String) requestPost("generate", name); }
private NameGenerator getNameGenerator(String namePrefix) { synchronized(this) { if (_nameGenerators == null) _nameGenerators = new HashMap<String,NameGenerator>(); NameGenerator nameGenerator = _nameGenerators.get(namePrefix); if (nameGenerator =...
Generate a new Key in the NFVO. @param name the name of the new Key @return the private Key @throws SDKException if the request fails
@Help(help = "Generate a new Key in the NFVO") public String generateKey(String name) throws SDKException { return (String) requestPost("generate", name); }
public static void generateSecretKey(KeyConfig config) throws NoSuchAlgorithmException, KeyStoreException, CertificateException, IOException { if (config == null || config.getKeyStoreFile() == null || StringUtils.isEmpty(config.getKeyEntryName()) || config.getAlgorithm() == null) { throw new KeyStor...
Generate a new Key in the NFVO. @param name the name of the new Key @return the private Key @throws SDKException if the request fails
@Help(help = "Generate a new Key in the NFVO") public String generateKey(String name) throws SDKException { return (String) requestPost("generate", name); }
public PBKey getPBKey() { if (pbKey == null) { this.pbKey = new PBKey(this.getJcdAlias(), this.getUserName(), this.getPassWord()); } return pbKey; }
Generate a new Key in the NFVO. @param name the name of the new Key @return the private Key @throws SDKException if the request fails
@Help(help = "Generate a new Key in the NFVO") public String generateKey(String name) throws SDKException { return (String) requestPost("generate", name); }
def generate_semantic_data_key(used_semantic_keys): """ Create a new and unique semantic data key :param list used_semantic_keys: Handed list of keys already in use :rtype: str :return: semantic_data_id """ semantic_data_id_counter = -1 while True: semantic_data_id_counter += 1 ...
hack for NS62 bug
function jsUnitFixTop() { var tempTop = top; if (!tempTop) { tempTop = window; while (tempTop.parent) { tempTop = tempTop.parent; if (tempTop.top && tempTop.top.jsUnitTestSuite) { tempTop = tempTop.top; break; } } } ...
@Fix(io.sarl.lang.validation.IssueCodes.INVALID_IMPLEMENTED_TYPE) public void fixInvalidImplementedType(final Issue issue, IssueResolutionAcceptor acceptor) { ImplementedTypeRemoveModification.accept(this, issue, acceptor, RemovalType.OTHER); }
hack for NS62 bug
function jsUnitFixTop() { var tempTop = top; if (!tempTop) { tempTop = window; while (tempTop.parent) { tempTop = tempTop.parent; if (tempTop.top && tempTop.top.jsUnitTestSuite) { tempTop = tempTop.top; break; } } } ...
public boolean shouldInvalidate (Object id, int sourceOfInvalidation, int causeOfInvalidation) { boolean retVal = true; if (preInvalidationListenerCount > 0) { // In external implementation, catch any exceptions and process try { retVal = currentPreInvalidationListener.shouldInv...
hack for NS62 bug
function jsUnitFixTop() { var tempTop = top; if (!tempTop) { tempTop = window; while (tempTop.parent) { tempTop = tempTop.parent; if (tempTop.top && tempTop.top.jsUnitTestSuite) { tempTop = tempTop.top; break; } } } ...
def remove(spy) if @constant_spies[spy.constant_name] == spy @constant_spies.delete(spy.constant_name) else raise NoSpyError, "#{spy.constant_name} was not stubbed on #{base_module.name}" end self end
hack for NS62 bug
function jsUnitFixTop() { var tempTop = top; if (!tempTop) { tempTop = window; while (tempTop.parent) { tempTop = tempTop.parent; if (tempTop.top && tempTop.top.jsUnitTestSuite) { tempTop = tempTop.top; break; } } } ...
def test(): """Test for ReverseDNS class""" dns = ReverseDNS() print(dns.lookup('192.168.0.1')) print(dns.lookup('8.8.8.8')) # Test cache print(dns.lookup('8.8.8.8'))
hack for NS62 bug
function jsUnitFixTop() { var tempTop = top; if (!tempTop) { tempTop = window; while (tempTop.parent) { tempTop = tempTop.parent; if (tempTop.top && tempTop.top.jsUnitTestSuite) { tempTop = tempTop.top; break; } } } ...
import re def debug(s): return re.sub(r'bug(?!s)', '', s)
Convert a file into a raid file format
public void raidFile(INode sourceINodes[], String source, RaidCodec codec, short expectedSourceRepl, Block[] parityBlocks) throws IOException { waitForReady(); long now = FSNamesystem.now(); unprotectedRaidFile(sourceINodes, source, codec, expectedSourceRepl, parityBlocks, now); ...
boolean reconstructFile(Path srcPath, Context context) throws IOException, InterruptedException { Progressable progress = context; if (progress == null) { progress = RaidUtils.NULL_PROGRESSABLE; } FileSystem fs = srcPath.getFileSystem(getConf()); FileStatus srcStat = null; try {...
Convert a file into a raid file format
public void raidFile(INode sourceINodes[], String source, RaidCodec codec, short expectedSourceRepl, Block[] parityBlocks) throws IOException { waitForReady(); long now = FSNamesystem.now(); unprotectedRaidFile(sourceINodes, source, codec, expectedSourceRepl, parityBlocks, now); ...
@Override public INodeRaidStorage convertToRaidStorage(BlockInfo[] parityBlocks, RaidCodec codec, int[] checksums, BlocksMap blocksMap, short replication, INodeFile inode) throws IOException { if (codec == null) { throw new IOException("Codec is null"); } else { return new INodeRaidSt...
Convert a file into a raid file format
public void raidFile(INode sourceINodes[], String source, RaidCodec codec, short expectedSourceRepl, Block[] parityBlocks) throws IOException { waitForReady(); long now = FSNamesystem.now(); unprotectedRaidFile(sourceINodes, source, codec, expectedSourceRepl, parityBlocks, now); ...
private static BlockLocation[] getParityBlocks(final Path filePath, final long blockSize, final long numStripes, final RaidInfo raidInfo) throws IOException { FileSystem parityFS = raid...
Convert a file into a raid file format
public void raidFile(INode sourceINodes[], String source, RaidCodec codec, short expectedSourceRepl, Block[] parityBlocks) throws IOException { waitForReady(); long now = FSNamesystem.now(); unprotectedRaidFile(sourceINodes, source, codec, expectedSourceRepl, parityBlocks, now); ...
def getpart(self, ix): """ Returns a fileobject for the specified section. This method optionally decompresses the data found in the .idb file, and returns a file-like object, with seek, read, tell. """ if self.offsets[ix] == 0: return comp...
Convert a file into a raid file format
public void raidFile(INode sourceINodes[], String source, RaidCodec codec, short expectedSourceRepl, Block[] parityBlocks) throws IOException { waitForReady(); long now = FSNamesystem.now(); unprotectedRaidFile(sourceINodes, source, codec, expectedSourceRepl, parityBlocks, now); ...
def read_raid(self, controller=None): """Get the current RAID configuration from the system. :param controller: If controller model its post-create read else post-delete :returns: current raid config. """ if controller: if not self.logical_...
Checks if an object holding the same name already exists in the index. If so, it compares their definition order: the lowest definition order is kept. If definition order equal, an error is risen.Item The method returns the item that should be added after it has decided which one shoul...
def manage_conflict(self, item, name): """ Checks if an object holding the same name already exists in the index. If so, it compares their definition order: the lowest definition order is kept. If definition order equal, an error is risen.Item The method returns the item that s...
def cmpname(name1, name2): """ Compare two CIM names for equality and ordering. The comparison is performed case-insensitively. One or both of the items may be `None`, and `None` is considered the lowest possible value. The implementation delegates to the '==' and '<' operators of the nam...
Checks if an object holding the same name already exists in the index. If so, it compares their definition order: the lowest definition order is kept. If definition order equal, an error is risen.Item The method returns the item that should be added after it has decided which one shoul...
def manage_conflict(self, item, name): """ Checks if an object holding the same name already exists in the index. If so, it compares their definition order: the lowest definition order is kept. If definition order equal, an error is risen.Item The method returns the item that s...
def is_fullfilled_by(self, other): """ Checks if the other index already fulfills all the indexing and constraint needs of the current one. :param other: The other index :type other: Index :rtype: bool """ # allow the other index to be equally large only...
Checks if an object holding the same name already exists in the index. If so, it compares their definition order: the lowest definition order is kept. If definition order equal, an error is risen.Item The method returns the item that should be added after it has decided which one shoul...
def manage_conflict(self, item, name): """ Checks if an object holding the same name already exists in the index. If so, it compares their definition order: the lowest definition order is kept. If definition order equal, an error is risen.Item The method returns the item that s...
def insert_right(self, item): 'Insert a new item. If equal keys are found, add to the right' k = self._key(item) i = bisect_right(self._keys, k) self._keys.insert(i, k) self._items.insert(i, item)
Checks if an object holding the same name already exists in the index. If so, it compares their definition order: the lowest definition order is kept. If definition order equal, an error is risen.Item The method returns the item that should be added after it has decided which one shoul...
def manage_conflict(self, item, name): """ Checks if an object holding the same name already exists in the index. If so, it compares their definition order: the lowest definition order is kept. If definition order equal, an error is risen.Item The method returns the item that s...
def has_key(cls, *args): """ Check whether flyweight object with specified key has already been created. Returns: bool: True if already created, False if not """ key = args if len(args) > 1 else args[0] return key in cls._instances
Checks if an object holding the same name already exists in the index. If so, it compares their definition order: the lowest definition order is kept. If definition order equal, an error is risen.Item The method returns the item that should be added after it has decided which one shoul...
def manage_conflict(self, item, name): """ Checks if an object holding the same name already exists in the index. If so, it compares their definition order: the lowest definition order is kept. If definition order equal, an error is risen.Item The method returns the item that s...
public KType indexReplace(int index, KType equivalentKey) { assert index >= 0 : "The index must point at an existing key."; assert index <= mask || (index == mask + 1 && hasEmptyKey); assert Intrinsics.equals(this, keys[index], equivalentKey); KType previousValue = Intrinsics.<KType> cast(ke...
Convert the alias. @param string @return LibBaseTemplateFilterAlias
public function write(&$text) { $matches = array(); if (strpos($text, '<html')) { //add language $text = str_replace('<html', '<html lang="'.$this->getService('anahita:language')->getTag().'"', $text); //render the styles $text = str_replace('</head...
protected function normalizeAlias($alias) { $normalized = preg_replace('/[^a-zA-Z0-9]/', ' ', $alias); $normalized = 'new' . str_replace(' ', '', ucwords($normalized)); return $normalized; }
Convert the alias. @param string @return LibBaseTemplateFilterAlias
public function write(&$text) { $matches = array(); if (strpos($text, '<html')) { //add language $text = str_replace('<html', '<html lang="'.$this->getService('anahita:language')->getTag().'"', $text); //render the styles $text = str_replace('</head...
public function getConvertedValue($alias = null) { if ($alias && isset($this->convertedAliasValue[$alias])) { return $this->convertedAliasValue[$alias]; } else { return $this->convertedValue; } }
Convert the alias. @param string @return LibBaseTemplateFilterAlias
public function write(&$text) { $matches = array(); if (strpos($text, '<html')) { //add language $text = str_replace('<html', '<html lang="'.$this->getService('anahita:language')->getTag().'"', $text); //render the styles $text = str_replace('</head...
private static String aliasAsUrlPattern(final String alias) { String urlPattern = alias; if (urlPattern != null && !urlPattern.equals("/") && !urlPattern.contains("*")) { if (urlPattern.endsWith("/")) { urlPattern = urlPattern + "*"; } else { urlPattern = urlPattern + "/*"; } } return urlPa...
Convert the alias. @param string @return LibBaseTemplateFilterAlias
public function write(&$text) { $matches = array(); if (strpos($text, '<html')) { //add language $text = str_replace('<html', '<html lang="'.$this->getService('anahita:language')->getTag().'"', $text); //render the styles $text = str_replace('</head...
public static String getAlias(String queryString) { Matcher m = ALIAS_PATTERN.matcher(queryString); return m.find() ? m.group(1) : null; }
Convert the alias. @param string @return LibBaseTemplateFilterAlias
public function write(&$text) { $matches = array(); if (strpos($text, '<html')) { //add language $text = str_replace('<html', '<html lang="'.$this->getService('anahita:language')->getTag().'"', $text); //render the styles $text = str_replace('</head...
public function add($original, $alias) { $alias = Input::checkAlias($alias); $this->aliases[$alias] = $original; }
Create an object URL. Given a base URL and an object name, create an object URL. This is useful because object names can contain certain characters (namely slashes (`/`)) that are normally URLencoded when they appear inside of path sequences. @note Swift does not distinguish between @c %2F and a slash character, so ...
public static function objectUrl($base, $oname) { if (strpos($oname, '/') === FALSE) { return $base . '/' . rawurlencode($oname); } $oParts = explode('/', $oname); $buffer = array(); foreach ($oParts as $part) { $buffer[] = rawurlencode($part); } $newname = implode('/', $buffer)...
public function getAddUrlFor(array $params = array()) { $params = array_merge($params, $this->getExtraParameters()); $friendlyName = explode('\\', $this->getEntityName()); $friendlyName = array_pop($friendlyName); $re = '/(?<=[a-z])(?=[A-Z])|(?<=[A-Z])(?=[A-Z][a-z])/'; $a = ...
Create an object URL. Given a base URL and an object name, create an object URL. This is useful because object names can contain certain characters (namely slashes (`/`)) that are normally URLencoded when they appear inside of path sequences. @note Swift does not distinguish between @c %2F and a slash character, so ...
public static function objectUrl($base, $oname) { if (strpos($oname, '/') === FALSE) { return $base . '/' . rawurlencode($oname); } $oParts = explode('/', $oname); $buffer = array(); foreach ($oParts as $part) { $buffer[] = rawurlencode($part); } $newname = implode('/', $buffer)...
public function standardizeUri(string $uri): string { if ($uri == '') { throw new BadMethodCallException('URI is empty'); } if (substr($uri, 0, 1) === '/') { $uri = substr($uri, 1); } $uri = preg_replace('|^https?://[^/]+/rest/(tx:[-0-9a-zA-Z]+/)?|', '', $...
Create an object URL. Given a base URL and an object name, create an object URL. This is useful because object names can contain certain characters (namely slashes (`/`)) that are normally URLencoded when they appear inside of path sequences. @note Swift does not distinguish between @c %2F and a slash character, so ...
public static function objectUrl($base, $oname) { if (strpos($oname, '/') === FALSE) { return $base . '/' . rawurlencode($oname); } $oParts = explode('/', $oname); $buffer = array(); foreach ($oParts as $part) { $buffer[] = rawurlencode($part); } $newname = implode('/', $buffer)...
public function baseUrl($targetPath = null) { if (!isset($this->baseUrl)) { throw new RuntimeException(sprintf( 'The base URI is not defined for [%s]', get_class($this) )); } if ($targetPath !== null) { return $this->create...
Create an object URL. Given a base URL and an object name, create an object URL. This is useful because object names can contain certain characters (namely slashes (`/`)) that are normally URLencoded when they appear inside of path sequences. @note Swift does not distinguish between @c %2F and a slash character, so ...
public static function objectUrl($base, $oname) { if (strpos($oname, '/') === FALSE) { return $base . '/' . rawurlencode($oname); } $oParts = explode('/', $oname); $buffer = array(); foreach ($oParts as $part) { $buffer[] = rawurlencode($part); } $newname = implode('/', $buffer)...
public static function alias( $alias, $params = array(), $retain = false ) { $route_params = array(); // to handle the suffix after a slash in an alias define $suffix = ''; if ( strpos( $alias, '/' ) !== false && $alias !== '/' ) { // slashes in aliases get appended as suffix list( $alias, $suffi...
Create an object URL. Given a base URL and an object name, create an object URL. This is useful because object names can contain certain characters (namely slashes (`/`)) that are normally URLencoded when they appear inside of path sequences. @note Swift does not distinguish between @c %2F and a slash character, so ...
public static function objectUrl($base, $oname) { if (strpos($oname, '/') === FALSE) { return $base . '/' . rawurlencode($oname); } $oParts = explode('/', $oname); $buffer = array(); foreach ($oParts as $part) { $buffer[] = rawurlencode($part); } $newname = implode('/', $buffer)...
public function qualify($url, $base) { if(!parse_url($url, PHP_URL_SCHEME)) { if ($url[0] != '/') { //Relative path $url = dirname($base) . '/' . $url; } else { //Absolute path ...