prompt large_stringlengths 72 9.34k | completion large_stringlengths 0 7.61k |
|---|---|
<|file_name|>mysql_001.py<|end_file_name|><|fim▁begin|>"""
Installs and configures MySQL
"""
import uuid
import logging
from packstack.installer import validators
from packstack.installer import utils
from packstack.modules.ospluginutils import getManifestTemplate, appendManifestFile
# Controller object will be ini... | initConfig |
<|file_name|>mysql_001.py<|end_file_name|><|fim▁begin|>"""
Installs and configures MySQL
"""
import uuid
import logging
from packstack.installer import validators
from packstack.installer import utils
from packstack.modules.ospluginutils import getManifestTemplate, appendManifestFile
# Controller object will be ini... | initSequences |
<|file_name|>mysql_001.py<|end_file_name|><|fim▁begin|>"""
Installs and configures MySQL
"""
import uuid
import logging
from packstack.installer import validators
from packstack.installer import utils
from packstack.modules.ospluginutils import getManifestTemplate, appendManifestFile
# Controller object will be ini... | createmanifest |
<|file_name|>mysql_001.py<|end_file_name|><|fim▁begin|>"""
Installs and configures MySQL
"""
import uuid
import logging
from packstack.installer import validators
from packstack.installer import utils
from packstack.modules.ospluginutils import getManifestTemplate, appendManifestFile
# Controller object will be ini... | append_for |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|>from zope.i18nmessageid import MessageFactory
PloneMessageFactory = MessageFactory('plone')
<|fim▁hole|>from Products.CMFCore.permissions import setDefaultRoles
setDefaultRoles('signature.portlets.gdsignature: Add GroupDocs Signature portlet',
('Mana... | |
<|file_name|>user.py<|end_file_name|><|fim▁begin|># User info wrapper object
import logging
class User(object):
"""
Wrapper object around an entry in users.json. Behaves like a read-only dictionary if
asked, but adds some useful logic to decouple the front end from the JSON structure.
"""
_NAME_KE... | size is supplied, give the URL for the full-size image.
"""
if "profile" not in self._raw:
return |
<|file_name|>user.py<|end_file_name|><|fim▁begin|># User info wrapper object
import logging
class User(object):
<|fim_middle|>
def deleted_user(id):
"""
Create a User object for a deleted user.
"""
deleted_user = {
"id": id,
"name": "deleted-" + id,
"deleted": True,
... | """
Wrapper object around an entry in users.json. Behaves like a read-only dictionary if
asked, but adds some useful logic to decouple the front end from the JSON structure.
"""
_NAME_KEYS = ["display_name", "real_name"]
_DEFAULT_IMAGE_KEY = "image_512"
def __init__(self, raw_data):
... |
<|file_name|>user.py<|end_file_name|><|fim▁begin|># User info wrapper object
import logging
class User(object):
"""
Wrapper object around an entry in users.json. Behaves like a read-only dictionary if
asked, but adds some useful logic to decouple the front end from the JSON structure.
"""
_NAME_KE... | self._raw = raw_data |
<|file_name|>user.py<|end_file_name|><|fim▁begin|># User info wrapper object
import logging
class User(object):
"""
Wrapper object around an entry in users.json. Behaves like a read-only dictionary if
asked, but adds some useful logic to decouple the front end from the JSON structure.
"""
_NAME_KE... | return self._raw[key] |
<|file_name|>user.py<|end_file_name|><|fim▁begin|># User info wrapper object
import logging
class User(object):
"""
Wrapper object around an entry in users.json. Behaves like a read-only dictionary if
asked, but adds some useful logic to decouple the front end from the JSON structure.
"""
_NAME_KE... | """
Find the most appropriate display name for a user: look for a "display_name", then
a "real_name", and finally fall back to the always-present "name".
"""
for k in self._NAME_KEYS:
if self._raw.get(k):
return self._raw[k]
if "profile" in... |
<|file_name|>user.py<|end_file_name|><|fim▁begin|># User info wrapper object
import logging
class User(object):
"""
Wrapper object around an entry in users.json. Behaves like a read-only dictionary if
asked, but adds some useful logic to decouple the front end from the JSON structure.
"""
_NAME_KE... | """
Shortcut property for finding the e-mail address or bot URL.
"""
if "profile" in self._raw:
email = self._raw["profile"].get("email")
elif "bot_url" in self._raw:
email = self._raw["bot_url"]
else:
email = None
if not email:... |
<|file_name|>user.py<|end_file_name|><|fim▁begin|># User info wrapper object
import logging
class User(object):
"""
Wrapper object around an entry in users.json. Behaves like a read-only dictionary if
asked, but adds some useful logic to decouple the front end from the JSON structure.
"""
_NAME_KE... | """
Get the URL for the user icon in the desired pixel size, if it exists. If no
size is supplied, give the URL for the full-size image.
"""
if "profile" not in self._raw:
return
profile = self._raw["profile"]
if (pixel_size):
img_key = "im... |
<|file_name|>user.py<|end_file_name|><|fim▁begin|># User info wrapper object
import logging
class User(object):
"""
Wrapper object around an entry in users.json. Behaves like a read-only dictionary if
asked, but adds some useful logic to decouple the front end from the JSON structure.
"""
_NAME_KE... | """
Create a User object for a deleted user.
"""
deleted_user = {
"id": id,
"name": "deleted-" + id,
"deleted": True,
"is_bot": False,
"is_app_user": False,
}
return User(deleted_user) |
<|file_name|>user.py<|end_file_name|><|fim▁begin|># User info wrapper object
import logging
class User(object):
"""
Wrapper object around an entry in users.json. Behaves like a read-only dictionary if
asked, but adds some useful logic to decouple the front end from the JSON structure.
"""
_NAME_KE... | return self._raw[k] |
<|file_name|>user.py<|end_file_name|><|fim▁begin|># User info wrapper object
import logging
class User(object):
"""
Wrapper object around an entry in users.json. Behaves like a read-only dictionary if
asked, but adds some useful logic to decouple the front end from the JSON structure.
"""
_NAME_KE... | return self._raw["profile"][k] |
<|file_name|>user.py<|end_file_name|><|fim▁begin|># User info wrapper object
import logging
class User(object):
"""
Wrapper object around an entry in users.json. Behaves like a read-only dictionary if
asked, but adds some useful logic to decouple the front end from the JSON structure.
"""
_NAME_KE... | email = self._raw["profile"].get("email") |
<|file_name|>user.py<|end_file_name|><|fim▁begin|># User info wrapper object
import logging
class User(object):
"""
Wrapper object around an entry in users.json. Behaves like a read-only dictionary if
asked, but adds some useful logic to decouple the front end from the JSON structure.
"""
_NAME_KE... | email = self._raw["bot_url"] |
<|file_name|>user.py<|end_file_name|><|fim▁begin|># User info wrapper object
import logging
class User(object):
"""
Wrapper object around an entry in users.json. Behaves like a read-only dictionary if
asked, but adds some useful logic to decouple the front end from the JSON structure.
"""
_NAME_KE... | email = None |
<|file_name|>user.py<|end_file_name|><|fim▁begin|># User info wrapper object
import logging
class User(object):
"""
Wrapper object around an entry in users.json. Behaves like a read-only dictionary if
asked, but adds some useful logic to decouple the front end from the JSON structure.
"""
_NAME_KE... | logging.debug("No email found for %s", self._raw.get("name")) |
<|file_name|>user.py<|end_file_name|><|fim▁begin|># User info wrapper object
import logging
class User(object):
"""
Wrapper object around an entry in users.json. Behaves like a read-only dictionary if
asked, but adds some useful logic to decouple the front end from the JSON structure.
"""
_NAME_KE... | return |
<|file_name|>user.py<|end_file_name|><|fim▁begin|># User info wrapper object
import logging
class User(object):
"""
Wrapper object around an entry in users.json. Behaves like a read-only dictionary if
asked, but adds some useful logic to decouple the front end from the JSON structure.
"""
_NAME_KE... | img_key = "image_%s" % pixel_size
if img_key in profile:
return profile[img_key] |
<|file_name|>user.py<|end_file_name|><|fim▁begin|># User info wrapper object
import logging
class User(object):
"""
Wrapper object around an entry in users.json. Behaves like a read-only dictionary if
asked, but adds some useful logic to decouple the front end from the JSON structure.
"""
_NAME_KE... | return profile[img_key] |
<|file_name|>user.py<|end_file_name|><|fim▁begin|># User info wrapper object
import logging
class User(object):
"""
Wrapper object around an entry in users.json. Behaves like a read-only dictionary if
asked, but adds some useful logic to decouple the front end from the JSON structure.
"""
_NAME_KE... | __init__ |
<|file_name|>user.py<|end_file_name|><|fim▁begin|># User info wrapper object
import logging
class User(object):
"""
Wrapper object around an entry in users.json. Behaves like a read-only dictionary if
asked, but adds some useful logic to decouple the front end from the JSON structure.
"""
_NAME_KE... | __getitem__ |
<|file_name|>user.py<|end_file_name|><|fim▁begin|># User info wrapper object
import logging
class User(object):
"""
Wrapper object around an entry in users.json. Behaves like a read-only dictionary if
asked, but adds some useful logic to decouple the front end from the JSON structure.
"""
_NAME_KE... | display_name |
<|file_name|>user.py<|end_file_name|><|fim▁begin|># User info wrapper object
import logging
class User(object):
"""
Wrapper object around an entry in users.json. Behaves like a read-only dictionary if
asked, but adds some useful logic to decouple the front end from the JSON structure.
"""
_NAME_KE... | email |
<|file_name|>user.py<|end_file_name|><|fim▁begin|># User info wrapper object
import logging
class User(object):
"""
Wrapper object around an entry in users.json. Behaves like a read-only dictionary if
asked, but adds some useful logic to decouple the front end from the JSON structure.
"""
_NAME_KE... | image_url |
<|file_name|>user.py<|end_file_name|><|fim▁begin|># User info wrapper object
import logging
class User(object):
"""
Wrapper object around an entry in users.json. Behaves like a read-only dictionary if
asked, but adds some useful logic to decouple the front end from the JSON structure.
"""
_NAME_KE... | deleted_user |
<|file_name|>manage.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "umiss_project.settings")
try:
from django.core.management import execute_from_command_line
except ImportError:
# The abo... | "Couldn't import Django. Are you sure it's installed and "
"available on your PYTHONPATH environment variable? Did you " |
<|file_name|>manage.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
<|fim_middle|>
<|fim▁end|> | os.environ.setdefault("DJANGO_SETTINGS_MODULE", "umiss_project.settings")
try:
from django.core.management import execute_from_command_line
except ImportError:
# The above import may fail for some other reason. Ensure that the
# issue is really that Django is missing to avoid masking... |
<|file_name|>stub_utils.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-<|fim▁hole|># Copyright 2014, 2015 Metaswitch Networks
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# h... | |
<|file_name|>stub_utils.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# Copyright 2014, 2015 Metaswitch Networks
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.a... | global test_time
test_time = value
log.debug("Time now set to : %d" % test_time) |
<|file_name|>stub_utils.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# Copyright 2014, 2015 Metaswitch Networks
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.a... | return test_time |
<|file_name|>stub_utils.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# Copyright 2014, 2015 Metaswitch Networks
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.a... | """
Gets a random mac address.
"""
mac = ("%02x:%02x:%02x:%02x:%02x:%02x" %
(random.randint(0x00, 0xff),
random.randint(0x00, 0xff),
random.randint(0x00, 0xff),
random.randint(0x00, 0xff),
random.rand... |
<|file_name|>stub_utils.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# Copyright 2014, 2015 Metaswitch Networks
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.a... | pass |
<|file_name|>stub_utils.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# Copyright 2014, 2015 Metaswitch Networks
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.a... | set_time |
<|file_name|>stub_utils.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# Copyright 2014, 2015 Metaswitch Networks
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.a... | get_time |
<|file_name|>stub_utils.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# Copyright 2014, 2015 Metaswitch Networks
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.a... | get_mac |
<|file_name|>test_convert_notebooks.py<|end_file_name|><|fim▁begin|>"""
@brief test log(time=0s)
"""
import os
import unittest<|fim▁hole|>from pyquickhelper.filehelper import explore_folder_iterfile
from pyquickhelper.ipythonhelper import upgrade_notebook, remove_execution_number
class TestConvertNotebooks(unit... | from pyquickhelper.loghelper import fLOG |
<|file_name|>test_convert_notebooks.py<|end_file_name|><|fim▁begin|>"""
@brief test log(time=0s)
"""
import os
import unittest
from pyquickhelper.loghelper import fLOG
from pyquickhelper.filehelper import explore_folder_iterfile
from pyquickhelper.ipythonhelper import upgrade_notebook, remove_execution_number
c... | """Converts notebooks from v3 to v4. Should not be needed anymore."""
def test_convert_notebooks(self):
fLOG(
__file__,
self._testMethodName,
OutputPrint=__name__ == "__main__")
fold = os.path.abspath(os.path.dirname(__file__))
fold2 = os.path.normpat... |
<|file_name|>test_convert_notebooks.py<|end_file_name|><|fim▁begin|>"""
@brief test log(time=0s)
"""
import os
import unittest
from pyquickhelper.loghelper import fLOG
from pyquickhelper.filehelper import explore_folder_iterfile
from pyquickhelper.ipythonhelper import upgrade_notebook, remove_execution_number
c... | fLOG(
__file__,
self._testMethodName,
OutputPrint=__name__ == "__main__")
fold = os.path.abspath(os.path.dirname(__file__))
fold2 = os.path.normpath(
os.path.join(fold, "..", "..", "_doc", "notebooks"))
for nbf in explore_folder_iterfile(fo... |
<|file_name|>test_convert_notebooks.py<|end_file_name|><|fim▁begin|>"""
@brief test log(time=0s)
"""
import os
import unittest
from pyquickhelper.loghelper import fLOG
from pyquickhelper.filehelper import explore_folder_iterfile
from pyquickhelper.ipythonhelper import upgrade_notebook, remove_execution_number
c... | fLOG("modified", nbf) |
<|file_name|>test_convert_notebooks.py<|end_file_name|><|fim▁begin|>"""
@brief test log(time=0s)
"""
import os
import unittest
from pyquickhelper.loghelper import fLOG
from pyquickhelper.filehelper import explore_folder_iterfile
from pyquickhelper.ipythonhelper import upgrade_notebook, remove_execution_number
c... | fLOG("modified", nbf) |
<|file_name|>test_convert_notebooks.py<|end_file_name|><|fim▁begin|>"""
@brief test log(time=0s)
"""
import os
import unittest
from pyquickhelper.loghelper import fLOG
from pyquickhelper.filehelper import explore_folder_iterfile
from pyquickhelper.ipythonhelper import upgrade_notebook, remove_execution_number
c... | unittest.main() |
<|file_name|>test_convert_notebooks.py<|end_file_name|><|fim▁begin|>"""
@brief test log(time=0s)
"""
import os
import unittest
from pyquickhelper.loghelper import fLOG
from pyquickhelper.filehelper import explore_folder_iterfile
from pyquickhelper.ipythonhelper import upgrade_notebook, remove_execution_number
c... | test_convert_notebooks |
<|file_name|>setup.py<|end_file_name|><|fim▁begin|>import setuptools
with open("README.md", "r") as fh:
long_description = fh.read()
with open('requirements.txt') as f:
requirements = f.read().splitlines()
with open('cli-requirements.txt') as f:
cli_requirements = f.read().splitlines()
setuptools.setup(... | long_description_content_type="text/markdown",
url="https://github.com/ladybug-tools/uwg",
packages=setuptools.find_packages(exclude=["tests*", "resources*"]), |
<|file_name|>setup.py<|end_file_name|><|fim▁begin|>#
# Copyright (c) 2013 Christopher L. Felton
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
... | #
|
<|file_name|>setup.py<|end_file_name|><|fim▁begin|>#
# Copyright (c) 2013 Christopher L. Felton
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
... | yield prefix
prefix = prefix + "."
for _, name, ispkg in walk_packages(path,
prefix,
onerror=lambda x: x):
if ispkg:
yield name |
<|file_name|>setup.py<|end_file_name|><|fim▁begin|>#
# Copyright (c) 2013 Christopher L. Felton
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
... | return list(_find_packages(mn.__path__, mn.__name__)) |
<|file_name|>setup.py<|end_file_name|><|fim▁begin|>#
# Copyright (c) 2013 Christopher L. Felton
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
... | yield name |
<|file_name|>setup.py<|end_file_name|><|fim▁begin|>#
# Copyright (c) 2013 Christopher L. Felton
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
... | _find_packages |
<|file_name|>setup.py<|end_file_name|><|fim▁begin|>#
# Copyright (c) 2013 Christopher L. Felton
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
... | find_packages |
<|file_name|>securitygroup.py<|end_file_name|><|fim▁begin|>""" -*- coding: utf-8 -*- """
from python2awscli import bin_aws
from python2awscli.error import AWSNotFound, ParseError, AWSDuplicate
from python2awscli import must
class BaseSecurityGroup(object):
def __init__(self, name, region, vpc, description, inbou... | self._get() |
<|file_name|>securitygroup.py<|end_file_name|><|fim▁begin|>""" -*- coding: utf-8 -*- """
from python2awscli import bin_aws
from python2awscli.error import AWSNotFound, ParseError, AWSDuplicate
from python2awscli import must
class BaseSecurityGroup(object):
def __init__(self, name, region, vpc, description, inbou... | raise ParseError(
'SecurityGroup {0}, need a list of dicts, instead got "{1}"'.format(self.name, requested)) |
<|file_name|>securitygroup.py<|end_file_name|><|fim▁begin|>""" -*- coding: utf-8 -*- """
from python2awscli import bin_aws
from python2awscli.error import AWSNotFound, ParseError, AWSDuplicate
from python2awscli import must
class BaseSecurityGroup(object):
def __init__(self, name, region, vpc, description, inbou... | self._add_rule(rule, egress) |
<|file_name|>securitygroup.py<|end_file_name|><|fim▁begin|>""" -*- coding: utf-8 -*- """
from python2awscli import bin_aws
from python2awscli.error import AWSNotFound, ParseError, AWSDuplicate
from python2awscli import must
class BaseSecurityGroup(object):
def __init__(self, name, region, vpc, description, inbou... | self._rm_rule(active_rule, egress) |
<|file_name|>securitygroup.py<|end_file_name|><|fim▁begin|>""" -*- coding: utf-8 -*- """
from python2awscli import bin_aws
from python2awscli.error import AWSNotFound, ParseError, AWSDuplicate
from python2awscli import must
class BaseSecurityGroup(object):
def __init__(self, name, region, vpc, description, inbou... | direction = 'authorize-security-group-egress' |
<|file_name|>securitygroup.py<|end_file_name|><|fim▁begin|>""" -*- coding: utf-8 -*- """
from python2awscli import bin_aws
from python2awscli.error import AWSNotFound, ParseError, AWSDuplicate
from python2awscli import must
class BaseSecurityGroup(object):
def __init__(self, name, region, vpc, description, inbou... | direction = 'revoke-security-group-egress' |
<|file_name|>securitygroup.py<|end_file_name|><|fim▁begin|>""" -*- coding: utf-8 -*- """
from python2awscli import bin_aws
from python2awscli.error import AWSNotFound, ParseError, AWSDuplicate
from python2awscli import must
class BaseSecurityGroup(object):
def __init__(self, name, region, vpc, description, inbou... | 'SecurityGroup {0}, need a list of dicts, instead got "{1}"'.format(self.name, requested))
for rule in requested:
if rule not in active:
self._add_rule(rule, egress) |
<|file_name|>securitygroup.py<|end_file_name|><|fim▁begin|>""" -*- coding: utf-8 -*- """
from python2awscli import bin_aws
from python2awscli.error import AWSNotFound, ParseError, AWSDuplicate
from python2awscli import must
class BaseSecurityGroup(object):
def <|fim_middle|>(self, name, region, vpc, description,... | __init__ |
<|file_name|>securitygroup.py<|end_file_name|><|fim▁begin|>""" -*- coding: utf-8 -*- """
from python2awscli import bin_aws
from python2awscli.error import AWSNotFound, ParseError, AWSDuplicate
from python2awscli import must
class BaseSecurityGroup(object):
def __init__(self, name, region, vpc, description, inbou... | _break_out |
<|file_name|>securitygroup.py<|end_file_name|><|fim▁begin|>""" -*- coding: utf-8 -*- """
from python2awscli import bin_aws
from python2awscli.error import AWSNotFound, ParseError, AWSDuplicate
from python2awscli import must
class BaseSecurityGroup(object):
def __init__(self, name, region, vpc, description, inbou... | _merge_rules |
<|file_name|>securitygroup.py<|end_file_name|><|fim▁begin|>""" -*- coding: utf-8 -*- """
from python2awscli import bin_aws
from python2awscli.error import AWSNotFound, ParseError, AWSDuplicate
from python2awscli import must
class BaseSecurityGroup(object):
def __init__(self, name, region, vpc, description, inbou... | _add_rule |
<|file_name|>securitygroup.py<|end_file_name|><|fim▁begin|>""" -*- coding: utf-8 -*- """
from python2awscli import bin_aws
from python2awscli.error import AWSNotFound, ParseError, AWSDuplicate
from python2awscli import must
class BaseSecurityGroup(object):
def __init__(self, name, region, vpc, description, inbou... | _rm_rule |
<|file_name|>securitygroup.py<|end_file_name|><|fim▁begin|>""" -*- coding: utf-8 -*- """
from python2awscli import bin_aws
from python2awscli.error import AWSNotFound, ParseError, AWSDuplicate
from python2awscli import must
class BaseSecurityGroup(object):
def __init__(self, name, region, vpc, description, inbou... | _create |
<|file_name|>securitygroup.py<|end_file_name|><|fim▁begin|>""" -*- coding: utf-8 -*- """
from python2awscli import bin_aws
from python2awscli.error import AWSNotFound, ParseError, AWSDuplicate
from python2awscli import must
class BaseSecurityGroup(object):
def __init__(self, name, region, vpc, description, inbou... | _get |
<|file_name|>securitygroup.py<|end_file_name|><|fim▁begin|>""" -*- coding: utf-8 -*- """
from python2awscli import bin_aws
from python2awscli.error import AWSNotFound, ParseError, AWSDuplicate
from python2awscli import must
class BaseSecurityGroup(object):
def __init__(self, name, region, vpc, description, inbou... | _delete |
<|file_name|>securitygroup.py<|end_file_name|><|fim▁begin|>""" -*- coding: utf-8 -*- """
from python2awscli import bin_aws
from python2awscli.error import AWSNotFound, ParseError, AWSDuplicate
from python2awscli import must
class BaseSecurityGroup(object):
<|fim_middle|>
<|fim▁end|> | def __init__(self, name, region, vpc, description, inbound=None, outbound=None):
"""
:param name: String, name of SG
:param region: String, AWS region
:param vpc: String, IP of the VPC this SG belongs to
:param description: String
:param inbound: List of dicts, IP Per... |
<|file_name|>securitygroup.py<|end_file_name|><|fim▁begin|>""" -*- coding: utf-8 -*- """
from python2awscli import bin_aws
from python2awscli.error import AWSNotFound, ParseError, AWSDuplicate
from python2awscli import must
class BaseSecurityGroup(object):
def __init__(self, name, region, vpc, description, inbou... | """
:param name: String, name of SG
:param region: String, AWS region
:param vpc: String, IP of the VPC this SG belongs to
:param description: String
:param inbound: List of dicts, IP Permissions that should exist
:param outbound: List of dicts, IP Permissions tha... |
<|file_name|>securitygroup.py<|end_file_name|><|fim▁begin|>""" -*- coding: utf-8 -*- """
from python2awscli import bin_aws
from python2awscli.error import AWSNotFound, ParseError, AWSDuplicate
from python2awscli import must
class BaseSecurityGroup(object):
def __init__(self, name, region, vpc, description, inbou... | """
Undo AWS's rule flattening so we can do simple 'if rule in existing' logic later.
:param existing: List of SG rules as dicts.
:return: List of SG rules as dicts.
"""
spool = list()
for rule in existing:
for ip in rule['IpRanges']:
c... |
<|file_name|>securitygroup.py<|end_file_name|><|fim▁begin|>""" -*- coding: utf-8 -*- """
from python2awscli import bin_aws
from python2awscli.error import AWSNotFound, ParseError, AWSDuplicate
from python2awscli import must
class BaseSecurityGroup(object):
def __init__(self, name, region, vpc, description, inbou... | """
:param requested: List of dicts, IP Permissions that should exist
:param active: List of dicts, IP Permissions that already exist
:param egress: Bool, addressing outbound rules or not?
:return: Bool
"""
if not isinstance(requested, list):
raise Par... |
<|file_name|>securitygroup.py<|end_file_name|><|fim▁begin|>""" -*- coding: utf-8 -*- """
from python2awscli import bin_aws
from python2awscli.error import AWSNotFound, ParseError, AWSDuplicate
from python2awscli import must
class BaseSecurityGroup(object):
def __init__(self, name, region, vpc, description, inbou... | """
:param ip_permissions: Dict of IP Permissions
:param egress: Bool
:return: Bool
"""
direction = 'authorize-security-group-ingress'
if egress:
direction = 'authorize-security-group-egress'
command = ['ec2', direction,
'--r... |
<|file_name|>securitygroup.py<|end_file_name|><|fim▁begin|>""" -*- coding: utf-8 -*- """
from python2awscli import bin_aws
from python2awscli.error import AWSNotFound, ParseError, AWSDuplicate
from python2awscli import must
class BaseSecurityGroup(object):
def __init__(self, name, region, vpc, description, inbou... | """
:param ip_permissions: Dict of IP Permissions
:param egress: Bool
:return: Bool
"""
direction = 'revoke-security-group-ingress'
if egress:
direction = 'revoke-security-group-egress'
command = ['ec2', direction,
'--region'... |
<|file_name|>securitygroup.py<|end_file_name|><|fim▁begin|>""" -*- coding: utf-8 -*- """
from python2awscli import bin_aws
from python2awscli.error import AWSNotFound, ParseError, AWSDuplicate
from python2awscli import must
class BaseSecurityGroup(object):
def __init__(self, name, region, vpc, description, inbou... | """
Create a Security Group
:return:
"""
# AWS grants all new SGs this default outbound rule "This is pro-human & anti-machine behavior."
default_egress = {
'Ipv6Ranges': [],
'PrefixListIds': [],
'IpRanges': [{'CidrIp': '0.0.0.0/0'}],
... |
<|file_name|>securitygroup.py<|end_file_name|><|fim▁begin|>""" -*- coding: utf-8 -*- """
from python2awscli import bin_aws
from python2awscli.error import AWSNotFound, ParseError, AWSDuplicate
from python2awscli import must
class BaseSecurityGroup(object):
def __init__(self, name, region, vpc, description, inbou... | """
Get information about Security Group from AWS and update self
:return: Bool
"""
command = ['ec2', 'describe-security-groups', '--region', self.region, '--group-names', self.name]
result = bin_aws(command, key='SecurityGroups', max=1) # will raise NotFound if empty
... |
<|file_name|>securitygroup.py<|end_file_name|><|fim▁begin|>""" -*- coding: utf-8 -*- """
from python2awscli import bin_aws
from python2awscli.error import AWSNotFound, ParseError, AWSDuplicate
from python2awscli import must
class BaseSecurityGroup(object):
def __init__(self, name, region, vpc, description, inbou... | """
Delete myself by my own id.
As of 20170114 no other methods call me. You must do `foo._delete()`
:return:
"""
command = ['ec2', 'delete-security-group', '--region', self.region,
# '--dry-run',
'--group-id', self.id
... |
<|file_name|>ticket.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
#
from rest_framework import viewsets
from rest_framework.decorators import action
from rest_framework.exceptions import MethodNotAllowed
from rest_framework.response import Response
from common.const.http import POST, PUT
from common.mixins.... | |
<|file_name|>ticket.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
#
from rest_framework import viewsets
from rest_framework.decorators import action
from rest_framework.exceptions import MethodNotAllowed
from rest_framework.response import Response
from common.const.http import POST, PUT
from common.mixins.... | permission_classes = (IsValidUser,)
serializer_class = serializers.TicketDisplaySerializer
serializer_classes = {
'open': serializers.TicketApplySerializer,
'approve': serializers.TicketApproveSerializer,
}
filterset_fields = [
'id', 'title', 'type', 'action', 'status', 'appl... |
<|file_name|>ticket.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
#
from rest_framework import viewsets
from rest_framework.decorators import action
from rest_framework.exceptions import MethodNotAllowed
from rest_framework.response import Response
from common.const.http import POST, PUT
from common.mixins.... | raise MethodNotAllowed(self.action) |
<|file_name|>ticket.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
#
from rest_framework import viewsets
from rest_framework.decorators import action
from rest_framework.exceptions import MethodNotAllowed
from rest_framework.response import Response
from common.const.http import POST, PUT
from common.mixins.... | raise MethodNotAllowed(self.action) |
<|file_name|>ticket.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
#
from rest_framework import viewsets
from rest_framework.decorators import action
from rest_framework.exceptions import MethodNotAllowed
from rest_framework.response import Response
from common.const.http import POST, PUT
from common.mixins.... | raise MethodNotAllowed(self.action) |
<|file_name|>ticket.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
#
from rest_framework import viewsets
from rest_framework.decorators import action
from rest_framework.exceptions import MethodNotAllowed
from rest_framework.response import Response
from common.const.http import POST, PUT
from common.mixins.... | queryset = Ticket.get_user_related_tickets(self.request.user)
return queryset |
<|file_name|>ticket.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
#
from rest_framework import viewsets
from rest_framework.decorators import action
from rest_framework.exceptions import MethodNotAllowed
from rest_framework.response import Response
from common.const.http import POST, PUT
from common.mixins.... | instance = serializer.save()
instance.open(applicant=self.request.user) |
<|file_name|>ticket.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
#
from rest_framework import viewsets
from rest_framework.decorators import action
from rest_framework.exceptions import MethodNotAllowed
from rest_framework.response import Response
from common.const.http import POST, PUT
from common.mixins.... | return super().create(request, *args, **kwargs) |
<|file_name|>ticket.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
#
from rest_framework import viewsets
from rest_framework.decorators import action
from rest_framework.exceptions import MethodNotAllowed
from rest_framework.response import Response
from common.const.http import POST, PUT
from common.mixins.... | response = super().update(request, *args, **kwargs)
instance = self.get_object()
instance.approve(processor=self.request.user)
return response |
<|file_name|>ticket.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
#
from rest_framework import viewsets
from rest_framework.decorators import action
from rest_framework.exceptions import MethodNotAllowed
from rest_framework.response import Response
from common.const.http import POST, PUT
from common.mixins.... | instance = self.get_object()
serializer = self.get_serializer(instance)
instance.reject(processor=request.user)
return Response(serializer.data) |
<|file_name|>ticket.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
#
from rest_framework import viewsets
from rest_framework.decorators import action
from rest_framework.exceptions import MethodNotAllowed
from rest_framework.response import Response
from common.const.http import POST, PUT
from common.mixins.... | instance = self.get_object()
serializer = self.get_serializer(instance)
instance.close(processor=request.user)
return Response(serializer.data) |
<|file_name|>ticket.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
#
from rest_framework import viewsets
from rest_framework.decorators import action
from rest_framework.exceptions import MethodNotAllowed
from rest_framework.response import Response
from common.const.http import POST, PUT
from common.mixins.... | create |
<|file_name|>ticket.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
#
from rest_framework import viewsets
from rest_framework.decorators import action
from rest_framework.exceptions import MethodNotAllowed
from rest_framework.response import Response
from common.const.http import POST, PUT
from common.mixins.... | update |
<|file_name|>ticket.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
#
from rest_framework import viewsets
from rest_framework.decorators import action
from rest_framework.exceptions import MethodNotAllowed
from rest_framework.response import Response
from common.const.http import POST, PUT
from common.mixins.... | destroy |
<|file_name|>ticket.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
#
from rest_framework import viewsets
from rest_framework.decorators import action
from rest_framework.exceptions import MethodNotAllowed
from rest_framework.response import Response
from common.const.http import POST, PUT
from common.mixins.... | get_queryset |
<|file_name|>ticket.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
#
from rest_framework import viewsets
from rest_framework.decorators import action
from rest_framework.exceptions import MethodNotAllowed
from rest_framework.response import Response
from common.const.http import POST, PUT
from common.mixins.... | perform_create |
<|file_name|>ticket.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
#
from rest_framework import viewsets
from rest_framework.decorators import action
from rest_framework.exceptions import MethodNotAllowed
from rest_framework.response import Response
from common.const.http import POST, PUT
from common.mixins.... | open |
<|file_name|>ticket.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
#
from rest_framework import viewsets
from rest_framework.decorators import action
from rest_framework.exceptions import MethodNotAllowed
from rest_framework.response import Response
from common.const.http import POST, PUT
from common.mixins.... | approve |
<|file_name|>ticket.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
#
from rest_framework import viewsets
from rest_framework.decorators import action
from rest_framework.exceptions import MethodNotAllowed
from rest_framework.response import Response
from common.const.http import POST, PUT
from common.mixins.... | reject |
<|file_name|>ticket.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
#
from rest_framework import viewsets
from rest_framework.decorators import action
from rest_framework.exceptions import MethodNotAllowed
from rest_framework.response import Response
from common.const.http import POST, PUT
from common.mixins.... | close |
<|file_name|>StreamService.py<|end_file_name|><|fim▁begin|>from Source import Source
from Components.Element import cached
from Components.SystemInfo import SystemInfo
from enigma import eServiceReference
StreamServiceList = []
class StreamService(Source):
def __init__(self, navcore):
Source.__init__(self)
self.... | |
<|file_name|>StreamService.py<|end_file_name|><|fim▁begin|>from Source import Source
from Components.Element import cached
from Components.SystemInfo import SystemInfo
from enigma import eServiceReference
StreamServiceList = []
class StreamService(Source):
<|fim_middle|>
<|fim▁end|> | def __init__(self, navcore):
Source.__init__(self)
self.ref = None
self.__service = None
self.navcore = navcore
def serviceEvent(self, event):
pass
@cached
def getService(self):
return self.__service
service = property(getService)
def handleCommand(self, cmd):
print "[StreamService] handle comma... |
<|file_name|>StreamService.py<|end_file_name|><|fim▁begin|>from Source import Source
from Components.Element import cached
from Components.SystemInfo import SystemInfo
from enigma import eServiceReference
StreamServiceList = []
class StreamService(Source):
def __init__(self, navcore):
<|fim_middle|>
def service... | Source.__init__(self)
self.ref = None
self.__service = None
self.navcore = navcore |
<|file_name|>StreamService.py<|end_file_name|><|fim▁begin|>from Source import Source
from Components.Element import cached
from Components.SystemInfo import SystemInfo
from enigma import eServiceReference
StreamServiceList = []
class StreamService(Source):
def __init__(self, navcore):
Source.__init__(self)
self.... | pass |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.