prompt
large_stringlengths
72
9.34k
completion
large_stringlengths
0
7.61k
<|file_name|>setup.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python from distutils.core import setup<|fim▁hole|> from dangagearman import __version__ as version setup( name = 'danga-gearman', version = version, description = 'Client for the Danga (Perl) Gearman implementation', author = 'Samuel S...
<|file_name|>keystone.py<|end_file_name|><|fim▁begin|># # 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.apache.org/licenses/LICENSE-2.0 # # Unless required by...
for domain_obj in domain_list: if domain_obj.name == domain: return domain_obj.id
<|file_name|>keystone.py<|end_file_name|><|fim▁begin|># # 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.apache.org/licenses/LICENSE-2.0 # # Unless required by...
exceptions_module = exceptions service_types = [IDENTITY] = ['identity'] def _create(self): return hkc.KeystoneClient(self.context) def is_not_found(self, ex): return isinstance(ex, exceptions.NotFound) def is_over_limit(self, ex): return isinstance(ex, exceptions.Request...
<|file_name|>keystone.py<|end_file_name|><|fim▁begin|># # 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.apache.org/licenses/LICENSE-2.0 # # Unless required by...
return hkc.KeystoneClient(self.context)
<|file_name|>keystone.py<|end_file_name|><|fim▁begin|># # 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.apache.org/licenses/LICENSE-2.0 # # Unless required by...
return isinstance(ex, exceptions.NotFound)
<|file_name|>keystone.py<|end_file_name|><|fim▁begin|># # 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.apache.org/licenses/LICENSE-2.0 # # Unless required by...
return isinstance(ex, exceptions.RequestEntityTooLarge)
<|file_name|>keystone.py<|end_file_name|><|fim▁begin|># # 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.apache.org/licenses/LICENSE-2.0 # # Unless required by...
return isinstance(ex, exceptions.Conflict)
<|file_name|>keystone.py<|end_file_name|><|fim▁begin|># # 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.apache.org/licenses/LICENSE-2.0 # # Unless required by...
try: role_obj = self.client().client.roles.get(role) return role_obj.id except exceptions.NotFound: role_list = self.client().client.roles.list(name=role) for role_obj in role_list: if role_obj.name == role: return role_...
<|file_name|>keystone.py<|end_file_name|><|fim▁begin|># # 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.apache.org/licenses/LICENSE-2.0 # # Unless required by...
try: project_obj = self.client().client.projects.get(project) return project_obj.id except exceptions.NotFound: project_list = self.client().client.projects.list(name=project) for project_obj in project_list: if project_obj.name == project:...
<|file_name|>keystone.py<|end_file_name|><|fim▁begin|># # 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.apache.org/licenses/LICENSE-2.0 # # Unless required by...
try: domain_obj = self.client().client.domains.get(domain) return domain_obj.id except exceptions.NotFound: domain_list = self.client().client.domains.list(name=domain) for domain_obj in domain_list: if domain_obj.name == domain: ...
<|file_name|>keystone.py<|end_file_name|><|fim▁begin|># # 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.apache.org/licenses/LICENSE-2.0 # # Unless required by...
try: group_obj = self.client().client.groups.get(group) return group_obj.id except exceptions.NotFound: group_list = self.client().client.groups.list(name=group) for group_obj in group_list: if group_obj.name == group: r...
<|file_name|>keystone.py<|end_file_name|><|fim▁begin|># # 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.apache.org/licenses/LICENSE-2.0 # # Unless required by...
try: service_obj = self.client().client.services.get(service) return service_obj.id except exceptions.NotFound: service_list = self.client().client.services.list(name=service) if len(service_list) == 1: return service_list[0].id ...
<|file_name|>keystone.py<|end_file_name|><|fim▁begin|># # 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.apache.org/licenses/LICENSE-2.0 # # Unless required by...
try: user_obj = self.client().client.users.get(user) return user_obj.id except exceptions.NotFound: user_list = self.client().client.users.list(name=user) for user_obj in user_list: if user_obj.name == user: return user_...
<|file_name|>keystone.py<|end_file_name|><|fim▁begin|># # 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.apache.org/licenses/LICENSE-2.0 # # Unless required by...
expected_exceptions = (exception.EntityNotFound,) def validate_with_client(self, client, role): client.client_plugin('keystone').get_role_id(role)
<|file_name|>keystone.py<|end_file_name|><|fim▁begin|># # 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.apache.org/licenses/LICENSE-2.0 # # Unless required by...
client.client_plugin('keystone').get_role_id(role)
<|file_name|>keystone.py<|end_file_name|><|fim▁begin|># # 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.apache.org/licenses/LICENSE-2.0 # # Unless required by...
expected_exceptions = (exception.EntityNotFound,) def validate_with_client(self, client, domain): client.client_plugin('keystone').get_domain_id(domain)
<|file_name|>keystone.py<|end_file_name|><|fim▁begin|># # 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.apache.org/licenses/LICENSE-2.0 # # Unless required by...
client.client_plugin('keystone').get_domain_id(domain)
<|file_name|>keystone.py<|end_file_name|><|fim▁begin|># # 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.apache.org/licenses/LICENSE-2.0 # # Unless required by...
expected_exceptions = (exception.EntityNotFound,) def validate_with_client(self, client, project): client.client_plugin('keystone').get_project_id(project)
<|file_name|>keystone.py<|end_file_name|><|fim▁begin|># # 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.apache.org/licenses/LICENSE-2.0 # # Unless required by...
client.client_plugin('keystone').get_project_id(project)
<|file_name|>keystone.py<|end_file_name|><|fim▁begin|># # 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.apache.org/licenses/LICENSE-2.0 # # Unless required by...
expected_exceptions = (exception.EntityNotFound,) def validate_with_client(self, client, group): client.client_plugin('keystone').get_group_id(group)
<|file_name|>keystone.py<|end_file_name|><|fim▁begin|># # 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.apache.org/licenses/LICENSE-2.0 # # Unless required by...
client.client_plugin('keystone').get_group_id(group)
<|file_name|>keystone.py<|end_file_name|><|fim▁begin|># # 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.apache.org/licenses/LICENSE-2.0 # # Unless required by...
expected_exceptions = (exception.EntityNotFound, exception.KeystoneServiceNameConflict,) def validate_with_client(self, client, service): client.client_plugin('keystone').get_service_id(service)
<|file_name|>keystone.py<|end_file_name|><|fim▁begin|># # 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.apache.org/licenses/LICENSE-2.0 # # Unless required by...
client.client_plugin('keystone').get_service_id(service)
<|file_name|>keystone.py<|end_file_name|><|fim▁begin|># # 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.apache.org/licenses/LICENSE-2.0 # # Unless required by...
expected_exceptions = (exception.EntityNotFound,) def validate_with_client(self, client, user): client.client_plugin('keystone').get_user_id(user)
<|file_name|>keystone.py<|end_file_name|><|fim▁begin|># # 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.apache.org/licenses/LICENSE-2.0 # # Unless required by...
client.client_plugin('keystone').get_user_id(user)
<|file_name|>keystone.py<|end_file_name|><|fim▁begin|># # 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.apache.org/licenses/LICENSE-2.0 # # Unless required by...
return role_obj.id
<|file_name|>keystone.py<|end_file_name|><|fim▁begin|># # 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.apache.org/licenses/LICENSE-2.0 # # Unless required by...
return project_obj.id
<|file_name|>keystone.py<|end_file_name|><|fim▁begin|># # 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.apache.org/licenses/LICENSE-2.0 # # Unless required by...
return domain_obj.id
<|file_name|>keystone.py<|end_file_name|><|fim▁begin|># # 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.apache.org/licenses/LICENSE-2.0 # # Unless required by...
return group_obj.id
<|file_name|>keystone.py<|end_file_name|><|fim▁begin|># # 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.apache.org/licenses/LICENSE-2.0 # # Unless required by...
return service_list[0].id
<|file_name|>keystone.py<|end_file_name|><|fim▁begin|># # 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.apache.org/licenses/LICENSE-2.0 # # Unless required by...
raise exception.KeystoneServiceNameConflict(service=service)
<|file_name|>keystone.py<|end_file_name|><|fim▁begin|># # 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.apache.org/licenses/LICENSE-2.0 # # Unless required by...
raise exception.EntityNotFound(entity='KeystoneService', name=service)
<|file_name|>keystone.py<|end_file_name|><|fim▁begin|># # 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.apache.org/licenses/LICENSE-2.0 # # Unless required by...
return user_obj.id
<|file_name|>keystone.py<|end_file_name|><|fim▁begin|># # 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.apache.org/licenses/LICENSE-2.0 # # Unless required by...
_create
<|file_name|>keystone.py<|end_file_name|><|fim▁begin|># # 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.apache.org/licenses/LICENSE-2.0 # # Unless required by...
is_not_found
<|file_name|>keystone.py<|end_file_name|><|fim▁begin|># # 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.apache.org/licenses/LICENSE-2.0 # # Unless required by...
is_over_limit
<|file_name|>keystone.py<|end_file_name|><|fim▁begin|># # 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.apache.org/licenses/LICENSE-2.0 # # Unless required by...
is_conflict
<|file_name|>keystone.py<|end_file_name|><|fim▁begin|># # 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.apache.org/licenses/LICENSE-2.0 # # Unless required by...
get_role_id
<|file_name|>keystone.py<|end_file_name|><|fim▁begin|># # 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.apache.org/licenses/LICENSE-2.0 # # Unless required by...
get_project_id
<|file_name|>keystone.py<|end_file_name|><|fim▁begin|># # 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.apache.org/licenses/LICENSE-2.0 # # Unless required by...
get_domain_id
<|file_name|>keystone.py<|end_file_name|><|fim▁begin|># # 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.apache.org/licenses/LICENSE-2.0 # # Unless required by...
get_group_id
<|file_name|>keystone.py<|end_file_name|><|fim▁begin|># # 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.apache.org/licenses/LICENSE-2.0 # # Unless required by...
get_service_id
<|file_name|>keystone.py<|end_file_name|><|fim▁begin|># # 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.apache.org/licenses/LICENSE-2.0 # # Unless required by...
get_user_id
<|file_name|>keystone.py<|end_file_name|><|fim▁begin|># # 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.apache.org/licenses/LICENSE-2.0 # # Unless required by...
validate_with_client
<|file_name|>keystone.py<|end_file_name|><|fim▁begin|># # 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.apache.org/licenses/LICENSE-2.0 # # Unless required by...
validate_with_client
<|file_name|>keystone.py<|end_file_name|><|fim▁begin|># # 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.apache.org/licenses/LICENSE-2.0 # # Unless required by...
validate_with_client
<|file_name|>keystone.py<|end_file_name|><|fim▁begin|># # 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.apache.org/licenses/LICENSE-2.0 # # Unless required by...
validate_with_client
<|file_name|>keystone.py<|end_file_name|><|fim▁begin|># # 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.apache.org/licenses/LICENSE-2.0 # # Unless required by...
validate_with_client
<|file_name|>keystone.py<|end_file_name|><|fim▁begin|># # 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.apache.org/licenses/LICENSE-2.0 # # Unless required by...
validate_with_client
<|file_name|>switch.py<|end_file_name|><|fim▁begin|>"""Support for Zigbee switches.""" import voluptuous as vol from homeassistant.components.switch import SwitchDevice from homeassistant.components.zigbee import ( ZigBeeDigitalOut, ZigBeeDigitalOutConfig, PLATFORM_SCHEMA) DEPENDENCIES = ['zigbee'] CONF_ON_STATE...
})
<|file_name|>switch.py<|end_file_name|><|fim▁begin|>"""Support for Zigbee switches.""" import voluptuous as vol from homeassistant.components.switch import SwitchDevice from homeassistant.components.zigbee import ( ZigBeeDigitalOut, ZigBeeDigitalOutConfig, PLATFORM_SCHEMA) DEPENDENCIES = ['zigbee'] CONF_ON_STATE...
"""Set up the Zigbee switch platform.""" add_entities([ZigBeeSwitch(hass, ZigBeeDigitalOutConfig(config))])
<|file_name|>switch.py<|end_file_name|><|fim▁begin|>"""Support for Zigbee switches.""" import voluptuous as vol from homeassistant.components.switch import SwitchDevice from homeassistant.components.zigbee import ( ZigBeeDigitalOut, ZigBeeDigitalOutConfig, PLATFORM_SCHEMA) DEPENDENCIES = ['zigbee'] CONF_ON_STATE...
"""Representation of a Zigbee Digital Out device.""" pass
<|file_name|>switch.py<|end_file_name|><|fim▁begin|>"""Support for Zigbee switches.""" import voluptuous as vol from homeassistant.components.switch import SwitchDevice from homeassistant.components.zigbee import ( ZigBeeDigitalOut, ZigBeeDigitalOutConfig, PLATFORM_SCHEMA) DEPENDENCIES = ['zigbee'] CONF_ON_STATE...
setup_platform
<|file_name|>saltfpringfilter.py<|end_file_name|><|fim▁begin|>################################# LICENSE ################################## # Copyright (c) 2009, South African Astronomical Observatory (SAAO) # # All rights reserved. # # ...
<|file_name|>saltfpringfilter.py<|end_file_name|><|fim▁begin|>################################# LICENSE ################################## # Copyright (c) 2009, South African Astronomical Observatory (SAAO) # # All rights reserved. # # ...
""" Determines the center coordinates of a ring, bins the ring radially and computes its power spectrum, and allows the user to select a smoothing filter for the ring. """ # default parameter values are set up in the pyraf .par file. The values used are then changed if a FORTRAN config file exists and the user el...
<|file_name|>saltfpringfilter.py<|end_file_name|><|fim▁begin|>################################# LICENSE ################################## # Copyright (c) 2009, South African Astronomical Observatory (SAAO) # # All rights reserved. # # ...
configfile = configfile.strip() if len(configfile) > 0: #check exists saltsafeio.fileexists(configfile) # read updated parameters from the file array=getpfp(configfile,"axc") s=len(array) flag = array[s-1] if flag == 1: ...
<|file_name|>saltfpringfilter.py<|end_file_name|><|fim▁begin|>################################# LICENSE ################################## # Copyright (c) 2009, South African Astronomical Observatory (SAAO) # # All rights reserved. # # ...
saltsafeio.fileexists(configfile) # read updated parameters from the file array=getpfp(configfile,"axc") s=len(array) flag = array[s-1] if flag == 1: axc=float(array[0]) array=getpfp(configfile,"ayc") s=len(array) ...
<|file_name|>saltfpringfilter.py<|end_file_name|><|fim▁begin|>################################# LICENSE ################################## # Copyright (c) 2009, South African Astronomical Observatory (SAAO) # # All rights reserved. # # ...
axc=float(array[0])
<|file_name|>saltfpringfilter.py<|end_file_name|><|fim▁begin|>################################# LICENSE ################################## # Copyright (c) 2009, South African Astronomical Observatory (SAAO) # # All rights reserved. # # ...
ayc=float(array[0])
<|file_name|>saltfpringfilter.py<|end_file_name|><|fim▁begin|>################################# LICENSE ################################## # Copyright (c) 2009, South African Astronomical Observatory (SAAO) # # All rights reserved. # # ...
arad=float(array[0])
<|file_name|>saltfpringfilter.py<|end_file_name|><|fim▁begin|>################################# LICENSE ################################## # Copyright (c) 2009, South African Astronomical Observatory (SAAO) # # All rights reserved. # # ...
rxc=float(array[0])
<|file_name|>saltfpringfilter.py<|end_file_name|><|fim▁begin|>################################# LICENSE ################################## # Copyright (c) 2009, South African Astronomical Observatory (SAAO) # # All rights reserved. # # ...
ryc=float(array[0])
<|file_name|>saltfpringfilter.py<|end_file_name|><|fim▁begin|>################################# LICENSE ################################## # Copyright (c) 2009, South African Astronomical Observatory (SAAO) # # All rights reserved. # # ...
filterwidth=int(array[0])
<|file_name|>saltfpringfilter.py<|end_file_name|><|fim▁begin|>################################# LICENSE ################################## # Copyright (c) 2009, South African Astronomical Observatory (SAAO) # # All rights reserved. # # ...
filterfreq=int(array[0])
<|file_name|>saltfpringfilter.py<|end_file_name|><|fim▁begin|>################################# LICENSE ################################## # Copyright (c) 2009, South African Astronomical Observatory (SAAO) # # All rights reserved. # # ...
itmax=int(array[0])
<|file_name|>saltfpringfilter.py<|end_file_name|><|fim▁begin|>################################# LICENSE ################################## # Copyright (c) 2009, South African Astronomical Observatory (SAAO) # # All rights reserved. # # ...
conv=float(array[0])
<|file_name|>saltfpringfilter.py<|end_file_name|><|fim▁begin|>################################# LICENSE ################################## # Copyright (c) 2009, South African Astronomical Observatory (SAAO) # # All rights reserved. # # ...
fitwidth=float(array[0])
<|file_name|>saltfpringfilter.py<|end_file_name|><|fim▁begin|>################################# LICENSE ################################## # Copyright (c) 2009, South African Astronomical Observatory (SAAO) # # All rights reserved. # # ...
logfile = baselog
<|file_name|>saltfpringfilter.py<|end_file_name|><|fim▁begin|>################################# LICENSE ################################## # Copyright (c) 2009, South African Astronomical Observatory (SAAO) # # All rights reserved. # # ...
saltsafeio.fileexists(image) infile = image
<|file_name|>saltfpringfilter.py<|end_file_name|><|fim▁begin|>################################# LICENSE ################################## # Copyright (c) 2009, South African Astronomical Observatory (SAAO) # # All rights reserved. # # ...
raise SaltIOError(basein + ' list input instead of a file' )
<|file_name|>saltfpringfilter.py<|end_file_name|><|fim▁begin|>################################# LICENSE ################################## # Copyright (c) 2009, South African Astronomical Observatory (SAAO) # # All rights reserved. # # ...
dir = pathin
<|file_name|>saltfpringfilter.py<|end_file_name|><|fim▁begin|>################################# LICENSE ################################## # Copyright (c) 2009, South African Astronomical Observatory (SAAO) # # All rights reserved. # # ...
dir = './'
<|file_name|>saltfpringfilter.py<|end_file_name|><|fim▁begin|>################################# LICENSE ################################## # Copyright (c) 2009, South African Astronomical Observatory (SAAO) # # All rights reserved. # # ...
saltfpringfilter
<|file_name|>decorator.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python """ Since functions are function instances you can wrap them Allow you to - modify arguments - modify function - modify results """ call_count = 0 def count(func): def wrapper(*args, **kw): global call_count call_count += 1 ...
- caching
<|file_name|>decorator.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python """ Since functions are function instances you can wrap them Allow you to - modify arguments - modify function - modify results """ call_count = 0 def count(func): <|fim_middle|> def hello(): print 'Invoked hello' hello = count(hello) ##...
def wrapper(*args, **kw): global call_count call_count += 1 return func(*args, **kw) return wrapper
<|file_name|>decorator.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python """ Since functions are function instances you can wrap them Allow you to - modify arguments - modify function - modify results """ call_count = 0 def count(func): def wrapper(*args, **kw): <|fim_middle|> return wrapper def hell...
global call_count call_count += 1 return func(*args, **kw)
<|file_name|>decorator.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python """ Since functions are function instances you can wrap them Allow you to - modify arguments - modify function - modify results """ call_count = 0 def count(func): def wrapper(*args, **kw): global call_count call_count += 1 ...
print 'Invoked hello'
<|file_name|>decorator.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python """ Since functions are function instances you can wrap them Allow you to - modify arguments - modify function - modify results """ call_count = 0 def count(func): def wrapper(*args, **kw): global call_count call_count += 1 ...
""" decorator to change cwd to directory containing rst for this function """ def wrapper(*args, **kw): cur_dir = os.getcwd() found = False for arg in sys.argv: if arg.endswith(".rst"): found = arg break if found: directory = os.path.dirname(arg) if directory: os.chdir(directory) data...
<|file_name|>decorator.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python """ Since functions are function instances you can wrap them Allow you to - modify arguments - modify function - modify results """ call_count = 0 def count(func): def wrapper(*args, **kw): global call_count call_count += 1 ...
cur_dir = os.getcwd() found = False for arg in sys.argv: if arg.endswith(".rst"): found = arg break if found: directory = os.path.dirname(arg) if directory: os.chdir(directory) data = func(*args, **kw) os.chdir(cur_dir) return data
<|file_name|>decorator.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python """ Since functions are function instances you can wrap them Allow you to - modify arguments - modify function - modify results """ call_count = 0 def count(func): def wrapper(*args, **kw): global call_count call_count += 1 ...
""" yeild files found in base_dir """ for name in os.listdir(base_dir): filepath = os.path.join(base_dir, name) if os.path.isdir(filepath) and recurse: for child in find_files(filepath, recurse): yield child else: yield filepath
<|file_name|>decorator.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python """ Since functions are function instances you can wrap them Allow you to - modify arguments - modify function - modify results """ call_count = 0 def count(func): def wrapper(*args, **kw): global call_count call_count += 1 ...
found = arg break
<|file_name|>decorator.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python """ Since functions are function instances you can wrap them Allow you to - modify arguments - modify function - modify results """ call_count = 0 def count(func): def wrapper(*args, **kw): global call_count call_count += 1 ...
directory = os.path.dirname(arg) if directory: os.chdir(directory)
<|file_name|>decorator.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python """ Since functions are function instances you can wrap them Allow you to - modify arguments - modify function - modify results """ call_count = 0 def count(func): def wrapper(*args, **kw): global call_count call_count += 1 ...
os.chdir(directory)
<|file_name|>decorator.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python """ Since functions are function instances you can wrap them Allow you to - modify arguments - modify function - modify results """ call_count = 0 def count(func): def wrapper(*args, **kw): global call_count call_count += 1 ...
for child in find_files(filepath, recurse): yield child
<|file_name|>decorator.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python """ Since functions are function instances you can wrap them Allow you to - modify arguments - modify function - modify results """ call_count = 0 def count(func): def wrapper(*args, **kw): global call_count call_count += 1 ...
yield filepath
<|file_name|>decorator.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python """ Since functions are function instances you can wrap them Allow you to - modify arguments - modify function - modify results """ call_count = 0 def <|fim_middle|>(func): def wrapper(*args, **kw): global call_count call_coun...
count
<|file_name|>decorator.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python """ Since functions are function instances you can wrap them Allow you to - modify arguments - modify function - modify results """ call_count = 0 def count(func): def <|fim_middle|>(*args, **kw): global call_count call_count ...
wrapper
<|file_name|>decorator.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python """ Since functions are function instances you can wrap them Allow you to - modify arguments - modify function - modify results """ call_count = 0 def count(func): def wrapper(*args, **kw): global call_count call_count += 1 ...
hello
<|file_name|>decorator.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python """ Since functions are function instances you can wrap them Allow you to - modify arguments - modify function - modify results """ call_count = 0 def count(func): def wrapper(*args, **kw): global call_count call_count += 1 ...
cwd_decorator
<|file_name|>decorator.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python """ Since functions are function instances you can wrap them Allow you to - modify arguments - modify function - modify results """ call_count = 0 def count(func): def wrapper(*args, **kw): global call_count call_count += 1 ...
wrapper
<|file_name|>decorator.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python """ Since functions are function instances you can wrap them Allow you to - modify arguments - modify function - modify results """ call_count = 0 def count(func): def wrapper(*args, **kw): global call_count call_count += 1 ...
find_files
<|file_name|>const.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- __author__ = 'LIWEI240' """<|fim▁hole|>Constants definition """ class Const(object): class RetCode(object): OK = 0 InvalidParam = -1 NotExist = -2 ParseError = -3<|fim▁end|>
<|file_name|>const.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- __author__ = 'LIWEI240' """ Constants definition """ class Const(object): <|fim_middle|> <|fim▁end|>
class RetCode(object): OK = 0 InvalidParam = -1 NotExist = -2 ParseError = -3
<|file_name|>const.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- __author__ = 'LIWEI240' """ Constants definition """ class Const(object): class RetCode(object): <|fim_middle|> <|fim▁end|>
OK = 0 InvalidParam = -1 NotExist = -2 ParseError = -3
<|file_name|>utils.py<|end_file_name|><|fim▁begin|># (c) Copyright 2013 Hewlett-Packard Development Company, L.P. # All Rights Reserved. # # 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 Li...
raise ValueError() except ValueError: message = _(
<|file_name|>utils.py<|end_file_name|><|fim▁begin|># (c) Copyright 2013 Hewlett-Packard Development Company, L.P. # All Rights Reserved. # # 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 Li...
for key, value in dpd_dict.items(): if key not in dpd_supported_keys: message = _( "DPD Dictionary KeyError: " "Reason-Invalid DPD key : " "'%(key)s' not in %(supported_key)s ") % { 'key': key, 'supported_key': dpd_supported_key...
<|file_name|>utils.py<|end_file_name|><|fim▁begin|># (c) Copyright 2013 Hewlett-Packard Development Company, L.P. # All Rights Reserved. # # 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 Li...
for key, value in lifetime_dict.items(): if key not in lifetime_keys: message = _( "Lifetime Dictionary KeyError: " "Reason-Invalid unit key : " "'%(key)s' not in %(supported_key)s ") % { 'key': key, 'supported_key': lifetime_ke...
<|file_name|>utils.py<|end_file_name|><|fim▁begin|># (c) Copyright 2013 Hewlett-Packard Development Company, L.P. # All Rights Reserved. # # 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 Li...
lifetime = _("%s lifetime attributes. " "'units'-seconds, default:seconds. " "'value'-non negative integer, default:3600.") % policy return lifetime
<|file_name|>utils.py<|end_file_name|><|fim▁begin|># (c) Copyright 2013 Hewlett-Packard Development Company, L.P. # All Rights Reserved. # # 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 Li...
dpd = _(" %s Dead Peer Detection attributes." " 'action'-hold,clear,disabled,restart,restart-by-peer." " 'interval' and 'timeout' are non negative integers. " " 'interval' should be less than 'timeout' value. " " 'action', default:hold 'interval', default:30, " ...
<|file_name|>utils.py<|end_file_name|><|fim▁begin|># (c) Copyright 2013 Hewlett-Packard Development Company, L.P. # All Rights Reserved. # # 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 Li...
message = _( "DPD Dictionary KeyError: " "Reason-Invalid DPD key : " "'%(key)s' not in %(supported_key)s ") % { 'key': key, 'supported_key': dpd_supported_keys} raise exceptions.CommandError(message)