prompt large_stringlengths 72 9.34k | completion large_stringlengths 0 7.61k |
|---|---|
<|file_name|>datastore_summary_maintenance_mode_state.py<|end_file_name|><|fim▁begin|>########################################
# Automatically generated, do not edit.
########################################
<|fim▁hole|>
DatastoreSummaryMaintenanceModeState = Enum(
'enteringMaintenance',
'inMaintenance',
'n... |
from pyvisdk.thirdparty import Enum |
<|file_name|>UserService.py<|end_file_name|><|fim▁begin|>from datetime import datetime
import random
import string
from bson import ObjectId
class DuplicateUserException(Exception):
def __init__(self, message='User name/email already exits'):
Exception.__init__(self, message)
pass
class UserService... | query = {}
if email is not None: |
<|file_name|>UserService.py<|end_file_name|><|fim▁begin|>from datetime import datetime
import random
import string
from bson import ObjectId
class DuplicateUserException(Exception):
<|fim_middle|>
class UserServiceException(Exception):
def __init__(self, message=None):
Exception.__init__(self, mess... | def __init__(self, message='User name/email already exits'):
Exception.__init__(self, message)
pass |
<|file_name|>UserService.py<|end_file_name|><|fim▁begin|>from datetime import datetime
import random
import string
from bson import ObjectId
class DuplicateUserException(Exception):
def __init__(self, message='User name/email already exits'):
<|fim_middle|>
pass
class UserServiceException(Exceptio... | Exception.__init__(self, message) |
<|file_name|>UserService.py<|end_file_name|><|fim▁begin|>from datetime import datetime
import random
import string
from bson import ObjectId
class DuplicateUserException(Exception):
def __init__(self, message='User name/email already exits'):
Exception.__init__(self, message)
pass
class UserService... | def __init__(self, message=None):
Exception.__init__(self, message)
@classmethod
def cannot_delete_super_admin(cls):
return UserServiceException("Cannot delete super admin user!") |
<|file_name|>UserService.py<|end_file_name|><|fim▁begin|>from datetime import datetime
import random
import string
from bson import ObjectId
class DuplicateUserException(Exception):
def __init__(self, message='User name/email already exits'):
Exception.__init__(self, message)
pass
class UserService... | Exception.__init__(self, message) |
<|file_name|>UserService.py<|end_file_name|><|fim▁begin|>from datetime import datetime
import random
import string
from bson import ObjectId
class DuplicateUserException(Exception):
def __init__(self, message='User name/email already exits'):
Exception.__init__(self, message)
pass
class UserService... | return UserServiceException("Cannot delete super admin user!") |
<|file_name|>UserService.py<|end_file_name|><|fim▁begin|>from datetime import datetime
import random
import string
from bson import ObjectId
class DuplicateUserException(Exception):
def __init__(self, message='User name/email already exits'):
Exception.__init__(self, message)
pass
class UserService... | def __init__(self, db):
self.db = db
self.users = self.db.user_collection
def generate_api_key(self):
s = string.ascii_letters + string.digits
return ''.join(random.sample(s, 20))
def create(self, item):
if self.user_exists(item['email']):
raise Duplicat... |
<|file_name|>UserService.py<|end_file_name|><|fim▁begin|>from datetime import datetime
import random
import string
from bson import ObjectId
class DuplicateUserException(Exception):
def __init__(self, message='User name/email already exits'):
Exception.__init__(self, message)
pass
class UserService... | self.db = db
self.users = self.db.user_collection |
<|file_name|>UserService.py<|end_file_name|><|fim▁begin|>from datetime import datetime
import random
import string
from bson import ObjectId
class DuplicateUserException(Exception):
def __init__(self, message='User name/email already exits'):
Exception.__init__(self, message)
pass
class UserService... | s = string.ascii_letters + string.digits
return ''.join(random.sample(s, 20)) |
<|file_name|>UserService.py<|end_file_name|><|fim▁begin|>from datetime import datetime
import random
import string
from bson import ObjectId
class DuplicateUserException(Exception):
def __init__(self, message='User name/email already exits'):
Exception.__init__(self, message)
pass
class UserService... | if self.user_exists(item['email']):
raise DuplicateUserException()
item.pop('_id', None)
item['created_at'] = datetime.now()
item['status'] = True
if 'api_key' not in item:
item['api_key'] = self.generate_api_key()
if 'roles' not in item or item['r... |
<|file_name|>UserService.py<|end_file_name|><|fim▁begin|>from datetime import datetime
import random
import string
from bson import ObjectId
class DuplicateUserException(Exception):
def __init__(self, message='User name/email already exits'):
Exception.__init__(self, message)
pass
class UserService... | return self.users.find_one({"email": email}) |
<|file_name|>UserService.py<|end_file_name|><|fim▁begin|>from datetime import datetime
import random
import string
from bson import ObjectId
class DuplicateUserException(Exception):
def __init__(self, message='User name/email already exits'):
Exception.__init__(self, message)
pass
class UserService... | query = {'email': username, 'password': password}
return self.users.find(query).count() > 0 |
<|file_name|>UserService.py<|end_file_name|><|fim▁begin|>from datetime import datetime
import random
import string
from bson import ObjectId
class DuplicateUserException(Exception):
def __init__(self, message='User name/email already exits'):
Exception.__init__(self, message)
pass
class UserService... | query = {}
if email is not None:
query['email'] = email
return [x for x in self.users.find(query)] |
<|file_name|>UserService.py<|end_file_name|><|fim▁begin|>from datetime import datetime
import random
import string
from bson import ObjectId
class DuplicateUserException(Exception):
def __init__(self, message='User name/email already exits'):
Exception.__init__(self, message)
pass
class UserService... | item = self.get_by_id(id)
if item and 'roles' in item and item['roles'] is not None and 'super_admin' in item['roles']:
raise UserServiceException.cannot_delete_super_admin()
return self.users.remove({"_id": ObjectId(id)}) |
<|file_name|>UserService.py<|end_file_name|><|fim▁begin|>from datetime import datetime
import random
import string
from bson import ObjectId
class DuplicateUserException(Exception):
def __init__(self, message='User name/email already exits'):
Exception.__init__(self, message)
pass
class UserService... | return self.users.find_one({"_id": ObjectId(id)}) |
<|file_name|>UserService.py<|end_file_name|><|fim▁begin|>from datetime import datetime
import random
import string
from bson import ObjectId
class DuplicateUserException(Exception):
def __init__(self, message='User name/email already exits'):
Exception.__init__(self, message)
pass
class UserService... | return self.users.find_one({"api_key": api_key}) |
<|file_name|>UserService.py<|end_file_name|><|fim▁begin|>from datetime import datetime
import random
import string
from bson import ObjectId
class DuplicateUserException(Exception):
def __init__(self, message='User name/email already exits'):
Exception.__init__(self, message)
pass
class UserService... | if item['_id'] is None:
return item
if self.user_exists(item['email'], str(item['_id'])):
raise DuplicateUserException()
item['updated_at'] = datetime.now()
self.users.save(item)
return item |
<|file_name|>UserService.py<|end_file_name|><|fim▁begin|>from datetime import datetime
import random
import string
from bson import ObjectId
class DuplicateUserException(Exception):
def __init__(self, message='User name/email already exits'):
Exception.__init__(self, message)
pass
class UserService... | query = {}
if id is not None:
query = {"_id": {"$ne": ObjectId(id)}}
query['email'] = email
return self.users.find(query).count() > 0 |
<|file_name|>UserService.py<|end_file_name|><|fim▁begin|>from datetime import datetime
import random
import string
from bson import ObjectId
class DuplicateUserException(Exception):
def __init__(self, message='User name/email already exits'):
Exception.__init__(self, message)
pass
class UserService... | raise DuplicateUserException() |
<|file_name|>UserService.py<|end_file_name|><|fim▁begin|>from datetime import datetime
import random
import string
from bson import ObjectId
class DuplicateUserException(Exception):
def __init__(self, message='User name/email already exits'):
Exception.__init__(self, message)
pass
class UserService... | item['api_key'] = self.generate_api_key() |
<|file_name|>UserService.py<|end_file_name|><|fim▁begin|>from datetime import datetime
import random
import string
from bson import ObjectId
class DuplicateUserException(Exception):
def __init__(self, message='User name/email already exits'):
Exception.__init__(self, message)
pass
class UserService... | item['roles'] = ['member'] |
<|file_name|>UserService.py<|end_file_name|><|fim▁begin|>from datetime import datetime
import random
import string
from bson import ObjectId
class DuplicateUserException(Exception):
def __init__(self, message='User name/email already exits'):
Exception.__init__(self, message)
pass
class UserService... | query['email'] = email |
<|file_name|>UserService.py<|end_file_name|><|fim▁begin|>from datetime import datetime
import random
import string
from bson import ObjectId
class DuplicateUserException(Exception):
def __init__(self, message='User name/email already exits'):
Exception.__init__(self, message)
pass
class UserService... | raise UserServiceException.cannot_delete_super_admin() |
<|file_name|>UserService.py<|end_file_name|><|fim▁begin|>from datetime import datetime
import random
import string
from bson import ObjectId
class DuplicateUserException(Exception):
def __init__(self, message='User name/email already exits'):
Exception.__init__(self, message)
pass
class UserService... | return item |
<|file_name|>UserService.py<|end_file_name|><|fim▁begin|>from datetime import datetime
import random
import string
from bson import ObjectId
class DuplicateUserException(Exception):
def __init__(self, message='User name/email already exits'):
Exception.__init__(self, message)
pass
class UserService... | raise DuplicateUserException() |
<|file_name|>UserService.py<|end_file_name|><|fim▁begin|>from datetime import datetime
import random
import string
from bson import ObjectId
class DuplicateUserException(Exception):
def __init__(self, message='User name/email already exits'):
Exception.__init__(self, message)
pass
class UserService... | query = {"_id": {"$ne": ObjectId(id)}} |
<|file_name|>UserService.py<|end_file_name|><|fim▁begin|>from datetime import datetime
import random
import string
from bson import ObjectId
class DuplicateUserException(Exception):
def <|fim_middle|>(self, message='User name/email already exits'):
Exception.__init__(self, message)
pass
class UserS... | __init__ |
<|file_name|>UserService.py<|end_file_name|><|fim▁begin|>from datetime import datetime
import random
import string
from bson import ObjectId
class DuplicateUserException(Exception):
def __init__(self, message='User name/email already exits'):
Exception.__init__(self, message)
pass
class UserService... | __init__ |
<|file_name|>UserService.py<|end_file_name|><|fim▁begin|>from datetime import datetime
import random
import string
from bson import ObjectId
class DuplicateUserException(Exception):
def __init__(self, message='User name/email already exits'):
Exception.__init__(self, message)
pass
class UserService... | cannot_delete_super_admin |
<|file_name|>UserService.py<|end_file_name|><|fim▁begin|>from datetime import datetime
import random
import string
from bson import ObjectId
class DuplicateUserException(Exception):
def __init__(self, message='User name/email already exits'):
Exception.__init__(self, message)
pass
class UserService... | __init__ |
<|file_name|>UserService.py<|end_file_name|><|fim▁begin|>from datetime import datetime
import random
import string
from bson import ObjectId
class DuplicateUserException(Exception):
def __init__(self, message='User name/email already exits'):
Exception.__init__(self, message)
pass
class UserService... | generate_api_key |
<|file_name|>UserService.py<|end_file_name|><|fim▁begin|>from datetime import datetime
import random
import string
from bson import ObjectId
class DuplicateUserException(Exception):
def __init__(self, message='User name/email already exits'):
Exception.__init__(self, message)
pass
class UserService... | create |
<|file_name|>UserService.py<|end_file_name|><|fim▁begin|>from datetime import datetime
import random
import string
from bson import ObjectId
class DuplicateUserException(Exception):
def __init__(self, message='User name/email already exits'):
Exception.__init__(self, message)
pass
class UserService... | get_by_email |
<|file_name|>UserService.py<|end_file_name|><|fim▁begin|>from datetime import datetime
import random
import string
from bson import ObjectId
class DuplicateUserException(Exception):
def __init__(self, message='User name/email already exits'):
Exception.__init__(self, message)
pass
class UserService... | validate_user |
<|file_name|>UserService.py<|end_file_name|><|fim▁begin|>from datetime import datetime
import random
import string
from bson import ObjectId
class DuplicateUserException(Exception):
def __init__(self, message='User name/email already exits'):
Exception.__init__(self, message)
pass
class UserService... | search |
<|file_name|>UserService.py<|end_file_name|><|fim▁begin|>from datetime import datetime
import random
import string
from bson import ObjectId
class DuplicateUserException(Exception):
def __init__(self, message='User name/email already exits'):
Exception.__init__(self, message)
pass
class UserService... | delete |
<|file_name|>UserService.py<|end_file_name|><|fim▁begin|>from datetime import datetime
import random
import string
from bson import ObjectId
class DuplicateUserException(Exception):
def __init__(self, message='User name/email already exits'):
Exception.__init__(self, message)
pass
class UserService... | get_by_id |
<|file_name|>UserService.py<|end_file_name|><|fim▁begin|>from datetime import datetime
import random
import string
from bson import ObjectId
class DuplicateUserException(Exception):
def __init__(self, message='User name/email already exits'):
Exception.__init__(self, message)
pass
class UserService... | get_by_api_key |
<|file_name|>UserService.py<|end_file_name|><|fim▁begin|>from datetime import datetime
import random
import string
from bson import ObjectId
class DuplicateUserException(Exception):
def __init__(self, message='User name/email already exits'):
Exception.__init__(self, message)
pass
class UserService... | update |
<|file_name|>UserService.py<|end_file_name|><|fim▁begin|>from datetime import datetime
import random
import string
from bson import ObjectId
class DuplicateUserException(Exception):
def __init__(self, message='User name/email already exits'):
Exception.__init__(self, message)
pass
class UserService... | user_exists |
<|file_name|>func_module.py<|end_file_name|><|fim▁begin|>##
## Copyright 2007, Red Hat, Inc
## see AUTHORS
##
## This software may be freely redistributed under the terms of the GNU
## general public license.
##
## You should have received a copy of the GNU General Public License
## along with this program; if not, wri... | self.arg_comp.validate_all()
return tmp_arg_dict |
<|file_name|>func_module.py<|end_file_name|><|fim▁begin|>##
## Copyright 2007, Red Hat, Inc
## see AUTHORS
##
## This software may be freely redistributed under the terms of the GNU
## general public license.
##
## You should have received a copy of the GNU General Public License
## along with this program; if not, wri... | version = "0.0.0"
api_version = "0.0.0"
description = "No Description provided"
class Config(BaseConfig):
pass
def __init__(self):
config_file = '/etc/func/minion.conf'
self.config = read_config(config_file, FuncdConfig)
self.__init_log()
self.__base_method... |
<|file_name|>func_module.py<|end_file_name|><|fim▁begin|>##
## Copyright 2007, Red Hat, Inc
## see AUTHORS
##
## This software may be freely redistributed under the terms of the GNU
## general public license.
##
## You should have received a copy of the GNU General Public License
## along with this program; if not, wri... | pass |
<|file_name|>func_module.py<|end_file_name|><|fim▁begin|>##
## Copyright 2007, Red Hat, Inc
## see AUTHORS
##
## This software may be freely redistributed under the terms of the GNU
## general public license.
##
## You should have received a copy of the GNU General Public License
## along with this program; if not, wri... | config_file = '/etc/func/minion.conf'
self.config = read_config(config_file, FuncdConfig)
self.__init_log()
self.__base_methods = {
# __'s so we don't clobber useful names
"module_version" : self.__module_version,
"module_api_version" : self.__module_a... |
<|file_name|>func_module.py<|end_file_name|><|fim▁begin|>##
## Copyright 2007, Red Hat, Inc
## see AUTHORS
##
## This software may be freely redistributed under the terms of the GNU
## general public license.
##
## You should have received a copy of the GNU General Public License
## along with this program; if not, wri... | log = logger.Logger()
self.logger = log.logger |
<|file_name|>func_module.py<|end_file_name|><|fim▁begin|>##
## Copyright 2007, Red Hat, Inc
## see AUTHORS
##
## This software may be freely redistributed under the terms of the GNU
## general public license.
##
## You should have received a copy of the GNU General Public License
## along with this program; if not, wri... | options_file = '/etc/func/modules/'+self.__class__.__name__+'.conf'
self.options = read_config(options_file, self.Config)
return |
<|file_name|>func_module.py<|end_file_name|><|fim▁begin|>##
## Copyright 2007, Red Hat, Inc
## see AUTHORS
##
## This software may be freely redistributed under the terms of the GNU
## general public license.
##
## You should have received a copy of the GNU General Public License
## along with this program; if not, wri... | for meth in self.__base_methods:
handlers["%s.%s" % (module_name, meth)] = self.__base_methods[meth]
# register our module's handlers
for name, handler in self.__list_handlers().items():
handlers["%s.%s" % (module_name, name)] = handler |
<|file_name|>func_module.py<|end_file_name|><|fim▁begin|>##
## Copyright 2007, Red Hat, Inc
## see AUTHORS
##
## This software may be freely redistributed under the terms of the GNU
## general public license.
##
## You should have received a copy of the GNU General Public License
## along with this program; if not, wri... | """ Return a dict of { handler_name, method, ... }.
All methods that do not being with an underscore will be exposed.
We also make sure to not expose our register_rpc method.
"""
handlers = {}
for attr in dir(self):
if self.__is_public_valid_method(attr):
... |
<|file_name|>func_module.py<|end_file_name|><|fim▁begin|>##
## Copyright 2007, Red Hat, Inc
## see AUTHORS
##
## This software may be freely redistributed under the terms of the GNU
## general public license.
##
## You should have received a copy of the GNU General Public License
## along with this program; if not, wri... | return self.__list_handlers().keys() + self.__base_methods.keys() |
<|file_name|>func_module.py<|end_file_name|><|fim▁begin|>##
## Copyright 2007, Red Hat, Inc
## see AUTHORS
##
## This software may be freely redistributed under the terms of the GNU
## general public license.
##
## You should have received a copy of the GNU General Public License
## along with this program; if not, wri... | return self.version |
<|file_name|>func_module.py<|end_file_name|><|fim▁begin|>##
## Copyright 2007, Red Hat, Inc
## see AUTHORS
##
## This software may be freely redistributed under the terms of the GNU
## general public license.
##
## You should have received a copy of the GNU General Public License
## along with this program; if not, wri... | return self.api_version |
<|file_name|>func_module.py<|end_file_name|><|fim▁begin|>##
## Copyright 2007, Red Hat, Inc
## see AUTHORS
##
## This software may be freely redistributed under the terms of the GNU
## general public license.
##
## You should have received a copy of the GNU General Public License
## along with this program; if not, wri... | return self.description |
<|file_name|>func_module.py<|end_file_name|><|fim▁begin|>##
## Copyright 2007, Red Hat, Inc
## see AUTHORS
##
## This software may be freely redistributed under the terms of the GNU
## general public license.
##
## You should have received a copy of the GNU General Public License
## along with this program; if not, wri... | if inspect.ismethod(getattr(self, attr)) and attr[0] != '_' and\
attr != 'register_rpc' and attr!='register_method_args':
return True
return False |
<|file_name|>func_module.py<|end_file_name|><|fim▁begin|>##
## Copyright 2007, Red Hat, Inc
## see AUTHORS
##
## This software may be freely redistributed under the terms of the GNU
## general public license.
##
## You should have received a copy of the GNU General Public License
## along with this program; if not, wri... | """
Gets arguments with their formats according to ArgCompatibility
class' rules.
@return : dict with args or Raise Exception if something wrong
happens
"""
tmp_arg_dict = self.register_method_args()
#if it is not implemeted then return empty stuff
... |
<|file_name|>func_module.py<|end_file_name|><|fim▁begin|>##
## Copyright 2007, Red Hat, Inc
## see AUTHORS
##
## This software may be freely redistributed under the terms of the GNU
## general public license.
##
## You should have received a copy of the GNU General Public License
## along with this program; if not, wri... | """
That is the method where users should override in their
modules according to be able to send their method arguments
to the Overlord. If they dont have it nothing breaks
just that one in the base class is called
@return : empty {}
"""
# to know they d... |
<|file_name|>func_module.py<|end_file_name|><|fim▁begin|>##
## Copyright 2007, Red Hat, Inc
## see AUTHORS
##
## This software may be freely redistributed under the terms of the GNU
## general public license.
##
## You should have received a copy of the GNU General Public License
## along with this program; if not, wri... | handlers[attr] = getattr(self, attr) |
<|file_name|>func_module.py<|end_file_name|><|fim▁begin|>##
## Copyright 2007, Red Hat, Inc
## see AUTHORS
##
## This software may be freely redistributed under the terms of the GNU
## general public license.
##
## You should have received a copy of the GNU General Public License
## along with this program; if not, wri... | return True |
<|file_name|>func_module.py<|end_file_name|><|fim▁begin|>##
## Copyright 2007, Red Hat, Inc
## see AUTHORS
##
## This software may be freely redistributed under the terms of the GNU
## general public license.
##
## You should have received a copy of the GNU General Public License
## along with this program; if not, wri... | return {} |
<|file_name|>func_module.py<|end_file_name|><|fim▁begin|>##
## Copyright 2007, Red Hat, Inc
## see AUTHORS
##
## This software may be freely redistributed under the terms of the GNU
## general public license.
##
## You should have received a copy of the GNU General Public License
## along with this program; if not, wri... | raise NonExistingMethodRegistered("%s is not in %s "%(method,self.__class__.__name__)) |
<|file_name|>func_module.py<|end_file_name|><|fim▁begin|>##
## Copyright 2007, Red Hat, Inc
## see AUTHORS
##
## This software may be freely redistributed under the terms of the GNU
## general public license.
##
## You should have received a copy of the GNU General Public License
## along with this program; if not, wri... | __init__ |
<|file_name|>func_module.py<|end_file_name|><|fim▁begin|>##
## Copyright 2007, Red Hat, Inc
## see AUTHORS
##
## This software may be freely redistributed under the terms of the GNU
## general public license.
##
## You should have received a copy of the GNU General Public License
## along with this program; if not, wri... | __init_log |
<|file_name|>func_module.py<|end_file_name|><|fim▁begin|>##
## Copyright 2007, Red Hat, Inc
## see AUTHORS
##
## This software may be freely redistributed under the terms of the GNU
## general public license.
##
## You should have received a copy of the GNU General Public License
## along with this program; if not, wri... | __init_options |
<|file_name|>func_module.py<|end_file_name|><|fim▁begin|>##
## Copyright 2007, Red Hat, Inc
## see AUTHORS
##
## This software may be freely redistributed under the terms of the GNU
## general public license.
##
## You should have received a copy of the GNU General Public License
## along with this program; if not, wri... | register_rpc |
<|file_name|>func_module.py<|end_file_name|><|fim▁begin|>##
## Copyright 2007, Red Hat, Inc
## see AUTHORS
##
## This software may be freely redistributed under the terms of the GNU
## general public license.
##
## You should have received a copy of the GNU General Public License
## along with this program; if not, wri... | __list_handlers |
<|file_name|>func_module.py<|end_file_name|><|fim▁begin|>##
## Copyright 2007, Red Hat, Inc
## see AUTHORS
##
## This software may be freely redistributed under the terms of the GNU
## general public license.
##
## You should have received a copy of the GNU General Public License
## along with this program; if not, wri... | __list_methods |
<|file_name|>func_module.py<|end_file_name|><|fim▁begin|>##
## Copyright 2007, Red Hat, Inc
## see AUTHORS
##
## This software may be freely redistributed under the terms of the GNU
## general public license.
##
## You should have received a copy of the GNU General Public License
## along with this program; if not, wri... | __module_version |
<|file_name|>func_module.py<|end_file_name|><|fim▁begin|>##
## Copyright 2007, Red Hat, Inc
## see AUTHORS
##
## This software may be freely redistributed under the terms of the GNU
## general public license.
##
## You should have received a copy of the GNU General Public License
## along with this program; if not, wri... | __module_api_version |
<|file_name|>func_module.py<|end_file_name|><|fim▁begin|>##
## Copyright 2007, Red Hat, Inc
## see AUTHORS
##
## This software may be freely redistributed under the terms of the GNU
## general public license.
##
## You should have received a copy of the GNU General Public License
## along with this program; if not, wri... | __module_description |
<|file_name|>func_module.py<|end_file_name|><|fim▁begin|>##
## Copyright 2007, Red Hat, Inc
## see AUTHORS
##
## This software may be freely redistributed under the terms of the GNU
## general public license.
##
## You should have received a copy of the GNU General Public License
## along with this program; if not, wri... | __is_public_valid_method |
<|file_name|>func_module.py<|end_file_name|><|fim▁begin|>##
## Copyright 2007, Red Hat, Inc
## see AUTHORS
##
## This software may be freely redistributed under the terms of the GNU
## general public license.
##
## You should have received a copy of the GNU General Public License
## along with this program; if not, wri... | __get_method_args |
<|file_name|>func_module.py<|end_file_name|><|fim▁begin|>##
## Copyright 2007, Red Hat, Inc
## see AUTHORS
##
## This software may be freely redistributed under the terms of the GNU
## general public license.
##
## You should have received a copy of the GNU General Public License
## along with this program; if not, wri... | register_method_args |
<|file_name|>wrap_matcher.py<|end_file_name|><|fim▁begin|>import six
from hamcrest.core.base_matcher import Matcher
from hamcrest.core.core.isequal import equal_to
__author__ = "Jon Reid"
__copyright__ = "Copyright 2011 hamcrest.org"
__license__ = "BSD, see License.txt"
import types
def wrap_matcher(x):
"""Wrap... | return True
if isinstance(expected_type, six.class_types): |
<|file_name|>wrap_matcher.py<|end_file_name|><|fim▁begin|>import six
from hamcrest.core.base_matcher import Matcher
from hamcrest.core.core.isequal import equal_to
__author__ = "Jon Reid"
__copyright__ = "Copyright 2011 hamcrest.org"
__license__ = "BSD, see License.txt"
import types
def wrap_matcher(x):
<|fim_m... | """Wraps argument in a matcher, if necessary.
:returns: the argument as-is if it is already a matcher, otherwise wrapped
in an :py:func:`~hamcrest.core.core.isequal.equal_to` matcher.
"""
if isinstance(x, Matcher):
return x
else:
return equal_to(x) |
<|file_name|>wrap_matcher.py<|end_file_name|><|fim▁begin|>import six
from hamcrest.core.base_matcher import Matcher
from hamcrest.core.core.isequal import equal_to
__author__ = "Jon Reid"
__copyright__ = "Copyright 2011 hamcrest.org"
__license__ = "BSD, see License.txt"
import types
def wrap_matcher(x):
"""Wrap... | if isinstance(expected_type, type):
return True
if isinstance(expected_type, six.class_types):
return True
if isinstance(expected_type, tuple) and \
expected_type and \
all(map(is_matchable_type, expected_type)):
return True
return False |
<|file_name|>wrap_matcher.py<|end_file_name|><|fim▁begin|>import six
from hamcrest.core.base_matcher import Matcher
from hamcrest.core.core.isequal import equal_to
__author__ = "Jon Reid"
__copyright__ = "Copyright 2011 hamcrest.org"
__license__ = "BSD, see License.txt"
import types
def wrap_matcher(x):
"""Wrap... | return x |
<|file_name|>wrap_matcher.py<|end_file_name|><|fim▁begin|>import six
from hamcrest.core.base_matcher import Matcher
from hamcrest.core.core.isequal import equal_to
__author__ = "Jon Reid"
__copyright__ = "Copyright 2011 hamcrest.org"
__license__ = "BSD, see License.txt"
import types
def wrap_matcher(x):
"""Wrap... | return equal_to(x) |
<|file_name|>wrap_matcher.py<|end_file_name|><|fim▁begin|>import six
from hamcrest.core.base_matcher import Matcher
from hamcrest.core.core.isequal import equal_to
__author__ = "Jon Reid"
__copyright__ = "Copyright 2011 hamcrest.org"
__license__ = "BSD, see License.txt"
import types
def wrap_matcher(x):
"""Wrap... | return True |
<|file_name|>wrap_matcher.py<|end_file_name|><|fim▁begin|>import six
from hamcrest.core.base_matcher import Matcher
from hamcrest.core.core.isequal import equal_to
__author__ = "Jon Reid"
__copyright__ = "Copyright 2011 hamcrest.org"
__license__ = "BSD, see License.txt"
import types
def wrap_matcher(x):
"""Wrap... | return True |
<|file_name|>wrap_matcher.py<|end_file_name|><|fim▁begin|>import six
from hamcrest.core.base_matcher import Matcher
from hamcrest.core.core.isequal import equal_to
__author__ = "Jon Reid"
__copyright__ = "Copyright 2011 hamcrest.org"
__license__ = "BSD, see License.txt"
import types
def wrap_matcher(x):
"""Wrap... | return True |
<|file_name|>wrap_matcher.py<|end_file_name|><|fim▁begin|>import six
from hamcrest.core.base_matcher import Matcher
from hamcrest.core.core.isequal import equal_to
__author__ = "Jon Reid"
__copyright__ = "Copyright 2011 hamcrest.org"
__license__ = "BSD, see License.txt"
import types
def <|fim_middle|>(x):
"""Wr... | wrap_matcher |
<|file_name|>wrap_matcher.py<|end_file_name|><|fim▁begin|>import six
from hamcrest.core.base_matcher import Matcher
from hamcrest.core.core.isequal import equal_to
__author__ = "Jon Reid"
__copyright__ = "Copyright 2011 hamcrest.org"
__license__ = "BSD, see License.txt"
import types
def wrap_matcher(x):
"""Wrap... | is_matchable_type |
<|file_name|>item.py<|end_file_name|><|fim▁begin|># ===============================================================================
# Copyright (C) 2010 Diego Duclos
#
# This file is part of eos.
#
# eos is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public Licens... | |
<|file_name|>browser.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# Copyright(C) 2010-2015 Julien Veyssier, Laurent Bachelier
#
# This file is part of weboob.
#
# weboob is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# th... | |
<|file_name|>browser.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# Copyright(C) 2010-2015 Julien Veyssier, Laurent Bachelier
#
# This file is part of weboob.
#
# weboob is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# th... | ENCODING = 'utf-8'
DOMAINS = ['thepiratebay.vg',
'thepiratebay.la',
'thepiratebay.mn',
'thepiratebay.gd']
def __init__(self, url, *args, **kwargs):
url = url or 'https://%s/' % random.choice(self.DOMAINS)
url_parsed = urlsplit(url)
self.P... |
<|file_name|>browser.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# Copyright(C) 2010-2015 Julien Veyssier, Laurent Bachelier
#
# This file is part of weboob.
#
# weboob is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# th... | url = url or 'https://%s/' % random.choice(self.DOMAINS)
url_parsed = urlsplit(url)
self.PROTOCOL = url_parsed.scheme
self.DOMAIN = url_parsed.netloc
self.PAGES = {
'%s://%s/' % (self.PROTOCOL, self.DOMAIN): IndexPage,
'%s://%s/search/.*/0/7/0' % (self.PRO... |
<|file_name|>browser.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# Copyright(C) 2010-2015 Julien Veyssier, Laurent Bachelier
#
# This file is part of weboob.
#
# weboob is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# th... | self.location('%s://%s/search/%s/0/7/0' % (self.PROTOCOL,
self.DOMAIN,
urllib.quote_plus(pattern.encode('utf-8'))))
assert self.is_on_page(TorrentsPage)
return self.page.iter_torrents() |
<|file_name|>browser.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# Copyright(C) 2010-2015 Julien Veyssier, Laurent Bachelier
#
# This file is part of weboob.
#
# weboob is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# th... | try:
self.location('%s://%s/torrent/%s/' % (self.PROTOCOL,
self.DOMAIN,
_id))
except BrowserHTTPNotFound:
return
if self.is_on_page(TorrentPage):
return self.... |
<|file_name|>browser.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# Copyright(C) 2010-2015 Julien Veyssier, Laurent Bachelier
#
# This file is part of weboob.
#
# weboob is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# th... | return self.page.get_torrent(_id) |
<|file_name|>browser.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# Copyright(C) 2010-2015 Julien Veyssier, Laurent Bachelier
#
# This file is part of weboob.
#
# weboob is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# th... | __init__ |
<|file_name|>browser.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# Copyright(C) 2010-2015 Julien Veyssier, Laurent Bachelier
#
# This file is part of weboob.
#
# weboob is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# th... | iter_torrents |
<|file_name|>browser.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# Copyright(C) 2010-2015 Julien Veyssier, Laurent Bachelier
#
# This file is part of weboob.
#
# weboob is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# th... | get_torrent |
<|file_name|>views.py<|end_file_name|><|fim▁begin|>from rest_framework import generics, permissions, views, response,status
from .models import Account
from .serializers import AccountCreateSerializer, AccountSerializer, AuthenticateSerializer, \
UpdateAccountSerializer, AccountRetrieveSerializer
# Create your vi... |
class AccountRetrieveView(generics.RetrieveAPIView):
queryset = Account.objects.all() |
<|file_name|>views.py<|end_file_name|><|fim▁begin|>from rest_framework import generics, permissions, views, response,status
from .models import Account
from .serializers import AccountCreateSerializer, AccountSerializer, AuthenticateSerializer, \
UpdateAccountSerializer, AccountRetrieveSerializer
# Create your vi... | queryset = Account.objects.all()
serializer_class = AccountCreateSerializer
permission_classes = [permissions.AllowAny] |
<|file_name|>views.py<|end_file_name|><|fim▁begin|>from rest_framework import generics, permissions, views, response,status
from .models import Account
from .serializers import AccountCreateSerializer, AccountSerializer, AuthenticateSerializer, \
UpdateAccountSerializer, AccountRetrieveSerializer
# Create your vi... | queryset = Account.objects.all()
serializer_class = AccountSerializer
permission_classes = [permissions.IsAuthenticated] |
<|file_name|>views.py<|end_file_name|><|fim▁begin|>from rest_framework import generics, permissions, views, response,status
from .models import Account
from .serializers import AccountCreateSerializer, AccountSerializer, AuthenticateSerializer, \
UpdateAccountSerializer, AccountRetrieveSerializer
# Create your vi... | queryset = Account.objects.all()
serializer_class = AccountRetrieveSerializer |
<|file_name|>views.py<|end_file_name|><|fim▁begin|>from rest_framework import generics, permissions, views, response,status
from .models import Account
from .serializers import AccountCreateSerializer, AccountSerializer, AuthenticateSerializer, \
UpdateAccountSerializer, AccountRetrieveSerializer
# Create your vi... | queryset = Account.objects.all()
serializer_class = UpdateAccountSerializer
# permission_classes = [permissions.IsAuthenticated] |
<|file_name|>views.py<|end_file_name|><|fim▁begin|>from rest_framework import generics, permissions, views, response,status
from .models import Account
from .serializers import AccountCreateSerializer, AccountSerializer, AuthenticateSerializer, \
UpdateAccountSerializer, AccountRetrieveSerializer
# Create your vi... | queryset = Account.objects.all()
serializer_class = AuthenticateSerializer
def post(self, request):
data = request.data
serializer = AuthenticateSerializer(data=data)
if serializer.is_valid(raise_exception=True):
new_date = serializer.data
return response.Res... |
<|file_name|>views.py<|end_file_name|><|fim▁begin|>from rest_framework import generics, permissions, views, response,status
from .models import Account
from .serializers import AccountCreateSerializer, AccountSerializer, AuthenticateSerializer, \
UpdateAccountSerializer, AccountRetrieveSerializer
# Create your vi... | data = request.data
serializer = AuthenticateSerializer(data=data)
if serializer.is_valid(raise_exception=True):
new_date = serializer.data
return response.Response(new_date,status=status.HTTP_200_OK)
return response.Response(serializer.errors, status=status.HTTP_... |
<|file_name|>views.py<|end_file_name|><|fim▁begin|>from rest_framework import generics, permissions, views, response,status
from .models import Account
from .serializers import AccountCreateSerializer, AccountSerializer, AuthenticateSerializer, \
UpdateAccountSerializer, AccountRetrieveSerializer
# Create your vi... | new_date = serializer.data
return response.Response(new_date,status=status.HTTP_200_OK) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.