code stringlengths 3 6.57k |
|---|
graph (this changes the original graph) |
self.__class__(name="Reverse of (%s) |
H.add_nodes_from(self) |
H.add_edges_from( (v,u,deepcopy(d) |
self.edges(data=True) |
deepcopy(self.graph) |
deepcopy(self.node) |
subgraph(self, nbunch) |
nx.Graph(G.subgraph(nbunch) |
G.subgraph(nbunch) |
copy() |
G.remove_nodes_from([ n in G if n not in set(nbunch) |
nx.Graph() |
G.add_path([0,1,2,3]) |
G.subgraph([0,1,2]) |
H.edges() |
self.nbunch_iter(nbunch) |
self.__class__() |
H.adjlist_dict_factory() |
H.adjlist_dict_factory() |
items() |
os.path.join(os.path.join(os.path.dirname(__file__) |
load_dotenv(dotenv_path) |
LoginManager() |
get_task_logger(__name__) |
create_celery() |
create_celery() |
create_app(config_name) |
Flask(__name__) |
app.config.from_object(config[config_name]) |
init_app(app) |
login_manager.init_app(app) |
redis.init_app(app) |
db.init_app(app) |
gateway.init_app(app=app) |
celery.conf.update(app.config) |
ContextTask(celery.Task) |
__call__(self, *args, **kwargs) |
app.app_context() |
self.run(*args, **kwargs) |
app.register_blueprint(ussd_bp) |
os.path.join(basedir, "app_logger.yaml") |
setup_logging(default_level=logging_level, logger_file_path=path) |
FakeClock(bucket.Clock) |
__init__(self, timestamp_sequences) |
sleep(self, amount) |
self.sleep_call_amounts.append(amount) |
current_time(self) |
self.timestamp_sequences.pop(0) |
TestTokenBucket(unittest.TestCase) |
setUp(self) |
FakeClock(self.timestamp_sequences) |
create_token_bucket(self, max_rate=10, min_rate=0.1) |
test_can_acquire_amount(self) |
self.create_token_bucket(max_rate=10) |
range(5) |
self.assertTrue(token_bucket.acquire(1, block=False) |
test_can_change_max_capacity_lower(self) |
self.timestamp_sequences.extend([1, 2, 3, 4, 5]) |
self.create_token_bucket(max_rate=10) |
range(5) |
self.assertTrue(token_bucket.acquire(1, block=False) |
self.timestamp_sequences.append(5) |
self.timestamp_sequences.extend([6, 7, 8, 9, 10]) |
range(5) |
self.assertTrue(token_bucket.acquire(1, block=False) |
test_max_capacity_is_at_least_one(self) |
self.create_token_bucket() |
self.timestamp_sequences.append(1) |
self.assertEqual(token_bucket.max_rate, 0.5) |
self.assertEqual(token_bucket.max_capacity, 1) |
test_acquire_fails_on_non_block_mode_returns_false(self) |
self.create_token_bucket(max_rate=10) |
self.assertRaises(CapacityNotAvailableError) |
token_bucket.acquire(100, block=False) |
test_can_retrieve_at_max_send_rate(self) |
ms (10 TPS) |
range(20) |
self.create_token_bucket(max_rate=10) |
range(20) |
self.assertTrue(token_bucket.acquire(1, block=False) |
test_acquiring_blocks_when_capacity_reached(self) |
self.create_token_bucket(max_rate=10) |
acquire() |
acquire() |
self.assertTrue(token_bucket.acquire(1, block=False) |
self.assertEqual(token_bucket.available_capacity, 0) |
self.assertTrue(token_bucket.acquire(1, block=True) |
self.assertEqual(token_bucket.available_capacity, 0) |
self.assertTrue(token_bucket.acquire(1, block=False) |
test_rate_cant_go_below_min(self) |
self.create_token_bucket(max_rate=1, min_rate=0.2) |
self.timestamp_sequences.append(1) |
self.assertEqual(token_bucket.max_rate, 0.2) |
self.assertEqual(token_bucket.max_capacity, 1) |
AdGroupSimulationServiceGrpcTransport(AdGroupSimulationServiceTransport) |
host (Optional[str]) |
credentials (Optional[google.auth.credentials.Credentials]) |
credentials_file (Optional[str]) |
scopes (Optional(Sequence[str]) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.