Attempts to determine the region for the bucket
@return bool|string
348038
protected function getBucketRegion() {
		if(!$this->enabled()) {
			return false;
		}

		$config = [
			'version' => 'latest',
			'credentials' => [
				'key' => $this->key,
				'secret' => $this->secret
			]
		];

		if(!empty($this->endpoint)) {
			$config['endpoint'] = $this->endpoint;
			if($this->endPointPathStyle) {
				$config['use_path_style_endpoint'] = true;
			}
		}

		$s3 = new S3MultiRegionClient($config);
		$region = false;
		try {
			$region = $s3->determineBucketRegion($this->bucket);
		}
		catch(AwsException $ex) {
			Logger::error("AWS Error fetching region", ['exception' => $ex->getMessage()]);
		}

		return $region;
	}
592374
public function getRegionCode()
    {
        $format_pattern = $this->getFormatPattern();

        if ($format_pattern !== null) {
            $matches = [];

            switch ($format_pattern) {
                case self::FORMAT_PATTERN_1: // X000XX77_OR_X000XX777
                    \preg_match('~(?<region_code>\d{2,3})$~D', $this->value, $matches);
                    break;

                case self::FORMAT_PATTERN_2: // X000XX
                    break;

                case self::FORMAT_PATTERN_3: // XX00077
                case self::FORMAT_PATTERN_4: // 0000XX77
                case self::FORMAT_PATTERN_5: // XX000077
                case self::FORMAT_PATTERN_6: // X000077
                case self::FORMAT_PATTERN_7: // 000X77
                case self::FORMAT_PATTERN_8: // 0000X77
                    \preg_match('~(?<region_code>\d{2})$~D', $this->value, $matches);
                    break;
            }

            if (isset($matches['region_code']) && ! empty($region_code = $matches['region_code'])) {
                return (int) $region_code;
            }
        }
    }
608703
private String getBucketRegionViaHeadRequest(String bucketName) {
        String bucketRegion = null;

        try {
            Request<HeadBucketRequest> request = createRequest(bucketName, null,
                    new HeadBucketRequest(bucketName), HttpMethodName.HEAD);
            request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "HeadBucket");

            HeadBucketResult result = invoke(request, new HeadBucketResultHandler(), bucketName, null, true);
            bucketRegion = result.getBucketRegion();
        } catch (AmazonS3Exception exception) {
            if (exception.getAdditionalDetails() != null) {
                bucketRegion = exception.getAdditionalDetails().get(
                    Headers.S3_BUCKET_REGION);
            }
        }

        if (bucketRegion == null && log.isDebugEnabled()) {
            log.debug("Not able to derive region of the " + bucketName + " from the HEAD Bucket requests.");
        }

        return bucketRegion;
    }
785674
public function emptyBucket()
    {

        // connect before uploading
        $connected = $this->connect();

        if (!$connected) {
            return false;
        }

        // user terminal message
        $this->console->writeln('<fg=yellow>Emptying in progress...</fg=yellow>');

        try {

            // Get the contents of the bucket for information purposes
            $contents = $this->s3_client->listObjects([
                'Bucket' => $this->getBucket(),
                'Key' => '',
            ]);

            // Check if the bucket is already empty
            if (!$contents['Contents']) {
                $this->console->writeln('<fg=green>The bucket '.$this->getBucket().' is already empty.</fg=green>');

                return true;
            }

            // Empty out the bucket
            $empty = BatchDelete::fromListObjects($this->s3_client, [
                'Bucket' => $this->getBucket(),
                'Prefix' => null,
            ]);

            $empty->delete();
        } catch (S3Exception $e) {
            $this->console->writeln('<fg=red>'.$e->getMessage().'</fg=red>');

            return false;
        }

        $this->console->writeln('<fg=green>The bucket '.$this->getBucket().' is now empty.</fg=green>');

        return true;
    }
198726
private String getRegion(String bucketName) throws InvalidBucketNameException, NoSuchAlgorithmException,
          InsufficientDataException, IOException, InvalidKeyException, NoResponseException, XmlPullParserException,
          ErrorResponseException, InternalException {
    String region;
    if (this.region == null || "".equals(this.region)) {
      updateRegionCache(bucketName);
      region = BucketRegionCache.INSTANCE.region(bucketName);
    } else {
      region = this.region;
    }
    return region;
  }
932709
public function is_empty_area() {
        if ($child = $this->get_area_backup(0, '/', '.')) {
            if (!$child->is_empty_area()) {
                return false;
            }
        }
        if ($child = $this->get_area_intro(0, '/', '.')) {
            if (!$child->is_empty_area()) {
                return false;
            }
        }

        foreach ($this->areas as $area=>$desctiption) {
            if ($child = $this->get_file_info('mod_'.$this->modname, $area, null, null, null)) {
                if (!$child->is_empty_area()) {
                    return false;
                }
            }
        }

        return true;
    }
968013
public static function getRegionBundle()
    {
        @trigger_error(sprintf('The method "%s()" is deprecated since Symfony 4.3, use "%s" instead.', __METHOD__, Regions::class), E_USER_DEPRECATED);

        if (null === self::$regionBundle) {
            self::$regionBundle = new RegionBundle(
                self::getDataDirectory().'/'.self::REGION_DIR,
                self::getEntryReader(),
                self::$localeBundle ?? self::$localeBundle = new LocaleBundle(self::getDataDirectory().'/'.self::LOCALE_DIR, self::getEntryReader())
            );
        }

        return self::$regionBundle;
    }
751536
private Region find(Region x) {
    Region current = this.root;
    while (current != NULL_NODE) {
      long res = x.orderRelativeTo(current);
      if (res < 0) {
        current = current.left;
      } else if (res > 0) {
        current = current.right;
      } else {
        return current;
      }
    }
    return null;
  }
779025
public function get_all_block_regions() {
        $regions = array();
        foreach ($this->layouts as $layoutinfo) {
            foreach ($layoutinfo['regions'] as $region) {
                $regions[$region] = $this->get_region_name($region, $this->name);
            }
        }
        return $regions;
    }
817833
def currentRegion(self):
        
        pos = QtGui.QCursor.pos()
        pos = self.mapFromGlobal(pos)
        for region in self.regions():
            if region.testHovered(pos):
                return region
        return None
680391
public function hasRange()
    {
        return ($this->getOffset() !== false && $this->getOffset() >= 0 && $this->getNumberOfEntries() !== false && $this->getNumberOfEntries() > 0);
    }
524633
private function getLocationConstraintMiddleware()
    {
        $region = $this->getRegion();
        return static function (callable $handler) use ($region) {
            return function (Command $command, $request = null) use ($handler, $region) {
                if ($command->getName() === 'CreateBucket') {
                    $locationConstraint = isset($command['CreateBucketConfiguration']['LocationConstraint'])
                        ? $command['CreateBucketConfiguration']['LocationConstraint']
                        : null;

                    if ($locationConstraint === 'us-east-1') {
                        unset($command['CreateBucketConfiguration']);
                    } elseif ('us-east-1' !== $region && empty($locationConstraint)) {
                        $command['CreateBucketConfiguration'] = ['LocationConstraint' => $region];
                    }
                }

                return $handler($command, $request);
            };
        };
    }
836406
public function getCountry()
    {
        if (strstr(Yii::app()->language, '_')) {
            return substr(strstr(Yii::app()->language, '_'), 1);
        } else {
            return null;
        }
    }
1023744
private Region find(long size) {
    validate(!VALIDATING || Long.bitCount(size) == 1);

    Region current = this.root;
    if ((current.available() & size) == 0) {
      //no region big enough for us...
      return null;
    } else {
      while (true) {
        if (current.left != null && (current.left.available() & size) != 0) {
          current = current.left;
        } else if ((current.availableHere() & size) != 0) {
          long mask = size - 1;
          long a = (current.start() + mask) & ~mask;
          return new Region(a, a + size - 1);
        } else if (current.right != null && (current.right.available() & size) != 0) {
          current = current.right;
        } else {
          throw new AssertionError();
        }
      }
    }
  }
1172950
public function getCenterLng()
    {
        return (is_null($this->getSouthWest()) || is_null($this->getNorthEast()))
            ? null
            : floatval(($this->getSouthWest()->getLng() + $this->getNorthEast()->getLng()) / 2);
    }
403003
public function size(): int {
        $size = 0;
        /**
         * @var string $hash
         * @var  AbstractLinkedList $list
         */
        foreach ($this->bucket as $hash => $list) {
            $size += $list->size();
        }
        return $size;
    }
753076
private Region getRegion()
    {
        while (true)
        {
            // Try to get the region
            Region region = currentRegion.get();
            if (region != null)
                return region;

            // No current region, so we want to allocate one. We race
            // against other allocators to CAS in a Region, and if we fail we stash the region for re-use
            region = RACE_ALLOCATED.poll();
            if (region == null)
                region = new Region(allocateOnHeapOnly ? ByteBuffer.allocate(REGION_SIZE) : ByteBuffer.allocateDirect(REGION_SIZE));
            if (currentRegion.compareAndSet(null, region))
            {
                if (!allocateOnHeapOnly)
                    offHeapRegions.add(region);
                regionCount.incrementAndGet();
                logger.trace("{} regions now allocated in {}", regionCount, this);
                return region;
            }

            // someone else won race - that's fine, we'll try to grab theirs
            // in the next iteration of the loop.
            RACE_ALLOCATED.add(region);
        }
    }