id
int64
0
190k
prompt
stringlengths
21
13.4M
docstring
stringlengths
1
12k
152,266
import os import json import logging import sqlalchemy as sa import cryptocode import etcd import uuid from alembic import op from optscale_client.config_client.client import Client as EtcdClient from sqlalchemy import select, update from sqlalchemy.orm import Session from sqlalchemy.sql import table, column LOG = logg...
null
152,267
import os import json import logging import sqlalchemy as sa import cryptocode import etcd import uuid from alembic import op from optscale_client.config_client.client import Client as EtcdClient from sqlalchemy import select, update from sqlalchemy.orm import Session from sqlalchemy.sql import table, column LOG = logg...
null
152,268
from alembic import op import sqlalchemy as sa def upgrade(): op.add_column('cloudaccount', sa.Column('last_getting_metrics_at', sa.Integer(), nullable=False, default=0)) op.add_column('cloudaccount', sa.Column('last_getting_metric_attempt_at', sa.Integer(), ...
null
152,269
from alembic import op import sqlalchemy as sa def downgrade(): op.drop_column('cloudaccount', 'last_getting_metrics_at') op.drop_column('cloudaccount', 'last_getting_metric_attempt_at') op.drop_column('cloudaccount', 'last_getting_metric_attempt_error')
null
152,270
from alembic import op import sqlalchemy as sa def upgrade(): op.add_column('organization', sa.Column('cleaned_at', sa.Integer(), nullable=False, default=0))
null
152,271
from alembic import op import sqlalchemy as sa def downgrade(): op.drop_column('organization', 'cleaned_at')
null
152,272
from __future__ import with_statement from alembic import context from sqlalchemy import engine_from_config, pool from logging.config import fileConfig import rest_api.rest_api_server.models.models config = context.config target_metadata = rest_api.rest_api_server.models.models.Base.metadata if context.is_offline_mode(...
Run migrations in 'offline' mode. This configures the context with just a URL and not an Engine, though an Engine is acceptable here as well. By skipping the Engine creation we don't even need a DBAPI to be available. Calls to context.execute() here emit the given string to the script output.
152,273
from __future__ import with_statement from alembic import context from sqlalchemy import engine_from_config, pool from logging.config import fileConfig import rest_api.rest_api_server.models.models config = context.config target_metadata = rest_api.rest_api_server.models.models.Base.metadata if context.is_offline_mode(...
Run migrations in 'online' mode. In this scenario we need to create an Engine and associate a connection with the context.
152,274
from alembic import op from sqlalchemy import engine_from_config from sqlalchemy.engine import reflection def table_has_column(table, column): # pylint: disable=no-member config = op.get_context().config engine = engine_from_config( config.get_section(config.config_ini_section), prefix='sqlalchemy....
null
152,275
import logging import os import configparser import argparse import subprocess class ConfigTemplate(object): connection_string = 'mysql+mysqlconnector://%s:%s@%s/%s' def __init__(self): self.path = os.path.join(os.path.abspath(os.path.dirname(__file__))) self.config = None def load(self, pat...
null
152,276
import logging import os import configparser import argparse import subprocess class ConfigTemplate(object): connection_string = 'mysql+mysqlconnector://%s:%s@%s/%s' def __init__(self): self.path = os.path.join(os.path.abspath(os.path.dirname(__file__))) self.config = None def load(self, pat...
null
152,277
from collections import defaultdict from datetime import datetime, timedelta from rest_api.rest_api_server.controllers.base import ( BaseProfilingTokenController, MongoMixin, ClickHouseMixin) from rest_api.rest_api_server.models.enums import RunStates from rest_api.rest_api_server.models.models import CloudAccount ...
null
152,278
from collections import defaultdict from datetime import datetime, timedelta from rest_api.rest_api_server.controllers.base import ( BaseProfilingTokenController, MongoMixin, ClickHouseMixin) from rest_api.rest_api_server.models.enums import RunStates from rest_api.rest_api_server.models.models import CloudAccount ...
null
152,279
from collections import defaultdict from datetime import datetime, timedelta from rest_api.rest_api_server.controllers.base import ( BaseProfilingTokenController, MongoMixin, ClickHouseMixin) from rest_api.rest_api_server.models.enums import RunStates from rest_api.rest_api_server.models.models import CloudAccount ...
null
152,280
from collections import defaultdict from datetime import datetime, timedelta from functools import reduce from requests.exceptions import HTTPError from sqlalchemy.sql import and_ from typing import Union from rest_api.rest_api_server.controllers.base_async import BaseAsyncControllerWrapper from rest_api.rest_api_serve...
null
152,281
from collections import defaultdict from datetime import datetime, timedelta from functools import reduce from requests.exceptions import HTTPError from sqlalchemy.sql import and_ from typing import Union from rest_api.rest_api_server.controllers.base_async import BaseAsyncControllerWrapper from rest_api.rest_api_serve...
null
152,282
from functools import reduce from itertools import product from requests.exceptions import HTTPError from typing import Iterable from rest_api.rest_api_server.controllers.base_async import BaseAsyncControllerWrapper from rest_api.rest_api_server.controllers.infrastructure.base import ( BaseInfraController, format_c...
null
152,283
from collections import defaultdict from datetime import datetime from requests.exceptions import HTTPError from sqlalchemy import and_ from rest_api.rest_api_server.controllers.base_async import BaseAsyncControllerWrapper from rest_api.rest_api_server.controllers.employee import EmployeeController from rest_api.rest_a...
null
152,284
from collections import defaultdict from datetime import datetime from requests.exceptions import HTTPError from sqlalchemy import and_ from rest_api.rest_api_server.controllers.base_async import BaseAsyncControllerWrapper from rest_api.rest_api_server.controllers.employee import EmployeeController from rest_api.rest_a...
null
152,285
from collections import defaultdict from datetime import datetime from requests.exceptions import HTTPError from sqlalchemy import and_ from rest_api.rest_api_server.controllers.base_async import BaseAsyncControllerWrapper from rest_api.rest_api_server.controllers.employee import EmployeeController from rest_api.rest_a...
null
152,286
from collections import defaultdict from datetime import datetime from requests.exceptions import HTTPError from sqlalchemy import and_ from rest_api.rest_api_server.controllers.base_async import BaseAsyncControllerWrapper from rest_api.rest_api_server.controllers.employee import EmployeeController from rest_api.rest_a...
null
152,287
import logging from collections import defaultdict from datetime import datetime, timedelta from requests.exceptions import HTTPError from sqlalchemy import and_ from uuid import uuid4 from sqlalchemy.exc import IntegrityError from rest_api.rest_api_server.controllers.base import ( BaseProfilingTokenController, Mon...
null
152,288
import logging from collections import defaultdict from datetime import datetime, timedelta from requests.exceptions import HTTPError from sqlalchemy import and_ from uuid import uuid4 from sqlalchemy.exc import IntegrityError from rest_api.rest_api_server.controllers.base import ( BaseProfilingTokenController, Mon...
null
152,289
import logging from collections import defaultdict from datetime import datetime, timedelta from requests.exceptions import HTTPError from sqlalchemy import and_ from uuid import uuid4 from sqlalchemy.exc import IntegrityError from rest_api.rest_api_server.controllers.base import ( BaseProfilingTokenController, Mon...
null
152,290
import logging from collections import defaultdict from datetime import datetime, timedelta from requests.exceptions import HTTPError from sqlalchemy import and_ from uuid import uuid4 from sqlalchemy.exc import IntegrityError from rest_api.rest_api_server.controllers.base import ( BaseProfilingTokenController, Mon...
null
152,291
import logging from collections import defaultdict from datetime import datetime, timedelta from requests.exceptions import HTTPError from sqlalchemy import and_ from uuid import uuid4 from sqlalchemy.exc import IntegrityError from rest_api.rest_api_server.controllers.base import ( BaseProfilingTokenController, Mon...
null
152,292
import logging from collections import defaultdict from datetime import datetime, timedelta from requests.exceptions import HTTPError from sqlalchemy import and_ from uuid import uuid4 from sqlalchemy.exc import IntegrityError from rest_api.rest_api_server.controllers.base import ( BaseProfilingTokenController, Mon...
null
152,293
import logging from collections import defaultdict from datetime import datetime, timedelta from requests.exceptions import HTTPError from sqlalchemy import and_ from uuid import uuid4 from sqlalchemy.exc import IntegrityError from rest_api.rest_api_server.controllers.base import ( BaseProfilingTokenController, Mon...
null
152,294
import os import logging import argparse import tornado.ioloop import pydevd_pycharm from etcd import Lock as EtcdLock from tornado.web import RedirectHandler import optscale_client.config_client.client import rest_api.rest_api_server.handlers.v1 as h_v1 import rest_api.rest_api_server.handlers.v2 as h_v2 from rest_api...
null
152,295
from sqlalchemy.orm import sessionmaker, scoped_session from retrying import retry import rest_api.rest_api_server.models.models as model_base def should_retry(exception): return True
null
152,296
import asyncio import logging import os import time from tornado.gen import multi from tornado.ioloop import IOLoop from tornado.options import define, options, parse_command_line from tornado.web import (Application, HTTPError as ResponseHttpError, RequestHandler, StaticFileHandler) from async...
null
152,297
import asyncio import logging import os import time from tornado.gen import multi from tornado.ioloop import IOLoop from tornado.options import define, options, parse_command_line from tornado.web import (Application, HTTPError as ResponseHttpError, RequestHandler, StaticFileHandler) from async...
null
152,298
import asyncio import logging import os import time from tornado.gen import multi from tornado.ioloop import IOLoop from tornado.options import define, options, parse_command_line from tornado.web import (Application, HTTPError as ResponseHttpError, RequestHandler, StaticFileHandler) from async...
null
152,299
import json import requests from retrying import retry def retry_if_connection_error(exception): if isinstance(exception, requests.ConnectionError): return True if isinstance(exception, requests.HTTPError): if exception.response.status_code in (503,): return True return False
null
152,300
from insider.insider_worker.processors.azure import AzurePriceProcessor PROCESSOR_TYPES = { 'azure_cnr': AzurePriceProcessor, } def get_processor_class(cloud_type): if cloud_type not in PROCESSOR_TYPES: raise ValueError('Cloud {} is not supported'.format(cloud_type)) return PROCESSOR_TYPES[cloud_ty...
null
152,301
import logging import os from kombu import Connection as QConnection, Exchange from kombu.pools import producers from optscale_client.config_client.client import Client as ConfigClient LOG = logging.getLogger(__name__) RETRY_POLICY = {'max_retries': 15, 'interval_start': 0, 'interval_step': 1, 'interval...
null
152,302
import re from datetime import datetime import enum import json from decimal import Decimal from bson import ObjectId from functools import wraps from tools.optscale_exceptions.common_exc import (WrongArgumentsException, UnauthorizedException) from insider.insider_api.e...
null
152,303
import re from datetime import datetime import enum import json from decimal import Decimal from bson import ObjectId from functools import wraps from tools.optscale_exceptions.common_exc import (WrongArgumentsException, UnauthorizedException) from insider.insider_api.e...
null
152,304
import re from datetime import datetime import enum import json from decimal import Decimal from bson import ObjectId from functools import wraps from tools.optscale_exceptions.common_exc import (WrongArgumentsException, UnauthorizedException) from insider.insider_api.e...
null
152,305
import re from botocore.exceptions import ClientError as AwsClientError from grpc._channel import _InactiveRpcError from pymongo import MongoClient from tools.optscale_exceptions.common_exc import ( NotFoundException, UnauthorizedException, WrongArgumentsException) from tools.cloud_adapter.clouds.azure import Azure...
null
152,306
import os import logging import argparse import tornado.ioloop import tornado.web from optscale_client.config_client.client import Client as ConfigClient import insider.insider_api.handlers.v2 as handlers from insider.insider_api.urls import urls_v2 def get_handlers(handler_kwargs): # pylint: disable=E1101 retu...
null
152,307
import logging from requests.exceptions import RequestException, HTTPError LOG = logging.getLogger(__name__) def _wrap_request_errors(http_exception_class): def decorator(func): def func_wrapper(*args, **kwargs): try: return func(*args, **kwargs) except HTTPError as ...
null
152,308
from concurrent.futures.thread import ThreadPoolExecutor from datetime import datetime from decimal import Decimal import enum import json import logging import uuid def gen_id(): return str(uuid.uuid4())
null
152,309
from alembic import op import sqlalchemy as sa def upgrade(): op.alter_column( "app_installation", "client_key", type_=sa.String(length=128), existing_type=sa.String(length=36), existing_nullable=False, )
null
152,310
from alembic import op import sqlalchemy as sa def downgrade(): op.alter_column( "app_installation", "client_key", type_=sa.String(length=36), existing_type=sa.String(length=128), existing_nullable=False, )
null
152,311
from alembic import op import sqlalchemy as sa def upgrade(): # ### commands auto generated by Alembic - please adjust! ### op.create_table( "app_installation", sa.Column("id", sa.String(length=36), nullable=False), sa.Column("created_at", sa.Integer(), nullable=False), sa.Colum...
null
152,312
from alembic import op import sqlalchemy as sa def downgrade(): # ### commands auto generated by Alembic - please adjust! ### op.drop_table("organization_assignment") op.drop_table("user_assignment") op.drop_table("app_installation") # ### end Alembic commands ###
null
152,313
from logging.config import fileConfig from sqlalchemy import engine_from_config from sqlalchemy import pool from alembic import context import jira_bus.jira_bus_server.models.models config = context.config target_metadata = jira_bus.jira_bus_server.models.models.Base.metadata if context.is_offline_mode(): run_migra...
Run migrations in 'offline' mode. This configures the context with just a URL and not an Engine, though an Engine is acceptable here as well. By skipping the Engine creation we don't even need a DBAPI to be available. Calls to context.execute() here emit the given string to the script output.
152,314
from logging.config import fileConfig from sqlalchemy import engine_from_config from sqlalchemy import pool from alembic import context import jira_bus.jira_bus_server.models.models config = context.config target_metadata = jira_bus.jira_bus_server.models.models.Base.metadata if context.is_offline_mode(): run_migra...
Run migrations in 'online' mode. In this scenario we need to create an Engine and associate a connection with the context.
152,315
import logging import os import configparser import argparse import subprocess class ConfigTemplate(object): connection_string = "mysql+mysqlconnector://%s:%s@%s/%s" def __init__(self): self.path = os.path.join(os.path.abspath(os.path.dirname(__file__))) self.config = None def load(self, pat...
null
152,316
import logging import os import configparser import argparse import subprocess class ConfigTemplate(object): connection_string = "mysql+mysqlconnector://%s:%s@%s/%s" def __init__(self): self.path = os.path.join(os.path.abspath(os.path.dirname(__file__))) self.config = None def load(self, pat...
null
152,317
import argparse import logging import os import pydevd_pycharm import tornado.ioloop import tornado.web from etcd import Lock as EtcdLock from jira_bus.jira_bus_server.constants import backend_urls from jira_bus.jira_bus_server.handlers.v2.app_descriptor import AppDescriptorHandler from jira_bus.jira_bus_server.handler...
null
152,318
import json from datetime import datetime from sqlalchemy import ( inspect, Column, Integer, String, Text, UniqueConstraint, ForeignKey, ) from sqlalchemy.ext.declarative import declarative_base, declared_attr from sqlalchemy.ext.hybrid import hybrid_property from sqlalchemy.orm import relat...
null
152,319
from retrying import retry from sqlalchemy.orm import sessionmaker, scoped_session import jira_bus.jira_bus_server.models.models as model_base def should_retry(exception): return True
null
152,320
from slacker.slacker_server.message_templates.org import get_org_switch_blocks def get_welcome_message(public_ip, secret): return { "text": "Hi there", "blocks": [ { "type": "section", "text": { "type": "mrkdwn", "t...
null
152,321
from slacker.slacker_server.message_templates.org import get_org_switch_blocks def get_org_switch_blocks(orgs, active_org_id): divider = {"type": "divider"} singular_plural_org = 'organization' if len(orgs) == 1 else 'organizations' org_switch_blocks = [ { "type": "section", ...
null
152,322
def get_org_switch_blocks(orgs, active_org_id): divider = {"type": "divider"} singular_plural_org = 'organization' if len(orgs) == 1 else 'organizations' org_switch_blocks = [ { "type": "section", "text": { "type": "mrkdwn", "text": f"You are m...
null
152,323
def get_org_switch_completed_message(org_name): bold_org_name = f'*{org_name}*' return { "text": f"You have set {org_name} as your current active organization.", "blocks": [ { "type": "section", "text": { "type": "mrkdwn", ...
null
152,324
from slacker.slacker_server.message_templates.alerts import get_alert_section def get_alert_section(public_ip, pool_id, organization_id, pool_name, limit, based, threshold, threshold_type, include_children, currency='USD'): c_sign = CURRENCY_MAP.get(currency, '') thr...
null
152,325
def get_ca_not_connected_message(org_name, public_ip): bold_org_name = f'*{org_name}*' header_blocks = [ { "type": "section", "text": { "type": "mrkdwn", "text": f":warning: Cloud Account error!", } }, { "...
null
152,326
def get_not_have_slack_permissions_message(): header_blocks = [ { "type": "section", "text": { "type": "mrkdwn", "text": f":warning: Slack permissions error!", } }, { "type": "section", "text": { ...
null
152,327
from datetime import datetime from slacker.slacker_server.constants import CURRENCY_MAP CURRENCY_MAP = { "AED": "د.إ", "AFN": "؋", "ALL": "L", "AMD": "֏", "ANG": "ƒ", "AOA": "Kz", "ARS": "$", "AUD": "$", "AWG": "ƒ", "AZN": "₼", "BAM": "KM", "BBD": "$", "BDT": "৳", ...
null
152,328
from datetime import datetime from slacker.slacker_server.constants import CURRENCY_MAP def get_alert_section(public_ip, pool_id, organization_id, pool_name, limit, based, threshold, threshold_type, include_children, currency='USD'): c_sign = CURRENCY_MAP.get(currency, ''...
null
152,329
from datetime import datetime from slacker.slacker_server.constants import CURRENCY_MAP def get_alert_section(public_ip, pool_id, organization_id, pool_name, limit, based, threshold, threshold_type, include_children, currency='USD'): c_sign = CURRENCY_MAP.get(currency, ''...
null
152,330
from datetime import datetime from slacker.slacker_server.constants import CURRENCY_MAP def get_join_channel_message(): return { "text": "Hi everyone", "blocks": [ { "type": "section", "text": { "type": "mrkdwn", "t...
null
152,331
from datetime import datetime from slacker.slacker_server.constants import CURRENCY_MAP def get_alert_list_block(alert, pool, channel_names, public_ip, organization_id, currency='USD'): main_section = get_alert_section( public_ip, alert['pool_id'], organization_id, pool['name'], ...
null
152,332
from datetime import datetime from slacker.slacker_server.constants import CURRENCY_MAP def get_add_alert_modal_empty_template(text): return { "callback_id": "add_alert_view", "title": { "type": "plain_text", "text": "Add alert" }, "blocks": [ { ...
null
152,333
from datetime import datetime from slacker.slacker_server.constants import CURRENCY_MAP def get_pool_selector(pools_map, currency_sign=''): blocks = [] max_text_length = 75 for pool_id, pool_info in pools_map.items(): pool_info_text = "{0} ({1}{2})".format(pool_info['name'], currency_sign, ...
null
152,334
from datetime import datetime from slacker.slacker_server.constants import CURRENCY_MAP def get_pool_selector(pools_map, currency_sign=''): blocks = [] max_text_length = 75 for pool_id, pool_info in pools_map.items(): pool_info_text = "{0} ({1}{2})".format(pool_info['name'], currency_sign, ...
null
152,335
from datetime import datetime from slacker.slacker_server.constants import CURRENCY_MAP def get_select_alert_type_modal(organization_name, private_metadata=''): return { "private_metadata": private_metadata, "callback_id": "add_alert_view", "title": { "type": "plain_text", ...
null
152,336
from datetime import datetime from slacker.slacker_server.message_templates.resource_details import get_resource_details_block SEC_IN_HRS = 3600 def get_ttl_constraint_message(ttl_constr): ttl_msg = None if ttl_constr: hrs = (ttl_constr['limit'] - datetime.utcnow().timestamp()) / SEC_IN_HRS if t...
null
152,337
from datetime import datetime from slacker.slacker_server.message_templates.resource_details import get_resource_details_block def get_ttl_constraint_message(ttl_constr): ttl_msg = None if ttl_constr: hrs = (ttl_constr['limit'] - datetime.utcnow().timestamp()) / SEC_IN_HRS if ttl_constr['limit']...
null
152,338
def get_disconnected_message(user_email, public_ip): italic_user_email = '_{}_'.format(user_email) return { "text": "You have disconnected your OptScale account " f"{user_email} from this Slack user.", "blocks": [ { "type": "section", ...
null
152,339
def get_disconnect_confirmation_message(user_email, public_ip): italic_user_email = '_{}_'.format(user_email) return { "text": "You are about to disconnect your OptScale " f"account {user_email} from this Slack user.", "blocks": [ { "type": "section"...
null
152,340
from slacker.slacker_server.message_templates.common import get_resource_type_location from slacker.slacker_server.constants import CURRENCY_MAP def get_resource_blocks(resource_data, public_ip, org_id, currency='USD'): c_sign = CURRENCY_MAP.get(currency, '') r_id = resource_data['resource_id'] r_cid = reso...
null
152,341
from collections import OrderedDict from datetime import datetime from slacker.slacker_server.constants import CURRENCY_MAP TTL_LIMIT_TO_SHOW = 72 SEC_IN_HRS = 3600 def get_resource_details_block(resource, org_id, public_ip): cloud_resource_id = resource['cloud_resource_id'] r_name = resource.get('name') or clo...
null
152,342
from slacker.slacker_server.message_templates.common import get_resource_type_location def get_resource_type_location(resource_data): r_type = resource_data['resource_type'] location = resource_data.get('cloud_account_name') if not location: location = "Cluster" if resource_data.get('cluster_type_...
null
152,343
def get_message_changed_active_state(resource_id, resource_name, public_ip, org_id, org_name, previous_state, new_state): return { "text": "Active state of the Environment resource has been changed", "blocks": [ ...
null
152,344
def get_released_or_acquired_message( resource_id, resource_name, public_ip, org_id, org_name, upcoming_booking, booking_status, acquired=True): acquired_or_released = 'acquired' if acquired else 'released' common_blocks = [ { "type": "section", "text": { ...
null
152,345
def get_released_or_acquired_message( resource_id, resource_name, public_ip, org_id, org_name, upcoming_booking, booking_status, acquired=True): acquired_or_released = 'acquired' if acquired else 'released' common_blocks = [ { "type": "section", "text": { ...
null
152,346
def get_env_property_updated_block(env_properties, public_ip, resource_id): def get_current_env_property_block(curr_env_properties): def get_property_updated_message(resource_id, resource_name, public_ip, org_id, org_name, env_properties, current_properties, ...
null
152,347
from slacker.slacker_server.message_templates.common import get_resource_type_location def get_env_resource_block(resource, resource_status_map, public_ip, org_id): r_id = resource['id'] r_name = resource.get('name') booking_status = resource_status_map[r_id] short_id = r_id[:4] return [{ "t...
null
152,348
from datetime import datetime, timedelta def get_time_options(): options = [] initial_option = None now = datetime.utcnow() start = now.replace(hour=0, minute=0, second=0, microsecond=0) end = start + timedelta(days=1) minutes = 0 while start != end: time = start.strftime('%I:%M%p')....
null
152,349
from datetime import datetime, timedelta def get_booking_block(booking_id, employee_name, since, until, allow_delete=False, allow_release=False): release_btn = { "type": "button", "text": { "type": "plain_text", "text": "Release" }, "acti...
null
152,351
import argparse import json import logging import os import sys import uuid from datetime import datetime from inspect import getmembers, getmodule, isfunction from slack_bolt import App from slack_bolt.oauth.oauth_settings import OAuthSettings from slack_sdk.oauth.installation_store.sqlalchemy import ( SQLAlchemyI...
null
152,352
import argparse import json import logging import os import sys import uuid from datetime import datetime from inspect import getmembers, getmodule, isfunction from slack_bolt import App from slack_bolt.oauth.oauth_settings import OAuthSettings from slack_sdk.oauth.installation_store.sqlalchemy import ( SQLAlchemyI...
null
152,353
import argparse import json import logging import os import sys import uuid from datetime import datetime from inspect import getmembers, getmodule, isfunction from slack_bolt import App from slack_bolt.oauth.oauth_settings import OAuthSettings from slack_sdk.oauth.installation_store.sqlalchemy import ( SQLAlchemyI...
null
152,354
from alembic import op import sqlalchemy as sa STRING_SIZE = 160 def upgrade(): op.create_table( 'slack_bots', sa.Column('id', sa.Integer(), autoincrement=True, nullable=False), sa.Column('client_id', sa.String(STRING_SIZE), nullable=False), sa.Column('app_id', sa.String(STRING_SIZE...
null
152,355
from alembic import op import sqlalchemy as sa def downgrade(): op.drop_table('slack_oauth_states') op.drop_index('slack_installations_idx', table_name='slack_installations') op.drop_table('slack_installations') op.drop_index('slack_bots_idx', table_name='slack_bots') op.drop_table('slack_bots')
null
152,356
import uuid from alembic import op import sqlalchemy as sa from sqlalchemy.orm import Session from sqlalchemy.sql import table from sqlalchemy import String, select, update, Column def upgrade(): # ### commands auto generated by Alembic - please adjust! ### op.add_column('user', sa.Column('slack_team_id', sa.S...
null
152,357
import uuid from alembic import op import sqlalchemy as sa from sqlalchemy.orm import Session from sqlalchemy.sql import table from sqlalchemy import String, select, update, Column def downgrade(): # ### commands auto generated by Alembic - please adjust! ### op.drop_column('user', 'slack_team_id') # ### e...
null
152,358
from alembic import op import sqlalchemy as sa def upgrade(): op.create_table( 'user', sa.Column('id', sa.String(length=36), nullable=False), sa.Column('created_at', sa.Integer(), nullable=False), sa.Column('deleted_at', sa.Integer(), nullable=False), sa.Column('slack_user_i...
null
152,359
from alembic import op import sqlalchemy as sa def downgrade(): op.drop_index(op.f('ix_user_slack_user_id'), table_name='user') op.drop_index(op.f('ix_user_secret'), table_name='user') op.drop_index(op.f('ix_user_auth_user_id'), table_name='user') op.drop_table('user')
null
152,360
from logging.config import fileConfig from sqlalchemy import engine_from_config from sqlalchemy import pool from alembic import context from slacker.slacker_server.models.db_base import get_db_metadata config = context.config target_metadata = get_db_metadata() if context.is_offline_mode(): run_migrations_offline()...
Run migrations in 'offline' mode. This configures the context with just a URL and not an Engine, though an Engine is acceptable here as well. By skipping the Engine creation we don't even need a DBAPI to be available. Calls to context.execute() here emit the given string to the script output.
152,361
from logging.config import fileConfig from sqlalchemy import engine_from_config from sqlalchemy import pool from alembic import context from slacker.slacker_server.models.db_base import get_db_metadata config = context.config target_metadata = get_db_metadata() if context.is_offline_mode(): run_migrations_offline()...
Run migrations in 'online' mode. In this scenario we need to create an Engine and associate a connection with the context.
152,362
import logging import os import configparser import argparse import subprocess class ConfigTemplate(object): connection_string = 'mysql+mysqlconnector://%s:%s@%s/%s' def __init__(self): self.path = os.path.join(os.path.abspath(os.path.dirname(__file__))) self.config = None def load(self, pat...
null
152,363
import logging import os import configparser import argparse import subprocess class ConfigTemplate(object): def __init__(self): def load(self, path, name='alembic.template'): def save(self, host, username, password, db, file_name='alembic.ini'): def execute(cmd, path='..'): def apply(args): config ...
null
152,364
import argparse import inspect import logging from datetime import datetime, timedelta from requests import HTTPError from retrying import Retrying from slack_sdk.errors import SlackApiError from sqlalchemy.exc import IntegrityError from slacker.slacker_server.controllers.base import BaseController from slacker.slacker...
null
152,365
import logging import os import re import tornado.web import tornado.ioloop from etcd import Lock as EtcdLock from slack_bolt import App from slack_bolt.oauth.oauth_settings import OAuthSettings from slack_sdk.oauth.installation_store.sqlalchemy import ( SQLAlchemyInstallationStore) from slack_sdk.oauth.state_store...
null
152,366
import logging import os import re import tornado.web import tornado.ioloop from etcd import Lock as EtcdLock from slack_bolt import App from slack_bolt.oauth.oauth_settings import OAuthSettings from slack_sdk.oauth.installation_store.sqlalchemy import ( SQLAlchemyInstallationStore) from slack_sdk.oauth.state_store...
null